2
0

pdf.worker.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184
  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 (data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function (data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function (data) {
  87. return WorkerMessageHandler.createDocumentHandler(data, port);
  88. });
  89. }
  90. static createDocumentHandler(docParams, port) {
  91. let pdfManager;
  92. let terminated = false;
  93. let cancelXHRs = null;
  94. const WorkerTasks = [];
  95. const verbosity = (0, _util.getVerbosityLevel)();
  96. const {
  97. docId,
  98. apiVersion
  99. } = docParams;
  100. const workerVersion = '3.2.146';
  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. 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. }).catch(function (e) {
  254. pdfManagerCapability.reject(e);
  255. cancelXHRs = null;
  256. });
  257. cancelXHRs = function (reason) {
  258. pdfStream.cancelAllRequests(reason);
  259. };
  260. return pdfManagerCapability.promise;
  261. }
  262. function setupDoc(data) {
  263. function onSuccess(doc) {
  264. ensureNotTerminated();
  265. handler.send("GetDoc", {
  266. pdfInfo: doc
  267. });
  268. }
  269. function onFailure(ex) {
  270. ensureNotTerminated();
  271. if (ex instanceof _util.PasswordException) {
  272. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  273. startWorkerTask(task);
  274. handler.sendWithPromise("PasswordRequest", ex).then(function (_ref3) {
  275. let {
  276. password
  277. } = _ref3;
  278. finishWorkerTask(task);
  279. pdfManager.updatePassword(password);
  280. pdfManagerReady();
  281. }).catch(function () {
  282. finishWorkerTask(task);
  283. handler.send("DocException", ex);
  284. });
  285. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  286. handler.send("DocException", ex);
  287. } else {
  288. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  289. }
  290. }
  291. function pdfManagerReady() {
  292. ensureNotTerminated();
  293. loadDocument(false).then(onSuccess, function (reason) {
  294. ensureNotTerminated();
  295. if (!(reason instanceof _core_utils.XRefParseException)) {
  296. onFailure(reason);
  297. return;
  298. }
  299. pdfManager.requestLoadedStream().then(function () {
  300. ensureNotTerminated();
  301. loadDocument(true).then(onSuccess, onFailure);
  302. });
  303. });
  304. }
  305. ensureNotTerminated();
  306. getPdfManager(data).then(function (newPdfManager) {
  307. if (terminated) {
  308. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  309. throw new Error("Worker was terminated");
  310. }
  311. pdfManager = newPdfManager;
  312. pdfManager.requestLoadedStream(true).then(stream => {
  313. handler.send("DataLoaded", {
  314. length: stream.bytes.byteLength
  315. });
  316. });
  317. }).then(pdfManagerReady, onFailure);
  318. }
  319. handler.on("GetPage", function (data) {
  320. return pdfManager.getPage(data.pageIndex).then(function (page) {
  321. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function (_ref4) {
  322. let [rotate, ref, userUnit, view] = _ref4;
  323. return {
  324. rotate,
  325. ref,
  326. userUnit,
  327. view
  328. };
  329. });
  330. });
  331. });
  332. handler.on("GetPageIndex", function (data) {
  333. const pageRef = _primitives.Ref.get(data.num, data.gen);
  334. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  335. });
  336. handler.on("GetDestinations", function (data) {
  337. return pdfManager.ensureCatalog("destinations");
  338. });
  339. handler.on("GetDestination", function (data) {
  340. return pdfManager.ensureCatalog("getDestination", [data.id]);
  341. });
  342. handler.on("GetPageLabels", function (data) {
  343. return pdfManager.ensureCatalog("pageLabels");
  344. });
  345. handler.on("GetPageLayout", function (data) {
  346. return pdfManager.ensureCatalog("pageLayout");
  347. });
  348. handler.on("GetPageMode", function (data) {
  349. return pdfManager.ensureCatalog("pageMode");
  350. });
  351. handler.on("GetViewerPreferences", function (data) {
  352. return pdfManager.ensureCatalog("viewerPreferences");
  353. });
  354. handler.on("GetOpenAction", function (data) {
  355. return pdfManager.ensureCatalog("openAction");
  356. });
  357. handler.on("GetAttachments", function (data) {
  358. return pdfManager.ensureCatalog("attachments");
  359. });
  360. handler.on("GetJavaScript", function (data) {
  361. return pdfManager.ensureCatalog("javaScript");
  362. });
  363. handler.on("GetDocJSActions", function (data) {
  364. return pdfManager.ensureCatalog("jsActions");
  365. });
  366. handler.on("GetPageJSActions", function (_ref5) {
  367. let {
  368. pageIndex
  369. } = _ref5;
  370. return pdfManager.getPage(pageIndex).then(function (page) {
  371. return pdfManager.ensure(page, "jsActions");
  372. });
  373. });
  374. handler.on("GetOutline", function (data) {
  375. return pdfManager.ensureCatalog("documentOutline");
  376. });
  377. handler.on("GetOptionalContentConfig", function (data) {
  378. return pdfManager.ensureCatalog("optionalContentConfig");
  379. });
  380. handler.on("GetPermissions", function (data) {
  381. return pdfManager.ensureCatalog("permissions");
  382. });
  383. handler.on("GetMetadata", function (data) {
  384. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  385. });
  386. handler.on("GetMarkInfo", function (data) {
  387. return pdfManager.ensureCatalog("markInfo");
  388. });
  389. handler.on("GetData", function (data) {
  390. return pdfManager.requestLoadedStream().then(function (stream) {
  391. return stream.bytes;
  392. });
  393. });
  394. handler.on("GetAnnotations", function (_ref6) {
  395. let {
  396. pageIndex,
  397. intent
  398. } = _ref6;
  399. return pdfManager.getPage(pageIndex).then(function (page) {
  400. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  401. startWorkerTask(task);
  402. return page.getAnnotationsData(handler, task, intent).then(data => {
  403. finishWorkerTask(task);
  404. return data;
  405. }, reason => {
  406. finishWorkerTask(task);
  407. });
  408. });
  409. });
  410. handler.on("GetFieldObjects", function (data) {
  411. return pdfManager.ensureDoc("fieldObjects");
  412. });
  413. handler.on("HasJSActions", function (data) {
  414. return pdfManager.ensureDoc("hasJSActions");
  415. });
  416. handler.on("GetCalculationOrderIds", function (data) {
  417. return pdfManager.ensureDoc("calculationOrderIds");
  418. });
  419. handler.on("SaveDocument", function (_ref7) {
  420. let {
  421. isPureXfa,
  422. numPages,
  423. annotationStorage,
  424. filename
  425. } = _ref7;
  426. const promises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  427. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  428. if (newAnnotationsByPage) {
  429. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  430. promises.push(pdfManager.getPage(pageIndex).then(page => {
  431. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  432. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  433. finishWorkerTask(task);
  434. });
  435. }));
  436. }
  437. }
  438. if (isPureXfa) {
  439. promises.push(pdfManager.serializeXfaData(annotationStorage));
  440. } else {
  441. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  442. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  443. const task = new WorkerTask(`Save: page ${pageIndex}`);
  444. return page.save(handler, task, annotationStorage).finally(function () {
  445. finishWorkerTask(task);
  446. });
  447. }));
  448. }
  449. }
  450. return Promise.all(promises).then(function (_ref8) {
  451. let [stream, acroForm, acroFormRef, xref, startXRef, ...refs] = _ref8;
  452. let newRefs = [];
  453. let xfaData = null;
  454. if (isPureXfa) {
  455. xfaData = refs[0];
  456. if (!xfaData) {
  457. return stream.bytes;
  458. }
  459. } else {
  460. newRefs = refs.flat(2);
  461. if (newRefs.length === 0) {
  462. return stream.bytes;
  463. }
  464. }
  465. const needAppearances = acroFormRef && acroForm instanceof _primitives.Dict && newRefs.some(ref => ref.needAppearances);
  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. hasXfaDatasetsEntry = true;
  474. }
  475. }
  476. if (xfaDatasetsRef === null) {
  477. xfaDatasetsRef = xref.getNewTemporaryRef();
  478. }
  479. } else if (xfa) {
  480. (0, _util.warn)("Unsupported XFA type.");
  481. }
  482. let newXrefInfo = Object.create(null);
  483. if (xref.trailer) {
  484. const infoObj = Object.create(null);
  485. const xrefInfo = xref.trailer.get("Info") || null;
  486. if (xrefInfo instanceof _primitives.Dict) {
  487. xrefInfo.forEach((key, value) => {
  488. if (typeof value === "string") {
  489. infoObj[key] = (0, _util.stringToPDFString)(value);
  490. }
  491. });
  492. }
  493. newXrefInfo = {
  494. rootRef: xref.trailer.getRaw("Root") || null,
  495. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  496. newRef: xref.getNewTemporaryRef(),
  497. infoRef: xref.trailer.getRaw("Info") || null,
  498. info: infoObj,
  499. fileIds: xref.trailer.get("ID") || null,
  500. startXRef,
  501. filename
  502. };
  503. }
  504. try {
  505. return (0, _writer.incrementalUpdate)({
  506. originalData: stream.bytes,
  507. xrefInfo: newXrefInfo,
  508. newRefs,
  509. xref,
  510. hasXfa: !!xfa,
  511. xfaDatasetsRef,
  512. hasXfaDatasetsEntry,
  513. needAppearances,
  514. acroFormRef,
  515. acroForm,
  516. xfaData
  517. });
  518. } finally {
  519. xref.resetNewTemporaryRef();
  520. }
  521. });
  522. });
  523. handler.on("GetOperatorList", function (data, sink) {
  524. const pageIndex = data.pageIndex;
  525. pdfManager.getPage(pageIndex).then(function (page) {
  526. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  527. startWorkerTask(task);
  528. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  529. page.getOperatorList({
  530. handler,
  531. sink,
  532. task,
  533. intent: data.intent,
  534. cacheKey: data.cacheKey,
  535. annotationStorage: data.annotationStorage
  536. }).then(function (operatorListInfo) {
  537. finishWorkerTask(task);
  538. if (start) {
  539. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  540. }
  541. sink.close();
  542. }, function (reason) {
  543. finishWorkerTask(task);
  544. if (task.terminated) {
  545. return;
  546. }
  547. sink.error(reason);
  548. });
  549. });
  550. });
  551. handler.on("GetTextContent", function (data, sink) {
  552. const pageIndex = data.pageIndex;
  553. pdfManager.getPage(pageIndex).then(function (page) {
  554. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  555. startWorkerTask(task);
  556. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  557. page.extractTextContent({
  558. handler,
  559. task,
  560. sink,
  561. includeMarkedContent: data.includeMarkedContent,
  562. combineTextItems: data.combineTextItems
  563. }).then(function () {
  564. finishWorkerTask(task);
  565. if (start) {
  566. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  567. }
  568. sink.close();
  569. }, function (reason) {
  570. finishWorkerTask(task);
  571. if (task.terminated) {
  572. return;
  573. }
  574. sink.error(reason);
  575. });
  576. });
  577. });
  578. handler.on("GetStructTree", function (data) {
  579. return pdfManager.getPage(data.pageIndex).then(function (page) {
  580. return pdfManager.ensure(page, "getStructTree");
  581. });
  582. });
  583. handler.on("FontFallback", function (data) {
  584. return pdfManager.fontFallback(data.id, handler);
  585. });
  586. handler.on("Cleanup", function (data) {
  587. return pdfManager.cleanup(true);
  588. });
  589. handler.on("Terminate", function (data) {
  590. terminated = true;
  591. const waitOn = [];
  592. if (pdfManager) {
  593. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  594. const cleanupPromise = pdfManager.cleanup();
  595. waitOn.push(cleanupPromise);
  596. pdfManager = null;
  597. } else {
  598. (0, _cleanup_helper.clearGlobalCaches)();
  599. }
  600. if (cancelXHRs) {
  601. cancelXHRs(new _util.AbortException("Worker was terminated."));
  602. }
  603. for (const task of WorkerTasks) {
  604. waitOn.push(task.finished);
  605. task.terminate();
  606. }
  607. return Promise.all(waitOn).then(function () {
  608. handler.destroy();
  609. handler = null;
  610. });
  611. });
  612. handler.on("Ready", function (data) {
  613. setupDoc(docParams);
  614. docParams = null;
  615. });
  616. return workerHandlerName;
  617. }
  618. static initializeFromPort(port) {
  619. const handler = new _message_handler.MessageHandler("worker", "main", port);
  620. WorkerMessageHandler.setup(handler, port);
  621. handler.send("ready", null);
  622. }
  623. }
  624. exports.WorkerMessageHandler = WorkerMessageHandler;
  625. function isMessagePort(maybePort) {
  626. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  627. }
  628. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  629. WorkerMessageHandler.initializeFromPort(self);
  630. }
  631. /***/ }),
  632. /* 2 */
  633. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  634. "use strict";
  635. Object.defineProperty(exports, "__esModule", ({
  636. value: true
  637. }));
  638. 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.BASELINE_FACTOR = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  639. exports.arrayByteLength = arrayByteLength;
  640. exports.arraysToBytes = arraysToBytes;
  641. exports.assert = assert;
  642. exports.bytesToString = bytesToString;
  643. exports.createPromiseCapability = createPromiseCapability;
  644. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  645. exports.getModificationDate = getModificationDate;
  646. exports.getVerbosityLevel = getVerbosityLevel;
  647. exports.info = info;
  648. exports.isArrayBuffer = isArrayBuffer;
  649. exports.isArrayEqual = isArrayEqual;
  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.stringToUTF8String = stringToUTF8String;
  658. exports.unreachable = unreachable;
  659. exports.utf8StringToString = utf8StringToString;
  660. exports.warn = warn;
  661. if (!globalThis._pdfjsCompatibilityChecked) {
  662. globalThis._pdfjsCompatibilityChecked = true;
  663. __w_pdfjs_require__(3);
  664. }
  665. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  666. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  667. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  668. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  669. const LINE_FACTOR = 1.35;
  670. exports.LINE_FACTOR = LINE_FACTOR;
  671. const LINE_DESCENT_FACTOR = 0.35;
  672. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  673. const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
  674. exports.BASELINE_FACTOR = BASELINE_FACTOR;
  675. const RenderingIntentFlag = {
  676. ANY: 0x01,
  677. DISPLAY: 0x02,
  678. PRINT: 0x04,
  679. SAVE: 0x08,
  680. ANNOTATIONS_FORMS: 0x10,
  681. ANNOTATIONS_STORAGE: 0x20,
  682. ANNOTATIONS_DISABLE: 0x40,
  683. OPLIST: 0x100
  684. };
  685. exports.RenderingIntentFlag = RenderingIntentFlag;
  686. const AnnotationMode = {
  687. DISABLE: 0,
  688. ENABLE: 1,
  689. ENABLE_FORMS: 2,
  690. ENABLE_STORAGE: 3
  691. };
  692. exports.AnnotationMode = AnnotationMode;
  693. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  694. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  695. const AnnotationEditorType = {
  696. DISABLE: -1,
  697. NONE: 0,
  698. FREETEXT: 3,
  699. INK: 15
  700. };
  701. exports.AnnotationEditorType = AnnotationEditorType;
  702. const AnnotationEditorParamsType = {
  703. FREETEXT_SIZE: 1,
  704. FREETEXT_COLOR: 2,
  705. FREETEXT_OPACITY: 3,
  706. INK_COLOR: 11,
  707. INK_THICKNESS: 12,
  708. INK_OPACITY: 13
  709. };
  710. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  711. const PermissionFlag = {
  712. PRINT: 0x04,
  713. MODIFY_CONTENTS: 0x08,
  714. COPY: 0x10,
  715. MODIFY_ANNOTATIONS: 0x20,
  716. FILL_INTERACTIVE_FORMS: 0x100,
  717. COPY_FOR_ACCESSIBILITY: 0x200,
  718. ASSEMBLE: 0x400,
  719. PRINT_HIGH_QUALITY: 0x800
  720. };
  721. exports.PermissionFlag = PermissionFlag;
  722. const TextRenderingMode = {
  723. FILL: 0,
  724. STROKE: 1,
  725. FILL_STROKE: 2,
  726. INVISIBLE: 3,
  727. FILL_ADD_TO_PATH: 4,
  728. STROKE_ADD_TO_PATH: 5,
  729. FILL_STROKE_ADD_TO_PATH: 6,
  730. ADD_TO_PATH: 7,
  731. FILL_STROKE_MASK: 3,
  732. ADD_TO_PATH_FLAG: 4
  733. };
  734. exports.TextRenderingMode = TextRenderingMode;
  735. const ImageKind = {
  736. GRAYSCALE_1BPP: 1,
  737. RGB_24BPP: 2,
  738. RGBA_32BPP: 3
  739. };
  740. exports.ImageKind = ImageKind;
  741. const AnnotationType = {
  742. TEXT: 1,
  743. LINK: 2,
  744. FREETEXT: 3,
  745. LINE: 4,
  746. SQUARE: 5,
  747. CIRCLE: 6,
  748. POLYGON: 7,
  749. POLYLINE: 8,
  750. HIGHLIGHT: 9,
  751. UNDERLINE: 10,
  752. SQUIGGLY: 11,
  753. STRIKEOUT: 12,
  754. STAMP: 13,
  755. CARET: 14,
  756. INK: 15,
  757. POPUP: 16,
  758. FILEATTACHMENT: 17,
  759. SOUND: 18,
  760. MOVIE: 19,
  761. WIDGET: 20,
  762. SCREEN: 21,
  763. PRINTERMARK: 22,
  764. TRAPNET: 23,
  765. WATERMARK: 24,
  766. THREED: 25,
  767. REDACT: 26
  768. };
  769. exports.AnnotationType = AnnotationType;
  770. const AnnotationStateModelType = {
  771. MARKED: "Marked",
  772. REVIEW: "Review"
  773. };
  774. exports.AnnotationStateModelType = AnnotationStateModelType;
  775. const AnnotationMarkedState = {
  776. MARKED: "Marked",
  777. UNMARKED: "Unmarked"
  778. };
  779. exports.AnnotationMarkedState = AnnotationMarkedState;
  780. const AnnotationReviewState = {
  781. ACCEPTED: "Accepted",
  782. REJECTED: "Rejected",
  783. CANCELLED: "Cancelled",
  784. COMPLETED: "Completed",
  785. NONE: "None"
  786. };
  787. exports.AnnotationReviewState = AnnotationReviewState;
  788. const AnnotationReplyType = {
  789. GROUP: "Group",
  790. REPLY: "R"
  791. };
  792. exports.AnnotationReplyType = AnnotationReplyType;
  793. const AnnotationFlag = {
  794. INVISIBLE: 0x01,
  795. HIDDEN: 0x02,
  796. PRINT: 0x04,
  797. NOZOOM: 0x08,
  798. NOROTATE: 0x10,
  799. NOVIEW: 0x20,
  800. READONLY: 0x40,
  801. LOCKED: 0x80,
  802. TOGGLENOVIEW: 0x100,
  803. LOCKEDCONTENTS: 0x200
  804. };
  805. exports.AnnotationFlag = AnnotationFlag;
  806. const AnnotationFieldFlag = {
  807. READONLY: 0x0000001,
  808. REQUIRED: 0x0000002,
  809. NOEXPORT: 0x0000004,
  810. MULTILINE: 0x0001000,
  811. PASSWORD: 0x0002000,
  812. NOTOGGLETOOFF: 0x0004000,
  813. RADIO: 0x0008000,
  814. PUSHBUTTON: 0x0010000,
  815. COMBO: 0x0020000,
  816. EDIT: 0x0040000,
  817. SORT: 0x0080000,
  818. FILESELECT: 0x0100000,
  819. MULTISELECT: 0x0200000,
  820. DONOTSPELLCHECK: 0x0400000,
  821. DONOTSCROLL: 0x0800000,
  822. COMB: 0x1000000,
  823. RICHTEXT: 0x2000000,
  824. RADIOSINUNISON: 0x2000000,
  825. COMMITONSELCHANGE: 0x4000000
  826. };
  827. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  828. const AnnotationBorderStyleType = {
  829. SOLID: 1,
  830. DASHED: 2,
  831. BEVELED: 3,
  832. INSET: 4,
  833. UNDERLINE: 5
  834. };
  835. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  836. const AnnotationActionEventType = {
  837. E: "Mouse Enter",
  838. X: "Mouse Exit",
  839. D: "Mouse Down",
  840. U: "Mouse Up",
  841. Fo: "Focus",
  842. Bl: "Blur",
  843. PO: "PageOpen",
  844. PC: "PageClose",
  845. PV: "PageVisible",
  846. PI: "PageInvisible",
  847. K: "Keystroke",
  848. F: "Format",
  849. V: "Validate",
  850. C: "Calculate"
  851. };
  852. exports.AnnotationActionEventType = AnnotationActionEventType;
  853. const DocumentActionEventType = {
  854. WC: "WillClose",
  855. WS: "WillSave",
  856. DS: "DidSave",
  857. WP: "WillPrint",
  858. DP: "DidPrint"
  859. };
  860. exports.DocumentActionEventType = DocumentActionEventType;
  861. const PageActionEventType = {
  862. O: "PageOpen",
  863. C: "PageClose"
  864. };
  865. exports.PageActionEventType = PageActionEventType;
  866. const StreamType = {
  867. UNKNOWN: "UNKNOWN",
  868. FLATE: "FLATE",
  869. LZW: "LZW",
  870. DCT: "DCT",
  871. JPX: "JPX",
  872. JBIG: "JBIG",
  873. A85: "A85",
  874. AHX: "AHX",
  875. CCF: "CCF",
  876. RLX: "RLX"
  877. };
  878. exports.StreamType = StreamType;
  879. const FontType = {
  880. UNKNOWN: "UNKNOWN",
  881. TYPE1: "TYPE1",
  882. TYPE1STANDARD: "TYPE1STANDARD",
  883. TYPE1C: "TYPE1C",
  884. CIDFONTTYPE0: "CIDFONTTYPE0",
  885. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  886. TRUETYPE: "TRUETYPE",
  887. CIDFONTTYPE2: "CIDFONTTYPE2",
  888. TYPE3: "TYPE3",
  889. OPENTYPE: "OPENTYPE",
  890. TYPE0: "TYPE0",
  891. MMTYPE1: "MMTYPE1"
  892. };
  893. exports.FontType = FontType;
  894. const VerbosityLevel = {
  895. ERRORS: 0,
  896. WARNINGS: 1,
  897. INFOS: 5
  898. };
  899. exports.VerbosityLevel = VerbosityLevel;
  900. const CMapCompressionType = {
  901. NONE: 0,
  902. BINARY: 1
  903. };
  904. exports.CMapCompressionType = CMapCompressionType;
  905. const OPS = {
  906. dependency: 1,
  907. setLineWidth: 2,
  908. setLineCap: 3,
  909. setLineJoin: 4,
  910. setMiterLimit: 5,
  911. setDash: 6,
  912. setRenderingIntent: 7,
  913. setFlatness: 8,
  914. setGState: 9,
  915. save: 10,
  916. restore: 11,
  917. transform: 12,
  918. moveTo: 13,
  919. lineTo: 14,
  920. curveTo: 15,
  921. curveTo2: 16,
  922. curveTo3: 17,
  923. closePath: 18,
  924. rectangle: 19,
  925. stroke: 20,
  926. closeStroke: 21,
  927. fill: 22,
  928. eoFill: 23,
  929. fillStroke: 24,
  930. eoFillStroke: 25,
  931. closeFillStroke: 26,
  932. closeEOFillStroke: 27,
  933. endPath: 28,
  934. clip: 29,
  935. eoClip: 30,
  936. beginText: 31,
  937. endText: 32,
  938. setCharSpacing: 33,
  939. setWordSpacing: 34,
  940. setHScale: 35,
  941. setLeading: 36,
  942. setFont: 37,
  943. setTextRenderingMode: 38,
  944. setTextRise: 39,
  945. moveText: 40,
  946. setLeadingMoveText: 41,
  947. setTextMatrix: 42,
  948. nextLine: 43,
  949. showText: 44,
  950. showSpacedText: 45,
  951. nextLineShowText: 46,
  952. nextLineSetSpacingShowText: 47,
  953. setCharWidth: 48,
  954. setCharWidthAndBounds: 49,
  955. setStrokeColorSpace: 50,
  956. setFillColorSpace: 51,
  957. setStrokeColor: 52,
  958. setStrokeColorN: 53,
  959. setFillColor: 54,
  960. setFillColorN: 55,
  961. setStrokeGray: 56,
  962. setFillGray: 57,
  963. setStrokeRGBColor: 58,
  964. setFillRGBColor: 59,
  965. setStrokeCMYKColor: 60,
  966. setFillCMYKColor: 61,
  967. shadingFill: 62,
  968. beginInlineImage: 63,
  969. beginImageData: 64,
  970. endInlineImage: 65,
  971. paintXObject: 66,
  972. markPoint: 67,
  973. markPointProps: 68,
  974. beginMarkedContent: 69,
  975. beginMarkedContentProps: 70,
  976. endMarkedContent: 71,
  977. beginCompat: 72,
  978. endCompat: 73,
  979. paintFormXObjectBegin: 74,
  980. paintFormXObjectEnd: 75,
  981. beginGroup: 76,
  982. endGroup: 77,
  983. beginAnnotation: 80,
  984. endAnnotation: 81,
  985. paintImageMaskXObject: 83,
  986. paintImageMaskXObjectGroup: 84,
  987. paintImageXObject: 85,
  988. paintInlineImageXObject: 86,
  989. paintInlineImageXObjectGroup: 87,
  990. paintImageXObjectRepeat: 88,
  991. paintImageMaskXObjectRepeat: 89,
  992. paintSolidColorImageMask: 90,
  993. constructPath: 91
  994. };
  995. exports.OPS = OPS;
  996. const UNSUPPORTED_FEATURES = {
  997. forms: "forms",
  998. javaScript: "javaScript",
  999. signatures: "signatures",
  1000. smask: "smask",
  1001. shadingPattern: "shadingPattern",
  1002. errorTilingPattern: "errorTilingPattern",
  1003. errorExtGState: "errorExtGState",
  1004. errorXObject: "errorXObject",
  1005. errorFontLoadType3: "errorFontLoadType3",
  1006. errorFontState: "errorFontState",
  1007. errorFontMissing: "errorFontMissing",
  1008. errorFontTranslate: "errorFontTranslate",
  1009. errorColorSpace: "errorColorSpace",
  1010. errorOperatorList: "errorOperatorList",
  1011. errorFontToUnicode: "errorFontToUnicode",
  1012. errorFontLoadNative: "errorFontLoadNative",
  1013. errorFontBuildPath: "errorFontBuildPath",
  1014. errorFontGetPath: "errorFontGetPath",
  1015. errorMarkedContent: "errorMarkedContent",
  1016. errorContentSubStream: "errorContentSubStream"
  1017. };
  1018. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1019. const PasswordResponses = {
  1020. NEED_PASSWORD: 1,
  1021. INCORRECT_PASSWORD: 2
  1022. };
  1023. exports.PasswordResponses = PasswordResponses;
  1024. let verbosity = VerbosityLevel.WARNINGS;
  1025. function setVerbosityLevel(level) {
  1026. if (Number.isInteger(level)) {
  1027. verbosity = level;
  1028. }
  1029. }
  1030. function getVerbosityLevel() {
  1031. return verbosity;
  1032. }
  1033. function info(msg) {
  1034. if (verbosity >= VerbosityLevel.INFOS) {
  1035. console.log(`Info: ${msg}`);
  1036. }
  1037. }
  1038. function warn(msg) {
  1039. if (verbosity >= VerbosityLevel.WARNINGS) {
  1040. console.log(`Warning: ${msg}`);
  1041. }
  1042. }
  1043. function unreachable(msg) {
  1044. throw new Error(msg);
  1045. }
  1046. function assert(cond, msg) {
  1047. if (!cond) {
  1048. unreachable(msg);
  1049. }
  1050. }
  1051. function _isValidProtocol(url) {
  1052. if (!url) {
  1053. return false;
  1054. }
  1055. switch (url.protocol) {
  1056. case "http:":
  1057. case "https:":
  1058. case "ftp:":
  1059. case "mailto:":
  1060. case "tel:":
  1061. return true;
  1062. default:
  1063. return false;
  1064. }
  1065. }
  1066. function createValidAbsoluteUrl(url) {
  1067. let baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1068. let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1069. if (!url) {
  1070. return null;
  1071. }
  1072. try {
  1073. if (options && typeof url === "string") {
  1074. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1075. const dots = url.match(/\./g);
  1076. if (dots && dots.length >= 2) {
  1077. url = `http://${url}`;
  1078. }
  1079. }
  1080. if (options.tryConvertEncoding) {
  1081. try {
  1082. url = stringToUTF8String(url);
  1083. } catch (ex) {}
  1084. }
  1085. }
  1086. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1087. if (_isValidProtocol(absoluteUrl)) {
  1088. return absoluteUrl;
  1089. }
  1090. } catch (ex) {}
  1091. return null;
  1092. }
  1093. function shadow(obj, prop, value) {
  1094. let nonSerializable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  1095. Object.defineProperty(obj, prop, {
  1096. value,
  1097. enumerable: !nonSerializable,
  1098. configurable: true,
  1099. writable: false
  1100. });
  1101. return value;
  1102. }
  1103. const BaseException = function BaseExceptionClosure() {
  1104. function BaseException(message, name) {
  1105. if (this.constructor === BaseException) {
  1106. unreachable("Cannot initialize BaseException.");
  1107. }
  1108. this.message = message;
  1109. this.name = name;
  1110. }
  1111. BaseException.prototype = new Error();
  1112. BaseException.constructor = BaseException;
  1113. return BaseException;
  1114. }();
  1115. exports.BaseException = BaseException;
  1116. class PasswordException extends BaseException {
  1117. constructor(msg, code) {
  1118. super(msg, "PasswordException");
  1119. this.code = code;
  1120. }
  1121. }
  1122. exports.PasswordException = PasswordException;
  1123. class UnknownErrorException extends BaseException {
  1124. constructor(msg, details) {
  1125. super(msg, "UnknownErrorException");
  1126. this.details = details;
  1127. }
  1128. }
  1129. exports.UnknownErrorException = UnknownErrorException;
  1130. class InvalidPDFException extends BaseException {
  1131. constructor(msg) {
  1132. super(msg, "InvalidPDFException");
  1133. }
  1134. }
  1135. exports.InvalidPDFException = InvalidPDFException;
  1136. class MissingPDFException extends BaseException {
  1137. constructor(msg) {
  1138. super(msg, "MissingPDFException");
  1139. }
  1140. }
  1141. exports.MissingPDFException = MissingPDFException;
  1142. class UnexpectedResponseException extends BaseException {
  1143. constructor(msg, status) {
  1144. super(msg, "UnexpectedResponseException");
  1145. this.status = status;
  1146. }
  1147. }
  1148. exports.UnexpectedResponseException = UnexpectedResponseException;
  1149. class FormatError extends BaseException {
  1150. constructor(msg) {
  1151. super(msg, "FormatError");
  1152. }
  1153. }
  1154. exports.FormatError = FormatError;
  1155. class AbortException extends BaseException {
  1156. constructor(msg) {
  1157. super(msg, "AbortException");
  1158. }
  1159. }
  1160. exports.AbortException = AbortException;
  1161. function bytesToString(bytes) {
  1162. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1163. unreachable("Invalid argument for bytesToString");
  1164. }
  1165. const length = bytes.length;
  1166. const MAX_ARGUMENT_COUNT = 8192;
  1167. if (length < MAX_ARGUMENT_COUNT) {
  1168. return String.fromCharCode.apply(null, bytes);
  1169. }
  1170. const strBuf = [];
  1171. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1172. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1173. const chunk = bytes.subarray(i, chunkEnd);
  1174. strBuf.push(String.fromCharCode.apply(null, chunk));
  1175. }
  1176. return strBuf.join("");
  1177. }
  1178. function stringToBytes(str) {
  1179. if (typeof str !== "string") {
  1180. unreachable("Invalid argument for stringToBytes");
  1181. }
  1182. const length = str.length;
  1183. const bytes = new Uint8Array(length);
  1184. for (let i = 0; i < length; ++i) {
  1185. bytes[i] = str.charCodeAt(i) & 0xff;
  1186. }
  1187. return bytes;
  1188. }
  1189. function arrayByteLength(arr) {
  1190. if (arr.length !== undefined) {
  1191. return arr.length;
  1192. }
  1193. if (arr.byteLength !== undefined) {
  1194. return arr.byteLength;
  1195. }
  1196. unreachable("Invalid argument for arrayByteLength");
  1197. }
  1198. function arraysToBytes(arr) {
  1199. const length = arr.length;
  1200. if (length === 1 && arr[0] instanceof Uint8Array) {
  1201. return arr[0];
  1202. }
  1203. let resultLength = 0;
  1204. for (let i = 0; i < length; i++) {
  1205. resultLength += arrayByteLength(arr[i]);
  1206. }
  1207. let pos = 0;
  1208. const data = new Uint8Array(resultLength);
  1209. for (let i = 0; i < length; i++) {
  1210. let item = arr[i];
  1211. if (!(item instanceof Uint8Array)) {
  1212. if (typeof item === "string") {
  1213. item = stringToBytes(item);
  1214. } else {
  1215. item = new Uint8Array(item);
  1216. }
  1217. }
  1218. const itemLength = item.byteLength;
  1219. data.set(item, pos);
  1220. pos += itemLength;
  1221. }
  1222. return data;
  1223. }
  1224. function string32(value) {
  1225. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1226. }
  1227. function objectSize(obj) {
  1228. return Object.keys(obj).length;
  1229. }
  1230. function objectFromMap(map) {
  1231. const obj = Object.create(null);
  1232. for (const [key, value] of map) {
  1233. obj[key] = value;
  1234. }
  1235. return obj;
  1236. }
  1237. function isLittleEndian() {
  1238. const buffer8 = new Uint8Array(4);
  1239. buffer8[0] = 1;
  1240. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1241. return view32[0] === 1;
  1242. }
  1243. function isEvalSupported() {
  1244. try {
  1245. new Function("");
  1246. return true;
  1247. } catch (e) {
  1248. return false;
  1249. }
  1250. }
  1251. class FeatureTest {
  1252. static get isLittleEndian() {
  1253. return shadow(this, "isLittleEndian", isLittleEndian());
  1254. }
  1255. static get isEvalSupported() {
  1256. return shadow(this, "isEvalSupported", isEvalSupported());
  1257. }
  1258. static get isOffscreenCanvasSupported() {
  1259. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1260. }
  1261. static get platform() {
  1262. if (typeof navigator === "undefined") {
  1263. return shadow(this, "platform", {
  1264. isWin: false,
  1265. isMac: false
  1266. });
  1267. }
  1268. return shadow(this, "platform", {
  1269. isWin: navigator.platform.includes("Win"),
  1270. isMac: navigator.platform.includes("Mac")
  1271. });
  1272. }
  1273. }
  1274. exports.FeatureTest = FeatureTest;
  1275. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1276. class Util {
  1277. static makeHexColor(r, g, b) {
  1278. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1279. }
  1280. static scaleMinMax(transform, minMax) {
  1281. let temp;
  1282. if (transform[0]) {
  1283. if (transform[0] < 0) {
  1284. temp = minMax[0];
  1285. minMax[0] = minMax[1];
  1286. minMax[1] = temp;
  1287. }
  1288. minMax[0] *= transform[0];
  1289. minMax[1] *= transform[0];
  1290. if (transform[3] < 0) {
  1291. temp = minMax[2];
  1292. minMax[2] = minMax[3];
  1293. minMax[3] = temp;
  1294. }
  1295. minMax[2] *= transform[3];
  1296. minMax[3] *= transform[3];
  1297. } else {
  1298. temp = minMax[0];
  1299. minMax[0] = minMax[2];
  1300. minMax[2] = temp;
  1301. temp = minMax[1];
  1302. minMax[1] = minMax[3];
  1303. minMax[3] = temp;
  1304. if (transform[1] < 0) {
  1305. temp = minMax[2];
  1306. minMax[2] = minMax[3];
  1307. minMax[3] = temp;
  1308. }
  1309. minMax[2] *= transform[1];
  1310. minMax[3] *= transform[1];
  1311. if (transform[2] < 0) {
  1312. temp = minMax[0];
  1313. minMax[0] = minMax[1];
  1314. minMax[1] = temp;
  1315. }
  1316. minMax[0] *= transform[2];
  1317. minMax[1] *= transform[2];
  1318. }
  1319. minMax[0] += transform[4];
  1320. minMax[1] += transform[4];
  1321. minMax[2] += transform[5];
  1322. minMax[3] += transform[5];
  1323. }
  1324. static transform(m1, m2) {
  1325. 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]];
  1326. }
  1327. static applyTransform(p, m) {
  1328. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1329. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1330. return [xt, yt];
  1331. }
  1332. static applyInverseTransform(p, m) {
  1333. const d = m[0] * m[3] - m[1] * m[2];
  1334. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1335. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1336. return [xt, yt];
  1337. }
  1338. static getAxialAlignedBoundingBox(r, m) {
  1339. const p1 = Util.applyTransform(r, m);
  1340. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1341. const p3 = Util.applyTransform([r[0], r[3]], m);
  1342. const p4 = Util.applyTransform([r[2], r[1]], m);
  1343. 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])];
  1344. }
  1345. static inverseTransform(m) {
  1346. const d = m[0] * m[3] - m[1] * m[2];
  1347. 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];
  1348. }
  1349. static singularValueDecompose2dScale(m) {
  1350. const transpose = [m[0], m[2], m[1], m[3]];
  1351. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1352. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1353. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1354. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1355. const first = (a + d) / 2;
  1356. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1357. const sx = first + second || 1;
  1358. const sy = first - second || 1;
  1359. return [Math.sqrt(sx), Math.sqrt(sy)];
  1360. }
  1361. static normalizeRect(rect) {
  1362. const r = rect.slice(0);
  1363. if (rect[0] > rect[2]) {
  1364. r[0] = rect[2];
  1365. r[2] = rect[0];
  1366. }
  1367. if (rect[1] > rect[3]) {
  1368. r[1] = rect[3];
  1369. r[3] = rect[1];
  1370. }
  1371. return r;
  1372. }
  1373. static intersect(rect1, rect2) {
  1374. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1375. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1376. if (xLow > xHigh) {
  1377. return null;
  1378. }
  1379. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1380. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1381. if (yLow > yHigh) {
  1382. return null;
  1383. }
  1384. return [xLow, yLow, xHigh, yHigh];
  1385. }
  1386. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1387. const tvalues = [],
  1388. bounds = [[], []];
  1389. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1390. for (let i = 0; i < 2; ++i) {
  1391. if (i === 0) {
  1392. b = 6 * x0 - 12 * x1 + 6 * x2;
  1393. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1394. c = 3 * x1 - 3 * x0;
  1395. } else {
  1396. b = 6 * y0 - 12 * y1 + 6 * y2;
  1397. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1398. c = 3 * y1 - 3 * y0;
  1399. }
  1400. if (Math.abs(a) < 1e-12) {
  1401. if (Math.abs(b) < 1e-12) {
  1402. continue;
  1403. }
  1404. t = -c / b;
  1405. if (0 < t && t < 1) {
  1406. tvalues.push(t);
  1407. }
  1408. continue;
  1409. }
  1410. b2ac = b * b - 4 * c * a;
  1411. sqrtb2ac = Math.sqrt(b2ac);
  1412. if (b2ac < 0) {
  1413. continue;
  1414. }
  1415. t1 = (-b + sqrtb2ac) / (2 * a);
  1416. if (0 < t1 && t1 < 1) {
  1417. tvalues.push(t1);
  1418. }
  1419. t2 = (-b - sqrtb2ac) / (2 * a);
  1420. if (0 < t2 && t2 < 1) {
  1421. tvalues.push(t2);
  1422. }
  1423. }
  1424. let j = tvalues.length,
  1425. mt;
  1426. const jlen = j;
  1427. while (j--) {
  1428. t = tvalues[j];
  1429. mt = 1 - t;
  1430. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1431. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1432. }
  1433. bounds[0][jlen] = x0;
  1434. bounds[1][jlen] = y0;
  1435. bounds[0][jlen + 1] = x3;
  1436. bounds[1][jlen + 1] = y3;
  1437. bounds[0].length = bounds[1].length = jlen + 2;
  1438. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1439. }
  1440. }
  1441. exports.Util = Util;
  1442. 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];
  1443. function stringToPDFString(str) {
  1444. if (str[0] >= "\xEF") {
  1445. let encoding;
  1446. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1447. encoding = "utf-16be";
  1448. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1449. encoding = "utf-16le";
  1450. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1451. encoding = "utf-8";
  1452. }
  1453. if (encoding) {
  1454. try {
  1455. const decoder = new TextDecoder(encoding, {
  1456. fatal: true
  1457. });
  1458. const buffer = stringToBytes(str);
  1459. return decoder.decode(buffer);
  1460. } catch (ex) {
  1461. warn(`stringToPDFString: "${ex}".`);
  1462. }
  1463. }
  1464. }
  1465. const strBuf = [];
  1466. for (let i = 0, ii = str.length; i < ii; i++) {
  1467. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1468. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1469. }
  1470. return strBuf.join("");
  1471. }
  1472. function stringToUTF8String(str) {
  1473. return decodeURIComponent(escape(str));
  1474. }
  1475. function utf8StringToString(str) {
  1476. return unescape(encodeURIComponent(str));
  1477. }
  1478. function isArrayBuffer(v) {
  1479. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1480. }
  1481. function isArrayEqual(arr1, arr2) {
  1482. if (arr1.length !== arr2.length) {
  1483. return false;
  1484. }
  1485. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1486. if (arr1[i] !== arr2[i]) {
  1487. return false;
  1488. }
  1489. }
  1490. return true;
  1491. }
  1492. function getModificationDate() {
  1493. let date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  1494. 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")];
  1495. return buffer.join("");
  1496. }
  1497. function createPromiseCapability() {
  1498. const capability = Object.create(null);
  1499. let isSettled = false;
  1500. Object.defineProperty(capability, "settled", {
  1501. get() {
  1502. return isSettled;
  1503. }
  1504. });
  1505. capability.promise = new Promise(function (resolve, reject) {
  1506. capability.resolve = function (data) {
  1507. isSettled = true;
  1508. resolve(data);
  1509. };
  1510. capability.reject = function (reason) {
  1511. isSettled = true;
  1512. reject(reason);
  1513. };
  1514. });
  1515. return capability;
  1516. }
  1517. /***/ }),
  1518. /* 3 */
  1519. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1520. "use strict";
  1521. var _is_node = __w_pdfjs_require__(4);
  1522. (function checkNodeBtoa() {
  1523. if (globalThis.btoa || !_is_node.isNodeJS) {
  1524. return;
  1525. }
  1526. globalThis.btoa = function (chars) {
  1527. return Buffer.from(chars, "binary").toString("base64");
  1528. };
  1529. })();
  1530. (function checkNodeAtob() {
  1531. if (globalThis.atob || !_is_node.isNodeJS) {
  1532. return;
  1533. }
  1534. globalThis.atob = function (input) {
  1535. return Buffer.from(input, "base64").toString("binary");
  1536. };
  1537. })();
  1538. (function checkDOMMatrix() {
  1539. if (globalThis.DOMMatrix || !_is_node.isNodeJS) {
  1540. return;
  1541. }
  1542. globalThis.DOMMatrix = require("canvas").DOMMatrix;
  1543. })();
  1544. (function checkReadableStream() {
  1545. if (globalThis.ReadableStream || !_is_node.isNodeJS) {
  1546. return;
  1547. }
  1548. globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
  1549. })();
  1550. (function checkArrayAt() {
  1551. if (Array.prototype.at) {
  1552. return;
  1553. }
  1554. __w_pdfjs_require__(5);
  1555. })();
  1556. (function checkTypedArrayAt() {
  1557. if (Uint8Array.prototype.at) {
  1558. return;
  1559. }
  1560. __w_pdfjs_require__(79);
  1561. })();
  1562. (function checkStructuredClone() {
  1563. if (globalThis.structuredClone) {
  1564. return;
  1565. }
  1566. __w_pdfjs_require__(89);
  1567. })();
  1568. /***/ }),
  1569. /* 4 */
  1570. /***/ ((__unused_webpack_module, exports) => {
  1571. "use strict";
  1572. Object.defineProperty(exports, "__esModule", ({
  1573. value: true
  1574. }));
  1575. exports.isNodeJS = void 0;
  1576. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1577. exports.isNodeJS = isNodeJS;
  1578. /***/ }),
  1579. /* 5 */
  1580. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1581. __w_pdfjs_require__(6);
  1582. var entryUnbind = __w_pdfjs_require__(78);
  1583. module.exports = entryUnbind('Array', 'at');
  1584. /***/ }),
  1585. /* 6 */
  1586. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1587. "use strict";
  1588. var $ = __w_pdfjs_require__(7);
  1589. var toObject = __w_pdfjs_require__(44);
  1590. var lengthOfArrayLike = __w_pdfjs_require__(68);
  1591. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  1592. var addToUnscopables = __w_pdfjs_require__(73);
  1593. $({
  1594. target: 'Array',
  1595. proto: true
  1596. }, {
  1597. at: function at(index) {
  1598. var O = toObject(this);
  1599. var len = lengthOfArrayLike(O);
  1600. var relativeIndex = toIntegerOrInfinity(index);
  1601. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  1602. return k < 0 || k >= len ? undefined : O[k];
  1603. }
  1604. });
  1605. addToUnscopables('at');
  1606. /***/ }),
  1607. /* 7 */
  1608. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1609. var global = __w_pdfjs_require__(8);
  1610. var getOwnPropertyDescriptor = (__w_pdfjs_require__(9).f);
  1611. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  1612. var defineBuiltIn = __w_pdfjs_require__(52);
  1613. var defineGlobalProperty = __w_pdfjs_require__(42);
  1614. var copyConstructorProperties = __w_pdfjs_require__(60);
  1615. var isForced = __w_pdfjs_require__(72);
  1616. module.exports = function (options, source) {
  1617. var TARGET = options.target;
  1618. var GLOBAL = options.global;
  1619. var STATIC = options.stat;
  1620. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  1621. if (GLOBAL) {
  1622. target = global;
  1623. } else if (STATIC) {
  1624. target = global[TARGET] || defineGlobalProperty(TARGET, {});
  1625. } else {
  1626. target = (global[TARGET] || {}).prototype;
  1627. }
  1628. if (target)
  1629. for (key in source) {
  1630. sourceProperty = source[key];
  1631. if (options.dontCallGetSet) {
  1632. descriptor = getOwnPropertyDescriptor(target, key);
  1633. targetProperty = descriptor && descriptor.value;
  1634. } else
  1635. targetProperty = target[key];
  1636. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  1637. if (!FORCED && targetProperty !== undefined) {
  1638. if (typeof sourceProperty == typeof targetProperty)
  1639. continue;
  1640. copyConstructorProperties(sourceProperty, targetProperty);
  1641. }
  1642. if (options.sham || targetProperty && targetProperty.sham) {
  1643. createNonEnumerableProperty(sourceProperty, 'sham', true);
  1644. }
  1645. defineBuiltIn(target, key, sourceProperty, options);
  1646. }
  1647. };
  1648. /***/ }),
  1649. /* 8 */
  1650. /***/ ((module) => {
  1651. var check = function (it) {
  1652. return it && it.Math == Math && it;
  1653. };
  1654. module.exports = check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || (function () {
  1655. return this;
  1656. }()) || Function('return this')();
  1657. /***/ }),
  1658. /* 9 */
  1659. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1660. var DESCRIPTORS = __w_pdfjs_require__(10);
  1661. var call = __w_pdfjs_require__(12);
  1662. var propertyIsEnumerableModule = __w_pdfjs_require__(14);
  1663. var createPropertyDescriptor = __w_pdfjs_require__(15);
  1664. var toIndexedObject = __w_pdfjs_require__(16);
  1665. var toPropertyKey = __w_pdfjs_require__(22);
  1666. var hasOwn = __w_pdfjs_require__(43);
  1667. var IE8_DOM_DEFINE = __w_pdfjs_require__(46);
  1668. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1669. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  1670. O = toIndexedObject(O);
  1671. P = toPropertyKey(P);
  1672. if (IE8_DOM_DEFINE)
  1673. try {
  1674. return $getOwnPropertyDescriptor(O, P);
  1675. } catch (error) {
  1676. }
  1677. if (hasOwn(O, P))
  1678. return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  1679. };
  1680. /***/ }),
  1681. /* 10 */
  1682. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1683. var fails = __w_pdfjs_require__(11);
  1684. module.exports = !fails(function () {
  1685. return Object.defineProperty({}, 1, {
  1686. get: function () {
  1687. return 7;
  1688. }
  1689. })[1] != 7;
  1690. });
  1691. /***/ }),
  1692. /* 11 */
  1693. /***/ ((module) => {
  1694. module.exports = function (exec) {
  1695. try {
  1696. return !!exec();
  1697. } catch (error) {
  1698. return true;
  1699. }
  1700. };
  1701. /***/ }),
  1702. /* 12 */
  1703. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1704. var NATIVE_BIND = __w_pdfjs_require__(13);
  1705. var call = Function.prototype.call;
  1706. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  1707. return call.apply(call, arguments);
  1708. };
  1709. /***/ }),
  1710. /* 13 */
  1711. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1712. var fails = __w_pdfjs_require__(11);
  1713. module.exports = !fails(function () {
  1714. var test = function () {
  1715. }.bind();
  1716. return typeof test != 'function' || test.hasOwnProperty('prototype');
  1717. });
  1718. /***/ }),
  1719. /* 14 */
  1720. /***/ ((__unused_webpack_module, exports) => {
  1721. "use strict";
  1722. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  1723. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1724. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  1725. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  1726. var descriptor = getOwnPropertyDescriptor(this, V);
  1727. return !!descriptor && descriptor.enumerable;
  1728. } : $propertyIsEnumerable;
  1729. /***/ }),
  1730. /* 15 */
  1731. /***/ ((module) => {
  1732. module.exports = function (bitmap, value) {
  1733. return {
  1734. enumerable: !(bitmap & 1),
  1735. configurable: !(bitmap & 2),
  1736. writable: !(bitmap & 4),
  1737. value: value
  1738. };
  1739. };
  1740. /***/ }),
  1741. /* 16 */
  1742. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1743. var IndexedObject = __w_pdfjs_require__(17);
  1744. var requireObjectCoercible = __w_pdfjs_require__(20);
  1745. module.exports = function (it) {
  1746. return IndexedObject(requireObjectCoercible(it));
  1747. };
  1748. /***/ }),
  1749. /* 17 */
  1750. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1751. var uncurryThis = __w_pdfjs_require__(18);
  1752. var fails = __w_pdfjs_require__(11);
  1753. var classof = __w_pdfjs_require__(19);
  1754. var $Object = Object;
  1755. var split = uncurryThis(''.split);
  1756. module.exports = fails(function () {
  1757. return !$Object('z').propertyIsEnumerable(0);
  1758. }) ? function (it) {
  1759. return classof(it) == 'String' ? split(it, '') : $Object(it);
  1760. } : $Object;
  1761. /***/ }),
  1762. /* 18 */
  1763. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1764. var NATIVE_BIND = __w_pdfjs_require__(13);
  1765. var FunctionPrototype = Function.prototype;
  1766. var call = FunctionPrototype.call;
  1767. var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
  1768. module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
  1769. return function () {
  1770. return call.apply(fn, arguments);
  1771. };
  1772. };
  1773. /***/ }),
  1774. /* 19 */
  1775. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1776. var uncurryThis = __w_pdfjs_require__(18);
  1777. var toString = uncurryThis({}.toString);
  1778. var stringSlice = uncurryThis(''.slice);
  1779. module.exports = function (it) {
  1780. return stringSlice(toString(it), 8, -1);
  1781. };
  1782. /***/ }),
  1783. /* 20 */
  1784. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1785. var isNullOrUndefined = __w_pdfjs_require__(21);
  1786. var $TypeError = TypeError;
  1787. module.exports = function (it) {
  1788. if (isNullOrUndefined(it))
  1789. throw $TypeError("Can't call method on " + it);
  1790. return it;
  1791. };
  1792. /***/ }),
  1793. /* 21 */
  1794. /***/ ((module) => {
  1795. module.exports = function (it) {
  1796. return it === null || it === undefined;
  1797. };
  1798. /***/ }),
  1799. /* 22 */
  1800. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1801. var toPrimitive = __w_pdfjs_require__(23);
  1802. var isSymbol = __w_pdfjs_require__(27);
  1803. module.exports = function (argument) {
  1804. var key = toPrimitive(argument, 'string');
  1805. return isSymbol(key) ? key : key + '';
  1806. };
  1807. /***/ }),
  1808. /* 23 */
  1809. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1810. var call = __w_pdfjs_require__(12);
  1811. var isObject = __w_pdfjs_require__(24);
  1812. var isSymbol = __w_pdfjs_require__(27);
  1813. var getMethod = __w_pdfjs_require__(34);
  1814. var ordinaryToPrimitive = __w_pdfjs_require__(37);
  1815. var wellKnownSymbol = __w_pdfjs_require__(38);
  1816. var $TypeError = TypeError;
  1817. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  1818. module.exports = function (input, pref) {
  1819. if (!isObject(input) || isSymbol(input))
  1820. return input;
  1821. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  1822. var result;
  1823. if (exoticToPrim) {
  1824. if (pref === undefined)
  1825. pref = 'default';
  1826. result = call(exoticToPrim, input, pref);
  1827. if (!isObject(result) || isSymbol(result))
  1828. return result;
  1829. throw $TypeError("Can't convert object to primitive value");
  1830. }
  1831. if (pref === undefined)
  1832. pref = 'number';
  1833. return ordinaryToPrimitive(input, pref);
  1834. };
  1835. /***/ }),
  1836. /* 24 */
  1837. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1838. var isCallable = __w_pdfjs_require__(25);
  1839. var $documentAll = __w_pdfjs_require__(26);
  1840. var documentAll = $documentAll.all;
  1841. module.exports = $documentAll.IS_HTMLDDA ? function (it) {
  1842. return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;
  1843. } : function (it) {
  1844. return typeof it == 'object' ? it !== null : isCallable(it);
  1845. };
  1846. /***/ }),
  1847. /* 25 */
  1848. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1849. var $documentAll = __w_pdfjs_require__(26);
  1850. var documentAll = $documentAll.all;
  1851. module.exports = $documentAll.IS_HTMLDDA ? function (argument) {
  1852. return typeof argument == 'function' || argument === documentAll;
  1853. } : function (argument) {
  1854. return typeof argument == 'function';
  1855. };
  1856. /***/ }),
  1857. /* 26 */
  1858. /***/ ((module) => {
  1859. var documentAll = typeof document == 'object' && document.all;
  1860. var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;
  1861. module.exports = {
  1862. all: documentAll,
  1863. IS_HTMLDDA: IS_HTMLDDA
  1864. };
  1865. /***/ }),
  1866. /* 27 */
  1867. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1868. var getBuiltIn = __w_pdfjs_require__(28);
  1869. var isCallable = __w_pdfjs_require__(25);
  1870. var isPrototypeOf = __w_pdfjs_require__(29);
  1871. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(30);
  1872. var $Object = Object;
  1873. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  1874. return typeof it == 'symbol';
  1875. } : function (it) {
  1876. var $Symbol = getBuiltIn('Symbol');
  1877. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
  1878. };
  1879. /***/ }),
  1880. /* 28 */
  1881. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1882. var global = __w_pdfjs_require__(8);
  1883. var isCallable = __w_pdfjs_require__(25);
  1884. var aFunction = function (argument) {
  1885. return isCallable(argument) ? argument : undefined;
  1886. };
  1887. module.exports = function (namespace, method) {
  1888. return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
  1889. };
  1890. /***/ }),
  1891. /* 29 */
  1892. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1893. var uncurryThis = __w_pdfjs_require__(18);
  1894. module.exports = uncurryThis({}.isPrototypeOf);
  1895. /***/ }),
  1896. /* 30 */
  1897. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1898. var NATIVE_SYMBOL = __w_pdfjs_require__(31);
  1899. module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol';
  1900. /***/ }),
  1901. /* 31 */
  1902. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1903. var V8_VERSION = __w_pdfjs_require__(32);
  1904. var fails = __w_pdfjs_require__(11);
  1905. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  1906. var symbol = Symbol();
  1907. return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  1908. });
  1909. /***/ }),
  1910. /* 32 */
  1911. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1912. var global = __w_pdfjs_require__(8);
  1913. var userAgent = __w_pdfjs_require__(33);
  1914. var process = global.process;
  1915. var Deno = global.Deno;
  1916. var versions = process && process.versions || Deno && Deno.version;
  1917. var v8 = versions && versions.v8;
  1918. var match, version;
  1919. if (v8) {
  1920. match = v8.split('.');
  1921. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  1922. }
  1923. if (!version && userAgent) {
  1924. match = userAgent.match(/Edge\/(\d+)/);
  1925. if (!match || match[1] >= 74) {
  1926. match = userAgent.match(/Chrome\/(\d+)/);
  1927. if (match)
  1928. version = +match[1];
  1929. }
  1930. }
  1931. module.exports = version;
  1932. /***/ }),
  1933. /* 33 */
  1934. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1935. var getBuiltIn = __w_pdfjs_require__(28);
  1936. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  1937. /***/ }),
  1938. /* 34 */
  1939. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1940. var aCallable = __w_pdfjs_require__(35);
  1941. var isNullOrUndefined = __w_pdfjs_require__(21);
  1942. module.exports = function (V, P) {
  1943. var func = V[P];
  1944. return isNullOrUndefined(func) ? undefined : aCallable(func);
  1945. };
  1946. /***/ }),
  1947. /* 35 */
  1948. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1949. var isCallable = __w_pdfjs_require__(25);
  1950. var tryToString = __w_pdfjs_require__(36);
  1951. var $TypeError = TypeError;
  1952. module.exports = function (argument) {
  1953. if (isCallable(argument))
  1954. return argument;
  1955. throw $TypeError(tryToString(argument) + ' is not a function');
  1956. };
  1957. /***/ }),
  1958. /* 36 */
  1959. /***/ ((module) => {
  1960. var $String = String;
  1961. module.exports = function (argument) {
  1962. try {
  1963. return $String(argument);
  1964. } catch (error) {
  1965. return 'Object';
  1966. }
  1967. };
  1968. /***/ }),
  1969. /* 37 */
  1970. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1971. var call = __w_pdfjs_require__(12);
  1972. var isCallable = __w_pdfjs_require__(25);
  1973. var isObject = __w_pdfjs_require__(24);
  1974. var $TypeError = TypeError;
  1975. module.exports = function (input, pref) {
  1976. var fn, val;
  1977. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1978. return val;
  1979. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
  1980. return val;
  1981. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1982. return val;
  1983. throw $TypeError("Can't convert object to primitive value");
  1984. };
  1985. /***/ }),
  1986. /* 38 */
  1987. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1988. var global = __w_pdfjs_require__(8);
  1989. var shared = __w_pdfjs_require__(39);
  1990. var hasOwn = __w_pdfjs_require__(43);
  1991. var uid = __w_pdfjs_require__(45);
  1992. var NATIVE_SYMBOL = __w_pdfjs_require__(31);
  1993. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(30);
  1994. var WellKnownSymbolsStore = shared('wks');
  1995. var Symbol = global.Symbol;
  1996. var symbolFor = Symbol && Symbol['for'];
  1997. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  1998. module.exports = function (name) {
  1999. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  2000. var description = 'Symbol.' + name;
  2001. if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
  2002. WellKnownSymbolsStore[name] = Symbol[name];
  2003. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  2004. WellKnownSymbolsStore[name] = symbolFor(description);
  2005. } else {
  2006. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  2007. }
  2008. }
  2009. return WellKnownSymbolsStore[name];
  2010. };
  2011. /***/ }),
  2012. /* 39 */
  2013. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2014. var IS_PURE = __w_pdfjs_require__(40);
  2015. var store = __w_pdfjs_require__(41);
  2016. (module.exports = function (key, value) {
  2017. return store[key] || (store[key] = value !== undefined ? value : {});
  2018. })('versions', []).push({
  2019. version: '3.26.1',
  2020. mode: IS_PURE ? 'pure' : 'global',
  2021. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  2022. license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
  2023. source: 'https://github.com/zloirock/core-js'
  2024. });
  2025. /***/ }),
  2026. /* 40 */
  2027. /***/ ((module) => {
  2028. module.exports = false;
  2029. /***/ }),
  2030. /* 41 */
  2031. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2032. var global = __w_pdfjs_require__(8);
  2033. var defineGlobalProperty = __w_pdfjs_require__(42);
  2034. var SHARED = '__core-js_shared__';
  2035. var store = global[SHARED] || defineGlobalProperty(SHARED, {});
  2036. module.exports = store;
  2037. /***/ }),
  2038. /* 42 */
  2039. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2040. var global = __w_pdfjs_require__(8);
  2041. var defineProperty = Object.defineProperty;
  2042. module.exports = function (key, value) {
  2043. try {
  2044. defineProperty(global, key, {
  2045. value: value,
  2046. configurable: true,
  2047. writable: true
  2048. });
  2049. } catch (error) {
  2050. global[key] = value;
  2051. }
  2052. return value;
  2053. };
  2054. /***/ }),
  2055. /* 43 */
  2056. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2057. var uncurryThis = __w_pdfjs_require__(18);
  2058. var toObject = __w_pdfjs_require__(44);
  2059. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  2060. module.exports = Object.hasOwn || function hasOwn(it, key) {
  2061. return hasOwnProperty(toObject(it), key);
  2062. };
  2063. /***/ }),
  2064. /* 44 */
  2065. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2066. var requireObjectCoercible = __w_pdfjs_require__(20);
  2067. var $Object = Object;
  2068. module.exports = function (argument) {
  2069. return $Object(requireObjectCoercible(argument));
  2070. };
  2071. /***/ }),
  2072. /* 45 */
  2073. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2074. var uncurryThis = __w_pdfjs_require__(18);
  2075. var id = 0;
  2076. var postfix = Math.random();
  2077. var toString = uncurryThis(1.0.toString);
  2078. module.exports = function (key) {
  2079. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  2080. };
  2081. /***/ }),
  2082. /* 46 */
  2083. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2084. var DESCRIPTORS = __w_pdfjs_require__(10);
  2085. var fails = __w_pdfjs_require__(11);
  2086. var createElement = __w_pdfjs_require__(47);
  2087. module.exports = !DESCRIPTORS && !fails(function () {
  2088. return Object.defineProperty(createElement('div'), 'a', {
  2089. get: function () {
  2090. return 7;
  2091. }
  2092. }).a != 7;
  2093. });
  2094. /***/ }),
  2095. /* 47 */
  2096. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2097. var global = __w_pdfjs_require__(8);
  2098. var isObject = __w_pdfjs_require__(24);
  2099. var document = global.document;
  2100. var EXISTS = isObject(document) && isObject(document.createElement);
  2101. module.exports = function (it) {
  2102. return EXISTS ? document.createElement(it) : {};
  2103. };
  2104. /***/ }),
  2105. /* 48 */
  2106. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2107. var DESCRIPTORS = __w_pdfjs_require__(10);
  2108. var definePropertyModule = __w_pdfjs_require__(49);
  2109. var createPropertyDescriptor = __w_pdfjs_require__(15);
  2110. module.exports = DESCRIPTORS ? function (object, key, value) {
  2111. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  2112. } : function (object, key, value) {
  2113. object[key] = value;
  2114. return object;
  2115. };
  2116. /***/ }),
  2117. /* 49 */
  2118. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2119. var DESCRIPTORS = __w_pdfjs_require__(10);
  2120. var IE8_DOM_DEFINE = __w_pdfjs_require__(46);
  2121. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(50);
  2122. var anObject = __w_pdfjs_require__(51);
  2123. var toPropertyKey = __w_pdfjs_require__(22);
  2124. var $TypeError = TypeError;
  2125. var $defineProperty = Object.defineProperty;
  2126. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2127. var ENUMERABLE = 'enumerable';
  2128. var CONFIGURABLE = 'configurable';
  2129. var WRITABLE = 'writable';
  2130. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  2131. anObject(O);
  2132. P = toPropertyKey(P);
  2133. anObject(Attributes);
  2134. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  2135. var current = $getOwnPropertyDescriptor(O, P);
  2136. if (current && current[WRITABLE]) {
  2137. O[P] = Attributes.value;
  2138. Attributes = {
  2139. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  2140. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  2141. writable: false
  2142. };
  2143. }
  2144. }
  2145. return $defineProperty(O, P, Attributes);
  2146. } : $defineProperty : function defineProperty(O, P, Attributes) {
  2147. anObject(O);
  2148. P = toPropertyKey(P);
  2149. anObject(Attributes);
  2150. if (IE8_DOM_DEFINE)
  2151. try {
  2152. return $defineProperty(O, P, Attributes);
  2153. } catch (error) {
  2154. }
  2155. if ('get' in Attributes || 'set' in Attributes)
  2156. throw $TypeError('Accessors not supported');
  2157. if ('value' in Attributes)
  2158. O[P] = Attributes.value;
  2159. return O;
  2160. };
  2161. /***/ }),
  2162. /* 50 */
  2163. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2164. var DESCRIPTORS = __w_pdfjs_require__(10);
  2165. var fails = __w_pdfjs_require__(11);
  2166. module.exports = DESCRIPTORS && fails(function () {
  2167. return Object.defineProperty(function () {
  2168. }, 'prototype', {
  2169. value: 42,
  2170. writable: false
  2171. }).prototype != 42;
  2172. });
  2173. /***/ }),
  2174. /* 51 */
  2175. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2176. var isObject = __w_pdfjs_require__(24);
  2177. var $String = String;
  2178. var $TypeError = TypeError;
  2179. module.exports = function (argument) {
  2180. if (isObject(argument))
  2181. return argument;
  2182. throw $TypeError($String(argument) + ' is not an object');
  2183. };
  2184. /***/ }),
  2185. /* 52 */
  2186. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2187. var isCallable = __w_pdfjs_require__(25);
  2188. var definePropertyModule = __w_pdfjs_require__(49);
  2189. var makeBuiltIn = __w_pdfjs_require__(53);
  2190. var defineGlobalProperty = __w_pdfjs_require__(42);
  2191. module.exports = function (O, key, value, options) {
  2192. if (!options)
  2193. options = {};
  2194. var simple = options.enumerable;
  2195. var name = options.name !== undefined ? options.name : key;
  2196. if (isCallable(value))
  2197. makeBuiltIn(value, name, options);
  2198. if (options.global) {
  2199. if (simple)
  2200. O[key] = value;
  2201. else
  2202. defineGlobalProperty(key, value);
  2203. } else {
  2204. try {
  2205. if (!options.unsafe)
  2206. delete O[key];
  2207. else if (O[key])
  2208. simple = true;
  2209. } catch (error) {
  2210. }
  2211. if (simple)
  2212. O[key] = value;
  2213. else
  2214. definePropertyModule.f(O, key, {
  2215. value: value,
  2216. enumerable: false,
  2217. configurable: !options.nonConfigurable,
  2218. writable: !options.nonWritable
  2219. });
  2220. }
  2221. return O;
  2222. };
  2223. /***/ }),
  2224. /* 53 */
  2225. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2226. var fails = __w_pdfjs_require__(11);
  2227. var isCallable = __w_pdfjs_require__(25);
  2228. var hasOwn = __w_pdfjs_require__(43);
  2229. var DESCRIPTORS = __w_pdfjs_require__(10);
  2230. var CONFIGURABLE_FUNCTION_NAME = (__w_pdfjs_require__(54).CONFIGURABLE);
  2231. var inspectSource = __w_pdfjs_require__(55);
  2232. var InternalStateModule = __w_pdfjs_require__(56);
  2233. var enforceInternalState = InternalStateModule.enforce;
  2234. var getInternalState = InternalStateModule.get;
  2235. var defineProperty = Object.defineProperty;
  2236. var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
  2237. return defineProperty(function () {
  2238. }, 'length', { value: 8 }).length !== 8;
  2239. });
  2240. var TEMPLATE = String(String).split('String');
  2241. var makeBuiltIn = module.exports = function (value, name, options) {
  2242. if (String(name).slice(0, 7) === 'Symbol(') {
  2243. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  2244. }
  2245. if (options && options.getter)
  2246. name = 'get ' + name;
  2247. if (options && options.setter)
  2248. name = 'set ' + name;
  2249. if (!hasOwn(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
  2250. if (DESCRIPTORS)
  2251. defineProperty(value, 'name', {
  2252. value: name,
  2253. configurable: true
  2254. });
  2255. else
  2256. value.name = name;
  2257. }
  2258. if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
  2259. defineProperty(value, 'length', { value: options.arity });
  2260. }
  2261. try {
  2262. if (options && hasOwn(options, 'constructor') && options.constructor) {
  2263. if (DESCRIPTORS)
  2264. defineProperty(value, 'prototype', { writable: false });
  2265. } else if (value.prototype)
  2266. value.prototype = undefined;
  2267. } catch (error) {
  2268. }
  2269. var state = enforceInternalState(value);
  2270. if (!hasOwn(state, 'source')) {
  2271. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  2272. }
  2273. return value;
  2274. };
  2275. Function.prototype.toString = makeBuiltIn(function toString() {
  2276. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  2277. }, 'toString');
  2278. /***/ }),
  2279. /* 54 */
  2280. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2281. var DESCRIPTORS = __w_pdfjs_require__(10);
  2282. var hasOwn = __w_pdfjs_require__(43);
  2283. var FunctionPrototype = Function.prototype;
  2284. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  2285. var EXISTS = hasOwn(FunctionPrototype, 'name');
  2286. var PROPER = EXISTS && function something() {
  2287. }.name === 'something';
  2288. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable);
  2289. module.exports = {
  2290. EXISTS: EXISTS,
  2291. PROPER: PROPER,
  2292. CONFIGURABLE: CONFIGURABLE
  2293. };
  2294. /***/ }),
  2295. /* 55 */
  2296. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2297. var uncurryThis = __w_pdfjs_require__(18);
  2298. var isCallable = __w_pdfjs_require__(25);
  2299. var store = __w_pdfjs_require__(41);
  2300. var functionToString = uncurryThis(Function.toString);
  2301. if (!isCallable(store.inspectSource)) {
  2302. store.inspectSource = function (it) {
  2303. return functionToString(it);
  2304. };
  2305. }
  2306. module.exports = store.inspectSource;
  2307. /***/ }),
  2308. /* 56 */
  2309. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2310. var NATIVE_WEAK_MAP = __w_pdfjs_require__(57);
  2311. var global = __w_pdfjs_require__(8);
  2312. var isObject = __w_pdfjs_require__(24);
  2313. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  2314. var hasOwn = __w_pdfjs_require__(43);
  2315. var shared = __w_pdfjs_require__(41);
  2316. var sharedKey = __w_pdfjs_require__(58);
  2317. var hiddenKeys = __w_pdfjs_require__(59);
  2318. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  2319. var TypeError = global.TypeError;
  2320. var WeakMap = global.WeakMap;
  2321. var set, get, has;
  2322. var enforce = function (it) {
  2323. return has(it) ? get(it) : set(it, {});
  2324. };
  2325. var getterFor = function (TYPE) {
  2326. return function (it) {
  2327. var state;
  2328. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  2329. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  2330. }
  2331. return state;
  2332. };
  2333. };
  2334. if (NATIVE_WEAK_MAP || shared.state) {
  2335. var store = shared.state || (shared.state = new WeakMap());
  2336. store.get = store.get;
  2337. store.has = store.has;
  2338. store.set = store.set;
  2339. set = function (it, metadata) {
  2340. if (store.has(it))
  2341. throw TypeError(OBJECT_ALREADY_INITIALIZED);
  2342. metadata.facade = it;
  2343. store.set(it, metadata);
  2344. return metadata;
  2345. };
  2346. get = function (it) {
  2347. return store.get(it) || {};
  2348. };
  2349. has = function (it) {
  2350. return store.has(it);
  2351. };
  2352. } else {
  2353. var STATE = sharedKey('state');
  2354. hiddenKeys[STATE] = true;
  2355. set = function (it, metadata) {
  2356. if (hasOwn(it, STATE))
  2357. throw TypeError(OBJECT_ALREADY_INITIALIZED);
  2358. metadata.facade = it;
  2359. createNonEnumerableProperty(it, STATE, metadata);
  2360. return metadata;
  2361. };
  2362. get = function (it) {
  2363. return hasOwn(it, STATE) ? it[STATE] : {};
  2364. };
  2365. has = function (it) {
  2366. return hasOwn(it, STATE);
  2367. };
  2368. }
  2369. module.exports = {
  2370. set: set,
  2371. get: get,
  2372. has: has,
  2373. enforce: enforce,
  2374. getterFor: getterFor
  2375. };
  2376. /***/ }),
  2377. /* 57 */
  2378. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2379. var global = __w_pdfjs_require__(8);
  2380. var isCallable = __w_pdfjs_require__(25);
  2381. var WeakMap = global.WeakMap;
  2382. module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
  2383. /***/ }),
  2384. /* 58 */
  2385. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2386. var shared = __w_pdfjs_require__(39);
  2387. var uid = __w_pdfjs_require__(45);
  2388. var keys = shared('keys');
  2389. module.exports = function (key) {
  2390. return keys[key] || (keys[key] = uid(key));
  2391. };
  2392. /***/ }),
  2393. /* 59 */
  2394. /***/ ((module) => {
  2395. module.exports = {};
  2396. /***/ }),
  2397. /* 60 */
  2398. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2399. var hasOwn = __w_pdfjs_require__(43);
  2400. var ownKeys = __w_pdfjs_require__(61);
  2401. var getOwnPropertyDescriptorModule = __w_pdfjs_require__(9);
  2402. var definePropertyModule = __w_pdfjs_require__(49);
  2403. module.exports = function (target, source, exceptions) {
  2404. var keys = ownKeys(source);
  2405. var defineProperty = definePropertyModule.f;
  2406. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  2407. for (var i = 0; i < keys.length; i++) {
  2408. var key = keys[i];
  2409. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  2410. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  2411. }
  2412. }
  2413. };
  2414. /***/ }),
  2415. /* 61 */
  2416. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2417. var getBuiltIn = __w_pdfjs_require__(28);
  2418. var uncurryThis = __w_pdfjs_require__(18);
  2419. var getOwnPropertyNamesModule = __w_pdfjs_require__(62);
  2420. var getOwnPropertySymbolsModule = __w_pdfjs_require__(71);
  2421. var anObject = __w_pdfjs_require__(51);
  2422. var concat = uncurryThis([].concat);
  2423. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  2424. var keys = getOwnPropertyNamesModule.f(anObject(it));
  2425. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  2426. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  2427. };
  2428. /***/ }),
  2429. /* 62 */
  2430. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2431. var internalObjectKeys = __w_pdfjs_require__(63);
  2432. var enumBugKeys = __w_pdfjs_require__(70);
  2433. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  2434. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  2435. return internalObjectKeys(O, hiddenKeys);
  2436. };
  2437. /***/ }),
  2438. /* 63 */
  2439. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2440. var uncurryThis = __w_pdfjs_require__(18);
  2441. var hasOwn = __w_pdfjs_require__(43);
  2442. var toIndexedObject = __w_pdfjs_require__(16);
  2443. var indexOf = (__w_pdfjs_require__(64).indexOf);
  2444. var hiddenKeys = __w_pdfjs_require__(59);
  2445. var push = uncurryThis([].push);
  2446. module.exports = function (object, names) {
  2447. var O = toIndexedObject(object);
  2448. var i = 0;
  2449. var result = [];
  2450. var key;
  2451. for (key in O)
  2452. !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  2453. while (names.length > i)
  2454. if (hasOwn(O, key = names[i++])) {
  2455. ~indexOf(result, key) || push(result, key);
  2456. }
  2457. return result;
  2458. };
  2459. /***/ }),
  2460. /* 64 */
  2461. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2462. var toIndexedObject = __w_pdfjs_require__(16);
  2463. var toAbsoluteIndex = __w_pdfjs_require__(65);
  2464. var lengthOfArrayLike = __w_pdfjs_require__(68);
  2465. var createMethod = function (IS_INCLUDES) {
  2466. return function ($this, el, fromIndex) {
  2467. var O = toIndexedObject($this);
  2468. var length = lengthOfArrayLike(O);
  2469. var index = toAbsoluteIndex(fromIndex, length);
  2470. var value;
  2471. if (IS_INCLUDES && el != el)
  2472. while (length > index) {
  2473. value = O[index++];
  2474. if (value != value)
  2475. return true;
  2476. }
  2477. else
  2478. for (; length > index; index++) {
  2479. if ((IS_INCLUDES || index in O) && O[index] === el)
  2480. return IS_INCLUDES || index || 0;
  2481. }
  2482. return !IS_INCLUDES && -1;
  2483. };
  2484. };
  2485. module.exports = {
  2486. includes: createMethod(true),
  2487. indexOf: createMethod(false)
  2488. };
  2489. /***/ }),
  2490. /* 65 */
  2491. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2492. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  2493. var max = Math.max;
  2494. var min = Math.min;
  2495. module.exports = function (index, length) {
  2496. var integer = toIntegerOrInfinity(index);
  2497. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  2498. };
  2499. /***/ }),
  2500. /* 66 */
  2501. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2502. var trunc = __w_pdfjs_require__(67);
  2503. module.exports = function (argument) {
  2504. var number = +argument;
  2505. return number !== number || number === 0 ? 0 : trunc(number);
  2506. };
  2507. /***/ }),
  2508. /* 67 */
  2509. /***/ ((module) => {
  2510. var ceil = Math.ceil;
  2511. var floor = Math.floor;
  2512. module.exports = Math.trunc || function trunc(x) {
  2513. var n = +x;
  2514. return (n > 0 ? floor : ceil)(n);
  2515. };
  2516. /***/ }),
  2517. /* 68 */
  2518. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2519. var toLength = __w_pdfjs_require__(69);
  2520. module.exports = function (obj) {
  2521. return toLength(obj.length);
  2522. };
  2523. /***/ }),
  2524. /* 69 */
  2525. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2526. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  2527. var min = Math.min;
  2528. module.exports = function (argument) {
  2529. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0;
  2530. };
  2531. /***/ }),
  2532. /* 70 */
  2533. /***/ ((module) => {
  2534. module.exports = [
  2535. 'constructor',
  2536. 'hasOwnProperty',
  2537. 'isPrototypeOf',
  2538. 'propertyIsEnumerable',
  2539. 'toLocaleString',
  2540. 'toString',
  2541. 'valueOf'
  2542. ];
  2543. /***/ }),
  2544. /* 71 */
  2545. /***/ ((__unused_webpack_module, exports) => {
  2546. exports.f = Object.getOwnPropertySymbols;
  2547. /***/ }),
  2548. /* 72 */
  2549. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2550. var fails = __w_pdfjs_require__(11);
  2551. var isCallable = __w_pdfjs_require__(25);
  2552. var replacement = /#|\.prototype\./;
  2553. var isForced = function (feature, detection) {
  2554. var value = data[normalize(feature)];
  2555. return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
  2556. };
  2557. var normalize = isForced.normalize = function (string) {
  2558. return String(string).replace(replacement, '.').toLowerCase();
  2559. };
  2560. var data = isForced.data = {};
  2561. var NATIVE = isForced.NATIVE = 'N';
  2562. var POLYFILL = isForced.POLYFILL = 'P';
  2563. module.exports = isForced;
  2564. /***/ }),
  2565. /* 73 */
  2566. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2567. var wellKnownSymbol = __w_pdfjs_require__(38);
  2568. var create = __w_pdfjs_require__(74);
  2569. var defineProperty = (__w_pdfjs_require__(49).f);
  2570. var UNSCOPABLES = wellKnownSymbol('unscopables');
  2571. var ArrayPrototype = Array.prototype;
  2572. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  2573. defineProperty(ArrayPrototype, UNSCOPABLES, {
  2574. configurable: true,
  2575. value: create(null)
  2576. });
  2577. }
  2578. module.exports = function (key) {
  2579. ArrayPrototype[UNSCOPABLES][key] = true;
  2580. };
  2581. /***/ }),
  2582. /* 74 */
  2583. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2584. var anObject = __w_pdfjs_require__(51);
  2585. var definePropertiesModule = __w_pdfjs_require__(75);
  2586. var enumBugKeys = __w_pdfjs_require__(70);
  2587. var hiddenKeys = __w_pdfjs_require__(59);
  2588. var html = __w_pdfjs_require__(77);
  2589. var documentCreateElement = __w_pdfjs_require__(47);
  2590. var sharedKey = __w_pdfjs_require__(58);
  2591. var GT = '>';
  2592. var LT = '<';
  2593. var PROTOTYPE = 'prototype';
  2594. var SCRIPT = 'script';
  2595. var IE_PROTO = sharedKey('IE_PROTO');
  2596. var EmptyConstructor = function () {
  2597. };
  2598. var scriptTag = function (content) {
  2599. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  2600. };
  2601. var NullProtoObjectViaActiveX = function (activeXDocument) {
  2602. activeXDocument.write(scriptTag(''));
  2603. activeXDocument.close();
  2604. var temp = activeXDocument.parentWindow.Object;
  2605. activeXDocument = null;
  2606. return temp;
  2607. };
  2608. var NullProtoObjectViaIFrame = function () {
  2609. var iframe = documentCreateElement('iframe');
  2610. var JS = 'java' + SCRIPT + ':';
  2611. var iframeDocument;
  2612. iframe.style.display = 'none';
  2613. html.appendChild(iframe);
  2614. iframe.src = String(JS);
  2615. iframeDocument = iframe.contentWindow.document;
  2616. iframeDocument.open();
  2617. iframeDocument.write(scriptTag('document.F=Object'));
  2618. iframeDocument.close();
  2619. return iframeDocument.F;
  2620. };
  2621. var activeXDocument;
  2622. var NullProtoObject = function () {
  2623. try {
  2624. activeXDocument = new ActiveXObject('htmlfile');
  2625. } catch (error) {
  2626. }
  2627. NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument);
  2628. var length = enumBugKeys.length;
  2629. while (length--)
  2630. delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  2631. return NullProtoObject();
  2632. };
  2633. hiddenKeys[IE_PROTO] = true;
  2634. module.exports = Object.create || function create(O, Properties) {
  2635. var result;
  2636. if (O !== null) {
  2637. EmptyConstructor[PROTOTYPE] = anObject(O);
  2638. result = new EmptyConstructor();
  2639. EmptyConstructor[PROTOTYPE] = null;
  2640. result[IE_PROTO] = O;
  2641. } else
  2642. result = NullProtoObject();
  2643. return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
  2644. };
  2645. /***/ }),
  2646. /* 75 */
  2647. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2648. var DESCRIPTORS = __w_pdfjs_require__(10);
  2649. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(50);
  2650. var definePropertyModule = __w_pdfjs_require__(49);
  2651. var anObject = __w_pdfjs_require__(51);
  2652. var toIndexedObject = __w_pdfjs_require__(16);
  2653. var objectKeys = __w_pdfjs_require__(76);
  2654. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  2655. anObject(O);
  2656. var props = toIndexedObject(Properties);
  2657. var keys = objectKeys(Properties);
  2658. var length = keys.length;
  2659. var index = 0;
  2660. var key;
  2661. while (length > index)
  2662. definePropertyModule.f(O, key = keys[index++], props[key]);
  2663. return O;
  2664. };
  2665. /***/ }),
  2666. /* 76 */
  2667. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2668. var internalObjectKeys = __w_pdfjs_require__(63);
  2669. var enumBugKeys = __w_pdfjs_require__(70);
  2670. module.exports = Object.keys || function keys(O) {
  2671. return internalObjectKeys(O, enumBugKeys);
  2672. };
  2673. /***/ }),
  2674. /* 77 */
  2675. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2676. var getBuiltIn = __w_pdfjs_require__(28);
  2677. module.exports = getBuiltIn('document', 'documentElement');
  2678. /***/ }),
  2679. /* 78 */
  2680. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2681. var global = __w_pdfjs_require__(8);
  2682. var uncurryThis = __w_pdfjs_require__(18);
  2683. module.exports = function (CONSTRUCTOR, METHOD) {
  2684. return uncurryThis(global[CONSTRUCTOR].prototype[METHOD]);
  2685. };
  2686. /***/ }),
  2687. /* 79 */
  2688. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2689. __w_pdfjs_require__(80);
  2690. /***/ }),
  2691. /* 80 */
  2692. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2693. "use strict";
  2694. var ArrayBufferViewCore = __w_pdfjs_require__(81);
  2695. var lengthOfArrayLike = __w_pdfjs_require__(68);
  2696. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  2697. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  2698. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  2699. exportTypedArrayMethod('at', function at(index) {
  2700. var O = aTypedArray(this);
  2701. var len = lengthOfArrayLike(O);
  2702. var relativeIndex = toIntegerOrInfinity(index);
  2703. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  2704. return k < 0 || k >= len ? undefined : O[k];
  2705. });
  2706. /***/ }),
  2707. /* 81 */
  2708. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2709. "use strict";
  2710. var NATIVE_ARRAY_BUFFER = __w_pdfjs_require__(82);
  2711. var DESCRIPTORS = __w_pdfjs_require__(10);
  2712. var global = __w_pdfjs_require__(8);
  2713. var isCallable = __w_pdfjs_require__(25);
  2714. var isObject = __w_pdfjs_require__(24);
  2715. var hasOwn = __w_pdfjs_require__(43);
  2716. var classof = __w_pdfjs_require__(83);
  2717. var tryToString = __w_pdfjs_require__(36);
  2718. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  2719. var defineBuiltIn = __w_pdfjs_require__(52);
  2720. var defineProperty = (__w_pdfjs_require__(49).f);
  2721. var isPrototypeOf = __w_pdfjs_require__(29);
  2722. var getPrototypeOf = __w_pdfjs_require__(85);
  2723. var setPrototypeOf = __w_pdfjs_require__(87);
  2724. var wellKnownSymbol = __w_pdfjs_require__(38);
  2725. var uid = __w_pdfjs_require__(45);
  2726. var InternalStateModule = __w_pdfjs_require__(56);
  2727. var enforceInternalState = InternalStateModule.enforce;
  2728. var getInternalState = InternalStateModule.get;
  2729. var Int8Array = global.Int8Array;
  2730. var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
  2731. var Uint8ClampedArray = global.Uint8ClampedArray;
  2732. var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
  2733. var TypedArray = Int8Array && getPrototypeOf(Int8Array);
  2734. var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
  2735. var ObjectPrototype = Object.prototype;
  2736. var TypeError = global.TypeError;
  2737. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2738. var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
  2739. var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';
  2740. var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
  2741. var TYPED_ARRAY_TAG_REQUIRED = false;
  2742. var NAME, Constructor, Prototype;
  2743. var TypedArrayConstructorsList = {
  2744. Int8Array: 1,
  2745. Uint8Array: 1,
  2746. Uint8ClampedArray: 1,
  2747. Int16Array: 2,
  2748. Uint16Array: 2,
  2749. Int32Array: 4,
  2750. Uint32Array: 4,
  2751. Float32Array: 4,
  2752. Float64Array: 8
  2753. };
  2754. var BigIntArrayConstructorsList = {
  2755. BigInt64Array: 8,
  2756. BigUint64Array: 8
  2757. };
  2758. var isView = function isView(it) {
  2759. if (!isObject(it))
  2760. return false;
  2761. var klass = classof(it);
  2762. return klass === 'DataView' || hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2763. };
  2764. var getTypedArrayConstructor = function (it) {
  2765. var proto = getPrototypeOf(it);
  2766. if (!isObject(proto))
  2767. return;
  2768. var state = getInternalState(proto);
  2769. return state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);
  2770. };
  2771. var isTypedArray = function (it) {
  2772. if (!isObject(it))
  2773. return false;
  2774. var klass = classof(it);
  2775. return hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2776. };
  2777. var aTypedArray = function (it) {
  2778. if (isTypedArray(it))
  2779. return it;
  2780. throw TypeError('Target is not a typed array');
  2781. };
  2782. var aTypedArrayConstructor = function (C) {
  2783. if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C)))
  2784. return C;
  2785. throw TypeError(tryToString(C) + ' is not a typed array constructor');
  2786. };
  2787. var exportTypedArrayMethod = function (KEY, property, forced, options) {
  2788. if (!DESCRIPTORS)
  2789. return;
  2790. if (forced)
  2791. for (var ARRAY in TypedArrayConstructorsList) {
  2792. var TypedArrayConstructor = global[ARRAY];
  2793. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY))
  2794. try {
  2795. delete TypedArrayConstructor.prototype[KEY];
  2796. } catch (error) {
  2797. try {
  2798. TypedArrayConstructor.prototype[KEY] = property;
  2799. } catch (error2) {
  2800. }
  2801. }
  2802. }
  2803. if (!TypedArrayPrototype[KEY] || forced) {
  2804. defineBuiltIn(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);
  2805. }
  2806. };
  2807. var exportTypedArrayStaticMethod = function (KEY, property, forced) {
  2808. var ARRAY, TypedArrayConstructor;
  2809. if (!DESCRIPTORS)
  2810. return;
  2811. if (setPrototypeOf) {
  2812. if (forced)
  2813. for (ARRAY in TypedArrayConstructorsList) {
  2814. TypedArrayConstructor = global[ARRAY];
  2815. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY))
  2816. try {
  2817. delete TypedArrayConstructor[KEY];
  2818. } catch (error) {
  2819. }
  2820. }
  2821. if (!TypedArray[KEY] || forced) {
  2822. try {
  2823. return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
  2824. } catch (error) {
  2825. }
  2826. } else
  2827. return;
  2828. }
  2829. for (ARRAY in TypedArrayConstructorsList) {
  2830. TypedArrayConstructor = global[ARRAY];
  2831. if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
  2832. defineBuiltIn(TypedArrayConstructor, KEY, property);
  2833. }
  2834. }
  2835. };
  2836. for (NAME in TypedArrayConstructorsList) {
  2837. Constructor = global[NAME];
  2838. Prototype = Constructor && Constructor.prototype;
  2839. if (Prototype)
  2840. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2841. else
  2842. NATIVE_ARRAY_BUFFER_VIEWS = false;
  2843. }
  2844. for (NAME in BigIntArrayConstructorsList) {
  2845. Constructor = global[NAME];
  2846. Prototype = Constructor && Constructor.prototype;
  2847. if (Prototype)
  2848. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2849. }
  2850. if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
  2851. TypedArray = function TypedArray() {
  2852. throw TypeError('Incorrect invocation');
  2853. };
  2854. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2855. for (NAME in TypedArrayConstructorsList) {
  2856. if (global[NAME])
  2857. setPrototypeOf(global[NAME], TypedArray);
  2858. }
  2859. }
  2860. if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
  2861. TypedArrayPrototype = TypedArray.prototype;
  2862. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2863. for (NAME in TypedArrayConstructorsList) {
  2864. if (global[NAME])
  2865. setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
  2866. }
  2867. }
  2868. if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
  2869. setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
  2870. }
  2871. if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {
  2872. TYPED_ARRAY_TAG_REQUIRED = true;
  2873. defineProperty(TypedArrayPrototype, TO_STRING_TAG, {
  2874. get: function () {
  2875. return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
  2876. }
  2877. });
  2878. for (NAME in TypedArrayConstructorsList)
  2879. if (global[NAME]) {
  2880. createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
  2881. }
  2882. }
  2883. module.exports = {
  2884. NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
  2885. TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,
  2886. aTypedArray: aTypedArray,
  2887. aTypedArrayConstructor: aTypedArrayConstructor,
  2888. exportTypedArrayMethod: exportTypedArrayMethod,
  2889. exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
  2890. getTypedArrayConstructor: getTypedArrayConstructor,
  2891. isView: isView,
  2892. isTypedArray: isTypedArray,
  2893. TypedArray: TypedArray,
  2894. TypedArrayPrototype: TypedArrayPrototype
  2895. };
  2896. /***/ }),
  2897. /* 82 */
  2898. /***/ ((module) => {
  2899. module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
  2900. /***/ }),
  2901. /* 83 */
  2902. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2903. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(84);
  2904. var isCallable = __w_pdfjs_require__(25);
  2905. var classofRaw = __w_pdfjs_require__(19);
  2906. var wellKnownSymbol = __w_pdfjs_require__(38);
  2907. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2908. var $Object = Object;
  2909. var CORRECT_ARGUMENTS = classofRaw((function () {
  2910. return arguments;
  2911. }())) == 'Arguments';
  2912. var tryGet = function (it, key) {
  2913. try {
  2914. return it[key];
  2915. } catch (error) {
  2916. }
  2917. };
  2918. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  2919. var O, tag, result;
  2920. 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;
  2921. };
  2922. /***/ }),
  2923. /* 84 */
  2924. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2925. var wellKnownSymbol = __w_pdfjs_require__(38);
  2926. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2927. var test = {};
  2928. test[TO_STRING_TAG] = 'z';
  2929. module.exports = String(test) === '[object z]';
  2930. /***/ }),
  2931. /* 85 */
  2932. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2933. var hasOwn = __w_pdfjs_require__(43);
  2934. var isCallable = __w_pdfjs_require__(25);
  2935. var toObject = __w_pdfjs_require__(44);
  2936. var sharedKey = __w_pdfjs_require__(58);
  2937. var CORRECT_PROTOTYPE_GETTER = __w_pdfjs_require__(86);
  2938. var IE_PROTO = sharedKey('IE_PROTO');
  2939. var $Object = Object;
  2940. var ObjectPrototype = $Object.prototype;
  2941. module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
  2942. var object = toObject(O);
  2943. if (hasOwn(object, IE_PROTO))
  2944. return object[IE_PROTO];
  2945. var constructor = object.constructor;
  2946. if (isCallable(constructor) && object instanceof constructor) {
  2947. return constructor.prototype;
  2948. }
  2949. return object instanceof $Object ? ObjectPrototype : null;
  2950. };
  2951. /***/ }),
  2952. /* 86 */
  2953. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2954. var fails = __w_pdfjs_require__(11);
  2955. module.exports = !fails(function () {
  2956. function F() {
  2957. }
  2958. F.prototype.constructor = null;
  2959. return Object.getPrototypeOf(new F()) !== F.prototype;
  2960. });
  2961. /***/ }),
  2962. /* 87 */
  2963. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2964. var uncurryThis = __w_pdfjs_require__(18);
  2965. var anObject = __w_pdfjs_require__(51);
  2966. var aPossiblePrototype = __w_pdfjs_require__(88);
  2967. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? (function () {
  2968. var CORRECT_SETTER = false;
  2969. var test = {};
  2970. var setter;
  2971. try {
  2972. setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  2973. setter(test, []);
  2974. CORRECT_SETTER = test instanceof Array;
  2975. } catch (error) {
  2976. }
  2977. return function setPrototypeOf(O, proto) {
  2978. anObject(O);
  2979. aPossiblePrototype(proto);
  2980. if (CORRECT_SETTER)
  2981. setter(O, proto);
  2982. else
  2983. O.__proto__ = proto;
  2984. return O;
  2985. };
  2986. }()) : undefined);
  2987. /***/ }),
  2988. /* 88 */
  2989. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2990. var isCallable = __w_pdfjs_require__(25);
  2991. var $String = String;
  2992. var $TypeError = TypeError;
  2993. module.exports = function (argument) {
  2994. if (typeof argument == 'object' || isCallable(argument))
  2995. return argument;
  2996. throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
  2997. };
  2998. /***/ }),
  2999. /* 89 */
  3000. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3001. __w_pdfjs_require__(90);
  3002. __w_pdfjs_require__(97);
  3003. __w_pdfjs_require__(99);
  3004. __w_pdfjs_require__(122);
  3005. __w_pdfjs_require__(124);
  3006. var path = __w_pdfjs_require__(133);
  3007. module.exports = path.structuredClone;
  3008. /***/ }),
  3009. /* 90 */
  3010. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3011. "use strict";
  3012. var toIndexedObject = __w_pdfjs_require__(16);
  3013. var addToUnscopables = __w_pdfjs_require__(73);
  3014. var Iterators = __w_pdfjs_require__(91);
  3015. var InternalStateModule = __w_pdfjs_require__(56);
  3016. var defineProperty = (__w_pdfjs_require__(49).f);
  3017. var defineIterator = __w_pdfjs_require__(92);
  3018. var createIterResultObject = __w_pdfjs_require__(96);
  3019. var IS_PURE = __w_pdfjs_require__(40);
  3020. var DESCRIPTORS = __w_pdfjs_require__(10);
  3021. var ARRAY_ITERATOR = 'Array Iterator';
  3022. var setInternalState = InternalStateModule.set;
  3023. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  3024. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  3025. setInternalState(this, {
  3026. type: ARRAY_ITERATOR,
  3027. target: toIndexedObject(iterated),
  3028. index: 0,
  3029. kind: kind
  3030. });
  3031. }, function () {
  3032. var state = getInternalState(this);
  3033. var target = state.target;
  3034. var kind = state.kind;
  3035. var index = state.index++;
  3036. if (!target || index >= target.length) {
  3037. state.target = undefined;
  3038. return createIterResultObject(undefined, true);
  3039. }
  3040. if (kind == 'keys')
  3041. return createIterResultObject(index, false);
  3042. if (kind == 'values')
  3043. return createIterResultObject(target[index], false);
  3044. return createIterResultObject([
  3045. index,
  3046. target[index]
  3047. ], false);
  3048. }, 'values');
  3049. var values = Iterators.Arguments = Iterators.Array;
  3050. addToUnscopables('keys');
  3051. addToUnscopables('values');
  3052. addToUnscopables('entries');
  3053. if (!IS_PURE && DESCRIPTORS && values.name !== 'values')
  3054. try {
  3055. defineProperty(values, 'name', { value: 'values' });
  3056. } catch (error) {
  3057. }
  3058. /***/ }),
  3059. /* 91 */
  3060. /***/ ((module) => {
  3061. module.exports = {};
  3062. /***/ }),
  3063. /* 92 */
  3064. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3065. "use strict";
  3066. var $ = __w_pdfjs_require__(7);
  3067. var call = __w_pdfjs_require__(12);
  3068. var IS_PURE = __w_pdfjs_require__(40);
  3069. var FunctionName = __w_pdfjs_require__(54);
  3070. var isCallable = __w_pdfjs_require__(25);
  3071. var createIteratorConstructor = __w_pdfjs_require__(93);
  3072. var getPrototypeOf = __w_pdfjs_require__(85);
  3073. var setPrototypeOf = __w_pdfjs_require__(87);
  3074. var setToStringTag = __w_pdfjs_require__(95);
  3075. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  3076. var defineBuiltIn = __w_pdfjs_require__(52);
  3077. var wellKnownSymbol = __w_pdfjs_require__(38);
  3078. var Iterators = __w_pdfjs_require__(91);
  3079. var IteratorsCore = __w_pdfjs_require__(94);
  3080. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  3081. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  3082. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  3083. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  3084. var ITERATOR = wellKnownSymbol('iterator');
  3085. var KEYS = 'keys';
  3086. var VALUES = 'values';
  3087. var ENTRIES = 'entries';
  3088. var returnThis = function () {
  3089. return this;
  3090. };
  3091. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  3092. createIteratorConstructor(IteratorConstructor, NAME, next);
  3093. var getIterationMethod = function (KIND) {
  3094. if (KIND === DEFAULT && defaultIterator)
  3095. return defaultIterator;
  3096. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
  3097. return IterablePrototype[KIND];
  3098. switch (KIND) {
  3099. case KEYS:
  3100. return function keys() {
  3101. return new IteratorConstructor(this, KIND);
  3102. };
  3103. case VALUES:
  3104. return function values() {
  3105. return new IteratorConstructor(this, KIND);
  3106. };
  3107. case ENTRIES:
  3108. return function entries() {
  3109. return new IteratorConstructor(this, KIND);
  3110. };
  3111. }
  3112. return function () {
  3113. return new IteratorConstructor(this);
  3114. };
  3115. };
  3116. var TO_STRING_TAG = NAME + ' Iterator';
  3117. var INCORRECT_VALUES_NAME = false;
  3118. var IterablePrototype = Iterable.prototype;
  3119. var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
  3120. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  3121. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  3122. var CurrentIteratorPrototype, methods, KEY;
  3123. if (anyNativeIterator) {
  3124. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  3125. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  3126. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  3127. if (setPrototypeOf) {
  3128. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  3129. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
  3130. defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
  3131. }
  3132. }
  3133. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  3134. if (IS_PURE)
  3135. Iterators[TO_STRING_TAG] = returnThis;
  3136. }
  3137. }
  3138. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  3139. if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
  3140. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  3141. } else {
  3142. INCORRECT_VALUES_NAME = true;
  3143. defaultIterator = function values() {
  3144. return call(nativeIterator, this);
  3145. };
  3146. }
  3147. }
  3148. if (DEFAULT) {
  3149. methods = {
  3150. values: getIterationMethod(VALUES),
  3151. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  3152. entries: getIterationMethod(ENTRIES)
  3153. };
  3154. if (FORCED)
  3155. for (KEY in methods) {
  3156. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  3157. defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
  3158. }
  3159. }
  3160. else
  3161. $({
  3162. target: NAME,
  3163. proto: true,
  3164. forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
  3165. }, methods);
  3166. }
  3167. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  3168. defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  3169. }
  3170. Iterators[NAME] = defaultIterator;
  3171. return methods;
  3172. };
  3173. /***/ }),
  3174. /* 93 */
  3175. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3176. "use strict";
  3177. var IteratorPrototype = (__w_pdfjs_require__(94).IteratorPrototype);
  3178. var create = __w_pdfjs_require__(74);
  3179. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3180. var setToStringTag = __w_pdfjs_require__(95);
  3181. var Iterators = __w_pdfjs_require__(91);
  3182. var returnThis = function () {
  3183. return this;
  3184. };
  3185. module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  3186. var TO_STRING_TAG = NAME + ' Iterator';
  3187. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  3188. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  3189. Iterators[TO_STRING_TAG] = returnThis;
  3190. return IteratorConstructor;
  3191. };
  3192. /***/ }),
  3193. /* 94 */
  3194. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3195. "use strict";
  3196. var fails = __w_pdfjs_require__(11);
  3197. var isCallable = __w_pdfjs_require__(25);
  3198. var isObject = __w_pdfjs_require__(24);
  3199. var create = __w_pdfjs_require__(74);
  3200. var getPrototypeOf = __w_pdfjs_require__(85);
  3201. var defineBuiltIn = __w_pdfjs_require__(52);
  3202. var wellKnownSymbol = __w_pdfjs_require__(38);
  3203. var IS_PURE = __w_pdfjs_require__(40);
  3204. var ITERATOR = wellKnownSymbol('iterator');
  3205. var BUGGY_SAFARI_ITERATORS = false;
  3206. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  3207. if ([].keys) {
  3208. arrayIterator = [].keys();
  3209. if (!('next' in arrayIterator))
  3210. BUGGY_SAFARI_ITERATORS = true;
  3211. else {
  3212. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  3213. if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
  3214. IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  3215. }
  3216. }
  3217. var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {
  3218. var test = {};
  3219. return IteratorPrototype[ITERATOR].call(test) !== test;
  3220. });
  3221. if (NEW_ITERATOR_PROTOTYPE)
  3222. IteratorPrototype = {};
  3223. else if (IS_PURE)
  3224. IteratorPrototype = create(IteratorPrototype);
  3225. if (!isCallable(IteratorPrototype[ITERATOR])) {
  3226. defineBuiltIn(IteratorPrototype, ITERATOR, function () {
  3227. return this;
  3228. });
  3229. }
  3230. module.exports = {
  3231. IteratorPrototype: IteratorPrototype,
  3232. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  3233. };
  3234. /***/ }),
  3235. /* 95 */
  3236. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3237. var defineProperty = (__w_pdfjs_require__(49).f);
  3238. var hasOwn = __w_pdfjs_require__(43);
  3239. var wellKnownSymbol = __w_pdfjs_require__(38);
  3240. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  3241. module.exports = function (target, TAG, STATIC) {
  3242. if (target && !STATIC)
  3243. target = target.prototype;
  3244. if (target && !hasOwn(target, TO_STRING_TAG)) {
  3245. defineProperty(target, TO_STRING_TAG, {
  3246. configurable: true,
  3247. value: TAG
  3248. });
  3249. }
  3250. };
  3251. /***/ }),
  3252. /* 96 */
  3253. /***/ ((module) => {
  3254. module.exports = function (value, done) {
  3255. return {
  3256. value: value,
  3257. done: done
  3258. };
  3259. };
  3260. /***/ }),
  3261. /* 97 */
  3262. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3263. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(84);
  3264. var defineBuiltIn = __w_pdfjs_require__(52);
  3265. var toString = __w_pdfjs_require__(98);
  3266. if (!TO_STRING_TAG_SUPPORT) {
  3267. defineBuiltIn(Object.prototype, 'toString', toString, { unsafe: true });
  3268. }
  3269. /***/ }),
  3270. /* 98 */
  3271. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3272. "use strict";
  3273. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(84);
  3274. var classof = __w_pdfjs_require__(83);
  3275. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  3276. return '[object ' + classof(this) + ']';
  3277. };
  3278. /***/ }),
  3279. /* 99 */
  3280. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3281. __w_pdfjs_require__(100);
  3282. /***/ }),
  3283. /* 100 */
  3284. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3285. "use strict";
  3286. var collection = __w_pdfjs_require__(101);
  3287. var collectionStrong = __w_pdfjs_require__(119);
  3288. collection('Map', function (init) {
  3289. return function Map() {
  3290. return init(this, arguments.length ? arguments[0] : undefined);
  3291. };
  3292. }, collectionStrong);
  3293. /***/ }),
  3294. /* 101 */
  3295. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3296. "use strict";
  3297. var $ = __w_pdfjs_require__(7);
  3298. var global = __w_pdfjs_require__(8);
  3299. var uncurryThis = __w_pdfjs_require__(18);
  3300. var isForced = __w_pdfjs_require__(72);
  3301. var defineBuiltIn = __w_pdfjs_require__(52);
  3302. var InternalMetadataModule = __w_pdfjs_require__(102);
  3303. var iterate = __w_pdfjs_require__(109);
  3304. var anInstance = __w_pdfjs_require__(116);
  3305. var isCallable = __w_pdfjs_require__(25);
  3306. var isNullOrUndefined = __w_pdfjs_require__(21);
  3307. var isObject = __w_pdfjs_require__(24);
  3308. var fails = __w_pdfjs_require__(11);
  3309. var checkCorrectnessOfIteration = __w_pdfjs_require__(117);
  3310. var setToStringTag = __w_pdfjs_require__(95);
  3311. var inheritIfRequired = __w_pdfjs_require__(118);
  3312. module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  3313. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  3314. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  3315. var ADDER = IS_MAP ? 'set' : 'add';
  3316. var NativeConstructor = global[CONSTRUCTOR_NAME];
  3317. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  3318. var Constructor = NativeConstructor;
  3319. var exported = {};
  3320. var fixMethod = function (KEY) {
  3321. var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]);
  3322. defineBuiltIn(NativePrototype, KEY, KEY == 'add' ? function add(value) {
  3323. uncurriedNativeMethod(this, value === 0 ? 0 : value);
  3324. return this;
  3325. } : KEY == 'delete' ? function (key) {
  3326. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3327. } : KEY == 'get' ? function get(key) {
  3328. return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3329. } : KEY == 'has' ? function has(key) {
  3330. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3331. } : function set(key, value) {
  3332. uncurriedNativeMethod(this, key === 0 ? 0 : key, value);
  3333. return this;
  3334. });
  3335. };
  3336. var REPLACE = isForced(CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
  3337. new NativeConstructor().entries().next();
  3338. })));
  3339. if (REPLACE) {
  3340. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  3341. InternalMetadataModule.enable();
  3342. } else if (isForced(CONSTRUCTOR_NAME, true)) {
  3343. var instance = new Constructor();
  3344. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  3345. var THROWS_ON_PRIMITIVES = fails(function () {
  3346. instance.has(1);
  3347. });
  3348. var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) {
  3349. new NativeConstructor(iterable);
  3350. });
  3351. var BUGGY_ZERO = !IS_WEAK && fails(function () {
  3352. var $instance = new NativeConstructor();
  3353. var index = 5;
  3354. while (index--)
  3355. $instance[ADDER](index, index);
  3356. return !$instance.has(-0);
  3357. });
  3358. if (!ACCEPT_ITERABLES) {
  3359. Constructor = wrapper(function (dummy, iterable) {
  3360. anInstance(dummy, NativePrototype);
  3361. var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
  3362. if (!isNullOrUndefined(iterable))
  3363. iterate(iterable, that[ADDER], {
  3364. that: that,
  3365. AS_ENTRIES: IS_MAP
  3366. });
  3367. return that;
  3368. });
  3369. Constructor.prototype = NativePrototype;
  3370. NativePrototype.constructor = Constructor;
  3371. }
  3372. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  3373. fixMethod('delete');
  3374. fixMethod('has');
  3375. IS_MAP && fixMethod('get');
  3376. }
  3377. if (BUGGY_ZERO || HASNT_CHAINING)
  3378. fixMethod(ADDER);
  3379. if (IS_WEAK && NativePrototype.clear)
  3380. delete NativePrototype.clear;
  3381. }
  3382. exported[CONSTRUCTOR_NAME] = Constructor;
  3383. $({
  3384. global: true,
  3385. constructor: true,
  3386. forced: Constructor != NativeConstructor
  3387. }, exported);
  3388. setToStringTag(Constructor, CONSTRUCTOR_NAME);
  3389. if (!IS_WEAK)
  3390. common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  3391. return Constructor;
  3392. };
  3393. /***/ }),
  3394. /* 102 */
  3395. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3396. var $ = __w_pdfjs_require__(7);
  3397. var uncurryThis = __w_pdfjs_require__(18);
  3398. var hiddenKeys = __w_pdfjs_require__(59);
  3399. var isObject = __w_pdfjs_require__(24);
  3400. var hasOwn = __w_pdfjs_require__(43);
  3401. var defineProperty = (__w_pdfjs_require__(49).f);
  3402. var getOwnPropertyNamesModule = __w_pdfjs_require__(62);
  3403. var getOwnPropertyNamesExternalModule = __w_pdfjs_require__(103);
  3404. var isExtensible = __w_pdfjs_require__(106);
  3405. var uid = __w_pdfjs_require__(45);
  3406. var FREEZING = __w_pdfjs_require__(108);
  3407. var REQUIRED = false;
  3408. var METADATA = uid('meta');
  3409. var id = 0;
  3410. var setMetadata = function (it) {
  3411. defineProperty(it, METADATA, {
  3412. value: {
  3413. objectID: 'O' + id++,
  3414. weakData: {}
  3415. }
  3416. });
  3417. };
  3418. var fastKey = function (it, create) {
  3419. if (!isObject(it))
  3420. return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  3421. if (!hasOwn(it, METADATA)) {
  3422. if (!isExtensible(it))
  3423. return 'F';
  3424. if (!create)
  3425. return 'E';
  3426. setMetadata(it);
  3427. }
  3428. return it[METADATA].objectID;
  3429. };
  3430. var getWeakData = function (it, create) {
  3431. if (!hasOwn(it, METADATA)) {
  3432. if (!isExtensible(it))
  3433. return true;
  3434. if (!create)
  3435. return false;
  3436. setMetadata(it);
  3437. }
  3438. return it[METADATA].weakData;
  3439. };
  3440. var onFreeze = function (it) {
  3441. if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA))
  3442. setMetadata(it);
  3443. return it;
  3444. };
  3445. var enable = function () {
  3446. meta.enable = function () {
  3447. };
  3448. REQUIRED = true;
  3449. var getOwnPropertyNames = getOwnPropertyNamesModule.f;
  3450. var splice = uncurryThis([].splice);
  3451. var test = {};
  3452. test[METADATA] = 1;
  3453. if (getOwnPropertyNames(test).length) {
  3454. getOwnPropertyNamesModule.f = function (it) {
  3455. var result = getOwnPropertyNames(it);
  3456. for (var i = 0, length = result.length; i < length; i++) {
  3457. if (result[i] === METADATA) {
  3458. splice(result, i, 1);
  3459. break;
  3460. }
  3461. }
  3462. return result;
  3463. };
  3464. $({
  3465. target: 'Object',
  3466. stat: true,
  3467. forced: true
  3468. }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f });
  3469. }
  3470. };
  3471. var meta = module.exports = {
  3472. enable: enable,
  3473. fastKey: fastKey,
  3474. getWeakData: getWeakData,
  3475. onFreeze: onFreeze
  3476. };
  3477. hiddenKeys[METADATA] = true;
  3478. /***/ }),
  3479. /* 103 */
  3480. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3481. var classof = __w_pdfjs_require__(19);
  3482. var toIndexedObject = __w_pdfjs_require__(16);
  3483. var $getOwnPropertyNames = (__w_pdfjs_require__(62).f);
  3484. var arraySlice = __w_pdfjs_require__(104);
  3485. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  3486. var getWindowNames = function (it) {
  3487. try {
  3488. return $getOwnPropertyNames(it);
  3489. } catch (error) {
  3490. return arraySlice(windowNames);
  3491. }
  3492. };
  3493. module.exports.f = function getOwnPropertyNames(it) {
  3494. return windowNames && classof(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it));
  3495. };
  3496. /***/ }),
  3497. /* 104 */
  3498. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3499. var toAbsoluteIndex = __w_pdfjs_require__(65);
  3500. var lengthOfArrayLike = __w_pdfjs_require__(68);
  3501. var createProperty = __w_pdfjs_require__(105);
  3502. var $Array = Array;
  3503. var max = Math.max;
  3504. module.exports = function (O, start, end) {
  3505. var length = lengthOfArrayLike(O);
  3506. var k = toAbsoluteIndex(start, length);
  3507. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  3508. var result = $Array(max(fin - k, 0));
  3509. for (var n = 0; k < fin; k++, n++)
  3510. createProperty(result, n, O[k]);
  3511. result.length = n;
  3512. return result;
  3513. };
  3514. /***/ }),
  3515. /* 105 */
  3516. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3517. "use strict";
  3518. var toPropertyKey = __w_pdfjs_require__(22);
  3519. var definePropertyModule = __w_pdfjs_require__(49);
  3520. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3521. module.exports = function (object, key, value) {
  3522. var propertyKey = toPropertyKey(key);
  3523. if (propertyKey in object)
  3524. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  3525. else
  3526. object[propertyKey] = value;
  3527. };
  3528. /***/ }),
  3529. /* 106 */
  3530. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3531. var fails = __w_pdfjs_require__(11);
  3532. var isObject = __w_pdfjs_require__(24);
  3533. var classof = __w_pdfjs_require__(19);
  3534. var ARRAY_BUFFER_NON_EXTENSIBLE = __w_pdfjs_require__(107);
  3535. var $isExtensible = Object.isExtensible;
  3536. var FAILS_ON_PRIMITIVES = fails(function () {
  3537. $isExtensible(1);
  3538. });
  3539. module.exports = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it) {
  3540. if (!isObject(it))
  3541. return false;
  3542. if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer')
  3543. return false;
  3544. return $isExtensible ? $isExtensible(it) : true;
  3545. } : $isExtensible;
  3546. /***/ }),
  3547. /* 107 */
  3548. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3549. var fails = __w_pdfjs_require__(11);
  3550. module.exports = fails(function () {
  3551. if (typeof ArrayBuffer == 'function') {
  3552. var buffer = new ArrayBuffer(8);
  3553. if (Object.isExtensible(buffer))
  3554. Object.defineProperty(buffer, 'a', { value: 8 });
  3555. }
  3556. });
  3557. /***/ }),
  3558. /* 108 */
  3559. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3560. var fails = __w_pdfjs_require__(11);
  3561. module.exports = !fails(function () {
  3562. return Object.isExtensible(Object.preventExtensions({}));
  3563. });
  3564. /***/ }),
  3565. /* 109 */
  3566. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3567. var bind = __w_pdfjs_require__(110);
  3568. var call = __w_pdfjs_require__(12);
  3569. var anObject = __w_pdfjs_require__(51);
  3570. var tryToString = __w_pdfjs_require__(36);
  3571. var isArrayIteratorMethod = __w_pdfjs_require__(112);
  3572. var lengthOfArrayLike = __w_pdfjs_require__(68);
  3573. var isPrototypeOf = __w_pdfjs_require__(29);
  3574. var getIterator = __w_pdfjs_require__(113);
  3575. var getIteratorMethod = __w_pdfjs_require__(114);
  3576. var iteratorClose = __w_pdfjs_require__(115);
  3577. var $TypeError = TypeError;
  3578. var Result = function (stopped, result) {
  3579. this.stopped = stopped;
  3580. this.result = result;
  3581. };
  3582. var ResultPrototype = Result.prototype;
  3583. module.exports = function (iterable, unboundFunction, options) {
  3584. var that = options && options.that;
  3585. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  3586. var IS_RECORD = !!(options && options.IS_RECORD);
  3587. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  3588. var INTERRUPTED = !!(options && options.INTERRUPTED);
  3589. var fn = bind(unboundFunction, that);
  3590. var iterator, iterFn, index, length, result, next, step;
  3591. var stop = function (condition) {
  3592. if (iterator)
  3593. iteratorClose(iterator, 'normal', condition);
  3594. return new Result(true, condition);
  3595. };
  3596. var callFn = function (value) {
  3597. if (AS_ENTRIES) {
  3598. anObject(value);
  3599. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  3600. }
  3601. return INTERRUPTED ? fn(value, stop) : fn(value);
  3602. };
  3603. if (IS_RECORD) {
  3604. iterator = iterable.iterator;
  3605. } else if (IS_ITERATOR) {
  3606. iterator = iterable;
  3607. } else {
  3608. iterFn = getIteratorMethod(iterable);
  3609. if (!iterFn)
  3610. throw $TypeError(tryToString(iterable) + ' is not iterable');
  3611. if (isArrayIteratorMethod(iterFn)) {
  3612. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  3613. result = callFn(iterable[index]);
  3614. if (result && isPrototypeOf(ResultPrototype, result))
  3615. return result;
  3616. }
  3617. return new Result(false);
  3618. }
  3619. iterator = getIterator(iterable, iterFn);
  3620. }
  3621. next = IS_RECORD ? iterable.next : iterator.next;
  3622. while (!(step = call(next, iterator)).done) {
  3623. try {
  3624. result = callFn(step.value);
  3625. } catch (error) {
  3626. iteratorClose(iterator, 'throw', error);
  3627. }
  3628. if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result))
  3629. return result;
  3630. }
  3631. return new Result(false);
  3632. };
  3633. /***/ }),
  3634. /* 110 */
  3635. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3636. var uncurryThis = __w_pdfjs_require__(111);
  3637. var aCallable = __w_pdfjs_require__(35);
  3638. var NATIVE_BIND = __w_pdfjs_require__(13);
  3639. var bind = uncurryThis(uncurryThis.bind);
  3640. module.exports = function (fn, that) {
  3641. aCallable(fn);
  3642. return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function () {
  3643. return fn.apply(that, arguments);
  3644. };
  3645. };
  3646. /***/ }),
  3647. /* 111 */
  3648. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3649. var classofRaw = __w_pdfjs_require__(19);
  3650. var uncurryThis = __w_pdfjs_require__(18);
  3651. module.exports = function (fn) {
  3652. if (classofRaw(fn) === 'Function')
  3653. return uncurryThis(fn);
  3654. };
  3655. /***/ }),
  3656. /* 112 */
  3657. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3658. var wellKnownSymbol = __w_pdfjs_require__(38);
  3659. var Iterators = __w_pdfjs_require__(91);
  3660. var ITERATOR = wellKnownSymbol('iterator');
  3661. var ArrayPrototype = Array.prototype;
  3662. module.exports = function (it) {
  3663. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  3664. };
  3665. /***/ }),
  3666. /* 113 */
  3667. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3668. var call = __w_pdfjs_require__(12);
  3669. var aCallable = __w_pdfjs_require__(35);
  3670. var anObject = __w_pdfjs_require__(51);
  3671. var tryToString = __w_pdfjs_require__(36);
  3672. var getIteratorMethod = __w_pdfjs_require__(114);
  3673. var $TypeError = TypeError;
  3674. module.exports = function (argument, usingIterator) {
  3675. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  3676. if (aCallable(iteratorMethod))
  3677. return anObject(call(iteratorMethod, argument));
  3678. throw $TypeError(tryToString(argument) + ' is not iterable');
  3679. };
  3680. /***/ }),
  3681. /* 114 */
  3682. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3683. var classof = __w_pdfjs_require__(83);
  3684. var getMethod = __w_pdfjs_require__(34);
  3685. var isNullOrUndefined = __w_pdfjs_require__(21);
  3686. var Iterators = __w_pdfjs_require__(91);
  3687. var wellKnownSymbol = __w_pdfjs_require__(38);
  3688. var ITERATOR = wellKnownSymbol('iterator');
  3689. module.exports = function (it) {
  3690. if (!isNullOrUndefined(it))
  3691. return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)];
  3692. };
  3693. /***/ }),
  3694. /* 115 */
  3695. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3696. var call = __w_pdfjs_require__(12);
  3697. var anObject = __w_pdfjs_require__(51);
  3698. var getMethod = __w_pdfjs_require__(34);
  3699. module.exports = function (iterator, kind, value) {
  3700. var innerResult, innerError;
  3701. anObject(iterator);
  3702. try {
  3703. innerResult = getMethod(iterator, 'return');
  3704. if (!innerResult) {
  3705. if (kind === 'throw')
  3706. throw value;
  3707. return value;
  3708. }
  3709. innerResult = call(innerResult, iterator);
  3710. } catch (error) {
  3711. innerError = true;
  3712. innerResult = error;
  3713. }
  3714. if (kind === 'throw')
  3715. throw value;
  3716. if (innerError)
  3717. throw innerResult;
  3718. anObject(innerResult);
  3719. return value;
  3720. };
  3721. /***/ }),
  3722. /* 116 */
  3723. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3724. var isPrototypeOf = __w_pdfjs_require__(29);
  3725. var $TypeError = TypeError;
  3726. module.exports = function (it, Prototype) {
  3727. if (isPrototypeOf(Prototype, it))
  3728. return it;
  3729. throw $TypeError('Incorrect invocation');
  3730. };
  3731. /***/ }),
  3732. /* 117 */
  3733. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3734. var wellKnownSymbol = __w_pdfjs_require__(38);
  3735. var ITERATOR = wellKnownSymbol('iterator');
  3736. var SAFE_CLOSING = false;
  3737. try {
  3738. var called = 0;
  3739. var iteratorWithReturn = {
  3740. next: function () {
  3741. return { done: !!called++ };
  3742. },
  3743. 'return': function () {
  3744. SAFE_CLOSING = true;
  3745. }
  3746. };
  3747. iteratorWithReturn[ITERATOR] = function () {
  3748. return this;
  3749. };
  3750. Array.from(iteratorWithReturn, function () {
  3751. throw 2;
  3752. });
  3753. } catch (error) {
  3754. }
  3755. module.exports = function (exec, SKIP_CLOSING) {
  3756. if (!SKIP_CLOSING && !SAFE_CLOSING)
  3757. return false;
  3758. var ITERATION_SUPPORT = false;
  3759. try {
  3760. var object = {};
  3761. object[ITERATOR] = function () {
  3762. return {
  3763. next: function () {
  3764. return { done: ITERATION_SUPPORT = true };
  3765. }
  3766. };
  3767. };
  3768. exec(object);
  3769. } catch (error) {
  3770. }
  3771. return ITERATION_SUPPORT;
  3772. };
  3773. /***/ }),
  3774. /* 118 */
  3775. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3776. var isCallable = __w_pdfjs_require__(25);
  3777. var isObject = __w_pdfjs_require__(24);
  3778. var setPrototypeOf = __w_pdfjs_require__(87);
  3779. module.exports = function ($this, dummy, Wrapper) {
  3780. var NewTarget, NewTargetPrototype;
  3781. if (setPrototypeOf && isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype)
  3782. setPrototypeOf($this, NewTargetPrototype);
  3783. return $this;
  3784. };
  3785. /***/ }),
  3786. /* 119 */
  3787. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3788. "use strict";
  3789. var defineProperty = (__w_pdfjs_require__(49).f);
  3790. var create = __w_pdfjs_require__(74);
  3791. var defineBuiltIns = __w_pdfjs_require__(120);
  3792. var bind = __w_pdfjs_require__(110);
  3793. var anInstance = __w_pdfjs_require__(116);
  3794. var isNullOrUndefined = __w_pdfjs_require__(21);
  3795. var iterate = __w_pdfjs_require__(109);
  3796. var defineIterator = __w_pdfjs_require__(92);
  3797. var createIterResultObject = __w_pdfjs_require__(96);
  3798. var setSpecies = __w_pdfjs_require__(121);
  3799. var DESCRIPTORS = __w_pdfjs_require__(10);
  3800. var fastKey = (__w_pdfjs_require__(102).fastKey);
  3801. var InternalStateModule = __w_pdfjs_require__(56);
  3802. var setInternalState = InternalStateModule.set;
  3803. var internalStateGetterFor = InternalStateModule.getterFor;
  3804. module.exports = {
  3805. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  3806. var Constructor = wrapper(function (that, iterable) {
  3807. anInstance(that, Prototype);
  3808. setInternalState(that, {
  3809. type: CONSTRUCTOR_NAME,
  3810. index: create(null),
  3811. first: undefined,
  3812. last: undefined,
  3813. size: 0
  3814. });
  3815. if (!DESCRIPTORS)
  3816. that.size = 0;
  3817. if (!isNullOrUndefined(iterable))
  3818. iterate(iterable, that[ADDER], {
  3819. that: that,
  3820. AS_ENTRIES: IS_MAP
  3821. });
  3822. });
  3823. var Prototype = Constructor.prototype;
  3824. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3825. var define = function (that, key, value) {
  3826. var state = getInternalState(that);
  3827. var entry = getEntry(that, key);
  3828. var previous, index;
  3829. if (entry) {
  3830. entry.value = value;
  3831. } else {
  3832. state.last = entry = {
  3833. index: index = fastKey(key, true),
  3834. key: key,
  3835. value: value,
  3836. previous: previous = state.last,
  3837. next: undefined,
  3838. removed: false
  3839. };
  3840. if (!state.first)
  3841. state.first = entry;
  3842. if (previous)
  3843. previous.next = entry;
  3844. if (DESCRIPTORS)
  3845. state.size++;
  3846. else
  3847. that.size++;
  3848. if (index !== 'F')
  3849. state.index[index] = entry;
  3850. }
  3851. return that;
  3852. };
  3853. var getEntry = function (that, key) {
  3854. var state = getInternalState(that);
  3855. var index = fastKey(key);
  3856. var entry;
  3857. if (index !== 'F')
  3858. return state.index[index];
  3859. for (entry = state.first; entry; entry = entry.next) {
  3860. if (entry.key == key)
  3861. return entry;
  3862. }
  3863. };
  3864. defineBuiltIns(Prototype, {
  3865. clear: function clear() {
  3866. var that = this;
  3867. var state = getInternalState(that);
  3868. var data = state.index;
  3869. var entry = state.first;
  3870. while (entry) {
  3871. entry.removed = true;
  3872. if (entry.previous)
  3873. entry.previous = entry.previous.next = undefined;
  3874. delete data[entry.index];
  3875. entry = entry.next;
  3876. }
  3877. state.first = state.last = undefined;
  3878. if (DESCRIPTORS)
  3879. state.size = 0;
  3880. else
  3881. that.size = 0;
  3882. },
  3883. 'delete': function (key) {
  3884. var that = this;
  3885. var state = getInternalState(that);
  3886. var entry = getEntry(that, key);
  3887. if (entry) {
  3888. var next = entry.next;
  3889. var prev = entry.previous;
  3890. delete state.index[entry.index];
  3891. entry.removed = true;
  3892. if (prev)
  3893. prev.next = next;
  3894. if (next)
  3895. next.previous = prev;
  3896. if (state.first == entry)
  3897. state.first = next;
  3898. if (state.last == entry)
  3899. state.last = prev;
  3900. if (DESCRIPTORS)
  3901. state.size--;
  3902. else
  3903. that.size--;
  3904. }
  3905. return !!entry;
  3906. },
  3907. forEach: function forEach(callbackfn) {
  3908. var state = getInternalState(this);
  3909. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  3910. var entry;
  3911. while (entry = entry ? entry.next : state.first) {
  3912. boundFunction(entry.value, entry.key, this);
  3913. while (entry && entry.removed)
  3914. entry = entry.previous;
  3915. }
  3916. },
  3917. has: function has(key) {
  3918. return !!getEntry(this, key);
  3919. }
  3920. });
  3921. defineBuiltIns(Prototype, IS_MAP ? {
  3922. get: function get(key) {
  3923. var entry = getEntry(this, key);
  3924. return entry && entry.value;
  3925. },
  3926. set: function set(key, value) {
  3927. return define(this, key === 0 ? 0 : key, value);
  3928. }
  3929. } : {
  3930. add: function add(value) {
  3931. return define(this, value = value === 0 ? 0 : value, value);
  3932. }
  3933. });
  3934. if (DESCRIPTORS)
  3935. defineProperty(Prototype, 'size', {
  3936. get: function () {
  3937. return getInternalState(this).size;
  3938. }
  3939. });
  3940. return Constructor;
  3941. },
  3942. setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
  3943. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  3944. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3945. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  3946. defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
  3947. setInternalState(this, {
  3948. type: ITERATOR_NAME,
  3949. target: iterated,
  3950. state: getInternalCollectionState(iterated),
  3951. kind: kind,
  3952. last: undefined
  3953. });
  3954. }, function () {
  3955. var state = getInternalIteratorState(this);
  3956. var kind = state.kind;
  3957. var entry = state.last;
  3958. while (entry && entry.removed)
  3959. entry = entry.previous;
  3960. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  3961. state.target = undefined;
  3962. return createIterResultObject(undefined, true);
  3963. }
  3964. if (kind == 'keys')
  3965. return createIterResultObject(entry.key, false);
  3966. if (kind == 'values')
  3967. return createIterResultObject(entry.value, false);
  3968. return createIterResultObject([
  3969. entry.key,
  3970. entry.value
  3971. ], false);
  3972. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  3973. setSpecies(CONSTRUCTOR_NAME);
  3974. }
  3975. };
  3976. /***/ }),
  3977. /* 120 */
  3978. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3979. var defineBuiltIn = __w_pdfjs_require__(52);
  3980. module.exports = function (target, src, options) {
  3981. for (var key in src)
  3982. defineBuiltIn(target, key, src[key], options);
  3983. return target;
  3984. };
  3985. /***/ }),
  3986. /* 121 */
  3987. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3988. "use strict";
  3989. var getBuiltIn = __w_pdfjs_require__(28);
  3990. var definePropertyModule = __w_pdfjs_require__(49);
  3991. var wellKnownSymbol = __w_pdfjs_require__(38);
  3992. var DESCRIPTORS = __w_pdfjs_require__(10);
  3993. var SPECIES = wellKnownSymbol('species');
  3994. module.exports = function (CONSTRUCTOR_NAME) {
  3995. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  3996. var defineProperty = definePropertyModule.f;
  3997. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  3998. defineProperty(Constructor, SPECIES, {
  3999. configurable: true,
  4000. get: function () {
  4001. return this;
  4002. }
  4003. });
  4004. }
  4005. };
  4006. /***/ }),
  4007. /* 122 */
  4008. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4009. __w_pdfjs_require__(123);
  4010. /***/ }),
  4011. /* 123 */
  4012. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4013. "use strict";
  4014. var collection = __w_pdfjs_require__(101);
  4015. var collectionStrong = __w_pdfjs_require__(119);
  4016. collection('Set', function (init) {
  4017. return function Set() {
  4018. return init(this, arguments.length ? arguments[0] : undefined);
  4019. };
  4020. }, collectionStrong);
  4021. /***/ }),
  4022. /* 124 */
  4023. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4024. var IS_PURE = __w_pdfjs_require__(40);
  4025. var $ = __w_pdfjs_require__(7);
  4026. var global = __w_pdfjs_require__(8);
  4027. var getBuiltin = __w_pdfjs_require__(28);
  4028. var uncurryThis = __w_pdfjs_require__(18);
  4029. var fails = __w_pdfjs_require__(11);
  4030. var uid = __w_pdfjs_require__(45);
  4031. var isCallable = __w_pdfjs_require__(25);
  4032. var isConstructor = __w_pdfjs_require__(125);
  4033. var isNullOrUndefined = __w_pdfjs_require__(21);
  4034. var isObject = __w_pdfjs_require__(24);
  4035. var isSymbol = __w_pdfjs_require__(27);
  4036. var iterate = __w_pdfjs_require__(109);
  4037. var anObject = __w_pdfjs_require__(51);
  4038. var classof = __w_pdfjs_require__(83);
  4039. var hasOwn = __w_pdfjs_require__(43);
  4040. var createProperty = __w_pdfjs_require__(105);
  4041. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  4042. var lengthOfArrayLike = __w_pdfjs_require__(68);
  4043. var validateArgumentsLength = __w_pdfjs_require__(126);
  4044. var getRegExpFlags = __w_pdfjs_require__(127);
  4045. var ERROR_STACK_INSTALLABLE = __w_pdfjs_require__(129);
  4046. var V8 = __w_pdfjs_require__(32);
  4047. var IS_BROWSER = __w_pdfjs_require__(130);
  4048. var IS_DENO = __w_pdfjs_require__(131);
  4049. var IS_NODE = __w_pdfjs_require__(132);
  4050. var Object = global.Object;
  4051. var Date = global.Date;
  4052. var Error = global.Error;
  4053. var EvalError = global.EvalError;
  4054. var RangeError = global.RangeError;
  4055. var ReferenceError = global.ReferenceError;
  4056. var SyntaxError = global.SyntaxError;
  4057. var TypeError = global.TypeError;
  4058. var URIError = global.URIError;
  4059. var PerformanceMark = global.PerformanceMark;
  4060. var WebAssembly = global.WebAssembly;
  4061. var CompileError = WebAssembly && WebAssembly.CompileError || Error;
  4062. var LinkError = WebAssembly && WebAssembly.LinkError || Error;
  4063. var RuntimeError = WebAssembly && WebAssembly.RuntimeError || Error;
  4064. var DOMException = getBuiltin('DOMException');
  4065. var Set = getBuiltin('Set');
  4066. var Map = getBuiltin('Map');
  4067. var MapPrototype = Map.prototype;
  4068. var mapHas = uncurryThis(MapPrototype.has);
  4069. var mapGet = uncurryThis(MapPrototype.get);
  4070. var mapSet = uncurryThis(MapPrototype.set);
  4071. var setAdd = uncurryThis(Set.prototype.add);
  4072. var objectKeys = getBuiltin('Object', 'keys');
  4073. var push = uncurryThis([].push);
  4074. var thisBooleanValue = uncurryThis(true.valueOf);
  4075. var thisNumberValue = uncurryThis(1.0.valueOf);
  4076. var thisStringValue = uncurryThis(''.valueOf);
  4077. var thisTimeValue = uncurryThis(Date.prototype.getTime);
  4078. var PERFORMANCE_MARK = uid('structuredClone');
  4079. var DATA_CLONE_ERROR = 'DataCloneError';
  4080. var TRANSFERRING = 'Transferring';
  4081. var checkBasicSemantic = function (structuredCloneImplementation) {
  4082. return !fails(function () {
  4083. var set1 = new global.Set([7]);
  4084. var set2 = structuredCloneImplementation(set1);
  4085. var number = structuredCloneImplementation(Object(7));
  4086. return set2 == set1 || !set2.has(7) || typeof number != 'object' || number != 7;
  4087. }) && structuredCloneImplementation;
  4088. };
  4089. var checkErrorsCloning = function (structuredCloneImplementation, $Error) {
  4090. return !fails(function () {
  4091. var error = new $Error();
  4092. var test = structuredCloneImplementation({
  4093. a: error,
  4094. b: error
  4095. });
  4096. return !(test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack);
  4097. });
  4098. };
  4099. var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) {
  4100. return !fails(function () {
  4101. var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 }));
  4102. return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3;
  4103. });
  4104. };
  4105. var nativeStructuredClone = global.structuredClone;
  4106. var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone, Error) || !checkErrorsCloning(nativeStructuredClone, DOMException) || !checkNewErrorsCloningSemantic(nativeStructuredClone);
  4107. var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {
  4108. return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;
  4109. });
  4110. var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark;
  4111. var throwUncloneable = function (type) {
  4112. throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR);
  4113. };
  4114. var throwUnpolyfillable = function (type, action) {
  4115. throw new DOMException((action || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR);
  4116. };
  4117. var createDataTransfer = function () {
  4118. var dataTransfer;
  4119. try {
  4120. dataTransfer = new global.DataTransfer();
  4121. } catch (error) {
  4122. try {
  4123. dataTransfer = new global.ClipboardEvent('').clipboardData;
  4124. } catch (error2) {
  4125. }
  4126. }
  4127. return dataTransfer && dataTransfer.items && dataTransfer.files ? dataTransfer : null;
  4128. };
  4129. var structuredCloneInternal = function (value, map) {
  4130. if (isSymbol(value))
  4131. throwUncloneable('Symbol');
  4132. if (!isObject(value))
  4133. return value;
  4134. if (map) {
  4135. if (mapHas(map, value))
  4136. return mapGet(map, value);
  4137. } else
  4138. map = new Map();
  4139. var type = classof(value);
  4140. var deep = false;
  4141. var C, name, cloned, dataTransfer, i, length, keys, key, source, target;
  4142. switch (type) {
  4143. case 'Array':
  4144. cloned = [];
  4145. deep = true;
  4146. break;
  4147. case 'Object':
  4148. cloned = {};
  4149. deep = true;
  4150. break;
  4151. case 'Map':
  4152. cloned = new Map();
  4153. deep = true;
  4154. break;
  4155. case 'Set':
  4156. cloned = new Set();
  4157. deep = true;
  4158. break;
  4159. case 'RegExp':
  4160. cloned = new RegExp(value.source, getRegExpFlags(value));
  4161. break;
  4162. case 'Error':
  4163. name = value.name;
  4164. switch (name) {
  4165. case 'AggregateError':
  4166. cloned = getBuiltin('AggregateError')([]);
  4167. break;
  4168. case 'EvalError':
  4169. cloned = EvalError();
  4170. break;
  4171. case 'RangeError':
  4172. cloned = RangeError();
  4173. break;
  4174. case 'ReferenceError':
  4175. cloned = ReferenceError();
  4176. break;
  4177. case 'SyntaxError':
  4178. cloned = SyntaxError();
  4179. break;
  4180. case 'TypeError':
  4181. cloned = TypeError();
  4182. break;
  4183. case 'URIError':
  4184. cloned = URIError();
  4185. break;
  4186. case 'CompileError':
  4187. cloned = CompileError();
  4188. break;
  4189. case 'LinkError':
  4190. cloned = LinkError();
  4191. break;
  4192. case 'RuntimeError':
  4193. cloned = RuntimeError();
  4194. break;
  4195. default:
  4196. cloned = Error();
  4197. }
  4198. deep = true;
  4199. break;
  4200. case 'DOMException':
  4201. cloned = new DOMException(value.message, value.name);
  4202. deep = true;
  4203. break;
  4204. case 'DataView':
  4205. case 'Int8Array':
  4206. case 'Uint8Array':
  4207. case 'Uint8ClampedArray':
  4208. case 'Int16Array':
  4209. case 'Uint16Array':
  4210. case 'Int32Array':
  4211. case 'Uint32Array':
  4212. case 'Float32Array':
  4213. case 'Float64Array':
  4214. case 'BigInt64Array':
  4215. case 'BigUint64Array':
  4216. C = global[type];
  4217. if (!isObject(C))
  4218. throwUnpolyfillable(type);
  4219. cloned = new C(structuredCloneInternal(value.buffer, map), value.byteOffset, type === 'DataView' ? value.byteLength : value.length);
  4220. break;
  4221. case 'DOMQuad':
  4222. try {
  4223. cloned = new DOMQuad(structuredCloneInternal(value.p1, map), structuredCloneInternal(value.p2, map), structuredCloneInternal(value.p3, map), structuredCloneInternal(value.p4, map));
  4224. } catch (error) {
  4225. if (nativeRestrictedStructuredClone) {
  4226. cloned = nativeRestrictedStructuredClone(value);
  4227. } else
  4228. throwUnpolyfillable(type);
  4229. }
  4230. break;
  4231. case 'FileList':
  4232. dataTransfer = createDataTransfer();
  4233. if (dataTransfer) {
  4234. for (i = 0, length = lengthOfArrayLike(value); i < length; i++) {
  4235. dataTransfer.items.add(structuredCloneInternal(value[i], map));
  4236. }
  4237. cloned = dataTransfer.files;
  4238. } else if (nativeRestrictedStructuredClone) {
  4239. cloned = nativeRestrictedStructuredClone(value);
  4240. } else
  4241. throwUnpolyfillable(type);
  4242. break;
  4243. case 'ImageData':
  4244. try {
  4245. cloned = new ImageData(structuredCloneInternal(value.data, map), value.width, value.height, { colorSpace: value.colorSpace });
  4246. } catch (error) {
  4247. if (nativeRestrictedStructuredClone) {
  4248. cloned = nativeRestrictedStructuredClone(value);
  4249. } else
  4250. throwUnpolyfillable(type);
  4251. }
  4252. break;
  4253. default:
  4254. if (nativeRestrictedStructuredClone) {
  4255. cloned = nativeRestrictedStructuredClone(value);
  4256. } else
  4257. switch (type) {
  4258. case 'BigInt':
  4259. cloned = Object(value.valueOf());
  4260. break;
  4261. case 'Boolean':
  4262. cloned = Object(thisBooleanValue(value));
  4263. break;
  4264. case 'Number':
  4265. cloned = Object(thisNumberValue(value));
  4266. break;
  4267. case 'String':
  4268. cloned = Object(thisStringValue(value));
  4269. break;
  4270. case 'Date':
  4271. cloned = new Date(thisTimeValue(value));
  4272. break;
  4273. case 'ArrayBuffer':
  4274. C = global.DataView;
  4275. if (!C && typeof value.slice != 'function')
  4276. throwUnpolyfillable(type);
  4277. try {
  4278. if (typeof value.slice == 'function') {
  4279. cloned = value.slice(0);
  4280. } else {
  4281. length = value.byteLength;
  4282. cloned = new ArrayBuffer(length);
  4283. source = new C(value);
  4284. target = new C(cloned);
  4285. for (i = 0; i < length; i++) {
  4286. target.setUint8(i, source.getUint8(i));
  4287. }
  4288. }
  4289. } catch (error) {
  4290. throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR);
  4291. }
  4292. break;
  4293. case 'SharedArrayBuffer':
  4294. cloned = value;
  4295. break;
  4296. case 'Blob':
  4297. try {
  4298. cloned = value.slice(0, value.size, value.type);
  4299. } catch (error) {
  4300. throwUnpolyfillable(type);
  4301. }
  4302. break;
  4303. case 'DOMPoint':
  4304. case 'DOMPointReadOnly':
  4305. C = global[type];
  4306. try {
  4307. cloned = C.fromPoint ? C.fromPoint(value) : new C(value.x, value.y, value.z, value.w);
  4308. } catch (error) {
  4309. throwUnpolyfillable(type);
  4310. }
  4311. break;
  4312. case 'DOMRect':
  4313. case 'DOMRectReadOnly':
  4314. C = global[type];
  4315. try {
  4316. cloned = C.fromRect ? C.fromRect(value) : new C(value.x, value.y, value.width, value.height);
  4317. } catch (error) {
  4318. throwUnpolyfillable(type);
  4319. }
  4320. break;
  4321. case 'DOMMatrix':
  4322. case 'DOMMatrixReadOnly':
  4323. C = global[type];
  4324. try {
  4325. cloned = C.fromMatrix ? C.fromMatrix(value) : new C(value);
  4326. } catch (error) {
  4327. throwUnpolyfillable(type);
  4328. }
  4329. break;
  4330. case 'AudioData':
  4331. case 'VideoFrame':
  4332. if (!isCallable(value.clone))
  4333. throwUnpolyfillable(type);
  4334. try {
  4335. cloned = value.clone();
  4336. } catch (error) {
  4337. throwUncloneable(type);
  4338. }
  4339. break;
  4340. case 'File':
  4341. try {
  4342. cloned = new File([value], value.name, value);
  4343. } catch (error) {
  4344. throwUnpolyfillable(type);
  4345. }
  4346. break;
  4347. case 'CropTarget':
  4348. case 'CryptoKey':
  4349. case 'FileSystemDirectoryHandle':
  4350. case 'FileSystemFileHandle':
  4351. case 'FileSystemHandle':
  4352. case 'GPUCompilationInfo':
  4353. case 'GPUCompilationMessage':
  4354. case 'ImageBitmap':
  4355. case 'RTCCertificate':
  4356. case 'WebAssembly.Module':
  4357. throwUnpolyfillable(type);
  4358. default:
  4359. throwUncloneable(type);
  4360. }
  4361. }
  4362. mapSet(map, value, cloned);
  4363. if (deep)
  4364. switch (type) {
  4365. case 'Array':
  4366. case 'Object':
  4367. keys = objectKeys(value);
  4368. for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) {
  4369. key = keys[i];
  4370. createProperty(cloned, key, structuredCloneInternal(value[key], map));
  4371. }
  4372. break;
  4373. case 'Map':
  4374. value.forEach(function (v, k) {
  4375. mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map));
  4376. });
  4377. break;
  4378. case 'Set':
  4379. value.forEach(function (v) {
  4380. setAdd(cloned, structuredCloneInternal(v, map));
  4381. });
  4382. break;
  4383. case 'Error':
  4384. createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map));
  4385. if (hasOwn(value, 'cause')) {
  4386. createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map));
  4387. }
  4388. if (name == 'AggregateError') {
  4389. cloned.errors = structuredCloneInternal(value.errors, map);
  4390. }
  4391. case 'DOMException':
  4392. if (ERROR_STACK_INSTALLABLE) {
  4393. createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map));
  4394. }
  4395. }
  4396. return cloned;
  4397. };
  4398. var PROPER_TRANSFER = nativeStructuredClone && !fails(function () {
  4399. if (IS_DENO && V8 > 92 || IS_NODE && V8 > 94 || IS_BROWSER && V8 > 97)
  4400. return false;
  4401. var buffer = new ArrayBuffer(8);
  4402. var clone = nativeStructuredClone(buffer, { transfer: [buffer] });
  4403. return buffer.byteLength != 0 || clone.byteLength != 8;
  4404. });
  4405. var tryToTransfer = function (rawTransfer, map) {
  4406. if (!isObject(rawTransfer))
  4407. throw TypeError('Transfer option cannot be converted to a sequence');
  4408. var transfer = [];
  4409. iterate(rawTransfer, function (value) {
  4410. push(transfer, anObject(value));
  4411. });
  4412. var i = 0;
  4413. var length = lengthOfArrayLike(transfer);
  4414. var value, type, C, transferredArray, transferred, canvas, context;
  4415. if (PROPER_TRANSFER) {
  4416. transferredArray = nativeStructuredClone(transfer, { transfer: transfer });
  4417. while (i < length)
  4418. mapSet(map, transfer[i], transferredArray[i++]);
  4419. } else
  4420. while (i < length) {
  4421. value = transfer[i++];
  4422. if (mapHas(map, value))
  4423. throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR);
  4424. type = classof(value);
  4425. switch (type) {
  4426. case 'ImageBitmap':
  4427. C = global.OffscreenCanvas;
  4428. if (!isConstructor(C))
  4429. throwUnpolyfillable(type, TRANSFERRING);
  4430. try {
  4431. canvas = new C(value.width, value.height);
  4432. context = canvas.getContext('bitmaprenderer');
  4433. context.transferFromImageBitmap(value);
  4434. transferred = canvas.transferToImageBitmap();
  4435. } catch (error) {
  4436. }
  4437. break;
  4438. case 'AudioData':
  4439. case 'VideoFrame':
  4440. if (!isCallable(value.clone) || !isCallable(value.close))
  4441. throwUnpolyfillable(type, TRANSFERRING);
  4442. try {
  4443. transferred = value.clone();
  4444. value.close();
  4445. } catch (error) {
  4446. }
  4447. break;
  4448. case 'ArrayBuffer':
  4449. case 'MediaSourceHandle':
  4450. case 'MessagePort':
  4451. case 'OffscreenCanvas':
  4452. case 'ReadableStream':
  4453. case 'TransformStream':
  4454. case 'WritableStream':
  4455. throwUnpolyfillable(type, TRANSFERRING);
  4456. }
  4457. if (transferred === undefined)
  4458. throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR);
  4459. mapSet(map, value, transferred);
  4460. }
  4461. };
  4462. $({
  4463. global: true,
  4464. enumerable: true,
  4465. sham: !PROPER_TRANSFER,
  4466. forced: FORCED_REPLACEMENT
  4467. }, {
  4468. structuredClone: function structuredClone(value) {
  4469. var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : undefined;
  4470. var transfer = options ? options.transfer : undefined;
  4471. var map;
  4472. if (transfer !== undefined) {
  4473. map = new Map();
  4474. tryToTransfer(transfer, map);
  4475. }
  4476. return structuredCloneInternal(value, map);
  4477. }
  4478. });
  4479. /***/ }),
  4480. /* 125 */
  4481. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4482. var uncurryThis = __w_pdfjs_require__(18);
  4483. var fails = __w_pdfjs_require__(11);
  4484. var isCallable = __w_pdfjs_require__(25);
  4485. var classof = __w_pdfjs_require__(83);
  4486. var getBuiltIn = __w_pdfjs_require__(28);
  4487. var inspectSource = __w_pdfjs_require__(55);
  4488. var noop = function () {
  4489. };
  4490. var empty = [];
  4491. var construct = getBuiltIn('Reflect', 'construct');
  4492. var constructorRegExp = /^\s*(?:class|function)\b/;
  4493. var exec = uncurryThis(constructorRegExp.exec);
  4494. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  4495. var isConstructorModern = function isConstructor(argument) {
  4496. if (!isCallable(argument))
  4497. return false;
  4498. try {
  4499. construct(noop, empty, argument);
  4500. return true;
  4501. } catch (error) {
  4502. return false;
  4503. }
  4504. };
  4505. var isConstructorLegacy = function isConstructor(argument) {
  4506. if (!isCallable(argument))
  4507. return false;
  4508. switch (classof(argument)) {
  4509. case 'AsyncFunction':
  4510. case 'GeneratorFunction':
  4511. case 'AsyncGeneratorFunction':
  4512. return false;
  4513. }
  4514. try {
  4515. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  4516. } catch (error) {
  4517. return true;
  4518. }
  4519. };
  4520. isConstructorLegacy.sham = true;
  4521. module.exports = !construct || fails(function () {
  4522. var called;
  4523. return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () {
  4524. called = true;
  4525. }) || called;
  4526. }) ? isConstructorLegacy : isConstructorModern;
  4527. /***/ }),
  4528. /* 126 */
  4529. /***/ ((module) => {
  4530. var $TypeError = TypeError;
  4531. module.exports = function (passed, required) {
  4532. if (passed < required)
  4533. throw $TypeError('Not enough arguments');
  4534. return passed;
  4535. };
  4536. /***/ }),
  4537. /* 127 */
  4538. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4539. var call = __w_pdfjs_require__(12);
  4540. var hasOwn = __w_pdfjs_require__(43);
  4541. var isPrototypeOf = __w_pdfjs_require__(29);
  4542. var regExpFlags = __w_pdfjs_require__(128);
  4543. var RegExpPrototype = RegExp.prototype;
  4544. module.exports = function (R) {
  4545. var flags = R.flags;
  4546. return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R) ? call(regExpFlags, R) : flags;
  4547. };
  4548. /***/ }),
  4549. /* 128 */
  4550. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4551. "use strict";
  4552. var anObject = __w_pdfjs_require__(51);
  4553. module.exports = function () {
  4554. var that = anObject(this);
  4555. var result = '';
  4556. if (that.hasIndices)
  4557. result += 'd';
  4558. if (that.global)
  4559. result += 'g';
  4560. if (that.ignoreCase)
  4561. result += 'i';
  4562. if (that.multiline)
  4563. result += 'm';
  4564. if (that.dotAll)
  4565. result += 's';
  4566. if (that.unicode)
  4567. result += 'u';
  4568. if (that.unicodeSets)
  4569. result += 'v';
  4570. if (that.sticky)
  4571. result += 'y';
  4572. return result;
  4573. };
  4574. /***/ }),
  4575. /* 129 */
  4576. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4577. var fails = __w_pdfjs_require__(11);
  4578. var createPropertyDescriptor = __w_pdfjs_require__(15);
  4579. module.exports = !fails(function () {
  4580. var error = Error('a');
  4581. if (!('stack' in error))
  4582. return true;
  4583. Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
  4584. return error.stack !== 7;
  4585. });
  4586. /***/ }),
  4587. /* 130 */
  4588. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4589. var IS_DENO = __w_pdfjs_require__(131);
  4590. var IS_NODE = __w_pdfjs_require__(132);
  4591. module.exports = !IS_DENO && !IS_NODE && typeof window == 'object' && typeof document == 'object';
  4592. /***/ }),
  4593. /* 131 */
  4594. /***/ ((module) => {
  4595. module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
  4596. /***/ }),
  4597. /* 132 */
  4598. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4599. var classof = __w_pdfjs_require__(19);
  4600. var global = __w_pdfjs_require__(8);
  4601. module.exports = classof(global.process) == 'process';
  4602. /***/ }),
  4603. /* 133 */
  4604. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4605. var global = __w_pdfjs_require__(8);
  4606. module.exports = global;
  4607. /***/ }),
  4608. /* 134 */
  4609. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4610. "use strict";
  4611. Object.defineProperty(exports, "__esModule", ({
  4612. value: true
  4613. }));
  4614. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  4615. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  4616. exports.isCmd = isCmd;
  4617. exports.isDict = isDict;
  4618. exports.isName = isName;
  4619. exports.isRefsEqual = isRefsEqual;
  4620. var _util = __w_pdfjs_require__(2);
  4621. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  4622. exports.CIRCULAR_REF = CIRCULAR_REF;
  4623. const EOF = Symbol("EOF");
  4624. exports.EOF = EOF;
  4625. const Name = function NameClosure() {
  4626. let nameCache = Object.create(null);
  4627. class Name {
  4628. constructor(name) {
  4629. this.name = name;
  4630. }
  4631. static get(name) {
  4632. return nameCache[name] || (nameCache[name] = new Name(name));
  4633. }
  4634. static _clearCache() {
  4635. nameCache = Object.create(null);
  4636. }
  4637. }
  4638. return Name;
  4639. }();
  4640. exports.Name = Name;
  4641. const Cmd = function CmdClosure() {
  4642. let cmdCache = Object.create(null);
  4643. class Cmd {
  4644. constructor(cmd) {
  4645. this.cmd = cmd;
  4646. }
  4647. static get(cmd) {
  4648. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  4649. }
  4650. static _clearCache() {
  4651. cmdCache = Object.create(null);
  4652. }
  4653. }
  4654. return Cmd;
  4655. }();
  4656. exports.Cmd = Cmd;
  4657. const nonSerializable = function nonSerializableClosure() {
  4658. return nonSerializable;
  4659. };
  4660. class Dict {
  4661. constructor() {
  4662. let xref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  4663. this._map = Object.create(null);
  4664. this.xref = xref;
  4665. this.objId = null;
  4666. this.suppressEncryption = false;
  4667. this.__nonSerializable__ = nonSerializable;
  4668. }
  4669. assignXref(newXref) {
  4670. this.xref = newXref;
  4671. }
  4672. get size() {
  4673. return Object.keys(this._map).length;
  4674. }
  4675. get(key1, key2, key3) {
  4676. let value = this._map[key1];
  4677. if (value === undefined && key2 !== undefined) {
  4678. value = this._map[key2];
  4679. if (value === undefined && key3 !== undefined) {
  4680. value = this._map[key3];
  4681. }
  4682. }
  4683. if (value instanceof Ref && this.xref) {
  4684. return this.xref.fetch(value, this.suppressEncryption);
  4685. }
  4686. return value;
  4687. }
  4688. async getAsync(key1, key2, key3) {
  4689. let value = this._map[key1];
  4690. if (value === undefined && key2 !== undefined) {
  4691. value = this._map[key2];
  4692. if (value === undefined && key3 !== undefined) {
  4693. value = this._map[key3];
  4694. }
  4695. }
  4696. if (value instanceof Ref && this.xref) {
  4697. return this.xref.fetchAsync(value, this.suppressEncryption);
  4698. }
  4699. return value;
  4700. }
  4701. getArray(key1, key2, key3) {
  4702. let value = this._map[key1];
  4703. if (value === undefined && key2 !== undefined) {
  4704. value = this._map[key2];
  4705. if (value === undefined && key3 !== undefined) {
  4706. value = this._map[key3];
  4707. }
  4708. }
  4709. if (value instanceof Ref && this.xref) {
  4710. value = this.xref.fetch(value, this.suppressEncryption);
  4711. }
  4712. if (Array.isArray(value)) {
  4713. value = value.slice();
  4714. for (let i = 0, ii = value.length; i < ii; i++) {
  4715. if (value[i] instanceof Ref && this.xref) {
  4716. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  4717. }
  4718. }
  4719. }
  4720. return value;
  4721. }
  4722. getRaw(key) {
  4723. return this._map[key];
  4724. }
  4725. getKeys() {
  4726. return Object.keys(this._map);
  4727. }
  4728. getRawValues() {
  4729. return Object.values(this._map);
  4730. }
  4731. set(key, value) {
  4732. this._map[key] = value;
  4733. }
  4734. has(key) {
  4735. return this._map[key] !== undefined;
  4736. }
  4737. forEach(callback) {
  4738. for (const key in this._map) {
  4739. callback(key, this.get(key));
  4740. }
  4741. }
  4742. static get empty() {
  4743. const emptyDict = new Dict(null);
  4744. emptyDict.set = (key, value) => {
  4745. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  4746. };
  4747. return (0, _util.shadow)(this, "empty", emptyDict);
  4748. }
  4749. static merge(_ref) {
  4750. let {
  4751. xref,
  4752. dictArray,
  4753. mergeSubDicts = false
  4754. } = _ref;
  4755. const mergedDict = new Dict(xref),
  4756. properties = new Map();
  4757. for (const dict of dictArray) {
  4758. if (!(dict instanceof Dict)) {
  4759. continue;
  4760. }
  4761. for (const [key, value] of Object.entries(dict._map)) {
  4762. let property = properties.get(key);
  4763. if (property === undefined) {
  4764. property = [];
  4765. properties.set(key, property);
  4766. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  4767. continue;
  4768. }
  4769. property.push(value);
  4770. }
  4771. }
  4772. for (const [name, values] of properties) {
  4773. if (values.length === 1 || !(values[0] instanceof Dict)) {
  4774. mergedDict._map[name] = values[0];
  4775. continue;
  4776. }
  4777. const subDict = new Dict(xref);
  4778. for (const dict of values) {
  4779. for (const [key, value] of Object.entries(dict._map)) {
  4780. if (subDict._map[key] === undefined) {
  4781. subDict._map[key] = value;
  4782. }
  4783. }
  4784. }
  4785. if (subDict.size > 0) {
  4786. mergedDict._map[name] = subDict;
  4787. }
  4788. }
  4789. properties.clear();
  4790. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  4791. }
  4792. }
  4793. exports.Dict = Dict;
  4794. const Ref = function RefClosure() {
  4795. let refCache = Object.create(null);
  4796. class Ref {
  4797. constructor(num, gen) {
  4798. this.num = num;
  4799. this.gen = gen;
  4800. }
  4801. toString() {
  4802. if (this.gen === 0) {
  4803. return `${this.num}R`;
  4804. }
  4805. return `${this.num}R${this.gen}`;
  4806. }
  4807. static get(num, gen) {
  4808. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  4809. return refCache[key] || (refCache[key] = new Ref(num, gen));
  4810. }
  4811. static _clearCache() {
  4812. refCache = Object.create(null);
  4813. }
  4814. }
  4815. return Ref;
  4816. }();
  4817. exports.Ref = Ref;
  4818. class RefSet {
  4819. constructor() {
  4820. let parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  4821. this._set = new Set(parent && parent._set);
  4822. }
  4823. has(ref) {
  4824. return this._set.has(ref.toString());
  4825. }
  4826. put(ref) {
  4827. this._set.add(ref.toString());
  4828. }
  4829. remove(ref) {
  4830. this._set.delete(ref.toString());
  4831. }
  4832. [Symbol.iterator]() {
  4833. return this._set.values();
  4834. }
  4835. clear() {
  4836. this._set.clear();
  4837. }
  4838. }
  4839. exports.RefSet = RefSet;
  4840. class RefSetCache {
  4841. constructor() {
  4842. this._map = new Map();
  4843. }
  4844. get size() {
  4845. return this._map.size;
  4846. }
  4847. get(ref) {
  4848. return this._map.get(ref.toString());
  4849. }
  4850. has(ref) {
  4851. return this._map.has(ref.toString());
  4852. }
  4853. put(ref, obj) {
  4854. this._map.set(ref.toString(), obj);
  4855. }
  4856. putAlias(ref, aliasRef) {
  4857. this._map.set(ref.toString(), this.get(aliasRef));
  4858. }
  4859. [Symbol.iterator]() {
  4860. return this._map.values();
  4861. }
  4862. clear() {
  4863. this._map.clear();
  4864. }
  4865. }
  4866. exports.RefSetCache = RefSetCache;
  4867. function isName(v, name) {
  4868. return v instanceof Name && (name === undefined || v.name === name);
  4869. }
  4870. function isCmd(v, cmd) {
  4871. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  4872. }
  4873. function isDict(v, type) {
  4874. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  4875. }
  4876. function isRefsEqual(v1, v2) {
  4877. return v1.num === v2.num && v1.gen === v2.gen;
  4878. }
  4879. function clearPrimitiveCaches() {
  4880. Cmd._clearCache();
  4881. Name._clearCache();
  4882. Ref._clearCache();
  4883. }
  4884. /***/ }),
  4885. /* 135 */
  4886. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4887. "use strict";
  4888. Object.defineProperty(exports, "__esModule", ({
  4889. value: true
  4890. }));
  4891. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = exports.DocStats = void 0;
  4892. exports.collectActions = collectActions;
  4893. exports.encodeToXmlString = encodeToXmlString;
  4894. exports.escapePDFName = escapePDFName;
  4895. exports.escapeString = escapeString;
  4896. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  4897. exports.getInheritableProperty = getInheritableProperty;
  4898. exports.getLookupTableFactory = getLookupTableFactory;
  4899. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  4900. exports.getRotationMatrix = getRotationMatrix;
  4901. exports.isAscii = isAscii;
  4902. exports.isWhiteSpace = isWhiteSpace;
  4903. exports.log2 = log2;
  4904. exports.numberToString = numberToString;
  4905. exports.parseXFAPath = parseXFAPath;
  4906. exports.readInt8 = readInt8;
  4907. exports.readUint16 = readUint16;
  4908. exports.readUint32 = readUint32;
  4909. exports.recoverJsURL = recoverJsURL;
  4910. exports.stringToUTF16HexString = stringToUTF16HexString;
  4911. exports.stringToUTF16String = stringToUTF16String;
  4912. exports.toRomanNumerals = toRomanNumerals;
  4913. exports.validateCSSFont = validateCSSFont;
  4914. var _util = __w_pdfjs_require__(2);
  4915. var _primitives = __w_pdfjs_require__(134);
  4916. var _base_stream = __w_pdfjs_require__(136);
  4917. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  4918. exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP;
  4919. function getLookupTableFactory(initializer) {
  4920. let lookup;
  4921. return function () {
  4922. if (initializer) {
  4923. lookup = Object.create(null);
  4924. initializer(lookup);
  4925. initializer = null;
  4926. }
  4927. return lookup;
  4928. };
  4929. }
  4930. function getArrayLookupTableFactory(initializer) {
  4931. let lookup;
  4932. return function () {
  4933. if (initializer) {
  4934. let arr = initializer();
  4935. initializer = null;
  4936. lookup = Object.create(null);
  4937. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  4938. lookup[arr[i]] = arr[i + 1];
  4939. }
  4940. arr = null;
  4941. }
  4942. return lookup;
  4943. };
  4944. }
  4945. class MissingDataException extends _util.BaseException {
  4946. constructor(begin, end) {
  4947. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  4948. this.begin = begin;
  4949. this.end = end;
  4950. }
  4951. }
  4952. exports.MissingDataException = MissingDataException;
  4953. class ParserEOFException extends _util.BaseException {
  4954. constructor(msg) {
  4955. super(msg, "ParserEOFException");
  4956. }
  4957. }
  4958. exports.ParserEOFException = ParserEOFException;
  4959. class XRefEntryException extends _util.BaseException {
  4960. constructor(msg) {
  4961. super(msg, "XRefEntryException");
  4962. }
  4963. }
  4964. exports.XRefEntryException = XRefEntryException;
  4965. class XRefParseException extends _util.BaseException {
  4966. constructor(msg) {
  4967. super(msg, "XRefParseException");
  4968. }
  4969. }
  4970. exports.XRefParseException = XRefParseException;
  4971. class DocStats {
  4972. constructor(handler) {
  4973. this._handler = handler;
  4974. this._streamTypes = new Set();
  4975. this._fontTypes = new Set();
  4976. }
  4977. _send() {
  4978. const streamTypes = Object.create(null),
  4979. fontTypes = Object.create(null);
  4980. for (const type of this._streamTypes) {
  4981. streamTypes[type] = true;
  4982. }
  4983. for (const type of this._fontTypes) {
  4984. fontTypes[type] = true;
  4985. }
  4986. this._handler.send("DocStats", {
  4987. streamTypes,
  4988. fontTypes
  4989. });
  4990. }
  4991. addStreamType(type) {
  4992. if (this._streamTypes.has(type)) {
  4993. return;
  4994. }
  4995. this._streamTypes.add(type);
  4996. this._send();
  4997. }
  4998. addFontType(type) {
  4999. if (this._fontTypes.has(type)) {
  5000. return;
  5001. }
  5002. this._fontTypes.add(type);
  5003. this._send();
  5004. }
  5005. }
  5006. exports.DocStats = DocStats;
  5007. function getInheritableProperty(_ref) {
  5008. let {
  5009. dict,
  5010. key,
  5011. getArray = false,
  5012. stopWhenFound = true
  5013. } = _ref;
  5014. let values;
  5015. const visited = new _primitives.RefSet();
  5016. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  5017. if (dict.objId) {
  5018. visited.put(dict.objId);
  5019. }
  5020. const value = getArray ? dict.getArray(key) : dict.get(key);
  5021. if (value !== undefined) {
  5022. if (stopWhenFound) {
  5023. return value;
  5024. }
  5025. if (!values) {
  5026. values = [];
  5027. }
  5028. values.push(value);
  5029. }
  5030. dict = dict.get("Parent");
  5031. }
  5032. return values;
  5033. }
  5034. 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"];
  5035. function toRomanNumerals(number) {
  5036. let lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5037. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  5038. const romanBuf = [];
  5039. let pos;
  5040. while (number >= 1000) {
  5041. number -= 1000;
  5042. romanBuf.push("M");
  5043. }
  5044. pos = number / 100 | 0;
  5045. number %= 100;
  5046. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  5047. pos = number / 10 | 0;
  5048. number %= 10;
  5049. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  5050. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  5051. const romanStr = romanBuf.join("");
  5052. return lowerCase ? romanStr.toLowerCase() : romanStr;
  5053. }
  5054. function log2(x) {
  5055. if (x <= 0) {
  5056. return 0;
  5057. }
  5058. return Math.ceil(Math.log2(x));
  5059. }
  5060. function readInt8(data, offset) {
  5061. return data[offset] << 24 >> 24;
  5062. }
  5063. function readUint16(data, offset) {
  5064. return data[offset] << 8 | data[offset + 1];
  5065. }
  5066. function readUint32(data, offset) {
  5067. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  5068. }
  5069. function isWhiteSpace(ch) {
  5070. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  5071. }
  5072. function parseXFAPath(path) {
  5073. const positionPattern = /(.+)\[(\d+)\]$/;
  5074. return path.split(".").map(component => {
  5075. const m = component.match(positionPattern);
  5076. if (m) {
  5077. return {
  5078. name: m[1],
  5079. pos: parseInt(m[2], 10)
  5080. };
  5081. }
  5082. return {
  5083. name: component,
  5084. pos: 0
  5085. };
  5086. });
  5087. }
  5088. function escapePDFName(str) {
  5089. const buffer = [];
  5090. let start = 0;
  5091. for (let i = 0, ii = str.length; i < ii; i++) {
  5092. const char = str.charCodeAt(i);
  5093. 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) {
  5094. if (start < i) {
  5095. buffer.push(str.substring(start, i));
  5096. }
  5097. buffer.push(`#${char.toString(16)}`);
  5098. start = i + 1;
  5099. }
  5100. }
  5101. if (buffer.length === 0) {
  5102. return str;
  5103. }
  5104. if (start < str.length) {
  5105. buffer.push(str.substring(start, str.length));
  5106. }
  5107. return buffer.join("");
  5108. }
  5109. function escapeString(str) {
  5110. return str.replace(/([()\\\n\r])/g, match => {
  5111. if (match === "\n") {
  5112. return "\\n";
  5113. } else if (match === "\r") {
  5114. return "\\r";
  5115. }
  5116. return `\\${match}`;
  5117. });
  5118. }
  5119. function _collectJS(entry, xref, list, parents) {
  5120. if (!entry) {
  5121. return;
  5122. }
  5123. let parent = null;
  5124. if (entry instanceof _primitives.Ref) {
  5125. if (parents.has(entry)) {
  5126. return;
  5127. }
  5128. parent = entry;
  5129. parents.put(parent);
  5130. entry = xref.fetch(entry);
  5131. }
  5132. if (Array.isArray(entry)) {
  5133. for (const element of entry) {
  5134. _collectJS(element, xref, list, parents);
  5135. }
  5136. } else if (entry instanceof _primitives.Dict) {
  5137. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  5138. const js = entry.get("JS");
  5139. let code;
  5140. if (js instanceof _base_stream.BaseStream) {
  5141. code = js.getString();
  5142. } else if (typeof js === "string") {
  5143. code = js;
  5144. }
  5145. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  5146. if (code) {
  5147. list.push(code);
  5148. }
  5149. }
  5150. _collectJS(entry.getRaw("Next"), xref, list, parents);
  5151. }
  5152. if (parent) {
  5153. parents.remove(parent);
  5154. }
  5155. }
  5156. function collectActions(xref, dict, eventType) {
  5157. const actions = Object.create(null);
  5158. const additionalActionsDicts = getInheritableProperty({
  5159. dict,
  5160. key: "AA",
  5161. stopWhenFound: false
  5162. });
  5163. if (additionalActionsDicts) {
  5164. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  5165. const additionalActions = additionalActionsDicts[i];
  5166. if (!(additionalActions instanceof _primitives.Dict)) {
  5167. continue;
  5168. }
  5169. for (const key of additionalActions.getKeys()) {
  5170. const action = eventType[key];
  5171. if (!action) {
  5172. continue;
  5173. }
  5174. const actionDict = additionalActions.getRaw(key);
  5175. const parents = new _primitives.RefSet();
  5176. const list = [];
  5177. _collectJS(actionDict, xref, list, parents);
  5178. if (list.length > 0) {
  5179. actions[action] = list;
  5180. }
  5181. }
  5182. }
  5183. }
  5184. if (dict.has("A")) {
  5185. const actionDict = dict.get("A");
  5186. const parents = new _primitives.RefSet();
  5187. const list = [];
  5188. _collectJS(actionDict, xref, list, parents);
  5189. if (list.length > 0) {
  5190. actions.Action = list;
  5191. }
  5192. }
  5193. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  5194. }
  5195. const XMLEntities = {
  5196. 0x3c: "&lt;",
  5197. 0x3e: "&gt;",
  5198. 0x26: "&amp;",
  5199. 0x22: "&quot;",
  5200. 0x27: "&apos;"
  5201. };
  5202. function encodeToXmlString(str) {
  5203. const buffer = [];
  5204. let start = 0;
  5205. for (let i = 0, ii = str.length; i < ii; i++) {
  5206. const char = str.codePointAt(i);
  5207. if (0x20 <= char && char <= 0x7e) {
  5208. const entity = XMLEntities[char];
  5209. if (entity) {
  5210. if (start < i) {
  5211. buffer.push(str.substring(start, i));
  5212. }
  5213. buffer.push(entity);
  5214. start = i + 1;
  5215. }
  5216. } else {
  5217. if (start < i) {
  5218. buffer.push(str.substring(start, i));
  5219. }
  5220. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  5221. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  5222. i++;
  5223. }
  5224. start = i + 1;
  5225. }
  5226. }
  5227. if (buffer.length === 0) {
  5228. return str;
  5229. }
  5230. if (start < str.length) {
  5231. buffer.push(str.substring(start, str.length));
  5232. }
  5233. return buffer.join("");
  5234. }
  5235. function validateCSSFont(cssFontInfo) {
  5236. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  5237. const DEFAULT_CSS_FONT_WEIGHT = "400";
  5238. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  5239. const {
  5240. fontFamily,
  5241. fontWeight,
  5242. italicAngle
  5243. } = cssFontInfo;
  5244. if (/^".*"$/.test(fontFamily)) {
  5245. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  5246. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  5247. return false;
  5248. }
  5249. } else if (/^'.*'$/.test(fontFamily)) {
  5250. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  5251. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  5252. return false;
  5253. }
  5254. } else {
  5255. for (const ident of fontFamily.split(/[ \t]+/)) {
  5256. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  5257. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  5258. return false;
  5259. }
  5260. }
  5261. }
  5262. const weight = fontWeight ? fontWeight.toString() : "";
  5263. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  5264. const angle = parseFloat(italicAngle);
  5265. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  5266. return true;
  5267. }
  5268. function recoverJsURL(str) {
  5269. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  5270. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  5271. const jsUrl = regex.exec(str);
  5272. if (jsUrl && jsUrl[2]) {
  5273. const url = jsUrl[2];
  5274. let newWindow = false;
  5275. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  5276. newWindow = true;
  5277. }
  5278. return {
  5279. url,
  5280. newWindow
  5281. };
  5282. }
  5283. return null;
  5284. }
  5285. function numberToString(value) {
  5286. if (Number.isInteger(value)) {
  5287. return value.toString();
  5288. }
  5289. const roundedValue = Math.round(value * 100);
  5290. if (roundedValue % 100 === 0) {
  5291. return (roundedValue / 100).toString();
  5292. }
  5293. if (roundedValue % 10 === 0) {
  5294. return value.toFixed(1);
  5295. }
  5296. return value.toFixed(2);
  5297. }
  5298. function getNewAnnotationsMap(annotationStorage) {
  5299. if (!annotationStorage) {
  5300. return null;
  5301. }
  5302. const newAnnotationsByPage = new Map();
  5303. for (const [key, value] of annotationStorage) {
  5304. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  5305. continue;
  5306. }
  5307. let annotations = newAnnotationsByPage.get(value.pageIndex);
  5308. if (!annotations) {
  5309. annotations = [];
  5310. newAnnotationsByPage.set(value.pageIndex, annotations);
  5311. }
  5312. annotations.push(value);
  5313. }
  5314. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  5315. }
  5316. function isAscii(str) {
  5317. return /^[\x00-\x7F]*$/.test(str);
  5318. }
  5319. function stringToUTF16HexString(str) {
  5320. const buf = [];
  5321. for (let i = 0, ii = str.length; i < ii; i++) {
  5322. const char = str.charCodeAt(i);
  5323. buf.push((char >> 8 & 0xff).toString(16).padStart(2, "0"), (char & 0xff).toString(16).padStart(2, "0"));
  5324. }
  5325. return buf.join("");
  5326. }
  5327. function stringToUTF16String(str) {
  5328. let bigEndian = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5329. const buf = [];
  5330. if (bigEndian) {
  5331. buf.push("\xFE\xFF");
  5332. }
  5333. for (let i = 0, ii = str.length; i < ii; i++) {
  5334. const char = str.charCodeAt(i);
  5335. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  5336. }
  5337. return buf.join("");
  5338. }
  5339. function getRotationMatrix(rotation, width, height) {
  5340. switch (rotation) {
  5341. case 90:
  5342. return [0, 1, -1, 0, width, 0];
  5343. case 180:
  5344. return [-1, 0, 0, -1, width, height];
  5345. case 270:
  5346. return [0, -1, 1, 0, 0, height];
  5347. default:
  5348. throw new Error("Invalid rotation");
  5349. }
  5350. }
  5351. /***/ }),
  5352. /* 136 */
  5353. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5354. "use strict";
  5355. Object.defineProperty(exports, "__esModule", ({
  5356. value: true
  5357. }));
  5358. exports.BaseStream = void 0;
  5359. var _util = __w_pdfjs_require__(2);
  5360. class BaseStream {
  5361. constructor() {
  5362. if (this.constructor === BaseStream) {
  5363. (0, _util.unreachable)("Cannot initialize BaseStream.");
  5364. }
  5365. }
  5366. get length() {
  5367. (0, _util.unreachable)("Abstract getter `length` accessed");
  5368. }
  5369. get isEmpty() {
  5370. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  5371. }
  5372. get isDataLoaded() {
  5373. return (0, _util.shadow)(this, "isDataLoaded", true);
  5374. }
  5375. getByte() {
  5376. (0, _util.unreachable)("Abstract method `getByte` called");
  5377. }
  5378. getBytes(length) {
  5379. (0, _util.unreachable)("Abstract method `getBytes` called");
  5380. }
  5381. peekByte() {
  5382. const peekedByte = this.getByte();
  5383. if (peekedByte !== -1) {
  5384. this.pos--;
  5385. }
  5386. return peekedByte;
  5387. }
  5388. peekBytes(length) {
  5389. const bytes = this.getBytes(length);
  5390. this.pos -= bytes.length;
  5391. return bytes;
  5392. }
  5393. getUint16() {
  5394. const b0 = this.getByte();
  5395. const b1 = this.getByte();
  5396. if (b0 === -1 || b1 === -1) {
  5397. return -1;
  5398. }
  5399. return (b0 << 8) + b1;
  5400. }
  5401. getInt32() {
  5402. const b0 = this.getByte();
  5403. const b1 = this.getByte();
  5404. const b2 = this.getByte();
  5405. const b3 = this.getByte();
  5406. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  5407. }
  5408. getByteRange(begin, end) {
  5409. (0, _util.unreachable)("Abstract method `getByteRange` called");
  5410. }
  5411. getString(length) {
  5412. return (0, _util.bytesToString)(this.getBytes(length));
  5413. }
  5414. skip(n) {
  5415. this.pos += n || 1;
  5416. }
  5417. reset() {
  5418. (0, _util.unreachable)("Abstract method `reset` called");
  5419. }
  5420. moveStart() {
  5421. (0, _util.unreachable)("Abstract method `moveStart` called");
  5422. }
  5423. makeSubStream(start, length) {
  5424. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5425. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  5426. }
  5427. getBaseStreams() {
  5428. return null;
  5429. }
  5430. }
  5431. exports.BaseStream = BaseStream;
  5432. /***/ }),
  5433. /* 137 */
  5434. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5435. "use strict";
  5436. Object.defineProperty(exports, "__esModule", ({
  5437. value: true
  5438. }));
  5439. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  5440. var _util = __w_pdfjs_require__(2);
  5441. var _chunked_stream = __w_pdfjs_require__(138);
  5442. var _core_utils = __w_pdfjs_require__(135);
  5443. var _document = __w_pdfjs_require__(140);
  5444. var _stream = __w_pdfjs_require__(139);
  5445. function parseDocBaseUrl(url) {
  5446. if (url) {
  5447. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  5448. if (absoluteUrl) {
  5449. return absoluteUrl.href;
  5450. }
  5451. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  5452. }
  5453. return null;
  5454. }
  5455. class BasePdfManager {
  5456. constructor() {
  5457. if (this.constructor === BasePdfManager) {
  5458. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  5459. }
  5460. }
  5461. get docId() {
  5462. return this._docId;
  5463. }
  5464. get password() {
  5465. return this._password;
  5466. }
  5467. get docBaseUrl() {
  5468. const catalog = this.pdfDocument.catalog;
  5469. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  5470. }
  5471. ensureDoc(prop, args) {
  5472. return this.ensure(this.pdfDocument, prop, args);
  5473. }
  5474. ensureXRef(prop, args) {
  5475. return this.ensure(this.pdfDocument.xref, prop, args);
  5476. }
  5477. ensureCatalog(prop, args) {
  5478. return this.ensure(this.pdfDocument.catalog, prop, args);
  5479. }
  5480. getPage(pageIndex) {
  5481. return this.pdfDocument.getPage(pageIndex);
  5482. }
  5483. fontFallback(id, handler) {
  5484. return this.pdfDocument.fontFallback(id, handler);
  5485. }
  5486. loadXfaFonts(handler, task) {
  5487. return this.pdfDocument.loadXfaFonts(handler, task);
  5488. }
  5489. loadXfaImages() {
  5490. return this.pdfDocument.loadXfaImages();
  5491. }
  5492. serializeXfaData(annotationStorage) {
  5493. return this.pdfDocument.serializeXfaData(annotationStorage);
  5494. }
  5495. cleanup() {
  5496. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5497. return this.pdfDocument.cleanup(manuallyTriggered);
  5498. }
  5499. async ensure(obj, prop, args) {
  5500. (0, _util.unreachable)("Abstract method `ensure` called");
  5501. }
  5502. requestRange(begin, end) {
  5503. (0, _util.unreachable)("Abstract method `requestRange` called");
  5504. }
  5505. requestLoadedStream() {
  5506. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5507. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  5508. }
  5509. sendProgressiveData(chunk) {
  5510. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  5511. }
  5512. updatePassword(password) {
  5513. this._password = password;
  5514. }
  5515. terminate(reason) {
  5516. (0, _util.unreachable)("Abstract method `terminate` called");
  5517. }
  5518. }
  5519. class LocalPdfManager extends BasePdfManager {
  5520. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  5521. super();
  5522. this._docId = docId;
  5523. this._password = password;
  5524. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  5525. this.msgHandler = msgHandler;
  5526. this.evaluatorOptions = evaluatorOptions;
  5527. this.enableXfa = enableXfa;
  5528. const stream = new _stream.Stream(data);
  5529. this.pdfDocument = new _document.PDFDocument(this, stream);
  5530. this._loadedStreamPromise = Promise.resolve(stream);
  5531. }
  5532. async ensure(obj, prop, args) {
  5533. const value = obj[prop];
  5534. if (typeof value === "function") {
  5535. return value.apply(obj, args);
  5536. }
  5537. return value;
  5538. }
  5539. requestRange(begin, end) {
  5540. return Promise.resolve();
  5541. }
  5542. requestLoadedStream() {
  5543. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5544. return this._loadedStreamPromise;
  5545. }
  5546. terminate(reason) {}
  5547. }
  5548. exports.LocalPdfManager = LocalPdfManager;
  5549. class NetworkPdfManager extends BasePdfManager {
  5550. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  5551. super();
  5552. this._docId = docId;
  5553. this._password = args.password;
  5554. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  5555. this.msgHandler = args.msgHandler;
  5556. this.evaluatorOptions = evaluatorOptions;
  5557. this.enableXfa = enableXfa;
  5558. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  5559. msgHandler: args.msgHandler,
  5560. length: args.length,
  5561. disableAutoFetch: args.disableAutoFetch,
  5562. rangeChunkSize: args.rangeChunkSize
  5563. });
  5564. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  5565. }
  5566. async ensure(obj, prop, args) {
  5567. try {
  5568. const value = obj[prop];
  5569. if (typeof value === "function") {
  5570. return value.apply(obj, args);
  5571. }
  5572. return value;
  5573. } catch (ex) {
  5574. if (!(ex instanceof _core_utils.MissingDataException)) {
  5575. throw ex;
  5576. }
  5577. await this.requestRange(ex.begin, ex.end);
  5578. return this.ensure(obj, prop, args);
  5579. }
  5580. }
  5581. requestRange(begin, end) {
  5582. return this.streamManager.requestRange(begin, end);
  5583. }
  5584. requestLoadedStream() {
  5585. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5586. return this.streamManager.requestAllChunks(noFetch);
  5587. }
  5588. sendProgressiveData(chunk) {
  5589. this.streamManager.onReceiveData({
  5590. chunk
  5591. });
  5592. }
  5593. terminate(reason) {
  5594. this.streamManager.abort(reason);
  5595. }
  5596. }
  5597. exports.NetworkPdfManager = NetworkPdfManager;
  5598. /***/ }),
  5599. /* 138 */
  5600. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5601. "use strict";
  5602. Object.defineProperty(exports, "__esModule", ({
  5603. value: true
  5604. }));
  5605. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  5606. var _util = __w_pdfjs_require__(2);
  5607. var _core_utils = __w_pdfjs_require__(135);
  5608. var _stream = __w_pdfjs_require__(139);
  5609. class ChunkedStream extends _stream.Stream {
  5610. constructor(length, chunkSize, manager) {
  5611. super(new Uint8Array(length), 0, length, null);
  5612. this.chunkSize = chunkSize;
  5613. this._loadedChunks = new Set();
  5614. this.numChunks = Math.ceil(length / chunkSize);
  5615. this.manager = manager;
  5616. this.progressiveDataLength = 0;
  5617. this.lastSuccessfulEnsureByteChunk = -1;
  5618. }
  5619. getMissingChunks() {
  5620. const chunks = [];
  5621. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  5622. if (!this._loadedChunks.has(chunk)) {
  5623. chunks.push(chunk);
  5624. }
  5625. }
  5626. return chunks;
  5627. }
  5628. get numChunksLoaded() {
  5629. return this._loadedChunks.size;
  5630. }
  5631. get isDataLoaded() {
  5632. return this.numChunksLoaded === this.numChunks;
  5633. }
  5634. onReceiveData(begin, chunk) {
  5635. const chunkSize = this.chunkSize;
  5636. if (begin % chunkSize !== 0) {
  5637. throw new Error(`Bad begin offset: ${begin}`);
  5638. }
  5639. const end = begin + chunk.byteLength;
  5640. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  5641. throw new Error(`Bad end offset: ${end}`);
  5642. }
  5643. this.bytes.set(new Uint8Array(chunk), begin);
  5644. const beginChunk = Math.floor(begin / chunkSize);
  5645. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  5646. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5647. this._loadedChunks.add(curChunk);
  5648. }
  5649. }
  5650. onReceiveProgressiveData(data) {
  5651. let position = this.progressiveDataLength;
  5652. const beginChunk = Math.floor(position / this.chunkSize);
  5653. this.bytes.set(new Uint8Array(data), position);
  5654. position += data.byteLength;
  5655. this.progressiveDataLength = position;
  5656. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  5657. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5658. this._loadedChunks.add(curChunk);
  5659. }
  5660. }
  5661. ensureByte(pos) {
  5662. if (pos < this.progressiveDataLength) {
  5663. return;
  5664. }
  5665. const chunk = Math.floor(pos / this.chunkSize);
  5666. if (chunk > this.numChunks) {
  5667. return;
  5668. }
  5669. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  5670. return;
  5671. }
  5672. if (!this._loadedChunks.has(chunk)) {
  5673. throw new _core_utils.MissingDataException(pos, pos + 1);
  5674. }
  5675. this.lastSuccessfulEnsureByteChunk = chunk;
  5676. }
  5677. ensureRange(begin, end) {
  5678. if (begin >= end) {
  5679. return;
  5680. }
  5681. if (end <= this.progressiveDataLength) {
  5682. return;
  5683. }
  5684. const beginChunk = Math.floor(begin / this.chunkSize);
  5685. if (beginChunk > this.numChunks) {
  5686. return;
  5687. }
  5688. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  5689. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5690. if (!this._loadedChunks.has(chunk)) {
  5691. throw new _core_utils.MissingDataException(begin, end);
  5692. }
  5693. }
  5694. }
  5695. nextEmptyChunk(beginChunk) {
  5696. const numChunks = this.numChunks;
  5697. for (let i = 0; i < numChunks; ++i) {
  5698. const chunk = (beginChunk + i) % numChunks;
  5699. if (!this._loadedChunks.has(chunk)) {
  5700. return chunk;
  5701. }
  5702. }
  5703. return null;
  5704. }
  5705. hasChunk(chunk) {
  5706. return this._loadedChunks.has(chunk);
  5707. }
  5708. getByte() {
  5709. const pos = this.pos;
  5710. if (pos >= this.end) {
  5711. return -1;
  5712. }
  5713. if (pos >= this.progressiveDataLength) {
  5714. this.ensureByte(pos);
  5715. }
  5716. return this.bytes[this.pos++];
  5717. }
  5718. getBytes(length) {
  5719. const bytes = this.bytes;
  5720. const pos = this.pos;
  5721. const strEnd = this.end;
  5722. if (!length) {
  5723. if (strEnd > this.progressiveDataLength) {
  5724. this.ensureRange(pos, strEnd);
  5725. }
  5726. return bytes.subarray(pos, strEnd);
  5727. }
  5728. let end = pos + length;
  5729. if (end > strEnd) {
  5730. end = strEnd;
  5731. }
  5732. if (end > this.progressiveDataLength) {
  5733. this.ensureRange(pos, end);
  5734. }
  5735. this.pos = end;
  5736. return bytes.subarray(pos, end);
  5737. }
  5738. getByteRange(begin, end) {
  5739. if (begin < 0) {
  5740. begin = 0;
  5741. }
  5742. if (end > this.end) {
  5743. end = this.end;
  5744. }
  5745. if (end > this.progressiveDataLength) {
  5746. this.ensureRange(begin, end);
  5747. }
  5748. return this.bytes.subarray(begin, end);
  5749. }
  5750. makeSubStream(start, length) {
  5751. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5752. if (length) {
  5753. if (start + length > this.progressiveDataLength) {
  5754. this.ensureRange(start, start + length);
  5755. }
  5756. } else {
  5757. if (start >= this.progressiveDataLength) {
  5758. this.ensureByte(start);
  5759. }
  5760. }
  5761. function ChunkedStreamSubstream() {}
  5762. ChunkedStreamSubstream.prototype = Object.create(this);
  5763. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  5764. const chunkSize = this.chunkSize;
  5765. const beginChunk = Math.floor(this.start / chunkSize);
  5766. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  5767. const missingChunks = [];
  5768. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5769. if (!this._loadedChunks.has(chunk)) {
  5770. missingChunks.push(chunk);
  5771. }
  5772. }
  5773. return missingChunks;
  5774. };
  5775. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  5776. get() {
  5777. if (this.numChunksLoaded === this.numChunks) {
  5778. return true;
  5779. }
  5780. return this.getMissingChunks().length === 0;
  5781. },
  5782. configurable: true
  5783. });
  5784. const subStream = new ChunkedStreamSubstream();
  5785. subStream.pos = subStream.start = start;
  5786. subStream.end = start + length || this.end;
  5787. subStream.dict = dict;
  5788. return subStream;
  5789. }
  5790. getBaseStreams() {
  5791. return [this];
  5792. }
  5793. }
  5794. exports.ChunkedStream = ChunkedStream;
  5795. class ChunkedStreamManager {
  5796. constructor(pdfNetworkStream, args) {
  5797. this.length = args.length;
  5798. this.chunkSize = args.rangeChunkSize;
  5799. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  5800. this.pdfNetworkStream = pdfNetworkStream;
  5801. this.disableAutoFetch = args.disableAutoFetch;
  5802. this.msgHandler = args.msgHandler;
  5803. this.currRequestId = 0;
  5804. this._chunksNeededByRequest = new Map();
  5805. this._requestsByChunk = new Map();
  5806. this._promisesByRequest = new Map();
  5807. this.progressiveDataLength = 0;
  5808. this.aborted = false;
  5809. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  5810. }
  5811. sendRequest(begin, end) {
  5812. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  5813. if (!rangeReader.isStreamingSupported) {
  5814. rangeReader.onProgress = this.onProgress.bind(this);
  5815. }
  5816. let chunks = [],
  5817. loaded = 0;
  5818. return new Promise((resolve, reject) => {
  5819. const readChunk = chunk => {
  5820. try {
  5821. if (!chunk.done) {
  5822. const data = chunk.value;
  5823. chunks.push(data);
  5824. loaded += (0, _util.arrayByteLength)(data);
  5825. if (rangeReader.isStreamingSupported) {
  5826. this.onProgress({
  5827. loaded
  5828. });
  5829. }
  5830. rangeReader.read().then(readChunk, reject);
  5831. return;
  5832. }
  5833. const chunkData = (0, _util.arraysToBytes)(chunks);
  5834. chunks = null;
  5835. resolve(chunkData);
  5836. } catch (e) {
  5837. reject(e);
  5838. }
  5839. };
  5840. rangeReader.read().then(readChunk, reject);
  5841. }).then(data => {
  5842. if (this.aborted) {
  5843. return;
  5844. }
  5845. this.onReceiveData({
  5846. chunk: data,
  5847. begin
  5848. });
  5849. });
  5850. }
  5851. requestAllChunks() {
  5852. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5853. if (!noFetch) {
  5854. const missingChunks = this.stream.getMissingChunks();
  5855. this._requestChunks(missingChunks);
  5856. }
  5857. return this._loadedStreamCapability.promise;
  5858. }
  5859. _requestChunks(chunks) {
  5860. const requestId = this.currRequestId++;
  5861. const chunksNeeded = new Set();
  5862. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  5863. for (const chunk of chunks) {
  5864. if (!this.stream.hasChunk(chunk)) {
  5865. chunksNeeded.add(chunk);
  5866. }
  5867. }
  5868. if (chunksNeeded.size === 0) {
  5869. return Promise.resolve();
  5870. }
  5871. const capability = (0, _util.createPromiseCapability)();
  5872. this._promisesByRequest.set(requestId, capability);
  5873. const chunksToRequest = [];
  5874. for (const chunk of chunksNeeded) {
  5875. let requestIds = this._requestsByChunk.get(chunk);
  5876. if (!requestIds) {
  5877. requestIds = [];
  5878. this._requestsByChunk.set(chunk, requestIds);
  5879. chunksToRequest.push(chunk);
  5880. }
  5881. requestIds.push(requestId);
  5882. }
  5883. if (chunksToRequest.length > 0) {
  5884. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  5885. for (const groupedChunk of groupedChunksToRequest) {
  5886. const begin = groupedChunk.beginChunk * this.chunkSize;
  5887. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  5888. this.sendRequest(begin, end).catch(capability.reject);
  5889. }
  5890. }
  5891. return capability.promise.catch(reason => {
  5892. if (this.aborted) {
  5893. return;
  5894. }
  5895. throw reason;
  5896. });
  5897. }
  5898. getStream() {
  5899. return this.stream;
  5900. }
  5901. requestRange(begin, end) {
  5902. end = Math.min(end, this.length);
  5903. const beginChunk = this.getBeginChunk(begin);
  5904. const endChunk = this.getEndChunk(end);
  5905. const chunks = [];
  5906. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5907. chunks.push(chunk);
  5908. }
  5909. return this._requestChunks(chunks);
  5910. }
  5911. requestRanges() {
  5912. let ranges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  5913. const chunksToRequest = [];
  5914. for (const range of ranges) {
  5915. const beginChunk = this.getBeginChunk(range.begin);
  5916. const endChunk = this.getEndChunk(range.end);
  5917. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5918. if (!chunksToRequest.includes(chunk)) {
  5919. chunksToRequest.push(chunk);
  5920. }
  5921. }
  5922. }
  5923. chunksToRequest.sort(function (a, b) {
  5924. return a - b;
  5925. });
  5926. return this._requestChunks(chunksToRequest);
  5927. }
  5928. groupChunks(chunks) {
  5929. const groupedChunks = [];
  5930. let beginChunk = -1;
  5931. let prevChunk = -1;
  5932. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  5933. const chunk = chunks[i];
  5934. if (beginChunk < 0) {
  5935. beginChunk = chunk;
  5936. }
  5937. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  5938. groupedChunks.push({
  5939. beginChunk,
  5940. endChunk: prevChunk + 1
  5941. });
  5942. beginChunk = chunk;
  5943. }
  5944. if (i + 1 === chunks.length) {
  5945. groupedChunks.push({
  5946. beginChunk,
  5947. endChunk: chunk + 1
  5948. });
  5949. }
  5950. prevChunk = chunk;
  5951. }
  5952. return groupedChunks;
  5953. }
  5954. onProgress(args) {
  5955. this.msgHandler.send("DocProgress", {
  5956. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  5957. total: this.length
  5958. });
  5959. }
  5960. onReceiveData(args) {
  5961. const chunk = args.chunk;
  5962. const isProgressive = args.begin === undefined;
  5963. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  5964. const end = begin + chunk.byteLength;
  5965. const beginChunk = Math.floor(begin / this.chunkSize);
  5966. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  5967. if (isProgressive) {
  5968. this.stream.onReceiveProgressiveData(chunk);
  5969. this.progressiveDataLength = end;
  5970. } else {
  5971. this.stream.onReceiveData(begin, chunk);
  5972. }
  5973. if (this.stream.isDataLoaded) {
  5974. this._loadedStreamCapability.resolve(this.stream);
  5975. }
  5976. const loadedRequests = [];
  5977. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5978. const requestIds = this._requestsByChunk.get(curChunk);
  5979. if (!requestIds) {
  5980. continue;
  5981. }
  5982. this._requestsByChunk.delete(curChunk);
  5983. for (const requestId of requestIds) {
  5984. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  5985. if (chunksNeeded.has(curChunk)) {
  5986. chunksNeeded.delete(curChunk);
  5987. }
  5988. if (chunksNeeded.size > 0) {
  5989. continue;
  5990. }
  5991. loadedRequests.push(requestId);
  5992. }
  5993. }
  5994. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  5995. let nextEmptyChunk;
  5996. if (this.stream.numChunksLoaded === 1) {
  5997. const lastChunk = this.stream.numChunks - 1;
  5998. if (!this.stream.hasChunk(lastChunk)) {
  5999. nextEmptyChunk = lastChunk;
  6000. }
  6001. } else {
  6002. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  6003. }
  6004. if (Number.isInteger(nextEmptyChunk)) {
  6005. this._requestChunks([nextEmptyChunk]);
  6006. }
  6007. }
  6008. for (const requestId of loadedRequests) {
  6009. const capability = this._promisesByRequest.get(requestId);
  6010. this._promisesByRequest.delete(requestId);
  6011. capability.resolve();
  6012. }
  6013. this.msgHandler.send("DocProgress", {
  6014. loaded: this.stream.numChunksLoaded * this.chunkSize,
  6015. total: this.length
  6016. });
  6017. }
  6018. onError(err) {
  6019. this._loadedStreamCapability.reject(err);
  6020. }
  6021. getBeginChunk(begin) {
  6022. return Math.floor(begin / this.chunkSize);
  6023. }
  6024. getEndChunk(end) {
  6025. return Math.floor((end - 1) / this.chunkSize) + 1;
  6026. }
  6027. abort(reason) {
  6028. this.aborted = true;
  6029. if (this.pdfNetworkStream) {
  6030. this.pdfNetworkStream.cancelAllRequests(reason);
  6031. }
  6032. for (const capability of this._promisesByRequest.values()) {
  6033. capability.reject(reason);
  6034. }
  6035. }
  6036. }
  6037. exports.ChunkedStreamManager = ChunkedStreamManager;
  6038. /***/ }),
  6039. /* 139 */
  6040. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6041. "use strict";
  6042. Object.defineProperty(exports, "__esModule", ({
  6043. value: true
  6044. }));
  6045. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  6046. var _base_stream = __w_pdfjs_require__(136);
  6047. var _util = __w_pdfjs_require__(2);
  6048. class Stream extends _base_stream.BaseStream {
  6049. constructor(arrayBuffer, start, length, dict) {
  6050. super();
  6051. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  6052. this.start = start || 0;
  6053. this.pos = this.start;
  6054. this.end = start + length || this.bytes.length;
  6055. this.dict = dict;
  6056. }
  6057. get length() {
  6058. return this.end - this.start;
  6059. }
  6060. get isEmpty() {
  6061. return this.length === 0;
  6062. }
  6063. getByte() {
  6064. if (this.pos >= this.end) {
  6065. return -1;
  6066. }
  6067. return this.bytes[this.pos++];
  6068. }
  6069. getBytes(length) {
  6070. const bytes = this.bytes;
  6071. const pos = this.pos;
  6072. const strEnd = this.end;
  6073. if (!length) {
  6074. return bytes.subarray(pos, strEnd);
  6075. }
  6076. let end = pos + length;
  6077. if (end > strEnd) {
  6078. end = strEnd;
  6079. }
  6080. this.pos = end;
  6081. return bytes.subarray(pos, end);
  6082. }
  6083. getByteRange(begin, end) {
  6084. if (begin < 0) {
  6085. begin = 0;
  6086. }
  6087. if (end > this.end) {
  6088. end = this.end;
  6089. }
  6090. return this.bytes.subarray(begin, end);
  6091. }
  6092. reset() {
  6093. this.pos = this.start;
  6094. }
  6095. moveStart() {
  6096. this.start = this.pos;
  6097. }
  6098. makeSubStream(start, length) {
  6099. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6100. return new Stream(this.bytes.buffer, start, length, dict);
  6101. }
  6102. }
  6103. exports.Stream = Stream;
  6104. class StringStream extends Stream {
  6105. constructor(str) {
  6106. super((0, _util.stringToBytes)(str));
  6107. }
  6108. }
  6109. exports.StringStream = StringStream;
  6110. class NullStream extends Stream {
  6111. constructor() {
  6112. super(new Uint8Array(0));
  6113. }
  6114. }
  6115. exports.NullStream = NullStream;
  6116. /***/ }),
  6117. /* 140 */
  6118. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6119. "use strict";
  6120. Object.defineProperty(exports, "__esModule", ({
  6121. value: true
  6122. }));
  6123. exports.Page = exports.PDFDocument = void 0;
  6124. var _annotation = __w_pdfjs_require__(141);
  6125. var _util = __w_pdfjs_require__(2);
  6126. var _core_utils = __w_pdfjs_require__(135);
  6127. var _primitives = __w_pdfjs_require__(134);
  6128. var _xfa_fonts = __w_pdfjs_require__(180);
  6129. var _base_stream = __w_pdfjs_require__(136);
  6130. var _crypto = __w_pdfjs_require__(196);
  6131. var _catalog = __w_pdfjs_require__(198);
  6132. var _cleanup_helper = __w_pdfjs_require__(200);
  6133. var _dataset_reader = __w_pdfjs_require__(229);
  6134. var _parser = __w_pdfjs_require__(146);
  6135. var _stream = __w_pdfjs_require__(139);
  6136. var _object_loader = __w_pdfjs_require__(204);
  6137. var _operator_list = __w_pdfjs_require__(191);
  6138. var _evaluator = __w_pdfjs_require__(144);
  6139. var _decode_stream = __w_pdfjs_require__(148);
  6140. var _struct_tree = __w_pdfjs_require__(203);
  6141. var _writer = __w_pdfjs_require__(194);
  6142. var _factory = __w_pdfjs_require__(205);
  6143. var _xref = __w_pdfjs_require__(230);
  6144. const DEFAULT_USER_UNIT = 1.0;
  6145. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  6146. class Page {
  6147. constructor(_ref) {
  6148. let {
  6149. pdfManager,
  6150. xref,
  6151. pageIndex,
  6152. pageDict,
  6153. ref,
  6154. globalIdFactory,
  6155. fontCache,
  6156. builtInCMapCache,
  6157. standardFontDataCache,
  6158. globalImageCache,
  6159. nonBlendModesSet,
  6160. xfaFactory
  6161. } = _ref;
  6162. this.pdfManager = pdfManager;
  6163. this.pageIndex = pageIndex;
  6164. this.pageDict = pageDict;
  6165. this.xref = xref;
  6166. this.ref = ref;
  6167. this.fontCache = fontCache;
  6168. this.builtInCMapCache = builtInCMapCache;
  6169. this.standardFontDataCache = standardFontDataCache;
  6170. this.globalImageCache = globalImageCache;
  6171. this.nonBlendModesSet = nonBlendModesSet;
  6172. this.evaluatorOptions = pdfManager.evaluatorOptions;
  6173. this.resourcesPromise = null;
  6174. this.xfaFactory = xfaFactory;
  6175. const idCounters = {
  6176. obj: 0
  6177. };
  6178. this._localIdFactory = class extends globalIdFactory {
  6179. static createObjId() {
  6180. return `p${pageIndex}_${++idCounters.obj}`;
  6181. }
  6182. static getPageObjId() {
  6183. return `page${ref.toString()}`;
  6184. }
  6185. };
  6186. }
  6187. _getInheritableProperty(key) {
  6188. let getArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6189. const value = (0, _core_utils.getInheritableProperty)({
  6190. dict: this.pageDict,
  6191. key,
  6192. getArray,
  6193. stopWhenFound: false
  6194. });
  6195. if (!Array.isArray(value)) {
  6196. return value;
  6197. }
  6198. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  6199. return value[0];
  6200. }
  6201. return _primitives.Dict.merge({
  6202. xref: this.xref,
  6203. dictArray: value
  6204. });
  6205. }
  6206. get content() {
  6207. return this.pageDict.getArray("Contents");
  6208. }
  6209. get resources() {
  6210. const resources = this._getInheritableProperty("Resources");
  6211. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  6212. }
  6213. _getBoundingBox(name) {
  6214. if (this.xfaData) {
  6215. return this.xfaData.bbox;
  6216. }
  6217. let box = this._getInheritableProperty(name, true);
  6218. if (Array.isArray(box) && box.length === 4) {
  6219. box = _util.Util.normalizeRect(box);
  6220. if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  6221. return box;
  6222. }
  6223. (0, _util.warn)(`Empty, or invalid, /${name} entry.`);
  6224. }
  6225. return null;
  6226. }
  6227. get mediaBox() {
  6228. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  6229. }
  6230. get cropBox() {
  6231. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  6232. }
  6233. get userUnit() {
  6234. let obj = this.pageDict.get("UserUnit");
  6235. if (typeof obj !== "number" || obj <= 0) {
  6236. obj = DEFAULT_USER_UNIT;
  6237. }
  6238. return (0, _util.shadow)(this, "userUnit", obj);
  6239. }
  6240. get view() {
  6241. const {
  6242. cropBox,
  6243. mediaBox
  6244. } = this;
  6245. if (cropBox !== mediaBox && !(0, _util.isArrayEqual)(cropBox, mediaBox)) {
  6246. const box = _util.Util.intersect(cropBox, mediaBox);
  6247. if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  6248. return (0, _util.shadow)(this, "view", box);
  6249. }
  6250. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  6251. }
  6252. return (0, _util.shadow)(this, "view", mediaBox);
  6253. }
  6254. get rotate() {
  6255. let rotate = this._getInheritableProperty("Rotate") || 0;
  6256. if (rotate % 90 !== 0) {
  6257. rotate = 0;
  6258. } else if (rotate >= 360) {
  6259. rotate %= 360;
  6260. } else if (rotate < 0) {
  6261. rotate = (rotate % 360 + 360) % 360;
  6262. }
  6263. return (0, _util.shadow)(this, "rotate", rotate);
  6264. }
  6265. _onSubStreamError(handler, reason, objId) {
  6266. if (this.evaluatorOptions.ignoreErrors) {
  6267. handler.send("UnsupportedFeature", {
  6268. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  6269. });
  6270. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  6271. return;
  6272. }
  6273. throw reason;
  6274. }
  6275. getContentStream(handler) {
  6276. return this.pdfManager.ensure(this, "content").then(content => {
  6277. if (content instanceof _base_stream.BaseStream) {
  6278. return content;
  6279. }
  6280. if (Array.isArray(content)) {
  6281. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  6282. }
  6283. return new _stream.NullStream();
  6284. });
  6285. }
  6286. get xfaData() {
  6287. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  6288. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  6289. } : null);
  6290. }
  6291. async saveNewAnnotations(handler, task, annotations) {
  6292. if (this.xfaFactory) {
  6293. throw new Error("XFA: Cannot save new annotations.");
  6294. }
  6295. const partialEvaluator = new _evaluator.PartialEvaluator({
  6296. xref: this.xref,
  6297. handler,
  6298. pageIndex: this.pageIndex,
  6299. idFactory: this._localIdFactory,
  6300. fontCache: this.fontCache,
  6301. builtInCMapCache: this.builtInCMapCache,
  6302. standardFontDataCache: this.standardFontDataCache,
  6303. globalImageCache: this.globalImageCache,
  6304. options: this.evaluatorOptions
  6305. });
  6306. const pageDict = this.pageDict;
  6307. const annotationsArray = this.annotations.slice();
  6308. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  6309. for (const {
  6310. ref
  6311. } of newData.annotations) {
  6312. annotationsArray.push(ref);
  6313. }
  6314. const savedDict = pageDict.get("Annots");
  6315. pageDict.set("Annots", annotationsArray);
  6316. const buffer = [];
  6317. let transform = null;
  6318. if (this.xref.encrypt) {
  6319. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  6320. }
  6321. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  6322. if (savedDict) {
  6323. pageDict.set("Annots", savedDict);
  6324. }
  6325. const objects = newData.dependencies;
  6326. objects.push({
  6327. ref: this.ref,
  6328. data: buffer.join("")
  6329. }, ...newData.annotations);
  6330. return objects;
  6331. }
  6332. save(handler, task, annotationStorage) {
  6333. const partialEvaluator = new _evaluator.PartialEvaluator({
  6334. xref: this.xref,
  6335. handler,
  6336. pageIndex: this.pageIndex,
  6337. idFactory: this._localIdFactory,
  6338. fontCache: this.fontCache,
  6339. builtInCMapCache: this.builtInCMapCache,
  6340. standardFontDataCache: this.standardFontDataCache,
  6341. globalImageCache: this.globalImageCache,
  6342. options: this.evaluatorOptions
  6343. });
  6344. return this._parsedAnnotations.then(function (annotations) {
  6345. const newRefsPromises = [];
  6346. for (const annotation of annotations) {
  6347. if (!annotation.mustBePrinted(annotationStorage)) {
  6348. continue;
  6349. }
  6350. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  6351. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6352. return null;
  6353. }));
  6354. }
  6355. return Promise.all(newRefsPromises).then(function (newRefs) {
  6356. return newRefs.filter(newRef => !!newRef);
  6357. });
  6358. });
  6359. }
  6360. loadResources(keys) {
  6361. if (!this.resourcesPromise) {
  6362. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  6363. }
  6364. return this.resourcesPromise.then(() => {
  6365. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  6366. return objectLoader.load();
  6367. });
  6368. }
  6369. getOperatorList(_ref2) {
  6370. let {
  6371. handler,
  6372. sink,
  6373. task,
  6374. intent,
  6375. cacheKey,
  6376. annotationStorage = null
  6377. } = _ref2;
  6378. const contentStreamPromise = this.getContentStream(handler);
  6379. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  6380. const partialEvaluator = new _evaluator.PartialEvaluator({
  6381. xref: this.xref,
  6382. handler,
  6383. pageIndex: this.pageIndex,
  6384. idFactory: this._localIdFactory,
  6385. fontCache: this.fontCache,
  6386. builtInCMapCache: this.builtInCMapCache,
  6387. standardFontDataCache: this.standardFontDataCache,
  6388. globalImageCache: this.globalImageCache,
  6389. options: this.evaluatorOptions
  6390. });
  6391. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  6392. let newAnnotationsPromise = Promise.resolve(null);
  6393. if (newAnnotationsByPage) {
  6394. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  6395. if (newAnnotations) {
  6396. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  6397. }
  6398. }
  6399. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6400. const pageListPromise = dataPromises.then(_ref3 => {
  6401. let [contentStream] = _ref3;
  6402. const opList = new _operator_list.OperatorList(intent, sink);
  6403. handler.send("StartRenderPage", {
  6404. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  6405. pageIndex: this.pageIndex,
  6406. cacheKey
  6407. });
  6408. return partialEvaluator.getOperatorList({
  6409. stream: contentStream,
  6410. task,
  6411. resources: this.resources,
  6412. operatorList: opList
  6413. }).then(function () {
  6414. return opList;
  6415. });
  6416. });
  6417. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function (_ref4) {
  6418. let [pageOpList, annotations, newAnnotations] = _ref4;
  6419. if (newAnnotations) {
  6420. annotations = annotations.concat(newAnnotations);
  6421. }
  6422. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  6423. pageOpList.flush(true);
  6424. return {
  6425. length: pageOpList.totalLength
  6426. };
  6427. }
  6428. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  6429. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6430. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6431. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6432. const opListPromises = [];
  6433. for (const annotation of annotations) {
  6434. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  6435. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  6436. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6437. return {
  6438. opList: null,
  6439. separateForm: false,
  6440. separateCanvas: false
  6441. };
  6442. }));
  6443. }
  6444. }
  6445. return Promise.all(opListPromises).then(function (opLists) {
  6446. let form = false,
  6447. canvas = false;
  6448. for (const {
  6449. opList,
  6450. separateForm,
  6451. separateCanvas
  6452. } of opLists) {
  6453. pageOpList.addOpList(opList);
  6454. if (separateForm) {
  6455. form = separateForm;
  6456. }
  6457. if (separateCanvas) {
  6458. canvas = separateCanvas;
  6459. }
  6460. }
  6461. pageOpList.flush(true, {
  6462. form,
  6463. canvas
  6464. });
  6465. return {
  6466. length: pageOpList.totalLength
  6467. };
  6468. });
  6469. });
  6470. }
  6471. extractTextContent(_ref5) {
  6472. let {
  6473. handler,
  6474. task,
  6475. includeMarkedContent,
  6476. sink,
  6477. combineTextItems
  6478. } = _ref5;
  6479. const contentStreamPromise = this.getContentStream(handler);
  6480. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  6481. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6482. return dataPromises.then(_ref6 => {
  6483. let [contentStream] = _ref6;
  6484. const partialEvaluator = new _evaluator.PartialEvaluator({
  6485. xref: this.xref,
  6486. handler,
  6487. pageIndex: this.pageIndex,
  6488. idFactory: this._localIdFactory,
  6489. fontCache: this.fontCache,
  6490. builtInCMapCache: this.builtInCMapCache,
  6491. standardFontDataCache: this.standardFontDataCache,
  6492. globalImageCache: this.globalImageCache,
  6493. options: this.evaluatorOptions
  6494. });
  6495. return partialEvaluator.getTextContent({
  6496. stream: contentStream,
  6497. task,
  6498. resources: this.resources,
  6499. includeMarkedContent,
  6500. combineTextItems,
  6501. sink,
  6502. viewBox: this.view
  6503. });
  6504. });
  6505. }
  6506. async getStructTree() {
  6507. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  6508. if (!structTreeRoot) {
  6509. return null;
  6510. }
  6511. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  6512. return structTree.serializable;
  6513. }
  6514. _parseStructTree(structTreeRoot) {
  6515. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  6516. tree.parse();
  6517. return tree;
  6518. }
  6519. async getAnnotationsData(handler, task, intent) {
  6520. const annotations = await this._parsedAnnotations;
  6521. if (annotations.length === 0) {
  6522. return [];
  6523. }
  6524. const textContentPromises = [];
  6525. const annotationsData = [];
  6526. let partialEvaluator;
  6527. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6528. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6529. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6530. for (const annotation of annotations) {
  6531. const isVisible = intentAny || intentDisplay && annotation.viewable;
  6532. if (isVisible || intentPrint && annotation.printable) {
  6533. annotationsData.push(annotation.data);
  6534. }
  6535. if (annotation.hasTextContent && isVisible) {
  6536. if (!partialEvaluator) {
  6537. partialEvaluator = new _evaluator.PartialEvaluator({
  6538. xref: this.xref,
  6539. handler,
  6540. pageIndex: this.pageIndex,
  6541. idFactory: this._localIdFactory,
  6542. fontCache: this.fontCache,
  6543. builtInCMapCache: this.builtInCMapCache,
  6544. standardFontDataCache: this.standardFontDataCache,
  6545. globalImageCache: this.globalImageCache,
  6546. options: this.evaluatorOptions
  6547. });
  6548. }
  6549. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  6550. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  6551. }));
  6552. }
  6553. }
  6554. await Promise.all(textContentPromises);
  6555. return annotationsData;
  6556. }
  6557. get annotations() {
  6558. const annots = this._getInheritableProperty("Annots");
  6559. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  6560. }
  6561. get _parsedAnnotations() {
  6562. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  6563. const annotationPromises = [];
  6564. for (const annotationRef of this.annotations) {
  6565. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  6566. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  6567. return null;
  6568. }));
  6569. }
  6570. return Promise.all(annotationPromises).then(function (annotations) {
  6571. if (annotations.length === 0) {
  6572. return annotations;
  6573. }
  6574. const sortedAnnotations = [];
  6575. let popupAnnotations;
  6576. for (const annotation of annotations) {
  6577. if (!annotation) {
  6578. continue;
  6579. }
  6580. if (annotation instanceof _annotation.PopupAnnotation) {
  6581. if (!popupAnnotations) {
  6582. popupAnnotations = [];
  6583. }
  6584. popupAnnotations.push(annotation);
  6585. continue;
  6586. }
  6587. sortedAnnotations.push(annotation);
  6588. }
  6589. if (popupAnnotations) {
  6590. sortedAnnotations.push(...popupAnnotations);
  6591. }
  6592. return sortedAnnotations;
  6593. });
  6594. });
  6595. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  6596. }
  6597. get jsActions() {
  6598. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  6599. return (0, _util.shadow)(this, "jsActions", actions);
  6600. }
  6601. }
  6602. exports.Page = Page;
  6603. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  6604. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  6605. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  6606. const FINGERPRINT_FIRST_BYTES = 1024;
  6607. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  6608. function find(stream, signature) {
  6609. let limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1024;
  6610. let backwards = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  6611. const signatureLength = signature.length;
  6612. const scanBytes = stream.peekBytes(limit);
  6613. const scanLength = scanBytes.length - signatureLength;
  6614. if (scanLength <= 0) {
  6615. return false;
  6616. }
  6617. if (backwards) {
  6618. const signatureEnd = signatureLength - 1;
  6619. let pos = scanBytes.length - 1;
  6620. while (pos >= signatureEnd) {
  6621. let j = 0;
  6622. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  6623. j++;
  6624. }
  6625. if (j >= signatureLength) {
  6626. stream.pos += pos - signatureEnd;
  6627. return true;
  6628. }
  6629. pos--;
  6630. }
  6631. } else {
  6632. let pos = 0;
  6633. while (pos <= scanLength) {
  6634. let j = 0;
  6635. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  6636. j++;
  6637. }
  6638. if (j >= signatureLength) {
  6639. stream.pos += pos;
  6640. return true;
  6641. }
  6642. pos++;
  6643. }
  6644. }
  6645. return false;
  6646. }
  6647. class PDFDocument {
  6648. constructor(pdfManager, stream) {
  6649. if (stream.length <= 0) {
  6650. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  6651. }
  6652. this.pdfManager = pdfManager;
  6653. this.stream = stream;
  6654. this.xref = new _xref.XRef(stream, pdfManager);
  6655. this._pagePromises = new Map();
  6656. this._version = null;
  6657. const idCounters = {
  6658. font: 0
  6659. };
  6660. this._globalIdFactory = class {
  6661. static getDocId() {
  6662. return `g_${pdfManager.docId}`;
  6663. }
  6664. static createFontId() {
  6665. return `f${++idCounters.font}`;
  6666. }
  6667. static createObjId() {
  6668. (0, _util.unreachable)("Abstract method `createObjId` called.");
  6669. }
  6670. static getPageObjId() {
  6671. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  6672. }
  6673. };
  6674. }
  6675. parse(recoveryMode) {
  6676. this.xref.parse(recoveryMode);
  6677. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  6678. }
  6679. get linearization() {
  6680. let linearization = null;
  6681. try {
  6682. linearization = _parser.Linearization.create(this.stream);
  6683. } catch (err) {
  6684. if (err instanceof _core_utils.MissingDataException) {
  6685. throw err;
  6686. }
  6687. (0, _util.info)(err);
  6688. }
  6689. return (0, _util.shadow)(this, "linearization", linearization);
  6690. }
  6691. get startXRef() {
  6692. const stream = this.stream;
  6693. let startXRef = 0;
  6694. if (this.linearization) {
  6695. stream.reset();
  6696. if (find(stream, ENDOBJ_SIGNATURE)) {
  6697. startXRef = stream.pos + 6 - stream.start;
  6698. }
  6699. } else {
  6700. const step = 1024;
  6701. const startXRefLength = STARTXREF_SIGNATURE.length;
  6702. let found = false,
  6703. pos = stream.end;
  6704. while (!found && pos > 0) {
  6705. pos -= step - startXRefLength;
  6706. if (pos < 0) {
  6707. pos = 0;
  6708. }
  6709. stream.pos = pos;
  6710. found = find(stream, STARTXREF_SIGNATURE, step, true);
  6711. }
  6712. if (found) {
  6713. stream.skip(9);
  6714. let ch;
  6715. do {
  6716. ch = stream.getByte();
  6717. } while ((0, _core_utils.isWhiteSpace)(ch));
  6718. let str = "";
  6719. while (ch >= 0x20 && ch <= 0x39) {
  6720. str += String.fromCharCode(ch);
  6721. ch = stream.getByte();
  6722. }
  6723. startXRef = parseInt(str, 10);
  6724. if (isNaN(startXRef)) {
  6725. startXRef = 0;
  6726. }
  6727. }
  6728. }
  6729. return (0, _util.shadow)(this, "startXRef", startXRef);
  6730. }
  6731. checkHeader() {
  6732. const stream = this.stream;
  6733. stream.reset();
  6734. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  6735. return;
  6736. }
  6737. stream.moveStart();
  6738. stream.skip(PDF_HEADER_SIGNATURE.length);
  6739. let version = "",
  6740. ch;
  6741. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  6742. version += String.fromCharCode(ch);
  6743. }
  6744. if (_core_utils.PDF_VERSION_REGEXP.test(version)) {
  6745. this._version = version;
  6746. } else {
  6747. (0, _util.warn)(`Invalid PDF header version: ${version}`);
  6748. }
  6749. }
  6750. parseStartXRef() {
  6751. this.xref.setStartXRef(this.startXRef);
  6752. }
  6753. get numPages() {
  6754. let num = 0;
  6755. if (this.catalog.hasActualNumPages) {
  6756. num = this.catalog.numPages;
  6757. } else if (this.xfaFactory) {
  6758. num = this.xfaFactory.getNumPages();
  6759. } else if (this.linearization) {
  6760. num = this.linearization.numPages;
  6761. } else {
  6762. num = this.catalog.numPages;
  6763. }
  6764. return (0, _util.shadow)(this, "numPages", num);
  6765. }
  6766. _hasOnlyDocumentSignatures(fields) {
  6767. let recursionDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  6768. const RECURSION_LIMIT = 10;
  6769. if (!Array.isArray(fields)) {
  6770. return false;
  6771. }
  6772. return fields.every(field => {
  6773. field = this.xref.fetchIfRef(field);
  6774. if (!(field instanceof _primitives.Dict)) {
  6775. return false;
  6776. }
  6777. if (field.has("Kids")) {
  6778. if (++recursionDepth > RECURSION_LIMIT) {
  6779. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  6780. return false;
  6781. }
  6782. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  6783. }
  6784. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  6785. const rectangle = field.get("Rect");
  6786. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  6787. return isSignature && isInvisible;
  6788. });
  6789. }
  6790. get _xfaStreams() {
  6791. const acroForm = this.catalog.acroForm;
  6792. if (!acroForm) {
  6793. return null;
  6794. }
  6795. const xfa = acroForm.get("XFA");
  6796. const entries = {
  6797. "xdp:xdp": "",
  6798. template: "",
  6799. datasets: "",
  6800. config: "",
  6801. connectionSet: "",
  6802. localeSet: "",
  6803. stylesheet: "",
  6804. "/xdp:xdp": ""
  6805. };
  6806. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  6807. entries["xdp:xdp"] = xfa;
  6808. return entries;
  6809. }
  6810. if (!Array.isArray(xfa) || xfa.length === 0) {
  6811. return null;
  6812. }
  6813. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  6814. let name;
  6815. if (i === 0) {
  6816. name = "xdp:xdp";
  6817. } else if (i === ii - 2) {
  6818. name = "/xdp:xdp";
  6819. } else {
  6820. name = xfa[i];
  6821. }
  6822. if (!entries.hasOwnProperty(name)) {
  6823. continue;
  6824. }
  6825. const data = this.xref.fetchIfRef(xfa[i + 1]);
  6826. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  6827. continue;
  6828. }
  6829. entries[name] = data;
  6830. }
  6831. return entries;
  6832. }
  6833. get xfaDatasets() {
  6834. const streams = this._xfaStreams;
  6835. if (!streams) {
  6836. return (0, _util.shadow)(this, "xfaDatasets", null);
  6837. }
  6838. for (const key of ["datasets", "xdp:xdp"]) {
  6839. const stream = streams[key];
  6840. if (!stream) {
  6841. continue;
  6842. }
  6843. try {
  6844. const str = (0, _util.stringToUTF8String)(stream.getString());
  6845. const data = {
  6846. [key]: str
  6847. };
  6848. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  6849. } catch (_) {
  6850. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6851. break;
  6852. }
  6853. }
  6854. return (0, _util.shadow)(this, "xfaDatasets", null);
  6855. }
  6856. get xfaData() {
  6857. const streams = this._xfaStreams;
  6858. if (!streams) {
  6859. return null;
  6860. }
  6861. const data = Object.create(null);
  6862. for (const [key, stream] of Object.entries(streams)) {
  6863. if (!stream) {
  6864. continue;
  6865. }
  6866. try {
  6867. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  6868. } catch (_) {
  6869. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6870. return null;
  6871. }
  6872. }
  6873. return data;
  6874. }
  6875. get xfaFactory() {
  6876. let data;
  6877. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  6878. data = this.xfaData;
  6879. }
  6880. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  6881. }
  6882. get isPureXfa() {
  6883. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  6884. }
  6885. get htmlForXfa() {
  6886. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  6887. }
  6888. async loadXfaImages() {
  6889. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  6890. if (!xfaImagesDict) {
  6891. return;
  6892. }
  6893. const keys = xfaImagesDict.getKeys();
  6894. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  6895. await objectLoader.load();
  6896. const xfaImages = new Map();
  6897. for (const key of keys) {
  6898. const stream = xfaImagesDict.get(key);
  6899. if (stream instanceof _base_stream.BaseStream) {
  6900. xfaImages.set(key, stream.getBytes());
  6901. }
  6902. }
  6903. this.xfaFactory.setImages(xfaImages);
  6904. }
  6905. async loadXfaFonts(handler, task) {
  6906. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  6907. if (!acroForm) {
  6908. return;
  6909. }
  6910. const resources = await acroForm.getAsync("DR");
  6911. if (!(resources instanceof _primitives.Dict)) {
  6912. return;
  6913. }
  6914. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  6915. await objectLoader.load();
  6916. const fontRes = resources.get("Font");
  6917. if (!(fontRes instanceof _primitives.Dict)) {
  6918. return;
  6919. }
  6920. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  6921. options.useSystemFonts = false;
  6922. const partialEvaluator = new _evaluator.PartialEvaluator({
  6923. xref: this.xref,
  6924. handler,
  6925. pageIndex: -1,
  6926. idFactory: this._globalIdFactory,
  6927. fontCache: this.catalog.fontCache,
  6928. builtInCMapCache: this.catalog.builtInCMapCache,
  6929. standardFontDataCache: this.catalog.standardFontDataCache,
  6930. options
  6931. });
  6932. const operatorList = new _operator_list.OperatorList();
  6933. const pdfFonts = [];
  6934. const initialState = {
  6935. get font() {
  6936. return pdfFonts.at(-1);
  6937. },
  6938. set font(font) {
  6939. pdfFonts.push(font);
  6940. },
  6941. clone() {
  6942. return this;
  6943. }
  6944. };
  6945. const fonts = new Map();
  6946. fontRes.forEach((fontName, font) => {
  6947. fonts.set(fontName, font);
  6948. });
  6949. const promises = [];
  6950. for (const [fontName, font] of fonts) {
  6951. const descriptor = font.get("FontDescriptor");
  6952. if (!(descriptor instanceof _primitives.Dict)) {
  6953. continue;
  6954. }
  6955. let fontFamily = descriptor.get("FontFamily");
  6956. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  6957. const fontWeight = descriptor.get("FontWeight");
  6958. const italicAngle = -descriptor.get("ItalicAngle");
  6959. const cssFontInfo = {
  6960. fontFamily,
  6961. fontWeight,
  6962. italicAngle
  6963. };
  6964. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  6965. continue;
  6966. }
  6967. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  6968. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  6969. return null;
  6970. }));
  6971. }
  6972. await Promise.all(promises);
  6973. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  6974. if (!missingFonts) {
  6975. return;
  6976. }
  6977. options.ignoreErrors = true;
  6978. promises.length = 0;
  6979. pdfFonts.length = 0;
  6980. const reallyMissingFonts = new Set();
  6981. for (const missing of missingFonts) {
  6982. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  6983. reallyMissingFonts.add(missing);
  6984. }
  6985. }
  6986. if (reallyMissingFonts.size) {
  6987. missingFonts.push("PdfJS-Fallback");
  6988. }
  6989. for (const missing of missingFonts) {
  6990. if (reallyMissingFonts.has(missing)) {
  6991. continue;
  6992. }
  6993. for (const fontInfo of [{
  6994. name: "Regular",
  6995. fontWeight: 400,
  6996. italicAngle: 0
  6997. }, {
  6998. name: "Bold",
  6999. fontWeight: 700,
  7000. italicAngle: 0
  7001. }, {
  7002. name: "Italic",
  7003. fontWeight: 400,
  7004. italicAngle: 12
  7005. }, {
  7006. name: "BoldItalic",
  7007. fontWeight: 700,
  7008. italicAngle: 12
  7009. }]) {
  7010. const name = `${missing}-${fontInfo.name}`;
  7011. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  7012. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  7013. fontFamily: missing,
  7014. fontWeight: fontInfo.fontWeight,
  7015. italicAngle: fontInfo.italicAngle
  7016. }).catch(function (reason) {
  7017. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  7018. return null;
  7019. }));
  7020. }
  7021. }
  7022. await Promise.all(promises);
  7023. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  7024. }
  7025. async serializeXfaData(annotationStorage) {
  7026. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  7027. }
  7028. get version() {
  7029. return this.catalog.version || this._version;
  7030. }
  7031. get formInfo() {
  7032. const formInfo = {
  7033. hasFields: false,
  7034. hasAcroForm: false,
  7035. hasXfa: false,
  7036. hasSignatures: false
  7037. };
  7038. const acroForm = this.catalog.acroForm;
  7039. if (!acroForm) {
  7040. return (0, _util.shadow)(this, "formInfo", formInfo);
  7041. }
  7042. try {
  7043. const fields = acroForm.get("Fields");
  7044. const hasFields = Array.isArray(fields) && fields.length > 0;
  7045. formInfo.hasFields = hasFields;
  7046. const xfa = acroForm.get("XFA");
  7047. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  7048. const sigFlags = acroForm.get("SigFlags");
  7049. const hasSignatures = !!(sigFlags & 0x1);
  7050. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  7051. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  7052. formInfo.hasSignatures = hasSignatures;
  7053. } catch (ex) {
  7054. if (ex instanceof _core_utils.MissingDataException) {
  7055. throw ex;
  7056. }
  7057. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  7058. }
  7059. return (0, _util.shadow)(this, "formInfo", formInfo);
  7060. }
  7061. get documentInfo() {
  7062. const docInfo = {
  7063. PDFFormatVersion: this.version,
  7064. Language: this.catalog.lang,
  7065. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  7066. IsLinearized: !!this.linearization,
  7067. IsAcroFormPresent: this.formInfo.hasAcroForm,
  7068. IsXFAPresent: this.formInfo.hasXfa,
  7069. IsCollectionPresent: !!this.catalog.collection,
  7070. IsSignaturesPresent: this.formInfo.hasSignatures
  7071. };
  7072. let infoDict;
  7073. try {
  7074. infoDict = this.xref.trailer.get("Info");
  7075. } catch (err) {
  7076. if (err instanceof _core_utils.MissingDataException) {
  7077. throw err;
  7078. }
  7079. (0, _util.info)("The document information dictionary is invalid.");
  7080. }
  7081. if (!(infoDict instanceof _primitives.Dict)) {
  7082. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7083. }
  7084. for (const key of infoDict.getKeys()) {
  7085. const value = infoDict.get(key);
  7086. switch (key) {
  7087. case "Title":
  7088. case "Author":
  7089. case "Subject":
  7090. case "Keywords":
  7091. case "Creator":
  7092. case "Producer":
  7093. case "CreationDate":
  7094. case "ModDate":
  7095. if (typeof value === "string") {
  7096. docInfo[key] = (0, _util.stringToPDFString)(value);
  7097. continue;
  7098. }
  7099. break;
  7100. case "Trapped":
  7101. if (value instanceof _primitives.Name) {
  7102. docInfo[key] = value;
  7103. continue;
  7104. }
  7105. break;
  7106. default:
  7107. let customValue;
  7108. switch (typeof value) {
  7109. case "string":
  7110. customValue = (0, _util.stringToPDFString)(value);
  7111. break;
  7112. case "number":
  7113. case "boolean":
  7114. customValue = value;
  7115. break;
  7116. default:
  7117. if (value instanceof _primitives.Name) {
  7118. customValue = value;
  7119. }
  7120. break;
  7121. }
  7122. if (customValue === undefined) {
  7123. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  7124. continue;
  7125. }
  7126. if (!docInfo.Custom) {
  7127. docInfo.Custom = Object.create(null);
  7128. }
  7129. docInfo.Custom[key] = customValue;
  7130. continue;
  7131. }
  7132. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  7133. }
  7134. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7135. }
  7136. get fingerprints() {
  7137. function validate(data) {
  7138. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  7139. }
  7140. function hexString(hash) {
  7141. const buf = [];
  7142. for (const num of hash) {
  7143. const hex = num.toString(16);
  7144. buf.push(hex.padStart(2, "0"));
  7145. }
  7146. return buf.join("");
  7147. }
  7148. const idArray = this.xref.trailer.get("ID");
  7149. let hashOriginal, hashModified;
  7150. if (Array.isArray(idArray) && validate(idArray[0])) {
  7151. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  7152. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  7153. hashModified = (0, _util.stringToBytes)(idArray[1]);
  7154. }
  7155. } else {
  7156. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  7157. }
  7158. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  7159. }
  7160. async _getLinearizationPage(pageIndex) {
  7161. const {
  7162. catalog,
  7163. linearization,
  7164. xref
  7165. } = this;
  7166. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  7167. try {
  7168. const obj = await xref.fetchAsync(ref);
  7169. if (obj instanceof _primitives.Dict) {
  7170. let type = obj.getRaw("Type");
  7171. if (type instanceof _primitives.Ref) {
  7172. type = await xref.fetchAsync(type);
  7173. }
  7174. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  7175. if (!catalog.pageKidsCountCache.has(ref)) {
  7176. catalog.pageKidsCountCache.put(ref, 1);
  7177. }
  7178. if (!catalog.pageIndexCache.has(ref)) {
  7179. catalog.pageIndexCache.put(ref, 0);
  7180. }
  7181. return [obj, ref];
  7182. }
  7183. }
  7184. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  7185. } catch (reason) {
  7186. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  7187. return catalog.getPageDict(pageIndex);
  7188. }
  7189. }
  7190. getPage(pageIndex) {
  7191. const cachedPromise = this._pagePromises.get(pageIndex);
  7192. if (cachedPromise) {
  7193. return cachedPromise;
  7194. }
  7195. const {
  7196. catalog,
  7197. linearization,
  7198. xfaFactory
  7199. } = this;
  7200. let promise;
  7201. if (xfaFactory) {
  7202. promise = Promise.resolve([_primitives.Dict.empty, null]);
  7203. } else if (linearization && linearization.pageFirst === pageIndex) {
  7204. promise = this._getLinearizationPage(pageIndex);
  7205. } else {
  7206. promise = catalog.getPageDict(pageIndex);
  7207. }
  7208. promise = promise.then(_ref7 => {
  7209. let [pageDict, ref] = _ref7;
  7210. return new Page({
  7211. pdfManager: this.pdfManager,
  7212. xref: this.xref,
  7213. pageIndex,
  7214. pageDict,
  7215. ref,
  7216. globalIdFactory: this._globalIdFactory,
  7217. fontCache: catalog.fontCache,
  7218. builtInCMapCache: catalog.builtInCMapCache,
  7219. standardFontDataCache: catalog.standardFontDataCache,
  7220. globalImageCache: catalog.globalImageCache,
  7221. nonBlendModesSet: catalog.nonBlendModesSet,
  7222. xfaFactory
  7223. });
  7224. });
  7225. this._pagePromises.set(pageIndex, promise);
  7226. return promise;
  7227. }
  7228. async checkFirstPage() {
  7229. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7230. if (recoveryMode) {
  7231. return;
  7232. }
  7233. try {
  7234. await this.getPage(0);
  7235. } catch (reason) {
  7236. if (reason instanceof _core_utils.XRefEntryException) {
  7237. this._pagePromises.delete(0);
  7238. await this.cleanup();
  7239. throw new _core_utils.XRefParseException();
  7240. }
  7241. }
  7242. }
  7243. async checkLastPage() {
  7244. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7245. const {
  7246. catalog,
  7247. pdfManager
  7248. } = this;
  7249. catalog.setActualNumPages();
  7250. let numPages;
  7251. try {
  7252. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  7253. if (this.xfaFactory) {
  7254. return;
  7255. } else if (this.linearization) {
  7256. numPages = this.linearization.numPages;
  7257. } else {
  7258. numPages = catalog.numPages;
  7259. }
  7260. if (!Number.isInteger(numPages)) {
  7261. throw new _util.FormatError("Page count is not an integer.");
  7262. } else if (numPages <= 1) {
  7263. return;
  7264. }
  7265. await this.getPage(numPages - 1);
  7266. } catch (reason) {
  7267. this._pagePromises.delete(numPages - 1);
  7268. await this.cleanup();
  7269. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7270. throw new _core_utils.XRefParseException();
  7271. }
  7272. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  7273. let pagesTree;
  7274. try {
  7275. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  7276. } catch (reasonAll) {
  7277. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7278. throw new _core_utils.XRefParseException();
  7279. }
  7280. catalog.setActualNumPages(1);
  7281. return;
  7282. }
  7283. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  7284. let promise;
  7285. if (pageDict instanceof Error) {
  7286. promise = Promise.reject(pageDict);
  7287. promise.catch(() => {});
  7288. } else {
  7289. promise = Promise.resolve(new Page({
  7290. pdfManager,
  7291. xref: this.xref,
  7292. pageIndex,
  7293. pageDict,
  7294. ref,
  7295. globalIdFactory: this._globalIdFactory,
  7296. fontCache: catalog.fontCache,
  7297. builtInCMapCache: catalog.builtInCMapCache,
  7298. standardFontDataCache: catalog.standardFontDataCache,
  7299. globalImageCache: catalog.globalImageCache,
  7300. nonBlendModesSet: catalog.nonBlendModesSet,
  7301. xfaFactory: null
  7302. }));
  7303. }
  7304. this._pagePromises.set(pageIndex, promise);
  7305. }
  7306. catalog.setActualNumPages(pagesTree.size);
  7307. }
  7308. }
  7309. fontFallback(id, handler) {
  7310. return this.catalog.fontFallback(id, handler);
  7311. }
  7312. async cleanup() {
  7313. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7314. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  7315. }
  7316. _collectFieldObjects(name, fieldRef, promises) {
  7317. const field = this.xref.fetchIfRef(fieldRef);
  7318. if (field.has("T")) {
  7319. const partName = (0, _util.stringToPDFString)(field.get("T"));
  7320. if (name === "") {
  7321. name = partName;
  7322. } else {
  7323. name = `${name}.${partName}`;
  7324. }
  7325. }
  7326. if (!promises.has(name)) {
  7327. promises.set(name, []);
  7328. }
  7329. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  7330. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  7331. return null;
  7332. }));
  7333. if (field.has("Kids")) {
  7334. const kids = field.get("Kids");
  7335. for (const kid of kids) {
  7336. this._collectFieldObjects(name, kid, promises);
  7337. }
  7338. }
  7339. }
  7340. get fieldObjects() {
  7341. if (!this.formInfo.hasFields) {
  7342. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  7343. }
  7344. const allFields = Object.create(null);
  7345. const fieldPromises = new Map();
  7346. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  7347. this._collectFieldObjects("", fieldRef, fieldPromises);
  7348. }
  7349. const allPromises = [];
  7350. for (const [name, promises] of fieldPromises) {
  7351. allPromises.push(Promise.all(promises).then(fields => {
  7352. fields = fields.filter(field => !!field);
  7353. if (fields.length > 0) {
  7354. allFields[name] = fields;
  7355. }
  7356. }));
  7357. }
  7358. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  7359. }
  7360. get hasJSActions() {
  7361. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  7362. return (0, _util.shadow)(this, "hasJSActions", promise);
  7363. }
  7364. async _parseHasJSActions() {
  7365. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  7366. if (catalogJsActions) {
  7367. return true;
  7368. }
  7369. if (fieldObjects) {
  7370. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  7371. }
  7372. return false;
  7373. }
  7374. get calculationOrderIds() {
  7375. const acroForm = this.catalog.acroForm;
  7376. if (!acroForm || !acroForm.has("CO")) {
  7377. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7378. }
  7379. const calculationOrder = acroForm.get("CO");
  7380. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  7381. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7382. }
  7383. const ids = [];
  7384. for (const id of calculationOrder) {
  7385. if (id instanceof _primitives.Ref) {
  7386. ids.push(id.toString());
  7387. }
  7388. }
  7389. if (ids.length === 0) {
  7390. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7391. }
  7392. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  7393. }
  7394. }
  7395. exports.PDFDocument = PDFDocument;
  7396. /***/ }),
  7397. /* 141 */
  7398. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7399. "use strict";
  7400. Object.defineProperty(exports, "__esModule", ({
  7401. value: true
  7402. }));
  7403. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  7404. exports.getQuadPoints = getQuadPoints;
  7405. var _util = __w_pdfjs_require__(2);
  7406. var _core_utils = __w_pdfjs_require__(135);
  7407. var _default_appearance = __w_pdfjs_require__(142);
  7408. var _primitives = __w_pdfjs_require__(134);
  7409. var _writer = __w_pdfjs_require__(194);
  7410. var _base_stream = __w_pdfjs_require__(136);
  7411. var _bidi = __w_pdfjs_require__(189);
  7412. var _catalog = __w_pdfjs_require__(198);
  7413. var _colorspace = __w_pdfjs_require__(143);
  7414. var _file_spec = __w_pdfjs_require__(201);
  7415. var _object_loader = __w_pdfjs_require__(204);
  7416. var _operator_list = __w_pdfjs_require__(191);
  7417. var _stream = __w_pdfjs_require__(139);
  7418. var _factory = __w_pdfjs_require__(205);
  7419. class AnnotationFactory {
  7420. static create(xref, ref, pdfManager, idFactory, collectFields) {
  7421. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(_ref => {
  7422. let [acroForm, baseUrl, attachments, xfaDatasets, pageIndex] = _ref;
  7423. return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, attachments, xfaDatasets, collectFields, pageIndex]);
  7424. });
  7425. }
  7426. static _create(xref, ref, pdfManager, idFactory, acroForm) {
  7427. let attachments = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
  7428. let xfaDatasets = arguments.length > 6 ? arguments[6] : undefined;
  7429. let collectFields = arguments.length > 7 ? arguments[7] : undefined;
  7430. let pageIndex = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : -1;
  7431. const dict = xref.fetchIfRef(ref);
  7432. if (!(dict instanceof _primitives.Dict)) {
  7433. return undefined;
  7434. }
  7435. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  7436. let subtype = dict.get("Subtype");
  7437. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  7438. const acroFormDict = acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty;
  7439. const parameters = {
  7440. xref,
  7441. ref,
  7442. dict,
  7443. subtype,
  7444. id,
  7445. pdfManager,
  7446. acroForm: acroFormDict,
  7447. attachments,
  7448. xfaDatasets,
  7449. collectFields,
  7450. needAppearances: !collectFields && acroFormDict.get("NeedAppearances") === true,
  7451. pageIndex,
  7452. isOffscreenCanvasSupported: _util.FeatureTest.isOffscreenCanvasSupported && pdfManager.evaluatorOptions.isOffscreenCanvasSupported
  7453. };
  7454. switch (subtype) {
  7455. case "Link":
  7456. return new LinkAnnotation(parameters);
  7457. case "Text":
  7458. return new TextAnnotation(parameters);
  7459. case "Widget":
  7460. let fieldType = (0, _core_utils.getInheritableProperty)({
  7461. dict,
  7462. key: "FT"
  7463. });
  7464. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  7465. switch (fieldType) {
  7466. case "Tx":
  7467. return new TextWidgetAnnotation(parameters);
  7468. case "Btn":
  7469. return new ButtonWidgetAnnotation(parameters);
  7470. case "Ch":
  7471. return new ChoiceWidgetAnnotation(parameters);
  7472. case "Sig":
  7473. return new SignatureWidgetAnnotation(parameters);
  7474. }
  7475. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  7476. return new WidgetAnnotation(parameters);
  7477. case "Popup":
  7478. return new PopupAnnotation(parameters);
  7479. case "FreeText":
  7480. return new FreeTextAnnotation(parameters);
  7481. case "Line":
  7482. return new LineAnnotation(parameters);
  7483. case "Square":
  7484. return new SquareAnnotation(parameters);
  7485. case "Circle":
  7486. return new CircleAnnotation(parameters);
  7487. case "PolyLine":
  7488. return new PolylineAnnotation(parameters);
  7489. case "Polygon":
  7490. return new PolygonAnnotation(parameters);
  7491. case "Caret":
  7492. return new CaretAnnotation(parameters);
  7493. case "Ink":
  7494. return new InkAnnotation(parameters);
  7495. case "Highlight":
  7496. return new HighlightAnnotation(parameters);
  7497. case "Underline":
  7498. return new UnderlineAnnotation(parameters);
  7499. case "Squiggly":
  7500. return new SquigglyAnnotation(parameters);
  7501. case "StrikeOut":
  7502. return new StrikeOutAnnotation(parameters);
  7503. case "Stamp":
  7504. return new StampAnnotation(parameters);
  7505. case "FileAttachment":
  7506. return new FileAttachmentAnnotation(parameters);
  7507. default:
  7508. if (!collectFields) {
  7509. if (!subtype) {
  7510. (0, _util.warn)("Annotation is missing the required /Subtype.");
  7511. } else {
  7512. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  7513. }
  7514. }
  7515. return new Annotation(parameters);
  7516. }
  7517. }
  7518. static async _getPageIndex(xref, ref, pdfManager) {
  7519. try {
  7520. const annotDict = await xref.fetchIfRefAsync(ref);
  7521. if (!(annotDict instanceof _primitives.Dict)) {
  7522. return -1;
  7523. }
  7524. const pageRef = annotDict.getRaw("P");
  7525. if (!(pageRef instanceof _primitives.Ref)) {
  7526. return -1;
  7527. }
  7528. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  7529. return pageIndex;
  7530. } catch (ex) {
  7531. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  7532. return -1;
  7533. }
  7534. }
  7535. static async saveNewAnnotations(evaluator, task, annotations) {
  7536. const xref = evaluator.xref;
  7537. let baseFontRef;
  7538. const dependencies = [];
  7539. const promises = [];
  7540. for (const annotation of annotations) {
  7541. switch (annotation.annotationType) {
  7542. case _util.AnnotationEditorType.FREETEXT:
  7543. if (!baseFontRef) {
  7544. const baseFont = new _primitives.Dict(xref);
  7545. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  7546. baseFont.set("Type", _primitives.Name.get("Font"));
  7547. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  7548. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  7549. const buffer = [];
  7550. baseFontRef = xref.getNewTemporaryRef();
  7551. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  7552. dependencies.push({
  7553. ref: baseFontRef,
  7554. data: buffer.join("")
  7555. });
  7556. }
  7557. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  7558. evaluator,
  7559. task,
  7560. baseFontRef
  7561. }));
  7562. break;
  7563. case _util.AnnotationEditorType.INK:
  7564. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  7565. }
  7566. }
  7567. return {
  7568. annotations: await Promise.all(promises),
  7569. dependencies
  7570. };
  7571. }
  7572. static async printNewAnnotations(evaluator, task, annotations) {
  7573. if (!annotations) {
  7574. return null;
  7575. }
  7576. const xref = evaluator.xref;
  7577. const promises = [];
  7578. const isOffscreenCanvasSupported = _util.FeatureTest.isOffscreenCanvasSupported && evaluator.options.isOffscreenCanvasSupported;
  7579. for (const annotation of annotations) {
  7580. switch (annotation.annotationType) {
  7581. case _util.AnnotationEditorType.FREETEXT:
  7582. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  7583. evaluator,
  7584. task,
  7585. isOffscreenCanvasSupported
  7586. }));
  7587. break;
  7588. case _util.AnnotationEditorType.INK:
  7589. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation, {
  7590. isOffscreenCanvasSupported
  7591. }));
  7592. break;
  7593. }
  7594. }
  7595. return Promise.all(promises);
  7596. }
  7597. }
  7598. exports.AnnotationFactory = AnnotationFactory;
  7599. function getRgbColor(color) {
  7600. let defaultColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Uint8ClampedArray(3);
  7601. if (!Array.isArray(color)) {
  7602. return defaultColor;
  7603. }
  7604. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  7605. switch (color.length) {
  7606. case 0:
  7607. return null;
  7608. case 1:
  7609. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  7610. return rgbColor;
  7611. case 3:
  7612. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  7613. return rgbColor;
  7614. case 4:
  7615. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  7616. return rgbColor;
  7617. default:
  7618. return defaultColor;
  7619. }
  7620. }
  7621. function getPdfColorArray(color) {
  7622. return Array.from(color, c => c / 255);
  7623. }
  7624. function getQuadPoints(dict, rect) {
  7625. const quadPoints = dict.getArray("QuadPoints");
  7626. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  7627. return null;
  7628. }
  7629. const quadPointsLists = [];
  7630. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  7631. let minX = Infinity,
  7632. maxX = -Infinity,
  7633. minY = Infinity,
  7634. maxY = -Infinity;
  7635. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  7636. const x = quadPoints[j];
  7637. const y = quadPoints[j + 1];
  7638. minX = Math.min(x, minX);
  7639. maxX = Math.max(x, maxX);
  7640. minY = Math.min(y, minY);
  7641. maxY = Math.max(y, maxY);
  7642. }
  7643. if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
  7644. return null;
  7645. }
  7646. quadPointsLists.push([{
  7647. x: minX,
  7648. y: maxY
  7649. }, {
  7650. x: maxX,
  7651. y: maxY
  7652. }, {
  7653. x: minX,
  7654. y: minY
  7655. }, {
  7656. x: maxX,
  7657. y: minY
  7658. }]);
  7659. }
  7660. return quadPointsLists;
  7661. }
  7662. function getTransformMatrix(rect, bbox, matrix) {
  7663. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  7664. if (minX === maxX || minY === maxY) {
  7665. return [1, 0, 0, 1, rect[0], rect[1]];
  7666. }
  7667. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  7668. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  7669. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  7670. }
  7671. class Annotation {
  7672. constructor(params) {
  7673. const {
  7674. dict,
  7675. xref
  7676. } = params;
  7677. this.setTitle(dict.get("T"));
  7678. this.setContents(dict.get("Contents"));
  7679. this.setModificationDate(dict.get("M"));
  7680. this.setFlags(dict.get("F"));
  7681. this.setRectangle(dict.getArray("Rect"));
  7682. this.setColor(dict.getArray("C"));
  7683. this.setBorderStyle(dict);
  7684. this.setAppearance(dict);
  7685. this.setOptionalContent(dict);
  7686. const MK = dict.get("MK");
  7687. this.setBorderAndBackgroundColors(MK);
  7688. this.setRotation(MK);
  7689. this._streams = [];
  7690. if (this.appearance) {
  7691. this._streams.push(this.appearance);
  7692. }
  7693. this.data = {
  7694. annotationFlags: this.flags,
  7695. borderStyle: this.borderStyle,
  7696. color: this.color,
  7697. backgroundColor: this.backgroundColor,
  7698. borderColor: this.borderColor,
  7699. rotation: this.rotation,
  7700. contentsObj: this._contents,
  7701. hasAppearance: !!this.appearance,
  7702. id: params.id,
  7703. modificationDate: this.modificationDate,
  7704. rect: this.rectangle,
  7705. subtype: params.subtype,
  7706. hasOwnCanvas: false
  7707. };
  7708. if (params.collectFields) {
  7709. const kids = dict.get("Kids");
  7710. if (Array.isArray(kids)) {
  7711. const kidIds = [];
  7712. for (const kid of kids) {
  7713. if (kid instanceof _primitives.Ref) {
  7714. kidIds.push(kid.toString());
  7715. }
  7716. }
  7717. if (kidIds.length !== 0) {
  7718. this.data.kidIds = kidIds;
  7719. }
  7720. }
  7721. this.data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  7722. this.data.fieldName = this._constructFieldName(dict);
  7723. this.data.pageIndex = params.pageIndex;
  7724. }
  7725. this._isOffscreenCanvasSupported = params.isOffscreenCanvasSupported;
  7726. this._fallbackFontDict = null;
  7727. this._needAppearances = false;
  7728. }
  7729. _hasFlag(flags, flag) {
  7730. return !!(flags & flag);
  7731. }
  7732. _isViewable(flags) {
  7733. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  7734. }
  7735. _isPrintable(flags) {
  7736. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  7737. }
  7738. mustBeViewed(annotationStorage) {
  7739. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7740. if (storageEntry && storageEntry.hidden !== undefined) {
  7741. return !storageEntry.hidden;
  7742. }
  7743. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  7744. }
  7745. mustBePrinted(annotationStorage) {
  7746. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7747. if (storageEntry && storageEntry.print !== undefined) {
  7748. return storageEntry.print;
  7749. }
  7750. return this.printable;
  7751. }
  7752. get viewable() {
  7753. if (this.data.quadPoints === null) {
  7754. return false;
  7755. }
  7756. if (this.flags === 0) {
  7757. return true;
  7758. }
  7759. return this._isViewable(this.flags);
  7760. }
  7761. get printable() {
  7762. if (this.data.quadPoints === null) {
  7763. return false;
  7764. }
  7765. if (this.flags === 0) {
  7766. return false;
  7767. }
  7768. return this._isPrintable(this.flags);
  7769. }
  7770. _parseStringHelper(data) {
  7771. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  7772. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  7773. return {
  7774. str,
  7775. dir
  7776. };
  7777. }
  7778. setDefaultAppearance(params) {
  7779. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  7780. dict: params.dict,
  7781. key: "DA"
  7782. }) || params.acroForm.get("DA");
  7783. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  7784. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  7785. }
  7786. setTitle(title) {
  7787. this._title = this._parseStringHelper(title);
  7788. }
  7789. setContents(contents) {
  7790. this._contents = this._parseStringHelper(contents);
  7791. }
  7792. setModificationDate(modificationDate) {
  7793. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  7794. }
  7795. setFlags(flags) {
  7796. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  7797. }
  7798. hasFlag(flag) {
  7799. return this._hasFlag(this.flags, flag);
  7800. }
  7801. setRectangle(rectangle) {
  7802. if (Array.isArray(rectangle) && rectangle.length === 4) {
  7803. this.rectangle = _util.Util.normalizeRect(rectangle);
  7804. } else {
  7805. this.rectangle = [0, 0, 0, 0];
  7806. }
  7807. }
  7808. setColor(color) {
  7809. this.color = getRgbColor(color);
  7810. }
  7811. setLineEndings(lineEndings) {
  7812. this.lineEndings = ["None", "None"];
  7813. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  7814. for (let i = 0; i < 2; i++) {
  7815. const obj = lineEndings[i];
  7816. if (obj instanceof _primitives.Name) {
  7817. switch (obj.name) {
  7818. case "None":
  7819. continue;
  7820. case "Square":
  7821. case "Circle":
  7822. case "Diamond":
  7823. case "OpenArrow":
  7824. case "ClosedArrow":
  7825. case "Butt":
  7826. case "ROpenArrow":
  7827. case "RClosedArrow":
  7828. case "Slash":
  7829. this.lineEndings[i] = obj.name;
  7830. continue;
  7831. }
  7832. }
  7833. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  7834. }
  7835. }
  7836. }
  7837. setRotation(mk) {
  7838. this.rotation = 0;
  7839. if (mk instanceof _primitives.Dict) {
  7840. let angle = mk.get("R") || 0;
  7841. if (Number.isInteger(angle) && angle !== 0) {
  7842. angle %= 360;
  7843. if (angle < 0) {
  7844. angle += 360;
  7845. }
  7846. if (angle % 90 === 0) {
  7847. this.rotation = angle;
  7848. }
  7849. }
  7850. }
  7851. }
  7852. setBorderAndBackgroundColors(mk) {
  7853. if (mk instanceof _primitives.Dict) {
  7854. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  7855. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  7856. } else {
  7857. this.borderColor = this.backgroundColor = null;
  7858. }
  7859. }
  7860. setBorderStyle(borderStyle) {
  7861. this.borderStyle = new AnnotationBorderStyle();
  7862. if (!(borderStyle instanceof _primitives.Dict)) {
  7863. return;
  7864. }
  7865. if (borderStyle.has("BS")) {
  7866. const dict = borderStyle.get("BS");
  7867. const dictType = dict.get("Type");
  7868. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  7869. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  7870. this.borderStyle.setStyle(dict.get("S"));
  7871. this.borderStyle.setDashArray(dict.getArray("D"));
  7872. }
  7873. } else if (borderStyle.has("Border")) {
  7874. const array = borderStyle.getArray("Border");
  7875. if (Array.isArray(array) && array.length >= 3) {
  7876. this.borderStyle.setHorizontalCornerRadius(array[0]);
  7877. this.borderStyle.setVerticalCornerRadius(array[1]);
  7878. this.borderStyle.setWidth(array[2], this.rectangle);
  7879. if (array.length === 4) {
  7880. this.borderStyle.setDashArray(array[3], true);
  7881. }
  7882. }
  7883. } else {
  7884. this.borderStyle.setWidth(0);
  7885. }
  7886. }
  7887. setAppearance(dict) {
  7888. this.appearance = null;
  7889. const appearanceStates = dict.get("AP");
  7890. if (!(appearanceStates instanceof _primitives.Dict)) {
  7891. return;
  7892. }
  7893. const normalAppearanceState = appearanceStates.get("N");
  7894. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  7895. this.appearance = normalAppearanceState;
  7896. return;
  7897. }
  7898. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  7899. return;
  7900. }
  7901. const as = dict.get("AS");
  7902. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  7903. return;
  7904. }
  7905. this.appearance = normalAppearanceState.get(as.name);
  7906. }
  7907. setOptionalContent(dict) {
  7908. this.oc = null;
  7909. const oc = dict.get("OC");
  7910. if (oc instanceof _primitives.Name) {
  7911. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  7912. } else if (oc instanceof _primitives.Dict) {
  7913. this.oc = oc;
  7914. }
  7915. }
  7916. loadResources(keys, appearance) {
  7917. return appearance.dict.getAsync("Resources").then(resources => {
  7918. if (!resources) {
  7919. return undefined;
  7920. }
  7921. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  7922. return objectLoader.load().then(function () {
  7923. return resources;
  7924. });
  7925. });
  7926. }
  7927. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  7928. const data = this.data;
  7929. let appearance = this.appearance;
  7930. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  7931. if (!appearance) {
  7932. if (!isUsingOwnCanvas) {
  7933. return {
  7934. opList: new _operator_list.OperatorList(),
  7935. separateForm: false,
  7936. separateCanvas: false
  7937. };
  7938. }
  7939. appearance = new _stream.StringStream("");
  7940. appearance.dict = new _primitives.Dict();
  7941. }
  7942. const appearanceDict = appearance.dict;
  7943. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  7944. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  7945. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  7946. const transform = getTransformMatrix(data.rect, bbox, matrix);
  7947. const opList = new _operator_list.OperatorList();
  7948. let optionalContent;
  7949. if (this.oc) {
  7950. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  7951. }
  7952. if (optionalContent !== undefined) {
  7953. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  7954. }
  7955. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  7956. await evaluator.getOperatorList({
  7957. stream: appearance,
  7958. task,
  7959. resources,
  7960. operatorList: opList,
  7961. fallbackFontDict: this._fallbackFontDict
  7962. });
  7963. opList.addOp(_util.OPS.endAnnotation, []);
  7964. if (optionalContent !== undefined) {
  7965. opList.addOp(_util.OPS.endMarkedContent, []);
  7966. }
  7967. this.reset();
  7968. return {
  7969. opList,
  7970. separateForm: false,
  7971. separateCanvas: isUsingOwnCanvas
  7972. };
  7973. }
  7974. async save(evaluator, task, annotationStorage) {
  7975. return null;
  7976. }
  7977. get hasTextContent() {
  7978. return false;
  7979. }
  7980. async extractTextContent(evaluator, task, viewBox) {
  7981. if (!this.appearance) {
  7982. return;
  7983. }
  7984. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  7985. const text = [];
  7986. const buffer = [];
  7987. const sink = {
  7988. desiredSize: Math.Infinity,
  7989. ready: true,
  7990. enqueue(chunk, size) {
  7991. for (const item of chunk.items) {
  7992. buffer.push(item.str);
  7993. if (item.hasEOL) {
  7994. text.push(buffer.join(""));
  7995. buffer.length = 0;
  7996. }
  7997. }
  7998. }
  7999. };
  8000. await evaluator.getTextContent({
  8001. stream: this.appearance,
  8002. task,
  8003. resources,
  8004. includeMarkedContent: true,
  8005. combineTextItems: true,
  8006. sink,
  8007. viewBox
  8008. });
  8009. this.reset();
  8010. if (buffer.length) {
  8011. text.push(buffer.join(""));
  8012. }
  8013. if (text.length > 0) {
  8014. this.data.textContent = text;
  8015. }
  8016. }
  8017. getFieldObject() {
  8018. if (this.data.kidIds) {
  8019. return {
  8020. id: this.data.id,
  8021. actions: this.data.actions,
  8022. name: this.data.fieldName,
  8023. strokeColor: this.data.borderColor,
  8024. fillColor: this.data.backgroundColor,
  8025. type: "",
  8026. kidIds: this.data.kidIds,
  8027. page: this.data.pageIndex,
  8028. rotation: this.rotation
  8029. };
  8030. }
  8031. return null;
  8032. }
  8033. reset() {
  8034. for (const stream of this._streams) {
  8035. stream.reset();
  8036. }
  8037. }
  8038. _constructFieldName(dict) {
  8039. if (!dict.has("T") && !dict.has("Parent")) {
  8040. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  8041. return "";
  8042. }
  8043. if (!dict.has("Parent")) {
  8044. return (0, _util.stringToPDFString)(dict.get("T"));
  8045. }
  8046. const fieldName = [];
  8047. if (dict.has("T")) {
  8048. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  8049. }
  8050. let loopDict = dict;
  8051. const visited = new _primitives.RefSet();
  8052. if (dict.objId) {
  8053. visited.put(dict.objId);
  8054. }
  8055. while (loopDict.has("Parent")) {
  8056. loopDict = loopDict.get("Parent");
  8057. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  8058. break;
  8059. }
  8060. if (loopDict.objId) {
  8061. visited.put(loopDict.objId);
  8062. }
  8063. if (loopDict.has("T")) {
  8064. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  8065. }
  8066. }
  8067. return fieldName.join(".");
  8068. }
  8069. }
  8070. exports.Annotation = Annotation;
  8071. class AnnotationBorderStyle {
  8072. constructor() {
  8073. this.width = 1;
  8074. this.style = _util.AnnotationBorderStyleType.SOLID;
  8075. this.dashArray = [3];
  8076. this.horizontalCornerRadius = 0;
  8077. this.verticalCornerRadius = 0;
  8078. }
  8079. setWidth(width) {
  8080. let rect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
  8081. if (width instanceof _primitives.Name) {
  8082. this.width = 0;
  8083. return;
  8084. }
  8085. if (typeof width === "number") {
  8086. if (width > 0) {
  8087. const maxWidth = (rect[2] - rect[0]) / 2;
  8088. const maxHeight = (rect[3] - rect[1]) / 2;
  8089. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  8090. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  8091. width = 1;
  8092. }
  8093. }
  8094. this.width = width;
  8095. }
  8096. }
  8097. setStyle(style) {
  8098. if (!(style instanceof _primitives.Name)) {
  8099. return;
  8100. }
  8101. switch (style.name) {
  8102. case "S":
  8103. this.style = _util.AnnotationBorderStyleType.SOLID;
  8104. break;
  8105. case "D":
  8106. this.style = _util.AnnotationBorderStyleType.DASHED;
  8107. break;
  8108. case "B":
  8109. this.style = _util.AnnotationBorderStyleType.BEVELED;
  8110. break;
  8111. case "I":
  8112. this.style = _util.AnnotationBorderStyleType.INSET;
  8113. break;
  8114. case "U":
  8115. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  8116. break;
  8117. default:
  8118. break;
  8119. }
  8120. }
  8121. setDashArray(dashArray) {
  8122. let forceStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8123. if (Array.isArray(dashArray) && dashArray.length > 0) {
  8124. let isValid = true;
  8125. let allZeros = true;
  8126. for (const element of dashArray) {
  8127. const validNumber = +element >= 0;
  8128. if (!validNumber) {
  8129. isValid = false;
  8130. break;
  8131. } else if (element > 0) {
  8132. allZeros = false;
  8133. }
  8134. }
  8135. if (isValid && !allZeros) {
  8136. this.dashArray = dashArray;
  8137. if (forceStyle) {
  8138. this.setStyle(_primitives.Name.get("D"));
  8139. }
  8140. } else {
  8141. this.width = 0;
  8142. }
  8143. } else if (dashArray) {
  8144. this.width = 0;
  8145. }
  8146. }
  8147. setHorizontalCornerRadius(radius) {
  8148. if (Number.isInteger(radius)) {
  8149. this.horizontalCornerRadius = radius;
  8150. }
  8151. }
  8152. setVerticalCornerRadius(radius) {
  8153. if (Number.isInteger(radius)) {
  8154. this.verticalCornerRadius = radius;
  8155. }
  8156. }
  8157. }
  8158. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  8159. class MarkupAnnotation extends Annotation {
  8160. constructor(params) {
  8161. super(params);
  8162. const {
  8163. dict
  8164. } = params;
  8165. if (dict.has("IRT")) {
  8166. const rawIRT = dict.getRaw("IRT");
  8167. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  8168. const rt = dict.get("RT");
  8169. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  8170. }
  8171. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  8172. const parent = dict.get("IRT");
  8173. this.setTitle(parent.get("T"));
  8174. this.data.titleObj = this._title;
  8175. this.setContents(parent.get("Contents"));
  8176. this.data.contentsObj = this._contents;
  8177. if (!parent.has("CreationDate")) {
  8178. this.data.creationDate = null;
  8179. } else {
  8180. this.setCreationDate(parent.get("CreationDate"));
  8181. this.data.creationDate = this.creationDate;
  8182. }
  8183. if (!parent.has("M")) {
  8184. this.data.modificationDate = null;
  8185. } else {
  8186. this.setModificationDate(parent.get("M"));
  8187. this.data.modificationDate = this.modificationDate;
  8188. }
  8189. this.data.hasPopup = parent.has("Popup");
  8190. if (!parent.has("C")) {
  8191. this.data.color = null;
  8192. } else {
  8193. this.setColor(parent.getArray("C"));
  8194. this.data.color = this.color;
  8195. }
  8196. } else {
  8197. this.data.titleObj = this._title;
  8198. this.setCreationDate(dict.get("CreationDate"));
  8199. this.data.creationDate = this.creationDate;
  8200. this.data.hasPopup = dict.has("Popup");
  8201. if (!dict.has("C")) {
  8202. this.data.color = null;
  8203. }
  8204. }
  8205. if (dict.has("RC")) {
  8206. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  8207. }
  8208. }
  8209. setCreationDate(creationDate) {
  8210. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  8211. }
  8212. _setDefaultAppearance(_ref2) {
  8213. let {
  8214. xref,
  8215. extra,
  8216. strokeColor,
  8217. fillColor,
  8218. blendMode,
  8219. strokeAlpha,
  8220. fillAlpha,
  8221. pointsCallback
  8222. } = _ref2;
  8223. let minX = Number.MAX_VALUE;
  8224. let minY = Number.MAX_VALUE;
  8225. let maxX = Number.MIN_VALUE;
  8226. let maxY = Number.MIN_VALUE;
  8227. const buffer = ["q"];
  8228. if (extra) {
  8229. buffer.push(extra);
  8230. }
  8231. if (strokeColor) {
  8232. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  8233. }
  8234. if (fillColor) {
  8235. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  8236. }
  8237. let pointsArray = this.data.quadPoints;
  8238. if (!pointsArray) {
  8239. pointsArray = [[{
  8240. x: this.rectangle[0],
  8241. y: this.rectangle[3]
  8242. }, {
  8243. x: this.rectangle[2],
  8244. y: this.rectangle[3]
  8245. }, {
  8246. x: this.rectangle[0],
  8247. y: this.rectangle[1]
  8248. }, {
  8249. x: this.rectangle[2],
  8250. y: this.rectangle[1]
  8251. }]];
  8252. }
  8253. for (const points of pointsArray) {
  8254. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  8255. minX = Math.min(minX, mX);
  8256. maxX = Math.max(maxX, MX);
  8257. minY = Math.min(minY, mY);
  8258. maxY = Math.max(maxY, MY);
  8259. }
  8260. buffer.push("Q");
  8261. const formDict = new _primitives.Dict(xref);
  8262. const appearanceStreamDict = new _primitives.Dict(xref);
  8263. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  8264. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  8265. appearanceStream.dict = appearanceStreamDict;
  8266. formDict.set("Fm0", appearanceStream);
  8267. const gsDict = new _primitives.Dict(xref);
  8268. if (blendMode) {
  8269. gsDict.set("BM", _primitives.Name.get(blendMode));
  8270. }
  8271. if (typeof strokeAlpha === "number") {
  8272. gsDict.set("CA", strokeAlpha);
  8273. }
  8274. if (typeof fillAlpha === "number") {
  8275. gsDict.set("ca", fillAlpha);
  8276. }
  8277. const stateDict = new _primitives.Dict(xref);
  8278. stateDict.set("GS0", gsDict);
  8279. const resources = new _primitives.Dict(xref);
  8280. resources.set("ExtGState", stateDict);
  8281. resources.set("XObject", formDict);
  8282. const appearanceDict = new _primitives.Dict(xref);
  8283. appearanceDict.set("Resources", resources);
  8284. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  8285. appearanceDict.set("BBox", bbox);
  8286. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  8287. this.appearance.dict = appearanceDict;
  8288. this._streams.push(this.appearance, appearanceStream);
  8289. }
  8290. static async createNewAnnotation(xref, annotation, dependencies, params) {
  8291. const annotationRef = xref.getNewTemporaryRef();
  8292. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8293. const buffer = [];
  8294. let annotationDict;
  8295. if (ap) {
  8296. const apRef = xref.getNewTemporaryRef();
  8297. annotationDict = this.createNewDict(annotation, xref, {
  8298. apRef
  8299. });
  8300. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  8301. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  8302. dependencies.push({
  8303. ref: apRef,
  8304. data: buffer.join("")
  8305. });
  8306. } else {
  8307. annotationDict = this.createNewDict(annotation, xref, {});
  8308. }
  8309. buffer.length = 0;
  8310. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  8311. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  8312. return {
  8313. ref: annotationRef,
  8314. data: buffer.join("")
  8315. };
  8316. }
  8317. static async createNewPrintAnnotation(xref, annotation, params) {
  8318. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8319. const annotationDict = this.createNewDict(annotation, xref, {
  8320. ap
  8321. });
  8322. return new this.prototype.constructor({
  8323. dict: annotationDict,
  8324. xref,
  8325. isOffscreenCanvasSupported: params.isOffscreenCanvasSupported
  8326. });
  8327. }
  8328. }
  8329. exports.MarkupAnnotation = MarkupAnnotation;
  8330. class WidgetAnnotation extends Annotation {
  8331. constructor(params) {
  8332. super(params);
  8333. const {
  8334. dict,
  8335. xref
  8336. } = params;
  8337. const data = this.data;
  8338. this.ref = params.ref;
  8339. this._needAppearances = params.needAppearances;
  8340. data.annotationType = _util.AnnotationType.WIDGET;
  8341. if (data.fieldName === undefined) {
  8342. data.fieldName = this._constructFieldName(dict);
  8343. }
  8344. if (data.actions === undefined) {
  8345. data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  8346. }
  8347. let fieldValue = (0, _core_utils.getInheritableProperty)({
  8348. dict,
  8349. key: "V",
  8350. getArray: true
  8351. });
  8352. data.fieldValue = this._decodeFormValue(fieldValue);
  8353. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  8354. dict,
  8355. key: "DV",
  8356. getArray: true
  8357. });
  8358. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  8359. if (fieldValue === undefined && params.xfaDatasets) {
  8360. const path = this._title.str;
  8361. if (path) {
  8362. this._hasValueFromXFA = true;
  8363. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  8364. }
  8365. }
  8366. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  8367. data.fieldValue = data.defaultFieldValue;
  8368. }
  8369. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  8370. this.setDefaultAppearance(params);
  8371. data.hasAppearance = this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null || data.hasAppearance;
  8372. const fieldType = (0, _core_utils.getInheritableProperty)({
  8373. dict,
  8374. key: "FT"
  8375. });
  8376. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  8377. const localResources = (0, _core_utils.getInheritableProperty)({
  8378. dict,
  8379. key: "DR"
  8380. });
  8381. const acroFormResources = params.acroForm.get("DR");
  8382. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  8383. this._fieldResources = {
  8384. localResources,
  8385. acroFormResources,
  8386. appearanceResources,
  8387. mergedResources: _primitives.Dict.merge({
  8388. xref,
  8389. dictArray: [localResources, appearanceResources, acroFormResources],
  8390. mergeSubDicts: true
  8391. })
  8392. };
  8393. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  8394. dict,
  8395. key: "Ff"
  8396. });
  8397. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  8398. data.fieldFlags = 0;
  8399. }
  8400. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  8401. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  8402. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  8403. }
  8404. _decodeFormValue(formValue) {
  8405. if (Array.isArray(formValue)) {
  8406. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  8407. } else if (formValue instanceof _primitives.Name) {
  8408. return (0, _util.stringToPDFString)(formValue.name);
  8409. } else if (typeof formValue === "string") {
  8410. return (0, _util.stringToPDFString)(formValue);
  8411. }
  8412. return null;
  8413. }
  8414. hasFieldFlag(flag) {
  8415. return !!(this.data.fieldFlags & flag);
  8416. }
  8417. getRotationMatrix(annotationStorage) {
  8418. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8419. let rotation = storageEntry && storageEntry.rotation;
  8420. if (rotation === undefined) {
  8421. rotation = this.rotation;
  8422. }
  8423. if (rotation === 0) {
  8424. return _util.IDENTITY_MATRIX;
  8425. }
  8426. const width = this.data.rect[2] - this.data.rect[0];
  8427. const height = this.data.rect[3] - this.data.rect[1];
  8428. return (0, _core_utils.getRotationMatrix)(rotation, width, height);
  8429. }
  8430. getBorderAndBackgroundAppearances(annotationStorage) {
  8431. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8432. let rotation = storageEntry && storageEntry.rotation;
  8433. if (rotation === undefined) {
  8434. rotation = this.rotation;
  8435. }
  8436. if (!this.backgroundColor && !this.borderColor) {
  8437. return "";
  8438. }
  8439. const width = this.data.rect[2] - this.data.rect[0];
  8440. const height = this.data.rect[3] - this.data.rect[1];
  8441. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  8442. let str = "";
  8443. if (this.backgroundColor) {
  8444. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  8445. }
  8446. if (this.borderColor) {
  8447. const borderWidth = this.borderStyle.width || 1;
  8448. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  8449. }
  8450. return str;
  8451. }
  8452. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  8453. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  8454. return {
  8455. opList: new _operator_list.OperatorList(),
  8456. separateForm: true,
  8457. separateCanvas: false
  8458. };
  8459. }
  8460. if (!this._hasText) {
  8461. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8462. }
  8463. const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
  8464. if (this.appearance && content === null) {
  8465. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8466. }
  8467. const opList = new _operator_list.OperatorList();
  8468. if (!this._defaultAppearance || content === null) {
  8469. return {
  8470. opList,
  8471. separateForm: false,
  8472. separateCanvas: false
  8473. };
  8474. }
  8475. const matrix = [1, 0, 0, 1, 0, 0];
  8476. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  8477. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  8478. let optionalContent;
  8479. if (this.oc) {
  8480. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  8481. }
  8482. if (optionalContent !== undefined) {
  8483. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8484. }
  8485. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  8486. const stream = new _stream.StringStream(content);
  8487. await evaluator.getOperatorList({
  8488. stream,
  8489. task,
  8490. resources: this._fieldResources.mergedResources,
  8491. operatorList: opList
  8492. });
  8493. opList.addOp(_util.OPS.endAnnotation, []);
  8494. if (optionalContent !== undefined) {
  8495. opList.addOp(_util.OPS.endMarkedContent, []);
  8496. }
  8497. return {
  8498. opList,
  8499. separateForm: false,
  8500. separateCanvas: false
  8501. };
  8502. }
  8503. _getMKDict(rotation) {
  8504. const mk = new _primitives.Dict(null);
  8505. if (rotation) {
  8506. mk.set("R", rotation);
  8507. }
  8508. if (this.borderColor) {
  8509. mk.set("BC", getPdfColorArray(this.borderColor));
  8510. }
  8511. if (this.backgroundColor) {
  8512. mk.set("BG", getPdfColorArray(this.backgroundColor));
  8513. }
  8514. return mk.size > 0 ? mk : null;
  8515. }
  8516. async save(evaluator, task, annotationStorage) {
  8517. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8518. let value = storageEntry && storageEntry.value;
  8519. let rotation = storageEntry && storageEntry.rotation;
  8520. if (value === this.data.fieldValue || value === undefined) {
  8521. if (!this._hasValueFromXFA && rotation === undefined) {
  8522. return null;
  8523. }
  8524. value = value || this.data.fieldValue;
  8525. }
  8526. 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])) {
  8527. return null;
  8528. }
  8529. if (rotation === undefined) {
  8530. rotation = this.rotation;
  8531. }
  8532. let appearance = null;
  8533. if (!this._needAppearances) {
  8534. appearance = await this._getAppearance(evaluator, task, _util.RenderingIntentFlag.SAVE, annotationStorage);
  8535. if (appearance === null) {
  8536. return null;
  8537. }
  8538. } else {}
  8539. let needAppearances = false;
  8540. if (appearance && appearance.needAppearances) {
  8541. needAppearances = true;
  8542. appearance = null;
  8543. }
  8544. const {
  8545. xref
  8546. } = evaluator;
  8547. const originalDict = xref.fetchIfRef(this.ref);
  8548. if (!(originalDict instanceof _primitives.Dict)) {
  8549. return null;
  8550. }
  8551. const dict = new _primitives.Dict(xref);
  8552. for (const key of originalDict.getKeys()) {
  8553. if (key !== "AP") {
  8554. dict.set(key, originalDict.getRaw(key));
  8555. }
  8556. }
  8557. const xfa = {
  8558. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  8559. value
  8560. };
  8561. const encoder = val => {
  8562. return (0, _core_utils.isAscii)(val) ? val : (0, _core_utils.stringToUTF16String)(val, true);
  8563. };
  8564. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  8565. const maybeMK = this._getMKDict(rotation);
  8566. if (maybeMK) {
  8567. dict.set("MK", maybeMK);
  8568. }
  8569. const encrypt = xref.encrypt;
  8570. const originalTransform = encrypt ? encrypt.createCipherTransform(this.ref.num, this.ref.gen) : null;
  8571. const buffer = [];
  8572. const changes = [{
  8573. ref: this.ref,
  8574. data: "",
  8575. xfa,
  8576. needAppearances
  8577. }];
  8578. if (appearance !== null) {
  8579. const newRef = xref.getNewTemporaryRef();
  8580. const AP = new _primitives.Dict(xref);
  8581. dict.set("AP", AP);
  8582. AP.set("N", newRef);
  8583. let newTransform = null;
  8584. if (encrypt) {
  8585. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  8586. appearance = newTransform.encryptString(appearance);
  8587. }
  8588. const resources = this._getSaveFieldResources(xref);
  8589. const appearanceStream = new _stream.StringStream(appearance);
  8590. const appearanceDict = appearanceStream.dict = new _primitives.Dict(xref);
  8591. appearanceDict.set("Length", appearance.length);
  8592. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  8593. appearanceDict.set("Resources", resources);
  8594. appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]);
  8595. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  8596. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  8597. appearanceDict.set("Matrix", rotationMatrix);
  8598. }
  8599. (0, _writer.writeObject)(newRef, appearanceStream, buffer, newTransform);
  8600. changes.push({
  8601. ref: newRef,
  8602. data: buffer.join(""),
  8603. xfa: null,
  8604. needAppearances: false
  8605. });
  8606. buffer.length = 0;
  8607. }
  8608. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  8609. (0, _writer.writeObject)(this.ref, dict, buffer, originalTransform);
  8610. changes[0].data = buffer.join("");
  8611. return changes;
  8612. }
  8613. async _getAppearance(evaluator, task, intent, annotationStorage) {
  8614. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  8615. if (isPassword) {
  8616. return null;
  8617. }
  8618. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8619. let value, rotation;
  8620. if (storageEntry) {
  8621. value = storageEntry.formattedValue || storageEntry.value;
  8622. rotation = storageEntry.rotation;
  8623. }
  8624. if (rotation === undefined && value === undefined && !this._needAppearances) {
  8625. if (!this._hasValueFromXFA || this.appearance) {
  8626. return null;
  8627. }
  8628. }
  8629. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8630. if (value === undefined) {
  8631. value = this.data.fieldValue;
  8632. if (!value) {
  8633. return `/Tx BMC q ${colors}Q EMC`;
  8634. }
  8635. }
  8636. if (Array.isArray(value) && value.length === 1) {
  8637. value = value[0];
  8638. }
  8639. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  8640. if (!this.data.combo) {
  8641. value = value.trim();
  8642. } else {
  8643. const option = this.data.options.find(_ref3 => {
  8644. let {
  8645. exportValue
  8646. } = _ref3;
  8647. return value === exportValue;
  8648. }) || this.data.options[0];
  8649. value = option && option.displayValue || "";
  8650. }
  8651. if (value === "") {
  8652. return `/Tx BMC q ${colors}Q EMC`;
  8653. }
  8654. if (rotation === undefined) {
  8655. rotation = this.rotation;
  8656. }
  8657. let lineCount = -1;
  8658. let lines;
  8659. if (this.data.multiLine) {
  8660. lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
  8661. lineCount = lines.length;
  8662. } else {
  8663. lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
  8664. }
  8665. const defaultPadding = 1;
  8666. const defaultHPadding = 2;
  8667. let totalHeight = this.data.rect[3] - this.data.rect[1];
  8668. let totalWidth = this.data.rect[2] - this.data.rect[0];
  8669. if (rotation === 90 || rotation === 270) {
  8670. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  8671. }
  8672. if (!this._defaultAppearance) {
  8673. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  8674. }
  8675. let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  8676. let defaultAppearance, fontSize, lineHeight;
  8677. const encodedLines = [];
  8678. let encodingError = false;
  8679. for (const line of lines) {
  8680. const encodedString = font.encodeString(line);
  8681. if (encodedString.length > 1) {
  8682. encodingError = true;
  8683. }
  8684. encodedLines.push(encodedString.join(""));
  8685. }
  8686. if (encodingError && intent & _util.RenderingIntentFlag.SAVE) {
  8687. return {
  8688. needAppearances: true
  8689. };
  8690. }
  8691. if (encodingError && this._isOffscreenCanvasSupported) {
  8692. const fontFamily = this.data.comb ? "monospace" : "sans-serif";
  8693. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(evaluator.xref, fontFamily);
  8694. const resources = fakeUnicodeFont.createFontResources(lines.join(""));
  8695. const newFont = resources.getRaw("Font");
  8696. if (this._fieldResources.mergedResources.has("Font")) {
  8697. const oldFont = this._fieldResources.mergedResources.get("Font");
  8698. for (const key of newFont.getKeys()) {
  8699. oldFont.set(key, newFont.getRaw(key));
  8700. }
  8701. } else {
  8702. this._fieldResources.mergedResources.set("Font", newFont);
  8703. }
  8704. const fontName = fakeUnicodeFont.fontName.name;
  8705. font = await WidgetAnnotation._getFontData(evaluator, task, {
  8706. fontName,
  8707. fontSize: 0
  8708. }, resources);
  8709. for (let i = 0, ii = encodedLines.length; i < ii; i++) {
  8710. encodedLines[i] = (0, _core_utils.stringToUTF16String)(lines[i]);
  8711. }
  8712. const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
  8713. this.data.defaultAppearanceData.fontSize = 0;
  8714. this.data.defaultAppearanceData.fontName = fontName;
  8715. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  8716. this.data.defaultAppearanceData = savedDefaultAppearance;
  8717. } else {
  8718. if (!this._isOffscreenCanvasSupported) {
  8719. (0, _util.warn)("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
  8720. }
  8721. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  8722. }
  8723. let descent = font.descent;
  8724. if (isNaN(descent)) {
  8725. descent = _util.BASELINE_FACTOR * lineHeight;
  8726. } else {
  8727. descent = Math.max(_util.BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
  8728. }
  8729. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  8730. const alignment = this.data.textAlignment;
  8731. if (this.data.multiLine) {
  8732. return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  8733. }
  8734. if (this.data.comb) {
  8735. return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  8736. }
  8737. const bottomPadding = defaultVPadding + descent;
  8738. if (alignment === 0 || alignment > 2) {
  8739. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(defaultHPadding)} ${(0, _core_utils.numberToString)(bottomPadding)} Tm (${(0, _core_utils.escapeString)(encodedLines[0])}) Tj` + " ET Q EMC";
  8740. }
  8741. const prevInfo = {
  8742. shift: 0
  8743. };
  8744. const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
  8745. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  8746. }
  8747. static async _getFontData(evaluator, task, appearanceData, resources) {
  8748. const operatorList = new _operator_list.OperatorList();
  8749. const initialState = {
  8750. font: null,
  8751. clone() {
  8752. return this;
  8753. }
  8754. };
  8755. const {
  8756. fontName,
  8757. fontSize
  8758. } = appearanceData;
  8759. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  8760. return initialState.font;
  8761. }
  8762. _getTextWidth(text, font) {
  8763. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  8764. }
  8765. _computeFontSize(height, width, text, font, lineCount) {
  8766. let {
  8767. fontSize
  8768. } = this.data.defaultAppearanceData;
  8769. let lineHeight = (fontSize || 12) * _util.LINE_FACTOR,
  8770. numberOfLines = Math.round(height / lineHeight);
  8771. if (!fontSize) {
  8772. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  8773. if (lineCount === -1) {
  8774. const textWidth = this._getTextWidth(text, font);
  8775. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, textWidth > width ? width / textWidth : Infinity));
  8776. numberOfLines = 1;
  8777. } else {
  8778. const lines = text.split(/\r\n?|\n/);
  8779. const cachedLines = [];
  8780. for (const line of lines) {
  8781. const encoded = font.encodeString(line).join("");
  8782. const glyphs = font.charsToGlyphs(encoded);
  8783. const positions = font.getCharPositions(encoded);
  8784. cachedLines.push({
  8785. line: encoded,
  8786. glyphs,
  8787. positions
  8788. });
  8789. }
  8790. const isTooBig = fsize => {
  8791. let totalHeight = 0;
  8792. for (const cache of cachedLines) {
  8793. const chunks = this._splitLine(null, font, fsize, width, cache);
  8794. totalHeight += chunks.length * fsize;
  8795. if (totalHeight > height) {
  8796. return true;
  8797. }
  8798. }
  8799. return false;
  8800. };
  8801. numberOfLines = Math.max(numberOfLines, lineCount);
  8802. while (true) {
  8803. lineHeight = height / numberOfLines;
  8804. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  8805. if (isTooBig(fontSize)) {
  8806. numberOfLines++;
  8807. continue;
  8808. }
  8809. break;
  8810. }
  8811. }
  8812. const {
  8813. fontName,
  8814. fontColor
  8815. } = this.data.defaultAppearanceData;
  8816. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  8817. fontSize,
  8818. fontName,
  8819. fontColor
  8820. });
  8821. }
  8822. return [this._defaultAppearance, fontSize, height / numberOfLines];
  8823. }
  8824. _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
  8825. let shift;
  8826. if (alignment === 1) {
  8827. const width = this._getTextWidth(text, font) * fontSize;
  8828. shift = (totalWidth - width) / 2;
  8829. } else if (alignment === 2) {
  8830. const width = this._getTextWidth(text, font) * fontSize;
  8831. shift = totalWidth - width - hPadding;
  8832. } else {
  8833. shift = hPadding;
  8834. }
  8835. const shiftStr = (0, _core_utils.numberToString)(shift - prevInfo.shift);
  8836. prevInfo.shift = shift;
  8837. vPadding = (0, _core_utils.numberToString)(vPadding);
  8838. return `${shiftStr} ${vPadding} Td (${(0, _core_utils.escapeString)(text)}) Tj`;
  8839. }
  8840. _getSaveFieldResources(xref) {
  8841. const {
  8842. localResources,
  8843. appearanceResources,
  8844. acroFormResources
  8845. } = this._fieldResources;
  8846. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  8847. if (!fontName) {
  8848. return localResources || _primitives.Dict.empty;
  8849. }
  8850. for (const resources of [localResources, appearanceResources]) {
  8851. if (resources instanceof _primitives.Dict) {
  8852. const localFont = resources.get("Font");
  8853. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  8854. return resources;
  8855. }
  8856. }
  8857. }
  8858. if (acroFormResources instanceof _primitives.Dict) {
  8859. const acroFormFont = acroFormResources.get("Font");
  8860. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  8861. const subFontDict = new _primitives.Dict(xref);
  8862. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  8863. const subResourcesDict = new _primitives.Dict(xref);
  8864. subResourcesDict.set("Font", subFontDict);
  8865. return _primitives.Dict.merge({
  8866. xref,
  8867. dictArray: [subResourcesDict, localResources],
  8868. mergeSubDicts: true
  8869. });
  8870. }
  8871. }
  8872. return localResources || _primitives.Dict.empty;
  8873. }
  8874. getFieldObject() {
  8875. return null;
  8876. }
  8877. }
  8878. class TextWidgetAnnotation extends WidgetAnnotation {
  8879. constructor(params) {
  8880. super(params);
  8881. this._hasText = true;
  8882. const dict = params.dict;
  8883. if (typeof this.data.fieldValue !== "string") {
  8884. this.data.fieldValue = "";
  8885. }
  8886. let alignment = (0, _core_utils.getInheritableProperty)({
  8887. dict,
  8888. key: "Q"
  8889. });
  8890. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  8891. alignment = null;
  8892. }
  8893. this.data.textAlignment = alignment;
  8894. let maximumLength = (0, _core_utils.getInheritableProperty)({
  8895. dict,
  8896. key: "MaxLen"
  8897. });
  8898. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  8899. maximumLength = 0;
  8900. }
  8901. this.data.maxLen = maximumLength;
  8902. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  8903. 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;
  8904. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  8905. }
  8906. _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  8907. const combWidth = width / this.data.maxLen;
  8908. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8909. const buf = [];
  8910. const positions = font.getCharPositions(text);
  8911. for (const [start, end] of positions) {
  8912. buf.push(`(${(0, _core_utils.escapeString)(text.substring(start, end))}) Tj`);
  8913. }
  8914. const renderedComb = buf.join(` ${(0, _core_utils.numberToString)(combWidth)} 0 Td `);
  8915. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(hPadding)} ${(0, _core_utils.numberToString)(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC";
  8916. }
  8917. _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  8918. const buf = [];
  8919. const totalWidth = width - 2 * hPadding;
  8920. const prevInfo = {
  8921. shift: 0
  8922. };
  8923. for (let i = 0, ii = lines.length; i < ii; i++) {
  8924. const line = lines[i];
  8925. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  8926. for (let j = 0, jj = chunks.length; j < jj; j++) {
  8927. const chunk = chunks[j];
  8928. const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
  8929. buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
  8930. }
  8931. }
  8932. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8933. const renderedText = buf.join("\n");
  8934. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${(0, _core_utils.numberToString)(height)} Tm ${renderedText}` + " ET Q EMC";
  8935. }
  8936. _splitLine(line, font, fontSize, width) {
  8937. let cache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  8938. line = cache.line || line;
  8939. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  8940. if (glyphs.length <= 1) {
  8941. return [line];
  8942. }
  8943. const positions = cache.positions || font.getCharPositions(line);
  8944. const scale = fontSize / 1000;
  8945. const chunks = [];
  8946. let lastSpacePosInStringStart = -1,
  8947. lastSpacePosInStringEnd = -1,
  8948. lastSpacePos = -1,
  8949. startChunk = 0,
  8950. currentWidth = 0;
  8951. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  8952. const [start, end] = positions[i];
  8953. const glyph = glyphs[i];
  8954. const glyphWidth = glyph.width * scale;
  8955. if (glyph.unicode === " ") {
  8956. if (currentWidth + glyphWidth > width) {
  8957. chunks.push(line.substring(startChunk, start));
  8958. startChunk = start;
  8959. currentWidth = glyphWidth;
  8960. lastSpacePosInStringStart = -1;
  8961. lastSpacePos = -1;
  8962. } else {
  8963. currentWidth += glyphWidth;
  8964. lastSpacePosInStringStart = start;
  8965. lastSpacePosInStringEnd = end;
  8966. lastSpacePos = i;
  8967. }
  8968. } else {
  8969. if (currentWidth + glyphWidth > width) {
  8970. if (lastSpacePosInStringStart !== -1) {
  8971. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  8972. startChunk = lastSpacePosInStringEnd;
  8973. i = lastSpacePos + 1;
  8974. lastSpacePosInStringStart = -1;
  8975. currentWidth = 0;
  8976. } else {
  8977. chunks.push(line.substring(startChunk, start));
  8978. startChunk = start;
  8979. currentWidth = glyphWidth;
  8980. }
  8981. } else {
  8982. currentWidth += glyphWidth;
  8983. }
  8984. }
  8985. }
  8986. if (startChunk < line.length) {
  8987. chunks.push(line.substring(startChunk, line.length));
  8988. }
  8989. return chunks;
  8990. }
  8991. getFieldObject() {
  8992. return {
  8993. id: this.data.id,
  8994. value: this.data.fieldValue,
  8995. defaultValue: this.data.defaultFieldValue || "",
  8996. multiline: this.data.multiLine,
  8997. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  8998. charLimit: this.data.maxLen,
  8999. comb: this.data.comb,
  9000. editable: !this.data.readOnly,
  9001. hidden: this.data.hidden,
  9002. name: this.data.fieldName,
  9003. rect: this.data.rect,
  9004. actions: this.data.actions,
  9005. page: this.data.pageIndex,
  9006. strokeColor: this.data.borderColor,
  9007. fillColor: this.data.backgroundColor,
  9008. rotation: this.rotation,
  9009. type: "text"
  9010. };
  9011. }
  9012. }
  9013. class ButtonWidgetAnnotation extends WidgetAnnotation {
  9014. constructor(params) {
  9015. super(params);
  9016. this.checkedAppearance = null;
  9017. this.uncheckedAppearance = null;
  9018. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  9019. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  9020. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  9021. this.data.isTooltipOnly = false;
  9022. if (this.data.checkBox) {
  9023. this._processCheckBox(params);
  9024. } else if (this.data.radioButton) {
  9025. this._processRadioButton(params);
  9026. } else if (this.data.pushButton) {
  9027. this.data.hasOwnCanvas = true;
  9028. this._processPushButton(params);
  9029. } else {
  9030. (0, _util.warn)("Invalid field flags for button widget annotation");
  9031. }
  9032. }
  9033. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  9034. if (this.data.pushButton) {
  9035. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  9036. }
  9037. let value = null;
  9038. let rotation = null;
  9039. if (annotationStorage) {
  9040. const storageEntry = annotationStorage.get(this.data.id);
  9041. value = storageEntry ? storageEntry.value : null;
  9042. rotation = storageEntry ? storageEntry.rotation : null;
  9043. }
  9044. if (value === null && this.appearance) {
  9045. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  9046. }
  9047. if (value === null || value === undefined) {
  9048. if (this.data.checkBox) {
  9049. value = this.data.fieldValue === this.data.exportValue;
  9050. } else {
  9051. value = this.data.fieldValue === this.data.buttonValue;
  9052. }
  9053. }
  9054. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  9055. if (appearance) {
  9056. const savedAppearance = this.appearance;
  9057. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  9058. if (rotation) {
  9059. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  9060. }
  9061. this.appearance = appearance;
  9062. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  9063. this.appearance = savedAppearance;
  9064. appearance.dict.set("Matrix", savedMatrix);
  9065. return operatorList;
  9066. }
  9067. return {
  9068. opList: new _operator_list.OperatorList(),
  9069. separateForm: false,
  9070. separateCanvas: false
  9071. };
  9072. }
  9073. async save(evaluator, task, annotationStorage) {
  9074. if (this.data.checkBox) {
  9075. return this._saveCheckbox(evaluator, task, annotationStorage);
  9076. }
  9077. if (this.data.radioButton) {
  9078. return this._saveRadioButton(evaluator, task, annotationStorage);
  9079. }
  9080. return null;
  9081. }
  9082. async _saveCheckbox(evaluator, task, annotationStorage) {
  9083. if (!annotationStorage) {
  9084. return null;
  9085. }
  9086. const storageEntry = annotationStorage.get(this.data.id);
  9087. let rotation = storageEntry && storageEntry.rotation;
  9088. let value = storageEntry && storageEntry.value;
  9089. if (rotation === undefined) {
  9090. if (value === undefined) {
  9091. return null;
  9092. }
  9093. const defaultValue = this.data.fieldValue === this.data.exportValue;
  9094. if (defaultValue === value) {
  9095. return null;
  9096. }
  9097. }
  9098. const dict = evaluator.xref.fetchIfRef(this.ref);
  9099. if (!(dict instanceof _primitives.Dict)) {
  9100. return null;
  9101. }
  9102. if (rotation === undefined) {
  9103. rotation = this.rotation;
  9104. }
  9105. if (value === undefined) {
  9106. value = this.data.fieldValue === this.data.exportValue;
  9107. }
  9108. const xfa = {
  9109. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  9110. value: value ? this.data.exportValue : ""
  9111. };
  9112. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  9113. dict.set("V", name);
  9114. dict.set("AS", name);
  9115. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  9116. const maybeMK = this._getMKDict(rotation);
  9117. if (maybeMK) {
  9118. dict.set("MK", maybeMK);
  9119. }
  9120. const encrypt = evaluator.xref.encrypt;
  9121. let originalTransform = null;
  9122. if (encrypt) {
  9123. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  9124. }
  9125. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  9126. (0, _writer.writeDict)(dict, buffer, originalTransform);
  9127. buffer.push("\nendobj\n");
  9128. return [{
  9129. ref: this.ref,
  9130. data: buffer.join(""),
  9131. xfa
  9132. }];
  9133. }
  9134. async _saveRadioButton(evaluator, task, annotationStorage) {
  9135. if (!annotationStorage) {
  9136. return null;
  9137. }
  9138. const storageEntry = annotationStorage.get(this.data.id);
  9139. let rotation = storageEntry && storageEntry.rotation;
  9140. let value = storageEntry && storageEntry.value;
  9141. if (rotation === undefined) {
  9142. if (value === undefined) {
  9143. return null;
  9144. }
  9145. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  9146. if (defaultValue === value) {
  9147. return null;
  9148. }
  9149. }
  9150. const dict = evaluator.xref.fetchIfRef(this.ref);
  9151. if (!(dict instanceof _primitives.Dict)) {
  9152. return null;
  9153. }
  9154. if (value === undefined) {
  9155. value = this.data.fieldValue === this.data.buttonValue;
  9156. }
  9157. if (rotation === undefined) {
  9158. rotation = this.rotation;
  9159. }
  9160. const xfa = {
  9161. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  9162. value: value ? this.data.buttonValue : ""
  9163. };
  9164. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  9165. let parentBuffer = null;
  9166. const encrypt = evaluator.xref.encrypt;
  9167. if (value) {
  9168. if (this.parent instanceof _primitives.Ref) {
  9169. const parent = evaluator.xref.fetch(this.parent);
  9170. let parentTransform = null;
  9171. if (encrypt) {
  9172. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  9173. }
  9174. parent.set("V", name);
  9175. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  9176. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  9177. parentBuffer.push("\nendobj\n");
  9178. } else if (this.parent instanceof _primitives.Dict) {
  9179. this.parent.set("V", name);
  9180. }
  9181. }
  9182. dict.set("AS", name);
  9183. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  9184. const maybeMK = this._getMKDict(rotation);
  9185. if (maybeMK) {
  9186. dict.set("MK", maybeMK);
  9187. }
  9188. let originalTransform = null;
  9189. if (encrypt) {
  9190. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  9191. }
  9192. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  9193. (0, _writer.writeDict)(dict, buffer, originalTransform);
  9194. buffer.push("\nendobj\n");
  9195. const newRefs = [{
  9196. ref: this.ref,
  9197. data: buffer.join(""),
  9198. xfa
  9199. }];
  9200. if (parentBuffer !== null) {
  9201. newRefs.push({
  9202. ref: this.parent,
  9203. data: parentBuffer.join(""),
  9204. xfa: null
  9205. });
  9206. }
  9207. return newRefs;
  9208. }
  9209. _getDefaultCheckedAppearance(params, type) {
  9210. const width = this.data.rect[2] - this.data.rect[0];
  9211. const height = this.data.rect[3] - this.data.rect[1];
  9212. const bbox = [0, 0, width, height];
  9213. const FONT_RATIO = 0.8;
  9214. const fontSize = Math.min(width, height) * FONT_RATIO;
  9215. let metrics, char;
  9216. if (type === "check") {
  9217. metrics = {
  9218. width: 0.755 * fontSize,
  9219. height: 0.705 * fontSize
  9220. };
  9221. char = "\x33";
  9222. } else if (type === "disc") {
  9223. metrics = {
  9224. width: 0.791 * fontSize,
  9225. height: 0.705 * fontSize
  9226. };
  9227. char = "\x6C";
  9228. } else {
  9229. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  9230. }
  9231. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  9232. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  9233. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  9234. const appearanceStreamDict = new _primitives.Dict(params.xref);
  9235. appearanceStreamDict.set("FormType", 1);
  9236. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9237. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9238. appearanceStreamDict.set("BBox", bbox);
  9239. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  9240. appearanceStreamDict.set("Length", appearance.length);
  9241. const resources = new _primitives.Dict(params.xref);
  9242. const font = new _primitives.Dict(params.xref);
  9243. font.set("PdfJsZaDb", this.fallbackFontDict);
  9244. resources.set("Font", font);
  9245. appearanceStreamDict.set("Resources", resources);
  9246. this.checkedAppearance = new _stream.StringStream(appearance);
  9247. this.checkedAppearance.dict = appearanceStreamDict;
  9248. this._streams.push(this.checkedAppearance);
  9249. }
  9250. _processCheckBox(params) {
  9251. const customAppearance = params.dict.get("AP");
  9252. if (!(customAppearance instanceof _primitives.Dict)) {
  9253. return;
  9254. }
  9255. const normalAppearance = customAppearance.get("N");
  9256. if (!(normalAppearance instanceof _primitives.Dict)) {
  9257. return;
  9258. }
  9259. const asValue = this._decodeFormValue(params.dict.get("AS"));
  9260. if (typeof asValue === "string") {
  9261. this.data.fieldValue = asValue;
  9262. }
  9263. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  9264. const exportValues = normalAppearance.getKeys();
  9265. if (exportValues.length === 0) {
  9266. exportValues.push("Off", yes);
  9267. } else if (exportValues.length === 1) {
  9268. if (exportValues[0] === "Off") {
  9269. exportValues.push(yes);
  9270. } else {
  9271. exportValues.unshift("Off");
  9272. }
  9273. } else if (exportValues.includes(yes)) {
  9274. exportValues.length = 0;
  9275. exportValues.push("Off", yes);
  9276. } else {
  9277. const otherYes = exportValues.find(v => v !== "Off");
  9278. exportValues.length = 0;
  9279. exportValues.push("Off", otherYes);
  9280. }
  9281. if (!exportValues.includes(this.data.fieldValue)) {
  9282. this.data.fieldValue = "Off";
  9283. }
  9284. this.data.exportValue = exportValues[1];
  9285. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  9286. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  9287. if (this.checkedAppearance) {
  9288. this._streams.push(this.checkedAppearance);
  9289. } else {
  9290. this._getDefaultCheckedAppearance(params, "check");
  9291. }
  9292. if (this.uncheckedAppearance) {
  9293. this._streams.push(this.uncheckedAppearance);
  9294. }
  9295. this._fallbackFontDict = this.fallbackFontDict;
  9296. }
  9297. _processRadioButton(params) {
  9298. this.data.fieldValue = this.data.buttonValue = null;
  9299. const fieldParent = params.dict.get("Parent");
  9300. if (fieldParent instanceof _primitives.Dict) {
  9301. this.parent = params.dict.getRaw("Parent");
  9302. const fieldParentValue = fieldParent.get("V");
  9303. if (fieldParentValue instanceof _primitives.Name) {
  9304. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  9305. }
  9306. }
  9307. const appearanceStates = params.dict.get("AP");
  9308. if (!(appearanceStates instanceof _primitives.Dict)) {
  9309. return;
  9310. }
  9311. const normalAppearance = appearanceStates.get("N");
  9312. if (!(normalAppearance instanceof _primitives.Dict)) {
  9313. return;
  9314. }
  9315. for (const key of normalAppearance.getKeys()) {
  9316. if (key !== "Off") {
  9317. this.data.buttonValue = this._decodeFormValue(key);
  9318. break;
  9319. }
  9320. }
  9321. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  9322. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  9323. if (this.checkedAppearance) {
  9324. this._streams.push(this.checkedAppearance);
  9325. } else {
  9326. this._getDefaultCheckedAppearance(params, "disc");
  9327. }
  9328. if (this.uncheckedAppearance) {
  9329. this._streams.push(this.uncheckedAppearance);
  9330. }
  9331. this._fallbackFontDict = this.fallbackFontDict;
  9332. }
  9333. _processPushButton(params) {
  9334. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  9335. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  9336. return;
  9337. }
  9338. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  9339. _catalog.Catalog.parseDestDictionary({
  9340. destDict: params.dict,
  9341. resultObj: this.data,
  9342. docBaseUrl: params.pdfManager.docBaseUrl,
  9343. docAttachments: params.attachments
  9344. });
  9345. }
  9346. getFieldObject() {
  9347. let type = "button";
  9348. let exportValues;
  9349. if (this.data.checkBox) {
  9350. type = "checkbox";
  9351. exportValues = this.data.exportValue;
  9352. } else if (this.data.radioButton) {
  9353. type = "radiobutton";
  9354. exportValues = this.data.buttonValue;
  9355. }
  9356. return {
  9357. id: this.data.id,
  9358. value: this.data.fieldValue || "Off",
  9359. defaultValue: this.data.defaultFieldValue,
  9360. exportValues,
  9361. editable: !this.data.readOnly,
  9362. name: this.data.fieldName,
  9363. rect: this.data.rect,
  9364. hidden: this.data.hidden,
  9365. actions: this.data.actions,
  9366. page: this.data.pageIndex,
  9367. strokeColor: this.data.borderColor,
  9368. fillColor: this.data.backgroundColor,
  9369. rotation: this.rotation,
  9370. type
  9371. };
  9372. }
  9373. get fallbackFontDict() {
  9374. const dict = new _primitives.Dict();
  9375. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  9376. dict.set("Type", _primitives.Name.get("FallbackType"));
  9377. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  9378. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  9379. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  9380. }
  9381. }
  9382. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  9383. constructor(params) {
  9384. super(params);
  9385. const {
  9386. dict,
  9387. xref
  9388. } = params;
  9389. this.data.options = [];
  9390. const options = (0, _core_utils.getInheritableProperty)({
  9391. dict,
  9392. key: "Opt"
  9393. });
  9394. if (Array.isArray(options)) {
  9395. for (let i = 0, ii = options.length; i < ii; i++) {
  9396. const option = xref.fetchIfRef(options[i]);
  9397. const isOptionArray = Array.isArray(option);
  9398. this.data.options[i] = {
  9399. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  9400. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  9401. };
  9402. }
  9403. }
  9404. if (typeof this.data.fieldValue === "string") {
  9405. this.data.fieldValue = [this.data.fieldValue];
  9406. } else if (!this.data.fieldValue) {
  9407. this.data.fieldValue = [];
  9408. }
  9409. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  9410. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  9411. this._hasText = true;
  9412. }
  9413. getFieldObject() {
  9414. const type = this.data.combo ? "combobox" : "listbox";
  9415. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  9416. return {
  9417. id: this.data.id,
  9418. value,
  9419. defaultValue: this.data.defaultFieldValue,
  9420. editable: !this.data.readOnly,
  9421. name: this.data.fieldName,
  9422. rect: this.data.rect,
  9423. numItems: this.data.fieldValue.length,
  9424. multipleSelection: this.data.multiSelect,
  9425. hidden: this.data.hidden,
  9426. actions: this.data.actions,
  9427. items: this.data.options,
  9428. page: this.data.pageIndex,
  9429. strokeColor: this.data.borderColor,
  9430. fillColor: this.data.backgroundColor,
  9431. rotation: this.rotation,
  9432. type
  9433. };
  9434. }
  9435. async _getAppearance(evaluator, task, intent, annotationStorage) {
  9436. if (this.data.combo) {
  9437. return super._getAppearance(evaluator, task, intent, annotationStorage);
  9438. }
  9439. let exportedValue, rotation;
  9440. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  9441. if (storageEntry) {
  9442. rotation = storageEntry.rotation;
  9443. exportedValue = storageEntry.value;
  9444. }
  9445. if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
  9446. return null;
  9447. }
  9448. if (exportedValue === undefined) {
  9449. exportedValue = this.data.fieldValue;
  9450. } else if (!Array.isArray(exportedValue)) {
  9451. exportedValue = [exportedValue];
  9452. }
  9453. const defaultPadding = 1;
  9454. const defaultHPadding = 2;
  9455. let totalHeight = this.data.rect[3] - this.data.rect[1];
  9456. let totalWidth = this.data.rect[2] - this.data.rect[0];
  9457. if (rotation === 90 || rotation === 270) {
  9458. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  9459. }
  9460. const lineCount = this.data.options.length;
  9461. const valueIndices = [];
  9462. for (let i = 0; i < lineCount; i++) {
  9463. const {
  9464. exportValue
  9465. } = this.data.options[i];
  9466. if (exportedValue.includes(exportValue)) {
  9467. valueIndices.push(i);
  9468. }
  9469. }
  9470. if (!this._defaultAppearance) {
  9471. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  9472. }
  9473. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  9474. let defaultAppearance;
  9475. let {
  9476. fontSize
  9477. } = this.data.defaultAppearanceData;
  9478. if (!fontSize) {
  9479. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  9480. let lineWidth = -1;
  9481. let value;
  9482. for (const {
  9483. displayValue
  9484. } of this.data.options) {
  9485. const width = this._getTextWidth(displayValue, font);
  9486. if (width > lineWidth) {
  9487. lineWidth = width;
  9488. value = displayValue;
  9489. }
  9490. }
  9491. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
  9492. } else {
  9493. defaultAppearance = this._defaultAppearance;
  9494. }
  9495. const lineHeight = fontSize * _util.LINE_FACTOR;
  9496. const vPadding = (lineHeight - fontSize) / 2;
  9497. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  9498. let firstIndex;
  9499. if (valueIndices.length === 1) {
  9500. const valuePosition = valueIndices[0];
  9501. const indexInPage = valuePosition % numberOfVisibleLines;
  9502. firstIndex = valuePosition - indexInPage;
  9503. } else {
  9504. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  9505. }
  9506. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  9507. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  9508. if (valueIndices.length) {
  9509. buf.push("0.600006 0.756866 0.854904 rg");
  9510. for (const index of valueIndices) {
  9511. if (firstIndex <= index && index < end) {
  9512. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  9513. }
  9514. }
  9515. }
  9516. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  9517. const prevInfo = {
  9518. shift: 0
  9519. };
  9520. for (let i = firstIndex; i < end; i++) {
  9521. const {
  9522. displayValue
  9523. } = this.data.options[i];
  9524. const vpadding = i === firstIndex ? vPadding : 0;
  9525. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
  9526. }
  9527. buf.push("ET Q EMC");
  9528. return buf.join("\n");
  9529. }
  9530. }
  9531. class SignatureWidgetAnnotation extends WidgetAnnotation {
  9532. constructor(params) {
  9533. super(params);
  9534. this.data.fieldValue = null;
  9535. }
  9536. getFieldObject() {
  9537. return {
  9538. id: this.data.id,
  9539. value: null,
  9540. page: this.data.pageIndex,
  9541. type: "signature"
  9542. };
  9543. }
  9544. }
  9545. class TextAnnotation extends MarkupAnnotation {
  9546. constructor(params) {
  9547. const DEFAULT_ICON_SIZE = 22;
  9548. super(params);
  9549. const {
  9550. dict
  9551. } = params;
  9552. this.data.annotationType = _util.AnnotationType.TEXT;
  9553. if (this.data.hasAppearance) {
  9554. this.data.name = "NoIcon";
  9555. } else {
  9556. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  9557. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  9558. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  9559. }
  9560. if (dict.has("State")) {
  9561. this.data.state = dict.get("State") || null;
  9562. this.data.stateModel = dict.get("StateModel") || null;
  9563. } else {
  9564. this.data.state = null;
  9565. this.data.stateModel = null;
  9566. }
  9567. }
  9568. }
  9569. class LinkAnnotation extends Annotation {
  9570. constructor(params) {
  9571. super(params);
  9572. this.data.annotationType = _util.AnnotationType.LINK;
  9573. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  9574. if (quadPoints) {
  9575. this.data.quadPoints = quadPoints;
  9576. }
  9577. this.data.borderColor = this.data.borderColor || this.data.color;
  9578. _catalog.Catalog.parseDestDictionary({
  9579. destDict: params.dict,
  9580. resultObj: this.data,
  9581. docBaseUrl: params.pdfManager.docBaseUrl,
  9582. docAttachments: params.attachments
  9583. });
  9584. }
  9585. }
  9586. class PopupAnnotation extends Annotation {
  9587. constructor(params) {
  9588. super(params);
  9589. const {
  9590. dict
  9591. } = params;
  9592. this.data.annotationType = _util.AnnotationType.POPUP;
  9593. let parentItem = dict.get("Parent");
  9594. if (!parentItem) {
  9595. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  9596. return;
  9597. }
  9598. const parentSubtype = parentItem.get("Subtype");
  9599. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  9600. const rawParent = dict.getRaw("Parent");
  9601. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  9602. const parentRect = parentItem.getArray("Rect");
  9603. if (Array.isArray(parentRect) && parentRect.length === 4) {
  9604. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  9605. } else {
  9606. this.data.parentRect = [0, 0, 0, 0];
  9607. }
  9608. const rt = parentItem.get("RT");
  9609. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  9610. parentItem = parentItem.get("IRT");
  9611. }
  9612. if (!parentItem.has("M")) {
  9613. this.data.modificationDate = null;
  9614. } else {
  9615. this.setModificationDate(parentItem.get("M"));
  9616. this.data.modificationDate = this.modificationDate;
  9617. }
  9618. if (!parentItem.has("C")) {
  9619. this.data.color = null;
  9620. } else {
  9621. this.setColor(parentItem.getArray("C"));
  9622. this.data.color = this.color;
  9623. }
  9624. if (!this.viewable) {
  9625. const parentFlags = parentItem.get("F");
  9626. if (this._isViewable(parentFlags)) {
  9627. this.setFlags(parentFlags);
  9628. }
  9629. }
  9630. this.setTitle(parentItem.get("T"));
  9631. this.data.titleObj = this._title;
  9632. this.setContents(parentItem.get("Contents"));
  9633. this.data.contentsObj = this._contents;
  9634. if (parentItem.has("RC")) {
  9635. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  9636. }
  9637. }
  9638. }
  9639. exports.PopupAnnotation = PopupAnnotation;
  9640. class FreeTextAnnotation extends MarkupAnnotation {
  9641. constructor(params) {
  9642. super(params);
  9643. const {
  9644. xref
  9645. } = params;
  9646. this.data.annotationType = _util.AnnotationType.FREETEXT;
  9647. this.setDefaultAppearance(params);
  9648. if (!this.appearance && this._isOffscreenCanvasSupported) {
  9649. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(xref, "sans-serif");
  9650. const fontData = this.data.defaultAppearanceData;
  9651. this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontData.fontSize || 10, fontData.fontColor);
  9652. this._streams.push(this.appearance, _default_appearance.FakeUnicodeFont.toUnicodeStream);
  9653. } else if (!this._isOffscreenCanvasSupported) {
  9654. (0, _util.warn)("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
  9655. }
  9656. }
  9657. get hasTextContent() {
  9658. return !!this.appearance;
  9659. }
  9660. static createNewDict(annotation, xref, _ref4) {
  9661. let {
  9662. apRef,
  9663. ap
  9664. } = _ref4;
  9665. const {
  9666. color,
  9667. fontSize,
  9668. rect,
  9669. rotation,
  9670. user,
  9671. value
  9672. } = annotation;
  9673. const freetext = new _primitives.Dict(xref);
  9674. freetext.set("Type", _primitives.Name.get("Annot"));
  9675. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  9676. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  9677. freetext.set("Rect", rect);
  9678. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  9679. freetext.set("DA", da);
  9680. freetext.set("Contents", (0, _core_utils.isAscii)(value) ? value : (0, _core_utils.stringToUTF16String)(value, true));
  9681. freetext.set("F", 4);
  9682. freetext.set("Border", [0, 0, 0]);
  9683. freetext.set("Rotate", rotation);
  9684. if (user) {
  9685. freetext.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true));
  9686. }
  9687. if (apRef || ap) {
  9688. const n = new _primitives.Dict(xref);
  9689. freetext.set("AP", n);
  9690. if (apRef) {
  9691. n.set("N", apRef);
  9692. } else {
  9693. n.set("N", ap);
  9694. }
  9695. }
  9696. return freetext;
  9697. }
  9698. static async createNewAppearanceStream(annotation, xref, params) {
  9699. const {
  9700. baseFontRef,
  9701. evaluator,
  9702. task
  9703. } = params;
  9704. const {
  9705. color,
  9706. fontSize,
  9707. rect,
  9708. rotation,
  9709. value
  9710. } = annotation;
  9711. const resources = new _primitives.Dict(xref);
  9712. const font = new _primitives.Dict(xref);
  9713. if (baseFontRef) {
  9714. font.set("Helv", baseFontRef);
  9715. } else {
  9716. const baseFont = new _primitives.Dict(xref);
  9717. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  9718. baseFont.set("Type", _primitives.Name.get("Font"));
  9719. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  9720. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  9721. font.set("Helv", baseFont);
  9722. }
  9723. resources.set("Font", font);
  9724. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  9725. fontName: "Helvetica",
  9726. fontSize
  9727. }, resources);
  9728. const [x1, y1, x2, y2] = rect;
  9729. let w = x2 - x1;
  9730. let h = y2 - y1;
  9731. if (rotation % 180 !== 0) {
  9732. [w, h] = [h, w];
  9733. }
  9734. const lines = value.split("\n");
  9735. const scale = fontSize / 1000;
  9736. let totalWidth = -Infinity;
  9737. const encodedLines = [];
  9738. for (let line of lines) {
  9739. const encoded = helv.encodeString(line);
  9740. if (encoded.length > 1) {
  9741. return null;
  9742. }
  9743. line = encoded.join("");
  9744. encodedLines.push(line);
  9745. let lineWidth = 0;
  9746. const glyphs = helv.charsToGlyphs(line);
  9747. for (const glyph of glyphs) {
  9748. lineWidth += glyph.width * scale;
  9749. }
  9750. totalWidth = Math.max(totalWidth, lineWidth);
  9751. }
  9752. let hscale = 1;
  9753. if (totalWidth > w) {
  9754. hscale = w / totalWidth;
  9755. }
  9756. let vscale = 1;
  9757. const lineHeight = _util.LINE_FACTOR * fontSize;
  9758. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  9759. const totalHeight = lineHeight * lines.length;
  9760. if (totalHeight > h) {
  9761. vscale = h / totalHeight;
  9762. }
  9763. const fscale = Math.min(hscale, vscale);
  9764. const newFontSize = fontSize * fscale;
  9765. 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`];
  9766. const vShift = (0, _core_utils.numberToString)(lineHeight);
  9767. for (const line of encodedLines) {
  9768. buffer.push(`0 -${vShift} Td (${(0, _core_utils.escapeString)(line)}) Tj`);
  9769. }
  9770. buffer.push("ET", "Q");
  9771. const appearance = buffer.join("\n");
  9772. const appearanceStreamDict = new _primitives.Dict(xref);
  9773. appearanceStreamDict.set("FormType", 1);
  9774. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9775. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9776. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  9777. appearanceStreamDict.set("Length", appearance.length);
  9778. appearanceStreamDict.set("Resources", resources);
  9779. if (rotation) {
  9780. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  9781. appearanceStreamDict.set("Matrix", matrix);
  9782. }
  9783. const ap = new _stream.StringStream(appearance);
  9784. ap.dict = appearanceStreamDict;
  9785. return ap;
  9786. }
  9787. }
  9788. class LineAnnotation extends MarkupAnnotation {
  9789. constructor(params) {
  9790. super(params);
  9791. const {
  9792. dict,
  9793. xref
  9794. } = params;
  9795. this.data.annotationType = _util.AnnotationType.LINE;
  9796. const lineCoordinates = dict.getArray("L");
  9797. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  9798. this.setLineEndings(dict.getArray("LE"));
  9799. this.data.lineEndings = this.lineEndings;
  9800. if (!this.appearance) {
  9801. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9802. const strokeAlpha = dict.get("CA");
  9803. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  9804. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  9805. const fillAlpha = fillColor ? strokeAlpha : null;
  9806. const borderWidth = this.borderStyle.width || 1,
  9807. borderAdjust = 2 * borderWidth;
  9808. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  9809. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9810. this.rectangle = bbox;
  9811. }
  9812. this._setDefaultAppearance({
  9813. xref,
  9814. extra: `${borderWidth} w`,
  9815. strokeColor,
  9816. fillColor,
  9817. strokeAlpha,
  9818. fillAlpha,
  9819. pointsCallback: (buffer, points) => {
  9820. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  9821. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  9822. }
  9823. });
  9824. }
  9825. }
  9826. }
  9827. class SquareAnnotation extends MarkupAnnotation {
  9828. constructor(params) {
  9829. super(params);
  9830. const {
  9831. dict,
  9832. xref
  9833. } = params;
  9834. this.data.annotationType = _util.AnnotationType.SQUARE;
  9835. if (!this.appearance) {
  9836. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9837. const strokeAlpha = dict.get("CA");
  9838. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  9839. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  9840. const fillAlpha = fillColor ? strokeAlpha : null;
  9841. if (this.borderStyle.width === 0 && !fillColor) {
  9842. return;
  9843. }
  9844. this._setDefaultAppearance({
  9845. xref,
  9846. extra: `${this.borderStyle.width} w`,
  9847. strokeColor,
  9848. fillColor,
  9849. strokeAlpha,
  9850. fillAlpha,
  9851. pointsCallback: (buffer, points) => {
  9852. const x = points[2].x + this.borderStyle.width / 2;
  9853. const y = points[2].y + this.borderStyle.width / 2;
  9854. const width = points[3].x - points[2].x - this.borderStyle.width;
  9855. const height = points[1].y - points[3].y - this.borderStyle.width;
  9856. buffer.push(`${x} ${y} ${width} ${height} re`);
  9857. if (fillColor) {
  9858. buffer.push("B");
  9859. } else {
  9860. buffer.push("S");
  9861. }
  9862. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9863. }
  9864. });
  9865. }
  9866. }
  9867. }
  9868. class CircleAnnotation extends MarkupAnnotation {
  9869. constructor(params) {
  9870. super(params);
  9871. const {
  9872. dict,
  9873. xref
  9874. } = params;
  9875. this.data.annotationType = _util.AnnotationType.CIRCLE;
  9876. if (!this.appearance) {
  9877. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9878. const strokeAlpha = dict.get("CA");
  9879. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  9880. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  9881. const fillAlpha = fillColor ? strokeAlpha : null;
  9882. if (this.borderStyle.width === 0 && !fillColor) {
  9883. return;
  9884. }
  9885. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  9886. this._setDefaultAppearance({
  9887. xref,
  9888. extra: `${this.borderStyle.width} w`,
  9889. strokeColor,
  9890. fillColor,
  9891. strokeAlpha,
  9892. fillAlpha,
  9893. pointsCallback: (buffer, points) => {
  9894. const x0 = points[0].x + this.borderStyle.width / 2;
  9895. const y0 = points[0].y - this.borderStyle.width / 2;
  9896. const x1 = points[3].x - this.borderStyle.width / 2;
  9897. const y1 = points[3].y + this.borderStyle.width / 2;
  9898. const xMid = x0 + (x1 - x0) / 2;
  9899. const yMid = y0 + (y1 - y0) / 2;
  9900. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  9901. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  9902. 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");
  9903. if (fillColor) {
  9904. buffer.push("B");
  9905. } else {
  9906. buffer.push("S");
  9907. }
  9908. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9909. }
  9910. });
  9911. }
  9912. }
  9913. }
  9914. class PolylineAnnotation extends MarkupAnnotation {
  9915. constructor(params) {
  9916. super(params);
  9917. const {
  9918. dict,
  9919. xref
  9920. } = params;
  9921. this.data.annotationType = _util.AnnotationType.POLYLINE;
  9922. this.data.vertices = [];
  9923. if (!(this instanceof PolygonAnnotation)) {
  9924. this.setLineEndings(dict.getArray("LE"));
  9925. this.data.lineEndings = this.lineEndings;
  9926. }
  9927. const rawVertices = dict.getArray("Vertices");
  9928. if (!Array.isArray(rawVertices)) {
  9929. return;
  9930. }
  9931. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  9932. this.data.vertices.push({
  9933. x: rawVertices[i],
  9934. y: rawVertices[i + 1]
  9935. });
  9936. }
  9937. if (!this.appearance) {
  9938. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9939. const strokeAlpha = dict.get("CA");
  9940. const borderWidth = this.borderStyle.width || 1,
  9941. borderAdjust = 2 * borderWidth;
  9942. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  9943. for (const vertex of this.data.vertices) {
  9944. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  9945. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  9946. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  9947. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  9948. }
  9949. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9950. this.rectangle = bbox;
  9951. }
  9952. this._setDefaultAppearance({
  9953. xref,
  9954. extra: `${borderWidth} w`,
  9955. strokeColor,
  9956. strokeAlpha,
  9957. pointsCallback: (buffer, points) => {
  9958. const vertices = this.data.vertices;
  9959. for (let i = 0, ii = vertices.length; i < ii; i++) {
  9960. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  9961. }
  9962. buffer.push("S");
  9963. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9964. }
  9965. });
  9966. }
  9967. }
  9968. }
  9969. class PolygonAnnotation extends PolylineAnnotation {
  9970. constructor(params) {
  9971. super(params);
  9972. this.data.annotationType = _util.AnnotationType.POLYGON;
  9973. }
  9974. }
  9975. class CaretAnnotation extends MarkupAnnotation {
  9976. constructor(params) {
  9977. super(params);
  9978. this.data.annotationType = _util.AnnotationType.CARET;
  9979. }
  9980. }
  9981. class InkAnnotation extends MarkupAnnotation {
  9982. constructor(params) {
  9983. super(params);
  9984. const {
  9985. dict,
  9986. xref
  9987. } = params;
  9988. this.data.annotationType = _util.AnnotationType.INK;
  9989. this.data.inkLists = [];
  9990. const rawInkLists = dict.getArray("InkList");
  9991. if (!Array.isArray(rawInkLists)) {
  9992. return;
  9993. }
  9994. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  9995. this.data.inkLists.push([]);
  9996. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  9997. this.data.inkLists[i].push({
  9998. x: xref.fetchIfRef(rawInkLists[i][j]),
  9999. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  10000. });
  10001. }
  10002. }
  10003. if (!this.appearance) {
  10004. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10005. const strokeAlpha = dict.get("CA");
  10006. const borderWidth = this.borderStyle.width || 1,
  10007. borderAdjust = 2 * borderWidth;
  10008. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  10009. for (const inkLists of this.data.inkLists) {
  10010. for (const vertex of inkLists) {
  10011. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  10012. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  10013. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  10014. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  10015. }
  10016. }
  10017. if (!_util.Util.intersect(this.rectangle, bbox)) {
  10018. this.rectangle = bbox;
  10019. }
  10020. this._setDefaultAppearance({
  10021. xref,
  10022. extra: `${borderWidth} w`,
  10023. strokeColor,
  10024. strokeAlpha,
  10025. pointsCallback: (buffer, points) => {
  10026. for (const inkList of this.data.inkLists) {
  10027. for (let i = 0, ii = inkList.length; i < ii; i++) {
  10028. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  10029. }
  10030. buffer.push("S");
  10031. }
  10032. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10033. }
  10034. });
  10035. }
  10036. }
  10037. static createNewDict(annotation, xref, _ref5) {
  10038. let {
  10039. apRef,
  10040. ap
  10041. } = _ref5;
  10042. const {
  10043. paths,
  10044. rect,
  10045. rotation
  10046. } = annotation;
  10047. const ink = new _primitives.Dict(xref);
  10048. ink.set("Type", _primitives.Name.get("Annot"));
  10049. ink.set("Subtype", _primitives.Name.get("Ink"));
  10050. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  10051. ink.set("Rect", rect);
  10052. ink.set("InkList", paths.map(p => p.points));
  10053. ink.set("F", 4);
  10054. ink.set("Border", [0, 0, 0]);
  10055. ink.set("Rotate", rotation);
  10056. const n = new _primitives.Dict(xref);
  10057. ink.set("AP", n);
  10058. if (apRef) {
  10059. n.set("N", apRef);
  10060. } else {
  10061. n.set("N", ap);
  10062. }
  10063. return ink;
  10064. }
  10065. static async createNewAppearanceStream(annotation, xref, params) {
  10066. const {
  10067. color,
  10068. rect,
  10069. rotation,
  10070. paths,
  10071. thickness,
  10072. opacity
  10073. } = annotation;
  10074. const [x1, y1, x2, y2] = rect;
  10075. let w = x2 - x1;
  10076. let h = y2 - y1;
  10077. if (rotation % 180 !== 0) {
  10078. [w, h] = [h, w];
  10079. }
  10080. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  10081. if (opacity !== 1) {
  10082. appearanceBuffer.push("/R0 gs");
  10083. }
  10084. const buffer = [];
  10085. for (const {
  10086. bezier
  10087. } of paths) {
  10088. buffer.length = 0;
  10089. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  10090. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  10091. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  10092. buffer.push(`${curve} c`);
  10093. }
  10094. buffer.push("S");
  10095. appearanceBuffer.push(buffer.join("\n"));
  10096. }
  10097. const appearance = appearanceBuffer.join("\n");
  10098. const appearanceStreamDict = new _primitives.Dict(xref);
  10099. appearanceStreamDict.set("FormType", 1);
  10100. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  10101. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  10102. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  10103. appearanceStreamDict.set("Length", appearance.length);
  10104. if (rotation) {
  10105. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  10106. appearanceStreamDict.set("Matrix", matrix);
  10107. }
  10108. if (opacity !== 1) {
  10109. const resources = new _primitives.Dict(xref);
  10110. const extGState = new _primitives.Dict(xref);
  10111. const r0 = new _primitives.Dict(xref);
  10112. r0.set("CA", opacity);
  10113. r0.set("Type", _primitives.Name.get("ExtGState"));
  10114. extGState.set("R0", r0);
  10115. resources.set("ExtGState", extGState);
  10116. appearanceStreamDict.set("Resources", resources);
  10117. }
  10118. const ap = new _stream.StringStream(appearance);
  10119. ap.dict = appearanceStreamDict;
  10120. return ap;
  10121. }
  10122. }
  10123. class HighlightAnnotation extends MarkupAnnotation {
  10124. constructor(params) {
  10125. super(params);
  10126. const {
  10127. dict,
  10128. xref
  10129. } = params;
  10130. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  10131. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10132. if (quadPoints) {
  10133. const resources = this.appearance && this.appearance.dict.get("Resources");
  10134. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  10135. if (this.appearance) {
  10136. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  10137. }
  10138. const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0];
  10139. const fillAlpha = dict.get("CA");
  10140. this._setDefaultAppearance({
  10141. xref,
  10142. fillColor,
  10143. blendMode: "Multiply",
  10144. fillAlpha,
  10145. pointsCallback: (buffer, points) => {
  10146. 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");
  10147. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10148. }
  10149. });
  10150. }
  10151. } else {
  10152. this.data.hasPopup = false;
  10153. }
  10154. }
  10155. }
  10156. class UnderlineAnnotation extends MarkupAnnotation {
  10157. constructor(params) {
  10158. super(params);
  10159. const {
  10160. dict,
  10161. xref
  10162. } = params;
  10163. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  10164. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10165. if (quadPoints) {
  10166. if (!this.appearance) {
  10167. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10168. const strokeAlpha = dict.get("CA");
  10169. this._setDefaultAppearance({
  10170. xref,
  10171. extra: "[] 0 d 1 w",
  10172. strokeColor,
  10173. strokeAlpha,
  10174. pointsCallback: (buffer, points) => {
  10175. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  10176. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10177. }
  10178. });
  10179. }
  10180. } else {
  10181. this.data.hasPopup = false;
  10182. }
  10183. }
  10184. }
  10185. class SquigglyAnnotation extends MarkupAnnotation {
  10186. constructor(params) {
  10187. super(params);
  10188. const {
  10189. dict,
  10190. xref
  10191. } = params;
  10192. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  10193. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10194. if (quadPoints) {
  10195. if (!this.appearance) {
  10196. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10197. const strokeAlpha = dict.get("CA");
  10198. this._setDefaultAppearance({
  10199. xref,
  10200. extra: "[] 0 d 1 w",
  10201. strokeColor,
  10202. strokeAlpha,
  10203. pointsCallback: (buffer, points) => {
  10204. const dy = (points[0].y - points[2].y) / 6;
  10205. let shift = dy;
  10206. let x = points[2].x;
  10207. const y = points[2].y;
  10208. const xEnd = points[3].x;
  10209. buffer.push(`${x} ${y + shift} m`);
  10210. do {
  10211. x += 2;
  10212. shift = shift === 0 ? dy : 0;
  10213. buffer.push(`${x} ${y + shift} l`);
  10214. } while (x < xEnd);
  10215. buffer.push("S");
  10216. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  10217. }
  10218. });
  10219. }
  10220. } else {
  10221. this.data.hasPopup = false;
  10222. }
  10223. }
  10224. }
  10225. class StrikeOutAnnotation extends MarkupAnnotation {
  10226. constructor(params) {
  10227. super(params);
  10228. const {
  10229. dict,
  10230. xref
  10231. } = params;
  10232. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  10233. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10234. if (quadPoints) {
  10235. if (!this.appearance) {
  10236. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10237. const strokeAlpha = dict.get("CA");
  10238. this._setDefaultAppearance({
  10239. xref,
  10240. extra: "[] 0 d 1 w",
  10241. strokeColor,
  10242. strokeAlpha,
  10243. pointsCallback: (buffer, points) => {
  10244. 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");
  10245. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10246. }
  10247. });
  10248. }
  10249. } else {
  10250. this.data.hasPopup = false;
  10251. }
  10252. }
  10253. }
  10254. class StampAnnotation extends MarkupAnnotation {
  10255. constructor(params) {
  10256. super(params);
  10257. this.data.annotationType = _util.AnnotationType.STAMP;
  10258. }
  10259. }
  10260. class FileAttachmentAnnotation extends MarkupAnnotation {
  10261. constructor(params) {
  10262. super(params);
  10263. const {
  10264. dict,
  10265. xref
  10266. } = params;
  10267. const file = new _file_spec.FileSpec(dict.get("FS"), xref);
  10268. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  10269. this.data.file = file.serializable;
  10270. const name = dict.get("Name");
  10271. this.data.name = name instanceof _primitives.Name ? (0, _util.stringToPDFString)(name.name) : "PushPin";
  10272. }
  10273. }
  10274. /***/ }),
  10275. /* 142 */
  10276. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10277. "use strict";
  10278. Object.defineProperty(exports, "__esModule", ({
  10279. value: true
  10280. }));
  10281. exports.FakeUnicodeFont = void 0;
  10282. exports.createDefaultAppearance = createDefaultAppearance;
  10283. exports.getPdfColor = getPdfColor;
  10284. exports.parseDefaultAppearance = parseDefaultAppearance;
  10285. var _primitives = __w_pdfjs_require__(134);
  10286. var _core_utils = __w_pdfjs_require__(135);
  10287. var _util = __w_pdfjs_require__(2);
  10288. var _colorspace = __w_pdfjs_require__(143);
  10289. var _evaluator = __w_pdfjs_require__(144);
  10290. var _stream = __w_pdfjs_require__(139);
  10291. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  10292. constructor(str) {
  10293. super(new _stream.StringStream(str));
  10294. }
  10295. parse() {
  10296. const operation = {
  10297. fn: 0,
  10298. args: []
  10299. };
  10300. const result = {
  10301. fontSize: 0,
  10302. fontName: "",
  10303. fontColor: new Uint8ClampedArray(3)
  10304. };
  10305. try {
  10306. while (true) {
  10307. operation.args.length = 0;
  10308. if (!this.read(operation)) {
  10309. break;
  10310. }
  10311. if (this.savedStatesDepth !== 0) {
  10312. continue;
  10313. }
  10314. const {
  10315. fn,
  10316. args
  10317. } = operation;
  10318. switch (fn | 0) {
  10319. case _util.OPS.setFont:
  10320. const [fontName, fontSize] = args;
  10321. if (fontName instanceof _primitives.Name) {
  10322. result.fontName = fontName.name;
  10323. }
  10324. if (typeof fontSize === "number" && fontSize > 0) {
  10325. result.fontSize = fontSize;
  10326. }
  10327. break;
  10328. case _util.OPS.setFillRGBColor:
  10329. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  10330. break;
  10331. case _util.OPS.setFillGray:
  10332. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  10333. break;
  10334. case _util.OPS.setFillColorSpace:
  10335. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  10336. break;
  10337. }
  10338. }
  10339. } catch (reason) {
  10340. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  10341. }
  10342. return result;
  10343. }
  10344. }
  10345. function parseDefaultAppearance(str) {
  10346. return new DefaultAppearanceEvaluator(str).parse();
  10347. }
  10348. function getPdfColor(color, isFill) {
  10349. if (color[0] === color[1] && color[1] === color[2]) {
  10350. const gray = color[0] / 255;
  10351. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  10352. }
  10353. return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  10354. }
  10355. function createDefaultAppearance(_ref) {
  10356. let {
  10357. fontSize,
  10358. fontName,
  10359. fontColor
  10360. } = _ref;
  10361. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  10362. }
  10363. class FakeUnicodeFont {
  10364. constructor(xref, fontFamily) {
  10365. this.xref = xref;
  10366. this.widths = null;
  10367. this.firstChar = Infinity;
  10368. this.lastChar = -Infinity;
  10369. this.fontFamily = fontFamily;
  10370. const canvas = new OffscreenCanvas(1, 1);
  10371. this.ctxMeasure = canvas.getContext("2d");
  10372. if (!FakeUnicodeFont._fontNameId) {
  10373. FakeUnicodeFont._fontNameId = 1;
  10374. }
  10375. this.fontName = _primitives.Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`);
  10376. }
  10377. get toUnicodeRef() {
  10378. if (!FakeUnicodeFont._toUnicodeRef) {
  10379. const toUnicode = `/CIDInit /ProcSet findresource begin
  10380. 12 dict begin
  10381. begincmap
  10382. /CIDSystemInfo
  10383. << /Registry (Adobe)
  10384. /Ordering (UCS) /Supplement 0 >> def
  10385. /CMapName /Adobe-Identity-UCS def
  10386. /CMapType 2 def
  10387. 1 begincodespacerange
  10388. <0000> <FFFF>
  10389. endcodespacerange
  10390. 1 beginbfrange
  10391. <0000> <FFFF> <0000>
  10392. endbfrange
  10393. endcmap CMapName currentdict /CMap defineresource pop end end`;
  10394. const toUnicodeStream = FakeUnicodeFont.toUnicodeStream = new _stream.StringStream(toUnicode);
  10395. const toUnicodeDict = new _primitives.Dict(this.xref);
  10396. toUnicodeStream.dict = toUnicodeDict;
  10397. toUnicodeDict.set("Length", toUnicode.length);
  10398. FakeUnicodeFont._toUnicodeRef = this.xref.getNewPersistentRef(toUnicodeStream);
  10399. }
  10400. return FakeUnicodeFont._toUnicodeRef;
  10401. }
  10402. get fontDescriptorRef() {
  10403. if (!FakeUnicodeFont._fontDescriptorRef) {
  10404. const fontDescriptor = new _primitives.Dict(this.xref);
  10405. fontDescriptor.set("Type", _primitives.Name.get("FontDescriptor"));
  10406. fontDescriptor.set("FontName", this.fontName);
  10407. fontDescriptor.set("FontFamily", "MyriadPro Regular");
  10408. fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
  10409. fontDescriptor.set("FontStretch", _primitives.Name.get("Normal"));
  10410. fontDescriptor.set("FontWeight", 400);
  10411. fontDescriptor.set("ItalicAngle", 0);
  10412. FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
  10413. }
  10414. return FakeUnicodeFont._fontDescriptorRef;
  10415. }
  10416. get descendantFontRef() {
  10417. const descendantFont = new _primitives.Dict(this.xref);
  10418. descendantFont.set("BaseFont", this.fontName);
  10419. descendantFont.set("Type", _primitives.Name.get("Font"));
  10420. descendantFont.set("Subtype", _primitives.Name.get("CIDFontType0"));
  10421. descendantFont.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  10422. descendantFont.set("FirstChar", this.firstChar);
  10423. descendantFont.set("LastChar", this.lastChar);
  10424. descendantFont.set("FontDescriptor", this.fontDescriptorRef);
  10425. descendantFont.set("DW", 1000);
  10426. const widths = [];
  10427. const chars = [...this.widths.entries()].sort();
  10428. let currentChar = null;
  10429. let currentWidths = null;
  10430. for (const [char, width] of chars) {
  10431. if (!currentChar) {
  10432. currentChar = char;
  10433. currentWidths = [width];
  10434. continue;
  10435. }
  10436. if (char === currentChar + currentWidths.length) {
  10437. currentWidths.push(width);
  10438. } else {
  10439. widths.push(currentChar, currentWidths);
  10440. currentChar = char;
  10441. currentWidths = [width];
  10442. }
  10443. }
  10444. if (currentChar) {
  10445. widths.push(currentChar, currentWidths);
  10446. }
  10447. descendantFont.set("W", widths);
  10448. const cidSystemInfo = new _primitives.Dict(this.xref);
  10449. cidSystemInfo.set("Ordering", "Identity");
  10450. cidSystemInfo.set("Registry", "Adobe");
  10451. cidSystemInfo.set("Supplement", 0);
  10452. descendantFont.set("CIDSystemInfo", cidSystemInfo);
  10453. return this.xref.getNewPersistentRef(descendantFont);
  10454. }
  10455. get baseFontRef() {
  10456. const baseFont = new _primitives.Dict(this.xref);
  10457. baseFont.set("BaseFont", this.fontName);
  10458. baseFont.set("Type", _primitives.Name.get("Font"));
  10459. baseFont.set("Subtype", _primitives.Name.get("Type0"));
  10460. baseFont.set("Encoding", _primitives.Name.get("Identity-H"));
  10461. baseFont.set("DescendantFonts", [this.descendantFontRef]);
  10462. baseFont.set("ToUnicode", this.toUnicodeRef);
  10463. return this.xref.getNewPersistentRef(baseFont);
  10464. }
  10465. get resources() {
  10466. const resources = new _primitives.Dict(this.xref);
  10467. const font = new _primitives.Dict(this.xref);
  10468. font.set(this.fontName.name, this.baseFontRef);
  10469. resources.set("Font", font);
  10470. return resources;
  10471. }
  10472. _createContext() {
  10473. this.widths = new Map();
  10474. this.ctxMeasure.font = `1000px ${this.fontFamily}`;
  10475. return this.ctxMeasure;
  10476. }
  10477. createFontResources(text) {
  10478. const ctx = this._createContext();
  10479. for (const line of text.split(/\r\n?|\n/)) {
  10480. for (const char of line.split("")) {
  10481. const code = char.charCodeAt(0);
  10482. if (this.widths.has(code)) {
  10483. continue;
  10484. }
  10485. const metrics = ctx.measureText(char);
  10486. const width = Math.ceil(metrics.width);
  10487. this.widths.set(code, width);
  10488. this.firstChar = Math.min(code, this.firstChar);
  10489. this.lastChar = Math.max(code, this.lastChar);
  10490. }
  10491. }
  10492. return this.resources;
  10493. }
  10494. createAppearance(text, rect, rotation, fontSize, bgColor) {
  10495. const ctx = this._createContext();
  10496. const lines = [];
  10497. let maxWidth = -Infinity;
  10498. for (const line of text.split(/\r\n?|\n/)) {
  10499. lines.push(line);
  10500. const lineWidth = ctx.measureText(line).width;
  10501. maxWidth = Math.max(maxWidth, lineWidth);
  10502. for (const char of line.split("")) {
  10503. const code = char.charCodeAt(0);
  10504. let width = this.widths.get(code);
  10505. if (width === undefined) {
  10506. const metrics = ctx.measureText(char);
  10507. width = Math.ceil(metrics.width);
  10508. this.widths.set(code, width);
  10509. this.firstChar = Math.min(code, this.firstChar);
  10510. this.lastChar = Math.max(code, this.lastChar);
  10511. }
  10512. }
  10513. }
  10514. maxWidth *= fontSize / 1000;
  10515. const [x1, y1, x2, y2] = rect;
  10516. let w = x2 - x1;
  10517. let h = y2 - y1;
  10518. if (rotation % 180 !== 0) {
  10519. [w, h] = [h, w];
  10520. }
  10521. let hscale = 1;
  10522. if (maxWidth > w) {
  10523. hscale = w / maxWidth;
  10524. }
  10525. let vscale = 1;
  10526. const lineHeight = _util.LINE_FACTOR * fontSize;
  10527. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  10528. const maxHeight = lineHeight * lines.length;
  10529. if (maxHeight > h) {
  10530. vscale = h / maxHeight;
  10531. }
  10532. const fscale = Math.min(hscale, vscale);
  10533. const newFontSize = fontSize * fscale;
  10534. const buffer = ["q", `0 0 ${(0, _core_utils.numberToString)(w)} ${(0, _core_utils.numberToString)(h)} re W n`, `BT`, `1 0 0 1 0 ${(0, _core_utils.numberToString)(h + lineDescent)} Tm 0 Tc ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${(0, _core_utils.numberToString)(newFontSize)} Tf`];
  10535. const vShift = (0, _core_utils.numberToString)(lineHeight);
  10536. for (const line of lines) {
  10537. buffer.push(`0 -${vShift} Td <${(0, _core_utils.stringToUTF16HexString)(line)}> Tj`);
  10538. }
  10539. buffer.push("ET", "Q");
  10540. const appearance = buffer.join("\n");
  10541. const appearanceStreamDict = new _primitives.Dict(this.xref);
  10542. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  10543. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  10544. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  10545. appearanceStreamDict.set("Length", appearance.length);
  10546. appearanceStreamDict.set("Resources", this.resources);
  10547. if (rotation) {
  10548. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  10549. appearanceStreamDict.set("Matrix", matrix);
  10550. }
  10551. const ap = new _stream.StringStream(appearance);
  10552. ap.dict = appearanceStreamDict;
  10553. return ap;
  10554. }
  10555. }
  10556. exports.FakeUnicodeFont = FakeUnicodeFont;
  10557. /***/ }),
  10558. /* 143 */
  10559. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10560. "use strict";
  10561. Object.defineProperty(exports, "__esModule", ({
  10562. value: true
  10563. }));
  10564. exports.ColorSpace = void 0;
  10565. var _util = __w_pdfjs_require__(2);
  10566. var _primitives = __w_pdfjs_require__(134);
  10567. var _base_stream = __w_pdfjs_require__(136);
  10568. var _core_utils = __w_pdfjs_require__(135);
  10569. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  10570. const COMPONENTS = 3;
  10571. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  10572. const xRatio = w1 / w2;
  10573. const yRatio = h1 / h2;
  10574. let newIndex = 0,
  10575. oldIndex;
  10576. const xScaled = new Uint16Array(w2);
  10577. const w1Scanline = w1 * COMPONENTS;
  10578. for (let i = 0; i < w2; i++) {
  10579. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  10580. }
  10581. for (let i = 0; i < h2; i++) {
  10582. const py = Math.floor(i * yRatio) * w1Scanline;
  10583. for (let j = 0; j < w2; j++) {
  10584. oldIndex = py + xScaled[j];
  10585. dest[newIndex++] = src[oldIndex++];
  10586. dest[newIndex++] = src[oldIndex++];
  10587. dest[newIndex++] = src[oldIndex++];
  10588. newIndex += alpha01;
  10589. }
  10590. }
  10591. }
  10592. class ColorSpace {
  10593. constructor(name, numComps) {
  10594. if (this.constructor === ColorSpace) {
  10595. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  10596. }
  10597. this.name = name;
  10598. this.numComps = numComps;
  10599. }
  10600. getRgb(src, srcOffset) {
  10601. const rgb = new Uint8ClampedArray(3);
  10602. this.getRgbItem(src, srcOffset, rgb, 0);
  10603. return rgb;
  10604. }
  10605. getRgbItem(src, srcOffset, dest, destOffset) {
  10606. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  10607. }
  10608. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10609. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  10610. }
  10611. getOutputLength(inputLength, alpha01) {
  10612. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  10613. }
  10614. isPassthrough(bits) {
  10615. return false;
  10616. }
  10617. isDefaultDecode(decodeMap, bpc) {
  10618. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  10619. }
  10620. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  10621. const count = originalWidth * originalHeight;
  10622. let rgbBuf = null;
  10623. const numComponentColors = 1 << bpc;
  10624. const needsResizing = originalHeight !== height || originalWidth !== width;
  10625. if (this.isPassthrough(bpc)) {
  10626. rgbBuf = comps;
  10627. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  10628. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  10629. for (let i = 0; i < numComponentColors; i++) {
  10630. allColors[i] = i;
  10631. }
  10632. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  10633. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  10634. if (!needsResizing) {
  10635. let destPos = 0;
  10636. for (let i = 0; i < count; ++i) {
  10637. const key = comps[i] * 3;
  10638. dest[destPos++] = colorMap[key];
  10639. dest[destPos++] = colorMap[key + 1];
  10640. dest[destPos++] = colorMap[key + 2];
  10641. destPos += alpha01;
  10642. }
  10643. } else {
  10644. rgbBuf = new Uint8Array(count * 3);
  10645. let rgbPos = 0;
  10646. for (let i = 0; i < count; ++i) {
  10647. const key = comps[i] * 3;
  10648. rgbBuf[rgbPos++] = colorMap[key];
  10649. rgbBuf[rgbPos++] = colorMap[key + 1];
  10650. rgbBuf[rgbPos++] = colorMap[key + 2];
  10651. }
  10652. }
  10653. } else {
  10654. if (!needsResizing) {
  10655. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  10656. } else {
  10657. rgbBuf = new Uint8ClampedArray(count * 3);
  10658. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  10659. }
  10660. }
  10661. if (rgbBuf) {
  10662. if (needsResizing) {
  10663. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  10664. } else {
  10665. let destPos = 0,
  10666. rgbPos = 0;
  10667. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  10668. dest[destPos++] = rgbBuf[rgbPos++];
  10669. dest[destPos++] = rgbBuf[rgbPos++];
  10670. dest[destPos++] = rgbBuf[rgbPos++];
  10671. destPos += alpha01;
  10672. }
  10673. }
  10674. }
  10675. }
  10676. get usesZeroToOneRange() {
  10677. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  10678. }
  10679. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  10680. if (!localColorSpaceCache) {
  10681. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  10682. }
  10683. if (!parsedColorSpace) {
  10684. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  10685. }
  10686. let csName, csRef;
  10687. if (cacheKey instanceof _primitives.Ref) {
  10688. csRef = cacheKey;
  10689. cacheKey = xref.fetch(cacheKey);
  10690. }
  10691. if (cacheKey instanceof _primitives.Name) {
  10692. csName = cacheKey.name;
  10693. }
  10694. if (csName || csRef) {
  10695. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  10696. }
  10697. }
  10698. static getCached(cacheKey, xref, localColorSpaceCache) {
  10699. if (!localColorSpaceCache) {
  10700. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  10701. }
  10702. if (cacheKey instanceof _primitives.Ref) {
  10703. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  10704. if (localColorSpace) {
  10705. return localColorSpace;
  10706. }
  10707. try {
  10708. cacheKey = xref.fetch(cacheKey);
  10709. } catch (ex) {
  10710. if (ex instanceof _core_utils.MissingDataException) {
  10711. throw ex;
  10712. }
  10713. }
  10714. }
  10715. if (cacheKey instanceof _primitives.Name) {
  10716. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  10717. if (localColorSpace) {
  10718. return localColorSpace;
  10719. }
  10720. }
  10721. return null;
  10722. }
  10723. static async parseAsync(_ref) {
  10724. let {
  10725. cs,
  10726. xref,
  10727. resources = null,
  10728. pdfFunctionFactory,
  10729. localColorSpaceCache
  10730. } = _ref;
  10731. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10732. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10733. return parsedColorSpace;
  10734. }
  10735. static parse(_ref2) {
  10736. let {
  10737. cs,
  10738. xref,
  10739. resources = null,
  10740. pdfFunctionFactory,
  10741. localColorSpaceCache
  10742. } = _ref2;
  10743. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  10744. if (cachedColorSpace) {
  10745. return cachedColorSpace;
  10746. }
  10747. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10748. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10749. return parsedColorSpace;
  10750. }
  10751. static _parse(cs, xref) {
  10752. let resources = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  10753. let pdfFunctionFactory = arguments.length > 3 ? arguments[3] : undefined;
  10754. cs = xref.fetchIfRef(cs);
  10755. if (cs instanceof _primitives.Name) {
  10756. switch (cs.name) {
  10757. case "G":
  10758. case "DeviceGray":
  10759. return this.singletons.gray;
  10760. case "RGB":
  10761. case "DeviceRGB":
  10762. return this.singletons.rgb;
  10763. case "CMYK":
  10764. case "DeviceCMYK":
  10765. return this.singletons.cmyk;
  10766. case "Pattern":
  10767. return new PatternCS(null);
  10768. default:
  10769. if (resources instanceof _primitives.Dict) {
  10770. const colorSpaces = resources.get("ColorSpace");
  10771. if (colorSpaces instanceof _primitives.Dict) {
  10772. const resourcesCS = colorSpaces.get(cs.name);
  10773. if (resourcesCS) {
  10774. if (resourcesCS instanceof _primitives.Name) {
  10775. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  10776. }
  10777. cs = resourcesCS;
  10778. break;
  10779. }
  10780. }
  10781. }
  10782. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  10783. }
  10784. }
  10785. if (Array.isArray(cs)) {
  10786. const mode = xref.fetchIfRef(cs[0]).name;
  10787. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  10788. switch (mode) {
  10789. case "G":
  10790. case "DeviceGray":
  10791. return this.singletons.gray;
  10792. case "RGB":
  10793. case "DeviceRGB":
  10794. return this.singletons.rgb;
  10795. case "CMYK":
  10796. case "DeviceCMYK":
  10797. return this.singletons.cmyk;
  10798. case "CalGray":
  10799. params = xref.fetchIfRef(cs[1]);
  10800. whitePoint = params.getArray("WhitePoint");
  10801. blackPoint = params.getArray("BlackPoint");
  10802. gamma = params.get("Gamma");
  10803. return new CalGrayCS(whitePoint, blackPoint, gamma);
  10804. case "CalRGB":
  10805. params = xref.fetchIfRef(cs[1]);
  10806. whitePoint = params.getArray("WhitePoint");
  10807. blackPoint = params.getArray("BlackPoint");
  10808. gamma = params.getArray("Gamma");
  10809. const matrix = params.getArray("Matrix");
  10810. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  10811. case "ICCBased":
  10812. const stream = xref.fetchIfRef(cs[1]);
  10813. const dict = stream.dict;
  10814. numComps = dict.get("N");
  10815. const alt = dict.get("Alternate");
  10816. if (alt) {
  10817. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  10818. if (altCS.numComps === numComps) {
  10819. return altCS;
  10820. }
  10821. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  10822. }
  10823. if (numComps === 1) {
  10824. return this.singletons.gray;
  10825. } else if (numComps === 3) {
  10826. return this.singletons.rgb;
  10827. } else if (numComps === 4) {
  10828. return this.singletons.cmyk;
  10829. }
  10830. break;
  10831. case "Pattern":
  10832. baseCS = cs[1] || null;
  10833. if (baseCS) {
  10834. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  10835. }
  10836. return new PatternCS(baseCS);
  10837. case "I":
  10838. case "Indexed":
  10839. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  10840. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  10841. const lookup = xref.fetchIfRef(cs[3]);
  10842. return new IndexedCS(baseCS, hiVal, lookup);
  10843. case "Separation":
  10844. case "DeviceN":
  10845. const name = xref.fetchIfRef(cs[1]);
  10846. numComps = Array.isArray(name) ? name.length : 1;
  10847. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  10848. const tintFn = pdfFunctionFactory.create(cs[3]);
  10849. return new AlternateCS(numComps, baseCS, tintFn);
  10850. case "Lab":
  10851. params = xref.fetchIfRef(cs[1]);
  10852. whitePoint = params.getArray("WhitePoint");
  10853. blackPoint = params.getArray("BlackPoint");
  10854. const range = params.getArray("Range");
  10855. return new LabCS(whitePoint, blackPoint, range);
  10856. default:
  10857. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  10858. }
  10859. }
  10860. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  10861. }
  10862. static isDefaultDecode(decode, numComps) {
  10863. if (!Array.isArray(decode)) {
  10864. return true;
  10865. }
  10866. if (numComps * 2 !== decode.length) {
  10867. (0, _util.warn)("The decode map is not the correct length");
  10868. return true;
  10869. }
  10870. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  10871. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  10872. return false;
  10873. }
  10874. }
  10875. return true;
  10876. }
  10877. static get singletons() {
  10878. return (0, _util.shadow)(this, "singletons", {
  10879. get gray() {
  10880. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  10881. },
  10882. get rgb() {
  10883. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  10884. },
  10885. get cmyk() {
  10886. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  10887. }
  10888. });
  10889. }
  10890. }
  10891. exports.ColorSpace = ColorSpace;
  10892. class AlternateCS extends ColorSpace {
  10893. constructor(numComps, base, tintFn) {
  10894. super("Alternate", numComps);
  10895. this.base = base;
  10896. this.tintFn = tintFn;
  10897. this.tmpBuf = new Float32Array(base.numComps);
  10898. }
  10899. getRgbItem(src, srcOffset, dest, destOffset) {
  10900. const tmpBuf = this.tmpBuf;
  10901. this.tintFn(src, srcOffset, tmpBuf, 0);
  10902. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  10903. }
  10904. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10905. const tintFn = this.tintFn;
  10906. const base = this.base;
  10907. const scale = 1 / ((1 << bits) - 1);
  10908. const baseNumComps = base.numComps;
  10909. const usesZeroToOneRange = base.usesZeroToOneRange;
  10910. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  10911. let pos = isPassthrough ? destOffset : 0;
  10912. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  10913. const numComps = this.numComps;
  10914. const scaled = new Float32Array(numComps);
  10915. const tinted = new Float32Array(baseNumComps);
  10916. let i, j;
  10917. for (i = 0; i < count; i++) {
  10918. for (j = 0; j < numComps; j++) {
  10919. scaled[j] = src[srcOffset++] * scale;
  10920. }
  10921. tintFn(scaled, 0, tinted, 0);
  10922. if (usesZeroToOneRange) {
  10923. for (j = 0; j < baseNumComps; j++) {
  10924. baseBuf[pos++] = tinted[j] * 255;
  10925. }
  10926. } else {
  10927. base.getRgbItem(tinted, 0, baseBuf, pos);
  10928. pos += baseNumComps;
  10929. }
  10930. }
  10931. if (!isPassthrough) {
  10932. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  10933. }
  10934. }
  10935. getOutputLength(inputLength, alpha01) {
  10936. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  10937. }
  10938. }
  10939. class PatternCS extends ColorSpace {
  10940. constructor(baseCS) {
  10941. super("Pattern", null);
  10942. this.base = baseCS;
  10943. }
  10944. isDefaultDecode(decodeMap, bpc) {
  10945. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  10946. }
  10947. }
  10948. class IndexedCS extends ColorSpace {
  10949. constructor(base, highVal, lookup) {
  10950. super("Indexed", 1);
  10951. this.base = base;
  10952. this.highVal = highVal;
  10953. const length = base.numComps * highVal;
  10954. this.lookup = new Uint8Array(length);
  10955. if (lookup instanceof _base_stream.BaseStream) {
  10956. const bytes = lookup.getBytes(length);
  10957. this.lookup.set(bytes);
  10958. } else if (typeof lookup === "string") {
  10959. for (let i = 0; i < length; ++i) {
  10960. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  10961. }
  10962. } else {
  10963. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  10964. }
  10965. }
  10966. getRgbItem(src, srcOffset, dest, destOffset) {
  10967. const numComps = this.base.numComps;
  10968. const start = src[srcOffset] * numComps;
  10969. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  10970. }
  10971. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10972. const base = this.base;
  10973. const numComps = base.numComps;
  10974. const outputDelta = base.getOutputLength(numComps, alpha01);
  10975. const lookup = this.lookup;
  10976. for (let i = 0; i < count; ++i) {
  10977. const lookupPos = src[srcOffset++] * numComps;
  10978. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  10979. destOffset += outputDelta;
  10980. }
  10981. }
  10982. getOutputLength(inputLength, alpha01) {
  10983. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  10984. }
  10985. isDefaultDecode(decodeMap, bpc) {
  10986. if (!Array.isArray(decodeMap)) {
  10987. return true;
  10988. }
  10989. if (decodeMap.length !== 2) {
  10990. (0, _util.warn)("Decode map length is not correct");
  10991. return true;
  10992. }
  10993. if (!Number.isInteger(bpc) || bpc < 1) {
  10994. (0, _util.warn)("Bits per component is not correct");
  10995. return true;
  10996. }
  10997. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  10998. }
  10999. }
  11000. class DeviceGrayCS extends ColorSpace {
  11001. constructor() {
  11002. super("DeviceGray", 1);
  11003. }
  11004. getRgbItem(src, srcOffset, dest, destOffset) {
  11005. const c = src[srcOffset] * 255;
  11006. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  11007. }
  11008. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11009. const scale = 255 / ((1 << bits) - 1);
  11010. let j = srcOffset,
  11011. q = destOffset;
  11012. for (let i = 0; i < count; ++i) {
  11013. const c = scale * src[j++];
  11014. dest[q++] = c;
  11015. dest[q++] = c;
  11016. dest[q++] = c;
  11017. q += alpha01;
  11018. }
  11019. }
  11020. getOutputLength(inputLength, alpha01) {
  11021. return inputLength * (3 + alpha01);
  11022. }
  11023. }
  11024. class DeviceRgbCS extends ColorSpace {
  11025. constructor() {
  11026. super("DeviceRGB", 3);
  11027. }
  11028. getRgbItem(src, srcOffset, dest, destOffset) {
  11029. dest[destOffset] = src[srcOffset] * 255;
  11030. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  11031. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  11032. }
  11033. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11034. if (bits === 8 && alpha01 === 0) {
  11035. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  11036. return;
  11037. }
  11038. const scale = 255 / ((1 << bits) - 1);
  11039. let j = srcOffset,
  11040. q = destOffset;
  11041. for (let i = 0; i < count; ++i) {
  11042. dest[q++] = scale * src[j++];
  11043. dest[q++] = scale * src[j++];
  11044. dest[q++] = scale * src[j++];
  11045. q += alpha01;
  11046. }
  11047. }
  11048. getOutputLength(inputLength, alpha01) {
  11049. return inputLength * (3 + alpha01) / 3 | 0;
  11050. }
  11051. isPassthrough(bits) {
  11052. return bits === 8;
  11053. }
  11054. }
  11055. const DeviceCmykCS = function DeviceCmykCSClosure() {
  11056. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  11057. const c = src[srcOffset] * srcScale;
  11058. const m = src[srcOffset + 1] * srcScale;
  11059. const y = src[srcOffset + 2] * srcScale;
  11060. const k = src[srcOffset + 3] * srcScale;
  11061. 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);
  11062. 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);
  11063. 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);
  11064. }
  11065. class DeviceCmykCS extends ColorSpace {
  11066. constructor() {
  11067. super("DeviceCMYK", 4);
  11068. }
  11069. getRgbItem(src, srcOffset, dest, destOffset) {
  11070. convertToRgb(src, srcOffset, 1, dest, destOffset);
  11071. }
  11072. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11073. const scale = 1 / ((1 << bits) - 1);
  11074. for (let i = 0; i < count; i++) {
  11075. convertToRgb(src, srcOffset, scale, dest, destOffset);
  11076. srcOffset += 4;
  11077. destOffset += 3 + alpha01;
  11078. }
  11079. }
  11080. getOutputLength(inputLength, alpha01) {
  11081. return inputLength / 4 * (3 + alpha01) | 0;
  11082. }
  11083. }
  11084. return DeviceCmykCS;
  11085. }();
  11086. const CalGrayCS = function CalGrayCSClosure() {
  11087. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  11088. const A = src[srcOffset] * scale;
  11089. const AG = A ** cs.G;
  11090. const L = cs.YW * AG;
  11091. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  11092. dest[destOffset] = val;
  11093. dest[destOffset + 1] = val;
  11094. dest[destOffset + 2] = val;
  11095. }
  11096. class CalGrayCS extends ColorSpace {
  11097. constructor(whitePoint, blackPoint, gamma) {
  11098. super("CalGray", 1);
  11099. if (!whitePoint) {
  11100. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  11101. }
  11102. blackPoint = blackPoint || [0, 0, 0];
  11103. gamma = gamma || 1;
  11104. this.XW = whitePoint[0];
  11105. this.YW = whitePoint[1];
  11106. this.ZW = whitePoint[2];
  11107. this.XB = blackPoint[0];
  11108. this.YB = blackPoint[1];
  11109. this.ZB = blackPoint[2];
  11110. this.G = gamma;
  11111. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  11112. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  11113. }
  11114. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  11115. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  11116. this.XB = this.YB = this.ZB = 0;
  11117. }
  11118. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  11119. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  11120. }
  11121. if (this.G < 1) {
  11122. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  11123. this.G = 1;
  11124. }
  11125. }
  11126. getRgbItem(src, srcOffset, dest, destOffset) {
  11127. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  11128. }
  11129. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11130. const scale = 1 / ((1 << bits) - 1);
  11131. for (let i = 0; i < count; ++i) {
  11132. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  11133. srcOffset += 1;
  11134. destOffset += 3 + alpha01;
  11135. }
  11136. }
  11137. getOutputLength(inputLength, alpha01) {
  11138. return inputLength * (3 + alpha01);
  11139. }
  11140. }
  11141. return CalGrayCS;
  11142. }();
  11143. const CalRGBCS = function CalRGBCSClosure() {
  11144. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  11145. 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]);
  11146. 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]);
  11147. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  11148. const tempNormalizeMatrix = new Float32Array(3);
  11149. const tempConvertMatrix1 = new Float32Array(3);
  11150. const tempConvertMatrix2 = new Float32Array(3);
  11151. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  11152. function matrixProduct(a, b, result) {
  11153. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  11154. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  11155. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  11156. }
  11157. function convertToFlat(sourceWhitePoint, LMS, result) {
  11158. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  11159. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  11160. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  11161. }
  11162. function convertToD65(sourceWhitePoint, LMS, result) {
  11163. const D65X = 0.95047;
  11164. const D65Y = 1;
  11165. const D65Z = 1.08883;
  11166. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  11167. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  11168. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  11169. }
  11170. function sRGBTransferFunction(color) {
  11171. if (color <= 0.0031308) {
  11172. return adjustToRange(0, 1, 12.92 * color);
  11173. }
  11174. if (color >= 0.99554525) {
  11175. return 1;
  11176. }
  11177. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  11178. }
  11179. function adjustToRange(min, max, value) {
  11180. return Math.max(min, Math.min(max, value));
  11181. }
  11182. function decodeL(L) {
  11183. if (L < 0) {
  11184. return -decodeL(-L);
  11185. }
  11186. if (L > 8.0) {
  11187. return ((L + 16) / 116) ** 3;
  11188. }
  11189. return L * DECODE_L_CONSTANT;
  11190. }
  11191. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  11192. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  11193. result[0] = XYZ_Flat[0];
  11194. result[1] = XYZ_Flat[1];
  11195. result[2] = XYZ_Flat[2];
  11196. return;
  11197. }
  11198. const zeroDecodeL = decodeL(0);
  11199. const X_DST = zeroDecodeL;
  11200. const X_SRC = decodeL(sourceBlackPoint[0]);
  11201. const Y_DST = zeroDecodeL;
  11202. const Y_SRC = decodeL(sourceBlackPoint[1]);
  11203. const Z_DST = zeroDecodeL;
  11204. const Z_SRC = decodeL(sourceBlackPoint[2]);
  11205. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  11206. const X_Offset = 1 - X_Scale;
  11207. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  11208. const Y_Offset = 1 - Y_Scale;
  11209. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  11210. const Z_Offset = 1 - Z_Scale;
  11211. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  11212. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  11213. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  11214. }
  11215. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  11216. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  11217. result[0] = XYZ_In[0];
  11218. result[1] = XYZ_In[1];
  11219. result[2] = XYZ_In[2];
  11220. return;
  11221. }
  11222. const LMS = result;
  11223. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  11224. const LMS_Flat = tempNormalizeMatrix;
  11225. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  11226. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  11227. }
  11228. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  11229. const LMS = result;
  11230. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  11231. const LMS_D65 = tempNormalizeMatrix;
  11232. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  11233. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  11234. }
  11235. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  11236. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  11237. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  11238. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  11239. const AGR = A === 1 ? 1 : A ** cs.GR;
  11240. const BGG = B === 1 ? 1 : B ** cs.GG;
  11241. const CGB = C === 1 ? 1 : C ** cs.GB;
  11242. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  11243. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  11244. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  11245. const XYZ = tempConvertMatrix1;
  11246. XYZ[0] = X;
  11247. XYZ[1] = Y;
  11248. XYZ[2] = Z;
  11249. const XYZ_Flat = tempConvertMatrix2;
  11250. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  11251. const XYZ_Black = tempConvertMatrix1;
  11252. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  11253. const XYZ_D65 = tempConvertMatrix2;
  11254. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  11255. const SRGB = tempConvertMatrix1;
  11256. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  11257. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  11258. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  11259. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  11260. }
  11261. class CalRGBCS extends ColorSpace {
  11262. constructor(whitePoint, blackPoint, gamma, matrix) {
  11263. super("CalRGB", 3);
  11264. if (!whitePoint) {
  11265. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  11266. }
  11267. blackPoint = blackPoint || new Float32Array(3);
  11268. gamma = gamma || new Float32Array([1, 1, 1]);
  11269. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  11270. const XW = whitePoint[0];
  11271. const YW = whitePoint[1];
  11272. const ZW = whitePoint[2];
  11273. this.whitePoint = whitePoint;
  11274. const XB = blackPoint[0];
  11275. const YB = blackPoint[1];
  11276. const ZB = blackPoint[2];
  11277. this.blackPoint = blackPoint;
  11278. this.GR = gamma[0];
  11279. this.GG = gamma[1];
  11280. this.GB = gamma[2];
  11281. this.MXA = matrix[0];
  11282. this.MYA = matrix[1];
  11283. this.MZA = matrix[2];
  11284. this.MXB = matrix[3];
  11285. this.MYB = matrix[4];
  11286. this.MZB = matrix[5];
  11287. this.MXC = matrix[6];
  11288. this.MYC = matrix[7];
  11289. this.MZC = matrix[8];
  11290. if (XW < 0 || ZW < 0 || YW !== 1) {
  11291. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  11292. }
  11293. if (XB < 0 || YB < 0 || ZB < 0) {
  11294. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  11295. this.blackPoint = new Float32Array(3);
  11296. }
  11297. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  11298. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  11299. this.GR = this.GG = this.GB = 1;
  11300. }
  11301. }
  11302. getRgbItem(src, srcOffset, dest, destOffset) {
  11303. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  11304. }
  11305. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11306. const scale = 1 / ((1 << bits) - 1);
  11307. for (let i = 0; i < count; ++i) {
  11308. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  11309. srcOffset += 3;
  11310. destOffset += 3 + alpha01;
  11311. }
  11312. }
  11313. getOutputLength(inputLength, alpha01) {
  11314. return inputLength * (3 + alpha01) / 3 | 0;
  11315. }
  11316. }
  11317. return CalRGBCS;
  11318. }();
  11319. const LabCS = function LabCSClosure() {
  11320. function fn_g(x) {
  11321. let result;
  11322. if (x >= 6 / 29) {
  11323. result = x ** 3;
  11324. } else {
  11325. result = 108 / 841 * (x - 4 / 29);
  11326. }
  11327. return result;
  11328. }
  11329. function decode(value, high1, low2, high2) {
  11330. return low2 + value * (high2 - low2) / high1;
  11331. }
  11332. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  11333. let Ls = src[srcOffset];
  11334. let as = src[srcOffset + 1];
  11335. let bs = src[srcOffset + 2];
  11336. if (maxVal !== false) {
  11337. Ls = decode(Ls, maxVal, 0, 100);
  11338. as = decode(as, maxVal, cs.amin, cs.amax);
  11339. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  11340. }
  11341. if (as > cs.amax) {
  11342. as = cs.amax;
  11343. } else if (as < cs.amin) {
  11344. as = cs.amin;
  11345. }
  11346. if (bs > cs.bmax) {
  11347. bs = cs.bmax;
  11348. } else if (bs < cs.bmin) {
  11349. bs = cs.bmin;
  11350. }
  11351. const M = (Ls + 16) / 116;
  11352. const L = M + as / 500;
  11353. const N = M - bs / 200;
  11354. const X = cs.XW * fn_g(L);
  11355. const Y = cs.YW * fn_g(M);
  11356. const Z = cs.ZW * fn_g(N);
  11357. let r, g, b;
  11358. if (cs.ZW < 1) {
  11359. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  11360. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  11361. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  11362. } else {
  11363. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  11364. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  11365. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  11366. }
  11367. dest[destOffset] = Math.sqrt(r) * 255;
  11368. dest[destOffset + 1] = Math.sqrt(g) * 255;
  11369. dest[destOffset + 2] = Math.sqrt(b) * 255;
  11370. }
  11371. class LabCS extends ColorSpace {
  11372. constructor(whitePoint, blackPoint, range) {
  11373. super("Lab", 3);
  11374. if (!whitePoint) {
  11375. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  11376. }
  11377. blackPoint = blackPoint || [0, 0, 0];
  11378. range = range || [-100, 100, -100, 100];
  11379. this.XW = whitePoint[0];
  11380. this.YW = whitePoint[1];
  11381. this.ZW = whitePoint[2];
  11382. this.amin = range[0];
  11383. this.amax = range[1];
  11384. this.bmin = range[2];
  11385. this.bmax = range[3];
  11386. this.XB = blackPoint[0];
  11387. this.YB = blackPoint[1];
  11388. this.ZB = blackPoint[2];
  11389. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  11390. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  11391. }
  11392. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  11393. (0, _util.info)("Invalid BlackPoint, falling back to default");
  11394. this.XB = this.YB = this.ZB = 0;
  11395. }
  11396. if (this.amin > this.amax || this.bmin > this.bmax) {
  11397. (0, _util.info)("Invalid Range, falling back to defaults");
  11398. this.amin = -100;
  11399. this.amax = 100;
  11400. this.bmin = -100;
  11401. this.bmax = 100;
  11402. }
  11403. }
  11404. getRgbItem(src, srcOffset, dest, destOffset) {
  11405. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  11406. }
  11407. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11408. const maxVal = (1 << bits) - 1;
  11409. for (let i = 0; i < count; i++) {
  11410. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  11411. srcOffset += 3;
  11412. destOffset += 3 + alpha01;
  11413. }
  11414. }
  11415. getOutputLength(inputLength, alpha01) {
  11416. return inputLength * (3 + alpha01) / 3 | 0;
  11417. }
  11418. isDefaultDecode(decodeMap, bpc) {
  11419. return true;
  11420. }
  11421. get usesZeroToOneRange() {
  11422. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  11423. }
  11424. }
  11425. return LabCS;
  11426. }();
  11427. /***/ }),
  11428. /* 144 */
  11429. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11430. "use strict";
  11431. Object.defineProperty(exports, "__esModule", ({
  11432. value: true
  11433. }));
  11434. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  11435. var _util = __w_pdfjs_require__(2);
  11436. var _cmap = __w_pdfjs_require__(145);
  11437. var _primitives = __w_pdfjs_require__(134);
  11438. var _fonts = __w_pdfjs_require__(163);
  11439. var _fonts_utils = __w_pdfjs_require__(167);
  11440. var _encodings = __w_pdfjs_require__(166);
  11441. var _standard_fonts = __w_pdfjs_require__(170);
  11442. var _pattern = __w_pdfjs_require__(179);
  11443. var _xfa_fonts = __w_pdfjs_require__(180);
  11444. var _to_unicode_map = __w_pdfjs_require__(171);
  11445. var _function = __w_pdfjs_require__(186);
  11446. var _parser = __w_pdfjs_require__(146);
  11447. var _image_utils = __w_pdfjs_require__(188);
  11448. var _stream = __w_pdfjs_require__(139);
  11449. var _base_stream = __w_pdfjs_require__(136);
  11450. var _bidi = __w_pdfjs_require__(189);
  11451. var _colorspace = __w_pdfjs_require__(143);
  11452. var _decode_stream = __w_pdfjs_require__(148);
  11453. var _glyphlist = __w_pdfjs_require__(168);
  11454. var _core_utils = __w_pdfjs_require__(135);
  11455. var _metrics = __w_pdfjs_require__(174);
  11456. var _unicode = __w_pdfjs_require__(169);
  11457. var _murmurhash = __w_pdfjs_require__(190);
  11458. var _operator_list = __w_pdfjs_require__(191);
  11459. var _image = __w_pdfjs_require__(192);
  11460. const DefaultPartialEvaluatorOptions = Object.freeze({
  11461. maxImageSize: -1,
  11462. disableFontFace: false,
  11463. ignoreErrors: false,
  11464. isEvalSupported: true,
  11465. isOffscreenCanvasSupported: true,
  11466. fontExtraProperties: false,
  11467. useSystemFonts: true,
  11468. cMapUrl: null,
  11469. standardFontDataUrl: null
  11470. });
  11471. const PatternType = {
  11472. TILING: 1,
  11473. SHADING: 2
  11474. };
  11475. const TEXT_CHUNK_BATCH_SIZE = 10;
  11476. const deferred = Promise.resolve();
  11477. function normalizeBlendMode(value) {
  11478. let parsingArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11479. if (Array.isArray(value)) {
  11480. for (const val of value) {
  11481. const maybeBM = normalizeBlendMode(val, true);
  11482. if (maybeBM) {
  11483. return maybeBM;
  11484. }
  11485. }
  11486. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  11487. return "source-over";
  11488. }
  11489. if (!(value instanceof _primitives.Name)) {
  11490. if (parsingArray) {
  11491. return null;
  11492. }
  11493. return "source-over";
  11494. }
  11495. switch (value.name) {
  11496. case "Normal":
  11497. case "Compatible":
  11498. return "source-over";
  11499. case "Multiply":
  11500. return "multiply";
  11501. case "Screen":
  11502. return "screen";
  11503. case "Overlay":
  11504. return "overlay";
  11505. case "Darken":
  11506. return "darken";
  11507. case "Lighten":
  11508. return "lighten";
  11509. case "ColorDodge":
  11510. return "color-dodge";
  11511. case "ColorBurn":
  11512. return "color-burn";
  11513. case "HardLight":
  11514. return "hard-light";
  11515. case "SoftLight":
  11516. return "soft-light";
  11517. case "Difference":
  11518. return "difference";
  11519. case "Exclusion":
  11520. return "exclusion";
  11521. case "Hue":
  11522. return "hue";
  11523. case "Saturation":
  11524. return "saturation";
  11525. case "Color":
  11526. return "color";
  11527. case "Luminosity":
  11528. return "luminosity";
  11529. }
  11530. if (parsingArray) {
  11531. return null;
  11532. }
  11533. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  11534. return "source-over";
  11535. }
  11536. function incrementCachedImageMaskCount(data) {
  11537. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  11538. data.args[0].count++;
  11539. }
  11540. }
  11541. class TimeSlotManager {
  11542. static get TIME_SLOT_DURATION_MS() {
  11543. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  11544. }
  11545. static get CHECK_TIME_EVERY() {
  11546. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  11547. }
  11548. constructor() {
  11549. this.reset();
  11550. }
  11551. check() {
  11552. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  11553. return false;
  11554. }
  11555. this.checked = 0;
  11556. return this.endTime <= Date.now();
  11557. }
  11558. reset() {
  11559. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  11560. this.checked = 0;
  11561. }
  11562. }
  11563. class PartialEvaluator {
  11564. constructor(_ref) {
  11565. let {
  11566. xref,
  11567. handler,
  11568. pageIndex,
  11569. idFactory,
  11570. fontCache,
  11571. builtInCMapCache,
  11572. standardFontDataCache,
  11573. globalImageCache,
  11574. options = null
  11575. } = _ref;
  11576. this.xref = xref;
  11577. this.handler = handler;
  11578. this.pageIndex = pageIndex;
  11579. this.idFactory = idFactory;
  11580. this.fontCache = fontCache;
  11581. this.builtInCMapCache = builtInCMapCache;
  11582. this.standardFontDataCache = standardFontDataCache;
  11583. this.globalImageCache = globalImageCache;
  11584. this.options = options || DefaultPartialEvaluatorOptions;
  11585. this.parsingType3Font = false;
  11586. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  11587. }
  11588. get _pdfFunctionFactory() {
  11589. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  11590. xref: this.xref,
  11591. isEvalSupported: this.options.isEvalSupported
  11592. });
  11593. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  11594. }
  11595. clone() {
  11596. let newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  11597. const newEvaluator = Object.create(this);
  11598. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  11599. return newEvaluator;
  11600. }
  11601. hasBlendModes(resources, nonBlendModesSet) {
  11602. if (!(resources instanceof _primitives.Dict)) {
  11603. return false;
  11604. }
  11605. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  11606. return false;
  11607. }
  11608. const processed = new _primitives.RefSet(nonBlendModesSet);
  11609. if (resources.objId) {
  11610. processed.put(resources.objId);
  11611. }
  11612. const nodes = [resources],
  11613. xref = this.xref;
  11614. while (nodes.length) {
  11615. const node = nodes.shift();
  11616. const graphicStates = node.get("ExtGState");
  11617. if (graphicStates instanceof _primitives.Dict) {
  11618. for (let graphicState of graphicStates.getRawValues()) {
  11619. if (graphicState instanceof _primitives.Ref) {
  11620. if (processed.has(graphicState)) {
  11621. continue;
  11622. }
  11623. try {
  11624. graphicState = xref.fetch(graphicState);
  11625. } catch (ex) {
  11626. processed.put(graphicState);
  11627. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  11628. continue;
  11629. }
  11630. }
  11631. if (!(graphicState instanceof _primitives.Dict)) {
  11632. continue;
  11633. }
  11634. if (graphicState.objId) {
  11635. processed.put(graphicState.objId);
  11636. }
  11637. const bm = graphicState.get("BM");
  11638. if (bm instanceof _primitives.Name) {
  11639. if (bm.name !== "Normal") {
  11640. return true;
  11641. }
  11642. continue;
  11643. }
  11644. if (bm !== undefined && Array.isArray(bm)) {
  11645. for (const element of bm) {
  11646. if (element instanceof _primitives.Name && element.name !== "Normal") {
  11647. return true;
  11648. }
  11649. }
  11650. }
  11651. }
  11652. }
  11653. const xObjects = node.get("XObject");
  11654. if (!(xObjects instanceof _primitives.Dict)) {
  11655. continue;
  11656. }
  11657. for (let xObject of xObjects.getRawValues()) {
  11658. if (xObject instanceof _primitives.Ref) {
  11659. if (processed.has(xObject)) {
  11660. continue;
  11661. }
  11662. try {
  11663. xObject = xref.fetch(xObject);
  11664. } catch (ex) {
  11665. processed.put(xObject);
  11666. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  11667. continue;
  11668. }
  11669. }
  11670. if (!(xObject instanceof _base_stream.BaseStream)) {
  11671. continue;
  11672. }
  11673. if (xObject.dict.objId) {
  11674. processed.put(xObject.dict.objId);
  11675. }
  11676. const xResources = xObject.dict.get("Resources");
  11677. if (!(xResources instanceof _primitives.Dict)) {
  11678. continue;
  11679. }
  11680. if (xResources.objId && processed.has(xResources.objId)) {
  11681. continue;
  11682. }
  11683. nodes.push(xResources);
  11684. if (xResources.objId) {
  11685. processed.put(xResources.objId);
  11686. }
  11687. }
  11688. }
  11689. for (const ref of processed) {
  11690. nonBlendModesSet.put(ref);
  11691. }
  11692. return false;
  11693. }
  11694. async fetchBuiltInCMap(name) {
  11695. const cachedData = this.builtInCMapCache.get(name);
  11696. if (cachedData) {
  11697. return cachedData;
  11698. }
  11699. let data;
  11700. if (this.options.cMapUrl !== null) {
  11701. const url = `${this.options.cMapUrl}${name}.bcmap`;
  11702. const response = await fetch(url);
  11703. if (!response.ok) {
  11704. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  11705. }
  11706. data = {
  11707. cMapData: new Uint8Array(await response.arrayBuffer()),
  11708. compressionType: _util.CMapCompressionType.BINARY
  11709. };
  11710. } else {
  11711. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  11712. name
  11713. });
  11714. }
  11715. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  11716. this.builtInCMapCache.set(name, data);
  11717. }
  11718. return data;
  11719. }
  11720. async fetchStandardFontData(name) {
  11721. const cachedData = this.standardFontDataCache.get(name);
  11722. if (cachedData) {
  11723. return new _stream.Stream(cachedData);
  11724. }
  11725. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  11726. return null;
  11727. }
  11728. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  11729. filename = standardFontNameToFileName[name];
  11730. let data;
  11731. if (this.options.standardFontDataUrl !== null) {
  11732. const url = `${this.options.standardFontDataUrl}${filename}`;
  11733. const response = await fetch(url);
  11734. if (!response.ok) {
  11735. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  11736. } else {
  11737. data = await response.arrayBuffer();
  11738. }
  11739. } else {
  11740. try {
  11741. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  11742. filename
  11743. });
  11744. } catch (e) {
  11745. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  11746. }
  11747. }
  11748. if (!data) {
  11749. return null;
  11750. }
  11751. this.standardFontDataCache.set(name, data);
  11752. return new _stream.Stream(data);
  11753. }
  11754. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  11755. const dict = xobj.dict;
  11756. const matrix = dict.getArray("Matrix");
  11757. let bbox = dict.getArray("BBox");
  11758. if (Array.isArray(bbox) && bbox.length === 4) {
  11759. bbox = _util.Util.normalizeRect(bbox);
  11760. } else {
  11761. bbox = null;
  11762. }
  11763. let optionalContent, groupOptions;
  11764. if (dict.has("OC")) {
  11765. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11766. }
  11767. if (optionalContent !== undefined) {
  11768. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  11769. }
  11770. const group = dict.get("Group");
  11771. if (group) {
  11772. groupOptions = {
  11773. matrix,
  11774. bbox,
  11775. smask,
  11776. isolated: false,
  11777. knockout: false
  11778. };
  11779. const groupSubtype = group.get("S");
  11780. let colorSpace = null;
  11781. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  11782. groupOptions.isolated = group.get("I") || false;
  11783. groupOptions.knockout = group.get("K") || false;
  11784. if (group.has("CS")) {
  11785. const cs = group.getRaw("CS");
  11786. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  11787. if (cachedColorSpace) {
  11788. colorSpace = cachedColorSpace;
  11789. } else {
  11790. colorSpace = await this.parseColorSpace({
  11791. cs,
  11792. resources,
  11793. localColorSpaceCache
  11794. });
  11795. }
  11796. }
  11797. }
  11798. if (smask && smask.backdrop) {
  11799. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  11800. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  11801. }
  11802. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  11803. }
  11804. const args = group ? [matrix, null] : [matrix, bbox];
  11805. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  11806. return this.getOperatorList({
  11807. stream: xobj,
  11808. task,
  11809. resources: dict.get("Resources") || resources,
  11810. operatorList,
  11811. initialState
  11812. }).then(function () {
  11813. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  11814. if (group) {
  11815. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  11816. }
  11817. if (optionalContent !== undefined) {
  11818. operatorList.addOp(_util.OPS.endMarkedContent, []);
  11819. }
  11820. });
  11821. }
  11822. _sendImgData(objId, imgData) {
  11823. let cacheGlobally = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  11824. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  11825. if (this.parsingType3Font || cacheGlobally) {
  11826. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  11827. }
  11828. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  11829. }
  11830. async buildPaintImageXObject(_ref2) {
  11831. let {
  11832. resources,
  11833. image,
  11834. isInline = false,
  11835. operatorList,
  11836. cacheKey,
  11837. localImageCache,
  11838. localColorSpaceCache
  11839. } = _ref2;
  11840. const dict = image.dict;
  11841. const imageRef = dict.objId;
  11842. const w = dict.get("W", "Width");
  11843. const h = dict.get("H", "Height");
  11844. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  11845. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  11846. return;
  11847. }
  11848. const maxImageSize = this.options.maxImageSize;
  11849. if (maxImageSize !== -1 && w * h > maxImageSize) {
  11850. const msg = "Image exceeded maximum allowed size and was removed.";
  11851. if (this.options.ignoreErrors) {
  11852. (0, _util.warn)(msg);
  11853. return;
  11854. }
  11855. throw new Error(msg);
  11856. }
  11857. let optionalContent;
  11858. if (dict.has("OC")) {
  11859. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11860. }
  11861. const imageMask = dict.get("IM", "ImageMask") || false;
  11862. let imgData, args;
  11863. if (imageMask) {
  11864. const interpolate = dict.get("I", "Interpolate");
  11865. const bitStrideLength = w + 7 >> 3;
  11866. const imgArray = image.getBytes(bitStrideLength * h);
  11867. const decode = dict.getArray("D", "Decode");
  11868. if (this.parsingType3Font) {
  11869. imgData = _image.PDFImage.createRawMask({
  11870. imgArray,
  11871. width: w,
  11872. height: h,
  11873. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11874. inverseDecode: !!decode && decode[0] > 0,
  11875. interpolate
  11876. });
  11877. imgData.cached = !!cacheKey;
  11878. args = [imgData];
  11879. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11880. if (cacheKey) {
  11881. localImageCache.set(cacheKey, imageRef, {
  11882. fn: _util.OPS.paintImageMaskXObject,
  11883. args,
  11884. optionalContent
  11885. });
  11886. }
  11887. return;
  11888. }
  11889. imgData = _image.PDFImage.createMask({
  11890. imgArray,
  11891. width: w,
  11892. height: h,
  11893. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11894. inverseDecode: !!decode && decode[0] > 0,
  11895. interpolate,
  11896. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  11897. });
  11898. if (imgData.isSingleOpaquePixel) {
  11899. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  11900. if (cacheKey) {
  11901. localImageCache.set(cacheKey, imageRef, {
  11902. fn: _util.OPS.paintSolidColorImageMask,
  11903. args: [],
  11904. optionalContent
  11905. });
  11906. }
  11907. return;
  11908. }
  11909. const objId = `mask_${this.idFactory.createObjId()}`;
  11910. operatorList.addDependency(objId);
  11911. this._sendImgData(objId, imgData);
  11912. args = [{
  11913. data: objId,
  11914. width: imgData.width,
  11915. height: imgData.height,
  11916. interpolate: imgData.interpolate,
  11917. count: 1
  11918. }];
  11919. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11920. if (cacheKey) {
  11921. localImageCache.set(cacheKey, imageRef, {
  11922. fn: _util.OPS.paintImageMaskXObject,
  11923. args,
  11924. optionalContent
  11925. });
  11926. }
  11927. return;
  11928. }
  11929. const softMask = dict.get("SM", "SMask") || false;
  11930. const mask = dict.get("Mask") || false;
  11931. const SMALL_IMAGE_DIMENSIONS = 200;
  11932. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  11933. const imageObj = new _image.PDFImage({
  11934. xref: this.xref,
  11935. res: resources,
  11936. image,
  11937. isInline,
  11938. pdfFunctionFactory: this._pdfFunctionFactory,
  11939. localColorSpaceCache
  11940. });
  11941. imgData = imageObj.createImageData(true);
  11942. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  11943. return;
  11944. }
  11945. let objId = `img_${this.idFactory.createObjId()}`,
  11946. cacheGlobally = false;
  11947. if (this.parsingType3Font) {
  11948. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  11949. } else if (imageRef) {
  11950. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  11951. if (cacheGlobally) {
  11952. objId = `${this.idFactory.getDocId()}_${objId}`;
  11953. }
  11954. }
  11955. operatorList.addDependency(objId);
  11956. args = [objId, w, h];
  11957. _image.PDFImage.buildImage({
  11958. xref: this.xref,
  11959. res: resources,
  11960. image,
  11961. isInline,
  11962. pdfFunctionFactory: this._pdfFunctionFactory,
  11963. localColorSpaceCache
  11964. }).then(imageObj => {
  11965. imgData = imageObj.createImageData(false);
  11966. if (cacheKey && imageRef && cacheGlobally) {
  11967. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  11968. }
  11969. return this._sendImgData(objId, imgData, cacheGlobally);
  11970. }).catch(reason => {
  11971. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  11972. return this._sendImgData(objId, null, cacheGlobally);
  11973. });
  11974. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  11975. if (cacheKey) {
  11976. localImageCache.set(cacheKey, imageRef, {
  11977. fn: _util.OPS.paintImageXObject,
  11978. args,
  11979. optionalContent
  11980. });
  11981. if (imageRef) {
  11982. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  11983. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  11984. if (cacheGlobally) {
  11985. this.globalImageCache.setData(imageRef, {
  11986. objId,
  11987. fn: _util.OPS.paintImageXObject,
  11988. args,
  11989. optionalContent,
  11990. byteSize: 0
  11991. });
  11992. }
  11993. }
  11994. }
  11995. }
  11996. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  11997. const smaskContent = smask.get("G");
  11998. const smaskOptions = {
  11999. subtype: smask.get("S").name,
  12000. backdrop: smask.get("BC")
  12001. };
  12002. const transferObj = smask.get("TR");
  12003. if ((0, _function.isPDFFunction)(transferObj)) {
  12004. const transferFn = this._pdfFunctionFactory.create(transferObj);
  12005. const transferMap = new Uint8Array(256);
  12006. const tmp = new Float32Array(1);
  12007. for (let i = 0; i < 256; i++) {
  12008. tmp[0] = i / 255;
  12009. transferFn(tmp, 0, tmp, 0);
  12010. transferMap[i] = tmp[0] * 255 | 0;
  12011. }
  12012. smaskOptions.transferMap = transferMap;
  12013. }
  12014. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  12015. }
  12016. handleTransferFunction(tr) {
  12017. let transferArray;
  12018. if (Array.isArray(tr)) {
  12019. transferArray = tr;
  12020. } else if ((0, _function.isPDFFunction)(tr)) {
  12021. transferArray = [tr];
  12022. } else {
  12023. return null;
  12024. }
  12025. const transferMaps = [];
  12026. let numFns = 0,
  12027. numEffectfulFns = 0;
  12028. for (const entry of transferArray) {
  12029. const transferObj = this.xref.fetchIfRef(entry);
  12030. numFns++;
  12031. if ((0, _primitives.isName)(transferObj, "Identity")) {
  12032. transferMaps.push(null);
  12033. continue;
  12034. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  12035. return null;
  12036. }
  12037. const transferFn = this._pdfFunctionFactory.create(transferObj);
  12038. const transferMap = new Uint8Array(256),
  12039. tmp = new Float32Array(1);
  12040. for (let j = 0; j < 256; j++) {
  12041. tmp[0] = j / 255;
  12042. transferFn(tmp, 0, tmp, 0);
  12043. transferMap[j] = tmp[0] * 255 | 0;
  12044. }
  12045. transferMaps.push(transferMap);
  12046. numEffectfulFns++;
  12047. }
  12048. if (!(numFns === 1 || numFns === 4)) {
  12049. return null;
  12050. }
  12051. if (numEffectfulFns === 0) {
  12052. return null;
  12053. }
  12054. return transferMaps;
  12055. }
  12056. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  12057. const tilingOpList = new _operator_list.OperatorList();
  12058. const patternResources = _primitives.Dict.merge({
  12059. xref: this.xref,
  12060. dictArray: [patternDict.get("Resources"), resources]
  12061. });
  12062. return this.getOperatorList({
  12063. stream: pattern,
  12064. task,
  12065. resources: patternResources,
  12066. operatorList: tilingOpList
  12067. }).then(function () {
  12068. const operatorListIR = tilingOpList.getIR();
  12069. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  12070. operatorList.addDependencies(tilingOpList.dependencies);
  12071. operatorList.addOp(fn, tilingPatternIR);
  12072. if (patternDict.objId) {
  12073. localTilingPatternCache.set(null, patternDict.objId, {
  12074. operatorListIR,
  12075. dict: patternDict
  12076. });
  12077. }
  12078. }).catch(reason => {
  12079. if (reason instanceof _util.AbortException) {
  12080. return;
  12081. }
  12082. if (this.options.ignoreErrors) {
  12083. this.handler.send("UnsupportedFeature", {
  12084. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  12085. });
  12086. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  12087. return;
  12088. }
  12089. throw reason;
  12090. });
  12091. }
  12092. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  12093. let fallbackFontDict = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  12094. let cssFontInfo = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  12095. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  12096. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  12097. if (!translated.font.isType3Font) {
  12098. return translated;
  12099. }
  12100. return translated.loadType3Data(this, resources, task).then(function () {
  12101. operatorList.addDependencies(translated.type3Dependencies);
  12102. return translated;
  12103. }).catch(reason => {
  12104. this.handler.send("UnsupportedFeature", {
  12105. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  12106. });
  12107. return new TranslatedFont({
  12108. loadedName: "g_font_error",
  12109. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  12110. dict: translated.font,
  12111. evaluatorOptions: this.options
  12112. });
  12113. });
  12114. }).then(translated => {
  12115. state.font = translated.font;
  12116. translated.send(this.handler);
  12117. return translated.loadedName;
  12118. });
  12119. }
  12120. handleText(chars, state) {
  12121. const font = state.font;
  12122. const glyphs = font.charsToGlyphs(chars);
  12123. if (font.data) {
  12124. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  12125. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  12126. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  12127. }
  12128. }
  12129. return glyphs;
  12130. }
  12131. ensureStateFont(state) {
  12132. if (state.font) {
  12133. return;
  12134. }
  12135. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  12136. if (this.options.ignoreErrors) {
  12137. this.handler.send("UnsupportedFeature", {
  12138. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  12139. });
  12140. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  12141. return;
  12142. }
  12143. throw reason;
  12144. }
  12145. async setGState(_ref3) {
  12146. let {
  12147. resources,
  12148. gState,
  12149. operatorList,
  12150. cacheKey,
  12151. task,
  12152. stateManager,
  12153. localGStateCache,
  12154. localColorSpaceCache
  12155. } = _ref3;
  12156. const gStateRef = gState.objId;
  12157. let isSimpleGState = true;
  12158. const gStateObj = [];
  12159. let promise = Promise.resolve();
  12160. for (const key of gState.getKeys()) {
  12161. const value = gState.get(key);
  12162. switch (key) {
  12163. case "Type":
  12164. break;
  12165. case "LW":
  12166. case "LC":
  12167. case "LJ":
  12168. case "ML":
  12169. case "D":
  12170. case "RI":
  12171. case "FL":
  12172. case "CA":
  12173. case "ca":
  12174. gStateObj.push([key, value]);
  12175. break;
  12176. case "Font":
  12177. isSimpleGState = false;
  12178. promise = promise.then(() => {
  12179. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  12180. operatorList.addDependency(loadedName);
  12181. gStateObj.push([key, [loadedName, value[1]]]);
  12182. });
  12183. });
  12184. break;
  12185. case "BM":
  12186. gStateObj.push([key, normalizeBlendMode(value)]);
  12187. break;
  12188. case "SMask":
  12189. if ((0, _primitives.isName)(value, "None")) {
  12190. gStateObj.push([key, false]);
  12191. break;
  12192. }
  12193. if (value instanceof _primitives.Dict) {
  12194. isSimpleGState = false;
  12195. promise = promise.then(() => {
  12196. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  12197. });
  12198. gStateObj.push([key, true]);
  12199. } else {
  12200. (0, _util.warn)("Unsupported SMask type");
  12201. }
  12202. break;
  12203. case "TR":
  12204. const transferMaps = this.handleTransferFunction(value);
  12205. gStateObj.push([key, transferMaps]);
  12206. break;
  12207. case "OP":
  12208. case "op":
  12209. case "OPM":
  12210. case "BG":
  12211. case "BG2":
  12212. case "UCR":
  12213. case "UCR2":
  12214. case "TR2":
  12215. case "HT":
  12216. case "SM":
  12217. case "SA":
  12218. case "AIS":
  12219. case "TK":
  12220. (0, _util.info)("graphic state operator " + key);
  12221. break;
  12222. default:
  12223. (0, _util.info)("Unknown graphic state operator " + key);
  12224. break;
  12225. }
  12226. }
  12227. return promise.then(function () {
  12228. if (gStateObj.length > 0) {
  12229. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  12230. }
  12231. if (isSimpleGState) {
  12232. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  12233. }
  12234. });
  12235. }
  12236. loadFont(fontName, font, resources) {
  12237. let fallbackFontDict = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  12238. let cssFontInfo = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  12239. const errorFont = async () => {
  12240. return new TranslatedFont({
  12241. loadedName: "g_font_error",
  12242. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  12243. dict: font,
  12244. evaluatorOptions: this.options
  12245. });
  12246. };
  12247. const xref = this.xref;
  12248. let fontRef;
  12249. if (font) {
  12250. if (font instanceof _primitives.Ref) {
  12251. fontRef = font;
  12252. }
  12253. } else {
  12254. const fontRes = resources.get("Font");
  12255. if (fontRes) {
  12256. fontRef = fontRes.getRaw(fontName);
  12257. }
  12258. }
  12259. if (!fontRef) {
  12260. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  12261. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  12262. (0, _util.warn)(`${partialMsg}.`);
  12263. return errorFont();
  12264. }
  12265. this.handler.send("UnsupportedFeature", {
  12266. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  12267. });
  12268. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  12269. if (fallbackFontDict) {
  12270. fontRef = fallbackFontDict;
  12271. } else {
  12272. fontRef = PartialEvaluator.fallbackFontDict;
  12273. }
  12274. }
  12275. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  12276. return errorFont();
  12277. }
  12278. if (this.fontCache.has(fontRef)) {
  12279. return this.fontCache.get(fontRef);
  12280. }
  12281. font = xref.fetchIfRef(fontRef);
  12282. if (!(font instanceof _primitives.Dict)) {
  12283. return errorFont();
  12284. }
  12285. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  12286. return this.fontCache.get(font.cacheKey);
  12287. }
  12288. const fontCapability = (0, _util.createPromiseCapability)();
  12289. let preEvaluatedFont;
  12290. try {
  12291. preEvaluatedFont = this.preEvaluateFont(font);
  12292. preEvaluatedFont.cssFontInfo = cssFontInfo;
  12293. } catch (reason) {
  12294. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  12295. return errorFont();
  12296. }
  12297. const {
  12298. descriptor,
  12299. hash
  12300. } = preEvaluatedFont;
  12301. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  12302. let fontID;
  12303. if (fontRefIsRef) {
  12304. fontID = `f${fontRef.toString()}`;
  12305. }
  12306. if (hash && descriptor instanceof _primitives.Dict) {
  12307. if (!descriptor.fontAliases) {
  12308. descriptor.fontAliases = Object.create(null);
  12309. }
  12310. const fontAliases = descriptor.fontAliases;
  12311. if (fontAliases[hash]) {
  12312. const aliasFontRef = fontAliases[hash].aliasRef;
  12313. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  12314. this.fontCache.putAlias(fontRef, aliasFontRef);
  12315. return this.fontCache.get(fontRef);
  12316. }
  12317. } else {
  12318. fontAliases[hash] = {
  12319. fontID: this.idFactory.createFontId()
  12320. };
  12321. }
  12322. if (fontRefIsRef) {
  12323. fontAliases[hash].aliasRef = fontRef;
  12324. }
  12325. fontID = fontAliases[hash].fontID;
  12326. }
  12327. if (fontRefIsRef) {
  12328. this.fontCache.put(fontRef, fontCapability.promise);
  12329. } else {
  12330. if (!fontID) {
  12331. fontID = this.idFactory.createFontId();
  12332. }
  12333. font.cacheKey = `cacheKey_${fontID}`;
  12334. this.fontCache.put(font.cacheKey, fontCapability.promise);
  12335. }
  12336. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  12337. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  12338. this.translateFont(preEvaluatedFont).then(translatedFont => {
  12339. if (translatedFont.fontType !== undefined) {
  12340. xref.stats.addFontType(translatedFont.fontType);
  12341. }
  12342. fontCapability.resolve(new TranslatedFont({
  12343. loadedName: font.loadedName,
  12344. font: translatedFont,
  12345. dict: font,
  12346. evaluatorOptions: this.options
  12347. }));
  12348. }).catch(reason => {
  12349. this.handler.send("UnsupportedFeature", {
  12350. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  12351. });
  12352. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  12353. try {
  12354. const fontFile3 = descriptor && descriptor.get("FontFile3");
  12355. const subtype = fontFile3 && fontFile3.get("Subtype");
  12356. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  12357. if (fontType !== undefined) {
  12358. xref.stats.addFontType(fontType);
  12359. }
  12360. } catch (ex) {}
  12361. fontCapability.resolve(new TranslatedFont({
  12362. loadedName: font.loadedName,
  12363. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  12364. dict: font,
  12365. evaluatorOptions: this.options
  12366. }));
  12367. });
  12368. return fontCapability.promise;
  12369. }
  12370. buildPath(operatorList, fn, args) {
  12371. let parsingText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  12372. const lastIndex = operatorList.length - 1;
  12373. if (!args) {
  12374. args = [];
  12375. }
  12376. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  12377. if (parsingText) {
  12378. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  12379. operatorList.addOp(_util.OPS.save, null);
  12380. }
  12381. let minMax;
  12382. switch (fn) {
  12383. case _util.OPS.rectangle:
  12384. const x = args[0] + args[2];
  12385. const y = args[1] + args[3];
  12386. minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)];
  12387. break;
  12388. case _util.OPS.moveTo:
  12389. case _util.OPS.lineTo:
  12390. minMax = [args[0], args[0], args[1], args[1]];
  12391. break;
  12392. default:
  12393. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  12394. break;
  12395. }
  12396. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  12397. if (parsingText) {
  12398. operatorList.addOp(_util.OPS.restore, null);
  12399. }
  12400. } else {
  12401. const opArgs = operatorList.argsArray[lastIndex];
  12402. opArgs[0].push(fn);
  12403. opArgs[1].push(...args);
  12404. const minMax = opArgs[2];
  12405. switch (fn) {
  12406. case _util.OPS.rectangle:
  12407. const x = args[0] + args[2];
  12408. const y = args[1] + args[3];
  12409. minMax[0] = Math.min(minMax[0], args[0], x);
  12410. minMax[1] = Math.max(minMax[1], args[0], x);
  12411. minMax[2] = Math.min(minMax[2], args[1], y);
  12412. minMax[3] = Math.max(minMax[3], args[1], y);
  12413. break;
  12414. case _util.OPS.moveTo:
  12415. case _util.OPS.lineTo:
  12416. minMax[0] = Math.min(minMax[0], args[0]);
  12417. minMax[1] = Math.max(minMax[1], args[0]);
  12418. minMax[2] = Math.min(minMax[2], args[1]);
  12419. minMax[3] = Math.max(minMax[3], args[1]);
  12420. break;
  12421. }
  12422. }
  12423. }
  12424. parseColorSpace(_ref4) {
  12425. let {
  12426. cs,
  12427. resources,
  12428. localColorSpaceCache
  12429. } = _ref4;
  12430. return _colorspace.ColorSpace.parseAsync({
  12431. cs,
  12432. xref: this.xref,
  12433. resources,
  12434. pdfFunctionFactory: this._pdfFunctionFactory,
  12435. localColorSpaceCache
  12436. }).catch(reason => {
  12437. if (reason instanceof _util.AbortException) {
  12438. return null;
  12439. }
  12440. if (this.options.ignoreErrors) {
  12441. this.handler.send("UnsupportedFeature", {
  12442. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  12443. });
  12444. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  12445. return null;
  12446. }
  12447. throw reason;
  12448. });
  12449. }
  12450. parseShading(_ref5) {
  12451. let {
  12452. shading,
  12453. resources,
  12454. localColorSpaceCache,
  12455. localShadingPatternCache
  12456. } = _ref5;
  12457. let id = localShadingPatternCache.get(shading);
  12458. if (!id) {
  12459. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  12460. const patternIR = shadingFill.getIR();
  12461. id = `pattern_${this.idFactory.createObjId()}`;
  12462. localShadingPatternCache.set(shading, id);
  12463. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  12464. }
  12465. return id;
  12466. }
  12467. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  12468. const patternName = args.pop();
  12469. if (patternName instanceof _primitives.Name) {
  12470. const rawPattern = patterns.getRaw(patternName.name);
  12471. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  12472. if (localTilingPattern) {
  12473. try {
  12474. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12475. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  12476. operatorList.addOp(fn, tilingPatternIR);
  12477. return undefined;
  12478. } catch (ex) {}
  12479. }
  12480. const pattern = this.xref.fetchIfRef(rawPattern);
  12481. if (pattern) {
  12482. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  12483. const typeNum = dict.get("PatternType");
  12484. if (typeNum === PatternType.TILING) {
  12485. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12486. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  12487. } else if (typeNum === PatternType.SHADING) {
  12488. const shading = dict.get("Shading");
  12489. const matrix = dict.getArray("Matrix");
  12490. const objId = this.parseShading({
  12491. shading,
  12492. resources,
  12493. localColorSpaceCache,
  12494. localShadingPatternCache
  12495. });
  12496. operatorList.addOp(fn, ["Shading", objId, matrix]);
  12497. return undefined;
  12498. }
  12499. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  12500. }
  12501. }
  12502. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  12503. }
  12504. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  12505. const MAX_NESTING = 10;
  12506. if (++nestingCounter > MAX_NESTING) {
  12507. (0, _util.warn)("Visibility expression is too deeply nested");
  12508. return;
  12509. }
  12510. const length = array.length;
  12511. const operator = this.xref.fetchIfRef(array[0]);
  12512. if (length < 2 || !(operator instanceof _primitives.Name)) {
  12513. (0, _util.warn)("Invalid visibility expression");
  12514. return;
  12515. }
  12516. switch (operator.name) {
  12517. case "And":
  12518. case "Or":
  12519. case "Not":
  12520. currentResult.push(operator.name);
  12521. break;
  12522. default:
  12523. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  12524. return;
  12525. }
  12526. for (let i = 1; i < length; i++) {
  12527. const raw = array[i];
  12528. const object = this.xref.fetchIfRef(raw);
  12529. if (Array.isArray(object)) {
  12530. const nestedResult = [];
  12531. currentResult.push(nestedResult);
  12532. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  12533. } else if (raw instanceof _primitives.Ref) {
  12534. currentResult.push(raw.toString());
  12535. }
  12536. }
  12537. }
  12538. async parseMarkedContentProps(contentProperties, resources) {
  12539. let optionalContent;
  12540. if (contentProperties instanceof _primitives.Name) {
  12541. const properties = resources.get("Properties");
  12542. optionalContent = properties.get(contentProperties.name);
  12543. } else if (contentProperties instanceof _primitives.Dict) {
  12544. optionalContent = contentProperties;
  12545. } else {
  12546. throw new _util.FormatError("Optional content properties malformed.");
  12547. }
  12548. const optionalContentType = optionalContent.get("Type").name;
  12549. if (optionalContentType === "OCG") {
  12550. return {
  12551. type: optionalContentType,
  12552. id: optionalContent.objId
  12553. };
  12554. } else if (optionalContentType === "OCMD") {
  12555. const expression = optionalContent.get("VE");
  12556. if (Array.isArray(expression)) {
  12557. const result = [];
  12558. this._parseVisibilityExpression(expression, 0, result);
  12559. if (result.length > 0) {
  12560. return {
  12561. type: "OCMD",
  12562. expression: result
  12563. };
  12564. }
  12565. }
  12566. const optionalContentGroups = optionalContent.get("OCGs");
  12567. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  12568. const groupIds = [];
  12569. if (Array.isArray(optionalContentGroups)) {
  12570. for (const ocg of optionalContentGroups) {
  12571. groupIds.push(ocg.toString());
  12572. }
  12573. } else {
  12574. groupIds.push(optionalContentGroups.objId);
  12575. }
  12576. return {
  12577. type: optionalContentType,
  12578. ids: groupIds,
  12579. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  12580. expression: null
  12581. };
  12582. } else if (optionalContentGroups instanceof _primitives.Ref) {
  12583. return {
  12584. type: optionalContentType,
  12585. id: optionalContentGroups.toString()
  12586. };
  12587. }
  12588. }
  12589. return null;
  12590. }
  12591. getOperatorList(_ref6) {
  12592. let {
  12593. stream,
  12594. task,
  12595. resources,
  12596. operatorList,
  12597. initialState = null,
  12598. fallbackFontDict = null
  12599. } = _ref6;
  12600. resources = resources || _primitives.Dict.empty;
  12601. initialState = initialState || new EvalState();
  12602. if (!operatorList) {
  12603. throw new Error('getOperatorList: missing "operatorList" parameter');
  12604. }
  12605. const self = this;
  12606. const xref = this.xref;
  12607. let parsingText = false;
  12608. const localImageCache = new _image_utils.LocalImageCache();
  12609. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  12610. const localGStateCache = new _image_utils.LocalGStateCache();
  12611. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  12612. const localShadingPatternCache = new Map();
  12613. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  12614. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  12615. const stateManager = new StateManager(initialState);
  12616. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  12617. const timeSlotManager = new TimeSlotManager();
  12618. function closePendingRestoreOPS(argument) {
  12619. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  12620. operatorList.addOp(_util.OPS.restore, []);
  12621. }
  12622. }
  12623. return new Promise(function promiseBody(resolve, reject) {
  12624. const next = function (promise) {
  12625. Promise.all([promise, operatorList.ready]).then(function () {
  12626. try {
  12627. promiseBody(resolve, reject);
  12628. } catch (ex) {
  12629. reject(ex);
  12630. }
  12631. }, reject);
  12632. };
  12633. task.ensureNotTerminated();
  12634. timeSlotManager.reset();
  12635. const operation = {};
  12636. let stop, i, ii, cs, name, isValidName;
  12637. while (!(stop = timeSlotManager.check())) {
  12638. operation.args = null;
  12639. if (!preprocessor.read(operation)) {
  12640. break;
  12641. }
  12642. let args = operation.args;
  12643. let fn = operation.fn;
  12644. switch (fn | 0) {
  12645. case _util.OPS.paintXObject:
  12646. isValidName = args[0] instanceof _primitives.Name;
  12647. name = args[0].name;
  12648. if (isValidName) {
  12649. const localImage = localImageCache.getByName(name);
  12650. if (localImage) {
  12651. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12652. incrementCachedImageMaskCount(localImage);
  12653. args = null;
  12654. continue;
  12655. }
  12656. }
  12657. next(new Promise(function (resolveXObject, rejectXObject) {
  12658. if (!isValidName) {
  12659. throw new _util.FormatError("XObject must be referred to by name.");
  12660. }
  12661. let xobj = xobjs.getRaw(name);
  12662. if (xobj instanceof _primitives.Ref) {
  12663. const localImage = localImageCache.getByRef(xobj);
  12664. if (localImage) {
  12665. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12666. incrementCachedImageMaskCount(localImage);
  12667. resolveXObject();
  12668. return;
  12669. }
  12670. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  12671. if (globalImage) {
  12672. operatorList.addDependency(globalImage.objId);
  12673. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  12674. resolveXObject();
  12675. return;
  12676. }
  12677. xobj = xref.fetch(xobj);
  12678. }
  12679. if (!(xobj instanceof _base_stream.BaseStream)) {
  12680. throw new _util.FormatError("XObject should be a stream");
  12681. }
  12682. const type = xobj.dict.get("Subtype");
  12683. if (!(type instanceof _primitives.Name)) {
  12684. throw new _util.FormatError("XObject should have a Name subtype");
  12685. }
  12686. if (type.name === "Form") {
  12687. stateManager.save();
  12688. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  12689. stateManager.restore();
  12690. resolveXObject();
  12691. }, rejectXObject);
  12692. return;
  12693. } else if (type.name === "Image") {
  12694. self.buildPaintImageXObject({
  12695. resources,
  12696. image: xobj,
  12697. operatorList,
  12698. cacheKey: name,
  12699. localImageCache,
  12700. localColorSpaceCache
  12701. }).then(resolveXObject, rejectXObject);
  12702. return;
  12703. } else if (type.name === "PS") {
  12704. (0, _util.info)("Ignored XObject subtype PS");
  12705. } else {
  12706. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  12707. }
  12708. resolveXObject();
  12709. }).catch(function (reason) {
  12710. if (reason instanceof _util.AbortException) {
  12711. return;
  12712. }
  12713. if (self.options.ignoreErrors) {
  12714. self.handler.send("UnsupportedFeature", {
  12715. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  12716. });
  12717. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  12718. return;
  12719. }
  12720. throw reason;
  12721. }));
  12722. return;
  12723. case _util.OPS.setFont:
  12724. var fontSize = args[1];
  12725. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  12726. operatorList.addDependency(loadedName);
  12727. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  12728. }));
  12729. return;
  12730. case _util.OPS.beginText:
  12731. parsingText = true;
  12732. break;
  12733. case _util.OPS.endText:
  12734. parsingText = false;
  12735. break;
  12736. case _util.OPS.endInlineImage:
  12737. var cacheKey = args[0].cacheKey;
  12738. if (cacheKey) {
  12739. const localImage = localImageCache.getByName(cacheKey);
  12740. if (localImage) {
  12741. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12742. incrementCachedImageMaskCount(localImage);
  12743. args = null;
  12744. continue;
  12745. }
  12746. }
  12747. next(self.buildPaintImageXObject({
  12748. resources,
  12749. image: args[0],
  12750. isInline: true,
  12751. operatorList,
  12752. cacheKey,
  12753. localImageCache,
  12754. localColorSpaceCache
  12755. }));
  12756. return;
  12757. case _util.OPS.showText:
  12758. if (!stateManager.state.font) {
  12759. self.ensureStateFont(stateManager.state);
  12760. continue;
  12761. }
  12762. args[0] = self.handleText(args[0], stateManager.state);
  12763. break;
  12764. case _util.OPS.showSpacedText:
  12765. if (!stateManager.state.font) {
  12766. self.ensureStateFont(stateManager.state);
  12767. continue;
  12768. }
  12769. var combinedGlyphs = [];
  12770. var state = stateManager.state;
  12771. for (const arrItem of args[0]) {
  12772. if (typeof arrItem === "string") {
  12773. combinedGlyphs.push(...self.handleText(arrItem, state));
  12774. } else if (typeof arrItem === "number") {
  12775. combinedGlyphs.push(arrItem);
  12776. }
  12777. }
  12778. args[0] = combinedGlyphs;
  12779. fn = _util.OPS.showText;
  12780. break;
  12781. case _util.OPS.nextLineShowText:
  12782. if (!stateManager.state.font) {
  12783. self.ensureStateFont(stateManager.state);
  12784. continue;
  12785. }
  12786. operatorList.addOp(_util.OPS.nextLine);
  12787. args[0] = self.handleText(args[0], stateManager.state);
  12788. fn = _util.OPS.showText;
  12789. break;
  12790. case _util.OPS.nextLineSetSpacingShowText:
  12791. if (!stateManager.state.font) {
  12792. self.ensureStateFont(stateManager.state);
  12793. continue;
  12794. }
  12795. operatorList.addOp(_util.OPS.nextLine);
  12796. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  12797. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  12798. args[0] = self.handleText(args[0], stateManager.state);
  12799. fn = _util.OPS.showText;
  12800. break;
  12801. case _util.OPS.setTextRenderingMode:
  12802. stateManager.state.textRenderingMode = args[0];
  12803. break;
  12804. case _util.OPS.setFillColorSpace:
  12805. {
  12806. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12807. if (cachedColorSpace) {
  12808. stateManager.state.fillColorSpace = cachedColorSpace;
  12809. continue;
  12810. }
  12811. next(self.parseColorSpace({
  12812. cs: args[0],
  12813. resources,
  12814. localColorSpaceCache
  12815. }).then(function (colorSpace) {
  12816. if (colorSpace) {
  12817. stateManager.state.fillColorSpace = colorSpace;
  12818. }
  12819. }));
  12820. return;
  12821. }
  12822. case _util.OPS.setStrokeColorSpace:
  12823. {
  12824. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12825. if (cachedColorSpace) {
  12826. stateManager.state.strokeColorSpace = cachedColorSpace;
  12827. continue;
  12828. }
  12829. next(self.parseColorSpace({
  12830. cs: args[0],
  12831. resources,
  12832. localColorSpaceCache
  12833. }).then(function (colorSpace) {
  12834. if (colorSpace) {
  12835. stateManager.state.strokeColorSpace = colorSpace;
  12836. }
  12837. }));
  12838. return;
  12839. }
  12840. case _util.OPS.setFillColor:
  12841. cs = stateManager.state.fillColorSpace;
  12842. args = cs.getRgb(args, 0);
  12843. fn = _util.OPS.setFillRGBColor;
  12844. break;
  12845. case _util.OPS.setStrokeColor:
  12846. cs = stateManager.state.strokeColorSpace;
  12847. args = cs.getRgb(args, 0);
  12848. fn = _util.OPS.setStrokeRGBColor;
  12849. break;
  12850. case _util.OPS.setFillGray:
  12851. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  12852. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12853. fn = _util.OPS.setFillRGBColor;
  12854. break;
  12855. case _util.OPS.setStrokeGray:
  12856. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  12857. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12858. fn = _util.OPS.setStrokeRGBColor;
  12859. break;
  12860. case _util.OPS.setFillCMYKColor:
  12861. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12862. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12863. fn = _util.OPS.setFillRGBColor;
  12864. break;
  12865. case _util.OPS.setStrokeCMYKColor:
  12866. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12867. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12868. fn = _util.OPS.setStrokeRGBColor;
  12869. break;
  12870. case _util.OPS.setFillRGBColor:
  12871. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12872. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12873. break;
  12874. case _util.OPS.setStrokeRGBColor:
  12875. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12876. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12877. break;
  12878. case _util.OPS.setFillColorN:
  12879. cs = stateManager.state.fillColorSpace;
  12880. if (cs.name === "Pattern") {
  12881. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12882. return;
  12883. }
  12884. args = cs.getRgb(args, 0);
  12885. fn = _util.OPS.setFillRGBColor;
  12886. break;
  12887. case _util.OPS.setStrokeColorN:
  12888. cs = stateManager.state.strokeColorSpace;
  12889. if (cs.name === "Pattern") {
  12890. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12891. return;
  12892. }
  12893. args = cs.getRgb(args, 0);
  12894. fn = _util.OPS.setStrokeRGBColor;
  12895. break;
  12896. case _util.OPS.shadingFill:
  12897. var shadingRes = resources.get("Shading");
  12898. if (!shadingRes) {
  12899. throw new _util.FormatError("No shading resource found");
  12900. }
  12901. var shading = shadingRes.get(args[0].name);
  12902. if (!shading) {
  12903. throw new _util.FormatError("No shading object found");
  12904. }
  12905. const patternId = self.parseShading({
  12906. shading,
  12907. resources,
  12908. localColorSpaceCache,
  12909. localShadingPatternCache
  12910. });
  12911. args = [patternId];
  12912. fn = _util.OPS.shadingFill;
  12913. break;
  12914. case _util.OPS.setGState:
  12915. isValidName = args[0] instanceof _primitives.Name;
  12916. name = args[0].name;
  12917. if (isValidName) {
  12918. const localGStateObj = localGStateCache.getByName(name);
  12919. if (localGStateObj) {
  12920. if (localGStateObj.length > 0) {
  12921. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  12922. }
  12923. args = null;
  12924. continue;
  12925. }
  12926. }
  12927. next(new Promise(function (resolveGState, rejectGState) {
  12928. if (!isValidName) {
  12929. throw new _util.FormatError("GState must be referred to by name.");
  12930. }
  12931. const extGState = resources.get("ExtGState");
  12932. if (!(extGState instanceof _primitives.Dict)) {
  12933. throw new _util.FormatError("ExtGState should be a dictionary.");
  12934. }
  12935. const gState = extGState.get(name);
  12936. if (!(gState instanceof _primitives.Dict)) {
  12937. throw new _util.FormatError("GState should be a dictionary.");
  12938. }
  12939. self.setGState({
  12940. resources,
  12941. gState,
  12942. operatorList,
  12943. cacheKey: name,
  12944. task,
  12945. stateManager,
  12946. localGStateCache,
  12947. localColorSpaceCache
  12948. }).then(resolveGState, rejectGState);
  12949. }).catch(function (reason) {
  12950. if (reason instanceof _util.AbortException) {
  12951. return;
  12952. }
  12953. if (self.options.ignoreErrors) {
  12954. self.handler.send("UnsupportedFeature", {
  12955. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  12956. });
  12957. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  12958. return;
  12959. }
  12960. throw reason;
  12961. }));
  12962. return;
  12963. case _util.OPS.moveTo:
  12964. case _util.OPS.lineTo:
  12965. case _util.OPS.curveTo:
  12966. case _util.OPS.curveTo2:
  12967. case _util.OPS.curveTo3:
  12968. case _util.OPS.closePath:
  12969. case _util.OPS.rectangle:
  12970. self.buildPath(operatorList, fn, args, parsingText);
  12971. continue;
  12972. case _util.OPS.markPoint:
  12973. case _util.OPS.markPointProps:
  12974. case _util.OPS.beginCompat:
  12975. case _util.OPS.endCompat:
  12976. continue;
  12977. case _util.OPS.beginMarkedContentProps:
  12978. if (!(args[0] instanceof _primitives.Name)) {
  12979. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  12980. continue;
  12981. }
  12982. if (args[0].name === "OC") {
  12983. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  12984. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  12985. }).catch(reason => {
  12986. if (reason instanceof _util.AbortException) {
  12987. return;
  12988. }
  12989. if (self.options.ignoreErrors) {
  12990. self.handler.send("UnsupportedFeature", {
  12991. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  12992. });
  12993. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  12994. return;
  12995. }
  12996. throw reason;
  12997. }));
  12998. return;
  12999. }
  13000. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  13001. break;
  13002. case _util.OPS.beginMarkedContent:
  13003. case _util.OPS.endMarkedContent:
  13004. default:
  13005. if (args !== null) {
  13006. for (i = 0, ii = args.length; i < ii; i++) {
  13007. if (args[i] instanceof _primitives.Dict) {
  13008. break;
  13009. }
  13010. }
  13011. if (i < ii) {
  13012. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  13013. continue;
  13014. }
  13015. }
  13016. }
  13017. operatorList.addOp(fn, args);
  13018. }
  13019. if (stop) {
  13020. next(deferred);
  13021. return;
  13022. }
  13023. closePendingRestoreOPS();
  13024. resolve();
  13025. }).catch(reason => {
  13026. if (reason instanceof _util.AbortException) {
  13027. return;
  13028. }
  13029. if (this.options.ignoreErrors) {
  13030. this.handler.send("UnsupportedFeature", {
  13031. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  13032. });
  13033. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  13034. closePendingRestoreOPS();
  13035. return;
  13036. }
  13037. throw reason;
  13038. });
  13039. }
  13040. getTextContent(_ref7) {
  13041. let {
  13042. stream,
  13043. task,
  13044. resources,
  13045. stateManager = null,
  13046. combineTextItems = false,
  13047. includeMarkedContent = false,
  13048. sink,
  13049. seenStyles = new Set(),
  13050. viewBox,
  13051. markedContentData = null
  13052. } = _ref7;
  13053. resources = resources || _primitives.Dict.empty;
  13054. stateManager = stateManager || new StateManager(new TextState());
  13055. if (includeMarkedContent) {
  13056. markedContentData = markedContentData || {
  13057. level: 0
  13058. };
  13059. }
  13060. const textContent = {
  13061. items: [],
  13062. styles: Object.create(null)
  13063. };
  13064. const textContentItem = {
  13065. initialized: false,
  13066. str: [],
  13067. totalWidth: 0,
  13068. totalHeight: 0,
  13069. width: 0,
  13070. height: 0,
  13071. vertical: false,
  13072. prevTransform: null,
  13073. textAdvanceScale: 0,
  13074. spaceInFlowMin: 0,
  13075. spaceInFlowMax: 0,
  13076. trackingSpaceMin: Infinity,
  13077. negativeSpaceMax: -Infinity,
  13078. notASpace: -Infinity,
  13079. transform: null,
  13080. fontName: null,
  13081. hasEOL: false
  13082. };
  13083. const twoLastChars = [" ", " "];
  13084. let twoLastCharsPos = 0;
  13085. function saveLastChar(char) {
  13086. const nextPos = (twoLastCharsPos + 1) % 2;
  13087. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  13088. twoLastChars[twoLastCharsPos] = char;
  13089. twoLastCharsPos = nextPos;
  13090. return ret;
  13091. }
  13092. function resetLastChars() {
  13093. twoLastChars[0] = twoLastChars[1] = " ";
  13094. twoLastCharsPos = 0;
  13095. }
  13096. const TRACKING_SPACE_FACTOR = 0.1;
  13097. const NOT_A_SPACE_FACTOR = 0.03;
  13098. const NEGATIVE_SPACE_FACTOR = -0.2;
  13099. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  13100. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  13101. const self = this;
  13102. const xref = this.xref;
  13103. const showSpacedTextBuffer = [];
  13104. let xobjs = null;
  13105. const emptyXObjectCache = new _image_utils.LocalImageCache();
  13106. const emptyGStateCache = new _image_utils.LocalGStateCache();
  13107. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  13108. let textState;
  13109. function getCurrentTextTransform() {
  13110. const font = textState.font;
  13111. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  13112. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  13113. const glyphHeight = font.bbox[3] - font.bbox[1];
  13114. if (glyphHeight > 0) {
  13115. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  13116. }
  13117. }
  13118. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  13119. }
  13120. function ensureTextContentItem() {
  13121. if (textContentItem.initialized) {
  13122. return textContentItem;
  13123. }
  13124. const {
  13125. font,
  13126. loadedName
  13127. } = textState;
  13128. if (!seenStyles.has(loadedName)) {
  13129. seenStyles.add(loadedName);
  13130. textContent.styles[loadedName] = {
  13131. fontFamily: font.fallbackName,
  13132. ascent: font.ascent,
  13133. descent: font.descent,
  13134. vertical: font.vertical
  13135. };
  13136. }
  13137. textContentItem.fontName = loadedName;
  13138. const trm = textContentItem.transform = getCurrentTextTransform();
  13139. if (!font.vertical) {
  13140. textContentItem.width = textContentItem.totalWidth = 0;
  13141. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  13142. textContentItem.vertical = false;
  13143. } else {
  13144. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  13145. textContentItem.height = textContentItem.totalHeight = 0;
  13146. textContentItem.vertical = true;
  13147. }
  13148. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  13149. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  13150. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  13151. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  13152. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  13153. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  13154. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  13155. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  13156. textContentItem.hasEOL = false;
  13157. textContentItem.initialized = true;
  13158. return textContentItem;
  13159. }
  13160. function updateAdvanceScale() {
  13161. if (!textContentItem.initialized) {
  13162. return;
  13163. }
  13164. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  13165. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  13166. const scaleFactor = scaleCtmX * scaleLineX;
  13167. if (scaleFactor === textContentItem.textAdvanceScale) {
  13168. return;
  13169. }
  13170. if (!textContentItem.vertical) {
  13171. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  13172. textContentItem.width = 0;
  13173. } else {
  13174. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  13175. textContentItem.height = 0;
  13176. }
  13177. textContentItem.textAdvanceScale = scaleFactor;
  13178. }
  13179. function runBidiTransform(textChunk) {
  13180. const text = textChunk.str.join("");
  13181. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  13182. return {
  13183. str: bidiResult.str,
  13184. dir: bidiResult.dir,
  13185. width: Math.abs(textChunk.totalWidth),
  13186. height: Math.abs(textChunk.totalHeight),
  13187. transform: textChunk.transform,
  13188. fontName: textChunk.fontName,
  13189. hasEOL: textChunk.hasEOL
  13190. };
  13191. }
  13192. function handleSetFont(fontName, fontRef) {
  13193. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  13194. if (!translated.font.isType3Font) {
  13195. return translated;
  13196. }
  13197. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  13198. return translated;
  13199. });
  13200. }).then(function (translated) {
  13201. textState.loadedName = translated.loadedName;
  13202. textState.font = translated.font;
  13203. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  13204. });
  13205. }
  13206. function applyInverseRotation(x, y, matrix) {
  13207. const scale = Math.hypot(matrix[0], matrix[1]);
  13208. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  13209. }
  13210. function compareWithLastPosition() {
  13211. const currentTransform = getCurrentTextTransform();
  13212. let posX = currentTransform[4];
  13213. let posY = currentTransform[5];
  13214. const shiftedX = posX - viewBox[0];
  13215. const shiftedY = posY - viewBox[1];
  13216. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  13217. return false;
  13218. }
  13219. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  13220. return true;
  13221. }
  13222. let lastPosX = textContentItem.prevTransform[4];
  13223. let lastPosY = textContentItem.prevTransform[5];
  13224. if (lastPosX === posX && lastPosY === posY) {
  13225. return true;
  13226. }
  13227. let rotate = -1;
  13228. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  13229. rotate = currentTransform[0] > 0 ? 0 : 180;
  13230. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  13231. rotate = currentTransform[1] > 0 ? 90 : 270;
  13232. }
  13233. switch (rotate) {
  13234. case 0:
  13235. break;
  13236. case 90:
  13237. [posX, posY] = [posY, posX];
  13238. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  13239. break;
  13240. case 180:
  13241. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  13242. break;
  13243. case 270:
  13244. [posX, posY] = [-posY, -posX];
  13245. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  13246. break;
  13247. default:
  13248. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  13249. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  13250. }
  13251. if (textState.font.vertical) {
  13252. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  13253. const advanceX = posX - lastPosX;
  13254. const textOrientation = Math.sign(textContentItem.height);
  13255. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  13256. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  13257. appendEOL();
  13258. return true;
  13259. }
  13260. resetLastChars();
  13261. flushTextContentItem();
  13262. return true;
  13263. }
  13264. if (Math.abs(advanceX) > textContentItem.width) {
  13265. appendEOL();
  13266. return true;
  13267. }
  13268. if (advanceY <= textOrientation * textContentItem.notASpace) {
  13269. resetLastChars();
  13270. }
  13271. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  13272. textContentItem.height += advanceY;
  13273. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  13274. if (textContentItem.str.length === 0) {
  13275. resetLastChars();
  13276. textContent.items.push({
  13277. str: " ",
  13278. dir: "ltr",
  13279. width: 0,
  13280. height: Math.abs(advanceY),
  13281. transform: textContentItem.prevTransform,
  13282. fontName: textContentItem.fontName,
  13283. hasEOL: false
  13284. });
  13285. } else {
  13286. textContentItem.height += advanceY;
  13287. }
  13288. }
  13289. return true;
  13290. }
  13291. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  13292. const advanceY = posY - lastPosY;
  13293. const textOrientation = Math.sign(textContentItem.width);
  13294. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  13295. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  13296. appendEOL();
  13297. return true;
  13298. }
  13299. resetLastChars();
  13300. flushTextContentItem();
  13301. return true;
  13302. }
  13303. if (Math.abs(advanceY) > textContentItem.height) {
  13304. appendEOL();
  13305. return true;
  13306. }
  13307. if (advanceX <= textOrientation * textContentItem.notASpace) {
  13308. resetLastChars();
  13309. }
  13310. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  13311. textContentItem.width += advanceX;
  13312. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  13313. if (textContentItem.str.length === 0) {
  13314. resetLastChars();
  13315. textContent.items.push({
  13316. str: " ",
  13317. dir: "ltr",
  13318. width: Math.abs(advanceX),
  13319. height: 0,
  13320. transform: textContentItem.prevTransform,
  13321. fontName: textContentItem.fontName,
  13322. hasEOL: false
  13323. });
  13324. } else {
  13325. textContentItem.width += advanceX;
  13326. }
  13327. }
  13328. return true;
  13329. }
  13330. function buildTextContentItem(_ref8) {
  13331. let {
  13332. chars,
  13333. extraSpacing
  13334. } = _ref8;
  13335. const font = textState.font;
  13336. if (!chars) {
  13337. const charSpacing = textState.charSpacing + extraSpacing;
  13338. if (charSpacing) {
  13339. if (!font.vertical) {
  13340. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13341. } else {
  13342. textState.translateTextMatrix(0, -charSpacing);
  13343. }
  13344. }
  13345. return;
  13346. }
  13347. const glyphs = font.charsToGlyphs(chars);
  13348. const scale = textState.fontMatrix[0] * textState.fontSize;
  13349. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  13350. const glyph = glyphs[i];
  13351. const {
  13352. category
  13353. } = glyph;
  13354. if (category.isInvisibleFormatMark) {
  13355. continue;
  13356. }
  13357. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  13358. let glyphWidth = glyph.width;
  13359. if (font.vertical) {
  13360. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  13361. }
  13362. let scaledDim = glyphWidth * scale;
  13363. if (category.isWhitespace) {
  13364. if (!font.vertical) {
  13365. charSpacing += scaledDim + textState.wordSpacing;
  13366. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13367. } else {
  13368. charSpacing += -scaledDim + textState.wordSpacing;
  13369. textState.translateTextMatrix(0, -charSpacing);
  13370. }
  13371. saveLastChar(" ");
  13372. continue;
  13373. }
  13374. if (!compareWithLastPosition()) {
  13375. continue;
  13376. }
  13377. const textChunk = ensureTextContentItem();
  13378. if (category.isZeroWidthDiacritic) {
  13379. scaledDim = 0;
  13380. }
  13381. if (!font.vertical) {
  13382. scaledDim *= textState.textHScale;
  13383. textState.translateTextMatrix(scaledDim, 0);
  13384. textChunk.width += scaledDim;
  13385. } else {
  13386. textState.translateTextMatrix(0, scaledDim);
  13387. scaledDim = Math.abs(scaledDim);
  13388. textChunk.height += scaledDim;
  13389. }
  13390. if (scaledDim) {
  13391. textChunk.prevTransform = getCurrentTextTransform();
  13392. }
  13393. const glyphUnicode = glyph.normalizedUnicode;
  13394. if (saveLastChar(glyphUnicode)) {
  13395. textChunk.str.push(" ");
  13396. }
  13397. textChunk.str.push(glyphUnicode);
  13398. if (charSpacing) {
  13399. if (!font.vertical) {
  13400. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13401. } else {
  13402. textState.translateTextMatrix(0, -charSpacing);
  13403. }
  13404. }
  13405. }
  13406. }
  13407. function appendEOL() {
  13408. resetLastChars();
  13409. if (textContentItem.initialized) {
  13410. textContentItem.hasEOL = true;
  13411. flushTextContentItem();
  13412. } else {
  13413. textContent.items.push({
  13414. str: "",
  13415. dir: "ltr",
  13416. width: 0,
  13417. height: 0,
  13418. transform: getCurrentTextTransform(),
  13419. fontName: textState.loadedName,
  13420. hasEOL: true
  13421. });
  13422. }
  13423. }
  13424. function addFakeSpaces(width, transf, textOrientation) {
  13425. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  13426. if (textContentItem.initialized) {
  13427. resetLastChars();
  13428. textContentItem.str.push(" ");
  13429. }
  13430. return false;
  13431. }
  13432. const fontName = textContentItem.fontName;
  13433. let height = 0;
  13434. if (textContentItem.vertical) {
  13435. height = width;
  13436. width = 0;
  13437. }
  13438. flushTextContentItem();
  13439. resetLastChars();
  13440. textContent.items.push({
  13441. str: " ",
  13442. dir: "ltr",
  13443. width: Math.abs(width),
  13444. height: Math.abs(height),
  13445. transform: transf || getCurrentTextTransform(),
  13446. fontName,
  13447. hasEOL: false
  13448. });
  13449. return true;
  13450. }
  13451. function flushTextContentItem() {
  13452. if (!textContentItem.initialized || !textContentItem.str) {
  13453. return;
  13454. }
  13455. if (!textContentItem.vertical) {
  13456. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  13457. } else {
  13458. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  13459. }
  13460. textContent.items.push(runBidiTransform(textContentItem));
  13461. textContentItem.initialized = false;
  13462. textContentItem.str.length = 0;
  13463. }
  13464. function enqueueChunk() {
  13465. let batch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  13466. const length = textContent.items.length;
  13467. if (length === 0) {
  13468. return;
  13469. }
  13470. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  13471. return;
  13472. }
  13473. sink.enqueue(textContent, length);
  13474. textContent.items = [];
  13475. textContent.styles = Object.create(null);
  13476. }
  13477. const timeSlotManager = new TimeSlotManager();
  13478. return new Promise(function promiseBody(resolve, reject) {
  13479. const next = function (promise) {
  13480. enqueueChunk(true);
  13481. Promise.all([promise, sink.ready]).then(function () {
  13482. try {
  13483. promiseBody(resolve, reject);
  13484. } catch (ex) {
  13485. reject(ex);
  13486. }
  13487. }, reject);
  13488. };
  13489. task.ensureNotTerminated();
  13490. timeSlotManager.reset();
  13491. const operation = {};
  13492. let stop,
  13493. args = [];
  13494. while (!(stop = timeSlotManager.check())) {
  13495. args.length = 0;
  13496. operation.args = args;
  13497. if (!preprocessor.read(operation)) {
  13498. break;
  13499. }
  13500. textState = stateManager.state;
  13501. const fn = operation.fn;
  13502. args = operation.args;
  13503. switch (fn | 0) {
  13504. case _util.OPS.setFont:
  13505. var fontNameArg = args[0].name,
  13506. fontSizeArg = args[1];
  13507. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  13508. break;
  13509. }
  13510. flushTextContentItem();
  13511. textState.fontName = fontNameArg;
  13512. textState.fontSize = fontSizeArg;
  13513. next(handleSetFont(fontNameArg, null));
  13514. return;
  13515. case _util.OPS.setTextRise:
  13516. textState.textRise = args[0];
  13517. break;
  13518. case _util.OPS.setHScale:
  13519. textState.textHScale = args[0] / 100;
  13520. break;
  13521. case _util.OPS.setLeading:
  13522. textState.leading = args[0];
  13523. break;
  13524. case _util.OPS.moveText:
  13525. textState.translateTextLineMatrix(args[0], args[1]);
  13526. textState.textMatrix = textState.textLineMatrix.slice();
  13527. break;
  13528. case _util.OPS.setLeadingMoveText:
  13529. textState.leading = -args[1];
  13530. textState.translateTextLineMatrix(args[0], args[1]);
  13531. textState.textMatrix = textState.textLineMatrix.slice();
  13532. break;
  13533. case _util.OPS.nextLine:
  13534. textState.carriageReturn();
  13535. break;
  13536. case _util.OPS.setTextMatrix:
  13537. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13538. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13539. updateAdvanceScale();
  13540. break;
  13541. case _util.OPS.setCharSpacing:
  13542. textState.charSpacing = args[0];
  13543. break;
  13544. case _util.OPS.setWordSpacing:
  13545. textState.wordSpacing = args[0];
  13546. break;
  13547. case _util.OPS.beginText:
  13548. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  13549. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  13550. break;
  13551. case _util.OPS.showSpacedText:
  13552. if (!stateManager.state.font) {
  13553. self.ensureStateFont(stateManager.state);
  13554. continue;
  13555. }
  13556. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  13557. const elements = args[0];
  13558. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  13559. const item = elements[i];
  13560. if (typeof item === "string") {
  13561. showSpacedTextBuffer.push(item);
  13562. } else if (typeof item === "number" && item !== 0) {
  13563. const str = showSpacedTextBuffer.join("");
  13564. showSpacedTextBuffer.length = 0;
  13565. buildTextContentItem({
  13566. chars: str,
  13567. extraSpacing: item * spaceFactor
  13568. });
  13569. }
  13570. }
  13571. const item = elements.at(-1);
  13572. if (typeof item === "string") {
  13573. showSpacedTextBuffer.push(item);
  13574. }
  13575. if (showSpacedTextBuffer.length > 0) {
  13576. const str = showSpacedTextBuffer.join("");
  13577. showSpacedTextBuffer.length = 0;
  13578. buildTextContentItem({
  13579. chars: str,
  13580. extraSpacing: 0
  13581. });
  13582. }
  13583. break;
  13584. case _util.OPS.showText:
  13585. if (!stateManager.state.font) {
  13586. self.ensureStateFont(stateManager.state);
  13587. continue;
  13588. }
  13589. buildTextContentItem({
  13590. chars: args[0],
  13591. extraSpacing: 0
  13592. });
  13593. break;
  13594. case _util.OPS.nextLineShowText:
  13595. if (!stateManager.state.font) {
  13596. self.ensureStateFont(stateManager.state);
  13597. continue;
  13598. }
  13599. textState.carriageReturn();
  13600. buildTextContentItem({
  13601. chars: args[0],
  13602. extraSpacing: 0
  13603. });
  13604. break;
  13605. case _util.OPS.nextLineSetSpacingShowText:
  13606. if (!stateManager.state.font) {
  13607. self.ensureStateFont(stateManager.state);
  13608. continue;
  13609. }
  13610. textState.wordSpacing = args[0];
  13611. textState.charSpacing = args[1];
  13612. textState.carriageReturn();
  13613. buildTextContentItem({
  13614. chars: args[2],
  13615. extraSpacing: 0
  13616. });
  13617. break;
  13618. case _util.OPS.paintXObject:
  13619. flushTextContentItem();
  13620. if (!xobjs) {
  13621. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  13622. }
  13623. var isValidName = args[0] instanceof _primitives.Name;
  13624. var name = args[0].name;
  13625. if (isValidName && emptyXObjectCache.getByName(name)) {
  13626. break;
  13627. }
  13628. next(new Promise(function (resolveXObject, rejectXObject) {
  13629. if (!isValidName) {
  13630. throw new _util.FormatError("XObject must be referred to by name.");
  13631. }
  13632. let xobj = xobjs.getRaw(name);
  13633. if (xobj instanceof _primitives.Ref) {
  13634. if (emptyXObjectCache.getByRef(xobj)) {
  13635. resolveXObject();
  13636. return;
  13637. }
  13638. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  13639. if (globalImage) {
  13640. resolveXObject();
  13641. return;
  13642. }
  13643. xobj = xref.fetch(xobj);
  13644. }
  13645. if (!(xobj instanceof _base_stream.BaseStream)) {
  13646. throw new _util.FormatError("XObject should be a stream");
  13647. }
  13648. const type = xobj.dict.get("Subtype");
  13649. if (!(type instanceof _primitives.Name)) {
  13650. throw new _util.FormatError("XObject should have a Name subtype");
  13651. }
  13652. if (type.name !== "Form") {
  13653. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13654. resolveXObject();
  13655. return;
  13656. }
  13657. const currentState = stateManager.state.clone();
  13658. const xObjStateManager = new StateManager(currentState);
  13659. const matrix = xobj.dict.getArray("Matrix");
  13660. if (Array.isArray(matrix) && matrix.length === 6) {
  13661. xObjStateManager.transform(matrix);
  13662. }
  13663. enqueueChunk();
  13664. const sinkWrapper = {
  13665. enqueueInvoked: false,
  13666. enqueue(chunk, size) {
  13667. this.enqueueInvoked = true;
  13668. sink.enqueue(chunk, size);
  13669. },
  13670. get desiredSize() {
  13671. return sink.desiredSize;
  13672. },
  13673. get ready() {
  13674. return sink.ready;
  13675. }
  13676. };
  13677. self.getTextContent({
  13678. stream: xobj,
  13679. task,
  13680. resources: xobj.dict.get("Resources") || resources,
  13681. stateManager: xObjStateManager,
  13682. combineTextItems,
  13683. includeMarkedContent,
  13684. sink: sinkWrapper,
  13685. seenStyles,
  13686. viewBox,
  13687. markedContentData
  13688. }).then(function () {
  13689. if (!sinkWrapper.enqueueInvoked) {
  13690. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13691. }
  13692. resolveXObject();
  13693. }, rejectXObject);
  13694. }).catch(function (reason) {
  13695. if (reason instanceof _util.AbortException) {
  13696. return;
  13697. }
  13698. if (self.options.ignoreErrors) {
  13699. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  13700. return;
  13701. }
  13702. throw reason;
  13703. }));
  13704. return;
  13705. case _util.OPS.setGState:
  13706. isValidName = args[0] instanceof _primitives.Name;
  13707. name = args[0].name;
  13708. if (isValidName && emptyGStateCache.getByName(name)) {
  13709. break;
  13710. }
  13711. next(new Promise(function (resolveGState, rejectGState) {
  13712. if (!isValidName) {
  13713. throw new _util.FormatError("GState must be referred to by name.");
  13714. }
  13715. const extGState = resources.get("ExtGState");
  13716. if (!(extGState instanceof _primitives.Dict)) {
  13717. throw new _util.FormatError("ExtGState should be a dictionary.");
  13718. }
  13719. const gState = extGState.get(name);
  13720. if (!(gState instanceof _primitives.Dict)) {
  13721. throw new _util.FormatError("GState should be a dictionary.");
  13722. }
  13723. const gStateFont = gState.get("Font");
  13724. if (!gStateFont) {
  13725. emptyGStateCache.set(name, gState.objId, true);
  13726. resolveGState();
  13727. return;
  13728. }
  13729. flushTextContentItem();
  13730. textState.fontName = null;
  13731. textState.fontSize = gStateFont[1];
  13732. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  13733. }).catch(function (reason) {
  13734. if (reason instanceof _util.AbortException) {
  13735. return;
  13736. }
  13737. if (self.options.ignoreErrors) {
  13738. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  13739. return;
  13740. }
  13741. throw reason;
  13742. }));
  13743. return;
  13744. case _util.OPS.beginMarkedContent:
  13745. flushTextContentItem();
  13746. if (includeMarkedContent) {
  13747. markedContentData.level++;
  13748. textContent.items.push({
  13749. type: "beginMarkedContent",
  13750. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13751. });
  13752. }
  13753. break;
  13754. case _util.OPS.beginMarkedContentProps:
  13755. flushTextContentItem();
  13756. if (includeMarkedContent) {
  13757. markedContentData.level++;
  13758. let mcid = null;
  13759. if (args[1] instanceof _primitives.Dict) {
  13760. mcid = args[1].get("MCID");
  13761. }
  13762. textContent.items.push({
  13763. type: "beginMarkedContentProps",
  13764. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  13765. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13766. });
  13767. }
  13768. break;
  13769. case _util.OPS.endMarkedContent:
  13770. flushTextContentItem();
  13771. if (includeMarkedContent) {
  13772. if (markedContentData.level === 0) {
  13773. break;
  13774. }
  13775. markedContentData.level--;
  13776. textContent.items.push({
  13777. type: "endMarkedContent"
  13778. });
  13779. }
  13780. break;
  13781. }
  13782. if (textContent.items.length >= sink.desiredSize) {
  13783. stop = true;
  13784. break;
  13785. }
  13786. }
  13787. if (stop) {
  13788. next(deferred);
  13789. return;
  13790. }
  13791. flushTextContentItem();
  13792. enqueueChunk();
  13793. resolve();
  13794. }).catch(reason => {
  13795. if (reason instanceof _util.AbortException) {
  13796. return;
  13797. }
  13798. if (this.options.ignoreErrors) {
  13799. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  13800. flushTextContentItem();
  13801. enqueueChunk();
  13802. return;
  13803. }
  13804. throw reason;
  13805. });
  13806. }
  13807. extractDataStructures(dict, baseDict, properties) {
  13808. const xref = this.xref;
  13809. let cidToGidBytes;
  13810. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  13811. if (properties.composite) {
  13812. const cidSystemInfo = dict.get("CIDSystemInfo");
  13813. if (cidSystemInfo instanceof _primitives.Dict) {
  13814. properties.cidSystemInfo = {
  13815. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  13816. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  13817. supplement: cidSystemInfo.get("Supplement")
  13818. };
  13819. }
  13820. try {
  13821. const cidToGidMap = dict.get("CIDToGIDMap");
  13822. if (cidToGidMap instanceof _base_stream.BaseStream) {
  13823. cidToGidBytes = cidToGidMap.getBytes();
  13824. }
  13825. } catch (ex) {
  13826. if (!this.options.ignoreErrors) {
  13827. throw ex;
  13828. }
  13829. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  13830. }
  13831. }
  13832. const differences = [];
  13833. let baseEncodingName = null;
  13834. let encoding;
  13835. if (dict.has("Encoding")) {
  13836. encoding = dict.get("Encoding");
  13837. if (encoding instanceof _primitives.Dict) {
  13838. baseEncodingName = encoding.get("BaseEncoding");
  13839. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  13840. if (encoding.has("Differences")) {
  13841. const diffEncoding = encoding.get("Differences");
  13842. let index = 0;
  13843. for (const entry of diffEncoding) {
  13844. const data = xref.fetchIfRef(entry);
  13845. if (typeof data === "number") {
  13846. index = data;
  13847. } else if (data instanceof _primitives.Name) {
  13848. differences[index++] = data.name;
  13849. } else {
  13850. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  13851. }
  13852. }
  13853. }
  13854. } else if (encoding instanceof _primitives.Name) {
  13855. baseEncodingName = encoding.name;
  13856. } else {
  13857. const msg = "Encoding is not a Name nor a Dict";
  13858. if (!this.options.ignoreErrors) {
  13859. throw new _util.FormatError(msg);
  13860. }
  13861. (0, _util.warn)(msg);
  13862. }
  13863. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  13864. baseEncodingName = null;
  13865. }
  13866. }
  13867. if (baseEncodingName) {
  13868. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13869. } else {
  13870. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  13871. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  13872. encoding = _encodings.StandardEncoding;
  13873. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  13874. encoding = _encodings.WinAnsiEncoding;
  13875. }
  13876. if (isSymbolicFont) {
  13877. encoding = _encodings.MacRomanEncoding;
  13878. if (!properties.file || properties.isInternalFont) {
  13879. if (/Symbol/i.test(properties.name)) {
  13880. encoding = _encodings.SymbolSetEncoding;
  13881. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  13882. encoding = _encodings.ZapfDingbatsEncoding;
  13883. }
  13884. }
  13885. }
  13886. properties.defaultEncoding = encoding;
  13887. }
  13888. properties.differences = differences;
  13889. properties.baseEncodingName = baseEncodingName;
  13890. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  13891. properties.dict = dict;
  13892. return toUnicodePromise.then(readToUnicode => {
  13893. properties.toUnicode = readToUnicode;
  13894. return this.buildToUnicode(properties);
  13895. }).then(builtToUnicode => {
  13896. properties.toUnicode = builtToUnicode;
  13897. if (cidToGidBytes) {
  13898. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  13899. }
  13900. return properties;
  13901. });
  13902. }
  13903. _simpleFontToUnicode(properties) {
  13904. let forceGlyphs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  13905. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  13906. const toUnicode = [];
  13907. const encoding = properties.defaultEncoding.slice();
  13908. const baseEncodingName = properties.baseEncodingName;
  13909. const differences = properties.differences;
  13910. for (const charcode in differences) {
  13911. const glyphName = differences[charcode];
  13912. if (glyphName === ".notdef") {
  13913. continue;
  13914. }
  13915. encoding[charcode] = glyphName;
  13916. }
  13917. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  13918. for (const charcode in encoding) {
  13919. let glyphName = encoding[charcode];
  13920. if (glyphName === "") {
  13921. continue;
  13922. }
  13923. let unicode = glyphsUnicodeMap[glyphName];
  13924. if (unicode !== undefined) {
  13925. toUnicode[charcode] = String.fromCharCode(unicode);
  13926. continue;
  13927. }
  13928. let code = 0;
  13929. switch (glyphName[0]) {
  13930. case "G":
  13931. if (glyphName.length === 3) {
  13932. code = parseInt(glyphName.substring(1), 16);
  13933. }
  13934. break;
  13935. case "g":
  13936. if (glyphName.length === 5) {
  13937. code = parseInt(glyphName.substring(1), 16);
  13938. }
  13939. break;
  13940. case "C":
  13941. case "c":
  13942. if (glyphName.length >= 3 && glyphName.length <= 4) {
  13943. const codeStr = glyphName.substring(1);
  13944. if (forceGlyphs) {
  13945. code = parseInt(codeStr, 16);
  13946. break;
  13947. }
  13948. code = +codeStr;
  13949. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  13950. return this._simpleFontToUnicode(properties, true);
  13951. }
  13952. }
  13953. break;
  13954. case "u":
  13955. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  13956. if (unicode !== -1) {
  13957. code = unicode;
  13958. }
  13959. break;
  13960. }
  13961. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  13962. if (baseEncodingName && code === +charcode) {
  13963. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13964. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  13965. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  13966. continue;
  13967. }
  13968. }
  13969. toUnicode[charcode] = String.fromCodePoint(code);
  13970. }
  13971. }
  13972. return toUnicode;
  13973. }
  13974. async buildToUnicode(properties) {
  13975. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  13976. if (properties.hasIncludedToUnicodeMap) {
  13977. if (!properties.composite && properties.hasEncoding) {
  13978. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  13979. }
  13980. return properties.toUnicode;
  13981. }
  13982. if (!properties.composite) {
  13983. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  13984. }
  13985. 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"))) {
  13986. const {
  13987. registry,
  13988. ordering
  13989. } = properties.cidSystemInfo;
  13990. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  13991. const ucs2CMap = await _cmap.CMapFactory.create({
  13992. encoding: ucs2CMapName,
  13993. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13994. useCMap: null
  13995. });
  13996. const toUnicode = [];
  13997. properties.cMap.forEach(function (charcode, cid) {
  13998. if (cid > 0xffff) {
  13999. throw new _util.FormatError("Max size of CID is 65,535");
  14000. }
  14001. const ucs2 = ucs2CMap.lookup(cid);
  14002. if (ucs2) {
  14003. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  14004. }
  14005. });
  14006. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  14007. }
  14008. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  14009. }
  14010. readToUnicode(cmapObj) {
  14011. if (!cmapObj) {
  14012. return Promise.resolve(null);
  14013. }
  14014. if (cmapObj instanceof _primitives.Name) {
  14015. return _cmap.CMapFactory.create({
  14016. encoding: cmapObj,
  14017. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14018. useCMap: null
  14019. }).then(function (cmap) {
  14020. if (cmap instanceof _cmap.IdentityCMap) {
  14021. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  14022. }
  14023. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  14024. });
  14025. } else if (cmapObj instanceof _base_stream.BaseStream) {
  14026. return _cmap.CMapFactory.create({
  14027. encoding: cmapObj,
  14028. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14029. useCMap: null
  14030. }).then(function (cmap) {
  14031. if (cmap instanceof _cmap.IdentityCMap) {
  14032. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  14033. }
  14034. const map = new Array(cmap.length);
  14035. cmap.forEach(function (charCode, token) {
  14036. if (typeof token === "number") {
  14037. map[charCode] = String.fromCodePoint(token);
  14038. return;
  14039. }
  14040. const str = [];
  14041. for (let k = 0; k < token.length; k += 2) {
  14042. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  14043. if ((w1 & 0xf800) !== 0xd800) {
  14044. str.push(w1);
  14045. continue;
  14046. }
  14047. k += 2;
  14048. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  14049. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  14050. }
  14051. map[charCode] = String.fromCodePoint(...str);
  14052. });
  14053. return new _to_unicode_map.ToUnicodeMap(map);
  14054. }, reason => {
  14055. if (reason instanceof _util.AbortException) {
  14056. return null;
  14057. }
  14058. if (this.options.ignoreErrors) {
  14059. this.handler.send("UnsupportedFeature", {
  14060. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  14061. });
  14062. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  14063. return null;
  14064. }
  14065. throw reason;
  14066. });
  14067. }
  14068. return Promise.resolve(null);
  14069. }
  14070. readCidToGidMap(glyphsData, toUnicode) {
  14071. const result = [];
  14072. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  14073. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  14074. const code = j >> 1;
  14075. if (glyphID === 0 && !toUnicode.has(code)) {
  14076. continue;
  14077. }
  14078. result[code] = glyphID;
  14079. }
  14080. return result;
  14081. }
  14082. extractWidths(dict, descriptor, properties) {
  14083. const xref = this.xref;
  14084. let glyphsWidths = [];
  14085. let defaultWidth = 0;
  14086. const glyphsVMetrics = [];
  14087. let defaultVMetrics;
  14088. let i, ii, j, jj, start, code, widths;
  14089. if (properties.composite) {
  14090. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  14091. widths = dict.get("W");
  14092. if (widths) {
  14093. for (i = 0, ii = widths.length; i < ii; i++) {
  14094. start = xref.fetchIfRef(widths[i++]);
  14095. code = xref.fetchIfRef(widths[i]);
  14096. if (Array.isArray(code)) {
  14097. for (j = 0, jj = code.length; j < jj; j++) {
  14098. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  14099. }
  14100. } else {
  14101. const width = xref.fetchIfRef(widths[++i]);
  14102. for (j = start; j <= code; j++) {
  14103. glyphsWidths[j] = width;
  14104. }
  14105. }
  14106. }
  14107. }
  14108. if (properties.vertical) {
  14109. let vmetrics = dict.getArray("DW2") || [880, -1000];
  14110. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  14111. vmetrics = dict.get("W2");
  14112. if (vmetrics) {
  14113. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  14114. start = xref.fetchIfRef(vmetrics[i++]);
  14115. code = xref.fetchIfRef(vmetrics[i]);
  14116. if (Array.isArray(code)) {
  14117. for (j = 0, jj = code.length; j < jj; j++) {
  14118. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  14119. }
  14120. } else {
  14121. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  14122. for (j = start; j <= code; j++) {
  14123. glyphsVMetrics[j] = vmetric;
  14124. }
  14125. }
  14126. }
  14127. }
  14128. }
  14129. } else {
  14130. const firstChar = properties.firstChar;
  14131. widths = dict.get("Widths");
  14132. if (widths) {
  14133. j = firstChar;
  14134. for (i = 0, ii = widths.length; i < ii; i++) {
  14135. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  14136. }
  14137. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  14138. } else {
  14139. const baseFontName = dict.get("BaseFont");
  14140. if (baseFontName instanceof _primitives.Name) {
  14141. const metrics = this.getBaseFontMetrics(baseFontName.name);
  14142. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  14143. defaultWidth = metrics.defaultWidth;
  14144. }
  14145. }
  14146. }
  14147. let isMonospace = true;
  14148. let firstWidth = defaultWidth;
  14149. for (const glyph in glyphsWidths) {
  14150. const glyphWidth = glyphsWidths[glyph];
  14151. if (!glyphWidth) {
  14152. continue;
  14153. }
  14154. if (!firstWidth) {
  14155. firstWidth = glyphWidth;
  14156. continue;
  14157. }
  14158. if (firstWidth !== glyphWidth) {
  14159. isMonospace = false;
  14160. break;
  14161. }
  14162. }
  14163. if (isMonospace) {
  14164. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  14165. }
  14166. properties.defaultWidth = defaultWidth;
  14167. properties.widths = glyphsWidths;
  14168. properties.defaultVMetrics = defaultVMetrics;
  14169. properties.vmetrics = glyphsVMetrics;
  14170. }
  14171. isSerifFont(baseFontName) {
  14172. const fontNameWoStyle = baseFontName.split("-")[0];
  14173. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle);
  14174. }
  14175. getBaseFontMetrics(name) {
  14176. let defaultWidth = 0;
  14177. let widths = Object.create(null);
  14178. let monospace = false;
  14179. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  14180. let lookupName = stdFontMap[name] || name;
  14181. const Metrics = (0, _metrics.getMetrics)();
  14182. if (!(lookupName in Metrics)) {
  14183. if (this.isSerifFont(name)) {
  14184. lookupName = "Times-Roman";
  14185. } else {
  14186. lookupName = "Helvetica";
  14187. }
  14188. }
  14189. const glyphWidths = Metrics[lookupName];
  14190. if (typeof glyphWidths === "number") {
  14191. defaultWidth = glyphWidths;
  14192. monospace = true;
  14193. } else {
  14194. widths = glyphWidths();
  14195. }
  14196. return {
  14197. defaultWidth,
  14198. monospace,
  14199. widths
  14200. };
  14201. }
  14202. buildCharCodeToWidth(widthsByGlyphName, properties) {
  14203. const widths = Object.create(null);
  14204. const differences = properties.differences;
  14205. const encoding = properties.defaultEncoding;
  14206. for (let charCode = 0; charCode < 256; charCode++) {
  14207. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  14208. widths[charCode] = widthsByGlyphName[differences[charCode]];
  14209. continue;
  14210. }
  14211. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  14212. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  14213. continue;
  14214. }
  14215. }
  14216. return widths;
  14217. }
  14218. preEvaluateFont(dict) {
  14219. const baseDict = dict;
  14220. let type = dict.get("Subtype");
  14221. if (!(type instanceof _primitives.Name)) {
  14222. throw new _util.FormatError("invalid font Subtype");
  14223. }
  14224. let composite = false;
  14225. let hash, toUnicode;
  14226. if (type.name === "Type0") {
  14227. const df = dict.get("DescendantFonts");
  14228. if (!df) {
  14229. throw new _util.FormatError("Descendant fonts are not specified");
  14230. }
  14231. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  14232. if (!(dict instanceof _primitives.Dict)) {
  14233. throw new _util.FormatError("Descendant font is not a dictionary.");
  14234. }
  14235. type = dict.get("Subtype");
  14236. if (!(type instanceof _primitives.Name)) {
  14237. throw new _util.FormatError("invalid font Subtype");
  14238. }
  14239. composite = true;
  14240. }
  14241. const firstChar = dict.get("FirstChar") || 0,
  14242. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  14243. const descriptor = dict.get("FontDescriptor");
  14244. if (descriptor) {
  14245. hash = new _murmurhash.MurmurHash3_64();
  14246. const encoding = baseDict.getRaw("Encoding");
  14247. if (encoding instanceof _primitives.Name) {
  14248. hash.update(encoding.name);
  14249. } else if (encoding instanceof _primitives.Ref) {
  14250. hash.update(encoding.toString());
  14251. } else if (encoding instanceof _primitives.Dict) {
  14252. for (const entry of encoding.getRawValues()) {
  14253. if (entry instanceof _primitives.Name) {
  14254. hash.update(entry.name);
  14255. } else if (entry instanceof _primitives.Ref) {
  14256. hash.update(entry.toString());
  14257. } else if (Array.isArray(entry)) {
  14258. const diffLength = entry.length,
  14259. diffBuf = new Array(diffLength);
  14260. for (let j = 0; j < diffLength; j++) {
  14261. const diffEntry = entry[j];
  14262. if (diffEntry instanceof _primitives.Name) {
  14263. diffBuf[j] = diffEntry.name;
  14264. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  14265. diffBuf[j] = diffEntry.toString();
  14266. }
  14267. }
  14268. hash.update(diffBuf.join());
  14269. }
  14270. }
  14271. }
  14272. hash.update(`${firstChar}-${lastChar}`);
  14273. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  14274. if (toUnicode instanceof _base_stream.BaseStream) {
  14275. const stream = toUnicode.str || toUnicode;
  14276. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  14277. hash.update(uint8array);
  14278. } else if (toUnicode instanceof _primitives.Name) {
  14279. hash.update(toUnicode.name);
  14280. }
  14281. const widths = dict.get("Widths") || baseDict.get("Widths");
  14282. if (Array.isArray(widths)) {
  14283. const widthsBuf = [];
  14284. for (const entry of widths) {
  14285. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  14286. widthsBuf.push(entry.toString());
  14287. }
  14288. }
  14289. hash.update(widthsBuf.join());
  14290. }
  14291. if (composite) {
  14292. hash.update("compositeFont");
  14293. const compositeWidths = dict.get("W") || baseDict.get("W");
  14294. if (Array.isArray(compositeWidths)) {
  14295. const widthsBuf = [];
  14296. for (const entry of compositeWidths) {
  14297. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  14298. widthsBuf.push(entry.toString());
  14299. } else if (Array.isArray(entry)) {
  14300. const subWidthsBuf = [];
  14301. for (const element of entry) {
  14302. if (typeof element === "number" || element instanceof _primitives.Ref) {
  14303. subWidthsBuf.push(element.toString());
  14304. }
  14305. }
  14306. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  14307. }
  14308. }
  14309. hash.update(widthsBuf.join());
  14310. }
  14311. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  14312. if (cidToGidMap instanceof _primitives.Name) {
  14313. hash.update(cidToGidMap.name);
  14314. } else if (cidToGidMap instanceof _primitives.Ref) {
  14315. hash.update(cidToGidMap.toString());
  14316. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  14317. hash.update(cidToGidMap.peekBytes());
  14318. }
  14319. }
  14320. }
  14321. return {
  14322. descriptor,
  14323. dict,
  14324. baseDict,
  14325. composite,
  14326. type: type.name,
  14327. firstChar,
  14328. lastChar,
  14329. toUnicode,
  14330. hash: hash ? hash.hexdigest() : ""
  14331. };
  14332. }
  14333. async translateFont(_ref9) {
  14334. let {
  14335. descriptor,
  14336. dict,
  14337. baseDict,
  14338. composite,
  14339. type,
  14340. firstChar,
  14341. lastChar,
  14342. toUnicode,
  14343. cssFontInfo
  14344. } = _ref9;
  14345. const isType3Font = type === "Type3";
  14346. let properties;
  14347. if (!descriptor) {
  14348. if (isType3Font) {
  14349. descriptor = new _primitives.Dict(null);
  14350. descriptor.set("FontName", _primitives.Name.get(type));
  14351. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  14352. } else {
  14353. let baseFontName = dict.get("BaseFont");
  14354. if (!(baseFontName instanceof _primitives.Name)) {
  14355. throw new _util.FormatError("Base font is not specified");
  14356. }
  14357. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  14358. const metrics = this.getBaseFontMetrics(baseFontName);
  14359. const fontNameWoStyle = baseFontName.split("-")[0];
  14360. 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);
  14361. properties = {
  14362. type,
  14363. name: baseFontName,
  14364. loadedName: baseDict.loadedName,
  14365. widths: metrics.widths,
  14366. defaultWidth: metrics.defaultWidth,
  14367. isSimulatedFlags: true,
  14368. flags,
  14369. firstChar,
  14370. lastChar,
  14371. toUnicode,
  14372. xHeight: 0,
  14373. capHeight: 0,
  14374. italicAngle: 0,
  14375. isType3Font
  14376. };
  14377. const widths = dict.get("Widths");
  14378. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  14379. let file = null;
  14380. if (standardFontName) {
  14381. properties.isStandardFont = true;
  14382. file = await this.fetchStandardFontData(standardFontName);
  14383. properties.isInternalFont = !!file;
  14384. }
  14385. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  14386. if (widths) {
  14387. const glyphWidths = [];
  14388. let j = firstChar;
  14389. for (const width of widths) {
  14390. glyphWidths[j++] = this.xref.fetchIfRef(width);
  14391. }
  14392. newProperties.widths = glyphWidths;
  14393. } else {
  14394. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  14395. }
  14396. return new _fonts.Font(baseFontName, file, newProperties);
  14397. });
  14398. }
  14399. }
  14400. let fontName = descriptor.get("FontName");
  14401. let baseFont = dict.get("BaseFont");
  14402. if (typeof fontName === "string") {
  14403. fontName = _primitives.Name.get(fontName);
  14404. }
  14405. if (typeof baseFont === "string") {
  14406. baseFont = _primitives.Name.get(baseFont);
  14407. }
  14408. if (!isType3Font) {
  14409. const fontNameStr = fontName && fontName.name;
  14410. const baseFontStr = baseFont && baseFont.name;
  14411. if (fontNameStr !== baseFontStr) {
  14412. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  14413. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  14414. fontName = baseFont;
  14415. }
  14416. }
  14417. }
  14418. fontName = fontName || baseFont;
  14419. if (!(fontName instanceof _primitives.Name)) {
  14420. throw new _util.FormatError("invalid font name");
  14421. }
  14422. let fontFile, subtype, length1, length2, length3;
  14423. try {
  14424. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  14425. } catch (ex) {
  14426. if (!this.options.ignoreErrors) {
  14427. throw ex;
  14428. }
  14429. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  14430. fontFile = new _stream.NullStream();
  14431. }
  14432. let isStandardFont = false;
  14433. let isInternalFont = false;
  14434. let glyphScaleFactors = null;
  14435. if (fontFile) {
  14436. if (fontFile.dict) {
  14437. const subtypeEntry = fontFile.dict.get("Subtype");
  14438. if (subtypeEntry instanceof _primitives.Name) {
  14439. subtype = subtypeEntry.name;
  14440. }
  14441. length1 = fontFile.dict.get("Length1");
  14442. length2 = fontFile.dict.get("Length2");
  14443. length3 = fontFile.dict.get("Length3");
  14444. }
  14445. } else if (cssFontInfo) {
  14446. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  14447. if (standardFontName) {
  14448. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  14449. cssFontInfo.metrics = standardFontName.metrics || null;
  14450. glyphScaleFactors = standardFontName.factors || null;
  14451. fontFile = await this.fetchStandardFontData(standardFontName.name);
  14452. isInternalFont = !!fontFile;
  14453. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  14454. composite = true;
  14455. }
  14456. } else if (!isType3Font) {
  14457. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  14458. if (standardFontName) {
  14459. isStandardFont = true;
  14460. fontFile = await this.fetchStandardFontData(standardFontName);
  14461. isInternalFont = !!fontFile;
  14462. }
  14463. }
  14464. properties = {
  14465. type,
  14466. name: fontName.name,
  14467. subtype,
  14468. file: fontFile,
  14469. length1,
  14470. length2,
  14471. length3,
  14472. isStandardFont,
  14473. isInternalFont,
  14474. loadedName: baseDict.loadedName,
  14475. composite,
  14476. fixedPitch: false,
  14477. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  14478. firstChar,
  14479. lastChar,
  14480. toUnicode,
  14481. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  14482. ascent: descriptor.get("Ascent"),
  14483. descent: descriptor.get("Descent"),
  14484. xHeight: descriptor.get("XHeight") || 0,
  14485. capHeight: descriptor.get("CapHeight") || 0,
  14486. flags: descriptor.get("Flags"),
  14487. italicAngle: descriptor.get("ItalicAngle") || 0,
  14488. isType3Font,
  14489. cssFontInfo,
  14490. scaleFactors: glyphScaleFactors
  14491. };
  14492. if (composite) {
  14493. const cidEncoding = baseDict.get("Encoding");
  14494. if (cidEncoding instanceof _primitives.Name) {
  14495. properties.cidEncoding = cidEncoding.name;
  14496. }
  14497. const cMap = await _cmap.CMapFactory.create({
  14498. encoding: cidEncoding,
  14499. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14500. useCMap: null
  14501. });
  14502. properties.cMap = cMap;
  14503. properties.vertical = properties.cMap.vertical;
  14504. }
  14505. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  14506. this.extractWidths(dict, descriptor, newProperties);
  14507. return new _fonts.Font(fontName.name, fontFile, newProperties);
  14508. });
  14509. }
  14510. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  14511. function buildPath(fontChar) {
  14512. const glyphName = `${font.loadedName}_path_${fontChar}`;
  14513. try {
  14514. if (font.renderer.hasBuiltPath(fontChar)) {
  14515. return;
  14516. }
  14517. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  14518. } catch (reason) {
  14519. if (evaluatorOptions.ignoreErrors) {
  14520. handler.send("UnsupportedFeature", {
  14521. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  14522. });
  14523. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  14524. return;
  14525. }
  14526. throw reason;
  14527. }
  14528. }
  14529. for (const glyph of glyphs) {
  14530. buildPath(glyph.fontChar);
  14531. const accent = glyph.accent;
  14532. if (accent && accent.fontChar) {
  14533. buildPath(accent.fontChar);
  14534. }
  14535. }
  14536. }
  14537. static get fallbackFontDict() {
  14538. const dict = new _primitives.Dict();
  14539. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  14540. dict.set("Type", _primitives.Name.get("FallbackType"));
  14541. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  14542. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  14543. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  14544. }
  14545. }
  14546. exports.PartialEvaluator = PartialEvaluator;
  14547. class TranslatedFont {
  14548. constructor(_ref10) {
  14549. let {
  14550. loadedName,
  14551. font,
  14552. dict,
  14553. evaluatorOptions
  14554. } = _ref10;
  14555. this.loadedName = loadedName;
  14556. this.font = font;
  14557. this.dict = dict;
  14558. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  14559. this.type3Loaded = null;
  14560. this.type3Dependencies = font.isType3Font ? new Set() : null;
  14561. this.sent = false;
  14562. }
  14563. send(handler) {
  14564. if (this.sent) {
  14565. return;
  14566. }
  14567. this.sent = true;
  14568. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  14569. }
  14570. fallback(handler) {
  14571. if (!this.font.data) {
  14572. return;
  14573. }
  14574. this.font.disableFontFace = true;
  14575. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  14576. }
  14577. loadType3Data(evaluator, resources, task) {
  14578. if (this.type3Loaded) {
  14579. return this.type3Loaded;
  14580. }
  14581. if (!this.font.isType3Font) {
  14582. throw new Error("Must be a Type3 font.");
  14583. }
  14584. const type3Evaluator = evaluator.clone({
  14585. ignoreErrors: false
  14586. });
  14587. type3Evaluator.parsingType3Font = true;
  14588. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  14589. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  14590. type3FontRefs.put(this.dict.objId);
  14591. }
  14592. type3Evaluator.type3FontRefs = type3FontRefs;
  14593. const translatedFont = this.font,
  14594. type3Dependencies = this.type3Dependencies;
  14595. let loadCharProcsPromise = Promise.resolve();
  14596. const charProcs = this.dict.get("CharProcs");
  14597. const fontResources = this.dict.get("Resources") || resources;
  14598. const charProcOperatorList = Object.create(null);
  14599. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  14600. width = fontBBox[2] - fontBBox[0],
  14601. height = fontBBox[3] - fontBBox[1];
  14602. const fontBBoxSize = Math.hypot(width, height);
  14603. for (const key of charProcs.getKeys()) {
  14604. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  14605. const glyphStream = charProcs.get(key);
  14606. const operatorList = new _operator_list.OperatorList();
  14607. return type3Evaluator.getOperatorList({
  14608. stream: glyphStream,
  14609. task,
  14610. resources: fontResources,
  14611. operatorList
  14612. }).then(() => {
  14613. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  14614. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  14615. }
  14616. charProcOperatorList[key] = operatorList.getIR();
  14617. for (const dependency of operatorList.dependencies) {
  14618. type3Dependencies.add(dependency);
  14619. }
  14620. }).catch(function (reason) {
  14621. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  14622. const dummyOperatorList = new _operator_list.OperatorList();
  14623. charProcOperatorList[key] = dummyOperatorList.getIR();
  14624. });
  14625. });
  14626. }
  14627. this.type3Loaded = loadCharProcsPromise.then(() => {
  14628. translatedFont.charProcOperatorList = charProcOperatorList;
  14629. if (this._bbox) {
  14630. translatedFont.isCharBBox = true;
  14631. translatedFont.bbox = this._bbox;
  14632. }
  14633. });
  14634. return this.type3Loaded;
  14635. }
  14636. _removeType3ColorOperators(operatorList) {
  14637. let fontBBoxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
  14638. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  14639. width = charBBox[2] - charBBox[0],
  14640. height = charBBox[3] - charBBox[1];
  14641. const charBBoxSize = Math.hypot(width, height);
  14642. if (width === 0 || height === 0) {
  14643. operatorList.fnArray.splice(0, 1);
  14644. operatorList.argsArray.splice(0, 1);
  14645. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  14646. if (!this._bbox) {
  14647. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  14648. }
  14649. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  14650. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  14651. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  14652. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  14653. }
  14654. let i = 0,
  14655. ii = operatorList.length;
  14656. while (i < ii) {
  14657. switch (operatorList.fnArray[i]) {
  14658. case _util.OPS.setCharWidthAndBounds:
  14659. break;
  14660. case _util.OPS.setStrokeColorSpace:
  14661. case _util.OPS.setFillColorSpace:
  14662. case _util.OPS.setStrokeColor:
  14663. case _util.OPS.setStrokeColorN:
  14664. case _util.OPS.setFillColor:
  14665. case _util.OPS.setFillColorN:
  14666. case _util.OPS.setStrokeGray:
  14667. case _util.OPS.setFillGray:
  14668. case _util.OPS.setStrokeRGBColor:
  14669. case _util.OPS.setFillRGBColor:
  14670. case _util.OPS.setStrokeCMYKColor:
  14671. case _util.OPS.setFillCMYKColor:
  14672. case _util.OPS.shadingFill:
  14673. case _util.OPS.setRenderingIntent:
  14674. operatorList.fnArray.splice(i, 1);
  14675. operatorList.argsArray.splice(i, 1);
  14676. ii--;
  14677. continue;
  14678. case _util.OPS.setGState:
  14679. const [gStateObj] = operatorList.argsArray[i];
  14680. let j = 0,
  14681. jj = gStateObj.length;
  14682. while (j < jj) {
  14683. const [gStateKey] = gStateObj[j];
  14684. switch (gStateKey) {
  14685. case "TR":
  14686. case "TR2":
  14687. case "HT":
  14688. case "BG":
  14689. case "BG2":
  14690. case "UCR":
  14691. case "UCR2":
  14692. gStateObj.splice(j, 1);
  14693. jj--;
  14694. continue;
  14695. }
  14696. j++;
  14697. }
  14698. break;
  14699. }
  14700. i++;
  14701. }
  14702. }
  14703. }
  14704. class StateManager {
  14705. constructor() {
  14706. let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new EvalState();
  14707. this.state = initialState;
  14708. this.stateStack = [];
  14709. }
  14710. save() {
  14711. const old = this.state;
  14712. this.stateStack.push(this.state);
  14713. this.state = old.clone();
  14714. }
  14715. restore() {
  14716. const prev = this.stateStack.pop();
  14717. if (prev) {
  14718. this.state = prev;
  14719. }
  14720. }
  14721. transform(args) {
  14722. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  14723. }
  14724. }
  14725. class TextState {
  14726. constructor() {
  14727. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14728. this.fontName = null;
  14729. this.fontSize = 0;
  14730. this.loadedName = null;
  14731. this.font = null;
  14732. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  14733. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  14734. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  14735. this.charSpacing = 0;
  14736. this.wordSpacing = 0;
  14737. this.leading = 0;
  14738. this.textHScale = 1;
  14739. this.textRise = 0;
  14740. }
  14741. setTextMatrix(a, b, c, d, e, f) {
  14742. const m = this.textMatrix;
  14743. m[0] = a;
  14744. m[1] = b;
  14745. m[2] = c;
  14746. m[3] = d;
  14747. m[4] = e;
  14748. m[5] = f;
  14749. }
  14750. setTextLineMatrix(a, b, c, d, e, f) {
  14751. const m = this.textLineMatrix;
  14752. m[0] = a;
  14753. m[1] = b;
  14754. m[2] = c;
  14755. m[3] = d;
  14756. m[4] = e;
  14757. m[5] = f;
  14758. }
  14759. translateTextMatrix(x, y) {
  14760. const m = this.textMatrix;
  14761. m[4] = m[0] * x + m[2] * y + m[4];
  14762. m[5] = m[1] * x + m[3] * y + m[5];
  14763. }
  14764. translateTextLineMatrix(x, y) {
  14765. const m = this.textLineMatrix;
  14766. m[4] = m[0] * x + m[2] * y + m[4];
  14767. m[5] = m[1] * x + m[3] * y + m[5];
  14768. }
  14769. carriageReturn() {
  14770. this.translateTextLineMatrix(0, -this.leading);
  14771. this.textMatrix = this.textLineMatrix.slice();
  14772. }
  14773. clone() {
  14774. const clone = Object.create(this);
  14775. clone.textMatrix = this.textMatrix.slice();
  14776. clone.textLineMatrix = this.textLineMatrix.slice();
  14777. clone.fontMatrix = this.fontMatrix.slice();
  14778. return clone;
  14779. }
  14780. }
  14781. class EvalState {
  14782. constructor() {
  14783. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14784. this.font = null;
  14785. this.textRenderingMode = _util.TextRenderingMode.FILL;
  14786. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  14787. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  14788. }
  14789. clone() {
  14790. return Object.create(this);
  14791. }
  14792. }
  14793. class EvaluatorPreprocessor {
  14794. static get opMap() {
  14795. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  14796. t.w = {
  14797. id: _util.OPS.setLineWidth,
  14798. numArgs: 1,
  14799. variableArgs: false
  14800. };
  14801. t.J = {
  14802. id: _util.OPS.setLineCap,
  14803. numArgs: 1,
  14804. variableArgs: false
  14805. };
  14806. t.j = {
  14807. id: _util.OPS.setLineJoin,
  14808. numArgs: 1,
  14809. variableArgs: false
  14810. };
  14811. t.M = {
  14812. id: _util.OPS.setMiterLimit,
  14813. numArgs: 1,
  14814. variableArgs: false
  14815. };
  14816. t.d = {
  14817. id: _util.OPS.setDash,
  14818. numArgs: 2,
  14819. variableArgs: false
  14820. };
  14821. t.ri = {
  14822. id: _util.OPS.setRenderingIntent,
  14823. numArgs: 1,
  14824. variableArgs: false
  14825. };
  14826. t.i = {
  14827. id: _util.OPS.setFlatness,
  14828. numArgs: 1,
  14829. variableArgs: false
  14830. };
  14831. t.gs = {
  14832. id: _util.OPS.setGState,
  14833. numArgs: 1,
  14834. variableArgs: false
  14835. };
  14836. t.q = {
  14837. id: _util.OPS.save,
  14838. numArgs: 0,
  14839. variableArgs: false
  14840. };
  14841. t.Q = {
  14842. id: _util.OPS.restore,
  14843. numArgs: 0,
  14844. variableArgs: false
  14845. };
  14846. t.cm = {
  14847. id: _util.OPS.transform,
  14848. numArgs: 6,
  14849. variableArgs: false
  14850. };
  14851. t.m = {
  14852. id: _util.OPS.moveTo,
  14853. numArgs: 2,
  14854. variableArgs: false
  14855. };
  14856. t.l = {
  14857. id: _util.OPS.lineTo,
  14858. numArgs: 2,
  14859. variableArgs: false
  14860. };
  14861. t.c = {
  14862. id: _util.OPS.curveTo,
  14863. numArgs: 6,
  14864. variableArgs: false
  14865. };
  14866. t.v = {
  14867. id: _util.OPS.curveTo2,
  14868. numArgs: 4,
  14869. variableArgs: false
  14870. };
  14871. t.y = {
  14872. id: _util.OPS.curveTo3,
  14873. numArgs: 4,
  14874. variableArgs: false
  14875. };
  14876. t.h = {
  14877. id: _util.OPS.closePath,
  14878. numArgs: 0,
  14879. variableArgs: false
  14880. };
  14881. t.re = {
  14882. id: _util.OPS.rectangle,
  14883. numArgs: 4,
  14884. variableArgs: false
  14885. };
  14886. t.S = {
  14887. id: _util.OPS.stroke,
  14888. numArgs: 0,
  14889. variableArgs: false
  14890. };
  14891. t.s = {
  14892. id: _util.OPS.closeStroke,
  14893. numArgs: 0,
  14894. variableArgs: false
  14895. };
  14896. t.f = {
  14897. id: _util.OPS.fill,
  14898. numArgs: 0,
  14899. variableArgs: false
  14900. };
  14901. t.F = {
  14902. id: _util.OPS.fill,
  14903. numArgs: 0,
  14904. variableArgs: false
  14905. };
  14906. t["f*"] = {
  14907. id: _util.OPS.eoFill,
  14908. numArgs: 0,
  14909. variableArgs: false
  14910. };
  14911. t.B = {
  14912. id: _util.OPS.fillStroke,
  14913. numArgs: 0,
  14914. variableArgs: false
  14915. };
  14916. t["B*"] = {
  14917. id: _util.OPS.eoFillStroke,
  14918. numArgs: 0,
  14919. variableArgs: false
  14920. };
  14921. t.b = {
  14922. id: _util.OPS.closeFillStroke,
  14923. numArgs: 0,
  14924. variableArgs: false
  14925. };
  14926. t["b*"] = {
  14927. id: _util.OPS.closeEOFillStroke,
  14928. numArgs: 0,
  14929. variableArgs: false
  14930. };
  14931. t.n = {
  14932. id: _util.OPS.endPath,
  14933. numArgs: 0,
  14934. variableArgs: false
  14935. };
  14936. t.W = {
  14937. id: _util.OPS.clip,
  14938. numArgs: 0,
  14939. variableArgs: false
  14940. };
  14941. t["W*"] = {
  14942. id: _util.OPS.eoClip,
  14943. numArgs: 0,
  14944. variableArgs: false
  14945. };
  14946. t.BT = {
  14947. id: _util.OPS.beginText,
  14948. numArgs: 0,
  14949. variableArgs: false
  14950. };
  14951. t.ET = {
  14952. id: _util.OPS.endText,
  14953. numArgs: 0,
  14954. variableArgs: false
  14955. };
  14956. t.Tc = {
  14957. id: _util.OPS.setCharSpacing,
  14958. numArgs: 1,
  14959. variableArgs: false
  14960. };
  14961. t.Tw = {
  14962. id: _util.OPS.setWordSpacing,
  14963. numArgs: 1,
  14964. variableArgs: false
  14965. };
  14966. t.Tz = {
  14967. id: _util.OPS.setHScale,
  14968. numArgs: 1,
  14969. variableArgs: false
  14970. };
  14971. t.TL = {
  14972. id: _util.OPS.setLeading,
  14973. numArgs: 1,
  14974. variableArgs: false
  14975. };
  14976. t.Tf = {
  14977. id: _util.OPS.setFont,
  14978. numArgs: 2,
  14979. variableArgs: false
  14980. };
  14981. t.Tr = {
  14982. id: _util.OPS.setTextRenderingMode,
  14983. numArgs: 1,
  14984. variableArgs: false
  14985. };
  14986. t.Ts = {
  14987. id: _util.OPS.setTextRise,
  14988. numArgs: 1,
  14989. variableArgs: false
  14990. };
  14991. t.Td = {
  14992. id: _util.OPS.moveText,
  14993. numArgs: 2,
  14994. variableArgs: false
  14995. };
  14996. t.TD = {
  14997. id: _util.OPS.setLeadingMoveText,
  14998. numArgs: 2,
  14999. variableArgs: false
  15000. };
  15001. t.Tm = {
  15002. id: _util.OPS.setTextMatrix,
  15003. numArgs: 6,
  15004. variableArgs: false
  15005. };
  15006. t["T*"] = {
  15007. id: _util.OPS.nextLine,
  15008. numArgs: 0,
  15009. variableArgs: false
  15010. };
  15011. t.Tj = {
  15012. id: _util.OPS.showText,
  15013. numArgs: 1,
  15014. variableArgs: false
  15015. };
  15016. t.TJ = {
  15017. id: _util.OPS.showSpacedText,
  15018. numArgs: 1,
  15019. variableArgs: false
  15020. };
  15021. t["'"] = {
  15022. id: _util.OPS.nextLineShowText,
  15023. numArgs: 1,
  15024. variableArgs: false
  15025. };
  15026. t['"'] = {
  15027. id: _util.OPS.nextLineSetSpacingShowText,
  15028. numArgs: 3,
  15029. variableArgs: false
  15030. };
  15031. t.d0 = {
  15032. id: _util.OPS.setCharWidth,
  15033. numArgs: 2,
  15034. variableArgs: false
  15035. };
  15036. t.d1 = {
  15037. id: _util.OPS.setCharWidthAndBounds,
  15038. numArgs: 6,
  15039. variableArgs: false
  15040. };
  15041. t.CS = {
  15042. id: _util.OPS.setStrokeColorSpace,
  15043. numArgs: 1,
  15044. variableArgs: false
  15045. };
  15046. t.cs = {
  15047. id: _util.OPS.setFillColorSpace,
  15048. numArgs: 1,
  15049. variableArgs: false
  15050. };
  15051. t.SC = {
  15052. id: _util.OPS.setStrokeColor,
  15053. numArgs: 4,
  15054. variableArgs: true
  15055. };
  15056. t.SCN = {
  15057. id: _util.OPS.setStrokeColorN,
  15058. numArgs: 33,
  15059. variableArgs: true
  15060. };
  15061. t.sc = {
  15062. id: _util.OPS.setFillColor,
  15063. numArgs: 4,
  15064. variableArgs: true
  15065. };
  15066. t.scn = {
  15067. id: _util.OPS.setFillColorN,
  15068. numArgs: 33,
  15069. variableArgs: true
  15070. };
  15071. t.G = {
  15072. id: _util.OPS.setStrokeGray,
  15073. numArgs: 1,
  15074. variableArgs: false
  15075. };
  15076. t.g = {
  15077. id: _util.OPS.setFillGray,
  15078. numArgs: 1,
  15079. variableArgs: false
  15080. };
  15081. t.RG = {
  15082. id: _util.OPS.setStrokeRGBColor,
  15083. numArgs: 3,
  15084. variableArgs: false
  15085. };
  15086. t.rg = {
  15087. id: _util.OPS.setFillRGBColor,
  15088. numArgs: 3,
  15089. variableArgs: false
  15090. };
  15091. t.K = {
  15092. id: _util.OPS.setStrokeCMYKColor,
  15093. numArgs: 4,
  15094. variableArgs: false
  15095. };
  15096. t.k = {
  15097. id: _util.OPS.setFillCMYKColor,
  15098. numArgs: 4,
  15099. variableArgs: false
  15100. };
  15101. t.sh = {
  15102. id: _util.OPS.shadingFill,
  15103. numArgs: 1,
  15104. variableArgs: false
  15105. };
  15106. t.BI = {
  15107. id: _util.OPS.beginInlineImage,
  15108. numArgs: 0,
  15109. variableArgs: false
  15110. };
  15111. t.ID = {
  15112. id: _util.OPS.beginImageData,
  15113. numArgs: 0,
  15114. variableArgs: false
  15115. };
  15116. t.EI = {
  15117. id: _util.OPS.endInlineImage,
  15118. numArgs: 1,
  15119. variableArgs: false
  15120. };
  15121. t.Do = {
  15122. id: _util.OPS.paintXObject,
  15123. numArgs: 1,
  15124. variableArgs: false
  15125. };
  15126. t.MP = {
  15127. id: _util.OPS.markPoint,
  15128. numArgs: 1,
  15129. variableArgs: false
  15130. };
  15131. t.DP = {
  15132. id: _util.OPS.markPointProps,
  15133. numArgs: 2,
  15134. variableArgs: false
  15135. };
  15136. t.BMC = {
  15137. id: _util.OPS.beginMarkedContent,
  15138. numArgs: 1,
  15139. variableArgs: false
  15140. };
  15141. t.BDC = {
  15142. id: _util.OPS.beginMarkedContentProps,
  15143. numArgs: 2,
  15144. variableArgs: false
  15145. };
  15146. t.EMC = {
  15147. id: _util.OPS.endMarkedContent,
  15148. numArgs: 0,
  15149. variableArgs: false
  15150. };
  15151. t.BX = {
  15152. id: _util.OPS.beginCompat,
  15153. numArgs: 0,
  15154. variableArgs: false
  15155. };
  15156. t.EX = {
  15157. id: _util.OPS.endCompat,
  15158. numArgs: 0,
  15159. variableArgs: false
  15160. };
  15161. t.BM = null;
  15162. t.BD = null;
  15163. t.true = null;
  15164. t.fa = null;
  15165. t.fal = null;
  15166. t.fals = null;
  15167. t.false = null;
  15168. t.nu = null;
  15169. t.nul = null;
  15170. t.null = null;
  15171. });
  15172. return (0, _util.shadow)(this, "opMap", getOPMap());
  15173. }
  15174. static get MAX_INVALID_PATH_OPS() {
  15175. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  15176. }
  15177. constructor(stream, xref) {
  15178. let stateManager = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new StateManager();
  15179. this.parser = new _parser.Parser({
  15180. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  15181. xref
  15182. });
  15183. this.stateManager = stateManager;
  15184. this.nonProcessedArgs = [];
  15185. this._isPathOp = false;
  15186. this._numInvalidPathOPS = 0;
  15187. }
  15188. get savedStatesDepth() {
  15189. return this.stateManager.stateStack.length;
  15190. }
  15191. read(operation) {
  15192. let args = operation.args;
  15193. while (true) {
  15194. const obj = this.parser.getObj();
  15195. if (obj instanceof _primitives.Cmd) {
  15196. const cmd = obj.cmd;
  15197. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  15198. if (!opSpec) {
  15199. (0, _util.warn)(`Unknown command "${cmd}".`);
  15200. continue;
  15201. }
  15202. const fn = opSpec.id;
  15203. const numArgs = opSpec.numArgs;
  15204. let argsLength = args !== null ? args.length : 0;
  15205. if (!this._isPathOp) {
  15206. this._numInvalidPathOPS = 0;
  15207. }
  15208. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  15209. if (!opSpec.variableArgs) {
  15210. if (argsLength !== numArgs) {
  15211. const nonProcessedArgs = this.nonProcessedArgs;
  15212. while (argsLength > numArgs) {
  15213. nonProcessedArgs.push(args.shift());
  15214. argsLength--;
  15215. }
  15216. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  15217. if (args === null) {
  15218. args = [];
  15219. }
  15220. args.unshift(nonProcessedArgs.pop());
  15221. argsLength++;
  15222. }
  15223. }
  15224. if (argsLength < numArgs) {
  15225. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  15226. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  15227. throw new _util.FormatError(`Invalid ${partialMsg}`);
  15228. }
  15229. (0, _util.warn)(`Skipping ${partialMsg}`);
  15230. if (args !== null) {
  15231. args.length = 0;
  15232. }
  15233. continue;
  15234. }
  15235. } else if (argsLength > numArgs) {
  15236. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  15237. }
  15238. this.preprocessCommand(fn, args);
  15239. operation.fn = fn;
  15240. operation.args = args;
  15241. return true;
  15242. }
  15243. if (obj === _primitives.EOF) {
  15244. return false;
  15245. }
  15246. if (obj !== null) {
  15247. if (args === null) {
  15248. args = [];
  15249. }
  15250. args.push(obj);
  15251. if (args.length > 33) {
  15252. throw new _util.FormatError("Too many arguments");
  15253. }
  15254. }
  15255. }
  15256. }
  15257. preprocessCommand(fn, args) {
  15258. switch (fn | 0) {
  15259. case _util.OPS.save:
  15260. this.stateManager.save();
  15261. break;
  15262. case _util.OPS.restore:
  15263. this.stateManager.restore();
  15264. break;
  15265. case _util.OPS.transform:
  15266. this.stateManager.transform(args);
  15267. break;
  15268. }
  15269. }
  15270. }
  15271. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  15272. /***/ }),
  15273. /* 145 */
  15274. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15275. "use strict";
  15276. Object.defineProperty(exports, "__esModule", ({
  15277. value: true
  15278. }));
  15279. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  15280. var _util = __w_pdfjs_require__(2);
  15281. var _primitives = __w_pdfjs_require__(134);
  15282. var _base_stream = __w_pdfjs_require__(136);
  15283. var _parser = __w_pdfjs_require__(146);
  15284. var _core_utils = __w_pdfjs_require__(135);
  15285. var _stream = __w_pdfjs_require__(139);
  15286. 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"];
  15287. const MAX_MAP_RANGE = 2 ** 24 - 1;
  15288. class CMap {
  15289. constructor() {
  15290. let builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  15291. this.codespaceRanges = [[], [], [], []];
  15292. this.numCodespaceRanges = 0;
  15293. this._map = [];
  15294. this.name = "";
  15295. this.vertical = false;
  15296. this.useCMap = null;
  15297. this.builtInCMap = builtInCMap;
  15298. }
  15299. addCodespaceRange(n, low, high) {
  15300. this.codespaceRanges[n - 1].push(low, high);
  15301. this.numCodespaceRanges++;
  15302. }
  15303. mapCidRange(low, high, dstLow) {
  15304. if (high - low > MAX_MAP_RANGE) {
  15305. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  15306. }
  15307. while (low <= high) {
  15308. this._map[low++] = dstLow++;
  15309. }
  15310. }
  15311. mapBfRange(low, high, dstLow) {
  15312. if (high - low > MAX_MAP_RANGE) {
  15313. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  15314. }
  15315. const lastByte = dstLow.length - 1;
  15316. while (low <= high) {
  15317. this._map[low++] = dstLow;
  15318. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  15319. if (nextCharCode > 0xff) {
  15320. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  15321. continue;
  15322. }
  15323. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  15324. }
  15325. }
  15326. mapBfRangeToArray(low, high, array) {
  15327. if (high - low > MAX_MAP_RANGE) {
  15328. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  15329. }
  15330. const ii = array.length;
  15331. let i = 0;
  15332. while (low <= high && i < ii) {
  15333. this._map[low] = array[i++];
  15334. ++low;
  15335. }
  15336. }
  15337. mapOne(src, dst) {
  15338. this._map[src] = dst;
  15339. }
  15340. lookup(code) {
  15341. return this._map[code];
  15342. }
  15343. contains(code) {
  15344. return this._map[code] !== undefined;
  15345. }
  15346. forEach(callback) {
  15347. const map = this._map;
  15348. const length = map.length;
  15349. if (length <= 0x10000) {
  15350. for (let i = 0; i < length; i++) {
  15351. if (map[i] !== undefined) {
  15352. callback(i, map[i]);
  15353. }
  15354. }
  15355. } else {
  15356. for (const i in map) {
  15357. callback(i, map[i]);
  15358. }
  15359. }
  15360. }
  15361. charCodeOf(value) {
  15362. const map = this._map;
  15363. if (map.length <= 0x10000) {
  15364. return map.indexOf(value);
  15365. }
  15366. for (const charCode in map) {
  15367. if (map[charCode] === value) {
  15368. return charCode | 0;
  15369. }
  15370. }
  15371. return -1;
  15372. }
  15373. getMap() {
  15374. return this._map;
  15375. }
  15376. readCharCode(str, offset, out) {
  15377. let c = 0;
  15378. const codespaceRanges = this.codespaceRanges;
  15379. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  15380. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  15381. const codespaceRange = codespaceRanges[n];
  15382. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  15383. const low = codespaceRange[k++];
  15384. const high = codespaceRange[k++];
  15385. if (c >= low && c <= high) {
  15386. out.charcode = c;
  15387. out.length = n + 1;
  15388. return;
  15389. }
  15390. }
  15391. }
  15392. out.charcode = 0;
  15393. out.length = 1;
  15394. }
  15395. getCharCodeLength(charCode) {
  15396. const codespaceRanges = this.codespaceRanges;
  15397. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  15398. const codespaceRange = codespaceRanges[n];
  15399. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  15400. const low = codespaceRange[k++];
  15401. const high = codespaceRange[k++];
  15402. if (charCode >= low && charCode <= high) {
  15403. return n + 1;
  15404. }
  15405. }
  15406. }
  15407. return 1;
  15408. }
  15409. get length() {
  15410. return this._map.length;
  15411. }
  15412. get isIdentityCMap() {
  15413. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  15414. return false;
  15415. }
  15416. if (this._map.length !== 0x10000) {
  15417. return false;
  15418. }
  15419. for (let i = 0; i < 0x10000; i++) {
  15420. if (this._map[i] !== i) {
  15421. return false;
  15422. }
  15423. }
  15424. return true;
  15425. }
  15426. }
  15427. exports.CMap = CMap;
  15428. class IdentityCMap extends CMap {
  15429. constructor(vertical, n) {
  15430. super();
  15431. this.vertical = vertical;
  15432. this.addCodespaceRange(n, 0, 0xffff);
  15433. }
  15434. mapCidRange(low, high, dstLow) {
  15435. (0, _util.unreachable)("should not call mapCidRange");
  15436. }
  15437. mapBfRange(low, high, dstLow) {
  15438. (0, _util.unreachable)("should not call mapBfRange");
  15439. }
  15440. mapBfRangeToArray(low, high, array) {
  15441. (0, _util.unreachable)("should not call mapBfRangeToArray");
  15442. }
  15443. mapOne(src, dst) {
  15444. (0, _util.unreachable)("should not call mapCidOne");
  15445. }
  15446. lookup(code) {
  15447. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  15448. }
  15449. contains(code) {
  15450. return Number.isInteger(code) && code <= 0xffff;
  15451. }
  15452. forEach(callback) {
  15453. for (let i = 0; i <= 0xffff; i++) {
  15454. callback(i, i);
  15455. }
  15456. }
  15457. charCodeOf(value) {
  15458. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  15459. }
  15460. getMap() {
  15461. const map = new Array(0x10000);
  15462. for (let i = 0; i <= 0xffff; i++) {
  15463. map[i] = i;
  15464. }
  15465. return map;
  15466. }
  15467. get length() {
  15468. return 0x10000;
  15469. }
  15470. get isIdentityCMap() {
  15471. (0, _util.unreachable)("should not access .isIdentityCMap");
  15472. }
  15473. }
  15474. exports.IdentityCMap = IdentityCMap;
  15475. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  15476. function hexToInt(a, size) {
  15477. let n = 0;
  15478. for (let i = 0; i <= size; i++) {
  15479. n = n << 8 | a[i];
  15480. }
  15481. return n >>> 0;
  15482. }
  15483. function hexToStr(a, size) {
  15484. if (size === 1) {
  15485. return String.fromCharCode(a[0], a[1]);
  15486. }
  15487. if (size === 3) {
  15488. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  15489. }
  15490. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  15491. }
  15492. function addHex(a, b, size) {
  15493. let c = 0;
  15494. for (let i = size; i >= 0; i--) {
  15495. c += a[i] + b[i];
  15496. a[i] = c & 255;
  15497. c >>= 8;
  15498. }
  15499. }
  15500. function incHex(a, size) {
  15501. let c = 1;
  15502. for (let i = size; i >= 0 && c > 0; i--) {
  15503. c += a[i];
  15504. a[i] = c & 255;
  15505. c >>= 8;
  15506. }
  15507. }
  15508. const MAX_NUM_SIZE = 16;
  15509. const MAX_ENCODED_NUM_SIZE = 19;
  15510. class BinaryCMapStream {
  15511. constructor(data) {
  15512. this.buffer = data;
  15513. this.pos = 0;
  15514. this.end = data.length;
  15515. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  15516. }
  15517. readByte() {
  15518. if (this.pos >= this.end) {
  15519. return -1;
  15520. }
  15521. return this.buffer[this.pos++];
  15522. }
  15523. readNumber() {
  15524. let n = 0;
  15525. let last;
  15526. do {
  15527. const b = this.readByte();
  15528. if (b < 0) {
  15529. throw new _util.FormatError("unexpected EOF in bcmap");
  15530. }
  15531. last = !(b & 0x80);
  15532. n = n << 7 | b & 0x7f;
  15533. } while (!last);
  15534. return n;
  15535. }
  15536. readSigned() {
  15537. const n = this.readNumber();
  15538. return n & 1 ? ~(n >>> 1) : n >>> 1;
  15539. }
  15540. readHex(num, size) {
  15541. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  15542. this.pos += size + 1;
  15543. }
  15544. readHexNumber(num, size) {
  15545. let last;
  15546. const stack = this.tmpBuf;
  15547. let sp = 0;
  15548. do {
  15549. const b = this.readByte();
  15550. if (b < 0) {
  15551. throw new _util.FormatError("unexpected EOF in bcmap");
  15552. }
  15553. last = !(b & 0x80);
  15554. stack[sp++] = b & 0x7f;
  15555. } while (!last);
  15556. let i = size,
  15557. buffer = 0,
  15558. bufferSize = 0;
  15559. while (i >= 0) {
  15560. while (bufferSize < 8 && stack.length > 0) {
  15561. buffer |= stack[--sp] << bufferSize;
  15562. bufferSize += 7;
  15563. }
  15564. num[i] = buffer & 255;
  15565. i--;
  15566. buffer >>= 8;
  15567. bufferSize -= 8;
  15568. }
  15569. }
  15570. readHexSigned(num, size) {
  15571. this.readHexNumber(num, size);
  15572. const sign = num[size] & 1 ? 255 : 0;
  15573. let c = 0;
  15574. for (let i = 0; i <= size; i++) {
  15575. c = (c & 1) << 8 | num[i];
  15576. num[i] = c >> 1 ^ sign;
  15577. }
  15578. }
  15579. readString() {
  15580. const len = this.readNumber();
  15581. let s = "";
  15582. for (let i = 0; i < len; i++) {
  15583. s += String.fromCharCode(this.readNumber());
  15584. }
  15585. return s;
  15586. }
  15587. }
  15588. class BinaryCMapReader {
  15589. async process(data, cMap, extend) {
  15590. const stream = new BinaryCMapStream(data);
  15591. const header = stream.readByte();
  15592. cMap.vertical = !!(header & 1);
  15593. let useCMap = null;
  15594. const start = new Uint8Array(MAX_NUM_SIZE);
  15595. const end = new Uint8Array(MAX_NUM_SIZE);
  15596. const char = new Uint8Array(MAX_NUM_SIZE);
  15597. const charCode = new Uint8Array(MAX_NUM_SIZE);
  15598. const tmp = new Uint8Array(MAX_NUM_SIZE);
  15599. let code;
  15600. let b;
  15601. while ((b = stream.readByte()) >= 0) {
  15602. const type = b >> 5;
  15603. if (type === 7) {
  15604. switch (b & 0x1f) {
  15605. case 0:
  15606. stream.readString();
  15607. break;
  15608. case 1:
  15609. useCMap = stream.readString();
  15610. break;
  15611. }
  15612. continue;
  15613. }
  15614. const sequence = !!(b & 0x10);
  15615. const dataSize = b & 15;
  15616. if (dataSize + 1 > MAX_NUM_SIZE) {
  15617. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  15618. }
  15619. const ucs2DataSize = 1;
  15620. const subitemsCount = stream.readNumber();
  15621. switch (type) {
  15622. case 0:
  15623. stream.readHex(start, dataSize);
  15624. stream.readHexNumber(end, dataSize);
  15625. addHex(end, start, dataSize);
  15626. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15627. for (let i = 1; i < subitemsCount; i++) {
  15628. incHex(end, dataSize);
  15629. stream.readHexNumber(start, dataSize);
  15630. addHex(start, end, dataSize);
  15631. stream.readHexNumber(end, dataSize);
  15632. addHex(end, start, dataSize);
  15633. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15634. }
  15635. break;
  15636. case 1:
  15637. stream.readHex(start, dataSize);
  15638. stream.readHexNumber(end, dataSize);
  15639. addHex(end, start, dataSize);
  15640. stream.readNumber();
  15641. for (let i = 1; i < subitemsCount; i++) {
  15642. incHex(end, dataSize);
  15643. stream.readHexNumber(start, dataSize);
  15644. addHex(start, end, dataSize);
  15645. stream.readHexNumber(end, dataSize);
  15646. addHex(end, start, dataSize);
  15647. stream.readNumber();
  15648. }
  15649. break;
  15650. case 2:
  15651. stream.readHex(char, dataSize);
  15652. code = stream.readNumber();
  15653. cMap.mapOne(hexToInt(char, dataSize), code);
  15654. for (let i = 1; i < subitemsCount; i++) {
  15655. incHex(char, dataSize);
  15656. if (!sequence) {
  15657. stream.readHexNumber(tmp, dataSize);
  15658. addHex(char, tmp, dataSize);
  15659. }
  15660. code = stream.readSigned() + (code + 1);
  15661. cMap.mapOne(hexToInt(char, dataSize), code);
  15662. }
  15663. break;
  15664. case 3:
  15665. stream.readHex(start, dataSize);
  15666. stream.readHexNumber(end, dataSize);
  15667. addHex(end, start, dataSize);
  15668. code = stream.readNumber();
  15669. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15670. for (let i = 1; i < subitemsCount; i++) {
  15671. incHex(end, dataSize);
  15672. if (!sequence) {
  15673. stream.readHexNumber(start, dataSize);
  15674. addHex(start, end, dataSize);
  15675. } else {
  15676. start.set(end);
  15677. }
  15678. stream.readHexNumber(end, dataSize);
  15679. addHex(end, start, dataSize);
  15680. code = stream.readNumber();
  15681. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15682. }
  15683. break;
  15684. case 4:
  15685. stream.readHex(char, ucs2DataSize);
  15686. stream.readHex(charCode, dataSize);
  15687. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15688. for (let i = 1; i < subitemsCount; i++) {
  15689. incHex(char, ucs2DataSize);
  15690. if (!sequence) {
  15691. stream.readHexNumber(tmp, ucs2DataSize);
  15692. addHex(char, tmp, ucs2DataSize);
  15693. }
  15694. incHex(charCode, dataSize);
  15695. stream.readHexSigned(tmp, dataSize);
  15696. addHex(charCode, tmp, dataSize);
  15697. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15698. }
  15699. break;
  15700. case 5:
  15701. stream.readHex(start, ucs2DataSize);
  15702. stream.readHexNumber(end, ucs2DataSize);
  15703. addHex(end, start, ucs2DataSize);
  15704. stream.readHex(charCode, dataSize);
  15705. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15706. for (let i = 1; i < subitemsCount; i++) {
  15707. incHex(end, ucs2DataSize);
  15708. if (!sequence) {
  15709. stream.readHexNumber(start, ucs2DataSize);
  15710. addHex(start, end, ucs2DataSize);
  15711. } else {
  15712. start.set(end);
  15713. }
  15714. stream.readHexNumber(end, ucs2DataSize);
  15715. addHex(end, start, ucs2DataSize);
  15716. stream.readHex(charCode, dataSize);
  15717. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15718. }
  15719. break;
  15720. default:
  15721. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  15722. }
  15723. }
  15724. if (useCMap) {
  15725. return extend(useCMap);
  15726. }
  15727. return cMap;
  15728. }
  15729. }
  15730. return BinaryCMapReader;
  15731. }();
  15732. const CMapFactory = function CMapFactoryClosure() {
  15733. function strToInt(str) {
  15734. let a = 0;
  15735. for (let i = 0; i < str.length; i++) {
  15736. a = a << 8 | str.charCodeAt(i);
  15737. }
  15738. return a >>> 0;
  15739. }
  15740. function expectString(obj) {
  15741. if (typeof obj !== "string") {
  15742. throw new _util.FormatError("Malformed CMap: expected string.");
  15743. }
  15744. }
  15745. function expectInt(obj) {
  15746. if (!Number.isInteger(obj)) {
  15747. throw new _util.FormatError("Malformed CMap: expected int.");
  15748. }
  15749. }
  15750. function parseBfChar(cMap, lexer) {
  15751. while (true) {
  15752. let obj = lexer.getObj();
  15753. if (obj === _primitives.EOF) {
  15754. break;
  15755. }
  15756. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  15757. return;
  15758. }
  15759. expectString(obj);
  15760. const src = strToInt(obj);
  15761. obj = lexer.getObj();
  15762. expectString(obj);
  15763. const dst = obj;
  15764. cMap.mapOne(src, dst);
  15765. }
  15766. }
  15767. function parseBfRange(cMap, lexer) {
  15768. while (true) {
  15769. let obj = lexer.getObj();
  15770. if (obj === _primitives.EOF) {
  15771. break;
  15772. }
  15773. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  15774. return;
  15775. }
  15776. expectString(obj);
  15777. const low = strToInt(obj);
  15778. obj = lexer.getObj();
  15779. expectString(obj);
  15780. const high = strToInt(obj);
  15781. obj = lexer.getObj();
  15782. if (Number.isInteger(obj) || typeof obj === "string") {
  15783. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  15784. cMap.mapBfRange(low, high, dstLow);
  15785. } else if ((0, _primitives.isCmd)(obj, "[")) {
  15786. obj = lexer.getObj();
  15787. const array = [];
  15788. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  15789. array.push(obj);
  15790. obj = lexer.getObj();
  15791. }
  15792. cMap.mapBfRangeToArray(low, high, array);
  15793. } else {
  15794. break;
  15795. }
  15796. }
  15797. throw new _util.FormatError("Invalid bf range.");
  15798. }
  15799. function parseCidChar(cMap, lexer) {
  15800. while (true) {
  15801. let obj = lexer.getObj();
  15802. if (obj === _primitives.EOF) {
  15803. break;
  15804. }
  15805. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  15806. return;
  15807. }
  15808. expectString(obj);
  15809. const src = strToInt(obj);
  15810. obj = lexer.getObj();
  15811. expectInt(obj);
  15812. const dst = obj;
  15813. cMap.mapOne(src, dst);
  15814. }
  15815. }
  15816. function parseCidRange(cMap, lexer) {
  15817. while (true) {
  15818. let obj = lexer.getObj();
  15819. if (obj === _primitives.EOF) {
  15820. break;
  15821. }
  15822. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  15823. return;
  15824. }
  15825. expectString(obj);
  15826. const low = strToInt(obj);
  15827. obj = lexer.getObj();
  15828. expectString(obj);
  15829. const high = strToInt(obj);
  15830. obj = lexer.getObj();
  15831. expectInt(obj);
  15832. const dstLow = obj;
  15833. cMap.mapCidRange(low, high, dstLow);
  15834. }
  15835. }
  15836. function parseCodespaceRange(cMap, lexer) {
  15837. while (true) {
  15838. let obj = lexer.getObj();
  15839. if (obj === _primitives.EOF) {
  15840. break;
  15841. }
  15842. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  15843. return;
  15844. }
  15845. if (typeof obj !== "string") {
  15846. break;
  15847. }
  15848. const low = strToInt(obj);
  15849. obj = lexer.getObj();
  15850. if (typeof obj !== "string") {
  15851. break;
  15852. }
  15853. const high = strToInt(obj);
  15854. cMap.addCodespaceRange(obj.length, low, high);
  15855. }
  15856. throw new _util.FormatError("Invalid codespace range.");
  15857. }
  15858. function parseWMode(cMap, lexer) {
  15859. const obj = lexer.getObj();
  15860. if (Number.isInteger(obj)) {
  15861. cMap.vertical = !!obj;
  15862. }
  15863. }
  15864. function parseCMapName(cMap, lexer) {
  15865. const obj = lexer.getObj();
  15866. if (obj instanceof _primitives.Name) {
  15867. cMap.name = obj.name;
  15868. }
  15869. }
  15870. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  15871. let previous, embeddedUseCMap;
  15872. objLoop: while (true) {
  15873. try {
  15874. const obj = lexer.getObj();
  15875. if (obj === _primitives.EOF) {
  15876. break;
  15877. } else if (obj instanceof _primitives.Name) {
  15878. if (obj.name === "WMode") {
  15879. parseWMode(cMap, lexer);
  15880. } else if (obj.name === "CMapName") {
  15881. parseCMapName(cMap, lexer);
  15882. }
  15883. previous = obj;
  15884. } else if (obj instanceof _primitives.Cmd) {
  15885. switch (obj.cmd) {
  15886. case "endcmap":
  15887. break objLoop;
  15888. case "usecmap":
  15889. if (previous instanceof _primitives.Name) {
  15890. embeddedUseCMap = previous.name;
  15891. }
  15892. break;
  15893. case "begincodespacerange":
  15894. parseCodespaceRange(cMap, lexer);
  15895. break;
  15896. case "beginbfchar":
  15897. parseBfChar(cMap, lexer);
  15898. break;
  15899. case "begincidchar":
  15900. parseCidChar(cMap, lexer);
  15901. break;
  15902. case "beginbfrange":
  15903. parseBfRange(cMap, lexer);
  15904. break;
  15905. case "begincidrange":
  15906. parseCidRange(cMap, lexer);
  15907. break;
  15908. }
  15909. }
  15910. } catch (ex) {
  15911. if (ex instanceof _core_utils.MissingDataException) {
  15912. throw ex;
  15913. }
  15914. (0, _util.warn)("Invalid cMap data: " + ex);
  15915. continue;
  15916. }
  15917. }
  15918. if (!useCMap && embeddedUseCMap) {
  15919. useCMap = embeddedUseCMap;
  15920. }
  15921. if (useCMap) {
  15922. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15923. }
  15924. return cMap;
  15925. }
  15926. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  15927. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  15928. if (cMap.numCodespaceRanges === 0) {
  15929. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  15930. for (let i = 0; i < useCodespaceRanges.length; i++) {
  15931. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  15932. }
  15933. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  15934. }
  15935. cMap.useCMap.forEach(function (key, value) {
  15936. if (!cMap.contains(key)) {
  15937. cMap.mapOne(key, cMap.useCMap.lookup(key));
  15938. }
  15939. });
  15940. return cMap;
  15941. }
  15942. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  15943. if (name === "Identity-H") {
  15944. return new IdentityCMap(false, 2);
  15945. } else if (name === "Identity-V") {
  15946. return new IdentityCMap(true, 2);
  15947. }
  15948. if (!BUILT_IN_CMAPS.includes(name)) {
  15949. throw new Error("Unknown CMap name: " + name);
  15950. }
  15951. if (!fetchBuiltInCMap) {
  15952. throw new Error("Built-in CMap parameters are not provided.");
  15953. }
  15954. const {
  15955. cMapData,
  15956. compressionType
  15957. } = await fetchBuiltInCMap(name);
  15958. const cMap = new CMap(true);
  15959. if (compressionType === _util.CMapCompressionType.BINARY) {
  15960. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  15961. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15962. });
  15963. }
  15964. if (compressionType === _util.CMapCompressionType.NONE) {
  15965. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  15966. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  15967. }
  15968. throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`);
  15969. }
  15970. return {
  15971. async create(params) {
  15972. const encoding = params.encoding;
  15973. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  15974. const useCMap = params.useCMap;
  15975. if (encoding instanceof _primitives.Name) {
  15976. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  15977. } else if (encoding instanceof _base_stream.BaseStream) {
  15978. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  15979. if (parsedCMap.isIdentityCMap) {
  15980. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  15981. }
  15982. return parsedCMap;
  15983. }
  15984. throw new Error("Encoding required.");
  15985. }
  15986. };
  15987. }();
  15988. exports.CMapFactory = CMapFactory;
  15989. /***/ }),
  15990. /* 146 */
  15991. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15992. "use strict";
  15993. Object.defineProperty(exports, "__esModule", ({
  15994. value: true
  15995. }));
  15996. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  15997. var _util = __w_pdfjs_require__(2);
  15998. var _primitives = __w_pdfjs_require__(134);
  15999. var _core_utils = __w_pdfjs_require__(135);
  16000. var _ascii_85_stream = __w_pdfjs_require__(147);
  16001. var _ascii_hex_stream = __w_pdfjs_require__(149);
  16002. var _ccitt_stream = __w_pdfjs_require__(150);
  16003. var _flate_stream = __w_pdfjs_require__(152);
  16004. var _jbig2_stream = __w_pdfjs_require__(153);
  16005. var _jpeg_stream = __w_pdfjs_require__(156);
  16006. var _jpx_stream = __w_pdfjs_require__(158);
  16007. var _lzw_stream = __w_pdfjs_require__(160);
  16008. var _stream = __w_pdfjs_require__(139);
  16009. var _predictor_stream = __w_pdfjs_require__(161);
  16010. var _run_length_stream = __w_pdfjs_require__(162);
  16011. const MAX_LENGTH_TO_CACHE = 1000;
  16012. function getInlineImageCacheKey(bytes) {
  16013. const strBuf = [],
  16014. ii = bytes.length;
  16015. let i = 0;
  16016. while (i < ii - 1) {
  16017. strBuf.push(bytes[i++] << 8 | bytes[i++]);
  16018. }
  16019. if (i < ii) {
  16020. strBuf.push(bytes[i]);
  16021. }
  16022. return ii + "_" + String.fromCharCode.apply(null, strBuf);
  16023. }
  16024. class Parser {
  16025. constructor(_ref) {
  16026. let {
  16027. lexer,
  16028. xref,
  16029. allowStreams = false,
  16030. recoveryMode = false
  16031. } = _ref;
  16032. this.lexer = lexer;
  16033. this.xref = xref;
  16034. this.allowStreams = allowStreams;
  16035. this.recoveryMode = recoveryMode;
  16036. this.imageCache = Object.create(null);
  16037. this._imageId = 0;
  16038. this.refill();
  16039. }
  16040. refill() {
  16041. this.buf1 = this.lexer.getObj();
  16042. this.buf2 = this.lexer.getObj();
  16043. }
  16044. shift() {
  16045. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  16046. this.buf1 = this.buf2;
  16047. this.buf2 = null;
  16048. } else {
  16049. this.buf1 = this.buf2;
  16050. this.buf2 = this.lexer.getObj();
  16051. }
  16052. }
  16053. tryShift() {
  16054. try {
  16055. this.shift();
  16056. return true;
  16057. } catch (e) {
  16058. if (e instanceof _core_utils.MissingDataException) {
  16059. throw e;
  16060. }
  16061. return false;
  16062. }
  16063. }
  16064. getObj() {
  16065. let cipherTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  16066. const buf1 = this.buf1;
  16067. this.shift();
  16068. if (buf1 instanceof _primitives.Cmd) {
  16069. switch (buf1.cmd) {
  16070. case "BI":
  16071. return this.makeInlineImage(cipherTransform);
  16072. case "[":
  16073. const array = [];
  16074. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  16075. array.push(this.getObj(cipherTransform));
  16076. }
  16077. if (this.buf1 === _primitives.EOF) {
  16078. if (this.recoveryMode) {
  16079. return array;
  16080. }
  16081. throw new _core_utils.ParserEOFException("End of file inside array.");
  16082. }
  16083. this.shift();
  16084. return array;
  16085. case "<<":
  16086. const dict = new _primitives.Dict(this.xref);
  16087. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  16088. if (!(this.buf1 instanceof _primitives.Name)) {
  16089. (0, _util.info)("Malformed dictionary: key must be a name object");
  16090. this.shift();
  16091. continue;
  16092. }
  16093. const key = this.buf1.name;
  16094. this.shift();
  16095. if (this.buf1 === _primitives.EOF) {
  16096. break;
  16097. }
  16098. dict.set(key, this.getObj(cipherTransform));
  16099. }
  16100. if (this.buf1 === _primitives.EOF) {
  16101. if (this.recoveryMode) {
  16102. return dict;
  16103. }
  16104. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  16105. }
  16106. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  16107. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  16108. }
  16109. this.shift();
  16110. return dict;
  16111. default:
  16112. return buf1;
  16113. }
  16114. }
  16115. if (Number.isInteger(buf1)) {
  16116. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  16117. const ref = _primitives.Ref.get(buf1, this.buf1);
  16118. this.shift();
  16119. this.shift();
  16120. return ref;
  16121. }
  16122. return buf1;
  16123. }
  16124. if (typeof buf1 === "string") {
  16125. if (cipherTransform) {
  16126. return cipherTransform.decryptString(buf1);
  16127. }
  16128. return buf1;
  16129. }
  16130. return buf1;
  16131. }
  16132. findDefaultInlineStreamEnd(stream) {
  16133. const E = 0x45,
  16134. I = 0x49,
  16135. SPACE = 0x20,
  16136. LF = 0xa,
  16137. CR = 0xd,
  16138. NUL = 0x0;
  16139. const lexer = this.lexer,
  16140. startPos = stream.pos,
  16141. n = 10;
  16142. let state = 0,
  16143. ch,
  16144. maybeEIPos;
  16145. while ((ch = stream.getByte()) !== -1) {
  16146. if (state === 0) {
  16147. state = ch === E ? 1 : 0;
  16148. } else if (state === 1) {
  16149. state = ch === I ? 2 : 0;
  16150. } else {
  16151. if (ch === SPACE || ch === LF || ch === CR) {
  16152. maybeEIPos = stream.pos;
  16153. const followingBytes = stream.peekBytes(n);
  16154. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  16155. ch = followingBytes[i];
  16156. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  16157. continue;
  16158. }
  16159. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  16160. state = 0;
  16161. break;
  16162. }
  16163. }
  16164. if (state !== 2) {
  16165. continue;
  16166. }
  16167. if (lexer.knownCommands) {
  16168. const nextObj = lexer.peekObj();
  16169. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  16170. state = 0;
  16171. }
  16172. } else {
  16173. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  16174. }
  16175. if (state === 2) {
  16176. break;
  16177. }
  16178. } else {
  16179. state = 0;
  16180. }
  16181. }
  16182. }
  16183. if (ch === -1) {
  16184. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  16185. if (maybeEIPos) {
  16186. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  16187. stream.skip(-(stream.pos - maybeEIPos));
  16188. }
  16189. }
  16190. let endOffset = 4;
  16191. stream.skip(-endOffset);
  16192. ch = stream.peekByte();
  16193. stream.skip(endOffset);
  16194. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  16195. endOffset--;
  16196. }
  16197. return stream.pos - endOffset - startPos;
  16198. }
  16199. findDCTDecodeInlineStreamEnd(stream) {
  16200. const startPos = stream.pos;
  16201. let foundEOI = false,
  16202. b,
  16203. markerLength;
  16204. while ((b = stream.getByte()) !== -1) {
  16205. if (b !== 0xff) {
  16206. continue;
  16207. }
  16208. switch (stream.getByte()) {
  16209. case 0x00:
  16210. break;
  16211. case 0xff:
  16212. stream.skip(-1);
  16213. break;
  16214. case 0xd9:
  16215. foundEOI = true;
  16216. break;
  16217. case 0xc0:
  16218. case 0xc1:
  16219. case 0xc2:
  16220. case 0xc3:
  16221. case 0xc5:
  16222. case 0xc6:
  16223. case 0xc7:
  16224. case 0xc9:
  16225. case 0xca:
  16226. case 0xcb:
  16227. case 0xcd:
  16228. case 0xce:
  16229. case 0xcf:
  16230. case 0xc4:
  16231. case 0xcc:
  16232. case 0xda:
  16233. case 0xdb:
  16234. case 0xdc:
  16235. case 0xdd:
  16236. case 0xde:
  16237. case 0xdf:
  16238. case 0xe0:
  16239. case 0xe1:
  16240. case 0xe2:
  16241. case 0xe3:
  16242. case 0xe4:
  16243. case 0xe5:
  16244. case 0xe6:
  16245. case 0xe7:
  16246. case 0xe8:
  16247. case 0xe9:
  16248. case 0xea:
  16249. case 0xeb:
  16250. case 0xec:
  16251. case 0xed:
  16252. case 0xee:
  16253. case 0xef:
  16254. case 0xfe:
  16255. markerLength = stream.getUint16();
  16256. if (markerLength > 2) {
  16257. stream.skip(markerLength - 2);
  16258. } else {
  16259. stream.skip(-2);
  16260. }
  16261. break;
  16262. }
  16263. if (foundEOI) {
  16264. break;
  16265. }
  16266. }
  16267. const length = stream.pos - startPos;
  16268. if (b === -1) {
  16269. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  16270. stream.skip(-length);
  16271. return this.findDefaultInlineStreamEnd(stream);
  16272. }
  16273. this.inlineStreamSkipEI(stream);
  16274. return length;
  16275. }
  16276. findASCII85DecodeInlineStreamEnd(stream) {
  16277. const TILDE = 0x7e,
  16278. GT = 0x3e;
  16279. const startPos = stream.pos;
  16280. let ch;
  16281. while ((ch = stream.getByte()) !== -1) {
  16282. if (ch === TILDE) {
  16283. const tildePos = stream.pos;
  16284. ch = stream.peekByte();
  16285. while ((0, _core_utils.isWhiteSpace)(ch)) {
  16286. stream.skip();
  16287. ch = stream.peekByte();
  16288. }
  16289. if (ch === GT) {
  16290. stream.skip();
  16291. break;
  16292. }
  16293. if (stream.pos > tildePos) {
  16294. const maybeEI = stream.peekBytes(2);
  16295. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  16296. break;
  16297. }
  16298. }
  16299. }
  16300. }
  16301. const length = stream.pos - startPos;
  16302. if (ch === -1) {
  16303. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  16304. stream.skip(-length);
  16305. return this.findDefaultInlineStreamEnd(stream);
  16306. }
  16307. this.inlineStreamSkipEI(stream);
  16308. return length;
  16309. }
  16310. findASCIIHexDecodeInlineStreamEnd(stream) {
  16311. const GT = 0x3e;
  16312. const startPos = stream.pos;
  16313. let ch;
  16314. while ((ch = stream.getByte()) !== -1) {
  16315. if (ch === GT) {
  16316. break;
  16317. }
  16318. }
  16319. const length = stream.pos - startPos;
  16320. if (ch === -1) {
  16321. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  16322. stream.skip(-length);
  16323. return this.findDefaultInlineStreamEnd(stream);
  16324. }
  16325. this.inlineStreamSkipEI(stream);
  16326. return length;
  16327. }
  16328. inlineStreamSkipEI(stream) {
  16329. const E = 0x45,
  16330. I = 0x49;
  16331. let state = 0,
  16332. ch;
  16333. while ((ch = stream.getByte()) !== -1) {
  16334. if (state === 0) {
  16335. state = ch === E ? 1 : 0;
  16336. } else if (state === 1) {
  16337. state = ch === I ? 2 : 0;
  16338. } else if (state === 2) {
  16339. break;
  16340. }
  16341. }
  16342. }
  16343. makeInlineImage(cipherTransform) {
  16344. const lexer = this.lexer;
  16345. const stream = lexer.stream;
  16346. const dictMap = Object.create(null);
  16347. let dictLength;
  16348. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  16349. if (!(this.buf1 instanceof _primitives.Name)) {
  16350. throw new _util.FormatError("Dictionary key must be a name object");
  16351. }
  16352. const key = this.buf1.name;
  16353. this.shift();
  16354. if (this.buf1 === _primitives.EOF) {
  16355. break;
  16356. }
  16357. dictMap[key] = this.getObj(cipherTransform);
  16358. }
  16359. if (lexer.beginInlineImagePos !== -1) {
  16360. dictLength = stream.pos - lexer.beginInlineImagePos;
  16361. }
  16362. const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
  16363. let filterName;
  16364. if (filter instanceof _primitives.Name) {
  16365. filterName = filter.name;
  16366. } else if (Array.isArray(filter)) {
  16367. const filterZero = this.xref.fetchIfRef(filter[0]);
  16368. if (filterZero instanceof _primitives.Name) {
  16369. filterName = filterZero.name;
  16370. }
  16371. }
  16372. const startPos = stream.pos;
  16373. let length;
  16374. switch (filterName) {
  16375. case "DCT":
  16376. case "DCTDecode":
  16377. length = this.findDCTDecodeInlineStreamEnd(stream);
  16378. break;
  16379. case "A85":
  16380. case "ASCII85Decode":
  16381. length = this.findASCII85DecodeInlineStreamEnd(stream);
  16382. break;
  16383. case "AHx":
  16384. case "ASCIIHexDecode":
  16385. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  16386. break;
  16387. default:
  16388. length = this.findDefaultInlineStreamEnd(stream);
  16389. }
  16390. let cacheKey;
  16391. if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
  16392. const initialStreamPos = stream.pos;
  16393. stream.pos = lexer.beginInlineImagePos;
  16394. cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
  16395. stream.pos = initialStreamPos;
  16396. const cacheEntry = this.imageCache[cacheKey];
  16397. if (cacheEntry !== undefined) {
  16398. this.buf2 = _primitives.Cmd.get("EI");
  16399. this.shift();
  16400. cacheEntry.reset();
  16401. return cacheEntry;
  16402. }
  16403. }
  16404. const dict = new _primitives.Dict(this.xref);
  16405. for (const key in dictMap) {
  16406. dict.set(key, dictMap[key]);
  16407. }
  16408. let imageStream = stream.makeSubStream(startPos, length, dict);
  16409. if (cipherTransform) {
  16410. imageStream = cipherTransform.createStream(imageStream, length);
  16411. }
  16412. imageStream = this.filter(imageStream, dict, length);
  16413. imageStream.dict = dict;
  16414. if (cacheKey !== undefined) {
  16415. imageStream.cacheKey = `inline_img_${++this._imageId}`;
  16416. this.imageCache[cacheKey] = imageStream;
  16417. }
  16418. this.buf2 = _primitives.Cmd.get("EI");
  16419. this.shift();
  16420. return imageStream;
  16421. }
  16422. _findStreamLength(startPos, signature) {
  16423. const {
  16424. stream
  16425. } = this.lexer;
  16426. stream.pos = startPos;
  16427. const SCAN_BLOCK_LENGTH = 2048;
  16428. const signatureLength = signature.length;
  16429. while (stream.pos < stream.end) {
  16430. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  16431. const scanLength = scanBytes.length - signatureLength;
  16432. if (scanLength <= 0) {
  16433. break;
  16434. }
  16435. let pos = 0;
  16436. while (pos < scanLength) {
  16437. let j = 0;
  16438. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  16439. j++;
  16440. }
  16441. if (j >= signatureLength) {
  16442. stream.pos += pos;
  16443. return stream.pos - startPos;
  16444. }
  16445. pos++;
  16446. }
  16447. stream.pos += scanLength;
  16448. }
  16449. return -1;
  16450. }
  16451. makeStream(dict, cipherTransform) {
  16452. const lexer = this.lexer;
  16453. let stream = lexer.stream;
  16454. lexer.skipToNextLine();
  16455. const startPos = stream.pos - 1;
  16456. let length = dict.get("Length");
  16457. if (!Number.isInteger(length)) {
  16458. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  16459. length = 0;
  16460. }
  16461. stream.pos = startPos + length;
  16462. lexer.nextChar();
  16463. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  16464. this.shift();
  16465. } else {
  16466. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  16467. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  16468. if (actualLength < 0) {
  16469. const MAX_TRUNCATION = 1;
  16470. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  16471. const end = ENDSTREAM_SIGNATURE.length - i;
  16472. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  16473. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  16474. if (maybeLength >= 0) {
  16475. const lastByte = stream.peekBytes(end + 1)[end];
  16476. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  16477. break;
  16478. }
  16479. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  16480. actualLength = maybeLength;
  16481. break;
  16482. }
  16483. }
  16484. if (actualLength < 0) {
  16485. throw new _util.FormatError("Missing endstream command.");
  16486. }
  16487. }
  16488. length = actualLength;
  16489. lexer.nextChar();
  16490. this.shift();
  16491. this.shift();
  16492. }
  16493. this.shift();
  16494. stream = stream.makeSubStream(startPos, length, dict);
  16495. if (cipherTransform) {
  16496. stream = cipherTransform.createStream(stream, length);
  16497. }
  16498. stream = this.filter(stream, dict, length);
  16499. stream.dict = dict;
  16500. return stream;
  16501. }
  16502. filter(stream, dict, length) {
  16503. let filter = dict.get("F", "Filter");
  16504. let params = dict.get("DP", "DecodeParms");
  16505. if (filter instanceof _primitives.Name) {
  16506. if (Array.isArray(params)) {
  16507. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  16508. }
  16509. return this.makeFilter(stream, filter.name, length, params);
  16510. }
  16511. let maybeLength = length;
  16512. if (Array.isArray(filter)) {
  16513. const filterArray = filter;
  16514. const paramsArray = params;
  16515. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  16516. filter = this.xref.fetchIfRef(filterArray[i]);
  16517. if (!(filter instanceof _primitives.Name)) {
  16518. throw new _util.FormatError(`Bad filter name "${filter}"`);
  16519. }
  16520. params = null;
  16521. if (Array.isArray(paramsArray) && i in paramsArray) {
  16522. params = this.xref.fetchIfRef(paramsArray[i]);
  16523. }
  16524. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  16525. maybeLength = null;
  16526. }
  16527. }
  16528. return stream;
  16529. }
  16530. makeFilter(stream, name, maybeLength, params) {
  16531. if (maybeLength === 0) {
  16532. (0, _util.warn)(`Empty "${name}" stream.`);
  16533. return new _stream.NullStream();
  16534. }
  16535. const xrefStats = this.xref.stats;
  16536. try {
  16537. switch (name) {
  16538. case "Fl":
  16539. case "FlateDecode":
  16540. xrefStats.addStreamType(_util.StreamType.FLATE);
  16541. if (params) {
  16542. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  16543. }
  16544. return new _flate_stream.FlateStream(stream, maybeLength);
  16545. case "LZW":
  16546. case "LZWDecode":
  16547. xrefStats.addStreamType(_util.StreamType.LZW);
  16548. let earlyChange = 1;
  16549. if (params) {
  16550. if (params.has("EarlyChange")) {
  16551. earlyChange = params.get("EarlyChange");
  16552. }
  16553. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  16554. }
  16555. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  16556. case "DCT":
  16557. case "DCTDecode":
  16558. xrefStats.addStreamType(_util.StreamType.DCT);
  16559. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  16560. case "JPX":
  16561. case "JPXDecode":
  16562. xrefStats.addStreamType(_util.StreamType.JPX);
  16563. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  16564. case "A85":
  16565. case "ASCII85Decode":
  16566. xrefStats.addStreamType(_util.StreamType.A85);
  16567. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  16568. case "AHx":
  16569. case "ASCIIHexDecode":
  16570. xrefStats.addStreamType(_util.StreamType.AHX);
  16571. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  16572. case "CCF":
  16573. case "CCITTFaxDecode":
  16574. xrefStats.addStreamType(_util.StreamType.CCF);
  16575. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  16576. case "RL":
  16577. case "RunLengthDecode":
  16578. xrefStats.addStreamType(_util.StreamType.RLX);
  16579. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  16580. case "JBIG2Decode":
  16581. xrefStats.addStreamType(_util.StreamType.JBIG);
  16582. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  16583. }
  16584. (0, _util.warn)(`Filter "${name}" is not supported.`);
  16585. return stream;
  16586. } catch (ex) {
  16587. if (ex instanceof _core_utils.MissingDataException) {
  16588. throw ex;
  16589. }
  16590. (0, _util.warn)(`Invalid stream: "${ex}"`);
  16591. return new _stream.NullStream();
  16592. }
  16593. }
  16594. }
  16595. exports.Parser = Parser;
  16596. 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];
  16597. function toHexDigit(ch) {
  16598. if (ch >= 0x30 && ch <= 0x39) {
  16599. return ch & 0x0f;
  16600. }
  16601. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  16602. return (ch & 0x0f) + 9;
  16603. }
  16604. return -1;
  16605. }
  16606. class Lexer {
  16607. constructor(stream) {
  16608. let knownCommands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  16609. this.stream = stream;
  16610. this.nextChar();
  16611. this.strBuf = [];
  16612. this.knownCommands = knownCommands;
  16613. this._hexStringNumWarn = 0;
  16614. this.beginInlineImagePos = -1;
  16615. }
  16616. nextChar() {
  16617. return this.currentChar = this.stream.getByte();
  16618. }
  16619. peekChar() {
  16620. return this.stream.peekByte();
  16621. }
  16622. getNumber() {
  16623. let ch = this.currentChar;
  16624. let eNotation = false;
  16625. let divideBy = 0;
  16626. let sign = 0;
  16627. if (ch === 0x2d) {
  16628. sign = -1;
  16629. ch = this.nextChar();
  16630. if (ch === 0x2d) {
  16631. ch = this.nextChar();
  16632. }
  16633. } else if (ch === 0x2b) {
  16634. sign = 1;
  16635. ch = this.nextChar();
  16636. }
  16637. if (ch === 0x0a || ch === 0x0d) {
  16638. do {
  16639. ch = this.nextChar();
  16640. } while (ch === 0x0a || ch === 0x0d);
  16641. }
  16642. if (ch === 0x2e) {
  16643. divideBy = 10;
  16644. ch = this.nextChar();
  16645. }
  16646. if (ch < 0x30 || ch > 0x39) {
  16647. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  16648. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  16649. (0, _util.info)(`Lexer.getNumber - "${msg}".`);
  16650. return 0;
  16651. }
  16652. throw new _util.FormatError(msg);
  16653. }
  16654. sign = sign || 1;
  16655. let baseValue = ch - 0x30;
  16656. let powerValue = 0;
  16657. let powerValueSign = 1;
  16658. while ((ch = this.nextChar()) >= 0) {
  16659. if (ch >= 0x30 && ch <= 0x39) {
  16660. const currentDigit = ch - 0x30;
  16661. if (eNotation) {
  16662. powerValue = powerValue * 10 + currentDigit;
  16663. } else {
  16664. if (divideBy !== 0) {
  16665. divideBy *= 10;
  16666. }
  16667. baseValue = baseValue * 10 + currentDigit;
  16668. }
  16669. } else if (ch === 0x2e) {
  16670. if (divideBy === 0) {
  16671. divideBy = 1;
  16672. } else {
  16673. break;
  16674. }
  16675. } else if (ch === 0x2d) {
  16676. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  16677. } else if (ch === 0x45 || ch === 0x65) {
  16678. ch = this.peekChar();
  16679. if (ch === 0x2b || ch === 0x2d) {
  16680. powerValueSign = ch === 0x2d ? -1 : 1;
  16681. this.nextChar();
  16682. } else if (ch < 0x30 || ch > 0x39) {
  16683. break;
  16684. }
  16685. eNotation = true;
  16686. } else {
  16687. break;
  16688. }
  16689. }
  16690. if (divideBy !== 0) {
  16691. baseValue /= divideBy;
  16692. }
  16693. if (eNotation) {
  16694. baseValue *= 10 ** (powerValueSign * powerValue);
  16695. }
  16696. return sign * baseValue;
  16697. }
  16698. getString() {
  16699. let numParen = 1;
  16700. let done = false;
  16701. const strBuf = this.strBuf;
  16702. strBuf.length = 0;
  16703. let ch = this.nextChar();
  16704. while (true) {
  16705. let charBuffered = false;
  16706. switch (ch | 0) {
  16707. case -1:
  16708. (0, _util.warn)("Unterminated string");
  16709. done = true;
  16710. break;
  16711. case 0x28:
  16712. ++numParen;
  16713. strBuf.push("(");
  16714. break;
  16715. case 0x29:
  16716. if (--numParen === 0) {
  16717. this.nextChar();
  16718. done = true;
  16719. } else {
  16720. strBuf.push(")");
  16721. }
  16722. break;
  16723. case 0x5c:
  16724. ch = this.nextChar();
  16725. switch (ch) {
  16726. case -1:
  16727. (0, _util.warn)("Unterminated string");
  16728. done = true;
  16729. break;
  16730. case 0x6e:
  16731. strBuf.push("\n");
  16732. break;
  16733. case 0x72:
  16734. strBuf.push("\r");
  16735. break;
  16736. case 0x74:
  16737. strBuf.push("\t");
  16738. break;
  16739. case 0x62:
  16740. strBuf.push("\b");
  16741. break;
  16742. case 0x66:
  16743. strBuf.push("\f");
  16744. break;
  16745. case 0x5c:
  16746. case 0x28:
  16747. case 0x29:
  16748. strBuf.push(String.fromCharCode(ch));
  16749. break;
  16750. case 0x30:
  16751. case 0x31:
  16752. case 0x32:
  16753. case 0x33:
  16754. case 0x34:
  16755. case 0x35:
  16756. case 0x36:
  16757. case 0x37:
  16758. let x = ch & 0x0f;
  16759. ch = this.nextChar();
  16760. charBuffered = true;
  16761. if (ch >= 0x30 && ch <= 0x37) {
  16762. x = (x << 3) + (ch & 0x0f);
  16763. ch = this.nextChar();
  16764. if (ch >= 0x30 && ch <= 0x37) {
  16765. charBuffered = false;
  16766. x = (x << 3) + (ch & 0x0f);
  16767. }
  16768. }
  16769. strBuf.push(String.fromCharCode(x));
  16770. break;
  16771. case 0x0d:
  16772. if (this.peekChar() === 0x0a) {
  16773. this.nextChar();
  16774. }
  16775. break;
  16776. case 0x0a:
  16777. break;
  16778. default:
  16779. strBuf.push(String.fromCharCode(ch));
  16780. break;
  16781. }
  16782. break;
  16783. default:
  16784. strBuf.push(String.fromCharCode(ch));
  16785. break;
  16786. }
  16787. if (done) {
  16788. break;
  16789. }
  16790. if (!charBuffered) {
  16791. ch = this.nextChar();
  16792. }
  16793. }
  16794. return strBuf.join("");
  16795. }
  16796. getName() {
  16797. let ch, previousCh;
  16798. const strBuf = this.strBuf;
  16799. strBuf.length = 0;
  16800. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16801. if (ch === 0x23) {
  16802. ch = this.nextChar();
  16803. if (specialChars[ch]) {
  16804. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  16805. strBuf.push("#");
  16806. break;
  16807. }
  16808. const x = toHexDigit(ch);
  16809. if (x !== -1) {
  16810. previousCh = ch;
  16811. ch = this.nextChar();
  16812. const x2 = toHexDigit(ch);
  16813. if (x2 === -1) {
  16814. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  16815. strBuf.push("#", String.fromCharCode(previousCh));
  16816. if (specialChars[ch]) {
  16817. break;
  16818. }
  16819. strBuf.push(String.fromCharCode(ch));
  16820. continue;
  16821. }
  16822. strBuf.push(String.fromCharCode(x << 4 | x2));
  16823. } else {
  16824. strBuf.push("#", String.fromCharCode(ch));
  16825. }
  16826. } else {
  16827. strBuf.push(String.fromCharCode(ch));
  16828. }
  16829. }
  16830. if (strBuf.length > 127) {
  16831. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  16832. }
  16833. return _primitives.Name.get(strBuf.join(""));
  16834. }
  16835. _hexStringWarn(ch) {
  16836. const MAX_HEX_STRING_NUM_WARN = 5;
  16837. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  16838. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  16839. return;
  16840. }
  16841. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  16842. return;
  16843. }
  16844. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  16845. }
  16846. getHexString() {
  16847. const strBuf = this.strBuf;
  16848. strBuf.length = 0;
  16849. let ch = this.currentChar;
  16850. let isFirstHex = true;
  16851. let firstDigit, secondDigit;
  16852. this._hexStringNumWarn = 0;
  16853. while (true) {
  16854. if (ch < 0) {
  16855. (0, _util.warn)("Unterminated hex string");
  16856. break;
  16857. } else if (ch === 0x3e) {
  16858. this.nextChar();
  16859. break;
  16860. } else if (specialChars[ch] === 1) {
  16861. ch = this.nextChar();
  16862. continue;
  16863. } else {
  16864. if (isFirstHex) {
  16865. firstDigit = toHexDigit(ch);
  16866. if (firstDigit === -1) {
  16867. this._hexStringWarn(ch);
  16868. ch = this.nextChar();
  16869. continue;
  16870. }
  16871. } else {
  16872. secondDigit = toHexDigit(ch);
  16873. if (secondDigit === -1) {
  16874. this._hexStringWarn(ch);
  16875. ch = this.nextChar();
  16876. continue;
  16877. }
  16878. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  16879. }
  16880. isFirstHex = !isFirstHex;
  16881. ch = this.nextChar();
  16882. }
  16883. }
  16884. return strBuf.join("");
  16885. }
  16886. getObj() {
  16887. let comment = false;
  16888. let ch = this.currentChar;
  16889. while (true) {
  16890. if (ch < 0) {
  16891. return _primitives.EOF;
  16892. }
  16893. if (comment) {
  16894. if (ch === 0x0a || ch === 0x0d) {
  16895. comment = false;
  16896. }
  16897. } else if (ch === 0x25) {
  16898. comment = true;
  16899. } else if (specialChars[ch] !== 1) {
  16900. break;
  16901. }
  16902. ch = this.nextChar();
  16903. }
  16904. switch (ch | 0) {
  16905. case 0x30:
  16906. case 0x31:
  16907. case 0x32:
  16908. case 0x33:
  16909. case 0x34:
  16910. case 0x35:
  16911. case 0x36:
  16912. case 0x37:
  16913. case 0x38:
  16914. case 0x39:
  16915. case 0x2b:
  16916. case 0x2d:
  16917. case 0x2e:
  16918. return this.getNumber();
  16919. case 0x28:
  16920. return this.getString();
  16921. case 0x2f:
  16922. return this.getName();
  16923. case 0x5b:
  16924. this.nextChar();
  16925. return _primitives.Cmd.get("[");
  16926. case 0x5d:
  16927. this.nextChar();
  16928. return _primitives.Cmd.get("]");
  16929. case 0x3c:
  16930. ch = this.nextChar();
  16931. if (ch === 0x3c) {
  16932. this.nextChar();
  16933. return _primitives.Cmd.get("<<");
  16934. }
  16935. return this.getHexString();
  16936. case 0x3e:
  16937. ch = this.nextChar();
  16938. if (ch === 0x3e) {
  16939. this.nextChar();
  16940. return _primitives.Cmd.get(">>");
  16941. }
  16942. return _primitives.Cmd.get(">");
  16943. case 0x7b:
  16944. this.nextChar();
  16945. return _primitives.Cmd.get("{");
  16946. case 0x7d:
  16947. this.nextChar();
  16948. return _primitives.Cmd.get("}");
  16949. case 0x29:
  16950. this.nextChar();
  16951. throw new _util.FormatError(`Illegal character: ${ch}`);
  16952. }
  16953. let str = String.fromCharCode(ch);
  16954. if (ch < 0x20 || ch > 0x7f) {
  16955. const nextCh = this.peekChar();
  16956. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  16957. this.nextChar();
  16958. return _primitives.Cmd.get(str);
  16959. }
  16960. }
  16961. const knownCommands = this.knownCommands;
  16962. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16963. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16964. const possibleCommand = str + String.fromCharCode(ch);
  16965. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  16966. break;
  16967. }
  16968. if (str.length === 128) {
  16969. throw new _util.FormatError(`Command token too long: ${str.length}`);
  16970. }
  16971. str = possibleCommand;
  16972. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16973. }
  16974. if (str === "true") {
  16975. return true;
  16976. }
  16977. if (str === "false") {
  16978. return false;
  16979. }
  16980. if (str === "null") {
  16981. return null;
  16982. }
  16983. if (str === "BI") {
  16984. this.beginInlineImagePos = this.stream.pos;
  16985. }
  16986. return _primitives.Cmd.get(str);
  16987. }
  16988. peekObj() {
  16989. const streamPos = this.stream.pos,
  16990. currentChar = this.currentChar,
  16991. beginInlineImagePos = this.beginInlineImagePos;
  16992. let nextObj;
  16993. try {
  16994. nextObj = this.getObj();
  16995. } catch (ex) {
  16996. if (ex instanceof _core_utils.MissingDataException) {
  16997. throw ex;
  16998. }
  16999. (0, _util.warn)(`peekObj: ${ex}`);
  17000. }
  17001. this.stream.pos = streamPos;
  17002. this.currentChar = currentChar;
  17003. this.beginInlineImagePos = beginInlineImagePos;
  17004. return nextObj;
  17005. }
  17006. skipToNextLine() {
  17007. let ch = this.currentChar;
  17008. while (ch >= 0) {
  17009. if (ch === 0x0d) {
  17010. ch = this.nextChar();
  17011. if (ch === 0x0a) {
  17012. this.nextChar();
  17013. }
  17014. break;
  17015. } else if (ch === 0x0a) {
  17016. this.nextChar();
  17017. break;
  17018. }
  17019. ch = this.nextChar();
  17020. }
  17021. }
  17022. }
  17023. exports.Lexer = Lexer;
  17024. class Linearization {
  17025. static create(stream) {
  17026. function getInt(linDict, name) {
  17027. let allowZeroValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  17028. const obj = linDict.get(name);
  17029. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  17030. return obj;
  17031. }
  17032. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  17033. }
  17034. function getHints(linDict) {
  17035. const hints = linDict.get("H");
  17036. let hintsLength;
  17037. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  17038. for (let index = 0; index < hintsLength; index++) {
  17039. const hint = hints[index];
  17040. if (!(Number.isInteger(hint) && hint > 0)) {
  17041. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  17042. }
  17043. }
  17044. return hints;
  17045. }
  17046. throw new Error("Hint array in the linearization dictionary is invalid.");
  17047. }
  17048. const parser = new Parser({
  17049. lexer: new Lexer(stream),
  17050. xref: null
  17051. });
  17052. const obj1 = parser.getObj();
  17053. const obj2 = parser.getObj();
  17054. const obj3 = parser.getObj();
  17055. const linDict = parser.getObj();
  17056. let obj, length;
  17057. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  17058. return null;
  17059. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  17060. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  17061. }
  17062. return {
  17063. length,
  17064. hints: getHints(linDict),
  17065. objectNumberFirst: getInt(linDict, "O"),
  17066. endFirst: getInt(linDict, "E"),
  17067. numPages: getInt(linDict, "N"),
  17068. mainXRefEntriesOffset: getInt(linDict, "T"),
  17069. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  17070. };
  17071. }
  17072. }
  17073. exports.Linearization = Linearization;
  17074. /***/ }),
  17075. /* 147 */
  17076. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17077. "use strict";
  17078. Object.defineProperty(exports, "__esModule", ({
  17079. value: true
  17080. }));
  17081. exports.Ascii85Stream = void 0;
  17082. var _decode_stream = __w_pdfjs_require__(148);
  17083. var _core_utils = __w_pdfjs_require__(135);
  17084. class Ascii85Stream extends _decode_stream.DecodeStream {
  17085. constructor(str, maybeLength) {
  17086. if (maybeLength) {
  17087. maybeLength *= 0.8;
  17088. }
  17089. super(maybeLength);
  17090. this.str = str;
  17091. this.dict = str.dict;
  17092. this.input = new Uint8Array(5);
  17093. }
  17094. readBlock() {
  17095. const TILDA_CHAR = 0x7e;
  17096. const Z_LOWER_CHAR = 0x7a;
  17097. const EOF = -1;
  17098. const str = this.str;
  17099. let c = str.getByte();
  17100. while ((0, _core_utils.isWhiteSpace)(c)) {
  17101. c = str.getByte();
  17102. }
  17103. if (c === EOF || c === TILDA_CHAR) {
  17104. this.eof = true;
  17105. return;
  17106. }
  17107. const bufferLength = this.bufferLength;
  17108. let buffer, i;
  17109. if (c === Z_LOWER_CHAR) {
  17110. buffer = this.ensureBuffer(bufferLength + 4);
  17111. for (i = 0; i < 4; ++i) {
  17112. buffer[bufferLength + i] = 0;
  17113. }
  17114. this.bufferLength += 4;
  17115. } else {
  17116. const input = this.input;
  17117. input[0] = c;
  17118. for (i = 1; i < 5; ++i) {
  17119. c = str.getByte();
  17120. while ((0, _core_utils.isWhiteSpace)(c)) {
  17121. c = str.getByte();
  17122. }
  17123. input[i] = c;
  17124. if (c === EOF || c === TILDA_CHAR) {
  17125. break;
  17126. }
  17127. }
  17128. buffer = this.ensureBuffer(bufferLength + i - 1);
  17129. this.bufferLength += i - 1;
  17130. if (i < 5) {
  17131. for (; i < 5; ++i) {
  17132. input[i] = 0x21 + 84;
  17133. }
  17134. this.eof = true;
  17135. }
  17136. let t = 0;
  17137. for (i = 0; i < 5; ++i) {
  17138. t = t * 85 + (input[i] - 0x21);
  17139. }
  17140. for (i = 3; i >= 0; --i) {
  17141. buffer[bufferLength + i] = t & 0xff;
  17142. t >>= 8;
  17143. }
  17144. }
  17145. }
  17146. }
  17147. exports.Ascii85Stream = Ascii85Stream;
  17148. /***/ }),
  17149. /* 148 */
  17150. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17151. "use strict";
  17152. Object.defineProperty(exports, "__esModule", ({
  17153. value: true
  17154. }));
  17155. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  17156. var _base_stream = __w_pdfjs_require__(136);
  17157. var _stream = __w_pdfjs_require__(139);
  17158. const emptyBuffer = new Uint8Array(0);
  17159. class DecodeStream extends _base_stream.BaseStream {
  17160. constructor(maybeMinBufferLength) {
  17161. super();
  17162. this._rawMinBufferLength = maybeMinBufferLength || 0;
  17163. this.pos = 0;
  17164. this.bufferLength = 0;
  17165. this.eof = false;
  17166. this.buffer = emptyBuffer;
  17167. this.minBufferLength = 512;
  17168. if (maybeMinBufferLength) {
  17169. while (this.minBufferLength < maybeMinBufferLength) {
  17170. this.minBufferLength *= 2;
  17171. }
  17172. }
  17173. }
  17174. get isEmpty() {
  17175. while (!this.eof && this.bufferLength === 0) {
  17176. this.readBlock();
  17177. }
  17178. return this.bufferLength === 0;
  17179. }
  17180. ensureBuffer(requested) {
  17181. const buffer = this.buffer;
  17182. if (requested <= buffer.byteLength) {
  17183. return buffer;
  17184. }
  17185. let size = this.minBufferLength;
  17186. while (size < requested) {
  17187. size *= 2;
  17188. }
  17189. const buffer2 = new Uint8Array(size);
  17190. buffer2.set(buffer);
  17191. return this.buffer = buffer2;
  17192. }
  17193. getByte() {
  17194. const pos = this.pos;
  17195. while (this.bufferLength <= pos) {
  17196. if (this.eof) {
  17197. return -1;
  17198. }
  17199. this.readBlock();
  17200. }
  17201. return this.buffer[this.pos++];
  17202. }
  17203. getBytes(length) {
  17204. const pos = this.pos;
  17205. let end;
  17206. if (length) {
  17207. this.ensureBuffer(pos + length);
  17208. end = pos + length;
  17209. while (!this.eof && this.bufferLength < end) {
  17210. this.readBlock();
  17211. }
  17212. const bufEnd = this.bufferLength;
  17213. if (end > bufEnd) {
  17214. end = bufEnd;
  17215. }
  17216. } else {
  17217. while (!this.eof) {
  17218. this.readBlock();
  17219. }
  17220. end = this.bufferLength;
  17221. }
  17222. this.pos = end;
  17223. return this.buffer.subarray(pos, end);
  17224. }
  17225. reset() {
  17226. this.pos = 0;
  17227. }
  17228. makeSubStream(start, length) {
  17229. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  17230. if (length === undefined) {
  17231. while (!this.eof) {
  17232. this.readBlock();
  17233. }
  17234. } else {
  17235. const end = start + length;
  17236. while (this.bufferLength <= end && !this.eof) {
  17237. this.readBlock();
  17238. }
  17239. }
  17240. return new _stream.Stream(this.buffer, start, length, dict);
  17241. }
  17242. getBaseStreams() {
  17243. return this.str ? this.str.getBaseStreams() : null;
  17244. }
  17245. }
  17246. exports.DecodeStream = DecodeStream;
  17247. class StreamsSequenceStream extends DecodeStream {
  17248. constructor(streams) {
  17249. let onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  17250. let maybeLength = 0;
  17251. for (const stream of streams) {
  17252. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  17253. }
  17254. super(maybeLength);
  17255. this.streams = streams;
  17256. this._onError = onError;
  17257. }
  17258. readBlock() {
  17259. const streams = this.streams;
  17260. if (streams.length === 0) {
  17261. this.eof = true;
  17262. return;
  17263. }
  17264. const stream = streams.shift();
  17265. let chunk;
  17266. try {
  17267. chunk = stream.getBytes();
  17268. } catch (reason) {
  17269. if (this._onError) {
  17270. this._onError(reason, stream.dict && stream.dict.objId);
  17271. return;
  17272. }
  17273. throw reason;
  17274. }
  17275. const bufferLength = this.bufferLength;
  17276. const newLength = bufferLength + chunk.length;
  17277. const buffer = this.ensureBuffer(newLength);
  17278. buffer.set(chunk, bufferLength);
  17279. this.bufferLength = newLength;
  17280. }
  17281. getBaseStreams() {
  17282. const baseStreamsBuf = [];
  17283. for (const stream of this.streams) {
  17284. const baseStreams = stream.getBaseStreams();
  17285. if (baseStreams) {
  17286. baseStreamsBuf.push(...baseStreams);
  17287. }
  17288. }
  17289. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  17290. }
  17291. }
  17292. exports.StreamsSequenceStream = StreamsSequenceStream;
  17293. /***/ }),
  17294. /* 149 */
  17295. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17296. "use strict";
  17297. Object.defineProperty(exports, "__esModule", ({
  17298. value: true
  17299. }));
  17300. exports.AsciiHexStream = void 0;
  17301. var _decode_stream = __w_pdfjs_require__(148);
  17302. class AsciiHexStream extends _decode_stream.DecodeStream {
  17303. constructor(str, maybeLength) {
  17304. if (maybeLength) {
  17305. maybeLength *= 0.5;
  17306. }
  17307. super(maybeLength);
  17308. this.str = str;
  17309. this.dict = str.dict;
  17310. this.firstDigit = -1;
  17311. }
  17312. readBlock() {
  17313. const UPSTREAM_BLOCK_SIZE = 8000;
  17314. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  17315. if (!bytes.length) {
  17316. this.eof = true;
  17317. return;
  17318. }
  17319. const maxDecodeLength = bytes.length + 1 >> 1;
  17320. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  17321. let bufferLength = this.bufferLength;
  17322. let firstDigit = this.firstDigit;
  17323. for (const ch of bytes) {
  17324. let digit;
  17325. if (ch >= 0x30 && ch <= 0x39) {
  17326. digit = ch & 0x0f;
  17327. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  17328. digit = (ch & 0x0f) + 9;
  17329. } else if (ch === 0x3e) {
  17330. this.eof = true;
  17331. break;
  17332. } else {
  17333. continue;
  17334. }
  17335. if (firstDigit < 0) {
  17336. firstDigit = digit;
  17337. } else {
  17338. buffer[bufferLength++] = firstDigit << 4 | digit;
  17339. firstDigit = -1;
  17340. }
  17341. }
  17342. if (firstDigit >= 0 && this.eof) {
  17343. buffer[bufferLength++] = firstDigit << 4;
  17344. firstDigit = -1;
  17345. }
  17346. this.firstDigit = firstDigit;
  17347. this.bufferLength = bufferLength;
  17348. }
  17349. }
  17350. exports.AsciiHexStream = AsciiHexStream;
  17351. /***/ }),
  17352. /* 150 */
  17353. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17354. "use strict";
  17355. Object.defineProperty(exports, "__esModule", ({
  17356. value: true
  17357. }));
  17358. exports.CCITTFaxStream = void 0;
  17359. var _ccitt = __w_pdfjs_require__(151);
  17360. var _decode_stream = __w_pdfjs_require__(148);
  17361. var _primitives = __w_pdfjs_require__(134);
  17362. class CCITTFaxStream extends _decode_stream.DecodeStream {
  17363. constructor(str, maybeLength, params) {
  17364. super(maybeLength);
  17365. this.str = str;
  17366. this.dict = str.dict;
  17367. if (!(params instanceof _primitives.Dict)) {
  17368. params = _primitives.Dict.empty;
  17369. }
  17370. const source = {
  17371. next() {
  17372. return str.getByte();
  17373. }
  17374. };
  17375. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  17376. K: params.get("K"),
  17377. EndOfLine: params.get("EndOfLine"),
  17378. EncodedByteAlign: params.get("EncodedByteAlign"),
  17379. Columns: params.get("Columns"),
  17380. Rows: params.get("Rows"),
  17381. EndOfBlock: params.get("EndOfBlock"),
  17382. BlackIs1: params.get("BlackIs1")
  17383. });
  17384. }
  17385. readBlock() {
  17386. while (!this.eof) {
  17387. const c = this.ccittFaxDecoder.readNextChar();
  17388. if (c === -1) {
  17389. this.eof = true;
  17390. return;
  17391. }
  17392. this.ensureBuffer(this.bufferLength + 1);
  17393. this.buffer[this.bufferLength++] = c;
  17394. }
  17395. }
  17396. }
  17397. exports.CCITTFaxStream = CCITTFaxStream;
  17398. /***/ }),
  17399. /* 151 */
  17400. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17401. "use strict";
  17402. Object.defineProperty(exports, "__esModule", ({
  17403. value: true
  17404. }));
  17405. exports.CCITTFaxDecoder = void 0;
  17406. var _util = __w_pdfjs_require__(2);
  17407. const ccittEOL = -2;
  17408. const ccittEOF = -1;
  17409. const twoDimPass = 0;
  17410. const twoDimHoriz = 1;
  17411. const twoDimVert0 = 2;
  17412. const twoDimVertR1 = 3;
  17413. const twoDimVertL1 = 4;
  17414. const twoDimVertR2 = 5;
  17415. const twoDimVertL2 = 6;
  17416. const twoDimVertR3 = 7;
  17417. const twoDimVertL3 = 8;
  17418. 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]];
  17419. 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]];
  17420. 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]];
  17421. 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]];
  17422. 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]];
  17423. 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]];
  17424. class CCITTFaxDecoder {
  17425. constructor(source) {
  17426. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  17427. if (!source || typeof source.next !== "function") {
  17428. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  17429. }
  17430. this.source = source;
  17431. this.eof = false;
  17432. this.encoding = options.K || 0;
  17433. this.eoline = options.EndOfLine || false;
  17434. this.byteAlign = options.EncodedByteAlign || false;
  17435. this.columns = options.Columns || 1728;
  17436. this.rows = options.Rows || 0;
  17437. let eoblock = options.EndOfBlock;
  17438. if (eoblock === null || eoblock === undefined) {
  17439. eoblock = true;
  17440. }
  17441. this.eoblock = eoblock;
  17442. this.black = options.BlackIs1 || false;
  17443. this.codingLine = new Uint32Array(this.columns + 1);
  17444. this.refLine = new Uint32Array(this.columns + 2);
  17445. this.codingLine[0] = this.columns;
  17446. this.codingPos = 0;
  17447. this.row = 0;
  17448. this.nextLine2D = this.encoding < 0;
  17449. this.inputBits = 0;
  17450. this.inputBuf = 0;
  17451. this.outputBits = 0;
  17452. this.rowsDone = false;
  17453. let code1;
  17454. while ((code1 = this._lookBits(12)) === 0) {
  17455. this._eatBits(1);
  17456. }
  17457. if (code1 === 1) {
  17458. this._eatBits(12);
  17459. }
  17460. if (this.encoding > 0) {
  17461. this.nextLine2D = !this._lookBits(1);
  17462. this._eatBits(1);
  17463. }
  17464. }
  17465. readNextChar() {
  17466. if (this.eof) {
  17467. return -1;
  17468. }
  17469. const refLine = this.refLine;
  17470. const codingLine = this.codingLine;
  17471. const columns = this.columns;
  17472. let refPos, blackPixels, bits, i;
  17473. if (this.outputBits === 0) {
  17474. if (this.rowsDone) {
  17475. this.eof = true;
  17476. }
  17477. if (this.eof) {
  17478. return -1;
  17479. }
  17480. this.err = false;
  17481. let code1, code2, code3;
  17482. if (this.nextLine2D) {
  17483. for (i = 0; codingLine[i] < columns; ++i) {
  17484. refLine[i] = codingLine[i];
  17485. }
  17486. refLine[i++] = columns;
  17487. refLine[i] = columns;
  17488. codingLine[0] = 0;
  17489. this.codingPos = 0;
  17490. refPos = 0;
  17491. blackPixels = 0;
  17492. while (codingLine[this.codingPos] < columns) {
  17493. code1 = this._getTwoDimCode();
  17494. switch (code1) {
  17495. case twoDimPass:
  17496. this._addPixels(refLine[refPos + 1], blackPixels);
  17497. if (refLine[refPos + 1] < columns) {
  17498. refPos += 2;
  17499. }
  17500. break;
  17501. case twoDimHoriz:
  17502. code1 = code2 = 0;
  17503. if (blackPixels) {
  17504. do {
  17505. code1 += code3 = this._getBlackCode();
  17506. } while (code3 >= 64);
  17507. do {
  17508. code2 += code3 = this._getWhiteCode();
  17509. } while (code3 >= 64);
  17510. } else {
  17511. do {
  17512. code1 += code3 = this._getWhiteCode();
  17513. } while (code3 >= 64);
  17514. do {
  17515. code2 += code3 = this._getBlackCode();
  17516. } while (code3 >= 64);
  17517. }
  17518. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17519. if (codingLine[this.codingPos] < columns) {
  17520. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  17521. }
  17522. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17523. refPos += 2;
  17524. }
  17525. break;
  17526. case twoDimVertR3:
  17527. this._addPixels(refLine[refPos] + 3, blackPixels);
  17528. blackPixels ^= 1;
  17529. if (codingLine[this.codingPos] < columns) {
  17530. ++refPos;
  17531. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17532. refPos += 2;
  17533. }
  17534. }
  17535. break;
  17536. case twoDimVertR2:
  17537. this._addPixels(refLine[refPos] + 2, blackPixels);
  17538. blackPixels ^= 1;
  17539. if (codingLine[this.codingPos] < columns) {
  17540. ++refPos;
  17541. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17542. refPos += 2;
  17543. }
  17544. }
  17545. break;
  17546. case twoDimVertR1:
  17547. this._addPixels(refLine[refPos] + 1, blackPixels);
  17548. blackPixels ^= 1;
  17549. if (codingLine[this.codingPos] < columns) {
  17550. ++refPos;
  17551. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17552. refPos += 2;
  17553. }
  17554. }
  17555. break;
  17556. case twoDimVert0:
  17557. this._addPixels(refLine[refPos], blackPixels);
  17558. blackPixels ^= 1;
  17559. if (codingLine[this.codingPos] < columns) {
  17560. ++refPos;
  17561. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17562. refPos += 2;
  17563. }
  17564. }
  17565. break;
  17566. case twoDimVertL3:
  17567. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  17568. blackPixels ^= 1;
  17569. if (codingLine[this.codingPos] < columns) {
  17570. if (refPos > 0) {
  17571. --refPos;
  17572. } else {
  17573. ++refPos;
  17574. }
  17575. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17576. refPos += 2;
  17577. }
  17578. }
  17579. break;
  17580. case twoDimVertL2:
  17581. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  17582. blackPixels ^= 1;
  17583. if (codingLine[this.codingPos] < columns) {
  17584. if (refPos > 0) {
  17585. --refPos;
  17586. } else {
  17587. ++refPos;
  17588. }
  17589. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17590. refPos += 2;
  17591. }
  17592. }
  17593. break;
  17594. case twoDimVertL1:
  17595. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  17596. blackPixels ^= 1;
  17597. if (codingLine[this.codingPos] < columns) {
  17598. if (refPos > 0) {
  17599. --refPos;
  17600. } else {
  17601. ++refPos;
  17602. }
  17603. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17604. refPos += 2;
  17605. }
  17606. }
  17607. break;
  17608. case ccittEOF:
  17609. this._addPixels(columns, 0);
  17610. this.eof = true;
  17611. break;
  17612. default:
  17613. (0, _util.info)("bad 2d code");
  17614. this._addPixels(columns, 0);
  17615. this.err = true;
  17616. }
  17617. }
  17618. } else {
  17619. codingLine[0] = 0;
  17620. this.codingPos = 0;
  17621. blackPixels = 0;
  17622. while (codingLine[this.codingPos] < columns) {
  17623. code1 = 0;
  17624. if (blackPixels) {
  17625. do {
  17626. code1 += code3 = this._getBlackCode();
  17627. } while (code3 >= 64);
  17628. } else {
  17629. do {
  17630. code1 += code3 = this._getWhiteCode();
  17631. } while (code3 >= 64);
  17632. }
  17633. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17634. blackPixels ^= 1;
  17635. }
  17636. }
  17637. let gotEOL = false;
  17638. if (this.byteAlign) {
  17639. this.inputBits &= ~7;
  17640. }
  17641. if (!this.eoblock && this.row === this.rows - 1) {
  17642. this.rowsDone = true;
  17643. } else {
  17644. code1 = this._lookBits(12);
  17645. if (this.eoline) {
  17646. while (code1 !== ccittEOF && code1 !== 1) {
  17647. this._eatBits(1);
  17648. code1 = this._lookBits(12);
  17649. }
  17650. } else {
  17651. while (code1 === 0) {
  17652. this._eatBits(1);
  17653. code1 = this._lookBits(12);
  17654. }
  17655. }
  17656. if (code1 === 1) {
  17657. this._eatBits(12);
  17658. gotEOL = true;
  17659. } else if (code1 === ccittEOF) {
  17660. this.eof = true;
  17661. }
  17662. }
  17663. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  17664. this.nextLine2D = !this._lookBits(1);
  17665. this._eatBits(1);
  17666. }
  17667. if (this.eoblock && gotEOL && this.byteAlign) {
  17668. code1 = this._lookBits(12);
  17669. if (code1 === 1) {
  17670. this._eatBits(12);
  17671. if (this.encoding > 0) {
  17672. this._lookBits(1);
  17673. this._eatBits(1);
  17674. }
  17675. if (this.encoding >= 0) {
  17676. for (i = 0; i < 4; ++i) {
  17677. code1 = this._lookBits(12);
  17678. if (code1 !== 1) {
  17679. (0, _util.info)("bad rtc code: " + code1);
  17680. }
  17681. this._eatBits(12);
  17682. if (this.encoding > 0) {
  17683. this._lookBits(1);
  17684. this._eatBits(1);
  17685. }
  17686. }
  17687. }
  17688. this.eof = true;
  17689. }
  17690. } else if (this.err && this.eoline) {
  17691. while (true) {
  17692. code1 = this._lookBits(13);
  17693. if (code1 === ccittEOF) {
  17694. this.eof = true;
  17695. return -1;
  17696. }
  17697. if (code1 >> 1 === 1) {
  17698. break;
  17699. }
  17700. this._eatBits(1);
  17701. }
  17702. this._eatBits(12);
  17703. if (this.encoding > 0) {
  17704. this._eatBits(1);
  17705. this.nextLine2D = !(code1 & 1);
  17706. }
  17707. }
  17708. if (codingLine[0] > 0) {
  17709. this.outputBits = codingLine[this.codingPos = 0];
  17710. } else {
  17711. this.outputBits = codingLine[this.codingPos = 1];
  17712. }
  17713. this.row++;
  17714. }
  17715. let c;
  17716. if (this.outputBits >= 8) {
  17717. c = this.codingPos & 1 ? 0 : 0xff;
  17718. this.outputBits -= 8;
  17719. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  17720. this.codingPos++;
  17721. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17722. }
  17723. } else {
  17724. bits = 8;
  17725. c = 0;
  17726. do {
  17727. if (typeof this.outputBits !== "number") {
  17728. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  17729. }
  17730. if (this.outputBits > bits) {
  17731. c <<= bits;
  17732. if (!(this.codingPos & 1)) {
  17733. c |= 0xff >> 8 - bits;
  17734. }
  17735. this.outputBits -= bits;
  17736. bits = 0;
  17737. } else {
  17738. c <<= this.outputBits;
  17739. if (!(this.codingPos & 1)) {
  17740. c |= 0xff >> 8 - this.outputBits;
  17741. }
  17742. bits -= this.outputBits;
  17743. this.outputBits = 0;
  17744. if (codingLine[this.codingPos] < columns) {
  17745. this.codingPos++;
  17746. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17747. } else if (bits > 0) {
  17748. c <<= bits;
  17749. bits = 0;
  17750. }
  17751. }
  17752. } while (bits);
  17753. }
  17754. if (this.black) {
  17755. c ^= 0xff;
  17756. }
  17757. return c;
  17758. }
  17759. _addPixels(a1, blackPixels) {
  17760. const codingLine = this.codingLine;
  17761. let codingPos = this.codingPos;
  17762. if (a1 > codingLine[codingPos]) {
  17763. if (a1 > this.columns) {
  17764. (0, _util.info)("row is wrong length");
  17765. this.err = true;
  17766. a1 = this.columns;
  17767. }
  17768. if (codingPos & 1 ^ blackPixels) {
  17769. ++codingPos;
  17770. }
  17771. codingLine[codingPos] = a1;
  17772. }
  17773. this.codingPos = codingPos;
  17774. }
  17775. _addPixelsNeg(a1, blackPixels) {
  17776. const codingLine = this.codingLine;
  17777. let codingPos = this.codingPos;
  17778. if (a1 > codingLine[codingPos]) {
  17779. if (a1 > this.columns) {
  17780. (0, _util.info)("row is wrong length");
  17781. this.err = true;
  17782. a1 = this.columns;
  17783. }
  17784. if (codingPos & 1 ^ blackPixels) {
  17785. ++codingPos;
  17786. }
  17787. codingLine[codingPos] = a1;
  17788. } else if (a1 < codingLine[codingPos]) {
  17789. if (a1 < 0) {
  17790. (0, _util.info)("invalid code");
  17791. this.err = true;
  17792. a1 = 0;
  17793. }
  17794. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  17795. --codingPos;
  17796. }
  17797. codingLine[codingPos] = a1;
  17798. }
  17799. this.codingPos = codingPos;
  17800. }
  17801. _findTableCode(start, end, table, limit) {
  17802. const limitValue = limit || 0;
  17803. for (let i = start; i <= end; ++i) {
  17804. let code = this._lookBits(i);
  17805. if (code === ccittEOF) {
  17806. return [true, 1, false];
  17807. }
  17808. if (i < end) {
  17809. code <<= end - i;
  17810. }
  17811. if (!limitValue || code >= limitValue) {
  17812. const p = table[code - limitValue];
  17813. if (p[0] === i) {
  17814. this._eatBits(i);
  17815. return [true, p[1], true];
  17816. }
  17817. }
  17818. }
  17819. return [false, 0, false];
  17820. }
  17821. _getTwoDimCode() {
  17822. let code = 0;
  17823. let p;
  17824. if (this.eoblock) {
  17825. code = this._lookBits(7);
  17826. p = twoDimTable[code];
  17827. if (p && p[0] > 0) {
  17828. this._eatBits(p[0]);
  17829. return p[1];
  17830. }
  17831. } else {
  17832. const result = this._findTableCode(1, 7, twoDimTable);
  17833. if (result[0] && result[2]) {
  17834. return result[1];
  17835. }
  17836. }
  17837. (0, _util.info)("Bad two dim code");
  17838. return ccittEOF;
  17839. }
  17840. _getWhiteCode() {
  17841. let code = 0;
  17842. let p;
  17843. if (this.eoblock) {
  17844. code = this._lookBits(12);
  17845. if (code === ccittEOF) {
  17846. return 1;
  17847. }
  17848. if (code >> 5 === 0) {
  17849. p = whiteTable1[code];
  17850. } else {
  17851. p = whiteTable2[code >> 3];
  17852. }
  17853. if (p[0] > 0) {
  17854. this._eatBits(p[0]);
  17855. return p[1];
  17856. }
  17857. } else {
  17858. let result = this._findTableCode(1, 9, whiteTable2);
  17859. if (result[0]) {
  17860. return result[1];
  17861. }
  17862. result = this._findTableCode(11, 12, whiteTable1);
  17863. if (result[0]) {
  17864. return result[1];
  17865. }
  17866. }
  17867. (0, _util.info)("bad white code");
  17868. this._eatBits(1);
  17869. return 1;
  17870. }
  17871. _getBlackCode() {
  17872. let code, p;
  17873. if (this.eoblock) {
  17874. code = this._lookBits(13);
  17875. if (code === ccittEOF) {
  17876. return 1;
  17877. }
  17878. if (code >> 7 === 0) {
  17879. p = blackTable1[code];
  17880. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  17881. p = blackTable2[(code >> 1) - 64];
  17882. } else {
  17883. p = blackTable3[code >> 7];
  17884. }
  17885. if (p[0] > 0) {
  17886. this._eatBits(p[0]);
  17887. return p[1];
  17888. }
  17889. } else {
  17890. let result = this._findTableCode(2, 6, blackTable3);
  17891. if (result[0]) {
  17892. return result[1];
  17893. }
  17894. result = this._findTableCode(7, 12, blackTable2, 64);
  17895. if (result[0]) {
  17896. return result[1];
  17897. }
  17898. result = this._findTableCode(10, 13, blackTable1);
  17899. if (result[0]) {
  17900. return result[1];
  17901. }
  17902. }
  17903. (0, _util.info)("bad black code");
  17904. this._eatBits(1);
  17905. return 1;
  17906. }
  17907. _lookBits(n) {
  17908. let c;
  17909. while (this.inputBits < n) {
  17910. if ((c = this.source.next()) === -1) {
  17911. if (this.inputBits === 0) {
  17912. return ccittEOF;
  17913. }
  17914. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  17915. }
  17916. this.inputBuf = this.inputBuf << 8 | c;
  17917. this.inputBits += 8;
  17918. }
  17919. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  17920. }
  17921. _eatBits(n) {
  17922. if ((this.inputBits -= n) < 0) {
  17923. this.inputBits = 0;
  17924. }
  17925. }
  17926. }
  17927. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  17928. /***/ }),
  17929. /* 152 */
  17930. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17931. "use strict";
  17932. Object.defineProperty(exports, "__esModule", ({
  17933. value: true
  17934. }));
  17935. exports.FlateStream = void 0;
  17936. var _decode_stream = __w_pdfjs_require__(148);
  17937. var _util = __w_pdfjs_require__(2);
  17938. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  17939. 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]);
  17940. 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]);
  17941. 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];
  17942. 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];
  17943. class FlateStream extends _decode_stream.DecodeStream {
  17944. constructor(str, maybeLength) {
  17945. super(maybeLength);
  17946. this.str = str;
  17947. this.dict = str.dict;
  17948. const cmf = str.getByte();
  17949. const flg = str.getByte();
  17950. if (cmf === -1 || flg === -1) {
  17951. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  17952. }
  17953. if ((cmf & 0x0f) !== 0x08) {
  17954. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  17955. }
  17956. if (((cmf << 8) + flg) % 31 !== 0) {
  17957. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  17958. }
  17959. if (flg & 0x20) {
  17960. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  17961. }
  17962. this.codeSize = 0;
  17963. this.codeBuf = 0;
  17964. }
  17965. getBits(bits) {
  17966. const str = this.str;
  17967. let codeSize = this.codeSize;
  17968. let codeBuf = this.codeBuf;
  17969. let b;
  17970. while (codeSize < bits) {
  17971. if ((b = str.getByte()) === -1) {
  17972. throw new _util.FormatError("Bad encoding in flate stream");
  17973. }
  17974. codeBuf |= b << codeSize;
  17975. codeSize += 8;
  17976. }
  17977. b = codeBuf & (1 << bits) - 1;
  17978. this.codeBuf = codeBuf >> bits;
  17979. this.codeSize = codeSize -= bits;
  17980. return b;
  17981. }
  17982. getCode(table) {
  17983. const str = this.str;
  17984. const codes = table[0];
  17985. const maxLen = table[1];
  17986. let codeSize = this.codeSize;
  17987. let codeBuf = this.codeBuf;
  17988. let b;
  17989. while (codeSize < maxLen) {
  17990. if ((b = str.getByte()) === -1) {
  17991. break;
  17992. }
  17993. codeBuf |= b << codeSize;
  17994. codeSize += 8;
  17995. }
  17996. const code = codes[codeBuf & (1 << maxLen) - 1];
  17997. const codeLen = code >> 16;
  17998. const codeVal = code & 0xffff;
  17999. if (codeLen < 1 || codeSize < codeLen) {
  18000. throw new _util.FormatError("Bad encoding in flate stream");
  18001. }
  18002. this.codeBuf = codeBuf >> codeLen;
  18003. this.codeSize = codeSize - codeLen;
  18004. return codeVal;
  18005. }
  18006. generateHuffmanTable(lengths) {
  18007. const n = lengths.length;
  18008. let maxLen = 0;
  18009. let i;
  18010. for (i = 0; i < n; ++i) {
  18011. if (lengths[i] > maxLen) {
  18012. maxLen = lengths[i];
  18013. }
  18014. }
  18015. const size = 1 << maxLen;
  18016. const codes = new Int32Array(size);
  18017. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  18018. for (let val = 0; val < n; ++val) {
  18019. if (lengths[val] === len) {
  18020. let code2 = 0;
  18021. let t = code;
  18022. for (i = 0; i < len; ++i) {
  18023. code2 = code2 << 1 | t & 1;
  18024. t >>= 1;
  18025. }
  18026. for (i = code2; i < size; i += skip) {
  18027. codes[i] = len << 16 | val;
  18028. }
  18029. ++code;
  18030. }
  18031. }
  18032. }
  18033. return [codes, maxLen];
  18034. }
  18035. readBlock() {
  18036. let buffer, len;
  18037. const str = this.str;
  18038. let hdr = this.getBits(3);
  18039. if (hdr & 1) {
  18040. this.eof = true;
  18041. }
  18042. hdr >>= 1;
  18043. if (hdr === 0) {
  18044. let b;
  18045. if ((b = str.getByte()) === -1) {
  18046. throw new _util.FormatError("Bad block header in flate stream");
  18047. }
  18048. let blockLen = b;
  18049. if ((b = str.getByte()) === -1) {
  18050. throw new _util.FormatError("Bad block header in flate stream");
  18051. }
  18052. blockLen |= b << 8;
  18053. if ((b = str.getByte()) === -1) {
  18054. throw new _util.FormatError("Bad block header in flate stream");
  18055. }
  18056. let check = b;
  18057. if ((b = str.getByte()) === -1) {
  18058. throw new _util.FormatError("Bad block header in flate stream");
  18059. }
  18060. check |= b << 8;
  18061. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  18062. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  18063. }
  18064. this.codeBuf = 0;
  18065. this.codeSize = 0;
  18066. const bufferLength = this.bufferLength,
  18067. end = bufferLength + blockLen;
  18068. buffer = this.ensureBuffer(end);
  18069. this.bufferLength = end;
  18070. if (blockLen === 0) {
  18071. if (str.peekByte() === -1) {
  18072. this.eof = true;
  18073. }
  18074. } else {
  18075. const block = str.getBytes(blockLen);
  18076. buffer.set(block, bufferLength);
  18077. if (block.length < blockLen) {
  18078. this.eof = true;
  18079. }
  18080. }
  18081. return;
  18082. }
  18083. let litCodeTable;
  18084. let distCodeTable;
  18085. if (hdr === 1) {
  18086. litCodeTable = fixedLitCodeTab;
  18087. distCodeTable = fixedDistCodeTab;
  18088. } else if (hdr === 2) {
  18089. const numLitCodes = this.getBits(5) + 257;
  18090. const numDistCodes = this.getBits(5) + 1;
  18091. const numCodeLenCodes = this.getBits(4) + 4;
  18092. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  18093. let i;
  18094. for (i = 0; i < numCodeLenCodes; ++i) {
  18095. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  18096. }
  18097. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  18098. len = 0;
  18099. i = 0;
  18100. const codes = numLitCodes + numDistCodes;
  18101. const codeLengths = new Uint8Array(codes);
  18102. let bitsLength, bitsOffset, what;
  18103. while (i < codes) {
  18104. const code = this.getCode(codeLenCodeTab);
  18105. if (code === 16) {
  18106. bitsLength = 2;
  18107. bitsOffset = 3;
  18108. what = len;
  18109. } else if (code === 17) {
  18110. bitsLength = 3;
  18111. bitsOffset = 3;
  18112. what = len = 0;
  18113. } else if (code === 18) {
  18114. bitsLength = 7;
  18115. bitsOffset = 11;
  18116. what = len = 0;
  18117. } else {
  18118. codeLengths[i++] = len = code;
  18119. continue;
  18120. }
  18121. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  18122. while (repeatLength-- > 0) {
  18123. codeLengths[i++] = what;
  18124. }
  18125. }
  18126. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  18127. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  18128. } else {
  18129. throw new _util.FormatError("Unknown block type in flate stream");
  18130. }
  18131. buffer = this.buffer;
  18132. let limit = buffer ? buffer.length : 0;
  18133. let pos = this.bufferLength;
  18134. while (true) {
  18135. let code1 = this.getCode(litCodeTable);
  18136. if (code1 < 256) {
  18137. if (pos + 1 >= limit) {
  18138. buffer = this.ensureBuffer(pos + 1);
  18139. limit = buffer.length;
  18140. }
  18141. buffer[pos++] = code1;
  18142. continue;
  18143. }
  18144. if (code1 === 256) {
  18145. this.bufferLength = pos;
  18146. return;
  18147. }
  18148. code1 -= 257;
  18149. code1 = lengthDecode[code1];
  18150. let code2 = code1 >> 16;
  18151. if (code2 > 0) {
  18152. code2 = this.getBits(code2);
  18153. }
  18154. len = (code1 & 0xffff) + code2;
  18155. code1 = this.getCode(distCodeTable);
  18156. code1 = distDecode[code1];
  18157. code2 = code1 >> 16;
  18158. if (code2 > 0) {
  18159. code2 = this.getBits(code2);
  18160. }
  18161. const dist = (code1 & 0xffff) + code2;
  18162. if (pos + len >= limit) {
  18163. buffer = this.ensureBuffer(pos + len);
  18164. limit = buffer.length;
  18165. }
  18166. for (let k = 0; k < len; ++k, ++pos) {
  18167. buffer[pos] = buffer[pos - dist];
  18168. }
  18169. }
  18170. }
  18171. }
  18172. exports.FlateStream = FlateStream;
  18173. /***/ }),
  18174. /* 153 */
  18175. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18176. "use strict";
  18177. Object.defineProperty(exports, "__esModule", ({
  18178. value: true
  18179. }));
  18180. exports.Jbig2Stream = void 0;
  18181. var _base_stream = __w_pdfjs_require__(136);
  18182. var _decode_stream = __w_pdfjs_require__(148);
  18183. var _primitives = __w_pdfjs_require__(134);
  18184. var _jbig = __w_pdfjs_require__(154);
  18185. var _util = __w_pdfjs_require__(2);
  18186. class Jbig2Stream extends _decode_stream.DecodeStream {
  18187. constructor(stream, maybeLength, params) {
  18188. super(maybeLength);
  18189. this.stream = stream;
  18190. this.dict = stream.dict;
  18191. this.maybeLength = maybeLength;
  18192. this.params = params;
  18193. }
  18194. get bytes() {
  18195. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  18196. }
  18197. ensureBuffer(requested) {}
  18198. readBlock() {
  18199. if (this.eof) {
  18200. return;
  18201. }
  18202. const jbig2Image = new _jbig.Jbig2Image();
  18203. const chunks = [];
  18204. if (this.params instanceof _primitives.Dict) {
  18205. const globalsStream = this.params.get("JBIG2Globals");
  18206. if (globalsStream instanceof _base_stream.BaseStream) {
  18207. const globals = globalsStream.getBytes();
  18208. chunks.push({
  18209. data: globals,
  18210. start: 0,
  18211. end: globals.length
  18212. });
  18213. }
  18214. }
  18215. chunks.push({
  18216. data: this.bytes,
  18217. start: 0,
  18218. end: this.bytes.length
  18219. });
  18220. const data = jbig2Image.parseChunks(chunks);
  18221. const dataLength = data.length;
  18222. for (let i = 0; i < dataLength; i++) {
  18223. data[i] ^= 0xff;
  18224. }
  18225. this.buffer = data;
  18226. this.bufferLength = dataLength;
  18227. this.eof = true;
  18228. }
  18229. }
  18230. exports.Jbig2Stream = Jbig2Stream;
  18231. /***/ }),
  18232. /* 154 */
  18233. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18234. "use strict";
  18235. Object.defineProperty(exports, "__esModule", ({
  18236. value: true
  18237. }));
  18238. exports.Jbig2Image = void 0;
  18239. var _util = __w_pdfjs_require__(2);
  18240. var _core_utils = __w_pdfjs_require__(135);
  18241. var _arithmetic_decoder = __w_pdfjs_require__(155);
  18242. var _ccitt = __w_pdfjs_require__(151);
  18243. class Jbig2Error extends _util.BaseException {
  18244. constructor(msg) {
  18245. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  18246. }
  18247. }
  18248. class ContextCache {
  18249. getContexts(id) {
  18250. if (id in this) {
  18251. return this[id];
  18252. }
  18253. return this[id] = new Int8Array(1 << 16);
  18254. }
  18255. }
  18256. class DecodingContext {
  18257. constructor(data, start, end) {
  18258. this.data = data;
  18259. this.start = start;
  18260. this.end = end;
  18261. }
  18262. get decoder() {
  18263. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  18264. return (0, _util.shadow)(this, "decoder", decoder);
  18265. }
  18266. get contextCache() {
  18267. const cache = new ContextCache();
  18268. return (0, _util.shadow)(this, "contextCache", cache);
  18269. }
  18270. }
  18271. function decodeInteger(contextCache, procedure, decoder) {
  18272. const contexts = contextCache.getContexts(procedure);
  18273. let prev = 1;
  18274. function readBits(length) {
  18275. let v = 0;
  18276. for (let i = 0; i < length; i++) {
  18277. const bit = decoder.readBit(contexts, prev);
  18278. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  18279. v = v << 1 | bit;
  18280. }
  18281. return v >>> 0;
  18282. }
  18283. const sign = readBits(1);
  18284. 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);
  18285. if (sign === 0) {
  18286. return value;
  18287. } else if (value > 0) {
  18288. return -value;
  18289. }
  18290. return null;
  18291. }
  18292. function decodeIAID(contextCache, decoder, codeLength) {
  18293. const contexts = contextCache.getContexts("IAID");
  18294. let prev = 1;
  18295. for (let i = 0; i < codeLength; i++) {
  18296. const bit = decoder.readBit(contexts, prev);
  18297. prev = prev << 1 | bit;
  18298. }
  18299. if (codeLength < 31) {
  18300. return prev & (1 << codeLength) - 1;
  18301. }
  18302. return prev & 0x7fffffff;
  18303. }
  18304. 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"];
  18305. const CodingTemplates = [[{
  18306. x: -1,
  18307. y: -2
  18308. }, {
  18309. x: 0,
  18310. y: -2
  18311. }, {
  18312. x: 1,
  18313. y: -2
  18314. }, {
  18315. x: -2,
  18316. y: -1
  18317. }, {
  18318. x: -1,
  18319. y: -1
  18320. }, {
  18321. x: 0,
  18322. y: -1
  18323. }, {
  18324. x: 1,
  18325. y: -1
  18326. }, {
  18327. x: 2,
  18328. y: -1
  18329. }, {
  18330. x: -4,
  18331. y: 0
  18332. }, {
  18333. x: -3,
  18334. y: 0
  18335. }, {
  18336. x: -2,
  18337. y: 0
  18338. }, {
  18339. x: -1,
  18340. y: 0
  18341. }], [{
  18342. x: -1,
  18343. y: -2
  18344. }, {
  18345. x: 0,
  18346. y: -2
  18347. }, {
  18348. x: 1,
  18349. y: -2
  18350. }, {
  18351. x: 2,
  18352. y: -2
  18353. }, {
  18354. x: -2,
  18355. y: -1
  18356. }, {
  18357. x: -1,
  18358. y: -1
  18359. }, {
  18360. x: 0,
  18361. y: -1
  18362. }, {
  18363. x: 1,
  18364. y: -1
  18365. }, {
  18366. x: 2,
  18367. y: -1
  18368. }, {
  18369. x: -3,
  18370. y: 0
  18371. }, {
  18372. x: -2,
  18373. y: 0
  18374. }, {
  18375. x: -1,
  18376. y: 0
  18377. }], [{
  18378. x: -1,
  18379. y: -2
  18380. }, {
  18381. x: 0,
  18382. y: -2
  18383. }, {
  18384. x: 1,
  18385. y: -2
  18386. }, {
  18387. x: -2,
  18388. y: -1
  18389. }, {
  18390. x: -1,
  18391. y: -1
  18392. }, {
  18393. x: 0,
  18394. y: -1
  18395. }, {
  18396. x: 1,
  18397. y: -1
  18398. }, {
  18399. x: -2,
  18400. y: 0
  18401. }, {
  18402. x: -1,
  18403. y: 0
  18404. }], [{
  18405. x: -3,
  18406. y: -1
  18407. }, {
  18408. x: -2,
  18409. y: -1
  18410. }, {
  18411. x: -1,
  18412. y: -1
  18413. }, {
  18414. x: 0,
  18415. y: -1
  18416. }, {
  18417. x: 1,
  18418. y: -1
  18419. }, {
  18420. x: -4,
  18421. y: 0
  18422. }, {
  18423. x: -3,
  18424. y: 0
  18425. }, {
  18426. x: -2,
  18427. y: 0
  18428. }, {
  18429. x: -1,
  18430. y: 0
  18431. }]];
  18432. const RefinementTemplates = [{
  18433. coding: [{
  18434. x: 0,
  18435. y: -1
  18436. }, {
  18437. x: 1,
  18438. y: -1
  18439. }, {
  18440. x: -1,
  18441. y: 0
  18442. }],
  18443. reference: [{
  18444. x: 0,
  18445. y: -1
  18446. }, {
  18447. x: 1,
  18448. y: -1
  18449. }, {
  18450. x: -1,
  18451. y: 0
  18452. }, {
  18453. x: 0,
  18454. y: 0
  18455. }, {
  18456. x: 1,
  18457. y: 0
  18458. }, {
  18459. x: -1,
  18460. y: 1
  18461. }, {
  18462. x: 0,
  18463. y: 1
  18464. }, {
  18465. x: 1,
  18466. y: 1
  18467. }]
  18468. }, {
  18469. coding: [{
  18470. x: -1,
  18471. y: -1
  18472. }, {
  18473. x: 0,
  18474. y: -1
  18475. }, {
  18476. x: 1,
  18477. y: -1
  18478. }, {
  18479. x: -1,
  18480. y: 0
  18481. }],
  18482. reference: [{
  18483. x: 0,
  18484. y: -1
  18485. }, {
  18486. x: -1,
  18487. y: 0
  18488. }, {
  18489. x: 0,
  18490. y: 0
  18491. }, {
  18492. x: 1,
  18493. y: 0
  18494. }, {
  18495. x: 0,
  18496. y: 1
  18497. }, {
  18498. x: 1,
  18499. y: 1
  18500. }]
  18501. }];
  18502. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  18503. const RefinementReusedContexts = [0x0020, 0x0008];
  18504. function decodeBitmapTemplate0(width, height, decodingContext) {
  18505. const decoder = decodingContext.decoder;
  18506. const contexts = decodingContext.contextCache.getContexts("GB");
  18507. const bitmap = [];
  18508. let contextLabel, i, j, pixel, row, row1, row2;
  18509. const OLD_PIXEL_MASK = 0x7bf7;
  18510. for (i = 0; i < height; i++) {
  18511. row = bitmap[i] = new Uint8Array(width);
  18512. row1 = i < 1 ? row : bitmap[i - 1];
  18513. row2 = i < 2 ? row : bitmap[i - 2];
  18514. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  18515. for (j = 0; j < width; j++) {
  18516. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  18517. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  18518. }
  18519. }
  18520. return bitmap;
  18521. }
  18522. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  18523. if (mmr) {
  18524. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  18525. return decodeMMRBitmap(input, width, height, false);
  18526. }
  18527. 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) {
  18528. return decodeBitmapTemplate0(width, height, decodingContext);
  18529. }
  18530. const useskip = !!skip;
  18531. const template = CodingTemplates[templateIndex].concat(at);
  18532. template.sort(function (a, b) {
  18533. return a.y - b.y || a.x - b.x;
  18534. });
  18535. const templateLength = template.length;
  18536. const templateX = new Int8Array(templateLength);
  18537. const templateY = new Int8Array(templateLength);
  18538. const changingTemplateEntries = [];
  18539. let reuseMask = 0,
  18540. minX = 0,
  18541. maxX = 0,
  18542. minY = 0;
  18543. let c, k;
  18544. for (k = 0; k < templateLength; k++) {
  18545. templateX[k] = template[k].x;
  18546. templateY[k] = template[k].y;
  18547. minX = Math.min(minX, template[k].x);
  18548. maxX = Math.max(maxX, template[k].x);
  18549. minY = Math.min(minY, template[k].y);
  18550. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  18551. reuseMask |= 1 << templateLength - 1 - k;
  18552. } else {
  18553. changingTemplateEntries.push(k);
  18554. }
  18555. }
  18556. const changingEntriesLength = changingTemplateEntries.length;
  18557. const changingTemplateX = new Int8Array(changingEntriesLength);
  18558. const changingTemplateY = new Int8Array(changingEntriesLength);
  18559. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  18560. for (c = 0; c < changingEntriesLength; c++) {
  18561. k = changingTemplateEntries[c];
  18562. changingTemplateX[c] = template[k].x;
  18563. changingTemplateY[c] = template[k].y;
  18564. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  18565. }
  18566. const sbb_left = -minX;
  18567. const sbb_top = -minY;
  18568. const sbb_right = width - maxX;
  18569. const pseudoPixelContext = ReusedContexts[templateIndex];
  18570. let row = new Uint8Array(width);
  18571. const bitmap = [];
  18572. const decoder = decodingContext.decoder;
  18573. const contexts = decodingContext.contextCache.getContexts("GB");
  18574. let ltp = 0,
  18575. j,
  18576. i0,
  18577. j0,
  18578. contextLabel = 0,
  18579. bit,
  18580. shift;
  18581. for (let i = 0; i < height; i++) {
  18582. if (prediction) {
  18583. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18584. ltp ^= sltp;
  18585. if (ltp) {
  18586. bitmap.push(row);
  18587. continue;
  18588. }
  18589. }
  18590. row = new Uint8Array(row);
  18591. bitmap.push(row);
  18592. for (j = 0; j < width; j++) {
  18593. if (useskip && skip[i][j]) {
  18594. row[j] = 0;
  18595. continue;
  18596. }
  18597. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  18598. contextLabel = contextLabel << 1 & reuseMask;
  18599. for (k = 0; k < changingEntriesLength; k++) {
  18600. i0 = i + changingTemplateY[k];
  18601. j0 = j + changingTemplateX[k];
  18602. bit = bitmap[i0][j0];
  18603. if (bit) {
  18604. bit = changingTemplateBit[k];
  18605. contextLabel |= bit;
  18606. }
  18607. }
  18608. } else {
  18609. contextLabel = 0;
  18610. shift = templateLength - 1;
  18611. for (k = 0; k < templateLength; k++, shift--) {
  18612. j0 = j + templateX[k];
  18613. if (j0 >= 0 && j0 < width) {
  18614. i0 = i + templateY[k];
  18615. if (i0 >= 0) {
  18616. bit = bitmap[i0][j0];
  18617. if (bit) {
  18618. contextLabel |= bit << shift;
  18619. }
  18620. }
  18621. }
  18622. }
  18623. }
  18624. const pixel = decoder.readBit(contexts, contextLabel);
  18625. row[j] = pixel;
  18626. }
  18627. }
  18628. return bitmap;
  18629. }
  18630. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  18631. let codingTemplate = RefinementTemplates[templateIndex].coding;
  18632. if (templateIndex === 0) {
  18633. codingTemplate = codingTemplate.concat([at[0]]);
  18634. }
  18635. const codingTemplateLength = codingTemplate.length;
  18636. const codingTemplateX = new Int32Array(codingTemplateLength);
  18637. const codingTemplateY = new Int32Array(codingTemplateLength);
  18638. let k;
  18639. for (k = 0; k < codingTemplateLength; k++) {
  18640. codingTemplateX[k] = codingTemplate[k].x;
  18641. codingTemplateY[k] = codingTemplate[k].y;
  18642. }
  18643. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  18644. if (templateIndex === 0) {
  18645. referenceTemplate = referenceTemplate.concat([at[1]]);
  18646. }
  18647. const referenceTemplateLength = referenceTemplate.length;
  18648. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  18649. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  18650. for (k = 0; k < referenceTemplateLength; k++) {
  18651. referenceTemplateX[k] = referenceTemplate[k].x;
  18652. referenceTemplateY[k] = referenceTemplate[k].y;
  18653. }
  18654. const referenceWidth = referenceBitmap[0].length;
  18655. const referenceHeight = referenceBitmap.length;
  18656. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  18657. const bitmap = [];
  18658. const decoder = decodingContext.decoder;
  18659. const contexts = decodingContext.contextCache.getContexts("GR");
  18660. let ltp = 0;
  18661. for (let i = 0; i < height; i++) {
  18662. if (prediction) {
  18663. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18664. ltp ^= sltp;
  18665. if (ltp) {
  18666. throw new Jbig2Error("prediction is not supported");
  18667. }
  18668. }
  18669. const row = new Uint8Array(width);
  18670. bitmap.push(row);
  18671. for (let j = 0; j < width; j++) {
  18672. let i0, j0;
  18673. let contextLabel = 0;
  18674. for (k = 0; k < codingTemplateLength; k++) {
  18675. i0 = i + codingTemplateY[k];
  18676. j0 = j + codingTemplateX[k];
  18677. if (i0 < 0 || j0 < 0 || j0 >= width) {
  18678. contextLabel <<= 1;
  18679. } else {
  18680. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  18681. }
  18682. }
  18683. for (k = 0; k < referenceTemplateLength; k++) {
  18684. i0 = i + referenceTemplateY[k] - offsetY;
  18685. j0 = j + referenceTemplateX[k] - offsetX;
  18686. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  18687. contextLabel <<= 1;
  18688. } else {
  18689. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  18690. }
  18691. }
  18692. const pixel = decoder.readBit(contexts, contextLabel);
  18693. row[j] = pixel;
  18694. }
  18695. }
  18696. return bitmap;
  18697. }
  18698. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  18699. if (huffman && refinement) {
  18700. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  18701. }
  18702. const newSymbols = [];
  18703. let currentHeight = 0;
  18704. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  18705. const decoder = decodingContext.decoder;
  18706. const contextCache = decodingContext.contextCache;
  18707. let tableB1, symbolWidths;
  18708. if (huffman) {
  18709. tableB1 = getStandardTable(1);
  18710. symbolWidths = [];
  18711. symbolCodeLength = Math.max(symbolCodeLength, 1);
  18712. }
  18713. while (newSymbols.length < numberOfNewSymbols) {
  18714. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  18715. currentHeight += deltaHeight;
  18716. let currentWidth = 0,
  18717. totalWidth = 0;
  18718. const firstSymbol = huffman ? symbolWidths.length : 0;
  18719. while (true) {
  18720. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  18721. if (deltaWidth === null) {
  18722. break;
  18723. }
  18724. currentWidth += deltaWidth;
  18725. totalWidth += currentWidth;
  18726. let bitmap;
  18727. if (refinement) {
  18728. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  18729. if (numberOfInstances > 1) {
  18730. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  18731. } else {
  18732. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  18733. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18734. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18735. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  18736. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  18737. }
  18738. newSymbols.push(bitmap);
  18739. } else if (huffman) {
  18740. symbolWidths.push(currentWidth);
  18741. } else {
  18742. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  18743. newSymbols.push(bitmap);
  18744. }
  18745. }
  18746. if (huffman && !refinement) {
  18747. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  18748. huffmanInput.byteAlign();
  18749. let collectiveBitmap;
  18750. if (bitmapSize === 0) {
  18751. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  18752. } else {
  18753. const originalEnd = huffmanInput.end;
  18754. const bitmapEnd = huffmanInput.position + bitmapSize;
  18755. huffmanInput.end = bitmapEnd;
  18756. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  18757. huffmanInput.end = originalEnd;
  18758. huffmanInput.position = bitmapEnd;
  18759. }
  18760. const numberOfSymbolsDecoded = symbolWidths.length;
  18761. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  18762. newSymbols.push(collectiveBitmap);
  18763. } else {
  18764. let i,
  18765. y,
  18766. xMin = 0,
  18767. xMax,
  18768. bitmapWidth,
  18769. symbolBitmap;
  18770. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  18771. bitmapWidth = symbolWidths[i];
  18772. xMax = xMin + bitmapWidth;
  18773. symbolBitmap = [];
  18774. for (y = 0; y < currentHeight; y++) {
  18775. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18776. }
  18777. newSymbols.push(symbolBitmap);
  18778. xMin = xMax;
  18779. }
  18780. }
  18781. }
  18782. }
  18783. const exportedSymbols = [],
  18784. flags = [];
  18785. let currentFlag = false,
  18786. i,
  18787. ii;
  18788. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  18789. while (flags.length < totalSymbolsLength) {
  18790. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  18791. while (runLength--) {
  18792. flags.push(currentFlag);
  18793. }
  18794. currentFlag = !currentFlag;
  18795. }
  18796. for (i = 0, ii = symbols.length; i < ii; i++) {
  18797. if (flags[i]) {
  18798. exportedSymbols.push(symbols[i]);
  18799. }
  18800. }
  18801. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  18802. if (flags[i]) {
  18803. exportedSymbols.push(newSymbols[j]);
  18804. }
  18805. }
  18806. return exportedSymbols;
  18807. }
  18808. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  18809. if (huffman && refinement) {
  18810. throw new Jbig2Error("refinement with Huffman is not supported");
  18811. }
  18812. const bitmap = [];
  18813. let i, row;
  18814. for (i = 0; i < height; i++) {
  18815. row = new Uint8Array(width);
  18816. if (defaultPixelValue) {
  18817. for (let j = 0; j < width; j++) {
  18818. row[j] = defaultPixelValue;
  18819. }
  18820. }
  18821. bitmap.push(row);
  18822. }
  18823. const decoder = decodingContext.decoder;
  18824. const contextCache = decodingContext.contextCache;
  18825. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  18826. let firstS = 0;
  18827. i = 0;
  18828. while (i < numberOfSymbolInstances) {
  18829. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  18830. stripT += deltaT;
  18831. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  18832. firstS += deltaFirstS;
  18833. let currentS = firstS;
  18834. do {
  18835. let currentT = 0;
  18836. if (stripSize > 1) {
  18837. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  18838. }
  18839. const t = stripSize * stripT + currentT;
  18840. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  18841. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  18842. let symbolBitmap = inputSymbols[symbolId];
  18843. let symbolWidth = symbolBitmap[0].length;
  18844. let symbolHeight = symbolBitmap.length;
  18845. if (applyRefinement) {
  18846. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  18847. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  18848. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18849. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18850. symbolWidth += rdw;
  18851. symbolHeight += rdh;
  18852. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  18853. }
  18854. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  18855. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  18856. let s2, t2, symbolRow;
  18857. if (transposed) {
  18858. for (s2 = 0; s2 < symbolHeight; s2++) {
  18859. row = bitmap[offsetS + s2];
  18860. if (!row) {
  18861. continue;
  18862. }
  18863. symbolRow = symbolBitmap[s2];
  18864. const maxWidth = Math.min(width - offsetT, symbolWidth);
  18865. switch (combinationOperator) {
  18866. case 0:
  18867. for (t2 = 0; t2 < maxWidth; t2++) {
  18868. row[offsetT + t2] |= symbolRow[t2];
  18869. }
  18870. break;
  18871. case 2:
  18872. for (t2 = 0; t2 < maxWidth; t2++) {
  18873. row[offsetT + t2] ^= symbolRow[t2];
  18874. }
  18875. break;
  18876. default:
  18877. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18878. }
  18879. }
  18880. currentS += symbolHeight - 1;
  18881. } else {
  18882. for (t2 = 0; t2 < symbolHeight; t2++) {
  18883. row = bitmap[offsetT + t2];
  18884. if (!row) {
  18885. continue;
  18886. }
  18887. symbolRow = symbolBitmap[t2];
  18888. switch (combinationOperator) {
  18889. case 0:
  18890. for (s2 = 0; s2 < symbolWidth; s2++) {
  18891. row[offsetS + s2] |= symbolRow[s2];
  18892. }
  18893. break;
  18894. case 2:
  18895. for (s2 = 0; s2 < symbolWidth; s2++) {
  18896. row[offsetS + s2] ^= symbolRow[s2];
  18897. }
  18898. break;
  18899. default:
  18900. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18901. }
  18902. }
  18903. currentS += symbolWidth - 1;
  18904. }
  18905. i++;
  18906. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  18907. if (deltaS === null) {
  18908. break;
  18909. }
  18910. currentS += deltaS + dsOffset;
  18911. } while (true);
  18912. }
  18913. return bitmap;
  18914. }
  18915. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  18916. const at = [];
  18917. if (!mmr) {
  18918. at.push({
  18919. x: -patternWidth,
  18920. y: 0
  18921. });
  18922. if (template === 0) {
  18923. at.push({
  18924. x: -3,
  18925. y: -1
  18926. }, {
  18927. x: 2,
  18928. y: -2
  18929. }, {
  18930. x: -2,
  18931. y: -2
  18932. });
  18933. }
  18934. }
  18935. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  18936. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  18937. const patterns = [];
  18938. for (let i = 0; i <= maxPatternIndex; i++) {
  18939. const patternBitmap = [];
  18940. const xMin = patternWidth * i;
  18941. const xMax = xMin + patternWidth;
  18942. for (let y = 0; y < patternHeight; y++) {
  18943. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18944. }
  18945. patterns.push(patternBitmap);
  18946. }
  18947. return patterns;
  18948. }
  18949. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  18950. const skip = null;
  18951. if (enableSkip) {
  18952. throw new Jbig2Error("skip is not supported");
  18953. }
  18954. if (combinationOperator !== 0) {
  18955. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  18956. }
  18957. const regionBitmap = [];
  18958. let i, j, row;
  18959. for (i = 0; i < regionHeight; i++) {
  18960. row = new Uint8Array(regionWidth);
  18961. if (defaultPixelValue) {
  18962. for (j = 0; j < regionWidth; j++) {
  18963. row[j] = defaultPixelValue;
  18964. }
  18965. }
  18966. regionBitmap.push(row);
  18967. }
  18968. const numberOfPatterns = patterns.length;
  18969. const pattern0 = patterns[0];
  18970. const patternWidth = pattern0[0].length,
  18971. patternHeight = pattern0.length;
  18972. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  18973. const at = [];
  18974. if (!mmr) {
  18975. at.push({
  18976. x: template <= 1 ? 3 : 2,
  18977. y: -1
  18978. });
  18979. if (template === 0) {
  18980. at.push({
  18981. x: -3,
  18982. y: -1
  18983. }, {
  18984. x: 2,
  18985. y: -2
  18986. }, {
  18987. x: -2,
  18988. y: -2
  18989. });
  18990. }
  18991. }
  18992. const grayScaleBitPlanes = [];
  18993. let mmrInput, bitmap;
  18994. if (mmr) {
  18995. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  18996. }
  18997. for (i = bitsPerValue - 1; i >= 0; i--) {
  18998. if (mmr) {
  18999. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  19000. } else {
  19001. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  19002. }
  19003. grayScaleBitPlanes[i] = bitmap;
  19004. }
  19005. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  19006. for (mg = 0; mg < gridHeight; mg++) {
  19007. for (ng = 0; ng < gridWidth; ng++) {
  19008. bit = 0;
  19009. patternIndex = 0;
  19010. for (j = bitsPerValue - 1; j >= 0; j--) {
  19011. bit ^= grayScaleBitPlanes[j][mg][ng];
  19012. patternIndex |= bit << j;
  19013. }
  19014. patternBitmap = patterns[patternIndex];
  19015. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  19016. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  19017. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  19018. for (i = 0; i < patternHeight; i++) {
  19019. regionRow = regionBitmap[y + i];
  19020. patternRow = patternBitmap[i];
  19021. for (j = 0; j < patternWidth; j++) {
  19022. regionRow[x + j] |= patternRow[j];
  19023. }
  19024. }
  19025. } else {
  19026. let regionX, regionY;
  19027. for (i = 0; i < patternHeight; i++) {
  19028. regionY = y + i;
  19029. if (regionY < 0 || regionY >= regionHeight) {
  19030. continue;
  19031. }
  19032. regionRow = regionBitmap[regionY];
  19033. patternRow = patternBitmap[i];
  19034. for (j = 0; j < patternWidth; j++) {
  19035. regionX = x + j;
  19036. if (regionX >= 0 && regionX < regionWidth) {
  19037. regionRow[regionX] |= patternRow[j];
  19038. }
  19039. }
  19040. }
  19041. }
  19042. }
  19043. }
  19044. return regionBitmap;
  19045. }
  19046. function readSegmentHeader(data, start) {
  19047. const segmentHeader = {};
  19048. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  19049. const flags = data[start + 4];
  19050. const segmentType = flags & 0x3f;
  19051. if (!SegmentTypes[segmentType]) {
  19052. throw new Jbig2Error("invalid segment type: " + segmentType);
  19053. }
  19054. segmentHeader.type = segmentType;
  19055. segmentHeader.typeName = SegmentTypes[segmentType];
  19056. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  19057. const pageAssociationFieldSize = !!(flags & 0x40);
  19058. const referredFlags = data[start + 5];
  19059. let referredToCount = referredFlags >> 5 & 7;
  19060. const retainBits = [referredFlags & 31];
  19061. let position = start + 6;
  19062. if (referredFlags === 7) {
  19063. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  19064. position += 3;
  19065. let bytes = referredToCount + 7 >> 3;
  19066. retainBits[0] = data[position++];
  19067. while (--bytes > 0) {
  19068. retainBits.push(data[position++]);
  19069. }
  19070. } else if (referredFlags === 5 || referredFlags === 6) {
  19071. throw new Jbig2Error("invalid referred-to flags");
  19072. }
  19073. segmentHeader.retainBits = retainBits;
  19074. let referredToSegmentNumberSize = 4;
  19075. if (segmentHeader.number <= 256) {
  19076. referredToSegmentNumberSize = 1;
  19077. } else if (segmentHeader.number <= 65536) {
  19078. referredToSegmentNumberSize = 2;
  19079. }
  19080. const referredTo = [];
  19081. let i, ii;
  19082. for (i = 0; i < referredToCount; i++) {
  19083. let number;
  19084. if (referredToSegmentNumberSize === 1) {
  19085. number = data[position];
  19086. } else if (referredToSegmentNumberSize === 2) {
  19087. number = (0, _core_utils.readUint16)(data, position);
  19088. } else {
  19089. number = (0, _core_utils.readUint32)(data, position);
  19090. }
  19091. referredTo.push(number);
  19092. position += referredToSegmentNumberSize;
  19093. }
  19094. segmentHeader.referredTo = referredTo;
  19095. if (!pageAssociationFieldSize) {
  19096. segmentHeader.pageAssociation = data[position++];
  19097. } else {
  19098. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  19099. position += 4;
  19100. }
  19101. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  19102. position += 4;
  19103. if (segmentHeader.length === 0xffffffff) {
  19104. if (segmentType === 38) {
  19105. const genericRegionInfo = readRegionSegmentInformation(data, position);
  19106. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  19107. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  19108. const searchPatternLength = 6;
  19109. const searchPattern = new Uint8Array(searchPatternLength);
  19110. if (!genericRegionMmr) {
  19111. searchPattern[0] = 0xff;
  19112. searchPattern[1] = 0xac;
  19113. }
  19114. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  19115. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  19116. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  19117. searchPattern[5] = genericRegionInfo.height & 0xff;
  19118. for (i = position, ii = data.length; i < ii; i++) {
  19119. let j = 0;
  19120. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  19121. j++;
  19122. }
  19123. if (j === searchPatternLength) {
  19124. segmentHeader.length = i + searchPatternLength;
  19125. break;
  19126. }
  19127. }
  19128. if (segmentHeader.length === 0xffffffff) {
  19129. throw new Jbig2Error("segment end was not found");
  19130. }
  19131. } else {
  19132. throw new Jbig2Error("invalid unknown segment length");
  19133. }
  19134. }
  19135. segmentHeader.headerEnd = position;
  19136. return segmentHeader;
  19137. }
  19138. function readSegments(header, data, start, end) {
  19139. const segments = [];
  19140. let position = start;
  19141. while (position < end) {
  19142. const segmentHeader = readSegmentHeader(data, position);
  19143. position = segmentHeader.headerEnd;
  19144. const segment = {
  19145. header: segmentHeader,
  19146. data
  19147. };
  19148. if (!header.randomAccess) {
  19149. segment.start = position;
  19150. position += segmentHeader.length;
  19151. segment.end = position;
  19152. }
  19153. segments.push(segment);
  19154. if (segmentHeader.type === 51) {
  19155. break;
  19156. }
  19157. }
  19158. if (header.randomAccess) {
  19159. for (let i = 0, ii = segments.length; i < ii; i++) {
  19160. segments[i].start = position;
  19161. position += segments[i].header.length;
  19162. segments[i].end = position;
  19163. }
  19164. }
  19165. return segments;
  19166. }
  19167. function readRegionSegmentInformation(data, start) {
  19168. return {
  19169. width: (0, _core_utils.readUint32)(data, start),
  19170. height: (0, _core_utils.readUint32)(data, start + 4),
  19171. x: (0, _core_utils.readUint32)(data, start + 8),
  19172. y: (0, _core_utils.readUint32)(data, start + 12),
  19173. combinationOperator: data[start + 16] & 7
  19174. };
  19175. }
  19176. const RegionSegmentInformationFieldLength = 17;
  19177. function processSegment(segment, visitor) {
  19178. const header = segment.header;
  19179. const data = segment.data,
  19180. end = segment.end;
  19181. let position = segment.start;
  19182. let args, at, i, atLength;
  19183. switch (header.type) {
  19184. case 0:
  19185. const dictionary = {};
  19186. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  19187. dictionary.huffman = !!(dictionaryFlags & 1);
  19188. dictionary.refinement = !!(dictionaryFlags & 2);
  19189. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  19190. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  19191. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  19192. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  19193. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  19194. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  19195. dictionary.template = dictionaryFlags >> 10 & 3;
  19196. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  19197. position += 2;
  19198. if (!dictionary.huffman) {
  19199. atLength = dictionary.template === 0 ? 4 : 1;
  19200. at = [];
  19201. for (i = 0; i < atLength; i++) {
  19202. at.push({
  19203. x: (0, _core_utils.readInt8)(data, position),
  19204. y: (0, _core_utils.readInt8)(data, position + 1)
  19205. });
  19206. position += 2;
  19207. }
  19208. dictionary.at = at;
  19209. }
  19210. if (dictionary.refinement && !dictionary.refinementTemplate) {
  19211. at = [];
  19212. for (i = 0; i < 2; i++) {
  19213. at.push({
  19214. x: (0, _core_utils.readInt8)(data, position),
  19215. y: (0, _core_utils.readInt8)(data, position + 1)
  19216. });
  19217. position += 2;
  19218. }
  19219. dictionary.refinementAt = at;
  19220. }
  19221. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  19222. position += 4;
  19223. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  19224. position += 4;
  19225. args = [dictionary, header.number, header.referredTo, data, position, end];
  19226. break;
  19227. case 6:
  19228. case 7:
  19229. const textRegion = {};
  19230. textRegion.info = readRegionSegmentInformation(data, position);
  19231. position += RegionSegmentInformationFieldLength;
  19232. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  19233. position += 2;
  19234. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  19235. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  19236. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  19237. textRegion.stripSize = 1 << textRegion.logStripSize;
  19238. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  19239. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  19240. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  19241. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  19242. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  19243. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  19244. if (textRegion.huffman) {
  19245. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  19246. position += 2;
  19247. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  19248. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  19249. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  19250. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  19251. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  19252. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  19253. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  19254. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  19255. }
  19256. if (textRegion.refinement && !textRegion.refinementTemplate) {
  19257. at = [];
  19258. for (i = 0; i < 2; i++) {
  19259. at.push({
  19260. x: (0, _core_utils.readInt8)(data, position),
  19261. y: (0, _core_utils.readInt8)(data, position + 1)
  19262. });
  19263. position += 2;
  19264. }
  19265. textRegion.refinementAt = at;
  19266. }
  19267. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  19268. position += 4;
  19269. args = [textRegion, header.referredTo, data, position, end];
  19270. break;
  19271. case 16:
  19272. const patternDictionary = {};
  19273. const patternDictionaryFlags = data[position++];
  19274. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  19275. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  19276. patternDictionary.patternWidth = data[position++];
  19277. patternDictionary.patternHeight = data[position++];
  19278. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  19279. position += 4;
  19280. args = [patternDictionary, header.number, data, position, end];
  19281. break;
  19282. case 22:
  19283. case 23:
  19284. const halftoneRegion = {};
  19285. halftoneRegion.info = readRegionSegmentInformation(data, position);
  19286. position += RegionSegmentInformationFieldLength;
  19287. const halftoneRegionFlags = data[position++];
  19288. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  19289. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  19290. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  19291. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  19292. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  19293. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  19294. position += 4;
  19295. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  19296. position += 4;
  19297. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  19298. position += 4;
  19299. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  19300. position += 4;
  19301. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  19302. position += 2;
  19303. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  19304. position += 2;
  19305. args = [halftoneRegion, header.referredTo, data, position, end];
  19306. break;
  19307. case 38:
  19308. case 39:
  19309. const genericRegion = {};
  19310. genericRegion.info = readRegionSegmentInformation(data, position);
  19311. position += RegionSegmentInformationFieldLength;
  19312. const genericRegionSegmentFlags = data[position++];
  19313. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  19314. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  19315. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  19316. if (!genericRegion.mmr) {
  19317. atLength = genericRegion.template === 0 ? 4 : 1;
  19318. at = [];
  19319. for (i = 0; i < atLength; i++) {
  19320. at.push({
  19321. x: (0, _core_utils.readInt8)(data, position),
  19322. y: (0, _core_utils.readInt8)(data, position + 1)
  19323. });
  19324. position += 2;
  19325. }
  19326. genericRegion.at = at;
  19327. }
  19328. args = [genericRegion, data, position, end];
  19329. break;
  19330. case 48:
  19331. const pageInfo = {
  19332. width: (0, _core_utils.readUint32)(data, position),
  19333. height: (0, _core_utils.readUint32)(data, position + 4),
  19334. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  19335. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  19336. };
  19337. if (pageInfo.height === 0xffffffff) {
  19338. delete pageInfo.height;
  19339. }
  19340. const pageSegmentFlags = data[position + 16];
  19341. (0, _core_utils.readUint16)(data, position + 17);
  19342. pageInfo.lossless = !!(pageSegmentFlags & 1);
  19343. pageInfo.refinement = !!(pageSegmentFlags & 2);
  19344. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  19345. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  19346. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  19347. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  19348. args = [pageInfo];
  19349. break;
  19350. case 49:
  19351. break;
  19352. case 50:
  19353. break;
  19354. case 51:
  19355. break;
  19356. case 53:
  19357. args = [header.number, data, position, end];
  19358. break;
  19359. case 62:
  19360. break;
  19361. default:
  19362. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  19363. }
  19364. const callbackName = "on" + header.typeName;
  19365. if (callbackName in visitor) {
  19366. visitor[callbackName].apply(visitor, args);
  19367. }
  19368. }
  19369. function processSegments(segments, visitor) {
  19370. for (let i = 0, ii = segments.length; i < ii; i++) {
  19371. processSegment(segments[i], visitor);
  19372. }
  19373. }
  19374. function parseJbig2Chunks(chunks) {
  19375. const visitor = new SimpleSegmentVisitor();
  19376. for (let i = 0, ii = chunks.length; i < ii; i++) {
  19377. const chunk = chunks[i];
  19378. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  19379. processSegments(segments, visitor);
  19380. }
  19381. return visitor.buffer;
  19382. }
  19383. function parseJbig2(data) {
  19384. throw new Error("Not implemented: parseJbig2");
  19385. }
  19386. class SimpleSegmentVisitor {
  19387. onPageInformation(info) {
  19388. this.currentPageInfo = info;
  19389. const rowSize = info.width + 7 >> 3;
  19390. const buffer = new Uint8ClampedArray(rowSize * info.height);
  19391. if (info.defaultPixelValue) {
  19392. buffer.fill(0xff);
  19393. }
  19394. this.buffer = buffer;
  19395. }
  19396. drawBitmap(regionInfo, bitmap) {
  19397. const pageInfo = this.currentPageInfo;
  19398. const width = regionInfo.width,
  19399. height = regionInfo.height;
  19400. const rowSize = pageInfo.width + 7 >> 3;
  19401. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  19402. const buffer = this.buffer;
  19403. const mask0 = 128 >> (regionInfo.x & 7);
  19404. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  19405. let i, j, mask, offset;
  19406. switch (combinationOperator) {
  19407. case 0:
  19408. for (i = 0; i < height; i++) {
  19409. mask = mask0;
  19410. offset = offset0;
  19411. for (j = 0; j < width; j++) {
  19412. if (bitmap[i][j]) {
  19413. buffer[offset] |= mask;
  19414. }
  19415. mask >>= 1;
  19416. if (!mask) {
  19417. mask = 128;
  19418. offset++;
  19419. }
  19420. }
  19421. offset0 += rowSize;
  19422. }
  19423. break;
  19424. case 2:
  19425. for (i = 0; i < height; i++) {
  19426. mask = mask0;
  19427. offset = offset0;
  19428. for (j = 0; j < width; j++) {
  19429. if (bitmap[i][j]) {
  19430. buffer[offset] ^= mask;
  19431. }
  19432. mask >>= 1;
  19433. if (!mask) {
  19434. mask = 128;
  19435. offset++;
  19436. }
  19437. }
  19438. offset0 += rowSize;
  19439. }
  19440. break;
  19441. default:
  19442. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  19443. }
  19444. }
  19445. onImmediateGenericRegion(region, data, start, end) {
  19446. const regionInfo = region.info;
  19447. const decodingContext = new DecodingContext(data, start, end);
  19448. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  19449. this.drawBitmap(regionInfo, bitmap);
  19450. }
  19451. onImmediateLosslessGenericRegion() {
  19452. this.onImmediateGenericRegion(...arguments);
  19453. }
  19454. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  19455. let huffmanTables, huffmanInput;
  19456. if (dictionary.huffman) {
  19457. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  19458. huffmanInput = new Reader(data, start, end);
  19459. }
  19460. let symbols = this.symbols;
  19461. if (!symbols) {
  19462. this.symbols = symbols = {};
  19463. }
  19464. const inputSymbols = [];
  19465. for (const referredSegment of referredSegments) {
  19466. const referredSymbols = symbols[referredSegment];
  19467. if (referredSymbols) {
  19468. inputSymbols.push(...referredSymbols);
  19469. }
  19470. }
  19471. const decodingContext = new DecodingContext(data, start, end);
  19472. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  19473. }
  19474. onImmediateTextRegion(region, referredSegments, data, start, end) {
  19475. const regionInfo = region.info;
  19476. let huffmanTables, huffmanInput;
  19477. const symbols = this.symbols;
  19478. const inputSymbols = [];
  19479. for (const referredSegment of referredSegments) {
  19480. const referredSymbols = symbols[referredSegment];
  19481. if (referredSymbols) {
  19482. inputSymbols.push(...referredSymbols);
  19483. }
  19484. }
  19485. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  19486. if (region.huffman) {
  19487. huffmanInput = new Reader(data, start, end);
  19488. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  19489. }
  19490. const decodingContext = new DecodingContext(data, start, end);
  19491. 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);
  19492. this.drawBitmap(regionInfo, bitmap);
  19493. }
  19494. onImmediateLosslessTextRegion() {
  19495. this.onImmediateTextRegion(...arguments);
  19496. }
  19497. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  19498. let patterns = this.patterns;
  19499. if (!patterns) {
  19500. this.patterns = patterns = {};
  19501. }
  19502. const decodingContext = new DecodingContext(data, start, end);
  19503. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  19504. }
  19505. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  19506. const patterns = this.patterns[referredSegments[0]];
  19507. const regionInfo = region.info;
  19508. const decodingContext = new DecodingContext(data, start, end);
  19509. 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);
  19510. this.drawBitmap(regionInfo, bitmap);
  19511. }
  19512. onImmediateLosslessHalftoneRegion() {
  19513. this.onImmediateHalftoneRegion(...arguments);
  19514. }
  19515. onTables(currentSegment, data, start, end) {
  19516. let customTables = this.customTables;
  19517. if (!customTables) {
  19518. this.customTables = customTables = {};
  19519. }
  19520. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  19521. }
  19522. }
  19523. class HuffmanLine {
  19524. constructor(lineData) {
  19525. if (lineData.length === 2) {
  19526. this.isOOB = true;
  19527. this.rangeLow = 0;
  19528. this.prefixLength = lineData[0];
  19529. this.rangeLength = 0;
  19530. this.prefixCode = lineData[1];
  19531. this.isLowerRange = false;
  19532. } else {
  19533. this.isOOB = false;
  19534. this.rangeLow = lineData[0];
  19535. this.prefixLength = lineData[1];
  19536. this.rangeLength = lineData[2];
  19537. this.prefixCode = lineData[3];
  19538. this.isLowerRange = lineData[4] === "lower";
  19539. }
  19540. }
  19541. }
  19542. class HuffmanTreeNode {
  19543. constructor(line) {
  19544. this.children = [];
  19545. if (line) {
  19546. this.isLeaf = true;
  19547. this.rangeLength = line.rangeLength;
  19548. this.rangeLow = line.rangeLow;
  19549. this.isLowerRange = line.isLowerRange;
  19550. this.isOOB = line.isOOB;
  19551. } else {
  19552. this.isLeaf = false;
  19553. }
  19554. }
  19555. buildTree(line, shift) {
  19556. const bit = line.prefixCode >> shift & 1;
  19557. if (shift <= 0) {
  19558. this.children[bit] = new HuffmanTreeNode(line);
  19559. } else {
  19560. let node = this.children[bit];
  19561. if (!node) {
  19562. this.children[bit] = node = new HuffmanTreeNode(null);
  19563. }
  19564. node.buildTree(line, shift - 1);
  19565. }
  19566. }
  19567. decodeNode(reader) {
  19568. if (this.isLeaf) {
  19569. if (this.isOOB) {
  19570. return null;
  19571. }
  19572. const htOffset = reader.readBits(this.rangeLength);
  19573. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  19574. }
  19575. const node = this.children[reader.readBit()];
  19576. if (!node) {
  19577. throw new Jbig2Error("invalid Huffman data");
  19578. }
  19579. return node.decodeNode(reader);
  19580. }
  19581. }
  19582. class HuffmanTable {
  19583. constructor(lines, prefixCodesDone) {
  19584. if (!prefixCodesDone) {
  19585. this.assignPrefixCodes(lines);
  19586. }
  19587. this.rootNode = new HuffmanTreeNode(null);
  19588. for (let i = 0, ii = lines.length; i < ii; i++) {
  19589. const line = lines[i];
  19590. if (line.prefixLength > 0) {
  19591. this.rootNode.buildTree(line, line.prefixLength - 1);
  19592. }
  19593. }
  19594. }
  19595. decode(reader) {
  19596. return this.rootNode.decodeNode(reader);
  19597. }
  19598. assignPrefixCodes(lines) {
  19599. const linesLength = lines.length;
  19600. let prefixLengthMax = 0;
  19601. for (let i = 0; i < linesLength; i++) {
  19602. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  19603. }
  19604. const histogram = new Uint32Array(prefixLengthMax + 1);
  19605. for (let i = 0; i < linesLength; i++) {
  19606. histogram[lines[i].prefixLength]++;
  19607. }
  19608. let currentLength = 1,
  19609. firstCode = 0,
  19610. currentCode,
  19611. currentTemp,
  19612. line;
  19613. histogram[0] = 0;
  19614. while (currentLength <= prefixLengthMax) {
  19615. firstCode = firstCode + histogram[currentLength - 1] << 1;
  19616. currentCode = firstCode;
  19617. currentTemp = 0;
  19618. while (currentTemp < linesLength) {
  19619. line = lines[currentTemp];
  19620. if (line.prefixLength === currentLength) {
  19621. line.prefixCode = currentCode;
  19622. currentCode++;
  19623. }
  19624. currentTemp++;
  19625. }
  19626. currentLength++;
  19627. }
  19628. }
  19629. }
  19630. function decodeTablesSegment(data, start, end) {
  19631. const flags = data[start];
  19632. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  19633. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  19634. const reader = new Reader(data, start + 9, end);
  19635. const prefixSizeBits = (flags >> 1 & 7) + 1;
  19636. const rangeSizeBits = (flags >> 4 & 7) + 1;
  19637. const lines = [];
  19638. let prefixLength,
  19639. rangeLength,
  19640. currentRangeLow = lowestValue;
  19641. do {
  19642. prefixLength = reader.readBits(prefixSizeBits);
  19643. rangeLength = reader.readBits(rangeSizeBits);
  19644. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  19645. currentRangeLow += 1 << rangeLength;
  19646. } while (currentRangeLow < highestValue);
  19647. prefixLength = reader.readBits(prefixSizeBits);
  19648. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  19649. prefixLength = reader.readBits(prefixSizeBits);
  19650. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  19651. if (flags & 1) {
  19652. prefixLength = reader.readBits(prefixSizeBits);
  19653. lines.push(new HuffmanLine([prefixLength, 0]));
  19654. }
  19655. return new HuffmanTable(lines, false);
  19656. }
  19657. const standardTablesCache = {};
  19658. function getStandardTable(number) {
  19659. let table = standardTablesCache[number];
  19660. if (table) {
  19661. return table;
  19662. }
  19663. let lines;
  19664. switch (number) {
  19665. case 1:
  19666. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  19667. break;
  19668. case 2:
  19669. 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]];
  19670. break;
  19671. case 3:
  19672. 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]];
  19673. break;
  19674. case 4:
  19675. 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]];
  19676. break;
  19677. case 5:
  19678. 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]];
  19679. break;
  19680. case 6:
  19681. 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]];
  19682. break;
  19683. case 7:
  19684. 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]];
  19685. break;
  19686. case 8:
  19687. 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]];
  19688. break;
  19689. case 9:
  19690. 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]];
  19691. break;
  19692. case 10:
  19693. 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]];
  19694. break;
  19695. case 11:
  19696. 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]];
  19697. break;
  19698. case 12:
  19699. 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]];
  19700. break;
  19701. case 13:
  19702. 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]];
  19703. break;
  19704. case 14:
  19705. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  19706. break;
  19707. case 15:
  19708. 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]];
  19709. break;
  19710. default:
  19711. throw new Jbig2Error(`standard table B.${number} does not exist`);
  19712. }
  19713. for (let i = 0, ii = lines.length; i < ii; i++) {
  19714. lines[i] = new HuffmanLine(lines[i]);
  19715. }
  19716. table = new HuffmanTable(lines, true);
  19717. standardTablesCache[number] = table;
  19718. return table;
  19719. }
  19720. class Reader {
  19721. constructor(data, start, end) {
  19722. this.data = data;
  19723. this.start = start;
  19724. this.end = end;
  19725. this.position = start;
  19726. this.shift = -1;
  19727. this.currentByte = 0;
  19728. }
  19729. readBit() {
  19730. if (this.shift < 0) {
  19731. if (this.position >= this.end) {
  19732. throw new Jbig2Error("end of data while reading bit");
  19733. }
  19734. this.currentByte = this.data[this.position++];
  19735. this.shift = 7;
  19736. }
  19737. const bit = this.currentByte >> this.shift & 1;
  19738. this.shift--;
  19739. return bit;
  19740. }
  19741. readBits(numBits) {
  19742. let result = 0,
  19743. i;
  19744. for (i = numBits - 1; i >= 0; i--) {
  19745. result |= this.readBit() << i;
  19746. }
  19747. return result;
  19748. }
  19749. byteAlign() {
  19750. this.shift = -1;
  19751. }
  19752. next() {
  19753. if (this.position >= this.end) {
  19754. return -1;
  19755. }
  19756. return this.data[this.position++];
  19757. }
  19758. }
  19759. function getCustomHuffmanTable(index, referredTo, customTables) {
  19760. let currentIndex = 0;
  19761. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  19762. const table = customTables[referredTo[i]];
  19763. if (table) {
  19764. if (index === currentIndex) {
  19765. return table;
  19766. }
  19767. currentIndex++;
  19768. }
  19769. }
  19770. throw new Jbig2Error("can't find custom Huffman table");
  19771. }
  19772. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  19773. const codes = [];
  19774. for (let i = 0; i <= 34; i++) {
  19775. const codeLength = reader.readBits(4);
  19776. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19777. }
  19778. const runCodesTable = new HuffmanTable(codes, false);
  19779. codes.length = 0;
  19780. for (let i = 0; i < numberOfSymbols;) {
  19781. const codeLength = runCodesTable.decode(reader);
  19782. if (codeLength >= 32) {
  19783. let repeatedLength, numberOfRepeats, j;
  19784. switch (codeLength) {
  19785. case 32:
  19786. if (i === 0) {
  19787. throw new Jbig2Error("no previous value in symbol ID table");
  19788. }
  19789. numberOfRepeats = reader.readBits(2) + 3;
  19790. repeatedLength = codes[i - 1].prefixLength;
  19791. break;
  19792. case 33:
  19793. numberOfRepeats = reader.readBits(3) + 3;
  19794. repeatedLength = 0;
  19795. break;
  19796. case 34:
  19797. numberOfRepeats = reader.readBits(7) + 11;
  19798. repeatedLength = 0;
  19799. break;
  19800. default:
  19801. throw new Jbig2Error("invalid code length in symbol ID table");
  19802. }
  19803. for (j = 0; j < numberOfRepeats; j++) {
  19804. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  19805. i++;
  19806. }
  19807. } else {
  19808. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19809. i++;
  19810. }
  19811. }
  19812. reader.byteAlign();
  19813. const symbolIDTable = new HuffmanTable(codes, false);
  19814. let customIndex = 0,
  19815. tableFirstS,
  19816. tableDeltaS,
  19817. tableDeltaT;
  19818. switch (textRegion.huffmanFS) {
  19819. case 0:
  19820. case 1:
  19821. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  19822. break;
  19823. case 3:
  19824. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19825. customIndex++;
  19826. break;
  19827. default:
  19828. throw new Jbig2Error("invalid Huffman FS selector");
  19829. }
  19830. switch (textRegion.huffmanDS) {
  19831. case 0:
  19832. case 1:
  19833. case 2:
  19834. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  19835. break;
  19836. case 3:
  19837. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19838. customIndex++;
  19839. break;
  19840. default:
  19841. throw new Jbig2Error("invalid Huffman DS selector");
  19842. }
  19843. switch (textRegion.huffmanDT) {
  19844. case 0:
  19845. case 1:
  19846. case 2:
  19847. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  19848. break;
  19849. case 3:
  19850. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19851. customIndex++;
  19852. break;
  19853. default:
  19854. throw new Jbig2Error("invalid Huffman DT selector");
  19855. }
  19856. if (textRegion.refinement) {
  19857. throw new Jbig2Error("refinement with Huffman is not supported");
  19858. }
  19859. return {
  19860. symbolIDTable,
  19861. tableFirstS,
  19862. tableDeltaS,
  19863. tableDeltaT
  19864. };
  19865. }
  19866. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  19867. let customIndex = 0,
  19868. tableDeltaHeight,
  19869. tableDeltaWidth;
  19870. switch (dictionary.huffmanDHSelector) {
  19871. case 0:
  19872. case 1:
  19873. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  19874. break;
  19875. case 3:
  19876. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19877. customIndex++;
  19878. break;
  19879. default:
  19880. throw new Jbig2Error("invalid Huffman DH selector");
  19881. }
  19882. switch (dictionary.huffmanDWSelector) {
  19883. case 0:
  19884. case 1:
  19885. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  19886. break;
  19887. case 3:
  19888. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19889. customIndex++;
  19890. break;
  19891. default:
  19892. throw new Jbig2Error("invalid Huffman DW selector");
  19893. }
  19894. let tableBitmapSize, tableAggregateInstances;
  19895. if (dictionary.bitmapSizeSelector) {
  19896. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19897. customIndex++;
  19898. } else {
  19899. tableBitmapSize = getStandardTable(1);
  19900. }
  19901. if (dictionary.aggregationInstancesSelector) {
  19902. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19903. } else {
  19904. tableAggregateInstances = getStandardTable(1);
  19905. }
  19906. return {
  19907. tableDeltaHeight,
  19908. tableDeltaWidth,
  19909. tableBitmapSize,
  19910. tableAggregateInstances
  19911. };
  19912. }
  19913. function readUncompressedBitmap(reader, width, height) {
  19914. const bitmap = [];
  19915. for (let y = 0; y < height; y++) {
  19916. const row = new Uint8Array(width);
  19917. bitmap.push(row);
  19918. for (let x = 0; x < width; x++) {
  19919. row[x] = reader.readBit();
  19920. }
  19921. reader.byteAlign();
  19922. }
  19923. return bitmap;
  19924. }
  19925. function decodeMMRBitmap(input, width, height, endOfBlock) {
  19926. const params = {
  19927. K: -1,
  19928. Columns: width,
  19929. Rows: height,
  19930. BlackIs1: true,
  19931. EndOfBlock: endOfBlock
  19932. };
  19933. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  19934. const bitmap = [];
  19935. let currentByte,
  19936. eof = false;
  19937. for (let y = 0; y < height; y++) {
  19938. const row = new Uint8Array(width);
  19939. bitmap.push(row);
  19940. let shift = -1;
  19941. for (let x = 0; x < width; x++) {
  19942. if (shift < 0) {
  19943. currentByte = decoder.readNextChar();
  19944. if (currentByte === -1) {
  19945. currentByte = 0;
  19946. eof = true;
  19947. }
  19948. shift = 7;
  19949. }
  19950. row[x] = currentByte >> shift & 1;
  19951. shift--;
  19952. }
  19953. }
  19954. if (endOfBlock && !eof) {
  19955. const lookForEOFLimit = 5;
  19956. for (let i = 0; i < lookForEOFLimit; i++) {
  19957. if (decoder.readNextChar() === -1) {
  19958. break;
  19959. }
  19960. }
  19961. }
  19962. return bitmap;
  19963. }
  19964. class Jbig2Image {
  19965. parseChunks(chunks) {
  19966. return parseJbig2Chunks(chunks);
  19967. }
  19968. parse(data) {
  19969. throw new Error("Not implemented: Jbig2Image.parse");
  19970. }
  19971. }
  19972. exports.Jbig2Image = Jbig2Image;
  19973. /***/ }),
  19974. /* 155 */
  19975. /***/ ((__unused_webpack_module, exports) => {
  19976. "use strict";
  19977. Object.defineProperty(exports, "__esModule", ({
  19978. value: true
  19979. }));
  19980. exports.ArithmeticDecoder = void 0;
  19981. const QeTable = [{
  19982. qe: 0x5601,
  19983. nmps: 1,
  19984. nlps: 1,
  19985. switchFlag: 1
  19986. }, {
  19987. qe: 0x3401,
  19988. nmps: 2,
  19989. nlps: 6,
  19990. switchFlag: 0
  19991. }, {
  19992. qe: 0x1801,
  19993. nmps: 3,
  19994. nlps: 9,
  19995. switchFlag: 0
  19996. }, {
  19997. qe: 0x0ac1,
  19998. nmps: 4,
  19999. nlps: 12,
  20000. switchFlag: 0
  20001. }, {
  20002. qe: 0x0521,
  20003. nmps: 5,
  20004. nlps: 29,
  20005. switchFlag: 0
  20006. }, {
  20007. qe: 0x0221,
  20008. nmps: 38,
  20009. nlps: 33,
  20010. switchFlag: 0
  20011. }, {
  20012. qe: 0x5601,
  20013. nmps: 7,
  20014. nlps: 6,
  20015. switchFlag: 1
  20016. }, {
  20017. qe: 0x5401,
  20018. nmps: 8,
  20019. nlps: 14,
  20020. switchFlag: 0
  20021. }, {
  20022. qe: 0x4801,
  20023. nmps: 9,
  20024. nlps: 14,
  20025. switchFlag: 0
  20026. }, {
  20027. qe: 0x3801,
  20028. nmps: 10,
  20029. nlps: 14,
  20030. switchFlag: 0
  20031. }, {
  20032. qe: 0x3001,
  20033. nmps: 11,
  20034. nlps: 17,
  20035. switchFlag: 0
  20036. }, {
  20037. qe: 0x2401,
  20038. nmps: 12,
  20039. nlps: 18,
  20040. switchFlag: 0
  20041. }, {
  20042. qe: 0x1c01,
  20043. nmps: 13,
  20044. nlps: 20,
  20045. switchFlag: 0
  20046. }, {
  20047. qe: 0x1601,
  20048. nmps: 29,
  20049. nlps: 21,
  20050. switchFlag: 0
  20051. }, {
  20052. qe: 0x5601,
  20053. nmps: 15,
  20054. nlps: 14,
  20055. switchFlag: 1
  20056. }, {
  20057. qe: 0x5401,
  20058. nmps: 16,
  20059. nlps: 14,
  20060. switchFlag: 0
  20061. }, {
  20062. qe: 0x5101,
  20063. nmps: 17,
  20064. nlps: 15,
  20065. switchFlag: 0
  20066. }, {
  20067. qe: 0x4801,
  20068. nmps: 18,
  20069. nlps: 16,
  20070. switchFlag: 0
  20071. }, {
  20072. qe: 0x3801,
  20073. nmps: 19,
  20074. nlps: 17,
  20075. switchFlag: 0
  20076. }, {
  20077. qe: 0x3401,
  20078. nmps: 20,
  20079. nlps: 18,
  20080. switchFlag: 0
  20081. }, {
  20082. qe: 0x3001,
  20083. nmps: 21,
  20084. nlps: 19,
  20085. switchFlag: 0
  20086. }, {
  20087. qe: 0x2801,
  20088. nmps: 22,
  20089. nlps: 19,
  20090. switchFlag: 0
  20091. }, {
  20092. qe: 0x2401,
  20093. nmps: 23,
  20094. nlps: 20,
  20095. switchFlag: 0
  20096. }, {
  20097. qe: 0x2201,
  20098. nmps: 24,
  20099. nlps: 21,
  20100. switchFlag: 0
  20101. }, {
  20102. qe: 0x1c01,
  20103. nmps: 25,
  20104. nlps: 22,
  20105. switchFlag: 0
  20106. }, {
  20107. qe: 0x1801,
  20108. nmps: 26,
  20109. nlps: 23,
  20110. switchFlag: 0
  20111. }, {
  20112. qe: 0x1601,
  20113. nmps: 27,
  20114. nlps: 24,
  20115. switchFlag: 0
  20116. }, {
  20117. qe: 0x1401,
  20118. nmps: 28,
  20119. nlps: 25,
  20120. switchFlag: 0
  20121. }, {
  20122. qe: 0x1201,
  20123. nmps: 29,
  20124. nlps: 26,
  20125. switchFlag: 0
  20126. }, {
  20127. qe: 0x1101,
  20128. nmps: 30,
  20129. nlps: 27,
  20130. switchFlag: 0
  20131. }, {
  20132. qe: 0x0ac1,
  20133. nmps: 31,
  20134. nlps: 28,
  20135. switchFlag: 0
  20136. }, {
  20137. qe: 0x09c1,
  20138. nmps: 32,
  20139. nlps: 29,
  20140. switchFlag: 0
  20141. }, {
  20142. qe: 0x08a1,
  20143. nmps: 33,
  20144. nlps: 30,
  20145. switchFlag: 0
  20146. }, {
  20147. qe: 0x0521,
  20148. nmps: 34,
  20149. nlps: 31,
  20150. switchFlag: 0
  20151. }, {
  20152. qe: 0x0441,
  20153. nmps: 35,
  20154. nlps: 32,
  20155. switchFlag: 0
  20156. }, {
  20157. qe: 0x02a1,
  20158. nmps: 36,
  20159. nlps: 33,
  20160. switchFlag: 0
  20161. }, {
  20162. qe: 0x0221,
  20163. nmps: 37,
  20164. nlps: 34,
  20165. switchFlag: 0
  20166. }, {
  20167. qe: 0x0141,
  20168. nmps: 38,
  20169. nlps: 35,
  20170. switchFlag: 0
  20171. }, {
  20172. qe: 0x0111,
  20173. nmps: 39,
  20174. nlps: 36,
  20175. switchFlag: 0
  20176. }, {
  20177. qe: 0x0085,
  20178. nmps: 40,
  20179. nlps: 37,
  20180. switchFlag: 0
  20181. }, {
  20182. qe: 0x0049,
  20183. nmps: 41,
  20184. nlps: 38,
  20185. switchFlag: 0
  20186. }, {
  20187. qe: 0x0025,
  20188. nmps: 42,
  20189. nlps: 39,
  20190. switchFlag: 0
  20191. }, {
  20192. qe: 0x0015,
  20193. nmps: 43,
  20194. nlps: 40,
  20195. switchFlag: 0
  20196. }, {
  20197. qe: 0x0009,
  20198. nmps: 44,
  20199. nlps: 41,
  20200. switchFlag: 0
  20201. }, {
  20202. qe: 0x0005,
  20203. nmps: 45,
  20204. nlps: 42,
  20205. switchFlag: 0
  20206. }, {
  20207. qe: 0x0001,
  20208. nmps: 45,
  20209. nlps: 43,
  20210. switchFlag: 0
  20211. }, {
  20212. qe: 0x5601,
  20213. nmps: 46,
  20214. nlps: 46,
  20215. switchFlag: 0
  20216. }];
  20217. class ArithmeticDecoder {
  20218. constructor(data, start, end) {
  20219. this.data = data;
  20220. this.bp = start;
  20221. this.dataEnd = end;
  20222. this.chigh = data[start];
  20223. this.clow = 0;
  20224. this.byteIn();
  20225. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  20226. this.clow = this.clow << 7 & 0xffff;
  20227. this.ct -= 7;
  20228. this.a = 0x8000;
  20229. }
  20230. byteIn() {
  20231. const data = this.data;
  20232. let bp = this.bp;
  20233. if (data[bp] === 0xff) {
  20234. if (data[bp + 1] > 0x8f) {
  20235. this.clow += 0xff00;
  20236. this.ct = 8;
  20237. } else {
  20238. bp++;
  20239. this.clow += data[bp] << 9;
  20240. this.ct = 7;
  20241. this.bp = bp;
  20242. }
  20243. } else {
  20244. bp++;
  20245. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  20246. this.ct = 8;
  20247. this.bp = bp;
  20248. }
  20249. if (this.clow > 0xffff) {
  20250. this.chigh += this.clow >> 16;
  20251. this.clow &= 0xffff;
  20252. }
  20253. }
  20254. readBit(contexts, pos) {
  20255. let cx_index = contexts[pos] >> 1,
  20256. cx_mps = contexts[pos] & 1;
  20257. const qeTableIcx = QeTable[cx_index];
  20258. const qeIcx = qeTableIcx.qe;
  20259. let d;
  20260. let a = this.a - qeIcx;
  20261. if (this.chigh < qeIcx) {
  20262. if (a < qeIcx) {
  20263. a = qeIcx;
  20264. d = cx_mps;
  20265. cx_index = qeTableIcx.nmps;
  20266. } else {
  20267. a = qeIcx;
  20268. d = 1 ^ cx_mps;
  20269. if (qeTableIcx.switchFlag === 1) {
  20270. cx_mps = d;
  20271. }
  20272. cx_index = qeTableIcx.nlps;
  20273. }
  20274. } else {
  20275. this.chigh -= qeIcx;
  20276. if ((a & 0x8000) !== 0) {
  20277. this.a = a;
  20278. return cx_mps;
  20279. }
  20280. if (a < qeIcx) {
  20281. d = 1 ^ cx_mps;
  20282. if (qeTableIcx.switchFlag === 1) {
  20283. cx_mps = d;
  20284. }
  20285. cx_index = qeTableIcx.nlps;
  20286. } else {
  20287. d = cx_mps;
  20288. cx_index = qeTableIcx.nmps;
  20289. }
  20290. }
  20291. do {
  20292. if (this.ct === 0) {
  20293. this.byteIn();
  20294. }
  20295. a <<= 1;
  20296. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  20297. this.clow = this.clow << 1 & 0xffff;
  20298. this.ct--;
  20299. } while ((a & 0x8000) === 0);
  20300. this.a = a;
  20301. contexts[pos] = cx_index << 1 | cx_mps;
  20302. return d;
  20303. }
  20304. }
  20305. exports.ArithmeticDecoder = ArithmeticDecoder;
  20306. /***/ }),
  20307. /* 156 */
  20308. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20309. "use strict";
  20310. Object.defineProperty(exports, "__esModule", ({
  20311. value: true
  20312. }));
  20313. exports.JpegStream = void 0;
  20314. var _decode_stream = __w_pdfjs_require__(148);
  20315. var _primitives = __w_pdfjs_require__(134);
  20316. var _jpg = __w_pdfjs_require__(157);
  20317. var _util = __w_pdfjs_require__(2);
  20318. class JpegStream extends _decode_stream.DecodeStream {
  20319. constructor(stream, maybeLength, params) {
  20320. let ch;
  20321. while ((ch = stream.getByte()) !== -1) {
  20322. if (ch === 0xff) {
  20323. stream.skip(-1);
  20324. break;
  20325. }
  20326. }
  20327. super(maybeLength);
  20328. this.stream = stream;
  20329. this.dict = stream.dict;
  20330. this.maybeLength = maybeLength;
  20331. this.params = params;
  20332. }
  20333. get bytes() {
  20334. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  20335. }
  20336. ensureBuffer(requested) {}
  20337. readBlock() {
  20338. if (this.eof) {
  20339. return;
  20340. }
  20341. const jpegOptions = {
  20342. decodeTransform: undefined,
  20343. colorTransform: undefined
  20344. };
  20345. const decodeArr = this.dict.getArray("D", "Decode");
  20346. if (this.forceRGB && Array.isArray(decodeArr)) {
  20347. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  20348. const decodeArrLength = decodeArr.length;
  20349. const transform = new Int32Array(decodeArrLength);
  20350. let transformNeeded = false;
  20351. const maxValue = (1 << bitsPerComponent) - 1;
  20352. for (let i = 0; i < decodeArrLength; i += 2) {
  20353. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  20354. transform[i + 1] = decodeArr[i] * maxValue | 0;
  20355. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  20356. transformNeeded = true;
  20357. }
  20358. }
  20359. if (transformNeeded) {
  20360. jpegOptions.decodeTransform = transform;
  20361. }
  20362. }
  20363. if (this.params instanceof _primitives.Dict) {
  20364. const colorTransform = this.params.get("ColorTransform");
  20365. if (Number.isInteger(colorTransform)) {
  20366. jpegOptions.colorTransform = colorTransform;
  20367. }
  20368. }
  20369. const jpegImage = new _jpg.JpegImage(jpegOptions);
  20370. jpegImage.parse(this.bytes);
  20371. const data = jpegImage.getData({
  20372. width: this.drawWidth,
  20373. height: this.drawHeight,
  20374. forceRGB: this.forceRGB,
  20375. isSourcePDF: true
  20376. });
  20377. this.buffer = data;
  20378. this.bufferLength = data.length;
  20379. this.eof = true;
  20380. }
  20381. }
  20382. exports.JpegStream = JpegStream;
  20383. /***/ }),
  20384. /* 157 */
  20385. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20386. "use strict";
  20387. Object.defineProperty(exports, "__esModule", ({
  20388. value: true
  20389. }));
  20390. exports.JpegImage = void 0;
  20391. var _util = __w_pdfjs_require__(2);
  20392. var _core_utils = __w_pdfjs_require__(135);
  20393. class JpegError extends _util.BaseException {
  20394. constructor(msg) {
  20395. super(`JPEG error: ${msg}`, "JpegError");
  20396. }
  20397. }
  20398. class DNLMarkerError extends _util.BaseException {
  20399. constructor(message, scanLines) {
  20400. super(message, "DNLMarkerError");
  20401. this.scanLines = scanLines;
  20402. }
  20403. }
  20404. class EOIMarkerError extends _util.BaseException {
  20405. constructor(msg) {
  20406. super(msg, "EOIMarkerError");
  20407. }
  20408. }
  20409. 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]);
  20410. const dctCos1 = 4017;
  20411. const dctSin1 = 799;
  20412. const dctCos3 = 3406;
  20413. const dctSin3 = 2276;
  20414. const dctCos6 = 1567;
  20415. const dctSin6 = 3784;
  20416. const dctSqrt2 = 5793;
  20417. const dctSqrt1d2 = 2896;
  20418. function buildHuffmanTable(codeLengths, values) {
  20419. let k = 0,
  20420. i,
  20421. j,
  20422. length = 16;
  20423. while (length > 0 && !codeLengths[length - 1]) {
  20424. length--;
  20425. }
  20426. const code = [{
  20427. children: [],
  20428. index: 0
  20429. }];
  20430. let p = code[0],
  20431. q;
  20432. for (i = 0; i < length; i++) {
  20433. for (j = 0; j < codeLengths[i]; j++) {
  20434. p = code.pop();
  20435. p.children[p.index] = values[k];
  20436. while (p.index > 0) {
  20437. p = code.pop();
  20438. }
  20439. p.index++;
  20440. code.push(p);
  20441. while (code.length <= i) {
  20442. code.push(q = {
  20443. children: [],
  20444. index: 0
  20445. });
  20446. p.children[p.index] = q.children;
  20447. p = q;
  20448. }
  20449. k++;
  20450. }
  20451. if (i + 1 < length) {
  20452. code.push(q = {
  20453. children: [],
  20454. index: 0
  20455. });
  20456. p.children[p.index] = q.children;
  20457. p = q;
  20458. }
  20459. }
  20460. return code[0].children;
  20461. }
  20462. function getBlockBufferOffset(component, row, col) {
  20463. return 64 * ((component.blocksPerLine + 1) * row + col);
  20464. }
  20465. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  20466. let parseDNLMarker = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
  20467. const mcusPerLine = frame.mcusPerLine;
  20468. const progressive = frame.progressive;
  20469. const startOffset = offset;
  20470. let bitsData = 0,
  20471. bitsCount = 0;
  20472. function readBit() {
  20473. if (bitsCount > 0) {
  20474. bitsCount--;
  20475. return bitsData >> bitsCount & 1;
  20476. }
  20477. bitsData = data[offset++];
  20478. if (bitsData === 0xff) {
  20479. const nextByte = data[offset++];
  20480. if (nextByte) {
  20481. if (nextByte === 0xdc && parseDNLMarker) {
  20482. offset += 2;
  20483. const scanLines = (0, _core_utils.readUint16)(data, offset);
  20484. offset += 2;
  20485. if (scanLines > 0 && scanLines !== frame.scanLines) {
  20486. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  20487. }
  20488. } else if (nextByte === 0xd9) {
  20489. if (parseDNLMarker) {
  20490. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  20491. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  20492. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  20493. }
  20494. }
  20495. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  20496. }
  20497. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  20498. }
  20499. }
  20500. bitsCount = 7;
  20501. return bitsData >>> 7;
  20502. }
  20503. function decodeHuffman(tree) {
  20504. let node = tree;
  20505. while (true) {
  20506. node = node[readBit()];
  20507. switch (typeof node) {
  20508. case "number":
  20509. return node;
  20510. case "object":
  20511. continue;
  20512. }
  20513. throw new JpegError("invalid huffman sequence");
  20514. }
  20515. }
  20516. function receive(length) {
  20517. let n = 0;
  20518. while (length > 0) {
  20519. n = n << 1 | readBit();
  20520. length--;
  20521. }
  20522. return n;
  20523. }
  20524. function receiveAndExtend(length) {
  20525. if (length === 1) {
  20526. return readBit() === 1 ? 1 : -1;
  20527. }
  20528. const n = receive(length);
  20529. if (n >= 1 << length - 1) {
  20530. return n;
  20531. }
  20532. return n + (-1 << length) + 1;
  20533. }
  20534. function decodeBaseline(component, blockOffset) {
  20535. const t = decodeHuffman(component.huffmanTableDC);
  20536. const diff = t === 0 ? 0 : receiveAndExtend(t);
  20537. component.blockData[blockOffset] = component.pred += diff;
  20538. let k = 1;
  20539. while (k < 64) {
  20540. const rs = decodeHuffman(component.huffmanTableAC);
  20541. const s = rs & 15,
  20542. r = rs >> 4;
  20543. if (s === 0) {
  20544. if (r < 15) {
  20545. break;
  20546. }
  20547. k += 16;
  20548. continue;
  20549. }
  20550. k += r;
  20551. const z = dctZigZag[k];
  20552. component.blockData[blockOffset + z] = receiveAndExtend(s);
  20553. k++;
  20554. }
  20555. }
  20556. function decodeDCFirst(component, blockOffset) {
  20557. const t = decodeHuffman(component.huffmanTableDC);
  20558. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  20559. component.blockData[blockOffset] = component.pred += diff;
  20560. }
  20561. function decodeDCSuccessive(component, blockOffset) {
  20562. component.blockData[blockOffset] |= readBit() << successive;
  20563. }
  20564. let eobrun = 0;
  20565. function decodeACFirst(component, blockOffset) {
  20566. if (eobrun > 0) {
  20567. eobrun--;
  20568. return;
  20569. }
  20570. let k = spectralStart;
  20571. const e = spectralEnd;
  20572. while (k <= e) {
  20573. const rs = decodeHuffman(component.huffmanTableAC);
  20574. const s = rs & 15,
  20575. r = rs >> 4;
  20576. if (s === 0) {
  20577. if (r < 15) {
  20578. eobrun = receive(r) + (1 << r) - 1;
  20579. break;
  20580. }
  20581. k += 16;
  20582. continue;
  20583. }
  20584. k += r;
  20585. const z = dctZigZag[k];
  20586. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  20587. k++;
  20588. }
  20589. }
  20590. let successiveACState = 0,
  20591. successiveACNextValue;
  20592. function decodeACSuccessive(component, blockOffset) {
  20593. let k = spectralStart;
  20594. const e = spectralEnd;
  20595. let r = 0;
  20596. let s;
  20597. let rs;
  20598. while (k <= e) {
  20599. const offsetZ = blockOffset + dctZigZag[k];
  20600. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  20601. switch (successiveACState) {
  20602. case 0:
  20603. rs = decodeHuffman(component.huffmanTableAC);
  20604. s = rs & 15;
  20605. r = rs >> 4;
  20606. if (s === 0) {
  20607. if (r < 15) {
  20608. eobrun = receive(r) + (1 << r);
  20609. successiveACState = 4;
  20610. } else {
  20611. r = 16;
  20612. successiveACState = 1;
  20613. }
  20614. } else {
  20615. if (s !== 1) {
  20616. throw new JpegError("invalid ACn encoding");
  20617. }
  20618. successiveACNextValue = receiveAndExtend(s);
  20619. successiveACState = r ? 2 : 3;
  20620. }
  20621. continue;
  20622. case 1:
  20623. case 2:
  20624. if (component.blockData[offsetZ]) {
  20625. component.blockData[offsetZ] += sign * (readBit() << successive);
  20626. } else {
  20627. r--;
  20628. if (r === 0) {
  20629. successiveACState = successiveACState === 2 ? 3 : 0;
  20630. }
  20631. }
  20632. break;
  20633. case 3:
  20634. if (component.blockData[offsetZ]) {
  20635. component.blockData[offsetZ] += sign * (readBit() << successive);
  20636. } else {
  20637. component.blockData[offsetZ] = successiveACNextValue << successive;
  20638. successiveACState = 0;
  20639. }
  20640. break;
  20641. case 4:
  20642. if (component.blockData[offsetZ]) {
  20643. component.blockData[offsetZ] += sign * (readBit() << successive);
  20644. }
  20645. break;
  20646. }
  20647. k++;
  20648. }
  20649. if (successiveACState === 4) {
  20650. eobrun--;
  20651. if (eobrun === 0) {
  20652. successiveACState = 0;
  20653. }
  20654. }
  20655. }
  20656. let blockRow = 0;
  20657. function decodeMcu(component, decode, mcu, row, col) {
  20658. const mcuRow = mcu / mcusPerLine | 0;
  20659. const mcuCol = mcu % mcusPerLine;
  20660. blockRow = mcuRow * component.v + row;
  20661. const blockCol = mcuCol * component.h + col;
  20662. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20663. decode(component, blockOffset);
  20664. }
  20665. function decodeBlock(component, decode, mcu) {
  20666. blockRow = mcu / component.blocksPerLine | 0;
  20667. const blockCol = mcu % component.blocksPerLine;
  20668. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20669. decode(component, blockOffset);
  20670. }
  20671. const componentsLength = components.length;
  20672. let component, i, j, k, n;
  20673. let decodeFn;
  20674. if (progressive) {
  20675. if (spectralStart === 0) {
  20676. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  20677. } else {
  20678. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  20679. }
  20680. } else {
  20681. decodeFn = decodeBaseline;
  20682. }
  20683. let mcu = 0,
  20684. fileMarker;
  20685. let mcuExpected;
  20686. if (componentsLength === 1) {
  20687. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  20688. } else {
  20689. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  20690. }
  20691. let h, v;
  20692. while (mcu <= mcuExpected) {
  20693. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  20694. if (mcuToRead > 0) {
  20695. for (i = 0; i < componentsLength; i++) {
  20696. components[i].pred = 0;
  20697. }
  20698. eobrun = 0;
  20699. if (componentsLength === 1) {
  20700. component = components[0];
  20701. for (n = 0; n < mcuToRead; n++) {
  20702. decodeBlock(component, decodeFn, mcu);
  20703. mcu++;
  20704. }
  20705. } else {
  20706. for (n = 0; n < mcuToRead; n++) {
  20707. for (i = 0; i < componentsLength; i++) {
  20708. component = components[i];
  20709. h = component.h;
  20710. v = component.v;
  20711. for (j = 0; j < v; j++) {
  20712. for (k = 0; k < h; k++) {
  20713. decodeMcu(component, decodeFn, mcu, j, k);
  20714. }
  20715. }
  20716. }
  20717. mcu++;
  20718. }
  20719. }
  20720. }
  20721. bitsCount = 0;
  20722. fileMarker = findNextFileMarker(data, offset);
  20723. if (!fileMarker) {
  20724. break;
  20725. }
  20726. if (fileMarker.invalid) {
  20727. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  20728. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  20729. offset = fileMarker.offset;
  20730. }
  20731. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  20732. offset += 2;
  20733. } else {
  20734. break;
  20735. }
  20736. }
  20737. return offset - startOffset;
  20738. }
  20739. function quantizeAndInverse(component, blockBufferOffset, p) {
  20740. const qt = component.quantizationTable,
  20741. blockData = component.blockData;
  20742. let v0, v1, v2, v3, v4, v5, v6, v7;
  20743. let p0, p1, p2, p3, p4, p5, p6, p7;
  20744. let t;
  20745. if (!qt) {
  20746. throw new JpegError("missing required Quantization Table.");
  20747. }
  20748. for (let row = 0; row < 64; row += 8) {
  20749. p0 = blockData[blockBufferOffset + row];
  20750. p1 = blockData[blockBufferOffset + row + 1];
  20751. p2 = blockData[blockBufferOffset + row + 2];
  20752. p3 = blockData[blockBufferOffset + row + 3];
  20753. p4 = blockData[blockBufferOffset + row + 4];
  20754. p5 = blockData[blockBufferOffset + row + 5];
  20755. p6 = blockData[blockBufferOffset + row + 6];
  20756. p7 = blockData[blockBufferOffset + row + 7];
  20757. p0 *= qt[row];
  20758. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20759. t = dctSqrt2 * p0 + 512 >> 10;
  20760. p[row] = t;
  20761. p[row + 1] = t;
  20762. p[row + 2] = t;
  20763. p[row + 3] = t;
  20764. p[row + 4] = t;
  20765. p[row + 5] = t;
  20766. p[row + 6] = t;
  20767. p[row + 7] = t;
  20768. continue;
  20769. }
  20770. p1 *= qt[row + 1];
  20771. p2 *= qt[row + 2];
  20772. p3 *= qt[row + 3];
  20773. p4 *= qt[row + 4];
  20774. p5 *= qt[row + 5];
  20775. p6 *= qt[row + 6];
  20776. p7 *= qt[row + 7];
  20777. v0 = dctSqrt2 * p0 + 128 >> 8;
  20778. v1 = dctSqrt2 * p4 + 128 >> 8;
  20779. v2 = p2;
  20780. v3 = p6;
  20781. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  20782. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  20783. v5 = p3 << 4;
  20784. v6 = p5 << 4;
  20785. v0 = v0 + v1 + 1 >> 1;
  20786. v1 = v0 - v1;
  20787. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  20788. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  20789. v3 = t;
  20790. v4 = v4 + v6 + 1 >> 1;
  20791. v6 = v4 - v6;
  20792. v7 = v7 + v5 + 1 >> 1;
  20793. v5 = v7 - v5;
  20794. v0 = v0 + v3 + 1 >> 1;
  20795. v3 = v0 - v3;
  20796. v1 = v1 + v2 + 1 >> 1;
  20797. v2 = v1 - v2;
  20798. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20799. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20800. v7 = t;
  20801. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20802. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20803. v6 = t;
  20804. p[row] = v0 + v7;
  20805. p[row + 7] = v0 - v7;
  20806. p[row + 1] = v1 + v6;
  20807. p[row + 6] = v1 - v6;
  20808. p[row + 2] = v2 + v5;
  20809. p[row + 5] = v2 - v5;
  20810. p[row + 3] = v3 + v4;
  20811. p[row + 4] = v3 - v4;
  20812. }
  20813. for (let col = 0; col < 8; ++col) {
  20814. p0 = p[col];
  20815. p1 = p[col + 8];
  20816. p2 = p[col + 16];
  20817. p3 = p[col + 24];
  20818. p4 = p[col + 32];
  20819. p5 = p[col + 40];
  20820. p6 = p[col + 48];
  20821. p7 = p[col + 56];
  20822. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20823. t = dctSqrt2 * p0 + 8192 >> 14;
  20824. if (t < -2040) {
  20825. t = 0;
  20826. } else if (t >= 2024) {
  20827. t = 255;
  20828. } else {
  20829. t = t + 2056 >> 4;
  20830. }
  20831. blockData[blockBufferOffset + col] = t;
  20832. blockData[blockBufferOffset + col + 8] = t;
  20833. blockData[blockBufferOffset + col + 16] = t;
  20834. blockData[blockBufferOffset + col + 24] = t;
  20835. blockData[blockBufferOffset + col + 32] = t;
  20836. blockData[blockBufferOffset + col + 40] = t;
  20837. blockData[blockBufferOffset + col + 48] = t;
  20838. blockData[blockBufferOffset + col + 56] = t;
  20839. continue;
  20840. }
  20841. v0 = dctSqrt2 * p0 + 2048 >> 12;
  20842. v1 = dctSqrt2 * p4 + 2048 >> 12;
  20843. v2 = p2;
  20844. v3 = p6;
  20845. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  20846. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  20847. v5 = p3;
  20848. v6 = p5;
  20849. v0 = (v0 + v1 + 1 >> 1) + 4112;
  20850. v1 = v0 - v1;
  20851. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  20852. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  20853. v3 = t;
  20854. v4 = v4 + v6 + 1 >> 1;
  20855. v6 = v4 - v6;
  20856. v7 = v7 + v5 + 1 >> 1;
  20857. v5 = v7 - v5;
  20858. v0 = v0 + v3 + 1 >> 1;
  20859. v3 = v0 - v3;
  20860. v1 = v1 + v2 + 1 >> 1;
  20861. v2 = v1 - v2;
  20862. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20863. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20864. v7 = t;
  20865. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20866. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20867. v6 = t;
  20868. p0 = v0 + v7;
  20869. p7 = v0 - v7;
  20870. p1 = v1 + v6;
  20871. p6 = v1 - v6;
  20872. p2 = v2 + v5;
  20873. p5 = v2 - v5;
  20874. p3 = v3 + v4;
  20875. p4 = v3 - v4;
  20876. if (p0 < 16) {
  20877. p0 = 0;
  20878. } else if (p0 >= 4080) {
  20879. p0 = 255;
  20880. } else {
  20881. p0 >>= 4;
  20882. }
  20883. if (p1 < 16) {
  20884. p1 = 0;
  20885. } else if (p1 >= 4080) {
  20886. p1 = 255;
  20887. } else {
  20888. p1 >>= 4;
  20889. }
  20890. if (p2 < 16) {
  20891. p2 = 0;
  20892. } else if (p2 >= 4080) {
  20893. p2 = 255;
  20894. } else {
  20895. p2 >>= 4;
  20896. }
  20897. if (p3 < 16) {
  20898. p3 = 0;
  20899. } else if (p3 >= 4080) {
  20900. p3 = 255;
  20901. } else {
  20902. p3 >>= 4;
  20903. }
  20904. if (p4 < 16) {
  20905. p4 = 0;
  20906. } else if (p4 >= 4080) {
  20907. p4 = 255;
  20908. } else {
  20909. p4 >>= 4;
  20910. }
  20911. if (p5 < 16) {
  20912. p5 = 0;
  20913. } else if (p5 >= 4080) {
  20914. p5 = 255;
  20915. } else {
  20916. p5 >>= 4;
  20917. }
  20918. if (p6 < 16) {
  20919. p6 = 0;
  20920. } else if (p6 >= 4080) {
  20921. p6 = 255;
  20922. } else {
  20923. p6 >>= 4;
  20924. }
  20925. if (p7 < 16) {
  20926. p7 = 0;
  20927. } else if (p7 >= 4080) {
  20928. p7 = 255;
  20929. } else {
  20930. p7 >>= 4;
  20931. }
  20932. blockData[blockBufferOffset + col] = p0;
  20933. blockData[blockBufferOffset + col + 8] = p1;
  20934. blockData[blockBufferOffset + col + 16] = p2;
  20935. blockData[blockBufferOffset + col + 24] = p3;
  20936. blockData[blockBufferOffset + col + 32] = p4;
  20937. blockData[blockBufferOffset + col + 40] = p5;
  20938. blockData[blockBufferOffset + col + 48] = p6;
  20939. blockData[blockBufferOffset + col + 56] = p7;
  20940. }
  20941. }
  20942. function buildComponentData(frame, component) {
  20943. const blocksPerLine = component.blocksPerLine;
  20944. const blocksPerColumn = component.blocksPerColumn;
  20945. const computationBuffer = new Int16Array(64);
  20946. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  20947. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  20948. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  20949. quantizeAndInverse(component, offset, computationBuffer);
  20950. }
  20951. }
  20952. return component.blockData;
  20953. }
  20954. function findNextFileMarker(data, currentPos) {
  20955. let startPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentPos;
  20956. const maxPos = data.length - 1;
  20957. let newPos = startPos < currentPos ? startPos : currentPos;
  20958. if (currentPos >= maxPos) {
  20959. return null;
  20960. }
  20961. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  20962. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  20963. return {
  20964. invalid: null,
  20965. marker: currentMarker,
  20966. offset: currentPos
  20967. };
  20968. }
  20969. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  20970. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  20971. if (++newPos >= maxPos) {
  20972. return null;
  20973. }
  20974. newMarker = (0, _core_utils.readUint16)(data, newPos);
  20975. }
  20976. return {
  20977. invalid: currentMarker.toString(16),
  20978. marker: newMarker,
  20979. offset: newPos
  20980. };
  20981. }
  20982. class JpegImage {
  20983. constructor() {
  20984. let {
  20985. decodeTransform = null,
  20986. colorTransform = -1
  20987. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20988. this._decodeTransform = decodeTransform;
  20989. this._colorTransform = colorTransform;
  20990. }
  20991. parse(data) {
  20992. let {
  20993. dnlScanLines = null
  20994. } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20995. function readDataBlock() {
  20996. const length = (0, _core_utils.readUint16)(data, offset);
  20997. offset += 2;
  20998. let endOffset = offset + length - 2;
  20999. const fileMarker = findNextFileMarker(data, endOffset, offset);
  21000. if (fileMarker && fileMarker.invalid) {
  21001. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  21002. endOffset = fileMarker.offset;
  21003. }
  21004. const array = data.subarray(offset, endOffset);
  21005. offset += array.length;
  21006. return array;
  21007. }
  21008. function prepareComponents(frame) {
  21009. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  21010. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  21011. for (const component of frame.components) {
  21012. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  21013. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  21014. const blocksPerLineForMcu = mcusPerLine * component.h;
  21015. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  21016. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  21017. component.blockData = new Int16Array(blocksBufferSize);
  21018. component.blocksPerLine = blocksPerLine;
  21019. component.blocksPerColumn = blocksPerColumn;
  21020. }
  21021. frame.mcusPerLine = mcusPerLine;
  21022. frame.mcusPerColumn = mcusPerColumn;
  21023. }
  21024. let offset = 0;
  21025. let jfif = null;
  21026. let adobe = null;
  21027. let frame, resetInterval;
  21028. let numSOSMarkers = 0;
  21029. const quantizationTables = [];
  21030. const huffmanTablesAC = [],
  21031. huffmanTablesDC = [];
  21032. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  21033. offset += 2;
  21034. if (fileMarker !== 0xffd8) {
  21035. throw new JpegError("SOI not found");
  21036. }
  21037. fileMarker = (0, _core_utils.readUint16)(data, offset);
  21038. offset += 2;
  21039. markerLoop: while (fileMarker !== 0xffd9) {
  21040. let i, j, l;
  21041. switch (fileMarker) {
  21042. case 0xffe0:
  21043. case 0xffe1:
  21044. case 0xffe2:
  21045. case 0xffe3:
  21046. case 0xffe4:
  21047. case 0xffe5:
  21048. case 0xffe6:
  21049. case 0xffe7:
  21050. case 0xffe8:
  21051. case 0xffe9:
  21052. case 0xffea:
  21053. case 0xffeb:
  21054. case 0xffec:
  21055. case 0xffed:
  21056. case 0xffee:
  21057. case 0xffef:
  21058. case 0xfffe:
  21059. const appData = readDataBlock();
  21060. if (fileMarker === 0xffe0) {
  21061. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  21062. jfif = {
  21063. version: {
  21064. major: appData[5],
  21065. minor: appData[6]
  21066. },
  21067. densityUnits: appData[7],
  21068. xDensity: appData[8] << 8 | appData[9],
  21069. yDensity: appData[10] << 8 | appData[11],
  21070. thumbWidth: appData[12],
  21071. thumbHeight: appData[13],
  21072. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  21073. };
  21074. }
  21075. }
  21076. if (fileMarker === 0xffee) {
  21077. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  21078. adobe = {
  21079. version: appData[5] << 8 | appData[6],
  21080. flags0: appData[7] << 8 | appData[8],
  21081. flags1: appData[9] << 8 | appData[10],
  21082. transformCode: appData[11]
  21083. };
  21084. }
  21085. }
  21086. break;
  21087. case 0xffdb:
  21088. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  21089. offset += 2;
  21090. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  21091. let z;
  21092. while (offset < quantizationTablesEnd) {
  21093. const quantizationTableSpec = data[offset++];
  21094. const tableData = new Uint16Array(64);
  21095. if (quantizationTableSpec >> 4 === 0) {
  21096. for (j = 0; j < 64; j++) {
  21097. z = dctZigZag[j];
  21098. tableData[z] = data[offset++];
  21099. }
  21100. } else if (quantizationTableSpec >> 4 === 1) {
  21101. for (j = 0; j < 64; j++) {
  21102. z = dctZigZag[j];
  21103. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  21104. offset += 2;
  21105. }
  21106. } else {
  21107. throw new JpegError("DQT - invalid table spec");
  21108. }
  21109. quantizationTables[quantizationTableSpec & 15] = tableData;
  21110. }
  21111. break;
  21112. case 0xffc0:
  21113. case 0xffc1:
  21114. case 0xffc2:
  21115. if (frame) {
  21116. throw new JpegError("Only single frame JPEGs supported");
  21117. }
  21118. offset += 2;
  21119. frame = {};
  21120. frame.extended = fileMarker === 0xffc1;
  21121. frame.progressive = fileMarker === 0xffc2;
  21122. frame.precision = data[offset++];
  21123. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  21124. offset += 2;
  21125. frame.scanLines = dnlScanLines || sofScanLines;
  21126. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  21127. offset += 2;
  21128. frame.components = [];
  21129. frame.componentIds = {};
  21130. const componentsCount = data[offset++];
  21131. let maxH = 0,
  21132. maxV = 0;
  21133. for (i = 0; i < componentsCount; i++) {
  21134. const componentId = data[offset];
  21135. const h = data[offset + 1] >> 4;
  21136. const v = data[offset + 1] & 15;
  21137. if (maxH < h) {
  21138. maxH = h;
  21139. }
  21140. if (maxV < v) {
  21141. maxV = v;
  21142. }
  21143. const qId = data[offset + 2];
  21144. l = frame.components.push({
  21145. h,
  21146. v,
  21147. quantizationId: qId,
  21148. quantizationTable: null
  21149. });
  21150. frame.componentIds[componentId] = l - 1;
  21151. offset += 3;
  21152. }
  21153. frame.maxH = maxH;
  21154. frame.maxV = maxV;
  21155. prepareComponents(frame);
  21156. break;
  21157. case 0xffc4:
  21158. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  21159. offset += 2;
  21160. for (i = 2; i < huffmanLength;) {
  21161. const huffmanTableSpec = data[offset++];
  21162. const codeLengths = new Uint8Array(16);
  21163. let codeLengthSum = 0;
  21164. for (j = 0; j < 16; j++, offset++) {
  21165. codeLengthSum += codeLengths[j] = data[offset];
  21166. }
  21167. const huffmanValues = new Uint8Array(codeLengthSum);
  21168. for (j = 0; j < codeLengthSum; j++, offset++) {
  21169. huffmanValues[j] = data[offset];
  21170. }
  21171. i += 17 + codeLengthSum;
  21172. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  21173. }
  21174. break;
  21175. case 0xffdd:
  21176. offset += 2;
  21177. resetInterval = (0, _core_utils.readUint16)(data, offset);
  21178. offset += 2;
  21179. break;
  21180. case 0xffda:
  21181. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  21182. offset += 2;
  21183. const selectorsCount = data[offset++],
  21184. components = [];
  21185. for (i = 0; i < selectorsCount; i++) {
  21186. const index = data[offset++];
  21187. const componentIndex = frame.componentIds[index];
  21188. const component = frame.components[componentIndex];
  21189. component.index = index;
  21190. const tableSpec = data[offset++];
  21191. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  21192. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  21193. components.push(component);
  21194. }
  21195. const spectralStart = data[offset++],
  21196. spectralEnd = data[offset++],
  21197. successiveApproximation = data[offset++];
  21198. try {
  21199. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  21200. offset += processed;
  21201. } catch (ex) {
  21202. if (ex instanceof DNLMarkerError) {
  21203. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  21204. return this.parse(data, {
  21205. dnlScanLines: ex.scanLines
  21206. });
  21207. } else if (ex instanceof EOIMarkerError) {
  21208. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  21209. break markerLoop;
  21210. }
  21211. throw ex;
  21212. }
  21213. break;
  21214. case 0xffdc:
  21215. offset += 4;
  21216. break;
  21217. case 0xffff:
  21218. if (data[offset] !== 0xff) {
  21219. offset--;
  21220. }
  21221. break;
  21222. default:
  21223. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  21224. if (nextFileMarker && nextFileMarker.invalid) {
  21225. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  21226. offset = nextFileMarker.offset;
  21227. break;
  21228. }
  21229. if (!nextFileMarker || offset >= data.length - 1) {
  21230. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  21231. break markerLoop;
  21232. }
  21233. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  21234. }
  21235. fileMarker = (0, _core_utils.readUint16)(data, offset);
  21236. offset += 2;
  21237. }
  21238. this.width = frame.samplesPerLine;
  21239. this.height = frame.scanLines;
  21240. this.jfif = jfif;
  21241. this.adobe = adobe;
  21242. this.components = [];
  21243. for (const component of frame.components) {
  21244. const quantizationTable = quantizationTables[component.quantizationId];
  21245. if (quantizationTable) {
  21246. component.quantizationTable = quantizationTable;
  21247. }
  21248. this.components.push({
  21249. index: component.index,
  21250. output: buildComponentData(frame, component),
  21251. scaleX: component.h / frame.maxH,
  21252. scaleY: component.v / frame.maxV,
  21253. blocksPerLine: component.blocksPerLine,
  21254. blocksPerColumn: component.blocksPerColumn
  21255. });
  21256. }
  21257. this.numComponents = this.components.length;
  21258. return undefined;
  21259. }
  21260. _getLinearizedBlockData(width, height) {
  21261. let isSourcePDF = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  21262. const scaleX = this.width / width,
  21263. scaleY = this.height / height;
  21264. let component, componentScaleX, componentScaleY, blocksPerScanline;
  21265. let x, y, i, j, k;
  21266. let index;
  21267. let offset = 0;
  21268. let output;
  21269. const numComponents = this.components.length;
  21270. const dataLength = width * height * numComponents;
  21271. const data = new Uint8ClampedArray(dataLength);
  21272. const xScaleBlockOffset = new Uint32Array(width);
  21273. const mask3LSB = 0xfffffff8;
  21274. let lastComponentScaleX;
  21275. for (i = 0; i < numComponents; i++) {
  21276. component = this.components[i];
  21277. componentScaleX = component.scaleX * scaleX;
  21278. componentScaleY = component.scaleY * scaleY;
  21279. offset = i;
  21280. output = component.output;
  21281. blocksPerScanline = component.blocksPerLine + 1 << 3;
  21282. if (componentScaleX !== lastComponentScaleX) {
  21283. for (x = 0; x < width; x++) {
  21284. j = 0 | x * componentScaleX;
  21285. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  21286. }
  21287. lastComponentScaleX = componentScaleX;
  21288. }
  21289. for (y = 0; y < height; y++) {
  21290. j = 0 | y * componentScaleY;
  21291. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  21292. for (x = 0; x < width; x++) {
  21293. data[offset] = output[index + xScaleBlockOffset[x]];
  21294. offset += numComponents;
  21295. }
  21296. }
  21297. }
  21298. let transform = this._decodeTransform;
  21299. if (!isSourcePDF && numComponents === 4 && !transform) {
  21300. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  21301. }
  21302. if (transform) {
  21303. for (i = 0; i < dataLength;) {
  21304. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  21305. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  21306. }
  21307. }
  21308. }
  21309. return data;
  21310. }
  21311. get _isColorConversionNeeded() {
  21312. if (this.adobe) {
  21313. return !!this.adobe.transformCode;
  21314. }
  21315. if (this.numComponents === 3) {
  21316. if (this._colorTransform === 0) {
  21317. return false;
  21318. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  21319. return false;
  21320. }
  21321. return true;
  21322. }
  21323. if (this._colorTransform === 1) {
  21324. return true;
  21325. }
  21326. return false;
  21327. }
  21328. _convertYccToRgb(data) {
  21329. let Y, Cb, Cr;
  21330. for (let i = 0, length = data.length; i < length; i += 3) {
  21331. Y = data[i];
  21332. Cb = data[i + 1];
  21333. Cr = data[i + 2];
  21334. data[i] = Y - 179.456 + 1.402 * Cr;
  21335. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  21336. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  21337. }
  21338. return data;
  21339. }
  21340. _convertYcckToRgb(data) {
  21341. let Y, Cb, Cr, k;
  21342. let offset = 0;
  21343. for (let i = 0, length = data.length; i < length; i += 4) {
  21344. Y = data[i];
  21345. Cb = data[i + 1];
  21346. Cr = data[i + 2];
  21347. k = data[i + 3];
  21348. 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);
  21349. 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);
  21350. 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);
  21351. }
  21352. return data.subarray(0, offset);
  21353. }
  21354. _convertYcckToCmyk(data) {
  21355. let Y, Cb, Cr;
  21356. for (let i = 0, length = data.length; i < length; i += 4) {
  21357. Y = data[i];
  21358. Cb = data[i + 1];
  21359. Cr = data[i + 2];
  21360. data[i] = 434.456 - Y - 1.402 * Cr;
  21361. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  21362. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  21363. }
  21364. return data;
  21365. }
  21366. _convertCmykToRgb(data) {
  21367. let c, m, y, k;
  21368. let offset = 0;
  21369. for (let i = 0, length = data.length; i < length; i += 4) {
  21370. c = data[i];
  21371. m = data[i + 1];
  21372. y = data[i + 2];
  21373. k = data[i + 3];
  21374. 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);
  21375. 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);
  21376. 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);
  21377. }
  21378. return data.subarray(0, offset);
  21379. }
  21380. getData(_ref) {
  21381. let {
  21382. width,
  21383. height,
  21384. forceRGB = false,
  21385. isSourcePDF = false
  21386. } = _ref;
  21387. if (this.numComponents > 4) {
  21388. throw new JpegError("Unsupported color mode");
  21389. }
  21390. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  21391. if (this.numComponents === 1 && forceRGB) {
  21392. const rgbData = new Uint8ClampedArray(data.length * 3);
  21393. let offset = 0;
  21394. for (const grayColor of data) {
  21395. rgbData[offset++] = grayColor;
  21396. rgbData[offset++] = grayColor;
  21397. rgbData[offset++] = grayColor;
  21398. }
  21399. return rgbData;
  21400. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  21401. return this._convertYccToRgb(data);
  21402. } else if (this.numComponents === 4) {
  21403. if (this._isColorConversionNeeded) {
  21404. if (forceRGB) {
  21405. return this._convertYcckToRgb(data);
  21406. }
  21407. return this._convertYcckToCmyk(data);
  21408. } else if (forceRGB) {
  21409. return this._convertCmykToRgb(data);
  21410. }
  21411. }
  21412. return data;
  21413. }
  21414. }
  21415. exports.JpegImage = JpegImage;
  21416. /***/ }),
  21417. /* 158 */
  21418. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21419. "use strict";
  21420. Object.defineProperty(exports, "__esModule", ({
  21421. value: true
  21422. }));
  21423. exports.JpxStream = void 0;
  21424. var _decode_stream = __w_pdfjs_require__(148);
  21425. var _jpx = __w_pdfjs_require__(159);
  21426. var _util = __w_pdfjs_require__(2);
  21427. class JpxStream extends _decode_stream.DecodeStream {
  21428. constructor(stream, maybeLength, params) {
  21429. super(maybeLength);
  21430. this.stream = stream;
  21431. this.dict = stream.dict;
  21432. this.maybeLength = maybeLength;
  21433. this.params = params;
  21434. }
  21435. get bytes() {
  21436. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  21437. }
  21438. ensureBuffer(requested) {}
  21439. readBlock() {
  21440. if (this.eof) {
  21441. return;
  21442. }
  21443. const jpxImage = new _jpx.JpxImage();
  21444. jpxImage.parse(this.bytes);
  21445. const width = jpxImage.width;
  21446. const height = jpxImage.height;
  21447. const componentsCount = jpxImage.componentsCount;
  21448. const tileCount = jpxImage.tiles.length;
  21449. if (tileCount === 1) {
  21450. this.buffer = jpxImage.tiles[0].items;
  21451. } else {
  21452. const data = new Uint8ClampedArray(width * height * componentsCount);
  21453. for (let k = 0; k < tileCount; k++) {
  21454. const tileComponents = jpxImage.tiles[k];
  21455. const tileWidth = tileComponents.width;
  21456. const tileHeight = tileComponents.height;
  21457. const tileLeft = tileComponents.left;
  21458. const tileTop = tileComponents.top;
  21459. const src = tileComponents.items;
  21460. let srcPosition = 0;
  21461. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  21462. const imgRowSize = width * componentsCount;
  21463. const tileRowSize = tileWidth * componentsCount;
  21464. for (let j = 0; j < tileHeight; j++) {
  21465. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  21466. data.set(rowBytes, dataPosition);
  21467. srcPosition += tileRowSize;
  21468. dataPosition += imgRowSize;
  21469. }
  21470. }
  21471. this.buffer = data;
  21472. }
  21473. this.bufferLength = this.buffer.length;
  21474. this.eof = true;
  21475. }
  21476. }
  21477. exports.JpxStream = JpxStream;
  21478. /***/ }),
  21479. /* 159 */
  21480. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21481. "use strict";
  21482. Object.defineProperty(exports, "__esModule", ({
  21483. value: true
  21484. }));
  21485. exports.JpxImage = void 0;
  21486. var _util = __w_pdfjs_require__(2);
  21487. var _core_utils = __w_pdfjs_require__(135);
  21488. var _arithmetic_decoder = __w_pdfjs_require__(155);
  21489. class JpxError extends _util.BaseException {
  21490. constructor(msg) {
  21491. super(`JPX error: ${msg}`, "JpxError");
  21492. }
  21493. }
  21494. const SubbandsGainLog2 = {
  21495. LL: 0,
  21496. LH: 1,
  21497. HL: 1,
  21498. HH: 2
  21499. };
  21500. class JpxImage {
  21501. constructor() {
  21502. this.failOnCorruptedImage = false;
  21503. }
  21504. parse(data) {
  21505. const head = (0, _core_utils.readUint16)(data, 0);
  21506. if (head === 0xff4f) {
  21507. this.parseCodestream(data, 0, data.length);
  21508. return;
  21509. }
  21510. const length = data.length;
  21511. let position = 0;
  21512. while (position < length) {
  21513. let headerSize = 8;
  21514. let lbox = (0, _core_utils.readUint32)(data, position);
  21515. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  21516. position += headerSize;
  21517. if (lbox === 1) {
  21518. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  21519. position += 8;
  21520. headerSize += 8;
  21521. }
  21522. if (lbox === 0) {
  21523. lbox = length - position + headerSize;
  21524. }
  21525. if (lbox < headerSize) {
  21526. throw new JpxError("Invalid box field size");
  21527. }
  21528. const dataLength = lbox - headerSize;
  21529. let jumpDataLength = true;
  21530. switch (tbox) {
  21531. case 0x6a703268:
  21532. jumpDataLength = false;
  21533. break;
  21534. case 0x636f6c72:
  21535. const method = data[position];
  21536. if (method === 1) {
  21537. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  21538. switch (colorspace) {
  21539. case 16:
  21540. case 17:
  21541. case 18:
  21542. break;
  21543. default:
  21544. (0, _util.warn)("Unknown colorspace " + colorspace);
  21545. break;
  21546. }
  21547. } else if (method === 2) {
  21548. (0, _util.info)("ICC profile not supported");
  21549. }
  21550. break;
  21551. case 0x6a703263:
  21552. this.parseCodestream(data, position, position + dataLength);
  21553. break;
  21554. case 0x6a502020:
  21555. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  21556. (0, _util.warn)("Invalid JP2 signature");
  21557. }
  21558. break;
  21559. case 0x6a501a1a:
  21560. case 0x66747970:
  21561. case 0x72726571:
  21562. case 0x72657320:
  21563. case 0x69686472:
  21564. break;
  21565. default:
  21566. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  21567. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  21568. break;
  21569. }
  21570. if (jumpDataLength) {
  21571. position += dataLength;
  21572. }
  21573. }
  21574. }
  21575. parseImageProperties(stream) {
  21576. let newByte = stream.getByte();
  21577. while (newByte >= 0) {
  21578. const oldByte = newByte;
  21579. newByte = stream.getByte();
  21580. const code = oldByte << 8 | newByte;
  21581. if (code === 0xff51) {
  21582. stream.skip(4);
  21583. const Xsiz = stream.getInt32() >>> 0;
  21584. const Ysiz = stream.getInt32() >>> 0;
  21585. const XOsiz = stream.getInt32() >>> 0;
  21586. const YOsiz = stream.getInt32() >>> 0;
  21587. stream.skip(16);
  21588. const Csiz = stream.getUint16();
  21589. this.width = Xsiz - XOsiz;
  21590. this.height = Ysiz - YOsiz;
  21591. this.componentsCount = Csiz;
  21592. this.bitsPerComponent = 8;
  21593. return;
  21594. }
  21595. }
  21596. throw new JpxError("No size marker found in JPX stream");
  21597. }
  21598. parseCodestream(data, start, end) {
  21599. const context = {};
  21600. let doNotRecover = false;
  21601. try {
  21602. let position = start;
  21603. while (position + 1 < end) {
  21604. const code = (0, _core_utils.readUint16)(data, position);
  21605. position += 2;
  21606. let length = 0,
  21607. j,
  21608. sqcd,
  21609. spqcds,
  21610. spqcdSize,
  21611. scalarExpounded,
  21612. tile;
  21613. switch (code) {
  21614. case 0xff4f:
  21615. context.mainHeader = true;
  21616. break;
  21617. case 0xffd9:
  21618. break;
  21619. case 0xff51:
  21620. length = (0, _core_utils.readUint16)(data, position);
  21621. const siz = {};
  21622. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  21623. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  21624. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  21625. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  21626. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  21627. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  21628. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  21629. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  21630. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  21631. siz.Csiz = componentsCount;
  21632. const components = [];
  21633. j = position + 38;
  21634. for (let i = 0; i < componentsCount; i++) {
  21635. const component = {
  21636. precision: (data[j] & 0x7f) + 1,
  21637. isSigned: !!(data[j] & 0x80),
  21638. XRsiz: data[j + 1],
  21639. YRsiz: data[j + 2]
  21640. };
  21641. j += 3;
  21642. calculateComponentDimensions(component, siz);
  21643. components.push(component);
  21644. }
  21645. context.SIZ = siz;
  21646. context.components = components;
  21647. calculateTileGrids(context, components);
  21648. context.QCC = [];
  21649. context.COC = [];
  21650. break;
  21651. case 0xff5c:
  21652. length = (0, _core_utils.readUint16)(data, position);
  21653. const qcd = {};
  21654. j = position + 2;
  21655. sqcd = data[j++];
  21656. switch (sqcd & 0x1f) {
  21657. case 0:
  21658. spqcdSize = 8;
  21659. scalarExpounded = true;
  21660. break;
  21661. case 1:
  21662. spqcdSize = 16;
  21663. scalarExpounded = false;
  21664. break;
  21665. case 2:
  21666. spqcdSize = 16;
  21667. scalarExpounded = true;
  21668. break;
  21669. default:
  21670. throw new Error("Invalid SQcd value " + sqcd);
  21671. }
  21672. qcd.noQuantization = spqcdSize === 8;
  21673. qcd.scalarExpounded = scalarExpounded;
  21674. qcd.guardBits = sqcd >> 5;
  21675. spqcds = [];
  21676. while (j < length + position) {
  21677. const spqcd = {};
  21678. if (spqcdSize === 8) {
  21679. spqcd.epsilon = data[j++] >> 3;
  21680. spqcd.mu = 0;
  21681. } else {
  21682. spqcd.epsilon = data[j] >> 3;
  21683. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21684. j += 2;
  21685. }
  21686. spqcds.push(spqcd);
  21687. }
  21688. qcd.SPqcds = spqcds;
  21689. if (context.mainHeader) {
  21690. context.QCD = qcd;
  21691. } else {
  21692. context.currentTile.QCD = qcd;
  21693. context.currentTile.QCC = [];
  21694. }
  21695. break;
  21696. case 0xff5d:
  21697. length = (0, _core_utils.readUint16)(data, position);
  21698. const qcc = {};
  21699. j = position + 2;
  21700. let cqcc;
  21701. if (context.SIZ.Csiz < 257) {
  21702. cqcc = data[j++];
  21703. } else {
  21704. cqcc = (0, _core_utils.readUint16)(data, j);
  21705. j += 2;
  21706. }
  21707. sqcd = data[j++];
  21708. switch (sqcd & 0x1f) {
  21709. case 0:
  21710. spqcdSize = 8;
  21711. scalarExpounded = true;
  21712. break;
  21713. case 1:
  21714. spqcdSize = 16;
  21715. scalarExpounded = false;
  21716. break;
  21717. case 2:
  21718. spqcdSize = 16;
  21719. scalarExpounded = true;
  21720. break;
  21721. default:
  21722. throw new Error("Invalid SQcd value " + sqcd);
  21723. }
  21724. qcc.noQuantization = spqcdSize === 8;
  21725. qcc.scalarExpounded = scalarExpounded;
  21726. qcc.guardBits = sqcd >> 5;
  21727. spqcds = [];
  21728. while (j < length + position) {
  21729. const spqcd = {};
  21730. if (spqcdSize === 8) {
  21731. spqcd.epsilon = data[j++] >> 3;
  21732. spqcd.mu = 0;
  21733. } else {
  21734. spqcd.epsilon = data[j] >> 3;
  21735. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21736. j += 2;
  21737. }
  21738. spqcds.push(spqcd);
  21739. }
  21740. qcc.SPqcds = spqcds;
  21741. if (context.mainHeader) {
  21742. context.QCC[cqcc] = qcc;
  21743. } else {
  21744. context.currentTile.QCC[cqcc] = qcc;
  21745. }
  21746. break;
  21747. case 0xff52:
  21748. length = (0, _core_utils.readUint16)(data, position);
  21749. const cod = {};
  21750. j = position + 2;
  21751. const scod = data[j++];
  21752. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  21753. cod.sopMarkerUsed = !!(scod & 2);
  21754. cod.ephMarkerUsed = !!(scod & 4);
  21755. cod.progressionOrder = data[j++];
  21756. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  21757. j += 2;
  21758. cod.multipleComponentTransform = data[j++];
  21759. cod.decompositionLevelsCount = data[j++];
  21760. cod.xcb = (data[j++] & 0xf) + 2;
  21761. cod.ycb = (data[j++] & 0xf) + 2;
  21762. const blockStyle = data[j++];
  21763. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  21764. cod.resetContextProbabilities = !!(blockStyle & 2);
  21765. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  21766. cod.verticallyStripe = !!(blockStyle & 8);
  21767. cod.predictableTermination = !!(blockStyle & 16);
  21768. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  21769. cod.reversibleTransformation = data[j++];
  21770. if (cod.entropyCoderWithCustomPrecincts) {
  21771. const precinctsSizes = [];
  21772. while (j < length + position) {
  21773. const precinctsSize = data[j++];
  21774. precinctsSizes.push({
  21775. PPx: precinctsSize & 0xf,
  21776. PPy: precinctsSize >> 4
  21777. });
  21778. }
  21779. cod.precinctsSizes = precinctsSizes;
  21780. }
  21781. const unsupported = [];
  21782. if (cod.selectiveArithmeticCodingBypass) {
  21783. unsupported.push("selectiveArithmeticCodingBypass");
  21784. }
  21785. if (cod.terminationOnEachCodingPass) {
  21786. unsupported.push("terminationOnEachCodingPass");
  21787. }
  21788. if (cod.verticallyStripe) {
  21789. unsupported.push("verticallyStripe");
  21790. }
  21791. if (cod.predictableTermination) {
  21792. unsupported.push("predictableTermination");
  21793. }
  21794. if (unsupported.length > 0) {
  21795. doNotRecover = true;
  21796. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  21797. }
  21798. if (context.mainHeader) {
  21799. context.COD = cod;
  21800. } else {
  21801. context.currentTile.COD = cod;
  21802. context.currentTile.COC = [];
  21803. }
  21804. break;
  21805. case 0xff90:
  21806. length = (0, _core_utils.readUint16)(data, position);
  21807. tile = {};
  21808. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  21809. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  21810. tile.dataEnd = tile.length + position - 2;
  21811. tile.partIndex = data[position + 8];
  21812. tile.partsCount = data[position + 9];
  21813. context.mainHeader = false;
  21814. if (tile.partIndex === 0) {
  21815. tile.COD = context.COD;
  21816. tile.COC = context.COC.slice(0);
  21817. tile.QCD = context.QCD;
  21818. tile.QCC = context.QCC.slice(0);
  21819. }
  21820. context.currentTile = tile;
  21821. break;
  21822. case 0xff93:
  21823. tile = context.currentTile;
  21824. if (tile.partIndex === 0) {
  21825. initializeTile(context, tile.index);
  21826. buildPackets(context);
  21827. }
  21828. length = tile.dataEnd - position;
  21829. parseTilePackets(context, data, position, length);
  21830. break;
  21831. case 0xff53:
  21832. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  21833. case 0xff55:
  21834. case 0xff57:
  21835. case 0xff58:
  21836. case 0xff64:
  21837. length = (0, _core_utils.readUint16)(data, position);
  21838. break;
  21839. default:
  21840. throw new Error("Unknown codestream code: " + code.toString(16));
  21841. }
  21842. position += length;
  21843. }
  21844. } catch (e) {
  21845. if (doNotRecover || this.failOnCorruptedImage) {
  21846. throw new JpxError(e.message);
  21847. } else {
  21848. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  21849. }
  21850. }
  21851. this.tiles = transformComponents(context);
  21852. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  21853. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  21854. this.componentsCount = context.SIZ.Csiz;
  21855. }
  21856. }
  21857. exports.JpxImage = JpxImage;
  21858. function calculateComponentDimensions(component, siz) {
  21859. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  21860. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  21861. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  21862. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  21863. component.width = component.x1 - component.x0;
  21864. component.height = component.y1 - component.y0;
  21865. }
  21866. function calculateTileGrids(context, components) {
  21867. const siz = context.SIZ;
  21868. const tiles = [];
  21869. let tile;
  21870. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  21871. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  21872. for (let q = 0; q < numYtiles; q++) {
  21873. for (let p = 0; p < numXtiles; p++) {
  21874. tile = {};
  21875. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  21876. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  21877. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  21878. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  21879. tile.width = tile.tx1 - tile.tx0;
  21880. tile.height = tile.ty1 - tile.ty0;
  21881. tile.components = [];
  21882. tiles.push(tile);
  21883. }
  21884. }
  21885. context.tiles = tiles;
  21886. const componentsCount = siz.Csiz;
  21887. for (let i = 0, ii = componentsCount; i < ii; i++) {
  21888. const component = components[i];
  21889. for (let j = 0, jj = tiles.length; j < jj; j++) {
  21890. const tileComponent = {};
  21891. tile = tiles[j];
  21892. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  21893. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  21894. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  21895. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  21896. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  21897. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  21898. tile.components[i] = tileComponent;
  21899. }
  21900. }
  21901. }
  21902. function getBlocksDimensions(context, component, r) {
  21903. const codOrCoc = component.codingStyleParameters;
  21904. const result = {};
  21905. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  21906. result.PPx = 15;
  21907. result.PPy = 15;
  21908. } else {
  21909. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  21910. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  21911. }
  21912. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  21913. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  21914. return result;
  21915. }
  21916. function buildPrecincts(context, resolution, dimensions) {
  21917. const precinctWidth = 1 << dimensions.PPx;
  21918. const precinctHeight = 1 << dimensions.PPy;
  21919. const isZeroRes = resolution.resLevel === 0;
  21920. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  21921. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  21922. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  21923. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  21924. const numprecincts = numprecinctswide * numprecinctshigh;
  21925. resolution.precinctParameters = {
  21926. precinctWidth,
  21927. precinctHeight,
  21928. numprecinctswide,
  21929. numprecinctshigh,
  21930. numprecincts,
  21931. precinctWidthInSubband,
  21932. precinctHeightInSubband
  21933. };
  21934. }
  21935. function buildCodeblocks(context, subband, dimensions) {
  21936. const xcb_ = dimensions.xcb_;
  21937. const ycb_ = dimensions.ycb_;
  21938. const codeblockWidth = 1 << xcb_;
  21939. const codeblockHeight = 1 << ycb_;
  21940. const cbx0 = subband.tbx0 >> xcb_;
  21941. const cby0 = subband.tby0 >> ycb_;
  21942. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  21943. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  21944. const precinctParameters = subband.resolution.precinctParameters;
  21945. const codeblocks = [];
  21946. const precincts = [];
  21947. let i, j, codeblock, precinctNumber;
  21948. for (j = cby0; j < cby1; j++) {
  21949. for (i = cbx0; i < cbx1; i++) {
  21950. codeblock = {
  21951. cbx: i,
  21952. cby: j,
  21953. tbx0: codeblockWidth * i,
  21954. tby0: codeblockHeight * j,
  21955. tbx1: codeblockWidth * (i + 1),
  21956. tby1: codeblockHeight * (j + 1)
  21957. };
  21958. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  21959. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  21960. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  21961. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  21962. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  21963. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  21964. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  21965. codeblock.precinctNumber = precinctNumber;
  21966. codeblock.subbandType = subband.type;
  21967. codeblock.Lblock = 3;
  21968. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  21969. continue;
  21970. }
  21971. codeblocks.push(codeblock);
  21972. let precinct = precincts[precinctNumber];
  21973. if (precinct !== undefined) {
  21974. if (i < precinct.cbxMin) {
  21975. precinct.cbxMin = i;
  21976. } else if (i > precinct.cbxMax) {
  21977. precinct.cbxMax = i;
  21978. }
  21979. if (j < precinct.cbyMin) {
  21980. precinct.cbxMin = j;
  21981. } else if (j > precinct.cbyMax) {
  21982. precinct.cbyMax = j;
  21983. }
  21984. } else {
  21985. precincts[precinctNumber] = precinct = {
  21986. cbxMin: i,
  21987. cbyMin: j,
  21988. cbxMax: i,
  21989. cbyMax: j
  21990. };
  21991. }
  21992. codeblock.precinct = precinct;
  21993. }
  21994. }
  21995. subband.codeblockParameters = {
  21996. codeblockWidth: xcb_,
  21997. codeblockHeight: ycb_,
  21998. numcodeblockwide: cbx1 - cbx0 + 1,
  21999. numcodeblockhigh: cby1 - cby0 + 1
  22000. };
  22001. subband.codeblocks = codeblocks;
  22002. subband.precincts = precincts;
  22003. }
  22004. function createPacket(resolution, precinctNumber, layerNumber) {
  22005. const precinctCodeblocks = [];
  22006. const subbands = resolution.subbands;
  22007. for (let i = 0, ii = subbands.length; i < ii; i++) {
  22008. const subband = subbands[i];
  22009. const codeblocks = subband.codeblocks;
  22010. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  22011. const codeblock = codeblocks[j];
  22012. if (codeblock.precinctNumber !== precinctNumber) {
  22013. continue;
  22014. }
  22015. precinctCodeblocks.push(codeblock);
  22016. }
  22017. }
  22018. return {
  22019. layerNumber,
  22020. codeblocks: precinctCodeblocks
  22021. };
  22022. }
  22023. function LayerResolutionComponentPositionIterator(context) {
  22024. const siz = context.SIZ;
  22025. const tileIndex = context.currentTile.index;
  22026. const tile = context.tiles[tileIndex];
  22027. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22028. const componentsCount = siz.Csiz;
  22029. let maxDecompositionLevelsCount = 0;
  22030. for (let q = 0; q < componentsCount; q++) {
  22031. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  22032. }
  22033. let l = 0,
  22034. r = 0,
  22035. i = 0,
  22036. k = 0;
  22037. this.nextPacket = function JpxImage_nextPacket() {
  22038. for (; l < layersCount; l++) {
  22039. for (; r <= maxDecompositionLevelsCount; r++) {
  22040. for (; i < componentsCount; i++) {
  22041. const component = tile.components[i];
  22042. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  22043. continue;
  22044. }
  22045. const resolution = component.resolutions[r];
  22046. const numprecincts = resolution.precinctParameters.numprecincts;
  22047. for (; k < numprecincts;) {
  22048. const packet = createPacket(resolution, k, l);
  22049. k++;
  22050. return packet;
  22051. }
  22052. k = 0;
  22053. }
  22054. i = 0;
  22055. }
  22056. r = 0;
  22057. }
  22058. throw new JpxError("Out of packets");
  22059. };
  22060. }
  22061. function ResolutionLayerComponentPositionIterator(context) {
  22062. const siz = context.SIZ;
  22063. const tileIndex = context.currentTile.index;
  22064. const tile = context.tiles[tileIndex];
  22065. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22066. const componentsCount = siz.Csiz;
  22067. let maxDecompositionLevelsCount = 0;
  22068. for (let q = 0; q < componentsCount; q++) {
  22069. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  22070. }
  22071. let r = 0,
  22072. l = 0,
  22073. i = 0,
  22074. k = 0;
  22075. this.nextPacket = function JpxImage_nextPacket() {
  22076. for (; r <= maxDecompositionLevelsCount; r++) {
  22077. for (; l < layersCount; l++) {
  22078. for (; i < componentsCount; i++) {
  22079. const component = tile.components[i];
  22080. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  22081. continue;
  22082. }
  22083. const resolution = component.resolutions[r];
  22084. const numprecincts = resolution.precinctParameters.numprecincts;
  22085. for (; k < numprecincts;) {
  22086. const packet = createPacket(resolution, k, l);
  22087. k++;
  22088. return packet;
  22089. }
  22090. k = 0;
  22091. }
  22092. i = 0;
  22093. }
  22094. l = 0;
  22095. }
  22096. throw new JpxError("Out of packets");
  22097. };
  22098. }
  22099. function ResolutionPositionComponentLayerIterator(context) {
  22100. const siz = context.SIZ;
  22101. const tileIndex = context.currentTile.index;
  22102. const tile = context.tiles[tileIndex];
  22103. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22104. const componentsCount = siz.Csiz;
  22105. let l, r, c, p;
  22106. let maxDecompositionLevelsCount = 0;
  22107. for (c = 0; c < componentsCount; c++) {
  22108. const component = tile.components[c];
  22109. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  22110. }
  22111. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  22112. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  22113. let maxNumPrecincts = 0;
  22114. for (c = 0; c < componentsCount; ++c) {
  22115. const resolutions = tile.components[c].resolutions;
  22116. if (r < resolutions.length) {
  22117. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  22118. }
  22119. }
  22120. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  22121. }
  22122. l = 0;
  22123. r = 0;
  22124. c = 0;
  22125. p = 0;
  22126. this.nextPacket = function JpxImage_nextPacket() {
  22127. for (; r <= maxDecompositionLevelsCount; r++) {
  22128. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  22129. for (; c < componentsCount; c++) {
  22130. const component = tile.components[c];
  22131. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  22132. continue;
  22133. }
  22134. const resolution = component.resolutions[r];
  22135. const numprecincts = resolution.precinctParameters.numprecincts;
  22136. if (p >= numprecincts) {
  22137. continue;
  22138. }
  22139. for (; l < layersCount;) {
  22140. const packet = createPacket(resolution, p, l);
  22141. l++;
  22142. return packet;
  22143. }
  22144. l = 0;
  22145. }
  22146. c = 0;
  22147. }
  22148. p = 0;
  22149. }
  22150. throw new JpxError("Out of packets");
  22151. };
  22152. }
  22153. function PositionComponentResolutionLayerIterator(context) {
  22154. const siz = context.SIZ;
  22155. const tileIndex = context.currentTile.index;
  22156. const tile = context.tiles[tileIndex];
  22157. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22158. const componentsCount = siz.Csiz;
  22159. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  22160. const precinctsIterationSizes = precinctsSizes;
  22161. let l = 0,
  22162. r = 0,
  22163. c = 0,
  22164. px = 0,
  22165. py = 0;
  22166. this.nextPacket = function JpxImage_nextPacket() {
  22167. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  22168. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  22169. for (; c < componentsCount; c++) {
  22170. const component = tile.components[c];
  22171. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22172. for (; r <= decompositionLevelsCount; r++) {
  22173. const resolution = component.resolutions[r];
  22174. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  22175. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  22176. if (k === null) {
  22177. continue;
  22178. }
  22179. for (; l < layersCount;) {
  22180. const packet = createPacket(resolution, k, l);
  22181. l++;
  22182. return packet;
  22183. }
  22184. l = 0;
  22185. }
  22186. r = 0;
  22187. }
  22188. c = 0;
  22189. }
  22190. px = 0;
  22191. }
  22192. throw new JpxError("Out of packets");
  22193. };
  22194. }
  22195. function ComponentPositionResolutionLayerIterator(context) {
  22196. const siz = context.SIZ;
  22197. const tileIndex = context.currentTile.index;
  22198. const tile = context.tiles[tileIndex];
  22199. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22200. const componentsCount = siz.Csiz;
  22201. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  22202. let l = 0,
  22203. r = 0,
  22204. c = 0,
  22205. px = 0,
  22206. py = 0;
  22207. this.nextPacket = function JpxImage_nextPacket() {
  22208. for (; c < componentsCount; ++c) {
  22209. const component = tile.components[c];
  22210. const precinctsIterationSizes = precinctsSizes.components[c];
  22211. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22212. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  22213. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  22214. for (; r <= decompositionLevelsCount; r++) {
  22215. const resolution = component.resolutions[r];
  22216. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  22217. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  22218. if (k === null) {
  22219. continue;
  22220. }
  22221. for (; l < layersCount;) {
  22222. const packet = createPacket(resolution, k, l);
  22223. l++;
  22224. return packet;
  22225. }
  22226. l = 0;
  22227. }
  22228. r = 0;
  22229. }
  22230. px = 0;
  22231. }
  22232. py = 0;
  22233. }
  22234. throw new JpxError("Out of packets");
  22235. };
  22236. }
  22237. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  22238. const posX = pxIndex * precinctIterationSizes.minWidth;
  22239. const posY = pyIndex * precinctIterationSizes.minHeight;
  22240. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  22241. return null;
  22242. }
  22243. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  22244. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  22245. }
  22246. function getPrecinctSizesInImageScale(tile) {
  22247. const componentsCount = tile.components.length;
  22248. let minWidth = Number.MAX_VALUE;
  22249. let minHeight = Number.MAX_VALUE;
  22250. let maxNumWide = 0;
  22251. let maxNumHigh = 0;
  22252. const sizePerComponent = new Array(componentsCount);
  22253. for (let c = 0; c < componentsCount; c++) {
  22254. const component = tile.components[c];
  22255. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22256. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  22257. let minWidthCurrentComponent = Number.MAX_VALUE;
  22258. let minHeightCurrentComponent = Number.MAX_VALUE;
  22259. let maxNumWideCurrentComponent = 0;
  22260. let maxNumHighCurrentComponent = 0;
  22261. let scale = 1;
  22262. for (let r = decompositionLevelsCount; r >= 0; --r) {
  22263. const resolution = component.resolutions[r];
  22264. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  22265. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  22266. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  22267. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  22268. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  22269. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  22270. sizePerResolution[r] = {
  22271. width: widthCurrentResolution,
  22272. height: heightCurrentResolution
  22273. };
  22274. scale <<= 1;
  22275. }
  22276. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  22277. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  22278. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  22279. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  22280. sizePerComponent[c] = {
  22281. resolutions: sizePerResolution,
  22282. minWidth: minWidthCurrentComponent,
  22283. minHeight: minHeightCurrentComponent,
  22284. maxNumWide: maxNumWideCurrentComponent,
  22285. maxNumHigh: maxNumHighCurrentComponent
  22286. };
  22287. }
  22288. return {
  22289. components: sizePerComponent,
  22290. minWidth,
  22291. minHeight,
  22292. maxNumWide,
  22293. maxNumHigh
  22294. };
  22295. }
  22296. function buildPackets(context) {
  22297. const siz = context.SIZ;
  22298. const tileIndex = context.currentTile.index;
  22299. const tile = context.tiles[tileIndex];
  22300. const componentsCount = siz.Csiz;
  22301. for (let c = 0; c < componentsCount; c++) {
  22302. const component = tile.components[c];
  22303. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22304. const resolutions = [];
  22305. const subbands = [];
  22306. for (let r = 0; r <= decompositionLevelsCount; r++) {
  22307. const blocksDimensions = getBlocksDimensions(context, component, r);
  22308. const resolution = {};
  22309. const scale = 1 << decompositionLevelsCount - r;
  22310. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  22311. resolution.try0 = Math.ceil(component.tcy0 / scale);
  22312. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  22313. resolution.try1 = Math.ceil(component.tcy1 / scale);
  22314. resolution.resLevel = r;
  22315. buildPrecincts(context, resolution, blocksDimensions);
  22316. resolutions.push(resolution);
  22317. let subband;
  22318. if (r === 0) {
  22319. subband = {};
  22320. subband.type = "LL";
  22321. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  22322. subband.tby0 = Math.ceil(component.tcy0 / scale);
  22323. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  22324. subband.tby1 = Math.ceil(component.tcy1 / scale);
  22325. subband.resolution = resolution;
  22326. buildCodeblocks(context, subband, blocksDimensions);
  22327. subbands.push(subband);
  22328. resolution.subbands = [subband];
  22329. } else {
  22330. const bscale = 1 << decompositionLevelsCount - r + 1;
  22331. const resolutionSubbands = [];
  22332. subband = {};
  22333. subband.type = "HL";
  22334. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  22335. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  22336. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  22337. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  22338. subband.resolution = resolution;
  22339. buildCodeblocks(context, subband, blocksDimensions);
  22340. subbands.push(subband);
  22341. resolutionSubbands.push(subband);
  22342. subband = {};
  22343. subband.type = "LH";
  22344. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  22345. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  22346. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  22347. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  22348. subband.resolution = resolution;
  22349. buildCodeblocks(context, subband, blocksDimensions);
  22350. subbands.push(subband);
  22351. resolutionSubbands.push(subband);
  22352. subband = {};
  22353. subband.type = "HH";
  22354. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  22355. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  22356. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  22357. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  22358. subband.resolution = resolution;
  22359. buildCodeblocks(context, subband, blocksDimensions);
  22360. subbands.push(subband);
  22361. resolutionSubbands.push(subband);
  22362. resolution.subbands = resolutionSubbands;
  22363. }
  22364. }
  22365. component.resolutions = resolutions;
  22366. component.subbands = subbands;
  22367. }
  22368. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  22369. switch (progressionOrder) {
  22370. case 0:
  22371. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  22372. break;
  22373. case 1:
  22374. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  22375. break;
  22376. case 2:
  22377. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  22378. break;
  22379. case 3:
  22380. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  22381. break;
  22382. case 4:
  22383. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  22384. break;
  22385. default:
  22386. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  22387. }
  22388. }
  22389. function parseTilePackets(context, data, offset, dataLength) {
  22390. let position = 0;
  22391. let buffer,
  22392. bufferSize = 0,
  22393. skipNextBit = false;
  22394. function readBits(count) {
  22395. while (bufferSize < count) {
  22396. const b = data[offset + position];
  22397. position++;
  22398. if (skipNextBit) {
  22399. buffer = buffer << 7 | b;
  22400. bufferSize += 7;
  22401. skipNextBit = false;
  22402. } else {
  22403. buffer = buffer << 8 | b;
  22404. bufferSize += 8;
  22405. }
  22406. if (b === 0xff) {
  22407. skipNextBit = true;
  22408. }
  22409. }
  22410. bufferSize -= count;
  22411. return buffer >>> bufferSize & (1 << count) - 1;
  22412. }
  22413. function skipMarkerIfEqual(value) {
  22414. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  22415. skipBytes(1);
  22416. return true;
  22417. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  22418. skipBytes(2);
  22419. return true;
  22420. }
  22421. return false;
  22422. }
  22423. function skipBytes(count) {
  22424. position += count;
  22425. }
  22426. function alignToByte() {
  22427. bufferSize = 0;
  22428. if (skipNextBit) {
  22429. position++;
  22430. skipNextBit = false;
  22431. }
  22432. }
  22433. function readCodingpasses() {
  22434. if (readBits(1) === 0) {
  22435. return 1;
  22436. }
  22437. if (readBits(1) === 0) {
  22438. return 2;
  22439. }
  22440. let value = readBits(2);
  22441. if (value < 3) {
  22442. return value + 3;
  22443. }
  22444. value = readBits(5);
  22445. if (value < 31) {
  22446. return value + 6;
  22447. }
  22448. value = readBits(7);
  22449. return value + 37;
  22450. }
  22451. const tileIndex = context.currentTile.index;
  22452. const tile = context.tiles[tileIndex];
  22453. const sopMarkerUsed = context.COD.sopMarkerUsed;
  22454. const ephMarkerUsed = context.COD.ephMarkerUsed;
  22455. const packetsIterator = tile.packetsIterator;
  22456. while (position < dataLength) {
  22457. alignToByte();
  22458. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  22459. skipBytes(4);
  22460. }
  22461. const packet = packetsIterator.nextPacket();
  22462. if (!readBits(1)) {
  22463. continue;
  22464. }
  22465. const layerNumber = packet.layerNumber,
  22466. queue = [];
  22467. let codeblock;
  22468. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  22469. codeblock = packet.codeblocks[i];
  22470. let precinct = codeblock.precinct;
  22471. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  22472. const codeblockRow = codeblock.cby - precinct.cbyMin;
  22473. let codeblockIncluded = false;
  22474. let firstTimeInclusion = false;
  22475. let valueReady, zeroBitPlanesTree;
  22476. if (codeblock.included !== undefined) {
  22477. codeblockIncluded = !!readBits(1);
  22478. } else {
  22479. precinct = codeblock.precinct;
  22480. let inclusionTree;
  22481. if (precinct.inclusionTree !== undefined) {
  22482. inclusionTree = precinct.inclusionTree;
  22483. } else {
  22484. const width = precinct.cbxMax - precinct.cbxMin + 1;
  22485. const height = precinct.cbyMax - precinct.cbyMin + 1;
  22486. inclusionTree = new InclusionTree(width, height, layerNumber);
  22487. zeroBitPlanesTree = new TagTree(width, height);
  22488. precinct.inclusionTree = inclusionTree;
  22489. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  22490. for (let l = 0; l < layerNumber; l++) {
  22491. if (readBits(1) !== 0) {
  22492. throw new JpxError("Invalid tag tree");
  22493. }
  22494. }
  22495. }
  22496. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  22497. while (true) {
  22498. if (readBits(1)) {
  22499. valueReady = !inclusionTree.nextLevel();
  22500. if (valueReady) {
  22501. codeblock.included = true;
  22502. codeblockIncluded = firstTimeInclusion = true;
  22503. break;
  22504. }
  22505. } else {
  22506. inclusionTree.incrementValue(layerNumber);
  22507. break;
  22508. }
  22509. }
  22510. }
  22511. }
  22512. if (!codeblockIncluded) {
  22513. continue;
  22514. }
  22515. if (firstTimeInclusion) {
  22516. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  22517. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  22518. while (true) {
  22519. if (readBits(1)) {
  22520. valueReady = !zeroBitPlanesTree.nextLevel();
  22521. if (valueReady) {
  22522. break;
  22523. }
  22524. } else {
  22525. zeroBitPlanesTree.incrementValue();
  22526. }
  22527. }
  22528. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  22529. }
  22530. const codingpasses = readCodingpasses();
  22531. while (readBits(1)) {
  22532. codeblock.Lblock++;
  22533. }
  22534. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  22535. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  22536. const codedDataLength = readBits(bits);
  22537. queue.push({
  22538. codeblock,
  22539. codingpasses,
  22540. dataLength: codedDataLength
  22541. });
  22542. }
  22543. alignToByte();
  22544. if (ephMarkerUsed) {
  22545. skipMarkerIfEqual(0x92);
  22546. }
  22547. while (queue.length > 0) {
  22548. const packetItem = queue.shift();
  22549. codeblock = packetItem.codeblock;
  22550. if (codeblock.data === undefined) {
  22551. codeblock.data = [];
  22552. }
  22553. codeblock.data.push({
  22554. data,
  22555. start: offset + position,
  22556. end: offset + position + packetItem.dataLength,
  22557. codingpasses: packetItem.codingpasses
  22558. });
  22559. position += packetItem.dataLength;
  22560. }
  22561. }
  22562. return position;
  22563. }
  22564. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  22565. const x0 = subband.tbx0;
  22566. const y0 = subband.tby0;
  22567. const width = subband.tbx1 - subband.tbx0;
  22568. const codeblocks = subband.codeblocks;
  22569. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  22570. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  22571. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  22572. const codeblock = codeblocks[i];
  22573. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  22574. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  22575. if (blockWidth === 0 || blockHeight === 0) {
  22576. continue;
  22577. }
  22578. if (codeblock.data === undefined) {
  22579. continue;
  22580. }
  22581. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  22582. let currentCodingpassType = 2;
  22583. const data = codeblock.data;
  22584. let totalLength = 0,
  22585. codingpasses = 0;
  22586. let j, jj, dataItem;
  22587. for (j = 0, jj = data.length; j < jj; j++) {
  22588. dataItem = data[j];
  22589. totalLength += dataItem.end - dataItem.start;
  22590. codingpasses += dataItem.codingpasses;
  22591. }
  22592. const encodedData = new Uint8Array(totalLength);
  22593. let position = 0;
  22594. for (j = 0, jj = data.length; j < jj; j++) {
  22595. dataItem = data[j];
  22596. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  22597. encodedData.set(chunk, position);
  22598. position += chunk.length;
  22599. }
  22600. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  22601. bitModel.setDecoder(decoder);
  22602. for (j = 0; j < codingpasses; j++) {
  22603. switch (currentCodingpassType) {
  22604. case 0:
  22605. bitModel.runSignificancePropagationPass();
  22606. break;
  22607. case 1:
  22608. bitModel.runMagnitudeRefinementPass();
  22609. break;
  22610. case 2:
  22611. bitModel.runCleanupPass();
  22612. if (segmentationSymbolUsed) {
  22613. bitModel.checkSegmentationSymbol();
  22614. }
  22615. break;
  22616. }
  22617. if (resetContextProbabilities) {
  22618. bitModel.reset();
  22619. }
  22620. currentCodingpassType = (currentCodingpassType + 1) % 3;
  22621. }
  22622. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  22623. const sign = bitModel.coefficentsSign;
  22624. const magnitude = bitModel.coefficentsMagnitude;
  22625. const bitsDecoded = bitModel.bitsDecoded;
  22626. const magnitudeCorrection = reversible ? 0 : 0.5;
  22627. let k, n, nb;
  22628. position = 0;
  22629. const interleave = subband.type !== "LL";
  22630. for (j = 0; j < blockHeight; j++) {
  22631. const row = offset / width | 0;
  22632. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  22633. for (k = 0; k < blockWidth; k++) {
  22634. n = magnitude[position];
  22635. if (n !== 0) {
  22636. n = (n + magnitudeCorrection) * delta;
  22637. if (sign[position] !== 0) {
  22638. n = -n;
  22639. }
  22640. nb = bitsDecoded[position];
  22641. const pos = interleave ? levelOffset + (offset << 1) : offset;
  22642. if (reversible && nb >= mb) {
  22643. coefficients[pos] = n;
  22644. } else {
  22645. coefficients[pos] = n * (1 << mb - nb);
  22646. }
  22647. }
  22648. offset++;
  22649. position++;
  22650. }
  22651. offset += width - blockWidth;
  22652. }
  22653. }
  22654. }
  22655. function transformTile(context, tile, c) {
  22656. const component = tile.components[c];
  22657. const codingStyleParameters = component.codingStyleParameters;
  22658. const quantizationParameters = component.quantizationParameters;
  22659. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  22660. const spqcds = quantizationParameters.SPqcds;
  22661. const scalarExpounded = quantizationParameters.scalarExpounded;
  22662. const guardBits = quantizationParameters.guardBits;
  22663. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  22664. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  22665. const precision = context.components[c].precision;
  22666. const reversible = codingStyleParameters.reversibleTransformation;
  22667. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  22668. const subbandCoefficients = [];
  22669. let b = 0;
  22670. for (let i = 0; i <= decompositionLevelsCount; i++) {
  22671. const resolution = component.resolutions[i];
  22672. const width = resolution.trx1 - resolution.trx0;
  22673. const height = resolution.try1 - resolution.try0;
  22674. const coefficients = new Float32Array(width * height);
  22675. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  22676. let mu, epsilon;
  22677. if (!scalarExpounded) {
  22678. mu = spqcds[0].mu;
  22679. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  22680. } else {
  22681. mu = spqcds[b].mu;
  22682. epsilon = spqcds[b].epsilon;
  22683. b++;
  22684. }
  22685. const subband = resolution.subbands[j];
  22686. const gainLog2 = SubbandsGainLog2[subband.type];
  22687. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  22688. const mb = guardBits + epsilon - 1;
  22689. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  22690. }
  22691. subbandCoefficients.push({
  22692. width,
  22693. height,
  22694. items: coefficients
  22695. });
  22696. }
  22697. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  22698. return {
  22699. left: component.tcx0,
  22700. top: component.tcy0,
  22701. width: result.width,
  22702. height: result.height,
  22703. items: result.items
  22704. };
  22705. }
  22706. function transformComponents(context) {
  22707. const siz = context.SIZ;
  22708. const components = context.components;
  22709. const componentsCount = siz.Csiz;
  22710. const resultImages = [];
  22711. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  22712. const tile = context.tiles[i];
  22713. const transformedTiles = [];
  22714. for (let c = 0; c < componentsCount; c++) {
  22715. transformedTiles[c] = transformTile(context, tile, c);
  22716. }
  22717. const tile0 = transformedTiles[0];
  22718. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  22719. const result = {
  22720. left: tile0.left,
  22721. top: tile0.top,
  22722. width: tile0.width,
  22723. height: tile0.height,
  22724. items: out
  22725. };
  22726. let shift, offset;
  22727. let pos = 0,
  22728. j,
  22729. jj,
  22730. y0,
  22731. y1,
  22732. y2;
  22733. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  22734. const fourComponents = componentsCount === 4;
  22735. const y0items = transformedTiles[0].items;
  22736. const y1items = transformedTiles[1].items;
  22737. const y2items = transformedTiles[2].items;
  22738. const y3items = fourComponents ? transformedTiles[3].items : null;
  22739. shift = components[0].precision - 8;
  22740. offset = (128 << shift) + 0.5;
  22741. const component0 = tile.components[0];
  22742. const alpha01 = componentsCount - 3;
  22743. jj = y0items.length;
  22744. if (!component0.codingStyleParameters.reversibleTransformation) {
  22745. for (j = 0; j < jj; j++, pos += alpha01) {
  22746. y0 = y0items[j] + offset;
  22747. y1 = y1items[j];
  22748. y2 = y2items[j];
  22749. out[pos++] = y0 + 1.402 * y2 >> shift;
  22750. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  22751. out[pos++] = y0 + 1.772 * y1 >> shift;
  22752. }
  22753. } else {
  22754. for (j = 0; j < jj; j++, pos += alpha01) {
  22755. y0 = y0items[j] + offset;
  22756. y1 = y1items[j];
  22757. y2 = y2items[j];
  22758. const g = y0 - (y2 + y1 >> 2);
  22759. out[pos++] = g + y2 >> shift;
  22760. out[pos++] = g >> shift;
  22761. out[pos++] = g + y1 >> shift;
  22762. }
  22763. }
  22764. if (fourComponents) {
  22765. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  22766. out[pos] = y3items[j] + offset >> shift;
  22767. }
  22768. }
  22769. } else {
  22770. for (let c = 0; c < componentsCount; c++) {
  22771. const items = transformedTiles[c].items;
  22772. shift = components[c].precision - 8;
  22773. offset = (128 << shift) + 0.5;
  22774. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  22775. out[pos] = items[j] + offset >> shift;
  22776. pos += componentsCount;
  22777. }
  22778. }
  22779. }
  22780. resultImages.push(result);
  22781. }
  22782. return resultImages;
  22783. }
  22784. function initializeTile(context, tileIndex) {
  22785. const siz = context.SIZ;
  22786. const componentsCount = siz.Csiz;
  22787. const tile = context.tiles[tileIndex];
  22788. for (let c = 0; c < componentsCount; c++) {
  22789. const component = tile.components[c];
  22790. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  22791. component.quantizationParameters = qcdOrQcc;
  22792. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  22793. component.codingStyleParameters = codOrCoc;
  22794. }
  22795. tile.codingStyleDefaultParameters = context.currentTile.COD;
  22796. }
  22797. class TagTree {
  22798. constructor(width, height) {
  22799. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22800. this.levels = [];
  22801. for (let i = 0; i < levelsLength; i++) {
  22802. const level = {
  22803. width,
  22804. height,
  22805. items: []
  22806. };
  22807. this.levels.push(level);
  22808. width = Math.ceil(width / 2);
  22809. height = Math.ceil(height / 2);
  22810. }
  22811. }
  22812. reset(i, j) {
  22813. let currentLevel = 0,
  22814. value = 0,
  22815. level;
  22816. while (currentLevel < this.levels.length) {
  22817. level = this.levels[currentLevel];
  22818. const index = i + j * level.width;
  22819. if (level.items[index] !== undefined) {
  22820. value = level.items[index];
  22821. break;
  22822. }
  22823. level.index = index;
  22824. i >>= 1;
  22825. j >>= 1;
  22826. currentLevel++;
  22827. }
  22828. currentLevel--;
  22829. level = this.levels[currentLevel];
  22830. level.items[level.index] = value;
  22831. this.currentLevel = currentLevel;
  22832. delete this.value;
  22833. }
  22834. incrementValue() {
  22835. const level = this.levels[this.currentLevel];
  22836. level.items[level.index]++;
  22837. }
  22838. nextLevel() {
  22839. let currentLevel = this.currentLevel;
  22840. let level = this.levels[currentLevel];
  22841. const value = level.items[level.index];
  22842. currentLevel--;
  22843. if (currentLevel < 0) {
  22844. this.value = value;
  22845. return false;
  22846. }
  22847. this.currentLevel = currentLevel;
  22848. level = this.levels[currentLevel];
  22849. level.items[level.index] = value;
  22850. return true;
  22851. }
  22852. }
  22853. class InclusionTree {
  22854. constructor(width, height, defaultValue) {
  22855. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22856. this.levels = [];
  22857. for (let i = 0; i < levelsLength; i++) {
  22858. const items = new Uint8Array(width * height);
  22859. for (let j = 0, jj = items.length; j < jj; j++) {
  22860. items[j] = defaultValue;
  22861. }
  22862. const level = {
  22863. width,
  22864. height,
  22865. items
  22866. };
  22867. this.levels.push(level);
  22868. width = Math.ceil(width / 2);
  22869. height = Math.ceil(height / 2);
  22870. }
  22871. }
  22872. reset(i, j, stopValue) {
  22873. let currentLevel = 0;
  22874. while (currentLevel < this.levels.length) {
  22875. const level = this.levels[currentLevel];
  22876. const index = i + j * level.width;
  22877. level.index = index;
  22878. const value = level.items[index];
  22879. if (value === 0xff) {
  22880. break;
  22881. }
  22882. if (value > stopValue) {
  22883. this.currentLevel = currentLevel;
  22884. this.propagateValues();
  22885. return false;
  22886. }
  22887. i >>= 1;
  22888. j >>= 1;
  22889. currentLevel++;
  22890. }
  22891. this.currentLevel = currentLevel - 1;
  22892. return true;
  22893. }
  22894. incrementValue(stopValue) {
  22895. const level = this.levels[this.currentLevel];
  22896. level.items[level.index] = stopValue + 1;
  22897. this.propagateValues();
  22898. }
  22899. propagateValues() {
  22900. let levelIndex = this.currentLevel;
  22901. let level = this.levels[levelIndex];
  22902. const currentValue = level.items[level.index];
  22903. while (--levelIndex >= 0) {
  22904. level = this.levels[levelIndex];
  22905. level.items[level.index] = currentValue;
  22906. }
  22907. }
  22908. nextLevel() {
  22909. let currentLevel = this.currentLevel;
  22910. let level = this.levels[currentLevel];
  22911. const value = level.items[level.index];
  22912. level.items[level.index] = 0xff;
  22913. currentLevel--;
  22914. if (currentLevel < 0) {
  22915. return false;
  22916. }
  22917. this.currentLevel = currentLevel;
  22918. level = this.levels[currentLevel];
  22919. level.items[level.index] = value;
  22920. return true;
  22921. }
  22922. }
  22923. const BitModel = function BitModelClosure() {
  22924. const UNIFORM_CONTEXT = 17;
  22925. const RUNLENGTH_CONTEXT = 18;
  22926. 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]);
  22927. 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]);
  22928. 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]);
  22929. class BitModel {
  22930. constructor(width, height, subband, zeroBitPlanes, mb) {
  22931. this.width = width;
  22932. this.height = height;
  22933. let contextLabelTable;
  22934. if (subband === "HH") {
  22935. contextLabelTable = HHContextLabel;
  22936. } else if (subband === "HL") {
  22937. contextLabelTable = HLContextLabel;
  22938. } else {
  22939. contextLabelTable = LLAndLHContextsLabel;
  22940. }
  22941. this.contextLabelTable = contextLabelTable;
  22942. const coefficientCount = width * height;
  22943. this.neighborsSignificance = new Uint8Array(coefficientCount);
  22944. this.coefficentsSign = new Uint8Array(coefficientCount);
  22945. let coefficentsMagnitude;
  22946. if (mb > 14) {
  22947. coefficentsMagnitude = new Uint32Array(coefficientCount);
  22948. } else if (mb > 6) {
  22949. coefficentsMagnitude = new Uint16Array(coefficientCount);
  22950. } else {
  22951. coefficentsMagnitude = new Uint8Array(coefficientCount);
  22952. }
  22953. this.coefficentsMagnitude = coefficentsMagnitude;
  22954. this.processingFlags = new Uint8Array(coefficientCount);
  22955. const bitsDecoded = new Uint8Array(coefficientCount);
  22956. if (zeroBitPlanes !== 0) {
  22957. for (let i = 0; i < coefficientCount; i++) {
  22958. bitsDecoded[i] = zeroBitPlanes;
  22959. }
  22960. }
  22961. this.bitsDecoded = bitsDecoded;
  22962. this.reset();
  22963. }
  22964. setDecoder(decoder) {
  22965. this.decoder = decoder;
  22966. }
  22967. reset() {
  22968. this.contexts = new Int8Array(19);
  22969. this.contexts[0] = 4 << 1 | 0;
  22970. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  22971. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  22972. }
  22973. setNeighborsSignificance(row, column, index) {
  22974. const neighborsSignificance = this.neighborsSignificance;
  22975. const width = this.width,
  22976. height = this.height;
  22977. const left = column > 0;
  22978. const right = column + 1 < width;
  22979. let i;
  22980. if (row > 0) {
  22981. i = index - width;
  22982. if (left) {
  22983. neighborsSignificance[i - 1] += 0x10;
  22984. }
  22985. if (right) {
  22986. neighborsSignificance[i + 1] += 0x10;
  22987. }
  22988. neighborsSignificance[i] += 0x04;
  22989. }
  22990. if (row + 1 < height) {
  22991. i = index + width;
  22992. if (left) {
  22993. neighborsSignificance[i - 1] += 0x10;
  22994. }
  22995. if (right) {
  22996. neighborsSignificance[i + 1] += 0x10;
  22997. }
  22998. neighborsSignificance[i] += 0x04;
  22999. }
  23000. if (left) {
  23001. neighborsSignificance[index - 1] += 0x01;
  23002. }
  23003. if (right) {
  23004. neighborsSignificance[index + 1] += 0x01;
  23005. }
  23006. neighborsSignificance[index] |= 0x80;
  23007. }
  23008. runSignificancePropagationPass() {
  23009. const decoder = this.decoder;
  23010. const width = this.width,
  23011. height = this.height;
  23012. const coefficentsMagnitude = this.coefficentsMagnitude;
  23013. const coefficentsSign = this.coefficentsSign;
  23014. const neighborsSignificance = this.neighborsSignificance;
  23015. const processingFlags = this.processingFlags;
  23016. const contexts = this.contexts;
  23017. const labels = this.contextLabelTable;
  23018. const bitsDecoded = this.bitsDecoded;
  23019. const processedInverseMask = ~1;
  23020. const processedMask = 1;
  23021. const firstMagnitudeBitMask = 2;
  23022. for (let i0 = 0; i0 < height; i0 += 4) {
  23023. for (let j = 0; j < width; j++) {
  23024. let index = i0 * width + j;
  23025. for (let i1 = 0; i1 < 4; i1++, index += width) {
  23026. const i = i0 + i1;
  23027. if (i >= height) {
  23028. break;
  23029. }
  23030. processingFlags[index] &= processedInverseMask;
  23031. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  23032. continue;
  23033. }
  23034. const contextLabel = labels[neighborsSignificance[index]];
  23035. const decision = decoder.readBit(contexts, contextLabel);
  23036. if (decision) {
  23037. const sign = this.decodeSignBit(i, j, index);
  23038. coefficentsSign[index] = sign;
  23039. coefficentsMagnitude[index] = 1;
  23040. this.setNeighborsSignificance(i, j, index);
  23041. processingFlags[index] |= firstMagnitudeBitMask;
  23042. }
  23043. bitsDecoded[index]++;
  23044. processingFlags[index] |= processedMask;
  23045. }
  23046. }
  23047. }
  23048. }
  23049. decodeSignBit(row, column, index) {
  23050. const width = this.width,
  23051. height = this.height;
  23052. const coefficentsMagnitude = this.coefficentsMagnitude;
  23053. const coefficentsSign = this.coefficentsSign;
  23054. let contribution, sign0, sign1, significance1;
  23055. let contextLabel, decoded;
  23056. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  23057. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  23058. sign1 = coefficentsSign[index + 1];
  23059. if (significance1) {
  23060. sign0 = coefficentsSign[index - 1];
  23061. contribution = 1 - sign1 - sign0;
  23062. } else {
  23063. contribution = 1 - sign1 - sign1;
  23064. }
  23065. } else if (significance1) {
  23066. sign0 = coefficentsSign[index - 1];
  23067. contribution = 1 - sign0 - sign0;
  23068. } else {
  23069. contribution = 0;
  23070. }
  23071. const horizontalContribution = 3 * contribution;
  23072. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  23073. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  23074. sign1 = coefficentsSign[index + width];
  23075. if (significance1) {
  23076. sign0 = coefficentsSign[index - width];
  23077. contribution = 1 - sign1 - sign0 + horizontalContribution;
  23078. } else {
  23079. contribution = 1 - sign1 - sign1 + horizontalContribution;
  23080. }
  23081. } else if (significance1) {
  23082. sign0 = coefficentsSign[index - width];
  23083. contribution = 1 - sign0 - sign0 + horizontalContribution;
  23084. } else {
  23085. contribution = horizontalContribution;
  23086. }
  23087. if (contribution >= 0) {
  23088. contextLabel = 9 + contribution;
  23089. decoded = this.decoder.readBit(this.contexts, contextLabel);
  23090. } else {
  23091. contextLabel = 9 - contribution;
  23092. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  23093. }
  23094. return decoded;
  23095. }
  23096. runMagnitudeRefinementPass() {
  23097. const decoder = this.decoder;
  23098. const width = this.width,
  23099. height = this.height;
  23100. const coefficentsMagnitude = this.coefficentsMagnitude;
  23101. const neighborsSignificance = this.neighborsSignificance;
  23102. const contexts = this.contexts;
  23103. const bitsDecoded = this.bitsDecoded;
  23104. const processingFlags = this.processingFlags;
  23105. const processedMask = 1;
  23106. const firstMagnitudeBitMask = 2;
  23107. const length = width * height;
  23108. const width4 = width * 4;
  23109. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  23110. indexNext = Math.min(length, index0 + width4);
  23111. for (let j = 0; j < width; j++) {
  23112. for (let index = index0 + j; index < indexNext; index += width) {
  23113. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  23114. continue;
  23115. }
  23116. let contextLabel = 16;
  23117. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  23118. processingFlags[index] ^= firstMagnitudeBitMask;
  23119. const significance = neighborsSignificance[index] & 127;
  23120. contextLabel = significance === 0 ? 15 : 14;
  23121. }
  23122. const bit = decoder.readBit(contexts, contextLabel);
  23123. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  23124. bitsDecoded[index]++;
  23125. processingFlags[index] |= processedMask;
  23126. }
  23127. }
  23128. }
  23129. }
  23130. runCleanupPass() {
  23131. const decoder = this.decoder;
  23132. const width = this.width,
  23133. height = this.height;
  23134. const neighborsSignificance = this.neighborsSignificance;
  23135. const coefficentsMagnitude = this.coefficentsMagnitude;
  23136. const coefficentsSign = this.coefficentsSign;
  23137. const contexts = this.contexts;
  23138. const labels = this.contextLabelTable;
  23139. const bitsDecoded = this.bitsDecoded;
  23140. const processingFlags = this.processingFlags;
  23141. const processedMask = 1;
  23142. const firstMagnitudeBitMask = 2;
  23143. const oneRowDown = width;
  23144. const twoRowsDown = width * 2;
  23145. const threeRowsDown = width * 3;
  23146. let iNext;
  23147. for (let i0 = 0; i0 < height; i0 = iNext) {
  23148. iNext = Math.min(i0 + 4, height);
  23149. const indexBase = i0 * width;
  23150. const checkAllEmpty = i0 + 3 < height;
  23151. for (let j = 0; j < width; j++) {
  23152. const index0 = indexBase + j;
  23153. 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;
  23154. let i1 = 0,
  23155. index = index0;
  23156. let i = i0,
  23157. sign;
  23158. if (allEmpty) {
  23159. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  23160. if (!hasSignificantCoefficent) {
  23161. bitsDecoded[index0]++;
  23162. bitsDecoded[index0 + oneRowDown]++;
  23163. bitsDecoded[index0 + twoRowsDown]++;
  23164. bitsDecoded[index0 + threeRowsDown]++;
  23165. continue;
  23166. }
  23167. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  23168. if (i1 !== 0) {
  23169. i = i0 + i1;
  23170. index += i1 * width;
  23171. }
  23172. sign = this.decodeSignBit(i, j, index);
  23173. coefficentsSign[index] = sign;
  23174. coefficentsMagnitude[index] = 1;
  23175. this.setNeighborsSignificance(i, j, index);
  23176. processingFlags[index] |= firstMagnitudeBitMask;
  23177. index = index0;
  23178. for (let i2 = i0; i2 <= i; i2++, index += width) {
  23179. bitsDecoded[index]++;
  23180. }
  23181. i1++;
  23182. }
  23183. for (i = i0 + i1; i < iNext; i++, index += width) {
  23184. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  23185. continue;
  23186. }
  23187. const contextLabel = labels[neighborsSignificance[index]];
  23188. const decision = decoder.readBit(contexts, contextLabel);
  23189. if (decision === 1) {
  23190. sign = this.decodeSignBit(i, j, index);
  23191. coefficentsSign[index] = sign;
  23192. coefficentsMagnitude[index] = 1;
  23193. this.setNeighborsSignificance(i, j, index);
  23194. processingFlags[index] |= firstMagnitudeBitMask;
  23195. }
  23196. bitsDecoded[index]++;
  23197. }
  23198. }
  23199. }
  23200. }
  23201. checkSegmentationSymbol() {
  23202. const decoder = this.decoder;
  23203. const contexts = this.contexts;
  23204. 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);
  23205. if (symbol !== 0xa) {
  23206. throw new JpxError("Invalid segmentation symbol");
  23207. }
  23208. }
  23209. }
  23210. return BitModel;
  23211. }();
  23212. class Transform {
  23213. constructor() {
  23214. if (this.constructor === Transform) {
  23215. (0, _util.unreachable)("Cannot initialize Transform.");
  23216. }
  23217. }
  23218. calculate(subbands, u0, v0) {
  23219. let ll = subbands[0];
  23220. for (let i = 1, ii = subbands.length; i < ii; i++) {
  23221. ll = this.iterate(ll, subbands[i], u0, v0);
  23222. }
  23223. return ll;
  23224. }
  23225. extend(buffer, offset, size) {
  23226. let i1 = offset - 1,
  23227. j1 = offset + 1;
  23228. let i2 = offset + size - 2,
  23229. j2 = offset + size;
  23230. buffer[i1--] = buffer[j1++];
  23231. buffer[j2++] = buffer[i2--];
  23232. buffer[i1--] = buffer[j1++];
  23233. buffer[j2++] = buffer[i2--];
  23234. buffer[i1--] = buffer[j1++];
  23235. buffer[j2++] = buffer[i2--];
  23236. buffer[i1] = buffer[j1];
  23237. buffer[j2] = buffer[i2];
  23238. }
  23239. filter(x, offset, length) {
  23240. (0, _util.unreachable)("Abstract method `filter` called");
  23241. }
  23242. iterate(ll, hl_lh_hh, u0, v0) {
  23243. const llWidth = ll.width,
  23244. llHeight = ll.height;
  23245. let llItems = ll.items;
  23246. const width = hl_lh_hh.width;
  23247. const height = hl_lh_hh.height;
  23248. const items = hl_lh_hh.items;
  23249. let i, j, k, l, u, v;
  23250. for (k = 0, i = 0; i < llHeight; i++) {
  23251. l = i * 2 * width;
  23252. for (j = 0; j < llWidth; j++, k++, l += 2) {
  23253. items[l] = llItems[k];
  23254. }
  23255. }
  23256. llItems = ll.items = null;
  23257. const bufferPadding = 4;
  23258. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  23259. if (width === 1) {
  23260. if ((u0 & 1) !== 0) {
  23261. for (v = 0, k = 0; v < height; v++, k += width) {
  23262. items[k] *= 0.5;
  23263. }
  23264. }
  23265. } else {
  23266. for (v = 0, k = 0; v < height; v++, k += width) {
  23267. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  23268. this.extend(rowBuffer, bufferPadding, width);
  23269. this.filter(rowBuffer, bufferPadding, width);
  23270. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  23271. }
  23272. }
  23273. let numBuffers = 16;
  23274. const colBuffers = [];
  23275. for (i = 0; i < numBuffers; i++) {
  23276. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  23277. }
  23278. let b,
  23279. currentBuffer = 0;
  23280. ll = bufferPadding + height;
  23281. if (height === 1) {
  23282. if ((v0 & 1) !== 0) {
  23283. for (u = 0; u < width; u++) {
  23284. items[u] *= 0.5;
  23285. }
  23286. }
  23287. } else {
  23288. for (u = 0; u < width; u++) {
  23289. if (currentBuffer === 0) {
  23290. numBuffers = Math.min(width - u, numBuffers);
  23291. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  23292. for (b = 0; b < numBuffers; b++) {
  23293. colBuffers[b][l] = items[k + b];
  23294. }
  23295. }
  23296. currentBuffer = numBuffers;
  23297. }
  23298. currentBuffer--;
  23299. const buffer = colBuffers[currentBuffer];
  23300. this.extend(buffer, bufferPadding, height);
  23301. this.filter(buffer, bufferPadding, height);
  23302. if (currentBuffer === 0) {
  23303. k = u - numBuffers + 1;
  23304. for (l = bufferPadding; l < ll; k += width, l++) {
  23305. for (b = 0; b < numBuffers; b++) {
  23306. items[k + b] = colBuffers[b][l];
  23307. }
  23308. }
  23309. }
  23310. }
  23311. }
  23312. return {
  23313. width,
  23314. height,
  23315. items
  23316. };
  23317. }
  23318. }
  23319. class IrreversibleTransform extends Transform {
  23320. filter(x, offset, length) {
  23321. const len = length >> 1;
  23322. offset |= 0;
  23323. let j, n, current, next;
  23324. const alpha = -1.586134342059924;
  23325. const beta = -0.052980118572961;
  23326. const gamma = 0.882911075530934;
  23327. const delta = 0.443506852043971;
  23328. const K = 1.230174104914001;
  23329. const K_ = 1 / K;
  23330. j = offset - 3;
  23331. for (n = len + 4; n--; j += 2) {
  23332. x[j] *= K_;
  23333. }
  23334. j = offset - 2;
  23335. current = delta * x[j - 1];
  23336. for (n = len + 3; n--; j += 2) {
  23337. next = delta * x[j + 1];
  23338. x[j] = K * x[j] - current - next;
  23339. if (n--) {
  23340. j += 2;
  23341. current = delta * x[j + 1];
  23342. x[j] = K * x[j] - current - next;
  23343. } else {
  23344. break;
  23345. }
  23346. }
  23347. j = offset - 1;
  23348. current = gamma * x[j - 1];
  23349. for (n = len + 2; n--; j += 2) {
  23350. next = gamma * x[j + 1];
  23351. x[j] -= current + next;
  23352. if (n--) {
  23353. j += 2;
  23354. current = gamma * x[j + 1];
  23355. x[j] -= current + next;
  23356. } else {
  23357. break;
  23358. }
  23359. }
  23360. j = offset;
  23361. current = beta * x[j - 1];
  23362. for (n = len + 1; n--; j += 2) {
  23363. next = beta * x[j + 1];
  23364. x[j] -= current + next;
  23365. if (n--) {
  23366. j += 2;
  23367. current = beta * x[j + 1];
  23368. x[j] -= current + next;
  23369. } else {
  23370. break;
  23371. }
  23372. }
  23373. if (len !== 0) {
  23374. j = offset + 1;
  23375. current = alpha * x[j - 1];
  23376. for (n = len; n--; j += 2) {
  23377. next = alpha * x[j + 1];
  23378. x[j] -= current + next;
  23379. if (n--) {
  23380. j += 2;
  23381. current = alpha * x[j + 1];
  23382. x[j] -= current + next;
  23383. } else {
  23384. break;
  23385. }
  23386. }
  23387. }
  23388. }
  23389. }
  23390. class ReversibleTransform extends Transform {
  23391. filter(x, offset, length) {
  23392. const len = length >> 1;
  23393. offset |= 0;
  23394. let j, n;
  23395. for (j = offset, n = len + 1; n--; j += 2) {
  23396. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  23397. }
  23398. for (j = offset + 1, n = len; n--; j += 2) {
  23399. x[j] += x[j - 1] + x[j + 1] >> 1;
  23400. }
  23401. }
  23402. }
  23403. /***/ }),
  23404. /* 160 */
  23405. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23406. "use strict";
  23407. Object.defineProperty(exports, "__esModule", ({
  23408. value: true
  23409. }));
  23410. exports.LZWStream = void 0;
  23411. var _decode_stream = __w_pdfjs_require__(148);
  23412. class LZWStream extends _decode_stream.DecodeStream {
  23413. constructor(str, maybeLength, earlyChange) {
  23414. super(maybeLength);
  23415. this.str = str;
  23416. this.dict = str.dict;
  23417. this.cachedData = 0;
  23418. this.bitsCached = 0;
  23419. const maxLzwDictionarySize = 4096;
  23420. const lzwState = {
  23421. earlyChange,
  23422. codeLength: 9,
  23423. nextCode: 258,
  23424. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  23425. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  23426. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  23427. currentSequence: new Uint8Array(maxLzwDictionarySize),
  23428. currentSequenceLength: 0
  23429. };
  23430. for (let i = 0; i < 256; ++i) {
  23431. lzwState.dictionaryValues[i] = i;
  23432. lzwState.dictionaryLengths[i] = 1;
  23433. }
  23434. this.lzwState = lzwState;
  23435. }
  23436. readBits(n) {
  23437. let bitsCached = this.bitsCached;
  23438. let cachedData = this.cachedData;
  23439. while (bitsCached < n) {
  23440. const c = this.str.getByte();
  23441. if (c === -1) {
  23442. this.eof = true;
  23443. return null;
  23444. }
  23445. cachedData = cachedData << 8 | c;
  23446. bitsCached += 8;
  23447. }
  23448. this.bitsCached = bitsCached -= n;
  23449. this.cachedData = cachedData;
  23450. this.lastCode = null;
  23451. return cachedData >>> bitsCached & (1 << n) - 1;
  23452. }
  23453. readBlock() {
  23454. const blockSize = 512,
  23455. decodedSizeDelta = blockSize;
  23456. let estimatedDecodedSize = blockSize * 2;
  23457. let i, j, q;
  23458. const lzwState = this.lzwState;
  23459. if (!lzwState) {
  23460. return;
  23461. }
  23462. const earlyChange = lzwState.earlyChange;
  23463. let nextCode = lzwState.nextCode;
  23464. const dictionaryValues = lzwState.dictionaryValues;
  23465. const dictionaryLengths = lzwState.dictionaryLengths;
  23466. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  23467. let codeLength = lzwState.codeLength;
  23468. let prevCode = lzwState.prevCode;
  23469. const currentSequence = lzwState.currentSequence;
  23470. let currentSequenceLength = lzwState.currentSequenceLength;
  23471. let decodedLength = 0;
  23472. let currentBufferLength = this.bufferLength;
  23473. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23474. for (i = 0; i < blockSize; i++) {
  23475. const code = this.readBits(codeLength);
  23476. const hasPrev = currentSequenceLength > 0;
  23477. if (code < 256) {
  23478. currentSequence[0] = code;
  23479. currentSequenceLength = 1;
  23480. } else if (code >= 258) {
  23481. if (code < nextCode) {
  23482. currentSequenceLength = dictionaryLengths[code];
  23483. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  23484. currentSequence[j] = dictionaryValues[q];
  23485. q = dictionaryPrevCodes[q];
  23486. }
  23487. } else {
  23488. currentSequence[currentSequenceLength++] = currentSequence[0];
  23489. }
  23490. } else if (code === 256) {
  23491. codeLength = 9;
  23492. nextCode = 258;
  23493. currentSequenceLength = 0;
  23494. continue;
  23495. } else {
  23496. this.eof = true;
  23497. delete this.lzwState;
  23498. break;
  23499. }
  23500. if (hasPrev) {
  23501. dictionaryPrevCodes[nextCode] = prevCode;
  23502. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  23503. dictionaryValues[nextCode] = currentSequence[0];
  23504. nextCode++;
  23505. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  23506. }
  23507. prevCode = code;
  23508. decodedLength += currentSequenceLength;
  23509. if (estimatedDecodedSize < decodedLength) {
  23510. do {
  23511. estimatedDecodedSize += decodedSizeDelta;
  23512. } while (estimatedDecodedSize < decodedLength);
  23513. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23514. }
  23515. for (j = 0; j < currentSequenceLength; j++) {
  23516. buffer[currentBufferLength++] = currentSequence[j];
  23517. }
  23518. }
  23519. lzwState.nextCode = nextCode;
  23520. lzwState.codeLength = codeLength;
  23521. lzwState.prevCode = prevCode;
  23522. lzwState.currentSequenceLength = currentSequenceLength;
  23523. this.bufferLength = currentBufferLength;
  23524. }
  23525. }
  23526. exports.LZWStream = LZWStream;
  23527. /***/ }),
  23528. /* 161 */
  23529. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23530. "use strict";
  23531. Object.defineProperty(exports, "__esModule", ({
  23532. value: true
  23533. }));
  23534. exports.PredictorStream = void 0;
  23535. var _decode_stream = __w_pdfjs_require__(148);
  23536. var _primitives = __w_pdfjs_require__(134);
  23537. var _util = __w_pdfjs_require__(2);
  23538. class PredictorStream extends _decode_stream.DecodeStream {
  23539. constructor(str, maybeLength, params) {
  23540. super(maybeLength);
  23541. if (!(params instanceof _primitives.Dict)) {
  23542. return str;
  23543. }
  23544. const predictor = this.predictor = params.get("Predictor") || 1;
  23545. if (predictor <= 1) {
  23546. return str;
  23547. }
  23548. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  23549. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23550. }
  23551. if (predictor === 2) {
  23552. this.readBlock = this.readBlockTiff;
  23553. } else {
  23554. this.readBlock = this.readBlockPng;
  23555. }
  23556. this.str = str;
  23557. this.dict = str.dict;
  23558. const colors = this.colors = params.get("Colors") || 1;
  23559. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  23560. const columns = this.columns = params.get("Columns") || 1;
  23561. this.pixBytes = colors * bits + 7 >> 3;
  23562. this.rowBytes = columns * colors * bits + 7 >> 3;
  23563. return this;
  23564. }
  23565. readBlockTiff() {
  23566. const rowBytes = this.rowBytes;
  23567. const bufferLength = this.bufferLength;
  23568. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23569. const bits = this.bits;
  23570. const colors = this.colors;
  23571. const rawBytes = this.str.getBytes(rowBytes);
  23572. this.eof = !rawBytes.length;
  23573. if (this.eof) {
  23574. return;
  23575. }
  23576. let inbuf = 0,
  23577. outbuf = 0;
  23578. let inbits = 0,
  23579. outbits = 0;
  23580. let pos = bufferLength;
  23581. let i;
  23582. if (bits === 1 && colors === 1) {
  23583. for (i = 0; i < rowBytes; ++i) {
  23584. let c = rawBytes[i] ^ inbuf;
  23585. c ^= c >> 1;
  23586. c ^= c >> 2;
  23587. c ^= c >> 4;
  23588. inbuf = (c & 1) << 7;
  23589. buffer[pos++] = c;
  23590. }
  23591. } else if (bits === 8) {
  23592. for (i = 0; i < colors; ++i) {
  23593. buffer[pos++] = rawBytes[i];
  23594. }
  23595. for (; i < rowBytes; ++i) {
  23596. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  23597. pos++;
  23598. }
  23599. } else if (bits === 16) {
  23600. const bytesPerPixel = colors * 2;
  23601. for (i = 0; i < bytesPerPixel; ++i) {
  23602. buffer[pos++] = rawBytes[i];
  23603. }
  23604. for (; i < rowBytes; i += 2) {
  23605. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  23606. buffer[pos++] = sum >> 8 & 0xff;
  23607. buffer[pos++] = sum & 0xff;
  23608. }
  23609. } else {
  23610. const compArray = new Uint8Array(colors + 1);
  23611. const bitMask = (1 << bits) - 1;
  23612. let j = 0,
  23613. k = bufferLength;
  23614. const columns = this.columns;
  23615. for (i = 0; i < columns; ++i) {
  23616. for (let kk = 0; kk < colors; ++kk) {
  23617. if (inbits < bits) {
  23618. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  23619. inbits += 8;
  23620. }
  23621. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  23622. inbits -= bits;
  23623. outbuf = outbuf << bits | compArray[kk];
  23624. outbits += bits;
  23625. if (outbits >= 8) {
  23626. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  23627. outbits -= 8;
  23628. }
  23629. }
  23630. }
  23631. if (outbits > 0) {
  23632. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  23633. }
  23634. }
  23635. this.bufferLength += rowBytes;
  23636. }
  23637. readBlockPng() {
  23638. const rowBytes = this.rowBytes;
  23639. const pixBytes = this.pixBytes;
  23640. const predictor = this.str.getByte();
  23641. const rawBytes = this.str.getBytes(rowBytes);
  23642. this.eof = !rawBytes.length;
  23643. if (this.eof) {
  23644. return;
  23645. }
  23646. const bufferLength = this.bufferLength;
  23647. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23648. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  23649. if (prevRow.length === 0) {
  23650. prevRow = new Uint8Array(rowBytes);
  23651. }
  23652. let i,
  23653. j = bufferLength,
  23654. up,
  23655. c;
  23656. switch (predictor) {
  23657. case 0:
  23658. for (i = 0; i < rowBytes; ++i) {
  23659. buffer[j++] = rawBytes[i];
  23660. }
  23661. break;
  23662. case 1:
  23663. for (i = 0; i < pixBytes; ++i) {
  23664. buffer[j++] = rawBytes[i];
  23665. }
  23666. for (; i < rowBytes; ++i) {
  23667. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  23668. j++;
  23669. }
  23670. break;
  23671. case 2:
  23672. for (i = 0; i < rowBytes; ++i) {
  23673. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  23674. }
  23675. break;
  23676. case 3:
  23677. for (i = 0; i < pixBytes; ++i) {
  23678. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  23679. }
  23680. for (; i < rowBytes; ++i) {
  23681. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  23682. j++;
  23683. }
  23684. break;
  23685. case 4:
  23686. for (i = 0; i < pixBytes; ++i) {
  23687. up = prevRow[i];
  23688. c = rawBytes[i];
  23689. buffer[j++] = up + c;
  23690. }
  23691. for (; i < rowBytes; ++i) {
  23692. up = prevRow[i];
  23693. const upLeft = prevRow[i - pixBytes];
  23694. const left = buffer[j - pixBytes];
  23695. const p = left + up - upLeft;
  23696. let pa = p - left;
  23697. if (pa < 0) {
  23698. pa = -pa;
  23699. }
  23700. let pb = p - up;
  23701. if (pb < 0) {
  23702. pb = -pb;
  23703. }
  23704. let pc = p - upLeft;
  23705. if (pc < 0) {
  23706. pc = -pc;
  23707. }
  23708. c = rawBytes[i];
  23709. if (pa <= pb && pa <= pc) {
  23710. buffer[j++] = left + c;
  23711. } else if (pb <= pc) {
  23712. buffer[j++] = up + c;
  23713. } else {
  23714. buffer[j++] = upLeft + c;
  23715. }
  23716. }
  23717. break;
  23718. default:
  23719. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23720. }
  23721. this.bufferLength += rowBytes;
  23722. }
  23723. }
  23724. exports.PredictorStream = PredictorStream;
  23725. /***/ }),
  23726. /* 162 */
  23727. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23728. "use strict";
  23729. Object.defineProperty(exports, "__esModule", ({
  23730. value: true
  23731. }));
  23732. exports.RunLengthStream = void 0;
  23733. var _decode_stream = __w_pdfjs_require__(148);
  23734. class RunLengthStream extends _decode_stream.DecodeStream {
  23735. constructor(str, maybeLength) {
  23736. super(maybeLength);
  23737. this.str = str;
  23738. this.dict = str.dict;
  23739. }
  23740. readBlock() {
  23741. const repeatHeader = this.str.getBytes(2);
  23742. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  23743. this.eof = true;
  23744. return;
  23745. }
  23746. let buffer;
  23747. let bufferLength = this.bufferLength;
  23748. let n = repeatHeader[0];
  23749. if (n < 128) {
  23750. buffer = this.ensureBuffer(bufferLength + n + 1);
  23751. buffer[bufferLength++] = repeatHeader[1];
  23752. if (n > 0) {
  23753. const source = this.str.getBytes(n);
  23754. buffer.set(source, bufferLength);
  23755. bufferLength += n;
  23756. }
  23757. } else {
  23758. n = 257 - n;
  23759. const b = repeatHeader[1];
  23760. buffer = this.ensureBuffer(bufferLength + n + 1);
  23761. for (let i = 0; i < n; i++) {
  23762. buffer[bufferLength++] = b;
  23763. }
  23764. }
  23765. this.bufferLength = bufferLength;
  23766. }
  23767. }
  23768. exports.RunLengthStream = RunLengthStream;
  23769. /***/ }),
  23770. /* 163 */
  23771. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23772. "use strict";
  23773. Object.defineProperty(exports, "__esModule", ({
  23774. value: true
  23775. }));
  23776. exports.Font = exports.ErrorFont = void 0;
  23777. var _util = __w_pdfjs_require__(2);
  23778. var _cff_parser = __w_pdfjs_require__(164);
  23779. var _fonts_utils = __w_pdfjs_require__(167);
  23780. var _unicode = __w_pdfjs_require__(169);
  23781. var _glyphlist = __w_pdfjs_require__(168);
  23782. var _encodings = __w_pdfjs_require__(166);
  23783. var _standard_fonts = __w_pdfjs_require__(170);
  23784. var _to_unicode_map = __w_pdfjs_require__(171);
  23785. var _cff_font = __w_pdfjs_require__(172);
  23786. var _font_renderer = __w_pdfjs_require__(173);
  23787. var _metrics = __w_pdfjs_require__(174);
  23788. var _glyf = __w_pdfjs_require__(175);
  23789. var _cmap = __w_pdfjs_require__(145);
  23790. var _opentype_file_builder = __w_pdfjs_require__(176);
  23791. var _core_utils = __w_pdfjs_require__(135);
  23792. var _stream = __w_pdfjs_require__(139);
  23793. var _type1_font = __w_pdfjs_require__(177);
  23794. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  23795. const PDF_GLYPH_SPACE_UNITS = 1000;
  23796. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  23797. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  23798. function adjustWidths(properties) {
  23799. if (!properties.fontMatrix) {
  23800. return;
  23801. }
  23802. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  23803. return;
  23804. }
  23805. const scale = 0.001 / properties.fontMatrix[0];
  23806. const glyphsWidths = properties.widths;
  23807. for (const glyph in glyphsWidths) {
  23808. glyphsWidths[glyph] *= scale;
  23809. }
  23810. properties.defaultWidth *= scale;
  23811. }
  23812. function adjustToUnicode(properties, builtInEncoding) {
  23813. if (properties.isInternalFont) {
  23814. return;
  23815. }
  23816. if (properties.hasIncludedToUnicodeMap) {
  23817. return;
  23818. }
  23819. if (builtInEncoding === properties.defaultEncoding) {
  23820. return;
  23821. }
  23822. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23823. return;
  23824. }
  23825. const toUnicode = [],
  23826. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23827. for (const charCode in builtInEncoding) {
  23828. if (properties.hasEncoding) {
  23829. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  23830. continue;
  23831. }
  23832. }
  23833. const glyphName = builtInEncoding[charCode];
  23834. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  23835. if (unicode !== -1) {
  23836. toUnicode[charCode] = String.fromCharCode(unicode);
  23837. }
  23838. }
  23839. if (toUnicode.length > 0) {
  23840. properties.toUnicode.amend(toUnicode);
  23841. }
  23842. }
  23843. function amendFallbackToUnicode(properties) {
  23844. if (!properties.fallbackToUnicode) {
  23845. return;
  23846. }
  23847. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23848. return;
  23849. }
  23850. const toUnicode = [];
  23851. for (const charCode in properties.fallbackToUnicode) {
  23852. if (properties.toUnicode.has(charCode)) {
  23853. continue;
  23854. }
  23855. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  23856. }
  23857. if (toUnicode.length > 0) {
  23858. properties.toUnicode.amend(toUnicode);
  23859. }
  23860. }
  23861. class Glyph {
  23862. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  23863. this.originalCharCode = originalCharCode;
  23864. this.fontChar = fontChar;
  23865. this.unicode = unicode;
  23866. this.accent = accent;
  23867. this.width = width;
  23868. this.vmetric = vmetric;
  23869. this.operatorListId = operatorListId;
  23870. this.isSpace = isSpace;
  23871. this.isInFont = isInFont;
  23872. }
  23873. get category() {
  23874. return (0, _util.shadow)(this, "category", (0, _unicode.getCharUnicodeCategory)(this.unicode), true);
  23875. }
  23876. get normalizedUnicode() {
  23877. return (0, _util.shadow)(this, "normalizedUnicode", (0, _unicode.reverseIfRtl)(Glyph._NormalizedUnicodes[this.unicode] || this.unicode), true);
  23878. }
  23879. static get _NormalizedUnicodes() {
  23880. return (0, _util.shadow)(this, "_NormalizedUnicodes", (0, _unicode.getNormalizedUnicodes)());
  23881. }
  23882. }
  23883. function int16(b0, b1) {
  23884. return (b0 << 8) + b1;
  23885. }
  23886. function writeSignedInt16(bytes, index, value) {
  23887. bytes[index + 1] = value;
  23888. bytes[index] = value >>> 8;
  23889. }
  23890. function signedInt16(b0, b1) {
  23891. const value = (b0 << 8) + b1;
  23892. return value & 1 << 15 ? value - 0x10000 : value;
  23893. }
  23894. function int32(b0, b1, b2, b3) {
  23895. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  23896. }
  23897. function string16(value) {
  23898. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23899. }
  23900. function safeString16(value) {
  23901. if (value > 0x7fff) {
  23902. value = 0x7fff;
  23903. } else if (value < -0x8000) {
  23904. value = -0x8000;
  23905. }
  23906. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23907. }
  23908. function isTrueTypeFile(file) {
  23909. const header = file.peekBytes(4);
  23910. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  23911. }
  23912. function isTrueTypeCollectionFile(file) {
  23913. const header = file.peekBytes(4);
  23914. return (0, _util.bytesToString)(header) === "ttcf";
  23915. }
  23916. function isOpenTypeFile(file) {
  23917. const header = file.peekBytes(4);
  23918. return (0, _util.bytesToString)(header) === "OTTO";
  23919. }
  23920. function isType1File(file) {
  23921. const header = file.peekBytes(2);
  23922. if (header[0] === 0x25 && header[1] === 0x21) {
  23923. return true;
  23924. }
  23925. if (header[0] === 0x80 && header[1] === 0x01) {
  23926. return true;
  23927. }
  23928. return false;
  23929. }
  23930. function isCFFFile(file) {
  23931. const header = file.peekBytes(4);
  23932. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  23933. return true;
  23934. }
  23935. return false;
  23936. }
  23937. function getFontFileType(file, _ref) {
  23938. let {
  23939. type,
  23940. subtype,
  23941. composite
  23942. } = _ref;
  23943. let fileType, fileSubtype;
  23944. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  23945. if (composite) {
  23946. fileType = "CIDFontType2";
  23947. } else {
  23948. fileType = "TrueType";
  23949. }
  23950. } else if (isOpenTypeFile(file)) {
  23951. if (composite) {
  23952. fileType = "CIDFontType2";
  23953. } else {
  23954. fileType = "OpenType";
  23955. }
  23956. } else if (isType1File(file)) {
  23957. if (composite) {
  23958. fileType = "CIDFontType0";
  23959. } else {
  23960. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23961. }
  23962. } else if (isCFFFile(file)) {
  23963. if (composite) {
  23964. fileType = "CIDFontType0";
  23965. fileSubtype = "CIDFontType0C";
  23966. } else {
  23967. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23968. fileSubtype = "Type1C";
  23969. }
  23970. } else {
  23971. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  23972. fileType = type;
  23973. fileSubtype = subtype;
  23974. }
  23975. return [fileType, fileSubtype];
  23976. }
  23977. function applyStandardFontGlyphMap(map, glyphMap) {
  23978. for (const charCode in glyphMap) {
  23979. map[+charCode] = glyphMap[charCode];
  23980. }
  23981. }
  23982. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  23983. const toFontChar = [];
  23984. let unicode;
  23985. for (let i = 0, ii = encoding.length; i < ii; i++) {
  23986. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  23987. if (unicode !== -1) {
  23988. toFontChar[i] = unicode;
  23989. }
  23990. }
  23991. for (const charCode in differences) {
  23992. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  23993. if (unicode !== -1) {
  23994. toFontChar[+charCode] = unicode;
  23995. }
  23996. }
  23997. return toFontChar;
  23998. }
  23999. function convertCidString(charCode, cid) {
  24000. let shouldThrow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  24001. switch (cid.length) {
  24002. case 1:
  24003. return cid.charCodeAt(0);
  24004. case 2:
  24005. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  24006. }
  24007. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  24008. if (shouldThrow) {
  24009. throw new _util.FormatError(msg);
  24010. }
  24011. (0, _util.warn)(msg);
  24012. return cid;
  24013. }
  24014. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  24015. const newMap = Object.create(null);
  24016. const toUnicodeExtraMap = new Map();
  24017. const toFontChar = [];
  24018. const usedGlyphIds = new Set();
  24019. let privateUseAreaIndex = 0;
  24020. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  24021. let nextAvailableFontCharCode = privateUseOffetStart;
  24022. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  24023. for (let originalCharCode in charCodeToGlyphId) {
  24024. originalCharCode |= 0;
  24025. let glyphId = charCodeToGlyphId[originalCharCode];
  24026. if (!hasGlyph(glyphId)) {
  24027. continue;
  24028. }
  24029. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  24030. privateUseAreaIndex++;
  24031. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  24032. (0, _util.warn)("Ran out of space in font private use area.");
  24033. break;
  24034. }
  24035. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  24036. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  24037. }
  24038. const fontCharCode = nextAvailableFontCharCode++;
  24039. if (glyphId === 0) {
  24040. glyphId = newGlyphZeroId;
  24041. }
  24042. let unicode = toUnicode.get(originalCharCode);
  24043. if (typeof unicode === "string") {
  24044. unicode = unicode.codePointAt(0);
  24045. }
  24046. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  24047. toUnicodeExtraMap.set(unicode, glyphId);
  24048. usedGlyphIds.add(glyphId);
  24049. }
  24050. newMap[fontCharCode] = glyphId;
  24051. toFontChar[originalCharCode] = fontCharCode;
  24052. }
  24053. return {
  24054. toFontChar,
  24055. charCodeToGlyphId: newMap,
  24056. toUnicodeExtraMap,
  24057. nextAvailableFontCharCode
  24058. };
  24059. }
  24060. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  24061. const codes = [];
  24062. for (const charCode in glyphs) {
  24063. if (glyphs[charCode] >= numGlyphs) {
  24064. continue;
  24065. }
  24066. codes.push({
  24067. fontCharCode: charCode | 0,
  24068. glyphId: glyphs[charCode]
  24069. });
  24070. }
  24071. if (toUnicodeExtraMap) {
  24072. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  24073. if (glyphId >= numGlyphs) {
  24074. continue;
  24075. }
  24076. codes.push({
  24077. fontCharCode: unicode,
  24078. glyphId
  24079. });
  24080. }
  24081. }
  24082. if (codes.length === 0) {
  24083. codes.push({
  24084. fontCharCode: 0,
  24085. glyphId: 0
  24086. });
  24087. }
  24088. codes.sort(function fontGetRangesSort(a, b) {
  24089. return a.fontCharCode - b.fontCharCode;
  24090. });
  24091. const ranges = [];
  24092. const length = codes.length;
  24093. for (let n = 0; n < length;) {
  24094. const start = codes[n].fontCharCode;
  24095. const codeIndices = [codes[n].glyphId];
  24096. ++n;
  24097. let end = start;
  24098. while (n < length && end + 1 === codes[n].fontCharCode) {
  24099. codeIndices.push(codes[n].glyphId);
  24100. ++end;
  24101. ++n;
  24102. if (end === 0xffff) {
  24103. break;
  24104. }
  24105. }
  24106. ranges.push([start, end, codeIndices]);
  24107. }
  24108. return ranges;
  24109. }
  24110. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  24111. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  24112. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  24113. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  24114. let i, ii, j, jj;
  24115. for (i = ranges.length - 1; i >= 0; --i) {
  24116. if (ranges[i][0] <= 0xffff) {
  24117. break;
  24118. }
  24119. }
  24120. const bmpLength = i + 1;
  24121. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  24122. ranges[i][1] = 0xfffe;
  24123. }
  24124. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  24125. const segCount = bmpLength + trailingRangesCount;
  24126. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  24127. let startCount = "";
  24128. let endCount = "";
  24129. let idDeltas = "";
  24130. let idRangeOffsets = "";
  24131. let glyphsIds = "";
  24132. let bias = 0;
  24133. let range, start, end, codes;
  24134. for (i = 0, ii = bmpLength; i < ii; i++) {
  24135. range = ranges[i];
  24136. start = range[0];
  24137. end = range[1];
  24138. startCount += string16(start);
  24139. endCount += string16(end);
  24140. codes = range[2];
  24141. let contiguous = true;
  24142. for (j = 1, jj = codes.length; j < jj; ++j) {
  24143. if (codes[j] !== codes[j - 1] + 1) {
  24144. contiguous = false;
  24145. break;
  24146. }
  24147. }
  24148. if (!contiguous) {
  24149. const offset = (segCount - i) * 2 + bias * 2;
  24150. bias += end - start + 1;
  24151. idDeltas += string16(0);
  24152. idRangeOffsets += string16(offset);
  24153. for (j = 0, jj = codes.length; j < jj; ++j) {
  24154. glyphsIds += string16(codes[j]);
  24155. }
  24156. } else {
  24157. const startCode = codes[0];
  24158. idDeltas += string16(startCode - start & 0xffff);
  24159. idRangeOffsets += string16(0);
  24160. }
  24161. }
  24162. if (trailingRangesCount > 0) {
  24163. endCount += "\xFF\xFF";
  24164. startCount += "\xFF\xFF";
  24165. idDeltas += "\x00\x01";
  24166. idRangeOffsets += "\x00\x00";
  24167. }
  24168. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  24169. let format31012 = "";
  24170. let header31012 = "";
  24171. if (numTables > 1) {
  24172. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  24173. format31012 = "";
  24174. for (i = 0, ii = ranges.length; i < ii; i++) {
  24175. range = ranges[i];
  24176. start = range[0];
  24177. codes = range[2];
  24178. let code = codes[0];
  24179. for (j = 1, jj = codes.length; j < jj; ++j) {
  24180. if (codes[j] !== codes[j - 1] + 1) {
  24181. end = range[0] + j - 1;
  24182. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  24183. start = end + 1;
  24184. code = codes[j];
  24185. }
  24186. }
  24187. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  24188. }
  24189. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  24190. }
  24191. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  24192. }
  24193. function validateOS2Table(os2, file) {
  24194. file.pos = (file.start || 0) + os2.offset;
  24195. const version = file.getUint16();
  24196. file.skip(60);
  24197. const selection = file.getUint16();
  24198. if (version < 4 && selection & 0x0300) {
  24199. return false;
  24200. }
  24201. const firstChar = file.getUint16();
  24202. const lastChar = file.getUint16();
  24203. if (firstChar > lastChar) {
  24204. return false;
  24205. }
  24206. file.skip(6);
  24207. const usWinAscent = file.getUint16();
  24208. if (usWinAscent === 0) {
  24209. return false;
  24210. }
  24211. os2.data[8] = os2.data[9] = 0;
  24212. return true;
  24213. }
  24214. function createOS2Table(properties, charstrings, override) {
  24215. override = override || {
  24216. unitsPerEm: 0,
  24217. yMax: 0,
  24218. yMin: 0,
  24219. ascent: 0,
  24220. descent: 0
  24221. };
  24222. let ulUnicodeRange1 = 0;
  24223. let ulUnicodeRange2 = 0;
  24224. let ulUnicodeRange3 = 0;
  24225. let ulUnicodeRange4 = 0;
  24226. let firstCharIndex = null;
  24227. let lastCharIndex = 0;
  24228. if (charstrings) {
  24229. for (let code in charstrings) {
  24230. code |= 0;
  24231. if (firstCharIndex > code || !firstCharIndex) {
  24232. firstCharIndex = code;
  24233. }
  24234. if (lastCharIndex < code) {
  24235. lastCharIndex = code;
  24236. }
  24237. const position = (0, _unicode.getUnicodeRangeFor)(code);
  24238. if (position < 32) {
  24239. ulUnicodeRange1 |= 1 << position;
  24240. } else if (position < 64) {
  24241. ulUnicodeRange2 |= 1 << position - 32;
  24242. } else if (position < 96) {
  24243. ulUnicodeRange3 |= 1 << position - 64;
  24244. } else if (position < 123) {
  24245. ulUnicodeRange4 |= 1 << position - 96;
  24246. } else {
  24247. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  24248. }
  24249. }
  24250. if (lastCharIndex > 0xffff) {
  24251. lastCharIndex = 0xffff;
  24252. }
  24253. } else {
  24254. firstCharIndex = 0;
  24255. lastCharIndex = 255;
  24256. }
  24257. const bbox = properties.bbox || [0, 0, 0, 0];
  24258. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  24259. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  24260. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  24261. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  24262. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  24263. typoDescent = -typoDescent;
  24264. }
  24265. const winAscent = override.yMax || typoAscent;
  24266. const winDescent = -override.yMin || -typoDescent;
  24267. 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";
  24268. }
  24269. function createPostTable(properties) {
  24270. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  24271. 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";
  24272. }
  24273. function createPostscriptName(name) {
  24274. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  24275. }
  24276. function createNameTable(name, proto) {
  24277. if (!proto) {
  24278. proto = [[], []];
  24279. }
  24280. 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"];
  24281. const stringsUnicode = [];
  24282. let i, ii, j, jj, str;
  24283. for (i = 0, ii = strings.length; i < ii; i++) {
  24284. str = proto[1][i] || strings[i];
  24285. const strBufUnicode = [];
  24286. for (j = 0, jj = str.length; j < jj; j++) {
  24287. strBufUnicode.push(string16(str.charCodeAt(j)));
  24288. }
  24289. stringsUnicode.push(strBufUnicode.join(""));
  24290. }
  24291. const names = [strings, stringsUnicode];
  24292. const platforms = ["\x00\x01", "\x00\x03"];
  24293. const encodings = ["\x00\x00", "\x00\x01"];
  24294. const languages = ["\x00\x00", "\x04\x09"];
  24295. const namesRecordCount = strings.length * platforms.length;
  24296. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  24297. let strOffset = 0;
  24298. for (i = 0, ii = platforms.length; i < ii; i++) {
  24299. const strs = names[i];
  24300. for (j = 0, jj = strs.length; j < jj; j++) {
  24301. str = strs[j];
  24302. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  24303. nameTable += nameRecord;
  24304. strOffset += str.length;
  24305. }
  24306. }
  24307. nameTable += strings.join("") + stringsUnicode.join("");
  24308. return nameTable;
  24309. }
  24310. class Font {
  24311. constructor(name, file, properties) {
  24312. this.name = name;
  24313. this.psName = null;
  24314. this.mimetype = null;
  24315. this.disableFontFace = false;
  24316. this.loadedName = properties.loadedName;
  24317. this.isType3Font = properties.isType3Font;
  24318. this.missingFile = false;
  24319. this.cssFontInfo = properties.cssFontInfo;
  24320. this._charsCache = Object.create(null);
  24321. this._glyphCache = Object.create(null);
  24322. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  24323. if (!isSerifFont && !properties.isSimulatedFlags) {
  24324. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  24325. serifFonts = (0, _standard_fonts.getSerifFonts)();
  24326. for (const namePart of baseName.split("+")) {
  24327. if (serifFonts[namePart]) {
  24328. isSerifFont = true;
  24329. break;
  24330. }
  24331. }
  24332. }
  24333. this.isSerifFont = isSerifFont;
  24334. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  24335. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  24336. let type = properties.type;
  24337. let subtype = properties.subtype;
  24338. this.type = type;
  24339. this.subtype = subtype;
  24340. const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
  24341. this.isInvalidPDFjsFont = !!matches;
  24342. if (this.isInvalidPDFjsFont) {
  24343. this.fallbackName = matches[1];
  24344. } else if (this.isMonospace) {
  24345. this.fallbackName = "monospace";
  24346. } else if (this.isSerifFont) {
  24347. this.fallbackName = "serif";
  24348. } else {
  24349. this.fallbackName = "sans-serif";
  24350. }
  24351. this.differences = properties.differences;
  24352. this.widths = properties.widths;
  24353. this.defaultWidth = properties.defaultWidth;
  24354. this.composite = properties.composite;
  24355. this.cMap = properties.cMap;
  24356. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  24357. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  24358. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  24359. this.lineHeight = this.ascent - this.descent;
  24360. this.fontMatrix = properties.fontMatrix;
  24361. this.bbox = properties.bbox;
  24362. this.defaultEncoding = properties.defaultEncoding;
  24363. this.toUnicode = properties.toUnicode;
  24364. this.toFontChar = [];
  24365. if (properties.type === "Type3") {
  24366. for (let charCode = 0; charCode < 256; charCode++) {
  24367. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  24368. }
  24369. this.fontType = _util.FontType.TYPE3;
  24370. return;
  24371. }
  24372. this.cidEncoding = properties.cidEncoding || "";
  24373. this.vertical = !!properties.vertical;
  24374. if (this.vertical) {
  24375. this.vmetrics = properties.vmetrics;
  24376. this.defaultVMetrics = properties.defaultVMetrics;
  24377. }
  24378. if (!file || file.isEmpty) {
  24379. if (file) {
  24380. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  24381. }
  24382. this.fallbackToSystemFont(properties);
  24383. return;
  24384. }
  24385. [type, subtype] = getFontFileType(file, properties);
  24386. if (type !== this.type || subtype !== this.subtype) {
  24387. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  24388. }
  24389. let data;
  24390. try {
  24391. switch (type) {
  24392. case "MMType1":
  24393. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  24394. case "Type1":
  24395. case "CIDFontType0":
  24396. this.mimetype = "font/opentype";
  24397. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  24398. adjustWidths(properties);
  24399. data = this.convert(name, cff, properties);
  24400. break;
  24401. case "OpenType":
  24402. case "TrueType":
  24403. case "CIDFontType2":
  24404. this.mimetype = "font/opentype";
  24405. data = this.checkAndRepair(name, file, properties);
  24406. if (this.isOpenType) {
  24407. adjustWidths(properties);
  24408. type = "OpenType";
  24409. }
  24410. break;
  24411. default:
  24412. throw new _util.FormatError(`Font ${type} is not supported`);
  24413. }
  24414. } catch (e) {
  24415. (0, _util.warn)(e);
  24416. this.fallbackToSystemFont(properties);
  24417. return;
  24418. }
  24419. amendFallbackToUnicode(properties);
  24420. this.data = data;
  24421. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  24422. this.fontMatrix = properties.fontMatrix;
  24423. this.widths = properties.widths;
  24424. this.defaultWidth = properties.defaultWidth;
  24425. this.toUnicode = properties.toUnicode;
  24426. this.seacMap = properties.seacMap;
  24427. }
  24428. get renderer() {
  24429. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  24430. return (0, _util.shadow)(this, "renderer", renderer);
  24431. }
  24432. exportData() {
  24433. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  24434. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  24435. const data = Object.create(null);
  24436. let property, value;
  24437. for (property of exportDataProperties) {
  24438. value = this[property];
  24439. if (value !== undefined) {
  24440. data[property] = value;
  24441. }
  24442. }
  24443. return data;
  24444. }
  24445. fallbackToSystemFont(properties) {
  24446. this.missingFile = true;
  24447. const name = this.name;
  24448. const type = this.type;
  24449. const subtype = this.subtype;
  24450. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  24451. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  24452. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  24453. const isStandardFont = !!stdFontMap[fontName];
  24454. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  24455. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  24456. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  24457. const metrics = fontBasicMetricsMap[fontName];
  24458. if (metrics) {
  24459. if (isNaN(this.ascent)) {
  24460. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  24461. }
  24462. if (isNaN(this.descent)) {
  24463. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  24464. }
  24465. if (isNaN(this.capHeight)) {
  24466. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  24467. }
  24468. }
  24469. this.bold = /bold/gi.test(fontName);
  24470. this.italic = /oblique|italic/gi.test(fontName);
  24471. this.black = /Black/g.test(name);
  24472. const isNarrow = /Narrow/g.test(name);
  24473. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  24474. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  24475. const cidToGidMap = properties.cidToGidMap;
  24476. const map = [];
  24477. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24478. if (/Arial-?Black/i.test(name)) {
  24479. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  24480. } else if (/Calibri/i.test(name)) {
  24481. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  24482. }
  24483. if (cidToGidMap) {
  24484. for (const charCode in map) {
  24485. const cid = map[charCode];
  24486. if (cidToGidMap[cid] !== undefined) {
  24487. map[+charCode] = cidToGidMap[cid];
  24488. }
  24489. }
  24490. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24491. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24492. const cid = map[charCode];
  24493. if (cidToGidMap[cid] === undefined) {
  24494. map[+charCode] = unicodeCharCode;
  24495. }
  24496. });
  24497. }
  24498. }
  24499. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24500. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24501. map[+charCode] = unicodeCharCode;
  24502. });
  24503. }
  24504. this.toFontChar = map;
  24505. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  24506. } else if (/Symbol/i.test(fontName)) {
  24507. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24508. } else if (/Dingbats/i.test(fontName)) {
  24509. if (/Wingdings/i.test(name)) {
  24510. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  24511. }
  24512. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  24513. } else if (isStandardFont) {
  24514. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24515. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24516. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24517. map[+charCode] = unicodeCharCode;
  24518. });
  24519. }
  24520. this.toFontChar = map;
  24521. } else {
  24522. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24523. const map = [];
  24524. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  24525. if (!this.composite) {
  24526. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  24527. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  24528. if (unicode !== -1) {
  24529. unicodeCharCode = unicode;
  24530. }
  24531. }
  24532. map[+charCode] = unicodeCharCode;
  24533. });
  24534. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24535. if (/Tahoma|Verdana/i.test(name)) {
  24536. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24537. }
  24538. }
  24539. this.toFontChar = map;
  24540. }
  24541. amendFallbackToUnicode(properties);
  24542. this.loadedName = fontName.split("-")[0];
  24543. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  24544. }
  24545. checkAndRepair(name, font, properties) {
  24546. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  24547. function readTables(file, numTables) {
  24548. const tables = Object.create(null);
  24549. tables["OS/2"] = null;
  24550. tables.cmap = null;
  24551. tables.head = null;
  24552. tables.hhea = null;
  24553. tables.hmtx = null;
  24554. tables.maxp = null;
  24555. tables.name = null;
  24556. tables.post = null;
  24557. for (let i = 0; i < numTables; i++) {
  24558. const table = readTableEntry(file);
  24559. if (!VALID_TABLES.includes(table.tag)) {
  24560. continue;
  24561. }
  24562. if (table.length === 0) {
  24563. continue;
  24564. }
  24565. tables[table.tag] = table;
  24566. }
  24567. return tables;
  24568. }
  24569. function readTableEntry(file) {
  24570. const tag = file.getString(4);
  24571. const checksum = file.getInt32() >>> 0;
  24572. const offset = file.getInt32() >>> 0;
  24573. const length = file.getInt32() >>> 0;
  24574. const previousPosition = file.pos;
  24575. file.pos = file.start || 0;
  24576. file.skip(offset);
  24577. const data = file.getBytes(length);
  24578. file.pos = previousPosition;
  24579. if (tag === "head") {
  24580. data[8] = data[9] = data[10] = data[11] = 0;
  24581. data[17] |= 0x20;
  24582. }
  24583. return {
  24584. tag,
  24585. checksum,
  24586. length,
  24587. offset,
  24588. data
  24589. };
  24590. }
  24591. function readOpenTypeHeader(ttf) {
  24592. return {
  24593. version: ttf.getString(4),
  24594. numTables: ttf.getUint16(),
  24595. searchRange: ttf.getUint16(),
  24596. entrySelector: ttf.getUint16(),
  24597. rangeShift: ttf.getUint16()
  24598. };
  24599. }
  24600. function readTrueTypeCollectionHeader(ttc) {
  24601. const ttcTag = ttc.getString(4);
  24602. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  24603. const majorVersion = ttc.getUint16();
  24604. const minorVersion = ttc.getUint16();
  24605. const numFonts = ttc.getInt32() >>> 0;
  24606. const offsetTable = [];
  24607. for (let i = 0; i < numFonts; i++) {
  24608. offsetTable.push(ttc.getInt32() >>> 0);
  24609. }
  24610. const header = {
  24611. ttcTag,
  24612. majorVersion,
  24613. minorVersion,
  24614. numFonts,
  24615. offsetTable
  24616. };
  24617. switch (majorVersion) {
  24618. case 1:
  24619. return header;
  24620. case 2:
  24621. header.dsigTag = ttc.getInt32() >>> 0;
  24622. header.dsigLength = ttc.getInt32() >>> 0;
  24623. header.dsigOffset = ttc.getInt32() >>> 0;
  24624. return header;
  24625. }
  24626. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  24627. }
  24628. function readTrueTypeCollectionData(ttc, fontName) {
  24629. const {
  24630. numFonts,
  24631. offsetTable
  24632. } = readTrueTypeCollectionHeader(ttc);
  24633. const fontNameParts = fontName.split("+");
  24634. let fallbackData;
  24635. for (let i = 0; i < numFonts; i++) {
  24636. ttc.pos = (ttc.start || 0) + offsetTable[i];
  24637. const potentialHeader = readOpenTypeHeader(ttc);
  24638. const potentialTables = readTables(ttc, potentialHeader.numTables);
  24639. if (!potentialTables.name) {
  24640. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  24641. }
  24642. const nameTable = readNameTable(potentialTables.name);
  24643. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  24644. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  24645. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  24646. if (!nameEntry) {
  24647. continue;
  24648. }
  24649. if (nameEntry === fontName) {
  24650. return {
  24651. header: potentialHeader,
  24652. tables: potentialTables
  24653. };
  24654. }
  24655. if (fontNameParts.length < 2) {
  24656. continue;
  24657. }
  24658. for (const part of fontNameParts) {
  24659. if (nameEntry === part) {
  24660. fallbackData = {
  24661. name: part,
  24662. header: potentialHeader,
  24663. tables: potentialTables
  24664. };
  24665. }
  24666. }
  24667. }
  24668. }
  24669. }
  24670. if (fallbackData) {
  24671. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  24672. return {
  24673. header: fallbackData.header,
  24674. tables: fallbackData.tables
  24675. };
  24676. }
  24677. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  24678. }
  24679. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  24680. if (!cmap) {
  24681. (0, _util.warn)("No cmap table available.");
  24682. return {
  24683. platformId: -1,
  24684. encodingId: -1,
  24685. mappings: [],
  24686. hasShortCmap: false
  24687. };
  24688. }
  24689. let segment;
  24690. let start = (file.start || 0) + cmap.offset;
  24691. file.pos = start;
  24692. file.skip(2);
  24693. const numTables = file.getUint16();
  24694. let potentialTable;
  24695. let canBreak = false;
  24696. for (let i = 0; i < numTables; i++) {
  24697. const platformId = file.getUint16();
  24698. const encodingId = file.getUint16();
  24699. const offset = file.getInt32() >>> 0;
  24700. let useTable = false;
  24701. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  24702. continue;
  24703. }
  24704. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  24705. useTable = true;
  24706. } else if (platformId === 1 && encodingId === 0) {
  24707. useTable = true;
  24708. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  24709. useTable = true;
  24710. if (!isSymbolicFont) {
  24711. canBreak = true;
  24712. }
  24713. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  24714. useTable = true;
  24715. let correctlySorted = true;
  24716. if (i < numTables - 1) {
  24717. const nextBytes = file.peekBytes(2),
  24718. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  24719. if (nextPlatformId < platformId) {
  24720. correctlySorted = false;
  24721. }
  24722. }
  24723. if (correctlySorted) {
  24724. canBreak = true;
  24725. }
  24726. }
  24727. if (useTable) {
  24728. potentialTable = {
  24729. platformId,
  24730. encodingId,
  24731. offset
  24732. };
  24733. }
  24734. if (canBreak) {
  24735. break;
  24736. }
  24737. }
  24738. if (potentialTable) {
  24739. file.pos = start + potentialTable.offset;
  24740. }
  24741. if (!potentialTable || file.peekByte() === -1) {
  24742. (0, _util.warn)("Could not find a preferred cmap table.");
  24743. return {
  24744. platformId: -1,
  24745. encodingId: -1,
  24746. mappings: [],
  24747. hasShortCmap: false
  24748. };
  24749. }
  24750. const format = file.getUint16();
  24751. let hasShortCmap = false;
  24752. const mappings = [];
  24753. let j, glyphId;
  24754. if (format === 0) {
  24755. file.skip(2 + 2);
  24756. for (j = 0; j < 256; j++) {
  24757. const index = file.getByte();
  24758. if (!index) {
  24759. continue;
  24760. }
  24761. mappings.push({
  24762. charCode: j,
  24763. glyphId: index
  24764. });
  24765. }
  24766. hasShortCmap = true;
  24767. } else if (format === 2) {
  24768. file.skip(2 + 2);
  24769. const subHeaderKeys = [];
  24770. let maxSubHeaderKey = 0;
  24771. for (let i = 0; i < 256; i++) {
  24772. const subHeaderKey = file.getUint16() >> 3;
  24773. subHeaderKeys.push(subHeaderKey);
  24774. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  24775. }
  24776. const subHeaders = [];
  24777. for (let i = 0; i <= maxSubHeaderKey; i++) {
  24778. subHeaders.push({
  24779. firstCode: file.getUint16(),
  24780. entryCount: file.getUint16(),
  24781. idDelta: signedInt16(file.getByte(), file.getByte()),
  24782. idRangePos: file.pos + file.getUint16()
  24783. });
  24784. }
  24785. for (let i = 0; i < 256; i++) {
  24786. if (subHeaderKeys[i] === 0) {
  24787. file.pos = subHeaders[0].idRangePos + 2 * i;
  24788. glyphId = file.getUint16();
  24789. mappings.push({
  24790. charCode: i,
  24791. glyphId
  24792. });
  24793. } else {
  24794. const s = subHeaders[subHeaderKeys[i]];
  24795. for (j = 0; j < s.entryCount; j++) {
  24796. const charCode = (i << 8) + j + s.firstCode;
  24797. file.pos = s.idRangePos + 2 * j;
  24798. glyphId = file.getUint16();
  24799. if (glyphId !== 0) {
  24800. glyphId = (glyphId + s.idDelta) % 65536;
  24801. }
  24802. mappings.push({
  24803. charCode,
  24804. glyphId
  24805. });
  24806. }
  24807. }
  24808. }
  24809. } else if (format === 4) {
  24810. file.skip(2 + 2);
  24811. const segCount = file.getUint16() >> 1;
  24812. file.skip(6);
  24813. const segments = [];
  24814. let segIndex;
  24815. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24816. segments.push({
  24817. end: file.getUint16()
  24818. });
  24819. }
  24820. file.skip(2);
  24821. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24822. segments[segIndex].start = file.getUint16();
  24823. }
  24824. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24825. segments[segIndex].delta = file.getUint16();
  24826. }
  24827. let offsetsCount = 0,
  24828. offsetIndex;
  24829. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24830. segment = segments[segIndex];
  24831. const rangeOffset = file.getUint16();
  24832. if (!rangeOffset) {
  24833. segment.offsetIndex = -1;
  24834. continue;
  24835. }
  24836. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  24837. segment.offsetIndex = offsetIndex;
  24838. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  24839. }
  24840. const offsets = [];
  24841. for (j = 0; j < offsetsCount; j++) {
  24842. offsets.push(file.getUint16());
  24843. }
  24844. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24845. segment = segments[segIndex];
  24846. start = segment.start;
  24847. const end = segment.end;
  24848. const delta = segment.delta;
  24849. offsetIndex = segment.offsetIndex;
  24850. for (j = start; j <= end; j++) {
  24851. if (j === 0xffff) {
  24852. continue;
  24853. }
  24854. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  24855. glyphId = glyphId + delta & 0xffff;
  24856. mappings.push({
  24857. charCode: j,
  24858. glyphId
  24859. });
  24860. }
  24861. }
  24862. } else if (format === 6) {
  24863. file.skip(2 + 2);
  24864. const firstCode = file.getUint16();
  24865. const entryCount = file.getUint16();
  24866. for (j = 0; j < entryCount; j++) {
  24867. glyphId = file.getUint16();
  24868. const charCode = firstCode + j;
  24869. mappings.push({
  24870. charCode,
  24871. glyphId
  24872. });
  24873. }
  24874. } else if (format === 12) {
  24875. file.skip(2 + 4 + 4);
  24876. const nGroups = file.getInt32() >>> 0;
  24877. for (j = 0; j < nGroups; j++) {
  24878. const startCharCode = file.getInt32() >>> 0;
  24879. const endCharCode = file.getInt32() >>> 0;
  24880. let glyphCode = file.getInt32() >>> 0;
  24881. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  24882. mappings.push({
  24883. charCode,
  24884. glyphId: glyphCode++
  24885. });
  24886. }
  24887. }
  24888. } else {
  24889. (0, _util.warn)("cmap table has unsupported format: " + format);
  24890. return {
  24891. platformId: -1,
  24892. encodingId: -1,
  24893. mappings: [],
  24894. hasShortCmap: false
  24895. };
  24896. }
  24897. mappings.sort(function (a, b) {
  24898. return a.charCode - b.charCode;
  24899. });
  24900. for (let i = 1; i < mappings.length; i++) {
  24901. if (mappings[i - 1].charCode === mappings[i].charCode) {
  24902. mappings.splice(i, 1);
  24903. i--;
  24904. }
  24905. }
  24906. return {
  24907. platformId: potentialTable.platformId,
  24908. encodingId: potentialTable.encodingId,
  24909. mappings,
  24910. hasShortCmap
  24911. };
  24912. }
  24913. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  24914. if (!header) {
  24915. if (metrics) {
  24916. metrics.data = null;
  24917. }
  24918. return;
  24919. }
  24920. file.pos = (file.start || 0) + header.offset;
  24921. file.pos += 4;
  24922. file.pos += 2;
  24923. file.pos += 2;
  24924. file.pos += 2;
  24925. file.pos += 2;
  24926. file.pos += 2;
  24927. file.pos += 2;
  24928. file.pos += 2;
  24929. file.pos += 2;
  24930. file.pos += 2;
  24931. const caretOffset = file.getUint16();
  24932. file.pos += 8;
  24933. file.pos += 2;
  24934. let numOfMetrics = file.getUint16();
  24935. if (caretOffset !== 0) {
  24936. const macStyle = int16(headTable.data[44], headTable.data[45]);
  24937. if (!(macStyle & 2)) {
  24938. header.data[22] = 0;
  24939. header.data[23] = 0;
  24940. }
  24941. }
  24942. if (numOfMetrics > numGlyphs) {
  24943. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  24944. numOfMetrics = numGlyphs;
  24945. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  24946. header.data[35] = numOfMetrics & 0x00ff;
  24947. }
  24948. const numOfSidebearings = numGlyphs - numOfMetrics;
  24949. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  24950. if (numMissing > 0) {
  24951. const entries = new Uint8Array(metrics.length + numMissing * 2);
  24952. entries.set(metrics.data);
  24953. if (dupFirstEntry) {
  24954. entries[metrics.length] = metrics.data[2];
  24955. entries[metrics.length + 1] = metrics.data[3];
  24956. }
  24957. metrics.data = entries;
  24958. }
  24959. }
  24960. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  24961. const glyphProfile = {
  24962. length: 0,
  24963. sizeOfInstructions: 0
  24964. };
  24965. if (sourceEnd - sourceStart <= 12) {
  24966. return glyphProfile;
  24967. }
  24968. const glyf = source.subarray(sourceStart, sourceEnd);
  24969. let contoursCount = signedInt16(glyf[0], glyf[1]);
  24970. if (contoursCount < 0) {
  24971. contoursCount = -1;
  24972. writeSignedInt16(glyf, 0, contoursCount);
  24973. dest.set(glyf, destStart);
  24974. glyphProfile.length = glyf.length;
  24975. return glyphProfile;
  24976. }
  24977. let i,
  24978. j = 10,
  24979. flagsCount = 0;
  24980. for (i = 0; i < contoursCount; i++) {
  24981. const endPoint = glyf[j] << 8 | glyf[j + 1];
  24982. flagsCount = endPoint + 1;
  24983. j += 2;
  24984. }
  24985. const instructionsStart = j;
  24986. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  24987. glyphProfile.sizeOfInstructions = instructionsLength;
  24988. j += 2 + instructionsLength;
  24989. const instructionsEnd = j;
  24990. let coordinatesLength = 0;
  24991. for (i = 0; i < flagsCount; i++) {
  24992. const flag = glyf[j++];
  24993. if (flag & 0xc0) {
  24994. glyf[j - 1] = flag & 0x3f;
  24995. }
  24996. let xLength = 2;
  24997. if (flag & 2) {
  24998. xLength = 1;
  24999. } else if (flag & 16) {
  25000. xLength = 0;
  25001. }
  25002. let yLength = 2;
  25003. if (flag & 4) {
  25004. yLength = 1;
  25005. } else if (flag & 32) {
  25006. yLength = 0;
  25007. }
  25008. const xyLength = xLength + yLength;
  25009. coordinatesLength += xyLength;
  25010. if (flag & 8) {
  25011. const repeat = glyf[j++];
  25012. i += repeat;
  25013. coordinatesLength += repeat * xyLength;
  25014. }
  25015. }
  25016. if (coordinatesLength === 0) {
  25017. return glyphProfile;
  25018. }
  25019. let glyphDataLength = j + coordinatesLength;
  25020. if (glyphDataLength > glyf.length) {
  25021. return glyphProfile;
  25022. }
  25023. if (!hintsValid && instructionsLength > 0) {
  25024. dest.set(glyf.subarray(0, instructionsStart), destStart);
  25025. dest.set([0, 0], destStart + instructionsStart);
  25026. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  25027. glyphDataLength -= instructionsLength;
  25028. if (glyf.length - glyphDataLength > 3) {
  25029. glyphDataLength = glyphDataLength + 3 & ~3;
  25030. }
  25031. glyphProfile.length = glyphDataLength;
  25032. return glyphProfile;
  25033. }
  25034. if (glyf.length - glyphDataLength > 3) {
  25035. glyphDataLength = glyphDataLength + 3 & ~3;
  25036. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  25037. glyphProfile.length = glyphDataLength;
  25038. return glyphProfile;
  25039. }
  25040. dest.set(glyf, destStart);
  25041. glyphProfile.length = glyf.length;
  25042. return glyphProfile;
  25043. }
  25044. function sanitizeHead(head, numGlyphs, locaLength) {
  25045. const data = head.data;
  25046. const version = int32(data[0], data[1], data[2], data[3]);
  25047. if (version >> 16 !== 1) {
  25048. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  25049. data[0] = 0;
  25050. data[1] = 1;
  25051. data[2] = 0;
  25052. data[3] = 0;
  25053. }
  25054. const indexToLocFormat = int16(data[50], data[51]);
  25055. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  25056. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  25057. const numGlyphsPlusOne = numGlyphs + 1;
  25058. if (locaLength === numGlyphsPlusOne << 1) {
  25059. data[50] = 0;
  25060. data[51] = 0;
  25061. } else if (locaLength === numGlyphsPlusOne << 2) {
  25062. data[50] = 0;
  25063. data[51] = 1;
  25064. } else {
  25065. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  25066. }
  25067. }
  25068. }
  25069. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  25070. let itemSize, itemDecode, itemEncode;
  25071. if (isGlyphLocationsLong) {
  25072. itemSize = 4;
  25073. itemDecode = function fontItemDecodeLong(data, offset) {
  25074. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  25075. };
  25076. itemEncode = function fontItemEncodeLong(data, offset, value) {
  25077. data[offset] = value >>> 24 & 0xff;
  25078. data[offset + 1] = value >> 16 & 0xff;
  25079. data[offset + 2] = value >> 8 & 0xff;
  25080. data[offset + 3] = value & 0xff;
  25081. };
  25082. } else {
  25083. itemSize = 2;
  25084. itemDecode = function fontItemDecode(data, offset) {
  25085. return data[offset] << 9 | data[offset + 1] << 1;
  25086. };
  25087. itemEncode = function fontItemEncode(data, offset, value) {
  25088. data[offset] = value >> 9 & 0xff;
  25089. data[offset + 1] = value >> 1 & 0xff;
  25090. };
  25091. }
  25092. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  25093. const locaDataSize = itemSize * (1 + numGlyphsOut);
  25094. const locaData = new Uint8Array(locaDataSize);
  25095. locaData.set(loca.data.subarray(0, locaDataSize));
  25096. loca.data = locaData;
  25097. const oldGlyfData = glyf.data;
  25098. const oldGlyfDataLength = oldGlyfData.length;
  25099. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  25100. let i, j;
  25101. const locaEntries = [];
  25102. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  25103. let offset = itemDecode(locaData, j);
  25104. if (offset > oldGlyfDataLength) {
  25105. offset = oldGlyfDataLength;
  25106. }
  25107. locaEntries.push({
  25108. index: i,
  25109. offset,
  25110. endOffset: 0
  25111. });
  25112. }
  25113. locaEntries.sort((a, b) => {
  25114. return a.offset - b.offset;
  25115. });
  25116. for (i = 0; i < numGlyphs; i++) {
  25117. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  25118. }
  25119. locaEntries.sort((a, b) => {
  25120. return a.index - b.index;
  25121. });
  25122. for (i = 0; i < numGlyphs; i++) {
  25123. const {
  25124. offset,
  25125. endOffset
  25126. } = locaEntries[i];
  25127. if (offset !== 0 || endOffset !== 0) {
  25128. break;
  25129. }
  25130. const nextOffset = locaEntries[i + 1].offset;
  25131. if (nextOffset === 0) {
  25132. continue;
  25133. }
  25134. locaEntries[i].endOffset = nextOffset;
  25135. break;
  25136. }
  25137. const missingGlyphs = Object.create(null);
  25138. let writeOffset = 0;
  25139. itemEncode(locaData, 0, writeOffset);
  25140. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  25141. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  25142. const newLength = glyphProfile.length;
  25143. if (newLength === 0) {
  25144. missingGlyphs[i] = true;
  25145. }
  25146. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  25147. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  25148. }
  25149. writeOffset += newLength;
  25150. itemEncode(locaData, j, writeOffset);
  25151. }
  25152. if (writeOffset === 0) {
  25153. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  25154. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  25155. itemEncode(locaData, j, simpleGlyph.length);
  25156. }
  25157. glyf.data = simpleGlyph;
  25158. } else if (dupFirstEntry) {
  25159. const firstEntryLength = itemDecode(locaData, itemSize);
  25160. if (newGlyfData.length > firstEntryLength + writeOffset) {
  25161. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  25162. } else {
  25163. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  25164. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  25165. }
  25166. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  25167. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  25168. } else {
  25169. glyf.data = newGlyfData.subarray(0, writeOffset);
  25170. }
  25171. return {
  25172. missingGlyphs,
  25173. maxSizeOfInstructions
  25174. };
  25175. }
  25176. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  25177. const start = (font.start || 0) + post.offset;
  25178. font.pos = start;
  25179. const length = post.length,
  25180. end = start + length;
  25181. const version = font.getInt32();
  25182. font.skip(28);
  25183. let glyphNames;
  25184. let valid = true;
  25185. let i;
  25186. switch (version) {
  25187. case 0x00010000:
  25188. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  25189. break;
  25190. case 0x00020000:
  25191. const numGlyphs = font.getUint16();
  25192. if (numGlyphs !== maxpNumGlyphs) {
  25193. valid = false;
  25194. break;
  25195. }
  25196. const glyphNameIndexes = [];
  25197. for (i = 0; i < numGlyphs; ++i) {
  25198. const index = font.getUint16();
  25199. if (index >= 32768) {
  25200. valid = false;
  25201. break;
  25202. }
  25203. glyphNameIndexes.push(index);
  25204. }
  25205. if (!valid) {
  25206. break;
  25207. }
  25208. const customNames = [],
  25209. strBuf = [];
  25210. while (font.pos < end) {
  25211. const stringLength = font.getByte();
  25212. strBuf.length = stringLength;
  25213. for (i = 0; i < stringLength; ++i) {
  25214. strBuf[i] = String.fromCharCode(font.getByte());
  25215. }
  25216. customNames.push(strBuf.join(""));
  25217. }
  25218. glyphNames = [];
  25219. for (i = 0; i < numGlyphs; ++i) {
  25220. const j = glyphNameIndexes[i];
  25221. if (j < 258) {
  25222. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  25223. continue;
  25224. }
  25225. glyphNames.push(customNames[j - 258]);
  25226. }
  25227. break;
  25228. case 0x00030000:
  25229. break;
  25230. default:
  25231. (0, _util.warn)("Unknown/unsupported post table version " + version);
  25232. valid = false;
  25233. if (propertiesObj.defaultEncoding) {
  25234. glyphNames = propertiesObj.defaultEncoding;
  25235. }
  25236. break;
  25237. }
  25238. propertiesObj.glyphNames = glyphNames;
  25239. return valid;
  25240. }
  25241. function readNameTable(nameTable) {
  25242. const start = (font.start || 0) + nameTable.offset;
  25243. font.pos = start;
  25244. const names = [[], []];
  25245. const length = nameTable.length,
  25246. end = start + length;
  25247. const format = font.getUint16();
  25248. const FORMAT_0_HEADER_LENGTH = 6;
  25249. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  25250. return names;
  25251. }
  25252. const numRecords = font.getUint16();
  25253. const stringsStart = font.getUint16();
  25254. const records = [];
  25255. const NAME_RECORD_LENGTH = 12;
  25256. let i, ii;
  25257. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  25258. const r = {
  25259. platform: font.getUint16(),
  25260. encoding: font.getUint16(),
  25261. language: font.getUint16(),
  25262. name: font.getUint16(),
  25263. length: font.getUint16(),
  25264. offset: font.getUint16()
  25265. };
  25266. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  25267. records.push(r);
  25268. }
  25269. }
  25270. for (i = 0, ii = records.length; i < ii; i++) {
  25271. const record = records[i];
  25272. if (record.length <= 0) {
  25273. continue;
  25274. }
  25275. const pos = start + stringsStart + record.offset;
  25276. if (pos + record.length > end) {
  25277. continue;
  25278. }
  25279. font.pos = pos;
  25280. const nameIndex = record.name;
  25281. if (record.encoding) {
  25282. let str = "";
  25283. for (let j = 0, jj = record.length; j < jj; j += 2) {
  25284. str += String.fromCharCode(font.getUint16());
  25285. }
  25286. names[1][nameIndex] = str;
  25287. } else {
  25288. names[0][nameIndex] = font.getString(record.length);
  25289. }
  25290. }
  25291. return names;
  25292. }
  25293. 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];
  25294. function sanitizeTTProgram(table, ttContext) {
  25295. let data = table.data;
  25296. let i = 0,
  25297. j,
  25298. n,
  25299. b,
  25300. funcId,
  25301. pc,
  25302. lastEndf = 0,
  25303. lastDeff = 0;
  25304. const stack = [];
  25305. const callstack = [];
  25306. const functionsCalled = [];
  25307. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  25308. let inFDEF = false,
  25309. ifLevel = 0,
  25310. inELSE = 0;
  25311. for (let ii = data.length; i < ii;) {
  25312. const op = data[i++];
  25313. if (op === 0x40) {
  25314. n = data[i++];
  25315. if (inFDEF || inELSE) {
  25316. i += n;
  25317. } else {
  25318. for (j = 0; j < n; j++) {
  25319. stack.push(data[i++]);
  25320. }
  25321. }
  25322. } else if (op === 0x41) {
  25323. n = data[i++];
  25324. if (inFDEF || inELSE) {
  25325. i += n * 2;
  25326. } else {
  25327. for (j = 0; j < n; j++) {
  25328. b = data[i++];
  25329. stack.push(b << 8 | data[i++]);
  25330. }
  25331. }
  25332. } else if ((op & 0xf8) === 0xb0) {
  25333. n = op - 0xb0 + 1;
  25334. if (inFDEF || inELSE) {
  25335. i += n;
  25336. } else {
  25337. for (j = 0; j < n; j++) {
  25338. stack.push(data[i++]);
  25339. }
  25340. }
  25341. } else if ((op & 0xf8) === 0xb8) {
  25342. n = op - 0xb8 + 1;
  25343. if (inFDEF || inELSE) {
  25344. i += n * 2;
  25345. } else {
  25346. for (j = 0; j < n; j++) {
  25347. b = data[i++];
  25348. stack.push(b << 8 | data[i++]);
  25349. }
  25350. }
  25351. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  25352. if (!inFDEF && !inELSE) {
  25353. funcId = stack.at(-1);
  25354. if (isNaN(funcId)) {
  25355. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  25356. } else {
  25357. ttContext.functionsUsed[funcId] = true;
  25358. if (funcId in ttContext.functionsStackDeltas) {
  25359. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  25360. if (newStackLength < 0) {
  25361. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  25362. ttContext.hintsValid = false;
  25363. return;
  25364. }
  25365. stack.length = newStackLength;
  25366. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  25367. callstack.push({
  25368. data,
  25369. i,
  25370. stackTop: stack.length - 1
  25371. });
  25372. functionsCalled.push(funcId);
  25373. pc = ttContext.functionsDefined[funcId];
  25374. if (!pc) {
  25375. (0, _util.warn)("TT: CALL non-existent function");
  25376. ttContext.hintsValid = false;
  25377. return;
  25378. }
  25379. data = pc.data;
  25380. i = pc.i;
  25381. }
  25382. }
  25383. }
  25384. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  25385. if (inFDEF || inELSE) {
  25386. (0, _util.warn)("TT: nested FDEFs not allowed");
  25387. tooComplexToFollowFunctions = true;
  25388. }
  25389. inFDEF = true;
  25390. lastDeff = i;
  25391. funcId = stack.pop();
  25392. ttContext.functionsDefined[funcId] = {
  25393. data,
  25394. i
  25395. };
  25396. } else if (op === 0x2d) {
  25397. if (inFDEF) {
  25398. inFDEF = false;
  25399. lastEndf = i;
  25400. } else {
  25401. pc = callstack.pop();
  25402. if (!pc) {
  25403. (0, _util.warn)("TT: ENDF bad stack");
  25404. ttContext.hintsValid = false;
  25405. return;
  25406. }
  25407. funcId = functionsCalled.pop();
  25408. data = pc.data;
  25409. i = pc.i;
  25410. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  25411. }
  25412. } else if (op === 0x89) {
  25413. if (inFDEF || inELSE) {
  25414. (0, _util.warn)("TT: nested IDEFs not allowed");
  25415. tooComplexToFollowFunctions = true;
  25416. }
  25417. inFDEF = true;
  25418. lastDeff = i;
  25419. } else if (op === 0x58) {
  25420. ++ifLevel;
  25421. } else if (op === 0x1b) {
  25422. inELSE = ifLevel;
  25423. } else if (op === 0x59) {
  25424. if (inELSE === ifLevel) {
  25425. inELSE = 0;
  25426. }
  25427. --ifLevel;
  25428. } else if (op === 0x1c) {
  25429. if (!inFDEF && !inELSE) {
  25430. const offset = stack.at(-1);
  25431. if (offset > 0) {
  25432. i += offset - 1;
  25433. }
  25434. }
  25435. }
  25436. if (!inFDEF && !inELSE) {
  25437. let stackDelta = 0;
  25438. if (op <= 0x8e) {
  25439. stackDelta = TTOpsStackDeltas[op];
  25440. } else if (op >= 0xc0 && op <= 0xdf) {
  25441. stackDelta = -1;
  25442. } else if (op >= 0xe0) {
  25443. stackDelta = -2;
  25444. }
  25445. if (op >= 0x71 && op <= 0x75) {
  25446. n = stack.pop();
  25447. if (!isNaN(n)) {
  25448. stackDelta = -n * 2;
  25449. }
  25450. }
  25451. while (stackDelta < 0 && stack.length > 0) {
  25452. stack.pop();
  25453. stackDelta++;
  25454. }
  25455. while (stackDelta > 0) {
  25456. stack.push(NaN);
  25457. stackDelta--;
  25458. }
  25459. }
  25460. }
  25461. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  25462. const content = [data];
  25463. if (i > data.length) {
  25464. content.push(new Uint8Array(i - data.length));
  25465. }
  25466. if (lastDeff > lastEndf) {
  25467. (0, _util.warn)("TT: complementing a missing function tail");
  25468. content.push(new Uint8Array([0x22, 0x2d]));
  25469. }
  25470. foldTTTable(table, content);
  25471. }
  25472. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  25473. if (ttContext.tooComplexToFollowFunctions) {
  25474. return;
  25475. }
  25476. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  25477. (0, _util.warn)("TT: more functions defined than expected");
  25478. ttContext.hintsValid = false;
  25479. return;
  25480. }
  25481. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  25482. if (j > maxFunctionDefs) {
  25483. (0, _util.warn)("TT: invalid function id: " + j);
  25484. ttContext.hintsValid = false;
  25485. return;
  25486. }
  25487. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  25488. (0, _util.warn)("TT: undefined function: " + j);
  25489. ttContext.hintsValid = false;
  25490. return;
  25491. }
  25492. }
  25493. }
  25494. function foldTTTable(table, content) {
  25495. if (content.length > 1) {
  25496. let newLength = 0;
  25497. let j, jj;
  25498. for (j = 0, jj = content.length; j < jj; j++) {
  25499. newLength += content[j].length;
  25500. }
  25501. newLength = newLength + 3 & ~3;
  25502. const result = new Uint8Array(newLength);
  25503. let pos = 0;
  25504. for (j = 0, jj = content.length; j < jj; j++) {
  25505. result.set(content[j], pos);
  25506. pos += content[j].length;
  25507. }
  25508. table.data = result;
  25509. table.length = newLength;
  25510. }
  25511. }
  25512. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  25513. const ttContext = {
  25514. functionsDefined: [],
  25515. functionsUsed: [],
  25516. functionsStackDeltas: [],
  25517. tooComplexToFollowFunctions: false,
  25518. hintsValid: true
  25519. };
  25520. if (fpgm) {
  25521. sanitizeTTProgram(fpgm, ttContext);
  25522. }
  25523. if (prep) {
  25524. sanitizeTTProgram(prep, ttContext);
  25525. }
  25526. if (fpgm) {
  25527. checkInvalidFunctions(ttContext, maxFunctionDefs);
  25528. }
  25529. if (cvt && cvt.length & 1) {
  25530. const cvtData = new Uint8Array(cvt.length + 1);
  25531. cvtData.set(cvt.data);
  25532. cvt.data = cvtData;
  25533. }
  25534. return ttContext.hintsValid;
  25535. }
  25536. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  25537. let header, tables;
  25538. if (isTrueTypeCollectionFile(font)) {
  25539. const ttcData = readTrueTypeCollectionData(font, this.name);
  25540. header = ttcData.header;
  25541. tables = ttcData.tables;
  25542. } else {
  25543. header = readOpenTypeHeader(font);
  25544. tables = readTables(font, header.numTables);
  25545. }
  25546. let cff, cffFile;
  25547. const isTrueType = !tables["CFF "];
  25548. if (!isTrueType) {
  25549. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  25550. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  25551. cffFile = new _stream.Stream(tables["CFF "].data);
  25552. cff = new _cff_font.CFFFont(cffFile, properties);
  25553. adjustWidths(properties);
  25554. return this.convert(name, cff, properties);
  25555. }
  25556. delete tables.glyf;
  25557. delete tables.loca;
  25558. delete tables.fpgm;
  25559. delete tables.prep;
  25560. delete tables["cvt "];
  25561. this.isOpenType = true;
  25562. } else {
  25563. if (!tables.loca) {
  25564. throw new _util.FormatError('Required "loca" table is not found');
  25565. }
  25566. if (!tables.glyf) {
  25567. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  25568. tables.glyf = {
  25569. tag: "glyf",
  25570. data: new Uint8Array(0)
  25571. };
  25572. }
  25573. this.isOpenType = false;
  25574. }
  25575. if (!tables.maxp) {
  25576. throw new _util.FormatError('Required "maxp" table is not found');
  25577. }
  25578. font.pos = (font.start || 0) + tables.maxp.offset;
  25579. const version = font.getInt32();
  25580. const numGlyphs = font.getUint16();
  25581. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  25582. const {
  25583. scaleFactors
  25584. } = properties;
  25585. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25586. const glyphs = new _glyf.GlyfTable({
  25587. glyfTable: tables.glyf.data,
  25588. isGlyphLocationsLong,
  25589. locaTable: tables.loca.data,
  25590. numGlyphs
  25591. });
  25592. glyphs.scale(scaleFactors);
  25593. const {
  25594. glyf,
  25595. loca,
  25596. isLocationLong
  25597. } = glyphs.write();
  25598. tables.glyf.data = glyf;
  25599. tables.loca.data = loca;
  25600. if (isLocationLong !== !!isGlyphLocationsLong) {
  25601. tables.head.data[50] = 0;
  25602. tables.head.data[51] = isLocationLong ? 1 : 0;
  25603. }
  25604. const metrics = tables.hmtx.data;
  25605. for (let i = 0; i < numGlyphs; i++) {
  25606. const j = 4 * i;
  25607. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  25608. metrics[j] = advanceWidth >> 8 & 0xff;
  25609. metrics[j + 1] = advanceWidth & 0xff;
  25610. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  25611. writeSignedInt16(metrics, j + 2, lsb);
  25612. }
  25613. }
  25614. let numGlyphsOut = numGlyphs + 1;
  25615. let dupFirstEntry = true;
  25616. if (numGlyphsOut > 0xffff) {
  25617. dupFirstEntry = false;
  25618. numGlyphsOut = numGlyphs;
  25619. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  25620. }
  25621. let maxFunctionDefs = 0;
  25622. let maxSizeOfInstructions = 0;
  25623. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25624. font.pos += 8;
  25625. const maxZones = font.getUint16();
  25626. if (maxZones > 2) {
  25627. tables.maxp.data[14] = 0;
  25628. tables.maxp.data[15] = 2;
  25629. }
  25630. font.pos += 4;
  25631. maxFunctionDefs = font.getUint16();
  25632. font.pos += 4;
  25633. maxSizeOfInstructions = font.getUint16();
  25634. }
  25635. tables.maxp.data[4] = numGlyphsOut >> 8;
  25636. tables.maxp.data[5] = numGlyphsOut & 255;
  25637. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  25638. if (!hintsValid) {
  25639. delete tables.fpgm;
  25640. delete tables.prep;
  25641. delete tables["cvt "];
  25642. }
  25643. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  25644. if (!tables.head) {
  25645. throw new _util.FormatError('Required "head" table is not found');
  25646. }
  25647. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  25648. let missingGlyphs = Object.create(null);
  25649. if (isTrueType) {
  25650. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25651. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  25652. missingGlyphs = glyphsInfo.missingGlyphs;
  25653. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25654. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  25655. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  25656. }
  25657. }
  25658. if (!tables.hhea) {
  25659. throw new _util.FormatError('Required "hhea" table is not found');
  25660. }
  25661. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  25662. tables.hhea.data[10] = 0xff;
  25663. tables.hhea.data[11] = 0xff;
  25664. }
  25665. const metricsOverride = {
  25666. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  25667. yMax: int16(tables.head.data[42], tables.head.data[43]),
  25668. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  25669. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  25670. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  25671. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  25672. };
  25673. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  25674. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  25675. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  25676. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  25677. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  25678. this.lineGap = this.cssFontInfo.metrics.lineGap;
  25679. } else {
  25680. this.lineHeight = this.ascent - this.descent + this.lineGap;
  25681. }
  25682. if (tables.post) {
  25683. readPostScriptTable(tables.post, properties, numGlyphs);
  25684. }
  25685. tables.post = {
  25686. tag: "post",
  25687. data: createPostTable(properties)
  25688. };
  25689. const charCodeToGlyphId = [];
  25690. function hasGlyph(glyphId) {
  25691. return !missingGlyphs[glyphId];
  25692. }
  25693. if (properties.composite) {
  25694. const cidToGidMap = properties.cidToGidMap || [];
  25695. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  25696. properties.cMap.forEach(function (charCode, cid) {
  25697. if (typeof cid === "string") {
  25698. cid = convertCidString(charCode, cid, true);
  25699. }
  25700. if (cid > 0xffff) {
  25701. throw new _util.FormatError("Max size of CID is 65,535");
  25702. }
  25703. let glyphId = -1;
  25704. if (isCidToGidMapEmpty) {
  25705. glyphId = cid;
  25706. } else if (cidToGidMap[cid] !== undefined) {
  25707. glyphId = cidToGidMap[cid];
  25708. }
  25709. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  25710. charCodeToGlyphId[charCode] = glyphId;
  25711. }
  25712. });
  25713. } else {
  25714. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  25715. const cmapPlatformId = cmapTable.platformId;
  25716. const cmapEncodingId = cmapTable.encodingId;
  25717. const cmapMappings = cmapTable.mappings;
  25718. let baseEncoding = [],
  25719. forcePostTable = false;
  25720. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  25721. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  25722. }
  25723. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  25724. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  25725. for (let charCode = 0; charCode < 256; charCode++) {
  25726. let glyphName;
  25727. if (this.differences[charCode] !== undefined) {
  25728. glyphName = this.differences[charCode];
  25729. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  25730. glyphName = baseEncoding[charCode];
  25731. } else {
  25732. glyphName = _encodings.StandardEncoding[charCode];
  25733. }
  25734. if (!glyphName) {
  25735. continue;
  25736. }
  25737. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  25738. let unicodeOrCharCode;
  25739. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  25740. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  25741. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  25742. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  25743. }
  25744. if (unicodeOrCharCode === undefined) {
  25745. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  25746. const unicode = this.toUnicode.get(charCode);
  25747. if (unicode) {
  25748. unicodeOrCharCode = unicode.codePointAt(0);
  25749. }
  25750. }
  25751. if (unicodeOrCharCode === undefined) {
  25752. continue;
  25753. }
  25754. }
  25755. for (const mapping of cmapMappings) {
  25756. if (mapping.charCode !== unicodeOrCharCode) {
  25757. continue;
  25758. }
  25759. charCodeToGlyphId[charCode] = mapping.glyphId;
  25760. break;
  25761. }
  25762. }
  25763. } else if (cmapPlatformId === 0) {
  25764. for (const mapping of cmapMappings) {
  25765. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  25766. }
  25767. forcePostTable = true;
  25768. } else {
  25769. for (const mapping of cmapMappings) {
  25770. let charCode = mapping.charCode;
  25771. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  25772. charCode &= 0xff;
  25773. }
  25774. charCodeToGlyphId[charCode] = mapping.glyphId;
  25775. }
  25776. }
  25777. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  25778. for (let i = 0; i < 256; ++i) {
  25779. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  25780. continue;
  25781. }
  25782. const glyphName = this.differences[i] || baseEncoding[i];
  25783. if (!glyphName) {
  25784. continue;
  25785. }
  25786. const glyphId = properties.glyphNames.indexOf(glyphName);
  25787. if (glyphId > 0 && hasGlyph(glyphId)) {
  25788. charCodeToGlyphId[i] = glyphId;
  25789. }
  25790. }
  25791. }
  25792. }
  25793. if (charCodeToGlyphId.length === 0) {
  25794. charCodeToGlyphId[0] = 0;
  25795. }
  25796. let glyphZeroId = numGlyphsOut - 1;
  25797. if (!dupFirstEntry) {
  25798. glyphZeroId = 0;
  25799. }
  25800. if (!properties.cssFontInfo) {
  25801. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  25802. this.toFontChar = newMapping.toFontChar;
  25803. tables.cmap = {
  25804. tag: "cmap",
  25805. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  25806. };
  25807. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  25808. tables["OS/2"] = {
  25809. tag: "OS/2",
  25810. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  25811. };
  25812. }
  25813. }
  25814. if (!isTrueType) {
  25815. try {
  25816. cffFile = new _stream.Stream(tables["CFF "].data);
  25817. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  25818. cff = parser.parse();
  25819. cff.duplicateFirstGlyph();
  25820. const compiler = new _cff_parser.CFFCompiler(cff);
  25821. tables["CFF "].data = compiler.compile();
  25822. } catch (e) {
  25823. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  25824. }
  25825. }
  25826. if (!tables.name) {
  25827. tables.name = {
  25828. tag: "name",
  25829. data: createNameTable(this.name)
  25830. };
  25831. } else {
  25832. const namePrototype = readNameTable(tables.name);
  25833. tables.name.data = createNameTable(name, namePrototype);
  25834. this.psName = namePrototype[0][6] || null;
  25835. }
  25836. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  25837. for (const tableTag in tables) {
  25838. builder.addTable(tableTag, tables[tableTag].data);
  25839. }
  25840. return builder.toArray();
  25841. }
  25842. convert(fontName, font, properties) {
  25843. properties.fixedPitch = false;
  25844. if (properties.builtInEncoding) {
  25845. adjustToUnicode(properties, properties.builtInEncoding);
  25846. }
  25847. let glyphZeroId = 1;
  25848. if (font instanceof _cff_font.CFFFont) {
  25849. glyphZeroId = font.numGlyphs - 1;
  25850. }
  25851. const mapping = font.getGlyphMapping(properties);
  25852. let newMapping = null;
  25853. let newCharCodeToGlyphId = mapping;
  25854. let toUnicodeExtraMap = null;
  25855. if (!properties.cssFontInfo) {
  25856. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  25857. this.toFontChar = newMapping.toFontChar;
  25858. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  25859. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  25860. }
  25861. const numGlyphs = font.numGlyphs;
  25862. function getCharCodes(charCodeToGlyphId, glyphId) {
  25863. let charCodes = null;
  25864. for (const charCode in charCodeToGlyphId) {
  25865. if (glyphId === charCodeToGlyphId[charCode]) {
  25866. if (!charCodes) {
  25867. charCodes = [];
  25868. }
  25869. charCodes.push(charCode | 0);
  25870. }
  25871. }
  25872. return charCodes;
  25873. }
  25874. function createCharCode(charCodeToGlyphId, glyphId) {
  25875. for (const charCode in charCodeToGlyphId) {
  25876. if (glyphId === charCodeToGlyphId[charCode]) {
  25877. return charCode | 0;
  25878. }
  25879. }
  25880. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  25881. return newMapping.nextAvailableFontCharCode++;
  25882. }
  25883. const seacs = font.seacs;
  25884. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  25885. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  25886. const charset = font.getCharset();
  25887. const seacMap = Object.create(null);
  25888. for (let glyphId in seacs) {
  25889. glyphId |= 0;
  25890. const seac = seacs[glyphId];
  25891. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  25892. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  25893. const baseGlyphId = charset.indexOf(baseGlyphName);
  25894. const accentGlyphId = charset.indexOf(accentGlyphName);
  25895. if (baseGlyphId < 0 || accentGlyphId < 0) {
  25896. continue;
  25897. }
  25898. const accentOffset = {
  25899. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  25900. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  25901. };
  25902. const charCodes = getCharCodes(mapping, glyphId);
  25903. if (!charCodes) {
  25904. continue;
  25905. }
  25906. for (const charCode of charCodes) {
  25907. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  25908. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  25909. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  25910. seacMap[charCode] = {
  25911. baseFontCharCode,
  25912. accentFontCharCode,
  25913. accentOffset
  25914. };
  25915. }
  25916. }
  25917. properties.seacMap = seacMap;
  25918. }
  25919. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  25920. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  25921. builder.addTable("CFF ", font.data);
  25922. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  25923. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  25924. 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");
  25925. 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));
  25926. builder.addTable("hmtx", function fontFieldsHmtx() {
  25927. const charstrings = font.charstrings;
  25928. const cffWidths = font.cff ? font.cff.widths : null;
  25929. let hmtx = "\x00\x00\x00\x00";
  25930. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  25931. let width = 0;
  25932. if (charstrings) {
  25933. const charstring = charstrings[i - 1];
  25934. width = "width" in charstring ? charstring.width : 0;
  25935. } else if (cffWidths) {
  25936. width = Math.ceil(cffWidths[i] || 0);
  25937. }
  25938. hmtx += string16(width) + string16(0);
  25939. }
  25940. return hmtx;
  25941. }());
  25942. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  25943. builder.addTable("name", createNameTable(fontName));
  25944. builder.addTable("post", createPostTable(properties));
  25945. return builder.toArray();
  25946. }
  25947. get spaceWidth() {
  25948. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  25949. let width;
  25950. for (const glyphName of possibleSpaceReplacements) {
  25951. if (glyphName in this.widths) {
  25952. width = this.widths[glyphName];
  25953. break;
  25954. }
  25955. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  25956. const glyphUnicode = glyphsUnicodeMap[glyphName];
  25957. let charcode = 0;
  25958. if (this.composite && this.cMap.contains(glyphUnicode)) {
  25959. charcode = this.cMap.lookup(glyphUnicode);
  25960. if (typeof charcode === "string") {
  25961. charcode = convertCidString(glyphUnicode, charcode);
  25962. }
  25963. }
  25964. if (!charcode && this.toUnicode) {
  25965. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  25966. }
  25967. if (charcode <= 0) {
  25968. charcode = glyphUnicode;
  25969. }
  25970. width = this.widths[charcode];
  25971. if (width) {
  25972. break;
  25973. }
  25974. }
  25975. width = width || this.defaultWidth;
  25976. return (0, _util.shadow)(this, "spaceWidth", width);
  25977. }
  25978. _charToGlyph(charcode) {
  25979. let isSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  25980. let glyph = this._glyphCache[charcode];
  25981. if (glyph && glyph.isSpace === isSpace) {
  25982. return glyph;
  25983. }
  25984. let fontCharCode, width, operatorListId;
  25985. let widthCode = charcode;
  25986. if (this.cMap && this.cMap.contains(charcode)) {
  25987. widthCode = this.cMap.lookup(charcode);
  25988. if (typeof widthCode === "string") {
  25989. widthCode = convertCidString(charcode, widthCode);
  25990. }
  25991. }
  25992. width = this.widths[widthCode];
  25993. if (typeof width !== "number") {
  25994. width = this.defaultWidth;
  25995. }
  25996. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  25997. let unicode = this.toUnicode.get(charcode) || charcode;
  25998. if (typeof unicode === "number") {
  25999. unicode = String.fromCharCode(unicode);
  26000. }
  26001. let isInFont = this.toFontChar[charcode] !== undefined;
  26002. fontCharCode = this.toFontChar[charcode] || charcode;
  26003. if (this.missingFile) {
  26004. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  26005. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  26006. fontCharCode = 0x20;
  26007. }
  26008. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  26009. }
  26010. if (this.isType3Font) {
  26011. operatorListId = fontCharCode;
  26012. }
  26013. let accent = null;
  26014. if (this.seacMap && this.seacMap[charcode]) {
  26015. isInFont = true;
  26016. const seac = this.seacMap[charcode];
  26017. fontCharCode = seac.baseFontCharCode;
  26018. accent = {
  26019. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  26020. offset: seac.accentOffset
  26021. };
  26022. }
  26023. let fontChar = "";
  26024. if (typeof fontCharCode === "number") {
  26025. if (fontCharCode <= 0x10ffff) {
  26026. fontChar = String.fromCodePoint(fontCharCode);
  26027. } else {
  26028. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  26029. }
  26030. }
  26031. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  26032. return this._glyphCache[charcode] = glyph;
  26033. }
  26034. charsToGlyphs(chars) {
  26035. let glyphs = this._charsCache[chars];
  26036. if (glyphs) {
  26037. return glyphs;
  26038. }
  26039. glyphs = [];
  26040. if (this.cMap) {
  26041. const c = Object.create(null),
  26042. ii = chars.length;
  26043. let i = 0;
  26044. while (i < ii) {
  26045. this.cMap.readCharCode(chars, i, c);
  26046. const {
  26047. charcode,
  26048. length
  26049. } = c;
  26050. i += length;
  26051. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  26052. glyphs.push(glyph);
  26053. }
  26054. } else {
  26055. for (let i = 0, ii = chars.length; i < ii; ++i) {
  26056. const charcode = chars.charCodeAt(i);
  26057. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  26058. glyphs.push(glyph);
  26059. }
  26060. }
  26061. return this._charsCache[chars] = glyphs;
  26062. }
  26063. getCharPositions(chars) {
  26064. const positions = [];
  26065. if (this.cMap) {
  26066. const c = Object.create(null);
  26067. let i = 0;
  26068. while (i < chars.length) {
  26069. this.cMap.readCharCode(chars, i, c);
  26070. const length = c.length;
  26071. positions.push([i, i + length]);
  26072. i += length;
  26073. }
  26074. } else {
  26075. for (let i = 0, ii = chars.length; i < ii; ++i) {
  26076. positions.push([i, i + 1]);
  26077. }
  26078. }
  26079. return positions;
  26080. }
  26081. get glyphCacheValues() {
  26082. return Object.values(this._glyphCache);
  26083. }
  26084. encodeString(str) {
  26085. const buffers = [];
  26086. const currentBuf = [];
  26087. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  26088. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  26089. for (let i = 0, ii = str.length; i < ii; i++) {
  26090. const unicode = str.codePointAt(i);
  26091. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  26092. i++;
  26093. }
  26094. if (this.toUnicode) {
  26095. const charCode = getCharCode(unicode);
  26096. if (charCode !== -1) {
  26097. if (hasCurrentBufErrors()) {
  26098. buffers.push(currentBuf.join(""));
  26099. currentBuf.length = 0;
  26100. }
  26101. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  26102. for (let j = charCodeLength - 1; j >= 0; j--) {
  26103. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  26104. }
  26105. continue;
  26106. }
  26107. }
  26108. if (!hasCurrentBufErrors()) {
  26109. buffers.push(currentBuf.join(""));
  26110. currentBuf.length = 0;
  26111. }
  26112. currentBuf.push(String.fromCodePoint(unicode));
  26113. }
  26114. buffers.push(currentBuf.join(""));
  26115. return buffers;
  26116. }
  26117. }
  26118. exports.Font = Font;
  26119. class ErrorFont {
  26120. constructor(error) {
  26121. this.error = error;
  26122. this.loadedName = "g_font_error";
  26123. this.missingFile = true;
  26124. }
  26125. charsToGlyphs() {
  26126. return [];
  26127. }
  26128. encodeString(chars) {
  26129. return [chars];
  26130. }
  26131. exportData() {
  26132. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  26133. return {
  26134. error: this.error
  26135. };
  26136. }
  26137. }
  26138. exports.ErrorFont = ErrorFont;
  26139. /***/ }),
  26140. /* 164 */
  26141. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26142. "use strict";
  26143. Object.defineProperty(exports, "__esModule", ({
  26144. value: true
  26145. }));
  26146. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  26147. var _util = __w_pdfjs_require__(2);
  26148. var _charsets = __w_pdfjs_require__(165);
  26149. var _encodings = __w_pdfjs_require__(166);
  26150. const MAX_SUBR_NESTING = 10;
  26151. 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"];
  26152. exports.CFFStandardStrings = CFFStandardStrings;
  26153. const NUM_STANDARD_CFF_STRINGS = 391;
  26154. const CharstringValidationData = [null, {
  26155. id: "hstem",
  26156. min: 2,
  26157. stackClearing: true,
  26158. stem: true
  26159. }, null, {
  26160. id: "vstem",
  26161. min: 2,
  26162. stackClearing: true,
  26163. stem: true
  26164. }, {
  26165. id: "vmoveto",
  26166. min: 1,
  26167. stackClearing: true
  26168. }, {
  26169. id: "rlineto",
  26170. min: 2,
  26171. resetStack: true
  26172. }, {
  26173. id: "hlineto",
  26174. min: 1,
  26175. resetStack: true
  26176. }, {
  26177. id: "vlineto",
  26178. min: 1,
  26179. resetStack: true
  26180. }, {
  26181. id: "rrcurveto",
  26182. min: 6,
  26183. resetStack: true
  26184. }, null, {
  26185. id: "callsubr",
  26186. min: 1,
  26187. undefStack: true
  26188. }, {
  26189. id: "return",
  26190. min: 0,
  26191. undefStack: true
  26192. }, null, null, {
  26193. id: "endchar",
  26194. min: 0,
  26195. stackClearing: true
  26196. }, null, null, null, {
  26197. id: "hstemhm",
  26198. min: 2,
  26199. stackClearing: true,
  26200. stem: true
  26201. }, {
  26202. id: "hintmask",
  26203. min: 0,
  26204. stackClearing: true
  26205. }, {
  26206. id: "cntrmask",
  26207. min: 0,
  26208. stackClearing: true
  26209. }, {
  26210. id: "rmoveto",
  26211. min: 2,
  26212. stackClearing: true
  26213. }, {
  26214. id: "hmoveto",
  26215. min: 1,
  26216. stackClearing: true
  26217. }, {
  26218. id: "vstemhm",
  26219. min: 2,
  26220. stackClearing: true,
  26221. stem: true
  26222. }, {
  26223. id: "rcurveline",
  26224. min: 8,
  26225. resetStack: true
  26226. }, {
  26227. id: "rlinecurve",
  26228. min: 8,
  26229. resetStack: true
  26230. }, {
  26231. id: "vvcurveto",
  26232. min: 4,
  26233. resetStack: true
  26234. }, {
  26235. id: "hhcurveto",
  26236. min: 4,
  26237. resetStack: true
  26238. }, null, {
  26239. id: "callgsubr",
  26240. min: 1,
  26241. undefStack: true
  26242. }, {
  26243. id: "vhcurveto",
  26244. min: 4,
  26245. resetStack: true
  26246. }, {
  26247. id: "hvcurveto",
  26248. min: 4,
  26249. resetStack: true
  26250. }];
  26251. const CharstringValidationData12 = [null, null, null, {
  26252. id: "and",
  26253. min: 2,
  26254. stackDelta: -1
  26255. }, {
  26256. id: "or",
  26257. min: 2,
  26258. stackDelta: -1
  26259. }, {
  26260. id: "not",
  26261. min: 1,
  26262. stackDelta: 0
  26263. }, null, null, null, {
  26264. id: "abs",
  26265. min: 1,
  26266. stackDelta: 0
  26267. }, {
  26268. id: "add",
  26269. min: 2,
  26270. stackDelta: -1,
  26271. stackFn(stack, index) {
  26272. stack[index - 2] = stack[index - 2] + stack[index - 1];
  26273. }
  26274. }, {
  26275. id: "sub",
  26276. min: 2,
  26277. stackDelta: -1,
  26278. stackFn(stack, index) {
  26279. stack[index - 2] = stack[index - 2] - stack[index - 1];
  26280. }
  26281. }, {
  26282. id: "div",
  26283. min: 2,
  26284. stackDelta: -1,
  26285. stackFn(stack, index) {
  26286. stack[index - 2] = stack[index - 2] / stack[index - 1];
  26287. }
  26288. }, null, {
  26289. id: "neg",
  26290. min: 1,
  26291. stackDelta: 0,
  26292. stackFn(stack, index) {
  26293. stack[index - 1] = -stack[index - 1];
  26294. }
  26295. }, {
  26296. id: "eq",
  26297. min: 2,
  26298. stackDelta: -1
  26299. }, null, null, {
  26300. id: "drop",
  26301. min: 1,
  26302. stackDelta: -1
  26303. }, null, {
  26304. id: "put",
  26305. min: 2,
  26306. stackDelta: -2
  26307. }, {
  26308. id: "get",
  26309. min: 1,
  26310. stackDelta: 0
  26311. }, {
  26312. id: "ifelse",
  26313. min: 4,
  26314. stackDelta: -3
  26315. }, {
  26316. id: "random",
  26317. min: 0,
  26318. stackDelta: 1
  26319. }, {
  26320. id: "mul",
  26321. min: 2,
  26322. stackDelta: -1,
  26323. stackFn(stack, index) {
  26324. stack[index - 2] = stack[index - 2] * stack[index - 1];
  26325. }
  26326. }, null, {
  26327. id: "sqrt",
  26328. min: 1,
  26329. stackDelta: 0
  26330. }, {
  26331. id: "dup",
  26332. min: 1,
  26333. stackDelta: 1
  26334. }, {
  26335. id: "exch",
  26336. min: 2,
  26337. stackDelta: 0
  26338. }, {
  26339. id: "index",
  26340. min: 2,
  26341. stackDelta: 0
  26342. }, {
  26343. id: "roll",
  26344. min: 3,
  26345. stackDelta: -2
  26346. }, null, null, null, {
  26347. id: "hflex",
  26348. min: 7,
  26349. resetStack: true
  26350. }, {
  26351. id: "flex",
  26352. min: 13,
  26353. resetStack: true
  26354. }, {
  26355. id: "hflex1",
  26356. min: 9,
  26357. resetStack: true
  26358. }, {
  26359. id: "flex1",
  26360. min: 11,
  26361. resetStack: true
  26362. }];
  26363. class CFFParser {
  26364. constructor(file, properties, seacAnalysisEnabled) {
  26365. this.bytes = file.getBytes();
  26366. this.properties = properties;
  26367. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  26368. }
  26369. parse() {
  26370. const properties = this.properties;
  26371. const cff = new CFF();
  26372. this.cff = cff;
  26373. const header = this.parseHeader();
  26374. const nameIndex = this.parseIndex(header.endPos);
  26375. const topDictIndex = this.parseIndex(nameIndex.endPos);
  26376. const stringIndex = this.parseIndex(topDictIndex.endPos);
  26377. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  26378. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  26379. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  26380. cff.header = header.obj;
  26381. cff.names = this.parseNameIndex(nameIndex.obj);
  26382. cff.strings = this.parseStringIndex(stringIndex.obj);
  26383. cff.topDict = topDict;
  26384. cff.globalSubrIndex = globalSubrIndex.obj;
  26385. this.parsePrivateDict(cff.topDict);
  26386. cff.isCIDFont = topDict.hasName("ROS");
  26387. const charStringOffset = topDict.getByName("CharStrings");
  26388. const charStringIndex = this.parseIndex(charStringOffset).obj;
  26389. const fontMatrix = topDict.getByName("FontMatrix");
  26390. if (fontMatrix) {
  26391. properties.fontMatrix = fontMatrix;
  26392. }
  26393. const fontBBox = topDict.getByName("FontBBox");
  26394. if (fontBBox) {
  26395. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  26396. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  26397. properties.ascentScaled = true;
  26398. }
  26399. let charset, encoding;
  26400. if (cff.isCIDFont) {
  26401. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  26402. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  26403. const dictRaw = fdArrayIndex.get(i);
  26404. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  26405. this.parsePrivateDict(fontDict);
  26406. cff.fdArray.push(fontDict);
  26407. }
  26408. encoding = null;
  26409. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  26410. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  26411. } else {
  26412. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  26413. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  26414. }
  26415. cff.charset = charset;
  26416. cff.encoding = encoding;
  26417. const charStringsAndSeacs = this.parseCharStrings({
  26418. charStrings: charStringIndex,
  26419. localSubrIndex: topDict.privateDict.subrsIndex,
  26420. globalSubrIndex: globalSubrIndex.obj,
  26421. fdSelect: cff.fdSelect,
  26422. fdArray: cff.fdArray,
  26423. privateDict: topDict.privateDict
  26424. });
  26425. cff.charStrings = charStringsAndSeacs.charStrings;
  26426. cff.seacs = charStringsAndSeacs.seacs;
  26427. cff.widths = charStringsAndSeacs.widths;
  26428. return cff;
  26429. }
  26430. parseHeader() {
  26431. let bytes = this.bytes;
  26432. const bytesLength = bytes.length;
  26433. let offset = 0;
  26434. while (offset < bytesLength && bytes[offset] !== 1) {
  26435. ++offset;
  26436. }
  26437. if (offset >= bytesLength) {
  26438. throw new _util.FormatError("Invalid CFF header");
  26439. }
  26440. if (offset !== 0) {
  26441. (0, _util.info)("cff data is shifted");
  26442. bytes = bytes.subarray(offset);
  26443. this.bytes = bytes;
  26444. }
  26445. const major = bytes[0];
  26446. const minor = bytes[1];
  26447. const hdrSize = bytes[2];
  26448. const offSize = bytes[3];
  26449. const header = new CFFHeader(major, minor, hdrSize, offSize);
  26450. return {
  26451. obj: header,
  26452. endPos: hdrSize
  26453. };
  26454. }
  26455. parseDict(dict) {
  26456. let pos = 0;
  26457. function parseOperand() {
  26458. let value = dict[pos++];
  26459. if (value === 30) {
  26460. return parseFloatOperand();
  26461. } else if (value === 28) {
  26462. value = dict[pos++];
  26463. value = (value << 24 | dict[pos++] << 16) >> 16;
  26464. return value;
  26465. } else if (value === 29) {
  26466. value = dict[pos++];
  26467. value = value << 8 | dict[pos++];
  26468. value = value << 8 | dict[pos++];
  26469. value = value << 8 | dict[pos++];
  26470. return value;
  26471. } else if (value >= 32 && value <= 246) {
  26472. return value - 139;
  26473. } else if (value >= 247 && value <= 250) {
  26474. return (value - 247) * 256 + dict[pos++] + 108;
  26475. } else if (value >= 251 && value <= 254) {
  26476. return -((value - 251) * 256) - dict[pos++] - 108;
  26477. }
  26478. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  26479. return NaN;
  26480. }
  26481. function parseFloatOperand() {
  26482. let str = "";
  26483. const eof = 15;
  26484. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  26485. const length = dict.length;
  26486. while (pos < length) {
  26487. const b = dict[pos++];
  26488. const b1 = b >> 4;
  26489. const b2 = b & 15;
  26490. if (b1 === eof) {
  26491. break;
  26492. }
  26493. str += lookup[b1];
  26494. if (b2 === eof) {
  26495. break;
  26496. }
  26497. str += lookup[b2];
  26498. }
  26499. return parseFloat(str);
  26500. }
  26501. let operands = [];
  26502. const entries = [];
  26503. pos = 0;
  26504. const end = dict.length;
  26505. while (pos < end) {
  26506. let b = dict[pos];
  26507. if (b <= 21) {
  26508. if (b === 12) {
  26509. b = b << 8 | dict[++pos];
  26510. }
  26511. entries.push([b, operands]);
  26512. operands = [];
  26513. ++pos;
  26514. } else {
  26515. operands.push(parseOperand());
  26516. }
  26517. }
  26518. return entries;
  26519. }
  26520. parseIndex(pos) {
  26521. const cffIndex = new CFFIndex();
  26522. const bytes = this.bytes;
  26523. const count = bytes[pos++] << 8 | bytes[pos++];
  26524. const offsets = [];
  26525. let end = pos;
  26526. let i, ii;
  26527. if (count !== 0) {
  26528. const offsetSize = bytes[pos++];
  26529. const startPos = pos + (count + 1) * offsetSize - 1;
  26530. for (i = 0, ii = count + 1; i < ii; ++i) {
  26531. let offset = 0;
  26532. for (let j = 0; j < offsetSize; ++j) {
  26533. offset <<= 8;
  26534. offset += bytes[pos++];
  26535. }
  26536. offsets.push(startPos + offset);
  26537. }
  26538. end = offsets[count];
  26539. }
  26540. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  26541. const offsetStart = offsets[i];
  26542. const offsetEnd = offsets[i + 1];
  26543. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  26544. }
  26545. return {
  26546. obj: cffIndex,
  26547. endPos: end
  26548. };
  26549. }
  26550. parseNameIndex(index) {
  26551. const names = [];
  26552. for (let i = 0, ii = index.count; i < ii; ++i) {
  26553. const name = index.get(i);
  26554. names.push((0, _util.bytesToString)(name));
  26555. }
  26556. return names;
  26557. }
  26558. parseStringIndex(index) {
  26559. const strings = new CFFStrings();
  26560. for (let i = 0, ii = index.count; i < ii; ++i) {
  26561. const data = index.get(i);
  26562. strings.add((0, _util.bytesToString)(data));
  26563. }
  26564. return strings;
  26565. }
  26566. createDict(Type, dict, strings) {
  26567. const cffDict = new Type(strings);
  26568. for (const [key, value] of dict) {
  26569. cffDict.setByKey(key, value);
  26570. }
  26571. return cffDict;
  26572. }
  26573. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  26574. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  26575. return false;
  26576. }
  26577. let stackSize = state.stackSize;
  26578. const stack = state.stack;
  26579. let length = data.length;
  26580. for (let j = 0; j < length;) {
  26581. const value = data[j++];
  26582. let validationCommand = null;
  26583. if (value === 12) {
  26584. const q = data[j++];
  26585. if (q === 0) {
  26586. data[j - 2] = 139;
  26587. data[j - 1] = 22;
  26588. stackSize = 0;
  26589. } else {
  26590. validationCommand = CharstringValidationData12[q];
  26591. }
  26592. } else if (value === 28) {
  26593. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  26594. j += 2;
  26595. stackSize++;
  26596. } else if (value === 14) {
  26597. if (stackSize >= 4) {
  26598. stackSize -= 4;
  26599. if (this.seacAnalysisEnabled) {
  26600. state.seac = stack.slice(stackSize, stackSize + 4);
  26601. return false;
  26602. }
  26603. }
  26604. validationCommand = CharstringValidationData[value];
  26605. } else if (value >= 32 && value <= 246) {
  26606. stack[stackSize] = value - 139;
  26607. stackSize++;
  26608. } else if (value >= 247 && value <= 254) {
  26609. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  26610. j++;
  26611. stackSize++;
  26612. } else if (value === 255) {
  26613. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  26614. j += 4;
  26615. stackSize++;
  26616. } else if (value === 19 || value === 20) {
  26617. state.hints += stackSize >> 1;
  26618. j += state.hints + 7 >> 3;
  26619. stackSize %= 2;
  26620. validationCommand = CharstringValidationData[value];
  26621. } else if (value === 10 || value === 29) {
  26622. let subrsIndex;
  26623. if (value === 10) {
  26624. subrsIndex = localSubrIndex;
  26625. } else {
  26626. subrsIndex = globalSubrIndex;
  26627. }
  26628. if (!subrsIndex) {
  26629. validationCommand = CharstringValidationData[value];
  26630. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  26631. return false;
  26632. }
  26633. let bias = 32768;
  26634. if (subrsIndex.count < 1240) {
  26635. bias = 107;
  26636. } else if (subrsIndex.count < 33900) {
  26637. bias = 1131;
  26638. }
  26639. const subrNumber = stack[--stackSize] + bias;
  26640. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  26641. validationCommand = CharstringValidationData[value];
  26642. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  26643. return false;
  26644. }
  26645. state.stackSize = stackSize;
  26646. state.callDepth++;
  26647. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  26648. if (!valid) {
  26649. return false;
  26650. }
  26651. state.callDepth--;
  26652. stackSize = state.stackSize;
  26653. continue;
  26654. } else if (value === 11) {
  26655. state.stackSize = stackSize;
  26656. return true;
  26657. } else if (value === 0 && j === data.length) {
  26658. data[j - 1] = 14;
  26659. validationCommand = CharstringValidationData[14];
  26660. } else if (value === 9) {
  26661. data.copyWithin(j - 1, j, -1);
  26662. j -= 1;
  26663. length -= 1;
  26664. continue;
  26665. } else {
  26666. validationCommand = CharstringValidationData[value];
  26667. }
  26668. if (validationCommand) {
  26669. if (validationCommand.stem) {
  26670. state.hints += stackSize >> 1;
  26671. if (value === 3 || value === 23) {
  26672. state.hasVStems = true;
  26673. } else if (state.hasVStems && (value === 1 || value === 18)) {
  26674. (0, _util.warn)("CFF stem hints are in wrong order");
  26675. data[j - 1] = value === 1 ? 3 : 23;
  26676. }
  26677. }
  26678. if ("min" in validationCommand) {
  26679. if (!state.undefStack && stackSize < validationCommand.min) {
  26680. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  26681. if (stackSize === 0) {
  26682. data[j - 1] = 14;
  26683. return true;
  26684. }
  26685. return false;
  26686. }
  26687. }
  26688. if (state.firstStackClearing && validationCommand.stackClearing) {
  26689. state.firstStackClearing = false;
  26690. stackSize -= validationCommand.min;
  26691. if (stackSize >= 2 && validationCommand.stem) {
  26692. stackSize %= 2;
  26693. } else if (stackSize > 1) {
  26694. (0, _util.warn)("Found too many parameters for stack-clearing command");
  26695. }
  26696. if (stackSize > 0) {
  26697. state.width = stack[stackSize - 1];
  26698. }
  26699. }
  26700. if ("stackDelta" in validationCommand) {
  26701. if ("stackFn" in validationCommand) {
  26702. validationCommand.stackFn(stack, stackSize);
  26703. }
  26704. stackSize += validationCommand.stackDelta;
  26705. } else if (validationCommand.stackClearing) {
  26706. stackSize = 0;
  26707. } else if (validationCommand.resetStack) {
  26708. stackSize = 0;
  26709. state.undefStack = false;
  26710. } else if (validationCommand.undefStack) {
  26711. stackSize = 0;
  26712. state.undefStack = true;
  26713. state.firstStackClearing = false;
  26714. }
  26715. }
  26716. }
  26717. if (length < data.length) {
  26718. data.fill(14, length);
  26719. }
  26720. state.stackSize = stackSize;
  26721. return true;
  26722. }
  26723. parseCharStrings(_ref) {
  26724. let {
  26725. charStrings,
  26726. localSubrIndex,
  26727. globalSubrIndex,
  26728. fdSelect,
  26729. fdArray,
  26730. privateDict
  26731. } = _ref;
  26732. const seacs = [];
  26733. const widths = [];
  26734. const count = charStrings.count;
  26735. for (let i = 0; i < count; i++) {
  26736. const charstring = charStrings.get(i);
  26737. const state = {
  26738. callDepth: 0,
  26739. stackSize: 0,
  26740. stack: [],
  26741. undefStack: true,
  26742. hints: 0,
  26743. firstStackClearing: true,
  26744. seac: null,
  26745. width: null,
  26746. hasVStems: false
  26747. };
  26748. let valid = true;
  26749. let localSubrToUse = null;
  26750. let privateDictToUse = privateDict;
  26751. if (fdSelect && fdArray.length) {
  26752. const fdIndex = fdSelect.getFDIndex(i);
  26753. if (fdIndex === -1) {
  26754. (0, _util.warn)("Glyph index is not in fd select.");
  26755. valid = false;
  26756. }
  26757. if (fdIndex >= fdArray.length) {
  26758. (0, _util.warn)("Invalid fd index for glyph index.");
  26759. valid = false;
  26760. }
  26761. if (valid) {
  26762. privateDictToUse = fdArray[fdIndex].privateDict;
  26763. localSubrToUse = privateDictToUse.subrsIndex;
  26764. }
  26765. } else if (localSubrIndex) {
  26766. localSubrToUse = localSubrIndex;
  26767. }
  26768. if (valid) {
  26769. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  26770. }
  26771. if (state.width !== null) {
  26772. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  26773. widths[i] = nominalWidth + state.width;
  26774. } else {
  26775. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  26776. widths[i] = defaultWidth;
  26777. }
  26778. if (state.seac !== null) {
  26779. seacs[i] = state.seac;
  26780. }
  26781. if (!valid) {
  26782. charStrings.set(i, new Uint8Array([14]));
  26783. }
  26784. }
  26785. return {
  26786. charStrings,
  26787. seacs,
  26788. widths
  26789. };
  26790. }
  26791. emptyPrivateDictionary(parentDict) {
  26792. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  26793. parentDict.setByKey(18, [0, 0]);
  26794. parentDict.privateDict = privateDict;
  26795. }
  26796. parsePrivateDict(parentDict) {
  26797. if (!parentDict.hasName("Private")) {
  26798. this.emptyPrivateDictionary(parentDict);
  26799. return;
  26800. }
  26801. const privateOffset = parentDict.getByName("Private");
  26802. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  26803. parentDict.removeByName("Private");
  26804. return;
  26805. }
  26806. const size = privateOffset[0];
  26807. const offset = privateOffset[1];
  26808. if (size === 0 || offset >= this.bytes.length) {
  26809. this.emptyPrivateDictionary(parentDict);
  26810. return;
  26811. }
  26812. const privateDictEnd = offset + size;
  26813. const dictData = this.bytes.subarray(offset, privateDictEnd);
  26814. const dict = this.parseDict(dictData);
  26815. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  26816. parentDict.privateDict = privateDict;
  26817. if (!privateDict.getByName("Subrs")) {
  26818. return;
  26819. }
  26820. const subrsOffset = privateDict.getByName("Subrs");
  26821. const relativeOffset = offset + subrsOffset;
  26822. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  26823. this.emptyPrivateDictionary(parentDict);
  26824. return;
  26825. }
  26826. const subrsIndex = this.parseIndex(relativeOffset);
  26827. privateDict.subrsIndex = subrsIndex.obj;
  26828. }
  26829. parseCharsets(pos, length, strings, cid) {
  26830. if (pos === 0) {
  26831. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  26832. } else if (pos === 1) {
  26833. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  26834. } else if (pos === 2) {
  26835. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  26836. }
  26837. const bytes = this.bytes;
  26838. const start = pos;
  26839. const format = bytes[pos++];
  26840. const charset = [cid ? 0 : ".notdef"];
  26841. let id, count, i;
  26842. length -= 1;
  26843. switch (format) {
  26844. case 0:
  26845. for (i = 0; i < length; i++) {
  26846. id = bytes[pos++] << 8 | bytes[pos++];
  26847. charset.push(cid ? id : strings.get(id));
  26848. }
  26849. break;
  26850. case 1:
  26851. while (charset.length <= length) {
  26852. id = bytes[pos++] << 8 | bytes[pos++];
  26853. count = bytes[pos++];
  26854. for (i = 0; i <= count; i++) {
  26855. charset.push(cid ? id++ : strings.get(id++));
  26856. }
  26857. }
  26858. break;
  26859. case 2:
  26860. while (charset.length <= length) {
  26861. id = bytes[pos++] << 8 | bytes[pos++];
  26862. count = bytes[pos++] << 8 | bytes[pos++];
  26863. for (i = 0; i <= count; i++) {
  26864. charset.push(cid ? id++ : strings.get(id++));
  26865. }
  26866. }
  26867. break;
  26868. default:
  26869. throw new _util.FormatError("Unknown charset format");
  26870. }
  26871. const end = pos;
  26872. const raw = bytes.subarray(start, end);
  26873. return new CFFCharset(false, format, charset, raw);
  26874. }
  26875. parseEncoding(pos, properties, strings, charset) {
  26876. const encoding = Object.create(null);
  26877. const bytes = this.bytes;
  26878. let predefined = false;
  26879. let format, i, ii;
  26880. let raw = null;
  26881. function readSupplement() {
  26882. const supplementsCount = bytes[pos++];
  26883. for (i = 0; i < supplementsCount; i++) {
  26884. const code = bytes[pos++];
  26885. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  26886. encoding[code] = charset.indexOf(strings.get(sid));
  26887. }
  26888. }
  26889. if (pos === 0 || pos === 1) {
  26890. predefined = true;
  26891. format = pos;
  26892. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  26893. for (i = 0, ii = charset.length; i < ii; i++) {
  26894. const index = baseEncoding.indexOf(charset[i]);
  26895. if (index !== -1) {
  26896. encoding[index] = i;
  26897. }
  26898. }
  26899. } else {
  26900. const dataStart = pos;
  26901. format = bytes[pos++];
  26902. switch (format & 0x7f) {
  26903. case 0:
  26904. const glyphsCount = bytes[pos++];
  26905. for (i = 1; i <= glyphsCount; i++) {
  26906. encoding[bytes[pos++]] = i;
  26907. }
  26908. break;
  26909. case 1:
  26910. const rangesCount = bytes[pos++];
  26911. let gid = 1;
  26912. for (i = 0; i < rangesCount; i++) {
  26913. const start = bytes[pos++];
  26914. const left = bytes[pos++];
  26915. for (let j = start; j <= start + left; j++) {
  26916. encoding[j] = gid++;
  26917. }
  26918. }
  26919. break;
  26920. default:
  26921. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  26922. }
  26923. const dataEnd = pos;
  26924. if (format & 0x80) {
  26925. bytes[dataStart] &= 0x7f;
  26926. readSupplement();
  26927. }
  26928. raw = bytes.subarray(dataStart, dataEnd);
  26929. }
  26930. format &= 0x7f;
  26931. return new CFFEncoding(predefined, format, encoding, raw);
  26932. }
  26933. parseFDSelect(pos, length) {
  26934. const bytes = this.bytes;
  26935. const format = bytes[pos++];
  26936. const fdSelect = [];
  26937. let i;
  26938. switch (format) {
  26939. case 0:
  26940. for (i = 0; i < length; ++i) {
  26941. const id = bytes[pos++];
  26942. fdSelect.push(id);
  26943. }
  26944. break;
  26945. case 3:
  26946. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  26947. for (i = 0; i < rangesCount; ++i) {
  26948. let first = bytes[pos++] << 8 | bytes[pos++];
  26949. if (i === 0 && first !== 0) {
  26950. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  26951. first = 0;
  26952. }
  26953. const fdIndex = bytes[pos++];
  26954. const next = bytes[pos] << 8 | bytes[pos + 1];
  26955. for (let j = first; j < next; ++j) {
  26956. fdSelect.push(fdIndex);
  26957. }
  26958. }
  26959. pos += 2;
  26960. break;
  26961. default:
  26962. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  26963. }
  26964. if (fdSelect.length !== length) {
  26965. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  26966. }
  26967. return new CFFFDSelect(format, fdSelect);
  26968. }
  26969. }
  26970. exports.CFFParser = CFFParser;
  26971. class CFF {
  26972. constructor() {
  26973. this.header = null;
  26974. this.names = [];
  26975. this.topDict = null;
  26976. this.strings = new CFFStrings();
  26977. this.globalSubrIndex = null;
  26978. this.encoding = null;
  26979. this.charset = null;
  26980. this.charStrings = null;
  26981. this.fdArray = [];
  26982. this.fdSelect = null;
  26983. this.isCIDFont = false;
  26984. }
  26985. duplicateFirstGlyph() {
  26986. if (this.charStrings.count >= 65535) {
  26987. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  26988. return;
  26989. }
  26990. const glyphZero = this.charStrings.get(0);
  26991. this.charStrings.add(glyphZero);
  26992. if (this.isCIDFont) {
  26993. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  26994. }
  26995. }
  26996. hasGlyphId(id) {
  26997. if (id < 0 || id >= this.charStrings.count) {
  26998. return false;
  26999. }
  27000. const glyph = this.charStrings.get(id);
  27001. return glyph.length > 0;
  27002. }
  27003. }
  27004. exports.CFF = CFF;
  27005. class CFFHeader {
  27006. constructor(major, minor, hdrSize, offSize) {
  27007. this.major = major;
  27008. this.minor = minor;
  27009. this.hdrSize = hdrSize;
  27010. this.offSize = offSize;
  27011. }
  27012. }
  27013. exports.CFFHeader = CFFHeader;
  27014. class CFFStrings {
  27015. constructor() {
  27016. this.strings = [];
  27017. }
  27018. get(index) {
  27019. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  27020. return CFFStandardStrings[index];
  27021. }
  27022. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  27023. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  27024. }
  27025. return CFFStandardStrings[0];
  27026. }
  27027. getSID(str) {
  27028. let index = CFFStandardStrings.indexOf(str);
  27029. if (index !== -1) {
  27030. return index;
  27031. }
  27032. index = this.strings.indexOf(str);
  27033. if (index !== -1) {
  27034. return index + NUM_STANDARD_CFF_STRINGS;
  27035. }
  27036. return -1;
  27037. }
  27038. add(value) {
  27039. this.strings.push(value);
  27040. }
  27041. get count() {
  27042. return this.strings.length;
  27043. }
  27044. }
  27045. exports.CFFStrings = CFFStrings;
  27046. class CFFIndex {
  27047. constructor() {
  27048. this.objects = [];
  27049. this.length = 0;
  27050. }
  27051. add(data) {
  27052. this.length += data.length;
  27053. this.objects.push(data);
  27054. }
  27055. set(index, data) {
  27056. this.length += data.length - this.objects[index].length;
  27057. this.objects[index] = data;
  27058. }
  27059. get(index) {
  27060. return this.objects[index];
  27061. }
  27062. get count() {
  27063. return this.objects.length;
  27064. }
  27065. }
  27066. exports.CFFIndex = CFFIndex;
  27067. class CFFDict {
  27068. constructor(tables, strings) {
  27069. this.keyToNameMap = tables.keyToNameMap;
  27070. this.nameToKeyMap = tables.nameToKeyMap;
  27071. this.defaults = tables.defaults;
  27072. this.types = tables.types;
  27073. this.opcodes = tables.opcodes;
  27074. this.order = tables.order;
  27075. this.strings = strings;
  27076. this.values = Object.create(null);
  27077. }
  27078. setByKey(key, value) {
  27079. if (!(key in this.keyToNameMap)) {
  27080. return false;
  27081. }
  27082. if (value.length === 0) {
  27083. return true;
  27084. }
  27085. for (const val of value) {
  27086. if (isNaN(val)) {
  27087. (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`);
  27088. return true;
  27089. }
  27090. }
  27091. const type = this.types[key];
  27092. if (type === "num" || type === "sid" || type === "offset") {
  27093. value = value[0];
  27094. }
  27095. this.values[key] = value;
  27096. return true;
  27097. }
  27098. setByName(name, value) {
  27099. if (!(name in this.nameToKeyMap)) {
  27100. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  27101. }
  27102. this.values[this.nameToKeyMap[name]] = value;
  27103. }
  27104. hasName(name) {
  27105. return this.nameToKeyMap[name] in this.values;
  27106. }
  27107. getByName(name) {
  27108. if (!(name in this.nameToKeyMap)) {
  27109. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  27110. }
  27111. const key = this.nameToKeyMap[name];
  27112. if (!(key in this.values)) {
  27113. return this.defaults[key];
  27114. }
  27115. return this.values[key];
  27116. }
  27117. removeByName(name) {
  27118. delete this.values[this.nameToKeyMap[name]];
  27119. }
  27120. static createTables(layout) {
  27121. const tables = {
  27122. keyToNameMap: {},
  27123. nameToKeyMap: {},
  27124. defaults: {},
  27125. types: {},
  27126. opcodes: {},
  27127. order: []
  27128. };
  27129. for (const entry of layout) {
  27130. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  27131. tables.keyToNameMap[key] = entry[1];
  27132. tables.nameToKeyMap[entry[1]] = key;
  27133. tables.types[key] = entry[2];
  27134. tables.defaults[key] = entry[3];
  27135. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  27136. tables.order.push(key);
  27137. }
  27138. return tables;
  27139. }
  27140. }
  27141. 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]];
  27142. class CFFTopDict extends CFFDict {
  27143. static get tables() {
  27144. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  27145. }
  27146. constructor(strings) {
  27147. super(CFFTopDict.tables, strings);
  27148. this.privateDict = null;
  27149. }
  27150. }
  27151. exports.CFFTopDict = CFFTopDict;
  27152. 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]];
  27153. class CFFPrivateDict extends CFFDict {
  27154. static get tables() {
  27155. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  27156. }
  27157. constructor(strings) {
  27158. super(CFFPrivateDict.tables, strings);
  27159. this.subrsIndex = null;
  27160. }
  27161. }
  27162. exports.CFFPrivateDict = CFFPrivateDict;
  27163. const CFFCharsetPredefinedTypes = {
  27164. ISO_ADOBE: 0,
  27165. EXPERT: 1,
  27166. EXPERT_SUBSET: 2
  27167. };
  27168. class CFFCharset {
  27169. constructor(predefined, format, charset, raw) {
  27170. this.predefined = predefined;
  27171. this.format = format;
  27172. this.charset = charset;
  27173. this.raw = raw;
  27174. }
  27175. }
  27176. exports.CFFCharset = CFFCharset;
  27177. class CFFEncoding {
  27178. constructor(predefined, format, encoding, raw) {
  27179. this.predefined = predefined;
  27180. this.format = format;
  27181. this.encoding = encoding;
  27182. this.raw = raw;
  27183. }
  27184. }
  27185. class CFFFDSelect {
  27186. constructor(format, fdSelect) {
  27187. this.format = format;
  27188. this.fdSelect = fdSelect;
  27189. }
  27190. getFDIndex(glyphIndex) {
  27191. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  27192. return -1;
  27193. }
  27194. return this.fdSelect[glyphIndex];
  27195. }
  27196. }
  27197. exports.CFFFDSelect = CFFFDSelect;
  27198. class CFFOffsetTracker {
  27199. constructor() {
  27200. this.offsets = Object.create(null);
  27201. }
  27202. isTracking(key) {
  27203. return key in this.offsets;
  27204. }
  27205. track(key, location) {
  27206. if (key in this.offsets) {
  27207. throw new _util.FormatError(`Already tracking location of ${key}`);
  27208. }
  27209. this.offsets[key] = location;
  27210. }
  27211. offset(value) {
  27212. for (const key in this.offsets) {
  27213. this.offsets[key] += value;
  27214. }
  27215. }
  27216. setEntryLocation(key, values, output) {
  27217. if (!(key in this.offsets)) {
  27218. throw new _util.FormatError(`Not tracking location of ${key}`);
  27219. }
  27220. const data = output.data;
  27221. const dataOffset = this.offsets[key];
  27222. const size = 5;
  27223. for (let i = 0, ii = values.length; i < ii; ++i) {
  27224. const offset0 = i * size + dataOffset;
  27225. const offset1 = offset0 + 1;
  27226. const offset2 = offset0 + 2;
  27227. const offset3 = offset0 + 3;
  27228. const offset4 = offset0 + 4;
  27229. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  27230. throw new _util.FormatError("writing to an offset that is not empty");
  27231. }
  27232. const value = values[i];
  27233. data[offset0] = 0x1d;
  27234. data[offset1] = value >> 24 & 0xff;
  27235. data[offset2] = value >> 16 & 0xff;
  27236. data[offset3] = value >> 8 & 0xff;
  27237. data[offset4] = value & 0xff;
  27238. }
  27239. }
  27240. }
  27241. class CFFCompiler {
  27242. constructor(cff) {
  27243. this.cff = cff;
  27244. }
  27245. compile() {
  27246. const cff = this.cff;
  27247. const output = {
  27248. data: [],
  27249. length: 0,
  27250. add(data) {
  27251. this.data = this.data.concat(data);
  27252. this.length = this.data.length;
  27253. }
  27254. };
  27255. const header = this.compileHeader(cff.header);
  27256. output.add(header);
  27257. const nameIndex = this.compileNameIndex(cff.names);
  27258. output.add(nameIndex);
  27259. if (cff.isCIDFont) {
  27260. if (cff.topDict.hasName("FontMatrix")) {
  27261. const base = cff.topDict.getByName("FontMatrix");
  27262. cff.topDict.removeByName("FontMatrix");
  27263. for (const subDict of cff.fdArray) {
  27264. let matrix = base.slice(0);
  27265. if (subDict.hasName("FontMatrix")) {
  27266. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  27267. }
  27268. subDict.setByName("FontMatrix", matrix);
  27269. }
  27270. }
  27271. }
  27272. const xuid = cff.topDict.getByName("XUID");
  27273. if (xuid && xuid.length > 16) {
  27274. cff.topDict.removeByName("XUID");
  27275. }
  27276. cff.topDict.setByName("charset", 0);
  27277. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  27278. output.add(compiled.output);
  27279. const topDictTracker = compiled.trackers[0];
  27280. const stringIndex = this.compileStringIndex(cff.strings.strings);
  27281. output.add(stringIndex);
  27282. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  27283. output.add(globalSubrIndex);
  27284. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  27285. if (cff.encoding.predefined) {
  27286. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  27287. } else {
  27288. const encoding = this.compileEncoding(cff.encoding);
  27289. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  27290. output.add(encoding);
  27291. }
  27292. }
  27293. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  27294. topDictTracker.setEntryLocation("charset", [output.length], output);
  27295. output.add(charset);
  27296. const charStrings = this.compileCharStrings(cff.charStrings);
  27297. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  27298. output.add(charStrings);
  27299. if (cff.isCIDFont) {
  27300. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  27301. const fdSelect = this.compileFDSelect(cff.fdSelect);
  27302. output.add(fdSelect);
  27303. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  27304. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  27305. output.add(compiled.output);
  27306. const fontDictTrackers = compiled.trackers;
  27307. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  27308. }
  27309. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  27310. output.add([0]);
  27311. return output.data;
  27312. }
  27313. encodeNumber(value) {
  27314. if (Number.isInteger(value)) {
  27315. return this.encodeInteger(value);
  27316. }
  27317. return this.encodeFloat(value);
  27318. }
  27319. static get EncodeFloatRegExp() {
  27320. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  27321. }
  27322. encodeFloat(num) {
  27323. let value = num.toString();
  27324. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  27325. if (m) {
  27326. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  27327. value = (Math.round(num * epsilon) / epsilon).toString();
  27328. }
  27329. let nibbles = "";
  27330. let i, ii;
  27331. for (i = 0, ii = value.length; i < ii; ++i) {
  27332. const a = value[i];
  27333. if (a === "e") {
  27334. nibbles += value[++i] === "-" ? "c" : "b";
  27335. } else if (a === ".") {
  27336. nibbles += "a";
  27337. } else if (a === "-") {
  27338. nibbles += "e";
  27339. } else {
  27340. nibbles += a;
  27341. }
  27342. }
  27343. nibbles += nibbles.length & 1 ? "f" : "ff";
  27344. const out = [30];
  27345. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  27346. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  27347. }
  27348. return out;
  27349. }
  27350. encodeInteger(value) {
  27351. let code;
  27352. if (value >= -107 && value <= 107) {
  27353. code = [value + 139];
  27354. } else if (value >= 108 && value <= 1131) {
  27355. value -= 108;
  27356. code = [(value >> 8) + 247, value & 0xff];
  27357. } else if (value >= -1131 && value <= -108) {
  27358. value = -value - 108;
  27359. code = [(value >> 8) + 251, value & 0xff];
  27360. } else if (value >= -32768 && value <= 32767) {
  27361. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  27362. } else {
  27363. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  27364. }
  27365. return code;
  27366. }
  27367. compileHeader(header) {
  27368. return [header.major, header.minor, 4, header.offSize];
  27369. }
  27370. compileNameIndex(names) {
  27371. const nameIndex = new CFFIndex();
  27372. for (const name of names) {
  27373. const length = Math.min(name.length, 127);
  27374. let sanitizedName = new Array(length);
  27375. for (let j = 0; j < length; j++) {
  27376. let char = name[j];
  27377. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  27378. char = "_";
  27379. }
  27380. sanitizedName[j] = char;
  27381. }
  27382. sanitizedName = sanitizedName.join("");
  27383. if (sanitizedName === "") {
  27384. sanitizedName = "Bad_Font_Name";
  27385. }
  27386. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  27387. }
  27388. return this.compileIndex(nameIndex);
  27389. }
  27390. compileTopDicts(dicts, length, removeCidKeys) {
  27391. const fontDictTrackers = [];
  27392. let fdArrayIndex = new CFFIndex();
  27393. for (const fontDict of dicts) {
  27394. if (removeCidKeys) {
  27395. fontDict.removeByName("CIDFontVersion");
  27396. fontDict.removeByName("CIDFontRevision");
  27397. fontDict.removeByName("CIDFontType");
  27398. fontDict.removeByName("CIDCount");
  27399. fontDict.removeByName("UIDBase");
  27400. }
  27401. const fontDictTracker = new CFFOffsetTracker();
  27402. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  27403. fontDictTrackers.push(fontDictTracker);
  27404. fdArrayIndex.add(fontDictData);
  27405. fontDictTracker.offset(length);
  27406. }
  27407. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  27408. return {
  27409. trackers: fontDictTrackers,
  27410. output: fdArrayIndex
  27411. };
  27412. }
  27413. compilePrivateDicts(dicts, trackers, output) {
  27414. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  27415. const fontDict = dicts[i];
  27416. const privateDict = fontDict.privateDict;
  27417. if (!privateDict || !fontDict.hasName("Private")) {
  27418. throw new _util.FormatError("There must be a private dictionary.");
  27419. }
  27420. const privateDictTracker = new CFFOffsetTracker();
  27421. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  27422. let outputLength = output.length;
  27423. privateDictTracker.offset(outputLength);
  27424. if (!privateDictData.length) {
  27425. outputLength = 0;
  27426. }
  27427. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  27428. output.add(privateDictData);
  27429. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  27430. const subrs = this.compileIndex(privateDict.subrsIndex);
  27431. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  27432. output.add(subrs);
  27433. }
  27434. }
  27435. }
  27436. compileDict(dict, offsetTracker) {
  27437. const out = [];
  27438. for (const key of dict.order) {
  27439. if (!(key in dict.values)) {
  27440. continue;
  27441. }
  27442. let values = dict.values[key];
  27443. let types = dict.types[key];
  27444. if (!Array.isArray(types)) {
  27445. types = [types];
  27446. }
  27447. if (!Array.isArray(values)) {
  27448. values = [values];
  27449. }
  27450. if (values.length === 0) {
  27451. continue;
  27452. }
  27453. for (let j = 0, jj = types.length; j < jj; ++j) {
  27454. const type = types[j];
  27455. const value = values[j];
  27456. switch (type) {
  27457. case "num":
  27458. case "sid":
  27459. out.push(...this.encodeNumber(value));
  27460. break;
  27461. case "offset":
  27462. const name = dict.keyToNameMap[key];
  27463. if (!offsetTracker.isTracking(name)) {
  27464. offsetTracker.track(name, out.length);
  27465. }
  27466. out.push(0x1d, 0, 0, 0, 0);
  27467. break;
  27468. case "array":
  27469. case "delta":
  27470. out.push(...this.encodeNumber(value));
  27471. for (let k = 1, kk = values.length; k < kk; ++k) {
  27472. out.push(...this.encodeNumber(values[k]));
  27473. }
  27474. break;
  27475. default:
  27476. throw new _util.FormatError(`Unknown data type of ${type}`);
  27477. }
  27478. }
  27479. out.push(...dict.opcodes[key]);
  27480. }
  27481. return out;
  27482. }
  27483. compileStringIndex(strings) {
  27484. const stringIndex = new CFFIndex();
  27485. for (const string of strings) {
  27486. stringIndex.add((0, _util.stringToBytes)(string));
  27487. }
  27488. return this.compileIndex(stringIndex);
  27489. }
  27490. compileGlobalSubrIndex() {
  27491. const globalSubrIndex = this.cff.globalSubrIndex;
  27492. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  27493. }
  27494. compileCharStrings(charStrings) {
  27495. const charStringsIndex = new CFFIndex();
  27496. for (let i = 0; i < charStrings.count; i++) {
  27497. const glyph = charStrings.get(i);
  27498. if (glyph.length === 0) {
  27499. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  27500. continue;
  27501. }
  27502. charStringsIndex.add(glyph);
  27503. }
  27504. return this.compileIndex(charStringsIndex);
  27505. }
  27506. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  27507. let out;
  27508. const numGlyphsLessNotDef = numGlyphs - 1;
  27509. if (isCIDFont) {
  27510. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  27511. } else {
  27512. const length = 1 + numGlyphsLessNotDef * 2;
  27513. out = new Uint8Array(length);
  27514. out[0] = 0;
  27515. let charsetIndex = 0;
  27516. const numCharsets = charset.charset.length;
  27517. let warned = false;
  27518. for (let i = 1; i < out.length; i += 2) {
  27519. let sid = 0;
  27520. if (charsetIndex < numCharsets) {
  27521. const name = charset.charset[charsetIndex++];
  27522. sid = strings.getSID(name);
  27523. if (sid === -1) {
  27524. sid = 0;
  27525. if (!warned) {
  27526. warned = true;
  27527. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  27528. }
  27529. }
  27530. }
  27531. out[i] = sid >> 8 & 0xff;
  27532. out[i + 1] = sid & 0xff;
  27533. }
  27534. }
  27535. return this.compileTypedArray(out);
  27536. }
  27537. compileEncoding(encoding) {
  27538. return this.compileTypedArray(encoding.raw);
  27539. }
  27540. compileFDSelect(fdSelect) {
  27541. const format = fdSelect.format;
  27542. let out, i;
  27543. switch (format) {
  27544. case 0:
  27545. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  27546. out[0] = format;
  27547. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  27548. out[i + 1] = fdSelect.fdSelect[i];
  27549. }
  27550. break;
  27551. case 3:
  27552. const start = 0;
  27553. let lastFD = fdSelect.fdSelect[0];
  27554. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  27555. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  27556. const currentFD = fdSelect.fdSelect[i];
  27557. if (currentFD !== lastFD) {
  27558. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  27559. lastFD = currentFD;
  27560. }
  27561. }
  27562. const numRanges = (ranges.length - 3) / 3;
  27563. ranges[1] = numRanges >> 8 & 0xff;
  27564. ranges[2] = numRanges & 0xff;
  27565. ranges.push(i >> 8 & 0xff, i & 0xff);
  27566. out = new Uint8Array(ranges);
  27567. break;
  27568. }
  27569. return this.compileTypedArray(out);
  27570. }
  27571. compileTypedArray(data) {
  27572. const out = [];
  27573. for (let i = 0, ii = data.length; i < ii; ++i) {
  27574. out[i] = data[i];
  27575. }
  27576. return out;
  27577. }
  27578. compileIndex(index) {
  27579. let trackers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  27580. const objects = index.objects;
  27581. const count = objects.length;
  27582. if (count === 0) {
  27583. return [0, 0];
  27584. }
  27585. const data = [count >> 8 & 0xff, count & 0xff];
  27586. let lastOffset = 1,
  27587. i;
  27588. for (i = 0; i < count; ++i) {
  27589. lastOffset += objects[i].length;
  27590. }
  27591. let offsetSize;
  27592. if (lastOffset < 0x100) {
  27593. offsetSize = 1;
  27594. } else if (lastOffset < 0x10000) {
  27595. offsetSize = 2;
  27596. } else if (lastOffset < 0x1000000) {
  27597. offsetSize = 3;
  27598. } else {
  27599. offsetSize = 4;
  27600. }
  27601. data.push(offsetSize);
  27602. let relativeOffset = 1;
  27603. for (i = 0; i < count + 1; i++) {
  27604. if (offsetSize === 1) {
  27605. data.push(relativeOffset & 0xff);
  27606. } else if (offsetSize === 2) {
  27607. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27608. } else if (offsetSize === 3) {
  27609. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27610. } else {
  27611. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27612. }
  27613. if (objects[i]) {
  27614. relativeOffset += objects[i].length;
  27615. }
  27616. }
  27617. for (i = 0; i < count; i++) {
  27618. if (trackers[i]) {
  27619. trackers[i].offset(data.length);
  27620. }
  27621. data.push(...objects[i]);
  27622. }
  27623. return data;
  27624. }
  27625. }
  27626. exports.CFFCompiler = CFFCompiler;
  27627. /***/ }),
  27628. /* 165 */
  27629. /***/ ((__unused_webpack_module, exports) => {
  27630. "use strict";
  27631. Object.defineProperty(exports, "__esModule", ({
  27632. value: true
  27633. }));
  27634. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  27635. 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"];
  27636. exports.ISOAdobeCharset = ISOAdobeCharset;
  27637. 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"];
  27638. exports.ExpertCharset = ExpertCharset;
  27639. 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"];
  27640. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  27641. /***/ }),
  27642. /* 166 */
  27643. /***/ ((__unused_webpack_module, exports) => {
  27644. "use strict";
  27645. Object.defineProperty(exports, "__esModule", ({
  27646. value: true
  27647. }));
  27648. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  27649. exports.getEncoding = getEncoding;
  27650. 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"];
  27651. exports.ExpertEncoding = ExpertEncoding;
  27652. 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", "", "", "", ""];
  27653. 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"];
  27654. exports.MacRomanEncoding = MacRomanEncoding;
  27655. 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", "", "", "", ""];
  27656. exports.StandardEncoding = StandardEncoding;
  27657. 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"];
  27658. exports.WinAnsiEncoding = WinAnsiEncoding;
  27659. 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", ""];
  27660. exports.SymbolSetEncoding = SymbolSetEncoding;
  27661. 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", ""];
  27662. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  27663. function getEncoding(encodingName) {
  27664. switch (encodingName) {
  27665. case "WinAnsiEncoding":
  27666. return WinAnsiEncoding;
  27667. case "StandardEncoding":
  27668. return StandardEncoding;
  27669. case "MacRomanEncoding":
  27670. return MacRomanEncoding;
  27671. case "SymbolSetEncoding":
  27672. return SymbolSetEncoding;
  27673. case "ZapfDingbatsEncoding":
  27674. return ZapfDingbatsEncoding;
  27675. case "ExpertEncoding":
  27676. return ExpertEncoding;
  27677. case "MacExpertEncoding":
  27678. return MacExpertEncoding;
  27679. default:
  27680. return null;
  27681. }
  27682. }
  27683. /***/ }),
  27684. /* 167 */
  27685. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  27686. "use strict";
  27687. Object.defineProperty(exports, "__esModule", ({
  27688. value: true
  27689. }));
  27690. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  27691. exports.getFontType = getFontType;
  27692. exports.normalizeFontName = normalizeFontName;
  27693. exports.recoverGlyphName = recoverGlyphName;
  27694. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  27695. var _util = __w_pdfjs_require__(2);
  27696. var _encodings = __w_pdfjs_require__(166);
  27697. var _glyphlist = __w_pdfjs_require__(168);
  27698. var _unicode = __w_pdfjs_require__(169);
  27699. const SEAC_ANALYSIS_ENABLED = true;
  27700. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  27701. const FontFlags = {
  27702. FixedPitch: 1,
  27703. Serif: 2,
  27704. Symbolic: 4,
  27705. Script: 8,
  27706. Nonsymbolic: 32,
  27707. Italic: 64,
  27708. AllCap: 65536,
  27709. SmallCap: 131072,
  27710. ForceBold: 262144
  27711. };
  27712. exports.FontFlags = FontFlags;
  27713. 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"];
  27714. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  27715. function getFontType(type, subtype) {
  27716. let isStandardFont = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  27717. switch (type) {
  27718. case "Type1":
  27719. if (isStandardFont) {
  27720. return _util.FontType.TYPE1STANDARD;
  27721. }
  27722. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  27723. case "CIDFontType0":
  27724. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  27725. case "OpenType":
  27726. return _util.FontType.OPENTYPE;
  27727. case "TrueType":
  27728. return _util.FontType.TRUETYPE;
  27729. case "CIDFontType2":
  27730. return _util.FontType.CIDFONTTYPE2;
  27731. case "MMType1":
  27732. return _util.FontType.MMTYPE1;
  27733. case "Type0":
  27734. return _util.FontType.TYPE0;
  27735. default:
  27736. return _util.FontType.UNKNOWN;
  27737. }
  27738. }
  27739. function recoverGlyphName(name, glyphsUnicodeMap) {
  27740. if (glyphsUnicodeMap[name] !== undefined) {
  27741. return name;
  27742. }
  27743. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  27744. if (unicode !== -1) {
  27745. for (const key in glyphsUnicodeMap) {
  27746. if (glyphsUnicodeMap[key] === unicode) {
  27747. return key;
  27748. }
  27749. }
  27750. }
  27751. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  27752. return name;
  27753. }
  27754. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  27755. const charCodeToGlyphId = Object.create(null);
  27756. let glyphId, charCode, baseEncoding;
  27757. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27758. if (properties.isInternalFont) {
  27759. baseEncoding = builtInEncoding;
  27760. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27761. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27762. if (glyphId >= 0) {
  27763. charCodeToGlyphId[charCode] = glyphId;
  27764. } else {
  27765. charCodeToGlyphId[charCode] = 0;
  27766. }
  27767. }
  27768. } else if (properties.baseEncodingName) {
  27769. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  27770. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27771. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27772. if (glyphId >= 0) {
  27773. charCodeToGlyphId[charCode] = glyphId;
  27774. } else {
  27775. charCodeToGlyphId[charCode] = 0;
  27776. }
  27777. }
  27778. } else if (isSymbolicFont) {
  27779. for (charCode in builtInEncoding) {
  27780. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  27781. }
  27782. } else {
  27783. baseEncoding = _encodings.StandardEncoding;
  27784. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27785. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27786. if (glyphId >= 0) {
  27787. charCodeToGlyphId[charCode] = glyphId;
  27788. } else {
  27789. charCodeToGlyphId[charCode] = 0;
  27790. }
  27791. }
  27792. }
  27793. const differences = properties.differences;
  27794. let glyphsUnicodeMap;
  27795. if (differences) {
  27796. for (charCode in differences) {
  27797. const glyphName = differences[charCode];
  27798. glyphId = glyphNames.indexOf(glyphName);
  27799. if (glyphId === -1) {
  27800. if (!glyphsUnicodeMap) {
  27801. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  27802. }
  27803. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  27804. if (standardGlyphName !== glyphName) {
  27805. glyphId = glyphNames.indexOf(standardGlyphName);
  27806. }
  27807. }
  27808. if (glyphId >= 0) {
  27809. charCodeToGlyphId[charCode] = glyphId;
  27810. } else {
  27811. charCodeToGlyphId[charCode] = 0;
  27812. }
  27813. }
  27814. }
  27815. return charCodeToGlyphId;
  27816. }
  27817. function normalizeFontName(name) {
  27818. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  27819. }
  27820. /***/ }),
  27821. /* 168 */
  27822. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  27823. "use strict";
  27824. __w_pdfjs_require__.r(__webpack_exports__);
  27825. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  27826. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  27827. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  27828. /* harmony export */ });
  27829. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(135);
  27830. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  27831. return [
  27832. "A",
  27833. 0x0041,
  27834. "AE",
  27835. 0x00c6,
  27836. "AEacute",
  27837. 0x01fc,
  27838. "AEmacron",
  27839. 0x01e2,
  27840. "AEsmall",
  27841. 0xf7e6,
  27842. "Aacute",
  27843. 0x00c1,
  27844. "Aacutesmall",
  27845. 0xf7e1,
  27846. "Abreve",
  27847. 0x0102,
  27848. "Abreveacute",
  27849. 0x1eae,
  27850. "Abrevecyrillic",
  27851. 0x04d0,
  27852. "Abrevedotbelow",
  27853. 0x1eb6,
  27854. "Abrevegrave",
  27855. 0x1eb0,
  27856. "Abrevehookabove",
  27857. 0x1eb2,
  27858. "Abrevetilde",
  27859. 0x1eb4,
  27860. "Acaron",
  27861. 0x01cd,
  27862. "Acircle",
  27863. 0x24b6,
  27864. "Acircumflex",
  27865. 0x00c2,
  27866. "Acircumflexacute",
  27867. 0x1ea4,
  27868. "Acircumflexdotbelow",
  27869. 0x1eac,
  27870. "Acircumflexgrave",
  27871. 0x1ea6,
  27872. "Acircumflexhookabove",
  27873. 0x1ea8,
  27874. "Acircumflexsmall",
  27875. 0xf7e2,
  27876. "Acircumflextilde",
  27877. 0x1eaa,
  27878. "Acute",
  27879. 0xf6c9,
  27880. "Acutesmall",
  27881. 0xf7b4,
  27882. "Acyrillic",
  27883. 0x0410,
  27884. "Adblgrave",
  27885. 0x0200,
  27886. "Adieresis",
  27887. 0x00c4,
  27888. "Adieresiscyrillic",
  27889. 0x04d2,
  27890. "Adieresismacron",
  27891. 0x01de,
  27892. "Adieresissmall",
  27893. 0xf7e4,
  27894. "Adotbelow",
  27895. 0x1ea0,
  27896. "Adotmacron",
  27897. 0x01e0,
  27898. "Agrave",
  27899. 0x00c0,
  27900. "Agravesmall",
  27901. 0xf7e0,
  27902. "Ahookabove",
  27903. 0x1ea2,
  27904. "Aiecyrillic",
  27905. 0x04d4,
  27906. "Ainvertedbreve",
  27907. 0x0202,
  27908. "Alpha",
  27909. 0x0391,
  27910. "Alphatonos",
  27911. 0x0386,
  27912. "Amacron",
  27913. 0x0100,
  27914. "Amonospace",
  27915. 0xff21,
  27916. "Aogonek",
  27917. 0x0104,
  27918. "Aring",
  27919. 0x00c5,
  27920. "Aringacute",
  27921. 0x01fa,
  27922. "Aringbelow",
  27923. 0x1e00,
  27924. "Aringsmall",
  27925. 0xf7e5,
  27926. "Asmall",
  27927. 0xf761,
  27928. "Atilde",
  27929. 0x00c3,
  27930. "Atildesmall",
  27931. 0xf7e3,
  27932. "Aybarmenian",
  27933. 0x0531,
  27934. "B",
  27935. 0x0042,
  27936. "Bcircle",
  27937. 0x24b7,
  27938. "Bdotaccent",
  27939. 0x1e02,
  27940. "Bdotbelow",
  27941. 0x1e04,
  27942. "Becyrillic",
  27943. 0x0411,
  27944. "Benarmenian",
  27945. 0x0532,
  27946. "Beta",
  27947. 0x0392,
  27948. "Bhook",
  27949. 0x0181,
  27950. "Blinebelow",
  27951. 0x1e06,
  27952. "Bmonospace",
  27953. 0xff22,
  27954. "Brevesmall",
  27955. 0xf6f4,
  27956. "Bsmall",
  27957. 0xf762,
  27958. "Btopbar",
  27959. 0x0182,
  27960. "C",
  27961. 0x0043,
  27962. "Caarmenian",
  27963. 0x053e,
  27964. "Cacute",
  27965. 0x0106,
  27966. "Caron",
  27967. 0xf6ca,
  27968. "Caronsmall",
  27969. 0xf6f5,
  27970. "Ccaron",
  27971. 0x010c,
  27972. "Ccedilla",
  27973. 0x00c7,
  27974. "Ccedillaacute",
  27975. 0x1e08,
  27976. "Ccedillasmall",
  27977. 0xf7e7,
  27978. "Ccircle",
  27979. 0x24b8,
  27980. "Ccircumflex",
  27981. 0x0108,
  27982. "Cdot",
  27983. 0x010a,
  27984. "Cdotaccent",
  27985. 0x010a,
  27986. "Cedillasmall",
  27987. 0xf7b8,
  27988. "Chaarmenian",
  27989. 0x0549,
  27990. "Cheabkhasiancyrillic",
  27991. 0x04bc,
  27992. "Checyrillic",
  27993. 0x0427,
  27994. "Chedescenderabkhasiancyrillic",
  27995. 0x04be,
  27996. "Chedescendercyrillic",
  27997. 0x04b6,
  27998. "Chedieresiscyrillic",
  27999. 0x04f4,
  28000. "Cheharmenian",
  28001. 0x0543,
  28002. "Chekhakassiancyrillic",
  28003. 0x04cb,
  28004. "Cheverticalstrokecyrillic",
  28005. 0x04b8,
  28006. "Chi",
  28007. 0x03a7,
  28008. "Chook",
  28009. 0x0187,
  28010. "Circumflexsmall",
  28011. 0xf6f6,
  28012. "Cmonospace",
  28013. 0xff23,
  28014. "Coarmenian",
  28015. 0x0551,
  28016. "Csmall",
  28017. 0xf763,
  28018. "D",
  28019. 0x0044,
  28020. "DZ",
  28021. 0x01f1,
  28022. "DZcaron",
  28023. 0x01c4,
  28024. "Daarmenian",
  28025. 0x0534,
  28026. "Dafrican",
  28027. 0x0189,
  28028. "Dcaron",
  28029. 0x010e,
  28030. "Dcedilla",
  28031. 0x1e10,
  28032. "Dcircle",
  28033. 0x24b9,
  28034. "Dcircumflexbelow",
  28035. 0x1e12,
  28036. "Dcroat",
  28037. 0x0110,
  28038. "Ddotaccent",
  28039. 0x1e0a,
  28040. "Ddotbelow",
  28041. 0x1e0c,
  28042. "Decyrillic",
  28043. 0x0414,
  28044. "Deicoptic",
  28045. 0x03ee,
  28046. "Delta",
  28047. 0x2206,
  28048. "Deltagreek",
  28049. 0x0394,
  28050. "Dhook",
  28051. 0x018a,
  28052. "Dieresis",
  28053. 0xf6cb,
  28054. "DieresisAcute",
  28055. 0xf6cc,
  28056. "DieresisGrave",
  28057. 0xf6cd,
  28058. "Dieresissmall",
  28059. 0xf7a8,
  28060. "Digammagreek",
  28061. 0x03dc,
  28062. "Djecyrillic",
  28063. 0x0402,
  28064. "Dlinebelow",
  28065. 0x1e0e,
  28066. "Dmonospace",
  28067. 0xff24,
  28068. "Dotaccentsmall",
  28069. 0xf6f7,
  28070. "Dslash",
  28071. 0x0110,
  28072. "Dsmall",
  28073. 0xf764,
  28074. "Dtopbar",
  28075. 0x018b,
  28076. "Dz",
  28077. 0x01f2,
  28078. "Dzcaron",
  28079. 0x01c5,
  28080. "Dzeabkhasiancyrillic",
  28081. 0x04e0,
  28082. "Dzecyrillic",
  28083. 0x0405,
  28084. "Dzhecyrillic",
  28085. 0x040f,
  28086. "E",
  28087. 0x0045,
  28088. "Eacute",
  28089. 0x00c9,
  28090. "Eacutesmall",
  28091. 0xf7e9,
  28092. "Ebreve",
  28093. 0x0114,
  28094. "Ecaron",
  28095. 0x011a,
  28096. "Ecedillabreve",
  28097. 0x1e1c,
  28098. "Echarmenian",
  28099. 0x0535,
  28100. "Ecircle",
  28101. 0x24ba,
  28102. "Ecircumflex",
  28103. 0x00ca,
  28104. "Ecircumflexacute",
  28105. 0x1ebe,
  28106. "Ecircumflexbelow",
  28107. 0x1e18,
  28108. "Ecircumflexdotbelow",
  28109. 0x1ec6,
  28110. "Ecircumflexgrave",
  28111. 0x1ec0,
  28112. "Ecircumflexhookabove",
  28113. 0x1ec2,
  28114. "Ecircumflexsmall",
  28115. 0xf7ea,
  28116. "Ecircumflextilde",
  28117. 0x1ec4,
  28118. "Ecyrillic",
  28119. 0x0404,
  28120. "Edblgrave",
  28121. 0x0204,
  28122. "Edieresis",
  28123. 0x00cb,
  28124. "Edieresissmall",
  28125. 0xf7eb,
  28126. "Edot",
  28127. 0x0116,
  28128. "Edotaccent",
  28129. 0x0116,
  28130. "Edotbelow",
  28131. 0x1eb8,
  28132. "Efcyrillic",
  28133. 0x0424,
  28134. "Egrave",
  28135. 0x00c8,
  28136. "Egravesmall",
  28137. 0xf7e8,
  28138. "Eharmenian",
  28139. 0x0537,
  28140. "Ehookabove",
  28141. 0x1eba,
  28142. "Eightroman",
  28143. 0x2167,
  28144. "Einvertedbreve",
  28145. 0x0206,
  28146. "Eiotifiedcyrillic",
  28147. 0x0464,
  28148. "Elcyrillic",
  28149. 0x041b,
  28150. "Elevenroman",
  28151. 0x216a,
  28152. "Emacron",
  28153. 0x0112,
  28154. "Emacronacute",
  28155. 0x1e16,
  28156. "Emacrongrave",
  28157. 0x1e14,
  28158. "Emcyrillic",
  28159. 0x041c,
  28160. "Emonospace",
  28161. 0xff25,
  28162. "Encyrillic",
  28163. 0x041d,
  28164. "Endescendercyrillic",
  28165. 0x04a2,
  28166. "Eng",
  28167. 0x014a,
  28168. "Enghecyrillic",
  28169. 0x04a4,
  28170. "Enhookcyrillic",
  28171. 0x04c7,
  28172. "Eogonek",
  28173. 0x0118,
  28174. "Eopen",
  28175. 0x0190,
  28176. "Epsilon",
  28177. 0x0395,
  28178. "Epsilontonos",
  28179. 0x0388,
  28180. "Ercyrillic",
  28181. 0x0420,
  28182. "Ereversed",
  28183. 0x018e,
  28184. "Ereversedcyrillic",
  28185. 0x042d,
  28186. "Escyrillic",
  28187. 0x0421,
  28188. "Esdescendercyrillic",
  28189. 0x04aa,
  28190. "Esh",
  28191. 0x01a9,
  28192. "Esmall",
  28193. 0xf765,
  28194. "Eta",
  28195. 0x0397,
  28196. "Etarmenian",
  28197. 0x0538,
  28198. "Etatonos",
  28199. 0x0389,
  28200. "Eth",
  28201. 0x00d0,
  28202. "Ethsmall",
  28203. 0xf7f0,
  28204. "Etilde",
  28205. 0x1ebc,
  28206. "Etildebelow",
  28207. 0x1e1a,
  28208. "Euro",
  28209. 0x20ac,
  28210. "Ezh",
  28211. 0x01b7,
  28212. "Ezhcaron",
  28213. 0x01ee,
  28214. "Ezhreversed",
  28215. 0x01b8,
  28216. "F",
  28217. 0x0046,
  28218. "Fcircle",
  28219. 0x24bb,
  28220. "Fdotaccent",
  28221. 0x1e1e,
  28222. "Feharmenian",
  28223. 0x0556,
  28224. "Feicoptic",
  28225. 0x03e4,
  28226. "Fhook",
  28227. 0x0191,
  28228. "Fitacyrillic",
  28229. 0x0472,
  28230. "Fiveroman",
  28231. 0x2164,
  28232. "Fmonospace",
  28233. 0xff26,
  28234. "Fourroman",
  28235. 0x2163,
  28236. "Fsmall",
  28237. 0xf766,
  28238. "G",
  28239. 0x0047,
  28240. "GBsquare",
  28241. 0x3387,
  28242. "Gacute",
  28243. 0x01f4,
  28244. "Gamma",
  28245. 0x0393,
  28246. "Gammaafrican",
  28247. 0x0194,
  28248. "Gangiacoptic",
  28249. 0x03ea,
  28250. "Gbreve",
  28251. 0x011e,
  28252. "Gcaron",
  28253. 0x01e6,
  28254. "Gcedilla",
  28255. 0x0122,
  28256. "Gcircle",
  28257. 0x24bc,
  28258. "Gcircumflex",
  28259. 0x011c,
  28260. "Gcommaaccent",
  28261. 0x0122,
  28262. "Gdot",
  28263. 0x0120,
  28264. "Gdotaccent",
  28265. 0x0120,
  28266. "Gecyrillic",
  28267. 0x0413,
  28268. "Ghadarmenian",
  28269. 0x0542,
  28270. "Ghemiddlehookcyrillic",
  28271. 0x0494,
  28272. "Ghestrokecyrillic",
  28273. 0x0492,
  28274. "Gheupturncyrillic",
  28275. 0x0490,
  28276. "Ghook",
  28277. 0x0193,
  28278. "Gimarmenian",
  28279. 0x0533,
  28280. "Gjecyrillic",
  28281. 0x0403,
  28282. "Gmacron",
  28283. 0x1e20,
  28284. "Gmonospace",
  28285. 0xff27,
  28286. "Grave",
  28287. 0xf6ce,
  28288. "Gravesmall",
  28289. 0xf760,
  28290. "Gsmall",
  28291. 0xf767,
  28292. "Gsmallhook",
  28293. 0x029b,
  28294. "Gstroke",
  28295. 0x01e4,
  28296. "H",
  28297. 0x0048,
  28298. "H18533",
  28299. 0x25cf,
  28300. "H18543",
  28301. 0x25aa,
  28302. "H18551",
  28303. 0x25ab,
  28304. "H22073",
  28305. 0x25a1,
  28306. "HPsquare",
  28307. 0x33cb,
  28308. "Haabkhasiancyrillic",
  28309. 0x04a8,
  28310. "Hadescendercyrillic",
  28311. 0x04b2,
  28312. "Hardsigncyrillic",
  28313. 0x042a,
  28314. "Hbar",
  28315. 0x0126,
  28316. "Hbrevebelow",
  28317. 0x1e2a,
  28318. "Hcedilla",
  28319. 0x1e28,
  28320. "Hcircle",
  28321. 0x24bd,
  28322. "Hcircumflex",
  28323. 0x0124,
  28324. "Hdieresis",
  28325. 0x1e26,
  28326. "Hdotaccent",
  28327. 0x1e22,
  28328. "Hdotbelow",
  28329. 0x1e24,
  28330. "Hmonospace",
  28331. 0xff28,
  28332. "Hoarmenian",
  28333. 0x0540,
  28334. "Horicoptic",
  28335. 0x03e8,
  28336. "Hsmall",
  28337. 0xf768,
  28338. "Hungarumlaut",
  28339. 0xf6cf,
  28340. "Hungarumlautsmall",
  28341. 0xf6f8,
  28342. "Hzsquare",
  28343. 0x3390,
  28344. "I",
  28345. 0x0049,
  28346. "IAcyrillic",
  28347. 0x042f,
  28348. "IJ",
  28349. 0x0132,
  28350. "IUcyrillic",
  28351. 0x042e,
  28352. "Iacute",
  28353. 0x00cd,
  28354. "Iacutesmall",
  28355. 0xf7ed,
  28356. "Ibreve",
  28357. 0x012c,
  28358. "Icaron",
  28359. 0x01cf,
  28360. "Icircle",
  28361. 0x24be,
  28362. "Icircumflex",
  28363. 0x00ce,
  28364. "Icircumflexsmall",
  28365. 0xf7ee,
  28366. "Icyrillic",
  28367. 0x0406,
  28368. "Idblgrave",
  28369. 0x0208,
  28370. "Idieresis",
  28371. 0x00cf,
  28372. "Idieresisacute",
  28373. 0x1e2e,
  28374. "Idieresiscyrillic",
  28375. 0x04e4,
  28376. "Idieresissmall",
  28377. 0xf7ef,
  28378. "Idot",
  28379. 0x0130,
  28380. "Idotaccent",
  28381. 0x0130,
  28382. "Idotbelow",
  28383. 0x1eca,
  28384. "Iebrevecyrillic",
  28385. 0x04d6,
  28386. "Iecyrillic",
  28387. 0x0415,
  28388. "Ifraktur",
  28389. 0x2111,
  28390. "Igrave",
  28391. 0x00cc,
  28392. "Igravesmall",
  28393. 0xf7ec,
  28394. "Ihookabove",
  28395. 0x1ec8,
  28396. "Iicyrillic",
  28397. 0x0418,
  28398. "Iinvertedbreve",
  28399. 0x020a,
  28400. "Iishortcyrillic",
  28401. 0x0419,
  28402. "Imacron",
  28403. 0x012a,
  28404. "Imacroncyrillic",
  28405. 0x04e2,
  28406. "Imonospace",
  28407. 0xff29,
  28408. "Iniarmenian",
  28409. 0x053b,
  28410. "Iocyrillic",
  28411. 0x0401,
  28412. "Iogonek",
  28413. 0x012e,
  28414. "Iota",
  28415. 0x0399,
  28416. "Iotaafrican",
  28417. 0x0196,
  28418. "Iotadieresis",
  28419. 0x03aa,
  28420. "Iotatonos",
  28421. 0x038a,
  28422. "Ismall",
  28423. 0xf769,
  28424. "Istroke",
  28425. 0x0197,
  28426. "Itilde",
  28427. 0x0128,
  28428. "Itildebelow",
  28429. 0x1e2c,
  28430. "Izhitsacyrillic",
  28431. 0x0474,
  28432. "Izhitsadblgravecyrillic",
  28433. 0x0476,
  28434. "J",
  28435. 0x004a,
  28436. "Jaarmenian",
  28437. 0x0541,
  28438. "Jcircle",
  28439. 0x24bf,
  28440. "Jcircumflex",
  28441. 0x0134,
  28442. "Jecyrillic",
  28443. 0x0408,
  28444. "Jheharmenian",
  28445. 0x054b,
  28446. "Jmonospace",
  28447. 0xff2a,
  28448. "Jsmall",
  28449. 0xf76a,
  28450. "K",
  28451. 0x004b,
  28452. "KBsquare",
  28453. 0x3385,
  28454. "KKsquare",
  28455. 0x33cd,
  28456. "Kabashkircyrillic",
  28457. 0x04a0,
  28458. "Kacute",
  28459. 0x1e30,
  28460. "Kacyrillic",
  28461. 0x041a,
  28462. "Kadescendercyrillic",
  28463. 0x049a,
  28464. "Kahookcyrillic",
  28465. 0x04c3,
  28466. "Kappa",
  28467. 0x039a,
  28468. "Kastrokecyrillic",
  28469. 0x049e,
  28470. "Kaverticalstrokecyrillic",
  28471. 0x049c,
  28472. "Kcaron",
  28473. 0x01e8,
  28474. "Kcedilla",
  28475. 0x0136,
  28476. "Kcircle",
  28477. 0x24c0,
  28478. "Kcommaaccent",
  28479. 0x0136,
  28480. "Kdotbelow",
  28481. 0x1e32,
  28482. "Keharmenian",
  28483. 0x0554,
  28484. "Kenarmenian",
  28485. 0x053f,
  28486. "Khacyrillic",
  28487. 0x0425,
  28488. "Kheicoptic",
  28489. 0x03e6,
  28490. "Khook",
  28491. 0x0198,
  28492. "Kjecyrillic",
  28493. 0x040c,
  28494. "Klinebelow",
  28495. 0x1e34,
  28496. "Kmonospace",
  28497. 0xff2b,
  28498. "Koppacyrillic",
  28499. 0x0480,
  28500. "Koppagreek",
  28501. 0x03de,
  28502. "Ksicyrillic",
  28503. 0x046e,
  28504. "Ksmall",
  28505. 0xf76b,
  28506. "L",
  28507. 0x004c,
  28508. "LJ",
  28509. 0x01c7,
  28510. "LL",
  28511. 0xf6bf,
  28512. "Lacute",
  28513. 0x0139,
  28514. "Lambda",
  28515. 0x039b,
  28516. "Lcaron",
  28517. 0x013d,
  28518. "Lcedilla",
  28519. 0x013b,
  28520. "Lcircle",
  28521. 0x24c1,
  28522. "Lcircumflexbelow",
  28523. 0x1e3c,
  28524. "Lcommaaccent",
  28525. 0x013b,
  28526. "Ldot",
  28527. 0x013f,
  28528. "Ldotaccent",
  28529. 0x013f,
  28530. "Ldotbelow",
  28531. 0x1e36,
  28532. "Ldotbelowmacron",
  28533. 0x1e38,
  28534. "Liwnarmenian",
  28535. 0x053c,
  28536. "Lj",
  28537. 0x01c8,
  28538. "Ljecyrillic",
  28539. 0x0409,
  28540. "Llinebelow",
  28541. 0x1e3a,
  28542. "Lmonospace",
  28543. 0xff2c,
  28544. "Lslash",
  28545. 0x0141,
  28546. "Lslashsmall",
  28547. 0xf6f9,
  28548. "Lsmall",
  28549. 0xf76c,
  28550. "M",
  28551. 0x004d,
  28552. "MBsquare",
  28553. 0x3386,
  28554. "Macron",
  28555. 0xf6d0,
  28556. "Macronsmall",
  28557. 0xf7af,
  28558. "Macute",
  28559. 0x1e3e,
  28560. "Mcircle",
  28561. 0x24c2,
  28562. "Mdotaccent",
  28563. 0x1e40,
  28564. "Mdotbelow",
  28565. 0x1e42,
  28566. "Menarmenian",
  28567. 0x0544,
  28568. "Mmonospace",
  28569. 0xff2d,
  28570. "Msmall",
  28571. 0xf76d,
  28572. "Mturned",
  28573. 0x019c,
  28574. "Mu",
  28575. 0x039c,
  28576. "N",
  28577. 0x004e,
  28578. "NJ",
  28579. 0x01ca,
  28580. "Nacute",
  28581. 0x0143,
  28582. "Ncaron",
  28583. 0x0147,
  28584. "Ncedilla",
  28585. 0x0145,
  28586. "Ncircle",
  28587. 0x24c3,
  28588. "Ncircumflexbelow",
  28589. 0x1e4a,
  28590. "Ncommaaccent",
  28591. 0x0145,
  28592. "Ndotaccent",
  28593. 0x1e44,
  28594. "Ndotbelow",
  28595. 0x1e46,
  28596. "Nhookleft",
  28597. 0x019d,
  28598. "Nineroman",
  28599. 0x2168,
  28600. "Nj",
  28601. 0x01cb,
  28602. "Njecyrillic",
  28603. 0x040a,
  28604. "Nlinebelow",
  28605. 0x1e48,
  28606. "Nmonospace",
  28607. 0xff2e,
  28608. "Nowarmenian",
  28609. 0x0546,
  28610. "Nsmall",
  28611. 0xf76e,
  28612. "Ntilde",
  28613. 0x00d1,
  28614. "Ntildesmall",
  28615. 0xf7f1,
  28616. "Nu",
  28617. 0x039d,
  28618. "O",
  28619. 0x004f,
  28620. "OE",
  28621. 0x0152,
  28622. "OEsmall",
  28623. 0xf6fa,
  28624. "Oacute",
  28625. 0x00d3,
  28626. "Oacutesmall",
  28627. 0xf7f3,
  28628. "Obarredcyrillic",
  28629. 0x04e8,
  28630. "Obarreddieresiscyrillic",
  28631. 0x04ea,
  28632. "Obreve",
  28633. 0x014e,
  28634. "Ocaron",
  28635. 0x01d1,
  28636. "Ocenteredtilde",
  28637. 0x019f,
  28638. "Ocircle",
  28639. 0x24c4,
  28640. "Ocircumflex",
  28641. 0x00d4,
  28642. "Ocircumflexacute",
  28643. 0x1ed0,
  28644. "Ocircumflexdotbelow",
  28645. 0x1ed8,
  28646. "Ocircumflexgrave",
  28647. 0x1ed2,
  28648. "Ocircumflexhookabove",
  28649. 0x1ed4,
  28650. "Ocircumflexsmall",
  28651. 0xf7f4,
  28652. "Ocircumflextilde",
  28653. 0x1ed6,
  28654. "Ocyrillic",
  28655. 0x041e,
  28656. "Odblacute",
  28657. 0x0150,
  28658. "Odblgrave",
  28659. 0x020c,
  28660. "Odieresis",
  28661. 0x00d6,
  28662. "Odieresiscyrillic",
  28663. 0x04e6,
  28664. "Odieresissmall",
  28665. 0xf7f6,
  28666. "Odotbelow",
  28667. 0x1ecc,
  28668. "Ogoneksmall",
  28669. 0xf6fb,
  28670. "Ograve",
  28671. 0x00d2,
  28672. "Ogravesmall",
  28673. 0xf7f2,
  28674. "Oharmenian",
  28675. 0x0555,
  28676. "Ohm",
  28677. 0x2126,
  28678. "Ohookabove",
  28679. 0x1ece,
  28680. "Ohorn",
  28681. 0x01a0,
  28682. "Ohornacute",
  28683. 0x1eda,
  28684. "Ohorndotbelow",
  28685. 0x1ee2,
  28686. "Ohorngrave",
  28687. 0x1edc,
  28688. "Ohornhookabove",
  28689. 0x1ede,
  28690. "Ohorntilde",
  28691. 0x1ee0,
  28692. "Ohungarumlaut",
  28693. 0x0150,
  28694. "Oi",
  28695. 0x01a2,
  28696. "Oinvertedbreve",
  28697. 0x020e,
  28698. "Omacron",
  28699. 0x014c,
  28700. "Omacronacute",
  28701. 0x1e52,
  28702. "Omacrongrave",
  28703. 0x1e50,
  28704. "Omega",
  28705. 0x2126,
  28706. "Omegacyrillic",
  28707. 0x0460,
  28708. "Omegagreek",
  28709. 0x03a9,
  28710. "Omegaroundcyrillic",
  28711. 0x047a,
  28712. "Omegatitlocyrillic",
  28713. 0x047c,
  28714. "Omegatonos",
  28715. 0x038f,
  28716. "Omicron",
  28717. 0x039f,
  28718. "Omicrontonos",
  28719. 0x038c,
  28720. "Omonospace",
  28721. 0xff2f,
  28722. "Oneroman",
  28723. 0x2160,
  28724. "Oogonek",
  28725. 0x01ea,
  28726. "Oogonekmacron",
  28727. 0x01ec,
  28728. "Oopen",
  28729. 0x0186,
  28730. "Oslash",
  28731. 0x00d8,
  28732. "Oslashacute",
  28733. 0x01fe,
  28734. "Oslashsmall",
  28735. 0xf7f8,
  28736. "Osmall",
  28737. 0xf76f,
  28738. "Ostrokeacute",
  28739. 0x01fe,
  28740. "Otcyrillic",
  28741. 0x047e,
  28742. "Otilde",
  28743. 0x00d5,
  28744. "Otildeacute",
  28745. 0x1e4c,
  28746. "Otildedieresis",
  28747. 0x1e4e,
  28748. "Otildesmall",
  28749. 0xf7f5,
  28750. "P",
  28751. 0x0050,
  28752. "Pacute",
  28753. 0x1e54,
  28754. "Pcircle",
  28755. 0x24c5,
  28756. "Pdotaccent",
  28757. 0x1e56,
  28758. "Pecyrillic",
  28759. 0x041f,
  28760. "Peharmenian",
  28761. 0x054a,
  28762. "Pemiddlehookcyrillic",
  28763. 0x04a6,
  28764. "Phi",
  28765. 0x03a6,
  28766. "Phook",
  28767. 0x01a4,
  28768. "Pi",
  28769. 0x03a0,
  28770. "Piwrarmenian",
  28771. 0x0553,
  28772. "Pmonospace",
  28773. 0xff30,
  28774. "Psi",
  28775. 0x03a8,
  28776. "Psicyrillic",
  28777. 0x0470,
  28778. "Psmall",
  28779. 0xf770,
  28780. "Q",
  28781. 0x0051,
  28782. "Qcircle",
  28783. 0x24c6,
  28784. "Qmonospace",
  28785. 0xff31,
  28786. "Qsmall",
  28787. 0xf771,
  28788. "R",
  28789. 0x0052,
  28790. "Raarmenian",
  28791. 0x054c,
  28792. "Racute",
  28793. 0x0154,
  28794. "Rcaron",
  28795. 0x0158,
  28796. "Rcedilla",
  28797. 0x0156,
  28798. "Rcircle",
  28799. 0x24c7,
  28800. "Rcommaaccent",
  28801. 0x0156,
  28802. "Rdblgrave",
  28803. 0x0210,
  28804. "Rdotaccent",
  28805. 0x1e58,
  28806. "Rdotbelow",
  28807. 0x1e5a,
  28808. "Rdotbelowmacron",
  28809. 0x1e5c,
  28810. "Reharmenian",
  28811. 0x0550,
  28812. "Rfraktur",
  28813. 0x211c,
  28814. "Rho",
  28815. 0x03a1,
  28816. "Ringsmall",
  28817. 0xf6fc,
  28818. "Rinvertedbreve",
  28819. 0x0212,
  28820. "Rlinebelow",
  28821. 0x1e5e,
  28822. "Rmonospace",
  28823. 0xff32,
  28824. "Rsmall",
  28825. 0xf772,
  28826. "Rsmallinverted",
  28827. 0x0281,
  28828. "Rsmallinvertedsuperior",
  28829. 0x02b6,
  28830. "S",
  28831. 0x0053,
  28832. "SF010000",
  28833. 0x250c,
  28834. "SF020000",
  28835. 0x2514,
  28836. "SF030000",
  28837. 0x2510,
  28838. "SF040000",
  28839. 0x2518,
  28840. "SF050000",
  28841. 0x253c,
  28842. "SF060000",
  28843. 0x252c,
  28844. "SF070000",
  28845. 0x2534,
  28846. "SF080000",
  28847. 0x251c,
  28848. "SF090000",
  28849. 0x2524,
  28850. "SF100000",
  28851. 0x2500,
  28852. "SF110000",
  28853. 0x2502,
  28854. "SF190000",
  28855. 0x2561,
  28856. "SF200000",
  28857. 0x2562,
  28858. "SF210000",
  28859. 0x2556,
  28860. "SF220000",
  28861. 0x2555,
  28862. "SF230000",
  28863. 0x2563,
  28864. "SF240000",
  28865. 0x2551,
  28866. "SF250000",
  28867. 0x2557,
  28868. "SF260000",
  28869. 0x255d,
  28870. "SF270000",
  28871. 0x255c,
  28872. "SF280000",
  28873. 0x255b,
  28874. "SF360000",
  28875. 0x255e,
  28876. "SF370000",
  28877. 0x255f,
  28878. "SF380000",
  28879. 0x255a,
  28880. "SF390000",
  28881. 0x2554,
  28882. "SF400000",
  28883. 0x2569,
  28884. "SF410000",
  28885. 0x2566,
  28886. "SF420000",
  28887. 0x2560,
  28888. "SF430000",
  28889. 0x2550,
  28890. "SF440000",
  28891. 0x256c,
  28892. "SF450000",
  28893. 0x2567,
  28894. "SF460000",
  28895. 0x2568,
  28896. "SF470000",
  28897. 0x2564,
  28898. "SF480000",
  28899. 0x2565,
  28900. "SF490000",
  28901. 0x2559,
  28902. "SF500000",
  28903. 0x2558,
  28904. "SF510000",
  28905. 0x2552,
  28906. "SF520000",
  28907. 0x2553,
  28908. "SF530000",
  28909. 0x256b,
  28910. "SF540000",
  28911. 0x256a,
  28912. "Sacute",
  28913. 0x015a,
  28914. "Sacutedotaccent",
  28915. 0x1e64,
  28916. "Sampigreek",
  28917. 0x03e0,
  28918. "Scaron",
  28919. 0x0160,
  28920. "Scarondotaccent",
  28921. 0x1e66,
  28922. "Scaronsmall",
  28923. 0xf6fd,
  28924. "Scedilla",
  28925. 0x015e,
  28926. "Schwa",
  28927. 0x018f,
  28928. "Schwacyrillic",
  28929. 0x04d8,
  28930. "Schwadieresiscyrillic",
  28931. 0x04da,
  28932. "Scircle",
  28933. 0x24c8,
  28934. "Scircumflex",
  28935. 0x015c,
  28936. "Scommaaccent",
  28937. 0x0218,
  28938. "Sdotaccent",
  28939. 0x1e60,
  28940. "Sdotbelow",
  28941. 0x1e62,
  28942. "Sdotbelowdotaccent",
  28943. 0x1e68,
  28944. "Seharmenian",
  28945. 0x054d,
  28946. "Sevenroman",
  28947. 0x2166,
  28948. "Shaarmenian",
  28949. 0x0547,
  28950. "Shacyrillic",
  28951. 0x0428,
  28952. "Shchacyrillic",
  28953. 0x0429,
  28954. "Sheicoptic",
  28955. 0x03e2,
  28956. "Shhacyrillic",
  28957. 0x04ba,
  28958. "Shimacoptic",
  28959. 0x03ec,
  28960. "Sigma",
  28961. 0x03a3,
  28962. "Sixroman",
  28963. 0x2165,
  28964. "Smonospace",
  28965. 0xff33,
  28966. "Softsigncyrillic",
  28967. 0x042c,
  28968. "Ssmall",
  28969. 0xf773,
  28970. "Stigmagreek",
  28971. 0x03da,
  28972. "T",
  28973. 0x0054,
  28974. "Tau",
  28975. 0x03a4,
  28976. "Tbar",
  28977. 0x0166,
  28978. "Tcaron",
  28979. 0x0164,
  28980. "Tcedilla",
  28981. 0x0162,
  28982. "Tcircle",
  28983. 0x24c9,
  28984. "Tcircumflexbelow",
  28985. 0x1e70,
  28986. "Tcommaaccent",
  28987. 0x0162,
  28988. "Tdotaccent",
  28989. 0x1e6a,
  28990. "Tdotbelow",
  28991. 0x1e6c,
  28992. "Tecyrillic",
  28993. 0x0422,
  28994. "Tedescendercyrillic",
  28995. 0x04ac,
  28996. "Tenroman",
  28997. 0x2169,
  28998. "Tetsecyrillic",
  28999. 0x04b4,
  29000. "Theta",
  29001. 0x0398,
  29002. "Thook",
  29003. 0x01ac,
  29004. "Thorn",
  29005. 0x00de,
  29006. "Thornsmall",
  29007. 0xf7fe,
  29008. "Threeroman",
  29009. 0x2162,
  29010. "Tildesmall",
  29011. 0xf6fe,
  29012. "Tiwnarmenian",
  29013. 0x054f,
  29014. "Tlinebelow",
  29015. 0x1e6e,
  29016. "Tmonospace",
  29017. 0xff34,
  29018. "Toarmenian",
  29019. 0x0539,
  29020. "Tonefive",
  29021. 0x01bc,
  29022. "Tonesix",
  29023. 0x0184,
  29024. "Tonetwo",
  29025. 0x01a7,
  29026. "Tretroflexhook",
  29027. 0x01ae,
  29028. "Tsecyrillic",
  29029. 0x0426,
  29030. "Tshecyrillic",
  29031. 0x040b,
  29032. "Tsmall",
  29033. 0xf774,
  29034. "Twelveroman",
  29035. 0x216b,
  29036. "Tworoman",
  29037. 0x2161,
  29038. "U",
  29039. 0x0055,
  29040. "Uacute",
  29041. 0x00da,
  29042. "Uacutesmall",
  29043. 0xf7fa,
  29044. "Ubreve",
  29045. 0x016c,
  29046. "Ucaron",
  29047. 0x01d3,
  29048. "Ucircle",
  29049. 0x24ca,
  29050. "Ucircumflex",
  29051. 0x00db,
  29052. "Ucircumflexbelow",
  29053. 0x1e76,
  29054. "Ucircumflexsmall",
  29055. 0xf7fb,
  29056. "Ucyrillic",
  29057. 0x0423,
  29058. "Udblacute",
  29059. 0x0170,
  29060. "Udblgrave",
  29061. 0x0214,
  29062. "Udieresis",
  29063. 0x00dc,
  29064. "Udieresisacute",
  29065. 0x01d7,
  29066. "Udieresisbelow",
  29067. 0x1e72,
  29068. "Udieresiscaron",
  29069. 0x01d9,
  29070. "Udieresiscyrillic",
  29071. 0x04f0,
  29072. "Udieresisgrave",
  29073. 0x01db,
  29074. "Udieresismacron",
  29075. 0x01d5,
  29076. "Udieresissmall",
  29077. 0xf7fc,
  29078. "Udotbelow",
  29079. 0x1ee4,
  29080. "Ugrave",
  29081. 0x00d9,
  29082. "Ugravesmall",
  29083. 0xf7f9,
  29084. "Uhookabove",
  29085. 0x1ee6,
  29086. "Uhorn",
  29087. 0x01af,
  29088. "Uhornacute",
  29089. 0x1ee8,
  29090. "Uhorndotbelow",
  29091. 0x1ef0,
  29092. "Uhorngrave",
  29093. 0x1eea,
  29094. "Uhornhookabove",
  29095. 0x1eec,
  29096. "Uhorntilde",
  29097. 0x1eee,
  29098. "Uhungarumlaut",
  29099. 0x0170,
  29100. "Uhungarumlautcyrillic",
  29101. 0x04f2,
  29102. "Uinvertedbreve",
  29103. 0x0216,
  29104. "Ukcyrillic",
  29105. 0x0478,
  29106. "Umacron",
  29107. 0x016a,
  29108. "Umacroncyrillic",
  29109. 0x04ee,
  29110. "Umacrondieresis",
  29111. 0x1e7a,
  29112. "Umonospace",
  29113. 0xff35,
  29114. "Uogonek",
  29115. 0x0172,
  29116. "Upsilon",
  29117. 0x03a5,
  29118. "Upsilon1",
  29119. 0x03d2,
  29120. "Upsilonacutehooksymbolgreek",
  29121. 0x03d3,
  29122. "Upsilonafrican",
  29123. 0x01b1,
  29124. "Upsilondieresis",
  29125. 0x03ab,
  29126. "Upsilondieresishooksymbolgreek",
  29127. 0x03d4,
  29128. "Upsilonhooksymbol",
  29129. 0x03d2,
  29130. "Upsilontonos",
  29131. 0x038e,
  29132. "Uring",
  29133. 0x016e,
  29134. "Ushortcyrillic",
  29135. 0x040e,
  29136. "Usmall",
  29137. 0xf775,
  29138. "Ustraightcyrillic",
  29139. 0x04ae,
  29140. "Ustraightstrokecyrillic",
  29141. 0x04b0,
  29142. "Utilde",
  29143. 0x0168,
  29144. "Utildeacute",
  29145. 0x1e78,
  29146. "Utildebelow",
  29147. 0x1e74,
  29148. "V",
  29149. 0x0056,
  29150. "Vcircle",
  29151. 0x24cb,
  29152. "Vdotbelow",
  29153. 0x1e7e,
  29154. "Vecyrillic",
  29155. 0x0412,
  29156. "Vewarmenian",
  29157. 0x054e,
  29158. "Vhook",
  29159. 0x01b2,
  29160. "Vmonospace",
  29161. 0xff36,
  29162. "Voarmenian",
  29163. 0x0548,
  29164. "Vsmall",
  29165. 0xf776,
  29166. "Vtilde",
  29167. 0x1e7c,
  29168. "W",
  29169. 0x0057,
  29170. "Wacute",
  29171. 0x1e82,
  29172. "Wcircle",
  29173. 0x24cc,
  29174. "Wcircumflex",
  29175. 0x0174,
  29176. "Wdieresis",
  29177. 0x1e84,
  29178. "Wdotaccent",
  29179. 0x1e86,
  29180. "Wdotbelow",
  29181. 0x1e88,
  29182. "Wgrave",
  29183. 0x1e80,
  29184. "Wmonospace",
  29185. 0xff37,
  29186. "Wsmall",
  29187. 0xf777,
  29188. "X",
  29189. 0x0058,
  29190. "Xcircle",
  29191. 0x24cd,
  29192. "Xdieresis",
  29193. 0x1e8c,
  29194. "Xdotaccent",
  29195. 0x1e8a,
  29196. "Xeharmenian",
  29197. 0x053d,
  29198. "Xi",
  29199. 0x039e,
  29200. "Xmonospace",
  29201. 0xff38,
  29202. "Xsmall",
  29203. 0xf778,
  29204. "Y",
  29205. 0x0059,
  29206. "Yacute",
  29207. 0x00dd,
  29208. "Yacutesmall",
  29209. 0xf7fd,
  29210. "Yatcyrillic",
  29211. 0x0462,
  29212. "Ycircle",
  29213. 0x24ce,
  29214. "Ycircumflex",
  29215. 0x0176,
  29216. "Ydieresis",
  29217. 0x0178,
  29218. "Ydieresissmall",
  29219. 0xf7ff,
  29220. "Ydotaccent",
  29221. 0x1e8e,
  29222. "Ydotbelow",
  29223. 0x1ef4,
  29224. "Yericyrillic",
  29225. 0x042b,
  29226. "Yerudieresiscyrillic",
  29227. 0x04f8,
  29228. "Ygrave",
  29229. 0x1ef2,
  29230. "Yhook",
  29231. 0x01b3,
  29232. "Yhookabove",
  29233. 0x1ef6,
  29234. "Yiarmenian",
  29235. 0x0545,
  29236. "Yicyrillic",
  29237. 0x0407,
  29238. "Yiwnarmenian",
  29239. 0x0552,
  29240. "Ymonospace",
  29241. 0xff39,
  29242. "Ysmall",
  29243. 0xf779,
  29244. "Ytilde",
  29245. 0x1ef8,
  29246. "Yusbigcyrillic",
  29247. 0x046a,
  29248. "Yusbigiotifiedcyrillic",
  29249. 0x046c,
  29250. "Yuslittlecyrillic",
  29251. 0x0466,
  29252. "Yuslittleiotifiedcyrillic",
  29253. 0x0468,
  29254. "Z",
  29255. 0x005a,
  29256. "Zaarmenian",
  29257. 0x0536,
  29258. "Zacute",
  29259. 0x0179,
  29260. "Zcaron",
  29261. 0x017d,
  29262. "Zcaronsmall",
  29263. 0xf6ff,
  29264. "Zcircle",
  29265. 0x24cf,
  29266. "Zcircumflex",
  29267. 0x1e90,
  29268. "Zdot",
  29269. 0x017b,
  29270. "Zdotaccent",
  29271. 0x017b,
  29272. "Zdotbelow",
  29273. 0x1e92,
  29274. "Zecyrillic",
  29275. 0x0417,
  29276. "Zedescendercyrillic",
  29277. 0x0498,
  29278. "Zedieresiscyrillic",
  29279. 0x04de,
  29280. "Zeta",
  29281. 0x0396,
  29282. "Zhearmenian",
  29283. 0x053a,
  29284. "Zhebrevecyrillic",
  29285. 0x04c1,
  29286. "Zhecyrillic",
  29287. 0x0416,
  29288. "Zhedescendercyrillic",
  29289. 0x0496,
  29290. "Zhedieresiscyrillic",
  29291. 0x04dc,
  29292. "Zlinebelow",
  29293. 0x1e94,
  29294. "Zmonospace",
  29295. 0xff3a,
  29296. "Zsmall",
  29297. 0xf77a,
  29298. "Zstroke",
  29299. 0x01b5,
  29300. "a",
  29301. 0x0061,
  29302. "aabengali",
  29303. 0x0986,
  29304. "aacute",
  29305. 0x00e1,
  29306. "aadeva",
  29307. 0x0906,
  29308. "aagujarati",
  29309. 0x0a86,
  29310. "aagurmukhi",
  29311. 0x0a06,
  29312. "aamatragurmukhi",
  29313. 0x0a3e,
  29314. "aarusquare",
  29315. 0x3303,
  29316. "aavowelsignbengali",
  29317. 0x09be,
  29318. "aavowelsigndeva",
  29319. 0x093e,
  29320. "aavowelsigngujarati",
  29321. 0x0abe,
  29322. "abbreviationmarkarmenian",
  29323. 0x055f,
  29324. "abbreviationsigndeva",
  29325. 0x0970,
  29326. "abengali",
  29327. 0x0985,
  29328. "abopomofo",
  29329. 0x311a,
  29330. "abreve",
  29331. 0x0103,
  29332. "abreveacute",
  29333. 0x1eaf,
  29334. "abrevecyrillic",
  29335. 0x04d1,
  29336. "abrevedotbelow",
  29337. 0x1eb7,
  29338. "abrevegrave",
  29339. 0x1eb1,
  29340. "abrevehookabove",
  29341. 0x1eb3,
  29342. "abrevetilde",
  29343. 0x1eb5,
  29344. "acaron",
  29345. 0x01ce,
  29346. "acircle",
  29347. 0x24d0,
  29348. "acircumflex",
  29349. 0x00e2,
  29350. "acircumflexacute",
  29351. 0x1ea5,
  29352. "acircumflexdotbelow",
  29353. 0x1ead,
  29354. "acircumflexgrave",
  29355. 0x1ea7,
  29356. "acircumflexhookabove",
  29357. 0x1ea9,
  29358. "acircumflextilde",
  29359. 0x1eab,
  29360. "acute",
  29361. 0x00b4,
  29362. "acutebelowcmb",
  29363. 0x0317,
  29364. "acutecmb",
  29365. 0x0301,
  29366. "acutecomb",
  29367. 0x0301,
  29368. "acutedeva",
  29369. 0x0954,
  29370. "acutelowmod",
  29371. 0x02cf,
  29372. "acutetonecmb",
  29373. 0x0341,
  29374. "acyrillic",
  29375. 0x0430,
  29376. "adblgrave",
  29377. 0x0201,
  29378. "addakgurmukhi",
  29379. 0x0a71,
  29380. "adeva",
  29381. 0x0905,
  29382. "adieresis",
  29383. 0x00e4,
  29384. "adieresiscyrillic",
  29385. 0x04d3,
  29386. "adieresismacron",
  29387. 0x01df,
  29388. "adotbelow",
  29389. 0x1ea1,
  29390. "adotmacron",
  29391. 0x01e1,
  29392. "ae",
  29393. 0x00e6,
  29394. "aeacute",
  29395. 0x01fd,
  29396. "aekorean",
  29397. 0x3150,
  29398. "aemacron",
  29399. 0x01e3,
  29400. "afii00208",
  29401. 0x2015,
  29402. "afii08941",
  29403. 0x20a4,
  29404. "afii10017",
  29405. 0x0410,
  29406. "afii10018",
  29407. 0x0411,
  29408. "afii10019",
  29409. 0x0412,
  29410. "afii10020",
  29411. 0x0413,
  29412. "afii10021",
  29413. 0x0414,
  29414. "afii10022",
  29415. 0x0415,
  29416. "afii10023",
  29417. 0x0401,
  29418. "afii10024",
  29419. 0x0416,
  29420. "afii10025",
  29421. 0x0417,
  29422. "afii10026",
  29423. 0x0418,
  29424. "afii10027",
  29425. 0x0419,
  29426. "afii10028",
  29427. 0x041a,
  29428. "afii10029",
  29429. 0x041b,
  29430. "afii10030",
  29431. 0x041c,
  29432. "afii10031",
  29433. 0x041d,
  29434. "afii10032",
  29435. 0x041e,
  29436. "afii10033",
  29437. 0x041f,
  29438. "afii10034",
  29439. 0x0420,
  29440. "afii10035",
  29441. 0x0421,
  29442. "afii10036",
  29443. 0x0422,
  29444. "afii10037",
  29445. 0x0423,
  29446. "afii10038",
  29447. 0x0424,
  29448. "afii10039",
  29449. 0x0425,
  29450. "afii10040",
  29451. 0x0426,
  29452. "afii10041",
  29453. 0x0427,
  29454. "afii10042",
  29455. 0x0428,
  29456. "afii10043",
  29457. 0x0429,
  29458. "afii10044",
  29459. 0x042a,
  29460. "afii10045",
  29461. 0x042b,
  29462. "afii10046",
  29463. 0x042c,
  29464. "afii10047",
  29465. 0x042d,
  29466. "afii10048",
  29467. 0x042e,
  29468. "afii10049",
  29469. 0x042f,
  29470. "afii10050",
  29471. 0x0490,
  29472. "afii10051",
  29473. 0x0402,
  29474. "afii10052",
  29475. 0x0403,
  29476. "afii10053",
  29477. 0x0404,
  29478. "afii10054",
  29479. 0x0405,
  29480. "afii10055",
  29481. 0x0406,
  29482. "afii10056",
  29483. 0x0407,
  29484. "afii10057",
  29485. 0x0408,
  29486. "afii10058",
  29487. 0x0409,
  29488. "afii10059",
  29489. 0x040a,
  29490. "afii10060",
  29491. 0x040b,
  29492. "afii10061",
  29493. 0x040c,
  29494. "afii10062",
  29495. 0x040e,
  29496. "afii10063",
  29497. 0xf6c4,
  29498. "afii10064",
  29499. 0xf6c5,
  29500. "afii10065",
  29501. 0x0430,
  29502. "afii10066",
  29503. 0x0431,
  29504. "afii10067",
  29505. 0x0432,
  29506. "afii10068",
  29507. 0x0433,
  29508. "afii10069",
  29509. 0x0434,
  29510. "afii10070",
  29511. 0x0435,
  29512. "afii10071",
  29513. 0x0451,
  29514. "afii10072",
  29515. 0x0436,
  29516. "afii10073",
  29517. 0x0437,
  29518. "afii10074",
  29519. 0x0438,
  29520. "afii10075",
  29521. 0x0439,
  29522. "afii10076",
  29523. 0x043a,
  29524. "afii10077",
  29525. 0x043b,
  29526. "afii10078",
  29527. 0x043c,
  29528. "afii10079",
  29529. 0x043d,
  29530. "afii10080",
  29531. 0x043e,
  29532. "afii10081",
  29533. 0x043f,
  29534. "afii10082",
  29535. 0x0440,
  29536. "afii10083",
  29537. 0x0441,
  29538. "afii10084",
  29539. 0x0442,
  29540. "afii10085",
  29541. 0x0443,
  29542. "afii10086",
  29543. 0x0444,
  29544. "afii10087",
  29545. 0x0445,
  29546. "afii10088",
  29547. 0x0446,
  29548. "afii10089",
  29549. 0x0447,
  29550. "afii10090",
  29551. 0x0448,
  29552. "afii10091",
  29553. 0x0449,
  29554. "afii10092",
  29555. 0x044a,
  29556. "afii10093",
  29557. 0x044b,
  29558. "afii10094",
  29559. 0x044c,
  29560. "afii10095",
  29561. 0x044d,
  29562. "afii10096",
  29563. 0x044e,
  29564. "afii10097",
  29565. 0x044f,
  29566. "afii10098",
  29567. 0x0491,
  29568. "afii10099",
  29569. 0x0452,
  29570. "afii10100",
  29571. 0x0453,
  29572. "afii10101",
  29573. 0x0454,
  29574. "afii10102",
  29575. 0x0455,
  29576. "afii10103",
  29577. 0x0456,
  29578. "afii10104",
  29579. 0x0457,
  29580. "afii10105",
  29581. 0x0458,
  29582. "afii10106",
  29583. 0x0459,
  29584. "afii10107",
  29585. 0x045a,
  29586. "afii10108",
  29587. 0x045b,
  29588. "afii10109",
  29589. 0x045c,
  29590. "afii10110",
  29591. 0x045e,
  29592. "afii10145",
  29593. 0x040f,
  29594. "afii10146",
  29595. 0x0462,
  29596. "afii10147",
  29597. 0x0472,
  29598. "afii10148",
  29599. 0x0474,
  29600. "afii10192",
  29601. 0xf6c6,
  29602. "afii10193",
  29603. 0x045f,
  29604. "afii10194",
  29605. 0x0463,
  29606. "afii10195",
  29607. 0x0473,
  29608. "afii10196",
  29609. 0x0475,
  29610. "afii10831",
  29611. 0xf6c7,
  29612. "afii10832",
  29613. 0xf6c8,
  29614. "afii10846",
  29615. 0x04d9,
  29616. "afii299",
  29617. 0x200e,
  29618. "afii300",
  29619. 0x200f,
  29620. "afii301",
  29621. 0x200d,
  29622. "afii57381",
  29623. 0x066a,
  29624. "afii57388",
  29625. 0x060c,
  29626. "afii57392",
  29627. 0x0660,
  29628. "afii57393",
  29629. 0x0661,
  29630. "afii57394",
  29631. 0x0662,
  29632. "afii57395",
  29633. 0x0663,
  29634. "afii57396",
  29635. 0x0664,
  29636. "afii57397",
  29637. 0x0665,
  29638. "afii57398",
  29639. 0x0666,
  29640. "afii57399",
  29641. 0x0667,
  29642. "afii57400",
  29643. 0x0668,
  29644. "afii57401",
  29645. 0x0669,
  29646. "afii57403",
  29647. 0x061b,
  29648. "afii57407",
  29649. 0x061f,
  29650. "afii57409",
  29651. 0x0621,
  29652. "afii57410",
  29653. 0x0622,
  29654. "afii57411",
  29655. 0x0623,
  29656. "afii57412",
  29657. 0x0624,
  29658. "afii57413",
  29659. 0x0625,
  29660. "afii57414",
  29661. 0x0626,
  29662. "afii57415",
  29663. 0x0627,
  29664. "afii57416",
  29665. 0x0628,
  29666. "afii57417",
  29667. 0x0629,
  29668. "afii57418",
  29669. 0x062a,
  29670. "afii57419",
  29671. 0x062b,
  29672. "afii57420",
  29673. 0x062c,
  29674. "afii57421",
  29675. 0x062d,
  29676. "afii57422",
  29677. 0x062e,
  29678. "afii57423",
  29679. 0x062f,
  29680. "afii57424",
  29681. 0x0630,
  29682. "afii57425",
  29683. 0x0631,
  29684. "afii57426",
  29685. 0x0632,
  29686. "afii57427",
  29687. 0x0633,
  29688. "afii57428",
  29689. 0x0634,
  29690. "afii57429",
  29691. 0x0635,
  29692. "afii57430",
  29693. 0x0636,
  29694. "afii57431",
  29695. 0x0637,
  29696. "afii57432",
  29697. 0x0638,
  29698. "afii57433",
  29699. 0x0639,
  29700. "afii57434",
  29701. 0x063a,
  29702. "afii57440",
  29703. 0x0640,
  29704. "afii57441",
  29705. 0x0641,
  29706. "afii57442",
  29707. 0x0642,
  29708. "afii57443",
  29709. 0x0643,
  29710. "afii57444",
  29711. 0x0644,
  29712. "afii57445",
  29713. 0x0645,
  29714. "afii57446",
  29715. 0x0646,
  29716. "afii57448",
  29717. 0x0648,
  29718. "afii57449",
  29719. 0x0649,
  29720. "afii57450",
  29721. 0x064a,
  29722. "afii57451",
  29723. 0x064b,
  29724. "afii57452",
  29725. 0x064c,
  29726. "afii57453",
  29727. 0x064d,
  29728. "afii57454",
  29729. 0x064e,
  29730. "afii57455",
  29731. 0x064f,
  29732. "afii57456",
  29733. 0x0650,
  29734. "afii57457",
  29735. 0x0651,
  29736. "afii57458",
  29737. 0x0652,
  29738. "afii57470",
  29739. 0x0647,
  29740. "afii57505",
  29741. 0x06a4,
  29742. "afii57506",
  29743. 0x067e,
  29744. "afii57507",
  29745. 0x0686,
  29746. "afii57508",
  29747. 0x0698,
  29748. "afii57509",
  29749. 0x06af,
  29750. "afii57511",
  29751. 0x0679,
  29752. "afii57512",
  29753. 0x0688,
  29754. "afii57513",
  29755. 0x0691,
  29756. "afii57514",
  29757. 0x06ba,
  29758. "afii57519",
  29759. 0x06d2,
  29760. "afii57534",
  29761. 0x06d5,
  29762. "afii57636",
  29763. 0x20aa,
  29764. "afii57645",
  29765. 0x05be,
  29766. "afii57658",
  29767. 0x05c3,
  29768. "afii57664",
  29769. 0x05d0,
  29770. "afii57665",
  29771. 0x05d1,
  29772. "afii57666",
  29773. 0x05d2,
  29774. "afii57667",
  29775. 0x05d3,
  29776. "afii57668",
  29777. 0x05d4,
  29778. "afii57669",
  29779. 0x05d5,
  29780. "afii57670",
  29781. 0x05d6,
  29782. "afii57671",
  29783. 0x05d7,
  29784. "afii57672",
  29785. 0x05d8,
  29786. "afii57673",
  29787. 0x05d9,
  29788. "afii57674",
  29789. 0x05da,
  29790. "afii57675",
  29791. 0x05db,
  29792. "afii57676",
  29793. 0x05dc,
  29794. "afii57677",
  29795. 0x05dd,
  29796. "afii57678",
  29797. 0x05de,
  29798. "afii57679",
  29799. 0x05df,
  29800. "afii57680",
  29801. 0x05e0,
  29802. "afii57681",
  29803. 0x05e1,
  29804. "afii57682",
  29805. 0x05e2,
  29806. "afii57683",
  29807. 0x05e3,
  29808. "afii57684",
  29809. 0x05e4,
  29810. "afii57685",
  29811. 0x05e5,
  29812. "afii57686",
  29813. 0x05e6,
  29814. "afii57687",
  29815. 0x05e7,
  29816. "afii57688",
  29817. 0x05e8,
  29818. "afii57689",
  29819. 0x05e9,
  29820. "afii57690",
  29821. 0x05ea,
  29822. "afii57694",
  29823. 0xfb2a,
  29824. "afii57695",
  29825. 0xfb2b,
  29826. "afii57700",
  29827. 0xfb4b,
  29828. "afii57705",
  29829. 0xfb1f,
  29830. "afii57716",
  29831. 0x05f0,
  29832. "afii57717",
  29833. 0x05f1,
  29834. "afii57718",
  29835. 0x05f2,
  29836. "afii57723",
  29837. 0xfb35,
  29838. "afii57793",
  29839. 0x05b4,
  29840. "afii57794",
  29841. 0x05b5,
  29842. "afii57795",
  29843. 0x05b6,
  29844. "afii57796",
  29845. 0x05bb,
  29846. "afii57797",
  29847. 0x05b8,
  29848. "afii57798",
  29849. 0x05b7,
  29850. "afii57799",
  29851. 0x05b0,
  29852. "afii57800",
  29853. 0x05b2,
  29854. "afii57801",
  29855. 0x05b1,
  29856. "afii57802",
  29857. 0x05b3,
  29858. "afii57803",
  29859. 0x05c2,
  29860. "afii57804",
  29861. 0x05c1,
  29862. "afii57806",
  29863. 0x05b9,
  29864. "afii57807",
  29865. 0x05bc,
  29866. "afii57839",
  29867. 0x05bd,
  29868. "afii57841",
  29869. 0x05bf,
  29870. "afii57842",
  29871. 0x05c0,
  29872. "afii57929",
  29873. 0x02bc,
  29874. "afii61248",
  29875. 0x2105,
  29876. "afii61289",
  29877. 0x2113,
  29878. "afii61352",
  29879. 0x2116,
  29880. "afii61573",
  29881. 0x202c,
  29882. "afii61574",
  29883. 0x202d,
  29884. "afii61575",
  29885. 0x202e,
  29886. "afii61664",
  29887. 0x200c,
  29888. "afii63167",
  29889. 0x066d,
  29890. "afii64937",
  29891. 0x02bd,
  29892. "agrave",
  29893. 0x00e0,
  29894. "agujarati",
  29895. 0x0a85,
  29896. "agurmukhi",
  29897. 0x0a05,
  29898. "ahiragana",
  29899. 0x3042,
  29900. "ahookabove",
  29901. 0x1ea3,
  29902. "aibengali",
  29903. 0x0990,
  29904. "aibopomofo",
  29905. 0x311e,
  29906. "aideva",
  29907. 0x0910,
  29908. "aiecyrillic",
  29909. 0x04d5,
  29910. "aigujarati",
  29911. 0x0a90,
  29912. "aigurmukhi",
  29913. 0x0a10,
  29914. "aimatragurmukhi",
  29915. 0x0a48,
  29916. "ainarabic",
  29917. 0x0639,
  29918. "ainfinalarabic",
  29919. 0xfeca,
  29920. "aininitialarabic",
  29921. 0xfecb,
  29922. "ainmedialarabic",
  29923. 0xfecc,
  29924. "ainvertedbreve",
  29925. 0x0203,
  29926. "aivowelsignbengali",
  29927. 0x09c8,
  29928. "aivowelsigndeva",
  29929. 0x0948,
  29930. "aivowelsigngujarati",
  29931. 0x0ac8,
  29932. "akatakana",
  29933. 0x30a2,
  29934. "akatakanahalfwidth",
  29935. 0xff71,
  29936. "akorean",
  29937. 0x314f,
  29938. "alef",
  29939. 0x05d0,
  29940. "alefarabic",
  29941. 0x0627,
  29942. "alefdageshhebrew",
  29943. 0xfb30,
  29944. "aleffinalarabic",
  29945. 0xfe8e,
  29946. "alefhamzaabovearabic",
  29947. 0x0623,
  29948. "alefhamzaabovefinalarabic",
  29949. 0xfe84,
  29950. "alefhamzabelowarabic",
  29951. 0x0625,
  29952. "alefhamzabelowfinalarabic",
  29953. 0xfe88,
  29954. "alefhebrew",
  29955. 0x05d0,
  29956. "aleflamedhebrew",
  29957. 0xfb4f,
  29958. "alefmaddaabovearabic",
  29959. 0x0622,
  29960. "alefmaddaabovefinalarabic",
  29961. 0xfe82,
  29962. "alefmaksuraarabic",
  29963. 0x0649,
  29964. "alefmaksurafinalarabic",
  29965. 0xfef0,
  29966. "alefmaksurainitialarabic",
  29967. 0xfef3,
  29968. "alefmaksuramedialarabic",
  29969. 0xfef4,
  29970. "alefpatahhebrew",
  29971. 0xfb2e,
  29972. "alefqamatshebrew",
  29973. 0xfb2f,
  29974. "aleph",
  29975. 0x2135,
  29976. "allequal",
  29977. 0x224c,
  29978. "alpha",
  29979. 0x03b1,
  29980. "alphatonos",
  29981. 0x03ac,
  29982. "amacron",
  29983. 0x0101,
  29984. "amonospace",
  29985. 0xff41,
  29986. "ampersand",
  29987. 0x0026,
  29988. "ampersandmonospace",
  29989. 0xff06,
  29990. "ampersandsmall",
  29991. 0xf726,
  29992. "amsquare",
  29993. 0x33c2,
  29994. "anbopomofo",
  29995. 0x3122,
  29996. "angbopomofo",
  29997. 0x3124,
  29998. "angbracketleft",
  29999. 0x3008,
  30000. "angbracketright",
  30001. 0x3009,
  30002. "angkhankhuthai",
  30003. 0x0e5a,
  30004. "angle",
  30005. 0x2220,
  30006. "anglebracketleft",
  30007. 0x3008,
  30008. "anglebracketleftvertical",
  30009. 0xfe3f,
  30010. "anglebracketright",
  30011. 0x3009,
  30012. "anglebracketrightvertical",
  30013. 0xfe40,
  30014. "angleleft",
  30015. 0x2329,
  30016. "angleright",
  30017. 0x232a,
  30018. "angstrom",
  30019. 0x212b,
  30020. "anoteleia",
  30021. 0x0387,
  30022. "anudattadeva",
  30023. 0x0952,
  30024. "anusvarabengali",
  30025. 0x0982,
  30026. "anusvaradeva",
  30027. 0x0902,
  30028. "anusvaragujarati",
  30029. 0x0a82,
  30030. "aogonek",
  30031. 0x0105,
  30032. "apaatosquare",
  30033. 0x3300,
  30034. "aparen",
  30035. 0x249c,
  30036. "apostrophearmenian",
  30037. 0x055a,
  30038. "apostrophemod",
  30039. 0x02bc,
  30040. "apple",
  30041. 0xf8ff,
  30042. "approaches",
  30043. 0x2250,
  30044. "approxequal",
  30045. 0x2248,
  30046. "approxequalorimage",
  30047. 0x2252,
  30048. "approximatelyequal",
  30049. 0x2245,
  30050. "araeaekorean",
  30051. 0x318e,
  30052. "araeakorean",
  30053. 0x318d,
  30054. "arc",
  30055. 0x2312,
  30056. "arighthalfring",
  30057. 0x1e9a,
  30058. "aring",
  30059. 0x00e5,
  30060. "aringacute",
  30061. 0x01fb,
  30062. "aringbelow",
  30063. 0x1e01,
  30064. "arrowboth",
  30065. 0x2194,
  30066. "arrowdashdown",
  30067. 0x21e3,
  30068. "arrowdashleft",
  30069. 0x21e0,
  30070. "arrowdashright",
  30071. 0x21e2,
  30072. "arrowdashup",
  30073. 0x21e1,
  30074. "arrowdblboth",
  30075. 0x21d4,
  30076. "arrowdbldown",
  30077. 0x21d3,
  30078. "arrowdblleft",
  30079. 0x21d0,
  30080. "arrowdblright",
  30081. 0x21d2,
  30082. "arrowdblup",
  30083. 0x21d1,
  30084. "arrowdown",
  30085. 0x2193,
  30086. "arrowdownleft",
  30087. 0x2199,
  30088. "arrowdownright",
  30089. 0x2198,
  30090. "arrowdownwhite",
  30091. 0x21e9,
  30092. "arrowheaddownmod",
  30093. 0x02c5,
  30094. "arrowheadleftmod",
  30095. 0x02c2,
  30096. "arrowheadrightmod",
  30097. 0x02c3,
  30098. "arrowheadupmod",
  30099. 0x02c4,
  30100. "arrowhorizex",
  30101. 0xf8e7,
  30102. "arrowleft",
  30103. 0x2190,
  30104. "arrowleftdbl",
  30105. 0x21d0,
  30106. "arrowleftdblstroke",
  30107. 0x21cd,
  30108. "arrowleftoverright",
  30109. 0x21c6,
  30110. "arrowleftwhite",
  30111. 0x21e6,
  30112. "arrowright",
  30113. 0x2192,
  30114. "arrowrightdblstroke",
  30115. 0x21cf,
  30116. "arrowrightheavy",
  30117. 0x279e,
  30118. "arrowrightoverleft",
  30119. 0x21c4,
  30120. "arrowrightwhite",
  30121. 0x21e8,
  30122. "arrowtableft",
  30123. 0x21e4,
  30124. "arrowtabright",
  30125. 0x21e5,
  30126. "arrowup",
  30127. 0x2191,
  30128. "arrowupdn",
  30129. 0x2195,
  30130. "arrowupdnbse",
  30131. 0x21a8,
  30132. "arrowupdownbase",
  30133. 0x21a8,
  30134. "arrowupleft",
  30135. 0x2196,
  30136. "arrowupleftofdown",
  30137. 0x21c5,
  30138. "arrowupright",
  30139. 0x2197,
  30140. "arrowupwhite",
  30141. 0x21e7,
  30142. "arrowvertex",
  30143. 0xf8e6,
  30144. "asciicircum",
  30145. 0x005e,
  30146. "asciicircummonospace",
  30147. 0xff3e,
  30148. "asciitilde",
  30149. 0x007e,
  30150. "asciitildemonospace",
  30151. 0xff5e,
  30152. "ascript",
  30153. 0x0251,
  30154. "ascriptturned",
  30155. 0x0252,
  30156. "asmallhiragana",
  30157. 0x3041,
  30158. "asmallkatakana",
  30159. 0x30a1,
  30160. "asmallkatakanahalfwidth",
  30161. 0xff67,
  30162. "asterisk",
  30163. 0x002a,
  30164. "asteriskaltonearabic",
  30165. 0x066d,
  30166. "asteriskarabic",
  30167. 0x066d,
  30168. "asteriskmath",
  30169. 0x2217,
  30170. "asteriskmonospace",
  30171. 0xff0a,
  30172. "asterisksmall",
  30173. 0xfe61,
  30174. "asterism",
  30175. 0x2042,
  30176. "asuperior",
  30177. 0xf6e9,
  30178. "asymptoticallyequal",
  30179. 0x2243,
  30180. "at",
  30181. 0x0040,
  30182. "atilde",
  30183. 0x00e3,
  30184. "atmonospace",
  30185. 0xff20,
  30186. "atsmall",
  30187. 0xfe6b,
  30188. "aturned",
  30189. 0x0250,
  30190. "aubengali",
  30191. 0x0994,
  30192. "aubopomofo",
  30193. 0x3120,
  30194. "audeva",
  30195. 0x0914,
  30196. "augujarati",
  30197. 0x0a94,
  30198. "augurmukhi",
  30199. 0x0a14,
  30200. "aulengthmarkbengali",
  30201. 0x09d7,
  30202. "aumatragurmukhi",
  30203. 0x0a4c,
  30204. "auvowelsignbengali",
  30205. 0x09cc,
  30206. "auvowelsigndeva",
  30207. 0x094c,
  30208. "auvowelsigngujarati",
  30209. 0x0acc,
  30210. "avagrahadeva",
  30211. 0x093d,
  30212. "aybarmenian",
  30213. 0x0561,
  30214. "ayin",
  30215. 0x05e2,
  30216. "ayinaltonehebrew",
  30217. 0xfb20,
  30218. "ayinhebrew",
  30219. 0x05e2,
  30220. "b",
  30221. 0x0062,
  30222. "babengali",
  30223. 0x09ac,
  30224. "backslash",
  30225. 0x005c,
  30226. "backslashmonospace",
  30227. 0xff3c,
  30228. "badeva",
  30229. 0x092c,
  30230. "bagujarati",
  30231. 0x0aac,
  30232. "bagurmukhi",
  30233. 0x0a2c,
  30234. "bahiragana",
  30235. 0x3070,
  30236. "bahtthai",
  30237. 0x0e3f,
  30238. "bakatakana",
  30239. 0x30d0,
  30240. "bar",
  30241. 0x007c,
  30242. "barmonospace",
  30243. 0xff5c,
  30244. "bbopomofo",
  30245. 0x3105,
  30246. "bcircle",
  30247. 0x24d1,
  30248. "bdotaccent",
  30249. 0x1e03,
  30250. "bdotbelow",
  30251. 0x1e05,
  30252. "beamedsixteenthnotes",
  30253. 0x266c,
  30254. "because",
  30255. 0x2235,
  30256. "becyrillic",
  30257. 0x0431,
  30258. "beharabic",
  30259. 0x0628,
  30260. "behfinalarabic",
  30261. 0xfe90,
  30262. "behinitialarabic",
  30263. 0xfe91,
  30264. "behiragana",
  30265. 0x3079,
  30266. "behmedialarabic",
  30267. 0xfe92,
  30268. "behmeeminitialarabic",
  30269. 0xfc9f,
  30270. "behmeemisolatedarabic",
  30271. 0xfc08,
  30272. "behnoonfinalarabic",
  30273. 0xfc6d,
  30274. "bekatakana",
  30275. 0x30d9,
  30276. "benarmenian",
  30277. 0x0562,
  30278. "bet",
  30279. 0x05d1,
  30280. "beta",
  30281. 0x03b2,
  30282. "betasymbolgreek",
  30283. 0x03d0,
  30284. "betdagesh",
  30285. 0xfb31,
  30286. "betdageshhebrew",
  30287. 0xfb31,
  30288. "bethebrew",
  30289. 0x05d1,
  30290. "betrafehebrew",
  30291. 0xfb4c,
  30292. "bhabengali",
  30293. 0x09ad,
  30294. "bhadeva",
  30295. 0x092d,
  30296. "bhagujarati",
  30297. 0x0aad,
  30298. "bhagurmukhi",
  30299. 0x0a2d,
  30300. "bhook",
  30301. 0x0253,
  30302. "bihiragana",
  30303. 0x3073,
  30304. "bikatakana",
  30305. 0x30d3,
  30306. "bilabialclick",
  30307. 0x0298,
  30308. "bindigurmukhi",
  30309. 0x0a02,
  30310. "birusquare",
  30311. 0x3331,
  30312. "blackcircle",
  30313. 0x25cf,
  30314. "blackdiamond",
  30315. 0x25c6,
  30316. "blackdownpointingtriangle",
  30317. 0x25bc,
  30318. "blackleftpointingpointer",
  30319. 0x25c4,
  30320. "blackleftpointingtriangle",
  30321. 0x25c0,
  30322. "blacklenticularbracketleft",
  30323. 0x3010,
  30324. "blacklenticularbracketleftvertical",
  30325. 0xfe3b,
  30326. "blacklenticularbracketright",
  30327. 0x3011,
  30328. "blacklenticularbracketrightvertical",
  30329. 0xfe3c,
  30330. "blacklowerlefttriangle",
  30331. 0x25e3,
  30332. "blacklowerrighttriangle",
  30333. 0x25e2,
  30334. "blackrectangle",
  30335. 0x25ac,
  30336. "blackrightpointingpointer",
  30337. 0x25ba,
  30338. "blackrightpointingtriangle",
  30339. 0x25b6,
  30340. "blacksmallsquare",
  30341. 0x25aa,
  30342. "blacksmilingface",
  30343. 0x263b,
  30344. "blacksquare",
  30345. 0x25a0,
  30346. "blackstar",
  30347. 0x2605,
  30348. "blackupperlefttriangle",
  30349. 0x25e4,
  30350. "blackupperrighttriangle",
  30351. 0x25e5,
  30352. "blackuppointingsmalltriangle",
  30353. 0x25b4,
  30354. "blackuppointingtriangle",
  30355. 0x25b2,
  30356. "blank",
  30357. 0x2423,
  30358. "blinebelow",
  30359. 0x1e07,
  30360. "block",
  30361. 0x2588,
  30362. "bmonospace",
  30363. 0xff42,
  30364. "bobaimaithai",
  30365. 0x0e1a,
  30366. "bohiragana",
  30367. 0x307c,
  30368. "bokatakana",
  30369. 0x30dc,
  30370. "bparen",
  30371. 0x249d,
  30372. "bqsquare",
  30373. 0x33c3,
  30374. "braceex",
  30375. 0xf8f4,
  30376. "braceleft",
  30377. 0x007b,
  30378. "braceleftbt",
  30379. 0xf8f3,
  30380. "braceleftmid",
  30381. 0xf8f2,
  30382. "braceleftmonospace",
  30383. 0xff5b,
  30384. "braceleftsmall",
  30385. 0xfe5b,
  30386. "bracelefttp",
  30387. 0xf8f1,
  30388. "braceleftvertical",
  30389. 0xfe37,
  30390. "braceright",
  30391. 0x007d,
  30392. "bracerightbt",
  30393. 0xf8fe,
  30394. "bracerightmid",
  30395. 0xf8fd,
  30396. "bracerightmonospace",
  30397. 0xff5d,
  30398. "bracerightsmall",
  30399. 0xfe5c,
  30400. "bracerighttp",
  30401. 0xf8fc,
  30402. "bracerightvertical",
  30403. 0xfe38,
  30404. "bracketleft",
  30405. 0x005b,
  30406. "bracketleftbt",
  30407. 0xf8f0,
  30408. "bracketleftex",
  30409. 0xf8ef,
  30410. "bracketleftmonospace",
  30411. 0xff3b,
  30412. "bracketlefttp",
  30413. 0xf8ee,
  30414. "bracketright",
  30415. 0x005d,
  30416. "bracketrightbt",
  30417. 0xf8fb,
  30418. "bracketrightex",
  30419. 0xf8fa,
  30420. "bracketrightmonospace",
  30421. 0xff3d,
  30422. "bracketrighttp",
  30423. 0xf8f9,
  30424. "breve",
  30425. 0x02d8,
  30426. "brevebelowcmb",
  30427. 0x032e,
  30428. "brevecmb",
  30429. 0x0306,
  30430. "breveinvertedbelowcmb",
  30431. 0x032f,
  30432. "breveinvertedcmb",
  30433. 0x0311,
  30434. "breveinverteddoublecmb",
  30435. 0x0361,
  30436. "bridgebelowcmb",
  30437. 0x032a,
  30438. "bridgeinvertedbelowcmb",
  30439. 0x033a,
  30440. "brokenbar",
  30441. 0x00a6,
  30442. "bstroke",
  30443. 0x0180,
  30444. "bsuperior",
  30445. 0xf6ea,
  30446. "btopbar",
  30447. 0x0183,
  30448. "buhiragana",
  30449. 0x3076,
  30450. "bukatakana",
  30451. 0x30d6,
  30452. "bullet",
  30453. 0x2022,
  30454. "bulletinverse",
  30455. 0x25d8,
  30456. "bulletoperator",
  30457. 0x2219,
  30458. "bullseye",
  30459. 0x25ce,
  30460. "c",
  30461. 0x0063,
  30462. "caarmenian",
  30463. 0x056e,
  30464. "cabengali",
  30465. 0x099a,
  30466. "cacute",
  30467. 0x0107,
  30468. "cadeva",
  30469. 0x091a,
  30470. "cagujarati",
  30471. 0x0a9a,
  30472. "cagurmukhi",
  30473. 0x0a1a,
  30474. "calsquare",
  30475. 0x3388,
  30476. "candrabindubengali",
  30477. 0x0981,
  30478. "candrabinducmb",
  30479. 0x0310,
  30480. "candrabindudeva",
  30481. 0x0901,
  30482. "candrabindugujarati",
  30483. 0x0a81,
  30484. "capslock",
  30485. 0x21ea,
  30486. "careof",
  30487. 0x2105,
  30488. "caron",
  30489. 0x02c7,
  30490. "caronbelowcmb",
  30491. 0x032c,
  30492. "caroncmb",
  30493. 0x030c,
  30494. "carriagereturn",
  30495. 0x21b5,
  30496. "cbopomofo",
  30497. 0x3118,
  30498. "ccaron",
  30499. 0x010d,
  30500. "ccedilla",
  30501. 0x00e7,
  30502. "ccedillaacute",
  30503. 0x1e09,
  30504. "ccircle",
  30505. 0x24d2,
  30506. "ccircumflex",
  30507. 0x0109,
  30508. "ccurl",
  30509. 0x0255,
  30510. "cdot",
  30511. 0x010b,
  30512. "cdotaccent",
  30513. 0x010b,
  30514. "cdsquare",
  30515. 0x33c5,
  30516. "cedilla",
  30517. 0x00b8,
  30518. "cedillacmb",
  30519. 0x0327,
  30520. "cent",
  30521. 0x00a2,
  30522. "centigrade",
  30523. 0x2103,
  30524. "centinferior",
  30525. 0xf6df,
  30526. "centmonospace",
  30527. 0xffe0,
  30528. "centoldstyle",
  30529. 0xf7a2,
  30530. "centsuperior",
  30531. 0xf6e0,
  30532. "chaarmenian",
  30533. 0x0579,
  30534. "chabengali",
  30535. 0x099b,
  30536. "chadeva",
  30537. 0x091b,
  30538. "chagujarati",
  30539. 0x0a9b,
  30540. "chagurmukhi",
  30541. 0x0a1b,
  30542. "chbopomofo",
  30543. 0x3114,
  30544. "cheabkhasiancyrillic",
  30545. 0x04bd,
  30546. "checkmark",
  30547. 0x2713,
  30548. "checyrillic",
  30549. 0x0447,
  30550. "chedescenderabkhasiancyrillic",
  30551. 0x04bf,
  30552. "chedescendercyrillic",
  30553. 0x04b7,
  30554. "chedieresiscyrillic",
  30555. 0x04f5,
  30556. "cheharmenian",
  30557. 0x0573,
  30558. "chekhakassiancyrillic",
  30559. 0x04cc,
  30560. "cheverticalstrokecyrillic",
  30561. 0x04b9,
  30562. "chi",
  30563. 0x03c7,
  30564. "chieuchacirclekorean",
  30565. 0x3277,
  30566. "chieuchaparenkorean",
  30567. 0x3217,
  30568. "chieuchcirclekorean",
  30569. 0x3269,
  30570. "chieuchkorean",
  30571. 0x314a,
  30572. "chieuchparenkorean",
  30573. 0x3209,
  30574. "chochangthai",
  30575. 0x0e0a,
  30576. "chochanthai",
  30577. 0x0e08,
  30578. "chochingthai",
  30579. 0x0e09,
  30580. "chochoethai",
  30581. 0x0e0c,
  30582. "chook",
  30583. 0x0188,
  30584. "cieucacirclekorean",
  30585. 0x3276,
  30586. "cieucaparenkorean",
  30587. 0x3216,
  30588. "cieuccirclekorean",
  30589. 0x3268,
  30590. "cieuckorean",
  30591. 0x3148,
  30592. "cieucparenkorean",
  30593. 0x3208,
  30594. "cieucuparenkorean",
  30595. 0x321c,
  30596. "circle",
  30597. 0x25cb,
  30598. "circlecopyrt",
  30599. 0x00a9,
  30600. "circlemultiply",
  30601. 0x2297,
  30602. "circleot",
  30603. 0x2299,
  30604. "circleplus",
  30605. 0x2295,
  30606. "circlepostalmark",
  30607. 0x3036,
  30608. "circlewithlefthalfblack",
  30609. 0x25d0,
  30610. "circlewithrighthalfblack",
  30611. 0x25d1,
  30612. "circumflex",
  30613. 0x02c6,
  30614. "circumflexbelowcmb",
  30615. 0x032d,
  30616. "circumflexcmb",
  30617. 0x0302,
  30618. "clear",
  30619. 0x2327,
  30620. "clickalveolar",
  30621. 0x01c2,
  30622. "clickdental",
  30623. 0x01c0,
  30624. "clicklateral",
  30625. 0x01c1,
  30626. "clickretroflex",
  30627. 0x01c3,
  30628. "club",
  30629. 0x2663,
  30630. "clubsuitblack",
  30631. 0x2663,
  30632. "clubsuitwhite",
  30633. 0x2667,
  30634. "cmcubedsquare",
  30635. 0x33a4,
  30636. "cmonospace",
  30637. 0xff43,
  30638. "cmsquaredsquare",
  30639. 0x33a0,
  30640. "coarmenian",
  30641. 0x0581,
  30642. "colon",
  30643. 0x003a,
  30644. "colonmonetary",
  30645. 0x20a1,
  30646. "colonmonospace",
  30647. 0xff1a,
  30648. "colonsign",
  30649. 0x20a1,
  30650. "colonsmall",
  30651. 0xfe55,
  30652. "colontriangularhalfmod",
  30653. 0x02d1,
  30654. "colontriangularmod",
  30655. 0x02d0,
  30656. "comma",
  30657. 0x002c,
  30658. "commaabovecmb",
  30659. 0x0313,
  30660. "commaaboverightcmb",
  30661. 0x0315,
  30662. "commaaccent",
  30663. 0xf6c3,
  30664. "commaarabic",
  30665. 0x060c,
  30666. "commaarmenian",
  30667. 0x055d,
  30668. "commainferior",
  30669. 0xf6e1,
  30670. "commamonospace",
  30671. 0xff0c,
  30672. "commareversedabovecmb",
  30673. 0x0314,
  30674. "commareversedmod",
  30675. 0x02bd,
  30676. "commasmall",
  30677. 0xfe50,
  30678. "commasuperior",
  30679. 0xf6e2,
  30680. "commaturnedabovecmb",
  30681. 0x0312,
  30682. "commaturnedmod",
  30683. 0x02bb,
  30684. "compass",
  30685. 0x263c,
  30686. "congruent",
  30687. 0x2245,
  30688. "contourintegral",
  30689. 0x222e,
  30690. "control",
  30691. 0x2303,
  30692. "controlACK",
  30693. 0x0006,
  30694. "controlBEL",
  30695. 0x0007,
  30696. "controlBS",
  30697. 0x0008,
  30698. "controlCAN",
  30699. 0x0018,
  30700. "controlCR",
  30701. 0x000d,
  30702. "controlDC1",
  30703. 0x0011,
  30704. "controlDC2",
  30705. 0x0012,
  30706. "controlDC3",
  30707. 0x0013,
  30708. "controlDC4",
  30709. 0x0014,
  30710. "controlDEL",
  30711. 0x007f,
  30712. "controlDLE",
  30713. 0x0010,
  30714. "controlEM",
  30715. 0x0019,
  30716. "controlENQ",
  30717. 0x0005,
  30718. "controlEOT",
  30719. 0x0004,
  30720. "controlESC",
  30721. 0x001b,
  30722. "controlETB",
  30723. 0x0017,
  30724. "controlETX",
  30725. 0x0003,
  30726. "controlFF",
  30727. 0x000c,
  30728. "controlFS",
  30729. 0x001c,
  30730. "controlGS",
  30731. 0x001d,
  30732. "controlHT",
  30733. 0x0009,
  30734. "controlLF",
  30735. 0x000a,
  30736. "controlNAK",
  30737. 0x0015,
  30738. "controlNULL",
  30739. 0x0000,
  30740. "controlRS",
  30741. 0x001e,
  30742. "controlSI",
  30743. 0x000f,
  30744. "controlSO",
  30745. 0x000e,
  30746. "controlSOT",
  30747. 0x0002,
  30748. "controlSTX",
  30749. 0x0001,
  30750. "controlSUB",
  30751. 0x001a,
  30752. "controlSYN",
  30753. 0x0016,
  30754. "controlUS",
  30755. 0x001f,
  30756. "controlVT",
  30757. 0x000b,
  30758. "copyright",
  30759. 0x00a9,
  30760. "copyrightsans",
  30761. 0xf8e9,
  30762. "copyrightserif",
  30763. 0xf6d9,
  30764. "cornerbracketleft",
  30765. 0x300c,
  30766. "cornerbracketlefthalfwidth",
  30767. 0xff62,
  30768. "cornerbracketleftvertical",
  30769. 0xfe41,
  30770. "cornerbracketright",
  30771. 0x300d,
  30772. "cornerbracketrighthalfwidth",
  30773. 0xff63,
  30774. "cornerbracketrightvertical",
  30775. 0xfe42,
  30776. "corporationsquare",
  30777. 0x337f,
  30778. "cosquare",
  30779. 0x33c7,
  30780. "coverkgsquare",
  30781. 0x33c6,
  30782. "cparen",
  30783. 0x249e,
  30784. "cruzeiro",
  30785. 0x20a2,
  30786. "cstretched",
  30787. 0x0297,
  30788. "curlyand",
  30789. 0x22cf,
  30790. "curlyor",
  30791. 0x22ce,
  30792. "currency",
  30793. 0x00a4,
  30794. "cyrBreve",
  30795. 0xf6d1,
  30796. "cyrFlex",
  30797. 0xf6d2,
  30798. "cyrbreve",
  30799. 0xf6d4,
  30800. "cyrflex",
  30801. 0xf6d5,
  30802. "d",
  30803. 0x0064,
  30804. "daarmenian",
  30805. 0x0564,
  30806. "dabengali",
  30807. 0x09a6,
  30808. "dadarabic",
  30809. 0x0636,
  30810. "dadeva",
  30811. 0x0926,
  30812. "dadfinalarabic",
  30813. 0xfebe,
  30814. "dadinitialarabic",
  30815. 0xfebf,
  30816. "dadmedialarabic",
  30817. 0xfec0,
  30818. "dagesh",
  30819. 0x05bc,
  30820. "dageshhebrew",
  30821. 0x05bc,
  30822. "dagger",
  30823. 0x2020,
  30824. "daggerdbl",
  30825. 0x2021,
  30826. "dagujarati",
  30827. 0x0aa6,
  30828. "dagurmukhi",
  30829. 0x0a26,
  30830. "dahiragana",
  30831. 0x3060,
  30832. "dakatakana",
  30833. 0x30c0,
  30834. "dalarabic",
  30835. 0x062f,
  30836. "dalet",
  30837. 0x05d3,
  30838. "daletdagesh",
  30839. 0xfb33,
  30840. "daletdageshhebrew",
  30841. 0xfb33,
  30842. "dalethebrew",
  30843. 0x05d3,
  30844. "dalfinalarabic",
  30845. 0xfeaa,
  30846. "dammaarabic",
  30847. 0x064f,
  30848. "dammalowarabic",
  30849. 0x064f,
  30850. "dammatanaltonearabic",
  30851. 0x064c,
  30852. "dammatanarabic",
  30853. 0x064c,
  30854. "danda",
  30855. 0x0964,
  30856. "dargahebrew",
  30857. 0x05a7,
  30858. "dargalefthebrew",
  30859. 0x05a7,
  30860. "dasiapneumatacyrilliccmb",
  30861. 0x0485,
  30862. "dblGrave",
  30863. 0xf6d3,
  30864. "dblanglebracketleft",
  30865. 0x300a,
  30866. "dblanglebracketleftvertical",
  30867. 0xfe3d,
  30868. "dblanglebracketright",
  30869. 0x300b,
  30870. "dblanglebracketrightvertical",
  30871. 0xfe3e,
  30872. "dblarchinvertedbelowcmb",
  30873. 0x032b,
  30874. "dblarrowleft",
  30875. 0x21d4,
  30876. "dblarrowright",
  30877. 0x21d2,
  30878. "dbldanda",
  30879. 0x0965,
  30880. "dblgrave",
  30881. 0xf6d6,
  30882. "dblgravecmb",
  30883. 0x030f,
  30884. "dblintegral",
  30885. 0x222c,
  30886. "dbllowline",
  30887. 0x2017,
  30888. "dbllowlinecmb",
  30889. 0x0333,
  30890. "dbloverlinecmb",
  30891. 0x033f,
  30892. "dblprimemod",
  30893. 0x02ba,
  30894. "dblverticalbar",
  30895. 0x2016,
  30896. "dblverticallineabovecmb",
  30897. 0x030e,
  30898. "dbopomofo",
  30899. 0x3109,
  30900. "dbsquare",
  30901. 0x33c8,
  30902. "dcaron",
  30903. 0x010f,
  30904. "dcedilla",
  30905. 0x1e11,
  30906. "dcircle",
  30907. 0x24d3,
  30908. "dcircumflexbelow",
  30909. 0x1e13,
  30910. "dcroat",
  30911. 0x0111,
  30912. "ddabengali",
  30913. 0x09a1,
  30914. "ddadeva",
  30915. 0x0921,
  30916. "ddagujarati",
  30917. 0x0aa1,
  30918. "ddagurmukhi",
  30919. 0x0a21,
  30920. "ddalarabic",
  30921. 0x0688,
  30922. "ddalfinalarabic",
  30923. 0xfb89,
  30924. "dddhadeva",
  30925. 0x095c,
  30926. "ddhabengali",
  30927. 0x09a2,
  30928. "ddhadeva",
  30929. 0x0922,
  30930. "ddhagujarati",
  30931. 0x0aa2,
  30932. "ddhagurmukhi",
  30933. 0x0a22,
  30934. "ddotaccent",
  30935. 0x1e0b,
  30936. "ddotbelow",
  30937. 0x1e0d,
  30938. "decimalseparatorarabic",
  30939. 0x066b,
  30940. "decimalseparatorpersian",
  30941. 0x066b,
  30942. "decyrillic",
  30943. 0x0434,
  30944. "degree",
  30945. 0x00b0,
  30946. "dehihebrew",
  30947. 0x05ad,
  30948. "dehiragana",
  30949. 0x3067,
  30950. "deicoptic",
  30951. 0x03ef,
  30952. "dekatakana",
  30953. 0x30c7,
  30954. "deleteleft",
  30955. 0x232b,
  30956. "deleteright",
  30957. 0x2326,
  30958. "delta",
  30959. 0x03b4,
  30960. "deltaturned",
  30961. 0x018d,
  30962. "denominatorminusonenumeratorbengali",
  30963. 0x09f8,
  30964. "dezh",
  30965. 0x02a4,
  30966. "dhabengali",
  30967. 0x09a7,
  30968. "dhadeva",
  30969. 0x0927,
  30970. "dhagujarati",
  30971. 0x0aa7,
  30972. "dhagurmukhi",
  30973. 0x0a27,
  30974. "dhook",
  30975. 0x0257,
  30976. "dialytikatonos",
  30977. 0x0385,
  30978. "dialytikatonoscmb",
  30979. 0x0344,
  30980. "diamond",
  30981. 0x2666,
  30982. "diamondsuitwhite",
  30983. 0x2662,
  30984. "dieresis",
  30985. 0x00a8,
  30986. "dieresisacute",
  30987. 0xf6d7,
  30988. "dieresisbelowcmb",
  30989. 0x0324,
  30990. "dieresiscmb",
  30991. 0x0308,
  30992. "dieresisgrave",
  30993. 0xf6d8,
  30994. "dieresistonos",
  30995. 0x0385,
  30996. "dihiragana",
  30997. 0x3062,
  30998. "dikatakana",
  30999. 0x30c2,
  31000. "dittomark",
  31001. 0x3003,
  31002. "divide",
  31003. 0x00f7,
  31004. "divides",
  31005. 0x2223,
  31006. "divisionslash",
  31007. 0x2215,
  31008. "djecyrillic",
  31009. 0x0452,
  31010. "dkshade",
  31011. 0x2593,
  31012. "dlinebelow",
  31013. 0x1e0f,
  31014. "dlsquare",
  31015. 0x3397,
  31016. "dmacron",
  31017. 0x0111,
  31018. "dmonospace",
  31019. 0xff44,
  31020. "dnblock",
  31021. 0x2584,
  31022. "dochadathai",
  31023. 0x0e0e,
  31024. "dodekthai",
  31025. 0x0e14,
  31026. "dohiragana",
  31027. 0x3069,
  31028. "dokatakana",
  31029. 0x30c9,
  31030. "dollar",
  31031. 0x0024,
  31032. "dollarinferior",
  31033. 0xf6e3,
  31034. "dollarmonospace",
  31035. 0xff04,
  31036. "dollaroldstyle",
  31037. 0xf724,
  31038. "dollarsmall",
  31039. 0xfe69,
  31040. "dollarsuperior",
  31041. 0xf6e4,
  31042. "dong",
  31043. 0x20ab,
  31044. "dorusquare",
  31045. 0x3326,
  31046. "dotaccent",
  31047. 0x02d9,
  31048. "dotaccentcmb",
  31049. 0x0307,
  31050. "dotbelowcmb",
  31051. 0x0323,
  31052. "dotbelowcomb",
  31053. 0x0323,
  31054. "dotkatakana",
  31055. 0x30fb,
  31056. "dotlessi",
  31057. 0x0131,
  31058. "dotlessj",
  31059. 0xf6be,
  31060. "dotlessjstrokehook",
  31061. 0x0284,
  31062. "dotmath",
  31063. 0x22c5,
  31064. "dottedcircle",
  31065. 0x25cc,
  31066. "doubleyodpatah",
  31067. 0xfb1f,
  31068. "doubleyodpatahhebrew",
  31069. 0xfb1f,
  31070. "downtackbelowcmb",
  31071. 0x031e,
  31072. "downtackmod",
  31073. 0x02d5,
  31074. "dparen",
  31075. 0x249f,
  31076. "dsuperior",
  31077. 0xf6eb,
  31078. "dtail",
  31079. 0x0256,
  31080. "dtopbar",
  31081. 0x018c,
  31082. "duhiragana",
  31083. 0x3065,
  31084. "dukatakana",
  31085. 0x30c5,
  31086. "dz",
  31087. 0x01f3,
  31088. "dzaltone",
  31089. 0x02a3,
  31090. "dzcaron",
  31091. 0x01c6,
  31092. "dzcurl",
  31093. 0x02a5,
  31094. "dzeabkhasiancyrillic",
  31095. 0x04e1,
  31096. "dzecyrillic",
  31097. 0x0455,
  31098. "dzhecyrillic",
  31099. 0x045f,
  31100. "e",
  31101. 0x0065,
  31102. "eacute",
  31103. 0x00e9,
  31104. "earth",
  31105. 0x2641,
  31106. "ebengali",
  31107. 0x098f,
  31108. "ebopomofo",
  31109. 0x311c,
  31110. "ebreve",
  31111. 0x0115,
  31112. "ecandradeva",
  31113. 0x090d,
  31114. "ecandragujarati",
  31115. 0x0a8d,
  31116. "ecandravowelsigndeva",
  31117. 0x0945,
  31118. "ecandravowelsigngujarati",
  31119. 0x0ac5,
  31120. "ecaron",
  31121. 0x011b,
  31122. "ecedillabreve",
  31123. 0x1e1d,
  31124. "echarmenian",
  31125. 0x0565,
  31126. "echyiwnarmenian",
  31127. 0x0587,
  31128. "ecircle",
  31129. 0x24d4,
  31130. "ecircumflex",
  31131. 0x00ea,
  31132. "ecircumflexacute",
  31133. 0x1ebf,
  31134. "ecircumflexbelow",
  31135. 0x1e19,
  31136. "ecircumflexdotbelow",
  31137. 0x1ec7,
  31138. "ecircumflexgrave",
  31139. 0x1ec1,
  31140. "ecircumflexhookabove",
  31141. 0x1ec3,
  31142. "ecircumflextilde",
  31143. 0x1ec5,
  31144. "ecyrillic",
  31145. 0x0454,
  31146. "edblgrave",
  31147. 0x0205,
  31148. "edeva",
  31149. 0x090f,
  31150. "edieresis",
  31151. 0x00eb,
  31152. "edot",
  31153. 0x0117,
  31154. "edotaccent",
  31155. 0x0117,
  31156. "edotbelow",
  31157. 0x1eb9,
  31158. "eegurmukhi",
  31159. 0x0a0f,
  31160. "eematragurmukhi",
  31161. 0x0a47,
  31162. "efcyrillic",
  31163. 0x0444,
  31164. "egrave",
  31165. 0x00e8,
  31166. "egujarati",
  31167. 0x0a8f,
  31168. "eharmenian",
  31169. 0x0567,
  31170. "ehbopomofo",
  31171. 0x311d,
  31172. "ehiragana",
  31173. 0x3048,
  31174. "ehookabove",
  31175. 0x1ebb,
  31176. "eibopomofo",
  31177. 0x311f,
  31178. "eight",
  31179. 0x0038,
  31180. "eightarabic",
  31181. 0x0668,
  31182. "eightbengali",
  31183. 0x09ee,
  31184. "eightcircle",
  31185. 0x2467,
  31186. "eightcircleinversesansserif",
  31187. 0x2791,
  31188. "eightdeva",
  31189. 0x096e,
  31190. "eighteencircle",
  31191. 0x2471,
  31192. "eighteenparen",
  31193. 0x2485,
  31194. "eighteenperiod",
  31195. 0x2499,
  31196. "eightgujarati",
  31197. 0x0aee,
  31198. "eightgurmukhi",
  31199. 0x0a6e,
  31200. "eighthackarabic",
  31201. 0x0668,
  31202. "eighthangzhou",
  31203. 0x3028,
  31204. "eighthnotebeamed",
  31205. 0x266b,
  31206. "eightideographicparen",
  31207. 0x3227,
  31208. "eightinferior",
  31209. 0x2088,
  31210. "eightmonospace",
  31211. 0xff18,
  31212. "eightoldstyle",
  31213. 0xf738,
  31214. "eightparen",
  31215. 0x247b,
  31216. "eightperiod",
  31217. 0x248f,
  31218. "eightpersian",
  31219. 0x06f8,
  31220. "eightroman",
  31221. 0x2177,
  31222. "eightsuperior",
  31223. 0x2078,
  31224. "eightthai",
  31225. 0x0e58,
  31226. "einvertedbreve",
  31227. 0x0207,
  31228. "eiotifiedcyrillic",
  31229. 0x0465,
  31230. "ekatakana",
  31231. 0x30a8,
  31232. "ekatakanahalfwidth",
  31233. 0xff74,
  31234. "ekonkargurmukhi",
  31235. 0x0a74,
  31236. "ekorean",
  31237. 0x3154,
  31238. "elcyrillic",
  31239. 0x043b,
  31240. "element",
  31241. 0x2208,
  31242. "elevencircle",
  31243. 0x246a,
  31244. "elevenparen",
  31245. 0x247e,
  31246. "elevenperiod",
  31247. 0x2492,
  31248. "elevenroman",
  31249. 0x217a,
  31250. "ellipsis",
  31251. 0x2026,
  31252. "ellipsisvertical",
  31253. 0x22ee,
  31254. "emacron",
  31255. 0x0113,
  31256. "emacronacute",
  31257. 0x1e17,
  31258. "emacrongrave",
  31259. 0x1e15,
  31260. "emcyrillic",
  31261. 0x043c,
  31262. "emdash",
  31263. 0x2014,
  31264. "emdashvertical",
  31265. 0xfe31,
  31266. "emonospace",
  31267. 0xff45,
  31268. "emphasismarkarmenian",
  31269. 0x055b,
  31270. "emptyset",
  31271. 0x2205,
  31272. "enbopomofo",
  31273. 0x3123,
  31274. "encyrillic",
  31275. 0x043d,
  31276. "endash",
  31277. 0x2013,
  31278. "endashvertical",
  31279. 0xfe32,
  31280. "endescendercyrillic",
  31281. 0x04a3,
  31282. "eng",
  31283. 0x014b,
  31284. "engbopomofo",
  31285. 0x3125,
  31286. "enghecyrillic",
  31287. 0x04a5,
  31288. "enhookcyrillic",
  31289. 0x04c8,
  31290. "enspace",
  31291. 0x2002,
  31292. "eogonek",
  31293. 0x0119,
  31294. "eokorean",
  31295. 0x3153,
  31296. "eopen",
  31297. 0x025b,
  31298. "eopenclosed",
  31299. 0x029a,
  31300. "eopenreversed",
  31301. 0x025c,
  31302. "eopenreversedclosed",
  31303. 0x025e,
  31304. "eopenreversedhook",
  31305. 0x025d,
  31306. "eparen",
  31307. 0x24a0,
  31308. "epsilon",
  31309. 0x03b5,
  31310. "epsilontonos",
  31311. 0x03ad,
  31312. "equal",
  31313. 0x003d,
  31314. "equalmonospace",
  31315. 0xff1d,
  31316. "equalsmall",
  31317. 0xfe66,
  31318. "equalsuperior",
  31319. 0x207c,
  31320. "equivalence",
  31321. 0x2261,
  31322. "erbopomofo",
  31323. 0x3126,
  31324. "ercyrillic",
  31325. 0x0440,
  31326. "ereversed",
  31327. 0x0258,
  31328. "ereversedcyrillic",
  31329. 0x044d,
  31330. "escyrillic",
  31331. 0x0441,
  31332. "esdescendercyrillic",
  31333. 0x04ab,
  31334. "esh",
  31335. 0x0283,
  31336. "eshcurl",
  31337. 0x0286,
  31338. "eshortdeva",
  31339. 0x090e,
  31340. "eshortvowelsigndeva",
  31341. 0x0946,
  31342. "eshreversedloop",
  31343. 0x01aa,
  31344. "eshsquatreversed",
  31345. 0x0285,
  31346. "esmallhiragana",
  31347. 0x3047,
  31348. "esmallkatakana",
  31349. 0x30a7,
  31350. "esmallkatakanahalfwidth",
  31351. 0xff6a,
  31352. "estimated",
  31353. 0x212e,
  31354. "esuperior",
  31355. 0xf6ec,
  31356. "eta",
  31357. 0x03b7,
  31358. "etarmenian",
  31359. 0x0568,
  31360. "etatonos",
  31361. 0x03ae,
  31362. "eth",
  31363. 0x00f0,
  31364. "etilde",
  31365. 0x1ebd,
  31366. "etildebelow",
  31367. 0x1e1b,
  31368. "etnahtafoukhhebrew",
  31369. 0x0591,
  31370. "etnahtafoukhlefthebrew",
  31371. 0x0591,
  31372. "etnahtahebrew",
  31373. 0x0591,
  31374. "etnahtalefthebrew",
  31375. 0x0591,
  31376. "eturned",
  31377. 0x01dd,
  31378. "eukorean",
  31379. 0x3161,
  31380. "euro",
  31381. 0x20ac,
  31382. "evowelsignbengali",
  31383. 0x09c7,
  31384. "evowelsigndeva",
  31385. 0x0947,
  31386. "evowelsigngujarati",
  31387. 0x0ac7,
  31388. "exclam",
  31389. 0x0021,
  31390. "exclamarmenian",
  31391. 0x055c,
  31392. "exclamdbl",
  31393. 0x203c,
  31394. "exclamdown",
  31395. 0x00a1,
  31396. "exclamdownsmall",
  31397. 0xf7a1,
  31398. "exclammonospace",
  31399. 0xff01,
  31400. "exclamsmall",
  31401. 0xf721,
  31402. "existential",
  31403. 0x2203,
  31404. "ezh",
  31405. 0x0292,
  31406. "ezhcaron",
  31407. 0x01ef,
  31408. "ezhcurl",
  31409. 0x0293,
  31410. "ezhreversed",
  31411. 0x01b9,
  31412. "ezhtail",
  31413. 0x01ba,
  31414. "f",
  31415. 0x0066,
  31416. "fadeva",
  31417. 0x095e,
  31418. "fagurmukhi",
  31419. 0x0a5e,
  31420. "fahrenheit",
  31421. 0x2109,
  31422. "fathaarabic",
  31423. 0x064e,
  31424. "fathalowarabic",
  31425. 0x064e,
  31426. "fathatanarabic",
  31427. 0x064b,
  31428. "fbopomofo",
  31429. 0x3108,
  31430. "fcircle",
  31431. 0x24d5,
  31432. "fdotaccent",
  31433. 0x1e1f,
  31434. "feharabic",
  31435. 0x0641,
  31436. "feharmenian",
  31437. 0x0586,
  31438. "fehfinalarabic",
  31439. 0xfed2,
  31440. "fehinitialarabic",
  31441. 0xfed3,
  31442. "fehmedialarabic",
  31443. 0xfed4,
  31444. "feicoptic",
  31445. 0x03e5,
  31446. "female",
  31447. 0x2640,
  31448. "ff",
  31449. 0xfb00,
  31450. "f_f",
  31451. 0xfb00,
  31452. "ffi",
  31453. 0xfb03,
  31454. "f_f_i",
  31455. 0xfb03,
  31456. "ffl",
  31457. 0xfb04,
  31458. "f_f_l",
  31459. 0xfb04,
  31460. "fi",
  31461. 0xfb01,
  31462. "f_i",
  31463. 0xfb01,
  31464. "fifteencircle",
  31465. 0x246e,
  31466. "fifteenparen",
  31467. 0x2482,
  31468. "fifteenperiod",
  31469. 0x2496,
  31470. "figuredash",
  31471. 0x2012,
  31472. "filledbox",
  31473. 0x25a0,
  31474. "filledrect",
  31475. 0x25ac,
  31476. "finalkaf",
  31477. 0x05da,
  31478. "finalkafdagesh",
  31479. 0xfb3a,
  31480. "finalkafdageshhebrew",
  31481. 0xfb3a,
  31482. "finalkafhebrew",
  31483. 0x05da,
  31484. "finalmem",
  31485. 0x05dd,
  31486. "finalmemhebrew",
  31487. 0x05dd,
  31488. "finalnun",
  31489. 0x05df,
  31490. "finalnunhebrew",
  31491. 0x05df,
  31492. "finalpe",
  31493. 0x05e3,
  31494. "finalpehebrew",
  31495. 0x05e3,
  31496. "finaltsadi",
  31497. 0x05e5,
  31498. "finaltsadihebrew",
  31499. 0x05e5,
  31500. "firsttonechinese",
  31501. 0x02c9,
  31502. "fisheye",
  31503. 0x25c9,
  31504. "fitacyrillic",
  31505. 0x0473,
  31506. "five",
  31507. 0x0035,
  31508. "fivearabic",
  31509. 0x0665,
  31510. "fivebengali",
  31511. 0x09eb,
  31512. "fivecircle",
  31513. 0x2464,
  31514. "fivecircleinversesansserif",
  31515. 0x278e,
  31516. "fivedeva",
  31517. 0x096b,
  31518. "fiveeighths",
  31519. 0x215d,
  31520. "fivegujarati",
  31521. 0x0aeb,
  31522. "fivegurmukhi",
  31523. 0x0a6b,
  31524. "fivehackarabic",
  31525. 0x0665,
  31526. "fivehangzhou",
  31527. 0x3025,
  31528. "fiveideographicparen",
  31529. 0x3224,
  31530. "fiveinferior",
  31531. 0x2085,
  31532. "fivemonospace",
  31533. 0xff15,
  31534. "fiveoldstyle",
  31535. 0xf735,
  31536. "fiveparen",
  31537. 0x2478,
  31538. "fiveperiod",
  31539. 0x248c,
  31540. "fivepersian",
  31541. 0x06f5,
  31542. "fiveroman",
  31543. 0x2174,
  31544. "fivesuperior",
  31545. 0x2075,
  31546. "fivethai",
  31547. 0x0e55,
  31548. "fl",
  31549. 0xfb02,
  31550. "f_l",
  31551. 0xfb02,
  31552. "florin",
  31553. 0x0192,
  31554. "fmonospace",
  31555. 0xff46,
  31556. "fmsquare",
  31557. 0x3399,
  31558. "fofanthai",
  31559. 0x0e1f,
  31560. "fofathai",
  31561. 0x0e1d,
  31562. "fongmanthai",
  31563. 0x0e4f,
  31564. "forall",
  31565. 0x2200,
  31566. "four",
  31567. 0x0034,
  31568. "fourarabic",
  31569. 0x0664,
  31570. "fourbengali",
  31571. 0x09ea,
  31572. "fourcircle",
  31573. 0x2463,
  31574. "fourcircleinversesansserif",
  31575. 0x278d,
  31576. "fourdeva",
  31577. 0x096a,
  31578. "fourgujarati",
  31579. 0x0aea,
  31580. "fourgurmukhi",
  31581. 0x0a6a,
  31582. "fourhackarabic",
  31583. 0x0664,
  31584. "fourhangzhou",
  31585. 0x3024,
  31586. "fourideographicparen",
  31587. 0x3223,
  31588. "fourinferior",
  31589. 0x2084,
  31590. "fourmonospace",
  31591. 0xff14,
  31592. "fournumeratorbengali",
  31593. 0x09f7,
  31594. "fouroldstyle",
  31595. 0xf734,
  31596. "fourparen",
  31597. 0x2477,
  31598. "fourperiod",
  31599. 0x248b,
  31600. "fourpersian",
  31601. 0x06f4,
  31602. "fourroman",
  31603. 0x2173,
  31604. "foursuperior",
  31605. 0x2074,
  31606. "fourteencircle",
  31607. 0x246d,
  31608. "fourteenparen",
  31609. 0x2481,
  31610. "fourteenperiod",
  31611. 0x2495,
  31612. "fourthai",
  31613. 0x0e54,
  31614. "fourthtonechinese",
  31615. 0x02cb,
  31616. "fparen",
  31617. 0x24a1,
  31618. "fraction",
  31619. 0x2044,
  31620. "franc",
  31621. 0x20a3,
  31622. "g",
  31623. 0x0067,
  31624. "gabengali",
  31625. 0x0997,
  31626. "gacute",
  31627. 0x01f5,
  31628. "gadeva",
  31629. 0x0917,
  31630. "gafarabic",
  31631. 0x06af,
  31632. "gaffinalarabic",
  31633. 0xfb93,
  31634. "gafinitialarabic",
  31635. 0xfb94,
  31636. "gafmedialarabic",
  31637. 0xfb95,
  31638. "gagujarati",
  31639. 0x0a97,
  31640. "gagurmukhi",
  31641. 0x0a17,
  31642. "gahiragana",
  31643. 0x304c,
  31644. "gakatakana",
  31645. 0x30ac,
  31646. "gamma",
  31647. 0x03b3,
  31648. "gammalatinsmall",
  31649. 0x0263,
  31650. "gammasuperior",
  31651. 0x02e0,
  31652. "gangiacoptic",
  31653. 0x03eb,
  31654. "gbopomofo",
  31655. 0x310d,
  31656. "gbreve",
  31657. 0x011f,
  31658. "gcaron",
  31659. 0x01e7,
  31660. "gcedilla",
  31661. 0x0123,
  31662. "gcircle",
  31663. 0x24d6,
  31664. "gcircumflex",
  31665. 0x011d,
  31666. "gcommaaccent",
  31667. 0x0123,
  31668. "gdot",
  31669. 0x0121,
  31670. "gdotaccent",
  31671. 0x0121,
  31672. "gecyrillic",
  31673. 0x0433,
  31674. "gehiragana",
  31675. 0x3052,
  31676. "gekatakana",
  31677. 0x30b2,
  31678. "geometricallyequal",
  31679. 0x2251,
  31680. "gereshaccenthebrew",
  31681. 0x059c,
  31682. "gereshhebrew",
  31683. 0x05f3,
  31684. "gereshmuqdamhebrew",
  31685. 0x059d,
  31686. "germandbls",
  31687. 0x00df,
  31688. "gershayimaccenthebrew",
  31689. 0x059e,
  31690. "gershayimhebrew",
  31691. 0x05f4,
  31692. "getamark",
  31693. 0x3013,
  31694. "ghabengali",
  31695. 0x0998,
  31696. "ghadarmenian",
  31697. 0x0572,
  31698. "ghadeva",
  31699. 0x0918,
  31700. "ghagujarati",
  31701. 0x0a98,
  31702. "ghagurmukhi",
  31703. 0x0a18,
  31704. "ghainarabic",
  31705. 0x063a,
  31706. "ghainfinalarabic",
  31707. 0xfece,
  31708. "ghaininitialarabic",
  31709. 0xfecf,
  31710. "ghainmedialarabic",
  31711. 0xfed0,
  31712. "ghemiddlehookcyrillic",
  31713. 0x0495,
  31714. "ghestrokecyrillic",
  31715. 0x0493,
  31716. "gheupturncyrillic",
  31717. 0x0491,
  31718. "ghhadeva",
  31719. 0x095a,
  31720. "ghhagurmukhi",
  31721. 0x0a5a,
  31722. "ghook",
  31723. 0x0260,
  31724. "ghzsquare",
  31725. 0x3393,
  31726. "gihiragana",
  31727. 0x304e,
  31728. "gikatakana",
  31729. 0x30ae,
  31730. "gimarmenian",
  31731. 0x0563,
  31732. "gimel",
  31733. 0x05d2,
  31734. "gimeldagesh",
  31735. 0xfb32,
  31736. "gimeldageshhebrew",
  31737. 0xfb32,
  31738. "gimelhebrew",
  31739. 0x05d2,
  31740. "gjecyrillic",
  31741. 0x0453,
  31742. "glottalinvertedstroke",
  31743. 0x01be,
  31744. "glottalstop",
  31745. 0x0294,
  31746. "glottalstopinverted",
  31747. 0x0296,
  31748. "glottalstopmod",
  31749. 0x02c0,
  31750. "glottalstopreversed",
  31751. 0x0295,
  31752. "glottalstopreversedmod",
  31753. 0x02c1,
  31754. "glottalstopreversedsuperior",
  31755. 0x02e4,
  31756. "glottalstopstroke",
  31757. 0x02a1,
  31758. "glottalstopstrokereversed",
  31759. 0x02a2,
  31760. "gmacron",
  31761. 0x1e21,
  31762. "gmonospace",
  31763. 0xff47,
  31764. "gohiragana",
  31765. 0x3054,
  31766. "gokatakana",
  31767. 0x30b4,
  31768. "gparen",
  31769. 0x24a2,
  31770. "gpasquare",
  31771. 0x33ac,
  31772. "gradient",
  31773. 0x2207,
  31774. "grave",
  31775. 0x0060,
  31776. "gravebelowcmb",
  31777. 0x0316,
  31778. "gravecmb",
  31779. 0x0300,
  31780. "gravecomb",
  31781. 0x0300,
  31782. "gravedeva",
  31783. 0x0953,
  31784. "gravelowmod",
  31785. 0x02ce,
  31786. "gravemonospace",
  31787. 0xff40,
  31788. "gravetonecmb",
  31789. 0x0340,
  31790. "greater",
  31791. 0x003e,
  31792. "greaterequal",
  31793. 0x2265,
  31794. "greaterequalorless",
  31795. 0x22db,
  31796. "greatermonospace",
  31797. 0xff1e,
  31798. "greaterorequivalent",
  31799. 0x2273,
  31800. "greaterorless",
  31801. 0x2277,
  31802. "greateroverequal",
  31803. 0x2267,
  31804. "greatersmall",
  31805. 0xfe65,
  31806. "gscript",
  31807. 0x0261,
  31808. "gstroke",
  31809. 0x01e5,
  31810. "guhiragana",
  31811. 0x3050,
  31812. "guillemotleft",
  31813. 0x00ab,
  31814. "guillemotright",
  31815. 0x00bb,
  31816. "guilsinglleft",
  31817. 0x2039,
  31818. "guilsinglright",
  31819. 0x203a,
  31820. "gukatakana",
  31821. 0x30b0,
  31822. "guramusquare",
  31823. 0x3318,
  31824. "gysquare",
  31825. 0x33c9,
  31826. "h",
  31827. 0x0068,
  31828. "haabkhasiancyrillic",
  31829. 0x04a9,
  31830. "haaltonearabic",
  31831. 0x06c1,
  31832. "habengali",
  31833. 0x09b9,
  31834. "hadescendercyrillic",
  31835. 0x04b3,
  31836. "hadeva",
  31837. 0x0939,
  31838. "hagujarati",
  31839. 0x0ab9,
  31840. "hagurmukhi",
  31841. 0x0a39,
  31842. "haharabic",
  31843. 0x062d,
  31844. "hahfinalarabic",
  31845. 0xfea2,
  31846. "hahinitialarabic",
  31847. 0xfea3,
  31848. "hahiragana",
  31849. 0x306f,
  31850. "hahmedialarabic",
  31851. 0xfea4,
  31852. "haitusquare",
  31853. 0x332a,
  31854. "hakatakana",
  31855. 0x30cf,
  31856. "hakatakanahalfwidth",
  31857. 0xff8a,
  31858. "halantgurmukhi",
  31859. 0x0a4d,
  31860. "hamzaarabic",
  31861. 0x0621,
  31862. "hamzalowarabic",
  31863. 0x0621,
  31864. "hangulfiller",
  31865. 0x3164,
  31866. "hardsigncyrillic",
  31867. 0x044a,
  31868. "harpoonleftbarbup",
  31869. 0x21bc,
  31870. "harpoonrightbarbup",
  31871. 0x21c0,
  31872. "hasquare",
  31873. 0x33ca,
  31874. "hatafpatah",
  31875. 0x05b2,
  31876. "hatafpatah16",
  31877. 0x05b2,
  31878. "hatafpatah23",
  31879. 0x05b2,
  31880. "hatafpatah2f",
  31881. 0x05b2,
  31882. "hatafpatahhebrew",
  31883. 0x05b2,
  31884. "hatafpatahnarrowhebrew",
  31885. 0x05b2,
  31886. "hatafpatahquarterhebrew",
  31887. 0x05b2,
  31888. "hatafpatahwidehebrew",
  31889. 0x05b2,
  31890. "hatafqamats",
  31891. 0x05b3,
  31892. "hatafqamats1b",
  31893. 0x05b3,
  31894. "hatafqamats28",
  31895. 0x05b3,
  31896. "hatafqamats34",
  31897. 0x05b3,
  31898. "hatafqamatshebrew",
  31899. 0x05b3,
  31900. "hatafqamatsnarrowhebrew",
  31901. 0x05b3,
  31902. "hatafqamatsquarterhebrew",
  31903. 0x05b3,
  31904. "hatafqamatswidehebrew",
  31905. 0x05b3,
  31906. "hatafsegol",
  31907. 0x05b1,
  31908. "hatafsegol17",
  31909. 0x05b1,
  31910. "hatafsegol24",
  31911. 0x05b1,
  31912. "hatafsegol30",
  31913. 0x05b1,
  31914. "hatafsegolhebrew",
  31915. 0x05b1,
  31916. "hatafsegolnarrowhebrew",
  31917. 0x05b1,
  31918. "hatafsegolquarterhebrew",
  31919. 0x05b1,
  31920. "hatafsegolwidehebrew",
  31921. 0x05b1,
  31922. "hbar",
  31923. 0x0127,
  31924. "hbopomofo",
  31925. 0x310f,
  31926. "hbrevebelow",
  31927. 0x1e2b,
  31928. "hcedilla",
  31929. 0x1e29,
  31930. "hcircle",
  31931. 0x24d7,
  31932. "hcircumflex",
  31933. 0x0125,
  31934. "hdieresis",
  31935. 0x1e27,
  31936. "hdotaccent",
  31937. 0x1e23,
  31938. "hdotbelow",
  31939. 0x1e25,
  31940. "he",
  31941. 0x05d4,
  31942. "heart",
  31943. 0x2665,
  31944. "heartsuitblack",
  31945. 0x2665,
  31946. "heartsuitwhite",
  31947. 0x2661,
  31948. "hedagesh",
  31949. 0xfb34,
  31950. "hedageshhebrew",
  31951. 0xfb34,
  31952. "hehaltonearabic",
  31953. 0x06c1,
  31954. "heharabic",
  31955. 0x0647,
  31956. "hehebrew",
  31957. 0x05d4,
  31958. "hehfinalaltonearabic",
  31959. 0xfba7,
  31960. "hehfinalalttwoarabic",
  31961. 0xfeea,
  31962. "hehfinalarabic",
  31963. 0xfeea,
  31964. "hehhamzaabovefinalarabic",
  31965. 0xfba5,
  31966. "hehhamzaaboveisolatedarabic",
  31967. 0xfba4,
  31968. "hehinitialaltonearabic",
  31969. 0xfba8,
  31970. "hehinitialarabic",
  31971. 0xfeeb,
  31972. "hehiragana",
  31973. 0x3078,
  31974. "hehmedialaltonearabic",
  31975. 0xfba9,
  31976. "hehmedialarabic",
  31977. 0xfeec,
  31978. "heiseierasquare",
  31979. 0x337b,
  31980. "hekatakana",
  31981. 0x30d8,
  31982. "hekatakanahalfwidth",
  31983. 0xff8d,
  31984. "hekutaarusquare",
  31985. 0x3336,
  31986. "henghook",
  31987. 0x0267,
  31988. "herutusquare",
  31989. 0x3339,
  31990. "het",
  31991. 0x05d7,
  31992. "hethebrew",
  31993. 0x05d7,
  31994. "hhook",
  31995. 0x0266,
  31996. "hhooksuperior",
  31997. 0x02b1,
  31998. "hieuhacirclekorean",
  31999. 0x327b,
  32000. "hieuhaparenkorean",
  32001. 0x321b,
  32002. "hieuhcirclekorean",
  32003. 0x326d,
  32004. "hieuhkorean",
  32005. 0x314e,
  32006. "hieuhparenkorean",
  32007. 0x320d,
  32008. "hihiragana",
  32009. 0x3072,
  32010. "hikatakana",
  32011. 0x30d2,
  32012. "hikatakanahalfwidth",
  32013. 0xff8b,
  32014. "hiriq",
  32015. 0x05b4,
  32016. "hiriq14",
  32017. 0x05b4,
  32018. "hiriq21",
  32019. 0x05b4,
  32020. "hiriq2d",
  32021. 0x05b4,
  32022. "hiriqhebrew",
  32023. 0x05b4,
  32024. "hiriqnarrowhebrew",
  32025. 0x05b4,
  32026. "hiriqquarterhebrew",
  32027. 0x05b4,
  32028. "hiriqwidehebrew",
  32029. 0x05b4,
  32030. "hlinebelow",
  32031. 0x1e96,
  32032. "hmonospace",
  32033. 0xff48,
  32034. "hoarmenian",
  32035. 0x0570,
  32036. "hohipthai",
  32037. 0x0e2b,
  32038. "hohiragana",
  32039. 0x307b,
  32040. "hokatakana",
  32041. 0x30db,
  32042. "hokatakanahalfwidth",
  32043. 0xff8e,
  32044. "holam",
  32045. 0x05b9,
  32046. "holam19",
  32047. 0x05b9,
  32048. "holam26",
  32049. 0x05b9,
  32050. "holam32",
  32051. 0x05b9,
  32052. "holamhebrew",
  32053. 0x05b9,
  32054. "holamnarrowhebrew",
  32055. 0x05b9,
  32056. "holamquarterhebrew",
  32057. 0x05b9,
  32058. "holamwidehebrew",
  32059. 0x05b9,
  32060. "honokhukthai",
  32061. 0x0e2e,
  32062. "hookabovecomb",
  32063. 0x0309,
  32064. "hookcmb",
  32065. 0x0309,
  32066. "hookpalatalizedbelowcmb",
  32067. 0x0321,
  32068. "hookretroflexbelowcmb",
  32069. 0x0322,
  32070. "hoonsquare",
  32071. 0x3342,
  32072. "horicoptic",
  32073. 0x03e9,
  32074. "horizontalbar",
  32075. 0x2015,
  32076. "horncmb",
  32077. 0x031b,
  32078. "hotsprings",
  32079. 0x2668,
  32080. "house",
  32081. 0x2302,
  32082. "hparen",
  32083. 0x24a3,
  32084. "hsuperior",
  32085. 0x02b0,
  32086. "hturned",
  32087. 0x0265,
  32088. "huhiragana",
  32089. 0x3075,
  32090. "huiitosquare",
  32091. 0x3333,
  32092. "hukatakana",
  32093. 0x30d5,
  32094. "hukatakanahalfwidth",
  32095. 0xff8c,
  32096. "hungarumlaut",
  32097. 0x02dd,
  32098. "hungarumlautcmb",
  32099. 0x030b,
  32100. "hv",
  32101. 0x0195,
  32102. "hyphen",
  32103. 0x002d,
  32104. "hypheninferior",
  32105. 0xf6e5,
  32106. "hyphenmonospace",
  32107. 0xff0d,
  32108. "hyphensmall",
  32109. 0xfe63,
  32110. "hyphensuperior",
  32111. 0xf6e6,
  32112. "hyphentwo",
  32113. 0x2010,
  32114. "i",
  32115. 0x0069,
  32116. "iacute",
  32117. 0x00ed,
  32118. "iacyrillic",
  32119. 0x044f,
  32120. "ibengali",
  32121. 0x0987,
  32122. "ibopomofo",
  32123. 0x3127,
  32124. "ibreve",
  32125. 0x012d,
  32126. "icaron",
  32127. 0x01d0,
  32128. "icircle",
  32129. 0x24d8,
  32130. "icircumflex",
  32131. 0x00ee,
  32132. "icyrillic",
  32133. 0x0456,
  32134. "idblgrave",
  32135. 0x0209,
  32136. "ideographearthcircle",
  32137. 0x328f,
  32138. "ideographfirecircle",
  32139. 0x328b,
  32140. "ideographicallianceparen",
  32141. 0x323f,
  32142. "ideographiccallparen",
  32143. 0x323a,
  32144. "ideographiccentrecircle",
  32145. 0x32a5,
  32146. "ideographicclose",
  32147. 0x3006,
  32148. "ideographiccomma",
  32149. 0x3001,
  32150. "ideographiccommaleft",
  32151. 0xff64,
  32152. "ideographiccongratulationparen",
  32153. 0x3237,
  32154. "ideographiccorrectcircle",
  32155. 0x32a3,
  32156. "ideographicearthparen",
  32157. 0x322f,
  32158. "ideographicenterpriseparen",
  32159. 0x323d,
  32160. "ideographicexcellentcircle",
  32161. 0x329d,
  32162. "ideographicfestivalparen",
  32163. 0x3240,
  32164. "ideographicfinancialcircle",
  32165. 0x3296,
  32166. "ideographicfinancialparen",
  32167. 0x3236,
  32168. "ideographicfireparen",
  32169. 0x322b,
  32170. "ideographichaveparen",
  32171. 0x3232,
  32172. "ideographichighcircle",
  32173. 0x32a4,
  32174. "ideographiciterationmark",
  32175. 0x3005,
  32176. "ideographiclaborcircle",
  32177. 0x3298,
  32178. "ideographiclaborparen",
  32179. 0x3238,
  32180. "ideographicleftcircle",
  32181. 0x32a7,
  32182. "ideographiclowcircle",
  32183. 0x32a6,
  32184. "ideographicmedicinecircle",
  32185. 0x32a9,
  32186. "ideographicmetalparen",
  32187. 0x322e,
  32188. "ideographicmoonparen",
  32189. 0x322a,
  32190. "ideographicnameparen",
  32191. 0x3234,
  32192. "ideographicperiod",
  32193. 0x3002,
  32194. "ideographicprintcircle",
  32195. 0x329e,
  32196. "ideographicreachparen",
  32197. 0x3243,
  32198. "ideographicrepresentparen",
  32199. 0x3239,
  32200. "ideographicresourceparen",
  32201. 0x323e,
  32202. "ideographicrightcircle",
  32203. 0x32a8,
  32204. "ideographicsecretcircle",
  32205. 0x3299,
  32206. "ideographicselfparen",
  32207. 0x3242,
  32208. "ideographicsocietyparen",
  32209. 0x3233,
  32210. "ideographicspace",
  32211. 0x3000,
  32212. "ideographicspecialparen",
  32213. 0x3235,
  32214. "ideographicstockparen",
  32215. 0x3231,
  32216. "ideographicstudyparen",
  32217. 0x323b,
  32218. "ideographicsunparen",
  32219. 0x3230,
  32220. "ideographicsuperviseparen",
  32221. 0x323c,
  32222. "ideographicwaterparen",
  32223. 0x322c,
  32224. "ideographicwoodparen",
  32225. 0x322d,
  32226. "ideographiczero",
  32227. 0x3007,
  32228. "ideographmetalcircle",
  32229. 0x328e,
  32230. "ideographmooncircle",
  32231. 0x328a,
  32232. "ideographnamecircle",
  32233. 0x3294,
  32234. "ideographsuncircle",
  32235. 0x3290,
  32236. "ideographwatercircle",
  32237. 0x328c,
  32238. "ideographwoodcircle",
  32239. 0x328d,
  32240. "ideva",
  32241. 0x0907,
  32242. "idieresis",
  32243. 0x00ef,
  32244. "idieresisacute",
  32245. 0x1e2f,
  32246. "idieresiscyrillic",
  32247. 0x04e5,
  32248. "idotbelow",
  32249. 0x1ecb,
  32250. "iebrevecyrillic",
  32251. 0x04d7,
  32252. "iecyrillic",
  32253. 0x0435,
  32254. "ieungacirclekorean",
  32255. 0x3275,
  32256. "ieungaparenkorean",
  32257. 0x3215,
  32258. "ieungcirclekorean",
  32259. 0x3267,
  32260. "ieungkorean",
  32261. 0x3147,
  32262. "ieungparenkorean",
  32263. 0x3207,
  32264. "igrave",
  32265. 0x00ec,
  32266. "igujarati",
  32267. 0x0a87,
  32268. "igurmukhi",
  32269. 0x0a07,
  32270. "ihiragana",
  32271. 0x3044,
  32272. "ihookabove",
  32273. 0x1ec9,
  32274. "iibengali",
  32275. 0x0988,
  32276. "iicyrillic",
  32277. 0x0438,
  32278. "iideva",
  32279. 0x0908,
  32280. "iigujarati",
  32281. 0x0a88,
  32282. "iigurmukhi",
  32283. 0x0a08,
  32284. "iimatragurmukhi",
  32285. 0x0a40,
  32286. "iinvertedbreve",
  32287. 0x020b,
  32288. "iishortcyrillic",
  32289. 0x0439,
  32290. "iivowelsignbengali",
  32291. 0x09c0,
  32292. "iivowelsigndeva",
  32293. 0x0940,
  32294. "iivowelsigngujarati",
  32295. 0x0ac0,
  32296. "ij",
  32297. 0x0133,
  32298. "ikatakana",
  32299. 0x30a4,
  32300. "ikatakanahalfwidth",
  32301. 0xff72,
  32302. "ikorean",
  32303. 0x3163,
  32304. "ilde",
  32305. 0x02dc,
  32306. "iluyhebrew",
  32307. 0x05ac,
  32308. "imacron",
  32309. 0x012b,
  32310. "imacroncyrillic",
  32311. 0x04e3,
  32312. "imageorapproximatelyequal",
  32313. 0x2253,
  32314. "imatragurmukhi",
  32315. 0x0a3f,
  32316. "imonospace",
  32317. 0xff49,
  32318. "increment",
  32319. 0x2206,
  32320. "infinity",
  32321. 0x221e,
  32322. "iniarmenian",
  32323. 0x056b,
  32324. "integral",
  32325. 0x222b,
  32326. "integralbottom",
  32327. 0x2321,
  32328. "integralbt",
  32329. 0x2321,
  32330. "integralex",
  32331. 0xf8f5,
  32332. "integraltop",
  32333. 0x2320,
  32334. "integraltp",
  32335. 0x2320,
  32336. "intersection",
  32337. 0x2229,
  32338. "intisquare",
  32339. 0x3305,
  32340. "invbullet",
  32341. 0x25d8,
  32342. "invcircle",
  32343. 0x25d9,
  32344. "invsmileface",
  32345. 0x263b,
  32346. "iocyrillic",
  32347. 0x0451,
  32348. "iogonek",
  32349. 0x012f,
  32350. "iota",
  32351. 0x03b9,
  32352. "iotadieresis",
  32353. 0x03ca,
  32354. "iotadieresistonos",
  32355. 0x0390,
  32356. "iotalatin",
  32357. 0x0269,
  32358. "iotatonos",
  32359. 0x03af,
  32360. "iparen",
  32361. 0x24a4,
  32362. "irigurmukhi",
  32363. 0x0a72,
  32364. "ismallhiragana",
  32365. 0x3043,
  32366. "ismallkatakana",
  32367. 0x30a3,
  32368. "ismallkatakanahalfwidth",
  32369. 0xff68,
  32370. "issharbengali",
  32371. 0x09fa,
  32372. "istroke",
  32373. 0x0268,
  32374. "isuperior",
  32375. 0xf6ed,
  32376. "iterationhiragana",
  32377. 0x309d,
  32378. "iterationkatakana",
  32379. 0x30fd,
  32380. "itilde",
  32381. 0x0129,
  32382. "itildebelow",
  32383. 0x1e2d,
  32384. "iubopomofo",
  32385. 0x3129,
  32386. "iucyrillic",
  32387. 0x044e,
  32388. "ivowelsignbengali",
  32389. 0x09bf,
  32390. "ivowelsigndeva",
  32391. 0x093f,
  32392. "ivowelsigngujarati",
  32393. 0x0abf,
  32394. "izhitsacyrillic",
  32395. 0x0475,
  32396. "izhitsadblgravecyrillic",
  32397. 0x0477,
  32398. "j",
  32399. 0x006a,
  32400. "jaarmenian",
  32401. 0x0571,
  32402. "jabengali",
  32403. 0x099c,
  32404. "jadeva",
  32405. 0x091c,
  32406. "jagujarati",
  32407. 0x0a9c,
  32408. "jagurmukhi",
  32409. 0x0a1c,
  32410. "jbopomofo",
  32411. 0x3110,
  32412. "jcaron",
  32413. 0x01f0,
  32414. "jcircle",
  32415. 0x24d9,
  32416. "jcircumflex",
  32417. 0x0135,
  32418. "jcrossedtail",
  32419. 0x029d,
  32420. "jdotlessstroke",
  32421. 0x025f,
  32422. "jecyrillic",
  32423. 0x0458,
  32424. "jeemarabic",
  32425. 0x062c,
  32426. "jeemfinalarabic",
  32427. 0xfe9e,
  32428. "jeeminitialarabic",
  32429. 0xfe9f,
  32430. "jeemmedialarabic",
  32431. 0xfea0,
  32432. "jeharabic",
  32433. 0x0698,
  32434. "jehfinalarabic",
  32435. 0xfb8b,
  32436. "jhabengali",
  32437. 0x099d,
  32438. "jhadeva",
  32439. 0x091d,
  32440. "jhagujarati",
  32441. 0x0a9d,
  32442. "jhagurmukhi",
  32443. 0x0a1d,
  32444. "jheharmenian",
  32445. 0x057b,
  32446. "jis",
  32447. 0x3004,
  32448. "jmonospace",
  32449. 0xff4a,
  32450. "jparen",
  32451. 0x24a5,
  32452. "jsuperior",
  32453. 0x02b2,
  32454. "k",
  32455. 0x006b,
  32456. "kabashkircyrillic",
  32457. 0x04a1,
  32458. "kabengali",
  32459. 0x0995,
  32460. "kacute",
  32461. 0x1e31,
  32462. "kacyrillic",
  32463. 0x043a,
  32464. "kadescendercyrillic",
  32465. 0x049b,
  32466. "kadeva",
  32467. 0x0915,
  32468. "kaf",
  32469. 0x05db,
  32470. "kafarabic",
  32471. 0x0643,
  32472. "kafdagesh",
  32473. 0xfb3b,
  32474. "kafdageshhebrew",
  32475. 0xfb3b,
  32476. "kaffinalarabic",
  32477. 0xfeda,
  32478. "kafhebrew",
  32479. 0x05db,
  32480. "kafinitialarabic",
  32481. 0xfedb,
  32482. "kafmedialarabic",
  32483. 0xfedc,
  32484. "kafrafehebrew",
  32485. 0xfb4d,
  32486. "kagujarati",
  32487. 0x0a95,
  32488. "kagurmukhi",
  32489. 0x0a15,
  32490. "kahiragana",
  32491. 0x304b,
  32492. "kahookcyrillic",
  32493. 0x04c4,
  32494. "kakatakana",
  32495. 0x30ab,
  32496. "kakatakanahalfwidth",
  32497. 0xff76,
  32498. "kappa",
  32499. 0x03ba,
  32500. "kappasymbolgreek",
  32501. 0x03f0,
  32502. "kapyeounmieumkorean",
  32503. 0x3171,
  32504. "kapyeounphieuphkorean",
  32505. 0x3184,
  32506. "kapyeounpieupkorean",
  32507. 0x3178,
  32508. "kapyeounssangpieupkorean",
  32509. 0x3179,
  32510. "karoriisquare",
  32511. 0x330d,
  32512. "kashidaautoarabic",
  32513. 0x0640,
  32514. "kashidaautonosidebearingarabic",
  32515. 0x0640,
  32516. "kasmallkatakana",
  32517. 0x30f5,
  32518. "kasquare",
  32519. 0x3384,
  32520. "kasraarabic",
  32521. 0x0650,
  32522. "kasratanarabic",
  32523. 0x064d,
  32524. "kastrokecyrillic",
  32525. 0x049f,
  32526. "katahiraprolongmarkhalfwidth",
  32527. 0xff70,
  32528. "kaverticalstrokecyrillic",
  32529. 0x049d,
  32530. "kbopomofo",
  32531. 0x310e,
  32532. "kcalsquare",
  32533. 0x3389,
  32534. "kcaron",
  32535. 0x01e9,
  32536. "kcedilla",
  32537. 0x0137,
  32538. "kcircle",
  32539. 0x24da,
  32540. "kcommaaccent",
  32541. 0x0137,
  32542. "kdotbelow",
  32543. 0x1e33,
  32544. "keharmenian",
  32545. 0x0584,
  32546. "kehiragana",
  32547. 0x3051,
  32548. "kekatakana",
  32549. 0x30b1,
  32550. "kekatakanahalfwidth",
  32551. 0xff79,
  32552. "kenarmenian",
  32553. 0x056f,
  32554. "kesmallkatakana",
  32555. 0x30f6,
  32556. "kgreenlandic",
  32557. 0x0138,
  32558. "khabengali",
  32559. 0x0996,
  32560. "khacyrillic",
  32561. 0x0445,
  32562. "khadeva",
  32563. 0x0916,
  32564. "khagujarati",
  32565. 0x0a96,
  32566. "khagurmukhi",
  32567. 0x0a16,
  32568. "khaharabic",
  32569. 0x062e,
  32570. "khahfinalarabic",
  32571. 0xfea6,
  32572. "khahinitialarabic",
  32573. 0xfea7,
  32574. "khahmedialarabic",
  32575. 0xfea8,
  32576. "kheicoptic",
  32577. 0x03e7,
  32578. "khhadeva",
  32579. 0x0959,
  32580. "khhagurmukhi",
  32581. 0x0a59,
  32582. "khieukhacirclekorean",
  32583. 0x3278,
  32584. "khieukhaparenkorean",
  32585. 0x3218,
  32586. "khieukhcirclekorean",
  32587. 0x326a,
  32588. "khieukhkorean",
  32589. 0x314b,
  32590. "khieukhparenkorean",
  32591. 0x320a,
  32592. "khokhaithai",
  32593. 0x0e02,
  32594. "khokhonthai",
  32595. 0x0e05,
  32596. "khokhuatthai",
  32597. 0x0e03,
  32598. "khokhwaithai",
  32599. 0x0e04,
  32600. "khomutthai",
  32601. 0x0e5b,
  32602. "khook",
  32603. 0x0199,
  32604. "khorakhangthai",
  32605. 0x0e06,
  32606. "khzsquare",
  32607. 0x3391,
  32608. "kihiragana",
  32609. 0x304d,
  32610. "kikatakana",
  32611. 0x30ad,
  32612. "kikatakanahalfwidth",
  32613. 0xff77,
  32614. "kiroguramusquare",
  32615. 0x3315,
  32616. "kiromeetorusquare",
  32617. 0x3316,
  32618. "kirosquare",
  32619. 0x3314,
  32620. "kiyeokacirclekorean",
  32621. 0x326e,
  32622. "kiyeokaparenkorean",
  32623. 0x320e,
  32624. "kiyeokcirclekorean",
  32625. 0x3260,
  32626. "kiyeokkorean",
  32627. 0x3131,
  32628. "kiyeokparenkorean",
  32629. 0x3200,
  32630. "kiyeoksioskorean",
  32631. 0x3133,
  32632. "kjecyrillic",
  32633. 0x045c,
  32634. "klinebelow",
  32635. 0x1e35,
  32636. "klsquare",
  32637. 0x3398,
  32638. "kmcubedsquare",
  32639. 0x33a6,
  32640. "kmonospace",
  32641. 0xff4b,
  32642. "kmsquaredsquare",
  32643. 0x33a2,
  32644. "kohiragana",
  32645. 0x3053,
  32646. "kohmsquare",
  32647. 0x33c0,
  32648. "kokaithai",
  32649. 0x0e01,
  32650. "kokatakana",
  32651. 0x30b3,
  32652. "kokatakanahalfwidth",
  32653. 0xff7a,
  32654. "kooposquare",
  32655. 0x331e,
  32656. "koppacyrillic",
  32657. 0x0481,
  32658. "koreanstandardsymbol",
  32659. 0x327f,
  32660. "koroniscmb",
  32661. 0x0343,
  32662. "kparen",
  32663. 0x24a6,
  32664. "kpasquare",
  32665. 0x33aa,
  32666. "ksicyrillic",
  32667. 0x046f,
  32668. "ktsquare",
  32669. 0x33cf,
  32670. "kturned",
  32671. 0x029e,
  32672. "kuhiragana",
  32673. 0x304f,
  32674. "kukatakana",
  32675. 0x30af,
  32676. "kukatakanahalfwidth",
  32677. 0xff78,
  32678. "kvsquare",
  32679. 0x33b8,
  32680. "kwsquare",
  32681. 0x33be,
  32682. "l",
  32683. 0x006c,
  32684. "labengali",
  32685. 0x09b2,
  32686. "lacute",
  32687. 0x013a,
  32688. "ladeva",
  32689. 0x0932,
  32690. "lagujarati",
  32691. 0x0ab2,
  32692. "lagurmukhi",
  32693. 0x0a32,
  32694. "lakkhangyaothai",
  32695. 0x0e45,
  32696. "lamaleffinalarabic",
  32697. 0xfefc,
  32698. "lamalefhamzaabovefinalarabic",
  32699. 0xfef8,
  32700. "lamalefhamzaaboveisolatedarabic",
  32701. 0xfef7,
  32702. "lamalefhamzabelowfinalarabic",
  32703. 0xfefa,
  32704. "lamalefhamzabelowisolatedarabic",
  32705. 0xfef9,
  32706. "lamalefisolatedarabic",
  32707. 0xfefb,
  32708. "lamalefmaddaabovefinalarabic",
  32709. 0xfef6,
  32710. "lamalefmaddaaboveisolatedarabic",
  32711. 0xfef5,
  32712. "lamarabic",
  32713. 0x0644,
  32714. "lambda",
  32715. 0x03bb,
  32716. "lambdastroke",
  32717. 0x019b,
  32718. "lamed",
  32719. 0x05dc,
  32720. "lameddagesh",
  32721. 0xfb3c,
  32722. "lameddageshhebrew",
  32723. 0xfb3c,
  32724. "lamedhebrew",
  32725. 0x05dc,
  32726. "lamfinalarabic",
  32727. 0xfede,
  32728. "lamhahinitialarabic",
  32729. 0xfcca,
  32730. "laminitialarabic",
  32731. 0xfedf,
  32732. "lamjeeminitialarabic",
  32733. 0xfcc9,
  32734. "lamkhahinitialarabic",
  32735. 0xfccb,
  32736. "lamlamhehisolatedarabic",
  32737. 0xfdf2,
  32738. "lammedialarabic",
  32739. 0xfee0,
  32740. "lammeemhahinitialarabic",
  32741. 0xfd88,
  32742. "lammeeminitialarabic",
  32743. 0xfccc,
  32744. "largecircle",
  32745. 0x25ef,
  32746. "lbar",
  32747. 0x019a,
  32748. "lbelt",
  32749. 0x026c,
  32750. "lbopomofo",
  32751. 0x310c,
  32752. "lcaron",
  32753. 0x013e,
  32754. "lcedilla",
  32755. 0x013c,
  32756. "lcircle",
  32757. 0x24db,
  32758. "lcircumflexbelow",
  32759. 0x1e3d,
  32760. "lcommaaccent",
  32761. 0x013c,
  32762. "ldot",
  32763. 0x0140,
  32764. "ldotaccent",
  32765. 0x0140,
  32766. "ldotbelow",
  32767. 0x1e37,
  32768. "ldotbelowmacron",
  32769. 0x1e39,
  32770. "leftangleabovecmb",
  32771. 0x031a,
  32772. "lefttackbelowcmb",
  32773. 0x0318,
  32774. "less",
  32775. 0x003c,
  32776. "lessequal",
  32777. 0x2264,
  32778. "lessequalorgreater",
  32779. 0x22da,
  32780. "lessmonospace",
  32781. 0xff1c,
  32782. "lessorequivalent",
  32783. 0x2272,
  32784. "lessorgreater",
  32785. 0x2276,
  32786. "lessoverequal",
  32787. 0x2266,
  32788. "lesssmall",
  32789. 0xfe64,
  32790. "lezh",
  32791. 0x026e,
  32792. "lfblock",
  32793. 0x258c,
  32794. "lhookretroflex",
  32795. 0x026d,
  32796. "lira",
  32797. 0x20a4,
  32798. "liwnarmenian",
  32799. 0x056c,
  32800. "lj",
  32801. 0x01c9,
  32802. "ljecyrillic",
  32803. 0x0459,
  32804. "ll",
  32805. 0xf6c0,
  32806. "lladeva",
  32807. 0x0933,
  32808. "llagujarati",
  32809. 0x0ab3,
  32810. "llinebelow",
  32811. 0x1e3b,
  32812. "llladeva",
  32813. 0x0934,
  32814. "llvocalicbengali",
  32815. 0x09e1,
  32816. "llvocalicdeva",
  32817. 0x0961,
  32818. "llvocalicvowelsignbengali",
  32819. 0x09e3,
  32820. "llvocalicvowelsigndeva",
  32821. 0x0963,
  32822. "lmiddletilde",
  32823. 0x026b,
  32824. "lmonospace",
  32825. 0xff4c,
  32826. "lmsquare",
  32827. 0x33d0,
  32828. "lochulathai",
  32829. 0x0e2c,
  32830. "logicaland",
  32831. 0x2227,
  32832. "logicalnot",
  32833. 0x00ac,
  32834. "logicalnotreversed",
  32835. 0x2310,
  32836. "logicalor",
  32837. 0x2228,
  32838. "lolingthai",
  32839. 0x0e25,
  32840. "longs",
  32841. 0x017f,
  32842. "lowlinecenterline",
  32843. 0xfe4e,
  32844. "lowlinecmb",
  32845. 0x0332,
  32846. "lowlinedashed",
  32847. 0xfe4d,
  32848. "lozenge",
  32849. 0x25ca,
  32850. "lparen",
  32851. 0x24a7,
  32852. "lslash",
  32853. 0x0142,
  32854. "lsquare",
  32855. 0x2113,
  32856. "lsuperior",
  32857. 0xf6ee,
  32858. "ltshade",
  32859. 0x2591,
  32860. "luthai",
  32861. 0x0e26,
  32862. "lvocalicbengali",
  32863. 0x098c,
  32864. "lvocalicdeva",
  32865. 0x090c,
  32866. "lvocalicvowelsignbengali",
  32867. 0x09e2,
  32868. "lvocalicvowelsigndeva",
  32869. 0x0962,
  32870. "lxsquare",
  32871. 0x33d3,
  32872. "m",
  32873. 0x006d,
  32874. "mabengali",
  32875. 0x09ae,
  32876. "macron",
  32877. 0x00af,
  32878. "macronbelowcmb",
  32879. 0x0331,
  32880. "macroncmb",
  32881. 0x0304,
  32882. "macronlowmod",
  32883. 0x02cd,
  32884. "macronmonospace",
  32885. 0xffe3,
  32886. "macute",
  32887. 0x1e3f,
  32888. "madeva",
  32889. 0x092e,
  32890. "magujarati",
  32891. 0x0aae,
  32892. "magurmukhi",
  32893. 0x0a2e,
  32894. "mahapakhhebrew",
  32895. 0x05a4,
  32896. "mahapakhlefthebrew",
  32897. 0x05a4,
  32898. "mahiragana",
  32899. 0x307e,
  32900. "maichattawalowleftthai",
  32901. 0xf895,
  32902. "maichattawalowrightthai",
  32903. 0xf894,
  32904. "maichattawathai",
  32905. 0x0e4b,
  32906. "maichattawaupperleftthai",
  32907. 0xf893,
  32908. "maieklowleftthai",
  32909. 0xf88c,
  32910. "maieklowrightthai",
  32911. 0xf88b,
  32912. "maiekthai",
  32913. 0x0e48,
  32914. "maiekupperleftthai",
  32915. 0xf88a,
  32916. "maihanakatleftthai",
  32917. 0xf884,
  32918. "maihanakatthai",
  32919. 0x0e31,
  32920. "maitaikhuleftthai",
  32921. 0xf889,
  32922. "maitaikhuthai",
  32923. 0x0e47,
  32924. "maitholowleftthai",
  32925. 0xf88f,
  32926. "maitholowrightthai",
  32927. 0xf88e,
  32928. "maithothai",
  32929. 0x0e49,
  32930. "maithoupperleftthai",
  32931. 0xf88d,
  32932. "maitrilowleftthai",
  32933. 0xf892,
  32934. "maitrilowrightthai",
  32935. 0xf891,
  32936. "maitrithai",
  32937. 0x0e4a,
  32938. "maitriupperleftthai",
  32939. 0xf890,
  32940. "maiyamokthai",
  32941. 0x0e46,
  32942. "makatakana",
  32943. 0x30de,
  32944. "makatakanahalfwidth",
  32945. 0xff8f,
  32946. "male",
  32947. 0x2642,
  32948. "mansyonsquare",
  32949. 0x3347,
  32950. "maqafhebrew",
  32951. 0x05be,
  32952. "mars",
  32953. 0x2642,
  32954. "masoracirclehebrew",
  32955. 0x05af,
  32956. "masquare",
  32957. 0x3383,
  32958. "mbopomofo",
  32959. 0x3107,
  32960. "mbsquare",
  32961. 0x33d4,
  32962. "mcircle",
  32963. 0x24dc,
  32964. "mcubedsquare",
  32965. 0x33a5,
  32966. "mdotaccent",
  32967. 0x1e41,
  32968. "mdotbelow",
  32969. 0x1e43,
  32970. "meemarabic",
  32971. 0x0645,
  32972. "meemfinalarabic",
  32973. 0xfee2,
  32974. "meeminitialarabic",
  32975. 0xfee3,
  32976. "meemmedialarabic",
  32977. 0xfee4,
  32978. "meemmeeminitialarabic",
  32979. 0xfcd1,
  32980. "meemmeemisolatedarabic",
  32981. 0xfc48,
  32982. "meetorusquare",
  32983. 0x334d,
  32984. "mehiragana",
  32985. 0x3081,
  32986. "meizierasquare",
  32987. 0x337e,
  32988. "mekatakana",
  32989. 0x30e1,
  32990. "mekatakanahalfwidth",
  32991. 0xff92,
  32992. "mem",
  32993. 0x05de,
  32994. "memdagesh",
  32995. 0xfb3e,
  32996. "memdageshhebrew",
  32997. 0xfb3e,
  32998. "memhebrew",
  32999. 0x05de,
  33000. "menarmenian",
  33001. 0x0574,
  33002. "merkhahebrew",
  33003. 0x05a5,
  33004. "merkhakefulahebrew",
  33005. 0x05a6,
  33006. "merkhakefulalefthebrew",
  33007. 0x05a6,
  33008. "merkhalefthebrew",
  33009. 0x05a5,
  33010. "mhook",
  33011. 0x0271,
  33012. "mhzsquare",
  33013. 0x3392,
  33014. "middledotkatakanahalfwidth",
  33015. 0xff65,
  33016. "middot",
  33017. 0x00b7,
  33018. "mieumacirclekorean",
  33019. 0x3272,
  33020. "mieumaparenkorean",
  33021. 0x3212,
  33022. "mieumcirclekorean",
  33023. 0x3264,
  33024. "mieumkorean",
  33025. 0x3141,
  33026. "mieumpansioskorean",
  33027. 0x3170,
  33028. "mieumparenkorean",
  33029. 0x3204,
  33030. "mieumpieupkorean",
  33031. 0x316e,
  33032. "mieumsioskorean",
  33033. 0x316f,
  33034. "mihiragana",
  33035. 0x307f,
  33036. "mikatakana",
  33037. 0x30df,
  33038. "mikatakanahalfwidth",
  33039. 0xff90,
  33040. "minus",
  33041. 0x2212,
  33042. "minusbelowcmb",
  33043. 0x0320,
  33044. "minuscircle",
  33045. 0x2296,
  33046. "minusmod",
  33047. 0x02d7,
  33048. "minusplus",
  33049. 0x2213,
  33050. "minute",
  33051. 0x2032,
  33052. "miribaarusquare",
  33053. 0x334a,
  33054. "mirisquare",
  33055. 0x3349,
  33056. "mlonglegturned",
  33057. 0x0270,
  33058. "mlsquare",
  33059. 0x3396,
  33060. "mmcubedsquare",
  33061. 0x33a3,
  33062. "mmonospace",
  33063. 0xff4d,
  33064. "mmsquaredsquare",
  33065. 0x339f,
  33066. "mohiragana",
  33067. 0x3082,
  33068. "mohmsquare",
  33069. 0x33c1,
  33070. "mokatakana",
  33071. 0x30e2,
  33072. "mokatakanahalfwidth",
  33073. 0xff93,
  33074. "molsquare",
  33075. 0x33d6,
  33076. "momathai",
  33077. 0x0e21,
  33078. "moverssquare",
  33079. 0x33a7,
  33080. "moverssquaredsquare",
  33081. 0x33a8,
  33082. "mparen",
  33083. 0x24a8,
  33084. "mpasquare",
  33085. 0x33ab,
  33086. "mssquare",
  33087. 0x33b3,
  33088. "msuperior",
  33089. 0xf6ef,
  33090. "mturned",
  33091. 0x026f,
  33092. "mu",
  33093. 0x00b5,
  33094. "mu1",
  33095. 0x00b5,
  33096. "muasquare",
  33097. 0x3382,
  33098. "muchgreater",
  33099. 0x226b,
  33100. "muchless",
  33101. 0x226a,
  33102. "mufsquare",
  33103. 0x338c,
  33104. "mugreek",
  33105. 0x03bc,
  33106. "mugsquare",
  33107. 0x338d,
  33108. "muhiragana",
  33109. 0x3080,
  33110. "mukatakana",
  33111. 0x30e0,
  33112. "mukatakanahalfwidth",
  33113. 0xff91,
  33114. "mulsquare",
  33115. 0x3395,
  33116. "multiply",
  33117. 0x00d7,
  33118. "mumsquare",
  33119. 0x339b,
  33120. "munahhebrew",
  33121. 0x05a3,
  33122. "munahlefthebrew",
  33123. 0x05a3,
  33124. "musicalnote",
  33125. 0x266a,
  33126. "musicalnotedbl",
  33127. 0x266b,
  33128. "musicflatsign",
  33129. 0x266d,
  33130. "musicsharpsign",
  33131. 0x266f,
  33132. "mussquare",
  33133. 0x33b2,
  33134. "muvsquare",
  33135. 0x33b6,
  33136. "muwsquare",
  33137. 0x33bc,
  33138. "mvmegasquare",
  33139. 0x33b9,
  33140. "mvsquare",
  33141. 0x33b7,
  33142. "mwmegasquare",
  33143. 0x33bf,
  33144. "mwsquare",
  33145. 0x33bd,
  33146. "n",
  33147. 0x006e,
  33148. "nabengali",
  33149. 0x09a8,
  33150. "nabla",
  33151. 0x2207,
  33152. "nacute",
  33153. 0x0144,
  33154. "nadeva",
  33155. 0x0928,
  33156. "nagujarati",
  33157. 0x0aa8,
  33158. "nagurmukhi",
  33159. 0x0a28,
  33160. "nahiragana",
  33161. 0x306a,
  33162. "nakatakana",
  33163. 0x30ca,
  33164. "nakatakanahalfwidth",
  33165. 0xff85,
  33166. "napostrophe",
  33167. 0x0149,
  33168. "nasquare",
  33169. 0x3381,
  33170. "nbopomofo",
  33171. 0x310b,
  33172. "nbspace",
  33173. 0x00a0,
  33174. "ncaron",
  33175. 0x0148,
  33176. "ncedilla",
  33177. 0x0146,
  33178. "ncircle",
  33179. 0x24dd,
  33180. "ncircumflexbelow",
  33181. 0x1e4b,
  33182. "ncommaaccent",
  33183. 0x0146,
  33184. "ndotaccent",
  33185. 0x1e45,
  33186. "ndotbelow",
  33187. 0x1e47,
  33188. "nehiragana",
  33189. 0x306d,
  33190. "nekatakana",
  33191. 0x30cd,
  33192. "nekatakanahalfwidth",
  33193. 0xff88,
  33194. "newsheqelsign",
  33195. 0x20aa,
  33196. "nfsquare",
  33197. 0x338b,
  33198. "ngabengali",
  33199. 0x0999,
  33200. "ngadeva",
  33201. 0x0919,
  33202. "ngagujarati",
  33203. 0x0a99,
  33204. "ngagurmukhi",
  33205. 0x0a19,
  33206. "ngonguthai",
  33207. 0x0e07,
  33208. "nhiragana",
  33209. 0x3093,
  33210. "nhookleft",
  33211. 0x0272,
  33212. "nhookretroflex",
  33213. 0x0273,
  33214. "nieunacirclekorean",
  33215. 0x326f,
  33216. "nieunaparenkorean",
  33217. 0x320f,
  33218. "nieuncieuckorean",
  33219. 0x3135,
  33220. "nieuncirclekorean",
  33221. 0x3261,
  33222. "nieunhieuhkorean",
  33223. 0x3136,
  33224. "nieunkorean",
  33225. 0x3134,
  33226. "nieunpansioskorean",
  33227. 0x3168,
  33228. "nieunparenkorean",
  33229. 0x3201,
  33230. "nieunsioskorean",
  33231. 0x3167,
  33232. "nieuntikeutkorean",
  33233. 0x3166,
  33234. "nihiragana",
  33235. 0x306b,
  33236. "nikatakana",
  33237. 0x30cb,
  33238. "nikatakanahalfwidth",
  33239. 0xff86,
  33240. "nikhahitleftthai",
  33241. 0xf899,
  33242. "nikhahitthai",
  33243. 0x0e4d,
  33244. "nine",
  33245. 0x0039,
  33246. "ninearabic",
  33247. 0x0669,
  33248. "ninebengali",
  33249. 0x09ef,
  33250. "ninecircle",
  33251. 0x2468,
  33252. "ninecircleinversesansserif",
  33253. 0x2792,
  33254. "ninedeva",
  33255. 0x096f,
  33256. "ninegujarati",
  33257. 0x0aef,
  33258. "ninegurmukhi",
  33259. 0x0a6f,
  33260. "ninehackarabic",
  33261. 0x0669,
  33262. "ninehangzhou",
  33263. 0x3029,
  33264. "nineideographicparen",
  33265. 0x3228,
  33266. "nineinferior",
  33267. 0x2089,
  33268. "ninemonospace",
  33269. 0xff19,
  33270. "nineoldstyle",
  33271. 0xf739,
  33272. "nineparen",
  33273. 0x247c,
  33274. "nineperiod",
  33275. 0x2490,
  33276. "ninepersian",
  33277. 0x06f9,
  33278. "nineroman",
  33279. 0x2178,
  33280. "ninesuperior",
  33281. 0x2079,
  33282. "nineteencircle",
  33283. 0x2472,
  33284. "nineteenparen",
  33285. 0x2486,
  33286. "nineteenperiod",
  33287. 0x249a,
  33288. "ninethai",
  33289. 0x0e59,
  33290. "nj",
  33291. 0x01cc,
  33292. "njecyrillic",
  33293. 0x045a,
  33294. "nkatakana",
  33295. 0x30f3,
  33296. "nkatakanahalfwidth",
  33297. 0xff9d,
  33298. "nlegrightlong",
  33299. 0x019e,
  33300. "nlinebelow",
  33301. 0x1e49,
  33302. "nmonospace",
  33303. 0xff4e,
  33304. "nmsquare",
  33305. 0x339a,
  33306. "nnabengali",
  33307. 0x09a3,
  33308. "nnadeva",
  33309. 0x0923,
  33310. "nnagujarati",
  33311. 0x0aa3,
  33312. "nnagurmukhi",
  33313. 0x0a23,
  33314. "nnnadeva",
  33315. 0x0929,
  33316. "nohiragana",
  33317. 0x306e,
  33318. "nokatakana",
  33319. 0x30ce,
  33320. "nokatakanahalfwidth",
  33321. 0xff89,
  33322. "nonbreakingspace",
  33323. 0x00a0,
  33324. "nonenthai",
  33325. 0x0e13,
  33326. "nonuthai",
  33327. 0x0e19,
  33328. "noonarabic",
  33329. 0x0646,
  33330. "noonfinalarabic",
  33331. 0xfee6,
  33332. "noonghunnaarabic",
  33333. 0x06ba,
  33334. "noonghunnafinalarabic",
  33335. 0xfb9f,
  33336. "nooninitialarabic",
  33337. 0xfee7,
  33338. "noonjeeminitialarabic",
  33339. 0xfcd2,
  33340. "noonjeemisolatedarabic",
  33341. 0xfc4b,
  33342. "noonmedialarabic",
  33343. 0xfee8,
  33344. "noonmeeminitialarabic",
  33345. 0xfcd5,
  33346. "noonmeemisolatedarabic",
  33347. 0xfc4e,
  33348. "noonnoonfinalarabic",
  33349. 0xfc8d,
  33350. "notcontains",
  33351. 0x220c,
  33352. "notelement",
  33353. 0x2209,
  33354. "notelementof",
  33355. 0x2209,
  33356. "notequal",
  33357. 0x2260,
  33358. "notgreater",
  33359. 0x226f,
  33360. "notgreaternorequal",
  33361. 0x2271,
  33362. "notgreaternorless",
  33363. 0x2279,
  33364. "notidentical",
  33365. 0x2262,
  33366. "notless",
  33367. 0x226e,
  33368. "notlessnorequal",
  33369. 0x2270,
  33370. "notparallel",
  33371. 0x2226,
  33372. "notprecedes",
  33373. 0x2280,
  33374. "notsubset",
  33375. 0x2284,
  33376. "notsucceeds",
  33377. 0x2281,
  33378. "notsuperset",
  33379. 0x2285,
  33380. "nowarmenian",
  33381. 0x0576,
  33382. "nparen",
  33383. 0x24a9,
  33384. "nssquare",
  33385. 0x33b1,
  33386. "nsuperior",
  33387. 0x207f,
  33388. "ntilde",
  33389. 0x00f1,
  33390. "nu",
  33391. 0x03bd,
  33392. "nuhiragana",
  33393. 0x306c,
  33394. "nukatakana",
  33395. 0x30cc,
  33396. "nukatakanahalfwidth",
  33397. 0xff87,
  33398. "nuktabengali",
  33399. 0x09bc,
  33400. "nuktadeva",
  33401. 0x093c,
  33402. "nuktagujarati",
  33403. 0x0abc,
  33404. "nuktagurmukhi",
  33405. 0x0a3c,
  33406. "numbersign",
  33407. 0x0023,
  33408. "numbersignmonospace",
  33409. 0xff03,
  33410. "numbersignsmall",
  33411. 0xfe5f,
  33412. "numeralsigngreek",
  33413. 0x0374,
  33414. "numeralsignlowergreek",
  33415. 0x0375,
  33416. "numero",
  33417. 0x2116,
  33418. "nun",
  33419. 0x05e0,
  33420. "nundagesh",
  33421. 0xfb40,
  33422. "nundageshhebrew",
  33423. 0xfb40,
  33424. "nunhebrew",
  33425. 0x05e0,
  33426. "nvsquare",
  33427. 0x33b5,
  33428. "nwsquare",
  33429. 0x33bb,
  33430. "nyabengali",
  33431. 0x099e,
  33432. "nyadeva",
  33433. 0x091e,
  33434. "nyagujarati",
  33435. 0x0a9e,
  33436. "nyagurmukhi",
  33437. 0x0a1e,
  33438. "o",
  33439. 0x006f,
  33440. "oacute",
  33441. 0x00f3,
  33442. "oangthai",
  33443. 0x0e2d,
  33444. "obarred",
  33445. 0x0275,
  33446. "obarredcyrillic",
  33447. 0x04e9,
  33448. "obarreddieresiscyrillic",
  33449. 0x04eb,
  33450. "obengali",
  33451. 0x0993,
  33452. "obopomofo",
  33453. 0x311b,
  33454. "obreve",
  33455. 0x014f,
  33456. "ocandradeva",
  33457. 0x0911,
  33458. "ocandragujarati",
  33459. 0x0a91,
  33460. "ocandravowelsigndeva",
  33461. 0x0949,
  33462. "ocandravowelsigngujarati",
  33463. 0x0ac9,
  33464. "ocaron",
  33465. 0x01d2,
  33466. "ocircle",
  33467. 0x24de,
  33468. "ocircumflex",
  33469. 0x00f4,
  33470. "ocircumflexacute",
  33471. 0x1ed1,
  33472. "ocircumflexdotbelow",
  33473. 0x1ed9,
  33474. "ocircumflexgrave",
  33475. 0x1ed3,
  33476. "ocircumflexhookabove",
  33477. 0x1ed5,
  33478. "ocircumflextilde",
  33479. 0x1ed7,
  33480. "ocyrillic",
  33481. 0x043e,
  33482. "odblacute",
  33483. 0x0151,
  33484. "odblgrave",
  33485. 0x020d,
  33486. "odeva",
  33487. 0x0913,
  33488. "odieresis",
  33489. 0x00f6,
  33490. "odieresiscyrillic",
  33491. 0x04e7,
  33492. "odotbelow",
  33493. 0x1ecd,
  33494. "oe",
  33495. 0x0153,
  33496. "oekorean",
  33497. 0x315a,
  33498. "ogonek",
  33499. 0x02db,
  33500. "ogonekcmb",
  33501. 0x0328,
  33502. "ograve",
  33503. 0x00f2,
  33504. "ogujarati",
  33505. 0x0a93,
  33506. "oharmenian",
  33507. 0x0585,
  33508. "ohiragana",
  33509. 0x304a,
  33510. "ohookabove",
  33511. 0x1ecf,
  33512. "ohorn",
  33513. 0x01a1,
  33514. "ohornacute",
  33515. 0x1edb,
  33516. "ohorndotbelow",
  33517. 0x1ee3,
  33518. "ohorngrave",
  33519. 0x1edd,
  33520. "ohornhookabove",
  33521. 0x1edf,
  33522. "ohorntilde",
  33523. 0x1ee1,
  33524. "ohungarumlaut",
  33525. 0x0151,
  33526. "oi",
  33527. 0x01a3,
  33528. "oinvertedbreve",
  33529. 0x020f,
  33530. "okatakana",
  33531. 0x30aa,
  33532. "okatakanahalfwidth",
  33533. 0xff75,
  33534. "okorean",
  33535. 0x3157,
  33536. "olehebrew",
  33537. 0x05ab,
  33538. "omacron",
  33539. 0x014d,
  33540. "omacronacute",
  33541. 0x1e53,
  33542. "omacrongrave",
  33543. 0x1e51,
  33544. "omdeva",
  33545. 0x0950,
  33546. "omega",
  33547. 0x03c9,
  33548. "omega1",
  33549. 0x03d6,
  33550. "omegacyrillic",
  33551. 0x0461,
  33552. "omegalatinclosed",
  33553. 0x0277,
  33554. "omegaroundcyrillic",
  33555. 0x047b,
  33556. "omegatitlocyrillic",
  33557. 0x047d,
  33558. "omegatonos",
  33559. 0x03ce,
  33560. "omgujarati",
  33561. 0x0ad0,
  33562. "omicron",
  33563. 0x03bf,
  33564. "omicrontonos",
  33565. 0x03cc,
  33566. "omonospace",
  33567. 0xff4f,
  33568. "one",
  33569. 0x0031,
  33570. "onearabic",
  33571. 0x0661,
  33572. "onebengali",
  33573. 0x09e7,
  33574. "onecircle",
  33575. 0x2460,
  33576. "onecircleinversesansserif",
  33577. 0x278a,
  33578. "onedeva",
  33579. 0x0967,
  33580. "onedotenleader",
  33581. 0x2024,
  33582. "oneeighth",
  33583. 0x215b,
  33584. "onefitted",
  33585. 0xf6dc,
  33586. "onegujarati",
  33587. 0x0ae7,
  33588. "onegurmukhi",
  33589. 0x0a67,
  33590. "onehackarabic",
  33591. 0x0661,
  33592. "onehalf",
  33593. 0x00bd,
  33594. "onehangzhou",
  33595. 0x3021,
  33596. "oneideographicparen",
  33597. 0x3220,
  33598. "oneinferior",
  33599. 0x2081,
  33600. "onemonospace",
  33601. 0xff11,
  33602. "onenumeratorbengali",
  33603. 0x09f4,
  33604. "oneoldstyle",
  33605. 0xf731,
  33606. "oneparen",
  33607. 0x2474,
  33608. "oneperiod",
  33609. 0x2488,
  33610. "onepersian",
  33611. 0x06f1,
  33612. "onequarter",
  33613. 0x00bc,
  33614. "oneroman",
  33615. 0x2170,
  33616. "onesuperior",
  33617. 0x00b9,
  33618. "onethai",
  33619. 0x0e51,
  33620. "onethird",
  33621. 0x2153,
  33622. "oogonek",
  33623. 0x01eb,
  33624. "oogonekmacron",
  33625. 0x01ed,
  33626. "oogurmukhi",
  33627. 0x0a13,
  33628. "oomatragurmukhi",
  33629. 0x0a4b,
  33630. "oopen",
  33631. 0x0254,
  33632. "oparen",
  33633. 0x24aa,
  33634. "openbullet",
  33635. 0x25e6,
  33636. "option",
  33637. 0x2325,
  33638. "ordfeminine",
  33639. 0x00aa,
  33640. "ordmasculine",
  33641. 0x00ba,
  33642. "orthogonal",
  33643. 0x221f,
  33644. "oshortdeva",
  33645. 0x0912,
  33646. "oshortvowelsigndeva",
  33647. 0x094a,
  33648. "oslash",
  33649. 0x00f8,
  33650. "oslashacute",
  33651. 0x01ff,
  33652. "osmallhiragana",
  33653. 0x3049,
  33654. "osmallkatakana",
  33655. 0x30a9,
  33656. "osmallkatakanahalfwidth",
  33657. 0xff6b,
  33658. "ostrokeacute",
  33659. 0x01ff,
  33660. "osuperior",
  33661. 0xf6f0,
  33662. "otcyrillic",
  33663. 0x047f,
  33664. "otilde",
  33665. 0x00f5,
  33666. "otildeacute",
  33667. 0x1e4d,
  33668. "otildedieresis",
  33669. 0x1e4f,
  33670. "oubopomofo",
  33671. 0x3121,
  33672. "overline",
  33673. 0x203e,
  33674. "overlinecenterline",
  33675. 0xfe4a,
  33676. "overlinecmb",
  33677. 0x0305,
  33678. "overlinedashed",
  33679. 0xfe49,
  33680. "overlinedblwavy",
  33681. 0xfe4c,
  33682. "overlinewavy",
  33683. 0xfe4b,
  33684. "overscore",
  33685. 0x00af,
  33686. "ovowelsignbengali",
  33687. 0x09cb,
  33688. "ovowelsigndeva",
  33689. 0x094b,
  33690. "ovowelsigngujarati",
  33691. 0x0acb,
  33692. "p",
  33693. 0x0070,
  33694. "paampssquare",
  33695. 0x3380,
  33696. "paasentosquare",
  33697. 0x332b,
  33698. "pabengali",
  33699. 0x09aa,
  33700. "pacute",
  33701. 0x1e55,
  33702. "padeva",
  33703. 0x092a,
  33704. "pagedown",
  33705. 0x21df,
  33706. "pageup",
  33707. 0x21de,
  33708. "pagujarati",
  33709. 0x0aaa,
  33710. "pagurmukhi",
  33711. 0x0a2a,
  33712. "pahiragana",
  33713. 0x3071,
  33714. "paiyannoithai",
  33715. 0x0e2f,
  33716. "pakatakana",
  33717. 0x30d1,
  33718. "palatalizationcyrilliccmb",
  33719. 0x0484,
  33720. "palochkacyrillic",
  33721. 0x04c0,
  33722. "pansioskorean",
  33723. 0x317f,
  33724. "paragraph",
  33725. 0x00b6,
  33726. "parallel",
  33727. 0x2225,
  33728. "parenleft",
  33729. 0x0028,
  33730. "parenleftaltonearabic",
  33731. 0xfd3e,
  33732. "parenleftbt",
  33733. 0xf8ed,
  33734. "parenleftex",
  33735. 0xf8ec,
  33736. "parenleftinferior",
  33737. 0x208d,
  33738. "parenleftmonospace",
  33739. 0xff08,
  33740. "parenleftsmall",
  33741. 0xfe59,
  33742. "parenleftsuperior",
  33743. 0x207d,
  33744. "parenlefttp",
  33745. 0xf8eb,
  33746. "parenleftvertical",
  33747. 0xfe35,
  33748. "parenright",
  33749. 0x0029,
  33750. "parenrightaltonearabic",
  33751. 0xfd3f,
  33752. "parenrightbt",
  33753. 0xf8f8,
  33754. "parenrightex",
  33755. 0xf8f7,
  33756. "parenrightinferior",
  33757. 0x208e,
  33758. "parenrightmonospace",
  33759. 0xff09,
  33760. "parenrightsmall",
  33761. 0xfe5a,
  33762. "parenrightsuperior",
  33763. 0x207e,
  33764. "parenrighttp",
  33765. 0xf8f6,
  33766. "parenrightvertical",
  33767. 0xfe36,
  33768. "partialdiff",
  33769. 0x2202,
  33770. "paseqhebrew",
  33771. 0x05c0,
  33772. "pashtahebrew",
  33773. 0x0599,
  33774. "pasquare",
  33775. 0x33a9,
  33776. "patah",
  33777. 0x05b7,
  33778. "patah11",
  33779. 0x05b7,
  33780. "patah1d",
  33781. 0x05b7,
  33782. "patah2a",
  33783. 0x05b7,
  33784. "patahhebrew",
  33785. 0x05b7,
  33786. "patahnarrowhebrew",
  33787. 0x05b7,
  33788. "patahquarterhebrew",
  33789. 0x05b7,
  33790. "patahwidehebrew",
  33791. 0x05b7,
  33792. "pazerhebrew",
  33793. 0x05a1,
  33794. "pbopomofo",
  33795. 0x3106,
  33796. "pcircle",
  33797. 0x24df,
  33798. "pdotaccent",
  33799. 0x1e57,
  33800. "pe",
  33801. 0x05e4,
  33802. "pecyrillic",
  33803. 0x043f,
  33804. "pedagesh",
  33805. 0xfb44,
  33806. "pedageshhebrew",
  33807. 0xfb44,
  33808. "peezisquare",
  33809. 0x333b,
  33810. "pefinaldageshhebrew",
  33811. 0xfb43,
  33812. "peharabic",
  33813. 0x067e,
  33814. "peharmenian",
  33815. 0x057a,
  33816. "pehebrew",
  33817. 0x05e4,
  33818. "pehfinalarabic",
  33819. 0xfb57,
  33820. "pehinitialarabic",
  33821. 0xfb58,
  33822. "pehiragana",
  33823. 0x307a,
  33824. "pehmedialarabic",
  33825. 0xfb59,
  33826. "pekatakana",
  33827. 0x30da,
  33828. "pemiddlehookcyrillic",
  33829. 0x04a7,
  33830. "perafehebrew",
  33831. 0xfb4e,
  33832. "percent",
  33833. 0x0025,
  33834. "percentarabic",
  33835. 0x066a,
  33836. "percentmonospace",
  33837. 0xff05,
  33838. "percentsmall",
  33839. 0xfe6a,
  33840. "period",
  33841. 0x002e,
  33842. "periodarmenian",
  33843. 0x0589,
  33844. "periodcentered",
  33845. 0x00b7,
  33846. "periodhalfwidth",
  33847. 0xff61,
  33848. "periodinferior",
  33849. 0xf6e7,
  33850. "periodmonospace",
  33851. 0xff0e,
  33852. "periodsmall",
  33853. 0xfe52,
  33854. "periodsuperior",
  33855. 0xf6e8,
  33856. "perispomenigreekcmb",
  33857. 0x0342,
  33858. "perpendicular",
  33859. 0x22a5,
  33860. "perthousand",
  33861. 0x2030,
  33862. "peseta",
  33863. 0x20a7,
  33864. "pfsquare",
  33865. 0x338a,
  33866. "phabengali",
  33867. 0x09ab,
  33868. "phadeva",
  33869. 0x092b,
  33870. "phagujarati",
  33871. 0x0aab,
  33872. "phagurmukhi",
  33873. 0x0a2b,
  33874. "phi",
  33875. 0x03c6,
  33876. "phi1",
  33877. 0x03d5,
  33878. "phieuphacirclekorean",
  33879. 0x327a,
  33880. "phieuphaparenkorean",
  33881. 0x321a,
  33882. "phieuphcirclekorean",
  33883. 0x326c,
  33884. "phieuphkorean",
  33885. 0x314d,
  33886. "phieuphparenkorean",
  33887. 0x320c,
  33888. "philatin",
  33889. 0x0278,
  33890. "phinthuthai",
  33891. 0x0e3a,
  33892. "phisymbolgreek",
  33893. 0x03d5,
  33894. "phook",
  33895. 0x01a5,
  33896. "phophanthai",
  33897. 0x0e1e,
  33898. "phophungthai",
  33899. 0x0e1c,
  33900. "phosamphaothai",
  33901. 0x0e20,
  33902. "pi",
  33903. 0x03c0,
  33904. "pieupacirclekorean",
  33905. 0x3273,
  33906. "pieupaparenkorean",
  33907. 0x3213,
  33908. "pieupcieuckorean",
  33909. 0x3176,
  33910. "pieupcirclekorean",
  33911. 0x3265,
  33912. "pieupkiyeokkorean",
  33913. 0x3172,
  33914. "pieupkorean",
  33915. 0x3142,
  33916. "pieupparenkorean",
  33917. 0x3205,
  33918. "pieupsioskiyeokkorean",
  33919. 0x3174,
  33920. "pieupsioskorean",
  33921. 0x3144,
  33922. "pieupsiostikeutkorean",
  33923. 0x3175,
  33924. "pieupthieuthkorean",
  33925. 0x3177,
  33926. "pieuptikeutkorean",
  33927. 0x3173,
  33928. "pihiragana",
  33929. 0x3074,
  33930. "pikatakana",
  33931. 0x30d4,
  33932. "pisymbolgreek",
  33933. 0x03d6,
  33934. "piwrarmenian",
  33935. 0x0583,
  33936. "plus",
  33937. 0x002b,
  33938. "plusbelowcmb",
  33939. 0x031f,
  33940. "pluscircle",
  33941. 0x2295,
  33942. "plusminus",
  33943. 0x00b1,
  33944. "plusmod",
  33945. 0x02d6,
  33946. "plusmonospace",
  33947. 0xff0b,
  33948. "plussmall",
  33949. 0xfe62,
  33950. "plussuperior",
  33951. 0x207a,
  33952. "pmonospace",
  33953. 0xff50,
  33954. "pmsquare",
  33955. 0x33d8,
  33956. "pohiragana",
  33957. 0x307d,
  33958. "pointingindexdownwhite",
  33959. 0x261f,
  33960. "pointingindexleftwhite",
  33961. 0x261c,
  33962. "pointingindexrightwhite",
  33963. 0x261e,
  33964. "pointingindexupwhite",
  33965. 0x261d,
  33966. "pokatakana",
  33967. 0x30dd,
  33968. "poplathai",
  33969. 0x0e1b,
  33970. "postalmark",
  33971. 0x3012,
  33972. "postalmarkface",
  33973. 0x3020,
  33974. "pparen",
  33975. 0x24ab,
  33976. "precedes",
  33977. 0x227a,
  33978. "prescription",
  33979. 0x211e,
  33980. "primemod",
  33981. 0x02b9,
  33982. "primereversed",
  33983. 0x2035,
  33984. "product",
  33985. 0x220f,
  33986. "projective",
  33987. 0x2305,
  33988. "prolongedkana",
  33989. 0x30fc,
  33990. "propellor",
  33991. 0x2318,
  33992. "propersubset",
  33993. 0x2282,
  33994. "propersuperset",
  33995. 0x2283,
  33996. "proportion",
  33997. 0x2237,
  33998. "proportional",
  33999. 0x221d,
  34000. "psi",
  34001. 0x03c8,
  34002. "psicyrillic",
  34003. 0x0471,
  34004. "psilipneumatacyrilliccmb",
  34005. 0x0486,
  34006. "pssquare",
  34007. 0x33b0,
  34008. "puhiragana",
  34009. 0x3077,
  34010. "pukatakana",
  34011. 0x30d7,
  34012. "pvsquare",
  34013. 0x33b4,
  34014. "pwsquare",
  34015. 0x33ba,
  34016. "q",
  34017. 0x0071,
  34018. "qadeva",
  34019. 0x0958,
  34020. "qadmahebrew",
  34021. 0x05a8,
  34022. "qafarabic",
  34023. 0x0642,
  34024. "qaffinalarabic",
  34025. 0xfed6,
  34026. "qafinitialarabic",
  34027. 0xfed7,
  34028. "qafmedialarabic",
  34029. 0xfed8,
  34030. "qamats",
  34031. 0x05b8,
  34032. "qamats10",
  34033. 0x05b8,
  34034. "qamats1a",
  34035. 0x05b8,
  34036. "qamats1c",
  34037. 0x05b8,
  34038. "qamats27",
  34039. 0x05b8,
  34040. "qamats29",
  34041. 0x05b8,
  34042. "qamats33",
  34043. 0x05b8,
  34044. "qamatsde",
  34045. 0x05b8,
  34046. "qamatshebrew",
  34047. 0x05b8,
  34048. "qamatsnarrowhebrew",
  34049. 0x05b8,
  34050. "qamatsqatanhebrew",
  34051. 0x05b8,
  34052. "qamatsqatannarrowhebrew",
  34053. 0x05b8,
  34054. "qamatsqatanquarterhebrew",
  34055. 0x05b8,
  34056. "qamatsqatanwidehebrew",
  34057. 0x05b8,
  34058. "qamatsquarterhebrew",
  34059. 0x05b8,
  34060. "qamatswidehebrew",
  34061. 0x05b8,
  34062. "qarneyparahebrew",
  34063. 0x059f,
  34064. "qbopomofo",
  34065. 0x3111,
  34066. "qcircle",
  34067. 0x24e0,
  34068. "qhook",
  34069. 0x02a0,
  34070. "qmonospace",
  34071. 0xff51,
  34072. "qof",
  34073. 0x05e7,
  34074. "qofdagesh",
  34075. 0xfb47,
  34076. "qofdageshhebrew",
  34077. 0xfb47,
  34078. "qofhebrew",
  34079. 0x05e7,
  34080. "qparen",
  34081. 0x24ac,
  34082. "quarternote",
  34083. 0x2669,
  34084. "qubuts",
  34085. 0x05bb,
  34086. "qubuts18",
  34087. 0x05bb,
  34088. "qubuts25",
  34089. 0x05bb,
  34090. "qubuts31",
  34091. 0x05bb,
  34092. "qubutshebrew",
  34093. 0x05bb,
  34094. "qubutsnarrowhebrew",
  34095. 0x05bb,
  34096. "qubutsquarterhebrew",
  34097. 0x05bb,
  34098. "qubutswidehebrew",
  34099. 0x05bb,
  34100. "question",
  34101. 0x003f,
  34102. "questionarabic",
  34103. 0x061f,
  34104. "questionarmenian",
  34105. 0x055e,
  34106. "questiondown",
  34107. 0x00bf,
  34108. "questiondownsmall",
  34109. 0xf7bf,
  34110. "questiongreek",
  34111. 0x037e,
  34112. "questionmonospace",
  34113. 0xff1f,
  34114. "questionsmall",
  34115. 0xf73f,
  34116. "quotedbl",
  34117. 0x0022,
  34118. "quotedblbase",
  34119. 0x201e,
  34120. "quotedblleft",
  34121. 0x201c,
  34122. "quotedblmonospace",
  34123. 0xff02,
  34124. "quotedblprime",
  34125. 0x301e,
  34126. "quotedblprimereversed",
  34127. 0x301d,
  34128. "quotedblright",
  34129. 0x201d,
  34130. "quoteleft",
  34131. 0x2018,
  34132. "quoteleftreversed",
  34133. 0x201b,
  34134. "quotereversed",
  34135. 0x201b,
  34136. "quoteright",
  34137. 0x2019,
  34138. "quoterightn",
  34139. 0x0149,
  34140. "quotesinglbase",
  34141. 0x201a,
  34142. "quotesingle",
  34143. 0x0027,
  34144. "quotesinglemonospace",
  34145. 0xff07,
  34146. "r",
  34147. 0x0072,
  34148. "raarmenian",
  34149. 0x057c,
  34150. "rabengali",
  34151. 0x09b0,
  34152. "racute",
  34153. 0x0155,
  34154. "radeva",
  34155. 0x0930,
  34156. "radical",
  34157. 0x221a,
  34158. "radicalex",
  34159. 0xf8e5,
  34160. "radoverssquare",
  34161. 0x33ae,
  34162. "radoverssquaredsquare",
  34163. 0x33af,
  34164. "radsquare",
  34165. 0x33ad,
  34166. "rafe",
  34167. 0x05bf,
  34168. "rafehebrew",
  34169. 0x05bf,
  34170. "ragujarati",
  34171. 0x0ab0,
  34172. "ragurmukhi",
  34173. 0x0a30,
  34174. "rahiragana",
  34175. 0x3089,
  34176. "rakatakana",
  34177. 0x30e9,
  34178. "rakatakanahalfwidth",
  34179. 0xff97,
  34180. "ralowerdiagonalbengali",
  34181. 0x09f1,
  34182. "ramiddlediagonalbengali",
  34183. 0x09f0,
  34184. "ramshorn",
  34185. 0x0264,
  34186. "ratio",
  34187. 0x2236,
  34188. "rbopomofo",
  34189. 0x3116,
  34190. "rcaron",
  34191. 0x0159,
  34192. "rcedilla",
  34193. 0x0157,
  34194. "rcircle",
  34195. 0x24e1,
  34196. "rcommaaccent",
  34197. 0x0157,
  34198. "rdblgrave",
  34199. 0x0211,
  34200. "rdotaccent",
  34201. 0x1e59,
  34202. "rdotbelow",
  34203. 0x1e5b,
  34204. "rdotbelowmacron",
  34205. 0x1e5d,
  34206. "referencemark",
  34207. 0x203b,
  34208. "reflexsubset",
  34209. 0x2286,
  34210. "reflexsuperset",
  34211. 0x2287,
  34212. "registered",
  34213. 0x00ae,
  34214. "registersans",
  34215. 0xf8e8,
  34216. "registerserif",
  34217. 0xf6da,
  34218. "reharabic",
  34219. 0x0631,
  34220. "reharmenian",
  34221. 0x0580,
  34222. "rehfinalarabic",
  34223. 0xfeae,
  34224. "rehiragana",
  34225. 0x308c,
  34226. "rekatakana",
  34227. 0x30ec,
  34228. "rekatakanahalfwidth",
  34229. 0xff9a,
  34230. "resh",
  34231. 0x05e8,
  34232. "reshdageshhebrew",
  34233. 0xfb48,
  34234. "reshhebrew",
  34235. 0x05e8,
  34236. "reversedtilde",
  34237. 0x223d,
  34238. "reviahebrew",
  34239. 0x0597,
  34240. "reviamugrashhebrew",
  34241. 0x0597,
  34242. "revlogicalnot",
  34243. 0x2310,
  34244. "rfishhook",
  34245. 0x027e,
  34246. "rfishhookreversed",
  34247. 0x027f,
  34248. "rhabengali",
  34249. 0x09dd,
  34250. "rhadeva",
  34251. 0x095d,
  34252. "rho",
  34253. 0x03c1,
  34254. "rhook",
  34255. 0x027d,
  34256. "rhookturned",
  34257. 0x027b,
  34258. "rhookturnedsuperior",
  34259. 0x02b5,
  34260. "rhosymbolgreek",
  34261. 0x03f1,
  34262. "rhotichookmod",
  34263. 0x02de,
  34264. "rieulacirclekorean",
  34265. 0x3271,
  34266. "rieulaparenkorean",
  34267. 0x3211,
  34268. "rieulcirclekorean",
  34269. 0x3263,
  34270. "rieulhieuhkorean",
  34271. 0x3140,
  34272. "rieulkiyeokkorean",
  34273. 0x313a,
  34274. "rieulkiyeoksioskorean",
  34275. 0x3169,
  34276. "rieulkorean",
  34277. 0x3139,
  34278. "rieulmieumkorean",
  34279. 0x313b,
  34280. "rieulpansioskorean",
  34281. 0x316c,
  34282. "rieulparenkorean",
  34283. 0x3203,
  34284. "rieulphieuphkorean",
  34285. 0x313f,
  34286. "rieulpieupkorean",
  34287. 0x313c,
  34288. "rieulpieupsioskorean",
  34289. 0x316b,
  34290. "rieulsioskorean",
  34291. 0x313d,
  34292. "rieulthieuthkorean",
  34293. 0x313e,
  34294. "rieultikeutkorean",
  34295. 0x316a,
  34296. "rieulyeorinhieuhkorean",
  34297. 0x316d,
  34298. "rightangle",
  34299. 0x221f,
  34300. "righttackbelowcmb",
  34301. 0x0319,
  34302. "righttriangle",
  34303. 0x22bf,
  34304. "rihiragana",
  34305. 0x308a,
  34306. "rikatakana",
  34307. 0x30ea,
  34308. "rikatakanahalfwidth",
  34309. 0xff98,
  34310. "ring",
  34311. 0x02da,
  34312. "ringbelowcmb",
  34313. 0x0325,
  34314. "ringcmb",
  34315. 0x030a,
  34316. "ringhalfleft",
  34317. 0x02bf,
  34318. "ringhalfleftarmenian",
  34319. 0x0559,
  34320. "ringhalfleftbelowcmb",
  34321. 0x031c,
  34322. "ringhalfleftcentered",
  34323. 0x02d3,
  34324. "ringhalfright",
  34325. 0x02be,
  34326. "ringhalfrightbelowcmb",
  34327. 0x0339,
  34328. "ringhalfrightcentered",
  34329. 0x02d2,
  34330. "rinvertedbreve",
  34331. 0x0213,
  34332. "rittorusquare",
  34333. 0x3351,
  34334. "rlinebelow",
  34335. 0x1e5f,
  34336. "rlongleg",
  34337. 0x027c,
  34338. "rlonglegturned",
  34339. 0x027a,
  34340. "rmonospace",
  34341. 0xff52,
  34342. "rohiragana",
  34343. 0x308d,
  34344. "rokatakana",
  34345. 0x30ed,
  34346. "rokatakanahalfwidth",
  34347. 0xff9b,
  34348. "roruathai",
  34349. 0x0e23,
  34350. "rparen",
  34351. 0x24ad,
  34352. "rrabengali",
  34353. 0x09dc,
  34354. "rradeva",
  34355. 0x0931,
  34356. "rragurmukhi",
  34357. 0x0a5c,
  34358. "rreharabic",
  34359. 0x0691,
  34360. "rrehfinalarabic",
  34361. 0xfb8d,
  34362. "rrvocalicbengali",
  34363. 0x09e0,
  34364. "rrvocalicdeva",
  34365. 0x0960,
  34366. "rrvocalicgujarati",
  34367. 0x0ae0,
  34368. "rrvocalicvowelsignbengali",
  34369. 0x09c4,
  34370. "rrvocalicvowelsigndeva",
  34371. 0x0944,
  34372. "rrvocalicvowelsigngujarati",
  34373. 0x0ac4,
  34374. "rsuperior",
  34375. 0xf6f1,
  34376. "rtblock",
  34377. 0x2590,
  34378. "rturned",
  34379. 0x0279,
  34380. "rturnedsuperior",
  34381. 0x02b4,
  34382. "ruhiragana",
  34383. 0x308b,
  34384. "rukatakana",
  34385. 0x30eb,
  34386. "rukatakanahalfwidth",
  34387. 0xff99,
  34388. "rupeemarkbengali",
  34389. 0x09f2,
  34390. "rupeesignbengali",
  34391. 0x09f3,
  34392. "rupiah",
  34393. 0xf6dd,
  34394. "ruthai",
  34395. 0x0e24,
  34396. "rvocalicbengali",
  34397. 0x098b,
  34398. "rvocalicdeva",
  34399. 0x090b,
  34400. "rvocalicgujarati",
  34401. 0x0a8b,
  34402. "rvocalicvowelsignbengali",
  34403. 0x09c3,
  34404. "rvocalicvowelsigndeva",
  34405. 0x0943,
  34406. "rvocalicvowelsigngujarati",
  34407. 0x0ac3,
  34408. "s",
  34409. 0x0073,
  34410. "sabengali",
  34411. 0x09b8,
  34412. "sacute",
  34413. 0x015b,
  34414. "sacutedotaccent",
  34415. 0x1e65,
  34416. "sadarabic",
  34417. 0x0635,
  34418. "sadeva",
  34419. 0x0938,
  34420. "sadfinalarabic",
  34421. 0xfeba,
  34422. "sadinitialarabic",
  34423. 0xfebb,
  34424. "sadmedialarabic",
  34425. 0xfebc,
  34426. "sagujarati",
  34427. 0x0ab8,
  34428. "sagurmukhi",
  34429. 0x0a38,
  34430. "sahiragana",
  34431. 0x3055,
  34432. "sakatakana",
  34433. 0x30b5,
  34434. "sakatakanahalfwidth",
  34435. 0xff7b,
  34436. "sallallahoualayhewasallamarabic",
  34437. 0xfdfa,
  34438. "samekh",
  34439. 0x05e1,
  34440. "samekhdagesh",
  34441. 0xfb41,
  34442. "samekhdageshhebrew",
  34443. 0xfb41,
  34444. "samekhhebrew",
  34445. 0x05e1,
  34446. "saraaathai",
  34447. 0x0e32,
  34448. "saraaethai",
  34449. 0x0e41,
  34450. "saraaimaimalaithai",
  34451. 0x0e44,
  34452. "saraaimaimuanthai",
  34453. 0x0e43,
  34454. "saraamthai",
  34455. 0x0e33,
  34456. "saraathai",
  34457. 0x0e30,
  34458. "saraethai",
  34459. 0x0e40,
  34460. "saraiileftthai",
  34461. 0xf886,
  34462. "saraiithai",
  34463. 0x0e35,
  34464. "saraileftthai",
  34465. 0xf885,
  34466. "saraithai",
  34467. 0x0e34,
  34468. "saraothai",
  34469. 0x0e42,
  34470. "saraueeleftthai",
  34471. 0xf888,
  34472. "saraueethai",
  34473. 0x0e37,
  34474. "saraueleftthai",
  34475. 0xf887,
  34476. "sarauethai",
  34477. 0x0e36,
  34478. "sarauthai",
  34479. 0x0e38,
  34480. "sarauuthai",
  34481. 0x0e39,
  34482. "sbopomofo",
  34483. 0x3119,
  34484. "scaron",
  34485. 0x0161,
  34486. "scarondotaccent",
  34487. 0x1e67,
  34488. "scedilla",
  34489. 0x015f,
  34490. "schwa",
  34491. 0x0259,
  34492. "schwacyrillic",
  34493. 0x04d9,
  34494. "schwadieresiscyrillic",
  34495. 0x04db,
  34496. "schwahook",
  34497. 0x025a,
  34498. "scircle",
  34499. 0x24e2,
  34500. "scircumflex",
  34501. 0x015d,
  34502. "scommaaccent",
  34503. 0x0219,
  34504. "sdotaccent",
  34505. 0x1e61,
  34506. "sdotbelow",
  34507. 0x1e63,
  34508. "sdotbelowdotaccent",
  34509. 0x1e69,
  34510. "seagullbelowcmb",
  34511. 0x033c,
  34512. "second",
  34513. 0x2033,
  34514. "secondtonechinese",
  34515. 0x02ca,
  34516. "section",
  34517. 0x00a7,
  34518. "seenarabic",
  34519. 0x0633,
  34520. "seenfinalarabic",
  34521. 0xfeb2,
  34522. "seeninitialarabic",
  34523. 0xfeb3,
  34524. "seenmedialarabic",
  34525. 0xfeb4,
  34526. "segol",
  34527. 0x05b6,
  34528. "segol13",
  34529. 0x05b6,
  34530. "segol1f",
  34531. 0x05b6,
  34532. "segol2c",
  34533. 0x05b6,
  34534. "segolhebrew",
  34535. 0x05b6,
  34536. "segolnarrowhebrew",
  34537. 0x05b6,
  34538. "segolquarterhebrew",
  34539. 0x05b6,
  34540. "segoltahebrew",
  34541. 0x0592,
  34542. "segolwidehebrew",
  34543. 0x05b6,
  34544. "seharmenian",
  34545. 0x057d,
  34546. "sehiragana",
  34547. 0x305b,
  34548. "sekatakana",
  34549. 0x30bb,
  34550. "sekatakanahalfwidth",
  34551. 0xff7e,
  34552. "semicolon",
  34553. 0x003b,
  34554. "semicolonarabic",
  34555. 0x061b,
  34556. "semicolonmonospace",
  34557. 0xff1b,
  34558. "semicolonsmall",
  34559. 0xfe54,
  34560. "semivoicedmarkkana",
  34561. 0x309c,
  34562. "semivoicedmarkkanahalfwidth",
  34563. 0xff9f,
  34564. "sentisquare",
  34565. 0x3322,
  34566. "sentosquare",
  34567. 0x3323,
  34568. "seven",
  34569. 0x0037,
  34570. "sevenarabic",
  34571. 0x0667,
  34572. "sevenbengali",
  34573. 0x09ed,
  34574. "sevencircle",
  34575. 0x2466,
  34576. "sevencircleinversesansserif",
  34577. 0x2790,
  34578. "sevendeva",
  34579. 0x096d,
  34580. "seveneighths",
  34581. 0x215e,
  34582. "sevengujarati",
  34583. 0x0aed,
  34584. "sevengurmukhi",
  34585. 0x0a6d,
  34586. "sevenhackarabic",
  34587. 0x0667,
  34588. "sevenhangzhou",
  34589. 0x3027,
  34590. "sevenideographicparen",
  34591. 0x3226,
  34592. "seveninferior",
  34593. 0x2087,
  34594. "sevenmonospace",
  34595. 0xff17,
  34596. "sevenoldstyle",
  34597. 0xf737,
  34598. "sevenparen",
  34599. 0x247a,
  34600. "sevenperiod",
  34601. 0x248e,
  34602. "sevenpersian",
  34603. 0x06f7,
  34604. "sevenroman",
  34605. 0x2176,
  34606. "sevensuperior",
  34607. 0x2077,
  34608. "seventeencircle",
  34609. 0x2470,
  34610. "seventeenparen",
  34611. 0x2484,
  34612. "seventeenperiod",
  34613. 0x2498,
  34614. "seventhai",
  34615. 0x0e57,
  34616. "sfthyphen",
  34617. 0x00ad,
  34618. "shaarmenian",
  34619. 0x0577,
  34620. "shabengali",
  34621. 0x09b6,
  34622. "shacyrillic",
  34623. 0x0448,
  34624. "shaddaarabic",
  34625. 0x0651,
  34626. "shaddadammaarabic",
  34627. 0xfc61,
  34628. "shaddadammatanarabic",
  34629. 0xfc5e,
  34630. "shaddafathaarabic",
  34631. 0xfc60,
  34632. "shaddakasraarabic",
  34633. 0xfc62,
  34634. "shaddakasratanarabic",
  34635. 0xfc5f,
  34636. "shade",
  34637. 0x2592,
  34638. "shadedark",
  34639. 0x2593,
  34640. "shadelight",
  34641. 0x2591,
  34642. "shademedium",
  34643. 0x2592,
  34644. "shadeva",
  34645. 0x0936,
  34646. "shagujarati",
  34647. 0x0ab6,
  34648. "shagurmukhi",
  34649. 0x0a36,
  34650. "shalshelethebrew",
  34651. 0x0593,
  34652. "shbopomofo",
  34653. 0x3115,
  34654. "shchacyrillic",
  34655. 0x0449,
  34656. "sheenarabic",
  34657. 0x0634,
  34658. "sheenfinalarabic",
  34659. 0xfeb6,
  34660. "sheeninitialarabic",
  34661. 0xfeb7,
  34662. "sheenmedialarabic",
  34663. 0xfeb8,
  34664. "sheicoptic",
  34665. 0x03e3,
  34666. "sheqel",
  34667. 0x20aa,
  34668. "sheqelhebrew",
  34669. 0x20aa,
  34670. "sheva",
  34671. 0x05b0,
  34672. "sheva115",
  34673. 0x05b0,
  34674. "sheva15",
  34675. 0x05b0,
  34676. "sheva22",
  34677. 0x05b0,
  34678. "sheva2e",
  34679. 0x05b0,
  34680. "shevahebrew",
  34681. 0x05b0,
  34682. "shevanarrowhebrew",
  34683. 0x05b0,
  34684. "shevaquarterhebrew",
  34685. 0x05b0,
  34686. "shevawidehebrew",
  34687. 0x05b0,
  34688. "shhacyrillic",
  34689. 0x04bb,
  34690. "shimacoptic",
  34691. 0x03ed,
  34692. "shin",
  34693. 0x05e9,
  34694. "shindagesh",
  34695. 0xfb49,
  34696. "shindageshhebrew",
  34697. 0xfb49,
  34698. "shindageshshindot",
  34699. 0xfb2c,
  34700. "shindageshshindothebrew",
  34701. 0xfb2c,
  34702. "shindageshsindot",
  34703. 0xfb2d,
  34704. "shindageshsindothebrew",
  34705. 0xfb2d,
  34706. "shindothebrew",
  34707. 0x05c1,
  34708. "shinhebrew",
  34709. 0x05e9,
  34710. "shinshindot",
  34711. 0xfb2a,
  34712. "shinshindothebrew",
  34713. 0xfb2a,
  34714. "shinsindot",
  34715. 0xfb2b,
  34716. "shinsindothebrew",
  34717. 0xfb2b,
  34718. "shook",
  34719. 0x0282,
  34720. "sigma",
  34721. 0x03c3,
  34722. "sigma1",
  34723. 0x03c2,
  34724. "sigmafinal",
  34725. 0x03c2,
  34726. "sigmalunatesymbolgreek",
  34727. 0x03f2,
  34728. "sihiragana",
  34729. 0x3057,
  34730. "sikatakana",
  34731. 0x30b7,
  34732. "sikatakanahalfwidth",
  34733. 0xff7c,
  34734. "siluqhebrew",
  34735. 0x05bd,
  34736. "siluqlefthebrew",
  34737. 0x05bd,
  34738. "similar",
  34739. 0x223c,
  34740. "sindothebrew",
  34741. 0x05c2,
  34742. "siosacirclekorean",
  34743. 0x3274,
  34744. "siosaparenkorean",
  34745. 0x3214,
  34746. "sioscieuckorean",
  34747. 0x317e,
  34748. "sioscirclekorean",
  34749. 0x3266,
  34750. "sioskiyeokkorean",
  34751. 0x317a,
  34752. "sioskorean",
  34753. 0x3145,
  34754. "siosnieunkorean",
  34755. 0x317b,
  34756. "siosparenkorean",
  34757. 0x3206,
  34758. "siospieupkorean",
  34759. 0x317d,
  34760. "siostikeutkorean",
  34761. 0x317c,
  34762. "six",
  34763. 0x0036,
  34764. "sixarabic",
  34765. 0x0666,
  34766. "sixbengali",
  34767. 0x09ec,
  34768. "sixcircle",
  34769. 0x2465,
  34770. "sixcircleinversesansserif",
  34771. 0x278f,
  34772. "sixdeva",
  34773. 0x096c,
  34774. "sixgujarati",
  34775. 0x0aec,
  34776. "sixgurmukhi",
  34777. 0x0a6c,
  34778. "sixhackarabic",
  34779. 0x0666,
  34780. "sixhangzhou",
  34781. 0x3026,
  34782. "sixideographicparen",
  34783. 0x3225,
  34784. "sixinferior",
  34785. 0x2086,
  34786. "sixmonospace",
  34787. 0xff16,
  34788. "sixoldstyle",
  34789. 0xf736,
  34790. "sixparen",
  34791. 0x2479,
  34792. "sixperiod",
  34793. 0x248d,
  34794. "sixpersian",
  34795. 0x06f6,
  34796. "sixroman",
  34797. 0x2175,
  34798. "sixsuperior",
  34799. 0x2076,
  34800. "sixteencircle",
  34801. 0x246f,
  34802. "sixteencurrencydenominatorbengali",
  34803. 0x09f9,
  34804. "sixteenparen",
  34805. 0x2483,
  34806. "sixteenperiod",
  34807. 0x2497,
  34808. "sixthai",
  34809. 0x0e56,
  34810. "slash",
  34811. 0x002f,
  34812. "slashmonospace",
  34813. 0xff0f,
  34814. "slong",
  34815. 0x017f,
  34816. "slongdotaccent",
  34817. 0x1e9b,
  34818. "smileface",
  34819. 0x263a,
  34820. "smonospace",
  34821. 0xff53,
  34822. "sofpasuqhebrew",
  34823. 0x05c3,
  34824. "softhyphen",
  34825. 0x00ad,
  34826. "softsigncyrillic",
  34827. 0x044c,
  34828. "sohiragana",
  34829. 0x305d,
  34830. "sokatakana",
  34831. 0x30bd,
  34832. "sokatakanahalfwidth",
  34833. 0xff7f,
  34834. "soliduslongoverlaycmb",
  34835. 0x0338,
  34836. "solidusshortoverlaycmb",
  34837. 0x0337,
  34838. "sorusithai",
  34839. 0x0e29,
  34840. "sosalathai",
  34841. 0x0e28,
  34842. "sosothai",
  34843. 0x0e0b,
  34844. "sosuathai",
  34845. 0x0e2a,
  34846. "space",
  34847. 0x0020,
  34848. "spacehackarabic",
  34849. 0x0020,
  34850. "spade",
  34851. 0x2660,
  34852. "spadesuitblack",
  34853. 0x2660,
  34854. "spadesuitwhite",
  34855. 0x2664,
  34856. "sparen",
  34857. 0x24ae,
  34858. "squarebelowcmb",
  34859. 0x033b,
  34860. "squarecc",
  34861. 0x33c4,
  34862. "squarecm",
  34863. 0x339d,
  34864. "squarediagonalcrosshatchfill",
  34865. 0x25a9,
  34866. "squarehorizontalfill",
  34867. 0x25a4,
  34868. "squarekg",
  34869. 0x338f,
  34870. "squarekm",
  34871. 0x339e,
  34872. "squarekmcapital",
  34873. 0x33ce,
  34874. "squareln",
  34875. 0x33d1,
  34876. "squarelog",
  34877. 0x33d2,
  34878. "squaremg",
  34879. 0x338e,
  34880. "squaremil",
  34881. 0x33d5,
  34882. "squaremm",
  34883. 0x339c,
  34884. "squaremsquared",
  34885. 0x33a1,
  34886. "squareorthogonalcrosshatchfill",
  34887. 0x25a6,
  34888. "squareupperlefttolowerrightfill",
  34889. 0x25a7,
  34890. "squareupperrighttolowerleftfill",
  34891. 0x25a8,
  34892. "squareverticalfill",
  34893. 0x25a5,
  34894. "squarewhitewithsmallblack",
  34895. 0x25a3,
  34896. "srsquare",
  34897. 0x33db,
  34898. "ssabengali",
  34899. 0x09b7,
  34900. "ssadeva",
  34901. 0x0937,
  34902. "ssagujarati",
  34903. 0x0ab7,
  34904. "ssangcieuckorean",
  34905. 0x3149,
  34906. "ssanghieuhkorean",
  34907. 0x3185,
  34908. "ssangieungkorean",
  34909. 0x3180,
  34910. "ssangkiyeokkorean",
  34911. 0x3132,
  34912. "ssangnieunkorean",
  34913. 0x3165,
  34914. "ssangpieupkorean",
  34915. 0x3143,
  34916. "ssangsioskorean",
  34917. 0x3146,
  34918. "ssangtikeutkorean",
  34919. 0x3138,
  34920. "ssuperior",
  34921. 0xf6f2,
  34922. "sterling",
  34923. 0x00a3,
  34924. "sterlingmonospace",
  34925. 0xffe1,
  34926. "strokelongoverlaycmb",
  34927. 0x0336,
  34928. "strokeshortoverlaycmb",
  34929. 0x0335,
  34930. "subset",
  34931. 0x2282,
  34932. "subsetnotequal",
  34933. 0x228a,
  34934. "subsetorequal",
  34935. 0x2286,
  34936. "succeeds",
  34937. 0x227b,
  34938. "suchthat",
  34939. 0x220b,
  34940. "suhiragana",
  34941. 0x3059,
  34942. "sukatakana",
  34943. 0x30b9,
  34944. "sukatakanahalfwidth",
  34945. 0xff7d,
  34946. "sukunarabic",
  34947. 0x0652,
  34948. "summation",
  34949. 0x2211,
  34950. "sun",
  34951. 0x263c,
  34952. "superset",
  34953. 0x2283,
  34954. "supersetnotequal",
  34955. 0x228b,
  34956. "supersetorequal",
  34957. 0x2287,
  34958. "svsquare",
  34959. 0x33dc,
  34960. "syouwaerasquare",
  34961. 0x337c,
  34962. "t",
  34963. 0x0074,
  34964. "tabengali",
  34965. 0x09a4,
  34966. "tackdown",
  34967. 0x22a4,
  34968. "tackleft",
  34969. 0x22a3,
  34970. "tadeva",
  34971. 0x0924,
  34972. "tagujarati",
  34973. 0x0aa4,
  34974. "tagurmukhi",
  34975. 0x0a24,
  34976. "taharabic",
  34977. 0x0637,
  34978. "tahfinalarabic",
  34979. 0xfec2,
  34980. "tahinitialarabic",
  34981. 0xfec3,
  34982. "tahiragana",
  34983. 0x305f,
  34984. "tahmedialarabic",
  34985. 0xfec4,
  34986. "taisyouerasquare",
  34987. 0x337d,
  34988. "takatakana",
  34989. 0x30bf,
  34990. "takatakanahalfwidth",
  34991. 0xff80,
  34992. "tatweelarabic",
  34993. 0x0640,
  34994. "tau",
  34995. 0x03c4,
  34996. "tav",
  34997. 0x05ea,
  34998. "tavdages",
  34999. 0xfb4a,
  35000. "tavdagesh",
  35001. 0xfb4a,
  35002. "tavdageshhebrew",
  35003. 0xfb4a,
  35004. "tavhebrew",
  35005. 0x05ea,
  35006. "tbar",
  35007. 0x0167,
  35008. "tbopomofo",
  35009. 0x310a,
  35010. "tcaron",
  35011. 0x0165,
  35012. "tccurl",
  35013. 0x02a8,
  35014. "tcedilla",
  35015. 0x0163,
  35016. "tcheharabic",
  35017. 0x0686,
  35018. "tchehfinalarabic",
  35019. 0xfb7b,
  35020. "tchehinitialarabic",
  35021. 0xfb7c,
  35022. "tchehmedialarabic",
  35023. 0xfb7d,
  35024. "tcircle",
  35025. 0x24e3,
  35026. "tcircumflexbelow",
  35027. 0x1e71,
  35028. "tcommaaccent",
  35029. 0x0163,
  35030. "tdieresis",
  35031. 0x1e97,
  35032. "tdotaccent",
  35033. 0x1e6b,
  35034. "tdotbelow",
  35035. 0x1e6d,
  35036. "tecyrillic",
  35037. 0x0442,
  35038. "tedescendercyrillic",
  35039. 0x04ad,
  35040. "teharabic",
  35041. 0x062a,
  35042. "tehfinalarabic",
  35043. 0xfe96,
  35044. "tehhahinitialarabic",
  35045. 0xfca2,
  35046. "tehhahisolatedarabic",
  35047. 0xfc0c,
  35048. "tehinitialarabic",
  35049. 0xfe97,
  35050. "tehiragana",
  35051. 0x3066,
  35052. "tehjeeminitialarabic",
  35053. 0xfca1,
  35054. "tehjeemisolatedarabic",
  35055. 0xfc0b,
  35056. "tehmarbutaarabic",
  35057. 0x0629,
  35058. "tehmarbutafinalarabic",
  35059. 0xfe94,
  35060. "tehmedialarabic",
  35061. 0xfe98,
  35062. "tehmeeminitialarabic",
  35063. 0xfca4,
  35064. "tehmeemisolatedarabic",
  35065. 0xfc0e,
  35066. "tehnoonfinalarabic",
  35067. 0xfc73,
  35068. "tekatakana",
  35069. 0x30c6,
  35070. "tekatakanahalfwidth",
  35071. 0xff83,
  35072. "telephone",
  35073. 0x2121,
  35074. "telephoneblack",
  35075. 0x260e,
  35076. "telishagedolahebrew",
  35077. 0x05a0,
  35078. "telishaqetanahebrew",
  35079. 0x05a9,
  35080. "tencircle",
  35081. 0x2469,
  35082. "tenideographicparen",
  35083. 0x3229,
  35084. "tenparen",
  35085. 0x247d,
  35086. "tenperiod",
  35087. 0x2491,
  35088. "tenroman",
  35089. 0x2179,
  35090. "tesh",
  35091. 0x02a7,
  35092. "tet",
  35093. 0x05d8,
  35094. "tetdagesh",
  35095. 0xfb38,
  35096. "tetdageshhebrew",
  35097. 0xfb38,
  35098. "tethebrew",
  35099. 0x05d8,
  35100. "tetsecyrillic",
  35101. 0x04b5,
  35102. "tevirhebrew",
  35103. 0x059b,
  35104. "tevirlefthebrew",
  35105. 0x059b,
  35106. "thabengali",
  35107. 0x09a5,
  35108. "thadeva",
  35109. 0x0925,
  35110. "thagujarati",
  35111. 0x0aa5,
  35112. "thagurmukhi",
  35113. 0x0a25,
  35114. "thalarabic",
  35115. 0x0630,
  35116. "thalfinalarabic",
  35117. 0xfeac,
  35118. "thanthakhatlowleftthai",
  35119. 0xf898,
  35120. "thanthakhatlowrightthai",
  35121. 0xf897,
  35122. "thanthakhatthai",
  35123. 0x0e4c,
  35124. "thanthakhatupperleftthai",
  35125. 0xf896,
  35126. "theharabic",
  35127. 0x062b,
  35128. "thehfinalarabic",
  35129. 0xfe9a,
  35130. "thehinitialarabic",
  35131. 0xfe9b,
  35132. "thehmedialarabic",
  35133. 0xfe9c,
  35134. "thereexists",
  35135. 0x2203,
  35136. "therefore",
  35137. 0x2234,
  35138. "theta",
  35139. 0x03b8,
  35140. "theta1",
  35141. 0x03d1,
  35142. "thetasymbolgreek",
  35143. 0x03d1,
  35144. "thieuthacirclekorean",
  35145. 0x3279,
  35146. "thieuthaparenkorean",
  35147. 0x3219,
  35148. "thieuthcirclekorean",
  35149. 0x326b,
  35150. "thieuthkorean",
  35151. 0x314c,
  35152. "thieuthparenkorean",
  35153. 0x320b,
  35154. "thirteencircle",
  35155. 0x246c,
  35156. "thirteenparen",
  35157. 0x2480,
  35158. "thirteenperiod",
  35159. 0x2494,
  35160. "thonangmonthothai",
  35161. 0x0e11,
  35162. "thook",
  35163. 0x01ad,
  35164. "thophuthaothai",
  35165. 0x0e12,
  35166. "thorn",
  35167. 0x00fe,
  35168. "thothahanthai",
  35169. 0x0e17,
  35170. "thothanthai",
  35171. 0x0e10,
  35172. "thothongthai",
  35173. 0x0e18,
  35174. "thothungthai",
  35175. 0x0e16,
  35176. "thousandcyrillic",
  35177. 0x0482,
  35178. "thousandsseparatorarabic",
  35179. 0x066c,
  35180. "thousandsseparatorpersian",
  35181. 0x066c,
  35182. "three",
  35183. 0x0033,
  35184. "threearabic",
  35185. 0x0663,
  35186. "threebengali",
  35187. 0x09e9,
  35188. "threecircle",
  35189. 0x2462,
  35190. "threecircleinversesansserif",
  35191. 0x278c,
  35192. "threedeva",
  35193. 0x0969,
  35194. "threeeighths",
  35195. 0x215c,
  35196. "threegujarati",
  35197. 0x0ae9,
  35198. "threegurmukhi",
  35199. 0x0a69,
  35200. "threehackarabic",
  35201. 0x0663,
  35202. "threehangzhou",
  35203. 0x3023,
  35204. "threeideographicparen",
  35205. 0x3222,
  35206. "threeinferior",
  35207. 0x2083,
  35208. "threemonospace",
  35209. 0xff13,
  35210. "threenumeratorbengali",
  35211. 0x09f6,
  35212. "threeoldstyle",
  35213. 0xf733,
  35214. "threeparen",
  35215. 0x2476,
  35216. "threeperiod",
  35217. 0x248a,
  35218. "threepersian",
  35219. 0x06f3,
  35220. "threequarters",
  35221. 0x00be,
  35222. "threequartersemdash",
  35223. 0xf6de,
  35224. "threeroman",
  35225. 0x2172,
  35226. "threesuperior",
  35227. 0x00b3,
  35228. "threethai",
  35229. 0x0e53,
  35230. "thzsquare",
  35231. 0x3394,
  35232. "tihiragana",
  35233. 0x3061,
  35234. "tikatakana",
  35235. 0x30c1,
  35236. "tikatakanahalfwidth",
  35237. 0xff81,
  35238. "tikeutacirclekorean",
  35239. 0x3270,
  35240. "tikeutaparenkorean",
  35241. 0x3210,
  35242. "tikeutcirclekorean",
  35243. 0x3262,
  35244. "tikeutkorean",
  35245. 0x3137,
  35246. "tikeutparenkorean",
  35247. 0x3202,
  35248. "tilde",
  35249. 0x02dc,
  35250. "tildebelowcmb",
  35251. 0x0330,
  35252. "tildecmb",
  35253. 0x0303,
  35254. "tildecomb",
  35255. 0x0303,
  35256. "tildedoublecmb",
  35257. 0x0360,
  35258. "tildeoperator",
  35259. 0x223c,
  35260. "tildeoverlaycmb",
  35261. 0x0334,
  35262. "tildeverticalcmb",
  35263. 0x033e,
  35264. "timescircle",
  35265. 0x2297,
  35266. "tipehahebrew",
  35267. 0x0596,
  35268. "tipehalefthebrew",
  35269. 0x0596,
  35270. "tippigurmukhi",
  35271. 0x0a70,
  35272. "titlocyrilliccmb",
  35273. 0x0483,
  35274. "tiwnarmenian",
  35275. 0x057f,
  35276. "tlinebelow",
  35277. 0x1e6f,
  35278. "tmonospace",
  35279. 0xff54,
  35280. "toarmenian",
  35281. 0x0569,
  35282. "tohiragana",
  35283. 0x3068,
  35284. "tokatakana",
  35285. 0x30c8,
  35286. "tokatakanahalfwidth",
  35287. 0xff84,
  35288. "tonebarextrahighmod",
  35289. 0x02e5,
  35290. "tonebarextralowmod",
  35291. 0x02e9,
  35292. "tonebarhighmod",
  35293. 0x02e6,
  35294. "tonebarlowmod",
  35295. 0x02e8,
  35296. "tonebarmidmod",
  35297. 0x02e7,
  35298. "tonefive",
  35299. 0x01bd,
  35300. "tonesix",
  35301. 0x0185,
  35302. "tonetwo",
  35303. 0x01a8,
  35304. "tonos",
  35305. 0x0384,
  35306. "tonsquare",
  35307. 0x3327,
  35308. "topatakthai",
  35309. 0x0e0f,
  35310. "tortoiseshellbracketleft",
  35311. 0x3014,
  35312. "tortoiseshellbracketleftsmall",
  35313. 0xfe5d,
  35314. "tortoiseshellbracketleftvertical",
  35315. 0xfe39,
  35316. "tortoiseshellbracketright",
  35317. 0x3015,
  35318. "tortoiseshellbracketrightsmall",
  35319. 0xfe5e,
  35320. "tortoiseshellbracketrightvertical",
  35321. 0xfe3a,
  35322. "totaothai",
  35323. 0x0e15,
  35324. "tpalatalhook",
  35325. 0x01ab,
  35326. "tparen",
  35327. 0x24af,
  35328. "trademark",
  35329. 0x2122,
  35330. "trademarksans",
  35331. 0xf8ea,
  35332. "trademarkserif",
  35333. 0xf6db,
  35334. "tretroflexhook",
  35335. 0x0288,
  35336. "triagdn",
  35337. 0x25bc,
  35338. "triaglf",
  35339. 0x25c4,
  35340. "triagrt",
  35341. 0x25ba,
  35342. "triagup",
  35343. 0x25b2,
  35344. "ts",
  35345. 0x02a6,
  35346. "tsadi",
  35347. 0x05e6,
  35348. "tsadidagesh",
  35349. 0xfb46,
  35350. "tsadidageshhebrew",
  35351. 0xfb46,
  35352. "tsadihebrew",
  35353. 0x05e6,
  35354. "tsecyrillic",
  35355. 0x0446,
  35356. "tsere",
  35357. 0x05b5,
  35358. "tsere12",
  35359. 0x05b5,
  35360. "tsere1e",
  35361. 0x05b5,
  35362. "tsere2b",
  35363. 0x05b5,
  35364. "tserehebrew",
  35365. 0x05b5,
  35366. "tserenarrowhebrew",
  35367. 0x05b5,
  35368. "tserequarterhebrew",
  35369. 0x05b5,
  35370. "tserewidehebrew",
  35371. 0x05b5,
  35372. "tshecyrillic",
  35373. 0x045b,
  35374. "tsuperior",
  35375. 0xf6f3,
  35376. "ttabengali",
  35377. 0x099f,
  35378. "ttadeva",
  35379. 0x091f,
  35380. "ttagujarati",
  35381. 0x0a9f,
  35382. "ttagurmukhi",
  35383. 0x0a1f,
  35384. "tteharabic",
  35385. 0x0679,
  35386. "ttehfinalarabic",
  35387. 0xfb67,
  35388. "ttehinitialarabic",
  35389. 0xfb68,
  35390. "ttehmedialarabic",
  35391. 0xfb69,
  35392. "tthabengali",
  35393. 0x09a0,
  35394. "tthadeva",
  35395. 0x0920,
  35396. "tthagujarati",
  35397. 0x0aa0,
  35398. "tthagurmukhi",
  35399. 0x0a20,
  35400. "tturned",
  35401. 0x0287,
  35402. "tuhiragana",
  35403. 0x3064,
  35404. "tukatakana",
  35405. 0x30c4,
  35406. "tukatakanahalfwidth",
  35407. 0xff82,
  35408. "tusmallhiragana",
  35409. 0x3063,
  35410. "tusmallkatakana",
  35411. 0x30c3,
  35412. "tusmallkatakanahalfwidth",
  35413. 0xff6f,
  35414. "twelvecircle",
  35415. 0x246b,
  35416. "twelveparen",
  35417. 0x247f,
  35418. "twelveperiod",
  35419. 0x2493,
  35420. "twelveroman",
  35421. 0x217b,
  35422. "twentycircle",
  35423. 0x2473,
  35424. "twentyhangzhou",
  35425. 0x5344,
  35426. "twentyparen",
  35427. 0x2487,
  35428. "twentyperiod",
  35429. 0x249b,
  35430. "two",
  35431. 0x0032,
  35432. "twoarabic",
  35433. 0x0662,
  35434. "twobengali",
  35435. 0x09e8,
  35436. "twocircle",
  35437. 0x2461,
  35438. "twocircleinversesansserif",
  35439. 0x278b,
  35440. "twodeva",
  35441. 0x0968,
  35442. "twodotenleader",
  35443. 0x2025,
  35444. "twodotleader",
  35445. 0x2025,
  35446. "twodotleadervertical",
  35447. 0xfe30,
  35448. "twogujarati",
  35449. 0x0ae8,
  35450. "twogurmukhi",
  35451. 0x0a68,
  35452. "twohackarabic",
  35453. 0x0662,
  35454. "twohangzhou",
  35455. 0x3022,
  35456. "twoideographicparen",
  35457. 0x3221,
  35458. "twoinferior",
  35459. 0x2082,
  35460. "twomonospace",
  35461. 0xff12,
  35462. "twonumeratorbengali",
  35463. 0x09f5,
  35464. "twooldstyle",
  35465. 0xf732,
  35466. "twoparen",
  35467. 0x2475,
  35468. "twoperiod",
  35469. 0x2489,
  35470. "twopersian",
  35471. 0x06f2,
  35472. "tworoman",
  35473. 0x2171,
  35474. "twostroke",
  35475. 0x01bb,
  35476. "twosuperior",
  35477. 0x00b2,
  35478. "twothai",
  35479. 0x0e52,
  35480. "twothirds",
  35481. 0x2154,
  35482. "u",
  35483. 0x0075,
  35484. "uacute",
  35485. 0x00fa,
  35486. "ubar",
  35487. 0x0289,
  35488. "ubengali",
  35489. 0x0989,
  35490. "ubopomofo",
  35491. 0x3128,
  35492. "ubreve",
  35493. 0x016d,
  35494. "ucaron",
  35495. 0x01d4,
  35496. "ucircle",
  35497. 0x24e4,
  35498. "ucircumflex",
  35499. 0x00fb,
  35500. "ucircumflexbelow",
  35501. 0x1e77,
  35502. "ucyrillic",
  35503. 0x0443,
  35504. "udattadeva",
  35505. 0x0951,
  35506. "udblacute",
  35507. 0x0171,
  35508. "udblgrave",
  35509. 0x0215,
  35510. "udeva",
  35511. 0x0909,
  35512. "udieresis",
  35513. 0x00fc,
  35514. "udieresisacute",
  35515. 0x01d8,
  35516. "udieresisbelow",
  35517. 0x1e73,
  35518. "udieresiscaron",
  35519. 0x01da,
  35520. "udieresiscyrillic",
  35521. 0x04f1,
  35522. "udieresisgrave",
  35523. 0x01dc,
  35524. "udieresismacron",
  35525. 0x01d6,
  35526. "udotbelow",
  35527. 0x1ee5,
  35528. "ugrave",
  35529. 0x00f9,
  35530. "ugujarati",
  35531. 0x0a89,
  35532. "ugurmukhi",
  35533. 0x0a09,
  35534. "uhiragana",
  35535. 0x3046,
  35536. "uhookabove",
  35537. 0x1ee7,
  35538. "uhorn",
  35539. 0x01b0,
  35540. "uhornacute",
  35541. 0x1ee9,
  35542. "uhorndotbelow",
  35543. 0x1ef1,
  35544. "uhorngrave",
  35545. 0x1eeb,
  35546. "uhornhookabove",
  35547. 0x1eed,
  35548. "uhorntilde",
  35549. 0x1eef,
  35550. "uhungarumlaut",
  35551. 0x0171,
  35552. "uhungarumlautcyrillic",
  35553. 0x04f3,
  35554. "uinvertedbreve",
  35555. 0x0217,
  35556. "ukatakana",
  35557. 0x30a6,
  35558. "ukatakanahalfwidth",
  35559. 0xff73,
  35560. "ukcyrillic",
  35561. 0x0479,
  35562. "ukorean",
  35563. 0x315c,
  35564. "umacron",
  35565. 0x016b,
  35566. "umacroncyrillic",
  35567. 0x04ef,
  35568. "umacrondieresis",
  35569. 0x1e7b,
  35570. "umatragurmukhi",
  35571. 0x0a41,
  35572. "umonospace",
  35573. 0xff55,
  35574. "underscore",
  35575. 0x005f,
  35576. "underscoredbl",
  35577. 0x2017,
  35578. "underscoremonospace",
  35579. 0xff3f,
  35580. "underscorevertical",
  35581. 0xfe33,
  35582. "underscorewavy",
  35583. 0xfe4f,
  35584. "union",
  35585. 0x222a,
  35586. "universal",
  35587. 0x2200,
  35588. "uogonek",
  35589. 0x0173,
  35590. "uparen",
  35591. 0x24b0,
  35592. "upblock",
  35593. 0x2580,
  35594. "upperdothebrew",
  35595. 0x05c4,
  35596. "upsilon",
  35597. 0x03c5,
  35598. "upsilondieresis",
  35599. 0x03cb,
  35600. "upsilondieresistonos",
  35601. 0x03b0,
  35602. "upsilonlatin",
  35603. 0x028a,
  35604. "upsilontonos",
  35605. 0x03cd,
  35606. "uptackbelowcmb",
  35607. 0x031d,
  35608. "uptackmod",
  35609. 0x02d4,
  35610. "uragurmukhi",
  35611. 0x0a73,
  35612. "uring",
  35613. 0x016f,
  35614. "ushortcyrillic",
  35615. 0x045e,
  35616. "usmallhiragana",
  35617. 0x3045,
  35618. "usmallkatakana",
  35619. 0x30a5,
  35620. "usmallkatakanahalfwidth",
  35621. 0xff69,
  35622. "ustraightcyrillic",
  35623. 0x04af,
  35624. "ustraightstrokecyrillic",
  35625. 0x04b1,
  35626. "utilde",
  35627. 0x0169,
  35628. "utildeacute",
  35629. 0x1e79,
  35630. "utildebelow",
  35631. 0x1e75,
  35632. "uubengali",
  35633. 0x098a,
  35634. "uudeva",
  35635. 0x090a,
  35636. "uugujarati",
  35637. 0x0a8a,
  35638. "uugurmukhi",
  35639. 0x0a0a,
  35640. "uumatragurmukhi",
  35641. 0x0a42,
  35642. "uuvowelsignbengali",
  35643. 0x09c2,
  35644. "uuvowelsigndeva",
  35645. 0x0942,
  35646. "uuvowelsigngujarati",
  35647. 0x0ac2,
  35648. "uvowelsignbengali",
  35649. 0x09c1,
  35650. "uvowelsigndeva",
  35651. 0x0941,
  35652. "uvowelsigngujarati",
  35653. 0x0ac1,
  35654. "v",
  35655. 0x0076,
  35656. "vadeva",
  35657. 0x0935,
  35658. "vagujarati",
  35659. 0x0ab5,
  35660. "vagurmukhi",
  35661. 0x0a35,
  35662. "vakatakana",
  35663. 0x30f7,
  35664. "vav",
  35665. 0x05d5,
  35666. "vavdagesh",
  35667. 0xfb35,
  35668. "vavdagesh65",
  35669. 0xfb35,
  35670. "vavdageshhebrew",
  35671. 0xfb35,
  35672. "vavhebrew",
  35673. 0x05d5,
  35674. "vavholam",
  35675. 0xfb4b,
  35676. "vavholamhebrew",
  35677. 0xfb4b,
  35678. "vavvavhebrew",
  35679. 0x05f0,
  35680. "vavyodhebrew",
  35681. 0x05f1,
  35682. "vcircle",
  35683. 0x24e5,
  35684. "vdotbelow",
  35685. 0x1e7f,
  35686. "vecyrillic",
  35687. 0x0432,
  35688. "veharabic",
  35689. 0x06a4,
  35690. "vehfinalarabic",
  35691. 0xfb6b,
  35692. "vehinitialarabic",
  35693. 0xfb6c,
  35694. "vehmedialarabic",
  35695. 0xfb6d,
  35696. "vekatakana",
  35697. 0x30f9,
  35698. "venus",
  35699. 0x2640,
  35700. "verticalbar",
  35701. 0x007c,
  35702. "verticallineabovecmb",
  35703. 0x030d,
  35704. "verticallinebelowcmb",
  35705. 0x0329,
  35706. "verticallinelowmod",
  35707. 0x02cc,
  35708. "verticallinemod",
  35709. 0x02c8,
  35710. "vewarmenian",
  35711. 0x057e,
  35712. "vhook",
  35713. 0x028b,
  35714. "vikatakana",
  35715. 0x30f8,
  35716. "viramabengali",
  35717. 0x09cd,
  35718. "viramadeva",
  35719. 0x094d,
  35720. "viramagujarati",
  35721. 0x0acd,
  35722. "visargabengali",
  35723. 0x0983,
  35724. "visargadeva",
  35725. 0x0903,
  35726. "visargagujarati",
  35727. 0x0a83,
  35728. "vmonospace",
  35729. 0xff56,
  35730. "voarmenian",
  35731. 0x0578,
  35732. "voicediterationhiragana",
  35733. 0x309e,
  35734. "voicediterationkatakana",
  35735. 0x30fe,
  35736. "voicedmarkkana",
  35737. 0x309b,
  35738. "voicedmarkkanahalfwidth",
  35739. 0xff9e,
  35740. "vokatakana",
  35741. 0x30fa,
  35742. "vparen",
  35743. 0x24b1,
  35744. "vtilde",
  35745. 0x1e7d,
  35746. "vturned",
  35747. 0x028c,
  35748. "vuhiragana",
  35749. 0x3094,
  35750. "vukatakana",
  35751. 0x30f4,
  35752. "w",
  35753. 0x0077,
  35754. "wacute",
  35755. 0x1e83,
  35756. "waekorean",
  35757. 0x3159,
  35758. "wahiragana",
  35759. 0x308f,
  35760. "wakatakana",
  35761. 0x30ef,
  35762. "wakatakanahalfwidth",
  35763. 0xff9c,
  35764. "wakorean",
  35765. 0x3158,
  35766. "wasmallhiragana",
  35767. 0x308e,
  35768. "wasmallkatakana",
  35769. 0x30ee,
  35770. "wattosquare",
  35771. 0x3357,
  35772. "wavedash",
  35773. 0x301c,
  35774. "wavyunderscorevertical",
  35775. 0xfe34,
  35776. "wawarabic",
  35777. 0x0648,
  35778. "wawfinalarabic",
  35779. 0xfeee,
  35780. "wawhamzaabovearabic",
  35781. 0x0624,
  35782. "wawhamzaabovefinalarabic",
  35783. 0xfe86,
  35784. "wbsquare",
  35785. 0x33dd,
  35786. "wcircle",
  35787. 0x24e6,
  35788. "wcircumflex",
  35789. 0x0175,
  35790. "wdieresis",
  35791. 0x1e85,
  35792. "wdotaccent",
  35793. 0x1e87,
  35794. "wdotbelow",
  35795. 0x1e89,
  35796. "wehiragana",
  35797. 0x3091,
  35798. "weierstrass",
  35799. 0x2118,
  35800. "wekatakana",
  35801. 0x30f1,
  35802. "wekorean",
  35803. 0x315e,
  35804. "weokorean",
  35805. 0x315d,
  35806. "wgrave",
  35807. 0x1e81,
  35808. "whitebullet",
  35809. 0x25e6,
  35810. "whitecircle",
  35811. 0x25cb,
  35812. "whitecircleinverse",
  35813. 0x25d9,
  35814. "whitecornerbracketleft",
  35815. 0x300e,
  35816. "whitecornerbracketleftvertical",
  35817. 0xfe43,
  35818. "whitecornerbracketright",
  35819. 0x300f,
  35820. "whitecornerbracketrightvertical",
  35821. 0xfe44,
  35822. "whitediamond",
  35823. 0x25c7,
  35824. "whitediamondcontainingblacksmalldiamond",
  35825. 0x25c8,
  35826. "whitedownpointingsmalltriangle",
  35827. 0x25bf,
  35828. "whitedownpointingtriangle",
  35829. 0x25bd,
  35830. "whiteleftpointingsmalltriangle",
  35831. 0x25c3,
  35832. "whiteleftpointingtriangle",
  35833. 0x25c1,
  35834. "whitelenticularbracketleft",
  35835. 0x3016,
  35836. "whitelenticularbracketright",
  35837. 0x3017,
  35838. "whiterightpointingsmalltriangle",
  35839. 0x25b9,
  35840. "whiterightpointingtriangle",
  35841. 0x25b7,
  35842. "whitesmallsquare",
  35843. 0x25ab,
  35844. "whitesmilingface",
  35845. 0x263a,
  35846. "whitesquare",
  35847. 0x25a1,
  35848. "whitestar",
  35849. 0x2606,
  35850. "whitetelephone",
  35851. 0x260f,
  35852. "whitetortoiseshellbracketleft",
  35853. 0x3018,
  35854. "whitetortoiseshellbracketright",
  35855. 0x3019,
  35856. "whiteuppointingsmalltriangle",
  35857. 0x25b5,
  35858. "whiteuppointingtriangle",
  35859. 0x25b3,
  35860. "wihiragana",
  35861. 0x3090,
  35862. "wikatakana",
  35863. 0x30f0,
  35864. "wikorean",
  35865. 0x315f,
  35866. "wmonospace",
  35867. 0xff57,
  35868. "wohiragana",
  35869. 0x3092,
  35870. "wokatakana",
  35871. 0x30f2,
  35872. "wokatakanahalfwidth",
  35873. 0xff66,
  35874. "won",
  35875. 0x20a9,
  35876. "wonmonospace",
  35877. 0xffe6,
  35878. "wowaenthai",
  35879. 0x0e27,
  35880. "wparen",
  35881. 0x24b2,
  35882. "wring",
  35883. 0x1e98,
  35884. "wsuperior",
  35885. 0x02b7,
  35886. "wturned",
  35887. 0x028d,
  35888. "wynn",
  35889. 0x01bf,
  35890. "x",
  35891. 0x0078,
  35892. "xabovecmb",
  35893. 0x033d,
  35894. "xbopomofo",
  35895. 0x3112,
  35896. "xcircle",
  35897. 0x24e7,
  35898. "xdieresis",
  35899. 0x1e8d,
  35900. "xdotaccent",
  35901. 0x1e8b,
  35902. "xeharmenian",
  35903. 0x056d,
  35904. "xi",
  35905. 0x03be,
  35906. "xmonospace",
  35907. 0xff58,
  35908. "xparen",
  35909. 0x24b3,
  35910. "xsuperior",
  35911. 0x02e3,
  35912. "y",
  35913. 0x0079,
  35914. "yaadosquare",
  35915. 0x334e,
  35916. "yabengali",
  35917. 0x09af,
  35918. "yacute",
  35919. 0x00fd,
  35920. "yadeva",
  35921. 0x092f,
  35922. "yaekorean",
  35923. 0x3152,
  35924. "yagujarati",
  35925. 0x0aaf,
  35926. "yagurmukhi",
  35927. 0x0a2f,
  35928. "yahiragana",
  35929. 0x3084,
  35930. "yakatakana",
  35931. 0x30e4,
  35932. "yakatakanahalfwidth",
  35933. 0xff94,
  35934. "yakorean",
  35935. 0x3151,
  35936. "yamakkanthai",
  35937. 0x0e4e,
  35938. "yasmallhiragana",
  35939. 0x3083,
  35940. "yasmallkatakana",
  35941. 0x30e3,
  35942. "yasmallkatakanahalfwidth",
  35943. 0xff6c,
  35944. "yatcyrillic",
  35945. 0x0463,
  35946. "ycircle",
  35947. 0x24e8,
  35948. "ycircumflex",
  35949. 0x0177,
  35950. "ydieresis",
  35951. 0x00ff,
  35952. "ydotaccent",
  35953. 0x1e8f,
  35954. "ydotbelow",
  35955. 0x1ef5,
  35956. "yeharabic",
  35957. 0x064a,
  35958. "yehbarreearabic",
  35959. 0x06d2,
  35960. "yehbarreefinalarabic",
  35961. 0xfbaf,
  35962. "yehfinalarabic",
  35963. 0xfef2,
  35964. "yehhamzaabovearabic",
  35965. 0x0626,
  35966. "yehhamzaabovefinalarabic",
  35967. 0xfe8a,
  35968. "yehhamzaaboveinitialarabic",
  35969. 0xfe8b,
  35970. "yehhamzaabovemedialarabic",
  35971. 0xfe8c,
  35972. "yehinitialarabic",
  35973. 0xfef3,
  35974. "yehmedialarabic",
  35975. 0xfef4,
  35976. "yehmeeminitialarabic",
  35977. 0xfcdd,
  35978. "yehmeemisolatedarabic",
  35979. 0xfc58,
  35980. "yehnoonfinalarabic",
  35981. 0xfc94,
  35982. "yehthreedotsbelowarabic",
  35983. 0x06d1,
  35984. "yekorean",
  35985. 0x3156,
  35986. "yen",
  35987. 0x00a5,
  35988. "yenmonospace",
  35989. 0xffe5,
  35990. "yeokorean",
  35991. 0x3155,
  35992. "yeorinhieuhkorean",
  35993. 0x3186,
  35994. "yerahbenyomohebrew",
  35995. 0x05aa,
  35996. "yerahbenyomolefthebrew",
  35997. 0x05aa,
  35998. "yericyrillic",
  35999. 0x044b,
  36000. "yerudieresiscyrillic",
  36001. 0x04f9,
  36002. "yesieungkorean",
  36003. 0x3181,
  36004. "yesieungpansioskorean",
  36005. 0x3183,
  36006. "yesieungsioskorean",
  36007. 0x3182,
  36008. "yetivhebrew",
  36009. 0x059a,
  36010. "ygrave",
  36011. 0x1ef3,
  36012. "yhook",
  36013. 0x01b4,
  36014. "yhookabove",
  36015. 0x1ef7,
  36016. "yiarmenian",
  36017. 0x0575,
  36018. "yicyrillic",
  36019. 0x0457,
  36020. "yikorean",
  36021. 0x3162,
  36022. "yinyang",
  36023. 0x262f,
  36024. "yiwnarmenian",
  36025. 0x0582,
  36026. "ymonospace",
  36027. 0xff59,
  36028. "yod",
  36029. 0x05d9,
  36030. "yoddagesh",
  36031. 0xfb39,
  36032. "yoddageshhebrew",
  36033. 0xfb39,
  36034. "yodhebrew",
  36035. 0x05d9,
  36036. "yodyodhebrew",
  36037. 0x05f2,
  36038. "yodyodpatahhebrew",
  36039. 0xfb1f,
  36040. "yohiragana",
  36041. 0x3088,
  36042. "yoikorean",
  36043. 0x3189,
  36044. "yokatakana",
  36045. 0x30e8,
  36046. "yokatakanahalfwidth",
  36047. 0xff96,
  36048. "yokorean",
  36049. 0x315b,
  36050. "yosmallhiragana",
  36051. 0x3087,
  36052. "yosmallkatakana",
  36053. 0x30e7,
  36054. "yosmallkatakanahalfwidth",
  36055. 0xff6e,
  36056. "yotgreek",
  36057. 0x03f3,
  36058. "yoyaekorean",
  36059. 0x3188,
  36060. "yoyakorean",
  36061. 0x3187,
  36062. "yoyakthai",
  36063. 0x0e22,
  36064. "yoyingthai",
  36065. 0x0e0d,
  36066. "yparen",
  36067. 0x24b4,
  36068. "ypogegrammeni",
  36069. 0x037a,
  36070. "ypogegrammenigreekcmb",
  36071. 0x0345,
  36072. "yr",
  36073. 0x01a6,
  36074. "yring",
  36075. 0x1e99,
  36076. "ysuperior",
  36077. 0x02b8,
  36078. "ytilde",
  36079. 0x1ef9,
  36080. "yturned",
  36081. 0x028e,
  36082. "yuhiragana",
  36083. 0x3086,
  36084. "yuikorean",
  36085. 0x318c,
  36086. "yukatakana",
  36087. 0x30e6,
  36088. "yukatakanahalfwidth",
  36089. 0xff95,
  36090. "yukorean",
  36091. 0x3160,
  36092. "yusbigcyrillic",
  36093. 0x046b,
  36094. "yusbigiotifiedcyrillic",
  36095. 0x046d,
  36096. "yuslittlecyrillic",
  36097. 0x0467,
  36098. "yuslittleiotifiedcyrillic",
  36099. 0x0469,
  36100. "yusmallhiragana",
  36101. 0x3085,
  36102. "yusmallkatakana",
  36103. 0x30e5,
  36104. "yusmallkatakanahalfwidth",
  36105. 0xff6d,
  36106. "yuyekorean",
  36107. 0x318b,
  36108. "yuyeokorean",
  36109. 0x318a,
  36110. "yyabengali",
  36111. 0x09df,
  36112. "yyadeva",
  36113. 0x095f,
  36114. "z",
  36115. 0x007a,
  36116. "zaarmenian",
  36117. 0x0566,
  36118. "zacute",
  36119. 0x017a,
  36120. "zadeva",
  36121. 0x095b,
  36122. "zagurmukhi",
  36123. 0x0a5b,
  36124. "zaharabic",
  36125. 0x0638,
  36126. "zahfinalarabic",
  36127. 0xfec6,
  36128. "zahinitialarabic",
  36129. 0xfec7,
  36130. "zahiragana",
  36131. 0x3056,
  36132. "zahmedialarabic",
  36133. 0xfec8,
  36134. "zainarabic",
  36135. 0x0632,
  36136. "zainfinalarabic",
  36137. 0xfeb0,
  36138. "zakatakana",
  36139. 0x30b6,
  36140. "zaqefgadolhebrew",
  36141. 0x0595,
  36142. "zaqefqatanhebrew",
  36143. 0x0594,
  36144. "zarqahebrew",
  36145. 0x0598,
  36146. "zayin",
  36147. 0x05d6,
  36148. "zayindagesh",
  36149. 0xfb36,
  36150. "zayindageshhebrew",
  36151. 0xfb36,
  36152. "zayinhebrew",
  36153. 0x05d6,
  36154. "zbopomofo",
  36155. 0x3117,
  36156. "zcaron",
  36157. 0x017e,
  36158. "zcircle",
  36159. 0x24e9,
  36160. "zcircumflex",
  36161. 0x1e91,
  36162. "zcurl",
  36163. 0x0291,
  36164. "zdot",
  36165. 0x017c,
  36166. "zdotaccent",
  36167. 0x017c,
  36168. "zdotbelow",
  36169. 0x1e93,
  36170. "zecyrillic",
  36171. 0x0437,
  36172. "zedescendercyrillic",
  36173. 0x0499,
  36174. "zedieresiscyrillic",
  36175. 0x04df,
  36176. "zehiragana",
  36177. 0x305c,
  36178. "zekatakana",
  36179. 0x30bc,
  36180. "zero",
  36181. 0x0030,
  36182. "zeroarabic",
  36183. 0x0660,
  36184. "zerobengali",
  36185. 0x09e6,
  36186. "zerodeva",
  36187. 0x0966,
  36188. "zerogujarati",
  36189. 0x0ae6,
  36190. "zerogurmukhi",
  36191. 0x0a66,
  36192. "zerohackarabic",
  36193. 0x0660,
  36194. "zeroinferior",
  36195. 0x2080,
  36196. "zeromonospace",
  36197. 0xff10,
  36198. "zerooldstyle",
  36199. 0xf730,
  36200. "zeropersian",
  36201. 0x06f0,
  36202. "zerosuperior",
  36203. 0x2070,
  36204. "zerothai",
  36205. 0x0e50,
  36206. "zerowidthjoiner",
  36207. 0xfeff,
  36208. "zerowidthnonjoiner",
  36209. 0x200c,
  36210. "zerowidthspace",
  36211. 0x200b,
  36212. "zeta",
  36213. 0x03b6,
  36214. "zhbopomofo",
  36215. 0x3113,
  36216. "zhearmenian",
  36217. 0x056a,
  36218. "zhebrevecyrillic",
  36219. 0x04c2,
  36220. "zhecyrillic",
  36221. 0x0436,
  36222. "zhedescendercyrillic",
  36223. 0x0497,
  36224. "zhedieresiscyrillic",
  36225. 0x04dd,
  36226. "zihiragana",
  36227. 0x3058,
  36228. "zikatakana",
  36229. 0x30b8,
  36230. "zinorhebrew",
  36231. 0x05ae,
  36232. "zlinebelow",
  36233. 0x1e95,
  36234. "zmonospace",
  36235. 0xff5a,
  36236. "zohiragana",
  36237. 0x305e,
  36238. "zokatakana",
  36239. 0x30be,
  36240. "zparen",
  36241. 0x24b5,
  36242. "zretroflexhook",
  36243. 0x0290,
  36244. "zstroke",
  36245. 0x01b6,
  36246. "zuhiragana",
  36247. 0x305a,
  36248. "zukatakana",
  36249. 0x30ba,
  36250. ".notdef",
  36251. 0x0000,
  36252. "angbracketleftbig",
  36253. 0x2329,
  36254. "angbracketleftBig",
  36255. 0x2329,
  36256. "angbracketleftbigg",
  36257. 0x2329,
  36258. "angbracketleftBigg",
  36259. 0x2329,
  36260. "angbracketrightBig",
  36261. 0x232a,
  36262. "angbracketrightbig",
  36263. 0x232a,
  36264. "angbracketrightBigg",
  36265. 0x232a,
  36266. "angbracketrightbigg",
  36267. 0x232a,
  36268. "arrowhookleft",
  36269. 0x21aa,
  36270. "arrowhookright",
  36271. 0x21a9,
  36272. "arrowlefttophalf",
  36273. 0x21bc,
  36274. "arrowleftbothalf",
  36275. 0x21bd,
  36276. "arrownortheast",
  36277. 0x2197,
  36278. "arrownorthwest",
  36279. 0x2196,
  36280. "arrowrighttophalf",
  36281. 0x21c0,
  36282. "arrowrightbothalf",
  36283. 0x21c1,
  36284. "arrowsoutheast",
  36285. 0x2198,
  36286. "arrowsouthwest",
  36287. 0x2199,
  36288. "backslashbig",
  36289. 0x2216,
  36290. "backslashBig",
  36291. 0x2216,
  36292. "backslashBigg",
  36293. 0x2216,
  36294. "backslashbigg",
  36295. 0x2216,
  36296. "bardbl",
  36297. 0x2016,
  36298. "bracehtipdownleft",
  36299. 0xfe37,
  36300. "bracehtipdownright",
  36301. 0xfe37,
  36302. "bracehtipupleft",
  36303. 0xfe38,
  36304. "bracehtipupright",
  36305. 0xfe38,
  36306. "braceleftBig",
  36307. 0x007b,
  36308. "braceleftbig",
  36309. 0x007b,
  36310. "braceleftbigg",
  36311. 0x007b,
  36312. "braceleftBigg",
  36313. 0x007b,
  36314. "bracerightBig",
  36315. 0x007d,
  36316. "bracerightbig",
  36317. 0x007d,
  36318. "bracerightbigg",
  36319. 0x007d,
  36320. "bracerightBigg",
  36321. 0x007d,
  36322. "bracketleftbig",
  36323. 0x005b,
  36324. "bracketleftBig",
  36325. 0x005b,
  36326. "bracketleftbigg",
  36327. 0x005b,
  36328. "bracketleftBigg",
  36329. 0x005b,
  36330. "bracketrightBig",
  36331. 0x005d,
  36332. "bracketrightbig",
  36333. 0x005d,
  36334. "bracketrightbigg",
  36335. 0x005d,
  36336. "bracketrightBigg",
  36337. 0x005d,
  36338. "ceilingleftbig",
  36339. 0x2308,
  36340. "ceilingleftBig",
  36341. 0x2308,
  36342. "ceilingleftBigg",
  36343. 0x2308,
  36344. "ceilingleftbigg",
  36345. 0x2308,
  36346. "ceilingrightbig",
  36347. 0x2309,
  36348. "ceilingrightBig",
  36349. 0x2309,
  36350. "ceilingrightbigg",
  36351. 0x2309,
  36352. "ceilingrightBigg",
  36353. 0x2309,
  36354. "circledotdisplay",
  36355. 0x2299,
  36356. "circledottext",
  36357. 0x2299,
  36358. "circlemultiplydisplay",
  36359. 0x2297,
  36360. "circlemultiplytext",
  36361. 0x2297,
  36362. "circleplusdisplay",
  36363. 0x2295,
  36364. "circleplustext",
  36365. 0x2295,
  36366. "contintegraldisplay",
  36367. 0x222e,
  36368. "contintegraltext",
  36369. 0x222e,
  36370. "coproductdisplay",
  36371. 0x2210,
  36372. "coproducttext",
  36373. 0x2210,
  36374. "floorleftBig",
  36375. 0x230a,
  36376. "floorleftbig",
  36377. 0x230a,
  36378. "floorleftbigg",
  36379. 0x230a,
  36380. "floorleftBigg",
  36381. 0x230a,
  36382. "floorrightbig",
  36383. 0x230b,
  36384. "floorrightBig",
  36385. 0x230b,
  36386. "floorrightBigg",
  36387. 0x230b,
  36388. "floorrightbigg",
  36389. 0x230b,
  36390. "hatwide",
  36391. 0x0302,
  36392. "hatwider",
  36393. 0x0302,
  36394. "hatwidest",
  36395. 0x0302,
  36396. "intercal",
  36397. 0x1d40,
  36398. "integraldisplay",
  36399. 0x222b,
  36400. "integraltext",
  36401. 0x222b,
  36402. "intersectiondisplay",
  36403. 0x22c2,
  36404. "intersectiontext",
  36405. 0x22c2,
  36406. "logicalanddisplay",
  36407. 0x2227,
  36408. "logicalandtext",
  36409. 0x2227,
  36410. "logicalordisplay",
  36411. 0x2228,
  36412. "logicalortext",
  36413. 0x2228,
  36414. "parenleftBig",
  36415. 0x0028,
  36416. "parenleftbig",
  36417. 0x0028,
  36418. "parenleftBigg",
  36419. 0x0028,
  36420. "parenleftbigg",
  36421. 0x0028,
  36422. "parenrightBig",
  36423. 0x0029,
  36424. "parenrightbig",
  36425. 0x0029,
  36426. "parenrightBigg",
  36427. 0x0029,
  36428. "parenrightbigg",
  36429. 0x0029,
  36430. "prime",
  36431. 0x2032,
  36432. "productdisplay",
  36433. 0x220f,
  36434. "producttext",
  36435. 0x220f,
  36436. "radicalbig",
  36437. 0x221a,
  36438. "radicalBig",
  36439. 0x221a,
  36440. "radicalBigg",
  36441. 0x221a,
  36442. "radicalbigg",
  36443. 0x221a,
  36444. "radicalbt",
  36445. 0x221a,
  36446. "radicaltp",
  36447. 0x221a,
  36448. "radicalvertex",
  36449. 0x221a,
  36450. "slashbig",
  36451. 0x002f,
  36452. "slashBig",
  36453. 0x002f,
  36454. "slashBigg",
  36455. 0x002f,
  36456. "slashbigg",
  36457. 0x002f,
  36458. "summationdisplay",
  36459. 0x2211,
  36460. "summationtext",
  36461. 0x2211,
  36462. "tildewide",
  36463. 0x02dc,
  36464. "tildewider",
  36465. 0x02dc,
  36466. "tildewidest",
  36467. 0x02dc,
  36468. "uniondisplay",
  36469. 0x22c3,
  36470. "unionmultidisplay",
  36471. 0x228e,
  36472. "unionmultitext",
  36473. 0x228e,
  36474. "unionsqdisplay",
  36475. 0x2294,
  36476. "unionsqtext",
  36477. 0x2294,
  36478. "uniontext",
  36479. 0x22c3,
  36480. "vextenddouble",
  36481. 0x2225,
  36482. "vextendsingle",
  36483. 0x2223
  36484. ];
  36485. });
  36486. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  36487. return [
  36488. "space",
  36489. 0x0020,
  36490. "a1",
  36491. 0x2701,
  36492. "a2",
  36493. 0x2702,
  36494. "a202",
  36495. 0x2703,
  36496. "a3",
  36497. 0x2704,
  36498. "a4",
  36499. 0x260e,
  36500. "a5",
  36501. 0x2706,
  36502. "a119",
  36503. 0x2707,
  36504. "a118",
  36505. 0x2708,
  36506. "a117",
  36507. 0x2709,
  36508. "a11",
  36509. 0x261b,
  36510. "a12",
  36511. 0x261e,
  36512. "a13",
  36513. 0x270c,
  36514. "a14",
  36515. 0x270d,
  36516. "a15",
  36517. 0x270e,
  36518. "a16",
  36519. 0x270f,
  36520. "a105",
  36521. 0x2710,
  36522. "a17",
  36523. 0x2711,
  36524. "a18",
  36525. 0x2712,
  36526. "a19",
  36527. 0x2713,
  36528. "a20",
  36529. 0x2714,
  36530. "a21",
  36531. 0x2715,
  36532. "a22",
  36533. 0x2716,
  36534. "a23",
  36535. 0x2717,
  36536. "a24",
  36537. 0x2718,
  36538. "a25",
  36539. 0x2719,
  36540. "a26",
  36541. 0x271a,
  36542. "a27",
  36543. 0x271b,
  36544. "a28",
  36545. 0x271c,
  36546. "a6",
  36547. 0x271d,
  36548. "a7",
  36549. 0x271e,
  36550. "a8",
  36551. 0x271f,
  36552. "a9",
  36553. 0x2720,
  36554. "a10",
  36555. 0x2721,
  36556. "a29",
  36557. 0x2722,
  36558. "a30",
  36559. 0x2723,
  36560. "a31",
  36561. 0x2724,
  36562. "a32",
  36563. 0x2725,
  36564. "a33",
  36565. 0x2726,
  36566. "a34",
  36567. 0x2727,
  36568. "a35",
  36569. 0x2605,
  36570. "a36",
  36571. 0x2729,
  36572. "a37",
  36573. 0x272a,
  36574. "a38",
  36575. 0x272b,
  36576. "a39",
  36577. 0x272c,
  36578. "a40",
  36579. 0x272d,
  36580. "a41",
  36581. 0x272e,
  36582. "a42",
  36583. 0x272f,
  36584. "a43",
  36585. 0x2730,
  36586. "a44",
  36587. 0x2731,
  36588. "a45",
  36589. 0x2732,
  36590. "a46",
  36591. 0x2733,
  36592. "a47",
  36593. 0x2734,
  36594. "a48",
  36595. 0x2735,
  36596. "a49",
  36597. 0x2736,
  36598. "a50",
  36599. 0x2737,
  36600. "a51",
  36601. 0x2738,
  36602. "a52",
  36603. 0x2739,
  36604. "a53",
  36605. 0x273a,
  36606. "a54",
  36607. 0x273b,
  36608. "a55",
  36609. 0x273c,
  36610. "a56",
  36611. 0x273d,
  36612. "a57",
  36613. 0x273e,
  36614. "a58",
  36615. 0x273f,
  36616. "a59",
  36617. 0x2740,
  36618. "a60",
  36619. 0x2741,
  36620. "a61",
  36621. 0x2742,
  36622. "a62",
  36623. 0x2743,
  36624. "a63",
  36625. 0x2744,
  36626. "a64",
  36627. 0x2745,
  36628. "a65",
  36629. 0x2746,
  36630. "a66",
  36631. 0x2747,
  36632. "a67",
  36633. 0x2748,
  36634. "a68",
  36635. 0x2749,
  36636. "a69",
  36637. 0x274a,
  36638. "a70",
  36639. 0x274b,
  36640. "a71",
  36641. 0x25cf,
  36642. "a72",
  36643. 0x274d,
  36644. "a73",
  36645. 0x25a0,
  36646. "a74",
  36647. 0x274f,
  36648. "a203",
  36649. 0x2750,
  36650. "a75",
  36651. 0x2751,
  36652. "a204",
  36653. 0x2752,
  36654. "a76",
  36655. 0x25b2,
  36656. "a77",
  36657. 0x25bc,
  36658. "a78",
  36659. 0x25c6,
  36660. "a79",
  36661. 0x2756,
  36662. "a81",
  36663. 0x25d7,
  36664. "a82",
  36665. 0x2758,
  36666. "a83",
  36667. 0x2759,
  36668. "a84",
  36669. 0x275a,
  36670. "a97",
  36671. 0x275b,
  36672. "a98",
  36673. 0x275c,
  36674. "a99",
  36675. 0x275d,
  36676. "a100",
  36677. 0x275e,
  36678. "a101",
  36679. 0x2761,
  36680. "a102",
  36681. 0x2762,
  36682. "a103",
  36683. 0x2763,
  36684. "a104",
  36685. 0x2764,
  36686. "a106",
  36687. 0x2765,
  36688. "a107",
  36689. 0x2766,
  36690. "a108",
  36691. 0x2767,
  36692. "a112",
  36693. 0x2663,
  36694. "a111",
  36695. 0x2666,
  36696. "a110",
  36697. 0x2665,
  36698. "a109",
  36699. 0x2660,
  36700. "a120",
  36701. 0x2460,
  36702. "a121",
  36703. 0x2461,
  36704. "a122",
  36705. 0x2462,
  36706. "a123",
  36707. 0x2463,
  36708. "a124",
  36709. 0x2464,
  36710. "a125",
  36711. 0x2465,
  36712. "a126",
  36713. 0x2466,
  36714. "a127",
  36715. 0x2467,
  36716. "a128",
  36717. 0x2468,
  36718. "a129",
  36719. 0x2469,
  36720. "a130",
  36721. 0x2776,
  36722. "a131",
  36723. 0x2777,
  36724. "a132",
  36725. 0x2778,
  36726. "a133",
  36727. 0x2779,
  36728. "a134",
  36729. 0x277a,
  36730. "a135",
  36731. 0x277b,
  36732. "a136",
  36733. 0x277c,
  36734. "a137",
  36735. 0x277d,
  36736. "a138",
  36737. 0x277e,
  36738. "a139",
  36739. 0x277f,
  36740. "a140",
  36741. 0x2780,
  36742. "a141",
  36743. 0x2781,
  36744. "a142",
  36745. 0x2782,
  36746. "a143",
  36747. 0x2783,
  36748. "a144",
  36749. 0x2784,
  36750. "a145",
  36751. 0x2785,
  36752. "a146",
  36753. 0x2786,
  36754. "a147",
  36755. 0x2787,
  36756. "a148",
  36757. 0x2788,
  36758. "a149",
  36759. 0x2789,
  36760. "a150",
  36761. 0x278a,
  36762. "a151",
  36763. 0x278b,
  36764. "a152",
  36765. 0x278c,
  36766. "a153",
  36767. 0x278d,
  36768. "a154",
  36769. 0x278e,
  36770. "a155",
  36771. 0x278f,
  36772. "a156",
  36773. 0x2790,
  36774. "a157",
  36775. 0x2791,
  36776. "a158",
  36777. 0x2792,
  36778. "a159",
  36779. 0x2793,
  36780. "a160",
  36781. 0x2794,
  36782. "a161",
  36783. 0x2192,
  36784. "a163",
  36785. 0x2194,
  36786. "a164",
  36787. 0x2195,
  36788. "a196",
  36789. 0x2798,
  36790. "a165",
  36791. 0x2799,
  36792. "a192",
  36793. 0x279a,
  36794. "a166",
  36795. 0x279b,
  36796. "a167",
  36797. 0x279c,
  36798. "a168",
  36799. 0x279d,
  36800. "a169",
  36801. 0x279e,
  36802. "a170",
  36803. 0x279f,
  36804. "a171",
  36805. 0x27a0,
  36806. "a172",
  36807. 0x27a1,
  36808. "a173",
  36809. 0x27a2,
  36810. "a162",
  36811. 0x27a3,
  36812. "a174",
  36813. 0x27a4,
  36814. "a175",
  36815. 0x27a5,
  36816. "a176",
  36817. 0x27a6,
  36818. "a177",
  36819. 0x27a7,
  36820. "a178",
  36821. 0x27a8,
  36822. "a179",
  36823. 0x27a9,
  36824. "a193",
  36825. 0x27aa,
  36826. "a180",
  36827. 0x27ab,
  36828. "a199",
  36829. 0x27ac,
  36830. "a181",
  36831. 0x27ad,
  36832. "a200",
  36833. 0x27ae,
  36834. "a182",
  36835. 0x27af,
  36836. "a201",
  36837. 0x27b1,
  36838. "a183",
  36839. 0x27b2,
  36840. "a184",
  36841. 0x27b3,
  36842. "a197",
  36843. 0x27b4,
  36844. "a185",
  36845. 0x27b5,
  36846. "a194",
  36847. 0x27b6,
  36848. "a198",
  36849. 0x27b7,
  36850. "a186",
  36851. 0x27b8,
  36852. "a195",
  36853. 0x27b9,
  36854. "a187",
  36855. 0x27ba,
  36856. "a188",
  36857. 0x27bb,
  36858. "a189",
  36859. 0x27bc,
  36860. "a190",
  36861. 0x27bd,
  36862. "a191",
  36863. 0x27be,
  36864. "a89",
  36865. 0x2768,
  36866. "a90",
  36867. 0x2769,
  36868. "a93",
  36869. 0x276a,
  36870. "a94",
  36871. 0x276b,
  36872. "a91",
  36873. 0x276c,
  36874. "a92",
  36875. 0x276d,
  36876. "a205",
  36877. 0x276e,
  36878. "a85",
  36879. 0x276f,
  36880. "a206",
  36881. 0x2770,
  36882. "a86",
  36883. 0x2771,
  36884. "a87",
  36885. 0x2772,
  36886. "a88",
  36887. 0x2773,
  36888. "a95",
  36889. 0x2774,
  36890. "a96",
  36891. 0x2775,
  36892. ".notdef",
  36893. 0x0000
  36894. ];
  36895. });
  36896. /***/ }),
  36897. /* 169 */
  36898. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  36899. "use strict";
  36900. __w_pdfjs_require__.r(__webpack_exports__);
  36901. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  36902. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  36903. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  36904. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  36905. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  36906. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  36907. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  36908. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  36909. /* harmony export */ });
  36910. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(135);
  36911. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  36912. t[63721] = 0x00a9;
  36913. t[63193] = 0x00a9;
  36914. t[63720] = 0x00ae;
  36915. t[63194] = 0x00ae;
  36916. t[63722] = 0x2122;
  36917. t[63195] = 0x2122;
  36918. t[63729] = 0x23a7;
  36919. t[63730] = 0x23a8;
  36920. t[63731] = 0x23a9;
  36921. t[63740] = 0x23ab;
  36922. t[63741] = 0x23ac;
  36923. t[63742] = 0x23ad;
  36924. t[63726] = 0x23a1;
  36925. t[63727] = 0x23a2;
  36926. t[63728] = 0x23a3;
  36927. t[63737] = 0x23a4;
  36928. t[63738] = 0x23a5;
  36929. t[63739] = 0x23a6;
  36930. t[63723] = 0x239b;
  36931. t[63724] = 0x239c;
  36932. t[63725] = 0x239d;
  36933. t[63734] = 0x239e;
  36934. t[63735] = 0x239f;
  36935. t[63736] = 0x23a0;
  36936. });
  36937. function mapSpecialUnicodeValues(code) {
  36938. if (code >= 0xfff0 && code <= 0xffff) {
  36939. return 0;
  36940. } else if (code >= 0xf600 && code <= 0xf8ff) {
  36941. return getSpecialPUASymbols()[code] || code;
  36942. } else if (code === 0x00ad) {
  36943. return 0x002d;
  36944. }
  36945. return code;
  36946. }
  36947. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  36948. let unicode = glyphsUnicodeMap[name];
  36949. if (unicode !== undefined) {
  36950. return unicode;
  36951. }
  36952. if (!name) {
  36953. return -1;
  36954. }
  36955. if (name[0] === "u") {
  36956. const nameLen = name.length;
  36957. let hexStr;
  36958. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  36959. hexStr = name.substring(3);
  36960. } else if (nameLen >= 5 && nameLen <= 7) {
  36961. hexStr = name.substring(1);
  36962. } else {
  36963. return -1;
  36964. }
  36965. if (hexStr === hexStr.toUpperCase()) {
  36966. unicode = parseInt(hexStr, 16);
  36967. if (unicode >= 0) {
  36968. return unicode;
  36969. }
  36970. }
  36971. }
  36972. return -1;
  36973. }
  36974. const UnicodeRanges = [
  36975. {
  36976. begin: 0x0000,
  36977. end: 0x007f
  36978. },
  36979. {
  36980. begin: 0x0080,
  36981. end: 0x00ff
  36982. },
  36983. {
  36984. begin: 0x0100,
  36985. end: 0x017f
  36986. },
  36987. {
  36988. begin: 0x0180,
  36989. end: 0x024f
  36990. },
  36991. {
  36992. begin: 0x0250,
  36993. end: 0x02af
  36994. },
  36995. {
  36996. begin: 0x02b0,
  36997. end: 0x02ff
  36998. },
  36999. {
  37000. begin: 0x0300,
  37001. end: 0x036f
  37002. },
  37003. {
  37004. begin: 0x0370,
  37005. end: 0x03ff
  37006. },
  37007. {
  37008. begin: 0x2c80,
  37009. end: 0x2cff
  37010. },
  37011. {
  37012. begin: 0x0400,
  37013. end: 0x04ff
  37014. },
  37015. {
  37016. begin: 0x0530,
  37017. end: 0x058f
  37018. },
  37019. {
  37020. begin: 0x0590,
  37021. end: 0x05ff
  37022. },
  37023. {
  37024. begin: 0xa500,
  37025. end: 0xa63f
  37026. },
  37027. {
  37028. begin: 0x0600,
  37029. end: 0x06ff
  37030. },
  37031. {
  37032. begin: 0x07c0,
  37033. end: 0x07ff
  37034. },
  37035. {
  37036. begin: 0x0900,
  37037. end: 0x097f
  37038. },
  37039. {
  37040. begin: 0x0980,
  37041. end: 0x09ff
  37042. },
  37043. {
  37044. begin: 0x0a00,
  37045. end: 0x0a7f
  37046. },
  37047. {
  37048. begin: 0x0a80,
  37049. end: 0x0aff
  37050. },
  37051. {
  37052. begin: 0x0b00,
  37053. end: 0x0b7f
  37054. },
  37055. {
  37056. begin: 0x0b80,
  37057. end: 0x0bff
  37058. },
  37059. {
  37060. begin: 0x0c00,
  37061. end: 0x0c7f
  37062. },
  37063. {
  37064. begin: 0x0c80,
  37065. end: 0x0cff
  37066. },
  37067. {
  37068. begin: 0x0d00,
  37069. end: 0x0d7f
  37070. },
  37071. {
  37072. begin: 0x0e00,
  37073. end: 0x0e7f
  37074. },
  37075. {
  37076. begin: 0x0e80,
  37077. end: 0x0eff
  37078. },
  37079. {
  37080. begin: 0x10a0,
  37081. end: 0x10ff
  37082. },
  37083. {
  37084. begin: 0x1b00,
  37085. end: 0x1b7f
  37086. },
  37087. {
  37088. begin: 0x1100,
  37089. end: 0x11ff
  37090. },
  37091. {
  37092. begin: 0x1e00,
  37093. end: 0x1eff
  37094. },
  37095. {
  37096. begin: 0x1f00,
  37097. end: 0x1fff
  37098. },
  37099. {
  37100. begin: 0x2000,
  37101. end: 0x206f
  37102. },
  37103. {
  37104. begin: 0x2070,
  37105. end: 0x209f
  37106. },
  37107. {
  37108. begin: 0x20a0,
  37109. end: 0x20cf
  37110. },
  37111. {
  37112. begin: 0x20d0,
  37113. end: 0x20ff
  37114. },
  37115. {
  37116. begin: 0x2100,
  37117. end: 0x214f
  37118. },
  37119. {
  37120. begin: 0x2150,
  37121. end: 0x218f
  37122. },
  37123. {
  37124. begin: 0x2190,
  37125. end: 0x21ff
  37126. },
  37127. {
  37128. begin: 0x2200,
  37129. end: 0x22ff
  37130. },
  37131. {
  37132. begin: 0x2300,
  37133. end: 0x23ff
  37134. },
  37135. {
  37136. begin: 0x2400,
  37137. end: 0x243f
  37138. },
  37139. {
  37140. begin: 0x2440,
  37141. end: 0x245f
  37142. },
  37143. {
  37144. begin: 0x2460,
  37145. end: 0x24ff
  37146. },
  37147. {
  37148. begin: 0x2500,
  37149. end: 0x257f
  37150. },
  37151. {
  37152. begin: 0x2580,
  37153. end: 0x259f
  37154. },
  37155. {
  37156. begin: 0x25a0,
  37157. end: 0x25ff
  37158. },
  37159. {
  37160. begin: 0x2600,
  37161. end: 0x26ff
  37162. },
  37163. {
  37164. begin: 0x2700,
  37165. end: 0x27bf
  37166. },
  37167. {
  37168. begin: 0x3000,
  37169. end: 0x303f
  37170. },
  37171. {
  37172. begin: 0x3040,
  37173. end: 0x309f
  37174. },
  37175. {
  37176. begin: 0x30a0,
  37177. end: 0x30ff
  37178. },
  37179. {
  37180. begin: 0x3100,
  37181. end: 0x312f
  37182. },
  37183. {
  37184. begin: 0x3130,
  37185. end: 0x318f
  37186. },
  37187. {
  37188. begin: 0xa840,
  37189. end: 0xa87f
  37190. },
  37191. {
  37192. begin: 0x3200,
  37193. end: 0x32ff
  37194. },
  37195. {
  37196. begin: 0x3300,
  37197. end: 0x33ff
  37198. },
  37199. {
  37200. begin: 0xac00,
  37201. end: 0xd7af
  37202. },
  37203. {
  37204. begin: 0xd800,
  37205. end: 0xdfff
  37206. },
  37207. {
  37208. begin: 0x10900,
  37209. end: 0x1091f
  37210. },
  37211. {
  37212. begin: 0x4e00,
  37213. end: 0x9fff
  37214. },
  37215. {
  37216. begin: 0xe000,
  37217. end: 0xf8ff
  37218. },
  37219. {
  37220. begin: 0x31c0,
  37221. end: 0x31ef
  37222. },
  37223. {
  37224. begin: 0xfb00,
  37225. end: 0xfb4f
  37226. },
  37227. {
  37228. begin: 0xfb50,
  37229. end: 0xfdff
  37230. },
  37231. {
  37232. begin: 0xfe20,
  37233. end: 0xfe2f
  37234. },
  37235. {
  37236. begin: 0xfe10,
  37237. end: 0xfe1f
  37238. },
  37239. {
  37240. begin: 0xfe50,
  37241. end: 0xfe6f
  37242. },
  37243. {
  37244. begin: 0xfe70,
  37245. end: 0xfeff
  37246. },
  37247. {
  37248. begin: 0xff00,
  37249. end: 0xffef
  37250. },
  37251. {
  37252. begin: 0xfff0,
  37253. end: 0xffff
  37254. },
  37255. {
  37256. begin: 0x0f00,
  37257. end: 0x0fff
  37258. },
  37259. {
  37260. begin: 0x0700,
  37261. end: 0x074f
  37262. },
  37263. {
  37264. begin: 0x0780,
  37265. end: 0x07bf
  37266. },
  37267. {
  37268. begin: 0x0d80,
  37269. end: 0x0dff
  37270. },
  37271. {
  37272. begin: 0x1000,
  37273. end: 0x109f
  37274. },
  37275. {
  37276. begin: 0x1200,
  37277. end: 0x137f
  37278. },
  37279. {
  37280. begin: 0x13a0,
  37281. end: 0x13ff
  37282. },
  37283. {
  37284. begin: 0x1400,
  37285. end: 0x167f
  37286. },
  37287. {
  37288. begin: 0x1680,
  37289. end: 0x169f
  37290. },
  37291. {
  37292. begin: 0x16a0,
  37293. end: 0x16ff
  37294. },
  37295. {
  37296. begin: 0x1780,
  37297. end: 0x17ff
  37298. },
  37299. {
  37300. begin: 0x1800,
  37301. end: 0x18af
  37302. },
  37303. {
  37304. begin: 0x2800,
  37305. end: 0x28ff
  37306. },
  37307. {
  37308. begin: 0xa000,
  37309. end: 0xa48f
  37310. },
  37311. {
  37312. begin: 0x1700,
  37313. end: 0x171f
  37314. },
  37315. {
  37316. begin: 0x10300,
  37317. end: 0x1032f
  37318. },
  37319. {
  37320. begin: 0x10330,
  37321. end: 0x1034f
  37322. },
  37323. {
  37324. begin: 0x10400,
  37325. end: 0x1044f
  37326. },
  37327. {
  37328. begin: 0x1d000,
  37329. end: 0x1d0ff
  37330. },
  37331. {
  37332. begin: 0x1d400,
  37333. end: 0x1d7ff
  37334. },
  37335. {
  37336. begin: 0xff000,
  37337. end: 0xffffd
  37338. },
  37339. {
  37340. begin: 0xfe00,
  37341. end: 0xfe0f
  37342. },
  37343. {
  37344. begin: 0xe0000,
  37345. end: 0xe007f
  37346. },
  37347. {
  37348. begin: 0x1900,
  37349. end: 0x194f
  37350. },
  37351. {
  37352. begin: 0x1950,
  37353. end: 0x197f
  37354. },
  37355. {
  37356. begin: 0x1980,
  37357. end: 0x19df
  37358. },
  37359. {
  37360. begin: 0x1a00,
  37361. end: 0x1a1f
  37362. },
  37363. {
  37364. begin: 0x2c00,
  37365. end: 0x2c5f
  37366. },
  37367. {
  37368. begin: 0x2d30,
  37369. end: 0x2d7f
  37370. },
  37371. {
  37372. begin: 0x4dc0,
  37373. end: 0x4dff
  37374. },
  37375. {
  37376. begin: 0xa800,
  37377. end: 0xa82f
  37378. },
  37379. {
  37380. begin: 0x10000,
  37381. end: 0x1007f
  37382. },
  37383. {
  37384. begin: 0x10140,
  37385. end: 0x1018f
  37386. },
  37387. {
  37388. begin: 0x10380,
  37389. end: 0x1039f
  37390. },
  37391. {
  37392. begin: 0x103a0,
  37393. end: 0x103df
  37394. },
  37395. {
  37396. begin: 0x10450,
  37397. end: 0x1047f
  37398. },
  37399. {
  37400. begin: 0x10480,
  37401. end: 0x104af
  37402. },
  37403. {
  37404. begin: 0x10800,
  37405. end: 0x1083f
  37406. },
  37407. {
  37408. begin: 0x10a00,
  37409. end: 0x10a5f
  37410. },
  37411. {
  37412. begin: 0x1d300,
  37413. end: 0x1d35f
  37414. },
  37415. {
  37416. begin: 0x12000,
  37417. end: 0x123ff
  37418. },
  37419. {
  37420. begin: 0x1d360,
  37421. end: 0x1d37f
  37422. },
  37423. {
  37424. begin: 0x1b80,
  37425. end: 0x1bbf
  37426. },
  37427. {
  37428. begin: 0x1c00,
  37429. end: 0x1c4f
  37430. },
  37431. {
  37432. begin: 0x1c50,
  37433. end: 0x1c7f
  37434. },
  37435. {
  37436. begin: 0xa880,
  37437. end: 0xa8df
  37438. },
  37439. {
  37440. begin: 0xa900,
  37441. end: 0xa92f
  37442. },
  37443. {
  37444. begin: 0xa930,
  37445. end: 0xa95f
  37446. },
  37447. {
  37448. begin: 0xaa00,
  37449. end: 0xaa5f
  37450. },
  37451. {
  37452. begin: 0x10190,
  37453. end: 0x101cf
  37454. },
  37455. {
  37456. begin: 0x101d0,
  37457. end: 0x101ff
  37458. },
  37459. {
  37460. begin: 0x102a0,
  37461. end: 0x102df
  37462. },
  37463. {
  37464. begin: 0x1f030,
  37465. end: 0x1f09f
  37466. }
  37467. ];
  37468. function getUnicodeRangeFor(value) {
  37469. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  37470. const range = UnicodeRanges[i];
  37471. if (value >= range.begin && value < range.end) {
  37472. return i;
  37473. }
  37474. }
  37475. return -1;
  37476. }
  37477. function isRTLRangeFor(value) {
  37478. let range = UnicodeRanges[13];
  37479. if (value >= range.begin && value < range.end) {
  37480. return true;
  37481. }
  37482. range = UnicodeRanges[11];
  37483. if (value >= range.begin && value < range.end) {
  37484. return true;
  37485. }
  37486. return false;
  37487. }
  37488. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  37489. return [
  37490. "\u00A8",
  37491. "\u0020\u0308",
  37492. "\u00AF",
  37493. "\u0020\u0304",
  37494. "\u00B4",
  37495. "\u0020\u0301",
  37496. "\u00B5",
  37497. "\u03BC",
  37498. "\u00B8",
  37499. "\u0020\u0327",
  37500. "\u0132",
  37501. "\u0049\u004A",
  37502. "\u0133",
  37503. "\u0069\u006A",
  37504. "\u013F",
  37505. "\u004C\u00B7",
  37506. "\u0140",
  37507. "\u006C\u00B7",
  37508. "\u0149",
  37509. "\u02BC\u006E",
  37510. "\u017F",
  37511. "\u0073",
  37512. "\u01C4",
  37513. "\u0044\u017D",
  37514. "\u01C5",
  37515. "\u0044\u017E",
  37516. "\u01C6",
  37517. "\u0064\u017E",
  37518. "\u01C7",
  37519. "\u004C\u004A",
  37520. "\u01C8",
  37521. "\u004C\u006A",
  37522. "\u01C9",
  37523. "\u006C\u006A",
  37524. "\u01CA",
  37525. "\u004E\u004A",
  37526. "\u01CB",
  37527. "\u004E\u006A",
  37528. "\u01CC",
  37529. "\u006E\u006A",
  37530. "\u01F1",
  37531. "\u0044\u005A",
  37532. "\u01F2",
  37533. "\u0044\u007A",
  37534. "\u01F3",
  37535. "\u0064\u007A",
  37536. "\u02D8",
  37537. "\u0020\u0306",
  37538. "\u02D9",
  37539. "\u0020\u0307",
  37540. "\u02DA",
  37541. "\u0020\u030A",
  37542. "\u02DB",
  37543. "\u0020\u0328",
  37544. "\u02DC",
  37545. "\u0020\u0303",
  37546. "\u02DD",
  37547. "\u0020\u030B",
  37548. "\u037A",
  37549. "\u0020\u0345",
  37550. "\u0384",
  37551. "\u0020\u0301",
  37552. "\u03D0",
  37553. "\u03B2",
  37554. "\u03D1",
  37555. "\u03B8",
  37556. "\u03D2",
  37557. "\u03A5",
  37558. "\u03D5",
  37559. "\u03C6",
  37560. "\u03D6",
  37561. "\u03C0",
  37562. "\u03F0",
  37563. "\u03BA",
  37564. "\u03F1",
  37565. "\u03C1",
  37566. "\u03F2",
  37567. "\u03C2",
  37568. "\u03F4",
  37569. "\u0398",
  37570. "\u03F5",
  37571. "\u03B5",
  37572. "\u03F9",
  37573. "\u03A3",
  37574. "\u0587",
  37575. "\u0565\u0582",
  37576. "\u0675",
  37577. "\u0627\u0674",
  37578. "\u0676",
  37579. "\u0648\u0674",
  37580. "\u0677",
  37581. "\u06C7\u0674",
  37582. "\u0678",
  37583. "\u064A\u0674",
  37584. "\u0E33",
  37585. "\u0E4D\u0E32",
  37586. "\u0EB3",
  37587. "\u0ECD\u0EB2",
  37588. "\u0EDC",
  37589. "\u0EAB\u0E99",
  37590. "\u0EDD",
  37591. "\u0EAB\u0EA1",
  37592. "\u0F77",
  37593. "\u0FB2\u0F81",
  37594. "\u0F79",
  37595. "\u0FB3\u0F81",
  37596. "\u1E9A",
  37597. "\u0061\u02BE",
  37598. "\u1FBD",
  37599. "\u0020\u0313",
  37600. "\u1FBF",
  37601. "\u0020\u0313",
  37602. "\u1FC0",
  37603. "\u0020\u0342",
  37604. "\u1FFE",
  37605. "\u0020\u0314",
  37606. "\u2002",
  37607. "\u0020",
  37608. "\u2003",
  37609. "\u0020",
  37610. "\u2004",
  37611. "\u0020",
  37612. "\u2005",
  37613. "\u0020",
  37614. "\u2006",
  37615. "\u0020",
  37616. "\u2008",
  37617. "\u0020",
  37618. "\u2009",
  37619. "\u0020",
  37620. "\u200A",
  37621. "\u0020",
  37622. "\u2017",
  37623. "\u0020\u0333",
  37624. "\u2024",
  37625. "\u002E",
  37626. "\u2025",
  37627. "\u002E\u002E",
  37628. "\u2026",
  37629. "\u002E\u002E\u002E",
  37630. "\u2033",
  37631. "\u2032\u2032",
  37632. "\u2034",
  37633. "\u2032\u2032\u2032",
  37634. "\u2036",
  37635. "\u2035\u2035",
  37636. "\u2037",
  37637. "\u2035\u2035\u2035",
  37638. "\u203C",
  37639. "\u0021\u0021",
  37640. "\u203E",
  37641. "\u0020\u0305",
  37642. "\u2047",
  37643. "\u003F\u003F",
  37644. "\u2048",
  37645. "\u003F\u0021",
  37646. "\u2049",
  37647. "\u0021\u003F",
  37648. "\u2057",
  37649. "\u2032\u2032\u2032\u2032",
  37650. "\u205F",
  37651. "\u0020",
  37652. "\u20A8",
  37653. "\u0052\u0073",
  37654. "\u2100",
  37655. "\u0061\u002F\u0063",
  37656. "\u2101",
  37657. "\u0061\u002F\u0073",
  37658. "\u2103",
  37659. "\u00B0\u0043",
  37660. "\u2105",
  37661. "\u0063\u002F\u006F",
  37662. "\u2106",
  37663. "\u0063\u002F\u0075",
  37664. "\u2107",
  37665. "\u0190",
  37666. "\u2109",
  37667. "\u00B0\u0046",
  37668. "\u2116",
  37669. "\u004E\u006F",
  37670. "\u2121",
  37671. "\u0054\u0045\u004C",
  37672. "\u2135",
  37673. "\u05D0",
  37674. "\u2136",
  37675. "\u05D1",
  37676. "\u2137",
  37677. "\u05D2",
  37678. "\u2138",
  37679. "\u05D3",
  37680. "\u213B",
  37681. "\u0046\u0041\u0058",
  37682. "\u2160",
  37683. "\u0049",
  37684. "\u2161",
  37685. "\u0049\u0049",
  37686. "\u2162",
  37687. "\u0049\u0049\u0049",
  37688. "\u2163",
  37689. "\u0049\u0056",
  37690. "\u2164",
  37691. "\u0056",
  37692. "\u2165",
  37693. "\u0056\u0049",
  37694. "\u2166",
  37695. "\u0056\u0049\u0049",
  37696. "\u2167",
  37697. "\u0056\u0049\u0049\u0049",
  37698. "\u2168",
  37699. "\u0049\u0058",
  37700. "\u2169",
  37701. "\u0058",
  37702. "\u216A",
  37703. "\u0058\u0049",
  37704. "\u216B",
  37705. "\u0058\u0049\u0049",
  37706. "\u216C",
  37707. "\u004C",
  37708. "\u216D",
  37709. "\u0043",
  37710. "\u216E",
  37711. "\u0044",
  37712. "\u216F",
  37713. "\u004D",
  37714. "\u2170",
  37715. "\u0069",
  37716. "\u2171",
  37717. "\u0069\u0069",
  37718. "\u2172",
  37719. "\u0069\u0069\u0069",
  37720. "\u2173",
  37721. "\u0069\u0076",
  37722. "\u2174",
  37723. "\u0076",
  37724. "\u2175",
  37725. "\u0076\u0069",
  37726. "\u2176",
  37727. "\u0076\u0069\u0069",
  37728. "\u2177",
  37729. "\u0076\u0069\u0069\u0069",
  37730. "\u2178",
  37731. "\u0069\u0078",
  37732. "\u2179",
  37733. "\u0078",
  37734. "\u217A",
  37735. "\u0078\u0069",
  37736. "\u217B",
  37737. "\u0078\u0069\u0069",
  37738. "\u217C",
  37739. "\u006C",
  37740. "\u217D",
  37741. "\u0063",
  37742. "\u217E",
  37743. "\u0064",
  37744. "\u217F",
  37745. "\u006D",
  37746. "\u222C",
  37747. "\u222B\u222B",
  37748. "\u222D",
  37749. "\u222B\u222B\u222B",
  37750. "\u222F",
  37751. "\u222E\u222E",
  37752. "\u2230",
  37753. "\u222E\u222E\u222E",
  37754. "\u2474",
  37755. "\u0028\u0031\u0029",
  37756. "\u2475",
  37757. "\u0028\u0032\u0029",
  37758. "\u2476",
  37759. "\u0028\u0033\u0029",
  37760. "\u2477",
  37761. "\u0028\u0034\u0029",
  37762. "\u2478",
  37763. "\u0028\u0035\u0029",
  37764. "\u2479",
  37765. "\u0028\u0036\u0029",
  37766. "\u247A",
  37767. "\u0028\u0037\u0029",
  37768. "\u247B",
  37769. "\u0028\u0038\u0029",
  37770. "\u247C",
  37771. "\u0028\u0039\u0029",
  37772. "\u247D",
  37773. "\u0028\u0031\u0030\u0029",
  37774. "\u247E",
  37775. "\u0028\u0031\u0031\u0029",
  37776. "\u247F",
  37777. "\u0028\u0031\u0032\u0029",
  37778. "\u2480",
  37779. "\u0028\u0031\u0033\u0029",
  37780. "\u2481",
  37781. "\u0028\u0031\u0034\u0029",
  37782. "\u2482",
  37783. "\u0028\u0031\u0035\u0029",
  37784. "\u2483",
  37785. "\u0028\u0031\u0036\u0029",
  37786. "\u2484",
  37787. "\u0028\u0031\u0037\u0029",
  37788. "\u2485",
  37789. "\u0028\u0031\u0038\u0029",
  37790. "\u2486",
  37791. "\u0028\u0031\u0039\u0029",
  37792. "\u2487",
  37793. "\u0028\u0032\u0030\u0029",
  37794. "\u2488",
  37795. "\u0031\u002E",
  37796. "\u2489",
  37797. "\u0032\u002E",
  37798. "\u248A",
  37799. "\u0033\u002E",
  37800. "\u248B",
  37801. "\u0034\u002E",
  37802. "\u248C",
  37803. "\u0035\u002E",
  37804. "\u248D",
  37805. "\u0036\u002E",
  37806. "\u248E",
  37807. "\u0037\u002E",
  37808. "\u248F",
  37809. "\u0038\u002E",
  37810. "\u2490",
  37811. "\u0039\u002E",
  37812. "\u2491",
  37813. "\u0031\u0030\u002E",
  37814. "\u2492",
  37815. "\u0031\u0031\u002E",
  37816. "\u2493",
  37817. "\u0031\u0032\u002E",
  37818. "\u2494",
  37819. "\u0031\u0033\u002E",
  37820. "\u2495",
  37821. "\u0031\u0034\u002E",
  37822. "\u2496",
  37823. "\u0031\u0035\u002E",
  37824. "\u2497",
  37825. "\u0031\u0036\u002E",
  37826. "\u2498",
  37827. "\u0031\u0037\u002E",
  37828. "\u2499",
  37829. "\u0031\u0038\u002E",
  37830. "\u249A",
  37831. "\u0031\u0039\u002E",
  37832. "\u249B",
  37833. "\u0032\u0030\u002E",
  37834. "\u249C",
  37835. "\u0028\u0061\u0029",
  37836. "\u249D",
  37837. "\u0028\u0062\u0029",
  37838. "\u249E",
  37839. "\u0028\u0063\u0029",
  37840. "\u249F",
  37841. "\u0028\u0064\u0029",
  37842. "\u24A0",
  37843. "\u0028\u0065\u0029",
  37844. "\u24A1",
  37845. "\u0028\u0066\u0029",
  37846. "\u24A2",
  37847. "\u0028\u0067\u0029",
  37848. "\u24A3",
  37849. "\u0028\u0068\u0029",
  37850. "\u24A4",
  37851. "\u0028\u0069\u0029",
  37852. "\u24A5",
  37853. "\u0028\u006A\u0029",
  37854. "\u24A6",
  37855. "\u0028\u006B\u0029",
  37856. "\u24A7",
  37857. "\u0028\u006C\u0029",
  37858. "\u24A8",
  37859. "\u0028\u006D\u0029",
  37860. "\u24A9",
  37861. "\u0028\u006E\u0029",
  37862. "\u24AA",
  37863. "\u0028\u006F\u0029",
  37864. "\u24AB",
  37865. "\u0028\u0070\u0029",
  37866. "\u24AC",
  37867. "\u0028\u0071\u0029",
  37868. "\u24AD",
  37869. "\u0028\u0072\u0029",
  37870. "\u24AE",
  37871. "\u0028\u0073\u0029",
  37872. "\u24AF",
  37873. "\u0028\u0074\u0029",
  37874. "\u24B0",
  37875. "\u0028\u0075\u0029",
  37876. "\u24B1",
  37877. "\u0028\u0076\u0029",
  37878. "\u24B2",
  37879. "\u0028\u0077\u0029",
  37880. "\u24B3",
  37881. "\u0028\u0078\u0029",
  37882. "\u24B4",
  37883. "\u0028\u0079\u0029",
  37884. "\u24B5",
  37885. "\u0028\u007A\u0029",
  37886. "\u2A0C",
  37887. "\u222B\u222B\u222B\u222B",
  37888. "\u2A74",
  37889. "\u003A\u003A\u003D",
  37890. "\u2A75",
  37891. "\u003D\u003D",
  37892. "\u2A76",
  37893. "\u003D\u003D\u003D",
  37894. "\u2E9F",
  37895. "\u6BCD",
  37896. "\u2EF3",
  37897. "\u9F9F",
  37898. "\u2F00",
  37899. "\u4E00",
  37900. "\u2F01",
  37901. "\u4E28",
  37902. "\u2F02",
  37903. "\u4E36",
  37904. "\u2F03",
  37905. "\u4E3F",
  37906. "\u2F04",
  37907. "\u4E59",
  37908. "\u2F05",
  37909. "\u4E85",
  37910. "\u2F06",
  37911. "\u4E8C",
  37912. "\u2F07",
  37913. "\u4EA0",
  37914. "\u2F08",
  37915. "\u4EBA",
  37916. "\u2F09",
  37917. "\u513F",
  37918. "\u2F0A",
  37919. "\u5165",
  37920. "\u2F0B",
  37921. "\u516B",
  37922. "\u2F0C",
  37923. "\u5182",
  37924. "\u2F0D",
  37925. "\u5196",
  37926. "\u2F0E",
  37927. "\u51AB",
  37928. "\u2F0F",
  37929. "\u51E0",
  37930. "\u2F10",
  37931. "\u51F5",
  37932. "\u2F11",
  37933. "\u5200",
  37934. "\u2F12",
  37935. "\u529B",
  37936. "\u2F13",
  37937. "\u52F9",
  37938. "\u2F14",
  37939. "\u5315",
  37940. "\u2F15",
  37941. "\u531A",
  37942. "\u2F16",
  37943. "\u5338",
  37944. "\u2F17",
  37945. "\u5341",
  37946. "\u2F18",
  37947. "\u535C",
  37948. "\u2F19",
  37949. "\u5369",
  37950. "\u2F1A",
  37951. "\u5382",
  37952. "\u2F1B",
  37953. "\u53B6",
  37954. "\u2F1C",
  37955. "\u53C8",
  37956. "\u2F1D",
  37957. "\u53E3",
  37958. "\u2F1E",
  37959. "\u56D7",
  37960. "\u2F1F",
  37961. "\u571F",
  37962. "\u2F20",
  37963. "\u58EB",
  37964. "\u2F21",
  37965. "\u5902",
  37966. "\u2F22",
  37967. "\u590A",
  37968. "\u2F23",
  37969. "\u5915",
  37970. "\u2F24",
  37971. "\u5927",
  37972. "\u2F25",
  37973. "\u5973",
  37974. "\u2F26",
  37975. "\u5B50",
  37976. "\u2F27",
  37977. "\u5B80",
  37978. "\u2F28",
  37979. "\u5BF8",
  37980. "\u2F29",
  37981. "\u5C0F",
  37982. "\u2F2A",
  37983. "\u5C22",
  37984. "\u2F2B",
  37985. "\u5C38",
  37986. "\u2F2C",
  37987. "\u5C6E",
  37988. "\u2F2D",
  37989. "\u5C71",
  37990. "\u2F2E",
  37991. "\u5DDB",
  37992. "\u2F2F",
  37993. "\u5DE5",
  37994. "\u2F30",
  37995. "\u5DF1",
  37996. "\u2F31",
  37997. "\u5DFE",
  37998. "\u2F32",
  37999. "\u5E72",
  38000. "\u2F33",
  38001. "\u5E7A",
  38002. "\u2F34",
  38003. "\u5E7F",
  38004. "\u2F35",
  38005. "\u5EF4",
  38006. "\u2F36",
  38007. "\u5EFE",
  38008. "\u2F37",
  38009. "\u5F0B",
  38010. "\u2F38",
  38011. "\u5F13",
  38012. "\u2F39",
  38013. "\u5F50",
  38014. "\u2F3A",
  38015. "\u5F61",
  38016. "\u2F3B",
  38017. "\u5F73",
  38018. "\u2F3C",
  38019. "\u5FC3",
  38020. "\u2F3D",
  38021. "\u6208",
  38022. "\u2F3E",
  38023. "\u6236",
  38024. "\u2F3F",
  38025. "\u624B",
  38026. "\u2F40",
  38027. "\u652F",
  38028. "\u2F41",
  38029. "\u6534",
  38030. "\u2F42",
  38031. "\u6587",
  38032. "\u2F43",
  38033. "\u6597",
  38034. "\u2F44",
  38035. "\u65A4",
  38036. "\u2F45",
  38037. "\u65B9",
  38038. "\u2F46",
  38039. "\u65E0",
  38040. "\u2F47",
  38041. "\u65E5",
  38042. "\u2F48",
  38043. "\u66F0",
  38044. "\u2F49",
  38045. "\u6708",
  38046. "\u2F4A",
  38047. "\u6728",
  38048. "\u2F4B",
  38049. "\u6B20",
  38050. "\u2F4C",
  38051. "\u6B62",
  38052. "\u2F4D",
  38053. "\u6B79",
  38054. "\u2F4E",
  38055. "\u6BB3",
  38056. "\u2F4F",
  38057. "\u6BCB",
  38058. "\u2F50",
  38059. "\u6BD4",
  38060. "\u2F51",
  38061. "\u6BDB",
  38062. "\u2F52",
  38063. "\u6C0F",
  38064. "\u2F53",
  38065. "\u6C14",
  38066. "\u2F54",
  38067. "\u6C34",
  38068. "\u2F55",
  38069. "\u706B",
  38070. "\u2F56",
  38071. "\u722A",
  38072. "\u2F57",
  38073. "\u7236",
  38074. "\u2F58",
  38075. "\u723B",
  38076. "\u2F59",
  38077. "\u723F",
  38078. "\u2F5A",
  38079. "\u7247",
  38080. "\u2F5B",
  38081. "\u7259",
  38082. "\u2F5C",
  38083. "\u725B",
  38084. "\u2F5D",
  38085. "\u72AC",
  38086. "\u2F5E",
  38087. "\u7384",
  38088. "\u2F5F",
  38089. "\u7389",
  38090. "\u2F60",
  38091. "\u74DC",
  38092. "\u2F61",
  38093. "\u74E6",
  38094. "\u2F62",
  38095. "\u7518",
  38096. "\u2F63",
  38097. "\u751F",
  38098. "\u2F64",
  38099. "\u7528",
  38100. "\u2F65",
  38101. "\u7530",
  38102. "\u2F66",
  38103. "\u758B",
  38104. "\u2F67",
  38105. "\u7592",
  38106. "\u2F68",
  38107. "\u7676",
  38108. "\u2F69",
  38109. "\u767D",
  38110. "\u2F6A",
  38111. "\u76AE",
  38112. "\u2F6B",
  38113. "\u76BF",
  38114. "\u2F6C",
  38115. "\u76EE",
  38116. "\u2F6D",
  38117. "\u77DB",
  38118. "\u2F6E",
  38119. "\u77E2",
  38120. "\u2F6F",
  38121. "\u77F3",
  38122. "\u2F70",
  38123. "\u793A",
  38124. "\u2F71",
  38125. "\u79B8",
  38126. "\u2F72",
  38127. "\u79BE",
  38128. "\u2F73",
  38129. "\u7A74",
  38130. "\u2F74",
  38131. "\u7ACB",
  38132. "\u2F75",
  38133. "\u7AF9",
  38134. "\u2F76",
  38135. "\u7C73",
  38136. "\u2F77",
  38137. "\u7CF8",
  38138. "\u2F78",
  38139. "\u7F36",
  38140. "\u2F79",
  38141. "\u7F51",
  38142. "\u2F7A",
  38143. "\u7F8A",
  38144. "\u2F7B",
  38145. "\u7FBD",
  38146. "\u2F7C",
  38147. "\u8001",
  38148. "\u2F7D",
  38149. "\u800C",
  38150. "\u2F7E",
  38151. "\u8012",
  38152. "\u2F7F",
  38153. "\u8033",
  38154. "\u2F80",
  38155. "\u807F",
  38156. "\u2F81",
  38157. "\u8089",
  38158. "\u2F82",
  38159. "\u81E3",
  38160. "\u2F83",
  38161. "\u81EA",
  38162. "\u2F84",
  38163. "\u81F3",
  38164. "\u2F85",
  38165. "\u81FC",
  38166. "\u2F86",
  38167. "\u820C",
  38168. "\u2F87",
  38169. "\u821B",
  38170. "\u2F88",
  38171. "\u821F",
  38172. "\u2F89",
  38173. "\u826E",
  38174. "\u2F8A",
  38175. "\u8272",
  38176. "\u2F8B",
  38177. "\u8278",
  38178. "\u2F8C",
  38179. "\u864D",
  38180. "\u2F8D",
  38181. "\u866B",
  38182. "\u2F8E",
  38183. "\u8840",
  38184. "\u2F8F",
  38185. "\u884C",
  38186. "\u2F90",
  38187. "\u8863",
  38188. "\u2F91",
  38189. "\u897E",
  38190. "\u2F92",
  38191. "\u898B",
  38192. "\u2F93",
  38193. "\u89D2",
  38194. "\u2F94",
  38195. "\u8A00",
  38196. "\u2F95",
  38197. "\u8C37",
  38198. "\u2F96",
  38199. "\u8C46",
  38200. "\u2F97",
  38201. "\u8C55",
  38202. "\u2F98",
  38203. "\u8C78",
  38204. "\u2F99",
  38205. "\u8C9D",
  38206. "\u2F9A",
  38207. "\u8D64",
  38208. "\u2F9B",
  38209. "\u8D70",
  38210. "\u2F9C",
  38211. "\u8DB3",
  38212. "\u2F9D",
  38213. "\u8EAB",
  38214. "\u2F9E",
  38215. "\u8ECA",
  38216. "\u2F9F",
  38217. "\u8F9B",
  38218. "\u2FA0",
  38219. "\u8FB0",
  38220. "\u2FA1",
  38221. "\u8FB5",
  38222. "\u2FA2",
  38223. "\u9091",
  38224. "\u2FA3",
  38225. "\u9149",
  38226. "\u2FA4",
  38227. "\u91C6",
  38228. "\u2FA5",
  38229. "\u91CC",
  38230. "\u2FA6",
  38231. "\u91D1",
  38232. "\u2FA7",
  38233. "\u9577",
  38234. "\u2FA8",
  38235. "\u9580",
  38236. "\u2FA9",
  38237. "\u961C",
  38238. "\u2FAA",
  38239. "\u96B6",
  38240. "\u2FAB",
  38241. "\u96B9",
  38242. "\u2FAC",
  38243. "\u96E8",
  38244. "\u2FAD",
  38245. "\u9751",
  38246. "\u2FAE",
  38247. "\u975E",
  38248. "\u2FAF",
  38249. "\u9762",
  38250. "\u2FB0",
  38251. "\u9769",
  38252. "\u2FB1",
  38253. "\u97CB",
  38254. "\u2FB2",
  38255. "\u97ED",
  38256. "\u2FB3",
  38257. "\u97F3",
  38258. "\u2FB4",
  38259. "\u9801",
  38260. "\u2FB5",
  38261. "\u98A8",
  38262. "\u2FB6",
  38263. "\u98DB",
  38264. "\u2FB7",
  38265. "\u98DF",
  38266. "\u2FB8",
  38267. "\u9996",
  38268. "\u2FB9",
  38269. "\u9999",
  38270. "\u2FBA",
  38271. "\u99AC",
  38272. "\u2FBB",
  38273. "\u9AA8",
  38274. "\u2FBC",
  38275. "\u9AD8",
  38276. "\u2FBD",
  38277. "\u9ADF",
  38278. "\u2FBE",
  38279. "\u9B25",
  38280. "\u2FBF",
  38281. "\u9B2F",
  38282. "\u2FC0",
  38283. "\u9B32",
  38284. "\u2FC1",
  38285. "\u9B3C",
  38286. "\u2FC2",
  38287. "\u9B5A",
  38288. "\u2FC3",
  38289. "\u9CE5",
  38290. "\u2FC4",
  38291. "\u9E75",
  38292. "\u2FC5",
  38293. "\u9E7F",
  38294. "\u2FC6",
  38295. "\u9EA5",
  38296. "\u2FC7",
  38297. "\u9EBB",
  38298. "\u2FC8",
  38299. "\u9EC3",
  38300. "\u2FC9",
  38301. "\u9ECD",
  38302. "\u2FCA",
  38303. "\u9ED1",
  38304. "\u2FCB",
  38305. "\u9EF9",
  38306. "\u2FCC",
  38307. "\u9EFD",
  38308. "\u2FCD",
  38309. "\u9F0E",
  38310. "\u2FCE",
  38311. "\u9F13",
  38312. "\u2FCF",
  38313. "\u9F20",
  38314. "\u2FD0",
  38315. "\u9F3B",
  38316. "\u2FD1",
  38317. "\u9F4A",
  38318. "\u2FD2",
  38319. "\u9F52",
  38320. "\u2FD3",
  38321. "\u9F8D",
  38322. "\u2FD4",
  38323. "\u9F9C",
  38324. "\u2FD5",
  38325. "\u9FA0",
  38326. "\u3036",
  38327. "\u3012",
  38328. "\u3038",
  38329. "\u5341",
  38330. "\u3039",
  38331. "\u5344",
  38332. "\u303A",
  38333. "\u5345",
  38334. "\u309B",
  38335. "\u0020\u3099",
  38336. "\u309C",
  38337. "\u0020\u309A",
  38338. "\u3131",
  38339. "\u1100",
  38340. "\u3132",
  38341. "\u1101",
  38342. "\u3133",
  38343. "\u11AA",
  38344. "\u3134",
  38345. "\u1102",
  38346. "\u3135",
  38347. "\u11AC",
  38348. "\u3136",
  38349. "\u11AD",
  38350. "\u3137",
  38351. "\u1103",
  38352. "\u3138",
  38353. "\u1104",
  38354. "\u3139",
  38355. "\u1105",
  38356. "\u313A",
  38357. "\u11B0",
  38358. "\u313B",
  38359. "\u11B1",
  38360. "\u313C",
  38361. "\u11B2",
  38362. "\u313D",
  38363. "\u11B3",
  38364. "\u313E",
  38365. "\u11B4",
  38366. "\u313F",
  38367. "\u11B5",
  38368. "\u3140",
  38369. "\u111A",
  38370. "\u3141",
  38371. "\u1106",
  38372. "\u3142",
  38373. "\u1107",
  38374. "\u3143",
  38375. "\u1108",
  38376. "\u3144",
  38377. "\u1121",
  38378. "\u3145",
  38379. "\u1109",
  38380. "\u3146",
  38381. "\u110A",
  38382. "\u3147",
  38383. "\u110B",
  38384. "\u3148",
  38385. "\u110C",
  38386. "\u3149",
  38387. "\u110D",
  38388. "\u314A",
  38389. "\u110E",
  38390. "\u314B",
  38391. "\u110F",
  38392. "\u314C",
  38393. "\u1110",
  38394. "\u314D",
  38395. "\u1111",
  38396. "\u314E",
  38397. "\u1112",
  38398. "\u314F",
  38399. "\u1161",
  38400. "\u3150",
  38401. "\u1162",
  38402. "\u3151",
  38403. "\u1163",
  38404. "\u3152",
  38405. "\u1164",
  38406. "\u3153",
  38407. "\u1165",
  38408. "\u3154",
  38409. "\u1166",
  38410. "\u3155",
  38411. "\u1167",
  38412. "\u3156",
  38413. "\u1168",
  38414. "\u3157",
  38415. "\u1169",
  38416. "\u3158",
  38417. "\u116A",
  38418. "\u3159",
  38419. "\u116B",
  38420. "\u315A",
  38421. "\u116C",
  38422. "\u315B",
  38423. "\u116D",
  38424. "\u315C",
  38425. "\u116E",
  38426. "\u315D",
  38427. "\u116F",
  38428. "\u315E",
  38429. "\u1170",
  38430. "\u315F",
  38431. "\u1171",
  38432. "\u3160",
  38433. "\u1172",
  38434. "\u3161",
  38435. "\u1173",
  38436. "\u3162",
  38437. "\u1174",
  38438. "\u3163",
  38439. "\u1175",
  38440. "\u3164",
  38441. "\u1160",
  38442. "\u3165",
  38443. "\u1114",
  38444. "\u3166",
  38445. "\u1115",
  38446. "\u3167",
  38447. "\u11C7",
  38448. "\u3168",
  38449. "\u11C8",
  38450. "\u3169",
  38451. "\u11CC",
  38452. "\u316A",
  38453. "\u11CE",
  38454. "\u316B",
  38455. "\u11D3",
  38456. "\u316C",
  38457. "\u11D7",
  38458. "\u316D",
  38459. "\u11D9",
  38460. "\u316E",
  38461. "\u111C",
  38462. "\u316F",
  38463. "\u11DD",
  38464. "\u3170",
  38465. "\u11DF",
  38466. "\u3171",
  38467. "\u111D",
  38468. "\u3172",
  38469. "\u111E",
  38470. "\u3173",
  38471. "\u1120",
  38472. "\u3174",
  38473. "\u1122",
  38474. "\u3175",
  38475. "\u1123",
  38476. "\u3176",
  38477. "\u1127",
  38478. "\u3177",
  38479. "\u1129",
  38480. "\u3178",
  38481. "\u112B",
  38482. "\u3179",
  38483. "\u112C",
  38484. "\u317A",
  38485. "\u112D",
  38486. "\u317B",
  38487. "\u112E",
  38488. "\u317C",
  38489. "\u112F",
  38490. "\u317D",
  38491. "\u1132",
  38492. "\u317E",
  38493. "\u1136",
  38494. "\u317F",
  38495. "\u1140",
  38496. "\u3180",
  38497. "\u1147",
  38498. "\u3181",
  38499. "\u114C",
  38500. "\u3182",
  38501. "\u11F1",
  38502. "\u3183",
  38503. "\u11F2",
  38504. "\u3184",
  38505. "\u1157",
  38506. "\u3185",
  38507. "\u1158",
  38508. "\u3186",
  38509. "\u1159",
  38510. "\u3187",
  38511. "\u1184",
  38512. "\u3188",
  38513. "\u1185",
  38514. "\u3189",
  38515. "\u1188",
  38516. "\u318A",
  38517. "\u1191",
  38518. "\u318B",
  38519. "\u1192",
  38520. "\u318C",
  38521. "\u1194",
  38522. "\u318D",
  38523. "\u119E",
  38524. "\u318E",
  38525. "\u11A1",
  38526. "\u3200",
  38527. "\u0028\u1100\u0029",
  38528. "\u3201",
  38529. "\u0028\u1102\u0029",
  38530. "\u3202",
  38531. "\u0028\u1103\u0029",
  38532. "\u3203",
  38533. "\u0028\u1105\u0029",
  38534. "\u3204",
  38535. "\u0028\u1106\u0029",
  38536. "\u3205",
  38537. "\u0028\u1107\u0029",
  38538. "\u3206",
  38539. "\u0028\u1109\u0029",
  38540. "\u3207",
  38541. "\u0028\u110B\u0029",
  38542. "\u3208",
  38543. "\u0028\u110C\u0029",
  38544. "\u3209",
  38545. "\u0028\u110E\u0029",
  38546. "\u320A",
  38547. "\u0028\u110F\u0029",
  38548. "\u320B",
  38549. "\u0028\u1110\u0029",
  38550. "\u320C",
  38551. "\u0028\u1111\u0029",
  38552. "\u320D",
  38553. "\u0028\u1112\u0029",
  38554. "\u320E",
  38555. "\u0028\u1100\u1161\u0029",
  38556. "\u320F",
  38557. "\u0028\u1102\u1161\u0029",
  38558. "\u3210",
  38559. "\u0028\u1103\u1161\u0029",
  38560. "\u3211",
  38561. "\u0028\u1105\u1161\u0029",
  38562. "\u3212",
  38563. "\u0028\u1106\u1161\u0029",
  38564. "\u3213",
  38565. "\u0028\u1107\u1161\u0029",
  38566. "\u3214",
  38567. "\u0028\u1109\u1161\u0029",
  38568. "\u3215",
  38569. "\u0028\u110B\u1161\u0029",
  38570. "\u3216",
  38571. "\u0028\u110C\u1161\u0029",
  38572. "\u3217",
  38573. "\u0028\u110E\u1161\u0029",
  38574. "\u3218",
  38575. "\u0028\u110F\u1161\u0029",
  38576. "\u3219",
  38577. "\u0028\u1110\u1161\u0029",
  38578. "\u321A",
  38579. "\u0028\u1111\u1161\u0029",
  38580. "\u321B",
  38581. "\u0028\u1112\u1161\u0029",
  38582. "\u321C",
  38583. "\u0028\u110C\u116E\u0029",
  38584. "\u321D",
  38585. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  38586. "\u321E",
  38587. "\u0028\u110B\u1169\u1112\u116E\u0029",
  38588. "\u3220",
  38589. "\u0028\u4E00\u0029",
  38590. "\u3221",
  38591. "\u0028\u4E8C\u0029",
  38592. "\u3222",
  38593. "\u0028\u4E09\u0029",
  38594. "\u3223",
  38595. "\u0028\u56DB\u0029",
  38596. "\u3224",
  38597. "\u0028\u4E94\u0029",
  38598. "\u3225",
  38599. "\u0028\u516D\u0029",
  38600. "\u3226",
  38601. "\u0028\u4E03\u0029",
  38602. "\u3227",
  38603. "\u0028\u516B\u0029",
  38604. "\u3228",
  38605. "\u0028\u4E5D\u0029",
  38606. "\u3229",
  38607. "\u0028\u5341\u0029",
  38608. "\u322A",
  38609. "\u0028\u6708\u0029",
  38610. "\u322B",
  38611. "\u0028\u706B\u0029",
  38612. "\u322C",
  38613. "\u0028\u6C34\u0029",
  38614. "\u322D",
  38615. "\u0028\u6728\u0029",
  38616. "\u322E",
  38617. "\u0028\u91D1\u0029",
  38618. "\u322F",
  38619. "\u0028\u571F\u0029",
  38620. "\u3230",
  38621. "\u0028\u65E5\u0029",
  38622. "\u3231",
  38623. "\u0028\u682A\u0029",
  38624. "\u3232",
  38625. "\u0028\u6709\u0029",
  38626. "\u3233",
  38627. "\u0028\u793E\u0029",
  38628. "\u3234",
  38629. "\u0028\u540D\u0029",
  38630. "\u3235",
  38631. "\u0028\u7279\u0029",
  38632. "\u3236",
  38633. "\u0028\u8CA1\u0029",
  38634. "\u3237",
  38635. "\u0028\u795D\u0029",
  38636. "\u3238",
  38637. "\u0028\u52B4\u0029",
  38638. "\u3239",
  38639. "\u0028\u4EE3\u0029",
  38640. "\u323A",
  38641. "\u0028\u547C\u0029",
  38642. "\u323B",
  38643. "\u0028\u5B66\u0029",
  38644. "\u323C",
  38645. "\u0028\u76E3\u0029",
  38646. "\u323D",
  38647. "\u0028\u4F01\u0029",
  38648. "\u323E",
  38649. "\u0028\u8CC7\u0029",
  38650. "\u323F",
  38651. "\u0028\u5354\u0029",
  38652. "\u3240",
  38653. "\u0028\u796D\u0029",
  38654. "\u3241",
  38655. "\u0028\u4F11\u0029",
  38656. "\u3242",
  38657. "\u0028\u81EA\u0029",
  38658. "\u3243",
  38659. "\u0028\u81F3\u0029",
  38660. "\u32C0",
  38661. "\u0031\u6708",
  38662. "\u32C1",
  38663. "\u0032\u6708",
  38664. "\u32C2",
  38665. "\u0033\u6708",
  38666. "\u32C3",
  38667. "\u0034\u6708",
  38668. "\u32C4",
  38669. "\u0035\u6708",
  38670. "\u32C5",
  38671. "\u0036\u6708",
  38672. "\u32C6",
  38673. "\u0037\u6708",
  38674. "\u32C7",
  38675. "\u0038\u6708",
  38676. "\u32C8",
  38677. "\u0039\u6708",
  38678. "\u32C9",
  38679. "\u0031\u0030\u6708",
  38680. "\u32CA",
  38681. "\u0031\u0031\u6708",
  38682. "\u32CB",
  38683. "\u0031\u0032\u6708",
  38684. "\u3358",
  38685. "\u0030\u70B9",
  38686. "\u3359",
  38687. "\u0031\u70B9",
  38688. "\u335A",
  38689. "\u0032\u70B9",
  38690. "\u335B",
  38691. "\u0033\u70B9",
  38692. "\u335C",
  38693. "\u0034\u70B9",
  38694. "\u335D",
  38695. "\u0035\u70B9",
  38696. "\u335E",
  38697. "\u0036\u70B9",
  38698. "\u335F",
  38699. "\u0037\u70B9",
  38700. "\u3360",
  38701. "\u0038\u70B9",
  38702. "\u3361",
  38703. "\u0039\u70B9",
  38704. "\u3362",
  38705. "\u0031\u0030\u70B9",
  38706. "\u3363",
  38707. "\u0031\u0031\u70B9",
  38708. "\u3364",
  38709. "\u0031\u0032\u70B9",
  38710. "\u3365",
  38711. "\u0031\u0033\u70B9",
  38712. "\u3366",
  38713. "\u0031\u0034\u70B9",
  38714. "\u3367",
  38715. "\u0031\u0035\u70B9",
  38716. "\u3368",
  38717. "\u0031\u0036\u70B9",
  38718. "\u3369",
  38719. "\u0031\u0037\u70B9",
  38720. "\u336A",
  38721. "\u0031\u0038\u70B9",
  38722. "\u336B",
  38723. "\u0031\u0039\u70B9",
  38724. "\u336C",
  38725. "\u0032\u0030\u70B9",
  38726. "\u336D",
  38727. "\u0032\u0031\u70B9",
  38728. "\u336E",
  38729. "\u0032\u0032\u70B9",
  38730. "\u336F",
  38731. "\u0032\u0033\u70B9",
  38732. "\u3370",
  38733. "\u0032\u0034\u70B9",
  38734. "\u33E0",
  38735. "\u0031\u65E5",
  38736. "\u33E1",
  38737. "\u0032\u65E5",
  38738. "\u33E2",
  38739. "\u0033\u65E5",
  38740. "\u33E3",
  38741. "\u0034\u65E5",
  38742. "\u33E4",
  38743. "\u0035\u65E5",
  38744. "\u33E5",
  38745. "\u0036\u65E5",
  38746. "\u33E6",
  38747. "\u0037\u65E5",
  38748. "\u33E7",
  38749. "\u0038\u65E5",
  38750. "\u33E8",
  38751. "\u0039\u65E5",
  38752. "\u33E9",
  38753. "\u0031\u0030\u65E5",
  38754. "\u33EA",
  38755. "\u0031\u0031\u65E5",
  38756. "\u33EB",
  38757. "\u0031\u0032\u65E5",
  38758. "\u33EC",
  38759. "\u0031\u0033\u65E5",
  38760. "\u33ED",
  38761. "\u0031\u0034\u65E5",
  38762. "\u33EE",
  38763. "\u0031\u0035\u65E5",
  38764. "\u33EF",
  38765. "\u0031\u0036\u65E5",
  38766. "\u33F0",
  38767. "\u0031\u0037\u65E5",
  38768. "\u33F1",
  38769. "\u0031\u0038\u65E5",
  38770. "\u33F2",
  38771. "\u0031\u0039\u65E5",
  38772. "\u33F3",
  38773. "\u0032\u0030\u65E5",
  38774. "\u33F4",
  38775. "\u0032\u0031\u65E5",
  38776. "\u33F5",
  38777. "\u0032\u0032\u65E5",
  38778. "\u33F6",
  38779. "\u0032\u0033\u65E5",
  38780. "\u33F7",
  38781. "\u0032\u0034\u65E5",
  38782. "\u33F8",
  38783. "\u0032\u0035\u65E5",
  38784. "\u33F9",
  38785. "\u0032\u0036\u65E5",
  38786. "\u33FA",
  38787. "\u0032\u0037\u65E5",
  38788. "\u33FB",
  38789. "\u0032\u0038\u65E5",
  38790. "\u33FC",
  38791. "\u0032\u0039\u65E5",
  38792. "\u33FD",
  38793. "\u0033\u0030\u65E5",
  38794. "\u33FE",
  38795. "\u0033\u0031\u65E5",
  38796. "\uFB00",
  38797. "\u0066\u0066",
  38798. "\uFB01",
  38799. "\u0066\u0069",
  38800. "\uFB02",
  38801. "\u0066\u006C",
  38802. "\uFB03",
  38803. "\u0066\u0066\u0069",
  38804. "\uFB04",
  38805. "\u0066\u0066\u006C",
  38806. "\uFB05",
  38807. "\u017F\u0074",
  38808. "\uFB06",
  38809. "\u0073\u0074",
  38810. "\uFB13",
  38811. "\u0574\u0576",
  38812. "\uFB14",
  38813. "\u0574\u0565",
  38814. "\uFB15",
  38815. "\u0574\u056B",
  38816. "\uFB16",
  38817. "\u057E\u0576",
  38818. "\uFB17",
  38819. "\u0574\u056D",
  38820. "\uFB4F",
  38821. "\u05D0\u05DC",
  38822. "\uFB50",
  38823. "\u0671",
  38824. "\uFB51",
  38825. "\u0671",
  38826. "\uFB52",
  38827. "\u067B",
  38828. "\uFB53",
  38829. "\u067B",
  38830. "\uFB54",
  38831. "\u067B",
  38832. "\uFB55",
  38833. "\u067B",
  38834. "\uFB56",
  38835. "\u067E",
  38836. "\uFB57",
  38837. "\u067E",
  38838. "\uFB58",
  38839. "\u067E",
  38840. "\uFB59",
  38841. "\u067E",
  38842. "\uFB5A",
  38843. "\u0680",
  38844. "\uFB5B",
  38845. "\u0680",
  38846. "\uFB5C",
  38847. "\u0680",
  38848. "\uFB5D",
  38849. "\u0680",
  38850. "\uFB5E",
  38851. "\u067A",
  38852. "\uFB5F",
  38853. "\u067A",
  38854. "\uFB60",
  38855. "\u067A",
  38856. "\uFB61",
  38857. "\u067A",
  38858. "\uFB62",
  38859. "\u067F",
  38860. "\uFB63",
  38861. "\u067F",
  38862. "\uFB64",
  38863. "\u067F",
  38864. "\uFB65",
  38865. "\u067F",
  38866. "\uFB66",
  38867. "\u0679",
  38868. "\uFB67",
  38869. "\u0679",
  38870. "\uFB68",
  38871. "\u0679",
  38872. "\uFB69",
  38873. "\u0679",
  38874. "\uFB6A",
  38875. "\u06A4",
  38876. "\uFB6B",
  38877. "\u06A4",
  38878. "\uFB6C",
  38879. "\u06A4",
  38880. "\uFB6D",
  38881. "\u06A4",
  38882. "\uFB6E",
  38883. "\u06A6",
  38884. "\uFB6F",
  38885. "\u06A6",
  38886. "\uFB70",
  38887. "\u06A6",
  38888. "\uFB71",
  38889. "\u06A6",
  38890. "\uFB72",
  38891. "\u0684",
  38892. "\uFB73",
  38893. "\u0684",
  38894. "\uFB74",
  38895. "\u0684",
  38896. "\uFB75",
  38897. "\u0684",
  38898. "\uFB76",
  38899. "\u0683",
  38900. "\uFB77",
  38901. "\u0683",
  38902. "\uFB78",
  38903. "\u0683",
  38904. "\uFB79",
  38905. "\u0683",
  38906. "\uFB7A",
  38907. "\u0686",
  38908. "\uFB7B",
  38909. "\u0686",
  38910. "\uFB7C",
  38911. "\u0686",
  38912. "\uFB7D",
  38913. "\u0686",
  38914. "\uFB7E",
  38915. "\u0687",
  38916. "\uFB7F",
  38917. "\u0687",
  38918. "\uFB80",
  38919. "\u0687",
  38920. "\uFB81",
  38921. "\u0687",
  38922. "\uFB82",
  38923. "\u068D",
  38924. "\uFB83",
  38925. "\u068D",
  38926. "\uFB84",
  38927. "\u068C",
  38928. "\uFB85",
  38929. "\u068C",
  38930. "\uFB86",
  38931. "\u068E",
  38932. "\uFB87",
  38933. "\u068E",
  38934. "\uFB88",
  38935. "\u0688",
  38936. "\uFB89",
  38937. "\u0688",
  38938. "\uFB8A",
  38939. "\u0698",
  38940. "\uFB8B",
  38941. "\u0698",
  38942. "\uFB8C",
  38943. "\u0691",
  38944. "\uFB8D",
  38945. "\u0691",
  38946. "\uFB8E",
  38947. "\u06A9",
  38948. "\uFB8F",
  38949. "\u06A9",
  38950. "\uFB90",
  38951. "\u06A9",
  38952. "\uFB91",
  38953. "\u06A9",
  38954. "\uFB92",
  38955. "\u06AF",
  38956. "\uFB93",
  38957. "\u06AF",
  38958. "\uFB94",
  38959. "\u06AF",
  38960. "\uFB95",
  38961. "\u06AF",
  38962. "\uFB96",
  38963. "\u06B3",
  38964. "\uFB97",
  38965. "\u06B3",
  38966. "\uFB98",
  38967. "\u06B3",
  38968. "\uFB99",
  38969. "\u06B3",
  38970. "\uFB9A",
  38971. "\u06B1",
  38972. "\uFB9B",
  38973. "\u06B1",
  38974. "\uFB9C",
  38975. "\u06B1",
  38976. "\uFB9D",
  38977. "\u06B1",
  38978. "\uFB9E",
  38979. "\u06BA",
  38980. "\uFB9F",
  38981. "\u06BA",
  38982. "\uFBA0",
  38983. "\u06BB",
  38984. "\uFBA1",
  38985. "\u06BB",
  38986. "\uFBA2",
  38987. "\u06BB",
  38988. "\uFBA3",
  38989. "\u06BB",
  38990. "\uFBA4",
  38991. "\u06C0",
  38992. "\uFBA5",
  38993. "\u06C0",
  38994. "\uFBA6",
  38995. "\u06C1",
  38996. "\uFBA7",
  38997. "\u06C1",
  38998. "\uFBA8",
  38999. "\u06C1",
  39000. "\uFBA9",
  39001. "\u06C1",
  39002. "\uFBAA",
  39003. "\u06BE",
  39004. "\uFBAB",
  39005. "\u06BE",
  39006. "\uFBAC",
  39007. "\u06BE",
  39008. "\uFBAD",
  39009. "\u06BE",
  39010. "\uFBAE",
  39011. "\u06D2",
  39012. "\uFBAF",
  39013. "\u06D2",
  39014. "\uFBB0",
  39015. "\u06D3",
  39016. "\uFBB1",
  39017. "\u06D3",
  39018. "\uFBD3",
  39019. "\u06AD",
  39020. "\uFBD4",
  39021. "\u06AD",
  39022. "\uFBD5",
  39023. "\u06AD",
  39024. "\uFBD6",
  39025. "\u06AD",
  39026. "\uFBD7",
  39027. "\u06C7",
  39028. "\uFBD8",
  39029. "\u06C7",
  39030. "\uFBD9",
  39031. "\u06C6",
  39032. "\uFBDA",
  39033. "\u06C6",
  39034. "\uFBDB",
  39035. "\u06C8",
  39036. "\uFBDC",
  39037. "\u06C8",
  39038. "\uFBDD",
  39039. "\u0677",
  39040. "\uFBDE",
  39041. "\u06CB",
  39042. "\uFBDF",
  39043. "\u06CB",
  39044. "\uFBE0",
  39045. "\u06C5",
  39046. "\uFBE1",
  39047. "\u06C5",
  39048. "\uFBE2",
  39049. "\u06C9",
  39050. "\uFBE3",
  39051. "\u06C9",
  39052. "\uFBE4",
  39053. "\u06D0",
  39054. "\uFBE5",
  39055. "\u06D0",
  39056. "\uFBE6",
  39057. "\u06D0",
  39058. "\uFBE7",
  39059. "\u06D0",
  39060. "\uFBE8",
  39061. "\u0649",
  39062. "\uFBE9",
  39063. "\u0649",
  39064. "\uFBEA",
  39065. "\u0626\u0627",
  39066. "\uFBEB",
  39067. "\u0626\u0627",
  39068. "\uFBEC",
  39069. "\u0626\u06D5",
  39070. "\uFBED",
  39071. "\u0626\u06D5",
  39072. "\uFBEE",
  39073. "\u0626\u0648",
  39074. "\uFBEF",
  39075. "\u0626\u0648",
  39076. "\uFBF0",
  39077. "\u0626\u06C7",
  39078. "\uFBF1",
  39079. "\u0626\u06C7",
  39080. "\uFBF2",
  39081. "\u0626\u06C6",
  39082. "\uFBF3",
  39083. "\u0626\u06C6",
  39084. "\uFBF4",
  39085. "\u0626\u06C8",
  39086. "\uFBF5",
  39087. "\u0626\u06C8",
  39088. "\uFBF6",
  39089. "\u0626\u06D0",
  39090. "\uFBF7",
  39091. "\u0626\u06D0",
  39092. "\uFBF8",
  39093. "\u0626\u06D0",
  39094. "\uFBF9",
  39095. "\u0626\u0649",
  39096. "\uFBFA",
  39097. "\u0626\u0649",
  39098. "\uFBFB",
  39099. "\u0626\u0649",
  39100. "\uFBFC",
  39101. "\u06CC",
  39102. "\uFBFD",
  39103. "\u06CC",
  39104. "\uFBFE",
  39105. "\u06CC",
  39106. "\uFBFF",
  39107. "\u06CC",
  39108. "\uFC00",
  39109. "\u0626\u062C",
  39110. "\uFC01",
  39111. "\u0626\u062D",
  39112. "\uFC02",
  39113. "\u0626\u0645",
  39114. "\uFC03",
  39115. "\u0626\u0649",
  39116. "\uFC04",
  39117. "\u0626\u064A",
  39118. "\uFC05",
  39119. "\u0628\u062C",
  39120. "\uFC06",
  39121. "\u0628\u062D",
  39122. "\uFC07",
  39123. "\u0628\u062E",
  39124. "\uFC08",
  39125. "\u0628\u0645",
  39126. "\uFC09",
  39127. "\u0628\u0649",
  39128. "\uFC0A",
  39129. "\u0628\u064A",
  39130. "\uFC0B",
  39131. "\u062A\u062C",
  39132. "\uFC0C",
  39133. "\u062A\u062D",
  39134. "\uFC0D",
  39135. "\u062A\u062E",
  39136. "\uFC0E",
  39137. "\u062A\u0645",
  39138. "\uFC0F",
  39139. "\u062A\u0649",
  39140. "\uFC10",
  39141. "\u062A\u064A",
  39142. "\uFC11",
  39143. "\u062B\u062C",
  39144. "\uFC12",
  39145. "\u062B\u0645",
  39146. "\uFC13",
  39147. "\u062B\u0649",
  39148. "\uFC14",
  39149. "\u062B\u064A",
  39150. "\uFC15",
  39151. "\u062C\u062D",
  39152. "\uFC16",
  39153. "\u062C\u0645",
  39154. "\uFC17",
  39155. "\u062D\u062C",
  39156. "\uFC18",
  39157. "\u062D\u0645",
  39158. "\uFC19",
  39159. "\u062E\u062C",
  39160. "\uFC1A",
  39161. "\u062E\u062D",
  39162. "\uFC1B",
  39163. "\u062E\u0645",
  39164. "\uFC1C",
  39165. "\u0633\u062C",
  39166. "\uFC1D",
  39167. "\u0633\u062D",
  39168. "\uFC1E",
  39169. "\u0633\u062E",
  39170. "\uFC1F",
  39171. "\u0633\u0645",
  39172. "\uFC20",
  39173. "\u0635\u062D",
  39174. "\uFC21",
  39175. "\u0635\u0645",
  39176. "\uFC22",
  39177. "\u0636\u062C",
  39178. "\uFC23",
  39179. "\u0636\u062D",
  39180. "\uFC24",
  39181. "\u0636\u062E",
  39182. "\uFC25",
  39183. "\u0636\u0645",
  39184. "\uFC26",
  39185. "\u0637\u062D",
  39186. "\uFC27",
  39187. "\u0637\u0645",
  39188. "\uFC28",
  39189. "\u0638\u0645",
  39190. "\uFC29",
  39191. "\u0639\u062C",
  39192. "\uFC2A",
  39193. "\u0639\u0645",
  39194. "\uFC2B",
  39195. "\u063A\u062C",
  39196. "\uFC2C",
  39197. "\u063A\u0645",
  39198. "\uFC2D",
  39199. "\u0641\u062C",
  39200. "\uFC2E",
  39201. "\u0641\u062D",
  39202. "\uFC2F",
  39203. "\u0641\u062E",
  39204. "\uFC30",
  39205. "\u0641\u0645",
  39206. "\uFC31",
  39207. "\u0641\u0649",
  39208. "\uFC32",
  39209. "\u0641\u064A",
  39210. "\uFC33",
  39211. "\u0642\u062D",
  39212. "\uFC34",
  39213. "\u0642\u0645",
  39214. "\uFC35",
  39215. "\u0642\u0649",
  39216. "\uFC36",
  39217. "\u0642\u064A",
  39218. "\uFC37",
  39219. "\u0643\u0627",
  39220. "\uFC38",
  39221. "\u0643\u062C",
  39222. "\uFC39",
  39223. "\u0643\u062D",
  39224. "\uFC3A",
  39225. "\u0643\u062E",
  39226. "\uFC3B",
  39227. "\u0643\u0644",
  39228. "\uFC3C",
  39229. "\u0643\u0645",
  39230. "\uFC3D",
  39231. "\u0643\u0649",
  39232. "\uFC3E",
  39233. "\u0643\u064A",
  39234. "\uFC3F",
  39235. "\u0644\u062C",
  39236. "\uFC40",
  39237. "\u0644\u062D",
  39238. "\uFC41",
  39239. "\u0644\u062E",
  39240. "\uFC42",
  39241. "\u0644\u0645",
  39242. "\uFC43",
  39243. "\u0644\u0649",
  39244. "\uFC44",
  39245. "\u0644\u064A",
  39246. "\uFC45",
  39247. "\u0645\u062C",
  39248. "\uFC46",
  39249. "\u0645\u062D",
  39250. "\uFC47",
  39251. "\u0645\u062E",
  39252. "\uFC48",
  39253. "\u0645\u0645",
  39254. "\uFC49",
  39255. "\u0645\u0649",
  39256. "\uFC4A",
  39257. "\u0645\u064A",
  39258. "\uFC4B",
  39259. "\u0646\u062C",
  39260. "\uFC4C",
  39261. "\u0646\u062D",
  39262. "\uFC4D",
  39263. "\u0646\u062E",
  39264. "\uFC4E",
  39265. "\u0646\u0645",
  39266. "\uFC4F",
  39267. "\u0646\u0649",
  39268. "\uFC50",
  39269. "\u0646\u064A",
  39270. "\uFC51",
  39271. "\u0647\u062C",
  39272. "\uFC52",
  39273. "\u0647\u0645",
  39274. "\uFC53",
  39275. "\u0647\u0649",
  39276. "\uFC54",
  39277. "\u0647\u064A",
  39278. "\uFC55",
  39279. "\u064A\u062C",
  39280. "\uFC56",
  39281. "\u064A\u062D",
  39282. "\uFC57",
  39283. "\u064A\u062E",
  39284. "\uFC58",
  39285. "\u064A\u0645",
  39286. "\uFC59",
  39287. "\u064A\u0649",
  39288. "\uFC5A",
  39289. "\u064A\u064A",
  39290. "\uFC5B",
  39291. "\u0630\u0670",
  39292. "\uFC5C",
  39293. "\u0631\u0670",
  39294. "\uFC5D",
  39295. "\u0649\u0670",
  39296. "\uFC5E",
  39297. "\u0020\u064C\u0651",
  39298. "\uFC5F",
  39299. "\u0020\u064D\u0651",
  39300. "\uFC60",
  39301. "\u0020\u064E\u0651",
  39302. "\uFC61",
  39303. "\u0020\u064F\u0651",
  39304. "\uFC62",
  39305. "\u0020\u0650\u0651",
  39306. "\uFC63",
  39307. "\u0020\u0651\u0670",
  39308. "\uFC64",
  39309. "\u0626\u0631",
  39310. "\uFC65",
  39311. "\u0626\u0632",
  39312. "\uFC66",
  39313. "\u0626\u0645",
  39314. "\uFC67",
  39315. "\u0626\u0646",
  39316. "\uFC68",
  39317. "\u0626\u0649",
  39318. "\uFC69",
  39319. "\u0626\u064A",
  39320. "\uFC6A",
  39321. "\u0628\u0631",
  39322. "\uFC6B",
  39323. "\u0628\u0632",
  39324. "\uFC6C",
  39325. "\u0628\u0645",
  39326. "\uFC6D",
  39327. "\u0628\u0646",
  39328. "\uFC6E",
  39329. "\u0628\u0649",
  39330. "\uFC6F",
  39331. "\u0628\u064A",
  39332. "\uFC70",
  39333. "\u062A\u0631",
  39334. "\uFC71",
  39335. "\u062A\u0632",
  39336. "\uFC72",
  39337. "\u062A\u0645",
  39338. "\uFC73",
  39339. "\u062A\u0646",
  39340. "\uFC74",
  39341. "\u062A\u0649",
  39342. "\uFC75",
  39343. "\u062A\u064A",
  39344. "\uFC76",
  39345. "\u062B\u0631",
  39346. "\uFC77",
  39347. "\u062B\u0632",
  39348. "\uFC78",
  39349. "\u062B\u0645",
  39350. "\uFC79",
  39351. "\u062B\u0646",
  39352. "\uFC7A",
  39353. "\u062B\u0649",
  39354. "\uFC7B",
  39355. "\u062B\u064A",
  39356. "\uFC7C",
  39357. "\u0641\u0649",
  39358. "\uFC7D",
  39359. "\u0641\u064A",
  39360. "\uFC7E",
  39361. "\u0642\u0649",
  39362. "\uFC7F",
  39363. "\u0642\u064A",
  39364. "\uFC80",
  39365. "\u0643\u0627",
  39366. "\uFC81",
  39367. "\u0643\u0644",
  39368. "\uFC82",
  39369. "\u0643\u0645",
  39370. "\uFC83",
  39371. "\u0643\u0649",
  39372. "\uFC84",
  39373. "\u0643\u064A",
  39374. "\uFC85",
  39375. "\u0644\u0645",
  39376. "\uFC86",
  39377. "\u0644\u0649",
  39378. "\uFC87",
  39379. "\u0644\u064A",
  39380. "\uFC88",
  39381. "\u0645\u0627",
  39382. "\uFC89",
  39383. "\u0645\u0645",
  39384. "\uFC8A",
  39385. "\u0646\u0631",
  39386. "\uFC8B",
  39387. "\u0646\u0632",
  39388. "\uFC8C",
  39389. "\u0646\u0645",
  39390. "\uFC8D",
  39391. "\u0646\u0646",
  39392. "\uFC8E",
  39393. "\u0646\u0649",
  39394. "\uFC8F",
  39395. "\u0646\u064A",
  39396. "\uFC90",
  39397. "\u0649\u0670",
  39398. "\uFC91",
  39399. "\u064A\u0631",
  39400. "\uFC92",
  39401. "\u064A\u0632",
  39402. "\uFC93",
  39403. "\u064A\u0645",
  39404. "\uFC94",
  39405. "\u064A\u0646",
  39406. "\uFC95",
  39407. "\u064A\u0649",
  39408. "\uFC96",
  39409. "\u064A\u064A",
  39410. "\uFC97",
  39411. "\u0626\u062C",
  39412. "\uFC98",
  39413. "\u0626\u062D",
  39414. "\uFC99",
  39415. "\u0626\u062E",
  39416. "\uFC9A",
  39417. "\u0626\u0645",
  39418. "\uFC9B",
  39419. "\u0626\u0647",
  39420. "\uFC9C",
  39421. "\u0628\u062C",
  39422. "\uFC9D",
  39423. "\u0628\u062D",
  39424. "\uFC9E",
  39425. "\u0628\u062E",
  39426. "\uFC9F",
  39427. "\u0628\u0645",
  39428. "\uFCA0",
  39429. "\u0628\u0647",
  39430. "\uFCA1",
  39431. "\u062A\u062C",
  39432. "\uFCA2",
  39433. "\u062A\u062D",
  39434. "\uFCA3",
  39435. "\u062A\u062E",
  39436. "\uFCA4",
  39437. "\u062A\u0645",
  39438. "\uFCA5",
  39439. "\u062A\u0647",
  39440. "\uFCA6",
  39441. "\u062B\u0645",
  39442. "\uFCA7",
  39443. "\u062C\u062D",
  39444. "\uFCA8",
  39445. "\u062C\u0645",
  39446. "\uFCA9",
  39447. "\u062D\u062C",
  39448. "\uFCAA",
  39449. "\u062D\u0645",
  39450. "\uFCAB",
  39451. "\u062E\u062C",
  39452. "\uFCAC",
  39453. "\u062E\u0645",
  39454. "\uFCAD",
  39455. "\u0633\u062C",
  39456. "\uFCAE",
  39457. "\u0633\u062D",
  39458. "\uFCAF",
  39459. "\u0633\u062E",
  39460. "\uFCB0",
  39461. "\u0633\u0645",
  39462. "\uFCB1",
  39463. "\u0635\u062D",
  39464. "\uFCB2",
  39465. "\u0635\u062E",
  39466. "\uFCB3",
  39467. "\u0635\u0645",
  39468. "\uFCB4",
  39469. "\u0636\u062C",
  39470. "\uFCB5",
  39471. "\u0636\u062D",
  39472. "\uFCB6",
  39473. "\u0636\u062E",
  39474. "\uFCB7",
  39475. "\u0636\u0645",
  39476. "\uFCB8",
  39477. "\u0637\u062D",
  39478. "\uFCB9",
  39479. "\u0638\u0645",
  39480. "\uFCBA",
  39481. "\u0639\u062C",
  39482. "\uFCBB",
  39483. "\u0639\u0645",
  39484. "\uFCBC",
  39485. "\u063A\u062C",
  39486. "\uFCBD",
  39487. "\u063A\u0645",
  39488. "\uFCBE",
  39489. "\u0641\u062C",
  39490. "\uFCBF",
  39491. "\u0641\u062D",
  39492. "\uFCC0",
  39493. "\u0641\u062E",
  39494. "\uFCC1",
  39495. "\u0641\u0645",
  39496. "\uFCC2",
  39497. "\u0642\u062D",
  39498. "\uFCC3",
  39499. "\u0642\u0645",
  39500. "\uFCC4",
  39501. "\u0643\u062C",
  39502. "\uFCC5",
  39503. "\u0643\u062D",
  39504. "\uFCC6",
  39505. "\u0643\u062E",
  39506. "\uFCC7",
  39507. "\u0643\u0644",
  39508. "\uFCC8",
  39509. "\u0643\u0645",
  39510. "\uFCC9",
  39511. "\u0644\u062C",
  39512. "\uFCCA",
  39513. "\u0644\u062D",
  39514. "\uFCCB",
  39515. "\u0644\u062E",
  39516. "\uFCCC",
  39517. "\u0644\u0645",
  39518. "\uFCCD",
  39519. "\u0644\u0647",
  39520. "\uFCCE",
  39521. "\u0645\u062C",
  39522. "\uFCCF",
  39523. "\u0645\u062D",
  39524. "\uFCD0",
  39525. "\u0645\u062E",
  39526. "\uFCD1",
  39527. "\u0645\u0645",
  39528. "\uFCD2",
  39529. "\u0646\u062C",
  39530. "\uFCD3",
  39531. "\u0646\u062D",
  39532. "\uFCD4",
  39533. "\u0646\u062E",
  39534. "\uFCD5",
  39535. "\u0646\u0645",
  39536. "\uFCD6",
  39537. "\u0646\u0647",
  39538. "\uFCD7",
  39539. "\u0647\u062C",
  39540. "\uFCD8",
  39541. "\u0647\u0645",
  39542. "\uFCD9",
  39543. "\u0647\u0670",
  39544. "\uFCDA",
  39545. "\u064A\u062C",
  39546. "\uFCDB",
  39547. "\u064A\u062D",
  39548. "\uFCDC",
  39549. "\u064A\u062E",
  39550. "\uFCDD",
  39551. "\u064A\u0645",
  39552. "\uFCDE",
  39553. "\u064A\u0647",
  39554. "\uFCDF",
  39555. "\u0626\u0645",
  39556. "\uFCE0",
  39557. "\u0626\u0647",
  39558. "\uFCE1",
  39559. "\u0628\u0645",
  39560. "\uFCE2",
  39561. "\u0628\u0647",
  39562. "\uFCE3",
  39563. "\u062A\u0645",
  39564. "\uFCE4",
  39565. "\u062A\u0647",
  39566. "\uFCE5",
  39567. "\u062B\u0645",
  39568. "\uFCE6",
  39569. "\u062B\u0647",
  39570. "\uFCE7",
  39571. "\u0633\u0645",
  39572. "\uFCE8",
  39573. "\u0633\u0647",
  39574. "\uFCE9",
  39575. "\u0634\u0645",
  39576. "\uFCEA",
  39577. "\u0634\u0647",
  39578. "\uFCEB",
  39579. "\u0643\u0644",
  39580. "\uFCEC",
  39581. "\u0643\u0645",
  39582. "\uFCED",
  39583. "\u0644\u0645",
  39584. "\uFCEE",
  39585. "\u0646\u0645",
  39586. "\uFCEF",
  39587. "\u0646\u0647",
  39588. "\uFCF0",
  39589. "\u064A\u0645",
  39590. "\uFCF1",
  39591. "\u064A\u0647",
  39592. "\uFCF2",
  39593. "\u0640\u064E\u0651",
  39594. "\uFCF3",
  39595. "\u0640\u064F\u0651",
  39596. "\uFCF4",
  39597. "\u0640\u0650\u0651",
  39598. "\uFCF5",
  39599. "\u0637\u0649",
  39600. "\uFCF6",
  39601. "\u0637\u064A",
  39602. "\uFCF7",
  39603. "\u0639\u0649",
  39604. "\uFCF8",
  39605. "\u0639\u064A",
  39606. "\uFCF9",
  39607. "\u063A\u0649",
  39608. "\uFCFA",
  39609. "\u063A\u064A",
  39610. "\uFCFB",
  39611. "\u0633\u0649",
  39612. "\uFCFC",
  39613. "\u0633\u064A",
  39614. "\uFCFD",
  39615. "\u0634\u0649",
  39616. "\uFCFE",
  39617. "\u0634\u064A",
  39618. "\uFCFF",
  39619. "\u062D\u0649",
  39620. "\uFD00",
  39621. "\u062D\u064A",
  39622. "\uFD01",
  39623. "\u062C\u0649",
  39624. "\uFD02",
  39625. "\u062C\u064A",
  39626. "\uFD03",
  39627. "\u062E\u0649",
  39628. "\uFD04",
  39629. "\u062E\u064A",
  39630. "\uFD05",
  39631. "\u0635\u0649",
  39632. "\uFD06",
  39633. "\u0635\u064A",
  39634. "\uFD07",
  39635. "\u0636\u0649",
  39636. "\uFD08",
  39637. "\u0636\u064A",
  39638. "\uFD09",
  39639. "\u0634\u062C",
  39640. "\uFD0A",
  39641. "\u0634\u062D",
  39642. "\uFD0B",
  39643. "\u0634\u062E",
  39644. "\uFD0C",
  39645. "\u0634\u0645",
  39646. "\uFD0D",
  39647. "\u0634\u0631",
  39648. "\uFD0E",
  39649. "\u0633\u0631",
  39650. "\uFD0F",
  39651. "\u0635\u0631",
  39652. "\uFD10",
  39653. "\u0636\u0631",
  39654. "\uFD11",
  39655. "\u0637\u0649",
  39656. "\uFD12",
  39657. "\u0637\u064A",
  39658. "\uFD13",
  39659. "\u0639\u0649",
  39660. "\uFD14",
  39661. "\u0639\u064A",
  39662. "\uFD15",
  39663. "\u063A\u0649",
  39664. "\uFD16",
  39665. "\u063A\u064A",
  39666. "\uFD17",
  39667. "\u0633\u0649",
  39668. "\uFD18",
  39669. "\u0633\u064A",
  39670. "\uFD19",
  39671. "\u0634\u0649",
  39672. "\uFD1A",
  39673. "\u0634\u064A",
  39674. "\uFD1B",
  39675. "\u062D\u0649",
  39676. "\uFD1C",
  39677. "\u062D\u064A",
  39678. "\uFD1D",
  39679. "\u062C\u0649",
  39680. "\uFD1E",
  39681. "\u062C\u064A",
  39682. "\uFD1F",
  39683. "\u062E\u0649",
  39684. "\uFD20",
  39685. "\u062E\u064A",
  39686. "\uFD21",
  39687. "\u0635\u0649",
  39688. "\uFD22",
  39689. "\u0635\u064A",
  39690. "\uFD23",
  39691. "\u0636\u0649",
  39692. "\uFD24",
  39693. "\u0636\u064A",
  39694. "\uFD25",
  39695. "\u0634\u062C",
  39696. "\uFD26",
  39697. "\u0634\u062D",
  39698. "\uFD27",
  39699. "\u0634\u062E",
  39700. "\uFD28",
  39701. "\u0634\u0645",
  39702. "\uFD29",
  39703. "\u0634\u0631",
  39704. "\uFD2A",
  39705. "\u0633\u0631",
  39706. "\uFD2B",
  39707. "\u0635\u0631",
  39708. "\uFD2C",
  39709. "\u0636\u0631",
  39710. "\uFD2D",
  39711. "\u0634\u062C",
  39712. "\uFD2E",
  39713. "\u0634\u062D",
  39714. "\uFD2F",
  39715. "\u0634\u062E",
  39716. "\uFD30",
  39717. "\u0634\u0645",
  39718. "\uFD31",
  39719. "\u0633\u0647",
  39720. "\uFD32",
  39721. "\u0634\u0647",
  39722. "\uFD33",
  39723. "\u0637\u0645",
  39724. "\uFD34",
  39725. "\u0633\u062C",
  39726. "\uFD35",
  39727. "\u0633\u062D",
  39728. "\uFD36",
  39729. "\u0633\u062E",
  39730. "\uFD37",
  39731. "\u0634\u062C",
  39732. "\uFD38",
  39733. "\u0634\u062D",
  39734. "\uFD39",
  39735. "\u0634\u062E",
  39736. "\uFD3A",
  39737. "\u0637\u0645",
  39738. "\uFD3B",
  39739. "\u0638\u0645",
  39740. "\uFD3C",
  39741. "\u0627\u064B",
  39742. "\uFD3D",
  39743. "\u0627\u064B",
  39744. "\uFD50",
  39745. "\u062A\u062C\u0645",
  39746. "\uFD51",
  39747. "\u062A\u062D\u062C",
  39748. "\uFD52",
  39749. "\u062A\u062D\u062C",
  39750. "\uFD53",
  39751. "\u062A\u062D\u0645",
  39752. "\uFD54",
  39753. "\u062A\u062E\u0645",
  39754. "\uFD55",
  39755. "\u062A\u0645\u062C",
  39756. "\uFD56",
  39757. "\u062A\u0645\u062D",
  39758. "\uFD57",
  39759. "\u062A\u0645\u062E",
  39760. "\uFD58",
  39761. "\u062C\u0645\u062D",
  39762. "\uFD59",
  39763. "\u062C\u0645\u062D",
  39764. "\uFD5A",
  39765. "\u062D\u0645\u064A",
  39766. "\uFD5B",
  39767. "\u062D\u0645\u0649",
  39768. "\uFD5C",
  39769. "\u0633\u062D\u062C",
  39770. "\uFD5D",
  39771. "\u0633\u062C\u062D",
  39772. "\uFD5E",
  39773. "\u0633\u062C\u0649",
  39774. "\uFD5F",
  39775. "\u0633\u0645\u062D",
  39776. "\uFD60",
  39777. "\u0633\u0645\u062D",
  39778. "\uFD61",
  39779. "\u0633\u0645\u062C",
  39780. "\uFD62",
  39781. "\u0633\u0645\u0645",
  39782. "\uFD63",
  39783. "\u0633\u0645\u0645",
  39784. "\uFD64",
  39785. "\u0635\u062D\u062D",
  39786. "\uFD65",
  39787. "\u0635\u062D\u062D",
  39788. "\uFD66",
  39789. "\u0635\u0645\u0645",
  39790. "\uFD67",
  39791. "\u0634\u062D\u0645",
  39792. "\uFD68",
  39793. "\u0634\u062D\u0645",
  39794. "\uFD69",
  39795. "\u0634\u062C\u064A",
  39796. "\uFD6A",
  39797. "\u0634\u0645\u062E",
  39798. "\uFD6B",
  39799. "\u0634\u0645\u062E",
  39800. "\uFD6C",
  39801. "\u0634\u0645\u0645",
  39802. "\uFD6D",
  39803. "\u0634\u0645\u0645",
  39804. "\uFD6E",
  39805. "\u0636\u062D\u0649",
  39806. "\uFD6F",
  39807. "\u0636\u062E\u0645",
  39808. "\uFD70",
  39809. "\u0636\u062E\u0645",
  39810. "\uFD71",
  39811. "\u0637\u0645\u062D",
  39812. "\uFD72",
  39813. "\u0637\u0645\u062D",
  39814. "\uFD73",
  39815. "\u0637\u0645\u0645",
  39816. "\uFD74",
  39817. "\u0637\u0645\u064A",
  39818. "\uFD75",
  39819. "\u0639\u062C\u0645",
  39820. "\uFD76",
  39821. "\u0639\u0645\u0645",
  39822. "\uFD77",
  39823. "\u0639\u0645\u0645",
  39824. "\uFD78",
  39825. "\u0639\u0645\u0649",
  39826. "\uFD79",
  39827. "\u063A\u0645\u0645",
  39828. "\uFD7A",
  39829. "\u063A\u0645\u064A",
  39830. "\uFD7B",
  39831. "\u063A\u0645\u0649",
  39832. "\uFD7C",
  39833. "\u0641\u062E\u0645",
  39834. "\uFD7D",
  39835. "\u0641\u062E\u0645",
  39836. "\uFD7E",
  39837. "\u0642\u0645\u062D",
  39838. "\uFD7F",
  39839. "\u0642\u0645\u0645",
  39840. "\uFD80",
  39841. "\u0644\u062D\u0645",
  39842. "\uFD81",
  39843. "\u0644\u062D\u064A",
  39844. "\uFD82",
  39845. "\u0644\u062D\u0649",
  39846. "\uFD83",
  39847. "\u0644\u062C\u062C",
  39848. "\uFD84",
  39849. "\u0644\u062C\u062C",
  39850. "\uFD85",
  39851. "\u0644\u062E\u0645",
  39852. "\uFD86",
  39853. "\u0644\u062E\u0645",
  39854. "\uFD87",
  39855. "\u0644\u0645\u062D",
  39856. "\uFD88",
  39857. "\u0644\u0645\u062D",
  39858. "\uFD89",
  39859. "\u0645\u062D\u062C",
  39860. "\uFD8A",
  39861. "\u0645\u062D\u0645",
  39862. "\uFD8B",
  39863. "\u0645\u062D\u064A",
  39864. "\uFD8C",
  39865. "\u0645\u062C\u062D",
  39866. "\uFD8D",
  39867. "\u0645\u062C\u0645",
  39868. "\uFD8E",
  39869. "\u0645\u062E\u062C",
  39870. "\uFD8F",
  39871. "\u0645\u062E\u0645",
  39872. "\uFD92",
  39873. "\u0645\u062C\u062E",
  39874. "\uFD93",
  39875. "\u0647\u0645\u062C",
  39876. "\uFD94",
  39877. "\u0647\u0645\u0645",
  39878. "\uFD95",
  39879. "\u0646\u062D\u0645",
  39880. "\uFD96",
  39881. "\u0646\u062D\u0649",
  39882. "\uFD97",
  39883. "\u0646\u062C\u0645",
  39884. "\uFD98",
  39885. "\u0646\u062C\u0645",
  39886. "\uFD99",
  39887. "\u0646\u062C\u0649",
  39888. "\uFD9A",
  39889. "\u0646\u0645\u064A",
  39890. "\uFD9B",
  39891. "\u0646\u0645\u0649",
  39892. "\uFD9C",
  39893. "\u064A\u0645\u0645",
  39894. "\uFD9D",
  39895. "\u064A\u0645\u0645",
  39896. "\uFD9E",
  39897. "\u0628\u062E\u064A",
  39898. "\uFD9F",
  39899. "\u062A\u062C\u064A",
  39900. "\uFDA0",
  39901. "\u062A\u062C\u0649",
  39902. "\uFDA1",
  39903. "\u062A\u062E\u064A",
  39904. "\uFDA2",
  39905. "\u062A\u062E\u0649",
  39906. "\uFDA3",
  39907. "\u062A\u0645\u064A",
  39908. "\uFDA4",
  39909. "\u062A\u0645\u0649",
  39910. "\uFDA5",
  39911. "\u062C\u0645\u064A",
  39912. "\uFDA6",
  39913. "\u062C\u062D\u0649",
  39914. "\uFDA7",
  39915. "\u062C\u0645\u0649",
  39916. "\uFDA8",
  39917. "\u0633\u062E\u0649",
  39918. "\uFDA9",
  39919. "\u0635\u062D\u064A",
  39920. "\uFDAA",
  39921. "\u0634\u062D\u064A",
  39922. "\uFDAB",
  39923. "\u0636\u062D\u064A",
  39924. "\uFDAC",
  39925. "\u0644\u062C\u064A",
  39926. "\uFDAD",
  39927. "\u0644\u0645\u064A",
  39928. "\uFDAE",
  39929. "\u064A\u062D\u064A",
  39930. "\uFDAF",
  39931. "\u064A\u062C\u064A",
  39932. "\uFDB0",
  39933. "\u064A\u0645\u064A",
  39934. "\uFDB1",
  39935. "\u0645\u0645\u064A",
  39936. "\uFDB2",
  39937. "\u0642\u0645\u064A",
  39938. "\uFDB3",
  39939. "\u0646\u062D\u064A",
  39940. "\uFDB4",
  39941. "\u0642\u0645\u062D",
  39942. "\uFDB5",
  39943. "\u0644\u062D\u0645",
  39944. "\uFDB6",
  39945. "\u0639\u0645\u064A",
  39946. "\uFDB7",
  39947. "\u0643\u0645\u064A",
  39948. "\uFDB8",
  39949. "\u0646\u062C\u062D",
  39950. "\uFDB9",
  39951. "\u0645\u062E\u064A",
  39952. "\uFDBA",
  39953. "\u0644\u062C\u0645",
  39954. "\uFDBB",
  39955. "\u0643\u0645\u0645",
  39956. "\uFDBC",
  39957. "\u0644\u062C\u0645",
  39958. "\uFDBD",
  39959. "\u0646\u062C\u062D",
  39960. "\uFDBE",
  39961. "\u062C\u062D\u064A",
  39962. "\uFDBF",
  39963. "\u062D\u062C\u064A",
  39964. "\uFDC0",
  39965. "\u0645\u062C\u064A",
  39966. "\uFDC1",
  39967. "\u0641\u0645\u064A",
  39968. "\uFDC2",
  39969. "\u0628\u062D\u064A",
  39970. "\uFDC3",
  39971. "\u0643\u0645\u0645",
  39972. "\uFDC4",
  39973. "\u0639\u062C\u0645",
  39974. "\uFDC5",
  39975. "\u0635\u0645\u0645",
  39976. "\uFDC6",
  39977. "\u0633\u062E\u064A",
  39978. "\uFDC7",
  39979. "\u0646\u062C\u064A",
  39980. "\uFE49",
  39981. "\u203E",
  39982. "\uFE4A",
  39983. "\u203E",
  39984. "\uFE4B",
  39985. "\u203E",
  39986. "\uFE4C",
  39987. "\u203E",
  39988. "\uFE4D",
  39989. "\u005F",
  39990. "\uFE4E",
  39991. "\u005F",
  39992. "\uFE4F",
  39993. "\u005F",
  39994. "\uFE80",
  39995. "\u0621",
  39996. "\uFE81",
  39997. "\u0622",
  39998. "\uFE82",
  39999. "\u0622",
  40000. "\uFE83",
  40001. "\u0623",
  40002. "\uFE84",
  40003. "\u0623",
  40004. "\uFE85",
  40005. "\u0624",
  40006. "\uFE86",
  40007. "\u0624",
  40008. "\uFE87",
  40009. "\u0625",
  40010. "\uFE88",
  40011. "\u0625",
  40012. "\uFE89",
  40013. "\u0626",
  40014. "\uFE8A",
  40015. "\u0626",
  40016. "\uFE8B",
  40017. "\u0626",
  40018. "\uFE8C",
  40019. "\u0626",
  40020. "\uFE8D",
  40021. "\u0627",
  40022. "\uFE8E",
  40023. "\u0627",
  40024. "\uFE8F",
  40025. "\u0628",
  40026. "\uFE90",
  40027. "\u0628",
  40028. "\uFE91",
  40029. "\u0628",
  40030. "\uFE92",
  40031. "\u0628",
  40032. "\uFE93",
  40033. "\u0629",
  40034. "\uFE94",
  40035. "\u0629",
  40036. "\uFE95",
  40037. "\u062A",
  40038. "\uFE96",
  40039. "\u062A",
  40040. "\uFE97",
  40041. "\u062A",
  40042. "\uFE98",
  40043. "\u062A",
  40044. "\uFE99",
  40045. "\u062B",
  40046. "\uFE9A",
  40047. "\u062B",
  40048. "\uFE9B",
  40049. "\u062B",
  40050. "\uFE9C",
  40051. "\u062B",
  40052. "\uFE9D",
  40053. "\u062C",
  40054. "\uFE9E",
  40055. "\u062C",
  40056. "\uFE9F",
  40057. "\u062C",
  40058. "\uFEA0",
  40059. "\u062C",
  40060. "\uFEA1",
  40061. "\u062D",
  40062. "\uFEA2",
  40063. "\u062D",
  40064. "\uFEA3",
  40065. "\u062D",
  40066. "\uFEA4",
  40067. "\u062D",
  40068. "\uFEA5",
  40069. "\u062E",
  40070. "\uFEA6",
  40071. "\u062E",
  40072. "\uFEA7",
  40073. "\u062E",
  40074. "\uFEA8",
  40075. "\u062E",
  40076. "\uFEA9",
  40077. "\u062F",
  40078. "\uFEAA",
  40079. "\u062F",
  40080. "\uFEAB",
  40081. "\u0630",
  40082. "\uFEAC",
  40083. "\u0630",
  40084. "\uFEAD",
  40085. "\u0631",
  40086. "\uFEAE",
  40087. "\u0631",
  40088. "\uFEAF",
  40089. "\u0632",
  40090. "\uFEB0",
  40091. "\u0632",
  40092. "\uFEB1",
  40093. "\u0633",
  40094. "\uFEB2",
  40095. "\u0633",
  40096. "\uFEB3",
  40097. "\u0633",
  40098. "\uFEB4",
  40099. "\u0633",
  40100. "\uFEB5",
  40101. "\u0634",
  40102. "\uFEB6",
  40103. "\u0634",
  40104. "\uFEB7",
  40105. "\u0634",
  40106. "\uFEB8",
  40107. "\u0634",
  40108. "\uFEB9",
  40109. "\u0635",
  40110. "\uFEBA",
  40111. "\u0635",
  40112. "\uFEBB",
  40113. "\u0635",
  40114. "\uFEBC",
  40115. "\u0635",
  40116. "\uFEBD",
  40117. "\u0636",
  40118. "\uFEBE",
  40119. "\u0636",
  40120. "\uFEBF",
  40121. "\u0636",
  40122. "\uFEC0",
  40123. "\u0636",
  40124. "\uFEC1",
  40125. "\u0637",
  40126. "\uFEC2",
  40127. "\u0637",
  40128. "\uFEC3",
  40129. "\u0637",
  40130. "\uFEC4",
  40131. "\u0637",
  40132. "\uFEC5",
  40133. "\u0638",
  40134. "\uFEC6",
  40135. "\u0638",
  40136. "\uFEC7",
  40137. "\u0638",
  40138. "\uFEC8",
  40139. "\u0638",
  40140. "\uFEC9",
  40141. "\u0639",
  40142. "\uFECA",
  40143. "\u0639",
  40144. "\uFECB",
  40145. "\u0639",
  40146. "\uFECC",
  40147. "\u0639",
  40148. "\uFECD",
  40149. "\u063A",
  40150. "\uFECE",
  40151. "\u063A",
  40152. "\uFECF",
  40153. "\u063A",
  40154. "\uFED0",
  40155. "\u063A",
  40156. "\uFED1",
  40157. "\u0641",
  40158. "\uFED2",
  40159. "\u0641",
  40160. "\uFED3",
  40161. "\u0641",
  40162. "\uFED4",
  40163. "\u0641",
  40164. "\uFED5",
  40165. "\u0642",
  40166. "\uFED6",
  40167. "\u0642",
  40168. "\uFED7",
  40169. "\u0642",
  40170. "\uFED8",
  40171. "\u0642",
  40172. "\uFED9",
  40173. "\u0643",
  40174. "\uFEDA",
  40175. "\u0643",
  40176. "\uFEDB",
  40177. "\u0643",
  40178. "\uFEDC",
  40179. "\u0643",
  40180. "\uFEDD",
  40181. "\u0644",
  40182. "\uFEDE",
  40183. "\u0644",
  40184. "\uFEDF",
  40185. "\u0644",
  40186. "\uFEE0",
  40187. "\u0644",
  40188. "\uFEE1",
  40189. "\u0645",
  40190. "\uFEE2",
  40191. "\u0645",
  40192. "\uFEE3",
  40193. "\u0645",
  40194. "\uFEE4",
  40195. "\u0645",
  40196. "\uFEE5",
  40197. "\u0646",
  40198. "\uFEE6",
  40199. "\u0646",
  40200. "\uFEE7",
  40201. "\u0646",
  40202. "\uFEE8",
  40203. "\u0646",
  40204. "\uFEE9",
  40205. "\u0647",
  40206. "\uFEEA",
  40207. "\u0647",
  40208. "\uFEEB",
  40209. "\u0647",
  40210. "\uFEEC",
  40211. "\u0647",
  40212. "\uFEED",
  40213. "\u0648",
  40214. "\uFEEE",
  40215. "\u0648",
  40216. "\uFEEF",
  40217. "\u0649",
  40218. "\uFEF0",
  40219. "\u0649",
  40220. "\uFEF1",
  40221. "\u064A",
  40222. "\uFEF2",
  40223. "\u064A",
  40224. "\uFEF3",
  40225. "\u064A",
  40226. "\uFEF4",
  40227. "\u064A",
  40228. "\uFEF5",
  40229. "\u0644\u0622",
  40230. "\uFEF6",
  40231. "\u0644\u0622",
  40232. "\uFEF7",
  40233. "\u0644\u0623",
  40234. "\uFEF8",
  40235. "\u0644\u0623",
  40236. "\uFEF9",
  40237. "\u0644\u0625",
  40238. "\uFEFA",
  40239. "\u0644\u0625",
  40240. "\uFEFB",
  40241. "\u0644\u0627",
  40242. "\uFEFC",
  40243. "\u0644\u0627"
  40244. ];
  40245. });
  40246. function reverseIfRtl(chars) {
  40247. const charsLength = chars.length;
  40248. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  40249. return chars;
  40250. }
  40251. const buf = [];
  40252. for (let ii = charsLength - 1; ii >= 0; ii--) {
  40253. buf.push(chars[ii]);
  40254. }
  40255. return buf.join("");
  40256. }
  40257. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  40258. const CategoryCache = new Map();
  40259. function getCharUnicodeCategory(char) {
  40260. const cachedCategory = CategoryCache.get(char);
  40261. if (cachedCategory) {
  40262. return cachedCategory;
  40263. }
  40264. const groups = char.match(SpecialCharRegExp);
  40265. const category = {
  40266. isWhitespace: !!(groups && groups[1]),
  40267. isZeroWidthDiacritic: !!(groups && groups[2]),
  40268. isInvisibleFormatMark: !!(groups && groups[3])
  40269. };
  40270. CategoryCache.set(char, category);
  40271. return category;
  40272. }
  40273. function clearUnicodeCaches() {
  40274. CategoryCache.clear();
  40275. }
  40276. /***/ }),
  40277. /* 170 */
  40278. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40279. "use strict";
  40280. Object.defineProperty(exports, "__esModule", ({
  40281. value: true
  40282. }));
  40283. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  40284. exports.getStandardFontName = getStandardFontName;
  40285. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  40286. var _core_utils = __w_pdfjs_require__(135);
  40287. var _fonts_utils = __w_pdfjs_require__(167);
  40288. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  40289. t["Times-Roman"] = "Times-Roman";
  40290. t.Helvetica = "Helvetica";
  40291. t.Courier = "Courier";
  40292. t.Symbol = "Symbol";
  40293. t["Times-Bold"] = "Times-Bold";
  40294. t["Helvetica-Bold"] = "Helvetica-Bold";
  40295. t["Courier-Bold"] = "Courier-Bold";
  40296. t.ZapfDingbats = "ZapfDingbats";
  40297. t["Times-Italic"] = "Times-Italic";
  40298. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  40299. t["Courier-Oblique"] = "Courier-Oblique";
  40300. t["Times-BoldItalic"] = "Times-BoldItalic";
  40301. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  40302. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  40303. t.ArialNarrow = "Helvetica";
  40304. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  40305. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  40306. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  40307. t.ArialBlack = "Helvetica";
  40308. t["ArialBlack-Bold"] = "Helvetica-Bold";
  40309. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  40310. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  40311. t["Arial-Black"] = "Helvetica";
  40312. t["Arial-Black-Bold"] = "Helvetica-Bold";
  40313. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  40314. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  40315. t.Arial = "Helvetica";
  40316. t["Arial-Bold"] = "Helvetica-Bold";
  40317. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  40318. t["Arial-Italic"] = "Helvetica-Oblique";
  40319. t.ArialMT = "Helvetica";
  40320. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  40321. t["Arial-BoldMT"] = "Helvetica-Bold";
  40322. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  40323. t.ArialUnicodeMS = "Helvetica";
  40324. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  40325. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  40326. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  40327. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  40328. t["Courier-Italic"] = "Courier-Oblique";
  40329. t.CourierNew = "Courier";
  40330. t["CourierNew-Bold"] = "Courier-Bold";
  40331. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  40332. t["CourierNew-Italic"] = "Courier-Oblique";
  40333. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  40334. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  40335. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  40336. t.CourierNewPSMT = "Courier";
  40337. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  40338. t["Helvetica-Italic"] = "Helvetica-Oblique";
  40339. t["Symbol-Bold"] = "Symbol";
  40340. t["Symbol-BoldItalic"] = "Symbol";
  40341. t["Symbol-Italic"] = "Symbol";
  40342. t.TimesNewRoman = "Times-Roman";
  40343. t["TimesNewRoman-Bold"] = "Times-Bold";
  40344. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  40345. t["TimesNewRoman-Italic"] = "Times-Italic";
  40346. t.TimesNewRomanPS = "Times-Roman";
  40347. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  40348. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  40349. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  40350. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  40351. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  40352. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  40353. t.TimesNewRomanPSMT = "Times-Roman";
  40354. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  40355. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  40356. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  40357. });
  40358. exports.getStdFontMap = getStdFontMap;
  40359. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  40360. t.Courier = "FoxitFixed.pfb";
  40361. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  40362. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  40363. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  40364. t.Helvetica = "FoxitSans.pfb";
  40365. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  40366. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  40367. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  40368. t["Times-Roman"] = "FoxitSerif.pfb";
  40369. t["Times-Bold"] = "FoxitSerifBold.pfb";
  40370. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  40371. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  40372. t.Symbol = "FoxitSymbol.pfb";
  40373. t.ZapfDingbats = "FoxitDingbats.pfb";
  40374. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  40375. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  40376. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  40377. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  40378. });
  40379. exports.getFontNameToFileMap = getFontNameToFileMap;
  40380. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  40381. t.Calibri = "Helvetica";
  40382. t["Calibri-Bold"] = "Helvetica-Bold";
  40383. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  40384. t["Calibri-Italic"] = "Helvetica-Oblique";
  40385. t.CenturyGothic = "Helvetica";
  40386. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  40387. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  40388. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  40389. t.ComicSansMS = "Comic Sans MS";
  40390. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  40391. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  40392. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  40393. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  40394. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  40395. t["ItcSymbol-Book"] = "Helvetica";
  40396. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  40397. t["ItcSymbol-Medium"] = "Helvetica";
  40398. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  40399. t.LucidaConsole = "Courier";
  40400. t["LucidaConsole-Bold"] = "Courier-Bold";
  40401. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  40402. t["LucidaConsole-Italic"] = "Courier-Oblique";
  40403. t["LucidaSans-Demi"] = "Helvetica-Bold";
  40404. t["MS-Gothic"] = "MS Gothic";
  40405. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  40406. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  40407. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  40408. t["MS-Mincho"] = "MS Mincho";
  40409. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  40410. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  40411. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  40412. t["MS-PGothic"] = "MS PGothic";
  40413. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  40414. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  40415. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  40416. t["MS-PMincho"] = "MS PMincho";
  40417. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  40418. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  40419. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  40420. t.NuptialScript = "Times-Italic";
  40421. t.SegoeUISymbol = "Helvetica";
  40422. t.Wingdings = "ZapfDingbats";
  40423. t["Wingdings-Regular"] = "ZapfDingbats";
  40424. });
  40425. exports.getNonStdFontMap = getNonStdFontMap;
  40426. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40427. t["Adobe Jenson"] = true;
  40428. t["Adobe Text"] = true;
  40429. t.Albertus = true;
  40430. t.Aldus = true;
  40431. t.Alexandria = true;
  40432. t.Algerian = true;
  40433. t["American Typewriter"] = true;
  40434. t.Antiqua = true;
  40435. t.Apex = true;
  40436. t.Arno = true;
  40437. t.Aster = true;
  40438. t.Aurora = true;
  40439. t.Baskerville = true;
  40440. t.Bell = true;
  40441. t.Bembo = true;
  40442. t["Bembo Schoolbook"] = true;
  40443. t.Benguiat = true;
  40444. t["Berkeley Old Style"] = true;
  40445. t["Bernhard Modern"] = true;
  40446. t["Berthold City"] = true;
  40447. t.Bodoni = true;
  40448. t["Bauer Bodoni"] = true;
  40449. t["Book Antiqua"] = true;
  40450. t.Bookman = true;
  40451. t["Bordeaux Roman"] = true;
  40452. t["Californian FB"] = true;
  40453. t.Calisto = true;
  40454. t.Calvert = true;
  40455. t.Capitals = true;
  40456. t.Cambria = true;
  40457. t.Cartier = true;
  40458. t.Caslon = true;
  40459. t.Catull = true;
  40460. t.Centaur = true;
  40461. t["Century Old Style"] = true;
  40462. t["Century Schoolbook"] = true;
  40463. t.Chaparral = true;
  40464. t["Charis SIL"] = true;
  40465. t.Cheltenham = true;
  40466. t["Cholla Slab"] = true;
  40467. t.Clarendon = true;
  40468. t.Clearface = true;
  40469. t.Cochin = true;
  40470. t.Colonna = true;
  40471. t["Computer Modern"] = true;
  40472. t["Concrete Roman"] = true;
  40473. t.Constantia = true;
  40474. t["Cooper Black"] = true;
  40475. t.Corona = true;
  40476. t.Ecotype = true;
  40477. t.Egyptienne = true;
  40478. t.Elephant = true;
  40479. t.Excelsior = true;
  40480. t.Fairfield = true;
  40481. t["FF Scala"] = true;
  40482. t.Folkard = true;
  40483. t.Footlight = true;
  40484. t.FreeSerif = true;
  40485. t["Friz Quadrata"] = true;
  40486. t.Garamond = true;
  40487. t.Gentium = true;
  40488. t.Georgia = true;
  40489. t.Gloucester = true;
  40490. t["Goudy Old Style"] = true;
  40491. t["Goudy Schoolbook"] = true;
  40492. t["Goudy Pro Font"] = true;
  40493. t.Granjon = true;
  40494. t["Guardian Egyptian"] = true;
  40495. t.Heather = true;
  40496. t.Hercules = true;
  40497. t["High Tower Text"] = true;
  40498. t.Hiroshige = true;
  40499. t["Hoefler Text"] = true;
  40500. t["Humana Serif"] = true;
  40501. t.Imprint = true;
  40502. t["Ionic No. 5"] = true;
  40503. t.Janson = true;
  40504. t.Joanna = true;
  40505. t.Korinna = true;
  40506. t.Lexicon = true;
  40507. t.LiberationSerif = true;
  40508. t["Liberation Serif"] = true;
  40509. t["Linux Libertine"] = true;
  40510. t.Literaturnaya = true;
  40511. t.Lucida = true;
  40512. t["Lucida Bright"] = true;
  40513. t.Melior = true;
  40514. t.Memphis = true;
  40515. t.Miller = true;
  40516. t.Minion = true;
  40517. t.Modern = true;
  40518. t["Mona Lisa"] = true;
  40519. t["Mrs Eaves"] = true;
  40520. t["MS Serif"] = true;
  40521. t["Museo Slab"] = true;
  40522. t["New York"] = true;
  40523. t["Nimbus Roman"] = true;
  40524. t["NPS Rawlinson Roadway"] = true;
  40525. t.NuptialScript = true;
  40526. t.Palatino = true;
  40527. t.Perpetua = true;
  40528. t.Plantin = true;
  40529. t["Plantin Schoolbook"] = true;
  40530. t.Playbill = true;
  40531. t["Poor Richard"] = true;
  40532. t["Rawlinson Roadway"] = true;
  40533. t.Renault = true;
  40534. t.Requiem = true;
  40535. t.Rockwell = true;
  40536. t.Roman = true;
  40537. t["Rotis Serif"] = true;
  40538. t.Sabon = true;
  40539. t.Scala = true;
  40540. t.Seagull = true;
  40541. t.Sistina = true;
  40542. t.Souvenir = true;
  40543. t.STIX = true;
  40544. t["Stone Informal"] = true;
  40545. t["Stone Serif"] = true;
  40546. t.Sylfaen = true;
  40547. t.Times = true;
  40548. t.Trajan = true;
  40549. t["Trinité"] = true;
  40550. t["Trump Mediaeval"] = true;
  40551. t.Utopia = true;
  40552. t["Vale Type"] = true;
  40553. t["Bitstream Vera"] = true;
  40554. t["Vera Serif"] = true;
  40555. t.Versailles = true;
  40556. t.Wanted = true;
  40557. t.Weiss = true;
  40558. t["Wide Latin"] = true;
  40559. t.Windsor = true;
  40560. t.XITS = true;
  40561. });
  40562. exports.getSerifFonts = getSerifFonts;
  40563. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40564. t.Dingbats = true;
  40565. t.Symbol = true;
  40566. t.ZapfDingbats = true;
  40567. });
  40568. exports.getSymbolsFonts = getSymbolsFonts;
  40569. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40570. t[2] = 10;
  40571. t[3] = 32;
  40572. t[4] = 33;
  40573. t[5] = 34;
  40574. t[6] = 35;
  40575. t[7] = 36;
  40576. t[8] = 37;
  40577. t[9] = 38;
  40578. t[10] = 39;
  40579. t[11] = 40;
  40580. t[12] = 41;
  40581. t[13] = 42;
  40582. t[14] = 43;
  40583. t[15] = 44;
  40584. t[16] = 45;
  40585. t[17] = 46;
  40586. t[18] = 47;
  40587. t[19] = 48;
  40588. t[20] = 49;
  40589. t[21] = 50;
  40590. t[22] = 51;
  40591. t[23] = 52;
  40592. t[24] = 53;
  40593. t[25] = 54;
  40594. t[26] = 55;
  40595. t[27] = 56;
  40596. t[28] = 57;
  40597. t[29] = 58;
  40598. t[30] = 894;
  40599. t[31] = 60;
  40600. t[32] = 61;
  40601. t[33] = 62;
  40602. t[34] = 63;
  40603. t[35] = 64;
  40604. t[36] = 65;
  40605. t[37] = 66;
  40606. t[38] = 67;
  40607. t[39] = 68;
  40608. t[40] = 69;
  40609. t[41] = 70;
  40610. t[42] = 71;
  40611. t[43] = 72;
  40612. t[44] = 73;
  40613. t[45] = 74;
  40614. t[46] = 75;
  40615. t[47] = 76;
  40616. t[48] = 77;
  40617. t[49] = 78;
  40618. t[50] = 79;
  40619. t[51] = 80;
  40620. t[52] = 81;
  40621. t[53] = 82;
  40622. t[54] = 83;
  40623. t[55] = 84;
  40624. t[56] = 85;
  40625. t[57] = 86;
  40626. t[58] = 87;
  40627. t[59] = 88;
  40628. t[60] = 89;
  40629. t[61] = 90;
  40630. t[62] = 91;
  40631. t[63] = 92;
  40632. t[64] = 93;
  40633. t[65] = 94;
  40634. t[66] = 95;
  40635. t[67] = 96;
  40636. t[68] = 97;
  40637. t[69] = 98;
  40638. t[70] = 99;
  40639. t[71] = 100;
  40640. t[72] = 101;
  40641. t[73] = 102;
  40642. t[74] = 103;
  40643. t[75] = 104;
  40644. t[76] = 105;
  40645. t[77] = 106;
  40646. t[78] = 107;
  40647. t[79] = 108;
  40648. t[80] = 109;
  40649. t[81] = 110;
  40650. t[82] = 111;
  40651. t[83] = 112;
  40652. t[84] = 113;
  40653. t[85] = 114;
  40654. t[86] = 115;
  40655. t[87] = 116;
  40656. t[88] = 117;
  40657. t[89] = 118;
  40658. t[90] = 119;
  40659. t[91] = 120;
  40660. t[92] = 121;
  40661. t[93] = 122;
  40662. t[94] = 123;
  40663. t[95] = 124;
  40664. t[96] = 125;
  40665. t[97] = 126;
  40666. t[98] = 196;
  40667. t[99] = 197;
  40668. t[100] = 199;
  40669. t[101] = 201;
  40670. t[102] = 209;
  40671. t[103] = 214;
  40672. t[104] = 220;
  40673. t[105] = 225;
  40674. t[106] = 224;
  40675. t[107] = 226;
  40676. t[108] = 228;
  40677. t[109] = 227;
  40678. t[110] = 229;
  40679. t[111] = 231;
  40680. t[112] = 233;
  40681. t[113] = 232;
  40682. t[114] = 234;
  40683. t[115] = 235;
  40684. t[116] = 237;
  40685. t[117] = 236;
  40686. t[118] = 238;
  40687. t[119] = 239;
  40688. t[120] = 241;
  40689. t[121] = 243;
  40690. t[122] = 242;
  40691. t[123] = 244;
  40692. t[124] = 246;
  40693. t[125] = 245;
  40694. t[126] = 250;
  40695. t[127] = 249;
  40696. t[128] = 251;
  40697. t[129] = 252;
  40698. t[130] = 8224;
  40699. t[131] = 176;
  40700. t[132] = 162;
  40701. t[133] = 163;
  40702. t[134] = 167;
  40703. t[135] = 8226;
  40704. t[136] = 182;
  40705. t[137] = 223;
  40706. t[138] = 174;
  40707. t[139] = 169;
  40708. t[140] = 8482;
  40709. t[141] = 180;
  40710. t[142] = 168;
  40711. t[143] = 8800;
  40712. t[144] = 198;
  40713. t[145] = 216;
  40714. t[146] = 8734;
  40715. t[147] = 177;
  40716. t[148] = 8804;
  40717. t[149] = 8805;
  40718. t[150] = 165;
  40719. t[151] = 181;
  40720. t[152] = 8706;
  40721. t[153] = 8721;
  40722. t[154] = 8719;
  40723. t[156] = 8747;
  40724. t[157] = 170;
  40725. t[158] = 186;
  40726. t[159] = 8486;
  40727. t[160] = 230;
  40728. t[161] = 248;
  40729. t[162] = 191;
  40730. t[163] = 161;
  40731. t[164] = 172;
  40732. t[165] = 8730;
  40733. t[166] = 402;
  40734. t[167] = 8776;
  40735. t[168] = 8710;
  40736. t[169] = 171;
  40737. t[170] = 187;
  40738. t[171] = 8230;
  40739. t[179] = 8220;
  40740. t[180] = 8221;
  40741. t[181] = 8216;
  40742. t[182] = 8217;
  40743. t[200] = 193;
  40744. t[203] = 205;
  40745. t[210] = 218;
  40746. t[223] = 711;
  40747. t[224] = 321;
  40748. t[225] = 322;
  40749. t[226] = 352;
  40750. t[227] = 353;
  40751. t[228] = 381;
  40752. t[229] = 382;
  40753. t[233] = 221;
  40754. t[234] = 253;
  40755. t[252] = 263;
  40756. t[253] = 268;
  40757. t[254] = 269;
  40758. t[258] = 258;
  40759. t[260] = 260;
  40760. t[261] = 261;
  40761. t[265] = 280;
  40762. t[266] = 281;
  40763. t[267] = 282;
  40764. t[268] = 283;
  40765. t[269] = 313;
  40766. t[275] = 323;
  40767. t[276] = 324;
  40768. t[278] = 328;
  40769. t[283] = 344;
  40770. t[284] = 345;
  40771. t[285] = 346;
  40772. t[286] = 347;
  40773. t[292] = 367;
  40774. t[295] = 377;
  40775. t[296] = 378;
  40776. t[298] = 380;
  40777. t[305] = 963;
  40778. t[306] = 964;
  40779. t[307] = 966;
  40780. t[308] = 8215;
  40781. t[309] = 8252;
  40782. t[310] = 8319;
  40783. t[311] = 8359;
  40784. t[312] = 8592;
  40785. t[313] = 8593;
  40786. t[337] = 9552;
  40787. t[493] = 1039;
  40788. t[494] = 1040;
  40789. t[672] = 1488;
  40790. t[673] = 1489;
  40791. t[674] = 1490;
  40792. t[675] = 1491;
  40793. t[676] = 1492;
  40794. t[677] = 1493;
  40795. t[678] = 1494;
  40796. t[679] = 1495;
  40797. t[680] = 1496;
  40798. t[681] = 1497;
  40799. t[682] = 1498;
  40800. t[683] = 1499;
  40801. t[684] = 1500;
  40802. t[685] = 1501;
  40803. t[686] = 1502;
  40804. t[687] = 1503;
  40805. t[688] = 1504;
  40806. t[689] = 1505;
  40807. t[690] = 1506;
  40808. t[691] = 1507;
  40809. t[692] = 1508;
  40810. t[693] = 1509;
  40811. t[694] = 1510;
  40812. t[695] = 1511;
  40813. t[696] = 1512;
  40814. t[697] = 1513;
  40815. t[698] = 1514;
  40816. t[705] = 1524;
  40817. t[706] = 8362;
  40818. t[710] = 64288;
  40819. t[711] = 64298;
  40820. t[759] = 1617;
  40821. t[761] = 1776;
  40822. t[763] = 1778;
  40823. t[775] = 1652;
  40824. t[777] = 1764;
  40825. t[778] = 1780;
  40826. t[779] = 1781;
  40827. t[780] = 1782;
  40828. t[782] = 771;
  40829. t[783] = 64726;
  40830. t[786] = 8363;
  40831. t[788] = 8532;
  40832. t[790] = 768;
  40833. t[791] = 769;
  40834. t[792] = 768;
  40835. t[795] = 803;
  40836. t[797] = 64336;
  40837. t[798] = 64337;
  40838. t[799] = 64342;
  40839. t[800] = 64343;
  40840. t[801] = 64344;
  40841. t[802] = 64345;
  40842. t[803] = 64362;
  40843. t[804] = 64363;
  40844. t[805] = 64364;
  40845. t[2424] = 7821;
  40846. t[2425] = 7822;
  40847. t[2426] = 7823;
  40848. t[2427] = 7824;
  40849. t[2428] = 7825;
  40850. t[2429] = 7826;
  40851. t[2430] = 7827;
  40852. t[2433] = 7682;
  40853. t[2678] = 8045;
  40854. t[2679] = 8046;
  40855. t[2830] = 1552;
  40856. t[2838] = 686;
  40857. t[2840] = 751;
  40858. t[2842] = 753;
  40859. t[2843] = 754;
  40860. t[2844] = 755;
  40861. t[2846] = 757;
  40862. t[2856] = 767;
  40863. t[2857] = 848;
  40864. t[2858] = 849;
  40865. t[2862] = 853;
  40866. t[2863] = 854;
  40867. t[2864] = 855;
  40868. t[2865] = 861;
  40869. t[2866] = 862;
  40870. t[2906] = 7460;
  40871. t[2908] = 7462;
  40872. t[2909] = 7463;
  40873. t[2910] = 7464;
  40874. t[2912] = 7466;
  40875. t[2913] = 7467;
  40876. t[2914] = 7468;
  40877. t[2916] = 7470;
  40878. t[2917] = 7471;
  40879. t[2918] = 7472;
  40880. t[2920] = 7474;
  40881. t[2921] = 7475;
  40882. t[2922] = 7476;
  40883. t[2924] = 7478;
  40884. t[2925] = 7479;
  40885. t[2926] = 7480;
  40886. t[2928] = 7482;
  40887. t[2929] = 7483;
  40888. t[2930] = 7484;
  40889. t[2932] = 7486;
  40890. t[2933] = 7487;
  40891. t[2934] = 7488;
  40892. t[2936] = 7490;
  40893. t[2937] = 7491;
  40894. t[2938] = 7492;
  40895. t[2940] = 7494;
  40896. t[2941] = 7495;
  40897. t[2942] = 7496;
  40898. t[2944] = 7498;
  40899. t[2946] = 7500;
  40900. t[2948] = 7502;
  40901. t[2950] = 7504;
  40902. t[2951] = 7505;
  40903. t[2952] = 7506;
  40904. t[2954] = 7508;
  40905. t[2955] = 7509;
  40906. t[2956] = 7510;
  40907. t[2958] = 7512;
  40908. t[2959] = 7513;
  40909. t[2960] = 7514;
  40910. t[2962] = 7516;
  40911. t[2963] = 7517;
  40912. t[2964] = 7518;
  40913. t[2966] = 7520;
  40914. t[2967] = 7521;
  40915. t[2968] = 7522;
  40916. t[2970] = 7524;
  40917. t[2971] = 7525;
  40918. t[2972] = 7526;
  40919. t[2974] = 7528;
  40920. t[2975] = 7529;
  40921. t[2976] = 7530;
  40922. t[2978] = 1537;
  40923. t[2979] = 1538;
  40924. t[2980] = 1539;
  40925. t[2982] = 1549;
  40926. t[2983] = 1551;
  40927. t[2984] = 1552;
  40928. t[2986] = 1554;
  40929. t[2987] = 1555;
  40930. t[2988] = 1556;
  40931. t[2990] = 1623;
  40932. t[2991] = 1624;
  40933. t[2995] = 1775;
  40934. t[2999] = 1791;
  40935. t[3002] = 64290;
  40936. t[3003] = 64291;
  40937. t[3004] = 64292;
  40938. t[3006] = 64294;
  40939. t[3007] = 64295;
  40940. t[3008] = 64296;
  40941. t[3011] = 1900;
  40942. t[3014] = 8223;
  40943. t[3015] = 8244;
  40944. t[3017] = 7532;
  40945. t[3018] = 7533;
  40946. t[3019] = 7534;
  40947. t[3075] = 7590;
  40948. t[3076] = 7591;
  40949. t[3079] = 7594;
  40950. t[3080] = 7595;
  40951. t[3083] = 7598;
  40952. t[3084] = 7599;
  40953. t[3087] = 7602;
  40954. t[3088] = 7603;
  40955. t[3091] = 7606;
  40956. t[3092] = 7607;
  40957. t[3095] = 7610;
  40958. t[3096] = 7611;
  40959. t[3099] = 7614;
  40960. t[3100] = 7615;
  40961. t[3103] = 7618;
  40962. t[3104] = 7619;
  40963. t[3107] = 8337;
  40964. t[3108] = 8338;
  40965. t[3116] = 1884;
  40966. t[3119] = 1885;
  40967. t[3120] = 1885;
  40968. t[3123] = 1886;
  40969. t[3124] = 1886;
  40970. t[3127] = 1887;
  40971. t[3128] = 1887;
  40972. t[3131] = 1888;
  40973. t[3132] = 1888;
  40974. t[3135] = 1889;
  40975. t[3136] = 1889;
  40976. t[3139] = 1890;
  40977. t[3140] = 1890;
  40978. t[3143] = 1891;
  40979. t[3144] = 1891;
  40980. t[3147] = 1892;
  40981. t[3148] = 1892;
  40982. t[3153] = 580;
  40983. t[3154] = 581;
  40984. t[3157] = 584;
  40985. t[3158] = 585;
  40986. t[3161] = 588;
  40987. t[3162] = 589;
  40988. t[3165] = 891;
  40989. t[3166] = 892;
  40990. t[3169] = 1274;
  40991. t[3170] = 1275;
  40992. t[3173] = 1278;
  40993. t[3174] = 1279;
  40994. t[3181] = 7622;
  40995. t[3182] = 7623;
  40996. t[3282] = 11799;
  40997. t[3316] = 578;
  40998. t[3379] = 42785;
  40999. t[3393] = 1159;
  41000. t[3416] = 8377;
  41001. });
  41002. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  41003. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  41004. t[227] = 322;
  41005. t[264] = 261;
  41006. t[291] = 346;
  41007. });
  41008. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  41009. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  41010. t[1] = 32;
  41011. t[4] = 65;
  41012. t[5] = 192;
  41013. t[6] = 193;
  41014. t[9] = 196;
  41015. t[17] = 66;
  41016. t[18] = 67;
  41017. t[21] = 268;
  41018. t[24] = 68;
  41019. t[28] = 69;
  41020. t[29] = 200;
  41021. t[30] = 201;
  41022. t[32] = 282;
  41023. t[38] = 70;
  41024. t[39] = 71;
  41025. t[44] = 72;
  41026. t[47] = 73;
  41027. t[48] = 204;
  41028. t[49] = 205;
  41029. t[58] = 74;
  41030. t[60] = 75;
  41031. t[62] = 76;
  41032. t[68] = 77;
  41033. t[69] = 78;
  41034. t[75] = 79;
  41035. t[76] = 210;
  41036. t[80] = 214;
  41037. t[87] = 80;
  41038. t[89] = 81;
  41039. t[90] = 82;
  41040. t[92] = 344;
  41041. t[94] = 83;
  41042. t[97] = 352;
  41043. t[100] = 84;
  41044. t[104] = 85;
  41045. t[109] = 220;
  41046. t[115] = 86;
  41047. t[116] = 87;
  41048. t[121] = 88;
  41049. t[122] = 89;
  41050. t[124] = 221;
  41051. t[127] = 90;
  41052. t[129] = 381;
  41053. t[258] = 97;
  41054. t[259] = 224;
  41055. t[260] = 225;
  41056. t[263] = 228;
  41057. t[268] = 261;
  41058. t[271] = 98;
  41059. t[272] = 99;
  41060. t[273] = 263;
  41061. t[275] = 269;
  41062. t[282] = 100;
  41063. t[286] = 101;
  41064. t[287] = 232;
  41065. t[288] = 233;
  41066. t[290] = 283;
  41067. t[295] = 281;
  41068. t[296] = 102;
  41069. t[336] = 103;
  41070. t[346] = 104;
  41071. t[349] = 105;
  41072. t[350] = 236;
  41073. t[351] = 237;
  41074. t[361] = 106;
  41075. t[364] = 107;
  41076. t[367] = 108;
  41077. t[371] = 322;
  41078. t[373] = 109;
  41079. t[374] = 110;
  41080. t[381] = 111;
  41081. t[382] = 242;
  41082. t[383] = 243;
  41083. t[386] = 246;
  41084. t[393] = 112;
  41085. t[395] = 113;
  41086. t[396] = 114;
  41087. t[398] = 345;
  41088. t[400] = 115;
  41089. t[401] = 347;
  41090. t[403] = 353;
  41091. t[410] = 116;
  41092. t[437] = 117;
  41093. t[442] = 252;
  41094. t[448] = 118;
  41095. t[449] = 119;
  41096. t[454] = 120;
  41097. t[455] = 121;
  41098. t[457] = 253;
  41099. t[460] = 122;
  41100. t[462] = 382;
  41101. t[463] = 380;
  41102. t[853] = 44;
  41103. t[855] = 58;
  41104. t[856] = 46;
  41105. t[876] = 47;
  41106. t[878] = 45;
  41107. t[882] = 45;
  41108. t[894] = 40;
  41109. t[895] = 41;
  41110. t[896] = 91;
  41111. t[897] = 93;
  41112. t[923] = 64;
  41113. t[1004] = 48;
  41114. t[1005] = 49;
  41115. t[1006] = 50;
  41116. t[1007] = 51;
  41117. t[1008] = 52;
  41118. t[1009] = 53;
  41119. t[1010] = 54;
  41120. t[1011] = 55;
  41121. t[1012] = 56;
  41122. t[1013] = 57;
  41123. t[1081] = 37;
  41124. t[1085] = 43;
  41125. t[1086] = 45;
  41126. });
  41127. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  41128. function getStandardFontName(name) {
  41129. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  41130. const stdFontMap = getStdFontMap();
  41131. return stdFontMap[fontName];
  41132. }
  41133. /***/ }),
  41134. /* 171 */
  41135. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41136. "use strict";
  41137. Object.defineProperty(exports, "__esModule", ({
  41138. value: true
  41139. }));
  41140. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  41141. var _util = __w_pdfjs_require__(2);
  41142. class ToUnicodeMap {
  41143. constructor() {
  41144. let cmap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  41145. this._map = cmap;
  41146. }
  41147. get length() {
  41148. return this._map.length;
  41149. }
  41150. forEach(callback) {
  41151. for (const charCode in this._map) {
  41152. callback(charCode, this._map[charCode].charCodeAt(0));
  41153. }
  41154. }
  41155. has(i) {
  41156. return this._map[i] !== undefined;
  41157. }
  41158. get(i) {
  41159. return this._map[i];
  41160. }
  41161. charCodeOf(value) {
  41162. const map = this._map;
  41163. if (map.length <= 0x10000) {
  41164. return map.indexOf(value);
  41165. }
  41166. for (const charCode in map) {
  41167. if (map[charCode] === value) {
  41168. return charCode | 0;
  41169. }
  41170. }
  41171. return -1;
  41172. }
  41173. amend(map) {
  41174. for (const charCode in map) {
  41175. this._map[charCode] = map[charCode];
  41176. }
  41177. }
  41178. }
  41179. exports.ToUnicodeMap = ToUnicodeMap;
  41180. class IdentityToUnicodeMap {
  41181. constructor(firstChar, lastChar) {
  41182. this.firstChar = firstChar;
  41183. this.lastChar = lastChar;
  41184. }
  41185. get length() {
  41186. return this.lastChar + 1 - this.firstChar;
  41187. }
  41188. forEach(callback) {
  41189. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  41190. callback(i, i);
  41191. }
  41192. }
  41193. has(i) {
  41194. return this.firstChar <= i && i <= this.lastChar;
  41195. }
  41196. get(i) {
  41197. if (this.firstChar <= i && i <= this.lastChar) {
  41198. return String.fromCharCode(i);
  41199. }
  41200. return undefined;
  41201. }
  41202. charCodeOf(v) {
  41203. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  41204. }
  41205. amend(map) {
  41206. (0, _util.unreachable)("Should not call amend()");
  41207. }
  41208. }
  41209. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  41210. /***/ }),
  41211. /* 172 */
  41212. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41213. "use strict";
  41214. Object.defineProperty(exports, "__esModule", ({
  41215. value: true
  41216. }));
  41217. exports.CFFFont = void 0;
  41218. var _cff_parser = __w_pdfjs_require__(164);
  41219. var _fonts_utils = __w_pdfjs_require__(167);
  41220. var _util = __w_pdfjs_require__(2);
  41221. class CFFFont {
  41222. constructor(file, properties) {
  41223. this.properties = properties;
  41224. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  41225. this.cff = parser.parse();
  41226. this.cff.duplicateFirstGlyph();
  41227. const compiler = new _cff_parser.CFFCompiler(this.cff);
  41228. this.seacs = this.cff.seacs;
  41229. try {
  41230. this.data = compiler.compile();
  41231. } catch (e) {
  41232. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  41233. this.data = file;
  41234. }
  41235. this._createBuiltInEncoding();
  41236. }
  41237. get numGlyphs() {
  41238. return this.cff.charStrings.count;
  41239. }
  41240. getCharset() {
  41241. return this.cff.charset.charset;
  41242. }
  41243. getGlyphMapping() {
  41244. const cff = this.cff;
  41245. const properties = this.properties;
  41246. const {
  41247. cidToGidMap,
  41248. cMap
  41249. } = properties;
  41250. const charsets = cff.charset.charset;
  41251. let charCodeToGlyphId;
  41252. let glyphId;
  41253. if (properties.composite) {
  41254. let invCidToGidMap;
  41255. if (cidToGidMap && cidToGidMap.length > 0) {
  41256. invCidToGidMap = Object.create(null);
  41257. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  41258. const gid = cidToGidMap[i];
  41259. if (gid !== undefined) {
  41260. invCidToGidMap[gid] = i;
  41261. }
  41262. }
  41263. }
  41264. charCodeToGlyphId = Object.create(null);
  41265. let charCode;
  41266. if (cff.isCIDFont) {
  41267. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  41268. const cid = charsets[glyphId];
  41269. charCode = cMap.charCodeOf(cid);
  41270. if (invCidToGidMap && invCidToGidMap[charCode] !== undefined) {
  41271. charCode = invCidToGidMap[charCode];
  41272. }
  41273. charCodeToGlyphId[charCode] = glyphId;
  41274. }
  41275. } else {
  41276. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  41277. charCode = cMap.charCodeOf(glyphId);
  41278. charCodeToGlyphId[charCode] = glyphId;
  41279. }
  41280. }
  41281. return charCodeToGlyphId;
  41282. }
  41283. let encoding = cff.encoding ? cff.encoding.encoding : null;
  41284. if (properties.isInternalFont) {
  41285. encoding = properties.defaultEncoding;
  41286. }
  41287. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  41288. return charCodeToGlyphId;
  41289. }
  41290. hasGlyphId(id) {
  41291. return this.cff.hasGlyphId(id);
  41292. }
  41293. _createBuiltInEncoding() {
  41294. const {
  41295. charset,
  41296. encoding
  41297. } = this.cff;
  41298. if (!charset || !encoding) {
  41299. return;
  41300. }
  41301. const charsets = charset.charset,
  41302. encodings = encoding.encoding;
  41303. const map = [];
  41304. for (const charCode in encodings) {
  41305. const glyphId = encodings[charCode];
  41306. if (glyphId >= 0) {
  41307. const glyphName = charsets[glyphId];
  41308. if (glyphName) {
  41309. map[charCode] = glyphName;
  41310. }
  41311. }
  41312. }
  41313. if (map.length > 0) {
  41314. this.properties.builtInEncoding = map;
  41315. }
  41316. }
  41317. }
  41318. exports.CFFFont = CFFFont;
  41319. /***/ }),
  41320. /* 173 */
  41321. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41322. "use strict";
  41323. Object.defineProperty(exports, "__esModule", ({
  41324. value: true
  41325. }));
  41326. exports.FontRendererFactory = void 0;
  41327. var _util = __w_pdfjs_require__(2);
  41328. var _cff_parser = __w_pdfjs_require__(164);
  41329. var _glyphlist = __w_pdfjs_require__(168);
  41330. var _encodings = __w_pdfjs_require__(166);
  41331. var _stream = __w_pdfjs_require__(139);
  41332. function getUint32(data, offset) {
  41333. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  41334. }
  41335. function getUint16(data, offset) {
  41336. return data[offset] << 8 | data[offset + 1];
  41337. }
  41338. function getInt16(data, offset) {
  41339. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  41340. }
  41341. function getInt8(data, offset) {
  41342. return data[offset] << 24 >> 24;
  41343. }
  41344. function getFloat214(data, offset) {
  41345. return getInt16(data, offset) / 16384;
  41346. }
  41347. function getSubroutineBias(subrs) {
  41348. const numSubrs = subrs.length;
  41349. let bias = 32768;
  41350. if (numSubrs < 1240) {
  41351. bias = 107;
  41352. } else if (numSubrs < 33900) {
  41353. bias = 1131;
  41354. }
  41355. return bias;
  41356. }
  41357. function parseCmap(data, start, end) {
  41358. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  41359. const format = getUint16(data, start + offset);
  41360. let ranges, p, i;
  41361. if (format === 4) {
  41362. getUint16(data, start + offset + 2);
  41363. const segCount = getUint16(data, start + offset + 6) >> 1;
  41364. p = start + offset + 14;
  41365. ranges = [];
  41366. for (i = 0; i < segCount; i++, p += 2) {
  41367. ranges[i] = {
  41368. end: getUint16(data, p)
  41369. };
  41370. }
  41371. p += 2;
  41372. for (i = 0; i < segCount; i++, p += 2) {
  41373. ranges[i].start = getUint16(data, p);
  41374. }
  41375. for (i = 0; i < segCount; i++, p += 2) {
  41376. ranges[i].idDelta = getUint16(data, p);
  41377. }
  41378. for (i = 0; i < segCount; i++, p += 2) {
  41379. let idOffset = getUint16(data, p);
  41380. if (idOffset === 0) {
  41381. continue;
  41382. }
  41383. ranges[i].ids = [];
  41384. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  41385. ranges[i].ids[j] = getUint16(data, p + idOffset);
  41386. idOffset += 2;
  41387. }
  41388. }
  41389. return ranges;
  41390. } else if (format === 12) {
  41391. const groups = getUint32(data, start + offset + 12);
  41392. p = start + offset + 16;
  41393. ranges = [];
  41394. for (i = 0; i < groups; i++) {
  41395. start = getUint32(data, p);
  41396. ranges.push({
  41397. start,
  41398. end: getUint32(data, p + 4),
  41399. idDelta: getUint32(data, p + 8) - start
  41400. });
  41401. p += 12;
  41402. }
  41403. return ranges;
  41404. }
  41405. throw new _util.FormatError(`unsupported cmap: ${format}`);
  41406. }
  41407. function parseCff(data, start, end, seacAnalysisEnabled) {
  41408. const properties = {};
  41409. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  41410. const cff = parser.parse();
  41411. return {
  41412. glyphs: cff.charStrings.objects,
  41413. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  41414. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  41415. isCFFCIDFont: cff.isCIDFont,
  41416. fdSelect: cff.fdSelect,
  41417. fdArray: cff.fdArray
  41418. };
  41419. }
  41420. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  41421. let itemSize, itemDecode;
  41422. if (isGlyphLocationsLong) {
  41423. itemSize = 4;
  41424. itemDecode = getUint32;
  41425. } else {
  41426. itemSize = 2;
  41427. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  41428. }
  41429. const glyphs = [];
  41430. let startOffset = itemDecode(loca, 0);
  41431. for (let j = itemSize; j < loca.length; j += itemSize) {
  41432. const endOffset = itemDecode(loca, j);
  41433. glyphs.push(glyf.subarray(startOffset, endOffset));
  41434. startOffset = endOffset;
  41435. }
  41436. return glyphs;
  41437. }
  41438. function lookupCmap(ranges, unicode) {
  41439. const code = unicode.codePointAt(0);
  41440. let gid = 0,
  41441. l = 0,
  41442. r = ranges.length - 1;
  41443. while (l < r) {
  41444. const c = l + r + 1 >> 1;
  41445. if (code < ranges[c].start) {
  41446. r = c - 1;
  41447. } else {
  41448. l = c;
  41449. }
  41450. }
  41451. if (ranges[l].start <= code && code <= ranges[l].end) {
  41452. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  41453. }
  41454. return {
  41455. charCode: code,
  41456. glyphId: gid
  41457. };
  41458. }
  41459. function compileGlyf(code, cmds, font) {
  41460. function moveTo(x, y) {
  41461. cmds.push({
  41462. cmd: "moveTo",
  41463. args: [x, y]
  41464. });
  41465. }
  41466. function lineTo(x, y) {
  41467. cmds.push({
  41468. cmd: "lineTo",
  41469. args: [x, y]
  41470. });
  41471. }
  41472. function quadraticCurveTo(xa, ya, x, y) {
  41473. cmds.push({
  41474. cmd: "quadraticCurveTo",
  41475. args: [xa, ya, x, y]
  41476. });
  41477. }
  41478. let i = 0;
  41479. const numberOfContours = getInt16(code, i);
  41480. let flags;
  41481. let x = 0,
  41482. y = 0;
  41483. i += 10;
  41484. if (numberOfContours < 0) {
  41485. do {
  41486. flags = getUint16(code, i);
  41487. const glyphIndex = getUint16(code, i + 2);
  41488. i += 4;
  41489. let arg1, arg2;
  41490. if (flags & 0x01) {
  41491. if (flags & 0x02) {
  41492. arg1 = getInt16(code, i);
  41493. arg2 = getInt16(code, i + 2);
  41494. } else {
  41495. arg1 = getUint16(code, i);
  41496. arg2 = getUint16(code, i + 2);
  41497. }
  41498. i += 4;
  41499. } else {
  41500. if (flags & 0x02) {
  41501. arg1 = getInt8(code, i++);
  41502. arg2 = getInt8(code, i++);
  41503. } else {
  41504. arg1 = code[i++];
  41505. arg2 = code[i++];
  41506. }
  41507. }
  41508. if (flags & 0x02) {
  41509. x = arg1;
  41510. y = arg2;
  41511. } else {
  41512. x = 0;
  41513. y = 0;
  41514. }
  41515. let scaleX = 1,
  41516. scaleY = 1,
  41517. scale01 = 0,
  41518. scale10 = 0;
  41519. if (flags & 0x08) {
  41520. scaleX = scaleY = getFloat214(code, i);
  41521. i += 2;
  41522. } else if (flags & 0x40) {
  41523. scaleX = getFloat214(code, i);
  41524. scaleY = getFloat214(code, i + 2);
  41525. i += 4;
  41526. } else if (flags & 0x80) {
  41527. scaleX = getFloat214(code, i);
  41528. scale01 = getFloat214(code, i + 2);
  41529. scale10 = getFloat214(code, i + 4);
  41530. scaleY = getFloat214(code, i + 6);
  41531. i += 8;
  41532. }
  41533. const subglyph = font.glyphs[glyphIndex];
  41534. if (subglyph) {
  41535. cmds.push({
  41536. cmd: "save"
  41537. }, {
  41538. cmd: "transform",
  41539. args: [scaleX, scale01, scale10, scaleY, x, y]
  41540. });
  41541. if (!(flags & 0x02)) {}
  41542. compileGlyf(subglyph, cmds, font);
  41543. cmds.push({
  41544. cmd: "restore"
  41545. });
  41546. }
  41547. } while (flags & 0x20);
  41548. } else {
  41549. const endPtsOfContours = [];
  41550. let j, jj;
  41551. for (j = 0; j < numberOfContours; j++) {
  41552. endPtsOfContours.push(getUint16(code, i));
  41553. i += 2;
  41554. }
  41555. const instructionLength = getUint16(code, i);
  41556. i += 2 + instructionLength;
  41557. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  41558. const points = [];
  41559. while (points.length < numberOfPoints) {
  41560. flags = code[i++];
  41561. let repeat = 1;
  41562. if (flags & 0x08) {
  41563. repeat += code[i++];
  41564. }
  41565. while (repeat-- > 0) {
  41566. points.push({
  41567. flags
  41568. });
  41569. }
  41570. }
  41571. for (j = 0; j < numberOfPoints; j++) {
  41572. switch (points[j].flags & 0x12) {
  41573. case 0x00:
  41574. x += getInt16(code, i);
  41575. i += 2;
  41576. break;
  41577. case 0x02:
  41578. x -= code[i++];
  41579. break;
  41580. case 0x12:
  41581. x += code[i++];
  41582. break;
  41583. }
  41584. points[j].x = x;
  41585. }
  41586. for (j = 0; j < numberOfPoints; j++) {
  41587. switch (points[j].flags & 0x24) {
  41588. case 0x00:
  41589. y += getInt16(code, i);
  41590. i += 2;
  41591. break;
  41592. case 0x04:
  41593. y -= code[i++];
  41594. break;
  41595. case 0x24:
  41596. y += code[i++];
  41597. break;
  41598. }
  41599. points[j].y = y;
  41600. }
  41601. let startPoint = 0;
  41602. for (i = 0; i < numberOfContours; i++) {
  41603. const endPoint = endPtsOfContours[i];
  41604. const contour = points.slice(startPoint, endPoint + 1);
  41605. if (contour[0].flags & 1) {
  41606. contour.push(contour[0]);
  41607. } else if (contour.at(-1).flags & 1) {
  41608. contour.unshift(contour.at(-1));
  41609. } else {
  41610. const p = {
  41611. flags: 1,
  41612. x: (contour[0].x + contour.at(-1).x) / 2,
  41613. y: (contour[0].y + contour.at(-1).y) / 2
  41614. };
  41615. contour.unshift(p);
  41616. contour.push(p);
  41617. }
  41618. moveTo(contour[0].x, contour[0].y);
  41619. for (j = 1, jj = contour.length; j < jj; j++) {
  41620. if (contour[j].flags & 1) {
  41621. lineTo(contour[j].x, contour[j].y);
  41622. } else if (contour[j + 1].flags & 1) {
  41623. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  41624. j++;
  41625. } else {
  41626. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  41627. }
  41628. }
  41629. startPoint = endPoint + 1;
  41630. }
  41631. }
  41632. }
  41633. function compileCharString(charStringCode, cmds, font, glyphId) {
  41634. function moveTo(x, y) {
  41635. cmds.push({
  41636. cmd: "moveTo",
  41637. args: [x, y]
  41638. });
  41639. }
  41640. function lineTo(x, y) {
  41641. cmds.push({
  41642. cmd: "lineTo",
  41643. args: [x, y]
  41644. });
  41645. }
  41646. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  41647. cmds.push({
  41648. cmd: "bezierCurveTo",
  41649. args: [x1, y1, x2, y2, x, y]
  41650. });
  41651. }
  41652. const stack = [];
  41653. let x = 0,
  41654. y = 0;
  41655. let stems = 0;
  41656. function parse(code) {
  41657. let i = 0;
  41658. while (i < code.length) {
  41659. let stackClean = false;
  41660. let v = code[i++];
  41661. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  41662. switch (v) {
  41663. case 1:
  41664. stems += stack.length >> 1;
  41665. stackClean = true;
  41666. break;
  41667. case 3:
  41668. stems += stack.length >> 1;
  41669. stackClean = true;
  41670. break;
  41671. case 4:
  41672. y += stack.pop();
  41673. moveTo(x, y);
  41674. stackClean = true;
  41675. break;
  41676. case 5:
  41677. while (stack.length > 0) {
  41678. x += stack.shift();
  41679. y += stack.shift();
  41680. lineTo(x, y);
  41681. }
  41682. break;
  41683. case 6:
  41684. while (stack.length > 0) {
  41685. x += stack.shift();
  41686. lineTo(x, y);
  41687. if (stack.length === 0) {
  41688. break;
  41689. }
  41690. y += stack.shift();
  41691. lineTo(x, y);
  41692. }
  41693. break;
  41694. case 7:
  41695. while (stack.length > 0) {
  41696. y += stack.shift();
  41697. lineTo(x, y);
  41698. if (stack.length === 0) {
  41699. break;
  41700. }
  41701. x += stack.shift();
  41702. lineTo(x, y);
  41703. }
  41704. break;
  41705. case 8:
  41706. while (stack.length > 0) {
  41707. xa = x + stack.shift();
  41708. ya = y + stack.shift();
  41709. xb = xa + stack.shift();
  41710. yb = ya + stack.shift();
  41711. x = xb + stack.shift();
  41712. y = yb + stack.shift();
  41713. bezierCurveTo(xa, ya, xb, yb, x, y);
  41714. }
  41715. break;
  41716. case 10:
  41717. n = stack.pop();
  41718. subrCode = null;
  41719. if (font.isCFFCIDFont) {
  41720. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  41721. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  41722. const fontDict = font.fdArray[fdIndex];
  41723. let subrs;
  41724. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  41725. subrs = fontDict.privateDict.subrsIndex.objects;
  41726. }
  41727. if (subrs) {
  41728. n += getSubroutineBias(subrs);
  41729. subrCode = subrs[n];
  41730. }
  41731. } else {
  41732. (0, _util.warn)("Invalid fd index for glyph index.");
  41733. }
  41734. } else {
  41735. subrCode = font.subrs[n + font.subrsBias];
  41736. }
  41737. if (subrCode) {
  41738. parse(subrCode);
  41739. }
  41740. break;
  41741. case 11:
  41742. return;
  41743. case 12:
  41744. v = code[i++];
  41745. switch (v) {
  41746. case 34:
  41747. xa = x + stack.shift();
  41748. xb = xa + stack.shift();
  41749. y1 = y + stack.shift();
  41750. x = xb + stack.shift();
  41751. bezierCurveTo(xa, y, xb, y1, x, y1);
  41752. xa = x + stack.shift();
  41753. xb = xa + stack.shift();
  41754. x = xb + stack.shift();
  41755. bezierCurveTo(xa, y1, xb, y, x, y);
  41756. break;
  41757. case 35:
  41758. xa = x + stack.shift();
  41759. ya = y + stack.shift();
  41760. xb = xa + stack.shift();
  41761. yb = ya + stack.shift();
  41762. x = xb + stack.shift();
  41763. y = yb + stack.shift();
  41764. bezierCurveTo(xa, ya, xb, yb, x, y);
  41765. xa = x + stack.shift();
  41766. ya = y + stack.shift();
  41767. xb = xa + stack.shift();
  41768. yb = ya + stack.shift();
  41769. x = xb + stack.shift();
  41770. y = yb + stack.shift();
  41771. bezierCurveTo(xa, ya, xb, yb, x, y);
  41772. stack.pop();
  41773. break;
  41774. case 36:
  41775. xa = x + stack.shift();
  41776. y1 = y + stack.shift();
  41777. xb = xa + stack.shift();
  41778. y2 = y1 + stack.shift();
  41779. x = xb + stack.shift();
  41780. bezierCurveTo(xa, y1, xb, y2, x, y2);
  41781. xa = x + stack.shift();
  41782. xb = xa + stack.shift();
  41783. y3 = y2 + stack.shift();
  41784. x = xb + stack.shift();
  41785. bezierCurveTo(xa, y2, xb, y3, x, y);
  41786. break;
  41787. case 37:
  41788. const x0 = x,
  41789. y0 = y;
  41790. xa = x + stack.shift();
  41791. ya = y + stack.shift();
  41792. xb = xa + stack.shift();
  41793. yb = ya + stack.shift();
  41794. x = xb + stack.shift();
  41795. y = yb + stack.shift();
  41796. bezierCurveTo(xa, ya, xb, yb, x, y);
  41797. xa = x + stack.shift();
  41798. ya = y + stack.shift();
  41799. xb = xa + stack.shift();
  41800. yb = ya + stack.shift();
  41801. x = xb;
  41802. y = yb;
  41803. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  41804. x += stack.shift();
  41805. } else {
  41806. y += stack.shift();
  41807. }
  41808. bezierCurveTo(xa, ya, xb, yb, x, y);
  41809. break;
  41810. default:
  41811. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  41812. }
  41813. break;
  41814. case 14:
  41815. if (stack.length >= 4) {
  41816. const achar = stack.pop();
  41817. const bchar = stack.pop();
  41818. y = stack.pop();
  41819. x = stack.pop();
  41820. cmds.push({
  41821. cmd: "save"
  41822. }, {
  41823. cmd: "translate",
  41824. args: [x, y]
  41825. });
  41826. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  41827. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41828. cmds.push({
  41829. cmd: "restore"
  41830. });
  41831. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  41832. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41833. }
  41834. return;
  41835. case 18:
  41836. stems += stack.length >> 1;
  41837. stackClean = true;
  41838. break;
  41839. case 19:
  41840. stems += stack.length >> 1;
  41841. i += stems + 7 >> 3;
  41842. stackClean = true;
  41843. break;
  41844. case 20:
  41845. stems += stack.length >> 1;
  41846. i += stems + 7 >> 3;
  41847. stackClean = true;
  41848. break;
  41849. case 21:
  41850. y += stack.pop();
  41851. x += stack.pop();
  41852. moveTo(x, y);
  41853. stackClean = true;
  41854. break;
  41855. case 22:
  41856. x += stack.pop();
  41857. moveTo(x, y);
  41858. stackClean = true;
  41859. break;
  41860. case 23:
  41861. stems += stack.length >> 1;
  41862. stackClean = true;
  41863. break;
  41864. case 24:
  41865. while (stack.length > 2) {
  41866. xa = x + stack.shift();
  41867. ya = y + stack.shift();
  41868. xb = xa + stack.shift();
  41869. yb = ya + stack.shift();
  41870. x = xb + stack.shift();
  41871. y = yb + stack.shift();
  41872. bezierCurveTo(xa, ya, xb, yb, x, y);
  41873. }
  41874. x += stack.shift();
  41875. y += stack.shift();
  41876. lineTo(x, y);
  41877. break;
  41878. case 25:
  41879. while (stack.length > 6) {
  41880. x += stack.shift();
  41881. y += stack.shift();
  41882. lineTo(x, y);
  41883. }
  41884. xa = x + stack.shift();
  41885. ya = y + stack.shift();
  41886. xb = xa + stack.shift();
  41887. yb = ya + stack.shift();
  41888. x = xb + stack.shift();
  41889. y = yb + stack.shift();
  41890. bezierCurveTo(xa, ya, xb, yb, x, y);
  41891. break;
  41892. case 26:
  41893. if (stack.length % 2) {
  41894. x += stack.shift();
  41895. }
  41896. while (stack.length > 0) {
  41897. xa = x;
  41898. ya = y + stack.shift();
  41899. xb = xa + stack.shift();
  41900. yb = ya + stack.shift();
  41901. x = xb;
  41902. y = yb + stack.shift();
  41903. bezierCurveTo(xa, ya, xb, yb, x, y);
  41904. }
  41905. break;
  41906. case 27:
  41907. if (stack.length % 2) {
  41908. y += stack.shift();
  41909. }
  41910. while (stack.length > 0) {
  41911. xa = x + stack.shift();
  41912. ya = y;
  41913. xb = xa + stack.shift();
  41914. yb = ya + stack.shift();
  41915. x = xb + stack.shift();
  41916. y = yb;
  41917. bezierCurveTo(xa, ya, xb, yb, x, y);
  41918. }
  41919. break;
  41920. case 28:
  41921. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  41922. i += 2;
  41923. break;
  41924. case 29:
  41925. n = stack.pop() + font.gsubrsBias;
  41926. subrCode = font.gsubrs[n];
  41927. if (subrCode) {
  41928. parse(subrCode);
  41929. }
  41930. break;
  41931. case 30:
  41932. while (stack.length > 0) {
  41933. xa = x;
  41934. ya = y + stack.shift();
  41935. xb = xa + stack.shift();
  41936. yb = ya + stack.shift();
  41937. x = xb + stack.shift();
  41938. y = yb + (stack.length === 1 ? stack.shift() : 0);
  41939. bezierCurveTo(xa, ya, xb, yb, x, y);
  41940. if (stack.length === 0) {
  41941. break;
  41942. }
  41943. xa = x + stack.shift();
  41944. ya = y;
  41945. xb = xa + stack.shift();
  41946. yb = ya + stack.shift();
  41947. y = yb + stack.shift();
  41948. x = xb + (stack.length === 1 ? stack.shift() : 0);
  41949. bezierCurveTo(xa, ya, xb, yb, x, y);
  41950. }
  41951. break;
  41952. case 31:
  41953. while (stack.length > 0) {
  41954. xa = x + stack.shift();
  41955. ya = y;
  41956. xb = xa + stack.shift();
  41957. yb = ya + stack.shift();
  41958. y = yb + stack.shift();
  41959. x = xb + (stack.length === 1 ? stack.shift() : 0);
  41960. bezierCurveTo(xa, ya, xb, yb, x, y);
  41961. if (stack.length === 0) {
  41962. break;
  41963. }
  41964. xa = x;
  41965. ya = y + stack.shift();
  41966. xb = xa + stack.shift();
  41967. yb = ya + stack.shift();
  41968. x = xb + stack.shift();
  41969. y = yb + (stack.length === 1 ? stack.shift() : 0);
  41970. bezierCurveTo(xa, ya, xb, yb, x, y);
  41971. }
  41972. break;
  41973. default:
  41974. if (v < 32) {
  41975. throw new _util.FormatError(`unknown operator: ${v}`);
  41976. }
  41977. if (v < 247) {
  41978. stack.push(v - 139);
  41979. } else if (v < 251) {
  41980. stack.push((v - 247) * 256 + code[i++] + 108);
  41981. } else if (v < 255) {
  41982. stack.push(-(v - 251) * 256 - code[i++] - 108);
  41983. } else {
  41984. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  41985. i += 4;
  41986. }
  41987. break;
  41988. }
  41989. if (stackClean) {
  41990. stack.length = 0;
  41991. }
  41992. }
  41993. }
  41994. parse(charStringCode);
  41995. }
  41996. const NOOP = [];
  41997. class CompiledFont {
  41998. constructor(fontMatrix) {
  41999. if (this.constructor === CompiledFont) {
  42000. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  42001. }
  42002. this.fontMatrix = fontMatrix;
  42003. this.compiledGlyphs = Object.create(null);
  42004. this.compiledCharCodeToGlyphId = Object.create(null);
  42005. }
  42006. getPathJs(unicode) {
  42007. const {
  42008. charCode,
  42009. glyphId
  42010. } = lookupCmap(this.cmap, unicode);
  42011. let fn = this.compiledGlyphs[glyphId];
  42012. if (!fn) {
  42013. try {
  42014. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  42015. this.compiledGlyphs[glyphId] = fn;
  42016. } catch (ex) {
  42017. this.compiledGlyphs[glyphId] = NOOP;
  42018. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  42019. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  42020. }
  42021. throw ex;
  42022. }
  42023. }
  42024. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  42025. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  42026. }
  42027. return fn;
  42028. }
  42029. compileGlyph(code, glyphId) {
  42030. if (!code || code.length === 0 || code[0] === 14) {
  42031. return NOOP;
  42032. }
  42033. let fontMatrix = this.fontMatrix;
  42034. if (this.isCFFCIDFont) {
  42035. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  42036. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  42037. const fontDict = this.fdArray[fdIndex];
  42038. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  42039. } else {
  42040. (0, _util.warn)("Invalid fd index for glyph index.");
  42041. }
  42042. }
  42043. const cmds = [{
  42044. cmd: "save"
  42045. }, {
  42046. cmd: "transform",
  42047. args: fontMatrix.slice()
  42048. }, {
  42049. cmd: "scale",
  42050. args: ["size", "-size"]
  42051. }];
  42052. this.compileGlyphImpl(code, cmds, glyphId);
  42053. cmds.push({
  42054. cmd: "restore"
  42055. });
  42056. return cmds;
  42057. }
  42058. compileGlyphImpl() {
  42059. (0, _util.unreachable)("Children classes should implement this.");
  42060. }
  42061. hasBuiltPath(unicode) {
  42062. const {
  42063. charCode,
  42064. glyphId
  42065. } = lookupCmap(this.cmap, unicode);
  42066. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  42067. }
  42068. }
  42069. class TrueTypeCompiled extends CompiledFont {
  42070. constructor(glyphs, cmap, fontMatrix) {
  42071. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  42072. this.glyphs = glyphs;
  42073. this.cmap = cmap;
  42074. }
  42075. compileGlyphImpl(code, cmds) {
  42076. compileGlyf(code, cmds, this);
  42077. }
  42078. }
  42079. class Type2Compiled extends CompiledFont {
  42080. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  42081. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  42082. this.glyphs = cffInfo.glyphs;
  42083. this.gsubrs = cffInfo.gsubrs || [];
  42084. this.subrs = cffInfo.subrs || [];
  42085. this.cmap = cmap;
  42086. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  42087. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  42088. this.subrsBias = getSubroutineBias(this.subrs);
  42089. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  42090. this.fdSelect = cffInfo.fdSelect;
  42091. this.fdArray = cffInfo.fdArray;
  42092. }
  42093. compileGlyphImpl(code, cmds, glyphId) {
  42094. compileCharString(code, cmds, this, glyphId);
  42095. }
  42096. }
  42097. class FontRendererFactory {
  42098. static create(font, seacAnalysisEnabled) {
  42099. const data = new Uint8Array(font.data);
  42100. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  42101. const numTables = getUint16(data, 4);
  42102. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  42103. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  42104. const offset = getUint32(data, p + 8);
  42105. const length = getUint32(data, p + 12);
  42106. switch (tag) {
  42107. case "cmap":
  42108. cmap = parseCmap(data, offset, offset + length);
  42109. break;
  42110. case "glyf":
  42111. glyf = data.subarray(offset, offset + length);
  42112. break;
  42113. case "loca":
  42114. loca = data.subarray(offset, offset + length);
  42115. break;
  42116. case "head":
  42117. unitsPerEm = getUint16(data, offset + 18);
  42118. indexToLocFormat = getUint16(data, offset + 50);
  42119. break;
  42120. case "CFF ":
  42121. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  42122. break;
  42123. }
  42124. }
  42125. if (glyf) {
  42126. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  42127. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  42128. }
  42129. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  42130. }
  42131. }
  42132. exports.FontRendererFactory = FontRendererFactory;
  42133. /***/ }),
  42134. /* 174 */
  42135. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42136. "use strict";
  42137. Object.defineProperty(exports, "__esModule", ({
  42138. value: true
  42139. }));
  42140. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  42141. var _core_utils = __w_pdfjs_require__(135);
  42142. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  42143. t.Courier = 600;
  42144. t["Courier-Bold"] = 600;
  42145. t["Courier-BoldOblique"] = 600;
  42146. t["Courier-Oblique"] = 600;
  42147. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  42148. t.space = 278;
  42149. t.exclam = 278;
  42150. t.quotedbl = 355;
  42151. t.numbersign = 556;
  42152. t.dollar = 556;
  42153. t.percent = 889;
  42154. t.ampersand = 667;
  42155. t.quoteright = 222;
  42156. t.parenleft = 333;
  42157. t.parenright = 333;
  42158. t.asterisk = 389;
  42159. t.plus = 584;
  42160. t.comma = 278;
  42161. t.hyphen = 333;
  42162. t.period = 278;
  42163. t.slash = 278;
  42164. t.zero = 556;
  42165. t.one = 556;
  42166. t.two = 556;
  42167. t.three = 556;
  42168. t.four = 556;
  42169. t.five = 556;
  42170. t.six = 556;
  42171. t.seven = 556;
  42172. t.eight = 556;
  42173. t.nine = 556;
  42174. t.colon = 278;
  42175. t.semicolon = 278;
  42176. t.less = 584;
  42177. t.equal = 584;
  42178. t.greater = 584;
  42179. t.question = 556;
  42180. t.at = 1015;
  42181. t.A = 667;
  42182. t.B = 667;
  42183. t.C = 722;
  42184. t.D = 722;
  42185. t.E = 667;
  42186. t.F = 611;
  42187. t.G = 778;
  42188. t.H = 722;
  42189. t.I = 278;
  42190. t.J = 500;
  42191. t.K = 667;
  42192. t.L = 556;
  42193. t.M = 833;
  42194. t.N = 722;
  42195. t.O = 778;
  42196. t.P = 667;
  42197. t.Q = 778;
  42198. t.R = 722;
  42199. t.S = 667;
  42200. t.T = 611;
  42201. t.U = 722;
  42202. t.V = 667;
  42203. t.W = 944;
  42204. t.X = 667;
  42205. t.Y = 667;
  42206. t.Z = 611;
  42207. t.bracketleft = 278;
  42208. t.backslash = 278;
  42209. t.bracketright = 278;
  42210. t.asciicircum = 469;
  42211. t.underscore = 556;
  42212. t.quoteleft = 222;
  42213. t.a = 556;
  42214. t.b = 556;
  42215. t.c = 500;
  42216. t.d = 556;
  42217. t.e = 556;
  42218. t.f = 278;
  42219. t.g = 556;
  42220. t.h = 556;
  42221. t.i = 222;
  42222. t.j = 222;
  42223. t.k = 500;
  42224. t.l = 222;
  42225. t.m = 833;
  42226. t.n = 556;
  42227. t.o = 556;
  42228. t.p = 556;
  42229. t.q = 556;
  42230. t.r = 333;
  42231. t.s = 500;
  42232. t.t = 278;
  42233. t.u = 556;
  42234. t.v = 500;
  42235. t.w = 722;
  42236. t.x = 500;
  42237. t.y = 500;
  42238. t.z = 500;
  42239. t.braceleft = 334;
  42240. t.bar = 260;
  42241. t.braceright = 334;
  42242. t.asciitilde = 584;
  42243. t.exclamdown = 333;
  42244. t.cent = 556;
  42245. t.sterling = 556;
  42246. t.fraction = 167;
  42247. t.yen = 556;
  42248. t.florin = 556;
  42249. t.section = 556;
  42250. t.currency = 556;
  42251. t.quotesingle = 191;
  42252. t.quotedblleft = 333;
  42253. t.guillemotleft = 556;
  42254. t.guilsinglleft = 333;
  42255. t.guilsinglright = 333;
  42256. t.fi = 500;
  42257. t.fl = 500;
  42258. t.endash = 556;
  42259. t.dagger = 556;
  42260. t.daggerdbl = 556;
  42261. t.periodcentered = 278;
  42262. t.paragraph = 537;
  42263. t.bullet = 350;
  42264. t.quotesinglbase = 222;
  42265. t.quotedblbase = 333;
  42266. t.quotedblright = 333;
  42267. t.guillemotright = 556;
  42268. t.ellipsis = 1000;
  42269. t.perthousand = 1000;
  42270. t.questiondown = 611;
  42271. t.grave = 333;
  42272. t.acute = 333;
  42273. t.circumflex = 333;
  42274. t.tilde = 333;
  42275. t.macron = 333;
  42276. t.breve = 333;
  42277. t.dotaccent = 333;
  42278. t.dieresis = 333;
  42279. t.ring = 333;
  42280. t.cedilla = 333;
  42281. t.hungarumlaut = 333;
  42282. t.ogonek = 333;
  42283. t.caron = 333;
  42284. t.emdash = 1000;
  42285. t.AE = 1000;
  42286. t.ordfeminine = 370;
  42287. t.Lslash = 556;
  42288. t.Oslash = 778;
  42289. t.OE = 1000;
  42290. t.ordmasculine = 365;
  42291. t.ae = 889;
  42292. t.dotlessi = 278;
  42293. t.lslash = 222;
  42294. t.oslash = 611;
  42295. t.oe = 944;
  42296. t.germandbls = 611;
  42297. t.Idieresis = 278;
  42298. t.eacute = 556;
  42299. t.abreve = 556;
  42300. t.uhungarumlaut = 556;
  42301. t.ecaron = 556;
  42302. t.Ydieresis = 667;
  42303. t.divide = 584;
  42304. t.Yacute = 667;
  42305. t.Acircumflex = 667;
  42306. t.aacute = 556;
  42307. t.Ucircumflex = 722;
  42308. t.yacute = 500;
  42309. t.scommaaccent = 500;
  42310. t.ecircumflex = 556;
  42311. t.Uring = 722;
  42312. t.Udieresis = 722;
  42313. t.aogonek = 556;
  42314. t.Uacute = 722;
  42315. t.uogonek = 556;
  42316. t.Edieresis = 667;
  42317. t.Dcroat = 722;
  42318. t.commaaccent = 250;
  42319. t.copyright = 737;
  42320. t.Emacron = 667;
  42321. t.ccaron = 500;
  42322. t.aring = 556;
  42323. t.Ncommaaccent = 722;
  42324. t.lacute = 222;
  42325. t.agrave = 556;
  42326. t.Tcommaaccent = 611;
  42327. t.Cacute = 722;
  42328. t.atilde = 556;
  42329. t.Edotaccent = 667;
  42330. t.scaron = 500;
  42331. t.scedilla = 500;
  42332. t.iacute = 278;
  42333. t.lozenge = 471;
  42334. t.Rcaron = 722;
  42335. t.Gcommaaccent = 778;
  42336. t.ucircumflex = 556;
  42337. t.acircumflex = 556;
  42338. t.Amacron = 667;
  42339. t.rcaron = 333;
  42340. t.ccedilla = 500;
  42341. t.Zdotaccent = 611;
  42342. t.Thorn = 667;
  42343. t.Omacron = 778;
  42344. t.Racute = 722;
  42345. t.Sacute = 667;
  42346. t.dcaron = 643;
  42347. t.Umacron = 722;
  42348. t.uring = 556;
  42349. t.threesuperior = 333;
  42350. t.Ograve = 778;
  42351. t.Agrave = 667;
  42352. t.Abreve = 667;
  42353. t.multiply = 584;
  42354. t.uacute = 556;
  42355. t.Tcaron = 611;
  42356. t.partialdiff = 476;
  42357. t.ydieresis = 500;
  42358. t.Nacute = 722;
  42359. t.icircumflex = 278;
  42360. t.Ecircumflex = 667;
  42361. t.adieresis = 556;
  42362. t.edieresis = 556;
  42363. t.cacute = 500;
  42364. t.nacute = 556;
  42365. t.umacron = 556;
  42366. t.Ncaron = 722;
  42367. t.Iacute = 278;
  42368. t.plusminus = 584;
  42369. t.brokenbar = 260;
  42370. t.registered = 737;
  42371. t.Gbreve = 778;
  42372. t.Idotaccent = 278;
  42373. t.summation = 600;
  42374. t.Egrave = 667;
  42375. t.racute = 333;
  42376. t.omacron = 556;
  42377. t.Zacute = 611;
  42378. t.Zcaron = 611;
  42379. t.greaterequal = 549;
  42380. t.Eth = 722;
  42381. t.Ccedilla = 722;
  42382. t.lcommaaccent = 222;
  42383. t.tcaron = 317;
  42384. t.eogonek = 556;
  42385. t.Uogonek = 722;
  42386. t.Aacute = 667;
  42387. t.Adieresis = 667;
  42388. t.egrave = 556;
  42389. t.zacute = 500;
  42390. t.iogonek = 222;
  42391. t.Oacute = 778;
  42392. t.oacute = 556;
  42393. t.amacron = 556;
  42394. t.sacute = 500;
  42395. t.idieresis = 278;
  42396. t.Ocircumflex = 778;
  42397. t.Ugrave = 722;
  42398. t.Delta = 612;
  42399. t.thorn = 556;
  42400. t.twosuperior = 333;
  42401. t.Odieresis = 778;
  42402. t.mu = 556;
  42403. t.igrave = 278;
  42404. t.ohungarumlaut = 556;
  42405. t.Eogonek = 667;
  42406. t.dcroat = 556;
  42407. t.threequarters = 834;
  42408. t.Scedilla = 667;
  42409. t.lcaron = 299;
  42410. t.Kcommaaccent = 667;
  42411. t.Lacute = 556;
  42412. t.trademark = 1000;
  42413. t.edotaccent = 556;
  42414. t.Igrave = 278;
  42415. t.Imacron = 278;
  42416. t.Lcaron = 556;
  42417. t.onehalf = 834;
  42418. t.lessequal = 549;
  42419. t.ocircumflex = 556;
  42420. t.ntilde = 556;
  42421. t.Uhungarumlaut = 722;
  42422. t.Eacute = 667;
  42423. t.emacron = 556;
  42424. t.gbreve = 556;
  42425. t.onequarter = 834;
  42426. t.Scaron = 667;
  42427. t.Scommaaccent = 667;
  42428. t.Ohungarumlaut = 778;
  42429. t.degree = 400;
  42430. t.ograve = 556;
  42431. t.Ccaron = 722;
  42432. t.ugrave = 556;
  42433. t.radical = 453;
  42434. t.Dcaron = 722;
  42435. t.rcommaaccent = 333;
  42436. t.Ntilde = 722;
  42437. t.otilde = 556;
  42438. t.Rcommaaccent = 722;
  42439. t.Lcommaaccent = 556;
  42440. t.Atilde = 667;
  42441. t.Aogonek = 667;
  42442. t.Aring = 667;
  42443. t.Otilde = 778;
  42444. t.zdotaccent = 500;
  42445. t.Ecaron = 667;
  42446. t.Iogonek = 278;
  42447. t.kcommaaccent = 500;
  42448. t.minus = 584;
  42449. t.Icircumflex = 278;
  42450. t.ncaron = 556;
  42451. t.tcommaaccent = 278;
  42452. t.logicalnot = 584;
  42453. t.odieresis = 556;
  42454. t.udieresis = 556;
  42455. t.notequal = 549;
  42456. t.gcommaaccent = 556;
  42457. t.eth = 556;
  42458. t.zcaron = 500;
  42459. t.ncommaaccent = 556;
  42460. t.onesuperior = 333;
  42461. t.imacron = 278;
  42462. t.Euro = 556;
  42463. });
  42464. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42465. t.space = 278;
  42466. t.exclam = 333;
  42467. t.quotedbl = 474;
  42468. t.numbersign = 556;
  42469. t.dollar = 556;
  42470. t.percent = 889;
  42471. t.ampersand = 722;
  42472. t.quoteright = 278;
  42473. t.parenleft = 333;
  42474. t.parenright = 333;
  42475. t.asterisk = 389;
  42476. t.plus = 584;
  42477. t.comma = 278;
  42478. t.hyphen = 333;
  42479. t.period = 278;
  42480. t.slash = 278;
  42481. t.zero = 556;
  42482. t.one = 556;
  42483. t.two = 556;
  42484. t.three = 556;
  42485. t.four = 556;
  42486. t.five = 556;
  42487. t.six = 556;
  42488. t.seven = 556;
  42489. t.eight = 556;
  42490. t.nine = 556;
  42491. t.colon = 333;
  42492. t.semicolon = 333;
  42493. t.less = 584;
  42494. t.equal = 584;
  42495. t.greater = 584;
  42496. t.question = 611;
  42497. t.at = 975;
  42498. t.A = 722;
  42499. t.B = 722;
  42500. t.C = 722;
  42501. t.D = 722;
  42502. t.E = 667;
  42503. t.F = 611;
  42504. t.G = 778;
  42505. t.H = 722;
  42506. t.I = 278;
  42507. t.J = 556;
  42508. t.K = 722;
  42509. t.L = 611;
  42510. t.M = 833;
  42511. t.N = 722;
  42512. t.O = 778;
  42513. t.P = 667;
  42514. t.Q = 778;
  42515. t.R = 722;
  42516. t.S = 667;
  42517. t.T = 611;
  42518. t.U = 722;
  42519. t.V = 667;
  42520. t.W = 944;
  42521. t.X = 667;
  42522. t.Y = 667;
  42523. t.Z = 611;
  42524. t.bracketleft = 333;
  42525. t.backslash = 278;
  42526. t.bracketright = 333;
  42527. t.asciicircum = 584;
  42528. t.underscore = 556;
  42529. t.quoteleft = 278;
  42530. t.a = 556;
  42531. t.b = 611;
  42532. t.c = 556;
  42533. t.d = 611;
  42534. t.e = 556;
  42535. t.f = 333;
  42536. t.g = 611;
  42537. t.h = 611;
  42538. t.i = 278;
  42539. t.j = 278;
  42540. t.k = 556;
  42541. t.l = 278;
  42542. t.m = 889;
  42543. t.n = 611;
  42544. t.o = 611;
  42545. t.p = 611;
  42546. t.q = 611;
  42547. t.r = 389;
  42548. t.s = 556;
  42549. t.t = 333;
  42550. t.u = 611;
  42551. t.v = 556;
  42552. t.w = 778;
  42553. t.x = 556;
  42554. t.y = 556;
  42555. t.z = 500;
  42556. t.braceleft = 389;
  42557. t.bar = 280;
  42558. t.braceright = 389;
  42559. t.asciitilde = 584;
  42560. t.exclamdown = 333;
  42561. t.cent = 556;
  42562. t.sterling = 556;
  42563. t.fraction = 167;
  42564. t.yen = 556;
  42565. t.florin = 556;
  42566. t.section = 556;
  42567. t.currency = 556;
  42568. t.quotesingle = 238;
  42569. t.quotedblleft = 500;
  42570. t.guillemotleft = 556;
  42571. t.guilsinglleft = 333;
  42572. t.guilsinglright = 333;
  42573. t.fi = 611;
  42574. t.fl = 611;
  42575. t.endash = 556;
  42576. t.dagger = 556;
  42577. t.daggerdbl = 556;
  42578. t.periodcentered = 278;
  42579. t.paragraph = 556;
  42580. t.bullet = 350;
  42581. t.quotesinglbase = 278;
  42582. t.quotedblbase = 500;
  42583. t.quotedblright = 500;
  42584. t.guillemotright = 556;
  42585. t.ellipsis = 1000;
  42586. t.perthousand = 1000;
  42587. t.questiondown = 611;
  42588. t.grave = 333;
  42589. t.acute = 333;
  42590. t.circumflex = 333;
  42591. t.tilde = 333;
  42592. t.macron = 333;
  42593. t.breve = 333;
  42594. t.dotaccent = 333;
  42595. t.dieresis = 333;
  42596. t.ring = 333;
  42597. t.cedilla = 333;
  42598. t.hungarumlaut = 333;
  42599. t.ogonek = 333;
  42600. t.caron = 333;
  42601. t.emdash = 1000;
  42602. t.AE = 1000;
  42603. t.ordfeminine = 370;
  42604. t.Lslash = 611;
  42605. t.Oslash = 778;
  42606. t.OE = 1000;
  42607. t.ordmasculine = 365;
  42608. t.ae = 889;
  42609. t.dotlessi = 278;
  42610. t.lslash = 278;
  42611. t.oslash = 611;
  42612. t.oe = 944;
  42613. t.germandbls = 611;
  42614. t.Idieresis = 278;
  42615. t.eacute = 556;
  42616. t.abreve = 556;
  42617. t.uhungarumlaut = 611;
  42618. t.ecaron = 556;
  42619. t.Ydieresis = 667;
  42620. t.divide = 584;
  42621. t.Yacute = 667;
  42622. t.Acircumflex = 722;
  42623. t.aacute = 556;
  42624. t.Ucircumflex = 722;
  42625. t.yacute = 556;
  42626. t.scommaaccent = 556;
  42627. t.ecircumflex = 556;
  42628. t.Uring = 722;
  42629. t.Udieresis = 722;
  42630. t.aogonek = 556;
  42631. t.Uacute = 722;
  42632. t.uogonek = 611;
  42633. t.Edieresis = 667;
  42634. t.Dcroat = 722;
  42635. t.commaaccent = 250;
  42636. t.copyright = 737;
  42637. t.Emacron = 667;
  42638. t.ccaron = 556;
  42639. t.aring = 556;
  42640. t.Ncommaaccent = 722;
  42641. t.lacute = 278;
  42642. t.agrave = 556;
  42643. t.Tcommaaccent = 611;
  42644. t.Cacute = 722;
  42645. t.atilde = 556;
  42646. t.Edotaccent = 667;
  42647. t.scaron = 556;
  42648. t.scedilla = 556;
  42649. t.iacute = 278;
  42650. t.lozenge = 494;
  42651. t.Rcaron = 722;
  42652. t.Gcommaaccent = 778;
  42653. t.ucircumflex = 611;
  42654. t.acircumflex = 556;
  42655. t.Amacron = 722;
  42656. t.rcaron = 389;
  42657. t.ccedilla = 556;
  42658. t.Zdotaccent = 611;
  42659. t.Thorn = 667;
  42660. t.Omacron = 778;
  42661. t.Racute = 722;
  42662. t.Sacute = 667;
  42663. t.dcaron = 743;
  42664. t.Umacron = 722;
  42665. t.uring = 611;
  42666. t.threesuperior = 333;
  42667. t.Ograve = 778;
  42668. t.Agrave = 722;
  42669. t.Abreve = 722;
  42670. t.multiply = 584;
  42671. t.uacute = 611;
  42672. t.Tcaron = 611;
  42673. t.partialdiff = 494;
  42674. t.ydieresis = 556;
  42675. t.Nacute = 722;
  42676. t.icircumflex = 278;
  42677. t.Ecircumflex = 667;
  42678. t.adieresis = 556;
  42679. t.edieresis = 556;
  42680. t.cacute = 556;
  42681. t.nacute = 611;
  42682. t.umacron = 611;
  42683. t.Ncaron = 722;
  42684. t.Iacute = 278;
  42685. t.plusminus = 584;
  42686. t.brokenbar = 280;
  42687. t.registered = 737;
  42688. t.Gbreve = 778;
  42689. t.Idotaccent = 278;
  42690. t.summation = 600;
  42691. t.Egrave = 667;
  42692. t.racute = 389;
  42693. t.omacron = 611;
  42694. t.Zacute = 611;
  42695. t.Zcaron = 611;
  42696. t.greaterequal = 549;
  42697. t.Eth = 722;
  42698. t.Ccedilla = 722;
  42699. t.lcommaaccent = 278;
  42700. t.tcaron = 389;
  42701. t.eogonek = 556;
  42702. t.Uogonek = 722;
  42703. t.Aacute = 722;
  42704. t.Adieresis = 722;
  42705. t.egrave = 556;
  42706. t.zacute = 500;
  42707. t.iogonek = 278;
  42708. t.Oacute = 778;
  42709. t.oacute = 611;
  42710. t.amacron = 556;
  42711. t.sacute = 556;
  42712. t.idieresis = 278;
  42713. t.Ocircumflex = 778;
  42714. t.Ugrave = 722;
  42715. t.Delta = 612;
  42716. t.thorn = 611;
  42717. t.twosuperior = 333;
  42718. t.Odieresis = 778;
  42719. t.mu = 611;
  42720. t.igrave = 278;
  42721. t.ohungarumlaut = 611;
  42722. t.Eogonek = 667;
  42723. t.dcroat = 611;
  42724. t.threequarters = 834;
  42725. t.Scedilla = 667;
  42726. t.lcaron = 400;
  42727. t.Kcommaaccent = 722;
  42728. t.Lacute = 611;
  42729. t.trademark = 1000;
  42730. t.edotaccent = 556;
  42731. t.Igrave = 278;
  42732. t.Imacron = 278;
  42733. t.Lcaron = 611;
  42734. t.onehalf = 834;
  42735. t.lessequal = 549;
  42736. t.ocircumflex = 611;
  42737. t.ntilde = 611;
  42738. t.Uhungarumlaut = 722;
  42739. t.Eacute = 667;
  42740. t.emacron = 556;
  42741. t.gbreve = 611;
  42742. t.onequarter = 834;
  42743. t.Scaron = 667;
  42744. t.Scommaaccent = 667;
  42745. t.Ohungarumlaut = 778;
  42746. t.degree = 400;
  42747. t.ograve = 611;
  42748. t.Ccaron = 722;
  42749. t.ugrave = 611;
  42750. t.radical = 549;
  42751. t.Dcaron = 722;
  42752. t.rcommaaccent = 389;
  42753. t.Ntilde = 722;
  42754. t.otilde = 611;
  42755. t.Rcommaaccent = 722;
  42756. t.Lcommaaccent = 611;
  42757. t.Atilde = 722;
  42758. t.Aogonek = 722;
  42759. t.Aring = 722;
  42760. t.Otilde = 778;
  42761. t.zdotaccent = 500;
  42762. t.Ecaron = 667;
  42763. t.Iogonek = 278;
  42764. t.kcommaaccent = 556;
  42765. t.minus = 584;
  42766. t.Icircumflex = 278;
  42767. t.ncaron = 611;
  42768. t.tcommaaccent = 333;
  42769. t.logicalnot = 584;
  42770. t.odieresis = 611;
  42771. t.udieresis = 611;
  42772. t.notequal = 549;
  42773. t.gcommaaccent = 611;
  42774. t.eth = 611;
  42775. t.zcaron = 500;
  42776. t.ncommaaccent = 611;
  42777. t.onesuperior = 333;
  42778. t.imacron = 278;
  42779. t.Euro = 556;
  42780. });
  42781. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42782. t.space = 278;
  42783. t.exclam = 333;
  42784. t.quotedbl = 474;
  42785. t.numbersign = 556;
  42786. t.dollar = 556;
  42787. t.percent = 889;
  42788. t.ampersand = 722;
  42789. t.quoteright = 278;
  42790. t.parenleft = 333;
  42791. t.parenright = 333;
  42792. t.asterisk = 389;
  42793. t.plus = 584;
  42794. t.comma = 278;
  42795. t.hyphen = 333;
  42796. t.period = 278;
  42797. t.slash = 278;
  42798. t.zero = 556;
  42799. t.one = 556;
  42800. t.two = 556;
  42801. t.three = 556;
  42802. t.four = 556;
  42803. t.five = 556;
  42804. t.six = 556;
  42805. t.seven = 556;
  42806. t.eight = 556;
  42807. t.nine = 556;
  42808. t.colon = 333;
  42809. t.semicolon = 333;
  42810. t.less = 584;
  42811. t.equal = 584;
  42812. t.greater = 584;
  42813. t.question = 611;
  42814. t.at = 975;
  42815. t.A = 722;
  42816. t.B = 722;
  42817. t.C = 722;
  42818. t.D = 722;
  42819. t.E = 667;
  42820. t.F = 611;
  42821. t.G = 778;
  42822. t.H = 722;
  42823. t.I = 278;
  42824. t.J = 556;
  42825. t.K = 722;
  42826. t.L = 611;
  42827. t.M = 833;
  42828. t.N = 722;
  42829. t.O = 778;
  42830. t.P = 667;
  42831. t.Q = 778;
  42832. t.R = 722;
  42833. t.S = 667;
  42834. t.T = 611;
  42835. t.U = 722;
  42836. t.V = 667;
  42837. t.W = 944;
  42838. t.X = 667;
  42839. t.Y = 667;
  42840. t.Z = 611;
  42841. t.bracketleft = 333;
  42842. t.backslash = 278;
  42843. t.bracketright = 333;
  42844. t.asciicircum = 584;
  42845. t.underscore = 556;
  42846. t.quoteleft = 278;
  42847. t.a = 556;
  42848. t.b = 611;
  42849. t.c = 556;
  42850. t.d = 611;
  42851. t.e = 556;
  42852. t.f = 333;
  42853. t.g = 611;
  42854. t.h = 611;
  42855. t.i = 278;
  42856. t.j = 278;
  42857. t.k = 556;
  42858. t.l = 278;
  42859. t.m = 889;
  42860. t.n = 611;
  42861. t.o = 611;
  42862. t.p = 611;
  42863. t.q = 611;
  42864. t.r = 389;
  42865. t.s = 556;
  42866. t.t = 333;
  42867. t.u = 611;
  42868. t.v = 556;
  42869. t.w = 778;
  42870. t.x = 556;
  42871. t.y = 556;
  42872. t.z = 500;
  42873. t.braceleft = 389;
  42874. t.bar = 280;
  42875. t.braceright = 389;
  42876. t.asciitilde = 584;
  42877. t.exclamdown = 333;
  42878. t.cent = 556;
  42879. t.sterling = 556;
  42880. t.fraction = 167;
  42881. t.yen = 556;
  42882. t.florin = 556;
  42883. t.section = 556;
  42884. t.currency = 556;
  42885. t.quotesingle = 238;
  42886. t.quotedblleft = 500;
  42887. t.guillemotleft = 556;
  42888. t.guilsinglleft = 333;
  42889. t.guilsinglright = 333;
  42890. t.fi = 611;
  42891. t.fl = 611;
  42892. t.endash = 556;
  42893. t.dagger = 556;
  42894. t.daggerdbl = 556;
  42895. t.periodcentered = 278;
  42896. t.paragraph = 556;
  42897. t.bullet = 350;
  42898. t.quotesinglbase = 278;
  42899. t.quotedblbase = 500;
  42900. t.quotedblright = 500;
  42901. t.guillemotright = 556;
  42902. t.ellipsis = 1000;
  42903. t.perthousand = 1000;
  42904. t.questiondown = 611;
  42905. t.grave = 333;
  42906. t.acute = 333;
  42907. t.circumflex = 333;
  42908. t.tilde = 333;
  42909. t.macron = 333;
  42910. t.breve = 333;
  42911. t.dotaccent = 333;
  42912. t.dieresis = 333;
  42913. t.ring = 333;
  42914. t.cedilla = 333;
  42915. t.hungarumlaut = 333;
  42916. t.ogonek = 333;
  42917. t.caron = 333;
  42918. t.emdash = 1000;
  42919. t.AE = 1000;
  42920. t.ordfeminine = 370;
  42921. t.Lslash = 611;
  42922. t.Oslash = 778;
  42923. t.OE = 1000;
  42924. t.ordmasculine = 365;
  42925. t.ae = 889;
  42926. t.dotlessi = 278;
  42927. t.lslash = 278;
  42928. t.oslash = 611;
  42929. t.oe = 944;
  42930. t.germandbls = 611;
  42931. t.Idieresis = 278;
  42932. t.eacute = 556;
  42933. t.abreve = 556;
  42934. t.uhungarumlaut = 611;
  42935. t.ecaron = 556;
  42936. t.Ydieresis = 667;
  42937. t.divide = 584;
  42938. t.Yacute = 667;
  42939. t.Acircumflex = 722;
  42940. t.aacute = 556;
  42941. t.Ucircumflex = 722;
  42942. t.yacute = 556;
  42943. t.scommaaccent = 556;
  42944. t.ecircumflex = 556;
  42945. t.Uring = 722;
  42946. t.Udieresis = 722;
  42947. t.aogonek = 556;
  42948. t.Uacute = 722;
  42949. t.uogonek = 611;
  42950. t.Edieresis = 667;
  42951. t.Dcroat = 722;
  42952. t.commaaccent = 250;
  42953. t.copyright = 737;
  42954. t.Emacron = 667;
  42955. t.ccaron = 556;
  42956. t.aring = 556;
  42957. t.Ncommaaccent = 722;
  42958. t.lacute = 278;
  42959. t.agrave = 556;
  42960. t.Tcommaaccent = 611;
  42961. t.Cacute = 722;
  42962. t.atilde = 556;
  42963. t.Edotaccent = 667;
  42964. t.scaron = 556;
  42965. t.scedilla = 556;
  42966. t.iacute = 278;
  42967. t.lozenge = 494;
  42968. t.Rcaron = 722;
  42969. t.Gcommaaccent = 778;
  42970. t.ucircumflex = 611;
  42971. t.acircumflex = 556;
  42972. t.Amacron = 722;
  42973. t.rcaron = 389;
  42974. t.ccedilla = 556;
  42975. t.Zdotaccent = 611;
  42976. t.Thorn = 667;
  42977. t.Omacron = 778;
  42978. t.Racute = 722;
  42979. t.Sacute = 667;
  42980. t.dcaron = 743;
  42981. t.Umacron = 722;
  42982. t.uring = 611;
  42983. t.threesuperior = 333;
  42984. t.Ograve = 778;
  42985. t.Agrave = 722;
  42986. t.Abreve = 722;
  42987. t.multiply = 584;
  42988. t.uacute = 611;
  42989. t.Tcaron = 611;
  42990. t.partialdiff = 494;
  42991. t.ydieresis = 556;
  42992. t.Nacute = 722;
  42993. t.icircumflex = 278;
  42994. t.Ecircumflex = 667;
  42995. t.adieresis = 556;
  42996. t.edieresis = 556;
  42997. t.cacute = 556;
  42998. t.nacute = 611;
  42999. t.umacron = 611;
  43000. t.Ncaron = 722;
  43001. t.Iacute = 278;
  43002. t.plusminus = 584;
  43003. t.brokenbar = 280;
  43004. t.registered = 737;
  43005. t.Gbreve = 778;
  43006. t.Idotaccent = 278;
  43007. t.summation = 600;
  43008. t.Egrave = 667;
  43009. t.racute = 389;
  43010. t.omacron = 611;
  43011. t.Zacute = 611;
  43012. t.Zcaron = 611;
  43013. t.greaterequal = 549;
  43014. t.Eth = 722;
  43015. t.Ccedilla = 722;
  43016. t.lcommaaccent = 278;
  43017. t.tcaron = 389;
  43018. t.eogonek = 556;
  43019. t.Uogonek = 722;
  43020. t.Aacute = 722;
  43021. t.Adieresis = 722;
  43022. t.egrave = 556;
  43023. t.zacute = 500;
  43024. t.iogonek = 278;
  43025. t.Oacute = 778;
  43026. t.oacute = 611;
  43027. t.amacron = 556;
  43028. t.sacute = 556;
  43029. t.idieresis = 278;
  43030. t.Ocircumflex = 778;
  43031. t.Ugrave = 722;
  43032. t.Delta = 612;
  43033. t.thorn = 611;
  43034. t.twosuperior = 333;
  43035. t.Odieresis = 778;
  43036. t.mu = 611;
  43037. t.igrave = 278;
  43038. t.ohungarumlaut = 611;
  43039. t.Eogonek = 667;
  43040. t.dcroat = 611;
  43041. t.threequarters = 834;
  43042. t.Scedilla = 667;
  43043. t.lcaron = 400;
  43044. t.Kcommaaccent = 722;
  43045. t.Lacute = 611;
  43046. t.trademark = 1000;
  43047. t.edotaccent = 556;
  43048. t.Igrave = 278;
  43049. t.Imacron = 278;
  43050. t.Lcaron = 611;
  43051. t.onehalf = 834;
  43052. t.lessequal = 549;
  43053. t.ocircumflex = 611;
  43054. t.ntilde = 611;
  43055. t.Uhungarumlaut = 722;
  43056. t.Eacute = 667;
  43057. t.emacron = 556;
  43058. t.gbreve = 611;
  43059. t.onequarter = 834;
  43060. t.Scaron = 667;
  43061. t.Scommaaccent = 667;
  43062. t.Ohungarumlaut = 778;
  43063. t.degree = 400;
  43064. t.ograve = 611;
  43065. t.Ccaron = 722;
  43066. t.ugrave = 611;
  43067. t.radical = 549;
  43068. t.Dcaron = 722;
  43069. t.rcommaaccent = 389;
  43070. t.Ntilde = 722;
  43071. t.otilde = 611;
  43072. t.Rcommaaccent = 722;
  43073. t.Lcommaaccent = 611;
  43074. t.Atilde = 722;
  43075. t.Aogonek = 722;
  43076. t.Aring = 722;
  43077. t.Otilde = 778;
  43078. t.zdotaccent = 500;
  43079. t.Ecaron = 667;
  43080. t.Iogonek = 278;
  43081. t.kcommaaccent = 556;
  43082. t.minus = 584;
  43083. t.Icircumflex = 278;
  43084. t.ncaron = 611;
  43085. t.tcommaaccent = 333;
  43086. t.logicalnot = 584;
  43087. t.odieresis = 611;
  43088. t.udieresis = 611;
  43089. t.notequal = 549;
  43090. t.gcommaaccent = 611;
  43091. t.eth = 611;
  43092. t.zcaron = 500;
  43093. t.ncommaaccent = 611;
  43094. t.onesuperior = 333;
  43095. t.imacron = 278;
  43096. t.Euro = 556;
  43097. });
  43098. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43099. t.space = 278;
  43100. t.exclam = 278;
  43101. t.quotedbl = 355;
  43102. t.numbersign = 556;
  43103. t.dollar = 556;
  43104. t.percent = 889;
  43105. t.ampersand = 667;
  43106. t.quoteright = 222;
  43107. t.parenleft = 333;
  43108. t.parenright = 333;
  43109. t.asterisk = 389;
  43110. t.plus = 584;
  43111. t.comma = 278;
  43112. t.hyphen = 333;
  43113. t.period = 278;
  43114. t.slash = 278;
  43115. t.zero = 556;
  43116. t.one = 556;
  43117. t.two = 556;
  43118. t.three = 556;
  43119. t.four = 556;
  43120. t.five = 556;
  43121. t.six = 556;
  43122. t.seven = 556;
  43123. t.eight = 556;
  43124. t.nine = 556;
  43125. t.colon = 278;
  43126. t.semicolon = 278;
  43127. t.less = 584;
  43128. t.equal = 584;
  43129. t.greater = 584;
  43130. t.question = 556;
  43131. t.at = 1015;
  43132. t.A = 667;
  43133. t.B = 667;
  43134. t.C = 722;
  43135. t.D = 722;
  43136. t.E = 667;
  43137. t.F = 611;
  43138. t.G = 778;
  43139. t.H = 722;
  43140. t.I = 278;
  43141. t.J = 500;
  43142. t.K = 667;
  43143. t.L = 556;
  43144. t.M = 833;
  43145. t.N = 722;
  43146. t.O = 778;
  43147. t.P = 667;
  43148. t.Q = 778;
  43149. t.R = 722;
  43150. t.S = 667;
  43151. t.T = 611;
  43152. t.U = 722;
  43153. t.V = 667;
  43154. t.W = 944;
  43155. t.X = 667;
  43156. t.Y = 667;
  43157. t.Z = 611;
  43158. t.bracketleft = 278;
  43159. t.backslash = 278;
  43160. t.bracketright = 278;
  43161. t.asciicircum = 469;
  43162. t.underscore = 556;
  43163. t.quoteleft = 222;
  43164. t.a = 556;
  43165. t.b = 556;
  43166. t.c = 500;
  43167. t.d = 556;
  43168. t.e = 556;
  43169. t.f = 278;
  43170. t.g = 556;
  43171. t.h = 556;
  43172. t.i = 222;
  43173. t.j = 222;
  43174. t.k = 500;
  43175. t.l = 222;
  43176. t.m = 833;
  43177. t.n = 556;
  43178. t.o = 556;
  43179. t.p = 556;
  43180. t.q = 556;
  43181. t.r = 333;
  43182. t.s = 500;
  43183. t.t = 278;
  43184. t.u = 556;
  43185. t.v = 500;
  43186. t.w = 722;
  43187. t.x = 500;
  43188. t.y = 500;
  43189. t.z = 500;
  43190. t.braceleft = 334;
  43191. t.bar = 260;
  43192. t.braceright = 334;
  43193. t.asciitilde = 584;
  43194. t.exclamdown = 333;
  43195. t.cent = 556;
  43196. t.sterling = 556;
  43197. t.fraction = 167;
  43198. t.yen = 556;
  43199. t.florin = 556;
  43200. t.section = 556;
  43201. t.currency = 556;
  43202. t.quotesingle = 191;
  43203. t.quotedblleft = 333;
  43204. t.guillemotleft = 556;
  43205. t.guilsinglleft = 333;
  43206. t.guilsinglright = 333;
  43207. t.fi = 500;
  43208. t.fl = 500;
  43209. t.endash = 556;
  43210. t.dagger = 556;
  43211. t.daggerdbl = 556;
  43212. t.periodcentered = 278;
  43213. t.paragraph = 537;
  43214. t.bullet = 350;
  43215. t.quotesinglbase = 222;
  43216. t.quotedblbase = 333;
  43217. t.quotedblright = 333;
  43218. t.guillemotright = 556;
  43219. t.ellipsis = 1000;
  43220. t.perthousand = 1000;
  43221. t.questiondown = 611;
  43222. t.grave = 333;
  43223. t.acute = 333;
  43224. t.circumflex = 333;
  43225. t.tilde = 333;
  43226. t.macron = 333;
  43227. t.breve = 333;
  43228. t.dotaccent = 333;
  43229. t.dieresis = 333;
  43230. t.ring = 333;
  43231. t.cedilla = 333;
  43232. t.hungarumlaut = 333;
  43233. t.ogonek = 333;
  43234. t.caron = 333;
  43235. t.emdash = 1000;
  43236. t.AE = 1000;
  43237. t.ordfeminine = 370;
  43238. t.Lslash = 556;
  43239. t.Oslash = 778;
  43240. t.OE = 1000;
  43241. t.ordmasculine = 365;
  43242. t.ae = 889;
  43243. t.dotlessi = 278;
  43244. t.lslash = 222;
  43245. t.oslash = 611;
  43246. t.oe = 944;
  43247. t.germandbls = 611;
  43248. t.Idieresis = 278;
  43249. t.eacute = 556;
  43250. t.abreve = 556;
  43251. t.uhungarumlaut = 556;
  43252. t.ecaron = 556;
  43253. t.Ydieresis = 667;
  43254. t.divide = 584;
  43255. t.Yacute = 667;
  43256. t.Acircumflex = 667;
  43257. t.aacute = 556;
  43258. t.Ucircumflex = 722;
  43259. t.yacute = 500;
  43260. t.scommaaccent = 500;
  43261. t.ecircumflex = 556;
  43262. t.Uring = 722;
  43263. t.Udieresis = 722;
  43264. t.aogonek = 556;
  43265. t.Uacute = 722;
  43266. t.uogonek = 556;
  43267. t.Edieresis = 667;
  43268. t.Dcroat = 722;
  43269. t.commaaccent = 250;
  43270. t.copyright = 737;
  43271. t.Emacron = 667;
  43272. t.ccaron = 500;
  43273. t.aring = 556;
  43274. t.Ncommaaccent = 722;
  43275. t.lacute = 222;
  43276. t.agrave = 556;
  43277. t.Tcommaaccent = 611;
  43278. t.Cacute = 722;
  43279. t.atilde = 556;
  43280. t.Edotaccent = 667;
  43281. t.scaron = 500;
  43282. t.scedilla = 500;
  43283. t.iacute = 278;
  43284. t.lozenge = 471;
  43285. t.Rcaron = 722;
  43286. t.Gcommaaccent = 778;
  43287. t.ucircumflex = 556;
  43288. t.acircumflex = 556;
  43289. t.Amacron = 667;
  43290. t.rcaron = 333;
  43291. t.ccedilla = 500;
  43292. t.Zdotaccent = 611;
  43293. t.Thorn = 667;
  43294. t.Omacron = 778;
  43295. t.Racute = 722;
  43296. t.Sacute = 667;
  43297. t.dcaron = 643;
  43298. t.Umacron = 722;
  43299. t.uring = 556;
  43300. t.threesuperior = 333;
  43301. t.Ograve = 778;
  43302. t.Agrave = 667;
  43303. t.Abreve = 667;
  43304. t.multiply = 584;
  43305. t.uacute = 556;
  43306. t.Tcaron = 611;
  43307. t.partialdiff = 476;
  43308. t.ydieresis = 500;
  43309. t.Nacute = 722;
  43310. t.icircumflex = 278;
  43311. t.Ecircumflex = 667;
  43312. t.adieresis = 556;
  43313. t.edieresis = 556;
  43314. t.cacute = 500;
  43315. t.nacute = 556;
  43316. t.umacron = 556;
  43317. t.Ncaron = 722;
  43318. t.Iacute = 278;
  43319. t.plusminus = 584;
  43320. t.brokenbar = 260;
  43321. t.registered = 737;
  43322. t.Gbreve = 778;
  43323. t.Idotaccent = 278;
  43324. t.summation = 600;
  43325. t.Egrave = 667;
  43326. t.racute = 333;
  43327. t.omacron = 556;
  43328. t.Zacute = 611;
  43329. t.Zcaron = 611;
  43330. t.greaterequal = 549;
  43331. t.Eth = 722;
  43332. t.Ccedilla = 722;
  43333. t.lcommaaccent = 222;
  43334. t.tcaron = 317;
  43335. t.eogonek = 556;
  43336. t.Uogonek = 722;
  43337. t.Aacute = 667;
  43338. t.Adieresis = 667;
  43339. t.egrave = 556;
  43340. t.zacute = 500;
  43341. t.iogonek = 222;
  43342. t.Oacute = 778;
  43343. t.oacute = 556;
  43344. t.amacron = 556;
  43345. t.sacute = 500;
  43346. t.idieresis = 278;
  43347. t.Ocircumflex = 778;
  43348. t.Ugrave = 722;
  43349. t.Delta = 612;
  43350. t.thorn = 556;
  43351. t.twosuperior = 333;
  43352. t.Odieresis = 778;
  43353. t.mu = 556;
  43354. t.igrave = 278;
  43355. t.ohungarumlaut = 556;
  43356. t.Eogonek = 667;
  43357. t.dcroat = 556;
  43358. t.threequarters = 834;
  43359. t.Scedilla = 667;
  43360. t.lcaron = 299;
  43361. t.Kcommaaccent = 667;
  43362. t.Lacute = 556;
  43363. t.trademark = 1000;
  43364. t.edotaccent = 556;
  43365. t.Igrave = 278;
  43366. t.Imacron = 278;
  43367. t.Lcaron = 556;
  43368. t.onehalf = 834;
  43369. t.lessequal = 549;
  43370. t.ocircumflex = 556;
  43371. t.ntilde = 556;
  43372. t.Uhungarumlaut = 722;
  43373. t.Eacute = 667;
  43374. t.emacron = 556;
  43375. t.gbreve = 556;
  43376. t.onequarter = 834;
  43377. t.Scaron = 667;
  43378. t.Scommaaccent = 667;
  43379. t.Ohungarumlaut = 778;
  43380. t.degree = 400;
  43381. t.ograve = 556;
  43382. t.Ccaron = 722;
  43383. t.ugrave = 556;
  43384. t.radical = 453;
  43385. t.Dcaron = 722;
  43386. t.rcommaaccent = 333;
  43387. t.Ntilde = 722;
  43388. t.otilde = 556;
  43389. t.Rcommaaccent = 722;
  43390. t.Lcommaaccent = 556;
  43391. t.Atilde = 667;
  43392. t.Aogonek = 667;
  43393. t.Aring = 667;
  43394. t.Otilde = 778;
  43395. t.zdotaccent = 500;
  43396. t.Ecaron = 667;
  43397. t.Iogonek = 278;
  43398. t.kcommaaccent = 500;
  43399. t.minus = 584;
  43400. t.Icircumflex = 278;
  43401. t.ncaron = 556;
  43402. t.tcommaaccent = 278;
  43403. t.logicalnot = 584;
  43404. t.odieresis = 556;
  43405. t.udieresis = 556;
  43406. t.notequal = 549;
  43407. t.gcommaaccent = 556;
  43408. t.eth = 556;
  43409. t.zcaron = 500;
  43410. t.ncommaaccent = 556;
  43411. t.onesuperior = 333;
  43412. t.imacron = 278;
  43413. t.Euro = 556;
  43414. });
  43415. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  43416. t.space = 250;
  43417. t.exclam = 333;
  43418. t.universal = 713;
  43419. t.numbersign = 500;
  43420. t.existential = 549;
  43421. t.percent = 833;
  43422. t.ampersand = 778;
  43423. t.suchthat = 439;
  43424. t.parenleft = 333;
  43425. t.parenright = 333;
  43426. t.asteriskmath = 500;
  43427. t.plus = 549;
  43428. t.comma = 250;
  43429. t.minus = 549;
  43430. t.period = 250;
  43431. t.slash = 278;
  43432. t.zero = 500;
  43433. t.one = 500;
  43434. t.two = 500;
  43435. t.three = 500;
  43436. t.four = 500;
  43437. t.five = 500;
  43438. t.six = 500;
  43439. t.seven = 500;
  43440. t.eight = 500;
  43441. t.nine = 500;
  43442. t.colon = 278;
  43443. t.semicolon = 278;
  43444. t.less = 549;
  43445. t.equal = 549;
  43446. t.greater = 549;
  43447. t.question = 444;
  43448. t.congruent = 549;
  43449. t.Alpha = 722;
  43450. t.Beta = 667;
  43451. t.Chi = 722;
  43452. t.Delta = 612;
  43453. t.Epsilon = 611;
  43454. t.Phi = 763;
  43455. t.Gamma = 603;
  43456. t.Eta = 722;
  43457. t.Iota = 333;
  43458. t.theta1 = 631;
  43459. t.Kappa = 722;
  43460. t.Lambda = 686;
  43461. t.Mu = 889;
  43462. t.Nu = 722;
  43463. t.Omicron = 722;
  43464. t.Pi = 768;
  43465. t.Theta = 741;
  43466. t.Rho = 556;
  43467. t.Sigma = 592;
  43468. t.Tau = 611;
  43469. t.Upsilon = 690;
  43470. t.sigma1 = 439;
  43471. t.Omega = 768;
  43472. t.Xi = 645;
  43473. t.Psi = 795;
  43474. t.Zeta = 611;
  43475. t.bracketleft = 333;
  43476. t.therefore = 863;
  43477. t.bracketright = 333;
  43478. t.perpendicular = 658;
  43479. t.underscore = 500;
  43480. t.radicalex = 500;
  43481. t.alpha = 631;
  43482. t.beta = 549;
  43483. t.chi = 549;
  43484. t.delta = 494;
  43485. t.epsilon = 439;
  43486. t.phi = 521;
  43487. t.gamma = 411;
  43488. t.eta = 603;
  43489. t.iota = 329;
  43490. t.phi1 = 603;
  43491. t.kappa = 549;
  43492. t.lambda = 549;
  43493. t.mu = 576;
  43494. t.nu = 521;
  43495. t.omicron = 549;
  43496. t.pi = 549;
  43497. t.theta = 521;
  43498. t.rho = 549;
  43499. t.sigma = 603;
  43500. t.tau = 439;
  43501. t.upsilon = 576;
  43502. t.omega1 = 713;
  43503. t.omega = 686;
  43504. t.xi = 493;
  43505. t.psi = 686;
  43506. t.zeta = 494;
  43507. t.braceleft = 480;
  43508. t.bar = 200;
  43509. t.braceright = 480;
  43510. t.similar = 549;
  43511. t.Euro = 750;
  43512. t.Upsilon1 = 620;
  43513. t.minute = 247;
  43514. t.lessequal = 549;
  43515. t.fraction = 167;
  43516. t.infinity = 713;
  43517. t.florin = 500;
  43518. t.club = 753;
  43519. t.diamond = 753;
  43520. t.heart = 753;
  43521. t.spade = 753;
  43522. t.arrowboth = 1042;
  43523. t.arrowleft = 987;
  43524. t.arrowup = 603;
  43525. t.arrowright = 987;
  43526. t.arrowdown = 603;
  43527. t.degree = 400;
  43528. t.plusminus = 549;
  43529. t.second = 411;
  43530. t.greaterequal = 549;
  43531. t.multiply = 549;
  43532. t.proportional = 713;
  43533. t.partialdiff = 494;
  43534. t.bullet = 460;
  43535. t.divide = 549;
  43536. t.notequal = 549;
  43537. t.equivalence = 549;
  43538. t.approxequal = 549;
  43539. t.ellipsis = 1000;
  43540. t.arrowvertex = 603;
  43541. t.arrowhorizex = 1000;
  43542. t.carriagereturn = 658;
  43543. t.aleph = 823;
  43544. t.Ifraktur = 686;
  43545. t.Rfraktur = 795;
  43546. t.weierstrass = 987;
  43547. t.circlemultiply = 768;
  43548. t.circleplus = 768;
  43549. t.emptyset = 823;
  43550. t.intersection = 768;
  43551. t.union = 768;
  43552. t.propersuperset = 713;
  43553. t.reflexsuperset = 713;
  43554. t.notsubset = 713;
  43555. t.propersubset = 713;
  43556. t.reflexsubset = 713;
  43557. t.element = 713;
  43558. t.notelement = 713;
  43559. t.angle = 768;
  43560. t.gradient = 713;
  43561. t.registerserif = 790;
  43562. t.copyrightserif = 790;
  43563. t.trademarkserif = 890;
  43564. t.product = 823;
  43565. t.radical = 549;
  43566. t.dotmath = 250;
  43567. t.logicalnot = 713;
  43568. t.logicaland = 603;
  43569. t.logicalor = 603;
  43570. t.arrowdblboth = 1042;
  43571. t.arrowdblleft = 987;
  43572. t.arrowdblup = 603;
  43573. t.arrowdblright = 987;
  43574. t.arrowdbldown = 603;
  43575. t.lozenge = 494;
  43576. t.angleleft = 329;
  43577. t.registersans = 790;
  43578. t.copyrightsans = 790;
  43579. t.trademarksans = 786;
  43580. t.summation = 713;
  43581. t.parenlefttp = 384;
  43582. t.parenleftex = 384;
  43583. t.parenleftbt = 384;
  43584. t.bracketlefttp = 384;
  43585. t.bracketleftex = 384;
  43586. t.bracketleftbt = 384;
  43587. t.bracelefttp = 494;
  43588. t.braceleftmid = 494;
  43589. t.braceleftbt = 494;
  43590. t.braceex = 494;
  43591. t.angleright = 329;
  43592. t.integral = 274;
  43593. t.integraltp = 686;
  43594. t.integralex = 686;
  43595. t.integralbt = 686;
  43596. t.parenrighttp = 384;
  43597. t.parenrightex = 384;
  43598. t.parenrightbt = 384;
  43599. t.bracketrighttp = 384;
  43600. t.bracketrightex = 384;
  43601. t.bracketrightbt = 384;
  43602. t.bracerighttp = 494;
  43603. t.bracerightmid = 494;
  43604. t.bracerightbt = 494;
  43605. t.apple = 790;
  43606. });
  43607. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43608. t.space = 250;
  43609. t.exclam = 333;
  43610. t.quotedbl = 408;
  43611. t.numbersign = 500;
  43612. t.dollar = 500;
  43613. t.percent = 833;
  43614. t.ampersand = 778;
  43615. t.quoteright = 333;
  43616. t.parenleft = 333;
  43617. t.parenright = 333;
  43618. t.asterisk = 500;
  43619. t.plus = 564;
  43620. t.comma = 250;
  43621. t.hyphen = 333;
  43622. t.period = 250;
  43623. t.slash = 278;
  43624. t.zero = 500;
  43625. t.one = 500;
  43626. t.two = 500;
  43627. t.three = 500;
  43628. t.four = 500;
  43629. t.five = 500;
  43630. t.six = 500;
  43631. t.seven = 500;
  43632. t.eight = 500;
  43633. t.nine = 500;
  43634. t.colon = 278;
  43635. t.semicolon = 278;
  43636. t.less = 564;
  43637. t.equal = 564;
  43638. t.greater = 564;
  43639. t.question = 444;
  43640. t.at = 921;
  43641. t.A = 722;
  43642. t.B = 667;
  43643. t.C = 667;
  43644. t.D = 722;
  43645. t.E = 611;
  43646. t.F = 556;
  43647. t.G = 722;
  43648. t.H = 722;
  43649. t.I = 333;
  43650. t.J = 389;
  43651. t.K = 722;
  43652. t.L = 611;
  43653. t.M = 889;
  43654. t.N = 722;
  43655. t.O = 722;
  43656. t.P = 556;
  43657. t.Q = 722;
  43658. t.R = 667;
  43659. t.S = 556;
  43660. t.T = 611;
  43661. t.U = 722;
  43662. t.V = 722;
  43663. t.W = 944;
  43664. t.X = 722;
  43665. t.Y = 722;
  43666. t.Z = 611;
  43667. t.bracketleft = 333;
  43668. t.backslash = 278;
  43669. t.bracketright = 333;
  43670. t.asciicircum = 469;
  43671. t.underscore = 500;
  43672. t.quoteleft = 333;
  43673. t.a = 444;
  43674. t.b = 500;
  43675. t.c = 444;
  43676. t.d = 500;
  43677. t.e = 444;
  43678. t.f = 333;
  43679. t.g = 500;
  43680. t.h = 500;
  43681. t.i = 278;
  43682. t.j = 278;
  43683. t.k = 500;
  43684. t.l = 278;
  43685. t.m = 778;
  43686. t.n = 500;
  43687. t.o = 500;
  43688. t.p = 500;
  43689. t.q = 500;
  43690. t.r = 333;
  43691. t.s = 389;
  43692. t.t = 278;
  43693. t.u = 500;
  43694. t.v = 500;
  43695. t.w = 722;
  43696. t.x = 500;
  43697. t.y = 500;
  43698. t.z = 444;
  43699. t.braceleft = 480;
  43700. t.bar = 200;
  43701. t.braceright = 480;
  43702. t.asciitilde = 541;
  43703. t.exclamdown = 333;
  43704. t.cent = 500;
  43705. t.sterling = 500;
  43706. t.fraction = 167;
  43707. t.yen = 500;
  43708. t.florin = 500;
  43709. t.section = 500;
  43710. t.currency = 500;
  43711. t.quotesingle = 180;
  43712. t.quotedblleft = 444;
  43713. t.guillemotleft = 500;
  43714. t.guilsinglleft = 333;
  43715. t.guilsinglright = 333;
  43716. t.fi = 556;
  43717. t.fl = 556;
  43718. t.endash = 500;
  43719. t.dagger = 500;
  43720. t.daggerdbl = 500;
  43721. t.periodcentered = 250;
  43722. t.paragraph = 453;
  43723. t.bullet = 350;
  43724. t.quotesinglbase = 333;
  43725. t.quotedblbase = 444;
  43726. t.quotedblright = 444;
  43727. t.guillemotright = 500;
  43728. t.ellipsis = 1000;
  43729. t.perthousand = 1000;
  43730. t.questiondown = 444;
  43731. t.grave = 333;
  43732. t.acute = 333;
  43733. t.circumflex = 333;
  43734. t.tilde = 333;
  43735. t.macron = 333;
  43736. t.breve = 333;
  43737. t.dotaccent = 333;
  43738. t.dieresis = 333;
  43739. t.ring = 333;
  43740. t.cedilla = 333;
  43741. t.hungarumlaut = 333;
  43742. t.ogonek = 333;
  43743. t.caron = 333;
  43744. t.emdash = 1000;
  43745. t.AE = 889;
  43746. t.ordfeminine = 276;
  43747. t.Lslash = 611;
  43748. t.Oslash = 722;
  43749. t.OE = 889;
  43750. t.ordmasculine = 310;
  43751. t.ae = 667;
  43752. t.dotlessi = 278;
  43753. t.lslash = 278;
  43754. t.oslash = 500;
  43755. t.oe = 722;
  43756. t.germandbls = 500;
  43757. t.Idieresis = 333;
  43758. t.eacute = 444;
  43759. t.abreve = 444;
  43760. t.uhungarumlaut = 500;
  43761. t.ecaron = 444;
  43762. t.Ydieresis = 722;
  43763. t.divide = 564;
  43764. t.Yacute = 722;
  43765. t.Acircumflex = 722;
  43766. t.aacute = 444;
  43767. t.Ucircumflex = 722;
  43768. t.yacute = 500;
  43769. t.scommaaccent = 389;
  43770. t.ecircumflex = 444;
  43771. t.Uring = 722;
  43772. t.Udieresis = 722;
  43773. t.aogonek = 444;
  43774. t.Uacute = 722;
  43775. t.uogonek = 500;
  43776. t.Edieresis = 611;
  43777. t.Dcroat = 722;
  43778. t.commaaccent = 250;
  43779. t.copyright = 760;
  43780. t.Emacron = 611;
  43781. t.ccaron = 444;
  43782. t.aring = 444;
  43783. t.Ncommaaccent = 722;
  43784. t.lacute = 278;
  43785. t.agrave = 444;
  43786. t.Tcommaaccent = 611;
  43787. t.Cacute = 667;
  43788. t.atilde = 444;
  43789. t.Edotaccent = 611;
  43790. t.scaron = 389;
  43791. t.scedilla = 389;
  43792. t.iacute = 278;
  43793. t.lozenge = 471;
  43794. t.Rcaron = 667;
  43795. t.Gcommaaccent = 722;
  43796. t.ucircumflex = 500;
  43797. t.acircumflex = 444;
  43798. t.Amacron = 722;
  43799. t.rcaron = 333;
  43800. t.ccedilla = 444;
  43801. t.Zdotaccent = 611;
  43802. t.Thorn = 556;
  43803. t.Omacron = 722;
  43804. t.Racute = 667;
  43805. t.Sacute = 556;
  43806. t.dcaron = 588;
  43807. t.Umacron = 722;
  43808. t.uring = 500;
  43809. t.threesuperior = 300;
  43810. t.Ograve = 722;
  43811. t.Agrave = 722;
  43812. t.Abreve = 722;
  43813. t.multiply = 564;
  43814. t.uacute = 500;
  43815. t.Tcaron = 611;
  43816. t.partialdiff = 476;
  43817. t.ydieresis = 500;
  43818. t.Nacute = 722;
  43819. t.icircumflex = 278;
  43820. t.Ecircumflex = 611;
  43821. t.adieresis = 444;
  43822. t.edieresis = 444;
  43823. t.cacute = 444;
  43824. t.nacute = 500;
  43825. t.umacron = 500;
  43826. t.Ncaron = 722;
  43827. t.Iacute = 333;
  43828. t.plusminus = 564;
  43829. t.brokenbar = 200;
  43830. t.registered = 760;
  43831. t.Gbreve = 722;
  43832. t.Idotaccent = 333;
  43833. t.summation = 600;
  43834. t.Egrave = 611;
  43835. t.racute = 333;
  43836. t.omacron = 500;
  43837. t.Zacute = 611;
  43838. t.Zcaron = 611;
  43839. t.greaterequal = 549;
  43840. t.Eth = 722;
  43841. t.Ccedilla = 667;
  43842. t.lcommaaccent = 278;
  43843. t.tcaron = 326;
  43844. t.eogonek = 444;
  43845. t.Uogonek = 722;
  43846. t.Aacute = 722;
  43847. t.Adieresis = 722;
  43848. t.egrave = 444;
  43849. t.zacute = 444;
  43850. t.iogonek = 278;
  43851. t.Oacute = 722;
  43852. t.oacute = 500;
  43853. t.amacron = 444;
  43854. t.sacute = 389;
  43855. t.idieresis = 278;
  43856. t.Ocircumflex = 722;
  43857. t.Ugrave = 722;
  43858. t.Delta = 612;
  43859. t.thorn = 500;
  43860. t.twosuperior = 300;
  43861. t.Odieresis = 722;
  43862. t.mu = 500;
  43863. t.igrave = 278;
  43864. t.ohungarumlaut = 500;
  43865. t.Eogonek = 611;
  43866. t.dcroat = 500;
  43867. t.threequarters = 750;
  43868. t.Scedilla = 556;
  43869. t.lcaron = 344;
  43870. t.Kcommaaccent = 722;
  43871. t.Lacute = 611;
  43872. t.trademark = 980;
  43873. t.edotaccent = 444;
  43874. t.Igrave = 333;
  43875. t.Imacron = 333;
  43876. t.Lcaron = 611;
  43877. t.onehalf = 750;
  43878. t.lessequal = 549;
  43879. t.ocircumflex = 500;
  43880. t.ntilde = 500;
  43881. t.Uhungarumlaut = 722;
  43882. t.Eacute = 611;
  43883. t.emacron = 444;
  43884. t.gbreve = 500;
  43885. t.onequarter = 750;
  43886. t.Scaron = 556;
  43887. t.Scommaaccent = 556;
  43888. t.Ohungarumlaut = 722;
  43889. t.degree = 400;
  43890. t.ograve = 500;
  43891. t.Ccaron = 667;
  43892. t.ugrave = 500;
  43893. t.radical = 453;
  43894. t.Dcaron = 722;
  43895. t.rcommaaccent = 333;
  43896. t.Ntilde = 722;
  43897. t.otilde = 500;
  43898. t.Rcommaaccent = 667;
  43899. t.Lcommaaccent = 611;
  43900. t.Atilde = 722;
  43901. t.Aogonek = 722;
  43902. t.Aring = 722;
  43903. t.Otilde = 722;
  43904. t.zdotaccent = 444;
  43905. t.Ecaron = 611;
  43906. t.Iogonek = 333;
  43907. t.kcommaaccent = 500;
  43908. t.minus = 564;
  43909. t.Icircumflex = 333;
  43910. t.ncaron = 500;
  43911. t.tcommaaccent = 278;
  43912. t.logicalnot = 564;
  43913. t.odieresis = 500;
  43914. t.udieresis = 500;
  43915. t.notequal = 549;
  43916. t.gcommaaccent = 500;
  43917. t.eth = 500;
  43918. t.zcaron = 444;
  43919. t.ncommaaccent = 500;
  43920. t.onesuperior = 300;
  43921. t.imacron = 278;
  43922. t.Euro = 500;
  43923. });
  43924. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43925. t.space = 250;
  43926. t.exclam = 333;
  43927. t.quotedbl = 555;
  43928. t.numbersign = 500;
  43929. t.dollar = 500;
  43930. t.percent = 1000;
  43931. t.ampersand = 833;
  43932. t.quoteright = 333;
  43933. t.parenleft = 333;
  43934. t.parenright = 333;
  43935. t.asterisk = 500;
  43936. t.plus = 570;
  43937. t.comma = 250;
  43938. t.hyphen = 333;
  43939. t.period = 250;
  43940. t.slash = 278;
  43941. t.zero = 500;
  43942. t.one = 500;
  43943. t.two = 500;
  43944. t.three = 500;
  43945. t.four = 500;
  43946. t.five = 500;
  43947. t.six = 500;
  43948. t.seven = 500;
  43949. t.eight = 500;
  43950. t.nine = 500;
  43951. t.colon = 333;
  43952. t.semicolon = 333;
  43953. t.less = 570;
  43954. t.equal = 570;
  43955. t.greater = 570;
  43956. t.question = 500;
  43957. t.at = 930;
  43958. t.A = 722;
  43959. t.B = 667;
  43960. t.C = 722;
  43961. t.D = 722;
  43962. t.E = 667;
  43963. t.F = 611;
  43964. t.G = 778;
  43965. t.H = 778;
  43966. t.I = 389;
  43967. t.J = 500;
  43968. t.K = 778;
  43969. t.L = 667;
  43970. t.M = 944;
  43971. t.N = 722;
  43972. t.O = 778;
  43973. t.P = 611;
  43974. t.Q = 778;
  43975. t.R = 722;
  43976. t.S = 556;
  43977. t.T = 667;
  43978. t.U = 722;
  43979. t.V = 722;
  43980. t.W = 1000;
  43981. t.X = 722;
  43982. t.Y = 722;
  43983. t.Z = 667;
  43984. t.bracketleft = 333;
  43985. t.backslash = 278;
  43986. t.bracketright = 333;
  43987. t.asciicircum = 581;
  43988. t.underscore = 500;
  43989. t.quoteleft = 333;
  43990. t.a = 500;
  43991. t.b = 556;
  43992. t.c = 444;
  43993. t.d = 556;
  43994. t.e = 444;
  43995. t.f = 333;
  43996. t.g = 500;
  43997. t.h = 556;
  43998. t.i = 278;
  43999. t.j = 333;
  44000. t.k = 556;
  44001. t.l = 278;
  44002. t.m = 833;
  44003. t.n = 556;
  44004. t.o = 500;
  44005. t.p = 556;
  44006. t.q = 556;
  44007. t.r = 444;
  44008. t.s = 389;
  44009. t.t = 333;
  44010. t.u = 556;
  44011. t.v = 500;
  44012. t.w = 722;
  44013. t.x = 500;
  44014. t.y = 500;
  44015. t.z = 444;
  44016. t.braceleft = 394;
  44017. t.bar = 220;
  44018. t.braceright = 394;
  44019. t.asciitilde = 520;
  44020. t.exclamdown = 333;
  44021. t.cent = 500;
  44022. t.sterling = 500;
  44023. t.fraction = 167;
  44024. t.yen = 500;
  44025. t.florin = 500;
  44026. t.section = 500;
  44027. t.currency = 500;
  44028. t.quotesingle = 278;
  44029. t.quotedblleft = 500;
  44030. t.guillemotleft = 500;
  44031. t.guilsinglleft = 333;
  44032. t.guilsinglright = 333;
  44033. t.fi = 556;
  44034. t.fl = 556;
  44035. t.endash = 500;
  44036. t.dagger = 500;
  44037. t.daggerdbl = 500;
  44038. t.periodcentered = 250;
  44039. t.paragraph = 540;
  44040. t.bullet = 350;
  44041. t.quotesinglbase = 333;
  44042. t.quotedblbase = 500;
  44043. t.quotedblright = 500;
  44044. t.guillemotright = 500;
  44045. t.ellipsis = 1000;
  44046. t.perthousand = 1000;
  44047. t.questiondown = 500;
  44048. t.grave = 333;
  44049. t.acute = 333;
  44050. t.circumflex = 333;
  44051. t.tilde = 333;
  44052. t.macron = 333;
  44053. t.breve = 333;
  44054. t.dotaccent = 333;
  44055. t.dieresis = 333;
  44056. t.ring = 333;
  44057. t.cedilla = 333;
  44058. t.hungarumlaut = 333;
  44059. t.ogonek = 333;
  44060. t.caron = 333;
  44061. t.emdash = 1000;
  44062. t.AE = 1000;
  44063. t.ordfeminine = 300;
  44064. t.Lslash = 667;
  44065. t.Oslash = 778;
  44066. t.OE = 1000;
  44067. t.ordmasculine = 330;
  44068. t.ae = 722;
  44069. t.dotlessi = 278;
  44070. t.lslash = 278;
  44071. t.oslash = 500;
  44072. t.oe = 722;
  44073. t.germandbls = 556;
  44074. t.Idieresis = 389;
  44075. t.eacute = 444;
  44076. t.abreve = 500;
  44077. t.uhungarumlaut = 556;
  44078. t.ecaron = 444;
  44079. t.Ydieresis = 722;
  44080. t.divide = 570;
  44081. t.Yacute = 722;
  44082. t.Acircumflex = 722;
  44083. t.aacute = 500;
  44084. t.Ucircumflex = 722;
  44085. t.yacute = 500;
  44086. t.scommaaccent = 389;
  44087. t.ecircumflex = 444;
  44088. t.Uring = 722;
  44089. t.Udieresis = 722;
  44090. t.aogonek = 500;
  44091. t.Uacute = 722;
  44092. t.uogonek = 556;
  44093. t.Edieresis = 667;
  44094. t.Dcroat = 722;
  44095. t.commaaccent = 250;
  44096. t.copyright = 747;
  44097. t.Emacron = 667;
  44098. t.ccaron = 444;
  44099. t.aring = 500;
  44100. t.Ncommaaccent = 722;
  44101. t.lacute = 278;
  44102. t.agrave = 500;
  44103. t.Tcommaaccent = 667;
  44104. t.Cacute = 722;
  44105. t.atilde = 500;
  44106. t.Edotaccent = 667;
  44107. t.scaron = 389;
  44108. t.scedilla = 389;
  44109. t.iacute = 278;
  44110. t.lozenge = 494;
  44111. t.Rcaron = 722;
  44112. t.Gcommaaccent = 778;
  44113. t.ucircumflex = 556;
  44114. t.acircumflex = 500;
  44115. t.Amacron = 722;
  44116. t.rcaron = 444;
  44117. t.ccedilla = 444;
  44118. t.Zdotaccent = 667;
  44119. t.Thorn = 611;
  44120. t.Omacron = 778;
  44121. t.Racute = 722;
  44122. t.Sacute = 556;
  44123. t.dcaron = 672;
  44124. t.Umacron = 722;
  44125. t.uring = 556;
  44126. t.threesuperior = 300;
  44127. t.Ograve = 778;
  44128. t.Agrave = 722;
  44129. t.Abreve = 722;
  44130. t.multiply = 570;
  44131. t.uacute = 556;
  44132. t.Tcaron = 667;
  44133. t.partialdiff = 494;
  44134. t.ydieresis = 500;
  44135. t.Nacute = 722;
  44136. t.icircumflex = 278;
  44137. t.Ecircumflex = 667;
  44138. t.adieresis = 500;
  44139. t.edieresis = 444;
  44140. t.cacute = 444;
  44141. t.nacute = 556;
  44142. t.umacron = 556;
  44143. t.Ncaron = 722;
  44144. t.Iacute = 389;
  44145. t.plusminus = 570;
  44146. t.brokenbar = 220;
  44147. t.registered = 747;
  44148. t.Gbreve = 778;
  44149. t.Idotaccent = 389;
  44150. t.summation = 600;
  44151. t.Egrave = 667;
  44152. t.racute = 444;
  44153. t.omacron = 500;
  44154. t.Zacute = 667;
  44155. t.Zcaron = 667;
  44156. t.greaterequal = 549;
  44157. t.Eth = 722;
  44158. t.Ccedilla = 722;
  44159. t.lcommaaccent = 278;
  44160. t.tcaron = 416;
  44161. t.eogonek = 444;
  44162. t.Uogonek = 722;
  44163. t.Aacute = 722;
  44164. t.Adieresis = 722;
  44165. t.egrave = 444;
  44166. t.zacute = 444;
  44167. t.iogonek = 278;
  44168. t.Oacute = 778;
  44169. t.oacute = 500;
  44170. t.amacron = 500;
  44171. t.sacute = 389;
  44172. t.idieresis = 278;
  44173. t.Ocircumflex = 778;
  44174. t.Ugrave = 722;
  44175. t.Delta = 612;
  44176. t.thorn = 556;
  44177. t.twosuperior = 300;
  44178. t.Odieresis = 778;
  44179. t.mu = 556;
  44180. t.igrave = 278;
  44181. t.ohungarumlaut = 500;
  44182. t.Eogonek = 667;
  44183. t.dcroat = 556;
  44184. t.threequarters = 750;
  44185. t.Scedilla = 556;
  44186. t.lcaron = 394;
  44187. t.Kcommaaccent = 778;
  44188. t.Lacute = 667;
  44189. t.trademark = 1000;
  44190. t.edotaccent = 444;
  44191. t.Igrave = 389;
  44192. t.Imacron = 389;
  44193. t.Lcaron = 667;
  44194. t.onehalf = 750;
  44195. t.lessequal = 549;
  44196. t.ocircumflex = 500;
  44197. t.ntilde = 556;
  44198. t.Uhungarumlaut = 722;
  44199. t.Eacute = 667;
  44200. t.emacron = 444;
  44201. t.gbreve = 500;
  44202. t.onequarter = 750;
  44203. t.Scaron = 556;
  44204. t.Scommaaccent = 556;
  44205. t.Ohungarumlaut = 778;
  44206. t.degree = 400;
  44207. t.ograve = 500;
  44208. t.Ccaron = 722;
  44209. t.ugrave = 556;
  44210. t.radical = 549;
  44211. t.Dcaron = 722;
  44212. t.rcommaaccent = 444;
  44213. t.Ntilde = 722;
  44214. t.otilde = 500;
  44215. t.Rcommaaccent = 722;
  44216. t.Lcommaaccent = 667;
  44217. t.Atilde = 722;
  44218. t.Aogonek = 722;
  44219. t.Aring = 722;
  44220. t.Otilde = 778;
  44221. t.zdotaccent = 444;
  44222. t.Ecaron = 667;
  44223. t.Iogonek = 389;
  44224. t.kcommaaccent = 556;
  44225. t.minus = 570;
  44226. t.Icircumflex = 389;
  44227. t.ncaron = 556;
  44228. t.tcommaaccent = 333;
  44229. t.logicalnot = 570;
  44230. t.odieresis = 500;
  44231. t.udieresis = 556;
  44232. t.notequal = 549;
  44233. t.gcommaaccent = 500;
  44234. t.eth = 500;
  44235. t.zcaron = 444;
  44236. t.ncommaaccent = 556;
  44237. t.onesuperior = 300;
  44238. t.imacron = 278;
  44239. t.Euro = 500;
  44240. });
  44241. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44242. t.space = 250;
  44243. t.exclam = 389;
  44244. t.quotedbl = 555;
  44245. t.numbersign = 500;
  44246. t.dollar = 500;
  44247. t.percent = 833;
  44248. t.ampersand = 778;
  44249. t.quoteright = 333;
  44250. t.parenleft = 333;
  44251. t.parenright = 333;
  44252. t.asterisk = 500;
  44253. t.plus = 570;
  44254. t.comma = 250;
  44255. t.hyphen = 333;
  44256. t.period = 250;
  44257. t.slash = 278;
  44258. t.zero = 500;
  44259. t.one = 500;
  44260. t.two = 500;
  44261. t.three = 500;
  44262. t.four = 500;
  44263. t.five = 500;
  44264. t.six = 500;
  44265. t.seven = 500;
  44266. t.eight = 500;
  44267. t.nine = 500;
  44268. t.colon = 333;
  44269. t.semicolon = 333;
  44270. t.less = 570;
  44271. t.equal = 570;
  44272. t.greater = 570;
  44273. t.question = 500;
  44274. t.at = 832;
  44275. t.A = 667;
  44276. t.B = 667;
  44277. t.C = 667;
  44278. t.D = 722;
  44279. t.E = 667;
  44280. t.F = 667;
  44281. t.G = 722;
  44282. t.H = 778;
  44283. t.I = 389;
  44284. t.J = 500;
  44285. t.K = 667;
  44286. t.L = 611;
  44287. t.M = 889;
  44288. t.N = 722;
  44289. t.O = 722;
  44290. t.P = 611;
  44291. t.Q = 722;
  44292. t.R = 667;
  44293. t.S = 556;
  44294. t.T = 611;
  44295. t.U = 722;
  44296. t.V = 667;
  44297. t.W = 889;
  44298. t.X = 667;
  44299. t.Y = 611;
  44300. t.Z = 611;
  44301. t.bracketleft = 333;
  44302. t.backslash = 278;
  44303. t.bracketright = 333;
  44304. t.asciicircum = 570;
  44305. t.underscore = 500;
  44306. t.quoteleft = 333;
  44307. t.a = 500;
  44308. t.b = 500;
  44309. t.c = 444;
  44310. t.d = 500;
  44311. t.e = 444;
  44312. t.f = 333;
  44313. t.g = 500;
  44314. t.h = 556;
  44315. t.i = 278;
  44316. t.j = 278;
  44317. t.k = 500;
  44318. t.l = 278;
  44319. t.m = 778;
  44320. t.n = 556;
  44321. t.o = 500;
  44322. t.p = 500;
  44323. t.q = 500;
  44324. t.r = 389;
  44325. t.s = 389;
  44326. t.t = 278;
  44327. t.u = 556;
  44328. t.v = 444;
  44329. t.w = 667;
  44330. t.x = 500;
  44331. t.y = 444;
  44332. t.z = 389;
  44333. t.braceleft = 348;
  44334. t.bar = 220;
  44335. t.braceright = 348;
  44336. t.asciitilde = 570;
  44337. t.exclamdown = 389;
  44338. t.cent = 500;
  44339. t.sterling = 500;
  44340. t.fraction = 167;
  44341. t.yen = 500;
  44342. t.florin = 500;
  44343. t.section = 500;
  44344. t.currency = 500;
  44345. t.quotesingle = 278;
  44346. t.quotedblleft = 500;
  44347. t.guillemotleft = 500;
  44348. t.guilsinglleft = 333;
  44349. t.guilsinglright = 333;
  44350. t.fi = 556;
  44351. t.fl = 556;
  44352. t.endash = 500;
  44353. t.dagger = 500;
  44354. t.daggerdbl = 500;
  44355. t.periodcentered = 250;
  44356. t.paragraph = 500;
  44357. t.bullet = 350;
  44358. t.quotesinglbase = 333;
  44359. t.quotedblbase = 500;
  44360. t.quotedblright = 500;
  44361. t.guillemotright = 500;
  44362. t.ellipsis = 1000;
  44363. t.perthousand = 1000;
  44364. t.questiondown = 500;
  44365. t.grave = 333;
  44366. t.acute = 333;
  44367. t.circumflex = 333;
  44368. t.tilde = 333;
  44369. t.macron = 333;
  44370. t.breve = 333;
  44371. t.dotaccent = 333;
  44372. t.dieresis = 333;
  44373. t.ring = 333;
  44374. t.cedilla = 333;
  44375. t.hungarumlaut = 333;
  44376. t.ogonek = 333;
  44377. t.caron = 333;
  44378. t.emdash = 1000;
  44379. t.AE = 944;
  44380. t.ordfeminine = 266;
  44381. t.Lslash = 611;
  44382. t.Oslash = 722;
  44383. t.OE = 944;
  44384. t.ordmasculine = 300;
  44385. t.ae = 722;
  44386. t.dotlessi = 278;
  44387. t.lslash = 278;
  44388. t.oslash = 500;
  44389. t.oe = 722;
  44390. t.germandbls = 500;
  44391. t.Idieresis = 389;
  44392. t.eacute = 444;
  44393. t.abreve = 500;
  44394. t.uhungarumlaut = 556;
  44395. t.ecaron = 444;
  44396. t.Ydieresis = 611;
  44397. t.divide = 570;
  44398. t.Yacute = 611;
  44399. t.Acircumflex = 667;
  44400. t.aacute = 500;
  44401. t.Ucircumflex = 722;
  44402. t.yacute = 444;
  44403. t.scommaaccent = 389;
  44404. t.ecircumflex = 444;
  44405. t.Uring = 722;
  44406. t.Udieresis = 722;
  44407. t.aogonek = 500;
  44408. t.Uacute = 722;
  44409. t.uogonek = 556;
  44410. t.Edieresis = 667;
  44411. t.Dcroat = 722;
  44412. t.commaaccent = 250;
  44413. t.copyright = 747;
  44414. t.Emacron = 667;
  44415. t.ccaron = 444;
  44416. t.aring = 500;
  44417. t.Ncommaaccent = 722;
  44418. t.lacute = 278;
  44419. t.agrave = 500;
  44420. t.Tcommaaccent = 611;
  44421. t.Cacute = 667;
  44422. t.atilde = 500;
  44423. t.Edotaccent = 667;
  44424. t.scaron = 389;
  44425. t.scedilla = 389;
  44426. t.iacute = 278;
  44427. t.lozenge = 494;
  44428. t.Rcaron = 667;
  44429. t.Gcommaaccent = 722;
  44430. t.ucircumflex = 556;
  44431. t.acircumflex = 500;
  44432. t.Amacron = 667;
  44433. t.rcaron = 389;
  44434. t.ccedilla = 444;
  44435. t.Zdotaccent = 611;
  44436. t.Thorn = 611;
  44437. t.Omacron = 722;
  44438. t.Racute = 667;
  44439. t.Sacute = 556;
  44440. t.dcaron = 608;
  44441. t.Umacron = 722;
  44442. t.uring = 556;
  44443. t.threesuperior = 300;
  44444. t.Ograve = 722;
  44445. t.Agrave = 667;
  44446. t.Abreve = 667;
  44447. t.multiply = 570;
  44448. t.uacute = 556;
  44449. t.Tcaron = 611;
  44450. t.partialdiff = 494;
  44451. t.ydieresis = 444;
  44452. t.Nacute = 722;
  44453. t.icircumflex = 278;
  44454. t.Ecircumflex = 667;
  44455. t.adieresis = 500;
  44456. t.edieresis = 444;
  44457. t.cacute = 444;
  44458. t.nacute = 556;
  44459. t.umacron = 556;
  44460. t.Ncaron = 722;
  44461. t.Iacute = 389;
  44462. t.plusminus = 570;
  44463. t.brokenbar = 220;
  44464. t.registered = 747;
  44465. t.Gbreve = 722;
  44466. t.Idotaccent = 389;
  44467. t.summation = 600;
  44468. t.Egrave = 667;
  44469. t.racute = 389;
  44470. t.omacron = 500;
  44471. t.Zacute = 611;
  44472. t.Zcaron = 611;
  44473. t.greaterequal = 549;
  44474. t.Eth = 722;
  44475. t.Ccedilla = 667;
  44476. t.lcommaaccent = 278;
  44477. t.tcaron = 366;
  44478. t.eogonek = 444;
  44479. t.Uogonek = 722;
  44480. t.Aacute = 667;
  44481. t.Adieresis = 667;
  44482. t.egrave = 444;
  44483. t.zacute = 389;
  44484. t.iogonek = 278;
  44485. t.Oacute = 722;
  44486. t.oacute = 500;
  44487. t.amacron = 500;
  44488. t.sacute = 389;
  44489. t.idieresis = 278;
  44490. t.Ocircumflex = 722;
  44491. t.Ugrave = 722;
  44492. t.Delta = 612;
  44493. t.thorn = 500;
  44494. t.twosuperior = 300;
  44495. t.Odieresis = 722;
  44496. t.mu = 576;
  44497. t.igrave = 278;
  44498. t.ohungarumlaut = 500;
  44499. t.Eogonek = 667;
  44500. t.dcroat = 500;
  44501. t.threequarters = 750;
  44502. t.Scedilla = 556;
  44503. t.lcaron = 382;
  44504. t.Kcommaaccent = 667;
  44505. t.Lacute = 611;
  44506. t.trademark = 1000;
  44507. t.edotaccent = 444;
  44508. t.Igrave = 389;
  44509. t.Imacron = 389;
  44510. t.Lcaron = 611;
  44511. t.onehalf = 750;
  44512. t.lessequal = 549;
  44513. t.ocircumflex = 500;
  44514. t.ntilde = 556;
  44515. t.Uhungarumlaut = 722;
  44516. t.Eacute = 667;
  44517. t.emacron = 444;
  44518. t.gbreve = 500;
  44519. t.onequarter = 750;
  44520. t.Scaron = 556;
  44521. t.Scommaaccent = 556;
  44522. t.Ohungarumlaut = 722;
  44523. t.degree = 400;
  44524. t.ograve = 500;
  44525. t.Ccaron = 667;
  44526. t.ugrave = 556;
  44527. t.radical = 549;
  44528. t.Dcaron = 722;
  44529. t.rcommaaccent = 389;
  44530. t.Ntilde = 722;
  44531. t.otilde = 500;
  44532. t.Rcommaaccent = 667;
  44533. t.Lcommaaccent = 611;
  44534. t.Atilde = 667;
  44535. t.Aogonek = 667;
  44536. t.Aring = 667;
  44537. t.Otilde = 722;
  44538. t.zdotaccent = 389;
  44539. t.Ecaron = 667;
  44540. t.Iogonek = 389;
  44541. t.kcommaaccent = 500;
  44542. t.minus = 606;
  44543. t.Icircumflex = 389;
  44544. t.ncaron = 556;
  44545. t.tcommaaccent = 278;
  44546. t.logicalnot = 606;
  44547. t.odieresis = 500;
  44548. t.udieresis = 556;
  44549. t.notequal = 549;
  44550. t.gcommaaccent = 500;
  44551. t.eth = 500;
  44552. t.zcaron = 389;
  44553. t.ncommaaccent = 556;
  44554. t.onesuperior = 300;
  44555. t.imacron = 278;
  44556. t.Euro = 500;
  44557. });
  44558. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44559. t.space = 250;
  44560. t.exclam = 333;
  44561. t.quotedbl = 420;
  44562. t.numbersign = 500;
  44563. t.dollar = 500;
  44564. t.percent = 833;
  44565. t.ampersand = 778;
  44566. t.quoteright = 333;
  44567. t.parenleft = 333;
  44568. t.parenright = 333;
  44569. t.asterisk = 500;
  44570. t.plus = 675;
  44571. t.comma = 250;
  44572. t.hyphen = 333;
  44573. t.period = 250;
  44574. t.slash = 278;
  44575. t.zero = 500;
  44576. t.one = 500;
  44577. t.two = 500;
  44578. t.three = 500;
  44579. t.four = 500;
  44580. t.five = 500;
  44581. t.six = 500;
  44582. t.seven = 500;
  44583. t.eight = 500;
  44584. t.nine = 500;
  44585. t.colon = 333;
  44586. t.semicolon = 333;
  44587. t.less = 675;
  44588. t.equal = 675;
  44589. t.greater = 675;
  44590. t.question = 500;
  44591. t.at = 920;
  44592. t.A = 611;
  44593. t.B = 611;
  44594. t.C = 667;
  44595. t.D = 722;
  44596. t.E = 611;
  44597. t.F = 611;
  44598. t.G = 722;
  44599. t.H = 722;
  44600. t.I = 333;
  44601. t.J = 444;
  44602. t.K = 667;
  44603. t.L = 556;
  44604. t.M = 833;
  44605. t.N = 667;
  44606. t.O = 722;
  44607. t.P = 611;
  44608. t.Q = 722;
  44609. t.R = 611;
  44610. t.S = 500;
  44611. t.T = 556;
  44612. t.U = 722;
  44613. t.V = 611;
  44614. t.W = 833;
  44615. t.X = 611;
  44616. t.Y = 556;
  44617. t.Z = 556;
  44618. t.bracketleft = 389;
  44619. t.backslash = 278;
  44620. t.bracketright = 389;
  44621. t.asciicircum = 422;
  44622. t.underscore = 500;
  44623. t.quoteleft = 333;
  44624. t.a = 500;
  44625. t.b = 500;
  44626. t.c = 444;
  44627. t.d = 500;
  44628. t.e = 444;
  44629. t.f = 278;
  44630. t.g = 500;
  44631. t.h = 500;
  44632. t.i = 278;
  44633. t.j = 278;
  44634. t.k = 444;
  44635. t.l = 278;
  44636. t.m = 722;
  44637. t.n = 500;
  44638. t.o = 500;
  44639. t.p = 500;
  44640. t.q = 500;
  44641. t.r = 389;
  44642. t.s = 389;
  44643. t.t = 278;
  44644. t.u = 500;
  44645. t.v = 444;
  44646. t.w = 667;
  44647. t.x = 444;
  44648. t.y = 444;
  44649. t.z = 389;
  44650. t.braceleft = 400;
  44651. t.bar = 275;
  44652. t.braceright = 400;
  44653. t.asciitilde = 541;
  44654. t.exclamdown = 389;
  44655. t.cent = 500;
  44656. t.sterling = 500;
  44657. t.fraction = 167;
  44658. t.yen = 500;
  44659. t.florin = 500;
  44660. t.section = 500;
  44661. t.currency = 500;
  44662. t.quotesingle = 214;
  44663. t.quotedblleft = 556;
  44664. t.guillemotleft = 500;
  44665. t.guilsinglleft = 333;
  44666. t.guilsinglright = 333;
  44667. t.fi = 500;
  44668. t.fl = 500;
  44669. t.endash = 500;
  44670. t.dagger = 500;
  44671. t.daggerdbl = 500;
  44672. t.periodcentered = 250;
  44673. t.paragraph = 523;
  44674. t.bullet = 350;
  44675. t.quotesinglbase = 333;
  44676. t.quotedblbase = 556;
  44677. t.quotedblright = 556;
  44678. t.guillemotright = 500;
  44679. t.ellipsis = 889;
  44680. t.perthousand = 1000;
  44681. t.questiondown = 500;
  44682. t.grave = 333;
  44683. t.acute = 333;
  44684. t.circumflex = 333;
  44685. t.tilde = 333;
  44686. t.macron = 333;
  44687. t.breve = 333;
  44688. t.dotaccent = 333;
  44689. t.dieresis = 333;
  44690. t.ring = 333;
  44691. t.cedilla = 333;
  44692. t.hungarumlaut = 333;
  44693. t.ogonek = 333;
  44694. t.caron = 333;
  44695. t.emdash = 889;
  44696. t.AE = 889;
  44697. t.ordfeminine = 276;
  44698. t.Lslash = 556;
  44699. t.Oslash = 722;
  44700. t.OE = 944;
  44701. t.ordmasculine = 310;
  44702. t.ae = 667;
  44703. t.dotlessi = 278;
  44704. t.lslash = 278;
  44705. t.oslash = 500;
  44706. t.oe = 667;
  44707. t.germandbls = 500;
  44708. t.Idieresis = 333;
  44709. t.eacute = 444;
  44710. t.abreve = 500;
  44711. t.uhungarumlaut = 500;
  44712. t.ecaron = 444;
  44713. t.Ydieresis = 556;
  44714. t.divide = 675;
  44715. t.Yacute = 556;
  44716. t.Acircumflex = 611;
  44717. t.aacute = 500;
  44718. t.Ucircumflex = 722;
  44719. t.yacute = 444;
  44720. t.scommaaccent = 389;
  44721. t.ecircumflex = 444;
  44722. t.Uring = 722;
  44723. t.Udieresis = 722;
  44724. t.aogonek = 500;
  44725. t.Uacute = 722;
  44726. t.uogonek = 500;
  44727. t.Edieresis = 611;
  44728. t.Dcroat = 722;
  44729. t.commaaccent = 250;
  44730. t.copyright = 760;
  44731. t.Emacron = 611;
  44732. t.ccaron = 444;
  44733. t.aring = 500;
  44734. t.Ncommaaccent = 667;
  44735. t.lacute = 278;
  44736. t.agrave = 500;
  44737. t.Tcommaaccent = 556;
  44738. t.Cacute = 667;
  44739. t.atilde = 500;
  44740. t.Edotaccent = 611;
  44741. t.scaron = 389;
  44742. t.scedilla = 389;
  44743. t.iacute = 278;
  44744. t.lozenge = 471;
  44745. t.Rcaron = 611;
  44746. t.Gcommaaccent = 722;
  44747. t.ucircumflex = 500;
  44748. t.acircumflex = 500;
  44749. t.Amacron = 611;
  44750. t.rcaron = 389;
  44751. t.ccedilla = 444;
  44752. t.Zdotaccent = 556;
  44753. t.Thorn = 611;
  44754. t.Omacron = 722;
  44755. t.Racute = 611;
  44756. t.Sacute = 500;
  44757. t.dcaron = 544;
  44758. t.Umacron = 722;
  44759. t.uring = 500;
  44760. t.threesuperior = 300;
  44761. t.Ograve = 722;
  44762. t.Agrave = 611;
  44763. t.Abreve = 611;
  44764. t.multiply = 675;
  44765. t.uacute = 500;
  44766. t.Tcaron = 556;
  44767. t.partialdiff = 476;
  44768. t.ydieresis = 444;
  44769. t.Nacute = 667;
  44770. t.icircumflex = 278;
  44771. t.Ecircumflex = 611;
  44772. t.adieresis = 500;
  44773. t.edieresis = 444;
  44774. t.cacute = 444;
  44775. t.nacute = 500;
  44776. t.umacron = 500;
  44777. t.Ncaron = 667;
  44778. t.Iacute = 333;
  44779. t.plusminus = 675;
  44780. t.brokenbar = 275;
  44781. t.registered = 760;
  44782. t.Gbreve = 722;
  44783. t.Idotaccent = 333;
  44784. t.summation = 600;
  44785. t.Egrave = 611;
  44786. t.racute = 389;
  44787. t.omacron = 500;
  44788. t.Zacute = 556;
  44789. t.Zcaron = 556;
  44790. t.greaterequal = 549;
  44791. t.Eth = 722;
  44792. t.Ccedilla = 667;
  44793. t.lcommaaccent = 278;
  44794. t.tcaron = 300;
  44795. t.eogonek = 444;
  44796. t.Uogonek = 722;
  44797. t.Aacute = 611;
  44798. t.Adieresis = 611;
  44799. t.egrave = 444;
  44800. t.zacute = 389;
  44801. t.iogonek = 278;
  44802. t.Oacute = 722;
  44803. t.oacute = 500;
  44804. t.amacron = 500;
  44805. t.sacute = 389;
  44806. t.idieresis = 278;
  44807. t.Ocircumflex = 722;
  44808. t.Ugrave = 722;
  44809. t.Delta = 612;
  44810. t.thorn = 500;
  44811. t.twosuperior = 300;
  44812. t.Odieresis = 722;
  44813. t.mu = 500;
  44814. t.igrave = 278;
  44815. t.ohungarumlaut = 500;
  44816. t.Eogonek = 611;
  44817. t.dcroat = 500;
  44818. t.threequarters = 750;
  44819. t.Scedilla = 500;
  44820. t.lcaron = 300;
  44821. t.Kcommaaccent = 667;
  44822. t.Lacute = 556;
  44823. t.trademark = 980;
  44824. t.edotaccent = 444;
  44825. t.Igrave = 333;
  44826. t.Imacron = 333;
  44827. t.Lcaron = 611;
  44828. t.onehalf = 750;
  44829. t.lessequal = 549;
  44830. t.ocircumflex = 500;
  44831. t.ntilde = 500;
  44832. t.Uhungarumlaut = 722;
  44833. t.Eacute = 611;
  44834. t.emacron = 444;
  44835. t.gbreve = 500;
  44836. t.onequarter = 750;
  44837. t.Scaron = 500;
  44838. t.Scommaaccent = 500;
  44839. t.Ohungarumlaut = 722;
  44840. t.degree = 400;
  44841. t.ograve = 500;
  44842. t.Ccaron = 667;
  44843. t.ugrave = 500;
  44844. t.radical = 453;
  44845. t.Dcaron = 722;
  44846. t.rcommaaccent = 389;
  44847. t.Ntilde = 667;
  44848. t.otilde = 500;
  44849. t.Rcommaaccent = 611;
  44850. t.Lcommaaccent = 556;
  44851. t.Atilde = 611;
  44852. t.Aogonek = 611;
  44853. t.Aring = 611;
  44854. t.Otilde = 722;
  44855. t.zdotaccent = 389;
  44856. t.Ecaron = 611;
  44857. t.Iogonek = 333;
  44858. t.kcommaaccent = 444;
  44859. t.minus = 675;
  44860. t.Icircumflex = 333;
  44861. t.ncaron = 500;
  44862. t.tcommaaccent = 278;
  44863. t.logicalnot = 675;
  44864. t.odieresis = 500;
  44865. t.udieresis = 500;
  44866. t.notequal = 549;
  44867. t.gcommaaccent = 500;
  44868. t.eth = 500;
  44869. t.zcaron = 389;
  44870. t.ncommaaccent = 500;
  44871. t.onesuperior = 300;
  44872. t.imacron = 278;
  44873. t.Euro = 500;
  44874. });
  44875. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  44876. t.space = 278;
  44877. t.a1 = 974;
  44878. t.a2 = 961;
  44879. t.a202 = 974;
  44880. t.a3 = 980;
  44881. t.a4 = 719;
  44882. t.a5 = 789;
  44883. t.a119 = 790;
  44884. t.a118 = 791;
  44885. t.a117 = 690;
  44886. t.a11 = 960;
  44887. t.a12 = 939;
  44888. t.a13 = 549;
  44889. t.a14 = 855;
  44890. t.a15 = 911;
  44891. t.a16 = 933;
  44892. t.a105 = 911;
  44893. t.a17 = 945;
  44894. t.a18 = 974;
  44895. t.a19 = 755;
  44896. t.a20 = 846;
  44897. t.a21 = 762;
  44898. t.a22 = 761;
  44899. t.a23 = 571;
  44900. t.a24 = 677;
  44901. t.a25 = 763;
  44902. t.a26 = 760;
  44903. t.a27 = 759;
  44904. t.a28 = 754;
  44905. t.a6 = 494;
  44906. t.a7 = 552;
  44907. t.a8 = 537;
  44908. t.a9 = 577;
  44909. t.a10 = 692;
  44910. t.a29 = 786;
  44911. t.a30 = 788;
  44912. t.a31 = 788;
  44913. t.a32 = 790;
  44914. t.a33 = 793;
  44915. t.a34 = 794;
  44916. t.a35 = 816;
  44917. t.a36 = 823;
  44918. t.a37 = 789;
  44919. t.a38 = 841;
  44920. t.a39 = 823;
  44921. t.a40 = 833;
  44922. t.a41 = 816;
  44923. t.a42 = 831;
  44924. t.a43 = 923;
  44925. t.a44 = 744;
  44926. t.a45 = 723;
  44927. t.a46 = 749;
  44928. t.a47 = 790;
  44929. t.a48 = 792;
  44930. t.a49 = 695;
  44931. t.a50 = 776;
  44932. t.a51 = 768;
  44933. t.a52 = 792;
  44934. t.a53 = 759;
  44935. t.a54 = 707;
  44936. t.a55 = 708;
  44937. t.a56 = 682;
  44938. t.a57 = 701;
  44939. t.a58 = 826;
  44940. t.a59 = 815;
  44941. t.a60 = 789;
  44942. t.a61 = 789;
  44943. t.a62 = 707;
  44944. t.a63 = 687;
  44945. t.a64 = 696;
  44946. t.a65 = 689;
  44947. t.a66 = 786;
  44948. t.a67 = 787;
  44949. t.a68 = 713;
  44950. t.a69 = 791;
  44951. t.a70 = 785;
  44952. t.a71 = 791;
  44953. t.a72 = 873;
  44954. t.a73 = 761;
  44955. t.a74 = 762;
  44956. t.a203 = 762;
  44957. t.a75 = 759;
  44958. t.a204 = 759;
  44959. t.a76 = 892;
  44960. t.a77 = 892;
  44961. t.a78 = 788;
  44962. t.a79 = 784;
  44963. t.a81 = 438;
  44964. t.a82 = 138;
  44965. t.a83 = 277;
  44966. t.a84 = 415;
  44967. t.a97 = 392;
  44968. t.a98 = 392;
  44969. t.a99 = 668;
  44970. t.a100 = 668;
  44971. t.a89 = 390;
  44972. t.a90 = 390;
  44973. t.a93 = 317;
  44974. t.a94 = 317;
  44975. t.a91 = 276;
  44976. t.a92 = 276;
  44977. t.a205 = 509;
  44978. t.a85 = 509;
  44979. t.a206 = 410;
  44980. t.a86 = 410;
  44981. t.a87 = 234;
  44982. t.a88 = 234;
  44983. t.a95 = 334;
  44984. t.a96 = 334;
  44985. t.a101 = 732;
  44986. t.a102 = 544;
  44987. t.a103 = 544;
  44988. t.a104 = 910;
  44989. t.a106 = 667;
  44990. t.a107 = 760;
  44991. t.a108 = 760;
  44992. t.a112 = 776;
  44993. t.a111 = 595;
  44994. t.a110 = 694;
  44995. t.a109 = 626;
  44996. t.a120 = 788;
  44997. t.a121 = 788;
  44998. t.a122 = 788;
  44999. t.a123 = 788;
  45000. t.a124 = 788;
  45001. t.a125 = 788;
  45002. t.a126 = 788;
  45003. t.a127 = 788;
  45004. t.a128 = 788;
  45005. t.a129 = 788;
  45006. t.a130 = 788;
  45007. t.a131 = 788;
  45008. t.a132 = 788;
  45009. t.a133 = 788;
  45010. t.a134 = 788;
  45011. t.a135 = 788;
  45012. t.a136 = 788;
  45013. t.a137 = 788;
  45014. t.a138 = 788;
  45015. t.a139 = 788;
  45016. t.a140 = 788;
  45017. t.a141 = 788;
  45018. t.a142 = 788;
  45019. t.a143 = 788;
  45020. t.a144 = 788;
  45021. t.a145 = 788;
  45022. t.a146 = 788;
  45023. t.a147 = 788;
  45024. t.a148 = 788;
  45025. t.a149 = 788;
  45026. t.a150 = 788;
  45027. t.a151 = 788;
  45028. t.a152 = 788;
  45029. t.a153 = 788;
  45030. t.a154 = 788;
  45031. t.a155 = 788;
  45032. t.a156 = 788;
  45033. t.a157 = 788;
  45034. t.a158 = 788;
  45035. t.a159 = 788;
  45036. t.a160 = 894;
  45037. t.a161 = 838;
  45038. t.a163 = 1016;
  45039. t.a164 = 458;
  45040. t.a196 = 748;
  45041. t.a165 = 924;
  45042. t.a192 = 748;
  45043. t.a166 = 918;
  45044. t.a167 = 927;
  45045. t.a168 = 928;
  45046. t.a169 = 928;
  45047. t.a170 = 834;
  45048. t.a171 = 873;
  45049. t.a172 = 828;
  45050. t.a173 = 924;
  45051. t.a162 = 924;
  45052. t.a174 = 917;
  45053. t.a175 = 930;
  45054. t.a176 = 931;
  45055. t.a177 = 463;
  45056. t.a178 = 883;
  45057. t.a179 = 836;
  45058. t.a193 = 836;
  45059. t.a180 = 867;
  45060. t.a199 = 867;
  45061. t.a181 = 696;
  45062. t.a200 = 696;
  45063. t.a182 = 874;
  45064. t.a201 = 874;
  45065. t.a183 = 760;
  45066. t.a184 = 946;
  45067. t.a197 = 771;
  45068. t.a185 = 865;
  45069. t.a194 = 771;
  45070. t.a198 = 888;
  45071. t.a186 = 967;
  45072. t.a195 = 888;
  45073. t.a187 = 831;
  45074. t.a188 = 873;
  45075. t.a189 = 927;
  45076. t.a190 = 970;
  45077. t.a191 = 918;
  45078. });
  45079. });
  45080. exports.getMetrics = getMetrics;
  45081. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  45082. t.Courier = {
  45083. ascent: 629,
  45084. descent: -157,
  45085. capHeight: 562,
  45086. xHeight: -426
  45087. };
  45088. t["Courier-Bold"] = {
  45089. ascent: 629,
  45090. descent: -157,
  45091. capHeight: 562,
  45092. xHeight: 439
  45093. };
  45094. t["Courier-Oblique"] = {
  45095. ascent: 629,
  45096. descent: -157,
  45097. capHeight: 562,
  45098. xHeight: 426
  45099. };
  45100. t["Courier-BoldOblique"] = {
  45101. ascent: 629,
  45102. descent: -157,
  45103. capHeight: 562,
  45104. xHeight: 426
  45105. };
  45106. t.Helvetica = {
  45107. ascent: 718,
  45108. descent: -207,
  45109. capHeight: 718,
  45110. xHeight: 523
  45111. };
  45112. t["Helvetica-Bold"] = {
  45113. ascent: 718,
  45114. descent: -207,
  45115. capHeight: 718,
  45116. xHeight: 532
  45117. };
  45118. t["Helvetica-Oblique"] = {
  45119. ascent: 718,
  45120. descent: -207,
  45121. capHeight: 718,
  45122. xHeight: 523
  45123. };
  45124. t["Helvetica-BoldOblique"] = {
  45125. ascent: 718,
  45126. descent: -207,
  45127. capHeight: 718,
  45128. xHeight: 532
  45129. };
  45130. t["Times-Roman"] = {
  45131. ascent: 683,
  45132. descent: -217,
  45133. capHeight: 662,
  45134. xHeight: 450
  45135. };
  45136. t["Times-Bold"] = {
  45137. ascent: 683,
  45138. descent: -217,
  45139. capHeight: 676,
  45140. xHeight: 461
  45141. };
  45142. t["Times-Italic"] = {
  45143. ascent: 683,
  45144. descent: -217,
  45145. capHeight: 653,
  45146. xHeight: 441
  45147. };
  45148. t["Times-BoldItalic"] = {
  45149. ascent: 683,
  45150. descent: -217,
  45151. capHeight: 669,
  45152. xHeight: 462
  45153. };
  45154. t.Symbol = {
  45155. ascent: Math.NaN,
  45156. descent: Math.NaN,
  45157. capHeight: Math.NaN,
  45158. xHeight: Math.NaN
  45159. };
  45160. t.ZapfDingbats = {
  45161. ascent: Math.NaN,
  45162. descent: Math.NaN,
  45163. capHeight: Math.NaN,
  45164. xHeight: Math.NaN
  45165. };
  45166. });
  45167. exports.getFontBasicMetrics = getFontBasicMetrics;
  45168. /***/ }),
  45169. /* 175 */
  45170. /***/ ((__unused_webpack_module, exports) => {
  45171. "use strict";
  45172. Object.defineProperty(exports, "__esModule", ({
  45173. value: true
  45174. }));
  45175. exports.GlyfTable = void 0;
  45176. const ON_CURVE_POINT = 1 << 0;
  45177. const X_SHORT_VECTOR = 1 << 1;
  45178. const Y_SHORT_VECTOR = 1 << 2;
  45179. const REPEAT_FLAG = 1 << 3;
  45180. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  45181. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  45182. const OVERLAP_SIMPLE = 1 << 6;
  45183. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  45184. const ARGS_ARE_XY_VALUES = 1 << 1;
  45185. const WE_HAVE_A_SCALE = 1 << 3;
  45186. const MORE_COMPONENTS = 1 << 5;
  45187. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  45188. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  45189. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  45190. class GlyfTable {
  45191. constructor(_ref) {
  45192. let {
  45193. glyfTable,
  45194. isGlyphLocationsLong,
  45195. locaTable,
  45196. numGlyphs
  45197. } = _ref;
  45198. this.glyphs = [];
  45199. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  45200. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  45201. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  45202. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  45203. let pos = 0;
  45204. for (let i = 0; i < numGlyphs; i++) {
  45205. pos += offsetSize;
  45206. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  45207. if (next === prev) {
  45208. this.glyphs.push(new Glyph({}));
  45209. continue;
  45210. }
  45211. const glyph = Glyph.parse(prev, glyf);
  45212. this.glyphs.push(glyph);
  45213. prev = next;
  45214. }
  45215. }
  45216. getSize() {
  45217. return this.glyphs.reduce((a, g) => {
  45218. const size = g.getSize();
  45219. return a + (size + 3 & ~3);
  45220. }, 0);
  45221. }
  45222. write() {
  45223. const totalSize = this.getSize();
  45224. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  45225. const isLocationLong = totalSize > 0x1fffe;
  45226. const offsetSize = isLocationLong ? 4 : 2;
  45227. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  45228. if (isLocationLong) {
  45229. locaTable.setUint32(0, 0);
  45230. } else {
  45231. locaTable.setUint16(0, 0);
  45232. }
  45233. let pos = 0;
  45234. let locaIndex = 0;
  45235. for (const glyph of this.glyphs) {
  45236. pos += glyph.write(pos, glyfTable);
  45237. pos = pos + 3 & ~3;
  45238. locaIndex += offsetSize;
  45239. if (isLocationLong) {
  45240. locaTable.setUint32(locaIndex, pos);
  45241. } else {
  45242. locaTable.setUint16(locaIndex, pos >> 1);
  45243. }
  45244. }
  45245. return {
  45246. isLocationLong,
  45247. loca: new Uint8Array(locaTable.buffer),
  45248. glyf: new Uint8Array(glyfTable.buffer)
  45249. };
  45250. }
  45251. scale(factors) {
  45252. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  45253. this.glyphs[i].scale(factors[i]);
  45254. }
  45255. }
  45256. }
  45257. exports.GlyfTable = GlyfTable;
  45258. class Glyph {
  45259. constructor(_ref2) {
  45260. let {
  45261. header = null,
  45262. simple = null,
  45263. composites = null
  45264. } = _ref2;
  45265. this.header = header;
  45266. this.simple = simple;
  45267. this.composites = composites;
  45268. }
  45269. static parse(pos, glyf) {
  45270. const [read, header] = GlyphHeader.parse(pos, glyf);
  45271. pos += read;
  45272. if (header.numberOfContours < 0) {
  45273. const composites = [];
  45274. while (true) {
  45275. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  45276. pos += n;
  45277. composites.push(composite);
  45278. if (!(composite.flags & MORE_COMPONENTS)) {
  45279. break;
  45280. }
  45281. }
  45282. return new Glyph({
  45283. header,
  45284. composites
  45285. });
  45286. }
  45287. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  45288. return new Glyph({
  45289. header,
  45290. simple
  45291. });
  45292. }
  45293. getSize() {
  45294. if (!this.header) {
  45295. return 0;
  45296. }
  45297. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  45298. return this.header.getSize() + size;
  45299. }
  45300. write(pos, buf) {
  45301. if (!this.header) {
  45302. return 0;
  45303. }
  45304. const spos = pos;
  45305. pos += this.header.write(pos, buf);
  45306. if (this.simple) {
  45307. pos += this.simple.write(pos, buf);
  45308. } else {
  45309. for (const composite of this.composites) {
  45310. pos += composite.write(pos, buf);
  45311. }
  45312. }
  45313. return pos - spos;
  45314. }
  45315. scale(factor) {
  45316. if (!this.header) {
  45317. return;
  45318. }
  45319. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  45320. this.header.scale(xMiddle, factor);
  45321. if (this.simple) {
  45322. this.simple.scale(xMiddle, factor);
  45323. } else {
  45324. for (const composite of this.composites) {
  45325. composite.scale(xMiddle, factor);
  45326. }
  45327. }
  45328. }
  45329. }
  45330. class GlyphHeader {
  45331. constructor(_ref3) {
  45332. let {
  45333. numberOfContours,
  45334. xMin,
  45335. yMin,
  45336. xMax,
  45337. yMax
  45338. } = _ref3;
  45339. this.numberOfContours = numberOfContours;
  45340. this.xMin = xMin;
  45341. this.yMin = yMin;
  45342. this.xMax = xMax;
  45343. this.yMax = yMax;
  45344. }
  45345. static parse(pos, glyf) {
  45346. return [10, new GlyphHeader({
  45347. numberOfContours: glyf.getInt16(pos),
  45348. xMin: glyf.getInt16(pos + 2),
  45349. yMin: glyf.getInt16(pos + 4),
  45350. xMax: glyf.getInt16(pos + 6),
  45351. yMax: glyf.getInt16(pos + 8)
  45352. })];
  45353. }
  45354. getSize() {
  45355. return 10;
  45356. }
  45357. write(pos, buf) {
  45358. buf.setInt16(pos, this.numberOfContours);
  45359. buf.setInt16(pos + 2, this.xMin);
  45360. buf.setInt16(pos + 4, this.yMin);
  45361. buf.setInt16(pos + 6, this.xMax);
  45362. buf.setInt16(pos + 8, this.yMax);
  45363. return 10;
  45364. }
  45365. scale(x, factor) {
  45366. this.xMin = Math.round(x + (this.xMin - x) * factor);
  45367. this.xMax = Math.round(x + (this.xMax - x) * factor);
  45368. }
  45369. }
  45370. class Contour {
  45371. constructor(_ref4) {
  45372. let {
  45373. flags,
  45374. xCoordinates,
  45375. yCoordinates
  45376. } = _ref4;
  45377. this.xCoordinates = xCoordinates;
  45378. this.yCoordinates = yCoordinates;
  45379. this.flags = flags;
  45380. }
  45381. }
  45382. class SimpleGlyph {
  45383. constructor(_ref5) {
  45384. let {
  45385. contours,
  45386. instructions
  45387. } = _ref5;
  45388. this.contours = contours;
  45389. this.instructions = instructions;
  45390. }
  45391. static parse(pos, glyf, numberOfContours) {
  45392. const endPtsOfContours = [];
  45393. for (let i = 0; i < numberOfContours; i++) {
  45394. const endPt = glyf.getUint16(pos);
  45395. pos += 2;
  45396. endPtsOfContours.push(endPt);
  45397. }
  45398. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  45399. const instructionLength = glyf.getUint16(pos);
  45400. pos += 2;
  45401. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  45402. pos += instructionLength;
  45403. const flags = [];
  45404. for (let i = 0; i < numberOfPt; pos++, i++) {
  45405. let flag = glyf.getUint8(pos);
  45406. flags.push(flag);
  45407. if (flag & REPEAT_FLAG) {
  45408. const count = glyf.getUint8(++pos);
  45409. flag ^= REPEAT_FLAG;
  45410. for (let m = 0; m < count; m++) {
  45411. flags.push(flag);
  45412. }
  45413. i += count;
  45414. }
  45415. }
  45416. const allXCoordinates = [];
  45417. let xCoordinates = [];
  45418. let yCoordinates = [];
  45419. let pointFlags = [];
  45420. const contours = [];
  45421. let endPtsOfContoursIndex = 0;
  45422. let lastCoordinate = 0;
  45423. for (let i = 0; i < numberOfPt; i++) {
  45424. const flag = flags[i];
  45425. if (flag & X_SHORT_VECTOR) {
  45426. const x = glyf.getUint8(pos++);
  45427. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  45428. xCoordinates.push(lastCoordinate);
  45429. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  45430. xCoordinates.push(lastCoordinate);
  45431. } else {
  45432. lastCoordinate += glyf.getInt16(pos);
  45433. pos += 2;
  45434. xCoordinates.push(lastCoordinate);
  45435. }
  45436. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  45437. endPtsOfContoursIndex++;
  45438. allXCoordinates.push(xCoordinates);
  45439. xCoordinates = [];
  45440. }
  45441. }
  45442. lastCoordinate = 0;
  45443. endPtsOfContoursIndex = 0;
  45444. for (let i = 0; i < numberOfPt; i++) {
  45445. const flag = flags[i];
  45446. if (flag & Y_SHORT_VECTOR) {
  45447. const y = glyf.getUint8(pos++);
  45448. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  45449. yCoordinates.push(lastCoordinate);
  45450. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  45451. yCoordinates.push(lastCoordinate);
  45452. } else {
  45453. lastCoordinate += glyf.getInt16(pos);
  45454. pos += 2;
  45455. yCoordinates.push(lastCoordinate);
  45456. }
  45457. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  45458. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  45459. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  45460. endPtsOfContoursIndex++;
  45461. contours.push(new Contour({
  45462. flags: pointFlags,
  45463. xCoordinates,
  45464. yCoordinates
  45465. }));
  45466. yCoordinates = [];
  45467. pointFlags = [];
  45468. }
  45469. }
  45470. return new SimpleGlyph({
  45471. contours,
  45472. instructions
  45473. });
  45474. }
  45475. getSize() {
  45476. let size = this.contours.length * 2 + 2 + this.instructions.length;
  45477. let lastX = 0;
  45478. let lastY = 0;
  45479. for (const contour of this.contours) {
  45480. size += contour.flags.length;
  45481. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45482. const x = contour.xCoordinates[i];
  45483. const y = contour.yCoordinates[i];
  45484. let abs = Math.abs(x - lastX);
  45485. if (abs > 255) {
  45486. size += 2;
  45487. } else if (abs > 0) {
  45488. size += 1;
  45489. }
  45490. lastX = x;
  45491. abs = Math.abs(y - lastY);
  45492. if (abs > 255) {
  45493. size += 2;
  45494. } else if (abs > 0) {
  45495. size += 1;
  45496. }
  45497. lastY = y;
  45498. }
  45499. }
  45500. return size;
  45501. }
  45502. write(pos, buf) {
  45503. const spos = pos;
  45504. const xCoordinates = [];
  45505. const yCoordinates = [];
  45506. const flags = [];
  45507. let lastX = 0;
  45508. let lastY = 0;
  45509. for (const contour of this.contours) {
  45510. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45511. let flag = contour.flags[i];
  45512. const x = contour.xCoordinates[i];
  45513. let delta = x - lastX;
  45514. if (delta === 0) {
  45515. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  45516. xCoordinates.push(0);
  45517. } else {
  45518. const abs = Math.abs(delta);
  45519. if (abs <= 255) {
  45520. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  45521. xCoordinates.push(abs);
  45522. } else {
  45523. xCoordinates.push(delta);
  45524. }
  45525. }
  45526. lastX = x;
  45527. const y = contour.yCoordinates[i];
  45528. delta = y - lastY;
  45529. if (delta === 0) {
  45530. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  45531. yCoordinates.push(0);
  45532. } else {
  45533. const abs = Math.abs(delta);
  45534. if (abs <= 255) {
  45535. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  45536. yCoordinates.push(abs);
  45537. } else {
  45538. yCoordinates.push(delta);
  45539. }
  45540. }
  45541. lastY = y;
  45542. flags.push(flag);
  45543. }
  45544. buf.setUint16(pos, xCoordinates.length - 1);
  45545. pos += 2;
  45546. }
  45547. buf.setUint16(pos, this.instructions.length);
  45548. pos += 2;
  45549. if (this.instructions.length) {
  45550. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45551. pos += this.instructions.length;
  45552. }
  45553. for (const flag of flags) {
  45554. buf.setUint8(pos++, flag);
  45555. }
  45556. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  45557. const x = xCoordinates[i];
  45558. const flag = flags[i];
  45559. if (flag & X_SHORT_VECTOR) {
  45560. buf.setUint8(pos++, x);
  45561. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  45562. buf.setInt16(pos, x);
  45563. pos += 2;
  45564. }
  45565. }
  45566. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  45567. const y = yCoordinates[i];
  45568. const flag = flags[i];
  45569. if (flag & Y_SHORT_VECTOR) {
  45570. buf.setUint8(pos++, y);
  45571. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  45572. buf.setInt16(pos, y);
  45573. pos += 2;
  45574. }
  45575. }
  45576. return pos - spos;
  45577. }
  45578. scale(x, factor) {
  45579. for (const contour of this.contours) {
  45580. if (contour.xCoordinates.length === 0) {
  45581. continue;
  45582. }
  45583. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45584. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  45585. }
  45586. }
  45587. }
  45588. }
  45589. class CompositeGlyph {
  45590. constructor(_ref6) {
  45591. let {
  45592. flags,
  45593. glyphIndex,
  45594. argument1,
  45595. argument2,
  45596. transf,
  45597. instructions
  45598. } = _ref6;
  45599. this.flags = flags;
  45600. this.glyphIndex = glyphIndex;
  45601. this.argument1 = argument1;
  45602. this.argument2 = argument2;
  45603. this.transf = transf;
  45604. this.instructions = instructions;
  45605. }
  45606. static parse(pos, glyf) {
  45607. const spos = pos;
  45608. const transf = [];
  45609. let flags = glyf.getUint16(pos);
  45610. const glyphIndex = glyf.getUint16(pos + 2);
  45611. pos += 4;
  45612. let argument1, argument2;
  45613. if (flags & ARG_1_AND_2_ARE_WORDS) {
  45614. if (flags & ARGS_ARE_XY_VALUES) {
  45615. argument1 = glyf.getInt16(pos);
  45616. argument2 = glyf.getInt16(pos + 2);
  45617. } else {
  45618. argument1 = glyf.getUint16(pos);
  45619. argument2 = glyf.getUint16(pos + 2);
  45620. }
  45621. pos += 4;
  45622. flags ^= ARG_1_AND_2_ARE_WORDS;
  45623. } else {
  45624. if (flags & ARGS_ARE_XY_VALUES) {
  45625. argument1 = glyf.getInt8(pos);
  45626. argument2 = glyf.getInt8(pos + 1);
  45627. } else {
  45628. argument1 = glyf.getUint8(pos);
  45629. argument2 = glyf.getUint8(pos + 1);
  45630. }
  45631. pos += 2;
  45632. }
  45633. if (flags & WE_HAVE_A_SCALE) {
  45634. transf.push(glyf.getUint16(pos));
  45635. pos += 2;
  45636. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  45637. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  45638. pos += 4;
  45639. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  45640. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  45641. pos += 8;
  45642. }
  45643. let instructions = null;
  45644. if (flags & WE_HAVE_INSTRUCTIONS) {
  45645. const instructionLength = glyf.getUint16(pos);
  45646. pos += 2;
  45647. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  45648. pos += instructionLength;
  45649. }
  45650. return [pos - spos, new CompositeGlyph({
  45651. flags,
  45652. glyphIndex,
  45653. argument1,
  45654. argument2,
  45655. transf,
  45656. instructions
  45657. })];
  45658. }
  45659. getSize() {
  45660. let size = 2 + 2 + this.transf.length * 2;
  45661. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45662. size += 2 + this.instructions.length;
  45663. }
  45664. size += 2;
  45665. if (this.flags & 2) {
  45666. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45667. size += 2;
  45668. }
  45669. } else {
  45670. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45671. size += 2;
  45672. }
  45673. }
  45674. return size;
  45675. }
  45676. write(pos, buf) {
  45677. const spos = pos;
  45678. if (this.flags & ARGS_ARE_XY_VALUES) {
  45679. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45680. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45681. }
  45682. } else {
  45683. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45684. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45685. }
  45686. }
  45687. buf.setUint16(pos, this.flags);
  45688. buf.setUint16(pos + 2, this.glyphIndex);
  45689. pos += 4;
  45690. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  45691. if (this.flags & ARGS_ARE_XY_VALUES) {
  45692. buf.setInt16(pos, this.argument1);
  45693. buf.setInt16(pos + 2, this.argument2);
  45694. } else {
  45695. buf.setUint16(pos, this.argument1);
  45696. buf.setUint16(pos + 2, this.argument2);
  45697. }
  45698. pos += 4;
  45699. } else {
  45700. buf.setUint8(pos, this.argument1);
  45701. buf.setUint8(pos + 1, this.argument2);
  45702. pos += 2;
  45703. }
  45704. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45705. buf.setUint16(pos, this.instructions.length);
  45706. pos += 2;
  45707. if (this.instructions.length) {
  45708. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45709. pos += this.instructions.length;
  45710. }
  45711. }
  45712. return pos - spos;
  45713. }
  45714. scale(x, factor) {}
  45715. }
  45716. /***/ }),
  45717. /* 176 */
  45718. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45719. "use strict";
  45720. Object.defineProperty(exports, "__esModule", ({
  45721. value: true
  45722. }));
  45723. exports.OpenTypeFileBuilder = void 0;
  45724. var _core_utils = __w_pdfjs_require__(135);
  45725. var _util = __w_pdfjs_require__(2);
  45726. function writeInt16(dest, offset, num) {
  45727. dest[offset] = num >> 8 & 0xff;
  45728. dest[offset + 1] = num & 0xff;
  45729. }
  45730. function writeInt32(dest, offset, num) {
  45731. dest[offset] = num >> 24 & 0xff;
  45732. dest[offset + 1] = num >> 16 & 0xff;
  45733. dest[offset + 2] = num >> 8 & 0xff;
  45734. dest[offset + 3] = num & 0xff;
  45735. }
  45736. function writeData(dest, offset, data) {
  45737. if (data instanceof Uint8Array) {
  45738. dest.set(data, offset);
  45739. } else if (typeof data === "string") {
  45740. for (let i = 0, ii = data.length; i < ii; i++) {
  45741. dest[offset++] = data.charCodeAt(i) & 0xff;
  45742. }
  45743. } else {
  45744. for (const num of data) {
  45745. dest[offset++] = num & 0xff;
  45746. }
  45747. }
  45748. }
  45749. const OTF_HEADER_SIZE = 12;
  45750. const OTF_TABLE_ENTRY_SIZE = 16;
  45751. class OpenTypeFileBuilder {
  45752. constructor(sfnt) {
  45753. this.sfnt = sfnt;
  45754. this.tables = Object.create(null);
  45755. }
  45756. static getSearchParams(entriesCount, entrySize) {
  45757. let maxPower2 = 1,
  45758. log2 = 0;
  45759. while ((maxPower2 ^ entriesCount) > maxPower2) {
  45760. maxPower2 <<= 1;
  45761. log2++;
  45762. }
  45763. const searchRange = maxPower2 * entrySize;
  45764. return {
  45765. range: searchRange,
  45766. entry: log2,
  45767. rangeShift: entrySize * entriesCount - searchRange
  45768. };
  45769. }
  45770. toArray() {
  45771. let sfnt = this.sfnt;
  45772. const tables = this.tables;
  45773. const tablesNames = Object.keys(tables);
  45774. tablesNames.sort();
  45775. const numTables = tablesNames.length;
  45776. let i, j, jj, table, tableName;
  45777. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  45778. const tableOffsets = [offset];
  45779. for (i = 0; i < numTables; i++) {
  45780. table = tables[tablesNames[i]];
  45781. const paddedLength = (table.length + 3 & ~3) >>> 0;
  45782. offset += paddedLength;
  45783. tableOffsets.push(offset);
  45784. }
  45785. const file = new Uint8Array(offset);
  45786. for (i = 0; i < numTables; i++) {
  45787. table = tables[tablesNames[i]];
  45788. writeData(file, tableOffsets[i], table);
  45789. }
  45790. if (sfnt === "true") {
  45791. sfnt = (0, _util.string32)(0x00010000);
  45792. }
  45793. file[0] = sfnt.charCodeAt(0) & 0xff;
  45794. file[1] = sfnt.charCodeAt(1) & 0xff;
  45795. file[2] = sfnt.charCodeAt(2) & 0xff;
  45796. file[3] = sfnt.charCodeAt(3) & 0xff;
  45797. writeInt16(file, 4, numTables);
  45798. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  45799. writeInt16(file, 6, searchParams.range);
  45800. writeInt16(file, 8, searchParams.entry);
  45801. writeInt16(file, 10, searchParams.rangeShift);
  45802. offset = OTF_HEADER_SIZE;
  45803. for (i = 0; i < numTables; i++) {
  45804. tableName = tablesNames[i];
  45805. file[offset] = tableName.charCodeAt(0) & 0xff;
  45806. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  45807. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  45808. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  45809. let checksum = 0;
  45810. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  45811. const quad = (0, _core_utils.readUint32)(file, j);
  45812. checksum = checksum + quad >>> 0;
  45813. }
  45814. writeInt32(file, offset + 4, checksum);
  45815. writeInt32(file, offset + 8, tableOffsets[i]);
  45816. writeInt32(file, offset + 12, tables[tableName].length);
  45817. offset += OTF_TABLE_ENTRY_SIZE;
  45818. }
  45819. return file;
  45820. }
  45821. addTable(tag, data) {
  45822. if (tag in this.tables) {
  45823. throw new Error("Table " + tag + " already exists");
  45824. }
  45825. this.tables[tag] = data;
  45826. }
  45827. }
  45828. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  45829. /***/ }),
  45830. /* 177 */
  45831. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45832. "use strict";
  45833. Object.defineProperty(exports, "__esModule", ({
  45834. value: true
  45835. }));
  45836. exports.Type1Font = void 0;
  45837. var _cff_parser = __w_pdfjs_require__(164);
  45838. var _util = __w_pdfjs_require__(2);
  45839. var _fonts_utils = __w_pdfjs_require__(167);
  45840. var _core_utils = __w_pdfjs_require__(135);
  45841. var _stream = __w_pdfjs_require__(139);
  45842. var _type1_parser = __w_pdfjs_require__(178);
  45843. function findBlock(streamBytes, signature, startIndex) {
  45844. const streamBytesLength = streamBytes.length;
  45845. const signatureLength = signature.length;
  45846. const scanLength = streamBytesLength - signatureLength;
  45847. let i = startIndex,
  45848. found = false;
  45849. while (i < scanLength) {
  45850. let j = 0;
  45851. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  45852. j++;
  45853. }
  45854. if (j >= signatureLength) {
  45855. i += j;
  45856. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  45857. i++;
  45858. }
  45859. found = true;
  45860. break;
  45861. }
  45862. i++;
  45863. }
  45864. return {
  45865. found,
  45866. length: i
  45867. };
  45868. }
  45869. function getHeaderBlock(stream, suggestedLength) {
  45870. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  45871. const streamStartPos = stream.pos;
  45872. let headerBytes, headerBytesLength, block;
  45873. try {
  45874. headerBytes = stream.getBytes(suggestedLength);
  45875. headerBytesLength = headerBytes.length;
  45876. } catch (ex) {}
  45877. if (headerBytesLength === suggestedLength) {
  45878. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  45879. if (block.found && block.length === suggestedLength) {
  45880. return {
  45881. stream: new _stream.Stream(headerBytes),
  45882. length: suggestedLength
  45883. };
  45884. }
  45885. }
  45886. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  45887. stream.pos = streamStartPos;
  45888. const SCAN_BLOCK_LENGTH = 2048;
  45889. let actualLength;
  45890. while (true) {
  45891. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  45892. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  45893. if (block.length === 0) {
  45894. break;
  45895. }
  45896. stream.pos += block.length;
  45897. if (block.found) {
  45898. actualLength = stream.pos - streamStartPos;
  45899. break;
  45900. }
  45901. }
  45902. stream.pos = streamStartPos;
  45903. if (actualLength) {
  45904. return {
  45905. stream: new _stream.Stream(stream.getBytes(actualLength)),
  45906. length: actualLength
  45907. };
  45908. }
  45909. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  45910. return {
  45911. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  45912. length: suggestedLength
  45913. };
  45914. }
  45915. function getEexecBlock(stream, suggestedLength) {
  45916. const eexecBytes = stream.getBytes();
  45917. if (eexecBytes.length === 0) {
  45918. throw new _util.FormatError("getEexecBlock - no font program found.");
  45919. }
  45920. return {
  45921. stream: new _stream.Stream(eexecBytes),
  45922. length: eexecBytes.length
  45923. };
  45924. }
  45925. class Type1Font {
  45926. constructor(name, file, properties) {
  45927. const PFB_HEADER_SIZE = 6;
  45928. let headerBlockLength = properties.length1;
  45929. let eexecBlockLength = properties.length2;
  45930. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  45931. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  45932. if (pfbHeaderPresent) {
  45933. file.skip(PFB_HEADER_SIZE);
  45934. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45935. }
  45936. const headerBlock = getHeaderBlock(file, headerBlockLength);
  45937. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45938. headerBlockParser.extractFontHeader(properties);
  45939. if (pfbHeaderPresent) {
  45940. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  45941. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45942. }
  45943. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  45944. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45945. const data = eexecBlockParser.extractFontProgram(properties);
  45946. for (const key in data.properties) {
  45947. properties[key] = data.properties[key];
  45948. }
  45949. const charstrings = data.charstrings;
  45950. const type2Charstrings = this.getType2Charstrings(charstrings);
  45951. const subrs = this.getType2Subrs(data.subrs);
  45952. this.charstrings = charstrings;
  45953. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  45954. this.seacs = this.getSeacs(data.charstrings);
  45955. }
  45956. get numGlyphs() {
  45957. return this.charstrings.length + 1;
  45958. }
  45959. getCharset() {
  45960. const charset = [".notdef"];
  45961. for (const {
  45962. glyphName
  45963. } of this.charstrings) {
  45964. charset.push(glyphName);
  45965. }
  45966. return charset;
  45967. }
  45968. getGlyphMapping(properties) {
  45969. const charstrings = this.charstrings;
  45970. if (properties.composite) {
  45971. const charCodeToGlyphId = Object.create(null);
  45972. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  45973. const charCode = properties.cMap.charCodeOf(glyphId);
  45974. charCodeToGlyphId[charCode] = glyphId + 1;
  45975. }
  45976. return charCodeToGlyphId;
  45977. }
  45978. const glyphNames = [".notdef"];
  45979. let builtInEncoding, glyphId;
  45980. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  45981. glyphNames.push(charstrings[glyphId].glyphName);
  45982. }
  45983. const encoding = properties.builtInEncoding;
  45984. if (encoding) {
  45985. builtInEncoding = Object.create(null);
  45986. for (const charCode in encoding) {
  45987. glyphId = glyphNames.indexOf(encoding[charCode]);
  45988. if (glyphId >= 0) {
  45989. builtInEncoding[charCode] = glyphId;
  45990. }
  45991. }
  45992. }
  45993. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  45994. }
  45995. hasGlyphId(id) {
  45996. if (id < 0 || id >= this.numGlyphs) {
  45997. return false;
  45998. }
  45999. if (id === 0) {
  46000. return true;
  46001. }
  46002. const glyph = this.charstrings[id - 1];
  46003. return glyph.charstring.length > 0;
  46004. }
  46005. getSeacs(charstrings) {
  46006. const seacMap = [];
  46007. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  46008. const charstring = charstrings[i];
  46009. if (charstring.seac) {
  46010. seacMap[i + 1] = charstring.seac;
  46011. }
  46012. }
  46013. return seacMap;
  46014. }
  46015. getType2Charstrings(type1Charstrings) {
  46016. const type2Charstrings = [];
  46017. for (const type1Charstring of type1Charstrings) {
  46018. type2Charstrings.push(type1Charstring.charstring);
  46019. }
  46020. return type2Charstrings;
  46021. }
  46022. getType2Subrs(type1Subrs) {
  46023. let bias = 0;
  46024. const count = type1Subrs.length;
  46025. if (count < 1133) {
  46026. bias = 107;
  46027. } else if (count < 33769) {
  46028. bias = 1131;
  46029. } else {
  46030. bias = 32768;
  46031. }
  46032. const type2Subrs = [];
  46033. let i;
  46034. for (i = 0; i < bias; i++) {
  46035. type2Subrs.push([0x0b]);
  46036. }
  46037. for (i = 0; i < count; i++) {
  46038. type2Subrs.push(type1Subrs[i]);
  46039. }
  46040. return type2Subrs;
  46041. }
  46042. wrap(name, glyphs, charstrings, subrs, properties) {
  46043. const cff = new _cff_parser.CFF();
  46044. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  46045. cff.names = [name];
  46046. const topDict = new _cff_parser.CFFTopDict();
  46047. topDict.setByName("version", 391);
  46048. topDict.setByName("Notice", 392);
  46049. topDict.setByName("FullName", 393);
  46050. topDict.setByName("FamilyName", 394);
  46051. topDict.setByName("Weight", 395);
  46052. topDict.setByName("Encoding", null);
  46053. topDict.setByName("FontMatrix", properties.fontMatrix);
  46054. topDict.setByName("FontBBox", properties.bbox);
  46055. topDict.setByName("charset", null);
  46056. topDict.setByName("CharStrings", null);
  46057. topDict.setByName("Private", null);
  46058. cff.topDict = topDict;
  46059. const strings = new _cff_parser.CFFStrings();
  46060. strings.add("Version 0.11");
  46061. strings.add("See original notice");
  46062. strings.add(name);
  46063. strings.add(name);
  46064. strings.add("Medium");
  46065. cff.strings = strings;
  46066. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  46067. const count = glyphs.length;
  46068. const charsetArray = [".notdef"];
  46069. let i, ii;
  46070. for (i = 0; i < count; i++) {
  46071. const glyphName = charstrings[i].glyphName;
  46072. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  46073. if (index === -1) {
  46074. strings.add(glyphName);
  46075. }
  46076. charsetArray.push(glyphName);
  46077. }
  46078. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  46079. const charStringsIndex = new _cff_parser.CFFIndex();
  46080. charStringsIndex.add([0x8b, 0x0e]);
  46081. for (i = 0; i < count; i++) {
  46082. charStringsIndex.add(glyphs[i]);
  46083. }
  46084. cff.charStrings = charStringsIndex;
  46085. const privateDict = new _cff_parser.CFFPrivateDict();
  46086. privateDict.setByName("Subrs", null);
  46087. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  46088. for (i = 0, ii = fields.length; i < ii; i++) {
  46089. const field = fields[i];
  46090. if (!(field in properties.privateData)) {
  46091. continue;
  46092. }
  46093. const value = properties.privateData[field];
  46094. if (Array.isArray(value)) {
  46095. for (let j = value.length - 1; j > 0; j--) {
  46096. value[j] -= value[j - 1];
  46097. }
  46098. }
  46099. privateDict.setByName(field, value);
  46100. }
  46101. cff.topDict.privateDict = privateDict;
  46102. const subrIndex = new _cff_parser.CFFIndex();
  46103. for (i = 0, ii = subrs.length; i < ii; i++) {
  46104. subrIndex.add(subrs[i]);
  46105. }
  46106. privateDict.subrsIndex = subrIndex;
  46107. const compiler = new _cff_parser.CFFCompiler(cff);
  46108. return compiler.compile();
  46109. }
  46110. }
  46111. exports.Type1Font = Type1Font;
  46112. /***/ }),
  46113. /* 178 */
  46114. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46115. "use strict";
  46116. Object.defineProperty(exports, "__esModule", ({
  46117. value: true
  46118. }));
  46119. exports.Type1Parser = void 0;
  46120. var _encodings = __w_pdfjs_require__(166);
  46121. var _core_utils = __w_pdfjs_require__(135);
  46122. var _stream = __w_pdfjs_require__(139);
  46123. var _util = __w_pdfjs_require__(2);
  46124. const HINTING_ENABLED = false;
  46125. const COMMAND_MAP = {
  46126. hstem: [1],
  46127. vstem: [3],
  46128. vmoveto: [4],
  46129. rlineto: [5],
  46130. hlineto: [6],
  46131. vlineto: [7],
  46132. rrcurveto: [8],
  46133. callsubr: [10],
  46134. flex: [12, 35],
  46135. drop: [12, 18],
  46136. endchar: [14],
  46137. rmoveto: [21],
  46138. hmoveto: [22],
  46139. vhcurveto: [30],
  46140. hvcurveto: [31]
  46141. };
  46142. class Type1CharString {
  46143. constructor() {
  46144. this.width = 0;
  46145. this.lsb = 0;
  46146. this.flexing = false;
  46147. this.output = [];
  46148. this.stack = [];
  46149. }
  46150. convert(encoded, subrs, seacAnalysisEnabled) {
  46151. const count = encoded.length;
  46152. let error = false;
  46153. let wx, sbx, subrNumber;
  46154. for (let i = 0; i < count; i++) {
  46155. let value = encoded[i];
  46156. if (value < 32) {
  46157. if (value === 12) {
  46158. value = (value << 8) + encoded[++i];
  46159. }
  46160. switch (value) {
  46161. case 1:
  46162. if (!HINTING_ENABLED) {
  46163. this.stack = [];
  46164. break;
  46165. }
  46166. error = this.executeCommand(2, COMMAND_MAP.hstem);
  46167. break;
  46168. case 3:
  46169. if (!HINTING_ENABLED) {
  46170. this.stack = [];
  46171. break;
  46172. }
  46173. error = this.executeCommand(2, COMMAND_MAP.vstem);
  46174. break;
  46175. case 4:
  46176. if (this.flexing) {
  46177. if (this.stack.length < 1) {
  46178. error = true;
  46179. break;
  46180. }
  46181. const dy = this.stack.pop();
  46182. this.stack.push(0, dy);
  46183. break;
  46184. }
  46185. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  46186. break;
  46187. case 5:
  46188. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  46189. break;
  46190. case 6:
  46191. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  46192. break;
  46193. case 7:
  46194. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  46195. break;
  46196. case 8:
  46197. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  46198. break;
  46199. case 9:
  46200. this.stack = [];
  46201. break;
  46202. case 10:
  46203. if (this.stack.length < 1) {
  46204. error = true;
  46205. break;
  46206. }
  46207. subrNumber = this.stack.pop();
  46208. if (!subrs[subrNumber]) {
  46209. error = true;
  46210. break;
  46211. }
  46212. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  46213. break;
  46214. case 11:
  46215. return error;
  46216. case 13:
  46217. if (this.stack.length < 2) {
  46218. error = true;
  46219. break;
  46220. }
  46221. wx = this.stack.pop();
  46222. sbx = this.stack.pop();
  46223. this.lsb = sbx;
  46224. this.width = wx;
  46225. this.stack.push(wx, sbx);
  46226. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  46227. break;
  46228. case 14:
  46229. this.output.push(COMMAND_MAP.endchar[0]);
  46230. break;
  46231. case 21:
  46232. if (this.flexing) {
  46233. break;
  46234. }
  46235. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  46236. break;
  46237. case 22:
  46238. if (this.flexing) {
  46239. this.stack.push(0);
  46240. break;
  46241. }
  46242. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  46243. break;
  46244. case 30:
  46245. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  46246. break;
  46247. case 31:
  46248. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  46249. break;
  46250. case (12 << 8) + 0:
  46251. this.stack = [];
  46252. break;
  46253. case (12 << 8) + 1:
  46254. if (!HINTING_ENABLED) {
  46255. this.stack = [];
  46256. break;
  46257. }
  46258. error = this.executeCommand(2, COMMAND_MAP.vstem);
  46259. break;
  46260. case (12 << 8) + 2:
  46261. if (!HINTING_ENABLED) {
  46262. this.stack = [];
  46263. break;
  46264. }
  46265. error = this.executeCommand(2, COMMAND_MAP.hstem);
  46266. break;
  46267. case (12 << 8) + 6:
  46268. if (seacAnalysisEnabled) {
  46269. const asb = this.stack.at(-5);
  46270. this.seac = this.stack.splice(-4, 4);
  46271. this.seac[0] += this.lsb - asb;
  46272. error = this.executeCommand(0, COMMAND_MAP.endchar);
  46273. } else {
  46274. error = this.executeCommand(4, COMMAND_MAP.endchar);
  46275. }
  46276. break;
  46277. case (12 << 8) + 7:
  46278. if (this.stack.length < 4) {
  46279. error = true;
  46280. break;
  46281. }
  46282. this.stack.pop();
  46283. wx = this.stack.pop();
  46284. const sby = this.stack.pop();
  46285. sbx = this.stack.pop();
  46286. this.lsb = sbx;
  46287. this.width = wx;
  46288. this.stack.push(wx, sbx, sby);
  46289. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  46290. break;
  46291. case (12 << 8) + 12:
  46292. if (this.stack.length < 2) {
  46293. error = true;
  46294. break;
  46295. }
  46296. const num2 = this.stack.pop();
  46297. const num1 = this.stack.pop();
  46298. this.stack.push(num1 / num2);
  46299. break;
  46300. case (12 << 8) + 16:
  46301. if (this.stack.length < 2) {
  46302. error = true;
  46303. break;
  46304. }
  46305. subrNumber = this.stack.pop();
  46306. const numArgs = this.stack.pop();
  46307. if (subrNumber === 0 && numArgs === 3) {
  46308. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  46309. 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]);
  46310. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  46311. this.flexing = false;
  46312. this.stack.push(flexArgs[15], flexArgs[16]);
  46313. } else if (subrNumber === 1 && numArgs === 0) {
  46314. this.flexing = true;
  46315. }
  46316. break;
  46317. case (12 << 8) + 17:
  46318. break;
  46319. case (12 << 8) + 33:
  46320. this.stack = [];
  46321. break;
  46322. default:
  46323. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  46324. break;
  46325. }
  46326. if (error) {
  46327. break;
  46328. }
  46329. continue;
  46330. } else if (value <= 246) {
  46331. value -= 139;
  46332. } else if (value <= 250) {
  46333. value = (value - 247) * 256 + encoded[++i] + 108;
  46334. } else if (value <= 254) {
  46335. value = -((value - 251) * 256) - encoded[++i] - 108;
  46336. } else {
  46337. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  46338. }
  46339. this.stack.push(value);
  46340. }
  46341. return error;
  46342. }
  46343. executeCommand(howManyArgs, command, keepStack) {
  46344. const stackLength = this.stack.length;
  46345. if (howManyArgs > stackLength) {
  46346. return true;
  46347. }
  46348. const start = stackLength - howManyArgs;
  46349. for (let i = start; i < stackLength; i++) {
  46350. let value = this.stack[i];
  46351. if (Number.isInteger(value)) {
  46352. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  46353. } else {
  46354. value = 65536 * value | 0;
  46355. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  46356. }
  46357. }
  46358. this.output.push(...command);
  46359. if (keepStack) {
  46360. this.stack.splice(start, howManyArgs);
  46361. } else {
  46362. this.stack.length = 0;
  46363. }
  46364. return false;
  46365. }
  46366. }
  46367. const EEXEC_ENCRYPT_KEY = 55665;
  46368. const CHAR_STRS_ENCRYPT_KEY = 4330;
  46369. function isHexDigit(code) {
  46370. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  46371. }
  46372. function decrypt(data, key, discardNumber) {
  46373. if (discardNumber >= data.length) {
  46374. return new Uint8Array(0);
  46375. }
  46376. const c1 = 52845,
  46377. c2 = 22719;
  46378. let r = key | 0,
  46379. i,
  46380. j;
  46381. for (i = 0; i < discardNumber; i++) {
  46382. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  46383. }
  46384. const count = data.length - discardNumber;
  46385. const decrypted = new Uint8Array(count);
  46386. for (i = discardNumber, j = 0; j < count; i++, j++) {
  46387. const value = data[i];
  46388. decrypted[j] = value ^ r >> 8;
  46389. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  46390. }
  46391. return decrypted;
  46392. }
  46393. function decryptAscii(data, key, discardNumber) {
  46394. const c1 = 52845,
  46395. c2 = 22719;
  46396. let r = key | 0;
  46397. const count = data.length,
  46398. maybeLength = count >>> 1;
  46399. const decrypted = new Uint8Array(maybeLength);
  46400. let i, j;
  46401. for (i = 0, j = 0; i < count; i++) {
  46402. const digit1 = data[i];
  46403. if (!isHexDigit(digit1)) {
  46404. continue;
  46405. }
  46406. i++;
  46407. let digit2;
  46408. while (i < count && !isHexDigit(digit2 = data[i])) {
  46409. i++;
  46410. }
  46411. if (i < count) {
  46412. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  46413. decrypted[j++] = value ^ r >> 8;
  46414. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  46415. }
  46416. }
  46417. return decrypted.slice(discardNumber, j);
  46418. }
  46419. function isSpecial(c) {
  46420. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  46421. }
  46422. class Type1Parser {
  46423. constructor(stream, encrypted, seacAnalysisEnabled) {
  46424. if (encrypted) {
  46425. const data = stream.getBytes();
  46426. 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]));
  46427. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  46428. }
  46429. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  46430. this.stream = stream;
  46431. this.nextChar();
  46432. }
  46433. readNumberArray() {
  46434. this.getToken();
  46435. const array = [];
  46436. while (true) {
  46437. const token = this.getToken();
  46438. if (token === null || token === "]" || token === "}") {
  46439. break;
  46440. }
  46441. array.push(parseFloat(token || 0));
  46442. }
  46443. return array;
  46444. }
  46445. readNumber() {
  46446. const token = this.getToken();
  46447. return parseFloat(token || 0);
  46448. }
  46449. readInt() {
  46450. const token = this.getToken();
  46451. return parseInt(token || 0, 10) | 0;
  46452. }
  46453. readBoolean() {
  46454. const token = this.getToken();
  46455. return token === "true" ? 1 : 0;
  46456. }
  46457. nextChar() {
  46458. return this.currentChar = this.stream.getByte();
  46459. }
  46460. prevChar() {
  46461. this.stream.skip(-2);
  46462. return this.currentChar = this.stream.getByte();
  46463. }
  46464. getToken() {
  46465. let comment = false;
  46466. let ch = this.currentChar;
  46467. while (true) {
  46468. if (ch === -1) {
  46469. return null;
  46470. }
  46471. if (comment) {
  46472. if (ch === 0x0a || ch === 0x0d) {
  46473. comment = false;
  46474. }
  46475. } else if (ch === 0x25) {
  46476. comment = true;
  46477. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  46478. break;
  46479. }
  46480. ch = this.nextChar();
  46481. }
  46482. if (isSpecial(ch)) {
  46483. this.nextChar();
  46484. return String.fromCharCode(ch);
  46485. }
  46486. let token = "";
  46487. do {
  46488. token += String.fromCharCode(ch);
  46489. ch = this.nextChar();
  46490. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  46491. return token;
  46492. }
  46493. readCharStrings(bytes, lenIV) {
  46494. if (lenIV === -1) {
  46495. return bytes;
  46496. }
  46497. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  46498. }
  46499. extractFontProgram(properties) {
  46500. const stream = this.stream;
  46501. const subrs = [],
  46502. charstrings = [];
  46503. const privateData = Object.create(null);
  46504. privateData.lenIV = 4;
  46505. const program = {
  46506. subrs: [],
  46507. charstrings: [],
  46508. properties: {
  46509. privateData
  46510. }
  46511. };
  46512. let token, length, data, lenIV;
  46513. while ((token = this.getToken()) !== null) {
  46514. if (token !== "/") {
  46515. continue;
  46516. }
  46517. token = this.getToken();
  46518. switch (token) {
  46519. case "CharStrings":
  46520. this.getToken();
  46521. this.getToken();
  46522. this.getToken();
  46523. this.getToken();
  46524. while (true) {
  46525. token = this.getToken();
  46526. if (token === null || token === "end") {
  46527. break;
  46528. }
  46529. if (token !== "/") {
  46530. continue;
  46531. }
  46532. const glyph = this.getToken();
  46533. length = this.readInt();
  46534. this.getToken();
  46535. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46536. lenIV = program.properties.privateData.lenIV;
  46537. const encoded = this.readCharStrings(data, lenIV);
  46538. this.nextChar();
  46539. token = this.getToken();
  46540. if (token === "noaccess") {
  46541. this.getToken();
  46542. } else if (token === "/") {
  46543. this.prevChar();
  46544. }
  46545. charstrings.push({
  46546. glyph,
  46547. encoded
  46548. });
  46549. }
  46550. break;
  46551. case "Subrs":
  46552. this.readInt();
  46553. this.getToken();
  46554. while (this.getToken() === "dup") {
  46555. const index = this.readInt();
  46556. length = this.readInt();
  46557. this.getToken();
  46558. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46559. lenIV = program.properties.privateData.lenIV;
  46560. const encoded = this.readCharStrings(data, lenIV);
  46561. this.nextChar();
  46562. token = this.getToken();
  46563. if (token === "noaccess") {
  46564. this.getToken();
  46565. }
  46566. subrs[index] = encoded;
  46567. }
  46568. break;
  46569. case "BlueValues":
  46570. case "OtherBlues":
  46571. case "FamilyBlues":
  46572. case "FamilyOtherBlues":
  46573. const blueArray = this.readNumberArray();
  46574. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  46575. program.properties.privateData[token] = blueArray;
  46576. }
  46577. break;
  46578. case "StemSnapH":
  46579. case "StemSnapV":
  46580. program.properties.privateData[token] = this.readNumberArray();
  46581. break;
  46582. case "StdHW":
  46583. case "StdVW":
  46584. program.properties.privateData[token] = this.readNumberArray()[0];
  46585. break;
  46586. case "BlueShift":
  46587. case "lenIV":
  46588. case "BlueFuzz":
  46589. case "BlueScale":
  46590. case "LanguageGroup":
  46591. case "ExpansionFactor":
  46592. program.properties.privateData[token] = this.readNumber();
  46593. break;
  46594. case "ForceBold":
  46595. program.properties.privateData[token] = this.readBoolean();
  46596. break;
  46597. }
  46598. }
  46599. for (const {
  46600. encoded,
  46601. glyph
  46602. } of charstrings) {
  46603. const charString = new Type1CharString();
  46604. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  46605. let output = charString.output;
  46606. if (error) {
  46607. output = [14];
  46608. }
  46609. const charStringObject = {
  46610. glyphName: glyph,
  46611. charstring: output,
  46612. width: charString.width,
  46613. lsb: charString.lsb,
  46614. seac: charString.seac
  46615. };
  46616. if (glyph === ".notdef") {
  46617. program.charstrings.unshift(charStringObject);
  46618. } else {
  46619. program.charstrings.push(charStringObject);
  46620. }
  46621. if (properties.builtInEncoding) {
  46622. const index = properties.builtInEncoding.indexOf(glyph);
  46623. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  46624. properties.widths[index] = charString.width;
  46625. }
  46626. }
  46627. }
  46628. return program;
  46629. }
  46630. extractFontHeader(properties) {
  46631. let token;
  46632. while ((token = this.getToken()) !== null) {
  46633. if (token !== "/") {
  46634. continue;
  46635. }
  46636. token = this.getToken();
  46637. switch (token) {
  46638. case "FontMatrix":
  46639. const matrix = this.readNumberArray();
  46640. properties.fontMatrix = matrix;
  46641. break;
  46642. case "Encoding":
  46643. const encodingArg = this.getToken();
  46644. let encoding;
  46645. if (!/^\d+$/.test(encodingArg)) {
  46646. encoding = (0, _encodings.getEncoding)(encodingArg);
  46647. } else {
  46648. encoding = [];
  46649. const size = parseInt(encodingArg, 10) | 0;
  46650. this.getToken();
  46651. for (let j = 0; j < size; j++) {
  46652. token = this.getToken();
  46653. while (token !== "dup" && token !== "def") {
  46654. token = this.getToken();
  46655. if (token === null) {
  46656. return;
  46657. }
  46658. }
  46659. if (token === "def") {
  46660. break;
  46661. }
  46662. const index = this.readInt();
  46663. this.getToken();
  46664. const glyph = this.getToken();
  46665. encoding[index] = glyph;
  46666. this.getToken();
  46667. }
  46668. }
  46669. properties.builtInEncoding = encoding;
  46670. break;
  46671. case "FontBBox":
  46672. const fontBBox = this.readNumberArray();
  46673. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  46674. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  46675. properties.ascentScaled = true;
  46676. break;
  46677. }
  46678. }
  46679. }
  46680. }
  46681. exports.Type1Parser = Type1Parser;
  46682. /***/ }),
  46683. /* 179 */
  46684. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46685. "use strict";
  46686. Object.defineProperty(exports, "__esModule", ({
  46687. value: true
  46688. }));
  46689. exports.Pattern = void 0;
  46690. exports.getTilingPatternIR = getTilingPatternIR;
  46691. var _util = __w_pdfjs_require__(2);
  46692. var _base_stream = __w_pdfjs_require__(136);
  46693. var _colorspace = __w_pdfjs_require__(143);
  46694. var _core_utils = __w_pdfjs_require__(135);
  46695. const ShadingType = {
  46696. FUNCTION_BASED: 1,
  46697. AXIAL: 2,
  46698. RADIAL: 3,
  46699. FREE_FORM_MESH: 4,
  46700. LATTICE_FORM_MESH: 5,
  46701. COONS_PATCH_MESH: 6,
  46702. TENSOR_PATCH_MESH: 7
  46703. };
  46704. class Pattern {
  46705. constructor() {
  46706. (0, _util.unreachable)("Cannot initialize Pattern.");
  46707. }
  46708. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  46709. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  46710. const type = dict.get("ShadingType");
  46711. try {
  46712. switch (type) {
  46713. case ShadingType.AXIAL:
  46714. case ShadingType.RADIAL:
  46715. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46716. case ShadingType.FREE_FORM_MESH:
  46717. case ShadingType.LATTICE_FORM_MESH:
  46718. case ShadingType.COONS_PATCH_MESH:
  46719. case ShadingType.TENSOR_PATCH_MESH:
  46720. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46721. default:
  46722. throw new _util.FormatError("Unsupported ShadingType: " + type);
  46723. }
  46724. } catch (ex) {
  46725. if (ex instanceof _core_utils.MissingDataException) {
  46726. throw ex;
  46727. }
  46728. handler.send("UnsupportedFeature", {
  46729. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  46730. });
  46731. (0, _util.warn)(ex);
  46732. return new DummyShading();
  46733. }
  46734. }
  46735. }
  46736. exports.Pattern = Pattern;
  46737. class BaseShading {
  46738. static get SMALL_NUMBER() {
  46739. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  46740. }
  46741. constructor() {
  46742. if (this.constructor === BaseShading) {
  46743. (0, _util.unreachable)("Cannot initialize BaseShading.");
  46744. }
  46745. }
  46746. getIR() {
  46747. (0, _util.unreachable)("Abstract method `getIR` called.");
  46748. }
  46749. }
  46750. class RadialAxialShading extends BaseShading {
  46751. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  46752. super();
  46753. this.coordsArr = dict.getArray("Coords");
  46754. this.shadingType = dict.get("ShadingType");
  46755. const cs = _colorspace.ColorSpace.parse({
  46756. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  46757. xref,
  46758. resources,
  46759. pdfFunctionFactory,
  46760. localColorSpaceCache
  46761. });
  46762. const bbox = dict.getArray("BBox");
  46763. if (Array.isArray(bbox) && bbox.length === 4) {
  46764. this.bbox = _util.Util.normalizeRect(bbox);
  46765. } else {
  46766. this.bbox = null;
  46767. }
  46768. let t0 = 0.0,
  46769. t1 = 1.0;
  46770. if (dict.has("Domain")) {
  46771. const domainArr = dict.getArray("Domain");
  46772. t0 = domainArr[0];
  46773. t1 = domainArr[1];
  46774. }
  46775. let extendStart = false,
  46776. extendEnd = false;
  46777. if (dict.has("Extend")) {
  46778. const extendArr = dict.getArray("Extend");
  46779. extendStart = extendArr[0];
  46780. extendEnd = extendArr[1];
  46781. }
  46782. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  46783. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  46784. const distance = Math.hypot(x1 - x2, y1 - y2);
  46785. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  46786. (0, _util.warn)("Unsupported radial gradient.");
  46787. }
  46788. }
  46789. this.extendStart = extendStart;
  46790. this.extendEnd = extendEnd;
  46791. const fnObj = dict.getRaw("Function");
  46792. const fn = pdfFunctionFactory.createFromArray(fnObj);
  46793. const NUMBER_OF_SAMPLES = 10;
  46794. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  46795. const colorStops = this.colorStops = [];
  46796. if (t0 >= t1 || step <= 0) {
  46797. (0, _util.info)("Bad shading domain.");
  46798. return;
  46799. }
  46800. const color = new Float32Array(cs.numComps),
  46801. ratio = new Float32Array(1);
  46802. let rgbColor;
  46803. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  46804. ratio[0] = t0 + i * step;
  46805. fn(ratio, 0, color, 0);
  46806. rgbColor = cs.getRgb(color, 0);
  46807. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46808. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  46809. }
  46810. let background = "transparent";
  46811. if (dict.has("Background")) {
  46812. rgbColor = cs.getRgb(dict.get("Background"), 0);
  46813. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46814. }
  46815. if (!extendStart) {
  46816. colorStops.unshift([0, background]);
  46817. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  46818. }
  46819. if (!extendEnd) {
  46820. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  46821. colorStops.push([1, background]);
  46822. }
  46823. this.colorStops = colorStops;
  46824. }
  46825. getIR() {
  46826. const coordsArr = this.coordsArr;
  46827. const shadingType = this.shadingType;
  46828. let type, p0, p1, r0, r1;
  46829. if (shadingType === ShadingType.AXIAL) {
  46830. p0 = [coordsArr[0], coordsArr[1]];
  46831. p1 = [coordsArr[2], coordsArr[3]];
  46832. r0 = null;
  46833. r1 = null;
  46834. type = "axial";
  46835. } else if (shadingType === ShadingType.RADIAL) {
  46836. p0 = [coordsArr[0], coordsArr[1]];
  46837. p1 = [coordsArr[3], coordsArr[4]];
  46838. r0 = coordsArr[2];
  46839. r1 = coordsArr[5];
  46840. type = "radial";
  46841. } else {
  46842. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  46843. }
  46844. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  46845. }
  46846. }
  46847. class MeshStreamReader {
  46848. constructor(stream, context) {
  46849. this.stream = stream;
  46850. this.context = context;
  46851. this.buffer = 0;
  46852. this.bufferLength = 0;
  46853. const numComps = context.numComps;
  46854. this.tmpCompsBuf = new Float32Array(numComps);
  46855. const csNumComps = context.colorSpace.numComps;
  46856. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  46857. }
  46858. get hasData() {
  46859. if (this.stream.end) {
  46860. return this.stream.pos < this.stream.end;
  46861. }
  46862. if (this.bufferLength > 0) {
  46863. return true;
  46864. }
  46865. const nextByte = this.stream.getByte();
  46866. if (nextByte < 0) {
  46867. return false;
  46868. }
  46869. this.buffer = nextByte;
  46870. this.bufferLength = 8;
  46871. return true;
  46872. }
  46873. readBits(n) {
  46874. let buffer = this.buffer;
  46875. let bufferLength = this.bufferLength;
  46876. if (n === 32) {
  46877. if (bufferLength === 0) {
  46878. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  46879. }
  46880. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  46881. const nextByte = this.stream.getByte();
  46882. this.buffer = nextByte & (1 << bufferLength) - 1;
  46883. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  46884. }
  46885. if (n === 8 && bufferLength === 0) {
  46886. return this.stream.getByte();
  46887. }
  46888. while (bufferLength < n) {
  46889. buffer = buffer << 8 | this.stream.getByte();
  46890. bufferLength += 8;
  46891. }
  46892. bufferLength -= n;
  46893. this.bufferLength = bufferLength;
  46894. this.buffer = buffer & (1 << bufferLength) - 1;
  46895. return buffer >> bufferLength;
  46896. }
  46897. align() {
  46898. this.buffer = 0;
  46899. this.bufferLength = 0;
  46900. }
  46901. readFlag() {
  46902. return this.readBits(this.context.bitsPerFlag);
  46903. }
  46904. readCoordinate() {
  46905. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  46906. const xi = this.readBits(bitsPerCoordinate);
  46907. const yi = this.readBits(bitsPerCoordinate);
  46908. const decode = this.context.decode;
  46909. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  46910. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  46911. }
  46912. readComponents() {
  46913. const numComps = this.context.numComps;
  46914. const bitsPerComponent = this.context.bitsPerComponent;
  46915. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  46916. const decode = this.context.decode;
  46917. const components = this.tmpCompsBuf;
  46918. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  46919. const ci = this.readBits(bitsPerComponent);
  46920. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  46921. }
  46922. const color = this.tmpCsCompsBuf;
  46923. if (this.context.colorFn) {
  46924. this.context.colorFn(components, 0, color, 0);
  46925. }
  46926. return this.context.colorSpace.getRgb(color, 0);
  46927. }
  46928. }
  46929. const getB = function getBClosure() {
  46930. function buildB(count) {
  46931. const lut = [];
  46932. for (let i = 0; i <= count; i++) {
  46933. const t = i / count,
  46934. t_ = 1 - t;
  46935. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  46936. }
  46937. return lut;
  46938. }
  46939. const cache = [];
  46940. return function (count) {
  46941. if (!cache[count]) {
  46942. cache[count] = buildB(count);
  46943. }
  46944. return cache[count];
  46945. };
  46946. }();
  46947. class MeshShading extends BaseShading {
  46948. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46949. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  46950. }
  46951. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46952. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  46953. }
  46954. static get TRIANGLE_DENSITY() {
  46955. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  46956. }
  46957. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  46958. super();
  46959. if (!(stream instanceof _base_stream.BaseStream)) {
  46960. throw new _util.FormatError("Mesh data is not a stream");
  46961. }
  46962. const dict = stream.dict;
  46963. this.shadingType = dict.get("ShadingType");
  46964. const bbox = dict.getArray("BBox");
  46965. if (Array.isArray(bbox) && bbox.length === 4) {
  46966. this.bbox = _util.Util.normalizeRect(bbox);
  46967. } else {
  46968. this.bbox = null;
  46969. }
  46970. const cs = _colorspace.ColorSpace.parse({
  46971. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  46972. xref,
  46973. resources,
  46974. pdfFunctionFactory,
  46975. localColorSpaceCache
  46976. });
  46977. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  46978. const fnObj = dict.getRaw("Function");
  46979. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  46980. this.coords = [];
  46981. this.colors = [];
  46982. this.figures = [];
  46983. const decodeContext = {
  46984. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  46985. bitsPerComponent: dict.get("BitsPerComponent"),
  46986. bitsPerFlag: dict.get("BitsPerFlag"),
  46987. decode: dict.getArray("Decode"),
  46988. colorFn: fn,
  46989. colorSpace: cs,
  46990. numComps: fn ? 1 : cs.numComps
  46991. };
  46992. const reader = new MeshStreamReader(stream, decodeContext);
  46993. let patchMesh = false;
  46994. switch (this.shadingType) {
  46995. case ShadingType.FREE_FORM_MESH:
  46996. this._decodeType4Shading(reader);
  46997. break;
  46998. case ShadingType.LATTICE_FORM_MESH:
  46999. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  47000. if (verticesPerRow < 2) {
  47001. throw new _util.FormatError("Invalid VerticesPerRow");
  47002. }
  47003. this._decodeType5Shading(reader, verticesPerRow);
  47004. break;
  47005. case ShadingType.COONS_PATCH_MESH:
  47006. this._decodeType6Shading(reader);
  47007. patchMesh = true;
  47008. break;
  47009. case ShadingType.TENSOR_PATCH_MESH:
  47010. this._decodeType7Shading(reader);
  47011. patchMesh = true;
  47012. break;
  47013. default:
  47014. (0, _util.unreachable)("Unsupported mesh type.");
  47015. break;
  47016. }
  47017. if (patchMesh) {
  47018. this._updateBounds();
  47019. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  47020. this._buildFigureFromPatch(i);
  47021. }
  47022. }
  47023. this._updateBounds();
  47024. this._packData();
  47025. }
  47026. _decodeType4Shading(reader) {
  47027. const coords = this.coords;
  47028. const colors = this.colors;
  47029. const operators = [];
  47030. const ps = [];
  47031. let verticesLeft = 0;
  47032. while (reader.hasData) {
  47033. const f = reader.readFlag();
  47034. const coord = reader.readCoordinate();
  47035. const color = reader.readComponents();
  47036. if (verticesLeft === 0) {
  47037. if (!(0 <= f && f <= 2)) {
  47038. throw new _util.FormatError("Unknown type4 flag");
  47039. }
  47040. switch (f) {
  47041. case 0:
  47042. verticesLeft = 3;
  47043. break;
  47044. case 1:
  47045. ps.push(ps.at(-2), ps.at(-1));
  47046. verticesLeft = 1;
  47047. break;
  47048. case 2:
  47049. ps.push(ps.at(-3), ps.at(-1));
  47050. verticesLeft = 1;
  47051. break;
  47052. }
  47053. operators.push(f);
  47054. }
  47055. ps.push(coords.length);
  47056. coords.push(coord);
  47057. colors.push(color);
  47058. verticesLeft--;
  47059. reader.align();
  47060. }
  47061. this.figures.push({
  47062. type: "triangles",
  47063. coords: new Int32Array(ps),
  47064. colors: new Int32Array(ps)
  47065. });
  47066. }
  47067. _decodeType5Shading(reader, verticesPerRow) {
  47068. const coords = this.coords;
  47069. const colors = this.colors;
  47070. const ps = [];
  47071. while (reader.hasData) {
  47072. const coord = reader.readCoordinate();
  47073. const color = reader.readComponents();
  47074. ps.push(coords.length);
  47075. coords.push(coord);
  47076. colors.push(color);
  47077. }
  47078. this.figures.push({
  47079. type: "lattice",
  47080. coords: new Int32Array(ps),
  47081. colors: new Int32Array(ps),
  47082. verticesPerRow
  47083. });
  47084. }
  47085. _decodeType6Shading(reader) {
  47086. const coords = this.coords;
  47087. const colors = this.colors;
  47088. const ps = new Int32Array(16);
  47089. const cs = new Int32Array(4);
  47090. while (reader.hasData) {
  47091. const f = reader.readFlag();
  47092. if (!(0 <= f && f <= 3)) {
  47093. throw new _util.FormatError("Unknown type6 flag");
  47094. }
  47095. const pi = coords.length;
  47096. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  47097. coords.push(reader.readCoordinate());
  47098. }
  47099. const ci = colors.length;
  47100. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  47101. colors.push(reader.readComponents());
  47102. }
  47103. let tmp1, tmp2, tmp3, tmp4;
  47104. switch (f) {
  47105. case 0:
  47106. ps[12] = pi + 3;
  47107. ps[13] = pi + 4;
  47108. ps[14] = pi + 5;
  47109. ps[15] = pi + 6;
  47110. ps[8] = pi + 2;
  47111. ps[11] = pi + 7;
  47112. ps[4] = pi + 1;
  47113. ps[7] = pi + 8;
  47114. ps[0] = pi;
  47115. ps[1] = pi + 11;
  47116. ps[2] = pi + 10;
  47117. ps[3] = pi + 9;
  47118. cs[2] = ci + 1;
  47119. cs[3] = ci + 2;
  47120. cs[0] = ci;
  47121. cs[1] = ci + 3;
  47122. break;
  47123. case 1:
  47124. tmp1 = ps[12];
  47125. tmp2 = ps[13];
  47126. tmp3 = ps[14];
  47127. tmp4 = ps[15];
  47128. ps[12] = tmp4;
  47129. ps[13] = pi + 0;
  47130. ps[14] = pi + 1;
  47131. ps[15] = pi + 2;
  47132. ps[8] = tmp3;
  47133. ps[11] = pi + 3;
  47134. ps[4] = tmp2;
  47135. ps[7] = pi + 4;
  47136. ps[0] = tmp1;
  47137. ps[1] = pi + 7;
  47138. ps[2] = pi + 6;
  47139. ps[3] = pi + 5;
  47140. tmp1 = cs[2];
  47141. tmp2 = cs[3];
  47142. cs[2] = tmp2;
  47143. cs[3] = ci;
  47144. cs[0] = tmp1;
  47145. cs[1] = ci + 1;
  47146. break;
  47147. case 2:
  47148. tmp1 = ps[15];
  47149. tmp2 = ps[11];
  47150. ps[12] = ps[3];
  47151. ps[13] = pi + 0;
  47152. ps[14] = pi + 1;
  47153. ps[15] = pi + 2;
  47154. ps[8] = ps[7];
  47155. ps[11] = pi + 3;
  47156. ps[4] = tmp2;
  47157. ps[7] = pi + 4;
  47158. ps[0] = tmp1;
  47159. ps[1] = pi + 7;
  47160. ps[2] = pi + 6;
  47161. ps[3] = pi + 5;
  47162. tmp1 = cs[3];
  47163. cs[2] = cs[1];
  47164. cs[3] = ci;
  47165. cs[0] = tmp1;
  47166. cs[1] = ci + 1;
  47167. break;
  47168. case 3:
  47169. ps[12] = ps[0];
  47170. ps[13] = pi + 0;
  47171. ps[14] = pi + 1;
  47172. ps[15] = pi + 2;
  47173. ps[8] = ps[1];
  47174. ps[11] = pi + 3;
  47175. ps[4] = ps[2];
  47176. ps[7] = pi + 4;
  47177. ps[0] = ps[3];
  47178. ps[1] = pi + 7;
  47179. ps[2] = pi + 6;
  47180. ps[3] = pi + 5;
  47181. cs[2] = cs[0];
  47182. cs[3] = ci;
  47183. cs[0] = cs[1];
  47184. cs[1] = ci + 1;
  47185. break;
  47186. }
  47187. ps[5] = coords.length;
  47188. 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]);
  47189. ps[6] = coords.length;
  47190. 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]);
  47191. ps[9] = coords.length;
  47192. 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]);
  47193. ps[10] = coords.length;
  47194. 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]);
  47195. this.figures.push({
  47196. type: "patch",
  47197. coords: new Int32Array(ps),
  47198. colors: new Int32Array(cs)
  47199. });
  47200. }
  47201. }
  47202. _decodeType7Shading(reader) {
  47203. const coords = this.coords;
  47204. const colors = this.colors;
  47205. const ps = new Int32Array(16);
  47206. const cs = new Int32Array(4);
  47207. while (reader.hasData) {
  47208. const f = reader.readFlag();
  47209. if (!(0 <= f && f <= 3)) {
  47210. throw new _util.FormatError("Unknown type7 flag");
  47211. }
  47212. const pi = coords.length;
  47213. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  47214. coords.push(reader.readCoordinate());
  47215. }
  47216. const ci = colors.length;
  47217. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  47218. colors.push(reader.readComponents());
  47219. }
  47220. let tmp1, tmp2, tmp3, tmp4;
  47221. switch (f) {
  47222. case 0:
  47223. ps[12] = pi + 3;
  47224. ps[13] = pi + 4;
  47225. ps[14] = pi + 5;
  47226. ps[15] = pi + 6;
  47227. ps[8] = pi + 2;
  47228. ps[9] = pi + 13;
  47229. ps[10] = pi + 14;
  47230. ps[11] = pi + 7;
  47231. ps[4] = pi + 1;
  47232. ps[5] = pi + 12;
  47233. ps[6] = pi + 15;
  47234. ps[7] = pi + 8;
  47235. ps[0] = pi;
  47236. ps[1] = pi + 11;
  47237. ps[2] = pi + 10;
  47238. ps[3] = pi + 9;
  47239. cs[2] = ci + 1;
  47240. cs[3] = ci + 2;
  47241. cs[0] = ci;
  47242. cs[1] = ci + 3;
  47243. break;
  47244. case 1:
  47245. tmp1 = ps[12];
  47246. tmp2 = ps[13];
  47247. tmp3 = ps[14];
  47248. tmp4 = ps[15];
  47249. ps[12] = tmp4;
  47250. ps[13] = pi + 0;
  47251. ps[14] = pi + 1;
  47252. ps[15] = pi + 2;
  47253. ps[8] = tmp3;
  47254. ps[9] = pi + 9;
  47255. ps[10] = pi + 10;
  47256. ps[11] = pi + 3;
  47257. ps[4] = tmp2;
  47258. ps[5] = pi + 8;
  47259. ps[6] = pi + 11;
  47260. ps[7] = pi + 4;
  47261. ps[0] = tmp1;
  47262. ps[1] = pi + 7;
  47263. ps[2] = pi + 6;
  47264. ps[3] = pi + 5;
  47265. tmp1 = cs[2];
  47266. tmp2 = cs[3];
  47267. cs[2] = tmp2;
  47268. cs[3] = ci;
  47269. cs[0] = tmp1;
  47270. cs[1] = ci + 1;
  47271. break;
  47272. case 2:
  47273. tmp1 = ps[15];
  47274. tmp2 = ps[11];
  47275. ps[12] = ps[3];
  47276. ps[13] = pi + 0;
  47277. ps[14] = pi + 1;
  47278. ps[15] = pi + 2;
  47279. ps[8] = ps[7];
  47280. ps[9] = pi + 9;
  47281. ps[10] = pi + 10;
  47282. ps[11] = pi + 3;
  47283. ps[4] = tmp2;
  47284. ps[5] = pi + 8;
  47285. ps[6] = pi + 11;
  47286. ps[7] = pi + 4;
  47287. ps[0] = tmp1;
  47288. ps[1] = pi + 7;
  47289. ps[2] = pi + 6;
  47290. ps[3] = pi + 5;
  47291. tmp1 = cs[3];
  47292. cs[2] = cs[1];
  47293. cs[3] = ci;
  47294. cs[0] = tmp1;
  47295. cs[1] = ci + 1;
  47296. break;
  47297. case 3:
  47298. ps[12] = ps[0];
  47299. ps[13] = pi + 0;
  47300. ps[14] = pi + 1;
  47301. ps[15] = pi + 2;
  47302. ps[8] = ps[1];
  47303. ps[9] = pi + 9;
  47304. ps[10] = pi + 10;
  47305. ps[11] = pi + 3;
  47306. ps[4] = ps[2];
  47307. ps[5] = pi + 8;
  47308. ps[6] = pi + 11;
  47309. ps[7] = pi + 4;
  47310. ps[0] = ps[3];
  47311. ps[1] = pi + 7;
  47312. ps[2] = pi + 6;
  47313. ps[3] = pi + 5;
  47314. cs[2] = cs[0];
  47315. cs[3] = ci;
  47316. cs[0] = cs[1];
  47317. cs[1] = ci + 1;
  47318. break;
  47319. }
  47320. this.figures.push({
  47321. type: "patch",
  47322. coords: new Int32Array(ps),
  47323. colors: new Int32Array(cs)
  47324. });
  47325. }
  47326. }
  47327. _buildFigureFromPatch(index) {
  47328. const figure = this.figures[index];
  47329. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  47330. const coords = this.coords,
  47331. colors = this.colors;
  47332. const pi = figure.coords;
  47333. const ci = figure.colors;
  47334. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  47335. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  47336. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  47337. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  47338. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  47339. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  47340. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  47341. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  47342. const verticesPerRow = splitXBy + 1;
  47343. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  47344. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  47345. let k = 0;
  47346. const cl = new Uint8Array(3),
  47347. cr = new Uint8Array(3);
  47348. const c0 = colors[ci[0]],
  47349. c1 = colors[ci[1]],
  47350. c2 = colors[ci[2]],
  47351. c3 = colors[ci[3]];
  47352. const bRow = getB(splitYBy),
  47353. bCol = getB(splitXBy);
  47354. for (let row = 0; row <= splitYBy; row++) {
  47355. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  47356. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  47357. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  47358. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  47359. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  47360. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  47361. for (let col = 0; col <= splitXBy; col++, k++) {
  47362. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  47363. continue;
  47364. }
  47365. let x = 0,
  47366. y = 0;
  47367. let q = 0;
  47368. for (let i = 0; i <= 3; i++) {
  47369. for (let j = 0; j <= 3; j++, q++) {
  47370. const m = bRow[row][i] * bCol[col][j];
  47371. x += coords[pi[q]][0] * m;
  47372. y += coords[pi[q]][1] * m;
  47373. }
  47374. }
  47375. figureCoords[k] = coords.length;
  47376. coords.push([x, y]);
  47377. figureColors[k] = colors.length;
  47378. const newColor = new Uint8Array(3);
  47379. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  47380. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  47381. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  47382. colors.push(newColor);
  47383. }
  47384. }
  47385. figureCoords[0] = pi[0];
  47386. figureColors[0] = ci[0];
  47387. figureCoords[splitXBy] = pi[3];
  47388. figureColors[splitXBy] = ci[1];
  47389. figureCoords[verticesPerRow * splitYBy] = pi[12];
  47390. figureColors[verticesPerRow * splitYBy] = ci[2];
  47391. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  47392. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  47393. this.figures[index] = {
  47394. type: "lattice",
  47395. coords: figureCoords,
  47396. colors: figureColors,
  47397. verticesPerRow
  47398. };
  47399. }
  47400. _updateBounds() {
  47401. let minX = this.coords[0][0],
  47402. minY = this.coords[0][1],
  47403. maxX = minX,
  47404. maxY = minY;
  47405. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  47406. const x = this.coords[i][0],
  47407. y = this.coords[i][1];
  47408. minX = minX > x ? x : minX;
  47409. minY = minY > y ? y : minY;
  47410. maxX = maxX < x ? x : maxX;
  47411. maxY = maxY < y ? y : maxY;
  47412. }
  47413. this.bounds = [minX, minY, maxX, maxY];
  47414. }
  47415. _packData() {
  47416. let i, ii, j, jj;
  47417. const coords = this.coords;
  47418. const coordsPacked = new Float32Array(coords.length * 2);
  47419. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  47420. const xy = coords[i];
  47421. coordsPacked[j++] = xy[0];
  47422. coordsPacked[j++] = xy[1];
  47423. }
  47424. this.coords = coordsPacked;
  47425. const colors = this.colors;
  47426. const colorsPacked = new Uint8Array(colors.length * 3);
  47427. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  47428. const c = colors[i];
  47429. colorsPacked[j++] = c[0];
  47430. colorsPacked[j++] = c[1];
  47431. colorsPacked[j++] = c[2];
  47432. }
  47433. this.colors = colorsPacked;
  47434. const figures = this.figures;
  47435. for (i = 0, ii = figures.length; i < ii; i++) {
  47436. const figure = figures[i],
  47437. ps = figure.coords,
  47438. cs = figure.colors;
  47439. for (j = 0, jj = ps.length; j < jj; j++) {
  47440. ps[j] *= 2;
  47441. cs[j] *= 3;
  47442. }
  47443. }
  47444. }
  47445. getIR() {
  47446. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  47447. }
  47448. }
  47449. class DummyShading extends BaseShading {
  47450. getIR() {
  47451. return ["Dummy"];
  47452. }
  47453. }
  47454. function getTilingPatternIR(operatorList, dict, color) {
  47455. const matrix = dict.getArray("Matrix");
  47456. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  47457. const xstep = dict.get("XStep");
  47458. const ystep = dict.get("YStep");
  47459. const paintType = dict.get("PaintType");
  47460. const tilingType = dict.get("TilingType");
  47461. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  47462. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  47463. }
  47464. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  47465. }
  47466. /***/ }),
  47467. /* 180 */
  47468. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47469. "use strict";
  47470. Object.defineProperty(exports, "__esModule", ({
  47471. value: true
  47472. }));
  47473. exports.getXfaFontDict = getXfaFontDict;
  47474. exports.getXfaFontName = getXfaFontName;
  47475. var _calibri_factors = __w_pdfjs_require__(181);
  47476. var _primitives = __w_pdfjs_require__(134);
  47477. var _helvetica_factors = __w_pdfjs_require__(182);
  47478. var _liberationsans_widths = __w_pdfjs_require__(183);
  47479. var _myriadpro_factors = __w_pdfjs_require__(184);
  47480. var _segoeui_factors = __w_pdfjs_require__(185);
  47481. var _core_utils = __w_pdfjs_require__(135);
  47482. var _fonts_utils = __w_pdfjs_require__(167);
  47483. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  47484. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  47485. name: "LiberationSans-Regular",
  47486. factors: _myriadpro_factors.MyriadProRegularFactors,
  47487. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47488. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47489. metrics: _myriadpro_factors.MyriadProRegularMetrics
  47490. };
  47491. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  47492. name: "LiberationSans-Bold",
  47493. factors: _myriadpro_factors.MyriadProBoldFactors,
  47494. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47495. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47496. metrics: _myriadpro_factors.MyriadProBoldMetrics
  47497. };
  47498. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  47499. name: "LiberationSans-Italic",
  47500. factors: _myriadpro_factors.MyriadProItalicFactors,
  47501. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47502. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47503. metrics: _myriadpro_factors.MyriadProItalicMetrics
  47504. };
  47505. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  47506. name: "LiberationSans-BoldItalic",
  47507. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  47508. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47509. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47510. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  47511. };
  47512. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  47513. name: "LiberationSans-Regular",
  47514. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47515. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  47516. };
  47517. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  47518. name: "LiberationSans-Bold",
  47519. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47520. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  47521. };
  47522. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  47523. name: "LiberationSans-Italic",
  47524. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47525. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  47526. };
  47527. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  47528. name: "LiberationSans-BoldItalic",
  47529. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47530. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  47531. };
  47532. t["Calibri-Regular"] = {
  47533. name: "LiberationSans-Regular",
  47534. factors: _calibri_factors.CalibriRegularFactors,
  47535. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47536. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47537. metrics: _calibri_factors.CalibriRegularMetrics
  47538. };
  47539. t["Calibri-Bold"] = {
  47540. name: "LiberationSans-Bold",
  47541. factors: _calibri_factors.CalibriBoldFactors,
  47542. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47543. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47544. metrics: _calibri_factors.CalibriBoldMetrics
  47545. };
  47546. t["Calibri-Italic"] = {
  47547. name: "LiberationSans-Italic",
  47548. factors: _calibri_factors.CalibriItalicFactors,
  47549. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47550. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47551. metrics: _calibri_factors.CalibriItalicMetrics
  47552. };
  47553. t["Calibri-BoldItalic"] = {
  47554. name: "LiberationSans-BoldItalic",
  47555. factors: _calibri_factors.CalibriBoldItalicFactors,
  47556. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47557. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47558. metrics: _calibri_factors.CalibriBoldItalicMetrics
  47559. };
  47560. t["Segoeui-Regular"] = {
  47561. name: "LiberationSans-Regular",
  47562. factors: _segoeui_factors.SegoeuiRegularFactors,
  47563. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47564. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47565. metrics: _segoeui_factors.SegoeuiRegularMetrics
  47566. };
  47567. t["Segoeui-Bold"] = {
  47568. name: "LiberationSans-Bold",
  47569. factors: _segoeui_factors.SegoeuiBoldFactors,
  47570. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47571. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47572. metrics: _segoeui_factors.SegoeuiBoldMetrics
  47573. };
  47574. t["Segoeui-Italic"] = {
  47575. name: "LiberationSans-Italic",
  47576. factors: _segoeui_factors.SegoeuiItalicFactors,
  47577. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47578. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47579. metrics: _segoeui_factors.SegoeuiItalicMetrics
  47580. };
  47581. t["Segoeui-BoldItalic"] = {
  47582. name: "LiberationSans-BoldItalic",
  47583. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  47584. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47585. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47586. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  47587. };
  47588. t["Helvetica-Regular"] = t.Helvetica = {
  47589. name: "LiberationSans-Regular",
  47590. factors: _helvetica_factors.HelveticaRegularFactors,
  47591. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47592. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47593. metrics: _helvetica_factors.HelveticaRegularMetrics
  47594. };
  47595. t["Helvetica-Bold"] = {
  47596. name: "LiberationSans-Bold",
  47597. factors: _helvetica_factors.HelveticaBoldFactors,
  47598. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47599. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47600. metrics: _helvetica_factors.HelveticaBoldMetrics
  47601. };
  47602. t["Helvetica-Italic"] = {
  47603. name: "LiberationSans-Italic",
  47604. factors: _helvetica_factors.HelveticaItalicFactors,
  47605. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47606. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47607. metrics: _helvetica_factors.HelveticaItalicMetrics
  47608. };
  47609. t["Helvetica-BoldItalic"] = {
  47610. name: "LiberationSans-BoldItalic",
  47611. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  47612. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47613. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47614. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  47615. };
  47616. });
  47617. function getXfaFontName(name) {
  47618. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  47619. const fontMap = getXFAFontMap();
  47620. return fontMap[fontName];
  47621. }
  47622. function getXfaFontWidths(name) {
  47623. const info = getXfaFontName(name);
  47624. if (!info) {
  47625. return null;
  47626. }
  47627. const {
  47628. baseWidths,
  47629. baseMapping,
  47630. factors
  47631. } = info;
  47632. let rescaledBaseWidths;
  47633. if (!factors) {
  47634. rescaledBaseWidths = baseWidths;
  47635. } else {
  47636. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  47637. }
  47638. let currentCode = -2;
  47639. let currentArray;
  47640. const newWidths = [];
  47641. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort((_ref, _ref2) => {
  47642. let [unicode1] = _ref;
  47643. let [unicode2] = _ref2;
  47644. return unicode1 - unicode2;
  47645. })) {
  47646. if (unicode === -1) {
  47647. continue;
  47648. }
  47649. if (unicode === currentCode + 1) {
  47650. currentArray.push(rescaledBaseWidths[glyphIndex]);
  47651. currentCode += 1;
  47652. } else {
  47653. currentCode = unicode;
  47654. currentArray = [rescaledBaseWidths[glyphIndex]];
  47655. newWidths.push(unicode, currentArray);
  47656. }
  47657. }
  47658. return newWidths;
  47659. }
  47660. function getXfaFontDict(name) {
  47661. const widths = getXfaFontWidths(name);
  47662. const dict = new _primitives.Dict(null);
  47663. dict.set("BaseFont", _primitives.Name.get(name));
  47664. dict.set("Type", _primitives.Name.get("Font"));
  47665. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  47666. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  47667. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  47668. dict.set("W", widths);
  47669. dict.set("FirstChar", widths[0]);
  47670. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  47671. const descriptor = new _primitives.Dict(null);
  47672. dict.set("FontDescriptor", descriptor);
  47673. const systemInfo = new _primitives.Dict(null);
  47674. systemInfo.set("Ordering", "Identity");
  47675. systemInfo.set("Registry", "Adobe");
  47676. systemInfo.set("Supplement", 0);
  47677. dict.set("CIDSystemInfo", systemInfo);
  47678. return dict;
  47679. }
  47680. /***/ }),
  47681. /* 181 */
  47682. /***/ ((__unused_webpack_module, exports) => {
  47683. "use strict";
  47684. Object.defineProperty(exports, "__esModule", ({
  47685. value: true
  47686. }));
  47687. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  47688. 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];
  47689. exports.CalibriBoldFactors = CalibriBoldFactors;
  47690. const CalibriBoldMetrics = {
  47691. lineHeight: 1.2207,
  47692. lineGap: 0.2207
  47693. };
  47694. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  47695. 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];
  47696. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  47697. const CalibriBoldItalicMetrics = {
  47698. lineHeight: 1.2207,
  47699. lineGap: 0.2207
  47700. };
  47701. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  47702. 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];
  47703. exports.CalibriItalicFactors = CalibriItalicFactors;
  47704. const CalibriItalicMetrics = {
  47705. lineHeight: 1.2207,
  47706. lineGap: 0.2207
  47707. };
  47708. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  47709. 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];
  47710. exports.CalibriRegularFactors = CalibriRegularFactors;
  47711. const CalibriRegularMetrics = {
  47712. lineHeight: 1.2207,
  47713. lineGap: 0.2207
  47714. };
  47715. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  47716. /***/ }),
  47717. /* 182 */
  47718. /***/ ((__unused_webpack_module, exports) => {
  47719. "use strict";
  47720. Object.defineProperty(exports, "__esModule", ({
  47721. value: true
  47722. }));
  47723. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  47724. 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];
  47725. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  47726. const HelveticaBoldMetrics = {
  47727. lineHeight: 1.2,
  47728. lineGap: 0.2
  47729. };
  47730. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  47731. 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];
  47732. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  47733. const HelveticaBoldItalicMetrics = {
  47734. lineHeight: 1.35,
  47735. lineGap: 0.2
  47736. };
  47737. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  47738. 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];
  47739. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  47740. const HelveticaItalicMetrics = {
  47741. lineHeight: 1.35,
  47742. lineGap: 0.2
  47743. };
  47744. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  47745. 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];
  47746. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  47747. const HelveticaRegularMetrics = {
  47748. lineHeight: 1.2,
  47749. lineGap: 0.2
  47750. };
  47751. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  47752. /***/ }),
  47753. /* 183 */
  47754. /***/ ((__unused_webpack_module, exports) => {
  47755. "use strict";
  47756. Object.defineProperty(exports, "__esModule", ({
  47757. value: true
  47758. }));
  47759. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  47760. 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];
  47761. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  47762. 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];
  47763. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  47764. 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];
  47765. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  47766. 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];
  47767. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  47768. 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];
  47769. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  47770. 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];
  47771. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  47772. 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];
  47773. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  47774. 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];
  47775. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  47776. /***/ }),
  47777. /* 184 */
  47778. /***/ ((__unused_webpack_module, exports) => {
  47779. "use strict";
  47780. Object.defineProperty(exports, "__esModule", ({
  47781. value: true
  47782. }));
  47783. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  47784. 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];
  47785. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  47786. const MyriadProBoldMetrics = {
  47787. lineHeight: 1.2,
  47788. lineGap: 0.2
  47789. };
  47790. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  47791. 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];
  47792. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  47793. const MyriadProBoldItalicMetrics = {
  47794. lineHeight: 1.2,
  47795. lineGap: 0.2
  47796. };
  47797. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  47798. 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];
  47799. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  47800. const MyriadProItalicMetrics = {
  47801. lineHeight: 1.2,
  47802. lineGap: 0.2
  47803. };
  47804. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  47805. 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];
  47806. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  47807. const MyriadProRegularMetrics = {
  47808. lineHeight: 1.2,
  47809. lineGap: 0.2
  47810. };
  47811. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  47812. /***/ }),
  47813. /* 185 */
  47814. /***/ ((__unused_webpack_module, exports) => {
  47815. "use strict";
  47816. Object.defineProperty(exports, "__esModule", ({
  47817. value: true
  47818. }));
  47819. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  47820. 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];
  47821. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  47822. const SegoeuiBoldMetrics = {
  47823. lineHeight: 1.33008,
  47824. lineGap: 0
  47825. };
  47826. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  47827. 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];
  47828. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  47829. const SegoeuiBoldItalicMetrics = {
  47830. lineHeight: 1.33008,
  47831. lineGap: 0
  47832. };
  47833. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  47834. 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];
  47835. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  47836. const SegoeuiItalicMetrics = {
  47837. lineHeight: 1.33008,
  47838. lineGap: 0
  47839. };
  47840. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  47841. 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];
  47842. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  47843. const SegoeuiRegularMetrics = {
  47844. lineHeight: 1.33008,
  47845. lineGap: 0
  47846. };
  47847. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  47848. /***/ }),
  47849. /* 186 */
  47850. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47851. "use strict";
  47852. Object.defineProperty(exports, "__esModule", ({
  47853. value: true
  47854. }));
  47855. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  47856. exports.isPDFFunction = isPDFFunction;
  47857. var _primitives = __w_pdfjs_require__(134);
  47858. var _util = __w_pdfjs_require__(2);
  47859. var _ps_parser = __w_pdfjs_require__(187);
  47860. var _base_stream = __w_pdfjs_require__(136);
  47861. var _image_utils = __w_pdfjs_require__(188);
  47862. class PDFFunctionFactory {
  47863. constructor(_ref) {
  47864. let {
  47865. xref,
  47866. isEvalSupported = true
  47867. } = _ref;
  47868. this.xref = xref;
  47869. this.isEvalSupported = isEvalSupported !== false;
  47870. }
  47871. create(fn) {
  47872. const cachedFunction = this.getCached(fn);
  47873. if (cachedFunction) {
  47874. return cachedFunction;
  47875. }
  47876. const parsedFunction = PDFFunction.parse({
  47877. xref: this.xref,
  47878. isEvalSupported: this.isEvalSupported,
  47879. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  47880. });
  47881. this._cache(fn, parsedFunction);
  47882. return parsedFunction;
  47883. }
  47884. createFromArray(fnObj) {
  47885. const cachedFunction = this.getCached(fnObj);
  47886. if (cachedFunction) {
  47887. return cachedFunction;
  47888. }
  47889. const parsedFunction = PDFFunction.parseArray({
  47890. xref: this.xref,
  47891. isEvalSupported: this.isEvalSupported,
  47892. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  47893. });
  47894. this._cache(fnObj, parsedFunction);
  47895. return parsedFunction;
  47896. }
  47897. getCached(cacheKey) {
  47898. let fnRef;
  47899. if (cacheKey instanceof _primitives.Ref) {
  47900. fnRef = cacheKey;
  47901. } else if (cacheKey instanceof _primitives.Dict) {
  47902. fnRef = cacheKey.objId;
  47903. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47904. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47905. }
  47906. if (fnRef) {
  47907. const localFunction = this._localFunctionCache.getByRef(fnRef);
  47908. if (localFunction) {
  47909. return localFunction;
  47910. }
  47911. }
  47912. return null;
  47913. }
  47914. _cache(cacheKey, parsedFunction) {
  47915. if (!parsedFunction) {
  47916. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  47917. }
  47918. let fnRef;
  47919. if (cacheKey instanceof _primitives.Ref) {
  47920. fnRef = cacheKey;
  47921. } else if (cacheKey instanceof _primitives.Dict) {
  47922. fnRef = cacheKey.objId;
  47923. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47924. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47925. }
  47926. if (fnRef) {
  47927. this._localFunctionCache.set(null, fnRef, parsedFunction);
  47928. }
  47929. }
  47930. get _localFunctionCache() {
  47931. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  47932. }
  47933. }
  47934. exports.PDFFunctionFactory = PDFFunctionFactory;
  47935. function toNumberArray(arr) {
  47936. if (!Array.isArray(arr)) {
  47937. return null;
  47938. }
  47939. const length = arr.length;
  47940. for (let i = 0; i < length; i++) {
  47941. if (typeof arr[i] !== "number") {
  47942. const result = new Array(length);
  47943. for (let j = 0; j < length; j++) {
  47944. result[j] = +arr[j];
  47945. }
  47946. return result;
  47947. }
  47948. }
  47949. return arr;
  47950. }
  47951. class PDFFunction {
  47952. static getSampleArray(size, outputSize, bps, stream) {
  47953. let i, ii;
  47954. let length = 1;
  47955. for (i = 0, ii = size.length; i < ii; i++) {
  47956. length *= size[i];
  47957. }
  47958. length *= outputSize;
  47959. const array = new Array(length);
  47960. let codeSize = 0;
  47961. let codeBuf = 0;
  47962. const sampleMul = 1.0 / (2.0 ** bps - 1);
  47963. const strBytes = stream.getBytes((length * bps + 7) / 8);
  47964. let strIdx = 0;
  47965. for (i = 0; i < length; i++) {
  47966. while (codeSize < bps) {
  47967. codeBuf <<= 8;
  47968. codeBuf |= strBytes[strIdx++];
  47969. codeSize += 8;
  47970. }
  47971. codeSize -= bps;
  47972. array[i] = (codeBuf >> codeSize) * sampleMul;
  47973. codeBuf &= (1 << codeSize) - 1;
  47974. }
  47975. return array;
  47976. }
  47977. static parse(_ref2) {
  47978. let {
  47979. xref,
  47980. isEvalSupported,
  47981. fn
  47982. } = _ref2;
  47983. const dict = fn.dict || fn;
  47984. const typeNum = dict.get("FunctionType");
  47985. switch (typeNum) {
  47986. case 0:
  47987. return this.constructSampled({
  47988. xref,
  47989. isEvalSupported,
  47990. fn,
  47991. dict
  47992. });
  47993. case 1:
  47994. break;
  47995. case 2:
  47996. return this.constructInterpolated({
  47997. xref,
  47998. isEvalSupported,
  47999. dict
  48000. });
  48001. case 3:
  48002. return this.constructStiched({
  48003. xref,
  48004. isEvalSupported,
  48005. dict
  48006. });
  48007. case 4:
  48008. return this.constructPostScript({
  48009. xref,
  48010. isEvalSupported,
  48011. fn,
  48012. dict
  48013. });
  48014. }
  48015. throw new _util.FormatError("Unknown type of function");
  48016. }
  48017. static parseArray(_ref3) {
  48018. let {
  48019. xref,
  48020. isEvalSupported,
  48021. fnObj
  48022. } = _ref3;
  48023. if (!Array.isArray(fnObj)) {
  48024. return this.parse({
  48025. xref,
  48026. isEvalSupported,
  48027. fn: fnObj
  48028. });
  48029. }
  48030. const fnArray = [];
  48031. for (const fn of fnObj) {
  48032. fnArray.push(this.parse({
  48033. xref,
  48034. isEvalSupported,
  48035. fn: xref.fetchIfRef(fn)
  48036. }));
  48037. }
  48038. return function (src, srcOffset, dest, destOffset) {
  48039. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  48040. fnArray[i](src, srcOffset, dest, destOffset + i);
  48041. }
  48042. };
  48043. }
  48044. static constructSampled(_ref4) {
  48045. let {
  48046. xref,
  48047. isEvalSupported,
  48048. fn,
  48049. dict
  48050. } = _ref4;
  48051. function toMultiArray(arr) {
  48052. const inputLength = arr.length;
  48053. const out = [];
  48054. let index = 0;
  48055. for (let i = 0; i < inputLength; i += 2) {
  48056. out[index++] = [arr[i], arr[i + 1]];
  48057. }
  48058. return out;
  48059. }
  48060. function interpolate(x, xmin, xmax, ymin, ymax) {
  48061. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  48062. }
  48063. let domain = toNumberArray(dict.getArray("Domain"));
  48064. let range = toNumberArray(dict.getArray("Range"));
  48065. if (!domain || !range) {
  48066. throw new _util.FormatError("No domain or range");
  48067. }
  48068. const inputSize = domain.length / 2;
  48069. const outputSize = range.length / 2;
  48070. domain = toMultiArray(domain);
  48071. range = toMultiArray(range);
  48072. const size = toNumberArray(dict.getArray("Size"));
  48073. const bps = dict.get("BitsPerSample");
  48074. const order = dict.get("Order") || 1;
  48075. if (order !== 1) {
  48076. (0, _util.info)("No support for cubic spline interpolation: " + order);
  48077. }
  48078. let encode = toNumberArray(dict.getArray("Encode"));
  48079. if (!encode) {
  48080. encode = [];
  48081. for (let i = 0; i < inputSize; ++i) {
  48082. encode.push([0, size[i] - 1]);
  48083. }
  48084. } else {
  48085. encode = toMultiArray(encode);
  48086. }
  48087. let decode = toNumberArray(dict.getArray("Decode"));
  48088. if (!decode) {
  48089. decode = range;
  48090. } else {
  48091. decode = toMultiArray(decode);
  48092. }
  48093. const samples = this.getSampleArray(size, outputSize, bps, fn);
  48094. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  48095. const cubeVertices = 1 << inputSize;
  48096. const cubeN = new Float64Array(cubeVertices);
  48097. const cubeVertex = new Uint32Array(cubeVertices);
  48098. let i, j;
  48099. for (j = 0; j < cubeVertices; j++) {
  48100. cubeN[j] = 1;
  48101. }
  48102. let k = outputSize,
  48103. pos = 1;
  48104. for (i = 0; i < inputSize; ++i) {
  48105. const domain_2i = domain[i][0];
  48106. const domain_2i_1 = domain[i][1];
  48107. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  48108. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  48109. const size_i = size[i];
  48110. e = Math.min(Math.max(e, 0), size_i - 1);
  48111. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  48112. const n0 = e0 + 1 - e;
  48113. const n1 = e - e0;
  48114. const offset0 = e0 * k;
  48115. const offset1 = offset0 + k;
  48116. for (j = 0; j < cubeVertices; j++) {
  48117. if (j & pos) {
  48118. cubeN[j] *= n1;
  48119. cubeVertex[j] += offset1;
  48120. } else {
  48121. cubeN[j] *= n0;
  48122. cubeVertex[j] += offset0;
  48123. }
  48124. }
  48125. k *= size_i;
  48126. pos <<= 1;
  48127. }
  48128. for (j = 0; j < outputSize; ++j) {
  48129. let rj = 0;
  48130. for (i = 0; i < cubeVertices; i++) {
  48131. rj += samples[cubeVertex[i] + j] * cubeN[i];
  48132. }
  48133. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  48134. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  48135. }
  48136. };
  48137. }
  48138. static constructInterpolated(_ref5) {
  48139. let {
  48140. xref,
  48141. isEvalSupported,
  48142. dict
  48143. } = _ref5;
  48144. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  48145. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  48146. const n = dict.get("N");
  48147. const diff = [];
  48148. for (let i = 0, ii = c0.length; i < ii; ++i) {
  48149. diff.push(c1[i] - c0[i]);
  48150. }
  48151. const length = diff.length;
  48152. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  48153. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  48154. for (let j = 0; j < length; ++j) {
  48155. dest[destOffset + j] = c0[j] + x * diff[j];
  48156. }
  48157. };
  48158. }
  48159. static constructStiched(_ref6) {
  48160. let {
  48161. xref,
  48162. isEvalSupported,
  48163. dict
  48164. } = _ref6;
  48165. const domain = toNumberArray(dict.getArray("Domain"));
  48166. if (!domain) {
  48167. throw new _util.FormatError("No domain");
  48168. }
  48169. const inputSize = domain.length / 2;
  48170. if (inputSize !== 1) {
  48171. throw new _util.FormatError("Bad domain for stiched function");
  48172. }
  48173. const fns = [];
  48174. for (const fn of dict.get("Functions")) {
  48175. fns.push(this.parse({
  48176. xref,
  48177. isEvalSupported,
  48178. fn: xref.fetchIfRef(fn)
  48179. }));
  48180. }
  48181. const bounds = toNumberArray(dict.getArray("Bounds"));
  48182. const encode = toNumberArray(dict.getArray("Encode"));
  48183. const tmpBuf = new Float32Array(1);
  48184. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  48185. const clip = function constructStichedFromIRClip(v, min, max) {
  48186. if (v > max) {
  48187. v = max;
  48188. } else if (v < min) {
  48189. v = min;
  48190. }
  48191. return v;
  48192. };
  48193. const v = clip(src[srcOffset], domain[0], domain[1]);
  48194. const length = bounds.length;
  48195. let i;
  48196. for (i = 0; i < length; ++i) {
  48197. if (v < bounds[i]) {
  48198. break;
  48199. }
  48200. }
  48201. let dmin = domain[0];
  48202. if (i > 0) {
  48203. dmin = bounds[i - 1];
  48204. }
  48205. let dmax = domain[1];
  48206. if (i < bounds.length) {
  48207. dmax = bounds[i];
  48208. }
  48209. const rmin = encode[2 * i];
  48210. const rmax = encode[2 * i + 1];
  48211. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  48212. fns[i](tmpBuf, 0, dest, destOffset);
  48213. };
  48214. }
  48215. static constructPostScript(_ref7) {
  48216. let {
  48217. xref,
  48218. isEvalSupported,
  48219. fn,
  48220. dict
  48221. } = _ref7;
  48222. const domain = toNumberArray(dict.getArray("Domain"));
  48223. const range = toNumberArray(dict.getArray("Range"));
  48224. if (!domain) {
  48225. throw new _util.FormatError("No domain.");
  48226. }
  48227. if (!range) {
  48228. throw new _util.FormatError("No range.");
  48229. }
  48230. const lexer = new _ps_parser.PostScriptLexer(fn);
  48231. const parser = new _ps_parser.PostScriptParser(lexer);
  48232. const code = parser.parse();
  48233. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  48234. const compiled = new PostScriptCompiler().compile(code, domain, range);
  48235. if (compiled) {
  48236. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  48237. }
  48238. }
  48239. (0, _util.info)("Unable to compile PS function");
  48240. const numOutputs = range.length >> 1;
  48241. const numInputs = domain.length >> 1;
  48242. const evaluator = new PostScriptEvaluator(code);
  48243. const cache = Object.create(null);
  48244. const MAX_CACHE_SIZE = 2048 * 4;
  48245. let cache_available = MAX_CACHE_SIZE;
  48246. const tmpBuf = new Float32Array(numInputs);
  48247. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  48248. let i, value;
  48249. let key = "";
  48250. const input = tmpBuf;
  48251. for (i = 0; i < numInputs; i++) {
  48252. value = src[srcOffset + i];
  48253. input[i] = value;
  48254. key += value + "_";
  48255. }
  48256. const cachedValue = cache[key];
  48257. if (cachedValue !== undefined) {
  48258. dest.set(cachedValue, destOffset);
  48259. return;
  48260. }
  48261. const output = new Float32Array(numOutputs);
  48262. const stack = evaluator.execute(input);
  48263. const stackIndex = stack.length - numOutputs;
  48264. for (i = 0; i < numOutputs; i++) {
  48265. value = stack[stackIndex + i];
  48266. let bound = range[i * 2];
  48267. if (value < bound) {
  48268. value = bound;
  48269. } else {
  48270. bound = range[i * 2 + 1];
  48271. if (value > bound) {
  48272. value = bound;
  48273. }
  48274. }
  48275. output[i] = value;
  48276. }
  48277. if (cache_available > 0) {
  48278. cache_available--;
  48279. cache[key] = output;
  48280. }
  48281. dest.set(output, destOffset);
  48282. };
  48283. }
  48284. }
  48285. function isPDFFunction(v) {
  48286. let fnDict;
  48287. if (typeof v !== "object") {
  48288. return false;
  48289. } else if (v instanceof _primitives.Dict) {
  48290. fnDict = v;
  48291. } else if (v instanceof _base_stream.BaseStream) {
  48292. fnDict = v.dict;
  48293. } else {
  48294. return false;
  48295. }
  48296. return fnDict.has("FunctionType");
  48297. }
  48298. class PostScriptStack {
  48299. static get MAX_STACK_SIZE() {
  48300. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  48301. }
  48302. constructor(initialStack) {
  48303. this.stack = initialStack ? Array.from(initialStack) : [];
  48304. }
  48305. push(value) {
  48306. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  48307. throw new Error("PostScript function stack overflow.");
  48308. }
  48309. this.stack.push(value);
  48310. }
  48311. pop() {
  48312. if (this.stack.length <= 0) {
  48313. throw new Error("PostScript function stack underflow.");
  48314. }
  48315. return this.stack.pop();
  48316. }
  48317. copy(n) {
  48318. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  48319. throw new Error("PostScript function stack overflow.");
  48320. }
  48321. const stack = this.stack;
  48322. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  48323. stack.push(stack[i]);
  48324. }
  48325. }
  48326. index(n) {
  48327. this.push(this.stack[this.stack.length - n - 1]);
  48328. }
  48329. roll(n, p) {
  48330. const stack = this.stack;
  48331. const l = stack.length - n;
  48332. const r = stack.length - 1;
  48333. const c = l + (p - Math.floor(p / n) * n);
  48334. for (let i = l, j = r; i < j; i++, j--) {
  48335. const t = stack[i];
  48336. stack[i] = stack[j];
  48337. stack[j] = t;
  48338. }
  48339. for (let i = l, j = c - 1; i < j; i++, j--) {
  48340. const t = stack[i];
  48341. stack[i] = stack[j];
  48342. stack[j] = t;
  48343. }
  48344. for (let i = c, j = r; i < j; i++, j--) {
  48345. const t = stack[i];
  48346. stack[i] = stack[j];
  48347. stack[j] = t;
  48348. }
  48349. }
  48350. }
  48351. class PostScriptEvaluator {
  48352. constructor(operators) {
  48353. this.operators = operators;
  48354. }
  48355. execute(initialStack) {
  48356. const stack = new PostScriptStack(initialStack);
  48357. let counter = 0;
  48358. const operators = this.operators;
  48359. const length = operators.length;
  48360. let operator, a, b;
  48361. while (counter < length) {
  48362. operator = operators[counter++];
  48363. if (typeof operator === "number") {
  48364. stack.push(operator);
  48365. continue;
  48366. }
  48367. switch (operator) {
  48368. case "jz":
  48369. b = stack.pop();
  48370. a = stack.pop();
  48371. if (!a) {
  48372. counter = b;
  48373. }
  48374. break;
  48375. case "j":
  48376. a = stack.pop();
  48377. counter = a;
  48378. break;
  48379. case "abs":
  48380. a = stack.pop();
  48381. stack.push(Math.abs(a));
  48382. break;
  48383. case "add":
  48384. b = stack.pop();
  48385. a = stack.pop();
  48386. stack.push(a + b);
  48387. break;
  48388. case "and":
  48389. b = stack.pop();
  48390. a = stack.pop();
  48391. if (typeof a === "boolean" && typeof b === "boolean") {
  48392. stack.push(a && b);
  48393. } else {
  48394. stack.push(a & b);
  48395. }
  48396. break;
  48397. case "atan":
  48398. a = stack.pop();
  48399. stack.push(Math.atan(a));
  48400. break;
  48401. case "bitshift":
  48402. b = stack.pop();
  48403. a = stack.pop();
  48404. if (a > 0) {
  48405. stack.push(a << b);
  48406. } else {
  48407. stack.push(a >> b);
  48408. }
  48409. break;
  48410. case "ceiling":
  48411. a = stack.pop();
  48412. stack.push(Math.ceil(a));
  48413. break;
  48414. case "copy":
  48415. a = stack.pop();
  48416. stack.copy(a);
  48417. break;
  48418. case "cos":
  48419. a = stack.pop();
  48420. stack.push(Math.cos(a));
  48421. break;
  48422. case "cvi":
  48423. a = stack.pop() | 0;
  48424. stack.push(a);
  48425. break;
  48426. case "cvr":
  48427. break;
  48428. case "div":
  48429. b = stack.pop();
  48430. a = stack.pop();
  48431. stack.push(a / b);
  48432. break;
  48433. case "dup":
  48434. stack.copy(1);
  48435. break;
  48436. case "eq":
  48437. b = stack.pop();
  48438. a = stack.pop();
  48439. stack.push(a === b);
  48440. break;
  48441. case "exch":
  48442. stack.roll(2, 1);
  48443. break;
  48444. case "exp":
  48445. b = stack.pop();
  48446. a = stack.pop();
  48447. stack.push(a ** b);
  48448. break;
  48449. case "false":
  48450. stack.push(false);
  48451. break;
  48452. case "floor":
  48453. a = stack.pop();
  48454. stack.push(Math.floor(a));
  48455. break;
  48456. case "ge":
  48457. b = stack.pop();
  48458. a = stack.pop();
  48459. stack.push(a >= b);
  48460. break;
  48461. case "gt":
  48462. b = stack.pop();
  48463. a = stack.pop();
  48464. stack.push(a > b);
  48465. break;
  48466. case "idiv":
  48467. b = stack.pop();
  48468. a = stack.pop();
  48469. stack.push(a / b | 0);
  48470. break;
  48471. case "index":
  48472. a = stack.pop();
  48473. stack.index(a);
  48474. break;
  48475. case "le":
  48476. b = stack.pop();
  48477. a = stack.pop();
  48478. stack.push(a <= b);
  48479. break;
  48480. case "ln":
  48481. a = stack.pop();
  48482. stack.push(Math.log(a));
  48483. break;
  48484. case "log":
  48485. a = stack.pop();
  48486. stack.push(Math.log(a) / Math.LN10);
  48487. break;
  48488. case "lt":
  48489. b = stack.pop();
  48490. a = stack.pop();
  48491. stack.push(a < b);
  48492. break;
  48493. case "mod":
  48494. b = stack.pop();
  48495. a = stack.pop();
  48496. stack.push(a % b);
  48497. break;
  48498. case "mul":
  48499. b = stack.pop();
  48500. a = stack.pop();
  48501. stack.push(a * b);
  48502. break;
  48503. case "ne":
  48504. b = stack.pop();
  48505. a = stack.pop();
  48506. stack.push(a !== b);
  48507. break;
  48508. case "neg":
  48509. a = stack.pop();
  48510. stack.push(-a);
  48511. break;
  48512. case "not":
  48513. a = stack.pop();
  48514. if (typeof a === "boolean") {
  48515. stack.push(!a);
  48516. } else {
  48517. stack.push(~a);
  48518. }
  48519. break;
  48520. case "or":
  48521. b = stack.pop();
  48522. a = stack.pop();
  48523. if (typeof a === "boolean" && typeof b === "boolean") {
  48524. stack.push(a || b);
  48525. } else {
  48526. stack.push(a | b);
  48527. }
  48528. break;
  48529. case "pop":
  48530. stack.pop();
  48531. break;
  48532. case "roll":
  48533. b = stack.pop();
  48534. a = stack.pop();
  48535. stack.roll(a, b);
  48536. break;
  48537. case "round":
  48538. a = stack.pop();
  48539. stack.push(Math.round(a));
  48540. break;
  48541. case "sin":
  48542. a = stack.pop();
  48543. stack.push(Math.sin(a));
  48544. break;
  48545. case "sqrt":
  48546. a = stack.pop();
  48547. stack.push(Math.sqrt(a));
  48548. break;
  48549. case "sub":
  48550. b = stack.pop();
  48551. a = stack.pop();
  48552. stack.push(a - b);
  48553. break;
  48554. case "true":
  48555. stack.push(true);
  48556. break;
  48557. case "truncate":
  48558. a = stack.pop();
  48559. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  48560. stack.push(a);
  48561. break;
  48562. case "xor":
  48563. b = stack.pop();
  48564. a = stack.pop();
  48565. if (typeof a === "boolean" && typeof b === "boolean") {
  48566. stack.push(a !== b);
  48567. } else {
  48568. stack.push(a ^ b);
  48569. }
  48570. break;
  48571. default:
  48572. throw new _util.FormatError(`Unknown operator ${operator}`);
  48573. }
  48574. }
  48575. return stack.stack;
  48576. }
  48577. }
  48578. exports.PostScriptEvaluator = PostScriptEvaluator;
  48579. class AstNode {
  48580. constructor(type) {
  48581. this.type = type;
  48582. }
  48583. visit(visitor) {
  48584. (0, _util.unreachable)("abstract method");
  48585. }
  48586. }
  48587. class AstArgument extends AstNode {
  48588. constructor(index, min, max) {
  48589. super("args");
  48590. this.index = index;
  48591. this.min = min;
  48592. this.max = max;
  48593. }
  48594. visit(visitor) {
  48595. visitor.visitArgument(this);
  48596. }
  48597. }
  48598. class AstLiteral extends AstNode {
  48599. constructor(number) {
  48600. super("literal");
  48601. this.number = number;
  48602. this.min = number;
  48603. this.max = number;
  48604. }
  48605. visit(visitor) {
  48606. visitor.visitLiteral(this);
  48607. }
  48608. }
  48609. class AstBinaryOperation extends AstNode {
  48610. constructor(op, arg1, arg2, min, max) {
  48611. super("binary");
  48612. this.op = op;
  48613. this.arg1 = arg1;
  48614. this.arg2 = arg2;
  48615. this.min = min;
  48616. this.max = max;
  48617. }
  48618. visit(visitor) {
  48619. visitor.visitBinaryOperation(this);
  48620. }
  48621. }
  48622. class AstMin extends AstNode {
  48623. constructor(arg, max) {
  48624. super("max");
  48625. this.arg = arg;
  48626. this.min = arg.min;
  48627. this.max = max;
  48628. }
  48629. visit(visitor) {
  48630. visitor.visitMin(this);
  48631. }
  48632. }
  48633. class AstVariable extends AstNode {
  48634. constructor(index, min, max) {
  48635. super("var");
  48636. this.index = index;
  48637. this.min = min;
  48638. this.max = max;
  48639. }
  48640. visit(visitor) {
  48641. visitor.visitVariable(this);
  48642. }
  48643. }
  48644. class AstVariableDefinition extends AstNode {
  48645. constructor(variable, arg) {
  48646. super("definition");
  48647. this.variable = variable;
  48648. this.arg = arg;
  48649. }
  48650. visit(visitor) {
  48651. visitor.visitVariableDefinition(this);
  48652. }
  48653. }
  48654. class ExpressionBuilderVisitor {
  48655. constructor() {
  48656. this.parts = [];
  48657. }
  48658. visitArgument(arg) {
  48659. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  48660. }
  48661. visitVariable(variable) {
  48662. this.parts.push("v", variable.index);
  48663. }
  48664. visitLiteral(literal) {
  48665. this.parts.push(literal.number);
  48666. }
  48667. visitBinaryOperation(operation) {
  48668. this.parts.push("(");
  48669. operation.arg1.visit(this);
  48670. this.parts.push(" ", operation.op, " ");
  48671. operation.arg2.visit(this);
  48672. this.parts.push(")");
  48673. }
  48674. visitVariableDefinition(definition) {
  48675. this.parts.push("var ");
  48676. definition.variable.visit(this);
  48677. this.parts.push(" = ");
  48678. definition.arg.visit(this);
  48679. this.parts.push(";");
  48680. }
  48681. visitMin(max) {
  48682. this.parts.push("Math.min(");
  48683. max.arg.visit(this);
  48684. this.parts.push(", ", max.max, ")");
  48685. }
  48686. toString() {
  48687. return this.parts.join("");
  48688. }
  48689. }
  48690. function buildAddOperation(num1, num2) {
  48691. if (num2.type === "literal" && num2.number === 0) {
  48692. return num1;
  48693. }
  48694. if (num1.type === "literal" && num1.number === 0) {
  48695. return num2;
  48696. }
  48697. if (num2.type === "literal" && num1.type === "literal") {
  48698. return new AstLiteral(num1.number + num2.number);
  48699. }
  48700. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  48701. }
  48702. function buildMulOperation(num1, num2) {
  48703. if (num2.type === "literal") {
  48704. if (num2.number === 0) {
  48705. return new AstLiteral(0);
  48706. } else if (num2.number === 1) {
  48707. return num1;
  48708. } else if (num1.type === "literal") {
  48709. return new AstLiteral(num1.number * num2.number);
  48710. }
  48711. }
  48712. if (num1.type === "literal") {
  48713. if (num1.number === 0) {
  48714. return new AstLiteral(0);
  48715. } else if (num1.number === 1) {
  48716. return num2;
  48717. }
  48718. }
  48719. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48720. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48721. return new AstBinaryOperation("*", num1, num2, min, max);
  48722. }
  48723. function buildSubOperation(num1, num2) {
  48724. if (num2.type === "literal") {
  48725. if (num2.number === 0) {
  48726. return num1;
  48727. } else if (num1.type === "literal") {
  48728. return new AstLiteral(num1.number - num2.number);
  48729. }
  48730. }
  48731. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  48732. return num2.arg2;
  48733. }
  48734. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  48735. }
  48736. function buildMinOperation(num1, max) {
  48737. if (num1.min >= max) {
  48738. return new AstLiteral(max);
  48739. } else if (num1.max <= max) {
  48740. return num1;
  48741. }
  48742. return new AstMin(num1, max);
  48743. }
  48744. class PostScriptCompiler {
  48745. compile(code, domain, range) {
  48746. const stack = [];
  48747. const instructions = [];
  48748. const inputSize = domain.length >> 1,
  48749. outputSize = range.length >> 1;
  48750. let lastRegister = 0;
  48751. let n, j;
  48752. let num1, num2, ast1, ast2, tmpVar, item;
  48753. for (let i = 0; i < inputSize; i++) {
  48754. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  48755. }
  48756. for (let i = 0, ii = code.length; i < ii; i++) {
  48757. item = code[i];
  48758. if (typeof item === "number") {
  48759. stack.push(new AstLiteral(item));
  48760. continue;
  48761. }
  48762. switch (item) {
  48763. case "add":
  48764. if (stack.length < 2) {
  48765. return null;
  48766. }
  48767. num2 = stack.pop();
  48768. num1 = stack.pop();
  48769. stack.push(buildAddOperation(num1, num2));
  48770. break;
  48771. case "cvr":
  48772. if (stack.length < 1) {
  48773. return null;
  48774. }
  48775. break;
  48776. case "mul":
  48777. if (stack.length < 2) {
  48778. return null;
  48779. }
  48780. num2 = stack.pop();
  48781. num1 = stack.pop();
  48782. stack.push(buildMulOperation(num1, num2));
  48783. break;
  48784. case "sub":
  48785. if (stack.length < 2) {
  48786. return null;
  48787. }
  48788. num2 = stack.pop();
  48789. num1 = stack.pop();
  48790. stack.push(buildSubOperation(num1, num2));
  48791. break;
  48792. case "exch":
  48793. if (stack.length < 2) {
  48794. return null;
  48795. }
  48796. ast1 = stack.pop();
  48797. ast2 = stack.pop();
  48798. stack.push(ast1, ast2);
  48799. break;
  48800. case "pop":
  48801. if (stack.length < 1) {
  48802. return null;
  48803. }
  48804. stack.pop();
  48805. break;
  48806. case "index":
  48807. if (stack.length < 1) {
  48808. return null;
  48809. }
  48810. num1 = stack.pop();
  48811. if (num1.type !== "literal") {
  48812. return null;
  48813. }
  48814. n = num1.number;
  48815. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  48816. return null;
  48817. }
  48818. ast1 = stack[stack.length - n - 1];
  48819. if (ast1.type === "literal" || ast1.type === "var") {
  48820. stack.push(ast1);
  48821. break;
  48822. }
  48823. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48824. stack[stack.length - n - 1] = tmpVar;
  48825. stack.push(tmpVar);
  48826. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48827. break;
  48828. case "dup":
  48829. if (stack.length < 1) {
  48830. return null;
  48831. }
  48832. 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]) {
  48833. num1 = stack.pop();
  48834. stack.push(buildMinOperation(num1, code[i + 1]));
  48835. i += 6;
  48836. break;
  48837. }
  48838. ast1 = stack.at(-1);
  48839. if (ast1.type === "literal" || ast1.type === "var") {
  48840. stack.push(ast1);
  48841. break;
  48842. }
  48843. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48844. stack[stack.length - 1] = tmpVar;
  48845. stack.push(tmpVar);
  48846. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48847. break;
  48848. case "roll":
  48849. if (stack.length < 2) {
  48850. return null;
  48851. }
  48852. num2 = stack.pop();
  48853. num1 = stack.pop();
  48854. if (num2.type !== "literal" || num1.type !== "literal") {
  48855. return null;
  48856. }
  48857. j = num2.number;
  48858. n = num1.number;
  48859. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  48860. return null;
  48861. }
  48862. j = (j % n + n) % n;
  48863. if (j === 0) {
  48864. break;
  48865. }
  48866. stack.push(...stack.splice(stack.length - n, n - j));
  48867. break;
  48868. default:
  48869. return null;
  48870. }
  48871. }
  48872. if (stack.length !== outputSize) {
  48873. return null;
  48874. }
  48875. const result = [];
  48876. for (const instruction of instructions) {
  48877. const statementBuilder = new ExpressionBuilderVisitor();
  48878. instruction.visit(statementBuilder);
  48879. result.push(statementBuilder.toString());
  48880. }
  48881. for (let i = 0, ii = stack.length; i < ii; i++) {
  48882. const expr = stack[i],
  48883. statementBuilder = new ExpressionBuilderVisitor();
  48884. expr.visit(statementBuilder);
  48885. const min = range[i * 2],
  48886. max = range[i * 2 + 1];
  48887. const out = [statementBuilder.toString()];
  48888. if (min > expr.min) {
  48889. out.unshift("Math.max(", min, ", ");
  48890. out.push(")");
  48891. }
  48892. if (max < expr.max) {
  48893. out.unshift("Math.min(", max, ", ");
  48894. out.push(")");
  48895. }
  48896. out.unshift("dest[destOffset + ", i, "] = ");
  48897. out.push(";");
  48898. result.push(out.join(""));
  48899. }
  48900. return result.join("\n");
  48901. }
  48902. }
  48903. exports.PostScriptCompiler = PostScriptCompiler;
  48904. /***/ }),
  48905. /* 187 */
  48906. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48907. "use strict";
  48908. Object.defineProperty(exports, "__esModule", ({
  48909. value: true
  48910. }));
  48911. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  48912. var _util = __w_pdfjs_require__(2);
  48913. var _primitives = __w_pdfjs_require__(134);
  48914. var _core_utils = __w_pdfjs_require__(135);
  48915. class PostScriptParser {
  48916. constructor(lexer) {
  48917. this.lexer = lexer;
  48918. this.operators = [];
  48919. this.token = null;
  48920. this.prev = null;
  48921. }
  48922. nextToken() {
  48923. this.prev = this.token;
  48924. this.token = this.lexer.getToken();
  48925. }
  48926. accept(type) {
  48927. if (this.token.type === type) {
  48928. this.nextToken();
  48929. return true;
  48930. }
  48931. return false;
  48932. }
  48933. expect(type) {
  48934. if (this.accept(type)) {
  48935. return true;
  48936. }
  48937. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  48938. }
  48939. parse() {
  48940. this.nextToken();
  48941. this.expect(PostScriptTokenTypes.LBRACE);
  48942. this.parseBlock();
  48943. this.expect(PostScriptTokenTypes.RBRACE);
  48944. return this.operators;
  48945. }
  48946. parseBlock() {
  48947. while (true) {
  48948. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  48949. this.operators.push(this.prev.value);
  48950. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  48951. this.operators.push(this.prev.value);
  48952. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48953. this.parseCondition();
  48954. } else {
  48955. return;
  48956. }
  48957. }
  48958. }
  48959. parseCondition() {
  48960. const conditionLocation = this.operators.length;
  48961. this.operators.push(null, null);
  48962. this.parseBlock();
  48963. this.expect(PostScriptTokenTypes.RBRACE);
  48964. if (this.accept(PostScriptTokenTypes.IF)) {
  48965. this.operators[conditionLocation] = this.operators.length;
  48966. this.operators[conditionLocation + 1] = "jz";
  48967. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48968. const jumpLocation = this.operators.length;
  48969. this.operators.push(null, null);
  48970. const endOfTrue = this.operators.length;
  48971. this.parseBlock();
  48972. this.expect(PostScriptTokenTypes.RBRACE);
  48973. this.expect(PostScriptTokenTypes.IFELSE);
  48974. this.operators[jumpLocation] = this.operators.length;
  48975. this.operators[jumpLocation + 1] = "j";
  48976. this.operators[conditionLocation] = endOfTrue;
  48977. this.operators[conditionLocation + 1] = "jz";
  48978. } else {
  48979. throw new _util.FormatError("PS Function: error parsing conditional.");
  48980. }
  48981. }
  48982. }
  48983. exports.PostScriptParser = PostScriptParser;
  48984. const PostScriptTokenTypes = {
  48985. LBRACE: 0,
  48986. RBRACE: 1,
  48987. NUMBER: 2,
  48988. OPERATOR: 3,
  48989. IF: 4,
  48990. IFELSE: 5
  48991. };
  48992. class PostScriptToken {
  48993. static get opCache() {
  48994. return (0, _util.shadow)(this, "opCache", Object.create(null));
  48995. }
  48996. constructor(type, value) {
  48997. this.type = type;
  48998. this.value = value;
  48999. }
  49000. static getOperator(op) {
  49001. const opValue = PostScriptToken.opCache[op];
  49002. if (opValue) {
  49003. return opValue;
  49004. }
  49005. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  49006. }
  49007. static get LBRACE() {
  49008. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  49009. }
  49010. static get RBRACE() {
  49011. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  49012. }
  49013. static get IF() {
  49014. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  49015. }
  49016. static get IFELSE() {
  49017. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  49018. }
  49019. }
  49020. class PostScriptLexer {
  49021. constructor(stream) {
  49022. this.stream = stream;
  49023. this.nextChar();
  49024. this.strBuf = [];
  49025. }
  49026. nextChar() {
  49027. return this.currentChar = this.stream.getByte();
  49028. }
  49029. getToken() {
  49030. let comment = false;
  49031. let ch = this.currentChar;
  49032. while (true) {
  49033. if (ch < 0) {
  49034. return _primitives.EOF;
  49035. }
  49036. if (comment) {
  49037. if (ch === 0x0a || ch === 0x0d) {
  49038. comment = false;
  49039. }
  49040. } else if (ch === 0x25) {
  49041. comment = true;
  49042. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  49043. break;
  49044. }
  49045. ch = this.nextChar();
  49046. }
  49047. switch (ch | 0) {
  49048. case 0x30:
  49049. case 0x31:
  49050. case 0x32:
  49051. case 0x33:
  49052. case 0x34:
  49053. case 0x35:
  49054. case 0x36:
  49055. case 0x37:
  49056. case 0x38:
  49057. case 0x39:
  49058. case 0x2b:
  49059. case 0x2d:
  49060. case 0x2e:
  49061. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  49062. case 0x7b:
  49063. this.nextChar();
  49064. return PostScriptToken.LBRACE;
  49065. case 0x7d:
  49066. this.nextChar();
  49067. return PostScriptToken.RBRACE;
  49068. }
  49069. const strBuf = this.strBuf;
  49070. strBuf.length = 0;
  49071. strBuf[0] = String.fromCharCode(ch);
  49072. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  49073. strBuf.push(String.fromCharCode(ch));
  49074. }
  49075. const str = strBuf.join("");
  49076. switch (str.toLowerCase()) {
  49077. case "if":
  49078. return PostScriptToken.IF;
  49079. case "ifelse":
  49080. return PostScriptToken.IFELSE;
  49081. default:
  49082. return PostScriptToken.getOperator(str);
  49083. }
  49084. }
  49085. getNumber() {
  49086. let ch = this.currentChar;
  49087. const strBuf = this.strBuf;
  49088. strBuf.length = 0;
  49089. strBuf[0] = String.fromCharCode(ch);
  49090. while ((ch = this.nextChar()) >= 0) {
  49091. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  49092. strBuf.push(String.fromCharCode(ch));
  49093. } else {
  49094. break;
  49095. }
  49096. }
  49097. const value = parseFloat(strBuf.join(""));
  49098. if (isNaN(value)) {
  49099. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  49100. }
  49101. return value;
  49102. }
  49103. }
  49104. exports.PostScriptLexer = PostScriptLexer;
  49105. /***/ }),
  49106. /* 188 */
  49107. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49108. "use strict";
  49109. Object.defineProperty(exports, "__esModule", ({
  49110. value: true
  49111. }));
  49112. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  49113. var _util = __w_pdfjs_require__(2);
  49114. var _primitives = __w_pdfjs_require__(134);
  49115. class BaseLocalCache {
  49116. constructor(options) {
  49117. if (this.constructor === BaseLocalCache) {
  49118. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  49119. }
  49120. this._onlyRefs = (options && options.onlyRefs) === true;
  49121. if (!this._onlyRefs) {
  49122. this._nameRefMap = new Map();
  49123. this._imageMap = new Map();
  49124. }
  49125. this._imageCache = new _primitives.RefSetCache();
  49126. }
  49127. getByName(name) {
  49128. if (this._onlyRefs) {
  49129. (0, _util.unreachable)("Should not call `getByName` method.");
  49130. }
  49131. const ref = this._nameRefMap.get(name);
  49132. if (ref) {
  49133. return this.getByRef(ref);
  49134. }
  49135. return this._imageMap.get(name) || null;
  49136. }
  49137. getByRef(ref) {
  49138. return this._imageCache.get(ref) || null;
  49139. }
  49140. set(name, ref, data) {
  49141. (0, _util.unreachable)("Abstract method `set` called.");
  49142. }
  49143. }
  49144. class LocalImageCache extends BaseLocalCache {
  49145. set(name) {
  49146. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49147. let data = arguments.length > 2 ? arguments[2] : undefined;
  49148. if (typeof name !== "string") {
  49149. throw new Error('LocalImageCache.set - expected "name" argument.');
  49150. }
  49151. if (ref) {
  49152. if (this._imageCache.has(ref)) {
  49153. return;
  49154. }
  49155. this._nameRefMap.set(name, ref);
  49156. this._imageCache.put(ref, data);
  49157. return;
  49158. }
  49159. if (this._imageMap.has(name)) {
  49160. return;
  49161. }
  49162. this._imageMap.set(name, data);
  49163. }
  49164. }
  49165. exports.LocalImageCache = LocalImageCache;
  49166. class LocalColorSpaceCache extends BaseLocalCache {
  49167. set() {
  49168. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  49169. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49170. let data = arguments.length > 2 ? arguments[2] : undefined;
  49171. if (typeof name !== "string" && !ref) {
  49172. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  49173. }
  49174. if (ref) {
  49175. if (this._imageCache.has(ref)) {
  49176. return;
  49177. }
  49178. if (name !== null) {
  49179. this._nameRefMap.set(name, ref);
  49180. }
  49181. this._imageCache.put(ref, data);
  49182. return;
  49183. }
  49184. if (this._imageMap.has(name)) {
  49185. return;
  49186. }
  49187. this._imageMap.set(name, data);
  49188. }
  49189. }
  49190. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  49191. class LocalFunctionCache extends BaseLocalCache {
  49192. constructor(options) {
  49193. super({
  49194. onlyRefs: true
  49195. });
  49196. }
  49197. set() {
  49198. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  49199. let ref = arguments.length > 1 ? arguments[1] : undefined;
  49200. let data = arguments.length > 2 ? arguments[2] : undefined;
  49201. if (!ref) {
  49202. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  49203. }
  49204. if (this._imageCache.has(ref)) {
  49205. return;
  49206. }
  49207. this._imageCache.put(ref, data);
  49208. }
  49209. }
  49210. exports.LocalFunctionCache = LocalFunctionCache;
  49211. class LocalGStateCache extends BaseLocalCache {
  49212. set(name) {
  49213. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49214. let data = arguments.length > 2 ? arguments[2] : undefined;
  49215. if (typeof name !== "string") {
  49216. throw new Error('LocalGStateCache.set - expected "name" argument.');
  49217. }
  49218. if (ref) {
  49219. if (this._imageCache.has(ref)) {
  49220. return;
  49221. }
  49222. this._nameRefMap.set(name, ref);
  49223. this._imageCache.put(ref, data);
  49224. return;
  49225. }
  49226. if (this._imageMap.has(name)) {
  49227. return;
  49228. }
  49229. this._imageMap.set(name, data);
  49230. }
  49231. }
  49232. exports.LocalGStateCache = LocalGStateCache;
  49233. class LocalTilingPatternCache extends BaseLocalCache {
  49234. constructor(options) {
  49235. super({
  49236. onlyRefs: true
  49237. });
  49238. }
  49239. set() {
  49240. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  49241. let ref = arguments.length > 1 ? arguments[1] : undefined;
  49242. let data = arguments.length > 2 ? arguments[2] : undefined;
  49243. if (!ref) {
  49244. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  49245. }
  49246. if (this._imageCache.has(ref)) {
  49247. return;
  49248. }
  49249. this._imageCache.put(ref, data);
  49250. }
  49251. }
  49252. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  49253. class GlobalImageCache {
  49254. static get NUM_PAGES_THRESHOLD() {
  49255. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  49256. }
  49257. static get MIN_IMAGES_TO_CACHE() {
  49258. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  49259. }
  49260. static get MAX_BYTE_SIZE() {
  49261. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  49262. }
  49263. constructor() {
  49264. this._refCache = new _primitives.RefSetCache();
  49265. this._imageCache = new _primitives.RefSetCache();
  49266. }
  49267. get _byteSize() {
  49268. let byteSize = 0;
  49269. for (const imageData of this._imageCache) {
  49270. byteSize += imageData.byteSize;
  49271. }
  49272. return byteSize;
  49273. }
  49274. get _cacheLimitReached() {
  49275. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  49276. return false;
  49277. }
  49278. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  49279. return false;
  49280. }
  49281. return true;
  49282. }
  49283. shouldCache(ref, pageIndex) {
  49284. const pageIndexSet = this._refCache.get(ref);
  49285. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  49286. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  49287. return false;
  49288. }
  49289. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  49290. return false;
  49291. }
  49292. return true;
  49293. }
  49294. addPageIndex(ref, pageIndex) {
  49295. let pageIndexSet = this._refCache.get(ref);
  49296. if (!pageIndexSet) {
  49297. pageIndexSet = new Set();
  49298. this._refCache.put(ref, pageIndexSet);
  49299. }
  49300. pageIndexSet.add(pageIndex);
  49301. }
  49302. addByteSize(ref, byteSize) {
  49303. const imageData = this._imageCache.get(ref);
  49304. if (!imageData) {
  49305. return;
  49306. }
  49307. if (imageData.byteSize) {
  49308. return;
  49309. }
  49310. imageData.byteSize = byteSize;
  49311. }
  49312. getData(ref, pageIndex) {
  49313. const pageIndexSet = this._refCache.get(ref);
  49314. if (!pageIndexSet) {
  49315. return null;
  49316. }
  49317. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  49318. return null;
  49319. }
  49320. const imageData = this._imageCache.get(ref);
  49321. if (!imageData) {
  49322. return null;
  49323. }
  49324. pageIndexSet.add(pageIndex);
  49325. return imageData;
  49326. }
  49327. setData(ref, data) {
  49328. if (!this._refCache.has(ref)) {
  49329. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  49330. }
  49331. if (this._imageCache.has(ref)) {
  49332. return;
  49333. }
  49334. if (this._cacheLimitReached) {
  49335. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  49336. return;
  49337. }
  49338. this._imageCache.put(ref, data);
  49339. }
  49340. clear() {
  49341. let onlyData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  49342. if (!onlyData) {
  49343. this._refCache.clear();
  49344. }
  49345. this._imageCache.clear();
  49346. }
  49347. }
  49348. exports.GlobalImageCache = GlobalImageCache;
  49349. /***/ }),
  49350. /* 189 */
  49351. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49352. "use strict";
  49353. Object.defineProperty(exports, "__esModule", ({
  49354. value: true
  49355. }));
  49356. exports.bidi = bidi;
  49357. var _util = __w_pdfjs_require__(2);
  49358. 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"];
  49359. 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"];
  49360. function isOdd(i) {
  49361. return (i & 1) !== 0;
  49362. }
  49363. function isEven(i) {
  49364. return (i & 1) === 0;
  49365. }
  49366. function findUnequal(arr, start, value) {
  49367. let j, jj;
  49368. for (j = start, jj = arr.length; j < jj; ++j) {
  49369. if (arr[j] !== value) {
  49370. return j;
  49371. }
  49372. }
  49373. return j;
  49374. }
  49375. function setValues(arr, start, end, value) {
  49376. for (let j = start; j < end; ++j) {
  49377. arr[j] = value;
  49378. }
  49379. }
  49380. function reverseValues(arr, start, end) {
  49381. for (let i = start, j = end - 1; i < j; ++i, --j) {
  49382. const temp = arr[i];
  49383. arr[i] = arr[j];
  49384. arr[j] = temp;
  49385. }
  49386. }
  49387. function createBidiText(str, isLTR) {
  49388. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  49389. let dir = "ltr";
  49390. if (vertical) {
  49391. dir = "ttb";
  49392. } else if (!isLTR) {
  49393. dir = "rtl";
  49394. }
  49395. return {
  49396. str,
  49397. dir
  49398. };
  49399. }
  49400. const chars = [];
  49401. const types = [];
  49402. function bidi(str) {
  49403. let startLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
  49404. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  49405. let isLTR = true;
  49406. const strLength = str.length;
  49407. if (strLength === 0 || vertical) {
  49408. return createBidiText(str, isLTR, vertical);
  49409. }
  49410. chars.length = strLength;
  49411. types.length = strLength;
  49412. let numBidi = 0;
  49413. let i, ii;
  49414. for (i = 0; i < strLength; ++i) {
  49415. chars[i] = str.charAt(i);
  49416. const charCode = str.charCodeAt(i);
  49417. let charType = "L";
  49418. if (charCode <= 0x00ff) {
  49419. charType = baseTypes[charCode];
  49420. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  49421. charType = "R";
  49422. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  49423. charType = arabicTypes[charCode & 0xff];
  49424. if (!charType) {
  49425. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  49426. }
  49427. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  49428. charType = "AL";
  49429. }
  49430. if (charType === "R" || charType === "AL" || charType === "AN") {
  49431. numBidi++;
  49432. }
  49433. types[i] = charType;
  49434. }
  49435. if (numBidi === 0) {
  49436. isLTR = true;
  49437. return createBidiText(str, isLTR);
  49438. }
  49439. if (startLevel === -1) {
  49440. if (numBidi / strLength < 0.3 && strLength > 4) {
  49441. isLTR = true;
  49442. startLevel = 0;
  49443. } else {
  49444. isLTR = false;
  49445. startLevel = 1;
  49446. }
  49447. }
  49448. const levels = [];
  49449. for (i = 0; i < strLength; ++i) {
  49450. levels[i] = startLevel;
  49451. }
  49452. const e = isOdd(startLevel) ? "R" : "L";
  49453. const sor = e;
  49454. const eor = sor;
  49455. let lastType = sor;
  49456. for (i = 0; i < strLength; ++i) {
  49457. if (types[i] === "NSM") {
  49458. types[i] = lastType;
  49459. } else {
  49460. lastType = types[i];
  49461. }
  49462. }
  49463. lastType = sor;
  49464. let t;
  49465. for (i = 0; i < strLength; ++i) {
  49466. t = types[i];
  49467. if (t === "EN") {
  49468. types[i] = lastType === "AL" ? "AN" : "EN";
  49469. } else if (t === "R" || t === "L" || t === "AL") {
  49470. lastType = t;
  49471. }
  49472. }
  49473. for (i = 0; i < strLength; ++i) {
  49474. t = types[i];
  49475. if (t === "AL") {
  49476. types[i] = "R";
  49477. }
  49478. }
  49479. for (i = 1; i < strLength - 1; ++i) {
  49480. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  49481. types[i] = "EN";
  49482. }
  49483. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  49484. types[i] = types[i - 1];
  49485. }
  49486. }
  49487. for (i = 0; i < strLength; ++i) {
  49488. if (types[i] === "EN") {
  49489. for (let j = i - 1; j >= 0; --j) {
  49490. if (types[j] !== "ET") {
  49491. break;
  49492. }
  49493. types[j] = "EN";
  49494. }
  49495. for (let j = i + 1; j < strLength; ++j) {
  49496. if (types[j] !== "ET") {
  49497. break;
  49498. }
  49499. types[j] = "EN";
  49500. }
  49501. }
  49502. }
  49503. for (i = 0; i < strLength; ++i) {
  49504. t = types[i];
  49505. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  49506. types[i] = "ON";
  49507. }
  49508. }
  49509. lastType = sor;
  49510. for (i = 0; i < strLength; ++i) {
  49511. t = types[i];
  49512. if (t === "EN") {
  49513. types[i] = lastType === "L" ? "L" : "EN";
  49514. } else if (t === "R" || t === "L") {
  49515. lastType = t;
  49516. }
  49517. }
  49518. for (i = 0; i < strLength; ++i) {
  49519. if (types[i] === "ON") {
  49520. const end = findUnequal(types, i + 1, "ON");
  49521. let before = sor;
  49522. if (i > 0) {
  49523. before = types[i - 1];
  49524. }
  49525. let after = eor;
  49526. if (end + 1 < strLength) {
  49527. after = types[end + 1];
  49528. }
  49529. if (before !== "L") {
  49530. before = "R";
  49531. }
  49532. if (after !== "L") {
  49533. after = "R";
  49534. }
  49535. if (before === after) {
  49536. setValues(types, i, end, before);
  49537. }
  49538. i = end - 1;
  49539. }
  49540. }
  49541. for (i = 0; i < strLength; ++i) {
  49542. if (types[i] === "ON") {
  49543. types[i] = e;
  49544. }
  49545. }
  49546. for (i = 0; i < strLength; ++i) {
  49547. t = types[i];
  49548. if (isEven(levels[i])) {
  49549. if (t === "R") {
  49550. levels[i] += 1;
  49551. } else if (t === "AN" || t === "EN") {
  49552. levels[i] += 2;
  49553. }
  49554. } else {
  49555. if (t === "L" || t === "AN" || t === "EN") {
  49556. levels[i] += 1;
  49557. }
  49558. }
  49559. }
  49560. let highestLevel = -1;
  49561. let lowestOddLevel = 99;
  49562. let level;
  49563. for (i = 0, ii = levels.length; i < ii; ++i) {
  49564. level = levels[i];
  49565. if (highestLevel < level) {
  49566. highestLevel = level;
  49567. }
  49568. if (lowestOddLevel > level && isOdd(level)) {
  49569. lowestOddLevel = level;
  49570. }
  49571. }
  49572. for (level = highestLevel; level >= lowestOddLevel; --level) {
  49573. let start = -1;
  49574. for (i = 0, ii = levels.length; i < ii; ++i) {
  49575. if (levels[i] < level) {
  49576. if (start >= 0) {
  49577. reverseValues(chars, start, i);
  49578. start = -1;
  49579. }
  49580. } else if (start < 0) {
  49581. start = i;
  49582. }
  49583. }
  49584. if (start >= 0) {
  49585. reverseValues(chars, start, levels.length);
  49586. }
  49587. }
  49588. for (i = 0, ii = chars.length; i < ii; ++i) {
  49589. const ch = chars[i];
  49590. if (ch === "<" || ch === ">") {
  49591. chars[i] = "";
  49592. }
  49593. }
  49594. return createBidiText(chars.join(""), isLTR);
  49595. }
  49596. /***/ }),
  49597. /* 190 */
  49598. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49599. "use strict";
  49600. Object.defineProperty(exports, "__esModule", ({
  49601. value: true
  49602. }));
  49603. exports.MurmurHash3_64 = void 0;
  49604. var _util = __w_pdfjs_require__(2);
  49605. const SEED = 0xc3d2e1f0;
  49606. const MASK_HIGH = 0xffff0000;
  49607. const MASK_LOW = 0xffff;
  49608. class MurmurHash3_64 {
  49609. constructor(seed) {
  49610. this.h1 = seed ? seed & 0xffffffff : SEED;
  49611. this.h2 = seed ? seed & 0xffffffff : SEED;
  49612. }
  49613. update(input) {
  49614. let data, length;
  49615. if (typeof input === "string") {
  49616. data = new Uint8Array(input.length * 2);
  49617. length = 0;
  49618. for (let i = 0, ii = input.length; i < ii; i++) {
  49619. const code = input.charCodeAt(i);
  49620. if (code <= 0xff) {
  49621. data[length++] = code;
  49622. } else {
  49623. data[length++] = code >>> 8;
  49624. data[length++] = code & 0xff;
  49625. }
  49626. }
  49627. } else if ((0, _util.isArrayBuffer)(input)) {
  49628. data = input.slice();
  49629. length = data.byteLength;
  49630. } else {
  49631. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  49632. }
  49633. const blockCounts = length >> 2;
  49634. const tailLength = length - blockCounts * 4;
  49635. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  49636. let k1 = 0,
  49637. k2 = 0;
  49638. let h1 = this.h1,
  49639. h2 = this.h2;
  49640. const C1 = 0xcc9e2d51,
  49641. C2 = 0x1b873593;
  49642. const C1_LOW = C1 & MASK_LOW,
  49643. C2_LOW = C2 & MASK_LOW;
  49644. for (let i = 0; i < blockCounts; i++) {
  49645. if (i & 1) {
  49646. k1 = dataUint32[i];
  49647. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49648. k1 = k1 << 15 | k1 >>> 17;
  49649. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49650. h1 ^= k1;
  49651. h1 = h1 << 13 | h1 >>> 19;
  49652. h1 = h1 * 5 + 0xe6546b64;
  49653. } else {
  49654. k2 = dataUint32[i];
  49655. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  49656. k2 = k2 << 15 | k2 >>> 17;
  49657. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  49658. h2 ^= k2;
  49659. h2 = h2 << 13 | h2 >>> 19;
  49660. h2 = h2 * 5 + 0xe6546b64;
  49661. }
  49662. }
  49663. k1 = 0;
  49664. switch (tailLength) {
  49665. case 3:
  49666. k1 ^= data[blockCounts * 4 + 2] << 16;
  49667. case 2:
  49668. k1 ^= data[blockCounts * 4 + 1] << 8;
  49669. case 1:
  49670. k1 ^= data[blockCounts * 4];
  49671. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49672. k1 = k1 << 15 | k1 >>> 17;
  49673. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49674. if (blockCounts & 1) {
  49675. h1 ^= k1;
  49676. } else {
  49677. h2 ^= k1;
  49678. }
  49679. }
  49680. this.h1 = h1;
  49681. this.h2 = h2;
  49682. }
  49683. hexdigest() {
  49684. let h1 = this.h1,
  49685. h2 = this.h2;
  49686. h1 ^= h2 >>> 1;
  49687. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  49688. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  49689. h1 ^= h2 >>> 1;
  49690. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  49691. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  49692. h1 ^= h2 >>> 1;
  49693. return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
  49694. }
  49695. }
  49696. exports.MurmurHash3_64 = MurmurHash3_64;
  49697. /***/ }),
  49698. /* 191 */
  49699. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49700. "use strict";
  49701. Object.defineProperty(exports, "__esModule", ({
  49702. value: true
  49703. }));
  49704. exports.OperatorList = void 0;
  49705. var _util = __w_pdfjs_require__(2);
  49706. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  49707. let state = parentState;
  49708. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  49709. const item = pattern[i];
  49710. state = state[item] || (state[item] = []);
  49711. }
  49712. state[pattern.at(-1)] = {
  49713. checkFn,
  49714. iterateFn,
  49715. processFn
  49716. };
  49717. }
  49718. const InitialState = [];
  49719. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  49720. const fnArray = context.fnArray;
  49721. const iFirstSave = context.iCurr - 3;
  49722. const pos = (i - iFirstSave) % 4;
  49723. switch (pos) {
  49724. case 0:
  49725. return fnArray[i] === _util.OPS.save;
  49726. case 1:
  49727. return fnArray[i] === _util.OPS.transform;
  49728. case 2:
  49729. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  49730. case 3:
  49731. return fnArray[i] === _util.OPS.restore;
  49732. }
  49733. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  49734. }, function foundInlineImageGroup(context, i) {
  49735. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  49736. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  49737. const MAX_WIDTH = 1000;
  49738. const IMAGE_PADDING = 1;
  49739. const fnArray = context.fnArray,
  49740. argsArray = context.argsArray;
  49741. const curr = context.iCurr;
  49742. const iFirstSave = curr - 3;
  49743. const iFirstTransform = curr - 2;
  49744. const iFirstPIIXO = curr - 1;
  49745. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  49746. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  49747. return i - (i - iFirstSave) % 4;
  49748. }
  49749. let maxX = 0;
  49750. const map = [];
  49751. let maxLineHeight = 0;
  49752. let currentX = IMAGE_PADDING,
  49753. currentY = IMAGE_PADDING;
  49754. for (let q = 0; q < count; q++) {
  49755. const transform = argsArray[iFirstTransform + (q << 2)];
  49756. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  49757. if (currentX + img.width > MAX_WIDTH) {
  49758. maxX = Math.max(maxX, currentX);
  49759. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  49760. currentX = 0;
  49761. maxLineHeight = 0;
  49762. }
  49763. map.push({
  49764. transform,
  49765. x: currentX,
  49766. y: currentY,
  49767. w: img.width,
  49768. h: img.height
  49769. });
  49770. currentX += img.width + 2 * IMAGE_PADDING;
  49771. maxLineHeight = Math.max(maxLineHeight, img.height);
  49772. }
  49773. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  49774. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  49775. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  49776. const imgRowSize = imgWidth << 2;
  49777. for (let q = 0; q < count; q++) {
  49778. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  49779. const rowSize = map[q].w << 2;
  49780. let dataOffset = 0;
  49781. let offset = map[q].x + map[q].y * imgWidth << 2;
  49782. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  49783. for (let k = 0, kk = map[q].h; k < kk; k++) {
  49784. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  49785. dataOffset += rowSize;
  49786. offset += imgRowSize;
  49787. }
  49788. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  49789. while (offset >= 0) {
  49790. data[offset - 4] = data[offset];
  49791. data[offset - 3] = data[offset + 1];
  49792. data[offset - 2] = data[offset + 2];
  49793. data[offset - 1] = data[offset + 3];
  49794. data[offset + rowSize] = data[offset + rowSize - 4];
  49795. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  49796. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  49797. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  49798. offset -= imgRowSize;
  49799. }
  49800. }
  49801. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  49802. argsArray.splice(iFirstSave, count * 4, [{
  49803. width: imgWidth,
  49804. height: imgHeight,
  49805. kind: _util.ImageKind.RGBA_32BPP,
  49806. data: imgData
  49807. }, map]);
  49808. return iFirstSave + 1;
  49809. });
  49810. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  49811. const fnArray = context.fnArray;
  49812. const iFirstSave = context.iCurr - 3;
  49813. const pos = (i - iFirstSave) % 4;
  49814. switch (pos) {
  49815. case 0:
  49816. return fnArray[i] === _util.OPS.save;
  49817. case 1:
  49818. return fnArray[i] === _util.OPS.transform;
  49819. case 2:
  49820. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  49821. case 3:
  49822. return fnArray[i] === _util.OPS.restore;
  49823. }
  49824. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  49825. }, function foundImageMaskGroup(context, i) {
  49826. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  49827. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  49828. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  49829. const fnArray = context.fnArray,
  49830. argsArray = context.argsArray;
  49831. const curr = context.iCurr;
  49832. const iFirstSave = curr - 3;
  49833. const iFirstTransform = curr - 2;
  49834. const iFirstPIMXO = curr - 1;
  49835. let count = Math.floor((i - iFirstSave) / 4);
  49836. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  49837. return i - (i - iFirstSave) % 4;
  49838. }
  49839. let isSameImage = false;
  49840. let iTransform, transformArgs;
  49841. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  49842. const firstTransformArg0 = argsArray[iFirstTransform][0],
  49843. firstTransformArg1 = argsArray[iFirstTransform][1],
  49844. firstTransformArg2 = argsArray[iFirstTransform][2],
  49845. firstTransformArg3 = argsArray[iFirstTransform][3];
  49846. if (firstTransformArg1 === firstTransformArg2) {
  49847. isSameImage = true;
  49848. iTransform = iFirstTransform + 4;
  49849. let iPIMXO = iFirstPIMXO + 4;
  49850. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  49851. transformArgs = argsArray[iTransform];
  49852. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  49853. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  49854. isSameImage = false;
  49855. } else {
  49856. count = q;
  49857. }
  49858. break;
  49859. }
  49860. }
  49861. }
  49862. if (isSameImage) {
  49863. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  49864. const positions = new Float32Array(count * 2);
  49865. iTransform = iFirstTransform;
  49866. for (let q = 0; q < count; q++, iTransform += 4) {
  49867. transformArgs = argsArray[iTransform];
  49868. positions[q << 1] = transformArgs[4];
  49869. positions[(q << 1) + 1] = transformArgs[5];
  49870. }
  49871. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  49872. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  49873. } else {
  49874. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  49875. const images = [];
  49876. for (let q = 0; q < count; q++) {
  49877. transformArgs = argsArray[iFirstTransform + (q << 2)];
  49878. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  49879. images.push({
  49880. data: maskParams.data,
  49881. width: maskParams.width,
  49882. height: maskParams.height,
  49883. interpolate: maskParams.interpolate,
  49884. count: maskParams.count,
  49885. transform: transformArgs
  49886. });
  49887. }
  49888. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  49889. argsArray.splice(iFirstSave, count * 4, [images]);
  49890. }
  49891. return iFirstSave + 1;
  49892. });
  49893. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  49894. const argsArray = context.argsArray;
  49895. const iFirstTransform = context.iCurr - 2;
  49896. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  49897. }, function iterateImageGroup(context, i) {
  49898. const fnArray = context.fnArray,
  49899. argsArray = context.argsArray;
  49900. const iFirstSave = context.iCurr - 3;
  49901. const pos = (i - iFirstSave) % 4;
  49902. switch (pos) {
  49903. case 0:
  49904. return fnArray[i] === _util.OPS.save;
  49905. case 1:
  49906. if (fnArray[i] !== _util.OPS.transform) {
  49907. return false;
  49908. }
  49909. const iFirstTransform = context.iCurr - 2;
  49910. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49911. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49912. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  49913. return false;
  49914. }
  49915. return true;
  49916. case 2:
  49917. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  49918. return false;
  49919. }
  49920. const iFirstPIXO = context.iCurr - 1;
  49921. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49922. if (argsArray[i][0] !== firstPIXOArg0) {
  49923. return false;
  49924. }
  49925. return true;
  49926. case 3:
  49927. return fnArray[i] === _util.OPS.restore;
  49928. }
  49929. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  49930. }, function (context, i) {
  49931. const MIN_IMAGES_IN_BLOCK = 3;
  49932. const MAX_IMAGES_IN_BLOCK = 1000;
  49933. const fnArray = context.fnArray,
  49934. argsArray = context.argsArray;
  49935. const curr = context.iCurr;
  49936. const iFirstSave = curr - 3;
  49937. const iFirstTransform = curr - 2;
  49938. const iFirstPIXO = curr - 1;
  49939. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49940. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49941. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49942. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  49943. if (count < MIN_IMAGES_IN_BLOCK) {
  49944. return i - (i - iFirstSave) % 4;
  49945. }
  49946. const positions = new Float32Array(count * 2);
  49947. let iTransform = iFirstTransform;
  49948. for (let q = 0; q < count; q++, iTransform += 4) {
  49949. const transformArgs = argsArray[iTransform];
  49950. positions[q << 1] = transformArgs[4];
  49951. positions[(q << 1) + 1] = transformArgs[5];
  49952. }
  49953. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  49954. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  49955. argsArray.splice(iFirstSave, count * 4, args);
  49956. return iFirstSave + 1;
  49957. });
  49958. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  49959. const fnArray = context.fnArray,
  49960. argsArray = context.argsArray;
  49961. const iFirstSave = context.iCurr - 4;
  49962. const pos = (i - iFirstSave) % 5;
  49963. switch (pos) {
  49964. case 0:
  49965. return fnArray[i] === _util.OPS.beginText;
  49966. case 1:
  49967. return fnArray[i] === _util.OPS.setFont;
  49968. case 2:
  49969. return fnArray[i] === _util.OPS.setTextMatrix;
  49970. case 3:
  49971. if (fnArray[i] !== _util.OPS.showText) {
  49972. return false;
  49973. }
  49974. const iFirstSetFont = context.iCurr - 3;
  49975. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  49976. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  49977. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  49978. return false;
  49979. }
  49980. return true;
  49981. case 4:
  49982. return fnArray[i] === _util.OPS.endText;
  49983. }
  49984. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  49985. }, function (context, i) {
  49986. const MIN_CHARS_IN_BLOCK = 3;
  49987. const MAX_CHARS_IN_BLOCK = 1000;
  49988. const fnArray = context.fnArray,
  49989. argsArray = context.argsArray;
  49990. const curr = context.iCurr;
  49991. const iFirstBeginText = curr - 4;
  49992. const iFirstSetFont = curr - 3;
  49993. const iFirstSetTextMatrix = curr - 2;
  49994. const iFirstShowText = curr - 1;
  49995. const iFirstEndText = curr;
  49996. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  49997. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  49998. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  49999. if (count < MIN_CHARS_IN_BLOCK) {
  50000. return i - (i - iFirstBeginText) % 5;
  50001. }
  50002. let iFirst = iFirstBeginText;
  50003. 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) {
  50004. count++;
  50005. iFirst -= 5;
  50006. }
  50007. let iEndText = iFirst + 4;
  50008. for (let q = 1; q < count; q++) {
  50009. fnArray.splice(iEndText, 3);
  50010. argsArray.splice(iEndText, 3);
  50011. iEndText += 2;
  50012. }
  50013. return iEndText + 1;
  50014. });
  50015. class NullOptimizer {
  50016. constructor(queue) {
  50017. this.queue = queue;
  50018. }
  50019. _optimize() {}
  50020. push(fn, args) {
  50021. this.queue.fnArray.push(fn);
  50022. this.queue.argsArray.push(args);
  50023. this._optimize();
  50024. }
  50025. flush() {}
  50026. reset() {}
  50027. }
  50028. class QueueOptimizer extends NullOptimizer {
  50029. constructor(queue) {
  50030. super(queue);
  50031. this.state = null;
  50032. this.context = {
  50033. iCurr: 0,
  50034. fnArray: queue.fnArray,
  50035. argsArray: queue.argsArray
  50036. };
  50037. this.match = null;
  50038. this.lastProcessed = 0;
  50039. }
  50040. _optimize() {
  50041. const fnArray = this.queue.fnArray;
  50042. let i = this.lastProcessed,
  50043. ii = fnArray.length;
  50044. let state = this.state;
  50045. let match = this.match;
  50046. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  50047. this.lastProcessed = ii;
  50048. return;
  50049. }
  50050. const context = this.context;
  50051. while (i < ii) {
  50052. if (match) {
  50053. const iterate = (0, match.iterateFn)(context, i);
  50054. if (iterate) {
  50055. i++;
  50056. continue;
  50057. }
  50058. i = (0, match.processFn)(context, i + 1);
  50059. ii = fnArray.length;
  50060. match = null;
  50061. state = null;
  50062. if (i >= ii) {
  50063. break;
  50064. }
  50065. }
  50066. state = (state || InitialState)[fnArray[i]];
  50067. if (!state || Array.isArray(state)) {
  50068. i++;
  50069. continue;
  50070. }
  50071. context.iCurr = i;
  50072. i++;
  50073. if (state.checkFn && !(0, state.checkFn)(context)) {
  50074. state = null;
  50075. continue;
  50076. }
  50077. match = state;
  50078. state = null;
  50079. }
  50080. this.state = state;
  50081. this.match = match;
  50082. this.lastProcessed = i;
  50083. }
  50084. flush() {
  50085. while (this.match) {
  50086. const length = this.queue.fnArray.length;
  50087. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  50088. this.match = null;
  50089. this.state = null;
  50090. this._optimize();
  50091. }
  50092. }
  50093. reset() {
  50094. this.state = null;
  50095. this.match = null;
  50096. this.lastProcessed = 0;
  50097. }
  50098. }
  50099. class OperatorList {
  50100. static get CHUNK_SIZE() {
  50101. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  50102. }
  50103. static get CHUNK_SIZE_ABOUT() {
  50104. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  50105. }
  50106. constructor() {
  50107. let intent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  50108. let streamSink = arguments.length > 1 ? arguments[1] : undefined;
  50109. this._streamSink = streamSink;
  50110. this.fnArray = [];
  50111. this.argsArray = [];
  50112. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  50113. this.optimizer = new QueueOptimizer(this);
  50114. } else {
  50115. this.optimizer = new NullOptimizer(this);
  50116. }
  50117. this.dependencies = new Set();
  50118. this._totalLength = 0;
  50119. this.weight = 0;
  50120. this._resolved = streamSink ? null : Promise.resolve();
  50121. }
  50122. get length() {
  50123. return this.argsArray.length;
  50124. }
  50125. get ready() {
  50126. return this._resolved || this._streamSink.ready;
  50127. }
  50128. get totalLength() {
  50129. return this._totalLength + this.length;
  50130. }
  50131. addOp(fn, args) {
  50132. this.optimizer.push(fn, args);
  50133. this.weight++;
  50134. if (this._streamSink) {
  50135. if (this.weight >= OperatorList.CHUNK_SIZE) {
  50136. this.flush();
  50137. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  50138. this.flush();
  50139. }
  50140. }
  50141. }
  50142. addImageOps(fn, args, optionalContent) {
  50143. if (optionalContent !== undefined) {
  50144. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  50145. }
  50146. this.addOp(fn, args);
  50147. if (optionalContent !== undefined) {
  50148. this.addOp(_util.OPS.endMarkedContent, []);
  50149. }
  50150. }
  50151. addDependency(dependency) {
  50152. if (this.dependencies.has(dependency)) {
  50153. return;
  50154. }
  50155. this.dependencies.add(dependency);
  50156. this.addOp(_util.OPS.dependency, [dependency]);
  50157. }
  50158. addDependencies(dependencies) {
  50159. for (const dependency of dependencies) {
  50160. this.addDependency(dependency);
  50161. }
  50162. }
  50163. addOpList(opList) {
  50164. if (!(opList instanceof OperatorList)) {
  50165. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  50166. return;
  50167. }
  50168. for (const dependency of opList.dependencies) {
  50169. this.dependencies.add(dependency);
  50170. }
  50171. for (let i = 0, ii = opList.length; i < ii; i++) {
  50172. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  50173. }
  50174. }
  50175. getIR() {
  50176. return {
  50177. fnArray: this.fnArray,
  50178. argsArray: this.argsArray,
  50179. length: this.length
  50180. };
  50181. }
  50182. get _transfers() {
  50183. const transfers = [];
  50184. const {
  50185. fnArray,
  50186. argsArray,
  50187. length
  50188. } = this;
  50189. for (let i = 0; i < length; i++) {
  50190. switch (fnArray[i]) {
  50191. case _util.OPS.paintInlineImageXObject:
  50192. case _util.OPS.paintInlineImageXObjectGroup:
  50193. case _util.OPS.paintImageMaskXObject:
  50194. const arg = argsArray[i][0];
  50195. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  50196. transfers.push(arg.data.buffer);
  50197. }
  50198. break;
  50199. }
  50200. }
  50201. return transfers;
  50202. }
  50203. flush() {
  50204. let lastChunk = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  50205. let separateAnnots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  50206. this.optimizer.flush();
  50207. const length = this.length;
  50208. this._totalLength += length;
  50209. this._streamSink.enqueue({
  50210. fnArray: this.fnArray,
  50211. argsArray: this.argsArray,
  50212. lastChunk,
  50213. separateAnnots,
  50214. length
  50215. }, 1, this._transfers);
  50216. this.dependencies.clear();
  50217. this.fnArray.length = 0;
  50218. this.argsArray.length = 0;
  50219. this.weight = 0;
  50220. this.optimizer.reset();
  50221. }
  50222. }
  50223. exports.OperatorList = OperatorList;
  50224. /***/ }),
  50225. /* 192 */
  50226. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50227. "use strict";
  50228. Object.defineProperty(exports, "__esModule", ({
  50229. value: true
  50230. }));
  50231. exports.PDFImage = void 0;
  50232. var _util = __w_pdfjs_require__(2);
  50233. var _image_utils = __w_pdfjs_require__(193);
  50234. var _base_stream = __w_pdfjs_require__(136);
  50235. var _colorspace = __w_pdfjs_require__(143);
  50236. var _decode_stream = __w_pdfjs_require__(148);
  50237. var _jpeg_stream = __w_pdfjs_require__(156);
  50238. var _jpx = __w_pdfjs_require__(159);
  50239. var _primitives = __w_pdfjs_require__(134);
  50240. function decodeAndClamp(value, addend, coefficient, max) {
  50241. value = addend + value * coefficient;
  50242. if (value < 0) {
  50243. value = 0;
  50244. } else if (value > max) {
  50245. value = max;
  50246. }
  50247. return value;
  50248. }
  50249. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  50250. const length = w2 * h2;
  50251. let dest;
  50252. if (bpc <= 8) {
  50253. dest = new Uint8Array(length);
  50254. } else if (bpc <= 16) {
  50255. dest = new Uint16Array(length);
  50256. } else {
  50257. dest = new Uint32Array(length);
  50258. }
  50259. const xRatio = w1 / w2;
  50260. const yRatio = h1 / h2;
  50261. let i,
  50262. j,
  50263. py,
  50264. newIndex = 0,
  50265. oldIndex;
  50266. const xScaled = new Uint16Array(w2);
  50267. const w1Scanline = w1;
  50268. for (i = 0; i < w2; i++) {
  50269. xScaled[i] = Math.floor(i * xRatio);
  50270. }
  50271. for (i = 0; i < h2; i++) {
  50272. py = Math.floor(i * yRatio) * w1Scanline;
  50273. for (j = 0; j < w2; j++) {
  50274. oldIndex = py + xScaled[j];
  50275. dest[newIndex++] = src[oldIndex];
  50276. }
  50277. }
  50278. return dest;
  50279. }
  50280. class PDFImage {
  50281. constructor(_ref) {
  50282. let {
  50283. xref,
  50284. res,
  50285. image,
  50286. isInline = false,
  50287. smask = null,
  50288. mask = null,
  50289. isMask = false,
  50290. pdfFunctionFactory,
  50291. localColorSpaceCache
  50292. } = _ref;
  50293. this.image = image;
  50294. const dict = image.dict;
  50295. const filter = dict.get("F", "Filter");
  50296. let filterName;
  50297. if (filter instanceof _primitives.Name) {
  50298. filterName = filter.name;
  50299. } else if (Array.isArray(filter)) {
  50300. const filterZero = xref.fetchIfRef(filter[0]);
  50301. if (filterZero instanceof _primitives.Name) {
  50302. filterName = filterZero.name;
  50303. }
  50304. }
  50305. switch (filterName) {
  50306. case "JPXDecode":
  50307. const jpxImage = new _jpx.JpxImage();
  50308. jpxImage.parseImageProperties(image.stream);
  50309. image.stream.reset();
  50310. image.width = jpxImage.width;
  50311. image.height = jpxImage.height;
  50312. image.bitsPerComponent = jpxImage.bitsPerComponent;
  50313. image.numComps = jpxImage.componentsCount;
  50314. break;
  50315. case "JBIG2Decode":
  50316. image.bitsPerComponent = 1;
  50317. image.numComps = 1;
  50318. break;
  50319. }
  50320. let width = dict.get("W", "Width");
  50321. let height = dict.get("H", "Height");
  50322. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  50323. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  50324. width = image.width;
  50325. height = image.height;
  50326. }
  50327. if (width < 1 || height < 1) {
  50328. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  50329. }
  50330. this.width = width;
  50331. this.height = height;
  50332. this.interpolate = dict.get("I", "Interpolate");
  50333. this.imageMask = dict.get("IM", "ImageMask") || false;
  50334. this.matte = dict.get("Matte") || false;
  50335. let bitsPerComponent = image.bitsPerComponent;
  50336. if (!bitsPerComponent) {
  50337. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  50338. if (!bitsPerComponent) {
  50339. if (this.imageMask) {
  50340. bitsPerComponent = 1;
  50341. } else {
  50342. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  50343. }
  50344. }
  50345. }
  50346. this.bpc = bitsPerComponent;
  50347. if (!this.imageMask) {
  50348. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  50349. if (!colorSpace) {
  50350. (0, _util.info)("JPX images (which do not require color spaces)");
  50351. switch (image.numComps) {
  50352. case 1:
  50353. colorSpace = _primitives.Name.get("DeviceGray");
  50354. break;
  50355. case 3:
  50356. colorSpace = _primitives.Name.get("DeviceRGB");
  50357. break;
  50358. case 4:
  50359. colorSpace = _primitives.Name.get("DeviceCMYK");
  50360. break;
  50361. default:
  50362. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  50363. }
  50364. }
  50365. this.colorSpace = _colorspace.ColorSpace.parse({
  50366. cs: colorSpace,
  50367. xref,
  50368. resources: isInline ? res : null,
  50369. pdfFunctionFactory,
  50370. localColorSpaceCache
  50371. });
  50372. this.numComps = this.colorSpace.numComps;
  50373. }
  50374. this.decode = dict.getArray("D", "Decode");
  50375. this.needsDecode = false;
  50376. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  50377. this.needsDecode = true;
  50378. const max = (1 << bitsPerComponent) - 1;
  50379. this.decodeCoefficients = [];
  50380. this.decodeAddends = [];
  50381. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  50382. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  50383. const dmin = this.decode[i];
  50384. const dmax = this.decode[i + 1];
  50385. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  50386. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  50387. }
  50388. }
  50389. if (smask) {
  50390. this.smask = new PDFImage({
  50391. xref,
  50392. res,
  50393. image: smask,
  50394. isInline,
  50395. pdfFunctionFactory,
  50396. localColorSpaceCache
  50397. });
  50398. } else if (mask) {
  50399. if (mask instanceof _base_stream.BaseStream) {
  50400. const maskDict = mask.dict,
  50401. imageMask = maskDict.get("IM", "ImageMask");
  50402. if (!imageMask) {
  50403. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  50404. } else {
  50405. this.mask = new PDFImage({
  50406. xref,
  50407. res,
  50408. image: mask,
  50409. isInline,
  50410. isMask: true,
  50411. pdfFunctionFactory,
  50412. localColorSpaceCache
  50413. });
  50414. }
  50415. } else {
  50416. this.mask = mask;
  50417. }
  50418. }
  50419. }
  50420. static async buildImage(_ref2) {
  50421. let {
  50422. xref,
  50423. res,
  50424. image,
  50425. isInline = false,
  50426. pdfFunctionFactory,
  50427. localColorSpaceCache
  50428. } = _ref2;
  50429. const imageData = image;
  50430. let smaskData = null;
  50431. let maskData = null;
  50432. const smask = image.dict.get("SMask");
  50433. const mask = image.dict.get("Mask");
  50434. if (smask) {
  50435. if (smask instanceof _base_stream.BaseStream) {
  50436. smaskData = smask;
  50437. } else {
  50438. (0, _util.warn)("Unsupported /SMask format.");
  50439. }
  50440. } else if (mask) {
  50441. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  50442. maskData = mask;
  50443. } else {
  50444. (0, _util.warn)("Unsupported /Mask format.");
  50445. }
  50446. }
  50447. return new PDFImage({
  50448. xref,
  50449. res,
  50450. image: imageData,
  50451. isInline,
  50452. smask: smaskData,
  50453. mask: maskData,
  50454. pdfFunctionFactory,
  50455. localColorSpaceCache
  50456. });
  50457. }
  50458. static createRawMask(_ref3) {
  50459. let {
  50460. imgArray,
  50461. width,
  50462. height,
  50463. imageIsFromDecodeStream,
  50464. inverseDecode,
  50465. interpolate
  50466. } = _ref3;
  50467. const computedLength = (width + 7 >> 3) * height;
  50468. const actualLength = imgArray.byteLength;
  50469. const haveFullData = computedLength === actualLength;
  50470. let data, i;
  50471. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  50472. data = imgArray;
  50473. } else if (!inverseDecode) {
  50474. data = new Uint8Array(imgArray);
  50475. } else {
  50476. data = new Uint8Array(computedLength);
  50477. data.set(imgArray);
  50478. data.fill(0xff, actualLength);
  50479. }
  50480. if (inverseDecode) {
  50481. for (i = 0; i < actualLength; i++) {
  50482. data[i] ^= 0xff;
  50483. }
  50484. }
  50485. return {
  50486. data,
  50487. width,
  50488. height,
  50489. interpolate
  50490. };
  50491. }
  50492. static createMask(_ref4) {
  50493. let {
  50494. imgArray,
  50495. width,
  50496. height,
  50497. imageIsFromDecodeStream,
  50498. inverseDecode,
  50499. interpolate,
  50500. isOffscreenCanvasSupported = true
  50501. } = _ref4;
  50502. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  50503. if (isSingleOpaquePixel) {
  50504. return {
  50505. isSingleOpaquePixel
  50506. };
  50507. }
  50508. if (isOffscreenCanvasSupported && _util.FeatureTest.isOffscreenCanvasSupported) {
  50509. const canvas = new OffscreenCanvas(width, height);
  50510. const ctx = canvas.getContext("2d");
  50511. const imgData = ctx.createImageData(width, height);
  50512. (0, _image_utils.applyMaskImageData)({
  50513. src: imgArray,
  50514. dest: imgData.data,
  50515. width,
  50516. height,
  50517. inverseDecode
  50518. });
  50519. ctx.putImageData(imgData, 0, 0);
  50520. const bitmap = canvas.transferToImageBitmap();
  50521. return {
  50522. data: null,
  50523. width,
  50524. height,
  50525. interpolate,
  50526. bitmap
  50527. };
  50528. }
  50529. return this.createRawMask({
  50530. imgArray,
  50531. width,
  50532. height,
  50533. inverseDecode,
  50534. imageIsFromDecodeStream,
  50535. interpolate
  50536. });
  50537. }
  50538. get drawWidth() {
  50539. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  50540. }
  50541. get drawHeight() {
  50542. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  50543. }
  50544. decodeBuffer(buffer) {
  50545. const bpc = this.bpc;
  50546. const numComps = this.numComps;
  50547. const decodeAddends = this.decodeAddends;
  50548. const decodeCoefficients = this.decodeCoefficients;
  50549. const max = (1 << bpc) - 1;
  50550. let i, ii;
  50551. if (bpc === 1) {
  50552. for (i = 0, ii = buffer.length; i < ii; i++) {
  50553. buffer[i] = +!buffer[i];
  50554. }
  50555. return;
  50556. }
  50557. let index = 0;
  50558. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  50559. for (let j = 0; j < numComps; j++) {
  50560. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  50561. index++;
  50562. }
  50563. }
  50564. }
  50565. getComponents(buffer) {
  50566. const bpc = this.bpc;
  50567. if (bpc === 8) {
  50568. return buffer;
  50569. }
  50570. const width = this.width;
  50571. const height = this.height;
  50572. const numComps = this.numComps;
  50573. const length = width * height * numComps;
  50574. let bufferPos = 0;
  50575. let output;
  50576. if (bpc <= 8) {
  50577. output = new Uint8Array(length);
  50578. } else if (bpc <= 16) {
  50579. output = new Uint16Array(length);
  50580. } else {
  50581. output = new Uint32Array(length);
  50582. }
  50583. const rowComps = width * numComps;
  50584. const max = (1 << bpc) - 1;
  50585. let i = 0,
  50586. ii,
  50587. buf;
  50588. if (bpc === 1) {
  50589. let mask, loop1End, loop2End;
  50590. for (let j = 0; j < height; j++) {
  50591. loop1End = i + (rowComps & ~7);
  50592. loop2End = i + rowComps;
  50593. while (i < loop1End) {
  50594. buf = buffer[bufferPos++];
  50595. output[i] = buf >> 7 & 1;
  50596. output[i + 1] = buf >> 6 & 1;
  50597. output[i + 2] = buf >> 5 & 1;
  50598. output[i + 3] = buf >> 4 & 1;
  50599. output[i + 4] = buf >> 3 & 1;
  50600. output[i + 5] = buf >> 2 & 1;
  50601. output[i + 6] = buf >> 1 & 1;
  50602. output[i + 7] = buf & 1;
  50603. i += 8;
  50604. }
  50605. if (i < loop2End) {
  50606. buf = buffer[bufferPos++];
  50607. mask = 128;
  50608. while (i < loop2End) {
  50609. output[i++] = +!!(buf & mask);
  50610. mask >>= 1;
  50611. }
  50612. }
  50613. }
  50614. } else {
  50615. let bits = 0;
  50616. buf = 0;
  50617. for (i = 0, ii = length; i < ii; ++i) {
  50618. if (i % rowComps === 0) {
  50619. buf = 0;
  50620. bits = 0;
  50621. }
  50622. while (bits < bpc) {
  50623. buf = buf << 8 | buffer[bufferPos++];
  50624. bits += 8;
  50625. }
  50626. const remainingBits = bits - bpc;
  50627. let value = buf >> remainingBits;
  50628. if (value < 0) {
  50629. value = 0;
  50630. } else if (value > max) {
  50631. value = max;
  50632. }
  50633. output[i] = value;
  50634. buf &= (1 << remainingBits) - 1;
  50635. bits = remainingBits;
  50636. }
  50637. }
  50638. return output;
  50639. }
  50640. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  50641. const smask = this.smask;
  50642. const mask = this.mask;
  50643. let alphaBuf, sw, sh, i, ii, j;
  50644. if (smask) {
  50645. sw = smask.width;
  50646. sh = smask.height;
  50647. alphaBuf = new Uint8ClampedArray(sw * sh);
  50648. smask.fillGrayBuffer(alphaBuf);
  50649. if (sw !== width || sh !== height) {
  50650. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  50651. }
  50652. } else if (mask) {
  50653. if (mask instanceof PDFImage) {
  50654. sw = mask.width;
  50655. sh = mask.height;
  50656. alphaBuf = new Uint8ClampedArray(sw * sh);
  50657. mask.numComps = 1;
  50658. mask.fillGrayBuffer(alphaBuf);
  50659. for (i = 0, ii = sw * sh; i < ii; ++i) {
  50660. alphaBuf[i] = 255 - alphaBuf[i];
  50661. }
  50662. if (sw !== width || sh !== height) {
  50663. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  50664. }
  50665. } else if (Array.isArray(mask)) {
  50666. alphaBuf = new Uint8ClampedArray(width * height);
  50667. const numComps = this.numComps;
  50668. for (i = 0, ii = width * height; i < ii; ++i) {
  50669. let opacity = 0;
  50670. const imageOffset = i * numComps;
  50671. for (j = 0; j < numComps; ++j) {
  50672. const color = image[imageOffset + j];
  50673. const maskOffset = j * 2;
  50674. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  50675. opacity = 255;
  50676. break;
  50677. }
  50678. }
  50679. alphaBuf[i] = opacity;
  50680. }
  50681. } else {
  50682. throw new _util.FormatError("Unknown mask format.");
  50683. }
  50684. }
  50685. if (alphaBuf) {
  50686. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50687. rgbaBuf[j] = alphaBuf[i];
  50688. }
  50689. } else {
  50690. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50691. rgbaBuf[j] = 255;
  50692. }
  50693. }
  50694. }
  50695. undoPreblend(buffer, width, height) {
  50696. const matte = this.smask && this.smask.matte;
  50697. if (!matte) {
  50698. return;
  50699. }
  50700. const matteRgb = this.colorSpace.getRgb(matte, 0);
  50701. const matteR = matteRgb[0];
  50702. const matteG = matteRgb[1];
  50703. const matteB = matteRgb[2];
  50704. const length = width * height * 4;
  50705. for (let i = 0; i < length; i += 4) {
  50706. const alpha = buffer[i + 3];
  50707. if (alpha === 0) {
  50708. buffer[i] = 255;
  50709. buffer[i + 1] = 255;
  50710. buffer[i + 2] = 255;
  50711. continue;
  50712. }
  50713. const k = 255 / alpha;
  50714. buffer[i] = (buffer[i] - matteR) * k + matteR;
  50715. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  50716. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  50717. }
  50718. }
  50719. createImageData() {
  50720. let forceRGBA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  50721. const drawWidth = this.drawWidth;
  50722. const drawHeight = this.drawHeight;
  50723. const imgData = {
  50724. width: drawWidth,
  50725. height: drawHeight,
  50726. interpolate: this.interpolate,
  50727. kind: 0,
  50728. data: null
  50729. };
  50730. const numComps = this.numComps;
  50731. const originalWidth = this.width;
  50732. const originalHeight = this.height;
  50733. const bpc = this.bpc;
  50734. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  50735. if (!forceRGBA) {
  50736. let kind;
  50737. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  50738. kind = _util.ImageKind.GRAYSCALE_1BPP;
  50739. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  50740. kind = _util.ImageKind.RGB_24BPP;
  50741. }
  50742. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  50743. imgData.kind = kind;
  50744. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  50745. if (this.needsDecode) {
  50746. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  50747. const buffer = imgData.data;
  50748. for (let i = 0, ii = buffer.length; i < ii; i++) {
  50749. buffer[i] ^= 0xff;
  50750. }
  50751. }
  50752. return imgData;
  50753. }
  50754. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  50755. let imageLength = originalHeight * rowBytes;
  50756. switch (this.colorSpace.name) {
  50757. case "DeviceGray":
  50758. imageLength *= 3;
  50759. case "DeviceRGB":
  50760. case "DeviceCMYK":
  50761. imgData.kind = _util.ImageKind.RGB_24BPP;
  50762. imgData.data = this.getImageBytes(imageLength, {
  50763. drawWidth,
  50764. drawHeight,
  50765. forceRGB: true
  50766. });
  50767. return imgData;
  50768. }
  50769. }
  50770. }
  50771. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  50772. internal: true
  50773. });
  50774. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  50775. const comps = this.getComponents(imgArray);
  50776. let alpha01, maybeUndoPreblend;
  50777. if (!forceRGBA && !this.smask && !this.mask) {
  50778. imgData.kind = _util.ImageKind.RGB_24BPP;
  50779. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  50780. alpha01 = 0;
  50781. maybeUndoPreblend = false;
  50782. } else {
  50783. imgData.kind = _util.ImageKind.RGBA_32BPP;
  50784. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  50785. alpha01 = 1;
  50786. maybeUndoPreblend = true;
  50787. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  50788. }
  50789. if (this.needsDecode) {
  50790. this.decodeBuffer(comps);
  50791. }
  50792. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  50793. if (maybeUndoPreblend) {
  50794. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  50795. }
  50796. return imgData;
  50797. }
  50798. fillGrayBuffer(buffer) {
  50799. const numComps = this.numComps;
  50800. if (numComps !== 1) {
  50801. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  50802. }
  50803. const width = this.width;
  50804. const height = this.height;
  50805. const bpc = this.bpc;
  50806. const rowBytes = width * numComps * bpc + 7 >> 3;
  50807. const imgArray = this.getImageBytes(height * rowBytes, {
  50808. internal: true
  50809. });
  50810. const comps = this.getComponents(imgArray);
  50811. let i, length;
  50812. if (bpc === 1) {
  50813. length = width * height;
  50814. if (this.needsDecode) {
  50815. for (i = 0; i < length; ++i) {
  50816. buffer[i] = comps[i] - 1 & 255;
  50817. }
  50818. } else {
  50819. for (i = 0; i < length; ++i) {
  50820. buffer[i] = -comps[i] & 255;
  50821. }
  50822. }
  50823. return;
  50824. }
  50825. if (this.needsDecode) {
  50826. this.decodeBuffer(comps);
  50827. }
  50828. length = width * height;
  50829. const scale = 255 / ((1 << bpc) - 1);
  50830. for (i = 0; i < length; ++i) {
  50831. buffer[i] = scale * comps[i];
  50832. }
  50833. }
  50834. getImageBytes(length, _ref5) {
  50835. let {
  50836. drawWidth,
  50837. drawHeight,
  50838. forceRGB = false,
  50839. internal = false
  50840. } = _ref5;
  50841. this.image.reset();
  50842. this.image.drawWidth = drawWidth || this.width;
  50843. this.image.drawHeight = drawHeight || this.height;
  50844. this.image.forceRGB = !!forceRGB;
  50845. const imageBytes = this.image.getBytes(length);
  50846. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  50847. return imageBytes;
  50848. }
  50849. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  50850. return new Uint8Array(imageBytes);
  50851. }
  50852. }
  50853. exports.PDFImage = PDFImage;
  50854. /***/ }),
  50855. /* 193 */
  50856. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50857. "use strict";
  50858. Object.defineProperty(exports, "__esModule", ({
  50859. value: true
  50860. }));
  50861. exports.applyMaskImageData = applyMaskImageData;
  50862. var _util = __w_pdfjs_require__(2);
  50863. function applyMaskImageData(_ref) {
  50864. let {
  50865. src,
  50866. srcPos = 0,
  50867. dest,
  50868. destPos = 0,
  50869. width,
  50870. height,
  50871. inverseDecode = false
  50872. } = _ref;
  50873. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  50874. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  50875. const widthInSource = width >> 3;
  50876. const widthRemainder = width & 7;
  50877. const srcLength = src.length;
  50878. dest = new Uint32Array(dest.buffer);
  50879. for (let i = 0; i < height; i++) {
  50880. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  50881. const elem = srcPos < srcLength ? src[srcPos] : 255;
  50882. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  50883. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  50884. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  50885. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  50886. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  50887. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  50888. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  50889. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  50890. }
  50891. if (widthRemainder === 0) {
  50892. continue;
  50893. }
  50894. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  50895. for (let j = 0; j < widthRemainder; j++) {
  50896. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  50897. }
  50898. }
  50899. return {
  50900. srcPos,
  50901. destPos
  50902. };
  50903. }
  50904. /***/ }),
  50905. /* 194 */
  50906. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50907. "use strict";
  50908. Object.defineProperty(exports, "__esModule", ({
  50909. value: true
  50910. }));
  50911. exports.incrementalUpdate = incrementalUpdate;
  50912. exports.writeDict = writeDict;
  50913. exports.writeObject = writeObject;
  50914. var _util = __w_pdfjs_require__(2);
  50915. var _primitives = __w_pdfjs_require__(134);
  50916. var _core_utils = __w_pdfjs_require__(135);
  50917. var _xml_parser = __w_pdfjs_require__(195);
  50918. var _base_stream = __w_pdfjs_require__(136);
  50919. var _crypto = __w_pdfjs_require__(196);
  50920. function writeObject(ref, obj, buffer, transform) {
  50921. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  50922. if (obj instanceof _primitives.Dict) {
  50923. writeDict(obj, buffer, transform);
  50924. } else if (obj instanceof _base_stream.BaseStream) {
  50925. writeStream(obj, buffer, transform);
  50926. }
  50927. buffer.push("\nendobj\n");
  50928. }
  50929. function writeDict(dict, buffer, transform) {
  50930. buffer.push("<<");
  50931. for (const key of dict.getKeys()) {
  50932. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  50933. writeValue(dict.getRaw(key), buffer, transform);
  50934. }
  50935. buffer.push(">>");
  50936. }
  50937. function writeStream(stream, buffer, transform) {
  50938. writeDict(stream.dict, buffer, transform);
  50939. buffer.push(" stream\n");
  50940. let string = stream.getString();
  50941. if (transform !== null) {
  50942. string = transform.encryptString(string);
  50943. }
  50944. buffer.push(string, "\nendstream");
  50945. }
  50946. function writeArray(array, buffer, transform) {
  50947. buffer.push("[");
  50948. let first = true;
  50949. for (const val of array) {
  50950. if (!first) {
  50951. buffer.push(" ");
  50952. } else {
  50953. first = false;
  50954. }
  50955. writeValue(val, buffer, transform);
  50956. }
  50957. buffer.push("]");
  50958. }
  50959. function writeValue(value, buffer, transform) {
  50960. if (value instanceof _primitives.Name) {
  50961. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  50962. } else if (value instanceof _primitives.Ref) {
  50963. buffer.push(`${value.num} ${value.gen} R`);
  50964. } else if (Array.isArray(value)) {
  50965. writeArray(value, buffer, transform);
  50966. } else if (typeof value === "string") {
  50967. if (transform !== null) {
  50968. value = transform.encryptString(value);
  50969. }
  50970. buffer.push(`(${(0, _core_utils.escapeString)(value)})`);
  50971. } else if (typeof value === "number") {
  50972. buffer.push((0, _core_utils.numberToString)(value));
  50973. } else if (typeof value === "boolean") {
  50974. buffer.push(value.toString());
  50975. } else if (value instanceof _primitives.Dict) {
  50976. writeDict(value, buffer, transform);
  50977. } else if (value instanceof _base_stream.BaseStream) {
  50978. writeStream(value, buffer, transform);
  50979. } else if (value === null) {
  50980. buffer.push("null");
  50981. } else {
  50982. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  50983. }
  50984. }
  50985. function writeInt(number, size, offset, buffer) {
  50986. for (let i = size + offset - 1; i > offset - 1; i--) {
  50987. buffer[i] = number & 0xff;
  50988. number >>= 8;
  50989. }
  50990. return offset + size;
  50991. }
  50992. function writeString(string, offset, buffer) {
  50993. for (let i = 0, len = string.length; i < len; i++) {
  50994. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  50995. }
  50996. }
  50997. function computeMD5(filesize, xrefInfo) {
  50998. const time = Math.floor(Date.now() / 1000);
  50999. const filename = xrefInfo.filename || "";
  51000. const md5Buffer = [time.toString(), filename, filesize.toString()];
  51001. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  51002. for (const value of Object.values(xrefInfo.info)) {
  51003. md5Buffer.push(value);
  51004. md5BufferLen += value.length;
  51005. }
  51006. const array = new Uint8Array(md5BufferLen);
  51007. let offset = 0;
  51008. for (const str of md5Buffer) {
  51009. writeString(str, offset, array);
  51010. offset += str.length;
  51011. }
  51012. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  51013. }
  51014. function writeXFADataForAcroform(str, newRefs) {
  51015. const xml = new _xml_parser.SimpleXMLParser({
  51016. hasAttributes: true
  51017. }).parseFromString(str);
  51018. for (const {
  51019. xfa
  51020. } of newRefs) {
  51021. if (!xfa) {
  51022. continue;
  51023. }
  51024. const {
  51025. path,
  51026. value
  51027. } = xfa;
  51028. if (!path) {
  51029. continue;
  51030. }
  51031. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  51032. if (node) {
  51033. if (Array.isArray(value)) {
  51034. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  51035. } else {
  51036. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  51037. }
  51038. } else {
  51039. (0, _util.warn)(`Node not found for path: ${path}`);
  51040. }
  51041. }
  51042. const buffer = [];
  51043. xml.documentElement.dump(buffer);
  51044. return buffer.join("");
  51045. }
  51046. function updateAcroform(_ref) {
  51047. let {
  51048. xref,
  51049. acroForm,
  51050. acroFormRef,
  51051. hasXfa,
  51052. hasXfaDatasetsEntry,
  51053. xfaDatasetsRef,
  51054. needAppearances,
  51055. newRefs
  51056. } = _ref;
  51057. if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
  51058. (0, _util.warn)("XFA - Cannot save it");
  51059. }
  51060. if (!needAppearances && (!hasXfa || !xfaDatasetsRef)) {
  51061. return;
  51062. }
  51063. const dict = new _primitives.Dict(xref);
  51064. for (const key of acroForm.getKeys()) {
  51065. dict.set(key, acroForm.getRaw(key));
  51066. }
  51067. if (hasXfa && !hasXfaDatasetsEntry) {
  51068. const newXfa = acroForm.get("XFA").slice();
  51069. newXfa.splice(2, 0, "datasets");
  51070. newXfa.splice(3, 0, xfaDatasetsRef);
  51071. dict.set("XFA", newXfa);
  51072. }
  51073. if (needAppearances) {
  51074. dict.set("NeedAppearances", true);
  51075. }
  51076. const encrypt = xref.encrypt;
  51077. let transform = null;
  51078. if (encrypt) {
  51079. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  51080. }
  51081. const buffer = [];
  51082. writeObject(acroFormRef, dict, buffer, transform);
  51083. newRefs.push({
  51084. ref: acroFormRef,
  51085. data: buffer.join("")
  51086. });
  51087. }
  51088. function updateXFA(_ref2) {
  51089. let {
  51090. xfaData,
  51091. xfaDatasetsRef,
  51092. newRefs,
  51093. xref
  51094. } = _ref2;
  51095. if (xfaData === null) {
  51096. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  51097. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  51098. }
  51099. const encrypt = xref.encrypt;
  51100. if (encrypt) {
  51101. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  51102. xfaData = transform.encryptString(xfaData);
  51103. }
  51104. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  51105. newRefs.push({
  51106. ref: xfaDatasetsRef,
  51107. data
  51108. });
  51109. }
  51110. function incrementalUpdate(_ref3) {
  51111. let {
  51112. originalData,
  51113. xrefInfo,
  51114. newRefs,
  51115. xref = null,
  51116. hasXfa = false,
  51117. xfaDatasetsRef = null,
  51118. hasXfaDatasetsEntry = false,
  51119. needAppearances,
  51120. acroFormRef = null,
  51121. acroForm = null,
  51122. xfaData = null
  51123. } = _ref3;
  51124. updateAcroform({
  51125. xref,
  51126. acroForm,
  51127. acroFormRef,
  51128. hasXfa,
  51129. hasXfaDatasetsEntry,
  51130. xfaDatasetsRef,
  51131. needAppearances,
  51132. newRefs
  51133. });
  51134. if (hasXfa) {
  51135. updateXFA({
  51136. xfaData,
  51137. xfaDatasetsRef,
  51138. newRefs,
  51139. xref
  51140. });
  51141. }
  51142. const newXref = new _primitives.Dict(null);
  51143. const refForXrefTable = xrefInfo.newRef;
  51144. let buffer, baseOffset;
  51145. const lastByte = originalData.at(-1);
  51146. if (lastByte === 0x0a || lastByte === 0x0d) {
  51147. buffer = [];
  51148. baseOffset = originalData.length;
  51149. } else {
  51150. buffer = ["\n"];
  51151. baseOffset = originalData.length + 1;
  51152. }
  51153. newXref.set("Size", refForXrefTable.num + 1);
  51154. newXref.set("Prev", xrefInfo.startXRef);
  51155. newXref.set("Type", _primitives.Name.get("XRef"));
  51156. if (xrefInfo.rootRef !== null) {
  51157. newXref.set("Root", xrefInfo.rootRef);
  51158. }
  51159. if (xrefInfo.infoRef !== null) {
  51160. newXref.set("Info", xrefInfo.infoRef);
  51161. }
  51162. if (xrefInfo.encryptRef !== null) {
  51163. newXref.set("Encrypt", xrefInfo.encryptRef);
  51164. }
  51165. newRefs.push({
  51166. ref: refForXrefTable,
  51167. data: ""
  51168. });
  51169. newRefs = newRefs.sort((a, b) => {
  51170. return a.ref.num - b.ref.num;
  51171. });
  51172. const xrefTableData = [[0, 1, 0xffff]];
  51173. const indexes = [0, 1];
  51174. let maxOffset = 0;
  51175. for (const {
  51176. ref,
  51177. data
  51178. } of newRefs) {
  51179. maxOffset = Math.max(maxOffset, baseOffset);
  51180. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  51181. baseOffset += data.length;
  51182. indexes.push(ref.num, 1);
  51183. buffer.push(data);
  51184. }
  51185. newXref.set("Index", indexes);
  51186. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  51187. const md5 = computeMD5(baseOffset, xrefInfo);
  51188. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  51189. }
  51190. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  51191. const sizes = [1, offsetSize, 2];
  51192. const structSize = sizes[0] + sizes[1] + sizes[2];
  51193. const tableLength = structSize * xrefTableData.length;
  51194. newXref.set("W", sizes);
  51195. newXref.set("Length", tableLength);
  51196. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  51197. writeDict(newXref, buffer, null);
  51198. buffer.push(" stream\n");
  51199. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  51200. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  51201. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  51202. array.set(originalData);
  51203. let offset = originalData.length;
  51204. for (const str of buffer) {
  51205. writeString(str, offset, array);
  51206. offset += str.length;
  51207. }
  51208. for (const [type, objOffset, gen] of xrefTableData) {
  51209. offset = writeInt(type, sizes[0], offset, array);
  51210. offset = writeInt(objOffset, sizes[1], offset, array);
  51211. offset = writeInt(gen, sizes[2], offset, array);
  51212. }
  51213. writeString(footer, offset, array);
  51214. return array;
  51215. }
  51216. /***/ }),
  51217. /* 195 */
  51218. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51219. "use strict";
  51220. Object.defineProperty(exports, "__esModule", ({
  51221. value: true
  51222. }));
  51223. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  51224. var _core_utils = __w_pdfjs_require__(135);
  51225. const XMLParserErrorCode = {
  51226. NoError: 0,
  51227. EndOfDocument: -1,
  51228. UnterminatedCdat: -2,
  51229. UnterminatedXmlDeclaration: -3,
  51230. UnterminatedDoctypeDeclaration: -4,
  51231. UnterminatedComment: -5,
  51232. MalformedElement: -6,
  51233. OutOfMemory: -7,
  51234. UnterminatedAttributeValue: -8,
  51235. UnterminatedElement: -9,
  51236. ElementNeverBegun: -10
  51237. };
  51238. exports.XMLParserErrorCode = XMLParserErrorCode;
  51239. function isWhitespace(s, index) {
  51240. const ch = s[index];
  51241. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  51242. }
  51243. function isWhitespaceString(s) {
  51244. for (let i = 0, ii = s.length; i < ii; i++) {
  51245. if (!isWhitespace(s, i)) {
  51246. return false;
  51247. }
  51248. }
  51249. return true;
  51250. }
  51251. class XMLParserBase {
  51252. _resolveEntities(s) {
  51253. return s.replace(/&([^;]+);/g, (all, entity) => {
  51254. if (entity.substring(0, 2) === "#x") {
  51255. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  51256. } else if (entity.substring(0, 1) === "#") {
  51257. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  51258. }
  51259. switch (entity) {
  51260. case "lt":
  51261. return "<";
  51262. case "gt":
  51263. return ">";
  51264. case "amp":
  51265. return "&";
  51266. case "quot":
  51267. return '"';
  51268. case "apos":
  51269. return "'";
  51270. }
  51271. return this.onResolveEntity(entity);
  51272. });
  51273. }
  51274. _parseContent(s, start) {
  51275. const attributes = [];
  51276. let pos = start;
  51277. function skipWs() {
  51278. while (pos < s.length && isWhitespace(s, pos)) {
  51279. ++pos;
  51280. }
  51281. }
  51282. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  51283. ++pos;
  51284. }
  51285. const name = s.substring(start, pos);
  51286. skipWs();
  51287. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  51288. skipWs();
  51289. let attrName = "",
  51290. attrValue = "";
  51291. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  51292. attrName += s[pos];
  51293. ++pos;
  51294. }
  51295. skipWs();
  51296. if (s[pos] !== "=") {
  51297. return null;
  51298. }
  51299. ++pos;
  51300. skipWs();
  51301. const attrEndChar = s[pos];
  51302. if (attrEndChar !== '"' && attrEndChar !== "'") {
  51303. return null;
  51304. }
  51305. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  51306. if (attrEndIndex < 0) {
  51307. return null;
  51308. }
  51309. attrValue = s.substring(pos, attrEndIndex);
  51310. attributes.push({
  51311. name: attrName,
  51312. value: this._resolveEntities(attrValue)
  51313. });
  51314. pos = attrEndIndex + 1;
  51315. skipWs();
  51316. }
  51317. return {
  51318. name,
  51319. attributes,
  51320. parsed: pos - start
  51321. };
  51322. }
  51323. _parseProcessingInstruction(s, start) {
  51324. let pos = start;
  51325. function skipWs() {
  51326. while (pos < s.length && isWhitespace(s, pos)) {
  51327. ++pos;
  51328. }
  51329. }
  51330. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  51331. ++pos;
  51332. }
  51333. const name = s.substring(start, pos);
  51334. skipWs();
  51335. const attrStart = pos;
  51336. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  51337. ++pos;
  51338. }
  51339. const value = s.substring(attrStart, pos);
  51340. return {
  51341. name,
  51342. value,
  51343. parsed: pos - start
  51344. };
  51345. }
  51346. parseXml(s) {
  51347. let i = 0;
  51348. while (i < s.length) {
  51349. const ch = s[i];
  51350. let j = i;
  51351. if (ch === "<") {
  51352. ++j;
  51353. const ch2 = s[j];
  51354. let q;
  51355. switch (ch2) {
  51356. case "/":
  51357. ++j;
  51358. q = s.indexOf(">", j);
  51359. if (q < 0) {
  51360. this.onError(XMLParserErrorCode.UnterminatedElement);
  51361. return;
  51362. }
  51363. this.onEndElement(s.substring(j, q));
  51364. j = q + 1;
  51365. break;
  51366. case "?":
  51367. ++j;
  51368. const pi = this._parseProcessingInstruction(s, j);
  51369. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  51370. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  51371. return;
  51372. }
  51373. this.onPi(pi.name, pi.value);
  51374. j += pi.parsed + 2;
  51375. break;
  51376. case "!":
  51377. if (s.substring(j + 1, j + 3) === "--") {
  51378. q = s.indexOf("-->", j + 3);
  51379. if (q < 0) {
  51380. this.onError(XMLParserErrorCode.UnterminatedComment);
  51381. return;
  51382. }
  51383. this.onComment(s.substring(j + 3, q));
  51384. j = q + 3;
  51385. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  51386. q = s.indexOf("]]>", j + 8);
  51387. if (q < 0) {
  51388. this.onError(XMLParserErrorCode.UnterminatedCdat);
  51389. return;
  51390. }
  51391. this.onCdata(s.substring(j + 8, q));
  51392. j = q + 3;
  51393. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  51394. const q2 = s.indexOf("[", j + 8);
  51395. let complexDoctype = false;
  51396. q = s.indexOf(">", j + 8);
  51397. if (q < 0) {
  51398. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  51399. return;
  51400. }
  51401. if (q2 > 0 && q > q2) {
  51402. q = s.indexOf("]>", j + 8);
  51403. if (q < 0) {
  51404. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  51405. return;
  51406. }
  51407. complexDoctype = true;
  51408. }
  51409. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  51410. this.onDoctype(doctypeContent);
  51411. j = q + (complexDoctype ? 2 : 1);
  51412. } else {
  51413. this.onError(XMLParserErrorCode.MalformedElement);
  51414. return;
  51415. }
  51416. break;
  51417. default:
  51418. const content = this._parseContent(s, j);
  51419. if (content === null) {
  51420. this.onError(XMLParserErrorCode.MalformedElement);
  51421. return;
  51422. }
  51423. let isClosed = false;
  51424. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  51425. isClosed = true;
  51426. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  51427. this.onError(XMLParserErrorCode.UnterminatedElement);
  51428. return;
  51429. }
  51430. this.onBeginElement(content.name, content.attributes, isClosed);
  51431. j += content.parsed + (isClosed ? 2 : 1);
  51432. break;
  51433. }
  51434. } else {
  51435. while (j < s.length && s[j] !== "<") {
  51436. j++;
  51437. }
  51438. const text = s.substring(i, j);
  51439. this.onText(this._resolveEntities(text));
  51440. }
  51441. i = j;
  51442. }
  51443. }
  51444. onResolveEntity(name) {
  51445. return `&${name};`;
  51446. }
  51447. onPi(name, value) {}
  51448. onComment(text) {}
  51449. onCdata(text) {}
  51450. onDoctype(doctypeContent) {}
  51451. onText(text) {}
  51452. onBeginElement(name, attributes, isEmpty) {}
  51453. onEndElement(name) {}
  51454. onError(code) {}
  51455. }
  51456. exports.XMLParserBase = XMLParserBase;
  51457. class SimpleDOMNode {
  51458. constructor(nodeName, nodeValue) {
  51459. this.nodeName = nodeName;
  51460. this.nodeValue = nodeValue;
  51461. Object.defineProperty(this, "parentNode", {
  51462. value: null,
  51463. writable: true
  51464. });
  51465. }
  51466. get firstChild() {
  51467. return this.childNodes && this.childNodes[0];
  51468. }
  51469. get nextSibling() {
  51470. const childNodes = this.parentNode.childNodes;
  51471. if (!childNodes) {
  51472. return undefined;
  51473. }
  51474. const index = childNodes.indexOf(this);
  51475. if (index === -1) {
  51476. return undefined;
  51477. }
  51478. return childNodes[index + 1];
  51479. }
  51480. get textContent() {
  51481. if (!this.childNodes) {
  51482. return this.nodeValue || "";
  51483. }
  51484. return this.childNodes.map(function (child) {
  51485. return child.textContent;
  51486. }).join("");
  51487. }
  51488. get children() {
  51489. return this.childNodes || [];
  51490. }
  51491. hasChildNodes() {
  51492. return this.childNodes && this.childNodes.length > 0;
  51493. }
  51494. searchNode(paths, pos) {
  51495. if (pos >= paths.length) {
  51496. return this;
  51497. }
  51498. const component = paths[pos];
  51499. const stack = [];
  51500. let node = this;
  51501. while (true) {
  51502. if (component.name === node.nodeName) {
  51503. if (component.pos === 0) {
  51504. const res = node.searchNode(paths, pos + 1);
  51505. if (res !== null) {
  51506. return res;
  51507. }
  51508. } else if (stack.length === 0) {
  51509. return null;
  51510. } else {
  51511. const [parent] = stack.pop();
  51512. let siblingPos = 0;
  51513. for (const child of parent.childNodes) {
  51514. if (component.name === child.nodeName) {
  51515. if (siblingPos === component.pos) {
  51516. return child.searchNode(paths, pos + 1);
  51517. }
  51518. siblingPos++;
  51519. }
  51520. }
  51521. return node.searchNode(paths, pos + 1);
  51522. }
  51523. }
  51524. if (node.childNodes && node.childNodes.length !== 0) {
  51525. stack.push([node, 0]);
  51526. node = node.childNodes[0];
  51527. } else if (stack.length === 0) {
  51528. return null;
  51529. } else {
  51530. while (stack.length !== 0) {
  51531. const [parent, currentPos] = stack.pop();
  51532. const newPos = currentPos + 1;
  51533. if (newPos < parent.childNodes.length) {
  51534. stack.push([parent, newPos]);
  51535. node = parent.childNodes[newPos];
  51536. break;
  51537. }
  51538. }
  51539. if (stack.length === 0) {
  51540. return null;
  51541. }
  51542. }
  51543. }
  51544. }
  51545. dump(buffer) {
  51546. if (this.nodeName === "#text") {
  51547. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  51548. return;
  51549. }
  51550. buffer.push(`<${this.nodeName}`);
  51551. if (this.attributes) {
  51552. for (const attribute of this.attributes) {
  51553. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  51554. }
  51555. }
  51556. if (this.hasChildNodes()) {
  51557. buffer.push(">");
  51558. for (const child of this.childNodes) {
  51559. child.dump(buffer);
  51560. }
  51561. buffer.push(`</${this.nodeName}>`);
  51562. } else if (this.nodeValue) {
  51563. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  51564. } else {
  51565. buffer.push("/>");
  51566. }
  51567. }
  51568. }
  51569. exports.SimpleDOMNode = SimpleDOMNode;
  51570. class SimpleXMLParser extends XMLParserBase {
  51571. constructor(_ref) {
  51572. let {
  51573. hasAttributes = false,
  51574. lowerCaseName = false
  51575. } = _ref;
  51576. super();
  51577. this._currentFragment = null;
  51578. this._stack = null;
  51579. this._errorCode = XMLParserErrorCode.NoError;
  51580. this._hasAttributes = hasAttributes;
  51581. this._lowerCaseName = lowerCaseName;
  51582. }
  51583. parseFromString(data) {
  51584. this._currentFragment = [];
  51585. this._stack = [];
  51586. this._errorCode = XMLParserErrorCode.NoError;
  51587. this.parseXml(data);
  51588. if (this._errorCode !== XMLParserErrorCode.NoError) {
  51589. return undefined;
  51590. }
  51591. const [documentElement] = this._currentFragment;
  51592. if (!documentElement) {
  51593. return undefined;
  51594. }
  51595. return {
  51596. documentElement
  51597. };
  51598. }
  51599. onText(text) {
  51600. if (isWhitespaceString(text)) {
  51601. return;
  51602. }
  51603. const node = new SimpleDOMNode("#text", text);
  51604. this._currentFragment.push(node);
  51605. }
  51606. onCdata(text) {
  51607. const node = new SimpleDOMNode("#text", text);
  51608. this._currentFragment.push(node);
  51609. }
  51610. onBeginElement(name, attributes, isEmpty) {
  51611. if (this._lowerCaseName) {
  51612. name = name.toLowerCase();
  51613. }
  51614. const node = new SimpleDOMNode(name);
  51615. node.childNodes = [];
  51616. if (this._hasAttributes) {
  51617. node.attributes = attributes;
  51618. }
  51619. this._currentFragment.push(node);
  51620. if (isEmpty) {
  51621. return;
  51622. }
  51623. this._stack.push(this._currentFragment);
  51624. this._currentFragment = node.childNodes;
  51625. }
  51626. onEndElement(name) {
  51627. this._currentFragment = this._stack.pop() || [];
  51628. const lastElement = this._currentFragment.at(-1);
  51629. if (!lastElement) {
  51630. return null;
  51631. }
  51632. for (const childNode of lastElement.childNodes) {
  51633. childNode.parentNode = lastElement;
  51634. }
  51635. return lastElement;
  51636. }
  51637. onError(code) {
  51638. this._errorCode = code;
  51639. }
  51640. }
  51641. exports.SimpleXMLParser = SimpleXMLParser;
  51642. /***/ }),
  51643. /* 196 */
  51644. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51645. "use strict";
  51646. Object.defineProperty(exports, "__esModule", ({
  51647. value: true
  51648. }));
  51649. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  51650. exports.calculateSHA384 = calculateSHA384;
  51651. exports.calculateSHA512 = void 0;
  51652. var _util = __w_pdfjs_require__(2);
  51653. var _primitives = __w_pdfjs_require__(134);
  51654. var _decrypt_stream = __w_pdfjs_require__(197);
  51655. class ARCFourCipher {
  51656. constructor(key) {
  51657. this.a = 0;
  51658. this.b = 0;
  51659. const s = new Uint8Array(256);
  51660. const keyLength = key.length;
  51661. for (let i = 0; i < 256; ++i) {
  51662. s[i] = i;
  51663. }
  51664. for (let i = 0, j = 0; i < 256; ++i) {
  51665. const tmp = s[i];
  51666. j = j + tmp + key[i % keyLength] & 0xff;
  51667. s[i] = s[j];
  51668. s[j] = tmp;
  51669. }
  51670. this.s = s;
  51671. }
  51672. encryptBlock(data) {
  51673. let a = this.a,
  51674. b = this.b;
  51675. const s = this.s;
  51676. const n = data.length;
  51677. const output = new Uint8Array(n);
  51678. for (let i = 0; i < n; ++i) {
  51679. a = a + 1 & 0xff;
  51680. const tmp = s[a];
  51681. b = b + tmp & 0xff;
  51682. const tmp2 = s[b];
  51683. s[a] = tmp2;
  51684. s[b] = tmp;
  51685. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  51686. }
  51687. this.a = a;
  51688. this.b = b;
  51689. return output;
  51690. }
  51691. decryptBlock(data) {
  51692. return this.encryptBlock(data);
  51693. }
  51694. encrypt(data) {
  51695. return this.encryptBlock(data);
  51696. }
  51697. }
  51698. exports.ARCFourCipher = ARCFourCipher;
  51699. const calculateMD5 = function calculateMD5Closure() {
  51700. 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]);
  51701. 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]);
  51702. function hash(data, offset, length) {
  51703. let h0 = 1732584193,
  51704. h1 = -271733879,
  51705. h2 = -1732584194,
  51706. h3 = 271733878;
  51707. const paddedLength = length + 72 & ~63;
  51708. const padded = new Uint8Array(paddedLength);
  51709. let i, j;
  51710. for (i = 0; i < length; ++i) {
  51711. padded[i] = data[offset++];
  51712. }
  51713. padded[i++] = 0x80;
  51714. const n = paddedLength - 8;
  51715. while (i < n) {
  51716. padded[i++] = 0;
  51717. }
  51718. padded[i++] = length << 3 & 0xff;
  51719. padded[i++] = length >> 5 & 0xff;
  51720. padded[i++] = length >> 13 & 0xff;
  51721. padded[i++] = length >> 21 & 0xff;
  51722. padded[i++] = length >>> 29 & 0xff;
  51723. padded[i++] = 0;
  51724. padded[i++] = 0;
  51725. padded[i++] = 0;
  51726. const w = new Int32Array(16);
  51727. for (i = 0; i < paddedLength;) {
  51728. for (j = 0; j < 16; ++j, i += 4) {
  51729. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  51730. }
  51731. let a = h0,
  51732. b = h1,
  51733. c = h2,
  51734. d = h3,
  51735. f,
  51736. g;
  51737. for (j = 0; j < 64; ++j) {
  51738. if (j < 16) {
  51739. f = b & c | ~b & d;
  51740. g = j;
  51741. } else if (j < 32) {
  51742. f = d & b | ~d & c;
  51743. g = 5 * j + 1 & 15;
  51744. } else if (j < 48) {
  51745. f = b ^ c ^ d;
  51746. g = 3 * j + 5 & 15;
  51747. } else {
  51748. f = c ^ (b | ~d);
  51749. g = 7 * j & 15;
  51750. }
  51751. const tmp = d,
  51752. rotateArg = a + f + k[j] + w[g] | 0,
  51753. rotate = r[j];
  51754. d = c;
  51755. c = b;
  51756. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  51757. a = tmp;
  51758. }
  51759. h0 = h0 + a | 0;
  51760. h1 = h1 + b | 0;
  51761. h2 = h2 + c | 0;
  51762. h3 = h3 + d | 0;
  51763. }
  51764. 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]);
  51765. }
  51766. return hash;
  51767. }();
  51768. exports.calculateMD5 = calculateMD5;
  51769. class Word64 {
  51770. constructor(highInteger, lowInteger) {
  51771. this.high = highInteger | 0;
  51772. this.low = lowInteger | 0;
  51773. }
  51774. and(word) {
  51775. this.high &= word.high;
  51776. this.low &= word.low;
  51777. }
  51778. xor(word) {
  51779. this.high ^= word.high;
  51780. this.low ^= word.low;
  51781. }
  51782. or(word) {
  51783. this.high |= word.high;
  51784. this.low |= word.low;
  51785. }
  51786. shiftRight(places) {
  51787. if (places >= 32) {
  51788. this.low = this.high >>> places - 32 | 0;
  51789. this.high = 0;
  51790. } else {
  51791. this.low = this.low >>> places | this.high << 32 - places;
  51792. this.high = this.high >>> places | 0;
  51793. }
  51794. }
  51795. shiftLeft(places) {
  51796. if (places >= 32) {
  51797. this.high = this.low << places - 32;
  51798. this.low = 0;
  51799. } else {
  51800. this.high = this.high << places | this.low >>> 32 - places;
  51801. this.low <<= places;
  51802. }
  51803. }
  51804. rotateRight(places) {
  51805. let low, high;
  51806. if (places & 32) {
  51807. high = this.low;
  51808. low = this.high;
  51809. } else {
  51810. low = this.low;
  51811. high = this.high;
  51812. }
  51813. places &= 31;
  51814. this.low = low >>> places | high << 32 - places;
  51815. this.high = high >>> places | low << 32 - places;
  51816. }
  51817. not() {
  51818. this.high = ~this.high;
  51819. this.low = ~this.low;
  51820. }
  51821. add(word) {
  51822. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  51823. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  51824. if (lowAdd > 0xffffffff) {
  51825. highAdd += 1;
  51826. }
  51827. this.low = lowAdd | 0;
  51828. this.high = highAdd | 0;
  51829. }
  51830. copyTo(bytes, offset) {
  51831. bytes[offset] = this.high >>> 24 & 0xff;
  51832. bytes[offset + 1] = this.high >> 16 & 0xff;
  51833. bytes[offset + 2] = this.high >> 8 & 0xff;
  51834. bytes[offset + 3] = this.high & 0xff;
  51835. bytes[offset + 4] = this.low >>> 24 & 0xff;
  51836. bytes[offset + 5] = this.low >> 16 & 0xff;
  51837. bytes[offset + 6] = this.low >> 8 & 0xff;
  51838. bytes[offset + 7] = this.low & 0xff;
  51839. }
  51840. assign(word) {
  51841. this.high = word.high;
  51842. this.low = word.low;
  51843. }
  51844. }
  51845. const calculateSHA256 = function calculateSHA256Closure() {
  51846. function rotr(x, n) {
  51847. return x >>> n | x << 32 - n;
  51848. }
  51849. function ch(x, y, z) {
  51850. return x & y ^ ~x & z;
  51851. }
  51852. function maj(x, y, z) {
  51853. return x & y ^ x & z ^ y & z;
  51854. }
  51855. function sigma(x) {
  51856. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  51857. }
  51858. function sigmaPrime(x) {
  51859. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  51860. }
  51861. function littleSigma(x) {
  51862. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  51863. }
  51864. function littleSigmaPrime(x) {
  51865. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  51866. }
  51867. 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];
  51868. function hash(data, offset, length) {
  51869. let h0 = 0x6a09e667,
  51870. h1 = 0xbb67ae85,
  51871. h2 = 0x3c6ef372,
  51872. h3 = 0xa54ff53a,
  51873. h4 = 0x510e527f,
  51874. h5 = 0x9b05688c,
  51875. h6 = 0x1f83d9ab,
  51876. h7 = 0x5be0cd19;
  51877. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  51878. const padded = new Uint8Array(paddedLength);
  51879. let i, j;
  51880. for (i = 0; i < length; ++i) {
  51881. padded[i] = data[offset++];
  51882. }
  51883. padded[i++] = 0x80;
  51884. const n = paddedLength - 8;
  51885. while (i < n) {
  51886. padded[i++] = 0;
  51887. }
  51888. padded[i++] = 0;
  51889. padded[i++] = 0;
  51890. padded[i++] = 0;
  51891. padded[i++] = length >>> 29 & 0xff;
  51892. padded[i++] = length >> 21 & 0xff;
  51893. padded[i++] = length >> 13 & 0xff;
  51894. padded[i++] = length >> 5 & 0xff;
  51895. padded[i++] = length << 3 & 0xff;
  51896. const w = new Uint32Array(64);
  51897. for (i = 0; i < paddedLength;) {
  51898. for (j = 0; j < 16; ++j) {
  51899. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  51900. i += 4;
  51901. }
  51902. for (j = 16; j < 64; ++j) {
  51903. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  51904. }
  51905. let a = h0,
  51906. b = h1,
  51907. c = h2,
  51908. d = h3,
  51909. e = h4,
  51910. f = h5,
  51911. g = h6,
  51912. h = h7,
  51913. t1,
  51914. t2;
  51915. for (j = 0; j < 64; ++j) {
  51916. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  51917. t2 = sigma(a) + maj(a, b, c);
  51918. h = g;
  51919. g = f;
  51920. f = e;
  51921. e = d + t1 | 0;
  51922. d = c;
  51923. c = b;
  51924. b = a;
  51925. a = t1 + t2 | 0;
  51926. }
  51927. h0 = h0 + a | 0;
  51928. h1 = h1 + b | 0;
  51929. h2 = h2 + c | 0;
  51930. h3 = h3 + d | 0;
  51931. h4 = h4 + e | 0;
  51932. h5 = h5 + f | 0;
  51933. h6 = h6 + g | 0;
  51934. h7 = h7 + h | 0;
  51935. }
  51936. 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]);
  51937. }
  51938. return hash;
  51939. }();
  51940. exports.calculateSHA256 = calculateSHA256;
  51941. const calculateSHA512 = function calculateSHA512Closure() {
  51942. function ch(result, x, y, z, tmp) {
  51943. result.assign(x);
  51944. result.and(y);
  51945. tmp.assign(x);
  51946. tmp.not();
  51947. tmp.and(z);
  51948. result.xor(tmp);
  51949. }
  51950. function maj(result, x, y, z, tmp) {
  51951. result.assign(x);
  51952. result.and(y);
  51953. tmp.assign(x);
  51954. tmp.and(z);
  51955. result.xor(tmp);
  51956. tmp.assign(y);
  51957. tmp.and(z);
  51958. result.xor(tmp);
  51959. }
  51960. function sigma(result, x, tmp) {
  51961. result.assign(x);
  51962. result.rotateRight(28);
  51963. tmp.assign(x);
  51964. tmp.rotateRight(34);
  51965. result.xor(tmp);
  51966. tmp.assign(x);
  51967. tmp.rotateRight(39);
  51968. result.xor(tmp);
  51969. }
  51970. function sigmaPrime(result, x, tmp) {
  51971. result.assign(x);
  51972. result.rotateRight(14);
  51973. tmp.assign(x);
  51974. tmp.rotateRight(18);
  51975. result.xor(tmp);
  51976. tmp.assign(x);
  51977. tmp.rotateRight(41);
  51978. result.xor(tmp);
  51979. }
  51980. function littleSigma(result, x, tmp) {
  51981. result.assign(x);
  51982. result.rotateRight(1);
  51983. tmp.assign(x);
  51984. tmp.rotateRight(8);
  51985. result.xor(tmp);
  51986. tmp.assign(x);
  51987. tmp.shiftRight(7);
  51988. result.xor(tmp);
  51989. }
  51990. function littleSigmaPrime(result, x, tmp) {
  51991. result.assign(x);
  51992. result.rotateRight(19);
  51993. tmp.assign(x);
  51994. tmp.rotateRight(61);
  51995. result.xor(tmp);
  51996. tmp.assign(x);
  51997. tmp.shiftRight(6);
  51998. result.xor(tmp);
  51999. }
  52000. 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)];
  52001. function hash(data, offset, length) {
  52002. let mode384 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  52003. let h0, h1, h2, h3, h4, h5, h6, h7;
  52004. if (!mode384) {
  52005. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  52006. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  52007. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  52008. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  52009. h4 = new Word64(0x510e527f, 0xade682d1);
  52010. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  52011. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  52012. h7 = new Word64(0x5be0cd19, 0x137e2179);
  52013. } else {
  52014. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  52015. h1 = new Word64(0x629a292a, 0x367cd507);
  52016. h2 = new Word64(0x9159015a, 0x3070dd17);
  52017. h3 = new Word64(0x152fecd8, 0xf70e5939);
  52018. h4 = new Word64(0x67332667, 0xffc00b31);
  52019. h5 = new Word64(0x8eb44a87, 0x68581511);
  52020. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  52021. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  52022. }
  52023. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  52024. const padded = new Uint8Array(paddedLength);
  52025. let i, j;
  52026. for (i = 0; i < length; ++i) {
  52027. padded[i] = data[offset++];
  52028. }
  52029. padded[i++] = 0x80;
  52030. const n = paddedLength - 16;
  52031. while (i < n) {
  52032. padded[i++] = 0;
  52033. }
  52034. padded[i++] = 0;
  52035. padded[i++] = 0;
  52036. padded[i++] = 0;
  52037. padded[i++] = 0;
  52038. padded[i++] = 0;
  52039. padded[i++] = 0;
  52040. padded[i++] = 0;
  52041. padded[i++] = 0;
  52042. padded[i++] = 0;
  52043. padded[i++] = 0;
  52044. padded[i++] = 0;
  52045. padded[i++] = length >>> 29 & 0xff;
  52046. padded[i++] = length >> 21 & 0xff;
  52047. padded[i++] = length >> 13 & 0xff;
  52048. padded[i++] = length >> 5 & 0xff;
  52049. padded[i++] = length << 3 & 0xff;
  52050. const w = new Array(80);
  52051. for (i = 0; i < 80; i++) {
  52052. w[i] = new Word64(0, 0);
  52053. }
  52054. let a = new Word64(0, 0),
  52055. b = new Word64(0, 0),
  52056. c = new Word64(0, 0);
  52057. let d = new Word64(0, 0),
  52058. e = new Word64(0, 0),
  52059. f = new Word64(0, 0);
  52060. let g = new Word64(0, 0),
  52061. h = new Word64(0, 0);
  52062. const t1 = new Word64(0, 0),
  52063. t2 = new Word64(0, 0);
  52064. const tmp1 = new Word64(0, 0),
  52065. tmp2 = new Word64(0, 0);
  52066. let tmp3;
  52067. for (i = 0; i < paddedLength;) {
  52068. for (j = 0; j < 16; ++j) {
  52069. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  52070. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  52071. i += 8;
  52072. }
  52073. for (j = 16; j < 80; ++j) {
  52074. tmp3 = w[j];
  52075. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  52076. tmp3.add(w[j - 7]);
  52077. littleSigma(tmp1, w[j - 15], tmp2);
  52078. tmp3.add(tmp1);
  52079. tmp3.add(w[j - 16]);
  52080. }
  52081. a.assign(h0);
  52082. b.assign(h1);
  52083. c.assign(h2);
  52084. d.assign(h3);
  52085. e.assign(h4);
  52086. f.assign(h5);
  52087. g.assign(h6);
  52088. h.assign(h7);
  52089. for (j = 0; j < 80; ++j) {
  52090. t1.assign(h);
  52091. sigmaPrime(tmp1, e, tmp2);
  52092. t1.add(tmp1);
  52093. ch(tmp1, e, f, g, tmp2);
  52094. t1.add(tmp1);
  52095. t1.add(k[j]);
  52096. t1.add(w[j]);
  52097. sigma(t2, a, tmp2);
  52098. maj(tmp1, a, b, c, tmp2);
  52099. t2.add(tmp1);
  52100. tmp3 = h;
  52101. h = g;
  52102. g = f;
  52103. f = e;
  52104. d.add(t1);
  52105. e = d;
  52106. d = c;
  52107. c = b;
  52108. b = a;
  52109. tmp3.assign(t1);
  52110. tmp3.add(t2);
  52111. a = tmp3;
  52112. }
  52113. h0.add(a);
  52114. h1.add(b);
  52115. h2.add(c);
  52116. h3.add(d);
  52117. h4.add(e);
  52118. h5.add(f);
  52119. h6.add(g);
  52120. h7.add(h);
  52121. }
  52122. let result;
  52123. if (!mode384) {
  52124. result = new Uint8Array(64);
  52125. h0.copyTo(result, 0);
  52126. h1.copyTo(result, 8);
  52127. h2.copyTo(result, 16);
  52128. h3.copyTo(result, 24);
  52129. h4.copyTo(result, 32);
  52130. h5.copyTo(result, 40);
  52131. h6.copyTo(result, 48);
  52132. h7.copyTo(result, 56);
  52133. } else {
  52134. result = new Uint8Array(48);
  52135. h0.copyTo(result, 0);
  52136. h1.copyTo(result, 8);
  52137. h2.copyTo(result, 16);
  52138. h3.copyTo(result, 24);
  52139. h4.copyTo(result, 32);
  52140. h5.copyTo(result, 40);
  52141. }
  52142. return result;
  52143. }
  52144. return hash;
  52145. }();
  52146. exports.calculateSHA512 = calculateSHA512;
  52147. function calculateSHA384(data, offset, length) {
  52148. return calculateSHA512(data, offset, length, true);
  52149. }
  52150. class NullCipher {
  52151. decryptBlock(data) {
  52152. return data;
  52153. }
  52154. encrypt(data) {
  52155. return data;
  52156. }
  52157. }
  52158. class AESBaseCipher {
  52159. constructor() {
  52160. if (this.constructor === AESBaseCipher) {
  52161. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  52162. }
  52163. 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]);
  52164. 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]);
  52165. 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]);
  52166. this._mixCol = new Uint8Array(256);
  52167. for (let i = 0; i < 256; i++) {
  52168. if (i < 128) {
  52169. this._mixCol[i] = i << 1;
  52170. } else {
  52171. this._mixCol[i] = i << 1 ^ 0x1b;
  52172. }
  52173. }
  52174. this.buffer = new Uint8Array(16);
  52175. this.bufferPosition = 0;
  52176. }
  52177. _expandKey(cipherKey) {
  52178. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  52179. }
  52180. _decrypt(input, key) {
  52181. let t, u, v;
  52182. const state = new Uint8Array(16);
  52183. state.set(input);
  52184. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  52185. state[j] ^= key[k];
  52186. }
  52187. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  52188. t = state[13];
  52189. state[13] = state[9];
  52190. state[9] = state[5];
  52191. state[5] = state[1];
  52192. state[1] = t;
  52193. t = state[14];
  52194. u = state[10];
  52195. state[14] = state[6];
  52196. state[10] = state[2];
  52197. state[6] = t;
  52198. state[2] = u;
  52199. t = state[15];
  52200. u = state[11];
  52201. v = state[7];
  52202. state[15] = state[3];
  52203. state[11] = t;
  52204. state[7] = u;
  52205. state[3] = v;
  52206. for (let j = 0; j < 16; ++j) {
  52207. state[j] = this._inv_s[state[j]];
  52208. }
  52209. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  52210. state[j] ^= key[k];
  52211. }
  52212. for (let j = 0; j < 16; j += 4) {
  52213. const s0 = this._mix[state[j]];
  52214. const s1 = this._mix[state[j + 1]];
  52215. const s2 = this._mix[state[j + 2]];
  52216. const s3 = this._mix[state[j + 3]];
  52217. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  52218. state[j] = t >>> 24 & 0xff;
  52219. state[j + 1] = t >> 16 & 0xff;
  52220. state[j + 2] = t >> 8 & 0xff;
  52221. state[j + 3] = t & 0xff;
  52222. }
  52223. }
  52224. t = state[13];
  52225. state[13] = state[9];
  52226. state[9] = state[5];
  52227. state[5] = state[1];
  52228. state[1] = t;
  52229. t = state[14];
  52230. u = state[10];
  52231. state[14] = state[6];
  52232. state[10] = state[2];
  52233. state[6] = t;
  52234. state[2] = u;
  52235. t = state[15];
  52236. u = state[11];
  52237. v = state[7];
  52238. state[15] = state[3];
  52239. state[11] = t;
  52240. state[7] = u;
  52241. state[3] = v;
  52242. for (let j = 0; j < 16; ++j) {
  52243. state[j] = this._inv_s[state[j]];
  52244. state[j] ^= key[j];
  52245. }
  52246. return state;
  52247. }
  52248. _encrypt(input, key) {
  52249. const s = this._s;
  52250. let t, u, v;
  52251. const state = new Uint8Array(16);
  52252. state.set(input);
  52253. for (let j = 0; j < 16; ++j) {
  52254. state[j] ^= key[j];
  52255. }
  52256. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  52257. for (let j = 0; j < 16; ++j) {
  52258. state[j] = s[state[j]];
  52259. }
  52260. v = state[1];
  52261. state[1] = state[5];
  52262. state[5] = state[9];
  52263. state[9] = state[13];
  52264. state[13] = v;
  52265. v = state[2];
  52266. u = state[6];
  52267. state[2] = state[10];
  52268. state[6] = state[14];
  52269. state[10] = v;
  52270. state[14] = u;
  52271. v = state[3];
  52272. u = state[7];
  52273. t = state[11];
  52274. state[3] = state[15];
  52275. state[7] = v;
  52276. state[11] = u;
  52277. state[15] = t;
  52278. for (let j = 0; j < 16; j += 4) {
  52279. const s0 = state[j + 0];
  52280. const s1 = state[j + 1];
  52281. const s2 = state[j + 2];
  52282. const s3 = state[j + 3];
  52283. t = s0 ^ s1 ^ s2 ^ s3;
  52284. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  52285. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  52286. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  52287. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  52288. }
  52289. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  52290. state[j] ^= key[k];
  52291. }
  52292. }
  52293. for (let j = 0; j < 16; ++j) {
  52294. state[j] = s[state[j]];
  52295. }
  52296. v = state[1];
  52297. state[1] = state[5];
  52298. state[5] = state[9];
  52299. state[9] = state[13];
  52300. state[13] = v;
  52301. v = state[2];
  52302. u = state[6];
  52303. state[2] = state[10];
  52304. state[6] = state[14];
  52305. state[10] = v;
  52306. state[14] = u;
  52307. v = state[3];
  52308. u = state[7];
  52309. t = state[11];
  52310. state[3] = state[15];
  52311. state[7] = v;
  52312. state[11] = u;
  52313. state[15] = t;
  52314. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  52315. state[j] ^= key[k];
  52316. }
  52317. return state;
  52318. }
  52319. _decryptBlock2(data, finalize) {
  52320. const sourceLength = data.length;
  52321. let buffer = this.buffer,
  52322. bufferLength = this.bufferPosition;
  52323. const result = [];
  52324. let iv = this.iv;
  52325. for (let i = 0; i < sourceLength; ++i) {
  52326. buffer[bufferLength] = data[i];
  52327. ++bufferLength;
  52328. if (bufferLength < 16) {
  52329. continue;
  52330. }
  52331. const plain = this._decrypt(buffer, this._key);
  52332. for (let j = 0; j < 16; ++j) {
  52333. plain[j] ^= iv[j];
  52334. }
  52335. iv = buffer;
  52336. result.push(plain);
  52337. buffer = new Uint8Array(16);
  52338. bufferLength = 0;
  52339. }
  52340. this.buffer = buffer;
  52341. this.bufferLength = bufferLength;
  52342. this.iv = iv;
  52343. if (result.length === 0) {
  52344. return new Uint8Array(0);
  52345. }
  52346. let outputLength = 16 * result.length;
  52347. if (finalize) {
  52348. const lastBlock = result.at(-1);
  52349. let psLen = lastBlock[15];
  52350. if (psLen <= 16) {
  52351. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  52352. if (lastBlock[i] !== psLen) {
  52353. psLen = 0;
  52354. break;
  52355. }
  52356. }
  52357. outputLength -= psLen;
  52358. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  52359. }
  52360. }
  52361. const output = new Uint8Array(outputLength);
  52362. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  52363. output.set(result[i], j);
  52364. }
  52365. return output;
  52366. }
  52367. decryptBlock(data, finalize) {
  52368. let iv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  52369. const sourceLength = data.length;
  52370. const buffer = this.buffer;
  52371. let bufferLength = this.bufferPosition;
  52372. if (iv) {
  52373. this.iv = iv;
  52374. } else {
  52375. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  52376. buffer[bufferLength] = data[i];
  52377. }
  52378. if (bufferLength < 16) {
  52379. this.bufferLength = bufferLength;
  52380. return new Uint8Array(0);
  52381. }
  52382. this.iv = buffer;
  52383. data = data.subarray(16);
  52384. }
  52385. this.buffer = new Uint8Array(16);
  52386. this.bufferLength = 0;
  52387. this.decryptBlock = this._decryptBlock2;
  52388. return this.decryptBlock(data, finalize);
  52389. }
  52390. encrypt(data, iv) {
  52391. const sourceLength = data.length;
  52392. let buffer = this.buffer,
  52393. bufferLength = this.bufferPosition;
  52394. const result = [];
  52395. if (!iv) {
  52396. iv = new Uint8Array(16);
  52397. }
  52398. for (let i = 0; i < sourceLength; ++i) {
  52399. buffer[bufferLength] = data[i];
  52400. ++bufferLength;
  52401. if (bufferLength < 16) {
  52402. continue;
  52403. }
  52404. for (let j = 0; j < 16; ++j) {
  52405. buffer[j] ^= iv[j];
  52406. }
  52407. const cipher = this._encrypt(buffer, this._key);
  52408. iv = cipher;
  52409. result.push(cipher);
  52410. buffer = new Uint8Array(16);
  52411. bufferLength = 0;
  52412. }
  52413. this.buffer = buffer;
  52414. this.bufferLength = bufferLength;
  52415. this.iv = iv;
  52416. if (result.length === 0) {
  52417. return new Uint8Array(0);
  52418. }
  52419. const outputLength = 16 * result.length;
  52420. const output = new Uint8Array(outputLength);
  52421. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  52422. output.set(result[i], j);
  52423. }
  52424. return output;
  52425. }
  52426. }
  52427. class AES128Cipher extends AESBaseCipher {
  52428. constructor(key) {
  52429. super();
  52430. this._cyclesOfRepetition = 10;
  52431. this._keySize = 160;
  52432. 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]);
  52433. this._key = this._expandKey(key);
  52434. }
  52435. _expandKey(cipherKey) {
  52436. const b = 176;
  52437. const s = this._s;
  52438. const rcon = this._rcon;
  52439. const result = new Uint8Array(b);
  52440. result.set(cipherKey);
  52441. for (let j = 16, i = 1; j < b; ++i) {
  52442. let t1 = result[j - 3];
  52443. let t2 = result[j - 2];
  52444. let t3 = result[j - 1];
  52445. let t4 = result[j - 4];
  52446. t1 = s[t1];
  52447. t2 = s[t2];
  52448. t3 = s[t3];
  52449. t4 = s[t4];
  52450. t1 ^= rcon[i];
  52451. for (let n = 0; n < 4; ++n) {
  52452. result[j] = t1 ^= result[j - 16];
  52453. j++;
  52454. result[j] = t2 ^= result[j - 16];
  52455. j++;
  52456. result[j] = t3 ^= result[j - 16];
  52457. j++;
  52458. result[j] = t4 ^= result[j - 16];
  52459. j++;
  52460. }
  52461. }
  52462. return result;
  52463. }
  52464. }
  52465. exports.AES128Cipher = AES128Cipher;
  52466. class AES256Cipher extends AESBaseCipher {
  52467. constructor(key) {
  52468. super();
  52469. this._cyclesOfRepetition = 14;
  52470. this._keySize = 224;
  52471. this._key = this._expandKey(key);
  52472. }
  52473. _expandKey(cipherKey) {
  52474. const b = 240;
  52475. const s = this._s;
  52476. const result = new Uint8Array(b);
  52477. result.set(cipherKey);
  52478. let r = 1;
  52479. let t1, t2, t3, t4;
  52480. for (let j = 32, i = 1; j < b; ++i) {
  52481. if (j % 32 === 16) {
  52482. t1 = s[t1];
  52483. t2 = s[t2];
  52484. t3 = s[t3];
  52485. t4 = s[t4];
  52486. } else if (j % 32 === 0) {
  52487. t1 = result[j - 3];
  52488. t2 = result[j - 2];
  52489. t3 = result[j - 1];
  52490. t4 = result[j - 4];
  52491. t1 = s[t1];
  52492. t2 = s[t2];
  52493. t3 = s[t3];
  52494. t4 = s[t4];
  52495. t1 ^= r;
  52496. if ((r <<= 1) >= 256) {
  52497. r = (r ^ 0x1b) & 0xff;
  52498. }
  52499. }
  52500. for (let n = 0; n < 4; ++n) {
  52501. result[j] = t1 ^= result[j - 32];
  52502. j++;
  52503. result[j] = t2 ^= result[j - 32];
  52504. j++;
  52505. result[j] = t3 ^= result[j - 32];
  52506. j++;
  52507. result[j] = t4 ^= result[j - 32];
  52508. j++;
  52509. }
  52510. }
  52511. return result;
  52512. }
  52513. }
  52514. exports.AES256Cipher = AES256Cipher;
  52515. class PDF17 {
  52516. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52517. const hashData = new Uint8Array(password.length + 56);
  52518. hashData.set(password, 0);
  52519. hashData.set(ownerValidationSalt, password.length);
  52520. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52521. const result = calculateSHA256(hashData, 0, hashData.length);
  52522. return (0, _util.isArrayEqual)(result, ownerPassword);
  52523. }
  52524. checkUserPassword(password, userValidationSalt, userPassword) {
  52525. const hashData = new Uint8Array(password.length + 8);
  52526. hashData.set(password, 0);
  52527. hashData.set(userValidationSalt, password.length);
  52528. const result = calculateSHA256(hashData, 0, hashData.length);
  52529. return (0, _util.isArrayEqual)(result, userPassword);
  52530. }
  52531. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52532. const hashData = new Uint8Array(password.length + 56);
  52533. hashData.set(password, 0);
  52534. hashData.set(ownerKeySalt, password.length);
  52535. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52536. const key = calculateSHA256(hashData, 0, hashData.length);
  52537. const cipher = new AES256Cipher(key);
  52538. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52539. }
  52540. getUserKey(password, userKeySalt, userEncryption) {
  52541. const hashData = new Uint8Array(password.length + 8);
  52542. hashData.set(password, 0);
  52543. hashData.set(userKeySalt, password.length);
  52544. const key = calculateSHA256(hashData, 0, hashData.length);
  52545. const cipher = new AES256Cipher(key);
  52546. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52547. }
  52548. }
  52549. exports.PDF17 = PDF17;
  52550. const PDF20 = function PDF20Closure() {
  52551. function calculatePDF20Hash(password, input, userBytes) {
  52552. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  52553. let e = [0];
  52554. let i = 0;
  52555. while (i < 64 || e.at(-1) > i - 32) {
  52556. const combinedLength = password.length + k.length + userBytes.length,
  52557. combinedArray = new Uint8Array(combinedLength);
  52558. let writeOffset = 0;
  52559. combinedArray.set(password, writeOffset);
  52560. writeOffset += password.length;
  52561. combinedArray.set(k, writeOffset);
  52562. writeOffset += k.length;
  52563. combinedArray.set(userBytes, writeOffset);
  52564. const k1 = new Uint8Array(combinedLength * 64);
  52565. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  52566. k1.set(combinedArray, pos);
  52567. }
  52568. const cipher = new AES128Cipher(k.subarray(0, 16));
  52569. e = cipher.encrypt(k1, k.subarray(16, 32));
  52570. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  52571. if (remainder === 0) {
  52572. k = calculateSHA256(e, 0, e.length);
  52573. } else if (remainder === 1) {
  52574. k = calculateSHA384(e, 0, e.length);
  52575. } else if (remainder === 2) {
  52576. k = calculateSHA512(e, 0, e.length);
  52577. }
  52578. i++;
  52579. }
  52580. return k.subarray(0, 32);
  52581. }
  52582. class PDF20 {
  52583. hash(password, concatBytes, userBytes) {
  52584. return calculatePDF20Hash(password, concatBytes, userBytes);
  52585. }
  52586. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52587. const hashData = new Uint8Array(password.length + 56);
  52588. hashData.set(password, 0);
  52589. hashData.set(ownerValidationSalt, password.length);
  52590. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52591. const result = calculatePDF20Hash(password, hashData, userBytes);
  52592. return (0, _util.isArrayEqual)(result, ownerPassword);
  52593. }
  52594. checkUserPassword(password, userValidationSalt, userPassword) {
  52595. const hashData = new Uint8Array(password.length + 8);
  52596. hashData.set(password, 0);
  52597. hashData.set(userValidationSalt, password.length);
  52598. const result = calculatePDF20Hash(password, hashData, []);
  52599. return (0, _util.isArrayEqual)(result, userPassword);
  52600. }
  52601. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52602. const hashData = new Uint8Array(password.length + 56);
  52603. hashData.set(password, 0);
  52604. hashData.set(ownerKeySalt, password.length);
  52605. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52606. const key = calculatePDF20Hash(password, hashData, userBytes);
  52607. const cipher = new AES256Cipher(key);
  52608. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52609. }
  52610. getUserKey(password, userKeySalt, userEncryption) {
  52611. const hashData = new Uint8Array(password.length + 8);
  52612. hashData.set(password, 0);
  52613. hashData.set(userKeySalt, password.length);
  52614. const key = calculatePDF20Hash(password, hashData, []);
  52615. const cipher = new AES256Cipher(key);
  52616. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52617. }
  52618. }
  52619. return PDF20;
  52620. }();
  52621. exports.PDF20 = PDF20;
  52622. class CipherTransform {
  52623. constructor(stringCipherConstructor, streamCipherConstructor) {
  52624. this.StringCipherConstructor = stringCipherConstructor;
  52625. this.StreamCipherConstructor = streamCipherConstructor;
  52626. }
  52627. createStream(stream, length) {
  52628. const cipher = new this.StreamCipherConstructor();
  52629. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  52630. return cipher.decryptBlock(data, finalize);
  52631. });
  52632. }
  52633. decryptString(s) {
  52634. const cipher = new this.StringCipherConstructor();
  52635. let data = (0, _util.stringToBytes)(s);
  52636. data = cipher.decryptBlock(data, true);
  52637. return (0, _util.bytesToString)(data);
  52638. }
  52639. encryptString(s) {
  52640. const cipher = new this.StringCipherConstructor();
  52641. if (cipher instanceof AESBaseCipher) {
  52642. const strLen = s.length;
  52643. const pad = 16 - strLen % 16;
  52644. s += String.fromCharCode(pad).repeat(pad);
  52645. const iv = new Uint8Array(16);
  52646. if (typeof crypto !== "undefined") {
  52647. crypto.getRandomValues(iv);
  52648. } else {
  52649. for (let i = 0; i < 16; i++) {
  52650. iv[i] = Math.floor(256 * Math.random());
  52651. }
  52652. }
  52653. let data = (0, _util.stringToBytes)(s);
  52654. data = cipher.encrypt(data, iv);
  52655. const buf = new Uint8Array(16 + data.length);
  52656. buf.set(iv);
  52657. buf.set(data, 16);
  52658. return (0, _util.bytesToString)(buf);
  52659. }
  52660. let data = (0, _util.stringToBytes)(s);
  52661. data = cipher.encrypt(data);
  52662. return (0, _util.bytesToString)(data);
  52663. }
  52664. }
  52665. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  52666. 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]);
  52667. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  52668. if (password) {
  52669. const passwordLength = Math.min(127, password.length);
  52670. password = password.subarray(0, passwordLength);
  52671. } else {
  52672. password = [];
  52673. }
  52674. let pdfAlgorithm;
  52675. if (revision === 6) {
  52676. pdfAlgorithm = new PDF20();
  52677. } else {
  52678. pdfAlgorithm = new PDF17();
  52679. }
  52680. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  52681. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  52682. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  52683. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  52684. }
  52685. return null;
  52686. }
  52687. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  52688. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  52689. const hashData = new Uint8Array(hashDataSize);
  52690. let i = 0,
  52691. j,
  52692. n;
  52693. if (password) {
  52694. n = Math.min(32, password.length);
  52695. for (; i < n; ++i) {
  52696. hashData[i] = password[i];
  52697. }
  52698. }
  52699. j = 0;
  52700. while (i < 32) {
  52701. hashData[i++] = defaultPasswordBytes[j++];
  52702. }
  52703. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  52704. hashData[i++] = ownerPassword[j];
  52705. }
  52706. hashData[i++] = flags & 0xff;
  52707. hashData[i++] = flags >> 8 & 0xff;
  52708. hashData[i++] = flags >> 16 & 0xff;
  52709. hashData[i++] = flags >>> 24 & 0xff;
  52710. for (j = 0, n = fileId.length; j < n; ++j) {
  52711. hashData[i++] = fileId[j];
  52712. }
  52713. if (revision >= 4 && !encryptMetadata) {
  52714. hashData[i++] = 0xff;
  52715. hashData[i++] = 0xff;
  52716. hashData[i++] = 0xff;
  52717. hashData[i++] = 0xff;
  52718. }
  52719. let hash = calculateMD5(hashData, 0, i);
  52720. const keyLengthInBytes = keyLength >> 3;
  52721. if (revision >= 3) {
  52722. for (j = 0; j < 50; ++j) {
  52723. hash = calculateMD5(hash, 0, keyLengthInBytes);
  52724. }
  52725. }
  52726. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  52727. let cipher, checkData;
  52728. if (revision >= 3) {
  52729. for (i = 0; i < 32; ++i) {
  52730. hashData[i] = defaultPasswordBytes[i];
  52731. }
  52732. for (j = 0, n = fileId.length; j < n; ++j) {
  52733. hashData[i++] = fileId[j];
  52734. }
  52735. cipher = new ARCFourCipher(encryptionKey);
  52736. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  52737. n = encryptionKey.length;
  52738. const derivedKey = new Uint8Array(n);
  52739. for (j = 1; j <= 19; ++j) {
  52740. for (let k = 0; k < n; ++k) {
  52741. derivedKey[k] = encryptionKey[k] ^ j;
  52742. }
  52743. cipher = new ARCFourCipher(derivedKey);
  52744. checkData = cipher.encryptBlock(checkData);
  52745. }
  52746. for (j = 0, n = checkData.length; j < n; ++j) {
  52747. if (userPassword[j] !== checkData[j]) {
  52748. return null;
  52749. }
  52750. }
  52751. } else {
  52752. cipher = new ARCFourCipher(encryptionKey);
  52753. checkData = cipher.encryptBlock(defaultPasswordBytes);
  52754. for (j = 0, n = checkData.length; j < n; ++j) {
  52755. if (userPassword[j] !== checkData[j]) {
  52756. return null;
  52757. }
  52758. }
  52759. }
  52760. return encryptionKey;
  52761. }
  52762. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  52763. const hashData = new Uint8Array(32);
  52764. let i = 0;
  52765. const n = Math.min(32, password.length);
  52766. for (; i < n; ++i) {
  52767. hashData[i] = password[i];
  52768. }
  52769. let j = 0;
  52770. while (i < 32) {
  52771. hashData[i++] = defaultPasswordBytes[j++];
  52772. }
  52773. let hash = calculateMD5(hashData, 0, i);
  52774. const keyLengthInBytes = keyLength >> 3;
  52775. if (revision >= 3) {
  52776. for (j = 0; j < 50; ++j) {
  52777. hash = calculateMD5(hash, 0, hash.length);
  52778. }
  52779. }
  52780. let cipher, userPassword;
  52781. if (revision >= 3) {
  52782. userPassword = ownerPassword;
  52783. const derivedKey = new Uint8Array(keyLengthInBytes);
  52784. for (j = 19; j >= 0; j--) {
  52785. for (let k = 0; k < keyLengthInBytes; ++k) {
  52786. derivedKey[k] = hash[k] ^ j;
  52787. }
  52788. cipher = new ARCFourCipher(derivedKey);
  52789. userPassword = cipher.encryptBlock(userPassword);
  52790. }
  52791. } else {
  52792. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  52793. userPassword = cipher.encryptBlock(ownerPassword);
  52794. }
  52795. return userPassword;
  52796. }
  52797. const identityName = _primitives.Name.get("Identity");
  52798. function buildObjectKey(num, gen, encryptionKey) {
  52799. let isAes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  52800. const key = new Uint8Array(encryptionKey.length + 9);
  52801. const n = encryptionKey.length;
  52802. let i;
  52803. for (i = 0; i < n; ++i) {
  52804. key[i] = encryptionKey[i];
  52805. }
  52806. key[i++] = num & 0xff;
  52807. key[i++] = num >> 8 & 0xff;
  52808. key[i++] = num >> 16 & 0xff;
  52809. key[i++] = gen & 0xff;
  52810. key[i++] = gen >> 8 & 0xff;
  52811. if (isAes) {
  52812. key[i++] = 0x73;
  52813. key[i++] = 0x41;
  52814. key[i++] = 0x6c;
  52815. key[i++] = 0x54;
  52816. }
  52817. const hash = calculateMD5(key, 0, i);
  52818. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  52819. }
  52820. function buildCipherConstructor(cf, name, num, gen, key) {
  52821. if (!(name instanceof _primitives.Name)) {
  52822. throw new _util.FormatError("Invalid crypt filter name.");
  52823. }
  52824. const cryptFilter = cf.get(name.name);
  52825. let cfm;
  52826. if (cryptFilter !== null && cryptFilter !== undefined) {
  52827. cfm = cryptFilter.get("CFM");
  52828. }
  52829. if (!cfm || cfm.name === "None") {
  52830. return function cipherTransformFactoryBuildCipherConstructorNone() {
  52831. return new NullCipher();
  52832. };
  52833. }
  52834. if (cfm.name === "V2") {
  52835. return function cipherTransformFactoryBuildCipherConstructorV2() {
  52836. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  52837. };
  52838. }
  52839. if (cfm.name === "AESV2") {
  52840. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  52841. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  52842. };
  52843. }
  52844. if (cfm.name === "AESV3") {
  52845. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  52846. return new AES256Cipher(key);
  52847. };
  52848. }
  52849. throw new _util.FormatError("Unknown crypto method");
  52850. }
  52851. class CipherTransformFactory {
  52852. constructor(dict, fileId, password) {
  52853. const filter = dict.get("Filter");
  52854. if (!(0, _primitives.isName)(filter, "Standard")) {
  52855. throw new _util.FormatError("unknown encryption method");
  52856. }
  52857. this.filterName = filter.name;
  52858. this.dict = dict;
  52859. const algorithm = dict.get("V");
  52860. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  52861. throw new _util.FormatError("unsupported encryption algorithm");
  52862. }
  52863. this.algorithm = algorithm;
  52864. let keyLength = dict.get("Length");
  52865. if (!keyLength) {
  52866. if (algorithm <= 3) {
  52867. keyLength = 40;
  52868. } else {
  52869. const cfDict = dict.get("CF");
  52870. const streamCryptoName = dict.get("StmF");
  52871. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  52872. cfDict.suppressEncryption = true;
  52873. const handlerDict = cfDict.get(streamCryptoName.name);
  52874. keyLength = handlerDict && handlerDict.get("Length") || 128;
  52875. if (keyLength < 40) {
  52876. keyLength <<= 3;
  52877. }
  52878. }
  52879. }
  52880. }
  52881. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  52882. throw new _util.FormatError("invalid key length");
  52883. }
  52884. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  52885. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  52886. const flags = dict.get("P");
  52887. const revision = dict.get("R");
  52888. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  52889. this.encryptMetadata = encryptMetadata;
  52890. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  52891. let passwordBytes;
  52892. if (password) {
  52893. if (revision === 6) {
  52894. try {
  52895. password = (0, _util.utf8StringToString)(password);
  52896. } catch (ex) {
  52897. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  52898. }
  52899. }
  52900. passwordBytes = (0, _util.stringToBytes)(password);
  52901. }
  52902. let encryptionKey;
  52903. if (algorithm !== 5) {
  52904. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52905. } else {
  52906. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  52907. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  52908. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  52909. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  52910. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  52911. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  52912. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  52913. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  52914. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  52915. }
  52916. if (!encryptionKey && !password) {
  52917. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  52918. } else if (!encryptionKey && password) {
  52919. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  52920. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52921. }
  52922. if (!encryptionKey) {
  52923. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  52924. }
  52925. this.encryptionKey = encryptionKey;
  52926. if (algorithm >= 4) {
  52927. const cf = dict.get("CF");
  52928. if (cf instanceof _primitives.Dict) {
  52929. cf.suppressEncryption = true;
  52930. }
  52931. this.cf = cf;
  52932. this.stmf = dict.get("StmF") || identityName;
  52933. this.strf = dict.get("StrF") || identityName;
  52934. this.eff = dict.get("EFF") || this.stmf;
  52935. }
  52936. }
  52937. createCipherTransform(num, gen) {
  52938. if (this.algorithm === 4 || this.algorithm === 5) {
  52939. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  52940. }
  52941. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  52942. const cipherConstructor = function buildCipherCipherConstructor() {
  52943. return new ARCFourCipher(key);
  52944. };
  52945. return new CipherTransform(cipherConstructor, cipherConstructor);
  52946. }
  52947. }
  52948. return CipherTransformFactory;
  52949. }();
  52950. exports.CipherTransformFactory = CipherTransformFactory;
  52951. /***/ }),
  52952. /* 197 */
  52953. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52954. "use strict";
  52955. Object.defineProperty(exports, "__esModule", ({
  52956. value: true
  52957. }));
  52958. exports.DecryptStream = void 0;
  52959. var _decode_stream = __w_pdfjs_require__(148);
  52960. const chunkSize = 512;
  52961. class DecryptStream extends _decode_stream.DecodeStream {
  52962. constructor(str, maybeLength, decrypt) {
  52963. super(maybeLength);
  52964. this.str = str;
  52965. this.dict = str.dict;
  52966. this.decrypt = decrypt;
  52967. this.nextChunk = null;
  52968. this.initialized = false;
  52969. }
  52970. readBlock() {
  52971. let chunk;
  52972. if (this.initialized) {
  52973. chunk = this.nextChunk;
  52974. } else {
  52975. chunk = this.str.getBytes(chunkSize);
  52976. this.initialized = true;
  52977. }
  52978. if (!chunk || chunk.length === 0) {
  52979. this.eof = true;
  52980. return;
  52981. }
  52982. this.nextChunk = this.str.getBytes(chunkSize);
  52983. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  52984. const decrypt = this.decrypt;
  52985. chunk = decrypt(chunk, !hasMoreData);
  52986. const bufferLength = this.bufferLength,
  52987. newLength = bufferLength + chunk.length,
  52988. buffer = this.ensureBuffer(newLength);
  52989. buffer.set(chunk, bufferLength);
  52990. this.bufferLength = newLength;
  52991. }
  52992. }
  52993. exports.DecryptStream = DecryptStream;
  52994. /***/ }),
  52995. /* 198 */
  52996. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52997. "use strict";
  52998. Object.defineProperty(exports, "__esModule", ({
  52999. value: true
  53000. }));
  53001. exports.Catalog = void 0;
  53002. var _core_utils = __w_pdfjs_require__(135);
  53003. var _util = __w_pdfjs_require__(2);
  53004. var _primitives = __w_pdfjs_require__(134);
  53005. var _name_number_tree = __w_pdfjs_require__(199);
  53006. var _base_stream = __w_pdfjs_require__(136);
  53007. var _cleanup_helper = __w_pdfjs_require__(200);
  53008. var _colorspace = __w_pdfjs_require__(143);
  53009. var _file_spec = __w_pdfjs_require__(201);
  53010. var _image_utils = __w_pdfjs_require__(188);
  53011. var _metadata_parser = __w_pdfjs_require__(202);
  53012. var _struct_tree = __w_pdfjs_require__(203);
  53013. function fetchDestination(dest) {
  53014. if (dest instanceof _primitives.Dict) {
  53015. dest = dest.get("D");
  53016. }
  53017. return Array.isArray(dest) ? dest : null;
  53018. }
  53019. class Catalog {
  53020. constructor(pdfManager, xref) {
  53021. this.pdfManager = pdfManager;
  53022. this.xref = xref;
  53023. this._catDict = xref.getCatalogObj();
  53024. if (!(this._catDict instanceof _primitives.Dict)) {
  53025. throw new _util.FormatError("Catalog object is not a dictionary.");
  53026. }
  53027. this.toplevelPagesDict;
  53028. this._actualNumPages = null;
  53029. this.fontCache = new _primitives.RefSetCache();
  53030. this.builtInCMapCache = new Map();
  53031. this.standardFontDataCache = new Map();
  53032. this.globalImageCache = new _image_utils.GlobalImageCache();
  53033. this.pageKidsCountCache = new _primitives.RefSetCache();
  53034. this.pageIndexCache = new _primitives.RefSetCache();
  53035. this.nonBlendModesSet = new _primitives.RefSet();
  53036. }
  53037. get version() {
  53038. const version = this._catDict.get("Version");
  53039. if (version instanceof _primitives.Name) {
  53040. if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) {
  53041. return (0, _util.shadow)(this, "version", version.name);
  53042. }
  53043. (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`);
  53044. }
  53045. return (0, _util.shadow)(this, "version", null);
  53046. }
  53047. get lang() {
  53048. const lang = this._catDict.get("Lang");
  53049. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  53050. }
  53051. get needsRendering() {
  53052. const needsRendering = this._catDict.get("NeedsRendering");
  53053. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  53054. }
  53055. get collection() {
  53056. let collection = null;
  53057. try {
  53058. const obj = this._catDict.get("Collection");
  53059. if (obj instanceof _primitives.Dict && obj.size > 0) {
  53060. collection = obj;
  53061. }
  53062. } catch (ex) {
  53063. if (ex instanceof _core_utils.MissingDataException) {
  53064. throw ex;
  53065. }
  53066. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  53067. }
  53068. return (0, _util.shadow)(this, "collection", collection);
  53069. }
  53070. get acroForm() {
  53071. let acroForm = null;
  53072. try {
  53073. const obj = this._catDict.get("AcroForm");
  53074. if (obj instanceof _primitives.Dict && obj.size > 0) {
  53075. acroForm = obj;
  53076. }
  53077. } catch (ex) {
  53078. if (ex instanceof _core_utils.MissingDataException) {
  53079. throw ex;
  53080. }
  53081. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  53082. }
  53083. return (0, _util.shadow)(this, "acroForm", acroForm);
  53084. }
  53085. get acroFormRef() {
  53086. const value = this._catDict.getRaw("AcroForm");
  53087. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  53088. }
  53089. get metadata() {
  53090. const streamRef = this._catDict.getRaw("Metadata");
  53091. if (!(streamRef instanceof _primitives.Ref)) {
  53092. return (0, _util.shadow)(this, "metadata", null);
  53093. }
  53094. let metadata = null;
  53095. try {
  53096. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  53097. const stream = this.xref.fetch(streamRef, suppressEncryption);
  53098. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  53099. const type = stream.dict.get("Type");
  53100. const subtype = stream.dict.get("Subtype");
  53101. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  53102. const data = (0, _util.stringToUTF8String)(stream.getString());
  53103. if (data) {
  53104. metadata = new _metadata_parser.MetadataParser(data).serializable;
  53105. }
  53106. }
  53107. }
  53108. } catch (ex) {
  53109. if (ex instanceof _core_utils.MissingDataException) {
  53110. throw ex;
  53111. }
  53112. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  53113. }
  53114. return (0, _util.shadow)(this, "metadata", metadata);
  53115. }
  53116. get markInfo() {
  53117. let markInfo = null;
  53118. try {
  53119. markInfo = this._readMarkInfo();
  53120. } catch (ex) {
  53121. if (ex instanceof _core_utils.MissingDataException) {
  53122. throw ex;
  53123. }
  53124. (0, _util.warn)("Unable to read mark info.");
  53125. }
  53126. return (0, _util.shadow)(this, "markInfo", markInfo);
  53127. }
  53128. _readMarkInfo() {
  53129. const obj = this._catDict.get("MarkInfo");
  53130. if (!(obj instanceof _primitives.Dict)) {
  53131. return null;
  53132. }
  53133. const markInfo = {
  53134. Marked: false,
  53135. UserProperties: false,
  53136. Suspects: false
  53137. };
  53138. for (const key in markInfo) {
  53139. const value = obj.get(key);
  53140. if (typeof value === "boolean") {
  53141. markInfo[key] = value;
  53142. }
  53143. }
  53144. return markInfo;
  53145. }
  53146. get structTreeRoot() {
  53147. let structTree = null;
  53148. try {
  53149. structTree = this._readStructTreeRoot();
  53150. } catch (ex) {
  53151. if (ex instanceof _core_utils.MissingDataException) {
  53152. throw ex;
  53153. }
  53154. (0, _util.warn)("Unable read to structTreeRoot info.");
  53155. }
  53156. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  53157. }
  53158. _readStructTreeRoot() {
  53159. const obj = this._catDict.get("StructTreeRoot");
  53160. if (!(obj instanceof _primitives.Dict)) {
  53161. return null;
  53162. }
  53163. const root = new _struct_tree.StructTreeRoot(obj);
  53164. root.init();
  53165. return root;
  53166. }
  53167. get toplevelPagesDict() {
  53168. const pagesObj = this._catDict.get("Pages");
  53169. if (!(pagesObj instanceof _primitives.Dict)) {
  53170. throw new _util.FormatError("Invalid top-level pages dictionary.");
  53171. }
  53172. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  53173. }
  53174. get documentOutline() {
  53175. let obj = null;
  53176. try {
  53177. obj = this._readDocumentOutline();
  53178. } catch (ex) {
  53179. if (ex instanceof _core_utils.MissingDataException) {
  53180. throw ex;
  53181. }
  53182. (0, _util.warn)("Unable to read document outline.");
  53183. }
  53184. return (0, _util.shadow)(this, "documentOutline", obj);
  53185. }
  53186. _readDocumentOutline() {
  53187. let obj = this._catDict.get("Outlines");
  53188. if (!(obj instanceof _primitives.Dict)) {
  53189. return null;
  53190. }
  53191. obj = obj.getRaw("First");
  53192. if (!(obj instanceof _primitives.Ref)) {
  53193. return null;
  53194. }
  53195. const root = {
  53196. items: []
  53197. };
  53198. const queue = [{
  53199. obj,
  53200. parent: root
  53201. }];
  53202. const processed = new _primitives.RefSet();
  53203. processed.put(obj);
  53204. const xref = this.xref,
  53205. blackColor = new Uint8ClampedArray(3);
  53206. while (queue.length > 0) {
  53207. const i = queue.shift();
  53208. const outlineDict = xref.fetchIfRef(i.obj);
  53209. if (outlineDict === null) {
  53210. continue;
  53211. }
  53212. if (!outlineDict.has("Title")) {
  53213. throw new _util.FormatError("Invalid outline item encountered.");
  53214. }
  53215. const data = {
  53216. url: null,
  53217. dest: null,
  53218. action: null
  53219. };
  53220. Catalog.parseDestDictionary({
  53221. destDict: outlineDict,
  53222. resultObj: data,
  53223. docBaseUrl: this.pdfManager.docBaseUrl,
  53224. docAttachments: this.attachments
  53225. });
  53226. const title = outlineDict.get("Title");
  53227. const flags = outlineDict.get("F") || 0;
  53228. const color = outlineDict.getArray("C");
  53229. const count = outlineDict.get("Count");
  53230. let rgbColor = blackColor;
  53231. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  53232. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  53233. }
  53234. const outlineItem = {
  53235. action: data.action,
  53236. attachment: data.attachment,
  53237. dest: data.dest,
  53238. url: data.url,
  53239. unsafeUrl: data.unsafeUrl,
  53240. newWindow: data.newWindow,
  53241. setOCGState: data.setOCGState,
  53242. title: (0, _util.stringToPDFString)(title),
  53243. color: rgbColor,
  53244. count: Number.isInteger(count) ? count : undefined,
  53245. bold: !!(flags & 2),
  53246. italic: !!(flags & 1),
  53247. items: []
  53248. };
  53249. i.parent.items.push(outlineItem);
  53250. obj = outlineDict.getRaw("First");
  53251. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  53252. queue.push({
  53253. obj,
  53254. parent: outlineItem
  53255. });
  53256. processed.put(obj);
  53257. }
  53258. obj = outlineDict.getRaw("Next");
  53259. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  53260. queue.push({
  53261. obj,
  53262. parent: i.parent
  53263. });
  53264. processed.put(obj);
  53265. }
  53266. }
  53267. return root.items.length > 0 ? root.items : null;
  53268. }
  53269. get permissions() {
  53270. let permissions = null;
  53271. try {
  53272. permissions = this._readPermissions();
  53273. } catch (ex) {
  53274. if (ex instanceof _core_utils.MissingDataException) {
  53275. throw ex;
  53276. }
  53277. (0, _util.warn)("Unable to read permissions.");
  53278. }
  53279. return (0, _util.shadow)(this, "permissions", permissions);
  53280. }
  53281. _readPermissions() {
  53282. const encrypt = this.xref.trailer.get("Encrypt");
  53283. if (!(encrypt instanceof _primitives.Dict)) {
  53284. return null;
  53285. }
  53286. let flags = encrypt.get("P");
  53287. if (typeof flags !== "number") {
  53288. return null;
  53289. }
  53290. flags += 2 ** 32;
  53291. const permissions = [];
  53292. for (const key in _util.PermissionFlag) {
  53293. const value = _util.PermissionFlag[key];
  53294. if (flags & value) {
  53295. permissions.push(value);
  53296. }
  53297. }
  53298. return permissions;
  53299. }
  53300. get optionalContentConfig() {
  53301. let config = null;
  53302. try {
  53303. const properties = this._catDict.get("OCProperties");
  53304. if (!properties) {
  53305. return (0, _util.shadow)(this, "optionalContentConfig", null);
  53306. }
  53307. const defaultConfig = properties.get("D");
  53308. if (!defaultConfig) {
  53309. return (0, _util.shadow)(this, "optionalContentConfig", null);
  53310. }
  53311. const groupsData = properties.get("OCGs");
  53312. if (!Array.isArray(groupsData)) {
  53313. return (0, _util.shadow)(this, "optionalContentConfig", null);
  53314. }
  53315. const groups = [];
  53316. const groupRefs = [];
  53317. for (const groupRef of groupsData) {
  53318. if (!(groupRef instanceof _primitives.Ref)) {
  53319. continue;
  53320. }
  53321. groupRefs.push(groupRef);
  53322. const group = this.xref.fetchIfRef(groupRef);
  53323. groups.push({
  53324. id: groupRef.toString(),
  53325. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  53326. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  53327. });
  53328. }
  53329. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  53330. config.groups = groups;
  53331. } catch (ex) {
  53332. if (ex instanceof _core_utils.MissingDataException) {
  53333. throw ex;
  53334. }
  53335. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  53336. }
  53337. return (0, _util.shadow)(this, "optionalContentConfig", config);
  53338. }
  53339. _readOptionalContentConfig(config, contentGroupRefs) {
  53340. function parseOnOff(refs) {
  53341. const onParsed = [];
  53342. if (Array.isArray(refs)) {
  53343. for (const value of refs) {
  53344. if (!(value instanceof _primitives.Ref)) {
  53345. continue;
  53346. }
  53347. if (contentGroupRefs.includes(value)) {
  53348. onParsed.push(value.toString());
  53349. }
  53350. }
  53351. }
  53352. return onParsed;
  53353. }
  53354. function parseOrder(refs) {
  53355. let nestedLevels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  53356. if (!Array.isArray(refs)) {
  53357. return null;
  53358. }
  53359. const order = [];
  53360. for (const value of refs) {
  53361. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  53362. parsedOrderRefs.put(value);
  53363. order.push(value.toString());
  53364. continue;
  53365. }
  53366. const nestedOrder = parseNestedOrder(value, nestedLevels);
  53367. if (nestedOrder) {
  53368. order.push(nestedOrder);
  53369. }
  53370. }
  53371. if (nestedLevels > 0) {
  53372. return order;
  53373. }
  53374. const hiddenGroups = [];
  53375. for (const groupRef of contentGroupRefs) {
  53376. if (parsedOrderRefs.has(groupRef)) {
  53377. continue;
  53378. }
  53379. hiddenGroups.push(groupRef.toString());
  53380. }
  53381. if (hiddenGroups.length) {
  53382. order.push({
  53383. name: null,
  53384. order: hiddenGroups
  53385. });
  53386. }
  53387. return order;
  53388. }
  53389. function parseNestedOrder(ref, nestedLevels) {
  53390. if (++nestedLevels > MAX_NESTED_LEVELS) {
  53391. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  53392. return null;
  53393. }
  53394. const value = xref.fetchIfRef(ref);
  53395. if (!Array.isArray(value)) {
  53396. return null;
  53397. }
  53398. const nestedName = xref.fetchIfRef(value[0]);
  53399. if (typeof nestedName !== "string") {
  53400. return null;
  53401. }
  53402. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  53403. if (!nestedOrder || !nestedOrder.length) {
  53404. return null;
  53405. }
  53406. return {
  53407. name: (0, _util.stringToPDFString)(nestedName),
  53408. order: nestedOrder
  53409. };
  53410. }
  53411. const xref = this.xref,
  53412. parsedOrderRefs = new _primitives.RefSet(),
  53413. MAX_NESTED_LEVELS = 10;
  53414. return {
  53415. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  53416. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  53417. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  53418. on: parseOnOff(config.get("ON")),
  53419. off: parseOnOff(config.get("OFF")),
  53420. order: parseOrder(config.get("Order")),
  53421. groups: null
  53422. };
  53423. }
  53424. setActualNumPages() {
  53425. let num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  53426. this._actualNumPages = num;
  53427. }
  53428. get hasActualNumPages() {
  53429. return this._actualNumPages !== null;
  53430. }
  53431. get _pagesCount() {
  53432. const obj = this.toplevelPagesDict.get("Count");
  53433. if (!Number.isInteger(obj)) {
  53434. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  53435. }
  53436. return (0, _util.shadow)(this, "_pagesCount", obj);
  53437. }
  53438. get numPages() {
  53439. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  53440. }
  53441. get destinations() {
  53442. const obj = this._readDests(),
  53443. dests = Object.create(null);
  53444. if (obj instanceof _name_number_tree.NameTree) {
  53445. for (const [key, value] of obj.getAll()) {
  53446. const dest = fetchDestination(value);
  53447. if (dest) {
  53448. dests[(0, _util.stringToPDFString)(key)] = dest;
  53449. }
  53450. }
  53451. } else if (obj instanceof _primitives.Dict) {
  53452. obj.forEach(function (key, value) {
  53453. const dest = fetchDestination(value);
  53454. if (dest) {
  53455. dests[key] = dest;
  53456. }
  53457. });
  53458. }
  53459. return (0, _util.shadow)(this, "destinations", dests);
  53460. }
  53461. getDestination(id) {
  53462. const obj = this._readDests();
  53463. if (obj instanceof _name_number_tree.NameTree) {
  53464. const dest = fetchDestination(obj.get(id));
  53465. if (dest) {
  53466. return dest;
  53467. }
  53468. const allDest = this.destinations[id];
  53469. if (allDest) {
  53470. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  53471. return allDest;
  53472. }
  53473. } else if (obj instanceof _primitives.Dict) {
  53474. const dest = fetchDestination(obj.get(id));
  53475. if (dest) {
  53476. return dest;
  53477. }
  53478. }
  53479. return null;
  53480. }
  53481. _readDests() {
  53482. const obj = this._catDict.get("Names");
  53483. if (obj && obj.has("Dests")) {
  53484. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  53485. } else if (this._catDict.has("Dests")) {
  53486. return this._catDict.get("Dests");
  53487. }
  53488. return undefined;
  53489. }
  53490. get pageLabels() {
  53491. let obj = null;
  53492. try {
  53493. obj = this._readPageLabels();
  53494. } catch (ex) {
  53495. if (ex instanceof _core_utils.MissingDataException) {
  53496. throw ex;
  53497. }
  53498. (0, _util.warn)("Unable to read page labels.");
  53499. }
  53500. return (0, _util.shadow)(this, "pageLabels", obj);
  53501. }
  53502. _readPageLabels() {
  53503. const obj = this._catDict.getRaw("PageLabels");
  53504. if (!obj) {
  53505. return null;
  53506. }
  53507. const pageLabels = new Array(this.numPages);
  53508. let style = null,
  53509. prefix = "";
  53510. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  53511. const nums = numberTree.getAll();
  53512. let currentLabel = "",
  53513. currentIndex = 1;
  53514. for (let i = 0, ii = this.numPages; i < ii; i++) {
  53515. const labelDict = nums.get(i);
  53516. if (labelDict !== undefined) {
  53517. if (!(labelDict instanceof _primitives.Dict)) {
  53518. throw new _util.FormatError("PageLabel is not a dictionary.");
  53519. }
  53520. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  53521. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  53522. }
  53523. if (labelDict.has("S")) {
  53524. const s = labelDict.get("S");
  53525. if (!(s instanceof _primitives.Name)) {
  53526. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  53527. }
  53528. style = s.name;
  53529. } else {
  53530. style = null;
  53531. }
  53532. if (labelDict.has("P")) {
  53533. const p = labelDict.get("P");
  53534. if (typeof p !== "string") {
  53535. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  53536. }
  53537. prefix = (0, _util.stringToPDFString)(p);
  53538. } else {
  53539. prefix = "";
  53540. }
  53541. if (labelDict.has("St")) {
  53542. const st = labelDict.get("St");
  53543. if (!(Number.isInteger(st) && st >= 1)) {
  53544. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  53545. }
  53546. currentIndex = st;
  53547. } else {
  53548. currentIndex = 1;
  53549. }
  53550. }
  53551. switch (style) {
  53552. case "D":
  53553. currentLabel = currentIndex;
  53554. break;
  53555. case "R":
  53556. case "r":
  53557. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  53558. break;
  53559. case "A":
  53560. case "a":
  53561. const LIMIT = 26;
  53562. const A_UPPER_CASE = 0x41,
  53563. A_LOWER_CASE = 0x61;
  53564. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  53565. const letterIndex = currentIndex - 1;
  53566. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  53567. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  53568. break;
  53569. default:
  53570. if (style) {
  53571. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  53572. }
  53573. currentLabel = "";
  53574. }
  53575. pageLabels[i] = prefix + currentLabel;
  53576. currentIndex++;
  53577. }
  53578. return pageLabels;
  53579. }
  53580. get pageLayout() {
  53581. const obj = this._catDict.get("PageLayout");
  53582. let pageLayout = "";
  53583. if (obj instanceof _primitives.Name) {
  53584. switch (obj.name) {
  53585. case "SinglePage":
  53586. case "OneColumn":
  53587. case "TwoColumnLeft":
  53588. case "TwoColumnRight":
  53589. case "TwoPageLeft":
  53590. case "TwoPageRight":
  53591. pageLayout = obj.name;
  53592. }
  53593. }
  53594. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  53595. }
  53596. get pageMode() {
  53597. const obj = this._catDict.get("PageMode");
  53598. let pageMode = "UseNone";
  53599. if (obj instanceof _primitives.Name) {
  53600. switch (obj.name) {
  53601. case "UseNone":
  53602. case "UseOutlines":
  53603. case "UseThumbs":
  53604. case "FullScreen":
  53605. case "UseOC":
  53606. case "UseAttachments":
  53607. pageMode = obj.name;
  53608. }
  53609. }
  53610. return (0, _util.shadow)(this, "pageMode", pageMode);
  53611. }
  53612. get viewerPreferences() {
  53613. const obj = this._catDict.get("ViewerPreferences");
  53614. if (!(obj instanceof _primitives.Dict)) {
  53615. return (0, _util.shadow)(this, "viewerPreferences", null);
  53616. }
  53617. let prefs = null;
  53618. for (const key of obj.getKeys()) {
  53619. const value = obj.get(key);
  53620. let prefValue;
  53621. switch (key) {
  53622. case "HideToolbar":
  53623. case "HideMenubar":
  53624. case "HideWindowUI":
  53625. case "FitWindow":
  53626. case "CenterWindow":
  53627. case "DisplayDocTitle":
  53628. case "PickTrayByPDFSize":
  53629. if (typeof value === "boolean") {
  53630. prefValue = value;
  53631. }
  53632. break;
  53633. case "NonFullScreenPageMode":
  53634. if (value instanceof _primitives.Name) {
  53635. switch (value.name) {
  53636. case "UseNone":
  53637. case "UseOutlines":
  53638. case "UseThumbs":
  53639. case "UseOC":
  53640. prefValue = value.name;
  53641. break;
  53642. default:
  53643. prefValue = "UseNone";
  53644. }
  53645. }
  53646. break;
  53647. case "Direction":
  53648. if (value instanceof _primitives.Name) {
  53649. switch (value.name) {
  53650. case "L2R":
  53651. case "R2L":
  53652. prefValue = value.name;
  53653. break;
  53654. default:
  53655. prefValue = "L2R";
  53656. }
  53657. }
  53658. break;
  53659. case "ViewArea":
  53660. case "ViewClip":
  53661. case "PrintArea":
  53662. case "PrintClip":
  53663. if (value instanceof _primitives.Name) {
  53664. switch (value.name) {
  53665. case "MediaBox":
  53666. case "CropBox":
  53667. case "BleedBox":
  53668. case "TrimBox":
  53669. case "ArtBox":
  53670. prefValue = value.name;
  53671. break;
  53672. default:
  53673. prefValue = "CropBox";
  53674. }
  53675. }
  53676. break;
  53677. case "PrintScaling":
  53678. if (value instanceof _primitives.Name) {
  53679. switch (value.name) {
  53680. case "None":
  53681. case "AppDefault":
  53682. prefValue = value.name;
  53683. break;
  53684. default:
  53685. prefValue = "AppDefault";
  53686. }
  53687. }
  53688. break;
  53689. case "Duplex":
  53690. if (value instanceof _primitives.Name) {
  53691. switch (value.name) {
  53692. case "Simplex":
  53693. case "DuplexFlipShortEdge":
  53694. case "DuplexFlipLongEdge":
  53695. prefValue = value.name;
  53696. break;
  53697. default:
  53698. prefValue = "None";
  53699. }
  53700. }
  53701. break;
  53702. case "PrintPageRange":
  53703. if (Array.isArray(value) && value.length % 2 === 0) {
  53704. const isValid = value.every((page, i, arr) => {
  53705. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  53706. });
  53707. if (isValid) {
  53708. prefValue = value;
  53709. }
  53710. }
  53711. break;
  53712. case "NumCopies":
  53713. if (Number.isInteger(value) && value > 0) {
  53714. prefValue = value;
  53715. }
  53716. break;
  53717. default:
  53718. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  53719. continue;
  53720. }
  53721. if (prefValue === undefined) {
  53722. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  53723. continue;
  53724. }
  53725. if (!prefs) {
  53726. prefs = Object.create(null);
  53727. }
  53728. prefs[key] = prefValue;
  53729. }
  53730. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  53731. }
  53732. get openAction() {
  53733. const obj = this._catDict.get("OpenAction");
  53734. const openAction = Object.create(null);
  53735. if (obj instanceof _primitives.Dict) {
  53736. const destDict = new _primitives.Dict(this.xref);
  53737. destDict.set("A", obj);
  53738. const resultObj = {
  53739. url: null,
  53740. dest: null,
  53741. action: null
  53742. };
  53743. Catalog.parseDestDictionary({
  53744. destDict,
  53745. resultObj
  53746. });
  53747. if (Array.isArray(resultObj.dest)) {
  53748. openAction.dest = resultObj.dest;
  53749. } else if (resultObj.action) {
  53750. openAction.action = resultObj.action;
  53751. }
  53752. } else if (Array.isArray(obj)) {
  53753. openAction.dest = obj;
  53754. }
  53755. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  53756. }
  53757. get attachments() {
  53758. const obj = this._catDict.get("Names");
  53759. let attachments = null;
  53760. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  53761. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  53762. for (const [key, value] of nameTree.getAll()) {
  53763. const fs = new _file_spec.FileSpec(value, this.xref);
  53764. if (!attachments) {
  53765. attachments = Object.create(null);
  53766. }
  53767. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  53768. }
  53769. }
  53770. return (0, _util.shadow)(this, "attachments", attachments);
  53771. }
  53772. get xfaImages() {
  53773. const obj = this._catDict.get("Names");
  53774. let xfaImages = null;
  53775. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  53776. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  53777. for (const [key, value] of nameTree.getAll()) {
  53778. if (!xfaImages) {
  53779. xfaImages = new _primitives.Dict(this.xref);
  53780. }
  53781. xfaImages.set((0, _util.stringToPDFString)(key), value);
  53782. }
  53783. }
  53784. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  53785. }
  53786. _collectJavaScript() {
  53787. const obj = this._catDict.get("Names");
  53788. let javaScript = null;
  53789. function appendIfJavaScriptDict(name, jsDict) {
  53790. if (!(jsDict instanceof _primitives.Dict)) {
  53791. return;
  53792. }
  53793. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  53794. return;
  53795. }
  53796. let js = jsDict.get("JS");
  53797. if (js instanceof _base_stream.BaseStream) {
  53798. js = js.getString();
  53799. } else if (typeof js !== "string") {
  53800. return;
  53801. }
  53802. if (javaScript === null) {
  53803. javaScript = new Map();
  53804. }
  53805. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  53806. javaScript.set(name, js);
  53807. }
  53808. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  53809. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  53810. for (const [key, value] of nameTree.getAll()) {
  53811. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  53812. }
  53813. }
  53814. const openAction = this._catDict.get("OpenAction");
  53815. if (openAction) {
  53816. appendIfJavaScriptDict("OpenAction", openAction);
  53817. }
  53818. return javaScript;
  53819. }
  53820. get javaScript() {
  53821. const javaScript = this._collectJavaScript();
  53822. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  53823. }
  53824. get jsActions() {
  53825. const javaScript = this._collectJavaScript();
  53826. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  53827. if (javaScript) {
  53828. if (!actions) {
  53829. actions = Object.create(null);
  53830. }
  53831. for (const [key, val] of javaScript) {
  53832. if (key in actions) {
  53833. actions[key].push(val);
  53834. } else {
  53835. actions[key] = [val];
  53836. }
  53837. }
  53838. }
  53839. return (0, _util.shadow)(this, "jsActions", actions);
  53840. }
  53841. async fontFallback(id, handler) {
  53842. const translatedFonts = await Promise.all(this.fontCache);
  53843. for (const translatedFont of translatedFonts) {
  53844. if (translatedFont.loadedName === id) {
  53845. translatedFont.fallback(handler);
  53846. return;
  53847. }
  53848. }
  53849. }
  53850. async cleanup() {
  53851. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  53852. (0, _cleanup_helper.clearGlobalCaches)();
  53853. this.globalImageCache.clear(manuallyTriggered);
  53854. this.pageKidsCountCache.clear();
  53855. this.pageIndexCache.clear();
  53856. this.nonBlendModesSet.clear();
  53857. const translatedFonts = await Promise.all(this.fontCache);
  53858. for (const {
  53859. dict
  53860. } of translatedFonts) {
  53861. delete dict.cacheKey;
  53862. }
  53863. this.fontCache.clear();
  53864. this.builtInCMapCache.clear();
  53865. this.standardFontDataCache.clear();
  53866. }
  53867. async getPageDict(pageIndex) {
  53868. const nodesToVisit = [this.toplevelPagesDict];
  53869. const visitedNodes = new _primitives.RefSet();
  53870. const pagesRef = this._catDict.getRaw("Pages");
  53871. if (pagesRef instanceof _primitives.Ref) {
  53872. visitedNodes.put(pagesRef);
  53873. }
  53874. const xref = this.xref,
  53875. pageKidsCountCache = this.pageKidsCountCache,
  53876. pageIndexCache = this.pageIndexCache;
  53877. let currentPageIndex = 0;
  53878. while (nodesToVisit.length) {
  53879. const currentNode = nodesToVisit.pop();
  53880. if (currentNode instanceof _primitives.Ref) {
  53881. const count = pageKidsCountCache.get(currentNode);
  53882. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  53883. currentPageIndex += count;
  53884. continue;
  53885. }
  53886. if (visitedNodes.has(currentNode)) {
  53887. throw new _util.FormatError("Pages tree contains circular reference.");
  53888. }
  53889. visitedNodes.put(currentNode);
  53890. const obj = await xref.fetchAsync(currentNode);
  53891. if (obj instanceof _primitives.Dict) {
  53892. let type = obj.getRaw("Type");
  53893. if (type instanceof _primitives.Ref) {
  53894. type = await xref.fetchAsync(type);
  53895. }
  53896. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  53897. if (!pageKidsCountCache.has(currentNode)) {
  53898. pageKidsCountCache.put(currentNode, 1);
  53899. }
  53900. if (!pageIndexCache.has(currentNode)) {
  53901. pageIndexCache.put(currentNode, currentPageIndex);
  53902. }
  53903. if (currentPageIndex === pageIndex) {
  53904. return [obj, currentNode];
  53905. }
  53906. currentPageIndex++;
  53907. continue;
  53908. }
  53909. }
  53910. nodesToVisit.push(obj);
  53911. continue;
  53912. }
  53913. if (!(currentNode instanceof _primitives.Dict)) {
  53914. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  53915. }
  53916. const {
  53917. objId
  53918. } = currentNode;
  53919. let count = currentNode.getRaw("Count");
  53920. if (count instanceof _primitives.Ref) {
  53921. count = await xref.fetchAsync(count);
  53922. }
  53923. if (Number.isInteger(count) && count >= 0) {
  53924. if (objId && !pageKidsCountCache.has(objId)) {
  53925. pageKidsCountCache.put(objId, count);
  53926. }
  53927. if (currentPageIndex + count <= pageIndex) {
  53928. currentPageIndex += count;
  53929. continue;
  53930. }
  53931. }
  53932. let kids = currentNode.getRaw("Kids");
  53933. if (kids instanceof _primitives.Ref) {
  53934. kids = await xref.fetchAsync(kids);
  53935. }
  53936. if (!Array.isArray(kids)) {
  53937. let type = currentNode.getRaw("Type");
  53938. if (type instanceof _primitives.Ref) {
  53939. type = await xref.fetchAsync(type);
  53940. }
  53941. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  53942. if (currentPageIndex === pageIndex) {
  53943. return [currentNode, null];
  53944. }
  53945. currentPageIndex++;
  53946. continue;
  53947. }
  53948. throw new _util.FormatError("Page dictionary kids object is not an array.");
  53949. }
  53950. for (let last = kids.length - 1; last >= 0; last--) {
  53951. nodesToVisit.push(kids[last]);
  53952. }
  53953. }
  53954. throw new Error(`Page index ${pageIndex} not found.`);
  53955. }
  53956. async getAllPageDicts() {
  53957. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  53958. const {
  53959. ignoreErrors
  53960. } = this.pdfManager.evaluatorOptions;
  53961. const queue = [{
  53962. currentNode: this.toplevelPagesDict,
  53963. posInKids: 0
  53964. }];
  53965. const visitedNodes = new _primitives.RefSet();
  53966. const pagesRef = this._catDict.getRaw("Pages");
  53967. if (pagesRef instanceof _primitives.Ref) {
  53968. visitedNodes.put(pagesRef);
  53969. }
  53970. const map = new Map(),
  53971. xref = this.xref,
  53972. pageIndexCache = this.pageIndexCache;
  53973. let pageIndex = 0;
  53974. function addPageDict(pageDict, pageRef) {
  53975. if (pageRef && !pageIndexCache.has(pageRef)) {
  53976. pageIndexCache.put(pageRef, pageIndex);
  53977. }
  53978. map.set(pageIndex++, [pageDict, pageRef]);
  53979. }
  53980. function addPageError(error) {
  53981. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  53982. throw error;
  53983. }
  53984. if (recoveryMode && ignoreErrors && pageIndex === 0) {
  53985. (0, _util.warn)(`getAllPageDicts - Skipping invalid first page: "${error}".`);
  53986. error = _primitives.Dict.empty;
  53987. }
  53988. map.set(pageIndex++, [error, null]);
  53989. }
  53990. while (queue.length > 0) {
  53991. const queueItem = queue.at(-1);
  53992. const {
  53993. currentNode,
  53994. posInKids
  53995. } = queueItem;
  53996. let kids = currentNode.getRaw("Kids");
  53997. if (kids instanceof _primitives.Ref) {
  53998. try {
  53999. kids = await xref.fetchAsync(kids);
  54000. } catch (ex) {
  54001. addPageError(ex);
  54002. break;
  54003. }
  54004. }
  54005. if (!Array.isArray(kids)) {
  54006. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  54007. break;
  54008. }
  54009. if (posInKids >= kids.length) {
  54010. queue.pop();
  54011. continue;
  54012. }
  54013. const kidObj = kids[posInKids];
  54014. let obj;
  54015. if (kidObj instanceof _primitives.Ref) {
  54016. if (visitedNodes.has(kidObj)) {
  54017. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  54018. break;
  54019. }
  54020. visitedNodes.put(kidObj);
  54021. try {
  54022. obj = await xref.fetchAsync(kidObj);
  54023. } catch (ex) {
  54024. addPageError(ex);
  54025. break;
  54026. }
  54027. } else {
  54028. obj = kidObj;
  54029. }
  54030. if (!(obj instanceof _primitives.Dict)) {
  54031. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  54032. break;
  54033. }
  54034. let type = obj.getRaw("Type");
  54035. if (type instanceof _primitives.Ref) {
  54036. try {
  54037. type = await xref.fetchAsync(type);
  54038. } catch (ex) {
  54039. addPageError(ex);
  54040. break;
  54041. }
  54042. }
  54043. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  54044. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  54045. } else {
  54046. queue.push({
  54047. currentNode: obj,
  54048. posInKids: 0
  54049. });
  54050. }
  54051. queueItem.posInKids++;
  54052. }
  54053. return map;
  54054. }
  54055. getPageIndex(pageRef) {
  54056. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  54057. if (cachedPageIndex !== undefined) {
  54058. return Promise.resolve(cachedPageIndex);
  54059. }
  54060. const xref = this.xref;
  54061. function pagesBeforeRef(kidRef) {
  54062. let total = 0,
  54063. parentRef;
  54064. return xref.fetchAsync(kidRef).then(function (node) {
  54065. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  54066. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  54067. }
  54068. if (!node) {
  54069. return null;
  54070. }
  54071. if (!(node instanceof _primitives.Dict)) {
  54072. throw new _util.FormatError("Node must be a dictionary.");
  54073. }
  54074. parentRef = node.getRaw("Parent");
  54075. return node.getAsync("Parent");
  54076. }).then(function (parent) {
  54077. if (!parent) {
  54078. return null;
  54079. }
  54080. if (!(parent instanceof _primitives.Dict)) {
  54081. throw new _util.FormatError("Parent must be a dictionary.");
  54082. }
  54083. return parent.getAsync("Kids");
  54084. }).then(function (kids) {
  54085. if (!kids) {
  54086. return null;
  54087. }
  54088. const kidPromises = [];
  54089. let found = false;
  54090. for (const kid of kids) {
  54091. if (!(kid instanceof _primitives.Ref)) {
  54092. throw new _util.FormatError("Kid must be a reference.");
  54093. }
  54094. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  54095. found = true;
  54096. break;
  54097. }
  54098. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  54099. if (!(obj instanceof _primitives.Dict)) {
  54100. throw new _util.FormatError("Kid node must be a dictionary.");
  54101. }
  54102. if (obj.has("Count")) {
  54103. total += obj.get("Count");
  54104. } else {
  54105. total++;
  54106. }
  54107. }));
  54108. }
  54109. if (!found) {
  54110. throw new _util.FormatError("Kid reference not found in parent's kids.");
  54111. }
  54112. return Promise.all(kidPromises).then(function () {
  54113. return [total, parentRef];
  54114. });
  54115. });
  54116. }
  54117. let total = 0;
  54118. const next = ref => pagesBeforeRef(ref).then(args => {
  54119. if (!args) {
  54120. this.pageIndexCache.put(pageRef, total);
  54121. return total;
  54122. }
  54123. const [count, parentRef] = args;
  54124. total += count;
  54125. return next(parentRef);
  54126. });
  54127. return next(pageRef);
  54128. }
  54129. get baseUrl() {
  54130. const uri = this._catDict.get("URI");
  54131. if (uri instanceof _primitives.Dict) {
  54132. const base = uri.get("Base");
  54133. if (typeof base === "string") {
  54134. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  54135. tryConvertEncoding: true
  54136. });
  54137. if (absoluteUrl) {
  54138. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  54139. }
  54140. }
  54141. }
  54142. return (0, _util.shadow)(this, "baseUrl", null);
  54143. }
  54144. static parseDestDictionary(params) {
  54145. const destDict = params.destDict;
  54146. if (!(destDict instanceof _primitives.Dict)) {
  54147. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  54148. return;
  54149. }
  54150. const resultObj = params.resultObj;
  54151. if (typeof resultObj !== "object") {
  54152. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  54153. return;
  54154. }
  54155. const docBaseUrl = params.docBaseUrl || null;
  54156. const docAttachments = params.docAttachments || null;
  54157. let action = destDict.get("A"),
  54158. url,
  54159. dest;
  54160. if (!(action instanceof _primitives.Dict)) {
  54161. if (destDict.has("Dest")) {
  54162. action = destDict.get("Dest");
  54163. } else {
  54164. action = destDict.get("AA");
  54165. if (action instanceof _primitives.Dict) {
  54166. if (action.has("D")) {
  54167. action = action.get("D");
  54168. } else if (action.has("U")) {
  54169. action = action.get("U");
  54170. }
  54171. }
  54172. }
  54173. }
  54174. if (action instanceof _primitives.Dict) {
  54175. const actionType = action.get("S");
  54176. if (!(actionType instanceof _primitives.Name)) {
  54177. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  54178. return;
  54179. }
  54180. const actionName = actionType.name;
  54181. switch (actionName) {
  54182. case "ResetForm":
  54183. const flags = action.get("Flags");
  54184. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  54185. const fields = [];
  54186. const refs = [];
  54187. for (const obj of action.get("Fields") || []) {
  54188. if (obj instanceof _primitives.Ref) {
  54189. refs.push(obj.toString());
  54190. } else if (typeof obj === "string") {
  54191. fields.push((0, _util.stringToPDFString)(obj));
  54192. }
  54193. }
  54194. resultObj.resetForm = {
  54195. fields,
  54196. refs,
  54197. include
  54198. };
  54199. break;
  54200. case "URI":
  54201. url = action.get("URI");
  54202. if (url instanceof _primitives.Name) {
  54203. url = "/" + url.name;
  54204. }
  54205. break;
  54206. case "GoTo":
  54207. dest = action.get("D");
  54208. break;
  54209. case "Launch":
  54210. case "GoToR":
  54211. const urlDict = action.get("F");
  54212. if (urlDict instanceof _primitives.Dict) {
  54213. url = urlDict.get("F") || null;
  54214. } else if (typeof urlDict === "string") {
  54215. url = urlDict;
  54216. }
  54217. let remoteDest = action.get("D");
  54218. if (remoteDest) {
  54219. if (remoteDest instanceof _primitives.Name) {
  54220. remoteDest = remoteDest.name;
  54221. }
  54222. if (typeof url === "string") {
  54223. const baseUrl = url.split("#")[0];
  54224. if (typeof remoteDest === "string") {
  54225. url = baseUrl + "#" + remoteDest;
  54226. } else if (Array.isArray(remoteDest)) {
  54227. url = baseUrl + "#" + JSON.stringify(remoteDest);
  54228. }
  54229. }
  54230. }
  54231. const newWindow = action.get("NewWindow");
  54232. if (typeof newWindow === "boolean") {
  54233. resultObj.newWindow = newWindow;
  54234. }
  54235. break;
  54236. case "GoToE":
  54237. const target = action.get("T");
  54238. let attachment;
  54239. if (docAttachments && target instanceof _primitives.Dict) {
  54240. const relationship = target.get("R");
  54241. const name = target.get("N");
  54242. if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") {
  54243. attachment = docAttachments[(0, _util.stringToPDFString)(name)];
  54244. }
  54245. }
  54246. if (attachment) {
  54247. resultObj.attachment = attachment;
  54248. } else {
  54249. (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`);
  54250. }
  54251. break;
  54252. case "Named":
  54253. const namedAction = action.get("N");
  54254. if (namedAction instanceof _primitives.Name) {
  54255. resultObj.action = namedAction.name;
  54256. }
  54257. break;
  54258. case "SetOCGState":
  54259. const state = action.get("State");
  54260. const preserveRB = action.get("PreserveRB");
  54261. if (!Array.isArray(state) || state.length === 0) {
  54262. break;
  54263. }
  54264. const stateArr = [];
  54265. for (const elem of state) {
  54266. if (elem instanceof _primitives.Name) {
  54267. switch (elem.name) {
  54268. case "ON":
  54269. case "OFF":
  54270. case "Toggle":
  54271. stateArr.push(elem.name);
  54272. break;
  54273. }
  54274. } else if (elem instanceof _primitives.Ref) {
  54275. stateArr.push(elem.toString());
  54276. }
  54277. }
  54278. if (stateArr.length !== state.length) {
  54279. break;
  54280. }
  54281. resultObj.setOCGState = {
  54282. state: stateArr,
  54283. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  54284. };
  54285. break;
  54286. case "JavaScript":
  54287. const jsAction = action.get("JS");
  54288. let js;
  54289. if (jsAction instanceof _base_stream.BaseStream) {
  54290. js = jsAction.getString();
  54291. } else if (typeof jsAction === "string") {
  54292. js = jsAction;
  54293. }
  54294. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  54295. if (jsURL) {
  54296. url = jsURL.url;
  54297. resultObj.newWindow = jsURL.newWindow;
  54298. break;
  54299. }
  54300. default:
  54301. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  54302. break;
  54303. }
  54304. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  54305. break;
  54306. }
  54307. } else if (destDict.has("Dest")) {
  54308. dest = destDict.get("Dest");
  54309. }
  54310. if (typeof url === "string") {
  54311. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  54312. addDefaultProtocol: true,
  54313. tryConvertEncoding: true
  54314. });
  54315. if (absoluteUrl) {
  54316. resultObj.url = absoluteUrl.href;
  54317. }
  54318. resultObj.unsafeUrl = url;
  54319. }
  54320. if (dest) {
  54321. if (dest instanceof _primitives.Name) {
  54322. dest = dest.name;
  54323. }
  54324. if (typeof dest === "string") {
  54325. resultObj.dest = (0, _util.stringToPDFString)(dest);
  54326. } else if (Array.isArray(dest)) {
  54327. resultObj.dest = dest;
  54328. }
  54329. }
  54330. }
  54331. }
  54332. exports.Catalog = Catalog;
  54333. /***/ }),
  54334. /* 199 */
  54335. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54336. "use strict";
  54337. Object.defineProperty(exports, "__esModule", ({
  54338. value: true
  54339. }));
  54340. exports.NumberTree = exports.NameTree = void 0;
  54341. var _primitives = __w_pdfjs_require__(134);
  54342. var _util = __w_pdfjs_require__(2);
  54343. class NameOrNumberTree {
  54344. constructor(root, xref, type) {
  54345. if (this.constructor === NameOrNumberTree) {
  54346. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  54347. }
  54348. this.root = root;
  54349. this.xref = xref;
  54350. this._type = type;
  54351. }
  54352. getAll() {
  54353. const map = new Map();
  54354. if (!this.root) {
  54355. return map;
  54356. }
  54357. const xref = this.xref;
  54358. const processed = new _primitives.RefSet();
  54359. processed.put(this.root);
  54360. const queue = [this.root];
  54361. while (queue.length > 0) {
  54362. const obj = xref.fetchIfRef(queue.shift());
  54363. if (!(obj instanceof _primitives.Dict)) {
  54364. continue;
  54365. }
  54366. if (obj.has("Kids")) {
  54367. const kids = obj.get("Kids");
  54368. if (!Array.isArray(kids)) {
  54369. continue;
  54370. }
  54371. for (const kid of kids) {
  54372. if (processed.has(kid)) {
  54373. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  54374. }
  54375. queue.push(kid);
  54376. processed.put(kid);
  54377. }
  54378. continue;
  54379. }
  54380. const entries = obj.get(this._type);
  54381. if (!Array.isArray(entries)) {
  54382. continue;
  54383. }
  54384. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  54385. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  54386. }
  54387. }
  54388. return map;
  54389. }
  54390. get(key) {
  54391. if (!this.root) {
  54392. return null;
  54393. }
  54394. const xref = this.xref;
  54395. let kidsOrEntries = xref.fetchIfRef(this.root);
  54396. let loopCount = 0;
  54397. const MAX_LEVELS = 10;
  54398. while (kidsOrEntries.has("Kids")) {
  54399. if (++loopCount > MAX_LEVELS) {
  54400. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  54401. return null;
  54402. }
  54403. const kids = kidsOrEntries.get("Kids");
  54404. if (!Array.isArray(kids)) {
  54405. return null;
  54406. }
  54407. let l = 0,
  54408. r = kids.length - 1;
  54409. while (l <= r) {
  54410. const m = l + r >> 1;
  54411. const kid = xref.fetchIfRef(kids[m]);
  54412. const limits = kid.get("Limits");
  54413. if (key < xref.fetchIfRef(limits[0])) {
  54414. r = m - 1;
  54415. } else if (key > xref.fetchIfRef(limits[1])) {
  54416. l = m + 1;
  54417. } else {
  54418. kidsOrEntries = kid;
  54419. break;
  54420. }
  54421. }
  54422. if (l > r) {
  54423. return null;
  54424. }
  54425. }
  54426. const entries = kidsOrEntries.get(this._type);
  54427. if (Array.isArray(entries)) {
  54428. let l = 0,
  54429. r = entries.length - 2;
  54430. while (l <= r) {
  54431. const tmp = l + r >> 1,
  54432. m = tmp + (tmp & 1);
  54433. const currentKey = xref.fetchIfRef(entries[m]);
  54434. if (key < currentKey) {
  54435. r = m - 2;
  54436. } else if (key > currentKey) {
  54437. l = m + 2;
  54438. } else {
  54439. return xref.fetchIfRef(entries[m + 1]);
  54440. }
  54441. }
  54442. }
  54443. return null;
  54444. }
  54445. }
  54446. class NameTree extends NameOrNumberTree {
  54447. constructor(root, xref) {
  54448. super(root, xref, "Names");
  54449. }
  54450. }
  54451. exports.NameTree = NameTree;
  54452. class NumberTree extends NameOrNumberTree {
  54453. constructor(root, xref) {
  54454. super(root, xref, "Nums");
  54455. }
  54456. }
  54457. exports.NumberTree = NumberTree;
  54458. /***/ }),
  54459. /* 200 */
  54460. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54461. "use strict";
  54462. Object.defineProperty(exports, "__esModule", ({
  54463. value: true
  54464. }));
  54465. exports.clearGlobalCaches = clearGlobalCaches;
  54466. var _primitives = __w_pdfjs_require__(134);
  54467. var _unicode = __w_pdfjs_require__(169);
  54468. function clearGlobalCaches() {
  54469. (0, _primitives.clearPrimitiveCaches)();
  54470. (0, _unicode.clearUnicodeCaches)();
  54471. }
  54472. /***/ }),
  54473. /* 201 */
  54474. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54475. "use strict";
  54476. Object.defineProperty(exports, "__esModule", ({
  54477. value: true
  54478. }));
  54479. exports.FileSpec = void 0;
  54480. var _util = __w_pdfjs_require__(2);
  54481. var _base_stream = __w_pdfjs_require__(136);
  54482. var _primitives = __w_pdfjs_require__(134);
  54483. function pickPlatformItem(dict) {
  54484. if (dict.has("UF")) {
  54485. return dict.get("UF");
  54486. } else if (dict.has("F")) {
  54487. return dict.get("F");
  54488. } else if (dict.has("Unix")) {
  54489. return dict.get("Unix");
  54490. } else if (dict.has("Mac")) {
  54491. return dict.get("Mac");
  54492. } else if (dict.has("DOS")) {
  54493. return dict.get("DOS");
  54494. }
  54495. return null;
  54496. }
  54497. class FileSpec {
  54498. constructor(root, xref) {
  54499. if (!(root instanceof _primitives.Dict)) {
  54500. return;
  54501. }
  54502. this.xref = xref;
  54503. this.root = root;
  54504. if (root.has("FS")) {
  54505. this.fs = root.get("FS");
  54506. }
  54507. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  54508. if (root.has("RF")) {
  54509. (0, _util.warn)("Related file specifications are not supported");
  54510. }
  54511. this.contentAvailable = true;
  54512. if (!root.has("EF")) {
  54513. this.contentAvailable = false;
  54514. (0, _util.warn)("Non-embedded file specifications are not supported");
  54515. }
  54516. }
  54517. get filename() {
  54518. if (!this._filename && this.root) {
  54519. const filename = pickPlatformItem(this.root) || "unnamed";
  54520. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  54521. }
  54522. return this._filename;
  54523. }
  54524. get content() {
  54525. if (!this.contentAvailable) {
  54526. return null;
  54527. }
  54528. if (!this.contentRef && this.root) {
  54529. this.contentRef = pickPlatformItem(this.root.get("EF"));
  54530. }
  54531. let content = null;
  54532. if (this.contentRef) {
  54533. const fileObj = this.xref.fetchIfRef(this.contentRef);
  54534. if (fileObj instanceof _base_stream.BaseStream) {
  54535. content = fileObj.getBytes();
  54536. } else {
  54537. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  54538. }
  54539. } else {
  54540. (0, _util.warn)("Embedded file specification does not have a content");
  54541. }
  54542. return content;
  54543. }
  54544. get serializable() {
  54545. return {
  54546. filename: this.filename,
  54547. content: this.content
  54548. };
  54549. }
  54550. }
  54551. exports.FileSpec = FileSpec;
  54552. /***/ }),
  54553. /* 202 */
  54554. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54555. "use strict";
  54556. Object.defineProperty(exports, "__esModule", ({
  54557. value: true
  54558. }));
  54559. exports.MetadataParser = void 0;
  54560. var _xml_parser = __w_pdfjs_require__(195);
  54561. class MetadataParser {
  54562. constructor(data) {
  54563. data = this._repair(data);
  54564. const parser = new _xml_parser.SimpleXMLParser({
  54565. lowerCaseName: true
  54566. });
  54567. const xmlDocument = parser.parseFromString(data);
  54568. this._metadataMap = new Map();
  54569. this._data = data;
  54570. if (xmlDocument) {
  54571. this._parse(xmlDocument);
  54572. }
  54573. }
  54574. _repair(data) {
  54575. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  54576. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  54577. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  54578. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  54579. switch (name) {
  54580. case "amp":
  54581. return "&";
  54582. case "apos":
  54583. return "'";
  54584. case "gt":
  54585. return ">";
  54586. case "lt":
  54587. return "<";
  54588. case "quot":
  54589. return '"';
  54590. }
  54591. throw new Error(`_repair: ${name} isn't defined.`);
  54592. });
  54593. const charBuf = [];
  54594. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  54595. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  54596. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  54597. charBuf.push(String.fromCharCode(code));
  54598. } else {
  54599. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  54600. }
  54601. }
  54602. return ">" + charBuf.join("");
  54603. });
  54604. }
  54605. _getSequence(entry) {
  54606. const name = entry.nodeName;
  54607. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  54608. return null;
  54609. }
  54610. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  54611. }
  54612. _parseArray(entry) {
  54613. if (!entry.hasChildNodes()) {
  54614. return;
  54615. }
  54616. const [seqNode] = entry.childNodes;
  54617. const sequence = this._getSequence(seqNode) || [];
  54618. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  54619. }
  54620. _parse(xmlDocument) {
  54621. let rdf = xmlDocument.documentElement;
  54622. if (rdf.nodeName !== "rdf:rdf") {
  54623. rdf = rdf.firstChild;
  54624. while (rdf && rdf.nodeName !== "rdf:rdf") {
  54625. rdf = rdf.nextSibling;
  54626. }
  54627. }
  54628. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  54629. return;
  54630. }
  54631. for (const desc of rdf.childNodes) {
  54632. if (desc.nodeName !== "rdf:description") {
  54633. continue;
  54634. }
  54635. for (const entry of desc.childNodes) {
  54636. const name = entry.nodeName;
  54637. switch (name) {
  54638. case "#text":
  54639. continue;
  54640. case "dc:creator":
  54641. case "dc:subject":
  54642. this._parseArray(entry);
  54643. continue;
  54644. }
  54645. this._metadataMap.set(name, entry.textContent.trim());
  54646. }
  54647. }
  54648. }
  54649. get serializable() {
  54650. return {
  54651. parsedData: this._metadataMap,
  54652. rawData: this._data
  54653. };
  54654. }
  54655. }
  54656. exports.MetadataParser = MetadataParser;
  54657. /***/ }),
  54658. /* 203 */
  54659. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54660. "use strict";
  54661. Object.defineProperty(exports, "__esModule", ({
  54662. value: true
  54663. }));
  54664. exports.StructTreeRoot = exports.StructTreePage = void 0;
  54665. var _primitives = __w_pdfjs_require__(134);
  54666. var _util = __w_pdfjs_require__(2);
  54667. var _name_number_tree = __w_pdfjs_require__(199);
  54668. const MAX_DEPTH = 40;
  54669. const StructElementType = {
  54670. PAGE_CONTENT: "PAGE_CONTENT",
  54671. STREAM_CONTENT: "STREAM_CONTENT",
  54672. OBJECT: "OBJECT",
  54673. ELEMENT: "ELEMENT"
  54674. };
  54675. class StructTreeRoot {
  54676. constructor(rootDict) {
  54677. this.dict = rootDict;
  54678. this.roleMap = new Map();
  54679. }
  54680. init() {
  54681. this.readRoleMap();
  54682. }
  54683. readRoleMap() {
  54684. const roleMapDict = this.dict.get("RoleMap");
  54685. if (!(roleMapDict instanceof _primitives.Dict)) {
  54686. return;
  54687. }
  54688. roleMapDict.forEach((key, value) => {
  54689. if (!(value instanceof _primitives.Name)) {
  54690. return;
  54691. }
  54692. this.roleMap.set(key, value.name);
  54693. });
  54694. }
  54695. }
  54696. exports.StructTreeRoot = StructTreeRoot;
  54697. class StructElementNode {
  54698. constructor(tree, dict) {
  54699. this.tree = tree;
  54700. this.dict = dict;
  54701. this.kids = [];
  54702. this.parseKids();
  54703. }
  54704. get role() {
  54705. const nameObj = this.dict.get("S");
  54706. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  54707. const {
  54708. root
  54709. } = this.tree;
  54710. if (root.roleMap.has(name)) {
  54711. return root.roleMap.get(name);
  54712. }
  54713. return name;
  54714. }
  54715. parseKids() {
  54716. let pageObjId = null;
  54717. const objRef = this.dict.getRaw("Pg");
  54718. if (objRef instanceof _primitives.Ref) {
  54719. pageObjId = objRef.toString();
  54720. }
  54721. const kids = this.dict.get("K");
  54722. if (Array.isArray(kids)) {
  54723. for (const kid of kids) {
  54724. const element = this.parseKid(pageObjId, kid);
  54725. if (element) {
  54726. this.kids.push(element);
  54727. }
  54728. }
  54729. } else {
  54730. const element = this.parseKid(pageObjId, kids);
  54731. if (element) {
  54732. this.kids.push(element);
  54733. }
  54734. }
  54735. }
  54736. parseKid(pageObjId, kid) {
  54737. if (Number.isInteger(kid)) {
  54738. if (this.tree.pageDict.objId !== pageObjId) {
  54739. return null;
  54740. }
  54741. return new StructElement({
  54742. type: StructElementType.PAGE_CONTENT,
  54743. mcid: kid,
  54744. pageObjId
  54745. });
  54746. }
  54747. let kidDict = null;
  54748. if (kid instanceof _primitives.Ref) {
  54749. kidDict = this.dict.xref.fetch(kid);
  54750. } else if (kid instanceof _primitives.Dict) {
  54751. kidDict = kid;
  54752. }
  54753. if (!kidDict) {
  54754. return null;
  54755. }
  54756. const pageRef = kidDict.getRaw("Pg");
  54757. if (pageRef instanceof _primitives.Ref) {
  54758. pageObjId = pageRef.toString();
  54759. }
  54760. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  54761. if (type === "MCR") {
  54762. if (this.tree.pageDict.objId !== pageObjId) {
  54763. return null;
  54764. }
  54765. return new StructElement({
  54766. type: StructElementType.STREAM_CONTENT,
  54767. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  54768. pageObjId,
  54769. mcid: kidDict.get("MCID")
  54770. });
  54771. }
  54772. if (type === "OBJR") {
  54773. if (this.tree.pageDict.objId !== pageObjId) {
  54774. return null;
  54775. }
  54776. return new StructElement({
  54777. type: StructElementType.OBJECT,
  54778. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  54779. pageObjId
  54780. });
  54781. }
  54782. return new StructElement({
  54783. type: StructElementType.ELEMENT,
  54784. dict: kidDict
  54785. });
  54786. }
  54787. }
  54788. class StructElement {
  54789. constructor(_ref) {
  54790. let {
  54791. type,
  54792. dict = null,
  54793. mcid = null,
  54794. pageObjId = null,
  54795. refObjId = null
  54796. } = _ref;
  54797. this.type = type;
  54798. this.dict = dict;
  54799. this.mcid = mcid;
  54800. this.pageObjId = pageObjId;
  54801. this.refObjId = refObjId;
  54802. this.parentNode = null;
  54803. }
  54804. }
  54805. class StructTreePage {
  54806. constructor(structTreeRoot, pageDict) {
  54807. this.root = structTreeRoot;
  54808. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  54809. this.pageDict = pageDict;
  54810. this.nodes = [];
  54811. }
  54812. parse() {
  54813. if (!this.root || !this.rootDict) {
  54814. return;
  54815. }
  54816. const parentTree = this.rootDict.get("ParentTree");
  54817. if (!parentTree) {
  54818. return;
  54819. }
  54820. const id = this.pageDict.get("StructParents");
  54821. if (!Number.isInteger(id)) {
  54822. return;
  54823. }
  54824. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  54825. const parentArray = numberTree.get(id);
  54826. if (!Array.isArray(parentArray)) {
  54827. return;
  54828. }
  54829. const map = new Map();
  54830. for (const ref of parentArray) {
  54831. if (ref instanceof _primitives.Ref) {
  54832. this.addNode(this.rootDict.xref.fetch(ref), map);
  54833. }
  54834. }
  54835. }
  54836. addNode(dict, map) {
  54837. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54838. if (level > MAX_DEPTH) {
  54839. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  54840. return null;
  54841. }
  54842. if (map.has(dict)) {
  54843. return map.get(dict);
  54844. }
  54845. const element = new StructElementNode(this, dict);
  54846. map.set(dict, element);
  54847. const parent = dict.get("P");
  54848. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  54849. if (!this.addTopLevelNode(dict, element)) {
  54850. map.delete(dict);
  54851. }
  54852. return element;
  54853. }
  54854. const parentNode = this.addNode(parent, map, level + 1);
  54855. if (!parentNode) {
  54856. return element;
  54857. }
  54858. let save = false;
  54859. for (const kid of parentNode.kids) {
  54860. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  54861. kid.parentNode = element;
  54862. save = true;
  54863. }
  54864. }
  54865. if (!save) {
  54866. map.delete(dict);
  54867. }
  54868. return element;
  54869. }
  54870. addTopLevelNode(dict, element) {
  54871. const obj = this.rootDict.get("K");
  54872. if (!obj) {
  54873. return false;
  54874. }
  54875. if (obj instanceof _primitives.Dict) {
  54876. if (obj.objId !== dict.objId) {
  54877. return false;
  54878. }
  54879. this.nodes[0] = element;
  54880. return true;
  54881. }
  54882. if (!Array.isArray(obj)) {
  54883. return true;
  54884. }
  54885. let save = false;
  54886. for (let i = 0; i < obj.length; i++) {
  54887. const kidRef = obj[i];
  54888. if (kidRef && kidRef.toString() === dict.objId) {
  54889. this.nodes[i] = element;
  54890. save = true;
  54891. }
  54892. }
  54893. return save;
  54894. }
  54895. get serializable() {
  54896. function nodeToSerializable(node, parent) {
  54897. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54898. if (level > MAX_DEPTH) {
  54899. (0, _util.warn)("StructTree too deep to be fully serialized.");
  54900. return;
  54901. }
  54902. const obj = Object.create(null);
  54903. obj.role = node.role;
  54904. obj.children = [];
  54905. parent.children.push(obj);
  54906. const alt = node.dict.get("Alt");
  54907. if (typeof alt === "string") {
  54908. obj.alt = (0, _util.stringToPDFString)(alt);
  54909. }
  54910. const lang = node.dict.get("Lang");
  54911. if (typeof lang === "string") {
  54912. obj.lang = (0, _util.stringToPDFString)(lang);
  54913. }
  54914. for (const kid of node.kids) {
  54915. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  54916. if (kidElement) {
  54917. nodeToSerializable(kidElement, obj, level + 1);
  54918. continue;
  54919. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  54920. obj.children.push({
  54921. type: "content",
  54922. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  54923. });
  54924. } else if (kid.type === StructElementType.OBJECT) {
  54925. obj.children.push({
  54926. type: "object",
  54927. id: kid.refObjId
  54928. });
  54929. }
  54930. }
  54931. }
  54932. const root = Object.create(null);
  54933. root.children = [];
  54934. root.role = "Root";
  54935. for (const child of this.nodes) {
  54936. if (!child) {
  54937. continue;
  54938. }
  54939. nodeToSerializable(child, root);
  54940. }
  54941. return root;
  54942. }
  54943. }
  54944. exports.StructTreePage = StructTreePage;
  54945. /***/ }),
  54946. /* 204 */
  54947. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54948. "use strict";
  54949. Object.defineProperty(exports, "__esModule", ({
  54950. value: true
  54951. }));
  54952. exports.ObjectLoader = void 0;
  54953. var _primitives = __w_pdfjs_require__(134);
  54954. var _base_stream = __w_pdfjs_require__(136);
  54955. var _core_utils = __w_pdfjs_require__(135);
  54956. var _util = __w_pdfjs_require__(2);
  54957. function mayHaveChildren(value) {
  54958. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  54959. }
  54960. function addChildren(node, nodesToVisit) {
  54961. if (node instanceof _primitives.Dict) {
  54962. node = node.getRawValues();
  54963. } else if (node instanceof _base_stream.BaseStream) {
  54964. node = node.dict.getRawValues();
  54965. } else if (!Array.isArray(node)) {
  54966. return;
  54967. }
  54968. for (const rawValue of node) {
  54969. if (mayHaveChildren(rawValue)) {
  54970. nodesToVisit.push(rawValue);
  54971. }
  54972. }
  54973. }
  54974. class ObjectLoader {
  54975. constructor(dict, keys, xref) {
  54976. this.dict = dict;
  54977. this.keys = keys;
  54978. this.xref = xref;
  54979. this.refSet = null;
  54980. }
  54981. async load() {
  54982. if (this.xref.stream.isDataLoaded) {
  54983. return undefined;
  54984. }
  54985. const {
  54986. keys,
  54987. dict
  54988. } = this;
  54989. this.refSet = new _primitives.RefSet();
  54990. const nodesToVisit = [];
  54991. for (const key of keys) {
  54992. const rawValue = dict.getRaw(key);
  54993. if (rawValue !== undefined) {
  54994. nodesToVisit.push(rawValue);
  54995. }
  54996. }
  54997. return this._walk(nodesToVisit);
  54998. }
  54999. async _walk(nodesToVisit) {
  55000. const nodesToRevisit = [];
  55001. const pendingRequests = [];
  55002. while (nodesToVisit.length) {
  55003. let currentNode = nodesToVisit.pop();
  55004. if (currentNode instanceof _primitives.Ref) {
  55005. if (this.refSet.has(currentNode)) {
  55006. continue;
  55007. }
  55008. try {
  55009. this.refSet.put(currentNode);
  55010. currentNode = this.xref.fetch(currentNode);
  55011. } catch (ex) {
  55012. if (!(ex instanceof _core_utils.MissingDataException)) {
  55013. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  55014. this.refSet = null;
  55015. const {
  55016. manager
  55017. } = this.xref.stream;
  55018. return manager.requestAllChunks();
  55019. }
  55020. nodesToRevisit.push(currentNode);
  55021. pendingRequests.push({
  55022. begin: ex.begin,
  55023. end: ex.end
  55024. });
  55025. }
  55026. }
  55027. if (currentNode instanceof _base_stream.BaseStream) {
  55028. const baseStreams = currentNode.getBaseStreams();
  55029. if (baseStreams) {
  55030. let foundMissingData = false;
  55031. for (const stream of baseStreams) {
  55032. if (stream.isDataLoaded) {
  55033. continue;
  55034. }
  55035. foundMissingData = true;
  55036. pendingRequests.push({
  55037. begin: stream.start,
  55038. end: stream.end
  55039. });
  55040. }
  55041. if (foundMissingData) {
  55042. nodesToRevisit.push(currentNode);
  55043. }
  55044. }
  55045. }
  55046. addChildren(currentNode, nodesToVisit);
  55047. }
  55048. if (pendingRequests.length) {
  55049. await this.xref.stream.manager.requestRanges(pendingRequests);
  55050. for (const node of nodesToRevisit) {
  55051. if (node instanceof _primitives.Ref) {
  55052. this.refSet.remove(node);
  55053. }
  55054. }
  55055. return this._walk(nodesToRevisit);
  55056. }
  55057. this.refSet = null;
  55058. return undefined;
  55059. }
  55060. }
  55061. exports.ObjectLoader = ObjectLoader;
  55062. /***/ }),
  55063. /* 205 */
  55064. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55065. "use strict";
  55066. Object.defineProperty(exports, "__esModule", ({
  55067. value: true
  55068. }));
  55069. exports.XFAFactory = void 0;
  55070. var _xfa_object = __w_pdfjs_require__(206);
  55071. var _bind = __w_pdfjs_require__(210);
  55072. var _data = __w_pdfjs_require__(216);
  55073. var _fonts = __w_pdfjs_require__(214);
  55074. var _utils = __w_pdfjs_require__(207);
  55075. var _util = __w_pdfjs_require__(2);
  55076. var _parser = __w_pdfjs_require__(217);
  55077. var _xhtml = __w_pdfjs_require__(227);
  55078. class XFAFactory {
  55079. constructor(data) {
  55080. try {
  55081. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  55082. const binder = new _bind.Binder(this.root);
  55083. this.form = binder.bind();
  55084. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  55085. this.form[_xfa_object.$globalData].template = this.form;
  55086. } catch (e) {
  55087. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  55088. }
  55089. }
  55090. isValid() {
  55091. return this.root && this.form;
  55092. }
  55093. _createPagesHelper() {
  55094. const iterator = this.form[_xfa_object.$toPages]();
  55095. return new Promise((resolve, reject) => {
  55096. const nextIteration = () => {
  55097. try {
  55098. const value = iterator.next();
  55099. if (value.done) {
  55100. resolve(value.value);
  55101. } else {
  55102. setTimeout(nextIteration, 0);
  55103. }
  55104. } catch (e) {
  55105. reject(e);
  55106. }
  55107. };
  55108. setTimeout(nextIteration, 0);
  55109. });
  55110. }
  55111. async _createPages() {
  55112. try {
  55113. this.pages = await this._createPagesHelper();
  55114. this.dims = this.pages.children.map(c => {
  55115. const {
  55116. width,
  55117. height
  55118. } = c.attributes.style;
  55119. return [0, 0, parseInt(width), parseInt(height)];
  55120. });
  55121. } catch (e) {
  55122. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  55123. }
  55124. }
  55125. getBoundingBox(pageIndex) {
  55126. return this.dims[pageIndex];
  55127. }
  55128. async getNumPages() {
  55129. if (!this.pages) {
  55130. await this._createPages();
  55131. }
  55132. return this.dims.length;
  55133. }
  55134. setImages(images) {
  55135. this.form[_xfa_object.$globalData].images = images;
  55136. }
  55137. setFonts(fonts) {
  55138. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  55139. const missingFonts = [];
  55140. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  55141. typeface = (0, _utils.stripQuotes)(typeface);
  55142. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  55143. if (!font) {
  55144. missingFonts.push(typeface);
  55145. }
  55146. }
  55147. if (missingFonts.length > 0) {
  55148. return missingFonts;
  55149. }
  55150. return null;
  55151. }
  55152. appendFonts(fonts, reallyMissingFonts) {
  55153. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  55154. }
  55155. async getPages() {
  55156. if (!this.pages) {
  55157. await this._createPages();
  55158. }
  55159. const pages = this.pages;
  55160. this.pages = null;
  55161. return pages;
  55162. }
  55163. serializeData(storage) {
  55164. return this.dataHandler.serialize(storage);
  55165. }
  55166. static _createDocument(data) {
  55167. if (!data["/xdp:xdp"]) {
  55168. return data["xdp:xdp"];
  55169. }
  55170. return Object.values(data).join("");
  55171. }
  55172. static getRichTextAsHtml(rc) {
  55173. if (!rc || typeof rc !== "string") {
  55174. return null;
  55175. }
  55176. try {
  55177. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  55178. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  55179. const newRoot = _xhtml.XhtmlNamespace.body({});
  55180. newRoot[_xfa_object.$appendChild](root);
  55181. root = newRoot;
  55182. }
  55183. const result = root[_xfa_object.$toHTML]();
  55184. if (!result.success) {
  55185. return null;
  55186. }
  55187. const {
  55188. html
  55189. } = result;
  55190. const {
  55191. attributes
  55192. } = html;
  55193. if (attributes) {
  55194. if (attributes.class) {
  55195. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  55196. }
  55197. attributes.dir = "auto";
  55198. }
  55199. return {
  55200. html,
  55201. str: root[_xfa_object.$text]()
  55202. };
  55203. } catch (e) {
  55204. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  55205. }
  55206. return null;
  55207. }
  55208. }
  55209. exports.XFAFactory = XFAFactory;
  55210. /***/ }),
  55211. /* 206 */
  55212. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55213. "use strict";
  55214. Object.defineProperty(exports, "__esModule", ({
  55215. value: true
  55216. }));
  55217. 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;
  55218. var _utils = __w_pdfjs_require__(207);
  55219. var _util = __w_pdfjs_require__(2);
  55220. var _core_utils = __w_pdfjs_require__(135);
  55221. var _namespaces = __w_pdfjs_require__(208);
  55222. var _som = __w_pdfjs_require__(209);
  55223. const $acceptWhitespace = Symbol();
  55224. exports.$acceptWhitespace = $acceptWhitespace;
  55225. const $addHTML = Symbol();
  55226. exports.$addHTML = $addHTML;
  55227. const $appendChild = Symbol();
  55228. exports.$appendChild = $appendChild;
  55229. const $childrenToHTML = Symbol();
  55230. exports.$childrenToHTML = $childrenToHTML;
  55231. const $clean = Symbol();
  55232. exports.$clean = $clean;
  55233. const $cleanPage = Symbol();
  55234. exports.$cleanPage = $cleanPage;
  55235. const $cleanup = Symbol();
  55236. exports.$cleanup = $cleanup;
  55237. const $clone = Symbol();
  55238. exports.$clone = $clone;
  55239. const $consumed = Symbol();
  55240. exports.$consumed = $consumed;
  55241. const $content = Symbol("content");
  55242. exports.$content = $content;
  55243. const $data = Symbol("data");
  55244. exports.$data = $data;
  55245. const $dump = Symbol();
  55246. exports.$dump = $dump;
  55247. const $extra = Symbol("extra");
  55248. exports.$extra = $extra;
  55249. const $finalize = Symbol();
  55250. exports.$finalize = $finalize;
  55251. const $flushHTML = Symbol();
  55252. exports.$flushHTML = $flushHTML;
  55253. const $getAttributeIt = Symbol();
  55254. exports.$getAttributeIt = $getAttributeIt;
  55255. const $getAttributes = Symbol();
  55256. exports.$getAttributes = $getAttributes;
  55257. const $getAvailableSpace = Symbol();
  55258. exports.$getAvailableSpace = $getAvailableSpace;
  55259. const $getChildrenByClass = Symbol();
  55260. exports.$getChildrenByClass = $getChildrenByClass;
  55261. const $getChildrenByName = Symbol();
  55262. exports.$getChildrenByName = $getChildrenByName;
  55263. const $getChildrenByNameIt = Symbol();
  55264. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  55265. const $getDataValue = Symbol();
  55266. exports.$getDataValue = $getDataValue;
  55267. const $getExtra = Symbol();
  55268. exports.$getExtra = $getExtra;
  55269. const $getRealChildrenByNameIt = Symbol();
  55270. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  55271. const $getChildren = Symbol();
  55272. exports.$getChildren = $getChildren;
  55273. const $getContainedChildren = Symbol();
  55274. exports.$getContainedChildren = $getContainedChildren;
  55275. const $getNextPage = Symbol();
  55276. exports.$getNextPage = $getNextPage;
  55277. const $getSubformParent = Symbol();
  55278. exports.$getSubformParent = $getSubformParent;
  55279. const $getParent = Symbol();
  55280. exports.$getParent = $getParent;
  55281. const $getTemplateRoot = Symbol();
  55282. exports.$getTemplateRoot = $getTemplateRoot;
  55283. const $globalData = Symbol();
  55284. exports.$globalData = $globalData;
  55285. const $hasSettableValue = Symbol();
  55286. exports.$hasSettableValue = $hasSettableValue;
  55287. const $ids = Symbol();
  55288. exports.$ids = $ids;
  55289. const $indexOf = Symbol();
  55290. exports.$indexOf = $indexOf;
  55291. const $insertAt = Symbol();
  55292. exports.$insertAt = $insertAt;
  55293. const $isCDATAXml = Symbol();
  55294. exports.$isCDATAXml = $isCDATAXml;
  55295. const $isBindable = Symbol();
  55296. exports.$isBindable = $isBindable;
  55297. const $isDataValue = Symbol();
  55298. exports.$isDataValue = $isDataValue;
  55299. const $isDescendent = Symbol();
  55300. exports.$isDescendent = $isDescendent;
  55301. const $isNsAgnostic = Symbol();
  55302. exports.$isNsAgnostic = $isNsAgnostic;
  55303. const $isSplittable = Symbol();
  55304. exports.$isSplittable = $isSplittable;
  55305. const $isThereMoreWidth = Symbol();
  55306. exports.$isThereMoreWidth = $isThereMoreWidth;
  55307. const $isTransparent = Symbol();
  55308. exports.$isTransparent = $isTransparent;
  55309. const $isUsable = Symbol();
  55310. exports.$isUsable = $isUsable;
  55311. const $lastAttribute = Symbol();
  55312. const $namespaceId = Symbol("namespaceId");
  55313. exports.$namespaceId = $namespaceId;
  55314. const $nodeName = Symbol("nodeName");
  55315. exports.$nodeName = $nodeName;
  55316. const $nsAttributes = Symbol();
  55317. exports.$nsAttributes = $nsAttributes;
  55318. const $onChild = Symbol();
  55319. exports.$onChild = $onChild;
  55320. const $onChildCheck = Symbol();
  55321. exports.$onChildCheck = $onChildCheck;
  55322. const $onText = Symbol();
  55323. exports.$onText = $onText;
  55324. const $pushGlyphs = Symbol();
  55325. exports.$pushGlyphs = $pushGlyphs;
  55326. const $popPara = Symbol();
  55327. exports.$popPara = $popPara;
  55328. const $pushPara = Symbol();
  55329. exports.$pushPara = $pushPara;
  55330. const $removeChild = Symbol();
  55331. exports.$removeChild = $removeChild;
  55332. const $root = Symbol("root");
  55333. exports.$root = $root;
  55334. const $resolvePrototypes = Symbol();
  55335. exports.$resolvePrototypes = $resolvePrototypes;
  55336. const $searchNode = Symbol();
  55337. exports.$searchNode = $searchNode;
  55338. const $setId = Symbol();
  55339. exports.$setId = $setId;
  55340. const $setSetAttributes = Symbol();
  55341. exports.$setSetAttributes = $setSetAttributes;
  55342. const $setValue = Symbol();
  55343. exports.$setValue = $setValue;
  55344. const $tabIndex = Symbol();
  55345. exports.$tabIndex = $tabIndex;
  55346. const $text = Symbol();
  55347. exports.$text = $text;
  55348. const $toPages = Symbol();
  55349. exports.$toPages = $toPages;
  55350. const $toHTML = Symbol();
  55351. exports.$toHTML = $toHTML;
  55352. const $toString = Symbol();
  55353. exports.$toString = $toString;
  55354. const $toStyle = Symbol();
  55355. exports.$toStyle = $toStyle;
  55356. const $uid = Symbol("uid");
  55357. exports.$uid = $uid;
  55358. const _applyPrototype = Symbol();
  55359. const _attributes = Symbol();
  55360. const _attributeNames = Symbol();
  55361. const _children = Symbol("_children");
  55362. const _cloneAttribute = Symbol();
  55363. const _dataValue = Symbol();
  55364. const _defaultValue = Symbol();
  55365. const _filteredChildrenGenerator = Symbol();
  55366. const _getPrototype = Symbol();
  55367. const _getUnsetAttributes = Symbol();
  55368. const _hasChildren = Symbol();
  55369. const _max = Symbol();
  55370. const _options = Symbol();
  55371. const _parent = Symbol("parent");
  55372. const _resolvePrototypesHelper = Symbol();
  55373. const _setAttributes = Symbol();
  55374. const _validator = Symbol();
  55375. let uid = 0;
  55376. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  55377. class XFAObject {
  55378. constructor(nsId, name) {
  55379. let hasChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  55380. this[$namespaceId] = nsId;
  55381. this[$nodeName] = name;
  55382. this[_hasChildren] = hasChildren;
  55383. this[_parent] = null;
  55384. this[_children] = [];
  55385. this[$uid] = `${name}${uid++}`;
  55386. this[$globalData] = null;
  55387. }
  55388. [$onChild](child) {
  55389. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  55390. return false;
  55391. }
  55392. const name = child[$nodeName];
  55393. const node = this[name];
  55394. if (node instanceof XFAObjectArray) {
  55395. if (node.push(child)) {
  55396. this[$appendChild](child);
  55397. return true;
  55398. }
  55399. } else {
  55400. if (node !== null) {
  55401. this[$removeChild](node);
  55402. }
  55403. this[name] = child;
  55404. this[$appendChild](child);
  55405. return true;
  55406. }
  55407. let id = "";
  55408. if (this.id) {
  55409. id = ` (id: ${this.id})`;
  55410. } else if (this.name) {
  55411. id = ` (name: ${this.name} ${this.h.value})`;
  55412. }
  55413. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  55414. return false;
  55415. }
  55416. [$onChildCheck](child) {
  55417. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  55418. }
  55419. [$isNsAgnostic]() {
  55420. return false;
  55421. }
  55422. [$acceptWhitespace]() {
  55423. return false;
  55424. }
  55425. [$isCDATAXml]() {
  55426. return false;
  55427. }
  55428. [$isBindable]() {
  55429. return false;
  55430. }
  55431. [$popPara]() {
  55432. if (this.para) {
  55433. this[$getTemplateRoot]()[$extra].paraStack.pop();
  55434. }
  55435. }
  55436. [$pushPara]() {
  55437. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  55438. }
  55439. [$setId](ids) {
  55440. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  55441. ids.set(this.id, this);
  55442. }
  55443. }
  55444. [$getTemplateRoot]() {
  55445. return this[$globalData].template;
  55446. }
  55447. [$isSplittable]() {
  55448. return false;
  55449. }
  55450. [$isThereMoreWidth]() {
  55451. return false;
  55452. }
  55453. [$appendChild](child) {
  55454. child[_parent] = this;
  55455. this[_children].push(child);
  55456. if (!child[$globalData] && this[$globalData]) {
  55457. child[$globalData] = this[$globalData];
  55458. }
  55459. }
  55460. [$removeChild](child) {
  55461. const i = this[_children].indexOf(child);
  55462. this[_children].splice(i, 1);
  55463. }
  55464. [$hasSettableValue]() {
  55465. return this.hasOwnProperty("value");
  55466. }
  55467. [$setValue](_) {}
  55468. [$onText](_) {}
  55469. [$finalize]() {}
  55470. [$clean](builder) {
  55471. delete this[_hasChildren];
  55472. if (this[$cleanup]) {
  55473. builder.clean(this[$cleanup]);
  55474. delete this[$cleanup];
  55475. }
  55476. }
  55477. [$indexOf](child) {
  55478. return this[_children].indexOf(child);
  55479. }
  55480. [$insertAt](i, child) {
  55481. child[_parent] = this;
  55482. this[_children].splice(i, 0, child);
  55483. if (!child[$globalData] && this[$globalData]) {
  55484. child[$globalData] = this[$globalData];
  55485. }
  55486. }
  55487. [$isTransparent]() {
  55488. return !this.name;
  55489. }
  55490. [$lastAttribute]() {
  55491. return "";
  55492. }
  55493. [$text]() {
  55494. if (this[_children].length === 0) {
  55495. return this[$content];
  55496. }
  55497. return this[_children].map(c => c[$text]()).join("");
  55498. }
  55499. get [_attributeNames]() {
  55500. const proto = Object.getPrototypeOf(this);
  55501. if (!proto._attributes) {
  55502. const attributes = proto._attributes = new Set();
  55503. for (const name of Object.getOwnPropertyNames(this)) {
  55504. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  55505. break;
  55506. }
  55507. attributes.add(name);
  55508. }
  55509. }
  55510. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  55511. }
  55512. [$isDescendent](parent) {
  55513. let node = this;
  55514. while (node) {
  55515. if (node === parent) {
  55516. return true;
  55517. }
  55518. node = node[$getParent]();
  55519. }
  55520. return false;
  55521. }
  55522. [$getParent]() {
  55523. return this[_parent];
  55524. }
  55525. [$getSubformParent]() {
  55526. return this[$getParent]();
  55527. }
  55528. [$getChildren]() {
  55529. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55530. if (!name) {
  55531. return this[_children];
  55532. }
  55533. return this[name];
  55534. }
  55535. [$dump]() {
  55536. const dumped = Object.create(null);
  55537. if (this[$content]) {
  55538. dumped.$content = this[$content];
  55539. }
  55540. for (const name of Object.getOwnPropertyNames(this)) {
  55541. const value = this[name];
  55542. if (value === null) {
  55543. continue;
  55544. }
  55545. if (value instanceof XFAObject) {
  55546. dumped[name] = value[$dump]();
  55547. } else if (value instanceof XFAObjectArray) {
  55548. if (!value.isEmpty()) {
  55549. dumped[name] = value.dump();
  55550. }
  55551. } else {
  55552. dumped[name] = value;
  55553. }
  55554. }
  55555. return dumped;
  55556. }
  55557. [$toStyle]() {
  55558. return null;
  55559. }
  55560. [$toHTML]() {
  55561. return _utils.HTMLResult.EMPTY;
  55562. }
  55563. *[$getContainedChildren]() {
  55564. for (const node of this[$getChildren]()) {
  55565. yield node;
  55566. }
  55567. }
  55568. *[_filteredChildrenGenerator](filter, include) {
  55569. for (const node of this[$getContainedChildren]()) {
  55570. if (!filter || include === filter.has(node[$nodeName])) {
  55571. const availableSpace = this[$getAvailableSpace]();
  55572. const res = node[$toHTML](availableSpace);
  55573. if (!res.success) {
  55574. this[$extra].failingNode = node;
  55575. }
  55576. yield res;
  55577. }
  55578. }
  55579. }
  55580. [$flushHTML]() {
  55581. return null;
  55582. }
  55583. [$addHTML](html, bbox) {
  55584. this[$extra].children.push(html);
  55585. }
  55586. [$getAvailableSpace]() {}
  55587. [$childrenToHTML](_ref) {
  55588. let {
  55589. filter = null,
  55590. include = true
  55591. } = _ref;
  55592. if (!this[$extra].generator) {
  55593. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  55594. } else {
  55595. const availableSpace = this[$getAvailableSpace]();
  55596. const res = this[$extra].failingNode[$toHTML](availableSpace);
  55597. if (!res.success) {
  55598. return res;
  55599. }
  55600. if (res.html) {
  55601. this[$addHTML](res.html, res.bbox);
  55602. }
  55603. delete this[$extra].failingNode;
  55604. }
  55605. while (true) {
  55606. const gen = this[$extra].generator.next();
  55607. if (gen.done) {
  55608. break;
  55609. }
  55610. const res = gen.value;
  55611. if (!res.success) {
  55612. return res;
  55613. }
  55614. if (res.html) {
  55615. this[$addHTML](res.html, res.bbox);
  55616. }
  55617. }
  55618. this[$extra].generator = null;
  55619. return _utils.HTMLResult.EMPTY;
  55620. }
  55621. [$setSetAttributes](attributes) {
  55622. this[_setAttributes] = new Set(Object.keys(attributes));
  55623. }
  55624. [_getUnsetAttributes](protoAttributes) {
  55625. const allAttr = this[_attributeNames];
  55626. const setAttr = this[_setAttributes];
  55627. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  55628. }
  55629. [$resolvePrototypes](ids) {
  55630. let ancestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
  55631. for (const child of this[_children]) {
  55632. child[_resolvePrototypesHelper](ids, ancestors);
  55633. }
  55634. }
  55635. [_resolvePrototypesHelper](ids, ancestors) {
  55636. const proto = this[_getPrototype](ids, ancestors);
  55637. if (proto) {
  55638. this[_applyPrototype](proto, ids, ancestors);
  55639. } else {
  55640. this[$resolvePrototypes](ids, ancestors);
  55641. }
  55642. }
  55643. [_getPrototype](ids, ancestors) {
  55644. const {
  55645. use,
  55646. usehref
  55647. } = this;
  55648. if (!use && !usehref) {
  55649. return null;
  55650. }
  55651. let proto = null;
  55652. let somExpression = null;
  55653. let id = null;
  55654. let ref = use;
  55655. if (usehref) {
  55656. ref = usehref;
  55657. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  55658. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  55659. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  55660. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  55661. } else if (usehref.startsWith("#")) {
  55662. id = usehref.slice(1);
  55663. } else if (usehref.startsWith(".#")) {
  55664. id = usehref.slice(2);
  55665. }
  55666. } else if (use.startsWith("#")) {
  55667. id = use.slice(1);
  55668. } else {
  55669. somExpression = use;
  55670. }
  55671. this.use = this.usehref = "";
  55672. if (id) {
  55673. proto = ids.get(id);
  55674. } else {
  55675. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  55676. if (proto) {
  55677. proto = proto[0];
  55678. }
  55679. }
  55680. if (!proto) {
  55681. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  55682. return null;
  55683. }
  55684. if (proto[$nodeName] !== this[$nodeName]) {
  55685. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  55686. return null;
  55687. }
  55688. if (ancestors.has(proto)) {
  55689. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55690. return null;
  55691. }
  55692. ancestors.add(proto);
  55693. const protoProto = proto[_getPrototype](ids, ancestors);
  55694. if (protoProto) {
  55695. proto[_applyPrototype](protoProto, ids, ancestors);
  55696. }
  55697. proto[$resolvePrototypes](ids, ancestors);
  55698. ancestors.delete(proto);
  55699. return proto;
  55700. }
  55701. [_applyPrototype](proto, ids, ancestors) {
  55702. if (ancestors.has(proto)) {
  55703. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55704. return;
  55705. }
  55706. if (!this[$content] && proto[$content]) {
  55707. this[$content] = proto[$content];
  55708. }
  55709. const newAncestors = new Set(ancestors);
  55710. newAncestors.add(proto);
  55711. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  55712. this[unsetAttrName] = proto[unsetAttrName];
  55713. if (this[_setAttributes]) {
  55714. this[_setAttributes].add(unsetAttrName);
  55715. }
  55716. }
  55717. for (const name of Object.getOwnPropertyNames(this)) {
  55718. if (this[_attributeNames].has(name)) {
  55719. continue;
  55720. }
  55721. const value = this[name];
  55722. const protoValue = proto[name];
  55723. if (value instanceof XFAObjectArray) {
  55724. for (const child of value[_children]) {
  55725. child[_resolvePrototypesHelper](ids, ancestors);
  55726. }
  55727. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  55728. const child = proto[_children][i][$clone]();
  55729. if (value.push(child)) {
  55730. child[_parent] = this;
  55731. this[_children].push(child);
  55732. child[_resolvePrototypesHelper](ids, ancestors);
  55733. } else {
  55734. break;
  55735. }
  55736. }
  55737. continue;
  55738. }
  55739. if (value !== null) {
  55740. value[$resolvePrototypes](ids, ancestors);
  55741. if (protoValue) {
  55742. value[_applyPrototype](protoValue, ids, ancestors);
  55743. }
  55744. continue;
  55745. }
  55746. if (protoValue !== null) {
  55747. const child = protoValue[$clone]();
  55748. child[_parent] = this;
  55749. this[name] = child;
  55750. this[_children].push(child);
  55751. child[_resolvePrototypesHelper](ids, ancestors);
  55752. }
  55753. }
  55754. }
  55755. static [_cloneAttribute](obj) {
  55756. if (Array.isArray(obj)) {
  55757. return obj.map(x => XFAObject[_cloneAttribute](x));
  55758. }
  55759. if (typeof obj === "object" && obj !== null) {
  55760. return Object.assign({}, obj);
  55761. }
  55762. return obj;
  55763. }
  55764. [$clone]() {
  55765. const clone = Object.create(Object.getPrototypeOf(this));
  55766. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  55767. try {
  55768. clone[$symbol] = this[$symbol];
  55769. } catch (_) {
  55770. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  55771. }
  55772. }
  55773. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  55774. clone[_children] = [];
  55775. for (const name of Object.getOwnPropertyNames(this)) {
  55776. if (this[_attributeNames].has(name)) {
  55777. clone[name] = XFAObject[_cloneAttribute](this[name]);
  55778. continue;
  55779. }
  55780. const value = this[name];
  55781. if (value instanceof XFAObjectArray) {
  55782. clone[name] = new XFAObjectArray(value[_max]);
  55783. } else {
  55784. clone[name] = null;
  55785. }
  55786. }
  55787. for (const child of this[_children]) {
  55788. const name = child[$nodeName];
  55789. const clonedChild = child[$clone]();
  55790. clone[_children].push(clonedChild);
  55791. clonedChild[_parent] = clone;
  55792. if (clone[name] === null) {
  55793. clone[name] = clonedChild;
  55794. } else {
  55795. clone[name][_children].push(clonedChild);
  55796. }
  55797. }
  55798. return clone;
  55799. }
  55800. [$getChildren]() {
  55801. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55802. if (!name) {
  55803. return this[_children];
  55804. }
  55805. return this[_children].filter(c => c[$nodeName] === name);
  55806. }
  55807. [$getChildrenByClass](name) {
  55808. return this[name];
  55809. }
  55810. [$getChildrenByName](name, allTransparent) {
  55811. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55812. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  55813. }
  55814. [$getChildrenByNameIt](name, allTransparent) {
  55815. var _this = this;
  55816. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55817. return function* () {
  55818. if (name === "parent") {
  55819. yield _this[_parent];
  55820. return;
  55821. }
  55822. for (const child of _this[_children]) {
  55823. if (child[$nodeName] === name) {
  55824. yield child;
  55825. }
  55826. if (child.name === name) {
  55827. yield child;
  55828. }
  55829. if (allTransparent || child[$isTransparent]()) {
  55830. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  55831. }
  55832. }
  55833. if (first && _this[_attributeNames].has(name)) {
  55834. yield new XFAAttribute(_this, name, _this[name]);
  55835. }
  55836. }();
  55837. }
  55838. }
  55839. exports.XFAObject = XFAObject;
  55840. class XFAObjectArray {
  55841. constructor() {
  55842. let max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;
  55843. this[_max] = max;
  55844. this[_children] = [];
  55845. }
  55846. push(child) {
  55847. const len = this[_children].length;
  55848. if (len <= this[_max]) {
  55849. this[_children].push(child);
  55850. return true;
  55851. }
  55852. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  55853. return false;
  55854. }
  55855. isEmpty() {
  55856. return this[_children].length === 0;
  55857. }
  55858. dump() {
  55859. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  55860. }
  55861. [$clone]() {
  55862. const clone = new XFAObjectArray(this[_max]);
  55863. clone[_children] = this[_children].map(c => c[$clone]());
  55864. return clone;
  55865. }
  55866. get children() {
  55867. return this[_children];
  55868. }
  55869. clear() {
  55870. this[_children].length = 0;
  55871. }
  55872. }
  55873. exports.XFAObjectArray = XFAObjectArray;
  55874. class XFAAttribute {
  55875. constructor(node, name, value) {
  55876. this[_parent] = node;
  55877. this[$nodeName] = name;
  55878. this[$content] = value;
  55879. this[$consumed] = false;
  55880. this[$uid] = `attribute${uid++}`;
  55881. }
  55882. [$getParent]() {
  55883. return this[_parent];
  55884. }
  55885. [$isDataValue]() {
  55886. return true;
  55887. }
  55888. [$getDataValue]() {
  55889. return this[$content].trim();
  55890. }
  55891. [$setValue](value) {
  55892. value = value.value || "";
  55893. this[$content] = value.toString();
  55894. }
  55895. [$text]() {
  55896. return this[$content];
  55897. }
  55898. [$isDescendent](parent) {
  55899. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  55900. }
  55901. }
  55902. exports.XFAAttribute = XFAAttribute;
  55903. class XmlObject extends XFAObject {
  55904. constructor(nsId, name) {
  55905. let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  55906. super(nsId, name);
  55907. this[$content] = "";
  55908. this[_dataValue] = null;
  55909. if (name !== "#text") {
  55910. const map = new Map();
  55911. this[_attributes] = map;
  55912. for (const [attrName, value] of Object.entries(attributes)) {
  55913. map.set(attrName, new XFAAttribute(this, attrName, value));
  55914. }
  55915. if (attributes.hasOwnProperty($nsAttributes)) {
  55916. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  55917. if (dataNode !== undefined) {
  55918. if (dataNode === "dataGroup") {
  55919. this[_dataValue] = false;
  55920. } else if (dataNode === "dataValue") {
  55921. this[_dataValue] = true;
  55922. }
  55923. }
  55924. }
  55925. }
  55926. this[$consumed] = false;
  55927. }
  55928. [$toString](buf) {
  55929. const tagName = this[$nodeName];
  55930. if (tagName === "#text") {
  55931. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  55932. return;
  55933. }
  55934. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  55935. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  55936. buf.push(`<${prefix}${utf8TagName}`);
  55937. for (const [name, value] of this[_attributes].entries()) {
  55938. const utf8Name = (0, _util.utf8StringToString)(name);
  55939. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  55940. }
  55941. if (this[_dataValue] !== null) {
  55942. if (this[_dataValue]) {
  55943. buf.push(` xfa:dataNode="dataValue"`);
  55944. } else {
  55945. buf.push(` xfa:dataNode="dataGroup"`);
  55946. }
  55947. }
  55948. if (!this[$content] && this[_children].length === 0) {
  55949. buf.push("/>");
  55950. return;
  55951. }
  55952. buf.push(">");
  55953. if (this[$content]) {
  55954. if (typeof this[$content] === "string") {
  55955. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  55956. } else {
  55957. this[$content][$toString](buf);
  55958. }
  55959. } else {
  55960. for (const child of this[_children]) {
  55961. child[$toString](buf);
  55962. }
  55963. }
  55964. buf.push(`</${prefix}${utf8TagName}>`);
  55965. }
  55966. [$onChild](child) {
  55967. if (this[$content]) {
  55968. const node = new XmlObject(this[$namespaceId], "#text");
  55969. this[$appendChild](node);
  55970. node[$content] = this[$content];
  55971. this[$content] = "";
  55972. }
  55973. this[$appendChild](child);
  55974. return true;
  55975. }
  55976. [$onText](str) {
  55977. this[$content] += str;
  55978. }
  55979. [$finalize]() {
  55980. if (this[$content] && this[_children].length > 0) {
  55981. const node = new XmlObject(this[$namespaceId], "#text");
  55982. this[$appendChild](node);
  55983. node[$content] = this[$content];
  55984. delete this[$content];
  55985. }
  55986. }
  55987. [$toHTML]() {
  55988. if (this[$nodeName] === "#text") {
  55989. return _utils.HTMLResult.success({
  55990. name: "#text",
  55991. value: this[$content]
  55992. });
  55993. }
  55994. return _utils.HTMLResult.EMPTY;
  55995. }
  55996. [$getChildren]() {
  55997. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55998. if (!name) {
  55999. return this[_children];
  56000. }
  56001. return this[_children].filter(c => c[$nodeName] === name);
  56002. }
  56003. [$getAttributes]() {
  56004. return this[_attributes];
  56005. }
  56006. [$getChildrenByClass](name) {
  56007. const value = this[_attributes].get(name);
  56008. if (value !== undefined) {
  56009. return value;
  56010. }
  56011. return this[$getChildren](name);
  56012. }
  56013. *[$getChildrenByNameIt](name, allTransparent) {
  56014. const value = this[_attributes].get(name);
  56015. if (value) {
  56016. yield value;
  56017. }
  56018. for (const child of this[_children]) {
  56019. if (child[$nodeName] === name) {
  56020. yield child;
  56021. }
  56022. if (allTransparent) {
  56023. yield* child[$getChildrenByNameIt](name, allTransparent);
  56024. }
  56025. }
  56026. }
  56027. *[$getAttributeIt](name, skipConsumed) {
  56028. const value = this[_attributes].get(name);
  56029. if (value && (!skipConsumed || !value[$consumed])) {
  56030. yield value;
  56031. }
  56032. for (const child of this[_children]) {
  56033. yield* child[$getAttributeIt](name, skipConsumed);
  56034. }
  56035. }
  56036. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  56037. for (const child of this[_children]) {
  56038. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  56039. yield child;
  56040. }
  56041. if (allTransparent) {
  56042. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  56043. }
  56044. }
  56045. }
  56046. [$isDataValue]() {
  56047. if (this[_dataValue] === null) {
  56048. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  56049. }
  56050. return this[_dataValue];
  56051. }
  56052. [$getDataValue]() {
  56053. if (this[_dataValue] === null) {
  56054. if (this[_children].length === 0) {
  56055. return this[$content].trim();
  56056. }
  56057. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  56058. return this[_children][0][$text]().trim();
  56059. }
  56060. return null;
  56061. }
  56062. return this[$content].trim();
  56063. }
  56064. [$setValue](value) {
  56065. value = value.value || "";
  56066. this[$content] = value.toString();
  56067. }
  56068. [$dump]() {
  56069. let hasNS = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  56070. const dumped = Object.create(null);
  56071. if (hasNS) {
  56072. dumped.$ns = this[$namespaceId];
  56073. }
  56074. if (this[$content]) {
  56075. dumped.$content = this[$content];
  56076. }
  56077. dumped.$name = this[$nodeName];
  56078. dumped.children = [];
  56079. for (const child of this[_children]) {
  56080. dumped.children.push(child[$dump](hasNS));
  56081. }
  56082. dumped.attributes = Object.create(null);
  56083. for (const [name, value] of this[_attributes]) {
  56084. dumped.attributes[name] = value[$content];
  56085. }
  56086. return dumped;
  56087. }
  56088. }
  56089. exports.XmlObject = XmlObject;
  56090. class ContentObject extends XFAObject {
  56091. constructor(nsId, name) {
  56092. super(nsId, name);
  56093. this[$content] = "";
  56094. }
  56095. [$onText](text) {
  56096. this[$content] += text;
  56097. }
  56098. [$finalize]() {}
  56099. }
  56100. exports.ContentObject = ContentObject;
  56101. class OptionObject extends ContentObject {
  56102. constructor(nsId, name, options) {
  56103. super(nsId, name);
  56104. this[_options] = options;
  56105. }
  56106. [$finalize]() {
  56107. this[$content] = (0, _utils.getKeyword)({
  56108. data: this[$content],
  56109. defaultValue: this[_options][0],
  56110. validate: k => this[_options].includes(k)
  56111. });
  56112. }
  56113. [$clean](builder) {
  56114. super[$clean](builder);
  56115. delete this[_options];
  56116. }
  56117. }
  56118. exports.OptionObject = OptionObject;
  56119. class StringObject extends ContentObject {
  56120. [$finalize]() {
  56121. this[$content] = this[$content].trim();
  56122. }
  56123. }
  56124. exports.StringObject = StringObject;
  56125. class IntegerObject extends ContentObject {
  56126. constructor(nsId, name, defaultValue, validator) {
  56127. super(nsId, name);
  56128. this[_defaultValue] = defaultValue;
  56129. this[_validator] = validator;
  56130. }
  56131. [$finalize]() {
  56132. this[$content] = (0, _utils.getInteger)({
  56133. data: this[$content],
  56134. defaultValue: this[_defaultValue],
  56135. validate: this[_validator]
  56136. });
  56137. }
  56138. [$clean](builder) {
  56139. super[$clean](builder);
  56140. delete this[_defaultValue];
  56141. delete this[_validator];
  56142. }
  56143. }
  56144. exports.IntegerObject = IntegerObject;
  56145. class Option01 extends IntegerObject {
  56146. constructor(nsId, name) {
  56147. super(nsId, name, 0, n => n === 1);
  56148. }
  56149. }
  56150. exports.Option01 = Option01;
  56151. class Option10 extends IntegerObject {
  56152. constructor(nsId, name) {
  56153. super(nsId, name, 1, n => n === 0);
  56154. }
  56155. }
  56156. exports.Option10 = Option10;
  56157. /***/ }),
  56158. /* 207 */
  56159. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56160. "use strict";
  56161. Object.defineProperty(exports, "__esModule", ({
  56162. value: true
  56163. }));
  56164. exports.HTMLResult = void 0;
  56165. exports.getBBox = getBBox;
  56166. exports.getColor = getColor;
  56167. exports.getFloat = getFloat;
  56168. exports.getInteger = getInteger;
  56169. exports.getKeyword = getKeyword;
  56170. exports.getMeasurement = getMeasurement;
  56171. exports.getRatio = getRatio;
  56172. exports.getRelevant = getRelevant;
  56173. exports.getStringOption = getStringOption;
  56174. exports.stripQuotes = stripQuotes;
  56175. var _util = __w_pdfjs_require__(2);
  56176. const dimConverters = {
  56177. pt: x => x,
  56178. cm: x => x / 2.54 * 72,
  56179. mm: x => x / (10 * 2.54) * 72,
  56180. in: x => x * 72,
  56181. px: x => x
  56182. };
  56183. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  56184. function stripQuotes(str) {
  56185. if (str.startsWith("'") || str.startsWith('"')) {
  56186. return str.slice(1, str.length - 1);
  56187. }
  56188. return str;
  56189. }
  56190. function getInteger(_ref) {
  56191. let {
  56192. data,
  56193. defaultValue,
  56194. validate
  56195. } = _ref;
  56196. if (!data) {
  56197. return defaultValue;
  56198. }
  56199. data = data.trim();
  56200. const n = parseInt(data, 10);
  56201. if (!isNaN(n) && validate(n)) {
  56202. return n;
  56203. }
  56204. return defaultValue;
  56205. }
  56206. function getFloat(_ref2) {
  56207. let {
  56208. data,
  56209. defaultValue,
  56210. validate
  56211. } = _ref2;
  56212. if (!data) {
  56213. return defaultValue;
  56214. }
  56215. data = data.trim();
  56216. const n = parseFloat(data);
  56217. if (!isNaN(n) && validate(n)) {
  56218. return n;
  56219. }
  56220. return defaultValue;
  56221. }
  56222. function getKeyword(_ref3) {
  56223. let {
  56224. data,
  56225. defaultValue,
  56226. validate
  56227. } = _ref3;
  56228. if (!data) {
  56229. return defaultValue;
  56230. }
  56231. data = data.trim();
  56232. if (validate(data)) {
  56233. return data;
  56234. }
  56235. return defaultValue;
  56236. }
  56237. function getStringOption(data, options) {
  56238. return getKeyword({
  56239. data,
  56240. defaultValue: options[0],
  56241. validate: k => options.includes(k)
  56242. });
  56243. }
  56244. function getMeasurement(str) {
  56245. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "0";
  56246. def = def || "0";
  56247. if (!str) {
  56248. return getMeasurement(def);
  56249. }
  56250. const match = str.trim().match(measurementPattern);
  56251. if (!match) {
  56252. return getMeasurement(def);
  56253. }
  56254. const [, valueStr, unit] = match;
  56255. const value = parseFloat(valueStr);
  56256. if (isNaN(value)) {
  56257. return getMeasurement(def);
  56258. }
  56259. if (value === 0) {
  56260. return 0;
  56261. }
  56262. const conv = dimConverters[unit];
  56263. if (conv) {
  56264. return conv(value);
  56265. }
  56266. return value;
  56267. }
  56268. function getRatio(data) {
  56269. if (!data) {
  56270. return {
  56271. num: 1,
  56272. den: 1
  56273. };
  56274. }
  56275. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  56276. if (ratio.length === 1) {
  56277. ratio.push(1);
  56278. }
  56279. if (ratio.length === 0) {
  56280. return {
  56281. num: 1,
  56282. den: 1
  56283. };
  56284. }
  56285. const [num, den] = ratio;
  56286. return {
  56287. num,
  56288. den
  56289. };
  56290. }
  56291. function getRelevant(data) {
  56292. if (!data) {
  56293. return [];
  56294. }
  56295. return data.trim().split(/\s+/).map(e => {
  56296. return {
  56297. excluded: e[0] === "-",
  56298. viewname: e.substring(1)
  56299. };
  56300. });
  56301. }
  56302. function getColor(data) {
  56303. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
  56304. let [r, g, b] = def;
  56305. if (!data) {
  56306. return {
  56307. r,
  56308. g,
  56309. b
  56310. };
  56311. }
  56312. 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);
  56313. if (color.length < 3) {
  56314. return {
  56315. r,
  56316. g,
  56317. b
  56318. };
  56319. }
  56320. [r, g, b] = color;
  56321. return {
  56322. r,
  56323. g,
  56324. b
  56325. };
  56326. }
  56327. function getBBox(data) {
  56328. const def = -1;
  56329. if (!data) {
  56330. return {
  56331. x: def,
  56332. y: def,
  56333. width: def,
  56334. height: def
  56335. };
  56336. }
  56337. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  56338. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  56339. return {
  56340. x: def,
  56341. y: def,
  56342. width: def,
  56343. height: def
  56344. };
  56345. }
  56346. const [x, y, width, height] = bbox;
  56347. return {
  56348. x,
  56349. y,
  56350. width,
  56351. height
  56352. };
  56353. }
  56354. class HTMLResult {
  56355. static get FAILURE() {
  56356. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  56357. }
  56358. static get EMPTY() {
  56359. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  56360. }
  56361. constructor(success, html, bbox, breakNode) {
  56362. this.success = success;
  56363. this.html = html;
  56364. this.bbox = bbox;
  56365. this.breakNode = breakNode;
  56366. }
  56367. isBreak() {
  56368. return !!this.breakNode;
  56369. }
  56370. static breakNode(node) {
  56371. return new HTMLResult(false, null, null, node);
  56372. }
  56373. static success(html) {
  56374. let bbox = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  56375. return new HTMLResult(true, html, bbox, null);
  56376. }
  56377. }
  56378. exports.HTMLResult = HTMLResult;
  56379. /***/ }),
  56380. /* 208 */
  56381. /***/ ((__unused_webpack_module, exports) => {
  56382. "use strict";
  56383. Object.defineProperty(exports, "__esModule", ({
  56384. value: true
  56385. }));
  56386. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  56387. const $buildXFAObject = Symbol();
  56388. exports.$buildXFAObject = $buildXFAObject;
  56389. const NamespaceIds = {
  56390. config: {
  56391. id: 0,
  56392. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  56393. },
  56394. connectionSet: {
  56395. id: 1,
  56396. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  56397. },
  56398. datasets: {
  56399. id: 2,
  56400. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  56401. },
  56402. form: {
  56403. id: 3,
  56404. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  56405. },
  56406. localeSet: {
  56407. id: 4,
  56408. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  56409. },
  56410. pdf: {
  56411. id: 5,
  56412. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  56413. },
  56414. signature: {
  56415. id: 6,
  56416. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  56417. },
  56418. sourceSet: {
  56419. id: 7,
  56420. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  56421. },
  56422. stylesheet: {
  56423. id: 8,
  56424. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  56425. },
  56426. template: {
  56427. id: 9,
  56428. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  56429. },
  56430. xdc: {
  56431. id: 10,
  56432. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  56433. },
  56434. xdp: {
  56435. id: 11,
  56436. check: ns => ns === "http://ns.adobe.com/xdp/"
  56437. },
  56438. xfdf: {
  56439. id: 12,
  56440. check: ns => ns === "http://ns.adobe.com/xfdf/"
  56441. },
  56442. xhtml: {
  56443. id: 13,
  56444. check: ns => ns === "http://www.w3.org/1999/xhtml"
  56445. },
  56446. xmpmeta: {
  56447. id: 14,
  56448. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  56449. }
  56450. };
  56451. exports.NamespaceIds = NamespaceIds;
  56452. /***/ }),
  56453. /* 209 */
  56454. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56455. "use strict";
  56456. Object.defineProperty(exports, "__esModule", ({
  56457. value: true
  56458. }));
  56459. exports.createDataNode = createDataNode;
  56460. exports.searchNode = searchNode;
  56461. var _xfa_object = __w_pdfjs_require__(206);
  56462. var _namespaces = __w_pdfjs_require__(208);
  56463. var _util = __w_pdfjs_require__(2);
  56464. const namePattern = /^[^.[]+/;
  56465. const indexPattern = /^[^\]]+/;
  56466. const operators = {
  56467. dot: 0,
  56468. dotDot: 1,
  56469. dotHash: 2,
  56470. dotBracket: 3,
  56471. dotParen: 4
  56472. };
  56473. 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]]);
  56474. const somCache = new WeakMap();
  56475. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  56476. function parseIndex(index) {
  56477. index = index.trim();
  56478. if (index === "*") {
  56479. return Infinity;
  56480. }
  56481. return parseInt(index, 10) || 0;
  56482. }
  56483. function parseExpression(expr, dotDotAllowed) {
  56484. let noExpr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  56485. let match = expr.match(namePattern);
  56486. if (!match) {
  56487. return null;
  56488. }
  56489. let [name] = match;
  56490. const parsed = [{
  56491. name,
  56492. cacheName: "." + name,
  56493. index: 0,
  56494. js: null,
  56495. formCalc: null,
  56496. operator: operators.dot
  56497. }];
  56498. let pos = name.length;
  56499. while (pos < expr.length) {
  56500. const spos = pos;
  56501. const char = expr.charAt(pos++);
  56502. if (char === "[") {
  56503. match = expr.slice(pos).match(indexPattern);
  56504. if (!match) {
  56505. (0, _util.warn)("XFA - Invalid index in SOM expression");
  56506. return null;
  56507. }
  56508. parsed.at(-1).index = parseIndex(match[0]);
  56509. pos += match[0].length + 1;
  56510. continue;
  56511. }
  56512. let operator;
  56513. switch (expr.charAt(pos)) {
  56514. case ".":
  56515. if (!dotDotAllowed) {
  56516. return null;
  56517. }
  56518. pos++;
  56519. operator = operators.dotDot;
  56520. break;
  56521. case "#":
  56522. pos++;
  56523. operator = operators.dotHash;
  56524. break;
  56525. case "[":
  56526. if (noExpr) {
  56527. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  56528. return null;
  56529. }
  56530. operator = operators.dotBracket;
  56531. break;
  56532. case "(":
  56533. if (noExpr) {
  56534. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  56535. return null;
  56536. }
  56537. operator = operators.dotParen;
  56538. break;
  56539. default:
  56540. operator = operators.dot;
  56541. break;
  56542. }
  56543. match = expr.slice(pos).match(namePattern);
  56544. if (!match) {
  56545. break;
  56546. }
  56547. [name] = match;
  56548. pos += name.length;
  56549. parsed.push({
  56550. name,
  56551. cacheName: expr.slice(spos, pos),
  56552. operator,
  56553. index: 0,
  56554. js: null,
  56555. formCalc: null
  56556. });
  56557. }
  56558. return parsed;
  56559. }
  56560. function searchNode(root, container, expr) {
  56561. let dotDotAllowed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  56562. let useCache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  56563. const parsed = parseExpression(expr, dotDotAllowed);
  56564. if (!parsed) {
  56565. return null;
  56566. }
  56567. const fn = shortcuts.get(parsed[0].name);
  56568. let i = 0;
  56569. let isQualified;
  56570. if (fn) {
  56571. isQualified = true;
  56572. root = [fn(root, container)];
  56573. i = 1;
  56574. } else {
  56575. isQualified = container === null;
  56576. root = [container || root];
  56577. }
  56578. for (let ii = parsed.length; i < ii; i++) {
  56579. const {
  56580. name,
  56581. cacheName,
  56582. operator,
  56583. index
  56584. } = parsed[i];
  56585. const nodes = [];
  56586. for (const node of root) {
  56587. if (!(node instanceof _xfa_object.XFAObject)) {
  56588. continue;
  56589. }
  56590. let children, cached;
  56591. if (useCache) {
  56592. cached = somCache.get(node);
  56593. if (!cached) {
  56594. cached = new Map();
  56595. somCache.set(node, cached);
  56596. }
  56597. children = cached.get(cacheName);
  56598. }
  56599. if (!children) {
  56600. switch (operator) {
  56601. case operators.dot:
  56602. children = node[_xfa_object.$getChildrenByName](name, false);
  56603. break;
  56604. case operators.dotDot:
  56605. children = node[_xfa_object.$getChildrenByName](name, true);
  56606. break;
  56607. case operators.dotHash:
  56608. children = node[_xfa_object.$getChildrenByClass](name);
  56609. if (children instanceof _xfa_object.XFAObjectArray) {
  56610. children = children.children;
  56611. } else {
  56612. children = [children];
  56613. }
  56614. break;
  56615. default:
  56616. break;
  56617. }
  56618. if (useCache) {
  56619. cached.set(cacheName, children);
  56620. }
  56621. }
  56622. if (children.length > 0) {
  56623. nodes.push(children);
  56624. }
  56625. }
  56626. if (nodes.length === 0 && !isQualified && i === 0) {
  56627. const parent = container[_xfa_object.$getParent]();
  56628. container = parent;
  56629. if (!container) {
  56630. return null;
  56631. }
  56632. i = -1;
  56633. root = [container];
  56634. continue;
  56635. }
  56636. if (isFinite(index)) {
  56637. root = nodes.filter(node => index < node.length).map(node => node[index]);
  56638. } else {
  56639. root = nodes.flat();
  56640. }
  56641. }
  56642. if (root.length === 0) {
  56643. return null;
  56644. }
  56645. return root;
  56646. }
  56647. function createNodes(root, path) {
  56648. let node = null;
  56649. for (const {
  56650. name,
  56651. index
  56652. } of path) {
  56653. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  56654. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  56655. node = new _xfa_object.XmlObject(nsId, name);
  56656. root[_xfa_object.$appendChild](node);
  56657. }
  56658. root = node;
  56659. }
  56660. return node;
  56661. }
  56662. function createDataNode(root, container, expr) {
  56663. const parsed = parseExpression(expr);
  56664. if (!parsed) {
  56665. return null;
  56666. }
  56667. if (parsed.some(x => x.operator === operators.dotDot)) {
  56668. return null;
  56669. }
  56670. const fn = shortcuts.get(parsed[0].name);
  56671. let i = 0;
  56672. if (fn) {
  56673. root = fn(root, container);
  56674. i = 1;
  56675. } else {
  56676. root = container || root;
  56677. }
  56678. for (let ii = parsed.length; i < ii; i++) {
  56679. const {
  56680. name,
  56681. operator,
  56682. index
  56683. } = parsed[i];
  56684. if (!isFinite(index)) {
  56685. parsed[i].index = 0;
  56686. return createNodes(root, parsed.slice(i));
  56687. }
  56688. let children;
  56689. switch (operator) {
  56690. case operators.dot:
  56691. children = root[_xfa_object.$getChildrenByName](name, false);
  56692. break;
  56693. case operators.dotDot:
  56694. children = root[_xfa_object.$getChildrenByName](name, true);
  56695. break;
  56696. case operators.dotHash:
  56697. children = root[_xfa_object.$getChildrenByClass](name);
  56698. if (children instanceof _xfa_object.XFAObjectArray) {
  56699. children = children.children;
  56700. } else {
  56701. children = [children];
  56702. }
  56703. break;
  56704. default:
  56705. break;
  56706. }
  56707. if (children.length === 0) {
  56708. return createNodes(root, parsed.slice(i));
  56709. }
  56710. if (index < children.length) {
  56711. const child = children[index];
  56712. if (!(child instanceof _xfa_object.XFAObject)) {
  56713. (0, _util.warn)(`XFA - Cannot create a node.`);
  56714. return null;
  56715. }
  56716. root = child;
  56717. } else {
  56718. parsed[i].index = index - children.length;
  56719. return createNodes(root, parsed.slice(i));
  56720. }
  56721. }
  56722. return null;
  56723. }
  56724. /***/ }),
  56725. /* 210 */
  56726. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56727. "use strict";
  56728. Object.defineProperty(exports, "__esModule", ({
  56729. value: true
  56730. }));
  56731. exports.Binder = void 0;
  56732. var _xfa_object = __w_pdfjs_require__(206);
  56733. var _template = __w_pdfjs_require__(211);
  56734. var _som = __w_pdfjs_require__(209);
  56735. var _namespaces = __w_pdfjs_require__(208);
  56736. var _util = __w_pdfjs_require__(2);
  56737. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  56738. function createText(content) {
  56739. const node = new _template.Text({});
  56740. node[_xfa_object.$content] = content;
  56741. return node;
  56742. }
  56743. class Binder {
  56744. constructor(root) {
  56745. this.root = root;
  56746. this.datasets = root.datasets;
  56747. if (root.datasets && root.datasets.data) {
  56748. this.data = root.datasets.data;
  56749. } else {
  56750. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  56751. }
  56752. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  56753. this.root.form = this.form = root.template[_xfa_object.$clone]();
  56754. }
  56755. _isConsumeData() {
  56756. return !this.emptyMerge && this._mergeMode;
  56757. }
  56758. _isMatchTemplate() {
  56759. return !this._isConsumeData();
  56760. }
  56761. bind() {
  56762. this._bindElement(this.form, this.data);
  56763. return this.form;
  56764. }
  56765. getData() {
  56766. return this.data;
  56767. }
  56768. _bindValue(formNode, data, picture) {
  56769. formNode[_xfa_object.$data] = data;
  56770. if (formNode[_xfa_object.$hasSettableValue]()) {
  56771. if (data[_xfa_object.$isDataValue]()) {
  56772. const value = data[_xfa_object.$getDataValue]();
  56773. formNode[_xfa_object.$setValue](createText(value));
  56774. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  56775. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  56776. formNode[_xfa_object.$setValue](createText(value));
  56777. } else if (this._isConsumeData()) {
  56778. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56779. }
  56780. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  56781. this._bindElement(formNode, data);
  56782. } else {
  56783. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56784. }
  56785. }
  56786. _findDataByNameToConsume(name, isValue, dataNode, global) {
  56787. if (!name) {
  56788. return null;
  56789. }
  56790. let generator, match;
  56791. for (let i = 0; i < 3; i++) {
  56792. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  56793. while (true) {
  56794. match = generator.next().value;
  56795. if (!match) {
  56796. break;
  56797. }
  56798. if (isValue === match[_xfa_object.$isDataValue]()) {
  56799. return match;
  56800. }
  56801. }
  56802. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  56803. break;
  56804. }
  56805. dataNode = dataNode[_xfa_object.$getParent]();
  56806. }
  56807. if (!global) {
  56808. return null;
  56809. }
  56810. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  56811. match = generator.next().value;
  56812. if (match) {
  56813. return match;
  56814. }
  56815. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  56816. match = generator.next().value;
  56817. if (match && match[_xfa_object.$isDataValue]()) {
  56818. return match;
  56819. }
  56820. return null;
  56821. }
  56822. _setProperties(formNode, dataNode) {
  56823. if (!formNode.hasOwnProperty("setProperty")) {
  56824. return;
  56825. }
  56826. for (const {
  56827. ref,
  56828. target,
  56829. connection
  56830. } of formNode.setProperty.children) {
  56831. if (connection) {
  56832. continue;
  56833. }
  56834. if (!ref) {
  56835. continue;
  56836. }
  56837. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56838. if (!nodes) {
  56839. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56840. continue;
  56841. }
  56842. const [node] = nodes;
  56843. if (!node[_xfa_object.$isDescendent](this.data)) {
  56844. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  56845. continue;
  56846. }
  56847. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  56848. if (!targetNodes) {
  56849. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  56850. continue;
  56851. }
  56852. const [targetNode] = targetNodes;
  56853. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  56854. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  56855. continue;
  56856. }
  56857. const targetParent = targetNode[_xfa_object.$getParent]();
  56858. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  56859. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  56860. continue;
  56861. }
  56862. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  56863. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  56864. continue;
  56865. }
  56866. const content = node[_xfa_object.$text]();
  56867. const name = targetNode[_xfa_object.$nodeName];
  56868. if (targetNode instanceof _xfa_object.XFAAttribute) {
  56869. const attrs = Object.create(null);
  56870. attrs[name] = content;
  56871. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  56872. targetParent[name] = obj[name];
  56873. continue;
  56874. }
  56875. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  56876. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  56877. continue;
  56878. }
  56879. targetNode[_xfa_object.$data] = node;
  56880. targetNode[_xfa_object.$content] = content;
  56881. targetNode[_xfa_object.$finalize]();
  56882. }
  56883. }
  56884. _bindItems(formNode, dataNode) {
  56885. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  56886. return;
  56887. }
  56888. for (const item of formNode.items.children) {
  56889. formNode[_xfa_object.$removeChild](item);
  56890. }
  56891. formNode.items.clear();
  56892. const labels = new _template.Items({});
  56893. const values = new _template.Items({});
  56894. formNode[_xfa_object.$appendChild](labels);
  56895. formNode.items.push(labels);
  56896. formNode[_xfa_object.$appendChild](values);
  56897. formNode.items.push(values);
  56898. for (const {
  56899. ref,
  56900. labelRef,
  56901. valueRef,
  56902. connection
  56903. } of formNode.bindItems.children) {
  56904. if (connection) {
  56905. continue;
  56906. }
  56907. if (!ref) {
  56908. continue;
  56909. }
  56910. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56911. if (!nodes) {
  56912. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56913. continue;
  56914. }
  56915. for (const node of nodes) {
  56916. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  56917. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  56918. continue;
  56919. }
  56920. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  56921. if (!labelNodes) {
  56922. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  56923. continue;
  56924. }
  56925. const [labelNode] = labelNodes;
  56926. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  56927. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  56928. continue;
  56929. }
  56930. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  56931. if (!valueNodes) {
  56932. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  56933. continue;
  56934. }
  56935. const [valueNode] = valueNodes;
  56936. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  56937. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  56938. continue;
  56939. }
  56940. const label = createText(labelNode[_xfa_object.$text]());
  56941. const value = createText(valueNode[_xfa_object.$text]());
  56942. labels[_xfa_object.$appendChild](label);
  56943. labels.text.push(label);
  56944. values[_xfa_object.$appendChild](value);
  56945. values.text.push(value);
  56946. }
  56947. }
  56948. }
  56949. _bindOccurrences(formNode, matches, picture) {
  56950. let baseClone;
  56951. if (matches.length > 1) {
  56952. baseClone = formNode[_xfa_object.$clone]();
  56953. baseClone[_xfa_object.$removeChild](baseClone.occur);
  56954. baseClone.occur = null;
  56955. }
  56956. this._bindValue(formNode, matches[0], picture);
  56957. this._setProperties(formNode, matches[0]);
  56958. this._bindItems(formNode, matches[0]);
  56959. if (matches.length === 1) {
  56960. return;
  56961. }
  56962. const parent = formNode[_xfa_object.$getParent]();
  56963. const name = formNode[_xfa_object.$nodeName];
  56964. const pos = parent[_xfa_object.$indexOf](formNode);
  56965. for (let i = 1, ii = matches.length; i < ii; i++) {
  56966. const match = matches[i];
  56967. const clone = baseClone[_xfa_object.$clone]();
  56968. parent[name].push(clone);
  56969. parent[_xfa_object.$insertAt](pos + i, clone);
  56970. this._bindValue(clone, match, picture);
  56971. this._setProperties(clone, match);
  56972. this._bindItems(clone, match);
  56973. }
  56974. }
  56975. _createOccurrences(formNode) {
  56976. if (!this.emptyMerge) {
  56977. return;
  56978. }
  56979. const {
  56980. occur
  56981. } = formNode;
  56982. if (!occur || occur.initial <= 1) {
  56983. return;
  56984. }
  56985. const parent = formNode[_xfa_object.$getParent]();
  56986. const name = formNode[_xfa_object.$nodeName];
  56987. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  56988. return;
  56989. }
  56990. let currentNumber;
  56991. if (formNode.name) {
  56992. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  56993. } else {
  56994. currentNumber = parent[name].children.length;
  56995. }
  56996. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  56997. const ii = occur.initial - currentNumber;
  56998. if (ii) {
  56999. const nodeClone = formNode[_xfa_object.$clone]();
  57000. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  57001. nodeClone.occur = null;
  57002. parent[name].push(nodeClone);
  57003. parent[_xfa_object.$insertAt](pos, nodeClone);
  57004. for (let i = 1; i < ii; i++) {
  57005. const clone = nodeClone[_xfa_object.$clone]();
  57006. parent[name].push(clone);
  57007. parent[_xfa_object.$insertAt](pos + i, clone);
  57008. }
  57009. }
  57010. }
  57011. _getOccurInfo(formNode) {
  57012. const {
  57013. name,
  57014. occur
  57015. } = formNode;
  57016. if (!occur || !name) {
  57017. return [1, 1];
  57018. }
  57019. const max = occur.max === -1 ? Infinity : occur.max;
  57020. return [occur.min, max];
  57021. }
  57022. _setAndBind(formNode, dataNode) {
  57023. this._setProperties(formNode, dataNode);
  57024. this._bindItems(formNode, dataNode);
  57025. this._bindElement(formNode, dataNode);
  57026. }
  57027. _bindElement(formNode, dataNode) {
  57028. const uselessNodes = [];
  57029. this._createOccurrences(formNode);
  57030. for (const child of formNode[_xfa_object.$getChildren]()) {
  57031. if (child[_xfa_object.$data]) {
  57032. continue;
  57033. }
  57034. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  57035. this._mergeMode = child.mergeMode === "consumeData";
  57036. const dataChildren = dataNode[_xfa_object.$getChildren]();
  57037. if (dataChildren.length > 0) {
  57038. this._bindOccurrences(child, [dataChildren[0]], null);
  57039. } else if (this.emptyMerge) {
  57040. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  57041. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  57042. dataNode[_xfa_object.$appendChild](dataChild);
  57043. this._bindElement(child, dataChild);
  57044. }
  57045. continue;
  57046. }
  57047. if (!child[_xfa_object.$isBindable]()) {
  57048. continue;
  57049. }
  57050. let global = false;
  57051. let picture = null;
  57052. let ref = null;
  57053. let match = null;
  57054. if (child.bind) {
  57055. switch (child.bind.match) {
  57056. case "none":
  57057. this._setAndBind(child, dataNode);
  57058. continue;
  57059. case "global":
  57060. global = true;
  57061. break;
  57062. case "dataRef":
  57063. if (!child.bind.ref) {
  57064. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  57065. this._setAndBind(child, dataNode);
  57066. continue;
  57067. }
  57068. ref = child.bind.ref;
  57069. break;
  57070. default:
  57071. break;
  57072. }
  57073. if (child.bind.picture) {
  57074. picture = child.bind.picture[_xfa_object.$content];
  57075. }
  57076. }
  57077. const [min, max] = this._getOccurInfo(child);
  57078. if (ref) {
  57079. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  57080. if (match === null) {
  57081. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  57082. if (!match) {
  57083. continue;
  57084. }
  57085. if (this._isConsumeData()) {
  57086. match[_xfa_object.$consumed] = true;
  57087. }
  57088. this._setAndBind(child, match);
  57089. continue;
  57090. } else {
  57091. if (this._isConsumeData()) {
  57092. match = match.filter(node => !node[_xfa_object.$consumed]);
  57093. }
  57094. if (match.length > max) {
  57095. match = match.slice(0, max);
  57096. } else if (match.length === 0) {
  57097. match = null;
  57098. }
  57099. if (match && this._isConsumeData()) {
  57100. match.forEach(node => {
  57101. node[_xfa_object.$consumed] = true;
  57102. });
  57103. }
  57104. }
  57105. } else {
  57106. if (!child.name) {
  57107. this._setAndBind(child, dataNode);
  57108. continue;
  57109. }
  57110. if (this._isConsumeData()) {
  57111. const matches = [];
  57112. while (matches.length < max) {
  57113. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  57114. if (!found) {
  57115. break;
  57116. }
  57117. found[_xfa_object.$consumed] = true;
  57118. matches.push(found);
  57119. }
  57120. match = matches.length > 0 ? matches : null;
  57121. } else {
  57122. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  57123. if (!match) {
  57124. if (min === 0) {
  57125. uselessNodes.push(child);
  57126. continue;
  57127. }
  57128. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  57129. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  57130. if (this.emptyMerge) {
  57131. match[_xfa_object.$consumed] = true;
  57132. }
  57133. dataNode[_xfa_object.$appendChild](match);
  57134. this._setAndBind(child, match);
  57135. continue;
  57136. }
  57137. if (this.emptyMerge) {
  57138. match[_xfa_object.$consumed] = true;
  57139. }
  57140. match = [match];
  57141. }
  57142. }
  57143. if (match) {
  57144. this._bindOccurrences(child, match, picture);
  57145. } else if (min > 0) {
  57146. this._setAndBind(child, dataNode);
  57147. } else {
  57148. uselessNodes.push(child);
  57149. }
  57150. }
  57151. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  57152. }
  57153. }
  57154. exports.Binder = Binder;
  57155. /***/ }),
  57156. /* 211 */
  57157. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57158. "use strict";
  57159. Object.defineProperty(exports, "__esModule", ({
  57160. value: true
  57161. }));
  57162. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  57163. var _xfa_object = __w_pdfjs_require__(206);
  57164. var _namespaces = __w_pdfjs_require__(208);
  57165. var _layout = __w_pdfjs_require__(212);
  57166. var _html_utils = __w_pdfjs_require__(213);
  57167. var _utils = __w_pdfjs_require__(207);
  57168. var _util = __w_pdfjs_require__(2);
  57169. var _fonts = __w_pdfjs_require__(214);
  57170. var _core_utils = __w_pdfjs_require__(135);
  57171. var _som = __w_pdfjs_require__(209);
  57172. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  57173. const SVG_NS = "http://www.w3.org/2000/svg";
  57174. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  57175. const MAX_EMPTY_PAGES = 3;
  57176. const DEFAULT_TAB_INDEX = 5000;
  57177. const HEADING_PATTERN = /^H(\d+)$/;
  57178. 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"]);
  57179. 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"]];
  57180. function getBorderDims(node) {
  57181. if (!node || !node.border) {
  57182. return {
  57183. w: 0,
  57184. h: 0
  57185. };
  57186. }
  57187. const borderExtra = node.border[_xfa_object.$getExtra]();
  57188. if (!borderExtra) {
  57189. return {
  57190. w: 0,
  57191. h: 0
  57192. };
  57193. }
  57194. return {
  57195. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  57196. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  57197. };
  57198. }
  57199. function hasMargin(node) {
  57200. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  57201. }
  57202. function _setValue(templateNode, value) {
  57203. if (!templateNode.value) {
  57204. const nodeValue = new Value({});
  57205. templateNode[_xfa_object.$appendChild](nodeValue);
  57206. templateNode.value = nodeValue;
  57207. }
  57208. templateNode.value[_xfa_object.$setValue](value);
  57209. }
  57210. function* getContainedChildren(node) {
  57211. for (const child of node[_xfa_object.$getChildren]()) {
  57212. if (child instanceof SubformSet) {
  57213. yield* child[_xfa_object.$getContainedChildren]();
  57214. continue;
  57215. }
  57216. yield child;
  57217. }
  57218. }
  57219. function isRequired(node) {
  57220. return node.validate && node.validate.nullTest === "error";
  57221. }
  57222. function setTabIndex(node) {
  57223. while (node) {
  57224. if (!node.traversal) {
  57225. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  57226. return;
  57227. }
  57228. if (node[_xfa_object.$tabIndex]) {
  57229. return;
  57230. }
  57231. let next = null;
  57232. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  57233. if (child.operation === "next") {
  57234. next = child;
  57235. break;
  57236. }
  57237. }
  57238. if (!next || !next.ref) {
  57239. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  57240. return;
  57241. }
  57242. const root = node[_xfa_object.$getTemplateRoot]();
  57243. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  57244. const ref = root[_xfa_object.$searchNode](next.ref, node);
  57245. if (!ref) {
  57246. return;
  57247. }
  57248. node = ref[0];
  57249. }
  57250. }
  57251. function applyAssist(obj, attributes) {
  57252. const assist = obj.assist;
  57253. if (assist) {
  57254. const assistTitle = assist[_xfa_object.$toHTML]();
  57255. if (assistTitle) {
  57256. attributes.title = assistTitle;
  57257. }
  57258. const role = assist.role;
  57259. const match = role.match(HEADING_PATTERN);
  57260. if (match) {
  57261. const ariaRole = "heading";
  57262. const ariaLevel = match[1];
  57263. attributes.role = ariaRole;
  57264. attributes["aria-level"] = ariaLevel;
  57265. }
  57266. }
  57267. if (obj.layout === "table") {
  57268. attributes.role = "table";
  57269. } else if (obj.layout === "row") {
  57270. attributes.role = "row";
  57271. } else {
  57272. const parent = obj[_xfa_object.$getParent]();
  57273. if (parent.layout === "row") {
  57274. if (parent.assist && parent.assist.role === "TH") {
  57275. attributes.role = "columnheader";
  57276. } else {
  57277. attributes.role = "cell";
  57278. }
  57279. }
  57280. }
  57281. }
  57282. function ariaLabel(obj) {
  57283. if (!obj.assist) {
  57284. return null;
  57285. }
  57286. const assist = obj.assist;
  57287. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  57288. return assist.speak[_xfa_object.$content];
  57289. }
  57290. if (assist.toolTip) {
  57291. return assist.toolTip[_xfa_object.$content];
  57292. }
  57293. return null;
  57294. }
  57295. function valueToHtml(value) {
  57296. return _utils.HTMLResult.success({
  57297. name: "div",
  57298. attributes: {
  57299. class: ["xfaRich"],
  57300. style: Object.create(null)
  57301. },
  57302. children: [{
  57303. name: "span",
  57304. attributes: {
  57305. style: Object.create(null)
  57306. },
  57307. value
  57308. }]
  57309. });
  57310. }
  57311. function setFirstUnsplittable(node) {
  57312. const root = node[_xfa_object.$getTemplateRoot]();
  57313. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  57314. root[_xfa_object.$extra].firstUnsplittable = node;
  57315. root[_xfa_object.$extra].noLayoutFailure = true;
  57316. }
  57317. }
  57318. function unsetFirstUnsplittable(node) {
  57319. const root = node[_xfa_object.$getTemplateRoot]();
  57320. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  57321. root[_xfa_object.$extra].noLayoutFailure = false;
  57322. }
  57323. }
  57324. function handleBreak(node) {
  57325. if (node[_xfa_object.$extra]) {
  57326. return false;
  57327. }
  57328. node[_xfa_object.$extra] = Object.create(null);
  57329. if (node.targetType === "auto") {
  57330. return false;
  57331. }
  57332. const root = node[_xfa_object.$getTemplateRoot]();
  57333. let target = null;
  57334. if (node.target) {
  57335. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  57336. if (!target) {
  57337. return false;
  57338. }
  57339. target = target[0];
  57340. }
  57341. const {
  57342. currentPageArea,
  57343. currentContentArea
  57344. } = root[_xfa_object.$extra];
  57345. if (node.targetType === "pageArea") {
  57346. if (!(target instanceof PageArea)) {
  57347. target = null;
  57348. }
  57349. if (node.startNew) {
  57350. node[_xfa_object.$extra].target = target || currentPageArea;
  57351. return true;
  57352. } else if (target && target !== currentPageArea) {
  57353. node[_xfa_object.$extra].target = target;
  57354. return true;
  57355. }
  57356. return false;
  57357. }
  57358. if (!(target instanceof ContentArea)) {
  57359. target = null;
  57360. }
  57361. const pageArea = target && target[_xfa_object.$getParent]();
  57362. let index;
  57363. let nextPageArea = pageArea;
  57364. if (node.startNew) {
  57365. if (target) {
  57366. const contentAreas = pageArea.contentArea.children;
  57367. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  57368. const indexForTarget = contentAreas.indexOf(target);
  57369. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  57370. nextPageArea = null;
  57371. }
  57372. index = indexForTarget - 1;
  57373. } else {
  57374. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  57375. }
  57376. } else if (target && target !== currentContentArea) {
  57377. const contentAreas = pageArea.contentArea.children;
  57378. index = contentAreas.indexOf(target) - 1;
  57379. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  57380. } else {
  57381. return false;
  57382. }
  57383. node[_xfa_object.$extra].target = nextPageArea;
  57384. node[_xfa_object.$extra].index = index;
  57385. return true;
  57386. }
  57387. function handleOverflow(node, extraNode, space) {
  57388. const root = node[_xfa_object.$getTemplateRoot]();
  57389. const saved = root[_xfa_object.$extra].noLayoutFailure;
  57390. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  57391. extraNode[_xfa_object.$getSubformParent] = () => node;
  57392. root[_xfa_object.$extra].noLayoutFailure = true;
  57393. const res = extraNode[_xfa_object.$toHTML](space);
  57394. node[_xfa_object.$addHTML](res.html, res.bbox);
  57395. root[_xfa_object.$extra].noLayoutFailure = saved;
  57396. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  57397. }
  57398. class AppearanceFilter extends _xfa_object.StringObject {
  57399. constructor(attributes) {
  57400. super(TEMPLATE_NS_ID, "appearanceFilter");
  57401. this.id = attributes.id || "";
  57402. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57403. this.use = attributes.use || "";
  57404. this.usehref = attributes.usehref || "";
  57405. }
  57406. }
  57407. class Arc extends _xfa_object.XFAObject {
  57408. constructor(attributes) {
  57409. super(TEMPLATE_NS_ID, "arc", true);
  57410. this.circular = (0, _utils.getInteger)({
  57411. data: attributes.circular,
  57412. defaultValue: 0,
  57413. validate: x => x === 1
  57414. });
  57415. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57416. this.id = attributes.id || "";
  57417. this.startAngle = (0, _utils.getFloat)({
  57418. data: attributes.startAngle,
  57419. defaultValue: 0,
  57420. validate: x => true
  57421. });
  57422. this.sweepAngle = (0, _utils.getFloat)({
  57423. data: attributes.sweepAngle,
  57424. defaultValue: 360,
  57425. validate: x => true
  57426. });
  57427. this.use = attributes.use || "";
  57428. this.usehref = attributes.usehref || "";
  57429. this.edge = null;
  57430. this.fill = null;
  57431. }
  57432. [_xfa_object.$toHTML]() {
  57433. const edge = this.edge || new Edge({});
  57434. const edgeStyle = edge[_xfa_object.$toStyle]();
  57435. const style = Object.create(null);
  57436. if (this.fill && this.fill.presence === "visible") {
  57437. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57438. } else {
  57439. style.fill = "transparent";
  57440. }
  57441. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  57442. style.stroke = edgeStyle.color;
  57443. let arc;
  57444. const attributes = {
  57445. xmlns: SVG_NS,
  57446. style: {
  57447. width: "100%",
  57448. height: "100%",
  57449. overflow: "visible"
  57450. }
  57451. };
  57452. if (this.sweepAngle === 360) {
  57453. arc = {
  57454. name: "ellipse",
  57455. attributes: {
  57456. xmlns: SVG_NS,
  57457. cx: "50%",
  57458. cy: "50%",
  57459. rx: "50%",
  57460. ry: "50%",
  57461. style
  57462. }
  57463. };
  57464. } else {
  57465. const startAngle = this.startAngle * Math.PI / 180;
  57466. const sweepAngle = this.sweepAngle * Math.PI / 180;
  57467. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  57468. 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))];
  57469. arc = {
  57470. name: "path",
  57471. attributes: {
  57472. xmlns: SVG_NS,
  57473. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  57474. vectorEffect: "non-scaling-stroke",
  57475. style
  57476. }
  57477. };
  57478. Object.assign(attributes, {
  57479. viewBox: "0 0 100 100",
  57480. preserveAspectRatio: "none"
  57481. });
  57482. }
  57483. const svg = {
  57484. name: "svg",
  57485. children: [arc],
  57486. attributes
  57487. };
  57488. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57489. if (hasMargin(parent)) {
  57490. return _utils.HTMLResult.success({
  57491. name: "div",
  57492. attributes: {
  57493. style: {
  57494. display: "inline",
  57495. width: "100%",
  57496. height: "100%"
  57497. }
  57498. },
  57499. children: [svg]
  57500. });
  57501. }
  57502. svg.attributes.style.position = "absolute";
  57503. return _utils.HTMLResult.success(svg);
  57504. }
  57505. }
  57506. class Area extends _xfa_object.XFAObject {
  57507. constructor(attributes) {
  57508. super(TEMPLATE_NS_ID, "area", true);
  57509. this.colSpan = (0, _utils.getInteger)({
  57510. data: attributes.colSpan,
  57511. defaultValue: 1,
  57512. validate: n => n >= 1 || n === -1
  57513. });
  57514. this.id = attributes.id || "";
  57515. this.name = attributes.name || "";
  57516. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57517. this.use = attributes.use || "";
  57518. this.usehref = attributes.usehref || "";
  57519. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57520. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57521. this.desc = null;
  57522. this.extras = null;
  57523. this.area = new _xfa_object.XFAObjectArray();
  57524. this.draw = new _xfa_object.XFAObjectArray();
  57525. this.exObject = new _xfa_object.XFAObjectArray();
  57526. this.exclGroup = new _xfa_object.XFAObjectArray();
  57527. this.field = new _xfa_object.XFAObjectArray();
  57528. this.subform = new _xfa_object.XFAObjectArray();
  57529. this.subformSet = new _xfa_object.XFAObjectArray();
  57530. }
  57531. *[_xfa_object.$getContainedChildren]() {
  57532. yield* getContainedChildren(this);
  57533. }
  57534. [_xfa_object.$isTransparent]() {
  57535. return true;
  57536. }
  57537. [_xfa_object.$isBindable]() {
  57538. return true;
  57539. }
  57540. [_xfa_object.$addHTML](html, bbox) {
  57541. const [x, y, w, h] = bbox;
  57542. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  57543. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  57544. this[_xfa_object.$extra].children.push(html);
  57545. }
  57546. [_xfa_object.$getAvailableSpace]() {
  57547. return this[_xfa_object.$extra].availableSpace;
  57548. }
  57549. [_xfa_object.$toHTML](availableSpace) {
  57550. const style = (0, _html_utils.toStyle)(this, "position");
  57551. const attributes = {
  57552. style,
  57553. id: this[_xfa_object.$uid],
  57554. class: ["xfaArea"]
  57555. };
  57556. if ((0, _html_utils.isPrintOnly)(this)) {
  57557. attributes.class.push("xfaPrintOnly");
  57558. }
  57559. if (this.name) {
  57560. attributes.xfaName = this.name;
  57561. }
  57562. const children = [];
  57563. this[_xfa_object.$extra] = {
  57564. children,
  57565. width: 0,
  57566. height: 0,
  57567. availableSpace
  57568. };
  57569. const result = this[_xfa_object.$childrenToHTML]({
  57570. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  57571. include: true
  57572. });
  57573. if (!result.success) {
  57574. if (result.isBreak()) {
  57575. return result;
  57576. }
  57577. delete this[_xfa_object.$extra];
  57578. return _utils.HTMLResult.FAILURE;
  57579. }
  57580. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  57581. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  57582. const html = {
  57583. name: "div",
  57584. attributes,
  57585. children
  57586. };
  57587. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  57588. delete this[_xfa_object.$extra];
  57589. return _utils.HTMLResult.success(html, bbox);
  57590. }
  57591. }
  57592. class Assist extends _xfa_object.XFAObject {
  57593. constructor(attributes) {
  57594. super(TEMPLATE_NS_ID, "assist", true);
  57595. this.id = attributes.id || "";
  57596. this.role = attributes.role || "";
  57597. this.use = attributes.use || "";
  57598. this.usehref = attributes.usehref || "";
  57599. this.speak = null;
  57600. this.toolTip = null;
  57601. }
  57602. [_xfa_object.$toHTML]() {
  57603. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  57604. }
  57605. }
  57606. class Barcode extends _xfa_object.XFAObject {
  57607. constructor(attributes) {
  57608. super(TEMPLATE_NS_ID, "barcode", true);
  57609. this.charEncoding = (0, _utils.getKeyword)({
  57610. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  57611. defaultValue: "",
  57612. 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}/)
  57613. });
  57614. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  57615. this.dataColumnCount = (0, _utils.getInteger)({
  57616. data: attributes.dataColumnCount,
  57617. defaultValue: -1,
  57618. validate: x => x >= 0
  57619. });
  57620. this.dataLength = (0, _utils.getInteger)({
  57621. data: attributes.dataLength,
  57622. defaultValue: -1,
  57623. validate: x => x >= 0
  57624. });
  57625. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  57626. this.dataRowCount = (0, _utils.getInteger)({
  57627. data: attributes.dataRowCount,
  57628. defaultValue: -1,
  57629. validate: x => x >= 0
  57630. });
  57631. this.endChar = attributes.endChar || "";
  57632. this.errorCorrectionLevel = (0, _utils.getInteger)({
  57633. data: attributes.errorCorrectionLevel,
  57634. defaultValue: -1,
  57635. validate: x => x >= 0 && x <= 8
  57636. });
  57637. this.id = attributes.id || "";
  57638. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  57639. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  57640. this.printCheckDigit = (0, _utils.getInteger)({
  57641. data: attributes.printCheckDigit,
  57642. defaultValue: 0,
  57643. validate: x => x === 1
  57644. });
  57645. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  57646. this.startChar = attributes.startChar || "";
  57647. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  57648. this.truncate = (0, _utils.getInteger)({
  57649. data: attributes.truncate,
  57650. defaultValue: 0,
  57651. validate: x => x === 1
  57652. });
  57653. 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"]);
  57654. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  57655. this.use = attributes.use || "";
  57656. this.usehref = attributes.usehref || "";
  57657. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  57658. this.encrypt = null;
  57659. this.extras = null;
  57660. }
  57661. }
  57662. class Bind extends _xfa_object.XFAObject {
  57663. constructor(attributes) {
  57664. super(TEMPLATE_NS_ID, "bind", true);
  57665. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  57666. this.ref = attributes.ref || "";
  57667. this.picture = null;
  57668. }
  57669. }
  57670. class BindItems extends _xfa_object.XFAObject {
  57671. constructor(attributes) {
  57672. super(TEMPLATE_NS_ID, "bindItems");
  57673. this.connection = attributes.connection || "";
  57674. this.labelRef = attributes.labelRef || "";
  57675. this.ref = attributes.ref || "";
  57676. this.valueRef = attributes.valueRef || "";
  57677. }
  57678. }
  57679. exports.BindItems = BindItems;
  57680. class Bookend extends _xfa_object.XFAObject {
  57681. constructor(attributes) {
  57682. super(TEMPLATE_NS_ID, "bookend");
  57683. this.id = attributes.id || "";
  57684. this.leader = attributes.leader || "";
  57685. this.trailer = attributes.trailer || "";
  57686. this.use = attributes.use || "";
  57687. this.usehref = attributes.usehref || "";
  57688. }
  57689. }
  57690. class BooleanElement extends _xfa_object.Option01 {
  57691. constructor(attributes) {
  57692. super(TEMPLATE_NS_ID, "boolean");
  57693. this.id = attributes.id || "";
  57694. this.name = attributes.name || "";
  57695. this.use = attributes.use || "";
  57696. this.usehref = attributes.usehref || "";
  57697. }
  57698. [_xfa_object.$toHTML](availableSpace) {
  57699. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  57700. }
  57701. }
  57702. class Border extends _xfa_object.XFAObject {
  57703. constructor(attributes) {
  57704. super(TEMPLATE_NS_ID, "border", true);
  57705. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  57706. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57707. this.id = attributes.id || "";
  57708. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57709. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57710. this.use = attributes.use || "";
  57711. this.usehref = attributes.usehref || "";
  57712. this.corner = new _xfa_object.XFAObjectArray(4);
  57713. this.edge = new _xfa_object.XFAObjectArray(4);
  57714. this.extras = null;
  57715. this.fill = null;
  57716. this.margin = null;
  57717. }
  57718. [_xfa_object.$getExtra]() {
  57719. if (!this[_xfa_object.$extra]) {
  57720. const edges = this.edge.children.slice();
  57721. if (edges.length < 4) {
  57722. const defaultEdge = edges.at(-1) || new Edge({});
  57723. for (let i = edges.length; i < 4; i++) {
  57724. edges.push(defaultEdge);
  57725. }
  57726. }
  57727. const widths = edges.map(edge => edge.thickness);
  57728. const insets = [0, 0, 0, 0];
  57729. if (this.margin) {
  57730. insets[0] = this.margin.topInset;
  57731. insets[1] = this.margin.rightInset;
  57732. insets[2] = this.margin.bottomInset;
  57733. insets[3] = this.margin.leftInset;
  57734. }
  57735. this[_xfa_object.$extra] = {
  57736. widths,
  57737. insets,
  57738. edges
  57739. };
  57740. }
  57741. return this[_xfa_object.$extra];
  57742. }
  57743. [_xfa_object.$toStyle]() {
  57744. const {
  57745. edges
  57746. } = this[_xfa_object.$getExtra]();
  57747. const edgeStyles = edges.map(node => {
  57748. const style = node[_xfa_object.$toStyle]();
  57749. style.color = style.color || "#000000";
  57750. return style;
  57751. });
  57752. const style = Object.create(null);
  57753. if (this.margin) {
  57754. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  57755. }
  57756. if (this.fill && this.fill.presence === "visible") {
  57757. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57758. }
  57759. if (this.corner.children.some(node => node.radius !== 0)) {
  57760. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  57761. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  57762. const last = cornerStyles.at(-1);
  57763. for (let i = cornerStyles.length; i < 4; i++) {
  57764. cornerStyles.push(last);
  57765. }
  57766. }
  57767. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  57768. }
  57769. switch (this.presence) {
  57770. case "invisible":
  57771. case "hidden":
  57772. style.borderStyle = "";
  57773. break;
  57774. case "inactive":
  57775. style.borderStyle = "none";
  57776. break;
  57777. default:
  57778. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  57779. break;
  57780. }
  57781. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  57782. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  57783. return style;
  57784. }
  57785. }
  57786. class Break extends _xfa_object.XFAObject {
  57787. constructor(attributes) {
  57788. super(TEMPLATE_NS_ID, "break", true);
  57789. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57790. this.afterTarget = attributes.afterTarget || "";
  57791. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57792. this.beforeTarget = attributes.beforeTarget || "";
  57793. this.bookendLeader = attributes.bookendLeader || "";
  57794. this.bookendTrailer = attributes.bookendTrailer || "";
  57795. this.id = attributes.id || "";
  57796. this.overflowLeader = attributes.overflowLeader || "";
  57797. this.overflowTarget = attributes.overflowTarget || "";
  57798. this.overflowTrailer = attributes.overflowTrailer || "";
  57799. this.startNew = (0, _utils.getInteger)({
  57800. data: attributes.startNew,
  57801. defaultValue: 0,
  57802. validate: x => x === 1
  57803. });
  57804. this.use = attributes.use || "";
  57805. this.usehref = attributes.usehref || "";
  57806. this.extras = null;
  57807. }
  57808. }
  57809. class BreakAfter extends _xfa_object.XFAObject {
  57810. constructor(attributes) {
  57811. super(TEMPLATE_NS_ID, "breakAfter", true);
  57812. this.id = attributes.id || "";
  57813. this.leader = attributes.leader || "";
  57814. this.startNew = (0, _utils.getInteger)({
  57815. data: attributes.startNew,
  57816. defaultValue: 0,
  57817. validate: x => x === 1
  57818. });
  57819. this.target = attributes.target || "";
  57820. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57821. this.trailer = attributes.trailer || "";
  57822. this.use = attributes.use || "";
  57823. this.usehref = attributes.usehref || "";
  57824. this.script = null;
  57825. }
  57826. }
  57827. class BreakBefore extends _xfa_object.XFAObject {
  57828. constructor(attributes) {
  57829. super(TEMPLATE_NS_ID, "breakBefore", true);
  57830. this.id = attributes.id || "";
  57831. this.leader = attributes.leader || "";
  57832. this.startNew = (0, _utils.getInteger)({
  57833. data: attributes.startNew,
  57834. defaultValue: 0,
  57835. validate: x => x === 1
  57836. });
  57837. this.target = attributes.target || "";
  57838. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57839. this.trailer = attributes.trailer || "";
  57840. this.use = attributes.use || "";
  57841. this.usehref = attributes.usehref || "";
  57842. this.script = null;
  57843. }
  57844. [_xfa_object.$toHTML](availableSpace) {
  57845. this[_xfa_object.$extra] = {};
  57846. return _utils.HTMLResult.FAILURE;
  57847. }
  57848. }
  57849. class Button extends _xfa_object.XFAObject {
  57850. constructor(attributes) {
  57851. super(TEMPLATE_NS_ID, "button", true);
  57852. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  57853. this.id = attributes.id || "";
  57854. this.use = attributes.use || "";
  57855. this.usehref = attributes.usehref || "";
  57856. this.extras = null;
  57857. }
  57858. [_xfa_object.$toHTML](availableSpace) {
  57859. const parent = this[_xfa_object.$getParent]();
  57860. const grandpa = parent[_xfa_object.$getParent]();
  57861. const htmlButton = {
  57862. name: "button",
  57863. attributes: {
  57864. id: this[_xfa_object.$uid],
  57865. class: ["xfaButton"],
  57866. style: {}
  57867. },
  57868. children: []
  57869. };
  57870. for (const event of grandpa.event.children) {
  57871. if (event.activity !== "click" || !event.script) {
  57872. continue;
  57873. }
  57874. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  57875. if (!jsURL) {
  57876. continue;
  57877. }
  57878. const href = (0, _html_utils.fixURL)(jsURL.url);
  57879. if (!href) {
  57880. continue;
  57881. }
  57882. htmlButton.children.push({
  57883. name: "a",
  57884. attributes: {
  57885. id: "link" + this[_xfa_object.$uid],
  57886. href,
  57887. newWindow: jsURL.newWindow,
  57888. class: ["xfaLink"],
  57889. style: {}
  57890. },
  57891. children: []
  57892. });
  57893. }
  57894. return _utils.HTMLResult.success(htmlButton);
  57895. }
  57896. }
  57897. class Calculate extends _xfa_object.XFAObject {
  57898. constructor(attributes) {
  57899. super(TEMPLATE_NS_ID, "calculate", true);
  57900. this.id = attributes.id || "";
  57901. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  57902. this.use = attributes.use || "";
  57903. this.usehref = attributes.usehref || "";
  57904. this.extras = null;
  57905. this.message = null;
  57906. this.script = null;
  57907. }
  57908. }
  57909. class Caption extends _xfa_object.XFAObject {
  57910. constructor(attributes) {
  57911. super(TEMPLATE_NS_ID, "caption", true);
  57912. this.id = attributes.id || "";
  57913. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  57914. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57915. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  57916. this.use = attributes.use || "";
  57917. this.usehref = attributes.usehref || "";
  57918. this.extras = null;
  57919. this.font = null;
  57920. this.margin = null;
  57921. this.para = null;
  57922. this.value = null;
  57923. }
  57924. [_xfa_object.$setValue](value) {
  57925. _setValue(this, value);
  57926. }
  57927. [_xfa_object.$getExtra](availableSpace) {
  57928. if (!this[_xfa_object.$extra]) {
  57929. let {
  57930. width,
  57931. height
  57932. } = availableSpace;
  57933. switch (this.placement) {
  57934. case "left":
  57935. case "right":
  57936. case "inline":
  57937. width = this.reserve <= 0 ? width : this.reserve;
  57938. break;
  57939. case "top":
  57940. case "bottom":
  57941. height = this.reserve <= 0 ? height : this.reserve;
  57942. break;
  57943. }
  57944. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  57945. width,
  57946. height
  57947. });
  57948. }
  57949. return this[_xfa_object.$extra];
  57950. }
  57951. [_xfa_object.$toHTML](availableSpace) {
  57952. if (!this.value) {
  57953. return _utils.HTMLResult.EMPTY;
  57954. }
  57955. this[_xfa_object.$pushPara]();
  57956. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  57957. if (!value) {
  57958. this[_xfa_object.$popPara]();
  57959. return _utils.HTMLResult.EMPTY;
  57960. }
  57961. const savedReserve = this.reserve;
  57962. if (this.reserve <= 0) {
  57963. const {
  57964. w,
  57965. h
  57966. } = this[_xfa_object.$getExtra](availableSpace);
  57967. switch (this.placement) {
  57968. case "left":
  57969. case "right":
  57970. case "inline":
  57971. this.reserve = w;
  57972. break;
  57973. case "top":
  57974. case "bottom":
  57975. this.reserve = h;
  57976. break;
  57977. }
  57978. }
  57979. const children = [];
  57980. if (typeof value === "string") {
  57981. children.push({
  57982. name: "#text",
  57983. value
  57984. });
  57985. } else {
  57986. children.push(value);
  57987. }
  57988. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  57989. switch (this.placement) {
  57990. case "left":
  57991. case "right":
  57992. if (this.reserve > 0) {
  57993. style.width = (0, _html_utils.measureToString)(this.reserve);
  57994. }
  57995. break;
  57996. case "top":
  57997. case "bottom":
  57998. if (this.reserve > 0) {
  57999. style.height = (0, _html_utils.measureToString)(this.reserve);
  58000. }
  58001. break;
  58002. }
  58003. (0, _html_utils.setPara)(this, null, value);
  58004. this[_xfa_object.$popPara]();
  58005. this.reserve = savedReserve;
  58006. return _utils.HTMLResult.success({
  58007. name: "div",
  58008. attributes: {
  58009. style,
  58010. class: ["xfaCaption"]
  58011. },
  58012. children
  58013. });
  58014. }
  58015. }
  58016. class Certificate extends _xfa_object.StringObject {
  58017. constructor(attributes) {
  58018. super(TEMPLATE_NS_ID, "certificate");
  58019. this.id = attributes.id || "";
  58020. this.name = attributes.name || "";
  58021. this.use = attributes.use || "";
  58022. this.usehref = attributes.usehref || "";
  58023. }
  58024. }
  58025. class Certificates extends _xfa_object.XFAObject {
  58026. constructor(attributes) {
  58027. super(TEMPLATE_NS_ID, "certificates", true);
  58028. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  58029. this.id = attributes.id || "";
  58030. this.url = attributes.url || "";
  58031. this.urlPolicy = attributes.urlPolicy || "";
  58032. this.use = attributes.use || "";
  58033. this.usehref = attributes.usehref || "";
  58034. this.encryption = null;
  58035. this.issuers = null;
  58036. this.keyUsage = null;
  58037. this.oids = null;
  58038. this.signing = null;
  58039. this.subjectDNs = null;
  58040. }
  58041. }
  58042. class CheckButton extends _xfa_object.XFAObject {
  58043. constructor(attributes) {
  58044. super(TEMPLATE_NS_ID, "checkButton", true);
  58045. this.id = attributes.id || "";
  58046. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  58047. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  58048. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  58049. this.use = attributes.use || "";
  58050. this.usehref = attributes.usehref || "";
  58051. this.border = null;
  58052. this.extras = null;
  58053. this.margin = null;
  58054. }
  58055. [_xfa_object.$toHTML](availableSpace) {
  58056. const style = (0, _html_utils.toStyle)("margin");
  58057. const size = (0, _html_utils.measureToString)(this.size);
  58058. style.width = style.height = size;
  58059. let type;
  58060. let className;
  58061. let groupId;
  58062. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  58063. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  58064. const exportedValue = {
  58065. on: (items[0] !== undefined ? items[0] : "on").toString(),
  58066. off: (items[1] !== undefined ? items[1] : "off").toString()
  58067. };
  58068. const value = field.value && field.value[_xfa_object.$text]() || "off";
  58069. const checked = value === exportedValue.on || undefined;
  58070. const container = field[_xfa_object.$getSubformParent]();
  58071. const fieldId = field[_xfa_object.$uid];
  58072. let dataId;
  58073. if (container instanceof ExclGroup) {
  58074. groupId = container[_xfa_object.$uid];
  58075. type = "radio";
  58076. className = "xfaRadio";
  58077. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  58078. } else {
  58079. type = "checkbox";
  58080. className = "xfaCheckbox";
  58081. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  58082. }
  58083. const input = {
  58084. name: "input",
  58085. attributes: {
  58086. class: [className],
  58087. style,
  58088. fieldId,
  58089. dataId,
  58090. type,
  58091. checked,
  58092. xfaOn: exportedValue.on,
  58093. xfaOff: exportedValue.off,
  58094. "aria-label": ariaLabel(field),
  58095. "aria-required": false
  58096. }
  58097. };
  58098. if (groupId) {
  58099. input.attributes.name = groupId;
  58100. }
  58101. if (isRequired(field)) {
  58102. input.attributes["aria-required"] = true;
  58103. input.attributes.required = true;
  58104. }
  58105. return _utils.HTMLResult.success({
  58106. name: "label",
  58107. attributes: {
  58108. class: ["xfaLabel"]
  58109. },
  58110. children: [input]
  58111. });
  58112. }
  58113. }
  58114. class ChoiceList extends _xfa_object.XFAObject {
  58115. constructor(attributes) {
  58116. super(TEMPLATE_NS_ID, "choiceList", true);
  58117. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  58118. this.id = attributes.id || "";
  58119. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  58120. this.textEntry = (0, _utils.getInteger)({
  58121. data: attributes.textEntry,
  58122. defaultValue: 0,
  58123. validate: x => x === 1
  58124. });
  58125. this.use = attributes.use || "";
  58126. this.usehref = attributes.usehref || "";
  58127. this.border = null;
  58128. this.extras = null;
  58129. this.margin = null;
  58130. }
  58131. [_xfa_object.$toHTML](availableSpace) {
  58132. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  58133. const ui = this[_xfa_object.$getParent]();
  58134. const field = ui[_xfa_object.$getParent]();
  58135. const fontSize = field.font && field.font.size || 10;
  58136. const optionStyle = {
  58137. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  58138. };
  58139. const children = [];
  58140. if (field.items.children.length > 0) {
  58141. const items = field.items;
  58142. let displayedIndex = 0;
  58143. let saveIndex = 0;
  58144. if (items.children.length === 2) {
  58145. displayedIndex = items.children[0].save;
  58146. saveIndex = 1 - displayedIndex;
  58147. }
  58148. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  58149. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  58150. let selected = false;
  58151. const value = field.value && field.value[_xfa_object.$text]() || "";
  58152. for (let i = 0, ii = displayed.length; i < ii; i++) {
  58153. const option = {
  58154. name: "option",
  58155. attributes: {
  58156. value: values[i] || displayed[i],
  58157. style: optionStyle
  58158. },
  58159. value: displayed[i]
  58160. };
  58161. if (values[i] === value) {
  58162. option.attributes.selected = selected = true;
  58163. }
  58164. children.push(option);
  58165. }
  58166. if (!selected) {
  58167. children.splice(0, 0, {
  58168. name: "option",
  58169. attributes: {
  58170. hidden: true,
  58171. selected: true
  58172. },
  58173. value: " "
  58174. });
  58175. }
  58176. }
  58177. const selectAttributes = {
  58178. class: ["xfaSelect"],
  58179. fieldId: field[_xfa_object.$uid],
  58180. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58181. style,
  58182. "aria-label": ariaLabel(field),
  58183. "aria-required": false
  58184. };
  58185. if (isRequired(field)) {
  58186. selectAttributes["aria-required"] = true;
  58187. selectAttributes.required = true;
  58188. }
  58189. if (this.open === "multiSelect") {
  58190. selectAttributes.multiple = true;
  58191. }
  58192. return _utils.HTMLResult.success({
  58193. name: "label",
  58194. attributes: {
  58195. class: ["xfaLabel"]
  58196. },
  58197. children: [{
  58198. name: "select",
  58199. children,
  58200. attributes: selectAttributes
  58201. }]
  58202. });
  58203. }
  58204. }
  58205. class Color extends _xfa_object.XFAObject {
  58206. constructor(attributes) {
  58207. super(TEMPLATE_NS_ID, "color", true);
  58208. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  58209. this.id = attributes.id || "";
  58210. this.use = attributes.use || "";
  58211. this.usehref = attributes.usehref || "";
  58212. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  58213. this.extras = null;
  58214. }
  58215. [_xfa_object.$hasSettableValue]() {
  58216. return false;
  58217. }
  58218. [_xfa_object.$toStyle]() {
  58219. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  58220. }
  58221. }
  58222. class Comb extends _xfa_object.XFAObject {
  58223. constructor(attributes) {
  58224. super(TEMPLATE_NS_ID, "comb");
  58225. this.id = attributes.id || "";
  58226. this.numberOfCells = (0, _utils.getInteger)({
  58227. data: attributes.numberOfCells,
  58228. defaultValue: 0,
  58229. validate: x => x >= 0
  58230. });
  58231. this.use = attributes.use || "";
  58232. this.usehref = attributes.usehref || "";
  58233. }
  58234. }
  58235. class Connect extends _xfa_object.XFAObject {
  58236. constructor(attributes) {
  58237. super(TEMPLATE_NS_ID, "connect", true);
  58238. this.connection = attributes.connection || "";
  58239. this.id = attributes.id || "";
  58240. this.ref = attributes.ref || "";
  58241. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  58242. this.use = attributes.use || "";
  58243. this.usehref = attributes.usehref || "";
  58244. this.picture = null;
  58245. }
  58246. }
  58247. class ContentArea extends _xfa_object.XFAObject {
  58248. constructor(attributes) {
  58249. super(TEMPLATE_NS_ID, "contentArea", true);
  58250. this.h = (0, _utils.getMeasurement)(attributes.h);
  58251. this.id = attributes.id || "";
  58252. this.name = attributes.name || "";
  58253. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58254. this.use = attributes.use || "";
  58255. this.usehref = attributes.usehref || "";
  58256. this.w = (0, _utils.getMeasurement)(attributes.w);
  58257. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58258. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58259. this.desc = null;
  58260. this.extras = null;
  58261. }
  58262. [_xfa_object.$toHTML](availableSpace) {
  58263. const left = (0, _html_utils.measureToString)(this.x);
  58264. const top = (0, _html_utils.measureToString)(this.y);
  58265. const style = {
  58266. left,
  58267. top,
  58268. width: (0, _html_utils.measureToString)(this.w),
  58269. height: (0, _html_utils.measureToString)(this.h)
  58270. };
  58271. const classNames = ["xfaContentarea"];
  58272. if ((0, _html_utils.isPrintOnly)(this)) {
  58273. classNames.push("xfaPrintOnly");
  58274. }
  58275. return _utils.HTMLResult.success({
  58276. name: "div",
  58277. children: [],
  58278. attributes: {
  58279. style,
  58280. class: classNames,
  58281. id: this[_xfa_object.$uid]
  58282. }
  58283. });
  58284. }
  58285. }
  58286. class Corner extends _xfa_object.XFAObject {
  58287. constructor(attributes) {
  58288. super(TEMPLATE_NS_ID, "corner", true);
  58289. this.id = attributes.id || "";
  58290. this.inverted = (0, _utils.getInteger)({
  58291. data: attributes.inverted,
  58292. defaultValue: 0,
  58293. validate: x => x === 1
  58294. });
  58295. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  58296. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58297. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  58298. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  58299. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  58300. this.use = attributes.use || "";
  58301. this.usehref = attributes.usehref || "";
  58302. this.color = null;
  58303. this.extras = null;
  58304. }
  58305. [_xfa_object.$toStyle]() {
  58306. const style = (0, _html_utils.toStyle)(this, "visibility");
  58307. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  58308. return style;
  58309. }
  58310. }
  58311. class DateElement extends _xfa_object.ContentObject {
  58312. constructor(attributes) {
  58313. super(TEMPLATE_NS_ID, "date");
  58314. this.id = attributes.id || "";
  58315. this.name = attributes.name || "";
  58316. this.use = attributes.use || "";
  58317. this.usehref = attributes.usehref || "";
  58318. }
  58319. [_xfa_object.$finalize]() {
  58320. const date = this[_xfa_object.$content].trim();
  58321. this[_xfa_object.$content] = date ? new Date(date) : null;
  58322. }
  58323. [_xfa_object.$toHTML](availableSpace) {
  58324. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  58325. }
  58326. }
  58327. class DateTime extends _xfa_object.ContentObject {
  58328. constructor(attributes) {
  58329. super(TEMPLATE_NS_ID, "dateTime");
  58330. this.id = attributes.id || "";
  58331. this.name = attributes.name || "";
  58332. this.use = attributes.use || "";
  58333. this.usehref = attributes.usehref || "";
  58334. }
  58335. [_xfa_object.$finalize]() {
  58336. const date = this[_xfa_object.$content].trim();
  58337. this[_xfa_object.$content] = date ? new Date(date) : null;
  58338. }
  58339. [_xfa_object.$toHTML](availableSpace) {
  58340. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  58341. }
  58342. }
  58343. class DateTimeEdit extends _xfa_object.XFAObject {
  58344. constructor(attributes) {
  58345. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  58346. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  58347. this.id = attributes.id || "";
  58348. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  58349. this.use = attributes.use || "";
  58350. this.usehref = attributes.usehref || "";
  58351. this.border = null;
  58352. this.comb = null;
  58353. this.extras = null;
  58354. this.margin = null;
  58355. }
  58356. [_xfa_object.$toHTML](availableSpace) {
  58357. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  58358. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  58359. const html = {
  58360. name: "input",
  58361. attributes: {
  58362. type: "text",
  58363. fieldId: field[_xfa_object.$uid],
  58364. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58365. class: ["xfaTextfield"],
  58366. style,
  58367. "aria-label": ariaLabel(field),
  58368. "aria-required": false
  58369. }
  58370. };
  58371. if (isRequired(field)) {
  58372. html.attributes["aria-required"] = true;
  58373. html.attributes.required = true;
  58374. }
  58375. return _utils.HTMLResult.success({
  58376. name: "label",
  58377. attributes: {
  58378. class: ["xfaLabel"]
  58379. },
  58380. children: [html]
  58381. });
  58382. }
  58383. }
  58384. class Decimal extends _xfa_object.ContentObject {
  58385. constructor(attributes) {
  58386. super(TEMPLATE_NS_ID, "decimal");
  58387. this.fracDigits = (0, _utils.getInteger)({
  58388. data: attributes.fracDigits,
  58389. defaultValue: 2,
  58390. validate: x => true
  58391. });
  58392. this.id = attributes.id || "";
  58393. this.leadDigits = (0, _utils.getInteger)({
  58394. data: attributes.leadDigits,
  58395. defaultValue: -1,
  58396. validate: x => true
  58397. });
  58398. this.name = attributes.name || "";
  58399. this.use = attributes.use || "";
  58400. this.usehref = attributes.usehref || "";
  58401. }
  58402. [_xfa_object.$finalize]() {
  58403. const number = parseFloat(this[_xfa_object.$content].trim());
  58404. this[_xfa_object.$content] = isNaN(number) ? null : number;
  58405. }
  58406. [_xfa_object.$toHTML](availableSpace) {
  58407. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  58408. }
  58409. }
  58410. class DefaultUi extends _xfa_object.XFAObject {
  58411. constructor(attributes) {
  58412. super(TEMPLATE_NS_ID, "defaultUi", true);
  58413. this.id = attributes.id || "";
  58414. this.use = attributes.use || "";
  58415. this.usehref = attributes.usehref || "";
  58416. this.extras = null;
  58417. }
  58418. }
  58419. class Desc extends _xfa_object.XFAObject {
  58420. constructor(attributes) {
  58421. super(TEMPLATE_NS_ID, "desc", true);
  58422. this.id = attributes.id || "";
  58423. this.use = attributes.use || "";
  58424. this.usehref = attributes.usehref || "";
  58425. this.boolean = new _xfa_object.XFAObjectArray();
  58426. this.date = new _xfa_object.XFAObjectArray();
  58427. this.dateTime = new _xfa_object.XFAObjectArray();
  58428. this.decimal = new _xfa_object.XFAObjectArray();
  58429. this.exData = new _xfa_object.XFAObjectArray();
  58430. this.float = new _xfa_object.XFAObjectArray();
  58431. this.image = new _xfa_object.XFAObjectArray();
  58432. this.integer = new _xfa_object.XFAObjectArray();
  58433. this.text = new _xfa_object.XFAObjectArray();
  58434. this.time = new _xfa_object.XFAObjectArray();
  58435. }
  58436. }
  58437. class DigestMethod extends _xfa_object.OptionObject {
  58438. constructor(attributes) {
  58439. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  58440. this.id = attributes.id || "";
  58441. this.use = attributes.use || "";
  58442. this.usehref = attributes.usehref || "";
  58443. }
  58444. }
  58445. class DigestMethods extends _xfa_object.XFAObject {
  58446. constructor(attributes) {
  58447. super(TEMPLATE_NS_ID, "digestMethods", true);
  58448. this.id = attributes.id || "";
  58449. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58450. this.use = attributes.use || "";
  58451. this.usehref = attributes.usehref || "";
  58452. this.digestMethod = new _xfa_object.XFAObjectArray();
  58453. }
  58454. }
  58455. class Draw extends _xfa_object.XFAObject {
  58456. constructor(attributes) {
  58457. super(TEMPLATE_NS_ID, "draw", true);
  58458. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58459. this.colSpan = (0, _utils.getInteger)({
  58460. data: attributes.colSpan,
  58461. defaultValue: 1,
  58462. validate: n => n >= 1 || n === -1
  58463. });
  58464. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58465. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58466. this.id = attributes.id || "";
  58467. this.locale = attributes.locale || "";
  58468. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58469. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58470. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58471. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58472. this.name = attributes.name || "";
  58473. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58474. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58475. this.rotate = (0, _utils.getInteger)({
  58476. data: attributes.rotate,
  58477. defaultValue: 0,
  58478. validate: x => x % 90 === 0
  58479. });
  58480. this.use = attributes.use || "";
  58481. this.usehref = attributes.usehref || "";
  58482. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58483. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58484. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58485. this.assist = null;
  58486. this.border = null;
  58487. this.caption = null;
  58488. this.desc = null;
  58489. this.extras = null;
  58490. this.font = null;
  58491. this.keep = null;
  58492. this.margin = null;
  58493. this.para = null;
  58494. this.traversal = null;
  58495. this.ui = null;
  58496. this.value = null;
  58497. this.setProperty = new _xfa_object.XFAObjectArray();
  58498. }
  58499. [_xfa_object.$setValue](value) {
  58500. _setValue(this, value);
  58501. }
  58502. [_xfa_object.$toHTML](availableSpace) {
  58503. setTabIndex(this);
  58504. if (this.presence === "hidden" || this.presence === "inactive") {
  58505. return _utils.HTMLResult.EMPTY;
  58506. }
  58507. (0, _html_utils.fixDimensions)(this);
  58508. this[_xfa_object.$pushPara]();
  58509. const savedW = this.w;
  58510. const savedH = this.h;
  58511. const {
  58512. w,
  58513. h,
  58514. isBroken
  58515. } = (0, _html_utils.layoutNode)(this, availableSpace);
  58516. if (w && this.w === "") {
  58517. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  58518. this[_xfa_object.$popPara]();
  58519. return _utils.HTMLResult.FAILURE;
  58520. }
  58521. this.w = w;
  58522. }
  58523. if (h && this.h === "") {
  58524. this.h = h;
  58525. }
  58526. setFirstUnsplittable(this);
  58527. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58528. this.w = savedW;
  58529. this.h = savedH;
  58530. this[_xfa_object.$popPara]();
  58531. return _utils.HTMLResult.FAILURE;
  58532. }
  58533. unsetFirstUnsplittable(this);
  58534. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  58535. (0, _html_utils.setMinMaxDimensions)(this, style);
  58536. if (style.margin) {
  58537. style.padding = style.margin;
  58538. delete style.margin;
  58539. }
  58540. const classNames = ["xfaDraw"];
  58541. if (this.font) {
  58542. classNames.push("xfaFont");
  58543. }
  58544. if ((0, _html_utils.isPrintOnly)(this)) {
  58545. classNames.push("xfaPrintOnly");
  58546. }
  58547. const attributes = {
  58548. style,
  58549. id: this[_xfa_object.$uid],
  58550. class: classNames
  58551. };
  58552. if (this.name) {
  58553. attributes.xfaName = this.name;
  58554. }
  58555. const html = {
  58556. name: "div",
  58557. attributes,
  58558. children: []
  58559. };
  58560. applyAssist(this, attributes);
  58561. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  58562. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  58563. if (value === null) {
  58564. this.w = savedW;
  58565. this.h = savedH;
  58566. this[_xfa_object.$popPara]();
  58567. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58568. }
  58569. html.children.push(value);
  58570. (0, _html_utils.setPara)(this, style, value);
  58571. this.w = savedW;
  58572. this.h = savedH;
  58573. this[_xfa_object.$popPara]();
  58574. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58575. }
  58576. }
  58577. class Edge extends _xfa_object.XFAObject {
  58578. constructor(attributes) {
  58579. super(TEMPLATE_NS_ID, "edge", true);
  58580. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  58581. this.id = attributes.id || "";
  58582. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58583. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  58584. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  58585. this.use = attributes.use || "";
  58586. this.usehref = attributes.usehref || "";
  58587. this.color = null;
  58588. this.extras = null;
  58589. }
  58590. [_xfa_object.$toStyle]() {
  58591. const style = (0, _html_utils.toStyle)(this, "visibility");
  58592. Object.assign(style, {
  58593. linecap: this.cap,
  58594. width: (0, _html_utils.measureToString)(this.thickness),
  58595. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  58596. style: ""
  58597. });
  58598. if (this.presence !== "visible") {
  58599. style.style = "none";
  58600. } else {
  58601. switch (this.stroke) {
  58602. case "solid":
  58603. style.style = "solid";
  58604. break;
  58605. case "dashDot":
  58606. style.style = "dashed";
  58607. break;
  58608. case "dashDotDot":
  58609. style.style = "dashed";
  58610. break;
  58611. case "dashed":
  58612. style.style = "dashed";
  58613. break;
  58614. case "dotted":
  58615. style.style = "dotted";
  58616. break;
  58617. case "embossed":
  58618. style.style = "ridge";
  58619. break;
  58620. case "etched":
  58621. style.style = "groove";
  58622. break;
  58623. case "lowered":
  58624. style.style = "inset";
  58625. break;
  58626. case "raised":
  58627. style.style = "outset";
  58628. break;
  58629. }
  58630. }
  58631. return style;
  58632. }
  58633. }
  58634. class Encoding extends _xfa_object.OptionObject {
  58635. constructor(attributes) {
  58636. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  58637. this.id = attributes.id || "";
  58638. this.use = attributes.use || "";
  58639. this.usehref = attributes.usehref || "";
  58640. }
  58641. }
  58642. class Encodings extends _xfa_object.XFAObject {
  58643. constructor(attributes) {
  58644. super(TEMPLATE_NS_ID, "encodings", true);
  58645. this.id = attributes.id || "";
  58646. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58647. this.use = attributes.use || "";
  58648. this.usehref = attributes.usehref || "";
  58649. this.encoding = new _xfa_object.XFAObjectArray();
  58650. }
  58651. }
  58652. class Encrypt extends _xfa_object.XFAObject {
  58653. constructor(attributes) {
  58654. super(TEMPLATE_NS_ID, "encrypt", true);
  58655. this.id = attributes.id || "";
  58656. this.use = attributes.use || "";
  58657. this.usehref = attributes.usehref || "";
  58658. this.certificate = null;
  58659. }
  58660. }
  58661. class EncryptData extends _xfa_object.XFAObject {
  58662. constructor(attributes) {
  58663. super(TEMPLATE_NS_ID, "encryptData", true);
  58664. this.id = attributes.id || "";
  58665. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  58666. this.target = attributes.target || "";
  58667. this.use = attributes.use || "";
  58668. this.usehref = attributes.usehref || "";
  58669. this.filter = null;
  58670. this.manifest = null;
  58671. }
  58672. }
  58673. class Encryption extends _xfa_object.XFAObject {
  58674. constructor(attributes) {
  58675. super(TEMPLATE_NS_ID, "encryption", true);
  58676. this.id = attributes.id || "";
  58677. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58678. this.use = attributes.use || "";
  58679. this.usehref = attributes.usehref || "";
  58680. this.certificate = new _xfa_object.XFAObjectArray();
  58681. }
  58682. }
  58683. class EncryptionMethod extends _xfa_object.OptionObject {
  58684. constructor(attributes) {
  58685. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  58686. this.id = attributes.id || "";
  58687. this.use = attributes.use || "";
  58688. this.usehref = attributes.usehref || "";
  58689. }
  58690. }
  58691. class EncryptionMethods extends _xfa_object.XFAObject {
  58692. constructor(attributes) {
  58693. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  58694. this.id = attributes.id || "";
  58695. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58696. this.use = attributes.use || "";
  58697. this.usehref = attributes.usehref || "";
  58698. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  58699. }
  58700. }
  58701. class Event extends _xfa_object.XFAObject {
  58702. constructor(attributes) {
  58703. super(TEMPLATE_NS_ID, "event", true);
  58704. 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"]);
  58705. this.id = attributes.id || "";
  58706. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  58707. this.name = attributes.name || "";
  58708. this.ref = attributes.ref || "";
  58709. this.use = attributes.use || "";
  58710. this.usehref = attributes.usehref || "";
  58711. this.extras = null;
  58712. this.encryptData = null;
  58713. this.execute = null;
  58714. this.script = null;
  58715. this.signData = null;
  58716. this.submit = null;
  58717. }
  58718. }
  58719. class ExData extends _xfa_object.ContentObject {
  58720. constructor(attributes) {
  58721. super(TEMPLATE_NS_ID, "exData");
  58722. this.contentType = attributes.contentType || "";
  58723. this.href = attributes.href || "";
  58724. this.id = attributes.id || "";
  58725. this.maxLength = (0, _utils.getInteger)({
  58726. data: attributes.maxLength,
  58727. defaultValue: -1,
  58728. validate: x => x >= -1
  58729. });
  58730. this.name = attributes.name || "";
  58731. this.rid = attributes.rid || "";
  58732. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  58733. this.use = attributes.use || "";
  58734. this.usehref = attributes.usehref || "";
  58735. }
  58736. [_xfa_object.$isCDATAXml]() {
  58737. return this.contentType === "text/html";
  58738. }
  58739. [_xfa_object.$onChild](child) {
  58740. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  58741. this[_xfa_object.$content] = child;
  58742. return true;
  58743. }
  58744. if (this.contentType === "text/xml") {
  58745. this[_xfa_object.$content] = child;
  58746. return true;
  58747. }
  58748. return false;
  58749. }
  58750. [_xfa_object.$toHTML](availableSpace) {
  58751. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  58752. return _utils.HTMLResult.EMPTY;
  58753. }
  58754. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  58755. }
  58756. }
  58757. class ExObject extends _xfa_object.XFAObject {
  58758. constructor(attributes) {
  58759. super(TEMPLATE_NS_ID, "exObject", true);
  58760. this.archive = attributes.archive || "";
  58761. this.classId = attributes.classId || "";
  58762. this.codeBase = attributes.codeBase || "";
  58763. this.codeType = attributes.codeType || "";
  58764. this.id = attributes.id || "";
  58765. this.name = attributes.name || "";
  58766. this.use = attributes.use || "";
  58767. this.usehref = attributes.usehref || "";
  58768. this.extras = null;
  58769. this.boolean = new _xfa_object.XFAObjectArray();
  58770. this.date = new _xfa_object.XFAObjectArray();
  58771. this.dateTime = new _xfa_object.XFAObjectArray();
  58772. this.decimal = new _xfa_object.XFAObjectArray();
  58773. this.exData = new _xfa_object.XFAObjectArray();
  58774. this.exObject = new _xfa_object.XFAObjectArray();
  58775. this.float = new _xfa_object.XFAObjectArray();
  58776. this.image = new _xfa_object.XFAObjectArray();
  58777. this.integer = new _xfa_object.XFAObjectArray();
  58778. this.text = new _xfa_object.XFAObjectArray();
  58779. this.time = new _xfa_object.XFAObjectArray();
  58780. }
  58781. }
  58782. class ExclGroup extends _xfa_object.XFAObject {
  58783. constructor(attributes) {
  58784. super(TEMPLATE_NS_ID, "exclGroup", true);
  58785. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  58786. this.accessKey = attributes.accessKey || "";
  58787. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58788. this.colSpan = (0, _utils.getInteger)({
  58789. data: attributes.colSpan,
  58790. defaultValue: 1,
  58791. validate: n => n >= 1 || n === -1
  58792. });
  58793. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58794. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58795. this.id = attributes.id || "";
  58796. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  58797. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58798. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58799. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58800. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58801. this.name = attributes.name || "";
  58802. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58803. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58804. this.use = attributes.use || "";
  58805. this.usehref = attributes.usehref || "";
  58806. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58807. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58808. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58809. this.assist = null;
  58810. this.bind = null;
  58811. this.border = null;
  58812. this.calculate = null;
  58813. this.caption = null;
  58814. this.desc = null;
  58815. this.extras = null;
  58816. this.margin = null;
  58817. this.para = null;
  58818. this.traversal = null;
  58819. this.validate = null;
  58820. this.connect = new _xfa_object.XFAObjectArray();
  58821. this.event = new _xfa_object.XFAObjectArray();
  58822. this.field = new _xfa_object.XFAObjectArray();
  58823. this.setProperty = new _xfa_object.XFAObjectArray();
  58824. }
  58825. [_xfa_object.$isBindable]() {
  58826. return true;
  58827. }
  58828. [_xfa_object.$hasSettableValue]() {
  58829. return true;
  58830. }
  58831. [_xfa_object.$setValue](value) {
  58832. for (const field of this.field.children) {
  58833. if (!field.value) {
  58834. const nodeValue = new Value({});
  58835. field[_xfa_object.$appendChild](nodeValue);
  58836. field.value = nodeValue;
  58837. }
  58838. field.value[_xfa_object.$setValue](value);
  58839. }
  58840. }
  58841. [_xfa_object.$isThereMoreWidth]() {
  58842. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  58843. }
  58844. [_xfa_object.$isSplittable]() {
  58845. const parent = this[_xfa_object.$getSubformParent]();
  58846. if (!parent[_xfa_object.$isSplittable]()) {
  58847. return false;
  58848. }
  58849. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  58850. return this[_xfa_object.$extra]._isSplittable;
  58851. }
  58852. if (this.layout === "position" || this.layout.includes("row")) {
  58853. this[_xfa_object.$extra]._isSplittable = false;
  58854. return false;
  58855. }
  58856. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  58857. return false;
  58858. }
  58859. this[_xfa_object.$extra]._isSplittable = true;
  58860. return true;
  58861. }
  58862. [_xfa_object.$flushHTML]() {
  58863. return (0, _layout.flushHTML)(this);
  58864. }
  58865. [_xfa_object.$addHTML](html, bbox) {
  58866. (0, _layout.addHTML)(this, html, bbox);
  58867. }
  58868. [_xfa_object.$getAvailableSpace]() {
  58869. return (0, _layout.getAvailableSpace)(this);
  58870. }
  58871. [_xfa_object.$toHTML](availableSpace) {
  58872. setTabIndex(this);
  58873. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  58874. return _utils.HTMLResult.EMPTY;
  58875. }
  58876. (0, _html_utils.fixDimensions)(this);
  58877. const children = [];
  58878. const attributes = {
  58879. id: this[_xfa_object.$uid],
  58880. class: []
  58881. };
  58882. (0, _html_utils.setAccess)(this, attributes.class);
  58883. if (!this[_xfa_object.$extra]) {
  58884. this[_xfa_object.$extra] = Object.create(null);
  58885. }
  58886. Object.assign(this[_xfa_object.$extra], {
  58887. children,
  58888. attributes,
  58889. attempt: 0,
  58890. line: null,
  58891. numberInLine: 0,
  58892. availableSpace: {
  58893. width: Math.min(this.w || Infinity, availableSpace.width),
  58894. height: Math.min(this.h || Infinity, availableSpace.height)
  58895. },
  58896. width: 0,
  58897. height: 0,
  58898. prevHeight: 0,
  58899. currentWidth: 0
  58900. });
  58901. const isSplittable = this[_xfa_object.$isSplittable]();
  58902. if (!isSplittable) {
  58903. setFirstUnsplittable(this);
  58904. }
  58905. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58906. return _utils.HTMLResult.FAILURE;
  58907. }
  58908. const filter = new Set(["field"]);
  58909. if (this.layout.includes("row")) {
  58910. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  58911. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  58912. this[_xfa_object.$extra].columnWidths = columnWidths;
  58913. this[_xfa_object.$extra].currentColumn = 0;
  58914. }
  58915. }
  58916. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  58917. const classNames = ["xfaExclgroup"];
  58918. const cl = (0, _html_utils.layoutClass)(this);
  58919. if (cl) {
  58920. classNames.push(cl);
  58921. }
  58922. if ((0, _html_utils.isPrintOnly)(this)) {
  58923. classNames.push("xfaPrintOnly");
  58924. }
  58925. attributes.style = style;
  58926. attributes.class = classNames;
  58927. if (this.name) {
  58928. attributes.xfaName = this.name;
  58929. }
  58930. this[_xfa_object.$pushPara]();
  58931. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  58932. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  58933. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  58934. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  58935. this[_xfa_object.$extra].numberInLine = 0;
  58936. }
  58937. const result = this[_xfa_object.$childrenToHTML]({
  58938. filter,
  58939. include: true
  58940. });
  58941. if (result.success) {
  58942. break;
  58943. }
  58944. if (result.isBreak()) {
  58945. this[_xfa_object.$popPara]();
  58946. return result;
  58947. }
  58948. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58949. this[_xfa_object.$extra].attempt = maxRun;
  58950. break;
  58951. }
  58952. }
  58953. this[_xfa_object.$popPara]();
  58954. if (!isSplittable) {
  58955. unsetFirstUnsplittable(this);
  58956. }
  58957. if (this[_xfa_object.$extra].attempt === maxRun) {
  58958. if (!isSplittable) {
  58959. delete this[_xfa_object.$extra];
  58960. }
  58961. return _utils.HTMLResult.FAILURE;
  58962. }
  58963. let marginH = 0;
  58964. let marginV = 0;
  58965. if (this.margin) {
  58966. marginH = this.margin.leftInset + this.margin.rightInset;
  58967. marginV = this.margin.topInset + this.margin.bottomInset;
  58968. }
  58969. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  58970. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  58971. const bbox = [this.x, this.y, width, height];
  58972. if (this.w === "") {
  58973. style.width = (0, _html_utils.measureToString)(width);
  58974. }
  58975. if (this.h === "") {
  58976. style.height = (0, _html_utils.measureToString)(height);
  58977. }
  58978. const html = {
  58979. name: "div",
  58980. attributes,
  58981. children
  58982. };
  58983. applyAssist(this, attributes);
  58984. delete this[_xfa_object.$extra];
  58985. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58986. }
  58987. }
  58988. class Execute extends _xfa_object.XFAObject {
  58989. constructor(attributes) {
  58990. super(TEMPLATE_NS_ID, "execute");
  58991. this.connection = attributes.connection || "";
  58992. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  58993. this.id = attributes.id || "";
  58994. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  58995. this.use = attributes.use || "";
  58996. this.usehref = attributes.usehref || "";
  58997. }
  58998. }
  58999. class Extras extends _xfa_object.XFAObject {
  59000. constructor(attributes) {
  59001. super(TEMPLATE_NS_ID, "extras", true);
  59002. this.id = attributes.id || "";
  59003. this.name = attributes.name || "";
  59004. this.use = attributes.use || "";
  59005. this.usehref = attributes.usehref || "";
  59006. this.boolean = new _xfa_object.XFAObjectArray();
  59007. this.date = new _xfa_object.XFAObjectArray();
  59008. this.dateTime = new _xfa_object.XFAObjectArray();
  59009. this.decimal = new _xfa_object.XFAObjectArray();
  59010. this.exData = new _xfa_object.XFAObjectArray();
  59011. this.extras = new _xfa_object.XFAObjectArray();
  59012. this.float = new _xfa_object.XFAObjectArray();
  59013. this.image = new _xfa_object.XFAObjectArray();
  59014. this.integer = new _xfa_object.XFAObjectArray();
  59015. this.text = new _xfa_object.XFAObjectArray();
  59016. this.time = new _xfa_object.XFAObjectArray();
  59017. }
  59018. }
  59019. class Field extends _xfa_object.XFAObject {
  59020. constructor(attributes) {
  59021. super(TEMPLATE_NS_ID, "field", true);
  59022. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  59023. this.accessKey = attributes.accessKey || "";
  59024. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  59025. this.colSpan = (0, _utils.getInteger)({
  59026. data: attributes.colSpan,
  59027. defaultValue: 1,
  59028. validate: n => n >= 1 || n === -1
  59029. });
  59030. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  59031. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  59032. this.id = attributes.id || "";
  59033. this.locale = attributes.locale || "";
  59034. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  59035. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  59036. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  59037. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  59038. this.name = attributes.name || "";
  59039. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59040. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  59041. this.rotate = (0, _utils.getInteger)({
  59042. data: attributes.rotate,
  59043. defaultValue: 0,
  59044. validate: x => x % 90 === 0
  59045. });
  59046. this.use = attributes.use || "";
  59047. this.usehref = attributes.usehref || "";
  59048. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  59049. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  59050. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  59051. this.assist = null;
  59052. this.bind = null;
  59053. this.border = null;
  59054. this.calculate = null;
  59055. this.caption = null;
  59056. this.desc = null;
  59057. this.extras = null;
  59058. this.font = null;
  59059. this.format = null;
  59060. this.items = new _xfa_object.XFAObjectArray(2);
  59061. this.keep = null;
  59062. this.margin = null;
  59063. this.para = null;
  59064. this.traversal = null;
  59065. this.ui = null;
  59066. this.validate = null;
  59067. this.value = null;
  59068. this.bindItems = new _xfa_object.XFAObjectArray();
  59069. this.connect = new _xfa_object.XFAObjectArray();
  59070. this.event = new _xfa_object.XFAObjectArray();
  59071. this.setProperty = new _xfa_object.XFAObjectArray();
  59072. }
  59073. [_xfa_object.$isBindable]() {
  59074. return true;
  59075. }
  59076. [_xfa_object.$setValue](value) {
  59077. _setValue(this, value);
  59078. }
  59079. [_xfa_object.$toHTML](availableSpace) {
  59080. setTabIndex(this);
  59081. if (!this.ui) {
  59082. this.ui = new Ui({});
  59083. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  59084. this[_xfa_object.$appendChild](this.ui);
  59085. let node;
  59086. switch (this.items.children.length) {
  59087. case 0:
  59088. node = new TextEdit({});
  59089. this.ui.textEdit = node;
  59090. break;
  59091. case 1:
  59092. node = new CheckButton({});
  59093. this.ui.checkButton = node;
  59094. break;
  59095. case 2:
  59096. node = new ChoiceList({});
  59097. this.ui.choiceList = node;
  59098. break;
  59099. }
  59100. this.ui[_xfa_object.$appendChild](node);
  59101. }
  59102. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  59103. return _utils.HTMLResult.EMPTY;
  59104. }
  59105. if (this.caption) {
  59106. delete this.caption[_xfa_object.$extra];
  59107. }
  59108. this[_xfa_object.$pushPara]();
  59109. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  59110. const savedW = this.w;
  59111. const savedH = this.h;
  59112. let marginH = 0;
  59113. let marginV = 0;
  59114. if (this.margin) {
  59115. marginH = this.margin.leftInset + this.margin.rightInset;
  59116. marginV = this.margin.topInset + this.margin.bottomInset;
  59117. }
  59118. let borderDims = null;
  59119. if (this.w === "" || this.h === "") {
  59120. let width = null;
  59121. let height = null;
  59122. let uiW = 0;
  59123. let uiH = 0;
  59124. if (this.ui.checkButton) {
  59125. uiW = uiH = this.ui.checkButton.size;
  59126. } else {
  59127. const {
  59128. w,
  59129. h
  59130. } = (0, _html_utils.layoutNode)(this, availableSpace);
  59131. if (w !== null) {
  59132. uiW = w;
  59133. uiH = h;
  59134. } else {
  59135. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  59136. }
  59137. }
  59138. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  59139. uiW += borderDims.w;
  59140. uiH += borderDims.h;
  59141. if (this.caption) {
  59142. const {
  59143. w,
  59144. h,
  59145. isBroken
  59146. } = this.caption[_xfa_object.$getExtra](availableSpace);
  59147. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  59148. this[_xfa_object.$popPara]();
  59149. return _utils.HTMLResult.FAILURE;
  59150. }
  59151. width = w;
  59152. height = h;
  59153. switch (this.caption.placement) {
  59154. case "left":
  59155. case "right":
  59156. case "inline":
  59157. width += uiW;
  59158. break;
  59159. case "top":
  59160. case "bottom":
  59161. height += uiH;
  59162. break;
  59163. }
  59164. } else {
  59165. width = uiW;
  59166. height = uiH;
  59167. }
  59168. if (width && this.w === "") {
  59169. width += marginH;
  59170. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  59171. }
  59172. if (height && this.h === "") {
  59173. height += marginV;
  59174. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  59175. }
  59176. }
  59177. this[_xfa_object.$popPara]();
  59178. (0, _html_utils.fixDimensions)(this);
  59179. setFirstUnsplittable(this);
  59180. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  59181. this.w = savedW;
  59182. this.h = savedH;
  59183. this[_xfa_object.$popPara]();
  59184. return _utils.HTMLResult.FAILURE;
  59185. }
  59186. unsetFirstUnsplittable(this);
  59187. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  59188. (0, _html_utils.setMinMaxDimensions)(this, style);
  59189. const classNames = ["xfaField"];
  59190. if (this.font) {
  59191. classNames.push("xfaFont");
  59192. }
  59193. if ((0, _html_utils.isPrintOnly)(this)) {
  59194. classNames.push("xfaPrintOnly");
  59195. }
  59196. const attributes = {
  59197. style,
  59198. id: this[_xfa_object.$uid],
  59199. class: classNames
  59200. };
  59201. if (style.margin) {
  59202. style.padding = style.margin;
  59203. delete style.margin;
  59204. }
  59205. (0, _html_utils.setAccess)(this, classNames);
  59206. if (this.name) {
  59207. attributes.xfaName = this.name;
  59208. }
  59209. const children = [];
  59210. const html = {
  59211. name: "div",
  59212. attributes,
  59213. children
  59214. };
  59215. applyAssist(this, attributes);
  59216. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  59217. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  59218. const ui = this.ui[_xfa_object.$toHTML]().html;
  59219. if (!ui) {
  59220. Object.assign(style, borderStyle);
  59221. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59222. }
  59223. if (this[_xfa_object.$tabIndex]) {
  59224. if (ui.children && ui.children[0]) {
  59225. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  59226. } else {
  59227. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  59228. }
  59229. }
  59230. if (!ui.attributes.style) {
  59231. ui.attributes.style = Object.create(null);
  59232. }
  59233. let aElement = null;
  59234. if (this.ui.button) {
  59235. if (ui.children.length === 1) {
  59236. [aElement] = ui.children.splice(0, 1);
  59237. }
  59238. Object.assign(ui.attributes.style, borderStyle);
  59239. } else {
  59240. Object.assign(style, borderStyle);
  59241. }
  59242. children.push(ui);
  59243. if (this.value) {
  59244. if (this.ui.imageEdit) {
  59245. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  59246. } else if (!this.ui.button) {
  59247. let value = "";
  59248. if (this.value.exData) {
  59249. value = this.value.exData[_xfa_object.$text]();
  59250. } else if (this.value.text) {
  59251. value = this.value.text[_xfa_object.$getExtra]();
  59252. } else {
  59253. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  59254. if (htmlValue !== null) {
  59255. value = htmlValue.children[0].value;
  59256. }
  59257. }
  59258. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  59259. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  59260. }
  59261. if (value) {
  59262. if (this.ui.numericEdit) {
  59263. value = parseFloat(value);
  59264. value = isNaN(value) ? "" : value.toString();
  59265. }
  59266. if (ui.children[0].name === "textarea") {
  59267. ui.children[0].attributes.textContent = value;
  59268. } else {
  59269. ui.children[0].attributes.value = value;
  59270. }
  59271. }
  59272. }
  59273. }
  59274. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  59275. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  59276. let captionHeight = 0;
  59277. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  59278. captionHeight = this.caption.reserve;
  59279. if (captionHeight <= 0) {
  59280. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  59281. }
  59282. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  59283. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  59284. } else {
  59285. ui.children[0].attributes.style.height = "100%";
  59286. }
  59287. }
  59288. if (aElement) {
  59289. ui.children.push(aElement);
  59290. }
  59291. if (!caption) {
  59292. if (ui.attributes.class) {
  59293. ui.attributes.class.push("xfaLeft");
  59294. }
  59295. this.w = savedW;
  59296. this.h = savedH;
  59297. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59298. }
  59299. if (this.ui.button) {
  59300. if (style.padding) {
  59301. delete style.padding;
  59302. }
  59303. if (caption.name === "div") {
  59304. caption.name = "span";
  59305. }
  59306. ui.children.push(caption);
  59307. return _utils.HTMLResult.success(html, bbox);
  59308. } else if (this.ui.checkButton) {
  59309. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  59310. }
  59311. if (!ui.attributes.class) {
  59312. ui.attributes.class = [];
  59313. }
  59314. ui.children.splice(0, 0, caption);
  59315. switch (this.caption.placement) {
  59316. case "left":
  59317. ui.attributes.class.push("xfaLeft");
  59318. break;
  59319. case "right":
  59320. ui.attributes.class.push("xfaRight");
  59321. break;
  59322. case "top":
  59323. ui.attributes.class.push("xfaTop");
  59324. break;
  59325. case "bottom":
  59326. ui.attributes.class.push("xfaBottom");
  59327. break;
  59328. case "inline":
  59329. ui.attributes.class.push("xfaLeft");
  59330. break;
  59331. }
  59332. this.w = savedW;
  59333. this.h = savedH;
  59334. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59335. }
  59336. }
  59337. exports.Field = Field;
  59338. class Fill extends _xfa_object.XFAObject {
  59339. constructor(attributes) {
  59340. super(TEMPLATE_NS_ID, "fill", true);
  59341. this.id = attributes.id || "";
  59342. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59343. this.use = attributes.use || "";
  59344. this.usehref = attributes.usehref || "";
  59345. this.color = null;
  59346. this.extras = null;
  59347. this.linear = null;
  59348. this.pattern = null;
  59349. this.radial = null;
  59350. this.solid = null;
  59351. this.stipple = null;
  59352. }
  59353. [_xfa_object.$toStyle]() {
  59354. const parent = this[_xfa_object.$getParent]();
  59355. const grandpa = parent[_xfa_object.$getParent]();
  59356. const ggrandpa = grandpa[_xfa_object.$getParent]();
  59357. const style = Object.create(null);
  59358. let propName = "color";
  59359. let altPropName = propName;
  59360. if (parent instanceof Border) {
  59361. propName = "background-color";
  59362. altPropName = "background";
  59363. if (ggrandpa instanceof Ui) {
  59364. style.backgroundColor = "white";
  59365. }
  59366. }
  59367. if (parent instanceof Rectangle || parent instanceof Arc) {
  59368. propName = altPropName = "fill";
  59369. style.fill = "white";
  59370. }
  59371. for (const name of Object.getOwnPropertyNames(this)) {
  59372. if (name === "extras" || name === "color") {
  59373. continue;
  59374. }
  59375. const obj = this[name];
  59376. if (!(obj instanceof _xfa_object.XFAObject)) {
  59377. continue;
  59378. }
  59379. const color = obj[_xfa_object.$toStyle](this.color);
  59380. if (color) {
  59381. style[color.startsWith("#") ? propName : altPropName] = color;
  59382. }
  59383. return style;
  59384. }
  59385. if (this.color && this.color.value) {
  59386. const color = this.color[_xfa_object.$toStyle]();
  59387. style[color.startsWith("#") ? propName : altPropName] = color;
  59388. }
  59389. return style;
  59390. }
  59391. }
  59392. class Filter extends _xfa_object.XFAObject {
  59393. constructor(attributes) {
  59394. super(TEMPLATE_NS_ID, "filter", true);
  59395. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  59396. this.id = attributes.id || "";
  59397. this.name = attributes.name || "";
  59398. this.use = attributes.use || "";
  59399. this.usehref = attributes.usehref || "";
  59400. this.version = (0, _utils.getInteger)({
  59401. data: this.version,
  59402. defaultValue: 5,
  59403. validate: x => x >= 1 && x <= 5
  59404. });
  59405. this.appearanceFilter = null;
  59406. this.certificates = null;
  59407. this.digestMethods = null;
  59408. this.encodings = null;
  59409. this.encryptionMethods = null;
  59410. this.handler = null;
  59411. this.lockDocument = null;
  59412. this.mdp = null;
  59413. this.reasons = null;
  59414. this.timeStamp = null;
  59415. }
  59416. }
  59417. class Float extends _xfa_object.ContentObject {
  59418. constructor(attributes) {
  59419. super(TEMPLATE_NS_ID, "float");
  59420. this.id = attributes.id || "";
  59421. this.name = attributes.name || "";
  59422. this.use = attributes.use || "";
  59423. this.usehref = attributes.usehref || "";
  59424. }
  59425. [_xfa_object.$finalize]() {
  59426. const number = parseFloat(this[_xfa_object.$content].trim());
  59427. this[_xfa_object.$content] = isNaN(number) ? null : number;
  59428. }
  59429. [_xfa_object.$toHTML](availableSpace) {
  59430. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  59431. }
  59432. }
  59433. class Font extends _xfa_object.XFAObject {
  59434. constructor(attributes) {
  59435. super(TEMPLATE_NS_ID, "font", true);
  59436. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  59437. this.fontHorizontalScale = (0, _utils.getFloat)({
  59438. data: attributes.fontHorizontalScale,
  59439. defaultValue: 100,
  59440. validate: x => x >= 0
  59441. });
  59442. this.fontVerticalScale = (0, _utils.getFloat)({
  59443. data: attributes.fontVerticalScale,
  59444. defaultValue: 100,
  59445. validate: x => x >= 0
  59446. });
  59447. this.id = attributes.id || "";
  59448. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  59449. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  59450. this.lineThrough = (0, _utils.getInteger)({
  59451. data: attributes.lineThrough,
  59452. defaultValue: 0,
  59453. validate: x => x === 1 || x === 2
  59454. });
  59455. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  59456. this.overline = (0, _utils.getInteger)({
  59457. data: attributes.overline,
  59458. defaultValue: 0,
  59459. validate: x => x === 1 || x === 2
  59460. });
  59461. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  59462. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  59463. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  59464. this.typeface = attributes.typeface || "Courier";
  59465. this.underline = (0, _utils.getInteger)({
  59466. data: attributes.underline,
  59467. defaultValue: 0,
  59468. validate: x => x === 1 || x === 2
  59469. });
  59470. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  59471. this.use = attributes.use || "";
  59472. this.usehref = attributes.usehref || "";
  59473. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  59474. this.extras = null;
  59475. this.fill = null;
  59476. }
  59477. [_xfa_object.$clean](builder) {
  59478. super[_xfa_object.$clean](builder);
  59479. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  59480. }
  59481. [_xfa_object.$toStyle]() {
  59482. const style = (0, _html_utils.toStyle)(this, "fill");
  59483. const color = style.color;
  59484. if (color) {
  59485. if (color === "#000000") {
  59486. delete style.color;
  59487. } else if (!color.startsWith("#")) {
  59488. style.background = color;
  59489. style.backgroundClip = "text";
  59490. style.color = "transparent";
  59491. }
  59492. }
  59493. if (this.baselineShift) {
  59494. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  59495. }
  59496. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  59497. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  59498. if (this.lineThrough !== 0) {
  59499. style.textDecoration = "line-through";
  59500. if (this.lineThrough === 2) {
  59501. style.textDecorationStyle = "double";
  59502. }
  59503. }
  59504. if (this.overline !== 0) {
  59505. style.textDecoration = "overline";
  59506. if (this.overline === 2) {
  59507. style.textDecorationStyle = "double";
  59508. }
  59509. }
  59510. style.fontStyle = this.posture;
  59511. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  59512. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  59513. if (this.underline !== 0) {
  59514. style.textDecoration = "underline";
  59515. if (this.underline === 2) {
  59516. style.textDecorationStyle = "double";
  59517. }
  59518. }
  59519. style.fontWeight = this.weight;
  59520. return style;
  59521. }
  59522. }
  59523. class Format extends _xfa_object.XFAObject {
  59524. constructor(attributes) {
  59525. super(TEMPLATE_NS_ID, "format", true);
  59526. this.id = attributes.id || "";
  59527. this.use = attributes.use || "";
  59528. this.usehref = attributes.usehref || "";
  59529. this.extras = null;
  59530. this.picture = null;
  59531. }
  59532. }
  59533. class Handler extends _xfa_object.StringObject {
  59534. constructor(attributes) {
  59535. super(TEMPLATE_NS_ID, "handler");
  59536. this.id = attributes.id || "";
  59537. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59538. this.use = attributes.use || "";
  59539. this.usehref = attributes.usehref || "";
  59540. }
  59541. }
  59542. class Hyphenation extends _xfa_object.XFAObject {
  59543. constructor(attributes) {
  59544. super(TEMPLATE_NS_ID, "hyphenation");
  59545. this.excludeAllCaps = (0, _utils.getInteger)({
  59546. data: attributes.excludeAllCaps,
  59547. defaultValue: 0,
  59548. validate: x => x === 1
  59549. });
  59550. this.excludeInitialCap = (0, _utils.getInteger)({
  59551. data: attributes.excludeInitialCap,
  59552. defaultValue: 0,
  59553. validate: x => x === 1
  59554. });
  59555. this.hyphenate = (0, _utils.getInteger)({
  59556. data: attributes.hyphenate,
  59557. defaultValue: 0,
  59558. validate: x => x === 1
  59559. });
  59560. this.id = attributes.id || "";
  59561. this.pushCharacterCount = (0, _utils.getInteger)({
  59562. data: attributes.pushCharacterCount,
  59563. defaultValue: 3,
  59564. validate: x => x >= 0
  59565. });
  59566. this.remainCharacterCount = (0, _utils.getInteger)({
  59567. data: attributes.remainCharacterCount,
  59568. defaultValue: 3,
  59569. validate: x => x >= 0
  59570. });
  59571. this.use = attributes.use || "";
  59572. this.usehref = attributes.usehref || "";
  59573. this.wordCharacterCount = (0, _utils.getInteger)({
  59574. data: attributes.wordCharacterCount,
  59575. defaultValue: 7,
  59576. validate: x => x >= 0
  59577. });
  59578. }
  59579. }
  59580. class Image extends _xfa_object.StringObject {
  59581. constructor(attributes) {
  59582. super(TEMPLATE_NS_ID, "image");
  59583. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  59584. this.contentType = attributes.contentType || "";
  59585. this.href = attributes.href || "";
  59586. this.id = attributes.id || "";
  59587. this.name = attributes.name || "";
  59588. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  59589. this.use = attributes.use || "";
  59590. this.usehref = attributes.usehref || "";
  59591. }
  59592. [_xfa_object.$toHTML]() {
  59593. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  59594. return _utils.HTMLResult.EMPTY;
  59595. }
  59596. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  59597. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  59598. return _utils.HTMLResult.EMPTY;
  59599. }
  59600. if (!buffer && this.transferEncoding === "base64") {
  59601. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  59602. }
  59603. if (!buffer) {
  59604. return _utils.HTMLResult.EMPTY;
  59605. }
  59606. if (!this.contentType) {
  59607. for (const [header, type] of IMAGES_HEADERS) {
  59608. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  59609. this.contentType = type;
  59610. break;
  59611. }
  59612. }
  59613. if (!this.contentType) {
  59614. return _utils.HTMLResult.EMPTY;
  59615. }
  59616. }
  59617. const blob = new Blob([buffer], {
  59618. type: this.contentType
  59619. });
  59620. let style;
  59621. switch (this.aspect) {
  59622. case "fit":
  59623. case "actual":
  59624. break;
  59625. case "height":
  59626. style = {
  59627. height: "100%",
  59628. objectFit: "fill"
  59629. };
  59630. break;
  59631. case "none":
  59632. style = {
  59633. width: "100%",
  59634. height: "100%",
  59635. objectFit: "fill"
  59636. };
  59637. break;
  59638. case "width":
  59639. style = {
  59640. width: "100%",
  59641. objectFit: "fill"
  59642. };
  59643. break;
  59644. }
  59645. const parent = this[_xfa_object.$getParent]();
  59646. return _utils.HTMLResult.success({
  59647. name: "img",
  59648. attributes: {
  59649. class: ["xfaImage"],
  59650. style,
  59651. src: URL.createObjectURL(blob),
  59652. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  59653. }
  59654. });
  59655. }
  59656. }
  59657. class ImageEdit extends _xfa_object.XFAObject {
  59658. constructor(attributes) {
  59659. super(TEMPLATE_NS_ID, "imageEdit", true);
  59660. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  59661. this.id = attributes.id || "";
  59662. this.use = attributes.use || "";
  59663. this.usehref = attributes.usehref || "";
  59664. this.border = null;
  59665. this.extras = null;
  59666. this.margin = null;
  59667. }
  59668. [_xfa_object.$toHTML](availableSpace) {
  59669. if (this.data === "embed") {
  59670. return _utils.HTMLResult.success({
  59671. name: "div",
  59672. children: [],
  59673. attributes: {}
  59674. });
  59675. }
  59676. return _utils.HTMLResult.EMPTY;
  59677. }
  59678. }
  59679. class Integer extends _xfa_object.ContentObject {
  59680. constructor(attributes) {
  59681. super(TEMPLATE_NS_ID, "integer");
  59682. this.id = attributes.id || "";
  59683. this.name = attributes.name || "";
  59684. this.use = attributes.use || "";
  59685. this.usehref = attributes.usehref || "";
  59686. }
  59687. [_xfa_object.$finalize]() {
  59688. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  59689. this[_xfa_object.$content] = isNaN(number) ? null : number;
  59690. }
  59691. [_xfa_object.$toHTML](availableSpace) {
  59692. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  59693. }
  59694. }
  59695. class Issuers extends _xfa_object.XFAObject {
  59696. constructor(attributes) {
  59697. super(TEMPLATE_NS_ID, "issuers", true);
  59698. this.id = attributes.id || "";
  59699. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59700. this.use = attributes.use || "";
  59701. this.usehref = attributes.usehref || "";
  59702. this.certificate = new _xfa_object.XFAObjectArray();
  59703. }
  59704. }
  59705. class Items extends _xfa_object.XFAObject {
  59706. constructor(attributes) {
  59707. super(TEMPLATE_NS_ID, "items", true);
  59708. this.id = attributes.id || "";
  59709. this.name = attributes.name || "";
  59710. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59711. this.ref = attributes.ref || "";
  59712. this.save = (0, _utils.getInteger)({
  59713. data: attributes.save,
  59714. defaultValue: 0,
  59715. validate: x => x === 1
  59716. });
  59717. this.use = attributes.use || "";
  59718. this.usehref = attributes.usehref || "";
  59719. this.boolean = new _xfa_object.XFAObjectArray();
  59720. this.date = new _xfa_object.XFAObjectArray();
  59721. this.dateTime = new _xfa_object.XFAObjectArray();
  59722. this.decimal = new _xfa_object.XFAObjectArray();
  59723. this.exData = new _xfa_object.XFAObjectArray();
  59724. this.float = new _xfa_object.XFAObjectArray();
  59725. this.image = new _xfa_object.XFAObjectArray();
  59726. this.integer = new _xfa_object.XFAObjectArray();
  59727. this.text = new _xfa_object.XFAObjectArray();
  59728. this.time = new _xfa_object.XFAObjectArray();
  59729. }
  59730. [_xfa_object.$toHTML]() {
  59731. const output = [];
  59732. for (const child of this[_xfa_object.$getChildren]()) {
  59733. output.push(child[_xfa_object.$text]());
  59734. }
  59735. return _utils.HTMLResult.success(output);
  59736. }
  59737. }
  59738. exports.Items = Items;
  59739. class Keep extends _xfa_object.XFAObject {
  59740. constructor(attributes) {
  59741. super(TEMPLATE_NS_ID, "keep", true);
  59742. this.id = attributes.id || "";
  59743. const options = ["none", "contentArea", "pageArea"];
  59744. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  59745. this.next = (0, _utils.getStringOption)(attributes.next, options);
  59746. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  59747. this.use = attributes.use || "";
  59748. this.usehref = attributes.usehref || "";
  59749. this.extras = null;
  59750. }
  59751. }
  59752. class KeyUsage extends _xfa_object.XFAObject {
  59753. constructor(attributes) {
  59754. super(TEMPLATE_NS_ID, "keyUsage");
  59755. const options = ["", "yes", "no"];
  59756. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  59757. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  59758. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  59759. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  59760. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  59761. this.id = attributes.id || "";
  59762. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  59763. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  59764. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  59765. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  59766. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59767. this.use = attributes.use || "";
  59768. this.usehref = attributes.usehref || "";
  59769. }
  59770. }
  59771. class Line extends _xfa_object.XFAObject {
  59772. constructor(attributes) {
  59773. super(TEMPLATE_NS_ID, "line", true);
  59774. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  59775. this.id = attributes.id || "";
  59776. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  59777. this.use = attributes.use || "";
  59778. this.usehref = attributes.usehref || "";
  59779. this.edge = null;
  59780. }
  59781. [_xfa_object.$toHTML]() {
  59782. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  59783. const edge = this.edge || new Edge({});
  59784. const edgeStyle = edge[_xfa_object.$toStyle]();
  59785. const style = Object.create(null);
  59786. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  59787. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  59788. style.stroke = edgeStyle.color;
  59789. let x1, y1, x2, y2;
  59790. let width = "100%";
  59791. let height = "100%";
  59792. if (parent.w <= thickness) {
  59793. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  59794. width = style.strokeWidth;
  59795. } else if (parent.h <= thickness) {
  59796. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  59797. height = style.strokeWidth;
  59798. } else {
  59799. if (this.slope === "\\") {
  59800. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  59801. } else {
  59802. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  59803. }
  59804. }
  59805. const line = {
  59806. name: "line",
  59807. attributes: {
  59808. xmlns: SVG_NS,
  59809. x1,
  59810. y1,
  59811. x2,
  59812. y2,
  59813. style
  59814. }
  59815. };
  59816. const svg = {
  59817. name: "svg",
  59818. children: [line],
  59819. attributes: {
  59820. xmlns: SVG_NS,
  59821. width,
  59822. height,
  59823. style: {
  59824. overflow: "visible"
  59825. }
  59826. }
  59827. };
  59828. if (hasMargin(parent)) {
  59829. return _utils.HTMLResult.success({
  59830. name: "div",
  59831. attributes: {
  59832. style: {
  59833. display: "inline",
  59834. width: "100%",
  59835. height: "100%"
  59836. }
  59837. },
  59838. children: [svg]
  59839. });
  59840. }
  59841. svg.attributes.style.position = "absolute";
  59842. return _utils.HTMLResult.success(svg);
  59843. }
  59844. }
  59845. class Linear extends _xfa_object.XFAObject {
  59846. constructor(attributes) {
  59847. super(TEMPLATE_NS_ID, "linear", true);
  59848. this.id = attributes.id || "";
  59849. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  59850. this.use = attributes.use || "";
  59851. this.usehref = attributes.usehref || "";
  59852. this.color = null;
  59853. this.extras = null;
  59854. }
  59855. [_xfa_object.$toStyle](startColor) {
  59856. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  59857. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  59858. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  59859. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  59860. }
  59861. }
  59862. class LockDocument extends _xfa_object.ContentObject {
  59863. constructor(attributes) {
  59864. super(TEMPLATE_NS_ID, "lockDocument");
  59865. this.id = attributes.id || "";
  59866. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59867. this.use = attributes.use || "";
  59868. this.usehref = attributes.usehref || "";
  59869. }
  59870. [_xfa_object.$finalize]() {
  59871. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  59872. }
  59873. }
  59874. class Manifest extends _xfa_object.XFAObject {
  59875. constructor(attributes) {
  59876. super(TEMPLATE_NS_ID, "manifest", true);
  59877. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  59878. this.id = attributes.id || "";
  59879. this.name = attributes.name || "";
  59880. this.use = attributes.use || "";
  59881. this.usehref = attributes.usehref || "";
  59882. this.extras = null;
  59883. this.ref = new _xfa_object.XFAObjectArray();
  59884. }
  59885. }
  59886. class Margin extends _xfa_object.XFAObject {
  59887. constructor(attributes) {
  59888. super(TEMPLATE_NS_ID, "margin", true);
  59889. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  59890. this.id = attributes.id || "";
  59891. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  59892. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  59893. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  59894. this.use = attributes.use || "";
  59895. this.usehref = attributes.usehref || "";
  59896. this.extras = null;
  59897. }
  59898. [_xfa_object.$toStyle]() {
  59899. return {
  59900. 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)
  59901. };
  59902. }
  59903. }
  59904. class Mdp extends _xfa_object.XFAObject {
  59905. constructor(attributes) {
  59906. super(TEMPLATE_NS_ID, "mdp");
  59907. this.id = attributes.id || "";
  59908. this.permissions = (0, _utils.getInteger)({
  59909. data: attributes.permissions,
  59910. defaultValue: 2,
  59911. validate: x => x === 1 || x === 3
  59912. });
  59913. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  59914. this.use = attributes.use || "";
  59915. this.usehref = attributes.usehref || "";
  59916. }
  59917. }
  59918. class Medium extends _xfa_object.XFAObject {
  59919. constructor(attributes) {
  59920. super(TEMPLATE_NS_ID, "medium");
  59921. this.id = attributes.id || "";
  59922. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  59923. this.long = (0, _utils.getMeasurement)(attributes.long);
  59924. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  59925. this.short = (0, _utils.getMeasurement)(attributes.short);
  59926. this.stock = attributes.stock || "";
  59927. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  59928. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  59929. this.use = attributes.use || "";
  59930. this.usehref = attributes.usehref || "";
  59931. }
  59932. }
  59933. class Message extends _xfa_object.XFAObject {
  59934. constructor(attributes) {
  59935. super(TEMPLATE_NS_ID, "message", true);
  59936. this.id = attributes.id || "";
  59937. this.use = attributes.use || "";
  59938. this.usehref = attributes.usehref || "";
  59939. this.text = new _xfa_object.XFAObjectArray();
  59940. }
  59941. }
  59942. class NumericEdit extends _xfa_object.XFAObject {
  59943. constructor(attributes) {
  59944. super(TEMPLATE_NS_ID, "numericEdit", true);
  59945. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  59946. this.id = attributes.id || "";
  59947. this.use = attributes.use || "";
  59948. this.usehref = attributes.usehref || "";
  59949. this.border = null;
  59950. this.comb = null;
  59951. this.extras = null;
  59952. this.margin = null;
  59953. }
  59954. [_xfa_object.$toHTML](availableSpace) {
  59955. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  59956. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  59957. const html = {
  59958. name: "input",
  59959. attributes: {
  59960. type: "text",
  59961. fieldId: field[_xfa_object.$uid],
  59962. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  59963. class: ["xfaTextfield"],
  59964. style,
  59965. "aria-label": ariaLabel(field),
  59966. "aria-required": false
  59967. }
  59968. };
  59969. if (isRequired(field)) {
  59970. html.attributes["aria-required"] = true;
  59971. html.attributes.required = true;
  59972. }
  59973. return _utils.HTMLResult.success({
  59974. name: "label",
  59975. attributes: {
  59976. class: ["xfaLabel"]
  59977. },
  59978. children: [html]
  59979. });
  59980. }
  59981. }
  59982. class Occur extends _xfa_object.XFAObject {
  59983. constructor(attributes) {
  59984. super(TEMPLATE_NS_ID, "occur", true);
  59985. this.id = attributes.id || "";
  59986. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  59987. data: attributes.initial,
  59988. defaultValue: "",
  59989. validate: x => true
  59990. }) : "";
  59991. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  59992. data: attributes.max,
  59993. defaultValue: 1,
  59994. validate: x => true
  59995. }) : "";
  59996. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  59997. data: attributes.min,
  59998. defaultValue: 1,
  59999. validate: x => true
  60000. }) : "";
  60001. this.use = attributes.use || "";
  60002. this.usehref = attributes.usehref || "";
  60003. this.extras = null;
  60004. }
  60005. [_xfa_object.$clean]() {
  60006. const parent = this[_xfa_object.$getParent]();
  60007. const originalMin = this.min;
  60008. if (this.min === "") {
  60009. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  60010. }
  60011. if (this.max === "") {
  60012. if (originalMin === "") {
  60013. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  60014. } else {
  60015. this.max = this.min;
  60016. }
  60017. }
  60018. if (this.max !== -1 && this.max < this.min) {
  60019. this.max = this.min;
  60020. }
  60021. if (this.initial === "") {
  60022. this.initial = parent instanceof Template ? 1 : this.min;
  60023. }
  60024. }
  60025. }
  60026. class Oid extends _xfa_object.StringObject {
  60027. constructor(attributes) {
  60028. super(TEMPLATE_NS_ID, "oid");
  60029. this.id = attributes.id || "";
  60030. this.name = attributes.name || "";
  60031. this.use = attributes.use || "";
  60032. this.usehref = attributes.usehref || "";
  60033. }
  60034. }
  60035. class Oids extends _xfa_object.XFAObject {
  60036. constructor(attributes) {
  60037. super(TEMPLATE_NS_ID, "oids", true);
  60038. this.id = attributes.id || "";
  60039. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60040. this.use = attributes.use || "";
  60041. this.usehref = attributes.usehref || "";
  60042. this.oid = new _xfa_object.XFAObjectArray();
  60043. }
  60044. }
  60045. class Overflow extends _xfa_object.XFAObject {
  60046. constructor(attributes) {
  60047. super(TEMPLATE_NS_ID, "overflow");
  60048. this.id = attributes.id || "";
  60049. this.leader = attributes.leader || "";
  60050. this.target = attributes.target || "";
  60051. this.trailer = attributes.trailer || "";
  60052. this.use = attributes.use || "";
  60053. this.usehref = attributes.usehref || "";
  60054. }
  60055. [_xfa_object.$getExtra]() {
  60056. if (!this[_xfa_object.$extra]) {
  60057. const parent = this[_xfa_object.$getParent]();
  60058. const root = this[_xfa_object.$getTemplateRoot]();
  60059. const target = root[_xfa_object.$searchNode](this.target, parent);
  60060. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  60061. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  60062. this[_xfa_object.$extra] = {
  60063. target: target && target[0] || null,
  60064. leader: leader && leader[0] || null,
  60065. trailer: trailer && trailer[0] || null,
  60066. addLeader: false,
  60067. addTrailer: false
  60068. };
  60069. }
  60070. return this[_xfa_object.$extra];
  60071. }
  60072. }
  60073. class PageArea extends _xfa_object.XFAObject {
  60074. constructor(attributes) {
  60075. super(TEMPLATE_NS_ID, "pageArea", true);
  60076. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  60077. this.id = attributes.id || "";
  60078. this.initialNumber = (0, _utils.getInteger)({
  60079. data: attributes.initialNumber,
  60080. defaultValue: 1,
  60081. validate: x => true
  60082. });
  60083. this.name = attributes.name || "";
  60084. this.numbered = (0, _utils.getInteger)({
  60085. data: attributes.numbered,
  60086. defaultValue: 1,
  60087. validate: x => true
  60088. });
  60089. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  60090. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  60091. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60092. this.use = attributes.use || "";
  60093. this.usehref = attributes.usehref || "";
  60094. this.desc = null;
  60095. this.extras = null;
  60096. this.medium = null;
  60097. this.occur = null;
  60098. this.area = new _xfa_object.XFAObjectArray();
  60099. this.contentArea = new _xfa_object.XFAObjectArray();
  60100. this.draw = new _xfa_object.XFAObjectArray();
  60101. this.exclGroup = new _xfa_object.XFAObjectArray();
  60102. this.field = new _xfa_object.XFAObjectArray();
  60103. this.subform = new _xfa_object.XFAObjectArray();
  60104. }
  60105. [_xfa_object.$isUsable]() {
  60106. if (!this[_xfa_object.$extra]) {
  60107. this[_xfa_object.$extra] = {
  60108. numberOfUse: 0
  60109. };
  60110. return true;
  60111. }
  60112. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  60113. }
  60114. [_xfa_object.$cleanPage]() {
  60115. delete this[_xfa_object.$extra];
  60116. }
  60117. [_xfa_object.$getNextPage]() {
  60118. if (!this[_xfa_object.$extra]) {
  60119. this[_xfa_object.$extra] = {
  60120. numberOfUse: 0
  60121. };
  60122. }
  60123. const parent = this[_xfa_object.$getParent]();
  60124. if (parent.relation === "orderedOccurrence") {
  60125. if (this[_xfa_object.$isUsable]()) {
  60126. this[_xfa_object.$extra].numberOfUse += 1;
  60127. return this;
  60128. }
  60129. }
  60130. return parent[_xfa_object.$getNextPage]();
  60131. }
  60132. [_xfa_object.$getAvailableSpace]() {
  60133. return this[_xfa_object.$extra].space || {
  60134. width: 0,
  60135. height: 0
  60136. };
  60137. }
  60138. [_xfa_object.$toHTML]() {
  60139. if (!this[_xfa_object.$extra]) {
  60140. this[_xfa_object.$extra] = {
  60141. numberOfUse: 1
  60142. };
  60143. }
  60144. const children = [];
  60145. this[_xfa_object.$extra].children = children;
  60146. const style = Object.create(null);
  60147. if (this.medium && this.medium.short && this.medium.long) {
  60148. style.width = (0, _html_utils.measureToString)(this.medium.short);
  60149. style.height = (0, _html_utils.measureToString)(this.medium.long);
  60150. this[_xfa_object.$extra].space = {
  60151. width: this.medium.short,
  60152. height: this.medium.long
  60153. };
  60154. if (this.medium.orientation === "landscape") {
  60155. const x = style.width;
  60156. style.width = style.height;
  60157. style.height = x;
  60158. this[_xfa_object.$extra].space = {
  60159. width: this.medium.long,
  60160. height: this.medium.short
  60161. };
  60162. }
  60163. } else {
  60164. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  60165. }
  60166. this[_xfa_object.$childrenToHTML]({
  60167. filter: new Set(["area", "draw", "field", "subform"]),
  60168. include: true
  60169. });
  60170. this[_xfa_object.$childrenToHTML]({
  60171. filter: new Set(["contentArea"]),
  60172. include: true
  60173. });
  60174. return _utils.HTMLResult.success({
  60175. name: "div",
  60176. children,
  60177. attributes: {
  60178. class: ["xfaPage"],
  60179. id: this[_xfa_object.$uid],
  60180. style,
  60181. xfaName: this.name
  60182. }
  60183. });
  60184. }
  60185. }
  60186. class PageSet extends _xfa_object.XFAObject {
  60187. constructor(attributes) {
  60188. super(TEMPLATE_NS_ID, "pageSet", true);
  60189. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  60190. this.id = attributes.id || "";
  60191. this.name = attributes.name || "";
  60192. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  60193. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60194. this.use = attributes.use || "";
  60195. this.usehref = attributes.usehref || "";
  60196. this.extras = null;
  60197. this.occur = null;
  60198. this.pageArea = new _xfa_object.XFAObjectArray();
  60199. this.pageSet = new _xfa_object.XFAObjectArray();
  60200. }
  60201. [_xfa_object.$cleanPage]() {
  60202. for (const page of this.pageArea.children) {
  60203. page[_xfa_object.$cleanPage]();
  60204. }
  60205. for (const page of this.pageSet.children) {
  60206. page[_xfa_object.$cleanPage]();
  60207. }
  60208. }
  60209. [_xfa_object.$isUsable]() {
  60210. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  60211. }
  60212. [_xfa_object.$getNextPage]() {
  60213. if (!this[_xfa_object.$extra]) {
  60214. this[_xfa_object.$extra] = {
  60215. numberOfUse: 1,
  60216. pageIndex: -1,
  60217. pageSetIndex: -1
  60218. };
  60219. }
  60220. if (this.relation === "orderedOccurrence") {
  60221. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  60222. this[_xfa_object.$extra].pageIndex += 1;
  60223. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  60224. return pageArea[_xfa_object.$getNextPage]();
  60225. }
  60226. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  60227. this[_xfa_object.$extra].pageSetIndex += 1;
  60228. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  60229. }
  60230. if (this[_xfa_object.$isUsable]()) {
  60231. this[_xfa_object.$extra].numberOfUse += 1;
  60232. this[_xfa_object.$extra].pageIndex = -1;
  60233. this[_xfa_object.$extra].pageSetIndex = -1;
  60234. return this[_xfa_object.$getNextPage]();
  60235. }
  60236. const parent = this[_xfa_object.$getParent]();
  60237. if (parent instanceof PageSet) {
  60238. return parent[_xfa_object.$getNextPage]();
  60239. }
  60240. this[_xfa_object.$cleanPage]();
  60241. return this[_xfa_object.$getNextPage]();
  60242. }
  60243. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  60244. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  60245. const position = pageNumber === 0 ? "first" : "rest";
  60246. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  60247. if (page) {
  60248. return page;
  60249. }
  60250. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  60251. if (page) {
  60252. return page;
  60253. }
  60254. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  60255. if (page) {
  60256. return page;
  60257. }
  60258. return this.pageArea.children[0];
  60259. }
  60260. }
  60261. class Para extends _xfa_object.XFAObject {
  60262. constructor(attributes) {
  60263. super(TEMPLATE_NS_ID, "para", true);
  60264. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  60265. this.id = attributes.id || "";
  60266. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  60267. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  60268. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  60269. this.orphans = (0, _utils.getInteger)({
  60270. data: attributes.orphans,
  60271. defaultValue: 0,
  60272. validate: x => x >= 0
  60273. });
  60274. this.preserve = attributes.preserve || "";
  60275. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  60276. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  60277. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  60278. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  60279. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  60280. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  60281. this.use = attributes.use || "";
  60282. this.usehref = attributes.usehref || "";
  60283. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  60284. this.widows = (0, _utils.getInteger)({
  60285. data: attributes.widows,
  60286. defaultValue: 0,
  60287. validate: x => x >= 0
  60288. });
  60289. this.hyphenation = null;
  60290. }
  60291. [_xfa_object.$toStyle]() {
  60292. const style = (0, _html_utils.toStyle)(this, "hAlign");
  60293. if (this.marginLeft !== "") {
  60294. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  60295. }
  60296. if (this.marginRight !== "") {
  60297. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  60298. }
  60299. if (this.spaceAbove !== "") {
  60300. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  60301. }
  60302. if (this.spaceBelow !== "") {
  60303. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  60304. }
  60305. if (this.textIndent !== "") {
  60306. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  60307. (0, _html_utils.fixTextIndent)(style);
  60308. }
  60309. if (this.lineHeight > 0) {
  60310. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  60311. }
  60312. if (this.tabDefault !== "") {
  60313. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  60314. }
  60315. if (this.tabStops.length > 0) {}
  60316. if (this.hyphenatation) {
  60317. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  60318. }
  60319. return style;
  60320. }
  60321. }
  60322. class PasswordEdit extends _xfa_object.XFAObject {
  60323. constructor(attributes) {
  60324. super(TEMPLATE_NS_ID, "passwordEdit", true);
  60325. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  60326. this.id = attributes.id || "";
  60327. this.passwordChar = attributes.passwordChar || "*";
  60328. this.use = attributes.use || "";
  60329. this.usehref = attributes.usehref || "";
  60330. this.border = null;
  60331. this.extras = null;
  60332. this.margin = null;
  60333. }
  60334. }
  60335. class Pattern extends _xfa_object.XFAObject {
  60336. constructor(attributes) {
  60337. super(TEMPLATE_NS_ID, "pattern", true);
  60338. this.id = attributes.id || "";
  60339. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  60340. this.use = attributes.use || "";
  60341. this.usehref = attributes.usehref || "";
  60342. this.color = null;
  60343. this.extras = null;
  60344. }
  60345. [_xfa_object.$toStyle](startColor) {
  60346. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60347. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  60348. const width = 5;
  60349. const cmd = "repeating-linear-gradient";
  60350. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  60351. switch (this.type) {
  60352. case "crossHatch":
  60353. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  60354. case "crossDiagonal":
  60355. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  60356. case "diagonalLeft":
  60357. return `${cmd}(45deg,${colors})`;
  60358. case "diagonalRight":
  60359. return `${cmd}(-45deg,${colors})`;
  60360. case "horizontal":
  60361. return `${cmd}(to top,${colors})`;
  60362. case "vertical":
  60363. return `${cmd}(to right,${colors})`;
  60364. }
  60365. return "";
  60366. }
  60367. }
  60368. class Picture extends _xfa_object.StringObject {
  60369. constructor(attributes) {
  60370. super(TEMPLATE_NS_ID, "picture");
  60371. this.id = attributes.id || "";
  60372. this.use = attributes.use || "";
  60373. this.usehref = attributes.usehref || "";
  60374. }
  60375. }
  60376. class Proto extends _xfa_object.XFAObject {
  60377. constructor(attributes) {
  60378. super(TEMPLATE_NS_ID, "proto", true);
  60379. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  60380. this.arc = new _xfa_object.XFAObjectArray();
  60381. this.area = new _xfa_object.XFAObjectArray();
  60382. this.assist = new _xfa_object.XFAObjectArray();
  60383. this.barcode = new _xfa_object.XFAObjectArray();
  60384. this.bindItems = new _xfa_object.XFAObjectArray();
  60385. this.bookend = new _xfa_object.XFAObjectArray();
  60386. this.boolean = new _xfa_object.XFAObjectArray();
  60387. this.border = new _xfa_object.XFAObjectArray();
  60388. this.break = new _xfa_object.XFAObjectArray();
  60389. this.breakAfter = new _xfa_object.XFAObjectArray();
  60390. this.breakBefore = new _xfa_object.XFAObjectArray();
  60391. this.button = new _xfa_object.XFAObjectArray();
  60392. this.calculate = new _xfa_object.XFAObjectArray();
  60393. this.caption = new _xfa_object.XFAObjectArray();
  60394. this.certificate = new _xfa_object.XFAObjectArray();
  60395. this.certificates = new _xfa_object.XFAObjectArray();
  60396. this.checkButton = new _xfa_object.XFAObjectArray();
  60397. this.choiceList = new _xfa_object.XFAObjectArray();
  60398. this.color = new _xfa_object.XFAObjectArray();
  60399. this.comb = new _xfa_object.XFAObjectArray();
  60400. this.connect = new _xfa_object.XFAObjectArray();
  60401. this.contentArea = new _xfa_object.XFAObjectArray();
  60402. this.corner = new _xfa_object.XFAObjectArray();
  60403. this.date = new _xfa_object.XFAObjectArray();
  60404. this.dateTime = new _xfa_object.XFAObjectArray();
  60405. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  60406. this.decimal = new _xfa_object.XFAObjectArray();
  60407. this.defaultUi = new _xfa_object.XFAObjectArray();
  60408. this.desc = new _xfa_object.XFAObjectArray();
  60409. this.digestMethod = new _xfa_object.XFAObjectArray();
  60410. this.digestMethods = new _xfa_object.XFAObjectArray();
  60411. this.draw = new _xfa_object.XFAObjectArray();
  60412. this.edge = new _xfa_object.XFAObjectArray();
  60413. this.encoding = new _xfa_object.XFAObjectArray();
  60414. this.encodings = new _xfa_object.XFAObjectArray();
  60415. this.encrypt = new _xfa_object.XFAObjectArray();
  60416. this.encryptData = new _xfa_object.XFAObjectArray();
  60417. this.encryption = new _xfa_object.XFAObjectArray();
  60418. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  60419. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  60420. this.event = new _xfa_object.XFAObjectArray();
  60421. this.exData = new _xfa_object.XFAObjectArray();
  60422. this.exObject = new _xfa_object.XFAObjectArray();
  60423. this.exclGroup = new _xfa_object.XFAObjectArray();
  60424. this.execute = new _xfa_object.XFAObjectArray();
  60425. this.extras = new _xfa_object.XFAObjectArray();
  60426. this.field = new _xfa_object.XFAObjectArray();
  60427. this.fill = new _xfa_object.XFAObjectArray();
  60428. this.filter = new _xfa_object.XFAObjectArray();
  60429. this.float = new _xfa_object.XFAObjectArray();
  60430. this.font = new _xfa_object.XFAObjectArray();
  60431. this.format = new _xfa_object.XFAObjectArray();
  60432. this.handler = new _xfa_object.XFAObjectArray();
  60433. this.hyphenation = new _xfa_object.XFAObjectArray();
  60434. this.image = new _xfa_object.XFAObjectArray();
  60435. this.imageEdit = new _xfa_object.XFAObjectArray();
  60436. this.integer = new _xfa_object.XFAObjectArray();
  60437. this.issuers = new _xfa_object.XFAObjectArray();
  60438. this.items = new _xfa_object.XFAObjectArray();
  60439. this.keep = new _xfa_object.XFAObjectArray();
  60440. this.keyUsage = new _xfa_object.XFAObjectArray();
  60441. this.line = new _xfa_object.XFAObjectArray();
  60442. this.linear = new _xfa_object.XFAObjectArray();
  60443. this.lockDocument = new _xfa_object.XFAObjectArray();
  60444. this.manifest = new _xfa_object.XFAObjectArray();
  60445. this.margin = new _xfa_object.XFAObjectArray();
  60446. this.mdp = new _xfa_object.XFAObjectArray();
  60447. this.medium = new _xfa_object.XFAObjectArray();
  60448. this.message = new _xfa_object.XFAObjectArray();
  60449. this.numericEdit = new _xfa_object.XFAObjectArray();
  60450. this.occur = new _xfa_object.XFAObjectArray();
  60451. this.oid = new _xfa_object.XFAObjectArray();
  60452. this.oids = new _xfa_object.XFAObjectArray();
  60453. this.overflow = new _xfa_object.XFAObjectArray();
  60454. this.pageArea = new _xfa_object.XFAObjectArray();
  60455. this.pageSet = new _xfa_object.XFAObjectArray();
  60456. this.para = new _xfa_object.XFAObjectArray();
  60457. this.passwordEdit = new _xfa_object.XFAObjectArray();
  60458. this.pattern = new _xfa_object.XFAObjectArray();
  60459. this.picture = new _xfa_object.XFAObjectArray();
  60460. this.radial = new _xfa_object.XFAObjectArray();
  60461. this.reason = new _xfa_object.XFAObjectArray();
  60462. this.reasons = new _xfa_object.XFAObjectArray();
  60463. this.rectangle = new _xfa_object.XFAObjectArray();
  60464. this.ref = new _xfa_object.XFAObjectArray();
  60465. this.script = new _xfa_object.XFAObjectArray();
  60466. this.setProperty = new _xfa_object.XFAObjectArray();
  60467. this.signData = new _xfa_object.XFAObjectArray();
  60468. this.signature = new _xfa_object.XFAObjectArray();
  60469. this.signing = new _xfa_object.XFAObjectArray();
  60470. this.solid = new _xfa_object.XFAObjectArray();
  60471. this.speak = new _xfa_object.XFAObjectArray();
  60472. this.stipple = new _xfa_object.XFAObjectArray();
  60473. this.subform = new _xfa_object.XFAObjectArray();
  60474. this.subformSet = new _xfa_object.XFAObjectArray();
  60475. this.subjectDN = new _xfa_object.XFAObjectArray();
  60476. this.subjectDNs = new _xfa_object.XFAObjectArray();
  60477. this.submit = new _xfa_object.XFAObjectArray();
  60478. this.text = new _xfa_object.XFAObjectArray();
  60479. this.textEdit = new _xfa_object.XFAObjectArray();
  60480. this.time = new _xfa_object.XFAObjectArray();
  60481. this.timeStamp = new _xfa_object.XFAObjectArray();
  60482. this.toolTip = new _xfa_object.XFAObjectArray();
  60483. this.traversal = new _xfa_object.XFAObjectArray();
  60484. this.traverse = new _xfa_object.XFAObjectArray();
  60485. this.ui = new _xfa_object.XFAObjectArray();
  60486. this.validate = new _xfa_object.XFAObjectArray();
  60487. this.value = new _xfa_object.XFAObjectArray();
  60488. this.variables = new _xfa_object.XFAObjectArray();
  60489. }
  60490. }
  60491. class Radial extends _xfa_object.XFAObject {
  60492. constructor(attributes) {
  60493. super(TEMPLATE_NS_ID, "radial", true);
  60494. this.id = attributes.id || "";
  60495. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  60496. this.use = attributes.use || "";
  60497. this.usehref = attributes.usehref || "";
  60498. this.color = null;
  60499. this.extras = null;
  60500. }
  60501. [_xfa_object.$toStyle](startColor) {
  60502. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60503. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  60504. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  60505. return `radial-gradient(circle at center, ${colors})`;
  60506. }
  60507. }
  60508. class Reason extends _xfa_object.StringObject {
  60509. constructor(attributes) {
  60510. super(TEMPLATE_NS_ID, "reason");
  60511. this.id = attributes.id || "";
  60512. this.name = attributes.name || "";
  60513. this.use = attributes.use || "";
  60514. this.usehref = attributes.usehref || "";
  60515. }
  60516. }
  60517. class Reasons extends _xfa_object.XFAObject {
  60518. constructor(attributes) {
  60519. super(TEMPLATE_NS_ID, "reasons", true);
  60520. this.id = attributes.id || "";
  60521. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60522. this.use = attributes.use || "";
  60523. this.usehref = attributes.usehref || "";
  60524. this.reason = new _xfa_object.XFAObjectArray();
  60525. }
  60526. }
  60527. class Rectangle extends _xfa_object.XFAObject {
  60528. constructor(attributes) {
  60529. super(TEMPLATE_NS_ID, "rectangle", true);
  60530. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  60531. this.id = attributes.id || "";
  60532. this.use = attributes.use || "";
  60533. this.usehref = attributes.usehref || "";
  60534. this.corner = new _xfa_object.XFAObjectArray(4);
  60535. this.edge = new _xfa_object.XFAObjectArray(4);
  60536. this.fill = null;
  60537. }
  60538. [_xfa_object.$toHTML]() {
  60539. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  60540. const edgeStyle = edge[_xfa_object.$toStyle]();
  60541. const style = Object.create(null);
  60542. if (this.fill && this.fill.presence === "visible") {
  60543. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  60544. } else {
  60545. style.fill = "transparent";
  60546. }
  60547. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  60548. style.stroke = edgeStyle.color;
  60549. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  60550. const cornerStyle = corner[_xfa_object.$toStyle]();
  60551. const rect = {
  60552. name: "rect",
  60553. attributes: {
  60554. xmlns: SVG_NS,
  60555. width: "100%",
  60556. height: "100%",
  60557. x: 0,
  60558. y: 0,
  60559. rx: cornerStyle.radius,
  60560. ry: cornerStyle.radius,
  60561. style
  60562. }
  60563. };
  60564. const svg = {
  60565. name: "svg",
  60566. children: [rect],
  60567. attributes: {
  60568. xmlns: SVG_NS,
  60569. style: {
  60570. overflow: "visible"
  60571. },
  60572. width: "100%",
  60573. height: "100%"
  60574. }
  60575. };
  60576. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  60577. if (hasMargin(parent)) {
  60578. return _utils.HTMLResult.success({
  60579. name: "div",
  60580. attributes: {
  60581. style: {
  60582. display: "inline",
  60583. width: "100%",
  60584. height: "100%"
  60585. }
  60586. },
  60587. children: [svg]
  60588. });
  60589. }
  60590. svg.attributes.style.position = "absolute";
  60591. return _utils.HTMLResult.success(svg);
  60592. }
  60593. }
  60594. class RefElement extends _xfa_object.StringObject {
  60595. constructor(attributes) {
  60596. super(TEMPLATE_NS_ID, "ref");
  60597. this.id = attributes.id || "";
  60598. this.use = attributes.use || "";
  60599. this.usehref = attributes.usehref || "";
  60600. }
  60601. }
  60602. class Script extends _xfa_object.StringObject {
  60603. constructor(attributes) {
  60604. super(TEMPLATE_NS_ID, "script");
  60605. this.binding = attributes.binding || "";
  60606. this.contentType = attributes.contentType || "";
  60607. this.id = attributes.id || "";
  60608. this.name = attributes.name || "";
  60609. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  60610. this.use = attributes.use || "";
  60611. this.usehref = attributes.usehref || "";
  60612. }
  60613. }
  60614. class SetProperty extends _xfa_object.XFAObject {
  60615. constructor(attributes) {
  60616. super(TEMPLATE_NS_ID, "setProperty");
  60617. this.connection = attributes.connection || "";
  60618. this.ref = attributes.ref || "";
  60619. this.target = attributes.target || "";
  60620. }
  60621. }
  60622. exports.SetProperty = SetProperty;
  60623. class SignData extends _xfa_object.XFAObject {
  60624. constructor(attributes) {
  60625. super(TEMPLATE_NS_ID, "signData", true);
  60626. this.id = attributes.id || "";
  60627. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  60628. this.ref = attributes.ref || "";
  60629. this.target = attributes.target || "";
  60630. this.use = attributes.use || "";
  60631. this.usehref = attributes.usehref || "";
  60632. this.filter = null;
  60633. this.manifest = null;
  60634. }
  60635. }
  60636. class Signature extends _xfa_object.XFAObject {
  60637. constructor(attributes) {
  60638. super(TEMPLATE_NS_ID, "signature", true);
  60639. this.id = attributes.id || "";
  60640. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  60641. this.use = attributes.use || "";
  60642. this.usehref = attributes.usehref || "";
  60643. this.border = null;
  60644. this.extras = null;
  60645. this.filter = null;
  60646. this.manifest = null;
  60647. this.margin = null;
  60648. }
  60649. }
  60650. class Signing extends _xfa_object.XFAObject {
  60651. constructor(attributes) {
  60652. super(TEMPLATE_NS_ID, "signing", true);
  60653. this.id = attributes.id || "";
  60654. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60655. this.use = attributes.use || "";
  60656. this.usehref = attributes.usehref || "";
  60657. this.certificate = new _xfa_object.XFAObjectArray();
  60658. }
  60659. }
  60660. class Solid extends _xfa_object.XFAObject {
  60661. constructor(attributes) {
  60662. super(TEMPLATE_NS_ID, "solid", true);
  60663. this.id = attributes.id || "";
  60664. this.use = attributes.use || "";
  60665. this.usehref = attributes.usehref || "";
  60666. this.extras = null;
  60667. }
  60668. [_xfa_object.$toStyle](startColor) {
  60669. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60670. }
  60671. }
  60672. class Speak extends _xfa_object.StringObject {
  60673. constructor(attributes) {
  60674. super(TEMPLATE_NS_ID, "speak");
  60675. this.disable = (0, _utils.getInteger)({
  60676. data: attributes.disable,
  60677. defaultValue: 0,
  60678. validate: x => x === 1
  60679. });
  60680. this.id = attributes.id || "";
  60681. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  60682. this.rid = attributes.rid || "";
  60683. this.use = attributes.use || "";
  60684. this.usehref = attributes.usehref || "";
  60685. }
  60686. }
  60687. class Stipple extends _xfa_object.XFAObject {
  60688. constructor(attributes) {
  60689. super(TEMPLATE_NS_ID, "stipple", true);
  60690. this.id = attributes.id || "";
  60691. this.rate = (0, _utils.getInteger)({
  60692. data: attributes.rate,
  60693. defaultValue: 50,
  60694. validate: x => x >= 0 && x <= 100
  60695. });
  60696. this.use = attributes.use || "";
  60697. this.usehref = attributes.usehref || "";
  60698. this.color = null;
  60699. this.extras = null;
  60700. }
  60701. [_xfa_object.$toStyle](bgColor) {
  60702. const alpha = this.rate / 100;
  60703. 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));
  60704. }
  60705. }
  60706. class Subform extends _xfa_object.XFAObject {
  60707. constructor(attributes) {
  60708. super(TEMPLATE_NS_ID, "subform", true);
  60709. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  60710. this.allowMacro = (0, _utils.getInteger)({
  60711. data: attributes.allowMacro,
  60712. defaultValue: 0,
  60713. validate: x => x === 1
  60714. });
  60715. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  60716. this.colSpan = (0, _utils.getInteger)({
  60717. data: attributes.colSpan,
  60718. defaultValue: 1,
  60719. validate: n => n >= 1 || n === -1
  60720. });
  60721. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  60722. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  60723. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  60724. this.id = attributes.id || "";
  60725. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  60726. this.locale = attributes.locale || "";
  60727. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  60728. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  60729. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  60730. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  60731. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  60732. this.name = attributes.name || "";
  60733. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  60734. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60735. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  60736. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  60737. this.use = attributes.use || "";
  60738. this.usehref = attributes.usehref || "";
  60739. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  60740. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  60741. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  60742. this.assist = null;
  60743. this.bind = null;
  60744. this.bookend = null;
  60745. this.border = null;
  60746. this.break = null;
  60747. this.calculate = null;
  60748. this.desc = null;
  60749. this.extras = null;
  60750. this.keep = null;
  60751. this.margin = null;
  60752. this.occur = null;
  60753. this.overflow = null;
  60754. this.pageSet = null;
  60755. this.para = null;
  60756. this.traversal = null;
  60757. this.validate = null;
  60758. this.variables = null;
  60759. this.area = new _xfa_object.XFAObjectArray();
  60760. this.breakAfter = new _xfa_object.XFAObjectArray();
  60761. this.breakBefore = new _xfa_object.XFAObjectArray();
  60762. this.connect = new _xfa_object.XFAObjectArray();
  60763. this.draw = new _xfa_object.XFAObjectArray();
  60764. this.event = new _xfa_object.XFAObjectArray();
  60765. this.exObject = new _xfa_object.XFAObjectArray();
  60766. this.exclGroup = new _xfa_object.XFAObjectArray();
  60767. this.field = new _xfa_object.XFAObjectArray();
  60768. this.proto = new _xfa_object.XFAObjectArray();
  60769. this.setProperty = new _xfa_object.XFAObjectArray();
  60770. this.subform = new _xfa_object.XFAObjectArray();
  60771. this.subformSet = new _xfa_object.XFAObjectArray();
  60772. }
  60773. [_xfa_object.$getSubformParent]() {
  60774. const parent = this[_xfa_object.$getParent]();
  60775. if (parent instanceof SubformSet) {
  60776. return parent[_xfa_object.$getSubformParent]();
  60777. }
  60778. return parent;
  60779. }
  60780. [_xfa_object.$isBindable]() {
  60781. return true;
  60782. }
  60783. [_xfa_object.$isThereMoreWidth]() {
  60784. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  60785. }
  60786. *[_xfa_object.$getContainedChildren]() {
  60787. yield* getContainedChildren(this);
  60788. }
  60789. [_xfa_object.$flushHTML]() {
  60790. return (0, _layout.flushHTML)(this);
  60791. }
  60792. [_xfa_object.$addHTML](html, bbox) {
  60793. (0, _layout.addHTML)(this, html, bbox);
  60794. }
  60795. [_xfa_object.$getAvailableSpace]() {
  60796. return (0, _layout.getAvailableSpace)(this);
  60797. }
  60798. [_xfa_object.$isSplittable]() {
  60799. const parent = this[_xfa_object.$getSubformParent]();
  60800. if (!parent[_xfa_object.$isSplittable]()) {
  60801. return false;
  60802. }
  60803. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  60804. return this[_xfa_object.$extra]._isSplittable;
  60805. }
  60806. if (this.layout === "position" || this.layout.includes("row")) {
  60807. this[_xfa_object.$extra]._isSplittable = false;
  60808. return false;
  60809. }
  60810. if (this.keep && this.keep.intact !== "none") {
  60811. this[_xfa_object.$extra]._isSplittable = false;
  60812. return false;
  60813. }
  60814. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  60815. return false;
  60816. }
  60817. this[_xfa_object.$extra]._isSplittable = true;
  60818. return true;
  60819. }
  60820. [_xfa_object.$toHTML](availableSpace) {
  60821. setTabIndex(this);
  60822. if (this.break) {
  60823. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  60824. const node = new BreakAfter({
  60825. targetType: this.break.after,
  60826. target: this.break.afterTarget,
  60827. startNew: this.break.startNew.toString()
  60828. });
  60829. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60830. this[_xfa_object.$appendChild](node);
  60831. this.breakAfter.push(node);
  60832. }
  60833. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  60834. const node = new BreakBefore({
  60835. targetType: this.break.before,
  60836. target: this.break.beforeTarget,
  60837. startNew: this.break.startNew.toString()
  60838. });
  60839. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60840. this[_xfa_object.$appendChild](node);
  60841. this.breakBefore.push(node);
  60842. }
  60843. if (this.break.overflowTarget !== "") {
  60844. const node = new Overflow({
  60845. target: this.break.overflowTarget,
  60846. leader: this.break.overflowLeader,
  60847. trailer: this.break.overflowTrailer
  60848. });
  60849. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60850. this[_xfa_object.$appendChild](node);
  60851. this.overflow.push(node);
  60852. }
  60853. this[_xfa_object.$removeChild](this.break);
  60854. this.break = null;
  60855. }
  60856. if (this.presence === "hidden" || this.presence === "inactive") {
  60857. return _utils.HTMLResult.EMPTY;
  60858. }
  60859. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  60860. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  60861. }
  60862. if (this.breakBefore.children.length >= 1) {
  60863. const breakBefore = this.breakBefore.children[0];
  60864. if (handleBreak(breakBefore)) {
  60865. return _utils.HTMLResult.breakNode(breakBefore);
  60866. }
  60867. }
  60868. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  60869. return _utils.HTMLResult.EMPTY;
  60870. }
  60871. (0, _html_utils.fixDimensions)(this);
  60872. const children = [];
  60873. const attributes = {
  60874. id: this[_xfa_object.$uid],
  60875. class: []
  60876. };
  60877. (0, _html_utils.setAccess)(this, attributes.class);
  60878. if (!this[_xfa_object.$extra]) {
  60879. this[_xfa_object.$extra] = Object.create(null);
  60880. }
  60881. Object.assign(this[_xfa_object.$extra], {
  60882. children,
  60883. line: null,
  60884. attributes,
  60885. attempt: 0,
  60886. numberInLine: 0,
  60887. availableSpace: {
  60888. width: Math.min(this.w || Infinity, availableSpace.width),
  60889. height: Math.min(this.h || Infinity, availableSpace.height)
  60890. },
  60891. width: 0,
  60892. height: 0,
  60893. prevHeight: 0,
  60894. currentWidth: 0
  60895. });
  60896. const root = this[_xfa_object.$getTemplateRoot]();
  60897. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  60898. const isSplittable = this[_xfa_object.$isSplittable]();
  60899. if (!isSplittable) {
  60900. setFirstUnsplittable(this);
  60901. }
  60902. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  60903. return _utils.HTMLResult.FAILURE;
  60904. }
  60905. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  60906. if (this.layout.includes("row")) {
  60907. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  60908. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  60909. this[_xfa_object.$extra].columnWidths = columnWidths;
  60910. this[_xfa_object.$extra].currentColumn = 0;
  60911. }
  60912. }
  60913. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  60914. const classNames = ["xfaSubform"];
  60915. const cl = (0, _html_utils.layoutClass)(this);
  60916. if (cl) {
  60917. classNames.push(cl);
  60918. }
  60919. attributes.style = style;
  60920. attributes.class = classNames;
  60921. if (this.name) {
  60922. attributes.xfaName = this.name;
  60923. }
  60924. if (this.overflow) {
  60925. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  60926. if (overflowExtra.addLeader) {
  60927. overflowExtra.addLeader = false;
  60928. handleOverflow(this, overflowExtra.leader, availableSpace);
  60929. }
  60930. }
  60931. this[_xfa_object.$pushPara]();
  60932. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  60933. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  60934. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  60935. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  60936. this[_xfa_object.$extra].numberInLine = 0;
  60937. }
  60938. const result = this[_xfa_object.$childrenToHTML]({
  60939. filter,
  60940. include: true
  60941. });
  60942. if (result.success) {
  60943. break;
  60944. }
  60945. if (result.isBreak()) {
  60946. this[_xfa_object.$popPara]();
  60947. return result;
  60948. }
  60949. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  60950. this[_xfa_object.$extra].attempt = maxRun;
  60951. break;
  60952. }
  60953. }
  60954. this[_xfa_object.$popPara]();
  60955. if (!isSplittable) {
  60956. unsetFirstUnsplittable(this);
  60957. }
  60958. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  60959. if (this[_xfa_object.$extra].attempt === maxRun) {
  60960. if (this.overflow) {
  60961. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  60962. }
  60963. if (!isSplittable) {
  60964. delete this[_xfa_object.$extra];
  60965. }
  60966. return _utils.HTMLResult.FAILURE;
  60967. }
  60968. if (this.overflow) {
  60969. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  60970. if (overflowExtra.addTrailer) {
  60971. overflowExtra.addTrailer = false;
  60972. handleOverflow(this, overflowExtra.trailer, availableSpace);
  60973. }
  60974. }
  60975. let marginH = 0;
  60976. let marginV = 0;
  60977. if (this.margin) {
  60978. marginH = this.margin.leftInset + this.margin.rightInset;
  60979. marginV = this.margin.topInset + this.margin.bottomInset;
  60980. }
  60981. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  60982. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  60983. const bbox = [this.x, this.y, width, height];
  60984. if (this.w === "") {
  60985. style.width = (0, _html_utils.measureToString)(width);
  60986. }
  60987. if (this.h === "") {
  60988. style.height = (0, _html_utils.measureToString)(height);
  60989. }
  60990. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  60991. return _utils.HTMLResult.EMPTY;
  60992. }
  60993. const html = {
  60994. name: "div",
  60995. attributes,
  60996. children
  60997. };
  60998. applyAssist(this, attributes);
  60999. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  61000. if (this.breakAfter.children.length >= 1) {
  61001. const breakAfter = this.breakAfter.children[0];
  61002. if (handleBreak(breakAfter)) {
  61003. this[_xfa_object.$extra].afterBreakAfter = result;
  61004. return _utils.HTMLResult.breakNode(breakAfter);
  61005. }
  61006. }
  61007. delete this[_xfa_object.$extra];
  61008. return result;
  61009. }
  61010. }
  61011. class SubformSet extends _xfa_object.XFAObject {
  61012. constructor(attributes) {
  61013. super(TEMPLATE_NS_ID, "subformSet", true);
  61014. this.id = attributes.id || "";
  61015. this.name = attributes.name || "";
  61016. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  61017. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  61018. this.use = attributes.use || "";
  61019. this.usehref = attributes.usehref || "";
  61020. this.bookend = null;
  61021. this.break = null;
  61022. this.desc = null;
  61023. this.extras = null;
  61024. this.occur = null;
  61025. this.overflow = null;
  61026. this.breakAfter = new _xfa_object.XFAObjectArray();
  61027. this.breakBefore = new _xfa_object.XFAObjectArray();
  61028. this.subform = new _xfa_object.XFAObjectArray();
  61029. this.subformSet = new _xfa_object.XFAObjectArray();
  61030. }
  61031. *[_xfa_object.$getContainedChildren]() {
  61032. yield* getContainedChildren(this);
  61033. }
  61034. [_xfa_object.$getSubformParent]() {
  61035. let parent = this[_xfa_object.$getParent]();
  61036. while (!(parent instanceof Subform)) {
  61037. parent = parent[_xfa_object.$getParent]();
  61038. }
  61039. return parent;
  61040. }
  61041. [_xfa_object.$isBindable]() {
  61042. return true;
  61043. }
  61044. }
  61045. class SubjectDN extends _xfa_object.ContentObject {
  61046. constructor(attributes) {
  61047. super(TEMPLATE_NS_ID, "subjectDN");
  61048. this.delimiter = attributes.delimiter || ",";
  61049. this.id = attributes.id || "";
  61050. this.name = attributes.name || "";
  61051. this.use = attributes.use || "";
  61052. this.usehref = attributes.usehref || "";
  61053. }
  61054. [_xfa_object.$finalize]() {
  61055. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  61056. kv = kv.split("=", 2);
  61057. kv[0] = kv[0].trim();
  61058. return kv;
  61059. }));
  61060. }
  61061. }
  61062. class SubjectDNs extends _xfa_object.XFAObject {
  61063. constructor(attributes) {
  61064. super(TEMPLATE_NS_ID, "subjectDNs", true);
  61065. this.id = attributes.id || "";
  61066. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  61067. this.use = attributes.use || "";
  61068. this.usehref = attributes.usehref || "";
  61069. this.subjectDN = new _xfa_object.XFAObjectArray();
  61070. }
  61071. }
  61072. class Submit extends _xfa_object.XFAObject {
  61073. constructor(attributes) {
  61074. super(TEMPLATE_NS_ID, "submit", true);
  61075. this.embedPDF = (0, _utils.getInteger)({
  61076. data: attributes.embedPDF,
  61077. defaultValue: 0,
  61078. validate: x => x === 1
  61079. });
  61080. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  61081. this.id = attributes.id || "";
  61082. this.target = attributes.target || "";
  61083. this.textEncoding = (0, _utils.getKeyword)({
  61084. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  61085. defaultValue: "",
  61086. 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}/)
  61087. });
  61088. this.use = attributes.use || "";
  61089. this.usehref = attributes.usehref || "";
  61090. this.xdpContent = attributes.xdpContent || "";
  61091. this.encrypt = null;
  61092. this.encryptData = new _xfa_object.XFAObjectArray();
  61093. this.signData = new _xfa_object.XFAObjectArray();
  61094. }
  61095. }
  61096. class Template extends _xfa_object.XFAObject {
  61097. constructor(attributes) {
  61098. super(TEMPLATE_NS_ID, "template", true);
  61099. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  61100. this.extras = null;
  61101. this.subform = new _xfa_object.XFAObjectArray();
  61102. }
  61103. [_xfa_object.$finalize]() {
  61104. if (this.subform.children.length === 0) {
  61105. (0, _util.warn)("XFA - No subforms in template node.");
  61106. }
  61107. if (this.subform.children.length >= 2) {
  61108. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  61109. }
  61110. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  61111. }
  61112. [_xfa_object.$isSplittable]() {
  61113. return true;
  61114. }
  61115. [_xfa_object.$searchNode](expr, container) {
  61116. if (expr.startsWith("#")) {
  61117. return [this[_xfa_object.$ids].get(expr.slice(1))];
  61118. }
  61119. return (0, _som.searchNode)(this, container, expr, true, true);
  61120. }
  61121. *[_xfa_object.$toPages]() {
  61122. if (!this.subform.children.length) {
  61123. return _utils.HTMLResult.success({
  61124. name: "div",
  61125. children: []
  61126. });
  61127. }
  61128. this[_xfa_object.$extra] = {
  61129. overflowNode: null,
  61130. firstUnsplittable: null,
  61131. currentContentArea: null,
  61132. currentPageArea: null,
  61133. noLayoutFailure: false,
  61134. pageNumber: 1,
  61135. pagePosition: "first",
  61136. oddOrEven: "odd",
  61137. blankOrNotBlank: "nonBlank",
  61138. paraStack: []
  61139. };
  61140. const root = this.subform.children[0];
  61141. root.pageSet[_xfa_object.$cleanPage]();
  61142. const pageAreas = root.pageSet.pageArea.children;
  61143. const mainHtml = {
  61144. name: "div",
  61145. children: []
  61146. };
  61147. let pageArea = null;
  61148. let breakBefore = null;
  61149. let breakBeforeTarget = null;
  61150. if (root.breakBefore.children.length >= 1) {
  61151. breakBefore = root.breakBefore.children[0];
  61152. breakBeforeTarget = breakBefore.target;
  61153. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  61154. breakBefore = root.subform.children[0].breakBefore.children[0];
  61155. breakBeforeTarget = breakBefore.target;
  61156. } else if (root.break && root.break.beforeTarget) {
  61157. breakBefore = root.break;
  61158. breakBeforeTarget = breakBefore.beforeTarget;
  61159. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  61160. breakBefore = root.subform.children[0].break;
  61161. breakBeforeTarget = breakBefore.beforeTarget;
  61162. }
  61163. if (breakBefore) {
  61164. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  61165. if (target instanceof PageArea) {
  61166. pageArea = target;
  61167. breakBefore[_xfa_object.$extra] = {};
  61168. }
  61169. }
  61170. if (!pageArea) {
  61171. pageArea = pageAreas[0];
  61172. }
  61173. pageArea[_xfa_object.$extra] = {
  61174. numberOfUse: 1
  61175. };
  61176. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  61177. pageAreaParent[_xfa_object.$extra] = {
  61178. numberOfUse: 1,
  61179. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  61180. pageSetIndex: 0
  61181. };
  61182. let targetPageArea;
  61183. let leader = null;
  61184. let trailer = null;
  61185. let hasSomething = true;
  61186. let hasSomethingCounter = 0;
  61187. let startIndex = 0;
  61188. while (true) {
  61189. if (!hasSomething) {
  61190. mainHtml.children.pop();
  61191. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  61192. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  61193. return mainHtml;
  61194. }
  61195. } else {
  61196. hasSomethingCounter = 0;
  61197. }
  61198. targetPageArea = null;
  61199. this[_xfa_object.$extra].currentPageArea = pageArea;
  61200. const page = pageArea[_xfa_object.$toHTML]().html;
  61201. mainHtml.children.push(page);
  61202. if (leader) {
  61203. this[_xfa_object.$extra].noLayoutFailure = true;
  61204. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  61205. leader = null;
  61206. }
  61207. if (trailer) {
  61208. this[_xfa_object.$extra].noLayoutFailure = true;
  61209. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  61210. trailer = null;
  61211. }
  61212. const contentAreas = pageArea.contentArea.children;
  61213. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  61214. hasSomething = false;
  61215. this[_xfa_object.$extra].firstUnsplittable = null;
  61216. this[_xfa_object.$extra].noLayoutFailure = false;
  61217. const flush = index => {
  61218. const html = root[_xfa_object.$flushHTML]();
  61219. if (html) {
  61220. hasSomething = hasSomething || html.children && html.children.length !== 0;
  61221. htmlContentAreas[index].children.push(html);
  61222. }
  61223. };
  61224. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  61225. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  61226. const space = {
  61227. width: contentArea.w,
  61228. height: contentArea.h
  61229. };
  61230. startIndex = 0;
  61231. if (leader) {
  61232. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  61233. leader = null;
  61234. }
  61235. if (trailer) {
  61236. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  61237. trailer = null;
  61238. }
  61239. const html = root[_xfa_object.$toHTML](space);
  61240. if (html.success) {
  61241. if (html.html) {
  61242. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  61243. htmlContentAreas[i].children.push(html.html);
  61244. } else if (!hasSomething && mainHtml.children.length > 1) {
  61245. mainHtml.children.pop();
  61246. }
  61247. return mainHtml;
  61248. }
  61249. if (html.isBreak()) {
  61250. const node = html.breakNode;
  61251. flush(i);
  61252. if (node.targetType === "auto") {
  61253. continue;
  61254. }
  61255. if (node.leader) {
  61256. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  61257. leader = leader ? leader[0] : null;
  61258. }
  61259. if (node.trailer) {
  61260. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  61261. trailer = trailer ? trailer[0] : null;
  61262. }
  61263. if (node.targetType === "pageArea") {
  61264. targetPageArea = node[_xfa_object.$extra].target;
  61265. i = Infinity;
  61266. } else if (!node[_xfa_object.$extra].target) {
  61267. i = node[_xfa_object.$extra].index;
  61268. } else {
  61269. targetPageArea = node[_xfa_object.$extra].target;
  61270. startIndex = node[_xfa_object.$extra].index + 1;
  61271. i = Infinity;
  61272. }
  61273. continue;
  61274. }
  61275. if (this[_xfa_object.$extra].overflowNode) {
  61276. const node = this[_xfa_object.$extra].overflowNode;
  61277. this[_xfa_object.$extra].overflowNode = null;
  61278. const overflowExtra = node[_xfa_object.$getExtra]();
  61279. const target = overflowExtra.target;
  61280. overflowExtra.addLeader = overflowExtra.leader !== null;
  61281. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  61282. flush(i);
  61283. const currentIndex = i;
  61284. i = Infinity;
  61285. if (target instanceof PageArea) {
  61286. targetPageArea = target;
  61287. } else if (target instanceof ContentArea) {
  61288. const index = contentAreas.indexOf(target);
  61289. if (index !== -1) {
  61290. if (index > currentIndex) {
  61291. i = index - 1;
  61292. } else {
  61293. startIndex = index;
  61294. }
  61295. } else {
  61296. targetPageArea = target[_xfa_object.$getParent]();
  61297. startIndex = targetPageArea.contentArea.children.indexOf(target);
  61298. }
  61299. }
  61300. continue;
  61301. }
  61302. flush(i);
  61303. }
  61304. this[_xfa_object.$extra].pageNumber += 1;
  61305. if (targetPageArea) {
  61306. if (targetPageArea[_xfa_object.$isUsable]()) {
  61307. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  61308. } else {
  61309. targetPageArea = null;
  61310. }
  61311. }
  61312. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  61313. yield null;
  61314. }
  61315. }
  61316. }
  61317. exports.Template = Template;
  61318. class Text extends _xfa_object.ContentObject {
  61319. constructor(attributes) {
  61320. super(TEMPLATE_NS_ID, "text");
  61321. this.id = attributes.id || "";
  61322. this.maxChars = (0, _utils.getInteger)({
  61323. data: attributes.maxChars,
  61324. defaultValue: 0,
  61325. validate: x => x >= 0
  61326. });
  61327. this.name = attributes.name || "";
  61328. this.rid = attributes.rid || "";
  61329. this.use = attributes.use || "";
  61330. this.usehref = attributes.usehref || "";
  61331. }
  61332. [_xfa_object.$acceptWhitespace]() {
  61333. return true;
  61334. }
  61335. [_xfa_object.$onChild](child) {
  61336. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  61337. this[_xfa_object.$content] = child;
  61338. return true;
  61339. }
  61340. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  61341. return false;
  61342. }
  61343. [_xfa_object.$onText](str) {
  61344. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  61345. return;
  61346. }
  61347. super[_xfa_object.$onText](str);
  61348. }
  61349. [_xfa_object.$finalize]() {
  61350. if (typeof this[_xfa_object.$content] === "string") {
  61351. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  61352. }
  61353. }
  61354. [_xfa_object.$getExtra]() {
  61355. if (typeof this[_xfa_object.$content] === "string") {
  61356. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  61357. if (line) {
  61358. acc.push(line);
  61359. }
  61360. return acc;
  61361. }, []).join("\n");
  61362. }
  61363. return this[_xfa_object.$content][_xfa_object.$text]();
  61364. }
  61365. [_xfa_object.$toHTML](availableSpace) {
  61366. if (typeof this[_xfa_object.$content] === "string") {
  61367. const html = valueToHtml(this[_xfa_object.$content]).html;
  61368. if (this[_xfa_object.$content].includes("\u2029")) {
  61369. html.name = "div";
  61370. html.children = [];
  61371. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  61372. acc.push({
  61373. name: "span",
  61374. value: line
  61375. }, {
  61376. name: "br"
  61377. });
  61378. return acc;
  61379. }, [])).forEach(lines => {
  61380. html.children.push({
  61381. name: "p",
  61382. children: lines
  61383. });
  61384. });
  61385. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  61386. html.name = "div";
  61387. html.children = [];
  61388. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  61389. html.children.push({
  61390. name: "span",
  61391. value: line
  61392. }, {
  61393. name: "br"
  61394. });
  61395. });
  61396. }
  61397. return _utils.HTMLResult.success(html);
  61398. }
  61399. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  61400. }
  61401. }
  61402. exports.Text = Text;
  61403. class TextEdit extends _xfa_object.XFAObject {
  61404. constructor(attributes) {
  61405. super(TEMPLATE_NS_ID, "textEdit", true);
  61406. this.allowRichText = (0, _utils.getInteger)({
  61407. data: attributes.allowRichText,
  61408. defaultValue: 0,
  61409. validate: x => x === 1
  61410. });
  61411. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  61412. this.id = attributes.id || "";
  61413. this.multiLine = (0, _utils.getInteger)({
  61414. data: attributes.multiLine,
  61415. defaultValue: "",
  61416. validate: x => x === 0 || x === 1
  61417. });
  61418. this.use = attributes.use || "";
  61419. this.usehref = attributes.usehref || "";
  61420. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  61421. this.border = null;
  61422. this.comb = null;
  61423. this.extras = null;
  61424. this.margin = null;
  61425. }
  61426. [_xfa_object.$toHTML](availableSpace) {
  61427. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  61428. let html;
  61429. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  61430. if (this.multiLine === "") {
  61431. this.multiLine = field instanceof Draw ? 1 : 0;
  61432. }
  61433. if (this.multiLine === 1) {
  61434. html = {
  61435. name: "textarea",
  61436. attributes: {
  61437. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  61438. fieldId: field[_xfa_object.$uid],
  61439. class: ["xfaTextfield"],
  61440. style,
  61441. "aria-label": ariaLabel(field),
  61442. "aria-required": false
  61443. }
  61444. };
  61445. } else {
  61446. html = {
  61447. name: "input",
  61448. attributes: {
  61449. type: "text",
  61450. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  61451. fieldId: field[_xfa_object.$uid],
  61452. class: ["xfaTextfield"],
  61453. style,
  61454. "aria-label": ariaLabel(field),
  61455. "aria-required": false
  61456. }
  61457. };
  61458. }
  61459. if (isRequired(field)) {
  61460. html.attributes["aria-required"] = true;
  61461. html.attributes.required = true;
  61462. }
  61463. return _utils.HTMLResult.success({
  61464. name: "label",
  61465. attributes: {
  61466. class: ["xfaLabel"]
  61467. },
  61468. children: [html]
  61469. });
  61470. }
  61471. }
  61472. class Time extends _xfa_object.StringObject {
  61473. constructor(attributes) {
  61474. super(TEMPLATE_NS_ID, "time");
  61475. this.id = attributes.id || "";
  61476. this.name = attributes.name || "";
  61477. this.use = attributes.use || "";
  61478. this.usehref = attributes.usehref || "";
  61479. }
  61480. [_xfa_object.$finalize]() {
  61481. const date = this[_xfa_object.$content].trim();
  61482. this[_xfa_object.$content] = date ? new Date(date) : null;
  61483. }
  61484. [_xfa_object.$toHTML](availableSpace) {
  61485. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  61486. }
  61487. }
  61488. class TimeStamp extends _xfa_object.XFAObject {
  61489. constructor(attributes) {
  61490. super(TEMPLATE_NS_ID, "timeStamp");
  61491. this.id = attributes.id || "";
  61492. this.server = attributes.server || "";
  61493. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  61494. this.use = attributes.use || "";
  61495. this.usehref = attributes.usehref || "";
  61496. }
  61497. }
  61498. class ToolTip extends _xfa_object.StringObject {
  61499. constructor(attributes) {
  61500. super(TEMPLATE_NS_ID, "toolTip");
  61501. this.id = attributes.id || "";
  61502. this.rid = attributes.rid || "";
  61503. this.use = attributes.use || "";
  61504. this.usehref = attributes.usehref || "";
  61505. }
  61506. }
  61507. class Traversal extends _xfa_object.XFAObject {
  61508. constructor(attributes) {
  61509. super(TEMPLATE_NS_ID, "traversal", true);
  61510. this.id = attributes.id || "";
  61511. this.use = attributes.use || "";
  61512. this.usehref = attributes.usehref || "";
  61513. this.extras = null;
  61514. this.traverse = new _xfa_object.XFAObjectArray();
  61515. }
  61516. }
  61517. class Traverse extends _xfa_object.XFAObject {
  61518. constructor(attributes) {
  61519. super(TEMPLATE_NS_ID, "traverse", true);
  61520. this.id = attributes.id || "";
  61521. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  61522. this.ref = attributes.ref || "";
  61523. this.use = attributes.use || "";
  61524. this.usehref = attributes.usehref || "";
  61525. this.extras = null;
  61526. this.script = null;
  61527. }
  61528. get name() {
  61529. return this.operation;
  61530. }
  61531. [_xfa_object.$isTransparent]() {
  61532. return false;
  61533. }
  61534. }
  61535. class Ui extends _xfa_object.XFAObject {
  61536. constructor(attributes) {
  61537. super(TEMPLATE_NS_ID, "ui", true);
  61538. this.id = attributes.id || "";
  61539. this.use = attributes.use || "";
  61540. this.usehref = attributes.usehref || "";
  61541. this.extras = null;
  61542. this.picture = null;
  61543. this.barcode = null;
  61544. this.button = null;
  61545. this.checkButton = null;
  61546. this.choiceList = null;
  61547. this.dateTimeEdit = null;
  61548. this.defaultUi = null;
  61549. this.imageEdit = null;
  61550. this.numericEdit = null;
  61551. this.passwordEdit = null;
  61552. this.signature = null;
  61553. this.textEdit = null;
  61554. }
  61555. [_xfa_object.$getExtra]() {
  61556. if (this[_xfa_object.$extra] === undefined) {
  61557. for (const name of Object.getOwnPropertyNames(this)) {
  61558. if (name === "extras" || name === "picture") {
  61559. continue;
  61560. }
  61561. const obj = this[name];
  61562. if (!(obj instanceof _xfa_object.XFAObject)) {
  61563. continue;
  61564. }
  61565. this[_xfa_object.$extra] = obj;
  61566. return obj;
  61567. }
  61568. this[_xfa_object.$extra] = null;
  61569. }
  61570. return this[_xfa_object.$extra];
  61571. }
  61572. [_xfa_object.$toHTML](availableSpace) {
  61573. const obj = this[_xfa_object.$getExtra]();
  61574. if (obj) {
  61575. return obj[_xfa_object.$toHTML](availableSpace);
  61576. }
  61577. return _utils.HTMLResult.EMPTY;
  61578. }
  61579. }
  61580. class Validate extends _xfa_object.XFAObject {
  61581. constructor(attributes) {
  61582. super(TEMPLATE_NS_ID, "validate", true);
  61583. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  61584. this.id = attributes.id || "";
  61585. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  61586. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  61587. this.use = attributes.use || "";
  61588. this.usehref = attributes.usehref || "";
  61589. this.extras = null;
  61590. this.message = null;
  61591. this.picture = null;
  61592. this.script = null;
  61593. }
  61594. }
  61595. class Value extends _xfa_object.XFAObject {
  61596. constructor(attributes) {
  61597. super(TEMPLATE_NS_ID, "value", true);
  61598. this.id = attributes.id || "";
  61599. this.override = (0, _utils.getInteger)({
  61600. data: attributes.override,
  61601. defaultValue: 0,
  61602. validate: x => x === 1
  61603. });
  61604. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  61605. this.use = attributes.use || "";
  61606. this.usehref = attributes.usehref || "";
  61607. this.arc = null;
  61608. this.boolean = null;
  61609. this.date = null;
  61610. this.dateTime = null;
  61611. this.decimal = null;
  61612. this.exData = null;
  61613. this.float = null;
  61614. this.image = null;
  61615. this.integer = null;
  61616. this.line = null;
  61617. this.rectangle = null;
  61618. this.text = null;
  61619. this.time = null;
  61620. }
  61621. [_xfa_object.$setValue](value) {
  61622. const parent = this[_xfa_object.$getParent]();
  61623. if (parent instanceof Field) {
  61624. if (parent.ui && parent.ui.imageEdit) {
  61625. if (!this.image) {
  61626. this.image = new Image({});
  61627. this[_xfa_object.$appendChild](this.image);
  61628. }
  61629. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  61630. return;
  61631. }
  61632. }
  61633. const valueName = value[_xfa_object.$nodeName];
  61634. if (this[valueName] !== null) {
  61635. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  61636. return;
  61637. }
  61638. for (const name of Object.getOwnPropertyNames(this)) {
  61639. const obj = this[name];
  61640. if (obj instanceof _xfa_object.XFAObject) {
  61641. this[name] = null;
  61642. this[_xfa_object.$removeChild](obj);
  61643. }
  61644. }
  61645. this[value[_xfa_object.$nodeName]] = value;
  61646. this[_xfa_object.$appendChild](value);
  61647. }
  61648. [_xfa_object.$text]() {
  61649. if (this.exData) {
  61650. if (typeof this.exData[_xfa_object.$content] === "string") {
  61651. return this.exData[_xfa_object.$content].trim();
  61652. }
  61653. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  61654. }
  61655. for (const name of Object.getOwnPropertyNames(this)) {
  61656. if (name === "image") {
  61657. continue;
  61658. }
  61659. const obj = this[name];
  61660. if (obj instanceof _xfa_object.XFAObject) {
  61661. return (obj[_xfa_object.$content] || "").toString().trim();
  61662. }
  61663. }
  61664. return null;
  61665. }
  61666. [_xfa_object.$toHTML](availableSpace) {
  61667. for (const name of Object.getOwnPropertyNames(this)) {
  61668. const obj = this[name];
  61669. if (!(obj instanceof _xfa_object.XFAObject)) {
  61670. continue;
  61671. }
  61672. return obj[_xfa_object.$toHTML](availableSpace);
  61673. }
  61674. return _utils.HTMLResult.EMPTY;
  61675. }
  61676. }
  61677. exports.Value = Value;
  61678. class Variables extends _xfa_object.XFAObject {
  61679. constructor(attributes) {
  61680. super(TEMPLATE_NS_ID, "variables", true);
  61681. this.id = attributes.id || "";
  61682. this.use = attributes.use || "";
  61683. this.usehref = attributes.usehref || "";
  61684. this.boolean = new _xfa_object.XFAObjectArray();
  61685. this.date = new _xfa_object.XFAObjectArray();
  61686. this.dateTime = new _xfa_object.XFAObjectArray();
  61687. this.decimal = new _xfa_object.XFAObjectArray();
  61688. this.exData = new _xfa_object.XFAObjectArray();
  61689. this.float = new _xfa_object.XFAObjectArray();
  61690. this.image = new _xfa_object.XFAObjectArray();
  61691. this.integer = new _xfa_object.XFAObjectArray();
  61692. this.manifest = new _xfa_object.XFAObjectArray();
  61693. this.script = new _xfa_object.XFAObjectArray();
  61694. this.text = new _xfa_object.XFAObjectArray();
  61695. this.time = new _xfa_object.XFAObjectArray();
  61696. }
  61697. [_xfa_object.$isTransparent]() {
  61698. return true;
  61699. }
  61700. }
  61701. class TemplateNamespace {
  61702. static [_namespaces.$buildXFAObject](name, attributes) {
  61703. if (TemplateNamespace.hasOwnProperty(name)) {
  61704. const node = TemplateNamespace[name](attributes);
  61705. node[_xfa_object.$setSetAttributes](attributes);
  61706. return node;
  61707. }
  61708. return undefined;
  61709. }
  61710. static appearanceFilter(attrs) {
  61711. return new AppearanceFilter(attrs);
  61712. }
  61713. static arc(attrs) {
  61714. return new Arc(attrs);
  61715. }
  61716. static area(attrs) {
  61717. return new Area(attrs);
  61718. }
  61719. static assist(attrs) {
  61720. return new Assist(attrs);
  61721. }
  61722. static barcode(attrs) {
  61723. return new Barcode(attrs);
  61724. }
  61725. static bind(attrs) {
  61726. return new Bind(attrs);
  61727. }
  61728. static bindItems(attrs) {
  61729. return new BindItems(attrs);
  61730. }
  61731. static bookend(attrs) {
  61732. return new Bookend(attrs);
  61733. }
  61734. static boolean(attrs) {
  61735. return new BooleanElement(attrs);
  61736. }
  61737. static border(attrs) {
  61738. return new Border(attrs);
  61739. }
  61740. static break(attrs) {
  61741. return new Break(attrs);
  61742. }
  61743. static breakAfter(attrs) {
  61744. return new BreakAfter(attrs);
  61745. }
  61746. static breakBefore(attrs) {
  61747. return new BreakBefore(attrs);
  61748. }
  61749. static button(attrs) {
  61750. return new Button(attrs);
  61751. }
  61752. static calculate(attrs) {
  61753. return new Calculate(attrs);
  61754. }
  61755. static caption(attrs) {
  61756. return new Caption(attrs);
  61757. }
  61758. static certificate(attrs) {
  61759. return new Certificate(attrs);
  61760. }
  61761. static certificates(attrs) {
  61762. return new Certificates(attrs);
  61763. }
  61764. static checkButton(attrs) {
  61765. return new CheckButton(attrs);
  61766. }
  61767. static choiceList(attrs) {
  61768. return new ChoiceList(attrs);
  61769. }
  61770. static color(attrs) {
  61771. return new Color(attrs);
  61772. }
  61773. static comb(attrs) {
  61774. return new Comb(attrs);
  61775. }
  61776. static connect(attrs) {
  61777. return new Connect(attrs);
  61778. }
  61779. static contentArea(attrs) {
  61780. return new ContentArea(attrs);
  61781. }
  61782. static corner(attrs) {
  61783. return new Corner(attrs);
  61784. }
  61785. static date(attrs) {
  61786. return new DateElement(attrs);
  61787. }
  61788. static dateTime(attrs) {
  61789. return new DateTime(attrs);
  61790. }
  61791. static dateTimeEdit(attrs) {
  61792. return new DateTimeEdit(attrs);
  61793. }
  61794. static decimal(attrs) {
  61795. return new Decimal(attrs);
  61796. }
  61797. static defaultUi(attrs) {
  61798. return new DefaultUi(attrs);
  61799. }
  61800. static desc(attrs) {
  61801. return new Desc(attrs);
  61802. }
  61803. static digestMethod(attrs) {
  61804. return new DigestMethod(attrs);
  61805. }
  61806. static digestMethods(attrs) {
  61807. return new DigestMethods(attrs);
  61808. }
  61809. static draw(attrs) {
  61810. return new Draw(attrs);
  61811. }
  61812. static edge(attrs) {
  61813. return new Edge(attrs);
  61814. }
  61815. static encoding(attrs) {
  61816. return new Encoding(attrs);
  61817. }
  61818. static encodings(attrs) {
  61819. return new Encodings(attrs);
  61820. }
  61821. static encrypt(attrs) {
  61822. return new Encrypt(attrs);
  61823. }
  61824. static encryptData(attrs) {
  61825. return new EncryptData(attrs);
  61826. }
  61827. static encryption(attrs) {
  61828. return new Encryption(attrs);
  61829. }
  61830. static encryptionMethod(attrs) {
  61831. return new EncryptionMethod(attrs);
  61832. }
  61833. static encryptionMethods(attrs) {
  61834. return new EncryptionMethods(attrs);
  61835. }
  61836. static event(attrs) {
  61837. return new Event(attrs);
  61838. }
  61839. static exData(attrs) {
  61840. return new ExData(attrs);
  61841. }
  61842. static exObject(attrs) {
  61843. return new ExObject(attrs);
  61844. }
  61845. static exclGroup(attrs) {
  61846. return new ExclGroup(attrs);
  61847. }
  61848. static execute(attrs) {
  61849. return new Execute(attrs);
  61850. }
  61851. static extras(attrs) {
  61852. return new Extras(attrs);
  61853. }
  61854. static field(attrs) {
  61855. return new Field(attrs);
  61856. }
  61857. static fill(attrs) {
  61858. return new Fill(attrs);
  61859. }
  61860. static filter(attrs) {
  61861. return new Filter(attrs);
  61862. }
  61863. static float(attrs) {
  61864. return new Float(attrs);
  61865. }
  61866. static font(attrs) {
  61867. return new Font(attrs);
  61868. }
  61869. static format(attrs) {
  61870. return new Format(attrs);
  61871. }
  61872. static handler(attrs) {
  61873. return new Handler(attrs);
  61874. }
  61875. static hyphenation(attrs) {
  61876. return new Hyphenation(attrs);
  61877. }
  61878. static image(attrs) {
  61879. return new Image(attrs);
  61880. }
  61881. static imageEdit(attrs) {
  61882. return new ImageEdit(attrs);
  61883. }
  61884. static integer(attrs) {
  61885. return new Integer(attrs);
  61886. }
  61887. static issuers(attrs) {
  61888. return new Issuers(attrs);
  61889. }
  61890. static items(attrs) {
  61891. return new Items(attrs);
  61892. }
  61893. static keep(attrs) {
  61894. return new Keep(attrs);
  61895. }
  61896. static keyUsage(attrs) {
  61897. return new KeyUsage(attrs);
  61898. }
  61899. static line(attrs) {
  61900. return new Line(attrs);
  61901. }
  61902. static linear(attrs) {
  61903. return new Linear(attrs);
  61904. }
  61905. static lockDocument(attrs) {
  61906. return new LockDocument(attrs);
  61907. }
  61908. static manifest(attrs) {
  61909. return new Manifest(attrs);
  61910. }
  61911. static margin(attrs) {
  61912. return new Margin(attrs);
  61913. }
  61914. static mdp(attrs) {
  61915. return new Mdp(attrs);
  61916. }
  61917. static medium(attrs) {
  61918. return new Medium(attrs);
  61919. }
  61920. static message(attrs) {
  61921. return new Message(attrs);
  61922. }
  61923. static numericEdit(attrs) {
  61924. return new NumericEdit(attrs);
  61925. }
  61926. static occur(attrs) {
  61927. return new Occur(attrs);
  61928. }
  61929. static oid(attrs) {
  61930. return new Oid(attrs);
  61931. }
  61932. static oids(attrs) {
  61933. return new Oids(attrs);
  61934. }
  61935. static overflow(attrs) {
  61936. return new Overflow(attrs);
  61937. }
  61938. static pageArea(attrs) {
  61939. return new PageArea(attrs);
  61940. }
  61941. static pageSet(attrs) {
  61942. return new PageSet(attrs);
  61943. }
  61944. static para(attrs) {
  61945. return new Para(attrs);
  61946. }
  61947. static passwordEdit(attrs) {
  61948. return new PasswordEdit(attrs);
  61949. }
  61950. static pattern(attrs) {
  61951. return new Pattern(attrs);
  61952. }
  61953. static picture(attrs) {
  61954. return new Picture(attrs);
  61955. }
  61956. static proto(attrs) {
  61957. return new Proto(attrs);
  61958. }
  61959. static radial(attrs) {
  61960. return new Radial(attrs);
  61961. }
  61962. static reason(attrs) {
  61963. return new Reason(attrs);
  61964. }
  61965. static reasons(attrs) {
  61966. return new Reasons(attrs);
  61967. }
  61968. static rectangle(attrs) {
  61969. return new Rectangle(attrs);
  61970. }
  61971. static ref(attrs) {
  61972. return new RefElement(attrs);
  61973. }
  61974. static script(attrs) {
  61975. return new Script(attrs);
  61976. }
  61977. static setProperty(attrs) {
  61978. return new SetProperty(attrs);
  61979. }
  61980. static signData(attrs) {
  61981. return new SignData(attrs);
  61982. }
  61983. static signature(attrs) {
  61984. return new Signature(attrs);
  61985. }
  61986. static signing(attrs) {
  61987. return new Signing(attrs);
  61988. }
  61989. static solid(attrs) {
  61990. return new Solid(attrs);
  61991. }
  61992. static speak(attrs) {
  61993. return new Speak(attrs);
  61994. }
  61995. static stipple(attrs) {
  61996. return new Stipple(attrs);
  61997. }
  61998. static subform(attrs) {
  61999. return new Subform(attrs);
  62000. }
  62001. static subformSet(attrs) {
  62002. return new SubformSet(attrs);
  62003. }
  62004. static subjectDN(attrs) {
  62005. return new SubjectDN(attrs);
  62006. }
  62007. static subjectDNs(attrs) {
  62008. return new SubjectDNs(attrs);
  62009. }
  62010. static submit(attrs) {
  62011. return new Submit(attrs);
  62012. }
  62013. static template(attrs) {
  62014. return new Template(attrs);
  62015. }
  62016. static text(attrs) {
  62017. return new Text(attrs);
  62018. }
  62019. static textEdit(attrs) {
  62020. return new TextEdit(attrs);
  62021. }
  62022. static time(attrs) {
  62023. return new Time(attrs);
  62024. }
  62025. static timeStamp(attrs) {
  62026. return new TimeStamp(attrs);
  62027. }
  62028. static toolTip(attrs) {
  62029. return new ToolTip(attrs);
  62030. }
  62031. static traversal(attrs) {
  62032. return new Traversal(attrs);
  62033. }
  62034. static traverse(attrs) {
  62035. return new Traverse(attrs);
  62036. }
  62037. static ui(attrs) {
  62038. return new Ui(attrs);
  62039. }
  62040. static validate(attrs) {
  62041. return new Validate(attrs);
  62042. }
  62043. static value(attrs) {
  62044. return new Value(attrs);
  62045. }
  62046. static variables(attrs) {
  62047. return new Variables(attrs);
  62048. }
  62049. }
  62050. exports.TemplateNamespace = TemplateNamespace;
  62051. /***/ }),
  62052. /* 212 */
  62053. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62054. "use strict";
  62055. Object.defineProperty(exports, "__esModule", ({
  62056. value: true
  62057. }));
  62058. exports.addHTML = addHTML;
  62059. exports.checkDimensions = checkDimensions;
  62060. exports.flushHTML = flushHTML;
  62061. exports.getAvailableSpace = getAvailableSpace;
  62062. var _xfa_object = __w_pdfjs_require__(206);
  62063. var _html_utils = __w_pdfjs_require__(213);
  62064. function createLine(node, children) {
  62065. return {
  62066. name: "div",
  62067. attributes: {
  62068. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  62069. },
  62070. children
  62071. };
  62072. }
  62073. function flushHTML(node) {
  62074. if (!node[_xfa_object.$extra]) {
  62075. return null;
  62076. }
  62077. const attributes = node[_xfa_object.$extra].attributes;
  62078. const html = {
  62079. name: "div",
  62080. attributes,
  62081. children: node[_xfa_object.$extra].children
  62082. };
  62083. if (node[_xfa_object.$extra].failingNode) {
  62084. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  62085. if (htmlFromFailing) {
  62086. if (node.layout.endsWith("-tb")) {
  62087. html.children.push(createLine(node, [htmlFromFailing]));
  62088. } else {
  62089. html.children.push(htmlFromFailing);
  62090. }
  62091. }
  62092. }
  62093. if (html.children.length === 0) {
  62094. return null;
  62095. }
  62096. return html;
  62097. }
  62098. function addHTML(node, html, bbox) {
  62099. const extra = node[_xfa_object.$extra];
  62100. const availableSpace = extra.availableSpace;
  62101. const [x, y, w, h] = bbox;
  62102. switch (node.layout) {
  62103. case "position":
  62104. {
  62105. extra.width = Math.max(extra.width, x + w);
  62106. extra.height = Math.max(extra.height, y + h);
  62107. extra.children.push(html);
  62108. break;
  62109. }
  62110. case "lr-tb":
  62111. case "rl-tb":
  62112. if (!extra.line || extra.attempt === 1) {
  62113. extra.line = createLine(node, []);
  62114. extra.children.push(extra.line);
  62115. extra.numberInLine = 0;
  62116. }
  62117. extra.numberInLine += 1;
  62118. extra.line.children.push(html);
  62119. if (extra.attempt === 0) {
  62120. extra.currentWidth += w;
  62121. extra.height = Math.max(extra.height, extra.prevHeight + h);
  62122. } else {
  62123. extra.currentWidth = w;
  62124. extra.prevHeight = extra.height;
  62125. extra.height += h;
  62126. extra.attempt = 0;
  62127. }
  62128. extra.width = Math.max(extra.width, extra.currentWidth);
  62129. break;
  62130. case "rl-row":
  62131. case "row":
  62132. {
  62133. extra.children.push(html);
  62134. extra.width += w;
  62135. extra.height = Math.max(extra.height, h);
  62136. const height = (0, _html_utils.measureToString)(extra.height);
  62137. for (const child of extra.children) {
  62138. child.attributes.style.height = height;
  62139. }
  62140. break;
  62141. }
  62142. case "table":
  62143. {
  62144. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  62145. extra.height += h;
  62146. extra.children.push(html);
  62147. break;
  62148. }
  62149. case "tb":
  62150. {
  62151. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  62152. extra.height += h;
  62153. extra.children.push(html);
  62154. break;
  62155. }
  62156. }
  62157. }
  62158. function getAvailableSpace(node) {
  62159. const availableSpace = node[_xfa_object.$extra].availableSpace;
  62160. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  62161. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  62162. switch (node.layout) {
  62163. case "lr-tb":
  62164. case "rl-tb":
  62165. if (node[_xfa_object.$extra].attempt === 0) {
  62166. return {
  62167. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  62168. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  62169. };
  62170. }
  62171. return {
  62172. width: availableSpace.width - marginH,
  62173. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  62174. };
  62175. case "rl-row":
  62176. case "row":
  62177. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  62178. return {
  62179. width,
  62180. height: availableSpace.height - marginH
  62181. };
  62182. case "table":
  62183. case "tb":
  62184. return {
  62185. width: availableSpace.width - marginH,
  62186. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  62187. };
  62188. case "position":
  62189. default:
  62190. return availableSpace;
  62191. }
  62192. }
  62193. function getTransformedBBox(node) {
  62194. let w = node.w === "" ? NaN : node.w;
  62195. let h = node.h === "" ? NaN : node.h;
  62196. let [centerX, centerY] = [0, 0];
  62197. switch (node.anchorType || "") {
  62198. case "bottomCenter":
  62199. [centerX, centerY] = [w / 2, h];
  62200. break;
  62201. case "bottomLeft":
  62202. [centerX, centerY] = [0, h];
  62203. break;
  62204. case "bottomRight":
  62205. [centerX, centerY] = [w, h];
  62206. break;
  62207. case "middleCenter":
  62208. [centerX, centerY] = [w / 2, h / 2];
  62209. break;
  62210. case "middleLeft":
  62211. [centerX, centerY] = [0, h / 2];
  62212. break;
  62213. case "middleRight":
  62214. [centerX, centerY] = [w, h / 2];
  62215. break;
  62216. case "topCenter":
  62217. [centerX, centerY] = [w / 2, 0];
  62218. break;
  62219. case "topRight":
  62220. [centerX, centerY] = [w, 0];
  62221. break;
  62222. }
  62223. let x, y;
  62224. switch (node.rotate || 0) {
  62225. case 0:
  62226. [x, y] = [-centerX, -centerY];
  62227. break;
  62228. case 90:
  62229. [x, y] = [-centerY, centerX];
  62230. [w, h] = [h, -w];
  62231. break;
  62232. case 180:
  62233. [x, y] = [centerX, centerY];
  62234. [w, h] = [-w, -h];
  62235. break;
  62236. case 270:
  62237. [x, y] = [centerY, -centerX];
  62238. [w, h] = [-h, w];
  62239. break;
  62240. }
  62241. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  62242. }
  62243. function checkDimensions(node, space) {
  62244. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  62245. return true;
  62246. }
  62247. if (node.w === 0 || node.h === 0) {
  62248. return true;
  62249. }
  62250. const ERROR = 2;
  62251. const parent = node[_xfa_object.$getSubformParent]();
  62252. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  62253. const [, y, w, h] = getTransformedBBox(node);
  62254. switch (parent.layout) {
  62255. case "lr-tb":
  62256. case "rl-tb":
  62257. if (attempt === 0) {
  62258. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62259. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  62260. return false;
  62261. }
  62262. if (node.w !== "") {
  62263. if (Math.round(w - space.width) <= ERROR) {
  62264. return true;
  62265. }
  62266. if (parent[_xfa_object.$extra].numberInLine === 0) {
  62267. return space.height > ERROR;
  62268. }
  62269. return false;
  62270. }
  62271. return space.width > ERROR;
  62272. }
  62273. if (node.w !== "") {
  62274. return Math.round(w - space.width) <= ERROR;
  62275. }
  62276. return space.width > ERROR;
  62277. }
  62278. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62279. return true;
  62280. }
  62281. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  62282. return false;
  62283. }
  62284. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  62285. return space.height > ERROR;
  62286. }
  62287. if (parent[_xfa_object.$isThereMoreWidth]()) {
  62288. return false;
  62289. }
  62290. return space.height > ERROR;
  62291. case "table":
  62292. case "tb":
  62293. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62294. return true;
  62295. }
  62296. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  62297. return Math.round(h - space.height) <= ERROR;
  62298. }
  62299. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  62300. return space.height > ERROR;
  62301. }
  62302. if (parent[_xfa_object.$isThereMoreWidth]()) {
  62303. return false;
  62304. }
  62305. return space.height > ERROR;
  62306. case "position":
  62307. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62308. return true;
  62309. }
  62310. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  62311. return true;
  62312. }
  62313. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  62314. return h + y > area.h;
  62315. case "rl-row":
  62316. case "row":
  62317. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62318. return true;
  62319. }
  62320. if (node.h !== "") {
  62321. return Math.round(h - space.height) <= ERROR;
  62322. }
  62323. return true;
  62324. default:
  62325. return true;
  62326. }
  62327. }
  62328. /***/ }),
  62329. /* 213 */
  62330. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62331. "use strict";
  62332. Object.defineProperty(exports, "__esModule", ({
  62333. value: true
  62334. }));
  62335. exports.computeBbox = computeBbox;
  62336. exports.createWrapper = createWrapper;
  62337. exports.fixDimensions = fixDimensions;
  62338. exports.fixTextIndent = fixTextIndent;
  62339. exports.fixURL = fixURL;
  62340. exports.isPrintOnly = isPrintOnly;
  62341. exports.layoutClass = layoutClass;
  62342. exports.layoutNode = layoutNode;
  62343. exports.measureToString = measureToString;
  62344. exports.setAccess = setAccess;
  62345. exports.setFontFamily = setFontFamily;
  62346. exports.setMinMaxDimensions = setMinMaxDimensions;
  62347. exports.setPara = setPara;
  62348. exports.toStyle = toStyle;
  62349. var _xfa_object = __w_pdfjs_require__(206);
  62350. var _util = __w_pdfjs_require__(2);
  62351. var _utils = __w_pdfjs_require__(207);
  62352. var _fonts = __w_pdfjs_require__(214);
  62353. var _text = __w_pdfjs_require__(215);
  62354. function measureToString(m) {
  62355. if (typeof m === "string") {
  62356. return "0px";
  62357. }
  62358. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  62359. }
  62360. const converters = {
  62361. anchorType(node, style) {
  62362. const parent = node[_xfa_object.$getSubformParent]();
  62363. if (!parent || parent.layout && parent.layout !== "position") {
  62364. return;
  62365. }
  62366. if (!("transform" in style)) {
  62367. style.transform = "";
  62368. }
  62369. switch (node.anchorType) {
  62370. case "bottomCenter":
  62371. style.transform += "translate(-50%, -100%)";
  62372. break;
  62373. case "bottomLeft":
  62374. style.transform += "translate(0,-100%)";
  62375. break;
  62376. case "bottomRight":
  62377. style.transform += "translate(-100%,-100%)";
  62378. break;
  62379. case "middleCenter":
  62380. style.transform += "translate(-50%,-50%)";
  62381. break;
  62382. case "middleLeft":
  62383. style.transform += "translate(0,-50%)";
  62384. break;
  62385. case "middleRight":
  62386. style.transform += "translate(-100%,-50%)";
  62387. break;
  62388. case "topCenter":
  62389. style.transform += "translate(-50%,0)";
  62390. break;
  62391. case "topRight":
  62392. style.transform += "translate(-100%,0)";
  62393. break;
  62394. }
  62395. },
  62396. dimensions(node, style) {
  62397. const parent = node[_xfa_object.$getSubformParent]();
  62398. let width = node.w;
  62399. const height = node.h;
  62400. if (parent.layout && parent.layout.includes("row")) {
  62401. const extra = parent[_xfa_object.$extra];
  62402. const colSpan = node.colSpan;
  62403. let w;
  62404. if (colSpan === -1) {
  62405. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  62406. extra.currentColumn = 0;
  62407. } else {
  62408. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  62409. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  62410. }
  62411. if (!isNaN(w)) {
  62412. width = node.w = w;
  62413. }
  62414. }
  62415. if (width !== "") {
  62416. style.width = measureToString(width);
  62417. } else {
  62418. style.width = "auto";
  62419. }
  62420. if (height !== "") {
  62421. style.height = measureToString(height);
  62422. } else {
  62423. style.height = "auto";
  62424. }
  62425. },
  62426. position(node, style) {
  62427. const parent = node[_xfa_object.$getSubformParent]();
  62428. if (parent && parent.layout && parent.layout !== "position") {
  62429. return;
  62430. }
  62431. style.position = "absolute";
  62432. style.left = measureToString(node.x);
  62433. style.top = measureToString(node.y);
  62434. },
  62435. rotate(node, style) {
  62436. if (node.rotate) {
  62437. if (!("transform" in style)) {
  62438. style.transform = "";
  62439. }
  62440. style.transform += `rotate(-${node.rotate}deg)`;
  62441. style.transformOrigin = "top left";
  62442. }
  62443. },
  62444. presence(node, style) {
  62445. switch (node.presence) {
  62446. case "invisible":
  62447. style.visibility = "hidden";
  62448. break;
  62449. case "hidden":
  62450. case "inactive":
  62451. style.display = "none";
  62452. break;
  62453. }
  62454. },
  62455. hAlign(node, style) {
  62456. if (node[_xfa_object.$nodeName] === "para") {
  62457. switch (node.hAlign) {
  62458. case "justifyAll":
  62459. style.textAlign = "justify-all";
  62460. break;
  62461. case "radix":
  62462. style.textAlign = "left";
  62463. break;
  62464. default:
  62465. style.textAlign = node.hAlign;
  62466. }
  62467. } else {
  62468. switch (node.hAlign) {
  62469. case "left":
  62470. style.alignSelf = "start";
  62471. break;
  62472. case "center":
  62473. style.alignSelf = "center";
  62474. break;
  62475. case "right":
  62476. style.alignSelf = "end";
  62477. break;
  62478. }
  62479. }
  62480. },
  62481. margin(node, style) {
  62482. if (node.margin) {
  62483. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  62484. }
  62485. }
  62486. };
  62487. function setMinMaxDimensions(node, style) {
  62488. const parent = node[_xfa_object.$getSubformParent]();
  62489. if (parent.layout === "position") {
  62490. if (node.minW > 0) {
  62491. style.minWidth = measureToString(node.minW);
  62492. }
  62493. if (node.maxW > 0) {
  62494. style.maxWidth = measureToString(node.maxW);
  62495. }
  62496. if (node.minH > 0) {
  62497. style.minHeight = measureToString(node.minH);
  62498. }
  62499. if (node.maxH > 0) {
  62500. style.maxHeight = measureToString(node.maxH);
  62501. }
  62502. }
  62503. }
  62504. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  62505. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  62506. if (typeof text === "string") {
  62507. measure.addString(text);
  62508. } else {
  62509. text[_xfa_object.$pushGlyphs](measure);
  62510. }
  62511. return measure.compute(width);
  62512. }
  62513. function layoutNode(node, availableSpace) {
  62514. let height = null;
  62515. let width = null;
  62516. let isBroken = false;
  62517. if ((!node.w || !node.h) && node.value) {
  62518. let marginH = 0;
  62519. let marginV = 0;
  62520. if (node.margin) {
  62521. marginH = node.margin.leftInset + node.margin.rightInset;
  62522. marginV = node.margin.topInset + node.margin.bottomInset;
  62523. }
  62524. let lineHeight = null;
  62525. let margin = null;
  62526. if (node.para) {
  62527. margin = Object.create(null);
  62528. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  62529. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  62530. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  62531. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  62532. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  62533. }
  62534. let font = node.font;
  62535. if (!font) {
  62536. const root = node[_xfa_object.$getTemplateRoot]();
  62537. let parent = node[_xfa_object.$getParent]();
  62538. while (parent && parent !== root) {
  62539. if (parent.font) {
  62540. font = parent.font;
  62541. break;
  62542. }
  62543. parent = parent[_xfa_object.$getParent]();
  62544. }
  62545. }
  62546. const maxWidth = (node.w || availableSpace.width) - marginH;
  62547. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  62548. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  62549. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  62550. width = res.width;
  62551. height = res.height;
  62552. isBroken = res.isBroken;
  62553. } else {
  62554. const text = node.value[_xfa_object.$text]();
  62555. if (text) {
  62556. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  62557. width = res.width;
  62558. height = res.height;
  62559. isBroken = res.isBroken;
  62560. }
  62561. }
  62562. if (width !== null && !node.w) {
  62563. width += marginH;
  62564. }
  62565. if (height !== null && !node.h) {
  62566. height += marginV;
  62567. }
  62568. }
  62569. return {
  62570. w: width,
  62571. h: height,
  62572. isBroken
  62573. };
  62574. }
  62575. function computeBbox(node, html, availableSpace) {
  62576. let bbox;
  62577. if (node.w !== "" && node.h !== "") {
  62578. bbox = [node.x, node.y, node.w, node.h];
  62579. } else {
  62580. if (!availableSpace) {
  62581. return null;
  62582. }
  62583. let width = node.w;
  62584. if (width === "") {
  62585. if (node.maxW === 0) {
  62586. const parent = node[_xfa_object.$getSubformParent]();
  62587. if (parent.layout === "position" && parent.w !== "") {
  62588. width = 0;
  62589. } else {
  62590. width = node.minW;
  62591. }
  62592. } else {
  62593. width = Math.min(node.maxW, availableSpace.width);
  62594. }
  62595. html.attributes.style.width = measureToString(width);
  62596. }
  62597. let height = node.h;
  62598. if (height === "") {
  62599. if (node.maxH === 0) {
  62600. const parent = node[_xfa_object.$getSubformParent]();
  62601. if (parent.layout === "position" && parent.h !== "") {
  62602. height = 0;
  62603. } else {
  62604. height = node.minH;
  62605. }
  62606. } else {
  62607. height = Math.min(node.maxH, availableSpace.height);
  62608. }
  62609. html.attributes.style.height = measureToString(height);
  62610. }
  62611. bbox = [node.x, node.y, width, height];
  62612. }
  62613. return bbox;
  62614. }
  62615. function fixDimensions(node) {
  62616. const parent = node[_xfa_object.$getSubformParent]();
  62617. if (parent.layout && parent.layout.includes("row")) {
  62618. const extra = parent[_xfa_object.$extra];
  62619. const colSpan = node.colSpan;
  62620. let width;
  62621. if (colSpan === -1) {
  62622. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  62623. } else {
  62624. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  62625. }
  62626. if (!isNaN(width)) {
  62627. node.w = width;
  62628. }
  62629. }
  62630. if (parent.layout && parent.layout !== "position") {
  62631. node.x = node.y = 0;
  62632. }
  62633. if (node.layout === "table") {
  62634. if (node.w === "" && Array.isArray(node.columnWidths)) {
  62635. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  62636. }
  62637. }
  62638. }
  62639. function layoutClass(node) {
  62640. switch (node.layout) {
  62641. case "position":
  62642. return "xfaPosition";
  62643. case "lr-tb":
  62644. return "xfaLrTb";
  62645. case "rl-row":
  62646. return "xfaRlRow";
  62647. case "rl-tb":
  62648. return "xfaRlTb";
  62649. case "row":
  62650. return "xfaRow";
  62651. case "table":
  62652. return "xfaTable";
  62653. case "tb":
  62654. return "xfaTb";
  62655. default:
  62656. return "xfaPosition";
  62657. }
  62658. }
  62659. function toStyle(node) {
  62660. const style = Object.create(null);
  62661. for (var _len = arguments.length, names = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  62662. names[_key - 1] = arguments[_key];
  62663. }
  62664. for (const name of names) {
  62665. const value = node[name];
  62666. if (value === null) {
  62667. continue;
  62668. }
  62669. if (converters.hasOwnProperty(name)) {
  62670. converters[name](node, style);
  62671. continue;
  62672. }
  62673. if (value instanceof _xfa_object.XFAObject) {
  62674. const newStyle = value[_xfa_object.$toStyle]();
  62675. if (newStyle) {
  62676. Object.assign(style, newStyle);
  62677. } else {
  62678. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  62679. }
  62680. }
  62681. }
  62682. return style;
  62683. }
  62684. function createWrapper(node, html) {
  62685. const {
  62686. attributes
  62687. } = html;
  62688. const {
  62689. style
  62690. } = attributes;
  62691. const wrapper = {
  62692. name: "div",
  62693. attributes: {
  62694. class: ["xfaWrapper"],
  62695. style: Object.create(null)
  62696. },
  62697. children: []
  62698. };
  62699. attributes.class.push("xfaWrapped");
  62700. if (node.border) {
  62701. const {
  62702. widths,
  62703. insets
  62704. } = node.border[_xfa_object.$extra];
  62705. let width, height;
  62706. let top = insets[0];
  62707. let left = insets[3];
  62708. const insetsH = insets[0] + insets[2];
  62709. const insetsW = insets[1] + insets[3];
  62710. switch (node.border.hand) {
  62711. case "even":
  62712. top -= widths[0] / 2;
  62713. left -= widths[3] / 2;
  62714. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  62715. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  62716. break;
  62717. case "left":
  62718. top -= widths[0];
  62719. left -= widths[3];
  62720. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  62721. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  62722. break;
  62723. case "right":
  62724. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  62725. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  62726. break;
  62727. }
  62728. const classNames = ["xfaBorder"];
  62729. if (isPrintOnly(node.border)) {
  62730. classNames.push("xfaPrintOnly");
  62731. }
  62732. const border = {
  62733. name: "div",
  62734. attributes: {
  62735. class: classNames,
  62736. style: {
  62737. top: `${top}px`,
  62738. left: `${left}px`,
  62739. width,
  62740. height
  62741. }
  62742. },
  62743. children: []
  62744. };
  62745. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  62746. if (style[key] !== undefined) {
  62747. border.attributes.style[key] = style[key];
  62748. delete style[key];
  62749. }
  62750. }
  62751. wrapper.children.push(border, html);
  62752. } else {
  62753. wrapper.children.push(html);
  62754. }
  62755. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  62756. if (style[key] !== undefined) {
  62757. wrapper.attributes.style[key] = style[key];
  62758. delete style[key];
  62759. }
  62760. }
  62761. if (style.position === "absolute") {
  62762. wrapper.attributes.style.position = "absolute";
  62763. } else {
  62764. wrapper.attributes.style.position = "relative";
  62765. }
  62766. delete style.position;
  62767. if (style.alignSelf) {
  62768. wrapper.attributes.style.alignSelf = style.alignSelf;
  62769. delete style.alignSelf;
  62770. }
  62771. return wrapper;
  62772. }
  62773. function fixTextIndent(styles) {
  62774. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  62775. if (indent >= 0) {
  62776. return;
  62777. }
  62778. const align = styles.textAlign === "right" ? "right" : "left";
  62779. const name = "padding" + (align === "left" ? "Left" : "Right");
  62780. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  62781. styles[name] = `${padding - indent}px`;
  62782. }
  62783. function setAccess(node, classNames) {
  62784. switch (node.access) {
  62785. case "nonInteractive":
  62786. classNames.push("xfaNonInteractive");
  62787. break;
  62788. case "readOnly":
  62789. classNames.push("xfaReadOnly");
  62790. break;
  62791. case "protected":
  62792. classNames.push("xfaDisabled");
  62793. break;
  62794. }
  62795. }
  62796. function isPrintOnly(node) {
  62797. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  62798. }
  62799. function getCurrentPara(node) {
  62800. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  62801. return stack.length ? stack.at(-1) : null;
  62802. }
  62803. function setPara(node, nodeStyle, value) {
  62804. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  62805. if (nodeStyle) {
  62806. if (node.h === "") {
  62807. nodeStyle.height = "auto";
  62808. }
  62809. if (node.w === "") {
  62810. nodeStyle.width = "auto";
  62811. }
  62812. }
  62813. const para = getCurrentPara(node);
  62814. if (para) {
  62815. const valueStyle = value.attributes.style;
  62816. valueStyle.display = "flex";
  62817. valueStyle.flexDirection = "column";
  62818. switch (para.vAlign) {
  62819. case "top":
  62820. valueStyle.justifyContent = "start";
  62821. break;
  62822. case "bottom":
  62823. valueStyle.justifyContent = "end";
  62824. break;
  62825. case "middle":
  62826. valueStyle.justifyContent = "center";
  62827. break;
  62828. }
  62829. const paraStyle = para[_xfa_object.$toStyle]();
  62830. for (const [key, val] of Object.entries(paraStyle)) {
  62831. if (!(key in valueStyle)) {
  62832. valueStyle[key] = val;
  62833. }
  62834. }
  62835. }
  62836. }
  62837. }
  62838. function setFontFamily(xfaFont, node, fontFinder, style) {
  62839. if (!fontFinder) {
  62840. delete style.fontFamily;
  62841. return;
  62842. }
  62843. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  62844. style.fontFamily = `"${name}"`;
  62845. const typeface = fontFinder.find(name);
  62846. if (typeface) {
  62847. const {
  62848. fontFamily
  62849. } = typeface.regular.cssFontInfo;
  62850. if (fontFamily !== name) {
  62851. style.fontFamily = `"${fontFamily}"`;
  62852. }
  62853. const para = getCurrentPara(node);
  62854. if (para && para.lineHeight !== "") {
  62855. return;
  62856. }
  62857. if (style.lineHeight) {
  62858. return;
  62859. }
  62860. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  62861. if (pdfFont) {
  62862. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  62863. }
  62864. }
  62865. }
  62866. function fixURL(str) {
  62867. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  62868. addDefaultProtocol: true,
  62869. tryConvertEncoding: true
  62870. });
  62871. return absoluteUrl ? absoluteUrl.href : null;
  62872. }
  62873. /***/ }),
  62874. /* 214 */
  62875. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62876. "use strict";
  62877. Object.defineProperty(exports, "__esModule", ({
  62878. value: true
  62879. }));
  62880. exports.FontFinder = void 0;
  62881. exports.getMetrics = getMetrics;
  62882. exports.selectFont = selectFont;
  62883. var _xfa_object = __w_pdfjs_require__(206);
  62884. var _utils = __w_pdfjs_require__(207);
  62885. var _util = __w_pdfjs_require__(2);
  62886. class FontFinder {
  62887. constructor(pdfFonts) {
  62888. this.fonts = new Map();
  62889. this.cache = new Map();
  62890. this.warned = new Set();
  62891. this.defaultFont = null;
  62892. this.add(pdfFonts);
  62893. }
  62894. add(pdfFonts) {
  62895. let reallyMissingFonts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  62896. for (const pdfFont of pdfFonts) {
  62897. this.addPdfFont(pdfFont);
  62898. }
  62899. for (const pdfFont of this.fonts.values()) {
  62900. if (!pdfFont.regular) {
  62901. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  62902. }
  62903. }
  62904. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  62905. return;
  62906. }
  62907. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  62908. for (const missing of reallyMissingFonts) {
  62909. this.fonts.set(missing, myriad);
  62910. }
  62911. }
  62912. addPdfFont(pdfFont) {
  62913. const cssFontInfo = pdfFont.cssFontInfo;
  62914. const name = cssFontInfo.fontFamily;
  62915. let font = this.fonts.get(name);
  62916. if (!font) {
  62917. font = Object.create(null);
  62918. this.fonts.set(name, font);
  62919. if (!this.defaultFont) {
  62920. this.defaultFont = font;
  62921. }
  62922. }
  62923. let property = "";
  62924. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  62925. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  62926. property = fontWeight >= 700 ? "bolditalic" : "italic";
  62927. } else if (fontWeight >= 700) {
  62928. property = "bold";
  62929. }
  62930. if (!property) {
  62931. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  62932. property = "bold";
  62933. }
  62934. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  62935. property += "italic";
  62936. }
  62937. }
  62938. if (!property) {
  62939. property = "regular";
  62940. }
  62941. font[property] = pdfFont;
  62942. }
  62943. getDefault() {
  62944. return this.defaultFont;
  62945. }
  62946. find(fontName) {
  62947. let mustWarn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  62948. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  62949. if (font) {
  62950. return font;
  62951. }
  62952. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  62953. let name = fontName.replace(pattern, "");
  62954. font = this.fonts.get(name);
  62955. if (font) {
  62956. this.cache.set(fontName, font);
  62957. return font;
  62958. }
  62959. name = name.toLowerCase();
  62960. const maybe = [];
  62961. for (const [family, pdfFont] of this.fonts.entries()) {
  62962. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  62963. maybe.push(pdfFont);
  62964. }
  62965. }
  62966. if (maybe.length === 0) {
  62967. for (const [, pdfFont] of this.fonts.entries()) {
  62968. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  62969. maybe.push(pdfFont);
  62970. }
  62971. }
  62972. }
  62973. if (maybe.length === 0) {
  62974. name = name.replace(/psmt|mt/gi, "");
  62975. for (const [family, pdfFont] of this.fonts.entries()) {
  62976. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  62977. maybe.push(pdfFont);
  62978. }
  62979. }
  62980. }
  62981. if (maybe.length === 0) {
  62982. for (const pdfFont of this.fonts.values()) {
  62983. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  62984. maybe.push(pdfFont);
  62985. }
  62986. }
  62987. }
  62988. if (maybe.length >= 1) {
  62989. if (maybe.length !== 1 && mustWarn) {
  62990. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  62991. }
  62992. this.cache.set(fontName, maybe[0]);
  62993. return maybe[0];
  62994. }
  62995. if (mustWarn && !this.warned.has(fontName)) {
  62996. this.warned.add(fontName);
  62997. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  62998. }
  62999. return null;
  63000. }
  63001. }
  63002. exports.FontFinder = FontFinder;
  63003. function selectFont(xfaFont, typeface) {
  63004. if (xfaFont.posture === "italic") {
  63005. if (xfaFont.weight === "bold") {
  63006. return typeface.bolditalic;
  63007. }
  63008. return typeface.italic;
  63009. } else if (xfaFont.weight === "bold") {
  63010. return typeface.bold;
  63011. }
  63012. return typeface.regular;
  63013. }
  63014. function getMetrics(xfaFont) {
  63015. let real = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  63016. let pdfFont = null;
  63017. if (xfaFont) {
  63018. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  63019. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  63020. pdfFont = selectFont(xfaFont, typeface);
  63021. }
  63022. if (!pdfFont) {
  63023. return {
  63024. lineHeight: 12,
  63025. lineGap: 2,
  63026. lineNoGap: 10
  63027. };
  63028. }
  63029. const size = xfaFont.size || 10;
  63030. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  63031. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  63032. return {
  63033. lineHeight: lineHeight * size,
  63034. lineGap: lineGap * size,
  63035. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  63036. };
  63037. }
  63038. /***/ }),
  63039. /* 215 */
  63040. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63041. "use strict";
  63042. Object.defineProperty(exports, "__esModule", ({
  63043. value: true
  63044. }));
  63045. exports.TextMeasure = void 0;
  63046. var _fonts = __w_pdfjs_require__(214);
  63047. const WIDTH_FACTOR = 1.02;
  63048. class FontInfo {
  63049. constructor(xfaFont, margin, lineHeight, fontFinder) {
  63050. this.lineHeight = lineHeight;
  63051. this.paraMargin = margin || {
  63052. top: 0,
  63053. bottom: 0,
  63054. left: 0,
  63055. right: 0
  63056. };
  63057. if (!xfaFont) {
  63058. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  63059. return;
  63060. }
  63061. this.xfaFont = {
  63062. typeface: xfaFont.typeface,
  63063. posture: xfaFont.posture,
  63064. weight: xfaFont.weight,
  63065. size: xfaFont.size,
  63066. letterSpacing: xfaFont.letterSpacing
  63067. };
  63068. const typeface = fontFinder.find(xfaFont.typeface);
  63069. if (!typeface) {
  63070. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  63071. return;
  63072. }
  63073. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  63074. if (!this.pdfFont) {
  63075. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  63076. }
  63077. }
  63078. defaultFont(fontFinder) {
  63079. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  63080. if (font && font.regular) {
  63081. const pdfFont = font.regular;
  63082. const info = pdfFont.cssFontInfo;
  63083. const xfaFont = {
  63084. typeface: info.fontFamily,
  63085. posture: "normal",
  63086. weight: "normal",
  63087. size: 10,
  63088. letterSpacing: 0
  63089. };
  63090. return [pdfFont, xfaFont];
  63091. }
  63092. const xfaFont = {
  63093. typeface: "Courier",
  63094. posture: "normal",
  63095. weight: "normal",
  63096. size: 10,
  63097. letterSpacing: 0
  63098. };
  63099. return [null, xfaFont];
  63100. }
  63101. }
  63102. class FontSelector {
  63103. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  63104. this.fontFinder = fontFinder;
  63105. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  63106. }
  63107. pushData(xfaFont, margin, lineHeight) {
  63108. const lastFont = this.stack.at(-1);
  63109. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  63110. if (!xfaFont[name]) {
  63111. xfaFont[name] = lastFont.xfaFont[name];
  63112. }
  63113. }
  63114. for (const name of ["top", "bottom", "left", "right"]) {
  63115. if (isNaN(margin[name])) {
  63116. margin[name] = lastFont.paraMargin[name];
  63117. }
  63118. }
  63119. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  63120. if (!fontInfo.pdfFont) {
  63121. fontInfo.pdfFont = lastFont.pdfFont;
  63122. }
  63123. this.stack.push(fontInfo);
  63124. }
  63125. popFont() {
  63126. this.stack.pop();
  63127. }
  63128. topFont() {
  63129. return this.stack.at(-1);
  63130. }
  63131. }
  63132. class TextMeasure {
  63133. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  63134. this.glyphs = [];
  63135. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  63136. this.extraHeight = 0;
  63137. }
  63138. pushData(xfaFont, margin, lineHeight) {
  63139. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  63140. }
  63141. popFont(xfaFont) {
  63142. return this.fontSelector.popFont();
  63143. }
  63144. addPara() {
  63145. const lastFont = this.fontSelector.topFont();
  63146. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  63147. }
  63148. addString(str) {
  63149. if (!str) {
  63150. return;
  63151. }
  63152. const lastFont = this.fontSelector.topFont();
  63153. const fontSize = lastFont.xfaFont.size;
  63154. if (lastFont.pdfFont) {
  63155. const letterSpacing = lastFont.xfaFont.letterSpacing;
  63156. const pdfFont = lastFont.pdfFont;
  63157. const fontLineHeight = pdfFont.lineHeight || 1.2;
  63158. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  63159. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  63160. const noGap = fontLineHeight - lineGap;
  63161. const firstLineHeight = Math.max(1, noGap) * fontSize;
  63162. const scale = fontSize / 1000;
  63163. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  63164. for (const line of str.split(/[\u2029\n]/)) {
  63165. const encodedLine = pdfFont.encodeString(line).join("");
  63166. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  63167. for (const glyph of glyphs) {
  63168. const width = glyph.width || fallbackWidth;
  63169. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  63170. }
  63171. this.glyphs.push([0, 0, 0, "\n", true]);
  63172. }
  63173. this.glyphs.pop();
  63174. return;
  63175. }
  63176. for (const line of str.split(/[\u2029\n]/)) {
  63177. for (const char of line.split("")) {
  63178. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  63179. }
  63180. this.glyphs.push([0, 0, 0, "\n", true]);
  63181. }
  63182. this.glyphs.pop();
  63183. }
  63184. compute(maxWidth) {
  63185. let lastSpacePos = -1,
  63186. lastSpaceWidth = 0,
  63187. width = 0,
  63188. height = 0,
  63189. currentLineWidth = 0,
  63190. currentLineHeight = 0;
  63191. let isBroken = false;
  63192. let isFirstLine = true;
  63193. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  63194. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  63195. const isSpace = char === " ";
  63196. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  63197. if (isEOL) {
  63198. width = Math.max(width, currentLineWidth);
  63199. currentLineWidth = 0;
  63200. height += currentLineHeight;
  63201. currentLineHeight = glyphHeight;
  63202. lastSpacePos = -1;
  63203. lastSpaceWidth = 0;
  63204. isFirstLine = false;
  63205. continue;
  63206. }
  63207. if (isSpace) {
  63208. if (currentLineWidth + glyphWidth > maxWidth) {
  63209. width = Math.max(width, currentLineWidth);
  63210. currentLineWidth = 0;
  63211. height += currentLineHeight;
  63212. currentLineHeight = glyphHeight;
  63213. lastSpacePos = -1;
  63214. lastSpaceWidth = 0;
  63215. isBroken = true;
  63216. isFirstLine = false;
  63217. } else {
  63218. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  63219. lastSpaceWidth = currentLineWidth;
  63220. currentLineWidth += glyphWidth;
  63221. lastSpacePos = i;
  63222. }
  63223. continue;
  63224. }
  63225. if (currentLineWidth + glyphWidth > maxWidth) {
  63226. height += currentLineHeight;
  63227. currentLineHeight = glyphHeight;
  63228. if (lastSpacePos !== -1) {
  63229. i = lastSpacePos;
  63230. width = Math.max(width, lastSpaceWidth);
  63231. currentLineWidth = 0;
  63232. lastSpacePos = -1;
  63233. lastSpaceWidth = 0;
  63234. } else {
  63235. width = Math.max(width, currentLineWidth);
  63236. currentLineWidth = glyphWidth;
  63237. }
  63238. isBroken = true;
  63239. isFirstLine = false;
  63240. continue;
  63241. }
  63242. currentLineWidth += glyphWidth;
  63243. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  63244. }
  63245. width = Math.max(width, currentLineWidth);
  63246. height += currentLineHeight + this.extraHeight;
  63247. return {
  63248. width: WIDTH_FACTOR * width,
  63249. height,
  63250. isBroken
  63251. };
  63252. }
  63253. }
  63254. exports.TextMeasure = TextMeasure;
  63255. /***/ }),
  63256. /* 216 */
  63257. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63258. "use strict";
  63259. Object.defineProperty(exports, "__esModule", ({
  63260. value: true
  63261. }));
  63262. exports.DataHandler = void 0;
  63263. var _xfa_object = __w_pdfjs_require__(206);
  63264. class DataHandler {
  63265. constructor(root, data) {
  63266. this.data = data;
  63267. this.dataset = root.datasets || null;
  63268. }
  63269. serialize(storage) {
  63270. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  63271. while (stack.length > 0) {
  63272. const last = stack.at(-1);
  63273. const [i, children] = last;
  63274. if (i + 1 === children.length) {
  63275. stack.pop();
  63276. continue;
  63277. }
  63278. const child = children[++last[0]];
  63279. const storageEntry = storage.get(child[_xfa_object.$uid]);
  63280. if (storageEntry) {
  63281. child[_xfa_object.$setValue](storageEntry);
  63282. } else {
  63283. const attributes = child[_xfa_object.$getAttributes]();
  63284. for (const value of attributes.values()) {
  63285. const entry = storage.get(value[_xfa_object.$uid]);
  63286. if (entry) {
  63287. value[_xfa_object.$setValue](entry);
  63288. break;
  63289. }
  63290. }
  63291. }
  63292. const nodes = child[_xfa_object.$getChildren]();
  63293. if (nodes.length > 0) {
  63294. stack.push([-1, nodes]);
  63295. }
  63296. }
  63297. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  63298. if (this.dataset) {
  63299. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  63300. if (child[_xfa_object.$nodeName] !== "data") {
  63301. child[_xfa_object.$toString](buf);
  63302. }
  63303. }
  63304. }
  63305. this.data[_xfa_object.$toString](buf);
  63306. buf.push("</xfa:datasets>");
  63307. return buf.join("");
  63308. }
  63309. }
  63310. exports.DataHandler = DataHandler;
  63311. /***/ }),
  63312. /* 217 */
  63313. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63314. "use strict";
  63315. Object.defineProperty(exports, "__esModule", ({
  63316. value: true
  63317. }));
  63318. exports.XFAParser = void 0;
  63319. var _xfa_object = __w_pdfjs_require__(206);
  63320. var _xml_parser = __w_pdfjs_require__(195);
  63321. var _builder = __w_pdfjs_require__(218);
  63322. var _util = __w_pdfjs_require__(2);
  63323. class XFAParser extends _xml_parser.XMLParserBase {
  63324. constructor() {
  63325. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  63326. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  63327. super();
  63328. this._builder = new _builder.Builder(rootNameSpace);
  63329. this._stack = [];
  63330. this._globalData = {
  63331. usedTypefaces: new Set()
  63332. };
  63333. this._ids = new Map();
  63334. this._current = this._builder.buildRoot(this._ids);
  63335. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  63336. this._whiteRegex = /^\s+$/;
  63337. this._nbsps = /\xa0+/g;
  63338. this._richText = richText;
  63339. }
  63340. parse(data) {
  63341. this.parseXml(data);
  63342. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  63343. return undefined;
  63344. }
  63345. this._current[_xfa_object.$finalize]();
  63346. return this._current.element;
  63347. }
  63348. onText(text) {
  63349. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  63350. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  63351. this._current[_xfa_object.$onText](text, this._richText);
  63352. return;
  63353. }
  63354. if (this._whiteRegex.test(text)) {
  63355. return;
  63356. }
  63357. this._current[_xfa_object.$onText](text.trim());
  63358. }
  63359. onCdata(text) {
  63360. this._current[_xfa_object.$onText](text);
  63361. }
  63362. _mkAttributes(attributes, tagName) {
  63363. let namespace = null;
  63364. let prefixes = null;
  63365. const attributeObj = Object.create({});
  63366. for (const {
  63367. name,
  63368. value
  63369. } of attributes) {
  63370. if (name === "xmlns") {
  63371. if (!namespace) {
  63372. namespace = value;
  63373. } else {
  63374. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  63375. }
  63376. } else if (name.startsWith("xmlns:")) {
  63377. const prefix = name.substring("xmlns:".length);
  63378. if (!prefixes) {
  63379. prefixes = [];
  63380. }
  63381. prefixes.push({
  63382. prefix,
  63383. value
  63384. });
  63385. } else {
  63386. const i = name.indexOf(":");
  63387. if (i === -1) {
  63388. attributeObj[name] = value;
  63389. } else {
  63390. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  63391. if (!nsAttrs) {
  63392. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  63393. }
  63394. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  63395. let attrs = nsAttrs[ns];
  63396. if (!attrs) {
  63397. attrs = nsAttrs[ns] = Object.create(null);
  63398. }
  63399. attrs[attrName] = value;
  63400. }
  63401. }
  63402. }
  63403. return [namespace, prefixes, attributeObj];
  63404. }
  63405. _getNameAndPrefix(name, nsAgnostic) {
  63406. const i = name.indexOf(":");
  63407. if (i === -1) {
  63408. return [name, null];
  63409. }
  63410. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  63411. }
  63412. onBeginElement(tagName, attributes, isEmpty) {
  63413. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  63414. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  63415. const node = this._builder.build({
  63416. nsPrefix,
  63417. name,
  63418. attributes: attributesObj,
  63419. namespace,
  63420. prefixes
  63421. });
  63422. node[_xfa_object.$globalData] = this._globalData;
  63423. if (isEmpty) {
  63424. node[_xfa_object.$finalize]();
  63425. if (this._current[_xfa_object.$onChild](node)) {
  63426. node[_xfa_object.$setId](this._ids);
  63427. }
  63428. node[_xfa_object.$clean](this._builder);
  63429. return;
  63430. }
  63431. this._stack.push(this._current);
  63432. this._current = node;
  63433. }
  63434. onEndElement(name) {
  63435. const node = this._current;
  63436. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  63437. const parser = new XFAParser();
  63438. parser._globalData = this._globalData;
  63439. const root = parser.parse(node[_xfa_object.$content]);
  63440. node[_xfa_object.$content] = null;
  63441. node[_xfa_object.$onChild](root);
  63442. }
  63443. node[_xfa_object.$finalize]();
  63444. this._current = this._stack.pop();
  63445. if (this._current[_xfa_object.$onChild](node)) {
  63446. node[_xfa_object.$setId](this._ids);
  63447. }
  63448. node[_xfa_object.$clean](this._builder);
  63449. }
  63450. onError(code) {
  63451. this._errorCode = code;
  63452. }
  63453. }
  63454. exports.XFAParser = XFAParser;
  63455. /***/ }),
  63456. /* 218 */
  63457. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63458. "use strict";
  63459. Object.defineProperty(exports, "__esModule", ({
  63460. value: true
  63461. }));
  63462. exports.Builder = void 0;
  63463. var _namespaces = __w_pdfjs_require__(208);
  63464. var _xfa_object = __w_pdfjs_require__(206);
  63465. var _setup = __w_pdfjs_require__(219);
  63466. var _template = __w_pdfjs_require__(211);
  63467. var _unknown = __w_pdfjs_require__(228);
  63468. var _util = __w_pdfjs_require__(2);
  63469. class Root extends _xfa_object.XFAObject {
  63470. constructor(ids) {
  63471. super(-1, "root", Object.create(null));
  63472. this.element = null;
  63473. this[_xfa_object.$ids] = ids;
  63474. }
  63475. [_xfa_object.$onChild](child) {
  63476. this.element = child;
  63477. return true;
  63478. }
  63479. [_xfa_object.$finalize]() {
  63480. super[_xfa_object.$finalize]();
  63481. if (this.element.template instanceof _template.Template) {
  63482. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  63483. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  63484. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  63485. }
  63486. }
  63487. }
  63488. class Empty extends _xfa_object.XFAObject {
  63489. constructor() {
  63490. super(-1, "", Object.create(null));
  63491. }
  63492. [_xfa_object.$onChild](_) {
  63493. return false;
  63494. }
  63495. }
  63496. class Builder {
  63497. constructor() {
  63498. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  63499. this._namespaceStack = [];
  63500. this._nsAgnosticLevel = 0;
  63501. this._namespacePrefixes = new Map();
  63502. this._namespaces = new Map();
  63503. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(_ref => {
  63504. let {
  63505. id
  63506. } = _ref;
  63507. return id;
  63508. }));
  63509. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  63510. }
  63511. buildRoot(ids) {
  63512. return new Root(ids);
  63513. }
  63514. build(_ref2) {
  63515. let {
  63516. nsPrefix,
  63517. name,
  63518. attributes,
  63519. namespace,
  63520. prefixes
  63521. } = _ref2;
  63522. const hasNamespaceDef = namespace !== null;
  63523. if (hasNamespaceDef) {
  63524. this._namespaceStack.push(this._currentNamespace);
  63525. this._currentNamespace = this._searchNamespace(namespace);
  63526. }
  63527. if (prefixes) {
  63528. this._addNamespacePrefix(prefixes);
  63529. }
  63530. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  63531. const dataTemplate = _setup.NamespaceSetUp.datasets;
  63532. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  63533. let xfaAttrs = null;
  63534. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  63535. const nsToUse = this._getNamespaceToUse(ns);
  63536. if (nsToUse === dataTemplate) {
  63537. xfaAttrs = {
  63538. xfa: attrs
  63539. };
  63540. break;
  63541. }
  63542. }
  63543. if (xfaAttrs) {
  63544. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  63545. } else {
  63546. delete attributes[_xfa_object.$nsAttributes];
  63547. }
  63548. }
  63549. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  63550. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  63551. if (node[_xfa_object.$isNsAgnostic]()) {
  63552. this._nsAgnosticLevel++;
  63553. }
  63554. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  63555. node[_xfa_object.$cleanup] = {
  63556. hasNamespace: hasNamespaceDef,
  63557. prefixes,
  63558. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  63559. };
  63560. }
  63561. return node;
  63562. }
  63563. isNsAgnostic() {
  63564. return this._nsAgnosticLevel > 0;
  63565. }
  63566. _searchNamespace(nsName) {
  63567. let ns = this._namespaces.get(nsName);
  63568. if (ns) {
  63569. return ns;
  63570. }
  63571. for (const [name, {
  63572. check
  63573. }] of Object.entries(_namespaces.NamespaceIds)) {
  63574. if (check(nsName)) {
  63575. ns = _setup.NamespaceSetUp[name];
  63576. if (ns) {
  63577. this._namespaces.set(nsName, ns);
  63578. return ns;
  63579. }
  63580. break;
  63581. }
  63582. }
  63583. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  63584. this._namespaces.set(nsName, ns);
  63585. return ns;
  63586. }
  63587. _addNamespacePrefix(prefixes) {
  63588. for (const {
  63589. prefix,
  63590. value
  63591. } of prefixes) {
  63592. const namespace = this._searchNamespace(value);
  63593. let prefixStack = this._namespacePrefixes.get(prefix);
  63594. if (!prefixStack) {
  63595. prefixStack = [];
  63596. this._namespacePrefixes.set(prefix, prefixStack);
  63597. }
  63598. prefixStack.push(namespace);
  63599. }
  63600. }
  63601. _getNamespaceToUse(prefix) {
  63602. if (!prefix) {
  63603. return this._currentNamespace;
  63604. }
  63605. const prefixStack = this._namespacePrefixes.get(prefix);
  63606. if (prefixStack && prefixStack.length > 0) {
  63607. return prefixStack.at(-1);
  63608. }
  63609. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  63610. return null;
  63611. }
  63612. clean(data) {
  63613. const {
  63614. hasNamespace,
  63615. prefixes,
  63616. nsAgnostic
  63617. } = data;
  63618. if (hasNamespace) {
  63619. this._currentNamespace = this._namespaceStack.pop();
  63620. }
  63621. if (prefixes) {
  63622. prefixes.forEach(_ref3 => {
  63623. let {
  63624. prefix
  63625. } = _ref3;
  63626. this._namespacePrefixes.get(prefix).pop();
  63627. });
  63628. }
  63629. if (nsAgnostic) {
  63630. this._nsAgnosticLevel--;
  63631. }
  63632. }
  63633. }
  63634. exports.Builder = Builder;
  63635. /***/ }),
  63636. /* 219 */
  63637. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63638. "use strict";
  63639. Object.defineProperty(exports, "__esModule", ({
  63640. value: true
  63641. }));
  63642. exports.NamespaceSetUp = void 0;
  63643. var _config = __w_pdfjs_require__(220);
  63644. var _connection_set = __w_pdfjs_require__(221);
  63645. var _datasets = __w_pdfjs_require__(222);
  63646. var _locale_set = __w_pdfjs_require__(223);
  63647. var _signature = __w_pdfjs_require__(224);
  63648. var _stylesheet = __w_pdfjs_require__(225);
  63649. var _template = __w_pdfjs_require__(211);
  63650. var _xdp = __w_pdfjs_require__(226);
  63651. var _xhtml = __w_pdfjs_require__(227);
  63652. const NamespaceSetUp = {
  63653. config: _config.ConfigNamespace,
  63654. connection: _connection_set.ConnectionSetNamespace,
  63655. datasets: _datasets.DatasetsNamespace,
  63656. localeSet: _locale_set.LocaleSetNamespace,
  63657. signature: _signature.SignatureNamespace,
  63658. stylesheet: _stylesheet.StylesheetNamespace,
  63659. template: _template.TemplateNamespace,
  63660. xdp: _xdp.XdpNamespace,
  63661. xhtml: _xhtml.XhtmlNamespace
  63662. };
  63663. exports.NamespaceSetUp = NamespaceSetUp;
  63664. /***/ }),
  63665. /* 220 */
  63666. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63667. "use strict";
  63668. Object.defineProperty(exports, "__esModule", ({
  63669. value: true
  63670. }));
  63671. exports.ConfigNamespace = void 0;
  63672. var _namespaces = __w_pdfjs_require__(208);
  63673. var _xfa_object = __w_pdfjs_require__(206);
  63674. var _utils = __w_pdfjs_require__(207);
  63675. var _util = __w_pdfjs_require__(2);
  63676. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  63677. class Acrobat extends _xfa_object.XFAObject {
  63678. constructor(attributes) {
  63679. super(CONFIG_NS_ID, "acrobat", true);
  63680. this.acrobat7 = null;
  63681. this.autoSave = null;
  63682. this.common = null;
  63683. this.validate = null;
  63684. this.validateApprovalSignatures = null;
  63685. this.submitUrl = new _xfa_object.XFAObjectArray();
  63686. }
  63687. }
  63688. class Acrobat7 extends _xfa_object.XFAObject {
  63689. constructor(attributes) {
  63690. super(CONFIG_NS_ID, "acrobat7", true);
  63691. this.dynamicRender = null;
  63692. }
  63693. }
  63694. class ADBE_JSConsole extends _xfa_object.OptionObject {
  63695. constructor(attributes) {
  63696. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  63697. }
  63698. }
  63699. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  63700. constructor(attributes) {
  63701. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  63702. }
  63703. }
  63704. class AddSilentPrint extends _xfa_object.Option01 {
  63705. constructor(attributes) {
  63706. super(CONFIG_NS_ID, "addSilentPrint");
  63707. }
  63708. }
  63709. class AddViewerPreferences extends _xfa_object.Option01 {
  63710. constructor(attributes) {
  63711. super(CONFIG_NS_ID, "addViewerPreferences");
  63712. }
  63713. }
  63714. class AdjustData extends _xfa_object.Option10 {
  63715. constructor(attributes) {
  63716. super(CONFIG_NS_ID, "adjustData");
  63717. }
  63718. }
  63719. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  63720. constructor(attributes) {
  63721. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  63722. }
  63723. }
  63724. class Agent extends _xfa_object.XFAObject {
  63725. constructor(attributes) {
  63726. super(CONFIG_NS_ID, "agent", true);
  63727. this.name = attributes.name ? attributes.name.trim() : "";
  63728. this.common = new _xfa_object.XFAObjectArray();
  63729. }
  63730. }
  63731. class AlwaysEmbed extends _xfa_object.ContentObject {
  63732. constructor(attributes) {
  63733. super(CONFIG_NS_ID, "alwaysEmbed");
  63734. }
  63735. }
  63736. class Amd extends _xfa_object.StringObject {
  63737. constructor(attributes) {
  63738. super(CONFIG_NS_ID, "amd");
  63739. }
  63740. }
  63741. class Area extends _xfa_object.XFAObject {
  63742. constructor(attributes) {
  63743. super(CONFIG_NS_ID, "area");
  63744. this.level = (0, _utils.getInteger)({
  63745. data: attributes.level,
  63746. defaultValue: 0,
  63747. validate: n => n >= 1 && n <= 3
  63748. });
  63749. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  63750. }
  63751. }
  63752. class Attributes extends _xfa_object.OptionObject {
  63753. constructor(attributes) {
  63754. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  63755. }
  63756. }
  63757. class AutoSave extends _xfa_object.OptionObject {
  63758. constructor(attributes) {
  63759. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  63760. }
  63761. }
  63762. class Base extends _xfa_object.StringObject {
  63763. constructor(attributes) {
  63764. super(CONFIG_NS_ID, "base");
  63765. }
  63766. }
  63767. class BatchOutput extends _xfa_object.XFAObject {
  63768. constructor(attributes) {
  63769. super(CONFIG_NS_ID, "batchOutput");
  63770. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  63771. }
  63772. }
  63773. class BehaviorOverride extends _xfa_object.ContentObject {
  63774. constructor(attributes) {
  63775. super(CONFIG_NS_ID, "behaviorOverride");
  63776. }
  63777. [_xfa_object.$finalize]() {
  63778. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  63779. }
  63780. }
  63781. class Cache extends _xfa_object.XFAObject {
  63782. constructor(attributes) {
  63783. super(CONFIG_NS_ID, "cache", true);
  63784. this.templateCache = null;
  63785. }
  63786. }
  63787. class Change extends _xfa_object.Option01 {
  63788. constructor(attributes) {
  63789. super(CONFIG_NS_ID, "change");
  63790. }
  63791. }
  63792. class Common extends _xfa_object.XFAObject {
  63793. constructor(attributes) {
  63794. super(CONFIG_NS_ID, "common", true);
  63795. this.data = null;
  63796. this.locale = null;
  63797. this.localeSet = null;
  63798. this.messaging = null;
  63799. this.suppressBanner = null;
  63800. this.template = null;
  63801. this.validationMessaging = null;
  63802. this.versionControl = null;
  63803. this.log = new _xfa_object.XFAObjectArray();
  63804. }
  63805. }
  63806. class Compress extends _xfa_object.XFAObject {
  63807. constructor(attributes) {
  63808. super(CONFIG_NS_ID, "compress");
  63809. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  63810. }
  63811. }
  63812. class CompressLogicalStructure extends _xfa_object.Option01 {
  63813. constructor(attributes) {
  63814. super(CONFIG_NS_ID, "compressLogicalStructure");
  63815. }
  63816. }
  63817. class CompressObjectStream extends _xfa_object.Option10 {
  63818. constructor(attributes) {
  63819. super(CONFIG_NS_ID, "compressObjectStream");
  63820. }
  63821. }
  63822. class Compression extends _xfa_object.XFAObject {
  63823. constructor(attributes) {
  63824. super(CONFIG_NS_ID, "compression", true);
  63825. this.compressLogicalStructure = null;
  63826. this.compressObjectStream = null;
  63827. this.level = null;
  63828. this.type = null;
  63829. }
  63830. }
  63831. class Config extends _xfa_object.XFAObject {
  63832. constructor(attributes) {
  63833. super(CONFIG_NS_ID, "config", true);
  63834. this.acrobat = null;
  63835. this.present = null;
  63836. this.trace = null;
  63837. this.agent = new _xfa_object.XFAObjectArray();
  63838. }
  63839. }
  63840. class Conformance extends _xfa_object.OptionObject {
  63841. constructor(attributes) {
  63842. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  63843. }
  63844. }
  63845. class ContentCopy extends _xfa_object.Option01 {
  63846. constructor(attributes) {
  63847. super(CONFIG_NS_ID, "contentCopy");
  63848. }
  63849. }
  63850. class Copies extends _xfa_object.IntegerObject {
  63851. constructor(attributes) {
  63852. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  63853. }
  63854. }
  63855. class Creator extends _xfa_object.StringObject {
  63856. constructor(attributes) {
  63857. super(CONFIG_NS_ID, "creator");
  63858. }
  63859. }
  63860. class CurrentPage extends _xfa_object.IntegerObject {
  63861. constructor(attributes) {
  63862. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  63863. }
  63864. }
  63865. class Data extends _xfa_object.XFAObject {
  63866. constructor(attributes) {
  63867. super(CONFIG_NS_ID, "data", true);
  63868. this.adjustData = null;
  63869. this.attributes = null;
  63870. this.incrementalLoad = null;
  63871. this.outputXSL = null;
  63872. this.range = null;
  63873. this.record = null;
  63874. this.startNode = null;
  63875. this.uri = null;
  63876. this.window = null;
  63877. this.xsl = null;
  63878. this.excludeNS = new _xfa_object.XFAObjectArray();
  63879. this.transform = new _xfa_object.XFAObjectArray();
  63880. }
  63881. }
  63882. class Debug extends _xfa_object.XFAObject {
  63883. constructor(attributes) {
  63884. super(CONFIG_NS_ID, "debug", true);
  63885. this.uri = null;
  63886. }
  63887. }
  63888. class DefaultTypeface extends _xfa_object.ContentObject {
  63889. constructor(attributes) {
  63890. super(CONFIG_NS_ID, "defaultTypeface");
  63891. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  63892. }
  63893. }
  63894. class Destination extends _xfa_object.OptionObject {
  63895. constructor(attributes) {
  63896. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  63897. }
  63898. }
  63899. class DocumentAssembly extends _xfa_object.Option01 {
  63900. constructor(attributes) {
  63901. super(CONFIG_NS_ID, "documentAssembly");
  63902. }
  63903. }
  63904. class Driver extends _xfa_object.XFAObject {
  63905. constructor(attributes) {
  63906. super(CONFIG_NS_ID, "driver", true);
  63907. this.name = attributes.name ? attributes.name.trim() : "";
  63908. this.fontInfo = null;
  63909. this.xdc = null;
  63910. }
  63911. }
  63912. class DuplexOption extends _xfa_object.OptionObject {
  63913. constructor(attributes) {
  63914. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  63915. }
  63916. }
  63917. class DynamicRender extends _xfa_object.OptionObject {
  63918. constructor(attributes) {
  63919. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  63920. }
  63921. }
  63922. class Embed extends _xfa_object.Option01 {
  63923. constructor(attributes) {
  63924. super(CONFIG_NS_ID, "embed");
  63925. }
  63926. }
  63927. class Encrypt extends _xfa_object.Option01 {
  63928. constructor(attributes) {
  63929. super(CONFIG_NS_ID, "encrypt");
  63930. }
  63931. }
  63932. class Encryption extends _xfa_object.XFAObject {
  63933. constructor(attributes) {
  63934. super(CONFIG_NS_ID, "encryption", true);
  63935. this.encrypt = null;
  63936. this.encryptionLevel = null;
  63937. this.permissions = null;
  63938. }
  63939. }
  63940. class EncryptionLevel extends _xfa_object.OptionObject {
  63941. constructor(attributes) {
  63942. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  63943. }
  63944. }
  63945. class Enforce extends _xfa_object.StringObject {
  63946. constructor(attributes) {
  63947. super(CONFIG_NS_ID, "enforce");
  63948. }
  63949. }
  63950. class Equate extends _xfa_object.XFAObject {
  63951. constructor(attributes) {
  63952. super(CONFIG_NS_ID, "equate");
  63953. this.force = (0, _utils.getInteger)({
  63954. data: attributes.force,
  63955. defaultValue: 1,
  63956. validate: n => n === 0
  63957. });
  63958. this.from = attributes.from || "";
  63959. this.to = attributes.to || "";
  63960. }
  63961. }
  63962. class EquateRange extends _xfa_object.XFAObject {
  63963. constructor(attributes) {
  63964. super(CONFIG_NS_ID, "equateRange");
  63965. this.from = attributes.from || "";
  63966. this.to = attributes.to || "";
  63967. this._unicodeRange = attributes.unicodeRange || "";
  63968. }
  63969. get unicodeRange() {
  63970. const ranges = [];
  63971. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  63972. const unicodeRange = this._unicodeRange;
  63973. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  63974. range = range.split("-", 2).map(x => {
  63975. const found = x.match(unicodeRegex);
  63976. if (!found) {
  63977. return 0;
  63978. }
  63979. return parseInt(found[1], 16);
  63980. });
  63981. if (range.length === 1) {
  63982. range.push(range[0]);
  63983. }
  63984. ranges.push(range);
  63985. }
  63986. return (0, _util.shadow)(this, "unicodeRange", ranges);
  63987. }
  63988. }
  63989. class Exclude extends _xfa_object.ContentObject {
  63990. constructor(attributes) {
  63991. super(CONFIG_NS_ID, "exclude");
  63992. }
  63993. [_xfa_object.$finalize]() {
  63994. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  63995. }
  63996. }
  63997. class ExcludeNS extends _xfa_object.StringObject {
  63998. constructor(attributes) {
  63999. super(CONFIG_NS_ID, "excludeNS");
  64000. }
  64001. }
  64002. class FlipLabel extends _xfa_object.OptionObject {
  64003. constructor(attributes) {
  64004. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  64005. }
  64006. }
  64007. class FontInfo extends _xfa_object.XFAObject {
  64008. constructor(attributes) {
  64009. super(CONFIG_NS_ID, "fontInfo", true);
  64010. this.embed = null;
  64011. this.map = null;
  64012. this.subsetBelow = null;
  64013. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  64014. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  64015. this.neverEmbed = new _xfa_object.XFAObjectArray();
  64016. }
  64017. }
  64018. class FormFieldFilling extends _xfa_object.Option01 {
  64019. constructor(attributes) {
  64020. super(CONFIG_NS_ID, "formFieldFilling");
  64021. }
  64022. }
  64023. class GroupParent extends _xfa_object.StringObject {
  64024. constructor(attributes) {
  64025. super(CONFIG_NS_ID, "groupParent");
  64026. }
  64027. }
  64028. class IfEmpty extends _xfa_object.OptionObject {
  64029. constructor(attributes) {
  64030. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  64031. }
  64032. }
  64033. class IncludeXDPContent extends _xfa_object.StringObject {
  64034. constructor(attributes) {
  64035. super(CONFIG_NS_ID, "includeXDPContent");
  64036. }
  64037. }
  64038. class IncrementalLoad extends _xfa_object.OptionObject {
  64039. constructor(attributes) {
  64040. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  64041. }
  64042. }
  64043. class IncrementalMerge extends _xfa_object.Option01 {
  64044. constructor(attributes) {
  64045. super(CONFIG_NS_ID, "incrementalMerge");
  64046. }
  64047. }
  64048. class Interactive extends _xfa_object.Option01 {
  64049. constructor(attributes) {
  64050. super(CONFIG_NS_ID, "interactive");
  64051. }
  64052. }
  64053. class Jog extends _xfa_object.OptionObject {
  64054. constructor(attributes) {
  64055. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  64056. }
  64057. }
  64058. class LabelPrinter extends _xfa_object.XFAObject {
  64059. constructor(attributes) {
  64060. super(CONFIG_NS_ID, "labelPrinter", true);
  64061. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  64062. this.batchOutput = null;
  64063. this.flipLabel = null;
  64064. this.fontInfo = null;
  64065. this.xdc = null;
  64066. }
  64067. }
  64068. class Layout extends _xfa_object.OptionObject {
  64069. constructor(attributes) {
  64070. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  64071. }
  64072. }
  64073. class Level extends _xfa_object.IntegerObject {
  64074. constructor(attributes) {
  64075. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  64076. }
  64077. }
  64078. class Linearized extends _xfa_object.Option01 {
  64079. constructor(attributes) {
  64080. super(CONFIG_NS_ID, "linearized");
  64081. }
  64082. }
  64083. class Locale extends _xfa_object.StringObject {
  64084. constructor(attributes) {
  64085. super(CONFIG_NS_ID, "locale");
  64086. }
  64087. }
  64088. class LocaleSet extends _xfa_object.StringObject {
  64089. constructor(attributes) {
  64090. super(CONFIG_NS_ID, "localeSet");
  64091. }
  64092. }
  64093. class Log extends _xfa_object.XFAObject {
  64094. constructor(attributes) {
  64095. super(CONFIG_NS_ID, "log", true);
  64096. this.mode = null;
  64097. this.threshold = null;
  64098. this.to = null;
  64099. this.uri = null;
  64100. }
  64101. }
  64102. class MapElement extends _xfa_object.XFAObject {
  64103. constructor(attributes) {
  64104. super(CONFIG_NS_ID, "map", true);
  64105. this.equate = new _xfa_object.XFAObjectArray();
  64106. this.equateRange = new _xfa_object.XFAObjectArray();
  64107. }
  64108. }
  64109. class MediumInfo extends _xfa_object.XFAObject {
  64110. constructor(attributes) {
  64111. super(CONFIG_NS_ID, "mediumInfo", true);
  64112. this.map = null;
  64113. }
  64114. }
  64115. class Message extends _xfa_object.XFAObject {
  64116. constructor(attributes) {
  64117. super(CONFIG_NS_ID, "message", true);
  64118. this.msgId = null;
  64119. this.severity = null;
  64120. }
  64121. }
  64122. class Messaging extends _xfa_object.XFAObject {
  64123. constructor(attributes) {
  64124. super(CONFIG_NS_ID, "messaging", true);
  64125. this.message = new _xfa_object.XFAObjectArray();
  64126. }
  64127. }
  64128. class Mode extends _xfa_object.OptionObject {
  64129. constructor(attributes) {
  64130. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  64131. }
  64132. }
  64133. class ModifyAnnots extends _xfa_object.Option01 {
  64134. constructor(attributes) {
  64135. super(CONFIG_NS_ID, "modifyAnnots");
  64136. }
  64137. }
  64138. class MsgId extends _xfa_object.IntegerObject {
  64139. constructor(attributes) {
  64140. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  64141. }
  64142. }
  64143. class NameAttr extends _xfa_object.StringObject {
  64144. constructor(attributes) {
  64145. super(CONFIG_NS_ID, "nameAttr");
  64146. }
  64147. }
  64148. class NeverEmbed extends _xfa_object.ContentObject {
  64149. constructor(attributes) {
  64150. super(CONFIG_NS_ID, "neverEmbed");
  64151. }
  64152. }
  64153. class NumberOfCopies extends _xfa_object.IntegerObject {
  64154. constructor(attributes) {
  64155. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  64156. }
  64157. }
  64158. class OpenAction extends _xfa_object.XFAObject {
  64159. constructor(attributes) {
  64160. super(CONFIG_NS_ID, "openAction", true);
  64161. this.destination = null;
  64162. }
  64163. }
  64164. class Output extends _xfa_object.XFAObject {
  64165. constructor(attributes) {
  64166. super(CONFIG_NS_ID, "output", true);
  64167. this.to = null;
  64168. this.type = null;
  64169. this.uri = null;
  64170. }
  64171. }
  64172. class OutputBin extends _xfa_object.StringObject {
  64173. constructor(attributes) {
  64174. super(CONFIG_NS_ID, "outputBin");
  64175. }
  64176. }
  64177. class OutputXSL extends _xfa_object.XFAObject {
  64178. constructor(attributes) {
  64179. super(CONFIG_NS_ID, "outputXSL", true);
  64180. this.uri = null;
  64181. }
  64182. }
  64183. class Overprint extends _xfa_object.OptionObject {
  64184. constructor(attributes) {
  64185. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  64186. }
  64187. }
  64188. class Packets extends _xfa_object.StringObject {
  64189. constructor(attributes) {
  64190. super(CONFIG_NS_ID, "packets");
  64191. }
  64192. [_xfa_object.$finalize]() {
  64193. if (this[_xfa_object.$content] === "*") {
  64194. return;
  64195. }
  64196. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  64197. }
  64198. }
  64199. class PageOffset extends _xfa_object.XFAObject {
  64200. constructor(attributes) {
  64201. super(CONFIG_NS_ID, "pageOffset");
  64202. this.x = (0, _utils.getInteger)({
  64203. data: attributes.x,
  64204. defaultValue: "useXDCSetting",
  64205. validate: n => true
  64206. });
  64207. this.y = (0, _utils.getInteger)({
  64208. data: attributes.y,
  64209. defaultValue: "useXDCSetting",
  64210. validate: n => true
  64211. });
  64212. }
  64213. }
  64214. class PageRange extends _xfa_object.StringObject {
  64215. constructor(attributes) {
  64216. super(CONFIG_NS_ID, "pageRange");
  64217. }
  64218. [_xfa_object.$finalize]() {
  64219. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  64220. const ranges = [];
  64221. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  64222. ranges.push(numbers.slice(i, i + 2));
  64223. }
  64224. this[_xfa_object.$content] = ranges;
  64225. }
  64226. }
  64227. class Pagination extends _xfa_object.OptionObject {
  64228. constructor(attributes) {
  64229. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  64230. }
  64231. }
  64232. class PaginationOverride extends _xfa_object.OptionObject {
  64233. constructor(attributes) {
  64234. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  64235. }
  64236. }
  64237. class Part extends _xfa_object.IntegerObject {
  64238. constructor(attributes) {
  64239. super(CONFIG_NS_ID, "part", 1, n => false);
  64240. }
  64241. }
  64242. class Pcl extends _xfa_object.XFAObject {
  64243. constructor(attributes) {
  64244. super(CONFIG_NS_ID, "pcl", true);
  64245. this.name = attributes.name || "";
  64246. this.batchOutput = null;
  64247. this.fontInfo = null;
  64248. this.jog = null;
  64249. this.mediumInfo = null;
  64250. this.outputBin = null;
  64251. this.pageOffset = null;
  64252. this.staple = null;
  64253. this.xdc = null;
  64254. }
  64255. }
  64256. class Pdf extends _xfa_object.XFAObject {
  64257. constructor(attributes) {
  64258. super(CONFIG_NS_ID, "pdf", true);
  64259. this.name = attributes.name || "";
  64260. this.adobeExtensionLevel = null;
  64261. this.batchOutput = null;
  64262. this.compression = null;
  64263. this.creator = null;
  64264. this.encryption = null;
  64265. this.fontInfo = null;
  64266. this.interactive = null;
  64267. this.linearized = null;
  64268. this.openAction = null;
  64269. this.pdfa = null;
  64270. this.producer = null;
  64271. this.renderPolicy = null;
  64272. this.scriptModel = null;
  64273. this.silentPrint = null;
  64274. this.submitFormat = null;
  64275. this.tagged = null;
  64276. this.version = null;
  64277. this.viewerPreferences = null;
  64278. this.xdc = null;
  64279. }
  64280. }
  64281. class Pdfa extends _xfa_object.XFAObject {
  64282. constructor(attributes) {
  64283. super(CONFIG_NS_ID, "pdfa", true);
  64284. this.amd = null;
  64285. this.conformance = null;
  64286. this.includeXDPContent = null;
  64287. this.part = null;
  64288. }
  64289. }
  64290. class Permissions extends _xfa_object.XFAObject {
  64291. constructor(attributes) {
  64292. super(CONFIG_NS_ID, "permissions", true);
  64293. this.accessibleContent = null;
  64294. this.change = null;
  64295. this.contentCopy = null;
  64296. this.documentAssembly = null;
  64297. this.formFieldFilling = null;
  64298. this.modifyAnnots = null;
  64299. this.plaintextMetadata = null;
  64300. this.print = null;
  64301. this.printHighQuality = null;
  64302. }
  64303. }
  64304. class PickTrayByPDFSize extends _xfa_object.Option01 {
  64305. constructor(attributes) {
  64306. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  64307. }
  64308. }
  64309. class Picture extends _xfa_object.StringObject {
  64310. constructor(attributes) {
  64311. super(CONFIG_NS_ID, "picture");
  64312. }
  64313. }
  64314. class PlaintextMetadata extends _xfa_object.Option01 {
  64315. constructor(attributes) {
  64316. super(CONFIG_NS_ID, "plaintextMetadata");
  64317. }
  64318. }
  64319. class Presence extends _xfa_object.OptionObject {
  64320. constructor(attributes) {
  64321. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  64322. }
  64323. }
  64324. class Present extends _xfa_object.XFAObject {
  64325. constructor(attributes) {
  64326. super(CONFIG_NS_ID, "present", true);
  64327. this.behaviorOverride = null;
  64328. this.cache = null;
  64329. this.common = null;
  64330. this.copies = null;
  64331. this.destination = null;
  64332. this.incrementalMerge = null;
  64333. this.layout = null;
  64334. this.output = null;
  64335. this.overprint = null;
  64336. this.pagination = null;
  64337. this.paginationOverride = null;
  64338. this.script = null;
  64339. this.validate = null;
  64340. this.xdp = null;
  64341. this.driver = new _xfa_object.XFAObjectArray();
  64342. this.labelPrinter = new _xfa_object.XFAObjectArray();
  64343. this.pcl = new _xfa_object.XFAObjectArray();
  64344. this.pdf = new _xfa_object.XFAObjectArray();
  64345. this.ps = new _xfa_object.XFAObjectArray();
  64346. this.submitUrl = new _xfa_object.XFAObjectArray();
  64347. this.webClient = new _xfa_object.XFAObjectArray();
  64348. this.zpl = new _xfa_object.XFAObjectArray();
  64349. }
  64350. }
  64351. class Print extends _xfa_object.Option01 {
  64352. constructor(attributes) {
  64353. super(CONFIG_NS_ID, "print");
  64354. }
  64355. }
  64356. class PrintHighQuality extends _xfa_object.Option01 {
  64357. constructor(attributes) {
  64358. super(CONFIG_NS_ID, "printHighQuality");
  64359. }
  64360. }
  64361. class PrintScaling extends _xfa_object.OptionObject {
  64362. constructor(attributes) {
  64363. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  64364. }
  64365. }
  64366. class PrinterName extends _xfa_object.StringObject {
  64367. constructor(attributes) {
  64368. super(CONFIG_NS_ID, "printerName");
  64369. }
  64370. }
  64371. class Producer extends _xfa_object.StringObject {
  64372. constructor(attributes) {
  64373. super(CONFIG_NS_ID, "producer");
  64374. }
  64375. }
  64376. class Ps extends _xfa_object.XFAObject {
  64377. constructor(attributes) {
  64378. super(CONFIG_NS_ID, "ps", true);
  64379. this.name = attributes.name || "";
  64380. this.batchOutput = null;
  64381. this.fontInfo = null;
  64382. this.jog = null;
  64383. this.mediumInfo = null;
  64384. this.outputBin = null;
  64385. this.staple = null;
  64386. this.xdc = null;
  64387. }
  64388. }
  64389. class Range extends _xfa_object.ContentObject {
  64390. constructor(attributes) {
  64391. super(CONFIG_NS_ID, "range");
  64392. }
  64393. [_xfa_object.$finalize]() {
  64394. 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 => {
  64395. if (range.length === 1) {
  64396. range.push(range[0]);
  64397. }
  64398. return range;
  64399. });
  64400. }
  64401. }
  64402. class Record extends _xfa_object.ContentObject {
  64403. constructor(attributes) {
  64404. super(CONFIG_NS_ID, "record");
  64405. }
  64406. [_xfa_object.$finalize]() {
  64407. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  64408. const n = parseInt(this[_xfa_object.$content], 10);
  64409. if (!isNaN(n) && n >= 0) {
  64410. this[_xfa_object.$content] = n;
  64411. }
  64412. }
  64413. }
  64414. class Relevant extends _xfa_object.ContentObject {
  64415. constructor(attributes) {
  64416. super(CONFIG_NS_ID, "relevant");
  64417. }
  64418. [_xfa_object.$finalize]() {
  64419. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  64420. }
  64421. }
  64422. class Rename extends _xfa_object.ContentObject {
  64423. constructor(attributes) {
  64424. super(CONFIG_NS_ID, "rename");
  64425. }
  64426. [_xfa_object.$finalize]() {
  64427. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  64428. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_xfa_object.$content])) {
  64429. (0, _util.warn)("XFA - Rename: invalid XFA name");
  64430. }
  64431. }
  64432. }
  64433. class RenderPolicy extends _xfa_object.OptionObject {
  64434. constructor(attributes) {
  64435. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  64436. }
  64437. }
  64438. class RunScripts extends _xfa_object.OptionObject {
  64439. constructor(attributes) {
  64440. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  64441. }
  64442. }
  64443. class Script extends _xfa_object.XFAObject {
  64444. constructor(attributes) {
  64445. super(CONFIG_NS_ID, "script", true);
  64446. this.currentPage = null;
  64447. this.exclude = null;
  64448. this.runScripts = null;
  64449. }
  64450. }
  64451. class ScriptModel extends _xfa_object.OptionObject {
  64452. constructor(attributes) {
  64453. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  64454. }
  64455. }
  64456. class Severity extends _xfa_object.OptionObject {
  64457. constructor(attributes) {
  64458. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  64459. }
  64460. }
  64461. class SilentPrint extends _xfa_object.XFAObject {
  64462. constructor(attributes) {
  64463. super(CONFIG_NS_ID, "silentPrint", true);
  64464. this.addSilentPrint = null;
  64465. this.printerName = null;
  64466. }
  64467. }
  64468. class Staple extends _xfa_object.XFAObject {
  64469. constructor(attributes) {
  64470. super(CONFIG_NS_ID, "staple");
  64471. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  64472. }
  64473. }
  64474. class StartNode extends _xfa_object.StringObject {
  64475. constructor(attributes) {
  64476. super(CONFIG_NS_ID, "startNode");
  64477. }
  64478. }
  64479. class StartPage extends _xfa_object.IntegerObject {
  64480. constructor(attributes) {
  64481. super(CONFIG_NS_ID, "startPage", 0, n => true);
  64482. }
  64483. }
  64484. class SubmitFormat extends _xfa_object.OptionObject {
  64485. constructor(attributes) {
  64486. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  64487. }
  64488. }
  64489. class SubmitUrl extends _xfa_object.StringObject {
  64490. constructor(attributes) {
  64491. super(CONFIG_NS_ID, "submitUrl");
  64492. }
  64493. }
  64494. class SubsetBelow extends _xfa_object.IntegerObject {
  64495. constructor(attributes) {
  64496. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  64497. }
  64498. }
  64499. class SuppressBanner extends _xfa_object.Option01 {
  64500. constructor(attributes) {
  64501. super(CONFIG_NS_ID, "suppressBanner");
  64502. }
  64503. }
  64504. class Tagged extends _xfa_object.Option01 {
  64505. constructor(attributes) {
  64506. super(CONFIG_NS_ID, "tagged");
  64507. }
  64508. }
  64509. class Template extends _xfa_object.XFAObject {
  64510. constructor(attributes) {
  64511. super(CONFIG_NS_ID, "template", true);
  64512. this.base = null;
  64513. this.relevant = null;
  64514. this.startPage = null;
  64515. this.uri = null;
  64516. this.xsl = null;
  64517. }
  64518. }
  64519. class Threshold extends _xfa_object.OptionObject {
  64520. constructor(attributes) {
  64521. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  64522. }
  64523. }
  64524. class To extends _xfa_object.OptionObject {
  64525. constructor(attributes) {
  64526. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  64527. }
  64528. }
  64529. class TemplateCache extends _xfa_object.XFAObject {
  64530. constructor(attributes) {
  64531. super(CONFIG_NS_ID, "templateCache");
  64532. this.maxEntries = (0, _utils.getInteger)({
  64533. data: attributes.maxEntries,
  64534. defaultValue: 5,
  64535. validate: n => n >= 0
  64536. });
  64537. }
  64538. }
  64539. class Trace extends _xfa_object.XFAObject {
  64540. constructor(attributes) {
  64541. super(CONFIG_NS_ID, "trace", true);
  64542. this.area = new _xfa_object.XFAObjectArray();
  64543. }
  64544. }
  64545. class Transform extends _xfa_object.XFAObject {
  64546. constructor(attributes) {
  64547. super(CONFIG_NS_ID, "transform", true);
  64548. this.groupParent = null;
  64549. this.ifEmpty = null;
  64550. this.nameAttr = null;
  64551. this.picture = null;
  64552. this.presence = null;
  64553. this.rename = null;
  64554. this.whitespace = null;
  64555. }
  64556. }
  64557. class Type extends _xfa_object.OptionObject {
  64558. constructor(attributes) {
  64559. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  64560. }
  64561. }
  64562. class Uri extends _xfa_object.StringObject {
  64563. constructor(attributes) {
  64564. super(CONFIG_NS_ID, "uri");
  64565. }
  64566. }
  64567. class Validate extends _xfa_object.OptionObject {
  64568. constructor(attributes) {
  64569. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  64570. }
  64571. }
  64572. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  64573. constructor(attributes) {
  64574. super(CONFIG_NS_ID, "validateApprovalSignatures");
  64575. }
  64576. [_xfa_object.$finalize]() {
  64577. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  64578. }
  64579. }
  64580. class ValidationMessaging extends _xfa_object.OptionObject {
  64581. constructor(attributes) {
  64582. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  64583. }
  64584. }
  64585. class Version extends _xfa_object.OptionObject {
  64586. constructor(attributes) {
  64587. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  64588. }
  64589. }
  64590. class VersionControl extends _xfa_object.XFAObject {
  64591. constructor(attributes) {
  64592. super(CONFIG_NS_ID, "VersionControl");
  64593. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  64594. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  64595. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  64596. }
  64597. }
  64598. class ViewerPreferences extends _xfa_object.XFAObject {
  64599. constructor(attributes) {
  64600. super(CONFIG_NS_ID, "viewerPreferences", true);
  64601. this.ADBE_JSConsole = null;
  64602. this.ADBE_JSDebugger = null;
  64603. this.addViewerPreferences = null;
  64604. this.duplexOption = null;
  64605. this.enforce = null;
  64606. this.numberOfCopies = null;
  64607. this.pageRange = null;
  64608. this.pickTrayByPDFSize = null;
  64609. this.printScaling = null;
  64610. }
  64611. }
  64612. class WebClient extends _xfa_object.XFAObject {
  64613. constructor(attributes) {
  64614. super(CONFIG_NS_ID, "webClient", true);
  64615. this.name = attributes.name ? attributes.name.trim() : "";
  64616. this.fontInfo = null;
  64617. this.xdc = null;
  64618. }
  64619. }
  64620. class Whitespace extends _xfa_object.OptionObject {
  64621. constructor(attributes) {
  64622. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  64623. }
  64624. }
  64625. class Window extends _xfa_object.ContentObject {
  64626. constructor(attributes) {
  64627. super(CONFIG_NS_ID, "window");
  64628. }
  64629. [_xfa_object.$finalize]() {
  64630. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  64631. if (pair.some(x => isNaN(x))) {
  64632. this[_xfa_object.$content] = [0, 0];
  64633. return;
  64634. }
  64635. if (pair.length === 1) {
  64636. pair.push(pair[0]);
  64637. }
  64638. this[_xfa_object.$content] = pair;
  64639. }
  64640. }
  64641. class Xdc extends _xfa_object.XFAObject {
  64642. constructor(attributes) {
  64643. super(CONFIG_NS_ID, "xdc", true);
  64644. this.uri = new _xfa_object.XFAObjectArray();
  64645. this.xsl = new _xfa_object.XFAObjectArray();
  64646. }
  64647. }
  64648. class Xdp extends _xfa_object.XFAObject {
  64649. constructor(attributes) {
  64650. super(CONFIG_NS_ID, "xdp", true);
  64651. this.packets = null;
  64652. }
  64653. }
  64654. class Xsl extends _xfa_object.XFAObject {
  64655. constructor(attributes) {
  64656. super(CONFIG_NS_ID, "xsl", true);
  64657. this.debug = null;
  64658. this.uri = null;
  64659. }
  64660. }
  64661. class Zpl extends _xfa_object.XFAObject {
  64662. constructor(attributes) {
  64663. super(CONFIG_NS_ID, "zpl", true);
  64664. this.name = attributes.name ? attributes.name.trim() : "";
  64665. this.batchOutput = null;
  64666. this.flipLabel = null;
  64667. this.fontInfo = null;
  64668. this.xdc = null;
  64669. }
  64670. }
  64671. class ConfigNamespace {
  64672. static [_namespaces.$buildXFAObject](name, attributes) {
  64673. if (ConfigNamespace.hasOwnProperty(name)) {
  64674. return ConfigNamespace[name](attributes);
  64675. }
  64676. return undefined;
  64677. }
  64678. static acrobat(attrs) {
  64679. return new Acrobat(attrs);
  64680. }
  64681. static acrobat7(attrs) {
  64682. return new Acrobat7(attrs);
  64683. }
  64684. static ADBE_JSConsole(attrs) {
  64685. return new ADBE_JSConsole(attrs);
  64686. }
  64687. static ADBE_JSDebugger(attrs) {
  64688. return new ADBE_JSDebugger(attrs);
  64689. }
  64690. static addSilentPrint(attrs) {
  64691. return new AddSilentPrint(attrs);
  64692. }
  64693. static addViewerPreferences(attrs) {
  64694. return new AddViewerPreferences(attrs);
  64695. }
  64696. static adjustData(attrs) {
  64697. return new AdjustData(attrs);
  64698. }
  64699. static adobeExtensionLevel(attrs) {
  64700. return new AdobeExtensionLevel(attrs);
  64701. }
  64702. static agent(attrs) {
  64703. return new Agent(attrs);
  64704. }
  64705. static alwaysEmbed(attrs) {
  64706. return new AlwaysEmbed(attrs);
  64707. }
  64708. static amd(attrs) {
  64709. return new Amd(attrs);
  64710. }
  64711. static area(attrs) {
  64712. return new Area(attrs);
  64713. }
  64714. static attributes(attrs) {
  64715. return new Attributes(attrs);
  64716. }
  64717. static autoSave(attrs) {
  64718. return new AutoSave(attrs);
  64719. }
  64720. static base(attrs) {
  64721. return new Base(attrs);
  64722. }
  64723. static batchOutput(attrs) {
  64724. return new BatchOutput(attrs);
  64725. }
  64726. static behaviorOverride(attrs) {
  64727. return new BehaviorOverride(attrs);
  64728. }
  64729. static cache(attrs) {
  64730. return new Cache(attrs);
  64731. }
  64732. static change(attrs) {
  64733. return new Change(attrs);
  64734. }
  64735. static common(attrs) {
  64736. return new Common(attrs);
  64737. }
  64738. static compress(attrs) {
  64739. return new Compress(attrs);
  64740. }
  64741. static compressLogicalStructure(attrs) {
  64742. return new CompressLogicalStructure(attrs);
  64743. }
  64744. static compressObjectStream(attrs) {
  64745. return new CompressObjectStream(attrs);
  64746. }
  64747. static compression(attrs) {
  64748. return new Compression(attrs);
  64749. }
  64750. static config(attrs) {
  64751. return new Config(attrs);
  64752. }
  64753. static conformance(attrs) {
  64754. return new Conformance(attrs);
  64755. }
  64756. static contentCopy(attrs) {
  64757. return new ContentCopy(attrs);
  64758. }
  64759. static copies(attrs) {
  64760. return new Copies(attrs);
  64761. }
  64762. static creator(attrs) {
  64763. return new Creator(attrs);
  64764. }
  64765. static currentPage(attrs) {
  64766. return new CurrentPage(attrs);
  64767. }
  64768. static data(attrs) {
  64769. return new Data(attrs);
  64770. }
  64771. static debug(attrs) {
  64772. return new Debug(attrs);
  64773. }
  64774. static defaultTypeface(attrs) {
  64775. return new DefaultTypeface(attrs);
  64776. }
  64777. static destination(attrs) {
  64778. return new Destination(attrs);
  64779. }
  64780. static documentAssembly(attrs) {
  64781. return new DocumentAssembly(attrs);
  64782. }
  64783. static driver(attrs) {
  64784. return new Driver(attrs);
  64785. }
  64786. static duplexOption(attrs) {
  64787. return new DuplexOption(attrs);
  64788. }
  64789. static dynamicRender(attrs) {
  64790. return new DynamicRender(attrs);
  64791. }
  64792. static embed(attrs) {
  64793. return new Embed(attrs);
  64794. }
  64795. static encrypt(attrs) {
  64796. return new Encrypt(attrs);
  64797. }
  64798. static encryption(attrs) {
  64799. return new Encryption(attrs);
  64800. }
  64801. static encryptionLevel(attrs) {
  64802. return new EncryptionLevel(attrs);
  64803. }
  64804. static enforce(attrs) {
  64805. return new Enforce(attrs);
  64806. }
  64807. static equate(attrs) {
  64808. return new Equate(attrs);
  64809. }
  64810. static equateRange(attrs) {
  64811. return new EquateRange(attrs);
  64812. }
  64813. static exclude(attrs) {
  64814. return new Exclude(attrs);
  64815. }
  64816. static excludeNS(attrs) {
  64817. return new ExcludeNS(attrs);
  64818. }
  64819. static flipLabel(attrs) {
  64820. return new FlipLabel(attrs);
  64821. }
  64822. static fontInfo(attrs) {
  64823. return new FontInfo(attrs);
  64824. }
  64825. static formFieldFilling(attrs) {
  64826. return new FormFieldFilling(attrs);
  64827. }
  64828. static groupParent(attrs) {
  64829. return new GroupParent(attrs);
  64830. }
  64831. static ifEmpty(attrs) {
  64832. return new IfEmpty(attrs);
  64833. }
  64834. static includeXDPContent(attrs) {
  64835. return new IncludeXDPContent(attrs);
  64836. }
  64837. static incrementalLoad(attrs) {
  64838. return new IncrementalLoad(attrs);
  64839. }
  64840. static incrementalMerge(attrs) {
  64841. return new IncrementalMerge(attrs);
  64842. }
  64843. static interactive(attrs) {
  64844. return new Interactive(attrs);
  64845. }
  64846. static jog(attrs) {
  64847. return new Jog(attrs);
  64848. }
  64849. static labelPrinter(attrs) {
  64850. return new LabelPrinter(attrs);
  64851. }
  64852. static layout(attrs) {
  64853. return new Layout(attrs);
  64854. }
  64855. static level(attrs) {
  64856. return new Level(attrs);
  64857. }
  64858. static linearized(attrs) {
  64859. return new Linearized(attrs);
  64860. }
  64861. static locale(attrs) {
  64862. return new Locale(attrs);
  64863. }
  64864. static localeSet(attrs) {
  64865. return new LocaleSet(attrs);
  64866. }
  64867. static log(attrs) {
  64868. return new Log(attrs);
  64869. }
  64870. static map(attrs) {
  64871. return new MapElement(attrs);
  64872. }
  64873. static mediumInfo(attrs) {
  64874. return new MediumInfo(attrs);
  64875. }
  64876. static message(attrs) {
  64877. return new Message(attrs);
  64878. }
  64879. static messaging(attrs) {
  64880. return new Messaging(attrs);
  64881. }
  64882. static mode(attrs) {
  64883. return new Mode(attrs);
  64884. }
  64885. static modifyAnnots(attrs) {
  64886. return new ModifyAnnots(attrs);
  64887. }
  64888. static msgId(attrs) {
  64889. return new MsgId(attrs);
  64890. }
  64891. static nameAttr(attrs) {
  64892. return new NameAttr(attrs);
  64893. }
  64894. static neverEmbed(attrs) {
  64895. return new NeverEmbed(attrs);
  64896. }
  64897. static numberOfCopies(attrs) {
  64898. return new NumberOfCopies(attrs);
  64899. }
  64900. static openAction(attrs) {
  64901. return new OpenAction(attrs);
  64902. }
  64903. static output(attrs) {
  64904. return new Output(attrs);
  64905. }
  64906. static outputBin(attrs) {
  64907. return new OutputBin(attrs);
  64908. }
  64909. static outputXSL(attrs) {
  64910. return new OutputXSL(attrs);
  64911. }
  64912. static overprint(attrs) {
  64913. return new Overprint(attrs);
  64914. }
  64915. static packets(attrs) {
  64916. return new Packets(attrs);
  64917. }
  64918. static pageOffset(attrs) {
  64919. return new PageOffset(attrs);
  64920. }
  64921. static pageRange(attrs) {
  64922. return new PageRange(attrs);
  64923. }
  64924. static pagination(attrs) {
  64925. return new Pagination(attrs);
  64926. }
  64927. static paginationOverride(attrs) {
  64928. return new PaginationOverride(attrs);
  64929. }
  64930. static part(attrs) {
  64931. return new Part(attrs);
  64932. }
  64933. static pcl(attrs) {
  64934. return new Pcl(attrs);
  64935. }
  64936. static pdf(attrs) {
  64937. return new Pdf(attrs);
  64938. }
  64939. static pdfa(attrs) {
  64940. return new Pdfa(attrs);
  64941. }
  64942. static permissions(attrs) {
  64943. return new Permissions(attrs);
  64944. }
  64945. static pickTrayByPDFSize(attrs) {
  64946. return new PickTrayByPDFSize(attrs);
  64947. }
  64948. static picture(attrs) {
  64949. return new Picture(attrs);
  64950. }
  64951. static plaintextMetadata(attrs) {
  64952. return new PlaintextMetadata(attrs);
  64953. }
  64954. static presence(attrs) {
  64955. return new Presence(attrs);
  64956. }
  64957. static present(attrs) {
  64958. return new Present(attrs);
  64959. }
  64960. static print(attrs) {
  64961. return new Print(attrs);
  64962. }
  64963. static printHighQuality(attrs) {
  64964. return new PrintHighQuality(attrs);
  64965. }
  64966. static printScaling(attrs) {
  64967. return new PrintScaling(attrs);
  64968. }
  64969. static printerName(attrs) {
  64970. return new PrinterName(attrs);
  64971. }
  64972. static producer(attrs) {
  64973. return new Producer(attrs);
  64974. }
  64975. static ps(attrs) {
  64976. return new Ps(attrs);
  64977. }
  64978. static range(attrs) {
  64979. return new Range(attrs);
  64980. }
  64981. static record(attrs) {
  64982. return new Record(attrs);
  64983. }
  64984. static relevant(attrs) {
  64985. return new Relevant(attrs);
  64986. }
  64987. static rename(attrs) {
  64988. return new Rename(attrs);
  64989. }
  64990. static renderPolicy(attrs) {
  64991. return new RenderPolicy(attrs);
  64992. }
  64993. static runScripts(attrs) {
  64994. return new RunScripts(attrs);
  64995. }
  64996. static script(attrs) {
  64997. return new Script(attrs);
  64998. }
  64999. static scriptModel(attrs) {
  65000. return new ScriptModel(attrs);
  65001. }
  65002. static severity(attrs) {
  65003. return new Severity(attrs);
  65004. }
  65005. static silentPrint(attrs) {
  65006. return new SilentPrint(attrs);
  65007. }
  65008. static staple(attrs) {
  65009. return new Staple(attrs);
  65010. }
  65011. static startNode(attrs) {
  65012. return new StartNode(attrs);
  65013. }
  65014. static startPage(attrs) {
  65015. return new StartPage(attrs);
  65016. }
  65017. static submitFormat(attrs) {
  65018. return new SubmitFormat(attrs);
  65019. }
  65020. static submitUrl(attrs) {
  65021. return new SubmitUrl(attrs);
  65022. }
  65023. static subsetBelow(attrs) {
  65024. return new SubsetBelow(attrs);
  65025. }
  65026. static suppressBanner(attrs) {
  65027. return new SuppressBanner(attrs);
  65028. }
  65029. static tagged(attrs) {
  65030. return new Tagged(attrs);
  65031. }
  65032. static template(attrs) {
  65033. return new Template(attrs);
  65034. }
  65035. static templateCache(attrs) {
  65036. return new TemplateCache(attrs);
  65037. }
  65038. static threshold(attrs) {
  65039. return new Threshold(attrs);
  65040. }
  65041. static to(attrs) {
  65042. return new To(attrs);
  65043. }
  65044. static trace(attrs) {
  65045. return new Trace(attrs);
  65046. }
  65047. static transform(attrs) {
  65048. return new Transform(attrs);
  65049. }
  65050. static type(attrs) {
  65051. return new Type(attrs);
  65052. }
  65053. static uri(attrs) {
  65054. return new Uri(attrs);
  65055. }
  65056. static validate(attrs) {
  65057. return new Validate(attrs);
  65058. }
  65059. static validateApprovalSignatures(attrs) {
  65060. return new ValidateApprovalSignatures(attrs);
  65061. }
  65062. static validationMessaging(attrs) {
  65063. return new ValidationMessaging(attrs);
  65064. }
  65065. static version(attrs) {
  65066. return new Version(attrs);
  65067. }
  65068. static versionControl(attrs) {
  65069. return new VersionControl(attrs);
  65070. }
  65071. static viewerPreferences(attrs) {
  65072. return new ViewerPreferences(attrs);
  65073. }
  65074. static webClient(attrs) {
  65075. return new WebClient(attrs);
  65076. }
  65077. static whitespace(attrs) {
  65078. return new Whitespace(attrs);
  65079. }
  65080. static window(attrs) {
  65081. return new Window(attrs);
  65082. }
  65083. static xdc(attrs) {
  65084. return new Xdc(attrs);
  65085. }
  65086. static xdp(attrs) {
  65087. return new Xdp(attrs);
  65088. }
  65089. static xsl(attrs) {
  65090. return new Xsl(attrs);
  65091. }
  65092. static zpl(attrs) {
  65093. return new Zpl(attrs);
  65094. }
  65095. }
  65096. exports.ConfigNamespace = ConfigNamespace;
  65097. /***/ }),
  65098. /* 221 */
  65099. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65100. "use strict";
  65101. Object.defineProperty(exports, "__esModule", ({
  65102. value: true
  65103. }));
  65104. exports.ConnectionSetNamespace = void 0;
  65105. var _namespaces = __w_pdfjs_require__(208);
  65106. var _xfa_object = __w_pdfjs_require__(206);
  65107. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  65108. class ConnectionSet extends _xfa_object.XFAObject {
  65109. constructor(attributes) {
  65110. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  65111. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  65112. this.xmlConnection = new _xfa_object.XFAObjectArray();
  65113. this.xsdConnection = new _xfa_object.XFAObjectArray();
  65114. }
  65115. }
  65116. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  65117. constructor(attributes) {
  65118. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  65119. this.id = attributes.id || "";
  65120. this.name = attributes.name || "";
  65121. this.use = attributes.use || "";
  65122. this.usehref = attributes.usehref || "";
  65123. }
  65124. }
  65125. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  65126. constructor(attributes) {
  65127. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  65128. this.id = attributes.id || "";
  65129. this.name = attributes.name || "";
  65130. this.use = attributes.use || "";
  65131. this.usehref = attributes.usehref || "";
  65132. }
  65133. }
  65134. class Operation extends _xfa_object.StringObject {
  65135. constructor(attributes) {
  65136. super(CONNECTION_SET_NS_ID, "operation");
  65137. this.id = attributes.id || "";
  65138. this.input = attributes.input || "";
  65139. this.name = attributes.name || "";
  65140. this.output = attributes.output || "";
  65141. this.use = attributes.use || "";
  65142. this.usehref = attributes.usehref || "";
  65143. }
  65144. }
  65145. class RootElement extends _xfa_object.StringObject {
  65146. constructor(attributes) {
  65147. super(CONNECTION_SET_NS_ID, "rootElement");
  65148. this.id = attributes.id || "";
  65149. this.name = attributes.name || "";
  65150. this.use = attributes.use || "";
  65151. this.usehref = attributes.usehref || "";
  65152. }
  65153. }
  65154. class SoapAction extends _xfa_object.StringObject {
  65155. constructor(attributes) {
  65156. super(CONNECTION_SET_NS_ID, "soapAction");
  65157. this.id = attributes.id || "";
  65158. this.name = attributes.name || "";
  65159. this.use = attributes.use || "";
  65160. this.usehref = attributes.usehref || "";
  65161. }
  65162. }
  65163. class SoapAddress extends _xfa_object.StringObject {
  65164. constructor(attributes) {
  65165. super(CONNECTION_SET_NS_ID, "soapAddress");
  65166. this.id = attributes.id || "";
  65167. this.name = attributes.name || "";
  65168. this.use = attributes.use || "";
  65169. this.usehref = attributes.usehref || "";
  65170. }
  65171. }
  65172. class Uri extends _xfa_object.StringObject {
  65173. constructor(attributes) {
  65174. super(CONNECTION_SET_NS_ID, "uri");
  65175. this.id = attributes.id || "";
  65176. this.name = attributes.name || "";
  65177. this.use = attributes.use || "";
  65178. this.usehref = attributes.usehref || "";
  65179. }
  65180. }
  65181. class WsdlAddress extends _xfa_object.StringObject {
  65182. constructor(attributes) {
  65183. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  65184. this.id = attributes.id || "";
  65185. this.name = attributes.name || "";
  65186. this.use = attributes.use || "";
  65187. this.usehref = attributes.usehref || "";
  65188. }
  65189. }
  65190. class WsdlConnection extends _xfa_object.XFAObject {
  65191. constructor(attributes) {
  65192. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  65193. this.dataDescription = attributes.dataDescription || "";
  65194. this.name = attributes.name || "";
  65195. this.effectiveInputPolicy = null;
  65196. this.effectiveOutputPolicy = null;
  65197. this.operation = null;
  65198. this.soapAction = null;
  65199. this.soapAddress = null;
  65200. this.wsdlAddress = null;
  65201. }
  65202. }
  65203. class XmlConnection extends _xfa_object.XFAObject {
  65204. constructor(attributes) {
  65205. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  65206. this.dataDescription = attributes.dataDescription || "";
  65207. this.name = attributes.name || "";
  65208. this.uri = null;
  65209. }
  65210. }
  65211. class XsdConnection extends _xfa_object.XFAObject {
  65212. constructor(attributes) {
  65213. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  65214. this.dataDescription = attributes.dataDescription || "";
  65215. this.name = attributes.name || "";
  65216. this.rootElement = null;
  65217. this.uri = null;
  65218. }
  65219. }
  65220. class ConnectionSetNamespace {
  65221. static [_namespaces.$buildXFAObject](name, attributes) {
  65222. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  65223. return ConnectionSetNamespace[name](attributes);
  65224. }
  65225. return undefined;
  65226. }
  65227. static connectionSet(attrs) {
  65228. return new ConnectionSet(attrs);
  65229. }
  65230. static effectiveInputPolicy(attrs) {
  65231. return new EffectiveInputPolicy(attrs);
  65232. }
  65233. static effectiveOutputPolicy(attrs) {
  65234. return new EffectiveOutputPolicy(attrs);
  65235. }
  65236. static operation(attrs) {
  65237. return new Operation(attrs);
  65238. }
  65239. static rootElement(attrs) {
  65240. return new RootElement(attrs);
  65241. }
  65242. static soapAction(attrs) {
  65243. return new SoapAction(attrs);
  65244. }
  65245. static soapAddress(attrs) {
  65246. return new SoapAddress(attrs);
  65247. }
  65248. static uri(attrs) {
  65249. return new Uri(attrs);
  65250. }
  65251. static wsdlAddress(attrs) {
  65252. return new WsdlAddress(attrs);
  65253. }
  65254. static wsdlConnection(attrs) {
  65255. return new WsdlConnection(attrs);
  65256. }
  65257. static xmlConnection(attrs) {
  65258. return new XmlConnection(attrs);
  65259. }
  65260. static xsdConnection(attrs) {
  65261. return new XsdConnection(attrs);
  65262. }
  65263. }
  65264. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  65265. /***/ }),
  65266. /* 222 */
  65267. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65268. "use strict";
  65269. Object.defineProperty(exports, "__esModule", ({
  65270. value: true
  65271. }));
  65272. exports.DatasetsNamespace = void 0;
  65273. var _xfa_object = __w_pdfjs_require__(206);
  65274. var _namespaces = __w_pdfjs_require__(208);
  65275. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  65276. class Data extends _xfa_object.XmlObject {
  65277. constructor(attributes) {
  65278. super(DATASETS_NS_ID, "data", attributes);
  65279. }
  65280. [_xfa_object.$isNsAgnostic]() {
  65281. return true;
  65282. }
  65283. }
  65284. class Datasets extends _xfa_object.XFAObject {
  65285. constructor(attributes) {
  65286. super(DATASETS_NS_ID, "datasets", true);
  65287. this.data = null;
  65288. this.Signature = null;
  65289. }
  65290. [_xfa_object.$onChild](child) {
  65291. const name = child[_xfa_object.$nodeName];
  65292. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  65293. this[name] = child;
  65294. }
  65295. this[_xfa_object.$appendChild](child);
  65296. }
  65297. }
  65298. class DatasetsNamespace {
  65299. static [_namespaces.$buildXFAObject](name, attributes) {
  65300. if (DatasetsNamespace.hasOwnProperty(name)) {
  65301. return DatasetsNamespace[name](attributes);
  65302. }
  65303. return undefined;
  65304. }
  65305. static datasets(attributes) {
  65306. return new Datasets(attributes);
  65307. }
  65308. static data(attributes) {
  65309. return new Data(attributes);
  65310. }
  65311. }
  65312. exports.DatasetsNamespace = DatasetsNamespace;
  65313. /***/ }),
  65314. /* 223 */
  65315. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65316. "use strict";
  65317. Object.defineProperty(exports, "__esModule", ({
  65318. value: true
  65319. }));
  65320. exports.LocaleSetNamespace = void 0;
  65321. var _namespaces = __w_pdfjs_require__(208);
  65322. var _xfa_object = __w_pdfjs_require__(206);
  65323. var _utils = __w_pdfjs_require__(207);
  65324. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  65325. class CalendarSymbols extends _xfa_object.XFAObject {
  65326. constructor(attributes) {
  65327. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  65328. this.name = "gregorian";
  65329. this.dayNames = new _xfa_object.XFAObjectArray(2);
  65330. this.eraNames = null;
  65331. this.meridiemNames = null;
  65332. this.monthNames = new _xfa_object.XFAObjectArray(2);
  65333. }
  65334. }
  65335. class CurrencySymbol extends _xfa_object.StringObject {
  65336. constructor(attributes) {
  65337. super(LOCALE_SET_NS_ID, "currencySymbol");
  65338. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  65339. }
  65340. }
  65341. class CurrencySymbols extends _xfa_object.XFAObject {
  65342. constructor(attributes) {
  65343. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  65344. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  65345. }
  65346. }
  65347. class DatePattern extends _xfa_object.StringObject {
  65348. constructor(attributes) {
  65349. super(LOCALE_SET_NS_ID, "datePattern");
  65350. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65351. }
  65352. }
  65353. class DatePatterns extends _xfa_object.XFAObject {
  65354. constructor(attributes) {
  65355. super(LOCALE_SET_NS_ID, "datePatterns", true);
  65356. this.datePattern = new _xfa_object.XFAObjectArray(4);
  65357. }
  65358. }
  65359. class DateTimeSymbols extends _xfa_object.ContentObject {
  65360. constructor(attributes) {
  65361. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  65362. }
  65363. }
  65364. class Day extends _xfa_object.StringObject {
  65365. constructor(attributes) {
  65366. super(LOCALE_SET_NS_ID, "day");
  65367. }
  65368. }
  65369. class DayNames extends _xfa_object.XFAObject {
  65370. constructor(attributes) {
  65371. super(LOCALE_SET_NS_ID, "dayNames", true);
  65372. this.abbr = (0, _utils.getInteger)({
  65373. data: attributes.abbr,
  65374. defaultValue: 0,
  65375. validate: x => x === 1
  65376. });
  65377. this.day = new _xfa_object.XFAObjectArray(7);
  65378. }
  65379. }
  65380. class Era extends _xfa_object.StringObject {
  65381. constructor(attributes) {
  65382. super(LOCALE_SET_NS_ID, "era");
  65383. }
  65384. }
  65385. class EraNames extends _xfa_object.XFAObject {
  65386. constructor(attributes) {
  65387. super(LOCALE_SET_NS_ID, "eraNames", true);
  65388. this.era = new _xfa_object.XFAObjectArray(2);
  65389. }
  65390. }
  65391. class Locale extends _xfa_object.XFAObject {
  65392. constructor(attributes) {
  65393. super(LOCALE_SET_NS_ID, "locale", true);
  65394. this.desc = attributes.desc || "";
  65395. this.name = "isoname";
  65396. this.calendarSymbols = null;
  65397. this.currencySymbols = null;
  65398. this.datePatterns = null;
  65399. this.dateTimeSymbols = null;
  65400. this.numberPatterns = null;
  65401. this.numberSymbols = null;
  65402. this.timePatterns = null;
  65403. this.typeFaces = null;
  65404. }
  65405. }
  65406. class LocaleSet extends _xfa_object.XFAObject {
  65407. constructor(attributes) {
  65408. super(LOCALE_SET_NS_ID, "localeSet", true);
  65409. this.locale = new _xfa_object.XFAObjectArray();
  65410. }
  65411. }
  65412. class Meridiem extends _xfa_object.StringObject {
  65413. constructor(attributes) {
  65414. super(LOCALE_SET_NS_ID, "meridiem");
  65415. }
  65416. }
  65417. class MeridiemNames extends _xfa_object.XFAObject {
  65418. constructor(attributes) {
  65419. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  65420. this.meridiem = new _xfa_object.XFAObjectArray(2);
  65421. }
  65422. }
  65423. class Month extends _xfa_object.StringObject {
  65424. constructor(attributes) {
  65425. super(LOCALE_SET_NS_ID, "month");
  65426. }
  65427. }
  65428. class MonthNames extends _xfa_object.XFAObject {
  65429. constructor(attributes) {
  65430. super(LOCALE_SET_NS_ID, "monthNames", true);
  65431. this.abbr = (0, _utils.getInteger)({
  65432. data: attributes.abbr,
  65433. defaultValue: 0,
  65434. validate: x => x === 1
  65435. });
  65436. this.month = new _xfa_object.XFAObjectArray(12);
  65437. }
  65438. }
  65439. class NumberPattern extends _xfa_object.StringObject {
  65440. constructor(attributes) {
  65441. super(LOCALE_SET_NS_ID, "numberPattern");
  65442. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65443. }
  65444. }
  65445. class NumberPatterns extends _xfa_object.XFAObject {
  65446. constructor(attributes) {
  65447. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  65448. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  65449. }
  65450. }
  65451. class NumberSymbol extends _xfa_object.StringObject {
  65452. constructor(attributes) {
  65453. super(LOCALE_SET_NS_ID, "numberSymbol");
  65454. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  65455. }
  65456. }
  65457. class NumberSymbols extends _xfa_object.XFAObject {
  65458. constructor(attributes) {
  65459. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  65460. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  65461. }
  65462. }
  65463. class TimePattern extends _xfa_object.StringObject {
  65464. constructor(attributes) {
  65465. super(LOCALE_SET_NS_ID, "timePattern");
  65466. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65467. }
  65468. }
  65469. class TimePatterns extends _xfa_object.XFAObject {
  65470. constructor(attributes) {
  65471. super(LOCALE_SET_NS_ID, "timePatterns", true);
  65472. this.timePattern = new _xfa_object.XFAObjectArray(4);
  65473. }
  65474. }
  65475. class TypeFace extends _xfa_object.XFAObject {
  65476. constructor(attributes) {
  65477. super(LOCALE_SET_NS_ID, "typeFace", true);
  65478. this.name = attributes.name | "";
  65479. }
  65480. }
  65481. class TypeFaces extends _xfa_object.XFAObject {
  65482. constructor(attributes) {
  65483. super(LOCALE_SET_NS_ID, "typeFaces", true);
  65484. this.typeFace = new _xfa_object.XFAObjectArray();
  65485. }
  65486. }
  65487. class LocaleSetNamespace {
  65488. static [_namespaces.$buildXFAObject](name, attributes) {
  65489. if (LocaleSetNamespace.hasOwnProperty(name)) {
  65490. return LocaleSetNamespace[name](attributes);
  65491. }
  65492. return undefined;
  65493. }
  65494. static calendarSymbols(attrs) {
  65495. return new CalendarSymbols(attrs);
  65496. }
  65497. static currencySymbol(attrs) {
  65498. return new CurrencySymbol(attrs);
  65499. }
  65500. static currencySymbols(attrs) {
  65501. return new CurrencySymbols(attrs);
  65502. }
  65503. static datePattern(attrs) {
  65504. return new DatePattern(attrs);
  65505. }
  65506. static datePatterns(attrs) {
  65507. return new DatePatterns(attrs);
  65508. }
  65509. static dateTimeSymbols(attrs) {
  65510. return new DateTimeSymbols(attrs);
  65511. }
  65512. static day(attrs) {
  65513. return new Day(attrs);
  65514. }
  65515. static dayNames(attrs) {
  65516. return new DayNames(attrs);
  65517. }
  65518. static era(attrs) {
  65519. return new Era(attrs);
  65520. }
  65521. static eraNames(attrs) {
  65522. return new EraNames(attrs);
  65523. }
  65524. static locale(attrs) {
  65525. return new Locale(attrs);
  65526. }
  65527. static localeSet(attrs) {
  65528. return new LocaleSet(attrs);
  65529. }
  65530. static meridiem(attrs) {
  65531. return new Meridiem(attrs);
  65532. }
  65533. static meridiemNames(attrs) {
  65534. return new MeridiemNames(attrs);
  65535. }
  65536. static month(attrs) {
  65537. return new Month(attrs);
  65538. }
  65539. static monthNames(attrs) {
  65540. return new MonthNames(attrs);
  65541. }
  65542. static numberPattern(attrs) {
  65543. return new NumberPattern(attrs);
  65544. }
  65545. static numberPatterns(attrs) {
  65546. return new NumberPatterns(attrs);
  65547. }
  65548. static numberSymbol(attrs) {
  65549. return new NumberSymbol(attrs);
  65550. }
  65551. static numberSymbols(attrs) {
  65552. return new NumberSymbols(attrs);
  65553. }
  65554. static timePattern(attrs) {
  65555. return new TimePattern(attrs);
  65556. }
  65557. static timePatterns(attrs) {
  65558. return new TimePatterns(attrs);
  65559. }
  65560. static typeFace(attrs) {
  65561. return new TypeFace(attrs);
  65562. }
  65563. static typeFaces(attrs) {
  65564. return new TypeFaces(attrs);
  65565. }
  65566. }
  65567. exports.LocaleSetNamespace = LocaleSetNamespace;
  65568. /***/ }),
  65569. /* 224 */
  65570. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65571. "use strict";
  65572. Object.defineProperty(exports, "__esModule", ({
  65573. value: true
  65574. }));
  65575. exports.SignatureNamespace = void 0;
  65576. var _namespaces = __w_pdfjs_require__(208);
  65577. var _xfa_object = __w_pdfjs_require__(206);
  65578. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  65579. class Signature extends _xfa_object.XFAObject {
  65580. constructor(attributes) {
  65581. super(SIGNATURE_NS_ID, "signature", true);
  65582. }
  65583. }
  65584. class SignatureNamespace {
  65585. static [_namespaces.$buildXFAObject](name, attributes) {
  65586. if (SignatureNamespace.hasOwnProperty(name)) {
  65587. return SignatureNamespace[name](attributes);
  65588. }
  65589. return undefined;
  65590. }
  65591. static signature(attributes) {
  65592. return new Signature(attributes);
  65593. }
  65594. }
  65595. exports.SignatureNamespace = SignatureNamespace;
  65596. /***/ }),
  65597. /* 225 */
  65598. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65599. "use strict";
  65600. Object.defineProperty(exports, "__esModule", ({
  65601. value: true
  65602. }));
  65603. exports.StylesheetNamespace = void 0;
  65604. var _namespaces = __w_pdfjs_require__(208);
  65605. var _xfa_object = __w_pdfjs_require__(206);
  65606. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  65607. class Stylesheet extends _xfa_object.XFAObject {
  65608. constructor(attributes) {
  65609. super(STYLESHEET_NS_ID, "stylesheet", true);
  65610. }
  65611. }
  65612. class StylesheetNamespace {
  65613. static [_namespaces.$buildXFAObject](name, attributes) {
  65614. if (StylesheetNamespace.hasOwnProperty(name)) {
  65615. return StylesheetNamespace[name](attributes);
  65616. }
  65617. return undefined;
  65618. }
  65619. static stylesheet(attributes) {
  65620. return new Stylesheet(attributes);
  65621. }
  65622. }
  65623. exports.StylesheetNamespace = StylesheetNamespace;
  65624. /***/ }),
  65625. /* 226 */
  65626. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65627. "use strict";
  65628. Object.defineProperty(exports, "__esModule", ({
  65629. value: true
  65630. }));
  65631. exports.XdpNamespace = void 0;
  65632. var _namespaces = __w_pdfjs_require__(208);
  65633. var _xfa_object = __w_pdfjs_require__(206);
  65634. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  65635. class Xdp extends _xfa_object.XFAObject {
  65636. constructor(attributes) {
  65637. super(XDP_NS_ID, "xdp", true);
  65638. this.uuid = attributes.uuid || "";
  65639. this.timeStamp = attributes.timeStamp || "";
  65640. this.config = null;
  65641. this.connectionSet = null;
  65642. this.datasets = null;
  65643. this.localeSet = null;
  65644. this.stylesheet = new _xfa_object.XFAObjectArray();
  65645. this.template = null;
  65646. }
  65647. [_xfa_object.$onChildCheck](child) {
  65648. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  65649. return ns && child[_xfa_object.$namespaceId] === ns.id;
  65650. }
  65651. }
  65652. class XdpNamespace {
  65653. static [_namespaces.$buildXFAObject](name, attributes) {
  65654. if (XdpNamespace.hasOwnProperty(name)) {
  65655. return XdpNamespace[name](attributes);
  65656. }
  65657. return undefined;
  65658. }
  65659. static xdp(attributes) {
  65660. return new Xdp(attributes);
  65661. }
  65662. }
  65663. exports.XdpNamespace = XdpNamespace;
  65664. /***/ }),
  65665. /* 227 */
  65666. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65667. "use strict";
  65668. Object.defineProperty(exports, "__esModule", ({
  65669. value: true
  65670. }));
  65671. exports.XhtmlNamespace = void 0;
  65672. var _xfa_object = __w_pdfjs_require__(206);
  65673. var _namespaces = __w_pdfjs_require__(208);
  65674. var _html_utils = __w_pdfjs_require__(213);
  65675. var _utils = __w_pdfjs_require__(207);
  65676. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  65677. const $richText = Symbol();
  65678. 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"]);
  65679. 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) => {
  65680. value = original.fontSize = (0, _utils.getMeasurement)(value);
  65681. return (0, _html_utils.measureToString)(0.99 * value);
  65682. }], ["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))]]);
  65683. const spacesRegExp = /\s+/g;
  65684. const crlfRegExp = /[\r\n]+/g;
  65685. const crlfForRichTextRegExp = /\r\n?/g;
  65686. function mapStyle(styleStr, node, richText) {
  65687. const style = Object.create(null);
  65688. if (!styleStr) {
  65689. return style;
  65690. }
  65691. const original = Object.create(null);
  65692. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  65693. const mapping = StyleMapping.get(key);
  65694. if (mapping === "") {
  65695. continue;
  65696. }
  65697. let newValue = value;
  65698. if (mapping) {
  65699. if (typeof mapping === "string") {
  65700. newValue = mapping;
  65701. } else {
  65702. newValue = mapping(value, original);
  65703. }
  65704. }
  65705. if (key.endsWith("scale")) {
  65706. if (style.transform) {
  65707. style.transform = `${style[key]} ${newValue}`;
  65708. } else {
  65709. style.transform = newValue;
  65710. }
  65711. } else {
  65712. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  65713. }
  65714. }
  65715. if (style.fontFamily) {
  65716. (0, _html_utils.setFontFamily)({
  65717. typeface: style.fontFamily,
  65718. weight: style.fontWeight || "normal",
  65719. posture: style.fontStyle || "normal",
  65720. size: original.fontSize || 0
  65721. }, node, node[_xfa_object.$globalData].fontFinder, style);
  65722. }
  65723. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  65724. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  65725. const VERTICAL_FACTOR = 0.333;
  65726. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  65727. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  65728. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  65729. }
  65730. if (richText && style.fontSize) {
  65731. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  65732. }
  65733. (0, _html_utils.fixTextIndent)(style);
  65734. return style;
  65735. }
  65736. function checkStyle(node) {
  65737. if (!node.style) {
  65738. return "";
  65739. }
  65740. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(_ref => {
  65741. let [key, value] = _ref;
  65742. if (key === "font-family") {
  65743. node[_xfa_object.$globalData].usedTypefaces.add(value);
  65744. }
  65745. return VALID_STYLES.has(key);
  65746. }).map(kv => kv.join(":")).join(";");
  65747. }
  65748. const NoWhites = new Set(["body", "html"]);
  65749. class XhtmlObject extends _xfa_object.XmlObject {
  65750. constructor(attributes, name) {
  65751. super(XHTML_NS_ID, name);
  65752. this[$richText] = false;
  65753. this.style = attributes.style || "";
  65754. }
  65755. [_xfa_object.$clean](builder) {
  65756. super[_xfa_object.$clean](builder);
  65757. this.style = checkStyle(this);
  65758. }
  65759. [_xfa_object.$acceptWhitespace]() {
  65760. return !NoWhites.has(this[_xfa_object.$nodeName]);
  65761. }
  65762. [_xfa_object.$onText](str) {
  65763. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  65764. if (!richText) {
  65765. str = str.replace(crlfRegExp, "");
  65766. if (!this.style.includes("xfa-spacerun:yes")) {
  65767. str = str.replace(spacesRegExp, " ");
  65768. }
  65769. } else {
  65770. this[$richText] = true;
  65771. }
  65772. if (str) {
  65773. this[_xfa_object.$content] += str;
  65774. }
  65775. }
  65776. [_xfa_object.$pushGlyphs](measure) {
  65777. let mustPop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  65778. const xfaFont = Object.create(null);
  65779. const margin = {
  65780. top: NaN,
  65781. bottom: NaN,
  65782. left: NaN,
  65783. right: NaN
  65784. };
  65785. let lineHeight = null;
  65786. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  65787. switch (key) {
  65788. case "font-family":
  65789. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  65790. break;
  65791. case "font-size":
  65792. xfaFont.size = (0, _utils.getMeasurement)(value);
  65793. break;
  65794. case "font-weight":
  65795. xfaFont.weight = value;
  65796. break;
  65797. case "font-style":
  65798. xfaFont.posture = value;
  65799. break;
  65800. case "letter-spacing":
  65801. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  65802. break;
  65803. case "margin":
  65804. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  65805. switch (values.length) {
  65806. case 1:
  65807. margin.top = margin.bottom = margin.left = margin.right = values[0];
  65808. break;
  65809. case 2:
  65810. margin.top = margin.bottom = values[0];
  65811. margin.left = margin.right = values[1];
  65812. break;
  65813. case 3:
  65814. margin.top = values[0];
  65815. margin.bottom = values[2];
  65816. margin.left = margin.right = values[1];
  65817. break;
  65818. case 4:
  65819. margin.top = values[0];
  65820. margin.left = values[1];
  65821. margin.bottom = values[2];
  65822. margin.right = values[3];
  65823. break;
  65824. }
  65825. break;
  65826. case "margin-top":
  65827. margin.top = (0, _utils.getMeasurement)(value);
  65828. break;
  65829. case "margin-bottom":
  65830. margin.bottom = (0, _utils.getMeasurement)(value);
  65831. break;
  65832. case "margin-left":
  65833. margin.left = (0, _utils.getMeasurement)(value);
  65834. break;
  65835. case "margin-right":
  65836. margin.right = (0, _utils.getMeasurement)(value);
  65837. break;
  65838. case "line-height":
  65839. lineHeight = (0, _utils.getMeasurement)(value);
  65840. break;
  65841. }
  65842. }
  65843. measure.pushData(xfaFont, margin, lineHeight);
  65844. if (this[_xfa_object.$content]) {
  65845. measure.addString(this[_xfa_object.$content]);
  65846. } else {
  65847. for (const child of this[_xfa_object.$getChildren]()) {
  65848. if (child[_xfa_object.$nodeName] === "#text") {
  65849. measure.addString(child[_xfa_object.$content]);
  65850. continue;
  65851. }
  65852. child[_xfa_object.$pushGlyphs](measure);
  65853. }
  65854. }
  65855. if (mustPop) {
  65856. measure.popFont();
  65857. }
  65858. }
  65859. [_xfa_object.$toHTML](availableSpace) {
  65860. const children = [];
  65861. this[_xfa_object.$extra] = {
  65862. children
  65863. };
  65864. this[_xfa_object.$childrenToHTML]({});
  65865. if (children.length === 0 && !this[_xfa_object.$content]) {
  65866. return _utils.HTMLResult.EMPTY;
  65867. }
  65868. let value;
  65869. if (this[$richText]) {
  65870. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  65871. } else {
  65872. value = this[_xfa_object.$content] || undefined;
  65873. }
  65874. return _utils.HTMLResult.success({
  65875. name: this[_xfa_object.$nodeName],
  65876. attributes: {
  65877. href: this.href,
  65878. style: mapStyle(this.style, this, this[$richText])
  65879. },
  65880. children,
  65881. value
  65882. });
  65883. }
  65884. }
  65885. class A extends XhtmlObject {
  65886. constructor(attributes) {
  65887. super(attributes, "a");
  65888. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  65889. }
  65890. }
  65891. class B extends XhtmlObject {
  65892. constructor(attributes) {
  65893. super(attributes, "b");
  65894. }
  65895. [_xfa_object.$pushGlyphs](measure) {
  65896. measure.pushFont({
  65897. weight: "bold"
  65898. });
  65899. super[_xfa_object.$pushGlyphs](measure);
  65900. measure.popFont();
  65901. }
  65902. }
  65903. class Body extends XhtmlObject {
  65904. constructor(attributes) {
  65905. super(attributes, "body");
  65906. }
  65907. [_xfa_object.$toHTML](availableSpace) {
  65908. const res = super[_xfa_object.$toHTML](availableSpace);
  65909. const {
  65910. html
  65911. } = res;
  65912. if (!html) {
  65913. return _utils.HTMLResult.EMPTY;
  65914. }
  65915. html.name = "div";
  65916. html.attributes.class = ["xfaRich"];
  65917. return res;
  65918. }
  65919. }
  65920. class Br extends XhtmlObject {
  65921. constructor(attributes) {
  65922. super(attributes, "br");
  65923. }
  65924. [_xfa_object.$text]() {
  65925. return "\n";
  65926. }
  65927. [_xfa_object.$pushGlyphs](measure) {
  65928. measure.addString("\n");
  65929. }
  65930. [_xfa_object.$toHTML](availableSpace) {
  65931. return _utils.HTMLResult.success({
  65932. name: "br"
  65933. });
  65934. }
  65935. }
  65936. class Html extends XhtmlObject {
  65937. constructor(attributes) {
  65938. super(attributes, "html");
  65939. }
  65940. [_xfa_object.$toHTML](availableSpace) {
  65941. const children = [];
  65942. this[_xfa_object.$extra] = {
  65943. children
  65944. };
  65945. this[_xfa_object.$childrenToHTML]({});
  65946. if (children.length === 0) {
  65947. return _utils.HTMLResult.success({
  65948. name: "div",
  65949. attributes: {
  65950. class: ["xfaRich"],
  65951. style: {}
  65952. },
  65953. value: this[_xfa_object.$content] || ""
  65954. });
  65955. }
  65956. if (children.length === 1) {
  65957. const child = children[0];
  65958. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  65959. return _utils.HTMLResult.success(child);
  65960. }
  65961. }
  65962. return _utils.HTMLResult.success({
  65963. name: "div",
  65964. attributes: {
  65965. class: ["xfaRich"],
  65966. style: {}
  65967. },
  65968. children
  65969. });
  65970. }
  65971. }
  65972. class I extends XhtmlObject {
  65973. constructor(attributes) {
  65974. super(attributes, "i");
  65975. }
  65976. [_xfa_object.$pushGlyphs](measure) {
  65977. measure.pushFont({
  65978. posture: "italic"
  65979. });
  65980. super[_xfa_object.$pushGlyphs](measure);
  65981. measure.popFont();
  65982. }
  65983. }
  65984. class Li extends XhtmlObject {
  65985. constructor(attributes) {
  65986. super(attributes, "li");
  65987. }
  65988. }
  65989. class Ol extends XhtmlObject {
  65990. constructor(attributes) {
  65991. super(attributes, "ol");
  65992. }
  65993. }
  65994. class P extends XhtmlObject {
  65995. constructor(attributes) {
  65996. super(attributes, "p");
  65997. }
  65998. [_xfa_object.$pushGlyphs](measure) {
  65999. super[_xfa_object.$pushGlyphs](measure, false);
  66000. measure.addString("\n");
  66001. measure.addPara();
  66002. measure.popFont();
  66003. }
  66004. [_xfa_object.$text]() {
  66005. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  66006. if (siblings.at(-1) === this) {
  66007. return super[_xfa_object.$text]();
  66008. }
  66009. return super[_xfa_object.$text]() + "\n";
  66010. }
  66011. }
  66012. class Span extends XhtmlObject {
  66013. constructor(attributes) {
  66014. super(attributes, "span");
  66015. }
  66016. }
  66017. class Sub extends XhtmlObject {
  66018. constructor(attributes) {
  66019. super(attributes, "sub");
  66020. }
  66021. }
  66022. class Sup extends XhtmlObject {
  66023. constructor(attributes) {
  66024. super(attributes, "sup");
  66025. }
  66026. }
  66027. class Ul extends XhtmlObject {
  66028. constructor(attributes) {
  66029. super(attributes, "ul");
  66030. }
  66031. }
  66032. class XhtmlNamespace {
  66033. static [_namespaces.$buildXFAObject](name, attributes) {
  66034. if (XhtmlNamespace.hasOwnProperty(name)) {
  66035. return XhtmlNamespace[name](attributes);
  66036. }
  66037. return undefined;
  66038. }
  66039. static a(attributes) {
  66040. return new A(attributes);
  66041. }
  66042. static b(attributes) {
  66043. return new B(attributes);
  66044. }
  66045. static body(attributes) {
  66046. return new Body(attributes);
  66047. }
  66048. static br(attributes) {
  66049. return new Br(attributes);
  66050. }
  66051. static html(attributes) {
  66052. return new Html(attributes);
  66053. }
  66054. static i(attributes) {
  66055. return new I(attributes);
  66056. }
  66057. static li(attributes) {
  66058. return new Li(attributes);
  66059. }
  66060. static ol(attributes) {
  66061. return new Ol(attributes);
  66062. }
  66063. static p(attributes) {
  66064. return new P(attributes);
  66065. }
  66066. static span(attributes) {
  66067. return new Span(attributes);
  66068. }
  66069. static sub(attributes) {
  66070. return new Sub(attributes);
  66071. }
  66072. static sup(attributes) {
  66073. return new Sup(attributes);
  66074. }
  66075. static ul(attributes) {
  66076. return new Ul(attributes);
  66077. }
  66078. }
  66079. exports.XhtmlNamespace = XhtmlNamespace;
  66080. /***/ }),
  66081. /* 228 */
  66082. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66083. "use strict";
  66084. Object.defineProperty(exports, "__esModule", ({
  66085. value: true
  66086. }));
  66087. exports.UnknownNamespace = void 0;
  66088. var _namespaces = __w_pdfjs_require__(208);
  66089. var _xfa_object = __w_pdfjs_require__(206);
  66090. class UnknownNamespace {
  66091. constructor(nsId) {
  66092. this.namespaceId = nsId;
  66093. }
  66094. [_namespaces.$buildXFAObject](name, attributes) {
  66095. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  66096. }
  66097. }
  66098. exports.UnknownNamespace = UnknownNamespace;
  66099. /***/ }),
  66100. /* 229 */
  66101. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66102. "use strict";
  66103. Object.defineProperty(exports, "__esModule", ({
  66104. value: true
  66105. }));
  66106. exports.DatasetReader = void 0;
  66107. var _util = __w_pdfjs_require__(2);
  66108. var _core_utils = __w_pdfjs_require__(135);
  66109. var _xml_parser = __w_pdfjs_require__(195);
  66110. function decodeString(str) {
  66111. try {
  66112. return (0, _util.stringToUTF8String)(str);
  66113. } catch (ex) {
  66114. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  66115. return str;
  66116. }
  66117. }
  66118. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  66119. constructor(options) {
  66120. super(options);
  66121. this.node = null;
  66122. }
  66123. onEndElement(name) {
  66124. const node = super.onEndElement(name);
  66125. if (node && name === "xfa:datasets") {
  66126. this.node = node;
  66127. throw new Error("Aborting DatasetXMLParser.");
  66128. }
  66129. }
  66130. }
  66131. class DatasetReader {
  66132. constructor(data) {
  66133. if (data.datasets) {
  66134. this.node = new _xml_parser.SimpleXMLParser({
  66135. hasAttributes: true
  66136. }).parseFromString(data.datasets).documentElement;
  66137. } else {
  66138. const parser = new DatasetXMLParser({
  66139. hasAttributes: true
  66140. });
  66141. try {
  66142. parser.parseFromString(data["xdp:xdp"]);
  66143. } catch (_) {}
  66144. this.node = parser.node;
  66145. }
  66146. }
  66147. getValue(path) {
  66148. if (!this.node || !path) {
  66149. return "";
  66150. }
  66151. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  66152. if (!node) {
  66153. return "";
  66154. }
  66155. const first = node.firstChild;
  66156. if (first && first.nodeName === "value") {
  66157. return node.children.map(child => decodeString(child.textContent));
  66158. }
  66159. return decodeString(node.textContent);
  66160. }
  66161. }
  66162. exports.DatasetReader = DatasetReader;
  66163. /***/ }),
  66164. /* 230 */
  66165. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66166. "use strict";
  66167. Object.defineProperty(exports, "__esModule", ({
  66168. value: true
  66169. }));
  66170. exports.XRef = void 0;
  66171. var _util = __w_pdfjs_require__(2);
  66172. var _primitives = __w_pdfjs_require__(134);
  66173. var _core_utils = __w_pdfjs_require__(135);
  66174. var _parser = __w_pdfjs_require__(146);
  66175. var _base_stream = __w_pdfjs_require__(136);
  66176. var _crypto = __w_pdfjs_require__(196);
  66177. class XRef {
  66178. constructor(stream, pdfManager) {
  66179. this.stream = stream;
  66180. this.pdfManager = pdfManager;
  66181. this.entries = [];
  66182. this.xrefstms = Object.create(null);
  66183. this._cacheMap = new Map();
  66184. this._pendingRefs = new _primitives.RefSet();
  66185. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  66186. this._newPersistentRefNum = null;
  66187. this._newTemporaryRefNum = null;
  66188. }
  66189. getNewPersistentRef(obj) {
  66190. if (this._newPersistentRefNum === null) {
  66191. this._newPersistentRefNum = this.entries.length || 1;
  66192. }
  66193. const num = this._newPersistentRefNum++;
  66194. this._cacheMap.set(num, obj);
  66195. return _primitives.Ref.get(num, 0);
  66196. }
  66197. getNewTemporaryRef() {
  66198. if (this._newTemporaryRefNum === null) {
  66199. this._newTemporaryRefNum = this.entries.length || 1;
  66200. }
  66201. return _primitives.Ref.get(this._newTemporaryRefNum++, 0);
  66202. }
  66203. resetNewTemporaryRef() {
  66204. this._newTemporaryRefNum = null;
  66205. }
  66206. setStartXRef(startXRef) {
  66207. this.startXRefQueue = [startXRef];
  66208. }
  66209. parse() {
  66210. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  66211. let trailerDict;
  66212. if (!recoveryMode) {
  66213. trailerDict = this.readXRef();
  66214. } else {
  66215. (0, _util.warn)("Indexing all PDF objects");
  66216. trailerDict = this.indexObjects();
  66217. }
  66218. trailerDict.assignXref(this);
  66219. this.trailer = trailerDict;
  66220. let encrypt;
  66221. try {
  66222. encrypt = trailerDict.get("Encrypt");
  66223. } catch (ex) {
  66224. if (ex instanceof _core_utils.MissingDataException) {
  66225. throw ex;
  66226. }
  66227. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  66228. }
  66229. if (encrypt instanceof _primitives.Dict) {
  66230. const ids = trailerDict.get("ID");
  66231. const fileId = ids && ids.length ? ids[0] : "";
  66232. encrypt.suppressEncryption = true;
  66233. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  66234. }
  66235. let root;
  66236. try {
  66237. root = trailerDict.get("Root");
  66238. } catch (ex) {
  66239. if (ex instanceof _core_utils.MissingDataException) {
  66240. throw ex;
  66241. }
  66242. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  66243. }
  66244. if (root instanceof _primitives.Dict) {
  66245. try {
  66246. const pages = root.get("Pages");
  66247. if (pages instanceof _primitives.Dict) {
  66248. this.root = root;
  66249. return;
  66250. }
  66251. } catch (ex) {
  66252. if (ex instanceof _core_utils.MissingDataException) {
  66253. throw ex;
  66254. }
  66255. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  66256. }
  66257. }
  66258. if (!recoveryMode) {
  66259. throw new _core_utils.XRefParseException();
  66260. }
  66261. throw new _util.InvalidPDFException("Invalid Root reference.");
  66262. }
  66263. processXRefTable(parser) {
  66264. if (!("tableState" in this)) {
  66265. this.tableState = {
  66266. entryNum: 0,
  66267. streamPos: parser.lexer.stream.pos,
  66268. parserBuf1: parser.buf1,
  66269. parserBuf2: parser.buf2
  66270. };
  66271. }
  66272. const obj = this.readXRefTable(parser);
  66273. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  66274. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  66275. }
  66276. let dict = parser.getObj();
  66277. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  66278. dict = dict.dict;
  66279. }
  66280. if (!(dict instanceof _primitives.Dict)) {
  66281. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  66282. }
  66283. delete this.tableState;
  66284. return dict;
  66285. }
  66286. readXRefTable(parser) {
  66287. const stream = parser.lexer.stream;
  66288. const tableState = this.tableState;
  66289. stream.pos = tableState.streamPos;
  66290. parser.buf1 = tableState.parserBuf1;
  66291. parser.buf2 = tableState.parserBuf2;
  66292. let obj;
  66293. while (true) {
  66294. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  66295. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  66296. break;
  66297. }
  66298. tableState.firstEntryNum = obj;
  66299. tableState.entryCount = parser.getObj();
  66300. }
  66301. let first = tableState.firstEntryNum;
  66302. const count = tableState.entryCount;
  66303. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  66304. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  66305. }
  66306. for (let i = tableState.entryNum; i < count; i++) {
  66307. tableState.streamPos = stream.pos;
  66308. tableState.entryNum = i;
  66309. tableState.parserBuf1 = parser.buf1;
  66310. tableState.parserBuf2 = parser.buf2;
  66311. const entry = {};
  66312. entry.offset = parser.getObj();
  66313. entry.gen = parser.getObj();
  66314. const type = parser.getObj();
  66315. if (type instanceof _primitives.Cmd) {
  66316. switch (type.cmd) {
  66317. case "f":
  66318. entry.free = true;
  66319. break;
  66320. case "n":
  66321. entry.uncompressed = true;
  66322. break;
  66323. }
  66324. }
  66325. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  66326. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  66327. }
  66328. if (i === 0 && entry.free && first === 1) {
  66329. first = 0;
  66330. }
  66331. if (!this.entries[i + first]) {
  66332. this.entries[i + first] = entry;
  66333. }
  66334. }
  66335. tableState.entryNum = 0;
  66336. tableState.streamPos = stream.pos;
  66337. tableState.parserBuf1 = parser.buf1;
  66338. tableState.parserBuf2 = parser.buf2;
  66339. delete tableState.firstEntryNum;
  66340. delete tableState.entryCount;
  66341. }
  66342. if (this.entries[0] && !this.entries[0].free) {
  66343. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  66344. }
  66345. return obj;
  66346. }
  66347. processXRefStream(stream) {
  66348. if (!("streamState" in this)) {
  66349. const streamParameters = stream.dict;
  66350. const byteWidths = streamParameters.get("W");
  66351. let range = streamParameters.get("Index");
  66352. if (!range) {
  66353. range = [0, streamParameters.get("Size")];
  66354. }
  66355. this.streamState = {
  66356. entryRanges: range,
  66357. byteWidths,
  66358. entryNum: 0,
  66359. streamPos: stream.pos
  66360. };
  66361. }
  66362. this.readXRefStream(stream);
  66363. delete this.streamState;
  66364. return stream.dict;
  66365. }
  66366. readXRefStream(stream) {
  66367. const streamState = this.streamState;
  66368. stream.pos = streamState.streamPos;
  66369. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  66370. const entryRanges = streamState.entryRanges;
  66371. while (entryRanges.length > 0) {
  66372. const [first, n] = entryRanges;
  66373. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  66374. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  66375. }
  66376. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  66377. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  66378. }
  66379. for (let i = streamState.entryNum; i < n; ++i) {
  66380. streamState.entryNum = i;
  66381. streamState.streamPos = stream.pos;
  66382. let type = 0,
  66383. offset = 0,
  66384. generation = 0;
  66385. for (let j = 0; j < typeFieldWidth; ++j) {
  66386. const typeByte = stream.getByte();
  66387. if (typeByte === -1) {
  66388. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  66389. }
  66390. type = type << 8 | typeByte;
  66391. }
  66392. if (typeFieldWidth === 0) {
  66393. type = 1;
  66394. }
  66395. for (let j = 0; j < offsetFieldWidth; ++j) {
  66396. const offsetByte = stream.getByte();
  66397. if (offsetByte === -1) {
  66398. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  66399. }
  66400. offset = offset << 8 | offsetByte;
  66401. }
  66402. for (let j = 0; j < generationFieldWidth; ++j) {
  66403. const generationByte = stream.getByte();
  66404. if (generationByte === -1) {
  66405. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  66406. }
  66407. generation = generation << 8 | generationByte;
  66408. }
  66409. const entry = {};
  66410. entry.offset = offset;
  66411. entry.gen = generation;
  66412. switch (type) {
  66413. case 0:
  66414. entry.free = true;
  66415. break;
  66416. case 1:
  66417. entry.uncompressed = true;
  66418. break;
  66419. case 2:
  66420. break;
  66421. default:
  66422. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  66423. }
  66424. if (!this.entries[first + i]) {
  66425. this.entries[first + i] = entry;
  66426. }
  66427. }
  66428. streamState.entryNum = 0;
  66429. streamState.streamPos = stream.pos;
  66430. entryRanges.splice(0, 2);
  66431. }
  66432. }
  66433. indexObjects() {
  66434. const TAB = 0x9,
  66435. LF = 0xa,
  66436. CR = 0xd,
  66437. SPACE = 0x20;
  66438. const PERCENT = 0x25,
  66439. LT = 0x3c;
  66440. function readToken(data, offset) {
  66441. let token = "",
  66442. ch = data[offset];
  66443. while (ch !== LF && ch !== CR && ch !== LT) {
  66444. if (++offset >= data.length) {
  66445. break;
  66446. }
  66447. token += String.fromCharCode(ch);
  66448. ch = data[offset];
  66449. }
  66450. return token;
  66451. }
  66452. function skipUntil(data, offset, what) {
  66453. const length = what.length,
  66454. dataLength = data.length;
  66455. let skipped = 0;
  66456. while (offset < dataLength) {
  66457. let i = 0;
  66458. while (i < length && data[offset + i] === what[i]) {
  66459. ++i;
  66460. }
  66461. if (i >= length) {
  66462. break;
  66463. }
  66464. offset++;
  66465. skipped++;
  66466. }
  66467. return skipped;
  66468. }
  66469. const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer)\b/g;
  66470. const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g;
  66471. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  66472. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  66473. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  66474. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  66475. this.entries.length = 0;
  66476. this._cacheMap.clear();
  66477. const stream = this.stream;
  66478. stream.pos = 0;
  66479. const buffer = stream.getBytes(),
  66480. bufferStr = (0, _util.bytesToString)(buffer),
  66481. length = buffer.length;
  66482. let position = stream.start;
  66483. const trailers = [],
  66484. xrefStms = [];
  66485. while (position < length) {
  66486. let ch = buffer[position];
  66487. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  66488. ++position;
  66489. continue;
  66490. }
  66491. if (ch === PERCENT) {
  66492. do {
  66493. ++position;
  66494. if (position >= length) {
  66495. break;
  66496. }
  66497. ch = buffer[position];
  66498. } while (ch !== LF && ch !== CR);
  66499. continue;
  66500. }
  66501. const token = readToken(buffer, position);
  66502. let m;
  66503. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  66504. position += skipUntil(buffer, position, trailerBytes);
  66505. trailers.push(position);
  66506. position += skipUntil(buffer, position, startxrefBytes);
  66507. } else if (m = objRegExp.exec(token)) {
  66508. const num = m[1] | 0,
  66509. gen = m[2] | 0;
  66510. const startPos = position + token.length;
  66511. let contentLength,
  66512. updateEntries = false;
  66513. if (!this.entries[num]) {
  66514. updateEntries = true;
  66515. } else if (this.entries[num].gen === gen) {
  66516. try {
  66517. const parser = new _parser.Parser({
  66518. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  66519. });
  66520. parser.getObj();
  66521. updateEntries = true;
  66522. } catch (ex) {
  66523. if (ex instanceof _core_utils.ParserEOFException) {
  66524. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  66525. } else {
  66526. updateEntries = true;
  66527. }
  66528. }
  66529. }
  66530. if (updateEntries) {
  66531. this.entries[num] = {
  66532. offset: position - stream.start,
  66533. gen,
  66534. uncompressed: true
  66535. };
  66536. }
  66537. gEndobjRegExp.lastIndex = startPos;
  66538. const match = gEndobjRegExp.exec(bufferStr);
  66539. if (match) {
  66540. const endPos = gEndobjRegExp.lastIndex + 1;
  66541. contentLength = endPos - position;
  66542. if (match[1] !== "endobj") {
  66543. (0, _util.warn)(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.');
  66544. contentLength -= match[1].length + 1;
  66545. }
  66546. } else {
  66547. contentLength = length - position;
  66548. }
  66549. const content = buffer.subarray(position, position + contentLength);
  66550. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  66551. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  66552. xrefStms.push(position - stream.start);
  66553. this.xrefstms[position - stream.start] = 1;
  66554. }
  66555. position += contentLength;
  66556. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  66557. trailers.push(position);
  66558. const startPos = position + token.length;
  66559. let contentLength;
  66560. gStartxrefRegExp.lastIndex = startPos;
  66561. const match = gStartxrefRegExp.exec(bufferStr);
  66562. if (match) {
  66563. const endPos = gStartxrefRegExp.lastIndex + 1;
  66564. contentLength = endPos - position;
  66565. if (match[1] !== "startxref") {
  66566. (0, _util.warn)(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.');
  66567. contentLength -= match[1].length + 1;
  66568. }
  66569. } else {
  66570. contentLength = length - position;
  66571. }
  66572. position += contentLength;
  66573. } else {
  66574. position += token.length + 1;
  66575. }
  66576. }
  66577. for (const xrefStm of xrefStms) {
  66578. this.startXRefQueue.push(xrefStm);
  66579. this.readXRef(true);
  66580. }
  66581. let trailerDict, trailerError;
  66582. for (const trailer of [...trailers, "generationFallback", ...trailers]) {
  66583. if (trailer === "generationFallback") {
  66584. if (!trailerError) {
  66585. break;
  66586. }
  66587. this._generationFallback = true;
  66588. continue;
  66589. }
  66590. stream.pos = trailer;
  66591. const parser = new _parser.Parser({
  66592. lexer: new _parser.Lexer(stream),
  66593. xref: this,
  66594. allowStreams: true,
  66595. recoveryMode: true
  66596. });
  66597. const obj = parser.getObj();
  66598. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  66599. continue;
  66600. }
  66601. const dict = parser.getObj();
  66602. if (!(dict instanceof _primitives.Dict)) {
  66603. continue;
  66604. }
  66605. let validPagesDict = false;
  66606. try {
  66607. const rootDict = dict.get("Root");
  66608. if (!(rootDict instanceof _primitives.Dict)) {
  66609. continue;
  66610. }
  66611. const pagesDict = rootDict.get("Pages");
  66612. if (!(pagesDict instanceof _primitives.Dict)) {
  66613. continue;
  66614. }
  66615. const pagesCount = pagesDict.get("Count");
  66616. if (Number.isInteger(pagesCount)) {
  66617. validPagesDict = true;
  66618. }
  66619. } catch (ex) {
  66620. trailerError = ex;
  66621. continue;
  66622. }
  66623. if (validPagesDict && dict.has("ID")) {
  66624. return dict;
  66625. }
  66626. trailerDict = dict;
  66627. }
  66628. if (trailerDict) {
  66629. return trailerDict;
  66630. }
  66631. if (this.topDict) {
  66632. return this.topDict;
  66633. }
  66634. throw new _util.InvalidPDFException("Invalid PDF structure.");
  66635. }
  66636. readXRef() {
  66637. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  66638. const stream = this.stream;
  66639. const startXRefParsedCache = new Set();
  66640. while (this.startXRefQueue.length) {
  66641. try {
  66642. const startXRef = this.startXRefQueue[0];
  66643. if (startXRefParsedCache.has(startXRef)) {
  66644. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  66645. this.startXRefQueue.shift();
  66646. continue;
  66647. }
  66648. startXRefParsedCache.add(startXRef);
  66649. stream.pos = startXRef + stream.start;
  66650. const parser = new _parser.Parser({
  66651. lexer: new _parser.Lexer(stream),
  66652. xref: this,
  66653. allowStreams: true
  66654. });
  66655. let obj = parser.getObj();
  66656. let dict;
  66657. if ((0, _primitives.isCmd)(obj, "xref")) {
  66658. dict = this.processXRefTable(parser);
  66659. if (!this.topDict) {
  66660. this.topDict = dict;
  66661. }
  66662. obj = dict.get("XRefStm");
  66663. if (Number.isInteger(obj)) {
  66664. const pos = obj;
  66665. if (!(pos in this.xrefstms)) {
  66666. this.xrefstms[pos] = 1;
  66667. this.startXRefQueue.push(pos);
  66668. }
  66669. }
  66670. } else if (Number.isInteger(obj)) {
  66671. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  66672. throw new _util.FormatError("Invalid XRef stream");
  66673. }
  66674. dict = this.processXRefStream(obj);
  66675. if (!this.topDict) {
  66676. this.topDict = dict;
  66677. }
  66678. if (!dict) {
  66679. throw new _util.FormatError("Failed to read XRef stream");
  66680. }
  66681. } else {
  66682. throw new _util.FormatError("Invalid XRef stream header");
  66683. }
  66684. obj = dict.get("Prev");
  66685. if (Number.isInteger(obj)) {
  66686. this.startXRefQueue.push(obj);
  66687. } else if (obj instanceof _primitives.Ref) {
  66688. this.startXRefQueue.push(obj.num);
  66689. }
  66690. } catch (e) {
  66691. if (e instanceof _core_utils.MissingDataException) {
  66692. throw e;
  66693. }
  66694. (0, _util.info)("(while reading XRef): " + e);
  66695. }
  66696. this.startXRefQueue.shift();
  66697. }
  66698. if (this.topDict) {
  66699. return this.topDict;
  66700. }
  66701. if (recoveryMode) {
  66702. return undefined;
  66703. }
  66704. throw new _core_utils.XRefParseException();
  66705. }
  66706. getEntry(i) {
  66707. const xrefEntry = this.entries[i];
  66708. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  66709. return xrefEntry;
  66710. }
  66711. return null;
  66712. }
  66713. fetchIfRef(obj) {
  66714. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66715. if (obj instanceof _primitives.Ref) {
  66716. return this.fetch(obj, suppressEncryption);
  66717. }
  66718. return obj;
  66719. }
  66720. fetch(ref) {
  66721. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66722. if (!(ref instanceof _primitives.Ref)) {
  66723. throw new Error("ref object is not a reference");
  66724. }
  66725. const num = ref.num;
  66726. const cacheEntry = this._cacheMap.get(num);
  66727. if (cacheEntry !== undefined) {
  66728. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  66729. cacheEntry.objId = ref.toString();
  66730. }
  66731. return cacheEntry;
  66732. }
  66733. let xrefEntry = this.getEntry(num);
  66734. if (xrefEntry === null) {
  66735. this._cacheMap.set(num, xrefEntry);
  66736. return xrefEntry;
  66737. }
  66738. if (this._pendingRefs.has(ref)) {
  66739. this._pendingRefs.remove(ref);
  66740. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  66741. return _primitives.CIRCULAR_REF;
  66742. }
  66743. this._pendingRefs.put(ref);
  66744. try {
  66745. if (xrefEntry.uncompressed) {
  66746. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  66747. } else {
  66748. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  66749. }
  66750. this._pendingRefs.remove(ref);
  66751. } catch (ex) {
  66752. this._pendingRefs.remove(ref);
  66753. throw ex;
  66754. }
  66755. if (xrefEntry instanceof _primitives.Dict) {
  66756. xrefEntry.objId = ref.toString();
  66757. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  66758. xrefEntry.dict.objId = ref.toString();
  66759. }
  66760. return xrefEntry;
  66761. }
  66762. fetchUncompressed(ref, xrefEntry) {
  66763. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66764. const gen = ref.gen;
  66765. let num = ref.num;
  66766. if (xrefEntry.gen !== gen) {
  66767. const msg = `Inconsistent generation in XRef: ${ref}`;
  66768. if (this._generationFallback && xrefEntry.gen < gen) {
  66769. (0, _util.warn)(msg);
  66770. return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  66771. }
  66772. throw new _core_utils.XRefEntryException(msg);
  66773. }
  66774. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  66775. const parser = new _parser.Parser({
  66776. lexer: new _parser.Lexer(stream),
  66777. xref: this,
  66778. allowStreams: true
  66779. });
  66780. const obj1 = parser.getObj();
  66781. const obj2 = parser.getObj();
  66782. const obj3 = parser.getObj();
  66783. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  66784. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66785. }
  66786. if (obj3.cmd !== "obj") {
  66787. if (obj3.cmd.startsWith("obj")) {
  66788. num = parseInt(obj3.cmd.substring(3), 10);
  66789. if (!Number.isNaN(num)) {
  66790. return num;
  66791. }
  66792. }
  66793. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66794. }
  66795. if (this.encrypt && !suppressEncryption) {
  66796. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  66797. } else {
  66798. xrefEntry = parser.getObj();
  66799. }
  66800. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  66801. this._cacheMap.set(num, xrefEntry);
  66802. }
  66803. return xrefEntry;
  66804. }
  66805. fetchCompressed(ref, xrefEntry) {
  66806. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66807. const tableOffset = xrefEntry.offset;
  66808. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  66809. if (!(stream instanceof _base_stream.BaseStream)) {
  66810. throw new _util.FormatError("bad ObjStm stream");
  66811. }
  66812. const first = stream.dict.get("First");
  66813. const n = stream.dict.get("N");
  66814. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  66815. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  66816. }
  66817. let parser = new _parser.Parser({
  66818. lexer: new _parser.Lexer(stream),
  66819. xref: this,
  66820. allowStreams: true
  66821. });
  66822. const nums = new Array(n);
  66823. const offsets = new Array(n);
  66824. for (let i = 0; i < n; ++i) {
  66825. const num = parser.getObj();
  66826. if (!Number.isInteger(num)) {
  66827. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  66828. }
  66829. const offset = parser.getObj();
  66830. if (!Number.isInteger(offset)) {
  66831. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  66832. }
  66833. nums[i] = num;
  66834. offsets[i] = offset;
  66835. }
  66836. const start = (stream.start || 0) + first;
  66837. const entries = new Array(n);
  66838. for (let i = 0; i < n; ++i) {
  66839. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  66840. if (length < 0) {
  66841. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  66842. }
  66843. parser = new _parser.Parser({
  66844. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  66845. xref: this,
  66846. allowStreams: true
  66847. });
  66848. const obj = parser.getObj();
  66849. entries[i] = obj;
  66850. if (obj instanceof _base_stream.BaseStream) {
  66851. continue;
  66852. }
  66853. const num = nums[i],
  66854. entry = this.entries[num];
  66855. if (entry && entry.offset === tableOffset && entry.gen === i) {
  66856. this._cacheMap.set(num, obj);
  66857. }
  66858. }
  66859. xrefEntry = entries[xrefEntry.gen];
  66860. if (xrefEntry === undefined) {
  66861. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  66862. }
  66863. return xrefEntry;
  66864. }
  66865. async fetchIfRefAsync(obj, suppressEncryption) {
  66866. if (obj instanceof _primitives.Ref) {
  66867. return this.fetchAsync(obj, suppressEncryption);
  66868. }
  66869. return obj;
  66870. }
  66871. async fetchAsync(ref, suppressEncryption) {
  66872. try {
  66873. return this.fetch(ref, suppressEncryption);
  66874. } catch (ex) {
  66875. if (!(ex instanceof _core_utils.MissingDataException)) {
  66876. throw ex;
  66877. }
  66878. await this.pdfManager.requestRange(ex.begin, ex.end);
  66879. return this.fetchAsync(ref, suppressEncryption);
  66880. }
  66881. }
  66882. getCatalogObj() {
  66883. return this.root;
  66884. }
  66885. }
  66886. exports.XRef = XRef;
  66887. /***/ }),
  66888. /* 231 */
  66889. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66890. "use strict";
  66891. Object.defineProperty(exports, "__esModule", ({
  66892. value: true
  66893. }));
  66894. exports.MessageHandler = void 0;
  66895. var _util = __w_pdfjs_require__(2);
  66896. const CallbackKind = {
  66897. UNKNOWN: 0,
  66898. DATA: 1,
  66899. ERROR: 2
  66900. };
  66901. const StreamKind = {
  66902. UNKNOWN: 0,
  66903. CANCEL: 1,
  66904. CANCEL_COMPLETE: 2,
  66905. CLOSE: 3,
  66906. ENQUEUE: 4,
  66907. ERROR: 5,
  66908. PULL: 6,
  66909. PULL_COMPLETE: 7,
  66910. START_COMPLETE: 8
  66911. };
  66912. function wrapReason(reason) {
  66913. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  66914. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  66915. }
  66916. switch (reason.name) {
  66917. case "AbortException":
  66918. return new _util.AbortException(reason.message);
  66919. case "MissingPDFException":
  66920. return new _util.MissingPDFException(reason.message);
  66921. case "PasswordException":
  66922. return new _util.PasswordException(reason.message, reason.code);
  66923. case "UnexpectedResponseException":
  66924. return new _util.UnexpectedResponseException(reason.message, reason.status);
  66925. case "UnknownErrorException":
  66926. return new _util.UnknownErrorException(reason.message, reason.details);
  66927. default:
  66928. return new _util.UnknownErrorException(reason.message, reason.toString());
  66929. }
  66930. }
  66931. class MessageHandler {
  66932. constructor(sourceName, targetName, comObj) {
  66933. this.sourceName = sourceName;
  66934. this.targetName = targetName;
  66935. this.comObj = comObj;
  66936. this.callbackId = 1;
  66937. this.streamId = 1;
  66938. this.streamSinks = Object.create(null);
  66939. this.streamControllers = Object.create(null);
  66940. this.callbackCapabilities = Object.create(null);
  66941. this.actionHandler = Object.create(null);
  66942. this._onComObjOnMessage = event => {
  66943. const data = event.data;
  66944. if (data.targetName !== this.sourceName) {
  66945. return;
  66946. }
  66947. if (data.stream) {
  66948. this._processStreamMessage(data);
  66949. return;
  66950. }
  66951. if (data.callback) {
  66952. const callbackId = data.callbackId;
  66953. const capability = this.callbackCapabilities[callbackId];
  66954. if (!capability) {
  66955. throw new Error(`Cannot resolve callback ${callbackId}`);
  66956. }
  66957. delete this.callbackCapabilities[callbackId];
  66958. if (data.callback === CallbackKind.DATA) {
  66959. capability.resolve(data.data);
  66960. } else if (data.callback === CallbackKind.ERROR) {
  66961. capability.reject(wrapReason(data.reason));
  66962. } else {
  66963. throw new Error("Unexpected callback case");
  66964. }
  66965. return;
  66966. }
  66967. const action = this.actionHandler[data.action];
  66968. if (!action) {
  66969. throw new Error(`Unknown action from worker: ${data.action}`);
  66970. }
  66971. if (data.callbackId) {
  66972. const cbSourceName = this.sourceName;
  66973. const cbTargetName = data.sourceName;
  66974. new Promise(function (resolve) {
  66975. resolve(action(data.data));
  66976. }).then(function (result) {
  66977. comObj.postMessage({
  66978. sourceName: cbSourceName,
  66979. targetName: cbTargetName,
  66980. callback: CallbackKind.DATA,
  66981. callbackId: data.callbackId,
  66982. data: result
  66983. });
  66984. }, function (reason) {
  66985. comObj.postMessage({
  66986. sourceName: cbSourceName,
  66987. targetName: cbTargetName,
  66988. callback: CallbackKind.ERROR,
  66989. callbackId: data.callbackId,
  66990. reason: wrapReason(reason)
  66991. });
  66992. });
  66993. return;
  66994. }
  66995. if (data.streamId) {
  66996. this._createStreamSink(data);
  66997. return;
  66998. }
  66999. action(data.data);
  67000. };
  67001. comObj.addEventListener("message", this._onComObjOnMessage);
  67002. }
  67003. on(actionName, handler) {
  67004. const ah = this.actionHandler;
  67005. if (ah[actionName]) {
  67006. throw new Error(`There is already an actionName called "${actionName}"`);
  67007. }
  67008. ah[actionName] = handler;
  67009. }
  67010. send(actionName, data, transfers) {
  67011. this.comObj.postMessage({
  67012. sourceName: this.sourceName,
  67013. targetName: this.targetName,
  67014. action: actionName,
  67015. data
  67016. }, transfers);
  67017. }
  67018. sendWithPromise(actionName, data, transfers) {
  67019. const callbackId = this.callbackId++;
  67020. const capability = (0, _util.createPromiseCapability)();
  67021. this.callbackCapabilities[callbackId] = capability;
  67022. try {
  67023. this.comObj.postMessage({
  67024. sourceName: this.sourceName,
  67025. targetName: this.targetName,
  67026. action: actionName,
  67027. callbackId,
  67028. data
  67029. }, transfers);
  67030. } catch (ex) {
  67031. capability.reject(ex);
  67032. }
  67033. return capability.promise;
  67034. }
  67035. sendWithStream(actionName, data, queueingStrategy, transfers) {
  67036. const streamId = this.streamId++,
  67037. sourceName = this.sourceName,
  67038. targetName = this.targetName,
  67039. comObj = this.comObj;
  67040. return new ReadableStream({
  67041. start: controller => {
  67042. const startCapability = (0, _util.createPromiseCapability)();
  67043. this.streamControllers[streamId] = {
  67044. controller,
  67045. startCall: startCapability,
  67046. pullCall: null,
  67047. cancelCall: null,
  67048. isClosed: false
  67049. };
  67050. comObj.postMessage({
  67051. sourceName,
  67052. targetName,
  67053. action: actionName,
  67054. streamId,
  67055. data,
  67056. desiredSize: controller.desiredSize
  67057. }, transfers);
  67058. return startCapability.promise;
  67059. },
  67060. pull: controller => {
  67061. const pullCapability = (0, _util.createPromiseCapability)();
  67062. this.streamControllers[streamId].pullCall = pullCapability;
  67063. comObj.postMessage({
  67064. sourceName,
  67065. targetName,
  67066. stream: StreamKind.PULL,
  67067. streamId,
  67068. desiredSize: controller.desiredSize
  67069. });
  67070. return pullCapability.promise;
  67071. },
  67072. cancel: reason => {
  67073. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  67074. const cancelCapability = (0, _util.createPromiseCapability)();
  67075. this.streamControllers[streamId].cancelCall = cancelCapability;
  67076. this.streamControllers[streamId].isClosed = true;
  67077. comObj.postMessage({
  67078. sourceName,
  67079. targetName,
  67080. stream: StreamKind.CANCEL,
  67081. streamId,
  67082. reason: wrapReason(reason)
  67083. });
  67084. return cancelCapability.promise;
  67085. }
  67086. }, queueingStrategy);
  67087. }
  67088. _createStreamSink(data) {
  67089. const streamId = data.streamId,
  67090. sourceName = this.sourceName,
  67091. targetName = data.sourceName,
  67092. comObj = this.comObj;
  67093. const self = this,
  67094. action = this.actionHandler[data.action];
  67095. const streamSink = {
  67096. enqueue(chunk) {
  67097. let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  67098. let transfers = arguments.length > 2 ? arguments[2] : undefined;
  67099. if (this.isCancelled) {
  67100. return;
  67101. }
  67102. const lastDesiredSize = this.desiredSize;
  67103. this.desiredSize -= size;
  67104. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  67105. this.sinkCapability = (0, _util.createPromiseCapability)();
  67106. this.ready = this.sinkCapability.promise;
  67107. }
  67108. comObj.postMessage({
  67109. sourceName,
  67110. targetName,
  67111. stream: StreamKind.ENQUEUE,
  67112. streamId,
  67113. chunk
  67114. }, transfers);
  67115. },
  67116. close() {
  67117. if (this.isCancelled) {
  67118. return;
  67119. }
  67120. this.isCancelled = true;
  67121. comObj.postMessage({
  67122. sourceName,
  67123. targetName,
  67124. stream: StreamKind.CLOSE,
  67125. streamId
  67126. });
  67127. delete self.streamSinks[streamId];
  67128. },
  67129. error(reason) {
  67130. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  67131. if (this.isCancelled) {
  67132. return;
  67133. }
  67134. this.isCancelled = true;
  67135. comObj.postMessage({
  67136. sourceName,
  67137. targetName,
  67138. stream: StreamKind.ERROR,
  67139. streamId,
  67140. reason: wrapReason(reason)
  67141. });
  67142. },
  67143. sinkCapability: (0, _util.createPromiseCapability)(),
  67144. onPull: null,
  67145. onCancel: null,
  67146. isCancelled: false,
  67147. desiredSize: data.desiredSize,
  67148. ready: null
  67149. };
  67150. streamSink.sinkCapability.resolve();
  67151. streamSink.ready = streamSink.sinkCapability.promise;
  67152. this.streamSinks[streamId] = streamSink;
  67153. new Promise(function (resolve) {
  67154. resolve(action(data.data, streamSink));
  67155. }).then(function () {
  67156. comObj.postMessage({
  67157. sourceName,
  67158. targetName,
  67159. stream: StreamKind.START_COMPLETE,
  67160. streamId,
  67161. success: true
  67162. });
  67163. }, function (reason) {
  67164. comObj.postMessage({
  67165. sourceName,
  67166. targetName,
  67167. stream: StreamKind.START_COMPLETE,
  67168. streamId,
  67169. reason: wrapReason(reason)
  67170. });
  67171. });
  67172. }
  67173. _processStreamMessage(data) {
  67174. const streamId = data.streamId,
  67175. sourceName = this.sourceName,
  67176. targetName = data.sourceName,
  67177. comObj = this.comObj;
  67178. const streamController = this.streamControllers[streamId],
  67179. streamSink = this.streamSinks[streamId];
  67180. switch (data.stream) {
  67181. case StreamKind.START_COMPLETE:
  67182. if (data.success) {
  67183. streamController.startCall.resolve();
  67184. } else {
  67185. streamController.startCall.reject(wrapReason(data.reason));
  67186. }
  67187. break;
  67188. case StreamKind.PULL_COMPLETE:
  67189. if (data.success) {
  67190. streamController.pullCall.resolve();
  67191. } else {
  67192. streamController.pullCall.reject(wrapReason(data.reason));
  67193. }
  67194. break;
  67195. case StreamKind.PULL:
  67196. if (!streamSink) {
  67197. comObj.postMessage({
  67198. sourceName,
  67199. targetName,
  67200. stream: StreamKind.PULL_COMPLETE,
  67201. streamId,
  67202. success: true
  67203. });
  67204. break;
  67205. }
  67206. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  67207. streamSink.sinkCapability.resolve();
  67208. }
  67209. streamSink.desiredSize = data.desiredSize;
  67210. new Promise(function (resolve) {
  67211. resolve(streamSink.onPull && streamSink.onPull());
  67212. }).then(function () {
  67213. comObj.postMessage({
  67214. sourceName,
  67215. targetName,
  67216. stream: StreamKind.PULL_COMPLETE,
  67217. streamId,
  67218. success: true
  67219. });
  67220. }, function (reason) {
  67221. comObj.postMessage({
  67222. sourceName,
  67223. targetName,
  67224. stream: StreamKind.PULL_COMPLETE,
  67225. streamId,
  67226. reason: wrapReason(reason)
  67227. });
  67228. });
  67229. break;
  67230. case StreamKind.ENQUEUE:
  67231. (0, _util.assert)(streamController, "enqueue should have stream controller");
  67232. if (streamController.isClosed) {
  67233. break;
  67234. }
  67235. streamController.controller.enqueue(data.chunk);
  67236. break;
  67237. case StreamKind.CLOSE:
  67238. (0, _util.assert)(streamController, "close should have stream controller");
  67239. if (streamController.isClosed) {
  67240. break;
  67241. }
  67242. streamController.isClosed = true;
  67243. streamController.controller.close();
  67244. this._deleteStreamController(streamController, streamId);
  67245. break;
  67246. case StreamKind.ERROR:
  67247. (0, _util.assert)(streamController, "error should have stream controller");
  67248. streamController.controller.error(wrapReason(data.reason));
  67249. this._deleteStreamController(streamController, streamId);
  67250. break;
  67251. case StreamKind.CANCEL_COMPLETE:
  67252. if (data.success) {
  67253. streamController.cancelCall.resolve();
  67254. } else {
  67255. streamController.cancelCall.reject(wrapReason(data.reason));
  67256. }
  67257. this._deleteStreamController(streamController, streamId);
  67258. break;
  67259. case StreamKind.CANCEL:
  67260. if (!streamSink) {
  67261. break;
  67262. }
  67263. new Promise(function (resolve) {
  67264. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  67265. }).then(function () {
  67266. comObj.postMessage({
  67267. sourceName,
  67268. targetName,
  67269. stream: StreamKind.CANCEL_COMPLETE,
  67270. streamId,
  67271. success: true
  67272. });
  67273. }, function (reason) {
  67274. comObj.postMessage({
  67275. sourceName,
  67276. targetName,
  67277. stream: StreamKind.CANCEL_COMPLETE,
  67278. streamId,
  67279. reason: wrapReason(reason)
  67280. });
  67281. });
  67282. streamSink.sinkCapability.reject(wrapReason(data.reason));
  67283. streamSink.isCancelled = true;
  67284. delete this.streamSinks[streamId];
  67285. break;
  67286. default:
  67287. throw new Error("Unexpected stream case");
  67288. }
  67289. }
  67290. async _deleteStreamController(streamController, streamId) {
  67291. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  67292. delete this.streamControllers[streamId];
  67293. }
  67294. destroy() {
  67295. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  67296. }
  67297. }
  67298. exports.MessageHandler = MessageHandler;
  67299. /***/ }),
  67300. /* 232 */
  67301. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  67302. "use strict";
  67303. Object.defineProperty(exports, "__esModule", ({
  67304. value: true
  67305. }));
  67306. exports.PDFWorkerStream = void 0;
  67307. var _util = __w_pdfjs_require__(2);
  67308. class PDFWorkerStream {
  67309. constructor(msgHandler) {
  67310. this._msgHandler = msgHandler;
  67311. this._contentLength = null;
  67312. this._fullRequestReader = null;
  67313. this._rangeRequestReaders = [];
  67314. }
  67315. getFullReader() {
  67316. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  67317. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  67318. return this._fullRequestReader;
  67319. }
  67320. getRangeReader(begin, end) {
  67321. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  67322. this._rangeRequestReaders.push(reader);
  67323. return reader;
  67324. }
  67325. cancelAllRequests(reason) {
  67326. if (this._fullRequestReader) {
  67327. this._fullRequestReader.cancel(reason);
  67328. }
  67329. for (const reader of this._rangeRequestReaders.slice(0)) {
  67330. reader.cancel(reason);
  67331. }
  67332. }
  67333. }
  67334. exports.PDFWorkerStream = PDFWorkerStream;
  67335. class PDFWorkerStreamReader {
  67336. constructor(msgHandler) {
  67337. this._msgHandler = msgHandler;
  67338. this.onProgress = null;
  67339. this._contentLength = null;
  67340. this._isRangeSupported = false;
  67341. this._isStreamingSupported = false;
  67342. const readableStream = this._msgHandler.sendWithStream("GetReader");
  67343. this._reader = readableStream.getReader();
  67344. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  67345. this._isStreamingSupported = data.isStreamingSupported;
  67346. this._isRangeSupported = data.isRangeSupported;
  67347. this._contentLength = data.contentLength;
  67348. });
  67349. }
  67350. get headersReady() {
  67351. return this._headersReady;
  67352. }
  67353. get contentLength() {
  67354. return this._contentLength;
  67355. }
  67356. get isStreamingSupported() {
  67357. return this._isStreamingSupported;
  67358. }
  67359. get isRangeSupported() {
  67360. return this._isRangeSupported;
  67361. }
  67362. async read() {
  67363. const {
  67364. value,
  67365. done
  67366. } = await this._reader.read();
  67367. if (done) {
  67368. return {
  67369. value: undefined,
  67370. done: true
  67371. };
  67372. }
  67373. return {
  67374. value: value.buffer,
  67375. done: false
  67376. };
  67377. }
  67378. cancel(reason) {
  67379. this._reader.cancel(reason);
  67380. }
  67381. }
  67382. class PDFWorkerStreamRangeReader {
  67383. constructor(begin, end, msgHandler) {
  67384. this._msgHandler = msgHandler;
  67385. this.onProgress = null;
  67386. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  67387. begin,
  67388. end
  67389. });
  67390. this._reader = readableStream.getReader();
  67391. }
  67392. get isStreamingSupported() {
  67393. return false;
  67394. }
  67395. async read() {
  67396. const {
  67397. value,
  67398. done
  67399. } = await this._reader.read();
  67400. if (done) {
  67401. return {
  67402. value: undefined,
  67403. done: true
  67404. };
  67405. }
  67406. return {
  67407. value: value.buffer,
  67408. done: false
  67409. };
  67410. }
  67411. cancel(reason) {
  67412. this._reader.cancel(reason);
  67413. }
  67414. }
  67415. /***/ })
  67416. /******/ ]);
  67417. /************************************************************************/
  67418. /******/ // The module cache
  67419. /******/ var __webpack_module_cache__ = {};
  67420. /******/
  67421. /******/ // The require function
  67422. /******/ function __w_pdfjs_require__(moduleId) {
  67423. /******/ // Check if module is in cache
  67424. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  67425. /******/ if (cachedModule !== undefined) {
  67426. /******/ return cachedModule.exports;
  67427. /******/ }
  67428. /******/ // Create a new module (and put it into the cache)
  67429. /******/ var module = __webpack_module_cache__[moduleId] = {
  67430. /******/ // no module.id needed
  67431. /******/ // no module.loaded needed
  67432. /******/ exports: {}
  67433. /******/ };
  67434. /******/
  67435. /******/ // Execute the module function
  67436. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  67437. /******/
  67438. /******/ // Return the exports of the module
  67439. /******/ return module.exports;
  67440. /******/ }
  67441. /******/
  67442. /************************************************************************/
  67443. /******/ /* webpack/runtime/define property getters */
  67444. /******/ (() => {
  67445. /******/ // define getter functions for harmony exports
  67446. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  67447. /******/ for(var key in definition) {
  67448. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  67449. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  67450. /******/ }
  67451. /******/ }
  67452. /******/ };
  67453. /******/ })();
  67454. /******/
  67455. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  67456. /******/ (() => {
  67457. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  67458. /******/ })();
  67459. /******/
  67460. /******/ /* webpack/runtime/make namespace object */
  67461. /******/ (() => {
  67462. /******/ // define __esModule on exports
  67463. /******/ __w_pdfjs_require__.r = (exports) => {
  67464. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  67465. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  67466. /******/ }
  67467. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  67468. /******/ };
  67469. /******/ })();
  67470. /******/
  67471. /************************************************************************/
  67472. var __webpack_exports__ = {};
  67473. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  67474. (() => {
  67475. "use strict";
  67476. var exports = __webpack_exports__;
  67477. Object.defineProperty(exports, "__esModule", ({
  67478. value: true
  67479. }));
  67480. Object.defineProperty(exports, "WorkerMessageHandler", ({
  67481. enumerable: true,
  67482. get: function () {
  67483. return _worker.WorkerMessageHandler;
  67484. }
  67485. }));
  67486. var _worker = __w_pdfjs_require__(1);
  67487. const pdfjsVersion = '3.2.146';
  67488. const pdfjsBuild = '3fd2a3548';
  67489. })();
  67490. /******/ return __webpack_exports__;
  67491. /******/ })()
  67492. ;
  67493. });
  67494. //# sourceMappingURL=pdf.worker.js.map