@motiadev/plugin-states 0.13.0-beta.162-380543 → 0.13.0-beta.162-415452

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/LICENSE CHANGED
@@ -1,21 +1,93 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Motia
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject
14
+ to the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
27
+ of the licensor in the software. Any use of the licensor's trademarks is subject
28
+ to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately. If your company makes
40
+ such a claim, your patent license ends immediately for work on behalf of your
41
+ company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from you
46
+ also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not licensed,
59
+ and your licenses will automatically terminate. If the licensor provides you
60
+ with a notice of your violation, and you cease all violation of this license no
61
+ later than 30 days after you receive that notice, your licenses will be
62
+ reinstated retroactively. However, if you violate these terms after such
63
+ reinstatement, any additional violation of these terms will cause your licenses
64
+ to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ *As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising
70
+ out of these terms or the use or nature of the software, under any kind of
71
+ legal claim.*
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is the
76
+ software the licensor makes available under these terms, including any portion
77
+ of it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over,
83
+ are under the control of, or are under common control with that organization.
84
+ **control** means ownership of substantially all the assets of an entity, or the
85
+ power to direct its management and policies by vote, contract, or otherwise.
86
+ Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under
89
+ these terms.
90
+
91
+ **use** means anything you do with the software requiring one of your licenses.
92
+
93
+ **trademark** means trademarks, service marks, and similar rights.
package/dist/api.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { MotiaPluginContext } from '@motiadev/core';
2
+ export declare const api: (motia: MotiaPluginContext) => void;
3
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwC,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAE9F,eAAO,MAAM,GAAG,GAAI,OAAO,kBAAkB,KAAG,IAwE/C,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { FC } from 'react';
2
+ type JsonEditorProps = {
3
+ value: string;
4
+ height?: number | string;
5
+ schema?: Record<string, unknown>;
6
+ onChange?: (value: string) => void;
7
+ onValidate?: (isValid: boolean) => void;
8
+ language?: string;
9
+ readOnly?: boolean;
10
+ };
11
+ export declare const JsonEditor: FC<JsonEditorProps>;
12
+ export {};
13
+ //# sourceMappingURL=json-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-editor.d.ts","sourceRoot":"","sources":["../../src/components/json-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAA;AAEnD,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAmD1C,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { StateItem } from '../types/state';
3
+ type Props = {
4
+ state: StateItem;
5
+ };
6
+ export declare const StateDetails: React.FC<Props>;
7
+ export {};
8
+ //# sourceMappingURL=state-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-details.d.ts","sourceRoot":"","sources":["../../src/components/state-details.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAiE,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { StateItem } from '../types/state';
3
+ type Props = {
4
+ state: StateItem;
5
+ };
6
+ export declare const StateEditor: React.FC<Props>;
7
+ export {};
8
+ //# sourceMappingURL=state-editor.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ import { StateItem } from '../types/state';
3
+ type Props = {
4
+ state: StateItem;
5
+ onClose: () => void;
6
+ };
7
+ export declare const StateSidebar: React.FC<Props>;
8
+ export {};
9
+ //# sourceMappingURL=state-sidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-sidebar.d.ts","sourceRoot":"","sources":["../../src/components/state-sidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI/C,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,SAAS,CAAA;IAChB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAmBxC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const StatesTabLabel: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ //# sourceMappingURL=state-tab-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-tab-label.d.ts","sourceRoot":"","sources":["../../src/components/state-tab-label.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,oFAKzB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const StatesPage: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=states-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"states-page.d.ts","sourceRoot":"","sources":["../../src/components/states-page.tsx"],"names":[],"mappings":"AAsBA,eAAO,MAAM,UAAU,+CAwHtB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { StateItem } from '../types/state';
2
+ type Output = {
3
+ items: StateItem[];
4
+ deleteItems: (ids: string[]) => void;
5
+ refetch: () => void;
6
+ };
7
+ export declare const useGetStateItems: () => Output;
8
+ export {};
9
+ //# sourceMappingURL=states-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"states-hooks.d.ts","sourceRoot":"","sources":["../../src/hooks/states-hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACpC,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAO,MA6BnC,CAAA"}
package/dist/index.cjs ADDED
@@ -0,0 +1,92 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),L=require("@motiadev/ui");function Mt(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 D=Mt(c);var ce={exports:{}},te={};/**
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:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ 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
+ * @license lucide-react v0.545.0 - ISC
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:"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"}]],zt=W("refresh-cw",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=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Jt=W("search",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 Bt=[["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"}]],qt=W("trash",Bt);/**
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 Yt=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jt=W("x",Yt),Wt=()=>{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 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},Kt=e=>e?Ze(e):Ze,Gt=e=>e;function Xt(e,t=Gt){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 Qt=e=>{const t=Kt(e),r=n=>Xt(t,n);return Object.assign(r,t),r},er=e=>Qt,Je=er()(e=>({selectedStateId:void 0,selectStateId:t=>e({selectedStateId:t})}));function tr(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 rr=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()}},nr=rr,Be={"text/plain":"Text","text/html":"Url",default:"Text"},ar="Copy to clipboard: #{key}, Enter";function sr(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function or(e,t){var r,n,s,o,l,u,h=!1;t||(t={}),r=t.debug||!1;try{s=nr(),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=Be[t.format]||Be.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=sr("message"in t?t.message:ar),window.prompt(n,e)}}finally{l&&(typeof l.removeRange=="function"?l.removeRange(o):l.removeAllRanges()),u&&document.body.removeChild(u),s()}return h}var ir=or;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 cr(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 lr(e){return tr(this,void 0,void 0,function*(){try{yield navigator.clipboard.writeText(e)}catch{ir(e)}})}function qe(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 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=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 We(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 ur(e){return typeof e=="function"}function xt(e){return!e||e.add===void 0||!!e.add}function Ke(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 fr(e){return!e||e.matchesURL===void 0||!!e.matchesURL}function dr(e,t){return e==="string"?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t}var 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 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),Ge||(Ge=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"})))},Xe;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 D.createElement("svg",Ce({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),Xe||(Xe=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"})))},Qe,et;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 gr=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),Qe||(Qe=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"})),et||(et=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&&lr(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(gr,{className:"json-view--copy",style:{display:"inline-block"}}):typeof n=="function"?a.jsx(n,{onClick:u,className:"json-view--copy"}):a.jsx(pr,{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 tt,rt;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),tt||(tt=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"})),rt||(rt=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"})))},nt,at;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),nt||(nt=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"})),at||(at=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"})))},st,ot;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),st||(st=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"})),ot||(ot=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"})))},it,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 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),it||(it=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"})),ct||(ct=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 hr({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 vr({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(Ye(e,t,n,f,m,s));c.useEffect(()=>{b(Ye(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(hr,{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 mr({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(vr,{node:e,depth:t,indexOrName:r,deleteHandle:n,customOptions:s,parentPath:b});const x=K(e),[y,H]=c.useState(qe(e,t,r,u,m,s)),_=v=>{h?.({isCollapsing:!v,node:e,depth:t,indexOrName:r}),H(v)};c.useEffect(()=>{_(qe(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 br=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 lt;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 yr=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),lt||(lt=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"})))},ut,ft;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 jr=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),ut||(ut=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"})),ft||(ft=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(ur(w)){const b=w;return a.jsx(b,{node:e,depth:t,indexOrName:n})}}if(Array.isArray(e)||K(e))return a.jsx(mr,{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=dr(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&&We(f)&&Ke(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)&&fr(w)&&a.jsx("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:a.jsx(jr,{})})),!P&&We(f)&&Ke(w)&&o&&(typeof p=="function"?a.jsx(p,{className:"json-view--edit",onClick:V}):a.jsx(yr,{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(br,{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 wr({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=>cr(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 xr=({state:e})=>a.jsx(wr,{src:e.value,theme:"default"});/**
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 Cr=[["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"}]],dt=W("circle-alert",Cr);/**
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 Sr=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Er=W("check",Sr);/**
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 Or=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kr=W("loader-circle",Or);/**
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 Ar=[["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"}]],Nr=W("save",Ar);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!
84
+ You are using deprecated way of configuration.
85
+
86
+ Instead of using
87
+ monaco.config({ urls: { monacoBase: '...' } })
88
+ use
89
+ monaco.config({ paths: { vs: '...' } })
90
+
91
+ 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(Er,{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(dt,{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(dt,{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(kr,{className:"w-3 h-3 animate-spin mr-1"}),"Saving..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Nr,{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(xr,{state:e})},{label:"Editor",content:a.jsx(Hn,{state:e})}],actions:[{icon:a.jsx(jt,{}),onClick:t,label:"Close"}]}),Un=()=>{const e=Je(p=>p.selectedStateId),t=Je(p=>p.selectStateId),{items:r,deleteItems:n,refetch:s}=Wt(),[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(Jt,{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(qt,{})," Delete"]}),a.jsx(L.Button,{variant:"default",className:"h-[34px]",onClick:s,children:a.jsx(zt,{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;
package/dist/index.d.ts CHANGED
@@ -1,15 +1,3 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
-
3
- //#region src/components/states-page.d.ts
4
- declare const StatesPage: () => react_jsx_runtime0.JSX.Element;
5
- //#endregion
6
- //#region src/types/state.d.ts
7
- interface StateItem {
8
- groupId: string;
9
- key: string;
10
- type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'null';
11
- value: string | number | boolean | object | unknown[] | null;
12
- }
13
- //#endregion
14
- export { type StateItem, StatesPage };
1
+ export { StatesPage } from './components/states-page';
2
+ export type { StateItem } from './types/state';
15
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/states-page.tsx","../src/types/state.ts"],"sourcesContent":[],"mappings":";;;cAmBa,kBAAU,kBAAA,CAAA,GAAA,CAAA;;;UCnBN,SAAA;;;EDmBJ,IAAA,EAAA,QA4HZ,GAAA,QA5HsB,GAAA,SAAA,GAAA,QAAA,GAAA,OA4HtB,GAAA,MAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA"}