text: /*!
   * OpenUI5
   * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
   * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
   */
  sap.ui.define(['../base/ManagedObject',"sap/base/assert"],function(M,a){"use strict";var C={};var N=["sap.ui.comp.navpopover.SmartLink","sap.m.Link","sap.m.Label","sap.m.Text"];function t(i,I){if(!i){return null;}var o=sap.ui.getCore().byId(i);if(o&&I&&(!o.isA('sap.ui.core.Control')||o.getDomRef())){o.invalidate();}return o;}function f(l){var i=l.getLabelFor()||l._sAlternativeId||'';return i;}function r(l,D){var s=l.getId();var o=l.__sLabeledControl;var n=D?null:f(l);if(o==n){return;}if(!D){l.invalidate();}if(n){l.__sLabeledControl=n;}else{delete l.__sLabeledControl;}var e;if(o){e=C[o];if(e){e=e.filter(function(h){return h!=s;});if(e.length){C[o]=e;}else{delete C[o];}}}if(n){e=C[n]||[];e.push(s);C[n]=e;}var O=t(o,true);var g=t(n,true);if(O){l.detachRequiredChange(O);}if(g){l.attachRequiredChange(g);}}function c(o){if(!o){throw new Error("sap.ui.core.LabelEnablement cannot enrich null");}var m=o.getMetadata();if(!m.isInstanceOf("sap.ui.core.Label")){throw new Error("sap.ui.core.LabelEnablement only supports Controls with interface sap.ui.core.Label");}var l=m.getAssociation("labelFor");if(!l||l.multiple){throw new Error("sap.ui.core.LabelEnablement only supports Controls with a to-1 association 'labelFor'");}}function b(o){if(!o){return true;}var n=o.getMetadata().getName();return N.indexOf(n)<0;}var L={};L.writeLabelForAttribute=function(R,l){if(!l||!l.getLabelForRendering){return;}var s=l.getLabelForRendering();if(!s){return;}var o=t(s);if(o&&o.getIdForLabel){s=o.getIdForLabel();}if(s&&b(o)){R.attr("for",s);}};L.getReferencingLabels=function(e){var i=e?e.getId():null;if(!i){return[];}return C[i]||[];};L.isRequired=function(e){if(d(e)){return true;}var l=L.getReferencingLabels(e),o;for(var i=0;i<l.length;i++){o=sap.ui.getCore().byId(l[i]);if(d(o)){return true;}}return false;};function d(e){return!!(e&&e.getRequired&&e.getRequired());}L.enrich=function(o){c(o);o.__orig_setLabelFor=o.setLabelFor;o.setLabelFor=function(i){var e=this.__orig_setLabelFor.apply(this,arguments);r(this);return e;};o.__orig_exit=o.exit;o.exit=function(){this._sAlternativeId=null;r(this,true);if(o.__orig_exit){o.__orig_exit.apply(this,arguments);}};o.setAlternativeLabelFor=function(i){if(i instanceof M){i=i.getId();}else if(i!=null&&typeof i!=="string"){a(false,"setAlternativeLabelFor(): sId must be a string, an instance of sap.ui.base.ManagedObject or null");return this;}this._sAlternativeId=i;r(this);return this;};o.getLabelForRendering=function(){var i=this.getLabelFor()||this._sAlternativeId;var o=t(i);return b(o)?i:"";};if(!o.getMetadata().getProperty("required")){return;}o.__orig_setRequired=o.setRequired;o.setRequired=function(R){var O=this.getRequired(),e=this.__orig_setRequired.apply(this,arguments);if(this.getRequired()!==O){t(this.__sLabeledControl,true);}return e;};o.isRequired=function(){var F=t(this.getLabelForRendering(),false);return d(this)||d(F);};o.isDisplayOnly=function(){if(this.getDisplayOnly){return this.getDisplayOnly();}else{return false;}};o.isWrapping=function(){if(this.getWrapping){return this.getWrapping();}else{return false;}};o.disableRequiredChangeCheck=function(n){this._bNoRequiredChangeCheck=n;};o.attachRequiredChange=function(F){if(F&&!this._bNoRequiredChangeCheck){if(F.getMetadata().getProperty("required")){F.attachEvent("_change",_,this);}this._bRequiredAttached=true;}};o.detachRequiredChange=function(F){if(F&&!this._bNoRequiredChangeCheck){if(F.getMetadata().getProperty("required")){F.detachEvent("_change",_,this);}this._bRequiredAttached=false;}};function _(e){if(e.getParameter("name")=="required"){this.invalidate();}}o.__orig_onAfterRendering=o.onAfterRendering;o.onAfterRendering=function(e){var g;if(this.__orig_onAfterRendering){g=this.__orig_onAfterRendering.apply(this,arguments);}if(!this._bNoRequiredChangeCheck&&!this._bRequiredAttached&&this.__sLabeledControl){var F=t(this.__sLabeledControl,false);this.attachRequiredChange(F);}return g;};};return L;},true);
  