@jsarc/cp-request 0.0.0

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
+ let globalFunct=(e=>{let G=["en","fr"],_="%Y-%m-%dT%H:%M:%S.%fZ";var t="%Y/%m/%d",r="%H:%M:%S.%f",i=["0","1","2","3","4","5","6","7","8","9"],a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],s=[...a,...a.map(e=>e.toUpperCase())];[...i,...a],[...i,...s];let V={arrayFormat:"bracket",arraySeparator:",",skipNull:!0,skipEmptyString:!1,encode:!0,decode:!0,depth:10};class o{options;constructor(e={}){this.options={...V,...e}}stringify(e){return e&&"object"==typeof e&&(this.processObject("",e,e=[],0),0<e.length)?"?"+e.join("&"):""}parse(e){if(!e||"string"!=typeof e)return{};e=e.startsWith("?")?e.slice(1):e;if(!e)return{};var t,r,i,a={};for(t of e.split("&"))t&&([r,i]=t.split("="),r)&&(r=this.options.decode?decodeURIComponent(r):r,i=this.options.decode&&void 0!==i?decodeURIComponent(i):i,this.setValue(a,r,i));return this.transformArrays(a)}processObject(e,t,r,i){if(i>this.options.depth)console.warn("Qust: Profondeur maximale atteinte, arrêt de la récursion");else if(null==t)this.options.skipNull||r.push(this.encodeKey(e));else if("string"!=typeof t||""!==t||!this.options.skipEmptyString)if(Array.isArray(t))this.processArray(e,t,r,i+1);else if("object"!=typeof t||this.isPrimitive(t)){var a=this.encodeKey(e),_=(this.options.encode&&"string"==typeof t?encodeURIComponent:String)(t);r.push(a+"="+_)}else for(var[s,o]of Object.entries(t)){s=e?`${e}[${s}]`:s;this.processObject(s,o,r,i+1)}}processArray(r,e,i,a){if(0!==e.length){let t=this.encodeKey(r);switch(this.options.arrayFormat){case"comma":var _=e.map(e=>(this.options.encode&&"string"==typeof e?encodeURIComponent:String)(e)).join(this.options.arraySeparator);i.push(t+"="+_);break;case"index":e.forEach((e,t)=>{this.processObject(r+`[${t}]`,e,i,a)});break;case"separator":e.forEach(e=>{e=(this.options.encode&&"string"==typeof e?encodeURIComponent:String)(e);i.push(t+"="+e)});break;case"none":e.forEach(e=>{this.processObject(r,e,i,a)});break;default:e.forEach(e=>{this.processObject(r+"[]",e,i,a)})}}}encodeKey(t){if(!this.options.encode)return t;var r=[];let i="";for(let e=0;e<t.length;e++){var a=t[e];"["===a||"]"===a?(i&&(r.push(encodeURIComponent(i)),i=""),r.push(a)):i+=a}return i&&r.push(encodeURIComponent(i)),r.join("")}setValue(e,t,r){var i=t.match(/([^\[\]]+)|(\[\])/g);if(i){let t=e;for(let e=0;e<i.length;e++){var a,_,s=i[e],o=e===i.length-1;"[]"===s?(Array.isArray(t)||(t=[]),o?r&&t.push(this.parseValue(r)):(a=i[e+1],a=parseInt(a,10),isNaN(a)?(_={},t.push(_),t=_):(void 0===t[a]&&(t[a]={}),t=t[a],e++))):o?void 0!==r&&(t[s]=this.parseValue(r)):(void 0!==t[s]&&"object"==typeof t[s]||(_=i[e+1],t[s]="[]"===_?[]:{}),t=t[s])}}else void 0!==r&&(e[t]=this.parseValue(r))}transformArrays(i){if(Array.isArray(i))return i.map(e=>"object"==typeof e&&null!==e?this.transformArrays(e):e);if("object"!=typeof i||null===i)return i;let r={};var e=Object.keys(i);if(e.every(e=>{var t=parseInt(e,10);return!isNaN(t)&&0<=t&&t.toString()===e})&&0<e.length){let r=[];return e.forEach(e=>{var t=parseInt(e,10);r[t]=this.transformArrays(i[e])}),r}return e.forEach(e=>{var t=i[e];r[e]="object"==typeof t&&null!==t?this.transformArrays(t):t}),r}parseValue(e){var t;return"true"===e||"false"!==e&&("null"===e?null:"undefined"!==e?(t=Number(e),isNaN(t)||""===e.trim()?e:t):void 0)}isPrimitive(e){return null===e||"object"!=typeof e&&"function"!=typeof e}setOptions(e){this.options={...this.options,...e}}getOptions(){return{...this.options}}static exposeToGlobal(){"undefined"!=typeof window&&(window.Qust=o)}}let w={stringify(e,t){return new o(t).stringify(e)},parse(e,t){return new o(t).parse(e)}};"undefined"!=typeof window&&(window.Qust=o,window.qust=w);class C{static PROTOCOL_REGEX=new RegExp("^[a-zA-Z]+://");static DOUBLE_SLASH_REGEX=new RegExp("/+","g");static DOUBLE_BACKSLASH_REGEX=new RegExp("\\\\+","g");static TRAILING_SLASH_REGEX=new RegExp("/+$");static TRAILING_BACKSLASH_REGEX=new RegExp("\\\\+$");static LEADING_SLASH_REGEX=new RegExp("^/+");static WINDOWS_DRIVE_REGEX=new RegExp("^[a-zA-Z]:\\\\");static MIXED_SEPARATORS_REGEX=new RegExp("[\\\\/]+","g");static join(...r){if(0!==r.length){let t=r.some(e=>this.isWindowsPath(e));var i=r.filter(e=>null!=e&&0<e.trim().length).map(e=>this.normalizePathSegment(e,t));if(0!==i.length){var a=t?"\\":"/";let e=i.join(a);return t?e=e.replace(this.DOUBLE_BACKSLASH_REGEX,"\\"):(e=e.replace(this.DOUBLE_SLASH_REGEX,"/"),r[0]?.startsWith("/")&&!e.startsWith("/")&&(e="/"+e)),e||void 0}}}static joinWithHost(e,...t){var r;return e&&0!==e.trim().length?(e=e.trim().replace(this.TRAILING_SLASH_REGEX,""),e=this.PROTOCOL_REGEX.test(e)?e:"https: