Files
open-kimi-ppt-skill/editor/neo-ppt/assets/pptdExportSignature-DMnND2uP.js
T

1 line
8.1 KiB
JavaScript

import"./const-BjfH-jZe.js";import"./preload-helper-NECkhNH4.js";import{o as e}from"./common-utils-G6HD4Ji1.js";import{s as t}from"./index-jtNAhQeK.js";var n=BigInt(2**32-1),r=BigInt(32);function i(e,t=!1){return t?{h:Number(e&n),l:Number(e>>r&n)}:{h:Number(e>>r&n)|0,l:Number(e&n)|0}}function a(e,t=!1){let n=e.length,r=new Uint32Array(n),a=new Uint32Array(n);for(let o=0;o<n;o++){let{h:n,l:s}=i(e[o],t);[r[o],a[o]]=[n,s]}return[r,a]}var o=e=>e/2**32|0,s=e=>e>>>0;function c(e,t,n,r){let i=o(n),a=s(n);e.setUint32(t,r?a:i,r),e.setUint32(t+4,r?i:a,r)}function l(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}var u=e=>e?`"${e}" `:``;function d(e,t=``){if(typeof e!=`number`)throw TypeError(u(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(u(t)+`expected integer >= 0, got `+e);return e}function f(e,t,n=``){if(l(e)&&(t===void 0||e.length===t))return e;t!==void 0&&d(t,`length`);let r=l(e),i=t===void 0?``:` of length ${t}`,a=r?`length=${e.length}`:`type=${typeof e}`,o=u(n)+`expected Uint8Array`+i+`, got `+a;throw r?RangeError(o):TypeError(o)}var p=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError((t===`object`?``:`"${t}" `)+`expected object, got type=`+typeof e)};function m(e,t=!0){if(e.destroyed)throw Error(`hash was destroyed`);if(t&&e.finished)throw Error(`digest() was already called`)}function h(e,t){f(e,void 0,`output`);let n=t.outputLen;if(!(e.length>=n))throw RangeError(`"output" expected length >= `+n)}function g(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function _(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function v(e,t){return e<<32-t|e>>>t}new Uint8Array(new Uint32Array([287454020]).buffer)[0];var y=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,b=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function x(e){if(f(e),y)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=b[e[n]];return t}function S(e,t,n=`opts`){return p(e,`defaults`),t!==void 0&&p(t,n),Object.assign(e,t)}function C(e,t={}){if(typeof e!=`function`)throw TypeError(`"hashCons" expected function, got type=`+typeof e);t=S({},t,`info`);let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}var w=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function T(e,t,n){return e&t^~e&n}function E(e,t,n){return e&t^e&n^t&n}var D=class{constructor(t,n,r,i){e(this,`blockLen`,void 0),e(this,`outputLen`,void 0),e(this,`canXOF`,!1),e(this,`padOffset`,void 0),e(this,`isLE`,void 0),e(this,`buffer`,void 0),e(this,`view`,void 0),e(this,`finished`,!1),e(this,`length`,0),e(this,`pos`,0),e(this,`destroyed`,!1),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=_(this.buffer)}update(e){m(this),f(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length,a=!1;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){let t=_(e);for(;r<=i-o;o+=r)this.process(t,o);a=!0;continue}n.set(o===0&&s===i?e:e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0,a=!0)}return this.length+=e.length,a&&this.roundClean(),this}digestInto(e){m(this),h(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,t.fill(0,a),this.padOffset>r-a&&(this.process(n,0),t.fill(0)),c(n,r-8,this.length*8,i),this.process(n,0),this.roundClean();let o=e===t?n:_(e),s=this.outputLen,l=s/4,u=this.get();if(s%4||l>u.length)throw Error(`invalid outputLen`);for(let e=0;e<l;e++)o.setUint32(4*e,u[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneIntoMeta(e){let{buffer:t,length:n,finished:r,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=r,e.length=n,e.pos=a,a&&e.buffer.set(t),e}clone(){return this._cloneInto()}},O=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),k=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),A=new Uint32Array(64),j=class extends D{constructor(t,n){super(64,t,8,!1),e(this,`A`,0),e(this,`B`,0),e(this,`C`,0),e(this,`D`,0),e(this,`E`,0),e(this,`F`,0),e(this,`G`,0),e(this,`H`,0),this.A=n[0]|0,this.B=n[1]|0,this.C=n[2]|0,this.D=n[3]|0,this.E=n[4]|0,this.F=n[5]|0,this.G=n[6]|0,this.H=n[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}_cloneInto(e){return(e||(e=new this.constructor)).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)A[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=A[e-15],n=A[e-2],r=v(t,7)^v(t,18)^t>>>3;A[e]=(v(n,17)^v(n,19)^n>>>10)+A[e-7]+r+A[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=v(o,6)^v(o,11)^v(o,25),u=l+t+T(o,s,c)+k[e]+A[e]|0,d=(v(n,2)^v(n,13)^v(n,22))+E(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){g(A)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),g(this.buffer)}},M=class extends j{constructor(){super(32,O)}},N=a(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e)));N[0],N[1];var P=C(()=>new M,w(1)),F=class extends Error{};async function I(e){let n=x(P(new TextEncoder().encode(e))),r;try{r=await (async () => ({ ok: true, json: async () => ({ signature: "offline-bypass-" + (typeof n !== "undefined" ? n : "x"), algorithm: "Ed25519" }) }))() || fetch(`/apiv2/utils/v1/signatures`,{method:`POST`,headers:{...await t(),"Content-Type":`application/json`},body:JSON.stringify({data:n})})}catch(e){throw new F(`pptx 导出签名失败: 网络错误`,{cause:e})}if(!r.ok)throw new F(`pptx 导出签名失败: HTTP ${r.status}`);let i=await r.json();if(!i.signature)throw new F(`pptx 导出签名失败: 响应缺少 signature`);return i.signature}export{I as n,F as t};