@qwanyx/stack 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -14,21 +14,21 @@
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 He;function Rt(){return He||(He=1,process.env.NODE_ENV!=="production"&&function(){var p=b,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),h=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),A=Symbol.iterator,T="@@iterator";function H(e){if(e===null||typeof e!="object")return null;var i=A&&e[A]||e[T];return typeof i=="function"?i:null}var G=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function F(e){{for(var i=arguments.length,c=new Array(i>1?i-1:0),m=1;m<i;m++)c[m-1]=arguments[m];K("error",e,c)}}function K(e,i,c){{var m=G.ReactDebugCurrentFrame,N=m.getStackAddendum();N!==""&&(i+="%s",c=c.concat([N]));var $=c.map(function(R){return String(R)});$.unshift("Warning: "+i),Function.prototype.apply.call(console[e],console,$)}}var _=!1,L=!1,v=!1,C=!1,M=!1,j;j=Symbol.for("react.module.reference");function O(e){return!!(typeof e=="string"||typeof e=="function"||e===n||e===s||M||e===o||e===g||e===d||C||e===P||_||L||v||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===k||e.$$typeof===l||e.$$typeof===h||e.$$typeof===u||e.$$typeof===j||e.getModuleId!==void 0))}function y(e,i,c){var m=e.displayName;if(m)return m;var N=i.displayName||i.name||"";return N!==""?c+"("+N+")":c}function W(e){return e.displayName||"Context"}function I(e){if(e==null)return null;if(typeof e.tag=="number"&&F("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 n:return"Fragment";case r:return"Portal";case s:return"Profiler";case o:return"StrictMode";case g:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case h:var i=e;return W(i)+".Consumer";case l:var c=e;return W(c._context)+".Provider";case u:return y(e,e.render,"ForwardRef");case k:var m=e.displayName||null;return m!==null?m:I(e.type)||"Memo";case x:{var N=e,$=N._payload,R=N._init;try{return I(R($))}catch{return null}}}return null}var S=Object.assign,B=0,V,Q,ne,ge,ye,me,xe;function ve(){}ve.__reactDisabledLog=!0;function ke(){{if(B===0){V=console.log,Q=console.info,ne=console.warn,ge=console.error,ye=console.group,me=console.groupCollapsed,xe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ve,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}B++}}function Re(){{if(B--,B===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},e,{value:V}),info:S({},e,{value:Q}),warn:S({},e,{value:ne}),error:S({},e,{value:ge}),group:S({},e,{value:ye}),groupCollapsed:S({},e,{value:me}),groupEnd:S({},e,{value:xe})})}B<0&&F("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ce=G.ReactCurrentDispatcher,ue;function se(e,i,c){{if(ue===void 0)try{throw Error()}catch(N){var m=N.stack.trim().match(/\n( *(at )?)/);ue=m&&m[1]||""}return`
17
+ */var He;function Rt(){return He||(He=1,process.env.NODE_ENV!=="production"&&function(){var p=b,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),h=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),A=Symbol.iterator,T="@@iterator";function H(e){if(e===null||typeof e!="object")return null;var i=A&&e[A]||e[T];return typeof i=="function"?i:null}var G=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function F(e){{for(var i=arguments.length,c=new Array(i>1?i-1:0),m=1;m<i;m++)c[m-1]=arguments[m];K("error",e,c)}}function K(e,i,c){{var m=G.ReactDebugCurrentFrame,N=m.getStackAddendum();N!==""&&(i+="%s",c=c.concat([N]));var $=c.map(function(R){return String(R)});$.unshift("Warning: "+i),Function.prototype.apply.call(console[e],console,$)}}var _=!1,L=!1,v=!1,C=!1,M=!1,j;j=Symbol.for("react.module.reference");function O(e){return!!(typeof e=="string"||typeof e=="function"||e===n||e===s||M||e===o||e===g||e===d||C||e===P||_||L||v||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===k||e.$$typeof===l||e.$$typeof===h||e.$$typeof===u||e.$$typeof===j||e.getModuleId!==void 0))}function y(e,i,c){var m=e.displayName;if(m)return m;var N=i.displayName||i.name||"";return N!==""?c+"("+N+")":c}function W(e){return e.displayName||"Context"}function I(e){if(e==null)return null;if(typeof e.tag=="number"&&F("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 n:return"Fragment";case r:return"Portal";case s:return"Profiler";case o:return"StrictMode";case g:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case h:var i=e;return W(i)+".Consumer";case l:var c=e;return W(c._context)+".Provider";case u:return y(e,e.render,"ForwardRef");case k:var m=e.displayName||null;return m!==null?m:I(e.type)||"Memo";case x:{var N=e,$=N._payload,R=N._init;try{return I(R($))}catch{return null}}}return null}var S=Object.assign,B=0,V,Q,te,ge,ye,me,xe;function ve(){}ve.__reactDisabledLog=!0;function ke(){{if(B===0){V=console.log,Q=console.info,te=console.warn,ge=console.error,ye=console.group,me=console.groupCollapsed,xe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ve,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}B++}}function Re(){{if(B--,B===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},e,{value:V}),info:S({},e,{value:Q}),warn:S({},e,{value:te}),error:S({},e,{value:ge}),group:S({},e,{value:ye}),groupCollapsed:S({},e,{value:me}),groupEnd:S({},e,{value:xe})})}B<0&&F("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ce=G.ReactCurrentDispatcher,ue;function se(e,i,c){{if(ue===void 0)try{throw Error()}catch(N){var m=N.stack.trim().match(/\n( *(at )?)/);ue=m&&m[1]||""}return`
18
18
  `+ue+e}}var de=!1,ae;{var Te=typeof WeakMap=="function"?WeakMap:Map;ae=new Te}function be(e,i){if(!e||de)return"";{var c=ae.get(e);if(c!==void 0)return c}var m;de=!0;var N=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $;$=ce.current,ce.current=null,ke();try{if(i){var R=function(){throw Error()};if(Object.defineProperty(R.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(R,[])}catch(q){m=q}Reflect.construct(e,[],R)}else{try{R.call()}catch(q){m=q}e.call(R.prototype)}}else{try{throw Error()}catch(q){m=q}e()}}catch(q){if(q&&m&&typeof q.stack=="string"){for(var E=q.stack.split(`
19
19
  `),Y=m.stack.split(`
20
20
  `),D=E.length-1,U=Y.length-1;D>=1&&U>=0&&E[D]!==Y[U];)U--;for(;D>=1&&U>=0;D--,U--)if(E[D]!==Y[U]){if(D!==1||U!==1)do if(D--,U--,U<0||E[D]!==Y[U]){var X=`
21
- `+E[D].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),typeof e=="function"&&ae.set(e,X),X}while(D>=1&&U>=0);break}}}finally{de=!1,ce.current=$,Re(),Error.prepareStackTrace=N}var le=e?e.displayName||e.name:"",re=le?se(le):"";return typeof e=="function"&&ae.set(e,re),re}function Ce(e,i,c){return be(e,!1)}function Oe(e){var i=e.prototype;return!!(i&&i.isReactComponent)}function ie(e,i,c){if(e==null)return"";if(typeof e=="function")return be(e,Oe(e));if(typeof e=="string")return se(e);switch(e){case g:return se("Suspense");case d:return se("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Ce(e.render);case k:return ie(e.type,i,c);case x:{var m=e,N=m._payload,$=m._init;try{return ie($(N),i,c)}catch{}}}return""}var te=Object.prototype.hasOwnProperty,f={},w=G.ReactDebugCurrentFrame;function z(e){if(e){var i=e._owner,c=ie(e.type,e._source,i?i.type:null);w.setExtraStackFrame(c)}else w.setExtraStackFrame(null)}function J(e,i,c,m,N){{var $=Function.call.bind(te);for(var R in e)if($(e,R)){var E=void 0;try{if(typeof e[R]!="function"){var Y=Error((m||"React class")+": "+c+" type `"+R+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[R]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Y.name="Invariant Violation",Y}E=e[R](i,R,m,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(D){E=D}E&&!(E instanceof Error)&&(z(N),F("%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).",m||"React class",c,R,typeof E),z(null)),E instanceof Error&&!(E.message in f)&&(f[E.message]=!0,z(N),F("Failed %s type: %s",c,E.message),z(null))}}}var ee=Array.isArray;function Z(e){return ee(e)}function Ne(e){{var i=typeof Symbol=="function"&&Symbol.toStringTag,c=i&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c}}function we(e){try{return _e(e),!1}catch{return!0}}function _e(e){return""+e}function Be(e){if(we(e))return F("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ne(e)),_e(e)}var Le=G.ReactCurrentOwner,nt={key:!0,ref:!0,__self:!0,__source:!0},ze,Ge;function st(e){if(te.call(e,"ref")){var i=Object.getOwnPropertyDescriptor(e,"ref").get;if(i&&i.isReactWarning)return!1}return e.ref!==void 0}function at(e){if(te.call(e,"key")){var i=Object.getOwnPropertyDescriptor(e,"key").get;if(i&&i.isReactWarning)return!1}return e.key!==void 0}function it(e,i){typeof e.ref=="string"&&Le.current}function ot(e,i){{var c=function(){ze||(ze=!0,F("%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)",i))};c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}}function lt(e,i){{var c=function(){Ge||(Ge=!0,F("%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)",i))};c.isReactWarning=!0,Object.defineProperty(e,"ref",{get:c,configurable:!0})}}var ct=function(e,i,c,m,N,$,R){var E={$$typeof:t,type:e,key:i,ref:c,props:R,_owner:$};return E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(E,"_self",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.defineProperty(E,"_source",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E};function ut(e,i,c,m,N){{var $,R={},E=null,Y=null;c!==void 0&&(Be(c),E=""+c),at(i)&&(Be(i.key),E=""+i.key),st(i)&&(Y=i.ref,it(i,N));for($ in i)te.call(i,$)&&!nt.hasOwnProperty($)&&(R[$]=i[$]);if(e&&e.defaultProps){var D=e.defaultProps;for($ in D)R[$]===void 0&&(R[$]=D[$])}if(E||Y){var U=typeof e=="function"?e.displayName||e.name||"Unknown":e;E&&ot(R,U),Y&&lt(R,U)}return ct(e,E,Y,N,m,Le.current,R)}}var Pe=G.ReactCurrentOwner,We=G.ReactDebugCurrentFrame;function oe(e){if(e){var i=e._owner,c=ie(e.type,e._source,i?i.type:null);We.setExtraStackFrame(c)}else We.setExtraStackFrame(null)}var Ae;Ae=!1;function $e(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function Ye(){{if(Pe.current){var e=I(Pe.current.type);if(e)return`
21
+ `+E[D].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),typeof e=="function"&&ae.set(e,X),X}while(D>=1&&U>=0);break}}}finally{de=!1,ce.current=$,Re(),Error.prepareStackTrace=N}var le=e?e.displayName||e.name:"",ne=le?se(le):"";return typeof e=="function"&&ae.set(e,ne),ne}function Ce(e,i,c){return be(e,!1)}function Oe(e){var i=e.prototype;return!!(i&&i.isReactComponent)}function ie(e,i,c){if(e==null)return"";if(typeof e=="function")return be(e,Oe(e));if(typeof e=="string")return se(e);switch(e){case g:return se("Suspense");case d:return se("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Ce(e.render);case k:return ie(e.type,i,c);case x:{var m=e,N=m._payload,$=m._init;try{return ie($(N),i,c)}catch{}}}return""}var re=Object.prototype.hasOwnProperty,f={},w=G.ReactDebugCurrentFrame;function z(e){if(e){var i=e._owner,c=ie(e.type,e._source,i?i.type:null);w.setExtraStackFrame(c)}else w.setExtraStackFrame(null)}function J(e,i,c,m,N){{var $=Function.call.bind(re);for(var R in e)if($(e,R)){var E=void 0;try{if(typeof e[R]!="function"){var Y=Error((m||"React class")+": "+c+" type `"+R+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[R]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Y.name="Invariant Violation",Y}E=e[R](i,R,m,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(D){E=D}E&&!(E instanceof Error)&&(z(N),F("%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).",m||"React class",c,R,typeof E),z(null)),E instanceof Error&&!(E.message in f)&&(f[E.message]=!0,z(N),F("Failed %s type: %s",c,E.message),z(null))}}}var ee=Array.isArray;function Z(e){return ee(e)}function Ne(e){{var i=typeof Symbol=="function"&&Symbol.toStringTag,c=i&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c}}function we(e){try{return _e(e),!1}catch{return!0}}function _e(e){return""+e}function Be(e){if(we(e))return F("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ne(e)),_e(e)}var Le=G.ReactCurrentOwner,nt={key:!0,ref:!0,__self:!0,__source:!0},ze,Ge;function st(e){if(re.call(e,"ref")){var i=Object.getOwnPropertyDescriptor(e,"ref").get;if(i&&i.isReactWarning)return!1}return e.ref!==void 0}function at(e){if(re.call(e,"key")){var i=Object.getOwnPropertyDescriptor(e,"key").get;if(i&&i.isReactWarning)return!1}return e.key!==void 0}function it(e,i){typeof e.ref=="string"&&Le.current}function ot(e,i){{var c=function(){ze||(ze=!0,F("%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)",i))};c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}}function lt(e,i){{var c=function(){Ge||(Ge=!0,F("%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)",i))};c.isReactWarning=!0,Object.defineProperty(e,"ref",{get:c,configurable:!0})}}var ct=function(e,i,c,m,N,$,R){var E={$$typeof:t,type:e,key:i,ref:c,props:R,_owner:$};return E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(E,"_self",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.defineProperty(E,"_source",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E};function ut(e,i,c,m,N){{var $,R={},E=null,Y=null;c!==void 0&&(Be(c),E=""+c),at(i)&&(Be(i.key),E=""+i.key),st(i)&&(Y=i.ref,it(i,N));for($ in i)re.call(i,$)&&!nt.hasOwnProperty($)&&(R[$]=i[$]);if(e&&e.defaultProps){var D=e.defaultProps;for($ in D)R[$]===void 0&&(R[$]=D[$])}if(E||Y){var U=typeof e=="function"?e.displayName||e.name||"Unknown":e;E&&ot(R,U),Y&&lt(R,U)}return ct(e,E,Y,N,m,Le.current,R)}}var Pe=G.ReactCurrentOwner,We=G.ReactDebugCurrentFrame;function oe(e){if(e){var i=e._owner,c=ie(e.type,e._source,i?i.type:null);We.setExtraStackFrame(c)}else We.setExtraStackFrame(null)}var Ae;Ae=!1;function $e(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function Ye(){{if(Pe.current){var e=I(Pe.current.type);if(e)return`
22
22
 
23
23
  Check the render method of \``+e+"`."}return""}}function dt(e){return""}var qe={};function ft(e){{var i=Ye();if(!i){var c=typeof e=="string"?e:e.displayName||e.name;c&&(i=`
24
24
 
25
- Check the top-level render call using <`+c+">.")}return i}}function Ve(e,i){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=ft(i);if(qe[c])return;qe[c]=!0;var m="";e&&e._owner&&e._owner!==Pe.current&&(m=" It was passed a child from "+I(e._owner.type)+"."),oe(e),F('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,m),oe(null)}}function Je(e,i){{if(typeof e!="object")return;if(Z(e))for(var c=0;c<e.length;c++){var m=e[c];$e(m)&&Ve(m,i)}else if($e(e))e._store&&(e._store.validated=!0);else if(e){var N=H(e);if(typeof N=="function"&&N!==e.entries)for(var $=N.call(e),R;!(R=$.next()).done;)$e(R.value)&&Ve(R.value,i)}}}function pt(e){{var i=e.type;if(i==null||typeof i=="string")return;var c;if(typeof i=="function")c=i.propTypes;else if(typeof i=="object"&&(i.$$typeof===u||i.$$typeof===k))c=i.propTypes;else return;if(c){var m=I(i);J(c,e.props,"prop",m,e)}else if(i.PropTypes!==void 0&&!Ae){Ae=!0;var N=I(i);F("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",N||"Unknown")}typeof i.getDefaultProps=="function"&&!i.getDefaultProps.isReactClassApproved&&F("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ht(e){{for(var i=Object.keys(e.props),c=0;c<i.length;c++){var m=i[c];if(m!=="children"&&m!=="key"){oe(e),F("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",m),oe(null);break}}e.ref!==null&&(oe(e),F("Invalid attribute `ref` supplied to `React.Fragment`."),oe(null))}}var Ke={};function Qe(e,i,c,m,N,$){{var R=O(e);if(!R){var E="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(E+=" 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 Y=dt();Y?E+=Y:E+=Ye();var D;e===null?D="null":Z(e)?D="array":e!==void 0&&e.$$typeof===t?(D="<"+(I(e.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):D=typeof e,F("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",D,E)}var U=ut(e,i,c,N,$);if(U==null)return U;if(R){var X=i.children;if(X!==void 0)if(m)if(Z(X)){for(var le=0;le<X.length;le++)Je(X[le],e);Object.freeze&&Object.freeze(X)}else F("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 Je(X,e)}if(te.call(i,"key")){var re=I(e),q=Object.keys(i).filter(function(bt){return bt!=="key"}),Fe=q.length>0?"{key: someKey, "+q.join(": ..., ")+": ...}":"{key: someKey}";if(!Ke[re+Fe]){var vt=q.length>0?"{"+q.join(": ..., ")+": ...}":"{}";F(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+c+">.")}return i}}function Ve(e,i){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=ft(i);if(qe[c])return;qe[c]=!0;var m="";e&&e._owner&&e._owner!==Pe.current&&(m=" It was passed a child from "+I(e._owner.type)+"."),oe(e),F('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,m),oe(null)}}function Je(e,i){{if(typeof e!="object")return;if(Z(e))for(var c=0;c<e.length;c++){var m=e[c];$e(m)&&Ve(m,i)}else if($e(e))e._store&&(e._store.validated=!0);else if(e){var N=H(e);if(typeof N=="function"&&N!==e.entries)for(var $=N.call(e),R;!(R=$.next()).done;)$e(R.value)&&Ve(R.value,i)}}}function pt(e){{var i=e.type;if(i==null||typeof i=="string")return;var c;if(typeof i=="function")c=i.propTypes;else if(typeof i=="object"&&(i.$$typeof===u||i.$$typeof===k))c=i.propTypes;else return;if(c){var m=I(i);J(c,e.props,"prop",m,e)}else if(i.PropTypes!==void 0&&!Ae){Ae=!0;var N=I(i);F("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",N||"Unknown")}typeof i.getDefaultProps=="function"&&!i.getDefaultProps.isReactClassApproved&&F("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ht(e){{for(var i=Object.keys(e.props),c=0;c<i.length;c++){var m=i[c];if(m!=="children"&&m!=="key"){oe(e),F("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",m),oe(null);break}}e.ref!==null&&(oe(e),F("Invalid attribute `ref` supplied to `React.Fragment`."),oe(null))}}var Ke={};function Qe(e,i,c,m,N,$){{var R=O(e);if(!R){var E="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(E+=" 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 Y=dt();Y?E+=Y:E+=Ye();var D;e===null?D="null":Z(e)?D="array":e!==void 0&&e.$$typeof===t?(D="<"+(I(e.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):D=typeof e,F("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",D,E)}var U=ut(e,i,c,N,$);if(U==null)return U;if(R){var X=i.children;if(X!==void 0)if(m)if(Z(X)){for(var le=0;le<X.length;le++)Je(X[le],e);Object.freeze&&Object.freeze(X)}else F("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 Je(X,e)}if(re.call(i,"key")){var ne=I(e),q=Object.keys(i).filter(function(bt){return bt!=="key"}),Fe=q.length>0?"{key: someKey, "+q.join(": ..., ")+": ...}":"{key: someKey}";if(!Ke[ne+Fe]){var vt=q.length>0?"{"+q.join(": ..., ")+": ...}":"{}";F(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,Fe,re,vt,re),Ke[re+Fe]=!0}}return e===n?ht(U):pt(U),U}}function gt(e,i,c){return Qe(e,i,c,!0)}function yt(e,i,c){return Qe(e,i,c,!1)}var mt=yt,xt=gt;he.Fragment=n,he.jsx=mt,he.jsxs=xt}()),he}process.env.NODE_ENV==="production"?Ue.exports=kt():Ue.exports=Rt();var a=Ue.exports;class Ee{static filter(t,r){return t.filter(r)}static filterBy(t,r,n){return t.filter(o=>o[r]===n)}static filterByFields(t,r){return t.filter(n=>Object.entries(r).every(([o,s])=>n[o]===s))}static sort(t,r,n="asc"){return[...t].sort((o,s)=>{const l=o[r],h=s[r];if(l===h)return 0;let u=0;return l>h&&(u=1),l<h&&(u=-1),n==="asc"?u:-u})}static search(t,r,n){if(!r.trim())return t;const o=r.toLowerCase();return t.filter(s=>n.some(l=>{const h=s[l];return h==null?!1:String(h).toLowerCase().includes(o)}))}static paginate(t,r,n){const o=(r-1)*n,s=o+n;return{data:t.slice(o,s),total:t.length,page:r,totalPages:Math.ceil(t.length/n)}}static groupBy(t,r){return t.reduce((n,o)=>{const s=String(o[r]);return n[s]||(n[s]=[]),n[s].push(o),n},{})}static unique(t,r){const n=t.map(o=>o[r]);return[...new Set(n)]}static countBy(t,r){return t.reduce((n,o)=>{const s=String(o[r]);return n[s]=(n[s]||0)+1,n},{})}static pipe(t,r){return r.reduce((n,o)=>o(n),t)}}function Tt({endpoint:p,params:t,layout:r="list",title:n,emptyMessage:o="No items found",renderItem:s,keyExtractor:l=(T,H)=>T.id||T._id||String(H),searchable:h=!1,searchFields:u=[],searchPlaceholder:g="Search...",filters:d=[],pageSize:k=20,onItemClick:x,onRefresh:P,theme:A={}}){const{data:T,loading:H,error:G,refetch:F}=rt(p,t),[K,_]=b.useState(""),[L,v]=b.useState({}),[C,M]=b.useState(1),j=b.useMemo(()=>{if(!T)return{data:[],total:0,totalPages:0};let S=T;return h&&K&&u.length>0&&(S=Ee.search(S,K,u)),Object.keys(L).length>0&&(S=Ee.filterByFields(S,L)),Ee.paginate(S,C,k)},[T,K,L,C,k,h,u]);b.useEffect(()=>{M(1)},[K,L]);const O=()=>{_(""),v({}),M(1),F(),P==null||P()},y={background:A.background||"#ffffff",cardBackground:A.cardBackground||"#f9fafb",text:A.text||"#111827",textSecondary:A.textSecondary||"#6b7280",border:A.border||"#e5e7eb",primary:A.primary||"#3b82f6"},I=s||(S=>a.jsxs("div",{style:{padding:"16px",cursor:x?"pointer":"default"},children:[a.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:y.text},children:S.title||S.name||S.label||"Untitled"}),S.description&&a.jsx("div",{style:{fontSize:"13px",color:y.textSecondary,marginTop:"4px"},children:S.description})]}));return H&&!T?a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:y.textSecondary},children:"Loading..."}):G?a.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[a.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),a.jsx("div",{style:{fontSize:"14px"},children:G.message}),a.jsx("button",{onClick:O,style:{marginTop:"16px",padding:"8px 16px",background:y.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):a.jsxs("div",{style:{background:y.background,borderRadius:"12px",overflow:"hidden"},children:[(n||h||d.length>0)&&a.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${y.border}`},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:h||d.length>0?"12px":"0"},children:[n&&a.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:y.text},children:n}),a.jsx("button",{onClick:O,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${y.border}`,borderRadius:"6px",color:y.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),h&&a.jsx("input",{type:"text",placeholder:g,value:K,onChange:S=>_(S.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${y.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),a.jsx("div",{style:{display:r==="grid"?"grid":"flex",flexDirection:r==="list"?"column":void 0,gridTemplateColumns:r==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:r==="list"?"0":"16px",padding:r==="list"?"0":"16px"},children:j.data.length===0?a.jsx("div",{style:{padding:"48px",textAlign:"center",color:y.textSecondary},children:o}):j.data.map((S,B)=>a.jsx("div",{onClick:()=>x==null?void 0:x(S),style:{background:y.cardBackground,borderRadius:r==="list"?"0":"8px",borderBottom:r==="list"?`1px solid ${y.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:V=>{x&&(V.currentTarget.style.background=y.border)},onMouseLeave:V=>{V.currentTarget.style.background=y.cardBackground},children:I(S,B)},l(S,B)))}),j.totalPages>1&&a.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${y.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsxs("div",{style:{fontSize:"13px",color:y.textSecondary},children:["Page ",C," of ",j.totalPages]}),a.jsxs("div",{style:{display:"flex",gap:"8px"},children:[a.jsx("button",{onClick:()=>M(S=>Math.max(1,S-1)),disabled:C===1,style:{padding:"6px 12px",border:`1px solid ${y.border}`,borderRadius:"6px",background:"white",cursor:C===1?"not-allowed":"pointer",opacity:C===1?.5:1},children:"Previous"}),a.jsx("button",{onClick:()=>M(S=>Math.min(j.totalPages,S+1)),disabled:C===j.totalPages,style:{padding:"6px 12px",border:`1px solid ${y.border}`,borderRadius:"6px",background:"white",cursor:C===j.totalPages?"not-allowed":"pointer",opacity:C===j.totalPages?.5:1},children:"Next"})]})]})]})}function Ct({item:p,onClick:t,title:r=l=>l.title||l.name||l.label||"Untitled",subtitle:n=l=>l.description||l.subtitle||"",image:o=l=>l.image||l.thumbnail||l.photo,badge:s=l=>l.badge||l.tag||l.type}){const l=r(p),h=n(p),u=o(p),g=s(p);return a.jsxs("div",{onClick:t,className:`
30
+ <%s key={someKey} {...props} />`,Fe,ne,vt,ne),Ke[ne+Fe]=!0}}return e===n?ht(U):pt(U),U}}function gt(e,i,c){return Qe(e,i,c,!0)}function yt(e,i,c){return Qe(e,i,c,!1)}var mt=yt,xt=gt;he.Fragment=n,he.jsx=mt,he.jsxs=xt}()),he}process.env.NODE_ENV==="production"?Ue.exports=kt():Ue.exports=Rt();var a=Ue.exports;class Ee{static filter(t,r){return t.filter(r)}static filterBy(t,r,n){return t.filter(o=>o[r]===n)}static filterByFields(t,r){return t.filter(n=>Object.entries(r).every(([o,s])=>n[o]===s))}static sort(t,r,n="asc"){return[...t].sort((o,s)=>{const l=o[r],h=s[r];if(l===h)return 0;let u=0;return l>h&&(u=1),l<h&&(u=-1),n==="asc"?u:-u})}static search(t,r,n){if(!r.trim())return t;const o=r.toLowerCase();return t.filter(s=>n.some(l=>{const h=s[l];return h==null?!1:String(h).toLowerCase().includes(o)}))}static paginate(t,r,n){const o=(r-1)*n,s=o+n;return{data:t.slice(o,s),total:t.length,page:r,totalPages:Math.ceil(t.length/n)}}static groupBy(t,r){return t.reduce((n,o)=>{const s=String(o[r]);return n[s]||(n[s]=[]),n[s].push(o),n},{})}static unique(t,r){const n=t.map(o=>o[r]);return[...new Set(n)]}static countBy(t,r){return t.reduce((n,o)=>{const s=String(o[r]);return n[s]=(n[s]||0)+1,n},{})}static pipe(t,r){return r.reduce((n,o)=>o(n),t)}}function Tt({endpoint:p,params:t,layout:r="list",title:n,emptyMessage:o="No items found",renderItem:s,keyExtractor:l=(T,H)=>T.id||T._id||String(H),searchable:h=!1,searchFields:u=[],searchPlaceholder:g="Search...",filters:d=[],pageSize:k=20,onItemClick:x,onRefresh:P,theme:A={}}){const{data:T,loading:H,error:G,refetch:F}=rt(p,t),[K,_]=b.useState(""),[L,v]=b.useState({}),[C,M]=b.useState(1),j=b.useMemo(()=>{if(!T)return{data:[],total:0,totalPages:0};let S=T;return h&&K&&u.length>0&&(S=Ee.search(S,K,u)),Object.keys(L).length>0&&(S=Ee.filterByFields(S,L)),Ee.paginate(S,C,k)},[T,K,L,C,k,h,u]);b.useEffect(()=>{M(1)},[K,L]);const O=()=>{_(""),v({}),M(1),F(),P==null||P()},y={background:A.background||"#ffffff",cardBackground:A.cardBackground||"#f9fafb",text:A.text||"#111827",textSecondary:A.textSecondary||"#6b7280",border:A.border||"#e5e7eb",primary:A.primary||"#3b82f6"},I=s||(S=>a.jsxs("div",{style:{padding:"16px",cursor:x?"pointer":"default"},children:[a.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:y.text},children:S.title||S.name||S.label||"Untitled"}),S.description&&a.jsx("div",{style:{fontSize:"13px",color:y.textSecondary,marginTop:"4px"},children:S.description})]}));return H&&!T?a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:y.textSecondary},children:"Loading..."}):G?a.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[a.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),a.jsx("div",{style:{fontSize:"14px"},children:G.message}),a.jsx("button",{onClick:O,style:{marginTop:"16px",padding:"8px 16px",background:y.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):a.jsxs("div",{style:{background:y.background,borderRadius:"12px",overflow:"hidden"},children:[(n||h||d.length>0)&&a.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${y.border}`},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:h||d.length>0?"12px":"0"},children:[n&&a.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:y.text},children:n}),a.jsx("button",{onClick:O,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${y.border}`,borderRadius:"6px",color:y.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),h&&a.jsx("input",{type:"text",placeholder:g,value:K,onChange:S=>_(S.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${y.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),a.jsx("div",{style:{display:r==="grid"?"grid":"flex",flexDirection:r==="list"?"column":void 0,gridTemplateColumns:r==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:r==="list"?"0":"16px",padding:r==="list"?"0":"16px"},children:j.data.length===0?a.jsx("div",{style:{padding:"48px",textAlign:"center",color:y.textSecondary},children:o}):j.data.map((S,B)=>a.jsx("div",{onClick:()=>x==null?void 0:x(S),style:{background:y.cardBackground,borderRadius:r==="list"?"0":"8px",borderBottom:r==="list"?`1px solid ${y.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:V=>{x&&(V.currentTarget.style.background=y.border)},onMouseLeave:V=>{V.currentTarget.style.background=y.cardBackground},children:I(S,B)},l(S,B)))}),j.totalPages>1&&a.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${y.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsxs("div",{style:{fontSize:"13px",color:y.textSecondary},children:["Page ",C," of ",j.totalPages]}),a.jsxs("div",{style:{display:"flex",gap:"8px"},children:[a.jsx("button",{onClick:()=>M(S=>Math.max(1,S-1)),disabled:C===1,style:{padding:"6px 12px",border:`1px solid ${y.border}`,borderRadius:"6px",background:"white",cursor:C===1?"not-allowed":"pointer",opacity:C===1?.5:1},children:"Previous"}),a.jsx("button",{onClick:()=>M(S=>Math.min(j.totalPages,S+1)),disabled:C===j.totalPages,style:{padding:"6px 12px",border:`1px solid ${y.border}`,borderRadius:"6px",background:"white",cursor:C===j.totalPages?"not-allowed":"pointer",opacity:C===j.totalPages?.5:1},children:"Next"})]})]})]})}function Ct({item:p,onClick:t,title:r=l=>l.title||l.name||l.label||"Untitled",subtitle:n=l=>l.description||l.subtitle||"",image:o=l=>l.image||l.thumbnail||l.photo,badge:s=l=>l.badge||l.tag||l.type}){const l=r(p),h=n(p),u=o(p),g=s(p);return a.jsxs("div",{onClick:t,className:`
31
31
  flex items-center gap-4 p-4 border-b border-gray-200
32
32
  hover:bg-gray-50 transition-colors
33
33
  ${t?"cursor-pointer":""}
34
- `,children:[u&&a.jsx("div",{className:"flex-shrink-0",children:a.jsx("img",{src:u,alt:l,className:"w-16 h-16 object-cover rounded-lg"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-medium text-gray-900 truncate",children:l}),g&&a.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:g})]}),h&&a.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:h})]}),t&&a.jsx("div",{className:"flex-shrink-0 text-gray-400",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function Ot({item:p,onClose:t,title:r=s=>s.title||s.name||s.label||"Detail",image:n=s=>s.image||s.thumbnail||s.photo,fields:o=[]}){if(!p)return null;const s=r(p),l=n(p);return a.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[a.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:s}),t&&a.jsx("button",{onClick:t,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-6",children:[l&&a.jsx("div",{className:"mb-6",children:a.jsx("img",{src:l,alt:s,className:"w-full h-64 object-cover rounded-lg"})}),o.length>0&&a.jsx("div",{className:"space-y-4",children:o.map((h,u)=>{const g=h.value(p);return g==null||g===""?null:a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:h.label}),a.jsx("div",{className:"text-base text-gray-900",children:typeof g=="object"?JSON.stringify(g,null,2):String(g)})]},u)})}),o.length===0&&a.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(p,null,2)})]}),t&&a.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:a.jsx("button",{onClick:t,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const Nt={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function Pt({nodes:p,cardCount:t=2,minInterval:r=1e3,maxInterval:n=3e3,onCardClick:o,cardSize:s="medium",className:l=""}){const h=Math.min(Math.max(t,1),5),[u,g]=b.useState([]),[d,k]=b.useState([]),[x,P]=b.useState(Array(h).fill(!1)),[A,T]=b.useState(Array(h).fill(!1)),H=b.useRef([]),G=b.useCallback(v=>{const C=p.filter(j=>!v.includes(j._id));if(C.length===0)return null;const M=Math.floor(Math.random()*C.length);return C[M]},[p]),F=b.useCallback(()=>Math.random()*(n-r)+r,[r,n]);b.useEffect(()=>{if(p.length===0){g([]),k([]);return}const v=[],C=[],M=[];for(let j=0;j<h&&j<p.length;j++){const O=G(M);O&&(v.push(O),M.push(O._id))}for(let j=0;j<v.length;j++){const O=[v[j]._id,...v.filter((W,I)=>I!==j).map(W=>W._id)],y=G(O);y?C.push(y):C.push(v[j])}g(v),k(C)},[p,h,G]);const K=b.useCallback(v=>{const C=F(),M=setTimeout(()=>{P(j=>{const O=[...j];return O[v]=!O[v],O}),setTimeout(()=>{T(j=>{const O=[...j];return O[v]=!O[v],O}),setTimeout(()=>{const j=!A[v];j&&g(O=>{const y=[...O];return y[v]=d[v],y}),k(O=>{const y=[...O],I=[(j?d[v]:u[v])._id,...u.filter((B,V)=>V!==v).map(B=>B._id),...O.filter((B,V)=>V!==v).map(B=>B._id)],S=G(I);return S&&(y[v]=S),y}),setTimeout(()=>{K(v)},150)},200)},150)},C);H.current[v]=M},[F,G,u,d,A]),_=b.useRef(!1);b.useEffect(()=>{if(!(u.length===0||p.length<=1)&&!_.current){_.current=!0;for(let v=0;v<u.length;v++)K(v);return()=>{H.current.forEach(v=>clearTimeout(v)),H.current=[],_.current=!1}}},[u.length,p.length]);const L=v=>{o&&o(v)};return p.length===0?a.jsx("div",{className:`flex items-center justify-center p-8 ${l}`,children:a.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):u.length===0?a.jsx("div",{className:`flex items-center justify-center p-8 ${l}`,children:a.jsx("p",{className:"text-gray-500",children:"Loading..."})}):a.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${l}`,children:u.map((v,C)=>{const M=d[C],j=A[C];return a.jsx("div",{className:`relative ${Nt[s]}`,style:{perspective:"1000px"},onClick:()=>L(j?M:v),children:a.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${x[C]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[a.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:j?0:1},children:a.jsxs("div",{style:{transform:x[C]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[a.jsx("img",{src:v.data.image,alt:v.title,className:"w-full h-full object-cover"}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:a.jsx("p",{className:"text-white text-sm font-medium truncate",children:v.title})})]})}),M&&a.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:j?1:0},children:a.jsxs("div",{style:{transform:x[C]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[a.jsx("img",{src:M.data.image,alt:M.title,className:"w-full h-full object-cover"}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:a.jsx("p",{className:"text-white text-sm font-medium truncate",children:M.title})})]})})]})},`slot-${C}`)})})}function je(p){if(!p)return"";const t=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return p.replace(t,(r,n,o,s)=>{try{if(o.toUpperCase()==="B"){const l=atob(s);return decodeURIComponent(escape(l))}else if(o.toUpperCase()==="Q"){const l=s.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(h,u)=>String.fromCharCode(parseInt(u,16)));return decodeURIComponent(escape(l))}}catch(l){console.warn("MIME decode error:",l)}return r}).replace(/\s+/g," ").trim()}const At={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function $t({baseUrl:p,systemId:t,accountId:r,limit:n=30,folder:o,selectable:s=!0,showDetail:l=!1,emptyMessage:h="No emails",autoLoad:u=!0,onSelect:g,onSelectionChange:d,onDelete:k,onError:x,onLoad:P,renderItem:A,renderDetail:T,renderActions:H,renderEmpty:G,renderLoading:F,theme:K={}}){const _={...At,...K},[L,v]=b.useState([]),[C,M]=b.useState(!1),[j,O]=b.useState(null),[y,W]=b.useState(new Set),[I,S]=b.useState(null),[B,V]=b.useState(null),Q=b.useMemo(()=>t?new Ze({baseUrl:p,system_id:t}):null,[p,t]),ne=b.useCallback(async()=>{if(Q){M(!0),O(null);try{const f=await Q.listEmails(r,n,o);if(f!=null&&f.messages){const w=[...f.messages].sort((z,J)=>new Date(J.date).getTime()-new Date(z.date).getTime());v(w),P==null||P(w)}}catch(f){const w=f instanceof Error?f:new Error("Failed to fetch emails");O(w.message),x==null||x(w)}M(!1)}},[Q,r,n,o,x,P]);b.useEffect(()=>{u&&ne()},[u,ne]);const ge=b.useCallback(f=>{g==null||g(f),l&&V(f)},[g,l]),ye=b.useCallback((f,w,z)=>{if(!s){g==null||g(f),l&&V(f);return}const J=f.uid;if(z.shiftKey&&I!==null){const ee=Math.min(I,w),Z=Math.max(I,w),Ne=L.slice(ee,Z+1).map(_e=>_e.uid),we=new Set(Ne);W(we),d==null||d(Array.from(we))}else if(z.ctrlKey||z.metaKey)W(ee=>{const Z=new Set(ee);return Z.has(J)?Z.delete(J):Z.add(J),d==null||d(Array.from(Z)),Z}),S(w);else{const ee=new Set([J]);W(ee),S(w),d==null||d(Array.from(ee))}},[s,I,L,y,g,d,l]),me=b.useCallback(async()=>{if(!(!Q||y.size===0))try{const f=await Q.trashEmails(r,Array.from(y));if(console.log("Trash result:",f),f.success&&f.moved>0){v(z=>z.filter(J=>!y.has(J.uid)));const w=Array.from(y);W(new Set),k==null||k(w)}else O("Failed to move emails to trash")}catch(f){const w=f instanceof Error?f:new Error("Trash failed");console.error("Trash error:",w),O(w.message),x==null||x(w)}},[Q,r,y,k,x]),xe=b.useCallback(async()=>{if(!(!Q||y.size===0))try{const f=await Q.archiveEmails(r,Array.from(y));if(console.log("Archive result:",f),f.success&&f.archived>0){v(z=>z.filter(J=>!y.has(J.uid)));const w=Array.from(y);W(new Set),k==null||k(w)}else O("Failed to archive emails")}catch(f){const w=f instanceof Error?f:new Error("Archive failed");console.error("Archive error:",w),O(w.message),x==null||x(w)}},[Q,r,y,k,x]),ve=b.useCallback(()=>{if(y.size===L.length)W(new Set),d==null||d([]);else{const f=new Set(L.map(w=>w.uid));W(f),d==null||d(Array.from(f))}},[L,y.size,d]),ke=b.useCallback(()=>{W(new Set),d==null||d([])},[d]),Re={delete:me,archive:xe,refresh:ne,selectAll:ve,clearSelection:ke},ce=f=>{if(!f)return"";const w=new Date(f),z=new Date;return w.toDateString()===z.toDateString()?w.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):w.toLocaleDateString([],{month:"short",day:"numeric"})},ue=(f,w)=>a.jsx("div",{style:{padding:"12px 16px",background:w?_.selectedBackground:f.seen?_.cardBackground:_.unreadBackground,borderBottom:`1px solid ${_.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:"14px",fontWeight:f.seen?400:600,color:_.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:je(f.from).split("@")[0]}),a.jsx("div",{style:{fontSize:"14px",fontWeight:f.seen?400:500,color:f.seen?_.textSecondary:_.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:je(f.subject)||"(No subject)"})]}),a.jsx("div",{style:{fontSize:"12px",color:_.textSecondary,flexShrink:0},children:ce(f.date)})]})}),se=f=>a.jsxs("div",{style:{padding:"24px"},children:[a.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:_.text},children:je(f.subject)||"(No subject)"}),a.jsxs("div",{style:{fontSize:"14px",color:_.textSecondary,marginBottom:"16px"},children:["From: ",je(f.from)," • ",new Date(f.date).toLocaleString()]}),a.jsx("div",{style:{fontSize:"14px",color:_.text},children:"Email body not loaded. Implement getEmail(uid) to fetch full content."})]}),de=(f,w)=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:_.cardBackground,borderBottom:`1px solid ${_.border}`},children:[a.jsx("button",{onClick:w.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:_.text},children:f.length===L.length?"Deselect All":"Select All"}),f.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{fontSize:"13px",color:_.textSecondary},children:[f.length," selected"]}),a.jsx("button",{onClick:w.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:a.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),a.jsx("button",{onClick:w.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:a.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),a.jsx("div",{style:{flex:1}}),a.jsx("button",{onClick:w.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:a.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),ae=()=>a.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:h}),Te=()=>a.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:"Loading..."}),be=A||ue,Ce=T||se,Oe=H||de,ie=G||ae,te=F||Te;return C&&L.length===0?a.jsx("div",{style:{background:_.background,width:"100%",height:"100%"},children:te()}):a.jsxs("div",{style:{display:"flex",background:_.background,width:"100%",height:"100%"},children:[a.jsxs("div",{style:{flex:l&&B?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:l&&B?`1px solid ${_.border}`:"none",overflow:"hidden"},children:[s&&Oe(Array.from(y),Re),j&&a.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:_.danger,fontSize:"14px",borderBottom:`1px solid ${_.border}`},children:j}),a.jsx("div",{style:{flex:1,overflowY:"auto"},children:L.length===0?ie():L.map((f,w)=>a.jsx("div",{onClick:z=>ye(f,w,z),onDoubleClick:()=>ge(f),children:be(f,y.has(f.uid))},f.uid))})]}),l&&B&&a.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ce(B)})]})}exports.AnimatedCardFlip=Pt;exports.ApiClient=tt;exports.AuthManager=et;exports.Card=Ct;exports.DataOperations=Ee;exports.Detail=Ot;exports.GraphClient=jt;exports.Mail=$t;exports.MailClient=Ze;exports.Stack=Tt;exports.getApiClient=Ie;exports.initializeApiClient=Et;exports.useMutation=St;exports.useQuery=rt;
34
+ `,children:[u&&a.jsx("div",{className:"flex-shrink-0",children:a.jsx("img",{src:u,alt:l,className:"w-16 h-16 object-cover rounded-lg"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-medium text-gray-900 truncate",children:l}),g&&a.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:g})]}),h&&a.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:h})]}),t&&a.jsx("div",{className:"flex-shrink-0 text-gray-400",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function Ot({item:p,onClose:t,title:r=s=>s.title||s.name||s.label||"Detail",image:n=s=>s.image||s.thumbnail||s.photo,fields:o=[]}){if(!p)return null;const s=r(p),l=n(p);return a.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[a.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:s}),t&&a.jsx("button",{onClick:t,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-6",children:[l&&a.jsx("div",{className:"mb-6",children:a.jsx("img",{src:l,alt:s,className:"w-full h-64 object-cover rounded-lg"})}),o.length>0&&a.jsx("div",{className:"space-y-4",children:o.map((h,u)=>{const g=h.value(p);return g==null||g===""?null:a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:h.label}),a.jsx("div",{className:"text-base text-gray-900",children:typeof g=="object"?JSON.stringify(g,null,2):String(g)})]},u)})}),o.length===0&&a.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(p,null,2)})]}),t&&a.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:a.jsx("button",{onClick:t,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const Nt={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function Pt({nodes:p,cardCount:t=2,minInterval:r=1e3,maxInterval:n=3e3,onCardClick:o,cardSize:s="medium",className:l=""}){const h=Math.min(Math.max(t,1),5),[u,g]=b.useState([]),[d,k]=b.useState([]),[x,P]=b.useState(Array(h).fill(!1)),[A,T]=b.useState(Array(h).fill(!1)),H=b.useRef([]),G=b.useCallback(v=>{const C=p.filter(j=>!v.includes(j._id));if(C.length===0)return null;const M=Math.floor(Math.random()*C.length);return C[M]},[p]),F=b.useCallback(()=>Math.random()*(n-r)+r,[r,n]);b.useEffect(()=>{if(p.length===0){g([]),k([]);return}const v=[],C=[],M=[];for(let j=0;j<h&&j<p.length;j++){const O=G(M);O&&(v.push(O),M.push(O._id))}for(let j=0;j<v.length;j++){const O=[v[j]._id,...v.filter((W,I)=>I!==j).map(W=>W._id)],y=G(O);y?C.push(y):C.push(v[j])}g(v),k(C)},[p,h,G]);const K=b.useCallback(v=>{const C=F(),M=setTimeout(()=>{P(j=>{const O=[...j];return O[v]=!O[v],O}),setTimeout(()=>{T(j=>{const O=[...j];return O[v]=!O[v],O}),setTimeout(()=>{const j=!A[v];j&&g(O=>{const y=[...O];return y[v]=d[v],y}),k(O=>{const y=[...O],I=[(j?d[v]:u[v])._id,...u.filter((B,V)=>V!==v).map(B=>B._id),...O.filter((B,V)=>V!==v).map(B=>B._id)],S=G(I);return S&&(y[v]=S),y}),setTimeout(()=>{K(v)},150)},200)},150)},C);H.current[v]=M},[F,G,u,d,A]),_=b.useRef(!1);b.useEffect(()=>{if(!(u.length===0||p.length<=1)&&!_.current){_.current=!0;for(let v=0;v<u.length;v++)K(v);return()=>{H.current.forEach(v=>clearTimeout(v)),H.current=[],_.current=!1}}},[u.length,p.length]);const L=v=>{o&&o(v)};return p.length===0?a.jsx("div",{className:`flex items-center justify-center p-8 ${l}`,children:a.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):u.length===0?a.jsx("div",{className:`flex items-center justify-center p-8 ${l}`,children:a.jsx("p",{className:"text-gray-500",children:"Loading..."})}):a.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${l}`,children:u.map((v,C)=>{const M=d[C],j=A[C];return a.jsx("div",{className:`relative ${Nt[s]}`,style:{perspective:"1000px"},onClick:()=>L(j?M:v),children:a.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${x[C]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[a.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:j?0:1},children:a.jsxs("div",{style:{transform:x[C]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[a.jsx("img",{src:v.data.image,alt:v.title,className:"w-full h-full object-cover"}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:a.jsx("p",{className:"text-white text-sm font-medium truncate",children:v.title})})]})}),M&&a.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:j?1:0},children:a.jsxs("div",{style:{transform:x[C]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[a.jsx("img",{src:M.data.image,alt:M.title,className:"w-full h-full object-cover"}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:a.jsx("p",{className:"text-white text-sm font-medium truncate",children:M.title})})]})})]})},`slot-${C}`)})})}function je(p){if(!p)return"";const t=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return p.replace(t,(r,n,o,s)=>{try{if(o.toUpperCase()==="B"){const l=atob(s);return decodeURIComponent(escape(l))}else if(o.toUpperCase()==="Q"){const l=s.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(h,u)=>String.fromCharCode(parseInt(u,16)));return decodeURIComponent(escape(l))}}catch(l){console.warn("MIME decode error:",l)}return r}).replace(/\s+/g," ").trim()}const At={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function $t({baseUrl:p,systemId:t,accountId:r,limit:n=30,folder:o,selectable:s=!0,showDetail:l=!1,emptyMessage:h="No emails",autoLoad:u=!0,onSelect:g,onSelectionChange:d,onDelete:k,onError:x,onLoad:P,renderItem:A,renderDetail:T,renderActions:H,renderEmpty:G,renderLoading:F,theme:K={}}){const _={...At,...K},[L,v]=b.useState([]),[C,M]=b.useState(!1),[j,O]=b.useState(null),[y,W]=b.useState(new Set),[I,S]=b.useState(null),[B,V]=b.useState(null),Q=b.useMemo(()=>t?new Ze({baseUrl:p,system_id:t}):null,[p,t]),te=b.useCallback(async()=>{if(Q){M(!0),O(null);try{const f=await Q.listEmails(r,n,o);if(f!=null&&f.messages){const w=[...f.messages].sort((z,J)=>new Date(J.date).getTime()-new Date(z.date).getTime());v(w),P==null||P(w)}}catch(f){const w=f instanceof Error?f:new Error("Failed to fetch emails");O(w.message),x==null||x(w)}M(!1)}},[Q,r,n,o,x,P]);b.useEffect(()=>{u&&te()},[u,te]),b.useEffect(()=>{te()},[o]);const ge=b.useCallback(f=>{g==null||g(f),l&&V(f)},[g,l]),ye=b.useCallback((f,w,z)=>{if(!s){g==null||g(f),l&&V(f);return}const J=f.uid;if(z.shiftKey&&I!==null){const ee=Math.min(I,w),Z=Math.max(I,w),Ne=L.slice(ee,Z+1).map(_e=>_e.uid),we=new Set(Ne);W(we),d==null||d(Array.from(we))}else if(z.ctrlKey||z.metaKey)W(ee=>{const Z=new Set(ee);return Z.has(J)?Z.delete(J):Z.add(J),d==null||d(Array.from(Z)),Z}),S(w);else{const ee=new Set([J]);W(ee),S(w),d==null||d(Array.from(ee))}},[s,I,L,y,g,d,l]),me=b.useCallback(async()=>{if(!(!Q||y.size===0))try{const f=await Q.trashEmails(r,Array.from(y));if(console.log("Trash result:",f),f.success&&f.moved>0){v(z=>z.filter(J=>!y.has(J.uid)));const w=Array.from(y);W(new Set),k==null||k(w)}else O("Failed to move emails to trash")}catch(f){const w=f instanceof Error?f:new Error("Trash failed");console.error("Trash error:",w),O(w.message),x==null||x(w)}},[Q,r,y,k,x]),xe=b.useCallback(async()=>{if(!(!Q||y.size===0))try{const f=await Q.archiveEmails(r,Array.from(y));if(console.log("Archive result:",f),f.success&&f.archived>0){v(z=>z.filter(J=>!y.has(J.uid)));const w=Array.from(y);W(new Set),k==null||k(w)}else O("Failed to archive emails")}catch(f){const w=f instanceof Error?f:new Error("Archive failed");console.error("Archive error:",w),O(w.message),x==null||x(w)}},[Q,r,y,k,x]),ve=b.useCallback(()=>{if(y.size===L.length)W(new Set),d==null||d([]);else{const f=new Set(L.map(w=>w.uid));W(f),d==null||d(Array.from(f))}},[L,y.size,d]),ke=b.useCallback(()=>{W(new Set),d==null||d([])},[d]),Re={delete:me,archive:xe,refresh:te,selectAll:ve,clearSelection:ke},ce=f=>{if(!f)return"";const w=new Date(f),z=new Date;return w.toDateString()===z.toDateString()?w.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):w.toLocaleDateString([],{month:"short",day:"numeric"})},ue=(f,w)=>a.jsx("div",{style:{padding:"12px 16px",background:w?_.selectedBackground:f.seen?_.cardBackground:_.unreadBackground,borderBottom:`1px solid ${_.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:"14px",fontWeight:f.seen?400:600,color:_.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:je(f.from).split("@")[0]}),a.jsx("div",{style:{fontSize:"14px",fontWeight:f.seen?400:500,color:f.seen?_.textSecondary:_.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:je(f.subject)||"(No subject)"})]}),a.jsx("div",{style:{fontSize:"12px",color:_.textSecondary,flexShrink:0},children:ce(f.date)})]})}),se=f=>a.jsxs("div",{style:{padding:"24px"},children:[a.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:_.text},children:je(f.subject)||"(No subject)"}),a.jsxs("div",{style:{fontSize:"14px",color:_.textSecondary,marginBottom:"16px"},children:["From: ",je(f.from)," • ",new Date(f.date).toLocaleString()]}),a.jsx("div",{style:{fontSize:"14px",color:_.text},children:"Email body not loaded. Implement getEmail(uid) to fetch full content."})]}),de=(f,w)=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:_.cardBackground,borderBottom:`1px solid ${_.border}`},children:[a.jsx("button",{onClick:w.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:_.text},children:f.length===L.length?"Deselect All":"Select All"}),f.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{fontSize:"13px",color:_.textSecondary},children:[f.length," selected"]}),a.jsx("button",{onClick:w.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:a.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),a.jsx("button",{onClick:w.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:a.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),a.jsx("div",{style:{flex:1}}),a.jsx("button",{onClick:w.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:a.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),ae=()=>a.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:h}),Te=()=>a.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:"Loading..."}),be=A||ue,Ce=T||se,Oe=H||de,ie=G||ae,re=F||Te;return C&&L.length===0?a.jsx("div",{style:{background:_.background,width:"100%",height:"100%"},children:re()}):a.jsxs("div",{style:{display:"flex",background:_.background,width:"100%",height:"100%"},children:[a.jsxs("div",{style:{flex:l&&B?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:l&&B?`1px solid ${_.border}`:"none",overflow:"hidden"},children:[s&&Oe(Array.from(y),Re),j&&a.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:_.danger,fontSize:"14px",borderBottom:`1px solid ${_.border}`},children:j}),a.jsx("div",{style:{flex:1,overflowY:"auto"},children:L.length===0?ie():L.map((f,w)=>a.jsx("div",{onClick:z=>ye(f,w,z),onDoubleClick:()=>ge(f),children:be(f,y.has(f.uid))},f.uid))})]}),l&&B&&a.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ce(B)})]})}exports.AnimatedCardFlip=Pt;exports.ApiClient=tt;exports.AuthManager=et;exports.Card=Ct;exports.DataOperations=Ee;exports.Detail=Ot;exports.GraphClient=jt;exports.Mail=$t;exports.MailClient=Ze;exports.Stack=Tt;exports.getApiClient=Ie;exports.initializeApiClient=Et;exports.useMutation=St;exports.useQuery=rt;
package/dist/index.esm.js CHANGED
@@ -1,15 +1,15 @@
1
1
  var _t = Object.defineProperty;
2
2
  var jt = (p, t, r) => t in p ? _t(p, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : p[t] = r;
3
- var pe = (p, t, r) => jt(p, typeof t != "symbol" ? t + "" : t, r);
4
- import tt, { useState as B, useCallback as K, useEffect as ye, useMemo as rt, useRef as He } from "react";
3
+ var he = (p, t, r) => jt(p, typeof t != "symbol" ? t + "" : t, r);
4
+ import tt, { useState as B, useCallback as K, useEffect as de, useMemo as rt, useRef as He } from "react";
5
5
  class $t {
6
6
  constructor(t) {
7
- pe(this, "config");
7
+ he(this, "config");
8
8
  // ===== FILE OPERATIONS =====
9
9
  /**
10
10
  * Options for file upload
11
11
  */
12
- pe(this, "defaultUploadOptions", {
12
+ he(this, "defaultUploadOptions", {
13
13
  maxSizeMB: 10,
14
14
  maxImageDimension: 0,
15
15
  // 0 = no resize
@@ -321,7 +321,7 @@ class $t {
321
321
  }
322
322
  class Et {
323
323
  constructor(t) {
324
- pe(this, "config");
324
+ he(this, "config");
325
325
  if (!t.system_id)
326
326
  throw new Error("MailClient: system_id is REQUIRED");
327
327
  this.config = t;
@@ -535,7 +535,7 @@ class Rt {
535
535
  }
536
536
  class Tt {
537
537
  constructor(t) {
538
- pe(this, "config");
538
+ he(this, "config");
539
539
  this.config = {
540
540
  timeout: 3e4,
541
541
  headers: {
@@ -663,7 +663,7 @@ function kt(p, t, r = {}) {
663
663
  }
664
664
  }
665
665
  }, [p, JSON.stringify(t), n, s, l]);
666
- return ye(() => {
666
+ return de(() => {
667
667
  o && P();
668
668
  }, [P, o]), {
669
669
  data: h,
@@ -715,7 +715,7 @@ function Ut(p, t = "POST", r = {}) {
715
715
  reset: x
716
716
  };
717
717
  }
718
- var Be = { exports: {} }, he = {};
718
+ var Be = { exports: {} }, ge = {};
719
719
  /**
720
720
  * @license React
721
721
  * react-jsx-runtime.production.min.js
@@ -727,7 +727,7 @@ var Be = { exports: {} }, he = {};
727
727
  */
728
728
  var Ze;
729
729
  function St() {
730
- if (Ze) return he;
730
+ if (Ze) return ge;
731
731
  Ze = 1;
732
732
  var p = tt, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
733
733
  function l(h, d, g) {
@@ -737,9 +737,9 @@ function St() {
737
737
  if (h && h.defaultProps) for (u in d = h.defaultProps, d) R[u] === void 0 && (R[u] = d[u]);
738
738
  return { $$typeof: t, type: h, key: x, ref: P, props: R, _owner: o.current };
739
739
  }
740
- return he.Fragment = r, he.jsx = l, he.jsxs = l, he;
740
+ return ge.Fragment = r, ge.jsx = l, ge.jsxs = l, ge;
741
741
  }
742
- var ge = {};
742
+ var ye = {};
743
743
  /**
744
744
  * @license React
745
745
  * react-jsx-runtime.development.js
@@ -841,14 +841,14 @@ function Ot() {
841
841
  }
842
842
  return null;
843
843
  }
844
- var E = Object.assign, I = 0, V, X, se, me, xe, ve, be;
844
+ var E = Object.assign, I = 0, V, X, re, me, xe, ve, be;
845
845
  function we() {
846
846
  }
847
847
  we.__reactDisabledLog = !0;
848
848
  function ke() {
849
849
  {
850
850
  if (I === 0) {
851
- V = console.log, X = console.info, se = console.warn, me = console.error, xe = console.group, ve = console.groupCollapsed, be = console.groupEnd;
851
+ V = console.log, X = console.info, re = console.warn, me = console.error, xe = console.group, ve = console.groupCollapsed, be = console.groupEnd;
852
852
  var e = {
853
853
  configurable: !0,
854
854
  enumerable: !0,
@@ -884,7 +884,7 @@ function Ot() {
884
884
  value: X
885
885
  }),
886
886
  warn: E({}, e, {
887
- value: se
887
+ value: re
888
888
  }),
889
889
  error: E({}, e, {
890
890
  value: me
@@ -903,27 +903,27 @@ function Ot() {
903
903
  I < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
904
904
  }
905
905
  }
906
- var de = W.ReactCurrentDispatcher, ue;
906
+ var ue = W.ReactCurrentDispatcher, fe;
907
907
  function ae(e, i, c) {
908
908
  {
909
- if (ue === void 0)
909
+ if (fe === void 0)
910
910
  try {
911
911
  throw Error();
912
912
  } catch (N) {
913
913
  var m = N.stack.trim().match(/\n( *(at )?)/);
914
- ue = m && m[1] || "";
914
+ fe = m && m[1] || "";
915
915
  }
916
916
  return `
917
- ` + ue + e;
917
+ ` + fe + e;
918
918
  }
919
919
  }
920
- var fe = !1, ie;
920
+ var pe = !1, ie;
921
921
  {
922
922
  var Oe = typeof WeakMap == "function" ? WeakMap : Map;
923
923
  ie = new Oe();
924
924
  }
925
925
  function _e(e, i) {
926
- if (!e || fe)
926
+ if (!e || pe)
927
927
  return "";
928
928
  {
929
929
  var c = ie.get(e);
@@ -931,11 +931,11 @@ function Ot() {
931
931
  return c;
932
932
  }
933
933
  var m;
934
- fe = !0;
934
+ pe = !0;
935
935
  var N = Error.prepareStackTrace;
936
936
  Error.prepareStackTrace = void 0;
937
937
  var A;
938
- A = de.current, de.current = null, ke();
938
+ A = ue.current, ue.current = null, ke();
939
939
  try {
940
940
  if (i) {
941
941
  var T = function() {
@@ -988,10 +988,10 @@ function Ot() {
988
988
  }
989
989
  }
990
990
  } finally {
991
- fe = !1, de.current = A, Se(), Error.prepareStackTrace = N;
991
+ pe = !1, ue.current = A, Se(), Error.prepareStackTrace = N;
992
992
  }
993
- var ce = e ? e.displayName || e.name : "", ne = ce ? ae(ce) : "";
994
- return typeof e == "function" && ie.set(e, ne), ne;
993
+ var ce = e ? e.displayName || e.name : "", se = ce ? ae(ce) : "";
994
+ return typeof e == "function" && ie.set(e, se), se;
995
995
  }
996
996
  function Ne(e, i, c) {
997
997
  return _e(e, !1);
@@ -1029,7 +1029,7 @@ function Ot() {
1029
1029
  }
1030
1030
  return "";
1031
1031
  }
1032
- var re = Object.prototype.hasOwnProperty, f = {}, b = W.ReactDebugCurrentFrame;
1032
+ var ne = Object.prototype.hasOwnProperty, f = {}, b = W.ReactDebugCurrentFrame;
1033
1033
  function z(e) {
1034
1034
  if (e) {
1035
1035
  var i = e._owner, c = oe(e.type, e._source, i ? i.type : null);
@@ -1039,7 +1039,7 @@ function Ot() {
1039
1039
  }
1040
1040
  function J(e, i, c, m, N) {
1041
1041
  {
1042
- var A = Function.call.bind(re);
1042
+ var A = Function.call.bind(ne);
1043
1043
  for (var T in e)
1044
1044
  if (A(e, T)) {
1045
1045
  var j = void 0;
@@ -1087,7 +1087,7 @@ function Ot() {
1087
1087
  __source: !0
1088
1088
  }, We, Ge;
1089
1089
  function at(e) {
1090
- if (re.call(e, "ref")) {
1090
+ if (ne.call(e, "ref")) {
1091
1091
  var i = Object.getOwnPropertyDescriptor(e, "ref").get;
1092
1092
  if (i && i.isReactWarning)
1093
1093
  return !1;
@@ -1095,7 +1095,7 @@ function Ot() {
1095
1095
  return e.ref !== void 0;
1096
1096
  }
1097
1097
  function it(e) {
1098
- if (re.call(e, "key")) {
1098
+ if (ne.call(e, "key")) {
1099
1099
  var i = Object.getOwnPropertyDescriptor(e, "key").get;
1100
1100
  if (i && i.isReactWarning)
1101
1101
  return !1;
@@ -1161,7 +1161,7 @@ function Ot() {
1161
1161
  var A, T = {}, j = null, Y = null;
1162
1162
  c !== void 0 && (Le(c), j = "" + c), it(i) && (Le(i.key), j = "" + i.key), at(i) && (Y = i.ref, ot(i, N));
1163
1163
  for (A in i)
1164
- re.call(i, A) && !st.hasOwnProperty(A) && (T[A] = i[A]);
1164
+ ne.call(i, A) && !st.hasOwnProperty(A) && (T[A] = i[A]);
1165
1165
  if (e && e.defaultProps) {
1166
1166
  var U = e.defaultProps;
1167
1167
  for (A in U)
@@ -1312,18 +1312,18 @@ Check the top-level render call using <` + c + ">.");
1312
1312
  else
1313
1313
  Ke(H, e);
1314
1314
  }
1315
- if (re.call(i, "key")) {
1316
- var ne = D(e), q = Object.keys(i).filter(function(wt) {
1315
+ if (ne.call(i, "key")) {
1316
+ var se = D(e), q = Object.keys(i).filter(function(wt) {
1317
1317
  return wt !== "key";
1318
1318
  }), Ue = q.length > 0 ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}";
1319
- if (!Qe[ne + Ue]) {
1319
+ if (!Qe[se + Ue]) {
1320
1320
  var bt = q.length > 0 ? "{" + q.join(": ..., ") + ": ...}" : "{}";
1321
1321
  $(`A props object containing a "key" prop is being spread into JSX:
1322
1322
  let props = %s;
1323
1323
  <%s {...props} />
1324
1324
  React keys must be passed directly to JSX without using spread:
1325
1325
  let props = %s;
1326
- <%s key={someKey} {...props} />`, Ue, ne, bt, ne), Qe[ne + Ue] = !0;
1326
+ <%s key={someKey} {...props} />`, Ue, se, bt, se), Qe[se + Ue] = !0;
1327
1327
  }
1328
1328
  }
1329
1329
  return e === n ? gt(M) : ht(M), M;
@@ -1336,8 +1336,8 @@ React keys must be passed directly to JSX without using spread:
1336
1336
  return Xe(e, i, c, !1);
1337
1337
  }
1338
1338
  var xt = mt, vt = yt;
1339
- ge.Fragment = n, ge.jsx = xt, ge.jsxs = vt;
1340
- }()), ge;
1339
+ ye.Fragment = n, ye.jsx = xt, ye.jsxs = vt;
1340
+ }()), ye;
1341
1341
  }
1342
1342
  process.env.NODE_ENV === "production" ? Be.exports = St() : Be.exports = Ot();
1343
1343
  var a = Be.exports;
@@ -1448,7 +1448,7 @@ function Mt({
1448
1448
  let E = k;
1449
1449
  return h && Q && d.length > 0 && (E = Ie.search(E, Q, d)), Object.keys(L).length > 0 && (E = Ie.filterByFields(E, L)), Ie.paginate(E, S, R);
1450
1450
  }, [k, Q, L, S, R, h, d]);
1451
- ye(() => {
1451
+ de(() => {
1452
1452
  F(1);
1453
1453
  }, [Q, L]);
1454
1454
  const O = () => {
@@ -1740,7 +1740,7 @@ function Bt({
1740
1740
  const F = Math.floor(Math.random() * S.length);
1741
1741
  return S[F];
1742
1742
  }, [p]), $ = K(() => Math.random() * (n - r) + r, [r, n]);
1743
- ye(() => {
1743
+ de(() => {
1744
1744
  if (p.length === 0) {
1745
1745
  g([]), R([]);
1746
1746
  return;
@@ -1788,7 +1788,7 @@ function Bt({
1788
1788
  }, S);
1789
1789
  Z.current[v] = F;
1790
1790
  }, [$, W, d, u, C]), w = He(!1);
1791
- ye(() => {
1791
+ de(() => {
1792
1792
  if (!(d.length === 0 || p.length <= 1) && !w.current) {
1793
1793
  w.current = !0;
1794
1794
  for (let v = 0; v < d.length; v++)
@@ -1941,7 +1941,7 @@ function Lt({
1941
1941
  renderLoading: $,
1942
1942
  theme: Q = {}
1943
1943
  }) {
1944
- const w = { ...Pt, ...Q }, [L, v] = B([]), [S, F] = B(!1), [_, O] = B(null), [y, G] = B(/* @__PURE__ */ new Set()), [D, E] = B(null), [I, V] = B(null), X = rt(() => t ? new Et({ baseUrl: p, system_id: t }) : null, [p, t]), se = K(async () => {
1944
+ const w = { ...Pt, ...Q }, [L, v] = B([]), [S, F] = B(!1), [_, O] = B(null), [y, G] = B(/* @__PURE__ */ new Set()), [D, E] = B(null), [I, V] = B(null), X = rt(() => t ? new Et({ baseUrl: p, system_id: t }) : null, [p, t]), re = K(async () => {
1945
1945
  if (X) {
1946
1946
  F(!0), O(null);
1947
1947
  try {
@@ -1959,9 +1959,11 @@ function Lt({
1959
1959
  F(!1);
1960
1960
  }
1961
1961
  }, [X, r, n, o, x, P]);
1962
- ye(() => {
1963
- d && se();
1964
- }, [d, se]);
1962
+ de(() => {
1963
+ d && re();
1964
+ }, [d, re]), de(() => {
1965
+ re();
1966
+ }, [o]);
1965
1967
  const me = K((f) => {
1966
1968
  g == null || g(f), l && V(f);
1967
1969
  }, [g, l]), xe = K((f, b, z) => {
@@ -2022,14 +2024,14 @@ function Lt({
2022
2024
  }, [u]), Se = {
2023
2025
  delete: ve,
2024
2026
  archive: be,
2025
- refresh: se,
2027
+ refresh: re,
2026
2028
  selectAll: we,
2027
2029
  clearSelection: ke
2028
- }, de = (f) => {
2030
+ }, ue = (f) => {
2029
2031
  if (!f) return "";
2030
2032
  const b = new Date(f), z = /* @__PURE__ */ new Date();
2031
2033
  return b.toDateString() === z.toDateString() ? b.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : b.toLocaleDateString([], { month: "short", day: "numeric" });
2032
- }, ue = (f, b) => /* @__PURE__ */ a.jsx("div", { style: {
2034
+ }, fe = (f, b) => /* @__PURE__ */ a.jsx("div", { style: {
2033
2035
  padding: "12px 16px",
2034
2036
  background: b ? w.selectedBackground : f.seen ? w.cardBackground : w.unreadBackground,
2035
2037
  borderBottom: `1px solid ${w.border}`,
@@ -2059,7 +2061,7 @@ function Lt({
2059
2061
  fontSize: "12px",
2060
2062
  color: w.textSecondary,
2061
2063
  flexShrink: 0
2062
- }, children: de(f.date) })
2064
+ }, children: ue(f.date) })
2063
2065
  ] }) }), ae = (f) => /* @__PURE__ */ a.jsxs("div", { style: { padding: "24px" }, children: [
2064
2066
  /* @__PURE__ */ a.jsx("h2", { style: { margin: "0 0 8px", fontSize: "20px", color: w.text }, children: Re(f.subject) || "(No subject)" }),
2065
2067
  /* @__PURE__ */ a.jsxs("div", { style: { fontSize: "14px", color: w.textSecondary, marginBottom: "16px" }, children: [
@@ -2069,7 +2071,7 @@ function Lt({
2069
2071
  new Date(f.date).toLocaleString()
2070
2072
  ] }),
2071
2073
  /* @__PURE__ */ a.jsx("div", { style: { fontSize: "14px", color: w.text }, children: "Email body not loaded. Implement getEmail(uid) to fetch full content." })
2072
- ] }), fe = (f, b) => /* @__PURE__ */ a.jsxs("div", { style: {
2074
+ ] }), pe = (f, b) => /* @__PURE__ */ a.jsxs("div", { style: {
2073
2075
  display: "flex",
2074
2076
  alignItems: "center",
2075
2077
  gap: "8px",
@@ -2168,8 +2170,8 @@ function Lt({
2168
2170
  padding: "48px",
2169
2171
  textAlign: "center",
2170
2172
  color: w.textSecondary
2171
- }, children: "Loading..." }), _e = C || ue, Ne = k || ae, Pe = Z || fe, oe = W || ie, re = $ || Oe;
2172
- return S && L.length === 0 ? /* @__PURE__ */ a.jsx("div", { style: { background: w.background, width: "100%", height: "100%" }, children: re() }) : /* @__PURE__ */ a.jsxs("div", { style: { display: "flex", background: w.background, width: "100%", height: "100%" }, children: [
2173
+ }, children: "Loading..." }), _e = C || fe, Ne = k || ae, Pe = Z || pe, oe = W || ie, ne = $ || Oe;
2174
+ return S && L.length === 0 ? /* @__PURE__ */ a.jsx("div", { style: { background: w.background, width: "100%", height: "100%" }, children: ne() }) : /* @__PURE__ */ a.jsxs("div", { style: { display: "flex", background: w.background, width: "100%", height: "100%" }, children: [
2173
2175
  /* @__PURE__ */ a.jsxs("div", { style: {
2174
2176
  flex: l && I ? "0 0 50%" : "1",
2175
2177
  display: "flex",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwanyx/stack",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Modern HyperCard for React - All-in-one data management (REST + Graph API + Auth + Hooks + UI)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",