export default class ActionRegistry{constructor(){this._actionsById=new Map();this._registerActions();} _registerActions(){self.runtime.extensions('action').forEach(registerExtension,this);function registerExtension(extension){if(!extension.canInstantiate()){return;} const actionId=extension.descriptor()['actionId'];console.assert(actionId);console.assert(!this._actionsById.get(actionId));const action=new UI.Action(extension);if(!action.category()||action.title()){this._actionsById.set(actionId,action);}else{console.error(`Category actions require a title for command menu: ${actionId}`);}}} availableActions(){return this.applicableActions(this._actionsById.keysArray(),UI.context);} applicableActions(actionIds,context){const extensions=[];actionIds.forEach(function(actionId){const action=this._actionsById.get(actionId);if(action){extensions.push(action.extension());}},this);return context.applicableExtensions(extensions).valuesArray().map(extensionToAction.bind(this));function extensionToAction(extension){return(this.action(extension.descriptor()['actionId']));}} action(actionId){return this._actionsById.get(actionId)||null;}} self.UI=self.UI||{};UI=UI||{};UI.ActionRegistry=ActionRegistry;UI.actionRegistry;