/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/gherking@2.4.0/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.save=exports.process=exports.load=void 0;const tslib_1=require("tslib"),gherkin_io_1=require("gherkin-io"),DocumentProcessor_1=require("./DocumentProcessor"),debug_1=require("./debug"),debug=(0,debug_1.getDebugger)("main");tslib_1.__exportStar(require("./PreCompiler"),exports),tslib_1.__exportStar(require("gherkin-ast"),exports);const load=(e,r)=>(debug("load(pattern: %s, config: %o)",e,r),(0,gherkin_io_1.read)(e,r));exports.load=load;const process=(e,...r)=>tslib_1.__awaiter(void 0,void 0,void 0,(function*(){debug("process(ast: %s, preCompilers: %d)",null==e?void 0:e.constructor.name,r.length);const t=[e];for(const e of r){debug("...preCompiler: %s",null==e?void 0:e.constructor.name);const r=new DocumentProcessor_1.DocumentProcessor(e);for(let e=0;e<t.length;++e){debug("......document: %d",e);const o=yield r.execute(t[e]);debug("......new documents: %d",o.length),t.splice(e,1,...o),e+=o.length-1}}return t}));function save(e,r,t){return tslib_1.__awaiter(this,void 0,void 0,(function*(){if(debug("save(path: %s, ast: %s, options: %o)",e,null==r?void 0:r.constructor.name,t),!e)throw new TypeError("path parameter must be set, either as a string or a PathGenerator");if(Array.isArray(r)&&r.length>1){debug("...Array: %d",r.length);let o=e;"string"==typeof e&&(/\.feature$/.test(e)||(debug("......adding extension"),e+=".feature"),o=(r,t)=>{const o=String(e).replace(/\.feature$/,`${t}.feature`);return debug("pathGenerator(%d) -> %s",t,o),o});for(let e=0;e<r.length;++e){let s=o(r[e],e);/\.feature$/.test(s)||(debug("......adding extension"),s+=".feature"),debug("...process(path: %s, i: %d)",s,e),yield(0,gherkin_io_1.write)(s,r[e],t)}}else Array.isArray(r)&&(r=r[0]),"function"==typeof e&&(e=e(r),debug("...path: %s",e)),/\.feature$/.test(e)||(debug("......adding extension"),e+=".feature"),yield(0,gherkin_io_1.write)(e,r,t)}))}exports.process=process,exports.save=save;
//# sourceMappingURL=/sm/9428684d767689d3e42b5bff93302b327ba92bfbb69b418a4b05c1fbe08fecbc.map