-
Notifications
You must be signed in to change notification settings - Fork 31
/
58842.cbdae304.iframe.bundle.js
1 lines (1 loc) · 46.8 KB
/
58842.cbdae304.iframe.bundle.js
1
"use strict";(globalThis.webpackChunkmetamask_crx=globalThis.webpackChunkmetamask_crx||[]).push([[58842],{"./ui/components/app/snaps/snap-ui-renderer/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{a:()=>SnapUIRenderer});var react=__webpack_require__("./node_modules/react/index.js"),prop_types=__webpack_require__("./node_modules/prop-types/index.js"),prop_types_default=__webpack_require__.n(prop_types),es=__webpack_require__("./node_modules/react-redux/es/index.js"),Container=__webpack_require__("./node_modules/@metamask/snaps-sdk/dist/jsx/components/Container.mjs"),lodash=__webpack_require__("./node_modules/lodash/lodash.js"),metamask_template_renderer=__webpack_require__("./ui/components/app/metamask-template-renderer/metamask-template-renderer.js"),snap_delineator=__webpack_require__("./ui/components/app/snaps/snap-delineator/index.js"),selectors=__webpack_require__("./ui/selectors/index.js"),component_library=__webpack_require__("./ui/components/component-library/index.ts"),snaps=__webpack_require__("./ui/helpers/constants/snaps/index.js"),contexts_snaps=__webpack_require__("./ui/contexts/snaps/index.ts"),pulse_loader=__webpack_require__("./ui/components/ui/pulse-loader/index.js"),design_system=__webpack_require__("./ui/helpers/constants/design-system.ts"),useI18nContext=__webpack_require__("./ui/hooks/useI18nContext.js"),ui=__webpack_require__("./node_modules/@metamask/snaps-utils/dist/ui.mjs"),sha256=__webpack_require__("./node_modules/@noble/hashes/esm/sha256.js"),hex=__webpack_require__("./node_modules/@metamask/utils/dist/hex.mjs"),bytes=__webpack_require__("./node_modules/@metamask/utils/dist/bytes.mjs"),he=__webpack_require__("./node_modules/he/he.js");function _define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){_define_property(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}function _object_without_properties(source,excluded){if(null==source)return{};var key,i,target=_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}function generateJustifyContent(alignment){switch(alignment){default:case"start":return design_system.A9.flexStart;case"center":return design_system.A9.center;case"end":return design_system.A9.flexEnd;case"space-between":return design_system.A9.spaceBetween;case"space-around":return design_system.A9.spaceAround}}var box=function(_param){var element=_param.element,params=_object_without_properties(_param,["element"]);return{element:"Box",children:(0,ui.$I)(element).map(function(children){return mapToTemplate(_object_spread_props(_object_spread({},params),{element:children}))}),props:{display:design_system.nl.Flex,flexDirection:"horizontal"===element.props.direction?design_system.bo.Row:design_system.bo.Column,justifyContent:generateJustifyContent(element.props.alignment),alignItems:element.props.center&&design_system.k2.center,className:"snap-ui-renderer__panel",color:design_system.r7.textDefault}}},generateSize=function(size){switch(size){case"sm":default:return design_system.J3.headingSm;case"md":return design_system.J3.headingMd;case"lg":return design_system.J3.headingLg}};function text_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=text_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function text_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}function row_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function row_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){row_define_property(target,key,source[key])})}return target}function row_ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function row_object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):row_ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}function row_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=row_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function row_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}function button_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=button_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function button_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}var button_button=function(_param){var element=_param.element,params=button_object_without_properties(_param,["element"]);return{element:"SnapUIButton",props:{type:element.props.type,form:element.props.form,variant:element.props.variant,name:element.props.name,disabled:element.props.disabled},children:mapTextToTemplate((0,ui.$I)(element),params)}};function form_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function form_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){form_define_property(target,key,source[key])})}return target}function form_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=form_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function form_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}var misc=__webpack_require__("./node_modules/@metamask/utils/dist/misc.mjs");function input_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function input_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){input_define_property(target,key,source[key])})}return target}function input_ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function input_object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):input_ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}var constructInputProps=function(props){if(!(0,misc.i5)(props,"type"))return{textFieldProps:{type:"text"}};if("number"===props.type){var step=props.step,min=props.min,max=props.max;return{textFieldProps:{type:props.type,inputProps:{step:null==step?void 0:step.toString(),min:null==min?void 0:min.toString(),max:null==max?void 0:max.toString()}}}}return{textFieldProps:{type:props.type}}};function bold_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=bold_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function bold_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}function italic_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=italic_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function italic_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}function link_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=link_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function link_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}var dropdown_dropdown=function(param){var element=param.element,form=param.form,options=(0,ui.$I)(element).map(function(child){return{value:child.props.value,name:child.props.children}});return{element:"SnapUIDropdown",props:{id:element.props.name,name:element.props.name,form:form,options:options}}},radioGroup_radioGroup=function(param){var element=param.element,form=param.form,options=(0,ui.$I)(element).map(function(child){return{value:child.props.value,name:child.props.children}});return{element:"SnapUIRadioGroup",props:{id:element.props.name,name:element.props.name,form:form,options:options}}},checkbox_checkbox=function(param){var element=param.element,form=param.form;return{element:"SnapUICheckbox",props:{name:element.props.name,label:element.props.label,variant:element.props.variant,form:form}}};function selector_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function selector_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){selector_define_property(target,key,source[key])})}return target}function selector_ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function selector_object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):selector_ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}function selector_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=selector_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function selector_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}var selector_selector=function(_param){var element=_param.element,form=_param.form,params=selector_object_without_properties(_param,["element","form"]),children=(0,ui.$I)(element),options=children.map(function(child){return child.props.value}),optionComponents=children.map(function(child){return mapToTemplate(selector_object_spread_props(selector_object_spread({},params),{form:form,element:child.props.children}))});return{element:"SnapUISelector",props:{id:element.props.name,name:element.props.name,title:element.props.title,form:form,options:options},propComponents:{optionComponents:optionComponents}}};function field_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function field_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){field_define_property(target,key,source[key])})}return target}function field_ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function field_object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):field_ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}function field_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=field_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function field_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}var Text=__webpack_require__("./node_modules/@metamask/snaps-sdk/dist/jsx/components/Text.mjs");function tooltip_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function tooltip_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){tooltip_define_property(target,key,source[key])})}return target}function tooltip_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=tooltip_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function tooltip_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}function card_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function card_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){card_define_property(target,key,source[key])})}return target}function card_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=card_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function card_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}function footer_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function footer_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){footer_define_property(target,key,source[key])})}return target}function footer_ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function footer_object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):footer_ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}function footer_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=footer_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function footer_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}var DEFAULT_FOOTER={element:"Box",key:"default-footer",props:{display:design_system.nl.Flex,flexDirection:design_system.bo.Row,width:design_system.Zf.Full,gap:4,padding:4,className:"snap-ui-renderer__footer",backgroundColor:design_system.i0.backgroundDefault,style:{boxShadow:"var(--shadow-size-md) var(--color-shadow-default)",height:"80px",position:"fixed",bottom:0}}},getDefaultButtons=function(footer,t,onCancel){if(1===(0,ui.$I)(footer).length&&onCancel)return{element:"SnapUIFooterButton",key:"default-button",props:{onCancel:onCancel,variant:component_library.Ak.Secondary,isSnapAction:!1},children:t("cancel")}};function container_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function container_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){container_define_property(target,key,source[key])})}return target}function container_ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function container_object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):container_ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}function container_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=container_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function container_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}var ICON_NAMES=new Set(Object.values(component_library.$M));function section_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function section_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){section_define_property(target,key,source[key])})}return target}function section_ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function section_object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):section_ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}function section_object_without_properties(source,excluded){if(null==source)return{};var key,i,target=section_object_without_properties_loose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function section_object_without_properties_loose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}var COMPONENT_MAPPING={Box:box,Heading:function(param){var element=param.element;return{element:"Text",children:element.props.children,props:{variant:generateSize(element.props.size),overflowWrap:design_system.Np.Anywhere}}},Text:function(_param){var element=_param.element,params=text_object_without_properties(_param,["element"]);return{element:"Text",children:mapTextToTemplate((0,ui.$I)(element),params),props:{variant:design_system.J3.bodyMd,overflowWrap:design_system.Np.Anywhere,color:function(){switch(element.props.color){case"default":return design_system.r7.textDefault;case"alternative":return design_system.r7.textAlternative;case"muted":return design_system.r7.textMuted;case"error":return design_system.r7.errorDefault;case"success":return design_system.r7.successDefault;case"warning":return design_system.r7.warningDefault;default:return design_system.r7.inherit}}(),className:"snap-ui-renderer__text",textAlign:element.props.alignment}}},Divider:function(){return{element:"Box",props:{className:"snap-ui-renderer__divider",backgroundColor:design_system.cG.borderMuted}}},Spinner:function(){return{element:"Spinner",props:{className:"snap-ui-renderer__spinner"}}},Icon:function(param){var element=param.element;return{element:"SnapUIIcon",props:{name:ICON_NAMES.has(element.props.name)?element.props.name:component_library.$M.Danger,color:function(){switch(element.props.color){case"muted":return design_system.Li.iconMuted;case"primary":return design_system.Li.primaryDefault;default:return design_system.Li.iconDefault}}(),size:"md"===element.props.size?component_library.lK.Md:component_library.lK.Inherit}}},Image:function(param){return{element:"SnapUIImage",props:{value:param.element.props.src}}},Copyable:function(param){var element=param.element;return{element:"Copyable",props:{text:element.props.value,sensitive:element.props.sensitive}}},Row:function(_param){var element=_param.element;return{element:"ConfirmInfoRow",children:[mapToTemplate(row_object_spread_props(row_object_spread({},row_object_without_properties(_param,["element"])),{element:element.props.children}))],props:{label:element.props.label,variant:element.props.variant,tooltip:element.props.tooltip,style:{marginLeft:"-8px",marginRight:"-8px",marginTop:"0px",marginBottom:"0px"}}}},Address:function(param){var element=param.element;return{element:"SnapUIAddress",props:{address:element.props.address,avatarSize:"xs",truncate:element.props.truncate,displayName:element.props.displayName,avatar:element.props.avatar}}},Avatar:function(param){return{element:"SnapUIAvatar",props:{address:param.element.props.address}}},Button:button_button,FileInput:function(param){var element=param.element,form=param.form;return{element:"SnapUIInput",props:{element:"SnapUIFileInput",props:{name:element.props.name,accept:element.props.accept,compact:element.props.compact,form:form}}}},Form:function(_param){var element=_param.element,params=form_object_without_properties(_param,["element"]);return{element:"SnapUIForm",children:(0,ui.$I)(element).map(function(children){return mapToTemplate(form_object_spread({element:children,form:element.props.name},params))}),props:{name:element.props.name}}},Input:function(param){var element=param.element,form=param.form;return{element:"SnapUIInput",props:input_object_spread_props(input_object_spread({id:element.props.name,placeholder:element.props.placeholder},constructInputProps(element.props)),{name:element.props.name,form:form})}},Bold:function(_param){var element=_param.element,params=bold_object_without_properties(_param,["element"]);return{element:"Text",children:mapTextToTemplate((0,ui.$I)(element),params),props:{variant:design_system.J3.bodyMd,overflowWrap:design_system.Np.Anywhere,color:design_system.r7.inherit,className:"snap-ui-renderer__text",as:"b"}}},Italic:function(_param){var element=_param.element,params=italic_object_without_properties(_param,["element"]);return{element:"Text",children:mapTextToTemplate((0,ui.$I)(element),params),props:{variant:design_system.J3.bodyMd,overflowWrap:design_system.Np.Anywhere,color:design_system.r7.inherit,className:"snap-ui-renderer__text",as:"i"}}},Link:function(_param){var element=_param.element,params=link_object_without_properties(_param,["element"]);return{element:"SnapUILink",children:mapTextToTemplate((0,ui.$I)(element),params),props:{href:element.props.href}}},Field:function(_param){var element=_param.element,form=_param.form,params=field_object_without_properties(_param,["element","form"]),children=(0,ui.$I)(element),primaryChildIndex=getPrimaryChildElementIndex(children),child=children[primaryChildIndex];switch(child.type){case"FileInput":return{element:"SnapUIFileInput",props:{name:child.props.name,accept:child.props.accept,compact:child.props.compact,label:element.props.label,form:form,error:void 0!==element.props.error,helpText:element.props.error}};case"Input":var rightAccessoryIndex,accessoryIndex,leftAccessoryMapped=primaryChildIndex>0?mapToTemplate(field_object_spread_props(field_object_spread({},params),{element:children[0]})):void 0;children[2]?rightAccessoryIndex=2:0===primaryChildIndex&&children[1]&&(rightAccessoryIndex=1);var rightAccessoryMapped=rightAccessoryIndex?(accessoryIndex=rightAccessoryIndex,mapToTemplate(field_object_spread_props(field_object_spread({},params),{element:children[accessoryIndex]}))):void 0;return{element:"SnapUIInput",props:field_object_spread_props(field_object_spread({id:child.props.name,placeholder:child.props.placeholder,label:element.props.label},constructInputProps(child.props)),{name:child.props.name,form:form,error:void 0!==element.props.error,helpText:element.props.error}),propComponents:{startAccessory:leftAccessoryMapped&&field_object_spread_props(field_object_spread({},leftAccessoryMapped),{props:field_object_spread_props(field_object_spread({},leftAccessoryMapped.props),{padding:0})}),endAccessory:rightAccessoryMapped&&field_object_spread_props(field_object_spread({},rightAccessoryMapped),{props:field_object_spread_props(field_object_spread({},rightAccessoryMapped.props),{padding:0})})}};case"Dropdown":return{element:"SnapUIDropdown",props:field_object_spread_props(field_object_spread({},dropdown_dropdown({element:child}).props),{id:child.props.name,label:element.props.label,name:child.props.name,form:form,error:element.props.error})};case"RadioGroup":return{element:"SnapUIRadioGroup",props:field_object_spread_props(field_object_spread({},radioGroup_radioGroup({element:child}).props),{id:child.props.name,label:element.props.label,name:child.props.name,form:form,error:element.props.error})};case"Checkbox":return{element:"SnapUICheckbox",props:field_object_spread_props(field_object_spread({},checkbox_checkbox({element:child}).props),{fieldLabel:element.props.label,form:form,error:element.props.error})};case"Selector":var selectorMapped=selector_selector(field_object_spread_props(field_object_spread({},params),{element:child}));return field_object_spread_props(field_object_spread({},selectorMapped),{element:"SnapUISelector",props:field_object_spread_props(field_object_spread({},selectorMapped.props),{label:element.props.label,form:form,error:element.props.error})});default:throw Error("Invalid Field child: ".concat(child.type))}},Dropdown:dropdown_dropdown,RadioGroup:radioGroup_radioGroup,Value:function(param){var element=param.element;return{element:"ConfirmInfoRowValueDouble",props:{left:element.props.extra,right:element.props.value}}},Checkbox:checkbox_checkbox,Tooltip:function(_param){var element=_param.element,params=tooltip_object_without_properties(_param,["element"]);return{element:"SnapUITooltip",children:(0,ui.$I)(element).map(function(children){return mapToTemplate(tooltip_object_spread({element:children},params))}),propComponents:{content:mapToTemplate(tooltip_object_spread({element:"string"==typeof element.props.content?(0,Text.E)({children:element.props.content}):element.props.content},params))}}},Card:function(_param){var element=_param.element,params=card_object_without_properties(_param,["element"]);return"string"!=typeof element.props.title?{element:"SnapUICard",props:{image:element.props.image,description:element.props.description,value:element.props.value,extra:element.props.extra},propComponents:{title:mapToTemplate(card_object_spread({element:element.props.title},params))}}:{element:"SnapUICard",props:{image:element.props.image,title:element.props.title,description:element.props.description,value:element.props.value,extra:element.props.extra}}},Footer:function(_param){var element=_param.element,t=_param.t,onCancel=_param.onCancel,params=footer_object_without_properties(_param,["element","t","onCancel"]),defaultButtons=getDefaultButtons(element,t,onCancel),providedChildren=(0,ui.$I)(element),footerChildren=providedChildren.map(function(children,index){var _buttonMapped_props,_buttonMapped_props_name,buttonMapped=button_button(footer_object_spread_props(footer_object_spread({},params),{element:children}));return{element:"SnapUIFooterButton",key:"snap-footer-button-".concat(null!==(_buttonMapped_props_name=null===(_buttonMapped_props=buttonMapped.props)||void 0===_buttonMapped_props?void 0:_buttonMapped_props.name)&&void 0!==_buttonMapped_props_name?_buttonMapped_props_name:index),props:footer_object_spread_props(footer_object_spread({},buttonMapped.props),{variant:2===providedChildren.length&&0===index?component_library.Ak.Secondary:component_library.Ak.Primary,isSnapAction:!0}),children:buttonMapped.children}});return defaultButtons&&footerChildren.unshift(defaultButtons),footer_object_spread_props(footer_object_spread({},DEFAULT_FOOTER),{children:footerChildren})},Container:function(_param){var element=_param.element,useFooter=_param.useFooter,onCancel=_param.onCancel,promptLegacyProps=_param.promptLegacyProps,t=_param.t,params=container_object_without_properties(_param,["element","useFooter","onCancel","promptLegacyProps","t"]),children=(0,ui.$I)(element);useFooter||2!==children.length||children.pop();var templateChildren=children.map(function(child){return mapToTemplate(container_object_spread_props(container_object_spread({useFooter:useFooter,onCancel:onCancel,t:t},params),{element:child}))});return promptLegacyProps&&templateChildren.push({element:"FormTextField",key:"snap-prompt-input",props:{marginLeft:4,marginRight:4,className:"snap-prompt-input",value:promptLegacyProps.inputValue,onChange:promptLegacyProps.onInputChange,placeholder:promptLegacyProps.placeholder,maxLength:300}}),useFooter&&onCancel&&!children[1]&&templateChildren.push(container_object_spread_props(container_object_spread({},DEFAULT_FOOTER),{props:container_object_spread_props(container_object_spread({},DEFAULT_FOOTER.props),{className:"snap-ui-renderer__footer-centered"}),children:{element:"SnapUIFooterButton",key:"default-button",props:{onCancel:onCancel,isSnapAction:!1},children:t("close")}})),{element:"Box",children:templateChildren,props:{display:design_system.nl.Flex,flexDirection:design_system.bo.Column,height:design_system.Zf.Full,className:"snap-ui-renderer__container",style:{overflowY:"auto",paddingBottom:useFooter?"80px":"initial"}}}},Selector:selector_selector,Section:function(_param){var _box=box(section_object_spread({element:_param.element},section_object_without_properties(_param,["element"])));return{element:"Box",children:_box.children,props:section_object_spread_props(section_object_spread({},_box.props),{className:"snap-ui-renderer__section",padding:4,gap:2,backgroundColor:design_system.i0.backgroundDefault,borderRadius:design_system.Z6.LG})}}};function utils_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function utils_object_spread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))),ownKeys.forEach(function(key){utils_define_property(target,key,source[key])})}return target}function utils_ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function utils_object_spread_props(target,source){return source=null!=source?source:{},Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):utils_ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}),target}function getChildrenForHash(component){if(!(0,ui.Go)(component))return null;var children=component.props.children;return"string"==typeof children?children.slice(0,5e3):Array.isArray(children)?children.map(function(child){var _child_type;return{type:null!==(_child_type=null==child?void 0:child.type)&&void 0!==_child_type?_child_type:null}}):children}var generateHash=(0,lodash.memoize)(function(component){var type=component.type,name=component.props.name,children=getChildrenForHash(component);return(0,hex.nF)((0,bytes.My)((0,sha256.sc)(JSON.stringify({type:type,name:null!=name?name:null,children:children}))))});function generateKey(map,component){var _map_hash,hash=generateHash(component),count=(null!==(_map_hash=map[hash])&&void 0!==_map_hash?_map_hash:0)+1;return map[hash]=count,"".concat(hash,"_").concat(count)}var mapToTemplate=function(params){var _params_element=params.element,type=_params_element.type,key=_params_element.key,elementKey=null!=key?key:generateKey(params.map,params.element);return utils_object_spread_props(utils_object_spread({},COMPONENT_MAPPING[type](params)),{key:elementKey})},mapTextToTemplate=function(elements,params){return elements.map(function(element){return"string"==typeof element?(0,he.unescape)(element):mapToTemplate(utils_object_spread_props(utils_object_spread({},params),{element:element}))})},FIELD_ELEMENT_TYPES=["FileInput","Input","Dropdown","RadioGroup","Checkbox","Selector"],getPrimaryChildElementIndex=function(children){return children.findIndex(function(c){return FIELD_ELEMENT_TYPES.includes(c.type)})},SnapUIRendererComponent=function(param){var snapId=param.snapId,_param_delineatorType=param.delineatorType,delineatorType=void 0===_param_delineatorType?snaps.cJ.Content:_param_delineatorType,_param_isCollapsable=param.isCollapsable,_param_isCollapsed=param.isCollapsed,_param_isLoading=param.isLoading,_param_isPrompt=param.isPrompt,isPrompt=void 0!==_param_isPrompt&&_param_isPrompt,inputValue=param.inputValue,onInputChange=param.onInputChange,placeholder=param.placeholder,onClick=param.onClick,boxProps=param.boxProps,interfaceId=param.interfaceId,_param_useDelineator=param.useDelineator,_param_useFooter=param.useFooter,useFooter=void 0!==_param_useFooter&&_param_useFooter,onCancel=param.onCancel,contentBackgroundColor=param.contentBackgroundColor,t=(0,useI18nContext.P)(),snapName=(0,es.d4)(function(state){return(0,selectors.oeg)(state,snapId)}).name,interfaceState=(0,es.d4)(function(state){return(0,selectors.yhN)(state,interfaceId)},function(oldState,newState){return(0,lodash.isEqual)(oldState.content,newState.content)}),rawContent=null==interfaceState?void 0:interfaceState.content,content=(null==rawContent?void 0:rawContent.type)!=="Container"&&rawContent?(0,Container.m)({children:rawContent}):rawContent,promptLegacyProps=(0,react.useMemo)(function(){return isPrompt&&{inputValue:inputValue,onInputChange:onInputChange,placeholder:placeholder}},[inputValue,onInputChange,placeholder,isPrompt]),sections=(0,react.useMemo)(function(){return content&&mapToTemplate({map:{},element:content,onCancel:onCancel,useFooter:useFooter,promptLegacyProps:promptLegacyProps,t:t})},[content,onCancel,useFooter,promptLegacyProps,t]);if(void 0!==_param_isLoading&&_param_isLoading||!content)return react.createElement(component_library.az,{display:design_system.nl.Flex,justifyContent:design_system.A9.center,alignItems:design_system.k2.center,height:design_system.Zf.Full,width:design_system.Zf.Full},react.createElement(pulse_loader.A,null));var initialState=interfaceState.state,context=interfaceState.context;return void 0===_param_useDelineator||_param_useDelineator?react.createElement(snap_delineator.Q,{snapName:snapName,type:delineatorType,isCollapsable:void 0!==_param_isCollapsable&&_param_isCollapsable,isCollapsed:void 0!==_param_isCollapsed&&_param_isCollapsed,onClick:onClick,boxProps:boxProps,disablePadding:!0},react.createElement(component_library.az,{className:"snap-ui-renderer__content"},react.createElement(contexts_snaps.QU,{snapId:snapId,interfaceId:interfaceId,initialState:initialState,context:context},react.createElement(metamask_template_renderer.A,{sections:sections})))):react.createElement(contexts_snaps.QU,{snapId:snapId,interfaceId:interfaceId,initialState:initialState,context:context},react.createElement(component_library.az,{className:"snap-ui-renderer__content",height:design_system.Zf.Full,backgroundColor:contentBackgroundColor},react.createElement(metamask_template_renderer.A,{sections:sections})))},SnapUIRenderer=(0,react.memo)(SnapUIRendererComponent,function(prevProps,nextProps){return(0,lodash.isEqual)(prevProps,nextProps)});SnapUIRendererComponent.propTypes={snapId:prop_types_default().string,delineatorType:prop_types_default().string,isCollapsable:prop_types_default().bool,isCollapsed:prop_types_default().bool,isLoading:prop_types_default().bool,isPrompt:prop_types_default().bool,inputValue:prop_types_default().string,onInputChange:prop_types_default().func,placeholder:prop_types_default().string,onClick:prop_types_default().func,boxProps:prop_types_default().object,interfaceId:prop_types_default().string,useDelineator:prop_types_default().bool,useFooter:prop_types_default().bool,onCancel:prop_types_default().func,contentBackgroundColor:prop_types_default().string},SnapUIRendererComponent.__docgenInfo={description:"",methods:[],displayName:"SnapUIRendererComponent",props:{delineatorType:{defaultValue:{value:"DelineatorType.Content",computed:!0},description:"",type:{name:"string"},required:!1},isCollapsable:{defaultValue:{value:"false",computed:!1},description:"",type:{name:"bool"},required:!1},isCollapsed:{defaultValue:{value:"false",computed:!1},description:"",type:{name:"bool"},required:!1},isLoading:{defaultValue:{value:"false",computed:!1},description:"",type:{name:"bool"},required:!1},isPrompt:{defaultValue:{value:"false",computed:!1},description:"",type:{name:"bool"},required:!1},useDelineator:{defaultValue:{value:"true",computed:!1},description:"",type:{name:"bool"},required:!1},useFooter:{defaultValue:{value:"false",computed:!1},description:"",type:{name:"bool"},required:!1},snapId:{description:"",type:{name:"string"},required:!1},inputValue:{description:"",type:{name:"string"},required:!1},onInputChange:{description:"",type:{name:"func"},required:!1},placeholder:{description:"",type:{name:"string"},required:!1},onClick:{description:"",type:{name:"func"},required:!1},boxProps:{description:"",type:{name:"object"},required:!1},interfaceId:{description:"",type:{name:"string"},required:!1},onCancel:{description:"",type:{name:"func"},required:!1},contentBackgroundColor:{description:"",type:{name:"string"},required:!1}}}},"./ui/components/ui/pulse-loader/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_pulse_loader__WEBPACK_IMPORTED_MODULE_0__.A});var _pulse_loader__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./ui/components/ui/pulse-loader/pulse-loader.js")}}]);