/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

const Utils = require("./../../../unisharp/Utils");

const FibRbFcLcb2003 = require("./FibRbFcLcb2003");
const FibRbFcLcb2007 = require("./FibRbFcLcb2007");
const FibRbFcLcb97 = require("./FibRbFcLcb97");
const FibBase = require("./FibBase");
const FibRgW97 = require("./FibRgW97");
const FibRgLw97 = require("./FibRgLw97");
const FibRbFcLcb2000 = require("./FibRbFcLcb2000");
const FibRgCswNew = require("./FibRgCswNew");
const ReadUtils = require("./ReadUtils");
const Fib = require("./Fib");
const FibRbFcLcb2002 = require("./FibRbFcLcb2002");
const FibRgCswNew2000 = require("./FibRgCswNew2000");
const FibRgCswNew2007 = require("./FibRgCswNew2007");

class FibStructuresReader {
    
    static readFib(s) {
        let fib = new Fib();
        fib._base = FibStructuresReader.readFibBase(s);
        if (fib._base === null) 
            return null;
        fib.csw = Utils.bytesToObject(ReadUtils.readExact(s, ReadUtils.wordSize), 0, 'ushort', 2);
        fib.fibRgW = FibStructuresReader.readFibRgW97(s, fib.csw);
        fib.cslw = Utils.bytesToObject(ReadUtils.readExact(s, ReadUtils.wordSize), 0, 'ushort', 2);
        fib.fibRgLw = FibStructuresReader.readFibRgLw97(s, fib.cslw);
        fib.cbRgFcLcb = Utils.bytesToObject(ReadUtils.readExact(s, ReadUtils.wordSize), 0, 'ushort', 2);
        fib.fibRgFcLcbBlob = FibStructuresReader.readFibRgFcLcbBlob(s, fib._base.nFib, fib.cbRgFcLcb);
        fib.cswNew = Utils.bytesToObject(ReadUtils.readExact(s, ReadUtils.wordSize), 0, 'ushort', 2);
        fib.fibRgCswNew = FibStructuresReader.readFibRgCswNew(s, fib._base.nFib, fib.cswNew);
        return fib;
    }
    
    static readFibRgCswNew(s, nFib, size) {
        let fibRgCswNew2000 = null;
        let fibRgCswNew2007 = null;
        switch (size) { 
        case 0: {
            return new FibRgCswNew();
        }
        case 2: {
            fibRgCswNew2000 = new FibRgCswNew2000();
            break;
        }
        case 5: {
            fibRgCswNew2000 = (fibRgCswNew2007 = new FibRgCswNew2007());
            break;
        }
        default: {
            fibRgCswNew2000 = (fibRgCswNew2007 = new FibRgCswNew2007());
            break;
        }
        }
        let data = ReadUtils.readExact(s, (size) * 2);
        fibRgCswNew2000.cQuickSavesNew = Utils.bytesToObject(data, 0, 'ushort', 2);
        return fibRgCswNew2000;
    }
    
    static readFibRgFcLcbBlob(s, nFib, size) {
        let fibRbFcLcb97 = null;
        let fibRbFcLcb2000 = null;
        let fibRbFcLcb2002 = null;
        let fibRbFcLcb2003 = null;
        let fibRbFcLcb2007 = null;
        switch (size) { 
        case 0x005D: {
            fibRbFcLcb97 = new FibRbFcLcb97();
            break;
        }
        case 0x006C: {
            fibRbFcLcb97 = (fibRbFcLcb2000 = new FibRbFcLcb2000());
            break;
        }
        case 0x0088: {
            fibRbFcLcb97 = (fibRbFcLcb2000 = (fibRbFcLcb2002 = new FibRbFcLcb2002()));
            break;
        }
        case 0x00A4: {
            fibRbFcLcb97 = (fibRbFcLcb2000 = (fibRbFcLcb2002 = (fibRbFcLcb2003 = new FibRbFcLcb2003())));
            break;
        }
        case 0x00B7: {
            fibRbFcLcb97 = (fibRbFcLcb2000 = (fibRbFcLcb2002 = (fibRbFcLcb2003 = (fibRbFcLcb2007 = new FibRbFcLcb2007()))));
            break;
        }
        default: {
            if (Utils.compareUnsigned(size, 0x00B7) >= 0) 
                fibRbFcLcb97 = (fibRbFcLcb2000 = (fibRbFcLcb2002 = (fibRbFcLcb2003 = (fibRbFcLcb2007 = new FibRbFcLcb2007()))));
            else 
                fibRbFcLcb97 = new FibRbFcLcb97();
            break;
        }
        }
        let data = ReadUtils.readExact(s, (size) * 8);
        fibRbFcLcb97.fcStshfOrig = Utils.bytesToObject(data, 0, 'uint', 4);
        fibRbFcLcb97.lcbStshfOrig = Utils.bytesToObject(data, 4, 'uint', 4);
        fibRbFcLcb97.fcStshf = Utils.bytesToObject(data, 8, 'uint', 4);
        fibRbFcLcb97.lcbStshf = Utils.bytesToObject(data, 12, 'uint', 4);
        fibRbFcLcb97.fcPlcffndRef = Utils.bytesToObject(data, 16, 'uint', 4);
        fibRbFcLcb97.lcbPlcffndRef = Utils.bytesToObject(data, 20, 'uint', 4);
        fibRbFcLcb97.fcPlcffndTxt = Utils.bytesToObject(data, 24, 'uint', 4);
        fibRbFcLcb97.lcbPlcffndTxt = Utils.bytesToObject(data, 28, 'uint', 4);
        fibRbFcLcb97.fcPlcfandRef = Utils.bytesToObject(data, 32, 'uint', 4);
        fibRbFcLcb97.lcbPlcfandRef = Utils.bytesToObject(data, 36, 'uint', 4);
        fibRbFcLcb97.fcPlcfandTxt = Utils.bytesToObject(data, 40, 'uint', 4);
        fibRbFcLcb97.lcbPlcfandTxt = Utils.bytesToObject(data, 44, 'uint', 4);
        fibRbFcLcb97.fcPlcfSed = Utils.bytesToObject(data, 48, 'uint', 4);
        fibRbFcLcb97.lcbPlcfSed = Utils.bytesToObject(data, 52, 'uint', 4);
        fibRbFcLcb97.fcPlcPad = Utils.bytesToObject(data, 56, 'uint', 4);
        fibRbFcLcb97.lcbPlcPad = Utils.bytesToObject(data, 60, 'uint', 4);
        fibRbFcLcb97.fcPlcfPhe = Utils.bytesToObject(data, 64, 'uint', 4);
        fibRbFcLcb97.lcbPlcfPhe = Utils.bytesToObject(data, 68, 'uint', 4);
        fibRbFcLcb97.fcSttbfGlsy = Utils.bytesToObject(data, 72, 'uint', 4);
        fibRbFcLcb97.lcbSttbfGlsy = Utils.bytesToObject(data, 76, 'uint', 4);
        fibRbFcLcb97.fcPlcfGlsy = Utils.bytesToObject(data, 80, 'uint', 4);
        fibRbFcLcb97.lcbPlcfGlsy = Utils.bytesToObject(data, 84, 'uint', 4);
        fibRbFcLcb97.fcPlcfHdd = Utils.bytesToObject(data, 88, 'uint', 4);
        fibRbFcLcb97.lcbPlcfHdd = Utils.bytesToObject(data, 92, 'uint', 4);
        fibRbFcLcb97.fcPlcfBteChpx = Utils.bytesToObject(data, 96, 'uint', 4);
        fibRbFcLcb97.lcbPlcfBteChpx = Utils.bytesToObject(data, 100, 'uint', 4);
        fibRbFcLcb97.fcPlcfBtePapx = Utils.bytesToObject(data, 104, 'uint', 4);
        fibRbFcLcb97.lcbPlcfBtePapx = Utils.bytesToObject(data, 108, 'uint', 4);
        fibRbFcLcb97.fcPlcfSea = Utils.bytesToObject(data, 112, 'uint', 4);
        fibRbFcLcb97.lcbPlcfSea = Utils.bytesToObject(data, 116, 'uint', 4);
        fibRbFcLcb97.fcSttbfFfn = Utils.bytesToObject(data, 120, 'uint', 4);
        fibRbFcLcb97.lcbSttbfFfn = Utils.bytesToObject(data, 124, 'uint', 4);
        fibRbFcLcb97.fcPlcfFldMom = Utils.bytesToObject(data, 128, 'uint', 4);
        fibRbFcLcb97.lcbPlcfFldMom = Utils.bytesToObject(data, 132, 'uint', 4);
        fibRbFcLcb97.fcPlcfFldHdr = Utils.bytesToObject(data, 136, 'uint', 4);
        fibRbFcLcb97.lcbPlcfFldHdr = Utils.bytesToObject(data, 140, 'uint', 4);
        fibRbFcLcb97.fcPlcfFldFtn = Utils.bytesToObject(data, 144, 'uint', 4);
        fibRbFcLcb97.lcbPlcfFldFtn = Utils.bytesToObject(data, 148, 'uint', 4);
        fibRbFcLcb97.fcPlcfFldAtn = Utils.bytesToObject(data, 152, 'uint', 4);
        fibRbFcLcb97.lcbPlcfFldAtn = Utils.bytesToObject(data, 156, 'uint', 4);
        fibRbFcLcb97.fcPlcfFldMcr = Utils.bytesToObject(data, 160, 'uint', 4);
        fibRbFcLcb97.lcbPlcfFldMcr = Utils.bytesToObject(data, 164, 'uint', 4);
        fibRbFcLcb97.fcSttbfBkmk = Utils.bytesToObject(data, 168, 'uint', 4);
        fibRbFcLcb97.lcbSttbfBkmk = Utils.bytesToObject(data, 172, 'uint', 4);
        fibRbFcLcb97.fcPlcfBkf = Utils.bytesToObject(data, 176, 'uint', 4);
        fibRbFcLcb97.lcbPlcfBkf = Utils.bytesToObject(data, 180, 'uint', 4);
        fibRbFcLcb97.fcPlcfBkl = Utils.bytesToObject(data, 184, 'uint', 4);
        fibRbFcLcb97.lcbPlcfBkl = Utils.bytesToObject(data, 188, 'uint', 4);
        fibRbFcLcb97.fcCmds = Utils.bytesToObject(data, 192, 'uint', 4);
        fibRbFcLcb97.lcbCmds = Utils.bytesToObject(data, 196, 'uint', 4);
        fibRbFcLcb97.fcUnused1 = Utils.bytesToObject(data, 200, 'uint', 4);
        fibRbFcLcb97.lcbUnused1 = Utils.bytesToObject(data, 204, 'uint', 4);
        fibRbFcLcb97.fcSttbfMcr = Utils.bytesToObject(data, 208, 'uint', 4);
        fibRbFcLcb97.lcbSttbfMcr = Utils.bytesToObject(data, 212, 'uint', 4);
        fibRbFcLcb97.fcPrDrvr = Utils.bytesToObject(data, 216, 'uint', 4);
        fibRbFcLcb97.lcbPrDrvr = Utils.bytesToObject(data, 220, 'uint', 4);
        fibRbFcLcb97.fcPrEnvPort = Utils.bytesToObject(data, 224, 'uint', 4);
        fibRbFcLcb97.lcbPrEnvPort = Utils.bytesToObject(data, 228, 'uint', 4);
        fibRbFcLcb97.fcPrEnvLand = Utils.bytesToObject(data, 232, 'uint', 4);
        fibRbFcLcb97.lcbPrEnvLand = Utils.bytesToObject(data, 236, 'uint', 4);
        fibRbFcLcb97.fcWss = Utils.bytesToObject(data, 240, 'uint', 4);
        fibRbFcLcb97.lcbWss = Utils.bytesToObject(data, 244, 'uint', 4);
        fibRbFcLcb97.fcDop = Utils.bytesToObject(data, 248, 'uint', 4);
        fibRbFcLcb97.lcbDop = Utils.bytesToObject(data, 252, 'uint', 4);
        fibRbFcLcb97.fcSttbfAssoc = Utils.bytesToObject(data, 256, 'uint', 4);
        fibRbFcLcb97.lcbSttbfAssoc = Utils.bytesToObject(data, 260, 'uint', 4);
        fibRbFcLcb97.fcClx = Utils.bytesToObject(data, 264, 'uint', 4);
        fibRbFcLcb97.lcbClx = Utils.bytesToObject(data, 268, 'uint', 4);
        fibRbFcLcb97.fcPlcfPgdFtn = Utils.bytesToObject(data, 272, 'uint', 4);
        fibRbFcLcb97.lcbPlcfPgdFtn = Utils.bytesToObject(data, 276, 'uint', 4);
        fibRbFcLcb97.fcAutosaveSource = Utils.bytesToObject(data, 280, 'uint', 4);
        fibRbFcLcb97.lcbAutosaveSource = Utils.bytesToObject(data, 284, 'uint', 4);
        fibRbFcLcb97.fcGrpXstAtnOwners = Utils.bytesToObject(data, 288, 'uint', 4);
        fibRbFcLcb97.lcbGrpXstAtnOwners = Utils.bytesToObject(data, 292, 'uint', 4);
        fibRbFcLcb97.fcSttbfAtnBkmk = Utils.bytesToObject(data, 296, 'uint', 4);
        fibRbFcLcb97.lcbSttbfAtnBkmk = Utils.bytesToObject(data, 300, 'uint', 4);
        fibRbFcLcb97.fcUnused2 = Utils.bytesToObject(data, 304, 'uint', 4);
        fibRbFcLcb97.lcbUnused2 = Utils.bytesToObject(data, 308, 'uint', 4);
        fibRbFcLcb97.fcUnused3 = Utils.bytesToObject(data, 312, 'uint', 4);
        fibRbFcLcb97.lcbUnused3 = Utils.bytesToObject(data, 316, 'uint', 4);
        fibRbFcLcb97.fcPlcSpaMom = Utils.bytesToObject(data, 320, 'uint', 4);
        fibRbFcLcb97.lcbPlcSpaMom = Utils.bytesToObject(data, 324, 'uint', 4);
        fibRbFcLcb97.fcPlcSpaHdr = Utils.bytesToObject(data, 328, 'uint', 4);
        fibRbFcLcb97.lcbPlcSpaHdr = Utils.bytesToObject(data, 332, 'uint', 4);
        fibRbFcLcb97.fcPlcfAtnBkf = Utils.bytesToObject(data, 336, 'uint', 4);
        fibRbFcLcb97.lcbPlcfAtnBkf = Utils.bytesToObject(data, 340, 'uint', 4);
        fibRbFcLcb97.fcPlcfAtnBkl = Utils.bytesToObject(data, 344, 'uint', 4);
        fibRbFcLcb97.lcbPlcfAtnBkl = Utils.bytesToObject(data, 348, 'uint', 4);
        fibRbFcLcb97.fcPms = Utils.bytesToObject(data, 352, 'uint', 4);
        fibRbFcLcb97.lcbPms = Utils.bytesToObject(data, 356, 'uint', 4);
        fibRbFcLcb97.fcFormFldSttbs = Utils.bytesToObject(data, 360, 'uint', 4);
        fibRbFcLcb97.lcbFormFldSttbs = Utils.bytesToObject(data, 364, 'uint', 4);
        fibRbFcLcb97.fcPlcfendRef = Utils.bytesToObject(data, 368, 'uint', 4);
        fibRbFcLcb97.lcbPlcfendRef = Utils.bytesToObject(data, 372, 'uint', 4);
        fibRbFcLcb97.fcPlcfendTxt = Utils.bytesToObject(data, 376, 'uint', 4);
        fibRbFcLcb97.lcbPlcfendTxt = Utils.bytesToObject(data, 380, 'uint', 4);
        fibRbFcLcb97.fcPlcfFldEdn = Utils.bytesToObject(data, 384, 'uint', 4);
        fibRbFcLcb97.lcbPlcfFldEdn = Utils.bytesToObject(data, 388, 'uint', 4);
        fibRbFcLcb97.fcUnused4 = Utils.bytesToObject(data, 392, 'uint', 4);
        fibRbFcLcb97.lcbUnused4 = Utils.bytesToObject(data, 396, 'uint', 4);
        fibRbFcLcb97.fcDggInfo = Utils.bytesToObject(data, 400, 'uint', 4);
        fibRbFcLcb97.lcbDggInfo = Utils.bytesToObject(data, 404, 'uint', 4);
        fibRbFcLcb97.fcSttbfRMark = Utils.bytesToObject(data, 408, 'uint', 4);
        fibRbFcLcb97.lcbSttbfRMark = Utils.bytesToObject(data, 412, 'uint', 4);
        fibRbFcLcb97.fcSttbfCaption = Utils.bytesToObject(data, 416, 'uint', 4);
        fibRbFcLcb97.lcbSttbfCaption = Utils.bytesToObject(data, 420, 'uint', 4);
        fibRbFcLcb97.fcSttbfAutoCaption = Utils.bytesToObject(data, 424, 'uint', 4);
        fibRbFcLcb97.lcbSttbfAutoCaption = Utils.bytesToObject(data, 428, 'uint', 4);
        fibRbFcLcb97.fcPlcfWkb = Utils.bytesToObject(data, 432, 'uint', 4);
        fibRbFcLcb97.lcbPlcfWkb = Utils.bytesToObject(data, 436, 'uint', 4);
        fibRbFcLcb97.fcPlcfSpl = Utils.bytesToObject(data, 440, 'uint', 4);
        fibRbFcLcb97.lcbPlcfSpl = Utils.bytesToObject(data, 444, 'uint', 4);
        fibRbFcLcb97.fcPlcftxbxTxt = Utils.bytesToObject(data, 448, 'uint', 4);
        fibRbFcLcb97.lcbPlcftxbxTxt = Utils.bytesToObject(data, 452, 'uint', 4);
        fibRbFcLcb97.fcPlcfFldTxbx = Utils.bytesToObject(data, 456, 'uint', 4);
        fibRbFcLcb97.lcbPlcfFldTxbx = Utils.bytesToObject(data, 460, 'uint', 4);
        fibRbFcLcb97.fcPlcfHdrtxbxTxt = Utils.bytesToObject(data, 464, 'uint', 4);
        fibRbFcLcb97.lcbPlcfHdrtxbxTxt = Utils.bytesToObject(data, 468, 'uint', 4);
        fibRbFcLcb97.fcPlcffldHdrTxbx = Utils.bytesToObject(data, 472, 'uint', 4);
        fibRbFcLcb97.lcbPlcffldHdrTxbx = Utils.bytesToObject(data, 476, 'uint', 4);
        fibRbFcLcb97.fcStwUser = Utils.bytesToObject(data, 480, 'uint', 4);
        fibRbFcLcb97.lcbStwUser = Utils.bytesToObject(data, 484, 'uint', 4);
        fibRbFcLcb97.fcSttbTtmbd = Utils.bytesToObject(data, 488, 'uint', 4);
        fibRbFcLcb97.lcbSttbTtmbd = Utils.bytesToObject(data, 492, 'uint', 4);
        fibRbFcLcb97.fcCookieData = Utils.bytesToObject(data, 496, 'uint', 4);
        fibRbFcLcb97.lcbCookieData = Utils.bytesToObject(data, 500, 'uint', 4);
        fibRbFcLcb97.fcPgdMotherOldOld = Utils.bytesToObject(data, 504, 'uint', 4);
        fibRbFcLcb97.lcbPgdMotherOldOld = Utils.bytesToObject(data, 508, 'uint', 4);
        fibRbFcLcb97.fcBkdMotherOldOld = Utils.bytesToObject(data, 512, 'uint', 4);
        fibRbFcLcb97.lcbBkdMotherOldOld = Utils.bytesToObject(data, 516, 'uint', 4);
        fibRbFcLcb97.fcPgdFtnOldOld = Utils.bytesToObject(data, 520, 'uint', 4);
        fibRbFcLcb97.lcbPgdFtnOldOld = Utils.bytesToObject(data, 524, 'uint', 4);
        fibRbFcLcb97.fcBkdFtnOldOld = Utils.bytesToObject(data, 528, 'uint', 4);
        fibRbFcLcb97.lcbBkdFtnOldOld = Utils.bytesToObject(data, 532, 'uint', 4);
        fibRbFcLcb97.fcPgdEdnOldOld = Utils.bytesToObject(data, 536, 'uint', 4);
        fibRbFcLcb97.lcbPgdEdnOldOld = Utils.bytesToObject(data, 540, 'uint', 4);
        fibRbFcLcb97.fcBkdEdnOldOld = Utils.bytesToObject(data, 544, 'uint', 4);
        fibRbFcLcb97.lcbBkdEdnOldOld = Utils.bytesToObject(data, 548, 'uint', 4);
        fibRbFcLcb97.fcSttbfIntlFld = Utils.bytesToObject(data, 552, 'uint', 4);
        fibRbFcLcb97.lcbSttbfIntlFld = Utils.bytesToObject(data, 556, 'uint', 4);
        fibRbFcLcb97.fcRouteSlip = Utils.bytesToObject(data, 560, 'uint', 4);
        fibRbFcLcb97.lcbRouteSlip = Utils.bytesToObject(data, 564, 'uint', 4);
        fibRbFcLcb97.fcSttbSavedBy = Utils.bytesToObject(data, 568, 'uint', 4);
        fibRbFcLcb97.lcbSttbSavedBy = Utils.bytesToObject(data, 572, 'uint', 4);
        fibRbFcLcb97.fcSttbFnm = Utils.bytesToObject(data, 576, 'uint', 4);
        fibRbFcLcb97.lcbSttbFnm = Utils.bytesToObject(data, 580, 'uint', 4);
        fibRbFcLcb97.fcPlfLst = Utils.bytesToObject(data, 584, 'uint', 4);
        fibRbFcLcb97.lcbPlfLst = Utils.bytesToObject(data, 588, 'uint', 4);
        fibRbFcLcb97.fcPlfLfo = Utils.bytesToObject(data, 592, 'uint', 4);
        fibRbFcLcb97.lcbPlfLfo = Utils.bytesToObject(data, 596, 'uint', 4);
        fibRbFcLcb97.fcPlcfTxbxBkd = Utils.bytesToObject(data, 600, 'uint', 4);
        fibRbFcLcb97.lcbPlcfTxbxBkd = Utils.bytesToObject(data, 604, 'uint', 4);
        fibRbFcLcb97.fcPlcfTxbxHdrBkd = Utils.bytesToObject(data, 608, 'uint', 4);
        fibRbFcLcb97.lcbPlcfTxbxHdrBkd = Utils.bytesToObject(data, 612, 'uint', 4);
        fibRbFcLcb97.fcDocUndoWord9 = Utils.bytesToObject(data, 616, 'uint', 4);
        fibRbFcLcb97.lcbDocUndoWord9 = Utils.bytesToObject(data, 620, 'uint', 4);
        fibRbFcLcb97.fcRgbUse = Utils.bytesToObject(data, 624, 'uint', 4);
        fibRbFcLcb97.lcbRgbUse = Utils.bytesToObject(data, 628, 'uint', 4);
        fibRbFcLcb97.fcUsp = Utils.bytesToObject(data, 632, 'uint', 4);
        fibRbFcLcb97.lcbUsp = Utils.bytesToObject(data, 636, 'uint', 4);
        fibRbFcLcb97.fcUskf = Utils.bytesToObject(data, 640, 'uint', 4);
        fibRbFcLcb97.lcbUskf = Utils.bytesToObject(data, 644, 'uint', 4);
        fibRbFcLcb97.fcPlcupcRgbUse = Utils.bytesToObject(data, 648, 'uint', 4);
        fibRbFcLcb97.lcbPlcupcRgbUse = Utils.bytesToObject(data, 652, 'uint', 4);
        fibRbFcLcb97.fcPlcupcUsp = Utils.bytesToObject(data, 656, 'uint', 4);
        fibRbFcLcb97.lcbPlcupcUsp = Utils.bytesToObject(data, 660, 'uint', 4);
        fibRbFcLcb97.fcSttbGlsyStyle = Utils.bytesToObject(data, 664, 'uint', 4);
        fibRbFcLcb97.lcbSttbGlsyStyle = Utils.bytesToObject(data, 668, 'uint', 4);
        fibRbFcLcb97.fcPlgosl = Utils.bytesToObject(data, 672, 'uint', 4);
        fibRbFcLcb97.lcbPlgosl = Utils.bytesToObject(data, 676, 'uint', 4);
        fibRbFcLcb97.fcPlcocx = Utils.bytesToObject(data, 680, 'uint', 4);
        fibRbFcLcb97.lcbPlcocx = Utils.bytesToObject(data, 684, 'uint', 4);
        fibRbFcLcb97.fcPlcfBteLvc = Utils.bytesToObject(data, 688, 'uint', 4);
        fibRbFcLcb97.lcbPlcfBteLvc = Utils.bytesToObject(data, 692, 'uint', 4);
        fibRbFcLcb97.dwLowDateTime = Utils.bytesToObject(data, 696, 'uint', 4);
        fibRbFcLcb97.dwHighDateTime = Utils.bytesToObject(data, 700, 'uint', 4);
        fibRbFcLcb97.fcPlcfLvcPre10 = Utils.bytesToObject(data, 704, 'uint', 4);
        fibRbFcLcb97.lcbPlcfLvcPre10 = Utils.bytesToObject(data, 708, 'uint', 4);
        fibRbFcLcb97.fcPlcfAsumy = Utils.bytesToObject(data, 712, 'uint', 4);
        fibRbFcLcb97.lcbPlcfAsumy = Utils.bytesToObject(data, 716, 'uint', 4);
        fibRbFcLcb97.fcPlcfGram = Utils.bytesToObject(data, 720, 'uint', 4);
        fibRbFcLcb97.lcbPlcfGram = Utils.bytesToObject(data, 724, 'uint', 4);
        fibRbFcLcb97.fcSttbListNames = Utils.bytesToObject(data, 728, 'uint', 4);
        fibRbFcLcb97.lcbSttbListNames = Utils.bytesToObject(data, 732, 'uint', 4);
        fibRbFcLcb97.fcSttbfUssr = Utils.bytesToObject(data, 736, 'uint', 4);
        fibRbFcLcb97.lcbSttbfUssr = Utils.bytesToObject(data, 740, 'uint', 4);
        if (fibRbFcLcb2000 !== null) {
            fibRbFcLcb2000.fcPlcfTch = Utils.bytesToObject(data, 744, 'uint', 4);
            fibRbFcLcb2000.lcbPlcfTch = Utils.bytesToObject(data, 748, 'uint', 4);
            fibRbFcLcb2000.fcRmdThreading = Utils.bytesToObject(data, 752, 'uint', 4);
            fibRbFcLcb2000.lcbRmdThreading = Utils.bytesToObject(data, 756, 'uint', 4);
            fibRbFcLcb2000.fcMid = Utils.bytesToObject(data, 760, 'uint', 4);
            fibRbFcLcb2000.lcbMid = Utils.bytesToObject(data, 764, 'uint', 4);
            fibRbFcLcb2000.fcSttbRgtplc = Utils.bytesToObject(data, 768, 'uint', 4);
            fibRbFcLcb2000.lcbSttbRgtplc = Utils.bytesToObject(data, 772, 'uint', 4);
            fibRbFcLcb2000.fcMsoEnvelope = Utils.bytesToObject(data, 776, 'uint', 4);
            fibRbFcLcb2000.lcbMsoEnvelope = Utils.bytesToObject(data, 780, 'uint', 4);
            fibRbFcLcb2000.fcPlcfLad = Utils.bytesToObject(data, 784, 'uint', 4);
            fibRbFcLcb2000.lcbPlcfLad = Utils.bytesToObject(data, 788, 'uint', 4);
            fibRbFcLcb2000.fcRgDofr = Utils.bytesToObject(data, 792, 'uint', 4);
            fibRbFcLcb2000.lcbRgDofr = Utils.bytesToObject(data, 796, 'uint', 4);
            fibRbFcLcb2000.fcPlcosl = Utils.bytesToObject(data, 800, 'uint', 4);
            fibRbFcLcb2000.lcbPlcosl = Utils.bytesToObject(data, 804, 'uint', 4);
            fibRbFcLcb2000.fcPlcfCookieOld = Utils.bytesToObject(data, 808, 'uint', 4);
            fibRbFcLcb2000.lcbPlcfCookieOld = Utils.bytesToObject(data, 812, 'uint', 4);
            fibRbFcLcb2000.fcPgdMotherOld = Utils.bytesToObject(data, 816, 'uint', 4);
            fibRbFcLcb2000.lcbPgdMotherOld = Utils.bytesToObject(data, 820, 'uint', 4);
            fibRbFcLcb2000.fcBkdMotherOld = Utils.bytesToObject(data, 824, 'uint', 4);
            fibRbFcLcb2000.lcbBkdMotherOld = Utils.bytesToObject(data, 828, 'uint', 4);
            fibRbFcLcb2000.fcPgdFtnOld = Utils.bytesToObject(data, 832, 'uint', 4);
            fibRbFcLcb2000.lcbPgdFtnOld = Utils.bytesToObject(data, 836, 'uint', 4);
            fibRbFcLcb2000.fcBkdFtnOld = Utils.bytesToObject(data, 840, 'uint', 4);
            fibRbFcLcb2000.lcbBkdFtnOld = Utils.bytesToObject(data, 844, 'uint', 4);
            fibRbFcLcb2000.fcPgdEdnOld = Utils.bytesToObject(data, 848, 'uint', 4);
            fibRbFcLcb2000.lcbPgdEdnOld = Utils.bytesToObject(data, 852, 'uint', 4);
            fibRbFcLcb2000.fcBkdEdnOld = Utils.bytesToObject(data, 856, 'uint', 4);
            fibRbFcLcb2000.lcbBkdEdnOld = Utils.bytesToObject(data, 860, 'uint', 4);
        }
        if (fibRbFcLcb2002 !== null) {
            fibRbFcLcb2002.fcUnused10 = Utils.bytesToObject(data, 864, 'uint', 4);
            fibRbFcLcb2002.lcbUnused10 = Utils.bytesToObject(data, 868, 'uint', 4);
            fibRbFcLcb2002.fcPlcfPgp = Utils.bytesToObject(data, 872, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfPgp = Utils.bytesToObject(data, 876, 'uint', 4);
            fibRbFcLcb2002.fcPlcfuim = Utils.bytesToObject(data, 880, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfuim = Utils.bytesToObject(data, 884, 'uint', 4);
            fibRbFcLcb2002.fcPlfguidUim = Utils.bytesToObject(data, 888, 'uint', 4);
            fibRbFcLcb2002.lcbPlfguidUim = Utils.bytesToObject(data, 892, 'uint', 4);
            fibRbFcLcb2002.fcAtrdExtra = Utils.bytesToObject(data, 896, 'uint', 4);
            fibRbFcLcb2002.lcbAtrdExtra = Utils.bytesToObject(data, 900, 'uint', 4);
            fibRbFcLcb2002.fcPlrsid = Utils.bytesToObject(data, 904, 'uint', 4);
            fibRbFcLcb2002.lcbPlrsid = Utils.bytesToObject(data, 908, 'uint', 4);
            fibRbFcLcb2002.fcSttbfBkmkFactoid = Utils.bytesToObject(data, 912, 'uint', 4);
            fibRbFcLcb2002.lcbSttbfBkmkFactoid = Utils.bytesToObject(data, 916, 'uint', 4);
            fibRbFcLcb2002.fcPlcfBkfFactoid = Utils.bytesToObject(data, 920, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfBkfFactoid = Utils.bytesToObject(data, 924, 'uint', 4);
            fibRbFcLcb2002.fcPlcfcookie = Utils.bytesToObject(data, 928, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfcookie = Utils.bytesToObject(data, 932, 'uint', 4);
            fibRbFcLcb2002.fcPlcfBklFactoid = Utils.bytesToObject(data, 936, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfBklFactoid = Utils.bytesToObject(data, 940, 'uint', 4);
            fibRbFcLcb2002.fcFactoidData = Utils.bytesToObject(data, 944, 'uint', 4);
            fibRbFcLcb2002.lcbFactoidData = Utils.bytesToObject(data, 948, 'uint', 4);
            fibRbFcLcb2002.fcDocUndo = Utils.bytesToObject(data, 952, 'uint', 4);
            fibRbFcLcb2002.lcbDocUndo = Utils.bytesToObject(data, 956, 'uint', 4);
            fibRbFcLcb2002.fcSttbfBkmkFcc = Utils.bytesToObject(data, 960, 'uint', 4);
            fibRbFcLcb2002.lcbSttbfBkmkFcc = Utils.bytesToObject(data, 964, 'uint', 4);
            fibRbFcLcb2002.fcPlcfBkfFcc = Utils.bytesToObject(data, 968, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfBkfFcc = Utils.bytesToObject(data, 972, 'uint', 4);
            fibRbFcLcb2002.fcPlcfBklFcc = Utils.bytesToObject(data, 976, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfBklFcc = Utils.bytesToObject(data, 980, 'uint', 4);
            fibRbFcLcb2002.fcSttbfbkmkBPRepairs = Utils.bytesToObject(data, 984, 'uint', 4);
            fibRbFcLcb2002.lcbSttbfbkmkBPRepairs = Utils.bytesToObject(data, 988, 'uint', 4);
            fibRbFcLcb2002.fcPlcfbkfBPRepairs = Utils.bytesToObject(data, 992, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfbkfBPRepairs = Utils.bytesToObject(data, 996, 'uint', 4);
            fibRbFcLcb2002.fcPlcfbklBPRepairs = Utils.bytesToObject(data, 1000, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfbklBPRepairs = Utils.bytesToObject(data, 1004, 'uint', 4);
            fibRbFcLcb2002.fcPmsNew = Utils.bytesToObject(data, 1008, 'uint', 4);
            fibRbFcLcb2002.lcbPmsNew = Utils.bytesToObject(data, 1012, 'uint', 4);
            fibRbFcLcb2002.fcODSO = Utils.bytesToObject(data, 1016, 'uint', 4);
            fibRbFcLcb2002.lcbODSO = Utils.bytesToObject(data, 1020, 'uint', 4);
            fibRbFcLcb2002.fcPlcfpmiOldXP = Utils.bytesToObject(data, 1024, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfpmiOldXP = Utils.bytesToObject(data, 1028, 'uint', 4);
            fibRbFcLcb2002.fcPlcfpmiNewXP = Utils.bytesToObject(data, 1032, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfpmiNewXP = Utils.bytesToObject(data, 1036, 'uint', 4);
            fibRbFcLcb2002.fcPlcfpmiMixedXP = Utils.bytesToObject(data, 1040, 'uint', 4);
            fibRbFcLcb2002.lcbPlcfpmiMixedXP = Utils.bytesToObject(data, 1044, 'uint', 4);
            fibRbFcLcb2002.fcUnused20 = Utils.bytesToObject(data, 1048, 'uint', 4);
            fibRbFcLcb2002.lcbUnused20 = Utils.bytesToObject(data, 1052, 'uint', 4);
            fibRbFcLcb2002.fcPlcffactoid = Utils.bytesToObject(data, 1056, 'uint', 4);
            fibRbFcLcb2002.lcbPlcffactoid = Utils.bytesToObject(data, 1060, 'uint', 4);
            fibRbFcLcb2002.fcPlcflvcOldXP = Utils.bytesToObject(data, 1064, 'uint', 4);
            fibRbFcLcb2002.lcbPlcflvcOldXP = Utils.bytesToObject(data, 1068, 'uint', 4);
            fibRbFcLcb2002.fcPlcflvcNewXP = Utils.bytesToObject(data, 1072, 'uint', 4);
            fibRbFcLcb2002.lcbPlcflvcNewXP = Utils.bytesToObject(data, 1076, 'uint', 4);
            fibRbFcLcb2002.fcPlcflvcMixedXP = Utils.bytesToObject(data, 1080, 'uint', 4);
            fibRbFcLcb2002.lcbPlcflvcMixedXP = Utils.bytesToObject(data, 1084, 'uint', 4);
        }
        if (fibRbFcLcb2003 !== null) {
            fibRbFcLcb2003.fcHplxsdr = Utils.bytesToObject(data, 1088, 'uint', 4);
            fibRbFcLcb2003.lcbHplxsdr = Utils.bytesToObject(data, 1092, 'uint', 4);
            fibRbFcLcb2003.fcSttbfBkmkSdt = Utils.bytesToObject(data, 1096, 'uint', 4);
            fibRbFcLcb2003.lcbSttbfBkmkSdt = Utils.bytesToObject(data, 1100, 'uint', 4);
            fibRbFcLcb2003.fcPlcfBkfSdt = Utils.bytesToObject(data, 1104, 'uint', 4);
            fibRbFcLcb2003.lcbPlcfBkfSdt = Utils.bytesToObject(data, 1108, 'uint', 4);
            fibRbFcLcb2003.fcPlcfBklSdt = Utils.bytesToObject(data, 1112, 'uint', 4);
            fibRbFcLcb2003.lcbPlcfBklSdt = Utils.bytesToObject(data, 1116, 'uint', 4);
            fibRbFcLcb2003.fcCustomXForm = Utils.bytesToObject(data, 1120, 'uint', 4);
            fibRbFcLcb2003.lcbCustomXForm = Utils.bytesToObject(data, 1124, 'uint', 4);
            fibRbFcLcb2003.fcSttbfBkmkProt = Utils.bytesToObject(data, 1128, 'uint', 4);
            fibRbFcLcb2003.lcbSttbfBkmkProt = Utils.bytesToObject(data, 1132, 'uint', 4);
            fibRbFcLcb2003.fcPlcfBkfProt = Utils.bytesToObject(data, 1136, 'uint', 4);
            fibRbFcLcb2003.lcbPlcfBkfProt = Utils.bytesToObject(data, 1140, 'uint', 4);
            fibRbFcLcb2003.fcPlcfBklProt = Utils.bytesToObject(data, 1144, 'uint', 4);
            fibRbFcLcb2003.lcbPlcfBklProt = Utils.bytesToObject(data, 1148, 'uint', 4);
            fibRbFcLcb2003.fcSttbProtUser = Utils.bytesToObject(data, 1152, 'uint', 4);
            fibRbFcLcb2003.lcbSttbProtUser = Utils.bytesToObject(data, 1156, 'uint', 4);
            fibRbFcLcb2003.fcUnused = Utils.bytesToObject(data, 1160, 'uint', 4);
            fibRbFcLcb2003.lcbUnused = Utils.bytesToObject(data, 1164, 'uint', 4);
            fibRbFcLcb2003.fcPlcfpmiOld = Utils.bytesToObject(data, 1168, 'uint', 4);
            fibRbFcLcb2003.lcbPlcfpmiOld = Utils.bytesToObject(data, 1172, 'uint', 4);
            fibRbFcLcb2003.fcPlcfpmiOldInline = Utils.bytesToObject(data, 1176, 'uint', 4);
            fibRbFcLcb2003.lcbPlcfpmiOldInline = Utils.bytesToObject(data, 1180, 'uint', 4);
            fibRbFcLcb2003.fcPlcfpmiNew = Utils.bytesToObject(data, 1184, 'uint', 4);
            fibRbFcLcb2003.lcbPlcfpmiNew = Utils.bytesToObject(data, 1188, 'uint', 4);
            fibRbFcLcb2003.fcPlcfpmiNewInline = Utils.bytesToObject(data, 1192, 'uint', 4);
            fibRbFcLcb2003.lcbPlcfpmiNewInline = Utils.bytesToObject(data, 1196, 'uint', 4);
            fibRbFcLcb2003.fcPlcflvcOld = Utils.bytesToObject(data, 1200, 'uint', 4);
            fibRbFcLcb2003.lcbPlcflvcOld = Utils.bytesToObject(data, 1204, 'uint', 4);
            fibRbFcLcb2003.fcPlcflvcOldInline = Utils.bytesToObject(data, 1208, 'uint', 4);
            fibRbFcLcb2003.lcbPlcflvcOldInline = Utils.bytesToObject(data, 1212, 'uint', 4);
            fibRbFcLcb2003.fcPlcflvcNew = Utils.bytesToObject(data, 1216, 'uint', 4);
            fibRbFcLcb2003.lcbPlcflvcNew = Utils.bytesToObject(data, 1220, 'uint', 4);
            fibRbFcLcb2003.fcPlcflvcNewInline = Utils.bytesToObject(data, 1224, 'uint', 4);
            fibRbFcLcb2003.lcbPlcflvcNewInline = Utils.bytesToObject(data, 1228, 'uint', 4);
            fibRbFcLcb2003.fcPgdMother = Utils.bytesToObject(data, 1232, 'uint', 4);
            fibRbFcLcb2003.lcbPgdMother = Utils.bytesToObject(data, 1236, 'uint', 4);
            fibRbFcLcb2003.fcBkdMother = Utils.bytesToObject(data, 1240, 'uint', 4);
            fibRbFcLcb2003.lcbBkdMother = Utils.bytesToObject(data, 1244, 'uint', 4);
            fibRbFcLcb2003.fcAfdMother = Utils.bytesToObject(data, 1248, 'uint', 4);
            fibRbFcLcb2003.lcbAfdMother = Utils.bytesToObject(data, 1252, 'uint', 4);
            fibRbFcLcb2003.fcPgdFtn = Utils.bytesToObject(data, 1256, 'uint', 4);
            fibRbFcLcb2003.lcbPgdFtn = Utils.bytesToObject(data, 1260, 'uint', 4);
            fibRbFcLcb2003.fcBkdFtn = Utils.bytesToObject(data, 1264, 'uint', 4);
            fibRbFcLcb2003.lcbBkdFtn = Utils.bytesToObject(data, 1268, 'uint', 4);
            fibRbFcLcb2003.fcAfdFtn = Utils.bytesToObject(data, 1272, 'uint', 4);
            fibRbFcLcb2003.lcbAfdFtn = Utils.bytesToObject(data, 1276, 'uint', 4);
            fibRbFcLcb2003.fcPgdEdn = Utils.bytesToObject(data, 1280, 'uint', 4);
            fibRbFcLcb2003.lcbPgdEdn = Utils.bytesToObject(data, 1284, 'uint', 4);
            fibRbFcLcb2003.fcBkdEdn = Utils.bytesToObject(data, 1288, 'uint', 4);
            fibRbFcLcb2003.lcbBkdEdn = Utils.bytesToObject(data, 1292, 'uint', 4);
            fibRbFcLcb2003.fcAfdEdn = Utils.bytesToObject(data, 1296, 'uint', 4);
            fibRbFcLcb2003.lcbAfdEdn = Utils.bytesToObject(data, 1300, 'uint', 4);
            fibRbFcLcb2003.fcAfd = Utils.bytesToObject(data, 1304, 'uint', 4);
            fibRbFcLcb2003.lcbAfd = Utils.bytesToObject(data, 1308, 'uint', 4);
        }
        if (fibRbFcLcb2007 !== null) {
            fibRbFcLcb2007.fcPlcfmthd = Utils.bytesToObject(data, 1312, 'uint', 4);
            fibRbFcLcb2007.lcbPlcfmthd = Utils.bytesToObject(data, 1316, 'uint', 4);
            fibRbFcLcb2007.fcSttbfBkmkMoveFrom = Utils.bytesToObject(data, 1320, 'uint', 4);
            fibRbFcLcb2007.lcbSttbfBkmkMoveFrom = Utils.bytesToObject(data, 1324, 'uint', 4);
            fibRbFcLcb2007.fcPlcfBkfMoveFrom = Utils.bytesToObject(data, 1328, 'uint', 4);
            fibRbFcLcb2007.lcbPlcfBkfMoveFrom = Utils.bytesToObject(data, 1332, 'uint', 4);
            fibRbFcLcb2007.fcPlcfBklMoveFrom = Utils.bytesToObject(data, 1336, 'uint', 4);
            fibRbFcLcb2007.lcbPlcfBklMoveFrom = Utils.bytesToObject(data, 1340, 'uint', 4);
            fibRbFcLcb2007.fcSttbfBkmkMoveTo = Utils.bytesToObject(data, 1344, 'uint', 4);
            fibRbFcLcb2007.lcbSttbfBkmkMoveTo = Utils.bytesToObject(data, 1348, 'uint', 4);
            fibRbFcLcb2007.fcPlcfBkfMoveTo = Utils.bytesToObject(data, 1352, 'uint', 4);
            fibRbFcLcb2007.lcbPlcfBkfMoveTo = Utils.bytesToObject(data, 1356, 'uint', 4);
            fibRbFcLcb2007.fcPlcfBklMoveTo = Utils.bytesToObject(data, 1360, 'uint', 4);
            fibRbFcLcb2007.lcbPlcfBklMoveTo = Utils.bytesToObject(data, 1364, 'uint', 4);
            fibRbFcLcb2007.fcUnused11 = Utils.bytesToObject(data, 1368, 'uint', 4);
            fibRbFcLcb2007.lcbUnused11 = Utils.bytesToObject(data, 1372, 'uint', 4);
            fibRbFcLcb2007.fcUnused22 = Utils.bytesToObject(data, 1376, 'uint', 4);
            fibRbFcLcb2007.lcbUnused22 = Utils.bytesToObject(data, 1380, 'uint', 4);
            fibRbFcLcb2007.fcUnused33 = Utils.bytesToObject(data, 1384, 'uint', 4);
            fibRbFcLcb2007.lcbUnused33 = Utils.bytesToObject(data, 1388, 'uint', 4);
            fibRbFcLcb2007.fcSttbfBkmkArto = Utils.bytesToObject(data, 1392, 'uint', 4);
            fibRbFcLcb2007.lcbSttbfBkmkArto = Utils.bytesToObject(data, 1396, 'uint', 4);
            fibRbFcLcb2007.fcPlcfBkfArto = Utils.bytesToObject(data, 1400, 'uint', 4);
            fibRbFcLcb2007.lcbPlcfBkfArto = Utils.bytesToObject(data, 1404, 'uint', 4);
            fibRbFcLcb2007.fcPlcfBklArto = Utils.bytesToObject(data, 1408, 'uint', 4);
            fibRbFcLcb2007.lcbPlcfBklArto = Utils.bytesToObject(data, 1412, 'uint', 4);
            fibRbFcLcb2007.fcArtoData = Utils.bytesToObject(data, 1416, 'uint', 4);
            fibRbFcLcb2007.lcbArtoData = Utils.bytesToObject(data, 1420, 'uint', 4);
            fibRbFcLcb2007.fcUnused44 = Utils.bytesToObject(data, 1424, 'uint', 4);
            fibRbFcLcb2007.lcbUnused44 = Utils.bytesToObject(data, 1428, 'uint', 4);
            fibRbFcLcb2007.fcUnused5 = Utils.bytesToObject(data, 1432, 'uint', 4);
            fibRbFcLcb2007.lcbUnused5 = Utils.bytesToObject(data, 1436, 'uint', 4);
            fibRbFcLcb2007.fcUnused6 = Utils.bytesToObject(data, 1440, 'uint', 4);
            fibRbFcLcb2007.lcbUnused6 = Utils.bytesToObject(data, 1444, 'uint', 4);
            fibRbFcLcb2007.fcOssTheme = Utils.bytesToObject(data, 1448, 'uint', 4);
            fibRbFcLcb2007.lcbOssTheme = Utils.bytesToObject(data, 1452, 'uint', 4);
            fibRbFcLcb2007.fcColorSchemeMapping = Utils.bytesToObject(data, 1456, 'uint', 4);
            fibRbFcLcb2007.lcbColorSchemeMapping = Utils.bytesToObject(data, 1460, 'uint', 4);
        }
        return fibRbFcLcb97;
    }
    
    static readFibRgLw97(s, size) {
        let fibRgLw97Size = 88;
        if (((size) * 4) !== fibRgLw97Size) 
            throw new Error("Invalid FibRgLw97 size");
        let data = ReadUtils.readExact(s, fibRgLw97Size);
        let fibRgLw97 = new FibRgLw97();
        fibRgLw97.cbMac = Utils.bytesToObject(data, 0, 'uint', 4);
        fibRgLw97.ccpText = Utils.bytesToObject(data, 12, 'uint', 4);
        fibRgLw97.ccpFtn = Utils.bytesToObject(data, 16, 'uint', 4);
        fibRgLw97.ccpHdd = Utils.bytesToObject(data, 20, 'uint', 4);
        fibRgLw97.ccpAtn = Utils.bytesToObject(data, 28, 'uint', 4);
        fibRgLw97.ccpEdn = Utils.bytesToObject(data, 32, 'uint', 4);
        fibRgLw97.ccpTxbx = Utils.bytesToObject(data, 36, 'uint', 4);
        fibRgLw97.ccpHdrTxbx = Utils.bytesToObject(data, 40, 'uint', 4);
        return fibRgLw97;
    }
    
    static readFibRgW97(s, size) {
        let fibRgW97Size = 28;
        if (((size) * 2) < fibRgW97Size) 
            throw new Error("Invalid FibRgW97 size");
        let data = ReadUtils.readExact(s, fibRgW97Size);
        let fibRgW97 = new FibRgW97();
        fibRgW97.lidFE = Utils.bytesToObject(data, 26, 'ushort', 2);
        return fibRgW97;
    }
    
    static readFibBase(s) {
        let wordFileSignature = 0xA5EC;
        let wordFileSignature6 = 0xA5DC;
        let data = ReadUtils.readExact(s, 32);
        let fibBase = new FibBase();
        fibBase.wIdent = Utils.bytesToObject(data, 0, 'ushort', 2);
        fibBase.nFib = Utils.bytesToObject(data, 2, 'ushort', 2);
        if (Utils.compareUnsigned(fibBase.wIdent, wordFileSignature6) == 0) 
            return null;
        if (Utils.compareUnsigned(fibBase.wIdent, wordFileSignature) != 0) 
            throw new Error("Invalid word file signature");
        fibBase.lid = Utils.bytesToObject(data, 6, 'ushort', 2);
        fibBase.pnNext = Utils.bytesToObject(data, 8, 'ushort', 2);
        let flags = 0;
        flags = Utils.bytesToObject(data, 10, 'ushort', 2);
        fibBase.fDot = (((flags) & 0x0001)) !== 0;
        fibBase.fGlsy = (((flags) & 0x0002)) !== 0;
        fibBase.fComplex = (((flags) & 0x0004)) !== 0;
        fibBase.fHasPic = (((flags) & 0x0008)) !== 0;
        fibBase.cQuickSaves = ((((flags) >>> 4)) & 0x0F);
        fibBase.fEncrypted = (((flags) & 0x0100)) !== 0;
        fibBase.fWhichTblStm = (((flags) & 0x0200)) !== 0;
        fibBase.fReadOnlyRecommended = (((flags) & 0x0400)) !== 0;
        fibBase.fWriteReservation = (((flags) & 0x0800)) !== 0;
        fibBase.fExtChar = (((flags) & 0x1000)) !== 0;
        fibBase.fLoadOverride = (((flags) & 0x2000)) !== 0;
        fibBase.fFarEast = (((flags) & 0x4000)) !== 0;
        fibBase.fObfuscated = (((flags) & 0x8000)) !== 0;
        fibBase.lKey = Utils.bytesToObject(data, 14, 'uint', 4);
        fibBase.envr = data[18];
        flags = data[19];
        fibBase.fMac = (((flags) & 0x0001)) !== 0;
        fibBase.fEmptySpecial = (((flags) & 0x0002)) !== 0;
        fibBase.fLoadOverridePage = (((flags) & 0x0004)) !== 0;
        return fibBase;
    }
}


module.exports = FibStructuresReader