import { createRequire as $createRequire } from "node:module";

const require = $createRequire(import.meta.url);

import crypto from 'node:crypto';
import { parse, compileStyle, compileScript, compileTemplate } from 'vue/compiler-sfc';

var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
  if (typeof require !== "undefined") return require.apply(this, arguments);
  throw Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var require_utils = __commonJS({
  "../../node_modules/esbuild-plugin-vue3/dist/utils.js"(exports$1) {
    var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports$1 && exports$1.__importStar || function(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) {
        for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      }
      __setModuleDefault(result, mod);
      return result;
    };
    var __awaiter = exports$1 && exports$1.__awaiter || function(thisArg, _arguments, P, generator) {
      function adopt(value) {
        return value instanceof P ? value : new P(function(resolve) {
          resolve(value);
        });
      }
      return new (P || (P = Promise))(function(resolve, reject) {
        function fulfilled(value) {
          try {
            step(generator.next(value));
          } catch (e) {
            reject(e);
          }
        }
        function rejected(value) {
          try {
            step(generator["throw"](value));
          } catch (e) {
            reject(e);
          }
        }
        function step(result) {
          result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
    };
    var __generator = exports$1 && exports$1.__generator || function(thisArg, body) {
      var _ = { label: 0, sent: function() {
        if (t[0] & 1) throw t[1];
        return t[1];
      }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
        return this;
      }), g;
      function verb(n) {
        return function(v) {
          return step([n, v]);
        };
      }
      function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
          if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
          if (y = 0, t) op = [op[0] & 2, t.value];
          switch (op[0]) {
            case 0:
            case 1:
              t = op;
              break;
            case 4:
              _.label++;
              return { value: op[1], done: false };
            case 5:
              _.label++;
              y = op[1];
              op = [0];
              continue;
            case 7:
              op = _.ops.pop();
              _.trys.pop();
              continue;
            default:
              if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                _ = 0;
                continue;
              }
              if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                _.label = op[1];
                break;
              }
              if (op[0] === 6 && _.label < t[1]) {
                _.label = t[1];
                t = op;
                break;
              }
              if (t && _.label < t[2]) {
                _.label = t[2];
                _.ops.push(op);
                break;
              }
              if (t[2]) _.ops.pop();
              _.trys.pop();
              continue;
          }
          op = body.call(thisArg, _);
        } catch (e) {
          op = [6, e];
          y = 0;
        } finally {
          f = t = 0;
        }
        if (op[0] & 5) throw op[1];
        return { value: op[0] ? op[1] : void 0, done: true };
      }
    };
    Object.defineProperty(exports$1, "__esModule", { value: true });
    exports$1.AsyncCache = exports$1.tryAsync = exports$1.getFullPath = exports$1.fileExists = exports$1.getUrlParams = void 0;
    var fs = __importStar(__require("fs"));
    var path = __importStar(__require("path"));
    function getUrlParams(search) {
      var hashes = search.slice(search.indexOf("?") + 1).split("&");
      return hashes.reduce(function(params, hash) {
        var _a;
        var _b = hash.split("="), key = _b[0], val = _b[1];
        return Object.assign(params, (_a = {}, _a[key] = decodeURIComponent(val), _a));
      }, {});
    }
    exports$1.getUrlParams = getUrlParams;
    function fileExists(path2) {
      return __awaiter(this, void 0, void 0, function() {
        var stat;
        return __generator(this, function(_a) {
          switch (_a.label) {
            case 0:
              _a.trys.push([0, 2, , 3]);
              return [4, fs.promises.stat(path2)];
            case 1:
              stat = _a.sent();
              return [2, stat.isFile()];
            case 2:
              _a.sent();
              return [2, false];
            case 3:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }
    exports$1.fileExists = fileExists;
    function getFullPath(args) {
      return path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path);
    }
    exports$1.getFullPath = getFullPath;
    function tryAsync(fn, module2, requiredFor) {
      return __awaiter(this, void 0, void 0, function() {
        return __generator(this, function(_a) {
          switch (_a.label) {
            case 0:
              _a.trys.push([0, 2, , 3]);
              return [4, fn()];
            case 1:
              return [2, _a.sent()];
            case 2:
              _a.sent();
              throw new Error('Package "'.concat(module2, '" is required for ').concat(requiredFor, '. Please run "npm i -D ').concat(module2, '" and try again.'));
            case 3:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }
    exports$1.tryAsync = tryAsync;
    var AsyncCache = (
      /** @class */
      (function() {
        function AsyncCache2(enabled) {
          if (enabled === void 0) {
            enabled = true;
          }
          this.enabled = enabled;
          this.store = /* @__PURE__ */ new Map();
        }
        AsyncCache2.prototype.get = function(key, fn) {
          var _this = this;
          if (!this.enabled) {
            return fn();
          }
          var val = this.store.get(key);
          if (!val) {
            return fn().then(function(o) {
              return _this.store.set(key, o), o;
            });
          }
          return val;
        };
        return AsyncCache2;
      })()
    );
    exports$1.AsyncCache = AsyncCache;
  }
});
var require_paths = __commonJS({
  "../../node_modules/esbuild-plugin-vue3/dist/paths.js"(exports$1) {
    var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports$1 && exports$1.__importStar || function(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) {
        for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      }
      __setModuleDefault(result, mod);
      return result;
    };
    var __awaiter = exports$1 && exports$1.__awaiter || function(thisArg, _arguments, P, generator) {
      function adopt(value) {
        return value instanceof P ? value : new P(function(resolve) {
          resolve(value);
        });
      }
      return new (P || (P = Promise))(function(resolve, reject) {
        function fulfilled(value) {
          try {
            step(generator.next(value));
          } catch (e) {
            reject(e);
          }
        }
        function rejected(value) {
          try {
            step(generator["throw"](value));
          } catch (e) {
            reject(e);
          }
        }
        function step(result) {
          result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
    };
    var __generator = exports$1 && exports$1.__generator || function(thisArg, body) {
      var _ = { label: 0, sent: function() {
        if (t[0] & 1) throw t[1];
        return t[1];
      }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
        return this;
      }), g;
      function verb(n) {
        return function(v) {
          return step([n, v]);
        };
      }
      function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
          if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
          if (y = 0, t) op = [op[0] & 2, t.value];
          switch (op[0]) {
            case 0:
            case 1:
              t = op;
              break;
            case 4:
              _.label++;
              return { value: op[1], done: false };
            case 5:
              _.label++;
              y = op[1];
              op = [0];
              continue;
            case 7:
              op = _.ops.pop();
              _.trys.pop();
              continue;
            default:
              if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                _ = 0;
                continue;
              }
              if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                _.label = op[1];
                break;
              }
              if (op[0] === 6 && _.label < t[1]) {
                _.label = t[1];
                t = op;
                break;
              }
              if (t && _.label < t[2]) {
                _.label = t[2];
                _.ops.push(op);
                break;
              }
              if (t[2]) _.ops.pop();
              _.trys.pop();
              continue;
          }
          op = body.call(thisArg, _);
        } catch (e) {
          op = [6, e];
          y = 0;
        } finally {
          f = t = 0;
        }
        if (op[0] & 5) throw op[1];
        return { value: op[0] ? op[1] : void 0, done: true };
      }
    };
    Object.defineProperty(exports$1, "__esModule", { value: true });
    exports$1.replaceRules = exports$1.loadRules = void 0;
    var utils_1 = require_utils();
    var fs = __importStar(__require("fs"));
    var typescript_1 = __require("typescript");
    var rules = [];
    function loadRules(opts, tsconfigPath) {
      return __awaiter(this, void 0, void 0, function() {
        var path, from, to;
        return __generator(this, function(_a) {
          switch (_a.label) {
            case 0:
              if (opts.pathAliases === false) {
                return [2, false];
              }
              if (!opts.pathAliases) return [3, 1];
              for (path in opts.pathAliases) {
                from = "^" + replaceWildcard(path, "(.*)") + "$";
                to = replaceWildcard(opts.pathAliases[path], "$1");
                rules.push({
                  regex: new RegExp(from),
                  replacement: to
                });
              }
              return [3, 3];
            case 1:
              return [4, loadFromTsconfig(tsconfigPath)];
            case 2:
              _a.sent();
              _a.label = 3;
            case 3:
              return [2, rules.length > 0];
          }
        });
      });
    }
    exports$1.loadRules = loadRules;
    function loadFromTsconfig(path) {
      var _a;
      return __awaiter(this, void 0, void 0, function() {
        var _b, tsconfig, error, _c, _d, path_1, dests, from, to;
        return __generator(this, function(_e) {
          switch (_e.label) {
            case 0:
              return [4, (0, utils_1.fileExists)(path)];
            case 1:
              if (!_e.sent()) {
                return [
                  2
                  /*return*/
                ];
              }
              _c = typescript_1.parseConfigFileTextToJson;
              _d = [path];
              return [4, fs.promises.readFile(path)];
            case 2:
              _b = _c.apply(void 0, _d.concat([_e.sent().toString()])), tsconfig = _b.config, error = _b.error;
              if (error) {
                throw new Error("Failed to parse tsconfig.json: ".concat(JSON.stringify(error)));
              }
              if (!((_a = tsconfig === null || tsconfig === void 0 ? void 0 : tsconfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.paths)) {
                return [
                  2
                  /*return*/
                ];
              }
              for (path_1 in tsconfig.compilerOptions.paths) {
                dests = tsconfig.compilerOptions.paths[path_1];
                if (dests.length == 0) {
                  continue;
                }
                from = "^" + replaceWildcard(path_1, "(.*)") + "$";
                to = replaceWildcard(dests[0], "$1");
                rules.push({
                  regex: new RegExp(from),
                  replacement: to
                });
              }
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }
    function replaceWildcard(str, repl) {
      return str.replace(/\*/g, repl);
    }
    function replaceRules(path) {
      for (var _i = 0, rules_1 = rules; _i < rules_1.length; _i++) {
        var rule = rules_1[_i];
        path = path.replace(rule.regex, rule.replacement);
      }
      return path;
    }
    exports$1.replaceRules = replaceRules;
  }
});
var require_html = __commonJS({
  "../../node_modules/esbuild-plugin-vue3/dist/html.js"(exports$1) {
    var __assign = exports$1 && exports$1.__assign || function() {
      __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
          s = arguments[i];
          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
            t[p] = s[p];
        }
        return t;
      };
      return __assign.apply(this, arguments);
    };
    var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports$1 && exports$1.__importStar || function(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) {
        for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      }
      __setModuleDefault(result, mod);
      return result;
    };
    var __awaiter = exports$1 && exports$1.__awaiter || function(thisArg, _arguments, P, generator) {
      function adopt(value) {
        return value instanceof P ? value : new P(function(resolve) {
          resolve(value);
        });
      }
      return new (P || (P = Promise))(function(resolve, reject) {
        function fulfilled(value) {
          try {
            step(generator.next(value));
          } catch (e) {
            reject(e);
          }
        }
        function rejected(value) {
          try {
            step(generator["throw"](value));
          } catch (e) {
            reject(e);
          }
        }
        function step(result) {
          result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
    };
    var __generator = exports$1 && exports$1.__generator || function(thisArg, body) {
      var _ = { label: 0, sent: function() {
        if (t[0] & 1) throw t[1];
        return t[1];
      }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
        return this;
      }), g;
      function verb(n) {
        return function(v) {
          return step([n, v]);
        };
      }
      function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
          if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
          if (y = 0, t) op = [op[0] & 2, t.value];
          switch (op[0]) {
            case 0:
            case 1:
              t = op;
              break;
            case 4:
              _.label++;
              return { value: op[1], done: false };
            case 5:
              _.label++;
              y = op[1];
              op = [0];
              continue;
            case 7:
              op = _.ops.pop();
              _.trys.pop();
              continue;
            default:
              if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                _ = 0;
                continue;
              }
              if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                _.label = op[1];
                break;
              }
              if (op[0] === 6 && _.label < t[1]) {
                _.label = t[1];
                t = op;
                break;
              }
              if (t && _.label < t[2]) {
                _.label = t[2];
                _.ops.push(op);
                break;
              }
              if (t[2]) _.ops.pop();
              _.trys.pop();
              continue;
          }
          op = body.call(thisArg, _);
        } catch (e) {
          op = [6, e];
          y = 0;
        } finally {
          f = t = 0;
        }
        if (op[0] & 5) throw op[1];
        return { value: op[0] ? op[1] : void 0, done: true };
      }
    };
    Object.defineProperty(exports$1, "__esModule", { value: true });
    exports$1.generateIndexHTML = void 0;
    var fs = __importStar(__require("fs"));
    var path = __importStar(__require("path"));
    var utils_1 = require_utils();
    function generateIndexHTML(result, opts, min, inlineStyles) {
      return __awaiter(this, void 0, void 0, function() {
        var cheerio, $, _a, _b, _i, _c, item, link, name_1, ext, script, link, _d, inlineStyles_1, style, el, html, minify;
        return __generator(this, function(_e) {
          switch (_e.label) {
            case 0:
              if (!result.metafile) {
                throw new Error('The "metafile" option must be set to true in the build options');
              }
              if (!opts.outFile) {
                throw new Error("No outFile was specified and it could not be inferred from the build options");
              }
              return [4, (0, utils_1.tryAsync)(function() {
                return Promise.resolve().then(function() {
                  return __importStar(__require("cheerio"));
                });
              }, "cheerio", "HTML generation")];
            case 1:
              cheerio = _e.sent();
              _b = (_a = cheerio).load;
              return [4, fs.promises.readFile(opts.sourceFile)];
            case 2:
              $ = _b.apply(_a, [_e.sent()]);
              if (opts.preload) {
                for (_i = 0, _c = opts.preload; _i < _c.length; _i++) {
                  item = _c[_i];
                  link = $("<link>");
                  link.attr("rel", item.prefetch ? "prefetch" : "preload");
                  link.attr("href", item.href);
                  link.attr("as", item.as);
                  $("head").append(link);
                }
              }
              for (name_1 in result.metafile.outputs) {
                if (opts.trimPath) {
                  name_1 = name_1.replace(opts.trimPath, "");
                }
                if (opts.pathPrefix && !name_1.startsWith(opts.pathPrefix)) {
                  name_1 = opts.pathPrefix + name_1;
                }
                name_1 = path.normalize(name_1).replace(/\\/g, "/");
                ext = path.extname(name_1);
                if (ext === ".js") {
                  script = $("<script>");
                  script.attr("src", name_1);
                  $("body").append(script);
                } else if (ext === ".css") {
                  link = $("<link rel='stylesheet'>");
                  link.attr("href", name_1);
                  $("head").append(link);
                }
              }
              if (inlineStyles) {
                for (_d = 0, inlineStyles_1 = inlineStyles; _d < inlineStyles_1.length; _d++) {
                  style = inlineStyles_1[_d];
                  el = $("<style>");
                  el.text(style);
                  $("head").append(el);
                }
              }
              html = $.html();
              if (!min) return [3, 4];
              return [4, (0, utils_1.tryAsync)(function() {
                return Promise.resolve().then(function() {
                  return __importStar(__require("html-minifier"));
                });
              }, "html-minifier", "HTML minification")];
            case 3:
              minify = _e.sent().minify;
              html = minify(html, __assign({ collapseWhitespace: true, minifyCSS: true, removeComments: true }, opts.minifyOptions));
              _e.label = 4;
            case 4:
              return [4, fs.promises.writeFile(opts.outFile, html)];
            case 5:
              _e.sent();
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }
    exports$1.generateIndexHTML = generateIndexHTML;
  }
});
var require_random = __commonJS({
  "../../node_modules/esbuild-plugin-vue3/dist/random.js"(exports$1) {
    Object.defineProperty(exports$1, "__esModule", { value: true });
    var crypto_1 = __require("crypto");
    var randomBytesClassic = crypto_1.randomBytes;
    function default_1(seed) {
      if (seed === void 0) {
        seed = randomBytesClassic(32);
      }
      randomBytes.seed = seed;
      randomBytes.currentSeed = seed;
      return randomBytes;
      function randomBytes(n) {
        var result = Buffer.allocUnsafe(n);
        var used = 0;
        while (used < result.length) {
          randomBytes.currentSeed = seed = next(seed);
          seed.copy(result, used);
          used += seed.length;
        }
        return result;
      }
    }
    exports$1.default = default_1;
    function next(seed) {
      return (0, crypto_1.createHash)("sha256").update(seed).digest();
    }
  }
});
var require_dist = __commonJS({
  "../../node_modules/esbuild-plugin-vue3/dist/index.js"(exports$1, module) {
    var __assign = exports$1 && exports$1.__assign || function() {
      __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
          s = arguments[i];
          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
            t[p] = s[p];
        }
        return t;
      };
      return __assign.apply(this, arguments);
    };
    var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports$1 && exports$1.__importStar || function(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) {
        for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      }
      __setModuleDefault(result, mod);
      return result;
    };
    var __awaiter = exports$1 && exports$1.__awaiter || function(thisArg, _arguments, P, generator) {
      function adopt(value) {
        return value instanceof P ? value : new P(function(resolve) {
          resolve(value);
        });
      }
      return new (P || (P = Promise))(function(resolve, reject) {
        function fulfilled(value) {
          try {
            step(generator.next(value));
          } catch (e) {
            reject(e);
          }
        }
        function rejected(value) {
          try {
            step(generator["throw"](value));
          } catch (e) {
            reject(e);
          }
        }
        function step(result) {
          result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
    };
    var __generator = exports$1 && exports$1.__generator || function(thisArg, body) {
      var _ = { label: 0, sent: function() {
        if (t[0] & 1) throw t[1];
        return t[1];
      }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
        return this;
      }), g;
      function verb(n) {
        return function(v) {
          return step([n, v]);
        };
      }
      function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
          if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
          if (y = 0, t) op = [op[0] & 2, t.value];
          switch (op[0]) {
            case 0:
            case 1:
              t = op;
              break;
            case 4:
              _.label++;
              return { value: op[1], done: false };
            case 5:
              _.label++;
              y = op[1];
              op = [0];
              continue;
            case 7:
              op = _.ops.pop();
              _.trys.pop();
              continue;
            default:
              if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                _ = 0;
                continue;
              }
              if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                _.label = op[1];
                break;
              }
              if (op[0] === 6 && _.label < t[1]) {
                _.label = t[1];
                t = op;
                break;
              }
              if (t && _.label < t[2]) {
                _.label = t[2];
                _.ops.push(op);
                break;
              }
              if (t[2]) _.ops.pop();
              _.trys.pop();
              continue;
          }
          op = body.call(thisArg, _);
        } catch (e) {
          op = [6, e];
          y = 0;
        } finally {
          f = t = 0;
        }
        if (op[0] & 5) throw op[1];
        return { value: op[0] ? op[1] : void 0, done: true };
      }
    };
    var __rest = exports$1 && exports$1.__rest || function(s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
          if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
            t[p[i]] = s[p[i]];
        }
      return t;
    };
    var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    var path = __importStar(__require("path"));
    var fs = __importStar(__require("fs"));
    var crypto2 = __importStar(__require("crypto"));
    var url_1 = __require("url");
    var typescript_1 = __importDefault(__require("typescript"));
    var sfc = __importStar(__require("@vue/compiler-sfc"));
    var core = __importStar(__require("@vue/compiler-core"));
    var paths_1 = require_paths();
    var utils_1 = require_utils();
    var html_1 = require_html();
    var random_1 = __importDefault(require_random());
    var vuePlugin = function(opts) {
      if (opts === void 0) {
        opts = {};
      }
      return {
        name: "vue",
        setup: function(_a) {
          var _b;
          var buildOpts = _a.initialOptions, build = __rest(_a, ["initialOptions"]);
          return __awaiter(this, void 0, void 0, function() {
            var generatedCSS, mustReplace, random, cache, projectRoot, transforms, _loop_1, name_1;
            var _this = this;
            return __generator(this, function(_c) {
              switch (_c.label) {
                case 0:
                  buildOpts.define = __assign(__assign({}, buildOpts.define), { "__VUE_OPTIONS_API__": opts.disableOptionsApi ? "false" : "true", "__VUE_PROD_DEVTOOLS__": opts.enableDevTools ? "true" : "false", "__VUE_PROD_HYDRATION_MISMATCH_DETAILS__": opts.enableHydrationMismatchDetails ? "true" : "false" });
                  if (opts.generateHTML && !buildOpts.metafile) {
                    buildOpts.metafile = true;
                  }
                  if (opts.disableResolving) {
                    opts.pathAliases = false;
                    build.onStart(function() {
                      return { warnings: [{ text: "The disableResolving option is deprecated, use pathAliases instead" }] };
                    });
                  }
                  generatedCSS = [];
                  return [4, (0, paths_1.loadRules)(opts, (_b = buildOpts.tsconfig) !== null && _b !== void 0 ? _b : "tsconfig.json")];
                case 1:
                  mustReplace = _c.sent();
                  random = (0, random_1.default)(typeof opts.scopeId === "object" && typeof opts.scopeId.random === "string" ? opts.scopeId.random : void 0);
                  cache = new utils_1.AsyncCache(!opts.disableCache);
                  projectRoot = process.env.npm_config_local_prefix || process.cwd();
                  transforms = {};
                  if (opts.directiveTransforms) {
                    _loop_1 = function(name_12) {
                      if (Object.prototype.hasOwnProperty.call(opts.directiveTransforms, name_12)) {
                        var propName_1 = opts.directiveTransforms[name_12];
                        var transformation_1 = function(dir, name) {
                          var _a2;
                          return {
                            key: core.createSimpleExpression(JSON.stringify(name), false),
                            value: (_a2 = dir.exp) !== null && _a2 !== void 0 ? _a2 : core.createSimpleExpression("void 0", false),
                            loc: dir.loc,
                            type: 16
                          };
                        };
                        if (typeof propName_1 === "function") {
                          transforms[name_12] = function() {
                            var args = [];
                            for (var _i = 0; _i < arguments.length; _i++) {
                              args[_i] = arguments[_i];
                            }
                            var ret = propName_1(args[0], args[1], args[2]);
                            return {
                              props: ret === void 0 ? [] : [transformation_1(args[0], ret)]
                            };
                          };
                        } else {
                          transforms[name_12] = function(dir) {
                            return {
                              props: propName_1 === false ? [] : [transformation_1(dir, propName_1)]
                            };
                          };
                        }
                      }
                    };
                    for (name_1 in opts.directiveTransforms) {
                      _loop_1(name_1);
                    }
                  }
                  if (mustReplace) {
                    build.onResolve({ filter: /.*/ }, function(args) {
                      return __awaiter(_this, void 0, void 0, function() {
                        var aliased, fullPath, possible, _i, possible_1, postfix;
                        return __generator(this, function(_a2) {
                          switch (_a2.label) {
                            case 0:
                              aliased = (0, paths_1.replaceRules)(args.path);
                              fullPath = path.isAbsolute(aliased) ? aliased : path.join(process.cwd(), aliased);
                              return [4, (0, utils_1.fileExists)(fullPath)];
                            case 1:
                              if (!!_a2.sent()) return [3, 6];
                              possible = [
                                ".ts",
                                "/index.ts",
                                ".js",
                                "/index.js"
                              ];
                              _i = 0, possible_1 = possible;
                              _a2.label = 2;
                            case 2:
                              if (!(_i < possible_1.length)) return [3, 5];
                              postfix = possible_1[_i];
                              return [4, (0, utils_1.fileExists)(fullPath + postfix)];
                            case 3:
                              if (_a2.sent()) {
                                return [2, {
                                  path: path.normalize(fullPath + postfix),
                                  namespace: "file"
                                }];
                              }
                              _a2.label = 4;
                            case 4:
                              _i++;
                              return [3, 2];
                            case 5:
                              return [3, 7];
                            case 6:
                              return [2, {
                                path: path.normalize(fullPath),
                                namespace: "file"
                              }];
                            case 7:
                              return [
                                2
                                /*return*/
                              ];
                          }
                        });
                      });
                    });
                  }
                  build.onResolve({ filter: /\.vue/ }, function(args) {
                    return __awaiter(_this, void 0, void 0, function() {
                      var params;
                      return __generator(this, function(_a2) {
                        params = (0, utils_1.getUrlParams)(args.path);
                        return [2, {
                          path: (0, utils_1.getFullPath)(args),
                          namespace: params.type === "script" ? "sfc-script" : params.type === "template" ? "sfc-template" : params.type === "style" ? "sfc-style" : "file",
                          pluginData: __assign(__assign({}, args.pluginData), { index: params.index })
                        }];
                      });
                    });
                  });
                  build.onLoad({ filter: /\.vue$/ }, function(args) {
                    return cache.get([args.path, args.namespace], function() {
                      return __awaiter(_this, void 0, void 0, function() {
                        var encPath, source, filename, id, descriptor, script, dataId, code, src, style, renderFuncName;
                        return __generator(this, function(_a2) {
                          switch (_a2.label) {
                            case 0:
                              encPath = args.path.replace(/\\/g, "\\\\");
                              return [4, fs.promises.readFile(args.path, "utf8")];
                            case 1:
                              source = _a2.sent();
                              filename = path.relative(process.cwd(), args.path);
                              id = !opts.scopeId || opts.scopeId === "hash" ? crypto2.createHash("md5").update(filename).digest().toString("hex").substring(0, 8) : random(4).toString("hex");
                              descriptor = sfc.parse(source, {
                                filename
                              }).descriptor;
                              script = descriptor.script || descriptor.scriptSetup ? sfc.compileScript(descriptor, { id, fs: typescript_1.default.sys }) : void 0;
                              dataId = "data-v-" + id;
                              code = "";
                              if (descriptor.script || descriptor.scriptSetup) {
                                src = descriptor.script && !descriptor.scriptSetup && descriptor.script.src || encPath;
                                code += 'import script from "'.concat(src, '?type=script";');
                              } else {
                                code += "const script = {};";
                              }
                              for (style in descriptor.styles) {
                                code += 'import "'.concat(encPath, "?type=style&index=").concat(style, '";');
                              }
                              renderFuncName = opts.renderSSR ? "ssrRender" : "render";
                              descriptor.template && (code += "import { ".concat(renderFuncName, ' } from "').concat(encPath, '?type=template"; script.').concat(renderFuncName, " = ").concat(renderFuncName, ";"));
                              code += "script.__file = ".concat(JSON.stringify(filename), ";");
                              if (descriptor.styles.some(function(o) {
                                return o.scoped;
                              })) {
                                code += "script.__scopeId = ".concat(JSON.stringify(dataId), ";");
                              }
                              if (opts.renderSSR) {
                                code += "script.__ssrInlineRender = true;";
                              }
                              code += "export default script;";
                              return [2, {
                                contents: code,
                                resolveDir: path.dirname(args.path),
                                pluginData: { descriptor, id: dataId, script },
                                watchFiles: [args.path]
                              }];
                          }
                        });
                      });
                    });
                  });
                  build.onLoad({ filter: /.*/, namespace: "sfc-script" }, function(args) {
                    return cache.get([args.path, args.namespace], function() {
                      return __awaiter(_this, void 0, void 0, function() {
                        var script, code, sourceMap;
                        return __generator(this, function(_a2) {
                          script = args.pluginData.script;
                          if (script) {
                            code = script.content;
                            if (buildOpts.sourcemap && script.map) {
                              sourceMap = Buffer.from(JSON.stringify(script.map)).toString("base64");
                              code += "\n\n//@ sourceMappingURL=data:application/json;charset=utf-8;base64," + sourceMap;
                            }
                            return [2, {
                              contents: code,
                              loader: script.lang === "ts" ? "ts" : "js",
                              resolveDir: path.dirname(args.path)
                            }];
                          }
                          return [
                            2
                            /*return*/
                          ];
                        });
                      });
                    });
                  });
                  build.onLoad({ filter: /.*/, namespace: "sfc-template" }, function(args) {
                    return cache.get([args.path, args.namespace], function() {
                      return __awaiter(_this, void 0, void 0, function() {
                        var _a2, descriptor, id, script, source, pug, result;
                        return __generator(this, function(_b2) {
                          switch (_b2.label) {
                            case 0:
                              _a2 = args.pluginData, descriptor = _a2.descriptor, id = _a2.id, script = _a2.script;
                              if (!descriptor.template) {
                                return [2, {
                                  loader: "js",
                                  contents: ""
                                }];
                              }
                              source = descriptor.template.content;
                              if (!(descriptor.template.lang === "pug")) return [3, 2];
                              return [4, (0, utils_1.tryAsync)(function() {
                                return Promise.resolve().then(function() {
                                  return __importStar(__require("pug"));
                                });
                              }, "pug", "Pug template rendering")];
                            case 1:
                              pug = _b2.sent();
                              source = pug.render(descriptor.template.content);
                              source = source.replace(/(\B#.*?|\bv-.*?)="\1"/g, "$1");
                              _b2.label = 2;
                            case 2:
                              result = sfc.compileTemplate({
                                id,
                                source,
                                filename: args.path,
                                scoped: descriptor.styles.some(function(o) {
                                  return o.scoped;
                                }),
                                slotted: descriptor.slotted,
                                ssr: opts.renderSSR,
                                ssrCssVars: [],
                                isProd: process.env.NODE_ENV === "production" || buildOpts.minify,
                                compilerOptions: __assign({ inSSR: opts.renderSSR, directiveTransforms: transforms, bindingMetadata: script === null || script === void 0 ? void 0 : script.bindings }, opts.compilerOptions)
                              });
                              if (result.errors.length > 0) {
                                return [2, {
                                  errors: result.errors.map(function(o) {
                                    return typeof o === "string" ? { text: o } : {
                                      text: o.message,
                                      location: o.loc && {
                                        column: o.loc.start.column,
                                        file: descriptor.filename,
                                        line: o.loc.start.line + descriptor.template.loc.start.line + 1,
                                        lineText: o.loc.source
                                      }
                                    };
                                  })
                                }];
                              }
                              return [2, {
                                contents: result.code,
                                warnings: result.tips.map(function(o) {
                                  return { text: o };
                                }),
                                loader: "ts",
                                resolveDir: path.dirname(args.path)
                              }];
                          }
                        });
                      });
                    });
                  });
                  build.onLoad({ filter: /.*/, namespace: "sfc-style" }, function(args) {
                    return cache.get([args.path, args.namespace], function() {
                      return __awaiter(_this, void 0, void 0, function() {
                        var _a2, descriptor, index, id, style, includedFiles, result, errors, cssText, contents;
                        var _b2, _c2;
                        return __generator(this, function(_d) {
                          switch (_d.label) {
                            case 0:
                              _a2 = args.pluginData, descriptor = _a2.descriptor, index = _a2.index, id = _a2.id;
                              style = descriptor.styles[index];
                              includedFiles = [];
                              return [4, sfc.compileStyleAsync({
                                filename: args.path,
                                id,
                                source: style.content,
                                postcssOptions: (_b2 = opts.postcss) === null || _b2 === void 0 ? void 0 : _b2.options,
                                postcssPlugins: (_c2 = opts.postcss) === null || _c2 === void 0 ? void 0 : _c2.plugins,
                                preprocessLang: style.lang,
                                preprocessOptions: Object.assign({
                                  loadPaths: [
                                    path.dirname(args.path),
                                    path.resolve(projectRoot, "node_modules")
                                  ],
                                  importer: {
                                    findFileUrl: function(url) {
                                      var modulePath = path.join(projectRoot, "node_modules", url);
                                      if (fs.existsSync(modulePath))
                                        return (0, url_1.pathToFileURL)(modulePath);
                                      var replacedPath = (0, paths_1.replaceRules)(url);
                                      if (fs.existsSync(replacedPath))
                                        return (0, url_1.pathToFileURL)(replacedPath);
                                      return null;
                                    }
                                  }
                                }, opts.preprocessorOptions),
                                scoped: style.scoped
                              })];
                            case 1:
                              result = _d.sent();
                              if (result.errors.length > 0) {
                                errors = result.errors;
                                return [2, {
                                  errors: errors.map(function(o) {
                                    var _a3, _b3;
                                    return {
                                      text: o.message,
                                      location: {
                                        column: o.column,
                                        line: o.file === args.path ? style.loc.start.line + o.line - 1 : o.line,
                                        file: (_b3 = (_a3 = o.file) === null || _a3 === void 0 ? void 0 : _a3.replace(/\?.*?$/, "")) !== null && _b3 !== void 0 ? _b3 : "<unknown>",
                                        namespace: "file"
                                      }
                                    };
                                  })
                                }];
                              }
                              if (opts.cssInline) {
                                if (opts.generateHTML) {
                                  generatedCSS.push(result.code);
                                  return [2, {
                                    contents: "",
                                    loader: "js"
                                  }];
                                }
                                cssText = result.code;
                                contents = '\n                {\n                    const el = document.createElement("style");\n                    el.textContent = '.concat(JSON.stringify(cssText), ";\n                    document.head.append(el);\n                }");
                                return [2, {
                                  contents,
                                  loader: "js",
                                  resolveDir: path.dirname(args.path),
                                  watchFiles: includedFiles
                                }];
                              }
                              return [2, {
                                contents: result.code,
                                loader: "css",
                                resolveDir: path.dirname(args.path),
                                watchFiles: includedFiles
                              }];
                          }
                        });
                      });
                    });
                  });
                  build.onEnd(function(result) {
                    return __awaiter(_this, void 0, void 0, function() {
                      var outDir;
                      var _a2, _b2, _c2, _d;
                      var _e, _f, _g;
                      return __generator(this, function(_h) {
                        switch (_h.label) {
                          case 0:
                            if (!((opts === null || opts === void 0 ? void 0 : opts.generateHTML) && result.errors.length == 0)) return [3, 2];
                            if (typeof opts.generateHTML === "string") {
                              opts.generateHTML = {
                                sourceFile: opts.generateHTML
                              };
                            }
                            outDir = buildOpts.outdir ? buildOpts.outdir : buildOpts.outfile ? path.dirname(buildOpts.outfile) : void 0;
                            (_a2 = (_e = opts.generateHTML).trimPath) !== null && _a2 !== void 0 ? _a2 : _e.trimPath = outDir;
                            (_b2 = (_f = opts.generateHTML).pathPrefix) !== null && _b2 !== void 0 ? _b2 : _f.pathPrefix = "/";
                            (_c2 = (_g = opts.generateHTML).outFile) !== null && _c2 !== void 0 ? _c2 : _g.outFile = outDir && path.join(outDir, "index.html");
                            return [4, (0, html_1.generateIndexHTML)(result, opts.generateHTML, (_d = buildOpts.minify) !== null && _d !== void 0 ? _d : false, opts.cssInline ? generatedCSS : void 0)];
                          case 1:
                            _h.sent();
                            _h.label = 2;
                          case 2:
                            return [
                              2
                              /*return*/
                            ];
                        }
                      });
                    });
                  });
                  return [
                    2
                    /*return*/
                  ];
              }
            });
          });
        }
      };
    };
    module.exports = vuePlugin;
  }
});
var require_vendors = __commonJS({
  "../../node_modules/ci-info/vendors.json"(exports$1, module) {
    module.exports = [
      {
        name: "Agola CI",
        constant: "AGOLA",
        env: "AGOLA_GIT_REF",
        pr: "AGOLA_PULL_REQUEST_ID"
      },
      {
        name: "Appcircle",
        constant: "APPCIRCLE",
        env: "AC_APPCIRCLE",
        pr: {
          env: "AC_GIT_PR",
          ne: "false"
        }
      },
      {
        name: "AppVeyor",
        constant: "APPVEYOR",
        env: "APPVEYOR",
        pr: "APPVEYOR_PULL_REQUEST_NUMBER"
      },
      {
        name: "AWS CodeBuild",
        constant: "CODEBUILD",
        env: "CODEBUILD_BUILD_ARN",
        pr: {
          env: "CODEBUILD_WEBHOOK_EVENT",
          any: [
            "PULL_REQUEST_CREATED",
            "PULL_REQUEST_UPDATED",
            "PULL_REQUEST_REOPENED"
          ]
        }
      },
      {
        name: "Azure Pipelines",
        constant: "AZURE_PIPELINES",
        env: "TF_BUILD",
        pr: {
          BUILD_REASON: "PullRequest"
        }
      },
      {
        name: "Bamboo",
        constant: "BAMBOO",
        env: "bamboo_planKey"
      },
      {
        name: "Bitbucket Pipelines",
        constant: "BITBUCKET",
        env: "BITBUCKET_COMMIT",
        pr: "BITBUCKET_PR_ID"
      },
      {
        name: "Bitrise",
        constant: "BITRISE",
        env: "BITRISE_IO",
        pr: "BITRISE_PULL_REQUEST"
      },
      {
        name: "Buddy",
        constant: "BUDDY",
        env: "BUDDY_WORKSPACE_ID",
        pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
      },
      {
        name: "Buildkite",
        constant: "BUILDKITE",
        env: "BUILDKITE",
        pr: {
          env: "BUILDKITE_PULL_REQUEST",
          ne: "false"
        }
      },
      {
        name: "CircleCI",
        constant: "CIRCLE",
        env: "CIRCLECI",
        pr: "CIRCLE_PULL_REQUEST"
      },
      {
        name: "Cirrus CI",
        constant: "CIRRUS",
        env: "CIRRUS_CI",
        pr: "CIRRUS_PR"
      },
      {
        name: "Cloudflare Pages",
        constant: "CLOUDFLARE_PAGES",
        env: "CF_PAGES"
      },
      {
        name: "Cloudflare Workers",
        constant: "CLOUDFLARE_WORKERS",
        env: "WORKERS_CI"
      },
      {
        name: "Codefresh",
        constant: "CODEFRESH",
        env: "CF_BUILD_ID",
        pr: {
          any: [
            "CF_PULL_REQUEST_NUMBER",
            "CF_PULL_REQUEST_ID"
          ]
        }
      },
      {
        name: "Codemagic",
        constant: "CODEMAGIC",
        env: "CM_BUILD_ID",
        pr: "CM_PULL_REQUEST"
      },
      {
        name: "Codeship",
        constant: "CODESHIP",
        env: {
          CI_NAME: "codeship"
        }
      },
      {
        name: "Drone",
        constant: "DRONE",
        env: "DRONE",
        pr: {
          DRONE_BUILD_EVENT: "pull_request"
        }
      },
      {
        name: "dsari",
        constant: "DSARI",
        env: "DSARI"
      },
      {
        name: "Earthly",
        constant: "EARTHLY",
        env: "EARTHLY_CI"
      },
      {
        name: "Expo Application Services",
        constant: "EAS",
        env: "EAS_BUILD"
      },
      {
        name: "Gerrit",
        constant: "GERRIT",
        env: "GERRIT_PROJECT"
      },
      {
        name: "Gitea Actions",
        constant: "GITEA_ACTIONS",
        env: "GITEA_ACTIONS"
      },
      {
        name: "GitHub Actions",
        constant: "GITHUB_ACTIONS",
        env: "GITHUB_ACTIONS",
        pr: {
          GITHUB_EVENT_NAME: "pull_request"
        }
      },
      {
        name: "GitLab CI",
        constant: "GITLAB",
        env: "GITLAB_CI",
        pr: "CI_MERGE_REQUEST_ID"
      },
      {
        name: "GoCD",
        constant: "GOCD",
        env: "GO_PIPELINE_LABEL"
      },
      {
        name: "Google Cloud Build",
        constant: "GOOGLE_CLOUD_BUILD",
        env: "BUILDER_OUTPUT"
      },
      {
        name: "Harness CI",
        constant: "HARNESS",
        env: "HARNESS_BUILD_ID"
      },
      {
        name: "Heroku",
        constant: "HEROKU",
        env: {
          env: "NODE",
          includes: "/app/.heroku/node/bin/node"
        }
      },
      {
        name: "Hudson",
        constant: "HUDSON",
        env: "HUDSON_URL"
      },
      {
        name: "Jenkins",
        constant: "JENKINS",
        env: [
          "JENKINS_URL",
          "BUILD_ID"
        ],
        pr: {
          any: [
            "ghprbPullId",
            "CHANGE_ID"
          ]
        }
      },
      {
        name: "LayerCI",
        constant: "LAYERCI",
        env: "LAYERCI",
        pr: "LAYERCI_PULL_REQUEST"
      },
      {
        name: "Magnum CI",
        constant: "MAGNUM",
        env: "MAGNUM"
      },
      {
        name: "Netlify CI",
        constant: "NETLIFY",
        env: "NETLIFY",
        pr: {
          env: "PULL_REQUEST",
          ne: "false"
        }
      },
      {
        name: "Nevercode",
        constant: "NEVERCODE",
        env: "NEVERCODE",
        pr: {
          env: "NEVERCODE_PULL_REQUEST",
          ne: "false"
        }
      },
      {
        name: "Prow",
        constant: "PROW",
        env: "PROW_JOB_ID"
      },
      {
        name: "ReleaseHub",
        constant: "RELEASEHUB",
        env: "RELEASE_BUILD_ID"
      },
      {
        name: "Render",
        constant: "RENDER",
        env: "RENDER",
        pr: {
          IS_PULL_REQUEST: "true"
        }
      },
      {
        name: "Sail CI",
        constant: "SAIL",
        env: "SAILCI",
        pr: "SAIL_PULL_REQUEST_NUMBER"
      },
      {
        name: "Screwdriver",
        constant: "SCREWDRIVER",
        env: "SCREWDRIVER",
        pr: {
          env: "SD_PULL_REQUEST",
          ne: "false"
        }
      },
      {
        name: "Semaphore",
        constant: "SEMAPHORE",
        env: "SEMAPHORE",
        pr: "PULL_REQUEST_NUMBER"
      },
      {
        name: "Sourcehut",
        constant: "SOURCEHUT",
        env: {
          CI_NAME: "sourcehut"
        }
      },
      {
        name: "Strider CD",
        constant: "STRIDER",
        env: "STRIDER"
      },
      {
        name: "TaskCluster",
        constant: "TASKCLUSTER",
        env: [
          "TASK_ID",
          "RUN_ID"
        ]
      },
      {
        name: "TeamCity",
        constant: "TEAMCITY",
        env: "TEAMCITY_VERSION"
      },
      {
        name: "Travis CI",
        constant: "TRAVIS",
        env: "TRAVIS",
        pr: {
          env: "TRAVIS_PULL_REQUEST",
          ne: "false"
        }
      },
      {
        name: "Vela",
        constant: "VELA",
        env: "VELA",
        pr: {
          VELA_PULL_REQUEST: "1"
        }
      },
      {
        name: "Vercel",
        constant: "VERCEL",
        env: {
          any: [
            "NOW_BUILDER",
            "VERCEL"
          ]
        },
        pr: "VERCEL_GIT_PULL_REQUEST_ID"
      },
      {
        name: "Visual Studio App Center",
        constant: "APPCENTER",
        env: "APPCENTER_BUILD_ID"
      },
      {
        name: "Woodpecker",
        constant: "WOODPECKER",
        env: {
          CI: "woodpecker"
        },
        pr: {
          CI_BUILD_EVENT: "pull_request"
        }
      },
      {
        name: "Xcode Cloud",
        constant: "XCODE_CLOUD",
        env: "CI_XCODE_PROJECT",
        pr: "CI_PULL_REQUEST_NUMBER"
      },
      {
        name: "Xcode Server",
        constant: "XCODE_SERVER",
        env: "XCS"
      }
    ];
  }
});
var require_ci_info = __commonJS({
  "../../node_modules/ci-info/index.js"(exports$1) {
    var vendors = require_vendors();
    var env = process.env;
    Object.defineProperty(exports$1, "_vendors", {
      value: vendors.map(function(v) {
        return v.constant;
      })
    });
    exports$1.name = null;
    exports$1.isPR = null;
    exports$1.id = null;
    vendors.forEach(function(vendor) {
      const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
      const isCI2 = envs.every(function(obj) {
        return checkEnv(obj);
      });
      exports$1[vendor.constant] = isCI2;
      if (!isCI2) {
        return;
      }
      exports$1.name = vendor.name;
      exports$1.isPR = checkPR(vendor);
      exports$1.id = vendor.constant;
    });
    exports$1.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
    (env.BUILD_ID || // Jenkins, Cloudbees
    env.BUILD_NUMBER || // Jenkins, TeamCity
    env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers
    env.CI_APP_ID || // Appflow
    env.CI_BUILD_ID || // Appflow
    env.CI_BUILD_NUMBER || // Appflow
    env.CI_NAME || // Codeship and others
    env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
    env.RUN_ID || // TaskCluster, dsari
    exports$1.name || false));
    function checkEnv(obj) {
      if (typeof obj === "string") return !!env[obj];
      if ("env" in obj) {
        return env[obj.env] && env[obj.env].includes(obj.includes);
      }
      if ("any" in obj) {
        return obj.any.some(function(k) {
          return !!env[k];
        });
      }
      return Object.keys(obj).every(function(k) {
        return env[k] === obj[k];
      });
    }
    function checkPR(vendor) {
      switch (typeof vendor.pr) {
        case "string":
          return !!env[vendor.pr];
        case "object":
          if ("env" in vendor.pr) {
            if ("any" in vendor.pr) {
              return vendor.pr.any.some(function(key) {
                return env[vendor.pr.env] === key;
              });
            } else {
              return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
            }
          } else if ("any" in vendor.pr) {
            return vendor.pr.any.some(function(key) {
              return !!env[key];
            });
          } else {
            return checkEnv(vendor.pr);
          }
        default:
          return null;
      }
    }
  }
});
var require_is_ci = __commonJS({
  "../../node_modules/is-ci/index.js"(exports$1, module) {
    module.exports = require_ci_info().isCI;
  }
});
var import_esbuild_plugin_vue3 = __toESM(require_dist());
var import_is_ci = __toESM(require_is_ci());
var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
var HTML_REPLACEMENTS = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;"
};
function escapeHtml(str) {
  return str.replace(HTML_ESCAPE_REPLACE_RE, (ch) => HTML_REPLACEMENTS[ch]);
}
var counter = 1;
function getUniqueId(slug, fingerprint) {
  return crypto.createHash("md5").update(slug).update(fingerprint).update(String(counter++)).digest("hex").slice(0, 6);
}
function generateCode(options) {
  const { slug, fingerprint, code, filename, setupPath } = options;
  const id = getUniqueId(slug, fingerprint);
  const exampleId = `example-${id}`;
  const selector = `#${exampleId}`;
  const asset = `${slug}-${id}.js`;
  const { descriptor, errors } = parse(code, { filename });
  const scopeId = `data-v-${id}`;
  if (errors.length > 0) {
    if (import_is_ci.default) {
      const first = errors[0].message;
      throw new Error(
        `Errors occurred when trying to parse "${filename}": ${first}`
      );
    }
    const lines = errors.map((it) => `  ${it.message}`);
    const escaped = lines.map(escapeHtml);
    return {
      markup: `<strong style="color: red">Vue compiler error</strong>:<br><pre>${escaped.join("\n")}</pre>`,
      sourcecode: `Vue compiler error:
${lines.join("\n")}`,
      output: false
    };
  }
  const hasScoped = descriptor.styles.some((e) => e.scoped);
  const styleContent = descriptor.styles.map((stylePart) => {
    const compiledStyle = compileStyle({
      filename: descriptor.filename,
      source: stylePart.content,
      isProd: false,
      id: scopeId,
      scoped: stylePart.scoped,
      trim: true
    });
    return compiledStyle.code;
  }).join("\n");
  let sourcecode = `import { setup } from "${setupPath}";
`;
  let bindings = void 0;
  if (descriptor.script || descriptor.scriptSetup) {
    const script = compileScript(descriptor, {
      id: scopeId,
      isProd: false,
      sourceMap: false,
      inlineTemplate: false,
      genDefaultAs: "exampleComponent",
      templateOptions: {
        id: scopeId,
        filename,
        source: descriptor.template?.content,
        scoped: hasScoped,
        slotted: descriptor.slotted,
        compilerOptions: {
          comments: false,
          whitespace: "condense",
          scopeId: hasScoped ? scopeId : void 0,
          mode: "module"
        }
      }
    });
    bindings = script.bindings;
    sourcecode += script.content;
    sourcecode += "\n\n";
  } else {
    sourcecode += `const exampleComponent = {};

`;
  }
  if (descriptor.template) {
    const template = compileTemplate({
      id: scopeId,
      filename,
      source: descriptor.template.content,
      scoped: hasScoped,
      slotted: descriptor.slotted,
      preprocessLang: descriptor.template.lang,
      compilerOptions: {
        bindingMetadata: bindings,
        comments: false,
        whitespace: "condense",
        scopeId: hasScoped ? scopeId : void 0,
        mode: "module"
      }
    });
    sourcecode += `${template.code}

`;
    sourcecode += `exampleComponent.render = render;
`;
  }
  if (hasScoped) {
    sourcecode += `exampleComponent.__scopeId = "${scopeId}";
`;
  }
  sourcecode += `
setup({
  rootComponent: exampleComponent,
  selector: "${selector}"
});
`;
  const markup = (
    /* HTML */
    `
        <div id="${exampleId}"></div>
        <!-- [html-validate-disable-next element-permitted-content -- technical debt, should be inserted into <head>] -->
        <style>
            ${styleContent}
        </style>
        <!-- [html-validate-disable-next require-sri -- technical debt, should generate integrity but we don't know the hash of the compiled file yet] -->
        <script type="module" src="./${asset}"></script>
    `
  );
  return {
    markup,
    sourcecode,
    output: asset
  };
}
var export_vuePlugin = import_esbuild_plugin_vue3.default;

export { export_vuePlugin as e, generateCode as g };
//# sourceMappingURL=vue3-DtTC1eal.mjs.map
