text: /*!
   * OpenUI5
   * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
   * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
   */
  sap.ui.define(["sap/ui/core/XMLComposite","./library","sap/ui/core/Item"],function(e,t,i){"use strict";var r=e.extend("sap.m.MultiEditField",{metadata:{interfaces:["sap.ui.core.IFormContent"],library:"sap.m",properties:{selectedItem:{type:"sap.ui.core.Item",group:"Data",defaultValue:null,invalidate:true},showValueHelp:{type:"boolean",group:"Behavior",defaultValue:true,invalidate:true},nullable:{type:"boolean",group:"Behavior",defaultValue:true,invalidate:true},required:{type:"boolean",group:"Behavior",defaultValue:false,invalidate:true}},aggregations:{items:{type:"sap.ui.core.Item",multiple:true,bindable:"bindable"}},associations:{ariaLabelledBy:{type:"sap.ui.core.Control",multiple:true,singularName:"ariaLabelledBy"}},events:{change:{parameters:{selectedItem:{type:"sap.ui.core.Item"}}}}}});r.prototype.init=function(){if(!r.prototype._oRb){r.prototype._oRb=sap.ui.getCore().getLibraryResourceBundle("sap.m")}var e=new i({key:"keep",text:"< "+this._oRb.getText("MULTI_EDIT_KEEP_TEXT")+" >"}),t=new i({key:"blank",text:"< "+this._oRb.getText("MULTI_EDIT_BLANK_TEXT")+" >"}),s=new i({key:"new",text:"< "+this._oRb.getText("MULTI_EDIT_NEW_TEXT")+" >"});this._getKeepAll=function(){return e};this._getBlank=function(){return t};this._getValueHelp=function(){return s};this.byId("select").getParent=this.getParent.bind(this);this._oLastSelectedItem=this._getKeepAll()};r.prototype.onBeforeRendering=function(){this.insertAggregation("items",this._getKeepAll(),0,true);if(this.getNullable()){this.insertAggregation("items",this._getBlank(),1,true)}else{this.removeAggregation("items",this._getBlank(),true)}if(this.getShowValueHelp()){this.insertAggregation("items",this._getValueHelp(),this.getNullable()?2:1,true)}else{this.removeAggregation("items",this._getValueHelp(),true)}var e=this.getSelectedItem();if(e){e=this._getInternalItem(e);this.byId("select").setSelectedItem(e)}};r.prototype.setSelectedItem=function(e){var t=this._getExternalItem(e)||e;var i;if(t&&this.indexOfItem(t)>=0&&!this._isSpecialValueItem(t)){i=this._getInternalItem(e);if(i){this.byId("select").setSelectedItem(i)}this._oLastSelectedItem=t;return this.setProperty("selectedItem",t)}return this};r.prototype.exit=function(){this._getKeepAll().destroy();this._getBlank().destroy();this._getValueHelp().destroy();var e=this.byId("itemTemplate");if(e){e.destroy()}};r.prototype.getFormDoNotAdjustWidth=function(){return true};r.prototype.isBlankSelected=function(){return this._getExternalItem(this.byId("select").getSelectedItem())===this._getBlank()};r.prototype.isKeepExistingSelected=function(){return this._getExternalItem(this.byId("select").getSelectedItem())===this._getKeepAll()};r.prototype._isSpecialValueItem=function(e){return e===this._getKeepAll()||e===this._getBlank()||e===this._getValueHelp()};r.prototype._handleSelectionChange=function(e){var t=this._getExternalItem(e.getParameter("selectedItem"));if(t&&!this._isSpecialValueItem(t)){this.fireChange({selectedItem:t})}else if(t===this._getValueHelp()){this.fireEvent("_valueHelpRequest")}if(t!==this._getValueHelp()){this._oLastSelectedItem=t;this.setProperty("selectedItem",t,true)}};r.prototype.resetSelection=function(){this.byId("select").setSelectedItem(this._getInternalItem(this._oLastSelectedItem))};r.prototype._getExternalItem=function(e){var t=this.byId("select").indexOfItem(e);if(t>=0){return this.getItems()[t]}return null};r.prototype._getInternalItem=function(e){var t=this.indexOfItem(e);if(t>=0){return this.byId("select").getItems()[t]}return null};r.prototype._getInternalDomRef=function(){var e=this.byId("select");return e&&e.getDomRef()};r.prototype._getInternalUIArea=function(){return this.byId("select").getUIArea()};return r});