| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659 | import "./chunk-Y2F7D3TJ.js";// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/utils.jsvar toString = Object.prototype.toString;function isArray(val) {  return toString.call(val) === "[object Array]";}function isObject(val) {  return val !== null && typeof val === "object";}function isDate(val) {  return toString.call(val) === "[object Date]";}function isURLSearchParams(val) {  return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;}function forEach(obj, fn) {  if (obj === null || typeof obj === "undefined") {    return;  }  if (typeof obj !== "object") {    obj = [obj];  }  if (isArray(obj)) {    for (var i = 0, l = obj.length; i < l; i++) {      fn.call(null, obj[i], i, obj);    }  } else {    for (var key in obj) {      if (Object.prototype.hasOwnProperty.call(obj, key)) {        fn.call(null, obj[key], key, obj);      }    }  }}function isPlainObject(obj) {  return Object.prototype.toString.call(obj) === "[object Object]";}function deepMerge() {  let result = {};  function assignValue(val, key) {    if (typeof result[key] === "object" && typeof val === "object") {      result[key] = deepMerge(result[key], val);    } else if (typeof val === "object") {      result[key] = deepMerge({}, val);    } else {      result[key] = val;    }  }  for (let i = 0, l = arguments.length; i < l; i++) {    forEach(arguments[i], assignValue);  }  return result;}function isUndefined(val) {  return typeof val === "undefined";}// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/helpers/buildURL.jsfunction encode(val) {  return encodeURIComponent(val).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");}function buildURL(url, params, paramsSerializer) {  if (!params) {    return url;  }  var serializedParams;  if (paramsSerializer) {    serializedParams = paramsSerializer(params);  } else if (isURLSearchParams(params)) {    serializedParams = params.toString();  } else {    var parts = [];    forEach(params, function serialize(val, key) {      if (val === null || typeof val === "undefined") {        return;      }      if (isArray(val)) {        key = key + "[]";      } else {        val = [val];      }      forEach(val, function parseValue(v) {        if (isDate(v)) {          v = v.toISOString();        } else if (isObject(v)) {          v = JSON.stringify(v);        }        parts.push(encode(key) + "=" + encode(v));      });    });    serializedParams = parts.join("&");  }  if (serializedParams) {    var hashmarkIndex = url.indexOf("#");    if (hashmarkIndex !== -1) {      url = url.slice(0, hashmarkIndex);    }    url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;  }  return url;}// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/helpers/isAbsoluteURL.jsfunction isAbsoluteURL(url) {  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);}// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/helpers/combineURLs.jsfunction combineURLs(baseURL, relativeURL) {  return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;}// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/core/buildFullPath.jsfunction buildFullPath(baseURL, requestedURL) {  if (baseURL && !isAbsoluteURL(requestedURL)) {    return combineURLs(baseURL, requestedURL);  }  return requestedURL;}// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/core/settle.jsfunction settle(resolve, reject, response) {  const validateStatus2 = response.config.validateStatus;  const status = response.statusCode;  if (status && (!validateStatus2 || validateStatus2(status))) {    resolve(response);  } else {    reject(response);  }}// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/adapters/index.jsvar mergeKeys = (keys, config2) => {  let config = {};  keys.forEach((prop) => {    if (!isUndefined(config2[prop])) {      config[prop] = config2[prop];    }  });  return config;};var adapters_default = (config) => {  return new Promise((resolve, reject) => {    let fullPath = buildURL(buildFullPath(config.baseURL, config.url), config.params, config.paramsSerializer);    const _config = {      url: fullPath,      header: config.header,      complete: (response) => {        config.fullPath = fullPath;        response.config = config;        response.rawData = response.data;        try {          let jsonParseHandle = false;          const forcedJSONParsingType = typeof config.forcedJSONParsing;          if (forcedJSONParsingType === "boolean") {            jsonParseHandle = config.forcedJSONParsing;          } else if (forcedJSONParsingType === "object") {            const includesMethod = config.forcedJSONParsing.include || [];            jsonParseHandle = includesMethod.includes(config.method);          }          if (jsonParseHandle && typeof response.data === "string") {            response.data = JSON.parse(response.data);          }        } catch (e) {        }        settle(resolve, reject, response);      }    };    let requestTask;    if (config.method === "UPLOAD") {      delete _config.header["content-type"];      delete _config.header["Content-Type"];      let otherConfig = {        filePath: config.filePath,        name: config.name      };      const optionalKeys = [        "files",        "file",        "timeout",        "formData"      ];      requestTask = uni.uploadFile({ ..._config, ...otherConfig, ...mergeKeys(optionalKeys, config) });    } else if (config.method === "DOWNLOAD") {      const optionalKeys = [        "timeout"      ];      requestTask = uni.downloadFile({ ..._config, ...mergeKeys(optionalKeys, config) });    } else {      const optionalKeys = [        "data",        "method",        "timeout",        "dataType",        "responseType",        "withCredentials"      ];      requestTask = uni.request({ ..._config, ...mergeKeys(optionalKeys, config) });    }    if (config.getTask) {      config.getTask(requestTask, config);    }  });};// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/core/dispatchRequest.jsvar dispatchRequest_default = (config) => {  return adapters_default(config);};// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/core/InterceptorManager.jsfunction InterceptorManager() {  this.handlers = [];}InterceptorManager.prototype.use = function use(fulfilled, rejected) {  this.handlers.push({    fulfilled,    rejected  });  return this.handlers.length - 1;};InterceptorManager.prototype.eject = function eject(id) {  if (this.handlers[id]) {    this.handlers[id] = null;  }};InterceptorManager.prototype.forEach = function forEach2(fn) {  this.handlers.forEach((h) => {    if (h !== null) {      fn(h);    }  });};var InterceptorManager_default = InterceptorManager;// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/core/mergeConfig.jsvar mergeKeys2 = (keys, globalsConfig, config2) => {  let config = {};  keys.forEach((prop) => {    if (!isUndefined(config2[prop])) {      config[prop] = config2[prop];    } else if (!isUndefined(globalsConfig[prop])) {      config[prop] = globalsConfig[prop];    }  });  return config;};var mergeConfig_default = (globalsConfig, config2 = {}) => {  const method = config2.method || globalsConfig.method || "GET";  let config = {    baseURL: config2.baseURL || globalsConfig.baseURL || "",    method,    url: config2.url || "",    params: config2.params || {},    custom: { ...globalsConfig.custom || {}, ...config2.custom || {} },    header: deepMerge(globalsConfig.header || {}, config2.header || {})  };  const defaultToConfig2Keys = ["getTask", "validateStatus", "paramsSerializer", "forcedJSONParsing"];  config = { ...config, ...mergeKeys2(defaultToConfig2Keys, globalsConfig, config2) };  if (method === "DOWNLOAD") {    const downloadKeys = [      "timeout"    ];    config = { ...config, ...mergeKeys2(downloadKeys, globalsConfig, config2) };  } else if (method === "UPLOAD") {    delete config.header["content-type"];    delete config.header["Content-Type"];    const uploadKeys = [      "files",      "file",      "filePath",      "name",      "timeout",      "formData"    ];    uploadKeys.forEach((prop) => {      if (!isUndefined(config2[prop])) {        config[prop] = config2[prop];      }    });    if (isUndefined(config.timeout) && !isUndefined(globalsConfig.timeout)) {      config["timeout"] = globalsConfig["timeout"];    }  } else {    const defaultsKeys = [      "data",      "timeout",      "dataType",      "responseType",      "withCredentials"    ];    config = { ...config, ...mergeKeys2(defaultsKeys, globalsConfig, config2) };  }  return config;};// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/core/defaults.jsvar defaults_default = {  baseURL: "",  header: {},  method: "GET",  dataType: "json",  paramsSerializer: null,  responseType: "text",  custom: {},  timeout: 6e4,  withCredentials: false,  validateStatus: function validateStatus(status) {    return status >= 200 && status < 300;  },  // 是否尝试将响应数据json化  forcedJSONParsing: true};// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/utils/clone.jsvar clone = function() {  "use strict";  function _instanceof(obj, type) {    return type != null && obj instanceof type;  }  var nativeMap;  try {    nativeMap = Map;  } catch (_) {    nativeMap = function() {    };  }  var nativeSet;  try {    nativeSet = Set;  } catch (_) {    nativeSet = function() {    };  }  var nativePromise;  try {    nativePromise = Promise;  } catch (_) {    nativePromise = function() {    };  }  function clone2(parent, circular, depth, prototype, includeNonEnumerable) {    if (typeof circular === "object") {      depth = circular.depth;      prototype = circular.prototype;      includeNonEnumerable = circular.includeNonEnumerable;      circular = circular.circular;    }    var allParents = [];    var allChildren = [];    var useBuffer = typeof Buffer != "undefined";    if (typeof circular == "undefined")      circular = true;    if (typeof depth == "undefined")      depth = Infinity;    function _clone(parent2, depth2) {      if (parent2 === null)        return null;      if (depth2 === 0)        return parent2;      var child;      var proto;      if (typeof parent2 != "object") {        return parent2;      }      if (_instanceof(parent2, nativeMap)) {        child = new nativeMap();      } else if (_instanceof(parent2, nativeSet)) {        child = new nativeSet();      } else if (_instanceof(parent2, nativePromise)) {        child = new nativePromise(function(resolve, reject) {          parent2.then(function(value) {            resolve(_clone(value, depth2 - 1));          }, function(err) {            reject(_clone(err, depth2 - 1));          });        });      } else if (clone2.__isArray(parent2)) {        child = [];      } else if (clone2.__isRegExp(parent2)) {        child = new RegExp(parent2.source, __getRegExpFlags(parent2));        if (parent2.lastIndex)          child.lastIndex = parent2.lastIndex;      } else if (clone2.__isDate(parent2)) {        child = new Date(parent2.getTime());      } else if (useBuffer && Buffer.isBuffer(parent2)) {        if (Buffer.from) {          child = Buffer.from(parent2);        } else {          child = new Buffer(parent2.length);          parent2.copy(child);        }        return child;      } else if (_instanceof(parent2, Error)) {        child = Object.create(parent2);      } else {        if (typeof prototype == "undefined") {          proto = Object.getPrototypeOf(parent2);          child = Object.create(proto);        } else {          child = Object.create(prototype);          proto = prototype;        }      }      if (circular) {        var index = allParents.indexOf(parent2);        if (index != -1) {          return allChildren[index];        }        allParents.push(parent2);        allChildren.push(child);      }      if (_instanceof(parent2, nativeMap)) {        parent2.forEach(function(value, key) {          var keyChild = _clone(key, depth2 - 1);          var valueChild = _clone(value, depth2 - 1);          child.set(keyChild, valueChild);        });      }      if (_instanceof(parent2, nativeSet)) {        parent2.forEach(function(value) {          var entryChild = _clone(value, depth2 - 1);          child.add(entryChild);        });      }      for (var i in parent2) {        var attrs = Object.getOwnPropertyDescriptor(parent2, i);        if (attrs) {          child[i] = _clone(parent2[i], depth2 - 1);        }        try {          var objProperty = Object.getOwnPropertyDescriptor(parent2, i);          if (objProperty.set === "undefined") {            continue;          }          child[i] = _clone(parent2[i], depth2 - 1);        } catch (e) {          if (e instanceof TypeError) {            continue;          } else if (e instanceof ReferenceError) {            continue;          }        }      }      if (Object.getOwnPropertySymbols) {        var symbols = Object.getOwnPropertySymbols(parent2);        for (var i = 0; i < symbols.length; i++) {          var symbol = symbols[i];          var descriptor = Object.getOwnPropertyDescriptor(parent2, symbol);          if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {            continue;          }          child[symbol] = _clone(parent2[symbol], depth2 - 1);          Object.defineProperty(child, symbol, descriptor);        }      }      if (includeNonEnumerable) {        var allPropertyNames = Object.getOwnPropertyNames(parent2);        for (var i = 0; i < allPropertyNames.length; i++) {          var propertyName = allPropertyNames[i];          var descriptor = Object.getOwnPropertyDescriptor(parent2, propertyName);          if (descriptor && descriptor.enumerable) {            continue;          }          child[propertyName] = _clone(parent2[propertyName], depth2 - 1);          Object.defineProperty(child, propertyName, descriptor);        }      }      return child;    }    return _clone(parent, depth);  }  clone2.clonePrototype = function clonePrototype(parent) {    if (parent === null)      return null;    var c = function() {    };    c.prototype = parent;    return new c();  };  function __objToStr(o) {    return Object.prototype.toString.call(o);  }  clone2.__objToStr = __objToStr;  function __isDate(o) {    return typeof o === "object" && __objToStr(o) === "[object Date]";  }  clone2.__isDate = __isDate;  function __isArray(o) {    return typeof o === "object" && __objToStr(o) === "[object Array]";  }  clone2.__isArray = __isArray;  function __isRegExp(o) {    return typeof o === "object" && __objToStr(o) === "[object RegExp]";  }  clone2.__isRegExp = __isRegExp;  function __getRegExpFlags(re) {    var flags = "";    if (re.global)      flags += "g";    if (re.ignoreCase)      flags += "i";    if (re.multiline)      flags += "m";    return flags;  }  clone2.__getRegExpFlags = __getRegExpFlags;  return clone2;}();var clone_default = clone;// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/core/Request.jsvar Request = class {  /**   * @param {Object} arg - 全局配置   * @param {String} arg.baseURL - 全局根路径   * @param {Object} arg.header - 全局header   * @param {String} arg.method = [GET|POST|PUT|DELETE|CONNECT|HEAD|OPTIONS|TRACE] - 全局默认请求方式   * @param {String} arg.dataType = [json] - 全局默认的dataType   * @param {String} arg.responseType = [text|arraybuffer] - 全局默认的responseType。支付宝小程序不支持   * @param {Object} arg.custom - 全局默认的自定义参数   * @param {Number} arg.timeout - 全局默认的超时时间,单位 ms。默认60000。H5(HBuilderX 2.9.9+)、APP(HBuilderX 2.9.9+)、微信小程序(2.10.0)、支付宝小程序   * @param {Boolean} arg.sslVerify - 全局默认的是否验证 ssl 证书。默认true.仅App安卓端支持(HBuilderX 2.3.3+)   * @param {Boolean} arg.withCredentials - 全局默认的跨域请求时是否携带凭证(cookies)。默认false。仅H5支持(HBuilderX 2.6.15+)   * @param {Boolean} arg.firstIpv4 - 全DNS解析时优先使用ipv4。默认false。仅 App-Android 支持 (HBuilderX 2.8.0+)   * @param {Function(statusCode):Boolean} arg.validateStatus - 全局默认的自定义验证器。默认statusCode >= 200 && statusCode < 300   */  constructor(arg = {}) {    if (!isPlainObject(arg)) {      arg = {};      console.warn("设置全局参数必须接收一个Object");    }    this.config = clone_default({ ...defaults_default, ...arg });    this.interceptors = {      request: new InterceptorManager_default(),      response: new InterceptorManager_default()    };  }  /**   * @Function   * @param {Request~setConfigCallback} f - 设置全局默认配置   */  setConfig(f) {    this.config = f(this.config);  }  middleware(config) {    config = mergeConfig_default(this.config, config);    let chain = [dispatchRequest_default, void 0];    let promise = Promise.resolve(config);    this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {      chain.unshift(interceptor.fulfilled, interceptor.rejected);    });    this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {      chain.push(interceptor.fulfilled, interceptor.rejected);    });    while (chain.length) {      promise = promise.then(chain.shift(), chain.shift());    }    return promise;  }  /**   * @Function   * @param {Object} config - 请求配置项   * @prop {String} options.url - 请求路径   * @prop {Object} options.data - 请求参数   * @prop {Object} [options.responseType = config.responseType] [text|arraybuffer] - 响应的数据类型   * @prop {Object} [options.dataType = config.dataType] - 如果设为 json,会尝试对返回的数据做一次 JSON.parse   * @prop {Object} [options.header = config.header] - 请求header   * @prop {Object} [options.method = config.method] - 请求方法   * @returns {Promise<unknown>}   */  request(config = {}) {    return this.middleware(config);  }  get(url, options = {}) {    return this.middleware({      url,      method: "GET",      ...options    });  }  post(url, data, options = {}) {    return this.middleware({      url,      data,      method: "POST",      ...options    });  }  put(url, data, options = {}) {    return this.middleware({      url,      data,      method: "PUT",      ...options    });  }  delete(url, data, options = {}) {    return this.middleware({      url,      data,      method: "DELETE",      ...options    });  }  connect(url, data, options = {}) {    return this.middleware({      url,      data,      method: "CONNECT",      ...options    });  }  head(url, data, options = {}) {    return this.middleware({      url,      data,      method: "HEAD",      ...options    });  }  options(url, data, options = {}) {    return this.middleware({      url,      data,      method: "OPTIONS",      ...options    });  }  trace(url, data, options = {}) {    return this.middleware({      url,      data,      method: "TRACE",      ...options    });  }  upload(url, config = {}) {    config.url = url;    config.method = "UPLOAD";    return this.middleware(config);  }  download(url, config = {}) {    config.url = url;    config.method = "DOWNLOAD";    return this.middleware(config);  }  get version() {    return "3.1.0";  }};// D:/zx/mall-front-app/node_modules/.pnpm/luch-request@3.1.1/node_modules/luch-request/src/lib/luch-request.jsvar luch_request_default = Request;export {  luch_request_default as default};//# sourceMappingURL=luch-request.js.map
 |