template.js 111 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2021 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. "use strict";
  23. Object.defineProperty(exports, "__esModule", {
  24. value: true
  25. });
  26. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  27. var _xfa_object = require("./xfa_object.js");
  28. var _namespaces = require("./namespaces.js");
  29. var _utils = require("./utils.js");
  30. var _html_utils = require("./html_utils.js");
  31. var _util = require("../../shared/util.js");
  32. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  33. function _setValue(templateNode, value) {
  34. if (!templateNode.value) {
  35. const nodeValue = new Value({});
  36. templateNode[_xfa_object.$appendChild](nodeValue);
  37. templateNode.value = nodeValue;
  38. }
  39. templateNode.value[_xfa_object.$setValue](value);
  40. }
  41. class AppearanceFilter extends _xfa_object.StringObject {
  42. constructor(attributes) {
  43. super(TEMPLATE_NS_ID, "appearanceFilter");
  44. this.id = attributes.id || "";
  45. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  46. this.use = attributes.use || "";
  47. this.usehref = attributes.usehref || "";
  48. }
  49. }
  50. class Arc extends _xfa_object.XFAObject {
  51. constructor(attributes) {
  52. super(TEMPLATE_NS_ID, "arc", true);
  53. this.circular = (0, _utils.getInteger)({
  54. data: attributes.circular,
  55. defaultValue: 0,
  56. validate: x => x === 1
  57. });
  58. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  59. this.id = attributes.id || "";
  60. this.startAngle = (0, _utils.getFloat)({
  61. data: attributes.startAngle,
  62. defaultValue: 0,
  63. validate: x => true
  64. });
  65. this.sweepAngle = (0, _utils.getFloat)({
  66. data: attributes.sweepAngle,
  67. defaultValue: 360,
  68. validate: x => true
  69. });
  70. this.use = attributes.use || "";
  71. this.usehref = attributes.usehref || "";
  72. this.edge = null;
  73. this.fill = null;
  74. }
  75. }
  76. class Area extends _xfa_object.XFAObject {
  77. constructor(attributes) {
  78. super(TEMPLATE_NS_ID, "area", true);
  79. this.colSpan = (0, _utils.getInteger)({
  80. data: attributes.colSpan,
  81. defaultValue: 1,
  82. validate: n => n >= 1
  83. });
  84. this.id = attributes.id || "";
  85. this.name = attributes.name || "";
  86. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  87. this.use = attributes.use || "";
  88. this.usehref = attributes.usehref || "";
  89. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  90. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  91. this.desc = null;
  92. this.extras = null;
  93. this.area = new _xfa_object.XFAObjectArray();
  94. this.draw = new _xfa_object.XFAObjectArray();
  95. this.exObject = new _xfa_object.XFAObjectArray();
  96. this.exclGroup = new _xfa_object.XFAObjectArray();
  97. this.field = new _xfa_object.XFAObjectArray();
  98. this.subform = new _xfa_object.XFAObjectArray();
  99. this.subformSet = new _xfa_object.XFAObjectArray();
  100. }
  101. [_xfa_object.$isTransparent]() {
  102. return true;
  103. }
  104. }
  105. class Assist extends _xfa_object.XFAObject {
  106. constructor(attributes) {
  107. super(TEMPLATE_NS_ID, "assist", true);
  108. this.id = attributes.id || "";
  109. this.role = attributes.role || "";
  110. this.use = attributes.use || "";
  111. this.usehref = attributes.usehref || "";
  112. this.speak = null;
  113. this.toolTip = null;
  114. }
  115. }
  116. class Barcode extends _xfa_object.XFAObject {
  117. constructor(attributes) {
  118. super(TEMPLATE_NS_ID, "barcode", true);
  119. this.charEncoding = (0, _utils.getKeyword)({
  120. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  121. defaultValue: "",
  122. 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-[0-9]{2}/)
  123. });
  124. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  125. this.dataColumnCount = (0, _utils.getInteger)({
  126. data: attributes.dataColumnCount,
  127. defaultValue: -1,
  128. validate: x => x >= 0
  129. });
  130. this.dataLength = (0, _utils.getInteger)({
  131. data: attributes.dataLength,
  132. defaultValue: -1,
  133. validate: x => x >= 0
  134. });
  135. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  136. this.dataRowCount = (0, _utils.getInteger)({
  137. data: attributes.dataRowCount,
  138. defaultValue: -1,
  139. validate: x => x >= 0
  140. });
  141. this.endChar = attributes.endChar || "";
  142. this.errorCorrectionLevel = (0, _utils.getInteger)({
  143. data: attributes.errorCorrectionLevel,
  144. defaultValue: -1,
  145. validate: x => x >= 0 && x <= 8
  146. });
  147. this.id = attributes.id || "";
  148. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  149. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  150. this.printCheckDigit = (0, _utils.getInteger)({
  151. data: attributes.printCheckDigit,
  152. defaultValue: 0,
  153. validate: x => x === 1
  154. });
  155. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  156. this.startChar = attributes.startChar || "";
  157. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  158. this.truncate = (0, _utils.getInteger)({
  159. data: attributes.truncate,
  160. defaultValue: 0,
  161. validate: x => x === 1
  162. });
  163. 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"]);
  164. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  165. this.use = attributes.use || "";
  166. this.usehref = attributes.usehref || "";
  167. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  168. this.encrypt = null;
  169. this.extras = null;
  170. }
  171. }
  172. class Bind extends _xfa_object.XFAObject {
  173. constructor(attributes) {
  174. super(TEMPLATE_NS_ID, "bind", true);
  175. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  176. this.ref = attributes.ref || "";
  177. this.picture = null;
  178. }
  179. }
  180. class BindItems extends _xfa_object.XFAObject {
  181. constructor(attributes) {
  182. super(TEMPLATE_NS_ID, "bindItems");
  183. this.connection = attributes.connection || "";
  184. this.labelRef = attributes.labelRef || "";
  185. this.ref = attributes.ref || "";
  186. this.valueRef = attributes.valueRef || "";
  187. }
  188. }
  189. exports.BindItems = BindItems;
  190. class Bookend extends _xfa_object.XFAObject {
  191. constructor(attributes) {
  192. super(TEMPLATE_NS_ID, "bookend");
  193. this.id = attributes.id || "";
  194. this.leader = attributes.leader || "";
  195. this.trailer = attributes.trailer || "";
  196. this.use = attributes.use || "";
  197. this.usehref = attributes.usehref || "";
  198. }
  199. }
  200. class BooleanElement extends _xfa_object.Option01 {
  201. constructor(attributes) {
  202. super(TEMPLATE_NS_ID, "boolean");
  203. this.id = attributes.id || "";
  204. this.name = attributes.name || "";
  205. this.use = attributes.use || "";
  206. this.usehref = attributes.usehref || "";
  207. }
  208. [_xfa_object.$toHTML]() {
  209. return this[_xfa_object.$content] === 1;
  210. }
  211. }
  212. class Border extends _xfa_object.XFAObject {
  213. constructor(attributes) {
  214. super(TEMPLATE_NS_ID, "border", true);
  215. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  216. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  217. this.id = attributes.id || "";
  218. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  219. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  220. this.use = attributes.use || "";
  221. this.usehref = attributes.usehref || "";
  222. this.corner = new _xfa_object.XFAObjectArray(4);
  223. this.edge = new _xfa_object.XFAObjectArray(4);
  224. this.extras = null;
  225. this.fill = null;
  226. this.margin = null;
  227. }
  228. [_xfa_object.$toStyle](widths, margins) {
  229. const edgeStyles = this.edge.children.map(node => node[_xfa_object.$toStyle]());
  230. const cornerStyles = this.edge.children.map(node => node[_xfa_object.$toStyle]());
  231. let style;
  232. if (this.margin) {
  233. style = this.margin[_xfa_object.$toStyle]();
  234. if (margins) {
  235. margins.push(this.margin.topInset, this.margin.rightInset, this.margin.bottomInset, this.margin.leftInset);
  236. }
  237. } else {
  238. style = Object.create(null);
  239. if (margins) {
  240. margins.push(0, 0, 0, 0);
  241. }
  242. }
  243. if (this.fill) {
  244. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  245. }
  246. if (edgeStyles.length > 0) {
  247. if (widths) {
  248. this.edge.children.forEach(node => widths.push(node.thickness));
  249. if (widths.length < 4) {
  250. const last = widths[widths.length - 1];
  251. for (let i = widths.length; i < 4; i++) {
  252. widths.push(last);
  253. }
  254. }
  255. }
  256. if (edgeStyles.length === 2 || edgeStyles.length === 3) {
  257. const last = edgeStyles[edgeStyles.length - 1];
  258. for (let i = edgeStyles.length; i < 4; i++) {
  259. edgeStyles.push(last);
  260. }
  261. }
  262. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  263. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  264. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  265. } else {
  266. if (widths) {
  267. widths.push(0, 0, 0, 0);
  268. }
  269. }
  270. if (cornerStyles.length > 0) {
  271. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  272. const last = cornerStyles[cornerStyles.length - 1];
  273. for (let i = cornerStyles.length; i < 4; i++) {
  274. cornerStyles.push(last);
  275. }
  276. }
  277. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  278. }
  279. switch (this.presence) {
  280. case "invisible":
  281. case "hidden":
  282. style.borderStyle = "";
  283. break;
  284. case "inactive":
  285. style.borderStyle = "none";
  286. break;
  287. }
  288. return style;
  289. }
  290. }
  291. class Break extends _xfa_object.XFAObject {
  292. constructor(attributes) {
  293. super(TEMPLATE_NS_ID, "break", true);
  294. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  295. this.afterTarget = attributes.afterTarget || "";
  296. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  297. this.beforeTarget = attributes.beforeTarget || "";
  298. this.bookendLeader = attributes.bookendLeader || "";
  299. this.bookendTrailer = attributes.bookendTrailer || "";
  300. this.id = attributes.id || "";
  301. this.overflowLeader = attributes.overflowLeader || "";
  302. this.overflowTarget = attributes.overflowTarget || "";
  303. this.overflowTrailer = attributes.overflowTrailer || "";
  304. this.startNew = (0, _utils.getInteger)({
  305. data: attributes.startNew,
  306. defaultValue: 0,
  307. validate: x => x === 1
  308. });
  309. this.use = attributes.use || "";
  310. this.usehref = attributes.usehref || "";
  311. this.extras = null;
  312. }
  313. }
  314. class BreakAfter extends _xfa_object.XFAObject {
  315. constructor(attributes) {
  316. super(TEMPLATE_NS_ID, "breakAfter", true);
  317. this.id = attributes.id || "";
  318. this.leader = attributes.leader || "";
  319. this.startNew = (0, _utils.getInteger)({
  320. data: attributes.startNew,
  321. defaultValue: 0,
  322. validate: x => x === 1
  323. });
  324. this.target = attributes.target || "";
  325. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  326. this.trailer = attributes.trailer || "";
  327. this.use = attributes.use || "";
  328. this.usehref = attributes.usehref || "";
  329. this.script = null;
  330. }
  331. }
  332. class BreakBefore extends _xfa_object.XFAObject {
  333. constructor(attributes) {
  334. super(TEMPLATE_NS_ID, "breakBefore", true);
  335. this.id = attributes.id || "";
  336. this.leader = attributes.leader || "";
  337. this.startNew = (0, _utils.getInteger)({
  338. data: attributes.startNew,
  339. defaultValue: 0,
  340. validate: x => x === 1
  341. });
  342. this.target = attributes.target || "";
  343. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  344. this.trailer = attributes.trailer || "";
  345. this.use = attributes.use || "";
  346. this.usehref = attributes.usehref || "";
  347. this.script = null;
  348. }
  349. }
  350. class Button extends _xfa_object.XFAObject {
  351. constructor(attributes) {
  352. super(TEMPLATE_NS_ID, "button", true);
  353. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  354. this.id = attributes.id || "";
  355. this.use = attributes.use || "";
  356. this.usehref = attributes.usehref || "";
  357. this.extras = null;
  358. }
  359. [_xfa_object.$toHTML]() {
  360. return {
  361. name: "button",
  362. attributes: {
  363. class: "xfaButton",
  364. style: {}
  365. }
  366. };
  367. }
  368. }
  369. class Calculate extends _xfa_object.XFAObject {
  370. constructor(attributes) {
  371. super(TEMPLATE_NS_ID, "calculate", true);
  372. this.id = attributes.id || "";
  373. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  374. this.use = attributes.use || "";
  375. this.usehref = attributes.usehref || "";
  376. this.extras = null;
  377. this.message = null;
  378. this.script = null;
  379. }
  380. }
  381. class Caption extends _xfa_object.XFAObject {
  382. constructor(attributes) {
  383. super(TEMPLATE_NS_ID, "caption", true);
  384. this.id = attributes.id || "";
  385. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  386. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  387. this.reserve = (0, _utils.getMeasurement)(attributes.reserve);
  388. this.use = attributes.use || "";
  389. this.usehref = attributes.usehref || "";
  390. this.extras = null;
  391. this.font = null;
  392. this.margin = null;
  393. this.para = null;
  394. this.value = null;
  395. }
  396. [_xfa_object.$setValue](value) {
  397. _setValue(this, value);
  398. }
  399. [_xfa_object.$toHTML]() {
  400. if (!this.value) {
  401. return null;
  402. }
  403. const value = this.value[_xfa_object.$toHTML]();
  404. if (!value) {
  405. return null;
  406. }
  407. const children = [];
  408. if (typeof value === "string") {
  409. children.push({
  410. name: "#text",
  411. value
  412. });
  413. } else {
  414. children.push(value);
  415. }
  416. const style = (0, _html_utils.toStyle)(this, "font", "margin", "para", "visibility");
  417. switch (this.placement) {
  418. case "left":
  419. case "right":
  420. style.minWidth = (0, _html_utils.measureToString)(this.reserve);
  421. break;
  422. case "top":
  423. case "bottom":
  424. style.minHeight = (0, _html_utils.measureToString)(this.reserve);
  425. break;
  426. }
  427. return {
  428. name: "div",
  429. attributes: {
  430. style
  431. },
  432. children
  433. };
  434. }
  435. }
  436. class Certificate extends _xfa_object.StringObject {
  437. constructor(attributes) {
  438. super(TEMPLATE_NS_ID, "certificate");
  439. this.id = attributes.id || "";
  440. this.name = attributes.name || "";
  441. this.use = attributes.use || "";
  442. this.usehref = attributes.usehref || "";
  443. }
  444. }
  445. class Certificates extends _xfa_object.XFAObject {
  446. constructor(attributes) {
  447. super(TEMPLATE_NS_ID, "certificates", true);
  448. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  449. this.id = attributes.id || "";
  450. this.url = attributes.url || "";
  451. this.urlPolicy = attributes.urlPolicy || "";
  452. this.use = attributes.use || "";
  453. this.usehref = attributes.usehref || "";
  454. this.encryption = null;
  455. this.issuers = null;
  456. this.keyUsage = null;
  457. this.oids = null;
  458. this.signing = null;
  459. this.subjectDNs = null;
  460. }
  461. }
  462. class CheckButton extends _xfa_object.XFAObject {
  463. constructor(attributes) {
  464. super(TEMPLATE_NS_ID, "checkButton", true);
  465. this.id = attributes.id || "";
  466. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  467. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  468. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  469. this.use = attributes.use || "";
  470. this.usehref = attributes.usehref || "";
  471. this.border = null;
  472. this.extras = null;
  473. this.margin = null;
  474. }
  475. [_xfa_object.$toHTML]() {
  476. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  477. const size = (0, _html_utils.measureToString)(this.size);
  478. style.width = style.height = size;
  479. let mark, radius;
  480. if (this.shape === "square") {
  481. mark = "■";
  482. radius = "10%";
  483. } else {
  484. mark = "●";
  485. radius = "50%";
  486. }
  487. if (!style.borderRadius) {
  488. style.borderRadius = radius;
  489. }
  490. if (this.mark !== "default") {
  491. switch (this.mark) {
  492. case "check":
  493. mark = "✓";
  494. break;
  495. case "circle":
  496. mark = "●";
  497. break;
  498. case "cross":
  499. mark = "✕";
  500. break;
  501. case "diamond":
  502. mark = "♦";
  503. break;
  504. case "square":
  505. mark = "■";
  506. break;
  507. case "star":
  508. mark = "★";
  509. break;
  510. }
  511. }
  512. if (size !== "10px") {
  513. style.fontSize = size;
  514. style.lineHeight = size;
  515. style.width = size;
  516. style.height = size;
  517. }
  518. return {
  519. name: "label",
  520. attributes: {
  521. class: "xfaLabel"
  522. },
  523. children: [{
  524. name: "input",
  525. attributes: {
  526. class: "xfaCheckbox",
  527. type: "checkbox"
  528. }
  529. }, {
  530. name: "span",
  531. attributes: {
  532. class: "xfaCheckboxMark",
  533. mark,
  534. style
  535. }
  536. }]
  537. };
  538. }
  539. }
  540. class ChoiceList extends _xfa_object.XFAObject {
  541. constructor(attributes) {
  542. super(TEMPLATE_NS_ID, "choiceList", true);
  543. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  544. this.id = attributes.id || "";
  545. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  546. this.textEntry = (0, _utils.getInteger)({
  547. data: attributes.textEntry,
  548. defaultValue: 0,
  549. validate: x => x === 1
  550. });
  551. this.use = attributes.use || "";
  552. this.usehref = attributes.usehref || "";
  553. this.border = null;
  554. this.extras = null;
  555. this.margin = null;
  556. }
  557. [_xfa_object.$toHTML]() {
  558. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  559. return {
  560. name: "label",
  561. attributes: {
  562. class: "xfaLabel"
  563. },
  564. children: [{
  565. name: "select",
  566. attributes: {
  567. class: "xfaSxelect",
  568. multiple: this.open === "multiSelect",
  569. style
  570. }
  571. }]
  572. };
  573. }
  574. }
  575. class Color extends _xfa_object.XFAObject {
  576. constructor(attributes) {
  577. super(TEMPLATE_NS_ID, "color", true);
  578. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  579. this.id = attributes.id || "";
  580. this.use = attributes.use || "";
  581. this.usehref = attributes.usehref || "";
  582. this.value = (0, _utils.getColor)(attributes.value);
  583. this.extras = null;
  584. }
  585. [_xfa_object.$hasSettableValue]() {
  586. return false;
  587. }
  588. [_xfa_object.$toStyle]() {
  589. return _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b);
  590. }
  591. }
  592. class Comb extends _xfa_object.XFAObject {
  593. constructor(attributes) {
  594. super(TEMPLATE_NS_ID, "comb");
  595. this.id = attributes.id || "";
  596. this.numberOfCells = (0, _utils.getInteger)({
  597. data: attributes.numberOfCells,
  598. defaultValue: 0,
  599. validate: x => x >= 0
  600. });
  601. this.use = attributes.use || "";
  602. this.usehref = attributes.usehref || "";
  603. }
  604. }
  605. class Connect extends _xfa_object.XFAObject {
  606. constructor(attributes) {
  607. super(TEMPLATE_NS_ID, "connect", true);
  608. this.connection = attributes.connection || "";
  609. this.id = attributes.id || "";
  610. this.ref = attributes.ref || "";
  611. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  612. this.use = attributes.use || "";
  613. this.usehref = attributes.usehref || "";
  614. this.picture = null;
  615. }
  616. }
  617. class ContentArea extends _xfa_object.XFAObject {
  618. constructor(attributes) {
  619. super(TEMPLATE_NS_ID, "contentArea", true);
  620. this.h = (0, _utils.getMeasurement)(attributes.h);
  621. this.id = attributes.id || "";
  622. this.name = attributes.name || "";
  623. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  624. this.use = attributes.use || "";
  625. this.usehref = attributes.usehref || "";
  626. this.w = (0, _utils.getMeasurement)(attributes.w);
  627. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  628. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  629. this.desc = null;
  630. this.extras = null;
  631. }
  632. [_xfa_object.$toHTML]() {
  633. const left = (0, _html_utils.measureToString)(this.x);
  634. const top = (0, _html_utils.measureToString)(this.y);
  635. const style = {
  636. position: "absolute",
  637. left,
  638. top,
  639. width: (0, _html_utils.measureToString)(this.w),
  640. height: (0, _html_utils.measureToString)(this.h)
  641. };
  642. return {
  643. name: "div",
  644. children: [],
  645. attributes: {
  646. style,
  647. class: "xfaContentarea",
  648. id: this[_xfa_object.$uid]
  649. }
  650. };
  651. }
  652. }
  653. class Corner extends _xfa_object.XFAObject {
  654. constructor(attributes) {
  655. super(TEMPLATE_NS_ID, "corner", true);
  656. this.id = attributes.id || "";
  657. this.inverted = (0, _utils.getInteger)({
  658. data: attributes.inverted,
  659. defaultValue: 0,
  660. validate: x => x === 1
  661. });
  662. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  663. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  664. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  665. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  666. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  667. this.use = attributes.use || "";
  668. this.usehref = attributes.usehref || "";
  669. this.color = null;
  670. this.extras = null;
  671. }
  672. [_xfa_object.$toStyle]() {
  673. const style = (0, _html_utils.toStyle)(this, "visibility");
  674. style.radius = (0, _html_utils.measureToString)(this.radius);
  675. return style;
  676. }
  677. }
  678. class DateElement extends _xfa_object.ContentObject {
  679. constructor(attributes) {
  680. super(TEMPLATE_NS_ID, "date");
  681. this.id = attributes.id || "";
  682. this.name = attributes.name || "";
  683. this.use = attributes.use || "";
  684. this.usehref = attributes.usehref || "";
  685. }
  686. [_xfa_object.$finalize]() {
  687. this[_xfa_object.$content] = new Date(this[_xfa_object.$content].trim());
  688. }
  689. [_xfa_object.$toHTML]() {
  690. return this[_xfa_object.$content].toString();
  691. }
  692. }
  693. class DateTime extends _xfa_object.ContentObject {
  694. constructor(attributes) {
  695. super(TEMPLATE_NS_ID, "dateTime");
  696. this.id = attributes.id || "";
  697. this.name = attributes.name || "";
  698. this.use = attributes.use || "";
  699. this.usehref = attributes.usehref || "";
  700. }
  701. [_xfa_object.$finalize]() {
  702. this[_xfa_object.$content] = new Date(this[_xfa_object.$content].trim());
  703. }
  704. [_xfa_object.$toHTML]() {
  705. return this[_xfa_object.$content].toString();
  706. }
  707. }
  708. class DateTimeEdit extends _xfa_object.XFAObject {
  709. constructor(attributes) {
  710. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  711. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  712. this.id = attributes.id || "";
  713. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  714. this.use = attributes.use || "";
  715. this.usehref = attributes.usehref || "";
  716. this.border = null;
  717. this.comb = null;
  718. this.extras = null;
  719. this.margin = null;
  720. }
  721. [_xfa_object.$toHTML]() {
  722. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  723. const html = {
  724. name: "input",
  725. attributes: {
  726. type: "text",
  727. class: "xfaTextfield",
  728. style
  729. }
  730. };
  731. return {
  732. name: "label",
  733. attributes: {
  734. class: "xfaLabel"
  735. },
  736. children: [html]
  737. };
  738. }
  739. }
  740. class Decimal extends _xfa_object.ContentObject {
  741. constructor(attributes) {
  742. super(TEMPLATE_NS_ID, "decimal");
  743. this.fracDigits = (0, _utils.getInteger)({
  744. data: attributes.fracDigits,
  745. defaultValue: 2,
  746. validate: x => true
  747. });
  748. this.id = attributes.id || "";
  749. this.leadDigits = (0, _utils.getInteger)({
  750. data: attributes.leadDigits,
  751. defaultValue: -1,
  752. validate: x => true
  753. });
  754. this.name = attributes.name || "";
  755. this.use = attributes.use || "";
  756. this.usehref = attributes.usehref || "";
  757. }
  758. [_xfa_object.$finalize]() {
  759. const number = parseFloat(this[_xfa_object.$content].trim());
  760. this[_xfa_object.$content] = isNaN(number) ? null : number;
  761. }
  762. [_xfa_object.$toHTML]() {
  763. return this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "";
  764. }
  765. }
  766. class DefaultUi extends _xfa_object.XFAObject {
  767. constructor(attributes) {
  768. super(TEMPLATE_NS_ID, "defaultUi", true);
  769. this.id = attributes.id || "";
  770. this.use = attributes.use || "";
  771. this.usehref = attributes.usehref || "";
  772. this.extras = null;
  773. }
  774. }
  775. class Desc extends _xfa_object.XFAObject {
  776. constructor(attributes) {
  777. super(TEMPLATE_NS_ID, "desc", true);
  778. this.id = attributes.id || "";
  779. this.use = attributes.use || "";
  780. this.usehref = attributes.usehref || "";
  781. this.boolean = new _xfa_object.XFAObjectArray();
  782. this.date = new _xfa_object.XFAObjectArray();
  783. this.dateTime = new _xfa_object.XFAObjectArray();
  784. this.decimal = new _xfa_object.XFAObjectArray();
  785. this.exData = new _xfa_object.XFAObjectArray();
  786. this.float = new _xfa_object.XFAObjectArray();
  787. this.image = new _xfa_object.XFAObjectArray();
  788. this.integer = new _xfa_object.XFAObjectArray();
  789. this.text = new _xfa_object.XFAObjectArray();
  790. this.time = new _xfa_object.XFAObjectArray();
  791. }
  792. }
  793. class DigestMethod extends _xfa_object.OptionObject {
  794. constructor(attributes) {
  795. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  796. this.id = attributes.id || "";
  797. this.use = attributes.use || "";
  798. this.usehref = attributes.usehref || "";
  799. }
  800. }
  801. class DigestMethods extends _xfa_object.XFAObject {
  802. constructor(attributes) {
  803. super(TEMPLATE_NS_ID, "digestMethods", true);
  804. this.id = attributes.id || "";
  805. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  806. this.use = attributes.use || "";
  807. this.usehref = attributes.usehref || "";
  808. this.digestMethod = new _xfa_object.XFAObjectArray();
  809. }
  810. }
  811. class Draw extends _xfa_object.XFAObject {
  812. constructor(attributes) {
  813. super(TEMPLATE_NS_ID, "draw", true);
  814. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  815. this.colSpan = (0, _utils.getInteger)({
  816. data: attributes.colSpan,
  817. defaultValue: 1,
  818. validate: x => x >= 1
  819. });
  820. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  821. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  822. this.id = attributes.id || "";
  823. this.locale = attributes.locale || "";
  824. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  825. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  826. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  827. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  828. this.name = attributes.name || "";
  829. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  830. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  831. this.rotate = (0, _utils.getInteger)({
  832. data: attributes.rotate,
  833. defaultValue: 0,
  834. validate: x => x % 90 === 0
  835. });
  836. this.use = attributes.use || "";
  837. this.usehref = attributes.usehref || "";
  838. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  839. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  840. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  841. this.assist = null;
  842. this.border = null;
  843. this.caption = null;
  844. this.desc = null;
  845. this.extras = null;
  846. this.font = null;
  847. this.keep = null;
  848. this.margin = null;
  849. this.para = null;
  850. this.traversal = null;
  851. this.ui = null;
  852. this.value = null;
  853. this.setProperty = new _xfa_object.XFAObjectArray();
  854. }
  855. [_xfa_object.$setValue](value) {
  856. _setValue(this, value);
  857. }
  858. [_xfa_object.$toHTML]() {
  859. if (!this.value) {
  860. return null;
  861. }
  862. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "presence", "rotate", "anchorType");
  863. const clazz = ["xfaDraw"];
  864. if (this.font) {
  865. clazz.push("xfaFont");
  866. }
  867. const attributes = {
  868. style,
  869. id: this[_xfa_object.$uid],
  870. class: clazz.join(" ")
  871. };
  872. if (this.name) {
  873. attributes.xfaName = this.name;
  874. }
  875. return {
  876. name: "div",
  877. attributes,
  878. children: []
  879. };
  880. }
  881. }
  882. class Edge extends _xfa_object.XFAObject {
  883. constructor(attributes) {
  884. super(TEMPLATE_NS_ID, "edge", true);
  885. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  886. this.id = attributes.id || "";
  887. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  888. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  889. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  890. this.use = attributes.use || "";
  891. this.usehref = attributes.usehref || "";
  892. this.color = null;
  893. this.extras = null;
  894. }
  895. [_xfa_object.$toStyle]() {
  896. const style = (0, _html_utils.toStyle)(this, "visibility");
  897. Object.assign(style, {
  898. linecap: this.cap,
  899. width: (0, _html_utils.measureToString)(this.thickness),
  900. color: this.color ? this.color[_xfa_object.$toHTML]() : "#000000",
  901. style: ""
  902. });
  903. if (this.presence !== "visible") {
  904. style.style = "none";
  905. } else {
  906. switch (this.stroke) {
  907. case "solid":
  908. style.style = "solid";
  909. break;
  910. case "dashDot":
  911. style.style = "dashed";
  912. break;
  913. case "dashDotDot":
  914. style.style = "dashed";
  915. break;
  916. case "dashed":
  917. style.style = "dashed";
  918. break;
  919. case "dotted":
  920. style.style = "dotted";
  921. break;
  922. case "embossed":
  923. style.style = "ridge";
  924. break;
  925. case "etched":
  926. style.style = "groove";
  927. break;
  928. case "lowered":
  929. style.style = "inset";
  930. break;
  931. case "raised":
  932. style.style = "outset";
  933. break;
  934. }
  935. }
  936. return style;
  937. }
  938. }
  939. class Encoding extends _xfa_object.OptionObject {
  940. constructor(attributes) {
  941. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  942. this.id = attributes.id || "";
  943. this.use = attributes.use || "";
  944. this.usehref = attributes.usehref || "";
  945. }
  946. }
  947. class Encodings extends _xfa_object.XFAObject {
  948. constructor(attributes) {
  949. super(TEMPLATE_NS_ID, "encodings", true);
  950. this.id = attributes.id || "";
  951. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  952. this.use = attributes.use || "";
  953. this.usehref = attributes.usehref || "";
  954. this.encoding = new _xfa_object.XFAObjectArray();
  955. }
  956. }
  957. class Encrypt extends _xfa_object.XFAObject {
  958. constructor(attributes) {
  959. super(TEMPLATE_NS_ID, "encrypt", true);
  960. this.id = attributes.id || "";
  961. this.use = attributes.use || "";
  962. this.usehref = attributes.usehref || "";
  963. this.certificate = null;
  964. }
  965. }
  966. class EncryptData extends _xfa_object.XFAObject {
  967. constructor(attributes) {
  968. super(TEMPLATE_NS_ID, "encryptData", true);
  969. this.id = attributes.id || "";
  970. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  971. this.target = attributes.target || "";
  972. this.use = attributes.use || "";
  973. this.usehref = attributes.usehref || "";
  974. this.filter = null;
  975. this.manifest = null;
  976. }
  977. }
  978. class Encryption extends _xfa_object.XFAObject {
  979. constructor(attributes) {
  980. super(TEMPLATE_NS_ID, "encryption", true);
  981. this.id = attributes.id || "";
  982. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  983. this.use = attributes.use || "";
  984. this.usehref = attributes.usehref || "";
  985. this.certificate = new _xfa_object.XFAObjectArray();
  986. }
  987. }
  988. class EncryptionMethod extends _xfa_object.OptionObject {
  989. constructor(attributes) {
  990. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  991. this.id = attributes.id || "";
  992. this.use = attributes.use || "";
  993. this.usehref = attributes.usehref || "";
  994. }
  995. }
  996. class EncryptionMethods extends _xfa_object.XFAObject {
  997. constructor(attributes) {
  998. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  999. this.id = attributes.id || "";
  1000. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  1001. this.use = attributes.use || "";
  1002. this.usehref = attributes.usehref || "";
  1003. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  1004. }
  1005. }
  1006. class Event extends _xfa_object.XFAObject {
  1007. constructor(attributes) {
  1008. super(TEMPLATE_NS_ID, "event", true);
  1009. 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"]);
  1010. this.id = attributes.id || "";
  1011. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  1012. this.name = attributes.name || "";
  1013. this.ref = attributes.ref || "";
  1014. this.use = attributes.use || "";
  1015. this.usehref = attributes.usehref || "";
  1016. this.extras = null;
  1017. this.encryptData = null;
  1018. this.execute = null;
  1019. this.script = null;
  1020. this.signData = null;
  1021. this.submit = null;
  1022. }
  1023. }
  1024. class ExData extends _xfa_object.ContentObject {
  1025. constructor(attributes) {
  1026. super(TEMPLATE_NS_ID, "exData");
  1027. this.contentType = attributes.contentType || "";
  1028. this.href = attributes.href || "";
  1029. this.id = attributes.id || "";
  1030. this.maxLength = (0, _utils.getInteger)({
  1031. data: attributes.maxLength,
  1032. defaultValue: -1,
  1033. validate: x => x >= -1
  1034. });
  1035. this.name = attributes.name || "";
  1036. this.rid = attributes.rid || "";
  1037. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  1038. this.use = attributes.use || "";
  1039. this.usehref = attributes.usehref || "";
  1040. }
  1041. [_xfa_object.$onChild](child) {
  1042. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  1043. this[_xfa_object.$content] = child;
  1044. return true;
  1045. }
  1046. if (this.contentType === "text/xml") {
  1047. this[_xfa_object.$content] = child;
  1048. return true;
  1049. }
  1050. return false;
  1051. }
  1052. }
  1053. class ExObject extends _xfa_object.XFAObject {
  1054. constructor(attributes) {
  1055. super(TEMPLATE_NS_ID, "exObject", true);
  1056. this.archive = attributes.archive || "";
  1057. this.classId = attributes.classId || "";
  1058. this.codeBase = attributes.codeBase || "";
  1059. this.codeType = attributes.codeType || "";
  1060. this.id = attributes.id || "";
  1061. this.name = attributes.name || "";
  1062. this.use = attributes.use || "";
  1063. this.usehref = attributes.usehref || "";
  1064. this.extras = null;
  1065. this.boolean = new _xfa_object.XFAObjectArray();
  1066. this.date = new _xfa_object.XFAObjectArray();
  1067. this.dateTime = new _xfa_object.XFAObjectArray();
  1068. this.decimal = new _xfa_object.XFAObjectArray();
  1069. this.exData = new _xfa_object.XFAObjectArray();
  1070. this.exObject = new _xfa_object.XFAObjectArray();
  1071. this.float = new _xfa_object.XFAObjectArray();
  1072. this.image = new _xfa_object.XFAObjectArray();
  1073. this.integer = new _xfa_object.XFAObjectArray();
  1074. this.text = new _xfa_object.XFAObjectArray();
  1075. this.time = new _xfa_object.XFAObjectArray();
  1076. }
  1077. }
  1078. class ExclGroup extends _xfa_object.XFAObject {
  1079. constructor(attributes) {
  1080. super(TEMPLATE_NS_ID, "exclGroup", true);
  1081. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  1082. this.accessKey = attributes.accessKey || "";
  1083. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  1084. this.colSpan = (0, _utils.getInteger)({
  1085. data: attributes.colSpan,
  1086. defaultValue: 1,
  1087. validate: x => x >= 1
  1088. });
  1089. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  1090. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  1091. this.id = attributes.id || "";
  1092. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  1093. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  1094. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  1095. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  1096. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  1097. this.name = attributes.name || "";
  1098. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  1099. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  1100. this.use = attributes.use || "";
  1101. this.usehref = attributes.usehref || "";
  1102. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  1103. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  1104. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  1105. this.assist = null;
  1106. this.bind = null;
  1107. this.border = null;
  1108. this.calculate = null;
  1109. this.caption = null;
  1110. this.desc = null;
  1111. this.extras = null;
  1112. this.margin = null;
  1113. this.para = null;
  1114. this.traversal = null;
  1115. this.validate = null;
  1116. this.connect = new _xfa_object.XFAObjectArray();
  1117. this.event = new _xfa_object.XFAObjectArray();
  1118. this.field = new _xfa_object.XFAObjectArray();
  1119. this.setProperty = new _xfa_object.XFAObjectArray();
  1120. }
  1121. [_xfa_object.$hasSettableValue]() {
  1122. return true;
  1123. }
  1124. [_xfa_object.$setValue](value) {
  1125. for (const field of this.field.children) {
  1126. if (!field.value) {
  1127. const nodeValue = new Value({});
  1128. field[_xfa_object.$appendChild](nodeValue);
  1129. field.value = nodeValue;
  1130. }
  1131. const nodeBoolean = new BooleanElement({});
  1132. nodeBoolean[_xfa_object.$content] = 0;
  1133. for (const item of field.items.children) {
  1134. if (item[_xfa_object.$hasItem](value)) {
  1135. nodeBoolean[_xfa_object.$content] = 1;
  1136. break;
  1137. }
  1138. }
  1139. field.value[_xfa_object.$setValue](nodeBoolean);
  1140. }
  1141. }
  1142. [_xfa_object.$toHTML]() {
  1143. if (!this.value) {
  1144. return null;
  1145. }
  1146. const style = (0, _html_utils.toStyle)(this, "dimensions", "position", "anchorType");
  1147. const attributes = {
  1148. style,
  1149. id: this[_xfa_object.$uid],
  1150. class: "xfaExclgroup"
  1151. };
  1152. const children = this[_xfa_object.$childrenToHTML]({
  1153. filter: new Set(["field"]),
  1154. include: true
  1155. });
  1156. return {
  1157. name: "div",
  1158. attributes,
  1159. children
  1160. };
  1161. }
  1162. }
  1163. class Execute extends _xfa_object.XFAObject {
  1164. constructor(attributes) {
  1165. super(TEMPLATE_NS_ID, "execute");
  1166. this.connection = attributes.connection || "";
  1167. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  1168. this.id = attributes.id || "";
  1169. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  1170. this.use = attributes.use || "";
  1171. this.usehref = attributes.usehref || "";
  1172. }
  1173. }
  1174. class Extras extends _xfa_object.XFAObject {
  1175. constructor(attributes) {
  1176. super(TEMPLATE_NS_ID, "extras", true);
  1177. this.id = attributes.id || "";
  1178. this.name = attributes.name || "";
  1179. this.use = attributes.use || "";
  1180. this.usehref = attributes.usehref || "";
  1181. this.boolean = new _xfa_object.XFAObjectArray();
  1182. this.date = new _xfa_object.XFAObjectArray();
  1183. this.dateTime = new _xfa_object.XFAObjectArray();
  1184. this.decimal = new _xfa_object.XFAObjectArray();
  1185. this.exData = new _xfa_object.XFAObjectArray();
  1186. this.extras = new _xfa_object.XFAObjectArray();
  1187. this.float = new _xfa_object.XFAObjectArray();
  1188. this.image = new _xfa_object.XFAObjectArray();
  1189. this.integer = new _xfa_object.XFAObjectArray();
  1190. this.text = new _xfa_object.XFAObjectArray();
  1191. this.time = new _xfa_object.XFAObjectArray();
  1192. }
  1193. }
  1194. class Field extends _xfa_object.XFAObject {
  1195. constructor(attributes) {
  1196. super(TEMPLATE_NS_ID, "field", true);
  1197. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  1198. this.accessKey = attributes.accessKey || "";
  1199. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  1200. this.colSpan = (0, _utils.getInteger)({
  1201. data: attributes.colSpan,
  1202. defaultValue: 1,
  1203. validate: x => x >= 1
  1204. });
  1205. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  1206. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  1207. this.id = attributes.id || "";
  1208. this.locale = attributes.locale || "";
  1209. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  1210. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  1211. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  1212. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  1213. this.name = attributes.name || "";
  1214. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  1215. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  1216. this.rotate = (0, _utils.getInteger)({
  1217. data: attributes.rotate,
  1218. defaultValue: 0,
  1219. validate: x => x % 90 === 0
  1220. });
  1221. this.use = attributes.use || "";
  1222. this.usehref = attributes.usehref || "";
  1223. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  1224. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  1225. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  1226. this.assist = null;
  1227. this.bind = null;
  1228. this.border = null;
  1229. this.calculate = null;
  1230. this.caption = null;
  1231. this.desc = null;
  1232. this.extras = null;
  1233. this.font = null;
  1234. this.format = null;
  1235. this.items = new _xfa_object.XFAObjectArray(2);
  1236. this.keep = null;
  1237. this.margin = null;
  1238. this.para = null;
  1239. this.traversal = null;
  1240. this.ui = null;
  1241. this.validate = null;
  1242. this.value = null;
  1243. this.bindItems = new _xfa_object.XFAObjectArray();
  1244. this.connect = new _xfa_object.XFAObjectArray();
  1245. this.event = new _xfa_object.XFAObjectArray();
  1246. this.setProperty = new _xfa_object.XFAObjectArray();
  1247. }
  1248. [_xfa_object.$setValue](value) {
  1249. _setValue(this, value);
  1250. }
  1251. [_xfa_object.$toHTML]() {
  1252. if (!this.ui) {
  1253. return null;
  1254. }
  1255. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence");
  1256. const borderWidths = [];
  1257. const marginWidths = [];
  1258. if (this.border) {
  1259. Object.assign(style, this.border[_xfa_object.$toStyle](borderWidths, marginWidths));
  1260. }
  1261. if (this.margin) {
  1262. style.paddingTop = (0, _html_utils.measureToString)(this.margin.topInset - borderWidths[0] - marginWidths[0]);
  1263. style.paddingRight = (0, _html_utils.measureToString)(this.margin.rightInset - borderWidths[1] - marginWidths[1]);
  1264. style.paddingBottom = (0, _html_utils.measureToString)(this.margin.bottomInset - borderWidths[2] - marginWidths[2]);
  1265. style.paddingLeft = (0, _html_utils.measureToString)(this.margin.leftInset - borderWidths[3] - marginWidths[3]);
  1266. } else {
  1267. style.paddingTop = (0, _html_utils.measureToString)(-borderWidths[0] - marginWidths[0]);
  1268. style.paddingRight = (0, _html_utils.measureToString)(-borderWidths[1] - marginWidths[1]);
  1269. style.paddingBottom = (0, _html_utils.measureToString)(-borderWidths[2] - marginWidths[2]);
  1270. style.paddingLeft = (0, _html_utils.measureToString)(-borderWidths[3] - marginWidths[3]);
  1271. }
  1272. const clazz = ["xfaField"];
  1273. if (this.font) {
  1274. clazz.push("xfaFont");
  1275. }
  1276. const attributes = {
  1277. style,
  1278. id: this[_xfa_object.$uid],
  1279. class: clazz.join(" ")
  1280. };
  1281. if (this.name) {
  1282. attributes.xfaName = this.name;
  1283. }
  1284. const children = [];
  1285. const html = {
  1286. name: "div",
  1287. attributes,
  1288. children
  1289. };
  1290. const ui = this.ui ? this.ui[_xfa_object.$toHTML]() : null;
  1291. if (!ui) {
  1292. return html;
  1293. }
  1294. if (!ui.attributes.style) {
  1295. ui.attributes.style = Object.create(null);
  1296. }
  1297. children.push(ui);
  1298. if (this.value && ui.name !== "button") {
  1299. ui.children[0].attributes.value = this.value[_xfa_object.$toHTML]();
  1300. }
  1301. const caption = this.caption ? this.caption[_xfa_object.$toHTML]() : null;
  1302. if (!caption) {
  1303. return html;
  1304. }
  1305. if (ui.name === "button") {
  1306. ui.attributes.style.background = style.color;
  1307. delete style.color;
  1308. if (caption.name === "div") {
  1309. caption.name = "span";
  1310. }
  1311. ui.children = [caption];
  1312. return html;
  1313. }
  1314. ui.children.splice(0, 0, caption);
  1315. switch (this.caption.placement) {
  1316. case "left":
  1317. ui.attributes.style.flexDirection = "row";
  1318. break;
  1319. case "right":
  1320. ui.attributes.style.flexDirection = "row-reverse";
  1321. break;
  1322. case "top":
  1323. ui.attributes.style.flexDirection = "column";
  1324. break;
  1325. case "bottom":
  1326. ui.attributes.style.flexDirection = "column-reverse";
  1327. break;
  1328. case "inline":
  1329. delete ui.attributes.class;
  1330. caption.attributes.style.float = "left";
  1331. break;
  1332. }
  1333. return html;
  1334. }
  1335. }
  1336. exports.Field = Field;
  1337. class Fill extends _xfa_object.XFAObject {
  1338. constructor(attributes) {
  1339. super(TEMPLATE_NS_ID, "fill", true);
  1340. this.id = attributes.id || "";
  1341. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  1342. this.use = attributes.use || "";
  1343. this.usehref = attributes.usehref || "";
  1344. this.color = null;
  1345. this.extras = null;
  1346. this.linear = null;
  1347. this.pattern = null;
  1348. this.radial = null;
  1349. this.solid = null;
  1350. this.stipple = null;
  1351. }
  1352. [_xfa_object.$toStyle]() {
  1353. for (const name of Object.getOwnPropertyNames(this)) {
  1354. if (name === "extras" || name === "color") {
  1355. continue;
  1356. }
  1357. const obj = this[name];
  1358. if (!(obj instanceof _xfa_object.XFAObject)) {
  1359. continue;
  1360. }
  1361. return {
  1362. color: obj[_xfa_object.$toStyle](this.color)
  1363. };
  1364. }
  1365. return {
  1366. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000"
  1367. };
  1368. }
  1369. }
  1370. class Filter extends _xfa_object.XFAObject {
  1371. constructor(attributes) {
  1372. super(TEMPLATE_NS_ID, "filter", true);
  1373. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  1374. this.id = attributes.id || "";
  1375. this.name = attributes.name || "";
  1376. this.use = attributes.use || "";
  1377. this.usehref = attributes.usehref || "";
  1378. this.version = (0, _utils.getInteger)({
  1379. data: this.version,
  1380. defaultValue: 5,
  1381. validate: x => x >= 1 && x <= 5
  1382. });
  1383. this.appearanceFilter = null;
  1384. this.certificates = null;
  1385. this.digestMethods = null;
  1386. this.encodings = null;
  1387. this.encryptionMethods = null;
  1388. this.handler = null;
  1389. this.lockDocument = null;
  1390. this.mdp = null;
  1391. this.reasons = null;
  1392. this.timeStamp = null;
  1393. }
  1394. }
  1395. class Float extends _xfa_object.ContentObject {
  1396. constructor(attributes) {
  1397. super(TEMPLATE_NS_ID, "float");
  1398. this.id = attributes.id || "";
  1399. this.name = attributes.name || "";
  1400. this.use = attributes.use || "";
  1401. this.usehref = attributes.usehref || "";
  1402. }
  1403. [_xfa_object.$finalize]() {
  1404. const number = parseFloat(this[_xfa_object.$content].trim());
  1405. this[_xfa_object.$content] = isNaN(number) ? null : number;
  1406. }
  1407. [_xfa_object.$toHTML]() {
  1408. return this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "";
  1409. }
  1410. }
  1411. class Font extends _xfa_object.XFAObject {
  1412. constructor(attributes) {
  1413. super(TEMPLATE_NS_ID, "font", true);
  1414. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  1415. this.fontHorizontalScale = (0, _utils.getFloat)({
  1416. data: attributes.fontHorizontalScale,
  1417. defaultValue: 100,
  1418. validate: x => x >= 0
  1419. });
  1420. this.fontVerticalScale = (0, _utils.getFloat)({
  1421. data: attributes.fontVerticalScale,
  1422. defaultValue: 100,
  1423. validate: x => x >= 0
  1424. });
  1425. this.id = attributes.id || "";
  1426. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  1427. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  1428. this.lineThrough = (0, _utils.getInteger)({
  1429. data: attributes.lineThrough,
  1430. defaultValue: 0,
  1431. validate: x => x === 1 || x === 2
  1432. });
  1433. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  1434. this.overline = (0, _utils.getInteger)({
  1435. data: attributes.overline,
  1436. defaultValue: 0,
  1437. validate: x => x === 1 || x === 2
  1438. });
  1439. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  1440. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  1441. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  1442. this.typeface = attributes.typeface || "";
  1443. this.underline = (0, _utils.getInteger)({
  1444. data: attributes.underline,
  1445. defaultValue: 0,
  1446. validate: x => x === 1 || x === 2
  1447. });
  1448. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  1449. this.use = attributes.use || "";
  1450. this.usehref = attributes.usehref || "";
  1451. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  1452. this.extras = null;
  1453. this.fill = null;
  1454. }
  1455. [_xfa_object.$toStyle]() {
  1456. const style = (0, _html_utils.toStyle)(this, "fill");
  1457. if (style.color) {
  1458. if (!style.color.startsWith("#")) {
  1459. style.backgroundClip = "text";
  1460. style.background = style.color;
  1461. style.color = "transparent";
  1462. } else if (style.color === "#000000") {
  1463. delete style.color;
  1464. }
  1465. }
  1466. if (this.baselineShift) {
  1467. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  1468. }
  1469. if (this.kerningMode !== "none") {
  1470. style.fontKerning = "normal";
  1471. }
  1472. if (this.letterSpacing) {
  1473. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  1474. }
  1475. if (this.lineThrough !== 0) {
  1476. style.textDecoration = "line-through";
  1477. if (this.lineThrough === 2) {
  1478. style.textDecorationStyle = "double";
  1479. }
  1480. }
  1481. if (this.overline !== 0) {
  1482. style.textDecoration = "overline";
  1483. if (this.overline === 2) {
  1484. style.textDecorationStyle = "double";
  1485. }
  1486. }
  1487. if (this.posture !== "normal") {
  1488. style.fontStyle = this.posture;
  1489. }
  1490. const fontSize = (0, _html_utils.measureToString)(this.size);
  1491. if (fontSize !== "10px") {
  1492. style.fontSize = fontSize;
  1493. }
  1494. style.fontFamily = this.typeface;
  1495. if (this.underline !== 0) {
  1496. style.textDecoration = "underline";
  1497. if (this.underline === 2) {
  1498. style.textDecorationStyle = "double";
  1499. }
  1500. }
  1501. if (this.weight !== "normal") {
  1502. style.fontWeight = this.weight;
  1503. }
  1504. return style;
  1505. }
  1506. }
  1507. class Format extends _xfa_object.XFAObject {
  1508. constructor(attributes) {
  1509. super(TEMPLATE_NS_ID, "format", true);
  1510. this.id = attributes.id || "";
  1511. this.use = attributes.use || "";
  1512. this.usehref = attributes.usehref || "";
  1513. this.extras = null;
  1514. this.picture = null;
  1515. }
  1516. }
  1517. class Handler extends _xfa_object.StringObject {
  1518. constructor(attributes) {
  1519. super(TEMPLATE_NS_ID, "handler");
  1520. this.id = attributes.id || "";
  1521. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  1522. this.use = attributes.use || "";
  1523. this.usehref = attributes.usehref || "";
  1524. }
  1525. }
  1526. class Hyphenation extends _xfa_object.XFAObject {
  1527. constructor(attributes) {
  1528. super(TEMPLATE_NS_ID, "hyphenation");
  1529. this.excludeAllCaps = (0, _utils.getInteger)({
  1530. data: attributes.excludeAllCaps,
  1531. defaultValue: 0,
  1532. validate: x => x === 1
  1533. });
  1534. this.excludeInitialCap = (0, _utils.getInteger)({
  1535. data: attributes.excludeInitialCap,
  1536. defaultValue: 0,
  1537. validate: x => x === 1
  1538. });
  1539. this.hyphenate = (0, _utils.getInteger)({
  1540. data: attributes.hyphenate,
  1541. defaultValue: 0,
  1542. validate: x => x === 1
  1543. });
  1544. this.id = attributes.id || "";
  1545. this.pushCharacterCount = (0, _utils.getInteger)({
  1546. data: attributes.pushCharacterCount,
  1547. defaultValue: 3,
  1548. validate: x => x >= 0
  1549. });
  1550. this.remainCharacterCount = (0, _utils.getInteger)({
  1551. data: attributes.remainCharacterCount,
  1552. defaultValue: 3,
  1553. validate: x => x >= 0
  1554. });
  1555. this.use = attributes.use || "";
  1556. this.usehref = attributes.usehref || "";
  1557. this.wordCharacterCount = (0, _utils.getInteger)({
  1558. data: attributes.wordCharacterCount,
  1559. defaultValue: 7,
  1560. validate: x => x >= 0
  1561. });
  1562. }
  1563. }
  1564. class Image extends _xfa_object.StringObject {
  1565. constructor(attributes) {
  1566. super(TEMPLATE_NS_ID, "image");
  1567. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  1568. this.contentType = attributes.contentType || "";
  1569. this.href = attributes.href || "";
  1570. this.id = attributes.id || "";
  1571. this.name = attributes.name || "";
  1572. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  1573. this.use = attributes.use || "";
  1574. this.usehref = attributes.usehref || "";
  1575. }
  1576. [_xfa_object.$toHTML]() {
  1577. const html = {
  1578. name: "img",
  1579. attributes: {
  1580. style: {}
  1581. }
  1582. };
  1583. if (this.href) {
  1584. html.attributes.src = new URL(this.href);
  1585. return html;
  1586. }
  1587. if (this.transferEncoding === "base64") {
  1588. const buffer = Uint8Array.from(atob(this[_xfa_object.$content]), c => c.charCodeAt(0));
  1589. const blob = new Blob([buffer], {
  1590. type: this.contentType
  1591. });
  1592. html.attributes.src = URL.createObjectURL(blob);
  1593. return html;
  1594. }
  1595. return null;
  1596. }
  1597. }
  1598. class ImageEdit extends _xfa_object.XFAObject {
  1599. constructor(attributes) {
  1600. super(TEMPLATE_NS_ID, "imageEdit", true);
  1601. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  1602. this.id = attributes.id || "";
  1603. this.use = attributes.use || "";
  1604. this.usehref = attributes.usehref || "";
  1605. this.border = null;
  1606. this.extras = null;
  1607. this.margin = null;
  1608. }
  1609. }
  1610. class Integer extends _xfa_object.ContentObject {
  1611. constructor(attributes) {
  1612. super(TEMPLATE_NS_ID, "integer");
  1613. this.id = attributes.id || "";
  1614. this.name = attributes.name || "";
  1615. this.use = attributes.use || "";
  1616. this.usehref = attributes.usehref || "";
  1617. }
  1618. [_xfa_object.$finalize]() {
  1619. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  1620. this[_xfa_object.$content] = isNaN(number) ? null : number;
  1621. }
  1622. [_xfa_object.$toHTML]() {
  1623. return this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "";
  1624. }
  1625. }
  1626. class Issuers extends _xfa_object.XFAObject {
  1627. constructor(attributes) {
  1628. super(TEMPLATE_NS_ID, "issuers", true);
  1629. this.id = attributes.id || "";
  1630. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  1631. this.use = attributes.use || "";
  1632. this.usehref = attributes.usehref || "";
  1633. this.certificate = new _xfa_object.XFAObjectArray();
  1634. }
  1635. }
  1636. class Items extends _xfa_object.XFAObject {
  1637. constructor(attributes) {
  1638. super(TEMPLATE_NS_ID, "items", true);
  1639. this.id = attributes.id || "";
  1640. this.name = attributes.name || "";
  1641. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  1642. this.ref = attributes.ref || "";
  1643. this.save = (0, _utils.getInteger)({
  1644. data: attributes.save,
  1645. defaultValue: 0,
  1646. validate: x => x === 1
  1647. });
  1648. this.use = attributes.use || "";
  1649. this.usehref = attributes.usehref || "";
  1650. this.boolean = new _xfa_object.XFAObjectArray();
  1651. this.date = new _xfa_object.XFAObjectArray();
  1652. this.dateTime = new _xfa_object.XFAObjectArray();
  1653. this.decimal = new _xfa_object.XFAObjectArray();
  1654. this.exData = new _xfa_object.XFAObjectArray();
  1655. this.float = new _xfa_object.XFAObjectArray();
  1656. this.image = new _xfa_object.XFAObjectArray();
  1657. this.integer = new _xfa_object.XFAObjectArray();
  1658. this.text = new _xfa_object.XFAObjectArray();
  1659. this.time = new _xfa_object.XFAObjectArray();
  1660. }
  1661. [_xfa_object.$hasItem](value) {
  1662. return this.hasOwnProperty(value[_xfa_object.$nodeName]) && this[value[_xfa_object.$nodeName]].children.some(node => node[_xfa_object.$content] === value[_xfa_object.$content]);
  1663. }
  1664. }
  1665. exports.Items = Items;
  1666. class Keep extends _xfa_object.XFAObject {
  1667. constructor(attributes) {
  1668. super(TEMPLATE_NS_ID, "keep", true);
  1669. this.id = attributes.id || "";
  1670. const options = ["none", "contentArea", "pageArea"];
  1671. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  1672. this.next = (0, _utils.getStringOption)(attributes.next, options);
  1673. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  1674. this.use = attributes.use || "";
  1675. this.usehref = attributes.usehref || "";
  1676. this.extras = null;
  1677. }
  1678. }
  1679. class KeyUsage extends _xfa_object.XFAObject {
  1680. constructor(attributes) {
  1681. super(TEMPLATE_NS_ID, "keyUsage");
  1682. const options = ["", "yes", "no"];
  1683. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  1684. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  1685. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  1686. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  1687. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  1688. this.id = attributes.id || "";
  1689. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  1690. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  1691. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  1692. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  1693. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  1694. this.use = attributes.use || "";
  1695. this.usehref = attributes.usehref || "";
  1696. }
  1697. }
  1698. class Line extends _xfa_object.XFAObject {
  1699. constructor(attributes) {
  1700. super(TEMPLATE_NS_ID, "line", true);
  1701. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  1702. this.id = attributes.id || "";
  1703. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  1704. this.use = attributes.use || "";
  1705. this.usehref = attributes.usehref || "";
  1706. this.edge = null;
  1707. }
  1708. }
  1709. class Linear extends _xfa_object.XFAObject {
  1710. constructor(attributes) {
  1711. super(TEMPLATE_NS_ID, "linear", true);
  1712. this.id = attributes.id || "";
  1713. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  1714. this.use = attributes.use || "";
  1715. this.usehref = attributes.usehref || "";
  1716. this.color = null;
  1717. this.extras = null;
  1718. }
  1719. [_xfa_object.$toStyle](startColor) {
  1720. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  1721. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  1722. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  1723. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  1724. }
  1725. }
  1726. class LockDocument extends _xfa_object.ContentObject {
  1727. constructor(attributes) {
  1728. super(TEMPLATE_NS_ID, "lockDocument");
  1729. this.id = attributes.id || "";
  1730. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  1731. this.use = attributes.use || "";
  1732. this.usehref = attributes.usehref || "";
  1733. }
  1734. [_xfa_object.$finalize]() {
  1735. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  1736. }
  1737. }
  1738. class Manifest extends _xfa_object.XFAObject {
  1739. constructor(attributes) {
  1740. super(TEMPLATE_NS_ID, "manifest", true);
  1741. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  1742. this.id = attributes.id || "";
  1743. this.name = attributes.name || "";
  1744. this.use = attributes.use || "";
  1745. this.usehref = attributes.usehref || "";
  1746. this.extras = null;
  1747. this.ref = new _xfa_object.XFAObjectArray();
  1748. }
  1749. }
  1750. class Margin extends _xfa_object.XFAObject {
  1751. constructor(attributes) {
  1752. super(TEMPLATE_NS_ID, "margin", true);
  1753. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  1754. this.id = attributes.id || "";
  1755. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  1756. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  1757. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  1758. this.use = attributes.use || "";
  1759. this.usehref = attributes.usehref || "";
  1760. this.extras = null;
  1761. }
  1762. [_xfa_object.$toStyle]() {
  1763. return {
  1764. marginLeft: (0, _html_utils.measureToString)(this.leftInset),
  1765. marginRight: (0, _html_utils.measureToString)(this.rightInset),
  1766. marginTop: (0, _html_utils.measureToString)(this.topInset),
  1767. marginBottom: (0, _html_utils.measureToString)(this.bottomInset)
  1768. };
  1769. }
  1770. }
  1771. class Mdp extends _xfa_object.XFAObject {
  1772. constructor(attributes) {
  1773. super(TEMPLATE_NS_ID, "mdp");
  1774. this.id = attributes.id || "";
  1775. this.permissions = (0, _utils.getInteger)({
  1776. data: attributes.permissions,
  1777. defaultValue: 2,
  1778. validate: x => x === 1 || x === 3
  1779. });
  1780. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  1781. this.use = attributes.use || "";
  1782. this.usehref = attributes.usehref || "";
  1783. }
  1784. }
  1785. class Medium extends _xfa_object.XFAObject {
  1786. constructor(attributes) {
  1787. super(TEMPLATE_NS_ID, "medium");
  1788. this.id = attributes.id || "";
  1789. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  1790. this.long = (0, _utils.getMeasurement)(attributes.long);
  1791. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  1792. this.short = (0, _utils.getMeasurement)(attributes.short);
  1793. this.stock = attributes.stock || "";
  1794. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  1795. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  1796. this.use = attributes.use || "";
  1797. this.usehref = attributes.usehref || "";
  1798. }
  1799. }
  1800. class Message extends _xfa_object.XFAObject {
  1801. constructor(attributes) {
  1802. super(TEMPLATE_NS_ID, "message", true);
  1803. this.id = attributes.id || "";
  1804. this.use = attributes.use || "";
  1805. this.usehref = attributes.usehref || "";
  1806. this.text = new _xfa_object.XFAObjectArray();
  1807. }
  1808. }
  1809. class NumericEdit extends _xfa_object.XFAObject {
  1810. constructor(attributes) {
  1811. super(TEMPLATE_NS_ID, "numericEdit", true);
  1812. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  1813. this.id = attributes.id || "";
  1814. this.use = attributes.use || "";
  1815. this.usehref = attributes.usehref || "";
  1816. this.border = null;
  1817. this.comb = null;
  1818. this.extras = null;
  1819. this.margin = null;
  1820. }
  1821. [_xfa_object.$toHTML]() {
  1822. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  1823. const html = {
  1824. name: "input",
  1825. attributes: {
  1826. type: "text",
  1827. class: "xfaTextfield",
  1828. style
  1829. }
  1830. };
  1831. return {
  1832. name: "label",
  1833. attributes: {
  1834. class: "xfaLabel"
  1835. },
  1836. children: [html]
  1837. };
  1838. }
  1839. }
  1840. class Occur extends _xfa_object.XFAObject {
  1841. constructor(attributes) {
  1842. super(TEMPLATE_NS_ID, "occur", true);
  1843. this.id = attributes.id || "";
  1844. this.initial = (0, _utils.getInteger)({
  1845. data: attributes.initial,
  1846. defaultValue: 1,
  1847. validate: x => true
  1848. });
  1849. this.max = (0, _utils.getInteger)({
  1850. data: attributes.max,
  1851. defaultValue: 1,
  1852. validate: x => true
  1853. });
  1854. this.min = (0, _utils.getInteger)({
  1855. data: attributes.min,
  1856. defaultValue: 1,
  1857. validate: x => true
  1858. });
  1859. this.use = attributes.use || "";
  1860. this.usehref = attributes.usehref || "";
  1861. this.extras = null;
  1862. }
  1863. }
  1864. class Oid extends _xfa_object.StringObject {
  1865. constructor(attributes) {
  1866. super(TEMPLATE_NS_ID, "oid");
  1867. this.id = attributes.id || "";
  1868. this.name = attributes.name || "";
  1869. this.use = attributes.use || "";
  1870. this.usehref = attributes.usehref || "";
  1871. }
  1872. }
  1873. class Oids extends _xfa_object.XFAObject {
  1874. constructor(attributes) {
  1875. super(TEMPLATE_NS_ID, "oids", true);
  1876. this.id = attributes.id || "";
  1877. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  1878. this.use = attributes.use || "";
  1879. this.usehref = attributes.usehref || "";
  1880. this.oid = new _xfa_object.XFAObjectArray();
  1881. }
  1882. }
  1883. class Overflow extends _xfa_object.XFAObject {
  1884. constructor(attributes) {
  1885. super(TEMPLATE_NS_ID, "overflow");
  1886. this.id = attributes.id || "";
  1887. this.leader = attributes.leader || "";
  1888. this.target = attributes.target || "";
  1889. this.trailer = attributes.trailer || "";
  1890. this.use = attributes.use || "";
  1891. this.usehref = attributes.usehref || "";
  1892. }
  1893. }
  1894. class PageArea extends _xfa_object.XFAObject {
  1895. constructor(attributes) {
  1896. super(TEMPLATE_NS_ID, "pageArea", true);
  1897. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  1898. this.id = attributes.id || "";
  1899. this.initialNumber = (0, _utils.getInteger)({
  1900. data: attributes.initialNumber,
  1901. defaultValue: 1,
  1902. validate: x => true
  1903. });
  1904. this.name = attributes.name || "";
  1905. this.numbered = (0, _utils.getInteger)({
  1906. data: attributes.numbered,
  1907. defaultValue: 1,
  1908. validate: x => true
  1909. });
  1910. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  1911. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  1912. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  1913. this.use = attributes.use || "";
  1914. this.usehref = attributes.usehref || "";
  1915. this.desc = null;
  1916. this.extras = null;
  1917. this.medium = null;
  1918. this.occur = null;
  1919. this.area = new _xfa_object.XFAObjectArray();
  1920. this.contentArea = new _xfa_object.XFAObjectArray();
  1921. this.draw = new _xfa_object.XFAObjectArray();
  1922. this.exclGroup = new _xfa_object.XFAObjectArray();
  1923. this.field = new _xfa_object.XFAObjectArray();
  1924. this.subform = new _xfa_object.XFAObjectArray();
  1925. }
  1926. [_xfa_object.$toHTML]() {
  1927. if (this.contentArea.children.length === 0) {
  1928. return null;
  1929. }
  1930. const children = this[_xfa_object.$childrenToHTML]({
  1931. filter: new Set(["area", "draw", "field", "subform", "contentArea"]),
  1932. include: true
  1933. });
  1934. const contentArea = children.find(node => node.attributes.class === "xfaContentarea");
  1935. const style = Object.create(null);
  1936. if (this.medium && this.medium.short && this.medium.long) {
  1937. style.width = (0, _html_utils.measureToString)(this.medium.short);
  1938. style.height = (0, _html_utils.measureToString)(this.medium.long);
  1939. } else {}
  1940. return {
  1941. name: "div",
  1942. children,
  1943. attributes: {
  1944. id: this[_xfa_object.$uid],
  1945. style
  1946. },
  1947. contentArea
  1948. };
  1949. }
  1950. }
  1951. class PageSet extends _xfa_object.XFAObject {
  1952. constructor(attributes) {
  1953. super(TEMPLATE_NS_ID, "pageSet", true);
  1954. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  1955. this.id = attributes.id || "";
  1956. this.name = attributes.name || "";
  1957. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  1958. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  1959. this.use = attributes.use || "";
  1960. this.usehref = attributes.usehref || "";
  1961. this.extras = null;
  1962. this.occur = null;
  1963. this.pageArea = new _xfa_object.XFAObjectArray();
  1964. this.pageSet = new _xfa_object.XFAObjectArray();
  1965. }
  1966. [_xfa_object.$toHTML]() {
  1967. return {
  1968. name: "div",
  1969. children: this[_xfa_object.$childrenToHTML]({
  1970. filter: new Set(["pageArea", "pageSet"]),
  1971. include: true
  1972. }),
  1973. attributes: {
  1974. id: this[_xfa_object.$uid]
  1975. }
  1976. };
  1977. }
  1978. }
  1979. class Para extends _xfa_object.XFAObject {
  1980. constructor(attributes) {
  1981. super(TEMPLATE_NS_ID, "para", true);
  1982. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  1983. this.id = attributes.id || "";
  1984. this.lineHeight = (0, _utils.getMeasurement)(attributes.lineHeight, "0pt");
  1985. this.marginLeft = (0, _utils.getMeasurement)(attributes.marginLeft, "0");
  1986. this.marginRight = (0, _utils.getMeasurement)(attributes.marginRight, "0");
  1987. this.orphans = (0, _utils.getInteger)({
  1988. data: attributes.orphans,
  1989. defaultValue: 0,
  1990. validate: x => x >= 0
  1991. });
  1992. this.preserve = attributes.preserve || "";
  1993. this.radixOffset = (0, _utils.getMeasurement)(attributes.radixOffset, "0");
  1994. this.spaceAbove = (0, _utils.getMeasurement)(attributes.spaceAbove, "0");
  1995. this.spaceBelow = (0, _utils.getMeasurement)(attributes.spaceBelow, "0");
  1996. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : null;
  1997. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  1998. this.textIndent = (0, _utils.getMeasurement)(attributes.textIndent, "0");
  1999. this.use = attributes.use || "";
  2000. this.usehref = attributes.usehref || "";
  2001. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  2002. this.widows = (0, _utils.getInteger)({
  2003. data: attributes.widows,
  2004. defaultValue: 0,
  2005. validate: x => x >= 0
  2006. });
  2007. this.hyphenation = null;
  2008. }
  2009. [_xfa_object.$toHTML]() {
  2010. const style = {
  2011. marginLeft: (0, _html_utils.measureToString)(this.marginLeft),
  2012. marginRight: (0, _html_utils.measureToString)(this.marginRight),
  2013. paddingTop: (0, _html_utils.measureToString)(this.spaceAbove),
  2014. paddingBottom: (0, _html_utils.measureToString)(this.spaceBelow),
  2015. textIndent: (0, _html_utils.measureToString)(this.textIndent),
  2016. verticalAlign: this.vAlign
  2017. };
  2018. if (this.lineHeight.value >= 0) {
  2019. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  2020. }
  2021. if (this.tabDefault) {
  2022. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  2023. }
  2024. if (this.tabStops.length > 0) {}
  2025. if (this.hyphenatation) {
  2026. Object.assign(style, this.hyphenatation[_xfa_object.$toHTML]());
  2027. }
  2028. return style;
  2029. }
  2030. }
  2031. class PasswordEdit extends _xfa_object.XFAObject {
  2032. constructor(attributes) {
  2033. super(TEMPLATE_NS_ID, "passwordEdit", true);
  2034. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  2035. this.id = attributes.id || "";
  2036. this.passwordChar = attributes.passwordChar || "*";
  2037. this.use = attributes.use || "";
  2038. this.usehref = attributes.usehref || "";
  2039. this.border = null;
  2040. this.extras = null;
  2041. this.margin = null;
  2042. }
  2043. }
  2044. class Pattern extends _xfa_object.XFAObject {
  2045. constructor(attributes) {
  2046. super(TEMPLATE_NS_ID, "pattern", true);
  2047. this.id = attributes.id || "";
  2048. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  2049. this.use = attributes.use || "";
  2050. this.usehref = attributes.usehref || "";
  2051. this.color = null;
  2052. this.extras = null;
  2053. }
  2054. [_xfa_object.$toStyle](startColor) {
  2055. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  2056. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  2057. const width = 5;
  2058. const cmd = "repeating-linear-gradient";
  2059. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  2060. switch (this.type) {
  2061. case "crossHatch":
  2062. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  2063. case "crossDiagonal":
  2064. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  2065. case "diagonalLeft":
  2066. return `${cmd}(45deg,${colors})`;
  2067. case "diagonalRight":
  2068. return `${cmd}(-45deg,${colors})`;
  2069. case "horizontal":
  2070. return `${cmd}(to top,${colors})`;
  2071. case "vertical":
  2072. return `${cmd}(to right,${colors})`;
  2073. }
  2074. return "";
  2075. }
  2076. }
  2077. class Picture extends _xfa_object.StringObject {
  2078. constructor(attributes) {
  2079. super(TEMPLATE_NS_ID, "picture");
  2080. this.id = attributes.id || "";
  2081. this.use = attributes.use || "";
  2082. this.usehref = attributes.usehref || "";
  2083. }
  2084. }
  2085. class Proto extends _xfa_object.XFAObject {
  2086. constructor(attributes) {
  2087. super(TEMPLATE_NS_ID, "proto", true);
  2088. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  2089. this.arc = new _xfa_object.XFAObjectArray();
  2090. this.area = new _xfa_object.XFAObjectArray();
  2091. this.assist = new _xfa_object.XFAObjectArray();
  2092. this.barcode = new _xfa_object.XFAObjectArray();
  2093. this.bindItems = new _xfa_object.XFAObjectArray();
  2094. this.bookend = new _xfa_object.XFAObjectArray();
  2095. this.boolean = new _xfa_object.XFAObjectArray();
  2096. this.border = new _xfa_object.XFAObjectArray();
  2097. this.break = new _xfa_object.XFAObjectArray();
  2098. this.breakAfter = new _xfa_object.XFAObjectArray();
  2099. this.breakBefore = new _xfa_object.XFAObjectArray();
  2100. this.button = new _xfa_object.XFAObjectArray();
  2101. this.calculate = new _xfa_object.XFAObjectArray();
  2102. this.caption = new _xfa_object.XFAObjectArray();
  2103. this.certificate = new _xfa_object.XFAObjectArray();
  2104. this.certificates = new _xfa_object.XFAObjectArray();
  2105. this.checkButton = new _xfa_object.XFAObjectArray();
  2106. this.choiceList = new _xfa_object.XFAObjectArray();
  2107. this.color = new _xfa_object.XFAObjectArray();
  2108. this.comb = new _xfa_object.XFAObjectArray();
  2109. this.connect = new _xfa_object.XFAObjectArray();
  2110. this.contentArea = new _xfa_object.XFAObjectArray();
  2111. this.corner = new _xfa_object.XFAObjectArray();
  2112. this.date = new _xfa_object.XFAObjectArray();
  2113. this.dateTime = new _xfa_object.XFAObjectArray();
  2114. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  2115. this.decimal = new _xfa_object.XFAObjectArray();
  2116. this.defaultUi = new _xfa_object.XFAObjectArray();
  2117. this.desc = new _xfa_object.XFAObjectArray();
  2118. this.digestMethod = new _xfa_object.XFAObjectArray();
  2119. this.digestMethods = new _xfa_object.XFAObjectArray();
  2120. this.draw = new _xfa_object.XFAObjectArray();
  2121. this.edge = new _xfa_object.XFAObjectArray();
  2122. this.encoding = new _xfa_object.XFAObjectArray();
  2123. this.encodings = new _xfa_object.XFAObjectArray();
  2124. this.encrypt = new _xfa_object.XFAObjectArray();
  2125. this.encryptData = new _xfa_object.XFAObjectArray();
  2126. this.encryption = new _xfa_object.XFAObjectArray();
  2127. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  2128. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  2129. this.event = new _xfa_object.XFAObjectArray();
  2130. this.exData = new _xfa_object.XFAObjectArray();
  2131. this.exObject = new _xfa_object.XFAObjectArray();
  2132. this.exclGroup = new _xfa_object.XFAObjectArray();
  2133. this.execute = new _xfa_object.XFAObjectArray();
  2134. this.extras = new _xfa_object.XFAObjectArray();
  2135. this.field = new _xfa_object.XFAObjectArray();
  2136. this.fill = new _xfa_object.XFAObjectArray();
  2137. this.filter = new _xfa_object.XFAObjectArray();
  2138. this.float = new _xfa_object.XFAObjectArray();
  2139. this.font = new _xfa_object.XFAObjectArray();
  2140. this.format = new _xfa_object.XFAObjectArray();
  2141. this.handler = new _xfa_object.XFAObjectArray();
  2142. this.hyphenation = new _xfa_object.XFAObjectArray();
  2143. this.image = new _xfa_object.XFAObjectArray();
  2144. this.imageEdit = new _xfa_object.XFAObjectArray();
  2145. this.integer = new _xfa_object.XFAObjectArray();
  2146. this.issuers = new _xfa_object.XFAObjectArray();
  2147. this.items = new _xfa_object.XFAObjectArray();
  2148. this.keep = new _xfa_object.XFAObjectArray();
  2149. this.keyUsage = new _xfa_object.XFAObjectArray();
  2150. this.line = new _xfa_object.XFAObjectArray();
  2151. this.linear = new _xfa_object.XFAObjectArray();
  2152. this.lockDocument = new _xfa_object.XFAObjectArray();
  2153. this.manifest = new _xfa_object.XFAObjectArray();
  2154. this.margin = new _xfa_object.XFAObjectArray();
  2155. this.mdp = new _xfa_object.XFAObjectArray();
  2156. this.medium = new _xfa_object.XFAObjectArray();
  2157. this.message = new _xfa_object.XFAObjectArray();
  2158. this.numericEdit = new _xfa_object.XFAObjectArray();
  2159. this.occur = new _xfa_object.XFAObjectArray();
  2160. this.oid = new _xfa_object.XFAObjectArray();
  2161. this.oids = new _xfa_object.XFAObjectArray();
  2162. this.overflow = new _xfa_object.XFAObjectArray();
  2163. this.pageArea = new _xfa_object.XFAObjectArray();
  2164. this.pageSet = new _xfa_object.XFAObjectArray();
  2165. this.para = new _xfa_object.XFAObjectArray();
  2166. this.passwordEdit = new _xfa_object.XFAObjectArray();
  2167. this.pattern = new _xfa_object.XFAObjectArray();
  2168. this.picture = new _xfa_object.XFAObjectArray();
  2169. this.radial = new _xfa_object.XFAObjectArray();
  2170. this.reason = new _xfa_object.XFAObjectArray();
  2171. this.reasons = new _xfa_object.XFAObjectArray();
  2172. this.rectangle = new _xfa_object.XFAObjectArray();
  2173. this.ref = new _xfa_object.XFAObjectArray();
  2174. this.script = new _xfa_object.XFAObjectArray();
  2175. this.setProperty = new _xfa_object.XFAObjectArray();
  2176. this.signData = new _xfa_object.XFAObjectArray();
  2177. this.signature = new _xfa_object.XFAObjectArray();
  2178. this.signing = new _xfa_object.XFAObjectArray();
  2179. this.solid = new _xfa_object.XFAObjectArray();
  2180. this.speak = new _xfa_object.XFAObjectArray();
  2181. this.stipple = new _xfa_object.XFAObjectArray();
  2182. this.subform = new _xfa_object.XFAObjectArray();
  2183. this.subformSet = new _xfa_object.XFAObjectArray();
  2184. this.subjectDN = new _xfa_object.XFAObjectArray();
  2185. this.subjectDNs = new _xfa_object.XFAObjectArray();
  2186. this.submit = new _xfa_object.XFAObjectArray();
  2187. this.text = new _xfa_object.XFAObjectArray();
  2188. this.textEdit = new _xfa_object.XFAObjectArray();
  2189. this.time = new _xfa_object.XFAObjectArray();
  2190. this.timeStamp = new _xfa_object.XFAObjectArray();
  2191. this.toolTip = new _xfa_object.XFAObjectArray();
  2192. this.traversal = new _xfa_object.XFAObjectArray();
  2193. this.traverse = new _xfa_object.XFAObjectArray();
  2194. this.ui = new _xfa_object.XFAObjectArray();
  2195. this.validate = new _xfa_object.XFAObjectArray();
  2196. this.value = new _xfa_object.XFAObjectArray();
  2197. this.variables = new _xfa_object.XFAObjectArray();
  2198. }
  2199. }
  2200. class Radial extends _xfa_object.XFAObject {
  2201. constructor(attributes) {
  2202. super(TEMPLATE_NS_ID, "radial", true);
  2203. this.id = attributes.id || "";
  2204. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  2205. this.use = attributes.use || "";
  2206. this.usehref = attributes.usehref || "";
  2207. this.color = null;
  2208. this.extras = null;
  2209. }
  2210. [_xfa_object.$toStyle](startColor) {
  2211. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  2212. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  2213. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  2214. return `radial-gradient(circle to center, ${colors})`;
  2215. }
  2216. }
  2217. class Reason extends _xfa_object.StringObject {
  2218. constructor(attributes) {
  2219. super(TEMPLATE_NS_ID, "reason");
  2220. this.id = attributes.id || "";
  2221. this.name = attributes.name || "";
  2222. this.use = attributes.use || "";
  2223. this.usehref = attributes.usehref || "";
  2224. }
  2225. }
  2226. class Reasons extends _xfa_object.XFAObject {
  2227. constructor(attributes) {
  2228. super(TEMPLATE_NS_ID, "reasons", true);
  2229. this.id = attributes.id || "";
  2230. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  2231. this.use = attributes.use || "";
  2232. this.usehref = attributes.usehref || "";
  2233. this.reason = new _xfa_object.XFAObjectArray();
  2234. }
  2235. }
  2236. class Rectangle extends _xfa_object.XFAObject {
  2237. constructor(attributes) {
  2238. super(TEMPLATE_NS_ID, "rectangle", true);
  2239. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  2240. this.id = attributes.id || "";
  2241. this.use = attributes.use || "";
  2242. this.usehref = attributes.usehref || "";
  2243. this.corner = new _xfa_object.XFAObjectArray(4);
  2244. this.edge = new _xfa_object.XFAObjectArray(4);
  2245. this.fill = null;
  2246. }
  2247. }
  2248. class RefElement extends _xfa_object.StringObject {
  2249. constructor(attributes) {
  2250. super(TEMPLATE_NS_ID, "ref");
  2251. this.id = attributes.id || "";
  2252. this.use = attributes.use || "";
  2253. this.usehref = attributes.usehref || "";
  2254. }
  2255. }
  2256. class Script extends _xfa_object.StringObject {
  2257. constructor(attributes) {
  2258. super(TEMPLATE_NS_ID, "script");
  2259. this.binding = attributes.binding || "";
  2260. this.contentType = attributes.contentType || "";
  2261. this.id = attributes.id || "";
  2262. this.name = attributes.name || "";
  2263. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  2264. this.use = attributes.use || "";
  2265. this.usehref = attributes.usehref || "";
  2266. }
  2267. }
  2268. class SetProperty extends _xfa_object.XFAObject {
  2269. constructor(attributes) {
  2270. super(TEMPLATE_NS_ID, "setProperty");
  2271. this.connection = attributes.connection || "";
  2272. this.ref = attributes.ref || "";
  2273. this.target = attributes.target || "";
  2274. }
  2275. }
  2276. exports.SetProperty = SetProperty;
  2277. class SignData extends _xfa_object.XFAObject {
  2278. constructor(attributes) {
  2279. super(TEMPLATE_NS_ID, "signData", true);
  2280. this.id = attributes.id || "";
  2281. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  2282. this.ref = attributes.ref || "";
  2283. this.target = attributes.target || "";
  2284. this.use = attributes.use || "";
  2285. this.usehref = attributes.usehref || "";
  2286. this.filter = null;
  2287. this.manifest = null;
  2288. }
  2289. }
  2290. class Signature extends _xfa_object.XFAObject {
  2291. constructor(attributes) {
  2292. super(TEMPLATE_NS_ID, "signature", true);
  2293. this.id = attributes.id || "";
  2294. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  2295. this.use = attributes.use || "";
  2296. this.usehref = attributes.usehref || "";
  2297. this.border = null;
  2298. this.extras = null;
  2299. this.filter = null;
  2300. this.manifest = null;
  2301. this.margin = null;
  2302. }
  2303. }
  2304. class Signing extends _xfa_object.XFAObject {
  2305. constructor(attributes) {
  2306. super(TEMPLATE_NS_ID, "signing", true);
  2307. this.id = attributes.id || "";
  2308. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  2309. this.use = attributes.use || "";
  2310. this.usehref = attributes.usehref || "";
  2311. this.certificate = new _xfa_object.XFAObjectArray();
  2312. }
  2313. }
  2314. class Solid extends _xfa_object.XFAObject {
  2315. constructor(attributes) {
  2316. super(TEMPLATE_NS_ID, "solid", true);
  2317. this.id = attributes.id || "";
  2318. this.use = attributes.use || "";
  2319. this.usehref = attributes.usehref || "";
  2320. this.extras = null;
  2321. }
  2322. [_xfa_object.$toStyle](startColor) {
  2323. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  2324. }
  2325. }
  2326. class Speak extends _xfa_object.StringObject {
  2327. constructor(attributes) {
  2328. super(TEMPLATE_NS_ID, "speak");
  2329. this.disable = (0, _utils.getInteger)({
  2330. data: attributes.disable,
  2331. defaultValue: 0,
  2332. validate: x => x === 1
  2333. });
  2334. this.id = attributes.id || "";
  2335. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  2336. this.rid = attributes.rid || "";
  2337. this.use = attributes.use || "";
  2338. this.usehref = attributes.usehref || "";
  2339. }
  2340. }
  2341. class Stipple extends _xfa_object.XFAObject {
  2342. constructor(attributes) {
  2343. super(TEMPLATE_NS_ID, "stipple", true);
  2344. this.id = attributes.id || "";
  2345. this.rate = (0, _utils.getInteger)({
  2346. data: attributes.rate,
  2347. defaultValue: 50,
  2348. validate: x => x >= 0 && x <= 100
  2349. });
  2350. this.use = attributes.use || "";
  2351. this.usehref = attributes.usehref || "";
  2352. this.color = null;
  2353. this.extras = null;
  2354. }
  2355. [_xfa_object.$toStyle](bgColor) {
  2356. const alpha = this.rate / 100;
  2357. 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));
  2358. }
  2359. }
  2360. class Subform extends _xfa_object.XFAObject {
  2361. constructor(attributes) {
  2362. super(TEMPLATE_NS_ID, "subform", true);
  2363. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  2364. this.allowMacro = (0, _utils.getInteger)({
  2365. data: attributes.allowMacro,
  2366. defaultValue: 0,
  2367. validate: x => x === 1
  2368. });
  2369. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  2370. this.colSpan = (0, _utils.getInteger)({
  2371. data: attributes.colSpan,
  2372. defaultValue: 1,
  2373. validate: x => x >= 1
  2374. });
  2375. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  2376. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  2377. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  2378. this.id = attributes.id || "";
  2379. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  2380. this.locale = attributes.locale || "";
  2381. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  2382. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  2383. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  2384. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  2385. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  2386. this.name = attributes.name || "";
  2387. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  2388. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  2389. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  2390. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  2391. this.use = attributes.use || "";
  2392. this.usehref = attributes.usehref || "";
  2393. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  2394. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  2395. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  2396. this.assist = null;
  2397. this.bind = null;
  2398. this.bookend = null;
  2399. this.border = null;
  2400. this.break = null;
  2401. this.calculate = null;
  2402. this.desc = null;
  2403. this.extras = null;
  2404. this.keep = null;
  2405. this.margin = null;
  2406. this.occur = null;
  2407. this.overflow = null;
  2408. this.pageSet = null;
  2409. this.para = null;
  2410. this.traversal = null;
  2411. this.validate = null;
  2412. this.variables = null;
  2413. this.area = new _xfa_object.XFAObjectArray();
  2414. this.breakAfter = new _xfa_object.XFAObjectArray();
  2415. this.breakBefore = new _xfa_object.XFAObjectArray();
  2416. this.connect = new _xfa_object.XFAObjectArray();
  2417. this.draw = new _xfa_object.XFAObjectArray();
  2418. this.event = new _xfa_object.XFAObjectArray();
  2419. this.exObject = new _xfa_object.XFAObjectArray();
  2420. this.exclGroup = new _xfa_object.XFAObjectArray();
  2421. this.field = new _xfa_object.XFAObjectArray();
  2422. this.proto = new _xfa_object.XFAObjectArray();
  2423. this.setProperty = new _xfa_object.XFAObjectArray();
  2424. this.subform = new _xfa_object.XFAObjectArray();
  2425. this.subformSet = new _xfa_object.XFAObjectArray();
  2426. }
  2427. [_xfa_object.$toHTML]() {
  2428. this[_xfa_object.$extra] = Object.create(null);
  2429. const parent = this[_xfa_object.$getParent]();
  2430. let page = null;
  2431. if (parent[_xfa_object.$nodeName] === "template") {
  2432. if (this.pageSet !== null) {
  2433. this[_xfa_object.$extra].pageNumber = 0;
  2434. } else {
  2435. (0, _util.warn)("XFA - No pageSet in root subform");
  2436. }
  2437. } else if (parent[_xfa_object.$extra] && parent[_xfa_object.$extra].pageNumber !== undefined) {
  2438. const pageNumber = parent[_xfa_object.$extra].pageNumber;
  2439. const pageAreas = parent.pageSet.pageArea.children;
  2440. parent[_xfa_object.$extra].pageNumber = (parent[_xfa_object.$extra].pageNumber + 1) % pageAreas.length;
  2441. page = pageAreas[pageNumber][_xfa_object.$toHTML]();
  2442. }
  2443. const style = (0, _html_utils.toStyle)(this, "dimensions", "position", "presence");
  2444. const clazz = ["xfaSubform"];
  2445. const cl = (0, _html_utils.layoutClass)(this);
  2446. if (cl) {
  2447. clazz.push(cl);
  2448. }
  2449. const attributes = {
  2450. style,
  2451. id: this[_xfa_object.$uid],
  2452. class: clazz.join(" ")
  2453. };
  2454. if (this.name) {
  2455. attributes.xfaName = this.name;
  2456. }
  2457. const children = this[_xfa_object.$childrenToHTML]({
  2458. filter: new Set(["area", "draw", "field", "subform", "subformSet"]),
  2459. include: true
  2460. });
  2461. const html = {
  2462. name: "div",
  2463. attributes,
  2464. children
  2465. };
  2466. if (page) {
  2467. page.contentArea.children.push(html);
  2468. delete page.contentArea;
  2469. return page;
  2470. }
  2471. return html;
  2472. }
  2473. }
  2474. class SubformSet extends _xfa_object.XFAObject {
  2475. constructor(attributes) {
  2476. super(TEMPLATE_NS_ID, "subformSet", true);
  2477. this.id = attributes.id || "";
  2478. this.name = attributes.name || "";
  2479. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  2480. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  2481. this.use = attributes.use || "";
  2482. this.usehref = attributes.usehref || "";
  2483. this.bookend = null;
  2484. this.break = null;
  2485. this.desc = null;
  2486. this.extras = null;
  2487. this.occur = null;
  2488. this.overflow = null;
  2489. this.breakAfter = new _xfa_object.XFAObjectArray();
  2490. this.breakBefore = new _xfa_object.XFAObjectArray();
  2491. this.subform = new _xfa_object.XFAObjectArray();
  2492. this.subformSet = new _xfa_object.XFAObjectArray();
  2493. }
  2494. }
  2495. class SubjectDN extends _xfa_object.ContentObject {
  2496. constructor(attributes) {
  2497. super(TEMPLATE_NS_ID, "subjectDN");
  2498. this.delimiter = attributes.delimiter || ",";
  2499. this.id = attributes.id || "";
  2500. this.name = attributes.name || "";
  2501. this.use = attributes.use || "";
  2502. this.usehref = attributes.usehref || "";
  2503. }
  2504. [_xfa_object.$finalize]() {
  2505. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  2506. kv = kv.split("=", 2);
  2507. kv[0] = kv[0].trim();
  2508. return kv;
  2509. }));
  2510. }
  2511. }
  2512. class SubjectDNs extends _xfa_object.XFAObject {
  2513. constructor(attributes) {
  2514. super(TEMPLATE_NS_ID, "subjectDNs", true);
  2515. this.id = attributes.id || "";
  2516. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  2517. this.use = attributes.use || "";
  2518. this.usehref = attributes.usehref || "";
  2519. this.subjectDN = new _xfa_object.XFAObjectArray();
  2520. }
  2521. }
  2522. class Submit extends _xfa_object.XFAObject {
  2523. constructor(attributes) {
  2524. super(TEMPLATE_NS_ID, "submit", true);
  2525. this.embedPDF = (0, _utils.getInteger)({
  2526. data: attributes.embedPDF,
  2527. defaultValue: 0,
  2528. validate: x => x === 1
  2529. });
  2530. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  2531. this.id = attributes.id || "";
  2532. this.target = attributes.target || "";
  2533. this.textEncoding = (0, _utils.getKeyword)({
  2534. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  2535. defaultValue: "",
  2536. 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-[0-9]{2}/)
  2537. });
  2538. this.use = attributes.use || "";
  2539. this.usehref = attributes.usehref || "";
  2540. this.xdpContent = attributes.xdpContent || "";
  2541. this.encrypt = null;
  2542. this.encryptData = new _xfa_object.XFAObjectArray();
  2543. this.signData = new _xfa_object.XFAObjectArray();
  2544. }
  2545. }
  2546. class Template extends _xfa_object.XFAObject {
  2547. constructor(attributes) {
  2548. super(TEMPLATE_NS_ID, "template", true);
  2549. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  2550. this.extras = null;
  2551. this.subform = new _xfa_object.XFAObjectArray();
  2552. }
  2553. [_xfa_object.$finalize]() {
  2554. if (this.subform.children.length === 0) {
  2555. (0, _util.warn)("XFA - No subforms in template node.");
  2556. }
  2557. if (this.subform.children.length >= 2) {
  2558. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  2559. }
  2560. }
  2561. [_xfa_object.$toHTML]() {
  2562. if (this.subform.children.length > 0) {
  2563. return this.subform.children[0][_xfa_object.$toHTML]();
  2564. }
  2565. return {
  2566. name: "div",
  2567. children: []
  2568. };
  2569. }
  2570. }
  2571. exports.Template = Template;
  2572. class Text extends _xfa_object.ContentObject {
  2573. constructor(attributes) {
  2574. super(TEMPLATE_NS_ID, "text");
  2575. this.id = attributes.id || "";
  2576. this.maxChars = (0, _utils.getInteger)({
  2577. data: attributes.maxChars,
  2578. defaultValue: 0,
  2579. validate: x => x >= 0
  2580. });
  2581. this.name = attributes.name || "";
  2582. this.rid = attributes.rid || "";
  2583. this.use = attributes.use || "";
  2584. this.usehref = attributes.usehref || "";
  2585. }
  2586. [_xfa_object.$onChild](child) {
  2587. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  2588. this[_xfa_object.$content] = child;
  2589. return true;
  2590. }
  2591. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  2592. return false;
  2593. }
  2594. [_xfa_object.$toHTML]() {
  2595. if (typeof this[_xfa_object.$content] === "string") {
  2596. return this[_xfa_object.$content];
  2597. }
  2598. return this[_xfa_object.$content][_xfa_object.$toHTML]();
  2599. }
  2600. }
  2601. exports.Text = Text;
  2602. class TextEdit extends _xfa_object.XFAObject {
  2603. constructor(attributes) {
  2604. super(TEMPLATE_NS_ID, "textEdit", true);
  2605. this.allowRichText = (0, _utils.getInteger)({
  2606. data: attributes.allowRichText,
  2607. defaultValue: 0,
  2608. validate: x => x === 1
  2609. });
  2610. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  2611. this.id = attributes.id || "";
  2612. this.multiLine = (0, _utils.getInteger)({
  2613. data: attributes.multiLine,
  2614. defaultValue: 1,
  2615. validate: x => x === 0
  2616. });
  2617. this.use = attributes.use || "";
  2618. this.usehref = attributes.usehref || "";
  2619. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  2620. this.border = null;
  2621. this.comb = null;
  2622. this.extras = null;
  2623. this.margin = null;
  2624. }
  2625. [_xfa_object.$toHTML]() {
  2626. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  2627. let html;
  2628. if (this.multiline === 1) {
  2629. html = {
  2630. name: "textarea",
  2631. attributes: {
  2632. style
  2633. }
  2634. };
  2635. } else {
  2636. html = {
  2637. name: "input",
  2638. attributes: {
  2639. type: "text",
  2640. class: "xfaTextfield",
  2641. style
  2642. }
  2643. };
  2644. }
  2645. return {
  2646. name: "label",
  2647. attributes: {
  2648. class: "xfaLabel"
  2649. },
  2650. children: [html]
  2651. };
  2652. }
  2653. }
  2654. class Time extends _xfa_object.StringObject {
  2655. constructor(attributes) {
  2656. super(TEMPLATE_NS_ID, "time");
  2657. this.id = attributes.id || "";
  2658. this.name = attributes.name || "";
  2659. this.use = attributes.use || "";
  2660. this.usehref = attributes.usehref || "";
  2661. }
  2662. [_xfa_object.$finalize]() {
  2663. this[_xfa_object.$content] = new Date(this[_xfa_object.$content]);
  2664. }
  2665. [_xfa_object.$toHTML]() {
  2666. return this[_xfa_object.$content].toString();
  2667. }
  2668. }
  2669. class TimeStamp extends _xfa_object.XFAObject {
  2670. constructor(attributes) {
  2671. super(TEMPLATE_NS_ID, "timeStamp");
  2672. this.id = attributes.id || "";
  2673. this.server = attributes.server || "";
  2674. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  2675. this.use = attributes.use || "";
  2676. this.usehref = attributes.usehref || "";
  2677. }
  2678. }
  2679. class ToolTip extends _xfa_object.StringObject {
  2680. constructor(attributes) {
  2681. super(TEMPLATE_NS_ID, "toolTip");
  2682. this.id = attributes.id || "";
  2683. this.rid = attributes.rid || "";
  2684. this.use = attributes.use || "";
  2685. this.usehref = attributes.usehref || "";
  2686. }
  2687. }
  2688. class Traversal extends _xfa_object.XFAObject {
  2689. constructor(attributes) {
  2690. super(TEMPLATE_NS_ID, "traversal", true);
  2691. this.id = attributes.id || "";
  2692. this.use = attributes.use || "";
  2693. this.usehref = attributes.usehref || "";
  2694. this.extras = null;
  2695. this.traverse = new _xfa_object.XFAObjectArray();
  2696. }
  2697. }
  2698. class Traverse extends _xfa_object.XFAObject {
  2699. constructor(attributes) {
  2700. super(TEMPLATE_NS_ID, "traverse", true);
  2701. this.id = attributes.id || "";
  2702. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  2703. this.ref = attributes.ref || "";
  2704. this.use = attributes.use || "";
  2705. this.usehref = attributes.usehref || "";
  2706. this.extras = null;
  2707. this.script = null;
  2708. }
  2709. get name() {
  2710. return this.operation;
  2711. }
  2712. [_xfa_object.$isTransparent]() {
  2713. return false;
  2714. }
  2715. }
  2716. class Ui extends _xfa_object.XFAObject {
  2717. constructor(attributes) {
  2718. super(TEMPLATE_NS_ID, "ui", true);
  2719. this.id = attributes.id || "";
  2720. this.use = attributes.use || "";
  2721. this.usehref = attributes.usehref || "";
  2722. this.extras = null;
  2723. this.picture = null;
  2724. this.barcode = null;
  2725. this.button = null;
  2726. this.checkButton = null;
  2727. this.choiceList = null;
  2728. this.dateTimeEdit = null;
  2729. this.defaultUi = null;
  2730. this.imageEdit = null;
  2731. this.numericEdit = null;
  2732. this.passwordEdit = null;
  2733. this.signature = null;
  2734. this.textEdit = null;
  2735. }
  2736. [_xfa_object.$toHTML]() {
  2737. for (const name of Object.getOwnPropertyNames(this)) {
  2738. if (name === "extras" || name === "picture") {
  2739. continue;
  2740. }
  2741. const obj = this[name];
  2742. if (!(obj instanceof _xfa_object.XFAObject)) {
  2743. continue;
  2744. }
  2745. return obj[_xfa_object.$toHTML]();
  2746. }
  2747. return null;
  2748. }
  2749. }
  2750. class Validate extends _xfa_object.XFAObject {
  2751. constructor(attributes) {
  2752. super(TEMPLATE_NS_ID, "validate", true);
  2753. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  2754. this.id = attributes.id || "";
  2755. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  2756. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  2757. this.use = attributes.use || "";
  2758. this.usehref = attributes.usehref || "";
  2759. this.extras = null;
  2760. this.message = null;
  2761. this.picture = null;
  2762. this.script = null;
  2763. }
  2764. }
  2765. class Value extends _xfa_object.XFAObject {
  2766. constructor(attributes) {
  2767. super(TEMPLATE_NS_ID, "value", true);
  2768. this.id = attributes.id || "";
  2769. this.override = (0, _utils.getInteger)({
  2770. data: attributes.override,
  2771. defaultValue: 0,
  2772. validate: x => x === 1
  2773. });
  2774. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  2775. this.use = attributes.use || "";
  2776. this.usehref = attributes.usehref || "";
  2777. this.arc = null;
  2778. this.boolean = null;
  2779. this.date = null;
  2780. this.dateTime = null;
  2781. this.decimal = null;
  2782. this.exData = null;
  2783. this.float = null;
  2784. this.image = null;
  2785. this.integer = null;
  2786. this.line = null;
  2787. this.rectangle = null;
  2788. this.text = null;
  2789. this.time = null;
  2790. }
  2791. [_xfa_object.$setValue](value) {
  2792. const valueName = value[_xfa_object.$nodeName];
  2793. if (this[valueName] !== null) {
  2794. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  2795. return;
  2796. }
  2797. for (const name of Object.getOwnPropertyNames(this)) {
  2798. const obj = this[name];
  2799. if (obj instanceof _xfa_object.XFAObject) {
  2800. this[name] = null;
  2801. this[_xfa_object.$removeChild](obj);
  2802. }
  2803. }
  2804. this[value[_xfa_object.$nodeName]] = value;
  2805. this[_xfa_object.$appendChild](value);
  2806. }
  2807. [_xfa_object.$toHTML]() {
  2808. for (const name of Object.getOwnPropertyNames(this)) {
  2809. const obj = this[name];
  2810. if (!(obj instanceof _xfa_object.XFAObject)) {
  2811. continue;
  2812. }
  2813. return obj[_xfa_object.$toHTML]();
  2814. }
  2815. return null;
  2816. }
  2817. }
  2818. exports.Value = Value;
  2819. class Variables extends _xfa_object.XFAObject {
  2820. constructor(attributes) {
  2821. super(TEMPLATE_NS_ID, "variables", true);
  2822. this.id = attributes.id || "";
  2823. this.use = attributes.use || "";
  2824. this.usehref = attributes.usehref || "";
  2825. this.boolean = new _xfa_object.XFAObjectArray();
  2826. this.date = new _xfa_object.XFAObjectArray();
  2827. this.dateTime = new _xfa_object.XFAObjectArray();
  2828. this.decimal = new _xfa_object.XFAObjectArray();
  2829. this.exData = new _xfa_object.XFAObjectArray();
  2830. this.float = new _xfa_object.XFAObjectArray();
  2831. this.image = new _xfa_object.XFAObjectArray();
  2832. this.integer = new _xfa_object.XFAObjectArray();
  2833. this.manifest = new _xfa_object.XFAObjectArray();
  2834. this.script = new _xfa_object.XFAObjectArray();
  2835. this.text = new _xfa_object.XFAObjectArray();
  2836. this.time = new _xfa_object.XFAObjectArray();
  2837. }
  2838. [_xfa_object.$isTransparent]() {
  2839. return true;
  2840. }
  2841. }
  2842. class TemplateNamespace {
  2843. static [_namespaces.$buildXFAObject](name, attributes) {
  2844. if (TemplateNamespace.hasOwnProperty(name)) {
  2845. const node = TemplateNamespace[name](attributes);
  2846. node[_xfa_object.$setSetAttributes](attributes);
  2847. return node;
  2848. }
  2849. return undefined;
  2850. }
  2851. static appearanceFilter(attrs) {
  2852. return new AppearanceFilter(attrs);
  2853. }
  2854. static arc(attrs) {
  2855. return new Arc(attrs);
  2856. }
  2857. static area(attrs) {
  2858. return new Area(attrs);
  2859. }
  2860. static assist(attrs) {
  2861. return new Assist(attrs);
  2862. }
  2863. static barcode(attrs) {
  2864. return new Barcode(attrs);
  2865. }
  2866. static bind(attrs) {
  2867. return new Bind(attrs);
  2868. }
  2869. static bindItems(attrs) {
  2870. return new BindItems(attrs);
  2871. }
  2872. static bookend(attrs) {
  2873. return new Bookend(attrs);
  2874. }
  2875. static boolean(attrs) {
  2876. return new BooleanElement(attrs);
  2877. }
  2878. static border(attrs) {
  2879. return new Border(attrs);
  2880. }
  2881. static break(attrs) {
  2882. return new Break(attrs);
  2883. }
  2884. static breakAfter(attrs) {
  2885. return new BreakAfter(attrs);
  2886. }
  2887. static breakBefore(attrs) {
  2888. return new BreakBefore(attrs);
  2889. }
  2890. static button(attrs) {
  2891. return new Button(attrs);
  2892. }
  2893. static calculate(attrs) {
  2894. return new Calculate(attrs);
  2895. }
  2896. static caption(attrs) {
  2897. return new Caption(attrs);
  2898. }
  2899. static certificate(attrs) {
  2900. return new Certificate(attrs);
  2901. }
  2902. static certificates(attrs) {
  2903. return new Certificates(attrs);
  2904. }
  2905. static checkButton(attrs) {
  2906. return new CheckButton(attrs);
  2907. }
  2908. static choiceList(attrs) {
  2909. return new ChoiceList(attrs);
  2910. }
  2911. static color(attrs) {
  2912. return new Color(attrs);
  2913. }
  2914. static comb(attrs) {
  2915. return new Comb(attrs);
  2916. }
  2917. static connect(attrs) {
  2918. return new Connect(attrs);
  2919. }
  2920. static contentArea(attrs) {
  2921. return new ContentArea(attrs);
  2922. }
  2923. static corner(attrs) {
  2924. return new Corner(attrs);
  2925. }
  2926. static date(attrs) {
  2927. return new DateElement(attrs);
  2928. }
  2929. static dateTime(attrs) {
  2930. return new DateTime(attrs);
  2931. }
  2932. static dateTimeEdit(attrs) {
  2933. return new DateTimeEdit(attrs);
  2934. }
  2935. static decimal(attrs) {
  2936. return new Decimal(attrs);
  2937. }
  2938. static defaultUi(attrs) {
  2939. return new DefaultUi(attrs);
  2940. }
  2941. static desc(attrs) {
  2942. return new Desc(attrs);
  2943. }
  2944. static digestMethod(attrs) {
  2945. return new DigestMethod(attrs);
  2946. }
  2947. static digestMethods(attrs) {
  2948. return new DigestMethods(attrs);
  2949. }
  2950. static draw(attrs) {
  2951. return new Draw(attrs);
  2952. }
  2953. static edge(attrs) {
  2954. return new Edge(attrs);
  2955. }
  2956. static encoding(attrs) {
  2957. return new Encoding(attrs);
  2958. }
  2959. static encodings(attrs) {
  2960. return new Encodings(attrs);
  2961. }
  2962. static encrypt(attrs) {
  2963. return new Encrypt(attrs);
  2964. }
  2965. static encryptData(attrs) {
  2966. return new EncryptData(attrs);
  2967. }
  2968. static encryption(attrs) {
  2969. return new Encryption(attrs);
  2970. }
  2971. static encryptionMethod(attrs) {
  2972. return new EncryptionMethod(attrs);
  2973. }
  2974. static encryptionMethods(attrs) {
  2975. return new EncryptionMethods(attrs);
  2976. }
  2977. static event(attrs) {
  2978. return new Event(attrs);
  2979. }
  2980. static exData(attrs) {
  2981. return new ExData(attrs);
  2982. }
  2983. static exObject(attrs) {
  2984. return new ExObject(attrs);
  2985. }
  2986. static exclGroup(attrs) {
  2987. return new ExclGroup(attrs);
  2988. }
  2989. static execute(attrs) {
  2990. return new Execute(attrs);
  2991. }
  2992. static extras(attrs) {
  2993. return new Extras(attrs);
  2994. }
  2995. static field(attrs) {
  2996. return new Field(attrs);
  2997. }
  2998. static fill(attrs) {
  2999. return new Fill(attrs);
  3000. }
  3001. static filter(attrs) {
  3002. return new Filter(attrs);
  3003. }
  3004. static float(attrs) {
  3005. return new Float(attrs);
  3006. }
  3007. static font(attrs) {
  3008. return new Font(attrs);
  3009. }
  3010. static format(attrs) {
  3011. return new Format(attrs);
  3012. }
  3013. static handler(attrs) {
  3014. return new Handler(attrs);
  3015. }
  3016. static hyphenation(attrs) {
  3017. return new Hyphenation(attrs);
  3018. }
  3019. static image(attrs) {
  3020. return new Image(attrs);
  3021. }
  3022. static imageEdit(attrs) {
  3023. return new ImageEdit(attrs);
  3024. }
  3025. static integer(attrs) {
  3026. return new Integer(attrs);
  3027. }
  3028. static issuers(attrs) {
  3029. return new Issuers(attrs);
  3030. }
  3031. static items(attrs) {
  3032. return new Items(attrs);
  3033. }
  3034. static keep(attrs) {
  3035. return new Keep(attrs);
  3036. }
  3037. static keyUsage(attrs) {
  3038. return new KeyUsage(attrs);
  3039. }
  3040. static line(attrs) {
  3041. return new Line(attrs);
  3042. }
  3043. static linear(attrs) {
  3044. return new Linear(attrs);
  3045. }
  3046. static lockDocument(attrs) {
  3047. return new LockDocument(attrs);
  3048. }
  3049. static manifest(attrs) {
  3050. return new Manifest(attrs);
  3051. }
  3052. static margin(attrs) {
  3053. return new Margin(attrs);
  3054. }
  3055. static mdp(attrs) {
  3056. return new Mdp(attrs);
  3057. }
  3058. static medium(attrs) {
  3059. return new Medium(attrs);
  3060. }
  3061. static message(attrs) {
  3062. return new Message(attrs);
  3063. }
  3064. static numericEdit(attrs) {
  3065. return new NumericEdit(attrs);
  3066. }
  3067. static occur(attrs) {
  3068. return new Occur(attrs);
  3069. }
  3070. static oid(attrs) {
  3071. return new Oid(attrs);
  3072. }
  3073. static oids(attrs) {
  3074. return new Oids(attrs);
  3075. }
  3076. static overflow(attrs) {
  3077. return new Overflow(attrs);
  3078. }
  3079. static pageArea(attrs) {
  3080. return new PageArea(attrs);
  3081. }
  3082. static pageSet(attrs) {
  3083. return new PageSet(attrs);
  3084. }
  3085. static para(attrs) {
  3086. return new Para(attrs);
  3087. }
  3088. static passwordEdit(attrs) {
  3089. return new PasswordEdit(attrs);
  3090. }
  3091. static pattern(attrs) {
  3092. return new Pattern(attrs);
  3093. }
  3094. static picture(attrs) {
  3095. return new Picture(attrs);
  3096. }
  3097. static proto(attrs) {
  3098. return new Proto(attrs);
  3099. }
  3100. static radial(attrs) {
  3101. return new Radial(attrs);
  3102. }
  3103. static reason(attrs) {
  3104. return new Reason(attrs);
  3105. }
  3106. static reasons(attrs) {
  3107. return new Reasons(attrs);
  3108. }
  3109. static rectangle(attrs) {
  3110. return new Rectangle(attrs);
  3111. }
  3112. static ref(attrs) {
  3113. return new RefElement(attrs);
  3114. }
  3115. static script(attrs) {
  3116. return new Script(attrs);
  3117. }
  3118. static setProperty(attrs) {
  3119. return new SetProperty(attrs);
  3120. }
  3121. static signData(attrs) {
  3122. return new SignData(attrs);
  3123. }
  3124. static signature(attrs) {
  3125. return new Signature(attrs);
  3126. }
  3127. static signing(attrs) {
  3128. return new Signing(attrs);
  3129. }
  3130. static solid(attrs) {
  3131. return new Solid(attrs);
  3132. }
  3133. static speak(attrs) {
  3134. return new Speak(attrs);
  3135. }
  3136. static stipple(attrs) {
  3137. return new Stipple(attrs);
  3138. }
  3139. static subform(attrs) {
  3140. return new Subform(attrs);
  3141. }
  3142. static subformSet(attrs) {
  3143. return new SubformSet(attrs);
  3144. }
  3145. static subjectDN(attrs) {
  3146. return new SubjectDN(attrs);
  3147. }
  3148. static subjectDNs(attrs) {
  3149. return new SubjectDNs(attrs);
  3150. }
  3151. static submit(attrs) {
  3152. return new Submit(attrs);
  3153. }
  3154. static template(attrs) {
  3155. return new Template(attrs);
  3156. }
  3157. static text(attrs) {
  3158. return new Text(attrs);
  3159. }
  3160. static textEdit(attrs) {
  3161. return new TextEdit(attrs);
  3162. }
  3163. static time(attrs) {
  3164. return new Time(attrs);
  3165. }
  3166. static timeStamp(attrs) {
  3167. return new TimeStamp(attrs);
  3168. }
  3169. static toolTip(attrs) {
  3170. return new ToolTip(attrs);
  3171. }
  3172. static traversal(attrs) {
  3173. return new Traversal(attrs);
  3174. }
  3175. static traverse(attrs) {
  3176. return new Traverse(attrs);
  3177. }
  3178. static ui(attrs) {
  3179. return new Ui(attrs);
  3180. }
  3181. static validate(attrs) {
  3182. return new Validate(attrs);
  3183. }
  3184. static value(attrs) {
  3185. return new Value(attrs);
  3186. }
  3187. static variables(attrs) {
  3188. return new Variables(attrs);
  3189. }
  3190. }
  3191. exports.TemplateNamespace = TemplateNamespace;