@pi-outpost/embed 0.23.0 → 0.24.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,89 +0,0 @@
1
- //#region ../ui/src/util/workspacePath.ts
2
- function e(e) {
3
- return /^[a-z][a-z0-9+.-]*:/i.test(e) || e.startsWith("//");
4
- }
5
- function t(e, t) {
6
- let n = t.split(/[?#]/)[0], r = n.startsWith("/") ? n.split("/") : [...e.split("/").slice(0, -1), ...n.split("/")], i = [];
7
- for (let e of r) e !== "" && e !== "." && (e === ".." ? i.pop() : i.push(e));
8
- return i.join("/");
9
- }
10
- function n(e) {
11
- return /\.(png|jpe?g|gif|webp|svg|avif)$/i.test(e);
12
- }
13
- function r(e) {
14
- return /\.pdf$/i.test(e);
15
- }
16
- function i(e) {
17
- return /\.(docx|xlsx|pptx)$/i.test(e);
18
- }
19
- function a(e, t, n, r) {
20
- let i = n ? `&token=${encodeURIComponent(n)}` : "", a = r === void 0 ? "" : `&v=${encodeURIComponent(String(r))}`;
21
- return `${e}/files/raw?path=${encodeURIComponent(t)}${i}${a}`;
22
- }
23
- function o(e) {
24
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25
- }
26
- function s(e, t, n = Infinity) {
27
- if (t === "") return [];
28
- let r = new RegExp(o(t), "gi"), i = [], a;
29
- for (; (a = r.exec(e)) !== null && (i.push({
30
- start: a.index,
31
- end: a.index + a[0].length
32
- }), !(i.length >= n)););
33
- return i;
34
- }
35
- function c(e) {
36
- let t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), n = [], r = "";
37
- for (let e = t.nextNode(); e !== null; e = t.nextNode()) {
38
- let t = e.data.length;
39
- t !== 0 && (n.push({
40
- node: e,
41
- start: r.length,
42
- end: r.length + t
43
- }), r += e.data);
44
- }
45
- return {
46
- nodes: n,
47
- text: r
48
- };
49
- }
50
- function l(e, t, n = 3e3) {
51
- let r = {
52
- matches: [],
53
- truncated: !1,
54
- clear: () => {}
55
- };
56
- if (t === "") return r;
57
- let { nodes: i, text: a } = c(e);
58
- if (a === "") return r;
59
- let o = s(a, t, n + 1), l = o.length > n, u = l ? o.slice(0, n) : o;
60
- if (u.length === 0) return {
61
- matches: [],
62
- truncated: l,
63
- clear: () => {}
64
- };
65
- let d = Array(u.length);
66
- for (let e = u.length - 1; e >= 0; e--) {
67
- let { start: t, end: n } = u[e], r = [];
68
- for (let e of i) {
69
- if (e.end <= t || e.start >= n) continue;
70
- let i = Math.max(0, t - e.start), a = Math.min(e.node.data.length, n - e.start);
71
- if (i >= a) continue;
72
- let o = e.node;
73
- a < o.data.length && o.splitText(a);
74
- let s = i > 0 ? o.splitText(i) : o, c = document.createElement("mark");
75
- c.className = "find-match", s.replaceWith(c), c.appendChild(s), r.push(c);
76
- }
77
- d[e] = { marks: r };
78
- }
79
- return {
80
- matches: d,
81
- truncated: l,
82
- clear: () => {
83
- for (let { marks: e } of d) for (let t of e) t.replaceWith(document.createTextNode(t.textContent ?? ""));
84
- e.normalize();
85
- }
86
- };
87
- }
88
- //#endregion
89
- export { n as a, t as c, e as i, l as n, r as o, i as r, a as s, s as t };
@@ -1 +0,0 @@
1
- function e(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith(`//`)}function t(e,t){let n=t.split(/[?#]/)[0],r=n.startsWith(`/`)?n.split(`/`):[...e.split(`/`).slice(0,-1),...n.split(`/`)],i=[];for(let e of r)e!==``&&e!==`.`&&(e===`..`?i.pop():i.push(e));return i.join(`/`)}function n(e){return/\.(png|jpe?g|gif|webp|svg|avif)$/i.test(e)}function r(e){return/\.pdf$/i.test(e)}function i(e){return/\.(docx|xlsx|pptx)$/i.test(e)}function a(e,t,n,r){let i=n?`&token=${encodeURIComponent(n)}`:``,a=r===void 0?``:`&v=${encodeURIComponent(String(r))}`;return`${e}/files/raw?path=${encodeURIComponent(t)}${i}${a}`}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function s(e,t,n=1/0){if(t===``)return[];let r=new RegExp(o(t),`gi`),i=[],a;for(;(a=r.exec(e))!==null&&(i.push({start:a.index,end:a.index+a[0].length}),!(i.length>=n)););return i}function c(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[],r=``;for(let e=t.nextNode();e!==null;e=t.nextNode()){let t=e.data.length;t!==0&&(n.push({node:e,start:r.length,end:r.length+t}),r+=e.data)}return{nodes:n,text:r}}function l(e,t,n=3e3){let r={matches:[],truncated:!1,clear:()=>{}};if(t===``)return r;let{nodes:i,text:a}=c(e);if(a===``)return r;let o=s(a,t,n+1),l=o.length>n,u=l?o.slice(0,n):o;if(u.length===0)return{matches:[],truncated:l,clear:()=>{}};let d=Array(u.length);for(let e=u.length-1;e>=0;e--){let{start:t,end:n}=u[e],r=[];for(let e of i){if(e.end<=t||e.start>=n)continue;let i=Math.max(0,t-e.start),a=Math.min(e.node.data.length,n-e.start);if(i>=a)continue;let o=e.node;a<o.data.length&&o.splitText(a);let s=i>0?o.splitText(i):o,c=document.createElement(`mark`);c.className=`find-match`,s.replaceWith(c),c.appendChild(s),r.push(c)}d[e]={marks:r}}return{matches:d,truncated:l,clear:()=>{for(let{marks:e}of d)for(let t of e)t.replaceWith(document.createTextNode(t.textContent??``));e.normalize()}}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});