import{m as n,A as e,B as o,C as s,n as t,o as r,q as a,r as c,s as i,y as l,z as d,g as u}from"../../vendor.js";import{useRef as f}from"react";import{u as m,a as p}from"../../hooks.js";import{E as j}from"../Element/index.js";import{C as x}from"../Catalogue/index.js";import{I as v}from"../Icon/index.js";function h(n,e){var o=l(n);if(d){var s=d(n);e&&(s=u(s).call(s,(function(e){return i(n,e).enumerable}))),o.push.apply(o,s)}return o}function b(n){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?h(Object(o),!0).forEach((function(e){t(n,e,o[e])})):r?a(n,r(o)):h(Object(o)).forEach((function(e){c(n,e,i(o,e))}))}return n}var k=function(){var t=f(),r=m(),a=r.components,c=r.content,i=r.addElement,l=r._setSettingsHolderRef,d=r.undo,u=r.redo,h=r.isUndoPossible,k=r.isRedoPossible,g=r.getText,C=r.getOverrides,y=p(),E=y.debug,N=y.historyButtonsEnabled;return n.jsxs("div",{className:"oak-builder",children:[!1!==N&&n.jsxs("div",{className:"oak-undo-redo",children:[n.jsx("a",{onClick:function(){return h&&d()},className:e("oak-undo",!h&&"disabled"),children:n.jsx(v,{children:"undo"})}),n.jsx("a",{onClick:function(){return k&&u()},className:e("oak-redo",!k&&"disabled"),children:n.jsx(v,{children:"redo"})})]}),o(c).call(c,(function(e,o){return n.jsx(j,{index:o,element:e},e.id||o)})),n.jsx("div",{className:"oak-add-element",children:n.jsx(x,{ref:t,onAppend:function(n){var e,o,s=(null===(e=n.construct)||void 0===e?void 0:e.call(n))||{},r=C("component",s.type),a=b(b({},s),{},{content:"function"==typeof s.content?s.content(g):s.content});i(b(b({},a),null!=r&&r.construct&&"function"==typeof r.construct?r.construct(a):{})),null===(o=t.current)||void 0===o||o.close()},onPaste:function(n){var e;i(n,{normalizeOptions:{resetIds:!0}}),null===(e=t.current)||void 0===e||e.close()}})}),n.jsx("div",{ref:l}),E&&n.jsxs("pre",{children:[n.jsx("p",{children:"Content:"}),s(c,null,2),n.jsx("p",{children:"Components:"}),s(a,null,2)]})]})};export{k as B};
//# sourceMappingURL=index.js.map
