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

2 lines
12 KiB
JavaScript
Raw Normal View History

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