"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,o)=>{for(var n in o)__defProp(e,n,{get:o[n],enumerable:!0})},__copyProps=(e,o,n,r)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let t of __getOwnPropNames(o))__hasOwnProp.call(e,t)||t===n||__defProp(e,t,{get:()=>o[t],enumerable:!(r=__getOwnPropDesc(o,t))||r.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),downloads_menu_exports={};__export(downloads_menu_exports,{DownloadsMenu:()=>DownloadsMenu}),module.exports=__toCommonJS(downloads_menu_exports);var import_components=require("@wordpress/components"),import_element=require("@wordpress/element"),import_i18n=require("@wordpress/i18n"),import_icons=require("@wordpress/icons"),import_insert_url_menu_item=require("../insert-url-menu-item"),import_upload_files_menu_item=require("../upload-files-menu-item");function DownloadsMenu({allowedTypes:e,maxUploadFileSize:o,onUploadSuccess:n,onUploadError:r,onLinkError:t}){return(0,import_element.createElement)(import_components.Dropdown,{popoverProps:{placement:"bottom-end"},contentClassName:"woocommerce-downloads-menu__menu-content",renderToggle:({isOpen:e,onToggle:o})=>(0,import_element.createElement)(import_components.Button,{"aria-expanded":e,icon:e?import_icons.chevronUp:import_icons.chevronDown,variant:"secondary",onClick:o,className:"woocommerce-downloads-menu__toggle"},(0,import_element.createElement)("span",null,(0,import_i18n.__)("Add new","woocommerce"))),renderContent:({onClose:m})=>(0,import_element.createElement)("div",{className:"components-dropdown-menu__menu"},(0,import_element.createElement)(import_components.MenuGroup,null,(0,import_element.createElement)(import_upload_files_menu_item.UploadFilesMenuItem,{allowedTypes:e,maxUploadFileSize:o,onUploadSuccess:e=>{n(e),m()},onUploadError:e=>{r(e),m()}}),(0,import_element.createElement)(import_insert_url_menu_item.InsertUrlMenuItem,{onLinkSuccess:e=>{n(e),m()},onLinkError:e=>{t(e),m()}})))})}