"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Preview = void 0; var morphux_1 = require("morphux"); var Preview = /** @class */ (function () { function Preview(Main) { this.container = document.querySelector(".ntsh_tab[tabid=\"preview\"]"); this._Main = Main; this.registerTabListener(); } Preview.prototype.createPreviewFrame = function () { var container = (0, morphux_1.ce)('div', 'ntsh_preview'); var urlParams = new URLSearchParams(window.location.search); var transform = urlParams.has('transform') ? "?transform=".concat(urlParams.get('transform')) : ''; var frame = (0, morphux_1.ce)('iframe', 'ntsh_preview-frame', { src: "http://".concat(window.location.hostname, ":84").concat(transform), }); container.appendChild(frame); this.container.appendChild(container); }; Preview.prototype.removePreviewFrame = function () { this.container.innerHTML = ''; }; Preview.prototype.registerTabListener = function () { var _this = this; this._Main.TabController.registerListener('preview', function (visible) { if (visible) _this.createPreviewFrame(); else _this.removePreviewFrame(); }); }; return Preview; }()); exports.Preview = Preview; //# sourceMappingURL=preview.js.map