@mulmochat-plugin/summarize-pdf 0.1.2 → 0.2.0
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/core/index.d.ts +8 -0
- package/dist/core/plugin.d.ts +15 -0
- package/dist/core/types.d.ts +240 -0
- package/dist/core.cjs +1 -0
- package/dist/core.js +80 -0
- package/dist/index.cjs +1 -46
- package/dist/index.d.ts +17 -10
- package/dist/index.js +7 -1604
- package/dist/{plugin → vue}/Preview.vue.d.ts +1 -2
- package/dist/{plugin → vue}/View.vue.d.ts +1 -2
- package/dist/vue/index.d.ts +22 -0
- package/dist/vue/types.d.ts +32 -0
- package/dist/vue.cjs +1 -0
- package/dist/vue.js +121 -0
- package/package.json +11 -1
- package/dist/common/index.d.ts +0 -6
- package/dist/common/types.d.ts +0 -142
- package/dist/plugin/index.d.ts +0 -22
- package/dist/plugin/tools.d.ts +0 -19
- package/dist/plugin/types.d.ts +0 -18
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MulmoChat SummarizePdf Plugin - Core (Framework-agnostic)
|
|
3
|
+
*
|
|
4
|
+
* This module exports the core plugin logic without UI components.
|
|
5
|
+
* Import from "@mulmochat-plugin/summarize-pdf" or "@mulmochat-plugin/summarize-pdf/core"
|
|
6
|
+
*/
|
|
7
|
+
export type { BackendType, ToolContextApp, ToolContext, ToolResult, ToolResultComplete, JsonSchemaProperty, ToolDefinition, StartApiResponse, ToolSample, InputHandler, FileInputHandler, ClipboardImageInputHandler, UrlInputHandler, TextInputHandler, FileUploadConfig, ConfigValue, ConfigFieldSchema, PluginConfigSchema, ViewComponentProps, PreviewComponentProps, ToolPluginCore, PdfToolData, PdfArgs, PdfJsonData, } from "./types";
|
|
8
|
+
export { TOOL_NAME, TOOL_DEFINITION, createUploadedPdfResult, executeSummarizePdf, pluginCore, } from "./plugin";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MulmoChat SummarizePdf Plugin Core (Framework-agnostic)
|
|
3
|
+
*
|
|
4
|
+
* Contains the plugin logic without UI components.
|
|
5
|
+
* Can be used by any framework (Vue, React, etc.)
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolPluginCore, ToolContext, ToolResult, ToolDefinition, PdfToolData, PdfArgs, PdfJsonData } from "./types";
|
|
8
|
+
export declare const TOOL_NAME = "summarizePDF";
|
|
9
|
+
export declare const TOOL_DEFINITION: ToolDefinition;
|
|
10
|
+
/**
|
|
11
|
+
* Create a ToolResult for an uploaded PDF file
|
|
12
|
+
*/
|
|
13
|
+
export declare function createUploadedPdfResult(pdfData: string, fileName: string): ToolResult<PdfToolData, PdfJsonData>;
|
|
14
|
+
export declare const executeSummarizePdf: (context: ToolContext, args: PdfArgs) => Promise<ToolResult<PdfToolData, PdfJsonData>>;
|
|
15
|
+
export declare const pluginCore: ToolPluginCore<PdfToolData, PdfJsonData, PdfArgs>;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MulmoChat Plugin Core Types (Framework-agnostic)
|
|
3
|
+
*
|
|
4
|
+
* These types can be used by any framework implementation (Vue, React, etc.)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Backend types that plugins can declare they use.
|
|
8
|
+
* App layer manages actual provider/model settings for each type.
|
|
9
|
+
*/
|
|
10
|
+
export type BackendType = "textLLM" | "imageGen" | "audio" | "search" | "browse" | "map" | "mulmocast";
|
|
11
|
+
/**
|
|
12
|
+
* App interface provided to plugins via context.app
|
|
13
|
+
* Contains backend functions and config accessors
|
|
14
|
+
*/
|
|
15
|
+
export interface ToolContextApp extends Record<string, (...args: any[]) => any> {
|
|
16
|
+
getConfig: <T = unknown>(key: string) => T | undefined;
|
|
17
|
+
setConfig: (key: string, value: unknown) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Context passed to plugin execute function
|
|
21
|
+
*/
|
|
22
|
+
export interface ToolContext {
|
|
23
|
+
currentResult?: ToolResult<unknown> | null;
|
|
24
|
+
app?: ToolContextApp;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Result returned from plugin execution
|
|
28
|
+
*/
|
|
29
|
+
export interface ToolResult<T = unknown, J = unknown> {
|
|
30
|
+
toolName?: string;
|
|
31
|
+
uuid?: string;
|
|
32
|
+
message: string;
|
|
33
|
+
title?: string;
|
|
34
|
+
jsonData?: J;
|
|
35
|
+
instructions?: string;
|
|
36
|
+
instructionsRequired?: boolean;
|
|
37
|
+
updating?: boolean;
|
|
38
|
+
cancelled?: boolean;
|
|
39
|
+
data?: T;
|
|
40
|
+
viewState?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Complete tool result with required fields
|
|
44
|
+
*/
|
|
45
|
+
export interface ToolResultComplete<T = unknown, J = unknown> extends ToolResult<T, J> {
|
|
46
|
+
toolName: string;
|
|
47
|
+
uuid: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* JSON Schema property definition for tool parameters
|
|
51
|
+
*/
|
|
52
|
+
export interface JsonSchemaProperty {
|
|
53
|
+
type?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
enum?: string[];
|
|
56
|
+
items?: JsonSchemaProperty;
|
|
57
|
+
minimum?: number;
|
|
58
|
+
maximum?: number;
|
|
59
|
+
minItems?: number;
|
|
60
|
+
maxItems?: number;
|
|
61
|
+
properties?: Record<string, JsonSchemaProperty>;
|
|
62
|
+
required?: string[];
|
|
63
|
+
additionalProperties?: boolean;
|
|
64
|
+
oneOf?: JsonSchemaProperty[];
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Tool definition for OpenAI-compatible function calling
|
|
69
|
+
*/
|
|
70
|
+
export interface ToolDefinition {
|
|
71
|
+
type: "function";
|
|
72
|
+
name: string;
|
|
73
|
+
description: string;
|
|
74
|
+
parameters?: {
|
|
75
|
+
type: "object";
|
|
76
|
+
properties: Record<string, JsonSchemaProperty>;
|
|
77
|
+
required: string[];
|
|
78
|
+
additionalProperties?: boolean;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* API response from server start endpoint
|
|
83
|
+
*/
|
|
84
|
+
export interface StartApiResponse {
|
|
85
|
+
hasOpenAIApiKey?: boolean;
|
|
86
|
+
hasAnthropicApiKey?: boolean;
|
|
87
|
+
hasGoogleApiKey?: boolean;
|
|
88
|
+
[key: string]: unknown;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Sample arguments for testing
|
|
92
|
+
*/
|
|
93
|
+
export interface ToolSample {
|
|
94
|
+
name: string;
|
|
95
|
+
args: Record<string, unknown>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* File input handler
|
|
99
|
+
*/
|
|
100
|
+
export interface FileInputHandler {
|
|
101
|
+
type: "file";
|
|
102
|
+
acceptedTypes: string[];
|
|
103
|
+
handleInput: (fileData: string, fileName: string) => ToolResult<unknown, unknown>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Clipboard image input handler
|
|
107
|
+
*/
|
|
108
|
+
export interface ClipboardImageInputHandler {
|
|
109
|
+
type: "clipboard-image";
|
|
110
|
+
handleInput: (imageData: string) => ToolResult<unknown, unknown>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* URL input handler
|
|
114
|
+
*/
|
|
115
|
+
export interface UrlInputHandler {
|
|
116
|
+
type: "url";
|
|
117
|
+
patterns?: string[];
|
|
118
|
+
handleInput: (url: string) => ToolResult<unknown, unknown>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Text input handler
|
|
122
|
+
*/
|
|
123
|
+
export interface TextInputHandler {
|
|
124
|
+
type: "text";
|
|
125
|
+
patterns?: string[];
|
|
126
|
+
handleInput: (text: string) => ToolResult<unknown, unknown>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Union of all input handler types
|
|
130
|
+
*/
|
|
131
|
+
export type InputHandler = FileInputHandler | ClipboardImageInputHandler | UrlInputHandler | TextInputHandler;
|
|
132
|
+
/**
|
|
133
|
+
* Legacy file upload config (for backward compatibility)
|
|
134
|
+
* @deprecated Use InputHandler instead
|
|
135
|
+
*/
|
|
136
|
+
export interface FileUploadConfig {
|
|
137
|
+
acceptedTypes: string[];
|
|
138
|
+
handleUpload: (fileData: string, fileName: string, ...args: unknown[]) => ToolResult<unknown, unknown>;
|
|
139
|
+
}
|
|
140
|
+
export type ConfigValue = string | number | boolean | string[];
|
|
141
|
+
interface BaseFieldSchema {
|
|
142
|
+
label: string;
|
|
143
|
+
description?: string;
|
|
144
|
+
required?: boolean;
|
|
145
|
+
}
|
|
146
|
+
export interface StringFieldSchema extends BaseFieldSchema {
|
|
147
|
+
type: "string";
|
|
148
|
+
placeholder?: string;
|
|
149
|
+
minLength?: number;
|
|
150
|
+
maxLength?: number;
|
|
151
|
+
pattern?: string;
|
|
152
|
+
}
|
|
153
|
+
export interface NumberFieldSchema extends BaseFieldSchema {
|
|
154
|
+
type: "number";
|
|
155
|
+
min?: number;
|
|
156
|
+
max?: number;
|
|
157
|
+
step?: number;
|
|
158
|
+
}
|
|
159
|
+
export interface BooleanFieldSchema extends BaseFieldSchema {
|
|
160
|
+
type: "boolean";
|
|
161
|
+
}
|
|
162
|
+
export interface SelectOption {
|
|
163
|
+
value: string;
|
|
164
|
+
label: string;
|
|
165
|
+
description?: string;
|
|
166
|
+
disabled?: boolean;
|
|
167
|
+
}
|
|
168
|
+
export interface SelectFieldSchema extends BaseFieldSchema {
|
|
169
|
+
type: "select";
|
|
170
|
+
options: SelectOption[];
|
|
171
|
+
}
|
|
172
|
+
export interface MultiSelectFieldSchema extends BaseFieldSchema {
|
|
173
|
+
type: "multiselect";
|
|
174
|
+
options: SelectOption[];
|
|
175
|
+
minItems?: number;
|
|
176
|
+
maxItems?: number;
|
|
177
|
+
}
|
|
178
|
+
export type ConfigFieldSchema = StringFieldSchema | NumberFieldSchema | BooleanFieldSchema | SelectFieldSchema | MultiSelectFieldSchema;
|
|
179
|
+
/**
|
|
180
|
+
* Plugin configuration schema (JSON Schema based)
|
|
181
|
+
*/
|
|
182
|
+
export interface PluginConfigSchema {
|
|
183
|
+
key: string;
|
|
184
|
+
defaultValue: ConfigValue;
|
|
185
|
+
schema: ConfigFieldSchema;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Standard props for View components
|
|
189
|
+
*/
|
|
190
|
+
export interface ViewComponentProps<T = unknown, J = unknown> {
|
|
191
|
+
selectedResult: ToolResultComplete<T, J>;
|
|
192
|
+
sendTextMessage: (text?: string) => void;
|
|
193
|
+
onUpdateResult?: (result: Partial<ToolResult<T, J>>) => void;
|
|
194
|
+
pluginConfigs?: Record<string, unknown>;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Standard props for Preview components
|
|
198
|
+
*/
|
|
199
|
+
export interface PreviewComponentProps<T = unknown, J = unknown> {
|
|
200
|
+
result: ToolResultComplete<T, J>;
|
|
201
|
+
isSelected?: boolean;
|
|
202
|
+
onSelect?: () => void;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Core plugin interface - framework agnostic
|
|
206
|
+
* Does not include UI components
|
|
207
|
+
*/
|
|
208
|
+
export interface ToolPluginCore<T = unknown, J = unknown, A extends object = object> {
|
|
209
|
+
toolDefinition: ToolDefinition;
|
|
210
|
+
execute: (context: ToolContext, args: A) => Promise<ToolResult<T, J>>;
|
|
211
|
+
generatingMessage: string;
|
|
212
|
+
waitingMessage?: string;
|
|
213
|
+
uploadMessage?: string;
|
|
214
|
+
isEnabled: (startResponse?: StartApiResponse | null) => boolean;
|
|
215
|
+
delayAfterExecution?: number;
|
|
216
|
+
systemPrompt?: string;
|
|
217
|
+
inputHandlers?: InputHandler[];
|
|
218
|
+
/** @deprecated Use inputHandlers instead */
|
|
219
|
+
fileUpload?: FileUploadConfig;
|
|
220
|
+
/** New JSON Schema based config (framework-agnostic) */
|
|
221
|
+
configSchema?: PluginConfigSchema;
|
|
222
|
+
samples?: ToolSample[];
|
|
223
|
+
backends?: BackendType[];
|
|
224
|
+
}
|
|
225
|
+
/** PDF tool data stored in result.data */
|
|
226
|
+
export interface PdfToolData {
|
|
227
|
+
pdfData: string;
|
|
228
|
+
fileName: string;
|
|
229
|
+
summary?: string;
|
|
230
|
+
}
|
|
231
|
+
/** Arguments passed to the summarizePDF tool */
|
|
232
|
+
export interface PdfArgs {
|
|
233
|
+
prompt: string;
|
|
234
|
+
}
|
|
235
|
+
/** JSON data returned in result.jsonData */
|
|
236
|
+
export interface PdfJsonData {
|
|
237
|
+
fileName: string;
|
|
238
|
+
summary: string;
|
|
239
|
+
}
|
|
240
|
+
export {};
|
package/dist/core.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i="summarizePDF",n={type:"function",name:i,description:"Summarize the content of a currently selected PDF file using Claude.",parameters:{type:"object",properties:{prompt:{type:"string",description:"Instructions for Claude on how to summarize or analyze the PDF"}},required:["prompt"]}};function o(e,a){return{toolName:i,data:{pdfData:e,fileName:a},message:"",title:a}}const u=async(e,a)=>{const{prompt:l}=a,r=e.currentResult?.data;if(!r?.pdfData)return{message:"No PDF file available to summarize. Please select a PDF file first.",instructions:"Tell the user that no PDF file is currently selected and they need to upload a PDF file first."};if(!e.app?.summarizePdf)return{message:"summarizePdf function not available",instructions:"Tell the user that the PDF summarization failed."};try{const t=(await e.app.summarizePdf({prompt:l,pdfData:r.pdfData})).summary||"";return{data:{...r,summary:t},jsonData:{fileName:r.fileName,summary:t},message:"PDF summarized successfully",instructions:"Give the user a brief summary of the PDF.",instructionsRequired:!0,updating:!0}}catch(s){console.error("PDF summarization failed",s);const t=s instanceof Error?s.message:"Unknown error";return{message:`PDF summarization failed: ${t}`,instructions:`Tell the user that the PDF summarization failed with error: ${t}`}}},m={toolDefinition:n,execute:u,generatingMessage:"Summarizing PDF...",uploadMessage:"PDF file is available. Call 'summarizePDF' to see its summary",isEnabled:e=>!!e?.hasAnthropicApiKey,fileUpload:{acceptedTypes:["application/pdf"],handleUpload:o}};exports.TOOL_DEFINITION=n;exports.TOOL_NAME=i;exports.createUploadedPdfResult=o;exports.executeSummarizePdf=u;exports.pluginCore=m;
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const i = "summarizePDF", o = {
|
|
2
|
+
type: "function",
|
|
3
|
+
name: i,
|
|
4
|
+
description: "Summarize the content of a currently selected PDF file using Claude.",
|
|
5
|
+
parameters: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
prompt: {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: "Instructions for Claude on how to summarize or analyze the PDF"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
required: ["prompt"]
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
function u(e, a) {
|
|
17
|
+
return {
|
|
18
|
+
toolName: i,
|
|
19
|
+
data: { pdfData: e, fileName: a },
|
|
20
|
+
message: "",
|
|
21
|
+
title: a
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const l = async (e, a) => {
|
|
25
|
+
const { prompt: n } = a, r = e.currentResult?.data;
|
|
26
|
+
if (!r?.pdfData)
|
|
27
|
+
return {
|
|
28
|
+
message: "No PDF file available to summarize. Please select a PDF file first.",
|
|
29
|
+
instructions: "Tell the user that no PDF file is currently selected and they need to upload a PDF file first."
|
|
30
|
+
};
|
|
31
|
+
if (!e.app?.summarizePdf)
|
|
32
|
+
return {
|
|
33
|
+
message: "summarizePdf function not available",
|
|
34
|
+
instructions: "Tell the user that the PDF summarization failed."
|
|
35
|
+
};
|
|
36
|
+
try {
|
|
37
|
+
const t = (await e.app.summarizePdf({
|
|
38
|
+
prompt: n,
|
|
39
|
+
pdfData: r.pdfData
|
|
40
|
+
})).summary || "";
|
|
41
|
+
return {
|
|
42
|
+
data: {
|
|
43
|
+
...r,
|
|
44
|
+
summary: t
|
|
45
|
+
},
|
|
46
|
+
jsonData: {
|
|
47
|
+
fileName: r.fileName,
|
|
48
|
+
summary: t
|
|
49
|
+
},
|
|
50
|
+
message: "PDF summarized successfully",
|
|
51
|
+
instructions: "Give the user a brief summary of the PDF.",
|
|
52
|
+
instructionsRequired: !0,
|
|
53
|
+
updating: !0
|
|
54
|
+
};
|
|
55
|
+
} catch (s) {
|
|
56
|
+
console.error("PDF summarization failed", s);
|
|
57
|
+
const t = s instanceof Error ? s.message : "Unknown error";
|
|
58
|
+
return {
|
|
59
|
+
message: `PDF summarization failed: ${t}`,
|
|
60
|
+
instructions: `Tell the user that the PDF summarization failed with error: ${t}`
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}, m = {
|
|
64
|
+
toolDefinition: o,
|
|
65
|
+
execute: l,
|
|
66
|
+
generatingMessage: "Summarizing PDF...",
|
|
67
|
+
uploadMessage: "PDF file is available. Call 'summarizePDF' to see its summary",
|
|
68
|
+
isEnabled: (e) => !!e?.hasAnthropicApiKey,
|
|
69
|
+
fileUpload: {
|
|
70
|
+
acceptedTypes: ["application/pdf"],
|
|
71
|
+
handleUpload: u
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
o as TOOL_DEFINITION,
|
|
76
|
+
i as TOOL_NAME,
|
|
77
|
+
u as createUploadedPdfResult,
|
|
78
|
+
l as executeSummarizePdf,
|
|
79
|
+
m as pluginCore
|
|
80
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
`).map(i=>{const r=i.match(/^\s+/);if(r===null)return i;const[s]=r;return s.length>=e.length?i.slice(e.length):i}).join(`
|
|
3
|
-
`)}class A{options;rules;lexer;constructor(n){this.options=n||z}space(n){const t=this.rules.block.newline.exec(n);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(n){const t=this.rules.block.code.exec(n);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:P(e,`
|
|
4
|
-
`)}}}fences(n){const t=this.rules.block.fences.exec(n);if(t){const e=t[0],i=we(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(n){const t=this.rules.block.heading.exec(n);if(t){let e=t[2].trim();if(/#$/.test(e)){const i=P(e,"#");(this.options.pedantic||!i||/ $/.test(i))&&(e=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(n){const t=this.rules.block.hr.exec(n);if(t)return{type:"hr",raw:t[0]}}blockquote(n){const t=this.rules.block.blockquote.exec(n);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
5
|
-
$1`);e=P(e.replace(/^ *>[ \t]?/gm,""),`
|
|
6
|
-
`);const i=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(e);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:r,text:e}}}list(n){let t=this.rules.block.list.exec(n);if(t){let e=t[1].trim();const i=e.length>1,r={type:"list",raw:"",ordered:i,start:i?+e.slice(0,-1):"",loose:!1,items:[]};e=i?`\\d{1,9}\\${e.slice(-1)}`:`\\${e}`,this.options.pedantic&&(e=i?e:"[*+-]");const s=new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`);let l="",o="",p=!1;for(;n;){let c=!1;if(!(t=s.exec(n))||this.rules.block.hr.test(n))break;l=t[0],n=n.substring(l.length);let h=t[2].split(`
|
|
7
|
-
`,1)[0].replace(/^\t+/,B=>" ".repeat(3*B.length)),u=n.split(`
|
|
8
|
-
`,1)[0],g=0;this.options.pedantic?(g=2,o=h.trimStart()):(g=t[2].search(/[^ ]/),g=g>4?1:g,o=h.slice(g),g+=t[1].length);let y=!1;if(!h&&/^ *$/.test(u)&&(l+=u+`
|
|
9
|
-
`,n=n.substring(u.length+1),c=!0),!c){const B=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),H=new RegExp(`^ {0,${Math.min(3,g-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),G=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:\`\`\`|~~~)`),X=new RegExp(`^ {0,${Math.min(3,g-1)}}#`);for(;n;){const N=n.split(`
|
|
10
|
-
`,1)[0];if(u=N,this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),G.test(u)||X.test(u)||B.test(u)||H.test(n))break;if(u.search(/[^ ]/)>=g||!u.trim())o+=`
|
|
11
|
-
`+u.slice(g);else{if(y||h.search(/[^ ]/)>=4||G.test(h)||X.test(h)||H.test(h))break;o+=`
|
|
12
|
-
`+u}!y&&!u.trim()&&(y=!0),l+=N+`
|
|
13
|
-
`,n=n.substring(N.length+1),h=u.slice(g)}}r.loose||(p?r.loose=!0:/\n *\n *$/.test(l)&&(p=!0));let x=null,$;this.options.gfm&&(x=/^\[[ xX]\] /.exec(o),x&&($=x[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:l,task:!!x,checked:$,loose:!1,text:o,tokens:[]}),r.raw+=l}r.items[r.items.length-1].raw=l.trimEnd(),r.items[r.items.length-1].text=o.trimEnd(),r.raw=r.raw.trimEnd();for(let c=0;c<r.items.length;c++)if(this.lexer.state.top=!1,r.items[c].tokens=this.lexer.blockTokens(r.items[c].text,[]),!r.loose){const h=r.items[c].tokens.filter(g=>g.type==="space"),u=h.length>0&&h.some(g=>/\n.*\n/.test(g.raw));r.loose=u}if(r.loose)for(let c=0;c<r.items.length;c++)r.items[c].loose=!0;return r}}html(n){const t=this.rules.block.html.exec(n);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(n){const t=this.rules.block.def.exec(n);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:i,title:r}}}table(n){const t=this.rules.block.table.exec(n);if(!t||!/[:|]/.test(t[2]))return;const e=K(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),r=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
|
14
|
-
`):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(e.length===i.length){for(const l of i)/^ *-+: *$/.test(l)?s.align.push("right"):/^ *:-+: *$/.test(l)?s.align.push("center"):/^ *:-+ *$/.test(l)?s.align.push("left"):s.align.push(null);for(const l of e)s.header.push({text:l,tokens:this.lexer.inline(l)});for(const l of r)s.rows.push(K(l,s.header.length).map(o=>({text:o,tokens:this.lexer.inline(o)})));return s}}lheading(n){const t=this.rules.block.lheading.exec(n);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(n){const t=this.rules.block.paragraph.exec(n);if(t){const e=t[1].charAt(t[1].length-1)===`
|
|
15
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(n){const t=this.rules.block.text.exec(n);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(n){const t=this.rules.inline.escape.exec(n);if(t)return{type:"escape",raw:t[0],text:m(t[1])}}tag(n){const t=this.rules.inline.tag.exec(n);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(n){const t=this.rules.inline.link.exec(n);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const s=P(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{const s=be(t[2],"()");if(s>-1){const o=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){const s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);s&&(i=s[1],r=s[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(e)?i=i.slice(1):i=i.slice(1,-1)),Y(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(n,t){let e;if((e=this.rules.inline.reflink.exec(n))||(e=this.rules.inline.nolink.exec(n))){const i=(e[2]||e[1]).replace(/\s+/g," "),r=t[i.toLowerCase()];if(!r){const s=e[0].charAt(0);return{type:"text",raw:s,text:s}}return Y(e,r,e[0],this.lexer)}}emStrong(n,t,e=""){let i=this.rules.inline.emStrongLDelim.exec(n);if(!i||i[3]&&e.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!e||this.rules.inline.punctuation.exec(e)){const s=[...i[0]].length-1;let l,o,p=s,c=0;const h=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,t=t.slice(-1*n.length+s);(i=h.exec(t))!=null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l)continue;if(o=[...l].length,i[3]||i[4]){p+=o;continue}else if((i[5]||i[6])&&s%3&&!((s+o)%3)){c+=o;continue}if(p-=o,p>0)continue;o=Math.min(o,o+p+c);const u=[...i[0]][0].length,g=n.slice(0,s+i.index+u+o);if(Math.min(s,o)%2){const x=g.slice(1,-1);return{type:"em",raw:g,text:x,tokens:this.lexer.inlineTokens(x)}}const y=g.slice(2,-2);return{type:"strong",raw:g,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(n){const t=this.rules.inline.code.exec(n);if(t){let e=t[2].replace(/\n/g," ");const i=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return i&&r&&(e=e.substring(1,e.length-1)),e=m(e,!0),{type:"codespan",raw:t[0],text:e}}}br(n){const t=this.rules.inline.br.exec(n);if(t)return{type:"br",raw:t[0]}}del(n){const t=this.rules.inline.del.exec(n);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(n){const t=this.rules.inline.autolink.exec(n);if(t){let e,i;return t[2]==="@"?(e=m(t[1]),i="mailto:"+e):(e=m(t[1]),i=e),{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(n){let t;if(t=this.rules.inline.url.exec(n)){let e,i;if(t[2]==="@")e=m(t[0]),i="mailto:"+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);e=m(t[0]),t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(n){const t=this.rules.inline.text.exec(n);if(t){let e;return this.lexer.state.inRawBlock?e=t[0]:e=m(t[0]),{type:"text",raw:t[0],text:e}}}}const ye=/^(?: *(?:\n|$))+/,$e=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Te=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,v=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ze=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ie=/(?:[*+-]|\d{1,9}[.)])/,re=k(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ie).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),M=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,_e=/^[^\n]+/,O=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Re=k(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",O).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ve=k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ie).getRegex(),L="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",V=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Se=k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",V).replace("tag",L).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le=k(M).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",L).getRegex(),Pe=k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",le).getRegex(),j={blockquote:Pe,code:$e,def:Re,fences:Te,heading:ze,hr:v,html:Se,lheading:re,list:ve,newline:ye,paragraph:le,table:R,text:_e},ee=k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",L).getRegex(),Ee={...j,table:ee,paragraph:k(M).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ee).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",L).getRegex()},Ie={...j,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",V).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:R,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(M).replace("hr",v).replace("heading",` *#{1,6} *[^
|
|
16
|
-
]`).replace("lheading",re).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},oe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ae=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ae=/^( {2,}|\\)\n(?!\s*$)/,De=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,S="\\p{P}\\p{S}",Ce=k(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,S).getRegex(),Le=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Be=k(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,S).getRegex(),Ne=k("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,S).getRegex(),Fe=k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,S).getRegex(),qe=k(/\\([punct])/,"gu").replace(/punct/g,S).getRegex(),Ze=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Me=k(V).replace("(?:-->|$)","-->").getRegex(),Oe=k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Me).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),D=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ve=k(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",D).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ce=k(/^!?\[(label)\]\[(ref)\]/).replace("label",D).replace("ref",O).getRegex(),ue=k(/^!?\[(ref)\](?:\[\])?/).replace("ref",O).getRegex(),je=k("reflink|nolink(?!\\()","g").replace("reflink",ce).replace("nolink",ue).getRegex(),Q={_backpedal:R,anyPunctuation:qe,autolink:Ze,blockSkip:Le,br:ae,code:Ae,del:R,emStrongLDelim:Be,emStrongRDelimAst:Ne,emStrongRDelimUnd:Fe,escape:oe,link:Ve,nolink:ue,punctuation:Ce,reflink:ce,reflinkSearch:je,tag:Oe,text:De,url:R},Qe={...Q,link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",D).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D).getRegex()},F={...Q,escape:k(oe).replace("])","~|])").getRegex(),url:k(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ue={...F,br:k(ae).replace("{2,}","*").getRegex(),text:k(F.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},E={normal:j,gfm:Ee,pedantic:Ie},_={normal:Q,gfm:F,breaks:Ue,pedantic:Qe};class b{tokens;options;state;tokenizer;inlineQueue;constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||z,this.options.tokenizer=this.options.tokenizer||new A,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:E.normal,inline:_.normal};this.options.pedantic?(t.block=E.pedantic,t.inline=_.pedantic):this.options.gfm&&(t.block=E.gfm,this.options.breaks?t.inline=_.breaks:t.inline=_.gfm),this.tokenizer.rules=t}static get rules(){return{block:E,inline:_}}static lex(n,t){return new b(t).lex(n)}static lexInline(n,t){return new b(t).inlineTokens(n)}lex(n){n=n.replace(/\r\n|\r/g,`
|
|
17
|
-
`),this.blockTokens(n,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,t=[]){this.options.pedantic?n=n.replace(/\t/g," ").replace(/^ +$/gm,""):n=n.replace(/^( *)(\t+)/gm,(l,o,p)=>o+" ".repeat(p.length));let e,i,r,s;for(;n;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(e=l.call({lexer:this},n,t))?(n=n.substring(e.raw.length),t.push(e),!0):!1))){if(e=this.tokenizer.space(n)){n=n.substring(e.raw.length),e.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
|
18
|
-
`:t.push(e);continue}if(e=this.tokenizer.code(n)){n=n.substring(e.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
19
|
-
`+e.raw,i.text+=`
|
|
20
|
-
`+e.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(e);continue}if(e=this.tokenizer.fences(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.heading(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.hr(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.blockquote(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.list(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.html(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.def(n)){n=n.substring(e.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
21
|
-
`+e.raw,i.text+=`
|
|
22
|
-
`+e.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[e.tag]||(this.tokens.links[e.tag]={href:e.href,title:e.title});continue}if(e=this.tokenizer.table(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.lheading(n)){n=n.substring(e.raw.length),t.push(e);continue}if(r=n,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const o=n.slice(1);let p;this.options.extensions.startBlock.forEach(c=>{p=c.call({lexer:this},o),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(r=n.substring(0,l+1))}if(this.state.top&&(e=this.tokenizer.paragraph(r))){i=t[t.length-1],s&&i.type==="paragraph"?(i.raw+=`
|
|
23
|
-
`+e.raw,i.text+=`
|
|
24
|
-
`+e.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(e),s=r.length!==n.length,n=n.substring(e.raw.length);continue}if(e=this.tokenizer.text(n)){n=n.substring(e.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
|
|
25
|
-
`+e.raw,i.text+=`
|
|
26
|
-
`+e.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(e);continue}if(n){const l="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,t}inline(n,t=[]){return this.inlineQueue.push({src:n,tokens:t}),t}inlineTokens(n,t=[]){let e,i,r,s=n,l,o,p;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,l.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;n;)if(o||(p=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(e=c.call({lexer:this},n,t))?(n=n.substring(e.raw.length),t.push(e),!0):!1))){if(e=this.tokenizer.escape(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.tag(n)){n=n.substring(e.raw.length),i=t[t.length-1],i&&e.type==="text"&&i.type==="text"?(i.raw+=e.raw,i.text+=e.text):t.push(e);continue}if(e=this.tokenizer.link(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(e.raw.length),i=t[t.length-1],i&&e.type==="text"&&i.type==="text"?(i.raw+=e.raw,i.text+=e.text):t.push(e);continue}if(e=this.tokenizer.emStrong(n,s,p)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.codespan(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.br(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.del(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.autolink(n)){n=n.substring(e.raw.length),t.push(e);continue}if(!this.state.inLink&&(e=this.tokenizer.url(n))){n=n.substring(e.raw.length),t.push(e);continue}if(r=n,this.options.extensions&&this.options.extensions.startInline){let c=1/0;const h=n.slice(1);let u;this.options.extensions.startInline.forEach(g=>{u=g.call({lexer:this},h),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(r=n.substring(0,c+1))}if(e=this.tokenizer.inlineText(r)){n=n.substring(e.raw.length),e.raw.slice(-1)!=="_"&&(p=e.raw.slice(-1)),o=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=e.raw,i.text+=e.text):t.push(e);continue}if(n){const c="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}}class C{options;constructor(n){this.options=n||z}code(n,t,e){const i=(t||"").match(/^\S*/)?.[0];return n=n.replace(/\n$/,"")+`
|
|
27
|
-
`,i?'<pre><code class="language-'+m(i)+'">'+(e?n:m(n,!0))+`</code></pre>
|
|
28
|
-
`:"<pre><code>"+(e?n:m(n,!0))+`</code></pre>
|
|
29
|
-
`}blockquote(n){return`<blockquote>
|
|
30
|
-
${n}</blockquote>
|
|
31
|
-
`}html(n,t){return n}heading(n,t,e){return`<h${t}>${n}</h${t}>
|
|
32
|
-
`}hr(){return`<hr>
|
|
33
|
-
`}list(n,t,e){const i=t?"ol":"ul",r=t&&e!==1?' start="'+e+'"':"";return"<"+i+r+`>
|
|
34
|
-
`+n+"</"+i+`>
|
|
35
|
-
`}listitem(n,t,e){return`<li>${n}</li>
|
|
36
|
-
`}checkbox(n){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(n){return`<p>${n}</p>
|
|
37
|
-
`}table(n,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
|
|
38
|
-
<thead>
|
|
39
|
-
`+n+`</thead>
|
|
40
|
-
`+t+`</table>
|
|
41
|
-
`}tablerow(n){return`<tr>
|
|
42
|
-
${n}</tr>
|
|
43
|
-
`}tablecell(n,t){const e=t.header?"th":"td";return(t.align?`<${e} align="${t.align}">`:`<${e}>`)+n+`</${e}>
|
|
44
|
-
`}strong(n){return`<strong>${n}</strong>`}em(n){return`<em>${n}</em>`}codespan(n){return`<code>${n}</code>`}br(){return"<br>"}del(n){return`<del>${n}</del>`}link(n,t,e){const i=J(n);if(i===null)return e;n=i;let r='<a href="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=">"+e+"</a>",r}image(n,t,e){const i=J(n);if(i===null)return e;n=i;let r=`<img src="${n}" alt="${e}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(n){return n}}class U{strong(n){return n}em(n){return n}codespan(n){return n}del(n){return n}html(n){return n}text(n){return n}link(n,t,e){return""+e}image(n,t,e){return""+e}br(){return""}}class w{options;renderer;textRenderer;constructor(n){this.options=n||z,this.options.renderer=this.options.renderer||new C,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new U}static parse(n,t){return new w(t).parse(n)}static parseInline(n,t){return new w(t).parseInline(n)}parse(n,t=!0){let e="";for(let i=0;i<n.length;i++){const r=n[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const s=r,l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){e+=l||"";continue}}switch(r.type){case"space":continue;case"hr":{e+=this.renderer.hr();continue}case"heading":{const s=r;e+=this.renderer.heading(this.parseInline(s.tokens),s.depth,me(this.parseInline(s.tokens,this.textRenderer)));continue}case"code":{const s=r;e+=this.renderer.code(s.text,s.lang,!!s.escaped);continue}case"table":{const s=r;let l="",o="";for(let c=0;c<s.header.length;c++)o+=this.renderer.tablecell(this.parseInline(s.header[c].tokens),{header:!0,align:s.align[c]});l+=this.renderer.tablerow(o);let p="";for(let c=0;c<s.rows.length;c++){const h=s.rows[c];o="";for(let u=0;u<h.length;u++)o+=this.renderer.tablecell(this.parseInline(h[u].tokens),{header:!1,align:s.align[u]});p+=this.renderer.tablerow(o)}e+=this.renderer.table(l,p);continue}case"blockquote":{const s=r,l=this.parse(s.tokens);e+=this.renderer.blockquote(l);continue}case"list":{const s=r,l=s.ordered,o=s.start,p=s.loose;let c="";for(let h=0;h<s.items.length;h++){const u=s.items[h],g=u.checked,y=u.task;let x="";if(u.task){const $=this.renderer.checkbox(!!g);p?u.tokens.length>0&&u.tokens[0].type==="paragraph"?(u.tokens[0].text=$+" "+u.tokens[0].text,u.tokens[0].tokens&&u.tokens[0].tokens.length>0&&u.tokens[0].tokens[0].type==="text"&&(u.tokens[0].tokens[0].text=$+" "+u.tokens[0].tokens[0].text)):u.tokens.unshift({type:"text",text:$+" "}):x+=$+" "}x+=this.parse(u.tokens,p),c+=this.renderer.listitem(x,y,!!g)}e+=this.renderer.list(c,l,o);continue}case"html":{const s=r;e+=this.renderer.html(s.text,s.block);continue}case"paragraph":{const s=r;e+=this.renderer.paragraph(this.parseInline(s.tokens));continue}case"text":{let s=r,l=s.tokens?this.parseInline(s.tokens):s.text;for(;i+1<n.length&&n[i+1].type==="text";)s=n[++i],l+=`
|
|
45
|
-
`+(s.tokens?this.parseInline(s.tokens):s.text);e+=t?this.renderer.paragraph(l):l;continue}default:{const s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return e}parseInline(n,t){t=t||this.renderer;let e="";for(let i=0;i<n.length;i++){const r=n[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const s=this.options.extensions.renderers[r.type].call({parser:this},r);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){e+=s||"";continue}}switch(r.type){case"escape":{const s=r;e+=t.text(s.text);break}case"html":{const s=r;e+=t.html(s.text);break}case"link":{const s=r;e+=t.link(s.href,s.title,this.parseInline(s.tokens,t));break}case"image":{const s=r;e+=t.image(s.href,s.title,s.text);break}case"strong":{const s=r;e+=t.strong(this.parseInline(s.tokens,t));break}case"em":{const s=r;e+=t.em(this.parseInline(s.tokens,t));break}case"codespan":{const s=r;e+=t.codespan(s.text);break}case"br":{e+=t.br();break}case"del":{const s=r;e+=t.del(this.parseInline(s.tokens,t));break}case"text":{const s=r;e+=t.text(s.text);break}default:{const s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return e}}class I{options;constructor(n){this.options=n||z}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}}class He{defaults=Z();options=this.setOptions;parse=this.#e(b.lex,w.parse);parseInline=this.#e(b.lexInline,w.parseInline);Parser=w;Renderer=C;TextRenderer=U;Lexer=b;Tokenizer=A;Hooks=I;constructor(...n){this.use(...n)}walkTokens(n,t){let e=[];for(const i of n)switch(e=e.concat(t.call(this,i)),i.type){case"table":{const r=i;for(const s of r.header)e=e.concat(this.walkTokens(s.tokens,t));for(const s of r.rows)for(const l of s)e=e.concat(this.walkTokens(l.tokens,t));break}case"list":{const r=i;e=e.concat(this.walkTokens(r.items,t));break}default:{const r=i;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(s=>{const l=r[s].flat(1/0);e=e.concat(this.walkTokens(l,t))}):r.tokens&&(e=e.concat(this.walkTokens(r.tokens,t)))}}return e}use(...n){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(e=>{const i={...e};if(i.async=this.defaults.async||i.async||!1,e.extensions&&(e.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){const s=t.renderers[r.name];s?t.renderers[r.name]=function(...l){let o=r.renderer.apply(this,l);return o===!1&&(o=s.apply(this,l)),o}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=t[r.level];s?s.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),e.renderer){const r=this.defaults.renderer||new C(this.defaults);for(const s in e.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(s==="options")continue;const l=s,o=e.renderer[l],p=r[l];r[l]=(...c)=>{let h=o.apply(r,c);return h===!1&&(h=p.apply(r,c)),h||""}}i.renderer=r}if(e.tokenizer){const r=this.defaults.tokenizer||new A(this.defaults);for(const s in e.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const l=s,o=e.tokenizer[l],p=r[l];r[l]=(...c)=>{let h=o.apply(r,c);return h===!1&&(h=p.apply(r,c)),h}}i.tokenizer=r}if(e.hooks){const r=this.defaults.hooks||new I;for(const s in e.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;const l=s,o=e.hooks[l],p=r[l];I.passThroughHooks.has(s)?r[l]=c=>{if(this.defaults.async)return Promise.resolve(o.call(r,c)).then(u=>p.call(r,u));const h=o.call(r,c);return p.call(r,h)}:r[l]=(...c)=>{let h=o.apply(r,c);return h===!1&&(h=p.apply(r,c)),h}}i.hooks=r}if(e.walkTokens){const r=this.defaults.walkTokens,s=e.walkTokens;i.walkTokens=function(l){let o=[];return o.push(s.call(this,l)),r&&(o=o.concat(r.call(this,l))),o}}this.defaults={...this.defaults,...i}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,t){return b.lex(n,t??this.defaults)}parser(n,t){return w.parse(n,t??this.defaults)}#e(n,t){return(e,i)=>{const r={...i},s={...this.defaults,...r};this.defaults.async===!0&&r.async===!1&&(s.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),s.async=!0);const l=this.#t(!!s.silent,!!s.async);if(typeof e>"u"||e===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(e):e).then(o=>n(o,s)).then(o=>s.hooks?s.hooks.processAllTokens(o):o).then(o=>s.walkTokens?Promise.all(this.walkTokens(o,s.walkTokens)).then(()=>o):o).then(o=>t(o,s)).then(o=>s.hooks?s.hooks.postprocess(o):o).catch(l);try{s.hooks&&(e=s.hooks.preprocess(e));let o=n(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let p=t(o,s);return s.hooks&&(p=s.hooks.postprocess(p)),p}catch(o){return l(o)}}}#t(n,t){return e=>{if(e.message+=`
|
|
46
|
-
Please report this to https://github.com/markedjs/marked.`,n){const i="<p>An error occurred:</p><pre>"+m(e.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(e);throw e}}}const T=new He;function d(a,n){return T.parse(a,n)}d.options=d.setOptions=function(a){return T.setOptions(a),d.defaults=T.defaults,te(d.defaults),d};d.getDefaults=Z;d.defaults=z;d.use=function(...a){return T.use(...a),d.defaults=T.defaults,te(d.defaults),d};d.walkTokens=function(a,n){return T.walkTokens(a,n)};d.parseInline=T.parseInline;d.Parser=w;d.parser=w.parse;d.Renderer=C;d.TextRenderer=U;d.Lexer=b;d.lexer=b.lex;d.Tokenizer=A;d.Hooks=I;d.parse=d;d.options;d.setOptions;d.use;d.walkTokens;d.parseInline;w.parse;b.lex;const Ge={class:"w-full h-full flex flex-col p-4"},Xe={class:"flex-1 w-full min-h-0"},We=["src"],Je={key:0,class:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded-lg flex-shrink-0"},Ke={class:"text-sm text-gray-700 dark:text-gray-300"},Ye={key:1,class:"mt-2 p-3 bg-white rounded-lg flex-shrink-0 max-h-64 overflow-y-auto border border-gray-200"},et=["innerHTML"],tt=f.defineComponent({__name:"View",props:{selectedResult:{}},setup(a){const n=a,t=f.ref(null),e=f.ref("");f.watch(()=>n.selectedResult,s=>{s?.toolName===q&&s.data&&(t.value=s.data,r(s))},{immediate:!0,deep:!0});const i=f.computed(()=>{const s=t.value?.summary;return s?d(s):""});async function r(s){const l=s.data,o=s.uuid;if(l?.pdfData){if(!o){e.value=l.pdfData;return}try{const p=await fetch("/api/save-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pdfData:l.pdfData,uuid:o,fileName:l.fileName||"document.pdf"})});if(!p.ok)throw new Error("Failed to save PDF");const c=await p.json();e.value=c.pdfUrl}catch(p){console.error("Failed to save PDF to output folder:",p),e.value=l.pdfData}}}return(s,l)=>(f.openBlock(),f.createElementBlock("div",Ge,[f.createElementVNode("div",Xe,[e.value?(f.openBlock(),f.createElementBlock("iframe",{key:0,src:e.value,class:"w-full h-full border-0 rounded",title:"PDF Viewer"},null,8,We)):f.createCommentVNode("",!0)]),t.value?.fileName?(f.openBlock(),f.createElementBlock("div",Je,[f.createElementVNode("p",Ke,[l[0]||(l[0]=f.createElementVNode("span",{class:"font-medium"},"File:",-1)),f.createTextVNode(" "+f.toDisplayString(t.value.fileName),1)])])):f.createCommentVNode("",!0),t.value?.summary?(f.openBlock(),f.createElementBlock("div",Ye,[l[1]||(l[1]=f.createElementVNode("p",{class:"text-sm font-medium text-gray-700 mb-2"},"Summary:",-1)),f.createElementVNode("div",{class:"markdown-content prose prose-sm prose-slate max-w-none",innerHTML:i.value},null,8,et)])):f.createCommentVNode("",!0)]))}}),nt={class:"w-full h-32 bg-gray-200 dark:bg-gray-700 rounded flex items-center justify-center"},st={class:"text-center"},it={class:"text-xs mt-2 text-gray-600 dark:text-gray-300"},rt=f.defineComponent({__name:"Preview",props:{result:{}},setup(a){const n=a,t=f.computed(()=>n.result.data);return(e,i)=>(f.openBlock(),f.createElementBlock("div",nt,[f.createElementVNode("div",st,[i[0]||(i[0]=f.createElementVNode("svg",{class:"w-12 h-12 mx-auto text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[f.createElementVNode("path",{"fill-rule":"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z","clip-rule":"evenodd"})],-1)),f.createElementVNode("p",it,f.toDisplayString(t.value?.fileName||"PDF"),1)])]))}});function pe(a,n){return{toolName:q,data:{pdfData:a,fileName:n},message:"",title:n}}const lt=async(a,n)=>{const{prompt:t}=n,e=a.currentResult?.data;if(!e?.pdfData)return{message:"No PDF file available to summarize. Please select a PDF file first.",instructions:"Tell the user that no PDF file is currently selected and they need to upload a PDF file first."};if(!a.app?.summarizePdf)return{message:"summarizePdf function not available",instructions:"Tell the user that the PDF summarization failed."};try{const r=(await a.app.summarizePdf({prompt:t,pdfData:e.pdfData})).summary||"";return{data:{...e,summary:r},jsonData:{fileName:e.fileName,summary:r},message:"PDF summarized successfully",instructions:"Give the user a brief summary of the PDF.",instructionsRequired:!0,updating:!0}}catch(i){console.error("PDF summarization failed",i);const r=i instanceof Error?i.message:"Unknown error";return{message:`PDF summarization failed: ${r}`,instructions:`Tell the user that the PDF summarization failed with error: ${r}`}}},ot={toolDefinition:he,execute:lt,generatingMessage:"Summarizing PDF...",uploadMessage:"PDF file is available. Call 'summarizePDF' to see its summary",isEnabled:a=>!!a?.hasAnthropicApiKey,viewComponent:tt,previewComponent:rt,fileUpload:{acceptedTypes:["application/pdf"],handleUpload:pe}},at={plugin:ot};exports.createUploadedPdfResult=pe;exports.default=at;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./core.cjs");exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.createUploadedPdfResult=e.createUploadedPdfResult;exports.default=e.pluginCore;exports.executeSummarizePdf=e.executeSummarizePdf;exports.pluginCore=e.pluginCore;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MulmoChat Plugin
|
|
2
|
+
* MulmoChat SummarizePdf Plugin
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Default export is the framework-agnostic core.
|
|
5
|
+
* For Vue implementation, import from "@mulmochat-plugin/summarize-pdf/vue"
|
|
6
|
+
*
|
|
7
|
+
* @example Default (Core - framework-agnostic)
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { pluginCore, TOOL_NAME, PdfToolData } from "@mulmochat-plugin/summarize-pdf";
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @example Vue implementation
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import SummarizePdfPlugin from "@mulmochat-plugin/summarize-pdf/vue";
|
|
15
|
+
* import "@mulmochat-plugin/summarize-pdf/style.css";
|
|
16
|
+
* ```
|
|
5
17
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export { createUploadedPdfResult };
|
|
10
|
-
declare const _default: {
|
|
11
|
-
plugin: ToolPlugin;
|
|
12
|
-
};
|
|
13
|
-
export default _default;
|
|
18
|
+
export * from "./core";
|
|
19
|
+
export { pluginCore as default } from "./core";
|
|
20
|
+
export { createUploadedPdfResult } from "./core";
|