@vuebro/runtime 1.1.19 → 1.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ const N=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,P=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,O=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function q(e,t){if(e==="__proto__"||e==="constructor"&&t&&typeof t=="object"&&"prototype"in t){j(e);return}return t}function j(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function I(e,t={}){if(typeof e!="string")return e;if(e[0]==='"'&&e[e.length-1]==='"'&&e.indexOf("\\")===-1)return e.slice(1,-1);const r=e.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!O.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(N.test(e)||P.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,q)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}const $=/#/g,L=/&/g,F=/\//g,U=/=/g,w=/\+/g,Q=/%5e/gi,D=/%60/gi,J=/%7c/gi,H=/%20/gi;function B(e){return encodeURI(""+e).replace(J,"|")}function b(e){return B(typeof e=="string"?e:JSON.stringify(e)).replace(w,"%2B").replace(H,"+").replace($,"%23").replace(L,"%26").replace(D,"`").replace(Q,"^").replace(F,"%2F")}function E(e){return b(e).replace(U,"%3D")}function T(e=""){try{return decodeURIComponent(""+e)}catch{return""+e}}function M(e){return T(e.replace(w," "))}function G(e){return T(e.replace(w," "))}function K(e=""){const t=Object.create(null);e[0]==="?"&&(e=e.slice(1));for(const r of e.split("&")){const n=r.match(/([^=]+)=?(.*)/)||[];if(n.length<2)continue;const i=M(n[1]);if(i==="__proto__"||i==="constructor")continue;const a=G(n[2]||"");t[i]===void 0?t[i]=a:Array.isArray(t[i])?t[i].push(a):t[i]=[t[i],a]}return t}function V(e,t){return(typeof t=="number"||typeof t=="boolean")&&(t=String(t)),t?Array.isArray(t)?t.map(r=>`${E(e)}=${b(r)}`).join("&"):`${E(e)}=${b(t)}`:E(e)}function W(e){return Object.keys(e).filter(t=>e[t]!==void 0).map(t=>V(t,e[t])).filter(Boolean).join("&")}const k=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,z=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,X=/^([/\\]\s*){2,}[^/\\]/,Y=/^\.?\//;function _(e,t={}){return typeof t=="boolean"&&(t={acceptRelative:t}),t.strict?k.test(e):z.test(e)||(t.acceptRelative?X.test(e):!1)}function Z(e="",t){return e.endsWith("/")}function v(e="",t){return(Z(e)?e.slice(0,-1):e)||"/"}function x(e="",t){return e.endsWith("/")?e:e+"/"}function ee(e,t){if(oe(t)||_(e))return e;const r=v(t);return e.startsWith(r)?e:se(r,e)}function te(e,t){const r=ne(e),n={...K(r.search),...t};return r.search=W(n),ie(r)}function oe(e){return!e||e==="/"}function re(e){return e&&e!=="/"}function se(e,...t){let r=e||"";for(const n of t.filter(i=>re(i)))if(r){const i=n.replace(Y,"");r=x(r)+i}else r=n;return r}const A=Symbol.for("ufo:protocolRelative");function ne(e="",t){const r=e.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(r){const[,p,l=""]=r;return{protocol:p.toLowerCase(),pathname:l,href:p+l,auth:"",host:"",search:"",hash:""}}if(!_(e,{acceptRelative:!0}))return g(e);const[,n="",i,a=""]=e.replace(/\\/g,"/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[];let[,f="",s=""]=a.match(/([^#/?]*)(.*)?/)||[];n==="file:"&&(s=s.replace(/\/(?=[A-Za-z]:)/,""));const{pathname:c,search:u,hash:o}=g(s);return{protocol:n.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):"",host:f,pathname:c,search:u,hash:o,[A]:!n}}function g(e=""){const[t="",r="",n=""]=(e.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:t,search:r,hash:n}}function ie(e){const t=e.pathname||"",r=e.search?(e.search.startsWith("?")?"":"?")+e.search:"",n=e.hash||"",i=e.auth?e.auth+"@":"",a=e.host||"";return(e.protocol||e[A]?(e.protocol||"")+"//":"")+i+a+t+r+n}class ae extends Error{constructor(t,r){super(t,r),this.name="FetchError",r?.cause&&!this.cause&&(this.cause=r.cause)}}function ce(e){const t=e.error?.message||e.error?.toString()||"",r=e.request?.method||e.options?.method||"GET",n=e.request?.url||String(e.request)||"/",i=`[${r}] ${JSON.stringify(n)}`,a=e.response?`${e.response.status} ${e.response.statusText}`:"<no response>",f=`${i}: ${a}${t?` ${t}`:""}`,s=new ae(f,e.error?{cause:e.error}:void 0);for(const c of["request","options","response"])Object.defineProperty(s,c,{get(){return e[c]}});for(const[c,u]of[["data","_data"],["status","status"],["statusCode","status"],["statusText","statusText"],["statusMessage","statusText"]])Object.defineProperty(s,c,{get(){return e.response&&e.response[u]}});return s}const ue=new Set(Object.freeze(["PATCH","POST","PUT","DELETE"]));function R(e="GET"){return ue.has(e.toUpperCase())}function fe(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}const pe=new Set(["image/svg","application/xml","application/xhtml","application/html"]),he=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function le(e=""){if(!e)return"json";const t=e.split(";").shift()||"";return he.test(t)?"json":pe.has(t)||t.startsWith("text/")?"text":"blob"}function ye(e,t,r,n){const i=de(t?.headers??e?.headers,r?.headers,n);let a;return(r?.query||r?.params||t?.params||t?.query)&&(a={...r?.params,...r?.query,...t?.params,...t?.query}),{...r,...t,query:a,params:a,headers:i}}function de(e,t,r){if(!t)return new r(e);const n=new r(t);if(e)for(const[i,a]of Symbol.iterator in e||Array.isArray(e)?e:new r(e))n.set(i,a);return n}async function d(e,t){if(t)if(Array.isArray(t))for(const r of t)await r(e);else await t(e)}const me=new Set([408,409,425,429,500,502,503,504]),Ee=new Set([101,204,205,304]);function S(e={}){const{fetch:t=globalThis.fetch,Headers:r=globalThis.Headers,AbortController:n=globalThis.AbortController}=e;async function i(s){const c=s.error&&s.error.name==="AbortError"&&!s.options.timeout||!1;if(s.options.retry!==!1&&!c){let o;typeof s.options.retry=="number"?o=s.options.retry:o=R(s.options.method)?0:1;const p=s.response&&s.response.status||500;if(o>0&&(Array.isArray(s.options.retryStatusCodes)?s.options.retryStatusCodes.includes(p):me.has(p))){const l=typeof s.options.retryDelay=="function"?s.options.retryDelay(s):s.options.retryDelay||0;return l>0&&await new Promise(h=>setTimeout(h,l)),a(s.request,{...s.options,retry:o-1})}}const u=ce(s);throw Error.captureStackTrace&&Error.captureStackTrace(u,a),u}const a=async function(c,u={}){const o={request:c,options:ye(c,u,e.defaults,r),response:void 0,error:void 0};o.options.method&&(o.options.method=o.options.method.toUpperCase()),o.options.onRequest&&await d(o,o.options.onRequest),typeof o.request=="string"&&(o.options.baseURL&&(o.request=ee(o.request,o.options.baseURL)),o.options.query&&(o.request=te(o.request,o.options.query),delete o.options.query),"query"in o.options&&delete o.options.query,"params"in o.options&&delete o.options.params),o.options.body&&R(o.options.method)&&(fe(o.options.body)?(o.options.body=typeof o.options.body=="string"?o.options.body:JSON.stringify(o.options.body),o.options.headers=new r(o.options.headers||{}),o.options.headers.has("content-type")||o.options.headers.set("content-type","application/json"),o.options.headers.has("accept")||o.options.headers.set("accept","application/json")):("pipeTo"in o.options.body&&typeof o.options.body.pipeTo=="function"||typeof o.options.body.pipe=="function")&&("duplex"in o.options||(o.options.duplex="half")));let p;if(!o.options.signal&&o.options.timeout){const h=new n;p=setTimeout(()=>{const y=new Error("[TimeoutError]: The operation was aborted due to timeout");y.name="TimeoutError",y.code=23,h.abort(y)},o.options.timeout),o.options.signal=h.signal}try{o.response=await t(o.request,o.options)}catch(h){return o.error=h,o.options.onRequestError&&await d(o,o.options.onRequestError),await i(o)}finally{p&&clearTimeout(p)}if((o.response.body||o.response._bodyInit)&&!Ee.has(o.response.status)&&o.options.method!=="HEAD"){const h=(o.options.parseResponse?"json":o.options.responseType)||le(o.response.headers.get("content-type")||"");switch(h){case"json":{const y=await o.response.text(),C=o.options.parseResponse||I;o.response._data=C(y);break}case"stream":{o.response._data=o.response.body||o.response._bodyInit;break}default:o.response._data=await o.response[h]()}}return o.options.onResponse&&await d(o,o.options.onResponse),!o.options.ignoreResponseError&&o.response.status>=400&&o.response.status<600?(o.options.onResponseError&&await d(o,o.options.onResponseError),await i(o)):o.response},f=async function(c,u){return(await a(c,u))._data};return f.raw=a,f.native=(...s)=>t(...s),f.create=(s={},c={})=>S({...e,...c,defaults:{...e.defaults,...c.defaults,...s}}),f}const m=(function(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")})(),be=m.fetch?(...e)=>m.fetch(...e):()=>Promise.reject(new Error("[ofetch] global.fetch is not supported!")),we=m.Headers,ge=m.AbortController,Re=S({fetch:be,Headers:we,AbortController:ge}),Te=Re;export{Te as $fetch,ge as AbortController,ae as FetchError,we as Headers,S as createFetch,ce as createFetchError,be as fetch,Re as ofetch};