@pi-outpost/embed 0.35.2 → 0.36.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/CodeEditor-2Vx8PHAy.js +2790 -0
- package/dist/CodeEditor-Cb6i9oIs.cjs +6 -0
- package/dist/clike-8rZWBES0.cjs +1 -0
- package/dist/clike-D-dOQnrm.js +587 -0
- package/dist/{conversationExport-DU5Xp2g-.js → conversationExport-D8C7qzeU.js} +2 -2
- package/dist/{conversationExport-DwLc0HDC.cjs → conversationExport-DhGnf-eW.cjs} +1 -1
- package/dist/{conversationHistory-DTP8xNqg.cjs → conversationHistory-BtFE4dMu.cjs} +1 -1
- package/dist/{conversationHistory-DHEPfViO.js → conversationHistory-CwYAL6o8.js} +1 -1
- package/dist/dist-B0lO3k1f.js +410 -0
- package/dist/dist-B7I27gkN.cjs +1 -0
- package/dist/dist-B8gmxwh-.cjs +23 -0
- package/dist/dist-BBUKMRrs.js +69 -0
- package/dist/dist-BWlGU9XM.js +395 -0
- package/dist/dist-BZcglaBe.cjs +1 -0
- package/dist/dist-BZjcsPqi.cjs +13 -0
- package/dist/dist-BfQGuM1r.js +1340 -0
- package/dist/dist-BhNvvg0I.js +471 -0
- package/dist/dist-BhXQJ0x3.js +10805 -0
- package/dist/dist-BlD6NhiG.js +296 -0
- package/dist/dist-Bppoi_v9.js +357 -0
- package/dist/dist-BvsCdwbL.cjs +1 -0
- package/dist/dist-C0_uLrCb.cjs +6 -0
- package/dist/dist-C8jjSrIs.cjs +11 -0
- package/dist/dist-C9dtxVRR.cjs +1 -0
- package/dist/dist-CA6ERWRG.js +380 -0
- package/dist/dist-CHKg1Qb9.js +1583 -0
- package/dist/dist-CyFPTQ2l.cjs +1 -0
- package/dist/dist-D8I4FQ-Q.cjs +1 -0
- package/dist/dist-DEl2Ze0j.cjs +2 -0
- package/dist/dist-DJbgM591.cjs +1 -0
- package/dist/dist-DPXHxuWb.js +855 -0
- package/dist/dist-DZrtSp8H.js +607 -0
- package/dist/dist-Dja2VlN5.cjs +1 -0
- package/dist/dist-DqbI0un6.cjs +1 -0
- package/dist/dist-Dr4zY56l.js +440 -0
- package/dist/dist-Dvqp7T4I.cjs +1 -0
- package/dist/dist-FSzij9Rn.js +271 -0
- package/dist/dist-Xjm88mbq.js +756 -0
- package/dist/dist-qNFo_ASR.cjs +9 -0
- package/dist/dist-qq9a_ch2.js +431 -0
- package/dist/dockerfile-4x0UkDoN.js +291 -0
- package/dist/dockerfile-C67wRfne.cjs +1 -0
- package/dist/docxExport-BKC_hi5D.js +67 -0
- package/dist/docxExport-V7joLrkm.cjs +3 -0
- package/dist/{docxExport-BWwEuboU.js → loadReferencedImage-FGse7G4p.js} +538 -306
- package/dist/{docxExport-PjDC4XKL.cjs → loadReferencedImage-QespeGh9.cjs} +7 -9
- package/dist/pi-outpost-embed.cjs +51 -24
- package/dist/pi-outpost-embed.js +3769 -3519
- package/dist/properties-C85NeSsH.js +20 -0
- package/dist/properties-XjDvZYDm.cjs +1 -0
- package/dist/ruby-Bx72aP7E.cjs +1 -0
- package/dist/ruby-CjYBP7RB.js +166 -0
- package/dist/shell-CD1ADQh5.cjs +1 -0
- package/dist/shell-CevoiH_y.js +109 -0
- package/dist/toml-CPJF62TK.js +28 -0
- package/dist/toml-OuUxin0A.cjs +1 -0
- package/package.json +1 -1
- package/dist/loadReferencedImage-C8Hn2ejN.js +0 -268
- package/dist/loadReferencedImage-q-G47ESL.cjs +0 -1
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
//#region ../node_modules/@codemirror/legacy-modes/mode/simple-mode.js
|
|
2
|
+
function e(e) {
|
|
3
|
+
t(e, "start");
|
|
4
|
+
var n = {}, r = e.languageData || {}, s = !1;
|
|
5
|
+
for (var c in e) if (c != r && e.hasOwnProperty(c)) for (var l = n[c] = [], u = e[c], d = 0; d < u.length; d++) {
|
|
6
|
+
var f = u[d];
|
|
7
|
+
l.push(new i(f, e)), (f.indent || f.dedent) && (s = !0);
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
name: r.name,
|
|
11
|
+
startState: function() {
|
|
12
|
+
return {
|
|
13
|
+
state: "start",
|
|
14
|
+
pending: null,
|
|
15
|
+
indent: s ? [] : null
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
copyState: function(e) {
|
|
19
|
+
var t = {
|
|
20
|
+
state: e.state,
|
|
21
|
+
pending: e.pending,
|
|
22
|
+
indent: e.indent && e.indent.slice(0)
|
|
23
|
+
};
|
|
24
|
+
return e.stack && (t.stack = e.stack.slice(0)), t;
|
|
25
|
+
},
|
|
26
|
+
token: a(n),
|
|
27
|
+
indent: o(n, r),
|
|
28
|
+
mergeTokens: r.mergeTokens,
|
|
29
|
+
languageData: r
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function t(e, t) {
|
|
33
|
+
if (!e.hasOwnProperty(t)) throw Error("Undefined state " + t + " in simple mode");
|
|
34
|
+
}
|
|
35
|
+
function n(e, t) {
|
|
36
|
+
if (!e) return /(?:)/;
|
|
37
|
+
var n = "";
|
|
38
|
+
return e instanceof RegExp ? (e.ignoreCase && (n = "i"), e.unicode && (n += "u"), e = e.source) : e = String(e), RegExp((t === !1 ? "" : "^") + "(?:" + e + ")", n);
|
|
39
|
+
}
|
|
40
|
+
function r(e) {
|
|
41
|
+
if (!e) return null;
|
|
42
|
+
if (e.apply) return e;
|
|
43
|
+
if (typeof e == "string") return e.replace(/\./g, " ");
|
|
44
|
+
for (var t = [], n = 0; n < e.length; n++) t.push(e[n] && e[n].replace(/\./g, " "));
|
|
45
|
+
return t;
|
|
46
|
+
}
|
|
47
|
+
function i(e, i) {
|
|
48
|
+
(e.next || e.push) && t(i, e.next || e.push), this.regex = n(e.regex), this.token = r(e.token), this.data = e;
|
|
49
|
+
}
|
|
50
|
+
function a(e) {
|
|
51
|
+
return function(t, n) {
|
|
52
|
+
if (n.pending) {
|
|
53
|
+
var r = n.pending.shift();
|
|
54
|
+
return n.pending.length == 0 && (n.pending = null), t.pos += r.text.length, r.token;
|
|
55
|
+
}
|
|
56
|
+
for (var i = e[n.state], a = 0; a < i.length; a++) {
|
|
57
|
+
var o = i[a], s = (!o.data.sol || t.sol()) && t.match(o.regex);
|
|
58
|
+
if (s) {
|
|
59
|
+
o.data.next ? n.state = o.data.next : o.data.push ? ((n.stack ||= []).push(n.state), n.state = o.data.push) : o.data.pop && n.stack && n.stack.length && (n.state = n.stack.pop()), o.data.indent && n.indent.push(t.indentation() + t.indentUnit), o.data.dedent && n.indent.pop();
|
|
60
|
+
var c = o.token;
|
|
61
|
+
if (c && c.apply && (c = c(s)), s.length > 2 && o.token && typeof o.token != "string") {
|
|
62
|
+
n.pending = [];
|
|
63
|
+
for (var l = 2; l < s.length; l++) s[l] && n.pending.push({
|
|
64
|
+
text: s[l],
|
|
65
|
+
token: o.token[l - 1]
|
|
66
|
+
});
|
|
67
|
+
return t.backUp(s[0].length - (s[1] ? s[1].length : 0)), c[0];
|
|
68
|
+
}
|
|
69
|
+
return c && c.join ? c[0] : c;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return t.next(), null;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function o(e, t) {
|
|
76
|
+
return function(n, r) {
|
|
77
|
+
if (n.indent == null || t.dontIndentStates && t.dontIndentStates.indexOf(n.state) > -1) return null;
|
|
78
|
+
var i = n.indent.length - 1, a = e[n.state];
|
|
79
|
+
scan: for (;;) {
|
|
80
|
+
for (var o = 0; o < a.length; o++) {
|
|
81
|
+
var s = a[o];
|
|
82
|
+
if (s.data.dedent && s.data.dedentIfLineStart !== !1) {
|
|
83
|
+
var c = s.regex.exec(r);
|
|
84
|
+
if (c && c[0]) {
|
|
85
|
+
i--, (s.next || s.push) && (a = e[s.next || s.push]), r = r.slice(c[0].length);
|
|
86
|
+
continue scan;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
return i < 0 ? 0 : n.indent[i];
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region ../node_modules/@codemirror/legacy-modes/mode/dockerfile.js
|
|
97
|
+
var s = "from", c = RegExp("^(\\s*)\\b(" + s + ")\\b", "i"), l = [
|
|
98
|
+
"run",
|
|
99
|
+
"cmd",
|
|
100
|
+
"entrypoint",
|
|
101
|
+
"shell"
|
|
102
|
+
], u = RegExp("^(\\s*)(" + l.join("|") + ")(\\s+\\[)", "i"), d = "expose", f = RegExp("^(\\s*)(" + d + ")(\\s+)", "i"), p = "(" + [s, d].concat(l, [
|
|
103
|
+
"arg",
|
|
104
|
+
"from",
|
|
105
|
+
"maintainer",
|
|
106
|
+
"label",
|
|
107
|
+
"env",
|
|
108
|
+
"add",
|
|
109
|
+
"copy",
|
|
110
|
+
"volume",
|
|
111
|
+
"user",
|
|
112
|
+
"workdir",
|
|
113
|
+
"onbuild",
|
|
114
|
+
"stopsignal",
|
|
115
|
+
"healthcheck",
|
|
116
|
+
"shell"
|
|
117
|
+
]).join("|") + ")", m = RegExp("^(\\s*)" + p + "(\\s*)(#.*)?$", "i"), h = RegExp("^(\\s*)" + p + "(\\s+)", "i"), g = e({
|
|
118
|
+
start: [
|
|
119
|
+
{
|
|
120
|
+
regex: /^\s*#.*$/,
|
|
121
|
+
sol: !0,
|
|
122
|
+
token: "comment"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
regex: c,
|
|
126
|
+
token: [null, "keyword"],
|
|
127
|
+
sol: !0,
|
|
128
|
+
next: "from"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
regex: m,
|
|
132
|
+
token: [
|
|
133
|
+
null,
|
|
134
|
+
"keyword",
|
|
135
|
+
null,
|
|
136
|
+
"error"
|
|
137
|
+
],
|
|
138
|
+
sol: !0
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
regex: u,
|
|
142
|
+
token: [
|
|
143
|
+
null,
|
|
144
|
+
"keyword",
|
|
145
|
+
null
|
|
146
|
+
],
|
|
147
|
+
sol: !0,
|
|
148
|
+
next: "array"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
regex: f,
|
|
152
|
+
token: [
|
|
153
|
+
null,
|
|
154
|
+
"keyword",
|
|
155
|
+
null
|
|
156
|
+
],
|
|
157
|
+
sol: !0,
|
|
158
|
+
next: "expose"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
regex: h,
|
|
162
|
+
token: [
|
|
163
|
+
null,
|
|
164
|
+
"keyword",
|
|
165
|
+
null
|
|
166
|
+
],
|
|
167
|
+
sol: !0,
|
|
168
|
+
next: "arguments"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
regex: /./,
|
|
172
|
+
token: null
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
from: [
|
|
176
|
+
{
|
|
177
|
+
regex: /\s*$/,
|
|
178
|
+
token: null,
|
|
179
|
+
next: "start"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
regex: /(\s*)(#.*)$/,
|
|
183
|
+
token: [null, "error"],
|
|
184
|
+
next: "start"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
regex: /(\s*\S+\s+)(as)/i,
|
|
188
|
+
token: [null, "keyword"],
|
|
189
|
+
next: "start"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
token: null,
|
|
193
|
+
next: "start"
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
single: [{
|
|
197
|
+
regex: /(?:[^\\']|\\.)/,
|
|
198
|
+
token: "string"
|
|
199
|
+
}, {
|
|
200
|
+
regex: /'/,
|
|
201
|
+
token: "string",
|
|
202
|
+
pop: !0
|
|
203
|
+
}],
|
|
204
|
+
double: [{
|
|
205
|
+
regex: /(?:[^\\"]|\\.)/,
|
|
206
|
+
token: "string"
|
|
207
|
+
}, {
|
|
208
|
+
regex: /"/,
|
|
209
|
+
token: "string",
|
|
210
|
+
pop: !0
|
|
211
|
+
}],
|
|
212
|
+
array: [{
|
|
213
|
+
regex: /\]/,
|
|
214
|
+
token: null,
|
|
215
|
+
next: "start"
|
|
216
|
+
}, {
|
|
217
|
+
regex: /"(?:[^\\"]|\\.)*"?/,
|
|
218
|
+
token: "string"
|
|
219
|
+
}],
|
|
220
|
+
expose: [
|
|
221
|
+
{
|
|
222
|
+
regex: /\d+$/,
|
|
223
|
+
token: "number",
|
|
224
|
+
next: "start"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
regex: /[^\d]+$/,
|
|
228
|
+
token: null,
|
|
229
|
+
next: "start"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
regex: /\d+/,
|
|
233
|
+
token: "number"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
regex: /[^\d]+/,
|
|
237
|
+
token: null
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
token: null,
|
|
241
|
+
next: "start"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
arguments: [
|
|
245
|
+
{
|
|
246
|
+
regex: /^\s*#.*$/,
|
|
247
|
+
sol: !0,
|
|
248
|
+
token: "comment"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
regex: /"(?:[^\\"]|\\.)*"?$/,
|
|
252
|
+
token: "string",
|
|
253
|
+
next: "start"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
regex: /"/,
|
|
257
|
+
token: "string",
|
|
258
|
+
push: "double"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
regex: /'(?:[^\\']|\\.)*'?$/,
|
|
262
|
+
token: "string",
|
|
263
|
+
next: "start"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
regex: /'/,
|
|
267
|
+
token: "string",
|
|
268
|
+
push: "single"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
regex: /[^#"']+[\\`]$/,
|
|
272
|
+
token: null
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
regex: /[^#"']+$/,
|
|
276
|
+
token: null,
|
|
277
|
+
next: "start"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
regex: /[^#"']+/,
|
|
281
|
+
token: null
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
token: null,
|
|
285
|
+
next: "start"
|
|
286
|
+
}
|
|
287
|
+
],
|
|
288
|
+
languageData: { commentTokens: { line: "#" } }
|
|
289
|
+
});
|
|
290
|
+
//#endregion
|
|
291
|
+
export { g as dockerFile };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){t(e,`start`);var n={},r=e.languageData||{},s=!1;for(var c in e)if(c!=r&&e.hasOwnProperty(c))for(var l=n[c]=[],u=e[c],d=0;d<u.length;d++){var f=u[d];l.push(new i(f,e)),(f.indent||f.dedent)&&(s=!0)}return{name:r.name,startState:function(){return{state:`start`,pending:null,indent:s?[]:null}},copyState:function(e){var t={state:e.state,pending:e.pending,indent:e.indent&&e.indent.slice(0)};return e.stack&&(t.stack=e.stack.slice(0)),t},token:a(n),indent:o(n,r),mergeTokens:r.mergeTokens,languageData:r}}function t(e,t){if(!e.hasOwnProperty(t))throw Error(`Undefined state `+t+` in simple mode`)}function n(e,t){if(!e)return/(?:)/;var n=``;return e instanceof RegExp?(e.ignoreCase&&(n=`i`),e.unicode&&(n+=`u`),e=e.source):e=String(e),RegExp((t===!1?``:`^`)+`(?:`+e+`)`,n)}function r(e){if(!e)return null;if(e.apply)return e;if(typeof e==`string`)return e.replace(/\./g,` `);for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g,` `));return t}function i(e,i){(e.next||e.push)&&t(i,e.next||e.push),this.regex=n(e.regex),this.token=r(e.token),this.data=e}function a(e){return function(t,n){if(n.pending){var r=n.pending.shift();return n.pending.length==0&&(n.pending=null),t.pos+=r.text.length,r.token}for(var i=e[n.state],a=0;a<i.length;a++){var o=i[a],s=(!o.data.sol||t.sol())&&t.match(o.regex);if(s){o.data.next?n.state=o.data.next:o.data.push?((n.stack||=[]).push(n.state),n.state=o.data.push):o.data.pop&&n.stack&&n.stack.length&&(n.state=n.stack.pop()),o.data.indent&&n.indent.push(t.indentation()+t.indentUnit),o.data.dedent&&n.indent.pop();var c=o.token;if(c&&c.apply&&(c=c(s)),s.length>2&&o.token&&typeof o.token!=`string`){n.pending=[];for(var l=2;l<s.length;l++)s[l]&&n.pending.push({text:s[l],token:o.token[l-1]});return t.backUp(s[0].length-(s[1]?s[1].length:0)),c[0]}return c&&c.join?c[0]:c}}return t.next(),null}}function o(e,t){return function(n,r){if(n.indent==null||t.dontIndentStates&&t.dontIndentStates.indexOf(n.state)>-1)return null;var i=n.indent.length-1,a=e[n.state];scan:for(;;){for(var o=0;o<a.length;o++){var s=a[o];if(s.data.dedent&&s.data.dedentIfLineStart!==!1){var c=s.regex.exec(r);if(c&&c[0]){i--,(s.next||s.push)&&(a=e[s.next||s.push]),r=r.slice(c[0].length);continue scan}}}break}return i<0?0:n.indent[i]}}var s=`from`,c=RegExp(`^(\\s*)\\b(`+s+`)\\b`,`i`),l=[`run`,`cmd`,`entrypoint`,`shell`],u=RegExp(`^(\\s*)(`+l.join(`|`)+`)(\\s+\\[)`,`i`),d=`expose`,f=RegExp(`^(\\s*)(`+d+`)(\\s+)`,`i`),p=`(`+[s,d].concat(l,[`arg`,`from`,`maintainer`,`label`,`env`,`add`,`copy`,`volume`,`user`,`workdir`,`onbuild`,`stopsignal`,`healthcheck`,`shell`]).join(`|`)+`)`,m=RegExp(`^(\\s*)`+p+`(\\s*)(#.*)?$`,`i`),h=RegExp(`^(\\s*)`+p+`(\\s+)`,`i`),g=e({start:[{regex:/^\s*#.*$/,sol:!0,token:`comment`},{regex:c,token:[null,`keyword`],sol:!0,next:`from`},{regex:m,token:[null,`keyword`,null,`error`],sol:!0},{regex:u,token:[null,`keyword`,null],sol:!0,next:`array`},{regex:f,token:[null,`keyword`,null],sol:!0,next:`expose`},{regex:h,token:[null,`keyword`,null],sol:!0,next:`arguments`},{regex:/./,token:null}],from:[{regex:/\s*$/,token:null,next:`start`},{regex:/(\s*)(#.*)$/,token:[null,`error`],next:`start`},{regex:/(\s*\S+\s+)(as)/i,token:[null,`keyword`],next:`start`},{token:null,next:`start`}],single:[{regex:/(?:[^\\']|\\.)/,token:`string`},{regex:/'/,token:`string`,pop:!0}],double:[{regex:/(?:[^\\"]|\\.)/,token:`string`},{regex:/"/,token:`string`,pop:!0}],array:[{regex:/\]/,token:null,next:`start`},{regex:/"(?:[^\\"]|\\.)*"?/,token:`string`}],expose:[{regex:/\d+$/,token:`number`,next:`start`},{regex:/[^\d]+$/,token:null,next:`start`},{regex:/\d+/,token:`number`},{regex:/[^\d]+/,token:null},{token:null,next:`start`}],arguments:[{regex:/^\s*#.*$/,sol:!0,token:`comment`},{regex:/"(?:[^\\"]|\\.)*"?$/,token:`string`,next:`start`},{regex:/"/,token:`string`,push:`double`},{regex:/'(?:[^\\']|\\.)*'?$/,token:`string`,next:`start`},{regex:/'/,token:`string`,push:`single`},{regex:/[^#"']+[\\`]$/,token:null},{regex:/[^#"']+$/,token:null,next:`start`},{regex:/[^#"']+/,token:null},{token:null,next:`start`}],languageData:{commentTokens:{line:`#`}}});exports.dockerFile=g;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { h as e } from "./lib-BgQYQRfw.js";
|
|
2
|
+
import { c as t, d as n, f as r, i, l as a, n as o, s, t as c, u as l } from "./loadReferencedImage-FGse7G4p.js";
|
|
3
|
+
//#region ../ui/src/export/markdownToDocx.ts
|
|
4
|
+
async function u(e, n) {
|
|
5
|
+
let r = n?.path ?? "", a = n?.serverUrl ?? "", s = n?.token ?? null, l = n?.workspace;
|
|
6
|
+
return t(e, {
|
|
7
|
+
imageKey: (e) => o(r, e, a, s, l),
|
|
8
|
+
loadImage: (e) => c(r, e, a, s, l),
|
|
9
|
+
renderDiagram: i
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ../ui/src/export/plainTextToDocx.ts
|
|
14
|
+
var d = "Consolas, Courier New, monospace";
|
|
15
|
+
function f(e) {
|
|
16
|
+
return e.replace(/\r\n/g, "\n").replace(/\n$/, "").split("\n").map((e) => new n({
|
|
17
|
+
children: [new r({
|
|
18
|
+
text: a(e === "" ? " " : e),
|
|
19
|
+
font: d
|
|
20
|
+
})],
|
|
21
|
+
spacing: {
|
|
22
|
+
before: 0,
|
|
23
|
+
after: 0
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region ../ui/src/export/docxExport.ts
|
|
29
|
+
function p(e) {
|
|
30
|
+
let t = e.split(/[/\\]/).pop() ?? "document", n = t.lastIndexOf(".");
|
|
31
|
+
return `${n > 0 ? t.slice(0, n) : t}.docx`;
|
|
32
|
+
}
|
|
33
|
+
function m(e) {
|
|
34
|
+
return /\.(md|markdown)$/i.test(e);
|
|
35
|
+
}
|
|
36
|
+
async function h(e, t, n) {
|
|
37
|
+
return l.toBlob(s(await g(e, t, n)));
|
|
38
|
+
}
|
|
39
|
+
async function g(e, t, n) {
|
|
40
|
+
return m(t) ? u(e, {
|
|
41
|
+
...n,
|
|
42
|
+
path: t
|
|
43
|
+
}) : f(e);
|
|
44
|
+
}
|
|
45
|
+
async function _(t, n, r) {
|
|
46
|
+
e(await h(t, n, r), p(n));
|
|
47
|
+
}
|
|
48
|
+
var v = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
49
|
+
async function y(e, t, n) {
|
|
50
|
+
let r = await h(e, t, n), i = { "Content-Type": v };
|
|
51
|
+
n?.token && (i.Authorization = `Bearer ${n.token}`);
|
|
52
|
+
let a = await fetch(`${n?.serverUrl ?? ""}/files/docx-template`, {
|
|
53
|
+
method: "POST",
|
|
54
|
+
headers: i,
|
|
55
|
+
body: r
|
|
56
|
+
});
|
|
57
|
+
if (!a.ok) {
|
|
58
|
+
let e = await a.json().catch(() => null);
|
|
59
|
+
throw Error(e?.message ?? `the server answered ${a.status}`);
|
|
60
|
+
}
|
|
61
|
+
return a.blob();
|
|
62
|
+
}
|
|
63
|
+
async function b(t, n, r) {
|
|
64
|
+
e(await y(t, n, r), p(n));
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { _ as downloadDocx, b as downloadDocxInTemplate };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=require("./lib-DVuUFI8o.cjs"),t=require("./loadReferencedImage-QespeGh9.cjs");async function n(e,n){let r=n?.path??``,i=n?.serverUrl??``,a=n?.token??null,o=n?.workspace;return t.c(e,{imageKey:e=>t.n(r,e,i,a,o),loadImage:e=>t.t(r,e,i,a,o),renderDiagram:t.i})}var r=`Consolas, Courier New, monospace`;function i(e){return e.replace(/\r\n/g,`
|
|
2
|
+
`).replace(/\n$/,``).split(`
|
|
3
|
+
`).map(e=>new t.d({children:[new t.f({text:t.l(e===``?` `:e),font:r})],spacing:{before:0,after:0}}))}function a(e){let t=e.split(/[/\\]/).pop()??`document`,n=t.lastIndexOf(`.`);return`${n>0?t.slice(0,n):t}.docx`}function o(e){return/\.(md|markdown)$/i.test(e)}async function s(e,n,r){return t.u.toBlob(t.s(await c(e,n,r)))}async function c(e,t,r){return o(t)?n(e,{...r,path:t}):i(e)}async function l(t,n,r){e.h(await s(t,n,r),a(n))}var u=`application/vnd.openxmlformats-officedocument.wordprocessingml.document`;async function d(e,t,n){let r=await s(e,t,n),i={"Content-Type":u};n?.token&&(i.Authorization=`Bearer ${n.token}`);let a=await fetch(`${n?.serverUrl??``}/files/docx-template`,{method:`POST`,headers:i,body:r});if(!a.ok){let e=await a.json().catch(()=>null);throw Error(e?.message??`the server answered ${a.status}`)}return a.blob()}async function f(t,n,r){e.h(await d(t,n,r),a(n))}exports.downloadDocx=l,exports.downloadDocxInTemplate=f;
|