import{r as y}from"./65a4334c77c37b57961728e0a7a6ff53.js";var h={},c;function m(){if(c)return h;c=1;var t=y().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function a(a){var i=s(a);if("string"!=typeof i&&(t.isEncoding===e||!e(a)))throw new Error("Unknown encoding: "+a);return i||a}function i(e){var s;switch(this.encoding=a(e),this.encoding){case"utf16le":this.text=d,this.end=g,s=4;break;case"utf8":this.fillLast=o,s=4;break;case"base64":this.text=N,this.end=v,s=3;break;default:return this.write=C,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(s)}function r(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t,e,s){var a=e.length-1;if(a<s)return 0;var i=r(e[a]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--a<s||-2===i?0:(i=r(e[a]))>=0?(i>0&&(t.lastNeed=i-2),i):--a<s||-2===i?0:(i=r(e[a]))>=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}function l(t,e,s){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}function o(t){var e=this.lastTotal-this.lastNeed,s=l(this,t);return void 0!==s?s:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){var s=n(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=s;var a=t.length-(s-this.lastNeed);return t.copy(this.lastChar,0,a),t.toString("utf8",e,a)}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function d(t,e){if((t.length-e)%2==0){var s=t.toString("utf16le",e);if(s){var a=s.charCodeAt(s.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],s.slice(0,-1)}return s}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function g(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var s=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,s)}return e}function N(t,e){var s=(t.length-e)%3;return 0===s?t.toString("base64",e):(this.lastNeed=3-s,this.lastTotal=3,1===s?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-s))}function v(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function C(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}return h.StringDecoder=i,i.prototype.write=function(t){if(0===t.length)return"";var e,s;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";s=this.lastNeed,this.lastNeed=0}else s=0;return s<t.length?e?e+this.text(t,s):this.text(t,s):e||""},i.prototype.end=f,i.prototype.text=u,i.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},h}export{m as r};