"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Tiles
 */
Object.defineProperty(exports, "__esModule", { value: true });
const core_bentley_1 = require("@itwin/core-bentley");
const core_common_1 = require("@itwin/core-common");
const ImdlModel_1 = require("../../common/imdl/ImdlModel");
const ParseImdlDocument_1 = require("../../common/imdl/ParseImdlDocument");
const RegisterWorker_1 = require("../RegisterWorker");
let timeline;
(0, RegisterWorker_1.registerWorker)({
    parse: (options) => {
        const result = (0, ParseImdlDocument_1.parseImdlDocument)({
            ...options,
            data: options.data,
            timeline,
        });
        if (typeof result === "number")
            return result;
        return { result, transfer: (0, ImdlModel_1.collectTransferables)(result) };
    },
    setTimeline: (arg) => {
        (0, core_bentley_1.assert)(undefined === timeline, "setTimeline must be called only once");
        timeline = Array.isArray(arg) ? core_common_1.RenderSchedule.Script.fromJSON(arg) : core_common_1.RenderSchedule.ModelTimeline.fromJSON(arg);
    },
});
//# sourceMappingURL=Worker.js.map