@machinemetrics/mm-react-embeddable 1.0.6-0 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),H=require("prop-types"),Ye=require("styled-components");var ye={exports:{}},N={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ve;function wr(){if(Ve)return N;Ve=1;var n=
|
|
9
|
+
*/var Ve;function wr(){if(Ve)return N;Ve=1;var n=d,o=Symbol.for("react.element"),T=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,h=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,E={key:!0,ref:!0,__self:!0,__source:!0};function F(O,R,S){var m,x={},k=null,A=null;S!==void 0&&(k=""+S),R.key!==void 0&&(k=""+R.key),R.ref!==void 0&&(A=R.ref);for(m in R)c.call(R,m)&&!E.hasOwnProperty(m)&&(x[m]=R[m]);if(O&&O.defaultProps)for(m in R=O.defaultProps,R)x[m]===void 0&&(x[m]=R[m]);return{$$typeof:o,type:O,key:k,ref:A,props:x,_owner:h.current}}return N.Fragment=T,N.jsx=F,N.jsxs=F,N}var G={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,22 +14,22 @@
|
|
|
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 qe;function Sr(){return qe||(qe=1,process.env.NODE_ENV!=="production"&&function(){var n=
|
|
17
|
+
*/var qe;function Sr(){return qe||(qe=1,process.env.NODE_ENV!=="production"&&function(){var n=d,o=Symbol.for("react.element"),T=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),O=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),i=Symbol.iterator,g="@@iterator";function l(e){if(e===null||typeof e!="object")return null;var r=i&&e[i]||e[g];return typeof r=="function"?r:null}var f=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),a=1;a<r;a++)t[a-1]=arguments[a];w("error",e,t)}}function w(e,r,t){{var a=f.ReactDebugCurrentFrame,p=a.getStackAddendum();p!==""&&(r+="%s",t=t.concat([p]));var b=t.map(function(u){return String(u)});b.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,b)}}var D=!1,Y=!1,$=!1,z=!1,X=!1,U;U=Symbol.for("react.module.reference");function ie(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===E||X||e===h||e===S||e===m||z||e===A||D||Y||$||typeof e=="object"&&e!==null&&(e.$$typeof===k||e.$$typeof===x||e.$$typeof===F||e.$$typeof===O||e.$$typeof===R||e.$$typeof===U||e.getModuleId!==void 0))}function se(e,r,t){var a=e.displayName;if(a)return a;var p=r.displayName||r.name||"";return p!==""?t+"("+p+")":t}function Z(e){return e.displayName||"Context"}function I(e){if(e==null)return null;if(typeof e.tag=="number"&&v("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 c:return"Fragment";case T:return"Portal";case E:return"Profiler";case h:return"StrictMode";case S:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case O:var r=e;return Z(r)+".Consumer";case F:var t=e;return Z(t._context)+".Provider";case R:return se(e,e.render,"ForwardRef");case x:var a=e.displayName||null;return a!==null?a:I(e.type)||"Memo";case k:{var p=e,b=p._payload,u=p._init;try{return I(u(b))}catch{return null}}}return null}var W=Object.assign,B=0,he,Ee,Re,_e,we,Se,Ce;function Te(){}Te.__reactDisabledLog=!0;function He(){{if(B===0){he=console.log,Ee=console.info,Re=console.warn,_e=console.error,we=console.group,Se=console.groupCollapsed,Ce=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Te,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}B++}}function ze(){{if(B--,B===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:he}),info:W({},e,{value:Ee}),warn:W({},e,{value:Re}),error:W({},e,{value:_e}),group:W({},e,{value:we}),groupCollapsed:W({},e,{value:Se}),groupEnd:W({},e,{value:Ce})})}B<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ue=f.ReactCurrentDispatcher,ce;function Q(e,r,t){{if(ce===void 0)try{throw Error()}catch(p){var a=p.stack.trim().match(/\n( *(at )?)/);ce=a&&a[1]||""}return`
|
|
18
18
|
`+ce+e}}var le=!1,ee;{var Xe=typeof WeakMap=="function"?WeakMap:Map;ee=new Xe}function Oe(e,r){if(!e||le)return"";{var t=ee.get(e);if(t!==void 0)return t}var a;le=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var b;b=ue.current,ue.current=null,He();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(j){a=j}Reflect.construct(e,[],u)}else{try{u.call()}catch(j){a=j}e.call(u.prototype)}}else{try{throw Error()}catch(j){a=j}e()}}catch(j){if(j&&a&&typeof j.stack=="string"){for(var s=j.stack.split(`
|
|
19
19
|
`),P=a.stack.split(`
|
|
20
|
-
`),y=s.length-1,_=P.length-1;y>=1&&_>=0&&s[y]!==P[_];)_--;for(;y>=1&&_>=0;y--,_--)if(s[y]!==P[_]){if(y!==1||_!==1)do if(y--,_--,_<0||s[y]!==P[_]){var
|
|
21
|
-
`+s[y].replace(" at new "," at ");return e.displayName&&
|
|
20
|
+
`),y=s.length-1,_=P.length-1;y>=1&&_>=0&&s[y]!==P[_];)_--;for(;y>=1&&_>=0;y--,_--)if(s[y]!==P[_]){if(y!==1||_!==1)do if(y--,_--,_<0||s[y]!==P[_]){var M=`
|
|
21
|
+
`+s[y].replace(" at new "," at ");return e.displayName&&M.includes("<anonymous>")&&(M=M.replace("<anonymous>",e.displayName)),typeof e=="function"&&ee.set(e,M),M}while(y>=1&&_>=0);break}}}finally{le=!1,ue.current=b,ze(),Error.prepareStackTrace=p}var q=e?e.displayName||e.name:"",L=q?Q(q):"";return typeof e=="function"&&ee.set(e,L),L}function Qe(e,r,t){return Oe(e,!1)}function er(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function re(e,r,t){if(e==null)return"";if(typeof e=="function")return Oe(e,er(e));if(typeof e=="string")return Q(e);switch(e){case S:return Q("Suspense");case m:return Q("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case R:return Qe(e.render);case x:return re(e.type,r,t);case k:{var a=e,p=a._payload,b=a._init;try{return re(b(p),r,t)}catch{}}}return""}var J=Object.prototype.hasOwnProperty,Pe={},xe=f.ReactDebugCurrentFrame;function te(e){if(e){var r=e._owner,t=re(e.type,e._source,r?r.type:null);xe.setExtraStackFrame(t)}else xe.setExtraStackFrame(null)}function rr(e,r,t,a,p){{var b=Function.call.bind(J);for(var u in e)if(b(e,u)){var s=void 0;try{if(typeof e[u]!="function"){var P=Error((a||"React class")+": "+t+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}s=e[u](r,u,a,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(y){s=y}s&&!(s instanceof Error)&&(te(p),v("%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,u,typeof s),te(null)),s instanceof Error&&!(s.message in Pe)&&(Pe[s.message]=!0,te(p),v("Failed %s type: %s",t,s.message),te(null))}}}var tr=Array.isArray;function fe(e){return tr(e)}function nr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ar(e){try{return je(e),!1}catch{return!0}}function je(e){return""+e}function ke(e){if(ar(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nr(e)),je(e)}var K=f.ReactCurrentOwner,or={key:!0,ref:!0,__self:!0,__source:!0},Me,Fe,de;de={};function ir(e){if(J.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function sr(e){if(J.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ur(e,r){if(typeof e.ref=="string"&&K.current&&r&&K.current.stateNode!==r){var t=I(K.current.type);de[t]||(v('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',I(K.current.type),e.ref),de[t]=!0)}}function cr(e,r){{var t=function(){Me||(Me=!0,v("%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 lr(e,r){{var t=function(){Fe||(Fe=!0,v("%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 fr=function(e,r,t,a,p,b,u){var s={$$typeof:o,type:e,key:r,ref:t,props:u,_owner:b};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function dr(e,r,t,a,p){{var b,u={},s=null,P=null;t!==void 0&&(ke(t),s=""+t),sr(r)&&(ke(r.key),s=""+r.key),ir(r)&&(P=r.ref,ur(r,p));for(b in r)J.call(r,b)&&!or.hasOwnProperty(b)&&(u[b]=r[b]);if(e&&e.defaultProps){var y=e.defaultProps;for(b in y)u[b]===void 0&&(u[b]=y[b])}if(s||P){var _=typeof e=="function"?e.displayName||e.name||"Unknown":e;s&&cr(u,_),P&&lr(u,_)}return fr(e,s,P,p,a,K.current,u)}}var ve=f.ReactCurrentOwner,Ie=f.ReactDebugCurrentFrame;function V(e){if(e){var r=e._owner,t=re(e.type,e._source,r?r.type:null);Ie.setExtraStackFrame(t)}else Ie.setExtraStackFrame(null)}var pe;pe=!1;function be(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function De(){{if(ve.current){var e=I(ve.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function vr(e){return""}var Ae={};function pr(e){{var r=De();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+t+">.")}return r}}function $e(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=pr(r);if(Ae[t])return;Ae[t]=!0;var a="";e&&e._owner&&e._owner!==ve.current&&(a=" It was passed a child from "+I(e._owner.type)+"."),V(e),
|
|
25
|
+
Check the top-level render call using <`+t+">.")}return r}}function $e(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=pr(r);if(Ae[t])return;Ae[t]=!0;var a="";e&&e._owner&&e._owner!==ve.current&&(a=" It was passed a child from "+I(e._owner.type)+"."),V(e),v('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 Ue(e,r){{if(typeof e!="object")return;if(fe(e))for(var t=0;t<e.length;t++){var a=e[t];be(a)&&$e(a,r)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var p=l(e);if(typeof p=="function"&&p!==e.entries)for(var b=p.call(e),u;!(u=b.next()).done;)be(u.value)&&$e(u.value,r)}}}function br(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===R||r.$$typeof===x))t=r.propTypes;else return;if(t){var a=I(r);rr(t,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!pe){pe=!0;var p=I(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",p||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gr(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),v("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),v("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}var We={};function Le(e,r,t,a,p,b){{var u=ie(e);if(!u){var s="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(s+=" 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 P=vr();P?s+=P:s+=De();var y;e===null?y="null":fe(e)?y="array":e!==void 0&&e.$$typeof===o?(y="<"+(I(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,s)}var _=dr(e,r,t,p,b);if(_==null)return _;if(u){var M=r.children;if(M!==void 0)if(a)if(fe(M)){for(var q=0;q<M.length;q++)Ue(M[q],e);Object.freeze&&Object.freeze(M)}else v("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 Ue(M,e)}if(J.call(r,"key")){var L=I(e),j=Object.keys(r).filter(function(_r){return _r!=="key"}),ge=j.length>0?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}";if(!We[L+ge]){var Rr=j.length>0?"{"+j.join(": ..., ")+": ...}":"{}";v(`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} />`,
|
|
30
|
+
<%s key={someKey} {...props} />`,ge,L,Rr,L),We[L+ge]=!0}}return e===c?gr(_):br(_),_}}function mr(e,r,t){return Le(e,r,t,!0)}function yr(e,r,t){return Le(e,r,t,!1)}var hr=yr,Er=mr;G.Fragment=c,G.jsx=hr,G.jsxs=Er}()),G}process.env.NODE_ENV==="production"?ye.exports=wr():ye.exports=Sr();var ae=ye.exports;const C=[];for(let n=0;n<256;++n)C.push((n+256).toString(16).slice(1));function Cr(n,o=0){return(C[n[o+0]]+C[n[o+1]]+C[n[o+2]]+C[n[o+3]]+"-"+C[n[o+4]]+C[n[o+5]]+"-"+C[n[o+6]]+C[n[o+7]]+"-"+C[n[o+8]]+C[n[o+9]]+"-"+C[n[o+10]]+C[n[o+11]]+C[n[o+12]]+C[n[o+13]]+C[n[o+14]]+C[n[o+15]]).toLowerCase()}let me;const Tr=new Uint8Array(16);function Or(){if(!me){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");me=crypto.getRandomValues.bind(crypto)}return me(Tr)}const Pr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ze={randomUUID:Pr};function xr(n,o,T){var h;if(Ze.randomUUID&&!o&&!n)return Ze.randomUUID();n=n||{};const c=n.random??((h=n.rng)==null?void 0:h.call(n))??Or();if(c.length<16)throw new Error("Random bytes length must be >= 16");return c[6]=c[6]&15|64,c[8]=c[8]&63|128,Cr(c)}const oe=d.createContext(null),Be=({children:n})=>{const[o,T]=d.useState({}),c=d.useRef({}),h=d.useRef({}),E=d.useRef({}),F=d.useCallback((i,g)=>{var l;return!!((l=E.current[i])!=null&&l.has(g))},[]),O=d.useCallback((i,g,l)=>{T(f=>({...f,[i]:{origin:g,frameRef:l}}))},[]),R=d.useCallback(i=>{T(g=>{const l={...g};return delete l[i],l}),delete E.current[i]},[]);d.useEffect(()=>{const i=(l=[],f)=>{l.forEach(v=>v(f))},g=l=>{var D,Y,$,z,X;if(!((D=l==null?void 0:l.data)!=null&&D.instanceId))return;const{instanceId:f,type:v}=l.data,w=c.current;if(v==="response"){const{callbackId:U,response:ie,error:se}=l.data,Z=h.current[U];Z&&(Z(ie,se),delete h.current[U]);return}if(v==="mark-registered"){const{requestType:U}=l.data;E.current[f]||(E.current[f]=new Set),E.current[f].add(U);return}i((Y=w[f])==null?void 0:Y[v],l.data),i(($=w["*"])==null?void 0:$[v],l.data),i((z=w[f])==null?void 0:z["*"],l.data),i((X=w["*"])==null?void 0:X["*"],l.data)};return window.addEventListener("message",g),()=>{window.removeEventListener("message",g)}},[o]);const S=d.useCallback((i,g,l)=>{var v,w;const f=o[i];if(!f){console.warn(`Origin not set for id: ${i}. Unable to send message.`);return}(w=(v=f==null?void 0:f.frameRef)==null?void 0:v.current)!=null&&w.contentWindow&&f.frameRef.current.contentWindow.postMessage({type:g,...l,instanceId:i},f.origin)},[o]),m=d.useCallback(async(i,g,l={})=>new Promise((f,v)=>{const w=xr(),D=(Y,$)=>{delete h.current[w],$?v($):f(Y)};h.current[w]=D,S(i,"request",{callbackId:w,requestType:g,data:l})}),[S]),x=d.useCallback((i,g)=>{S(i,"load-options",g)},[S]),k=d.useCallback((i,g)=>{S(i,"validate",g)},[S]),A=d.useMemo(()=>({registerFrame:O,unregisterFrame:R,sendMessage:S,sendRequest:m,loadOptions:x,validate:k,hasHandler:F,addListener:(i,g,l)=>(c.current[i]||(c.current[i]={}),c.current[i][g]||(c.current[i][g]=[]),c.current[i][g].push(l),()=>{c.current[i][g]=c.current[i][g].filter(f=>f!==l)})}),[O,R,S,m,x,k,F]);return ae.jsx(oe.Provider,{value:A,children:n})},ne={},Je=async n=>{try{const o=new URL(n).origin;if(ne[o]!==void 0)return ne[o];const c=await(await fetch(`${o}/mm-app-manifest.json`)).json();if(!c.version)throw new Error("Invalid manifest");return ne[o]=c,c}catch{}return ne[origin]=!1,!1},Ke=async n=>!!await Je(n),Ne=(n,o,T)=>{const c=d.useContext(oe);if(c===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const h=d.useRef(T);d.useEffect(()=>{h.current=T},[T]),d.useEffect(()=>{if(!(!n||!o))return c.addListener(n,o,(...E)=>h.current(...E))},[c,n,o])};Be.propTypes={children:H.node.isRequired};const jr=Ye.default||Ye,kr=jr.iframe`
|
|
31
31
|
width: 100%;
|
|
32
32
|
height: 100%;
|
|
33
33
|
border: none;
|
|
34
34
|
visibility: ${n=>n.$isReady?"visible":"hidden"};
|
|
35
|
-
`,Ge=({id:n,src:o,path:T,onInit:c=()=>{},context:h={},params:E={},...
|
|
35
|
+
`,Ge=({id:n,src:o,path:T,onInit:c=()=>{},context:h={},params:E={},...F})=>{if("isConfiguring"in F)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in h)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in h)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const O=d.useRef(),[R,S]=d.useState(),[m,x]=d.useState(0),{registerFrame:k,unregisterFrame:A,sendMessage:i}=d.useContext(oe),[g,l]=d.useState(!0),[f,v]=d.useState();return d.useEffect(()=>{m&&i(n,"set-context",{context:{...h,colorMode:E.colorMode,isFullScreen:E.isFullScreen}})},[h,E.colorMode,E.isFullScreen,n,m]),d.useEffect(()=>{m&&(i(n,"set-params",{params:E}),i(n,"set-configuring",{isConfiguring:E.isConfiguring}))},[E,n,m]),d.useEffect(()=>{T!==void 0&&v(T)},[T]),d.useEffect(()=>{f===void 0||!m||i(n,"navigate",{path:f})},[f,m,n,i]),d.useEffect(()=>{if(!(!o||!n||!O))return(async()=>{const w=await Ke(o);if(l(w),w){const D=new URL(o);k(n,D.origin,O),c(),S(`${D.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`);return}})(),()=>{A(n)}},[o,n,k,O]),Ne(n,"ready",()=>x(w=>w+1)),g?ae.jsx(kr,{$isReady:m,ref:O,src:R,...F}):ae.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:ae.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};Ge.propTypes={id:H.string,src:H.string.isRequired,path:H.string,onInit:H.func};exports.MMEmbeddableZone=Ge;exports.MMEmbeddableZoneContext=oe;exports.MMEmbeddableZoneProvider=Be;exports.getAppInfo=Je;exports.testIsEmbeddable=Ke;exports.useEmbeddedEffect=Ne;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Ne, { createContext as wr, useState as z, useRef as Q, useCallback as Y, useEffect as A, useMemo as Tr, useContext as Ge } from "react";
|
|
2
2
|
import X from "prop-types";
|
|
3
3
|
import Be from "styled-components";
|
|
4
4
|
var Ee = { exports: {} }, G = {};
|
|
@@ -15,15 +15,15 @@ var Je;
|
|
|
15
15
|
function Sr() {
|
|
16
16
|
if (Je) return G;
|
|
17
17
|
Je = 1;
|
|
18
|
-
var n =
|
|
19
|
-
function
|
|
20
|
-
var b, P = {},
|
|
21
|
-
w !== void 0 && (
|
|
18
|
+
var n = Ne, o = Symbol.for("react.element"), S = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, y = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
19
|
+
function F(C, E, w) {
|
|
20
|
+
var b, P = {}, j = null, M = null;
|
|
21
|
+
w !== void 0 && (j = "" + w), E.key !== void 0 && (j = "" + E.key), E.ref !== void 0 && (M = E.ref);
|
|
22
22
|
for (b in E) c.call(E, b) && !h.hasOwnProperty(b) && (P[b] = E[b]);
|
|
23
23
|
if (C && C.defaultProps) for (b in E = C.defaultProps, E) P[b] === void 0 && (P[b] = E[b]);
|
|
24
|
-
return { $$typeof: o, type: C, key:
|
|
24
|
+
return { $$typeof: o, type: C, key: j, ref: M, props: P, _owner: y.current };
|
|
25
25
|
}
|
|
26
|
-
return G.Fragment = S, G.jsx =
|
|
26
|
+
return G.Fragment = S, G.jsx = F, G.jsxs = F, G;
|
|
27
27
|
}
|
|
28
28
|
var H = {};
|
|
29
29
|
/**
|
|
@@ -38,11 +38,11 @@ var H = {};
|
|
|
38
38
|
var Ke;
|
|
39
39
|
function Cr() {
|
|
40
40
|
return Ke || (Ke = 1, process.env.NODE_ENV !== "production" && function() {
|
|
41
|
-
var n =
|
|
41
|
+
var n = Ne, o = Symbol.for("react.element"), S = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), F = Symbol.for("react.provider"), C = Symbol.for("react.context"), E = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), P = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), M = Symbol.for("react.offscreen"), i = Symbol.iterator, g = "@@iterator";
|
|
42
42
|
function l(e) {
|
|
43
43
|
if (e === null || typeof e != "object")
|
|
44
44
|
return null;
|
|
45
|
-
var r = i && e[i] || e[
|
|
45
|
+
var r = i && e[i] || e[g];
|
|
46
46
|
return typeof r == "function" ? r : null;
|
|
47
47
|
}
|
|
48
48
|
var f = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
@@ -57,16 +57,16 @@ function Cr() {
|
|
|
57
57
|
{
|
|
58
58
|
var a = f.ReactDebugCurrentFrame, v = a.getStackAddendum();
|
|
59
59
|
v !== "" && (r += "%s", t = t.concat([v]));
|
|
60
|
-
var
|
|
60
|
+
var p = t.map(function(u) {
|
|
61
61
|
return String(u);
|
|
62
62
|
});
|
|
63
|
-
|
|
63
|
+
p.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, p);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
var D = !1, V = !1, $ = !1, ee = !1, re = !1, U;
|
|
67
67
|
U = Symbol.for("react.module.reference");
|
|
68
68
|
function ue(e) {
|
|
69
|
-
return !!(typeof e == "string" || typeof e == "function" || e === c || e === h || re || e === y || e === w || e === b || ee || e === M || D || V || $ || typeof e == "object" && e !== null && (e.$$typeof ===
|
|
69
|
+
return !!(typeof e == "string" || typeof e == "function" || e === c || e === h || re || e === y || e === w || e === b || ee || e === M || D || V || $ || typeof e == "object" && e !== null && (e.$$typeof === j || e.$$typeof === P || e.$$typeof === F || e.$$typeof === C || e.$$typeof === E || // This needs to include all possible module reference object
|
|
70
70
|
// types supported by any Flight configuration anywhere since
|
|
71
71
|
// we don't know which Flight build this will end up being used
|
|
72
72
|
// with.
|
|
@@ -108,7 +108,7 @@ function Cr() {
|
|
|
108
108
|
case C:
|
|
109
109
|
var r = e;
|
|
110
110
|
return J(r) + ".Consumer";
|
|
111
|
-
case
|
|
111
|
+
case F:
|
|
112
112
|
var t = e;
|
|
113
113
|
return J(t._context) + ".Provider";
|
|
114
114
|
case E:
|
|
@@ -116,10 +116,10 @@ function Cr() {
|
|
|
116
116
|
case P:
|
|
117
117
|
var a = e.displayName || null;
|
|
118
118
|
return a !== null ? a : I(e.type) || "Memo";
|
|
119
|
-
case
|
|
120
|
-
var v = e,
|
|
119
|
+
case j: {
|
|
120
|
+
var v = e, p = v._payload, u = v._init;
|
|
121
121
|
try {
|
|
122
|
-
return I(u(
|
|
122
|
+
return I(u(p));
|
|
123
123
|
} catch {
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
@@ -220,8 +220,8 @@ function Cr() {
|
|
|
220
220
|
de = !0;
|
|
221
221
|
var v = Error.prepareStackTrace;
|
|
222
222
|
Error.prepareStackTrace = void 0;
|
|
223
|
-
var
|
|
224
|
-
|
|
223
|
+
var p;
|
|
224
|
+
p = le.current, le.current = null, He();
|
|
225
225
|
try {
|
|
226
226
|
if (r) {
|
|
227
227
|
var u = function() {
|
|
@@ -265,16 +265,16 @@ function Cr() {
|
|
|
265
265
|
if (m !== 1 || R !== 1)
|
|
266
266
|
do
|
|
267
267
|
if (m--, R--, R < 0 || s[m] !== O[R]) {
|
|
268
|
-
var
|
|
268
|
+
var k = `
|
|
269
269
|
` + s[m].replace(" at new ", " at ");
|
|
270
|
-
return e.displayName &&
|
|
270
|
+
return e.displayName && k.includes("<anonymous>") && (k = k.replace("<anonymous>", e.displayName)), typeof e == "function" && ne.set(e, k), k;
|
|
271
271
|
}
|
|
272
272
|
while (m >= 1 && R >= 0);
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
} finally {
|
|
277
|
-
de = !1, le.current =
|
|
277
|
+
de = !1, le.current = p, ze(), Error.prepareStackTrace = v;
|
|
278
278
|
}
|
|
279
279
|
var B = e ? e.displayName || e.name : "", L = B ? te(B) : "";
|
|
280
280
|
return typeof e == "function" && ne.set(e, L), L;
|
|
@@ -305,17 +305,17 @@ function Cr() {
|
|
|
305
305
|
return Qe(e.render);
|
|
306
306
|
case P:
|
|
307
307
|
return ae(e.type, r, t);
|
|
308
|
-
case
|
|
309
|
-
var a = e, v = a._payload,
|
|
308
|
+
case j: {
|
|
309
|
+
var a = e, v = a._payload, p = a._init;
|
|
310
310
|
try {
|
|
311
|
-
return ae(
|
|
311
|
+
return ae(p(v), r, t);
|
|
312
312
|
} catch {
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var
|
|
318
|
+
var Z = Object.prototype.hasOwnProperty, ke = {}, Fe = f.ReactDebugCurrentFrame;
|
|
319
319
|
function oe(e) {
|
|
320
320
|
if (e) {
|
|
321
321
|
var r = e._owner, t = ae(e.type, e._source, r ? r.type : null);
|
|
@@ -325,9 +325,9 @@ function Cr() {
|
|
|
325
325
|
}
|
|
326
326
|
function rr(e, r, t, a, v) {
|
|
327
327
|
{
|
|
328
|
-
var
|
|
328
|
+
var p = Function.call.bind(Z);
|
|
329
329
|
for (var u in e)
|
|
330
|
-
if (
|
|
330
|
+
if (p(e, u)) {
|
|
331
331
|
var s = void 0;
|
|
332
332
|
try {
|
|
333
333
|
if (typeof e[u] != "function") {
|
|
@@ -366,7 +366,7 @@ function Cr() {
|
|
|
366
366
|
if (ar(e))
|
|
367
367
|
return d("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", nr(e)), Ie(e);
|
|
368
368
|
}
|
|
369
|
-
var
|
|
369
|
+
var N = f.ReactCurrentOwner, or = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
@@ -374,7 +374,7 @@ function Cr() {
|
|
|
374
374
|
}, Me, Ae, pe;
|
|
375
375
|
pe = {};
|
|
376
376
|
function ir(e) {
|
|
377
|
-
if (
|
|
377
|
+
if (Z.call(e, "ref")) {
|
|
378
378
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
379
379
|
if (r && r.isReactWarning)
|
|
380
380
|
return !1;
|
|
@@ -382,7 +382,7 @@ function Cr() {
|
|
|
382
382
|
return e.ref !== void 0;
|
|
383
383
|
}
|
|
384
384
|
function sr(e) {
|
|
385
|
-
if (
|
|
385
|
+
if (Z.call(e, "key")) {
|
|
386
386
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
387
387
|
if (r && r.isReactWarning)
|
|
388
388
|
return !1;
|
|
@@ -390,9 +390,9 @@ function Cr() {
|
|
|
390
390
|
return e.key !== void 0;
|
|
391
391
|
}
|
|
392
392
|
function ur(e, r) {
|
|
393
|
-
if (typeof e.ref == "string" &&
|
|
394
|
-
var t = I(
|
|
395
|
-
pe[t] || (d('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', I(
|
|
393
|
+
if (typeof e.ref == "string" && N.current && r && N.current.stateNode !== r) {
|
|
394
|
+
var t = I(N.current.type);
|
|
395
|
+
pe[t] || (d('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', I(N.current.type), e.ref), pe[t] = !0);
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
function cr(e, r) {
|
|
@@ -417,7 +417,7 @@ function Cr() {
|
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
var fr = function(e, r, t, a, v,
|
|
420
|
+
var fr = function(e, r, t, a, v, p, u) {
|
|
421
421
|
var s = {
|
|
422
422
|
// This tag allows us to uniquely identify this as a React Element
|
|
423
423
|
$$typeof: o,
|
|
@@ -427,7 +427,7 @@ function Cr() {
|
|
|
427
427
|
ref: t,
|
|
428
428
|
props: u,
|
|
429
429
|
// Record the component responsible for creating this element.
|
|
430
|
-
_owner:
|
|
430
|
+
_owner: p
|
|
431
431
|
};
|
|
432
432
|
return s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
433
433
|
configurable: !1,
|
|
@@ -448,20 +448,20 @@ function Cr() {
|
|
|
448
448
|
};
|
|
449
449
|
function dr(e, r, t, a, v) {
|
|
450
450
|
{
|
|
451
|
-
var
|
|
451
|
+
var p, u = {}, s = null, O = null;
|
|
452
452
|
t !== void 0 && (De(t), s = "" + t), sr(r) && (De(r.key), s = "" + r.key), ir(r) && (O = r.ref, ur(r, v));
|
|
453
|
-
for (
|
|
454
|
-
|
|
453
|
+
for (p in r)
|
|
454
|
+
Z.call(r, p) && !or.hasOwnProperty(p) && (u[p] = r[p]);
|
|
455
455
|
if (e && e.defaultProps) {
|
|
456
456
|
var m = e.defaultProps;
|
|
457
|
-
for (
|
|
458
|
-
u[
|
|
457
|
+
for (p in m)
|
|
458
|
+
u[p] === void 0 && (u[p] = m[p]);
|
|
459
459
|
}
|
|
460
460
|
if (s || O) {
|
|
461
461
|
var R = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
462
462
|
s && cr(u, R), O && lr(u, R);
|
|
463
463
|
}
|
|
464
|
-
return fr(e, s, O, v, a,
|
|
464
|
+
return fr(e, s, O, v, a, N.current, u);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
var ge = f.ReactCurrentOwner, $e = f.ReactDebugCurrentFrame;
|
|
@@ -532,7 +532,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
532
532
|
else if (e) {
|
|
533
533
|
var v = l(e);
|
|
534
534
|
if (typeof v == "function" && v !== e.entries)
|
|
535
|
-
for (var
|
|
535
|
+
for (var p = v.call(e), u; !(u = p.next()).done; )
|
|
536
536
|
me(u.value) && Le(u.value, r);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
@@ -575,7 +575,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
var Ve = {};
|
|
578
|
-
function qe(e, r, t, a, v,
|
|
578
|
+
function qe(e, r, t, a, v, p) {
|
|
579
579
|
{
|
|
580
580
|
var u = ue(e);
|
|
581
581
|
if (!u) {
|
|
@@ -586,23 +586,23 @@ Check the top-level render call using <` + t + ">.");
|
|
|
586
586
|
var m;
|
|
587
587
|
e === null ? m = "null" : ve(e) ? m = "array" : e !== void 0 && e.$$typeof === o ? (m = "<" + (I(e.type) || "Unknown") + " />", s = " Did you accidentally export a JSX literal instead of a component?") : m = typeof e, d("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", m, s);
|
|
588
588
|
}
|
|
589
|
-
var R = dr(e, r, t, v,
|
|
589
|
+
var R = dr(e, r, t, v, p);
|
|
590
590
|
if (R == null)
|
|
591
591
|
return R;
|
|
592
592
|
if (u) {
|
|
593
|
-
var
|
|
594
|
-
if (
|
|
593
|
+
var k = r.children;
|
|
594
|
+
if (k !== void 0)
|
|
595
595
|
if (a)
|
|
596
|
-
if (ve(
|
|
597
|
-
for (var B = 0; B <
|
|
598
|
-
Ye(
|
|
599
|
-
Object.freeze && Object.freeze(
|
|
596
|
+
if (ve(k)) {
|
|
597
|
+
for (var B = 0; B < k.length; B++)
|
|
598
|
+
Ye(k[B], e);
|
|
599
|
+
Object.freeze && Object.freeze(k);
|
|
600
600
|
} else
|
|
601
601
|
d("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
602
602
|
else
|
|
603
|
-
Ye(
|
|
603
|
+
Ye(k, e);
|
|
604
604
|
}
|
|
605
|
-
if (
|
|
605
|
+
if (Z.call(r, "key")) {
|
|
606
606
|
var L = I(e), x = Object.keys(r).filter(function(_r) {
|
|
607
607
|
return _r !== "key";
|
|
608
608
|
}), ye = x.length > 0 ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
@@ -647,11 +647,11 @@ function xr() {
|
|
|
647
647
|
}
|
|
648
648
|
return he(Pr);
|
|
649
649
|
}
|
|
650
|
-
const jr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
650
|
+
const jr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ze = { randomUUID: jr };
|
|
651
651
|
function kr(n, o, S) {
|
|
652
652
|
var y;
|
|
653
|
-
if (
|
|
654
|
-
return
|
|
653
|
+
if (Ze.randomUUID && !o && !n)
|
|
654
|
+
return Ze.randomUUID();
|
|
655
655
|
n = n || {};
|
|
656
656
|
const c = n.random ?? ((y = n.rng) == null ? void 0 : y.call(n)) ?? xr();
|
|
657
657
|
if (c.length < 16)
|
|
@@ -659,21 +659,21 @@ function kr(n, o, S) {
|
|
|
659
659
|
return c[6] = c[6] & 15 | 64, c[8] = c[8] & 63 | 128, Or(c);
|
|
660
660
|
}
|
|
661
661
|
const Re = wr(null), Fr = ({ children: n }) => {
|
|
662
|
-
const [o, S] = z({}), c = Q({}), y = Q({}), h = Q({}),
|
|
662
|
+
const [o, S] = z({}), c = Q({}), y = Q({}), h = Q({}), F = Y((i, g) => {
|
|
663
663
|
var l;
|
|
664
|
-
return !!((l = h.current[i]) != null && l.has(
|
|
665
|
-
}, []), C = Y((i,
|
|
666
|
-
S((f) => ({ ...f, [i]: { origin:
|
|
664
|
+
return !!((l = h.current[i]) != null && l.has(g));
|
|
665
|
+
}, []), C = Y((i, g, l) => {
|
|
666
|
+
S((f) => ({ ...f, [i]: { origin: g, frameRef: l } }));
|
|
667
667
|
}, []), E = Y((i) => {
|
|
668
|
-
S((
|
|
669
|
-
const l = { ...
|
|
668
|
+
S((g) => {
|
|
669
|
+
const l = { ...g };
|
|
670
670
|
return delete l[i], l;
|
|
671
671
|
}), delete h.current[i];
|
|
672
672
|
}, []);
|
|
673
673
|
A(() => {
|
|
674
674
|
const i = (l = [], f) => {
|
|
675
675
|
l.forEach((d) => d(f));
|
|
676
|
-
},
|
|
676
|
+
}, g = (l) => {
|
|
677
677
|
var D, V, $, ee, re;
|
|
678
678
|
if (!((D = l == null ? void 0 : l.data) != null && D.instanceId))
|
|
679
679
|
return;
|
|
@@ -690,12 +690,12 @@ const Re = wr(null), Fr = ({ children: n }) => {
|
|
|
690
690
|
}
|
|
691
691
|
i((V = _[f]) == null ? void 0 : V[d], l.data), i(($ = _["*"]) == null ? void 0 : $[d], l.data), i((ee = _[f]) == null ? void 0 : ee["*"], l.data), i((re = _["*"]) == null ? void 0 : re["*"], l.data);
|
|
692
692
|
};
|
|
693
|
-
return window.addEventListener("message",
|
|
694
|
-
window.removeEventListener("message",
|
|
693
|
+
return window.addEventListener("message", g), () => {
|
|
694
|
+
window.removeEventListener("message", g);
|
|
695
695
|
};
|
|
696
696
|
}, [o]);
|
|
697
697
|
const w = Y(
|
|
698
|
-
(i,
|
|
698
|
+
(i, g, l) => {
|
|
699
699
|
var d, _;
|
|
700
700
|
const f = o[i];
|
|
701
701
|
if (!f) {
|
|
@@ -703,33 +703,27 @@ const Re = wr(null), Fr = ({ children: n }) => {
|
|
|
703
703
|
return;
|
|
704
704
|
}
|
|
705
705
|
(_ = (d = f == null ? void 0 : f.frameRef) == null ? void 0 : d.current) != null && _.contentWindow && f.frameRef.current.contentWindow.postMessage(
|
|
706
|
-
{ type:
|
|
706
|
+
{ type: g, ...l, instanceId: i },
|
|
707
707
|
f.origin
|
|
708
708
|
);
|
|
709
709
|
},
|
|
710
710
|
[o]
|
|
711
711
|
), b = Y(
|
|
712
|
-
async (i,
|
|
713
|
-
if (!j(i, p)) {
|
|
714
|
-
d(
|
|
715
|
-
new Error(`No handler registered for request type: ${p}`)
|
|
716
|
-
);
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
712
|
+
async (i, g, l = {}) => new Promise((f, d) => {
|
|
719
713
|
const _ = kr(), D = (V, $) => {
|
|
720
714
|
delete y.current[_], $ ? d($) : f(V);
|
|
721
715
|
};
|
|
722
|
-
y.current[_] = D, w(i, "request", { callbackId: _, requestType:
|
|
716
|
+
y.current[_] = D, w(i, "request", { callbackId: _, requestType: g, data: l });
|
|
723
717
|
}),
|
|
724
|
-
[w
|
|
718
|
+
[w]
|
|
725
719
|
), P = Y(
|
|
726
|
-
(i,
|
|
727
|
-
w(i, "load-options",
|
|
720
|
+
(i, g) => {
|
|
721
|
+
w(i, "load-options", g);
|
|
728
722
|
},
|
|
729
723
|
[w]
|
|
730
|
-
),
|
|
731
|
-
(i,
|
|
732
|
-
w(i, "validate",
|
|
724
|
+
), j = Y(
|
|
725
|
+
(i, g) => {
|
|
726
|
+
w(i, "validate", g);
|
|
733
727
|
},
|
|
734
728
|
[w]
|
|
735
729
|
), M = Tr(
|
|
@@ -739,10 +733,10 @@ const Re = wr(null), Fr = ({ children: n }) => {
|
|
|
739
733
|
sendMessage: w,
|
|
740
734
|
sendRequest: b,
|
|
741
735
|
loadOptions: P,
|
|
742
|
-
validate:
|
|
743
|
-
hasHandler:
|
|
744
|
-
addListener: (i,
|
|
745
|
-
c.current[i][
|
|
736
|
+
validate: j,
|
|
737
|
+
hasHandler: F,
|
|
738
|
+
addListener: (i, g, l) => (c.current[i] || (c.current[i] = {}), c.current[i][g] || (c.current[i][g] = []), c.current[i][g].push(l), () => {
|
|
739
|
+
c.current[i][g] = c.current[i][g].filter((f) => f !== l);
|
|
746
740
|
})
|
|
747
741
|
}),
|
|
748
742
|
[
|
|
@@ -751,8 +745,8 @@ const Re = wr(null), Fr = ({ children: n }) => {
|
|
|
751
745
|
w,
|
|
752
746
|
b,
|
|
753
747
|
P,
|
|
754
|
-
|
|
755
|
-
|
|
748
|
+
j,
|
|
749
|
+
F
|
|
756
750
|
]
|
|
757
751
|
);
|
|
758
752
|
return /* @__PURE__ */ se.jsx(Re.Provider, { value: M, children: n });
|
|
@@ -802,9 +796,9 @@ const Ar = Be.default || Be, $r = Ar.iframe`
|
|
|
802
796
|
},
|
|
803
797
|
context: y = {},
|
|
804
798
|
params: h = {},
|
|
805
|
-
...
|
|
799
|
+
...F
|
|
806
800
|
}) => {
|
|
807
|
-
if ("isConfiguring" in
|
|
801
|
+
if ("isConfiguring" in F)
|
|
808
802
|
return console.error(
|
|
809
803
|
"isConfiguring must be passed via the params prop to MMEmbeddableZone"
|
|
810
804
|
), null;
|
|
@@ -816,9 +810,9 @@ const Ar = Be.default || Be, $r = Ar.iframe`
|
|
|
816
810
|
return console.error(
|
|
817
811
|
"isFullScreen must be passed via the params prop to MMEmbeddableZone"
|
|
818
812
|
), null;
|
|
819
|
-
const C = Q(), [E, w] = z(), [b, P] = z(0), { registerFrame:
|
|
813
|
+
const C = Q(), [E, w] = z(), [b, P] = z(0), { registerFrame: j, unregisterFrame: M, sendMessage: i } = Ge(
|
|
820
814
|
Re
|
|
821
|
-
), [
|
|
815
|
+
), [g, l] = z(!0), [f, d] = z();
|
|
822
816
|
return A(() => {
|
|
823
817
|
b && i(n, "set-context", {
|
|
824
818
|
context: {
|
|
@@ -840,7 +834,7 @@ const Ar = Be.default || Be, $r = Ar.iframe`
|
|
|
840
834
|
const _ = await Dr(o);
|
|
841
835
|
if (l(_), _) {
|
|
842
836
|
const D = new URL(o);
|
|
843
|
-
|
|
837
|
+
j(n, D.origin, C), c(), w(
|
|
844
838
|
`${D.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`
|
|
845
839
|
);
|
|
846
840
|
return;
|
|
@@ -848,7 +842,7 @@ const Ar = Be.default || Be, $r = Ar.iframe`
|
|
|
848
842
|
})(), () => {
|
|
849
843
|
M(n);
|
|
850
844
|
};
|
|
851
|
-
}, [o, n,
|
|
845
|
+
}, [o, n, j, C]), Mr(n, "ready", () => P((_) => _ + 1)), g ? /* @__PURE__ */ se.jsx($r, { $isReady: b, ref: C, src: E, ...F }) : /* @__PURE__ */ se.jsx(
|
|
852
846
|
"div",
|
|
853
847
|
{
|
|
854
848
|
style: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(j,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react"),require("prop-types"),require("styled-components")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","styled-components"],u):(j=typeof globalThis<"u"?globalThis:j||self,u(j["mm-react-embeddable"]={},j.React,j.PropTypes,j.styled))})(this,function(j,u,K,Ee){"use strict";var se={exports:{}},N={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Re;function Qe(){if(Re)return N;Re=1;var n=u,o=Symbol.for("react.element"),T=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,h=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,E={key:!0,ref:!0,__self:!0,__source:!0};function
|
|
9
|
+
*/var Re;function Qe(){if(Re)return N;Re=1;var n=u,o=Symbol.for("react.element"),T=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,h=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,E={key:!0,ref:!0,__self:!0,__source:!0};function F(O,R,C){var m,x={},M=null,U=null;C!==void 0&&(M=""+C),R.key!==void 0&&(M=""+R.key),R.ref!==void 0&&(U=R.ref);for(m in R)l.call(R,m)&&!E.hasOwnProperty(m)&&(x[m]=R[m]);if(O&&O.defaultProps)for(m in R=O.defaultProps,R)x[m]===void 0&&(x[m]=R[m]);return{$$typeof:o,type:O,key:M,ref:U,props:x,_owner:h.current}}return N.Fragment=T,N.jsx=F,N.jsxs=F,N}var G={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var _e;function qe(){return _e||(_e=1,process.env.NODE_ENV!=="production"&&function(){var n=u,o=Symbol.for("react.element"),T=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),
|
|
18
|
-
`+de+e}}var ve=!1,ae;{var ir=typeof WeakMap=="function"?WeakMap:Map;ae=new ir}function Ue(e,r){if(!e||ve)return"";{var t=ae.get(e);if(t!==void 0)return t}var a;ve=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var
|
|
17
|
+
*/var _e;function qe(){return _e||(_e=1,process.env.NODE_ENV!=="production"&&function(){var n=u,o=Symbol.for("react.element"),T=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),O=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),U=Symbol.for("react.offscreen"),i=Symbol.iterator,g="@@iterator";function f(e){if(e===null||typeof e!="object")return null;var r=i&&e[i]||e[g];return typeof r=="function"?r:null}var d=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),a=1;a<r;a++)t[a-1]=arguments[a];w("error",e,t)}}function w(e,r,t){{var a=d.ReactDebugCurrentFrame,p=a.getStackAddendum();p!==""&&(r+="%s",t=t.concat([p]));var b=t.map(function(c){return String(c)});b.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,b)}}var A=!1,Z=!1,W=!1,re=!1,te=!1,L;L=Symbol.for("react.module.reference");function ce(e){return!!(typeof e=="string"||typeof e=="function"||e===l||e===E||te||e===h||e===C||e===m||re||e===U||A||Z||W||typeof e=="object"&&e!==null&&(e.$$typeof===M||e.$$typeof===x||e.$$typeof===F||e.$$typeof===O||e.$$typeof===R||e.$$typeof===L||e.getModuleId!==void 0))}function le(e,r,t){var a=e.displayName;if(a)return a;var p=r.displayName||r.name||"";return p!==""?t+"("+p+")":t}function H(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&v("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 l:return"Fragment";case T:return"Portal";case E:return"Profiler";case h:return"StrictMode";case C:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case O:var r=e;return H(r)+".Consumer";case F:var t=e;return H(t._context)+".Provider";case R:return le(e,e.render,"ForwardRef");case x:var a=e.displayName||null;return a!==null?a:D(e.type)||"Memo";case M:{var p=e,b=p._payload,c=p._init;try{return D(c(b))}catch{return null}}}return null}var Y=Object.assign,z=0,je,xe,ke,Me,Ie,Fe,De;function Ae(){}Ae.__reactDisabledLog=!0;function ar(){{if(z===0){je=console.log,xe=console.info,ke=console.warn,Me=console.error,Ie=console.group,Fe=console.groupCollapsed,De=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ae,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function or(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Y({},e,{value:je}),info:Y({},e,{value:xe}),warn:Y({},e,{value:ke}),error:Y({},e,{value:Me}),group:Y({},e,{value:Ie}),groupCollapsed:Y({},e,{value:Fe}),groupEnd:Y({},e,{value:De})})}z<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=d.ReactCurrentDispatcher,de;function ne(e,r,t){{if(de===void 0)try{throw Error()}catch(p){var a=p.stack.trim().match(/\n( *(at )?)/);de=a&&a[1]||""}return`
|
|
18
|
+
`+de+e}}var ve=!1,ae;{var ir=typeof WeakMap=="function"?WeakMap:Map;ae=new ir}function Ue(e,r){if(!e||ve)return"";{var t=ae.get(e);if(t!==void 0)return t}var a;ve=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var b;b=fe.current,fe.current=null,ar();try{if(r){var c=function(){throw Error()};if(Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(k){a=k}Reflect.construct(e,[],c)}else{try{c.call()}catch(k){a=k}e.call(c.prototype)}}else{try{throw Error()}catch(k){a=k}e()}}catch(k){if(k&&a&&typeof k.stack=="string"){for(var s=k.stack.split(`
|
|
19
19
|
`),P=a.stack.split(`
|
|
20
|
-
`),y=s.length-1,_=P.length-1;y>=1&&_>=0&&s[y]!==P[_];)_--;for(;y>=1&&_>=0;y--,_--)if(s[y]!==P[_]){if(y!==1||_!==1)do if(y--,_--,_<0||s[y]!==P[_]){var
|
|
21
|
-
`+s[y].replace(" at new "," at ");return e.displayName&&
|
|
20
|
+
`),y=s.length-1,_=P.length-1;y>=1&&_>=0&&s[y]!==P[_];)_--;for(;y>=1&&_>=0;y--,_--)if(s[y]!==P[_]){if(y!==1||_!==1)do if(y--,_--,_<0||s[y]!==P[_]){var I=`
|
|
21
|
+
`+s[y].replace(" at new "," at ");return e.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",e.displayName)),typeof e=="function"&&ae.set(e,I),I}while(y>=1&&_>=0);break}}}finally{ve=!1,fe.current=b,or(),Error.prepareStackTrace=p}var J=e?e.displayName||e.name:"",V=J?ne(J):"";return typeof e=="function"&&ae.set(e,V),V}function sr(e,r,t){return Ue(e,!1)}function ur(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function oe(e,r,t){if(e==null)return"";if(typeof e=="function")return Ue(e,ur(e));if(typeof e=="string")return ne(e);switch(e){case C:return ne("Suspense");case m:return ne("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case R:return sr(e.render);case x:return oe(e.type,r,t);case M:{var a=e,p=a._payload,b=a._init;try{return oe(b(p),r,t)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,We={},Le=d.ReactDebugCurrentFrame;function ie(e){if(e){var r=e._owner,t=oe(e.type,e._source,r?r.type:null);Le.setExtraStackFrame(t)}else Le.setExtraStackFrame(null)}function cr(e,r,t,a,p){{var b=Function.call.bind(X);for(var c in e)if(b(e,c)){var s=void 0;try{if(typeof e[c]!="function"){var P=Error((a||"React class")+": "+t+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}s=e[c](r,c,a,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(y){s=y}s&&!(s instanceof Error)&&(ie(p),v("%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,c,typeof s),ie(null)),s instanceof Error&&!(s.message in We)&&(We[s.message]=!0,ie(p),v("Failed %s type: %s",t,s.message),ie(null))}}}var lr=Array.isArray;function pe(e){return lr(e)}function fr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function dr(e){try{return Ye(e),!1}catch{return!0}}function Ye(e){return""+e}function Ve(e){if(dr(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",fr(e)),Ye(e)}var Q=d.ReactCurrentOwner,vr={key:!0,ref:!0,__self:!0,__source:!0},Ze,Be,be;be={};function pr(e){if(X.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function br(e){if(X.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function gr(e,r){if(typeof e.ref=="string"&&Q.current&&r&&Q.current.stateNode!==r){var t=D(Q.current.type);be[t]||(v('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',D(Q.current.type),e.ref),be[t]=!0)}}function mr(e,r){{var t=function(){Ze||(Ze=!0,v("%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 yr(e,r){{var t=function(){Be||(Be=!0,v("%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 hr=function(e,r,t,a,p,b,c){var s={$$typeof:o,type:e,key:r,ref:t,props:c,_owner:b};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function Er(e,r,t,a,p){{var b,c={},s=null,P=null;t!==void 0&&(Ve(t),s=""+t),br(r)&&(Ve(r.key),s=""+r.key),pr(r)&&(P=r.ref,gr(r,p));for(b in r)X.call(r,b)&&!vr.hasOwnProperty(b)&&(c[b]=r[b]);if(e&&e.defaultProps){var y=e.defaultProps;for(b in y)c[b]===void 0&&(c[b]=y[b])}if(s||P){var _=typeof e=="function"?e.displayName||e.name||"Unknown":e;s&&mr(c,_),P&&yr(c,_)}return hr(e,s,P,p,a,Q.current,c)}}var ge=d.ReactCurrentOwner,Je=d.ReactDebugCurrentFrame;function B(e){if(e){var r=e._owner,t=oe(e.type,e._source,r?r.type:null);Je.setExtraStackFrame(t)}else Je.setExtraStackFrame(null)}var me;me=!1;function ye(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function Ke(){{if(ge.current){var e=D(ge.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function Rr(e){return""}var Ne={};function _r(e){{var r=Ke();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+t+">.")}return r}}function Ge(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=_r(r);if(Ne[t])return;Ne[t]=!0;var a="";e&&e._owner&&e._owner!==ge.current&&(a=" It was passed a child from "+D(e._owner.type)+"."),B(e),v('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),B(null)}}function He(e,r){{if(typeof e!="object")return;if(pe(e))for(var t=0;t<e.length;t++){var a=e[t];ye(a)&&Ge(a,r)}else if(ye(e))e._store&&(e._store.validated=!0);else if(e){var p=f(e);if(typeof p=="function"&&p!==e.entries)for(var
|
|
25
|
+
Check the top-level render call using <`+t+">.")}return r}}function Ge(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=_r(r);if(Ne[t])return;Ne[t]=!0;var a="";e&&e._owner&&e._owner!==ge.current&&(a=" It was passed a child from "+D(e._owner.type)+"."),B(e),v('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),B(null)}}function He(e,r){{if(typeof e!="object")return;if(pe(e))for(var t=0;t<e.length;t++){var a=e[t];ye(a)&&Ge(a,r)}else if(ye(e))e._store&&(e._store.validated=!0);else if(e){var p=f(e);if(typeof p=="function"&&p!==e.entries)for(var b=p.call(e),c;!(c=b.next()).done;)ye(c.value)&&Ge(c.value,r)}}}function wr(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===R||r.$$typeof===x))t=r.propTypes;else return;if(t){var a=D(r);cr(t,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!me){me=!0;var p=D(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",p||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Sr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var a=r[t];if(a!=="children"&&a!=="key"){B(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),B(null);break}}e.ref!==null&&(B(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}var ze={};function Xe(e,r,t,a,p,b){{var c=ce(e);if(!c){var s="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(s+=" 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 P=Rr();P?s+=P:s+=Ke();var y;e===null?y="null":pe(e)?y="array":e!==void 0&&e.$$typeof===o?(y="<"+(D(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,s)}var _=Er(e,r,t,p,b);if(_==null)return _;if(c){var I=r.children;if(I!==void 0)if(a)if(pe(I)){for(var J=0;J<I.length;J++)He(I[J],e);Object.freeze&&Object.freeze(I)}else v("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 He(I,e)}if(X.call(r,"key")){var V=D(e),k=Object.keys(r).filter(function(xr){return xr!=="key"}),he=k.length>0?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}";if(!ze[V+he]){var jr=k.length>0?"{"+k.join(": ..., ")+": ...}":"{}";v(`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} />`,he,V,
|
|
30
|
+
<%s key={someKey} {...props} />`,he,V,jr,V),ze[V+he]=!0}}return e===l?Sr(_):wr(_),_}}function Cr(e,r,t){return Xe(e,r,t,!0)}function Tr(e,r,t){return Xe(e,r,t,!1)}var Or=Tr,Pr=Cr;G.Fragment=l,G.jsx=Or,G.jsxs=Pr}()),G}process.env.NODE_ENV==="production"?se.exports=Qe():se.exports=qe();var q=se.exports;const S=[];for(let n=0;n<256;++n)S.push((n+256).toString(16).slice(1));function $e(n,o=0){return(S[n[o+0]]+S[n[o+1]]+S[n[o+2]]+S[n[o+3]]+"-"+S[n[o+4]]+S[n[o+5]]+"-"+S[n[o+6]]+S[n[o+7]]+"-"+S[n[o+8]]+S[n[o+9]]+"-"+S[n[o+10]]+S[n[o+11]]+S[n[o+12]]+S[n[o+13]]+S[n[o+14]]+S[n[o+15]]).toLowerCase()}let ue;const er=new Uint8Array(16);function rr(){if(!ue){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ue=crypto.getRandomValues.bind(crypto)}return ue(er)}const we={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function tr(n,o,T){var h;if(we.randomUUID&&!o&&!n)return we.randomUUID();n=n||{};const l=n.random??((h=n.rng)==null?void 0:h.call(n))??rr();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,$e(l)}const $=u.createContext(null),Se=({children:n})=>{const[o,T]=u.useState({}),l=u.useRef({}),h=u.useRef({}),E=u.useRef({}),F=u.useCallback((i,g)=>{var f;return!!((f=E.current[i])!=null&&f.has(g))},[]),O=u.useCallback((i,g,f)=>{T(d=>({...d,[i]:{origin:g,frameRef:f}}))},[]),R=u.useCallback(i=>{T(g=>{const f={...g};return delete f[i],f}),delete E.current[i]},[]);u.useEffect(()=>{const i=(f=[],d)=>{f.forEach(v=>v(d))},g=f=>{var A,Z,W,re,te;if(!((A=f==null?void 0:f.data)!=null&&A.instanceId))return;const{instanceId:d,type:v}=f.data,w=l.current;if(v==="response"){const{callbackId:L,response:ce,error:le}=f.data,H=h.current[L];H&&(H(ce,le),delete h.current[L]);return}if(v==="mark-registered"){const{requestType:L}=f.data;E.current[d]||(E.current[d]=new Set),E.current[d].add(L);return}i((Z=w[d])==null?void 0:Z[v],f.data),i((W=w["*"])==null?void 0:W[v],f.data),i((re=w[d])==null?void 0:re["*"],f.data),i((te=w["*"])==null?void 0:te["*"],f.data)};return window.addEventListener("message",g),()=>{window.removeEventListener("message",g)}},[o]);const C=u.useCallback((i,g,f)=>{var v,w;const d=o[i];if(!d){console.warn(`Origin not set for id: ${i}. Unable to send message.`);return}(w=(v=d==null?void 0:d.frameRef)==null?void 0:v.current)!=null&&w.contentWindow&&d.frameRef.current.contentWindow.postMessage({type:g,...f,instanceId:i},d.origin)},[o]),m=u.useCallback(async(i,g,f={})=>new Promise((d,v)=>{const w=tr(),A=(Z,W)=>{delete h.current[w],W?v(W):d(Z)};h.current[w]=A,C(i,"request",{callbackId:w,requestType:g,data:f})}),[C]),x=u.useCallback((i,g)=>{C(i,"load-options",g)},[C]),M=u.useCallback((i,g)=>{C(i,"validate",g)},[C]),U=u.useMemo(()=>({registerFrame:O,unregisterFrame:R,sendMessage:C,sendRequest:m,loadOptions:x,validate:M,hasHandler:F,addListener:(i,g,f)=>(l.current[i]||(l.current[i]={}),l.current[i][g]||(l.current[i][g]=[]),l.current[i][g].push(f),()=>{l.current[i][g]=l.current[i][g].filter(d=>d!==f)})}),[O,R,C,m,x,M,F]);return q.jsx($.Provider,{value:U,children:n})},ee={},Ce=async n=>{try{const o=new URL(n).origin;if(ee[o]!==void 0)return ee[o];const l=await(await fetch(`${o}/mm-app-manifest.json`)).json();if(!l.version)throw new Error("Invalid manifest");return ee[o]=l,l}catch{}return ee[origin]=!1,!1},Te=async n=>!!await Ce(n),Oe=(n,o,T)=>{const l=u.useContext($);if(l===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const h=u.useRef(T);u.useEffect(()=>{h.current=T},[T]),u.useEffect(()=>{if(!(!n||!o))return l.addListener(n,o,(...E)=>h.current(...E))},[l,n,o])};Se.propTypes={children:K.node.isRequired};const nr=(Ee.default||Ee).iframe`
|
|
31
31
|
width: 100%;
|
|
32
32
|
height: 100%;
|
|
33
33
|
border: none;
|
|
34
34
|
visibility: ${n=>n.$isReady?"visible":"hidden"};
|
|
35
|
-
`,Pe=({id:n,src:o,path:T,onInit:l=()=>{},context:h={},params:E={},...
|
|
35
|
+
`,Pe=({id:n,src:o,path:T,onInit:l=()=>{},context:h={},params:E={},...F})=>{if("isConfiguring"in F)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in h)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in h)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const O=u.useRef(),[R,C]=u.useState(),[m,x]=u.useState(0),{registerFrame:M,unregisterFrame:U,sendMessage:i}=u.useContext($),[g,f]=u.useState(!0),[d,v]=u.useState();return u.useEffect(()=>{m&&i(n,"set-context",{context:{...h,colorMode:E.colorMode,isFullScreen:E.isFullScreen}})},[h,E.colorMode,E.isFullScreen,n,m]),u.useEffect(()=>{m&&(i(n,"set-params",{params:E}),i(n,"set-configuring",{isConfiguring:E.isConfiguring}))},[E,n,m]),u.useEffect(()=>{T!==void 0&&v(T)},[T]),u.useEffect(()=>{d===void 0||!m||i(n,"navigate",{path:d})},[d,m,n,i]),u.useEffect(()=>{if(!(!o||!n||!O))return(async()=>{const w=await Te(o);if(f(w),w){const A=new URL(o);M(n,A.origin,O),l(),C(`${A.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`);return}})(),()=>{U(n)}},[o,n,M,O]),Oe(n,"ready",()=>x(w=>w+1)),g?q.jsx(nr,{$isReady:m,ref:O,src:R,...F}):q.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:q.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};Pe.propTypes={id:K.string,src:K.string.isRequired,path:K.string,onInit:K.func},j.MMEmbeddableZone=Pe,j.MMEmbeddableZoneContext=$,j.MMEmbeddableZoneProvider=Se,j.getAppInfo=Ce,j.testIsEmbeddable=Te,j.useEmbeddedEffect=Oe,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
|