@machinemetrics/mm-react-embeddable 1.0.9-1 → 1.0.9-3

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.
@@ -1,35 +1,27 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),H=require("prop-types"),Le=require("styled-components");var ge={exports:{}},G={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),Y=require("prop-types"),ee=require("styled-components");var q={exports:{}},N={};/**
2
2
  * @license React
3
- * react-jsx-runtime.production.min.js
3
+ * react-jsx-runtime.production.js
4
4
  *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
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 Ye;function hr(){if(Ye)return G;Ye=1;var f=c,b=Symbol.for("react.element"),C=Symbol.for("react.fragment"),p=Object.prototype.hasOwnProperty,_=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,E={key:!0,ref:!0,__self:!0,__source:!0};function M(T,y,F){var g,h={},P=null,D=null;F!==void 0&&(P=""+F),y.key!==void 0&&(P=""+y.key),y.ref!==void 0&&(D=y.ref);for(g in y)p.call(y,g)&&!E.hasOwnProperty(g)&&(h[g]=y[g]);if(T&&T.defaultProps)for(g in y=T.defaultProps,y)h[g]===void 0&&(h[g]=y[g]);return{$$typeof:b,type:T,key:P,ref:D,props:h,_owner:_.current}}return G.Fragment=C,G.jsx=M,G.jsxs=M,G}var z={};/**
9
+ */var re;function fe(){if(re)return N;re=1;var n=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function m(i,l,c){var T=null;if(c!==void 0&&(T=""+c),l.key!==void 0&&(T=""+l.key),"key"in l){c={};for(var g in l)g!=="key"&&(c[g]=l[g])}else c=l;return l=c.ref,{$$typeof:n,type:i,key:T,ref:l!==void 0?l:null,props:c}}return N.Fragment=f,N.jsx=m,N.jsxs=m,N}var $={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
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 Ue;function Rr(){return Ue||(Ue=1,process.env.NODE_ENV!=="production"&&function(){var f=c,b=Symbol.for("react.element"),C=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),T=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),D=Symbol.for("react.offscreen"),I=Symbol.iterator,Z="@@iterator";function s(e){if(e===null||typeof e!="object")return null;var r=I&&e[I]||e[Z];return typeof r=="function"?r:null}var u=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),a=1;a<r;a++)t[a-1]=arguments[a];d("error",e,t)}}function d(e,r,t){{var a=u.ReactDebugCurrentFrame,l=a.getStackAddendum();l!==""&&(r+="%s",t=t.concat([l]));var v=t.map(function(i){return String(i)});v.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,v)}}var w=!1,j=!1,L=!1,Y=!1,$=!1,B;B=Symbol.for("react.module.reference");function X(e){return!!(typeof e=="string"||typeof e=="function"||e===p||e===E||$||e===_||e===F||e===g||Y||e===D||w||j||L||typeof e=="object"&&e!==null&&(e.$$typeof===P||e.$$typeof===h||e.$$typeof===M||e.$$typeof===T||e.$$typeof===y||e.$$typeof===B||e.getModuleId!==void 0))}function U(e,r,t){var a=e.displayName;if(a)return a;var l=r.displayName||r.name||"";return l!==""?t+"("+l+")":t}function Q(e){return e.displayName||"Context"}function k(e){if(e==null)return null;if(typeof e.tag=="number"&&n("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 p:return"Fragment";case C:return"Portal";case E:return"Profiler";case _:return"StrictMode";case F:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:var r=e;return Q(r)+".Consumer";case M:var t=e;return Q(t._context)+".Provider";case y:return U(e,e.render,"ForwardRef");case h:var a=e.displayName||null;return a!==null?a:k(e.type)||"Memo";case P:{var l=e,v=l._payload,i=l._init;try{return k(i(v))}catch{return null}}}return null}var A=Object.assign,J=0,me,Ee,ye,he,Re,_e,we;function Ce(){}Ce.__reactDisabledLog=!0;function Ke(){{if(J===0){me=console.log,Ee=console.info,ye=console.warn,he=console.error,Re=console.group,_e=console.groupCollapsed,we=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}J++}}function Ne(){{if(J--,J===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},e,{value:me}),info:A({},e,{value:Ee}),warn:A({},e,{value:ye}),error:A({},e,{value:he}),group:A({},e,{value:Re}),groupCollapsed:A({},e,{value:_e}),groupEnd:A({},e,{value:we})})}J<0&&n("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=u.ReactCurrentDispatcher,ue;function ee(e,r,t){{if(ue===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);ue=a&&a[1]||""}return`
18
- `+ue+e}}var ce=!1,re;{var Ge=typeof WeakMap=="function"?WeakMap:Map;re=new Ge}function Te(e,r){if(!e||ce)return"";{var t=re.get(e);if(t!==void 0)return t}var a;ce=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=se.current,se.current=null,Ke();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(O){a=O}Reflect.construct(e,[],i)}else{try{i.call()}catch(O){a=O}e.call(i.prototype)}}else{try{throw Error()}catch(O){a=O}e()}}catch(O){if(O&&a&&typeof O.stack=="string"){for(var o=O.stack.split(`
19
- `),S=a.stack.split(`
20
- `),m=o.length-1,R=S.length-1;m>=1&&R>=0&&o[m]!==S[R];)R--;for(;m>=1&&R>=0;m--,R--)if(o[m]!==S[R]){if(m!==1||R!==1)do if(m--,R--,R<0||o[m]!==S[R]){var x=`
21
- `+o[m].replace(" at new "," at ");return e.displayName&&x.includes("<anonymous>")&&(x=x.replace("<anonymous>",e.displayName)),typeof e=="function"&&re.set(e,x),x}while(m>=1&&R>=0);break}}}finally{ce=!1,se.current=v,Ne(),Error.prepareStackTrace=l}var q=e?e.displayName||e.name:"",W=q?ee(q):"";return typeof e=="function"&&re.set(e,W),W}function ze(e,r,t){return Te(e,!1)}function He(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function te(e,r,t){if(e==null)return"";if(typeof e=="function")return Te(e,He(e));if(typeof e=="string")return ee(e);switch(e){case F:return ee("Suspense");case g:return ee("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case y:return ze(e.render);case h:return te(e.type,r,t);case P:{var a=e,l=a._payload,v=a._init;try{return te(v(l),r,t)}catch{}}}return""}var K=Object.prototype.hasOwnProperty,Se={},Oe=u.ReactDebugCurrentFrame;function ne(e){if(e){var r=e._owner,t=te(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}function Xe(e,r,t,a,l){{var v=Function.call.bind(K);for(var i in e)if(v(e,i)){var o=void 0;try{if(typeof e[i]!="function"){var S=Error((a||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}o=e[i](r,i,a,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(m){o=m}o&&!(o instanceof Error)&&(ne(l),n("%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).",a||"React class",t,i,typeof o),ne(null)),o instanceof Error&&!(o.message in Se)&&(Se[o.message]=!0,ne(l),n("Failed %s type: %s",t,o.message),ne(null))}}}var Qe=Array.isArray;function le(e){return Qe(e)}function er(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function rr(e){try{return Pe(e),!1}catch{return!0}}function Pe(e){return""+e}function je(e){if(rr(e))return n("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",er(e)),Pe(e)}var N=u.ReactCurrentOwner,tr={key:!0,ref:!0,__self:!0,__source:!0},ke,xe,fe;fe={};function nr(e){if(K.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function ar(e){if(K.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function or(e,r){if(typeof e.ref=="string"&&N.current&&r&&N.current.stateNode!==r){var t=k(N.current.type);fe[t]||(n('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',k(N.current.type),e.ref),fe[t]=!0)}}function ir(e,r){{var t=function(){ke||(ke=!0,n("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function sr(e,r){{var t=function(){xe||(xe=!0,n("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var ur=function(e,r,t,a,l,v,i){var o={$$typeof:b,type:e,key:r,ref:t,props:i,_owner:v};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function cr(e,r,t,a,l){{var v,i={},o=null,S=null;t!==void 0&&(je(t),o=""+t),ar(r)&&(je(r.key),o=""+r.key),nr(r)&&(S=r.ref,or(r,l));for(v in r)K.call(r,v)&&!tr.hasOwnProperty(v)&&(i[v]=r[v]);if(e&&e.defaultProps){var m=e.defaultProps;for(v in m)i[v]===void 0&&(i[v]=m[v])}if(o||S){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&ir(i,R),S&&sr(i,R)}return ur(e,o,S,l,a,N.current,i)}}var de=u.ReactCurrentOwner,Me=u.ReactDebugCurrentFrame;function V(e){if(e){var r=e._owner,t=te(e.type,e._source,r?r.type:null);Me.setExtraStackFrame(t)}else Me.setExtraStackFrame(null)}var ve;ve=!1;function pe(e){return typeof e=="object"&&e!==null&&e.$$typeof===b}function Fe(){{if(de.current){var e=k(de.current.type);if(e)return`
22
-
23
- Check the render method of \``+e+"`."}return""}}function lr(e){return""}var Ie={};function fr(e){{var r=Fe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
24
-
25
- Check the top-level render call using <`+t+">.")}return r}}function Ae(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=fr(r);if(Ie[t])return;Ie[t]=!0;var a="";e&&e._owner&&e._owner!==de.current&&(a=" It was passed a child from "+k(e._owner.type)+"."),V(e),n('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,a),V(null)}}function De(e,r){{if(typeof e!="object")return;if(le(e))for(var t=0;t<e.length;t++){var a=e[t];pe(a)&&Ae(a,r)}else if(pe(e))e._store&&(e._store.validated=!0);else if(e){var l=s(e);if(typeof l=="function"&&l!==e.entries)for(var v=l.call(e),i;!(i=v.next()).done;)pe(i.value)&&Ae(i.value,r)}}}function dr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===y||r.$$typeof===h))t=r.propTypes;else return;if(t){var a=k(r);Xe(t,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!ve){ve=!0;var l=k(r);n("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",l||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&n("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function vr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var a=r[t];if(a!=="children"&&a!=="key"){V(e),n("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),V(null);break}}e.ref!==null&&(V(e),n("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}var $e={};function We(e,r,t,a,l,v){{var i=X(e);if(!i){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" 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 S=lr();S?o+=S:o+=Fe();var m;e===null?m="null":le(e)?m="array":e!==void 0&&e.$$typeof===b?(m="<"+(k(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):m=typeof e,n("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",m,o)}var R=cr(e,r,t,l,v);if(R==null)return R;if(i){var x=r.children;if(x!==void 0)if(a)if(le(x)){for(var q=0;q<x.length;q++)De(x[q],e);Object.freeze&&Object.freeze(x)}else n("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 De(x,e)}if(K.call(r,"key")){var W=k(e),O=Object.keys(r).filter(function(yr){return yr!=="key"}),be=O.length>0?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}";if(!$e[W+be]){var Er=O.length>0?"{"+O.join(": ..., ")+": ...}":"{}";n(`A props object containing a "key" prop is being spread into JSX:
17
+ */var te;function de(){return te||(te=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Z?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case a:return"Fragment";case u:return"Profiler";case o:return"StrictMode";case A:return"Suspense";case x:return"SuspenseList";case M:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case t:return"Portal";case b:return(e.displayName||"Context")+".Provider";case R:return(e._context.displayName||"Context")+".Consumer";case k:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return r=e.displayName||null,r!==null?r:n(e.type)||"Memo";case C:r=e._payload,e=e._init;try{return n(e(r))}catch{}}return null}function f(e){return""+e}function m(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var d=r.error,E=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return d.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",E),f(e)}}function i(e){if(e===a)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var r=n(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function l(){var e=I.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function T(e){if(F.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function g(e,r){function d(){X||(X=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}d.isReactWarning=!0,Object.defineProperty(e,"key",{get:d,configurable:!0})}function P(){var e=n(this.type);return H[e]||(H[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function v(e,r,d,E,y,h,z,V){return d=h.ref,e={$$typeof:O,type:e,key:r,props:h,_owner:y},(d!==void 0?d:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:P}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function _(e,r,d,E,y,h,z,V){var p=r.children;if(p!==void 0)if(E)if(ie(p)){for(E=0;E<p.length;E++)S(p[E]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else S(p);if(F.call(r,"key")){p=n(e);var j=Object.keys(r).filter(function(le){return le!=="key"});E=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",K[p+E]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
26
18
  let props = %s;
27
19
  <%s {...props} />
28
20
  React keys must be passed directly to JSX without using spread:
29
21
  let props = %s;
30
- <%s key={someKey} {...props} />`,be,W,Er,W),$e[W+be]=!0}}return e===p?vr(R):dr(R),R}}function pr(e,r,t){return We(e,r,t,!0)}function br(e,r,t){return We(e,r,t,!1)}var gr=br,mr=pr;z.Fragment=p,z.jsx=gr,z.jsxs=mr}()),z}process.env.NODE_ENV==="production"?ge.exports=hr():ge.exports=Rr();var oe=ge.exports;const ie=c.createContext(null),Ve=({children:f})=>{const[b,C]=c.useState({}),p=c.useRef({}),_=c.useRef({}),E=c.useRef({}),M=c.useRef(0),T=c.useCallback(()=>(M.current+=1,`callback_${Date.now()}_${M.current}`),[]),y=c.useCallback((s,u)=>{var n;return!!((n=E.current[s])!=null&&n.has(u))},[]),F=c.useCallback((s,u,n)=>{C(d=>({...d,[s]:{origin:u,frameRef:n}}))},[]),g=c.useCallback(s=>{C(u=>{const n={...u};return delete n[s],n}),delete E.current[s]},[]);c.useEffect(()=>{const s=(n=[],d)=>{n.forEach(w=>w(d))},u=n=>{var L,Y,$,B,X;if(!((L=n==null?void 0:n.data)!=null&&L.instanceId))return;const{instanceId:d,type:w}=n.data,j=p.current;if(w==="response"){const{callbackId:U,response:Q,error:k}=n.data,A=_.current[U];A&&(A(Q,k),delete _.current[U]);return}if(w==="mark-registered"){const{requestType:U}=n.data;E.current[d]||(E.current[d]=new Set),E.current[d].add(U);return}s((Y=j[d])==null?void 0:Y[w],n.data),s(($=j["*"])==null?void 0:$[w],n.data),s((B=j[d])==null?void 0:B["*"],n.data),s((X=j["*"])==null?void 0:X["*"],n.data)};return window.addEventListener("message",u),()=>{window.removeEventListener("message",u)}},[b]);const h=c.useCallback((s,u,n)=>{var w,j;const d=b[s];if(!d){console.warn(`Origin not set for id: ${s}. Unable to send message.`);return}(j=(w=d==null?void 0:d.frameRef)==null?void 0:w.current)!=null&&j.contentWindow&&d.frameRef.current.contentWindow.postMessage({type:u,...n,instanceId:s},d.origin)},[b]),P=c.useCallback(async(s,u,n={})=>new Promise((d,w)=>{const j=T(),L=(Y,$)=>{delete _.current[j],$?w($):d(Y)};_.current[j]=L,h(s,"request",{callbackId:j,requestType:u,data:n})}),[h,T]),D=c.useCallback((s,u)=>{h(s,"load-options",u)},[h]),I=c.useCallback((s,u)=>{h(s,"validate",u)},[h]),Z=c.useMemo(()=>({registerFrame:F,unregisterFrame:g,sendMessage:h,sendRequest:P,loadOptions:D,validate:I,hasHandler:y,addListener:(s,u,n)=>(p.current[s]||(p.current[s]={}),p.current[s][u]||(p.current[s][u]=[]),p.current[s][u].push(n),()=>{p.current[s][u]=p.current[s][u].filter(d=>d!==n)})}),[F,g,h,P,D,I,y]);return oe.jsx(ie.Provider,{value:Z,children:f})},ae={},qe=async f=>{try{const b=new URL(f).origin;if(ae[b]!==void 0)return ae[b];const p=await(await fetch(`${b}/mm-app-manifest.json`)).json();if(!p.version)throw new Error("Invalid manifest");return ae[b]=p,p}catch{}return ae[origin]=!1,!1},Ze=async f=>!!await qe(f),Be=(f,b,C)=>{const p=c.useContext(ie);if(p===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const _=c.useRef(C);c.useEffect(()=>{_.current=C},[C]),c.useEffect(()=>{if(!(!f||!b))return p.addListener(f,b,(...E)=>_.current(...E))},[p,f,b])};Ve.propTypes={children:H.node.isRequired};const _r=Le.default||Le,wr=_r.iframe`
22
+ <%s key={someKey} {...props} />`,E,p,j,p),K[p+E]=!0)}if(p=null,d!==void 0&&(m(d),p=""+d),T(r)&&(m(r.key),p=""+r.key),"key"in r){d={};for(var G in r)G!=="key"&&(d[G]=r[G])}else d=r;return p&&g(d,typeof e=="function"?e.displayName||e.name||"Unknown":e),v(e,p,h,y,l(),d,z,V)}function S(e){typeof e=="object"&&e!==null&&e.$$typeof===O&&e._store&&(e._store.validated=1)}var w=s,O=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),b=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),Z=Symbol.for("react.client.reference"),I=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,ie=Array.isArray,J=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(e){return e()}};var X,H={},B=w.react_stack_bottom_frame.bind(w,c)(),Q=J(i(c)),K={};$.Fragment=a,$.jsx=function(e,r,d,E,y){var h=1e4>I.recentlyCreatedOwnerStacks++;return _(e,r,d,!1,E,y,h?Error("react-stack-top-frame"):B,h?J(i(e)):Q)},$.jsxs=function(e,r,d,E,y){var h=1e4>I.recentlyCreatedOwnerStacks++;return _(e,r,d,!0,E,y,h?Error("react-stack-top-frame"):B,h?J(i(e)):Q)}})()),$}var ne;function be(){return ne||(ne=1,process.env.NODE_ENV==="production"?q.exports=fe():q.exports=de()),q.exports}var D=be();const W=s.createContext(null),oe=({children:n})=>{const[f,m]=s.useState({}),i=s.useRef({}),l=s.useRef({}),c=s.useRef({}),T=s.useCallback((t,a)=>{var o;return!!((o=c.current[t])!=null&&o.has(a))},[]),g=s.useCallback((t,a,o)=>{m(u=>({...u,[t]:{origin:a,frameRef:o}}))},[]),P=s.useCallback(t=>{m(a=>{const o={...a};return delete o[t],o}),delete c.current[t]},[]);s.useEffect(()=>{const t=(o=[],u)=>{o.forEach(R=>R(u))},a=o=>{var k,A,x,L,C;if(!((k=o==null?void 0:o.data)!=null&&k.instanceId))return;const{instanceId:u,type:R}=o.data,b=i.current;if(R==="response"){const{callbackId:M,response:Z,error:I}=o.data,F=l.current[M];F&&(F(Z,I),delete l.current[M]);return}if(R==="mark-registered"){const{requestType:M}=o.data;c.current[u]||(c.current[u]=new Set),c.current[u].add(M);return}t((A=b[u])==null?void 0:A[R],o.data),t((x=b["*"])==null?void 0:x[R],o.data),t((L=b[u])==null?void 0:L["*"],o.data),t((C=b["*"])==null?void 0:C["*"],o.data)};return window.addEventListener("message",a),()=>{window.removeEventListener("message",a)}},[f]);const v=s.useCallback((t,a,o)=>{var R,b;const u=f[t];if(!u){console.warn(`Origin not set for id: ${t}. Unable to send message.`);return}(b=(R=u==null?void 0:u.frameRef)==null?void 0:R.current)!=null&&b.contentWindow&&u.frameRef.current.contentWindow.postMessage({type:a,...o,instanceId:t},u.origin)},[f]),_=s.useCallback(async(t,a,o={})=>new Promise((u,R)=>{const b=crypto.randomUUID(),k=(A,x)=>{delete l.current[b],x?R(x):u(A)};l.current[b]=k,v(t,"request",{callbackId:b,requestType:a,data:o})}),[v]),S=s.useCallback((t,a)=>{v(t,"load-options",a)},[v]),w=s.useCallback((t,a)=>{v(t,"validate",a)},[v]),O=s.useMemo(()=>({registerFrame:g,unregisterFrame:P,sendMessage:v,sendRequest:_,loadOptions:S,validate:w,hasHandler:T,addListener:(t,a,o)=>(i.current[t]||(i.current[t]={}),i.current[t][a]||(i.current[t][a]=[]),i.current[t][a].push(o),()=>{i.current[t][a]=i.current[t][a].filter(u=>u!==o)})}),[g,P,v,_,S,w,T]);return D.jsx(W.Provider,{value:O,children:n})},U={},se=async n=>{try{const f=new URL(n).origin;if(U[f]!==void 0)return U[f];const i=await(await fetch(`${f}/mm-app-manifest.json`)).json();if(!i.version)throw new Error("Invalid manifest");return U[f]=i,i}catch{}return U[origin]=!1,!1},ae=async n=>!!await se(n),ce=(n,f,m)=>{const i=s.useContext(W);if(i===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const l=s.useRef(m);s.useEffect(()=>{l.current=m},[m]),s.useEffect(()=>{if(!(!n||!f))return i.addListener(n,f,(...c)=>l.current(...c))},[i,n,f])};oe.propTypes={children:Y.node.isRequired};const me=ee.default||ee,Ee=me.iframe`
31
23
  width: 100%;
32
24
  height: 100%;
33
25
  border: none;
34
- visibility: ${f=>f.$isReady?"visible":"hidden"};
35
- `,Je=({id:f,src:b,path:C,onInit:p=()=>{},context:_={},params:E={},...M})=>{if("isConfiguring"in M)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in _)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in _)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const T=c.useRef(),[y,F]=c.useState(),[g,h]=c.useState(0),{registerFrame:P,unregisterFrame:D,sendMessage:I}=c.useContext(ie),[Z,s]=c.useState(!0),[u,n]=c.useState();return c.useEffect(()=>{g&&I(f,"set-context",{context:{..._,colorMode:E.colorMode,isFullScreen:E.isFullScreen}})},[_,E.colorMode,E.isFullScreen,f,g]),c.useEffect(()=>{g&&(I(f,"set-params",{params:E}),I(f,"set-configuring",{isConfiguring:E.isConfiguring}))},[E,f,g]),c.useEffect(()=>{C!==void 0&&n(C||"/")},[C]),c.useEffect(()=>{u===void 0||!g||I(f,"navigate",{path:u})},[u,g,f,I]),c.useEffect(()=>{if(!(!b||!f||!T))return(async()=>{const d=await Ze(b);if(s(d),d){const w=new URL(b);P(f,w.origin,T),p(),F(`${w.origin}/mm-embedded-interop?id=${f}&origin=${window.location.origin}`);return}})(),()=>{D(f)}},[b,f,P,T]),Be(f,"ready",()=>h(d=>d+1)),Z?oe.jsx(wr,{$isReady:g,ref:T,src:y,...M}):oe.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:oe.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};Je.propTypes={id:H.string,src:H.string.isRequired,path:H.string,onInit:H.func};exports.MMEmbeddableZone=Je;exports.MMEmbeddableZoneContext=ie;exports.MMEmbeddableZoneProvider=Ve;exports.getAppInfo=qe;exports.testIsEmbeddable=Ze;exports.useEmbeddedEffect=Be;
26
+ visibility: ${n=>n.$isReady?"visible":"hidden"};
27
+ `,ue=({id:n,src:f,path:m,onInit:i=()=>{},context:l={},params:c={},...T})=>{if("isConfiguring"in T)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in l)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in l)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const g=s.useRef(),[P,v]=s.useState(),[_,S]=s.useState(0),{registerFrame:w,unregisterFrame:O,sendMessage:t}=s.useContext(W),[a,o]=s.useState(!0),[u,R]=s.useState();return s.useEffect(()=>{_&&t(n,"set-context",{context:{...l,colorMode:c.colorMode,isFullScreen:c.isFullScreen}})},[l,c.colorMode,c.isFullScreen,n,_]),s.useEffect(()=>{_&&(t(n,"set-params",{params:c}),t(n,"set-configuring",{isConfiguring:c.isConfiguring}))},[c,n,_]),s.useEffect(()=>{m!==void 0&&R(m||"/")},[m]),s.useEffect(()=>{u===void 0||!_||t(n,"navigate",{path:u})},[u,_,n,t]),s.useEffect(()=>{if(!(!f||!n||!g))return(async()=>{const b=await ae(f);if(o(b),b){const k=new URL(f);w(n,k.origin,g),i(),v(`${k.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`);return}})(),()=>{O(n)}},[f,n,w,g]),ce(n,"ready",()=>S(b=>b+1)),a?D.jsx(Ee,{$isReady:_,ref:g,src:P,...T}):D.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:D.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};ue.propTypes={id:Y.string,src:Y.string.isRequired,path:Y.string,onInit:Y.func};exports.MMEmbeddableZone=ue;exports.MMEmbeddableZoneContext=W;exports.MMEmbeddableZoneProvider=oe;exports.getAppInfo=se;exports.testIsEmbeddable=ae;exports.useEmbeddedEffect=ce;