/**
 * amis-ui v6.12.0-beta.0
 * Copyright 2018-2025 fex
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var tslib = require('tslib');
var React = require('react');
var amisCore = require('amis-core');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

var __react_jsx__ = require('react');
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
(__react_jsx__["default"] || __react_jsx__).Fragment;
var Html = /** @class */ (function (_super) {
    tslib.__extends(Html, _super);
    function Html(props) {
        var _this = _super.call(this, props) || this;
        _this.htmlRef = _this.htmlRef.bind(_this);
        return _this;
    }
    Html.prototype.componentDidUpdate = function (prevProps) {
        if (this.props.html !== prevProps.html) {
            this._render();
        }
    };
    Html.prototype.htmlRef = function (dom) {
        this.dom = dom;
        if (!dom) {
            return;
        }
        this._render();
    };
    Html.prototype._render = function () {
        var _a = this.props, html = _a.html, filterHtml = _a.filterHtml;
        if (html) {
            this.dom.innerHTML = filterHtml ? filterHtml(html) : html;
        }
    };
    Html.prototype.render = function () {
        var _a = this.props, className = _a.className, wrapperComponent = _a.wrapperComponent, inline = _a.inline; _a.classPrefix; var cx = _a.classnames;
        var Component = wrapperComponent || (inline ? 'span' : 'div');
        return (_J$X_(Component, { ref: this.htmlRef, className: cx("Html", className) }));
    };
    Html.defaultProps = {
        inline: true
    };
    return Html;
}(React__default["default"].Component));
var Html$1 = amisCore.themeable(Html);

exports.Html = Html;
exports["default"] = Html$1;
