json-edit-react
Advanced tools
Comparing version 1.21.1 to 1.21.2
@@ -1,1 +0,1 @@ | ||
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("object-property-assigner"),r=require("object-property-extractor");function o(e,t,n,r){return new(n||(n=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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const a=({className:t,name:n,value:r,setValue:o,handleKeyPress:a,styles:i,textAreaRef:s})=>{if("string"!=typeof r)return null;const l="\n"===r.slice(-1)?r+".":r;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${n}_textarea`,ref:s,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},i),rows:1,className:t,name:`${n}_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: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"},i),children:l})]})},i=e=>null!==e&&"object"==typeof e,s=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!l(r,t,n))return!1}if(!n&&r&&!l(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!c(t,r))return!1}return!0},l=(e="",t,n=c)=>{const r=t.value;return Object.entries(r).some((([o,a])=>{const s=[...t.path,o],c=Object.assign(Object.assign({},t),{key:o,path:s,level:t.level+1,value:a,size:s.length,parentData:r});return i(a)?l(e,c,n):n(c,e)}))},c=(e,t="")=>{const{value:n}=e;if(null===n&&"null".includes(t.toLowerCase()))return!0;switch(typeof n){case"string":return n.toLowerCase().includes(t.toLowerCase());case"number":return!!String(n).includes(t);case"boolean":return n?"true".includes(t.toLowerCase())||"1"===t:"false".includes(t.toLowerCase())||"0"===t;default:return!1}},d=({key:e,path:t},n="")=>!!c({value:e},n)||!!t.some((e=>c({value:e},n))),u=(e,t=200)=>"string"==typeof e?e.length<t?e:`${e.slice(0,t-2).trim()}...`:e,p=(e,t)=>(null!=t?t:"")+e.map((e=>""===e?String.fromCharCode(0):e)).join("."),m=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,g=(e,t,n)=>{const r=e.key,o=m(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:a,modifier:i}=t;return("stringLineBreak"!==n||"Enter"!==r||"Shift"!==o||"Enter"!==a||!(null==i?void 0:i.includes("Shift")))&&(r===a&&(i===o||Array.isArray(i)&&i.includes(o)))},h={key:"Enter"},y={confirm:h,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},h),{modifier:["Meta","Shift","Control"]}),objectLineBreak:h,stringConfirm:h,stringLineBreak:Object.assign(Object.assign({},h),{modifier:["Shift"]}),numberConfirm:h,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:h,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},f=(e,t,n="next",o)=>{const a=t.slice(0,t.length-1),s=t.slice(-1)[0];if(void 0===s)return null;const l=r(e,a),c=j(l);Array.isArray(l)||o(c,(({key:e,value:t})=>[e,t]));const d=c.findIndex((e=>e.key===s)),u=c["next"===n?d+1:d-1];return u?i(u.value)?b(e,[...a,u.key],n,o):[...a,u.key]:0===a.length?null:f(e,a,n,o)},b=(e,t,n="next",o)=>{const a=r(e,t);if(!i(a))return t;const s=Array.isArray(a)?a.map(((e,t)=>t)):Object.keys(a);o(s,(n=>[n,r(e,t)]));const l="next"===n?s[0]:s[s.length-1];return b(e,[...t,l],n,o)},j=e=>Array.isArray(e)?e.map(((e,t)=>({index:t,value:e,key:t}))):Object.entries(e).map((([e,t],n)=>({key:e,value:t,index:n}))),v=(e,t)=>{var n,r,o,a;const i=e.current,s=null!==(n=null==i?void 0:i.selectionStart)&&void 0!==n?n:1/0,l=null!==(r=null==i?void 0:i.selectionEnd)&&void 0!==r?r:1/0,c=(null===(o=null==i?void 0:i.textContent)||void 0===o?void 0:o.slice(0,s))+t+(null===(a=null==i?void 0:i.textContent)||void 0===a?void 0:a.slice(l));return i.value=c,null==i||i.setSelectionRange(s+1,s+1),c},x={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)"}},E=t.createContext({getStyles:()=>({}),icons:{}}),D=({theme:t=x,icons:n={},docRoot:r,children:o})=>{const a=C(t,r);return e.jsx(E.Provider,{value:{getStyles:(e,t)=>"function"==typeof a[e]?a[e](t):a[e],icons:n},children:o})},w=()=>t.useContext(E),C=(e,t)=>{var n,r,o,a;const i={},s=(Array.isArray(e)?e:[e]).map((e=>S(e)?k({fragments:{},styles:e},i):k(e,i))),l=k(x,{});Object.keys(l).forEach((e=>{const t=e;s.forEach((e=>{e[t]&&(l[t]=Object.assign(Object.assign({},l[t]),e[t]))}))}));const c=Object.assign({},l);return Object.entries(i).forEach((([e,t])=>{const n=e;c[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},l[n]),r)}})),"function"!=typeof(null==c?void 0:c.inputHighlight)&&(null===(n=null==c?void 0:c.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",null===(r=null==c?void 0:c.inputHighlight)||void 0===r?void 0:r.backgroundColor),"function"!=typeof(null==c?void 0:c.iconCopy)&&(null===(o=null==c?void 0:c.iconCopy)||void 0===o?void 0:o.color)&&t.style.setProperty("--jer-icon-copy-color",null===(a=null==c?void 0:c.iconCopy)||void 0===a?void 0:a.color),c},k=(e,t)=>{const{fragments:n,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a,i;if("function"==typeof o)return t[e]=o,Object.assign({},r);if("string"==typeof o){const t=null!==(a=null==n?void 0:n[o])&&void 0!==a?a:o;return"string"==typeof t?Object.assign(Object.assign({},r),{[null!==(i=O[e])&&void 0!==i?i:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},S=e=>!("styles"in e),O={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},N=t.createContext({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},previouslyEditedElement:null,setPreviouslyEditedElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{},tabDirection:"next",setTabDirection:()=>{}}),A=({children:n})=>{const[r,o]=t.useState(null),[a,i]=t.useState(null),[s,l]=t.useState({path:null,pathString:null}),c=t.useRef(null),d=t.useRef("next"),u=t.useRef(null);return e.jsx(N.Provider,{value:{collapseState:r,setCollapseState:e=>{o(e),null!==e&&setTimeout((()=>o(null)),2e3)},doesPathMatch:e=>{if(null===r)return!1;for(const[t,n]of r.path.entries())if(n!==e[t])return!1;return!0},currentlyEditingElement:a,setCurrentlyEditingElement:(e,t)=>{const n="string"==typeof e||null===e?e:p(e,"key"===t?"key_":void 0);null!==a&&null!==n&&null!==c.current&&c.current(),i(n),c.current="function"==typeof t?t:null},areChildrenBeingEdited:e=>null!==a&&a.includes(e),previouslyEditedElement:u.current,setPreviouslyEditedElement:e=>{u.current=e},tabDirection:d.current,setTabDirection:e=>{d.current=e},dragSource:s,setDragSource:l},children:n})},T=()=>t.useContext(N),R="**INVALID_FUNCTION**",M=({value:n,setValue:r,isEditing:o,path:i,setIsEditing:s,handleEdit:l,stringTruncate:c,showStringQuotes:d,nodeData:m,handleKeyboard:g,keyboardCommon:h})=>{const{getStyles:y}=w(),f=t.useRef(null),b=p(i),j=d?'"':"";return o?e.jsx(a,{className:"jer-input-text",textAreaRef:f,name:b,value:n,setValue:r,isEditing:o,handleKeyPress:e=>{g(e,Object.assign({stringConfirm:l,stringLineBreak:()=>{const e=v(f,"\n");r(e)}},h))},styles:y("input",m)}):e.jsxs("div",{id:`${b}_display`,onDoubleClick:()=>s(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&s(!0)},className:"jer-value-string",style:y("string",m),children:[j,u(n,c),j]})},P=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:d}=w();return r?e.jsx("input",{className:"jer-input-number",type:"text",name:p(o),value:t,onChange:e=>n(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>l(e,Object.assign({numberConfirm:i,numberUp:()=>n(Number(t)+1),numberDown:()=>n(Number(t)-1)},c)),style:Object.assign({width:String(t).length/1.5+2+"em"},d("input",s))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",s),children:t})},F=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:d}=w();return r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:p(o),checked:t,onChange:()=>n(!t),onKeyDown:e=>{" "===e.key&&e.preventDefault(),l(e,Object.assign({booleanConfirm:i,booleanToggle:()=>n(!t)},c))},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",s),children:String(t)})},V=({value:n,isEditing:r,setIsEditing:o,handleEdit:a,nodeData:i,handleKeyboard:s,keyboardCommon:l})=>{const{getStyles:c}=w(),d=t.useRef();t.useEffect((()=>{if(r)return d.current=window.setTimeout((()=>window.addEventListener("keydown",u)),100),()=>window.removeEventListener("keydown",u);window.clearTimeout(d.current)}),[r]);const u=e=>s(e,Object.assign({confirm:a},l));return e.jsx("div",{onDoubleClick:()=>o(!0),className:"jer-value-null",style:c("null",i),children:String(n)})},z=({value:t})=>{let n="Error!";switch(typeof t){case"string":t===R&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:n})},I=({size:t,style:n,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})]}),K=({size:t,style:n,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})]}),L=({size:t,style:n,className:r})=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})}),_=({size:t,style:n,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:r,style:n,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"})]}),B=({size:t,style:n,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:r,style:n,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"})]}),W=({size:t,style:n,className:r})=>e.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})}),G=({size:t,style:n,className:r})=>e.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:t,height:t,className:r,style:n,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"})}),U=({name:t,nodeData:n,rotate:r})=>{var o,a,i,s,l,c,d;const{getStyles:u,icons:p}=w(),m={size:"1.4em",className:"jer-icon"};switch(t){case"add":return null!==(o=null==p?void 0:p.add)&&void 0!==o?o:e.jsx(I,Object.assign({},m,{style:u("iconAdd",n)}));case"edit":return null!==(a=null==p?void 0:p.edit)&&void 0!==a?a:e.jsx(K,Object.assign({},m,{style:u("iconEdit",n)}));case"delete":return null!==(i=null==p?void 0:p.delete)&&void 0!==i?i:e.jsx(L,Object.assign({},m,{style:u("iconDelete",n),size:"1.45em"}));case"copy":return null!==(s=null==p?void 0:p.copy)&&void 0!==s?s:e.jsx(_,Object.assign({},m,{style:u("iconCopy",n),size:"1.2em"}));case"ok":return null!==(l=null==p?void 0:p.ok)&&void 0!==l?l:e.jsx(B,Object.assign({},m,{style:Object.assign({fontSize:"90%"},u("iconOk",n))}));case"cancel":return null!==(c=null==p?void 0:p.cancel)&&void 0!==c?c:e.jsx(W,Object.assign({},m,{style:Object.assign({fontSize:"130%"},u("iconCancel",n))}));case"chevron":return null!==(d=null==p?void 0:p.chevron)&&void 0!==d?d:e.jsx(G,{size:"1em",style:u("iconCollection",n)});default:return e.jsx(e.Fragment,{})}},H=({startEdit:n,handleDelete:r,handleAdd:o,enableClipboard:a,type:i,customButtons:s,nodeData:l,translate:c,keyboardControls:d,handleKeyboard:u})=>{const{getStyles:p}=w(),g=c("KEY_NEW",l),[h,y]=t.useState(!1),[f,b]=t.useState(g),{key:j,path:v,value:x}=l;return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:h?1:void 0},children:[a&&e.jsx("div",{onClick:e=>{e.stopPropagation();let t,n="value",r="";if(a){const o=m(e);o&&d.clipboardModifier.includes(o)?(t=$(v),r=t,n="path"):(t=x,r=i?JSON.stringify(x,null,2):String(t)),navigator.clipboard.writeText(r)}"function"==typeof a&&a({value:t,stringValue:r,path:v,key:j,type:n})},className:"jer-copy-pulse",children:e.jsx(U,{name:"copy",nodeData:l})}),n&&e.jsx("div",{onClick:e=>{e.stopPropagation(),n()},children:e.jsx(U,{name:"edit",nodeData:l})}),r&&e.jsx("div",{onClick:e=>{e.stopPropagation(),r()},children:e.jsx(U,{name:"delete",nodeData:l})}),o&&e.jsx("div",{onClick:e=>{e.stopPropagation(),"object"===i?y(!0):o("")},children:e.jsx(U,{name:"add",nodeData:l})}),null==s?void 0:s.map((({Element:t,onClick:n},r)=>e.jsx("div",{onClick:e=>n&&n(l,e),children:e.jsx(t,{nodeData:l})},r))),h&&o&&"object"===i&&e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:f,onChange:e=>b(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{u(e,{stringConfirm:()=>{o&&(y(!1),o(f),b(g))},cancel:()=>{y(!1),b(g)}})},style:p("input",l)}),e.jsx(Y,{onOk:e=>{f&&(e.stopPropagation(),y(!1),o(f))},onCancel:e=>{e.stopPropagation(),y(!1)},nodeData:l})]})]})},Y=({onOk:t,onCancel:n,nodeData:r})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[e.jsx("div",{onClick:t,children:e.jsx(U,{name:"ok",nodeData:r})}),e.jsx("div",{onClick:n,children:e.jsx(U,{name:"cancel",nodeData:r})})]}),$=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),J=["string","number","boolean","null","object","array"],X=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[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,m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(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},m)},Z=({props:e,collapsed:n})=>{const{data:r,nodeData:o,parentData:a,onEdit:i,onError:s,showErrorMessages:l,restrictEditFilter:c,restrictDeleteFilter:d,restrictAddFilter:u,restrictDragFilter:m,translate:g,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:f}=T(),[b,j]=t.useState(null),v=Object.assign(Object.assign({},o),{collapsed:n}),{path:x,key:E,size:D}=v,w=p(x),C=t.useMemo((()=>!c(v)),[v]),k=t.useMemo((()=>!d(v)),[v]),S=t.useMemo((()=>!u(v)),[v]),O=t.useMemo((()=>!m(v)&&k&&null===y),[v]),N=e=>{l&&(j(e),setTimeout((()=>j(null)),h)),console.warn("Error",e)},A=t.useMemo((()=>(e,t)=>{N(e.message),s&&s({currentData:v.fullData,errorValue:t,currentValue:r,name:E,path:x,error:e})}),[s,l]),R=y===w,M=y===`key_${w}`,P="number"==typeof x.slice(-1)[0];return{pathString:w,nodeData:v,path:x,name:E,size:D,canEdit:C,canDelete:k,canAdd:S,canDrag:O,error:b,showError:N,onError:A,setError:j,handleEditKey:e=>{if(f(null),E===e)return;if(!a)return;const t=x.slice(0,-1);if(Object.keys(a).includes(e))return void A({code:"KEY_EXISTS",message:g("ERROR_KEY_EXISTS",v)},e);const n=Object.fromEntries(Object.entries(a).map((([t,n])=>t===E?[e,n]:[t,n])));i(n,t).then((t=>{t&&A({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:{isEditing:R,isEditingKey:M,isArray:P,canEditKey:null!==a&&C&&S&&k&&!P}}},q=({canDrag:n,canDragOnto:r,path:o,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=w(),{dragSource:d,setDragSource:u}=T(),[m,g]=t.useState(!1),h=p(o),y=t.useMemo((()=>n?{onDragStart:e=>{e.stopPropagation(),u({path:o,pathString:h})},onDragEnd:e=>{e.stopPropagation(),u({path:null,pathString:null})}}:{}),[n]),f=t.useMemo((()=>e=>r?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:t=>{t.stopPropagation(),j(e),u({path:null,pathString:null}),g(!1)},onDragEnter:t=>{var n;t.stopPropagation(),h.startsWith(null!==(n=d.pathString)&&void 0!==n?n:"")||g(e)},onDragExit:e=>{e.stopPropagation(),g(!1)}}:{}),[d,r]),b=t.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}},f("below"))):null),[d,r]),j=e=>{var t,n;const r=null===(t=d.path)||void 0===t?void 0:t.slice(-1)[0],c=null===(n=d.path)||void 0===n?void 0:n.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:f,BottomDropTarget:b,DropTargetPadding:({position:t,nodeData:n})=>m===t?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",n)}):null,handleDrop:j}},Q=(e,t,n)=>{var r,o,a;const i=parseInt(null!==(r=getComputedStyle(n.current).getPropertyValue("line-height"))&&void 0!==r?r:"16px"),s=(null!==(a=null===(o=t.current)||void 0===o?void 0:o.offsetWidth)&&void 0!==a?a:0)/(.5*i),l=JSON.stringify(e,null,2).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/s))).reduce(((e,t)=>e+t),0)*i;return Math.min(l+30,window.innerHeight-50)},ee=n=>{const{data:r,parentData:o,onEdit:a,onDelete:i,onChange:l,onMove:c,enableClipboard:d,canDragOnto:u,restrictTypeSelection:p,searchFilter:m,searchText:g,showLabel:h,stringTruncate:y,showStringQuotes:b,indent:j,translate:v,customNodeDefinitions:x,handleKeyboard:E,keyboardControls:D,sort:C}=n,{getStyles:k}=w(),{setCurrentlyEditingElement:S,setCollapseState:O,previouslyEditedElement:N,setPreviouslyEditedElement:A,tabDirection:M,setTabDirection:P}=T(),[F,V]=t.useState("function"==typeof r?R:r),{pathString:z,nodeData:I,path:K,name:L,canEdit:_,canDelete:B,canDrag:W,error:G,onError:U,handleEditKey:$,derivedValues:Q}=Z({props:n}),{dragSourceProps:ee,getDropTargetProps:oe,BottomDropTarget:ae,DropTargetPadding:ie}=q({canDrag:W,canDragOnto:u,path:K,nodeData:I,onMove:c,onError:U,translate:v}),se=X(x,I),[le,ce]=t.useState(te(r,se)),de=t.useCallback((e=>{if(!l)return void V(e);const t=l({currentData:I.fullData,newValue:e,currentValue:F,name:L,path:K});V(t)}),[l]);t.useEffect((()=>{V("function"==typeof r?R:r),ce(te(r,se))}),[r,G]);const{CustomNode:ue,customNodeProps:pe,hideKey:me,showEditTools:ge=!0,showOnEdit:he,showOnView:ye}=se,fe=[...J,...x.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],be=t.useMemo((()=>{if("boolean"==typeof p)return p?[]:fe;if(Array.isArray(p))return p;const e=p(I);return"boolean"==typeof e?e?[]:fe:e}),[I,p]),{isEditing:je}=Q,ve=s("value",I,m,g);if(je&&(!ve||!_)){const e=f(I.fullData,K,M,C);S(e||N)}if(!ve)return null;const xe=()=>{let e;switch(S(null),le){case"object":e={[v("DEFAULT_NEW_KEY",I)]:F};break;case"array":e=null!=F?F:[];break;case"number":{const t=Number(F);e=isNaN(t)?0:t;break}default:e=F}a(e,K).then((t=>{t&&U({code:"UPDATE_ERROR",message:t},e)}))},Ee=()=>{S(null),V(r),ce(te(r,se))},{isEditingKey:De,canEditKey:we}=Q,Ce=!je&&G,ke=je&&be.length>0,Se="invalid"!==le&&!G&&ge,Oe=h&&De,Ne=h&&!De&&!me,Ae={value:F,parentData:o,setValue:de,isEditing:je,setIsEditing:_?()=>S(K):()=>{},handleEdit:xe,handleCancel:Ee,path:K,stringTruncate:y,showStringQuotes:b,nodeData:I,translate:v,handleKeyboard:E,keyboardCommon:{cancel:Ee,tabForward:()=>{P("next"),A(z);const e=f(I.fullData,K,"next",C);e&&(xe(),S(e))},tabBack:()=>{P("prev"),A(z);const e=f(I.fullData,K,"prev",C);e&&(xe(),S(e))}}},Te=ue&&(je&&he||!je&&ye)?e.jsx(ue,Object.assign({},n,{value:F,customNodeProps:pe,setValue:de,handleEdit:xe,handleCancel:Ee,handleKeyPress:e=>E(e,{stringConfirm:xe,cancel:Ee}),isEditing:je,setIsEditing:()=>S(K),getStyles:k})):ne(te(r),Ae);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:j/2+"em",position:"relative"},draggable:W},ee,oe("above"),{children:[ae,e.jsx(ie,{position:"above",nodeData:I}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:L.length>10?"wrap":"nowrap"},children:[Ne&&e.jsx("span",{className:"jer-key-text",style:Object.assign(Object.assign({},k("property",I)),{minWidth:`${Math.min(String(L).length+1,5)}ch`,flexShrink:L.length>10?1:0}),onDoubleClick:()=>we&&S(K,"key"),children:""===L?e.jsx("span",{className:K.length>0?"jer-empty-string":void 0}):`${L}:`}),Oe&&e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:z,defaultValue:L,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>E(e,{stringConfirm:()=>$(e.target.value),cancel:Ee,tabForward:()=>{$(e.target.value),S(K)},tabBack:()=>{$(e.target.value),S(f(I.fullData,K,"prev",C))}}),style:{width:String(L).length/1.5+.5+"em"}}),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:Te}),je?e.jsx(Y,{onOk:xe,onCancel:Ee,nodeData:I}):Se&&e.jsx(H,{startEdit:_?()=>S(K,Ee):void 0,handleDelete:B?()=>{i(F,K).then((e=>{e&&U({code:"DELETE_ERROR",message:e},F)}))}:void 0,enableClipboard:d,translate:v,customButtons:n.customButtons,nodeData:I,handleKeyboard:E,keyboardControls:D}),ke&&e.jsxs("div",{className:"jer-select",children:[e.jsx("select",{name:`${L}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const t=x.find((t=>t.name===e));if(t)a(t.defaultValue,K),ce(e),S(null),O({path:K,collapsed:!1});else{const t=re(F,e,v("DEFAULT_NEW_KEY",I),(null==se?void 0:se.CustomNode)?v("DEFAULT_STRING",I):void 0);de(t),a(t,K).then((e=>{e&&(U({code:"UPDATE_ERROR",message:e},t),S(null))}))}})(e.target.value),value:le,children:be.map((t=>e.jsx("option",{value:t,children:t},t)))}),e.jsx("span",{className:"focus"})]}),Ce&&e.jsx("span",{className:"jer-error-slug",style:k("error",I),children:G})]})]}),e.jsx(ie,{position:"below",nodeData:I})]}))},te=(e,t)=>(null==t?void 0:t.CustomNode)&&(null==t?void 0:t.name)&&t.showInTypesSelector?t.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",ne=(t,n)=>{const r=n.value;switch(t){case"string":return e.jsx(M,Object.assign({},n,{value:r}));case"number":return e.jsx(P,Object.assign({},n,{value:r}));case"boolean":return e.jsx(F,Object.assign({},n,{value:r}));case"null":return e.jsx(V,Object.assign({},n));default:return e.jsx(z,Object.assign({},n))}},re=(e,t,n,r)=>{switch(t){case"string":return null!=r?r:String(e);case"number":{const t=Number(e);return isNaN(t)?0:t}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},oe=n=>{const{getStyles:r}=w(),{collapseState:l,setCollapseState:c,doesPathMatch:d,currentlyEditingElement:u,setCurrentlyEditingElement:p,areChildrenBeingEdited:g}=T(),{mainContainerRef:h,data:y,nodeData:b,parentData:j,showCollectionCount:x,onEdit:E,onAdd:D,onDelete:C,canDragOnto:k,collapseFilter:S,collapseAnimationTime:O,onMove:N,enableClipboard:A,searchFilter:R,searchText:M,indent:P,sort:F,showArrayIndices:V,defaultValue:z,translate:I,customNodeDefinitions:K,jsonParse:L,jsonStringify:_,keyboardControls:B,handleKeyboard:W,insertAtTop:G}=n,[$,J]=t.useState(_(y)),te=S(b),{contentRef:ne,isAnimating:re,maxHeight:ae,collapsed:ie,animateCollapse:se}=((e,n,r,o)=>{const[a,i]=t.useState(r?0:void 0),[s,l]=t.useState(r),c=t.useRef(!1),d=t.useRef(null),u=t.useRef(0),p=t.useRef();return{contentRef:d,isAnimating:c.current,animateCollapse:t=>{var r,a;if(s!==t){switch(window.clearTimeout(p.current),c.current=!0,t){case!0:{const e=null!==(a=null===(r=d.current)||void 0===r?void 0:r.offsetHeight)&&void 0!==a?a:0;u.current=e,i(e),setTimeout((()=>{i(0)}),5);break}case!1:i(u.current||Q(e,d,o))}l(!s),p.current=window.setTimeout((()=>{c.current=!1,t||i(void 0)}),n)}},maxHeight:a,collapsed:s}})(y,O,te,h),{pathString:le,nodeData:ce,path:de,name:ue,size:pe,canEdit:me,canDelete:ge,canAdd:he,canDrag:ye,error:fe,setError:be,onError:je,handleEditKey:ve,derivedValues:xe}=Z({props:n,collapsed:ie}),{dragSourceProps:Ee,getDropTargetProps:De,BottomDropTarget:we,DropTargetPadding:Ce}=q({canDrag:ye,canDragOnto:k,path:de,nodeData:ce,onMove:N,onError:je,translate:I}),ke=t.useRef(!te);t.useEffect((()=>{J(_(y))}),[y]),t.useEffect((()=>{const e=S(ce)&&!xe.isEditing;ke.current=!e,se(e)}),[S]),t.useEffect((()=>{null!==l&&d(de)&&(ke.current=!0,se(l.collapsed))}),[l]);const Se=t.useRef(null),Oe=t.useMemo((()=>(e,t)=>"function"!=typeof z?z:z(e,t)),[z]),{CustomNode:Ne,customNodeProps:Ae,CustomWrapper:Te,wrapperProps:Re={},hideKey:Me,showEditTools:Pe=!0,showOnEdit:Fe,showOnView:Ve,showCollectionWrapper:ze=!0}=t.useMemo((()=>X(K,ce)),[]),Ie=g(le);Ie&&ie&&se(!1);if(!(s("collection",ce,R,M)||0===ce.level)&&!Ie)return null;const Ke=Array.isArray(y)?"array":"object",Le="array"===Ke?{open:"[",close:"]"}:{open:"{",close:"}"},_e=e=>{if("Tab"!==e.key||e.getModifierState("Shift"))W(e,{objectConfirm:We,cancel:Ue});else{e.preventDefault();const t=v(Se,"\t");J(t)}},Be=e=>{const t=m(e);if(t&&B.collapseModifier.includes(t))return ke.current=!0,void c({collapsed:!ie,path:de});u&&u.includes(le)||(ke.current=!0,c(null),se(!ie))},We=()=>{try{const e=L($);if(p(null),be(null),JSON.stringify(e)===JSON.stringify(y))return;E(e,de).then((t=>{t&&je({code:"UPDATE_ERROR",message:t},e)}))}catch(e){je({code:"INVALID_JSON",message:I("ERROR_INVALID_JSON",ce)},$)}},Ge=de.length>0?()=>{C(y,de).then((e=>{e&&je({code:"DELETE_ERROR",message:e},y)}))}:void 0,Ue=()=>{p(null),be(null),J(_(y))},{isEditing:He,isEditingKey:Ye,isArray:$e,canEditKey:Je}=xe,Xe="when-closed"===x?ie:x,Ze=!He&&Pe,qe=(V||!$e)&&!Me&&void 0!==ue,Qe=Ne&&(He&&Fe||!He&&Ve),et=Object.entries(y).map((([e,t])=>["array"===Ke?Number(e):e,t]));"object"===Ke&&F(et,(e=>e));const tt=ke.current?He?e.jsx("div",{className:"jer-collection-text-edit",children:e.jsxs("div",{children:[e.jsx(a,{textAreaRef:Se,className:"jer-collection-text-area",name:le,value:$,setValue:J,isEditing:He,handleKeyPress:_e,styles:r("input",ce)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(Y,{onOk:We,onCancel:Ue,nodeData:ce})})]})}):et.map((([t,o],a)=>{const s={key:t,value:o,path:[...de,t],level:de.length+1,index:a,size:i(o)?Object.keys(o).length:1,parentData:y,fullData:ce.fullData};return e.jsx("div",{className:"jer-collection-element",style:r("collectionElement",s),children:i(o)?e.jsx(oe,Object.assign({},n,{data:o,parentData:y,nodeData:s,showCollectionCount:x,canDragOnto:me}),t):e.jsx(ee,Object.assign({},n,{data:o,parentData:y,nodeData:s,canDragOnto:me,showLabel:"object"===Ke||V}),t)},t)})):null,nt=!!ze&&(ie&&!Ie);nt||(ke.current=!0);const rt=Object.assign(Object.assign({},n),{data:y,value:y,parentData:j,nodeData:ce,setValue:e=>o(void 0,void 0,void 0,(function*(){return yield E(e,de)})),handleEdit:We,handleCancel:Ue,handleKeyPress:_e,isEditing:He,setIsEditing:()=>p(de),getStyles:r,canDragOnto:me}),ot=Qe?e.jsx(Ne,Object.assign({customNodeProps:Ae},rt,{children:tt})):tt,at=Ye?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:le,defaultValue:ue,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>W(e,{stringConfirm:()=>ve(e.target.value),cancel:Ue,tabForward:()=>{ve(e.target.value);const t=null==et?void 0:et[0][0];p(t?[...de,t]:f(ce.fullData,de,"next",F))},tabBack:()=>{ve(e.target.value),p(f(ce.fullData,de,"prev",F))}}),style:{width:String(ue).length/1.5+.5+"em"}}):qe&&e.jsx("span",{className:"jer-key-text",style:r("property",ce),onClick:e=>e.stopPropagation(),onDoubleClick:()=>Je&&p(de,"key"),children:""===ue?e.jsx("span",{className:de.length>0?"jer-empty-string":void 0}):`${ue}:`}),it=Ze&&e.jsx(H,{startEdit:me?()=>{ke.current=!0,p(de)}:void 0,handleAdd:he?e=>{se(!1);const t=Oe(ce,e);if("array"===Ke){const e=G.array?0:y.length,n=G.array?{insert:!0}:{};D(t,[...de,e],n).then((e=>{e&&je({code:"ADD_ERROR",message:e},t)}))}else if(e in y)je({code:"KEY_EXISTS",message:I("ERROR_KEY_EXISTS",ce)},e);else{const n=G.object?{insertBefore:0}:{};D(t,[...de,e],n).then((e=>{e&&je({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:ge?Ge:void 0,enableClipboard:A,type:Ke,nodeData:ce,translate:I,customButtons:n.customButtons,keyboardControls:B,handleKeyboard:W}),st=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===de.length?0:P/2)+"em"},r("collection",ce)),{position:"relative"}),draggable:ye},Ee,De("above"),{children:[e.jsx("div",{className:"jer-clickzone",style:{width:P/2+1+"em",zIndex:10+2*ce.level},onClick:e=>Be(e)}),!He&&we,e.jsx(Ce,{position:"above",nodeData:ce}),ze?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:e=>Be(e),children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon jer-accordion-icon"+(ie?" jer-rotate-90":""),style:{zIndex:11+2*ce.level},onClick:e=>Be(e),children:e.jsx(U,{name:"chevron",rotate:ie,nodeData:ce})}),at,!He&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:r("bracket",ce),children:Le.open})]}),!He&&Xe&&e.jsx("div",{className:"jer-collection-item-count"+(Xe?" jer-visible":" jer-hidden"),style:r("itemCount",ce),children:1===pe?I("ITEM_SINGLE",Object.assign(Object.assign({},ce),{size:1}),1):I("ITEMS_MULTIPLE",ce,pe)}),e.jsx("div",{className:"jer-brackets"+(nt?" jer-visible":" jer-hidden"),style:r("bracket",ce),children:Le.close}),it]}):Me?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[at,it]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign({overflowY:nt||re?"clip":"visible",maxHeight:Ie?void 0:ae},r("collectionInner",ce)),ref:ne,children:[ot,e.jsx("div",{className:He?"jer-collection-error-row":"jer-collection-error-row-edit",children:fe&&e.jsx("span",{className:"jer-error-slug",style:r("error",ce),children:fe})}),!He&&ze&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},r("bracket",ce)),{marginLeft:(P<3?-1:P<6?-.5:0)+"em"}),children:Le.close})]}),e.jsx(Ce,{position:"below",nodeData:ce})]}));return Te?e.jsx(Te,Object.assign({customNodeProps:Re},rt,{children:st})):st},ae={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"},ie=(e,t)=>(n,r,o)=>((e,t,n,r,o)=>{if(t[r]){const e=t[r](n);if(null!==e)return e}const a=r in e?e[r]:ae[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,t,r,n,o);var se=[],le=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,a="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var i=se.indexOf(a);-1===i&&(i=se.push(a)-1,le[i]={}),n=le[i]&&le[i][r]?le[i][r]:le[i][r]=s()}else n=s();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-expand-transition-time:0.3s;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden,.jer-visible{transition:var(--jer-expand-transition-time)}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative;transition:var(--jer-expand-transition-time)}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:transform var(--jer-expand-transition-time)}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-accordion-icon,.jer-rotate-90{transition:transform var(--jer-expand-transition-time)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string:after{content:"<empty string>:";font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}',{});const ce=({data:n,setData:r,rootName:a="root",onUpdate:s=(()=>{}),onEdit:l=s,onDelete:c=s,onAdd:d=s,onChange:u,onError:p,showErrorMessages:m=!0,enableClipboard:h=!0,indent:f=2,collapse:b=!1,collapseAnimationTime:j=300,showCollectionCount:v=!0,restrictEdit:x=!1,restrictDelete:E=!1,restrictAdd:D=!1,restrictTypeSelection:C=!1,restrictDrag:k=!0,searchFilter:S,searchText:O,searchDebounceTime:N=350,keySort:A=!1,showArrayIndices:R=!0,showStringQuotes:M=!0,defaultValue:P=null,minWidth:F=250,maxWidth:V="min(600px, 90vw)",rootFontSize:z,stringTruncate:I=250,translations:K={},className:L,id:_,customText:B={},customNodeDefinitions:W=[],customButtons:G=[],jsonParse:U=JSON.parse,jsonStringify:H=(e=>JSON.stringify(e,null,2)),errorMessageTimeout:Y=2500,keyboardControls:$={},insertAtTop:J=!1})=>{const{getStyles:X}=w(),{setCurrentlyEditingElement:Z}=T(),q=t.useCallback(ue(b),[b]),Q=t.useCallback(ie(K,B),[K,B]),[te,ne]=t.useState(O),[re,ae]=(({setData:e,data:n})=>{const[r,o]=t.useState(e?void 0:n),a=t.useCallback((t=>{e?e(t):o(t)}),[e]);return t.useEffect((()=>{e||o(n)}),[n]),[e?n:r,a]})({setData:r,data:n}),se=t.useRef(null);t.useEffect((()=>{Z(null);const e=setTimeout((()=>ne(O)),N);return()=>clearTimeout(e)}),[O,N]);const le={key:a,path:[],level:0,index:0,value:re,size:"object"==typeof re&&null!==re?Object.keys(re).length:1,parentData:null,fullData:re},ce=(e,t)=>o(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void ae(t.newData);const r=me(n)?n:["error",n],[o,a]=r;if("error"===o)return ae(t.currentData),!1===a?Q("ERROR_UPDATE",le):String(a);ae(a)})),ge=t.useMemo((()=>ue(x)),[x]),he=t.useMemo((()=>ue(E)),[E]),ye=t.useMemo((()=>ue(D)),[D]),fe=t.useMemo((()=>ue(k)),[k]),be=t.useMemo((()=>pe(S)),[S]),je=t.useMemo((()=>(e=>{const t=Object.assign({},y);for(const n of Object.keys(y)){const r=n;if(e[r]){const o=e[r],a=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(o)?o:[o]:"string"==typeof o?{key:o}:o;t[r]=a,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})($)),[$]),ve=t.useCallback(((e,t)=>((e,t,n)=>{const r=Object.entries(t);for(const[t,o]of r)if(g(n,e[t],t)){n.preventDefault(),o();break}})(je,t,e)),[$]),xe=t.useCallback(((e,t)=>{!1!==A&&("function"!=typeof A?e.sort(((e,n)=>{const r=t(e)[0],o=t(n)[0];return r<o?-1:r>o?1:0})):e.sort(((e,n)=>A(t(e),t(n)))))}),[A]),Ee={mainContainerRef:se,name:a,nodeData:le,onEdit:(e,t)=>o(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=de(re,t,e,"update");if(o!==a)return yield ce(l,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>o(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=de(re,t,e,"delete");return yield ce(c,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:a,newValue:i}=de(re,t,e,"add",n);return yield ce(d,{currentData:r,newData:o,currentValue:a,newValue:i,name:t.slice(-1)[0],path:t})})),onChange:u,onError:p,showErrorMessages:m,onMove:(e,t,n)=>o(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=de(re,e,"","delete"),i=e.slice(-1)[0],s=t.slice(0,-1),c=t.slice(-1)[0];let d="number"==typeof c?"above"===n?c:c+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===n?{insertBefore:c}:{insertAfter:c},{newData:p,newValue:m}=de(o,[...s,d],a,"add",u);return yield ce(l,{currentData:r,newData:p,currentValue:a,newValue:m,name:t.slice(-1)[0],path:t})})),showCollectionCount:v,collapseFilter:q,collapseAnimationTime:j,restrictEditFilter:ge,restrictDeleteFilter:he,restrictAddFilter:ye,restrictTypeSelection:C,restrictDragFilter:fe,canDragOnto:!1,searchFilter:be,searchText:te,enableClipboard:h,keySort:A,sort:xe,showArrayIndices:R,showStringQuotes:M,indent:f,defaultValue:P,stringTruncate:I,translate:Q,customNodeDefinitions:W,customButtons:G,parentData:null,jsonParse:U,jsonStringify:H,errorMessageTimeout:Y,handleKeyboard:ve,keyboardControls:je,insertAtTop:{object:!0===J||"object"===J,array:!0===J||"array"===J}},De=Object.assign(Object.assign({},X("container",le)),{minWidth:F,maxWidth:V});return De.fontSize=null!=z?z:De.fontSize,e.jsx("div",{id:_,ref:se,className:`jer-editor-container ${null!=L?L:""}`,style:De,children:i(re)?e.jsx(oe,Object.assign({data:re},Ee)):e.jsx(ee,Object.assign({data:re,showLabel:!0},Ee))})},de=(e,t,o,a,i={})=>{if(0===t.length)return{currentData:e,newData:o,currentValue:e,newValue:o};const s=Object.assign({remove:"delete"===a},i),l="add"!==a?r(e,t):void 0;return{currentData:e,newData:n(e,t,o,s),currentValue:l,newValue:"delete"!==a?o:void 0}},ue=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,pe=e=>{if(void 0!==e)return"value"===e?c:"key"===e?d:"all"===e?(e,t)=>c(e,t)||d(e,t):e},me=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),ge=({value:t,setIsEditing:n,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:()=>n(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&n(!0)},className:"jer-value-string jer-hyperlink",style:c,children:e.jsxs("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:null!==(s=c.color)&&void 0!==s?s:void 0},children:['"',u(t,l),'"']})})},he={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:ge,showOnView:!0,showOnEdit:!1};exports.assign=n,exports.extract=r,exports.IconAdd=I,exports.IconCancel=W,exports.IconChevron=G,exports.IconCopy=_,exports.IconDelete=L,exports.IconEdit=K,exports.IconOk=B,exports.JsonEditor=n=>{var r;const[o,a]=t.useState();t.useEffect((()=>{const e=document.documentElement;a(e)}),[]);const{collapseAnimationTime:i=300}=n;if(!o)return null;const s=getComputedStyle(o).getPropertyValue("--jer-expand-transition-time");return 1e3*parseFloat(s)!==i&&o.style.setProperty("--jer-expand-transition-time",i/1e3+"s"),e.jsx(D,{theme:null!==(r=n.theme)&&void 0!==r?r:x,icons:n.icons,docRoot:o,children:e.jsx(A,{children:e.jsx(ce,Object.assign({},n))})})},exports.LinkCustomComponent=ge,exports.LinkCustomNodeDefinition=he,exports.candyWrapperTheme={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"}},exports.defaultTheme=x,exports.githubDarkTheme={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)"}},exports.githubLightTheme={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"}},exports.isCollection=i,exports.matchNode=c,exports.matchNodeKey=d,exports.monoDarkTheme={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"}},exports.monoLightTheme={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"}},exports.psychedelicTheme={displayName:"Psychedelic",fragments:{pale:{color:"#A8DADC"},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"}},exports.truncate=u; | ||
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("object-property-assigner"),r=require("object-property-extractor");function o(e,t,n,r){return new(n||(n=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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const a=({className:t,name:n,value:r,setValue:o,handleKeyPress:a,styles:i,textAreaRef:s})=>{if("string"!=typeof r)return null;const l="\n"===r.slice(-1)?r+".":r;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${n}_textarea`,ref:s,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},i),rows:1,className:t,name:`${n}_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: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"},i),children:l})]})},i=e=>null!==e&&"object"==typeof e,s=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!l(r,t,n))return!1}if(!n&&r&&!l(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!c(t,r))return!1}return!0},l=(e="",t,n=c)=>{const r=t.value;return Object.entries(r).some((([o,a])=>{const s=[...t.path,o],c=Object.assign(Object.assign({},t),{key:o,path:s,level:t.level+1,value:a,size:s.length,parentData:r});return i(a)?l(e,c,n):n(c,e)}))},c=(e,t="")=>{const{value:n}=e;if(null===n&&"null".includes(t.toLowerCase()))return!0;switch(typeof n){case"string":return n.toLowerCase().includes(t.toLowerCase());case"number":return!!String(n).includes(t);case"boolean":return n?"true".includes(t.toLowerCase())||"1"===t:"false".includes(t.toLowerCase())||"0"===t;default:return!1}},d=({key:e,path:t},n="")=>!!c({value:e},n)||!!t.some((e=>c({value:e},n))),u=(e,t=200)=>"string"==typeof e?e.length<t?e:`${e.slice(0,t-2).trim()}...`:e,p=(e,t)=>(null!=t?t:"")+e.map((e=>""===e?String.fromCharCode(0):e)).join("."),m=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,g=(e,t,n)=>{const r=e.key,o=m(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:a,modifier:i}=t;return("stringLineBreak"!==n||"Enter"!==r||"Shift"!==o||"Enter"!==a||!(null==i?void 0:i.includes("Shift")))&&(r===a&&(i===o||Array.isArray(i)&&i.includes(o)))},h={key:"Enter"},y={confirm:h,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},h),{modifier:["Meta","Shift","Control"]}),objectLineBreak:h,stringConfirm:h,stringLineBreak:Object.assign(Object.assign({},h),{modifier:["Shift"]}),numberConfirm:h,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:h,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},f=(e,t,n="next",o)=>{const a=t.slice(0,t.length-1),s=t.slice(-1)[0];if(void 0===s)return null;const l=r(e,a),c=j(l);Array.isArray(l)||o(c,(({key:e,value:t})=>[e,t]));const d=c.findIndex((e=>e.key===s)),u=c[d+("next"===n?1:-1)];return u?i(u.value)?0===Object.keys(u.value).length?f(e,[...a,u.key],n,o):b(e,[...a,u.key],n,o):[...a,u.key]:0===a.length?null:f(e,a,n,o)},b=(e,t,n="next",o)=>{const a=r(e,t);if(!i(a))return t;const s=Array.isArray(a)?a.map(((e,t)=>t)):Object.keys(a);o(s,(e=>[e,a]));const l="next"===n?s[0]:s[s.length-1];return b(e,[...t,l],n,o)},j=e=>Array.isArray(e)?e.map(((e,t)=>({index:t,value:e,key:t}))):Object.entries(e).map((([e,t],n)=>({key:e,value:t,index:n}))),v=(e,t)=>{var n,r,o,a;const i=e.current,s=null!==(n=null==i?void 0:i.selectionStart)&&void 0!==n?n:1/0,l=null!==(r=null==i?void 0:i.selectionEnd)&&void 0!==r?r:1/0,c=(null===(o=null==i?void 0:i.textContent)||void 0===o?void 0:o.slice(0,s))+t+(null===(a=null==i?void 0:i.textContent)||void 0===a?void 0:a.slice(l));return i.value=c,null==i||i.setSelectionRange(s+1,s+1),c},x={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)"}},E=t.createContext({getStyles:()=>({}),icons:{}}),D=({theme:t=x,icons:n={},docRoot:r,children:o})=>{const a=C(t,r);return e.jsx(E.Provider,{value:{getStyles:(e,t)=>"function"==typeof a[e]?a[e](t):a[e],icons:n},children:o})},w=()=>t.useContext(E),C=(e,t)=>{var n,r,o,a;const i={},s=(Array.isArray(e)?e:[e]).map((e=>S(e)?k({fragments:{},styles:e},i):k(e,i))),l=k(x,{});Object.keys(l).forEach((e=>{const t=e;s.forEach((e=>{e[t]&&(l[t]=Object.assign(Object.assign({},l[t]),e[t]))}))}));const c=Object.assign({},l);return Object.entries(i).forEach((([e,t])=>{const n=e;c[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},l[n]),r)}})),"function"!=typeof(null==c?void 0:c.inputHighlight)&&(null===(n=null==c?void 0:c.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",null===(r=null==c?void 0:c.inputHighlight)||void 0===r?void 0:r.backgroundColor),"function"!=typeof(null==c?void 0:c.iconCopy)&&(null===(o=null==c?void 0:c.iconCopy)||void 0===o?void 0:o.color)&&t.style.setProperty("--jer-icon-copy-color",null===(a=null==c?void 0:c.iconCopy)||void 0===a?void 0:a.color),c},k=(e,t)=>{const{fragments:n,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a,i;if("function"==typeof o)return t[e]=o,Object.assign({},r);if("string"==typeof o){const t=null!==(a=null==n?void 0:n[o])&&void 0!==a?a:o;return"string"==typeof t?Object.assign(Object.assign({},r),{[null!==(i=O[e])&&void 0!==i?i:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},S=e=>!("styles"in e),O={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},N=t.createContext({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},previouslyEditedElement:null,setPreviouslyEditedElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{},tabDirection:"next",setTabDirection:()=>{}}),A=({children:n})=>{const[r,o]=t.useState(null),[a,i]=t.useState(null),[s,l]=t.useState({path:null,pathString:null}),c=t.useRef(null),d=t.useRef("next"),u=t.useRef(null);return e.jsx(N.Provider,{value:{collapseState:r,setCollapseState:e=>{o(e),null!==e&&setTimeout((()=>o(null)),2e3)},doesPathMatch:e=>{if(null===r)return!1;for(const[t,n]of r.path.entries())if(n!==e[t])return!1;return!0},currentlyEditingElement:a,setCurrentlyEditingElement:(e,t)=>{const n="string"==typeof e||null===e?e:p(e,"key"===t?"key_":void 0);null!==a&&null!==n&&null!==c.current&&c.current(),i(n),c.current="function"==typeof t?t:null},areChildrenBeingEdited:e=>null!==a&&a.includes(e),previouslyEditedElement:u.current,setPreviouslyEditedElement:e=>{u.current=e},tabDirection:d.current,setTabDirection:e=>{d.current=e},dragSource:s,setDragSource:l},children:n})},T=()=>t.useContext(N),R="**INVALID_FUNCTION**",M=({value:n,setValue:r,isEditing:o,path:i,setIsEditing:s,handleEdit:l,stringTruncate:c,showStringQuotes:d,nodeData:m,handleKeyboard:g,keyboardCommon:h})=>{const{getStyles:y}=w(),f=t.useRef(null),b=p(i),j=d?'"':"";return o?e.jsx(a,{className:"jer-input-text",textAreaRef:f,name:b,value:n,setValue:r,isEditing:o,handleKeyPress:e=>{g(e,Object.assign({stringConfirm:l,stringLineBreak:()=>{const e=v(f,"\n");r(e)}},h))},styles:y("input",m)}):e.jsxs("div",{id:`${b}_display`,onDoubleClick:()=>s(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&s(!0)},className:"jer-value-string",style:y("string",m),children:[j,u(n,c),j]})},P=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:d}=w();return r?e.jsx("input",{className:"jer-input-number",type:"text",name:p(o),value:t,onChange:e=>n(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>l(e,Object.assign({numberConfirm:i,numberUp:()=>n(Number(t)+1),numberDown:()=>n(Number(t)-1)},c)),style:Object.assign({width:String(t).length/1.5+2+"em"},d("input",s))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",s),children:t})},F=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:d}=w();return r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:p(o),checked:t,onChange:()=>n(!t),onKeyDown:e=>{" "===e.key&&e.preventDefault(),l(e,Object.assign({booleanConfirm:i,booleanToggle:()=>n(!t)},c))},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",s),children:String(t)})},V=({value:n,isEditing:r,setIsEditing:o,handleEdit:a,nodeData:i,handleKeyboard:s,keyboardCommon:l})=>{const{getStyles:c}=w(),d=t.useRef();t.useEffect((()=>{if(r)return d.current=window.setTimeout((()=>window.addEventListener("keydown",u)),100),()=>window.removeEventListener("keydown",u);window.clearTimeout(d.current)}),[r]);const u=e=>s(e,Object.assign({confirm:a},l));return e.jsx("div",{onDoubleClick:()=>o(!0),className:"jer-value-null",style:c("null",i),children:String(n)})},z=({value:t})=>{let n="Error!";switch(typeof t){case"string":t===R&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:n})},I=({size:t,style:n,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})]}),K=({size:t,style:n,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})]}),L=({size:t,style:n,className:r})=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})}),_=({size:t,style:n,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:r,style:n,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"})]}),B=({size:t,style:n,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:r,style:n,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"})]}),W=({size:t,style:n,className:r})=>e.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})}),G=({size:t,style:n,className:r})=>e.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:t,height:t,className:r,style:n,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"})}),U=({name:t,nodeData:n,rotate:r})=>{var o,a,i,s,l,c,d;const{getStyles:u,icons:p}=w(),m={size:"1.4em",className:"jer-icon"};switch(t){case"add":return null!==(o=null==p?void 0:p.add)&&void 0!==o?o:e.jsx(I,Object.assign({},m,{style:u("iconAdd",n)}));case"edit":return null!==(a=null==p?void 0:p.edit)&&void 0!==a?a:e.jsx(K,Object.assign({},m,{style:u("iconEdit",n)}));case"delete":return null!==(i=null==p?void 0:p.delete)&&void 0!==i?i:e.jsx(L,Object.assign({},m,{style:u("iconDelete",n),size:"1.45em"}));case"copy":return null!==(s=null==p?void 0:p.copy)&&void 0!==s?s:e.jsx(_,Object.assign({},m,{style:u("iconCopy",n),size:"1.2em"}));case"ok":return null!==(l=null==p?void 0:p.ok)&&void 0!==l?l:e.jsx(B,Object.assign({},m,{style:Object.assign({fontSize:"90%"},u("iconOk",n))}));case"cancel":return null!==(c=null==p?void 0:p.cancel)&&void 0!==c?c:e.jsx(W,Object.assign({},m,{style:Object.assign({fontSize:"130%"},u("iconCancel",n))}));case"chevron":return null!==(d=null==p?void 0:p.chevron)&&void 0!==d?d:e.jsx(G,{size:"1em",style:u("iconCollection",n)});default:return e.jsx(e.Fragment,{})}},H=({startEdit:n,handleDelete:r,handleAdd:o,enableClipboard:a,type:i,customButtons:s,nodeData:l,translate:c,keyboardControls:d,handleKeyboard:u})=>{const{getStyles:p}=w(),g=c("KEY_NEW",l),[h,y]=t.useState(!1),[f,b]=t.useState(g),{key:j,path:v,value:x}=l;return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:h?1:void 0},children:[a&&e.jsx("div",{onClick:e=>{e.stopPropagation();let t,n="value",r="";if(a){const o=m(e);o&&d.clipboardModifier.includes(o)?(t=$(v),r=t,n="path"):(t=x,r=i?JSON.stringify(x,null,2):String(t)),navigator.clipboard.writeText(r)}"function"==typeof a&&a({value:t,stringValue:r,path:v,key:j,type:n})},className:"jer-copy-pulse",children:e.jsx(U,{name:"copy",nodeData:l})}),n&&e.jsx("div",{onClick:e=>{e.stopPropagation(),n()},children:e.jsx(U,{name:"edit",nodeData:l})}),r&&e.jsx("div",{onClick:e=>{e.stopPropagation(),r()},children:e.jsx(U,{name:"delete",nodeData:l})}),o&&e.jsx("div",{onClick:e=>{e.stopPropagation(),"object"===i?y(!0):o("")},children:e.jsx(U,{name:"add",nodeData:l})}),null==s?void 0:s.map((({Element:t,onClick:n},r)=>e.jsx("div",{onClick:e=>n&&n(l,e),children:e.jsx(t,{nodeData:l})},r))),h&&o&&"object"===i&&e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:f,onChange:e=>b(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{u(e,{stringConfirm:()=>{o&&(y(!1),o(f),b(g))},cancel:()=>{y(!1),b(g)}})},style:p("input",l)}),e.jsx(Y,{onOk:e=>{f&&(e.stopPropagation(),y(!1),o(f))},onCancel:e=>{e.stopPropagation(),y(!1)},nodeData:l})]})]})},Y=({onOk:t,onCancel:n,nodeData:r})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[e.jsx("div",{onClick:t,children:e.jsx(U,{name:"ok",nodeData:r})}),e.jsx("div",{onClick:n,children:e.jsx(U,{name:"cancel",nodeData:r})})]}),$=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),J=["string","number","boolean","null","object","array"],X=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[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,m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(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},m)},Z=({props:e,collapsed:n})=>{const{data:r,nodeData:o,parentData:a,onEdit:i,onError:s,showErrorMessages:l,restrictEditFilter:c,restrictDeleteFilter:d,restrictAddFilter:u,restrictDragFilter:m,translate:g,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:f}=T(),[b,j]=t.useState(null),v=Object.assign(Object.assign({},o),{collapsed:n}),{path:x,key:E,size:D}=v,w=p(x),C=t.useMemo((()=>!c(v)),[v]),k=t.useMemo((()=>!d(v)),[v]),S=t.useMemo((()=>!u(v)),[v]),O=t.useMemo((()=>!m(v)&&k&&null===y),[v]),N=e=>{l&&(j(e),setTimeout((()=>j(null)),h)),console.warn("Error",e)},A=t.useMemo((()=>(e,t)=>{N(e.message),s&&s({currentData:v.fullData,errorValue:t,currentValue:r,name:E,path:x,error:e})}),[s,l]),R=y===w,M=y===`key_${w}`,P="number"==typeof x.slice(-1)[0];return{pathString:w,nodeData:v,path:x,name:E,size:D,canEdit:C,canDelete:k,canAdd:S,canDrag:O,error:b,showError:N,onError:A,setError:j,handleEditKey:e=>{if(f(null),E===e)return;if(!a)return;const t=x.slice(0,-1);if(Object.keys(a).includes(e))return void A({code:"KEY_EXISTS",message:g("ERROR_KEY_EXISTS",v)},e);const n=Object.fromEntries(Object.entries(a).map((([t,n])=>t===E?[e,n]:[t,n])));i(n,t).then((t=>{t&&A({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:{isEditing:R,isEditingKey:M,isArray:P,canEditKey:null!==a&&C&&S&&k&&!P}}},q=({canDrag:n,canDragOnto:r,path:o,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=w(),{dragSource:d,setDragSource:u}=T(),[m,g]=t.useState(!1),h=p(o),y=t.useMemo((()=>n?{onDragStart:e=>{e.stopPropagation(),u({path:o,pathString:h})},onDragEnd:e=>{e.stopPropagation(),u({path:null,pathString:null})}}:{}),[n]),f=t.useMemo((()=>e=>r?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:t=>{t.stopPropagation(),j(e),u({path:null,pathString:null}),g(!1)},onDragEnter:t=>{var n;t.stopPropagation(),h.startsWith(null!==(n=d.pathString)&&void 0!==n?n:"")||g(e)},onDragExit:e=>{e.stopPropagation(),g(!1)}}:{}),[d,r]),b=t.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}},f("below"))):null),[d,r]),j=e=>{var t,n;const r=null===(t=d.path)||void 0===t?void 0:t.slice(-1)[0],c=null===(n=d.path)||void 0===n?void 0:n.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:f,BottomDropTarget:b,DropTargetPadding:({position:t,nodeData:n})=>m===t?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",n)}):null,handleDrop:j}},Q=(e,t,n)=>{var r,o,a;const i=parseInt(null!==(r=getComputedStyle(n.current).getPropertyValue("line-height"))&&void 0!==r?r:"16px"),s=(null!==(a=null===(o=t.current)||void 0===o?void 0:o.offsetWidth)&&void 0!==a?a:0)/(.5*i),l=JSON.stringify(e,null,2).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/s))).reduce(((e,t)=>e+t),0)*i;return Math.min(l+30,window.innerHeight-50)},ee=n=>{const{data:r,parentData:o,onEdit:a,onDelete:i,onChange:l,onMove:c,enableClipboard:d,canDragOnto:u,restrictTypeSelection:p,searchFilter:m,searchText:g,showLabel:h,stringTruncate:y,showStringQuotes:b,indent:j,translate:v,customNodeDefinitions:x,handleKeyboard:E,keyboardControls:D,sort:C}=n,{getStyles:k}=w(),{setCurrentlyEditingElement:S,setCollapseState:O,previouslyEditedElement:N,setPreviouslyEditedElement:A,tabDirection:M,setTabDirection:P}=T(),[F,V]=t.useState("function"==typeof r?R:r),{pathString:z,nodeData:I,path:K,name:L,canEdit:_,canDelete:B,canDrag:W,error:G,onError:U,handleEditKey:$,derivedValues:Q}=Z({props:n}),{dragSourceProps:ee,getDropTargetProps:oe,BottomDropTarget:ae,DropTargetPadding:ie}=q({canDrag:W,canDragOnto:u,path:K,nodeData:I,onMove:c,onError:U,translate:v}),se=X(x,I),[le,ce]=t.useState(te(r,se)),de=t.useCallback((e=>{if(!l)return void V(e);const t=l({currentData:I.fullData,newValue:e,currentValue:F,name:L,path:K});V(t)}),[l]);t.useEffect((()=>{V("function"==typeof r?R:r),ce(te(r,se))}),[r,G]);const{CustomNode:ue,customNodeProps:pe,hideKey:me,showEditTools:ge=!0,showOnEdit:he,showOnView:ye}=se,fe=[...J,...x.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],be=t.useMemo((()=>{if("boolean"==typeof p)return p?[]:fe;if(Array.isArray(p))return p;const e=p(I);return"boolean"==typeof e?e?[]:fe:e}),[I,p]),{isEditing:je}=Q,ve=s("value",I,m,g);if(je&&(!ve||!_)){const e=f(I.fullData,K,M,C);S(e||N)}if(!ve)return null;const xe=()=>{let e;switch(S(null),le){case"object":e={[v("DEFAULT_NEW_KEY",I)]:F};break;case"array":e=null!=F?F:[];break;case"number":{const t=Number(F);e=isNaN(t)?0:t;break}default:e=F}a(e,K).then((t=>{t&&U({code:"UPDATE_ERROR",message:t},e)}))},Ee=()=>{S(null),V(r),ce(te(r,se))},{isEditingKey:De,canEditKey:we}=Q,Ce=!je&&G,ke=je&&be.length>0,Se="invalid"!==le&&!G&&ge,Oe=h&&De,Ne=h&&!De&&!me,Ae={value:F,parentData:o,setValue:de,isEditing:je,setIsEditing:_?()=>S(K):()=>{},handleEdit:xe,handleCancel:Ee,path:K,stringTruncate:y,showStringQuotes:b,nodeData:I,translate:v,handleKeyboard:E,keyboardCommon:{cancel:Ee,tabForward:()=>{P("next"),A(z);const e=f(I.fullData,K,"next",C);e&&(xe(),S(e))},tabBack:()=>{P("prev"),A(z);const e=f(I.fullData,K,"prev",C);e&&(xe(),S(e))}}},Te=ue&&(je&&he||!je&&ye)?e.jsx(ue,Object.assign({},n,{value:F,customNodeProps:pe,setValue:de,handleEdit:xe,handleCancel:Ee,handleKeyPress:e=>E(e,{stringConfirm:xe,cancel:Ee}),isEditing:je,setIsEditing:()=>S(K),getStyles:k})):ne(te(r),Ae);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:j/2+"em",position:"relative"},draggable:W},ee,oe("above"),{children:[ae,e.jsx(ie,{position:"above",nodeData:I}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:L.length>10?"wrap":"nowrap"},children:[Ne&&e.jsx("span",{className:"jer-key-text",style:Object.assign(Object.assign({},k("property",I)),{minWidth:`${Math.min(String(L).length+1,5)}ch`,flexShrink:L.length>10?1:0}),onDoubleClick:()=>we&&S(K,"key"),children:""===L?e.jsx("span",{className:K.length>0?"jer-empty-string":void 0}):`${L}:`}),Oe&&e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:z,defaultValue:L,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>E(e,{stringConfirm:()=>$(e.target.value),cancel:Ee,tabForward:()=>{$(e.target.value),S(K)},tabBack:()=>{$(e.target.value),S(f(I.fullData,K,"prev",C))}}),style:{width:String(L).length/1.5+.5+"em"}}),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:Te}),je?e.jsx(Y,{onOk:xe,onCancel:Ee,nodeData:I}):Se&&e.jsx(H,{startEdit:_?()=>S(K,Ee):void 0,handleDelete:B?()=>{i(F,K).then((e=>{e&&U({code:"DELETE_ERROR",message:e},F)}))}:void 0,enableClipboard:d,translate:v,customButtons:n.customButtons,nodeData:I,handleKeyboard:E,keyboardControls:D}),ke&&e.jsxs("div",{className:"jer-select",children:[e.jsx("select",{name:`${L}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const t=x.find((t=>t.name===e));if(t)a(t.defaultValue,K),ce(e),S(null),O({path:K,collapsed:!1});else{const t=re(F,e,v("DEFAULT_NEW_KEY",I),(null==se?void 0:se.CustomNode)?v("DEFAULT_STRING",I):void 0);de(t),a(t,K).then((e=>{e&&(U({code:"UPDATE_ERROR",message:e},t),S(null))}))}})(e.target.value),value:le,children:be.map((t=>e.jsx("option",{value:t,children:t},t)))}),e.jsx("span",{className:"focus"})]}),Ce&&e.jsx("span",{className:"jer-error-slug",style:k("error",I),children:G})]})]}),e.jsx(ie,{position:"below",nodeData:I})]}))},te=(e,t)=>(null==t?void 0:t.CustomNode)&&(null==t?void 0:t.name)&&t.showInTypesSelector?t.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",ne=(t,n)=>{const r=n.value;switch(t){case"string":return e.jsx(M,Object.assign({},n,{value:r}));case"number":return e.jsx(P,Object.assign({},n,{value:r}));case"boolean":return e.jsx(F,Object.assign({},n,{value:r}));case"null":return e.jsx(V,Object.assign({},n));default:return e.jsx(z,Object.assign({},n))}},re=(e,t,n,r)=>{switch(t){case"string":return null!=r?r:String(e);case"number":{const t=Number(e);return isNaN(t)?0:t}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},oe=n=>{const{getStyles:r}=w(),{collapseState:l,setCollapseState:c,doesPathMatch:d,currentlyEditingElement:u,setCurrentlyEditingElement:p,areChildrenBeingEdited:g}=T(),{mainContainerRef:h,data:y,nodeData:b,parentData:j,showCollectionCount:x,onEdit:E,onAdd:D,onDelete:C,canDragOnto:k,collapseFilter:S,collapseAnimationTime:O,onMove:N,enableClipboard:A,searchFilter:R,searchText:M,indent:P,sort:F,showArrayIndices:V,defaultValue:z,translate:I,customNodeDefinitions:K,jsonParse:L,jsonStringify:_,keyboardControls:B,handleKeyboard:W,insertAtTop:G}=n,[$,J]=t.useState(_(y)),te=S(b),{contentRef:ne,isAnimating:re,maxHeight:ae,collapsed:ie,animateCollapse:se}=((e,n,r,o)=>{const[a,i]=t.useState(r?0:void 0),[s,l]=t.useState(r),c=t.useRef(!1),d=t.useRef(null),u=t.useRef(0),p=t.useRef();return{contentRef:d,isAnimating:c.current,animateCollapse:t=>{var r,a;if(s!==t){switch(window.clearTimeout(p.current),c.current=!0,t){case!0:{const e=null!==(a=null===(r=d.current)||void 0===r?void 0:r.offsetHeight)&&void 0!==a?a:0;u.current=e,i(e),setTimeout((()=>{i(0)}),5);break}case!1:i(u.current||Q(e,d,o))}l(!s),p.current=window.setTimeout((()=>{c.current=!1,t||i(void 0)}),n)}},maxHeight:a,collapsed:s}})(y,O,te,h),{pathString:le,nodeData:ce,path:de,name:ue,size:pe,canEdit:me,canDelete:ge,canAdd:he,canDrag:ye,error:fe,setError:be,onError:je,handleEditKey:ve,derivedValues:xe}=Z({props:n,collapsed:ie}),{dragSourceProps:Ee,getDropTargetProps:De,BottomDropTarget:we,DropTargetPadding:Ce}=q({canDrag:ye,canDragOnto:k,path:de,nodeData:ce,onMove:N,onError:je,translate:I}),ke=t.useRef(!te);t.useEffect((()=>{J(_(y))}),[y]),t.useEffect((()=>{const e=S(ce)&&!xe.isEditing;ke.current=!e,se(e)}),[S]),t.useEffect((()=>{null!==l&&d(de)&&(ke.current=!0,se(l.collapsed))}),[l]);const Se=t.useRef(null),Oe=t.useMemo((()=>(e,t)=>"function"!=typeof z?z:z(e,t)),[z]),{CustomNode:Ne,customNodeProps:Ae,CustomWrapper:Te,wrapperProps:Re={},hideKey:Me,showEditTools:Pe=!0,showOnEdit:Fe,showOnView:Ve,showCollectionWrapper:ze=!0}=t.useMemo((()=>X(K,ce)),[]),Ie=g(le);Ie&&ie&&se(!1);if(!(s("collection",ce,R,M)||0===ce.level)&&!Ie)return null;const Ke=Array.isArray(y)?"array":"object",Le="array"===Ke?{open:"[",close:"]"}:{open:"{",close:"}"},_e=e=>{if("Tab"!==e.key||e.getModifierState("Shift"))W(e,{objectConfirm:We,cancel:Ue});else{e.preventDefault();const t=v(Se,"\t");J(t)}},Be=e=>{const t=m(e);if(t&&B.collapseModifier.includes(t))return ke.current=!0,void c({collapsed:!ie,path:de});u&&u.includes(le)||(ke.current=!0,c(null),se(!ie))},We=()=>{try{const e=L($);if(p(null),be(null),JSON.stringify(e)===JSON.stringify(y))return;E(e,de).then((t=>{t&&je({code:"UPDATE_ERROR",message:t},e)}))}catch(e){je({code:"INVALID_JSON",message:I("ERROR_INVALID_JSON",ce)},$)}},Ge=de.length>0?()=>{C(y,de).then((e=>{e&&je({code:"DELETE_ERROR",message:e},y)}))}:void 0,Ue=()=>{p(null),be(null),J(_(y))},{isEditing:He,isEditingKey:Ye,isArray:$e,canEditKey:Je}=xe,Xe="when-closed"===x?ie:x,Ze=!He&&Pe,qe=(V||!$e)&&!Me&&void 0!==ue,Qe=Ne&&(He&&Fe||!He&&Ve),et=Object.entries(y).map((([e,t])=>["array"===Ke?Number(e):e,t]));"object"===Ke&&F(et,(e=>e));const tt=ke.current?He?e.jsx("div",{className:"jer-collection-text-edit",children:e.jsxs("div",{children:[e.jsx(a,{textAreaRef:Se,className:"jer-collection-text-area",name:le,value:$,setValue:J,isEditing:He,handleKeyPress:_e,styles:r("input",ce)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(Y,{onOk:We,onCancel:Ue,nodeData:ce})})]})}):et.map((([t,o],a)=>{const s={key:t,value:o,path:[...de,t],level:de.length+1,index:a,size:i(o)?Object.keys(o).length:1,parentData:y,fullData:ce.fullData};return e.jsx("div",{className:"jer-collection-element",style:r("collectionElement",s),children:i(o)?e.jsx(oe,Object.assign({},n,{data:o,parentData:y,nodeData:s,showCollectionCount:x,canDragOnto:me}),t):e.jsx(ee,Object.assign({},n,{data:o,parentData:y,nodeData:s,canDragOnto:me,showLabel:"object"===Ke||V}),t)},t)})):null,nt=!!ze&&(ie&&!Ie);nt||(ke.current=!0);const rt=Object.assign(Object.assign({},n),{data:y,value:y,parentData:j,nodeData:ce,setValue:e=>o(void 0,void 0,void 0,(function*(){return yield E(e,de)})),handleEdit:We,handleCancel:Ue,handleKeyPress:_e,isEditing:He,setIsEditing:()=>p(de),getStyles:r,canDragOnto:me}),ot=Qe?e.jsx(Ne,Object.assign({customNodeProps:Ae},rt,{children:tt})):tt,at=Ye?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:le,defaultValue:ue,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>W(e,{stringConfirm:()=>ve(e.target.value),cancel:Ue,tabForward:()=>{ve(e.target.value);const t=null==et?void 0:et[0][0];p(t?[...de,t]:f(ce.fullData,de,"next",F))},tabBack:()=>{ve(e.target.value),p(f(ce.fullData,de,"prev",F))}}),style:{width:String(ue).length/1.5+.5+"em"}}):qe&&e.jsx("span",{className:"jer-key-text",style:r("property",ce),onClick:e=>e.stopPropagation(),onDoubleClick:()=>Je&&p(de,"key"),children:""===ue?e.jsx("span",{className:de.length>0?"jer-empty-string":void 0}):`${ue}:`}),it=Ze&&e.jsx(H,{startEdit:me?()=>{ke.current=!0,p(de)}:void 0,handleAdd:he?e=>{se(!1);const t=Oe(ce,e);if("array"===Ke){const e=G.array?0:y.length,n=G.array?{insert:!0}:{};D(t,[...de,e],n).then((e=>{e&&je({code:"ADD_ERROR",message:e},t)}))}else if(e in y)je({code:"KEY_EXISTS",message:I("ERROR_KEY_EXISTS",ce)},e);else{const n=G.object?{insertBefore:0}:{};D(t,[...de,e],n).then((e=>{e&&je({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:ge?Ge:void 0,enableClipboard:A,type:Ke,nodeData:ce,translate:I,customButtons:n.customButtons,keyboardControls:B,handleKeyboard:W}),st=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===de.length?0:P/2)+"em"},r("collection",ce)),{position:"relative"}),draggable:ye},Ee,De("above"),{children:[e.jsx("div",{className:"jer-clickzone",style:{width:P/2+1+"em",zIndex:10+2*ce.level},onClick:e=>Be(e)}),!He&&we,e.jsx(Ce,{position:"above",nodeData:ce}),ze?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:e=>Be(e),children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon jer-accordion-icon"+(ie?" jer-rotate-90":""),style:{zIndex:11+2*ce.level},onClick:e=>Be(e),children:e.jsx(U,{name:"chevron",rotate:ie,nodeData:ce})}),at,!He&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:r("bracket",ce),children:Le.open})]}),!He&&Xe&&e.jsx("div",{className:"jer-collection-item-count"+(Xe?" jer-visible":" jer-hidden"),style:r("itemCount",ce),children:1===pe?I("ITEM_SINGLE",Object.assign(Object.assign({},ce),{size:1}),1):I("ITEMS_MULTIPLE",ce,pe)}),e.jsx("div",{className:"jer-brackets"+(nt?" jer-visible":" jer-hidden"),style:r("bracket",ce),children:Le.close}),it]}):Me?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[at,it]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign({overflowY:nt||re?"clip":"visible",maxHeight:Ie?void 0:ae},r("collectionInner",ce)),ref:ne,children:[ot,e.jsx("div",{className:He?"jer-collection-error-row":"jer-collection-error-row-edit",children:fe&&e.jsx("span",{className:"jer-error-slug",style:r("error",ce),children:fe})}),!He&&ze&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},r("bracket",ce)),{marginLeft:(P<3?-1:P<6?-.5:0)+"em"}),children:Le.close})]}),e.jsx(Ce,{position:"below",nodeData:ce})]}));return Te?e.jsx(Te,Object.assign({customNodeProps:Re},rt,{children:st})):st},ae={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"},ie=(e,t)=>(n,r,o)=>((e,t,n,r,o)=>{if(t[r]){const e=t[r](n);if(null!==e)return e}const a=r in e?e[r]:ae[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,t,r,n,o);var se=[],le=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,a="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var i=se.indexOf(a);-1===i&&(i=se.push(a)-1,le[i]={}),n=le[i]&&le[i][r]?le[i][r]:le[i][r]=s()}else n=s();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-expand-transition-time:0.3s;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden,.jer-visible{transition:var(--jer-expand-transition-time)}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative;transition:var(--jer-expand-transition-time)}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:transform var(--jer-expand-transition-time)}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-accordion-icon,.jer-rotate-90{transition:transform var(--jer-expand-transition-time)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string:after{content:"<empty string>:";font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}',{});const ce=({data:n,setData:r,rootName:a="root",onUpdate:s=(()=>{}),onEdit:l=s,onDelete:c=s,onAdd:d=s,onChange:u,onError:p,showErrorMessages:m=!0,enableClipboard:h=!0,indent:f=2,collapse:b=!1,collapseAnimationTime:j=300,showCollectionCount:v=!0,restrictEdit:x=!1,restrictDelete:E=!1,restrictAdd:D=!1,restrictTypeSelection:C=!1,restrictDrag:k=!0,searchFilter:S,searchText:O,searchDebounceTime:N=350,keySort:A=!1,showArrayIndices:R=!0,showStringQuotes:M=!0,defaultValue:P=null,minWidth:F=250,maxWidth:V="min(600px, 90vw)",rootFontSize:z,stringTruncate:I=250,translations:K={},className:L,id:_,customText:B={},customNodeDefinitions:W=[],customButtons:G=[],jsonParse:U=JSON.parse,jsonStringify:H=(e=>JSON.stringify(e,null,2)),errorMessageTimeout:Y=2500,keyboardControls:$={},insertAtTop:J=!1})=>{const{getStyles:X}=w(),{setCurrentlyEditingElement:Z}=T(),q=t.useCallback(ue(b),[b]),Q=t.useCallback(ie(K,B),[K,B]),[te,ne]=t.useState(O),[re,ae]=(({setData:e,data:n})=>{const[r,o]=t.useState(e?void 0:n),a=t.useCallback((t=>{e?e(t):o(t)}),[e]);return t.useEffect((()=>{e||o(n)}),[n]),[e?n:r,a]})({setData:r,data:n}),se=t.useRef(null);t.useEffect((()=>{Z(null);const e=setTimeout((()=>ne(O)),N);return()=>clearTimeout(e)}),[O,N]);const le={key:a,path:[],level:0,index:0,value:re,size:"object"==typeof re&&null!==re?Object.keys(re).length:1,parentData:null,fullData:re},ce=(e,t)=>o(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void ae(t.newData);const r=me(n)?n:["error",n],[o,a]=r;if("error"===o)return ae(t.currentData),!1===a?Q("ERROR_UPDATE",le):String(a);ae(a)})),ge=t.useMemo((()=>ue(x)),[x]),he=t.useMemo((()=>ue(E)),[E]),ye=t.useMemo((()=>ue(D)),[D]),fe=t.useMemo((()=>ue(k)),[k]),be=t.useMemo((()=>pe(S)),[S]),je=t.useMemo((()=>(e=>{const t=Object.assign({},y);for(const n of Object.keys(y)){const r=n;if(e[r]){const o=e[r],a=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(o)?o:[o]:"string"==typeof o?{key:o}:o;t[r]=a,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})($)),[$]),ve=t.useCallback(((e,t)=>((e,t,n)=>{const r=Object.entries(t);for(const[t,o]of r)if(g(n,e[t],t)){n.preventDefault(),o();break}})(je,t,e)),[$]),xe=t.useCallback(((e,t)=>{!1!==A&&("function"!=typeof A?e.sort(((e,n)=>{const r=t(e)[0],o=t(n)[0];return r<o?-1:r>o?1:0})):e.sort(((e,n)=>A(t(e),t(n)))))}),[A]),Ee={mainContainerRef:se,name:a,nodeData:le,onEdit:(e,t)=>o(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=de(re,t,e,"update");if(o!==a)return yield ce(l,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>o(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=de(re,t,e,"delete");return yield ce(c,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:a,newValue:i}=de(re,t,e,"add",n);return yield ce(d,{currentData:r,newData:o,currentValue:a,newValue:i,name:t.slice(-1)[0],path:t})})),onChange:u,onError:p,showErrorMessages:m,onMove:(e,t,n)=>o(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=de(re,e,"","delete"),i=e.slice(-1)[0],s=t.slice(0,-1),c=t.slice(-1)[0];let d="number"==typeof c?"above"===n?c:c+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===n?{insertBefore:c}:{insertAfter:c},{newData:p,newValue:m}=de(o,[...s,d],a,"add",u);return yield ce(l,{currentData:r,newData:p,currentValue:a,newValue:m,name:t.slice(-1)[0],path:t})})),showCollectionCount:v,collapseFilter:q,collapseAnimationTime:j,restrictEditFilter:ge,restrictDeleteFilter:he,restrictAddFilter:ye,restrictTypeSelection:C,restrictDragFilter:fe,canDragOnto:!1,searchFilter:be,searchText:te,enableClipboard:h,keySort:A,sort:xe,showArrayIndices:R,showStringQuotes:M,indent:f,defaultValue:P,stringTruncate:I,translate:Q,customNodeDefinitions:W,customButtons:G,parentData:null,jsonParse:U,jsonStringify:H,errorMessageTimeout:Y,handleKeyboard:ve,keyboardControls:je,insertAtTop:{object:!0===J||"object"===J,array:!0===J||"array"===J}},De=Object.assign(Object.assign({},X("container",le)),{minWidth:F,maxWidth:V});return De.fontSize=null!=z?z:De.fontSize,e.jsx("div",{id:_,ref:se,className:`jer-editor-container ${null!=L?L:""}`,style:De,children:i(re)?e.jsx(oe,Object.assign({data:re},Ee)):e.jsx(ee,Object.assign({data:re,showLabel:!0},Ee))})},de=(e,t,o,a,i={})=>{if(0===t.length)return{currentData:e,newData:o,currentValue:e,newValue:o};const s=Object.assign({remove:"delete"===a},i),l="add"!==a?r(e,t):void 0;return{currentData:e,newData:n(e,t,o,s),currentValue:l,newValue:"delete"!==a?o:void 0}},ue=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,pe=e=>{if(void 0!==e)return"value"===e?c:"key"===e?d:"all"===e?(e,t)=>c(e,t)||d(e,t):e},me=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),ge=({value:t,setIsEditing:n,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:()=>n(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&n(!0)},className:"jer-value-string jer-hyperlink",style:c,children:e.jsxs("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:null!==(s=c.color)&&void 0!==s?s:void 0},children:['"',u(t,l),'"']})})},he={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:ge,showOnView:!0,showOnEdit:!1};exports.assign=n,exports.extract=r,exports.IconAdd=I,exports.IconCancel=W,exports.IconChevron=G,exports.IconCopy=_,exports.IconDelete=L,exports.IconEdit=K,exports.IconOk=B,exports.JsonEditor=n=>{var r;const[o,a]=t.useState();t.useEffect((()=>{const e=document.documentElement;a(e)}),[]);const{collapseAnimationTime:i=300}=n;if(!o)return null;const s=getComputedStyle(o).getPropertyValue("--jer-expand-transition-time");return 1e3*parseFloat(s)!==i&&o.style.setProperty("--jer-expand-transition-time",i/1e3+"s"),e.jsx(D,{theme:null!==(r=n.theme)&&void 0!==r?r:x,icons:n.icons,docRoot:o,children:e.jsx(A,{children:e.jsx(ce,Object.assign({},n))})})},exports.LinkCustomComponent=ge,exports.LinkCustomNodeDefinition=he,exports.candyWrapperTheme={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"}},exports.defaultTheme=x,exports.githubDarkTheme={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)"}},exports.githubLightTheme={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"}},exports.isCollection=i,exports.matchNode=c,exports.matchNodeKey=d,exports.monoDarkTheme={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"}},exports.monoLightTheme={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"}},exports.psychedelicTheme={displayName:"Psychedelic",fragments:{pale:{color:"#A8DADC"},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"}},exports.truncate=u; |
@@ -1,1 +0,1 @@ | ||
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createContext as r,useContext as o,useState as a,useRef as i,useEffect as l,useMemo as s,useCallback 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,t,n,r){return new(n||(n=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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}s((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const g=({className:n,name:r,value:o,setValue:a,handleKeyPress:i,styles:l,textAreaRef:s})=>{if("string"!=typeof o)return null;const c="\n"===o.slice(-1)?o+".":o;return e("div",{style:{display:"grid"},children:[t("textarea",{id:`${r}_textarea`,ref:s,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},l),rows:1,className:n,name:`${r}_textarea`,value:o,onChange:e=>a(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:i}),t("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"},l),children:c})]})},m=e=>null!==e&&"object"==typeof e,h=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!y(r,t,n))return!1}if(!n&&r&&!y(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!b(t,r))return!1}return!0},y=(e="",t,n=b)=>{const r=t.value;return Object.entries(r).some((([o,a])=>{const i=[...t.path,o],l=Object.assign(Object.assign({},t),{key:o,path:i,level:t.level+1,value:a,size:i.length,parentData:r});return m(a)?y(e,l,n):n(l,e)}))},b=(e,t="")=>{const{value:n}=e;if(null===n&&"null".includes(t.toLowerCase()))return!0;switch(typeof n){case"string":return n.toLowerCase().includes(t.toLowerCase());case"number":return!!String(n).includes(t);case"boolean":return n?"true".includes(t.toLowerCase())||"1"===t:"false".includes(t.toLowerCase())||"0"===t;default:return!1}},f=({key:e,path:t},n="")=>!!b({value:e},n)||!!t.some((e=>b({value:e},n))),v=(e,t=200)=>"string"==typeof e?e.length<t?e:`${e.slice(0,t-2).trim()}...`:e,j=(e,t)=>(null!=t?t:"")+e.map((e=>""===e?String.fromCharCode(0):e)).join("."),E=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,D=(e,t,n)=>{const r=e.key,o=E(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:a,modifier:i}=t;return("stringLineBreak"!==n||"Enter"!==r||"Shift"!==o||"Enter"!==a||!(null==i?void 0:i.includes("Shift")))&&(r===a&&(i===o||Array.isArray(i)&&i.includes(o)))},w={key:"Enter"},C={confirm:w,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},w),{modifier:["Meta","Shift","Control"]}),objectLineBreak:w,stringConfirm:w,stringLineBreak:Object.assign(Object.assign({},w),{modifier:["Shift"]}),numberConfirm:w,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:w,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},k=(e,t,n="next",r)=>{const o=t.slice(0,t.length-1),a=t.slice(-1)[0];if(void 0===a)return null;const i=u(e,o),l=S(i);Array.isArray(i)||r(l,(({key:e,value:t})=>[e,t]));const s=l.findIndex((e=>e.key===a)),c=l["next"===n?s+1:s-1];return c?m(c.value)?O(e,[...o,c.key],n,r):[...o,c.key]:0===o.length?null:k(e,o,n,r)},O=(e,t,n="next",r)=>{const o=u(e,t);if(!m(o))return t;const a=Array.isArray(o)?o.map(((e,t)=>t)):Object.keys(o);r(a,(n=>[n,u(e,t)]));const i="next"===n?a[0]:a[a.length-1];return O(e,[...t,i],n,r)},S=e=>Array.isArray(e)?e.map(((e,t)=>({index:t,value:e,key:t}))):Object.entries(e).map((([e,t],n)=>({key:e,value:t,index:n}))),N=(e,t)=>{var n,r,o,a;const i=e.current,l=null!==(n=null==i?void 0:i.selectionStart)&&void 0!==n?n:1/0,s=null!==(r=null==i?void 0:i.selectionEnd)&&void 0!==r?r:1/0,c=(null===(o=null==i?void 0:i.textContent)||void 0===o?void 0:o.slice(0,l))+t+(null===(a=null==i?void 0:i.textContent)||void 0===a?void 0:a.slice(s));return i.value=c,null==i||i.setSelectionRange(l+1,l+1),c},x={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)"}},A=r({getStyles:()=>({}),icons:{}}),T=({theme:e=x,icons:n={},docRoot:r,children:o})=>{const a=R(e,r);return t(A.Provider,{value:{getStyles:(e,t)=>"function"==typeof a[e]?a[e](t):a[e],icons:n},children:o})},P=()=>o(A),R=(e,t)=>{var n,r,o,a;const i={},l=(Array.isArray(e)?e:[e]).map((e=>z(e)?V({fragments:{},styles:e},i):V(e,i))),s=V(x,{});Object.keys(s).forEach((e=>{const t=e;l.forEach((e=>{e[t]&&(s[t]=Object.assign(Object.assign({},s[t]),e[t]))}))}));const c=Object.assign({},s);return Object.entries(i).forEach((([e,t])=>{const n=e;c[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},s[n]),r)}})),"function"!=typeof(null==c?void 0:c.inputHighlight)&&(null===(n=null==c?void 0:c.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",null===(r=null==c?void 0:c.inputHighlight)||void 0===r?void 0:r.backgroundColor),"function"!=typeof(null==c?void 0:c.iconCopy)&&(null===(o=null==c?void 0:c.iconCopy)||void 0===o?void 0:o.color)&&t.style.setProperty("--jer-icon-copy-color",null===(a=null==c?void 0:c.iconCopy)||void 0===a?void 0:a.color),c},V=(e,t)=>{const{fragments:n,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a,i;if("function"==typeof o)return t[e]=o,Object.assign({},r);if("string"==typeof o){const t=null!==(a=null==n?void 0:n[o])&&void 0!==a?a:o;return"string"==typeof t?Object.assign(Object.assign({},r),{[null!==(i=F[e])&&void 0!==i?i:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},z=e=>!("styles"in e),F={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},M=r({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},previouslyEditedElement:null,setPreviouslyEditedElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{},tabDirection:"next",setTabDirection:()=>{}}),K=({children:e})=>{const[n,r]=a(null),[o,l]=a(null),[s,c]=a({path:null,pathString:null}),d=i(null),u=i("next"),p=i(null);return t(M.Provider,{value:{collapseState:n,setCollapseState:e=>{r(e),null!==e&&setTimeout((()=>r(null)),2e3)},doesPathMatch:e=>{if(null===n)return!1;for(const[t,r]of n.path.entries())if(r!==e[t])return!1;return!0},currentlyEditingElement:o,setCurrentlyEditingElement:(e,t)=>{const n="string"==typeof e||null===e?e:j(e,"key"===t?"key_":void 0);null!==o&&null!==n&&null!==d.current&&d.current(),l(n),d.current="function"==typeof t?t:null},areChildrenBeingEdited:e=>null!==o&&o.includes(e),previouslyEditedElement:p.current,setPreviouslyEditedElement:e=>{p.current=e},tabDirection:u.current,setTabDirection:e=>{u.current=e},dragSource:s,setDragSource:c},children:e})},_=()=>o(M),I="**INVALID_FUNCTION**",L=({value:n,setValue:r,isEditing:o,path:a,setIsEditing:l,handleEdit:s,stringTruncate:c,showStringQuotes:d,nodeData:u,handleKeyboard:p,keyboardCommon:m})=>{const{getStyles:h}=P(),y=i(null),b=j(a),f=d?'"':"";return o?t(g,{className:"jer-input-text",textAreaRef:y,name:b,value:n,setValue:r,isEditing:o,handleKeyPress:e=>{p(e,Object.assign({stringConfirm:s,stringLineBreak:()=>{const e=N(y,"\n");r(e)}},m))},styles:h("input",u)}):e("div",{id:`${b}_display`,onDoubleClick:()=>l(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&l(!0)},className:"jer-value-string",style:h("string",u),children:[f,v(n,c),f]})},B=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:l,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=P();return r?t("input",{className:"jer-input-number",type:"text",name:j(o),value:e,onChange:e=>n(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:t=>s(t,Object.assign({numberConfirm:i,numberUp:()=>n(Number(e)+1),numberDown:()=>n(Number(e)-1)},c)),style:Object.assign({width:String(e).length/1.5+2+"em"},d("input",l))}):t("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",l),children:e})},W=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:l,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=P();return r?t("input",{className:"jer-input-boolean",type:"checkbox",name:j(o),checked:e,onChange:()=>n(!e),onKeyDown:t=>{" "===t.key&&t.preventDefault(),s(t,Object.assign({booleanConfirm:i,booleanToggle:()=>n(!e)},c))},autoFocus:!0}):t("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",l),children:String(e)})},G=({value:e,isEditing:n,setIsEditing:r,handleEdit:o,nodeData:a,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=P(),u=i();l((()=>{if(n)return u.current=window.setTimeout((()=>window.addEventListener("keydown",p)),100),()=>window.removeEventListener("keydown",p);window.clearTimeout(u.current)}),[n]);const p=e=>s(e,Object.assign({confirm:o},c));return t("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:d("null",a),children:String(e)})},U=({value:e})=>{let n="Error!";switch(typeof e){case"string":e===I&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return t("span",{className:"jer-value-invalid",children:n})},H=({size:n,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:o,style:r,children:[t("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),t("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"})]}),Y=({size:n,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:o,style:r,transform:"translate(0, 0.5)",children:[t("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"}),t("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"})]}),$=({size:e,style:n,className:r})=>t("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),J=({size:n,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:o,style:r,children:[t("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"}),t("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),t("path",{d:"M15 10l-4 4 4 4"})]}),X=({size:n,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:o,style:r,children:[t("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),t("path",{d:"M22 4L12 14.01l-3-3"})]}),Z=({size:e,style:n,className:r})=>t("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),Q=({size:e,style:n,className:r})=>t("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),q=({name:e,nodeData:r,rotate:o})=>{var a,i,l,s,c,d,u;const{getStyles:p,icons:g}=P(),m={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(a=null==g?void 0:g.add)&&void 0!==a?a:t(H,Object.assign({},m,{style:p("iconAdd",r)}));case"edit":return null!==(i=null==g?void 0:g.edit)&&void 0!==i?i:t(Y,Object.assign({},m,{style:p("iconEdit",r)}));case"delete":return null!==(l=null==g?void 0:g.delete)&&void 0!==l?l:t($,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:t(J,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:t(X,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:t(Z,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:t(Q,{size:"1em",style:p("iconCollection",r)});default:return t(n,{})}},ee=({startEdit:r,handleDelete:o,handleAdd:i,enableClipboard:l,type:s,customButtons:c,nodeData:d,translate:u,keyboardControls:p,handleKeyboard:g})=>{const{getStyles:m}=P(),h=u("KEY_NEW",d),[y,b]=a(!1),[f,v]=a(h),{key:j,path:D,value:w}=d;return e("div",{className:"jer-edit-buttons",style:{opacity:y?1:void 0},children:[l&&t("div",{onClick:e=>{e.stopPropagation();let t,n="value",r="";if(l){const o=E(e);o&&p.clipboardModifier.includes(o)?(t=ne(D),r=t,n="path"):(t=w,r=s?JSON.stringify(w,null,2):String(t)),navigator.clipboard.writeText(r)}"function"==typeof l&&l({value:t,stringValue:r,path:D,key:j,type:n})},className:"jer-copy-pulse",children:t(q,{name:"copy",nodeData:d})}),r&&t("div",{onClick:e=>{e.stopPropagation(),r()},children:t(q,{name:"edit",nodeData:d})}),o&&t("div",{onClick:e=>{e.stopPropagation(),o()},children:t(q,{name:"delete",nodeData:d})}),i&&t("div",{onClick:e=>{e.stopPropagation(),"object"===s?b(!0):i("")},children:t(q,{name:"add",nodeData:d})}),null==c?void 0:c.map((({Element:e,onClick:n},r)=>t("div",{onClick:e=>n&&n(d,e),children:t(e,{nodeData:d})},r))),y&&i&&"object"===s&&e(n,{children:[t("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:f,onChange:e=>v(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{g(e,{stringConfirm:()=>{i&&(b(!1),i(f),v(h))},cancel:()=>{b(!1),v(h)}})},style:m("input",d)}),t(te,{onOk:e=>{f&&(e.stopPropagation(),b(!1),i(f))},onCancel:e=>{e.stopPropagation(),b(!1)},nodeData:d})]})]})},te=({onOk:n,onCancel:r,nodeData:o})=>e("div",{className:"jer-confirm-buttons",children:[t("div",{onClick:n,children:t(q,{name:"ok",nodeData:o})}),t("div",{onClick:r,children:t(q,{name:"cancel",nodeData:o})})]}),ne=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),re=["string","number","boolean","null","object","array"],oe=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[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,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(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)},ae=({props:e,collapsed:t})=>{const{data:n,nodeData:r,parentData:o,onEdit:i,onError:l,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:m,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:b}=_(),[f,v]=a(null),E=Object.assign(Object.assign({},r),{collapsed:t}),{path:D,key:w,size:C}=E,k=j(D),O=s((()=>!d(E)),[E]),S=s((()=>!u(E)),[E]),N=s((()=>!p(E)),[E]),x=s((()=>!g(E)&&S&&null===y),[E]),A=e=>{c&&(v(e),setTimeout((()=>v(null)),h)),console.warn("Error",e)},T=s((()=>(e,t)=>{A(e.message),l&&l({currentData:E.fullData,errorValue:t,currentValue:n,name:w,path:D,error:e})}),[l,c]),P=y===k,R=y===`key_${k}`,V="number"==typeof D.slice(-1)[0];return{pathString:k,nodeData:E,path:D,name:w,size:C,canEdit:O,canDelete:S,canAdd:N,canDrag:x,error:f,showError:A,onError:T,setError:v,handleEditKey:e=>{if(b(null),w===e)return;if(!o)return;const t=D.slice(0,-1);if(Object.keys(o).includes(e))return void T({code:"KEY_EXISTS",message:m("ERROR_KEY_EXISTS",E)},e);const n=Object.fromEntries(Object.entries(o).map((([t,n])=>t===w?[e,n]:[t,n])));i(n,t).then((t=>{t&&T({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:{isEditing:P,isEditingKey:R,isArray:V,canEditKey:null!==o&&O&&N&&S&&!V}}},ie=({canDrag:e,canDragOnto:n,path:r,nodeData:o,onMove:i,onError:l,translate:c})=>{const{getStyles:d}=P(),{dragSource:u,setDragSource:p}=_(),[g,m]=a(!1),h=j(r),y=s((()=>e?{onDragStart:e=>{e.stopPropagation(),p({path:r,pathString:h})},onDragEnd:e=>{e.stopPropagation(),p({path:null,pathString:null})}}:{}),[e]),b=s((()=>e=>n?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:t=>{t.stopPropagation(),v(e),p({path:null,pathString:null}),m(!1)},onDragEnter:t=>{var n;t.stopPropagation(),h.startsWith(null!==(n=u.pathString)&&void 0!==n?n:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[u,n]),f=s((()=>n&&null!==u.pathString?t("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:r.length}},b("below"))):null),[u,n]),v=e=>{var t,n;const a=null===(t=u.path)||void 0===t?void 0:t.slice(-1)[0],s=null===(n=u.path)||void 0===n?void 0:n.slice(0,-1).join("."),d=r.slice(0,-1).join(""),{parentData:p}=o;"string"==typeof a&&p&&!Array.isArray(p)&&Object.keys(p).includes(a)&&a in p&&s!==d?l({code:"KEY_EXISTS",message:c("ERROR_KEY_EXISTS",o)},a):i(u.path,r,e).then((e=>{e&&l({code:"UPDATE_ERROR",message:e},o.value)}))};return{dragSourceProps:y,getDropTargetProps:b,BottomDropTarget:f,DropTargetPadding:({position:e,nodeData:n})=>g===e?t("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",n)}):null,handleDrop:v}},le=(e,t,n)=>{var r,o,a;const i=parseInt(null!==(r=getComputedStyle(n.current).getPropertyValue("line-height"))&&void 0!==r?r:"16px"),l=(null!==(a=null===(o=t.current)||void 0===o?void 0:o.offsetWidth)&&void 0!==a?a:0)/(.5*i),s=JSON.stringify(e,null,2).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/l))).reduce(((e,t)=>e+t),0)*i;return Math.min(s+30,window.innerHeight-50)},se=n=>{const{data:r,parentData:o,onEdit:i,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:m,restrictTypeSelection:y,searchFilter:b,searchText:f,showLabel:v,stringTruncate:j,showStringQuotes:E,indent:D,translate:w,customNodeDefinitions:C,handleKeyboard:O,keyboardControls:S,sort:N}=n,{getStyles:x}=P(),{setCurrentlyEditingElement:A,setCollapseState:T,previouslyEditedElement:R,setPreviouslyEditedElement:V,tabDirection:z,setTabDirection:F}=_(),[M,K]=a("function"==typeof r?I:r),{pathString:L,nodeData:B,path:W,name:G,canEdit:U,canDelete:H,canDrag:Y,error:$,onError:J,handleEditKey:X,derivedValues:Z}=ae({props:n}),{dragSourceProps:Q,getDropTargetProps:q,BottomDropTarget:ne,DropTargetPadding:le}=ie({canDrag:Y,canDragOnto:m,path:W,nodeData:B,onMove:p,onError:J,translate:w}),se=oe(C,B),[pe,ge]=a(ce(r,se)),me=c((e=>{if(!u)return void K(e);const t=u({currentData:B.fullData,newValue:e,currentValue:M,name:G,path:W});K(t)}),[u]);l((()=>{K("function"==typeof r?I:r),ge(ce(r,se))}),[r,$]);const{CustomNode:he,customNodeProps:ye,hideKey:be,showEditTools:fe=!0,showOnEdit:ve,showOnView:je}=se,Ee=[...re,...C.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],De=s((()=>{if("boolean"==typeof y)return y?[]:Ee;if(Array.isArray(y))return y;const e=y(B);return"boolean"==typeof e?e?[]:Ee:e}),[B,y]),{isEditing:we}=Z,Ce=h("value",B,b,f);if(we&&(!Ce||!U)){const e=k(B.fullData,W,z,N);A(e||R)}if(!Ce)return null;const ke=()=>{let e;switch(A(null),pe){case"object":e={[w("DEFAULT_NEW_KEY",B)]:M};break;case"array":e=null!=M?M:[];break;case"number":{const t=Number(M);e=isNaN(t)?0:t;break}default:e=M}i(e,W).then((t=>{t&&J({code:"UPDATE_ERROR",message:t},e)}))},Oe=()=>{A(null),K(r),ge(ce(r,se))},{isEditingKey:Se,canEditKey:Ne}=Z,xe=!we&&$,Ae=we&&De.length>0,Te="invalid"!==pe&&!$&&fe,Pe=v&&Se,Re=v&&!Se&&!be,Ve={value:M,parentData:o,setValue:me,isEditing:we,setIsEditing:U?()=>A(W):()=>{},handleEdit:ke,handleCancel:Oe,path:W,stringTruncate:j,showStringQuotes:E,nodeData:B,translate:w,handleKeyboard:O,keyboardCommon:{cancel:Oe,tabForward:()=>{F("next"),V(L);const e=k(B.fullData,W,"next",N);e&&(ke(),A(e))},tabBack:()=>{F("prev"),V(L);const e=k(B.fullData,W,"prev",N);e&&(ke(),A(e))}}},ze=he&&(we&&ve||!we&&je)?t(he,Object.assign({},n,{value:M,customNodeProps:ye,setValue:me,handleEdit:ke,handleCancel:Oe,handleKeyPress:e=>O(e,{stringConfirm:ke,cancel:Oe}),isEditing:we,setIsEditing:()=>A(W),getStyles:x})):de(ce(r),Ve);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:D/2+"em",position:"relative"},draggable:Y},Q,q("above"),{children:[ne,t(le,{position:"above",nodeData:B}),e("div",{className:"jer-value-main-row",style:{flexWrap:G.length>10?"wrap":"nowrap"},children:[Re&&t("span",{className:"jer-key-text",style:Object.assign(Object.assign({},x("property",B)),{minWidth:`${Math.min(String(G).length+1,5)}ch`,flexShrink:G.length>10?1:0}),onDoubleClick:()=>Ne&&A(W,"key"),children:""===G?t("span",{className:W.length>0?"jer-empty-string":void 0}):`${G}:`}),Pe&&t("input",{className:"jer-input-text jer-key-edit",type:"text",name:L,defaultValue:G,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>O(e,{stringConfirm:()=>X(e.target.value),cancel:Oe,tabForward:()=>{X(e.target.value),A(W)},tabBack:()=>{X(e.target.value),A(k(B.fullData,W,"prev",N))}}),style:{width:String(G).length/1.5+.5+"em"}}),e("div",{className:"jer-value-and-buttons",children:[t("div",{className:"jer-input-component",children:ze}),we?t(te,{onOk:ke,onCancel:Oe,nodeData:B}):Te&&t(ee,{startEdit:U?()=>A(W,Oe):void 0,handleDelete:H?()=>{d(M,W).then((e=>{e&&J({code:"DELETE_ERROR",message:e},M)}))}:void 0,enableClipboard:g,translate:w,customButtons:n.customButtons,nodeData:B,handleKeyboard:O,keyboardControls:S}),Ae&&e("div",{className:"jer-select",children:[t("select",{name:`${G}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const t=C.find((t=>t.name===e));if(t)i(t.defaultValue,W),ge(e),A(null),T({path:W,collapsed:!1});else{const t=ue(M,e,w("DEFAULT_NEW_KEY",B),(null==se?void 0:se.CustomNode)?w("DEFAULT_STRING",B):void 0);me(t),i(t,W).then((e=>{e&&(J({code:"UPDATE_ERROR",message:e},t),A(null))}))}})(e.target.value),value:pe,children:De.map((e=>t("option",{value:e,children:e},e)))}),t("span",{className:"focus"})]}),xe&&t("span",{className:"jer-error-slug",style:x("error",B),children:$})]})]}),t(le,{position:"below",nodeData:B})]}))},ce=(e,t)=>(null==t?void 0:t.CustomNode)&&(null==t?void 0:t.name)&&t.showInTypesSelector?t.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",de=(e,n)=>{const r=n.value;switch(e){case"string":return t(L,Object.assign({},n,{value:r}));case"number":return t(B,Object.assign({},n,{value:r}));case"boolean":return t(W,Object.assign({},n,{value:r}));case"null":return t(G,Object.assign({},n));default:return t(U,Object.assign({},n))}},ue=(e,t,n,r)=>{switch(t){case"string":return null!=r?r:String(e);case"number":{const t=Number(e);return isNaN(t)?0:t}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},pe=r=>{const{getStyles:o}=P(),{collapseState:c,setCollapseState:d,doesPathMatch:u,currentlyEditingElement:y,setCurrentlyEditingElement:b,areChildrenBeingEdited:f}=_(),{mainContainerRef:v,data:j,nodeData:D,parentData:w,showCollectionCount:C,onEdit:O,onAdd:S,onDelete:x,canDragOnto:A,collapseFilter:T,collapseAnimationTime:R,onMove:V,enableClipboard:z,searchFilter:F,searchText:M,indent:K,sort:I,showArrayIndices:L,defaultValue:B,translate:W,customNodeDefinitions:G,jsonParse:U,jsonStringify:H,keyboardControls:Y,handleKeyboard:$,insertAtTop:J}=r,[X,Z]=a(H(j)),Q=T(D),{contentRef:ne,isAnimating:re,maxHeight:ce,collapsed:de,animateCollapse:ue}=((e,t,n,r)=>{const[o,l]=a(n?0:void 0),[s,c]=a(n),d=i(!1),u=i(null),p=i(0),g=i();return{contentRef:u,isAnimating:d.current,animateCollapse:n=>{var o,a;if(s!==n){switch(window.clearTimeout(g.current),d.current=!0,n){case!0:{const e=null!==(a=null===(o=u.current)||void 0===o?void 0:o.offsetHeight)&&void 0!==a?a:0;p.current=e,l(e),setTimeout((()=>{l(0)}),5);break}case!1:l(p.current||le(e,u,r))}c(!s),g.current=window.setTimeout((()=>{d.current=!1,n||l(void 0)}),t)}},maxHeight:o,collapsed:s}})(j,R,Q,v),{pathString:ge,nodeData:me,path:he,name:ye,size:be,canEdit:fe,canDelete:ve,canAdd:je,canDrag:Ee,error:De,setError:we,onError:Ce,handleEditKey:ke,derivedValues:Oe}=ae({props:r,collapsed:de}),{dragSourceProps:Se,getDropTargetProps:Ne,BottomDropTarget:xe,DropTargetPadding:Ae}=ie({canDrag:Ee,canDragOnto:A,path:he,nodeData:me,onMove:V,onError:Ce,translate:W}),Te=i(!Q);l((()=>{Z(H(j))}),[j]),l((()=>{const e=T(me)&&!Oe.isEditing;Te.current=!e,ue(e)}),[T]),l((()=>{null!==c&&u(he)&&(Te.current=!0,ue(c.collapsed))}),[c]);const Pe=i(null),Re=s((()=>(e,t)=>"function"!=typeof B?B:B(e,t)),[B]),{CustomNode:Ve,customNodeProps:ze,CustomWrapper:Fe,wrapperProps:Me={},hideKey:Ke,showEditTools:_e=!0,showOnEdit:Ie,showOnView:Le,showCollectionWrapper:Be=!0}=s((()=>oe(G,me)),[]),We=f(ge);We&&de&&ue(!1);if(!(h("collection",me,F,M)||0===me.level)&&!We)return null;const Ge=Array.isArray(j)?"array":"object",Ue="array"===Ge?{open:"[",close:"]"}:{open:"{",close:"}"},He=e=>{if("Tab"!==e.key||e.getModifierState("Shift"))$(e,{objectConfirm:$e,cancel:Xe});else{e.preventDefault();const t=N(Pe,"\t");Z(t)}},Ye=e=>{const t=E(e);if(t&&Y.collapseModifier.includes(t))return Te.current=!0,void d({collapsed:!de,path:he});y&&y.includes(ge)||(Te.current=!0,d(null),ue(!de))},$e=()=>{try{const e=U(X);if(b(null),we(null),JSON.stringify(e)===JSON.stringify(j))return;O(e,he).then((t=>{t&&Ce({code:"UPDATE_ERROR",message:t},e)}))}catch(e){Ce({code:"INVALID_JSON",message:W("ERROR_INVALID_JSON",me)},X)}},Je=he.length>0?()=>{x(j,he).then((e=>{e&&Ce({code:"DELETE_ERROR",message:e},j)}))}:void 0,Xe=()=>{b(null),we(null),Z(H(j))},{isEditing:Ze,isEditingKey:Qe,isArray:qe,canEditKey:et}=Oe,tt="when-closed"===C?de:C,nt=!Ze&&_e,rt=(L||!qe)&&!Ke&&void 0!==ye,ot=Ve&&(Ze&&Ie||!Ze&&Le),at=Object.entries(j).map((([e,t])=>["array"===Ge?Number(e):e,t]));"object"===Ge&&I(at,(e=>e));const it=Te.current?Ze?t("div",{className:"jer-collection-text-edit",children:e("div",{children:[t(g,{textAreaRef:Pe,className:"jer-collection-text-area",name:ge,value:X,setValue:Z,isEditing:Ze,handleKeyPress:He,styles:o("input",me)}),t("div",{className:"jer-collection-input-button-row",children:t(te,{onOk:$e,onCancel:Xe,nodeData:me})})]})}):at.map((([e,n],a)=>{const i={key:e,value:n,path:[...he,e],level:he.length+1,index:a,size:m(n)?Object.keys(n).length:1,parentData:j,fullData:me.fullData};return t("div",{className:"jer-collection-element",style:o("collectionElement",i),children:m(n)?t(pe,Object.assign({},r,{data:n,parentData:j,nodeData:i,showCollectionCount:C,canDragOnto:fe}),e):t(se,Object.assign({},r,{data:n,parentData:j,nodeData:i,canDragOnto:fe,showLabel:"object"===Ge||L}),e)},e)})):null,lt=!!Be&&(de&&!We);lt||(Te.current=!0);const st=Object.assign(Object.assign({},r),{data:j,value:j,parentData:w,nodeData:me,setValue:e=>p(void 0,void 0,void 0,(function*(){return yield O(e,he)})),handleEdit:$e,handleCancel:Xe,handleKeyPress:He,isEditing:Ze,setIsEditing:()=>b(he),getStyles:o,canDragOnto:fe}),ct=ot?t(Ve,Object.assign({customNodeProps:ze},st,{children:it})):it,dt=Qe?t("input",{className:"jer-input-text jer-key-edit",type:"text",name:ge,defaultValue:ye,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>$(e,{stringConfirm:()=>ke(e.target.value),cancel:Xe,tabForward:()=>{ke(e.target.value);const t=null==at?void 0:at[0][0];b(t?[...he,t]:k(me.fullData,he,"next",I))},tabBack:()=>{ke(e.target.value),b(k(me.fullData,he,"prev",I))}}),style:{width:String(ye).length/1.5+.5+"em"}}):rt&&t("span",{className:"jer-key-text",style:o("property",me),onClick:e=>e.stopPropagation(),onDoubleClick:()=>et&&b(he,"key"),children:""===ye?t("span",{className:he.length>0?"jer-empty-string":void 0}):`${ye}:`}),ut=nt&&t(ee,{startEdit:fe?()=>{Te.current=!0,b(he)}:void 0,handleAdd:je?e=>{ue(!1);const t=Re(me,e);if("array"===Ge){const e=J.array?0:j.length,n=J.array?{insert:!0}:{};S(t,[...he,e],n).then((e=>{e&&Ce({code:"ADD_ERROR",message:e},t)}))}else if(e in j)Ce({code:"KEY_EXISTS",message:W("ERROR_KEY_EXISTS",me)},e);else{const n=J.object?{insertBefore:0}:{};S(t,[...he,e],n).then((e=>{e&&Ce({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:ve?Je:void 0,enableClipboard:z,type:Ge,nodeData:me,translate:W,customButtons:r.customButtons,keyboardControls:Y,handleKeyboard:$}),pt=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===he.length?0:K/2)+"em"},o("collection",me)),{position:"relative"}),draggable:Ee},Se,Ne("above"),{children:[t("div",{className:"jer-clickzone",style:{width:K/2+1+"em",zIndex:10+2*me.level},onClick:e=>Ye(e)}),!Ze&&xe,t(Ae,{position:"above",nodeData:me}),Be?e("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:e=>Ye(e),children:[e("div",{className:"jer-collection-name",children:[t("div",{className:"jer-collapse-icon jer-accordion-icon"+(de?" jer-rotate-90":""),style:{zIndex:11+2*me.level},onClick:e=>Ye(e),children:t(q,{name:"chevron",rotate:de,nodeData:me})}),dt,!Ze&&t("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",me),children:Ue.open})]}),!Ze&&tt&&t("div",{className:"jer-collection-item-count"+(tt?" jer-visible":" jer-hidden"),style:o("itemCount",me),children:1===be?W("ITEM_SINGLE",Object.assign(Object.assign({},me),{size:1}),1):W("ITEMS_MULTIPLE",me,be)}),t("div",{className:"jer-brackets"+(lt?" jer-visible":" jer-hidden"),style:o("bracket",me),children:Ue.close}),ut]}):Ke?t(n,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[dt,ut]}),e("div",{className:"jer-collection-inner",style:Object.assign({overflowY:lt||re?"clip":"visible",maxHeight:We?void 0:ce},o("collectionInner",me)),ref:ne,children:[ct,t("div",{className:Ze?"jer-collection-error-row":"jer-collection-error-row-edit",children:De&&t("span",{className:"jer-error-slug",style:o("error",me),children:De})}),!Ze&&Be&&t("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},o("bracket",me)),{marginLeft:(K<3?-1:K<6?-.5:0)+"em"}),children:Ue.close})]}),t(Ae,{position:"below",nodeData:me})]}));return Fe?t(Fe,Object.assign({customNodeProps:Me},st,{children:pt})):pt},ge={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"},me=(e,t)=>(n,r,o)=>((e,t,n,r,o)=>{if(t[r]){const e=t[r](n);if(null!==e)return e}const a=r in e?e[r]:ge[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,t,r,n,o);var he=[],ye=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,a="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var i=he.indexOf(a);-1===i&&(i=he.push(a)-1,ye[i]={}),n=ye[i]&&ye[i][r]?ye[i][r]:ye[i][r]=l()}else n=l();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function l(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-expand-transition-time:0.3s;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden,.jer-visible{transition:var(--jer-expand-transition-time)}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative;transition:var(--jer-expand-transition-time)}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:transform var(--jer-expand-transition-time)}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-accordion-icon,.jer-rotate-90{transition:transform var(--jer-expand-transition-time)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string:after{content:"<empty string>:";font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}',{});const be=({data:e,setData:n,rootName:r="root",onUpdate:o=(()=>{}),onEdit:d=o,onDelete:u=o,onAdd:g=o,onChange:h,onError:y,showErrorMessages:b=!0,enableClipboard:f=!0,indent:v=2,collapse:j=!1,collapseAnimationTime:E=300,showCollectionCount:w=!0,restrictEdit:k=!1,restrictDelete:O=!1,restrictAdd:S=!1,restrictTypeSelection:N=!1,restrictDrag:x=!0,searchFilter:A,searchText:T,searchDebounceTime:R=350,keySort:V=!1,showArrayIndices:z=!0,showStringQuotes:F=!0,defaultValue:M=null,minWidth:K=250,maxWidth:I="min(600px, 90vw)",rootFontSize:L,stringTruncate:B=250,translations:W={},className:G,id:U,customText:H={},customNodeDefinitions:Y=[],customButtons:$=[],jsonParse:J=JSON.parse,jsonStringify:X=(e=>JSON.stringify(e,null,2)),errorMessageTimeout:Z=2500,keyboardControls:Q={},insertAtTop:q=!1})=>{const{getStyles:ee}=P(),{setCurrentlyEditingElement:te}=_(),ne=c(je(j),[j]),re=c(me(W,H),[W,H]),[oe,ae]=a(T),[ie,le]=(({setData:e,data:t})=>{const[n,r]=a(e?void 0:t),o=c((t=>{e?e(t):r(t)}),[e]);return l((()=>{e||r(t)}),[t]),[e?t:n,o]})({setData:n,data:e}),ce=i(null);l((()=>{te(null);const e=setTimeout((()=>ae(T)),R);return()=>clearTimeout(e)}),[T,R]);const de={key:r,path:[],level:0,index:0,value:ie,size:"object"==typeof ie&&null!==ie?Object.keys(ie).length:1,parentData:null,fullData:ie},ue=(e,t)=>p(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void le(t.newData);const r=De(n)?n:["error",n],[o,a]=r;if("error"===o)return le(t.currentData),!1===a?re("ERROR_UPDATE",de):String(a);le(a)})),ge=s((()=>je(k)),[k]),he=s((()=>je(O)),[O]),ye=s((()=>je(S)),[S]),be=s((()=>je(x)),[x]),fe=s((()=>Ee(A)),[A]),we=s((()=>(e=>{const t=Object.assign({},C);for(const n of Object.keys(C)){const r=n;if(e[r]){const o=e[r],a=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(o)?o:[o]:"string"==typeof o?{key:o}:o;t[r]=a,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})(Q)),[Q]),Ce=c(((e,t)=>((e,t,n)=>{const r=Object.entries(t);for(const[t,o]of r)if(D(n,e[t],t)){n.preventDefault(),o();break}})(we,t,e)),[Q]),ke=c(((e,t)=>{!1!==V&&("function"!=typeof V?e.sort(((e,n)=>{const r=t(e)[0],o=t(n)[0];return r<o?-1:r>o?1:0})):e.sort(((e,n)=>V(t(e),t(n)))))}),[V]),Oe={mainContainerRef:ce,name:r,nodeData:de,onEdit:(e,t)=>p(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=ve(ie,t,e,"update");if(o!==a)return yield ue(d,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>p(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=ve(ie,t,e,"delete");return yield ue(u,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:a,newValue:i}=ve(ie,t,e,"add",n);return yield ue(g,{currentData:r,newData:o,currentValue:a,newValue:i,name:t.slice(-1)[0],path:t})})),onChange:h,onError:y,showErrorMessages:b,onMove:(e,t,n)=>p(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=ve(ie,e,"","delete"),i=e.slice(-1)[0],l=t.slice(0,-1),s=t.slice(-1)[0];let c="number"==typeof s?"above"===n?s:s+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof c&&i<c&&(c-=1);const u="number"==typeof c?{insert:!0}:"above"===n?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=ve(o,[...l,c],a,"add",u);return yield ue(d,{currentData:r,newData:p,currentValue:a,newValue:g,name:t.slice(-1)[0],path:t})})),showCollectionCount:w,collapseFilter:ne,collapseAnimationTime:E,restrictEditFilter:ge,restrictDeleteFilter:he,restrictAddFilter:ye,restrictTypeSelection:N,restrictDragFilter:be,canDragOnto:!1,searchFilter:fe,searchText:oe,enableClipboard:f,keySort:V,sort:ke,showArrayIndices:z,showStringQuotes:F,indent:v,defaultValue:M,stringTruncate:B,translate:re,customNodeDefinitions:Y,customButtons:$,parentData:null,jsonParse:J,jsonStringify:X,errorMessageTimeout:Z,handleKeyboard:Ce,keyboardControls:we,insertAtTop:{object:!0===q||"object"===q,array:!0===q||"array"===q}},Se=Object.assign(Object.assign({},ee("container",de)),{minWidth:K,maxWidth:I});return Se.fontSize=null!=L?L:Se.fontSize,t("div",{id:U,ref:ce,className:`jer-editor-container ${null!=G?G:""}`,style:Se,children:m(ie)?t(pe,Object.assign({data:ie},Oe)):t(se,Object.assign({data:ie,showLabel:!0},Oe))})},fe=e=>{var n;const[r,o]=a();l((()=>{const e=document.documentElement;o(e)}),[]);const{collapseAnimationTime:i=300}=e;if(!r)return null;const s=getComputedStyle(r).getPropertyValue("--jer-expand-transition-time");return 1e3*parseFloat(s)!==i&&r.style.setProperty("--jer-expand-transition-time",i/1e3+"s"),t(T,{theme:null!==(n=e.theme)&&void 0!==n?n:x,icons:e.icons,docRoot:r,children:t(K,{children:t(be,Object.assign({},e))})})},ve=(e,t,n,r,o={})=>{if(0===t.length)return{currentData:e,newData:n,currentValue:e,newValue:n};const a=Object.assign({remove:"delete"===r},o),i="add"!==r?u(e,t):void 0;return{currentData:e,newData:d(e,t,n,a),currentValue:i,newValue:"delete"!==r?n:void 0}},je=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,Ee=e=>{if(void 0!==e)return"value"===e?b:"key"===e?f:"all"===e?(e,t)=>b(e,t)||f(e,t):e},De=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),we=({value:n,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 t("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:n,target:"_blank",rel:"noreferrer",style:{color:null!==(s=d.color)&&void 0!==s?s:void 0},children:['"',v(n,c),'"']})})},Ce={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:we,showOnView:!0,showOnEdit:!1},ke={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)"}},Oe={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"}},Se={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"}},Ne={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"}},xe={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"}},Ae={displayName:"Psychedelic",fragments:{pale:{color:"#A8DADC"},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"}};export{H as IconAdd,Z as IconCancel,Q as IconChevron,J as IconCopy,$ as IconDelete,Y as IconEdit,X as IconOk,fe as JsonEditor,we as LinkCustomComponent,Ce as LinkCustomNodeDefinition,xe as candyWrapperTheme,x as defaultTheme,ke as githubDarkTheme,Oe as githubLightTheme,m as isCollection,b as matchNode,f as matchNodeKey,Se as monoDarkTheme,Ne as monoLightTheme,Ae as psychedelicTheme,v as truncate}; | ||
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createContext as r,useContext as o,useState as a,useRef as i,useEffect as l,useMemo as s,useCallback 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,t,n,r){return new(n||(n=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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}s((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const g=({className:n,name:r,value:o,setValue:a,handleKeyPress:i,styles:l,textAreaRef:s})=>{if("string"!=typeof o)return null;const c="\n"===o.slice(-1)?o+".":o;return e("div",{style:{display:"grid"},children:[t("textarea",{id:`${r}_textarea`,ref:s,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},l),rows:1,className:n,name:`${r}_textarea`,value:o,onChange:e=>a(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:i}),t("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"},l),children:c})]})},m=e=>null!==e&&"object"==typeof e,h=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!y(r,t,n))return!1}if(!n&&r&&!y(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!b(t,r))return!1}return!0},y=(e="",t,n=b)=>{const r=t.value;return Object.entries(r).some((([o,a])=>{const i=[...t.path,o],l=Object.assign(Object.assign({},t),{key:o,path:i,level:t.level+1,value:a,size:i.length,parentData:r});return m(a)?y(e,l,n):n(l,e)}))},b=(e,t="")=>{const{value:n}=e;if(null===n&&"null".includes(t.toLowerCase()))return!0;switch(typeof n){case"string":return n.toLowerCase().includes(t.toLowerCase());case"number":return!!String(n).includes(t);case"boolean":return n?"true".includes(t.toLowerCase())||"1"===t:"false".includes(t.toLowerCase())||"0"===t;default:return!1}},f=({key:e,path:t},n="")=>!!b({value:e},n)||!!t.some((e=>b({value:e},n))),v=(e,t=200)=>"string"==typeof e?e.length<t?e:`${e.slice(0,t-2).trim()}...`:e,j=(e,t)=>(null!=t?t:"")+e.map((e=>""===e?String.fromCharCode(0):e)).join("."),E=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,D=(e,t,n)=>{const r=e.key,o=E(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:a,modifier:i}=t;return("stringLineBreak"!==n||"Enter"!==r||"Shift"!==o||"Enter"!==a||!(null==i?void 0:i.includes("Shift")))&&(r===a&&(i===o||Array.isArray(i)&&i.includes(o)))},w={key:"Enter"},k={confirm:w,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},w),{modifier:["Meta","Shift","Control"]}),objectLineBreak:w,stringConfirm:w,stringLineBreak:Object.assign(Object.assign({},w),{modifier:["Shift"]}),numberConfirm:w,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:w,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},C=(e,t,n="next",r)=>{const o=t.slice(0,t.length-1),a=t.slice(-1)[0];if(void 0===a)return null;const i=u(e,o),l=S(i);Array.isArray(i)||r(l,(({key:e,value:t})=>[e,t]));const s=l.findIndex((e=>e.key===a)),c=l[s+("next"===n?1:-1)];return c?m(c.value)?0===Object.keys(c.value).length?C(e,[...o,c.key],n,r):O(e,[...o,c.key],n,r):[...o,c.key]:0===o.length?null:C(e,o,n,r)},O=(e,t,n="next",r)=>{const o=u(e,t);if(!m(o))return t;const a=Array.isArray(o)?o.map(((e,t)=>t)):Object.keys(o);r(a,(e=>[e,o]));const i="next"===n?a[0]:a[a.length-1];return O(e,[...t,i],n,r)},S=e=>Array.isArray(e)?e.map(((e,t)=>({index:t,value:e,key:t}))):Object.entries(e).map((([e,t],n)=>({key:e,value:t,index:n}))),N=(e,t)=>{var n,r,o,a;const i=e.current,l=null!==(n=null==i?void 0:i.selectionStart)&&void 0!==n?n:1/0,s=null!==(r=null==i?void 0:i.selectionEnd)&&void 0!==r?r:1/0,c=(null===(o=null==i?void 0:i.textContent)||void 0===o?void 0:o.slice(0,l))+t+(null===(a=null==i?void 0:i.textContent)||void 0===a?void 0:a.slice(s));return i.value=c,null==i||i.setSelectionRange(l+1,l+1),c},x={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)"}},A=r({getStyles:()=>({}),icons:{}}),T=({theme:e=x,icons:n={},docRoot:r,children:o})=>{const a=R(e,r);return t(A.Provider,{value:{getStyles:(e,t)=>"function"==typeof a[e]?a[e](t):a[e],icons:n},children:o})},P=()=>o(A),R=(e,t)=>{var n,r,o,a;const i={},l=(Array.isArray(e)?e:[e]).map((e=>z(e)?V({fragments:{},styles:e},i):V(e,i))),s=V(x,{});Object.keys(s).forEach((e=>{const t=e;l.forEach((e=>{e[t]&&(s[t]=Object.assign(Object.assign({},s[t]),e[t]))}))}));const c=Object.assign({},s);return Object.entries(i).forEach((([e,t])=>{const n=e;c[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},s[n]),r)}})),"function"!=typeof(null==c?void 0:c.inputHighlight)&&(null===(n=null==c?void 0:c.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",null===(r=null==c?void 0:c.inputHighlight)||void 0===r?void 0:r.backgroundColor),"function"!=typeof(null==c?void 0:c.iconCopy)&&(null===(o=null==c?void 0:c.iconCopy)||void 0===o?void 0:o.color)&&t.style.setProperty("--jer-icon-copy-color",null===(a=null==c?void 0:c.iconCopy)||void 0===a?void 0:a.color),c},V=(e,t)=>{const{fragments:n,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a,i;if("function"==typeof o)return t[e]=o,Object.assign({},r);if("string"==typeof o){const t=null!==(a=null==n?void 0:n[o])&&void 0!==a?a:o;return"string"==typeof t?Object.assign(Object.assign({},r),{[null!==(i=F[e])&&void 0!==i?i:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},z=e=>!("styles"in e),F={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},M=r({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},previouslyEditedElement:null,setPreviouslyEditedElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{},tabDirection:"next",setTabDirection:()=>{}}),K=({children:e})=>{const[n,r]=a(null),[o,l]=a(null),[s,c]=a({path:null,pathString:null}),d=i(null),u=i("next"),p=i(null);return t(M.Provider,{value:{collapseState:n,setCollapseState:e=>{r(e),null!==e&&setTimeout((()=>r(null)),2e3)},doesPathMatch:e=>{if(null===n)return!1;for(const[t,r]of n.path.entries())if(r!==e[t])return!1;return!0},currentlyEditingElement:o,setCurrentlyEditingElement:(e,t)=>{const n="string"==typeof e||null===e?e:j(e,"key"===t?"key_":void 0);null!==o&&null!==n&&null!==d.current&&d.current(),l(n),d.current="function"==typeof t?t:null},areChildrenBeingEdited:e=>null!==o&&o.includes(e),previouslyEditedElement:p.current,setPreviouslyEditedElement:e=>{p.current=e},tabDirection:u.current,setTabDirection:e=>{u.current=e},dragSource:s,setDragSource:c},children:e})},_=()=>o(M),I="**INVALID_FUNCTION**",L=({value:n,setValue:r,isEditing:o,path:a,setIsEditing:l,handleEdit:s,stringTruncate:c,showStringQuotes:d,nodeData:u,handleKeyboard:p,keyboardCommon:m})=>{const{getStyles:h}=P(),y=i(null),b=j(a),f=d?'"':"";return o?t(g,{className:"jer-input-text",textAreaRef:y,name:b,value:n,setValue:r,isEditing:o,handleKeyPress:e=>{p(e,Object.assign({stringConfirm:s,stringLineBreak:()=>{const e=N(y,"\n");r(e)}},m))},styles:h("input",u)}):e("div",{id:`${b}_display`,onDoubleClick:()=>l(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&l(!0)},className:"jer-value-string",style:h("string",u),children:[f,v(n,c),f]})},B=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:l,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=P();return r?t("input",{className:"jer-input-number",type:"text",name:j(o),value:e,onChange:e=>n(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:t=>s(t,Object.assign({numberConfirm:i,numberUp:()=>n(Number(e)+1),numberDown:()=>n(Number(e)-1)},c)),style:Object.assign({width:String(e).length/1.5+2+"em"},d("input",l))}):t("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",l),children:e})},W=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:l,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=P();return r?t("input",{className:"jer-input-boolean",type:"checkbox",name:j(o),checked:e,onChange:()=>n(!e),onKeyDown:t=>{" "===t.key&&t.preventDefault(),s(t,Object.assign({booleanConfirm:i,booleanToggle:()=>n(!e)},c))},autoFocus:!0}):t("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",l),children:String(e)})},G=({value:e,isEditing:n,setIsEditing:r,handleEdit:o,nodeData:a,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=P(),u=i();l((()=>{if(n)return u.current=window.setTimeout((()=>window.addEventListener("keydown",p)),100),()=>window.removeEventListener("keydown",p);window.clearTimeout(u.current)}),[n]);const p=e=>s(e,Object.assign({confirm:o},c));return t("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:d("null",a),children:String(e)})},U=({value:e})=>{let n="Error!";switch(typeof e){case"string":e===I&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return t("span",{className:"jer-value-invalid",children:n})},H=({size:n,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:o,style:r,children:[t("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),t("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"})]}),Y=({size:n,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:o,style:r,transform:"translate(0, 0.5)",children:[t("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"}),t("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"})]}),$=({size:e,style:n,className:r})=>t("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),J=({size:n,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:o,style:r,children:[t("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"}),t("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),t("path",{d:"M15 10l-4 4 4 4"})]}),X=({size:n,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:o,style:r,children:[t("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),t("path",{d:"M22 4L12 14.01l-3-3"})]}),Z=({size:e,style:n,className:r})=>t("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),Q=({size:e,style:n,className:r})=>t("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),q=({name:e,nodeData:r,rotate:o})=>{var a,i,l,s,c,d,u;const{getStyles:p,icons:g}=P(),m={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(a=null==g?void 0:g.add)&&void 0!==a?a:t(H,Object.assign({},m,{style:p("iconAdd",r)}));case"edit":return null!==(i=null==g?void 0:g.edit)&&void 0!==i?i:t(Y,Object.assign({},m,{style:p("iconEdit",r)}));case"delete":return null!==(l=null==g?void 0:g.delete)&&void 0!==l?l:t($,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:t(J,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:t(X,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:t(Z,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:t(Q,{size:"1em",style:p("iconCollection",r)});default:return t(n,{})}},ee=({startEdit:r,handleDelete:o,handleAdd:i,enableClipboard:l,type:s,customButtons:c,nodeData:d,translate:u,keyboardControls:p,handleKeyboard:g})=>{const{getStyles:m}=P(),h=u("KEY_NEW",d),[y,b]=a(!1),[f,v]=a(h),{key:j,path:D,value:w}=d;return e("div",{className:"jer-edit-buttons",style:{opacity:y?1:void 0},children:[l&&t("div",{onClick:e=>{e.stopPropagation();let t,n="value",r="";if(l){const o=E(e);o&&p.clipboardModifier.includes(o)?(t=ne(D),r=t,n="path"):(t=w,r=s?JSON.stringify(w,null,2):String(t)),navigator.clipboard.writeText(r)}"function"==typeof l&&l({value:t,stringValue:r,path:D,key:j,type:n})},className:"jer-copy-pulse",children:t(q,{name:"copy",nodeData:d})}),r&&t("div",{onClick:e=>{e.stopPropagation(),r()},children:t(q,{name:"edit",nodeData:d})}),o&&t("div",{onClick:e=>{e.stopPropagation(),o()},children:t(q,{name:"delete",nodeData:d})}),i&&t("div",{onClick:e=>{e.stopPropagation(),"object"===s?b(!0):i("")},children:t(q,{name:"add",nodeData:d})}),null==c?void 0:c.map((({Element:e,onClick:n},r)=>t("div",{onClick:e=>n&&n(d,e),children:t(e,{nodeData:d})},r))),y&&i&&"object"===s&&e(n,{children:[t("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:f,onChange:e=>v(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{g(e,{stringConfirm:()=>{i&&(b(!1),i(f),v(h))},cancel:()=>{b(!1),v(h)}})},style:m("input",d)}),t(te,{onOk:e=>{f&&(e.stopPropagation(),b(!1),i(f))},onCancel:e=>{e.stopPropagation(),b(!1)},nodeData:d})]})]})},te=({onOk:n,onCancel:r,nodeData:o})=>e("div",{className:"jer-confirm-buttons",children:[t("div",{onClick:n,children:t(q,{name:"ok",nodeData:o})}),t("div",{onClick:r,children:t(q,{name:"cancel",nodeData:o})})]}),ne=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),re=["string","number","boolean","null","object","array"],oe=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[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,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(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)},ae=({props:e,collapsed:t})=>{const{data:n,nodeData:r,parentData:o,onEdit:i,onError:l,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:m,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:b}=_(),[f,v]=a(null),E=Object.assign(Object.assign({},r),{collapsed:t}),{path:D,key:w,size:k}=E,C=j(D),O=s((()=>!d(E)),[E]),S=s((()=>!u(E)),[E]),N=s((()=>!p(E)),[E]),x=s((()=>!g(E)&&S&&null===y),[E]),A=e=>{c&&(v(e),setTimeout((()=>v(null)),h)),console.warn("Error",e)},T=s((()=>(e,t)=>{A(e.message),l&&l({currentData:E.fullData,errorValue:t,currentValue:n,name:w,path:D,error:e})}),[l,c]),P=y===C,R=y===`key_${C}`,V="number"==typeof D.slice(-1)[0];return{pathString:C,nodeData:E,path:D,name:w,size:k,canEdit:O,canDelete:S,canAdd:N,canDrag:x,error:f,showError:A,onError:T,setError:v,handleEditKey:e=>{if(b(null),w===e)return;if(!o)return;const t=D.slice(0,-1);if(Object.keys(o).includes(e))return void T({code:"KEY_EXISTS",message:m("ERROR_KEY_EXISTS",E)},e);const n=Object.fromEntries(Object.entries(o).map((([t,n])=>t===w?[e,n]:[t,n])));i(n,t).then((t=>{t&&T({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:{isEditing:P,isEditingKey:R,isArray:V,canEditKey:null!==o&&O&&N&&S&&!V}}},ie=({canDrag:e,canDragOnto:n,path:r,nodeData:o,onMove:i,onError:l,translate:c})=>{const{getStyles:d}=P(),{dragSource:u,setDragSource:p}=_(),[g,m]=a(!1),h=j(r),y=s((()=>e?{onDragStart:e=>{e.stopPropagation(),p({path:r,pathString:h})},onDragEnd:e=>{e.stopPropagation(),p({path:null,pathString:null})}}:{}),[e]),b=s((()=>e=>n?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:t=>{t.stopPropagation(),v(e),p({path:null,pathString:null}),m(!1)},onDragEnter:t=>{var n;t.stopPropagation(),h.startsWith(null!==(n=u.pathString)&&void 0!==n?n:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[u,n]),f=s((()=>n&&null!==u.pathString?t("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:r.length}},b("below"))):null),[u,n]),v=e=>{var t,n;const a=null===(t=u.path)||void 0===t?void 0:t.slice(-1)[0],s=null===(n=u.path)||void 0===n?void 0:n.slice(0,-1).join("."),d=r.slice(0,-1).join(""),{parentData:p}=o;"string"==typeof a&&p&&!Array.isArray(p)&&Object.keys(p).includes(a)&&a in p&&s!==d?l({code:"KEY_EXISTS",message:c("ERROR_KEY_EXISTS",o)},a):i(u.path,r,e).then((e=>{e&&l({code:"UPDATE_ERROR",message:e},o.value)}))};return{dragSourceProps:y,getDropTargetProps:b,BottomDropTarget:f,DropTargetPadding:({position:e,nodeData:n})=>g===e?t("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",n)}):null,handleDrop:v}},le=(e,t,n)=>{var r,o,a;const i=parseInt(null!==(r=getComputedStyle(n.current).getPropertyValue("line-height"))&&void 0!==r?r:"16px"),l=(null!==(a=null===(o=t.current)||void 0===o?void 0:o.offsetWidth)&&void 0!==a?a:0)/(.5*i),s=JSON.stringify(e,null,2).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/l))).reduce(((e,t)=>e+t),0)*i;return Math.min(s+30,window.innerHeight-50)},se=n=>{const{data:r,parentData:o,onEdit:i,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:m,restrictTypeSelection:y,searchFilter:b,searchText:f,showLabel:v,stringTruncate:j,showStringQuotes:E,indent:D,translate:w,customNodeDefinitions:k,handleKeyboard:O,keyboardControls:S,sort:N}=n,{getStyles:x}=P(),{setCurrentlyEditingElement:A,setCollapseState:T,previouslyEditedElement:R,setPreviouslyEditedElement:V,tabDirection:z,setTabDirection:F}=_(),[M,K]=a("function"==typeof r?I:r),{pathString:L,nodeData:B,path:W,name:G,canEdit:U,canDelete:H,canDrag:Y,error:$,onError:J,handleEditKey:X,derivedValues:Z}=ae({props:n}),{dragSourceProps:Q,getDropTargetProps:q,BottomDropTarget:ne,DropTargetPadding:le}=ie({canDrag:Y,canDragOnto:m,path:W,nodeData:B,onMove:p,onError:J,translate:w}),se=oe(k,B),[pe,ge]=a(ce(r,se)),me=c((e=>{if(!u)return void K(e);const t=u({currentData:B.fullData,newValue:e,currentValue:M,name:G,path:W});K(t)}),[u]);l((()=>{K("function"==typeof r?I:r),ge(ce(r,se))}),[r,$]);const{CustomNode:he,customNodeProps:ye,hideKey:be,showEditTools:fe=!0,showOnEdit:ve,showOnView:je}=se,Ee=[...re,...k.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],De=s((()=>{if("boolean"==typeof y)return y?[]:Ee;if(Array.isArray(y))return y;const e=y(B);return"boolean"==typeof e?e?[]:Ee:e}),[B,y]),{isEditing:we}=Z,ke=h("value",B,b,f);if(we&&(!ke||!U)){const e=C(B.fullData,W,z,N);A(e||R)}if(!ke)return null;const Ce=()=>{let e;switch(A(null),pe){case"object":e={[w("DEFAULT_NEW_KEY",B)]:M};break;case"array":e=null!=M?M:[];break;case"number":{const t=Number(M);e=isNaN(t)?0:t;break}default:e=M}i(e,W).then((t=>{t&&J({code:"UPDATE_ERROR",message:t},e)}))},Oe=()=>{A(null),K(r),ge(ce(r,se))},{isEditingKey:Se,canEditKey:Ne}=Z,xe=!we&&$,Ae=we&&De.length>0,Te="invalid"!==pe&&!$&&fe,Pe=v&&Se,Re=v&&!Se&&!be,Ve={value:M,parentData:o,setValue:me,isEditing:we,setIsEditing:U?()=>A(W):()=>{},handleEdit:Ce,handleCancel:Oe,path:W,stringTruncate:j,showStringQuotes:E,nodeData:B,translate:w,handleKeyboard:O,keyboardCommon:{cancel:Oe,tabForward:()=>{F("next"),V(L);const e=C(B.fullData,W,"next",N);e&&(Ce(),A(e))},tabBack:()=>{F("prev"),V(L);const e=C(B.fullData,W,"prev",N);e&&(Ce(),A(e))}}},ze=he&&(we&&ve||!we&&je)?t(he,Object.assign({},n,{value:M,customNodeProps:ye,setValue:me,handleEdit:Ce,handleCancel:Oe,handleKeyPress:e=>O(e,{stringConfirm:Ce,cancel:Oe}),isEditing:we,setIsEditing:()=>A(W),getStyles:x})):de(ce(r),Ve);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:D/2+"em",position:"relative"},draggable:Y},Q,q("above"),{children:[ne,t(le,{position:"above",nodeData:B}),e("div",{className:"jer-value-main-row",style:{flexWrap:G.length>10?"wrap":"nowrap"},children:[Re&&t("span",{className:"jer-key-text",style:Object.assign(Object.assign({},x("property",B)),{minWidth:`${Math.min(String(G).length+1,5)}ch`,flexShrink:G.length>10?1:0}),onDoubleClick:()=>Ne&&A(W,"key"),children:""===G?t("span",{className:W.length>0?"jer-empty-string":void 0}):`${G}:`}),Pe&&t("input",{className:"jer-input-text jer-key-edit",type:"text",name:L,defaultValue:G,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>O(e,{stringConfirm:()=>X(e.target.value),cancel:Oe,tabForward:()=>{X(e.target.value),A(W)},tabBack:()=>{X(e.target.value),A(C(B.fullData,W,"prev",N))}}),style:{width:String(G).length/1.5+.5+"em"}}),e("div",{className:"jer-value-and-buttons",children:[t("div",{className:"jer-input-component",children:ze}),we?t(te,{onOk:Ce,onCancel:Oe,nodeData:B}):Te&&t(ee,{startEdit:U?()=>A(W,Oe):void 0,handleDelete:H?()=>{d(M,W).then((e=>{e&&J({code:"DELETE_ERROR",message:e},M)}))}:void 0,enableClipboard:g,translate:w,customButtons:n.customButtons,nodeData:B,handleKeyboard:O,keyboardControls:S}),Ae&&e("div",{className:"jer-select",children:[t("select",{name:`${G}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const t=k.find((t=>t.name===e));if(t)i(t.defaultValue,W),ge(e),A(null),T({path:W,collapsed:!1});else{const t=ue(M,e,w("DEFAULT_NEW_KEY",B),(null==se?void 0:se.CustomNode)?w("DEFAULT_STRING",B):void 0);me(t),i(t,W).then((e=>{e&&(J({code:"UPDATE_ERROR",message:e},t),A(null))}))}})(e.target.value),value:pe,children:De.map((e=>t("option",{value:e,children:e},e)))}),t("span",{className:"focus"})]}),xe&&t("span",{className:"jer-error-slug",style:x("error",B),children:$})]})]}),t(le,{position:"below",nodeData:B})]}))},ce=(e,t)=>(null==t?void 0:t.CustomNode)&&(null==t?void 0:t.name)&&t.showInTypesSelector?t.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",de=(e,n)=>{const r=n.value;switch(e){case"string":return t(L,Object.assign({},n,{value:r}));case"number":return t(B,Object.assign({},n,{value:r}));case"boolean":return t(W,Object.assign({},n,{value:r}));case"null":return t(G,Object.assign({},n));default:return t(U,Object.assign({},n))}},ue=(e,t,n,r)=>{switch(t){case"string":return null!=r?r:String(e);case"number":{const t=Number(e);return isNaN(t)?0:t}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},pe=r=>{const{getStyles:o}=P(),{collapseState:c,setCollapseState:d,doesPathMatch:u,currentlyEditingElement:y,setCurrentlyEditingElement:b,areChildrenBeingEdited:f}=_(),{mainContainerRef:v,data:j,nodeData:D,parentData:w,showCollectionCount:k,onEdit:O,onAdd:S,onDelete:x,canDragOnto:A,collapseFilter:T,collapseAnimationTime:R,onMove:V,enableClipboard:z,searchFilter:F,searchText:M,indent:K,sort:I,showArrayIndices:L,defaultValue:B,translate:W,customNodeDefinitions:G,jsonParse:U,jsonStringify:H,keyboardControls:Y,handleKeyboard:$,insertAtTop:J}=r,[X,Z]=a(H(j)),Q=T(D),{contentRef:ne,isAnimating:re,maxHeight:ce,collapsed:de,animateCollapse:ue}=((e,t,n,r)=>{const[o,l]=a(n?0:void 0),[s,c]=a(n),d=i(!1),u=i(null),p=i(0),g=i();return{contentRef:u,isAnimating:d.current,animateCollapse:n=>{var o,a;if(s!==n){switch(window.clearTimeout(g.current),d.current=!0,n){case!0:{const e=null!==(a=null===(o=u.current)||void 0===o?void 0:o.offsetHeight)&&void 0!==a?a:0;p.current=e,l(e),setTimeout((()=>{l(0)}),5);break}case!1:l(p.current||le(e,u,r))}c(!s),g.current=window.setTimeout((()=>{d.current=!1,n||l(void 0)}),t)}},maxHeight:o,collapsed:s}})(j,R,Q,v),{pathString:ge,nodeData:me,path:he,name:ye,size:be,canEdit:fe,canDelete:ve,canAdd:je,canDrag:Ee,error:De,setError:we,onError:ke,handleEditKey:Ce,derivedValues:Oe}=ae({props:r,collapsed:de}),{dragSourceProps:Se,getDropTargetProps:Ne,BottomDropTarget:xe,DropTargetPadding:Ae}=ie({canDrag:Ee,canDragOnto:A,path:he,nodeData:me,onMove:V,onError:ke,translate:W}),Te=i(!Q);l((()=>{Z(H(j))}),[j]),l((()=>{const e=T(me)&&!Oe.isEditing;Te.current=!e,ue(e)}),[T]),l((()=>{null!==c&&u(he)&&(Te.current=!0,ue(c.collapsed))}),[c]);const Pe=i(null),Re=s((()=>(e,t)=>"function"!=typeof B?B:B(e,t)),[B]),{CustomNode:Ve,customNodeProps:ze,CustomWrapper:Fe,wrapperProps:Me={},hideKey:Ke,showEditTools:_e=!0,showOnEdit:Ie,showOnView:Le,showCollectionWrapper:Be=!0}=s((()=>oe(G,me)),[]),We=f(ge);We&&de&&ue(!1);if(!(h("collection",me,F,M)||0===me.level)&&!We)return null;const Ge=Array.isArray(j)?"array":"object",Ue="array"===Ge?{open:"[",close:"]"}:{open:"{",close:"}"},He=e=>{if("Tab"!==e.key||e.getModifierState("Shift"))$(e,{objectConfirm:$e,cancel:Xe});else{e.preventDefault();const t=N(Pe,"\t");Z(t)}},Ye=e=>{const t=E(e);if(t&&Y.collapseModifier.includes(t))return Te.current=!0,void d({collapsed:!de,path:he});y&&y.includes(ge)||(Te.current=!0,d(null),ue(!de))},$e=()=>{try{const e=U(X);if(b(null),we(null),JSON.stringify(e)===JSON.stringify(j))return;O(e,he).then((t=>{t&&ke({code:"UPDATE_ERROR",message:t},e)}))}catch(e){ke({code:"INVALID_JSON",message:W("ERROR_INVALID_JSON",me)},X)}},Je=he.length>0?()=>{x(j,he).then((e=>{e&&ke({code:"DELETE_ERROR",message:e},j)}))}:void 0,Xe=()=>{b(null),we(null),Z(H(j))},{isEditing:Ze,isEditingKey:Qe,isArray:qe,canEditKey:et}=Oe,tt="when-closed"===k?de:k,nt=!Ze&&_e,rt=(L||!qe)&&!Ke&&void 0!==ye,ot=Ve&&(Ze&&Ie||!Ze&&Le),at=Object.entries(j).map((([e,t])=>["array"===Ge?Number(e):e,t]));"object"===Ge&&I(at,(e=>e));const it=Te.current?Ze?t("div",{className:"jer-collection-text-edit",children:e("div",{children:[t(g,{textAreaRef:Pe,className:"jer-collection-text-area",name:ge,value:X,setValue:Z,isEditing:Ze,handleKeyPress:He,styles:o("input",me)}),t("div",{className:"jer-collection-input-button-row",children:t(te,{onOk:$e,onCancel:Xe,nodeData:me})})]})}):at.map((([e,n],a)=>{const i={key:e,value:n,path:[...he,e],level:he.length+1,index:a,size:m(n)?Object.keys(n).length:1,parentData:j,fullData:me.fullData};return t("div",{className:"jer-collection-element",style:o("collectionElement",i),children:m(n)?t(pe,Object.assign({},r,{data:n,parentData:j,nodeData:i,showCollectionCount:k,canDragOnto:fe}),e):t(se,Object.assign({},r,{data:n,parentData:j,nodeData:i,canDragOnto:fe,showLabel:"object"===Ge||L}),e)},e)})):null,lt=!!Be&&(de&&!We);lt||(Te.current=!0);const st=Object.assign(Object.assign({},r),{data:j,value:j,parentData:w,nodeData:me,setValue:e=>p(void 0,void 0,void 0,(function*(){return yield O(e,he)})),handleEdit:$e,handleCancel:Xe,handleKeyPress:He,isEditing:Ze,setIsEditing:()=>b(he),getStyles:o,canDragOnto:fe}),ct=ot?t(Ve,Object.assign({customNodeProps:ze},st,{children:it})):it,dt=Qe?t("input",{className:"jer-input-text jer-key-edit",type:"text",name:ge,defaultValue:ye,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>$(e,{stringConfirm:()=>Ce(e.target.value),cancel:Xe,tabForward:()=>{Ce(e.target.value);const t=null==at?void 0:at[0][0];b(t?[...he,t]:C(me.fullData,he,"next",I))},tabBack:()=>{Ce(e.target.value),b(C(me.fullData,he,"prev",I))}}),style:{width:String(ye).length/1.5+.5+"em"}}):rt&&t("span",{className:"jer-key-text",style:o("property",me),onClick:e=>e.stopPropagation(),onDoubleClick:()=>et&&b(he,"key"),children:""===ye?t("span",{className:he.length>0?"jer-empty-string":void 0}):`${ye}:`}),ut=nt&&t(ee,{startEdit:fe?()=>{Te.current=!0,b(he)}:void 0,handleAdd:je?e=>{ue(!1);const t=Re(me,e);if("array"===Ge){const e=J.array?0:j.length,n=J.array?{insert:!0}:{};S(t,[...he,e],n).then((e=>{e&&ke({code:"ADD_ERROR",message:e},t)}))}else if(e in j)ke({code:"KEY_EXISTS",message:W("ERROR_KEY_EXISTS",me)},e);else{const n=J.object?{insertBefore:0}:{};S(t,[...he,e],n).then((e=>{e&&ke({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:ve?Je:void 0,enableClipboard:z,type:Ge,nodeData:me,translate:W,customButtons:r.customButtons,keyboardControls:Y,handleKeyboard:$}),pt=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===he.length?0:K/2)+"em"},o("collection",me)),{position:"relative"}),draggable:Ee},Se,Ne("above"),{children:[t("div",{className:"jer-clickzone",style:{width:K/2+1+"em",zIndex:10+2*me.level},onClick:e=>Ye(e)}),!Ze&&xe,t(Ae,{position:"above",nodeData:me}),Be?e("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:e=>Ye(e),children:[e("div",{className:"jer-collection-name",children:[t("div",{className:"jer-collapse-icon jer-accordion-icon"+(de?" jer-rotate-90":""),style:{zIndex:11+2*me.level},onClick:e=>Ye(e),children:t(q,{name:"chevron",rotate:de,nodeData:me})}),dt,!Ze&&t("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",me),children:Ue.open})]}),!Ze&&tt&&t("div",{className:"jer-collection-item-count"+(tt?" jer-visible":" jer-hidden"),style:o("itemCount",me),children:1===be?W("ITEM_SINGLE",Object.assign(Object.assign({},me),{size:1}),1):W("ITEMS_MULTIPLE",me,be)}),t("div",{className:"jer-brackets"+(lt?" jer-visible":" jer-hidden"),style:o("bracket",me),children:Ue.close}),ut]}):Ke?t(n,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[dt,ut]}),e("div",{className:"jer-collection-inner",style:Object.assign({overflowY:lt||re?"clip":"visible",maxHeight:We?void 0:ce},o("collectionInner",me)),ref:ne,children:[ct,t("div",{className:Ze?"jer-collection-error-row":"jer-collection-error-row-edit",children:De&&t("span",{className:"jer-error-slug",style:o("error",me),children:De})}),!Ze&&Be&&t("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},o("bracket",me)),{marginLeft:(K<3?-1:K<6?-.5:0)+"em"}),children:Ue.close})]}),t(Ae,{position:"below",nodeData:me})]}));return Fe?t(Fe,Object.assign({customNodeProps:Me},st,{children:pt})):pt},ge={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"},me=(e,t)=>(n,r,o)=>((e,t,n,r,o)=>{if(t[r]){const e=t[r](n);if(null!==e)return e}const a=r in e?e[r]:ge[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,t,r,n,o);var he=[],ye=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,a="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var i=he.indexOf(a);-1===i&&(i=he.push(a)-1,ye[i]={}),n=ye[i]&&ye[i][r]?ye[i][r]:ye[i][r]=l()}else n=l();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function l(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-expand-transition-time:0.3s;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden,.jer-visible{transition:var(--jer-expand-transition-time)}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative;transition:var(--jer-expand-transition-time)}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:transform var(--jer-expand-transition-time)}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-accordion-icon,.jer-rotate-90{transition:transform var(--jer-expand-transition-time)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string:after{content:"<empty string>:";font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}',{});const be=({data:e,setData:n,rootName:r="root",onUpdate:o=(()=>{}),onEdit:d=o,onDelete:u=o,onAdd:g=o,onChange:h,onError:y,showErrorMessages:b=!0,enableClipboard:f=!0,indent:v=2,collapse:j=!1,collapseAnimationTime:E=300,showCollectionCount:w=!0,restrictEdit:C=!1,restrictDelete:O=!1,restrictAdd:S=!1,restrictTypeSelection:N=!1,restrictDrag:x=!0,searchFilter:A,searchText:T,searchDebounceTime:R=350,keySort:V=!1,showArrayIndices:z=!0,showStringQuotes:F=!0,defaultValue:M=null,minWidth:K=250,maxWidth:I="min(600px, 90vw)",rootFontSize:L,stringTruncate:B=250,translations:W={},className:G,id:U,customText:H={},customNodeDefinitions:Y=[],customButtons:$=[],jsonParse:J=JSON.parse,jsonStringify:X=(e=>JSON.stringify(e,null,2)),errorMessageTimeout:Z=2500,keyboardControls:Q={},insertAtTop:q=!1})=>{const{getStyles:ee}=P(),{setCurrentlyEditingElement:te}=_(),ne=c(je(j),[j]),re=c(me(W,H),[W,H]),[oe,ae]=a(T),[ie,le]=(({setData:e,data:t})=>{const[n,r]=a(e?void 0:t),o=c((t=>{e?e(t):r(t)}),[e]);return l((()=>{e||r(t)}),[t]),[e?t:n,o]})({setData:n,data:e}),ce=i(null);l((()=>{te(null);const e=setTimeout((()=>ae(T)),R);return()=>clearTimeout(e)}),[T,R]);const de={key:r,path:[],level:0,index:0,value:ie,size:"object"==typeof ie&&null!==ie?Object.keys(ie).length:1,parentData:null,fullData:ie},ue=(e,t)=>p(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void le(t.newData);const r=De(n)?n:["error",n],[o,a]=r;if("error"===o)return le(t.currentData),!1===a?re("ERROR_UPDATE",de):String(a);le(a)})),ge=s((()=>je(C)),[C]),he=s((()=>je(O)),[O]),ye=s((()=>je(S)),[S]),be=s((()=>je(x)),[x]),fe=s((()=>Ee(A)),[A]),we=s((()=>(e=>{const t=Object.assign({},k);for(const n of Object.keys(k)){const r=n;if(e[r]){const o=e[r],a=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(o)?o:[o]:"string"==typeof o?{key:o}:o;t[r]=a,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})(Q)),[Q]),ke=c(((e,t)=>((e,t,n)=>{const r=Object.entries(t);for(const[t,o]of r)if(D(n,e[t],t)){n.preventDefault(),o();break}})(we,t,e)),[Q]),Ce=c(((e,t)=>{!1!==V&&("function"!=typeof V?e.sort(((e,n)=>{const r=t(e)[0],o=t(n)[0];return r<o?-1:r>o?1:0})):e.sort(((e,n)=>V(t(e),t(n)))))}),[V]),Oe={mainContainerRef:ce,name:r,nodeData:de,onEdit:(e,t)=>p(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=ve(ie,t,e,"update");if(o!==a)return yield ue(d,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>p(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=ve(ie,t,e,"delete");return yield ue(u,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:a,newValue:i}=ve(ie,t,e,"add",n);return yield ue(g,{currentData:r,newData:o,currentValue:a,newValue:i,name:t.slice(-1)[0],path:t})})),onChange:h,onError:y,showErrorMessages:b,onMove:(e,t,n)=>p(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=ve(ie,e,"","delete"),i=e.slice(-1)[0],l=t.slice(0,-1),s=t.slice(-1)[0];let c="number"==typeof s?"above"===n?s:s+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof c&&i<c&&(c-=1);const u="number"==typeof c?{insert:!0}:"above"===n?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=ve(o,[...l,c],a,"add",u);return yield ue(d,{currentData:r,newData:p,currentValue:a,newValue:g,name:t.slice(-1)[0],path:t})})),showCollectionCount:w,collapseFilter:ne,collapseAnimationTime:E,restrictEditFilter:ge,restrictDeleteFilter:he,restrictAddFilter:ye,restrictTypeSelection:N,restrictDragFilter:be,canDragOnto:!1,searchFilter:fe,searchText:oe,enableClipboard:f,keySort:V,sort:Ce,showArrayIndices:z,showStringQuotes:F,indent:v,defaultValue:M,stringTruncate:B,translate:re,customNodeDefinitions:Y,customButtons:$,parentData:null,jsonParse:J,jsonStringify:X,errorMessageTimeout:Z,handleKeyboard:ke,keyboardControls:we,insertAtTop:{object:!0===q||"object"===q,array:!0===q||"array"===q}},Se=Object.assign(Object.assign({},ee("container",de)),{minWidth:K,maxWidth:I});return Se.fontSize=null!=L?L:Se.fontSize,t("div",{id:U,ref:ce,className:`jer-editor-container ${null!=G?G:""}`,style:Se,children:m(ie)?t(pe,Object.assign({data:ie},Oe)):t(se,Object.assign({data:ie,showLabel:!0},Oe))})},fe=e=>{var n;const[r,o]=a();l((()=>{const e=document.documentElement;o(e)}),[]);const{collapseAnimationTime:i=300}=e;if(!r)return null;const s=getComputedStyle(r).getPropertyValue("--jer-expand-transition-time");return 1e3*parseFloat(s)!==i&&r.style.setProperty("--jer-expand-transition-time",i/1e3+"s"),t(T,{theme:null!==(n=e.theme)&&void 0!==n?n:x,icons:e.icons,docRoot:r,children:t(K,{children:t(be,Object.assign({},e))})})},ve=(e,t,n,r,o={})=>{if(0===t.length)return{currentData:e,newData:n,currentValue:e,newValue:n};const a=Object.assign({remove:"delete"===r},o),i="add"!==r?u(e,t):void 0;return{currentData:e,newData:d(e,t,n,a),currentValue:i,newValue:"delete"!==r?n:void 0}},je=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,Ee=e=>{if(void 0!==e)return"value"===e?b:"key"===e?f:"all"===e?(e,t)=>b(e,t)||f(e,t):e},De=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),we=({value:n,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 t("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:n,target:"_blank",rel:"noreferrer",style:{color:null!==(s=d.color)&&void 0!==s?s:void 0},children:['"',v(n,c),'"']})})},ke={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:we,showOnView:!0,showOnEdit:!1},Ce={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)"}},Oe={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"}},Se={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"}},Ne={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"}},xe={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"}},Ae={displayName:"Psychedelic",fragments:{pale:{color:"#A8DADC"},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"}};export{H as IconAdd,Z as IconCancel,Q as IconChevron,J as IconCopy,$ as IconDelete,Y as IconEdit,X as IconOk,fe as JsonEditor,we as LinkCustomComponent,ke as LinkCustomNodeDefinition,xe as candyWrapperTheme,x as defaultTheme,Ce as githubDarkTheme,Oe as githubLightTheme,m as isCollection,b as matchNode,f as matchNodeKey,Se as monoDarkTheme,Ne as monoLightTheme,Ae as psychedelicTheme,v as truncate}; |
{ | ||
"name": "json-edit-react", | ||
"version": "1.21.1", | ||
"version": "1.21.2", | ||
"description": "React component for editing or viewing JSON/object data", | ||
@@ -5,0 +5,0 @@ "main": "build/index.cjs.js", |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
183624
0