"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var a=i(require("react")),b=i(require("prop-types")),c=require("react-i18next"),d=i(require("./ViewableJSONDisplay")),e=i(require("./ExpandableDisplay")),f=require("./CodeViewer"),g=require("carbon-components-react"),h=["schema","example","exampleLoading","exampleError","id"];function i(a){return a&&a.__esModule?a:{default:a}}function j(a){"@babel/helpers - typeof";return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},j(a)}function k(a,b){if(null==a)return{};var c,d,e=l(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function l(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}var m=function(b){var i=b.schema,l=b.example,m=b.exampleLoading,n=b.exampleError,o=b.id,p=k(b,h),q=(0,c.useTranslation)(),r=q.t,s=function(b){return a["default"].createElement(f.CodeViewer,{"data-testid":"channel-data-error",highlight:!1},b)},t=function(b,c,h){var i,k;return b?i=a["default"].createElement(g.InlineLoading,{"data-testid":"example-loading-icon"}):c?"object"===j(c)?(i=a["default"].createElement(d["default"],{content:c}),k=JSON.stringify(c)):(i=a["default"].createElement(f.CodeViewer,null,c+""),k=c+""):h?(k=JSON.stringify(h),i=s(k)):(k=r("no_examples"),i=s(r("no_examples"))),a["default"].createElement("div",{"data-testid":"schema-example"},a["default"].createElement(e["default"],{copyableContent:k},i))};return a["default"].createElement("div",p,a["default"].createElement(g.Tabs,{className:"channel__schema"},a["default"].createElement(g.Tab,{id:"".concat(o,"_schema"),label:r("schema"),title:r("schema")},a["default"].createElement("div",{"data-testid":"schema"},a["default"].createElement(e["default"],{copyableContent:JSON.stringify(i,null,2)},i&&a["default"].createElement(d["default"],{content:i}),!i&&s(r("invalid_schema"))))),a["default"].createElement(g.Tab,{id:"".concat(o,"_example"),label:r("example"),title:r("example")},t(m,l,n))))};m.propTypes={schema:b["default"].object,example:b["default"].any,exampleLoading:b["default"].bool,exampleError:b["default"].string};var n=m;exports["default"]=n;