@apprun/shiqu 0.6.0 → 0.6.5

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,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/es-B0vSJwvP.js","assets/index-y4BxCnhg.js","assets/index-B0URXv2Q.css"])))=>i.map(i=>d[i]);
2
+ import{c as e,l as t,t as n}from"./index-y4BxCnhg.js";var r=900,i=1350,a=72,o=`"Noto Serif SC", "Songti SC", "STSong", serif`,s=`"Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif`;function c(e){return`sourceReference`in e&&typeof e.sourceReference==`string`?e.sourceReference:e.bookId===`zhongshanlang`?`《中山狼传》·马中锡《东田文集》`:e.id===`zhongli`&&e.bookId===`liaozhai`?`《聊斋志异·种梨》`:`原典见出处链接`}function l(e){return(e.replace(/[<>:"/\\|?*\u0000-\u001f]/g,``).trim().slice(0,60)||`拾趣故事`)+`-拾趣.pdf`}function u(e){if(!e.pages.length||e.pages.some(e=>!e.image))throw Error(`等所有画面生成完成后,就能导出完整 PDF。`)}function d(e,t,n){let r=[];for(let i of e.replace(/\r\n?/g,`
3
+ `).split(`
4
+ `)){let e=``;for(let a of Array.from(i))if(e&&n(e+a)>t)if(/[,。!?;:、)】》”’]/.test(a)&&e.length>1){let t=Array.from(e),n=t.pop();r.push(t.join(``)),e=n+a}else r.push(e),e=a;else e+=a;r.push(e)}return r}async function f(l,f=()=>{}){u(l);let{PDFDocument:p}=await n(async()=>{let{PDFDocument:e}=await import(`./es-B0vSJwvP.js`);return{PDFDocument:e}},__vite__mapDeps([0,1,2]));await document.fonts.ready;let m=await p.create();m.setTitle(l.title),m.setAuthor(l.publication?.author||`未署名`),m.setSubject(l.theme),m.setCreator(`拾趣故事阅读器`);let h=document.createElement(`canvas`);h.width=r,h.height=i;let g=h.getContext(`2d`);if(!g)throw Error(`当前浏览器暂不支持 PDF 导出,请换个浏览器试试。`);let _=g,v=(e,t=o)=>{_.font=`${e}px ${t}`,_.textBaseline=`top`},y=(e,t=r-2*a)=>d(e,t,e=>_.measureText(e).width);async function b(){let e=await new Promise((e,t)=>h.toBlob(n=>n?e(n):t(Error(`PDF 排版失败,请重试。`)),`image/jpeg`,.93)),t=await m.embedJpg(await e.arrayBuffer());m.addPage([360,540]).drawImage(t,{x:0,y:0,width:360,height:540})}try{for(let t=0;t<l.pages.length;t++){f(`正在整理第 ${t+1} / ${l.pages.length} 幅`);let n=l.pages[t],o=new URL(n.image,location.origin);if(o.origin!==location.origin)throw Error(`画面来源不可用,无法导出 PDF。`);let c=await fetch(o.href,{credentials:`same-origin`,signal:AbortSignal.timeout(3e4)});if(!c.ok)throw Error(`第 ${t+1} 幅读取失败,请保持联网后重试。`);let u=await c.blob();if(!/^image\/(png|jpeg|webp)(;|$)/.test(u.type))throw Error(`第 ${t+1} 幅画面暂不可用。`);let d=new Image,p=URL.createObjectURL(u);try{d.src=p,await d.decode();let e=Math.max(r/d.naturalWidth,i/d.naturalHeight),t=d.naturalWidth*e,n=d.naturalHeight*e;_.clearRect(0,0,r,i),_.drawImage(d,(r-t)/2,(i-n)/2,t,n)}finally{URL.revokeObjectURL(p)}let m=_.createLinearGradient(0,0,0,260);m.addColorStop(0,`rgba(14,34,25,.72)`),m.addColorStop(1,`rgba(14,34,25,0)`),_.fillStyle=m,_.fillRect(0,0,r,260),v(27,s),_.fillStyle=`#f1efdf`,y(l.title,r-2*a-120).forEach((e,t)=>_.fillText(e,a,55+t*39)),_.textAlign=`right`,_.fillText(`${String(t+1).padStart(2,`0`)} / ${l.pages.length}`,r-a,55),_.textAlign=`left`,v(42);let h=y(n.caption),g=i-140-h.length*65,x=_.createLinearGradient(0,Math.max(300,g-200),0,i);x.addColorStop(0,`rgba(14,34,25,0)`),x.addColorStop(.5,`rgba(14,34,25,.8)`),x.addColorStop(1,`rgba(14,34,25,.96)`),_.fillStyle=x,_.fillRect(0,Math.max(300,g-200),r,i),_.fillStyle=`#fff9e9`,h.forEach((e,t)=>_.fillText(e,a,g+t*65)),v(21,s),_.fillStyle=`#c7d1bc`,_.fillText(e(l),a,i-65,r-2*a),await b()}f(`正在整理余味与出处`);let n=0,o=0;function u(){_.fillStyle=`#f7f6ef`,_.fillRect(0,0,r,i),v(22,s),_.fillStyle=`#7b8b74`,_.fillText(`拾趣 / 故事之后`,a,50),_.textAlign=`right`,_.fillText(String(l.pages.length+1+ o++).padStart(2,`0`),r-a,50),_.textAlign=`left`,n=140}u();async function d(e,t,r=30){if(!t.trim())return;n>i-230&&(await b(),u()),v(22,s),_.fillStyle=`#8c7957`,_.fillText(e,a,n),n+=46,v(r);let o=y(t);for(let e of o)n>i-110&&(await b(),u(),v(r)),_.fillStyle=`#2a493b`,_.fillText(e,a,n),n+=r*1.75;n+=40}return await d(`留一点余味`,l.reflection,40),await d(`原典线索`,c(l)),await d(`关于这次改编`,l.adaptationNote.replace(`;当前可使用设备朗读试听。`,`。`)),await d(`署名与转载`,t(l),25),l.sourceUrl&&await d(`出处链接`,l.sourceUrl,23),await b(),f(`正在保存 PDF`),await m.save()}finally{h.width=0,h.height=0}}async function p(e,t){let n=await f(e,t),r=new Blob([n],{type:`application/pdf`}),i=URL.createObjectURL(r),a=document.createElement(`a`);return a.href=i,a.download=l(e.title),(document.querySelector(`dialog[open]`)||document.body).appendChild(a),a.click(),a.remove(),{url:i,filename:a.download}}export{p as downloadStoryPdf,l as pdfFilename,c as storySourceReference,d as wrapPdfText};
@@ -0,0 +1 @@
1
+ import{a as e,c as t,i as n}from"./index-y4BxCnhg.js";import{pdfFilename as r,wrapPdfText as i}from"./reader-pdf-AMLMoode.js";var a=36,o=24,s=420,c=630,l=42,u=`"Noto Serif SC", "Songti SC", "STSong", "SimSun", serif`;function d(e){return r(e).replace(/\.pdf$/,`-一页.png`)}function f(e){if(!e.pages.length||e.pages.some(e=>!e.image))throw Error(`等所有画面生成完成后,就能一页输出 PNG。`)}function p(r,u){f(r);let d=r.pages.length,p=d<=4?d:d<=8?4:d<=10?5:4,m=2*a+p*s+(p-1)*o,h=(e,t,n)=>i(e,n,e=>u(e,t)),g=h(`${r.title} · ${d}幅故事总览`,52,m-2*a),_=`generated`in r&&r.generated===!0?r:null,v=h([n.find(e=>e.id===r.bookId)?.title||e(r.bookId)||`自选故事`,_?.artStyleLabel,r.theme].filter(Boolean).join(` · `),26,m-2*a),y=a+g.length*70+12,b=y+v.length*40+30,x=[];for(let e=0;e<d;e+=p){let t=r.pages.slice(e,e+p).map((t,n)=>({index:e+n,x:a+n*(s+o),y:b,caption:h(t.caption,26,s)}));x.push(...t),b+=c+58+Math.max(...t.map(e=>e.caption.length))*l+o}let S=b+6,C=h(r.reflection?`余味:${r.reflection}`:`故事到这里,余味留给你。`,36,m-2*a),w=h(t(r),22,m-2*a);return{width:m,height:S+32+C.length*56+30+w.length*32+24,columns:p,title:g,subtitle:v,subtitleY:y,cells:x,footerY:S,reflection:C,credit:w}}async function m(e,t=()=>{}){f(e),await document.fonts.ready;let n=document.createElement(`canvas`),r=n.getContext(`2d`);if(!r)throw Error(`当前浏览器暂不支持 PNG 导出,请换个浏览器试试。`);let i=r,o=e=>{i.font=`${e}px ${u}`,i.textBaseline=`top`},d=p(e,(e,t)=>(o(t),i.measureText(e).width));n.width=d.width,n.height=d.height;try{i.fillStyle=`#f6f2e8`,i.fillRect(0,0,n.width,n.height);function r(e,t,n,r,a,s){o(r),i.fillStyle=s,e.forEach((e,r)=>i.fillText(e,t,n+r*a))}r(d.title,a,a,52,70,`#263a2e`),r(d.subtitle,a,d.subtitleY,26,40,`#6b7465`);for(let n of d.cells){t(`正在整理第 ${n.index+1} / ${e.pages.length} 幅`);let a=new URL(e.pages[n.index].image,location.origin);if(a.origin!==location.origin)throw Error(`画面来源不可用,无法导出 PNG。`);let o=await fetch(a.href,{credentials:`same-origin`,signal:AbortSignal.timeout(3e4)});if(!o.ok)throw Error(`第 ${n.index+1} 幅读取失败,请保持联网后重试。`);let u=await o.blob();if(!/^image\/(png|jpeg|webp)(;|$)/.test(u.type))throw Error(`第 ${n.index+1} 幅画面暂不可用。`);let d=new Image,f=URL.createObjectURL(u);try{d.src=f,await d.decode();let e=Math.min(s/d.naturalWidth,c/d.naturalHeight),t=d.naturalWidth*e,r=d.naturalHeight*e;i.drawImage(d,n.x+(s-t)/2,n.y+(c-r)/2,t,r)}finally{d.src=``,URL.revokeObjectURL(f)}r([String(n.index+1).padStart(2,`0`)],n.x,n.y+c+14,28,40,`#263a2e`),r(n.caption,n.x,n.y+c+58,26,l,`#4b5148`)}return i.strokeStyle=`#c9cbbb`,i.lineWidth=2,i.beginPath(),i.moveTo(a,d.footerY),i.lineTo(d.width-a,d.footerY),i.stroke(),r(d.reflection,a,d.footerY+32,36,56,`#263a2e`),r(d.credit,a,d.height-24-d.credit.length*32,22,32,`#6b7465`),t(`正在保存一页 PNG`),await new Promise((e,t)=>n.toBlob(n=>n?e(n):t(Error(`PNG 排版失败,请重试。`)),`image/png`))}finally{n.width=0,n.height=0}}async function h(e,t){let n=await m(e,t),r=URL.createObjectURL(n),i=document.createElement(`a`);return i.href=r,i.download=d(e.title),(document.querySelector(`dialog[open]`)||document.body).appendChild(i),i.click(),i.remove(),{url:r,filename:i.download}}export{h as downloadStoryPng};
@@ -0,0 +1,16 @@
1
+ import{c as e,l as t,n,o as r,r as i,s as a,u as o}from"./index-y4BxCnhg.js";import{pdfFilename as s,storySourceReference as c}from"./reader-pdf-AMLMoode.js";var l=Uint8Array,u=Uint16Array,d=Int32Array,f=new l([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),p=new l([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),m=new l([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=function(e,t){for(var n=new u(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new d(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},g=h(f,2),_=g.b,v=g.r;_[28]=258,v[258]=28;var y=h(p,0);y.b;for(var b=y.r,x=new u(32768),S=0;S<32768;++S){var C=(S&43690)>>1|(S&21845)<<1;C=(C&52428)>>2|(C&13107)<<2,C=(C&61680)>>4|(C&3855)<<4,x[S]=((C&65280)>>8|(C&255)<<8)>>1}for(var w=(function(e,t,n){for(var r=e.length,i=0,a=new u(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new u(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new u(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],d=t-e[i],f=o[e[i]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)s[x[f]>>c]=l}else for(s=new u(r),i=0;i<r;++i)e[i]&&(s[i]=x[o[e[i]-1]++]>>15-e[i]);return s}),T=new l(288),S=0;S<144;++S)T[S]=8;for(var S=144;S<256;++S)T[S]=9;for(var S=256;S<280;++S)T[S]=7;for(var S=280;S<288;++S)T[S]=8;for(var E=new l(32),S=0;S<32;++S)E[S]=5;var ee=w(T,9,0),D=w(E,5,0),te=function(e){return(e+7)/8|0},ne=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new l(e.subarray(t,n))},O=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],k=function(e,t,n){var r=Error(t||O[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,k),!n)throw r;return r},A=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},j=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},M=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:L,l:0};if(i==1){var o=new l(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],d=0,f=1,p=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};f!=i-1;)s=n[n[d].f<n[p].f?d++:p++],c=n[d!=f&&n[d].f<n[p].f?d++:p++],n[f++]={s:-1,f:s.f+c.f,l:s,r:c};for(var m=a[0].s,r=1;r<i;++r)a[r].s>m&&(m=a[r].s);var h=new u(m+1),g=N(n[f-1],h,0);if(g>t){var r=0,_=0,v=g-t,y=1<<v;for(a.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r<i;++r){var b=a[r].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=a[r].s;h[x]<t?_-=1<<t-h[x]++-1:++r}for(;r>=0&&_;--r){var S=a[r].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new l(h),l:g}},N=function(e,t,n){return e.s==-1?Math.max(N(e.l,t,n+1),N(e.r,t,n+1)):t[e.s]=n},P=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new u(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},F=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},re=function(e,t,n){var r=n.length,i=te(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},ie=function(e,t,n,r,i,a,o,s,c,l,d){A(t,d++,n),++i[256];for(var h=M(i,15),g=h.t,_=h.l,v=M(a,15),y=v.t,b=v.l,x=P(g),S=x.c,C=x.n,te=P(y),ne=te.c,O=te.n,k=new u(19),N=0;N<S.length;++N)++k[S[N]&31];for(var N=0;N<ne.length;++N)++k[ne[N]&31];for(var ie=M(k,7),I=ie.t,L=ie.l,R=19;R>4&&!I[m[R-1]];--R);var z=l+5<<3,B=F(i,T)+F(a,E)+o,V=F(i,g)+F(a,y)+o+14+3*R+F(k,I)+2*k[16]+3*k[17]+7*k[18];if(c>=0&&z<=B&&z<=V)return re(t,d,e.subarray(c,c+l));var H,U,W,G;if(A(t,d,1+(V<B)),d+=2,V<B){H=w(g,_,0),U=g,W=w(y,b,0),G=y;var ae=w(I,L,0);A(t,d,C-257),A(t,d+5,O-1),A(t,d+10,R-4),d+=14;for(var N=0;N<R;++N)A(t,d+3*N,I[m[N]]);d+=3*R;for(var oe=[S,ne],K=0;K<2;++K)for(var q=oe[K],N=0;N<q.length;++N){var J=q[N]&31;A(t,d,ae[J]),d+=I[J],J>15&&(A(t,d,q[N]>>5&127),d+=q[N]>>12)}}else H=ee,U=T,W=D,G=E;for(var N=0;N<s;++N){var Y=r[N];if(Y>255){var J=Y>>18&31;j(t,d,H[J+257]),d+=U[J+257],J>7&&(A(t,d,Y>>23&31),d+=f[J]);var X=Y&31;j(t,d,W[X]),d+=G[X],X>3&&(j(t,d,Y>>5&8191),d+=p[X])}else j(t,d,H[Y]),d+=U[Y]}return j(t,d,H[256]),d+U[256]},I=new d([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),L=new l(0),R=function(e,t,n,r,i,a){var o=a.z||e.length,s=new l(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),m=a.l,h=(a.r||0)&7;if(t){h&&(c[0]=a.r>>3);for(var g=I[t-1],_=g>>13,y=g&8191,x=(1<<n)-1,S=a.p||new u(32768),C=a.h||new u(x+1),w=Math.ceil(n/3),T=2*w,E=function(t){return(e[t]^e[t+1]<<w^e[t+2]<<T)&x},ee=new d(25e3),D=new u(288),O=new u(32),k=0,A=0,j=a.i||0,M=0,N=a.w||0,P=0;j+2<o;++j){var F=E(j),L=j&32767,R=C[F];if(S[L]=R,C[F]=L,N<=j){var z=o-j;if((k>7e3||M>24576)&&(z>423||!m)){h=ie(e,c,0,ee,D,O,A,M,P,j-P,h),M=k=A=0,P=j;for(var B=0;B<286;++B)D[B]=0;for(var B=0;B<30;++B)O[B]=0}var V=2,H=0,U=y,W=L-R&32767;if(z>2&&F==E(j-W))for(var G=Math.min(_,z)-1,ae=Math.min(32767,j),oe=Math.min(258,z);W<=ae&&--U&&L!=R;){if(e[j+V]==e[j+V-W]){for(var K=0;K<oe&&e[j+K]==e[j+K-W];++K);if(K>V){if(V=K,H=W,K>G)break;for(var q=Math.min(W,K-2),J=0,B=0;B<q;++B){var Y=j-W+B&32767,X=Y-S[Y]&32767;X>J&&(J=X,R=Y)}}}L=R,R=S[L],W+=L-R&32767}if(H){ee[M++]=268435456|v[V]<<18|b[H];var se=v[V]&31,ce=b[H]&31;A+=f[se]+p[ce],++D[257+se],++O[ce],N=j+V,++k}else ee[M++]=e[j],++D[e[j]]}}for(j=Math.max(j,N);j<o;++j)ee[M++]=e[j],++D[e[j]];h=ie(e,c,m,ee,D,O,A,M,P,j-P,h),m||(a.r=h&7|c[h/8|0]<<3,h-=7,a.h=C,a.p=S,a.i=j,a.w=N)}else{for(var j=a.w||0;j<o+m;j+=65535){var Z=j+65535;Z>=o&&(c[h/8|0]=m,Z=o),h=re(c,h+1,e.subarray(j,Z))}a.i=o}return ne(s,0,r+te(h)+i)},z=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),B=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=z[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},V=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new l(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return R(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},H=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},U=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function W(e,t){return V(e,t||{},0,0)}var G=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=H(r,a[1]),a=a[0]),a instanceof l?n[o]=[a,s]:(n[o+=`/`]=[new l(0),s],G(a,o,n,r))}},ae=typeof TextEncoder<`u`&&new TextEncoder,oe=typeof TextDecoder<`u`&&new TextDecoder;try{oe.decode(L,{stream:!0})}catch{}function K(e,t){if(t){for(var n=new l(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(ae)return ae.encode(e);for(var i=e.length,a=new l(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new l(o+8+(i-r<<1));c.set(a),a=c}var u=e.charCodeAt(r);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++r)&1023,s(240|u>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|u&63)):(s(224|u>>12),s(128|u>>6&63),s(128|u&63))}return ne(a,0,o)}var q=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&k(9),t+=r+4}return t},J=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=q(l);U(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&k(10),U(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(U(e,t,n.crc),U(e,t+4,a<0?-a-2:a),U(e,t+8,n.size)),U(e,t+12,c),U(e,t+14,d),t+=16,o!=null&&(U(e,t,u),U(e,t+6,n.attrs),U(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;U(e,t,+m),U(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},Y=function(e,t,n,r,i){U(e,t,101010256),U(e,t+8,n),U(e,t+10,n),U(e,t+12,r),U(e,t+16,i)};function X(e,t){t||={};var n={},r=[];G(e,``,n,t);var i=0,a=0;for(var o in n){var s=n[o],c=s[0],u=s[1],d=u.level==0?0:8,f=K(o),p=f.length,m=u.comment,h=m&&K(m),g=h&&h.length,_=q(u.extra);p>65535&&k(11);var v=d?W(c,u):c,y=v.length,b=B();b.p(c),r.push(H(u,{size:c.length,crc:b.d(),c:v,f,m:h,u:p!=o.length||h&&m.length!=g,o:i,compression:d})),i+=30+p+_+y,a+=76+2*(p+_)+(g||0)+y}for(var x=new l(a+22),S=i,C=a-i,w=0;w<r.length;++w){var f=r[w];J(x,f.o,f,f.f,f.u,f.c.length);var T=30+f.f.length+q(f.extra);x.set(f.c,f.o+T),J(x,i,f,f.f,f.u,f.c.length,f.o,f.m),i+=16+T+(f.m?f.m.length:0)}return Y(x,i,r.length,C,S),x}function se(t){let n=Array.from(t.publication?.author||`未署名`);return e({...t,publication:{author:n.slice(0,18).join(``)+(n.length>18?`…`:``),workUrl:``,contact:``,sourceNote:``,reuse:``}}).replace(/^制作:/,``)}function ce(e,t,n,r){let i=se(r),a=r.publication?.watermarkFontSize??o.default;e.save(),e.font=`300 ${a}px "PingFang SC", "Microsoft YaHei", sans-serif`,e.textAlign=`right`,e.textBaseline=`bottom`,e.shadowColor=`rgba(0,0,0,.5)`,e.shadowBlur=3,e.shadowOffsetY=1,e.fillStyle=`rgba(255,250,239,.75)`,e.fillText(i,t-t*.03,n-t*.03,t*.94),e.restore()}var Z=BigInt(2**32-1),le=BigInt(32);function ue(e,t=!1){return t?{h:Number(e&Z),l:Number(e>>le&Z)}:{h:Number(e>>le&Z)|0,l:Number(e&Z)|0}}function de(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=ue(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}var fe=e=>e/2**32|0,pe=e=>e>>>0;function me(e,t,n,r){let i=fe(n),a=pe(n);e.setUint32(t,r?a:i,r),e.setUint32(t+4,r?i:a,r)}function he(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}var ge=e=>e?`"${e}" `:``;function _e(e,t=``){if(typeof e!=`number`)throw TypeError(ge(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(ge(t)+`expected integer >= 0, got `+e);return e}function ve(e,t,n=``){if(he(e)&&(t===void 0||e.length===t))return e;t!==void 0&&_e(t,`length`);let r=he(e),i=t===void 0?``:` of length ${t}`,a=r?`length=${e.length}`:`type=${typeof e}`,o=ge(n)+`expected Uint8Array`+i+`, got `+a;throw r?RangeError(o):TypeError(o)}var ye=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError((t===`object`?``:`"${t}" `)+`expected object, got type=`+typeof e)},be=(e,t)=>{ye(e,t);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,`__proto__`))throw TypeError(`"${t}.__proto__" is not allowed`)};function xe(e,t=!0){if(e.destroyed)throw Error(`hash was destroyed`);if(t&&e.finished)throw Error(`digest() was already called`)}function Se(e,t){ve(e,void 0,`output`);let n=t.outputLen;if(!(e.length>=n))throw RangeError(`"output" expected length >= `+n)}function Ce(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function we(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Q(e,t){return e<<32-t|e>>>t}new Uint8Array(new Uint32Array([287454020]).buffer)[0];var Te=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,Ee=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function De(e){if(ve(e),Te)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=Ee[e[n]];return t}function Oe(e,t,n=`opts`){return be(e,`defaults`),t!==void 0&&be(t,n),Object.assign(Object.create(null),e,t)}function ke(e,t={}){if(typeof e!=`function`)throw TypeError(`"hashCons" expected function, got type=`+typeof e);t=Oe({},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 Ae=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function je(e,t,n){return e&t^~e&n}function Me(e,t,n){return e&t^e&n^t&n}var Ne=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=we(this.buffer)}update(e){xe(this),ve(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=we(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){xe(this),Se(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)),me(n,r-8,this.length*8,i),this.process(n,0),this.roundClean();let o=e===t?n:we(e),s=this.outputLen,c=s/4,l=this.get();if(s%4||c>l.length)throw Error(`invalid outputLen`);for(let e=0;e<c;e++)o.setUint32(4*e,l[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()}},Pe=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Fe=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]),$=new Uint32Array(64),Ie=class extends Ne{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=t[0]|0,this.B=t[1]|0,this.C=t[2]|0,this.D=t[3]|0,this.E=t[4]|0,this.F=t[5]|0,this.G=t[6]|0,this.H=t[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||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)$[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=$[e-15],n=$[e-2],r=Q(t,7)^Q(t,18)^t>>>3;$[e]=(Q(n,17)^Q(n,19)^n>>>10)+$[e-7]+r+$[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=Q(o,6)^Q(o,11)^Q(o,25),u=l+t+je(o,s,c)+Fe[e]+$[e]|0,d=(Q(n,2)^Q(n,13)^Q(n,22))+Me(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(){Ce($)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Ce(this.buffer)}},Le=class extends Ie{constructor(){super(32,Pe)}},Re=de(`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)));Re[0],Re[1];var ze=ke(()=>new Le,Ae(1));function Be(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=(e,n=!1)=>t.getUint16(e,n),r=(e,n=!1)=>t.getUint32(e,n),i=(t,n)=>String.fromCharCode(...e.subarray(t,t+n)),a=1,o=null;function s(e,t){if(i(e,6)===`Exif\0\0`&&(e+=6),t-e<8)throw Error(`INVALID_EXIF`);let o=i(e,2),s=o===`II`;if(o!==`II`&&o!==`MM`||n(e+2,s)!==42)throw Error(`INVALID_EXIF`);let c=e+r(e+4,s);if(c<e+8||c+2>t)throw Error(`INVALID_EXIF`);let l=n(c,s);if(c+2+l*12+4>t)throw Error(`INVALID_EXIF`);for(let e=0;e<l;e++){let t=c+2+e*12;if(n(t,s)===274&&(n(t+2,s)!==3||r(t+4,s)!==1||(a=n(t+8,s),a<1||a>8)))throw Error(`INVALID_EXIF`)}}if(i(0,8)===`‰PNG\r
2
+ 
3
+ `){let t=8,n=!1,a=!1;for(;t+12<=e.length;){let c=r(t),l=i(t+4,4),u=t+8,d=u+c;if(d+4>e.length)return null;if(t===8){if(l!==`IHDR`||c!==13)return null;o={width:r(u),height:r(u+4)}}else if(l===`IHDR`)return null;if(l===`eXIf`&&s(u,d),l===`IDAT`&&(a=!0),t=d+4,l===`IEND`){n=c===0&&t===e.length;break}}if(!n||!a)return null}else if(e[0]===255&&e[1]===216){let t=2,r=!1;if(e.at(-2)!==255||e.at(-1)!==217)return null;for(;t<e.length-2;){if(e[t++]!==255)return null;for(;e[t]===255;)t++;let a=e[t++];if(a===0||a===217)return null;if(a===1||a>=208&&a<=215)continue;if(t+2>e.length)return null;let c=n(t),l=t+c;if(c<2||l>e.length)return null;if(a===225&&i(t+2,6)===`Exif\0\0`&&s(t+2,l),a>=192&&a<=207&&![196,200,204].includes(a)){if(c<8||c!==8+3*e[t+7])return null;o={width:n(t+5),height:n(t+3)}}if(a===218){r=l<e.length-2;break}t=l}if(!r)return null}else if(i(0,4)===`RIFF`&&i(8,4)===`WEBP`){if(e.length<20||r(4,!0)+8!==e.length)return null;let t=12,a=null;for(;t+8<=e.length;){let c=i(t,4),l=r(t+4,!0),u=t+8,d=u+l;if(d+l%2>e.length)return null;if(c===`VP8X`){if(l!==10||e[u]&2)return null;a={width:1+e[u+4]+e[u+5]*256+e[u+6]*65536,height:1+e[u+7]+e[u+8]*256+e[u+9]*65536}}else if(c===`VP8 `){if(l<10||e[u]&1||i(u+3,3)!==`*`)return null;o={width:n(u+6,!0)&16383,height:n(u+8,!0)&16383}}else if(c===`VP8L`){if(l<5||e[u]!==47)return null;let t=r(u+1,!0);o={width:1+(t&16383),height:1+(t>>>14&16383)}}else c===`EXIF`&&s(u,d);t=d+l%2}if(t!==e.length||a&&(!o||a.width!==o.width||a.height!==o.height))return null}else return null;return!o||!o.width||!o.height?null:a>=5?{width:o.height,height:o.width}:o}function Ve(e){try{return Be(e)}catch{return null}}var He=new TextEncoder,Ue=new TextDecoder,We=`RIFF ICCP/ALPH/VP8/VP8L chunks including headers and padding, in file order`,Ge=e=>De(ze(e));function Ke(e){if(e.length<20||Ue.decode(e.subarray(0,4))!==`RIFF`||Ue.decode(e.subarray(8,12))!==`WEBP`||new DataView(e.buffer,e.byteOffset).getUint32(4,!0)+8!==e.length)throw Error(`无效的 WebP 文件。`);let t=[],n=12;for(;n<e.length;){if(n+8>e.length)throw Error(`WebP 数据不完整。`);let r=new DataView(e.buffer,e.byteOffset+n+4,4).getUint32(0,!0),i=n+8+r+r%2;if(i>e.length)throw Error(`WebP 数据不完整。`);t.push({tag:Ue.decode(e.subarray(n,n+4)),bytes:e.subarray(n,i),data:e.subarray(n+8,n+8+r)}),n=i}return t}function qe(e,t){let n=new Uint8Array(8+t.length+t.length%2);return n.set(He.encode(e)),new DataView(n.buffer).setUint32(4,t.length,!0),n.set(t,8),n}function Je(e){let t=ze.create(),n=0;for(let r of Ke(e))[`ICCP`,`ALPH`,`VP8 `,`VP8L`].includes(r.tag)&&(t.update(r.bytes),(r.tag===`VP8 `||r.tag===`VP8L`)&&n++);if(n!==1)throw Error(`只支持单幅 WebP 插图。`);return De(t.digest())}function Ye(e){return Array.from(e).filter(e=>{let t=e.codePointAt(0);return t===9||t===10||t===13||t>=32&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111}).join(``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`)}function Xe(e,n,r,i){let o={StoryId:e.id,Revision:String(e.revision),Frame:String(n+1),AIGenerated:`generated`in e&&e.generated===!0?`true`:`unknown`,OriginalFileSHA256:r,ImagePayloadSHA256:i,HashScope:We,WorkURL:e.publication?.workUrl||``,SourceURL:e.sourceUrl,Contact:e.publication?.contact||``,SourceLicense:e.publication?.sourceNote||``,Reuse:e.publication?.reuse||``};return`<?xpacket begin="\uFEFF" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:shiqu="https://github.com/yysun/shiqu/ns/1.0/" ${Object.entries(o).map(([e,t])=>`shiqu:${e}="${Ye(t)}"`).join(` `)}><dc:creator><rdf:Seq><rdf:li>${Ye(e.publication?.author||`未署名`)}</rdf:li></rdf:Seq></dc:creator><dc:title><rdf:Alt><rdf:li xml:lang="x-default">${Ye(e.title)}</rdf:li></rdf:Alt></dc:title><dc:description>${Ye(a(e))}</dc:description><dc:rights><rdf:Alt><rdf:li xml:lang="x-default">${Ye(t(e))}</rdf:li></rdf:Alt></dc:rights></rdf:Description></rdf:RDF></x:xmpmeta><?xpacket end="w"?>`}function Ze(e,t){let n=Ve(e);if(!n)throw Error(`无效的静态 WebP 图片。`);let r=Ke(e);if(r.some(e=>[`ANIM`,`ANMF`].includes(e.tag)))throw Error(`只支持单幅 WebP 插图。`);let i=r.find(e=>e.tag===`VP8X`)?.data.slice()||new Uint8Array(10),a=r.find(e=>e.tag===`VP8L`),o=r.some(e=>e.tag===`ALPH`)||!!(a?.data[4]&&a.data[4]&16);i[0]=(r.some(e=>e.tag===`ICCP`)?32:0)|(o?16:0)|4,i.fill(0,1,4);for(let[e,t]of[[4,n.width-1],[7,n.height-1]])for(let n=0;n<3;n++)i[e+n]=t>>>8*n&255;let s=r.filter(e=>![`VP8X`,`XMP `,`EXIF`].includes(e.tag)),c=[qe(`VP8X`,i),...s.map(e=>e.bytes),qe(`XMP `,He.encode(t))],l=new Uint8Array(12+c.reduce((e,t)=>e+t.length,0));l.set(He.encode(`RIFF`)),new DataView(l.buffer).setUint32(4,l.length-8,!0),l.set(He.encode(`WEBP`),8);let u=12;for(let e of c)l.set(e,u),u+=e.length;return l}function Qe(e){return s(e).replace(/-拾趣\.pdf$/,`.zip`)}function $e(e){if(!e.pages.length||e.pages.some(e=>!e.image))throw Error(`等所有画面生成完成后,就能下载分镜与图片 ZIP。`)}async function et(e,t,n){let r=new Image,i=URL.createObjectURL(e),a;try{if(r.src=i,await r.decode(),!r.naturalWidth||!r.naturalHeight)throw Error(`INVALID_IMAGE`);a=document.createElement(`canvas`),a.width=r.naturalWidth,a.height=r.naturalHeight;let e=a.getContext(`2d`);if(!e)throw Error(`CANVAS_UNAVAILABLE`);return e.drawImage(r,0,0),ce(e,a.width,a.height,n),await new Promise((e,t)=>a.toBlob(n=>{!n?.size||n.type!==`image/webp`?t(Error(`WEBP_UNAVAILABLE`)):e(n)},`image/webp`,.85))}catch{throw Error(`第 ${t+1} 幅画面转为 WebP 失败,请换用支持 WebP 导出的浏览器后重试。`)}finally{r.src=``,URL.revokeObjectURL(i),a&&(a.width=0,a.height=0)}}function tt(e,n){let r=`generated`in e&&e.generated===!0?e:null;return[`# ${e.title}`,e.summary,`主题:${e.theme}`,`出处:${c(e)}`,e.sourceUrl&&`出处链接:${e.sourceUrl}`,r?.artStyleLabel&&`画风:${r.artStyleLabel}`,`## 署名与转载\n\n${t(e)}`,...e.pages.map((e,t)=>`## 第 ${t+1} 幅\n\n图片:${n[t]}\n\n### 旁白\n\n${e.caption}\n\n### 画面提示词\n\n${e.prompt||`未留存。`}`),e.reflection&&`## 余味\n\n${e.reflection}`,e.adaptationNote&&`## 改编说明\n\n${e.adaptationNote}`,e.sourceText&&`## 保存的原文\n\n${e.sourceText}`].filter(Boolean).join(`
4
+
5
+ `)+`
6
+ `}function nt(e,t){let n=new Map(t.systemPrompts.map(e=>[e.id,e]));return[`# ${e.title} · 制作提示词`,`本文件包含已保存的制作与验收要求、逐幅画面提示词,以及实际调用留存的系统指令、文本输入、输出契约与参考图路径。分享前请检查原文与自定义内容;参考图路径不代表已打包参考图文件。`,`相同系统规则只保存一次,各次调用引用 [系统提示词](系统提示词.md);不同历史规则分别保留,文本输入不做删减。`,`## 制作要求\n\n${t.productionPrompt===null?`未留存。`:t.productionPrompt||`未填写。`}`,`## 验收要求\n\n${t.acceptancePrompt===null?`未留存。`:t.acceptancePrompt||`未填写。`}`,`## 逐幅画面提示词`,...e.pages.map((e,t)=>`### 第 ${t+1} 幅\n\n${e.prompt||`未留存。`}`),`## 实际调用记录`,`以下仅为已留存的调用记录,不保证完整复现;未留存的历史不使用当前系统规则补造。`,...t.records.length?t.records.map(t=>[`### ${t.index+1} · ${t.step} · ${t.model}`,`来源版本:${t.originId}(${t.originId===e.id?`本版本实际使用`:`沿用旧版本记录`})`,i({...t.record,instructions:t.record.instructionsRef?`[${n.get(t.record.instructionsRef).label}](系统提示词.md#${t.record.instructionsRef})`:`未使用独立系统指令。`})].join(`
7
+
8
+ `)):[`未留存完整提示词调用记录。`],...t.missingRecords.length?[`## 未留存完整提示词的调用`,...t.missingRecords.map(e=>`- ${e.index+1} · ${e.step} · ${e.model} · 来源版本:${e.originId} · 未留存`)]:[]].join(`
9
+
10
+ `)+`
11
+ `}function rt(e,t){return[`# ${e.title} · 系统提示词`,`以下为实际调用时留存的系统规则,每段原文只保存一次;不同历史版本分别列出,不以当前规则替代。`,...t.systemPrompts.length?t.systemPrompts.map(e=>`<a id="${e.id}"></a>\n\n## ${e.label}\n\n${e.instructions}`):[`未留存非空的系统指令;各次调用是否留存完整提示词请查看 [提示词](提示词.md)。`]].join(`
12
+
13
+ `)+`
14
+ `}async function it(e,r,i=()=>{}){$e(e);let o=`generated`in e&&e.generated===!0?e:null;if(o&&!r)throw Error(`提示词记录未载入,无法打包 ZIP,请重试。`);await document.fonts?.ready;let s={},l=[],u=[],d=Math.max(2,String(e.pages.length).length);for(let[t,n]of e.pages.entries()){i(`正在打包第 ${t+1} / ${e.pages.length} 幅`);let r=new URL(n.image,location.origin);if(r.origin!==location.origin)throw Error(`画面来源不可用,无法打包 ZIP。`);let a=await fetch(r.href,{credentials:`same-origin`,signal:AbortSignal.timeout(3e4)});if(!a.ok)throw Error(`第 ${t+1} 幅读取失败,请保持联网后重试。`);let o=await a.blob(),c=o.type.split(`;`)[0].trim().toLowerCase();if(![`image/png`,`image/jpeg`,`image/webp`].includes(c)||!o.size)throw Error(`第 ${t+1} 幅画面暂不可用,无法打包 ZIP。`);let f=await et(o,t,e),p=`图片/${String(t+1).padStart(d,`0`)}.webp`,m=new Uint8Array(await f.arrayBuffer()),h=Ge(new Uint8Array(await o.arrayBuffer())),g=Je(m),_=Ze(m,Xe(e,t,h,g));l.push(p),s[p]=_,u.push({sha256:Ge(_),originalSha256:h,imagePayloadSha256:g})}i(`正在整理分镜与保存 ZIP`);let f=n(r);return s[`分镜.md`]=K(tt(e,l)),s[`提示词.md`]=K(nt(e,f)),s[`系统提示词.md`]=K(rt(e,f)),s[`提示词.json`]=K(JSON.stringify(f,null,2)+`
15
+ `),s[`故事.json`]=K(JSON.stringify({id:e.id,title:e.title,summary:e.summary,bookId:e.bookId,theme:e.theme,sourceReference:c(e),sourceText:e.sourceText,sourceUrl:e.sourceUrl,artStyleLabel:o?.artStyleLabel??null,author:e.publication?.author||``,publication:e.publication||null,aiGenerated:o?!0:null,aiDisclosure:a(e),generationModels:o?.generationModels??[],productionPrompt:r?.productionPrompt??null,acceptancePrompt:r?.acceptancePrompt??null,promptHistoryFile:`提示词.json`,pages:e.pages.map((e,t)=>({caption:e.caption,prompt:e.prompt||null,image:l[t],...u[t]})),reflection:e.reflection,adaptationNote:e.adaptationNote,revision:e.revision,createdAt:e.createdAt,updatedAt:e.updatedAt},null,2)+`
16
+ `),s[`署名与转载.txt`]=K(`${e.title}\n\n${t(e)}\n\n原作出处:${c(e)}\n${e.sourceUrl}\n\n作品编号:${e.id}\n版本:${e.revision}\n保存时间:${e.updatedAt}\n`),new Blob([X(s,{level:0})],{type:`application/zip`})}async function at(e,t){$e(e),t(`正在读取已保存的提示词`);let n=await it(e,`generated`in e&&e.generated===!0?await r(`reader/sessions/${encodeURIComponent(e.id)}/prompts`):null,t),i=URL.createObjectURL(n),a=document.createElement(`a`);return a.href=i,a.download=Qe(e.title),(document.querySelector(`dialog[open]`)||document.body).appendChild(a),a.click(),a.remove(),{url:i,filename:a.download}}export{at as downloadStoryZip};
@@ -12,8 +12,8 @@
12
12
  <link rel="apple-touch-icon" sizes="180x180" href="/shiqu-home-180.png" />
13
13
  <link rel="manifest" href="/manifest.webmanifest" />
14
14
  <title>拾趣 · 片刻入戏,久久回味</title>
15
- <script type="module" crossorigin src="/assets/index-BXhJYqND.js"></script>
16
- <link rel="stylesheet" crossorigin href="/assets/index-CTBPjFtm.css">
15
+ <script type="module" crossorigin src="/assets/index-y4BxCnhg.js"></script>
16
+ <link rel="stylesheet" crossorigin href="/assets/index-B0URXv2Q.css">
17
17
  </head>
18
18
  <body><div id="root"></div></body>
19
19
  </html>