@motiadev/plugin-states 0.9.4-beta.150 → 0.9.4-beta.151-216335
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/state-editor.d.ts.map +1 -1
- package/dist/components/states-page.d.ts.map +1 -1
- package/dist/index.cjs +4 -80
- package/dist/index.js +867 -944
- package/dist/plugin-states.css +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-editor.d.ts","sourceRoot":"","sources":["../../src/components/state-editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"state-editor.d.ts","sourceRoot":"","sources":["../../src/components/state-editor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA0JvC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"states-page.d.ts","sourceRoot":"","sources":["../../src/components/states-page.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"states-page.d.ts","sourceRoot":"","sources":["../../src/components/states-page.tsx"],"names":[],"mappings":"AAsBA,eAAO,MAAM,UAAU,+CAwHtB,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,86 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),L=require("@motiadev/ui");function
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var He;function It(){if(He)return te;He=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,o){var l=null;if(o!==void 0&&(l=""+o),s.key!==void 0&&(l=""+s.key),"key"in s){o={};for(var u in s)u!=="key"&&(o[u]=s[u])}else o=s;return s=o.ref,{$$typeof:e,type:n,key:l,ref:s!==void 0?s:null,props:o}}return te.Fragment=t,te.jsx=r,te.jsxs=r,te}var re={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Fe;function Pt(){return Fe||(Fe=1,process.env.NODE_ENV!=="production"&&function(){function e(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===S?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case N:return"Fragment";case T:return"Profiler";case p:return"StrictMode";case b:return"Suspense";case x:return"SuspenseList";case _:return"Activity"}if(typeof i=="object")switch(typeof i.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),i.$$typeof){case O:return"Portal";case I:return(i.displayName||"Context")+".Provider";case k:return(i._context.displayName||"Context")+".Consumer";case w:var g=i.render;return i=i.displayName,i||(i=g.displayName||g.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case y:return g=i.displayName||null,g!==null?g:e(i.type)||"Memo";case H:g=i._payload,i=i._init;try{return e(i(g))}catch{}}return null}function t(i){return""+i}function r(i){try{t(i);var g=!1}catch{g=!0}if(g){g=console;var C=g.error,v=typeof Symbol=="function"&&Symbol.toStringTag&&i[Symbol.toStringTag]||i.constructor.name||"Object";return C.call(g,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",v),t(i)}}function n(i){if(i===N)return"<>";if(typeof i=="object"&&i!==null&&i.$$typeof===H)return"<...>";try{var g=e(i);return g?"<"+g+">":"<...>"}catch{return"<...>"}}function s(){var i=$.A;return i===null?null:i.getOwner()}function o(){return Error("react-stack-top-frame")}function l(i){if(V.call(i,"key")){var g=Object.getOwnPropertyDescriptor(i,"key").get;if(g&&g.isReactWarning)return!1}return i.key!==void 0}function u(i,g){function C(){j||(j=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",g))}C.isReactWarning=!0,Object.defineProperty(i,"key",{get:C,configurable:!0})}function h(){var i=e(this.type);return M[i]||(M[i]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),i=this.props.ref,i!==void 0?i:null}function f(i,g,C,v,A,B,ve,me){return C=B.ref,i={$$typeof:R,type:i,key:g,props:B,_owner:A},(C!==void 0?C:null)!==null?Object.defineProperty(i,"ref",{enumerable:!1,get:h}):Object.defineProperty(i,"ref",{enumerable:!1,value:null}),i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(i,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(i,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ve}),Object.defineProperty(i,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:me}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i}function d(i,g,C,v,A,B,ve,me){var J=g.children;if(J!==void 0)if(v)if(U(J)){for(v=0;v<J.length;v++)m(J[v]);Object.freeze&&Object.freeze(J)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(J);if(V.call(g,"key")){J=e(i);var X=Object.keys(g).filter(function(_t){return _t!=="key"});v=0<X.length?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}",Z[J+v]||(X=0<X.length?"{"+X.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),L=require("@motiadev/ui");function Rt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const $=Rt(c);var ce={exports:{}},te={};var Ve;function Mt(){if(Ve)return te;Ve=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,i){var l=null;if(i!==void 0&&(l=""+i),s.key!==void 0&&(l=""+s.key),"key"in s){i={};for(var u in s)u!=="key"&&(i[u]=s[u])}else i=s;return s=i.ref,{$$typeof:e,type:n,key:l,ref:s!==void 0?s:null,props:i}}return te.Fragment=t,te.jsx=r,te.jsxs=r,te}var re={};var He;function Pt(){return He||(He=1,process.env.NODE_ENV!=="production"&&(function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===V?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case p:return"Fragment";case A:return"Profiler";case N:return"StrictMode";case C:return"Suspense";case b:return"SuspenseList";case E:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case _:return"Portal";case x:return o.displayName||"Context";case M:return(o._context.displayName||"Context")+".Consumer";case y:var v=o.render;return o=o.displayName,o||(o=v.displayName||v.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case F:return v=o.displayName||null,v!==null?v:e(o.type)||"Memo";case T:v=o._payload,o=o._init;try{return e(o(v))}catch{}}return null}function t(o){return""+o}function r(o){try{t(o);var v=!1}catch{v=!0}if(v){v=console;var g=v.error,w=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return g.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",w),t(o)}}function n(o){if(o===p)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===T)return"<...>";try{var v=e(o);return v?"<"+v+">":"<...>"}catch{return"<...>"}}function s(){var o=D.A;return o===null?null:o.getOwner()}function i(){return Error("react-stack-top-frame")}function l(o){if(H.call(o,"key")){var v=Object.getOwnPropertyDescriptor(o,"key").get;if(v&&v.isReactWarning)return!1}return o.key!==void 0}function u(o,v){function g(){R||(R=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",v))}g.isReactWarning=!0,Object.defineProperty(o,"key",{get:g,configurable:!0})}function h(){var o=e(this.type);return P[o]||(P[o]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),o=this.props.ref,o!==void 0?o:null}function f(o,v,g,w,q,ve){var U=g.ref;return o={$$typeof:S,type:o,key:v,props:g,_owner:w},(U!==void 0?U:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:h}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ve}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function d(o,v,g,w,q,ve){var U=v.children;if(U!==void 0)if(w)if(z(U)){for(w=0;w<U.length;w++)m(U[w]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(U);if(H.call(v,"key")){U=e(o);var X=Object.keys(v).filter(function(_t){return _t!=="key"});w=0<X.length?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}",I[U+w]||(X=0<X.length?"{"+X.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
2
|
let props = %s;
|
|
19
3
|
<%s {...props} />
|
|
20
4
|
React keys must be passed directly to JSX without using spread:
|
|
21
5
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,v,J,X,J),Z[J+v]=!0)}if(J=null,C!==void 0&&(r(C),J=""+C),l(g)&&(r(g.key),J=""+g.key),"key"in g){C={};for(var be in g)be!=="key"&&(C[be]=g[be])}else C=g;return J&&u(C,typeof i=="function"?i.displayName||i.name||"Unknown":i),f(i,J,B,A,s(),C,ve,me)}function m(i){typeof i=="object"&&i!==null&&i.$$typeof===R&&i._store&&(i._store.validated=1)}var E=c,R=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),I=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),S=Symbol.for("react.client.reference"),$=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,U=Array.isArray,F=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(i){return i()}};var j,M={},P=E.react_stack_bottom_frame.bind(E,o)(),z=F(n(o)),Z={};re.Fragment=N,re.jsx=function(i,g,C,v,A){var B=1e4>$.recentlyCreatedOwnerStacks++;return d(i,g,C,!1,v,A,B?Error("react-stack-top-frame"):P,B?F(n(i)):z)},re.jsxs=function(i,g,C,v,A){var B=1e4>$.recentlyCreatedOwnerStacks++;return d(i,g,C,!0,v,A,B?Error("react-stack-top-frame"):P,B?F(n(i)):z)}}()),re}var Ue;function $t(){return Ue||(Ue=1,process.env.NODE_ENV==="production"?ce.exports=It():ce.exports=Pt()),ce.exports}var a=$t();/**
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the ISC license.
|
|
26
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const Dt=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Lt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),ze=e=>{const t=Lt(e);return t.charAt(0).toUpperCase()+t.slice(1)},yt=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Vt=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
28
|
-
* @license lucide-react v0.545.0 - ISC
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the ISC license.
|
|
31
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/var Ht={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
33
|
-
* @license lucide-react v0.545.0 - ISC
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the ISC license.
|
|
36
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/const Ft=c.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:l,...u},h)=>c.createElement("svg",{ref:h,...Ht,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:yt("lucide",s),...!o&&!Vt(u)&&{"aria-hidden":"true"},...u},[...l.map(([f,d])=>c.createElement(f,d)),...Array.isArray(o)?o:[o]]));/**
|
|
38
|
-
* @license lucide-react v0.545.0 - ISC
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the ISC license.
|
|
41
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const W=(e,t)=>{const r=c.forwardRef(({className:n,...s},o)=>c.createElement(Ft,{ref:o,iconNode:t,className:yt(`lucide-${Dt(ze(e))}`,`lucide-${e}`,n),...s}));return r.displayName=ze(e),r};/**
|
|
43
|
-
* @license lucide-react v0.545.0 - ISC
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the ISC license.
|
|
46
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/const Ut=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],zt=W("check",Ut);/**
|
|
48
|
-
* @license lucide-react v0.545.0 - ISC
|
|
49
|
-
*
|
|
50
|
-
* This source code is licensed under the ISC license.
|
|
51
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/const Zt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Ze=W("circle-alert",Zt);/**
|
|
53
|
-
* @license lucide-react v0.545.0 - ISC
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the ISC license.
|
|
56
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/const Jt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Bt=W("loader-circle",Jt);/**
|
|
58
|
-
* @license lucide-react v0.545.0 - ISC
|
|
59
|
-
*
|
|
60
|
-
* This source code is licensed under the ISC license.
|
|
61
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
-
*/const qt=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Yt=W("refresh-cw",qt);/**
|
|
63
|
-
* @license lucide-react v0.545.0 - ISC
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the ISC license.
|
|
66
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/const Wt=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Kt=W("save",Wt);/**
|
|
68
|
-
* @license lucide-react v0.545.0 - ISC
|
|
69
|
-
*
|
|
70
|
-
* This source code is licensed under the ISC license.
|
|
71
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/const Gt=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Xt=W("search",Gt);/**
|
|
73
|
-
* @license lucide-react v0.545.0 - ISC
|
|
74
|
-
*
|
|
75
|
-
* This source code is licensed under the ISC license.
|
|
76
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
-
*/const Qt=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],er=W("trash",Qt);/**
|
|
78
|
-
* @license lucide-react v0.545.0 - ISC
|
|
79
|
-
*
|
|
80
|
-
* This source code is licensed under the ISC license.
|
|
81
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/const tr=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jt=W("x",tr),rr=()=>{const[e,t]=c.useState([]),r=c.useCallback(()=>{fetch("/__motia/state").then(async s=>{if(s.ok)return s.json();throw await s.json()}).then(t).catch(s=>console.error(s))},[]),n=s=>{fetch("/__motia/state/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}).then(()=>r())};return c.useEffect(()=>{r()},[r]),{items:e,deleteItems:n,refetch:r}},Je=e=>{let t;const r=new Set,n=(f,d)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const E=t;t=d??(typeof m!="object"||m===null)?m:Object.assign({},t,m),r.forEach(R=>R(t,E))}},s=()=>t,u={setState:n,getState:s,getInitialState:()=>h,subscribe:f=>(r.add(f),()=>r.delete(f))},h=t=e(n,s,u);return u},nr=e=>e?Je(e):Je,ar=e=>e;function sr(e,t=ar){const r=c.useSyncExternalStore(e.subscribe,c.useCallback(()=>t(e.getState()),[e,t]),c.useCallback(()=>t(e.getInitialState()),[e,t]));return c.useDebugValue(r),r}const or=e=>{const t=nr(e),r=n=>sr(t,n);return Object.assign(r,t),r},ir=e=>or,Be=ir()(e=>({selectedStateId:void 0,selectStateId:t=>e({selectedStateId:t})}));function cr(e,t,r,n){function s(o){return o instanceof r?o:new r(function(l){l(o)})}return new(r||(r=Promise))(function(o,l){function u(d){try{f(n.next(d))}catch(m){l(m)}}function h(d){try{f(n.throw(d))}catch(m){l(m)}}function f(d){d.done?o(d.value):s(d.value).then(u,h)}f((n=n.apply(e,[])).next())})}var lr=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(s){e.addRange(s)}),t&&t.focus()}},ur=lr,qe={"text/plain":"Text","text/html":"Url",default:"Text"},fr="Copy to clipboard: #{key}, Enter";function dr(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function pr(e,t){var r,n,s,o,l,u,h=!1;t||(t={}),r=t.debug||!1;try{s=ur(),o=document.createRange(),l=document.getSelection(),u=document.createElement("span"),u.textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(d){if(d.stopPropagation(),t.format)if(d.preventDefault(),typeof d.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=qe[t.format]||qe.default;window.clipboardData.setData(m,e)}else d.clipboardData.clearData(),d.clipboardData.setData(t.format,e);t.onCopy&&(d.preventDefault(),t.onCopy(d.clipboardData))}),document.body.appendChild(u),o.selectNodeContents(u),l.addRange(o);var f=document.execCommand("copy");if(!f)throw new Error("copy command was unsuccessful");h=!0}catch(d){r&&console.error("unable to copy using execCommand: ",d),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),h=!0}catch(m){r&&console.error("unable to copy using clipboardData: ",m),r&&console.error("falling back to prompt"),n=dr("message"in t?t.message:fr),window.prompt(n,e)}}finally{l&&(typeof l.removeRange=="function"?l.removeRange(o):l.removeAllRanges()),u&&document.body.removeChild(u),s()}return h}var gr=pr;function K(e){return Object.prototype.toString.call(e)==="[object Object]"}function ae(e){return Array.isArray(e)?e.length:K(e)?Object.keys(e).length:0}function hr(e,t){if(typeof e=="string")return e;try{return JSON.stringify(e,(r,n)=>{switch(typeof n){case"bigint":return String(n)+"n";case"number":case"boolean":case"object":case"string":return n;default:return String(n)}},t)}catch(r){return`${r.name}: ${r.message}`||"JSON.stringify failed"}}function vr(e){return cr(this,void 0,void 0,function*(){try{yield navigator.clipboard.writeText(e)}catch{gr(e)}})}function Ye(e,t,r,n,s,o){if(o&&o.collapsed!==void 0)return!!o.collapsed;if(typeof n=="boolean")return n;if(typeof n=="number"&&t>n)return!0;const l=ae(e);if(typeof n=="function"){const u=_e(n,[{node:e,depth:t,indexOrName:r,size:l}]);if(typeof u=="boolean")return u}return!!(Array.isArray(e)&&l>s||K(e)&&l>s)}function We(e,t,r,n,s,o){if(o&&o.collapsed!==void 0)return!!o.collapsed;if(typeof n=="boolean")return n;if(typeof n=="number"&&t>n)return!0;const l=Math.ceil(e.length/100);if(typeof n=="function"){const u=_e(n,[{node:e,depth:t,indexOrName:r,size:l}]);if(typeof u=="boolean")return u}return!!(Array.isArray(e)&&l>s||K(e)&&l>s)}function ee(e,t,r){return typeof e=="boolean"?e:!!(typeof e=="number"&&t>e||e==="collapsed"&&r||e==="expanded"&&!r)}function _e(e,t){try{return e(...t)}catch(r){reportError(r)}}function wt(e){if(e===!0||K(e)&&e.add===!0)return!0}function Ke(e){if(e===!0||K(e)&&e.edit===!0)return!0}function Me(e){if(e===!0||K(e)&&e.delete===!0)return!0}function mr(e){return typeof e=="function"}function xt(e){return!e||e.add===void 0||!!e.add}function Ge(e){return!e||e.edit===void 0||!!e.edit}function Ie(e){return!e||e.delete===void 0||!!e.delete}function pe(e){return!e||e.enableClipboard===void 0||!!e.enableClipboard}function br(e){return!e||e.matchesURL===void 0||!!e.matchesURL}function yr(e,t){return e==="string"?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t}var Xe;function xe(){return xe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xe.apply(this,arguments)}var Pe=function(t){return D.createElement("svg",xe({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},t),Xe||(Xe=D.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))},Qe;function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ce.apply(this,arguments)}var jr=function(t){return D.createElement("svg",Ce({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),Qe||(Qe=D.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))},et,tt;function Se(){return Se=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Se.apply(this,arguments)}var wr=function(t){return D.createElement("svg",Se({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),et||(et=D.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),tt||(tt=D.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function ge({node:e,nodeMeta:t}){const{customizeCopy:r,CopyComponent:n,CopiedComponent:s}=c.useContext(G),[o,l]=c.useState(!1),u=h=>{h.stopPropagation();const f=r(e,t);typeof f=="string"&&f&&vr(f),l(!0),setTimeout(()=>l(!1),3e3)};return o?typeof s=="function"?a.jsx(s,{className:"json-view--copy",style:{display:"inline-block"}}):a.jsx(wr,{className:"json-view--copy",style:{display:"inline-block"}}):typeof n=="function"?a.jsx(n,{onClick:u,className:"json-view--copy"}):a.jsx(jr,{onClick:u,className:"json-view--copy"})}function Ee({indexOrName:e,value:t,depth:r,deleteHandle:n,editHandle:s,parent:o,parentPath:l}){const{displayArrayIndex:u}=c.useContext(G),h=Array.isArray(o);return a.jsxs("div",Object.assign({className:"json-view--pair"},{children:[!h||h&&u?a.jsxs(a.Fragment,{children:[a.jsx("span",Object.assign({className:typeof e=="number"?"json-view--index":"json-view--property"},{children:e})),":"," "]}):a.jsx(a.Fragment,{}),a.jsx(St,{node:t,depth:r+1,deleteHandle:(f,d)=>n(f,d),editHandle:(f,d,m,E)=>s(f,d,m,E),parent:o,indexOrName:e,parentPath:l})]}))}var rt,nt;function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Oe.apply(this,arguments)}var $e=function(t){return D.createElement("svg",Oe({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),rt||(rt=D.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),nt||(nt=D.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))},at,st;function ke(){return ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ke.apply(this,arguments)}var Ct=function(t){return D.createElement("svg",ke({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),at||(at=D.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),st||(st=D.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))},ot,it;function Ae(){return Ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ae.apply(this,arguments)}var De=function(t){return D.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),ot||(ot=D.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),it||(it=D.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))},ct,lt;function Ne(){return Ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ne.apply(this,arguments)}var Le=function(t){return D.createElement("svg",Ne({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),ct||(ct=D.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),lt||(lt=D.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function xr({originNode:e,node:t,depth:r,index:n,deleteHandle:s,customOptions:o,startIndex:l,parent:u,parentPath:h}){const{enableClipboard:f,src:d,onEdit:m,onChange:E,forceUpdate:R,displaySize:O,CustomOperation:N}=c.useContext(G),p=[...h,String(n)],[T,k]=c.useState(!0),I=c.useCallback((x,y,H)=>{e[x]=y,m&&m({newValue:y,oldValue:H,depth:r,src:d,indexOrName:x,parentType:"array",parentPath:h}),E&&E({type:"edit",depth:r,src:d,indexOrName:x,parentType:"array",parentPath:h}),R()},[t,m,E,R]),w=x=>{e.splice(x,1),s&&s(x,h),R()},b=a.jsxs(a.Fragment,{children:[!T&&a.jsxs("span",Object.assign({onClick:()=>k(!0),className:"jv-size-chevron"},{children:[ee(O,r,T)&&a.jsxs("span",Object.assign({className:"jv-size"},{children:[ae(t)," Items"]})),a.jsx(Pe,{className:"jv-chevron"})]})),!T&&f&&pe(o)&&a.jsx(ge,{node:t,nodeMeta:{depth:r,indexOrName:n,parent:u,parentPath:h,currentPath:p}}),typeof N=="function"?a.jsx(N,{node:t}):null]});return a.jsxs("div",{children:[a.jsx("span",{children:"["}),b,T?a.jsxs("button",Object.assign({onClick:()=>k(!1),className:"jv-button"},{children:[l," ... ",l+t.length-1]})):a.jsx("div",Object.assign({className:"jv-indent"},{children:t.map((x,y)=>a.jsx(Ee,{indexOrName:y+l,value:x,depth:r,parent:t,deleteHandle:w,editHandle:I,parentPath:h},String(n)+String(y)))})),a.jsx("span",{children:"]"})]})}function Cr({node:e,depth:t,deleteHandle:r,indexOrName:n,customOptions:s,parent:o,parentPath:l}){const u=typeof n<"u"?[...l,String(n)]:l,h=[];for(let j=0;j<e.length;j+=100)h.push(e.slice(j,j+100));const{collapsed:f,enableClipboard:d,collapseObjectsAfterLength:m,editable:E,onDelete:R,src:O,onAdd:N,CustomOperation:p,onChange:T,forceUpdate:k,displaySize:I}=c.useContext(G),[w,b]=c.useState(We(e,t,n,f,m,s));c.useEffect(()=>{b(We(e,t,n,f,m,s))},[f,m]);const[x,y]=c.useState(!1),H=()=>{y(!1),r&&r(n,l),R&&R({value:e,depth:t,src:O,indexOrName:n,parentType:"array",parentPath:l}),T&&T({type:"delete",depth:t,src:O,indexOrName:n,parentType:"array",parentPath:l})},[_,S]=c.useState(!1),$=()=>{const j=e;j.push(null),N&&N({indexOrName:j.length-1,depth:t,src:O,parentType:"array",parentPath:l}),T&&T({type:"add",indexOrName:j.length-1,depth:t,src:O,parentType:"array",parentPath:l}),k()},V=x||_,U=()=>{y(!1),S(!1)},F=a.jsxs(a.Fragment,{children:[!w&&!V&&a.jsxs("span",Object.assign({onClick:()=>b(!0),className:"jv-size-chevron"},{children:[ee(I,t,w)&&a.jsxs("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),a.jsx(Pe,{className:"jv-chevron"})]})),V&&a.jsx(De,{className:"json-view--edit",style:{display:"inline-block"},onClick:_?$:H}),V&&a.jsx(Le,{className:"json-view--edit",style:{display:"inline-block"},onClick:U}),!w&&!V&&d&&pe(s)&&a.jsx(ge,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:o,parentPath:l,currentPath:u}}),!w&&!V&&wt(E)&&xt(s)&&a.jsx(Ct,{className:"json-view--edit",onClick:()=>{$()}}),!w&&!V&&Me(E)&&Ie(s)&&r&&a.jsx($e,{className:"json-view--edit",onClick:()=>y(!0)}),typeof p=="function"?a.jsx(p,{node:e}):null]});return a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"["}),F,w?a.jsx("button",Object.assign({onClick:()=>b(!1),className:"jv-button"},{children:"..."})):a.jsx("div",Object.assign({className:"jv-indent"},{children:h.map((j,M)=>a.jsx(xr,{originNode:e,node:j,depth:t,index:M,startIndex:M*100,deleteHandle:r,customOptions:s,parentPath:l},String(n)+String(M)))})),a.jsx("span",{children:"]"}),w&&ee(I,t,w)&&a.jsxs("span",Object.assign({onClick:()=>b(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function Sr({node:e,depth:t,indexOrName:r,deleteHandle:n,customOptions:s,parent:o,parentPath:l}){const{collapsed:u,onCollapse:h,enableClipboard:f,ignoreLargeArray:d,collapseObjectsAfterLength:m,editable:E,onDelete:R,src:O,onAdd:N,onEdit:p,onChange:T,forceUpdate:k,displaySize:I,CustomOperation:w}=c.useContext(G),b=typeof r<"u"?[...l,String(r)]:l;if(!d&&Array.isArray(e)&&e.length>100)return a.jsx(Cr,{node:e,depth:t,indexOrName:r,deleteHandle:n,customOptions:s,parentPath:b});const x=K(e),[y,H]=c.useState(Ye(e,t,r,u,m,s)),_=v=>{h?.({isCollapsing:!v,node:e,depth:t,indexOrName:r}),H(v)};c.useEffect(()=>{_(Ye(e,t,r,u,m,s))},[u,m]);const S=c.useCallback((v,A,B)=>{Array.isArray(e)?e[+v]=A:e&&(e[v]=A),p&&p({newValue:A,oldValue:B,depth:t,src:O,indexOrName:v,parentType:x?"object":"array",parentPath:b}),T&&T({type:"edit",depth:t,src:O,indexOrName:v,parentType:x?"object":"array",parentPath:b}),k()},[e,p,T,k]),$=v=>{Array.isArray(e)?e.splice(+v,1):e&&delete e[v],k()},[V,U]=c.useState(!1),F=()=>{U(!1),n&&n(r,b),R&&R({value:e,depth:t,src:O,indexOrName:r,parentType:x?"object":"array",parentPath:b}),T&&T({type:"delete",depth:t,src:O,indexOrName:r,parentType:x?"object":"array",parentPath:b})},[j,M]=c.useState(!1),P=c.useRef(null),z=()=>{var v;if(x){const A=(v=P.current)===null||v===void 0?void 0:v.value;A&&(e[A]=null,P.current&&(P.current.value=""),M(!1),N&&N({indexOrName:A,depth:t,src:O,parentType:"object",parentPath:b}),T&&T({type:"add",indexOrName:A,depth:t,src:O,parentType:"object",parentPath:b}))}else if(Array.isArray(e)){const A=e;A.push(null),N&&N({indexOrName:A.length-1,depth:t,src:O,parentType:"array",parentPath:b}),T&&T({type:"add",indexOrName:A.length-1,depth:t,src:O,parentType:"array",parentPath:b})}k()},Z=v=>{v.key==="Enter"?(v.preventDefault(),z()):v.key==="Escape"&&g()},i=V||j,g=()=>{U(!1),M(!1)},C=a.jsxs(a.Fragment,{children:[!y&&!i&&a.jsxs("span",Object.assign({onClick:()=>_(!0),className:"jv-size-chevron"},{children:[ee(I,t,y)&&a.jsxs("span",Object.assign({className:"jv-size"},{children:[ae(e)," Items"]})),a.jsx(Pe,{className:"jv-chevron"})]})),j&&x&&a.jsx("input",{className:"json-view--input",placeholder:"property",ref:P,onKeyDown:Z}),i&&a.jsx(De,{className:"json-view--edit",style:{display:"inline-block"},onClick:j?z:F}),i&&a.jsx(Le,{className:"json-view--edit",style:{display:"inline-block"},onClick:g}),!y&&!i&&f&&pe(s)&&a.jsx(ge,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:o,parentPath:l,currentPath:b}}),!y&&!i&&wt(E)&&xt(s)&&a.jsx(Ct,{className:"json-view--edit",onClick:()=>{x?(M(!0),setTimeout(()=>{var v;return(v=P.current)===null||v===void 0?void 0:v.focus()})):z()}}),!y&&!i&&Me(E)&&Ie(s)&&n&&a.jsx($e,{className:"json-view--edit",onClick:()=>U(!0)}),typeof w=="function"?a.jsx(w,{node:e}):null]});return Array.isArray(e)?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"["}),C,y?a.jsx("button",Object.assign({onClick:()=>_(!1),className:"jv-button"},{children:"..."})):a.jsx("div",Object.assign({className:"jv-indent"},{children:e.map((v,A)=>a.jsx(Ee,{indexOrName:A,value:v,depth:t,parent:e,deleteHandle:$,editHandle:S,parentPath:b},String(r)+String(A)))})),a.jsx("span",{children:"]"}),y&&ee(I,t,y)&&a.jsxs("span",Object.assign({onClick:()=>_(!1),className:"jv-size"},{children:[ae(e)," Items"]}))]}):x?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"{"}),C,y?a.jsx("button",Object.assign({onClick:()=>_(!1),className:"jv-button"},{children:"..."})):a.jsx("div",Object.assign({className:"jv-indent"},{children:Object.entries(e).map(([v,A])=>a.jsx(Ee,{indexOrName:v,value:A,depth:t,parent:e,deleteHandle:$,editHandle:S,parentPath:b},String(r)+String(v)))})),a.jsx("span",{children:"}"}),y&&ee(I,t,y)&&a.jsxs("span",Object.assign({onClick:()=>_(!1),className:"jv-size"},{children:[ae(e)," Items"]}))]}):a.jsx("span",{children:String(e)})}const Er=c.forwardRef(({str:e,className:t,ctrlClick:r},n)=>{let{collapseStringMode:s,collapseStringsAfterLength:o,customizeCollapseStringUI:l}=c.useContext(G);const[u,h]=c.useState(!0),f=c.useRef(null);o=o>0?o:0;const d=e.replace(/\s+/g," "),m=typeof l=="function"?l(d,u):typeof l=="string"?l:"...",E=R=>{var O;if((R.ctrlKey||R.metaKey)&&r)r(R);else{const N=window.getSelection();if(N&&N.anchorOffset!==N.focusOffset&&((O=N.anchorNode)===null||O===void 0?void 0:O.parentElement)===f.current)return;h(!u)}};if(e.length<=o)return a.jsxs("span",Object.assign({ref:f,className:t,onClick:r},{children:['"',e,'"']}));if(s==="address")return e.length<=10?a.jsxs("span",Object.assign({ref:f,className:t,onClick:r},{children:['"',e,'"']})):a.jsxs("span",Object.assign({ref:f,onClick:E,className:t+" cursor-pointer"},{children:['"',u?[d.slice(0,6),m,d.slice(-4)]:e,'"']}));if(s==="directly")return a.jsxs("span",Object.assign({ref:f,onClick:E,className:t+" cursor-pointer"},{children:['"',u?[d.slice(0,o),m]:e,'"']}));if(s==="word"){let R=o,O=o+1,N=d,p=1;for(;;){if(/\W/.test(e[R])){N=e.slice(0,R);break}if(/\W/.test(e[O])){N=e.slice(0,O);break}if(p===6){N=e.slice(0,o);break}p++,R--,O++}return a.jsxs("span",Object.assign({ref:f,onClick:E,className:t+" cursor-pointer"},{children:['"',u?[N,m]:e,'"']}))}return a.jsxs("span",Object.assign({ref:f,className:t},{children:['"',e,'"']}))});var ut;function Te(){return Te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Te.apply(this,arguments)}var Or=function(t){return D.createElement("svg",Te({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),ut||(ut=D.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))},ft,dt;function Re(){return Re=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Re.apply(this,arguments)}var kr=function(t){return D.createElement("svg",Re({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),ft||(ft=D.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),dt||(dt=D.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function St({node:e,depth:t,deleteHandle:r,indexOrName:n,parent:s,editHandle:o,parentPath:l}){const{collapseStringsAfterLength:u,enableClipboard:h,editable:f,src:d,onDelete:m,onChange:E,customizeNode:R,matchesURL:O,urlRegExp:N,EditComponent:p,DoneComponent:T,CancelComponent:k,CustomOperation:I}=c.useContext(G);let w;if(typeof R=="function"&&(w=_e(R,[{node:e,depth:t,indexOrName:n}])),w){if(c.isValidElement(w))return w;if(mr(w)){const b=w;return a.jsx(b,{node:e,depth:t,indexOrName:n})}}if(Array.isArray(e)||K(e))return a.jsx(Sr,{parent:s,node:e,depth:t,indexOrName:n,deleteHandle:r,parentPath:l,customOptions:typeof w=="object"?w:void 0});{const b=typeof e,x=typeof n<"u"?[...l,String(n)]:l,[y,H]=c.useState(!1),[_,S]=c.useState(!1),$=c.useRef(null),V=()=>{H(!0),setTimeout(()=>{var v,A;(v=window.getSelection())===null||v===void 0||v.selectAllChildren($.current),(A=$.current)===null||A===void 0||A.focus()})},U=c.useCallback(()=>{let v=$.current.innerText;try{const A=JSON.parse(v);o&&o(n,A,e,l)}catch{const B=yr(b,v);o&&o(n,B,e,l)}H(!1)},[o,n,e,l,b]),F=()=>{H(!1),S(!1)},j=()=>{S(!1),r&&r(n,l),m&&m({value:e,depth:t,src:d,indexOrName:n,parentType:Array.isArray(s)?"array":"object",parentPath:l}),E&&E({depth:t,src:d,indexOrName:n,parentType:Array.isArray(s)?"array":"object",type:"delete",parentPath:l})},M=c.useCallback(v=>{v.key==="Enter"?(v.preventDefault(),U()):v.key==="Escape"&&F()},[U]),P=y||_,z=!P&&Ke(f)&&Ge(w)&&o?v=>{(v.ctrlKey||v.metaKey)&&V()}:void 0,Z=a.jsxs(a.Fragment,{children:[P&&(typeof T=="function"?a.jsx(T,{className:"json-view--edit",style:{display:"inline-block"},onClick:_?j:U}):a.jsx(De,{className:"json-view--edit",style:{display:"inline-block"},onClick:_?j:U})),P&&(typeof k=="function"?a.jsx(k,{className:"json-view--edit",style:{display:"inline-block"},onClick:F}):a.jsx(Le,{className:"json-view--edit",style:{display:"inline-block"},onClick:F})),!P&&h&&pe(w)&&a.jsx(ge,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:s,parentPath:l,currentPath:x}}),!P&&O&&b==="string"&&N.test(e)&&br(w)&&a.jsx("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:a.jsx(kr,{})})),!P&&Ke(f)&&Ge(w)&&o&&(typeof p=="function"?a.jsx(p,{className:"json-view--edit",onClick:V}):a.jsx(Or,{className:"json-view--edit",onClick:V})),!P&&Me(f)&&Ie(w)&&r&&a.jsx($e,{className:"json-view--edit",onClick:()=>S(!0)}),typeof I=="function"?a.jsx(I,{node:e}):null]});let i="json-view--string";switch(b){case"number":case"bigint":i="json-view--number";break;case"boolean":i="json-view--boolean";break;case"object":i="json-view--null";break}typeof w?.className=="string"&&(i+=" "+w.className),_&&(i+=" json-view--deleting");let g=String(e);b==="bigint"&&(g+="n");const C=c.useMemo(()=>a.jsx("span",{contentEditable:!0,className:i,dangerouslySetInnerHTML:{__html:b==="string"?`"${g}"`:g},ref:$,onKeyDown:M}),[g,b,M]);return b==="string"?a.jsxs(a.Fragment,{children:[y?C:e.length>u?a.jsx(Er,{str:e,ref:$,className:i,ctrlClick:z}):a.jsxs("span",Object.assign({className:i,onClick:z},{children:['"',g,'"']})),Z]}):a.jsxs(a.Fragment,{children:[y?C:a.jsx("span",Object.assign({className:i,onClick:z},{children:g})),Z]})}}const Et=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,G=c.createContext({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:()=>{},displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:Et,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function Ar({src:e,collapseStringsAfterLength:t=99,collapseStringMode:r="directly",customizeCollapseStringUI:n,collapseObjectsAfterLength:s=99,collapsed:o,onCollapse:l,enableClipboard:u=!0,editable:h=!1,onEdit:f,onDelete:d,onAdd:m,onChange:E,dark:R=!1,theme:O="default",customizeNode:N,customizeCopy:p=F=>hr(F),displaySize:T,displayArrayIndex:k=!0,style:I,className:w,matchesURL:b=!1,urlRegExp:x=Et,ignoreLargeArray:y=!1,CopyComponent:H,CopiedComponent:_,EditComponent:S,CancelComponent:$,DoneComponent:V,CustomOperation:U}){const[F,j]=c.useState(0),M=c.useCallback(()=>j(Z=>++Z),[]),[P,z]=c.useState(e);return c.useEffect(()=>z(e),[e]),a.jsx(G.Provider,Object.assign({value:{src:P,collapseStringsAfterLength:t,collapseStringMode:r,customizeCollapseStringUI:n,collapseObjectsAfterLength:s,collapsed:o,onCollapse:l,enableClipboard:u,editable:h,onEdit:f,onDelete:d,onAdd:m,onChange:E,forceUpdate:M,customizeNode:N,customizeCopy:p,displaySize:T,displayArrayIndex:k,matchesURL:b,urlRegExp:x,ignoreLargeArray:y,CopyComponent:H,CopiedComponent:_,EditComponent:S,CancelComponent:$,DoneComponent:V,CustomOperation:U}},{children:a.jsx("code",Object.assign({className:"json-view"+(R?" dark":"")+(O&&O!=="default"?" json-view_"+O:"")+(w?" "+w:""),style:I},{children:a.jsx(St,{node:P,depth:1,editHandle:(Z,i,g,C)=>{z(i),f&&f({newValue:i,oldValue:g,depth:1,src:P,indexOrName:Z,parentType:null,parentPath:C}),E&&E({type:"edit",depth:1,src:P,indexOrName:Z,parentType:null,parentPath:C})},deleteHandle:(Z,i)=>{z(void 0),d&&d({value:P,depth:1,src:P,indexOrName:Z,parentType:null,parentPath:i}),E&&E({depth:1,src:P,indexOrName:Z,parentType:null,type:"delete",parentPath:i})},parentPath:[]})}))}))}const Nr=({state:e})=>a.jsx(Ar,{src:e.value,theme:"default"});function Tr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function gt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pt(Object(r),!0).forEach(function(n){Tr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rr(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,o;for(o=0;o<n.length;o++)s=n[o],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}function _r(e,t){if(e==null)return{};var r=Rr(e,t),n,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)n=o[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Mr(e,t){return Ir(e)||Pr(e,t)||$r(e,t)||Dr()}function Ir(e){if(Array.isArray(e))return e}function Pr(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,s=!1,o=void 0;try{for(var l=e[Symbol.iterator](),u;!(n=(u=l.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(h){s=!0,o=h}finally{try{!n&&l.return!=null&&l.return()}finally{if(s)throw o}}return r}}function $r(e,t){if(e){if(typeof e=="string")return ht(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ht(e,t)}}function ht(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Dr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
83
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function mt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vt(Object(r),!0).forEach(function(n){Lr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vr(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(s,o){return o(s)},n)}}function ne(e){return function t(){for(var r=this,n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];return s.length>=e.length?e.apply(this,s):function(){for(var l=arguments.length,u=new Array(l),h=0;h<l;h++)u[h]=arguments[h];return t.apply(r,[].concat(s,u))}}}function fe(e){return{}.toString.call(e).includes("Object")}function Hr(e){return!Object.keys(e).length}function oe(e){return typeof e=="function"}function Fr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ur(e,t){return fe(t)||Y("changeType"),Object.keys(t).some(function(r){return!Fr(e,r)})&&Y("changeField"),t}function zr(e){oe(e)||Y("selectorType")}function Zr(e){oe(e)||fe(e)||Y("handlerType"),fe(e)&&Object.values(e).some(function(t){return!oe(t)})&&Y("handlersType")}function Jr(e){e||Y("initialIsRequired"),fe(e)||Y("initialType"),Hr(e)&&Y("initialContent")}function Br(e,t){throw new Error(e[t]||e.default)}var qr={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Y=ne(Br)(qr),le={changes:Ur,selector:zr,handler:Zr,initial:Jr};function Yr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};le.initial(e),le.handler(t);var r={current:e},n=ne(Gr)(r,t),s=ne(Kr)(r),o=ne(le.changes)(e),l=ne(Wr)(r);function u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return le.selector(f),f(r.current)}function h(f){Vr(n,s,o,l)(f)}return[u,h]}function Wr(e,t){return oe(t)?t(e.current):t}function Kr(e,t){return e.current=mt(mt({},e.current),t),t}function Gr(e,t,r){return oe(t)?t(e.current):Object.keys(r).forEach(function(n){var s;return(s=t[n])===null||s===void 0?void 0:s.call(t,e.current[n])}),r}var Xr={create:Yr},Qr={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function en(e){return function t(){for(var r=this,n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];return s.length>=e.length?e.apply(this,s):function(){for(var l=arguments.length,u=new Array(l),h=0;h<l;h++)u[h]=arguments[h];return t.apply(r,[].concat(s,u))}}}function tn(e){return{}.toString.call(e).includes("Object")}function rn(e){return e||bt("configIsRequired"),tn(e)||bt("configType"),e.urls?(nn(),{paths:{vs:e.urls.monacoBase}}):e}function nn(){console.warn(Ot.deprecation)}function an(e,t){throw new Error(e[t]||e.default)}var Ot={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
6
|
+
<%s key={someKey} {...props} />`,w,U,X,U),I[U+w]=!0)}if(U=null,g!==void 0&&(r(g),U=""+g),l(v)&&(r(v.key),U=""+v.key),"key"in v){g={};for(var me in v)me!=="key"&&(g[me]=v[me])}else g=v;return U&&u(g,typeof o=="function"?o.displayName||o.name||"Unknown":o),f(o,U,g,s(),q,ve)}function m(o){O(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===T&&(o._payload.status==="fulfilled"?O(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function O(o){return typeof o=="object"&&o!==null&&o.$$typeof===S}var k=c,S=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),x=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),D=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=Object.prototype.hasOwnProperty,z=Array.isArray,j=console.createTask?console.createTask:function(){return null};k={react_stack_bottom_frame:function(o){return o()}};var R,P={},Z=k.react_stack_bottom_frame.bind(k,i)(),J=j(n(i)),I={};re.Fragment=p,re.jsx=function(o,v,g){var w=1e4>D.recentlyCreatedOwnerStacks++;return d(o,v,g,!1,w?Error("react-stack-top-frame"):Z,w?j(n(o)):J)},re.jsxs=function(o,v,g){var w=1e4>D.recentlyCreatedOwnerStacks++;return d(o,v,g,!0,w?Error("react-stack-top-frame"):Z,w?j(n(o)):J)}})()),re}var Fe;function It(){return Fe||(Fe=1,process.env.NODE_ENV==="production"?ce.exports=Mt():ce.exports=Pt()),ce.exports}var a=It();const $t=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Dt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),Ue=e=>{const t=Dt(e);return t.charAt(0).toUpperCase()+t.slice(1)},yt=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Lt=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Vt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ht=c.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:l,...u},h)=>c.createElement("svg",{ref:h,...Vt,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:yt("lucide",s),...!i&&!Lt(u)&&{"aria-hidden":"true"},...u},[...l.map(([f,d])=>c.createElement(f,d)),...Array.isArray(i)?i:[i]]));const W=(e,t)=>{const r=c.forwardRef(({className:n,...s},i)=>c.createElement(Ht,{ref:i,iconNode:t,className:yt(`lucide-${$t(Ue(e))}`,`lucide-${e}`,n),...s}));return r.displayName=Ue(e),r};const Ft=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ut=W("refresh-cw",Ft);const zt=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Zt=W("search",zt);const Jt=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Bt=W("trash",Jt);const qt=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],bt=W("x",qt),Yt=()=>{const[e,t]=c.useState([]),r=c.useCallback(()=>{fetch("/__motia/state").then(async s=>{if(s.ok)return s.json();throw await s.json()}).then(t).catch(s=>console.error(s))},[]),n=s=>{fetch("/__motia/state/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}).then(()=>r())};return c.useEffect(()=>{r()},[r]),{items:e,deleteItems:n,refetch:r}},ze=e=>{let t;const r=new Set,n=(f,d)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const O=t;t=d??(typeof m!="object"||m===null)?m:Object.assign({},t,m),r.forEach(k=>k(t,O))}},s=()=>t,u={setState:n,getState:s,getInitialState:()=>h,subscribe:f=>(r.add(f),()=>r.delete(f))},h=t=e(n,s,u);return u},Wt=(e=>e?ze(e):ze),Kt=e=>e;function Gt(e,t=Kt){const r=c.useSyncExternalStore(e.subscribe,c.useCallback(()=>t(e.getState()),[e,t]),c.useCallback(()=>t(e.getInitialState()),[e,t]));return c.useDebugValue(r),r}const Xt=e=>{const t=Wt(e),r=n=>Gt(t,n);return Object.assign(r,t),r},Qt=(e=>Xt),Ze=Qt()(e=>({selectedStateId:void 0,selectStateId:t=>e({selectedStateId:t})}));function er(e,t,r,n){function s(i){return i instanceof r?i:new r(function(l){l(i)})}return new(r||(r=Promise))(function(i,l){function u(d){try{f(n.next(d))}catch(m){l(m)}}function h(d){try{f(n.throw(d))}catch(m){l(m)}}function f(d){d.done?i(d.value):s(d.value).then(u,h)}f((n=n.apply(e,[])).next())})}var tr=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(s){e.addRange(s)}),t&&t.focus()}},rr=tr,Je={"text/plain":"Text","text/html":"Url",default:"Text"},nr="Copy to clipboard: #{key}, Enter";function ar(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function sr(e,t){var r,n,s,i,l,u,h=!1;t||(t={}),r=t.debug||!1;try{s=rr(),i=document.createRange(),l=document.getSelection(),u=document.createElement("span"),u.textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(d){if(d.stopPropagation(),t.format)if(d.preventDefault(),typeof d.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=Je[t.format]||Je.default;window.clipboardData.setData(m,e)}else d.clipboardData.clearData(),d.clipboardData.setData(t.format,e);t.onCopy&&(d.preventDefault(),t.onCopy(d.clipboardData))}),document.body.appendChild(u),i.selectNodeContents(u),l.addRange(i);var f=document.execCommand("copy");if(!f)throw new Error("copy command was unsuccessful");h=!0}catch(d){r&&console.error("unable to copy using execCommand: ",d),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),h=!0}catch(m){r&&console.error("unable to copy using clipboardData: ",m),r&&console.error("falling back to prompt"),n=ar("message"in t?t.message:nr),window.prompt(n,e)}}finally{l&&(typeof l.removeRange=="function"?l.removeRange(i):l.removeAllRanges()),u&&document.body.removeChild(u),s()}return h}var or=sr;function K(e){return Object.prototype.toString.call(e)==="[object Object]"}function ae(e){return Array.isArray(e)?e.length:K(e)?Object.keys(e).length:0}function ir(e,t){if(typeof e=="string")return e;try{return JSON.stringify(e,(r,n)=>{switch(typeof n){case"bigint":return String(n)+"n";case"number":case"boolean":case"object":case"string":return n;default:return String(n)}},t)}catch(r){return`${r.name}: ${r.message}`||"JSON.stringify failed"}}function cr(e){return er(this,void 0,void 0,function*(){try{yield navigator.clipboard.writeText(e)}catch{or(e)}})}function Be(e,t,r,n,s,i){if(i&&i.collapsed!==void 0)return!!i.collapsed;if(typeof n=="boolean")return n;if(typeof n=="number"&&t>n)return!0;const l=ae(e);if(typeof n=="function"){const u=_e(n,[{node:e,depth:t,indexOrName:r,size:l}]);if(typeof u=="boolean")return u}return!!(Array.isArray(e)&&l>s||K(e)&&l>s)}function qe(e,t,r,n,s,i){if(i&&i.collapsed!==void 0)return!!i.collapsed;if(typeof n=="boolean")return n;if(typeof n=="number"&&t>n)return!0;const l=Math.ceil(e.length/100);if(typeof n=="function"){const u=_e(n,[{node:e,depth:t,indexOrName:r,size:l}]);if(typeof u=="boolean")return u}return!!(Array.isArray(e)&&l>s||K(e)&&l>s)}function ee(e,t,r){return typeof e=="boolean"?e:!!(typeof e=="number"&&t>e||e==="collapsed"&&r||e==="expanded"&&!r)}function _e(e,t){try{return e(...t)}catch(r){reportError(r)}}function jt(e){if(e===!0||K(e)&&e.add===!0)return!0}function Ye(e){if(e===!0||K(e)&&e.edit===!0)return!0}function Re(e){if(e===!0||K(e)&&e.delete===!0)return!0}function lr(e){return typeof e=="function"}function wt(e){return!e||e.add===void 0||!!e.add}function We(e){return!e||e.edit===void 0||!!e.edit}function Me(e){return!e||e.delete===void 0||!!e.delete}function pe(e){return!e||e.enableClipboard===void 0||!!e.enableClipboard}function ur(e){return!e||e.matchesURL===void 0||!!e.matchesURL}function fr(e,t){return e==="string"?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t}var Ke;function we(){return we=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},we.apply(this,arguments)}var Pe=function(t){return $.createElement("svg",we({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},t),Ke||(Ke=$.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))},Ge;function xe(){return xe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xe.apply(this,arguments)}var dr=function(t){return $.createElement("svg",xe({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),Ge||(Ge=$.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))},Xe,Qe;function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ce.apply(this,arguments)}var pr=function(t){return $.createElement("svg",Ce({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),Xe||(Xe=$.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),Qe||(Qe=$.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function ge({node:e,nodeMeta:t}){const{customizeCopy:r,CopyComponent:n,CopiedComponent:s}=c.useContext(G),[i,l]=c.useState(!1),u=h=>{h.stopPropagation();const f=r(e,t);typeof f=="string"&&f&&cr(f),l(!0),setTimeout(()=>l(!1),3e3)};return i?typeof s=="function"?a.jsx(s,{className:"json-view--copy",style:{display:"inline-block"}}):a.jsx(pr,{className:"json-view--copy",style:{display:"inline-block"}}):typeof n=="function"?a.jsx(n,{onClick:u,className:"json-view--copy"}):a.jsx(dr,{onClick:u,className:"json-view--copy"})}function Se({indexOrName:e,value:t,depth:r,deleteHandle:n,editHandle:s,parent:i,parentPath:l}){const{displayArrayIndex:u}=c.useContext(G),h=Array.isArray(i);return a.jsxs("div",Object.assign({className:"json-view--pair"},{children:[!h||h&&u?a.jsxs(a.Fragment,{children:[a.jsx("span",Object.assign({className:typeof e=="number"?"json-view--index":"json-view--property"},{children:e})),":"," "]}):a.jsx(a.Fragment,{}),a.jsx(Ct,{node:t,depth:r+1,deleteHandle:(f,d)=>n(f,d),editHandle:(f,d,m,O)=>s(f,d,m,O),parent:i,indexOrName:e,parentPath:l})]}))}var et,tt;function Ee(){return Ee=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ee.apply(this,arguments)}var Ie=function(t){return $.createElement("svg",Ee({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),et||(et=$.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),tt||(tt=$.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))},rt,nt;function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Oe.apply(this,arguments)}var xt=function(t){return $.createElement("svg",Oe({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),rt||(rt=$.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),nt||(nt=$.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))},at,st;function ke(){return ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ke.apply(this,arguments)}var $e=function(t){return $.createElement("svg",ke({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),at||(at=$.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),st||(st=$.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))},ot,it;function Ae(){return Ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ae.apply(this,arguments)}var De=function(t){return $.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),ot||(ot=$.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),it||(it=$.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function gr({originNode:e,node:t,depth:r,index:n,deleteHandle:s,customOptions:i,startIndex:l,parent:u,parentPath:h}){const{enableClipboard:f,src:d,onEdit:m,onChange:O,forceUpdate:k,displaySize:S,CustomOperation:_}=c.useContext(G),p=[...h,String(n)],[N,A]=c.useState(!0),M=c.useCallback((C,b,F)=>{e[C]=b,m&&m({newValue:b,oldValue:F,depth:r,src:d,indexOrName:C,parentType:"array",parentPath:h}),O&&O({type:"edit",depth:r,src:d,indexOrName:C,parentType:"array",parentPath:h}),k()},[t,m,O,k]),x=C=>{e.splice(C,1),s&&s(C,h),k()},y=a.jsxs(a.Fragment,{children:[!N&&a.jsxs("span",Object.assign({onClick:()=>A(!0),className:"jv-size-chevron"},{children:[ee(S,r,N)&&a.jsxs("span",Object.assign({className:"jv-size"},{children:[ae(t)," Items"]})),a.jsx(Pe,{className:"jv-chevron"})]})),!N&&f&&pe(i)&&a.jsx(ge,{node:t,nodeMeta:{depth:r,indexOrName:n,parent:u,parentPath:h,currentPath:p}}),typeof _=="function"?a.jsx(_,{node:t}):null]});return a.jsxs("div",{children:[a.jsx("span",{children:"["}),y,N?a.jsxs("button",Object.assign({onClick:()=>A(!1),className:"jv-button"},{children:[l," ... ",l+t.length-1]})):a.jsx("div",Object.assign({className:"jv-indent"},{children:t.map((C,b)=>a.jsx(Se,{indexOrName:b+l,value:C,depth:r,parent:t,deleteHandle:x,editHandle:M,parentPath:h},String(n)+String(b)))})),a.jsx("span",{children:"]"})]})}function hr({node:e,depth:t,deleteHandle:r,indexOrName:n,customOptions:s,parent:i,parentPath:l}){const u=typeof n<"u"?[...l,String(n)]:l,h=[];for(let j=0;j<e.length;j+=100)h.push(e.slice(j,j+100));const{collapsed:f,enableClipboard:d,collapseObjectsAfterLength:m,editable:O,onDelete:k,src:S,onAdd:_,CustomOperation:p,onChange:N,forceUpdate:A,displaySize:M}=c.useContext(G),[x,y]=c.useState(qe(e,t,n,f,m,s));c.useEffect(()=>{y(qe(e,t,n,f,m,s))},[f,m]);const[C,b]=c.useState(!1),F=()=>{b(!1),r&&r(n,l),k&&k({value:e,depth:t,src:S,indexOrName:n,parentType:"array",parentPath:l}),N&&N({type:"delete",depth:t,src:S,indexOrName:n,parentType:"array",parentPath:l})},[T,E]=c.useState(!1),V=()=>{const j=e;j.push(null),_&&_({indexOrName:j.length-1,depth:t,src:S,parentType:"array",parentPath:l}),N&&N({type:"add",indexOrName:j.length-1,depth:t,src:S,parentType:"array",parentPath:l}),A()},D=C||T,H=()=>{b(!1),E(!1)},z=a.jsxs(a.Fragment,{children:[!x&&!D&&a.jsxs("span",Object.assign({onClick:()=>y(!0),className:"jv-size-chevron"},{children:[ee(M,t,x)&&a.jsxs("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),a.jsx(Pe,{className:"jv-chevron"})]})),D&&a.jsx($e,{className:"json-view--edit",style:{display:"inline-block"},onClick:T?V:F}),D&&a.jsx(De,{className:"json-view--edit",style:{display:"inline-block"},onClick:H}),!x&&!D&&d&&pe(s)&&a.jsx(ge,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:i,parentPath:l,currentPath:u}}),!x&&!D&&jt(O)&&wt(s)&&a.jsx(xt,{className:"json-view--edit",onClick:()=>{V()}}),!x&&!D&&Re(O)&&Me(s)&&r&&a.jsx(Ie,{className:"json-view--edit",onClick:()=>b(!0)}),typeof p=="function"?a.jsx(p,{node:e}):null]});return a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"["}),z,x?a.jsx("button",Object.assign({onClick:()=>y(!1),className:"jv-button"},{children:"..."})):a.jsx("div",Object.assign({className:"jv-indent"},{children:h.map((j,R)=>a.jsx(gr,{originNode:e,node:j,depth:t,index:R,startIndex:R*100,deleteHandle:r,customOptions:s,parentPath:l},String(n)+String(R)))})),a.jsx("span",{children:"]"}),x&&ee(M,t,x)&&a.jsxs("span",Object.assign({onClick:()=>y(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function vr({node:e,depth:t,indexOrName:r,deleteHandle:n,customOptions:s,parent:i,parentPath:l}){const{collapsed:u,onCollapse:h,enableClipboard:f,ignoreLargeArray:d,collapseObjectsAfterLength:m,editable:O,onDelete:k,src:S,onAdd:_,onEdit:p,onChange:N,forceUpdate:A,displaySize:M,CustomOperation:x}=c.useContext(G),y=typeof r<"u"?[...l,String(r)]:l;if(!d&&Array.isArray(e)&&e.length>100)return a.jsx(hr,{node:e,depth:t,indexOrName:r,deleteHandle:n,customOptions:s,parentPath:y});const C=K(e),[b,F]=c.useState(Be(e,t,r,u,m,s)),T=g=>{h?.({isCollapsing:!g,node:e,depth:t,indexOrName:r}),F(g)};c.useEffect(()=>{T(Be(e,t,r,u,m,s))},[u,m]);const E=c.useCallback((g,w,q)=>{Array.isArray(e)?e[+g]=w:e&&(e[g]=w),p&&p({newValue:w,oldValue:q,depth:t,src:S,indexOrName:g,parentType:C?"object":"array",parentPath:y}),N&&N({type:"edit",depth:t,src:S,indexOrName:g,parentType:C?"object":"array",parentPath:y}),A()},[e,p,N,A]),V=g=>{Array.isArray(e)?e.splice(+g,1):e&&delete e[g],A()},[D,H]=c.useState(!1),z=()=>{H(!1),n&&n(r,y),k&&k({value:e,depth:t,src:S,indexOrName:r,parentType:C?"object":"array",parentPath:y}),N&&N({type:"delete",depth:t,src:S,indexOrName:r,parentType:C?"object":"array",parentPath:y})},[j,R]=c.useState(!1),P=c.useRef(null),Z=()=>{var g;if(C){const w=(g=P.current)===null||g===void 0?void 0:g.value;w&&(e[w]=null,P.current&&(P.current.value=""),R(!1),_&&_({indexOrName:w,depth:t,src:S,parentType:"object",parentPath:y}),N&&N({type:"add",indexOrName:w,depth:t,src:S,parentType:"object",parentPath:y}))}else if(Array.isArray(e)){const w=e;w.push(null),_&&_({indexOrName:w.length-1,depth:t,src:S,parentType:"array",parentPath:y}),N&&N({type:"add",indexOrName:w.length-1,depth:t,src:S,parentType:"array",parentPath:y})}A()},J=g=>{g.key==="Enter"?(g.preventDefault(),Z()):g.key==="Escape"&&o()},I=D||j,o=()=>{H(!1),R(!1)},v=a.jsxs(a.Fragment,{children:[!b&&!I&&a.jsxs("span",Object.assign({onClick:()=>T(!0),className:"jv-size-chevron"},{children:[ee(M,t,b)&&a.jsxs("span",Object.assign({className:"jv-size"},{children:[ae(e)," Items"]})),a.jsx(Pe,{className:"jv-chevron"})]})),j&&C&&a.jsx("input",{className:"json-view--input",placeholder:"property",ref:P,onKeyDown:J}),I&&a.jsx($e,{className:"json-view--edit",style:{display:"inline-block"},onClick:j?Z:z}),I&&a.jsx(De,{className:"json-view--edit",style:{display:"inline-block"},onClick:o}),!b&&!I&&f&&pe(s)&&a.jsx(ge,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:i,parentPath:l,currentPath:y}}),!b&&!I&&jt(O)&&wt(s)&&a.jsx(xt,{className:"json-view--edit",onClick:()=>{C?(R(!0),setTimeout(()=>{var g;return(g=P.current)===null||g===void 0?void 0:g.focus()})):Z()}}),!b&&!I&&Re(O)&&Me(s)&&n&&a.jsx(Ie,{className:"json-view--edit",onClick:()=>H(!0)}),typeof x=="function"?a.jsx(x,{node:e}):null]});return Array.isArray(e)?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"["}),v,b?a.jsx("button",Object.assign({onClick:()=>T(!1),className:"jv-button"},{children:"..."})):a.jsx("div",Object.assign({className:"jv-indent"},{children:e.map((g,w)=>a.jsx(Se,{indexOrName:w,value:g,depth:t,parent:e,deleteHandle:V,editHandle:E,parentPath:y},String(r)+String(w)))})),a.jsx("span",{children:"]"}),b&&ee(M,t,b)&&a.jsxs("span",Object.assign({onClick:()=>T(!1),className:"jv-size"},{children:[ae(e)," Items"]}))]}):C?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"{"}),v,b?a.jsx("button",Object.assign({onClick:()=>T(!1),className:"jv-button"},{children:"..."})):a.jsx("div",Object.assign({className:"jv-indent"},{children:Object.entries(e).map(([g,w])=>a.jsx(Se,{indexOrName:g,value:w,depth:t,parent:e,deleteHandle:V,editHandle:E,parentPath:y},String(r)+String(g)))})),a.jsx("span",{children:"}"}),b&&ee(M,t,b)&&a.jsxs("span",Object.assign({onClick:()=>T(!1),className:"jv-size"},{children:[ae(e)," Items"]}))]}):a.jsx("span",{children:String(e)})}const mr=c.forwardRef(({str:e,className:t,ctrlClick:r},n)=>{let{collapseStringMode:s,collapseStringsAfterLength:i,customizeCollapseStringUI:l}=c.useContext(G);const[u,h]=c.useState(!0),f=c.useRef(null);i=i>0?i:0;const d=e.replace(/\s+/g," "),m=typeof l=="function"?l(d,u):typeof l=="string"?l:"...",O=k=>{var S;if((k.ctrlKey||k.metaKey)&&r)r(k);else{const _=window.getSelection();if(_&&_.anchorOffset!==_.focusOffset&&((S=_.anchorNode)===null||S===void 0?void 0:S.parentElement)===f.current)return;h(!u)}};if(e.length<=i)return a.jsxs("span",Object.assign({ref:f,className:t,onClick:r},{children:['"',e,'"']}));if(s==="address")return e.length<=10?a.jsxs("span",Object.assign({ref:f,className:t,onClick:r},{children:['"',e,'"']})):a.jsxs("span",Object.assign({ref:f,onClick:O,className:t+" cursor-pointer"},{children:['"',u?[d.slice(0,6),m,d.slice(-4)]:e,'"']}));if(s==="directly")return a.jsxs("span",Object.assign({ref:f,onClick:O,className:t+" cursor-pointer"},{children:['"',u?[d.slice(0,i),m]:e,'"']}));if(s==="word"){let k=i,S=i+1,_=d,p=1;for(;;){if(/\W/.test(e[k])){_=e.slice(0,k);break}if(/\W/.test(e[S])){_=e.slice(0,S);break}if(p===6){_=e.slice(0,i);break}p++,k--,S++}return a.jsxs("span",Object.assign({ref:f,onClick:O,className:t+" cursor-pointer"},{children:['"',u?[_,m]:e,'"']}))}return a.jsxs("span",Object.assign({ref:f,className:t},{children:['"',e,'"']}))});var ct;function Ne(){return Ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ne.apply(this,arguments)}var yr=function(t){return $.createElement("svg",Ne({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),ct||(ct=$.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))},lt,ut;function Te(){return Te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Te.apply(this,arguments)}var br=function(t){return $.createElement("svg",Te({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),lt||(lt=$.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),ut||(ut=$.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function Ct({node:e,depth:t,deleteHandle:r,indexOrName:n,parent:s,editHandle:i,parentPath:l}){const{collapseStringsAfterLength:u,enableClipboard:h,editable:f,src:d,onDelete:m,onChange:O,customizeNode:k,matchesURL:S,urlRegExp:_,EditComponent:p,DoneComponent:N,CancelComponent:A,CustomOperation:M}=c.useContext(G);let x;if(typeof k=="function"&&(x=_e(k,[{node:e,depth:t,indexOrName:n}])),x){if(c.isValidElement(x))return x;if(lr(x)){const y=x;return a.jsx(y,{node:e,depth:t,indexOrName:n})}}if(Array.isArray(e)||K(e))return a.jsx(vr,{parent:s,node:e,depth:t,indexOrName:n,deleteHandle:r,parentPath:l,customOptions:typeof x=="object"?x:void 0});{const y=typeof e,C=typeof n<"u"?[...l,String(n)]:l,[b,F]=c.useState(!1),[T,E]=c.useState(!1),V=c.useRef(null),D=()=>{F(!0),setTimeout(()=>{var g,w;(g=window.getSelection())===null||g===void 0||g.selectAllChildren(V.current),(w=V.current)===null||w===void 0||w.focus()})},H=c.useCallback(()=>{let g=V.current.innerText;try{const w=JSON.parse(g);i&&i(n,w,e,l)}catch{const q=fr(y,g);i&&i(n,q,e,l)}F(!1)},[i,n,e,l,y]),z=()=>{F(!1),E(!1)},j=()=>{E(!1),r&&r(n,l),m&&m({value:e,depth:t,src:d,indexOrName:n,parentType:Array.isArray(s)?"array":"object",parentPath:l}),O&&O({depth:t,src:d,indexOrName:n,parentType:Array.isArray(s)?"array":"object",type:"delete",parentPath:l})},R=c.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),H()):g.key==="Escape"&&z()},[H]),P=b||T,Z=!P&&Ye(f)&&We(x)&&i?g=>{(g.ctrlKey||g.metaKey)&&D()}:void 0,J=a.jsxs(a.Fragment,{children:[P&&(typeof N=="function"?a.jsx(N,{className:"json-view--edit",style:{display:"inline-block"},onClick:T?j:H}):a.jsx($e,{className:"json-view--edit",style:{display:"inline-block"},onClick:T?j:H})),P&&(typeof A=="function"?a.jsx(A,{className:"json-view--edit",style:{display:"inline-block"},onClick:z}):a.jsx(De,{className:"json-view--edit",style:{display:"inline-block"},onClick:z})),!P&&h&&pe(x)&&a.jsx(ge,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:s,parentPath:l,currentPath:C}}),!P&&S&&y==="string"&&_.test(e)&&ur(x)&&a.jsx("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:a.jsx(br,{})})),!P&&Ye(f)&&We(x)&&i&&(typeof p=="function"?a.jsx(p,{className:"json-view--edit",onClick:D}):a.jsx(yr,{className:"json-view--edit",onClick:D})),!P&&Re(f)&&Me(x)&&r&&a.jsx(Ie,{className:"json-view--edit",onClick:()=>E(!0)}),typeof M=="function"?a.jsx(M,{node:e}):null]});let I="json-view--string";switch(y){case"number":case"bigint":I="json-view--number";break;case"boolean":I="json-view--boolean";break;case"object":I="json-view--null";break}typeof x?.className=="string"&&(I+=" "+x.className),T&&(I+=" json-view--deleting");let o=String(e);y==="bigint"&&(o+="n");const v=c.useMemo(()=>a.jsx("span",{contentEditable:!0,className:I,dangerouslySetInnerHTML:{__html:y==="string"?`"${o}"`:o},ref:V,onKeyDown:R}),[o,y,R]);return y==="string"?a.jsxs(a.Fragment,{children:[b?v:e.length>u?a.jsx(mr,{str:e,ref:V,className:I,ctrlClick:Z}):a.jsxs("span",Object.assign({className:I,onClick:Z},{children:['"',o,'"']})),J]}):a.jsxs(a.Fragment,{children:[b?v:a.jsx("span",Object.assign({className:I,onClick:Z},{children:o})),J]})}}const St=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,G=c.createContext({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:(()=>{}),displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:St,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function jr({src:e,collapseStringsAfterLength:t=99,collapseStringMode:r="directly",customizeCollapseStringUI:n,collapseObjectsAfterLength:s=99,collapsed:i,onCollapse:l,enableClipboard:u=!0,editable:h=!1,onEdit:f,onDelete:d,onAdd:m,onChange:O,dark:k=!1,theme:S="default",customizeNode:_,customizeCopy:p=z=>ir(z),displaySize:N,displayArrayIndex:A=!0,style:M,className:x,matchesURL:y=!1,urlRegExp:C=St,ignoreLargeArray:b=!1,CopyComponent:F,CopiedComponent:T,EditComponent:E,CancelComponent:V,DoneComponent:D,CustomOperation:H}){const[z,j]=c.useState(0),R=c.useCallback(()=>j(J=>++J),[]),[P,Z]=c.useState(e);return c.useEffect(()=>Z(e),[e]),a.jsx(G.Provider,Object.assign({value:{src:P,collapseStringsAfterLength:t,collapseStringMode:r,customizeCollapseStringUI:n,collapseObjectsAfterLength:s,collapsed:i,onCollapse:l,enableClipboard:u,editable:h,onEdit:f,onDelete:d,onAdd:m,onChange:O,forceUpdate:R,customizeNode:_,customizeCopy:p,displaySize:N,displayArrayIndex:A,matchesURL:y,urlRegExp:C,ignoreLargeArray:b,CopyComponent:F,CopiedComponent:T,EditComponent:E,CancelComponent:V,DoneComponent:D,CustomOperation:H}},{children:a.jsx("code",Object.assign({className:"json-view"+(k?" dark":"")+(S&&S!=="default"?" json-view_"+S:"")+(x?" "+x:""),style:M},{children:a.jsx(Ct,{node:P,depth:1,editHandle:(J,I,o,v)=>{Z(I),f&&f({newValue:I,oldValue:o,depth:1,src:P,indexOrName:J,parentType:null,parentPath:v}),O&&O({type:"edit",depth:1,src:P,indexOrName:J,parentType:null,parentPath:v})},deleteHandle:(J,I)=>{Z(void 0),d&&d({value:P,depth:1,src:P,indexOrName:J,parentType:null,parentPath:I}),O&&O({depth:1,src:P,indexOrName:J,parentType:null,type:"delete",parentPath:I})},parentPath:[]})}))}))}const wr=({state:e})=>a.jsx(jr,{src:e.value,theme:"default"});const xr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ft=W("circle-alert",xr);const Cr=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Sr=W("check",Cr);const Er=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Or=W("loader-circle",Er);const kr=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Ar=W("save",kr);function dt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Nr(e){if(Array.isArray(e))return e}function Tr(e,t,r){return(t=Dr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _r(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,l,u=[],h=!0,f=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(h=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);h=!0);}catch(d){f=!0,s=d}finally{try{if(!h&&r.return!=null&&(l=r.return(),Object(l)!==l))return}finally{if(f)throw s}}return u}}function Rr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
7
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function gt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pt(Object(r),!0).forEach(function(n){Tr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mr(e,t){if(e==null)return{};var r,n,s=Pr(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Pr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Ir(e,t){return Nr(e)||_r(e,t)||Lr(e,t)||Rr()}function $r(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dr(e){var t=$r(e,"string");return typeof t=="symbol"?t:t+""}function Lr(e,t){if(e){if(typeof e=="string")return dt(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?dt(e,t):void 0}}function Vr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ht(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function vt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ht(Object(r),!0).forEach(function(n){Vr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ht(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Hr(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(s,i){return i(s)},n)}}function ne(e){return function t(){for(var r=this,n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return s.length>=e.length?e.apply(this,s):function(){for(var l=arguments.length,u=new Array(l),h=0;h<l;h++)u[h]=arguments[h];return t.apply(r,[].concat(s,u))}}}function fe(e){return{}.toString.call(e).includes("Object")}function Fr(e){return!Object.keys(e).length}function oe(e){return typeof e=="function"}function Ur(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function zr(e,t){return fe(t)||Y("changeType"),Object.keys(t).some(function(r){return!Ur(e,r)})&&Y("changeField"),t}function Zr(e){oe(e)||Y("selectorType")}function Jr(e){oe(e)||fe(e)||Y("handlerType"),fe(e)&&Object.values(e).some(function(t){return!oe(t)})&&Y("handlersType")}function Br(e){e||Y("initialIsRequired"),fe(e)||Y("initialType"),Fr(e)&&Y("initialContent")}function qr(e,t){throw new Error(e[t]||e.default)}var Yr={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Y=ne(qr)(Yr),le={changes:zr,selector:Zr,handler:Jr,initial:Br};function Wr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};le.initial(e),le.handler(t);var r={current:e},n=ne(Xr)(r,t),s=ne(Gr)(r),i=ne(le.changes)(e),l=ne(Kr)(r);function u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return le.selector(f),f(r.current)}function h(f){Hr(n,s,i,l)(f)}return[u,h]}function Kr(e,t){return oe(t)?t(e.current):t}function Gr(e,t){return e.current=vt(vt({},e.current),t),t}function Xr(e,t,r){return oe(t)?t(e.current):Object.keys(r).forEach(function(n){var s;return(s=t[n])===null||s===void 0?void 0:s.call(t,e.current[n])}),r}var Qr={create:Wr},en={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}};function tn(e){return function t(){for(var r=this,n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return s.length>=e.length?e.apply(this,s):function(){for(var l=arguments.length,u=new Array(l),h=0;h<l;h++)u[h]=arguments[h];return t.apply(r,[].concat(s,u))}}}function rn(e){return{}.toString.call(e).includes("Object")}function nn(e){return e||mt("configIsRequired"),rn(e)||mt("configType"),e.urls?(an(),{paths:{vs:e.urls.monacoBase}}):e}function an(){console.warn(Et.deprecation)}function sn(e,t){throw new Error(e[t]||e.default)}var Et={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
84
8
|
You are using deprecated way of configuration.
|
|
85
9
|
|
|
86
10
|
Instead of using
|
|
@@ -89,4 +13,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
89
13
|
monaco.config({ paths: { vs: '...' } })
|
|
90
14
|
|
|
91
15
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
92
|
-
`},bt=en(an)(Ot),sn={config:rn},on=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(s){return r.reduceRight(function(o,l){return l(o)},s)}};function kt(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],kt(e[r],t[r]))}),gt(gt({},e),t)}var cn={type:"cancelation",msg:"operation is manually canceled"};function ye(e){var t=!1,r=new Promise(function(n,s){e.then(function(o){return t?s(cn):n(o)}),e.catch(s)});return r.cancel=function(){return t=!0},r}var ln=Xr.create({config:Qr,isInitialized:!1,resolve:null,reject:null,monaco:null}),At=Mr(ln,2),ie=At[0],he=At[1];function un(e){var t=sn.config(e),r=t.monaco,n=_r(t,["monaco"]);he(function(s){return{config:kt(s.config,n),monaco:r}})}function fn(){var e=ie(function(t){var r=t.monaco,n=t.isInitialized,s=t.resolve;return{monaco:r,isInitialized:n,resolve:s}});if(!e.isInitialized){if(he({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),ye(je);if(window.monaco&&window.monaco.editor)return Nt(window.monaco),e.resolve(window.monaco),ye(je);on(dn,gn)(hn)}return ye(je)}function dn(e){return document.body.appendChild(e)}function pn(e){var t=document.createElement("script");return e&&(t.src=e),t}function gn(e){var t=ie(function(n){var s=n.config,o=n.reject;return{config:s,reject:o}}),r=pn("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function hn(){var e=ie(function(r){var n=r.config,s=r.resolve,o=r.reject;return{config:n,resolve:s,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){Nt(r),e.resolve(r)},function(r){e.reject(r)})}function Nt(e){ie().monaco||he({monaco:e})}function vn(){return ie(function(e){var t=e.monaco;return t})}var je=new Promise(function(e,t){return he({resolve:e,reject:t})}),de={config:un,init:fn,__getMonacoInstance:vn},mn={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},we=mn,bn={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},yn=bn;function jn({children:e}){return c.createElement("div",{style:yn.container},e)}var wn=jn,xn=wn;function Cn({width:e,height:t,isEditorReady:r,loading:n,_ref:s,className:o,wrapperProps:l}){return c.createElement("section",{style:{...we.wrapper,width:e,height:t},...l},!r&&c.createElement(xn,null,n),c.createElement("div",{ref:s,style:{...we.fullWidth,...!r&&we.hide},className:o}))}var Sn=Cn,Tt=c.memo(Sn);function En(e){c.useEffect(e,[])}var Ve=En;function On(e,t,r=!0){let n=c.useRef(!0);c.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var q=On;function se(){}function Q(e,t,r,n){return kn(e,n)||An(e,t,r,n)}function kn(e,t){return e.editor.getModel(Rt(e,t))}function An(e,t,r,n){return e.editor.createModel(t,r,n?Rt(e,n):void 0)}function Rt(e,t){return e.Uri.parse(t)}function Nn({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:l,keepCurrentOriginalModel:u=!1,keepCurrentModifiedModel:h=!1,theme:f="light",loading:d="Loading...",options:m={},height:E="100%",width:R="100%",className:O,wrapperProps:N={},beforeMount:p=se,onMount:T=se}){let[k,I]=c.useState(!1),[w,b]=c.useState(!0),x=c.useRef(null),y=c.useRef(null),H=c.useRef(null),_=c.useRef(T),S=c.useRef(p),$=c.useRef(!1);Ve(()=>{let j=de.init();return j.then(M=>(y.current=M)&&b(!1)).catch(M=>M?.type!=="cancelation"&&console.error("Monaco initialization: error:",M)),()=>x.current?F():j.cancel()}),q(()=>{if(x.current&&y.current){let j=x.current.getOriginalEditor(),M=Q(y.current,e||"",n||r||"text",o||"");M!==j.getModel()&&j.setModel(M)}},[o],k),q(()=>{if(x.current&&y.current){let j=x.current.getModifiedEditor(),M=Q(y.current,t||"",s||r||"text",l||"");M!==j.getModel()&&j.setModel(M)}},[l],k),q(()=>{let j=x.current.getModifiedEditor();j.getOption(y.current.editor.EditorOption.readOnly)?j.setValue(t||""):t!==j.getValue()&&(j.executeEdits("",[{range:j.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),j.pushUndoStop())},[t],k),q(()=>{x.current?.getModel()?.original.setValue(e||"")},[e],k),q(()=>{let{original:j,modified:M}=x.current.getModel();y.current.editor.setModelLanguage(j,n||r||"text"),y.current.editor.setModelLanguage(M,s||r||"text")},[r,n,s],k),q(()=>{y.current?.editor.setTheme(f)},[f],k),q(()=>{x.current?.updateOptions(m)},[m],k);let V=c.useCallback(()=>{if(!y.current)return;S.current(y.current);let j=Q(y.current,e||"",n||r||"text",o||""),M=Q(y.current,t||"",s||r||"text",l||"");x.current?.setModel({original:j,modified:M})},[r,t,s,e,n,o,l]),U=c.useCallback(()=>{!$.current&&H.current&&(x.current=y.current.editor.createDiffEditor(H.current,{automaticLayout:!0,...m}),V(),y.current?.editor.setTheme(f),I(!0),$.current=!0)},[m,f,V]);c.useEffect(()=>{k&&_.current(x.current,y.current)},[k]),c.useEffect(()=>{!w&&!k&&U()},[w,k,U]);function F(){let j=x.current?.getModel();u||j?.original?.dispose(),h||j?.modified?.dispose(),x.current?.dispose()}return c.createElement(Tt,{width:R,height:E,isEditorReady:k,loading:d,_ref:H,className:O,wrapperProps:N})}var Tn=Nn;c.memo(Tn);function Rn(){let[e,t]=c.useState(de.__getMonacoInstance());return Ve(()=>{let r;return e||(r=de.init(),r.then(n=>{t(n)})),()=>r?.cancel()}),e}var _n=Rn;function Mn(e){let t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}var In=Mn,ue=new Map;function Pn({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:s,path:o,theme:l="light",line:u,loading:h="Loading...",options:f={},overrideServices:d={},saveViewState:m=!0,keepCurrentModel:E=!1,width:R="100%",height:O="100%",className:N,wrapperProps:p={},beforeMount:T=se,onMount:k=se,onChange:I,onValidate:w=se}){let[b,x]=c.useState(!1),[y,H]=c.useState(!0),_=c.useRef(null),S=c.useRef(null),$=c.useRef(null),V=c.useRef(k),U=c.useRef(T),F=c.useRef(),j=c.useRef(n),M=In(o),P=c.useRef(!1),z=c.useRef(!1);Ve(()=>{let g=de.init();return g.then(C=>(_.current=C)&&H(!1)).catch(C=>C?.type!=="cancelation"&&console.error("Monaco initialization: error:",C)),()=>S.current?i():g.cancel()}),q(()=>{let g=Q(_.current,e||n||"",t||s||"",o||r||"");g!==S.current?.getModel()&&(m&&ue.set(M,S.current?.saveViewState()),S.current?.setModel(g),m&&S.current?.restoreViewState(ue.get(o)))},[o],b),q(()=>{S.current?.updateOptions(f)},[f],b),q(()=>{!S.current||n===void 0||(S.current.getOption(_.current.editor.EditorOption.readOnly)?S.current.setValue(n):n!==S.current.getValue()&&(z.current=!0,S.current.executeEdits("",[{range:S.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),S.current.pushUndoStop(),z.current=!1))},[n],b),q(()=>{let g=S.current?.getModel();g&&s&&_.current?.editor.setModelLanguage(g,s)},[s],b),q(()=>{u!==void 0&&S.current?.revealLine(u)},[u],b),q(()=>{_.current?.editor.setTheme(l)},[l],b);let Z=c.useCallback(()=>{if(!(!$.current||!_.current)&&!P.current){U.current(_.current);let g=o||r,C=Q(_.current,n||e||"",t||s||"",g||"");S.current=_.current?.editor.create($.current,{model:C,automaticLayout:!0,...f},d),m&&S.current.restoreViewState(ue.get(g)),_.current.editor.setTheme(l),u!==void 0&&S.current.revealLine(u),x(!0),P.current=!0}},[e,t,r,n,s,o,f,d,m,l,u]);c.useEffect(()=>{b&&V.current(S.current,_.current)},[b]),c.useEffect(()=>{!y&&!b&&Z()},[y,b,Z]),j.current=n,c.useEffect(()=>{b&&I&&(F.current?.dispose(),F.current=S.current?.onDidChangeModelContent(g=>{z.current||I(S.current.getValue(),g)}))},[b,I]),c.useEffect(()=>{if(b){let g=_.current.editor.onDidChangeMarkers(C=>{let v=S.current.getModel()?.uri;if(v&&C.find(A=>A.path===v.path)){let A=_.current.editor.getModelMarkers({resource:v});w?.(A)}});return()=>{g?.dispose()}}return()=>{}},[b,w]);function i(){F.current?.dispose(),E?m&&ue.set(o,S.current.saveViewState()):S.current.getModel()?.dispose(),S.current.dispose()}return c.createElement(Tt,{width:R,height:O,isEditorReady:b,loading:h,_ref:$,className:N,wrapperProps:p})}var $n=Pn,Dn=c.memo($n),Ln=Dn;const Vn=({value:e,height:t=300,schema:r,onChange:n,onValidate:s,language:o="json",readOnly:l=!1})=>{const u=_n(),h=L.useThemeStore(d=>d.theme),f=c.useMemo(()=>h==="dark"?"vs-dark":"light",[h]);return c.useEffect(()=>{u&&(u.languages.typescript.javascriptDefaults.setCompilerOptions({isolatedModules:!0}),u.languages.json.jsonDefaults.setDiagnosticsOptions({schemas:r?[{uri:window.location.href,fileMatch:["*"],schema:r}]:[]}))},[u,r,o]),a.jsx(Ln,{"data-testid":"json-editor",height:t,language:o,value:e,theme:f,onChange:d=>{d||s?.(!1),n?.(d??"")},onValidate:d=>s?.(d.length===0),options:{readOnly:l,scrollBeyondLastLine:!1,minimap:{enabled:!1}}})},Hn=({state:e})=>{const[t,r]=c.useState(!1),[n,s]=c.useState(!0),[o,l]=c.useState(JSON.stringify(e.value,null,2)),[u,h]=c.useState(!1),[f,d]=c.useState("idle"),m=c.useRef(JSON.stringify(e.value,null,2));c.useEffect(()=>{l(JSON.stringify(e.value,null,2))},[e.value]);const E=c.useCallback(p=>{h(p!==m.current),l(p),d("idle")},[]),R=async()=>{if(!(!n||!u))try{r(!0),d("idle");const p=await fetch("/__motia/state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,groupId:e.groupId,value:JSON.parse(o)})});if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);m.current=o,d("success"),h(!1),setTimeout(()=>{d("idle")},3e3)}catch(p){console.error("Failed to save state:",p),d("error")}finally{r(!1)}},O=c.useCallback(()=>{l(JSON.stringify(e.value,null,2)),h(!1),d("idle")},[e.value]),N=c.useMemo(()=>f==="success"?a.jsx("div",{className:"bg-green-50 dark:bg-green-950/20 border border-green-200 dark:border-green-800 rounded-lg p-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-green-700 dark:text-green-400 text-sm",children:[a.jsx(zt,{className:"w-4 h-4"}),"State saved successfully!"]})}):f==="error"?a.jsx("div",{className:"bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-800 rounded-lg p-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-red-700 dark:text-red-400 text-sm",children:[a.jsx(Ze,{className:"w-4 h-4"}),"Failed to save state. Please try again."]})}):a.jsx("div",{className:"text-xs text-muted-foreground",children:u?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"w-2 h-2 bg-orange-500 rounded-full"}),"Unsaved changes"]}):a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),"Up to date"]})}),[f,u]);return a.jsxs("div",{className:"flex flex-col gap-2 h-full",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Modify the state value using the JSON editor below."}),a.jsx("div",{className:"space-y-3 pt-2 flex flex-col",children:a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Vn,{value:o,onChange:E,onValidate:s,height:"calc(100vh - 300px)"}),!n&&a.jsxs("div",{className:"absolute top-2 right-2 bg-destructive/90 text-destructive-foreground px-2 py-1 rounded text-xs flex items-center gap-1",children:[a.jsx(Ze,{className:"w-3 h-3"}),"Invalid JSON"]})]})}),a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[N,a.jsxs("div",{className:"flex items-center gap-2",children:[u&&a.jsx(L.Button,{variant:"secondary",onClick:O,disabled:t,children:"Reset"}),a.jsx(L.Button,{onClick:R,variant:"accent",disabled:t||!n||!u,"data-testid":"state-save-button",children:t?a.jsxs(a.Fragment,{children:[a.jsx(Bt,{className:"w-3 h-3 animate-spin mr-1"}),"Saving..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Kt,{className:"w-3 h-3 mr-1"}),"Save Changes"]})})]})]})]})},Fn=({state:e,onClose:t})=>a.jsx(L.Sidebar,{onClose:t,title:"State Details",initialWidth:500,tabs:[{label:"Overview",content:a.jsx(Nr,{state:e})},{label:"Editor",content:a.jsx(Hn,{state:e})}],actions:[{icon:a.jsx(jt,{}),onClick:t,label:"Close"}]}),Un=()=>{const e=Be(p=>p.selectedStateId),t=Be(p=>p.selectStateId),{items:r,deleteItems:n,refetch:s}=rr(),[o,l]=c.useState(""),u=c.useMemo(()=>r.filter(p=>p.groupId.toLowerCase().includes(o.toLowerCase())||p.key.toLowerCase().includes(o.toLowerCase())),[r,o]),h=c.useMemo(()=>e?u.find(p=>`${p.groupId}:${p.key}`===e):null,[u,e]),[f,d]=c.useState(new Set),m=p=>t(`${p.groupId}:${p.key}`),E=()=>t(void 0),R=()=>{n(Array.from(f)),d(new Set)},O=p=>{const T=f.has(`${p.groupId}:${p.key}`);d(k=>{const I=new Set(k);return T?I.delete(`${p.groupId}:${p.key}`):I.add(`${p.groupId}:${p.key}`),I})},N=p=>{d(T=>{const k=new Set(T);return p?u.forEach(I=>k.add(`${I.groupId}:${I.key}`)):u.forEach(I=>k.delete(`${I.groupId}:${I.key}`)),k})};return a.jsxs(a.Fragment,{children:[h&&a.jsx(Fn,{state:h,onClose:E}),a.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-full","data-testid":"states-container",children:[a.jsxs("div",{className:"flex p-2 border-b gap-2","data-testid":"logs-search-container",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(L.Input,{variant:"shade",value:o,onChange:p=>l(p.target.value),className:"px-9 font-medium",placeholder:"Search by Group ID or Key"}),a.jsx(Xt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50"}),a.jsx(jt,{className:"cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>l("")})]}),a.jsxs(L.Button,{variant:"default",className:"h-[34px]",disabled:f.size===0,onClick:R,children:[a.jsx(er,{})," Delete"]}),a.jsx(L.Button,{variant:"default",className:"h-[34px]",onClick:s,children:a.jsx(Yt,{className:"w-4 h-4 text-muted-foreground"})})]}),a.jsxs(L.Table,{children:[a.jsx(L.TableHeader,{className:"sticky top-0 bg-background/20 backdrop-blur-sm",children:a.jsxs(L.TableRow,{children:[a.jsx(L.TableHead,{children:a.jsx(L.Checkbox,{onClick:p=>p.stopPropagation(),onCheckedChange:N})}),a.jsx(L.TableHead,{className:"rounded-0",children:"Group ID"}),a.jsx(L.TableHead,{children:"Key"}),a.jsx(L.TableHead,{children:"Type"})]})}),a.jsx(L.TableBody,{children:u.map(p=>a.jsxs(L.TableRow,{"data-testid":`item-${p}`,onClick:()=>m(p),className:L.cn("font-mono font-semibold cursor-pointer border-0",h===p?"bg-muted-foreground/10 hover:bg-muted-foreground/20":"hover:bg-muted-foreground/10"),children:[a.jsx(L.TableCell,{onClick:T=>T.stopPropagation(),children:a.jsx(L.Checkbox,{checked:f.has(`${p.groupId}:${p.key}`),onClick:()=>O(p)})}),a.jsx(L.TableCell,{className:"hover:bg-transparent",children:p.groupId}),a.jsx(L.TableCell,{className:"hover:bg-transparent",children:p.key}),a.jsx(L.TableCell,{className:"hover:bg-transparent",children:p.type})]},`${p.groupId}:${p.key}`))})]})]})]})};exports.StatesPage=Un;
|
|
16
|
+
`},mt=tn(sn)(Et),on={config:nn},cn=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(s){return r.reduceRight(function(i,l){return l(i)},s)}};function Ot(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],Ot(e[r],t[r]))}),gt(gt({},e),t)}var ln={type:"cancelation",msg:"operation is manually canceled"};function ye(e){var t=!1,r=new Promise(function(n,s){e.then(function(i){return t?s(ln):n(i)}),e.catch(s)});return r.cancel=function(){return t=!0},r}var un=["monaco"],fn=Qr.create({config:en,isInitialized:!1,resolve:null,reject:null,monaco:null}),kt=Ir(fn,2),ie=kt[0],he=kt[1];function dn(e){var t=on.config(e),r=t.monaco,n=Mr(t,un);he(function(s){return{config:Ot(s.config,n),monaco:r}})}function pn(){var e=ie(function(t){var r=t.monaco,n=t.isInitialized,s=t.resolve;return{monaco:r,isInitialized:n,resolve:s}});if(!e.isInitialized){if(he({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),ye(be);if(window.monaco&&window.monaco.editor)return At(window.monaco),e.resolve(window.monaco),ye(be);cn(gn,vn)(mn)}return ye(be)}function gn(e){return document.body.appendChild(e)}function hn(e){var t=document.createElement("script");return e&&(t.src=e),t}function vn(e){var t=ie(function(n){var s=n.config,i=n.reject;return{config:s,reject:i}}),r=hn("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function mn(){var e=ie(function(r){var n=r.config,s=r.resolve,i=r.reject;return{config:n,resolve:s,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var n=r.m;At(n),e.resolve(n)},function(r){e.reject(r)})}function At(e){ie().monaco||he({monaco:e})}function yn(){return ie(function(e){var t=e.monaco;return t})}var be=new Promise(function(e,t){return he({resolve:e,reject:t})}),de={config:dn,init:pn,__getMonacoInstance:yn},bn={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},je=bn,jn={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},wn=jn;function xn({children:e}){return c.createElement("div",{style:wn.container},e)}var Cn=xn,Sn=Cn;function En({width:e,height:t,isEditorReady:r,loading:n,_ref:s,className:i,wrapperProps:l}){return c.createElement("section",{style:{...je.wrapper,width:e,height:t},...l},!r&&c.createElement(Sn,null,n),c.createElement("div",{ref:s,style:{...je.fullWidth,...!r&&je.hide},className:i}))}var On=En,Nt=c.memo(On);function kn(e){c.useEffect(e,[])}var Le=kn;function An(e,t,r=!0){let n=c.useRef(!0);c.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var B=An;function se(){}function Q(e,t,r,n){return Nn(e,n)||Tn(e,t,r,n)}function Nn(e,t){return e.editor.getModel(Tt(e,t))}function Tn(e,t,r,n){return e.editor.createModel(t,r,n?Tt(e,n):void 0)}function Tt(e,t){return e.Uri.parse(t)}function _n({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:s,originalModelPath:i,modifiedModelPath:l,keepCurrentOriginalModel:u=!1,keepCurrentModifiedModel:h=!1,theme:f="light",loading:d="Loading...",options:m={},height:O="100%",width:k="100%",className:S,wrapperProps:_={},beforeMount:p=se,onMount:N=se}){let[A,M]=c.useState(!1),[x,y]=c.useState(!0),C=c.useRef(null),b=c.useRef(null),F=c.useRef(null),T=c.useRef(N),E=c.useRef(p),V=c.useRef(!1);Le(()=>{let j=de.init();return j.then(R=>(b.current=R)&&y(!1)).catch(R=>R?.type!=="cancelation"&&console.error("Monaco initialization: error:",R)),()=>C.current?z():j.cancel()}),B(()=>{if(C.current&&b.current){let j=C.current.getOriginalEditor(),R=Q(b.current,e||"",n||r||"text",i||"");R!==j.getModel()&&j.setModel(R)}},[i],A),B(()=>{if(C.current&&b.current){let j=C.current.getModifiedEditor(),R=Q(b.current,t||"",s||r||"text",l||"");R!==j.getModel()&&j.setModel(R)}},[l],A),B(()=>{let j=C.current.getModifiedEditor();j.getOption(b.current.editor.EditorOption.readOnly)?j.setValue(t||""):t!==j.getValue()&&(j.executeEdits("",[{range:j.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),j.pushUndoStop())},[t],A),B(()=>{C.current?.getModel()?.original.setValue(e||"")},[e],A),B(()=>{let{original:j,modified:R}=C.current.getModel();b.current.editor.setModelLanguage(j,n||r||"text"),b.current.editor.setModelLanguage(R,s||r||"text")},[r,n,s],A),B(()=>{b.current?.editor.setTheme(f)},[f],A),B(()=>{C.current?.updateOptions(m)},[m],A);let D=c.useCallback(()=>{if(!b.current)return;E.current(b.current);let j=Q(b.current,e||"",n||r||"text",i||""),R=Q(b.current,t||"",s||r||"text",l||"");C.current?.setModel({original:j,modified:R})},[r,t,s,e,n,i,l]),H=c.useCallback(()=>{!V.current&&F.current&&(C.current=b.current.editor.createDiffEditor(F.current,{automaticLayout:!0,...m}),D(),b.current?.editor.setTheme(f),M(!0),V.current=!0)},[m,f,D]);c.useEffect(()=>{A&&T.current(C.current,b.current)},[A]),c.useEffect(()=>{!x&&!A&&H()},[x,A,H]);function z(){let j=C.current?.getModel();u||j?.original?.dispose(),h||j?.modified?.dispose(),C.current?.dispose()}return c.createElement(Nt,{width:k,height:O,isEditorReady:A,loading:d,_ref:F,className:S,wrapperProps:_})}var Rn=_n;c.memo(Rn);function Mn(){let[e,t]=c.useState(de.__getMonacoInstance());return Le(()=>{let r;return e||(r=de.init(),r.then(n=>{t(n)})),()=>r?.cancel()}),e}var Pn=Mn;function In(e){let t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}var $n=In,ue=new Map;function Dn({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:s,path:i,theme:l="light",line:u,loading:h="Loading...",options:f={},overrideServices:d={},saveViewState:m=!0,keepCurrentModel:O=!1,width:k="100%",height:S="100%",className:_,wrapperProps:p={},beforeMount:N=se,onMount:A=se,onChange:M,onValidate:x=se}){let[y,C]=c.useState(!1),[b,F]=c.useState(!0),T=c.useRef(null),E=c.useRef(null),V=c.useRef(null),D=c.useRef(A),H=c.useRef(N),z=c.useRef(),j=c.useRef(n),R=$n(i),P=c.useRef(!1),Z=c.useRef(!1);Le(()=>{let o=de.init();return o.then(v=>(T.current=v)&&F(!1)).catch(v=>v?.type!=="cancelation"&&console.error("Monaco initialization: error:",v)),()=>E.current?I():o.cancel()}),B(()=>{let o=Q(T.current,e||n||"",t||s||"",i||r||"");o!==E.current?.getModel()&&(m&&ue.set(R,E.current?.saveViewState()),E.current?.setModel(o),m&&E.current?.restoreViewState(ue.get(i)))},[i],y),B(()=>{E.current?.updateOptions(f)},[f],y),B(()=>{!E.current||n===void 0||(E.current.getOption(T.current.editor.EditorOption.readOnly)?E.current.setValue(n):n!==E.current.getValue()&&(Z.current=!0,E.current.executeEdits("",[{range:E.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),E.current.pushUndoStop(),Z.current=!1))},[n],y),B(()=>{let o=E.current?.getModel();o&&s&&T.current?.editor.setModelLanguage(o,s)},[s],y),B(()=>{u!==void 0&&E.current?.revealLine(u)},[u],y),B(()=>{T.current?.editor.setTheme(l)},[l],y);let J=c.useCallback(()=>{if(!(!V.current||!T.current)&&!P.current){H.current(T.current);let o=i||r,v=Q(T.current,n||e||"",t||s||"",o||"");E.current=T.current?.editor.create(V.current,{model:v,automaticLayout:!0,...f},d),m&&E.current.restoreViewState(ue.get(o)),T.current.editor.setTheme(l),u!==void 0&&E.current.revealLine(u),C(!0),P.current=!0}},[e,t,r,n,s,i,f,d,m,l,u]);c.useEffect(()=>{y&&D.current(E.current,T.current)},[y]),c.useEffect(()=>{!b&&!y&&J()},[b,y,J]),j.current=n,c.useEffect(()=>{y&&M&&(z.current?.dispose(),z.current=E.current?.onDidChangeModelContent(o=>{Z.current||M(E.current.getValue(),o)}))},[y,M]),c.useEffect(()=>{if(y){let o=T.current.editor.onDidChangeMarkers(v=>{let g=E.current.getModel()?.uri;if(g&&v.find(w=>w.path===g.path)){let w=T.current.editor.getModelMarkers({resource:g});x?.(w)}});return()=>{o?.dispose()}}return()=>{}},[y,x]);function I(){z.current?.dispose(),O?m&&ue.set(i,E.current.saveViewState()):E.current.getModel()?.dispose(),E.current.dispose()}return c.createElement(Nt,{width:k,height:S,isEditorReady:y,loading:h,_ref:V,className:_,wrapperProps:p})}var Ln=Dn,Vn=c.memo(Ln),Hn=Vn;const Fn=({value:e,height:t=300,schema:r,onChange:n,onValidate:s,language:i="json",readOnly:l=!1})=>{const u=Pn(),h=L.useThemeStore(d=>d.theme),f=c.useMemo(()=>h==="dark"?"vs-dark":"light",[h]);return c.useEffect(()=>{u&&(u.languages.typescript.javascriptDefaults.setCompilerOptions({isolatedModules:!0}),u.languages.json.jsonDefaults.setDiagnosticsOptions({schemas:r?[{uri:window.location.href,fileMatch:["*"],schema:r}]:[]}))},[u,r,i]),a.jsx(Hn,{"data-testid":"json-editor",height:t,language:i,value:e,theme:f,onChange:d=>{d||s?.(!1),n?.(d??"")},onValidate:d=>s?.(d.length===0),options:{readOnly:l,scrollBeyondLastLine:!1,minimap:{enabled:!1}}})},Un=({state:e})=>{const[t,r]=c.useState(!1),[n,s]=c.useState(!0),[i,l]=c.useState(JSON.stringify(e.value,null,2)),[u,h]=c.useState(!1),[f,d]=c.useState("idle"),m=c.useRef(JSON.stringify(e.value,null,2));c.useEffect(()=>{l(JSON.stringify(e.value,null,2))},[e.value]);const O=c.useCallback(p=>{h(p!==m.current),l(p),d("idle")},[]),k=async()=>{if(!(!n||!u))try{r(!0),d("idle");const p=await fetch("/__motia/state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,groupId:e.groupId,value:JSON.parse(i)})});if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);m.current=i,d("success"),h(!1),setTimeout(()=>{d("idle")},3e3)}catch(p){console.error("Failed to save state:",p),d("error")}finally{r(!1)}},S=c.useCallback(()=>{l(JSON.stringify(e.value,null,2)),h(!1),d("idle")},[e.value]),_=c.useMemo(()=>f==="success"?a.jsx("div",{className:"bg-green-50 dark:bg-green-950/20 border border-green-200 dark:border-green-800 rounded-lg p-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-green-700 dark:text-green-400 text-sm",children:[a.jsx(Sr,{className:"w-4 h-4"}),"State saved successfully!"]})}):f==="error"?a.jsx("div",{className:"bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-800 rounded-lg p-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-red-700 dark:text-red-400 text-sm",children:[a.jsx(ft,{className:"w-4 h-4"}),"Failed to save state. Please try again."]})}):a.jsx("div",{className:"text-xs text-muted-foreground",children:u?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"w-2 h-2 bg-orange-500 rounded-full"}),"Unsaved changes"]}):a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),"Up to date"]})}),[f,u]);return a.jsxs("div",{className:"flex flex-col gap-2 h-full",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Modify the state value using the JSON editor below."}),a.jsx("div",{className:"space-y-3 pt-2 flex flex-col",children:a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Fn,{value:i,onChange:O,onValidate:s,height:"calc(100vh - 300px)"}),!n&&a.jsxs("div",{className:"absolute top-2 right-2 bg-destructive/90 text-destructive-foreground px-2 py-1 rounded text-xs flex items-center gap-1",children:[a.jsx(ft,{className:"w-3 h-3"}),"Invalid JSON"]})]})}),a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[_,a.jsxs("div",{className:"flex items-center gap-2",children:[u&&a.jsx(L.Button,{variant:"secondary",onClick:S,disabled:t,children:"Reset"}),a.jsx(L.Button,{onClick:k,variant:"accent",disabled:t||!n||!u,"data-testid":"state-save-button",children:t?a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3 animate-spin mr-1"}),"Saving..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ar,{className:"w-3 h-3 mr-1"}),"Save Changes"]})})]})]})]})},zn=({state:e,onClose:t})=>a.jsx(L.Sidebar,{onClose:t,title:"State Details",initialWidth:500,tabs:[{label:"Overview",content:a.jsx(wr,{state:e})},{label:"Editor",content:a.jsx(Un,{state:e})}],actions:[{icon:a.jsx(bt,{}),onClick:t,label:"Close"}]}),Zn=()=>{const e=Ze(p=>p.selectedStateId),t=Ze(p=>p.selectStateId),{items:r,deleteItems:n,refetch:s}=Yt(),[i,l]=c.useState(""),u=c.useMemo(()=>r.filter(p=>p.groupId.toLowerCase().includes(i.toLowerCase())||p.key.toLowerCase().includes(i.toLowerCase())),[r,i]),h=c.useMemo(()=>e?u.find(p=>`${p.groupId}:${p.key}`===e):null,[u,e]),[f,d]=c.useState(new Set),m=p=>t(`${p.groupId}:${p.key}`),O=()=>t(void 0),k=()=>{n(Array.from(f)),d(new Set)},S=p=>{const N=f.has(`${p.groupId}:${p.key}`);d(A=>{const M=new Set(A);return N?M.delete(`${p.groupId}:${p.key}`):M.add(`${p.groupId}:${p.key}`),M})},_=p=>{d(N=>{const A=new Set(N);return p?u.forEach(M=>A.add(`${M.groupId}:${M.key}`)):u.forEach(M=>A.delete(`${M.groupId}:${M.key}`)),A})};return a.jsxs(a.Fragment,{children:[h&&a.jsx(zn,{state:h,onClose:O}),a.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-full","data-testid":"states-container",children:[a.jsxs("div",{className:"flex p-2 border-b gap-2","data-testid":"logs-search-container",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(L.Input,{variant:"shade",value:i,onChange:p=>l(p.target.value),className:"px-9 font-medium",placeholder:"Search by Group ID or Key"}),a.jsx(Zt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50"}),a.jsx(bt,{className:"cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>l("")})]}),a.jsxs(L.Button,{variant:"default",className:"h-[34px]",disabled:f.size===0,onClick:k,children:[a.jsx(Bt,{})," Delete"]}),a.jsx(L.Button,{variant:"default",className:"h-[34px]",onClick:s,children:a.jsx(Ut,{className:"w-4 h-4 text-muted-foreground"})})]}),a.jsxs(L.Table,{children:[a.jsx(L.TableHeader,{className:"sticky top-0 bg-background/20 backdrop-blur-sm",children:a.jsxs(L.TableRow,{children:[a.jsx(L.TableHead,{children:a.jsx(L.Checkbox,{onClick:p=>p.stopPropagation(),onCheckedChange:_})}),a.jsx(L.TableHead,{className:"rounded-0",children:"Group ID"}),a.jsx(L.TableHead,{children:"Key"}),a.jsx(L.TableHead,{children:"Type"})]})}),a.jsx(L.TableBody,{children:u.map(p=>a.jsxs(L.TableRow,{"data-testid":`item-${p}`,onClick:()=>m(p),className:L.cn("font-mono font-semibold cursor-pointer border-0",h===p?"bg-muted-foreground/10 hover:bg-muted-foreground/20":"hover:bg-muted-foreground/10"),children:[a.jsx(L.TableCell,{onClick:N=>N.stopPropagation(),children:a.jsx(L.Checkbox,{checked:f.has(`${p.groupId}:${p.key}`),onClick:()=>S(p)})}),a.jsx(L.TableCell,{className:"hover:bg-transparent",children:p.groupId}),a.jsx(L.TableCell,{className:"hover:bg-transparent",children:p.key}),a.jsx(L.TableCell,{className:"hover:bg-transparent",children:p.type})]},`${p.groupId}:${p.key}`))})]})]})]})};exports.StatesPage=Zn;
|