@sap-ux/generator-odata-downloader 0.3.14 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -720,7 +720,7 @@ ${i}`),await fl(e,s.concat(i),n),!0}function wTn(e,t){let r=Qu.create("","",0,e)
720
720
  `).filter(i=>!!/^\s*at .*(\S+:\d+|\(native\))/m.exec(i));return n.length&&n.forEach(i=>{let s=i.replace(/^\s+/,""),a=/ (\((.+):(\d+):(\d+)\)$)/.exec(i);if(!a)return;let u=null,c=a[2].replace(/\\/g,"/");for(let h of t){let g=h.exec(c);if(g){u=g[0];break}}if(!u)return;s=s.replace(a[0],"");let l=s.split(/\s+/).slice(1).join(""),f=a[3],p=a[4],d=`${l} at (${u}:${f}:${p});`;r.push(d)}),r},Q5,oOt=e=>{process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY?.trim()!=="true"&&(Q5=new sOt.TelemetryClient(Eo.azureInstrumentationKey),c$(Q5));let t={message:e.message};if(e.stack){let n=gbn(e.stack);n.length&&(t.stack=n.join(`
721
721
  `))}let r={name:$x.TELEMETRY_SETTINGS_INIT_FAILED,properties:t,measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&Q5.trackEvent(r)},aOt=(e,t)=>{let r={name:$x.DISABLE_TELEMETRY,properties:{disableTelemetry:`${!e}`,...t},measurements:{}};process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY!=="true"&&Q5.trackEvent(r)};var pS;(function(e){e.BackendSystem="system",e.TelemetrySetting="telemetrySetting"})(pS||(pS={}));var uOt={error:{unsupportedEntity:"Unsupported entity - {{entityName}}",systemDoesNotExist:"System does not exist. URL: [{{system.url}}], client: [{{system.client}}]",parsingStore:"Cannot parse store for {{entityName}}",noPropertiesSpecified:"No properties specified for update",systemMigrationFailed:"Migrating systems from secure store failed",systemAlreadyExistsInHybridStore:"System with ID: [{{systemId}}] already exists in hybrid store. Not migrating",couldNotDeleteRefreshToken:"Could not delete refresh token for [{{- url}}]",backendSystemEntityKeyExists:"The 'BackendSystem' entity was not written because a 'BackendSystem' entity key already exists: {{entityKey}}.",systemsJsonMigrationFailed:"The migration of the systems.json file from .fioritools to .saptools failed: {{- error}}"},info:{foundRefreshToken:"Found refresh token for {{- systemId}}",tryingToUpdateAuthType:"Trying to update authentication type for {{- systemId}}",authTypeDetermined:"Authentication type [{{- authenticationType }}] determined for {{- systemId }}",authTypeNotDetermined:"Authentication type could not be determined for {{- systemId }}",updatingRefreshTokenInNewStore:"Update refresh token in new store for {{- systemId}}",deletingRefreshTokenFromOldStore:"Deleting refresh token in old store for {{- systemId}}",legacyApiHubKeyFound:"Legacy format API Hub Key found in secure store",legacyApiHubKeyDeleted:"Legacy format API Hub Key removed from secure store",legacyApiHubKeyMigrated:"Legacy format API Hub Key migrated to new format",legacyApiHubKeyNotMigrated:"Legacy format API Hub Key not migrated, new format already exits",noLegacyApiHubKeyFound:"No legacy format API Hub Key found in secure store"}};var dye="ux-store",hye=Ur.createInstance();async function cOt(){hye=Ur.createInstance({resources:{en:{[dye]:uOt}},lng:"en",fallbackLng:"en",defaultNS:dye,fallbackNS:"default",ns:[dye],interpolation:{escapeValue:!1},showSupportNotice:!1}),await hye.init()}function Zu(e,t){return hye.t(e,typeof t=="string"?{defaultValue:t}:t)}var hS=Te(require("node:path"),1),dl=Te(require("node:fs"),1);var _ye=require("node:os"),vye=require("node:path"),pOt=Te(lOt(),1);var yye;(function(e){e.PROXY_URL="HTTP_PROXY",e.H2O_URL="H2O_URL"})(yye||(yye={}));function fOt(){return!!process.env[yye.H2O_URL]}var dL={AbapCloud:"AbapCloud",AbapOnPrem:"OnPrem",Generic:"Generic"},hL={Basic:"basic",ReentranceTicket:"reentranceTicket",OAuth2RefreshToken:"oauth2",OAuth2ClientCredential:"oauth2ClientCredential"},Eye={AbapCatalog:"abap_catalog",GenericHost:"generic_host",ODataService:"odata_service"};function mL(e){let t;return e.authenticationType==="reentranceTicket"?t=dL.AbapCloud:e.serviceKeys?t=dL.AbapCloud:(e.authenticationType==="basic"||e.username)&&(t=dL.AbapOnPrem),t}var Ebn=pOt.default.plural,Sye=(e,...t)=>e&&t?.length>0&&t.reduce((r,n)=>(r[n]=e[n],r),{})||void 0;function gL(e,t){return e==null||typeof e!="object"?!1:t.some(r=>{let n=e[r];return n!=null})}function t8(e){return e instanceof Error?e:new Error(String(e))}function gf(e){return e instanceof Error?e.message:String(e)}var Z5;(function(e){e.dir=".fioritools"})(Z5||(Z5={}));var e8;(function(e){e.dir=".saptools"})(e8||(e8={}));var yL=()=>(0,vye.join)((0,_ye.homedir)(),Z5.dir),yy=()=>(0,vye.join)((0,_ye.homedir)(),e8.dir);function dS(e){let t=e?.trim().toLowerCase();return t&&Ebn(t)}function EL(e){return dS(e)+".json"}function Tye(e,t){return Object.entries(t).every(([r,n])=>Array.isArray(n)?n.includes(e[r]):n&&typeof n=="object"?Tye(e[r],n):e[r]===n)}var dOt=Te(require("node:os"),1),hOt=({baseDirectory:e}={})=>e?hS.default.isAbsolute(e)?e:hS.default.join(dOt.default.homedir(),e):yL(),bye=class{logger;storeDirectory;constructor(t,r={}){this.logger=t,this.storeDirectory=hOt(r)}async read({entityName:t,id:r}){let n=dS(t);if(!n){this.logger.debug("read: Entity Type is falsy - "+t);return}let{entities:i,error:s}=this._readAll(n);if(s){if(s.code==="ENOENT")return;throw s}if(!i){this.logger.debug(`read: After parsing, entities is falsy. Entity: ${n}, parsed value: ${i}`);return}return i[r]}async getAll({entityName:t}){let r=dS(t);if(!r)return this.logger.debug("read: Entity Type is falsy - "+t),[];let{entities:n,error:i}=this._readAll(r);if(i){if(i.code==="ENOENT")return[];throw i}return n?Object.values(n):(this.logger.debug(`read: After parsing, entities is falsy. Entity: ${r}, parsed value: ${n}`),[])}async readAll({entityName:t}){let r=dS(t);if(!r)return this.logger.debug("read: Entity Type is falsy - "+t),{};let{entities:n,error:i}=this._readAll(r);if(i){if(i.code==="ENOENT")return{};throw i}return n||(this.logger.debug(`read: After parsing, entities is falsy. Entity: ${r}, parsed value: ${n}`),{})}async write({entityName:t,id:r,entity:n}){let i=dS(t);if(!i){this.logger.debug("write: Entity is falsy - "+i);return}let{entities:s={},error:o}=this._readAll(i);if(o&&o.code!=="ENOENT")throw o;return s[r]=n,this.writeToFile(i,s),n}async partialUpdate({entityName:t,id:r,entity:n}){if(!n||!Object.keys(n).length){this.logger.debug("partialUpdate: No properties specified for update");return}let i=await this.read({entityName:t,id:r});if(!i){this.logger.debug(`partialUpdate: Entity with id ${r} does not exist in ${t}. Cannot update.`);return}let s=this.mergeProperties(n,i);return this.write({entityName:t,id:r,entity:s})}mergeProperties(t,r){return{...{...r,...t}}}async del({entityName:t,id:r}){let n=dS(t);if(!n)return this.logger.debug("delete: Entity is falsy - "+n),!1;let{entities:i={},error:s}=this._readAll(n);if(s&&s.code!=="ENOENT")throw s;return i[r]?(this.logger.debug(`delete: entity found for id - ${r}. Deleting`),delete i[r],this.writeToFile(n,i),!0):(this.logger.debug("delete: entity not found"),!1)}_readAll(t){let r;try{let i=hS.default.join(this.storeDirectory,`${t}.json`);(0,dl.existsSync)(i)?r=(0,dl.readFileSync)(i).toString().trim():r=""}catch(i){let s=t8(i);return this.logger.debug(s.message),{error:s}}if(!r)return{entities:void 0};let n;try{n=JSON.parse(r)?.[t]}catch(i){return{error:t8(i)}}return{entities:n}}writeToFile(t,r){let n=JSON.stringify({[t]:r},null,2),i=EL(t);try{(0,dl.writeFileSync)(hS.default.join(this.storeDirectory,i),n)}catch(s){if(t8(s)?.code==="ENOENT")this.logger.debug(`Base directory [${this.storeDirectory}] does not exist, trying to create it`),(0,dl.mkdirSync)(this.storeDirectory,{recursive:!0}),(0,dl.writeFileSync)(hS.default.join(this.storeDirectory,i),n);else throw s}}};function r8(e,t,r={}){let n=hS.default.join(hOt(r),EL(e));if((0,dl.existsSync)(n))return dl.default.watch(n,void 0,()=>{t(e)});console.warn(`File Not Found: ${n}`)}function n8(e,t){return new bye(e,t)}var _L=class{log;constructor(t){this.log=t}async save(t,r,n){return this.log.warn(`Dummy store. Trying to save for service: ${t}, key: ${r}`),!0}async retrieve(t,r){this.log.warn(`Dummy store. Trying to retrieve for service: ${t}, key: ${r}`)}async delete(t,r){return this.log.warn(`Dummy store. Trying to delete for service: ${t}, key: ${r}`),!0}async getAll(t){return this.log.warn(`Dummy store. Trying to get all values for service: [${t}]`),{}}};var i8=class{log;keyring;constructor(t,r){this.log=t,this.keyring=r}serialize(t){try{return JSON.stringify(t)}catch{throw new Error("Failed to serialize value while storing credentials")}}deserialize(t){try{return JSON.parse(t)}catch{throw new Error("Failed to deserialize value while retrieving credentials")}}validateInput(t,r){return!t||!r?(this.log.error("Invalid input: Service or Key is missing."),!1):!0}async save(t,r,n){if(!this.validateInput(t,r))return!1;try{let i=this.serialize(n);return await this.keyring.setPassword(t,r,i),this.log.info(`Credential saved successfully. Service: [${t}], Key: [${r}]`),!0}catch(i){return this.log.error(`Failed to save credential. Service: [${t}], Key: [${r}]. Error: ${gf(i)}`),!1}}async retrieve(t,r){if(this.validateInput(t,r))try{let n=await this.keyring.getPassword(t,r);if(!n){this.log.warn(`No credential found. Service: [${t}], Key: [${r}]`);return}return this.deserialize(n)}catch(n){n instanceof Error?this.log.error(`Deserialization error for Service: [${t}], Key: [${r}]. Error: ${gf(n)}`):this.log.error(`Failed to retrieve credential. Service: [${t}], Key: [${r}]. Error: ${gf(n)}`);return}}async delete(t,r){if(!this.validateInput(t,r))return!1;try{let n=await this.keyring.deletePassword(t,r);return n?this.log.info(`Credential deleted. Service: [${t}], Key: [${r}]`):this.log.warn(`No credential to delete. Service: [${t}], Key: [${r}]`),n}catch(n){return this.log.error(`Failed to delete credential. Service: [${t}], Key: [${r}]. Error: ${gf(n)}`),!1}}async getAll(t){let r={};try{let n=await this.keyring.findCredentials(t);return!n||n.length===0?(this.log.warn(`No credentials found for Service: [${t}]`),r):(n.forEach(({account:i,password:s})=>{if(i)try{let o=this.deserialize(s);r[i]=o}catch(o){this.log.error(`Failed to parse credential for Account: [${i}]. Error: ${gf(o)}`)}}),this.log.info(`All credentials retrieved. Service: [${t}], Count: ${Object.keys(r).length}`),r)}catch(n){return this.log.error(`Failed to retrieve credentials for Service: [${t}]. Error: ${gf(n)}`),r}}};var Gx=require("node:path"),yOt=require("node:os"),EOt=require("node:module"),s8=Te(require("node:fs"),1),mOt=(0,EOt.createRequire)(__importMetaUrl);function gOt(e){let t=e?".vscode-insiders":".vscode",r=(0,Gx.join)((0,yOt.homedir)(),t,"extensions");return s8.default.existsSync(r)?s8.default.readdirSync(r).filter(i=>i.startsWith("sapse.sap-ux-application-modeler-extension")).map(i=>{let s=(0,Gx.join)(r,i),o=(0,Gx.join)(s,"node_modules/@zowe/secrets-for-zowe-sdk/package.json");return s8.default.existsSync(o)?(0,Gx.dirname)(o):""}).filter(i=>i!==""):[]}function _bn(e){try{return mOt("@zowe/secrets-for-zowe-sdk").keyring}catch(t){e.warn(gf(t)),e.debug("Attempting to load Zowe secrets SDK from fallback locations.");try{let r=[...gOt(!1),...gOt(!0)];e.debug(`Discovered fallback directories: ${JSON.stringify(r)}`);for(let n of r)try{return e.debug(`Attempting to load Zowe secrets SDK from: ${n}`),typeof __non_webpack_require__=="function"?__non_webpack_require__(n):mOt(n)}catch(i){e.warn(`Failed to load Zowe secrets SDK from ${n}: ${gf(i)}`)}}catch(r){e.warn(`Error while discovering fallback paths: ${gf(r)}`)}e.warn("Unable to load Zowe secrets SDK from any location.");return}}var o8=e=>{if(fOt()||process.env.FIORI_TOOLS_DISABLE_SECURE_STORE)return e.debug("Secure store disabled, using DummyStore."),new _L(e);let t=_bn(e);return t?(e.debug("Using KeyStoreManager for secure storage."),new i8(e,t)):(e.debug("Falling back to DummyStore as secure storage could not be initialized."),new _L(e))};var wVi=Te(vOt(),1),Aye=Symbol("serializable");function hl(e,t){let r=Reflect.getOwnMetadata(Aye,e.constructor)||new Set;Reflect.defineMetadata(Aye,r.add(t),e.constructor)}function SOt(e){let t=Reflect.getOwnMetadata(Aye,e.constructor);return t&&Array.from(t.values())||[]}var xye=Symbol("sensitive");function mS(e,t){let r=Reflect.getOwnMetadata(xye,e.constructor)||new Set;Reflect.defineMetadata(xye,r.add(t),e.constructor)}function a8(e){let t=Reflect.getOwnMetadata(xye,e.constructor);return t&&Array.from(t.values())||[]}var vL=require("node:util");function u8(e){return"fiori/v2/"+e}var wye=class{logger;filesystem;secureStore;constructor(t,r={}){this.logger=t,this.filesystem=n8(this.logger,r),this.secureStore=o8(this.logger)}async read({entityName:t,id:r}){let n=await this.filesystem.read({entityName:t,id:r});n?this.logger.debug(`hybrid/read - id: [${r}], filesystem: ${(0,vL.inspect)(n)}`):this.logger.debug(`hybrid/read - id: [${r}], nothing on the filesystem`);let i=await this.secureStore.retrieve(u8(t),r);if(i?this.logger.debug(`hybrid/read - id: [${r}]. Found sensitive data in secure store`):this.logger.debug(`hybrid/read - id: [${r}], nothing in the secure store`),n||i)return{...n,...i}}async getAll({entityName:t,includeSensitiveData:r=!0}){return Object.values(await this.readAll({entityName:t,includeSensitiveData:r}))}async readAll({entityName:t,includeSensitiveData:r=!0}){let n={},i=await this.filesystem.readAll({entityName:t})||{},s=Object.keys(i).length===0;if(!r&&!s)return i;let o=await this.secureStore.getAll(u8(t))||{};for(let a of new Set([...Object.keys(i),...Object.keys(o)])){let u={...i[a],...o[a]};n[a]=u}return n}async write({entityName:t,id:r,entity:n}){let i=SOt(n),s=a8(n);if(i.length>0&&s.length>0)for(let u=0;u<i.length;u=u+1)s.indexOf(i[u])!==-1&&(this.logger.debug(`hybrid/write - [${String(i[u])}] is also marked as sensitive. Not writing to filesystem`),i.splice(u,1));let o=Sye(n,...i);gL(n,i)?(this.logger.debug(`hybrid/write - writing serializable properties: ${(0,vL.inspect)(o)}`),await this.filesystem.write({entityName:t,id:r,entity:o})):this.logger.debug(`hybrid/write - no serializable properties found in ${(0,vL.inspect)(o)}`);let a=Sye(n,...s);return gL(a,s)?(this.logger.debug(`hybrid/write - writing sensitive properties to secure store. ID: [${r}]`),await this.secureStore.save(u8(t),r,a)):this.logger.debug(`hybrid/write - no sensitive properties found in ${(0,vL.inspect)(n)}`),n}async del({entityName:t,id:r}){let n=await this.filesystem.del({entityName:t,id:r});this.logger.debug(`hybrid/del - delete result for id [${r}] on the filesystem: ${n}`);let i=await this.secureStore.delete(u8(t),r);return this.logger.debug(`hybrid/del - delete result for id [${r}] in the secure store: ${i}`),n||i}async partialUpdate({entityName:t,id:r,entity:n}){return this.filesystem.partialUpdate({entityName:t,id:r,entity:n})}};function c8(e,t){return new wye(e,t)}var ec=function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},tc=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},ai=class{name;url;client;userDisplayName;systemType;connectionType;authenticationType;hasSensitiveData;systemInfo;serviceKeys;refreshToken;username;password;constructor({name:t,url:r,client:n,systemType:i,serviceKeys:s,refreshToken:o,username:a,password:u,userDisplayName:c,authenticationType:l,connectionType:f,systemInfo:p}){this.name=t,this.url=r,this.client=n,this.systemType=i,this.serviceKeys=s,this.refreshToken=o,this.username=a,this.password=u,this.userDisplayName=c,this.authenticationType=l,this.connectionType=f;let d=a8(this);this.hasSensitiveData=gL(this,d),this.systemInfo=p}};ec([hl,tc("design:type",String)],ai.prototype,"name",void 0);ec([hl,tc("design:type",String)],ai.prototype,"url",void 0);ec([hl,tc("design:type",String)],ai.prototype,"client",void 0);ec([hl,tc("design:type",String)],ai.prototype,"userDisplayName",void 0);ec([hl,tc("design:type",String)],ai.prototype,"systemType",void 0);ec([hl,tc("design:type",String)],ai.prototype,"connectionType",void 0);ec([hl,tc("design:type",String)],ai.prototype,"authenticationType",void 0);ec([hl,tc("design:type",Boolean)],ai.prototype,"hasSensitiveData",void 0);ec([hl,tc("design:type",Object)],ai.prototype,"systemInfo",void 0);ec([mS,tc("design:type",Object)],ai.prototype,"serviceKeys",void 0);ec([mS,tc("design:type",String)],ai.prototype,"refreshToken",void 0);ec([mS,tc("design:type",String)],ai.prototype,"username",void 0);ec([mS,tc("design:type",String)],ai.prototype,"password",void 0);var la=class e{url;client;static from(t){return new e({url:t.url,client:t.client})}constructor({url:t,client:r}){this.url=t.trim().replace(/\/$/,""),this.client=r?.trim()}getId(){return this.url+`${this.client?"/"+this.client:""}`}};var Ey;(function(e){e.BackendSystem="system",e.SystemMigrationStatus="systemMigrationStatus",e.TelemetrySetting="telemetrySetting",e.ApiHub="apiHub"})(Ey||(Ey={}));var Oye=require("node:path"),l8=require("node:fs"),TOt=class{dataAccessor;entityName=Ey.BackendSystem;logger;constructor(e,t={}){this.logger=e,this.dataAccessor=c8(this.logger,t)}async read(e){return this.dataAccessor.read({entityName:this.entityName,id:e.getId()})}async write(e){let t;return e instanceof ai?t=e:t=new ai({...e}),this.dataAccessor.write({entityName:this.entityName,id:la.from(e).getId(),entity:t})}async delete(e){return this.dataAccessor.del({entityName:this.entityName,id:la.from(e).getId()})}async getAll(e){let t=this.isMigrationRequired(),{includeSensitiveData:r=!0,backendSystemFilter:n}=e??{},i=await this.dataAccessor.readAll({entityName:this.entityName,includeSensitiveData:t?!0:r});return await this.migrateBackendSystems(i,r)||(i=await this.dataAccessor.readAll({entityName:this.entityName,includeSensitiveData:r})),this.applyFilters(Object.values(i),n)}isMigrationRequired(){let e=(0,Oye.join)(yy(),".systemsMigrated");try{let t=(0,l8.readFileSync)(e,"utf-8");return!JSON.parse(t)?.backendSystemMigrationV1}catch{return!0}}applyFilters(e,t={}){return t.connectionType||(t.connectionType="abap_catalog"),e.filter(r=>Tye(r,t))}async migrateBackendSystems(e,t){let r=!0;for(let[n,i]of Object.entries(e)){if(i?.hasSensitiveData!==void 0&&i?.systemType!==void 0&&i?.connectionType!==void 0)continue;r=!1;let o=await this.buildMigratedSystem(i,t,n);await this.dataAccessor.partialUpdate({entityName:this.entityName,id:n,entity:{hasSensitiveData:o.hasSensitiveData,systemType:o.systemType,connectionType:o.connectionType}})}if(!r){let n=(0,Oye.join)(yy(),".systemsMigrated"),i={backendSystemMigrationV1:new Date().toISOString()};(0,l8.writeFileSync)(n,JSON.stringify(i,null,2))}return r}async buildMigratedSystem(e,t,r){let n=e;t||(n=await this.dataAccessor.read({entityName:this.entityName,id:r}));let i=n.systemType??mL(n)??"OnPrem",s=n?.connectionType??Eye.AbapCatalog;return new ai({...n,systemType:i,connectionType:s})}};var rc=require("node:fs"),Hx=require("node:path");var Cye=class{dataProvider;logger;constructor(t,r={}){this.logger=t,this.dataProvider=new TOt(this.logger,r)}async partialUpdate(t,r){this.validatePartialUpdateInput(r);let n=await this.readOrThrow(t),i=this.mergeProperties(r,n);return this.write(i,{force:!0})}mergeProperties(t,r){let n={...t};delete n.url,delete n.client;let i={...r,...n};return new ai({...i})}async readOrThrow(t){let r=await this.read(t);if(!r)throw new Error(Zu("error.systemDoesNotExist",{system:t}));return r}validatePartialUpdateInput(t){if(!t||!Object.keys(t).length)throw new Error(Zu("error.noPropertiesSpecified"))}async read(t){return this.dataProvider.read(t)}async write(t,r){let n=la.from(t),i=await this.read(la.from(t));if(!r?.force&&i)throw new Error(Zu("error.backendSystemEntityKeyExists",{entityKey:n.getId()}));return this.dataProvider.write(t)}async delete(t){return this.dataProvider.delete(t)}async getAll(t){return this.dataProvider.getAll(t)}};function bOt(e,t={}){if(!t.baseDirectory){try{vbn()}catch(r){e.error(Zu("error.systemsJsonMigrationFailed",{error:r.message}))}t.baseDirectory=yy()}return new Cye(e,t)}function vbn(){let e=EL(pS.BackendSystem),t=(0,Hx.join)(yL(),e),r=(0,Hx.join)(yy(),e),n=(0,Hx.join)(yy(),".systemsMigrated");if(!(0,rc.existsSync)(t))return;let i=JSON.parse((0,rc.readFileSync)(t,"utf-8")).systems;(0,rc.existsSync)(n)?Sbn(r,i):((0,rc.mkdirSync)((0,Hx.dirname)(r),{recursive:!0}),(0,rc.writeFileSync)(r,JSON.stringify({systems:i},null,2)),(0,rc.writeFileSync)(n,new Date().toISOString()));let s={};for(let[o,a]of Object.entries(i))s[o]={...a,_migrated:!0};(0,rc.writeFileSync)(t,JSON.stringify({systems:{...s}},null,2))}function Sbn(e,t){let r=!1,n={};for(let[i,s]of Object.entries(t))s._migrated||(n[i]={...s},r=!0);if(r){let i=JSON.parse((0,rc.readFileSync)(e,"utf-8")).systems;(0,rc.writeFileSync)(e,JSON.stringify({systems:{...i,...n}},null,2))}}var Tbn=function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},bbn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},SL=class{enableTelemetry;constructor({enableTelemetry:t}){this.enableTelemetry=t}};Tbn([hl,bbn("design:type",Boolean)],SL.prototype,"enableTelemetry",void 0);var _y=class{getId(){return"telemetrySetting"}};var AOt=class{dataAccessor;entityName=Ey.TelemetrySetting;logger;constructor(e){this.logger=e,this.dataAccessor=n8(this.logger)}read(e){return this.dataAccessor.read({entityName:this.entityName,id:e.getId()})}write(e){return this.dataAccessor.write({entityName:this.entityName,id:new _y().getId(),entity:e})}delete(e){return this.dataAccessor.del({entityName:this.entityName,id:new _y().getId()})}getAll(){return this.dataAccessor.getAll({entityName:this.entityName})}};var Pye=class{dataProvider;logger;constructor(t){this.logger=t,this.dataProvider=new AOt(this.logger)}async partialUpdate(){throw new Error("NOT IMPLEMENTED")}async read(t){return this.dataProvider.read(t)}async write(t){return this.dataProvider.write(t)}async delete(t){return this.dataProvider.delete(t)}async getAll(){return this.dataProvider.getAll()}};function xOt(e){return new Pye(e)}var Abn=function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},xbn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},TL=class{apiKey;constructor({apiKey:t}){this.apiKey=t}};Abn([mS,xbn("design:type",String)],TL.prototype,"apiKey",void 0);var Nh=class e{static SINGLETON="API_HUB_API_KEY";getId(){return e.SINGLETON}};var wOt=class{dataAccessor;entityName=Ey.ApiHub;logger;constructor(e,t={}){this.logger=e,this.dataAccessor=c8(this.logger,t)}read(e){return this.dataAccessor.read({entityName:this.entityName,id:e.getId()})}write(e){return this.dataAccessor.write({entityName:this.entityName,id:Nh.SINGLETON,entity:e})}delete(e){return this.dataAccessor.del({entityName:this.entityName,id:Nh.SINGLETON})}getAll(){return this.dataAccessor.getAll({entityName:this.entityName})}};var OOt="fiori/system/apiHub",COt="API_HUB_API_KEY";async function POt({dataProvider:e,secureStore:t,logger:r}){let n=await t.retrieve(OOt,COt);if(n)r.info(Zu("info.legacyApiHubKeyFound"));else{r.debug(Zu("info.noLegacyApiHubKeyFound"));return}await e.read(new Nh)?r.info(Zu("info.legacyApiHubKeyNotMigrated")):(await e.write(new TL({apiKey:n})),r.info(Zu("info.legacyApiHubKeyMigrated"))),await t.delete(OOt,COt),r.info(Zu("info.legacyApiHubKeyDeleted"))}var f8=class{dataProvider;logger;secureStore;migrationDone=!1;key=new Nh;constructor(t){this.logger=t,this.dataProvider=new wOt(this.logger)}async migrate(){this.migrationDone||(this.secureStore||(this.secureStore=o8(this.logger)),await POt({logger:this.logger,secureStore:this.secureStore,dataProvider:this.dataProvider}),this.migrationDone=!0)}async partialUpdate(){throw await this.migrate(),new Error("NOT IMPLEMENTED")}async read(){return await this.migrate(),this.dataProvider.read(this.key)}async write(t){return await this.migrate(),this.dataProvider.write(t)}async delete(t){return await this.migrate(),this.dataProvider.delete(t)}async getAll(){return await this.migrate(),this.dataProvider.getAll()}};function DOt(e){return new f8(e)}var ROt=()=>new ys({transports:[new Cm]});var wbn={system:bOt,telemetrySetting:xOt,"api-hub":DOt};async function gS({logger:e=ROt(),entityName:t,options:r={}}){await cOt();let n=wbn[t];if(n)return n(e,r);throw new Error(Zu("error.unsupportedEntity",{entityName:t}))}var NOt=Te(require("node:os"),1),IOt=Te(require("node:path"),1),LOt=Te(require("node:fs"),1);var Obn={win32:"\\AppData\\Roaming\\Code\\User\\settings.json",darwin:"/Library/Application Support/Code/User/settings.json",linux:"/.config/Code/User/settings.json",theia:"/.theia/settings.json"},Cbn=["sap.ux.annotation.lsp.enableTelemetry","sap.ux.applicationModeler.enableTelemetry","sap.ux.help.enableTelemetry","sap.ux.serviceModeler.enableTelemetry"],Pbn=e=>{let t=process.platform,r=e[t];if(jr()&&(r=e.theia),!r)return null;let n=NOt.default.homedir();return IOt.default.join(n,r)};async function Dbn(e){let t;try{t=await e.read(new _y)}catch{}if(t)Eo.telemetryEnabled=t.enableTelemetry;else{let r=Pbn(Obn);if(!r)await p8(!0);else{let n;try{n=await LOt.default.promises.readFile(r,"utf-8");let i=JSON.parse(n),o=Cbn.map(a=>i[a]??!0).reduce((a,u)=>a&&u,!0);await p8(o)}catch{await p8(!0)}}}}function Rbn(e){r8(pS.TelemetrySetting,()=>{e.read(new _y).then(t=>{t&&(Eo.telemetryEnabled=t.enableTelemetry)}).catch(()=>{})})}var bL=async e=>{try{Eo.consumerModuleName=e.consumerModule.name,Eo.consumerModuleVersion=e.consumerModule.version,J5.internalFeature=e.internalFeature??!1,e.resourceId&&(Eo.azureInstrumentationKey=e.resourceId);let t=await gS({entityName:"telemetrySetting"});await Dbn(t),e.watchTelemetrySettingStore&&Rbn(t)}catch(t){oOt(t)}};async function p8(e){try{let r=await gS({entityName:"telemetrySetting"}),n=new SL({enableTelemetry:e});await r.write(n),Eo.telemetryEnabled=e}catch{}let t=await fye();aOt(e,t)}var nc=class e{static clientMap=new Map;static getTelemetryClient(){return e.getTelemetryClientByClass(kR)}static getTelemetryClientByClass(t){let r=e.clientMap.get(t.name);if(r)return r;let n=t;return r=new n(Eo.azureInstrumentationKey,Eo.consumerModuleName,Eo.consumerModuleVersion),e.clientMap.set(t.name,r),r}};var ml;(function(e){e.START_MARK="START_MARK",e.END_MARK="END_MARK",e.MEASUREMENT="MEASUREMENT"})(ml||(ml={}));var d8=class{static initTiming;static enteries;static initialize;static startMark;static endMark;static measure;static getEntries;static getEntriesByName;static getEntriesByType;static getEntriesByNameType;static getMeasurementDuration;static clearEntries};var AL=class{startTime;name;type;getStartTime(){return this.startTime}constructor(t,r,n){this.startTime=n,this.name=t,this.startTime=n,this.type=r}},h8=class extends AL{startTime;duration;constructor(t,r,n){super(t,ml.MEASUREMENT,r),this.startTime=r,this.duration=n,this.duration=n}getDurationTime(){return this.duration}};var MOt=require("node:perf_hooks"),Nbn=()=>MOt.performance.now(),ws=class e extends d8{static initTiming;static now=Nbn;static entries=[];static initialize(){e.initTiming=e.now()}static mark(t,r,n){let i=new AL(t,r,n);e.entries.push(i)}static startMark(t){let r=e.now(),n=t+r;return e.mark(n,ml.START_MARK,r),n}static endMark(t){let r=e.now();e.mark(t,ml.END_MARK,r)}static measure(t){let r=e.getEntriesByNameType(t,ml.START_MARK).slice(-1)[0],n=e.getEntriesByNameType(t,ml.END_MARK).slice(-1)[0];if(!r&&!n)throw new Error(`Failed to execute 'measure': mark '${t}' doesn't exist.`);if(!r||!n){let u=r?ml.END_MARK:ml.START_MARK;throw new Error(`Failed to execute 'measure': mark '${t}'of type '${u}' doesn't exist.`)}let i=r.getStartTime(),o=n.getStartTime()-i,a=new h8(`${t}`,e.now(),o);e.entries.push(a)}static getEntries(){return e.entries}static getEntriesByName(t){return e.entries.filter(r=>r.name===t)}static getEntriesByNameType(t,r){return e.entries.filter(n=>n.name===t&&n.type===r)}static getEntriesByType(t){return e.entries.filter(r=>r.type===t)}static getMeasurementDuration(t){return e.getEntriesByNameType(t,ml.MEASUREMENT).slice(-1)[0].getDurationTime()}static clearEntries(){e.entries=[]}};ws.initialize();var Ibn=(e,t)=>new Error(`Wrong path for '${e}' field is specified in instructions with index - ${t}`),Lbn=(e,t,r,n)=>{let i=t.split("/"),s=e,o=0;for(;o<i.length;){if(s=s[i[o]],s===void 0)throw Ibn(r,n);o++}return s},FOt=(e,t)=>{let r={},n={},i=null;t.paramIndex!==void 0&&(i=e[t.paramIndex]);let s=t.key?t.key:"data",o="";return typeof t.value=="string"?o=t.value:t.value!==void 0&&t.paramIndex!==void 0?o=Lbn(i,t.value.path,"val",t.paramIndex):o=i,typeof o=="number"&&!Number.isNaN(o)?n[s]=o:r[s]=o,[r,n]},Dye=(e,t)=>{let r,n,i={},s={};if(Array.isArray(t))for(let o of t)[r,n]=FOt(e,o),i={...i,...r},s={...s,...n};else[i,s]=FOt(e,t);return[i,s]};var UOt=(e,t,r,n)=>(...i)=>{let s=t.apply(e,i);return nc.getTelemetryClient().report(r,{},{},n),s},kOt=(e,t,r,n)=>async(...i)=>{let s=await t.apply(e,i);return nc.getTelemetryClient().report(r,{},{},n),s},BOt=(e,t,r,n)=>(...i)=>{let s=ws.startMark("mark"),o=t.apply(e,i);ws.endMark(s),ws.measure(s);let a=ws.getMeasurementDuration(s);return nc.getTelemetryClient().report(r,{},{ms:a},n),o},qOt=(e,t,r,n)=>async(...i)=>{let s=ws.startMark("mark"),o=await t.apply(e,i);ws.endMark(s),ws.measure(s);let a=ws.getMeasurementDuration(s);return nc.getTelemetryClient().report(r,{},{ms:a},n),o},jOt=(e,t,r,n,i)=>(...s)=>{let o=t.apply(e,s),[a,u]=Dye(s,i);return nc.getTelemetryClient().report(r,a,u,n),o},VOt=(e,t,r,n,i)=>async(...s)=>{let o=await t.apply(e,s),[a,u]=Dye(s,i);return nc.getTelemetryClient().report(r,a,u,n),o};var Ih;(function(e){e.NOTIFICATION="notify",e.DURATION="duration",e.CAPTURE_PARAM="captureParam"})(Ih||(Ih={}));var m8=new Map;m8.set(Ih.NOTIFICATION,UOt);m8.set(Ih.DURATION,BOt);m8.set(Ih.CAPTURE_PARAM,jOt);var g8=new Map;g8.set(Ih.NOTIFICATION,kOt);g8.set(Ih.DURATION,qOt);g8.set(Ih.CAPTURE_PARAM,VOt);var KCt=Te(F8(),1);var vS=class e{static _telemetryData;static _previousEventTimestamp;static get telemetryData(){return this._telemetryData}static async initTelemetrySettings(t){await bL(t)}static createTelemetryData(t,r=!1){let n=new Date().getTime();if(this._previousEventTimestamp||(r=!1,this._previousEventTimestamp=n),!this._telemetryData){let i=tg("telemetry.unknownOs");try{i=(0,KCt.default)()}catch{}this._telemetryData={Platform:Uc().technical,OperatingSystem:i}}if(r){let i={...this._telemetryData,...t};if(Math.abs(this._previousEventTimestamp-n)<1e3&&JSON.stringify(i)===JSON.stringify(this._telemetryData))return}return this._previousEventTimestamp=n,this._telemetryData=Object.assign(this._telemetryData,t),this._telemetryData}static markAppGenStartTime(){e.createTelemetryData({markName:ws.startMark("LOADING_TIME")})}static markAppGenEndTime(){this._telemetryData?.markName&&(ws.endMark(this._telemetryData.markName),ws.measure(this._telemetryData.markName))}};var i1n=Te(PIt(),1),c4=Te(z0(),1);var{getExtensionLogger:s1n}=i1n,o1n="ApplicationWizard.loggingLevel",f4={fatal:e=>{console.log(e)},error:e=>{console.error(e)},warn:e=>{console.warn(e)},info:e=>{console.log(e)},debug:e=>{console.log(e)},trace:e=>{console.trace(e)},getChildLogger:()=>f4,getLogLevel:()=>"off",log:function(e){console.log(e instanceof Object?e.message:e)},add:function(){return console.warn("Log method `add(transport)` not implemented."),this},remove:function(){return console.warn("Log method `remove(transport)` not implemented."),this},transports:function(){return console.warn("Logger method `transports()` not implemented."),[]},child:function(){return console.warn("Log method `remove(transport)` not implemented. Returning current logger."),this}},DIt={off:-1,fatal:0,error:1,warn:2,info:3,debug:4,trace:5};function a1n(e,t="off"){return s1n({extName:e,level:t,logConsole:!0})}var l4=class e{static _vscodeLogger;static _yoLogger;static _logLevel;static consoleFormat=c4.format.combine(c4.format.timestamp({format:"YYYY-MM-DD HH:mm:ss"}),c4.format.printf(t=>`[${t.timestamp}] ${t.level.toUpperCase()}: ${t.message}`));constructor(t,r,n,i,s){e._yoLogger=r,i?(e._logLevel=s?s.workspace.getConfiguration().get(o1n):n??"info",e._vscodeLogger=i.getChildLogger({label:t})):(e._yoLogger||(e._vscodeLogger=a1n(t,n)),e._logLevel=n==="off"||!n?"info":n),e._vscodeLogger?.debug(tg("logMessages.debug.loggingConfigured",{logLevel:e._logLevel}))}static logAtLevel=(t,r,...n)=>{typeof r=="object"&&(r=JSON.stringify(r)),e._vscodeLogger&&t!=="off"&&e._vscodeLogger[t](r,...n),e._yoLogger?DIt[t]<=DIt[e._logLevel]&&e._yoLogger(e.consoleFormat.transform({level:t,message:r})[Symbol.for("message")]):f4.error(tg("logMessages.error.logWrapperNotInitialised"))};fatal(t,...r){e.logAtLevel("fatal",t,...r)}error(t,...r){e.logAtLevel("error",t,...r)}warn(t,...r){e.logAtLevel("warn",t,...r)}info(t,...r){e.logAtLevel("info",t,...r)}debug(t,...r){e.logAtLevel("debug",t,...r)}trace(t,...r){e.logAtLevel("trace",t,...r)}static log(t){e.logAtLevel("info",t)}getLogLevel(){return e._logLevel}getChildLogger(){return e.logAtLevel("trace","Log method `getChildLogger()` not implemented. Returning current logger."),this}log(t){e.logAtLevel("info",t.message??t)}add(){return e.logAtLevel("warn","Log method `add(transport)` not implemented."),this}remove(){return e.logAtLevel("warn","Log method `remove(transport)` not implemented."),this}transports(){return e.logAtLevel("warn","Log method `transports()` not implemented."),[]}child(){return e.logAtLevel("warn","Log method `child(options)` not implemented. Returning current logger."),this}};var RIt=Te(require("node:os"),1),NIt=require("node:path"),IIt=Te(ea(),1);var N5i=(0,NIt.join)(RIt.default.homedir(),"projects");var f_e=require("node:path"),LIt=require("node:url"),L5i=(0,f_e.dirname)((0,LIt.fileURLToPath)(__importMetaUrl));function p_e(e,t){e.conflicter&&(e.conflicter.force=t??!0),e.conflicterOptions&&(e.conflicterOptions.force=t??!0)}var L4=require("node:path"),lMt=require("node:url"),sNn=Te(CI(),1),oNn=Te(Mx(),1);var BIt=Te(CI(),1),qIt=Te(Mx(),1);var MIt=require("node:path");function FIt(e,t,r){let n=(0,MIt.join)(t,"package.json"),i=e.readJSON(n);u1n(i,r?.mockserverModule,r?.mockserverVersion),c1n(e,i),e.writeJSON(n,i)}function u1n(e,t="@sap-ux/ui5-middleware-fe-mockserver",r="2"){if(e.devDependencies=e.devDependencies??{},delete e.devDependencies["@sap/ux-ui5-fe-mockserver-middleware"],e.devDependencies[t]=r,f1n(e.devDependencies))d1n(e);else{e.ui5||={},e.ui5.dependencies||=[];let n=e.ui5.dependencies.filter(i=>i!=="@sap/ux-ui5-fe-mockserver-middleware");n.includes(t)||n.push(t),e.ui5.dependencies=n}}function c1n(e,t){t.scripts||={},t.scripts["start-mock"]=l1n(t.scripts.start)??t.scripts["start-mock"]??'fiori run --config ./ui5-mock.yaml --open "/"'}function l1n(e){if(typeof e!="string")return;let t="fiori run",r=e.indexOf(t);if(r<0)return;let n=e.indexOf("--config",r);return n<0?e.replace(t,`${t} --config ./ui5-mock.yaml`):p1n(e,n)}function f1n(e){let t=!1;try{let r=e["@ui5/cli"];typeof r=="string"&&(t=Number.parseInt(r.split(".")[0].match(/\d+/)?.[0]||"0",10)>2)}catch{}return t}function p1n(e,t){let r=t+8+1,n=e.slice(r).search(/[^\s]/)+r,i=" ",s=0;(e[n]==='"'||e[n]==="'")&&(i=e[n],s=1);let o=e.indexOf(i,n+s);return o=o===-1?e.length:o+s,`${e.substring(0,r)}./ui5-mock.yaml${e.substring(o)}`}function d1n(e){let t=new Set(["@sap/ux-ui5-fe-mockserver-middleware","@sap-ux/ui5-middleware-fe-mockserver"]);e.ui5?.dependencies&&Array.isArray(e.ui5.dependencies)&&(e.ui5.dependencies=e.ui5.dependencies.filter(r=>!t.has(r)),e.ui5.dependencies.length===0&&delete e.ui5.dependencies),e.ui5&&Object.keys(e.ui5).length===0&&delete e.ui5}var Ks=require("node:path");function p4(e,t="OData"){let r={},n=e["sap.app"]?.dataSources??{};for(let i in n)n[i].uri&&n[i].type===t&&(r[i]=n[i]);return r}async function UIt(e,t,r,n){let i=!!n?.overwrite,s=(0,Ks.join)(t,"ui5-mock.yaml"),o,a=e.readJSON((0,Ks.join)(r,"manifest.json")),u=Object.values(p4(a,"ODataAnnotation")),c=[];u.forEach(d=>{if(d.settings?.localUri!==d.uri){let h=d.settings?.localUri;c.push({localPath:h?`.${Ks.posix.sep}${(0,Ks.relative)(t,(0,Ks.join)(r,h)).replaceAll(Ks.sep,Ks.posix.sep)}`:void 0,urlPath:d.uri})}});let l=p4(a),f=[];for(let d in l){let h=l[d].settings?.localUri,g=n?.resolveExternalServiceReferences?.[d];f.push({serviceName:d,servicePath:l[d].uri,metadataPath:h?`.${Ks.posix.sep}${(0,Ks.relative)(t,(0,Ks.join)(r,h)).replaceAll(Ks.sep,Ks.posix.sep)}`:void 0,resolveExternalServiceReferences:g})}e.exists(s)?o=await h1n(e,t,r,s,f,c,i):o=e.exists((0,Ks.join)(t,"ui5.yaml"))?await m1n(e,t,r,f,c):await g1n(a["sap.app"]?.id||"",t,r,f,c);let p=o.toString();e.write(s,p)}async function h1n(e,t,r,n,i,s,o=!1){let a=await Co.newInstance(e.read(n));if(o){let u=await kIt(t,r,i,s);a.updateCustomMiddleware(u)}else for(let u in i)a.addServiceToMockserverMiddleware(t,r,i[u],s);return a}async function m1n(e,t,r,n,i){let s=await bx(t,vt.Ui5Yaml,e),o=await kIt(t,r,n,i);return s.updateCustomMiddleware(o),s}async function g1n(e,t,r,n,i){let s=await Co.newInstance(`# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
722
722
 
723
- specVersion: "2.5"`);return s.setMetadata({name:e}),s.setType("application"),s.addFioriToolsProxyMiddleware({ui5:{}}),s.addFioriToolsAppReloadMiddleware(),s.addMockServerMiddleware(t,r,n,i),s}async function kIt(e,t,r,n){let i=await Co.newInstance("");i.addMockServerMiddleware(e,t,r,n);let s=i.findCustomMiddleware("sap-fe-mockserver");if(!s)throw Error("Could not create new mockserver config");return s}async function d4(e,t,r){return r||(r=(0,qIt.create)((0,BIt.create)())),t.packageJsonConfig?.skip||FIt(r,e,t.packageJsonConfig),await UIt(r,e,t.webappPath,t.ui5MockYamlConfig),r}var y1n=Te(CI(),1),E1n=Te(Mx(),1);var jIt={questions:{pathToMock:"Path to mocked service",overwrite:"Overwrite services"}};var d_e="mockserver-config-writer",VIt;async function S1n(){VIt=Ur.createInstance({resources:{en:{[d_e]:jIt}},lng:"en",fallbackLng:"en",defaultNS:d_e,ns:[d_e],showSupportNotice:!1}),await VIt.init()}S1n().catch(()=>{});var $It={error:{requiredProjectFileNotFound:"Invalid project structure. Cannot find the required file: {{-path}}.",requiredProjectPropertyNotFound:"The required project property: {{-property}} was not found in the file: {{-path}}.",requiredServiceAlreadyExists:"A service with the {{-uri}} URI already exists. Choose another service.",unparseableXML:"Unparseable XML was specified: {{-error}}."}};var h_e="odata-service-writer",b1n=Ur.createInstance();async function A1n(){await b1n.init({resources:{en:{[h_e]:$It}},lng:"en",fallbackLng:"en",defaultNS:h_e,ns:[h_e],showSupportNotice:!1})}A1n().catch(()=>{});var O1n=Te(h4(),1);var zn;(function(e){e.v2="2",e.v4="4"})(zn||(zn={}));var sM;(function(e){e.EDMX="edmx",e.CDS="cds"})(sM||(sM={}));var m_e="mainService";var I_e=require("node:path"),oMt=require("node:path/posix"),aMt=Te(h4(),1),uMt=Te(Oy(),1),cMt=Te(Py(),1);var iMt=4;function I4(e,t,r,n=m_e,i){if(!r.length||!i)return;let s=new Set;for(let o of r){let a=ZRn(i,o.path),u=[t,oi.LocalService,n,a],c=o.path.split(";")[0];if(o.entityData&&!s.has(c)){for(let f of o.entityData){let p=(0,I_e.join)(...u,`${f.entitySetName}.json`);e.write(p,JSON.stringify(f.items,void 0,iMt))}s.add(c)}o.type==="value-list"&&u.push(o.target),u.push("metadata.xml");let l=(0,I_e.join)(...u);o.metadata&&e.write(l,(0,aMt.default)(o.metadata,{indent:iMt}))}}function ZRn(e,t){let[r]=t.split(";"),n=r.split("/"),i="/",s=n.shift();for(;s!==void 0;){let o=(0,oMt.join)(i,s);if(!e.startsWith(o))break;i=o,s=n.shift()}return r.replace(i,"")}var N_e={valueListReferences:!0,codeLists:!0};function eNn(e){return e?{valueListReferences:e.valueListReferences??N_e.valueListReferences,codeLists:e.codeLists??N_e.codeLists}:{...N_e}}function lM(e,t,r=[],n){let i=eNn(n);if(!t)return[];let s=[t,...r.map(a=>a.Definitions)],o=[];for(let a of s){let u=typeof a=="string"?(0,uMt.convert)((0,cMt.parse)(a)):a;for(let c of Object.values(u.annotations))for(let l of c){let f=l.target.replace(u.namespace+".","");tNn(i,o,f,l,e)}}return o}function tNn(e,t,r,n,i){for(let s of n.annotations)rNn(e,t,r,s,i),nNn(e,t,s,i)}function rNn(e,t,r,n,i){if(e.valueListReferences&&n.term==="com.sap.vocabularies.Common.v1.ValueListReferences"){for(let s of n.collection??[])if(s.type==="String"){let o=s;t.push({type:"value-list",serviceRootPath:i,target:r,value:o.String})}}}function nNn(e,t,r,n){if(e.codeLists&&(r.term==="com.sap.vocabularies.CodeList.v1.CurrencyCodes"||r.term==="com.sap.vocabularies.CodeList.v1.UnitsOfMeasure")&&r.record){let i=sMt(r.record,"CollectionPath"),s=sMt(r.record,"Url");s&&t.push({type:"code-list",serviceRootPath:n,value:s,collectionPath:i??void 0})}}function sMt(e,t){let r=e.propertyValues.find(n=>n.name===t);if(r?.value?.type==="String")return r.value.String}var iNn=Te(ea(),1);var Z4i=(0,L4.dirname)((0,lMt.fileURLToPath)(__importMetaUrl));var ZS=require("node:path"),S4t=Te(h4()),T4t=Te(bUt());var AUt={errors:{odataQueryError:"An error occurred when querying for odata: {{error}}. $t(texts.seeLogForDetails)",dataNotFetched:"Data was not fetched",entityModelLoading:"An error occurred when reading the data model: {{- error}}. $t(texts.seeLogForDetails)"},info:{loggingInitialised:"Logger has been configure with level: {{logLevel}}",noServiceEntityData:"No service entity data to write.",noValueHelpData:"No Value Help service data to write.",entityFilesToBeGenerated:"The following entity files will be created: {{entities}}",noListEntityDefined:"No list entity defined. A main list entity is required to download data.",hierarchyEntityQuery:"Fetching hierarchy data for entity set: {{entitySetName}}...",hierarchyFilesGenerated:"The following hierarchy data files were created: {{entities}}"},texts:{seeLogForDetails:"For more information, view the logs.",rows_one:"{{count}} row",rows_other:"{{count}} rows",generatorTitle:"SAP Fiori Elements Data Downloader"},prompts:{appSelection:{message:"Select an application as data download target",breadcrumb:"Selected App",validation:{specficationApiVersionOutdated:"The found version of @sap/ux-specification {{specApiVersion}} is too old. Data download cannot proceed.",selectedPathDoesNotContainValidApp:"The selected path does not contain a valid application. {{- error}}",appMainServiceOdataVersionNotSupported:"The selected apps main service odata version is '{{serviceOdataVersion}}'. Please select an app with a main service odata version '4'."}},relatedEntitySelection:{message:"Select entities for data download (pre-selected entities are referenced by the application)",openLogs:"Show Logs"},toggleSelection:{message:"Reset selection",labelTrue:"Clear selected",labelFalse:"Restore default selection"},entityKey:{message:"Enter values for: {{keyName}}",hint:"For range selection use '-' between values. Use commas to select non-contiguous values.",validation:{invalidKeyValueChars:"Invalid key value contain not allowed characters: {{chars}}",invalidRangeSpecified:"Invalid range specified, only the lowest and highest values allowed. e.g. '1-10'",invalidBooleanValue:"Invalid Boolean value entered. Please enter true or false.",invalidGuidValue:"Invalid GUID format. Expected format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}},skipDataDownload:{message:"If data download is not required select this option and proceed to Value Help download",hint:"Use this to temporarily disable live queries when entering multiple inputs and re-enable when ready",labelTrue:"Execute the OData query (data files will be generated on finish)",labelFalse:"Suppress the OData query (prevents multiple queries during selections)",querySuccess:'OData query success. $t(texts.rows, {"count": "{{count}}") returned. $t(texts.seeLogForDetails)',validation:{keyRequired:"Please enter at least one key field value to run the OData query"},choiceLabel:"Skip data download"},updateMainServiceMetadata:{message:"Update local metadata file from backend (remote service metadata is always used for data download):",validation:{errorLoadingAppOrMainService:"An error occurred while loading the application. Please correct the issue to proceed: {{- error}}"}},valueHelpSelection:{message:"Select Value Help data"}},steps:{odataDownloader:{name:"Configure Data Download",description:"Download data from an OData service for use with the UX Tools Mockdata Server"},valueHelpSelection:{name:"Value Help selection",description:"Value Help selection"},addConstraints:{name:"Add Missing Constraints",description:"Add Missing Constraints"}},telemetry:{unknownOs:"Unknown"}};var xUt=Ur.createInstance(),e6="odata-dowload-generator";async function _ve(){await xUt.init({resources:{en:{[e6]:AUt}},lng:"en",fallbackLng:"en",defaultNS:e6,ns:[e6],missingInterpolationHandler:()=>"",showSupportNotice:!1})}function Nt(e,t){return t?.ns||(t=Object.assign(t??{},{ns:e6})),xUt.t(e,t)}_ve().catch(e=>console.error("Failed to initialize i18n:",e));var gbe=require("@sap-devx/yeoman-ui-types");var vve;(function(e){e.official="officialVersions",e.snapshot="snapshotsVersions",e.support="support"})(vve||(vve={}));var t6="1.65.0";var r6=Te(ea(),1);var TM=Te(ea(),1);var Ne={maintenance:"Maintenance",outOfMaintenance:"Out of maintenance",skipped:"Skipped"},XLn=[{version:"1.147.*",support:Ne.maintenance},{version:"1.146.*",support:Ne.maintenance},{version:"1.145.*",support:Ne.maintenance},{version:"1.144.*",support:Ne.outOfMaintenance},{version:"1.143.*",support:Ne.outOfMaintenance},{version:"1.142.*",support:Ne.maintenance},{version:"1.141.*",support:Ne.outOfMaintenance},{version:"1.140.*",support:Ne.outOfMaintenance},{version:"1.139.*",support:Ne.outOfMaintenance},{version:"1.138.*",support:Ne.outOfMaintenance},{version:"1.136.*",support:Ne.maintenance},{version:"1.135.*",support:Ne.outOfMaintenance},{version:"1.134.*",support:Ne.outOfMaintenance},{version:"1.133.*",support:Ne.outOfMaintenance},{version:"1.132.*",support:Ne.outOfMaintenance},{version:"1.131.*",support:Ne.outOfMaintenance},{version:"1.130.*",support:Ne.outOfMaintenance},{version:"1.129.*",support:Ne.outOfMaintenance},{version:"1.128.*",support:Ne.outOfMaintenance},{version:"1.127.*",support:Ne.outOfMaintenance},{version:"1.126.*",support:Ne.outOfMaintenance},{version:"1.125.*",support:Ne.outOfMaintenance},{version:"1.124.*",support:Ne.outOfMaintenance},{version:"1.123.*",support:Ne.outOfMaintenance},{version:"1.122.*",support:Ne.outOfMaintenance},{version:"1.121.*",support:Ne.outOfMaintenance},{version:"1.120.*",support:Ne.maintenance},{version:"1.119.*",support:Ne.outOfMaintenance},{version:"1.118.*",support:Ne.outOfMaintenance},{version:"1.117.*",support:Ne.outOfMaintenance},{version:"1.116.*",support:Ne.outOfMaintenance},{version:"1.115.*",support:Ne.outOfMaintenance},{version:"1.114.*",support:Ne.outOfMaintenance},{version:"1.113.*",support:Ne.outOfMaintenance},{version:"1.112.*",support:Ne.outOfMaintenance},{version:"1.111.*",support:Ne.outOfMaintenance},{version:"1.110.*",support:Ne.outOfMaintenance},{version:"1.109.*",support:Ne.outOfMaintenance},{version:"1.108.*",support:Ne.maintenance},{version:"1.107.*",support:Ne.outOfMaintenance},{version:"1.106.*",support:Ne.outOfMaintenance},{version:"1.105.*",support:Ne.outOfMaintenance},{version:"1.104.*",support:Ne.outOfMaintenance},{version:"1.103.*",support:Ne.outOfMaintenance},{version:"1.102.*",support:Ne.outOfMaintenance},{version:"1.101.*",support:Ne.outOfMaintenance},{version:"1.100.*",support:Ne.outOfMaintenance},{version:"1.99.*",support:Ne.outOfMaintenance},{version:"1.98.*",support:Ne.outOfMaintenance},{version:"1.97.*",support:Ne.outOfMaintenance},{version:"1.96.*",support:Ne.maintenance},{version:"1.95.*",support:Ne.outOfMaintenance},{version:"1.94.*",support:Ne.outOfMaintenance},{version:"1.93.*",support:Ne.outOfMaintenance},{version:"1.92.*",support:Ne.outOfMaintenance},{version:"1.91.*",support:Ne.outOfMaintenance},{version:"1.90.*",support:Ne.outOfMaintenance},{version:"1.89.*",support:Ne.outOfMaintenance},{version:"1.88.*",support:Ne.outOfMaintenance},{version:"1.87.*",support:Ne.outOfMaintenance},{version:"1.86.*",support:Ne.outOfMaintenance},{version:"1.85.*",support:Ne.outOfMaintenance},{version:"1.84.*",support:Ne.outOfMaintenance},{version:"1.82.*",support:Ne.outOfMaintenance},{version:"1.81.*",support:Ne.outOfMaintenance},{version:"1.80.*",support:Ne.outOfMaintenance},{version:"1.79.*",support:Ne.outOfMaintenance},{version:"1.78.*",support:Ne.outOfMaintenance},{version:"1.77.*",support:Ne.outOfMaintenance},{version:"1.76.*",support:Ne.outOfMaintenance},{version:"1.75.*",support:Ne.outOfMaintenance},{version:"1.74.*",support:Ne.outOfMaintenance},{version:"1.73.*",support:Ne.outOfMaintenance},{version:"1.72.*",support:Ne.outOfMaintenance},{version:"1.71.*",support:Ne.maintenance},{version:"1.70.*",support:Ne.outOfMaintenance},{version:"1.69.*",support:Ne.outOfMaintenance},{version:"1.68.*",support:Ne.outOfMaintenance},{version:"1.67.*",support:Ne.outOfMaintenance},{version:"1.66.*",support:Ne.outOfMaintenance},{version:"1.65.*",support:Ne.outOfMaintenance},{version:"1.64.*",support:Ne.outOfMaintenance},{version:"1.63.*",support:Ne.outOfMaintenance},{version:"1.62.*",support:Ne.outOfMaintenance},{version:"1.61.*",support:Ne.outOfMaintenance},{version:"1.60.*",support:Ne.outOfMaintenance},{version:"1.58.*",support:Ne.outOfMaintenance},{version:"1.56.*",support:Ne.outOfMaintenance},{version:"1.54.*",support:Ne.outOfMaintenance},{version:"1.52.*",support:Ne.outOfMaintenance},{version:"1.50.*",support:Ne.outOfMaintenance},{version:"1.48.*",support:Ne.outOfMaintenance},{version:"1.46.*",support:Ne.outOfMaintenance},{version:"1.44.*",support:Ne.outOfMaintenance},{version:"1.42.*",support:Ne.outOfMaintenance},{version:"1.40.*",support:Ne.outOfMaintenance},{version:"1.38.*",support:Ne.maintenance},{version:"1.36.*",support:Ne.outOfMaintenance},{version:"1.34.*",support:Ne.outOfMaintenance},{version:"1.32.*",support:Ne.outOfMaintenance},{version:"1.30.*",support:Ne.outOfMaintenance},{version:"1.28.*",support:Ne.outOfMaintenance},{version:"1.26.*",support:Ne.outOfMaintenance},{version:"1.24.*",support:Ne.outOfMaintenance},{version:"1.22.*",support:Ne.outOfMaintenance},{version:"*",support:Ne.outOfMaintenance}],Sve=XLn.filter(e=>e.support===Ne.maintenance&&(0,TM.gte)((0,TM.coerce)(e.version)??"0.0.0",t6)).map(e=>({version:(0,TM.coerce)(e.version)?.version??"0.0.0",support:Ne.maintenance})),JLn=[...Sve].map(e=>e.version);var Tve=Te(ea(),1);var eMn="1.72.0",CUt="1.102.0",tMn="1.136.0",rMn="1.120.0",ac;(function(e){e.SAP_BELIZE="sap_belize",e.SAP_FIORI_3="sap_fiori_3",e.SAP_FIORI_3_DARK="sap_fiori_3_dark",e.SAP_HORIZON="sap_horizon",e.SAP_HORIZON_DARK="sap_horizon_dark"})(ac||(ac={}));var nMn={[ac.SAP_BELIZE]:{id:ac.SAP_BELIZE,label:"Belize",supportUntil:tMn,deprecateSince:rMn},[ac.SAP_FIORI_3]:{id:ac.SAP_FIORI_3,label:"Quartz Light"},[ac.SAP_FIORI_3_DARK]:{id:ac.SAP_FIORI_3_DARK,label:"Quartz Dark",supportSince:eMn},[ac.SAP_HORIZON]:{id:ac.SAP_HORIZON,label:"Morning Horizon",supportSince:CUt},[ac.SAP_HORIZON_DARK]:{id:ac.SAP_HORIZON_DARK,label:"Evening Horizon",supportSince:CUt}};var kUt=Te(RUt(),1),Ave=Te(ea(),1);var NUt={prompts:{username:{message:"Username"},password:{message:"Password"}},ui5VersionLabels:{maintained:"Maintained",outOfMaintenance:"Out of maintenance",version_one:"version",version_other:"versions"},errors:{destination:{unavailable:"The selected destination references an instance that is not available. Please check your destination configuration and try again.",notFound:"The destination target URL cannot be found. The request failed with status code 404. Please check the destination target URL connectivity in your SAP BTP cockpit.",notReachable:"The selected system is not reachable. System Name: {{systemName}}, Error: {{- error}}.",misconfigured:'The destination is misconfigured. $t(errors.destination.missingPropMsg, {"destinationProperty": "{{destinationProperty}}" })',missingPropMsg:"The property: `{{destinationProperty}}` is missing.",httpConnectionError:"A connection error occurred with the selected destination. HTTP Code: {{- code}}. $t(texts.seeLogForDetails)"},unknownError:"An error occurred{{- error, addMsgWithColonFormatter}}",servicesUnavailable:"An error occurred retrieving services for the SAP System.",certificateError:"A certificate error has occurred{{- errorMsg, addMsgWithColonFormatter}}",urlCertValidationError:"The system URL is using {{certErrorReason}} security certificate.",authenticationFailed:"Authentication incorrect. {{- error}}",authenticationTimeout:"Authorization was not verified within the allowed time. Please ensure you have authenticated using the associated browser window.",invalidUrl:"Invalid URL{{-input, addMsgWithColonFormatter}}",connectionError:"A connection error occurred. Please ensure the target host is available on the network: {{- error}}",timeout:"A connection timeout error occurred{{- errorMsg, addMsgWithColonFormatter}}",serverReturnedAnError:"The server returned an error. {{- errorDesc}}",serverUnableToCompleteRequest:"The server was unable to complete the request. Please try again.",catalogServiceNotActive:"Catalog service is not active.",urlNotFound:"URL not found.",odataServiceUrlNotFound:"The service URL you have provided is not a valid OData Service. SAP Fiori applications require an OData service as the data source.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",redirectError:"A redirect response was received from the server",abapEnvsUnavailable:"ABAP environments unavailable.",noSuchHostError:"No such host is known. Ensure the host is available.",noAbapEnvsInCFSpace:"No ABAP environments in CF space found. Ensure an ABAP environment exists.",abapEnvsCFDiscoveryFailed:"Discovering ABAP Environments failed. Please ensure you are logged into Cloud Foundry. For more information, see https://docs.cloudfoundry.org/cf-cli/getting-started.html#login.",systemConnectionValidationFailed:"A connection to the selected system cannot be established. Ensure the credentials are valid.",internalServerError:"Internal server error{{-errorMsg, addMsgWithColonFormatter}}",badGateway:"Bad gateway{{- errorMsg, addMsgWithColonFormatter}}",badRequest:"Bad request{{- errorMsg, addMsgWithColonFormatter}}",cannotBeEmpty:"{{- field}} cannot be empty.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata."},guidedAnswers:{validationErrorHelpText:"Need help with this error?"},texts:{anExpiredCert:"an expired",aSelfSignedCert:"a self-signed",anUnknownOrInvalidCert:"an unknown or invalid",anUntrustedRootCert:"an untrusted root",suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, see the log.",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration."}};var IUt="inquirer-common",bve=Ur.createInstance();function n6(){bve.addResourceBundle("en",IUt,NUt)}async function oMn(){await bve.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{format:function(e,t){return t==="addMsgWithColonFormatter"?e?`: ${e}`:"":e}},showSupportNotice:!1}),n6()}function Kt(e,t){return t?.ns||(t=Object.assign(t??{},{ns:IUt})),bve.t(e,t)}oMn().catch(()=>{});var lMn=Te(o6(),1);function ww(e,t){return e&&t?kUt.default.filter(e,t,{extract:r=>r.name??""}).map(r=>r.original):t}var a6=class{message;link;constructor(t){Object.assign(this,t)}toString(){return`${this.message} ${this.link.text}${this.link.url?" : "+this.link.url:""}`}};var bM=Te(NF(),1);function fMn(e,t,r){let n=e.additionalMessages;return(i,s)=>{let o={...(0,bM.default)(s),...(0,bM.default)(r)},a=t(i,o);return a||(typeof n=="function"?n(i,s):void 0)}}function pMn(e,t,r){let n=e.validate;return(i,s)=>{let o={...(0,bM.default)(s),...(0,bM.default)(r)},a=t?.(i,o);return a!==!0?a:typeof n=="function"?n(i,s):!0}}function dMn(e,t,r,n){let i;return r==="validate"&&t.validate&&(i=pMn(e,t.validate,n)),r==="additionalMessages"&&t.additionalMessages&&(i=fMn(e,t.additionalMessages,n)),e=Object.assign(e,{[r]:i}),e}function Ps(e,t){return e.forEach(r=>{if(r.when!==void 0)if(typeof r.when=="function"){let n=r.when;r.when=i=>t(i)?n(i):!1}else{let n=r.when;r.when=i=>t(i)&&n}else r.when=t}),e}function xve(e,t,r){return e.forEach(n=>{let i=n.name,s=t[n.name];if(s){let o=Object.keys(s);for(let a of o){(a==="validate"||a==="additionalMessages")&&(n=dMn(n,s,a,r));let u=t[i].default;u&&(n.default=u)}}}),e}var wve="data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjMzc5NEZGIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iIzM3OTRGRiIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";var Ove={FIORI_TOOLS:3046},Uo={FIORI_TOOLS:45995,DEV_PLATFORM:45996,FIORI_APP_GENERATOR:48363,BAS_CATALOG_SERVICES_REQUEST_FAILED:48366,APPLICATION_PREVIEW:52881,CERTIFICATE_ERROR:53643,DESTINATION_MISCONFIGURED:54336,DESTINATION_UNAVAILABLE:51208,DESTINATION_NOT_FOUND:51208,BAD_GATEWAY:48366,DESTINATION_SERVICE_UNAVAILBLE:52526,NO_V4_SERVICES:57573,NO_ADT_SERVICE_AUTH:57266,DESTINATION_CONNECTION_ERRORS:48366,UI_SERVICE_GENERATOR:63068,DESTINATION_GATEWAY_TIMEOUT:57914,ADT_APP_NOT_FOUND_ERROR:63911,DESTINATION_FULL_URL:68172};var BUt="sap.ux.guidedAnswer.openGuidedAnswer",hMn="https://ga.support.sap.com/dtp/viewer/index.html";function qUt(e,t){let r="";return t.length>0&&(r=`/actions/${t.join(":")}`),`${hMn}#/tree/${e}${r}`}var jUt=Te(F8(),1);var Pve,Cve;function VUt(){return Pve}function IS(e,t){let r=mMn(e,t);Pve&&Pve.reportEvent(r,Ci.NoSampling)}function mMn(e,t){Cve=Cve??(0,jUt.default)();let r=Object.assign(t,{OperatingSystem:Cve,Platform:t.Platform||Uc().technical});return{eventName:e,properties:r,measurements:{}}}function u6(e){return aq(e)?"AbapODataCatalogDest":eg(e)?"GenericODataFullUrlDest":zl(e)?"GenericODataPartialUrlDest":"Unknown"}var gMn="GA_LINK_CREATED",yMn="SERVICE_INQUIRER_BAS_ERROR",pe;(function(e){e.AUTH="AUTH",e.AUTH_TIMEOUT="AUTH_TIMEOUT",e.REDIRECT="REDIRECT",e.CERT="CERT",e.CERT_SELF_SIGNED="CERT_SELF_SIGNED",e.CERT_UKNOWN_OR_INVALID="CERT_UKNOWN_OR_INVALID",e.CERT_EXPIRED="CERT_EXPIRED",e.CERT_SELF_SIGNED_CERT_IN_CHAIN="CERT_SELF_SIGNED_CERT_IN_CHAIN",e.INVALID_SSL_CERTIFICATE="INVALID_SSL_CERTIFICATE",e.UNKNOWN="UNKNOWN",e.INVALID_URL="INVALID_URL",e.TIMEOUT="TIMEOUT",e.CONNECTION="CONNECTION",e.SERVICES_UNAVAILABLE="SERVICES_UNAVAILABLE",e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.NO_ABAP_ENVS="NO_ABAP_ENVS",e.CATALOG_SERVICE_NOT_ACTIVE="CATALOG_SERVICE_NOT_ACTIVE",e.NO_SUCH_HOST="NO_SUCH_HOST",e.NOT_FOUND="NOT_FOUND",e.ODATA_URL_NOT_FOUND="ODATA_URL_NOT_FOUND",e.BAD_GATEWAY="BAD_GATEWAY",e.GATEWAY_TIMEOUT="GATEWAY_TIMEOUT",e.INTERNAL_SERVER_ERROR="INTERNAL_SERVER_ERROR",e.DESTINATION_SERVICE_UNAVAILABLE="DESTINATION_SERVICE_UNAVAILABLE",e.DESTINATION_UNAVAILABLE="DESTINATION_UNAVAILABLE",e.DESTINATION_NOT_FOUND="DESTINATION_NOT_FOUND",e.DESTINATION_MISCONFIGURED="DESTINATION_MISCONFIGURED",e.NO_V2_SERVICES="NO_V2_SERVICES",e.NO_V4_SERVICES="NO_V4_SERVICES",e.BAD_REQUEST="BAD_REQUEST",e.DESTINATION_CONNECTION_ERROR="DESTINATION_CONNECTION_ERROR",e.SERVER_HTTP_ERROR="SERVER_HTTP_ERROR"})(pe||(pe={}));var EMn={[pe.AUTH]:[/401/,/403/,/Incorrect credentials were provided to login/,/Unable to retrieve SAP Business Accelerator Hub key/],[pe.AUTH_TIMEOUT]:[/UAATimeoutError/],[pe.TIMEOUT]:[/Timeout/],[pe.CERT]:[],[pe.CERT_UKNOWN_OR_INVALID]:[/UNABLE_TO_GET_ISSUER_CERT/,/UNABLE_TO_GET_ISSUER_CERT_LOCALLY/,/unable to get local issuer certificate/,/UNABLE_TO_VERIFY_LEAF_SIGNATURE/,/ERR_TLS_CERT_ALTNAME_INVALID/],[pe.CERT_EXPIRED]:[/CERT_HAS_EXPIRED/],[pe.CERT_SELF_SIGNED]:[/DEPTH_ZERO_SELF_SIGNED_CERT/],[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:[/SELF_SIGNED_CERT_IN_CHAIN/],[pe.INVALID_SSL_CERTIFICATE]:[/526/,/Invalid SSL Certificate/],[pe.UNKNOWN]:[],[pe.CONNECTION]:[/ENOTFOUND/,/ECONNRESET/,/ECONNREFUSED/,/EPROTO/,/ConnectionError/],[pe.SERVICES_UNAVAILABLE]:[],[pe.SERVICE_UNAVAILABLE]:[/503/],[pe.INVALID_URL]:[/Invalid URL/,/ERR_INVALID_URL/],[pe.REDIRECT]:[/3\d\d/],[pe.NO_ABAP_ENVS]:[],[pe.CATALOG_SERVICE_NOT_ACTIVE]:[/\/IWBEP\/CM_V4_COS\/014/,/\/IWFND\/CM_V4_COS\/021/,/Service group '\/IWFND\/CONFIG' not published/],[pe.NO_SUCH_HOST]:[/no such host/],[pe.NOT_FOUND]:[/404/],[pe.ODATA_URL_NOT_FOUND]:[],[pe.INTERNAL_SERVER_ERROR]:[/500/],[pe.BAD_GATEWAY]:[/502/],[pe.GATEWAY_TIMEOUT]:[/504/],[pe.DESTINATION_SERVICE_UNAVAILABLE]:[],[pe.DESTINATION_UNAVAILABLE]:[],[pe.DESTINATION_NOT_FOUND]:[],[pe.DESTINATION_MISCONFIGURED]:[],[pe.NO_V2_SERVICES]:[],[pe.NO_V4_SERVICES]:[],[pe.BAD_REQUEST]:[/400/],[pe.DESTINATION_CONNECTION_ERROR]:[],[pe.SERVER_HTTP_ERROR]:[/5\d\d/]},ln=class e{currentErrorMsg;currentErrorType;static _guidedAnswersEnabled;static _logger;static _platform;static get platform(){return e._platform}static set platform(t){e._platform=t}static _guidedAnswersTrigger;static get guidedAnswersTrigger(){return e._guidedAnswersTrigger}static set guidedAnswersTrigger(t){e._guidedAnswersTrigger=t}static getMessageFromError=t=>t?.message||t?.status?.toString()||t?.response?.status?.toString()||(typeof t=="string"?t:JSON.stringify(t));static serverErrorMessage=(t,r)=>Kt("errors.serverReturnedAnError",{errorDesc:r?Kt(r,{errorMsg:e.getMessageFromError(t)}):e.getMessageFromError(t)});static _errorTypeToMsg={[pe.CERT]:t=>Kt("errors.certificateError",{errorMsg:e.getMessageFromError(t)}),[pe.CERT_EXPIRED]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.anExpiredCert")}),[pe.CERT_SELF_SIGNED]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.aSelfSignedCert")}),[pe.CERT_UKNOWN_OR_INVALID]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.anUnknownOrInvalidCert")}),[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.anUntrustedRootCert")}),[pe.INVALID_SSL_CERTIFICATE]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.anUnknownOrInvalidCert")}),[pe.AUTH]:t=>Kt("errors.authenticationFailed",{error:e.getMessageFromError(t)}),[pe.AUTH_TIMEOUT]:()=>Kt("errors.authenticationTimeout"),[pe.TIMEOUT]:t=>Kt("errors.timeout",{errorMsg:e.getMessageFromError(t)}),[pe.INVALID_URL]:()=>Kt("errors.invalidUrl"),[pe.CONNECTION]:t=>Kt("errors.connectionError",{error:e.getMessageFromError(t)}),[pe.UNKNOWN]:t=>Kt("errors.unknownError",{error:e.getMessageFromError(t)}),[pe.SERVICES_UNAVAILABLE]:()=>Kt("errors.servicesUnavailable"),[pe.SERVICE_UNAVAILABLE]:t=>e.serverErrorMessage(t),[pe.CATALOG_SERVICE_NOT_ACTIVE]:()=>Kt("errors.catalogServiceNotActive"),[pe.INTERNAL_SERVER_ERROR]:t=>e.serverErrorMessage(t,"errors.internalServerError"),[pe.NOT_FOUND]:()=>Kt("errors.urlNotFound"),[pe.ODATA_URL_NOT_FOUND]:()=>Kt("errors.odataServiceUrlNotFound"),[pe.BAD_GATEWAY]:t=>e.serverErrorMessage(t,"errors.badGateway"),[pe.DESTINATION_UNAVAILABLE]:()=>Kt("errors.destination.unavailable"),[pe.DESTINATION_NOT_FOUND]:()=>Kt("errors.destination.notFound"),[pe.DESTINATION_MISCONFIGURED]:t=>Kt("errors.destination.misconfigured",{destinationProperty:typeof t=="string"?t:""}),[pe.NO_V2_SERVICES]:()=>Kt("errors.noServicesAvailable",{version:"2"}),[pe.NO_V4_SERVICES]:()=>Kt("errors.noServicesAvailable",{version:"4"}),[pe.DESTINATION_SERVICE_UNAVAILABLE]:()=>Kt("errors.destination.unavailable"),[pe.REDIRECT]:()=>Kt("errors.redirectError"),[pe.NO_SUCH_HOST]:()=>Kt("errors.noSuchHostError"),[pe.NO_ABAP_ENVS]:()=>Kt("errors.abapEnvsUnavailable"),[pe.BAD_REQUEST]:t=>e.serverErrorMessage(t,"errors.badRequest"),[pe.DESTINATION_CONNECTION_ERROR]:()=>Kt("errors.systemConnectionValidationFailed"),[pe.SERVER_HTTP_ERROR]:t=>e.serverErrorMessage(t),[pe.GATEWAY_TIMEOUT]:t=>e.serverErrorMessage(t)};static _errorMsg=(t,r)=>e._errorTypeToMsg[t](r);static getHelpNode=t=>{let r=jr();return{[pe.SERVICES_UNAVAILABLE]:r?Uo.BAS_CATALOG_SERVICES_REQUEST_FAILED:void 0,[pe.CERT]:Uo.CERTIFICATE_ERROR,[pe.CERT_EXPIRED]:Uo.CERTIFICATE_ERROR,[pe.CERT_SELF_SIGNED]:Uo.CERTIFICATE_ERROR,[pe.CERT_UKNOWN_OR_INVALID]:Uo.CERTIFICATE_ERROR,[pe.INVALID_SSL_CERTIFICATE]:Uo.CERTIFICATE_ERROR,[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:Uo.CERTIFICATE_ERROR,[pe.DESTINATION_MISCONFIGURED]:Uo.DESTINATION_MISCONFIGURED,[pe.DESTINATION_UNAVAILABLE]:Uo.DESTINATION_UNAVAILABLE,[pe.DESTINATION_NOT_FOUND]:Uo.DESTINATION_NOT_FOUND,[pe.BAD_GATEWAY]:Uo.BAD_GATEWAY,[pe.DESTINATION_SERVICE_UNAVAILABLE]:Uo.DESTINATION_SERVICE_UNAVAILBLE,[pe.NO_V4_SERVICES]:Uo.NO_V4_SERVICES,[pe.GATEWAY_TIMEOUT]:r?Uo.DESTINATION_GATEWAY_TIMEOUT:void 0,[pe.AUTH]:void 0,[pe.AUTH_TIMEOUT]:void 0,[pe.REDIRECT]:void 0,[pe.UNKNOWN]:void 0,[pe.INVALID_URL]:void 0,[pe.CONNECTION]:void 0,[pe.SERVICE_UNAVAILABLE]:void 0,[pe.NO_ABAP_ENVS]:void 0,[pe.CATALOG_SERVICE_NOT_ACTIVE]:void 0,[pe.NO_SUCH_HOST]:void 0,[pe.NOT_FOUND]:void 0,[pe.ODATA_URL_NOT_FOUND]:void 0,[pe.INTERNAL_SERVER_ERROR]:void 0,[pe.NO_V2_SERVICES]:void 0,[pe.TIMEOUT]:void 0,[pe.BAD_REQUEST]:void 0,[pe.DESTINATION_CONNECTION_ERROR]:Uo.DESTINATION_CONNECTION_ERRORS,[pe.SERVER_HTTP_ERROR]:void 0}[t]};static findErrorValueForMapping=t=>t.response?.data?.error?.code||t.response?.status||t.response?.data||t.code||(["TypeError","Error"].includes(t.name)?t.message:t.name)||t.message||t;constructor(t,r=!1,n){e._logger=t??new ys({logPrefix:n??"@sap-ux/inquirer-common"}),e.guidedAnswersEnabled=r}static get guidedAnswersEnabled(){return e._guidedAnswersEnabled}static set guidedAnswersEnabled(t){e._guidedAnswersEnabled=t}static set logger(t){e._logger=t}static get logger(){return e._logger}static isCertError(t){return[pe.CERT,pe.CERT_EXPIRED,pe.CERT_SELF_SIGNED,pe.CERT_UKNOWN_OR_INVALID,pe.CERT_SELF_SIGNED_CERT_IN_CHAIN].includes(e.getErrorType(t))}static getErrorType(t){let r=t;return t instanceof Error&&(r=e.findErrorValueForMapping(t)),Object.keys(pe).find(n=>EMn[n].find(i=>i.test(r.toString())))}logErrorMsgs(t,r,n=!0){let i={errorMsg:"",errorType:pe.UNKNOWN};if(Object.values(pe).includes(t)){let s=t;i.errorMsg=e.getErrorMsgFromType(s)??s.toString(),i.errorType=s}else typeof t=="string"?i.errorMsg=t:i=e.mapErrorToMsg(t);return e._logger.error(r?`${r} ${i.errorMsg}`:i.errorMsg),n&&(this.currentErrorMsg=r??i.errorMsg,this.currentErrorType=i.errorType),i.errorMsg}static mapErrorToMsg(t){let r;return Object.values(pe).includes(t)?r=t:r=e.getErrorType(this.findErrorValueForMapping(t))??pe.UNKNOWN,{errorMsg:e._errorMsg(r,t),errorType:r}}getErrorMsg(t,r,n){let i;return t&&typeof t!="boolean"&&(i=e.mapErrorToMsg(t).errorMsg),i||(i=this.currentErrorMsg??(n?e.getErrorMsgFromType(n):void 0)),(t===!0||r)&&(this.currentErrorMsg=null,this.currentErrorType=null),i}resetErrorState(){this.currentErrorMsg=null,this.currentErrorType=null}getValidationErrorHelp(t,r=!1,n){let i,s,o;if(t?{errorMsg:s,errorType:o}=e.mapErrorToMsg(t):(s=this.currentErrorMsg??void 0,this.currentErrorType&&(o=this.currentErrorType)),o){if(n){let{errorType:a,errorMsg:u}=e.getDestinationSpecificError(o,n);s=u??s,o=a??o}o&&(i=e.getHelpForError(o,s))}return r&&(this.currentErrorMsg=null,this.currentErrorType=null),i??s}static getDestinationSpecificError(t,r){let n,i;return hHe(r)?t===pe.SERVICE_UNAVAILABLE?dHe(r)?n=pe.DESTINATION_SERVICE_UNAVAILABLE:n=pe.DESTINATION_CONNECTION_ERROR:t===pe.NOT_FOUND?(n=pe.DESTINATION_NOT_FOUND,i=this.getErrorMsgFromType(pe.DESTINATION_NOT_FOUND)):pe.INTERNAL_SERVER_ERROR===t||pe.SERVER_HTTP_ERROR===t?n=pe.DESTINATION_CONNECTION_ERROR:t===pe.AUTH&&r.Authentication!==sp.NO_AUTHENTICATION&&(i=this.getErrorMsgFromType(pe.AUTH,Kt("texts.checkDestinationAuthConfig"))):(n=pe.DESTINATION_MISCONFIGURED,i=this.getErrorMsgFromType(n,"HTML5.DynamicDestination")),IS(yMn,{basErrorType:n??t,destODataType:u6(r),Platform:this._platform??Uc().technical}),{errorType:n??t,errorMsg:i}}static getErrorMsgFromType(t,r){if(pe[t])return e._errorMsg(pe[t],r)}hasError(t=!1){let r=!!this.currentErrorMsg;return t&&(this.currentErrorMsg=null,this.currentErrorType=null),r}setCurrentError(t,r){this.currentErrorMsg=e._errorMsg(pe[t],r),this.currentErrorType=t}getCurrentErrorType(t=!1){let r=this.currentErrorType;return t&&(this.currentErrorMsg=null,this.currentErrorType=null),r}static getHelpForError(t,r){let n=e.getHelpNode(t),i=r??e.getErrorMsgFromType(t);return n&&i?this.getHelpLink(n,t,i):i}static getHelpLink(t,r,n){let i={message:n,link:{text:Kt("guidedAnswers.validationErrorHelpText"),icon:wve,url:qUt(Ove.FIORI_TOOLS,[t])}};return this.guidedAnswersEnabled&&(i.link.command={id:BUt,params:{treeId:Ove.FIORI_TOOLS,nodeIdPath:[t],trigger:this.guidedAnswersTrigger}}),IS(gMn,{errorType:r,isGuidedAnswersEnabled:this.guidedAnswersEnabled,nodeIdPath:`${t}`,Platform:this.platform??Uc().technical}),new a6(i)}};var $Ut=Te(tq(),1);async function GUt(e){let t=[];try{let r=[Vd.ABAP,Vd.ABAP_TRIAL,Vd.ABAP_CANARY,Vd.ABAP_OEM,Vd.ABAP_OEM_CANARY,Vd.ABAP_HAAS,Vd.ABAP_STAGING,Vd.ABAP_INTERNAL_STAGING],n=process.env.ABAPEnvServiceTypes?process.env.ABAPEnvServiceTypes.split(",").map(s=>s.trim()):[],i=await(0,$Ut.apiGetServicesInstancesFilteredByType)([...r,...n]);i.length>0?i.forEach(s=>{t.push({name:s.label,value:s})}):e.logErrorMsgs(pe.NO_ABAP_ENVS,Kt("errors.noAbapEnvsInCFSpace"))}catch{e.logErrorMsgs(pe.NO_ABAP_ENVS,Kt("errors.abapEnvsCFDiscoveryFailed"))}return t.sort((r,n)=>r.name?r.name.localeCompare(n.name??""):0)}var _Mn=Te(Oy(),1),vMn=Te(Py(),1);var cQn=Te(Q3t(),1);var Z3t={deploy:{abapAppDescLength:"The deployment description cannot exceed 60 characters.",abapTransportNumRequired:"Provide a transport request for your application.",abapPackageWarn:"Provide a package.",abapAppNameRequired:"The application name is required.",abapInvalidNamespace:"The namespace is invalid because there are too many forward slashes.",abapInvalidNamespaceLength:"The namespace is limited to 10 characters. Entered {{length}}.",abapInvalidAppNameLength:"The application name is limited to 15 characters. Entered {{length}}.",abapInvalidAppName:"The application name must be prefixed with [{{prefix}}].",charactersForbiddenInAppName:"Only alphanumeric, underscore, and slash characters are allowed.",invalidAppNameMultipleReason:"The application name is invalid for multiple reasons:"},ui5:{namespaceMustStartWithLetter:"The namespace must start with a letter.",namespaceEndInPeriod:"The namespace cannot end with a period.",namespaceCannotBeSap:"The namespace cannot be {{str}}.",namespaceStartsWithNew:"The namespace cannot start with {{str}}.",namespaceNumberAfterPeriod:"A number cannot follow a period in the namespace.",lowerAlphaNumericOnly:"Only use lowercase alphanumeric characters.",lowerAlphaNumericDotsOnly:"Only use lowercase alphanumeric characters and dots for the namespace.",namespaceSpecialCharacter:"The namespace can only contain letters, digits, dots, and underscores.",moduleNameMustStartWithLetter:"The module name must start with a letter.",nameCombinedTooLong:"The combined length of the namespace and module name must not exceed {{length}} characters.",folderDoesNotExist:"This folder does not exist. Please enter the root folder for your project.",folderDoesNotHaveCorrectPermissions:"The selected folder does not have the required permissions. Please ensure you have permission to write to the selected folder and try again.",enterProjectFolder:"Please enter a project folder.",nameNull:"The module name cannot be null.",nameUndefined:"The module name cannot be undefined.",nameNotString:"The module name must be a string.",nameLengthZero:"The module name's length must be greater than zero.",nameStartsWithPeriod:"The module name cannot start with a period.",nameStartsWithUnderscore:"The module name cannot start with an underscore.",nameStartsOrEndsWithSpace:"The module name cannot contain leading or trailing spaces.",nameBlocklisted:"{{modName}} is a blocklisted module name. Choose a different name.",nameIsCoreModule:"{{modName}} is a core module name. Choose a different name.",nameTooLong:"The module name cannot exceed {{length}} characters.",nameTooShort:"The module name must be at least {{length}} characters.",inputValueContainsCapital:"{{promptName}} cannot contain capital letters",nameContainsSpecialCharacters:`The module name cannot contain special characters: ("~'!()*)`,nameNotUrlFriendly:"The module name can only contain URL-friendly characters.",invalidModuleName:"Invalid module name.",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path.",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must use the local CAP project as the data source."},general:{invalidUrl:"Invalid URL: [{{-input}}]",invalidClient:"[{{client}}] is invalid. Leave this field empty or enter a value between 000-999.",inputCannotBeEmpty:"The input cannot be empty.",inputCannotHaveSpaces:"The input cannot contain spaces.",invalidJSON:"Invalid JSON.",invalidValueForSpecialChars:"The input must only contain Latin alphanumeric characters or the following symbols: '-','_','$' and '.'.",maxLength:"The maximum length is: {{maxLength}} characters.",supportedFormats:"Only alphanumeric and '{{allowedCharacters}}' characters are allowed.",nameContainsSpecialCharacters:`Module name cannot contain special characters ("~'!()*)`,nameNotUrlFriendly:"Module name can only contain URL-friendly characters",invalidModuleName:"Invalid module name",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must therefore use the local CAP project as the data source.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",windowsFolderPathTooLong:"The combined length {{length}} of the target folder and module name exceeds the default Windows path length. This can cause issues with project generation."},adp:{projectNameUppercaseError:"The project name cannot contain uppercase letters.",projectNameLengthErrorExt:"The project name cannot exceed 61 characters or end with the word 'component'.",projectNameValidationErrorExt:"The project name must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",projectNameLengthErrorInt:"The project name cannot start with the word 'customer', exceed 61 characters, or end with the word 'component'.",projectNameValidationErrorInt:"The project name must only contain Latin alphanumeric characters and it must have at least two parts. The different parts must be separated by a period and every part must start with a letter.",duplicatedProjectName:"A project with this name already exists in your workspace. Please choose another name.",differentNamespaceThanProjectName:"The namespace must be the same as the project name.",namespaceSameAsProjectNameError:"The namespace must be the same as the project name.",namespaceLengthError:"The namespace cannot exceed 61 characters or end with the word 'component'.",namespaceValidationError:"The namespace must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",achMandatoryError:"The Application Component Hierarchy must only contain capital letters, digits, and dashes."}};var e$t="project-input-validator",LTe=Ur.createInstance();function zY(){LTe.addResourceBundle("en",e$t,Z3t)}async function t$t(){await LTe.init({lng:"en",fallbackLng:"en",showSupportNotice:!1}),zY()}function WS(e,t){return t?.ns||(t=Object.assign(t??{},{ns:e$t})),LTe.t(e,t)}t$t().catch(()=>{});var rJn=Te(i$t(),1);function s$t(e){let t=e?.trim()||"";return t===""||/^\d{3}$/.test(t)?!0:WS("general.invalidClient",{client:e})}var o$t={prompts:{datasourceType:{message:"Data Source",projectSpecificDestName:"Project Specific Destination",businessHubName:"SAP Business Accelerator Hub",sapSystemName:"System",odataServiceUrlName:"OData Service",capProjectName:"Local CAP Project",metadataFileName:"Metadata Document",choiceNone:"$t(texts.choiceNameNone)",projectSpecificDestChoiceText:"Connect to a $t(prompts.datasourceType.projectSpecificDestName)",businessHubChoiceText:"Connect to $t(prompts.datasourceType.businessHubName)",sapSystemChoiceText:"Connect to a $t(prompts.datasourceType.sapSystemName)",odataServiceUrlChoiceText:"Connect to an $t(prompts.datasourceType.odataServiceUrlName)",capProjectChoiceText:"Use a $t(prompts.datasourceType.capProjectName)",metadataFileChoiceText:"Upload a $t(prompts.datasourceType.metadataFileName)",notYetImplementedWarningMessage:"The selected data source type: {{ datasourceType }} is not yet implemented."},metadataFile:{message:"Metadata File Path",description:"Upload a metadata file",placeholder_odata_service_url:"/here/goes/your/serviceurl/"},capProject:{message:"Choose a CAP Project",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capProjectPath:{message:"CAP Project Folder Path",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capService:{message:"OData Service",description:"Select a local CAP service",breadcrumb:"CAP Service",enterCapPathChoiceName:"Manually select CAP service folder path"},odataServiceUrl:{message:"OData{{odataVersion, odataVersionFormatter}} service URL"},ignoreCertErrors:{message:"Do you want to continue generation with the untrusted certificate?"},serviceUsername:{message:"Service username"},servicePassword:{message:"Service password"},validationMessages:{odataVersionMismatch:"The template you have chosen supports V{{requiredOdataVersion}} OData services only. The provided version is V{{providedOdataVersion}}.",metadataInvalid:"The service metadata is invalid.",metadataFilePathNotValid:"The metadata file does not exist or is not accessible. Please specify a valid file path.",capProjectNotFound:"The folder you have selected does not contain a valid CAP project. Please check and try again.",warningCertificateValidationDisabled:"Certificate validation has been disabled by the user.",annotationsNotFound:"Annotations not found for the specified service.",backendSystemExistsWarning:'A saved system connection entry: "{{- backendName}}" already exists with the same URL and client. Please reuse the existing entry or remove it, using the systems panel, before adding a new connection.',systemUrlOriginOnlyWarning:"System URLs must only contain the hostname and may also include the port, for example, 'https://abc.com:123/'."},warnings:{nonUIServiceTypeWarningMessage:"Services of service type: {{serviceType}} or without a service type are not intended to be used for generating SAP Fiori UI applications.",noServicesAvailable:"There are no services available for the selected system. For more information, see the logs.",noServicesAvailableForOdataVersion:"There are no OData V{{odataVersion}} services available from the selected system and the template you have chosen only supports OData V{{odataVersion}} services.",noAnnotations:"No back-end annotations associated with this service were retrieved. This can result in an invalid application.",collaborativeDraftMessage:"The selected service is draft-enabled but does not support collaborative draft."},systemUrl:{message:"System URL",description:"Enter the URL of the SAP System",placeholder:"https://<host>:<port>"},sapClient:{message:"SAP client (leave empty for default)",breadcrumb:"SAP Client"},systemUsername:{message:"Username"},systemPassword:{message:"Password"},storeSystemCredentials:{message:"Do you want to store the system credentials?",breadcrumb:"Store Credentials"},systemService:{message:"Service",breadcrumb:"Service",noServicesWarning:"No services available for the selected system. For more information, see the logs."},newSystemType:{choiceAbapOnPrem:"ABAP On Premise",choiceAbapOnBtp:"ABAP Environment on SAP Business Technology Platform",choiceCFAbapEnvServiceOnBtp:"Cloud Foundry ABAP environment on SAP Business Technology Platform",message:"System Type",notYetImplementedWarningMessage:"The selected system type: {{ systemType }} is not yet implemented."},systemName:{message:"System name",hint:"Entering a system name will save the connection for re-use.",systemNameExistsWarning:"A system with that name already exists in the secure storage. Please try a different name.",reservedSystemNameWarning:"'{{ systemName }}' is a reserved system name. Please try a different name.",emptySystemNameWarning:"System name cannot be empty."},systemSelection:{newSystemChoiceLabel:"New System",hint:"Select a system configuration.",message:"System",authenticationFailedUpdateCredentials:"$t(texts.authenticationFailed). Please try updating the credentials."},abapOnBTPType:{message:"ABAP environment definition source",choiceReentranceTicket:"Use Reentrance Ticket",choiceServiceKey:"Upload a Service Key File",choiceCloudFoundry:"Discover a Cloud Foundry Service"},serviceKey:{message:"Service Key File Path",hint:"Select a local file that defines the service connection for an ABAP Environment on SAP Business Technology Platform.",incompleteServiceKeyInfo:"The service keys file does not contain the required information. Check the file is valid and try again.",unparseableServiceKey:"The service keys file does not contain a valid JSON format. Check the formatting and try again."},cloudFoundryAbapSystem:{message:"ABAP environment",hint:"Enter the name of the Cloud Foundry service that contains the ABAP Environment instance."},destinationServicePath:{message:"Service Path",hint:"Enter the path to the OData service relative to the selected destination URL.",invalidServicePathWarning:"Please enter a valid service path"},mainEntitySelection:{message:"Main Entity",defaultEntityNameNotFoundWarning:"The supplied entity cannot be found in the service. Please choose from the list above.",noDraftEnabledEntitiesError:"The CAP service you have chosen does not have any entities that are draft enabled. To generate an OData V4 SAP Fiori application using this floorplan for a CAP project, the entity selected must be draft enabled.",mainEntityParameterFoundInfo:"The selected entity '{{entityName}}' requires a parameter which is set by the application filters. Navigation entities are not supported.",noEntitiesError:"$t(errors.noRelevantEntities)",noEntitiesAlpV4Error:"The OData V4 service you have provided is not suitable for use in an analytical list page application. The service must contain aggregate-based entities for this template.",requiredError:"Please select a main entity to continue."},navigationEntitySelection:{message:"Navigation Entity",choiceNone:"$t(texts.choiceNameNone)"},filterEntitySet:{message:"Filter Entity",noEntitiesError:"$t(errors.noRelevantEntities)"},pageBuildingBlock:{message:"Add a Page Building Block to the Application?",tooltip:"The Page building block is supported from SAPUI5 version 1.136. By choosing this option, you will be restricting the minimum SAPUI5 versions available for the application to be 1.136 and above.",warning:"The Page building block is supported with SAPUI5 version 1.136 and above.",titleMessage:"Page Title"},tableType:{message:"Table Type",hint:"Defines the table type for the list report page.",requiredError:"Please select a table type to continue.",choiceNone:"$t(texts.choiceNameNone)",choiceGrid:"Grid",choiceAnalytical:"Analytical",choiceResponsive:"Responsive",choiceTree:"Tree",analyticalTableDefault:"The 'Analytical' table type is chosen by default because the selected entity supports it.",treeTableDefault:"The 'Tree' table type is chosen by default because the selected entity supports it.",responsiveTableInfo:"Only use the responsive table if the total number of items in the table doesn't exceed 200."},hierarchyQualifier:{message:"Hierarchy Qualifier",hint:"Leading property that decides between either a recursive hierarchy or data aggregation.",qualifierRequiredForV4Warning:"Hierarchy qualifier is required for OData V4 services."},addFEOPAnnotations:{message:"Automatically add a form to the generated application if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations"},addLineItemAnnotations:{message:"Automatically add table columns to the list page and a section to the object page if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations",valueHelpsAnnotationsInfoMessage:"Basic value helps will also be created."},presentationQualifier:{message:"Qualifier",hint:"Represents the qualifier of the `SelectionPresentationVariant`. The analytical list page looks for a `SelectionPresentationVariant` with this qualifier and if not found, it looks for a `PresentationVariant` with this qualifier."},tableSelectionMode:{message:"Selection Mode",hint:"Defines different selection modes for the `SmartTable` in the analytical list page.",choiceNone:"$t(texts.choiceNameNone)",choiceSingle:"Single",choiceAuto:"Auto",choiceMulti:"Multi"},tableMultiSelect:{message:"Allow Multi Select",hint:"Allows you to show a checkbox for selecting multiple items in a table. This setting comes into effect only if there are actions defined either by using an annotation or a setting in the `manifest.json` file."},tableAutoHide:{message:"Auto Hide",hint:"Determines the chart or table interaction. If set to `true`, the chart acts as a filter for the table. If set to `false`, the matching table rows are highlighted but the table is not filtered."},smartVariantManagement:{message:"Enable Smart Variant Management",hint:"Enables page level variant."},valueHelpDownload:{message:"The service contains references to value help services. Do you want to download the associated metadata during generation? This may increase generation time.",hint:"Download metadata for value help to improve the user experience with dropdowns and search."}},errors:{destination:{authError:"The selected system: {{systemName}} returned an authentication error: {{- error}}.",listDestinations:"An error occurred when retrieving the list of destinations: {{- error}}."},cannotReadCapServiceMetadata:"An error occurred reading CAP service metadata: {{serviceName}}. $t(texts.seeLogForDetails).",capModelAndServicesLoadError:"An error occurred loading the CAP model and services: {{- error, addMsgWithColonFormatter}}.",capServiceUrlPathNotDefined:"An error occurred reading CAP service metadata: {{serviceName}}. The CAP service property: `urlPath` is not defined but it is required.",unknownError:"An error occurred: {{- error, addMsgWithColonFormatter}}.",authenticationFailed:"$t(texts.authenticationFailed): {{error}}.",authenticationFailedSpecificCatalog:"{{authFailType}}: Unable to access the OData V{{odataVersion}} service catalog",authenticationFailedAllCatalogs:"{{authFailType}}: Unable to access any service catalogs",invalidUrl:"Invalid URL: {{-input, addMsgWithColonFormatter}}.",connectionError:"A connection error occurred. Ensure the target host is available on the network: {{- error}}",urlNotFound:"URL not found.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",abapEnvsUnavailable:"ABAP environments unavailable.",systemOrServiceUrlNotFound:"Please verify the URL: {{- url}}, target system configuration and network connectivity.",urlRedirect:"The service URL is redirecting.",certValidationRequired:"Certificate validation is required to continue.",exitingGeneration:"Exiting generation. Exit: {{exitReason}}.",serviceMetadataError:"An error occurred when reading the service metadata for service: {{- servicePath}}. Error: {{errorText}}",serviceMetadataErrorUI:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" }) $t(texts.seeLogForDetails)',serviceMetadataErrorLog:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" })',serviceTypeRequestError:"An error occurred when retrieving the service type: {{- error}}.",abapServiceAuthenticationFailed:"ABAP environment authentication using UAA failed.",serviceCatalogRequest:"An error occurred requesting services from: {{- catalogRequestUri }} and entity set: {{entitySet}}: {{error}}.",storedSystemConnectionError:"An error occurred when validating the stored system connection info. System Name: {{-systemName}}. Error: {{- error}}.",noCatalogOrServiceAvailable:"No active system or OData service endpoint connection available to retrieve the server.",allCatalogServiceRequestsFailed:"All catalog service requests failed for the selected system. OData version: V{{version}}.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata.",unparseableXML:"Unparseable XML was specified: {{-error}}.",noRelevantEntities:"The template and service selected have no relevant entities that you can use.",cfInstanceCredentialsNotReturned:"Cannot not retrieve credentials to access: {{serviceInstanceName}}.",v2CatalogServiceNoAnnotations:"An error occurred when creating an OData V2 catalog service object. Annotations will not be available: {{-error}}",backendSystemRetrieval:"An error occurred when retrieving the backend systems from the store: {{-error}}"},warnings:{largeMetadataDocument:"The metadata for this OData service is very large. It may take some time before this operation completes.",warningCertificateValidationDisabled:"User has disabled certificate validation",nonUIServiceTypeWarningMessage:"Please note that {{serviceType}} services, or not classified services, are not intended to be used for the generation of SAP Fiori UI applications",noServicesAvailable:"No services available for the selected system, see logs for further details.",noServicesAvailableForOdataVersion:"There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only",noAnnotations:"No backend annotations associated with this service were retrieved and may result in an invalid application being created",collaborativeDraftMessage:"The selected service is draft enabled but does not support collaborative draft.",certificateErrors:"A certificate error occurred when connecting to the host: {{-url}}. Certificate error: {{error}}.",allowingUnauthorizedCertsNode:"Setting the `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `0` makes TLS connections and HTTPS requests insecure by disabling certificate verification. It is important to understand the security risks when using this setting.",certErrorIgnoredByNodeSetting:"An SSL certificate error is being ignored by the 'NODE_TLS_REJECT_UNAUTHORIZED=0' Node.js setting. This makes TLS connections and HTTPS requests insecure by disabling certificate verification. For details of the certification error, see the logs.",noExternalServiceMetdataFetched:"No external service metadata was fetched. $t(texts.seeLogForDetails)",missingServices:"OData V{{odataVersion}} services are not available.",specifiedServicesNotAvailable_one:"The required OData service: {{-service}} is not available from the {{odataVersion}}services catalog. Please ensure the service is available.",specifiedServicesNotAvailable_other:"The required OData services are not available from the {{odataVersion}}services catalog. Please ensure the services are available. $t(texts.seeLogForDetails)",storedSystemUrlPathNotSupported:"The stored cloud system URL '{{- systemUrl}}' contains a path which is not supported for reentrance ticket authentication. The path is ignored for this connection."},texts:{suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, view the logs.",forUserName:"(for user [{{username}}])",httpStatus:"HTTP Status {{httpStatus}}",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration.",choiceNameNone:"None",passwordStoreWarning:"Passwords are stored in your operating system's credential manager and are protected by its security policies.",authorizationFailed:"Authorization failed",authenticationFailed:"Authentication failed"}};var a$t="odata-service-inquirer";var MTe=Ur.createInstance();async function u$t(){await MTe.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{format:function(e,t){return t==="odataVersionFormatter"?e?` V${e}`:"":t==="addMsgWithColonFormatter"?e?`: ${e}`:"":e}},showSupportNotice:!1}),MTe.addResourceBundle("en",a$t,o$t),n6(),zY()}function we(e,t){return t?.ns||(t=Object.assign(t??{},{ns:a$t})),MTe.t(e,t)}u$t().catch(()=>{});var WM;(function(e){e.sapSystem="sapSystem",e.capProject="capProject",e.odataServiceUrl="odataServiceUrl",e.none="none",e.metadataFile="metadataFile",e.projectSpecificDestination="projectSpecificDestination",e.businessHub="businessHub"})(WM||(WM={}));var KY="sap-client";var wn;(function(e){e.datasourceType="datasourceType",e.metadataFilePath="metadataFilePath",e.capProject="capProject",e.capService="capService",e.serviceUrl="serviceUrl",e.serviceUrlPassword="serviceUrlPassword",e.serviceSelection="serviceSelection",e.userSystemName="userSystemName",e.systemSelection="systemSelection",e.valueHelpDownload="valueHelpDownload"})(wn||(wn={}));var YS=Te(v$t(),1),at=class e{static _logger=new ys({logPrefix:"@sap-ux/odata-service-inquirer"});static get logger(){return e._logger}static set logger(t){e._logger=t}static attachAxiosLogger(t){let r=typeof e.logger.getLogLevel=="function"&&e.logger.getLogLevel()==="trace",n=e.logger.debug.bind(e.logger);t.request.use(i=>(i.url||n(`Request URL: ${i.baseURL}`),YS.requestLogger(i,{url:!0,data:!0,params:!0,method:!0,headers:!0,logger:n})),i=>YS.errorLogger(i,{logger:n})),t.response.use(i=>YS.responseLogger(i,{data:r,status:!0,headers:!0,logger:n}),i=>YS.errorLogger(i,{logger:n}))}};var gt=class e{static odataService={};static isYUI=!1;static backendSystemsCache=[];static reset(){Object.keys(e.odataService).forEach(t=>{e.odataService[t]=void 0})}static resetConnectedSystem(){e.odataService.connectedSystem=void 0}};var x$t=Te(Oy(),1),w$t=Te(Py(),1),qTe=Te(A$t(),1);function Bo(){return gt.isYUI?jr()?un.bas:un.vscode:un.cli}function O$t(e){try{let t=(0,x$t.convert)((0,w$t.parse)(e)),r=Number.parseInt(t?.version,10);if(Number.isNaN(r))throw at.logger.error(we("errors.unparseableOdataVersion")),new Error(we("errors.unparseableOdataVersion"));return{odataVersion:r===4?zn.v4:zn.v2,convertedMetadata:t}}catch(t){throw at.logger.error(t),new Error(we("prompts.validationMessages.metadataInvalid"))}}function Qh(e){if(e)return e===zn.v2?Er.v2:Er.v4}function n7(e){if(e?.length===1)return 0}function Zh(e){for(let t in e.services)e.services?.[t].log&&(e.services[t].log=(0,qTe.removeSync)(e.services[t]?.log,{setUndefined:!0}));return e.log&&(e.log=(0,qTe.removeSync)(e.log,{setUndefined:!0})),e}function xO(e,t,r){let n=new la({url:t,client:r}).getId();return e.find(i=>la.from(i).getId()===n)}function C$t(e,t){return!e&&!t||e?.length===0&&t?.length===0||e===t?!0:!e||!t?!1:[...e].sort().toString()===[...t].sort().toString()}var Vr=new ln(void 0,void 0,"@sap-ux/odata-service-inquirer");var jTe;(function(e){e.capProjectPath="capProjectPath",e.capCliStateSetter="capCliStateSetter"})(jTe||(jTe={}));function i7(e,t){try{let{convertedMetadata:r,odataVersion:n}=O$t(e);if(t&&t!==n){let i=we("prompts.validationMessages.odataVersionMismatch",{providedOdataVersion:n,requiredOdataVersion:t});return at.logger.error(i),{validationMsg:i}}return{version:n,convertedMetadata:r}}catch(r){return{validationMsg:r.message}}}var ZTe=require("@sap-devx/yeoman-ui-types");var P$t=new Set([pe.CERT_SELF_SIGNED,pe.CERT_SELF_SIGNED_CERT_IN_CHAIN,pe.CERT_EXPIRED,pe.CERT_UKNOWN_OR_INVALID,pe.INVALID_SSL_CERTIFICATE]),Sl=class{validity={};_validatedUrl;_destinationUrl;_destination;_validatedClient;_odataService;_serviceProvider;_axiosConfig;_catalogV2;_catalogV4;_systemAuthType;_serviceInfo;_connectedUserName;_connectedSystemName;_refreshToken;_ignoreCertError;_connectType="abap_catalog";get ignoreCertError(){return this._ignoreCertError}get axiosConfig(){return this._axiosConfig}get odataService(){return this._odataService}get catalogs(){return{[Er.v2]:this._catalogV2,[Er.v4]:this._catalogV4}}get serviceProvider(){return this._serviceProvider}get systemAuthType(){return this._systemAuthType}set systemAuthType(t){this._systemAuthType=t}get validatedUrl(){return this._validatedUrl}get validatedClient(){return this._validatedClient}get serviceInfo(){return this._serviceInfo}set serviceInfo(t){this._serviceInfo=t}get connectedUserName(){return this._connectedUserName}get refreshToken(){return this._refreshToken}get destinationUrl(){return this._destinationUrl}get destination(){return this._destination}get connectType(){return this._connectType}get connectedSystemName(){return this._connectedSystemName?this._connectedSystemName:this.systemAuthType==="serviceKey"?this.serviceInfo?.systemid:this.validatedUrl}set connectedSystemName(t){this._connectedSystemName=t}setConnectedSystem({serviceProvider:t,backendSystem:r}){if(!t.catalog){at.logger.debug("ConnectionValidator.setConnectedSystem(): Use of a cached connected system is only supported for AbapServiceProviders. Re-authorization will be required.");return}this._serviceProvider=t,this._catalogV2=this._serviceProvider.catalog(Er.v2),this._catalogV4=this._serviceProvider.catalog(Er.v4),this._validatedUrl=r?.serviceKeys?.url??r?.url,this._connectedUserName=r?.userDisplayName,this._validatedClient=r?.client,this._refreshToken=r?.refreshToken,this._serviceInfo=r?.serviceKeys,this.validity.authenticated=!0,this.validity.reachable=!0,this.validity.urlFormat=!0,this.validity.authRequired=!0,r?.authenticationType==="reentranceTicket"?this.systemAuthType="reentranceTicket":r?.serviceKeys?this.systemAuthType="serviceKey":this.systemAuthType="basic"}async checkUrl(t,r,n,{ignoreCertError:i=!1,isSystem:s=!1,odataVersion:o,connectType:a}={}){let u=jr();try{t.pathname=t.pathname?.endsWith("/")?t.pathname:`${t.pathname}/`,i===!0&&jA(!i),u&&t.searchParams.append("saml2","disabled");let c=this.createAxiosConfig(t,i,r,n);if(s){if(await this.createSystemConnection({axiosConfig:c,url:t,odataVersion:o,connectType:a}),a!=="odata_path"){let l=await this.serviceProvider.getSystemInfo();this._connectedUserName=l?.userName,this._connectedSystemName=l?.systemID}}else await this.createOdataServiceConnection(c,t.pathname);return this._validatedClient=t.searchParams.get(KY)??void 0,200}catch(c){if(at.logger.debug(`ConnectionValidator.checkUrl() - error: ${c.message}`),c?.isAxiosError){if(c?.response?.status.toString().match(/5\d\d/)&&u)throw c;return c?.response?.status||c?.code}else throw c}}createAxiosConfig(t,r,n,i){let s={params:Object.fromEntries(t.searchParams),ignoreCertErrors:r,cookies:"",baseURL:t.origin,url:t.pathname,logger:at.logger};return n&&i&&(s=Object.assign(s,{auth:{username:n,password:i}})),s}async createOdataServiceConnection(t,r){await this.shouldIgnoreCertError(t)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,jA(!1)),this._axiosConfig=t,this._serviceProvider=VHe(this._axiosConfig),this._odataService=this._serviceProvider.service(r),this._connectType="odata_path",at.attachAxiosLogger(this._serviceProvider.interceptors),await this._odataService.get("")}resetConnectionState(t=!1){this._serviceProvider=void 0,this._odataService=void 0,this._catalogV2=void 0,this._catalogV4=void 0,this._serviceInfo=void 0,this._connectedUserName=void 0,this._refreshToken=void 0,this._connectedSystemName=void 0,this._ignoreCertError=void 0,this._connectType="abap_catalog",t&&this.resetValidity(),Vr.resetErrorState()}async shouldIgnoreCertError(t,r){at.logger.debug(`ConnectionValidator.shouldIgnoreCertError() - url: ${t.baseURL}`);let n=!1;if(process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0")try{let s=!r||r===Er.v2?Er.v2:Er.v4,o=b_(t);at.attachAxiosLogger(o.interceptors),await o.catalog(s).listServices()}catch(s){let o=ln.getErrorType(s?.response?.status??s?.code);s?.isAxiosError&&P$t.has(o)&&(at.logger.warn(we("warnings.certificateErrors",{url:t?.baseURL,error:o})),at.logger.warn(we("warnings.allowingUnauthorizedCertsNode")),n=!0)}return n}async createSystemConnection({axiosConfig:t,url:r,serviceInfo:n,destination:i,odataVersion:s,connectType:o=this._connectType}){if(this.resetConnectionState(!0),this.systemAuthType==="reentranceTicket"||this.systemAuthType==="serviceKey")this._serviceProvider=this.getAbapOnCloudServiceProvider(r,n);else if(i){let a=r?r.pathname:void 0;this._validatedUrl=tb(i.Name,a),this._destinationUrl=a?this._validatedUrl.replace(`https://${i.Name.toLowerCase()}.dest`,i.Host.replace(/\/{1,10}$/,"")):i.Host,this._serviceProvider=$He({},i)}else t&&(await this.shouldIgnoreCertError(t,s)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,jA(!1)),this._axiosConfig=t,this._serviceProvider=b_(t));if(this._serviceProvider&&at.attachAxiosLogger(this._serviceProvider.interceptors),o==="abap_catalog"){(!s||s===Er.v2)&&(this._catalogV2=this._serviceProvider.catalog(Er.v2)),(!s||s===Er.v4)&&(this._catalogV4=this._serviceProvider.catalog(Er.v4));let a=!1;try{this._catalogV2?await this._catalogV2?.listServices():this._catalogV4&&(a=!0,await this._catalogV4?.listServices())}catch(u){await this.handleCatalogError(u,a)}}else o==="odata_path"&&r&&(at.logger.debug(`Using provided url path: ${r.pathname} to validate authentication.`),this._connectType="odata_path",this._odataService=this._serviceProvider.service(`${r?.pathname}`),await this._odataService.get(""))}async handleCatalogError(t,r){let n=t.response?.status,i=n?ln.getErrorType(n):void 0,s=n&&!r&&(i===pe.NOT_FOUND||i===pe.AUTH);if(this._catalogV4&&s){this._axiosConfig&&await this.shouldIgnoreCertError(this._axiosConfig,Er.v4)&&(this._ignoreCertError=!0,jA(!1),this._axiosConfig={...this._axiosConfig,ignoreCertErrors:!0},this._serviceProvider=b_(this._axiosConfig),this._catalogV4=this._serviceProvider.catalog(Er.v4),at.attachAxiosLogger(this._serviceProvider.interceptors));try{await this._catalogV4.listServices()}catch(o){throw i===pe.AUTH?t:o}}else throw t}async refreshTokenChangedCb(t){at.logger.debug("ConnectionValidator.refreshTokenChangedCb()"),this._refreshToken=t}getAbapOnCloudServiceProvider(t,r,n){if(this.systemAuthType==="reentranceTicket"&&t)return Sre({environment:T_.EmbeddedSteampunk,url:t.origin,logger:at.logger});if(this.systemAuthType==="serviceKey"&&r)return Sre({environment:T_.Standalone,service:r,refreshToken:n,refreshTokenChangedCb:this.refreshTokenChangedCb.bind(this),logger:at.logger});throw new Error("Invalid system auth type")}async validateServiceInfo(t,r){if(!t)return!1;if(t.url===this.validatedUrl&&JSON.stringify(t.uaa)===JSON.stringify(this.serviceInfo?.uaa))return this.getValidationResultFromStatusCode(200);try{return this.systemAuthType="serviceKey",await this.createSystemConnection({serviceInfo:t,odataVersion:r}),this._connectedUserName=await this.serviceProvider.user(),this._serviceInfo=t,this._validatedUrl=t.url,this.getValidationResultFromStatusCode(200)}catch(n){return at.logger.debug(`ConnectionValidator.validateServiceInfo() - error: ${n.message}`),n?.isAxiosError&&this.getValidationResultFromStatusCode(n?.response?.status||n?.code),Vr.getErrorMsg(n)??!1}}async validateDestination(t,r,n){try{if(this.systemAuthType=t.Authentication===sp.NO_AUTHENTICATION?"basic":"unknown",eg(t)||zl(t))return await this.validateOdataServiceDestination(t,n);{let i;if(n){let s=tb(t.Name.toLowerCase(),n);i=new URL(s)}await this.createSystemConnection({destination:t,odataVersion:r,url:i,connectType:i?"odata_path":void 0})}return{valResult:this.getValidationResultFromStatusCode(200)}}catch(i){i?.isAxiosError&&this.getValidationResultFromStatusCode(i?.response?.status||i?.code);let s=Vr.logErrorMsgs(i);return{valResult:Vr.getValidationErrorHelp(i,!1,t)??s,errorType:Vr.getCurrentErrorType()??pe.DESTINATION_CONNECTION_ERROR}}}async validateOdataServiceDestination(t,r,n){this.resetConnectionState(!0);let i=tb(t.Name.toLowerCase(),r);this._destinationUrl=r?i.replace(`https://${t.Name.toLowerCase()}.dest`,t.Host.replace(/\/{1,10}$/,"")):t.Host,this._destination=t;let s=await this.checkUrl(new URL(i),void 0,void 0,{odataVersion:n}),o=this.getValidationResultFromStatusCode(s);if(this.validity.reachable&&(this._validatedUrl=i),!this.validity.reachable){let a=Vr.logErrorMsgs(s);return{valResult:Vr.getValidationErrorHelp(s,!1,t)??a,errorType:Vr.getCurrentErrorType()??pe.DESTINATION_CONNECTION_ERROR}}return this.validity.authRequired?{valResult:ln.getErrorMsgFromType(pe.AUTH,t.Authentication!==sp.NO_AUTHENTICATION?we("texts.checkDestinationAuthConfig"):void 0),errorType:pe.AUTH}:{valResult:o}}async validateUrl(t,{ignoreCertError:r=!1,forceReValidation:n=!1,isSystem:i=!1,odataVersion:s,systemAuthType:o,connectType:a}={}){if(this.isEmptyString(t))return this.resetValidity(),this.validity.urlFormat=!1,!1;o&&(this.systemAuthType=o);let u;try{if(u=new URL(t),u.origin==="null")return we("errors.invalidUrl",{input:t});if(a!=="odata_path"&&(this.systemAuthType==="reentranceTicket"||i)&&!(u.pathname.length===0||u.pathname==="/"))return we("prompts.validationMessages.systemUrlOriginOnlyWarning")}catch{return we("errors.invalidUrl",{input:t})}try{if(!n&&this.isUrlValidated(t))return this.validity.reachable??!1;this.resetValidity();let c=await this.checkUrl(u,void 0,void 0,{ignoreCertError:r,isSystem:i,odataVersion:s,connectType:a});return at.logger.debug(`ConnectionValidator.validateUrl() - status: ${c}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t,this.getValidationResultFromStatusCode(c)}catch(c){return this.resetValidity(),ln.getErrorType(c)===pe.CONNECTION?(this.validity.reachable=!1,Vr.logErrorMsgs(we("errors.systemOrServiceUrlNotFound",{url:t}))):Vr.getErrorMsg(c)??c.message}}getValidationResultFromStatusCode(t){return t===200?(this.validity.reachable=!0,this.validity.authenticated=!0,!0):ln.getErrorType(t)===pe.NOT_FOUND?(this.validity.reachable=!1,ln.getErrorMsgFromType(pe.NOT_FOUND)??!1):ln.isCertError(t)?(this.validity.reachable=!0,this.validity.canSkipCertError=P$t.has(ln.getErrorType(t)),this.validity.authenticated=!1,Vr.getValidationErrorHelp(t,!1)??!1):ln.getErrorType(t)===pe.AUTH?(this.validity.reachable=!0,this.validity.authRequired=!0,this.validity.authenticated=!1,!0):ln.getErrorType(t)===pe.REDIRECT?(this.validity.reachable=!0,we("errors.urlRedirect")):ln.getErrorType(t)===pe.CONNECTION?(this.validity.reachable=!1,ln.getErrorMsgFromType(pe.CONNECTION,we("texts.httpStatus",{httpStatus:t}))??!1):ln.getErrorType(t)===pe.BAD_REQUEST?(this.validity.reachable=!0,ln.getErrorMsgFromType(pe.BAD_REQUEST,we("texts.httpStatus",{httpStatus:t}))??!1):ln.getErrorType(t)===pe.BAD_GATEWAY?(this.validity.reachable=!1,ln.getErrorMsgFromType(pe.BAD_GATEWAY,we("texts.httpStatus",{httpStatus:t}))??!1):(this.validity.reachable=!0,ln.getErrorMsgFromType(ln.getErrorType(t),we("texts.httpStatus",{httpStatus:t}))??!0)}isEmptyString(t){return!t||t.trim().length===0}isUrlValidated(t){return this._validatedUrl===t}async isAuthRequired(){return at.logger.debug(`ConnectionValidator.isAuthRequired() - validity: ${JSON.stringify(this.validity)}`),!this._validatedUrl||this.validity.authenticated?!1:this.validity.authRequired}async validateAuth(t,r,n,{ignoreCertError:i=!1,sapClient:s,odataVersion:o,isSystem:a=!1,connectType:u}={}){if(!t)return{valResult:!1};try{let c=new URL(t);s&&c.searchParams.append(KY,s),this.systemAuthType="basic";let l=await this.checkUrl(c,r,n,{ignoreCertError:i,isSystem:a,odataVersion:o,connectType:u});at.logger.debug(`ConnectionValidator.validateAuth() - status: ${l}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t;let f=this.getValidationResultFromStatusCode(l);if(f===!0){if(this.validity.authenticated===!0)return this._connectedUserName=r,{valResult:!0};if(this.validity.authenticated===!1)return{valResult:this.getAuthFailureReasonText(l,o),errorType:pe.AUTH}}return{valResult:f}}catch(c){return{valResult:Vr.getValidationErrorHelp(c,!1,this.destination)??Vr.getErrorMsg(c)??we("errors.unknownError"),errorType:Vr.getCurrentErrorType()??void 0}}}resetValidity(){delete this.validity.urlFormat,delete this.validity.reachable,delete this.validity.authRequired,delete this.validity.authenticated,delete this.validity.canSkipCertError,this._validatedUrl=void 0,this._destinationUrl=void 0,this._destination=void 0}getAuthFailureReasonText(t,r){let n;[403,"403"].includes(t)?n=we("texts.authorizationFailed"):[401,"401"].includes(t)&&(n=we("texts.authenticationFailed"));let i;return r?i=we("errors.authenticationFailedSpecificCatalog",{odataVersion:r,authFailType:n}):i=we("errors.authenticationFailedAllCatalogs",{authFailType:n}),i}};var G$t=Te(tq(),1);var iE={newSystemType:"newSystemType",newSystemUrl:"newSystemUrl",newSystemAuthType:"newSystemAuthType"};var sE=require("@sap-devx/yeoman-ui-types");var UJn=Te(Oy(),1),kJn=Te(Py(),1);function D$t(e){return e.filter(t=>!!t.entityType.entityProperties.find(n=>n.name==="HasDraftEntity"))}var R$t=Te(Oy(),1),N$t=Te(Py(),1);function BJn(e){return!!e.find(r=>r.annotations?.Common?.DraftRoot?!!r.annotations.Common.DraftRoot.ShareAction:!1)}function VTe(e){let t=!1;try{let r;typeof e=="string"?r=(0,R$t.convert)((0,N$t.parse)(e)):r=e;let n=D$t(r.entitySets)??[];n?.length>0&&(t=!BJn(n))}catch(r){at.logger.error(we("errors.unparseableMetadata",{error:r.message}))}return t}var qJn=["/IWBEP/COMMON"],jJn="SERVICE_INQUIRER_BAS_SUCCESS",VJn=e=>{let t=[],r=!1;return typeof at.logger.getLogLevel=="function"&&(r=at.logger.getLogLevel()==="trace"),e?.filter(n=>!qJn.some(i=>n.id.includes(i))).forEach(n=>{let i=n.name,s=n.path;i=`${i} (${n.serviceVersion}) - OData V${n.odataVersion}`,r&&(i=`${i} Service Type: ${n.serviceType}`),t.push({name:i,value:{servicePath:s,serviceODataVersion:n.odataVersion,toString:()=>i,serviceType:n.serviceType,serviceId:n.id}})}),at.logger.debug(`Number of unique service choices: ${t.length}`),t.sort((n,i)=>n.name?n.name.localeCompare(i.name??""):0)};function $Jn(e,t){let r=Object.entries(e);r.forEach(([n,i])=>{Vr.logErrorMsgs(i,we("warnings.missingServices",{odataVersion:n}))}),t===r.length&&Vr.logErrorMsgs(we("errors.allCatalogServiceRequestsFailed",{version:Object.keys(e).join(", ")}))}async function I$t(e,t){let r={},n={},i=[];for(let o of e){let a=o instanceof Bm?Er.v2:Er.v4;try{let u=Date.now(),c=await o.listServices(),l=Date.now(),f=l-u===0?"<1 ms":`${l-u}ms`;n[`v${a}`]={serviceCount:c.length,duration:f},at.logger.debug(`Number of service${a===Er.v4?" groups":"s"}: ${c.length} returned in: ${f}}`),i.push(c)}catch(u){at.logger.error(we("errors.serviceCatalogRequest",{catalogRequestUri:o.getUri(),entitySet:o.entitySet,error:u})),Object.assign(r,{[a]:u}),i.push([])}}at.logger.debug(`Service catalog request times: ${JSON.stringify(n,void 0," ")}`);let s=i?.flat()??[];return at.logger.debug(`Number of services available: ${s.length}`),(s.length===0||Object.keys(r).length>0)&&$Jn(r,e.length),t&&(s=s.filter(o=>t.includes(o.id)||t.includes(o.path))),VJn(s)}function $Te(e){let t=vS.createTelemetryData({destODataType:u6(e)})??{};IS(jJn,t)}async function GJn(e,t,r,n,i){let s=[];try{let o=await t.metadata(),{validationMsg:a,version:u,convertedMetadata:c}=i7(o,i);if(a)return{validationMsg:a};if(!r&&u===zn.v2&&n)try{at.logger.debug("Creating a catalog service object for v2 service path to request annotations."),r=b_(n).catalog(Er.v2),at.attachAxiosLogger(r.interceptors)}catch(l){at.logger.warn(we("error.v2CatalogServiceNoAnnotations",l))}if(r)try{s=await r.getAnnotations({path:e})}catch{at.logger.info(we("prompts.validationMessages.noAnnotations"))}return{annotations:s,metadata:o,version:u,convertedMetadata:c}}catch(o){let a=Vr.getErrorMsg(o);return at.logger.error(we("errors.serviceMetadataErrorLog",{servicePath:e,errorText:a})),{validationMsg:we("errors.serviceMetadataErrorUI",{servicePath:e,errorText:a})}}}async function HJn(e,t,r){let n;if(t===DP.NotDetermined)try{n=await r.getServiceType(e)??DP.NotDetermined}catch(i){at.logger.error(we("errors.serviceTypeRequestError",{error:i.message}))}return n??t}async function GTe(e,t,r){let n=t.catalogs?.[e.serviceODataVersion];if(!t.serviceProvider)return at.logger.error("ConnectionValidator connection is not initialized"),{validationResult:!1};let i=t.odataService;i||(i=t.serviceProvider.service(e.servicePath));let{validationMsg:s,version:o,convertedMetadata:a,annotations:u,metadata:c}=await GJn(e.servicePath,i,n,t.axiosConfig,r);if(s)return{validationResult:s};let l=t.destinationUrl??t.validatedUrl,f;return l&&(f=new URL(l).origin),gt.odataService.annotations=u,gt.odataService.metadata=c,gt.odataService.odataVersion=o??(e.serviceODataVersion===Er.v2?zn.v2:zn.v4),gt.odataService.servicePath=e.servicePath,gt.odataService.serviceId=e.serviceId,gt.odataService.origin=f,gt.odataService.sapClient=t.validatedClient,gt.odataService.ignoreCertError=t.ignoreCertError,{validationResult:!0,hasAnnotations:!!gt.odataService.annotations&&gt.odataService.annotations.length>0,convertedMetadata:a}}function L$t(e){let t=we("prompts.systemService.message");return e&&(t=t.concat(` ${we("texts.forUserName",{username:e})}`)),t}async function M$t(e,t,r,{requiredOdataVersion:n,hasAnnotations:i=!0,showCollabDraftWarnOptions:s,serviceFilter:o}){if(e?.length===0)return o&&o.length>0?{message:we("warnings.specifiedServicesNotAvailable",{odataVersion:n?`V${n} `:void 0,service:o[0],count:o.length}),severity:sE.Severity.warning}:n?{message:we("warnings.noServicesAvailableForOdataVersion",{odataVersion:n}),severity:sE.Severity.warning}:{message:we("warnings.noServicesAvailable"),severity:sE.Severity.warning};if(t){let a=t.serviceType;if(t.serviceODataVersion===Er.v2){if(!i)return{message:we("warnings.noAnnotations"),severity:sE.Severity.warning};a=await HJn(t.servicePath,t.serviceType,r.catalogs[Er.v2])}else if(s?.showCollabDraftWarning&&t.serviceODataVersion===Er.v4&&VTe(s.edmx))return{message:we("warnings.collaborativeDraftMessage"),severity:sE.Severity.warning};if(a&&a!==DP.UI)return{message:we("warnings.nonUIServiceTypeWarningMessage",{serviceType:"A2X"}),severity:sE.Severity.warning}}else if(Vr.getErrorMsg())return{message:`${Vr.getErrorMsg()} ${we("texts.seeLogForDetails")}`,severity:sE.Severity.information}}var WJn="VALUE_HELP_DOWNLOAD_PROMPTED",YJn="VALUE_HELP_DOWNLOAD_SUCCESS",zJn="VALUE_HELP_DOWNLOAD_FAILED";async function HTe(e,t,r){let n=vS.createTelemetryData(t)??{};if(r&&Object.keys(r).length>0){let i=VUt();i&&await i.reportEvent({eventName:e,properties:n,measurements:r},Ci.NoSampling)}else IS(e,n)}async function F$t(e,t,r){if(delete gt.odataService.valueListMetadata,await HTe(WJn,{userChoseToDownload:e}),e&&t.serviceProvider instanceof ja){let n=Date.now();try{let i=await t.serviceProvider.fetchExternalServices(r),s=Date.now()-n;i.length>0?gt.odataService.valueListMetadata=i:at.logger.info(we("warnings.noExternalServiceMetdataFetched")),await HTe(YJn,{userChoseToDownload:!0,valueHelpCount:i.length},{downloadTimeMs:s})}catch(i){let s=Date.now()-n;at.logger.error(`Failed to fetch external service metadata: ${i}`),await HTe(zJn,{userChoseToDownload:!0,error:i instanceof Error?i.message:"Unknown error"},{downloadTimeMs:s})}}}function U$t(e,t,r){let n=`${t?t+":":""}`,i=`${n}${wn.valueHelpDownload}`,s=`${n}${wn.serviceSelection}`,o=`${n}cliValueHelpDownload`,a,c=[{when:l=>{let p=l?.[s]?.servicePath;return p&&r?.convertedMetadata?(a=lM(p,r?.convertedMetadata),a.length>0):!1},name:i,type:"confirm",message:we("prompts.valueHelpDownload.message"),validate:async l=>(Bo()!==un.cli&&await F$t(l,e,a),!0)}];return Bo()===un.cli&&c.push({when:async l=>{let f=l?.[i];return f!==void 0&&a&&await F$t(f,e,a),!1},name:o,type:"input"}),c}var KJn="cliServiceSelection";function oE(e,t,r,n=!0){let i=[],s,o,a,u,c,l={convertedMetadata:void 0},f=r?.requiredOdataVersion,p=`${t}:${wn.serviceSelection}`,d={when:()=>e.validity.authenticated||e.validity.authRequired===!1,name:p,type:r?.useAutoComplete?"autocomplete":"list",message:()=>L$t(e.connectedUserName),guiOptions:{breadcrumb:we("prompts.systemService.breadcrumb"),mandatory:!0,applyDefaultWhenDirty:!0},showOutputTabLink:"validationMessageOverflow",source:(g,v)=>ww(v,i),choices:async g=>{if(i.length===0||s!==e.validatedUrl||o!==e.validatedClient||!C$t(u,r?.serviceFilter))if(e.catalogs[zn.v2]||e.catalogs[zn.v4])i=await XJn(e.catalogs,f,r?.serviceFilter),s=e.validatedUrl,o=e.validatedClient,u=r?.serviceFilter?[...r.serviceFilter]:void 0,g?.[`${wn.systemSelection}`]?.type==="destination"&&$Te(g?.[`${wn.systemSelection}`]?.system);else if(e.odataService&&e.validatedUrl&&!await e.isAuthRequired()){let v=new URL(e.destinationUrl??e.validatedUrl);i=[{name:v.toString(),value:{servicePath:v.pathname}}],g?.[`${wn.systemSelection}`]?.type==="destination"&&$Te(g?.[`${wn.systemSelection}`]?.system)}else at.logger.error(we("errors.noCatalogOrServiceAvailable"));return i},additionalMessages:g=>M$t(i,g,e,{requiredOdataVersion:f,hasAnnotations:c,showCollabDraftWarnOptions:l.convertedMetadata?{showCollabDraftWarning:!!r?.showCollaborativeDraftWarning,edmx:l.convertedMetadata}:void 0,serviceFilter:r?.serviceFilter}),default:()=>n7(i),validate:async g=>{let v=g;if(r?.useAutoComplete&&g.value&&(v=g.value),!e.validatedUrl)return!1;if(i.length===0&&Vr.hasError())return ln.getHelpForError(pe.SERVICES_UNAVAILABLE)??!1;if(v&&(a?.servicePath!==v.servicePath||a?.servicePath!==gt.odataService.servicePath)){c=void 0,l.convertedMetadata=void 0,a=v;let S=await GTe(v,e,f);return c=S.hasAnnotations,l.convertedMetadata=S.convertedMetadata,S.validationResult}return!0}};if(r?.additionalMessages){let g={[p]:{additionalMessages:r.additionalMessages}};d=xve([d],g,gt.odataService)[0]}let h=[d];return Bo()===un.cli&&!r?.useAutoComplete&&h.push({when:async g=>{let v=g?.[`${t}:${wn.serviceSelection}`];if(v&&e.validatedUrl){let{validationResult:S,hasAnnotations:b,convertedMetadata:A}=await GTe(v,e);if(typeof S=="string")throw at.logger.error(S),new Error(S);c=b,l.convertedMetadata=A}if(i.length===0&&Vr.hasError()){let S=ln.getHelpForError(pe.SERVICES_UNAVAILABLE).toString();throw new Error(S)}return!1},name:`${t}:${KJn}`}),n||h.push(...Ps(U$t(e,t,l),g=>e.serviceProvider instanceof ja&&!!l.convertedMetadata&&g?.[p]?.serviceODataVersion===Er.v4)),h}async function XJn(e,t,r){let n=[];return t&&e[t]?n.push(e[t]):n=Object.values(e).filter(i=>i!==void 0),await I$t(n,r)}async function WTe(){return await gS({entityName:"system"})}async function s7(e=!1){let t=[];try{t=await(await WTe()).getAll({includeSensitiveData:e,backendSystemFilter:{connectionType:["abap_catalog","odata_service"]}})}catch(r){at.logger.error(we("errors.backendSystemRetrieval",{error:r.message}))}return t}async function JJn(e){return!!(await s7(!1)).find(r=>r.name===e)}async function KM(e){return e?await JJn(e)?we("prompts.systemName.systemNameExistsWarning"):!0:we("prompts.systemName.emptySystemNameWarning")}function k$t(e,t){try{return new URL(t,e),!0}catch{return we("errors.invalidUrl",{input:`${e}${t}`})}}async function B$t(e,t){let r=e+(t?we("texts.suggestedSystemNameClient",{client:t}):"");return await KM(r)===!0?r:QJn(r)}async function QJn(e){let t=1,r=`${e} (${t})`;for(;await KM(r)!==!0;)r=`${e} (${t})`,t++;return r}var q$t=require("@sap-devx/yeoman-ui-types");var YTe=require("@sap-devx/yeoman-ui-types");var cc;(function(e){e.systemUsername="systemUsername",e.systemPassword="systemPassword",e.storeSystemCredentials="storeSystemCredentials"})(cc||(cc={}));function o7(e,t,r,n){let i=`${t?t+":":""}${cc.systemUsername}`,s=`${t?t+":":""}${cc.systemPassword}`,o=`${t?t+":":""}${cc.storeSystemCredentials}`,a,u=[{when:async()=>(a=await e.isAuthRequired(),e.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"input",name:i,message:we("prompts.systemUsername.message"),guiOptions:{mandatory:!0},default:"",validate:l=>l?.length>0},{when:()=>!!(e.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"password",guiOptions:{mandatory:!0,applyDefaultWhenDirty:!0},guiType:"login",showOutputTabLink:"validationMessageOverflow",name:s,message:we("prompts.systemPassword.message"),mask:"*",default:"",validate:async(l,f)=>{if(!(e.validatedUrl&&f?.[i]&&l&&(!r||r.isValid)))return!1;let p=f?.[wn.systemSelection],d,h=!0;if(p?.type==="backendSystem")d=p.system?.client;else if(p?.type==="destination"){let v=p.system;(eg(v)||zl(v))&&(h=!1)}let{valResult:g}=await e.validateAuth(e.validatedUrl,f?.[i],l,{sapClient:r?.sapClient||d,isSystem:h,odataVersion:Qh(n)});return g===!0&&e.serviceProvider?(ZJn(e.serviceProvider,p,{username:f?.[i],password:l}),!0):g},additionalMessages:(l,f)=>{if(e.ignoreCertError&&f?.newSystemType!=="abapOnPrem")return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:YTe.Severity.warning}}}],c={when:l=>!!(e.systemAuthType==="basic"&&a&&e.validity.authenticated&&l[s]),type:"confirm",name:o,message:we("prompts.storeSystemCredentials.message"),default:!1,guiOptions:{breadcrumb:we("prompts.storeSystemCredentials.breadcrumb")},validate:async l=>{if(gt.odataService.connectedSystem?.backendSystem){let f=gt.odataService.connectedSystem.backendSystem;gt.odataService.connectedSystem.backendSystem=Object.assign(f,{newOrUpdated:l})}return!0},additionalMessages:l=>{if(l===!0)return{message:we("texts.passwordStoreWarning"),severity:YTe.Severity.warning}}};return jr()||u.push(c),u}function ZJn(e,t,{username:r,password:n}){if(gt.odataService.connectedSystem={serviceProvider:Zh(e)},t?.type==="backendSystem"){let i=t.system;(i.username!==r||i.password!==n)&&(gt.odataService.connectedSystem.backendSystem=Object.assign(i,{username:r,password:n,userDisplayName:r}))}else t?.type==="destination"&&(gt.odataService.connectedSystem.destination=t.system)}function eQn(e){switch(e){case"serviceKey":return hL.ReentranceTicket;case"reentranceTicket":return hL.ReentranceTicket;case"basic":return hL.Basic;default:return}}function a7(e,t,r,n,i=!0){return{type:"input",name:`${t?t+":":""}${iE.newSystemUrl}`,message:we("prompts.systemUrl.message"),guiOptions:{hint:we("prompts.systemUrl.description"),mandatory:!0,breadcrumb:!0},validate:async a=>{if(gt.resetConnectedSystem(),n&&n.backendSystem?.url===a&&n.backendSystem?.authenticationType==="reentranceTicket")e.setConnectedSystem(n);else if(i){let c=xO(gt.backendSystemsCache,a);if(c)return we("prompts.validationMessages.backendSystemExistsWarning",{backendName:c.name})}let u=await e.validateUrl(a,{isSystem:!0,odataVersion:Qh(r)});return u===!0&&(e.validity.authenticated&&e.serviceProvider?gt.odataService.connectedSystem={serviceProvider:Zh(e.serviceProvider)}:e.systemAuthType="basic"),u},additionalMessages:()=>{if(e.ignoreCertError)return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:q$t.Severity.warning}}}}function u7(e,t){let r,n=!1,i=`${t?t+":":""}`,s=`${i}${wn.userSystemName}`;return{type:"input",guiOptions:{hint:we("prompts.systemName.hint"),applyDefaultWhenDirty:!0,breadcrumb:!0,mandatory:!0},name:s,message:we("prompts.systemName.message"),default:async()=>{let a=e.connectedSystemName;return a&&!n&&(r=await B$t(a,e.validatedClient)),r},validate:async(a,u)=>{if(!a)return!1;let c=!1;a===r?c=!0:(n=!0,r=a,c=await KM(a));let l=!!u?.[`${i}${cc.storeSystemCredentials}`];if(c===!0&&e.validatedUrl&&gt.odataService.connectedSystem){let f=new ai({authenticationType:eQn(e.systemAuthType),name:a,url:e.validatedUrl,client:e.validatedClient,username:l?e.axiosConfig?.auth?.username:void 0,password:l?e.axiosConfig?.auth?.password:void 0,serviceKeys:e.serviceInfo,userDisplayName:e.connectedUserName,systemType:mL({serviceKeys:e.serviceInfo,authenticationType:e.systemAuthType}),connectionType:"abap_catalog"});gt.odataService.connectedSystem.backendSystem=f,gt.odataService.connectedSystem.backendSystem.newOrUpdated=!0}return c}}}var zTe="!@\xA3*&937newSystem*X~qy^",c7="cfAbapEnvService";async function j$t(e,t,r,n,i){gt.resetConnectedSystem();let s=!1,a=await(await WTe()).read(e);if(a){n&&n.backendSystem?.url===a.url&&t.setConnectedSystem(n);let u=new URL(a.url),c=u.origin;if(i&&(c=new URL(i,u.origin).toString()),a.authenticationType==="reentranceTicket")u.pathname!=="/"&&at.logger.warn(we("warnings.storedSystemUrlPathNotSupported",{systemUrl:a.url})),s=await t.validateUrl(c,{isSystem:!0,odataVersion:Qh(r),systemAuthType:"reentranceTicket",connectType:i?"odata_path":void 0});else if(a.serviceKeys)s=await t.validateServiceInfo(a.serviceKeys,Qh(r));else if(a.authenticationType==="basic"||!a.authenticationType){let l;if({valResult:s,errorType:l}=await t.validateAuth(c,a.username,a.password,{isSystem:!0,odataVersion:Qh(r),sapClient:a.client,connectType:i?"odata_path":void 0}),l===pe.AUTH)return at.logger.error(we("errors.storedSystemConnectionError",{systemName:a.name,error:s})),!0}s===!0&&t.serviceProvider&&(gt.odataService.connectedSystem={serviceProvider:Zh(t.serviceProvider),backendSystem:a})}return s}async function XM(e,t,r,n){gt.resetConnectedSystem();let{valResult:i,errorType:s}=await t.validateDestination(e,Qh(r),n);return s===pe.AUTH&&t.systemAuthType==="basic"?(at.logger.error(we("errors.destination.authError",{systemName:e.Name,error:i})),!0):(i===!0&&t.serviceProvider&&(gt.odataService.connectedSystem={serviceProvider:Zh(t.serviceProvider),destination:e}),i)}function tQn(e,t){return!t||t.odata_abap&&aq(e)||t.odata_generic&&oq(e)||t.full_service_url&&eg(e)||t.partial_service_url&&zl(e)?!0:(at.logger.debug(`Destination: ${e.Name} does not match any filters and will be excluded as a prompt choice. Destination configuration: ${JSON.stringify(e)}`),!1)}async function V$t(e,t=!1,r=!1){let n=[],i;if(jr()){let s={};try{s=await hre({stripS4HCApiHosts:!0})}catch(o){at.logger.error(we("errors.destination.listDestinations",{error:o.message}))}n=Object.values(s).filter(o=>tQn(o,e)).map(o=>({name:mHe(o),value:{type:"destination",system:o}})),t&&(i={name:we("prompts.newSystemType.choiceCFAbapEnvServiceOnBtp"),value:{type:c7,system:c7}})}else{let s=await s7(!1);gt.backendSystemsCache=s,n=s.map(o=>({name:c5e(o),value:{system:o,type:"backendSystem"}})),r||(i={name:we("prompts.systemSelection.newSystemChoiceLabel"),value:{type:"newSystemChoice",system:zTe}})}return n.sort(({name:s},{name:o})=>s.localeCompare(o,void 0,{numeric:!0,caseFirst:"lower"})),i&&n.unshift(i),n}function KTe(e,t){let r=typeof t=="string"?t:t?.value;return r?e.findIndex(i=>{let{type:s,system:o}=i.value;if(s==="destination")return o.Name===r;if(s==="backendSystem")return o.name===r;if(s==="newSystemChoice")return r===zTe;if(s==="cfAbapEnvService")return r===c7}):-1}var l7="abapOnBtp",_rs=`${l7}:${iE.newSystemUrl}`,rQn="cliCfAbapService",XTe={abapOnBtpAuthType:"abapOnBtpAuthType",cloudFoundryAbapSystem:"cloudFoundryAbapSystem"};function H$t(e,t){gt.reset();let r=new Sl,n=[];return n.push({type:"list",name:XTe.abapOnBtpAuthType,choices:[{name:we("prompts.abapOnBTPType.choiceCloudFoundry"),value:"cloudFoundry"},{name:we("prompts.abapOnBTPType.choiceReentranceTicket"),value:"reentranceTicket"}],message:we("prompts.abapOnBTPType.message"),validate:()=>(r.resetConnectionState(!0),gt.resetConnectedSystem(),!0)}),n.push(Ps([a7(r,l7,e?.serviceSelection?.requiredOdataVersion,t)],i=>i?.abapOnBtpAuthType==="reentranceTicket"?(r.systemAuthType=i.abapOnBtpAuthType,!0):!1)[0],...Ps([...JTe(r,void 0,void 0,t)],i=>i?.abapOnBtpAuthType==="cloudFoundry")),e?.userSystemName?.hide!==!0&&n.push(Ps([u7(r,l7)],()=>!!r.validatedUrl&&r.validity.reachable===!0&&(r.validity.authenticated??r.validity.authRequired!==!0))[0]),n.push(...oE(r,l7,e?.serviceSelection,e?.valueHelpDownload?.hide)),n}async function $$t(e,t,r,n=!1,i){gt.resetConnectedSystem();let s=e.label,o=await(0,G$t.apiGetInstanceCredentials)(s);if(!o?.credentials?.uaa)return we("errors.cfInstanceCredentialsNotReturned",{serviceInstanceName:s});let a=!0,u;if(Bo()===un.bas)try{u=await _He(s,{uaaCredentials:o.credentials.uaa,hostUrl:o.credentials.url},at.logger),a=await XM(u,t,r)}catch(c){a=c.message}else i&&i.backendSystem?.url===o.credentials.url&&JSON.stringify(i.backendSystem.serviceKeys?.uaa)===JSON.stringify(o.credentials.uaa)&&t.setConnectedSystem(i),a=await t.validateServiceInfo(o.credentials);if(!n&&a!==!0)return a;if(n&&typeof a=="string")throw at.logger.error(a),new Error(a);if(n&&a===!1)throw at.logger.error(Vr.getErrorMsg()??we("errors.abapServiceAuthenticationFailed")),new Error(we("errors.abapServiceAuthenticationFailed"));return t.serviceProvider&&Bo()!==un.bas&&(t.connectedSystemName=await mre(s),gt.odataService.connectedSystem={serviceProvider:Zh(t.serviceProvider)}),!0}function JTe(e,t,r,n){let i=[],o=[{type:"list",name:`${t?t+":":""}${XTe.cloudFoundryAbapSystem}`,guiOptions:{breadcrumb:!0,applyDefaultWhenDirty:!0},choices:async()=>{if(i=await GUt(Vr),i.length===0&&Bo()===un.cli)throw new Error(we("errors.abapEnvsUnavailable"));return i},default:()=>n7(i),message:we("prompts.cloudFoundryAbapSystem.message"),validate:async a=>{if(a){let c=await $$t(a,e,r,Bo()===un.cli,n);if(!jr()&&c===!0&&e.validatedUrl){let l=xO(gt.backendSystemsCache,e.validatedUrl,e.validatedClient);if(l)return e.resetConnectionState(!0),we("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}return c}if(Vr.getCurrentErrorType()===pe.NO_ABAP_ENVS){let c=Vr.getErrorMsg(!0),l=we("texts.seeLogForDetails");return`${c} ${l}`}return!1}}];return Bo()===un.cli&&o.push({when:async a=>{let u=a?.[XTe.cloudFoundryAbapSystem];return u&&await $$t(u,e,r,!0),!1},name:rQn}),o}function W$t(e){let t="cfAbapBas",r=new Sl;return[...JTe(r,t,e?.serviceSelection?.requiredOdataVersion),...oE(r,t,e?.serviceSelection,e?.valueHelpDownload?.hide)]}var zS="abapOnPrem",QTe=`${zS}:${iE.newSystemUrl}`,Lrs=`${zS}:${cc.systemUsername}`,Mrs=`${zS}:${cc.systemPassword}`,nQn={sapClient:"sapClient"};function Y$t(e){gt.reset();let t=new Sl,r=e?.serviceSelection?.requiredOdataVersion,n=iQn(e?.userSystemName,t,r);return n.push(...oE(t,zS,e?.serviceSelection,e?.valueHelpDownload?.hide)),n}function iQn(e,t,r){let n=t??new Sl,i={sapClient:void 0,isValid:!0},s=[a7(n,zS,r,void 0,!1),{type:"input",name:nQn.sapClient,message:we("prompts.sapClient.message"),guiOptions:{breadcrumb:we("prompts.sapClient.breadcrumb")},validate:(o,a)=>{let u=s$t(o);if(u===!0){if(i.sapClient=o,i.isValid=!0,a?.[QTe]){let c=xO(gt.backendSystemsCache,a[QTe],o);if(c)return i.isValid=!1,we("prompts.validationMessages.backendSystemExistsWarning",{backendName:c.name})}return!0}return i.sapClient=void 0,i.isValid=!1,u}},...o7(n,zS,i,r)];return e?.hide!==!0&&s.push(Ps([u7(n,zS)],o=>!!o?.[QTe]&&n.validity.reachable===!0&&(n.validity.authenticated||n.validity.authRequired===!1))[0]),s}function z$t(e,t){let r=[{type:"list",name:iE.newSystemType,choices:[{name:we("prompts.newSystemType.choiceAbapOnBtp"),value:"abapOnBtp"},{name:we("prompts.newSystemType.choiceAbapOnPrem"),value:"abapOnPrem"}],message:we("prompts.newSystemType.message")}];return r.push(...Ps(Y$t(e),n=>n.newSystemType==="abapOnPrem")),r.push(...Ps(H$t(e,t),n=>n.newSystemType==="abapOnBtp")),r}var f7="systemSelection",ins=`${f7}:${cc.systemUsername}`,sns=`${f7}:${cc.systemPassword}`,K$t={systemSelectionCli:"systemSelectionCli",destinationServicePath:"destinationServicePath"};async function X$t(e,t,r,n,i){if(gt.reset(),e.type==="newSystemChoice"||e.type==="cfAbapEnvService")return t.resetConnectionState(!0),!0;let s=!1;if(e.type==="backendSystem"){e.system.connectionType==="odata_service"&&(i=e.system.url);let o=la.from(e.system);s=await j$t(o,t,r,n,i)}else if(e.type==="destination"){if(zl(e.system))return!0;s=await XM(e.system,t,r,i)}return s}async function ebe(e,t){gt.reset();let r=new Sl,n=await sQn(r,e,t);return e?.serviceSelection?.hide||n.push(...Ps(oE(r,f7,e?.serviceSelection,e?.valueHelpDownload?.hide),i=>i.systemSelection?.type!=="newSystemChoice")),jr()?n.push(...Ps(W$t(e),i=>i.systemSelection?.type==="cfAbapEnvService")):n.push(...Ps(z$t(e,t),i=>i.systemSelection?.type==="newSystemChoice")),n}async function sQn(e,t,r){let n=t?.serviceSelection?.requiredOdataVersion,i=t?.systemSelection?.destinationFilters,s=await V$t(i,t?.systemSelection?.includeCloudFoundryAbapEnvChoice,t?.systemSelection?.hideNewSystem),o=KTe(s,t?.systemSelection?.defaultChoice),a=t?.systemSelection?.connectPath,u=t?.systemSelection?.onlyShowDefaultChoice&&t?.systemSelection?.defaultChoice,c=[{type:t?.systemSelection?.useAutoComplete?"autocomplete":"list",name:wn.systemSelection,message:we("prompts.systemSelection.message"),guiOptions:{breadcrumb:!0,hint:we("prompts.systemSelection.hint")},source:(l,f)=>ww(f,s),choices:u?[s[o]]:s,default:()=>u?0:(o=KTe(s,t?.systemSelection?.defaultChoice),typeof t?.systemSelection?.connectPath=="object"&&(a=t?.systemSelection.connectPath),o),validate:async l=>{if(!l)return!1;let f=l;return t?.systemSelection?.useAutoComplete&&l.value&&(f=l.value),X$t(f,e,n,r,a?.value)??!1},additionalMessages:async l=>{if(l.type==="backendSystem"&&e.systemAuthType==="basic"&&await e.isAuthRequired())return{message:we("prompts.systemSelection.authenticationFailedUpdateCredentials"),severity:ZTe.Severity.information};if(e.ignoreCertError)return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:ZTe.Severity.warning}}}];if(jr()){let l={when:f=>{let p=f?.[wn.systemSelection];return p?.type==="destination"?zl(p.system):!1},type:"input",name:K$t.destinationServicePath,message:we("prompts.destinationServicePath.message"),guiOptions:{hint:we("prompts.destinationServicePath.hint"),mandatory:!0,breadcrumb:!0,applyDefaultWhenDirty:!0},default:"",validate:async(f,p)=>{if(!f||f.trim().length<2||f.startsWith("//"))return e.resetConnectionState(!0),we("prompts.destinationServicePath.invalidServicePathWarning");let d=p?.[wn.systemSelection]?.system,h=k$t(d.Host,f);return h!==!0?(e.resetConnectionState(!0),h):await XM(d,e,n,f)}};c.push(l)}return Bo()===un.cli&&!t?.systemSelection?.useAutoComplete&&c.push({when:async l=>{let f=l?.[wn.systemSelection];if(!f)return!1;let p=await X$t(f,e,n,void 0,a?.value);if(p!==!0)throw at.logger.error(p.toString),new Error(p.toString());return!1},name:`${K$t.systemSelectionCli}`}),c.push(...o7(e,f7,void 0,n)),c}var oQn=require("@sap-devx/yeoman-ui-types");var tbe;(function(e){e.ignoreCertError="ignoreCertError",e.username="username",e.cliIgnoreCertValidate="cliIgnoreCertValidate"})(tbe||(tbe={}));var uQn=require("@sap-devx/yeoman-ui-types");async function J$t(e,t,r){return t!==void 0&&(gt.isYUI=t),r&&(at.logger=r),{prompts:await ebe(e),answers:gt.odataService}}var F8t=Te(Oy()),DO=Te(Py()),fbe=require("node:fs"),U8t=require("node:fs/promises"),k8t=require("node:module"),x7=require("node:path");var QM=Te(N8t());var I8t=["DraftAdministrativeData","SiblingEntity"],L8t=["I_DraftAdministrativeData"];function OQn(e,t){for(let r of Object.keys(t))if(e[r]){let n=new Set(e[r].map(i=>JSON.stringify(i)));for(let i of t[r]){let s=JSON.stringify(i);n.has(s)||(n.add(s),e[r].push(i))}}else e[r]=t[r];return e}function pbe(e,t,r,n,i=""){let s={},o=Array.isArray(e)?e:[e],a={};return o.forEach(u=>{for(let l of Object.keys(u)){let f=i?`${i}/${l}`:l,p=t[f]??t[l];if(!p||!u[l])continue;let d=pbe(u[l],t,p,void 0,f);OQn(s,d),delete u[l]}a[r]||(a[r]=new Set((s[r]??[]).map(l=>JSON.stringify(l))));let c=JSON.stringify(u);a[r].has(c)||(a[r].add(c),s[r]?s[r].push(u):s[r]=[u])}),n?.length&&(DQn(s,n),RQn(s,n)),s}var CQn=/^[0-9A-F]{32}$/,M8t=/^0\d+$/;function PQn(e){let t=e.toLowerCase();return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function DQn(e,t){for(let r of t){let n=r.nodeProperty.split("/");for(let i of Object.values(e))for(let s of i){let o=s,a;if(n.length>1?a=o[n[0]]?.[n[1]]:a=o[n[0]],typeof a=="string"){if(r.parentPropertyType&&["Edm.Guid","Edm.UUID"].includes(r.parentPropertyType)&&CQn.test(a)){let u=PQn(a);n.length>1?o[n[0]][n[1]]=u:o[n[0]]=u}else if(r.parentProperty&&M8t.test(a)){let u=Number.parseInt(a,10).toString();n.length>1?o[n[0]][n[1]]=u:o[n[0]]=u;let c=o[r.parentProperty];typeof c=="string"&&M8t.test(c)&&(o[r.parentProperty]=Number.parseInt(c,10).toString())}}}}}function RQn(e,t){for(let r of t){let n=r.nodeProperty.split("/");for(let i of Object.values(e))for(let s of i){let o=s;if(!r.parentProperty||!(r.parentProperty in o))continue;(n.length>1?o[n[0]]?.DistanceFromRoot:o.DistanceFromRoot)===0&&(o[r.parentProperty]="")}}}async function B8t(e,t){let r=await gS({logger:cr.logger,entityName:"system"});return typeof t=="number"&&(t=String(t)),(await r.read(new la({url:e,client:t})))?.name??"NewSystemChoice"}function NQn(e){let t=[],r=new Set(["DraftUUID","IsActiveEntity"]),n=e.keys.filter(i=>!r.has(i.name));if(e?.annotations.Common?.SemanticKey){e.annotations.Common.SemanticKey.forEach((o,a)=>{let u=o.value,l=n.some(f=>f.name===u)?void 0:n[a]?.name;l&&cr.logger.debug(`Semantic key '${u}' mapped to actual entity key '${l}'`),t.push({name:u,keyName:l,type:o.$target?.type??"Edm.String",value:void 0})});let s=new Set(t.map(o=>o.name));e.keys.filter(o=>r.has(o.name)&&!s.has(o.name)).forEach(o=>{t.push({name:o.name,type:o.type,value:o.name==="IsActiveEntity"?"true":void 0})})}return t.length===0&&e.keys.forEach(i=>{t.push({name:i.name,type:i.type,value:i.name==="IsActiveEntity"?"true":void 0})}),t}function IQn(e,t){return e.find(r=>r.entityTypeName===t)}function q8t(e,t,r,n=4){let i=[];return--n>0&&e.navigationProperties.forEach(s=>{if(!I8t.includes(s.name)){let o=[];s.targetType.navigationProperties.length>0&&n>0&&(o=q8t(s.targetType,t,r,n)),i.push({entityType:s.targetType,entityPath:s.name,entitySetName:t.entitySets.find(a=>a.entityTypeName===s.targetTypeName)?.name??"Unknown",navPropEntities:[...o]})}}),i}function LQn(e,t,r){let n=r?(0,x7.join)(r,`${e}.js`):void 0;if(!n||!(0,fbe.existsSync)(n))return;let s=(0,k8t.createRequire)(__filename)(n).getReferentialConstraints?.({name:t,referentialConstraint:[]})??[];return cr.logger.debug(`getHierarchyEntities: '${e}' loaded constraints from existing file: ${JSON.stringify(s)}`),s[0]?.sourceProperty}function MQn(e,t,r,n){if(r)return{parentProperty:t?.$target?.referentialConstraint?.[0]?.sourceProperty,missingReferentialConstraints:void 0};let i=t?.value;if(!i)return{parentProperty:void 0,missingReferentialConstraints:void 0};let s=LQn(e,i,n);return s?{parentProperty:s,missingReferentialConstraints:void 0}:(cr.logger.debug(`getHierarchyEntities: '${e}' nav prop '${i}' has no referentialConstraint in metadata \u2014 will prompt user`),{parentProperty:void 0,missingReferentialConstraints:{navPropName:i,constraints:[]}})}function FQn(e,t){let r=[];for(let n of e.entitySets){let i=n.entityType?.annotations?.Aggregation,s=Object.keys(i??{}).find(d=>d.startsWith("RecursiveHierarchy"));if(!s)continue;let o=i[s],a=o.NodeProperty?.value;if(!a)continue;cr.logger.debug(`Number of hierarchy annotations entity type: ${n.entityType.name} - ${Object.keys(i).filter(d=>d.startsWith("RecursiveHierarchy")).length}`);let u=s.split("#")[1]??"",c=o.ParentNavigationProperty,l=(c?.$target?.referentialConstraint?.length??0)>0,{parentProperty:f,missingReferentialConstraints:p}=MQn(n.name,c,l,t);r.push({entitySetName:n.name,entityTypeName:n.entityType.fullyQualifiedName,qualifier:u,nodeProperty:a,parentProperty:f,parentPropertyType:f?n.entityType.entityProperties.find(d=>d.name===f)?.type??"Edm.String":void 0,isDraft:!!(n.annotations?.Common?.DraftRoot??n.annotations?.Common?.DraftNode),entityTypeKeys:n.entityType.keys.map(d=>d.name),entityProperties:n.entityType.entityProperties.map(d=>d.name),missingReferentialConstraints:p})}return r.length&&cr.logger.debug(`Hierarchy entities found: ${r.map(n=>n.entitySetName).join(", ")}`),r}async function j8t(e,t,r){let n,i=e.app.services.mainService;try{if(i.local){let s=(i.annotations??[]).map(f=>f.local).filter(f=>!!f&&(0,fbe.existsSync)(f)),a=(await Promise.all(s.map(f=>(0,U8t.readFile)(f,"utf-8")))).map((f,p)=>(0,DO.parse)(f,s[p])),u=a.length>0?(0,DO.merge)((0,DO.parse)(r),...a):(0,DO.parse)(r),c=(0,F8t.convert)(u),l=await t.readApp({app:e});if(l.applicationModel&&l.applicationModel?.target?.fioriElements==QM.FioriElementsVersion.v4){let p=l.applicationModel.pages,d,h=[];if(Object.values(p).forEach(A=>{if(A.pageType===QM.PageTypeV4.ListReport&&A.entityType&&A.entitySet){if(d=c.entityTypes.find(w=>w.fullyQualifiedName===A.entityType),d){let w=NQn(d);n={listEntity:{entitySetName:A.entitySet,semanticKeys:w,entityPath:A.entitySet,entityType:d}},n.listEntity.navPropEntities=q8t(d,c)}}else if(A.pageType===QM.PageTypeV4.ObjectPage&&A.entityType&&A.entitySet&&A.entitySet&&A.entityType&&A.entityType!==d?.fullyQualifiedName){let w=IQn(c.entitySets,A.entityType),x={entityPath:A.navigationProperty,entitySetName:A.entitySet,entityType:w?.entityType,page:A};h.push(x)}}),!n?.listEntity)return cr.logger.info(Nt("info.noListEntityDefined")),Nt("info.noListEntityDefined");n.pageObjectEntities=h;let g=e.getAppRoot(),S=(await Ax(g))?.services?.find(A=>A.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===i.uri?.replaceAll(/(^\/)|(\/$)/g,"")),b=(0,x7.join)(g,S?.mockdataPath??(0,x7.join)(oi.Webapp,oi.LocalService,oi.Mockdata));n.hierarchyEntities=FQn(c,b)}}return n}catch(s){let o=Nt("errors.entityModelLoading",{error:s});return cr.logger.error(o),o}}function V8t(e,t){let r=JSON.stringify(t,null,4).replaceAll(`
723
+ specVersion: "2.5"`);return s.setMetadata({name:e}),s.setType("application"),s.addFioriToolsProxyMiddleware({ui5:{}}),s.addFioriToolsAppReloadMiddleware(),s.addMockServerMiddleware(t,r,n,i),s}async function kIt(e,t,r,n){let i=await Co.newInstance("");i.addMockServerMiddleware(e,t,r,n);let s=i.findCustomMiddleware("sap-fe-mockserver");if(!s)throw Error("Could not create new mockserver config");return s}async function d4(e,t,r){return r||(r=(0,qIt.create)((0,BIt.create)())),t.packageJsonConfig?.skip||FIt(r,e,t.packageJsonConfig),await UIt(r,e,t.webappPath,t.ui5MockYamlConfig),r}var y1n=Te(CI(),1),E1n=Te(Mx(),1);var jIt={questions:{pathToMock:"Path to mocked service",overwrite:"Overwrite services"}};var d_e="mockserver-config-writer",VIt;async function S1n(){VIt=Ur.createInstance({resources:{en:{[d_e]:jIt}},lng:"en",fallbackLng:"en",defaultNS:d_e,ns:[d_e],showSupportNotice:!1}),await VIt.init()}S1n().catch(()=>{});var $It={error:{requiredProjectFileNotFound:"Invalid project structure. Cannot find the required file: {{-path}}.",requiredProjectPropertyNotFound:"The required project property: {{-property}} was not found in the file: {{-path}}.",requiredServiceAlreadyExists:"A service with the {{-uri}} URI already exists. Choose another service.",unparseableXML:"Unparseable XML was specified: {{-error}}."}};var h_e="odata-service-writer",b1n=Ur.createInstance();async function A1n(){await b1n.init({resources:{en:{[h_e]:$It}},lng:"en",fallbackLng:"en",defaultNS:h_e,ns:[h_e],showSupportNotice:!1})}A1n().catch(()=>{});var O1n=Te(h4(),1);var zn;(function(e){e.v2="2",e.v4="4"})(zn||(zn={}));var sM;(function(e){e.EDMX="edmx",e.CDS="cds"})(sM||(sM={}));var m_e="mainService";var I_e=require("node:path"),oMt=require("node:path/posix"),aMt=Te(h4(),1),uMt=Te(Oy(),1),cMt=Te(Py(),1);var iMt=4;function I4(e,t,r,n=m_e,i){if(!r.length||!i)return;let s=new Set;for(let o of r){let a=ZRn(i,o.path),u=[t,oi.LocalService,n,a],c=o.path.split(";")[0];if(o.entityData&&!s.has(c)){for(let f of o.entityData){let p=(0,I_e.join)(...u,`${f.entitySetName}.json`);e.write(p,JSON.stringify(f.items,void 0,iMt))}s.add(c)}o.type==="value-list"&&u.push(o.target),u.push("metadata.xml");let l=(0,I_e.join)(...u);o.metadata&&e.write(l,(0,aMt.default)(o.metadata,{indent:iMt}))}}function ZRn(e,t){let[r]=t.split(";"),n=r.split("/"),i="/",s=n.shift();for(;s!==void 0;){let o=(0,oMt.join)(i,s);if(!e.startsWith(o))break;i=o,s=n.shift()}return r.replace(i,"")}var N_e={valueListReferences:!0,codeLists:!0};function eNn(e){return e?{valueListReferences:e.valueListReferences??N_e.valueListReferences,codeLists:e.codeLists??N_e.codeLists}:{...N_e}}function lM(e,t,r=[],n){let i=eNn(n);if(!t)return[];let s=[t,...r.map(a=>a.Definitions)],o=[];for(let a of s){let u=typeof a=="string"?(0,uMt.convert)((0,cMt.parse)(a)):a;for(let c of Object.values(u.annotations))for(let l of c){let f=l.target.replace(u.namespace+".","");tNn(i,o,f,l,e)}}return o}function tNn(e,t,r,n,i){for(let s of n.annotations)rNn(e,t,r,s,i),nNn(e,t,s,i)}function rNn(e,t,r,n,i){if(e.valueListReferences&&n.term==="com.sap.vocabularies.Common.v1.ValueListReferences"){for(let s of n.collection??[])if(s.type==="String"){let o=s;t.push({type:"value-list",serviceRootPath:i,target:r,value:o.String})}}}function nNn(e,t,r,n){if(e.codeLists&&(r.term==="com.sap.vocabularies.CodeList.v1.CurrencyCodes"||r.term==="com.sap.vocabularies.CodeList.v1.UnitsOfMeasure")&&r.record){let i=sMt(r.record,"CollectionPath"),s=sMt(r.record,"Url");s&&t.push({type:"code-list",serviceRootPath:n,value:s,collectionPath:i??void 0})}}function sMt(e,t){let r=e.propertyValues.find(n=>n.name===t);if(r?.value?.type==="String")return r.value.String}var iNn=Te(ea(),1);var Z4i=(0,L4.dirname)((0,lMt.fileURLToPath)(__importMetaUrl));var ZS=require("node:path"),S4t=Te(h4()),T4t=Te(bUt());var AUt={errors:{odataQueryError:"An error occurred when querying for odata: {{error}}. $t(texts.seeLogForDetails)",dataNotFetched:"Data was not fetched",entityModelLoading:"An error occurred when reading the data model: {{- error}}. $t(texts.seeLogForDetails)"},info:{loggingInitialised:"Logger has been configure with level: {{logLevel}}",noServiceEntityData:"No service entity data to write.",noValueHelpData:"No Value Help service data to write.",entityFilesToBeGenerated:"The following entity files will be created: {{entities}}",noListEntityDefined:"No list entity defined. A main list entity is required to download data.",hierarchyEntityQuery:"Fetching hierarchy data for entity set: {{entitySetName}}...",hierarchyFilesGenerated:"The following hierarchy data files were created: {{entities}}"},texts:{seeLogForDetails:"For more information, view the logs.",rows_one:"{{count}} row",rows_other:"{{count}} rows",generatorTitle:"SAP Fiori Elements Data Downloader"},prompts:{appSelection:{message:"Select an application as data download target",breadcrumb:"Selected App",validation:{specficationApiVersionOutdated:"The found version of @sap/ux-specification {{specApiVersion}} is too old. Data download cannot proceed.",selectedPathDoesNotContainValidApp:"The selected path does not contain a valid application. {{- error}}",appMainServiceOdataVersionNotSupported:"The selected apps main service odata version is '{{serviceOdataVersion}}'. Please select an app with a main service odata version '4'."}},relatedEntitySelection:{message:"Select entities for data download (pre-selected entities are referenced by the application)",openLogs:"Show Logs"},toggleSelection:{message:"Reset selection",labelTrue:"Clear selected",labelFalse:"Restore default selection"},entityKey:{message:"Enter values for: {{keyName}}",hint:"For range selection use '-' between values. Use commas to select non-contiguous values.",validation:{invalidKeyValueChars:"Invalid key value contain not allowed characters: {{chars}}",invalidRangeSpecified:"Invalid range specified, only the lowest and highest values allowed. e.g. '1-10'",invalidBooleanValue:"Invalid Boolean value entered. Please enter true or false.",invalidGuidValue:"Invalid GUID format. Expected format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}},skipDataDownload:{message:"If data download is not required select this option and proceed to Value Help download",hint:"Use this to temporarily disable live queries when entering multiple inputs and re-enable when ready",labelTrue:"Execute the OData query (data files will be generated on finish)",labelFalse:"Suppress the OData query (prevents multiple queries during selections)",querySuccess:'OData query success. $t(texts.rows, {"count": "{{count}}") returned. $t(texts.seeLogForDetails)',validation:{keyRequired:"Please enter at least one key field value to run the OData query"},choiceLabel:"Skip data download"},updateMainServiceMetadata:{message:"Update local metadata file from backend (remote service metadata is always used for data download):",validation:{errorLoadingAppOrMainService:"An error occurred while loading the application. Please correct the issue to proceed: {{- error}}"}},valueHelpSelection:{message:"Select Value Help data"}},steps:{odataDownloader:{name:"Configure Data Download",description:"Download data from an OData service for use with the UX Tools Mockdata Server"},valueHelpSelection:{name:"Value Help selection",description:"Value Help selection"},addConstraints:{name:"Add Missing Constraints",description:"Add Missing Constraints"}},telemetry:{unknownOs:"Unknown"}};var xUt=Ur.createInstance(),e6="odata-dowload-generator";async function _ve(){await xUt.init({resources:{en:{[e6]:AUt}},lng:"en",fallbackLng:"en",defaultNS:e6,ns:[e6],missingInterpolationHandler:()=>"",showSupportNotice:!1})}function Nt(e,t){return t?.ns||(t=Object.assign(t??{},{ns:e6})),xUt.t(e,t)}_ve().catch(e=>console.error("Failed to initialize i18n:",e));var gbe=require("@sap-devx/yeoman-ui-types");var vve;(function(e){e.official="officialVersions",e.snapshot="snapshotsVersions",e.support="support"})(vve||(vve={}));var t6="1.65.0";var r6=Te(ea(),1);var TM=Te(ea(),1);var Ne={maintenance:"Maintenance",outOfMaintenance:"Out of maintenance",skipped:"Skipped"},XLn=[{version:"1.147.*",support:Ne.maintenance},{version:"1.146.*",support:Ne.maintenance},{version:"1.145.*",support:Ne.maintenance},{version:"1.144.*",support:Ne.outOfMaintenance},{version:"1.143.*",support:Ne.outOfMaintenance},{version:"1.142.*",support:Ne.maintenance},{version:"1.141.*",support:Ne.outOfMaintenance},{version:"1.140.*",support:Ne.outOfMaintenance},{version:"1.139.*",support:Ne.outOfMaintenance},{version:"1.138.*",support:Ne.outOfMaintenance},{version:"1.136.*",support:Ne.maintenance},{version:"1.135.*",support:Ne.outOfMaintenance},{version:"1.134.*",support:Ne.outOfMaintenance},{version:"1.133.*",support:Ne.outOfMaintenance},{version:"1.132.*",support:Ne.outOfMaintenance},{version:"1.131.*",support:Ne.outOfMaintenance},{version:"1.130.*",support:Ne.outOfMaintenance},{version:"1.129.*",support:Ne.outOfMaintenance},{version:"1.128.*",support:Ne.outOfMaintenance},{version:"1.127.*",support:Ne.outOfMaintenance},{version:"1.126.*",support:Ne.outOfMaintenance},{version:"1.125.*",support:Ne.outOfMaintenance},{version:"1.124.*",support:Ne.outOfMaintenance},{version:"1.123.*",support:Ne.outOfMaintenance},{version:"1.122.*",support:Ne.outOfMaintenance},{version:"1.121.*",support:Ne.outOfMaintenance},{version:"1.120.*",support:Ne.maintenance},{version:"1.119.*",support:Ne.outOfMaintenance},{version:"1.118.*",support:Ne.outOfMaintenance},{version:"1.117.*",support:Ne.outOfMaintenance},{version:"1.116.*",support:Ne.outOfMaintenance},{version:"1.115.*",support:Ne.outOfMaintenance},{version:"1.114.*",support:Ne.outOfMaintenance},{version:"1.113.*",support:Ne.outOfMaintenance},{version:"1.112.*",support:Ne.outOfMaintenance},{version:"1.111.*",support:Ne.outOfMaintenance},{version:"1.110.*",support:Ne.outOfMaintenance},{version:"1.109.*",support:Ne.outOfMaintenance},{version:"1.108.*",support:Ne.maintenance},{version:"1.107.*",support:Ne.outOfMaintenance},{version:"1.106.*",support:Ne.outOfMaintenance},{version:"1.105.*",support:Ne.outOfMaintenance},{version:"1.104.*",support:Ne.outOfMaintenance},{version:"1.103.*",support:Ne.outOfMaintenance},{version:"1.102.*",support:Ne.outOfMaintenance},{version:"1.101.*",support:Ne.outOfMaintenance},{version:"1.100.*",support:Ne.outOfMaintenance},{version:"1.99.*",support:Ne.outOfMaintenance},{version:"1.98.*",support:Ne.outOfMaintenance},{version:"1.97.*",support:Ne.outOfMaintenance},{version:"1.96.*",support:Ne.maintenance},{version:"1.95.*",support:Ne.outOfMaintenance},{version:"1.94.*",support:Ne.outOfMaintenance},{version:"1.93.*",support:Ne.outOfMaintenance},{version:"1.92.*",support:Ne.outOfMaintenance},{version:"1.91.*",support:Ne.outOfMaintenance},{version:"1.90.*",support:Ne.outOfMaintenance},{version:"1.89.*",support:Ne.outOfMaintenance},{version:"1.88.*",support:Ne.outOfMaintenance},{version:"1.87.*",support:Ne.outOfMaintenance},{version:"1.86.*",support:Ne.outOfMaintenance},{version:"1.85.*",support:Ne.outOfMaintenance},{version:"1.84.*",support:Ne.outOfMaintenance},{version:"1.82.*",support:Ne.outOfMaintenance},{version:"1.81.*",support:Ne.outOfMaintenance},{version:"1.80.*",support:Ne.outOfMaintenance},{version:"1.79.*",support:Ne.outOfMaintenance},{version:"1.78.*",support:Ne.outOfMaintenance},{version:"1.77.*",support:Ne.outOfMaintenance},{version:"1.76.*",support:Ne.outOfMaintenance},{version:"1.75.*",support:Ne.outOfMaintenance},{version:"1.74.*",support:Ne.outOfMaintenance},{version:"1.73.*",support:Ne.outOfMaintenance},{version:"1.72.*",support:Ne.outOfMaintenance},{version:"1.71.*",support:Ne.maintenance},{version:"1.70.*",support:Ne.outOfMaintenance},{version:"1.69.*",support:Ne.outOfMaintenance},{version:"1.68.*",support:Ne.outOfMaintenance},{version:"1.67.*",support:Ne.outOfMaintenance},{version:"1.66.*",support:Ne.outOfMaintenance},{version:"1.65.*",support:Ne.outOfMaintenance},{version:"1.64.*",support:Ne.outOfMaintenance},{version:"1.63.*",support:Ne.outOfMaintenance},{version:"1.62.*",support:Ne.outOfMaintenance},{version:"1.61.*",support:Ne.outOfMaintenance},{version:"1.60.*",support:Ne.outOfMaintenance},{version:"1.58.*",support:Ne.outOfMaintenance},{version:"1.56.*",support:Ne.outOfMaintenance},{version:"1.54.*",support:Ne.outOfMaintenance},{version:"1.52.*",support:Ne.outOfMaintenance},{version:"1.50.*",support:Ne.outOfMaintenance},{version:"1.48.*",support:Ne.outOfMaintenance},{version:"1.46.*",support:Ne.outOfMaintenance},{version:"1.44.*",support:Ne.outOfMaintenance},{version:"1.42.*",support:Ne.outOfMaintenance},{version:"1.40.*",support:Ne.outOfMaintenance},{version:"1.38.*",support:Ne.maintenance},{version:"1.36.*",support:Ne.outOfMaintenance},{version:"1.34.*",support:Ne.outOfMaintenance},{version:"1.32.*",support:Ne.outOfMaintenance},{version:"1.30.*",support:Ne.outOfMaintenance},{version:"1.28.*",support:Ne.outOfMaintenance},{version:"1.26.*",support:Ne.outOfMaintenance},{version:"1.24.*",support:Ne.outOfMaintenance},{version:"1.22.*",support:Ne.outOfMaintenance},{version:"*",support:Ne.outOfMaintenance}],Sve=XLn.filter(e=>e.support===Ne.maintenance&&(0,TM.gte)((0,TM.coerce)(e.version)??"0.0.0",t6)).map(e=>({version:(0,TM.coerce)(e.version)?.version??"0.0.0",support:Ne.maintenance})),JLn=[...Sve].map(e=>e.version);var Tve=Te(ea(),1);var eMn="1.72.0",CUt="1.102.0",tMn="1.136.0",rMn="1.120.0",ac;(function(e){e.SAP_BELIZE="sap_belize",e.SAP_FIORI_3="sap_fiori_3",e.SAP_FIORI_3_DARK="sap_fiori_3_dark",e.SAP_HORIZON="sap_horizon",e.SAP_HORIZON_DARK="sap_horizon_dark"})(ac||(ac={}));var nMn={[ac.SAP_BELIZE]:{id:ac.SAP_BELIZE,label:"Belize",supportUntil:tMn,deprecateSince:rMn},[ac.SAP_FIORI_3]:{id:ac.SAP_FIORI_3,label:"Quartz Light"},[ac.SAP_FIORI_3_DARK]:{id:ac.SAP_FIORI_3_DARK,label:"Quartz Dark",supportSince:eMn},[ac.SAP_HORIZON]:{id:ac.SAP_HORIZON,label:"Morning Horizon",supportSince:CUt},[ac.SAP_HORIZON_DARK]:{id:ac.SAP_HORIZON_DARK,label:"Evening Horizon",supportSince:CUt}};var kUt=Te(RUt(),1),Ave=Te(ea(),1);var NUt={prompts:{username:{message:"Username"},password:{message:"Password"}},ui5VersionLabels:{maintained:"Maintained",outOfMaintenance:"Out of maintenance",version_one:"version",version_other:"versions"},errors:{destination:{unavailable:"The selected destination references an instance that is not available. Please check your destination configuration and try again.",notFound:"The destination target URL cannot be found. The request failed with status code 404. Please check the destination target URL connectivity in your SAP BTP cockpit.",notReachable:"The selected system is not reachable. System Name: {{systemName}}, Error: {{- error}}.",misconfigured:'The destination is misconfigured. $t(errors.destination.missingPropMsg, {"destinationProperty": "{{destinationProperty}}" })',missingPropMsg:"The property: `{{destinationProperty}}` is missing.",httpConnectionError:"A connection error occurred with the selected destination. HTTP Code: {{- code}}. $t(texts.seeLogForDetails)"},unknownError:"An error occurred{{- error, addMsgWithColonFormatter}}",servicesUnavailable:"An error occurred retrieving services for the SAP System.",certificateError:"A certificate error has occurred{{- errorMsg, addMsgWithColonFormatter}}",urlCertValidationError:"The system URL is using {{certErrorReason}} security certificate.",authenticationFailed:"Authentication incorrect. {{- error}}",authenticationTimeout:"Authorization was not verified within the allowed time. Please ensure you have authenticated using the associated browser window.",invalidUrl:"Invalid URL{{-input, addMsgWithColonFormatter}}",connectionError:"A connection error occurred. Please ensure the target host is available on the network: {{- error}}",timeout:"A connection timeout error occurred{{- errorMsg, addMsgWithColonFormatter}}",serverReturnedAnError:"The server returned an error. {{- errorDesc}}",serverUnableToCompleteRequest:"The server was unable to complete the request. Please try again.",catalogServiceNotActive:"Catalog service is not active.",urlNotFound:"URL not found.",odataServiceUrlNotFound:"The service URL you have provided is not a valid OData Service. SAP Fiori applications require an OData service as the data source.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",redirectError:"A redirect response was received from the server",abapEnvsUnavailable:"ABAP environments unavailable.",noSuchHostError:"No such host is known. Ensure the host is available.",noAbapEnvsInCFSpace:"No ABAP environments in CF space found. Ensure an ABAP environment exists.",abapEnvsCFDiscoveryFailed:"Discovering ABAP Environments failed. Please ensure you are logged into Cloud Foundry. For more information, see https://docs.cloudfoundry.org/cf-cli/getting-started.html#login.",systemConnectionValidationFailed:"A connection to the selected system cannot be established. Ensure the credentials are valid.",internalServerError:"Internal server error{{-errorMsg, addMsgWithColonFormatter}}",badGateway:"Bad gateway{{- errorMsg, addMsgWithColonFormatter}}",badRequest:"Bad request{{- errorMsg, addMsgWithColonFormatter}}",cannotBeEmpty:"{{- field}} cannot be empty.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata."},guidedAnswers:{validationErrorHelpText:"Need help with this error?"},texts:{anExpiredCert:"an expired",aSelfSignedCert:"a self-signed",anUnknownOrInvalidCert:"an unknown or invalid",anUntrustedRootCert:"an untrusted root",suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, see the log.",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration."}};var IUt="inquirer-common",bve=Ur.createInstance();function n6(){bve.addResourceBundle("en",IUt,NUt)}async function oMn(){await bve.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{format:function(e,t){return t==="addMsgWithColonFormatter"?e?`: ${e}`:"":e}},showSupportNotice:!1}),n6()}function Kt(e,t){return t?.ns||(t=Object.assign(t??{},{ns:IUt})),bve.t(e,t)}oMn().catch(()=>{});var lMn=Te(o6(),1);function ww(e,t){return e&&t?kUt.default.filter(e,t,{extract:r=>r.name??""}).map(r=>r.original):t}var a6=class{message;link;constructor(t){Object.assign(this,t)}toString(){return`${this.message} ${this.link.text}${this.link.url?" : "+this.link.url:""}`}};var bM=Te(NF(),1);function fMn(e,t,r){let n=e.additionalMessages;return(i,s)=>{let o={...(0,bM.default)(s),...(0,bM.default)(r)},a=t(i,o);return a||(typeof n=="function"?n(i,s):void 0)}}function pMn(e,t,r){let n=e.validate;return(i,s)=>{let o={...(0,bM.default)(s),...(0,bM.default)(r)},a=t?.(i,o);return a!==!0?a:typeof n=="function"?n(i,s):!0}}function dMn(e,t,r,n){let i;return r==="validate"&&t.validate&&(i=pMn(e,t.validate,n)),r==="additionalMessages"&&t.additionalMessages&&(i=fMn(e,t.additionalMessages,n)),e=Object.assign(e,{[r]:i}),e}function Ps(e,t){return e.forEach(r=>{if(r.when!==void 0)if(typeof r.when=="function"){let n=r.when;r.when=i=>t(i)?n(i):!1}else{let n=r.when;r.when=i=>t(i)&&n}else r.when=t}),e}function xve(e,t,r){return e.forEach(n=>{let i=n.name,s=t[n.name];if(s){let o=Object.keys(s);for(let a of o){(a==="validate"||a==="additionalMessages")&&(n=dMn(n,s,a,r));let u=t[i].default;u&&(n.default=u)}}}),e}var wve="data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjMzc5NEZGIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iIzM3OTRGRiIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";var Ove={FIORI_TOOLS:3046},Uo={FIORI_TOOLS:45995,DEV_PLATFORM:45996,FIORI_APP_GENERATOR:48363,BAS_CATALOG_SERVICES_REQUEST_FAILED:48366,APPLICATION_PREVIEW:52881,CERTIFICATE_ERROR:53643,DESTINATION_MISCONFIGURED:54336,DESTINATION_UNAVAILABLE:51208,DESTINATION_NOT_FOUND:51208,BAD_GATEWAY:48366,DESTINATION_SERVICE_UNAVAILBLE:52526,NO_V4_SERVICES:57573,NO_ADT_SERVICE_AUTH:57266,DESTINATION_CONNECTION_ERRORS:48366,UI_SERVICE_GENERATOR:63068,DESTINATION_GATEWAY_TIMEOUT:57914,ADT_APP_NOT_FOUND_ERROR:63911,DESTINATION_FULL_URL:68172};var BUt="sap.ux.guidedAnswer.openGuidedAnswer",hMn="https://ga.support.sap.com/dtp/viewer/index.html";function qUt(e,t){let r="";return t.length>0&&(r=`/actions/${t.join(":")}`),`${hMn}#/tree/${e}${r}`}var jUt=Te(F8(),1);var Pve,Cve;function VUt(){return Pve}function IS(e,t){let r=mMn(e,t);Pve&&Pve.reportEvent(r,Ci.NoSampling)}function mMn(e,t){Cve=Cve??(0,jUt.default)();let r=Object.assign(t,{OperatingSystem:Cve,Platform:t.Platform||Uc().technical});return{eventName:e,properties:r,measurements:{}}}function u6(e){return aq(e)?"AbapODataCatalogDest":eg(e)?"GenericODataFullUrlDest":zl(e)?"GenericODataPartialUrlDest":"Unknown"}var gMn="GA_LINK_CREATED",yMn="SERVICE_INQUIRER_BAS_ERROR",pe;(function(e){e.AUTH="AUTH",e.AUTH_TIMEOUT="AUTH_TIMEOUT",e.REDIRECT="REDIRECT",e.CERT="CERT",e.CERT_SELF_SIGNED="CERT_SELF_SIGNED",e.CERT_UKNOWN_OR_INVALID="CERT_UKNOWN_OR_INVALID",e.CERT_EXPIRED="CERT_EXPIRED",e.CERT_SELF_SIGNED_CERT_IN_CHAIN="CERT_SELF_SIGNED_CERT_IN_CHAIN",e.INVALID_SSL_CERTIFICATE="INVALID_SSL_CERTIFICATE",e.UNKNOWN="UNKNOWN",e.INVALID_URL="INVALID_URL",e.TIMEOUT="TIMEOUT",e.CONNECTION="CONNECTION",e.SERVICES_UNAVAILABLE="SERVICES_UNAVAILABLE",e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.NO_ABAP_ENVS="NO_ABAP_ENVS",e.CATALOG_SERVICE_NOT_ACTIVE="CATALOG_SERVICE_NOT_ACTIVE",e.NO_SUCH_HOST="NO_SUCH_HOST",e.NOT_FOUND="NOT_FOUND",e.ODATA_URL_NOT_FOUND="ODATA_URL_NOT_FOUND",e.BAD_GATEWAY="BAD_GATEWAY",e.GATEWAY_TIMEOUT="GATEWAY_TIMEOUT",e.INTERNAL_SERVER_ERROR="INTERNAL_SERVER_ERROR",e.DESTINATION_SERVICE_UNAVAILABLE="DESTINATION_SERVICE_UNAVAILABLE",e.DESTINATION_UNAVAILABLE="DESTINATION_UNAVAILABLE",e.DESTINATION_NOT_FOUND="DESTINATION_NOT_FOUND",e.DESTINATION_MISCONFIGURED="DESTINATION_MISCONFIGURED",e.NO_V2_SERVICES="NO_V2_SERVICES",e.NO_V4_SERVICES="NO_V4_SERVICES",e.BAD_REQUEST="BAD_REQUEST",e.DESTINATION_CONNECTION_ERROR="DESTINATION_CONNECTION_ERROR",e.SERVER_HTTP_ERROR="SERVER_HTTP_ERROR"})(pe||(pe={}));var EMn={[pe.AUTH]:[/401/,/403/,/Incorrect credentials were provided to login/,/Unable to retrieve SAP Business Accelerator Hub key/],[pe.AUTH_TIMEOUT]:[/UAATimeoutError/],[pe.TIMEOUT]:[/Timeout/],[pe.CERT]:[],[pe.CERT_UKNOWN_OR_INVALID]:[/UNABLE_TO_GET_ISSUER_CERT/,/UNABLE_TO_GET_ISSUER_CERT_LOCALLY/,/unable to get local issuer certificate/,/UNABLE_TO_VERIFY_LEAF_SIGNATURE/,/ERR_TLS_CERT_ALTNAME_INVALID/],[pe.CERT_EXPIRED]:[/CERT_HAS_EXPIRED/],[pe.CERT_SELF_SIGNED]:[/DEPTH_ZERO_SELF_SIGNED_CERT/],[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:[/SELF_SIGNED_CERT_IN_CHAIN/],[pe.INVALID_SSL_CERTIFICATE]:[/526/,/Invalid SSL Certificate/],[pe.UNKNOWN]:[],[pe.CONNECTION]:[/ENOTFOUND/,/ECONNRESET/,/ECONNREFUSED/,/EPROTO/,/ConnectionError/],[pe.SERVICES_UNAVAILABLE]:[],[pe.SERVICE_UNAVAILABLE]:[/503/],[pe.INVALID_URL]:[/Invalid URL/,/ERR_INVALID_URL/],[pe.REDIRECT]:[/3\d\d/],[pe.NO_ABAP_ENVS]:[],[pe.CATALOG_SERVICE_NOT_ACTIVE]:[/\/IWBEP\/CM_V4_COS\/014/,/\/IWFND\/CM_V4_COS\/021/,/Service group '\/IWFND\/CONFIG' not published/],[pe.NO_SUCH_HOST]:[/no such host/],[pe.NOT_FOUND]:[/404/],[pe.ODATA_URL_NOT_FOUND]:[],[pe.INTERNAL_SERVER_ERROR]:[/500/],[pe.BAD_GATEWAY]:[/502/],[pe.GATEWAY_TIMEOUT]:[/504/],[pe.DESTINATION_SERVICE_UNAVAILABLE]:[],[pe.DESTINATION_UNAVAILABLE]:[],[pe.DESTINATION_NOT_FOUND]:[],[pe.DESTINATION_MISCONFIGURED]:[],[pe.NO_V2_SERVICES]:[],[pe.NO_V4_SERVICES]:[],[pe.BAD_REQUEST]:[/400/],[pe.DESTINATION_CONNECTION_ERROR]:[],[pe.SERVER_HTTP_ERROR]:[/5\d\d/]},ln=class e{currentErrorMsg;currentErrorType;static _guidedAnswersEnabled;static _logger;static _platform;static get platform(){return e._platform}static set platform(t){e._platform=t}static _guidedAnswersTrigger;static get guidedAnswersTrigger(){return e._guidedAnswersTrigger}static set guidedAnswersTrigger(t){e._guidedAnswersTrigger=t}static getMessageFromError=t=>t?.message||t?.status?.toString()||t?.response?.status?.toString()||(typeof t=="string"?t:JSON.stringify(t));static serverErrorMessage=(t,r)=>Kt("errors.serverReturnedAnError",{errorDesc:r?Kt(r,{errorMsg:e.getMessageFromError(t)}):e.getMessageFromError(t)});static _errorTypeToMsg={[pe.CERT]:t=>Kt("errors.certificateError",{errorMsg:e.getMessageFromError(t)}),[pe.CERT_EXPIRED]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.anExpiredCert")}),[pe.CERT_SELF_SIGNED]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.aSelfSignedCert")}),[pe.CERT_UKNOWN_OR_INVALID]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.anUnknownOrInvalidCert")}),[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.anUntrustedRootCert")}),[pe.INVALID_SSL_CERTIFICATE]:()=>Kt("errors.urlCertValidationError",{certErrorReason:Kt("texts.anUnknownOrInvalidCert")}),[pe.AUTH]:t=>Kt("errors.authenticationFailed",{error:e.getMessageFromError(t)}),[pe.AUTH_TIMEOUT]:()=>Kt("errors.authenticationTimeout"),[pe.TIMEOUT]:t=>Kt("errors.timeout",{errorMsg:e.getMessageFromError(t)}),[pe.INVALID_URL]:()=>Kt("errors.invalidUrl"),[pe.CONNECTION]:t=>Kt("errors.connectionError",{error:e.getMessageFromError(t)}),[pe.UNKNOWN]:t=>Kt("errors.unknownError",{error:e.getMessageFromError(t)}),[pe.SERVICES_UNAVAILABLE]:()=>Kt("errors.servicesUnavailable"),[pe.SERVICE_UNAVAILABLE]:t=>e.serverErrorMessage(t),[pe.CATALOG_SERVICE_NOT_ACTIVE]:()=>Kt("errors.catalogServiceNotActive"),[pe.INTERNAL_SERVER_ERROR]:t=>e.serverErrorMessage(t,"errors.internalServerError"),[pe.NOT_FOUND]:()=>Kt("errors.urlNotFound"),[pe.ODATA_URL_NOT_FOUND]:()=>Kt("errors.odataServiceUrlNotFound"),[pe.BAD_GATEWAY]:t=>e.serverErrorMessage(t,"errors.badGateway"),[pe.DESTINATION_UNAVAILABLE]:()=>Kt("errors.destination.unavailable"),[pe.DESTINATION_NOT_FOUND]:()=>Kt("errors.destination.notFound"),[pe.DESTINATION_MISCONFIGURED]:t=>Kt("errors.destination.misconfigured",{destinationProperty:typeof t=="string"?t:""}),[pe.NO_V2_SERVICES]:()=>Kt("errors.noServicesAvailable",{version:"2"}),[pe.NO_V4_SERVICES]:()=>Kt("errors.noServicesAvailable",{version:"4"}),[pe.DESTINATION_SERVICE_UNAVAILABLE]:()=>Kt("errors.destination.unavailable"),[pe.REDIRECT]:()=>Kt("errors.redirectError"),[pe.NO_SUCH_HOST]:()=>Kt("errors.noSuchHostError"),[pe.NO_ABAP_ENVS]:()=>Kt("errors.abapEnvsUnavailable"),[pe.BAD_REQUEST]:t=>e.serverErrorMessage(t,"errors.badRequest"),[pe.DESTINATION_CONNECTION_ERROR]:()=>Kt("errors.systemConnectionValidationFailed"),[pe.SERVER_HTTP_ERROR]:t=>e.serverErrorMessage(t),[pe.GATEWAY_TIMEOUT]:t=>e.serverErrorMessage(t)};static _errorMsg=(t,r)=>e._errorTypeToMsg[t](r);static getHelpNode=t=>{let r=jr();return{[pe.SERVICES_UNAVAILABLE]:r?Uo.BAS_CATALOG_SERVICES_REQUEST_FAILED:void 0,[pe.CERT]:Uo.CERTIFICATE_ERROR,[pe.CERT_EXPIRED]:Uo.CERTIFICATE_ERROR,[pe.CERT_SELF_SIGNED]:Uo.CERTIFICATE_ERROR,[pe.CERT_UKNOWN_OR_INVALID]:Uo.CERTIFICATE_ERROR,[pe.INVALID_SSL_CERTIFICATE]:Uo.CERTIFICATE_ERROR,[pe.CERT_SELF_SIGNED_CERT_IN_CHAIN]:Uo.CERTIFICATE_ERROR,[pe.DESTINATION_MISCONFIGURED]:Uo.DESTINATION_MISCONFIGURED,[pe.DESTINATION_UNAVAILABLE]:Uo.DESTINATION_UNAVAILABLE,[pe.DESTINATION_NOT_FOUND]:Uo.DESTINATION_NOT_FOUND,[pe.BAD_GATEWAY]:Uo.BAD_GATEWAY,[pe.DESTINATION_SERVICE_UNAVAILABLE]:Uo.DESTINATION_SERVICE_UNAVAILBLE,[pe.NO_V4_SERVICES]:Uo.NO_V4_SERVICES,[pe.GATEWAY_TIMEOUT]:r?Uo.DESTINATION_GATEWAY_TIMEOUT:void 0,[pe.AUTH]:void 0,[pe.AUTH_TIMEOUT]:void 0,[pe.REDIRECT]:void 0,[pe.UNKNOWN]:void 0,[pe.INVALID_URL]:void 0,[pe.CONNECTION]:void 0,[pe.SERVICE_UNAVAILABLE]:void 0,[pe.NO_ABAP_ENVS]:void 0,[pe.CATALOG_SERVICE_NOT_ACTIVE]:void 0,[pe.NO_SUCH_HOST]:void 0,[pe.NOT_FOUND]:void 0,[pe.ODATA_URL_NOT_FOUND]:void 0,[pe.INTERNAL_SERVER_ERROR]:void 0,[pe.NO_V2_SERVICES]:void 0,[pe.TIMEOUT]:void 0,[pe.BAD_REQUEST]:void 0,[pe.DESTINATION_CONNECTION_ERROR]:Uo.DESTINATION_CONNECTION_ERRORS,[pe.SERVER_HTTP_ERROR]:void 0}[t]};static findErrorValueForMapping=t=>t.response?.data?.error?.code||t.response?.status||t.response?.data||t.code||(["TypeError","Error"].includes(t.name)?t.message:t.name)||t.message||t;constructor(t,r=!1,n){e._logger=t??new ys({logPrefix:n??"@sap-ux/inquirer-common"}),e.guidedAnswersEnabled=r}static get guidedAnswersEnabled(){return e._guidedAnswersEnabled}static set guidedAnswersEnabled(t){e._guidedAnswersEnabled=t}static set logger(t){e._logger=t}static get logger(){return e._logger}static isCertError(t){return[pe.CERT,pe.CERT_EXPIRED,pe.CERT_SELF_SIGNED,pe.CERT_UKNOWN_OR_INVALID,pe.CERT_SELF_SIGNED_CERT_IN_CHAIN].includes(e.getErrorType(t))}static getErrorType(t){let r=t;return t instanceof Error&&(r=e.findErrorValueForMapping(t)),Object.keys(pe).find(n=>EMn[n].find(i=>i.test(r.toString())))}logErrorMsgs(t,r,n=!0){let i={errorMsg:"",errorType:pe.UNKNOWN};if(Object.values(pe).includes(t)){let s=t;i.errorMsg=e.getErrorMsgFromType(s)??s.toString(),i.errorType=s}else typeof t=="string"?i.errorMsg=t:i=e.mapErrorToMsg(t);return e._logger.error(r?`${r} ${i.errorMsg}`:i.errorMsg),n&&(this.currentErrorMsg=r??i.errorMsg,this.currentErrorType=i.errorType),i.errorMsg}static mapErrorToMsg(t){let r;return Object.values(pe).includes(t)?r=t:r=e.getErrorType(this.findErrorValueForMapping(t))??pe.UNKNOWN,{errorMsg:e._errorMsg(r,t),errorType:r}}getErrorMsg(t,r,n){let i;return t&&typeof t!="boolean"&&(i=e.mapErrorToMsg(t).errorMsg),i||(i=this.currentErrorMsg??(n?e.getErrorMsgFromType(n):void 0)),(t===!0||r)&&(this.currentErrorMsg=null,this.currentErrorType=null),i}resetErrorState(){this.currentErrorMsg=null,this.currentErrorType=null}getValidationErrorHelp(t,r=!1,n){let i,s,o;if(t?{errorMsg:s,errorType:o}=e.mapErrorToMsg(t):(s=this.currentErrorMsg??void 0,this.currentErrorType&&(o=this.currentErrorType)),o){if(n){let{errorType:a,errorMsg:u}=e.getDestinationSpecificError(o,n);s=u??s,o=a??o}o&&(i=e.getHelpForError(o,s))}return r&&(this.currentErrorMsg=null,this.currentErrorType=null),i??s}static getDestinationSpecificError(t,r){let n,i;return hHe(r)?t===pe.SERVICE_UNAVAILABLE?dHe(r)?n=pe.DESTINATION_SERVICE_UNAVAILABLE:n=pe.DESTINATION_CONNECTION_ERROR:t===pe.NOT_FOUND?(n=pe.DESTINATION_NOT_FOUND,i=this.getErrorMsgFromType(pe.DESTINATION_NOT_FOUND)):pe.INTERNAL_SERVER_ERROR===t||pe.SERVER_HTTP_ERROR===t?n=pe.DESTINATION_CONNECTION_ERROR:t===pe.AUTH&&r.Authentication!==sp.NO_AUTHENTICATION&&(i=this.getErrorMsgFromType(pe.AUTH,Kt("texts.checkDestinationAuthConfig"))):(n=pe.DESTINATION_MISCONFIGURED,i=this.getErrorMsgFromType(n,"HTML5.DynamicDestination")),IS(yMn,{basErrorType:n??t,destODataType:u6(r),Platform:this._platform??Uc().technical}),{errorType:n??t,errorMsg:i}}static getErrorMsgFromType(t,r){if(pe[t])return e._errorMsg(pe[t],r)}hasError(t=!1){let r=!!this.currentErrorMsg;return t&&(this.currentErrorMsg=null,this.currentErrorType=null),r}setCurrentError(t,r){this.currentErrorMsg=e._errorMsg(pe[t],r),this.currentErrorType=t}getCurrentErrorType(t=!1){let r=this.currentErrorType;return t&&(this.currentErrorMsg=null,this.currentErrorType=null),r}static getHelpForError(t,r){let n=e.getHelpNode(t),i=r??e.getErrorMsgFromType(t);return n&&i?this.getHelpLink(n,t,i):i}static getHelpLink(t,r,n){let i={message:n,link:{text:Kt("guidedAnswers.validationErrorHelpText"),icon:wve,url:qUt(Ove.FIORI_TOOLS,[t])}};return this.guidedAnswersEnabled&&(i.link.command={id:BUt,params:{treeId:Ove.FIORI_TOOLS,nodeIdPath:[t],trigger:this.guidedAnswersTrigger}}),IS(gMn,{errorType:r,isGuidedAnswersEnabled:this.guidedAnswersEnabled,nodeIdPath:`${t}`,Platform:this.platform??Uc().technical}),new a6(i)}};var $Ut=Te(tq(),1);async function GUt(e){let t=[];try{let r=[Vd.ABAP,Vd.ABAP_TRIAL,Vd.ABAP_CANARY,Vd.ABAP_OEM,Vd.ABAP_OEM_CANARY,Vd.ABAP_HAAS,Vd.ABAP_STAGING,Vd.ABAP_INTERNAL_STAGING],n=process.env.ABAPEnvServiceTypes?process.env.ABAPEnvServiceTypes.split(",").map(s=>s.trim()):[],i=await(0,$Ut.apiGetServicesInstancesFilteredByType)([...r,...n]);i.length>0?i.forEach(s=>{t.push({name:s.label,value:s})}):e.logErrorMsgs(pe.NO_ABAP_ENVS,Kt("errors.noAbapEnvsInCFSpace"))}catch{e.logErrorMsgs(pe.NO_ABAP_ENVS,Kt("errors.abapEnvsCFDiscoveryFailed"))}return t.sort((r,n)=>r.name?r.name.localeCompare(n.name??""):0)}var _Mn=Te(Oy(),1),vMn=Te(Py(),1);var cQn=Te(Q3t(),1);var Z3t={deploy:{abapAppDescLength:"The deployment description cannot exceed 60 characters.",abapTransportNumRequired:"Provide a transport request for your application.",abapPackageWarn:"Provide a package.",abapAppNameRequired:"The application name is required.",abapInvalidNamespace:"The namespace is invalid because there are too many forward slashes.",abapInvalidNamespaceLength:"The namespace is limited to 10 characters. Entered {{length}}.",abapInvalidAppNameLength:"The application name is limited to 15 characters. Entered {{length}}.",abapInvalidAppName:"The application name must be prefixed with [{{prefix}}].",charactersForbiddenInAppName:"Only alphanumeric, underscore, and slash characters are allowed.",invalidAppNameMultipleReason:"The application name is invalid for multiple reasons:"},ui5:{namespaceMustStartWithLetter:"The namespace must start with a letter.",namespaceEndInPeriod:"The namespace cannot end with a period.",namespaceCannotBeSap:"The namespace cannot be {{str}}.",namespaceStartsWithNew:"The namespace cannot start with {{str}}.",namespaceNumberAfterPeriod:"A number cannot follow a period in the namespace.",lowerAlphaNumericOnly:"Only use lowercase alphanumeric characters.",lowerAlphaNumericDotsOnly:"Only use lowercase alphanumeric characters and dots for the namespace.",namespaceSpecialCharacter:"The namespace can only contain letters, digits, dots, and underscores.",moduleNameMustStartWithLetter:"The module name must start with a letter.",nameCombinedTooLong:"The combined length of the namespace and module name must not exceed {{length}} characters.",folderDoesNotExist:"This folder does not exist. Please enter the root folder for your project.",folderDoesNotHaveCorrectPermissions:"The selected folder does not have the required permissions. Please ensure you have permission to write to the selected folder and try again.",enterProjectFolder:"Please enter a project folder.",nameNull:"The module name cannot be null.",nameUndefined:"The module name cannot be undefined.",nameNotString:"The module name must be a string.",nameLengthZero:"The module name's length must be greater than zero.",nameStartsWithPeriod:"The module name cannot start with a period.",nameStartsWithUnderscore:"The module name cannot start with an underscore.",nameStartsOrEndsWithSpace:"The module name cannot contain leading or trailing spaces.",nameBlocklisted:"{{modName}} is a blocklisted module name. Choose a different name.",nameIsCoreModule:"{{modName}} is a core module name. Choose a different name.",nameTooLong:"The module name cannot exceed {{length}} characters.",nameTooShort:"The module name must be at least {{length}} characters.",inputValueContainsCapital:"{{promptName}} cannot contain capital letters",nameContainsSpecialCharacters:`The module name cannot contain special characters: ("~'!()*)`,nameNotUrlFriendly:"The module name can only contain URL-friendly characters.",invalidModuleName:"Invalid module name.",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path.",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must use the local CAP project as the data source."},general:{invalidUrl:"Invalid URL: [{{-input}}]",invalidClient:"[{{client}}] is invalid. Leave this field empty or enter a value between 000-999.",inputCannotBeEmpty:"The input cannot be empty.",inputCannotHaveSpaces:"The input cannot contain spaces.",invalidJSON:"Invalid JSON.",invalidValueForSpecialChars:"The input must only contain Latin alphanumeric characters or the following symbols: '-','_','$' and '.'.",maxLength:"The maximum length is: {{maxLength}} characters.",supportedFormats:"Only alphanumeric and '{{allowedCharacters}}' characters are allowed.",nameContainsSpecialCharacters:`Module name cannot contain special characters ("~'!()*)`,nameNotUrlFriendly:"Module name can only contain URL-friendly characters",invalidModuleName:"Invalid module name",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must therefore use the local CAP project as the data source.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",windowsFolderPathTooLong:"The combined length {{length}} of the target folder and module name exceeds the default Windows path length. This can cause issues with project generation."},adp:{projectNameUppercaseError:"The project name cannot contain uppercase letters.",projectNameLengthErrorExt:"The project name cannot exceed 61 characters or end with the word 'component'.",projectNameValidationErrorExt:"The project name must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",projectNameLengthErrorInt:"The project name cannot start with the word 'customer', exceed 61 characters, or end with the word 'component'.",projectNameValidationErrorInt:"The project name must only contain Latin alphanumeric characters and it must have at least two parts. The different parts must be separated by a period and every part must start with a letter.",duplicatedProjectName:"A project with this name already exists in your workspace. Please choose another name.",differentNamespaceThanProjectName:"The namespace must be the same as the project name.",namespaceSameAsProjectNameError:"The namespace must be the same as the project name.",namespaceLengthError:"The namespace cannot exceed 61 characters or end with the word 'component'.",namespaceValidationError:"The namespace must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",achMandatoryError:"The Application Component Hierarchy must only contain capital letters, digits, and dashes."}};var e$t="project-input-validator",LTe=Ur.createInstance();function zY(){LTe.addResourceBundle("en",e$t,Z3t)}async function t$t(){await LTe.init({lng:"en",fallbackLng:"en",showSupportNotice:!1}),zY()}function WS(e,t){return t?.ns||(t=Object.assign(t??{},{ns:e$t})),LTe.t(e,t)}t$t().catch(()=>{});var rJn=Te(i$t(),1);function s$t(e){let t=e?.trim()||"";return t===""||/^\d{3}$/.test(t)?!0:WS("general.invalidClient",{client:e})}var o$t={prompts:{datasourceType:{message:"Data Source",projectSpecificDestName:"Project Specific Destination",businessHubName:"SAP Business Accelerator Hub",sapSystemName:"System",odataServiceUrlName:"OData Service",capProjectName:"Local CAP Project",metadataFileName:"Metadata Document",choiceNone:"$t(texts.choiceNameNone)",projectSpecificDestChoiceText:"Connect to a $t(prompts.datasourceType.projectSpecificDestName)",businessHubChoiceText:"Connect to $t(prompts.datasourceType.businessHubName)",sapSystemChoiceText:"Connect to a $t(prompts.datasourceType.sapSystemName)",odataServiceUrlChoiceText:"Connect to an $t(prompts.datasourceType.odataServiceUrlName)",capProjectChoiceText:"Use a $t(prompts.datasourceType.capProjectName)",metadataFileChoiceText:"Upload a $t(prompts.datasourceType.metadataFileName)",notYetImplementedWarningMessage:"The selected data source type: {{ datasourceType }} is not yet implemented."},metadataFile:{message:"Metadata File Path",description:"Upload a metadata file",placeholder_odata_service_url:"/here/goes/your/serviceurl/"},capProject:{message:"Choose a CAP Project",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capProjectPath:{message:"CAP Project Folder Path",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capService:{message:"OData Service",description:"Select a local CAP service",breadcrumb:"CAP Service",enterCapPathChoiceName:"Manually select CAP service folder path"},odataServiceUrl:{message:"OData{{odataVersion, odataVersionFormatter}} service URL"},ignoreCertErrors:{message:"Do you want to continue generation with the untrusted certificate?"},serviceUsername:{message:"Service username"},servicePassword:{message:"Service password"},validationMessages:{odataVersionMismatch:"The template you have chosen supports V{{requiredOdataVersion}} OData services only. The provided version is V{{providedOdataVersion}}.",metadataInvalid:"The service metadata is invalid.",metadataFilePathNotValid:"The metadata file does not exist or is not accessible. Please specify a valid file path.",capProjectNotFound:"The folder you have selected does not contain a valid CAP project. Please check and try again.",warningCertificateValidationDisabled:"Certificate validation has been disabled by the user.",annotationsNotFound:"Annotations not found for the specified service.",backendSystemExistsWarning:'A saved system connection entry: "{{- backendName}}" already exists with the same URL and client. Please reuse the existing entry or remove it, using the systems panel, before adding a new connection.',systemUrlOriginOnlyWarning:"System URLs must only contain the hostname and may also include the port, for example, 'https://abc.com:123/'."},warnings:{nonUIServiceTypeWarningMessage:"Services of service type: {{serviceType}} or without a service type are not intended to be used for generating SAP Fiori UI applications.",noServicesAvailable:"There are no services available for the selected system. For more information, see the logs.",noServicesAvailableForOdataVersion:"There are no OData V{{odataVersion}} services available from the selected system and the template you have chosen only supports OData V{{odataVersion}} services.",noAnnotations:"No back-end annotations associated with this service were retrieved. This can result in an invalid application.",collaborativeDraftMessage:"The selected service is draft-enabled but does not support collaborative draft."},systemUrl:{message:"System URL",description:"Enter the URL of the SAP System",placeholder:"https://<host>:<port>"},sapClient:{message:"SAP client (leave empty for default)",breadcrumb:"SAP Client"},systemUsername:{message:"Username"},systemPassword:{message:"Password"},storeSystemCredentials:{message:"Do you want to store the system credentials?",breadcrumb:"Store Credentials"},systemService:{message:"Service",breadcrumb:"Service",noServicesWarning:"No services available for the selected system. For more information, see the logs."},newSystemType:{choiceAbapOnPrem:"ABAP On Premise",choiceAbapOnBtp:"ABAP Environment on SAP Business Technology Platform",choiceCFAbapEnvServiceOnBtp:"Cloud Foundry ABAP environment on SAP Business Technology Platform",message:"System Type",notYetImplementedWarningMessage:"The selected system type: {{ systemType }} is not yet implemented."},systemName:{message:"System name",hint:"Entering a system name will save the connection for re-use.",systemNameExistsWarning:"A system with that name already exists in the secure storage. Please try a different name.",reservedSystemNameWarning:"'{{ systemName }}' is a reserved system name. Please try a different name.",emptySystemNameWarning:"System name cannot be empty."},systemSelection:{newSystemChoiceLabel:"New System",hint:"Select a system configuration.",message:"System",authenticationFailedUpdateCredentials:"$t(texts.authenticationFailed). Please try updating the credentials."},abapOnBTPType:{message:"ABAP environment definition source",choiceReentranceTicket:"Use Reentrance Ticket",choiceServiceKey:"Upload a Service Key File",choiceCloudFoundry:"Discover a Cloud Foundry Service"},serviceKey:{message:"Service Key File Path",hint:"Select a local file that defines the service connection for an ABAP Environment on SAP Business Technology Platform.",incompleteServiceKeyInfo:"The service keys file does not contain the required information. Check the file is valid and try again.",unparseableServiceKey:"The service keys file does not contain a valid JSON format. Check the formatting and try again."},cloudFoundryAbapSystem:{message:"ABAP environment",hint:"Enter the name of the Cloud Foundry service that contains the ABAP Environment instance."},destinationServicePath:{message:"Service Path",hint:"Enter the path to the OData service relative to the selected destination URL.",invalidServicePathWarning:"Please enter a valid service path"},mainEntitySelection:{message:"Main Entity",defaultEntityNameNotFoundWarning:"The supplied entity cannot be found in the service. Please choose from the list above.",noDraftEnabledEntitiesError:"The CAP service you have chosen does not have any entities that are draft enabled. To generate an OData V4 SAP Fiori application using this floorplan for a CAP project, the entity selected must be draft enabled.",mainEntityParameterFoundInfo:"The selected entity '{{entityName}}' requires a parameter which is set by the application filters. Navigation entities are not supported.",noEntitiesError:"$t(errors.noRelevantEntities)",noEntitiesAlpV4Error:"The OData V4 service you have provided is not suitable for use in an analytical list page application. The service must contain aggregate-based entities for this template.",requiredError:"Please select a main entity to continue."},navigationEntitySelection:{message:"Navigation Entity",choiceNone:"$t(texts.choiceNameNone)"},filterEntitySet:{message:"Filter Entity",noEntitiesError:"$t(errors.noRelevantEntities)"},pageBuildingBlock:{message:"Add a Page Building Block to the Application?",tooltip:"The Page building block is supported from SAPUI5 version 1.136. By choosing this option, you will be restricting the minimum SAPUI5 versions available for the application to be 1.136 and above.",warning:"The Page building block is supported with SAPUI5 version 1.136 and above.",titleMessage:"Page Title"},tableType:{message:"Table Type",hint:"Defines the table type for the list report page.",requiredError:"Please select a table type to continue.",choiceNone:"$t(texts.choiceNameNone)",choiceGrid:"Grid",choiceAnalytical:"Analytical",choiceResponsive:"Responsive",choiceTree:"Tree",analyticalTableDefault:"The 'Analytical' table type is chosen by default because the selected entity supports it.",treeTableDefault:"The 'Tree' table type is chosen by default because the selected entity supports it.",responsiveTableInfo:"Only use the responsive table if the total number of items in the table doesn't exceed 200."},hierarchyQualifier:{message:"Hierarchy Qualifier",hint:"Leading property that decides between either a recursive hierarchy or data aggregation.",qualifierRequiredForV4Warning:"Hierarchy qualifier is required for OData V4 services."},addFEOPAnnotations:{message:"Automatically add a form to the generated application if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations"},addLineItemAnnotations:{message:"Automatically add table columns to the list page and a section to the object page if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations",valueHelpsAnnotationsInfoMessage:"Basic value helps will also be created."},presentationQualifier:{message:"Qualifier",hint:"Represents the qualifier of the `SelectionPresentationVariant`. The analytical list page looks for a `SelectionPresentationVariant` with this qualifier and if not found, it looks for a `PresentationVariant` with this qualifier."},tableSelectionMode:{message:"Selection Mode",hint:"Defines different selection modes for the `SmartTable` in the analytical list page.",choiceNone:"$t(texts.choiceNameNone)",choiceSingle:"Single",choiceAuto:"Auto",choiceMulti:"Multi"},tableMultiSelect:{message:"Allow Multi Select",hint:"Allows you to show a checkbox for selecting multiple items in a table. This setting comes into effect only if there are actions defined either by using an annotation or a setting in the `manifest.json` file."},tableAutoHide:{message:"Auto Hide",hint:"Determines the chart or table interaction. If set to `true`, the chart acts as a filter for the table. If set to `false`, the matching table rows are highlighted but the table is not filtered."},smartVariantManagement:{message:"Enable Smart Variant Management",hint:"Enables page level variant."},valueHelpDownload:{message:"The service contains references to value help services. Do you want to download the associated metadata during generation? This may increase generation time.",hint:"Download metadata for value help to improve the user experience with dropdowns and search."}},errors:{destination:{authError:"The selected system: {{systemName}} returned an authentication error: {{- error}}.",listDestinations:"An error occurred when retrieving the list of destinations: {{- error}}."},cannotReadCapServiceMetadata:"An error occurred reading CAP service metadata: {{serviceName}}. $t(texts.seeLogForDetails).",capModelAndServicesLoadError:"An error occurred loading the CAP model and services: {{- error, addMsgWithColonFormatter}}.",capServiceUrlPathNotDefined:"An error occurred reading CAP service metadata: {{serviceName}}. The CAP service property: `urlPath` is not defined but it is required.",unknownError:"An error occurred: {{- error, addMsgWithColonFormatter}}.",authenticationFailed:"$t(texts.authenticationFailed): {{error}}.",authenticationFailedSpecificCatalog:"{{authFailType}}: Unable to access the OData V{{odataVersion}} service catalog",authenticationFailedAllCatalogs:"{{authFailType}}: Unable to access any service catalogs",invalidUrl:"Invalid URL: {{-input, addMsgWithColonFormatter}}.",connectionError:"A connection error occurred. Ensure the target host is available on the network: {{- error}}",urlNotFound:"URL not found.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",abapEnvsUnavailable:"ABAP environments unavailable.",systemOrServiceUrlNotFound:"Please verify the URL: {{- url}}, target system configuration and network connectivity.",urlRedirect:"The service URL is redirecting.",certValidationRequired:"Certificate validation is required to continue.",exitingGeneration:"Exiting generation. Exit: {{exitReason}}.",serviceMetadataError:"An error occurred when reading the service metadata for service: {{- servicePath}}. Error: {{errorText}}",serviceMetadataErrorUI:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" }) $t(texts.seeLogForDetails)',serviceMetadataErrorLog:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" })',serviceTypeRequestError:"An error occurred when retrieving the service type: {{- error}}.",abapServiceAuthenticationFailed:"ABAP environment authentication using UAA failed.",serviceCatalogRequest:"An error occurred requesting services from: {{- catalogRequestUri }} and entity set: {{entitySet}}: {{error}}.",storedSystemConnectionError:"An error occurred when validating the stored system connection info. System Name: {{-systemName}}. Error: {{- error}}.",noCatalogOrServiceAvailable:"No active system or OData service endpoint connection available to retrieve the server.",allCatalogServiceRequestsFailed:"All catalog service requests failed for the selected system. OData version: V{{version}}.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata.",unparseableXML:"Unparseable XML was specified: {{-error}}.",noRelevantEntities:"The template and service selected have no relevant entities that you can use.",cfInstanceCredentialsNotReturned:"Cannot not retrieve credentials to access: {{serviceInstanceName}}.",v2CatalogServiceNoAnnotations:"An error occurred when creating an OData V2 catalog service object. Annotations will not be available: {{-error}}",backendSystemRetrieval:"An error occurred when retrieving the backend systems from the store: {{-error}}"},warnings:{largeMetadataDocument:"The metadata for this OData service is very large. It may take some time before this operation completes.",warningCertificateValidationDisabled:"User has disabled certificate validation",nonUIServiceTypeWarningMessage:"Please note that {{serviceType}} services, or not classified services, are not intended to be used for the generation of SAP Fiori UI applications",noServicesAvailable:"No services available for the selected system, see logs for further details.",noServicesAvailableForOdataVersion:"There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only",noAnnotations:"No backend annotations associated with this service were retrieved and may result in an invalid application being created",collaborativeDraftMessage:"The selected service is draft enabled but does not support collaborative draft.",certificateErrors:"A certificate error occurred when connecting to the host: {{-url}}. Certificate error: {{error}}.",allowingUnauthorizedCertsNode:"Setting the `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `0` makes TLS connections and HTTPS requests insecure by disabling certificate verification. It is important to understand the security risks when using this setting.",certErrorIgnoredByNodeSetting:"An SSL certificate error is being ignored by the 'NODE_TLS_REJECT_UNAUTHORIZED=0' Node.js setting. This makes TLS connections and HTTPS requests insecure by disabling certificate verification. For details of the certification error, see the logs.",noExternalServiceMetdataFetched:"No external service metadata was fetched. $t(texts.seeLogForDetails)",missingServices:"OData V{{odataVersion}} services are not available.",specifiedServicesNotAvailable_one:"The required OData service: {{-service}} is not available from the {{odataVersion}}services catalog. Please ensure the service is available.",specifiedServicesNotAvailable_other:"The required OData services are not available from the {{odataVersion}}services catalog. Please ensure the services are available. $t(texts.seeLogForDetails)",storedSystemUrlPathNotSupported:"The stored cloud system URL '{{- systemUrl}}' contains a path which is not supported for reentrance ticket authentication. The path is ignored for this connection."},texts:{suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, view the logs.",forUserName:"(for user [{{username}}])",httpStatus:"HTTP Status {{httpStatus}}",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration.",choiceNameNone:"None",passwordStoreWarning:"Passwords are stored in your operating system's credential manager and are protected by its security policies.",authorizationFailed:"Authorization failed",authenticationFailed:"Authentication failed"}};var a$t="odata-service-inquirer";var MTe=Ur.createInstance();async function u$t(){await MTe.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{format:function(e,t){return t==="odataVersionFormatter"?e?` V${e}`:"":t==="addMsgWithColonFormatter"?e?`: ${e}`:"":e}},showSupportNotice:!1}),MTe.addResourceBundle("en",a$t,o$t),n6(),zY()}function we(e,t){return t?.ns||(t=Object.assign(t??{},{ns:a$t})),MTe.t(e,t)}u$t().catch(()=>{});var WM;(function(e){e.sapSystem="sapSystem",e.capProject="capProject",e.odataServiceUrl="odataServiceUrl",e.none="none",e.metadataFile="metadataFile",e.projectSpecificDestination="projectSpecificDestination",e.businessHub="businessHub"})(WM||(WM={}));var KY="sap-client";var wn;(function(e){e.datasourceType="datasourceType",e.metadataFilePath="metadataFilePath",e.capProject="capProject",e.capService="capService",e.serviceUrl="serviceUrl",e.serviceUrlPassword="serviceUrlPassword",e.serviceSelection="serviceSelection",e.userSystemName="userSystemName",e.systemSelection="systemSelection",e.valueHelpDownload="valueHelpDownload"})(wn||(wn={}));var YS=Te(v$t(),1),at=class e{static _logger=new ys({logPrefix:"@sap-ux/odata-service-inquirer"});static get logger(){return e._logger}static set logger(t){e._logger=t}static attachAxiosLogger(t){let r=typeof e.logger.getLogLevel=="function"&&e.logger.getLogLevel()==="trace",n=e.logger.debug.bind(e.logger);t.request.use(i=>(i.url||n(`Request URL: ${i.baseURL}`),YS.requestLogger(i,{url:!0,data:!0,params:!0,method:!0,headers:!0,logger:n})),i=>YS.errorLogger(i,{logger:n})),t.response.use(i=>YS.responseLogger(i,{data:r,status:!0,headers:!0,logger:n}),i=>YS.errorLogger(i,{logger:n}))}};var gt=class e{static odataService={};static isYUI=!1;static backendSystemsCache=[];static reset(){Object.keys(e.odataService).forEach(t=>{e.odataService[t]=void 0})}static resetConnectedSystem(){e.odataService.connectedSystem=void 0}};var x$t=Te(Oy(),1),w$t=Te(Py(),1),qTe=Te(A$t(),1);function Bo(){return gt.isYUI?jr()?un.bas:un.vscode:un.cli}function O$t(e){try{let t=(0,x$t.convert)((0,w$t.parse)(e)),r=Number.parseInt(t?.version,10);if(Number.isNaN(r))throw at.logger.error(we("errors.unparseableOdataVersion")),new Error(we("errors.unparseableOdataVersion"));return{odataVersion:r===4?zn.v4:zn.v2,convertedMetadata:t}}catch(t){throw at.logger.error(t),new Error(we("prompts.validationMessages.metadataInvalid"))}}function Qh(e){if(e)return e===zn.v2?Er.v2:Er.v4}function n7(e){if(e?.length===1)return 0}function Zh(e){for(let t in e.services)e.services?.[t].log&&(e.services[t].log=(0,qTe.removeSync)(e.services[t]?.log,{setUndefined:!0}));return e.log&&(e.log=(0,qTe.removeSync)(e.log,{setUndefined:!0})),e}function xO(e,t,r){let n=new la({url:t,client:r}).getId();return e.find(i=>la.from(i).getId()===n)}function C$t(e,t){return!e&&!t||e?.length===0&&t?.length===0||e===t?!0:!e||!t?!1:[...e].sort().toString()===[...t].sort().toString()}var Vr=new ln(void 0,void 0,"@sap-ux/odata-service-inquirer");var jTe;(function(e){e.capProjectPath="capProjectPath",e.capCliStateSetter="capCliStateSetter"})(jTe||(jTe={}));function i7(e,t){try{let{convertedMetadata:r,odataVersion:n}=O$t(e);if(t&&t!==n){let i=we("prompts.validationMessages.odataVersionMismatch",{providedOdataVersion:n,requiredOdataVersion:t});return at.logger.error(i),{validationMsg:i}}return{version:n,convertedMetadata:r}}catch(r){return{validationMsg:r.message}}}var ZTe=require("@sap-devx/yeoman-ui-types");var P$t=new Set([pe.CERT_SELF_SIGNED,pe.CERT_SELF_SIGNED_CERT_IN_CHAIN,pe.CERT_EXPIRED,pe.CERT_UKNOWN_OR_INVALID,pe.INVALID_SSL_CERTIFICATE]),Sl=class{validity={};_validatedUrl;_destinationUrl;_destination;_validatedClient;_odataService;_serviceProvider;_axiosConfig;_catalogV2;_catalogV4;_systemAuthType;_serviceInfo;_connectedUserName;_connectedSystemName;_refreshToken;_ignoreCertError;_connectType="abap_catalog";get ignoreCertError(){return this._ignoreCertError}get axiosConfig(){return this._axiosConfig}get odataService(){return this._odataService}get catalogs(){return{[Er.v2]:this._catalogV2,[Er.v4]:this._catalogV4}}get serviceProvider(){return this._serviceProvider}get systemAuthType(){return this._systemAuthType}set systemAuthType(t){this._systemAuthType=t}get validatedUrl(){return this._validatedUrl}get validatedClient(){return this._validatedClient}get serviceInfo(){return this._serviceInfo}set serviceInfo(t){this._serviceInfo=t}get connectedUserName(){return this._connectedUserName}get refreshToken(){return this._refreshToken}get destinationUrl(){return this._destinationUrl}get destination(){return this._destination}get connectType(){return this._connectType}get connectedSystemName(){return this._connectedSystemName?this._connectedSystemName:this.systemAuthType==="serviceKey"?this.serviceInfo?.systemid:this.validatedUrl}set connectedSystemName(t){this._connectedSystemName=t}setConnectedSystem({serviceProvider:t,backendSystem:r}){if(!t.catalog){at.logger.debug("ConnectionValidator.setConnectedSystem(): Use of a cached connected system is only supported for AbapServiceProviders. Re-authorization will be required.");return}this._serviceProvider=t,this._catalogV2=this._serviceProvider.catalog(Er.v2),this._catalogV4=this._serviceProvider.catalog(Er.v4),this._validatedUrl=r?.serviceKeys?.url??r?.url,this._connectedUserName=r?.userDisplayName,this._validatedClient=r?.client,this._refreshToken=r?.refreshToken,this._serviceInfo=r?.serviceKeys,this.validity.authenticated=!0,this.validity.reachable=!0,this.validity.urlFormat=!0,this.validity.authRequired=!0,r?.authenticationType==="reentranceTicket"?this.systemAuthType="reentranceTicket":r?.serviceKeys?this.systemAuthType="serviceKey":this.systemAuthType="basic"}async checkUrl(t,r,n,{ignoreCertError:i=!1,isSystem:s=!1,odataVersion:o,connectType:a}={}){let u=jr();try{t.pathname=t.pathname?.endsWith("/")?t.pathname:`${t.pathname}/`,i===!0&&jA(!i),u&&t.searchParams.append("saml2","disabled");let c=this.createAxiosConfig(t,i,r,n);if(s){if(await this.createSystemConnection({axiosConfig:c,url:t,odataVersion:o,connectType:a}),a!=="odata_path"){let l=await this.serviceProvider.getSystemInfo();this._connectedUserName=l?.userName,this._connectedSystemName=l?.systemID}}else await this.createOdataServiceConnection(c,t.pathname);return this._validatedClient=t.searchParams.get(KY)??void 0,200}catch(c){if(at.logger.debug(`ConnectionValidator.checkUrl() - error: ${c.message}`),c?.isAxiosError){if(c?.response?.status.toString().match(/5\d\d/)&&u)throw c;return c?.response?.status||c?.code}else throw c}}createAxiosConfig(t,r,n,i){let s={params:Object.fromEntries(t.searchParams),ignoreCertErrors:r,cookies:"",baseURL:t.origin,url:t.pathname,logger:at.logger};return n&&i&&(s=Object.assign(s,{auth:{username:n,password:i}})),s}async createOdataServiceConnection(t,r){await this.shouldIgnoreCertError(t)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,jA(!1)),this._axiosConfig=t,this._serviceProvider=VHe(this._axiosConfig),this._odataService=this._serviceProvider.service(r),this._connectType="odata_path",at.attachAxiosLogger(this._serviceProvider.interceptors),await this._odataService.get("")}resetConnectionState(t=!1){this._serviceProvider=void 0,this._odataService=void 0,this._catalogV2=void 0,this._catalogV4=void 0,this._serviceInfo=void 0,this._connectedUserName=void 0,this._refreshToken=void 0,this._connectedSystemName=void 0,this._ignoreCertError=void 0,this._connectType="abap_catalog",t&&this.resetValidity(),Vr.resetErrorState()}async shouldIgnoreCertError(t,r){at.logger.debug(`ConnectionValidator.shouldIgnoreCertError() - url: ${t.baseURL}`);let n=!1;if(process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0")try{let s=!r||r===Er.v2?Er.v2:Er.v4,o=b_(t);at.attachAxiosLogger(o.interceptors),await o.catalog(s).listServices()}catch(s){let o=ln.getErrorType(s?.response?.status??s?.code);s?.isAxiosError&&P$t.has(o)&&(at.logger.warn(we("warnings.certificateErrors",{url:t?.baseURL,error:o})),at.logger.warn(we("warnings.allowingUnauthorizedCertsNode")),n=!0)}return n}async createSystemConnection({axiosConfig:t,url:r,serviceInfo:n,destination:i,odataVersion:s,connectType:o=this._connectType}){if(this.resetConnectionState(!0),this.systemAuthType==="reentranceTicket"||this.systemAuthType==="serviceKey")this._serviceProvider=this.getAbapOnCloudServiceProvider(r,n);else if(i){let a=r?r.pathname:void 0;this._validatedUrl=tb(i.Name,a),this._destinationUrl=a?this._validatedUrl.replace(`https://${i.Name.toLowerCase()}.dest`,i.Host.replace(/\/{1,10}$/,"")):i.Host,this._serviceProvider=$He({},i)}else t&&(await this.shouldIgnoreCertError(t,s)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,jA(!1)),this._axiosConfig=t,this._serviceProvider=b_(t));if(this._serviceProvider&&at.attachAxiosLogger(this._serviceProvider.interceptors),o==="abap_catalog"){(!s||s===Er.v2)&&(this._catalogV2=this._serviceProvider.catalog(Er.v2)),(!s||s===Er.v4)&&(this._catalogV4=this._serviceProvider.catalog(Er.v4));let a=!1;try{this._catalogV2?await this._catalogV2?.listServices():this._catalogV4&&(a=!0,await this._catalogV4?.listServices())}catch(u){await this.handleCatalogError(u,a)}}else o==="odata_path"&&r&&(at.logger.debug(`Using provided url path: ${r.pathname} to validate authentication.`),this._connectType="odata_path",this._odataService=this._serviceProvider.service(`${r?.pathname}`),await this._odataService.get(""))}async handleCatalogError(t,r){let n=t.response?.status,i=n?ln.getErrorType(n):void 0,s=n&&!r&&(i===pe.NOT_FOUND||i===pe.AUTH);if(this._catalogV4&&s){this._axiosConfig&&await this.shouldIgnoreCertError(this._axiosConfig,Er.v4)&&(this._ignoreCertError=!0,jA(!1),this._axiosConfig={...this._axiosConfig,ignoreCertErrors:!0},this._serviceProvider=b_(this._axiosConfig),this._catalogV4=this._serviceProvider.catalog(Er.v4),at.attachAxiosLogger(this._serviceProvider.interceptors));try{await this._catalogV4.listServices()}catch(o){throw i===pe.AUTH?t:o}}else throw t}async refreshTokenChangedCb(t){at.logger.debug("ConnectionValidator.refreshTokenChangedCb()"),this._refreshToken=t}getAbapOnCloudServiceProvider(t,r,n){if(this.systemAuthType==="reentranceTicket"&&t)return Sre({environment:T_.EmbeddedSteampunk,url:t.origin,logger:at.logger});if(this.systemAuthType==="serviceKey"&&r)return Sre({environment:T_.Standalone,service:r,refreshToken:n,refreshTokenChangedCb:this.refreshTokenChangedCb.bind(this),logger:at.logger});throw new Error("Invalid system auth type")}async validateServiceInfo(t,r){if(!t)return!1;if(t.url===this.validatedUrl&&JSON.stringify(t.uaa)===JSON.stringify(this.serviceInfo?.uaa))return this.getValidationResultFromStatusCode(200);try{return this.systemAuthType="serviceKey",await this.createSystemConnection({serviceInfo:t,odataVersion:r}),this._connectedUserName=await this.serviceProvider.user(),this._serviceInfo=t,this._validatedUrl=t.url,this.getValidationResultFromStatusCode(200)}catch(n){return at.logger.debug(`ConnectionValidator.validateServiceInfo() - error: ${n.message}`),n?.isAxiosError&&this.getValidationResultFromStatusCode(n?.response?.status||n?.code),Vr.getErrorMsg(n)??!1}}async validateDestination(t,r,n){try{if(this.systemAuthType=t.Authentication===sp.NO_AUTHENTICATION?"basic":"unknown",eg(t)||zl(t))return await this.validateOdataServiceDestination(t,n);{let i;if(n){let s=tb(t.Name.toLowerCase(),n);i=new URL(s)}await this.createSystemConnection({destination:t,odataVersion:r,url:i,connectType:i?"odata_path":void 0})}return{valResult:this.getValidationResultFromStatusCode(200)}}catch(i){i?.isAxiosError&&this.getValidationResultFromStatusCode(i?.response?.status||i?.code);let s=Vr.logErrorMsgs(i);return{valResult:Vr.getValidationErrorHelp(i,!1,t)??s,errorType:Vr.getCurrentErrorType()??pe.DESTINATION_CONNECTION_ERROR}}}async validateOdataServiceDestination(t,r,n){this.resetConnectionState(!0);let i=tb(t.Name.toLowerCase(),r);this._destinationUrl=r?i.replace(`https://${t.Name.toLowerCase()}.dest`,t.Host.replace(/\/{1,10}$/,"")):t.Host,this._destination=t;let s=await this.checkUrl(new URL(i),void 0,void 0,{odataVersion:n}),o=this.getValidationResultFromStatusCode(s);if(this.validity.reachable&&(this._validatedUrl=i),!this.validity.reachable){let a=Vr.logErrorMsgs(s);return{valResult:Vr.getValidationErrorHelp(s,!1,t)??a,errorType:Vr.getCurrentErrorType()??pe.DESTINATION_CONNECTION_ERROR}}return this.validity.authRequired?{valResult:ln.getErrorMsgFromType(pe.AUTH,t.Authentication!==sp.NO_AUTHENTICATION?we("texts.checkDestinationAuthConfig"):void 0),errorType:pe.AUTH}:{valResult:o}}async validateUrl(t,{ignoreCertError:r=!1,forceReValidation:n=!1,isSystem:i=!1,odataVersion:s,systemAuthType:o,connectType:a}={}){if(this.isEmptyString(t))return this.resetValidity(),this.validity.urlFormat=!1,!1;o&&(this.systemAuthType=o);let u;try{if(u=new URL(t),u.origin==="null")return we("errors.invalidUrl",{input:t});if(a!=="odata_path"&&(this.systemAuthType==="reentranceTicket"||i)&&!(u.pathname.length===0||u.pathname==="/"))return we("prompts.validationMessages.systemUrlOriginOnlyWarning")}catch{return we("errors.invalidUrl",{input:t})}try{if(!n&&this.isUrlValidated(t))return this.validity.reachable??!1;this.resetValidity();let c=await this.checkUrl(u,void 0,void 0,{ignoreCertError:r,isSystem:i,odataVersion:s,connectType:a});return at.logger.debug(`ConnectionValidator.validateUrl() - status: ${c}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t,this.getValidationResultFromStatusCode(c)}catch(c){return this.resetValidity(),ln.getErrorType(c)===pe.CONNECTION?(this.validity.reachable=!1,Vr.logErrorMsgs(we("errors.systemOrServiceUrlNotFound",{url:t}))):Vr.getErrorMsg(c)??c.message}}getValidationResultFromStatusCode(t){return t===200?(this.validity.reachable=!0,this.validity.authenticated=!0,!0):ln.getErrorType(t)===pe.NOT_FOUND?(this.validity.reachable=!1,ln.getErrorMsgFromType(pe.NOT_FOUND)??!1):ln.isCertError(t)?(this.validity.reachable=!0,this.validity.canSkipCertError=P$t.has(ln.getErrorType(t)),this.validity.authenticated=!1,Vr.getValidationErrorHelp(t,!1)??!1):ln.getErrorType(t)===pe.AUTH?(this.validity.reachable=!0,this.validity.authRequired=!0,this.validity.authenticated=!1,!0):ln.getErrorType(t)===pe.REDIRECT?(this.validity.reachable=!0,we("errors.urlRedirect")):ln.getErrorType(t)===pe.CONNECTION?(this.validity.reachable=!1,ln.getErrorMsgFromType(pe.CONNECTION,we("texts.httpStatus",{httpStatus:t}))??!1):ln.getErrorType(t)===pe.BAD_REQUEST?(this.validity.reachable=!0,ln.getErrorMsgFromType(pe.BAD_REQUEST,we("texts.httpStatus",{httpStatus:t}))??!1):ln.getErrorType(t)===pe.BAD_GATEWAY?(this.validity.reachable=!1,ln.getErrorMsgFromType(pe.BAD_GATEWAY,we("texts.httpStatus",{httpStatus:t}))??!1):(this.validity.reachable=!0,ln.getErrorMsgFromType(ln.getErrorType(t),we("texts.httpStatus",{httpStatus:t}))??!0)}isEmptyString(t){return!t||t.trim().length===0}isUrlValidated(t){return this._validatedUrl===t}async isAuthRequired(){return at.logger.debug(`ConnectionValidator.isAuthRequired() - validity: ${JSON.stringify(this.validity)}`),!this._validatedUrl||this.validity.authenticated?!1:this.validity.authRequired}async validateAuth(t,r,n,{ignoreCertError:i=!1,sapClient:s,odataVersion:o,isSystem:a=!1,connectType:u}={}){if(!t)return{valResult:!1};try{let c=new URL(t);s&&c.searchParams.append(KY,s),this.systemAuthType="basic";let l=await this.checkUrl(c,r,n,{ignoreCertError:i,isSystem:a,odataVersion:o,connectType:u});at.logger.debug(`ConnectionValidator.validateAuth() - status: ${l}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t;let f=this.getValidationResultFromStatusCode(l);if(f===!0){if(this.validity.authenticated===!0)return this._connectedUserName=r,{valResult:!0};if(this.validity.authenticated===!1)return{valResult:this.getAuthFailureReasonText(l,o),errorType:pe.AUTH}}return{valResult:f}}catch(c){return{valResult:Vr.getValidationErrorHelp(c,!1,this.destination)??Vr.getErrorMsg(c)??we("errors.unknownError"),errorType:Vr.getCurrentErrorType()??void 0}}}resetValidity(){delete this.validity.urlFormat,delete this.validity.reachable,delete this.validity.authRequired,delete this.validity.authenticated,delete this.validity.canSkipCertError,this._validatedUrl=void 0,this._destinationUrl=void 0,this._destination=void 0}getAuthFailureReasonText(t,r){let n;[403,"403"].includes(t)?n=we("texts.authorizationFailed"):[401,"401"].includes(t)&&(n=we("texts.authenticationFailed"));let i;return r?i=we("errors.authenticationFailedSpecificCatalog",{odataVersion:r,authFailType:n}):i=we("errors.authenticationFailedAllCatalogs",{authFailType:n}),i}};var G$t=Te(tq(),1);var iE={newSystemType:"newSystemType",newSystemUrl:"newSystemUrl",newSystemAuthType:"newSystemAuthType"};var sE=require("@sap-devx/yeoman-ui-types");var UJn=Te(Oy(),1),kJn=Te(Py(),1);function D$t(e){return e.filter(t=>!!t.entityType.entityProperties.find(n=>n.name==="HasDraftEntity"))}var R$t=Te(Oy(),1),N$t=Te(Py(),1);function BJn(e){return!!e.find(r=>r.annotations?.Common?.DraftRoot?!!r.annotations.Common.DraftRoot.ShareAction:!1)}function VTe(e){let t=!1;try{let r;typeof e=="string"?r=(0,R$t.convert)((0,N$t.parse)(e)):r=e;let n=D$t(r.entitySets)??[];n?.length>0&&(t=!BJn(n))}catch(r){at.logger.error(we("errors.unparseableMetadata",{error:r.message}))}return t}var qJn=["/IWBEP/COMMON"],jJn="SERVICE_INQUIRER_BAS_SUCCESS",VJn=e=>{let t=[],r=!1;return typeof at.logger.getLogLevel=="function"&&(r=at.logger.getLogLevel()==="trace"),e?.filter(n=>!qJn.some(i=>n.id.includes(i))).forEach(n=>{let i=n.name,s=n.path;i=`${i} (${n.serviceVersion}) - OData V${n.odataVersion}`,r&&(i=`${i} Service Type: ${n.serviceType}`),t.push({name:i,value:{servicePath:s,serviceODataVersion:n.odataVersion,toString:()=>i,serviceType:n.serviceType,serviceId:n.id}})}),at.logger.debug(`Number of unique service choices: ${t.length}`),t.sort((n,i)=>n.name?n.name.localeCompare(i.name??""):0)};function $Jn(e,t){let r=Object.entries(e);r.forEach(([n,i])=>{Vr.logErrorMsgs(i,we("warnings.missingServices",{odataVersion:n}))}),t===r.length&&Vr.logErrorMsgs(we("errors.allCatalogServiceRequestsFailed",{version:Object.keys(e).join(", ")}))}async function I$t(e,t){let r={},n={},i=[];for(let o of e){let a=o instanceof Bm?Er.v2:Er.v4;try{let u=Date.now(),c=await o.listServices(),l=Date.now(),f=l-u===0?"<1 ms":`${l-u}ms`;n[`v${a}`]={serviceCount:c.length,duration:f},at.logger.debug(`Number of service${a===Er.v4?" groups":"s"}: ${c.length} returned in: ${f}}`),i.push(c)}catch(u){at.logger.error(we("errors.serviceCatalogRequest",{catalogRequestUri:o.getUri(),entitySet:o.entitySet,error:u})),Object.assign(r,{[a]:u}),i.push([])}}at.logger.debug(`Service catalog request times: ${JSON.stringify(n,void 0," ")}`);let s=i?.flat()??[];return at.logger.debug(`Number of services available: ${s.length}`),(s.length===0||Object.keys(r).length>0)&&$Jn(r,e.length),t&&(s=s.filter(o=>t.includes(o.id)||t.includes(o.path))),VJn(s)}function $Te(e){let t=vS.createTelemetryData({destODataType:u6(e)})??{};IS(jJn,t)}async function GJn(e,t,r,n,i){let s=[];try{let o=await t.metadata(),{validationMsg:a,version:u,convertedMetadata:c}=i7(o,i);if(a)return{validationMsg:a};if(!r&&u===zn.v2&&n)try{at.logger.debug("Creating a catalog service object for v2 service path to request annotations."),r=b_(n).catalog(Er.v2),at.attachAxiosLogger(r.interceptors)}catch(l){at.logger.warn(we("error.v2CatalogServiceNoAnnotations",l))}if(r)try{s=await r.getAnnotations({path:e})}catch{at.logger.info(we("prompts.validationMessages.noAnnotations"))}return{annotations:s,metadata:o,version:u,convertedMetadata:c}}catch(o){let a=Vr.getErrorMsg(o);return at.logger.error(we("errors.serviceMetadataErrorLog",{servicePath:e,errorText:a})),{validationMsg:we("errors.serviceMetadataErrorUI",{servicePath:e,errorText:a})}}}async function HJn(e,t,r){let n;if(t===DP.NotDetermined)try{n=await r.getServiceType(e)??DP.NotDetermined}catch(i){at.logger.error(we("errors.serviceTypeRequestError",{error:i.message}))}return n??t}async function GTe(e,t,r){let n=t.catalogs?.[e.serviceODataVersion];if(!t.serviceProvider)return at.logger.error("ConnectionValidator connection is not initialized"),{validationResult:!1};let i=t.odataService;i||(i=t.serviceProvider.service(e.servicePath));let{validationMsg:s,version:o,convertedMetadata:a,annotations:u,metadata:c}=await GJn(e.servicePath,i,n,t.axiosConfig,r);if(s)return{validationResult:s};let l=t.destinationUrl??t.validatedUrl,f;return l&&(f=new URL(l).origin),gt.odataService.annotations=u,gt.odataService.metadata=c,gt.odataService.odataVersion=o??(e.serviceODataVersion===Er.v2?zn.v2:zn.v4),gt.odataService.servicePath=e.servicePath,gt.odataService.serviceId=e.serviceId,gt.odataService.origin=f,gt.odataService.sapClient=t.validatedClient,gt.odataService.ignoreCertError=t.ignoreCertError,{validationResult:!0,hasAnnotations:!!gt.odataService.annotations&&gt.odataService.annotations.length>0,convertedMetadata:a}}function L$t(e){let t=we("prompts.systemService.message");return e&&(t=t.concat(` ${we("texts.forUserName",{username:e})}`)),t}async function M$t(e,t,r,{requiredOdataVersion:n,hasAnnotations:i=!0,showCollabDraftWarnOptions:s,serviceFilter:o}){if(e?.length===0)return o&&o.length>0?{message:we("warnings.specifiedServicesNotAvailable",{odataVersion:n?`V${n} `:void 0,service:o[0],count:o.length}),severity:sE.Severity.warning}:n?{message:we("warnings.noServicesAvailableForOdataVersion",{odataVersion:n}),severity:sE.Severity.warning}:{message:we("warnings.noServicesAvailable"),severity:sE.Severity.warning};if(t){let a=t.serviceType;if(t.serviceODataVersion===Er.v2){if(!i)return{message:we("warnings.noAnnotations"),severity:sE.Severity.warning};a=await HJn(t.servicePath,t.serviceType,r.catalogs[Er.v2])}else if(s?.showCollabDraftWarning&&t.serviceODataVersion===Er.v4&&VTe(s.edmx))return{message:we("warnings.collaborativeDraftMessage"),severity:sE.Severity.warning};if(a&&a!==DP.UI)return{message:we("warnings.nonUIServiceTypeWarningMessage",{serviceType:"A2X"}),severity:sE.Severity.warning}}else if(Vr.getErrorMsg())return{message:`${Vr.getErrorMsg()} ${we("texts.seeLogForDetails")}`,severity:sE.Severity.information}}var WJn="VALUE_HELP_DOWNLOAD_PROMPTED",YJn="VALUE_HELP_DOWNLOAD_SUCCESS",zJn="VALUE_HELP_DOWNLOAD_FAILED";async function HTe(e,t,r){let n=vS.createTelemetryData(t)??{};if(r&&Object.keys(r).length>0){let i=VUt();i&&await i.reportEvent({eventName:e,properties:n,measurements:r},Ci.NoSampling)}else IS(e,n)}async function F$t(e,t,r){if(delete gt.odataService.valueListMetadata,await HTe(WJn,{userChoseToDownload:e}),e&&t.serviceProvider instanceof ja){let n=Date.now();try{let i=await t.serviceProvider.fetchExternalServices(r),s=Date.now()-n;i.length>0?gt.odataService.valueListMetadata=i:at.logger.info(we("warnings.noExternalServiceMetdataFetched")),await HTe(YJn,{userChoseToDownload:!0,valueHelpCount:i.length},{downloadTimeMs:s})}catch(i){let s=Date.now()-n;at.logger.error(`Failed to fetch external service metadata: ${i}`),await HTe(zJn,{userChoseToDownload:!0,error:i instanceof Error?i.message:"Unknown error"},{downloadTimeMs:s})}}}function U$t(e,t,r){let n=`${t?t+":":""}`,i=`${n}${wn.valueHelpDownload}`,s=`${n}${wn.serviceSelection}`,o=`${n}cliValueHelpDownload`,a,c=[{when:l=>{let p=l?.[s]?.servicePath;return p&&r?.convertedMetadata?(a=lM(p,r?.convertedMetadata),a.length>0):!1},name:i,type:"confirm",message:we("prompts.valueHelpDownload.message"),validate:async l=>(Bo()!==un.cli&&await F$t(l,e,a),!0)}];return Bo()===un.cli&&c.push({when:async l=>{let f=l?.[i];return f!==void 0&&a&&await F$t(f,e,a),!1},name:o,type:"input"}),c}var KJn="cliServiceSelection";function oE(e,t,r,n=!0){let i=[],s,o,a,u,c,l={convertedMetadata:void 0},f=r?.requiredOdataVersion,p=`${t}:${wn.serviceSelection}`,d={when:()=>e.validity.authenticated||e.validity.authRequired===!1,name:p,type:r?.useAutoComplete?"autocomplete":"list",message:()=>L$t(e.connectedUserName),guiOptions:{breadcrumb:we("prompts.systemService.breadcrumb"),mandatory:!0,applyDefaultWhenDirty:!0},showOutputTabLink:"validationMessageOverflow",source:(g,v)=>ww(v,i),choices:async g=>{if(i.length===0||s!==e.validatedUrl||o!==e.validatedClient||!C$t(u,r?.serviceFilter))if(e.catalogs[zn.v2]||e.catalogs[zn.v4])i=await XJn(e.catalogs,f,r?.serviceFilter),s=e.validatedUrl,o=e.validatedClient,u=r?.serviceFilter?[...r.serviceFilter]:void 0,g?.[`${wn.systemSelection}`]?.type==="destination"&&$Te(g?.[`${wn.systemSelection}`]?.system);else if(e.odataService&&e.validatedUrl&&!await e.isAuthRequired()){let v=new URL(e.destinationUrl??e.validatedUrl);i=[{name:v.toString(),value:{servicePath:v.pathname}}],g?.[`${wn.systemSelection}`]?.type==="destination"&&$Te(g?.[`${wn.systemSelection}`]?.system)}else at.logger.error(we("errors.noCatalogOrServiceAvailable"));return i},additionalMessages:g=>M$t(i,g,e,{requiredOdataVersion:f,hasAnnotations:c,showCollabDraftWarnOptions:l.convertedMetadata?{showCollabDraftWarning:!!r?.showCollaborativeDraftWarning,edmx:l.convertedMetadata}:void 0,serviceFilter:r?.serviceFilter}),default:()=>n7(i),validate:async g=>{let v=g;if(r?.useAutoComplete&&g.value&&(v=g.value),!e.validatedUrl)return!1;if(i.length===0&&Vr.hasError())return ln.getHelpForError(pe.SERVICES_UNAVAILABLE)??!1;if(v&&(a?.servicePath!==v.servicePath||a?.servicePath!==gt.odataService.servicePath)){c=void 0,l.convertedMetadata=void 0,a=v;let S=await GTe(v,e,f);return c=S.hasAnnotations,l.convertedMetadata=S.convertedMetadata,S.validationResult}return!0}};if(r?.additionalMessages){let g={[p]:{additionalMessages:r.additionalMessages}};d=xve([d],g,gt.odataService)[0]}let h=[d];return Bo()===un.cli&&!r?.useAutoComplete&&h.push({when:async g=>{let v=g?.[`${t}:${wn.serviceSelection}`];if(v&&e.validatedUrl){let{validationResult:S,hasAnnotations:b,convertedMetadata:A}=await GTe(v,e);if(typeof S=="string")throw at.logger.error(S),new Error(S);c=b,l.convertedMetadata=A}if(i.length===0&&Vr.hasError()){let S=ln.getHelpForError(pe.SERVICES_UNAVAILABLE).toString();throw new Error(S)}return!1},name:`${t}:${KJn}`}),n||h.push(...Ps(U$t(e,t,l),g=>e.serviceProvider instanceof ja&&!!l.convertedMetadata&&g?.[p]?.serviceODataVersion===Er.v4)),h}async function XJn(e,t,r){let n=[];return t&&e[t]?n.push(e[t]):n=Object.values(e).filter(i=>i!==void 0),await I$t(n,r)}var q$t=require("@sap-devx/yeoman-ui-types");var WTe=require("@sap-devx/yeoman-ui-types");var cc;(function(e){e.systemUsername="systemUsername",e.systemPassword="systemPassword",e.storeSystemCredentials="storeSystemCredentials"})(cc||(cc={}));function s7(e,t,r,n){let i=`${t?t+":":""}${cc.systemUsername}`,s=`${t?t+":":""}${cc.systemPassword}`,o=`${t?t+":":""}${cc.storeSystemCredentials}`,a,u=[{when:async()=>(a=await e.isAuthRequired(),e.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"input",name:i,message:we("prompts.systemUsername.message"),guiOptions:{mandatory:!0},default:"",validate:l=>l?.length>0},{when:()=>!!(e.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"password",guiOptions:{mandatory:!0,applyDefaultWhenDirty:!0},guiType:"login",showOutputTabLink:"validationMessageOverflow",name:s,message:we("prompts.systemPassword.message"),mask:"*",default:"",validate:async(l,f)=>{if(!(e.validatedUrl&&f?.[i]&&l&&(!r||r.isValid)))return!1;let p=f?.[wn.systemSelection],d,h=!0;if(p?.type==="backendSystem")d=p.system?.client;else if(p?.type==="destination"){let v=p.system;(eg(v)||zl(v))&&(h=!1)}let{valResult:g}=await e.validateAuth(e.validatedUrl,f?.[i],l,{sapClient:r?.sapClient||d,isSystem:h,odataVersion:Qh(n)});return g===!0&&e.serviceProvider?(JJn(e.serviceProvider,p,{username:f?.[i],password:l}),!0):g},additionalMessages:(l,f)=>{if(e.ignoreCertError&&f?.newSystemType!=="abapOnPrem")return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:WTe.Severity.warning}}}],c={when:l=>!!(e.systemAuthType==="basic"&&a&&e.validity.authenticated&&l[s]),type:"confirm",name:o,message:we("prompts.storeSystemCredentials.message"),default:!1,guiOptions:{breadcrumb:we("prompts.storeSystemCredentials.breadcrumb")},validate:async l=>{if(gt.odataService.connectedSystem?.backendSystem){let f=gt.odataService.connectedSystem.backendSystem;gt.odataService.connectedSystem.backendSystem=Object.assign(f,{newOrUpdated:l})}return!0},additionalMessages:l=>{if(l===!0)return{message:we("texts.passwordStoreWarning"),severity:WTe.Severity.warning}}};return jr()||u.push(c),u}function JJn(e,t,{username:r,password:n}){if(gt.odataService.connectedSystem={serviceProvider:Zh(e)},t?.type==="backendSystem"){let i=t.system;(i.username!==r||i.password!==n)&&(gt.odataService.connectedSystem.backendSystem=Object.assign(i,{username:r,password:n,userDisplayName:r}))}else t?.type==="destination"&&(gt.odataService.connectedSystem.destination=t.system)}async function YTe(){return await gS({entityName:"system"})}async function o7(e=!1){let t=[];try{t=await(await YTe()).getAll({includeSensitiveData:e,backendSystemFilter:{connectionType:["abap_catalog","odata_service"]}})}catch(r){at.logger.error(we("errors.backendSystemRetrieval",{error:r.message}))}return t}async function QJn(e){return!!(await o7(!1)).find(r=>r.name===e)}async function KM(e){return e?await QJn(e)?we("prompts.systemName.systemNameExistsWarning"):!0:we("prompts.systemName.emptySystemNameWarning")}function k$t(e,t){try{return new URL(t,e),!0}catch{return we("errors.invalidUrl",{input:`${e}${t}`})}}async function B$t(e,t){let r=e+(t?we("texts.suggestedSystemNameClient",{client:t}):"");return await KM(r)===!0?r:ZJn(r)}async function ZJn(e){let t=1,r=`${e} (${t})`;for(;await KM(r)!==!0;)r=`${e} (${t})`,t++;return r}function eQn(e){switch(e){case"serviceKey":return hL.ReentranceTicket;case"reentranceTicket":return hL.ReentranceTicket;case"basic":return hL.Basic;default:return}}function a7(e,t,r,n,i=!0){return{type:"input",name:`${t?t+":":""}${iE.newSystemUrl}`,message:we("prompts.systemUrl.message"),guiOptions:{hint:we("prompts.systemUrl.description"),mandatory:!0,breadcrumb:!0},validate:async a=>{if(gt.resetConnectedSystem(),n&&n.backendSystem?.url===a&&n.backendSystem?.authenticationType==="reentranceTicket")e.setConnectedSystem(n);else if(i){let c=xO(gt.backendSystemsCache,a);if(c)return we("prompts.validationMessages.backendSystemExistsWarning",{backendName:c.name})}let u=await e.validateUrl(a,{isSystem:!0,odataVersion:Qh(r),forceReValidation:!0});return u===!0&&(e.validity.authenticated&&e.serviceProvider?gt.odataService.connectedSystem={serviceProvider:Zh(e.serviceProvider)}:e.systemAuthType="basic"),u},additionalMessages:()=>{if(e.ignoreCertError)return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:q$t.Severity.warning}}}}function u7(e,t){let r,n=!1,i=`${t?t+":":""}`,s=`${i}${wn.userSystemName}`;return{type:"input",guiOptions:{hint:we("prompts.systemName.hint"),applyDefaultWhenDirty:!0,breadcrumb:!0,mandatory:!0},name:s,message:we("prompts.systemName.message"),default:async()=>{let a=e.connectedSystemName;return a&&!n&&(r=await B$t(a,e.validatedClient)),r},validate:async(a,u)=>{if(!a)return!1;let c=!1;a===r?c=!0:(n=!0,r=a,c=await KM(a));let l=!!u?.[`${i}${cc.storeSystemCredentials}`];if(c===!0&&e.validatedUrl&&gt.odataService.connectedSystem){let f=new ai({authenticationType:eQn(e.systemAuthType),name:a,url:e.validatedUrl,client:e.validatedClient,username:l?e.axiosConfig?.auth?.username:void 0,password:l?e.axiosConfig?.auth?.password:void 0,serviceKeys:e.serviceInfo,userDisplayName:e.connectedUserName,systemType:mL({serviceKeys:e.serviceInfo,authenticationType:e.systemAuthType}),connectionType:"abap_catalog"});gt.odataService.connectedSystem.backendSystem=f,gt.odataService.connectedSystem.backendSystem.newOrUpdated=!0}return c}}}var zTe="!@\xA3*&937newSystem*X~qy^",c7="cfAbapEnvService";async function j$t(e,t,r,n,i){gt.resetConnectedSystem();let s=!1,a=await(await YTe()).read(e);if(a){n&&n.backendSystem?.url===a.url&&t.setConnectedSystem(n);let u=new URL(a.url),c=u.origin;if(i&&(c=new URL(i,u.origin).toString()),a.authenticationType==="reentranceTicket")u.pathname!=="/"&&at.logger.warn(we("warnings.storedSystemUrlPathNotSupported",{systemUrl:a.url})),s=await t.validateUrl(c,{isSystem:!0,odataVersion:Qh(r),systemAuthType:"reentranceTicket",connectType:i?"odata_path":void 0});else if(a.serviceKeys)s=await t.validateServiceInfo(a.serviceKeys,Qh(r));else if(a.authenticationType==="basic"||!a.authenticationType){let l;if({valResult:s,errorType:l}=await t.validateAuth(c,a.username,a.password,{isSystem:!0,odataVersion:Qh(r),sapClient:a.client,connectType:i?"odata_path":void 0}),l===pe.AUTH)return at.logger.error(we("errors.storedSystemConnectionError",{systemName:a.name,error:s})),!0}s===!0&&t.serviceProvider&&(gt.odataService.connectedSystem={serviceProvider:Zh(t.serviceProvider),backendSystem:a})}return s}async function XM(e,t,r,n){gt.resetConnectedSystem();let{valResult:i,errorType:s}=await t.validateDestination(e,Qh(r),n);return s===pe.AUTH&&t.systemAuthType==="basic"?(at.logger.error(we("errors.destination.authError",{systemName:e.Name,error:i})),!0):(i===!0&&t.serviceProvider&&(gt.odataService.connectedSystem={serviceProvider:Zh(t.serviceProvider),destination:e}),i)}function tQn(e,t){return!t||t.odata_abap&&aq(e)||t.odata_generic&&oq(e)||t.full_service_url&&eg(e)||t.partial_service_url&&zl(e)?!0:(at.logger.debug(`Destination: ${e.Name} does not match any filters and will be excluded as a prompt choice. Destination configuration: ${JSON.stringify(e)}`),!1)}async function V$t(e,t=!1,r=!1){let n=[],i;if(jr()){let s={};try{s=await hre({stripS4HCApiHosts:!0})}catch(o){at.logger.error(we("errors.destination.listDestinations",{error:o.message}))}n=Object.values(s).filter(o=>tQn(o,e)).map(o=>({name:mHe(o),value:{type:"destination",system:o}})),t&&(i={name:we("prompts.newSystemType.choiceCFAbapEnvServiceOnBtp"),value:{type:c7,system:c7}})}else{let s=await o7(!1);gt.backendSystemsCache=s,n=s.map(o=>({name:c5e(o),value:{system:o,type:"backendSystem"}})),r||(i={name:we("prompts.systemSelection.newSystemChoiceLabel"),value:{type:"newSystemChoice",system:zTe}})}return n.sort(({name:s},{name:o})=>s.localeCompare(o,void 0,{numeric:!0,caseFirst:"lower"})),i&&n.unshift(i),n}function KTe(e,t){let r=typeof t=="string"?t:t?.value;return r?e.findIndex(i=>{let{type:s,system:o}=i.value;if(s==="destination")return o.Name===r;if(s==="backendSystem")return o.name===r;if(s==="newSystemChoice")return r===zTe;if(s==="cfAbapEnvService")return r===c7}):-1}var l7="abapOnBtp",_rs=`${l7}:${iE.newSystemUrl}`,rQn="cliCfAbapService",XTe={abapOnBtpAuthType:"abapOnBtpAuthType",cloudFoundryAbapSystem:"cloudFoundryAbapSystem"};function H$t(e,t){gt.reset();let r=new Sl,n=[];return n.push({type:"list",name:XTe.abapOnBtpAuthType,choices:[{name:we("prompts.abapOnBTPType.choiceCloudFoundry"),value:"cloudFoundry"},{name:we("prompts.abapOnBTPType.choiceReentranceTicket"),value:"reentranceTicket"}],message:we("prompts.abapOnBTPType.message"),validate:()=>(r.resetConnectionState(!0),gt.resetConnectedSystem(),!0)}),n.push(Ps([a7(r,l7,e?.serviceSelection?.requiredOdataVersion,t)],i=>i?.abapOnBtpAuthType==="reentranceTicket"?(r.systemAuthType=i.abapOnBtpAuthType,!0):!1)[0],...Ps([...JTe(r,void 0,void 0,t)],i=>i?.abapOnBtpAuthType==="cloudFoundry")),e?.userSystemName?.hide!==!0&&n.push(Ps([u7(r,l7)],()=>!!r.validatedUrl&&r.validity.reachable===!0&&(r.validity.authenticated??r.validity.authRequired!==!0))[0]),n.push(...oE(r,l7,e?.serviceSelection,e?.valueHelpDownload?.hide)),n}async function $$t(e,t,r,n=!1,i){gt.resetConnectedSystem();let s=e.label,o=await(0,G$t.apiGetInstanceCredentials)(s);if(!o?.credentials?.uaa)return we("errors.cfInstanceCredentialsNotReturned",{serviceInstanceName:s});let a=!0,u;if(Bo()===un.bas)try{u=await _He(s,{uaaCredentials:o.credentials.uaa,hostUrl:o.credentials.url},at.logger),a=await XM(u,t,r)}catch(c){a=c.message}else i&&i.backendSystem?.url===o.credentials.url&&JSON.stringify(i.backendSystem.serviceKeys?.uaa)===JSON.stringify(o.credentials.uaa)&&t.setConnectedSystem(i),a=await t.validateServiceInfo(o.credentials);if(!n&&a!==!0)return a;if(n&&typeof a=="string")throw at.logger.error(a),new Error(a);if(n&&a===!1)throw at.logger.error(Vr.getErrorMsg()??we("errors.abapServiceAuthenticationFailed")),new Error(we("errors.abapServiceAuthenticationFailed"));return t.serviceProvider&&Bo()!==un.bas&&(t.connectedSystemName=await mre(s),gt.odataService.connectedSystem={serviceProvider:Zh(t.serviceProvider)}),!0}function JTe(e,t,r,n){let i=[],o=[{type:"list",name:`${t?t+":":""}${XTe.cloudFoundryAbapSystem}`,guiOptions:{breadcrumb:!0,applyDefaultWhenDirty:!0},choices:async()=>{if(i=await GUt(Vr),i.length===0&&Bo()===un.cli)throw new Error(we("errors.abapEnvsUnavailable"));return i},default:()=>n7(i),message:we("prompts.cloudFoundryAbapSystem.message"),validate:async a=>{if(a){let c=await $$t(a,e,r,Bo()===un.cli,n);if(!jr()&&c===!0&&e.validatedUrl){let l=xO(gt.backendSystemsCache,e.validatedUrl,e.validatedClient);if(l)return e.resetConnectionState(!0),we("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}return c}if(Vr.getCurrentErrorType()===pe.NO_ABAP_ENVS){let c=Vr.getErrorMsg(!0),l=we("texts.seeLogForDetails");return`${c} ${l}`}return!1}}];return Bo()===un.cli&&o.push({when:async a=>{let u=a?.[XTe.cloudFoundryAbapSystem];return u&&await $$t(u,e,r,!0),!1},name:rQn}),o}function W$t(e){let t="cfAbapBas",r=new Sl;return[...JTe(r,t,e?.serviceSelection?.requiredOdataVersion),...oE(r,t,e?.serviceSelection,e?.valueHelpDownload?.hide)]}var zS="abapOnPrem",QTe=`${zS}:${iE.newSystemUrl}`,Lrs=`${zS}:${cc.systemUsername}`,Mrs=`${zS}:${cc.systemPassword}`,nQn={sapClient:"sapClient"};function Y$t(e){gt.reset();let t=new Sl,r=e?.serviceSelection?.requiredOdataVersion,n=iQn(e?.userSystemName,t,r);return n.push(...oE(t,zS,e?.serviceSelection,e?.valueHelpDownload?.hide)),n}function iQn(e,t,r){let n=t??new Sl,i={sapClient:void 0,isValid:!0},s=[a7(n,zS,r,void 0,!1),{type:"input",name:nQn.sapClient,message:we("prompts.sapClient.message"),guiOptions:{breadcrumb:we("prompts.sapClient.breadcrumb")},validate:(o,a)=>{let u=s$t(o);if(u===!0){if(i.sapClient=o,i.isValid=!0,a?.[QTe]){let c=xO(gt.backendSystemsCache,a[QTe],o);if(c)return i.isValid=!1,we("prompts.validationMessages.backendSystemExistsWarning",{backendName:c.name})}return!0}return i.sapClient=void 0,i.isValid=!1,u}},...s7(n,zS,i,r)];return e?.hide!==!0&&s.push(Ps([u7(n,zS)],o=>!!o?.[QTe]&&n.validity.reachable===!0&&(n.validity.authenticated||n.validity.authRequired===!1))[0]),s}function z$t(e,t){let r=[{type:"list",name:iE.newSystemType,choices:[{name:we("prompts.newSystemType.choiceAbapOnBtp"),value:"abapOnBtp"},{name:we("prompts.newSystemType.choiceAbapOnPrem"),value:"abapOnPrem"}],message:we("prompts.newSystemType.message")}];return r.push(...Ps(Y$t(e),n=>n.newSystemType==="abapOnPrem")),r.push(...Ps(H$t(e,t),n=>n.newSystemType==="abapOnBtp")),r}var f7="systemSelection",ins=`${f7}:${cc.systemUsername}`,sns=`${f7}:${cc.systemPassword}`,K$t={systemSelectionCli:"systemSelectionCli",destinationServicePath:"destinationServicePath"};async function X$t(e,t,r,n,i){if(gt.reset(),e.type==="newSystemChoice"||e.type==="cfAbapEnvService")return t.resetConnectionState(!0),!0;let s=!1;if(e.type==="backendSystem"){e.system.connectionType==="odata_service"&&(i=e.system.url);let o=la.from(e.system);s=await j$t(o,t,r,n,i)}else if(e.type==="destination"){if(zl(e.system))return!0;s=await XM(e.system,t,r,i)}return s}async function ebe(e,t){gt.reset();let r=new Sl,n=await sQn(r,e,t);return e?.serviceSelection?.hide||n.push(...Ps(oE(r,f7,e?.serviceSelection,e?.valueHelpDownload?.hide),i=>i.systemSelection?.type!=="newSystemChoice")),jr()?n.push(...Ps(W$t(e),i=>i.systemSelection?.type==="cfAbapEnvService")):n.push(...Ps(z$t(e,t),i=>i.systemSelection?.type==="newSystemChoice")),n}async function sQn(e,t,r){let n=t?.serviceSelection?.requiredOdataVersion,i=t?.systemSelection?.destinationFilters,s=await V$t(i,t?.systemSelection?.includeCloudFoundryAbapEnvChoice,t?.systemSelection?.hideNewSystem),o=KTe(s,t?.systemSelection?.defaultChoice),a=t?.systemSelection?.connectPath,u=t?.systemSelection?.onlyShowDefaultChoice&&t?.systemSelection?.defaultChoice,c=[{type:t?.systemSelection?.useAutoComplete?"autocomplete":"list",name:wn.systemSelection,message:we("prompts.systemSelection.message"),guiOptions:{breadcrumb:!0,hint:we("prompts.systemSelection.hint")},source:(l,f)=>ww(f,s),choices:u?[s[o]]:s,default:()=>u?0:(o=KTe(s,t?.systemSelection?.defaultChoice),typeof t?.systemSelection?.connectPath=="object"&&(a=t?.systemSelection.connectPath),o),validate:async l=>{if(!l)return!1;let f=l;return t?.systemSelection?.useAutoComplete&&l.value&&(f=l.value),X$t(f,e,n,r,a?.value)??!1},additionalMessages:async l=>{if(l.type==="backendSystem"&&e.systemAuthType==="basic"&&await e.isAuthRequired())return{message:we("prompts.systemSelection.authenticationFailedUpdateCredentials"),severity:ZTe.Severity.information};if(e.ignoreCertError)return{message:we("warnings.certErrorIgnoredByNodeSetting"),severity:ZTe.Severity.warning}}}];if(jr()){let l={when:f=>{let p=f?.[wn.systemSelection];return p?.type==="destination"?zl(p.system):!1},type:"input",name:K$t.destinationServicePath,message:we("prompts.destinationServicePath.message"),guiOptions:{hint:we("prompts.destinationServicePath.hint"),mandatory:!0,breadcrumb:!0,applyDefaultWhenDirty:!0},default:"",validate:async(f,p)=>{if(!f||f.trim().length<2||f.startsWith("//"))return e.resetConnectionState(!0),we("prompts.destinationServicePath.invalidServicePathWarning");let d=p?.[wn.systemSelection]?.system,h=k$t(d.Host,f);return h!==!0?(e.resetConnectionState(!0),h):await XM(d,e,n,f)}};c.push(l)}return Bo()===un.cli&&!t?.systemSelection?.useAutoComplete&&c.push({when:async l=>{let f=l?.[wn.systemSelection];if(!f)return!1;let p=await X$t(f,e,n,void 0,a?.value);if(p!==!0)throw at.logger.error(p.toString),new Error(p.toString());return!1},name:`${K$t.systemSelectionCli}`}),c.push(...s7(e,f7,void 0,n)),c}var oQn=require("@sap-devx/yeoman-ui-types");var tbe;(function(e){e.ignoreCertError="ignoreCertError",e.username="username",e.cliIgnoreCertValidate="cliIgnoreCertValidate"})(tbe||(tbe={}));var uQn=require("@sap-devx/yeoman-ui-types");async function J$t(e,t,r){return t!==void 0&&(gt.isYUI=t),r&&(at.logger=r),{prompts:await ebe(e),answers:gt.odataService}}var F8t=Te(Oy()),DO=Te(Py()),fbe=require("node:fs"),U8t=require("node:fs/promises"),k8t=require("node:module"),x7=require("node:path");var QM=Te(N8t());var I8t=["DraftAdministrativeData","SiblingEntity"],L8t=["I_DraftAdministrativeData"];function OQn(e,t){for(let r of Object.keys(t))if(e[r]){let n=new Set(e[r].map(i=>JSON.stringify(i)));for(let i of t[r]){let s=JSON.stringify(i);n.has(s)||(n.add(s),e[r].push(i))}}else e[r]=t[r];return e}function pbe(e,t,r,n,i=""){let s={},o=Array.isArray(e)?e:[e],a={};return o.forEach(u=>{for(let l of Object.keys(u)){let f=i?`${i}/${l}`:l,p=t[f]??t[l];if(!p||!u[l])continue;let d=pbe(u[l],t,p,void 0,f);OQn(s,d),delete u[l]}a[r]||(a[r]=new Set((s[r]??[]).map(l=>JSON.stringify(l))));let c=JSON.stringify(u);a[r].has(c)||(a[r].add(c),s[r]?s[r].push(u):s[r]=[u])}),n?.length&&(DQn(s,n),RQn(s,n)),s}var CQn=/^[0-9A-F]{32}$/,M8t=/^0\d+$/;function PQn(e){let t=e.toLowerCase();return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function DQn(e,t){for(let r of t){let n=r.nodeProperty.split("/");for(let i of Object.values(e))for(let s of i){let o=s,a;if(n.length>1?a=o[n[0]]?.[n[1]]:a=o[n[0]],typeof a=="string"){if(r.parentPropertyType&&["Edm.Guid","Edm.UUID"].includes(r.parentPropertyType)&&CQn.test(a)){let u=PQn(a);n.length>1?o[n[0]][n[1]]=u:o[n[0]]=u}else if(r.parentProperty&&M8t.test(a)){let u=Number.parseInt(a,10).toString();n.length>1?o[n[0]][n[1]]=u:o[n[0]]=u;let c=o[r.parentProperty];typeof c=="string"&&M8t.test(c)&&(o[r.parentProperty]=Number.parseInt(c,10).toString())}}}}}function RQn(e,t){for(let r of t){let n=r.nodeProperty.split("/");for(let i of Object.values(e))for(let s of i){let o=s;if(!r.parentProperty||!(r.parentProperty in o))continue;(n.length>1?o[n[0]]?.DistanceFromRoot:o.DistanceFromRoot)===0&&(o[r.parentProperty]="")}}}async function B8t(e,t){let r=await gS({logger:cr.logger,entityName:"system"});return typeof t=="number"&&(t=String(t)),(await r.read(new la({url:e,client:t})))?.name??"NewSystemChoice"}function NQn(e){let t=[],r=new Set(["DraftUUID","IsActiveEntity"]),n=e.keys.filter(i=>!r.has(i.name));if(e?.annotations.Common?.SemanticKey){e.annotations.Common.SemanticKey.forEach((o,a)=>{let u=o.value,l=n.some(f=>f.name===u)?void 0:n[a]?.name;l&&cr.logger.debug(`Semantic key '${u}' mapped to actual entity key '${l}'`),t.push({name:u,keyName:l,type:o.$target?.type??"Edm.String",value:void 0})});let s=new Set(t.map(o=>o.name));e.keys.filter(o=>r.has(o.name)&&!s.has(o.name)).forEach(o=>{t.push({name:o.name,type:o.type,value:o.name==="IsActiveEntity"?"true":void 0})})}return t.length===0&&e.keys.forEach(i=>{t.push({name:i.name,type:i.type,value:i.name==="IsActiveEntity"?"true":void 0})}),t}function IQn(e,t){return e.find(r=>r.entityTypeName===t)}function q8t(e,t,r,n=4){let i=[];return--n>0&&e.navigationProperties.forEach(s=>{if(!I8t.includes(s.name)){let o=[];s.targetType.navigationProperties.length>0&&n>0&&(o=q8t(s.targetType,t,r,n)),i.push({entityType:s.targetType,entityPath:s.name,entitySetName:t.entitySets.find(a=>a.entityTypeName===s.targetTypeName)?.name??"Unknown",navPropEntities:[...o]})}}),i}function LQn(e,t,r){let n=r?(0,x7.join)(r,`${e}.js`):void 0;if(!n||!(0,fbe.existsSync)(n))return;let s=(0,k8t.createRequire)(__filename)(n).getReferentialConstraints?.({name:t,referentialConstraint:[]})??[];return cr.logger.debug(`getHierarchyEntities: '${e}' loaded constraints from existing file: ${JSON.stringify(s)}`),s[0]?.sourceProperty}function MQn(e,t,r,n){if(r)return{parentProperty:t?.$target?.referentialConstraint?.[0]?.sourceProperty,missingReferentialConstraints:void 0};let i=t?.value;if(!i)return{parentProperty:void 0,missingReferentialConstraints:void 0};let s=LQn(e,i,n);return s?{parentProperty:s,missingReferentialConstraints:void 0}:(cr.logger.debug(`getHierarchyEntities: '${e}' nav prop '${i}' has no referentialConstraint in metadata \u2014 will prompt user`),{parentProperty:void 0,missingReferentialConstraints:{navPropName:i,constraints:[]}})}function FQn(e,t){let r=[];for(let n of e.entitySets){let i=n.entityType?.annotations?.Aggregation,s=Object.keys(i??{}).find(d=>d.startsWith("RecursiveHierarchy"));if(!s)continue;let o=i[s],a=o.NodeProperty?.value;if(!a)continue;cr.logger.debug(`Number of hierarchy annotations entity type: ${n.entityType.name} - ${Object.keys(i).filter(d=>d.startsWith("RecursiveHierarchy")).length}`);let u=s.split("#")[1]??"",c=o.ParentNavigationProperty,l=(c?.$target?.referentialConstraint?.length??0)>0,{parentProperty:f,missingReferentialConstraints:p}=MQn(n.name,c,l,t);r.push({entitySetName:n.name,entityTypeName:n.entityType.fullyQualifiedName,qualifier:u,nodeProperty:a,parentProperty:f,parentPropertyType:f?n.entityType.entityProperties.find(d=>d.name===f)?.type??"Edm.String":void 0,isDraft:!!(n.annotations?.Common?.DraftRoot??n.annotations?.Common?.DraftNode),entityTypeKeys:n.entityType.keys.map(d=>d.name),entityProperties:n.entityType.entityProperties.map(d=>d.name),missingReferentialConstraints:p})}return r.length&&cr.logger.debug(`Hierarchy entities found: ${r.map(n=>n.entitySetName).join(", ")}`),r}async function j8t(e,t,r){let n,i=e.app.services.mainService;try{if(i.local){let s=(i.annotations??[]).map(f=>f.local).filter(f=>!!f&&(0,fbe.existsSync)(f)),a=(await Promise.all(s.map(f=>(0,U8t.readFile)(f,"utf-8")))).map((f,p)=>(0,DO.parse)(f,s[p])),u=a.length>0?(0,DO.merge)((0,DO.parse)(r),...a):(0,DO.parse)(r),c=(0,F8t.convert)(u),l=await t.readApp({app:e});if(l.applicationModel&&l.applicationModel?.target?.fioriElements==QM.FioriElementsVersion.v4){let p=l.applicationModel.pages,d,h=[];if(Object.values(p).forEach(A=>{if(A.pageType===QM.PageTypeV4.ListReport&&A.entityType&&A.entitySet){if(d=c.entityTypes.find(w=>w.fullyQualifiedName===A.entityType),d){let w=NQn(d);n={listEntity:{entitySetName:A.entitySet,semanticKeys:w,entityPath:A.entitySet,entityType:d}},n.listEntity.navPropEntities=q8t(d,c)}}else if(A.pageType===QM.PageTypeV4.ObjectPage&&A.entityType&&A.entitySet&&A.entitySet&&A.entityType&&A.entityType!==d?.fullyQualifiedName){let w=IQn(c.entitySets,A.entityType),x={entityPath:A.navigationProperty,entitySetName:A.entitySet,entityType:w?.entityType,page:A};h.push(x)}}),!n?.listEntity)return cr.logger.info(Nt("info.noListEntityDefined")),Nt("info.noListEntityDefined");n.pageObjectEntities=h;let g=e.getAppRoot(),S=(await Ax(g))?.services?.find(A=>A.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===i.uri?.replaceAll(/(^\/)|(\/$)/g,"")),b=(0,x7.join)(g,S?.mockdataPath??(0,x7.join)(oi.Webapp,oi.LocalService,oi.Mockdata));n.hierarchyEntities=FQn(c,b)}}return n}catch(s){let o=Nt("errors.entityModelLoading",{error:s});return cr.logger.error(o),o}}function V8t(e,t){let r=JSON.stringify(t,null,4).replaceAll(`
724
724
  `,`
725
725
  `);return["module.exports = {"," // See: https://github.com/SAP/open-ux-odata/blob/main/docs/MockserverAPI.md#getreferentialconstraints"," getReferentialConstraints: function (navigationProperty) {",` if (navigationProperty.name === "${e}") {`,` return ${r};`," }"," return undefined;"," }","};",""].join(`
726
726
  `)}function $8t(e,t,r){if(e.includes(`"${t}"`)||e.includes(`'${t}'`))return e;let n=JSON.stringify(r,null,4).replaceAll(`
@@ -730,7 +730,7 @@ specVersion: "2.5"`);return s.setMetadata({name:e}),s.setType("application"),s.a
730
730
  ${i}`);let s=[" getReferentialConstraints: function (navigationProperty) {",`${i}`," return undefined;"," }"].join(`
731
731
  `),o=e.lastIndexOf(`
732
732
  };`);return o!==-1?`${e.slice(0,o)},
733
- ${s}${e.slice(o)}`:e}var Z8t=require("node:fs/promises"),e4t=require("node:path");var H8t=require("node:crypto"),W8t=Te(F8());var G8t={name:"@sap-ux/generator-odata-downloader",displayName:"Fiori Elements Data Downloader",description:"Yeoman generator that supports download of app data, typically for mock data server use.",version:"0.3.14",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/generator-odata-downloader"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aodata-download"},license:"Apache-2.0",main:"generators/app/index.js",keywords:["yeoman-generator"],scripts:{build:"npm-run-all clean bundle:prod",compile:"tsc --build",clean:"rimraf --glob generators prebuilds test/test-output coverage *.tsbuildinfo",watch:"tsc --watch",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",bundle:"node esbuild.mjs","bundle:dev":"pnpm clean && node esbuild.mjs --development && pnpm pack","bundle:prod":"node esbuild.mjs --production"},files:["LICENSE","generators","!generators/*.map","!generators/**/*.map","prebuilds","yeoman.png"],devDependencies:{"@jest/globals":"30.3.0"},dependencies:{"@sap-devx/yeoman-ui-types":"1.25.0","@sap-ux/annotation-converter":"0.10.21","@sap-ux/axios-extension":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/edmx-parser":"0.10.0","@sap-ux/fiori-generator-shared":"workspace:*","@sap-ux/inquirer-common":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/mockserver-config-writer":"workspace:*","@sap-ux/odata-service-inquirer":"workspace:*","@sap-ux/odata-service-writer":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/store":"workspace:*","@sap-ux/telemetry":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/vocabularies-types":"0.15.0","@sap/ux-specification":"1.144.0","@types/inquirer":"8.2.6","@types/yeoman-generator":"5.2.14","@vscode-logging/logger":"2.0.9",deepmerge:"4.3.1",i18next:"25.10.10",inquirer:"8.2.7","odata-query":"8.0.5","os-name":"4.0.1","prettify-xml":"1.2.0",rimraf:"6.1.3","yeoman-generator":"5.10.0"},engines:{node:">=22.x"}};var kQn="@sap-ux/odata-download-sub-generator",BQn="0a65e45d-6bf4-421d-b845-61e888c50e9e",ya=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(t){this._sessionId=(0,H8t.randomUUID)(),cr.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:kQn,version:G8t.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:BQn,...t};try{await bL(r)}catch(n){cr.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(t){if(!this._telemetryData){let r=Nt("telemetry.unknownOs");try{r=(0,W8t.default)()}catch{}this._telemetryData={Platform:jr()?"SBAS":"VSCode",OperatingSystem:r,SessionId:this._sessionId}}return this._telemetryData=Object.assign(this._telemetryData,t),this._telemetryData}static prepareTelemetryEvent(t,r){return{eventName:t,properties:r,measurements:{}}}static async sendTelemetry(t,r){let n=this.createTelemetryData(r),i=this.prepareTelemetryEvent(t,n);await nc.getTelemetryClient().reportEvent(i,Ci.NoSampling)}};var qQn=["eq","ne","gt","ge","lt","le"],w7=["and","or","not"],jQn=["any","all"],VQn=["startswith","endswith","contains","matchespattern"],$Qn=["expand","levels","select","skip","top","count","orderby","filter"],Y8t=/\((.*)\)/,z8t=/(?!indexof)\((\w+)\)/;var im="";function hbe({select:e,search:t,skiptoken:r,format:n,top:i,skip:s,filter:o,transform:a,orderBy:u,key:c,count:l,expand:f,action:p,func:d}={}){let h="",g=[],v={};if(c!=null&&(h+=`(${od(c,g)})`),(o||typeof l=="object")&&(v.$filter=C7(typeof l=="object"?l:o,g)),a&&(v.$apply=X8t(a)),f&&(v.$expand=O7(f)),u&&(v.$orderby=mbe(u)),l&&(typeof l=="boolean"?v.$count=!0:h+="/$count"),typeof i=="number"&&(v.$top=i),typeof s=="number"&&(v.$skip=s),p&&(h+=`/${p}`),d){if(typeof d=="string")h+=`/${d}`;else if(typeof d=="object"){let[S]=Object.keys(d),b=od(d[S],g);h+=`/${S}`,b!==""&&(h+=`(${b})`)}}return g.length>0&&Object.assign(v,g.reduce((S,b)=>Object.assign(S,{[`@${b.name}`]:od(b.value)}),{})),zQn(h,{$select:e,$search:t,$skiptoken:r,$format:n,...v})}function dbe(e,t,r=[]){return`${e} eq ${od(t,r)}`}function C7(e={},t=[],r=""){return(Array.isArray(e)?e:[e]).reduce((s,o)=>{if(o){let a=n(o,t,r);a&&s.push(a)}return s},[]).join(" and ");function n(s={},o=[],a=""){let u="";return typeof s=="string"?u=s:s&&typeof s=="object"&&(u=Object.keys(s).reduce((c,l)=>{let f=s[l];if(f===void 0)return c;let p="";if(a?l===im?p=a:z8t.test(l)?p=l.replace(z8t,(d,h)=>h.trim()===im?`(${a})`:`(${a}/${h.trim()})`):Y8t.test(l)?p=l.replace(Y8t,(d,h)=>h.trim()===im?`(${a})`:`(${a}/${h.trim()})`):p=`${a}/${l}`:p=l,l===im&&Array.isArray(f))return c.concat(f.map(d=>dbe(p,d)));if(["number","string","boolean"].indexOf(typeof f)!==-1||f instanceof Date||f===null)c.push(dbe(p,f,o));else if(Array.isArray(f)){let d=l,h=f.map(g=>C7(g,o,a)).filter(g=>g).map(g=>w7.indexOf(d)!==-1?`(${g})`:g);h.length&&(w7.indexOf(d)!==-1?h.length&&(d==="not"?c.push(K8t(h)):c.push(`(${h.join(` ${d} `)})`)):c.push(h.join(` ${d} `)))}else if(w7.indexOf(p)!==-1){let d=p,h=Object.keys(f).map(g=>n({[g]:f[g]}));h.length&&(d==="not"?c.push(K8t(h)):c.push(`(${h.join(` ${d} `)})`))}else if(typeof f=="object")"type"in f?c.push(dbe(p,f,o)):Object.keys(f).forEach(d=>{if(f[d]!==void 0)if(qQn.indexOf(d)!==-1)c.push(`${p} ${d} ${od(f[d],o)}`);else if(w7.indexOf(d)!==-1)Array.isArray(f[d])?c.push(f[d].map(h=>"("+n(h,o,p)+")").join(` ${d} `)):c.push("("+n(f[d],o,p)+")");else if(jQn.indexOf(d)!==-1){let h=i(l.toLowerCase(),f[d],d,p);h&&c.push(h)}else if(d==="has")c.push(`${p} ${d} ${od(f[d],o)}`);else if(d==="in"){let h=Array.isArray(f[d])?f[d]:f[d].value.map(g=>({type:f[d].type,value:g}));c.push(p+" in ("+h.map(g=>od(g,o)).join(",")+")")}else if(VQn.indexOf(d)!==-1)c.push(`${d}(${p},${od(f[d],o)})`);else{let h=n({[d]:f[d]},o,p);h&&c.push(h)}});else throw new Error(`Unexpected value type: ${f}`);return c},[]).join(" and ")),u}function i(s,o,a,u){let c="";if(typeof o=="string"||o instanceof String)c=GQn(s,o,a,u);else if(o){let l=Array.isArray(o)?o.reduce((p,d)=>d.hasOwnProperty(im)?(p.hasOwnProperty(im)||(p[im]=[]),p[im].push(d[im]),p):{...p,...d},{}):o,f=n(l,t,s);c=`${u}/${a}(${f?`${s}:${f}`:""})`}return c}}function GQn(e,t,r,n){let i=r=="all"?"ne":"eq";return`${n}/${r}(${e}: ${e} ${i} '${t}')`}function HQn(e){return e=e.replace(/%/g,"%25"),e=e.replace(/\+/g,"%2B"),e=e.replace(/\//g,"%2F"),e=e.replace(/\?/g,"%3F"),e=e.replace(/#/g,"%23"),e=e.replace(/&/g,"%26"),e=e.replace(/'/g,"''"),e}function od(e,t){if(typeof e=="string")return`'${HQn(e)}'`;if(e instanceof Date)return e.toISOString();if(typeof e=="number")return e;if(Array.isArray(e))return`[${e.map(r=>od(r)).join(",")}]`;if(e===null)return e;if(typeof e=="object")switch(e.type){case"raw":case"guid":return e.value;case"duration":return`duration'${e.value}'`;case"binary":return`binary'${e.value}'`;case"alias":return Array.isArray(t)&&t.push(e),`@${e.name}`;case"json":return escape(JSON.stringify(e.value));case"decimal":return`${e.value}M`;default:return Object.entries(e).filter(([,r])=>r!==void 0).map(([r,n])=>`${r}=${od(n,t)}`).join(",")}return e}function O7(e){if(typeof e=="number")return e;if(typeof e=="string")return e.indexOf("/")===-1?e:e.split("/").reverse().reduce((t,r,n,i)=>n===0?`$expand=${r}`:n===i.length-1?`${r}(${t})`:`$expand=${r}(${t})`,"");if(Array.isArray(e))return`${e.map(t=>O7(t)).join(",")}`;if(typeof e=="object"){let t=Object.keys(e);return t.some(r=>$Qn.indexOf(r.toLowerCase())!==-1)?t.map(r=>{let n;switch(r){case"filter":n=C7(e[r]);break;case"orderBy":n=mbe(e[r]);break;case"levels":case"count":case"skip":case"top":n=`${e[r]}`;break;default:n=O7(e[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):t.map(r=>{let n=O7(e[r]);return n?`${r}(${n})`:r}).join(",")}return""}function X8t(e){return(Array.isArray(e)?e:[e]).reduce((t,r)=>{for(let n of Object.keys(r))switch(n){case"aggregate":{let i=r[n];i&&t.push(`aggregate(${WQn(i)})`);break}case"filter":{let i=r[n];if(i){let s=C7(i);s&&t.push(`filter(${s})`)}break}case"groupBy":{let i=r[n];i&&t.push(`groupby(${YQn(i)})`);break}default:throw new Error(`Unsupported transform: ${n}`)}return t},[]).join("/")||void 0}function WQn(e){return(Array.isArray(e)?e:[e]).map(t=>typeof t=="string"?t:Object.keys(t).map(r=>{let n=t[r];if(!n.with&&n.as)return`${r} as ${n.as}`;if(!n.with)throw new Error(`'with' property required for '${r}'`);if(!n.as)throw new Error(`'as' property required for '${r}'`);return`${r} with ${n.with} as ${n.as}`})).join(",")}function YQn(e){if(!e.properties)throw new Error("'properties' property required for groupBy");let t=`(${e.properties.join(",")})`;return e.transform&&(t+=`,${X8t(e.transform)}`),t}function mbe(e,t=""){return Array.isArray(e)?e.map(r=>Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r).map(r=>`${t}${String(r)}`).join(","):typeof e=="object"?Object.entries(e).map(([r,n])=>mbe(n,`${r}/`)).map(r=>`${t}${r}`).join(","):`${t}${String(e)}`}function zQn(e,t){let r=Object.getOwnPropertyNames(t).filter(n=>t[n]!==void 0&&t[n]!=="").map(n=>`${n}=${t[n]}`);return r.length?`${e}?${r.join("&")}`:e}function K8t(e){return`not (${e.join(" and ")})`}function KQn(e){let t=[];return{expands:e.reduce((n,{entityPath:i})=>{let s=i.split("/"),o=n;return s.forEach((a,u)=>{o.expand||(o.expand={}),o.expand[a]??=u===s.length-1?{}:{expand:{}},o=o.expand[a],t.includes(a)||t.push(a)}),n},{expand:{}}),entityPathParts:t}}function XQn(e,t,r=1,n){let i=t?.map(d=>({entityPath:d.fullPath,entitySetName:d.entity.entitySetName})),{expands:s,entityPathParts:o}=KQn(i),a=o.map(d=>t.find(g=>d===g.entity.entityPath?g.entity.entitySetName:void 0)?.entity.entitySetName).filter(d=>d!==void 0);cr.logger.info(Nt("info.entityFilesToBeGenerated",{entities:a.join(", ")}));let u=e;if(n){let d=[];u.semanticKeys.forEach(x=>{if(x.value!==void 0&&x.value!=="")if(x.type==="Edm.Boolean")d.push(`${x.name} eq ${x.value}`);else{let N=String(x.value).split(","),F=["Edm.UUID","Edm.Guid"].includes(x.type),D=V=>F?V.trim():`'${V.trim()}'`;if(N.length===1)d.push(`${x.name} eq ${D(N[0])}`);else{let V=N.map(z=>`${x.name} eq ${D(z)}`);d.push(`(${V.join(" or ")})`)}}});let h=d.length>0?`,filter(${d.join(" and ")})`:"",g=`$root/${u.entitySetName},${n.qualifier},${n.nodeProperty}`,v=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/${u.entitySetName},HierarchyQualifier='${n.qualifier}',NodeProperty='${n.nodeProperty}')`,S=n.isDraft?`$apply=ancestors(${g}${h},keep start)/${v}`:`$apply=${v}`,b=s?hbe(s):"",A=b?`&${b.substring(1)}`:"",w=`${u.entitySetName}?${S}${A}`;return cr.logger.debug(`Query for odata: ${w}`),{query:w}}let c=[];u.semanticKeys.forEach(d=>{if(d.value!==void 0&&d.value!=="")if(["Edm.UUID","Edm.Guid"].includes(d.type)){let g=String(d.value).split(",").map(v=>({[d.name]:{type:"guid",value:v.trim()}}));c.push(g.length===1?g[0]:{or:g})}else if(d.type==="Edm.Boolean")c.push({[d.name]:String(d.value)==="true"});else if(d.type==="Edm.String"){let h=String(d.value).split(","),g=[];h.forEach(v=>{let S=v.trim().split("-");S.length===1?g.push({[d.name]:v.trim()}):S.length===2&&g.push({[d.name]:{ge:S[0].trim(),le:S[1].trim()}})}),c.push(g.length==1?g[0]:{or:g})}else c.push({[d.name]:d.value})});let l={};s&&Object.assign(l,s),c.length>0?Object.assign(l,{filter:c.length===1?c[0]:c,count:!0}):r&&Object.assign(l,{top:r});let f=hbe(l),p=`${u.entitySetName}${f}`;return cr.logger.debug(`Query for odata: ${p}`),{query:p}}function JQn(e,t,r){let n=new Set(["DraftUUID","IsActiveEntity"]),i=[];for(let f of e.semanticKeys){if(f.value===void 0||f.value===""||n.has(f.name))continue;let p=f.keyName??f.name,d=String(f.value).split(",")[0].trim(),h=["Edm.UUID","Edm.Guid"].includes(f.type),g=f.type==="Edm.Boolean";i.push(`${p}=${h||g?d:`'${d}'`}`)}if(i.length===0){cr.logger.debug(`buildNavPropHierarchyQuery: no key values available for '${e.entitySetName}', skipping nav-prop hierarchy query for '${t}'`);return}let s={DraftUUID:"00000000-0000-0000-0000-000000000000",IsActiveEntity:"true"};e.entityType?.keys?.filter(f=>f.name in s).forEach(f=>i.push(`${f.name}=${s[f.name]}`)),cr.logger.debug(`buildNavPropHierarchyQuery: key segment for '${e.entitySetName}': (${i.join(",")})`);let a=`${`${e.entitySetName}(${i.join(",")})`}/${t}`,c=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=${`$root/${a}`},HierarchyQualifier='${r.qualifier}',NodeProperty='${r.nodeProperty}')`,l=`${a}?$apply=${c}`;return cr.logger.debug(`Nav-prop hierarchy query: ${l}`),l}async function Q8t(e,t,r,n,i,s=[]){let o=XQn(e,r,n,i),a=await J8t(t,o.query);for(let u of s){let c=r.find(v=>v.entity.entitySetName===u.entitySetName);if(!c){cr.logger.debug(`fetchData: no selected entity matched hierarchy entity '${u.entitySetName}', skipping`);continue}let l=JQn(e,c.entity.entityPath,u);if(!l){cr.logger.debug(`fetchData: could not build nav-prop hierarchy query for '${u.entitySetName}', skipping`);continue}let f=await J8t(t,l);if(!f.entityData||!a.entityData){cr.logger.debug(`fetchData: no data returned for nav-prop hierarchy query '${u.entitySetName}', skipping merge`);continue}cr.logger.debug(`fetchData: merging ${f.entityData.length} hierarchy records into '${c.entity.entityPath}' expanded items`);let p=c.entity.entityPath,d=u.nodeProperty.split("/")[0],h=f.entityData,g=0;for(let v of a.entityData){let S=v[p];if(Array.isArray(S))for(let b of S){let A=h.find(w=>u.entityTypeKeys.every(x=>w[x]===b[x]));A&&(b[d]=A[d],g++)}}cr.logger.debug(`fetchData: patched '${d}' onto ${g} expanded '${p}' records`)}return{odataResult:a}}async function J8t(e,t){try{cr.logger.info(`OData query request: ${encodeURI(e.defaults.baseURL+t).replaceAll("'","%27")}`),cr.logger.debug(`OData query request headers: ${JSON.stringify(e.defaults.headers)}`);let r=await e.get(t),n=r?.data?.match(/"@odata\.count":(\d+)/)?.[1];return cr.logger.info(`OData query records count: ${n}`),{entityData:r?.odata()}}catch(r){let n=Nt("errors.odataQueryError",{error:r});return cr.logger.error(n),{error:n}}}var xu=class e{static externalServiceRequestCache={};static entityTypeRefFacetCache={};static resetExternalServiceCache(t){if(t){delete e.externalServiceRequestCache[t];return}e.externalServiceRequestCache={}}static resetRefFacetCache(){e.entityTypeRefFacetCache={}}static resetServiceCaches(){e.resetExternalServiceCache(),e.resetRefFacetCache()}};async function t4t(e,t,r){if(e.metadata&&t.appAccess&&e.connectedSystem&&e.servicePath&&t.appAccess&&t.referencedEntities){e.connectedSystem.serviceProvider.log=cr.logger;let n=e.connectedSystem?.serviceProvider.service(e.servicePath);if(n){let i=Date.now();ya.sendTelemetry("ODATA_DOWNLOAD_SEND_QUERY",{time:Date()});let s=t.referencedEntities.hierarchyEntities?.find(u=>u.entitySetName===t.referencedEntities.listEntity.entitySetName),o=t.referencedEntities.hierarchyEntities?.filter(u=>u.entitySetName!==t.referencedEntities.listEntity.entitySetName&&r.some(c=>c.entity.entitySetName===u.entitySetName))??[],{odataResult:a}=await Q8t(t.referencedEntities.listEntity,n,r,s?void 0:1,s,o);if(a.entityData)return ya.sendTelemetry("ODATA_DOWNLOAD_RECEIVED_QUERY_RESULT",{duration:`${Date.now()-i} ms`,resultSize:`${a.entityData.length} rows`}),cr.logger.debug(`Got result rows: ${a.entityData.length}`),{odataQueryResult:a.entityData};if(a.error)return ya.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return Nt("errors.dataNotFetched")}function r4t(e){let t=[];return e.Facets.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target.type==="AnnotationPath"){let n=r.Target.value;n.lastIndexOf("/")>-1&&t.push(n.substring(0,n.lastIndexOf("/")))}else r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&t.push(...r4t(r))}),t}function QQn(e){if(xu.entityTypeRefFacetCache[e.name])return xu.entityTypeRefFacetCache[e.name];let t=[];return e.annotations?.UI?.Facets?.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target?.type==="AnnotationPath"){let n=r.Target.value;n?.lastIndexOf("/")>-1&&t.push(n.substring(0,n.lastIndexOf("/")))}r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&t.push(...r4t(r))}),xu.entityTypeRefFacetCache[e.name]=t,t??[]}function n4t(e,t="",r=[],n,i){let s={},o=e.navPropEntities;if(o&&o.length>0){let a=e.entityType?QQn(e.entityType):[];for(let u of o){let c=u.entityPath,l=i??e;if(u.entityType?.name===l?.entityType?.name||t.includes(c))continue;let f=t.concat(`${t?"/":""}${c}`);u.navPropEntities&&u.navPropEntities.length>0&&Object.assign(s,n4t(u,f,r,n,i??e).entitySetsFlat);let p={fullPath:f,entity:{entityPath:u.entityPath,entitySetName:u.entitySetName,defaultSelected:a.includes(u.entityPath)||!!n?.includes(f)}},d=`${f}`;r||(r=[]),r.push({name:d,value:p,checked:p.entity.defaultSelected}),s[f]=u.entitySetName}}return{entitySetsFlat:s,choices:r}}function i4t(e,t){let r=t?.map(n=>{let i=n.page?.contextPath??n.page?.routePattern?.replace(":?query:","").replaceAll(/\(\{[^}]*\}\)/g,"");return i?.startsWith(`/${e.entityPath}/`)?i.replace(`/${e.entityPath}/`,""):i}).filter(n=>n!==void 0);if(e.navPropEntities){let n=n4t(e,void 0,void 0,r);return n.choices.sort((i,s)=>(i.name??"").localeCompare(s.name??"")),n}}async function s4t(e,t){let n=(await Co.newInstance(await(0,Z8t.readFile)((0,e4t.join)(e,vt.Ui5Yaml),"utf-8"))).getBackendConfigsFromFioriToolsProxyMiddleware()[0],i;if(n){let s=n.url;if(n.connectPath){let o=n.connectPath.startsWith("/")?n.connectPath:`/${n.connectPath}`;s=new URL(o,n.url).href}i=jr()?n?.destination:await B8t(s,n?.client)}return{servicePath:t.uri,systemName:i}}async function o4t(e){let t=await fL(e.app.appRoot),r=t.getApiVersion(),n=typeof r?.version=="string"?Number.parseInt(r.version,10):0;return n<24?(cr.logger.debug(`@sap/ux-specification from module cache API version is: ${n}. API version '24' at least is required.`),Nt("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):t}var a4t,ZQn=(...e)=>new Promise(t=>{clearTimeout(a4t),a4t=setTimeout(async()=>t(await t4t(...e)),1e3)}),Ol={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},eZn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,u4t=["."];async function c4t(e,t,r){let n=!1;if(!r.referencedEntities?.listEntity.semanticKeys.every((a,u)=>(a.name!=="IsActiveEntity"&&!n&&(n=!!a.value),a.value!==void 0&&a.value!==""||!e[`entityKeyIdx:${u}`]))||!n)return Nt("prompts.skipDataDownload.validation.keyRequired");let s=[];r.relatedEntityChoices?.choices?.length&&(s=e[Ol.relatedEntitySelection]);let o=await ZQn(t,r,s);return o}function tZn(e){return xu.resetServiceCaches(),e.appAccess=void 0,e.referencedEntities=void 0,e.servicePath=void 0,e.systemName&&(e.systemName.value=void 0),e.relatedEntityChoices.choices=[],e.relatedEntityChoices.entitySetsFlat={},e}async function l4t(e){let t=[],r={appAccess:void 0,referencedEntities:void 0,servicePath:void 0,systemName:{value:void 0},connectPath:{value:void 0},relatedEntityChoices:{choices:[],entitySetsFlat:{}}},n=[],i=rZn(r,n,e?.appPath),s=await J$t({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:zn.v4}},Uc()!==un.cli,cr.logger);s.prompts=Ps(s.prompts,()=>!!r.appAccess);let o={odata:[]},a=iZn(r,r.relatedEntityChoices),u=sZn(5,r,s.answers,o),c=nZn(r.relatedEntityChoices,s.answers,r,o);return t.push(i,...s.prompts,aZn(s.answers,r),oZn(s.answers,r),...u,a,c),{questions:t,answers:{application:r,odataQueryResult:o,odataServiceAnswers:s.answers}}}function rZn(e,t,r){return{type:"input",guiType:"folder-browser",name:Ol.appSelection,message:Nt("prompts.appSelection.message"),default:n=>r??n.appSelection??e.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:Nt("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===e.appAccess?.app.appRoot)return!0;t.length=0,tZn(e);let i;try{i=await X5(n)}catch(c){let l=c;return c instanceof Error&&(l=c.message),cr.logger.error(Nt("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${Nt("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${Nt("texts.seeLogForDetails")}`}let s=i.app.services[i.app.mainService??"mainService"];if(!s?.odataVersion?.startsWith("4."))return Nt("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:s.odataVersion});let o=await o4t(i);if(typeof o=="string")return o;e.appAccess=i,e.specification=o;let{servicePath:a,systemName:u}=await s4t(i.app.appRoot,s);return a&&(e.servicePath=a,t.push(a)),e.systemName&&(e.systemName.value=u),e.connectPath&&(e.connectPath.value=a),!0}}}function nZn(e,t,r,n){let i;return{when:async s=>e.choices.length>0,name:Ol.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:Nt("prompts.relatedEntitySelection.message"),choices:()=>e.choices,validate:async(s,o)=>{if(e.choices.forEach(a=>{a.disabled||(a.checked=s.some(u=>u.fullPath===a.value.fullPath))}),o&&!o[Ol.skipDataDownload]?.[0]){if(i=await c4t(o,t,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:Nt("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:gbe.Severity.information}},showOutputTabLink:()=>({show:!!i,linkMessage:Nt("prompts.relatedEntitySelection.openLogs")})}}function iZn(e,t){let r,n,i;return{when:()=>{if((n!==e.systemName?.value||e.servicePath!==r)&&e.referencedEntities?.listEntity){let o=i4t(e.referencedEntities.listEntity,e.referencedEntities.pageObjectEntities);o&&(t.choices=o.choices,Object.assign(t.entitySetsFlat,o.entitySetsFlat)),r=e.servicePath,n=e.systemName?.value}return t.choices.length>0},name:Ol.toggleSelection,type:"confirm",message:Nt("prompts.toggleSelection.message"),labelTrue:Nt("prompts.toggleSelection.labelTrue"),labelFalse:Nt("prompts.toggleSelection.labelFalse"),default:!1,validate:o=>(o!==i&&(t.choices.forEach(a=>{if(a.disabled)return;let u=a.value;a.checked=o===!1?u.entity.defaultSelected:!1}),i=o),!0)}}function sZn(e,t,r,n){let i=[],s,o=0,a=u=>({when:async()=>{let c=t.referencedEntities?.listEntity.semanticKeys[u],l=!!c?.name&&c.name!=="IsActiveEntity";return l&&u>o&&(o=u),l},name:`entityKeyIdx:${u}`,message:()=>Nt("prompts.entityKey.message",{keyName:`${t.referencedEntities?.listEntity.semanticKeys[u]?.name} (${t.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:Nt("prompts.entityKey.hint")},validate:async(c,l)=>{let f=t.referencedEntities?.listEntity.semanticKeys[u];if(f&&delete f.value,u4t.includes(c))return Nt("prompts.entityKey.validation.invalidKeyValueChars",{chars:u4t.join()});if(c&&f)if(f.type==="Edm.Boolean")try{f.value=JSON.parse(c)}catch{return Nt("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(f.type)){let d=c.split(",");for(let h of d)if(!eZn.test(h.trim()))return Nt("prompts.entityKey.validation.invalidGuidValue");f.value=c.trim()}else f.value=c.trim();let p=c.split(",");if(f?.type&&!["Edm.UUID","Edm.Guid"].includes(f.type)){for(let d of p)if(d.split("-").length>2)return f&&delete f.value,Nt("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!t.relatedEntityChoices?.choices?.length&&u===o&&!l[Ol.skipDataDownload]?.[0]&&t.referencedEntities?.listEntity.semanticKeys[u]?.name){if(s=await c4t(l,r,t),typeof s=="string")return s;n.odata=s.odataQueryResult}return!0}});for(let u=0;u<e;u++)i.push(a(u));return i}function oZn(e,t){return{when:()=>!!e.metadata&&!!t.servicePath,name:Ol.skipDataDownload,type:"checkbox",message:Nt("prompts.skipDataDownload.message"),guiOptions:{hint:Nt("prompts.skipDataDownload.hint")},default:!1,choices:[{name:Nt("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function aZn(e,t){let r;return{when:async()=>t.appAccess&&t.specification&&e?.metadata?(r=await j8t(t.appAccess,t.specification,e.metadata),typeof r=="object"&&(t.referencedEntities=r),!0):!1,name:Ol.updateMainServiceMetadata,type:"confirm",message:Nt("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:gbe.Severity.error}}}}function f4t(e){let t=[],r=n=>[{name:`${n.entitySetName}/${n.nodeProperty}/source`,type:"list",message:`Source: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))},{name:`${n.entitySetName}/${n.nodeProperty}/target`,type:"list",message:`Target: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))}];return e.forEach(n=>{!n.parentProperty&&n.missingReferentialConstraints?.navPropName&&t.push(...r(n))}),t}var g4t=Te(Oy()),y4t=Te(Py());var E4t=Te(m4t()),_4t=require("node:path");function v4t(e,t,r){xu.resetExternalServiceCache();let n=bZn(e,t),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:Nt("prompts.valueHelpSelection.message"),choices:()=>n,validate:async o=>{if(!o||o.length===0)return xu.resetExternalServiceCache(),!0;let a=await TZn(o,r),u=(0,E4t.default)(i,a);return i.length=0,i.push(...u),await SZn(i,r),!0}}],valueHelpData:i}}async function SZn(e,t){let r=[],n={transformResponse:s=>typeof s=="string"?JSON.parse(s):s},i=e.map(async s=>{let o=s,[a]=o.path.split(";");xu.externalServiceRequestCache[a]??=[];let l=(0,g4t.convert)((0,y4t.parse)(s.metadata)).entitySets.map(async f=>{let p=f.name;if(xu.externalServiceRequestCache[a].includes(p))return;xu.externalServiceRequestCache[a].push(p);let d=await t.get((0,_4t.join)(o.path,p),n);o.entityData=o.entityData??[],o.entityData?.push({entitySetName:p,items:d.data.value})});await Promise.allSettled(l),o.entityData&&r.push(o)});return await Promise.allSettled(i),r}async function TZn(e,t){let r=e.flat();return await t.fetchExternalServices(r)}function bZn(e,t){let r=lM(e,t,[]),n={};for(let s of r)if(s.type==="value-list"){if(L8t.includes(s.target))continue;let[o]=s.value.split(";"),a=s.target.split("/").pop();a&&(n[o]??={},n[o][a]??=[],n[o][a].push(s))}else s.type==="code-list"&&(n[s.value]??={},n[s.value]["Code list"]??=[],n[s.value]["Code list"].push(s));let i=[];for(let s of Object.values(n))for(let[o,a]of Object.entries(s)){let u=a.map(c=>{if(c.type==="value-list")return c.target.replace(/\/[^/]*$/,"");if(c.type==="code-list"&&c.collectionPath)return c.collectionPath}).filter(c=>c!==void 0);i.push({name:`${o} (${u.join()})`,value:a})}return i.sort((s,o)=>s.name.localeCompare(o.name))}var cr=class e extends T4t.default{vscode;appWizard;static _logger=f4;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(t,r){super(t,{...r,skipInstall:!0},{unique:"namespace"}),p_e(this.env,!0),this.options.force=!0,this.prompts=new P7.Prompts([{description:Nt("steps.odataDownloader.description"),name:Nt("steps.odataDownloader.name")},{description:Nt("steps.valueHelpSelection.description"),name:Nt("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(Nt("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return e._logger}async initializing(){await _ve(),e._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await ya.initTelemetrySettings(),ya.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:t,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await l4t(this.options?.data),s=await this.prompt(i);if(this.state.entityOData=r.odata,this.state.entityPropertyToEntitySet=t.relatedEntityChoices.entitySetsFlat,this.state.appRootPath=t.appAccess?.getAppRoot(),this.state.mainServicePath=n.servicePath,this.state.mainServiceName=t.appAccess?.app.mainService,this.state.appEntities=t.referencedEntities,this.state.appRootPath){this.state.mockServerConfig=await Ax(this.state.appRootPath);let o;this.state.mockServerConfig?.services&&(e.logger.debug(`Mock config: ${JSON.stringify(this.state.mockServerConfig)}`),o=this.state.mockServerConfig.services.find(a=>a.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===this.state.mainServicePath?.replaceAll(/(^\/)|(\/$)/g,""))),this.state.mockDataRootPath=o?.mockdataPath??(0,ZS.join)(oi.Webapp,oi.LocalService,oi.Mockdata)}if(this.state.updateMainServiceMetadata=s[Ol.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,s[Ol.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(t,s),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof ja){let{questions:o,valueHelpData:a}=v4t(n.servicePath,n.metadata,n.connectedSystem?.serviceProvider);await this.prompt(o),this.state.valueHelpData=a}}catch(t){e.logger.error(t),this._exitOnError(t)}}async writing(){if(this.state.appRootPath){if(this.state.entityOData&&this.state.entityPropertyToEntitySet&&this.state.appEntities)try{let t=Date.now();ya.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,ZS.join)(this.state.appRootPath));let r=pbe(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);e.logger.info(Nt("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,s])=>{this.writeDestinationJSON((0,ZS.join)(this.state.mockDataRootPath,`${i}.json`),s)}),this.state.appEntities.hierarchyEntities?.filter(i=>i.missingReferentialConstraints&&n.some(([s])=>s===i.entitySetName))?.forEach(i=>{let s=(0,ZS.join)(this.state.mockDataRootPath,`${i.entitySetName}.js`),o=this.destinationPath(s),{navPropName:a,constraints:u}=i.missingReferentialConstraints;if(this.fs.exists(o)){let c=this.fs.read(o),l=$8t(c,a,u);l!==c?(this.writeDestination(s,l),e.logger.info(`Updated referential constraint file: ${i.entitySetName}.js`)):e.logger.debug(`Referential constraint for '${a}' already present in ${i.entitySetName}.js \u2014 skipping`)}else{let c=V8t(a,u);this.writeDestination(s,c),e.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),ya.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-t} ms`,numberOfFiles:`${n.length}`})}catch(t){e.logger.error(t),ya.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else e.logger.info(Nt("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let t=Date.now();ya.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,ZS.join)(this.state.appRootPath,oi.Webapp);if(await I4(this.fs,r,this.state.valueHelpData,this.state.mainServiceName,this.state.mainServicePath),this.state.mockServerConfig){let n={webappPath:r,packageJsonConfig:{skip:!0},ui5MockYamlConfig:{overwrite:!0}};n.ui5MockYamlConfig&&this.state.mainServiceName&&(n.ui5MockYamlConfig.resolveExternalServiceReferences={[this.state.mainServiceName]:!0},await d4(this.state.appRootPath,n,this.fs))}ya.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_DATA_FILES_END",{writeFileDuration:`${Date.now()-t} ms`,numberOfExternalServices:`${this.state.valueHelpData.length}`})}catch(t){e.logger.error(t),ya.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else e.logger.info(Nt("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let t=(0,ZS.join)(this.state.appRootPath,oi.Webapp,oi.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(t,(0,S4t.default)(this.state.mainServiceMetadata,{indent:4}))}}}async _promptMissingReferentialConstraints(t,r){let n=t.referencedEntities?.listEntity.entitySetName,i=new Set([...n?[n]:[],...(r[Ol.relatedEntitySelection]??[]).map(o=>o.entity.entitySetName)]),s=t.referencedEntities?.hierarchyEntities?.filter(o=>!o.parentProperty&&o.missingReferentialConstraints&&i.has(o.entitySetName))??[];if(s.length>0){this.prompts.splice(1,0,[{name:Nt("steps.addConstraints.name"),description:Nt("steps.addConstraints.description")}]);let o=f4t(s),a=await this.prompt(o),u=[t.referencedEntities?.listEntity,...t.referencedEntities?.pageObjectEntities??[]];s.forEach(c=>{let l=a[`${c.entitySetName}/${c.nodeProperty}/source`],f=a[`${c.entitySetName}/${c.nodeProperty}/target`];if(l&&f){c.missingReferentialConstraints.constraints=[{sourceProperty:l,targetProperty:f}],c.parentProperty=l;let p=u.find(d=>d?.entitySetName===c.entitySetName)?.entityType;c.parentPropertyType=p?.entityProperties.find(d=>d.name===l)?.type??"Edm.String"}})}}_exitOnError(t){throw Uc()!==un.cli&&this.appWizard?.showError(t,P7.MessageType.notification),new Error(t)}_configureLogging(t,r,n){let i=new l4(this.rootGeneratorName(),this.log,t,r,n);return i.info(Nt("info.loggingInitialised",{logLevel:i.getLogLevel()})),i}};
733
+ ${s}${e.slice(o)}`:e}var Z8t=require("node:fs/promises"),e4t=require("node:path");var H8t=require("node:crypto"),W8t=Te(F8());var G8t={name:"@sap-ux/generator-odata-downloader",displayName:"Fiori Elements Data Downloader",description:"Yeoman generator that supports download of app data, typically for mock data server use.",version:"0.3.16",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/generator-odata-downloader"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aodata-download"},license:"Apache-2.0",main:"generators/app/index.js",keywords:["yeoman-generator"],scripts:{build:"npm-run-all clean bundle:prod",compile:"tsc --build",clean:"rimraf --glob generators prebuilds test/test-output coverage *.tsbuildinfo",watch:"tsc --watch",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",bundle:"node esbuild.mjs","bundle:dev":"pnpm clean && node esbuild.mjs --development && pnpm pack","bundle:prod":"node esbuild.mjs --production"},files:["LICENSE","generators","!generators/*.map","!generators/**/*.map","prebuilds","yeoman.png"],devDependencies:{"@jest/globals":"30.3.0"},dependencies:{"@sap-devx/yeoman-ui-types":"1.25.0","@sap-ux/annotation-converter":"0.10.21","@sap-ux/axios-extension":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/edmx-parser":"0.10.0","@sap-ux/fiori-generator-shared":"workspace:*","@sap-ux/inquirer-common":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/mockserver-config-writer":"workspace:*","@sap-ux/odata-service-inquirer":"workspace:*","@sap-ux/odata-service-writer":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/store":"workspace:*","@sap-ux/telemetry":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/vocabularies-types":"0.15.0","@sap/ux-specification":"1.144.0","@types/inquirer":"8.2.6","@types/yeoman-generator":"5.2.14","@vscode-logging/logger":"2.0.9",deepmerge:"4.3.1",i18next:"25.10.10",inquirer:"8.2.7","odata-query":"8.0.5","os-name":"4.0.1","prettify-xml":"1.2.0",rimraf:"6.1.3","yeoman-generator":"5.10.0"},engines:{node:">=22.x"}};var kQn="@sap-ux/odata-download-sub-generator",BQn="0a65e45d-6bf4-421d-b845-61e888c50e9e",ya=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(t){this._sessionId=(0,H8t.randomUUID)(),cr.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:kQn,version:G8t.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:BQn,...t};try{await bL(r)}catch(n){cr.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(t){if(!this._telemetryData){let r=Nt("telemetry.unknownOs");try{r=(0,W8t.default)()}catch{}this._telemetryData={Platform:jr()?"SBAS":"VSCode",OperatingSystem:r,SessionId:this._sessionId}}return this._telemetryData=Object.assign(this._telemetryData,t),this._telemetryData}static prepareTelemetryEvent(t,r){return{eventName:t,properties:r,measurements:{}}}static async sendTelemetry(t,r){let n=this.createTelemetryData(r),i=this.prepareTelemetryEvent(t,n);await nc.getTelemetryClient().reportEvent(i,Ci.NoSampling)}};var qQn=["eq","ne","gt","ge","lt","le"],w7=["and","or","not"],jQn=["any","all"],VQn=["startswith","endswith","contains","matchespattern"],$Qn=["expand","levels","select","skip","top","count","orderby","filter"],Y8t=/\((.*)\)/,z8t=/(?!indexof)\((\w+)\)/;var im="";function hbe({select:e,search:t,skiptoken:r,format:n,top:i,skip:s,filter:o,transform:a,orderBy:u,key:c,count:l,expand:f,action:p,func:d}={}){let h="",g=[],v={};if(c!=null&&(h+=`(${od(c,g)})`),(o||typeof l=="object")&&(v.$filter=C7(typeof l=="object"?l:o,g)),a&&(v.$apply=X8t(a)),f&&(v.$expand=O7(f)),u&&(v.$orderby=mbe(u)),l&&(typeof l=="boolean"?v.$count=!0:h+="/$count"),typeof i=="number"&&(v.$top=i),typeof s=="number"&&(v.$skip=s),p&&(h+=`/${p}`),d){if(typeof d=="string")h+=`/${d}`;else if(typeof d=="object"){let[S]=Object.keys(d),b=od(d[S],g);h+=`/${S}`,b!==""&&(h+=`(${b})`)}}return g.length>0&&Object.assign(v,g.reduce((S,b)=>Object.assign(S,{[`@${b.name}`]:od(b.value)}),{})),zQn(h,{$select:e,$search:t,$skiptoken:r,$format:n,...v})}function dbe(e,t,r=[]){return`${e} eq ${od(t,r)}`}function C7(e={},t=[],r=""){return(Array.isArray(e)?e:[e]).reduce((s,o)=>{if(o){let a=n(o,t,r);a&&s.push(a)}return s},[]).join(" and ");function n(s={},o=[],a=""){let u="";return typeof s=="string"?u=s:s&&typeof s=="object"&&(u=Object.keys(s).reduce((c,l)=>{let f=s[l];if(f===void 0)return c;let p="";if(a?l===im?p=a:z8t.test(l)?p=l.replace(z8t,(d,h)=>h.trim()===im?`(${a})`:`(${a}/${h.trim()})`):Y8t.test(l)?p=l.replace(Y8t,(d,h)=>h.trim()===im?`(${a})`:`(${a}/${h.trim()})`):p=`${a}/${l}`:p=l,l===im&&Array.isArray(f))return c.concat(f.map(d=>dbe(p,d)));if(["number","string","boolean"].indexOf(typeof f)!==-1||f instanceof Date||f===null)c.push(dbe(p,f,o));else if(Array.isArray(f)){let d=l,h=f.map(g=>C7(g,o,a)).filter(g=>g).map(g=>w7.indexOf(d)!==-1?`(${g})`:g);h.length&&(w7.indexOf(d)!==-1?h.length&&(d==="not"?c.push(K8t(h)):c.push(`(${h.join(` ${d} `)})`)):c.push(h.join(` ${d} `)))}else if(w7.indexOf(p)!==-1){let d=p,h=Object.keys(f).map(g=>n({[g]:f[g]}));h.length&&(d==="not"?c.push(K8t(h)):c.push(`(${h.join(` ${d} `)})`))}else if(typeof f=="object")"type"in f?c.push(dbe(p,f,o)):Object.keys(f).forEach(d=>{if(f[d]!==void 0)if(qQn.indexOf(d)!==-1)c.push(`${p} ${d} ${od(f[d],o)}`);else if(w7.indexOf(d)!==-1)Array.isArray(f[d])?c.push(f[d].map(h=>"("+n(h,o,p)+")").join(` ${d} `)):c.push("("+n(f[d],o,p)+")");else if(jQn.indexOf(d)!==-1){let h=i(l.toLowerCase(),f[d],d,p);h&&c.push(h)}else if(d==="has")c.push(`${p} ${d} ${od(f[d],o)}`);else if(d==="in"){let h=Array.isArray(f[d])?f[d]:f[d].value.map(g=>({type:f[d].type,value:g}));c.push(p+" in ("+h.map(g=>od(g,o)).join(",")+")")}else if(VQn.indexOf(d)!==-1)c.push(`${d}(${p},${od(f[d],o)})`);else{let h=n({[d]:f[d]},o,p);h&&c.push(h)}});else throw new Error(`Unexpected value type: ${f}`);return c},[]).join(" and ")),u}function i(s,o,a,u){let c="";if(typeof o=="string"||o instanceof String)c=GQn(s,o,a,u);else if(o){let l=Array.isArray(o)?o.reduce((p,d)=>d.hasOwnProperty(im)?(p.hasOwnProperty(im)||(p[im]=[]),p[im].push(d[im]),p):{...p,...d},{}):o,f=n(l,t,s);c=`${u}/${a}(${f?`${s}:${f}`:""})`}return c}}function GQn(e,t,r,n){let i=r=="all"?"ne":"eq";return`${n}/${r}(${e}: ${e} ${i} '${t}')`}function HQn(e){return e=e.replace(/%/g,"%25"),e=e.replace(/\+/g,"%2B"),e=e.replace(/\//g,"%2F"),e=e.replace(/\?/g,"%3F"),e=e.replace(/#/g,"%23"),e=e.replace(/&/g,"%26"),e=e.replace(/'/g,"''"),e}function od(e,t){if(typeof e=="string")return`'${HQn(e)}'`;if(e instanceof Date)return e.toISOString();if(typeof e=="number")return e;if(Array.isArray(e))return`[${e.map(r=>od(r)).join(",")}]`;if(e===null)return e;if(typeof e=="object")switch(e.type){case"raw":case"guid":return e.value;case"duration":return`duration'${e.value}'`;case"binary":return`binary'${e.value}'`;case"alias":return Array.isArray(t)&&t.push(e),`@${e.name}`;case"json":return escape(JSON.stringify(e.value));case"decimal":return`${e.value}M`;default:return Object.entries(e).filter(([,r])=>r!==void 0).map(([r,n])=>`${r}=${od(n,t)}`).join(",")}return e}function O7(e){if(typeof e=="number")return e;if(typeof e=="string")return e.indexOf("/")===-1?e:e.split("/").reverse().reduce((t,r,n,i)=>n===0?`$expand=${r}`:n===i.length-1?`${r}(${t})`:`$expand=${r}(${t})`,"");if(Array.isArray(e))return`${e.map(t=>O7(t)).join(",")}`;if(typeof e=="object"){let t=Object.keys(e);return t.some(r=>$Qn.indexOf(r.toLowerCase())!==-1)?t.map(r=>{let n;switch(r){case"filter":n=C7(e[r]);break;case"orderBy":n=mbe(e[r]);break;case"levels":case"count":case"skip":case"top":n=`${e[r]}`;break;default:n=O7(e[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):t.map(r=>{let n=O7(e[r]);return n?`${r}(${n})`:r}).join(",")}return""}function X8t(e){return(Array.isArray(e)?e:[e]).reduce((t,r)=>{for(let n of Object.keys(r))switch(n){case"aggregate":{let i=r[n];i&&t.push(`aggregate(${WQn(i)})`);break}case"filter":{let i=r[n];if(i){let s=C7(i);s&&t.push(`filter(${s})`)}break}case"groupBy":{let i=r[n];i&&t.push(`groupby(${YQn(i)})`);break}default:throw new Error(`Unsupported transform: ${n}`)}return t},[]).join("/")||void 0}function WQn(e){return(Array.isArray(e)?e:[e]).map(t=>typeof t=="string"?t:Object.keys(t).map(r=>{let n=t[r];if(!n.with&&n.as)return`${r} as ${n.as}`;if(!n.with)throw new Error(`'with' property required for '${r}'`);if(!n.as)throw new Error(`'as' property required for '${r}'`);return`${r} with ${n.with} as ${n.as}`})).join(",")}function YQn(e){if(!e.properties)throw new Error("'properties' property required for groupBy");let t=`(${e.properties.join(",")})`;return e.transform&&(t+=`,${X8t(e.transform)}`),t}function mbe(e,t=""){return Array.isArray(e)?e.map(r=>Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r).map(r=>`${t}${String(r)}`).join(","):typeof e=="object"?Object.entries(e).map(([r,n])=>mbe(n,`${r}/`)).map(r=>`${t}${r}`).join(","):`${t}${String(e)}`}function zQn(e,t){let r=Object.getOwnPropertyNames(t).filter(n=>t[n]!==void 0&&t[n]!=="").map(n=>`${n}=${t[n]}`);return r.length?`${e}?${r.join("&")}`:e}function K8t(e){return`not (${e.join(" and ")})`}function KQn(e){let t=[];return{expands:e.reduce((n,{entityPath:i})=>{let s=i.split("/"),o=n;return s.forEach((a,u)=>{o.expand||(o.expand={}),o.expand[a]??=u===s.length-1?{}:{expand:{}},o=o.expand[a],t.includes(a)||t.push(a)}),n},{expand:{}}),entityPathParts:t}}function XQn(e,t,r=1,n){let i=t?.map(d=>({entityPath:d.fullPath,entitySetName:d.entity.entitySetName})),{expands:s,entityPathParts:o}=KQn(i),a=o.map(d=>t.find(g=>d===g.entity.entityPath?g.entity.entitySetName:void 0)?.entity.entitySetName).filter(d=>d!==void 0);cr.logger.info(Nt("info.entityFilesToBeGenerated",{entities:a.join(", ")}));let u=e;if(n){let d=[];u.semanticKeys.forEach(x=>{if(x.value!==void 0&&x.value!=="")if(x.type==="Edm.Boolean")d.push(`${x.name} eq ${x.value}`);else{let N=String(x.value).split(","),F=["Edm.UUID","Edm.Guid"].includes(x.type),D=V=>F?V.trim():`'${V.trim()}'`;if(N.length===1)d.push(`${x.name} eq ${D(N[0])}`);else{let V=N.map(z=>`${x.name} eq ${D(z)}`);d.push(`(${V.join(" or ")})`)}}});let h=d.length>0?`,filter(${d.join(" and ")})`:"",g=`$root/${u.entitySetName},${n.qualifier},${n.nodeProperty}`,v=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/${u.entitySetName},HierarchyQualifier='${n.qualifier}',NodeProperty='${n.nodeProperty}')`,S=n.isDraft?`$apply=ancestors(${g}${h},keep start)/${v}`:`$apply=${v}`,b=s?hbe(s):"",A=b?`&${b.substring(1)}`:"",w=`${u.entitySetName}?${S}${A}`;return cr.logger.debug(`Query for odata: ${w}`),{query:w}}let c=[];u.semanticKeys.forEach(d=>{if(d.value!==void 0&&d.value!=="")if(["Edm.UUID","Edm.Guid"].includes(d.type)){let g=String(d.value).split(",").map(v=>({[d.name]:{type:"guid",value:v.trim()}}));c.push(g.length===1?g[0]:{or:g})}else if(d.type==="Edm.Boolean")c.push({[d.name]:String(d.value)==="true"});else if(d.type==="Edm.String"){let h=String(d.value).split(","),g=[];h.forEach(v=>{let S=v.trim().split("-");S.length===1?g.push({[d.name]:v.trim()}):S.length===2&&g.push({[d.name]:{ge:S[0].trim(),le:S[1].trim()}})}),c.push(g.length==1?g[0]:{or:g})}else c.push({[d.name]:d.value})});let l={};s&&Object.assign(l,s),c.length>0?Object.assign(l,{filter:c.length===1?c[0]:c,count:!0}):r&&Object.assign(l,{top:r});let f=hbe(l),p=`${u.entitySetName}${f}`;return cr.logger.debug(`Query for odata: ${p}`),{query:p}}function JQn(e,t,r){let n=new Set(["DraftUUID","IsActiveEntity"]),i=[];for(let f of e.semanticKeys){if(f.value===void 0||f.value===""||n.has(f.name))continue;let p=f.keyName??f.name,d=String(f.value).split(",")[0].trim(),h=["Edm.UUID","Edm.Guid"].includes(f.type),g=f.type==="Edm.Boolean";i.push(`${p}=${h||g?d:`'${d}'`}`)}if(i.length===0){cr.logger.debug(`buildNavPropHierarchyQuery: no key values available for '${e.entitySetName}', skipping nav-prop hierarchy query for '${t}'`);return}let s={DraftUUID:"00000000-0000-0000-0000-000000000000",IsActiveEntity:"true"};e.entityType?.keys?.filter(f=>f.name in s).forEach(f=>i.push(`${f.name}=${s[f.name]}`)),cr.logger.debug(`buildNavPropHierarchyQuery: key segment for '${e.entitySetName}': (${i.join(",")})`);let a=`${`${e.entitySetName}(${i.join(",")})`}/${t}`,c=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=${`$root/${a}`},HierarchyQualifier='${r.qualifier}',NodeProperty='${r.nodeProperty}')`,l=`${a}?$apply=${c}`;return cr.logger.debug(`Nav-prop hierarchy query: ${l}`),l}async function Q8t(e,t,r,n,i,s=[]){let o=XQn(e,r,n,i),a=await J8t(t,o.query);for(let u of s){let c=r.find(v=>v.entity.entitySetName===u.entitySetName);if(!c){cr.logger.debug(`fetchData: no selected entity matched hierarchy entity '${u.entitySetName}', skipping`);continue}let l=JQn(e,c.entity.entityPath,u);if(!l){cr.logger.debug(`fetchData: could not build nav-prop hierarchy query for '${u.entitySetName}', skipping`);continue}let f=await J8t(t,l);if(!f.entityData||!a.entityData){cr.logger.debug(`fetchData: no data returned for nav-prop hierarchy query '${u.entitySetName}', skipping merge`);continue}cr.logger.debug(`fetchData: merging ${f.entityData.length} hierarchy records into '${c.entity.entityPath}' expanded items`);let p=c.entity.entityPath,d=u.nodeProperty.split("/")[0],h=f.entityData,g=0;for(let v of a.entityData){let S=v[p];if(Array.isArray(S))for(let b of S){let A=h.find(w=>u.entityTypeKeys.every(x=>w[x]===b[x]));A&&(b[d]=A[d],g++)}}cr.logger.debug(`fetchData: patched '${d}' onto ${g} expanded '${p}' records`)}return{odataResult:a}}async function J8t(e,t){try{cr.logger.info(`OData query request: ${encodeURI(e.defaults.baseURL+t).replaceAll("'","%27")}`),cr.logger.debug(`OData query request headers: ${JSON.stringify(e.defaults.headers)}`);let r=await e.get(t),n=r?.data?.match(/"@odata\.count":(\d+)/)?.[1];return cr.logger.info(`OData query records count: ${n}`),{entityData:r?.odata()}}catch(r){let n=Nt("errors.odataQueryError",{error:r});return cr.logger.error(n),{error:n}}}var xu=class e{static externalServiceRequestCache={};static entityTypeRefFacetCache={};static resetExternalServiceCache(t){if(t){delete e.externalServiceRequestCache[t];return}e.externalServiceRequestCache={}}static resetRefFacetCache(){e.entityTypeRefFacetCache={}}static resetServiceCaches(){e.resetExternalServiceCache(),e.resetRefFacetCache()}};async function t4t(e,t,r){if(e.metadata&&t.appAccess&&e.connectedSystem&&e.servicePath&&t.appAccess&&t.referencedEntities){e.connectedSystem.serviceProvider.log=cr.logger;let n=e.connectedSystem?.serviceProvider.service(e.servicePath);if(n){let i=Date.now();ya.sendTelemetry("ODATA_DOWNLOAD_SEND_QUERY",{time:Date()});let s=t.referencedEntities.hierarchyEntities?.find(u=>u.entitySetName===t.referencedEntities.listEntity.entitySetName),o=t.referencedEntities.hierarchyEntities?.filter(u=>u.entitySetName!==t.referencedEntities.listEntity.entitySetName&&r.some(c=>c.entity.entitySetName===u.entitySetName))??[],{odataResult:a}=await Q8t(t.referencedEntities.listEntity,n,r,s?void 0:1,s,o);if(a.entityData)return ya.sendTelemetry("ODATA_DOWNLOAD_RECEIVED_QUERY_RESULT",{duration:`${Date.now()-i} ms`,resultSize:`${a.entityData.length} rows`}),cr.logger.debug(`Got result rows: ${a.entityData.length}`),{odataQueryResult:a.entityData};if(a.error)return ya.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return Nt("errors.dataNotFetched")}function r4t(e){let t=[];return e.Facets.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target.type==="AnnotationPath"){let n=r.Target.value;n.lastIndexOf("/")>-1&&t.push(n.substring(0,n.lastIndexOf("/")))}else r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&t.push(...r4t(r))}),t}function QQn(e){if(xu.entityTypeRefFacetCache[e.name])return xu.entityTypeRefFacetCache[e.name];let t=[];return e.annotations?.UI?.Facets?.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target?.type==="AnnotationPath"){let n=r.Target.value;n?.lastIndexOf("/")>-1&&t.push(n.substring(0,n.lastIndexOf("/")))}r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&t.push(...r4t(r))}),xu.entityTypeRefFacetCache[e.name]=t,t??[]}function n4t(e,t="",r=[],n,i){let s={},o=e.navPropEntities;if(o&&o.length>0){let a=e.entityType?QQn(e.entityType):[];for(let u of o){let c=u.entityPath,l=i??e;if(u.entityType?.name===l?.entityType?.name||t.includes(c))continue;let f=t.concat(`${t?"/":""}${c}`);u.navPropEntities&&u.navPropEntities.length>0&&Object.assign(s,n4t(u,f,r,n,i??e).entitySetsFlat);let p={fullPath:f,entity:{entityPath:u.entityPath,entitySetName:u.entitySetName,defaultSelected:a.includes(u.entityPath)||!!n?.includes(f)}},d=`${f}`;r||(r=[]),r.push({name:d,value:p,checked:p.entity.defaultSelected}),s[f]=u.entitySetName}}return{entitySetsFlat:s,choices:r}}function i4t(e,t){let r=t?.map(n=>{let i=n.page?.contextPath??n.page?.routePattern?.replace(":?query:","").replaceAll(/\(\{[^}]*\}\)/g,"");return i?.startsWith(`/${e.entityPath}/`)?i.replace(`/${e.entityPath}/`,""):i}).filter(n=>n!==void 0);if(e.navPropEntities){let n=n4t(e,void 0,void 0,r);return n.choices.sort((i,s)=>(i.name??"").localeCompare(s.name??"")),n}}async function s4t(e,t){let n=(await Co.newInstance(await(0,Z8t.readFile)((0,e4t.join)(e,vt.Ui5Yaml),"utf-8"))).getBackendConfigsFromFioriToolsProxyMiddleware()[0],i;if(n){let s=n.url;if(n.connectPath){let o=n.connectPath.startsWith("/")?n.connectPath:`/${n.connectPath}`;s=new URL(o,n.url).href}i=jr()?n?.destination:await B8t(s,n?.client)}return{servicePath:t.uri,systemName:i}}async function o4t(e){let t=await fL(e.app.appRoot),r=t.getApiVersion(),n=typeof r?.version=="string"?Number.parseInt(r.version,10):0;return n<24?(cr.logger.debug(`@sap/ux-specification from module cache API version is: ${n}. API version '24' at least is required.`),Nt("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):t}var a4t,ZQn=(...e)=>new Promise(t=>{clearTimeout(a4t),a4t=setTimeout(async()=>t(await t4t(...e)),1e3)}),Ol={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},eZn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,u4t=["."];async function c4t(e,t,r){let n=!1;if(!r.referencedEntities?.listEntity.semanticKeys.every((a,u)=>(a.name!=="IsActiveEntity"&&!n&&(n=!!a.value),a.value!==void 0&&a.value!==""||!e[`entityKeyIdx:${u}`]))||!n)return Nt("prompts.skipDataDownload.validation.keyRequired");let s=[];r.relatedEntityChoices?.choices?.length&&(s=e[Ol.relatedEntitySelection]);let o=await ZQn(t,r,s);return o}function tZn(e){return xu.resetServiceCaches(),e.appAccess=void 0,e.referencedEntities=void 0,e.servicePath=void 0,e.systemName&&(e.systemName.value=void 0),e.relatedEntityChoices.choices=[],e.relatedEntityChoices.entitySetsFlat={},e}async function l4t(e){let t=[],r={appAccess:void 0,referencedEntities:void 0,servicePath:void 0,systemName:{value:void 0},connectPath:{value:void 0},relatedEntityChoices:{choices:[],entitySetsFlat:{}}},n=[],i=rZn(r,n,e?.appPath),s=await J$t({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:zn.v4}},Uc()!==un.cli,cr.logger);s.prompts=Ps(s.prompts,()=>!!r.appAccess);let o={odata:[]},a=iZn(r,r.relatedEntityChoices),u=sZn(5,r,s.answers,o),c=nZn(r.relatedEntityChoices,s.answers,r,o);return t.push(i,...s.prompts,aZn(s.answers,r),oZn(s.answers,r),...u,a,c),{questions:t,answers:{application:r,odataQueryResult:o,odataServiceAnswers:s.answers}}}function rZn(e,t,r){return{type:"input",guiType:"folder-browser",name:Ol.appSelection,message:Nt("prompts.appSelection.message"),default:n=>r??n.appSelection??e.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:Nt("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===e.appAccess?.app.appRoot)return!0;t.length=0,tZn(e);let i;try{i=await X5(n)}catch(c){let l=c;return c instanceof Error&&(l=c.message),cr.logger.error(Nt("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${Nt("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${Nt("texts.seeLogForDetails")}`}let s=i.app.services[i.app.mainService??"mainService"];if(!s?.odataVersion?.startsWith("4."))return Nt("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:s.odataVersion});let o=await o4t(i);if(typeof o=="string")return o;e.appAccess=i,e.specification=o;let{servicePath:a,systemName:u}=await s4t(i.app.appRoot,s);return a&&(e.servicePath=a,t.push(a)),e.systemName&&(e.systemName.value=u),e.connectPath&&(e.connectPath.value=a),!0}}}function nZn(e,t,r,n){let i;return{when:async s=>e.choices.length>0,name:Ol.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:Nt("prompts.relatedEntitySelection.message"),choices:()=>e.choices,validate:async(s,o)=>{if(e.choices.forEach(a=>{a.disabled||(a.checked=s.some(u=>u.fullPath===a.value.fullPath))}),o&&!o[Ol.skipDataDownload]?.[0]){if(i=await c4t(o,t,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:Nt("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:gbe.Severity.information}},showOutputTabLink:()=>({show:!!i,linkMessage:Nt("prompts.relatedEntitySelection.openLogs")})}}function iZn(e,t){let r,n,i;return{when:()=>{if((n!==e.systemName?.value||e.servicePath!==r)&&e.referencedEntities?.listEntity){let o=i4t(e.referencedEntities.listEntity,e.referencedEntities.pageObjectEntities);o&&(t.choices=o.choices,Object.assign(t.entitySetsFlat,o.entitySetsFlat)),r=e.servicePath,n=e.systemName?.value}return t.choices.length>0},name:Ol.toggleSelection,type:"confirm",message:Nt("prompts.toggleSelection.message"),labelTrue:Nt("prompts.toggleSelection.labelTrue"),labelFalse:Nt("prompts.toggleSelection.labelFalse"),default:!1,validate:o=>(o!==i&&(t.choices.forEach(a=>{if(a.disabled)return;let u=a.value;a.checked=o===!1?u.entity.defaultSelected:!1}),i=o),!0)}}function sZn(e,t,r,n){let i=[],s,o=0,a=u=>({when:async()=>{let c=t.referencedEntities?.listEntity.semanticKeys[u],l=!!c?.name&&c.name!=="IsActiveEntity";return l&&u>o&&(o=u),l},name:`entityKeyIdx:${u}`,message:()=>Nt("prompts.entityKey.message",{keyName:`${t.referencedEntities?.listEntity.semanticKeys[u]?.name} (${t.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:Nt("prompts.entityKey.hint")},validate:async(c,l)=>{let f=t.referencedEntities?.listEntity.semanticKeys[u];if(f&&delete f.value,u4t.includes(c))return Nt("prompts.entityKey.validation.invalidKeyValueChars",{chars:u4t.join()});if(c&&f)if(f.type==="Edm.Boolean")try{f.value=JSON.parse(c)}catch{return Nt("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(f.type)){let d=c.split(",");for(let h of d)if(!eZn.test(h.trim()))return Nt("prompts.entityKey.validation.invalidGuidValue");f.value=c.trim()}else f.value=c.trim();let p=c.split(",");if(f?.type&&!["Edm.UUID","Edm.Guid"].includes(f.type)){for(let d of p)if(d.split("-").length>2)return f&&delete f.value,Nt("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!t.relatedEntityChoices?.choices?.length&&u===o&&!l[Ol.skipDataDownload]?.[0]&&t.referencedEntities?.listEntity.semanticKeys[u]?.name){if(s=await c4t(l,r,t),typeof s=="string")return s;n.odata=s.odataQueryResult}return!0}});for(let u=0;u<e;u++)i.push(a(u));return i}function oZn(e,t){return{when:()=>!!e.metadata&&!!t.servicePath,name:Ol.skipDataDownload,type:"checkbox",message:Nt("prompts.skipDataDownload.message"),guiOptions:{hint:Nt("prompts.skipDataDownload.hint")},default:!1,choices:[{name:Nt("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function aZn(e,t){let r;return{when:async()=>t.appAccess&&t.specification&&e?.metadata?(r=await j8t(t.appAccess,t.specification,e.metadata),typeof r=="object"&&(t.referencedEntities=r),!0):!1,name:Ol.updateMainServiceMetadata,type:"confirm",message:Nt("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:gbe.Severity.error}}}}function f4t(e){let t=[],r=n=>[{name:`${n.entitySetName}/${n.nodeProperty}/source`,type:"list",message:`Source: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))},{name:`${n.entitySetName}/${n.nodeProperty}/target`,type:"list",message:`Target: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))}];return e.forEach(n=>{!n.parentProperty&&n.missingReferentialConstraints?.navPropName&&t.push(...r(n))}),t}var g4t=Te(Oy()),y4t=Te(Py());var E4t=Te(m4t()),_4t=require("node:path");function v4t(e,t,r){xu.resetExternalServiceCache();let n=bZn(e,t),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:Nt("prompts.valueHelpSelection.message"),choices:()=>n,validate:async o=>{if(!o||o.length===0)return xu.resetExternalServiceCache(),!0;let a=await TZn(o,r),u=(0,E4t.default)(i,a);return i.length=0,i.push(...u),await SZn(i,r),!0}}],valueHelpData:i}}async function SZn(e,t){let r=[],n={transformResponse:s=>typeof s=="string"?JSON.parse(s):s},i=e.map(async s=>{let o=s,[a]=o.path.split(";");xu.externalServiceRequestCache[a]??=[];let l=(0,g4t.convert)((0,y4t.parse)(s.metadata)).entitySets.map(async f=>{let p=f.name;if(xu.externalServiceRequestCache[a].includes(p))return;xu.externalServiceRequestCache[a].push(p);let d=await t.get((0,_4t.join)(o.path,p),n);o.entityData=o.entityData??[],o.entityData?.push({entitySetName:p,items:d.data.value})});await Promise.allSettled(l),o.entityData&&r.push(o)});return await Promise.allSettled(i),r}async function TZn(e,t){let r=e.flat();return await t.fetchExternalServices(r)}function bZn(e,t){let r=lM(e,t,[]),n={};for(let s of r)if(s.type==="value-list"){if(L8t.includes(s.target))continue;let[o]=s.value.split(";"),a=s.target.split("/").pop();a&&(n[o]??={},n[o][a]??=[],n[o][a].push(s))}else s.type==="code-list"&&(n[s.value]??={},n[s.value]["Code list"]??=[],n[s.value]["Code list"].push(s));let i=[];for(let s of Object.values(n))for(let[o,a]of Object.entries(s)){let u=a.map(c=>{if(c.type==="value-list")return c.target.replace(/\/[^/]*$/,"");if(c.type==="code-list"&&c.collectionPath)return c.collectionPath}).filter(c=>c!==void 0);i.push({name:`${o} (${u.join()})`,value:a})}return i.sort((s,o)=>s.name.localeCompare(o.name))}var cr=class e extends T4t.default{vscode;appWizard;static _logger=f4;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(t,r){super(t,{...r,skipInstall:!0},{unique:"namespace"}),p_e(this.env,!0),this.options.force=!0,this.prompts=new P7.Prompts([{description:Nt("steps.odataDownloader.description"),name:Nt("steps.odataDownloader.name")},{description:Nt("steps.valueHelpSelection.description"),name:Nt("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(Nt("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return e._logger}async initializing(){await _ve(),e._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await ya.initTelemetrySettings(),ya.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:t,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await l4t(this.options?.data),s=await this.prompt(i);if(this.state.entityOData=r.odata,this.state.entityPropertyToEntitySet=t.relatedEntityChoices.entitySetsFlat,this.state.appRootPath=t.appAccess?.getAppRoot(),this.state.mainServicePath=n.servicePath,this.state.mainServiceName=t.appAccess?.app.mainService,this.state.appEntities=t.referencedEntities,this.state.appRootPath){this.state.mockServerConfig=await Ax(this.state.appRootPath);let o;this.state.mockServerConfig?.services&&(e.logger.debug(`Mock config: ${JSON.stringify(this.state.mockServerConfig)}`),o=this.state.mockServerConfig.services.find(a=>a.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===this.state.mainServicePath?.replaceAll(/(^\/)|(\/$)/g,""))),this.state.mockDataRootPath=o?.mockdataPath??(0,ZS.join)(oi.Webapp,oi.LocalService,oi.Mockdata)}if(this.state.updateMainServiceMetadata=s[Ol.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,s[Ol.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(t,s),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof ja){let{questions:o,valueHelpData:a}=v4t(n.servicePath,n.metadata,n.connectedSystem?.serviceProvider);await this.prompt(o),this.state.valueHelpData=a}}catch(t){e.logger.error(t),this._exitOnError(t)}}async writing(){if(this.state.appRootPath){if(this.state.entityOData&&this.state.entityPropertyToEntitySet&&this.state.appEntities)try{let t=Date.now();ya.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,ZS.join)(this.state.appRootPath));let r=pbe(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);e.logger.info(Nt("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,s])=>{this.writeDestinationJSON((0,ZS.join)(this.state.mockDataRootPath,`${i}.json`),s)}),this.state.appEntities.hierarchyEntities?.filter(i=>i.missingReferentialConstraints&&n.some(([s])=>s===i.entitySetName))?.forEach(i=>{let s=(0,ZS.join)(this.state.mockDataRootPath,`${i.entitySetName}.js`),o=this.destinationPath(s),{navPropName:a,constraints:u}=i.missingReferentialConstraints;if(this.fs.exists(o)){let c=this.fs.read(o),l=$8t(c,a,u);l!==c?(this.writeDestination(s,l),e.logger.info(`Updated referential constraint file: ${i.entitySetName}.js`)):e.logger.debug(`Referential constraint for '${a}' already present in ${i.entitySetName}.js \u2014 skipping`)}else{let c=V8t(a,u);this.writeDestination(s,c),e.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),ya.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-t} ms`,numberOfFiles:`${n.length}`})}catch(t){e.logger.error(t),ya.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else e.logger.info(Nt("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let t=Date.now();ya.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,ZS.join)(this.state.appRootPath,oi.Webapp);if(await I4(this.fs,r,this.state.valueHelpData,this.state.mainServiceName,this.state.mainServicePath),this.state.mockServerConfig){let n={webappPath:r,packageJsonConfig:{skip:!0},ui5MockYamlConfig:{overwrite:!0}};n.ui5MockYamlConfig&&this.state.mainServiceName&&(n.ui5MockYamlConfig.resolveExternalServiceReferences={[this.state.mainServiceName]:!0},await d4(this.state.appRootPath,n,this.fs))}ya.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_DATA_FILES_END",{writeFileDuration:`${Date.now()-t} ms`,numberOfExternalServices:`${this.state.valueHelpData.length}`})}catch(t){e.logger.error(t),ya.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else e.logger.info(Nt("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let t=(0,ZS.join)(this.state.appRootPath,oi.Webapp,oi.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(t,(0,S4t.default)(this.state.mainServiceMetadata,{indent:4}))}}}async _promptMissingReferentialConstraints(t,r){let n=t.referencedEntities?.listEntity.entitySetName,i=new Set([...n?[n]:[],...(r[Ol.relatedEntitySelection]??[]).map(o=>o.entity.entitySetName)]),s=t.referencedEntities?.hierarchyEntities?.filter(o=>!o.parentProperty&&o.missingReferentialConstraints&&i.has(o.entitySetName))??[];if(s.length>0){this.prompts.splice(1,0,[{name:Nt("steps.addConstraints.name"),description:Nt("steps.addConstraints.description")}]);let o=f4t(s),a=await this.prompt(o),u=[t.referencedEntities?.listEntity,...t.referencedEntities?.pageObjectEntities??[]];s.forEach(c=>{let l=a[`${c.entitySetName}/${c.nodeProperty}/source`],f=a[`${c.entitySetName}/${c.nodeProperty}/target`];if(l&&f){c.missingReferentialConstraints.constraints=[{sourceProperty:l,targetProperty:f}],c.parentProperty=l;let p=u.find(d=>d?.entitySetName===c.entitySetName)?.entityType;c.parentPropertyType=p?.entityProperties.find(d=>d.name===l)?.type??"Edm.String"}})}}_exitOnError(t){throw Uc()!==un.cli&&this.appWizard?.showError(t,P7.MessageType.notification),new Error(t)}_configureLogging(t,r,n){let i=new l4(this.rootGeneratorName(),this.log,t,r,n);return i.info(Nt("info.loggingInitialised",{logLevel:i.getLogLevel()})),i}};
734
734
  /*! Bundled license information:
735
735
 
736
736
  mime-db/index.js:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sap-ux/generator-odata-downloader",
3
3
  "displayName": "Fiori Elements Data Downloader",
4
4
  "description": "Yeoman generator that supports download of app data, typically for mock data server use.",
5
- "version": "0.3.14",
5
+ "version": "0.3.16",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -47,11 +47,11 @@
47
47
  "@sap-ux/axios-extension": "2.0.3",
48
48
  "@sap-ux/btp-utils": "2.0.2",
49
49
  "@sap-ux/fiori-generator-shared": "1.0.11",
50
- "@sap-ux/inquirer-common": "1.0.11",
50
+ "@sap-ux/inquirer-common": "1.0.12",
51
51
  "@sap-ux/logger": "1.0.1",
52
52
  "@sap-ux/mockserver-config-writer": "1.0.6",
53
- "@sap-ux/odata-service-inquirer": "3.0.11",
54
- "@sap-ux/odata-service-writer": "1.0.6",
53
+ "@sap-ux/odata-service-inquirer": "3.0.13",
54
+ "@sap-ux/odata-service-writer": "1.0.7",
55
55
  "@sap-ux/project-access": "2.1.2",
56
56
  "@sap-ux/store": "2.0.1",
57
57
  "@sap-ux/telemetry": "1.0.9",