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

2 lines
12 KiB
JavaScript
Raw Normal View History

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