Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-edit-react

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-edit-react - npm Package Compare versions

Comparing version 1.15.1 to 1.15.2

2

build/index.cjs.js

@@ -1,1 +0,1 @@

"use strict";var e=require("react/jsx-runtime"),n=require("react"),t=require("object-property-assigner"),r=require("object-property-extractor");function o(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,s)}l((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var a=[],i=[];!function(e,n){if(e&&"undefined"!=typeof document){var t,r=!0===n.prepend?"prepend":"append",o=!0===n.singleTag,s="string"==typeof n.container?document.querySelector(n.container):document.getElementsByTagName("head")[0];if(o){var l=a.indexOf(s);-1===l&&(l=a.push(s)-1,i[l]={}),t=i[l]&&i[l][r]?i[l][r]:i[l][r]=c()}else t=c();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),n.attributes)for(var t=Object.keys(n.attributes),o=0;o<t.length;o++)e.setAttribute(t[o],n.attributes[t[o]]);var a="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(a,e),e}}(":root {\n --jer-select-border: #b6b6b6;\n --jer-select-focus: #777;\n --jer-select-arrow: #777;\n --jer-form-border: 1px solid #ededf0;\n --jer-form-border-focus: 1px solid #e2e2e2;\n --jer-expand-transition-time: 0.5s;\n --jer-highlight-color: #b3d8ff;\n}\n\n.jer-visible {\n opacity: 1;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-hidden {\n opacity: 0;\n transition: var(--jer-expand-transition-time);\n}\n\n/* Select styled as per:\nhttps://moderncss.dev/custom-select-styles-with-pure-css/\n*/\n\n.jer-select select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: transparent;\n border: none;\n padding: 0 1em 0 0;\n margin: 0;\n /* width: 100%; */\n font-family: inherit;\n font-size: 0.8em;\n color: black;\n cursor: inherit;\n line-height: inherit;\n z-index: 1;\n outline: none;\n}\nselect::-ms-expand {\n display: none;\n}\n\n.jer-select {\n display: grid;\n grid-template-areas: 'select';\n align-items: center;\n position: relative;\n min-width: 12ch;\n max-width: 15ch;\n border: 1px solid var(--jer-select-border);\n border-radius: 0.25em;\n padding: 0.25em 0.5em;\n cursor: pointer;\n line-height: 1.1;\n background-color: #fff;\n background-image: linear-gradient(to top, #f9f9f9, #fff 33%);\n}\n.jer-select select,\n.jer-select::after {\n grid-area: select;\n}\n.jer-select:not(.jer-select--multiple)::after {\n content: '';\n justify-self: end;\n width: 0.8em;\n height: 0.5em;\n background-color: var(--jer-select-arrow);\n -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n}\n\nselect:focus + .focus {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n border: 1px solid var(--jer-select-focus);\n border-radius: inherit;\n}\n\n.jer-editor-container {\n position: relative;\n font-size: 16px;\n line-height: 1;\n padding: 1em;\n padding-left: 2em;\n /* margin-top: 1em; */\n /* margin-bottom: 1em; */\n border-radius: 0.5em;\n text-align: left;\n}\n\n.jer-editor-container textarea {\n color: var(--jer-input-color);\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n}\n\n.jer-editor-container textarea:focus {\n border: var(--jer-form-border-focus);\n}\n\n.jer-editor-container input {\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n font-family: inherit;\n}\n\n.jer-editor-container input:focus {\n border: var(--jer-form-border-focus);\n}\n\n/* Input highlighted text */\n.jer-editor-container ::selection {\n background-color: var(--jer-highlight-color);\n}\n\n/* .jer-editor-container select {\n color: red;\n} */\n\n/* .jer-component {\n} */\n\n.jer-collection-header-row,\n.jer-value-main-row {\n display: flex;\n min-height: 1.7em;\n gap: 0.3em;\n align-items: center;\n}\n\n.jer-collection-header-row {\n display: flex;\n flex-wrap: wrap;\n}\n\n/* .jer-brackets {\n} */\n\n/* .jer-bracket-outside {\n} */\n\n/* .jer-collection-item-count {\n} */\n\n.jer-collapse-icon {\n position: absolute;\n left: -1.2em;\n top: 0.35em;\n}\n\n.jer-collection-inner {\n position: relative;\n}\n\n.jer-collection-text-edit {\n display: flex;\n flex-direction: column;\n gap: 0.3em;\n align-items: flex-start;\n}\n\n.jer-collection-text-area {\n resize: both;\n padding-top: 0.2em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-bottom: 0;\n overflow: hidden;\n max-height: 40em;\n font-family: inherit;\n font-size: 0.85em;\n}\n\n.jer-collection-input-button-row {\n display: flex;\n justify-content: flex-end;\n font-size: 150%;\n margin-top: 0.4em;\n}\n\n/* .jer-collection-element {\n} */\n\n.jer-collection-error-row {\n position: absolute;\n bottom: 0.5em;\n}\n\n/* .jer-collection-error-row-edit {\n} */\n\n.jer-error-slug {\n margin-left: 1em;\n}\n\n.jer-value-component {\n position: relative;\n}\n\n.jer-value-main-row {\n display: flex;\n gap: 0;\n}\n\n.jer-value-and-buttons {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-left: 0.5em;\n}\n\n.jer-value-error-row {\n position: absolute;\n}\n\n.jer-value-string {\n line-height: 1.3em;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.jer-hyperlink {\n text-decoration: underline;\n}\n\n.jer-input-text {\n resize: none;\n margin: 0;\n height: 1.4em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-top: 0.25em;\n padding-bottom: 0.2em;\n min-width: 6em;\n overflow: hidden;\n line-height: 1.2em;\n font-family: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-number {\n} */\n\n/* .jer-value-boolean {\n} */\n\n.jer-input-boolean {\n transform: scale(1.5);\n margin-left: 0.3em;\n margin-right: 0.3em;\n}\n\n/* .jer-value-null {\n} */\n\n.jer-value-object {\n}\n\n.jer-key-text {\n word-break: break-word;\n line-height: 1.1em;\n white-space: pre-wrap;\n}\n\n.jer-key-edit {\n padding: 0 0.3em;\n font-size: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-array {\n} */\n\n.jer-value-invalid {\n opacity: 0.5;\n font-style: italic;\n}\n\n.jer-input-number {\n min-width: 3em;\n font-size: 90%;\n}\n\n/* .jer-input-component {\n} */\n\n.jer-edit-buttons,\n.jer-confirm-buttons {\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 1em;\n}\n\n.jer-input-buttons {\n gap: 0.4em;\n}\n\n.jer-edit-buttons {\n gap: 0.4em;\n margin-left: 0.5em;\n opacity: 0;\n}\n\n.jer-confirm-buttons {\n gap: 0.2em;\n margin-left: 0.4em;\n}\n\n.jer-edit-buttons:hover {\n opacity: 1;\n position: relative;\n}\n\n.jer-collection-header-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-main-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-and-buttons:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n/* .jer-input-buttons {\n} */\n\n.jer-copy-pulse {\n position: relative;\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-copy-pulse:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n.jer-copy-pulse:after {\n content: '';\n display: block;\n position: absolute;\n border-radius: 50%;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: all 0.5s;\n box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);\n}\n\n.jer-copy-pulse:active:after {\n box-shadow: 0 0 0 0 var(--jer-icon-copy-color);\n position: absolute;\n border-radius: 4em;\n left: 0;\n top: 0;\n opacity: 1;\n transition: 0s;\n}\n\n.jer-copy-pulse:active {\n top: 0.07em;\n}\n\n.jer-rotate-90 {\n transform: rotate(-90deg);\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-accordion-icon {\n /* font-size: '2em'; */\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-icon:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n/* For displaying keys that are purely <empty string> \"\" */\n.jer-empty-string::after {\n content: '<empty string>';\n font-style: italic;\n font-size: 90%;\n}\n\n.jer-drag-n-drop-padding {\n height: 0.5em;\n border: 1px dashed #e0e0e0;\n border-radius: 0.3em;\n}\n",{});const s=({className:n,name:t,value:r,setValue:o,handleKeyPress:a,styles:i})=>{if("string"!=typeof r)return null;const s="\n"===r.slice(-1)?r+".":r;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${t}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},i),rows:1,className:n,name:`${t}_textarea`,value:r,onChange:e=>o(e.target.value),autoFocus:!0,onFocus:e=>{r.length<40&&e.target.select()},onKeyDown:a}),e.jsx("span",{className:n,style:Object.assign({visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent"},i),children:s})]})},l={default:{displayName:"Default",fragments:{edit:"rgb(42, 161, 152)"},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},collection:{},collectionInner:{},collectionElement:{},dropZone:{},property:"#292929",bracket:{color:"rgb(0, 43, 54)",fontWeight:"bold"},itemCount:{color:"rgba(0, 0, 0, 0.3)",fontStyle:"italic"},string:"rgb(203, 75, 22)",number:"rgb(38, 139, 210)",boolean:"green",null:{color:"rgb(220, 50, 47)",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"rgb(0, 43, 54)",iconEdit:"edit",iconDelete:"rgb(203, 75, 22)",iconAdd:"edit",iconCopy:"rgb(38, 139, 210)",iconOk:"green",iconCancel:"rgb(203, 75, 22)"}},githubDark:{displayName:"Github Dark",styles:{container:{backgroundColor:"#0d1117",color:"white"},dropZone:"rgba(165, 214, 255, 0.17)",property:"#E6EDF3",bracket:"#56d364",itemCount:"#8B949E",string:"#A5D6FF",number:"#D2A8FF",boolean:{color:"#FF7B72",fontSize:"90%",fontWeight:"bold"},null:"green",iconCollection:"#D2A8FF",iconEdit:"#D2A8FF",iconDelete:"rgb(203, 75, 22)",iconAdd:"rgb(203, 75, 22)",iconCopy:"#A5D6FF",iconOk:"#56d364",iconCancel:"rgb(203, 75, 22)"}},githubLight:{displayName:"Github Light",styles:{container:"white",property:"#1F2328",bracket:"#00802e",itemCount:"#8B949E",string:"#0A3069",number:"#953800",boolean:{color:"#CF222E",fontSize:"90%",fontWeight:"bold"},null:"#FF7B72",iconCollection:"#8250DF",iconEdit:"#8250DF",iconDelete:"rgb(203, 75, 22)",iconAdd:"#8250DF",iconCopy:"#57606A"}},monoDark:{displayName:"Black & White",fragments:{lightText:{color:"white"},midGrey:"#5c5c5c"},styles:{container:["lightText",{backgroundColor:"black"}],dropZone:"#e0e0e029",property:"lightText",bracket:"midGrey",itemCount:"#4a4a4a",string:"#a8a8a8",number:"#666666",boolean:{color:"#848484",fontStyle:"italic"},null:"#333333",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},monoLight:{fragments:{midGrey:"#a3a3a3"},displayName:"White & Black",styles:{container:"white",property:"black",bracket:"midGrey",itemCount:"#b5b5b5",string:"#575757",number:"#999999",boolean:{color:"#7b7b7b",fontStyle:"italic"},null:"#cccccc",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},candyWrapper:{displayName:"Candy Wrapper",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},darkBlue:{color:"#2B2D42"}},styles:{container:"minty",property:"pop",dropZone:"#eb121217",bracket:"dark",itemCount:"pale",string:"mid",number:["darkBlue",{fontSize:"85%"}],boolean:["mid",{fontStyle:"italic",fontWeight:"bold",fontSize:"80%"}],null:["#cccccc",{fontWeight:"bold"}],input:{border:"1px solid rgb(115, 194, 198)"},iconCollection:"#1D3557",iconEdit:"#457B9D",iconDelete:"#E63946",iconAdd:"#2B2D42",iconCopy:"#1D3557",iconCancel:"#E63946"}},psychedelic:{displayName:"Psychedelic",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},fluroYellow:"rgb(242, 228, 21)",fluroGreen:"rgb(68, 255, 62)",hotPink:"#f7379a"},styles:{container:{backgroundColor:"unset",background:"linear-gradient(90deg, hsla(333, 100%, 53%, 1) 0%, hsla(33, 94%, 57%, 1) 100%)",color:"black"},dropZone:"fluroYellow",property:"black",bracket:"fluroYellow",itemCount:["pale",{opacity:.7}],string:"white",number:["#33d9ff",{fontSize:"90%",fontWeight:"bold"}],boolean:["fluroGreen",{fontWeight:"bold",fontSize:"80%"}],null:["black",{fontWeight:"bold",opacity:.3,backgroundColor:"rgb(255, 255, 255, 0.5)",padding:"0 0.4em",borderRadius:"0.4em"}],iconCollection:"fluroYellow",iconEdit:["black"],iconDelete:["white",{opacity:.5}],iconAdd:["white",{opacity:.5}],iconCopy:"rgb(32, 84, 242)",iconOk:"fluroGreen",iconCancel:"hotPink"}}},c=l.default,d=n.createContext({getStyles:()=>({}),icons:{}}),u=({theme:n="default",icons:t={},children:r})=>{const o=g(n);return e.jsx(d.Provider,{value:{getStyles:(e,n)=>"function"==typeof o[e]?o[e](n):o[e],icons:t},children:r})},p=()=>n.useContext(d),g=e=>{var n,t,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((n=>"default"===e?{}:"string"==typeof n?h(l[n],a):m(n)?h({fragments:{},styles:n},a):h(n,a))),s=h(c,{});Object.keys(s).forEach((e=>{const n=e;i.forEach((e=>{e[n]&&(s[n]=Object.assign(Object.assign({},s[n]),e[n]))}))}));const d=Object.assign({},s);return Object.entries(a).forEach((([e,n])=>{const t=e;d[t]=e=>{const r=n(e)||{};return Object.assign(Object.assign({},s[t]),r)}})),"function"!=typeof(null==d?void 0:d.inputHighlight)&&(null===(n=null==d?void 0:d.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(t=null==d?void 0:d.inputHighlight)||void 0===t?void 0:t.backgroundColor),"function"!=typeof(null==d?void 0:d.iconCopy)&&(null===(r=null==d?void 0:d.iconCopy)||void 0===r?void 0:r.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(o=null==d?void 0:d.iconCopy)||void 0===o?void 0:o.color),d},h=(e,n)=>{const{fragments:t,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a;if("function"==typeof o)return n[e]=o,Object.assign({},r);if("string"==typeof o){const n=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:o;return"string"==typeof n?Object.assign(Object.assign({},r),{[y[e]]:n}):Object.assign(Object.assign({},r),n)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},m=e=>!("styles"in e),y={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",property:"color",bracket:"color",itemCount:"color",string:"color",number:"color",boolean:"color",null:"color",input:"color",inputHighlight:"backgroundColor",error:"color",iconCollection:"color",iconEdit:"color",iconDelete:"color",iconAdd:"color",iconCopy:"color",iconOk:"color",iconCancel:"color"},j="**INVALID_FUNCTION**",b=(e,n=200)=>"string"==typeof e?e.length<n?e:`${e.slice(0,n-2).trim()}...`:e,f=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),v=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,stringTruncate:c,showStringQuotes:d,nodeData:u})=>{const{getStyles:g}=p(),h=f(o),m=d?'"':"";return r?e.jsx(s,{className:"jer-input-text",name:h,value:n,setValue:t,isEditing:r,handleKeyPress:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&l():i()},styles:g("input",u)}):e.jsxs("div",{id:`${h}_display`,onDoubleClick:()=>a(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&a(!0)},className:"jer-value-string",style:g("string",u),children:[m,b(n,c),m]})},E=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l})=>{const{getStyles:c}=p();return r?e.jsx("input",{className:"jer-input-number",type:"text",name:f(o),value:n,onChange:e=>t(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{switch(e.key){case"Enter":i();break;case"Escape":s();break;case"ArrowUp":e.preventDefault(),t(Number(n)+1);break;case"ArrowDown":e.preventDefault(),t(Number(n)-1)}},style:Object.assign({width:String(n).length/1.5+2+"em"},c("input",l))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:c("number",l),children:n})},x=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l})=>{const{getStyles:c}=p();return r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:f(o),checked:n,onChange:()=>t(!n),onKeyDown:e=>{"Enter"===e.key?i():"Escape"===e.key&&s()},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:c("boolean",l),children:String(n)})},D=({value:t,isEditing:r,setIsEditing:o,handleEdit:a,handleCancel:i,nodeData:s})=>{const{getStyles:l}=p();n.useEffect((()=>(r&&document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c))),[r]);const c=e=>{"Enter"===e.key?a():"Escape"===e.key&&i()};return e.jsx("div",{onDoubleClick:()=>o(!0),className:"jer-value-null",style:l("null",s),children:String(t)})},w=({value:n})=>{let t="Error!";switch(typeof n){case"string":n===j&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:t})},k=({size:n,style:t,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),e.jsx("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]}),C=({size:n,style:t,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,transform:"translate(0, 0.5)",children:[e.jsx("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),e.jsx("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),S=({size:n,style:t,className:r})=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"})}),O=({size:n,style:t,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),e.jsx("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),e.jsx("path",{d:"M15 10l-4 4 4 4"})]}),N=({size:n,style:t,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),e.jsx("path",{d:"M22 4L12 14.01l-3-3"})]}),A=({size:n,style:t,className:r})=>e.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"})}),T=({size:n,style:t,className:r})=>e.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})}),F=({name:n,nodeData:t,rotate:r})=>{var o,a,i,s,l,c,d;const{getStyles:u,icons:g}=p(),h={size:"1.4em",className:"jer-icon"};switch(n){case"add":return null!==(o=null==g?void 0:g.add)&&void 0!==o?o:e.jsx(k,Object.assign({},h,{style:u("iconAdd",t)}));case"edit":return null!==(a=null==g?void 0:g.edit)&&void 0!==a?a:e.jsx(C,Object.assign({},h,{style:u("iconEdit",t)}));case"delete":return null!==(i=null==g?void 0:g.delete)&&void 0!==i?i:e.jsx(S,Object.assign({},h,{style:u("iconDelete",t),size:"1.45em"}));case"copy":return null!==(s=null==g?void 0:g.copy)&&void 0!==s?s:e.jsx(O,Object.assign({},h,{style:u("iconCopy",t),size:"1.2em"}));case"ok":return null!==(l=null==g?void 0:g.ok)&&void 0!==l?l:e.jsx(N,Object.assign({},h,{style:Object.assign({fontSize:"90%"},u("iconOk",t))}));case"cancel":return null!==(c=null==g?void 0:g.cancel)&&void 0!==c?c:e.jsx(A,Object.assign({},h,{style:Object.assign({fontSize:"130%"},u("iconCancel",t))}));case"chevron":return null!==(d=null==g?void 0:g.chevron)&&void 0!==d?d:e.jsx(T,{className:"jer-accordion-icon"+(r?" jer-rotate-90":""),size:"1em",style:u("iconCollection",t)});default:return e.jsx(e.Fragment,{})}},V=({startEdit:t,handleDelete:r,handleAdd:o,enableClipboard:a,type:i,nodeData:s,translate:l})=>{const{getStyles:c}=p(),d=l("KEY_NEW",s),[u,g]=n.useState(!1),[h,m]=n.useState(d),{key:y,path:j,value:b}=s;return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:u?1:void 0},children:[a&&e.jsx("div",{onClick:e=>{let n,t="value",r="";if(a){if(!0===(e.ctrlKey||e.metaKey))n=R(j),r=n,t="path";else n=b,r=i?JSON.stringify(b,null,2):String(n);navigator.clipboard.writeText(r)}"function"==typeof a&&a({value:n,stringValue:r,path:j,key:y,type:t})},className:"jer-copy-pulse",children:e.jsx(F,{name:"copy",nodeData:s})}),t&&e.jsx("div",{onClick:t,children:e.jsx(F,{name:"edit",nodeData:s})}),r&&e.jsx("div",{onClick:r,children:e.jsx(F,{name:"delete",nodeData:s})}),o&&e.jsx("div",{onClick:()=>{"object"===i?g(!0):o("")},children:e.jsx(F,{name:"add",nodeData:s})}),u&&o&&"object"===i&&e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:h,onChange:e=>m(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&o?(g(!1),o(h),m(d)):"Escape"===e.key&&(g(!1),m(d))},style:c("input",s)}),e.jsx(P,{onOk:()=>{h&&(g(!1),o(h))},onCancel:()=>{g(!1)},nodeData:s})]})]})},P=({onOk:n,onCancel:t,nodeData:r})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[e.jsx("div",{onClick:n,children:e.jsx(F,{name:"ok",nodeData:r})}),e.jsx("div",{onClick:t,children:e.jsx(F,{name:"cancel",nodeData:r})})]}),R=e=>e.reduce(((e,n)=>"number"==typeof n?`${e}[${n}]`:""===e?n:`${e}.${n}`),""),M=["string","number","boolean","null","object","array"],z=(e=[],n)=>{const t=e.filter((({condition:e})=>e(n)));if(0===t.length)return{};const r=t[0],{element:o,wrapperElement:a,customNodeProps:i,wrapperProps:s,hideKey:l=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:p=!0}=r,g=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:a,customNodeProps:i,wrapperProps:s,hideKey:l,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:p},g)},I=e=>null!==e&&"object"==typeof e,_=(e,n,t,r="")=>{if(!t&&!r)return!0;switch(e){case"collection":if(t){if(t(n,r))return!0;if(!L(r,n,t))return!1}if(!t&&r&&!L(r,n))return!1;break;case"value":if(t&&!t(n,r))return!1;if(!t&&r&&!K(n,r))return!1}return!0},L=(e="",n,t=K)=>{const r=n.value;return Object.entries(r).some((([o,a])=>{const i=[...n.path,o],s=Object.assign(Object.assign({},n),{key:o,path:i,level:n.level+1,value:a,size:i.length,parentData:r});return I(a)?L(e,s,t):t(s,e)}))},K=(e,n="")=>{const{value:t}=e;if(null===t&&"null".includes(n.toLowerCase()))return!0;switch(typeof t){case"string":return t.toLowerCase().includes(n.toLowerCase());case"number":return!!String(t).includes(n);case"boolean":return t?"true".includes(n.toLowerCase())||"1"===n:"false".includes(n.toLowerCase())||"0"===n;default:return!1}},W=({key:e,path:n},t="")=>!!K({value:e},t)||!!n.some((e=>K({value:e},t))),B=n.createContext({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),G=({children:t})=>{const[r,o]=n.useState(null),[a,i]=n.useState(null),[s,l]=n.useState({path:null,pathString:null});return e.jsx(B.Provider,{value:{collapseState:r,setCollapseState:e=>{o(e),null!==e&&setTimeout((()=>o(null)),2e3)},doesPathMatch:e=>{if(null===r)return!1;for(const[n,t]of r.path.entries())if(t!==e[n])return!1;return!0},currentlyEditingElement:a,setCurrentlyEditingElement:i,areChildrenBeingEdited:e=>null!==a&&a.includes(e),dragSource:s,setDragSource:l},children:t})},U=()=>n.useContext(B),Y=({props:e,collapsed:t})=>{const{data:r,nodeData:o,parentData:a,onEdit:i,onError:s,showErrorMessages:l,restrictEditFilter:c,restrictDeleteFilter:d,restrictAddFilter:u,restrictDragFilter:p,translate:g}=e,{currentlyEditingElement:h,setCurrentlyEditingElement:m}=U(),[y,j]=n.useState(null),b=Object.assign(Object.assign({},o),{collapsed:t}),{path:v,key:E,size:x}=b,D=f(v),w=n.useMemo((()=>!c(b)),[b]),k=n.useMemo((()=>!d(b)),[b]),C=n.useMemo((()=>!u(b)),[b]),S=n.useMemo((()=>!p(b)&&k&&null===h),[b]),O=e=>{l&&(j(e),setTimeout((()=>j(null)),2500)),console.warn("Error",e)},N=n.useMemo((()=>(e,n)=>{O(e.message),s&&s({currentData:b.fullData,errorValue:n,currentValue:r,name:E,path:v,error:e})}),[s,l]),A=h===D,T=h===`key_${D}`,F="number"==typeof v.slice(-1)[0];return{pathString:D,nodeData:b,path:v,name:E,size:x,canEdit:w,canDelete:k,canAdd:C,canDrag:S,error:y,showError:O,onError:N,setError:j,handleEditKey:e=>{if(m(null),E===e)return;if(!a)return;const n=v.slice(0,-1);if(Object.keys(a).includes(e))return void N({code:"KEY_EXISTS",message:g("ERROR_KEY_EXISTS",b)},e);const t=Object.fromEntries(Object.entries(a).map((([n,t])=>n===E?[e,t]:[n,t])));i(t,n).then((n=>{n&&N({code:"UPDATE_ERROR",message:n},e)}))},derivedValues:{isEditing:A,isEditingKey:T,isArray:F,canEditKey:null!==a&&w&&C&&k&&!F}}},$=({canDrag:t,canDragOnto:r,path:o,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=p(),{dragSource:d,setDragSource:u}=U(),[g,h]=n.useState(!1),m=f(o),y=n.useMemo((()=>t?{onDragStart:e=>{e.stopPropagation(),u({path:o,pathString:m})},onDragEnd:e=>{e.stopPropagation(),u({path:null,pathString:null})}}:{}),[t]),j=n.useMemo((()=>e=>r?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:n=>{n.stopPropagation(),v(e),u({path:null,pathString:null}),h(!1)},onDragEnter:n=>{var t;n.stopPropagation(),m.startsWith(null!==(t=d.pathString)&&void 0!==t?t:"")||h(e)},onDragExit:e=>{e.stopPropagation(),h(!1)}}:{}),[d,r]),b=n.useMemo((()=>r&&null!==d.pathString?e.jsx("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:o.length}},j("below"))):null),[d,r]),v=e=>{var n,t;const r=null===(n=d.path)||void 0===n?void 0:n.slice(-1)[0],c=null===(t=d.path)||void 0===t?void 0:t.slice(0,-1).join("."),u=o.slice(0,-1).join(""),{parentData:p}=a;"string"==typeof r&&p&&!Array.isArray(p)&&Object.keys(p).includes(r)&&r in p&&c!==u?s({code:"KEY_EXISTS",message:l("ERROR_KEY_EXISTS",a)},r):i(d.path,o,e).then((e=>{e&&s({code:"UPDATE_ERROR",message:e},a.value)}))};return{dragSourceProps:y,getDropTargetProps:j,BottomDropTarget:b,DropTargetPadding:({position:n,nodeData:t})=>g===n?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",t)}):null,handleDrop:v}},H=t=>{const{data:r,parentData:o,onEdit:a,onDelete:i,onChange:s,onMove:l,enableClipboard:c,canDragOnto:d,restrictTypeSelection:u,searchFilter:g,searchText:h,showLabel:m,stringTruncate:y,showStringQuotes:b,indent:f,translate:v,customNodeDefinitions:E}=t,{getStyles:x}=p(),{setCurrentlyEditingElement:D}=U(),[w,k]=n.useState("function"==typeof r?j:r),{pathString:C,nodeData:S,path:O,name:N,canEdit:A,canDelete:T,canDrag:F,error:R,onError:I,handleEditKey:L,derivedValues:K}=Y({props:t}),{dragSourceProps:W,getDropTargetProps:B,BottomDropTarget:G,DropTargetPadding:H}=$({canDrag:F,canDragOnto:d,path:O,nodeData:S,onMove:l,onError:I,translate:v}),q=z(E,S),[Q,ee]=n.useState(J(r,q)),ne=n.useCallback((e=>{if(!s)return void k(e);const n=s({currentData:S.fullData,newValue:e,currentValue:w,name:N,path:O});k(n)}),[s]);n.useEffect((()=>{k("function"==typeof r?j:r),ee(J(r,q))}),[r,R]);const{CustomNode:te,customNodeProps:re,hideKey:oe,showEditTools:ae=!0,showOnEdit:ie,showOnView:se}=q,le=[...M,...E.filter((({showInTypesSelector:e=!1,name:n})=>e&&!!n)).map((({name:e})=>e))],ce=n.useMemo((()=>{if("boolean"==typeof u)return u?[]:le;if(Array.isArray(u))return u;const e=u(S);return"boolean"==typeof e?e?[]:le:e}),[S,u]);if(!_("value",S,g,h))return null;const de=()=>{let e;switch(D(null),Q){case"object":e={[v("DEFAULT_NEW_KEY",S)]:w};break;case"array":e=null!=w?w:[];break;case"number":{const n=Number(w);e=isNaN(n)?0:n;break}default:e=w}a(e,O).then((n=>{n&&I({code:"UPDATE_ERROR",message:n},e)}))},ue=()=>{D(null),k(r),ee(J(r,q))},{isEditing:pe,isEditingKey:ge,canEditKey:he}=K,me=!pe&&R,ye=pe&&ce.length>0,je="invalid"!==Q&&!R&&ae,be=m&&ge,fe=m&&!ge&&!oe,ve={value:w,parentData:o,setValue:ne,isEditing:pe,setIsEditing:A?()=>D(C):()=>{},handleEdit:de,handleCancel:ue,path:O,stringTruncate:y,showStringQuotes:b,nodeData:S,translate:v},Ee=te&&(pe&&ie||!pe&&se)?e.jsx(te,Object.assign({},t,{value:w,customNodeProps:re,setValue:ne,handleEdit:de,handleCancel:ue,handleKeyPress:e=>{"Enter"===e.key?de():"Escape"===e.key&&ue()},isEditing:pe,setIsEditing:()=>D(C),getStyles:x})):X(J(r),ve);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:f/2+"em",position:"relative"},draggable:F},W,B("above"),{children:[G,e.jsx(H,{position:"above",nodeData:S}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:N.length>10?"wrap":"nowrap"},children:[fe&&e.jsxs("span",{className:"jer-key-text",style:Object.assign(Object.assign({},x("property",S)),{minWidth:`${Math.min(String(N).length+1,5)}ch`,flexShrink:N.length>10?1:0}),onDoubleClick:()=>he&&D(`key_${C}`),children:[""===N?e.jsx("span",{className:"jer-empty-string"}):N,":"]}),be&&e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:C,defaultValue:N,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?L(e.target.value):"Escape"===e.key&&ue()},style:{width:String(N).length/1.5+.5+"em"}}),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:Ee}),pe?e.jsx(P,{onOk:de,onCancel:ue,nodeData:S}):je&&e.jsx(V,{startEdit:A?()=>D(C):void 0,handleDelete:T?()=>{i(w,O).then((e=>{e&&I({code:"DELETE_ERROR",message:e},w)}))}:void 0,enableClipboard:c,translate:v,nodeData:S}),ye&&e.jsxs("div",{className:"jer-select",children:[e.jsx("select",{name:`${N}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const n=E.find((n=>n.name===e));if(n)a(n.defaultValue,O),ee(e);else{const n=Z(w,e,v("DEFAULT_NEW_KEY",S),(null==q?void 0:q.CustomNode)?v("DEFAULT_STRING",S):void 0);ne(n),a(n,O).then((e=>{e&&(I({code:"UPDATE_ERROR",message:e},n),D(null))}))}})(e.target.value),value:Q,children:ce.map((n=>e.jsx("option",{value:n,children:n},n)))}),e.jsx("span",{className:"focus"})]}),me&&e.jsx("span",{className:"jer-error-slug",style:x("error",S),children:R})]})]}),e.jsx(H,{position:"below",nodeData:S})]}))},J=(e,n)=>(null==n?void 0:n.CustomNode)&&(null==n?void 0:n.name)&&n.showInTypesSelector?n.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",X=(n,t)=>{const r=t.value;switch(n){case"string":return e.jsx(v,Object.assign({},t,{value:r}));case"number":return e.jsx(E,Object.assign({},t,{value:r}));case"boolean":return e.jsx(x,Object.assign({},t,{value:r}));case"null":return e.jsx(D,Object.assign({},t));default:return e.jsx(w,Object.assign({},t))}},Z=(e,n,t,r)=>{switch(n){case"string":return null!=r?r:String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;case"null":return null;case"object":return{[t]:e};case"array":return[e];default:return String(e)}},q=t=>{const{getStyles:a}=p(),{collapseState:i,setCollapseState:l,doesPathMatch:c,currentlyEditingElement:d,setCurrentlyEditingElement:u,areChildrenBeingEdited:g}=U(),{data:h,nodeData:m,parentData:y,showCollectionCount:j,onEdit:b,onAdd:f,onDelete:v,canDragOnto:E,collapseFilter:x,onMove:D,enableClipboard:w,searchFilter:k,searchText:C,indent:S,keySort:O,showArrayIndices:N,defaultValue:A,translate:T,customNodeDefinitions:R,jsonParse:M,jsonStringify:L}=t,[K,W]=n.useState(L(h)),B=x(m),[G,J]=n.useState(B),{pathString:X,nodeData:Z,path:Q,name:ee,size:ne,canEdit:te,canDelete:re,canAdd:oe,canDrag:ae,error:ie,setError:se,onError:le,handleEditKey:ce,derivedValues:de}=Y({props:t,collapsed:G}),{dragSourceProps:ue,getDropTargetProps:pe,BottomDropTarget:ge,DropTargetPadding:he}=$({canDrag:ae,canDragOnto:E,path:Q,nodeData:Z,onMove:D,onError:le,translate:T}),me=n.useRef(!B),[ye,je]=n.useState(!1);n.useEffect((()=>{W(L(h))}),[h]),n.useEffect((()=>{const e=x(Z)&&!de.isEditing;me.current=!e,J(e)}),[x]),n.useEffect((()=>{null!==i&&c(Q)&&(me.current=!0,J(i.collapsed))}),[i]);const be=n.useMemo((()=>e=>"function"!=typeof A?A:A(e)),[A]),{CustomNode:fe,customNodeProps:ve,CustomWrapper:Ee,wrapperProps:xe={},hideKey:De,showEditTools:we=!0,showOnEdit:ke,showOnView:Ce,showCollectionWrapper:Se=!0}=n.useMemo((()=>z(R,Z)),[]);if(!_("collection",Z,k,C)&&Z.level>0)return null;const Oe=Array.isArray(h)?"array":"object",Ne="array"===Oe?{open:"[",close:"]"}:{open:"{",close:"}"},Ae=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time"),Te=e=>{"Enter"===e.key&&(e.metaKey||e.shiftKey||e.ctrlKey)?Fe():"Escape"===e.key&&Pe()},Fe=()=>{try{const e=M(K);if(u(null),se(null),JSON.stringify(e)===JSON.stringify(h))return;b(e,Q).then((n=>{n&&le({code:"UPDATE_ERROR",message:n},e)}))}catch(e){le({code:"INVALID_JSON",message:T("ERROR_INVALID_JSON",Z)},K)}},Ve=Q.length>0?()=>{v(h,Q).then((e=>{e&&le({code:"DELETE_ERROR",message:e},r(h,Q))}))}:void 0,Pe=()=>{u(null),se(null),W(L(h))},{isEditing:Re,isEditingKey:Me,isArray:ze,canEditKey:Ie}=de,_e="when-closed"===j?G:j,Le=!Re&&we,Ke=(N||!ze)&&!De&&void 0!==ee,We=fe&&(Re&&ke||!Re&&Ce),Be=O&&"object"===Oe,Ge=Object.entries(h).map((([e,n])=>["array"===Oe?Number(e):e,n]));Be&&Ge.sort("function"==typeof O?(e,n)=>O(e[0],n[0]):void 0);const Ue=JSON.stringify(h,null,2).replace(/\\n/g,"\n").split("\n").length,Ye=me.current?Re?e.jsx("div",{className:"jer-collection-text-edit",children:e.jsxs("div",{children:[e.jsx(s,{className:"jer-collection-text-area",name:X,value:K,setValue:W,isEditing:Re,handleKeyPress:Te,styles:a("input",Z)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(P,{onOk:Fe,onCancel:Pe,nodeData:Z})})]})}):Ge.map((([n,r],o)=>{const i={key:n,value:r,path:[...Q,n],level:Q.length+1,index:o,size:I(r)?Object.keys(r).length:1,parentData:h,fullData:Z.fullData};return e.jsx("div",{className:"jer-collection-element",style:a("collectionElement",i),children:I(r)?e.jsx(q,Object.assign({},t,{data:r,parentData:h,nodeData:i,showCollectionCount:j,canDragOnto:te}),n):e.jsx(H,Object.assign({},t,{data:r,parentData:h,nodeData:i,canDragOnto:te,showLabel:"object"===Oe||N}),n)},n)})):null,$e=!!Se&&G;$e||(me.current=!0);const He=Object.assign(Object.assign({},t),{data:h,value:h,parentData:y,nodeData:Z,setValue:e=>o(void 0,void 0,void 0,(function*(){return yield b(e,Q)})),handleEdit:Fe,handleCancel:Pe,handleKeyPress:Te,isEditing:Re,setIsEditing:()=>u(X),getStyles:a,canDragOnto:te}),Je=We?e.jsx(fe,Object.assign({customNodeProps:ve},He,{children:Ye})):Ye,Xe=Me?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:X,defaultValue:ee,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?ce(e.target.value):"Escape"===e.key&&Pe()},style:{width:String(ee).length/1.5+.5+"em"}}):Ke&&e.jsx("span",{className:"jer-key-text",style:a("property",Z),onDoubleClick:()=>Ie&&u(`key_${X}`),children:""===ee?e.jsx("span",{className:Q.length>0?"jer-empty-string":void 0}):`${ee}:`}),Ze=Le&&e.jsx(V,{startEdit:te?()=>{me.current=!0,u(X),J(!1)}:void 0,handleAdd:oe?e=>{J(!1);const n=be(Z);"array"===Oe?f(n,[...Q,h.length]).then((e=>{e&&le({code:"ADD_ERROR",message:e},n)})):e in h?le({code:"KEY_EXISTS",message:T("ERROR_KEY_EXISTS",Z)},e):f(n,[...Q,e]).then((e=>{e&&le({code:"ADD_ERROR",message:e},n)}))}:void 0,handleDelete:re?Ve:void 0,enableClipboard:w,type:Oe,nodeData:Z,translate:T}),qe=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===Q.length?0:S/2)+"em"},a("collection",Z)),{position:"relative"}),draggable:ae},ue,pe("above"),{children:[!Re&&ge,e.jsx(he,{position:"above",nodeData:Z}),Se?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon",onClick:e=>(e=>{if(e.getModifierState("Alt"))return me.current=!0,void l({collapsed:!G,path:Q});d&&d.includes(X)||(je(!0),me.current=!0,J(!G),l(null),setTimeout((()=>je(!1)),500))})(e),children:e.jsx(F,{name:"chevron",rotate:G,nodeData:Z})}),Xe,!Re&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:a("bracket",Z),children:Ne.open})]}),!Re&&_e&&e.jsx("div",{className:"jer-collection-item-count"+(_e?" jer-visible":" jer-hidden"),style:a("itemCount",Z),children:1===ne?T("ITEM_SINGLE",Object.assign(Object.assign({},Z),{size:1}),1):T("ITEMS_MULTIPLE",Z,ne)}),e.jsx("div",{className:"jer-brackets"+($e?" jer-visible":" jer-hidden"),style:a("bracket",Z),children:Ne.close}),Ze]}):De?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[Xe,Ze]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign({maxHeight:$e?0:g(X)?void 0:3*Ue+"em",overflowY:$e||ye?"hidden":"visible",transition:`max-height ${Ae}`},a("collectionInner",Z)),children:[Je,e.jsx("div",{className:Re?"jer-collection-error-row":"jer-collection-error-row-edit",children:ie&&e.jsx("span",{className:"jer-error-slug",style:a("error",Z),children:ie})}),!Re&&Se&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:a("bracket",Z),children:Ne.close})]}),e.jsx(he,{position:"below",nodeData:Z})]}));return Ee?e.jsx(Ee,Object.assign({customNodeProps:xe},He,{children:qe})):qe},Q={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",DEFAULT_STRING:"New data!",DEFAULT_NEW_KEY:"key"},ee=(e,n)=>(t,r,o)=>((e,n,t,r,o)=>{if(n[r]){const e=n[r](t);if(null!==e)return e}const a=r in e?e[r]:Q[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,n,r,t,o),ne=({data:t,setData:r,rootName:a="root",onUpdate:i=(()=>{}),onEdit:s=i,onDelete:l=i,onAdd:c=i,onChange:d,onError:u,showErrorMessages:g=!0,enableClipboard:h=!0,indent:m=3,collapse:y=!1,showCollectionCount:j=!0,restrictEdit:b=!1,restrictDelete:f=!1,restrictAdd:v=!1,restrictTypeSelection:E=!1,restrictDrag:x=!0,searchFilter:D,searchText:w,searchDebounceTime:k=350,keySort:C=!1,showArrayIndices:S=!0,showStringQuotes:O=!0,defaultValue:N=null,minWidth:A=250,maxWidth:T="min(600px, 90vw)",rootFontSize:F,stringTruncate:V=250,translations:P={},className:R,id:M,customText:z={},customNodeDefinitions:_=[],jsonParse:L=JSON.parse,jsonStringify:K=(e=>JSON.stringify(e,null,2))})=>{const{getStyles:W}=p(),B=n.useCallback(re(y),[y]),G=n.useCallback(ee(P,z),[P,z]),[U,Y]=n.useState(w),[$,J]=(({setData:e,data:t})=>{const[r,o]=n.useState(e?void 0:t),a=n.useCallback((n=>{e?e(n):o(n)}),[e]);return n.useEffect((()=>{e||o(t)}),[t]),[e?t:r,a]})({setData:r,data:t});n.useEffect((()=>{const e=setTimeout((()=>Y(w)),k);return()=>clearTimeout(e)}),[w,k]);const X={key:a,path:[],level:0,index:0,value:$,size:"object"==typeof $&&null!==$?Object.keys($).length:1,parentData:null,fullData:$},Z=(e,n)=>o(void 0,void 0,void 0,(function*(){const t=yield e(n);if(void 0===t)return void J(n.newData);const r=ae(t)?t:["error",t],[o,a]=r;if("error"===o)return J(n.currentData),!1===a?G("ERROR_UPDATE",X):String(a);J(a)})),Q=n.useMemo((()=>re(b)),[b]),ne=n.useMemo((()=>re(f)),[f]),ie=n.useMemo((()=>re(v)),[v]),se=n.useMemo((()=>re(x)),[x]),le=n.useMemo((()=>oe(D)),[D]),ce={name:a,nodeData:X,onEdit:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=te($,n,e,"update");if(o!==a)return yield Z(s,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onDelete:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=te($,n,e,"delete");return yield Z(l,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onAdd:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=te($,n,e,"add");return yield Z(c,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onChange:d,onError:u,showErrorMessages:g,onMove:(e,n,t)=>o(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=te($,e,"","delete"),i=e.slice(-1)[0],l=n.slice(0,-1),c=n.slice(-1)[0];let d="number"==typeof c?"above"===t?c:c+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===n.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===t?{insertBefore:c}:{insertAfter:c},{newData:p,newValue:g}=te(o,[...l,d],a,"add",u);return yield Z(s,{currentData:r,newData:p,currentValue:a,newValue:g,name:n.slice(-1)[0],path:n})})),showCollectionCount:j,collapseFilter:B,restrictEditFilter:Q,restrictDeleteFilter:ne,restrictAddFilter:ie,restrictTypeSelection:E,restrictDragFilter:se,canDragOnto:!1,searchFilter:le,searchText:U,enableClipboard:h,keySort:C,showArrayIndices:S,showStringQuotes:O,indent:m,defaultValue:N,stringTruncate:V,translate:G,customNodeDefinitions:_,parentData:null,jsonParse:L,jsonStringify:K},de=Object.assign(Object.assign({},W("container",X)),{minWidth:A,maxWidth:T});return de.fontSize=null!=F?F:de.fontSize,e.jsx("div",{id:M,className:"jer-editor-container "+R,style:de,children:I($)?e.jsx(q,Object.assign({data:$},ce)):e.jsx(H,Object.assign({data:$,showLabel:!0},ce))})},te=(e,n,o,a,i={})=>{if(0===n.length)return{currentData:e,newData:o,currentValue:e,newValue:o};const s=Object.assign({remove:"delete"===a},i),l="add"!==a?r(e,n):void 0;return{currentData:e,newData:t(e,n,o,s),currentValue:l,newValue:"delete"!==a?o:void 0}},re=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:n})=>n>=e:e,oe=e=>{if(void 0!==e)return"value"===e?K:"key"===e?W:"all"===e?(e,n)=>K(e,n)||W(e,n):e},ae=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),ie=({value:n,setIsEditing:t,getStyles:r,customNodeProps:o,nodeData:a})=>{var i,s;const l=null!==(i=null==o?void 0:o.stringTruncate)&&void 0!==i?i:100,c=r("string",a);return e.jsx("div",{onDoubleClick:()=>t(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&t(!0)},className:"jer-value-string jer-hyperlink",style:c,children:e.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",style:{color:null!==(s=c.color)&&void 0!==s?s:void 0},children:['"',b(n,l),'"']})})},se={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:ie,showOnView:!0,showOnEdit:!1};exports.assign=t,exports.extract=r,exports.IconAdd=k,exports.IconCancel=A,exports.IconChevron=T,exports.IconCopy=O,exports.IconDelete=S,exports.IconEdit=C,exports.IconOk=N,exports.JsonEditor=n=>e.jsx(u,{theme:n.theme,icons:n.icons,children:e.jsx(G,{children:e.jsx(ne,Object.assign({},n))})}),exports.LinkCustomComponent=ie,exports.LinkCustomNodeDefinition=se,exports.isCollection=I,exports.matchNode=K,exports.matchNodeKey=W,exports.themes=l,exports.truncate=b;
"use strict";var e=require("react/jsx-runtime"),n=require("react"),t=require("object-property-assigner"),r=require("object-property-extractor");function o(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,s)}l((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var a=[],i=[];!function(e,n){if(e&&"undefined"!=typeof document){var t,r=!0===n.prepend?"prepend":"append",o=!0===n.singleTag,s="string"==typeof n.container?document.querySelector(n.container):document.getElementsByTagName("head")[0];if(o){var l=a.indexOf(s);-1===l&&(l=a.push(s)-1,i[l]={}),t=i[l]&&i[l][r]?i[l][r]:i[l][r]=c()}else t=c();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),n.attributes)for(var t=Object.keys(n.attributes),o=0;o<t.length;o++)e.setAttribute(t[o],n.attributes[t[o]]);var a="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(a,e),e}}(":root {\n --jer-select-border: #b6b6b6;\n --jer-select-focus: #777;\n --jer-select-arrow: #777;\n --jer-form-border: 1px solid #ededf0;\n --jer-form-border-focus: 1px solid #e2e2e2;\n --jer-expand-transition-time: 0.5s;\n --jer-highlight-color: #b3d8ff;\n}\n\n.jer-visible {\n opacity: 1;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-hidden {\n opacity: 0;\n transition: var(--jer-expand-transition-time);\n}\n\n/* Select styled as per:\nhttps://moderncss.dev/custom-select-styles-with-pure-css/\n*/\n\n.jer-select select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: transparent;\n border: none;\n padding: 0 1em 0 0;\n margin: 0;\n /* width: 100%; */\n font-family: inherit;\n font-size: 0.8em;\n color: black;\n cursor: inherit;\n line-height: inherit;\n z-index: 1;\n outline: none;\n}\nselect::-ms-expand {\n display: none;\n}\n\n.jer-select {\n display: grid;\n grid-template-areas: 'select';\n align-items: center;\n position: relative;\n min-width: 12ch;\n max-width: 15ch;\n border: 1px solid var(--jer-select-border);\n border-radius: 0.25em;\n padding: 0.25em 0.5em;\n cursor: pointer;\n line-height: 1.1;\n background-color: #fff;\n background-image: linear-gradient(to top, #f9f9f9, #fff 33%);\n}\n.jer-select select,\n.jer-select::after {\n grid-area: select;\n}\n.jer-select:not(.jer-select--multiple)::after {\n content: '';\n justify-self: end;\n width: 0.8em;\n height: 0.5em;\n background-color: var(--jer-select-arrow);\n -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n}\n\nselect:focus + .focus {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n border: 1px solid var(--jer-select-focus);\n border-radius: inherit;\n}\n\n.jer-editor-container {\n position: relative;\n font-size: 16px;\n line-height: 1;\n padding: 1em;\n padding-left: 2em;\n /* margin-top: 1em; */\n /* margin-bottom: 1em; */\n border-radius: 0.5em;\n text-align: left;\n}\n\n.jer-editor-container textarea {\n color: var(--jer-input-color);\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n}\n\n.jer-editor-container textarea:focus {\n border: var(--jer-form-border-focus);\n}\n\n.jer-editor-container input {\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n font-family: inherit;\n}\n\n.jer-editor-container input:focus {\n border: var(--jer-form-border-focus);\n}\n\n/* Input highlighted text */\n.jer-editor-container ::selection {\n background-color: var(--jer-highlight-color);\n}\n\n/* .jer-editor-container select {\n color: red;\n} */\n\n/* .jer-component {\n} */\n\n.jer-collection-header-row,\n.jer-value-main-row {\n display: flex;\n min-height: 1.7em;\n gap: 0.3em;\n align-items: center;\n}\n\n.jer-collection-header-row {\n display: flex;\n flex-wrap: wrap;\n}\n\n/* .jer-brackets {\n} */\n\n/* .jer-bracket-outside {\n} */\n\n/* .jer-collection-item-count {\n} */\n\n.jer-collapse-icon {\n position: absolute;\n left: -1.2em;\n top: 0.35em;\n}\n\n.jer-collection-inner {\n position: relative;\n}\n\n.jer-collection-text-edit {\n display: flex;\n flex-direction: column;\n gap: 0.3em;\n align-items: flex-start;\n}\n\n.jer-collection-text-area {\n resize: both;\n padding-top: 0.2em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-bottom: 0;\n overflow: hidden;\n max-height: 40em;\n font-family: inherit;\n font-size: 0.85em;\n}\n\n.jer-collection-input-button-row {\n display: flex;\n justify-content: flex-end;\n font-size: 150%;\n margin-top: 0.4em;\n}\n\n/* .jer-collection-element {\n} */\n\n.jer-collection-error-row {\n position: absolute;\n bottom: 0.5em;\n}\n\n/* .jer-collection-error-row-edit {\n} */\n\n.jer-error-slug {\n margin-left: 1em;\n}\n\n.jer-value-component {\n position: relative;\n}\n\n.jer-value-main-row {\n display: flex;\n gap: 0;\n}\n\n.jer-value-and-buttons {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-left: 0.5em;\n}\n\n.jer-value-error-row {\n position: absolute;\n}\n\n.jer-value-string {\n line-height: 1.3em;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.jer-hyperlink {\n text-decoration: underline;\n}\n\n.jer-input-text {\n resize: none;\n margin: 0;\n height: 1.4em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-top: 0.25em;\n padding-bottom: 0.2em;\n min-width: 6em;\n overflow: hidden;\n line-height: 1.2em;\n font-family: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-number {\n} */\n\n/* .jer-value-boolean {\n} */\n\n.jer-input-boolean {\n transform: scale(1.5);\n margin-left: 0.3em;\n margin-right: 0.3em;\n}\n\n/* .jer-value-null {\n} */\n\n.jer-value-object {\n}\n\n.jer-key-text {\n word-break: break-word;\n line-height: 1.1em;\n white-space: pre-wrap;\n}\n\n.jer-key-edit {\n padding: 0 0.3em;\n font-size: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-array {\n} */\n\n.jer-value-invalid {\n opacity: 0.5;\n font-style: italic;\n}\n\n.jer-input-number {\n min-width: 3em;\n font-size: 90%;\n}\n\n/* .jer-input-component {\n} */\n\n.jer-edit-buttons,\n.jer-confirm-buttons {\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 1em;\n}\n\n.jer-input-buttons {\n gap: 0.4em;\n}\n\n.jer-edit-buttons {\n gap: 0.4em;\n margin-left: 0.5em;\n opacity: 0;\n}\n\n.jer-confirm-buttons {\n gap: 0.2em;\n margin-left: 0.4em;\n}\n\n.jer-edit-buttons:hover {\n opacity: 1;\n position: relative;\n}\n\n.jer-collection-header-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-main-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-and-buttons:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n/* .jer-input-buttons {\n} */\n\n.jer-copy-pulse {\n position: relative;\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-copy-pulse:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n.jer-copy-pulse:after {\n content: '';\n display: block;\n position: absolute;\n border-radius: 50%;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: all 0.5s;\n box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);\n}\n\n.jer-copy-pulse:active:after {\n box-shadow: 0 0 0 0 var(--jer-icon-copy-color);\n position: absolute;\n border-radius: 4em;\n left: 0;\n top: 0;\n opacity: 1;\n transition: 0s;\n}\n\n.jer-copy-pulse:active {\n top: 0.07em;\n}\n\n.jer-rotate-90 {\n transform: rotate(-90deg);\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-accordion-icon {\n /* font-size: '2em'; */\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-icon:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n/* For displaying keys that are purely <empty string> \"\" */\n.jer-empty-string::after {\n content: '<empty string>';\n font-style: italic;\n font-size: 90%;\n}\n\n.jer-drag-n-drop-padding {\n height: 0.5em;\n border: 1px dashed #e0e0e0;\n border-radius: 0.3em;\n}\n",{});const s=({className:n,name:t,value:r,setValue:o,handleKeyPress:a,styles:i})=>{if("string"!=typeof r)return null;const s="\n"===r.slice(-1)?r+".":r;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${t}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},i),rows:1,className:n,name:`${t}_textarea`,value:r,onChange:e=>o(e.target.value),autoFocus:!0,onFocus:e=>{r.length<40&&e.target.select()},onKeyDown:a}),e.jsx("span",{className:n,style:Object.assign({visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent"},i),children:s})]})},l={default:{displayName:"Default",fragments:{edit:"rgb(42, 161, 152)"},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},collection:{},collectionInner:{},collectionElement:{},dropZone:{},property:"#292929",bracket:{color:"rgb(0, 43, 54)",fontWeight:"bold"},itemCount:{color:"rgba(0, 0, 0, 0.3)",fontStyle:"italic"},string:"rgb(203, 75, 22)",number:"rgb(38, 139, 210)",boolean:"green",null:{color:"rgb(220, 50, 47)",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"rgb(0, 43, 54)",iconEdit:"edit",iconDelete:"rgb(203, 75, 22)",iconAdd:"edit",iconCopy:"rgb(38, 139, 210)",iconOk:"green",iconCancel:"rgb(203, 75, 22)"}},githubDark:{displayName:"Github Dark",styles:{container:{backgroundColor:"#0d1117",color:"white"},dropZone:"rgba(165, 214, 255, 0.17)",property:"#E6EDF3",bracket:"#56d364",itemCount:"#8B949E",string:"#A5D6FF",number:"#D2A8FF",boolean:{color:"#FF7B72",fontSize:"90%",fontWeight:"bold"},null:"green",iconCollection:"#D2A8FF",iconEdit:"#D2A8FF",iconDelete:"rgb(203, 75, 22)",iconAdd:"rgb(203, 75, 22)",iconCopy:"#A5D6FF",iconOk:"#56d364",iconCancel:"rgb(203, 75, 22)"}},githubLight:{displayName:"Github Light",styles:{container:"white",property:"#1F2328",bracket:"#00802e",itemCount:"#8B949E",string:"#0A3069",number:"#953800",boolean:{color:"#CF222E",fontSize:"90%",fontWeight:"bold"},null:"#FF7B72",iconCollection:"#8250DF",iconEdit:"#8250DF",iconDelete:"rgb(203, 75, 22)",iconAdd:"#8250DF",iconCopy:"#57606A"}},monoDark:{displayName:"Black & White",fragments:{lightText:{color:"white"},midGrey:"#5c5c5c"},styles:{container:["lightText",{backgroundColor:"black"}],dropZone:"#e0e0e029",property:"lightText",bracket:"midGrey",itemCount:"#4a4a4a",string:"#a8a8a8",number:"#666666",boolean:{color:"#848484",fontStyle:"italic"},null:"#333333",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},monoLight:{fragments:{midGrey:"#a3a3a3"},displayName:"White & Black",styles:{container:"white",property:"black",bracket:"midGrey",itemCount:"#b5b5b5",string:"#575757",number:"#999999",boolean:{color:"#7b7b7b",fontStyle:"italic"},null:"#cccccc",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},candyWrapper:{displayName:"Candy Wrapper",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},darkBlue:{color:"#2B2D42"}},styles:{container:"minty",property:"pop",dropZone:"#eb121217",bracket:"dark",itemCount:"pale",string:"mid",number:["darkBlue",{fontSize:"85%"}],boolean:["mid",{fontStyle:"italic",fontWeight:"bold",fontSize:"80%"}],null:["#cccccc",{fontWeight:"bold"}],input:{border:"1px solid rgb(115, 194, 198)"},iconCollection:"#1D3557",iconEdit:"#457B9D",iconDelete:"#E63946",iconAdd:"#2B2D42",iconCopy:"#1D3557",iconCancel:"#E63946"}},psychedelic:{displayName:"Psychedelic",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},fluroYellow:"rgb(242, 228, 21)",fluroGreen:"rgb(68, 255, 62)",hotPink:"#f7379a"},styles:{container:{backgroundColor:"unset",background:"linear-gradient(90deg, hsla(333, 100%, 53%, 1) 0%, hsla(33, 94%, 57%, 1) 100%)",color:"black"},dropZone:"fluroYellow",property:"black",bracket:"fluroYellow",itemCount:["pale",{opacity:.7}],string:"white",number:["#33d9ff",{fontSize:"90%",fontWeight:"bold"}],boolean:["fluroGreen",{fontWeight:"bold",fontSize:"80%"}],null:["black",{fontWeight:"bold",opacity:.3,backgroundColor:"rgb(255, 255, 255, 0.5)",padding:"0 0.4em",borderRadius:"0.4em"}],iconCollection:"fluroYellow",iconEdit:["black"],iconDelete:["white",{opacity:.5}],iconAdd:["white",{opacity:.5}],iconCopy:"rgb(32, 84, 242)",iconOk:"fluroGreen",iconCancel:"hotPink"}}},c=l.default,d=n.createContext({getStyles:()=>({}),icons:{}}),u=({theme:n="default",icons:t={},children:r})=>{const o=g(n);return e.jsx(d.Provider,{value:{getStyles:(e,n)=>"function"==typeof o[e]?o[e](n):o[e],icons:t},children:r})},p=()=>n.useContext(d),g=e=>{var n,t,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((n=>"default"===e?{}:"string"==typeof n?m(l[n],a):h(n)?m({fragments:{},styles:n},a):m(n,a))),s=m(c,{});Object.keys(s).forEach((e=>{const n=e;i.forEach((e=>{e[n]&&(s[n]=Object.assign(Object.assign({},s[n]),e[n]))}))}));const d=Object.assign({},s);return Object.entries(a).forEach((([e,n])=>{const t=e;d[t]=e=>{const r=n(e)||{};return Object.assign(Object.assign({},s[t]),r)}})),"function"!=typeof(null==d?void 0:d.inputHighlight)&&(null===(n=null==d?void 0:d.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(t=null==d?void 0:d.inputHighlight)||void 0===t?void 0:t.backgroundColor),"function"!=typeof(null==d?void 0:d.iconCopy)&&(null===(r=null==d?void 0:d.iconCopy)||void 0===r?void 0:r.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(o=null==d?void 0:d.iconCopy)||void 0===o?void 0:o.color),d},m=(e,n)=>{const{fragments:t,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a;if("function"==typeof o)return n[e]=o,Object.assign({},r);if("string"==typeof o){const n=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:o;return"string"==typeof n?Object.assign(Object.assign({},r),{[y[e]]:n}):Object.assign(Object.assign({},r),n)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},h=e=>!("styles"in e),y={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",property:"color",bracket:"color",itemCount:"color",string:"color",number:"color",boolean:"color",null:"color",input:"color",inputHighlight:"backgroundColor",error:"color",iconCollection:"color",iconEdit:"color",iconDelete:"color",iconAdd:"color",iconCopy:"color",iconOk:"color",iconCancel:"color"},j="**INVALID_FUNCTION**",b=(e,n=200)=>"string"==typeof e?e.length<n?e:`${e.slice(0,n-2).trim()}...`:e,f=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),v=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,stringTruncate:c,showStringQuotes:d,nodeData:u})=>{const{getStyles:g}=p(),m=f(o),h=d?'"':"";return r?e.jsx(s,{className:"jer-input-text",name:m,value:n,setValue:t,isEditing:r,handleKeyPress:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&l():i()},styles:g("input",u)}):e.jsxs("div",{id:`${m}_display`,onDoubleClick:()=>a(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&a(!0)},className:"jer-value-string",style:g("string",u),children:[h,b(n,c),h]})},E=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l})=>{const{getStyles:c}=p();return r?e.jsx("input",{className:"jer-input-number",type:"text",name:f(o),value:n,onChange:e=>t(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{switch(e.key){case"Enter":i();break;case"Escape":s();break;case"ArrowUp":e.preventDefault(),t(Number(n)+1);break;case"ArrowDown":e.preventDefault(),t(Number(n)-1)}},style:Object.assign({width:String(n).length/1.5+2+"em"},c("input",l))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:c("number",l),children:n})},x=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l})=>{const{getStyles:c}=p();return r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:f(o),checked:n,onChange:()=>t(!n),onKeyDown:e=>{"Enter"===e.key?i():"Escape"===e.key&&s()},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:c("boolean",l),children:String(n)})},D=({value:t,isEditing:r,setIsEditing:o,handleEdit:a,handleCancel:i,nodeData:s})=>{const{getStyles:l}=p();n.useEffect((()=>(r&&document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c))),[r]);const c=e=>{"Enter"===e.key?a():"Escape"===e.key&&i()};return e.jsx("div",{onDoubleClick:()=>o(!0),className:"jer-value-null",style:l("null",s),children:String(t)})},w=({value:n})=>{let t="Error!";switch(typeof n){case"string":n===j&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:t})},k=({size:n,style:t,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),e.jsx("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]}),C=({size:n,style:t,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,transform:"translate(0, 0.5)",children:[e.jsx("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),e.jsx("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),S=({size:n,style:t,className:r})=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"})}),O=({size:n,style:t,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),e.jsx("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),e.jsx("path",{d:"M15 10l-4 4 4 4"})]}),N=({size:n,style:t,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),e.jsx("path",{d:"M22 4L12 14.01l-3-3"})]}),A=({size:n,style:t,className:r})=>e.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"})}),T=({size:n,style:t,className:r})=>e.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})}),F=({name:n,nodeData:t,rotate:r})=>{var o,a,i,s,l,c,d;const{getStyles:u,icons:g}=p(),m={size:"1.4em",className:"jer-icon"};switch(n){case"add":return null!==(o=null==g?void 0:g.add)&&void 0!==o?o:e.jsx(k,Object.assign({},m,{style:u("iconAdd",t)}));case"edit":return null!==(a=null==g?void 0:g.edit)&&void 0!==a?a:e.jsx(C,Object.assign({},m,{style:u("iconEdit",t)}));case"delete":return null!==(i=null==g?void 0:g.delete)&&void 0!==i?i:e.jsx(S,Object.assign({},m,{style:u("iconDelete",t),size:"1.45em"}));case"copy":return null!==(s=null==g?void 0:g.copy)&&void 0!==s?s:e.jsx(O,Object.assign({},m,{style:u("iconCopy",t),size:"1.2em"}));case"ok":return null!==(l=null==g?void 0:g.ok)&&void 0!==l?l:e.jsx(N,Object.assign({},m,{style:Object.assign({fontSize:"90%"},u("iconOk",t))}));case"cancel":return null!==(c=null==g?void 0:g.cancel)&&void 0!==c?c:e.jsx(A,Object.assign({},m,{style:Object.assign({fontSize:"130%"},u("iconCancel",t))}));case"chevron":return null!==(d=null==g?void 0:g.chevron)&&void 0!==d?d:e.jsx(T,{className:"jer-accordion-icon"+(r?" jer-rotate-90":""),size:"1em",style:u("iconCollection",t)});default:return e.jsx(e.Fragment,{})}},P=({startEdit:t,handleDelete:r,handleAdd:o,enableClipboard:a,type:i,nodeData:s,translate:l})=>{const{getStyles:c}=p(),d=l("KEY_NEW",s),[u,g]=n.useState(!1),[m,h]=n.useState(d),{key:y,path:j,value:b}=s;return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:u?1:void 0},children:[a&&e.jsx("div",{onClick:e=>{let n,t="value",r="";if(a){if(!0===(e.ctrlKey||e.metaKey))n=R(j),r=n,t="path";else n=b,r=i?JSON.stringify(b,null,2):String(n);navigator.clipboard.writeText(r)}"function"==typeof a&&a({value:n,stringValue:r,path:j,key:y,type:t})},className:"jer-copy-pulse",children:e.jsx(F,{name:"copy",nodeData:s})}),t&&e.jsx("div",{onClick:t,children:e.jsx(F,{name:"edit",nodeData:s})}),r&&e.jsx("div",{onClick:r,children:e.jsx(F,{name:"delete",nodeData:s})}),o&&e.jsx("div",{onClick:()=>{"object"===i?g(!0):o("")},children:e.jsx(F,{name:"add",nodeData:s})}),u&&o&&"object"===i&&e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:m,onChange:e=>h(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&o?(g(!1),o(m),h(d)):"Escape"===e.key&&(g(!1),h(d))},style:c("input",s)}),e.jsx(V,{onOk:()=>{m&&(g(!1),o(m))},onCancel:()=>{g(!1)},nodeData:s})]})]})},V=({onOk:n,onCancel:t,nodeData:r})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[e.jsx("div",{onClick:n,children:e.jsx(F,{name:"ok",nodeData:r})}),e.jsx("div",{onClick:t,children:e.jsx(F,{name:"cancel",nodeData:r})})]}),R=e=>e.reduce(((e,n)=>"number"==typeof n?`${e}[${n}]`:""===e?n:`${e}.${n}`),""),M=["string","number","boolean","null","object","array"],z=(e=[],n)=>{const t=e.filter((({condition:e})=>e(n)));if(0===t.length)return{};const r=t[0],{element:o,wrapperElement:a,customNodeProps:i,wrapperProps:s,hideKey:l=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:p=!0}=r,g=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:a,customNodeProps:i,wrapperProps:s,hideKey:l,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:p},g)},I=e=>null!==e&&"object"==typeof e,_=(e,n,t,r="")=>{if(!t&&!r)return!0;switch(e){case"collection":if(t){if(t(n,r))return!0;if(!L(r,n,t))return!1}if(!t&&r&&!L(r,n))return!1;break;case"value":if(t&&!t(n,r))return!1;if(!t&&r&&!K(n,r))return!1}return!0},L=(e="",n,t=K)=>{const r=n.value;return Object.entries(r).some((([o,a])=>{const i=[...n.path,o],s=Object.assign(Object.assign({},n),{key:o,path:i,level:n.level+1,value:a,size:i.length,parentData:r});return I(a)?L(e,s,t):t(s,e)}))},K=(e,n="")=>{const{value:t}=e;if(null===t&&"null".includes(n.toLowerCase()))return!0;switch(typeof t){case"string":return t.toLowerCase().includes(n.toLowerCase());case"number":return!!String(t).includes(n);case"boolean":return t?"true".includes(n.toLowerCase())||"1"===n:"false".includes(n.toLowerCase())||"0"===n;default:return!1}},W=({key:e,path:n},t="")=>!!K({value:e},t)||!!n.some((e=>K({value:e},t))),B=n.createContext({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),G=({children:t})=>{const[r,o]=n.useState(null),[a,i]=n.useState(null),[s,l]=n.useState({path:null,pathString:null});return e.jsx(B.Provider,{value:{collapseState:r,setCollapseState:e=>{o(e),null!==e&&setTimeout((()=>o(null)),2e3)},doesPathMatch:e=>{if(null===r)return!1;for(const[n,t]of r.path.entries())if(t!==e[n])return!1;return!0},currentlyEditingElement:a,setCurrentlyEditingElement:i,areChildrenBeingEdited:e=>null!==a&&a.includes(e),dragSource:s,setDragSource:l},children:t})},U=()=>n.useContext(B),Y=({props:e,collapsed:t})=>{const{data:r,nodeData:o,parentData:a,onEdit:i,onError:s,showErrorMessages:l,restrictEditFilter:c,restrictDeleteFilter:d,restrictAddFilter:u,restrictDragFilter:p,translate:g}=e,{currentlyEditingElement:m,setCurrentlyEditingElement:h}=U(),[y,j]=n.useState(null),b=Object.assign(Object.assign({},o),{collapsed:t}),{path:v,key:E,size:x}=b,D=f(v),w=n.useMemo((()=>!c(b)),[b]),k=n.useMemo((()=>!d(b)),[b]),C=n.useMemo((()=>!u(b)),[b]),S=n.useMemo((()=>!p(b)&&k&&null===m),[b]),O=e=>{l&&(j(e),setTimeout((()=>j(null)),2500)),console.warn("Error",e)},N=n.useMemo((()=>(e,n)=>{O(e.message),s&&s({currentData:b.fullData,errorValue:n,currentValue:r,name:E,path:v,error:e})}),[s,l]),A=m===D,T=m===`key_${D}`,F="number"==typeof v.slice(-1)[0];return{pathString:D,nodeData:b,path:v,name:E,size:x,canEdit:w,canDelete:k,canAdd:C,canDrag:S,error:y,showError:O,onError:N,setError:j,handleEditKey:e=>{if(h(null),E===e)return;if(!a)return;const n=v.slice(0,-1);if(Object.keys(a).includes(e))return void N({code:"KEY_EXISTS",message:g("ERROR_KEY_EXISTS",b)},e);const t=Object.fromEntries(Object.entries(a).map((([n,t])=>n===E?[e,t]:[n,t])));i(t,n).then((n=>{n&&N({code:"UPDATE_ERROR",message:n},e)}))},derivedValues:{isEditing:A,isEditingKey:T,isArray:F,canEditKey:null!==a&&w&&C&&k&&!F}}},$=({canDrag:t,canDragOnto:r,path:o,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=p(),{dragSource:d,setDragSource:u}=U(),[g,m]=n.useState(!1),h=f(o),y=n.useMemo((()=>t?{onDragStart:e=>{e.stopPropagation(),u({path:o,pathString:h})},onDragEnd:e=>{e.stopPropagation(),u({path:null,pathString:null})}}:{}),[t]),j=n.useMemo((()=>e=>r?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:n=>{n.stopPropagation(),v(e),u({path:null,pathString:null}),m(!1)},onDragEnter:n=>{var t;n.stopPropagation(),h.startsWith(null!==(t=d.pathString)&&void 0!==t?t:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[d,r]),b=n.useMemo((()=>r&&null!==d.pathString?e.jsx("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:o.length}},j("below"))):null),[d,r]),v=e=>{var n,t;const r=null===(n=d.path)||void 0===n?void 0:n.slice(-1)[0],c=null===(t=d.path)||void 0===t?void 0:t.slice(0,-1).join("."),u=o.slice(0,-1).join(""),{parentData:p}=a;"string"==typeof r&&p&&!Array.isArray(p)&&Object.keys(p).includes(r)&&r in p&&c!==u?s({code:"KEY_EXISTS",message:l("ERROR_KEY_EXISTS",a)},r):i(d.path,o,e).then((e=>{e&&s({code:"UPDATE_ERROR",message:e},a.value)}))};return{dragSourceProps:y,getDropTargetProps:j,BottomDropTarget:b,DropTargetPadding:({position:n,nodeData:t})=>g===n?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",t)}):null,handleDrop:v}},H=t=>{const{data:r,parentData:o,onEdit:a,onDelete:i,onChange:s,onMove:l,enableClipboard:c,canDragOnto:d,restrictTypeSelection:u,searchFilter:g,searchText:m,showLabel:h,stringTruncate:y,showStringQuotes:b,indent:f,translate:v,customNodeDefinitions:E}=t,{getStyles:x}=p(),{setCurrentlyEditingElement:D}=U(),[w,k]=n.useState("function"==typeof r?j:r),{pathString:C,nodeData:S,path:O,name:N,canEdit:A,canDelete:T,canDrag:F,error:R,onError:I,handleEditKey:L,derivedValues:K}=Y({props:t}),{dragSourceProps:W,getDropTargetProps:B,BottomDropTarget:G,DropTargetPadding:H}=$({canDrag:F,canDragOnto:d,path:O,nodeData:S,onMove:l,onError:I,translate:v}),q=z(E,S),[Q,ee]=n.useState(J(r,q)),ne=n.useCallback((e=>{if(!s)return void k(e);const n=s({currentData:S.fullData,newValue:e,currentValue:w,name:N,path:O});k(n)}),[s]);n.useEffect((()=>{k("function"==typeof r?j:r),ee(J(r,q))}),[r,R]);const{CustomNode:te,customNodeProps:re,hideKey:oe,showEditTools:ae=!0,showOnEdit:ie,showOnView:se}=q,le=[...M,...E.filter((({showInTypesSelector:e=!1,name:n})=>e&&!!n)).map((({name:e})=>e))],ce=n.useMemo((()=>{if("boolean"==typeof u)return u?[]:le;if(Array.isArray(u))return u;const e=u(S);return"boolean"==typeof e?e?[]:le:e}),[S,u]);if(!_("value",S,g,m))return null;const de=()=>{let e;switch(D(null),Q){case"object":e={[v("DEFAULT_NEW_KEY",S)]:w};break;case"array":e=null!=w?w:[];break;case"number":{const n=Number(w);e=isNaN(n)?0:n;break}default:e=w}a(e,O).then((n=>{n&&I({code:"UPDATE_ERROR",message:n},e)}))},ue=()=>{D(null),k(r),ee(J(r,q))},{isEditing:pe,isEditingKey:ge,canEditKey:me}=K,he=!pe&&R,ye=pe&&ce.length>0,je="invalid"!==Q&&!R&&ae,be=h&&ge,fe=h&&!ge&&!oe,ve={value:w,parentData:o,setValue:ne,isEditing:pe,setIsEditing:A?()=>D(C):()=>{},handleEdit:de,handleCancel:ue,path:O,stringTruncate:y,showStringQuotes:b,nodeData:S,translate:v},Ee=te&&(pe&&ie||!pe&&se)?e.jsx(te,Object.assign({},t,{value:w,customNodeProps:re,setValue:ne,handleEdit:de,handleCancel:ue,handleKeyPress:e=>{"Enter"===e.key?de():"Escape"===e.key&&ue()},isEditing:pe,setIsEditing:()=>D(C),getStyles:x})):X(J(r),ve);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:f/2+"em",position:"relative"},draggable:F},W,B("above"),{children:[G,e.jsx(H,{position:"above",nodeData:S}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:N.length>10?"wrap":"nowrap"},children:[fe&&e.jsxs("span",{className:"jer-key-text",style:Object.assign(Object.assign({},x("property",S)),{minWidth:`${Math.min(String(N).length+1,5)}ch`,flexShrink:N.length>10?1:0}),onDoubleClick:()=>me&&D(`key_${C}`),children:[""===N?e.jsx("span",{className:"jer-empty-string"}):N,":"]}),be&&e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:C,defaultValue:N,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?L(e.target.value):"Escape"===e.key&&ue()},style:{width:String(N).length/1.5+.5+"em"}}),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:Ee}),pe?e.jsx(V,{onOk:de,onCancel:ue,nodeData:S}):je&&e.jsx(P,{startEdit:A?()=>D(C):void 0,handleDelete:T?()=>{i(w,O).then((e=>{e&&I({code:"DELETE_ERROR",message:e},w)}))}:void 0,enableClipboard:c,translate:v,nodeData:S}),ye&&e.jsxs("div",{className:"jer-select",children:[e.jsx("select",{name:`${N}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const n=E.find((n=>n.name===e));if(n)a(n.defaultValue,O),ee(e);else{const n=Z(w,e,v("DEFAULT_NEW_KEY",S),(null==q?void 0:q.CustomNode)?v("DEFAULT_STRING",S):void 0);ne(n),a(n,O).then((e=>{e&&(I({code:"UPDATE_ERROR",message:e},n),D(null))}))}})(e.target.value),value:Q,children:ce.map((n=>e.jsx("option",{value:n,children:n},n)))}),e.jsx("span",{className:"focus"})]}),he&&e.jsx("span",{className:"jer-error-slug",style:x("error",S),children:R})]})]}),e.jsx(H,{position:"below",nodeData:S})]}))},J=(e,n)=>(null==n?void 0:n.CustomNode)&&(null==n?void 0:n.name)&&n.showInTypesSelector?n.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",X=(n,t)=>{const r=t.value;switch(n){case"string":return e.jsx(v,Object.assign({},t,{value:r}));case"number":return e.jsx(E,Object.assign({},t,{value:r}));case"boolean":return e.jsx(x,Object.assign({},t,{value:r}));case"null":return e.jsx(D,Object.assign({},t));default:return e.jsx(w,Object.assign({},t))}},Z=(e,n,t,r)=>{switch(n){case"string":return null!=r?r:String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;case"null":return null;case"object":return{[t]:e};case"array":return[e];default:return String(e)}},q=t=>{const{getStyles:a}=p(),{collapseState:i,setCollapseState:l,doesPathMatch:c,currentlyEditingElement:d,setCurrentlyEditingElement:u,areChildrenBeingEdited:g}=U(),{data:m,nodeData:h,parentData:y,showCollectionCount:j,onEdit:b,onAdd:f,onDelete:v,canDragOnto:E,collapseFilter:x,collapseAnimationTime:D,onMove:w,enableClipboard:k,searchFilter:C,searchText:S,indent:O,keySort:N,showArrayIndices:A,defaultValue:T,translate:R,customNodeDefinitions:M,jsonParse:L,jsonStringify:K}=t,[W,B]=n.useState(K(m)),G=x(h),[J,X]=n.useState(G),{pathString:Z,nodeData:Q,path:ee,name:ne,size:te,canEdit:re,canDelete:oe,canAdd:ae,canDrag:ie,error:se,setError:le,onError:ce,handleEditKey:de,derivedValues:ue}=Y({props:t,collapsed:J}),{dragSourceProps:pe,getDropTargetProps:ge,BottomDropTarget:me,DropTargetPadding:he}=$({canDrag:ie,canDragOnto:E,path:ee,nodeData:Q,onMove:w,onError:ce,translate:R}),ye=n.useRef(!G),[je,be]=n.useState(!1);n.useEffect((()=>{B(K(m))}),[m]),n.useEffect((()=>{const e=x(Q)&&!ue.isEditing;ye.current=!e,X(e)}),[x]),n.useEffect((()=>{null!==i&&c(ee)&&(ye.current=!0,X(i.collapsed))}),[i]);const fe=n.useMemo((()=>e=>"function"!=typeof T?T:T(e)),[T]),{CustomNode:ve,customNodeProps:Ee,CustomWrapper:xe,wrapperProps:De={},hideKey:we,showEditTools:ke=!0,showOnEdit:Ce,showOnView:Se,showCollectionWrapper:Oe=!0}=n.useMemo((()=>z(M,Q)),[]);if(!_("collection",Q,C,S)&&Q.level>0)return null;const Ne=Array.isArray(m)?"array":"object",Ae="array"===Ne?{open:"[",close:"]"}:{open:"{",close:"}"},Te=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time"),Fe=e=>{"Enter"===e.key&&(e.metaKey||e.shiftKey||e.ctrlKey)?Pe():"Escape"===e.key&&Re()},Pe=()=>{try{const e=L(W);if(u(null),le(null),JSON.stringify(e)===JSON.stringify(m))return;b(e,ee).then((n=>{n&&ce({code:"UPDATE_ERROR",message:n},e)}))}catch(e){ce({code:"INVALID_JSON",message:R("ERROR_INVALID_JSON",Q)},W)}},Ve=ee.length>0?()=>{v(m,ee).then((e=>{e&&ce({code:"DELETE_ERROR",message:e},r(m,ee))}))}:void 0,Re=()=>{u(null),le(null),B(K(m))},{isEditing:Me,isEditingKey:ze,isArray:Ie,canEditKey:_e}=ue,Le="when-closed"===j?J:j,Ke=!Me&&ke,We=(A||!Ie)&&!we&&void 0!==ne,Be=ve&&(Me&&Ce||!Me&&Se),Ge=N&&"object"===Ne,Ue=Object.entries(m).map((([e,n])=>["array"===Ne?Number(e):e,n]));Ge&&Ue.sort("function"==typeof N?(e,n)=>N(e[0],n[0]):void 0);const Ye=JSON.stringify(m,null,2).replace(/\\n/g,"\n").split("\n").length,$e=ye.current?Me?e.jsx("div",{className:"jer-collection-text-edit",children:e.jsxs("div",{children:[e.jsx(s,{className:"jer-collection-text-area",name:Z,value:W,setValue:B,isEditing:Me,handleKeyPress:Fe,styles:a("input",Q)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(V,{onOk:Pe,onCancel:Re,nodeData:Q})})]})}):Ue.map((([n,r],o)=>{const i={key:n,value:r,path:[...ee,n],level:ee.length+1,index:o,size:I(r)?Object.keys(r).length:1,parentData:m,fullData:Q.fullData};return e.jsx("div",{className:"jer-collection-element",style:a("collectionElement",i),children:I(r)?e.jsx(q,Object.assign({},t,{data:r,parentData:m,nodeData:i,showCollectionCount:j,canDragOnto:re}),n):e.jsx(H,Object.assign({},t,{data:r,parentData:m,nodeData:i,canDragOnto:re,showLabel:"object"===Ne||A}),n)},n)})):null,He=!!Oe&&J;He||(ye.current=!0);const Je=Object.assign(Object.assign({},t),{data:m,value:m,parentData:y,nodeData:Q,setValue:e=>o(void 0,void 0,void 0,(function*(){return yield b(e,ee)})),handleEdit:Pe,handleCancel:Re,handleKeyPress:Fe,isEditing:Me,setIsEditing:()=>u(Z),getStyles:a,canDragOnto:re}),Xe=Be?e.jsx(ve,Object.assign({customNodeProps:Ee},Je,{children:$e})):$e,Ze=ze?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:Z,defaultValue:ne,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?de(e.target.value):"Escape"===e.key&&Re()},style:{width:String(ne).length/1.5+.5+"em"}}):We&&e.jsx("span",{className:"jer-key-text",style:a("property",Q),onDoubleClick:()=>_e&&u(`key_${Z}`),children:""===ne?e.jsx("span",{className:ee.length>0?"jer-empty-string":void 0}):`${ne}:`}),qe=Ke&&e.jsx(P,{startEdit:re?()=>{ye.current=!0,u(Z),X(!1)}:void 0,handleAdd:ae?e=>{X(!1);const n=fe(Q);"array"===Ne?f(n,[...ee,m.length]).then((e=>{e&&ce({code:"ADD_ERROR",message:e},n)})):e in m?ce({code:"KEY_EXISTS",message:R("ERROR_KEY_EXISTS",Q)},e):f(n,[...ee,e]).then((e=>{e&&ce({code:"ADD_ERROR",message:e},n)}))}:void 0,handleDelete:oe?Ve:void 0,enableClipboard:k,type:Ne,nodeData:Q,translate:R}),Qe=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===ee.length?0:O/2)+"em"},a("collection",Q)),{position:"relative"}),draggable:ie},pe,ge("above"),{children:[!Me&&me,e.jsx(he,{position:"above",nodeData:Q}),Oe?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon",onClick:e=>(e=>{if(e.getModifierState("Alt"))return ye.current=!0,void l({collapsed:!J,path:ee});d&&d.includes(Z)||(be(!0),ye.current=!0,X(!J),l(null),setTimeout((()=>be(!1)),D))})(e),children:e.jsx(F,{name:"chevron",rotate:J,nodeData:Q})}),Ze,!Me&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:a("bracket",Q),children:Ae.open})]}),!Me&&Le&&e.jsx("div",{className:"jer-collection-item-count"+(Le?" jer-visible":" jer-hidden"),style:a("itemCount",Q),children:1===te?R("ITEM_SINGLE",Object.assign(Object.assign({},Q),{size:1}),1):R("ITEMS_MULTIPLE",Q,te)}),e.jsx("div",{className:"jer-brackets"+(He?" jer-visible":" jer-hidden"),style:a("bracket",Q),children:Ae.close}),qe]}):we?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[Ze,qe]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign({maxHeight:He?0:g(Z)?void 0:3*Ye+"em",overflowY:He||je?"hidden":"visible",transition:`max-height ${Te}`},a("collectionInner",Q)),children:[Xe,e.jsx("div",{className:Me?"jer-collection-error-row":"jer-collection-error-row-edit",children:se&&e.jsx("span",{className:"jer-error-slug",style:a("error",Q),children:se})}),!Me&&Oe&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:a("bracket",Q),children:Ae.close})]}),e.jsx(he,{position:"below",nodeData:Q})]}));return xe?e.jsx(xe,Object.assign({customNodeProps:De},Je,{children:Qe})):Qe},Q={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",DEFAULT_STRING:"New data!",DEFAULT_NEW_KEY:"key"},ee=(e,n)=>(t,r,o)=>((e,n,t,r,o)=>{if(n[r]){const e=n[r](t);if(null!==e)return e}const a=r in e?e[r]:Q[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,n,r,t,o),ne=({data:t,setData:r,rootName:a="root",onUpdate:i=(()=>{}),onEdit:s=i,onDelete:l=i,onAdd:c=i,onChange:d,onError:u,showErrorMessages:g=!0,enableClipboard:m=!0,indent:h=3,collapse:y=!1,collapseAnimationTime:j=500,showCollectionCount:b=!0,restrictEdit:f=!1,restrictDelete:v=!1,restrictAdd:E=!1,restrictTypeSelection:x=!1,restrictDrag:D=!0,searchFilter:w,searchText:k,searchDebounceTime:C=350,keySort:S=!1,showArrayIndices:O=!0,showStringQuotes:N=!0,defaultValue:A=null,minWidth:T=250,maxWidth:F="min(600px, 90vw)",rootFontSize:P,stringTruncate:V=250,translations:R={},className:M,id:z,customText:_={},customNodeDefinitions:L=[],jsonParse:K=JSON.parse,jsonStringify:W=(e=>JSON.stringify(e,null,2))})=>{const{getStyles:B}=p(),G=n.useCallback(re(y),[y]),U=n.useCallback(ee(R,_),[R,_]),[Y,$]=n.useState(k),[J,X]=(({setData:e,data:t})=>{const[r,o]=n.useState(e?void 0:t),a=n.useCallback((n=>{e?e(n):o(n)}),[e]);return n.useEffect((()=>{e||o(t)}),[t]),[e?t:r,a]})({setData:r,data:t}),Z=document.querySelector(":root"),Q=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(Q)!==j&&(null==Z||Z.style.setProperty("--jer-expand-transition-time",j/1e3+"s")),n.useEffect((()=>{const e=setTimeout((()=>$(k)),C);return()=>clearTimeout(e)}),[k,C]);const ne={key:a,path:[],level:0,index:0,value:J,size:"object"==typeof J&&null!==J?Object.keys(J).length:1,parentData:null,fullData:J},ie=(e,n)=>o(void 0,void 0,void 0,(function*(){const t=yield e(n);if(void 0===t)return void X(n.newData);const r=ae(t)?t:["error",t],[o,a]=r;if("error"===o)return X(n.currentData),!1===a?U("ERROR_UPDATE",ne):String(a);X(a)})),se=n.useMemo((()=>re(f)),[f]),le=n.useMemo((()=>re(v)),[v]),ce=n.useMemo((()=>re(E)),[E]),de=n.useMemo((()=>re(D)),[D]),ue=n.useMemo((()=>oe(w)),[w]),pe={name:a,nodeData:ne,onEdit:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=te(J,n,e,"update");if(o!==a)return yield ie(s,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onDelete:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=te(J,n,e,"delete");return yield ie(l,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onAdd:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=te(J,n,e,"add");return yield ie(c,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onChange:d,onError:u,showErrorMessages:g,onMove:(e,n,t)=>o(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=te(J,e,"","delete"),i=e.slice(-1)[0],l=n.slice(0,-1),c=n.slice(-1)[0];let d="number"==typeof c?"above"===t?c:c+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===n.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===t?{insertBefore:c}:{insertAfter:c},{newData:p,newValue:g}=te(o,[...l,d],a,"add",u);return yield ie(s,{currentData:r,newData:p,currentValue:a,newValue:g,name:n.slice(-1)[0],path:n})})),showCollectionCount:b,collapseFilter:G,collapseAnimationTime:j,restrictEditFilter:se,restrictDeleteFilter:le,restrictAddFilter:ce,restrictTypeSelection:x,restrictDragFilter:de,canDragOnto:!1,searchFilter:ue,searchText:Y,enableClipboard:m,keySort:S,showArrayIndices:O,showStringQuotes:N,indent:h,defaultValue:A,stringTruncate:V,translate:U,customNodeDefinitions:L,parentData:null,jsonParse:K,jsonStringify:W},ge=Object.assign(Object.assign({},B("container",ne)),{minWidth:T,maxWidth:F});return ge.fontSize=null!=P?P:ge.fontSize,e.jsx("div",{id:z,className:"jer-editor-container "+M,style:ge,children:I(J)?e.jsx(q,Object.assign({data:J},pe)):e.jsx(H,Object.assign({data:J,showLabel:!0},pe))})},te=(e,n,o,a,i={})=>{if(0===n.length)return{currentData:e,newData:o,currentValue:e,newValue:o};const s=Object.assign({remove:"delete"===a},i),l="add"!==a?r(e,n):void 0;return{currentData:e,newData:t(e,n,o,s),currentValue:l,newValue:"delete"!==a?o:void 0}},re=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:n})=>n>=e:e,oe=e=>{if(void 0!==e)return"value"===e?K:"key"===e?W:"all"===e?(e,n)=>K(e,n)||W(e,n):e},ae=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),ie=({value:n,setIsEditing:t,getStyles:r,customNodeProps:o,nodeData:a})=>{var i,s;const l=null!==(i=null==o?void 0:o.stringTruncate)&&void 0!==i?i:100,c=r("string",a);return e.jsx("div",{onDoubleClick:()=>t(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&t(!0)},className:"jer-value-string jer-hyperlink",style:c,children:e.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",style:{color:null!==(s=c.color)&&void 0!==s?s:void 0},children:['"',b(n,l),'"']})})},se={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:ie,showOnView:!0,showOnEdit:!1};exports.assign=t,exports.extract=r,exports.IconAdd=k,exports.IconCancel=A,exports.IconChevron=T,exports.IconCopy=O,exports.IconDelete=S,exports.IconEdit=C,exports.IconOk=N,exports.JsonEditor=n=>e.jsx(u,{theme:n.theme,icons:n.icons,children:e.jsx(G,{children:e.jsx(ne,Object.assign({},n))})}),exports.LinkCustomComponent=ie,exports.LinkCustomNodeDefinition=se,exports.isCollection=I,exports.matchNode=K,exports.matchNodeKey=W,exports.themes=l,exports.truncate=b;

@@ -40,2 +40,3 @@ /// <reference types="react" />

collapse?: boolean | number | FilterFunction;
collapseAnimationTime?: number;
showCollectionCount?: boolean | 'when-closed';

@@ -160,2 +161,3 @@ restrictEdit?: boolean | FilterFunction;

collapseFilter: FilterFunction;
collapseAnimationTime: number;
onAdd: InternalUpdateFunction;

@@ -162,0 +164,0 @@ keySort: boolean | CompareFunction;

@@ -1,1 +0,1 @@

import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import{createContext as r,useContext as o,useEffect as a,useState as i,useMemo as l,useCallback as s,useRef as c}from"react";import d from"object-property-assigner";export{default as assign}from"object-property-assigner";import u from"object-property-extractor";export{default as extract}from"object-property-extractor";function p(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function l(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,l)}s((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var g=[],h=[];!function(e,n){if(e&&"undefined"!=typeof document){var t,r=!0===n.prepend?"prepend":"append",o=!0===n.singleTag,a="string"==typeof n.container?document.querySelector(n.container):document.getElementsByTagName("head")[0];if(o){var i=g.indexOf(a);-1===i&&(i=g.push(a)-1,h[i]={}),t=h[i]&&h[i][r]?h[i][r]:h[i][r]=l()}else t=l();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function l(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),n.attributes)for(var t=Object.keys(n.attributes),o=0;o<t.length;o++)e.setAttribute(t[o],n.attributes[t[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(":root {\n --jer-select-border: #b6b6b6;\n --jer-select-focus: #777;\n --jer-select-arrow: #777;\n --jer-form-border: 1px solid #ededf0;\n --jer-form-border-focus: 1px solid #e2e2e2;\n --jer-expand-transition-time: 0.5s;\n --jer-highlight-color: #b3d8ff;\n}\n\n.jer-visible {\n opacity: 1;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-hidden {\n opacity: 0;\n transition: var(--jer-expand-transition-time);\n}\n\n/* Select styled as per:\nhttps://moderncss.dev/custom-select-styles-with-pure-css/\n*/\n\n.jer-select select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: transparent;\n border: none;\n padding: 0 1em 0 0;\n margin: 0;\n /* width: 100%; */\n font-family: inherit;\n font-size: 0.8em;\n color: black;\n cursor: inherit;\n line-height: inherit;\n z-index: 1;\n outline: none;\n}\nselect::-ms-expand {\n display: none;\n}\n\n.jer-select {\n display: grid;\n grid-template-areas: 'select';\n align-items: center;\n position: relative;\n min-width: 12ch;\n max-width: 15ch;\n border: 1px solid var(--jer-select-border);\n border-radius: 0.25em;\n padding: 0.25em 0.5em;\n cursor: pointer;\n line-height: 1.1;\n background-color: #fff;\n background-image: linear-gradient(to top, #f9f9f9, #fff 33%);\n}\n.jer-select select,\n.jer-select::after {\n grid-area: select;\n}\n.jer-select:not(.jer-select--multiple)::after {\n content: '';\n justify-self: end;\n width: 0.8em;\n height: 0.5em;\n background-color: var(--jer-select-arrow);\n -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n}\n\nselect:focus + .focus {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n border: 1px solid var(--jer-select-focus);\n border-radius: inherit;\n}\n\n.jer-editor-container {\n position: relative;\n font-size: 16px;\n line-height: 1;\n padding: 1em;\n padding-left: 2em;\n /* margin-top: 1em; */\n /* margin-bottom: 1em; */\n border-radius: 0.5em;\n text-align: left;\n}\n\n.jer-editor-container textarea {\n color: var(--jer-input-color);\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n}\n\n.jer-editor-container textarea:focus {\n border: var(--jer-form-border-focus);\n}\n\n.jer-editor-container input {\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n font-family: inherit;\n}\n\n.jer-editor-container input:focus {\n border: var(--jer-form-border-focus);\n}\n\n/* Input highlighted text */\n.jer-editor-container ::selection {\n background-color: var(--jer-highlight-color);\n}\n\n/* .jer-editor-container select {\n color: red;\n} */\n\n/* .jer-component {\n} */\n\n.jer-collection-header-row,\n.jer-value-main-row {\n display: flex;\n min-height: 1.7em;\n gap: 0.3em;\n align-items: center;\n}\n\n.jer-collection-header-row {\n display: flex;\n flex-wrap: wrap;\n}\n\n/* .jer-brackets {\n} */\n\n/* .jer-bracket-outside {\n} */\n\n/* .jer-collection-item-count {\n} */\n\n.jer-collapse-icon {\n position: absolute;\n left: -1.2em;\n top: 0.35em;\n}\n\n.jer-collection-inner {\n position: relative;\n}\n\n.jer-collection-text-edit {\n display: flex;\n flex-direction: column;\n gap: 0.3em;\n align-items: flex-start;\n}\n\n.jer-collection-text-area {\n resize: both;\n padding-top: 0.2em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-bottom: 0;\n overflow: hidden;\n max-height: 40em;\n font-family: inherit;\n font-size: 0.85em;\n}\n\n.jer-collection-input-button-row {\n display: flex;\n justify-content: flex-end;\n font-size: 150%;\n margin-top: 0.4em;\n}\n\n/* .jer-collection-element {\n} */\n\n.jer-collection-error-row {\n position: absolute;\n bottom: 0.5em;\n}\n\n/* .jer-collection-error-row-edit {\n} */\n\n.jer-error-slug {\n margin-left: 1em;\n}\n\n.jer-value-component {\n position: relative;\n}\n\n.jer-value-main-row {\n display: flex;\n gap: 0;\n}\n\n.jer-value-and-buttons {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-left: 0.5em;\n}\n\n.jer-value-error-row {\n position: absolute;\n}\n\n.jer-value-string {\n line-height: 1.3em;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.jer-hyperlink {\n text-decoration: underline;\n}\n\n.jer-input-text {\n resize: none;\n margin: 0;\n height: 1.4em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-top: 0.25em;\n padding-bottom: 0.2em;\n min-width: 6em;\n overflow: hidden;\n line-height: 1.2em;\n font-family: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-number {\n} */\n\n/* .jer-value-boolean {\n} */\n\n.jer-input-boolean {\n transform: scale(1.5);\n margin-left: 0.3em;\n margin-right: 0.3em;\n}\n\n/* .jer-value-null {\n} */\n\n.jer-value-object {\n}\n\n.jer-key-text {\n word-break: break-word;\n line-height: 1.1em;\n white-space: pre-wrap;\n}\n\n.jer-key-edit {\n padding: 0 0.3em;\n font-size: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-array {\n} */\n\n.jer-value-invalid {\n opacity: 0.5;\n font-style: italic;\n}\n\n.jer-input-number {\n min-width: 3em;\n font-size: 90%;\n}\n\n/* .jer-input-component {\n} */\n\n.jer-edit-buttons,\n.jer-confirm-buttons {\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 1em;\n}\n\n.jer-input-buttons {\n gap: 0.4em;\n}\n\n.jer-edit-buttons {\n gap: 0.4em;\n margin-left: 0.5em;\n opacity: 0;\n}\n\n.jer-confirm-buttons {\n gap: 0.2em;\n margin-left: 0.4em;\n}\n\n.jer-edit-buttons:hover {\n opacity: 1;\n position: relative;\n}\n\n.jer-collection-header-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-main-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-and-buttons:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n/* .jer-input-buttons {\n} */\n\n.jer-copy-pulse {\n position: relative;\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-copy-pulse:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n.jer-copy-pulse:after {\n content: '';\n display: block;\n position: absolute;\n border-radius: 50%;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: all 0.5s;\n box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);\n}\n\n.jer-copy-pulse:active:after {\n box-shadow: 0 0 0 0 var(--jer-icon-copy-color);\n position: absolute;\n border-radius: 4em;\n left: 0;\n top: 0;\n opacity: 1;\n transition: 0s;\n}\n\n.jer-copy-pulse:active {\n top: 0.07em;\n}\n\n.jer-rotate-90 {\n transform: rotate(-90deg);\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-accordion-icon {\n /* font-size: '2em'; */\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-icon:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n/* For displaying keys that are purely <empty string> \"\" */\n.jer-empty-string::after {\n content: '<empty string>';\n font-style: italic;\n font-size: 90%;\n}\n\n.jer-drag-n-drop-padding {\n height: 0.5em;\n border: 1px dashed #e0e0e0;\n border-radius: 0.3em;\n}\n",{});const m=({className:t,name:r,value:o,setValue:a,handleKeyPress:i,styles:l})=>{if("string"!=typeof o)return null;const s="\n"===o.slice(-1)?o+".":o;return e("div",{style:{display:"grid"},children:[n("textarea",{id:`${r}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},l),rows:1,className:t,name:`${r}_textarea`,value:o,onChange:e=>a(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:i}),n("span",{className:t,style:Object.assign({visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent"},l),children:s})]})},y={default:{displayName:"Default",fragments:{edit:"rgb(42, 161, 152)"},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},collection:{},collectionInner:{},collectionElement:{},dropZone:{},property:"#292929",bracket:{color:"rgb(0, 43, 54)",fontWeight:"bold"},itemCount:{color:"rgba(0, 0, 0, 0.3)",fontStyle:"italic"},string:"rgb(203, 75, 22)",number:"rgb(38, 139, 210)",boolean:"green",null:{color:"rgb(220, 50, 47)",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"rgb(0, 43, 54)",iconEdit:"edit",iconDelete:"rgb(203, 75, 22)",iconAdd:"edit",iconCopy:"rgb(38, 139, 210)",iconOk:"green",iconCancel:"rgb(203, 75, 22)"}},githubDark:{displayName:"Github Dark",styles:{container:{backgroundColor:"#0d1117",color:"white"},dropZone:"rgba(165, 214, 255, 0.17)",property:"#E6EDF3",bracket:"#56d364",itemCount:"#8B949E",string:"#A5D6FF",number:"#D2A8FF",boolean:{color:"#FF7B72",fontSize:"90%",fontWeight:"bold"},null:"green",iconCollection:"#D2A8FF",iconEdit:"#D2A8FF",iconDelete:"rgb(203, 75, 22)",iconAdd:"rgb(203, 75, 22)",iconCopy:"#A5D6FF",iconOk:"#56d364",iconCancel:"rgb(203, 75, 22)"}},githubLight:{displayName:"Github Light",styles:{container:"white",property:"#1F2328",bracket:"#00802e",itemCount:"#8B949E",string:"#0A3069",number:"#953800",boolean:{color:"#CF222E",fontSize:"90%",fontWeight:"bold"},null:"#FF7B72",iconCollection:"#8250DF",iconEdit:"#8250DF",iconDelete:"rgb(203, 75, 22)",iconAdd:"#8250DF",iconCopy:"#57606A"}},monoDark:{displayName:"Black & White",fragments:{lightText:{color:"white"},midGrey:"#5c5c5c"},styles:{container:["lightText",{backgroundColor:"black"}],dropZone:"#e0e0e029",property:"lightText",bracket:"midGrey",itemCount:"#4a4a4a",string:"#a8a8a8",number:"#666666",boolean:{color:"#848484",fontStyle:"italic"},null:"#333333",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},monoLight:{fragments:{midGrey:"#a3a3a3"},displayName:"White & Black",styles:{container:"white",property:"black",bracket:"midGrey",itemCount:"#b5b5b5",string:"#575757",number:"#999999",boolean:{color:"#7b7b7b",fontStyle:"italic"},null:"#cccccc",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},candyWrapper:{displayName:"Candy Wrapper",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},darkBlue:{color:"#2B2D42"}},styles:{container:"minty",property:"pop",dropZone:"#eb121217",bracket:"dark",itemCount:"pale",string:"mid",number:["darkBlue",{fontSize:"85%"}],boolean:["mid",{fontStyle:"italic",fontWeight:"bold",fontSize:"80%"}],null:["#cccccc",{fontWeight:"bold"}],input:{border:"1px solid rgb(115, 194, 198)"},iconCollection:"#1D3557",iconEdit:"#457B9D",iconDelete:"#E63946",iconAdd:"#2B2D42",iconCopy:"#1D3557",iconCancel:"#E63946"}},psychedelic:{displayName:"Psychedelic",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},fluroYellow:"rgb(242, 228, 21)",fluroGreen:"rgb(68, 255, 62)",hotPink:"#f7379a"},styles:{container:{backgroundColor:"unset",background:"linear-gradient(90deg, hsla(333, 100%, 53%, 1) 0%, hsla(33, 94%, 57%, 1) 100%)",color:"black"},dropZone:"fluroYellow",property:"black",bracket:"fluroYellow",itemCount:["pale",{opacity:.7}],string:"white",number:["#33d9ff",{fontSize:"90%",fontWeight:"bold"}],boolean:["fluroGreen",{fontWeight:"bold",fontSize:"80%"}],null:["black",{fontWeight:"bold",opacity:.3,backgroundColor:"rgb(255, 255, 255, 0.5)",padding:"0 0.4em",borderRadius:"0.4em"}],iconCollection:"fluroYellow",iconEdit:["black"],iconDelete:["white",{opacity:.5}],iconAdd:["white",{opacity:.5}],iconCopy:"rgb(32, 84, 242)",iconOk:"fluroGreen",iconCancel:"hotPink"}}},b=y.default,f=r({getStyles:()=>({}),icons:{}}),v=({theme:e="default",icons:t={},children:r})=>{const o=E(e);return n(f.Provider,{value:{getStyles:(e,n)=>"function"==typeof o[e]?o[e](n):o[e],icons:t},children:r})},j=()=>o(f),E=e=>{var n,t,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((n=>"default"===e?{}:"string"==typeof n?D(y[n],a):w(n)?D({fragments:{},styles:n},a):D(n,a))),l=D(b,{});Object.keys(l).forEach((e=>{const n=e;i.forEach((e=>{e[n]&&(l[n]=Object.assign(Object.assign({},l[n]),e[n]))}))}));const s=Object.assign({},l);return Object.entries(a).forEach((([e,n])=>{const t=e;s[t]=e=>{const r=n(e)||{};return Object.assign(Object.assign({},l[t]),r)}})),"function"!=typeof(null==s?void 0:s.inputHighlight)&&(null===(n=null==s?void 0:s.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(t=null==s?void 0:s.inputHighlight)||void 0===t?void 0:t.backgroundColor),"function"!=typeof(null==s?void 0:s.iconCopy)&&(null===(r=null==s?void 0:s.iconCopy)||void 0===r?void 0:r.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(o=null==s?void 0:s.iconCopy)||void 0===o?void 0:o.color),s},D=(e,n)=>{const{fragments:t,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a;if("function"==typeof o)return n[e]=o,Object.assign({},r);if("string"==typeof o){const n=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:o;return"string"==typeof n?Object.assign(Object.assign({},r),{[k[e]]:n}):Object.assign(Object.assign({},r),n)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},w=e=>!("styles"in e),k={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",property:"color",bracket:"color",itemCount:"color",string:"color",number:"color",boolean:"color",null:"color",input:"color",inputHighlight:"backgroundColor",error:"color",iconCollection:"color",iconEdit:"color",iconDelete:"color",iconAdd:"color",iconCopy:"color",iconOk:"color",iconCancel:"color"},C="**INVALID_FUNCTION**",O=(e,n=200)=>"string"==typeof e?e.length<n?e:`${e.slice(0,n-2).trim()}...`:e,S=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),N=({value:t,setValue:r,isEditing:o,path:a,setIsEditing:i,handleEdit:l,handleCancel:s,stringTruncate:c,showStringQuotes:d,nodeData:u})=>{const{getStyles:p}=j(),g=S(a),h=d?'"':"";return o?n(m,{className:"jer-input-text",name:g,value:t,setValue:r,isEditing:o,handleKeyPress:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&s():l()},styles:p("input",u)}):e("div",{id:`${g}_display`,onDoubleClick:()=>i(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&i(!0)},className:"jer-value-string",style:p("string",u),children:[h,O(t,c),h]})},x=({value:e,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s})=>{const{getStyles:c}=j();return r?n("input",{className:"jer-input-number",type:"text",name:S(o),value:e,onChange:e=>t(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:n=>{switch(n.key){case"Enter":i();break;case"Escape":l();break;case"ArrowUp":n.preventDefault(),t(Number(e)+1);break;case"ArrowDown":n.preventDefault(),t(Number(e)-1)}},style:Object.assign({width:String(e).length/1.5+2+"em"},c("input",s))}):n("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:c("number",s),children:e})},A=({value:e,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s})=>{const{getStyles:c}=j();return r?n("input",{className:"jer-input-boolean",type:"checkbox",name:S(o),checked:e,onChange:()=>t(!e),onKeyDown:e=>{"Enter"===e.key?i():"Escape"===e.key&&l()},autoFocus:!0}):n("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:c("boolean",s),children:String(e)})},T=({value:e,isEditing:t,setIsEditing:r,handleEdit:o,handleCancel:i,nodeData:l})=>{const{getStyles:s}=j();a((()=>(t&&document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c))),[t]);const c=e=>{"Enter"===e.key?o():"Escape"===e.key&&i()};return n("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:s("null",l),children:String(e)})},V=({value:e})=>{let t="Error!";switch(typeof e){case"string":e===C&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return n("span",{className:"jer-value-invalid",children:t})},P=({size:t,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:r,children:[n("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),n("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]}),R=({size:t,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:r,transform:"translate(0, 0.5)",children:[n("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),n("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),F=({size:e,style:t,className:r})=>n("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"})}),z=({size:t,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:r,children:[n("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),n("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),n("path",{d:"M15 10l-4 4 4 4"})]}),_=({size:t,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:r,children:[n("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),n("path",{d:"M22 4L12 14.01l-3-3"})]}),I=({size:e,style:t,className:r})=>n("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"})}),L=({size:e,style:t,className:r})=>n("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})}),K=({name:e,nodeData:r,rotate:o})=>{var a,i,l,s,c,d,u;const{getStyles:p,icons:g}=j(),h={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(a=null==g?void 0:g.add)&&void 0!==a?a:n(P,Object.assign({},h,{style:p("iconAdd",r)}));case"edit":return null!==(i=null==g?void 0:g.edit)&&void 0!==i?i:n(R,Object.assign({},h,{style:p("iconEdit",r)}));case"delete":return null!==(l=null==g?void 0:g.delete)&&void 0!==l?l:n(F,Object.assign({},h,{style:p("iconDelete",r),size:"1.45em"}));case"copy":return null!==(s=null==g?void 0:g.copy)&&void 0!==s?s:n(z,Object.assign({},h,{style:p("iconCopy",r),size:"1.2em"}));case"ok":return null!==(c=null==g?void 0:g.ok)&&void 0!==c?c:n(_,Object.assign({},h,{style:Object.assign({fontSize:"90%"},p("iconOk",r))}));case"cancel":return null!==(d=null==g?void 0:g.cancel)&&void 0!==d?d:n(I,Object.assign({},h,{style:Object.assign({fontSize:"130%"},p("iconCancel",r))}));case"chevron":return null!==(u=null==g?void 0:g.chevron)&&void 0!==u?u:n(L,{className:"jer-accordion-icon"+(o?" jer-rotate-90":""),size:"1em",style:p("iconCollection",r)});default:return n(t,{})}},M=({startEdit:r,handleDelete:o,handleAdd:a,enableClipboard:l,type:s,nodeData:c,translate:d})=>{const{getStyles:u}=j(),p=d("KEY_NEW",c),[g,h]=i(!1),[m,y]=i(p),{key:b,path:f,value:v}=c;return e("div",{className:"jer-edit-buttons",style:{opacity:g?1:void 0},children:[l&&n("div",{onClick:e=>{let n,t="value",r="";if(l){if(!0===(e.ctrlKey||e.metaKey))n=B(f),r=n,t="path";else n=v,r=s?JSON.stringify(v,null,2):String(n);navigator.clipboard.writeText(r)}"function"==typeof l&&l({value:n,stringValue:r,path:f,key:b,type:t})},className:"jer-copy-pulse",children:n(K,{name:"copy",nodeData:c})}),r&&n("div",{onClick:r,children:n(K,{name:"edit",nodeData:c})}),o&&n("div",{onClick:o,children:n(K,{name:"delete",nodeData:c})}),a&&n("div",{onClick:()=>{"object"===s?h(!0):a("")},children:n(K,{name:"add",nodeData:c})}),g&&a&&"object"===s&&e(t,{children:[n("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:m,onChange:e=>y(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&a?(h(!1),a(m),y(p)):"Escape"===e.key&&(h(!1),y(p))},style:u("input",c)}),n(W,{onOk:()=>{m&&(h(!1),a(m))},onCancel:()=>{h(!1)},nodeData:c})]})]})},W=({onOk:t,onCancel:r,nodeData:o})=>e("div",{className:"jer-confirm-buttons",children:[n("div",{onClick:t,children:n(K,{name:"ok",nodeData:o})}),n("div",{onClick:r,children:n(K,{name:"cancel",nodeData:o})})]}),B=e=>e.reduce(((e,n)=>"number"==typeof n?`${e}[${n}]`:""===e?n:`${e}.${n}`),""),G=["string","number","boolean","null","object","array"],U=(e=[],n)=>{const t=e.filter((({condition:e})=>e(n)));if(0===t.length)return{};const r=t[0],{element:o,wrapperElement:a,customNodeProps:i,wrapperProps:l,hideKey:s=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:p=!0}=r,g=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:a,customNodeProps:i,wrapperProps:l,hideKey:s,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:p},g)},Y=e=>null!==e&&"object"==typeof e,$=(e,n,t,r="")=>{if(!t&&!r)return!0;switch(e){case"collection":if(t){if(t(n,r))return!0;if(!H(r,n,t))return!1}if(!t&&r&&!H(r,n))return!1;break;case"value":if(t&&!t(n,r))return!1;if(!t&&r&&!J(n,r))return!1}return!0},H=(e="",n,t=J)=>{const r=n.value;return Object.entries(r).some((([o,a])=>{const i=[...n.path,o],l=Object.assign(Object.assign({},n),{key:o,path:i,level:n.level+1,value:a,size:i.length,parentData:r});return Y(a)?H(e,l,t):t(l,e)}))},J=(e,n="")=>{const{value:t}=e;if(null===t&&"null".includes(n.toLowerCase()))return!0;switch(typeof t){case"string":return t.toLowerCase().includes(n.toLowerCase());case"number":return!!String(t).includes(n);case"boolean":return t?"true".includes(n.toLowerCase())||"1"===n:"false".includes(n.toLowerCase())||"0"===n;default:return!1}},X=({key:e,path:n},t="")=>!!J({value:e},t)||!!n.some((e=>J({value:e},t))),Z=r({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),Q=({children:e})=>{const[t,r]=i(null),[o,a]=i(null),[l,s]=i({path:null,pathString:null});return n(Z.Provider,{value:{collapseState:t,setCollapseState:e=>{r(e),null!==e&&setTimeout((()=>r(null)),2e3)},doesPathMatch:e=>{if(null===t)return!1;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},currentlyEditingElement:o,setCurrentlyEditingElement:a,areChildrenBeingEdited:e=>null!==o&&o.includes(e),dragSource:l,setDragSource:s},children:e})},q=()=>o(Z),ee=({props:e,collapsed:n})=>{const{data:t,nodeData:r,parentData:o,onEdit:a,onError:s,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:h}=e,{currentlyEditingElement:m,setCurrentlyEditingElement:y}=q(),[b,f]=i(null),v=Object.assign(Object.assign({},r),{collapsed:n}),{path:j,key:E,size:D}=v,w=S(j),k=l((()=>!d(v)),[v]),C=l((()=>!u(v)),[v]),O=l((()=>!p(v)),[v]),N=l((()=>!g(v)&&C&&null===m),[v]),x=e=>{c&&(f(e),setTimeout((()=>f(null)),2500)),console.warn("Error",e)},A=l((()=>(e,n)=>{x(e.message),s&&s({currentData:v.fullData,errorValue:n,currentValue:t,name:E,path:j,error:e})}),[s,c]),T=m===w,V=m===`key_${w}`,P="number"==typeof j.slice(-1)[0];return{pathString:w,nodeData:v,path:j,name:E,size:D,canEdit:k,canDelete:C,canAdd:O,canDrag:N,error:b,showError:x,onError:A,setError:f,handleEditKey:e=>{if(y(null),E===e)return;if(!o)return;const n=j.slice(0,-1);if(Object.keys(o).includes(e))return void A({code:"KEY_EXISTS",message:h("ERROR_KEY_EXISTS",v)},e);const t=Object.fromEntries(Object.entries(o).map((([n,t])=>n===E?[e,t]:[n,t])));a(t,n).then((n=>{n&&A({code:"UPDATE_ERROR",message:n},e)}))},derivedValues:{isEditing:T,isEditingKey:V,isArray:P,canEditKey:null!==o&&k&&O&&C&&!P}}},ne=({canDrag:e,canDragOnto:t,path:r,nodeData:o,onMove:a,onError:s,translate:c})=>{const{getStyles:d}=j(),{dragSource:u,setDragSource:p}=q(),[g,h]=i(!1),m=S(r),y=l((()=>e?{onDragStart:e=>{e.stopPropagation(),p({path:r,pathString:m})},onDragEnd:e=>{e.stopPropagation(),p({path:null,pathString:null})}}:{}),[e]),b=l((()=>e=>t?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:n=>{n.stopPropagation(),v(e),p({path:null,pathString:null}),h(!1)},onDragEnter:n=>{var t;n.stopPropagation(),m.startsWith(null!==(t=u.pathString)&&void 0!==t?t:"")||h(e)},onDragExit:e=>{e.stopPropagation(),h(!1)}}:{}),[u,t]),f=l((()=>t&&null!==u.pathString?n("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:r.length}},b("below"))):null),[u,t]),v=e=>{var n,t;const i=null===(n=u.path)||void 0===n?void 0:n.slice(-1)[0],l=null===(t=u.path)||void 0===t?void 0:t.slice(0,-1).join("."),d=r.slice(0,-1).join(""),{parentData:p}=o;"string"==typeof i&&p&&!Array.isArray(p)&&Object.keys(p).includes(i)&&i in p&&l!==d?s({code:"KEY_EXISTS",message:c("ERROR_KEY_EXISTS",o)},i):a(u.path,r,e).then((e=>{e&&s({code:"UPDATE_ERROR",message:e},o.value)}))};return{dragSourceProps:y,getDropTargetProps:b,BottomDropTarget:f,DropTargetPadding:({position:e,nodeData:t})=>g===e?n("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",t)}):null,handleDrop:v}},te=t=>{const{data:r,parentData:o,onEdit:c,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:h,restrictTypeSelection:m,searchFilter:y,searchText:b,showLabel:f,stringTruncate:v,showStringQuotes:E,indent:D,translate:w,customNodeDefinitions:k}=t,{getStyles:O}=j(),{setCurrentlyEditingElement:S}=q(),[N,x]=i("function"==typeof r?C:r),{pathString:A,nodeData:T,path:V,name:P,canEdit:R,canDelete:F,canDrag:z,error:_,onError:I,handleEditKey:L,derivedValues:K}=ee({props:t}),{dragSourceProps:B,getDropTargetProps:Y,BottomDropTarget:H,DropTargetPadding:J}=ne({canDrag:z,canDragOnto:h,path:V,nodeData:T,onMove:p,onError:I,translate:w}),X=U(k,T),[Z,Q]=i(re(r,X)),te=s((e=>{if(!u)return void x(e);const n=u({currentData:T.fullData,newValue:e,currentValue:N,name:P,path:V});x(n)}),[u]);a((()=>{x("function"==typeof r?C:r),Q(re(r,X))}),[r,_]);const{CustomNode:ie,customNodeProps:le,hideKey:se,showEditTools:ce=!0,showOnEdit:de,showOnView:ue}=X,pe=[...G,...k.filter((({showInTypesSelector:e=!1,name:n})=>e&&!!n)).map((({name:e})=>e))],ge=l((()=>{if("boolean"==typeof m)return m?[]:pe;if(Array.isArray(m))return m;const e=m(T);return"boolean"==typeof e?e?[]:pe:e}),[T,m]);if(!$("value",T,y,b))return null;const he=()=>{let e;switch(S(null),Z){case"object":e={[w("DEFAULT_NEW_KEY",T)]:N};break;case"array":e=null!=N?N:[];break;case"number":{const n=Number(N);e=isNaN(n)?0:n;break}default:e=N}c(e,V).then((n=>{n&&I({code:"UPDATE_ERROR",message:n},e)}))},me=()=>{S(null),x(r),Q(re(r,X))},{isEditing:ye,isEditingKey:be,canEditKey:fe}=K,ve=!ye&&_,je=ye&&ge.length>0,Ee="invalid"!==Z&&!_&&ce,De=f&&be,we=f&&!be&&!se,ke={value:N,parentData:o,setValue:te,isEditing:ye,setIsEditing:R?()=>S(A):()=>{},handleEdit:he,handleCancel:me,path:V,stringTruncate:v,showStringQuotes:E,nodeData:T,translate:w},Ce=ie&&(ye&&de||!ye&&ue)?n(ie,Object.assign({},t,{value:N,customNodeProps:le,setValue:te,handleEdit:he,handleCancel:me,handleKeyPress:e=>{"Enter"===e.key?he():"Escape"===e.key&&me()},isEditing:ye,setIsEditing:()=>S(A),getStyles:O})):oe(re(r),ke);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:D/2+"em",position:"relative"},draggable:z},B,Y("above"),{children:[H,n(J,{position:"above",nodeData:T}),e("div",{className:"jer-value-main-row",style:{flexWrap:P.length>10?"wrap":"nowrap"},children:[we&&e("span",{className:"jer-key-text",style:Object.assign(Object.assign({},O("property",T)),{minWidth:`${Math.min(String(P).length+1,5)}ch`,flexShrink:P.length>10?1:0}),onDoubleClick:()=>fe&&S(`key_${A}`),children:[""===P?n("span",{className:"jer-empty-string"}):P,":"]}),De&&n("input",{className:"jer-input-text jer-key-edit",type:"text",name:A,defaultValue:P,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?L(e.target.value):"Escape"===e.key&&me()},style:{width:String(P).length/1.5+.5+"em"}}),e("div",{className:"jer-value-and-buttons",children:[n("div",{className:"jer-input-component",children:Ce}),ye?n(W,{onOk:he,onCancel:me,nodeData:T}):Ee&&n(M,{startEdit:R?()=>S(A):void 0,handleDelete:F?()=>{d(N,V).then((e=>{e&&I({code:"DELETE_ERROR",message:e},N)}))}:void 0,enableClipboard:g,translate:w,nodeData:T}),je&&e("div",{className:"jer-select",children:[n("select",{name:`${P}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const n=k.find((n=>n.name===e));if(n)c(n.defaultValue,V),Q(e);else{const n=ae(N,e,w("DEFAULT_NEW_KEY",T),(null==X?void 0:X.CustomNode)?w("DEFAULT_STRING",T):void 0);te(n),c(n,V).then((e=>{e&&(I({code:"UPDATE_ERROR",message:e},n),S(null))}))}})(e.target.value),value:Z,children:ge.map((e=>n("option",{value:e,children:e},e)))}),n("span",{className:"focus"})]}),ve&&n("span",{className:"jer-error-slug",style:O("error",T),children:_})]})]}),n(J,{position:"below",nodeData:T})]}))},re=(e,n)=>(null==n?void 0:n.CustomNode)&&(null==n?void 0:n.name)&&n.showInTypesSelector?n.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",oe=(e,t)=>{const r=t.value;switch(e){case"string":return n(N,Object.assign({},t,{value:r}));case"number":return n(x,Object.assign({},t,{value:r}));case"boolean":return n(A,Object.assign({},t,{value:r}));case"null":return n(T,Object.assign({},t));default:return n(V,Object.assign({},t))}},ae=(e,n,t,r)=>{switch(n){case"string":return null!=r?r:String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;case"null":return null;case"object":return{[t]:e};case"array":return[e];default:return String(e)}},ie=r=>{const{getStyles:o}=j(),{collapseState:s,setCollapseState:d,doesPathMatch:g,currentlyEditingElement:h,setCurrentlyEditingElement:y,areChildrenBeingEdited:b}=q(),{data:f,nodeData:v,parentData:E,showCollectionCount:D,onEdit:w,onAdd:k,onDelete:C,canDragOnto:O,collapseFilter:S,onMove:N,enableClipboard:x,searchFilter:A,searchText:T,indent:V,keySort:P,showArrayIndices:R,defaultValue:F,translate:z,customNodeDefinitions:_,jsonParse:I,jsonStringify:L}=r,[B,G]=i(L(f)),H=S(v),[J,X]=i(H),{pathString:Z,nodeData:Q,path:re,name:oe,size:ae,canEdit:le,canDelete:se,canAdd:ce,canDrag:de,error:ue,setError:pe,onError:ge,handleEditKey:he,derivedValues:me}=ee({props:r,collapsed:J}),{dragSourceProps:ye,getDropTargetProps:be,BottomDropTarget:fe,DropTargetPadding:ve}=ne({canDrag:de,canDragOnto:O,path:re,nodeData:Q,onMove:N,onError:ge,translate:z}),je=c(!H),[Ee,De]=i(!1);a((()=>{G(L(f))}),[f]),a((()=>{const e=S(Q)&&!me.isEditing;je.current=!e,X(e)}),[S]),a((()=>{null!==s&&g(re)&&(je.current=!0,X(s.collapsed))}),[s]);const we=l((()=>e=>"function"!=typeof F?F:F(e)),[F]),{CustomNode:ke,customNodeProps:Ce,CustomWrapper:Oe,wrapperProps:Se={},hideKey:Ne,showEditTools:xe=!0,showOnEdit:Ae,showOnView:Te,showCollectionWrapper:Ve=!0}=l((()=>U(_,Q)),[]);if(!$("collection",Q,A,T)&&Q.level>0)return null;const Pe=Array.isArray(f)?"array":"object",Re="array"===Pe?{open:"[",close:"]"}:{open:"{",close:"}"},Fe=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time"),ze=e=>{"Enter"===e.key&&(e.metaKey||e.shiftKey||e.ctrlKey)?_e():"Escape"===e.key&&Le()},_e=()=>{try{const e=I(B);if(y(null),pe(null),JSON.stringify(e)===JSON.stringify(f))return;w(e,re).then((n=>{n&&ge({code:"UPDATE_ERROR",message:n},e)}))}catch(e){ge({code:"INVALID_JSON",message:z("ERROR_INVALID_JSON",Q)},B)}},Ie=re.length>0?()=>{C(f,re).then((e=>{e&&ge({code:"DELETE_ERROR",message:e},u(f,re))}))}:void 0,Le=()=>{y(null),pe(null),G(L(f))},{isEditing:Ke,isEditingKey:Me,isArray:We,canEditKey:Be}=me,Ge="when-closed"===D?J:D,Ue=!Ke&&xe,Ye=(R||!We)&&!Ne&&void 0!==oe,$e=ke&&(Ke&&Ae||!Ke&&Te),He=P&&"object"===Pe,Je=Object.entries(f).map((([e,n])=>["array"===Pe?Number(e):e,n]));He&&Je.sort("function"==typeof P?(e,n)=>P(e[0],n[0]):void 0);const Xe=JSON.stringify(f,null,2).replace(/\\n/g,"\n").split("\n").length,Ze=je.current?Ke?n("div",{className:"jer-collection-text-edit",children:e("div",{children:[n(m,{className:"jer-collection-text-area",name:Z,value:B,setValue:G,isEditing:Ke,handleKeyPress:ze,styles:o("input",Q)}),n("div",{className:"jer-collection-input-button-row",children:n(W,{onOk:_e,onCancel:Le,nodeData:Q})})]})}):Je.map((([e,t],a)=>{const i={key:e,value:t,path:[...re,e],level:re.length+1,index:a,size:Y(t)?Object.keys(t).length:1,parentData:f,fullData:Q.fullData};return n("div",{className:"jer-collection-element",style:o("collectionElement",i),children:Y(t)?n(ie,Object.assign({},r,{data:t,parentData:f,nodeData:i,showCollectionCount:D,canDragOnto:le}),e):n(te,Object.assign({},r,{data:t,parentData:f,nodeData:i,canDragOnto:le,showLabel:"object"===Pe||R}),e)},e)})):null,Qe=!!Ve&&J;Qe||(je.current=!0);const qe=Object.assign(Object.assign({},r),{data:f,value:f,parentData:E,nodeData:Q,setValue:e=>p(void 0,void 0,void 0,(function*(){return yield w(e,re)})),handleEdit:_e,handleCancel:Le,handleKeyPress:ze,isEditing:Ke,setIsEditing:()=>y(Z),getStyles:o,canDragOnto:le}),en=$e?n(ke,Object.assign({customNodeProps:Ce},qe,{children:Ze})):Ze,nn=Me?n("input",{className:"jer-input-text jer-key-edit",type:"text",name:Z,defaultValue:oe,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?he(e.target.value):"Escape"===e.key&&Le()},style:{width:String(oe).length/1.5+.5+"em"}}):Ye&&n("span",{className:"jer-key-text",style:o("property",Q),onDoubleClick:()=>Be&&y(`key_${Z}`),children:""===oe?n("span",{className:re.length>0?"jer-empty-string":void 0}):`${oe}:`}),tn=Ue&&n(M,{startEdit:le?()=>{je.current=!0,y(Z),X(!1)}:void 0,handleAdd:ce?e=>{X(!1);const n=we(Q);"array"===Pe?k(n,[...re,f.length]).then((e=>{e&&ge({code:"ADD_ERROR",message:e},n)})):e in f?ge({code:"KEY_EXISTS",message:z("ERROR_KEY_EXISTS",Q)},e):k(n,[...re,e]).then((e=>{e&&ge({code:"ADD_ERROR",message:e},n)}))}:void 0,handleDelete:se?Ie:void 0,enableClipboard:x,type:Pe,nodeData:Q,translate:z}),rn=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===re.length?0:V/2)+"em"},o("collection",Q)),{position:"relative"}),draggable:de},ye,be("above"),{children:[!Ke&&fe,n(ve,{position:"above",nodeData:Q}),Ve?e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e("div",{className:"jer-collection-name",children:[n("div",{className:"jer-collapse-icon",onClick:e=>(e=>{if(e.getModifierState("Alt"))return je.current=!0,void d({collapsed:!J,path:re});h&&h.includes(Z)||(De(!0),je.current=!0,X(!J),d(null),setTimeout((()=>De(!1)),500))})(e),children:n(K,{name:"chevron",rotate:J,nodeData:Q})}),nn,!Ke&&n("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",Q),children:Re.open})]}),!Ke&&Ge&&n("div",{className:"jer-collection-item-count"+(Ge?" jer-visible":" jer-hidden"),style:o("itemCount",Q),children:1===ae?z("ITEM_SINGLE",Object.assign(Object.assign({},Q),{size:1}),1):z("ITEMS_MULTIPLE",Q,ae)}),n("div",{className:"jer-brackets"+(Qe?" jer-visible":" jer-hidden"),style:o("bracket",Q),children:Re.close}),tn]}):Ne?n(t,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[nn,tn]}),e("div",{className:"jer-collection-inner",style:Object.assign({maxHeight:Qe?0:b(Z)?void 0:3*Xe+"em",overflowY:Qe||Ee?"hidden":"visible",transition:`max-height ${Fe}`},o("collectionInner",Q)),children:[en,n("div",{className:Ke?"jer-collection-error-row":"jer-collection-error-row-edit",children:ue&&n("span",{className:"jer-error-slug",style:o("error",Q),children:ue})}),!Ke&&Ve&&n("div",{className:"jer-brackets jer-bracket-outside",style:o("bracket",Q),children:Re.close})]}),n(ve,{position:"below",nodeData:Q})]}));return Oe?n(Oe,Object.assign({customNodeProps:Se},qe,{children:rn})):rn},le={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",DEFAULT_STRING:"New data!",DEFAULT_NEW_KEY:"key"},se=(e,n)=>(t,r,o)=>((e,n,t,r,o)=>{if(n[r]){const e=n[r](t);if(null!==e)return e}const a=r in e?e[r]:le[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,n,r,t,o),ce=({data:e,setData:t,rootName:r="root",onUpdate:o=(()=>{}),onEdit:c=o,onDelete:d=o,onAdd:u=o,onChange:g,onError:h,showErrorMessages:m=!0,enableClipboard:y=!0,indent:b=3,collapse:f=!1,showCollectionCount:v=!0,restrictEdit:E=!1,restrictDelete:D=!1,restrictAdd:w=!1,restrictTypeSelection:k=!1,restrictDrag:C=!0,searchFilter:O,searchText:S,searchDebounceTime:N=350,keySort:x=!1,showArrayIndices:A=!0,showStringQuotes:T=!0,defaultValue:V=null,minWidth:P=250,maxWidth:R="min(600px, 90vw)",rootFontSize:F,stringTruncate:z=250,translations:_={},className:I,id:L,customText:K={},customNodeDefinitions:M=[],jsonParse:W=JSON.parse,jsonStringify:B=(e=>JSON.stringify(e,null,2))})=>{const{getStyles:G}=j(),U=s(pe(f),[f]),$=s(se(_,K),[_,K]),[H,J]=i(S),[X,Z]=(({setData:e,data:n})=>{const[t,r]=i(e?void 0:n),o=s((n=>{e?e(n):r(n)}),[e]);return a((()=>{e||r(n)}),[n]),[e?n:t,o]})({setData:t,data:e});a((()=>{const e=setTimeout((()=>J(S)),N);return()=>clearTimeout(e)}),[S,N]);const Q={key:r,path:[],level:0,index:0,value:X,size:"object"==typeof X&&null!==X?Object.keys(X).length:1,parentData:null,fullData:X},q=(e,n)=>p(void 0,void 0,void 0,(function*(){const t=yield e(n);if(void 0===t)return void Z(n.newData);const r=he(t)?t:["error",t],[o,a]=r;if("error"===o)return Z(n.currentData),!1===a?$("ERROR_UPDATE",Q):String(a);Z(a)})),ee=l((()=>pe(E)),[E]),ne=l((()=>pe(D)),[D]),re=l((()=>pe(w)),[w]),oe=l((()=>pe(C)),[C]),ae=l((()=>ge(O)),[O]),le={name:r,nodeData:Q,onEdit:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=ue(X,n,e,"update");if(o!==a)return yield q(c,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onDelete:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=ue(X,n,e,"delete");return yield q(d,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onAdd:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=ue(X,n,e,"add");return yield q(u,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onChange:g,onError:h,showErrorMessages:m,onMove:(e,n,t)=>p(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=ue(X,e,"","delete"),i=e.slice(-1)[0],l=n.slice(0,-1),s=n.slice(-1)[0];let d="number"==typeof s?"above"===t?s:s+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===n.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===t?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=ue(o,[...l,d],a,"add",u);return yield q(c,{currentData:r,newData:p,currentValue:a,newValue:g,name:n.slice(-1)[0],path:n})})),showCollectionCount:v,collapseFilter:U,restrictEditFilter:ee,restrictDeleteFilter:ne,restrictAddFilter:re,restrictTypeSelection:k,restrictDragFilter:oe,canDragOnto:!1,searchFilter:ae,searchText:H,enableClipboard:y,keySort:x,showArrayIndices:A,showStringQuotes:T,indent:b,defaultValue:V,stringTruncate:z,translate:$,customNodeDefinitions:M,parentData:null,jsonParse:W,jsonStringify:B},ce=Object.assign(Object.assign({},G("container",Q)),{minWidth:P,maxWidth:R});return ce.fontSize=null!=F?F:ce.fontSize,n("div",{id:L,className:"jer-editor-container "+I,style:ce,children:Y(X)?n(ie,Object.assign({data:X},le)):n(te,Object.assign({data:X,showLabel:!0},le))})},de=e=>n(v,{theme:e.theme,icons:e.icons,children:n(Q,{children:n(ce,Object.assign({},e))})}),ue=(e,n,t,r,o={})=>{if(0===n.length)return{currentData:e,newData:t,currentValue:e,newValue:t};const a=Object.assign({remove:"delete"===r},o),i="add"!==r?u(e,n):void 0;return{currentData:e,newData:d(e,n,t,a),currentValue:i,newValue:"delete"!==r?t:void 0}},pe=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:n})=>n>=e:e,ge=e=>{if(void 0!==e)return"value"===e?J:"key"===e?X:"all"===e?(e,n)=>J(e,n)||X(e,n):e},he=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),me=({value:t,setIsEditing:r,getStyles:o,customNodeProps:a,nodeData:i})=>{var l,s;const c=null!==(l=null==a?void 0:a.stringTruncate)&&void 0!==l?l:100,d=o("string",i);return n("div",{onDoubleClick:()=>r(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&r(!0)},className:"jer-value-string jer-hyperlink",style:d,children:e("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:null!==(s=d.color)&&void 0!==s?s:void 0},children:['"',O(t,c),'"']})})},ye={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:me,showOnView:!0,showOnEdit:!1};export{P as IconAdd,I as IconCancel,L as IconChevron,z as IconCopy,F as IconDelete,R as IconEdit,_ as IconOk,de as JsonEditor,me as LinkCustomComponent,ye as LinkCustomNodeDefinition,Y as isCollection,J as matchNode,X as matchNodeKey,y as themes,O as truncate};
import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import{createContext as r,useContext as o,useEffect as a,useState as i,useMemo as l,useCallback as s,useRef as c}from"react";import d from"object-property-assigner";export{default as assign}from"object-property-assigner";import u from"object-property-extractor";export{default as extract}from"object-property-extractor";function p(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function l(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,l)}s((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var g=[],m=[];!function(e,n){if(e&&"undefined"!=typeof document){var t,r=!0===n.prepend?"prepend":"append",o=!0===n.singleTag,a="string"==typeof n.container?document.querySelector(n.container):document.getElementsByTagName("head")[0];if(o){var i=g.indexOf(a);-1===i&&(i=g.push(a)-1,m[i]={}),t=m[i]&&m[i][r]?m[i][r]:m[i][r]=l()}else t=l();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function l(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),n.attributes)for(var t=Object.keys(n.attributes),o=0;o<t.length;o++)e.setAttribute(t[o],n.attributes[t[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(":root {\n --jer-select-border: #b6b6b6;\n --jer-select-focus: #777;\n --jer-select-arrow: #777;\n --jer-form-border: 1px solid #ededf0;\n --jer-form-border-focus: 1px solid #e2e2e2;\n --jer-expand-transition-time: 0.5s;\n --jer-highlight-color: #b3d8ff;\n}\n\n.jer-visible {\n opacity: 1;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-hidden {\n opacity: 0;\n transition: var(--jer-expand-transition-time);\n}\n\n/* Select styled as per:\nhttps://moderncss.dev/custom-select-styles-with-pure-css/\n*/\n\n.jer-select select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: transparent;\n border: none;\n padding: 0 1em 0 0;\n margin: 0;\n /* width: 100%; */\n font-family: inherit;\n font-size: 0.8em;\n color: black;\n cursor: inherit;\n line-height: inherit;\n z-index: 1;\n outline: none;\n}\nselect::-ms-expand {\n display: none;\n}\n\n.jer-select {\n display: grid;\n grid-template-areas: 'select';\n align-items: center;\n position: relative;\n min-width: 12ch;\n max-width: 15ch;\n border: 1px solid var(--jer-select-border);\n border-radius: 0.25em;\n padding: 0.25em 0.5em;\n cursor: pointer;\n line-height: 1.1;\n background-color: #fff;\n background-image: linear-gradient(to top, #f9f9f9, #fff 33%);\n}\n.jer-select select,\n.jer-select::after {\n grid-area: select;\n}\n.jer-select:not(.jer-select--multiple)::after {\n content: '';\n justify-self: end;\n width: 0.8em;\n height: 0.5em;\n background-color: var(--jer-select-arrow);\n -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n}\n\nselect:focus + .focus {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n border: 1px solid var(--jer-select-focus);\n border-radius: inherit;\n}\n\n.jer-editor-container {\n position: relative;\n font-size: 16px;\n line-height: 1;\n padding: 1em;\n padding-left: 2em;\n /* margin-top: 1em; */\n /* margin-bottom: 1em; */\n border-radius: 0.5em;\n text-align: left;\n}\n\n.jer-editor-container textarea {\n color: var(--jer-input-color);\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n}\n\n.jer-editor-container textarea:focus {\n border: var(--jer-form-border-focus);\n}\n\n.jer-editor-container input {\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n font-family: inherit;\n}\n\n.jer-editor-container input:focus {\n border: var(--jer-form-border-focus);\n}\n\n/* Input highlighted text */\n.jer-editor-container ::selection {\n background-color: var(--jer-highlight-color);\n}\n\n/* .jer-editor-container select {\n color: red;\n} */\n\n/* .jer-component {\n} */\n\n.jer-collection-header-row,\n.jer-value-main-row {\n display: flex;\n min-height: 1.7em;\n gap: 0.3em;\n align-items: center;\n}\n\n.jer-collection-header-row {\n display: flex;\n flex-wrap: wrap;\n}\n\n/* .jer-brackets {\n} */\n\n/* .jer-bracket-outside {\n} */\n\n/* .jer-collection-item-count {\n} */\n\n.jer-collapse-icon {\n position: absolute;\n left: -1.2em;\n top: 0.35em;\n}\n\n.jer-collection-inner {\n position: relative;\n}\n\n.jer-collection-text-edit {\n display: flex;\n flex-direction: column;\n gap: 0.3em;\n align-items: flex-start;\n}\n\n.jer-collection-text-area {\n resize: both;\n padding-top: 0.2em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-bottom: 0;\n overflow: hidden;\n max-height: 40em;\n font-family: inherit;\n font-size: 0.85em;\n}\n\n.jer-collection-input-button-row {\n display: flex;\n justify-content: flex-end;\n font-size: 150%;\n margin-top: 0.4em;\n}\n\n/* .jer-collection-element {\n} */\n\n.jer-collection-error-row {\n position: absolute;\n bottom: 0.5em;\n}\n\n/* .jer-collection-error-row-edit {\n} */\n\n.jer-error-slug {\n margin-left: 1em;\n}\n\n.jer-value-component {\n position: relative;\n}\n\n.jer-value-main-row {\n display: flex;\n gap: 0;\n}\n\n.jer-value-and-buttons {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-left: 0.5em;\n}\n\n.jer-value-error-row {\n position: absolute;\n}\n\n.jer-value-string {\n line-height: 1.3em;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.jer-hyperlink {\n text-decoration: underline;\n}\n\n.jer-input-text {\n resize: none;\n margin: 0;\n height: 1.4em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-top: 0.25em;\n padding-bottom: 0.2em;\n min-width: 6em;\n overflow: hidden;\n line-height: 1.2em;\n font-family: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-number {\n} */\n\n/* .jer-value-boolean {\n} */\n\n.jer-input-boolean {\n transform: scale(1.5);\n margin-left: 0.3em;\n margin-right: 0.3em;\n}\n\n/* .jer-value-null {\n} */\n\n.jer-value-object {\n}\n\n.jer-key-text {\n word-break: break-word;\n line-height: 1.1em;\n white-space: pre-wrap;\n}\n\n.jer-key-edit {\n padding: 0 0.3em;\n font-size: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-array {\n} */\n\n.jer-value-invalid {\n opacity: 0.5;\n font-style: italic;\n}\n\n.jer-input-number {\n min-width: 3em;\n font-size: 90%;\n}\n\n/* .jer-input-component {\n} */\n\n.jer-edit-buttons,\n.jer-confirm-buttons {\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 1em;\n}\n\n.jer-input-buttons {\n gap: 0.4em;\n}\n\n.jer-edit-buttons {\n gap: 0.4em;\n margin-left: 0.5em;\n opacity: 0;\n}\n\n.jer-confirm-buttons {\n gap: 0.2em;\n margin-left: 0.4em;\n}\n\n.jer-edit-buttons:hover {\n opacity: 1;\n position: relative;\n}\n\n.jer-collection-header-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-main-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-and-buttons:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n/* .jer-input-buttons {\n} */\n\n.jer-copy-pulse {\n position: relative;\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-copy-pulse:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n.jer-copy-pulse:after {\n content: '';\n display: block;\n position: absolute;\n border-radius: 50%;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: all 0.5s;\n box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);\n}\n\n.jer-copy-pulse:active:after {\n box-shadow: 0 0 0 0 var(--jer-icon-copy-color);\n position: absolute;\n border-radius: 4em;\n left: 0;\n top: 0;\n opacity: 1;\n transition: 0s;\n}\n\n.jer-copy-pulse:active {\n top: 0.07em;\n}\n\n.jer-rotate-90 {\n transform: rotate(-90deg);\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-accordion-icon {\n /* font-size: '2em'; */\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-icon:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n/* For displaying keys that are purely <empty string> \"\" */\n.jer-empty-string::after {\n content: '<empty string>';\n font-style: italic;\n font-size: 90%;\n}\n\n.jer-drag-n-drop-padding {\n height: 0.5em;\n border: 1px dashed #e0e0e0;\n border-radius: 0.3em;\n}\n",{});const h=({className:t,name:r,value:o,setValue:a,handleKeyPress:i,styles:l})=>{if("string"!=typeof o)return null;const s="\n"===o.slice(-1)?o+".":o;return e("div",{style:{display:"grid"},children:[n("textarea",{id:`${r}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},l),rows:1,className:t,name:`${r}_textarea`,value:o,onChange:e=>a(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:i}),n("span",{className:t,style:Object.assign({visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent"},l),children:s})]})},y={default:{displayName:"Default",fragments:{edit:"rgb(42, 161, 152)"},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},collection:{},collectionInner:{},collectionElement:{},dropZone:{},property:"#292929",bracket:{color:"rgb(0, 43, 54)",fontWeight:"bold"},itemCount:{color:"rgba(0, 0, 0, 0.3)",fontStyle:"italic"},string:"rgb(203, 75, 22)",number:"rgb(38, 139, 210)",boolean:"green",null:{color:"rgb(220, 50, 47)",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"rgb(0, 43, 54)",iconEdit:"edit",iconDelete:"rgb(203, 75, 22)",iconAdd:"edit",iconCopy:"rgb(38, 139, 210)",iconOk:"green",iconCancel:"rgb(203, 75, 22)"}},githubDark:{displayName:"Github Dark",styles:{container:{backgroundColor:"#0d1117",color:"white"},dropZone:"rgba(165, 214, 255, 0.17)",property:"#E6EDF3",bracket:"#56d364",itemCount:"#8B949E",string:"#A5D6FF",number:"#D2A8FF",boolean:{color:"#FF7B72",fontSize:"90%",fontWeight:"bold"},null:"green",iconCollection:"#D2A8FF",iconEdit:"#D2A8FF",iconDelete:"rgb(203, 75, 22)",iconAdd:"rgb(203, 75, 22)",iconCopy:"#A5D6FF",iconOk:"#56d364",iconCancel:"rgb(203, 75, 22)"}},githubLight:{displayName:"Github Light",styles:{container:"white",property:"#1F2328",bracket:"#00802e",itemCount:"#8B949E",string:"#0A3069",number:"#953800",boolean:{color:"#CF222E",fontSize:"90%",fontWeight:"bold"},null:"#FF7B72",iconCollection:"#8250DF",iconEdit:"#8250DF",iconDelete:"rgb(203, 75, 22)",iconAdd:"#8250DF",iconCopy:"#57606A"}},monoDark:{displayName:"Black & White",fragments:{lightText:{color:"white"},midGrey:"#5c5c5c"},styles:{container:["lightText",{backgroundColor:"black"}],dropZone:"#e0e0e029",property:"lightText",bracket:"midGrey",itemCount:"#4a4a4a",string:"#a8a8a8",number:"#666666",boolean:{color:"#848484",fontStyle:"italic"},null:"#333333",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},monoLight:{fragments:{midGrey:"#a3a3a3"},displayName:"White & Black",styles:{container:"white",property:"black",bracket:"midGrey",itemCount:"#b5b5b5",string:"#575757",number:"#999999",boolean:{color:"#7b7b7b",fontStyle:"italic"},null:"#cccccc",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},candyWrapper:{displayName:"Candy Wrapper",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},darkBlue:{color:"#2B2D42"}},styles:{container:"minty",property:"pop",dropZone:"#eb121217",bracket:"dark",itemCount:"pale",string:"mid",number:["darkBlue",{fontSize:"85%"}],boolean:["mid",{fontStyle:"italic",fontWeight:"bold",fontSize:"80%"}],null:["#cccccc",{fontWeight:"bold"}],input:{border:"1px solid rgb(115, 194, 198)"},iconCollection:"#1D3557",iconEdit:"#457B9D",iconDelete:"#E63946",iconAdd:"#2B2D42",iconCopy:"#1D3557",iconCancel:"#E63946"}},psychedelic:{displayName:"Psychedelic",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},fluroYellow:"rgb(242, 228, 21)",fluroGreen:"rgb(68, 255, 62)",hotPink:"#f7379a"},styles:{container:{backgroundColor:"unset",background:"linear-gradient(90deg, hsla(333, 100%, 53%, 1) 0%, hsla(33, 94%, 57%, 1) 100%)",color:"black"},dropZone:"fluroYellow",property:"black",bracket:"fluroYellow",itemCount:["pale",{opacity:.7}],string:"white",number:["#33d9ff",{fontSize:"90%",fontWeight:"bold"}],boolean:["fluroGreen",{fontWeight:"bold",fontSize:"80%"}],null:["black",{fontWeight:"bold",opacity:.3,backgroundColor:"rgb(255, 255, 255, 0.5)",padding:"0 0.4em",borderRadius:"0.4em"}],iconCollection:"fluroYellow",iconEdit:["black"],iconDelete:["white",{opacity:.5}],iconAdd:["white",{opacity:.5}],iconCopy:"rgb(32, 84, 242)",iconOk:"fluroGreen",iconCancel:"hotPink"}}},b=y.default,f=r({getStyles:()=>({}),icons:{}}),v=({theme:e="default",icons:t={},children:r})=>{const o=E(e);return n(f.Provider,{value:{getStyles:(e,n)=>"function"==typeof o[e]?o[e](n):o[e],icons:t},children:r})},j=()=>o(f),E=e=>{var n,t,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((n=>"default"===e?{}:"string"==typeof n?D(y[n],a):w(n)?D({fragments:{},styles:n},a):D(n,a))),l=D(b,{});Object.keys(l).forEach((e=>{const n=e;i.forEach((e=>{e[n]&&(l[n]=Object.assign(Object.assign({},l[n]),e[n]))}))}));const s=Object.assign({},l);return Object.entries(a).forEach((([e,n])=>{const t=e;s[t]=e=>{const r=n(e)||{};return Object.assign(Object.assign({},l[t]),r)}})),"function"!=typeof(null==s?void 0:s.inputHighlight)&&(null===(n=null==s?void 0:s.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(t=null==s?void 0:s.inputHighlight)||void 0===t?void 0:t.backgroundColor),"function"!=typeof(null==s?void 0:s.iconCopy)&&(null===(r=null==s?void 0:s.iconCopy)||void 0===r?void 0:r.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(o=null==s?void 0:s.iconCopy)||void 0===o?void 0:o.color),s},D=(e,n)=>{const{fragments:t,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a;if("function"==typeof o)return n[e]=o,Object.assign({},r);if("string"==typeof o){const n=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:o;return"string"==typeof n?Object.assign(Object.assign({},r),{[k[e]]:n}):Object.assign(Object.assign({},r),n)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},w=e=>!("styles"in e),k={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",property:"color",bracket:"color",itemCount:"color",string:"color",number:"color",boolean:"color",null:"color",input:"color",inputHighlight:"backgroundColor",error:"color",iconCollection:"color",iconEdit:"color",iconDelete:"color",iconAdd:"color",iconCopy:"color",iconOk:"color",iconCancel:"color"},C="**INVALID_FUNCTION**",O=(e,n=200)=>"string"==typeof e?e.length<n?e:`${e.slice(0,n-2).trim()}...`:e,S=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),N=({value:t,setValue:r,isEditing:o,path:a,setIsEditing:i,handleEdit:l,handleCancel:s,stringTruncate:c,showStringQuotes:d,nodeData:u})=>{const{getStyles:p}=j(),g=S(a),m=d?'"':"";return o?n(h,{className:"jer-input-text",name:g,value:t,setValue:r,isEditing:o,handleKeyPress:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&s():l()},styles:p("input",u)}):e("div",{id:`${g}_display`,onDoubleClick:()=>i(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&i(!0)},className:"jer-value-string",style:p("string",u),children:[m,O(t,c),m]})},x=({value:e,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s})=>{const{getStyles:c}=j();return r?n("input",{className:"jer-input-number",type:"text",name:S(o),value:e,onChange:e=>t(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:n=>{switch(n.key){case"Enter":i();break;case"Escape":l();break;case"ArrowUp":n.preventDefault(),t(Number(e)+1);break;case"ArrowDown":n.preventDefault(),t(Number(e)-1)}},style:Object.assign({width:String(e).length/1.5+2+"em"},c("input",s))}):n("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:c("number",s),children:e})},A=({value:e,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s})=>{const{getStyles:c}=j();return r?n("input",{className:"jer-input-boolean",type:"checkbox",name:S(o),checked:e,onChange:()=>t(!e),onKeyDown:e=>{"Enter"===e.key?i():"Escape"===e.key&&l()},autoFocus:!0}):n("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:c("boolean",s),children:String(e)})},T=({value:e,isEditing:t,setIsEditing:r,handleEdit:o,handleCancel:i,nodeData:l})=>{const{getStyles:s}=j();a((()=>(t&&document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c))),[t]);const c=e=>{"Enter"===e.key?o():"Escape"===e.key&&i()};return n("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:s("null",l),children:String(e)})},P=({value:e})=>{let t="Error!";switch(typeof e){case"string":e===C&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return n("span",{className:"jer-value-invalid",children:t})},V=({size:t,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:r,children:[n("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),n("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]}),F=({size:t,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:r,transform:"translate(0, 0.5)",children:[n("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),n("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),R=({size:e,style:t,className:r})=>n("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"})}),z=({size:t,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:r,children:[n("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),n("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),n("path",{d:"M15 10l-4 4 4 4"})]}),_=({size:t,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:r,children:[n("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),n("path",{d:"M22 4L12 14.01l-3-3"})]}),I=({size:e,style:t,className:r})=>n("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"})}),L=({size:e,style:t,className:r})=>n("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})}),K=({name:e,nodeData:r,rotate:o})=>{var a,i,l,s,c,d,u;const{getStyles:p,icons:g}=j(),m={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(a=null==g?void 0:g.add)&&void 0!==a?a:n(V,Object.assign({},m,{style:p("iconAdd",r)}));case"edit":return null!==(i=null==g?void 0:g.edit)&&void 0!==i?i:n(F,Object.assign({},m,{style:p("iconEdit",r)}));case"delete":return null!==(l=null==g?void 0:g.delete)&&void 0!==l?l:n(R,Object.assign({},m,{style:p("iconDelete",r),size:"1.45em"}));case"copy":return null!==(s=null==g?void 0:g.copy)&&void 0!==s?s:n(z,Object.assign({},m,{style:p("iconCopy",r),size:"1.2em"}));case"ok":return null!==(c=null==g?void 0:g.ok)&&void 0!==c?c:n(_,Object.assign({},m,{style:Object.assign({fontSize:"90%"},p("iconOk",r))}));case"cancel":return null!==(d=null==g?void 0:g.cancel)&&void 0!==d?d:n(I,Object.assign({},m,{style:Object.assign({fontSize:"130%"},p("iconCancel",r))}));case"chevron":return null!==(u=null==g?void 0:g.chevron)&&void 0!==u?u:n(L,{className:"jer-accordion-icon"+(o?" jer-rotate-90":""),size:"1em",style:p("iconCollection",r)});default:return n(t,{})}},M=({startEdit:r,handleDelete:o,handleAdd:a,enableClipboard:l,type:s,nodeData:c,translate:d})=>{const{getStyles:u}=j(),p=d("KEY_NEW",c),[g,m]=i(!1),[h,y]=i(p),{key:b,path:f,value:v}=c;return e("div",{className:"jer-edit-buttons",style:{opacity:g?1:void 0},children:[l&&n("div",{onClick:e=>{let n,t="value",r="";if(l){if(!0===(e.ctrlKey||e.metaKey))n=B(f),r=n,t="path";else n=v,r=s?JSON.stringify(v,null,2):String(n);navigator.clipboard.writeText(r)}"function"==typeof l&&l({value:n,stringValue:r,path:f,key:b,type:t})},className:"jer-copy-pulse",children:n(K,{name:"copy",nodeData:c})}),r&&n("div",{onClick:r,children:n(K,{name:"edit",nodeData:c})}),o&&n("div",{onClick:o,children:n(K,{name:"delete",nodeData:c})}),a&&n("div",{onClick:()=>{"object"===s?m(!0):a("")},children:n(K,{name:"add",nodeData:c})}),g&&a&&"object"===s&&e(t,{children:[n("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:h,onChange:e=>y(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&a?(m(!1),a(h),y(p)):"Escape"===e.key&&(m(!1),y(p))},style:u("input",c)}),n(W,{onOk:()=>{h&&(m(!1),a(h))},onCancel:()=>{m(!1)},nodeData:c})]})]})},W=({onOk:t,onCancel:r,nodeData:o})=>e("div",{className:"jer-confirm-buttons",children:[n("div",{onClick:t,children:n(K,{name:"ok",nodeData:o})}),n("div",{onClick:r,children:n(K,{name:"cancel",nodeData:o})})]}),B=e=>e.reduce(((e,n)=>"number"==typeof n?`${e}[${n}]`:""===e?n:`${e}.${n}`),""),G=["string","number","boolean","null","object","array"],U=(e=[],n)=>{const t=e.filter((({condition:e})=>e(n)));if(0===t.length)return{};const r=t[0],{element:o,wrapperElement:a,customNodeProps:i,wrapperProps:l,hideKey:s=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:p=!0}=r,g=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:a,customNodeProps:i,wrapperProps:l,hideKey:s,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:p},g)},Y=e=>null!==e&&"object"==typeof e,$=(e,n,t,r="")=>{if(!t&&!r)return!0;switch(e){case"collection":if(t){if(t(n,r))return!0;if(!H(r,n,t))return!1}if(!t&&r&&!H(r,n))return!1;break;case"value":if(t&&!t(n,r))return!1;if(!t&&r&&!J(n,r))return!1}return!0},H=(e="",n,t=J)=>{const r=n.value;return Object.entries(r).some((([o,a])=>{const i=[...n.path,o],l=Object.assign(Object.assign({},n),{key:o,path:i,level:n.level+1,value:a,size:i.length,parentData:r});return Y(a)?H(e,l,t):t(l,e)}))},J=(e,n="")=>{const{value:t}=e;if(null===t&&"null".includes(n.toLowerCase()))return!0;switch(typeof t){case"string":return t.toLowerCase().includes(n.toLowerCase());case"number":return!!String(t).includes(n);case"boolean":return t?"true".includes(n.toLowerCase())||"1"===n:"false".includes(n.toLowerCase())||"0"===n;default:return!1}},X=({key:e,path:n},t="")=>!!J({value:e},t)||!!n.some((e=>J({value:e},t))),Z=r({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),Q=({children:e})=>{const[t,r]=i(null),[o,a]=i(null),[l,s]=i({path:null,pathString:null});return n(Z.Provider,{value:{collapseState:t,setCollapseState:e=>{r(e),null!==e&&setTimeout((()=>r(null)),2e3)},doesPathMatch:e=>{if(null===t)return!1;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},currentlyEditingElement:o,setCurrentlyEditingElement:a,areChildrenBeingEdited:e=>null!==o&&o.includes(e),dragSource:l,setDragSource:s},children:e})},q=()=>o(Z),ee=({props:e,collapsed:n})=>{const{data:t,nodeData:r,parentData:o,onEdit:a,onError:s,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:m}=e,{currentlyEditingElement:h,setCurrentlyEditingElement:y}=q(),[b,f]=i(null),v=Object.assign(Object.assign({},r),{collapsed:n}),{path:j,key:E,size:D}=v,w=S(j),k=l((()=>!d(v)),[v]),C=l((()=>!u(v)),[v]),O=l((()=>!p(v)),[v]),N=l((()=>!g(v)&&C&&null===h),[v]),x=e=>{c&&(f(e),setTimeout((()=>f(null)),2500)),console.warn("Error",e)},A=l((()=>(e,n)=>{x(e.message),s&&s({currentData:v.fullData,errorValue:n,currentValue:t,name:E,path:j,error:e})}),[s,c]),T=h===w,P=h===`key_${w}`,V="number"==typeof j.slice(-1)[0];return{pathString:w,nodeData:v,path:j,name:E,size:D,canEdit:k,canDelete:C,canAdd:O,canDrag:N,error:b,showError:x,onError:A,setError:f,handleEditKey:e=>{if(y(null),E===e)return;if(!o)return;const n=j.slice(0,-1);if(Object.keys(o).includes(e))return void A({code:"KEY_EXISTS",message:m("ERROR_KEY_EXISTS",v)},e);const t=Object.fromEntries(Object.entries(o).map((([n,t])=>n===E?[e,t]:[n,t])));a(t,n).then((n=>{n&&A({code:"UPDATE_ERROR",message:n},e)}))},derivedValues:{isEditing:T,isEditingKey:P,isArray:V,canEditKey:null!==o&&k&&O&&C&&!V}}},ne=({canDrag:e,canDragOnto:t,path:r,nodeData:o,onMove:a,onError:s,translate:c})=>{const{getStyles:d}=j(),{dragSource:u,setDragSource:p}=q(),[g,m]=i(!1),h=S(r),y=l((()=>e?{onDragStart:e=>{e.stopPropagation(),p({path:r,pathString:h})},onDragEnd:e=>{e.stopPropagation(),p({path:null,pathString:null})}}:{}),[e]),b=l((()=>e=>t?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:n=>{n.stopPropagation(),v(e),p({path:null,pathString:null}),m(!1)},onDragEnter:n=>{var t;n.stopPropagation(),h.startsWith(null!==(t=u.pathString)&&void 0!==t?t:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[u,t]),f=l((()=>t&&null!==u.pathString?n("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:r.length}},b("below"))):null),[u,t]),v=e=>{var n,t;const i=null===(n=u.path)||void 0===n?void 0:n.slice(-1)[0],l=null===(t=u.path)||void 0===t?void 0:t.slice(0,-1).join("."),d=r.slice(0,-1).join(""),{parentData:p}=o;"string"==typeof i&&p&&!Array.isArray(p)&&Object.keys(p).includes(i)&&i in p&&l!==d?s({code:"KEY_EXISTS",message:c("ERROR_KEY_EXISTS",o)},i):a(u.path,r,e).then((e=>{e&&s({code:"UPDATE_ERROR",message:e},o.value)}))};return{dragSourceProps:y,getDropTargetProps:b,BottomDropTarget:f,DropTargetPadding:({position:e,nodeData:t})=>g===e?n("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",t)}):null,handleDrop:v}},te=t=>{const{data:r,parentData:o,onEdit:c,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:m,restrictTypeSelection:h,searchFilter:y,searchText:b,showLabel:f,stringTruncate:v,showStringQuotes:E,indent:D,translate:w,customNodeDefinitions:k}=t,{getStyles:O}=j(),{setCurrentlyEditingElement:S}=q(),[N,x]=i("function"==typeof r?C:r),{pathString:A,nodeData:T,path:P,name:V,canEdit:F,canDelete:R,canDrag:z,error:_,onError:I,handleEditKey:L,derivedValues:K}=ee({props:t}),{dragSourceProps:B,getDropTargetProps:Y,BottomDropTarget:H,DropTargetPadding:J}=ne({canDrag:z,canDragOnto:m,path:P,nodeData:T,onMove:p,onError:I,translate:w}),X=U(k,T),[Z,Q]=i(re(r,X)),te=s((e=>{if(!u)return void x(e);const n=u({currentData:T.fullData,newValue:e,currentValue:N,name:V,path:P});x(n)}),[u]);a((()=>{x("function"==typeof r?C:r),Q(re(r,X))}),[r,_]);const{CustomNode:ie,customNodeProps:le,hideKey:se,showEditTools:ce=!0,showOnEdit:de,showOnView:ue}=X,pe=[...G,...k.filter((({showInTypesSelector:e=!1,name:n})=>e&&!!n)).map((({name:e})=>e))],ge=l((()=>{if("boolean"==typeof h)return h?[]:pe;if(Array.isArray(h))return h;const e=h(T);return"boolean"==typeof e?e?[]:pe:e}),[T,h]);if(!$("value",T,y,b))return null;const me=()=>{let e;switch(S(null),Z){case"object":e={[w("DEFAULT_NEW_KEY",T)]:N};break;case"array":e=null!=N?N:[];break;case"number":{const n=Number(N);e=isNaN(n)?0:n;break}default:e=N}c(e,P).then((n=>{n&&I({code:"UPDATE_ERROR",message:n},e)}))},he=()=>{S(null),x(r),Q(re(r,X))},{isEditing:ye,isEditingKey:be,canEditKey:fe}=K,ve=!ye&&_,je=ye&&ge.length>0,Ee="invalid"!==Z&&!_&&ce,De=f&&be,we=f&&!be&&!se,ke={value:N,parentData:o,setValue:te,isEditing:ye,setIsEditing:F?()=>S(A):()=>{},handleEdit:me,handleCancel:he,path:P,stringTruncate:v,showStringQuotes:E,nodeData:T,translate:w},Ce=ie&&(ye&&de||!ye&&ue)?n(ie,Object.assign({},t,{value:N,customNodeProps:le,setValue:te,handleEdit:me,handleCancel:he,handleKeyPress:e=>{"Enter"===e.key?me():"Escape"===e.key&&he()},isEditing:ye,setIsEditing:()=>S(A),getStyles:O})):oe(re(r),ke);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:D/2+"em",position:"relative"},draggable:z},B,Y("above"),{children:[H,n(J,{position:"above",nodeData:T}),e("div",{className:"jer-value-main-row",style:{flexWrap:V.length>10?"wrap":"nowrap"},children:[we&&e("span",{className:"jer-key-text",style:Object.assign(Object.assign({},O("property",T)),{minWidth:`${Math.min(String(V).length+1,5)}ch`,flexShrink:V.length>10?1:0}),onDoubleClick:()=>fe&&S(`key_${A}`),children:[""===V?n("span",{className:"jer-empty-string"}):V,":"]}),De&&n("input",{className:"jer-input-text jer-key-edit",type:"text",name:A,defaultValue:V,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?L(e.target.value):"Escape"===e.key&&he()},style:{width:String(V).length/1.5+.5+"em"}}),e("div",{className:"jer-value-and-buttons",children:[n("div",{className:"jer-input-component",children:Ce}),ye?n(W,{onOk:me,onCancel:he,nodeData:T}):Ee&&n(M,{startEdit:F?()=>S(A):void 0,handleDelete:R?()=>{d(N,P).then((e=>{e&&I({code:"DELETE_ERROR",message:e},N)}))}:void 0,enableClipboard:g,translate:w,nodeData:T}),je&&e("div",{className:"jer-select",children:[n("select",{name:`${V}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const n=k.find((n=>n.name===e));if(n)c(n.defaultValue,P),Q(e);else{const n=ae(N,e,w("DEFAULT_NEW_KEY",T),(null==X?void 0:X.CustomNode)?w("DEFAULT_STRING",T):void 0);te(n),c(n,P).then((e=>{e&&(I({code:"UPDATE_ERROR",message:e},n),S(null))}))}})(e.target.value),value:Z,children:ge.map((e=>n("option",{value:e,children:e},e)))}),n("span",{className:"focus"})]}),ve&&n("span",{className:"jer-error-slug",style:O("error",T),children:_})]})]}),n(J,{position:"below",nodeData:T})]}))},re=(e,n)=>(null==n?void 0:n.CustomNode)&&(null==n?void 0:n.name)&&n.showInTypesSelector?n.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",oe=(e,t)=>{const r=t.value;switch(e){case"string":return n(N,Object.assign({},t,{value:r}));case"number":return n(x,Object.assign({},t,{value:r}));case"boolean":return n(A,Object.assign({},t,{value:r}));case"null":return n(T,Object.assign({},t));default:return n(P,Object.assign({},t))}},ae=(e,n,t,r)=>{switch(n){case"string":return null!=r?r:String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;case"null":return null;case"object":return{[t]:e};case"array":return[e];default:return String(e)}},ie=r=>{const{getStyles:o}=j(),{collapseState:s,setCollapseState:d,doesPathMatch:g,currentlyEditingElement:m,setCurrentlyEditingElement:y,areChildrenBeingEdited:b}=q(),{data:f,nodeData:v,parentData:E,showCollectionCount:D,onEdit:w,onAdd:k,onDelete:C,canDragOnto:O,collapseFilter:S,collapseAnimationTime:N,onMove:x,enableClipboard:A,searchFilter:T,searchText:P,indent:V,keySort:F,showArrayIndices:R,defaultValue:z,translate:_,customNodeDefinitions:I,jsonParse:L,jsonStringify:B}=r,[G,H]=i(B(f)),J=S(v),[X,Z]=i(J),{pathString:Q,nodeData:re,path:oe,name:ae,size:le,canEdit:se,canDelete:ce,canAdd:de,canDrag:ue,error:pe,setError:ge,onError:me,handleEditKey:he,derivedValues:ye}=ee({props:r,collapsed:X}),{dragSourceProps:be,getDropTargetProps:fe,BottomDropTarget:ve,DropTargetPadding:je}=ne({canDrag:ue,canDragOnto:O,path:oe,nodeData:re,onMove:x,onError:me,translate:_}),Ee=c(!J),[De,we]=i(!1);a((()=>{H(B(f))}),[f]),a((()=>{const e=S(re)&&!ye.isEditing;Ee.current=!e,Z(e)}),[S]),a((()=>{null!==s&&g(oe)&&(Ee.current=!0,Z(s.collapsed))}),[s]);const ke=l((()=>e=>"function"!=typeof z?z:z(e)),[z]),{CustomNode:Ce,customNodeProps:Oe,CustomWrapper:Se,wrapperProps:Ne={},hideKey:xe,showEditTools:Ae=!0,showOnEdit:Te,showOnView:Pe,showCollectionWrapper:Ve=!0}=l((()=>U(I,re)),[]);if(!$("collection",re,T,P)&&re.level>0)return null;const Fe=Array.isArray(f)?"array":"object",Re="array"===Fe?{open:"[",close:"]"}:{open:"{",close:"}"},ze=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time"),_e=e=>{"Enter"===e.key&&(e.metaKey||e.shiftKey||e.ctrlKey)?Ie():"Escape"===e.key&&Ke()},Ie=()=>{try{const e=L(G);if(y(null),ge(null),JSON.stringify(e)===JSON.stringify(f))return;w(e,oe).then((n=>{n&&me({code:"UPDATE_ERROR",message:n},e)}))}catch(e){me({code:"INVALID_JSON",message:_("ERROR_INVALID_JSON",re)},G)}},Le=oe.length>0?()=>{C(f,oe).then((e=>{e&&me({code:"DELETE_ERROR",message:e},u(f,oe))}))}:void 0,Ke=()=>{y(null),ge(null),H(B(f))},{isEditing:Me,isEditingKey:We,isArray:Be,canEditKey:Ge}=ye,Ue="when-closed"===D?X:D,Ye=!Me&&Ae,$e=(R||!Be)&&!xe&&void 0!==ae,He=Ce&&(Me&&Te||!Me&&Pe),Je=F&&"object"===Fe,Xe=Object.entries(f).map((([e,n])=>["array"===Fe?Number(e):e,n]));Je&&Xe.sort("function"==typeof F?(e,n)=>F(e[0],n[0]):void 0);const Ze=JSON.stringify(f,null,2).replace(/\\n/g,"\n").split("\n").length,Qe=Ee.current?Me?n("div",{className:"jer-collection-text-edit",children:e("div",{children:[n(h,{className:"jer-collection-text-area",name:Q,value:G,setValue:H,isEditing:Me,handleKeyPress:_e,styles:o("input",re)}),n("div",{className:"jer-collection-input-button-row",children:n(W,{onOk:Ie,onCancel:Ke,nodeData:re})})]})}):Xe.map((([e,t],a)=>{const i={key:e,value:t,path:[...oe,e],level:oe.length+1,index:a,size:Y(t)?Object.keys(t).length:1,parentData:f,fullData:re.fullData};return n("div",{className:"jer-collection-element",style:o("collectionElement",i),children:Y(t)?n(ie,Object.assign({},r,{data:t,parentData:f,nodeData:i,showCollectionCount:D,canDragOnto:se}),e):n(te,Object.assign({},r,{data:t,parentData:f,nodeData:i,canDragOnto:se,showLabel:"object"===Fe||R}),e)},e)})):null,qe=!!Ve&&X;qe||(Ee.current=!0);const en=Object.assign(Object.assign({},r),{data:f,value:f,parentData:E,nodeData:re,setValue:e=>p(void 0,void 0,void 0,(function*(){return yield w(e,oe)})),handleEdit:Ie,handleCancel:Ke,handleKeyPress:_e,isEditing:Me,setIsEditing:()=>y(Q),getStyles:o,canDragOnto:se}),nn=He?n(Ce,Object.assign({customNodeProps:Oe},en,{children:Qe})):Qe,tn=We?n("input",{className:"jer-input-text jer-key-edit",type:"text",name:Q,defaultValue:ae,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?he(e.target.value):"Escape"===e.key&&Ke()},style:{width:String(ae).length/1.5+.5+"em"}}):$e&&n("span",{className:"jer-key-text",style:o("property",re),onDoubleClick:()=>Ge&&y(`key_${Q}`),children:""===ae?n("span",{className:oe.length>0?"jer-empty-string":void 0}):`${ae}:`}),rn=Ye&&n(M,{startEdit:se?()=>{Ee.current=!0,y(Q),Z(!1)}:void 0,handleAdd:de?e=>{Z(!1);const n=ke(re);"array"===Fe?k(n,[...oe,f.length]).then((e=>{e&&me({code:"ADD_ERROR",message:e},n)})):e in f?me({code:"KEY_EXISTS",message:_("ERROR_KEY_EXISTS",re)},e):k(n,[...oe,e]).then((e=>{e&&me({code:"ADD_ERROR",message:e},n)}))}:void 0,handleDelete:ce?Le:void 0,enableClipboard:A,type:Fe,nodeData:re,translate:_}),on=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===oe.length?0:V/2)+"em"},o("collection",re)),{position:"relative"}),draggable:ue},be,fe("above"),{children:[!Me&&ve,n(je,{position:"above",nodeData:re}),Ve?e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e("div",{className:"jer-collection-name",children:[n("div",{className:"jer-collapse-icon",onClick:e=>(e=>{if(e.getModifierState("Alt"))return Ee.current=!0,void d({collapsed:!X,path:oe});m&&m.includes(Q)||(we(!0),Ee.current=!0,Z(!X),d(null),setTimeout((()=>we(!1)),N))})(e),children:n(K,{name:"chevron",rotate:X,nodeData:re})}),tn,!Me&&n("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",re),children:Re.open})]}),!Me&&Ue&&n("div",{className:"jer-collection-item-count"+(Ue?" jer-visible":" jer-hidden"),style:o("itemCount",re),children:1===le?_("ITEM_SINGLE",Object.assign(Object.assign({},re),{size:1}),1):_("ITEMS_MULTIPLE",re,le)}),n("div",{className:"jer-brackets"+(qe?" jer-visible":" jer-hidden"),style:o("bracket",re),children:Re.close}),rn]}):xe?n(t,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[tn,rn]}),e("div",{className:"jer-collection-inner",style:Object.assign({maxHeight:qe?0:b(Q)?void 0:3*Ze+"em",overflowY:qe||De?"hidden":"visible",transition:`max-height ${ze}`},o("collectionInner",re)),children:[nn,n("div",{className:Me?"jer-collection-error-row":"jer-collection-error-row-edit",children:pe&&n("span",{className:"jer-error-slug",style:o("error",re),children:pe})}),!Me&&Ve&&n("div",{className:"jer-brackets jer-bracket-outside",style:o("bracket",re),children:Re.close})]}),n(je,{position:"below",nodeData:re})]}));return Se?n(Se,Object.assign({customNodeProps:Ne},en,{children:on})):on},le={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",DEFAULT_STRING:"New data!",DEFAULT_NEW_KEY:"key"},se=(e,n)=>(t,r,o)=>((e,n,t,r,o)=>{if(n[r]){const e=n[r](t);if(null!==e)return e}const a=r in e?e[r]:le[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,n,r,t,o),ce=({data:e,setData:t,rootName:r="root",onUpdate:o=(()=>{}),onEdit:c=o,onDelete:d=o,onAdd:u=o,onChange:g,onError:m,showErrorMessages:h=!0,enableClipboard:y=!0,indent:b=3,collapse:f=!1,collapseAnimationTime:v=500,showCollectionCount:E=!0,restrictEdit:D=!1,restrictDelete:w=!1,restrictAdd:k=!1,restrictTypeSelection:C=!1,restrictDrag:O=!0,searchFilter:S,searchText:N,searchDebounceTime:x=350,keySort:A=!1,showArrayIndices:T=!0,showStringQuotes:P=!0,defaultValue:V=null,minWidth:F=250,maxWidth:R="min(600px, 90vw)",rootFontSize:z,stringTruncate:_=250,translations:I={},className:L,id:K,customText:M={},customNodeDefinitions:W=[],jsonParse:B=JSON.parse,jsonStringify:G=(e=>JSON.stringify(e,null,2))})=>{const{getStyles:U}=j(),$=s(pe(f),[f]),H=s(se(I,M),[I,M]),[J,X]=i(N),[Z,Q]=(({setData:e,data:n})=>{const[t,r]=i(e?void 0:n),o=s((n=>{e?e(n):r(n)}),[e]);return a((()=>{e||r(n)}),[n]),[e?n:t,o]})({setData:t,data:e}),q=document.querySelector(":root"),ee=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(ee)!==v&&(null==q||q.style.setProperty("--jer-expand-transition-time",v/1e3+"s")),a((()=>{const e=setTimeout((()=>X(N)),x);return()=>clearTimeout(e)}),[N,x]);const ne={key:r,path:[],level:0,index:0,value:Z,size:"object"==typeof Z&&null!==Z?Object.keys(Z).length:1,parentData:null,fullData:Z},re=(e,n)=>p(void 0,void 0,void 0,(function*(){const t=yield e(n);if(void 0===t)return void Q(n.newData);const r=me(t)?t:["error",t],[o,a]=r;if("error"===o)return Q(n.currentData),!1===a?H("ERROR_UPDATE",ne):String(a);Q(a)})),oe=l((()=>pe(D)),[D]),ae=l((()=>pe(w)),[w]),le=l((()=>pe(k)),[k]),ce=l((()=>pe(O)),[O]),de=l((()=>ge(S)),[S]),he={name:r,nodeData:ne,onEdit:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=ue(Z,n,e,"update");if(o!==a)return yield re(c,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onDelete:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=ue(Z,n,e,"delete");return yield re(d,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onAdd:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=ue(Z,n,e,"add");return yield re(u,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onChange:g,onError:m,showErrorMessages:h,onMove:(e,n,t)=>p(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=ue(Z,e,"","delete"),i=e.slice(-1)[0],l=n.slice(0,-1),s=n.slice(-1)[0];let d="number"==typeof s?"above"===t?s:s+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===n.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===t?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=ue(o,[...l,d],a,"add",u);return yield re(c,{currentData:r,newData:p,currentValue:a,newValue:g,name:n.slice(-1)[0],path:n})})),showCollectionCount:E,collapseFilter:$,collapseAnimationTime:v,restrictEditFilter:oe,restrictDeleteFilter:ae,restrictAddFilter:le,restrictTypeSelection:C,restrictDragFilter:ce,canDragOnto:!1,searchFilter:de,searchText:J,enableClipboard:y,keySort:A,showArrayIndices:T,showStringQuotes:P,indent:b,defaultValue:V,stringTruncate:_,translate:H,customNodeDefinitions:W,parentData:null,jsonParse:B,jsonStringify:G},ye=Object.assign(Object.assign({},U("container",ne)),{minWidth:F,maxWidth:R});return ye.fontSize=null!=z?z:ye.fontSize,n("div",{id:K,className:"jer-editor-container "+L,style:ye,children:Y(Z)?n(ie,Object.assign({data:Z},he)):n(te,Object.assign({data:Z,showLabel:!0},he))})},de=e=>n(v,{theme:e.theme,icons:e.icons,children:n(Q,{children:n(ce,Object.assign({},e))})}),ue=(e,n,t,r,o={})=>{if(0===n.length)return{currentData:e,newData:t,currentValue:e,newValue:t};const a=Object.assign({remove:"delete"===r},o),i="add"!==r?u(e,n):void 0;return{currentData:e,newData:d(e,n,t,a),currentValue:i,newValue:"delete"!==r?t:void 0}},pe=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:n})=>n>=e:e,ge=e=>{if(void 0!==e)return"value"===e?J:"key"===e?X:"all"===e?(e,n)=>J(e,n)||X(e,n):e},me=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),he=({value:t,setIsEditing:r,getStyles:o,customNodeProps:a,nodeData:i})=>{var l,s;const c=null!==(l=null==a?void 0:a.stringTruncate)&&void 0!==l?l:100,d=o("string",i);return n("div",{onDoubleClick:()=>r(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&r(!0)},className:"jer-value-string jer-hyperlink",style:d,children:e("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:null!==(s=d.color)&&void 0!==s?s:void 0},children:['"',O(t,c),'"']})})},ye={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:he,showOnView:!0,showOnEdit:!1};export{V as IconAdd,I as IconCancel,L as IconChevron,z as IconCopy,R as IconDelete,F as IconEdit,_ as IconOk,de as JsonEditor,he as LinkCustomComponent,ye as LinkCustomNodeDefinition,Y as isCollection,J as matchNode,X as matchNodeKey,y as themes,O as truncate};
{
"name": "json-edit-react",
"version": "1.15.1",
"version": "1.15.2",
"description": "React component for editing or viewing JSON/object data",

@@ -5,0 +5,0 @@ "main": "build/index.cjs.js",

@@ -115,2 +115,3 @@ # json-edit-react

| `collapse` | `boolean\|number\|FilterFunction` | `false` | Defines which nodes of the JSON tree will be displayed "opened" in the UI on load. If `boolean`, it'll be either all or none. A `number` specifies a nesting depth after which nodes will be closed. For more fine control a function can be provided — see [Filter functions](#filter-functions). |
| `collapseAnimationTime` | `number` | `500` | Time (in milliseconds) for the transition animation when collapsing collection nodes. |
| `restrictEdit` | `boolean\|FilterFunction` | `false` | If `true`, no editing is permitted. A function can be provided for more specificity — see [Filter functions](#filter-functions) |

@@ -690,3 +691,3 @@ | `restrictDelete` | `boolean\|FilterFunction` | `false` | As with `restrictEdit` but for deletion |

- **1.15.1**:
- **1.15.2**:
- Collapse animation timing is configurable (#96)

@@ -693,0 +694,0 @@ - Bug fix for non-responsive keyboard submit for boolean values (#97)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc