ai-helper-agent 2.4.4 → 2.4.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.
- package/dist/assets/{agent-store-BvS-vIQr.js → agent-store-D-jYf94_.js} +1 -1
- package/dist/assets/background.js +59 -59
- package/dist/assets/{chat-export-CBdPUbRE.js → chat-export-B5n-Qevt.js} +1 -1
- package/dist/assets/content.js +44 -41
- package/dist/assets/options.js +1 -1
- package/dist/assets/session-store-BBIdbyV_.js +81 -0
- package/dist/assets/side_panel.js +28 -28
- package/dist/assets/{utils-BKYmnE_x.js → utils-BIworoAB.js} +1 -1
- package/dist/assets/{version-hj8NxYZu.js → version-Djv0o0pB.js} +1 -1
- package/dist/manifest.json +1 -1
- package/dist/options.html +1 -1
- package/dist/side_panel.html +4 -4
- package/package.json +1 -1
- package/dist/assets/session-store-BrI5n6_W.js +0 -81
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,c as t,l as n}from"./i18n-8vdDPNQb.js";import{C as r}from"./utils-
|
|
1
|
+
import{a as e,c as t,l as n}from"./i18n-8vdDPNQb.js";import{C as r}from"./utils-BIworoAB.js";import{i,n as a,r as o,t as s}from"./side_panel.js";import{BorderStyle as c,Document as l,ExternalHyperlink as u,HeadingLevel as d,ImageRun as f,Packer as p,Paragraph as m,Table as h,TableCell as g,TableRow as _,TextRun as v,WidthType as y,convertInchesToTwip as b}from"./dist-LQPh1k0y.js";e(`zh`,{chatExport:{exportFailed:`导出失败:{message}`,pdfLibNotLoaded:`PDF 库未加载,无法导出`,noContent:`没有可导出的内容`,imageLibNotLoaded:`图片库未加载,无法导出为图片`,imagePlaceholder:`[图片: {name}]`,canvasFailed:`Canvas 转 DataURL 失败:{message}`,svgLoadFailed:`SVG 图片加载失败`}}),e(`en`,{chatExport:{exportFailed:`Export failed: {message}`,pdfLibNotLoaded:`PDF library not loaded, cannot export`,noContent:`No content to export`,imageLibNotLoaded:`Image library not loaded, cannot export as image`,imagePlaceholder:`[Image: {name}]`,canvasFailed:`Canvas to DataURL failed: {message}`,svgLoadFailed:`SVG image loading failed`}});var x=new Map,S=/Mac|iPhone|iPad|iPod/i.test(typeof navigator<`u`?navigator.userAgent:``)?`Apple Color Emoji`:`Segoe UI Emoji`,C=RegExp(`(?:\\p{Emoji_Presentation}|\\p{Extended_Pictographic}\\uFE0F)(?:[\\u{1F3FB}-\\u{1F3FF}]|\\u200D(?:\\p{Emoji_Presentation}|\\p{Extended_Pictographic}\\uFE0F))*`,`gu`);function w(e,t={}){if(!e)return[];let n=[],r=0;for(let i of e.matchAll(C))i.index>r&&n.push(new v({...t,text:e.slice(r,i.index)})),n.push(new v({...t,text:i[0],font:{name:S}})),r=i.index+i[0].length;return r<e.length&&n.push(new v({...t,text:e.slice(r)})),n}function T(e){if(!e)return[];let r=/(\*\*(.+?)\*\*|(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)|__(.+?)__|(?<!_)_(?!_)(.+?)(?<!_)_(?!_)|`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)|!\[([^\]]*)\]\(([^)]+)\))/,i=[],a=e;for(;a.length>0;){let e=a.match(r);if(!e){i.push(...w(a));break}let o=e.index;o>0&&i.push(...w(a.slice(0,o)));let s=e[1];if(e[2]!==void 0)i.push(...w(e[2],{bold:!0}));else if(e[3]!==void 0)i.push(...w(e[3],{italics:!0}));else if(e[4]!==void 0)i.push(...w(e[4],{bold:!0}));else if(e[5]!==void 0)i.push(...w(e[5],{italics:!0}));else if(e[6]!==void 0)i.push(new v({text:e[6],font:`Consolas`,size:20}));else if(e[7]!==void 0)i.push(new u({children:[new v({text:e[7],style:`Hyperlink`})],link:e[8]}));else if(e[9]!==void 0){let r=e[10];if(r.startsWith(`data:`))try{let[e,t]=r.split(`,`),n=e.match(/data:(image\/(\w+))/);if(n&&t){let e=atob(t),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);let a=n[2],o=E(r,a),s=o.width,c=o.height;if(s>567){let e=567/s;s=Math.round(s*e),c=Math.round(c*e)}i.push(new f({data:r,transformation:{width:s,height:c},type:a}))}}catch(r){n.warn(`[ChatExport] ImageRun create failed:`,r.message),i.push(new v({text:t(`chatExport.imagePlaceholder`,{name:e[9]||`image`}),italics:!0,color:`999999`}))}else i.push(new v({text:t(`chatExport.imagePlaceholder`,{name:e[9]||r}),italics:!0,color:`999999`}))}a=a.slice(o+s.length)}return i}function E(e,t){if(t===`png`&&e.length>24){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:t.getUint32(16),height:t.getUint32(20)}}if((t===`jpeg`||t===`jpg`)&&e.length>100){let t=2;for(;t<e.length-9;)if(e[t]===255){let n=e[t+1];if(n>=192&&n<=195){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);return{height:n.getUint16(t+5),width:n.getUint16(t+7)}}t+=2+(e[t+2]<<8|e[t+3])}else t++}return{width:600,height:400}}async function D(e){if(!e||!e.trim())return[new m({children:[new v({text:``})]})];let t=[],n=e,r=[];n=n.replace(/```(\w*)\n([\s\S]*?)```/g,(e,t,n)=>{let i=r.length;return r.push({lang:t||``,code:n.trimEnd()}),`\n\n%%CODEBLOCK_${i}%%\n\n`});let i=[];n=n.replace(/<table[\s\S]*?<\/table>/gi,e=>{let t=i.length;return i.push(e),`\n\n%%HTMLTABLE_${t}%%\n\n`});let a=[];n=n.replace(/(?:^\|.+\|\s*$\n)+^\|[\s\-:|]+\|\s*$\n(?:^\|.+\|\s*$\n?)+/gm,e=>{let t=a.length;return a.push(e),`\n\n%%MDTABLE_${t}%%\n\n`});let o=n.split(/\n{2,}/).filter(e=>e.trim());for(let e of o){let n=e.trim(),o=n.match(/^%%CODEBLOCK_(\d+)%%$/);if(o){let{lang:e,code:n}=r[parseInt(o[1])],i=e?`${e} code`:`code`;t.push(new m({children:[new v({text:i,bold:!0,font:`Consolas`,size:18})]}));let a=n.split(`
|
|
2
2
|
`);for(let e of a)t.push(new m({children:[new v({text:e||` `,font:`Consolas`,size:18})],spacing:{before:0,after:0,line:240},shading:{fill:`F5F5F5`}}));t.push(new m({children:[new v({text:``})]}));continue}let s=n.match(/^%%HTMLTABLE_(\d+)%%$/);if(s){let e=i[parseInt(s[1])],n=O(e);n.length>0&&(t.push(A(n)),t.push(new m({children:[new v({text:``})]})));continue}let l=n.match(/^%%MDTABLE_(\d+)%%$/);if(l){let e=a[parseInt(l[1])],n=k(e);t.push(A(n)),t.push(new m({children:[new v({text:``})]}));continue}let u=n.match(/^(#{1,6})\s+(.+)/);if(u){let e=u[1].length,r=u[2],i={1:d.HEADING_1,2:d.HEADING_2,3:d.HEADING_3,4:d.HEADING_4,5:d.HEADING_5,6:d.HEADING_6};t.push(new m({children:T(r),heading:i[e]||d.HEADING_1,border:{bottom:{style:c.SINGLE,size:6,color:`EAECEF`}}}));let a=n.slice(u[0].length).replace(/^\n+/,``).trim();a&&t.push(new m({children:T(a),spacing:{before:60,after:60}}));continue}if(/^(---|\*\*\*|___)\s*$/.test(n)){t.push(new m({children:[],border:{bottom:{style:c.SINGLE,size:6,color:`CCCCCC`}},spacing:{before:200,after:200}}));continue}if(/^[\-\*\+]\s+/.test(n)){let n=e.split(/\n(?=[\-\*\+]\s+)/);for(let e of n){let n=e.replace(/^[\-\*\+]\s+/,``);t.push(new m({children:T(n),bullet:{level:0},spacing:{before:40,after:40}}))}continue}if(/^\d+\.\s+/.test(n)){let n=e.split(/\n(?=\d+\.\s+)/);for(let e of n){let n=e.replace(/^\d+\.\s+/,``);t.push(new m({children:T(n),numbering:{reference:`default`,level:0},spacing:{before:40,after:40}}))}continue}if(n.startsWith(`>`)){let n=e.split(`
|
|
3
3
|
`).map(e=>e.replace(/^>\s?/,``)).join(`
|
|
4
4
|
`);t.push(new m({children:T(n),indent:{left:b(.5)},border:{left:{style:c.SINGLE,size:12,color:`CCCCCC`}},spacing:{before:60,after:60}}));continue}let f=T(n);t.push(new m({children:f.length>0?f:w(n),spacing:{before:60,after:60}}))}return t}function O(e){let t=new DOMParser().parseFromString(e,`text/html`),n=[];return t.querySelectorAll(`tr`).forEach(e=>{let t=[];e.querySelectorAll(`th, td`).forEach(e=>{t.push(e.textContent.trim())}),t.length>0&&n.push(t)}),n}function k(e){let t=e.trim().split(`
|