"use strict";(self.webpackChunknpwd_crypto=self.webpackChunknpwd_crypto||[]).push([[208,387],{1642:(e,n,t)=>{n.__esModule=!0,n.NuiContext=void 0;var r=t(2950);n.NuiContext=r.createContext({removeHandler:function(){console.log("Failed to remove event. The context has not been initialized")},addHandler:function(){console.log("Failed to add event. The context has not been initialized")}})},6877:(e,n,t)=>{n.__esModule=!0,n.useNuiEvent=void 0;var r=t(2950),i=t(1642);n.useNuiEvent=function(e){var n,t=r.useContext(null!==(n=e.context)&&void 0!==n?n:i.NuiContext),o=r.useState(e.defaultValue),u=o[0],a=o[1];if(!t)throw new Error("useNuiEvent must be used inside the NuiProvider");if(!e.event)throw new Error("Cannot use NuiEvent on nothing.");return r.useEffect((function(){return t.addHandler(e.event,(function(n){a(n.data.payload),e.callback&&"function"==typeof e.callback&&e.callback(n.data.payload)})),function(){t.removeHandler(e.event)}}),[]),{data:u}}},4208:function(e,n,t){var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t),Object.defineProperty(e,r,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),i=this&&this.__exportStar||function(e,n){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(n,t)||r(n,e,t)};n.__esModule=!0,i(t(8841),n),i(t(1642),n),i(t(6877),n)},8841:function(e,n,t){var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t),Object.defineProperty(e,r,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),i=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&r(n,e,t);return i(n,e),n},u=this&&this.__spreadArray||function(e,n){for(var t=0,r=n.length,i=e.length;t<r;t++,i++)e[i]=n[t];return e};n.__esModule=!0,n.NuiProvider=void 0;var a=o(t(2950)),d=t(1642);n.NuiProvider=function(e){var n,t=null!==(n=e.context)&&void 0!==n?n:d.NuiContext,r=a.useRef({}),i=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];e.debug&&console.debug(n)},o=function(n){if(i("Handling event",n),!e.validateEvent||e.validateEvent(n)){var t=n.data.type;i("Checking if we should handle event .. ",t),r.current&&r.current[t]&&r.current[t].length>0&&r.current[t].forEach((function(e){i("Running handler for",t),e(n)}))}else i("Returning! Event was invalid",n)};return a.useEffect((function(){return window.addEventListener("message",o),function(){return window.removeEventListener("message",o)}}),[]),a.default.createElement(t.Provider,{value:{addHandler:function(e,n){var t;i("Adding handler for event",e);var o=null!==(t=r.current[e])&&void 0!==t?t:[];i("Existing handlers",o),r.current[e]=u(u([],o),[n])},removeHandler:function(e){i("Removing handler for event",e),delete r.current[e]}}},e.children)}}}]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 13104 characters]