UNPKG

@sap/generator-fiori

Version:

Create an SAPUI5 application using SAP Fiori elements or a freestyle approach

1 lines 103 kB
"use strict";exports.id=7971,exports.ids=[7971],exports.modules={31061(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.generateActionMenu=async function generateActionMenu(e,t,n){(0,r.validateVersion)(t.minUI5Version),n||(n=(0,o.create)((0,i.create)()));await(0,r.validateBasePath)(e,n);const{path:p,content:d}=await(0,c.getManifest)(e,n);if(t.target.menuId){const e=function getExistingMenuItemsContainer(e,t){const n=e["sap.ui5"].routing.targets[t.page];if(t.control===u.TargetControl.header)return n.options.settings.content[t.control].actions;if(t.control===u.TargetControl.body&&t.customSectionKey)return n.options.settings.content[t.control].sections[t.customSectionKey].actions;{const e=t.navProperty?t.navProperty+"/":"",i=t.qualifier?"#"+t.qualifier:"",o=`${e}${t.control}${i}`;return n.options.settings.controlConfiguration[o].actions}}(d,t.target);e[t.target.menuId].menu.push(...t.settings.actions)}else{const e=(0,g.enhanceManifestAndGetActionsElementReference)(d,t.target);Object.assign(e,JSON.parse((0,a.render)(n.read((0,s.getTemplatePath)("action/manifest.action-menu.json")),t,{})));for(const{key:n,position:i}of t.positionUpdates??[]){if(["__proto__","constructor","prototype"].includes(n))continue;const t=e[n];t&&(t.position=i,i||delete t.position)}}return n.writeJSON(p,d,void 0,(0,l.getJsonSpace)(n,p,t.tabInfo)),n};const i=n(64812),o=n(90718),a=n(29473),r=n(31376),s=n(27099),l=n(51048),c=n(96929),g=n(71767),u=n(4220)},4220(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TargetControl=void 0,function(e){e.header="header",e.body="body",e.section="@com.sap.vocabularies.UI.v1.FieldGroup",e.table="@com.sap.vocabularies.UI.v1.LineItem"}(n||(t.TargetControl=n={}))},71767(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.enhanceManifestAndGetActionsElementReference=enhanceManifestAndGetActionsElementReference,t.generateCustomAction=async function generateCustomAction(e,t,n){(0,s.validateVersion)(t.minUI5Version),n||(n=(0,o.create)((0,i.create)()));await(0,s.validateBasePath)(e,n);const{path:a,content:d}=await(0,p.getManifest)(e,n),m=function enhanceConfig(e,t,n){const i={...e,target:{...e.target},settings:{...e.settings}};return(0,l.setCommonDefaults)(i,t,n),i.settings.enabled=i.settings.enabled||!0,i.settings.visible=i.settings.visible||!0,i}(t,a,d);m.eventHandler&&(m.eventHandler=(0,c.applyEventHandlerConfiguration)(n,m,m.eventHandler,{controllerSuffix:!1,typescript:m.typescript},[c.contextParameter,c.selectedContextsParameter]));const f=enhanceManifestAndGetActionsElementReference(d,m.target);Object.assign(f,JSON.parse((0,r.render)(n.read((0,g.getTemplatePath)("action/manifest.action.json")),m,{}))),m.target.menuId&&f[m.target.menuId].menu.push(m.name);return n.writeJSON(a,d,void 0,(0,u.getJsonSpace)(n,a,t.tabInfo)),n};const i=n(64812),o=n(90718),a=n(14318),r=n(29473),s=n(31376),l=n(99644),c=n(78193),g=n(27099),u=n(51048),p=n(96929);function enhanceManifestAndGetActionsElementReference(e,t){const n=e["sap.ui5"].routing.targets[t.page];if(n.options=n.options||{},n.options.settings=n.options.settings||{},t.control===a.TargetControl.header||t.control===a.TargetControl.footer)return n.options.settings.content=n.options.settings.content||{},n.options.settings.content[t.control]=n.options.settings.content[t.control]||{},n.options.settings.content[t.control].actions=n.options.settings.content[t.control].actions||{},n.options.settings.content[t.control].actions;if(t.control===a.TargetControl.body&&t.customSectionKey)return n.options.settings.content=n.options.settings.content||{},n.options.settings.content[t.control]=n.options.settings.content[t.control]||{},n.options.settings.content[t.control].sections=n.options.settings.content[t.control].sections||{},n.options.settings.content[t.control].sections[t.customSectionKey]=n.options.settings.content[t.control].sections[t.customSectionKey]||{},n.options.settings.content[t.control].sections[t.customSectionKey].actions=n.options.settings.content[t.control].sections[t.customSectionKey].actions||{},n.options.settings.content[t.control].sections[t.customSectionKey].actions;{const e=t.navProperty?t.navProperty+"/":"",i=t.qualifier?"#"+t.qualifier:"",o=`${e}${t.control}${i}`;return n.options.settings.controlConfiguration=n.options.settings.controlConfiguration||{},n.options.settings.controlConfiguration[o]=n.options.settings.controlConfiguration[o]||{},n.options.settings.controlConfiguration[o].actions=n.options.settings.controlConfiguration[o].actions||{},n.options.settings.controlConfiguration[o].actions}}},14318(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TargetControl=void 0,function(e){e.header="header",e.body="body",e.footer="footer",e.section="@com.sap.vocabularies.UI.v1.FieldGroup",e.table="@com.sap.vocabularies.UI.v1.LineItem"}(n||(t.TargetControl=n={}))},82800(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.MIN_VERSION=void 0,t.enableFPM=async function enableFPM(e,n={},p){p||(p=(0,o.create)((0,i.create)()));const{path:d,content:m}=await(0,g.getManifest)(e,p);m["sap.ui5"]?.dependencies?.libs?.["sap.fe.templates"]||p.extendJSON(d,{"sap.ui5":{dependencies:{libs:{"sap.fe.templates":{}}}}});(function adaptMinUI5Version(e,n,i){const o=(0,s.getMinUI5VersionAsArray)(e,!0);if(o?.length>0){let e=!1;for(let n=0;n<o.length;n++){const i=o[n];i&&(0,r.valid)(i)&&(0,r.lt)(i,t.MIN_VERSION)&&(o[n]=t.MIN_VERSION,e=!0)}e&&(1===o.length?n.extendJSON(i,{"sap.ui5":{dependencies:{minUI5Version:o[0]}}}):o.length>1&&n.extendJSON(i,{"sap.ui5":{dependencies:{minUI5Version:o}}}))}})(m,p,d),n.typescript&&(0,g.addExtensionTypes)(e,(0,s.getMinimumUI5Version)(m),p);n.fcl&&p.extendJSON(d,{"sap.ui5":{rootView:{viewName:"sap.fe.templates.RootContainer.view.Fcl",type:"XML",async:!0,id:"appRootView"},routing:{config:{routerClass:l.FCL_ROUTER}}}});if(n.replaceAppComponent){const t=n.typescript?"ts":"js",i=(0,c.getTemplatePath)(`/app/Component.${t}`);(0,u.copyTpl)(p,i,(0,a.join)(e,`webapp/Component.${t}`),m["sap.app"])}return p};const i=n(64812),o=n(90718),a=n(76760),r=n(85263),s=n(20787),l=n(99644),c=n(27099),g=n(96929),u=n(51048);t.MIN_VERSION="1.94.0"},78549(e,t,n){var i,o=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||(i=function(e){return i=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},i(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=i(e),r=0;r<n.length;r++)"default"!==n[r]&&o(t,e,n[r]);return a(t,e),t}),s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.generateBuildingBlock=async function generateBuildingBlock(e,t,n){const{viewOrFragmentPath:i,aggregationPath:o,buildingBlockData:a,allowAutoAddDependencyLib:r=!0}=t;n??=(0,c.create)((0,l.create)()),await(0,y.validateBasePath)(e,n,[]);const s=t.buildingBlockData.generateId??await(0,B.createIdGenerator)({basePath:e,fsEditor:n});if(!n.exists((0,p.join)(e,i)))throw new Error(`Invalid view path ${i}.`);const{path:g,content:b}=await(0,T.getManifest)(e,n),v=getUI5XmlDocument(e,i,n),{updatedAggregationPath:w,processedBuildingBlockData:E,hasAggregation:k,aggregationNamespace:I}=(0,x.processBuildingBlock)({...a,generateId:s},v,g,b,o,n),S=function getTemplateDocument(e,t,n,i,o){const a=getTemplateContent(e,t,i,n,void 0,o),errorHandler=(e,t)=>{throw new Error(`Unable to parse template file with building block data. Details: [${e}] - ${t}`)};let r;try{r=new d.DOMParser({errorHandler}).parseFromString(a,"text/xml")}catch(e){throw new Error(`Unable to parse template file with building block data. Details: ${(0,y.getErrorMessage)(e)}`)}return r}({...E,generateId:s},v,n,b,{hasAggregation:k,aggregationNamespace:I});if(a.buildingBlockType===P.BuildingBlockType.RichTextEditor||a.buildingBlockType===P.BuildingBlockType.RichTextEditorButtonGroups){const e=b?(0,u.coerce)((0,h.getMinimumUI5Version)(b)):void 0;if(e&&(0,u.lt)(e,"1.117.0")){const t=(0,O.translate)(O.i18nNamespaces.buildingBlock,"richTextEditorBuildingBlock.");throw new Error(`${t("minUi5VersionRequirement",{minUI5Version:e})}`)}(0,C.getOrAddNamespace)(v,"sap.fe.macros.richtexteditor","richtexteditor")}if(n=function updateViewFile(e,t,n,i,o,a,r=!1){const s=f.useNamespaces(i.firstChild._nsMap)(n,i);if(!(s&&Array.isArray(s)&&s.length>0))throw new Error(`Aggregation control not found ${n}.`);{const n=s[0],l=i.importNode(o.documentElement,!0);r?n.parentNode?.replaceChild(l,n):n.appendChild(l);const c=(new d.XMLSerializer).serializeToString(i);a.write((0,p.join)(e,t),(0,m.default)(c))}return a}(e,i,w,v,S,n,t.replace),r&&b&&!(0,y.validateDependenciesLibs)(b,["sap.fe.macros"])){const t=await(0,T.getManifestPath)(e,n),i=await getManifestContent(n),o=n.read(t),a=(0,B.detectTabSpacing)(o);(0,B.extendJSON)(n,{filepath:t,content:i,tabInfo:a})}return n},t.getManifestContent=getManifestContent,t.getSerializedFileContent=async function getSerializedFileContent(e,t,n){const i={},{buildingBlockData:o,viewOrFragmentPath:a,allowAutoAddDependencyLib:r=!0}=t;if(!o?.buildingBlockType)return{};n=n??(0,c.create)((0,l.create)());const s=a?getUI5XmlDocument(e,a,n):void 0,{content:g,path:u}=await(0,T.getManifest)(e,n,!1),d=getTemplateContent(o,s,g,n,!0),m=function getFilePathProps(e,t){if(t)return{fileName:(0,p.parse)(t).base,relativePath:t,fullPath:(0,p.join)(e,t)};return{}}(e,a);if(i.viewOrFragmentPath={content:d,language:v.CodeSnippetLanguage.XML,filePathProps:m},r){const t=await getManifestContent(n);i.manifest={content:t,language:v.CodeSnippetLanguage.JSON,filePathProps:{fileName:(0,p.parse)(u).base,relativePath:(0,p.relative)(e,u),fullPath:u}}}return i};const l=n(64812),c=n(90718),g=n(29473),u=n(85263),p=n(76760),d=n(69972),m=s(n(76489)),f=r(n(99861)),h=n(20787),P=n(51708),y=n(31376),b=n(27099),v=n(6641),B=n(51048),T=n(96929),C=n(52310),O=n(28702),x=n(63429),w="REPLACE_WITH_BUILDING_BLOCK_ID",E="REPLACE_WITH_ENTITY",k="REPLACE_WITH_A_QUALIFIER";function getUI5XmlDocument(e,t,n){let i;try{i=n.read((0,p.join)(e,t))}catch(e){throw new Error(`Unable to read xml view file. Details: ${(0,y.getErrorMessage)(e)}`)}const errorHandler=(e,t)=>{throw new Error(`Unable to parse xml view file. Details: [${e}] - ${t}`)};let o;try{o=new d.DOMParser({errorHandler}).parseFromString(i,"text/xml")}catch(e){throw new Error(`Unable to parse xml view file. Details: ${(0,y.getErrorMessage)(e)}`)}return o}function getMetaPath(e,t,n,i){if(!t)return function getDefaultMetaPath(e,t){return e?{metaPath:t?`/${k}`:"",contextPath:t?E:""}:{metaPath:t?`/${E}/${k}`:""}}(e,n);const{bindingContextType:o=P.bindingContextAbsolute,alwaysAbsolutePath:a=!0}=t;let{entitySet:r,qualifier:s}=t;r=r||(n?E:"");const l=s||(n?k:"");if(e){const e=l.split("/");return s=e.pop(),{metaPath:s,contextPath:e.length?`/${r}/${e.join("/")}`:`/${r}`}}if(i){return{metaPath:`${o===P.bindingContextAbsolute?"/":""}${r}/${i}`}}return{metaPath:o===P.bindingContextAbsolute||a?`/${r}/${l}`:l}}function getTemplateContent(e,t,n,i,o,a){const r=e.buildingBlockType,s=(0,b.getTemplatePath)(`/building-block/${r}/View.xml`);if("object"==typeof e.metaPath||void 0===e.metaPath){const t=n?(0,u.coerce)((0,h.getMinimumUI5Version)(n)):void 0;let i;e.buildingBlockType!==P.BuildingBlockType.RichTextEditor&&e.buildingBlockType!==P.BuildingBlockType.CustomFormField||!("targetProperty"in e)||"string"!=typeof e.targetProperty||(i=e.targetProperty);const a=getMetaPath(e.buildingBlockType===P.BuildingBlockType.Chart||!(!t||!(0,u.lt)(t,"1.97.0")),e.metaPath,o,i);!(e={...e,metaPath:a.metaPath}).contextPath&&a.contextPath&&(e.contextPath=a.contextPath)}e.id||(e.id=w);const l=(0,B.getRelativeTemplateComponentPath)(s),c=B.CONFIG[l];let p={macrosNamespace:t?(0,C.getOrAddNamespace)(t,"sap.fe.macros","macros"):"macros",data:e,config:a};if(c?.getData){const t=c.getData(e.generateId,e);p={...p,...t}}return(0,g.render)(i.read(s),p,{})}async function getManifestContent(e,t="sap.fe.macros"){const n=(0,b.getTemplatePath)("/building-block/common/manifest.json");return(0,g.render)(e.read(n),{libraries:{[t]:{}}})}},63429(e,t,n){var i,o=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||(i=function(e){return i=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},i(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=i(e),r=0;r<n.length;r++)"default"!==n[r]&&o(t,e,n[r]);return a(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.BUILDING_BLOCK_CONFIG=t.BUTTON_GROUP_CONFIGS=void 0,t.processBuildingBlock=function processBuildingBlock(e,n,i,o,a,r){let l,g,u=a,m=!1,f="macrosTable";const h=t.BUILDING_BLOCK_CONFIG[e.buildingBlockType];if(!h)return{updatedAggregationPath:u,processedBuildingBlockData:e,hasAggregation:m,aggregationNamespace:f};if(isBuildingBlockType(e,c.BuildingBlockType.RichTextEditorButtonGroups)||isBuildingBlockType(e,c.BuildingBlockType.RichTextEditor)){const t=updateAggregationPath(n,a,{aggregationName:h.aggregationConfig.aggregationName,elementName:h.aggregationConfig.elementName},{uri:h.namespace.uri,prefix:h.namespace.prefix}),i={fs:r,xmlDocument:n,updatedAggregationPath:t.updatedAggregationPath,hasAggregation:t.hasElement};h.processor(e,i),f=(0,d.getOrAddNamespace)(n,h.namespace.uri,h.namespace.prefix)}if((isBuildingBlockType(e,c.BuildingBlockType.CustomColumn)||isBuildingBlockType(e,c.BuildingBlockType.CustomFilterField)||isBuildingBlockType(e,c.BuildingBlockType.CustomFormField))&&e.embededFragment){l=(0,p.setCommonDefaults)(e.embededFragment,i,o),g=(0,s.join)(l.path,`${l.fragmentFile??l.name}.fragment.xml`);const t={fs:r,viewPath:g,embeddedFragment:l};h.processor(e,t);const c=updateAggregationPath(n,a,{aggregationName:h.aggregationConfig.aggregationName,elementName:h.aggregationConfig.elementName});u=c.updatedAggregationPath,m=c.hasElement,f=(0,d.getOrAddNamespace)(n,h.namespace.uri,h.namespace.prefix)}if(isBuildingBlockType(e,c.BuildingBlockType.Action)&&e.embeddedAction){const t=updateAggregationPath(n,a,{aggregationName:h.aggregationConfig.aggregationName,elementName:h.aggregationConfig.elementName}),s={fs:r,xmlDocument:n,updatedAggregationPath:t.updatedAggregationPath,hasAggregation:t.hasElement,embeddedAction:(0,p.setCommonDefaults)(e.embeddedAction,i,o)};h.processor(e,s),u=t.updatedAggregationPath,m=t.hasElement,(0,d.getOrAddNamespace)(n,h.namespace.uri,h.namespace.prefix)}return{updatedAggregationPath:u,processedBuildingBlockData:e,hasAggregation:m,aggregationNamespace:f}};const s=n(76760),l=r(n(99861)),c=n(51708),g=n(27099),u=n(78193),p=n(99644),d=n(52310),m=n(51048);function getBuildingBlockConfig(e){const n=t.BUILDING_BLOCK_CONFIG[e];if(!n)throw new Error(`No configuration found for building block type: ${e}`);return n}function isBuildingBlockType(e,t){return e.buildingBlockType===t}function updateAggregationPath(e,t,n,i){const o=l.useNamespaces(e.firstChild._nsMap),a=o(t,e);if(!a||!Array.isArray(a)||0===a.length)return{updatedAggregationPath:t,hasElement:!1};const r=a[0],s=o(`./*[local-name()='${n.aggregationName}']`,r);if(s&&Array.isArray(s)&&s.length>0)return{updatedAggregationPath:t+`/${(0,d.getOrAddNamespace)(e,i?.uri)}:${n.aggregationName}`,hasElement:!0};{const e=o(`./*[local-name()='${n.elementName}']`,r);if(e&&Array.isArray(e)&&e.length>0)return{updatedAggregationPath:t,hasElement:!0}}return{updatedAggregationPath:t,hasElement:!1}}t.BUTTON_GROUP_CONFIGS=[{name:"font-style",buttons:"bold,italic,underline,strikethrough"},{name:"clipboard",buttons:"cut,copy,paste"},{name:"structure",buttons:"bullist,numlist,outdent,indent"},{name:"font",buttons:"fontfamily,fontsize,forecolor,backcolor"},{name:"undo",buttons:"undo,redo"},{name:"insert",buttons:"image,emoticons"},{name:"link",buttons:"link,unlink"},{name:"text-align",buttons:"alignleft,aligncenter,alignright,alignjustify"},{name:"table",buttons:"table"},{name:"styleselect",buttons:"styleselect"}],t.BUILDING_BLOCK_CONFIG={[c.BuildingBlockType.CustomColumn]:{aggregationConfig:{aggregationName:"columns",elementName:"Column"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:function processCustomColumn(e,t){const{fs:n,viewPath:i}=t;if(!isBuildingBlockType(e,c.BuildingBlockType.CustomColumn))throw new Error("Expected CustomColumn building block data");const o=getBuildingBlockConfig(c.BuildingBlockType.CustomColumn),a=e.embededFragment;let r;a.eventHandler&&(r=(0,u.applyEventHandlerConfiguration)(n,a,a.eventHandler,{controllerSuffix:!1,typescript:a.typescript}),a.eventHandler=r);a.content=(0,p.getDefaultFragmentContent)("Sample Text",e.generateId,r),i&&!n.exists(i)&&n.copyTpl((0,g.getTemplatePath)(o.templateFile),i,a)}},[c.BuildingBlockType.CustomFilterField]:{aggregationConfig:{aggregationName:"filterFields",elementName:"FilterField"},templateFile:"filter/fragment.xml",namespace:{uri:"sap.fe.macros.filterBar",prefix:"macros"},processor:function processCustomFilterField(e,t){const{fs:n,viewPath:i,embeddedFragment:o}=t;if(!isBuildingBlockType(e,c.BuildingBlockType.CustomFilterField))throw new Error("Expected CustomFilterField building block data");if(!o)throw new Error("EmbeddedFragment is required for CustomFilterField");const a=getBuildingBlockConfig(c.BuildingBlockType.CustomFilterField);let r={label:e.label,property:e.property,required:e.required??!1,position:e.position,eventHandler:e.embededFragment?.eventHandler,ns:o.ns,name:o.name,path:o.path};r.eventHandler&&(r.eventHandler=(0,u.applyEventHandlerConfiguration)(n,r,r.eventHandler,{controllerSuffix:!1,typescript:e.embededFragment?.typescript,templatePath:"filter/Controller"}));const s=a.templateFile,l=m.CONFIG[s];if(l?.getData){const t=l.getData(e.generateId);r={...r,...t}}i&&!n.exists(i)&&n.copyTpl((0,g.getTemplatePath)(a.templateFile),i,r)}},[c.BuildingBlockType.CustomFormField]:{aggregationConfig:{aggregationName:"fields",elementName:"FormElement"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:function processCustomFormField(e,t){const{fs:n,viewPath:i}=t;if(!isBuildingBlockType(e,c.BuildingBlockType.CustomFormField))throw new Error("Expected CustomFormField building block data");if(!e.embededFragment)throw new Error("EmbeddedFragment is required for CustomFormField");const o=getBuildingBlockConfig(c.BuildingBlockType.CustomFormField),a=e.embededFragment;let r;a.eventHandler&&(r=(0,u.applyEventHandlerConfiguration)(n,a,a.eventHandler,{controllerSuffix:!1,typescript:a.typescript}),a.eventHandler=r);a.content??=(0,p.getDefaultFragmentContent)("Custom Form Field Content",e.generateId,r),i&&!n.exists(i)&&n.copyTpl((0,g.getTemplatePath)(o.templateFile),i,a)}},[c.BuildingBlockType.RichTextEditorButtonGroups]:{aggregationConfig:{aggregationName:"buttonGroups",elementName:"ButtonGroup"},namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:function processRichTextEditorButtonGroups(e,n){const{xmlDocument:i,updatedAggregationPath:o,hasAggregation:a}=n;if(!isBuildingBlockType(e,c.BuildingBlockType.RichTextEditorButtonGroups)&&!isBuildingBlockType(e,c.BuildingBlockType.RichTextEditor))throw new Error("Expected RichTextEditorButtonGroups or RichTextEditor building block data");const r=new Map;if(a&&i&&o){const e=l.useNamespaces(i.firstChild._nsMap)(o,i);if(e.length>0){const t=e[0],n=getBuildingBlockConfig(c.BuildingBlockType.RichTextEditorButtonGroups);Array.from(t.childNodes).filter(e=>1===e.nodeType&&e.localName===n.aggregationConfig.elementName).forEach(e=>{const t=function extractButtonGroupConfig(e){const t=e.getAttribute("name"),n=e.getAttribute("buttons");if(!t||!n)return;const i={name:t,buttons:n};n&&(i.buttons=n);const o=e.getAttribute("visible");o&&(i.visible="true"===o);const a=e.getAttribute("priority");a&&(i.priority=Number.parseInt(a,10));const r=e.getAttribute("customToolbarPriority");r&&(i.customToolbarPriority=Number.parseInt(r,10));const s=e.getAttribute("row");s&&(i.row=Number.parseInt(s,10));const l=e.getAttribute("id");l&&(i.id=l);return i}(e);t&&r.set(t.name,t)});const i=e[0];i.parentNode?.removeChild(i)}}e.buttonGroups=function mergeButtonGroups(e,n){let i=function getNextCustomToolbarPriority(e){const t=Array.from(e.values()).map(e=>e.customToolbarPriority).filter(e=>"number"==typeof e);return t.length>0?Math.max(...t)+1:1}(e);return n.buttonGroups?.map(n=>{const o=t.BUTTON_GROUP_CONFIGS.find(e=>e.name===n.name);if(!o)throw new Error(`Unknown button group: ${n.name}`);const a=e.get(n.name),r=Object.keys(n).some(e=>"name"!==e&&void 0!==n[e]);let s=n.customToolbarPriority;return void 0!==s||a?void 0!==a?.customToolbarPriority&&(s=a.customToolbarPriority):s=i++,a&&!r?{...a,customToolbarPriority:s}:{name:n.name,buttons:n.buttons??o.buttons,visible:n.visible,priority:n.priority,customToolbarPriority:s,row:n.row,id:n.id}})}(r,e)}},[c.BuildingBlockType.Action]:{aggregationConfig:{aggregationName:"actions",elementName:"Action"},namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:function processAction(e,t){const{fs:n}=t;if(!isBuildingBlockType(e,c.BuildingBlockType.Action))throw new Error("Expected Action building block data");const i=e.embeddedAction;if("object"==typeof i.eventHandler){const e=(0,u.applyEventHandlerConfiguration)(n,i,i.eventHandler,{typescript:i.typescript}),o=i.eventHandler?i.eventHandler.fnName:e;if(i.eventHandler.fileName?.includes(".controller"))i.eventHandler={fnName:`.${o}`};else{let e;if(i.eventHandler.fileName){const n=t.embeddedAction?.ns?.split(".").join("/");e=s.posix.join(n??"",i.eventHandler.fileName)}i.eventHandler={fnName:`handler.${o}`,fileName:e}}}}}}},78082(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getManifestPromptsGroup=void 0,t.getBuildingBlockTypePrompts=async function getBuildingBlockTypePrompts(){const e=(0,i.translate)(i.i18nNamespaces.buildingBlock,"prompts.super.");return{questions:[{type:"list",name:"buildingBlockType",message:e("buildingBlockType.message"),choices:[{name:e("buildingBlockType.choices.chart"),value:o.BuildingBlockType.Chart},{name:e("buildingBlockType.choices.filterBar"),value:o.BuildingBlockType.FilterBar},{name:e("buildingBlockType.choices.table"),value:o.BuildingBlockType.Table}]}]}};const i=n(28702),o=n(51708);t.getManifestPromptsGroup=()=>{const e=(0,i.translate)(i.i18nNamespaces.buildingBlock,"prompts.super.manifestGroup.");return{id:"manifestLibraries",title:e("manifestLibrariesTitle"),description:e("manifestLibrariesDescription",{returnObjects:!0})}}},49439(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getChartBuildingBlockPrompts=async function getChartBuildingBlockPrompts(e){const{project:t}=e,n=(0,i.translate)(i.i18nNamespaces.buildingBlock,"prompts.chart.");return{groups:[{id:c,title:n("chartBuildingBlockPropertiesTitle"),description:n("chartBuildingBlockPropertiesDescription",{returnObjects:!0})},{id:g,title:n("chartVisualizationPropertiesTitle"),description:n("chartVisualizationPropertiesDescription",{returnObjects:!0})},{id:u,title:n("chartConfigureEventsTitle"),description:n("chartConfigureEventsDescription",{returnObjects:!0})},r],questions:[(0,o.getViewOrFragmentPathPrompt)(e,n("viewOrFragmentPath.validate"),{message:n("viewOrFragmentPath.message"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["aggregationPath","buildingBlockData.filterBar"]}}),(0,o.getBuildingBlockIdPrompt)(e,n("id.validation"),{message:n("id.message"),default:s,guiOptions:{groupId:c,mandatory:!0}}),(0,o.getBindingContextTypePrompt)({message:n("bindingContextType"),default:l,guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["buildingBlockData.metaPath.qualifier"]}}),...t&&(0,o.isCapProject)(t)?[await(0,o.getCAPServicePrompt)(e,{message:n("service"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:[]}})]:[],(0,o.getEntityPrompt)(e,{message:n("entity"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["buildingBlockData.metaPath.qualifier"]}}),(0,o.getAnnotationPathQualifierPrompt)(e,{message:n("qualifier"),guiOptions:{groupId:c,mandatory:!0,placeholder:n("qualifierPlaceholder"),hint:n("valuesDependentOnEntityTypeInfo")}},["com.sap.vocabularies.UI.v1.Chart"]),(0,o.getAggregationPathPrompt)(e,{message:n("aggregation"),guiOptions:{groupId:c,mandatory:!0}}),(0,o.getFilterBarIdPrompt)(e,{message:n("filterBar.message"),type:"list",guiOptions:{groupId:c,placeholder:n("filterBar.placeholder"),creation:{placeholder:n("filterBar.inputPlaceholder")}}}),{type:"checkbox",name:"buildingBlockData.personalization",message:n("personalization.message"),choices:[{name:n("personalization.choices.type"),value:"Type"},{name:n("personalization.choices.item"),value:"Item"},{name:n("personalization.choices.sort"),value:"Sort"}],guiOptions:{groupId:g,placeholder:n("personalization.placeholder"),selectType:"static"}},{type:"list",name:"buildingBlockData.selectionMode",message:n("selectionMode.message"),choices:[{name:n("selectionMode.choices.single"),value:"Single"},{name:n("selectionMode.choices.multiple"),value:"Multiple"}],guiOptions:{groupId:u,selectType:"static"}},{type:"input",name:"buildingBlockData.selectionChange",message:n("selectionChange"),guiOptions:{groupId:u,placeholder:n("selectionChangePlaceholder")}}],initialAnswers:{buildingBlockData:{buildingBlockType:a.BuildingBlockType.Chart}}}};const i=n(28702),o=n(26455),a=n(51708),r=(0,n(78082).getManifestPromptsGroup)(),s="Chart",l="absolute",c="chartBuildingBlockProperties",g="chartVisualizationProperties",u="chartConfigureEvents"},22805(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getFilterBarBuildingBlockPrompts=async function getFilterBarBuildingBlockPrompts(e){const{project:t}=e,n=(0,i.translate)(i.i18nNamespaces.buildingBlock,"prompts.filterBar.");return{groups:[{id:c,title:n("filterBarBuildingBlockPropertiesTitle"),description:n("filterBarBuildingBlockPropertiesDescription",{returnObjects:!0})},{id:g,title:n("filterBarConfigureEventsTitle"),description:n("filterBarConfigureEventsDescription",{returnObjects:!0})},r],questions:[(0,o.getViewOrFragmentPathPrompt)(e,n("viewOrFragmentPath.validate"),{message:n("viewOrFragmentPath.message"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["aggregationPath"]}}),(0,o.getBuildingBlockIdPrompt)(e,n("id.validation"),{message:n("id.message"),default:s,guiOptions:{groupId:c,mandatory:!0}}),(0,o.getBindingContextTypePrompt)({message:n("bindingContextType"),default:l,guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["buildingBlockData.metaPath.qualifier"]}}),...t&&(0,o.isCapProject)(t)?[await(0,o.getCAPServicePrompt)(e,{message:n("service"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:[]}})]:[],(0,o.getAggregationPathPrompt)(e,{message:n("aggregation"),guiOptions:{groupId:c,mandatory:!0}}),(0,o.getEntityPrompt)(e,{message:n("entity"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["buildingBlockData.metaPath.qualifier"]}}),(0,o.getAnnotationPathQualifierPrompt)(e,{message:n("qualifier"),guiOptions:{groupId:c,mandatory:!0,placeholder:n("qualifierPlaceholder"),hint:n("valuesDependentOnEntityTypeInfo")}},["com.sap.vocabularies.UI.v1.SelectionFields"]),{type:"input",name:"buildingBlockData.filterChanged",message:n("filterChanged"),guiOptions:{groupId:g,placeholder:n("filterChangedPlaceholder")}},{type:"input",name:"buildingBlockData.search",message:n("search"),guiOptions:{groupId:g,placeholder:n("searchPlaceholder")}}],initialAnswers:{buildingBlockData:{buildingBlockType:a.BuildingBlockType.FilterBar}}}};const i=n(28702),o=n(26455),a=n(51708),r=(0,n(78082).getManifestPromptsGroup)(),s="FilterBar",l="absolute",c="filterBarBuildingBlockProperties",g="filterConfigureEvents"},8337(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getFormBuildingBlockPrompts=async function getFormBuildingBlockPrompts(e){const{project:t}=e,n=(0,o.translate)(o.i18nNamespaces.buildingBlock,"prompts.form."),a=[{id:c,title:n("formBuildingBlockPropertiesTitle"),description:n("formBuildingBlockPropertiesDescription",{returnObjects:!0})},l],p=[(0,r.getViewOrFragmentPathPrompt)(e,n("viewOrFragmentPath.validate"),{message:n("viewOrFragmentPath.message"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["aggregationPath"]}}),(0,r.getBuildingBlockIdPrompt)(e,n("id.validation"),{message:n("id.message"),default:g,guiOptions:{groupId:c,mandatory:!0}}),(0,r.getBindingContextTypePrompt)({message:n("bindingContextType"),default:u,guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["buildingBlockData.metaPath.qualifier"]}}),...t&&(0,r.isCapProject)(t)?[await(0,r.getCAPServicePrompt)(e,{message:n("service"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:[]}})]:[],(0,r.getEntityPrompt)(e,{message:n("entity"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["buildingBlockData.metaPath.qualifier"]}}),(0,r.getAnnotationPathQualifierPrompt)(e,{message:n("qualifier"),guiOptions:{hint:n("valuesDependentOnEntityTypeInfo"),groupId:c,mandatory:!0,placeholder:n("qualifierPlaceholder")}},["com.sap.vocabularies.UI.v1.FieldGroup"]),(0,r.getAggregationPathPrompt)(e,{message:n("aggregation"),guiOptions:{groupId:c,mandatory:!0}}),{type:"input",name:"buildingBlockData.title",message:n("title.message"),guiOptions:{groupId:c,mandatory:!0,translationProperties:{type:i.SapShortTextType.Heading,annotation:n("title.translationAnnotation")}}}];return{groups:a,questions:p,initialAnswers:{buildingBlockData:{buildingBlockType:s.BuildingBlockType.Form}}}};const i=n(20197),o=n(28702),a=n(78082),r=n(26455),s=n(51708),l=(0,a.getManifestPromptsGroup)(),c="formBuildingBlockProperties",g="Form",u="absolute"},70523(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(78082),t),o(n(49439),t),o(n(22805),t),o(n(8337),t),o(n(28595),t),o(n(7720),t),o(n(887),t),o(n(32107),t)},7720(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getPageBuildingBlockPrompts=async function getPageBuildingBlockPrompts(e){const t=(0,i.translate)(i.i18nNamespaces.buildingBlock,"prompts.page.");return{questions:[(0,o.getViewOrFragmentPathPrompt)(e,t("viewOrFragmentPath.validate"),{message:t("viewOrFragmentPath.message"),guiOptions:{mandatory:!0,dependantPromptNames:["aggregationPath"]}}),(0,o.getAggregationPathPrompt)(e,{message:t("aggregation"),guiOptions:{mandatory:!0}}),(0,o.getBuildingBlockIdPrompt)(e,t("id.validation"),{message:t("id.message"),default:"Page",guiOptions:{mandatory:!0}}),{type:"input",name:"buildingBlockData.title",message:t("title.message"),guiOptions:{mandatory:!0,translationProperties:{type:r.SapShortTextType.Heading,annotation:t("title.translationAnnotation")}}},{type:"input",name:"buildingBlockData.description",message:t("description.message"),guiOptions:{translationProperties:{type:r.SapLongTextType.Description,annotation:t("description.translationAnnotation")}}}],initialAnswers:{buildingBlockData:{buildingBlockType:a.BuildingBlockType.Page}}}};const i=n(28702),o=n(26455),a=n(51708),r=n(20197)},887(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getRichTextEditorBuildingBlockPrompts=async function getRichTextEditorBuildingBlockPrompts(e){const t=(0,i.translate)(i.i18nNamespaces.buildingBlock,"prompts.richTextEditor.");return{questions:[(0,o.getBuildingBlockIdPrompt)(e,t("id.validation"),{message:t("id.message"),guiOptions:{mandatory:!0}}),(0,o.getViewOrFragmentPathPrompt)(e,t("viewOrFragmentPath.validate"),{message:t("viewOrFragmentPath.message"),guiOptions:{mandatory:!0,dependantPromptNames:["aggregationPath"]}}),(0,o.getBindingContextTypePrompt)({name:"buildingBlockData.metaPath.bindingContextType",message:t("bindingContextType"),default:a.bindingContextAbsolute,guiOptions:{mandatory:!0,dependantPromptNames:["buildingBlockData.metaPath.entitySet"]},choices:(0,r.resolveBindingContextTypeChoices)(e)}),(0,o.getEntityPrompt)(e,{name:"buildingBlockData.metaPath.entitySet",default:e.options?.pageContextEntitySet,message:t("entitySet"),guiOptions:{mandatory:!0,dependantPromptNames:["buildingBlockData.targetProperty"]}}),(0,o.getTargetPropertiesPrompt)(e,{name:"buildingBlockData.targetProperty",message:t("targetProperty"),guiOptions:{mandatory:!0}}),(0,o.getAggregationPathPrompt)(e,{message:t("aggregation"),guiOptions:{mandatory:!0}})],initialAnswers:{buildingBlockData:{buildingBlockType:a.BuildingBlockType.RichTextEditor}}}};const i=n(28702),o=n(26455),a=n(51708),r=n(42677)},32107(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getRichTextEditorButtonGroupsBuildingBlockPrompts=async function getRichTextEditorButtonGroupsBuildingBlockPrompts(e){return{questions:[(0,a.getViewOrFragmentPathPrompt)(e,s("viewOrFragmentPath.validate"),{message:s("viewOrFragmentPath.message"),guiOptions:{mandatory:!0,dependantPromptNames:["aggregationPath","buildingBlockData.buttonGroups"]}}),(0,a.getAggregationPathPrompt)(e,{message:s("aggregation"),guiOptions:{mandatory:!0,dependantPromptNames:["buildingBlockData.buttonGroups"]}}),{type:"checkbox",name:"buildingBlockData.buttonGroups",message:s("message"),choices:t=>(0,r.getButtonGroupsChoices)(e,t),guiOptions:{hint:s("replaceDefaultButtonGroupsHint"),selectType:"dynamic"}}],initialAnswers:{buildingBlockData:{buildingBlockType:o.BuildingBlockType.RichTextEditorButtonGroups}}}};const i=n(28702),o=n(51708),a=n(26455),r=n(42677),s=(0,i.translate)(i.i18nNamespaces.buildingBlock,"prompts.richTextEditorButtonGroups.")},28595(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getTableBuildingBlockPrompts=async function getTableBuildingBlockPrompts(e){const{project:t}=e,n=(0,i.translate)(i.i18nNamespaces.buildingBlock,"prompts.table.");return{groups:[{id:c,title:n("tableBuildingBlockPropertiesTitle"),description:n("tableBuildingBlockPropertiesDescription",{returnObjects:!0})},{id:g,title:n("tableVisualizationPropertiesTitle"),description:n("tableVisualizationPropertiesDescription",{returnObjects:!0})},l],questions:[(0,o.getViewOrFragmentPathPrompt)(e,n("viewOrFragmentPath.validate"),{message:n("viewOrFragmentPath.message"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["aggregationPath","buildingBlockData.filterBar"]}}),(0,o.getBuildingBlockIdPrompt)(e,n("id.validation"),{message:n("id.message"),default:u,guiOptions:{groupId:c,mandatory:!0}}),(0,o.getBindingContextTypePrompt)({message:n("bindingContextType"),default:T,guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["buildingBlockData.metaPath.qualifier"]}}),...t&&(0,o.isCapProject)(t)?[await(0,o.getCAPServicePrompt)(e,{message:n("service"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:[]}})]:[],(0,o.getEntityPrompt)(e,{message:n("entity"),guiOptions:{groupId:c,mandatory:!0,dependantPromptNames:["buildingBlockData.metaPath.qualifier"]}}),(0,o.getAnnotationPathQualifierPrompt)(e,{message:n("qualifier"),guiOptions:{hint:n("valuesDependentOnEntityTypeInfo"),groupId:c,mandatory:!0,placeholder:n("qualifierPlaceholder")}},["com.sap.vocabularies.UI.v1.LineItem"]),(0,o.getAggregationPathPrompt)(e,{message:n("aggregation"),guiOptions:{groupId:c,mandatory:!0}}),(0,o.getFilterBarIdPrompt)(e,{message:n("filterBar.message"),type:"list",guiOptions:{groupId:c,placeholder:n("filterBar.placeholder"),creation:{placeholder:n("filterBar.inputPlaceholder")}}}),{type:"list",name:"buildingBlockData.type",message:n("tableType.message"),choices:[{name:"Responsive Table",value:"ResponsiveTable"},{name:"Grid Table",value:"GridTable"}],default:p,guiOptions:{groupId:g}},{type:"list",name:"buildingBlockData.selectionMode",message:n("selectionMode.message"),choices:[{name:n("selectionMode.choices.single"),value:"Single"},{name:n("selectionMode.choices.multiple"),value:"Multi"},{name:n("selectionMode.choices.auto"),value:"Auto"},{name:n("selectionMode.choices.none"),value:"None"}],default:d,guiOptions:{groupId:g}},(0,o.getBooleanPrompt)({name:"buildingBlockData.headerVisible",message:n("headerVisible"),default:m,guiOptions:{groupId:g}}),{type:"input",name:"buildingBlockData.header",message:n("header.message"),guiOptions:{groupId:g,translationProperties:{type:s.SapShortTextType.TableTitle,annotation:n("header.translationAnnotation")}}},{type:"checkbox",name:"buildingBlockData.personalization",message:n("personalization.message"),choices:[{name:n("personalization.choices.Sort"),value:"Sort"},{name:n("personalization.choices.Column"),value:"Column"},{name:n("personalization.choices.Filter"),value:"Filter"}],guiOptions:{groupId:g}},{type:"list",name:"buildingBlockData.variantManagement",message:n("tableVariantManagement"),choices:[{name:"Page",value:"Page"},{name:"Control",value:"Control"},{name:"None",value:"None"}],default:f,guiOptions:{groupId:g}},(0,o.getBooleanPrompt)({name:"buildingBlockData.readOnly",message:n("readOnlyMode"),default:h,guiOptions:{groupId:g}}),(0,o.getBooleanPrompt)({name:"buildingBlockData.enableAutoColumnWidth",message:n("autoColumnWidth"),default:P,guiOptions:{groupId:g}}),(0,o.getBooleanPrompt)({name:"buildingBlockData.enableExport",message:n("dataExport"),default:y,guiOptions:{groupId:g}}),(0,o.getBooleanPrompt)({name:"buildingBlockData.enableFullScreen",message:n("fullScreenMode"),default:b,guiOptions:{groupId:g}}),(0,o.getBooleanPrompt)({name:"buildingBlockData.enablePaste",message:n("pasteFromClipboard"),default:v,guiOptions:{groupId:g}}),(0,o.getBooleanPrompt)({name:"buildingBlockData.isSearchable",message:n("tableSearchableToggle"),default:B,guiOptions:{groupId:g}})],initialAnswers:{buildingBlockData:{buildingBlockType:a.BuildingBlockType.Table}}}};const i=n(28702),o=n(26455),a=n(51708),r=n(78082),s=n(20197),l=(0,r.getManifestPromptsGroup)(),c="tableBuildingBlockProperties",g="tableVisualizationProperties",u="Table",p="ResponsiveTable",d="Single",m=!0,f="None",h=!1,P=!1,y=!1,b=!1,v=!1,B=!0,T="absolute"},26455(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(94090),t),o(n(45522),t),o(n(34204),t),o(n(52310),t)},94090(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCapProject=function isCapProject(e){return["CAPJava","CAPNodejs"].includes(e.projectType)}},42677(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.entitySetCache=void 0,t.loadEntitySets=loadEntitySets,t.getEntitySetOptions=getEntitySetOptions,t.resolveEntitySetTargets=function resolveEntitySetTargets(e,t,n,o){const a=t||o,r=e.find(e=>e.name===a);if(!o)return[];if(n===i.bindingContextRelative&&o){const t=r?.entityType?.navigationProperties?.find(e=>e.name===o),n=e.find(e=>e.entityTypeName===t?.targetTypeName);return n?.entityType?.entityProperties??[]}return r?.entityType?.entityProperties??[]},t.resolveBindingContextTypeChoices=function resolveBindingContextTypeChoices(e){const{project:t}=e;if(t)return async()=>{const t=await loadEntitySets(e),{pageContextEntitySet:n}=e.options??{};if(!n)return getBindingContextTypeChoices();return getEntitySetOptions(t,n,i.bindingContextRelative).length?getBindingContextTypeChoices():getBindingContextTypeChoices(!0)};return getBindingContextTypeChoices()},t.getButtonGroupsChoices=async function getButtonGroupsChoices(e,t){const{project:n,appPath:i,fs:o}=e;if(!n)return[];let c=new Set;if(t.viewOrFragmentPath){const e=(0,r.join)(i,t.viewOrFragmentPath);c=await(0,s.getExistingButtonGroups)(e,t.aggregationPath,o)}const g=!c||0===c.size,u=(0,a.translate)(a.i18nNamespaces.buildingBlock,"prompts.richTextEditorButtonGroups.");return l.BUTTON_GROUP_CONFIGS.map(e=>{const t=u(`choices.${e.name}`);return{name:t,value:e.name,hidden:!g&&c.has(e.name),checked:c.has(e.name),title:t}})};const i=n(51708),o=n(34204),a=n(28702),r=n(76760),s=n(52310),l=n(63429);async function loadEntitySets(e){const{project:n,appId:i}=e;if(!n||0===Object.keys(n).length)throw new Error("Project is undefined. Cannot fetch entity sets.");const a=JSON.stringify(n)+":"+i;return t.entitySetCache[a]||(t.entitySetCache[a]=await(0,o.getEntitySets)(n,i)),t.entitySetCache[a]}function getEntitySetOptions(e,t,n){const o=e.find(e=>e.name===t);if(!o)return e;if(n===i.bindingContextRelative){let e=o?.entityType?.navigationProperties?.filter(e=>!1===e.isCollection)??[];return e=e.filter(e=>!["DraftAdministrativeData","SiblingEntity"].includes(e.name)),e}return[o]}function getBindingContextTypeChoices(e=!1){const t=(0,a.translate)(a.i18nNamespaces.buildingBlock,"prompts.");return[{name:t("common.bindingContextType.option.absolute"),value:i.bindingContextAbsolute},{name:t("common.bindingContextType.option.relative"),value:i.bindingContextRelative,...e?{disabled:!0,title:t("richTextEditor.relativeBindingDisabledTooltip")}:{}}]}t.entitySetCache={}},45522(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getBooleanPrompt=function getBooleanPrompt(e){const{guiOptions:t}=e;return{...e,type:"list",choices:[{name:"False",value:!1},{name:"True",value:!0}],guiOptions:{...t,selectType:"static"}}},t.getAnnotationPathQualifierPrompt=function getAnnotationPathQualifierPrompt(e,t={},n=[]){const{project:i,appId:a}=e,{guiOptions:s}=t;return{...t,type:"list",name:"buildingBlockData.metaPath.qualifier",choices:i?async e=>{const{entitySet:t,bindingContextType:s}=e.buildingBlockData?.metaPath??{};if(!t)return[];const l=s?{type:s,isCollection:e.buildingBlockData.buildingBlockType===r.BuildingBlockType.Table}:{type:"absolute"},c=transformChoices(await(0,o.getAnnotationPathQualifiers)(i,a,t,n,l,!0));if(t&&!c.length)throw new Error(`Couldn't find any existing annotations for term ${n.join(",")}. Please add ${n.join(",")} annotation/s`);return c}:[],guiOptions:{...s,selectType:"dynamic"}}},t.getViewOrFragmentPathPrompt=function getViewOrFragmentPathPrompt(e,t,n={}){const{fs:o,project:a,appPath:r}=e,{guiOptions:s}=n;return{...n,type:"list",name:"viewOrFragmentPath",choices:a?async()=>transformChoices((await(0,g.getFragmentAndViewFiles)(r,o)).map(e=>(0,i.relative)(r,e))):[],validate:e=>!(a&&!e)||t,guiOptions:{...s,selectType:"dynamic",placeholder:s?.placeholder??p("viewOrFragmentPath.defaultPlaceholder")}}},t.getCAPServicePrompt=async function getCAPServicePrompt(e,t={}){const{project:n,appId:i}=e,{guiOptions:o}=t,a=n?await getCAPServiceChoices(n,i):[],r=1===a.length?a[0].value:void 0;return{...t,type:"list",name:"service",choices:n?getCAPServiceChoices.bind(null,n,i):[],default:r,guiOptions:{...o,selectType:"dynamic",placeholder:o?.placeholder??p("service.defaultPlaceholder")}}},t.getEntityPrompt=function getEntityPrompt(e,t={}){const{project:n}=e,{pageContextEntitySet:i}=e.options??{},{guiOptions:o}=t;return{...t,type:"list",name:"buildingBlockData.metaPath.entitySet",choices:n?async t=>{const n=await(0,c.loadEntitySets)(e);if(!i)return transformChoices(n.map(e=>e.name));const o=t?.buildingBlockData?.metaPath.bindingContextType??r.bindingContextAbsolute,a=(0,c.getEntitySetOptions)(n,i,o);return transformChoices((a.length>0?a:[]).map(e=>e.name))}:[],guiOptions:{...o,selectType:"dynamic",placeholder:o?.placeholder??p("entity.defaultPlaceholder")}}},t.getTargetPropertiesPrompt=function getTargetPropertiesPrompt(e,t={}){const{project:n}=e,i=e.options?.pageContextEntitySet??"",{guiOptions:o}=t;return{...t,type:"list",name:"buildingBlockData.targetProperty",choices:n?async t=>{const n=await(0,c.loadEntitySets)(e),{bindingContextType:o,entitySet:a}=t?.buildingBlockData?.metaPath??{};if(!a)return[];return transformChoices((0,c.resolveEntitySetTargets)(n,i,o,a).map(e=>e.name))}:[],guiOptions:{...o,selectType:"dynamic",placeholder:o?.placeholder??p("targetProperty.defaultPlaceholder")}}},t.getCAPServiceChoices=getCAPServiceChoices,t.getAggregationPathPrompt=function getAggregationPathPrompt(e,t={}){const{fs:n,project:o,appPath:a}=e,{guiOptions:r}=t;return{...t,type:"list",name:"aggregationPath",choices:o?e=>{const{viewOrFragmentPath:t}=e;if(t){const{inputChoices:e,pageMacroDefinition:o}=(0,s.getXPathStringsForXmlFile)((0,i.join)(a,t),n),r=transformChoices(e,!1,Object.keys(e).find(e=>e.endsWith(`/${o}`)));if(!r.length)throw new Error("Failed while fetching the aggregation path.");return r}return[]}:[],guiOptions:{...r,selectType:"dynamic",placeholder:r?.placeholder??p("aggregationPath.defaultPlaceholder")}}},t.transformChoices=transformChoices,t.getFilterBarIdPrompt=function getFilterBarIdPrompt(e,t){const{fs:n,project:o,appPath:a}=e,{guiOptions:r}=t,l={...t,type:"input",name:"buildingBlockData.filterBar",guiOptions:{...r,placeholder:r?.placeholder??p("filterBar.defaultPlaceholder")}};if("input"===t.type)return l;return{...l,type:"list",choices:o?async e=>e.viewOrFragmentPath?transformChoices(await(0,s.getFilterBarIdsInFile)((0,i.join)(a,e.viewOrFragmentPath),n)):[]:[],guiOptions:{...l.guiOptions,selectType:"dynamic"}}},t.getBindingContextTypePrompt=function getBindingContextTypePrompt(e={}){const{guiOptions:t}=e;return{...e,type:"list",name:"buildingBlockData.metaPath.bindingContextType",choices:e.choices??[{name:p("bindingContextType.option.absolute"),value:"absolute"},{name:p("bindingContextType.option.relative"),value:"relative"}],guiOptions:{...t,selectType:"function"==typeof e.choices?"dynamic":"static"}}},t.getBuildingBlockIdPrompt=function getBuildingBlockIdPrompt(e,t,n={}){const{fs:o,project:a,appPath:r}=e,{guiOptions:s}=n;return{...n,type:"input",name:"buildingBlockData.id",validate:(e,n)=>!a||(e?!(n?.viewOrFragmentPath&&!(0,u.isElementIdAvailable)(o,(0,i.join)(r,n.viewOrFragmentPath),e))||p("id.existingIdValidation"):t),guiOptions:{...s,placeholder:s?.placeholder??p("id.defaultPlaceholder")}}};const i=n(76760),o=n(34204),a=n(20787),r=n(51708),s=n(52310),l=n(28702),c=n(42677),g=n(51048),u=n(96929);(0,l.initI18n)();const p=(0,l.translate)(l.i18nNamespaces.buildingBlock,"prompts.common.");async function getCAPServiceChoices(e,t){const n=e.apps[t]?.services,i={};for(const o of Object.keys(n)){i[await(0,a.getCapServiceName)(e.root,e.apps[t].services[o]?.uri??"")]=o}return transformChoices(i)}function transformChoices(e,t=!0,n){let i=[];return Array.isArray(e)?(e=[...new Set(e)],t?[...e].sort((e,t)=>e.localeCompare(t)):e):(i=Object.entries(e).map(([e,t])=>e===n?{name:e,value:t,checked:!0}:{name:e,value:t}),t&&(i=i.sort((e,t)=>e.name.localeCompare(t.name))),i)}},34204(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getMappedServiceName=getMappedServiceName,t.getAnnotationService=getAnnotationService,t.getMergedMetadata=getMergedMetadata,t.getEntitySets=async function getEntitySets(e,t){const n=await(async(e,t,n)=>{const i=await getAnnotationService(e,t,n);return getMergedMetadata(i)})(e,getMainService(e,t),t);return Array.from(n.entitySets)},t.getAnnotationTermAlias=getAnnotationTermAlias,t.getAnnotationPathQualifiers=async function getAnnotationPathQualifiers(e,t,n,i,o,a=!1){const r={};try{const s=await getAnnotationService(e,getMainService(e,t),t),l=getMergedMetadata(s).entitySets.by_name(n),c=l?.entityType;c&&function getAnnotationPathQualifiersForEntityType(e,t,n,i,o){"absolute"===o.type?addAnnotationPathQualifierToResult(e,"",t,n,i):"relative"===o.type&&e.navigationProperties.forEach(e=>{"EntityType"===e.targetType?._type&&"SiblingEntity"!==e.name&&(!o.isCollection||o.isCollection&&e.isCollection)&&addAnnotationPathQualifierToResult(e.targetType,e.name,t,n,i)})}(c,i,r,a,o)}catch(e){throw new Error(`An error occurred while reading the annotation path qualifiers. Details: ${e}`)}return r};const i=n(91125),o=n(97183),a=n(20787);async function getMappedServiceName(e,t,n){let i=t;if(["CAPJava","CAPNodejs"].includes(e.projectType)){const t=getMainService(e,n);t&&(i=await(0,a.getCapServiceName)(e.root,e.apps[n]?.services?.[t].uri??""))}return i}async function getAnnotationService(e,t,n,i=!0){const a=await getMappedServiceName(e,t,n),r=await o.FioriAnnotationService.createService(e,a,n);return i&&await r.sync(),r}function getMergedMetadata(e){const t=e.getSchema();return(0,i.convert)(t)}function getMainService(e,t){let n;if(void 0===t){const t=Object.keys(e.apps);n=e.apps[t[0]].mainService}else{const i=e.apps[t];if(!i)throw new Error("ERROR_INVALID_APP_ID");n=i.mainService}return n??"mainService"}function getAnnotationTermAlias(e){const[,,,t,,n]=e.split(".");return[t,n]}function addAnnotationPathQualifierToResult(e,t,n,i,o=!1){n.forEach(n=>{const[a,r]=getAnnotationTermAlias(n),s=n.substring(0,n.lastIndexOf(".")),l=e.annotations[a];l&&Object.entries(l).forEach(([e,n])=>{if(e.startsWith(r)){const e=n.qualifier?"#"+n.qualifier:"",l=""+(t?t+"/":"");i[`${l}@${a}.${r}`+e]=`${l}@${o?s:a}.${r}`+e}})})}},52310(e,t,n){var i,o=this&&this.__createBinding||(Object.create?function(e,t,n,i){void