text: /*!
   * OpenUI5
   * (c) Copyright 2009-2020 SAP SE or an SAP affiliate company.
   * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
   */
  sap.ui.define(["sap/ui/thirdparty/jquery","sap/ui/core/Control","sap/ui/integration/util/Manifest","sap/base/Log","sap/ui/integration/WidgetRenderer","sap/base/util/LoaderExtensions","sap/ui/core/ComponentContainer"],function(q,C,W,L,a,b,c){"use strict";var M={APP_TYPE:"/sap.app/type",PARAMS:"/sap.widget/configuration/parameters"};var d=C.extend("sap.ui.integration.Widget",{metadata:{library:"sap.ui.integration",properties:{manifest:{type:"any",defaultValue:""},parameters:{type:"object",defaultValue:null},baseUrl:{type:"string",defaultValue:""}},aggregations:{_content:{type:"sap.ui.core.Control",multiple:false,visibility:"hidden"}},events:{action:{parameters:{actionSource:{type:"sap.ui.core.Control"},manifestParameters:{type:"object"}}},manifestReady:{parameters:{}}}},renderer:a});d.prototype.init=function(){this.setBusyIndicatorDelay(0);};d.prototype.onBeforeRendering=function(){if(this._bApplyManifest){this._bApplyManifest=false;var m=this.getManifest();if(!m){this.destroyManifest();}else{this.createManifest(m,this.getBaseUrl());}}};d.prototype.exit=function(){this.destroyManifest();};d.prototype.destroyManifest=function(){if(this._oWidgetManifest){this._oWidgetManifest.destroy();this._oWidgetManifest=null;}this.destroyAggregation("_content");};d.prototype.setManifest=function(v){this.setProperty("manifest",v);this._bApplyManifest=true;return this;};d.prototype.setParameters=function(v){this.setProperty("parameters",v);this._bApplyManifest=true;return this;};d.prototype.getManifest=function(){var v=this.getProperty("manifest");if(v&&typeof v==="object"){return q.extend(true,{},v);}return v;};d.prototype.createManifest=function(m,B){var o={};if(typeof m==="string"){o.manifestUrl=m;m=null;}o.processI18n=false;this.setBusy(true);this._oWidgetManifest=new W("sap.widget",m,B);return this._oWidgetManifest.load(o).then(function(){this.fireManifestReady();this._applyManifest();}.bind(this)).catch(this._applyManifest.bind(this));};d.prototype.getParameters=function(){var v=this.getProperty("parameters");if(v&&typeof v==="object"){return q.extend(true,{},v);}return v;};d.prototype._applyManifest=function(){var p=this.getParameters(),A=this._oWidgetManifest.get(M.APP_TYPE);if(A&&A!=="widget"){L.error("sap.app/type entry in manifest is not 'widget'");}this._registerManifestModulePath();this._oWidgetManifest.processParameters(p);return this._createComponent(this._oWidgetManifest.getJson(),this.getBaseUrl());};d.prototype._registerManifestModulePath=function(){if(!this._oWidgetManifest){return;}var A=this._oWidgetManifest.get("/sap.app/id");if(A){b.registerResourcePath(A.replace(/\./g,"/"),this._oWidgetManifest.getUrl());}else{L.error("Widget sap.app/id entry in the manifest is mandatory");}};d.prototype._createComponent=function(m,B){var o={manifest:m};if(B){o.url=B;o.altManifestUrl=B;}return sap.ui.core.Component.load(o).then(function(e){var f=new c({component:e().getId()});f.attachEvent("action",function(E){this.fireEvent("action",{actionSource:E.getParameter("actionSource"),manifestParameters:E.getParameter("manifestParameters")});}.bind(this));this.setAggregation("_content",f);this.setBusy(false);this.fireEvent("_ready");}.bind(this));};d.prototype.loadDesigntime=function(){if(!this._oWidgetManifest){return Promise.reject("Manifest not yet available");}var A=this._oWidgetManifest.get("/sap.app/id");if(!A){return Promise.reject("App id not maintained");}var m=A.replace(/\./g,"/");return new Promise(function(r,e){var s=m+"/"+(this._oWidgetManifest.get("/sap.widget/designtime")||"designtime/Widget.designtime");if(s){sap.ui.require([s,"sap/base/util/deepClone"],function(D,f){r({designtime:D,manifest:f(this._oWidgetManifest.oJson,30)});}.bind(this),function(){e({error:s+" not found"});});}else{e();}}.bind(this));};return d;});
  