@pi-outpost/embed 0.44.0 → 0.46.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.
@@ -1,12 +1,12 @@
1
1
  import { t as e } from "./download-DVJ5QY85.js";
2
- import { a as t, c as n, d as r, f as i, l as a, p as o, u as s } from "./mermaidToImage-B2aJB9x8.js";
3
- import { n as c, t as l } from "./loadReferencedImage-2qNdVVhQ.js";
2
+ import { a as t, c as n, d as r, f as i, h as a, m as o, p as s } from "./mermaidToImage-knc9XzLd.js";
3
+ import { n as c, t as l } from "./loadReferencedImage-LF2DEOPa.js";
4
4
  //#region ../ui/src/export/markdownToDocx.ts
5
5
  async function u(e, n) {
6
- let r = n?.path ?? "", i = n?.serverUrl ?? "", o = n?.token ?? null, s = n?.workspace;
7
- return a(e, {
8
- imageKey: (e) => c(r, e, i, o, s),
9
- loadImage: (e) => l(r, e, i, o, s),
6
+ let i = n?.path ?? "", a = n?.serverUrl ?? "", o = n?.token ?? null, s = n?.workspace;
7
+ return r(e, {
8
+ imageKey: (e) => c(i, e, a, o, s),
9
+ loadImage: (e) => l(i, e, a, o, s),
10
10
  renderDiagram: t
11
11
  });
12
12
  }
@@ -14,9 +14,9 @@ async function u(e, n) {
14
14
  //#region ../ui/src/export/plainTextToDocx.ts
15
15
  var d = "Consolas, Courier New, monospace";
16
16
  function f(e) {
17
- return e.replace(/\r\n/g, "\n").replace(/\n$/, "").split("\n").map((e) => new i({
18
- children: [new o({
19
- text: s(e === "" ? " " : e),
17
+ return e.replace(/\r\n/g, "\n").replace(/\n$/, "").split("\n").map((e) => new o({
18
+ children: [new a({
19
+ text: i(e === "" ? " " : e),
20
20
  font: d
21
21
  })],
22
22
  spacing: {
@@ -34,8 +34,8 @@ function p(e) {
34
34
  function m(e) {
35
35
  return /\.(md|markdown)$/i.test(e);
36
36
  }
37
- async function h(e, t, i) {
38
- return r.toBlob(n(await g(e, t, i)));
37
+ async function h(e, t, r) {
38
+ return s.toBlob(n(await g(e, t, r)));
39
39
  }
40
40
  async function g(e, t, n) {
41
41
  return m(t) ? u(e, {
@@ -1,3 +1,3 @@
1
- const e=require("./download-U7JEZ6c9.cjs"),t=require("./mermaidToImage-qujM0Ggp.cjs"),n=require("./loadReferencedImage-qVqyIGz2.cjs");async function r(e,r){let i=r?.path??``,a=r?.serverUrl??``,o=r?.token??null,s=r?.workspace;return t.l(e,{imageKey:e=>n.n(i,e,a,o,s),loadImage:e=>n.t(i,e,a,o,s),renderDiagram:t.a})}var i=`Consolas, Courier New, monospace`;function a(e){return e.replace(/\r\n/g,`
1
+ const e=require("./download-U7JEZ6c9.cjs"),t=require("./mermaidToImage-Ckx06W6z.cjs"),n=require("./loadReferencedImage-RUfxAG0o.cjs");async function r(e,r){let i=r?.path??``,a=r?.serverUrl??``,o=r?.token??null,s=r?.workspace;return t.d(e,{imageKey:e=>n.n(i,e,a,o,s),loadImage:e=>n.t(i,e,a,o,s),renderDiagram:t.a})}var i=`Consolas, Courier New, monospace`;function a(e){return e.replace(/\r\n/g,`
2
2
  `).replace(/\n$/,``).split(`
3
- `).map(e=>new t.f({children:[new t.p({text:t.u(e===``?` `:e),font:i})],spacing:{before:0,after:0}}))}function o(e){let t=e.split(/[/\\]/).pop()??`document`,n=t.lastIndexOf(`.`);return`${n>0?t.slice(0,n):t}.docx`}function s(e){return/\.(md|markdown)$/i.test(e)}async function c(e,n,r){return t.d.toBlob(t.c(await l(e,n,r)))}async function l(e,t,n){return s(t)?r(e,{...n,path:t}):a(e)}async function u(t,n,r){e.t(await c(t,n,r),o(n))}var d=`application/vnd.openxmlformats-officedocument.wordprocessingml.document`;async function f(e,t,n){let r=await c(e,t,n),i={"Content-Type":d};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 p(t,n,r){e.t(await f(t,n,r),o(n))}exports.downloadDocx=u,exports.downloadDocxInTemplate=p;
3
+ `).map(e=>new t.m({children:[new t.h({text:t.f(e===``?` `:e),font:i})],spacing:{before:0,after:0}}))}function o(e){let t=e.split(/[/\\]/).pop()??`document`,n=t.lastIndexOf(`.`);return`${n>0?t.slice(0,n):t}.docx`}function s(e){return/\.(md|markdown)$/i.test(e)}async function c(e,n,r){return t.p.toBlob(t.c(await l(e,n,r)))}async function l(e,t,n){return s(t)?r(e,{...n,path:t}):a(e)}async function u(t,n,r){e.t(await c(t,n,r),o(n))}var d=`application/vnd.openxmlformats-officedocument.wordprocessingml.document`;async function f(e,t,n){let r=await c(e,t,n),i={"Content-Type":d};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 p(t,n,r){e.t(await f(t,n,r),o(n))}exports.downloadDocx=u,exports.downloadDocxInTemplate=p;
@@ -1,11 +1,11 @@
1
- import { a as e, n as t, s as n } from "./workspacePath-Dzahj9-k.js";
2
- import { i as r, n as i, o as a, s as o, t as s } from "./mermaidToImage-B2aJB9x8.js";
1
+ import { c as e, o as t, r as n } from "./workspacePath-j4IUi8yY.js";
2
+ import { i as r, n as i, o as a, s as o, t as s } from "./mermaidToImage-knc9XzLd.js";
3
3
  //#region ../ui/src/export/loadReferencedImage.ts
4
4
  function c(e) {
5
- return e !== "" && !t(e);
5
+ return e !== "" && !n(e);
6
6
  }
7
- function l(t, r, i, a, o) {
8
- if (c(r)) return e(i, n(t, r), a, void 0, o);
7
+ function l(n, r, i, a, o) {
8
+ if (c(r)) return t(i, e(n, r), a, void 0, o);
9
9
  }
10
10
  async function u(e, t, n, r, i) {
11
11
  let a = l(e, t, n, r, i);
@@ -1 +1 @@
1
- const e=require("./workspacePath-D0C-ViGF.cjs"),t=require("./mermaidToImage-qujM0Ggp.cjs");function n(t){return t!==``&&!e.n(t)}function r(t,r,i,a,o){if(n(r))return e.a(i,e.s(t,r),a,void 0,o)}async function i(e,t,n,i,o){let s=r(e,t,n,i,o);if(s!==void 0)try{let e=await fetch(s);return e.ok?await a(new Uint8Array(await e.arrayBuffer())):void 0}catch{return}}async function a(e){if(o(e))return s(new TextDecoder().decode(e));let t=u(e);return t===void 0?void 0:{kind:`raster`,...t,bytes:e}}function o(e){return new TextDecoder().decode(e.subarray(0,512)).toLowerCase().includes(`<svg`)}async function s(e){try{let{width:n,height:r}=c(e),i=t.s(e,n,r),a=await t.i(i,n,r);return{kind:`vector`,image:{svg:t.n(i),png:a,width:n,height:r}}}catch{return}}function c(e){try{return t.o(e)}catch{let n=/<svg\b[^>]*>/.exec(e),r=l(n?.[0]??``,`width`),i=l(n?.[0]??``,`height`);if(r===void 0||i===void 0)throw new t.t(`the referenced svg states no size`);return{width:r,height:i}}}function l(e,t){let n=RegExp(`\\s${t}="([^"]*)"`).exec(e)?.[1];if(n===void 0)return;let r=Number.parseFloat(n.replace(/px$/i,``));return Number.isFinite(r)&&r>0&&!n.includes(`%`)?r:void 0}function u(e){return h(e)??g(e)??_(e)??y(e)}function d(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function f(e,t){return e[t]|e[t+1]<<8}function p(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}var m=[137,80,78,71,13,10,26,10];function h(e){if(!(e.length<24)&&m.every((t,n)=>e[n]===t))return b(`png`,d(e,16),d(e,20))}function g(e){if(e.length<10)return;let t=String.fromCharCode(...e.subarray(0,6));if(t===`GIF87a`||t===`GIF89a`)return b(`gif`,f(e,6),f(e,8))}function _(e){if(!(e.length<26||e[0]!==66||e[1]!==77))return b(`bmp`,Math.abs(p(e,18)),Math.abs(p(e,22)))}var v=new Set([192,193,194,195,197,198,199,201,202,203,205,206,207]);function y(e){if(e.length<4||e[0]!==255||e[1]!==216)return;let t=2;for(;t+9<e.length;){if(e[t]!==255){t+=1;continue}let n=e[t+1];if(n===255){t+=1;continue}if(n===216||n===1||n>=208&&n<=215){t+=2;continue}if(v.has(n))return b(`jpg`,e[t+7]<<8|e[t+8],e[t+5]<<8|e[t+6]);let r=e[t+2]<<8|e[t+3];if(r<2)return;t+=2+r}}function b(e,t,n){return t>0&&n>0?{type:e,width:t,height:n}:void 0}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
1
+ const e=require("./workspacePath-BdmjN0W2.cjs"),t=require("./mermaidToImage-Ckx06W6z.cjs");function n(t){return t!==``&&!e.r(t)}function r(t,r,i,a,o){if(n(r))return e.o(i,e.c(t,r),a,void 0,o)}async function i(e,t,n,i,o){let s=r(e,t,n,i,o);if(s!==void 0)try{let e=await fetch(s);return e.ok?await a(new Uint8Array(await e.arrayBuffer())):void 0}catch{return}}async function a(e){if(o(e))return s(new TextDecoder().decode(e));let t=u(e);return t===void 0?void 0:{kind:`raster`,...t,bytes:e}}function o(e){return new TextDecoder().decode(e.subarray(0,512)).toLowerCase().includes(`<svg`)}async function s(e){try{let{width:n,height:r}=c(e),i=t.s(e,n,r),a=await t.i(i,n,r);return{kind:`vector`,image:{svg:t.n(i),png:a,width:n,height:r}}}catch{return}}function c(e){try{return t.o(e)}catch{let n=/<svg\b[^>]*>/.exec(e),r=l(n?.[0]??``,`width`),i=l(n?.[0]??``,`height`);if(r===void 0||i===void 0)throw new t.t(`the referenced svg states no size`);return{width:r,height:i}}}function l(e,t){let n=RegExp(`\\s${t}="([^"]*)"`).exec(e)?.[1];if(n===void 0)return;let r=Number.parseFloat(n.replace(/px$/i,``));return Number.isFinite(r)&&r>0&&!n.includes(`%`)?r:void 0}function u(e){return h(e)??g(e)??_(e)??y(e)}function d(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function f(e,t){return e[t]|e[t+1]<<8}function p(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}var m=[137,80,78,71,13,10,26,10];function h(e){if(!(e.length<24)&&m.every((t,n)=>e[n]===t))return b(`png`,d(e,16),d(e,20))}function g(e){if(e.length<10)return;let t=String.fromCharCode(...e.subarray(0,6));if(t===`GIF87a`||t===`GIF89a`)return b(`gif`,f(e,6),f(e,8))}function _(e){if(!(e.length<26||e[0]!==66||e[1]!==77))return b(`bmp`,Math.abs(p(e,18)),Math.abs(p(e,22)))}var v=new Set([192,193,194,195,197,198,199,201,202,203,205,206,207]);function y(e){if(e.length<4||e[0]!==255||e[1]!==216)return;let t=2;for(;t+9<e.length;){if(e[t]!==255){t+=1;continue}let n=e[t+1];if(n===255){t+=1;continue}if(n===216||n===1||n>=208&&n<=215){t+=2;continue}if(v.has(n))return b(`jpg`,e[t+7]<<8|e[t+8],e[t+5]<<8|e[t+6]);let r=e[t+2]<<8|e[t+3];if(r<2)return;t+=2+r}}function b(e,t,n){return t>0&&n>0?{type:e,width:t,height:n}:void 0}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});