it-tools/dist/client/assets/chunks/chunk-157ebde1.js

23 lines
276 KiB
JavaScript
Raw Normal View History

2024-04-28 00:48:29 +08:00
import{e as Pi}from"./chunk-a740628f.js";import{r as ea}from"./chunk-44692048.js";var z={options:{usePureJavaScript:!1}},ta={},Vi=ta,ma={};ta.encode=function(e,t,a){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(a!==void 0&&typeof a!="number")throw new TypeError('"maxline" must be a number.');var r="";if(!(e instanceof Uint8Array))r=Oi(e,t);else{var i=0,s=t.length,n=t.charAt(0),o=[0];for(i=0;i<e.length;++i){for(var f=0,u=e[i];f<o.length;++f)u+=o[f]<<8,o[f]=u%s,u=u/s|0;for(;u>0;)o.push(u%s),u=u/s|0}for(i=0;e[i]===0&&i<e.length-1;++i)r+=n;for(i=o.length-1;i>=0;--i)r+=t[o[i]]}if(a){var l=new RegExp(".{1,"+a+"}","g");r=r.match(l).join(`\r
`)}return r};ta.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var a=ma[t];if(!a){a=ma[t]=[];for(var r=0;r<t.length;++r)a[t.charCodeAt(r)]=r}e=e.replace(/\s/g,"");for(var i=t.length,s=t.charAt(0),n=[0],r=0;r<e.length;r++){var o=a[e.charCodeAt(r)];if(o===void 0)return;for(var f=0,u=o;f<n.length;++f)u+=n[f]*i,n[f]=u&255,u>>=8;for(;u>0;)n.push(u&255),u>>=8}for(var l=0;e[l]===s&&l<e.length-1;++l)n.push(0);return typeof Buffer<"u"?Buffer.from(n.reverse()):new Uint8Array(n.reverse())};function Oi(e,t){var a=0,r=t.length,i=t.charAt(0),s=[0];for(a=0;a<e.length();++a){for(var n=0,o=e.at(a);n<s.length;++n)o+=s[n]<<8,s[n]=o%r,o=o/r|0;for(;o>0;)s.push(o%r),o=o/r|0}var f="";for(a=0;e.at(a)===0&&a<e.length()-1;++a)f+=i;for(a=s.length-1;a>=0;--a)f+=t[s[a]];return f}var Ea=z,xa=Vi,E=Ea.util=Ea.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){E.nextTick=process.nextTick,typeof setImmediate=="function"?E.setImmediate=setImmediate:E.setImmediate=E.nextTick;return}if(typeof setImmediate=="function"){E.setImmediate=function(){return setImmediate.apply(void 0,arguments)},E.nextTick=function(n){return setImmediate(n)};return}if(E.setImmediate=function(n){setTimeout(n,0)},typeof window<"u"&&typeof window.postMessage=="function"){let n=function(o){if(o.source===window&&o.data===e){o.stopPropagation();var f=t.slice();t.length=0,f.forEach(function(u){u()})}};var e="forge.setImmediate",t=[];E.setImmediate=function(o){t.push(o),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",n,!0)}if(typeof MutationObserver<"u"){var a=Date.now(),r=!0,i=document.createElement("div"),t=[];new MutationObserver(function(){var o=t.slice();t.length=0,o.forEach(function(f){f()})}).observe(i,{attributes:!0});var s=E.setImmediate;E.setImmediate=function(o){Date.now()-a>15?(a=Date.now(),s(o)):(t.push(o),t.length===1&&i.setAttribute("a",r=!r))}}E.nextTick=E.setImmediate})();E.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;E.globalScope=function(){return E.isNodejs?Pi:typeof self>"u"?window:self}();E.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};E.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer};E.isArrayBufferView=function(e){return e&&E.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function er(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}E.ByteBuffer=ra;function ra(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(E.isArrayBuffer(e)||E.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof ra||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}E.ByteStringBuffer=ra;var Fi=4096;E.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>Fi&&(this.data.substr(0,1),this._constructedStringLength=0)};E.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};E.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};E.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))};E.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var a=this.data;t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return this.data=a,this._optimizeConstructedString(t),this};E.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this};E.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(E.encodeUtf8(e))};E.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};E.ByteStringBuffer
`,a=a.substr(t));return r+=a,r};E.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",a,r,i,s,n=0;n<e.length;)a=gt[e.charCodeAt(n++)-43],r=gt[e.charCodeAt(n++)-43],i=gt[e.charCodeAt(n++)-43],s=gt[e.charCodeAt(n++)-43],t+=String.fromCharCode(a<<2|r>>4),i!==64&&(t+=String.fromCharCode((r&15)<<4|i>>2),s!==64&&(t+=String.fromCharCode((i&3)<<6|s)));return t};E.encodeUtf8=function(e){return unescape(encodeURIComponent(e))};E.decodeUtf8=function(e){return decodeURIComponent(escape(e))};E.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:xa.encode,decode:xa.decode}};E.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)};E.binary.raw.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var i=a,s=0;s<e.length;++s)r[i++]=e.charCodeAt(s);return t?i-a:r};E.binary.hex.encode=E.bytesToHex;E.binary.hex.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2))),a=a||0;var i=0,s=a;for(e.length&1&&(i=1,r[s++]=parseInt(e[0],16));i<e.length;i+=2)r[s++]=parseInt(e.substr(i,2),16);return t?s-a:r};E.binary.base64.encode=function(e,t){for(var a="",r="",i,s,n,o=0;o<e.byteLength;)i=e[o++],s=e[o++],n=e[o++],a+=yt.charAt(i>>2),a+=yt.charAt((i&3)<<4|s>>4),isNaN(s)?a+="==":(a+=yt.charAt((s&15)<<2|n>>6),a+=isNaN(n)?"=":yt.charAt(n&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
`,a=a.substr(t));return r+=a,r};E.binary.base64.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),a=a||0;for(var i,s,n,o,f=0,u=a;f<e.length;)i=gt[e.charCodeAt(f++)-43],s=gt[e.charCodeAt(f++)-43],n=gt[e.charCodeAt(f++)-43],o=gt[e.charCodeAt(f++)-43],r[u++]=i<<2|s>>4,n!==64&&(r[u++]=(s&15)<<4|n>>2,o!==64&&(r[u++]=(n&3)<<6|o));return t?u-a:r.subarray(0,u)};E.binary.base58.encode=function(e,t){return E.binary.baseN.encode(e,za,t)};E.binary.base58.decode=function(e,t){return E.binary.baseN.decode(e,za,t)};E.text={utf8:{},utf16:{}};E.text.utf8.encode=function(e,t,a){e=E.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var i=a,s=0;s<e.length;++s)r[i++]=e.charCodeAt(s);return t?i-a:r};E.text.utf8.decode=function(e){return E.decodeUtf8(String.fromCharCode.apply(null,e))};E.text.utf16.encode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length*2));var i=new Uint16Array(r.buffer);a=a||0;for(var s=a,n=a,o=0;o<e.length;++o)i[n++]=e.charCodeAt(o),s+=2;return t?s-a:r};E.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))};E.deflate=function(e,t,a){if(t=E.decode64(e.deflate(E.encode64(t)).rval),a){var r=2,i=t.charCodeAt(1);i&32&&(r=6),t=t.substring(r,t.length-4)}return t};E.inflate=function(e,t,a){var r=e.inflate(E.encode64(t)).rval;return r===null?null:E.decode64(r)};var aa=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var r;if(a===null?r=e.removeItem(t):(a=E.encode64(JSON.stringify(a)),r=e.setItem(t,a)),typeof r<"u"&&r.rval!==!0){var i=new Error(r.error.message);throw i.id=r.error.id,i.name=r.error.name,i}},ia=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(a.rval===null){if(a.error){var r=new Error(a.error.message);throw r.id=a.error.id,r.name=a.error.name,r}a=null}else a=a.rval;return a!==null&&(a=JSON.parse(E.decode64(a))),a},Mi=function(e,t,a,r){var i=ia(e,t);i===null&&(i={}),i[a]=r,aa(e,t,i)},Hi=function(e,t,a){var r=ia(e,t);return r!==null&&(r=a in r?r[a]:null),r},Gi=function(e,t,a){var r=ia(e,t);if(r!==null&&a in r){delete r[a];var i=!0;for(var s in r){i=!1;break}i&&(r=null),aa(e,t,r)}},qi=function(e,t){aa(e,t,null)},Er=function(e,t,a){var r=null;typeof a>"u"&&(a=["web","flash"]);var i,s=!1,n=null;for(var o in a){i=a[o];try{if(i==="flash"||i==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");r=e.apply(this,t),s=i==="flash"}(i==="web"||i==="both")&&(t[0]=localStorage,r=e.apply(this,t),s=!0)}catch(f){n=f}if(s)break}if(!s)throw n;return r};E.setItem=function(e,t,a,r,i){Er(Mi,arguments,i)};E.getItem=function(e,t,a,r){return Er(Hi,arguments,r)};E.removeItem=function(e,t,a,r){Er(Gi,arguments,r)};E.clearItems=function(e,t,a){Er(qi,arguments,a)};E.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};E.format=function(e){for(var t=/%./g,a,r,i=0,s=[],n=0;a=t.exec(e);){r=e.substring(n,t.lastIndex-2),r.length>0&&s.push(r),n=t.lastIndex;var o=a[0][1];switch(o){case"s":case"o":i<arguments.length?s.push(arguments[i+++1]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(e.substring(n)),s.join("")};E.formatNumber=function(e,t,a,r){var i=e,s=isNaN(t=Math.abs(t))?2:t,n=a===void 0?",":a,o=r===void 0?".":r,f=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",l=u.length>3?u.length%3:0;return f+(l?u.substr(0,l)+o:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?n+Math.abs(i-u).toFixed(s).slice(2):"")};E.formatSize=function(e){return e>=1073741824?e=E.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=E.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=E.formatNumber(e/1024,0)+" KiB":e=E.formatNumber(e,0)+" bytes",e};E.bytesFromIP=function(e){return e.indexOf(".")!==-1?E.bytesFromIPv4(e):e.indexOf(":")!==-1?E.bytesFromIPv6(e):null};E.bytesFromIPv4=function(e){if(e=e.split("."),e.length!==4)return null;for(var t=E.createBuffer(),a=0;a<e.length;++a){var r=parseInt(e[a],10);if(isNaN(r))return null;t.putByte(r)}return t.getBytes()};E.bytesFromIPv6=function(
`);for(var i="",s=0;s<t*a;++s)i+=" ";switch(r+=i+"Tag: ",e.tagClass){case U.Class.UNIVERSAL:r+="Universal:";break;case U.Class.APPLICATION:r+="Application:";break;case U.Class.CONTEXT_SPECIFIC:r+="Context-Specific:";break;case U.Class.PRIVATE:r+="Private:";break}if(e.tagClass===U.Class.UNIVERSAL)switch(r+=e.type,e.type){case U.Type.NONE:r+=" (None)";break;case U.Type.BOOLEAN:r+=" (Boolean)";break;case U.Type.INTEGER:r+=" (Integer)";break;case U.Type.BITSTRING:r+=" (Bit string)";break;case U.Type.OCTETSTRING:r+=" (Octet string)";break;case U.Type.NULL:r+=" (Null)";break;case U.Type.OID:r+=" (Object Identifier)";break;case U.Type.ODESC:r+=" (Object Descriptor)";break;case U.Type.EXTERNAL:r+=" (External or Instance of)";break;case U.Type.REAL:r+=" (Real)";break;case U.Type.ENUMERATED:r+=" (Enumerated)";break;case U.Type.EMBEDDED:r+=" (Embedded PDV)";break;case U.Type.UTF8:r+=" (UTF8)";break;case U.Type.ROID:r+=" (Relative Object Identifier)";break;case U.Type.SEQUENCE:r+=" (Sequence)";break;case U.Type.SET:r+=" (Set)";break;case U.Type.PRINTABLESTRING:r+=" (Printable String)";break;case U.Type.IA5String:r+=" (IA5String (ASCII))";break;case U.Type.UTCTIME:r+=" (UTC time)";break;case U.Type.GENERALIZEDTIME:r+=" (Generalized time)";break;case U.Type.BMPSTRING:r+=" (BMP String)";break}else r+=e.type;if(r+=`
`,r+=i+"Constructed: "+e.constructed+`
`,e.composed){for(var n=0,o="",s=0;s<e.value.length;++s)e.value[s]!==void 0&&(n+=1,o+=U.prettyPrint(e.value[s],t+1,a),s+1<e.value.length&&(o+=","));r+=i+"Sub values: "+n+o}else{if(r+=i+"Value: ",e.type===U.Type.OID){var f=U.derToOid(e.value);r+=f,fe.pki&&fe.pki.oids&&f in fe.pki.oids&&(r+=" ("+fe.pki.oids[f]+") ")}if(e.type===U.Type.INTEGER)try{r+=U.derToInteger(e.value)}catch{r+="0x"+fe.util.bytesToHex(e.value)}else if(e.type===U.Type.BITSTRING){if(e.value.length>1?r+="0x"+fe.util.bytesToHex(e.value.slice(1)):r+="(none)",e.value.length>0){var u=e.value.charCodeAt(0);u==1?r+=" (1 unused bit shown)":u>1&&(r+=" ("+u+" unused bits shown)")}}else if(e.type===U.Type.OCTETSTRING)Sa.test(e.value)||(r+="("+e.value+") "),r+="0x"+fe.util.bytesToHex(e.value);else if(e.type===U.Type.UTF8)try{r+=fe.util.decodeUtf8(e.value)}catch(l){if(l.message==="URI malformed")r+="0x"+fe.util.bytesToHex(e.value)+" (malformed UTF8)";else throw l}else e.type===U.Type.PRINTABLESTRING||e.type===U.Type.IA5String?r+=e.value:Sa.test(e.value)?r+="0x"+fe.util.bytesToHex(e.value):e.value.length===0?r+="[null]":r+=e.value}return r};var lr=z;lr.md=lr.md||{};lr.md.algorithms=lr.md.algorithms||{};var ct=z,zi=ct.hmac=ct.hmac||{};zi.create=function(){var e=null,t=null,a=null,r=null,i={};return i.start=function(s,n){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in ct.md.algorithms)t=ct.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else t=s;if(n===null)n=e;else{if(typeof n=="string")n=ct.util.createBuffer(n);else if(ct.util.isArray(n)){var o=n;n=ct.util.createBuffer();for(var f=0;f<o.length;++f)n.putByte(o[f])}var u=n.length();u>t.blockLength&&(t.start(),t.update(n.bytes()),n=t.digest()),a=ct.util.createBuffer(),r=ct.util.createBuffer(),u=n.length();for(var f=0;f<u;++f){var o=n.at(f);a.putByte(54^o),r.putByte(92^o)}if(u<t.blockLength)for(var o=t.blockLength-u,f=0;f<o;++f)a.putByte(54),r.putByte(92);e=n,a=a.bytes(),r=r.bytes()}t.start(),t.update(a)},i.update=function(s){t.update(s)},i.getMac=function(){var s=t.digest().bytes();return t.start(),t.update(r),t.update(s),t.digest()},i.digest=i.getMac,i};var nt=z,ja=nt.md5=nt.md5||{};nt.md.md5=nt.md.algorithms.md5=ja;ja.create=function(){$a||Yi();var e=null,t=nt.util.createBuffer(),a=new Array(16),r={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var i=r.messageLengthSize/4,s=0;s<i;++s)r.fullMessageLength.push(0);return t=nt.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},r},r.start(),r.update=function(i,s){s==="utf8"&&(i=nt.util.encodeUtf8(i));var n=i.length;r.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=n[1],n[1]=n[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,n[0]=n[1]/4294967296>>>0;return t.putBytes(i),Ta(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var i=nt.util.createBuffer();i.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,n=s&r.blockLength-1;i.putBytes(Kr.substr(0,r.blockLength-n));for(var o,f=0,u=r.fullMessageLength.length-1;u>=0;--u)o=r.fullMessageLength[u]*8+f,f=o/4294967296>>>0,i.putInt32Le(o>>>0);var l={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};Ta(l,a,i);var c=nt.util.createBuffer();return c.putInt32Le(l.h0),c.putInt32Le(l.h1),c.putInt32Le(l.h2),c.putInt32Le(l.h3),c},r};var Kr=null,ur=null,Wt=null,Pt=null,$a=!1;function Yi(){Kr=String.fromCharCode(128),Kr+=nt.util.fillString(String.fromCharCode(0),64),ur=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],Wt=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Pt=new Array(64);for(var e=0;e<64;++e)Pt[e]=Math.floor(Math.abs(Math.sin(e+
`,r;if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=ar(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=ar(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=ar(r)),e.headers)for(var i=0;i<e.headers.length;++i)a+=ar(e.headers[i]);return e.procType&&(a+=`\r
`),a+=cr.util.encode64(e.body,t.maxline||64)+`\r
`,a+="-----END "+e.type+`-----\r
`,a};Za.decode=function(e){for(var t=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/,s;s=a.exec(e),!!s;){var n=s[1];n==="NEW CERTIFICATE REQUEST"&&(n="CERTIFICATE REQUEST");var o={type:n,procType:null,contentDomain:null,dekInfo:null,headers:[],body:cr.util.decode64(s[3])};if(t.push(o),!!s[2]){for(var f=s[2].split(i),u=0;s&&u<f.length;){for(var l=f[u].replace(/\s+$/,""),c=u+1;c<f.length;++c){var v=f[c];if(!/\s/.test(v[0]))break;l+=v,u=c}if(s=l.match(r),s){for(var C={name:s[1],values:[]},y=s[2].split(","),x=0;x<y.length;++x)C.values.push(Xi(y[x]));if(o.procType)if(!o.contentDomain&&C.name==="Content-Domain")o.contentDomain=y[0]||"";else if(!o.dekInfo&&C.name==="DEK-Info"){if(C.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');o.dekInfo={algorithm:y[0],parameters:y[1]||null}}else o.headers.push(C);else{if(C.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(C.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');o.procType={version:y[0],type:y[1]}}}++u}if(o.procType==="ENCRYPTED"&&!o.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function ar(e){for(var t=e.name+": ",a=[],r=function(f,u){return" "+u},i=0;i<e.values.length;++i)a.push(e.values[i].replace(/^(\S+\r\n)/,r));t+=a.join(",")+`\r
`;for(var s=0,n=-1,i=0;i<t.length;++i,++s)if(s>65&&n!==-1){var o=t[n];o===","?(++n,t=t.substr(0,n)+`\r
`+t.substr(n)):t=t.substr(0,n)+`\r
`+o+t.substr(n+1),s=i-n-1,n=-1,++i}else(t[i]===" "||t[i]===" "||t[i]===",")&&(n=i);return t}function Xi(e){return e.replace(/^\s+/,"")}var ce=z;ce.des=ce.des||{};ce.des.startEncrypting=function(e,t,a,r){var i=Ir({key:e,output:a,decrypt:!1,mode:r||(t===null?"ECB":"CBC")});return i.start(t),i};ce.des.createEncryptionCipher=function(e,t){return Ir({key:e,output:null,decrypt:!1,mode:t})};ce.des.startDecrypting=function(e,t,a,r){var i=Ir({key:e,output:a,decrypt:!0,mode:r||(t===null?"ECB":"CBC")});return i.start(t),i};ce.des.createDecryptionCipher=function(e,t){return Ir({key:e,output:null,decrypt:!0,mode:t})};ce.des.Algorithm=function(e,t){var a=this;a.name=e,a.mode=new t({blockSize:8,cipher:{encrypt:function(r,i){return Ia(a._keys,r,i,!1)},decrypt:function(r,i){return Ia(a._keys,r,i,!0)}}}),a._init=!1};ce.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=ce.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=an(t),this._init=!0}};ft("DES-ECB",ce.cipher.modes.ecb);ft("DES-CBC",ce.cipher.modes.cbc);ft("DES-CFB",ce.cipher.modes.cfb);ft("DES-OFB",ce.cipher.modes.ofb);ft("DES-CTR",ce.cipher.modes.ctr);ft("3DES-ECB",ce.cipher.modes.ecb);ft("3DES-CBC",ce.cipher.modes.cbc);ft("3DES-CFB",ce.cipher.modes.cfb);ft("3DES-OFB",ce.cipher.modes.ofb);ft("3DES-CTR",ce.cipher.modes.ctr);function ft(e,t){var a=function(){return new ce.des.Algorithm(e,t)};ce.cipher.registerAlgorithm(e,a)}var Wi=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],ji=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],$i=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],Zi=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],Ji=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],en=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,53687092
`;s+="Encryption: "+i+`\r
`,s+="Comment: "+a+`\r
`;var n=ge.util.createBuffer();Ot(n,r),it(n,e.e),it(n,e.n);var o=ge.util.encode64(n.bytes(),64),f=Math.floor(o.length/66)+1;s+="Public-Lines: "+f+`\r
`,s+=o;var u=ge.util.createBuffer();it(u,e.d),it(u,e.p),it(u,e.q),it(u,e.qInv);var l;if(!t)l=ge.util.encode64(u.bytes(),64);else{var c=u.length()+16-1;c-=c%16;var v=sr(u.bytes());v.truncate(v.length()-c+u.length()),u.putBuffer(v);var C=ge.util.createBuffer();C.putBuffer(sr("\0\0\0\0",t)),C.putBuffer(sr("\0\0\0",t));var y=ge.aes.createEncryptionCipher(C.truncate(8),"CBC");y.start(ge.util.createBuffer().fillWithByte(0,16)),y.update(u.copy()),y.finish();var x=y.output;x.truncate(16),l=ge.util.encode64(x.bytes(),64)}f=Math.floor(l.length/66)+1,s+=`\r
Private-Lines: `+f+`\r
`,s+=l;var T=sr("putty-private-key-file-mac-key",t),I=ge.util.createBuffer();Ot(I,r),Ot(I,i),Ot(I,a),I.putInt32(n.length()),I.putBuffer(n),I.putInt32(u.length()),I.putBuffer(u);var B=ge.hmac.create();return B.start("sha1",T),B.update(I.bytes()),s+=`\r
Private-MAC: `+B.digest().toHex()+`\r
`,s};Nr.publicKeyToOpenSSH=function(e,t){var a="ssh-rsa";t=t||"";var r=ge.util.createBuffer();return Ot(r,a),it(r,e.e),it(r,e.n),a+" "+ge.util.encode64(r.bytes())+" "+t};Nr.privateKeyToOpenSSH=function(e,t){return t?ge.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):ge.pki.privateKeyToPem(e)};Nr.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||ge.md.md5.create(),r="ssh-rsa",i=ge.util.createBuffer();Ot(i,r),it(i,e.e),it(i,e.n),a.start(),a.update(i.getBytes());var s=a.digest();if(t.encoding==="hex"){var n=s.toHex();return t.delimiter?n.match(/.{2}/g).join(t.delimiter):n}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s};function it(e,t){var a=t.toString(16);a[0]>="8"&&(a="00"+a);var r=ge.util.hexToBytes(a);e.putInt32(r.length),e.putBytes(r)}function Ot(e,t){e.putInt32(t.length),e.putString(t)}function sr(){for(var e=ge.md.sha1.create(),t=arguments.length,a=0;a<t;++a)e.update(arguments[a]);return e.digest()}var bo=z;export{bo as l};