ff-request-dist/dist/ff-request.umd.cjs

2 lines
12 KiB
JavaScript
Raw Normal View History

2024-05-25 22:06:42 +08:00
(function(d,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(d=typeof globalThis<"u"?globalThis:d||self,w(d["ff-request"]={}))})(this,function(d){"use strict";var ye=Object.defineProperty;var be=(d,w,_)=>w in d?ye(d,w,{enumerable:!0,configurable:!0,writable:!0,value:_}):d[w]=_;var P=(d,w,_)=>(be(d,typeof w!="symbol"?w+"":w,_),_),le=(d,w,_)=>{if(!w.has(d))throw TypeError("Cannot "+_)};var u=(d,w,_)=>(le(d,w,"read from private field"),_?_.call(d):w.get(d)),N=(d,w,_)=>{if(w.has(d))throw TypeError("Cannot add the same private member more than once");w instanceof WeakSet?w.add(d):w.set(d,_)},D=(d,w,_,Y)=>(le(d,w,"write to private field"),Y?Y.call(d,_):w.set(d,_),_);var G,B,J,q,Q,W,L,X,Z,H,K,k,j,I;function w(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function _(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var s=0;s<t.length;s++){var l=t.charAt(s),y=l.charCodeAt(0);if(e[y]!==255)throw new TypeError(l+" is ambiguous");e[y]=s}var p=t.length,m=t.charAt(0),V=Math.log(p)/Math.log(256),z=Math.log(256)/Math.log(p);function F(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var i=0,o=0,c=0,a=f.length;c!==a&&f[c]===0;)c++,i++;for(var h=(a-c)*z+1>>>0,g=new Uint8Array(h);c!==a;){for(var A=f[c],T=0,b=h-1;(A!==0||T<o)&&b!==-1;b--,T++)A+=256*g[b]>>>0,g[b]=A%p>>>0,A=A/p>>>0;if(A!==0)throw new Error("Non-zero carry");o=T,c++}for(var n=h-o;n!==h&&g[n]===0;)n++;for(var E=m.repeat(i);n<h;++n)E+=t.charAt(g[n]);return E}function $(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;for(var i=0,o=0,c=0;f[i]===m;)o++,i++;for(var a=(f.length-i)*V+1>>>0,h=new Uint8Array(a);f[i];){var g=e[f.charCodeAt(i)];if(g===255)return;for(var A=0,T=a-1;(g!==0||A<c)&&T!==-1;T--,A++)g+=p*h[T]>>>0,h[T]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");c=A,i++}for(var b=a-c;b!==a&&h[b]===0;)b++;for(var n=new Uint8Array(o+(a-b)),E=o;b!==a;)n[E++]=h[b++];return n}function v(f){var i=$(f);if(i)return i;throw new Error("Non-base"+p+" character")}return{encode:F,decodeUnsafe:$,decode:v}}var Y=_;const ce=w(Y);var ne={};(function(t){(function(e){e([],function(){var r=-1,s=-2,l=-3,y=-4,p=-5,m=function(i,o){o=o||{};var c=o.verbose||!1;c&&console.log("Normalize the JSON Object"),i=typeof i=="string"?this.JSON.parse(i):i,c&&console.log("Creating a empty dictionary");var a={strings:[],integers:[],floats:[]};c&&console.log("Creating the AST");var h=function b(n){c&&console.log("Calling recursiveAstBuilder with "+this.JSON.stringify(n));var E=typeof n;if(n===null)return{type:"null",index:l};if(typeof n>"u")return{type:"undefined",index:p};if(n instanceof Array){var U=["@"];for(var S in n)n.hasOwnProperty(S)&&U.push(b(n[S]));return U}if(E==="object"){var U=["$"];for(var M in n)n.hasOwnProperty(M)&&(U.push(b(M)),U.push(b(n[M])));return U}if(n==="")return{type:"empty",index:y};if(E==="string"){var C=f.call(a.strings,n);return C==-1&&(a.strings.push(z(n)),C=a.strings.length-1),{type:"strings",index:C}}if(E==="number"&&n%1===0){var C=f.call(a.integers,n);return C==-1&&(a.integers.push($(n)),C=a.integers.length-1),{type:"integers",index:C}}if(E==="number"){var C=f.call(a.floats,n);return C==-1&&(a.floats.push(n),C=a.floats.length-1),{type:"floats",index:C}}if(E==="boolean")return{type:"boolean",index:n?r:s};throw new Error("Unexpected argument of type "+typeof n)}(i),g=a.strings.length,A=a.integers.length;a.floats.length,c&&console.log("Parsing the dictionary");var T=a.strings.join("|");return T+="^"+a.integers.join("|"),T+="^"+a.floats.join("|"),c&&console.log("Parsing the structure"),T+="^"+function b(n){if(c&&console.log("Calling a recursiveParser with "+this.JSON.stringify(n)),n instanceof Array){var E=n.shift();for(var U in n)n.hasOw