superleap-code-editor 1.0.5 → 1.0.6

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.
@@ -5,6 +5,7 @@ interface EditorLayoutProps {
5
5
  rightPanel: React.ReactNode | false;
6
6
  activePanel: string;
7
7
  setActivePanel: (panel: string) => void;
8
+ allowedPannels?: string[];
8
9
  }
9
10
  export declare const EditorLayout: React.FC<EditorLayoutProps>;
10
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"editorLayout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/editorLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,iBAAiB;IACzB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,UAAU,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AACD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuDpD,CAAC"}
1
+ {"version":3,"file":"editorLayout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/editorLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,iBAAiB;IACzB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,UAAU,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AACD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA4DpD,CAAC"}
@@ -2,7 +2,7 @@ import React from "react";
2
2
  interface SidebarProps {
3
3
  activePanel: string;
4
4
  setActivePanel: (panel: string) => void;
5
- allowedRoutes?: string[];
5
+ allowedPannels: string[];
6
6
  }
7
7
  export declare const Sidebar: React.FC<SidebarProps>;
8
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":[],"mappings":"AASA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,UAAU,YAAY;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AA4BD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA8B1C,CAAC"}
1
+ {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":[],"mappings":"AASA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,UAAU,YAAY;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AA4BD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA8B1C,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react"),jt=require("@monaco-editor/react"),w=require("antd"),h=require("@tabler/icons-react");var q={exports:{}},L={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),jt=require("@monaco-editor/react"),N=require("antd"),h=require("@tabler/icons-react");var q={exports:{}},L={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Se;function Et(){if(Se)return L;Se=1;var o=E,r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,c=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g={key:!0,ref:!0,__self:!0,__source:!0};function N(C,v,R){var d,F={},S=null,O=null;R!==void 0&&(S=""+R),v.key!==void 0&&(S=""+v.key),v.ref!==void 0&&(O=v.ref);for(d in v)i.call(v,d)&&!g.hasOwnProperty(d)&&(F[d]=v[d]);if(C&&C.defaultProps)for(d in v=C.defaultProps,v)F[d]===void 0&&(F[d]=v[d]);return{$$typeof:r,type:C,key:S,ref:O,props:F,_owner:c.current}}return L.Fragment=a,L.jsx=N,L.jsxs=N,L}var $={};/**
9
+ */var Se;function Et(){if(Se)return L;Se=1;var o=w,r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,c=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g={key:!0,ref:!0,__self:!0,__source:!0};function j(C,v,R){var d,F={},S=null,O=null;R!==void 0&&(S=""+R),v.key!==void 0&&(S=""+v.key),v.ref!==void 0&&(O=v.ref);for(d in v)i.call(v,d)&&!g.hasOwnProperty(d)&&(F[d]=v[d]);if(C&&C.defaultProps)for(d in v=C.defaultProps,v)F[d]===void 0&&(F[d]=v[d]);return{$$typeof:r,type:C,key:S,ref:O,props:F,_owner:c.current}}return L.Fragment=a,L.jsx=j,L.jsxs=j,L}var $={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,15 +14,15 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var _e;function wt(){return _e||(_e=1,process.env.NODE_ENV!=="production"&&(function(){var o=E,r=Symbol.for("react.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),N=Symbol.for("react.provider"),C=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),M=Symbol.iterator,J="@@iterator";function G(e){if(e===null||typeof e!="object")return null;var n=M&&e[M]||e[J];return typeof n=="function"?n:null}var b=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(e){{for(var n=arguments.length,s=new Array(n>1?n-1:0),l=1;l<n;l++)s[l-1]=arguments[l];We("error",e,s)}}function We(e,n,s){{var l=b.ReactDebugCurrentFrame,m=l.getStackAddendum();m!==""&&(n+="%s",s=s.concat([m]));var x=s.map(function(f){return String(f)});x.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,x)}}var Ve=!1,Ye=!1,Ue=!1,qe=!1,He=!1,ne;ne=Symbol.for("react.module.reference");function Je(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===g||He||e===c||e===R||e===d||qe||e===O||Ve||Ye||Ue||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===F||e.$$typeof===N||e.$$typeof===C||e.$$typeof===v||e.$$typeof===ne||e.getModuleId!==void 0))}function Ge(e,n,s){var l=e.displayName;if(l)return l;var m=n.displayName||n.name||"";return m!==""?s+"("+m+")":s}function ae(e){return e.displayName||"Context"}function I(e){if(e==null)return null;if(typeof e.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case a:return"Portal";case g:return"Profiler";case c:return"StrictMode";case R:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case C:var n=e;return ae(n)+".Consumer";case N:var s=e;return ae(s._context)+".Provider";case v:return Ge(e,e.render,"ForwardRef");case F:var l=e.displayName||null;return l!==null?l:I(e.type)||"Memo";case S:{var m=e,x=m._payload,f=m._init;try{return I(f(x))}catch{return null}}}return null}var k=Object.assign,z=0,se,ie,oe,le,ce,de,ue;function fe(){}fe.__reactDisabledLog=!0;function Ke(){{if(z===0){se=console.log,ie=console.info,oe=console.warn,le=console.error,ce=console.group,de=console.groupCollapsed,ue=console.groupEnd;var e={configurable:!0,enumerable:!0,value:fe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function Xe(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},e,{value:se}),info:k({},e,{value:ie}),warn:k({},e,{value:oe}),error:k({},e,{value:le}),group:k({},e,{value:ce}),groupCollapsed:k({},e,{value:de}),groupEnd:k({},e,{value:ue})})}z<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=b.ReactCurrentDispatcher,X;function B(e,n,s){{if(X===void 0)try{throw Error()}catch(m){var l=m.stack.trim().match(/\n( *(at )?)/);X=l&&l[1]||""}return`
17
+ */var _e;function wt(){return _e||(_e=1,process.env.NODE_ENV!=="production"&&(function(){var o=w,r=Symbol.for("react.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),j=Symbol.for("react.provider"),C=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),M=Symbol.iterator,J="@@iterator";function G(e){if(e===null||typeof e!="object")return null;var n=M&&e[M]||e[J];return typeof n=="function"?n:null}var b=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(e){{for(var n=arguments.length,s=new Array(n>1?n-1:0),l=1;l<n;l++)s[l-1]=arguments[l];We("error",e,s)}}function We(e,n,s){{var l=b.ReactDebugCurrentFrame,m=l.getStackAddendum();m!==""&&(n+="%s",s=s.concat([m]));var x=s.map(function(f){return String(f)});x.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,x)}}var Ve=!1,Ye=!1,Ue=!1,qe=!1,He=!1,ne;ne=Symbol.for("react.module.reference");function Je(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===g||He||e===c||e===R||e===d||qe||e===O||Ve||Ye||Ue||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===F||e.$$typeof===j||e.$$typeof===C||e.$$typeof===v||e.$$typeof===ne||e.getModuleId!==void 0))}function Ge(e,n,s){var l=e.displayName;if(l)return l;var m=n.displayName||n.name||"";return m!==""?s+"("+m+")":s}function ae(e){return e.displayName||"Context"}function I(e){if(e==null)return null;if(typeof e.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case a:return"Portal";case g:return"Profiler";case c:return"StrictMode";case R:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case C:var n=e;return ae(n)+".Consumer";case j:var s=e;return ae(s._context)+".Provider";case v:return Ge(e,e.render,"ForwardRef");case F:var l=e.displayName||null;return l!==null?l:I(e.type)||"Memo";case S:{var m=e,x=m._payload,f=m._init;try{return I(f(x))}catch{return null}}}return null}var k=Object.assign,z=0,se,ie,oe,le,ce,de,ue;function fe(){}fe.__reactDisabledLog=!0;function Ke(){{if(z===0){se=console.log,ie=console.info,oe=console.warn,le=console.error,ce=console.group,de=console.groupCollapsed,ue=console.groupEnd;var e={configurable:!0,enumerable:!0,value:fe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function Xe(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},e,{value:se}),info:k({},e,{value:ie}),warn:k({},e,{value:oe}),error:k({},e,{value:le}),group:k({},e,{value:ce}),groupCollapsed:k({},e,{value:de}),groupEnd:k({},e,{value:ue})})}z<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=b.ReactCurrentDispatcher,X;function B(e,n,s){{if(X===void 0)try{throw Error()}catch(m){var l=m.stack.trim().match(/\n( *(at )?)/);X=l&&l[1]||""}return`
18
18
  `+X+e}}var Z=!1,W;{var Ze=typeof WeakMap=="function"?WeakMap:Map;W=new Ze}function me(e,n){if(!e||Z)return"";{var s=W.get(e);if(s!==void 0)return s}var l;Z=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var x;x=K.current,K.current=null,Ke();try{if(n){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(P){l=P}Reflect.construct(e,[],f)}else{try{f.call()}catch(P){l=P}e.call(f.prototype)}}else{try{throw Error()}catch(P){l=P}e()}}catch(P){if(P&&l&&typeof P.stack=="string"){for(var u=P.stack.split(`
19
19
  `),_=l.stack.split(`
20
- `),y=u.length-1,j=_.length-1;y>=1&&j>=0&&u[y]!==_[j];)j--;for(;y>=1&&j>=0;y--,j--)if(u[y]!==_[j]){if(y!==1||j!==1)do if(y--,j--,j<0||u[y]!==_[j]){var T=`
21
- `+u[y].replace(" at new "," at ");return e.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",e.displayName)),typeof e=="function"&&W.set(e,T),T}while(y>=1&&j>=0);break}}}finally{Z=!1,K.current=x,Xe(),Error.prepareStackTrace=m}var A=e?e.displayName||e.name:"",Re=A?B(A):"";return typeof e=="function"&&W.set(e,Re),Re}function Qe(e,n,s){return me(e,!1)}function et(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function V(e,n,s){if(e==null)return"";if(typeof e=="function")return me(e,et(e));if(typeof e=="string")return B(e);switch(e){case R:return B("Suspense");case d:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Qe(e.render);case F:return V(e.type,n,s);case S:{var l=e,m=l._payload,x=l._init;try{return V(x(m),n,s)}catch{}}}return""}var Y=Object.prototype.hasOwnProperty,he={},pe=b.ReactDebugCurrentFrame;function U(e){if(e){var n=e._owner,s=V(e.type,e._source,n?n.type:null);pe.setExtraStackFrame(s)}else pe.setExtraStackFrame(null)}function tt(e,n,s,l,m){{var x=Function.call.bind(Y);for(var f in e)if(x(e,f)){var u=void 0;try{if(typeof e[f]!="function"){var _=Error((l||"React class")+": "+s+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}u=e[f](n,f,l,s,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(y){u=y}u&&!(u instanceof Error)&&(U(m),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",l||"React class",s,f,typeof u),U(null)),u instanceof Error&&!(u.message in he)&&(he[u.message]=!0,U(m),p("Failed %s type: %s",s,u.message),U(null))}}}var rt=Array.isArray;function Q(e){return rt(e)}function nt(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,s=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function at(e){try{return xe(e),!1}catch{return!0}}function xe(e){return""+e}function ve(e){if(at(e))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nt(e)),xe(e)}var be=b.ReactCurrentOwner,st={key:!0,ref:!0,__self:!0,__source:!0},ge,ye;function it(e){if(Y.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function ot(e){if(Y.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function lt(e,n){typeof e.ref=="string"&&be.current}function ct(e,n){{var s=function(){ge||(ge=!0,p("%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://reactjs.org/link/special-props)",n))};s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}}function dt(e,n){{var s=function(){ye||(ye=!0,p("%s: `ref` 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://reactjs.org/link/special-props)",n))};s.isReactWarning=!0,Object.defineProperty(e,"ref",{get:s,configurable:!0})}}var ut=function(e,n,s,l,m,x,f){var u={$$typeof:r,type:e,key:n,ref:s,props:f,_owner:x};return u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function ft(e,n,s,l,m){{var x,f={},u=null,_=null;s!==void 0&&(ve(s),u=""+s),ot(n)&&(ve(n.key),u=""+n.key),it(n)&&(_=n.ref,lt(n,m));for(x in n)Y.call(n,x)&&!st.hasOwnProperty(x)&&(f[x]=n[x]);if(e&&e.defaultProps){var y=e.defaultProps;for(x in y)f[x]===void 0&&(f[x]=y[x])}if(u||_){var j=typeof e=="function"?e.displayName||e.name||"Unknown":e;u&&ct(f,j),_&&dt(f,j)}return ut(e,u,_,m,l,be.current,f)}}var ee=b.ReactCurrentOwner,je=b.ReactDebugCurrentFrame;function D(e){if(e){var n=e._owner,s=V(e.type,e._source,n?n.type:null);je.setExtraStackFrame(s)}else je.setExtraStackFrame(null)}var te;te=!1;function re(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Ee(){{if(ee.current){var e=I(ee.current.type);if(e)return`
20
+ `),y=u.length-1,E=_.length-1;y>=1&&E>=0&&u[y]!==_[E];)E--;for(;y>=1&&E>=0;y--,E--)if(u[y]!==_[E]){if(y!==1||E!==1)do if(y--,E--,E<0||u[y]!==_[E]){var T=`
21
+ `+u[y].replace(" at new "," at ");return e.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",e.displayName)),typeof e=="function"&&W.set(e,T),T}while(y>=1&&E>=0);break}}}finally{Z=!1,K.current=x,Xe(),Error.prepareStackTrace=m}var A=e?e.displayName||e.name:"",Re=A?B(A):"";return typeof e=="function"&&W.set(e,Re),Re}function Qe(e,n,s){return me(e,!1)}function et(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function V(e,n,s){if(e==null)return"";if(typeof e=="function")return me(e,et(e));if(typeof e=="string")return B(e);switch(e){case R:return B("Suspense");case d:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Qe(e.render);case F:return V(e.type,n,s);case S:{var l=e,m=l._payload,x=l._init;try{return V(x(m),n,s)}catch{}}}return""}var Y=Object.prototype.hasOwnProperty,he={},pe=b.ReactDebugCurrentFrame;function U(e){if(e){var n=e._owner,s=V(e.type,e._source,n?n.type:null);pe.setExtraStackFrame(s)}else pe.setExtraStackFrame(null)}function tt(e,n,s,l,m){{var x=Function.call.bind(Y);for(var f in e)if(x(e,f)){var u=void 0;try{if(typeof e[f]!="function"){var _=Error((l||"React class")+": "+s+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}u=e[f](n,f,l,s,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(y){u=y}u&&!(u instanceof Error)&&(U(m),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",l||"React class",s,f,typeof u),U(null)),u instanceof Error&&!(u.message in he)&&(he[u.message]=!0,U(m),p("Failed %s type: %s",s,u.message),U(null))}}}var rt=Array.isArray;function Q(e){return rt(e)}function nt(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,s=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function at(e){try{return xe(e),!1}catch{return!0}}function xe(e){return""+e}function ve(e){if(at(e))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nt(e)),xe(e)}var be=b.ReactCurrentOwner,st={key:!0,ref:!0,__self:!0,__source:!0},ge,ye;function it(e){if(Y.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function ot(e){if(Y.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function lt(e,n){typeof e.ref=="string"&&be.current}function ct(e,n){{var s=function(){ge||(ge=!0,p("%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://reactjs.org/link/special-props)",n))};s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}}function dt(e,n){{var s=function(){ye||(ye=!0,p("%s: `ref` 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://reactjs.org/link/special-props)",n))};s.isReactWarning=!0,Object.defineProperty(e,"ref",{get:s,configurable:!0})}}var ut=function(e,n,s,l,m,x,f){var u={$$typeof:r,type:e,key:n,ref:s,props:f,_owner:x};return u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function ft(e,n,s,l,m){{var x,f={},u=null,_=null;s!==void 0&&(ve(s),u=""+s),ot(n)&&(ve(n.key),u=""+n.key),it(n)&&(_=n.ref,lt(n,m));for(x in n)Y.call(n,x)&&!st.hasOwnProperty(x)&&(f[x]=n[x]);if(e&&e.defaultProps){var y=e.defaultProps;for(x in y)f[x]===void 0&&(f[x]=y[x])}if(u||_){var E=typeof e=="function"?e.displayName||e.name||"Unknown":e;u&&ct(f,E),_&&dt(f,E)}return ut(e,u,_,m,l,be.current,f)}}var ee=b.ReactCurrentOwner,je=b.ReactDebugCurrentFrame;function D(e){if(e){var n=e._owner,s=V(e.type,e._source,n?n.type:null);je.setExtraStackFrame(s)}else je.setExtraStackFrame(null)}var te;te=!1;function re(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Ee(){{if(ee.current){var e=I(ee.current.type);if(e)return`
22
22
 
23
23
  Check the render method of \``+e+"`."}return""}}function mt(e){return""}var we={};function ht(e){{var n=Ee();if(!n){var s=typeof e=="string"?e:e.displayName||e.name;s&&(n=`
24
24
 
25
- Check the top-level render call using <`+s+">.")}return n}}function Ne(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var s=ht(n);if(we[s])return;we[s]=!0;var l="";e&&e._owner&&e._owner!==ee.current&&(l=" It was passed a child from "+I(e._owner.type)+"."),D(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',s,l),D(null)}}function Ce(e,n){{if(typeof e!="object")return;if(Q(e))for(var s=0;s<e.length;s++){var l=e[s];re(l)&&Ne(l,n)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var m=G(e);if(typeof m=="function"&&m!==e.entries)for(var x=m.call(e),f;!(f=x.next()).done;)re(f.value)&&Ne(f.value,n)}}}function pt(e){{var n=e.type;if(n==null||typeof n=="string")return;var s;if(typeof n=="function")s=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===v||n.$$typeof===F))s=n.propTypes;else return;if(s){var l=I(n);tt(s,e.props,"prop",l,e)}else if(n.PropTypes!==void 0&&!te){te=!0;var m=I(n);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xt(e){{for(var n=Object.keys(e.props),s=0;s<n.length;s++){var l=n[s];if(l!=="children"&&l!=="key"){D(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",l),D(null);break}}e.ref!==null&&(D(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}function Fe(e,n,s,l,m,x){{var f=Je(e);if(!f){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var _=mt();_?u+=_:u+=Ee();var y;e===null?y="null":Q(e)?y="array":e!==void 0&&e.$$typeof===r?(y="<"+(I(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,u)}var j=ft(e,n,s,m,x);if(j==null)return j;if(f){var T=n.children;if(T!==void 0)if(l)if(Q(T)){for(var A=0;A<T.length;A++)Ce(T[A],e);Object.freeze&&Object.freeze(T)}else p("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 Ce(T,e)}return e===i?xt(j):pt(j),j}}function vt(e,n,s){return Fe(e,n,s,!0)}function bt(e,n,s){return Fe(e,n,s,!1)}var gt=bt,yt=vt;$.Fragment=i,$.jsx=gt,$.jsxs=yt})()),$}var Te;function Nt(){return Te||(Te=1,process.env.NODE_ENV==="production"?q.exports=Et():q.exports=wt()),q.exports}var t=Nt();function Pe(o){const[r,a]=E.useState([]),[i,c]=E.useState(null),[g,N]=E.useState(""),[C,v]=E.useState(!1),[R,d]=E.useState(null),F=E.useCallback(async()=>{try{v(!0),d(null);const b=await o.getFiles();if(a(b),!i&&b.length>0){const p=Oe(b);p&&c(p.id)}}catch(b){d(b instanceof Error?b.message:"Failed to load files")}finally{v(!1)}},[o,i]),S=E.useCallback(async b=>{try{v(!0),d(null);const p=await o.getFileContent(b);N(p)}catch(p){d(p instanceof Error?p.message:"Failed to load file content"),N("")}finally{v(!1)}},[o]),O=E.useCallback(async b=>{if(i)try{d(null),await o.updateFileContent(i,b),N(b),a(p=>ke(p,i,{content:b}))}catch(p){d(p instanceof Error?p.message:"Failed to update file content")}},[i,o]),M=E.useCallback(b=>{c(b),S(b)},[S]),J=E.useCallback(()=>{F()},[F]),G=E.useCallback(b=>Ie(r,b),[r]);return E.useEffect(()=>{F()},[F]),E.useEffect(()=>{i&&S(i)},[i,S]),{files:r,activeFile:i,fileContent:g,loading:C,error:R,setActiveFile:M,updateFileContent:O,refreshFiles:J,getFileById:G}}function Oe(o){for(const r of o){if(r.type==="file")return r;if(r.children){const a=Oe(r.children);if(a)return a}}return null}function Ie(o,r){for(const a of o){if(a.id===r)return a;if(a.children){const i=Ie(a.children,r);if(i)return i}}return null}function ke(o,r,a){return o.map(i=>i.id===r?{...i,...a}:i.children?{...i,children:ke(i.children,r,a)}:i)}class De{config;files=[];constructor(r){this.config=r}async getFiles(){return this.files.length===0&&await this.loadFiles(),this.files}async getFileContent(r){if(r==="main-function")return await this.config.fetchFunction(this.config.functionId,this.config.version);throw new Error(`File ${r} not found`)}async updateFileContent(r,a){const i=this.findFileById(r);i&&(i.content=a),console.log(`Updated file ${r} with content:`,a)}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}async loadFiles(){this.files=[{id:"main-function",name:"function.js",type:"file",path:"/function.js",metadata:{language:"javascript",lastModified:new Date}},{id:"versions",name:"versions",type:"folder",path:"/versions",children:this.config.versionList.map(r=>({id:`version-${r}`,name:`v${r}.js`,type:"file",path:`/versions/v${r}.js`,metadata:{language:"javascript"}}))}]}findFileById(r){const a=i=>{for(const c of i){if(c.id===r)return c;if(c.children){const g=a(c.children);if(g)return g}}return null};return a(this.files)}}class Ae{config;files=[];constructor(r){this.config=r,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(r){if(r==="form-code")return this.config.codeContent;throw new Error(`File ${r} not found`)}async updateFileContent(r,a){if(r==="form-code"){this.config.codeContent=a;const i=this.files.find(c=>c.id===r);i&&(i.content=a)}}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}initializeFiles(){this.files=[{id:"form-code",name:this.config.fileName||"code.js",type:"file",path:`/${this.config.fileName||"code.js"}`,content:this.config.codeContent,metadata:{language:this.config.language||"javascript",lastModified:new Date}}]}findFileById(r){return this.files.find(a=>a.id===r)||null}}class ze{config;files=[];constructor(r){this.config=r,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(r){const a=this.findFileById(r);if(!a||!a.metadata?.url)throw new Error(`File ${r} not found`);try{const i=await fetch(a.metadata.url);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return await i.text()}catch(i){throw new Error(`Error fetching file content: ${i}`)}}async updateFileContent(r,a){console.log(`Would save file ${r} content to backend:`,a);const i=this.findFileById(r);i&&(i.content=a)}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}initializeFiles(){this.files=this.config.fileUrls.map((r,a)=>({id:`url-file-${a}`,name:r.name,type:"file",path:`/${r.name}`,metadata:{language:r.type,url:r.url,lastModified:new Date}}))}findFileById(r){return this.files.find(a=>a.id===r)||null}}function Le(o){if(o.workflowConfig)return new De(o.workflowConfig);if(o.formConfig)return new Ae(o.formConfig);if(o.urlConfig)return new ze(o.urlConfig);throw new Error("No valid configuration provided")}const $e=({value:o,onChange:r,language:a="javascript",filename:i,readOnly:c=!1,loading:g=!1})=>{const N=C=>{C!==void 0&&r(C)};return t.jsx("div",{className:"h-full w-full",children:t.jsx(jt,{height:"100%",defaultLanguage:a,defaultValue:o,onChange:N,theme:"vs-light",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0,padding:{top:16},scrollBeyondLastLine:!1,readOnly:c}})})},Ct=[{id:"explorer",icon:h.IconFolderOpen,label:"Files"},{id:"data",icon:h.IconDatabase,label:"Data"},{id:"functions",icon:h.IconCode,label:"Functions"},{id:"versions",icon:h.IconHistory,label:"Versions"},{id:"tests",icon:h.IconFlask,label:"Tests"}],Ft=({activePanel:o,setActivePanel:r,allowedRoutes:a=["explorer"]})=>{const i=E.useMemo(()=>Ct.filter(c=>a.includes(c.id)),[a]);return t.jsxs("div",{className:"w-14 border-r border-slate-200 bg-white flex flex-col gap-4 items-center py-4",children:[i.map(c=>{const g=c.icon;return t.jsx(w.Tooltip,{title:c.label,placement:"right",children:t.jsx(w.Button,{type:o===c.id?"primary":"text",icon:t.jsx(g,{size:16}),onClick:()=>r(c.id)})},c.id)}),t.jsx("div",{className:"mt-auto",children:t.jsx(w.Tooltip,{title:"Settings",placement:"right",children:t.jsx(w.Button,{type:"text",icon:t.jsx(h.IconSettings,{size:20})})})})]})},Me=({leftPanel:o,editor:r,rightPanel:a,activePanel:i,setActivePanel:c})=>t.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[t.jsx(Ft,{activePanel:i,setActivePanel:c}),t.jsx("div",{className:"flex-1",children:a?t.jsxs(w.Splitter,{style:{height:"100%"},onResize:g=>console.log(g),children:[t.jsx(w.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-slate-200",collapsible:!0,children:t.jsx("div",{className:"h-full overflow-y-auto",children:o})}),t.jsx(w.Splitter.Panel,{defaultSize:"50%",min:"30%",children:r}),t.jsx(w.Splitter.Panel,{defaultSize:"25%",min:"20%",max:"50%",className:"bg-white border-l border-slate-200",children:t.jsx("div",{className:"h-full overflow-y-auto",children:a})})]}):t.jsxs(w.Splitter,{style:{height:"100%"},children:[t.jsx(w.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-slate-200",children:t.jsx("div",{className:"h-full overflow-y-auto",children:o})}),t.jsx(w.Splitter.Panel,{defaultSize:"75%",min:"60%",children:r})]})})]}),Be=({files:o,activeFile:r,onFileSelect:a,loading:i=!1,error:c=null,onRefresh:g})=>{const N=R=>R.map(d=>({title:d.name,key:d.id,icon:d.type==="file"?t.jsx(h.IconFile,{size:16,className:"text-slate-500 flex"}):t.jsx(h.IconFolderOpen,{size:16,className:"text-slate-500 flex"}),isLeaf:d.type==="file",children:d.children?N(d.children):void 0,metadata:d.metadata})),C=N(o),v=(R,d)=>{d?.node.isLeaf&&d.node.key&&a(d.node.key)};return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Files"}),t.jsx("div",{className:"flex items-center gap-2",children:g&&t.jsx(w.Button,{type:"text",icon:t.jsx(h.IconPlus,{size:16}),onClick:g,loading:i,title:"Refresh files"})})]}),t.jsxs("div",{className:"p-2",children:[c&&t.jsx(w.Alert,{message:"Error loading files",description:c,type:"error",className:"mb-2"}),t.jsx(w.Tree,{treeData:C,onSelect:v,selectedKeys:r?[r]:[],showIcon:!0,defaultExpandAll:!0,showLine:!0,className:"file-explorer-tree"})]})]})},H=({config:o,rightPanel:r=!1})=>{const a=E.useMemo(()=>Le(o),[o]);console.log({config:o});const{files:i,activeFile:c,fileContent:g,loading:N,error:C,setActiveFile:v,updateFileContent:R,refreshFiles:d,getFileById:F}=Pe(a),S=c?F(c):null,O=S?.metadata?.language||"javascript";return t.jsx(Me,{leftPanel:t.jsx(Be,{files:i,activeFile:c,onFileSelect:v,loading:N,error:C,onRefresh:d}),editor:t.jsx($e,{value:g,onChange:R,language:O,filename:S?.name,readOnly:o.settings?.readOnly,loading:N}),rightPanel:r,activePanel:"explorer",setActivePanel:()=>{}})},Rt=({functionId:o,version:r,versionList:a,fetchFunction:i,fetchVersionList:c})=>{const g={workflowConfig:{functionId:o,version:r,versionList:a,fetchFunction:i,fetchVersionList:c}};return t.jsx(H,{config:g})},St=({codeContent:o,fileName:r="code.js",language:a="javascript",readOnly:i=!1})=>{const c={formConfig:{codeContent:o,fileName:r,language:a},settings:{readOnly:i}};return t.jsx(H,{config:c})},_t=({fileUrls:o,rightPanel:r})=>{const a={urlConfig:{fileUrls:o}};return t.jsx(H,{config:a,rightPanel:r})},Tt=({activeFile:o,showPreview:r,setShowPreview:a})=>t.jsxs("div",{className:"h-14 border-b border-slate-200 bg-white px-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-slate-900 mr-4",children:"CRM Code Editor"}),t.jsx("span",{className:"text-sm text-slate-500 px-2 py-1 bg-slate-100 rounded-md",children:o})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",onClick:()=>a(!r),title:r?"Hide Preview":"Show Preview",children:r?t.jsx(h.IconEyeOff,{size:18}):t.jsx(h.IconEye,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Version History",children:t.jsx(h.IconHistory,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Run Code",children:t.jsx(h.IconPlayerPlay,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Export",children:t.jsx(h.IconDownload,{size:18})}),t.jsxs("button",{className:"ml-2 px-3 py-1.5 bg-slate-900 text-white rounded-md flex items-center text-sm hover:bg-slate-800",children:[t.jsx(h.IconDeviceFloppy,{size:16,className:"mr-1.5"})," Save"]}),t.jsxs("div",{className:"ml-2 px-3 py-1.5 bg-emerald-100 text-emerald-800 rounded-md flex items-center text-sm",children:[t.jsx("span",{className:"w-2 h-2 bg-emerald-500 rounded-full mr-1.5"})," ","Draft"]})]})]}),Pt=()=>{const o=[{name:"Lead",fields:["id","name","email","phone","status","createdAt"],expanded:!0},{name:"Contact",fields:["id","firstName","lastName","email","phone"],expanded:!1},{name:"Account",fields:["id","name","industry","website","employees"],expanded:!1},{name:"Opportunity",fields:["id","name","amount","stage","closeDate"],expanded:!1}];return t.jsxs("div",{className:"h-full",children:[t.jsx("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:t.jsx("h2",{className:"font-medium text-sm",children:"Data Explorer"})}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"relative mb-3",children:[t.jsx(h.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-slate-400"}),t.jsx("input",{type:"text",placeholder:"Search objects...",className:"w-full pl-8 pr-3 py-2 text-sm border border-slate-200 rounded-md focus:outline-none focus:ring-2 focus:ring-slate-300"})]}),t.jsx("div",{children:o.map(r=>t.jsxs("div",{className:"mb-1",children:[t.jsxs("div",{className:"flex items-center p-2 hover:bg-slate-50 rounded-md cursor-pointer",children:[t.jsx(h.IconChevronRight,{size:16,className:`mr-1 text-slate-400 transition-transform ${r.expanded?"rotate-90":""}`}),t.jsx(h.IconDatabase,{size:16,className:"mr-2 text-slate-500"}),t.jsx("span",{className:"text-sm font-medium",children:r.name})]}),r.expanded&&t.jsx("div",{className:"ml-7 border-l border-slate-200 pl-2",children:r.fields.map(a=>t.jsx("div",{className:"flex items-center p-1.5 hover:bg-slate-50 rounded-md cursor-pointer",children:t.jsx("span",{className:"text-xs text-slate-600",children:a})},a))})]},r.name))})]})]})},Ot=()=>{const o=[{name:"formatCurrency",description:"Format a number as currency",category:"Formatting"},{name:"calculateDiscount",description:"Calculate discount based on amount",category:"Calculations"},{name:"getLeadData",description:"Fetch lead data from CRM",category:"Data Access"},{name:"updateContact",description:"Update contact information",category:"Data Modification"},{name:"sendEmail",description:"Send an email to a contact",category:"Communication"},{name:"validateEmail",description:"Validate email format",category:"Validation"}];return t.jsxs("div",{className:"h-full",children:[t.jsx("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:t.jsx("h2",{className:"font-medium text-sm",children:"Function Library"})}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"relative mb-3",children:[t.jsx(h.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-slate-400"}),t.jsx("input",{type:"text",placeholder:"Search functions...",className:"w-full pl-8 pr-3 py-2 text-sm border border-slate-200 rounded-md focus:outline-none focus:ring-2 focus:ring-slate-300"})]}),t.jsx("div",{children:o.map(r=>t.jsxs("div",{className:"p-2 border border-slate-200 rounded-md mb-2 hover:bg-slate-50 cursor-pointer",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx(h.IconCode,{size:16,className:"mr-2 text-slate-500"}),t.jsx("span",{className:"text-sm font-medium",children:r.name})]}),t.jsx("span",{className:"text-xs bg-slate-100 px-2 py-0.5 rounded text-slate-600",children:r.category})]}),t.jsx("p",{className:"text-xs text-slate-500 mt-1",children:r.description})]},r.name))}),t.jsxs("div",{className:"mt-4 p-3 bg-slate-50 rounded-md border border-slate-200 flex items-center",children:[t.jsx(h.IconBook,{size:16,className:"text-slate-500 mr-2"}),t.jsx("span",{className:"text-xs text-slate-600",children:"Browse documentation for more functions and examples"})]})]})]})},It=({code:o})=>{const[r,a]=E.useState(null),[i,c]=E.useState(!1),g="body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; padding: 1rem; }",C=(d=>d.replace(/import\s+.*axios.*from\s+['"]axios['"];?/g,"// Axios imports removed for preview").replace(/axios\./g,"/* axios. */").replace(/fetch\(/g,"/* fetch( */"))(o),v=`
25
+ Check the top-level render call using <`+s+">.")}return n}}function Ne(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var s=ht(n);if(we[s])return;we[s]=!0;var l="";e&&e._owner&&e._owner!==ee.current&&(l=" It was passed a child from "+I(e._owner.type)+"."),D(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',s,l),D(null)}}function Ce(e,n){{if(typeof e!="object")return;if(Q(e))for(var s=0;s<e.length;s++){var l=e[s];re(l)&&Ne(l,n)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var m=G(e);if(typeof m=="function"&&m!==e.entries)for(var x=m.call(e),f;!(f=x.next()).done;)re(f.value)&&Ne(f.value,n)}}}function pt(e){{var n=e.type;if(n==null||typeof n=="string")return;var s;if(typeof n=="function")s=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===v||n.$$typeof===F))s=n.propTypes;else return;if(s){var l=I(n);tt(s,e.props,"prop",l,e)}else if(n.PropTypes!==void 0&&!te){te=!0;var m=I(n);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xt(e){{for(var n=Object.keys(e.props),s=0;s<n.length;s++){var l=n[s];if(l!=="children"&&l!=="key"){D(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",l),D(null);break}}e.ref!==null&&(D(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}function Fe(e,n,s,l,m,x){{var f=Je(e);if(!f){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var _=mt();_?u+=_:u+=Ee();var y;e===null?y="null":Q(e)?y="array":e!==void 0&&e.$$typeof===r?(y="<"+(I(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,u)}var E=ft(e,n,s,m,x);if(E==null)return E;if(f){var T=n.children;if(T!==void 0)if(l)if(Q(T)){for(var A=0;A<T.length;A++)Ce(T[A],e);Object.freeze&&Object.freeze(T)}else p("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 Ce(T,e)}return e===i?xt(E):pt(E),E}}function vt(e,n,s){return Fe(e,n,s,!0)}function bt(e,n,s){return Fe(e,n,s,!1)}var gt=bt,yt=vt;$.Fragment=i,$.jsx=gt,$.jsxs=yt})()),$}var Te;function Nt(){return Te||(Te=1,process.env.NODE_ENV==="production"?q.exports=Et():q.exports=wt()),q.exports}var t=Nt();function Pe(o){const[r,a]=w.useState([]),[i,c]=w.useState(null),[g,j]=w.useState(""),[C,v]=w.useState(!1),[R,d]=w.useState(null),F=w.useCallback(async()=>{try{v(!0),d(null);const b=await o.getFiles();if(a(b),!i&&b.length>0){const p=Oe(b);p&&c(p.id)}}catch(b){d(b instanceof Error?b.message:"Failed to load files")}finally{v(!1)}},[o,i]),S=w.useCallback(async b=>{try{v(!0),d(null);const p=await o.getFileContent(b);j(p)}catch(p){d(p instanceof Error?p.message:"Failed to load file content"),j("")}finally{v(!1)}},[o]),O=w.useCallback(async b=>{if(i)try{d(null),await o.updateFileContent(i,b),j(b),a(p=>ke(p,i,{content:b}))}catch(p){d(p instanceof Error?p.message:"Failed to update file content")}},[i,o]),M=w.useCallback(b=>{c(b),S(b)},[S]),J=w.useCallback(()=>{F()},[F]),G=w.useCallback(b=>Ie(r,b),[r]);return w.useEffect(()=>{F()},[F]),w.useEffect(()=>{i&&S(i)},[i,S]),{files:r,activeFile:i,fileContent:g,loading:C,error:R,setActiveFile:M,updateFileContent:O,refreshFiles:J,getFileById:G}}function Oe(o){for(const r of o){if(r.type==="file")return r;if(r.children){const a=Oe(r.children);if(a)return a}}return null}function Ie(o,r){for(const a of o){if(a.id===r)return a;if(a.children){const i=Ie(a.children,r);if(i)return i}}return null}function ke(o,r,a){return o.map(i=>i.id===r?{...i,...a}:i.children?{...i,children:ke(i.children,r,a)}:i)}class De{config;files=[];constructor(r){this.config=r}async getFiles(){return this.files.length===0&&await this.loadFiles(),this.files}async getFileContent(r){if(r==="main-function")return await this.config.fetchFunction(this.config.functionId,this.config.version);throw new Error(`File ${r} not found`)}async updateFileContent(r,a){const i=this.findFileById(r);i&&(i.content=a),console.log(`Updated file ${r} with content:`,a)}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}async loadFiles(){this.files=[{id:"main-function",name:"function.js",type:"file",path:"/function.js",metadata:{language:"javascript",lastModified:new Date}},{id:"versions",name:"versions",type:"folder",path:"/versions",children:this.config.versionList.map(r=>({id:`version-${r}`,name:`v${r}.js`,type:"file",path:`/versions/v${r}.js`,metadata:{language:"javascript"}}))}]}findFileById(r){const a=i=>{for(const c of i){if(c.id===r)return c;if(c.children){const g=a(c.children);if(g)return g}}return null};return a(this.files)}}class Ae{config;files=[];constructor(r){this.config=r,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(r){if(r==="form-code")return this.config.codeContent;throw new Error(`File ${r} not found`)}async updateFileContent(r,a){if(r==="form-code"){this.config.codeContent=a;const i=this.files.find(c=>c.id===r);i&&(i.content=a)}}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}initializeFiles(){this.files=[{id:"form-code",name:this.config.fileName||"code.js",type:"file",path:`/${this.config.fileName||"code.js"}`,content:this.config.codeContent,metadata:{language:this.config.language||"javascript",lastModified:new Date}}]}findFileById(r){return this.files.find(a=>a.id===r)||null}}class ze{config;files=[];constructor(r){this.config=r,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(r){const a=this.findFileById(r);if(!a||!a.metadata?.url)throw new Error(`File ${r} not found`);try{const i=await fetch(a.metadata.url);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return await i.text()}catch(i){throw new Error(`Error fetching file content: ${i}`)}}async updateFileContent(r,a){console.log(`Would save file ${r} content to backend:`,a);const i=this.findFileById(r);i&&(i.content=a)}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}initializeFiles(){this.files=this.config.fileUrls.map((r,a)=>({id:`url-file-${a}`,name:r.name,type:"file",path:`/${r.name}`,metadata:{language:r.type,url:r.url,lastModified:new Date}}))}findFileById(r){return this.files.find(a=>a.id===r)||null}}function Le(o){if(o.workflowConfig)return new De(o.workflowConfig);if(o.formConfig)return new Ae(o.formConfig);if(o.urlConfig)return new ze(o.urlConfig);throw new Error("No valid configuration provided")}const $e=({value:o,onChange:r,language:a="javascript",filename:i,readOnly:c=!1,loading:g=!1})=>{const j=C=>{C!==void 0&&r(C)};return t.jsx("div",{className:"h-full w-full",children:t.jsx(jt,{height:"100%",defaultLanguage:a,defaultValue:o,onChange:j,theme:"vs-light",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0,padding:{top:16},scrollBeyondLastLine:!1,readOnly:c}})})},Ct=[{id:"explorer",icon:h.IconFolderOpen,label:"Files"},{id:"data",icon:h.IconDatabase,label:"Data"},{id:"functions",icon:h.IconCode,label:"Functions"},{id:"versions",icon:h.IconHistory,label:"Versions"},{id:"tests",icon:h.IconFlask,label:"Tests"}],Ft=({activePanel:o,setActivePanel:r,allowedPannels:a})=>{const i=w.useMemo(()=>Ct.filter(c=>a.includes(c.id)),[a]);return t.jsxs("div",{className:"w-14 border-r border-slate-200 bg-white flex flex-col gap-4 items-center py-4",children:[i.map(c=>{const g=c.icon;return t.jsx(N.Tooltip,{title:c.label,placement:"right",children:t.jsx(N.Button,{type:o===c.id?"primary":"text",icon:t.jsx(g,{size:16}),onClick:()=>r(c.id)})},c.id)}),t.jsx("div",{className:"mt-auto",children:t.jsx(N.Tooltip,{title:"Settings",placement:"right",children:t.jsx(N.Button,{type:"text",icon:t.jsx(h.IconSettings,{size:20})})})})]})},Me=({leftPanel:o,editor:r,rightPanel:a,activePanel:i,setActivePanel:c,allowedPannels:g=["explorer"]})=>t.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[t.jsx(Ft,{activePanel:i,setActivePanel:c,allowedPannels:g}),t.jsx("div",{className:"flex-1",children:a?t.jsxs(N.Splitter,{style:{height:"100%"},onResize:j=>console.log(j),children:[t.jsx(N.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-slate-200",collapsible:!0,children:t.jsx("div",{className:"h-full overflow-y-auto",children:o})}),t.jsx(N.Splitter.Panel,{defaultSize:"50%",min:"30%",children:r}),t.jsx(N.Splitter.Panel,{defaultSize:"25%",min:"20%",max:"50%",className:"bg-white border-l border-slate-200",children:t.jsx("div",{className:"h-full overflow-y-auto",children:a})})]}):t.jsxs(N.Splitter,{style:{height:"100%"},children:[t.jsx(N.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-slate-200",children:t.jsx("div",{className:"h-full overflow-y-auto",children:o})}),t.jsx(N.Splitter.Panel,{defaultSize:"75%",min:"60%",children:r})]})})]}),Be=({files:o,activeFile:r,onFileSelect:a,loading:i=!1,error:c=null,onRefresh:g})=>{const j=R=>R.map(d=>({title:d.name,key:d.id,icon:d.type==="file"?t.jsx(h.IconFile,{size:16,className:"text-slate-500 flex"}):t.jsx(h.IconFolderOpen,{size:16,className:"text-slate-500 flex"}),isLeaf:d.type==="file",children:d.children?j(d.children):void 0,metadata:d.metadata})),C=j(o),v=(R,d)=>{d?.node.isLeaf&&d.node.key&&a(d.node.key)};return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Files"}),t.jsx("div",{className:"flex items-center gap-2",children:g&&t.jsx(N.Button,{type:"text",icon:t.jsx(h.IconPlus,{size:16}),onClick:g,loading:i,title:"Refresh files"})})]}),t.jsxs("div",{className:"p-2",children:[c&&t.jsx(N.Alert,{message:"Error loading files",description:c,type:"error",className:"mb-2"}),t.jsx(N.Tree,{treeData:C,onSelect:v,selectedKeys:r?[r]:[],showIcon:!0,defaultExpandAll:!0,showLine:!0,className:"file-explorer-tree"})]})]})},H=({config:o,rightPanel:r=!1})=>{const a=w.useMemo(()=>Le(o),[o]);console.log({config:o});const{files:i,activeFile:c,fileContent:g,loading:j,error:C,setActiveFile:v,updateFileContent:R,refreshFiles:d,getFileById:F}=Pe(a),S=c?F(c):null,O=S?.metadata?.language||"javascript";return t.jsx(Me,{leftPanel:t.jsx(Be,{files:i,activeFile:c,onFileSelect:v,loading:j,error:C,onRefresh:d}),editor:t.jsx($e,{value:g,onChange:R,language:O,filename:S?.name,readOnly:o.settings?.readOnly,loading:j}),rightPanel:r,activePanel:"explorer",setActivePanel:()=>{}})},Rt=({functionId:o,version:r,versionList:a,fetchFunction:i,fetchVersionList:c})=>{const g={workflowConfig:{functionId:o,version:r,versionList:a,fetchFunction:i,fetchVersionList:c}};return t.jsx(H,{config:g})},St=({codeContent:o,fileName:r="code.js",language:a="javascript",readOnly:i=!1})=>{const c={formConfig:{codeContent:o,fileName:r,language:a},settings:{readOnly:i}};return t.jsx(H,{config:c})},_t=({fileUrls:o,rightPanel:r})=>{const a={urlConfig:{fileUrls:o}};return t.jsx(H,{config:a,rightPanel:r})},Tt=({activeFile:o,showPreview:r,setShowPreview:a})=>t.jsxs("div",{className:"h-14 border-b border-slate-200 bg-white px-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-slate-900 mr-4",children:"CRM Code Editor"}),t.jsx("span",{className:"text-sm text-slate-500 px-2 py-1 bg-slate-100 rounded-md",children:o})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",onClick:()=>a(!r),title:r?"Hide Preview":"Show Preview",children:r?t.jsx(h.IconEyeOff,{size:18}):t.jsx(h.IconEye,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Version History",children:t.jsx(h.IconHistory,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Run Code",children:t.jsx(h.IconPlayerPlay,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Export",children:t.jsx(h.IconDownload,{size:18})}),t.jsxs("button",{className:"ml-2 px-3 py-1.5 bg-slate-900 text-white rounded-md flex items-center text-sm hover:bg-slate-800",children:[t.jsx(h.IconDeviceFloppy,{size:16,className:"mr-1.5"})," Save"]}),t.jsxs("div",{className:"ml-2 px-3 py-1.5 bg-emerald-100 text-emerald-800 rounded-md flex items-center text-sm",children:[t.jsx("span",{className:"w-2 h-2 bg-emerald-500 rounded-full mr-1.5"})," ","Draft"]})]})]}),Pt=()=>{const o=[{name:"Lead",fields:["id","name","email","phone","status","createdAt"],expanded:!0},{name:"Contact",fields:["id","firstName","lastName","email","phone"],expanded:!1},{name:"Account",fields:["id","name","industry","website","employees"],expanded:!1},{name:"Opportunity",fields:["id","name","amount","stage","closeDate"],expanded:!1}];return t.jsxs("div",{className:"h-full",children:[t.jsx("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:t.jsx("h2",{className:"font-medium text-sm",children:"Data Explorer"})}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"relative mb-3",children:[t.jsx(h.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-slate-400"}),t.jsx("input",{type:"text",placeholder:"Search objects...",className:"w-full pl-8 pr-3 py-2 text-sm border border-slate-200 rounded-md focus:outline-none focus:ring-2 focus:ring-slate-300"})]}),t.jsx("div",{children:o.map(r=>t.jsxs("div",{className:"mb-1",children:[t.jsxs("div",{className:"flex items-center p-2 hover:bg-slate-50 rounded-md cursor-pointer",children:[t.jsx(h.IconChevronRight,{size:16,className:`mr-1 text-slate-400 transition-transform ${r.expanded?"rotate-90":""}`}),t.jsx(h.IconDatabase,{size:16,className:"mr-2 text-slate-500"}),t.jsx("span",{className:"text-sm font-medium",children:r.name})]}),r.expanded&&t.jsx("div",{className:"ml-7 border-l border-slate-200 pl-2",children:r.fields.map(a=>t.jsx("div",{className:"flex items-center p-1.5 hover:bg-slate-50 rounded-md cursor-pointer",children:t.jsx("span",{className:"text-xs text-slate-600",children:a})},a))})]},r.name))})]})]})},Ot=()=>{const o=[{name:"formatCurrency",description:"Format a number as currency",category:"Formatting"},{name:"calculateDiscount",description:"Calculate discount based on amount",category:"Calculations"},{name:"getLeadData",description:"Fetch lead data from CRM",category:"Data Access"},{name:"updateContact",description:"Update contact information",category:"Data Modification"},{name:"sendEmail",description:"Send an email to a contact",category:"Communication"},{name:"validateEmail",description:"Validate email format",category:"Validation"}];return t.jsxs("div",{className:"h-full",children:[t.jsx("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:t.jsx("h2",{className:"font-medium text-sm",children:"Function Library"})}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"relative mb-3",children:[t.jsx(h.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-slate-400"}),t.jsx("input",{type:"text",placeholder:"Search functions...",className:"w-full pl-8 pr-3 py-2 text-sm border border-slate-200 rounded-md focus:outline-none focus:ring-2 focus:ring-slate-300"})]}),t.jsx("div",{children:o.map(r=>t.jsxs("div",{className:"p-2 border border-slate-200 rounded-md mb-2 hover:bg-slate-50 cursor-pointer",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx(h.IconCode,{size:16,className:"mr-2 text-slate-500"}),t.jsx("span",{className:"text-sm font-medium",children:r.name})]}),t.jsx("span",{className:"text-xs bg-slate-100 px-2 py-0.5 rounded text-slate-600",children:r.category})]}),t.jsx("p",{className:"text-xs text-slate-500 mt-1",children:r.description})]},r.name))}),t.jsxs("div",{className:"mt-4 p-3 bg-slate-50 rounded-md border border-slate-200 flex items-center",children:[t.jsx(h.IconBook,{size:16,className:"text-slate-500 mr-2"}),t.jsx("span",{className:"text-xs text-slate-600",children:"Browse documentation for more functions and examples"})]})]})]})},It=({code:o})=>{const[r,a]=w.useState(null),[i,c]=w.useState(!1),g="body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; padding: 1rem; }",C=(d=>d.replace(/import\s+.*axios.*from\s+['"]axios['"];?/g,"// Axios imports removed for preview").replace(/axios\./g,"/* axios. */").replace(/fetch\(/g,"/* fetch( */"))(o),v=`
26
26
  <!DOCTYPE html>
27
27
  <html>
28
28
  <head>
@@ -51,4 +51,4 @@ Check the top-level render call using <`+s+">.")}return n}}function Ne(e,n){{if(
51
51
  <\/script>
52
52
  </body>
53
53
  </html>
54
- `,R=()=>{c(!0),a(null),setTimeout(()=>c(!1),300)};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Preview"}),t.jsx("button",{className:"p-1 hover:bg-slate-100 rounded-md",onClick:R,children:t.jsx(h.IconRefresh,{size:16,className:i?"animate-spin":""})})]}),t.jsx("div",{className:"flex-1 bg-white overflow-auto",children:r?t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-md flex items-start",children:[t.jsx(h.IconAlertTriangle,{size:16,className:"text-red-500 mr-2 mt-0.5"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-red-800",children:"Preview Error"}),t.jsx("p",{className:"text-xs text-red-600",children:r})]})]}):t.jsx("iframe",{title:"Preview",className:"w-full h-full",srcDoc:v,sandbox:"allow-scripts",onError:()=>a("Failed to load preview")})})]})},kt=()=>{const o=[{id:"1",name:"Should format currency correctly",status:"passed",duration:"12ms"},{id:"2",name:"Should calculate discount",status:"passed",duration:"8ms"},{id:"3",name:"Should validate email format",status:"failed",duration:"5ms",error:"Expected true but received false"},{id:"4",name:"Should handle empty input",status:"passed",duration:"3ms"}];return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Test Runner"}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("button",{className:"p-1 hover:bg-slate-100 rounded-md mr-1",children:t.jsx(h.IconSettings,{size:14})}),t.jsxs("button",{className:"bg-slate-900 text-white text-xs px-2 py-1 rounded-md flex items-center",children:[t.jsx(h.IconPlayerPlay,{size:12,className:"mr-1"})," Run Tests"]})]})]}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"mb-3 p-2 bg-slate-50 rounded-md border border-slate-200",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-medium",children:"Test Summary"}),t.jsx("span",{className:"text-xs",children:"3 passed, 1 failed, 4 total"})]}),t.jsx("div",{className:"w-full h-2 bg-slate-200 rounded-full mt-2 overflow-hidden",children:t.jsx("div",{className:"h-full bg-emerald-500",style:{width:"75%"}})})]}),t.jsx("div",{children:o.map(r=>t.jsxs("div",{className:`p-2 mb-2 rounded-md ${r.status==="failed"?"bg-red-50 border border-red-100":"bg-slate-50 border border-slate-200"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[r.status==="passed"?t.jsx(h.IconCircleCheck,{size:16,className:"text-emerald-500 mr-2"}):t.jsx(h.IconCircleX,{size:16,className:"text-red-500 mr-2"}),t.jsx("span",{className:"text-sm",children:r.name})]}),t.jsx("span",{className:"text-xs text-slate-500",children:r.duration})]}),r.error&&t.jsx("div",{className:"mt-2 text-xs text-red-600 bg-red-50 p-2 rounded",children:r.error})]},r.id))}),t.jsx("div",{className:"mt-4",children:t.jsx("button",{className:"w-full py-2 border border-dashed border-slate-300 rounded-md text-sm text-slate-500 hover:bg-slate-50",children:"+ Add New Test Case"})})]})]})},Dt=()=>{const o=[{id:"v1",name:"Initial version",author:"John Doe",timestamp:"Today, 2:30 PM",current:!0},{id:"v2",name:"Added form validation",author:"John Doe",timestamp:"Today, 1:15 PM",current:!1},{id:"v3",name:"Fixed API integration",author:"Sarah Smith",timestamp:"Yesterday, 4:45 PM",current:!1},{id:"v4",name:"Initial setup",author:"Sarah Smith",timestamp:"Yesterday, 11:30 AM",current:!1}];return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Version History"}),t.jsx("button",{className:"text-xs text-slate-500 hover:text-slate-800",children:"Save Version"})]}),t.jsx("div",{className:"p-2",children:o.map(r=>t.jsxs("div",{className:`p-3 mb-2 rounded-md ${r.current?"bg-slate-100 border border-slate-200":"hover:bg-slate-50 cursor-pointer"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-medium",children:r.name}),r.current&&t.jsx("span",{className:"text-xs bg-emerald-100 text-emerald-800 px-2 py-0.5 rounded",children:"Current"})]}),t.jsxs("div",{className:"flex items-center mt-1 text-xs text-slate-500",children:[t.jsx(h.IconUser,{size:12,className:"mr-1"}),t.jsx("span",{className:"mr-3",children:r.author}),t.jsx(h.IconClock,{size:12,className:"mr-1"}),t.jsx("span",{children:r.timestamp})]}),!r.current&&t.jsx("div",{className:"mt-2",children:t.jsxs("button",{className:"text-xs flex items-center text-slate-600 hover:text-slate-900",children:[t.jsx(h.IconRotate,{size:12,className:"mr-1"})," Restore this version"]})})]},r.id))})]})},At="1.0.0";Object.defineProperty(exports,"Alert",{enumerable:!0,get:()=>w.Alert});Object.defineProperty(exports,"Button",{enumerable:!0,get:()=>w.Button});Object.defineProperty(exports,"Splitter",{enumerable:!0,get:()=>w.Splitter});Object.defineProperty(exports,"Tooltip",{enumerable:!0,get:()=>w.Tooltip});Object.defineProperty(exports,"Tree",{enumerable:!0,get:()=>w.Tree});exports.CodeEditor=$e;exports.CodeEditorWrapper=H;exports.DataExplorer=Pt;exports.EditorLayout=Me;exports.FileExplorer=Be;exports.FormCodeEditor=St;exports.FormFileProvider=Ae;exports.FunctionLibrary=Ot;exports.Header=Tt;exports.PreviewPanel=It;exports.TestRunner=kt;exports.URLCodeEditor=_t;exports.URLFileProvider=ze;exports.VERSION=At;exports.VersionHistory=Dt;exports.WorkflowCodeEditor=Rt;exports.WorkflowFileProvider=De;exports.createFileProvider=Le;exports.useFileManager=Pe;
54
+ `,R=()=>{c(!0),a(null),setTimeout(()=>c(!1),300)};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Preview"}),t.jsx("button",{className:"p-1 hover:bg-slate-100 rounded-md",onClick:R,children:t.jsx(h.IconRefresh,{size:16,className:i?"animate-spin":""})})]}),t.jsx("div",{className:"flex-1 bg-white overflow-auto",children:r?t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-md flex items-start",children:[t.jsx(h.IconAlertTriangle,{size:16,className:"text-red-500 mr-2 mt-0.5"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-red-800",children:"Preview Error"}),t.jsx("p",{className:"text-xs text-red-600",children:r})]})]}):t.jsx("iframe",{title:"Preview",className:"w-full h-full",srcDoc:v,sandbox:"allow-scripts",onError:()=>a("Failed to load preview")})})]})},kt=()=>{const o=[{id:"1",name:"Should format currency correctly",status:"passed",duration:"12ms"},{id:"2",name:"Should calculate discount",status:"passed",duration:"8ms"},{id:"3",name:"Should validate email format",status:"failed",duration:"5ms",error:"Expected true but received false"},{id:"4",name:"Should handle empty input",status:"passed",duration:"3ms"}];return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Test Runner"}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("button",{className:"p-1 hover:bg-slate-100 rounded-md mr-1",children:t.jsx(h.IconSettings,{size:14})}),t.jsxs("button",{className:"bg-slate-900 text-white text-xs px-2 py-1 rounded-md flex items-center",children:[t.jsx(h.IconPlayerPlay,{size:12,className:"mr-1"})," Run Tests"]})]})]}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"mb-3 p-2 bg-slate-50 rounded-md border border-slate-200",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-medium",children:"Test Summary"}),t.jsx("span",{className:"text-xs",children:"3 passed, 1 failed, 4 total"})]}),t.jsx("div",{className:"w-full h-2 bg-slate-200 rounded-full mt-2 overflow-hidden",children:t.jsx("div",{className:"h-full bg-emerald-500",style:{width:"75%"}})})]}),t.jsx("div",{children:o.map(r=>t.jsxs("div",{className:`p-2 mb-2 rounded-md ${r.status==="failed"?"bg-red-50 border border-red-100":"bg-slate-50 border border-slate-200"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[r.status==="passed"?t.jsx(h.IconCircleCheck,{size:16,className:"text-emerald-500 mr-2"}):t.jsx(h.IconCircleX,{size:16,className:"text-red-500 mr-2"}),t.jsx("span",{className:"text-sm",children:r.name})]}),t.jsx("span",{className:"text-xs text-slate-500",children:r.duration})]}),r.error&&t.jsx("div",{className:"mt-2 text-xs text-red-600 bg-red-50 p-2 rounded",children:r.error})]},r.id))}),t.jsx("div",{className:"mt-4",children:t.jsx("button",{className:"w-full py-2 border border-dashed border-slate-300 rounded-md text-sm text-slate-500 hover:bg-slate-50",children:"+ Add New Test Case"})})]})]})},Dt=()=>{const o=[{id:"v1",name:"Initial version",author:"John Doe",timestamp:"Today, 2:30 PM",current:!0},{id:"v2",name:"Added form validation",author:"John Doe",timestamp:"Today, 1:15 PM",current:!1},{id:"v3",name:"Fixed API integration",author:"Sarah Smith",timestamp:"Yesterday, 4:45 PM",current:!1},{id:"v4",name:"Initial setup",author:"Sarah Smith",timestamp:"Yesterday, 11:30 AM",current:!1}];return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Version History"}),t.jsx("button",{className:"text-xs text-slate-500 hover:text-slate-800",children:"Save Version"})]}),t.jsx("div",{className:"p-2",children:o.map(r=>t.jsxs("div",{className:`p-3 mb-2 rounded-md ${r.current?"bg-slate-100 border border-slate-200":"hover:bg-slate-50 cursor-pointer"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-medium",children:r.name}),r.current&&t.jsx("span",{className:"text-xs bg-emerald-100 text-emerald-800 px-2 py-0.5 rounded",children:"Current"})]}),t.jsxs("div",{className:"flex items-center mt-1 text-xs text-slate-500",children:[t.jsx(h.IconUser,{size:12,className:"mr-1"}),t.jsx("span",{className:"mr-3",children:r.author}),t.jsx(h.IconClock,{size:12,className:"mr-1"}),t.jsx("span",{children:r.timestamp})]}),!r.current&&t.jsx("div",{className:"mt-2",children:t.jsxs("button",{className:"text-xs flex items-center text-slate-600 hover:text-slate-900",children:[t.jsx(h.IconRotate,{size:12,className:"mr-1"})," Restore this version"]})})]},r.id))})]})},At="1.0.0";Object.defineProperty(exports,"Alert",{enumerable:!0,get:()=>N.Alert});Object.defineProperty(exports,"Button",{enumerable:!0,get:()=>N.Button});Object.defineProperty(exports,"Splitter",{enumerable:!0,get:()=>N.Splitter});Object.defineProperty(exports,"Tooltip",{enumerable:!0,get:()=>N.Tooltip});Object.defineProperty(exports,"Tree",{enumerable:!0,get:()=>N.Tree});exports.CodeEditor=$e;exports.CodeEditorWrapper=H;exports.DataExplorer=Pt;exports.EditorLayout=Me;exports.FileExplorer=Be;exports.FormCodeEditor=St;exports.FormFileProvider=Ae;exports.FunctionLibrary=Ot;exports.Header=Tt;exports.PreviewPanel=It;exports.TestRunner=kt;exports.URLCodeEditor=_t;exports.URLFileProvider=ze;exports.VERSION=At;exports.VersionHistory=Dt;exports.WorkflowCodeEditor=Rt;exports.WorkflowFileProvider=De;exports.createFileProvider=Le;exports.useFileManager=Pe;
package/dist/index.esm.js CHANGED
@@ -18,14 +18,14 @@ function Yt() {
18
18
  if (Oe) return $;
19
19
  Oe = 1;
20
20
  var o = ne, r = Symbol.for("react.element"), s = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, c = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
21
- function j(w, x, N) {
21
+ function y(w, x, N) {
22
22
  var d, E = {}, C = null, S = null;
23
23
  N !== void 0 && (C = "" + N), x.key !== void 0 && (C = "" + x.key), x.ref !== void 0 && (S = x.ref);
24
24
  for (d in x) i.call(x, d) && !g.hasOwnProperty(d) && (E[d] = x[d]);
25
25
  if (w && w.defaultProps) for (d in x = w.defaultProps, x) E[d] === void 0 && (E[d] = x[d]);
26
26
  return { $$typeof: r, type: w, key: C, ref: S, props: E, _owner: c.current };
27
27
  }
28
- return $.Fragment = s, $.jsx = j, $.jsxs = j, $;
28
+ return $.Fragment = s, $.jsx = y, $.jsxs = y, $;
29
29
  }
30
30
  var L = {};
31
31
  /**
@@ -40,7 +40,7 @@ var L = {};
40
40
  var Ie;
41
41
  function Ut() {
42
42
  return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && (function() {
43
- var o = ne, r = Symbol.for("react.element"), s = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), j = Symbol.for("react.provider"), w = Symbol.for("react.context"), x = Symbol.for("react.forward_ref"), N = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), M = Symbol.iterator, H = "@@iterator";
43
+ var o = ne, r = Symbol.for("react.element"), s = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), y = Symbol.for("react.provider"), w = Symbol.for("react.context"), x = Symbol.for("react.forward_ref"), N = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), M = Symbol.iterator, H = "@@iterator";
44
44
  function J(e) {
45
45
  if (e === null || typeof e != "object")
46
46
  return null;
@@ -68,7 +68,7 @@ function Ut() {
68
68
  var qe = !1, He = !1, Je = !1, Ge = !1, Ke = !1, ae;
69
69
  ae = Symbol.for("react.module.reference");
70
70
  function Xe(e) {
71
- return !!(typeof e == "string" || typeof e == "function" || e === i || e === g || Ke || e === c || e === N || e === d || Ge || e === S || qe || He || Je || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === E || e.$$typeof === j || e.$$typeof === w || e.$$typeof === x || // This needs to include all possible module reference object
71
+ return !!(typeof e == "string" || typeof e == "function" || e === i || e === g || Ke || e === c || e === N || e === d || Ge || e === S || qe || He || Je || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === E || e.$$typeof === y || e.$$typeof === w || e.$$typeof === x || // This needs to include all possible module reference object
72
72
  // types supported by any Flight configuration anywhere since
73
73
  // we don't know which Flight build this will end up being used
74
74
  // with.
@@ -110,7 +110,7 @@ function Ut() {
110
110
  case w:
111
111
  var n = e;
112
112
  return ie(n) + ".Consumer";
113
- case j:
113
+ case y:
114
114
  var a = e;
115
115
  return ie(a._context) + ".Provider";
116
116
  case x:
@@ -260,18 +260,18 @@ function Ut() {
260
260
  if (_ && l && typeof _.stack == "string") {
261
261
  for (var u = _.stack.split(`
262
262
  `), R = l.stack.split(`
263
- `), b = u.length - 1, y = R.length - 1; b >= 1 && y >= 0 && u[b] !== R[y]; )
264
- y--;
265
- for (; b >= 1 && y >= 0; b--, y--)
266
- if (u[b] !== R[y]) {
267
- if (b !== 1 || y !== 1)
263
+ `), b = u.length - 1, j = R.length - 1; b >= 1 && j >= 0 && u[b] !== R[j]; )
264
+ j--;
265
+ for (; b >= 1 && j >= 0; b--, j--)
266
+ if (u[b] !== R[j]) {
267
+ if (b !== 1 || j !== 1)
268
268
  do
269
- if (b--, y--, y < 0 || u[b] !== R[y]) {
269
+ if (b--, j--, j < 0 || u[b] !== R[j]) {
270
270
  var F = `
271
271
  ` + u[b].replace(" at new ", " at ");
272
272
  return e.displayName && F.includes("<anonymous>") && (F = F.replace("<anonymous>", e.displayName)), typeof e == "function" && W.set(e, F), F;
273
273
  }
274
- while (b >= 1 && y >= 0);
274
+ while (b >= 1 && j >= 0);
275
275
  break;
276
276
  }
277
277
  }
@@ -456,8 +456,8 @@ function Ut() {
456
456
  f[p] === void 0 && (f[p] = b[p]);
457
457
  }
458
458
  if (u || R) {
459
- var y = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
460
- u && ft(f, y), R && mt(f, y);
459
+ var j = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
460
+ u && ft(f, j), R && mt(f, j);
461
461
  }
462
462
  return ht(e, u, R, m, l, ye.current, f);
463
463
  }
@@ -583,9 +583,9 @@ Check the top-level render call using <` + a + ">.");
583
583
  var b;
584
584
  e === null ? b = "null" : Z(e) ? b = "array" : e !== void 0 && e.$$typeof === r ? (b = "<" + (T(e.type) || "Unknown") + " />", u = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, u);
585
585
  }
586
- var y = pt(e, n, a, m, p);
587
- if (y == null)
588
- return y;
586
+ var j = pt(e, n, a, m, p);
587
+ if (j == null)
588
+ return j;
589
589
  if (f) {
590
590
  var F = n.children;
591
591
  if (F !== void 0)
@@ -599,7 +599,7 @@ Check the top-level render call using <` + a + ">.");
599
599
  else
600
600
  Fe(F, e);
601
601
  }
602
- return e === i ? bt(y) : gt(y), y;
602
+ return e === i ? bt(j) : gt(j), j;
603
603
  }
604
604
  }
605
605
  function yt(e, n, a) {
@@ -618,7 +618,7 @@ function qt() {
618
618
  }
619
619
  var t = qt();
620
620
  function Ht(o) {
621
- const [r, s] = I([]), [i, c] = I(null), [g, j] = I(""), [w, x] = I(!1), [N, d] = I(null), E = A(async () => {
621
+ const [r, s] = I([]), [i, c] = I(null), [g, y] = I(""), [w, x] = I(!1), [N, d] = I(null), E = A(async () => {
622
622
  try {
623
623
  x(!0), d(null);
624
624
  const v = await o.getFiles();
@@ -636,11 +636,11 @@ function Ht(o) {
636
636
  try {
637
637
  x(!0), d(null);
638
638
  const h = await o.getFileContent(v);
639
- j(h);
639
+ y(h);
640
640
  } catch (h) {
641
641
  d(
642
642
  h instanceof Error ? h.message : "Failed to load file content"
643
- ), j("");
643
+ ), y("");
644
644
  } finally {
645
645
  x(!1);
646
646
  }
@@ -650,7 +650,7 @@ function Ht(o) {
650
650
  async (v) => {
651
651
  if (i)
652
652
  try {
653
- d(null), await o.updateFileContent(i, v), j(v), s(
653
+ d(null), await o.updateFileContent(i, v), y(v), s(
654
654
  (h) => Ye(h, i, { content: v })
655
655
  );
656
656
  } catch (h) {
@@ -888,7 +888,7 @@ const Zt = ({
888
888
  readOnly: c = !1,
889
889
  loading: g = !1
890
890
  }) => {
891
- const j = (w) => {
891
+ const y = (w) => {
892
892
  w !== void 0 && r(w);
893
893
  };
894
894
  return /* @__PURE__ */ t.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ t.jsx(
@@ -897,7 +897,7 @@ const Zt = ({
897
897
  height: "100%",
898
898
  defaultLanguage: s,
899
899
  defaultValue: o,
900
- onChange: j,
900
+ onChange: y,
901
901
  theme: "vs-light",
902
902
  options: {
903
903
  minimap: {
@@ -943,7 +943,7 @@ const Zt = ({
943
943
  ], er = ({
944
944
  activePanel: o,
945
945
  setActivePanel: r,
946
- allowedRoutes: s = ["explorer"]
946
+ allowedPannels: s
947
947
  }) => {
948
948
  const i = Nt(
949
949
  () => Qt.filter((c) => s.includes(c.id)),
@@ -968,14 +968,22 @@ const Zt = ({
968
968
  editor: r,
969
969
  rightPanel: s,
970
970
  activePanel: i,
971
- setActivePanel: c
971
+ setActivePanel: c,
972
+ allowedPannels: g = ["explorer"]
972
973
  }) => /* @__PURE__ */ t.jsxs("div", { className: "flex flex-1 overflow-hidden", children: [
973
- /* @__PURE__ */ t.jsx(er, { activePanel: i, setActivePanel: c }),
974
+ /* @__PURE__ */ t.jsx(
975
+ er,
976
+ {
977
+ activePanel: i,
978
+ setActivePanel: c,
979
+ allowedPannels: g
980
+ }
981
+ ),
974
982
  /* @__PURE__ */ t.jsx("div", { className: "flex-1", children: s ? /* @__PURE__ */ t.jsxs(
975
983
  O,
976
984
  {
977
985
  style: { height: "100%" },
978
- onResize: (g) => console.log(g),
986
+ onResize: (y) => console.log(y),
979
987
  children: [
980
988
  /* @__PURE__ */ t.jsx(
981
989
  O.Panel,
@@ -1022,14 +1030,14 @@ const Zt = ({
1022
1030
  error: c = null,
1023
1031
  onRefresh: g
1024
1032
  }) => {
1025
- const j = (N) => N.map((d) => ({
1033
+ const y = (N) => N.map((d) => ({
1026
1034
  title: d.name,
1027
1035
  key: d.id,
1028
1036
  icon: d.type === "file" ? /* @__PURE__ */ t.jsx(Tt, { size: 16, className: "text-slate-500 flex" }) : /* @__PURE__ */ t.jsx(De, { size: 16, className: "text-slate-500 flex" }),
1029
1037
  isLeaf: d.type === "file",
1030
- children: d.children ? j(d.children) : void 0,
1038
+ children: d.children ? y(d.children) : void 0,
1031
1039
  metadata: d.metadata
1032
- })), w = j(o), x = (N, d) => {
1040
+ })), w = y(o), x = (N, d) => {
1033
1041
  d?.node.isLeaf && d.node.key && s(d.node.key);
1034
1042
  };
1035
1043
  return /* @__PURE__ */ t.jsxs("div", { className: "h-full", children: [
@@ -1083,7 +1091,7 @@ const Zt = ({
1083
1091
  files: i,
1084
1092
  activeFile: c,
1085
1093
  fileContent: g,
1086
- loading: j,
1094
+ loading: y,
1087
1095
  error: w,
1088
1096
  setActiveFile: x,
1089
1097
  updateFileContent: N,
@@ -1099,7 +1107,7 @@ const Zt = ({
1099
1107
  files: i,
1100
1108
  activeFile: c,
1101
1109
  onFileSelect: x,
1102
- loading: j,
1110
+ loading: y,
1103
1111
  error: w,
1104
1112
  onRefresh: d
1105
1113
  }
@@ -1112,7 +1120,7 @@ const Zt = ({
1112
1120
  language: S,
1113
1121
  filename: C?.name,
1114
1122
  readOnly: o.settings?.readOnly,
1115
- loading: j
1123
+ loading: y
1116
1124
  }
1117
1125
  ),
1118
1126
  rightPanel: r,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superleap-code-editor",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A flexible, reusable code editor component with multiple file handling modes",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",