@netless/appliance-plugin 1.1.35-beta.0 → 1.1.36-beta.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.
Files changed (31) hide show
  1. package/cdn/cdn.js +1 -1
  2. package/cdn/{fullWorker-BShzOf.js → fullWorker-Cu37fr.js} +1 -1
  3. package/cdn/{subWorker-DofGU2.js → subWorker-le1nnC.js} +1 -1
  4. package/dist/appliance-plugin.js +1 -1
  5. package/dist/appliance-plugin.mjs +1 -1
  6. package/dist/assets/{fullWorker-BLBp1QlT.js → fullWorker-C_pHxd3d.js} +1 -1
  7. package/dist/assets/{subWorker-CA5sK8hX.js → subWorker-mLNCeIEX.js} +1 -1
  8. package/dist/bridge-DO3A2FRh.js +1 -0
  9. package/dist/{bridge-D6IerdOk.mjs → bridge-DskXXarZ.mjs} +5 -5
  10. package/dist/bridge-white-web-sdk.d.ts +1 -0
  11. package/dist/bridge.js +1 -1
  12. package/dist/bridge.mjs +1 -1
  13. package/dist/component/textEditor/utils.d.ts +3 -0
  14. package/dist/fullWorker.js +1 -1
  15. package/dist/index-B00mKJ2E.js +1 -0
  16. package/dist/{index-CPmHcL9u.mjs → index-B4Npl8dw.mjs} +1 -1
  17. package/dist/{index-4k563Sm-.mjs → index-BAT55jp1.mjs} +2522 -2508
  18. package/dist/{index-DR2km5D4.mjs → index-BBcEMXkc.mjs} +1 -1
  19. package/dist/{index-D-IWIyEl.mjs → index-BVkfyJQn.mjs} +1 -1
  20. package/dist/{index-DDL0Hq_X.js → index-CqQPnW7_.js} +1 -1
  21. package/dist/index-D50QxS0c.js +1 -0
  22. package/dist/{index-IQRiGPX7.mjs → index-DDULymwD.mjs} +1 -1
  23. package/dist/{index-D1p6YXf0.mjs → index-DTMQbvIh.mjs} +2390 -2324
  24. package/dist/{index-328yD4vj.js → index-DlkXPynh.js} +1 -1
  25. package/dist/{index-DXx1-O0K.js → index-DoKk1ccL.js} +1 -1
  26. package/dist/{index-CBE_U7Gn.js → index-vfn-RVQz.js} +1 -1
  27. package/dist/subWorker.js +1 -1
  28. package/package.json +2 -1
  29. package/dist/bridge-s6K3XU2g.js +0 -1
  30. package/dist/index-C89lvDjQ.js +0 -1
  31. package/dist/index-DbLWM-6h.js +0 -1
@@ -1,7 +1,7 @@
1
1
  var K = Object.defineProperty;
2
2
  var j = (o, e, t) => e in o ? K(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
3
  var u = (o, e, t) => j(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { E as B, a as y, b as D, c as M, d as E, V as P, S as Z } from "./index-4k563Sm-.mjs";
4
+ import { E as B, a as y, b as D, c as M, d as E, V as P, S as Z } from "./index-DTMQbvIh.mjs";
5
5
  import { isEqual as W, isString as _, clone as J, throttle as Q } from "lodash";
6
6
  import "white-web-sdk";
7
7
  import "spritejs";
@@ -1,7 +1,7 @@
1
1
  var K = Object.defineProperty;
2
2
  var j = (o, e, t) => e in o ? K(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
3
  var u = (o, e, t) => j(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { E as B, a as y, b as D, c as M, d as E, V as P, S as Z } from "./index-D1p6YXf0.mjs";
4
+ import { E as B, a as y, b as D, c as M, d as E, V as P, S as Z } from "./index-BAT55jp1.mjs";
5
5
  import { isEqual as W, isString as _, clone as J, throttle as Q } from "lodash";
6
6
  import "spritejs";
7
7
  import "lz-string";
@@ -1,3 +1,3 @@
1
- "use strict";var j=Object.create;var N=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var R=(o,e,t)=>e in o?N(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var _=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of U(e))!Y.call(o,a)&&a!==t&&N(o,a,{get:()=>e[a],enumerable:!(r=G(e,a))||r.enumerable});return o};var Z=(o,e,t)=>(t=o!=null?j(X(o)):{},_(e||!o||!o.__esModule?N(t,"default",{value:o,enumerable:!0}):t,o));var g=(o,e,t)=>R(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-DbLWM-6h.js"),x=require("lodash");require("spritejs");require("lz-string");require("clipper-lib");require("lineclip");require("xss");require("react-dom");require("react");const J=require("markmap-view"),Q=require("markmap-lib"),ee=require("./ObserverMap-DTz9zucn.js");function te(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const $=te(J);class re{constructor(){g(this,"threadEngine")}registerBackgroundThread(e){return this.threadEngine=e,this}}class ae extends re{constructor(){super(...arguments);g(this,"emitEventType",d.EmitEventType.CopyNode)}async consume(t){const{msgType:r,dataType:a,emitEventType:i}=t;if(r===d.EPostMessageType.FullWork&&a===d.EDataType.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var a;const{workId:r}=t;r&&await((a=this.threadEngine)==null?void 0:a.consumeFull(t))}}class se{constructor(e){g(this,"builders",new Map);this.builders=new Map(e.map(t=>[t,this.build(t)]))}build(e){switch(e){case d.EmitEventType.CopyNode:return new ae}}registerForBackgroundThread(e){return this.builders.forEach(t=>{t&&t.registerBackgroundThread(e)}),this}async consumeForBackgroundThread(e){for(const t of this.builders.values())if(await(t==null?void 0:t.consume(e)))return!0;return!1}}let C=null,A=null,L=!1;function F(o){return!o||typeof o!="string"?!1:/```\s*mermaid[\s\S]*?```/i.test(o)}async function ie(){return C||A||(A=import("mermaid").then(o=>(C=o,A=null,o)).catch(o=>{throw A=null,o}),A)}async function ne(){const o=await ie();return L||(o.default.initialize({startOnLoad:!1,theme:"default"}),L=!0),o}function oe(){return(C==null?void 0:C.default)||null}const M=class M{constructor(){g(this,"mermaidCodeBlocksByWorkId",new Map)}static getInstance(){return M.instance||(M.instance=new M),M.instance}generateId(){return`mermaid-${Math.random().toString(36).substr(2,9)}`}createContainer(e,t,r){if(t&&r){let a=this.mermaidCodeBlocksByWorkId.get(r);a||(a=new Map,this.mermaidCodeBlocksByWorkId.set(r,a)),a.set(e,t)}return`<div class="mermaid-container" data-mermaid-id="${e}"><div class="mermaid-placeholder" id="${e}">正在渲染图表...</div></div>`}getCode(e,t){const r=this.mermaidCodeBlocksByWorkId.get(t);return r==null?void 0:r.get(e)}clear(e){e?this.mermaidCodeBlocksByWorkId.delete(e):this.mermaidCodeBlocksByWorkId.clear()}extendMarkdown(e,t){const r=e.md.renderer,a=r.rules.fence,i=this;r.rules.fence=(s,n,c,h,f)=>{const p=s[n];if(p.info.trim()==="mermaid"){const y=i.generateId();return i.createContainer(y,p.content,t)}return a?a(s,n,c,h,f):""}}static generateId(){return M.getInstance().generateId()}static createContainer(e,t,r){return M.getInstance().createContainer(e,t,r)}static getCode(e,t){return M.getInstance().getCode(e,t)}static clear(e){M.getInstance().clear(e)}static extendMarkdown(e,t){M.getInstance().extendMarkdown(e,t)}};g(M,"instance",null);let E=M;class I{static checkNodeHasMermaid(e){if(!e)return!1;if(e.content&&typeof e.content=="string"&&(e.content.includes('class="mermaid-container"')||e.content.includes("class='mermaid-container'")||e.content.includes("data-mermaid-id=")||e.content.includes("mermaid-placeholder")))return!0;if(e.children&&Array.isArray(e.children)){for(const t of e.children)if(I.checkNodeHasMermaid(t))return!0}return!1}static async renderMermaidAfterDOMUpdate(e,t){await I.renderMermaidBlocks(e,t)}static async renderMermaidBlocks(e,t){if(!e)return;try{await ne()}catch(n){console.error("[renderMermaidBlocks] error: ",n);return}const r=oe();if(!r)return;let a=null,i=!1;for(let n=0;n<30;n++){const c=e.querySelectorAll("foreignObject");if(a=e.querySelectorAll(".mermaid-container"),a.length>0||(c.length>0&&(i=!0),await new Promise(h=>setTimeout(h,50)),i&&n>=20))break}if(!a||a.length===0)return;const s=Array.from(a).map(async(n,c)=>{const h=n,f=h.getAttribute("data-mermaid-id"),p=f?E.getCode(f,t):void 0,m=h.querySelector(".mermaid-placeholder");if(!(!m||!p))try{const w=`mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}-${Date.now()}-${c}`,{svg:v}=await r.render(w,p);if(m&&m.parentNode){const T=document.createElement("div");T.innerHTML=v;const l=T.querySelector("svg");if(l){if(!l.getAttribute("viewBox")&&l.getAttribute("width")&&l.getAttribute("height")){const S=l.getAttribute("width"),k=l.getAttribute("height"),b=parseFloat((S==null?void 0:S.replace(/px|%/,""))||"0"),O=parseFloat((k==null?void 0:k.replace(/px|%/,""))||"0");b>0&&O>0&&l.setAttribute("viewBox",`0 0 ${b} ${O}`)}l.style.display="block",l.style.maxWidth="100%",l.style.width="auto",l.style.height="auto",l.style.overflow="visible",l.style.verticalAlign="top",l.style.objectFit="contain";const u=document.createElement("div");u.className="mermaid-wrapper",u.style.width="100%",u.style.height="auto",u.style.overflow="hidden",u.style.display="inline-block",u.style.verticalAlign="top",u.style.margin="0",u.style.padding="0",u.style.boxSizing="border-box",u.style.position="relative",this.isSafari()&&(u.style.clipPath="inset(100% 0 0 0)",u.style.pointerEvents="none"),u.appendChild(l),l.style.width="100%",l.style.height="100%",l.style.maxWidth="100%",l.style.maxHeight="100%",l.style.objectFit="contain",l.setAttribute("data-type","mermaid"),this.isSafari()&&(l.style.opacity="0"),m.parentNode.replaceChild(u,m)}else m.outerHTML=v}}catch(y){const w=y instanceof Error?y.message:String(y);m&&(m.textContent=`Mermaid 渲染失败: ${w}`,m.style.color="red",m.style.fontSize="12px")}});await Promise.all(s)}static isSafari(){const e=navigator.userAgent.toLowerCase(),t=e.indexOf("safari")!==-1&&e.indexOf("chrome")===-1&&e.indexOf("chromium")===-1,r=!!(navigator.vendor&&navigator.vendor.indexOf("Apple")!==-1);return t||r}static async transformMermaidSvgToMarkmapSvg(e){if(!e)return;await new Promise(s=>setTimeout(s,200));const t=e.querySelectorAll('g[data-mermaid-wrapper][data-mermaid-clone="true"]'),r=e.querySelectorAll("foreignObject"),a=new Set;if(r.forEach(s=>{const n=s.querySelector(".mermaid-container"),c=n==null?void 0:n.getAttribute("data-mermaid-id");c&&a.add(c)}),t.forEach(s=>{const n=s.getAttribute("data-mermaid-id");n&&!a.has(n)&&s.remove()}),r.length===0)return;const i=Array.from(r).map(async s=>{let n=s.querySelector('svg[data-type="mermaid"]');if(!n){const f=s.querySelector(".mermaid-wrapper");f&&(n=f.querySelector('svg[data-type="mermaid"]'))}if(!n)return;const c=s.querySelector(".mermaid-container"),h=c==null?void 0:c.getAttribute("data-mermaid-id");if(h)try{const f=parseFloat(s.getAttribute("x")||"0"),p=parseFloat(s.getAttribute("y")||"0"),m=parseFloat(s.getAttribute("width")||"0"),y=parseFloat(s.getAttribute("height")||"0");if(m<=0||y<=0)return;const w=s.parentElement;if(!w||w.tagName!=="g")return;let v=w.getAttribute("transform");if(!v)v=`translate(${f}, ${p})`;else{const k=v.match(/translate\(([^,]+),([^)]+)\)/);if(k){const b=parseFloat(k[1]),O=parseFloat(k[2]),P=b+f,K=O+p;v=v.replace(/translate\([^)]+\)/,`translate(${P}, ${K})`)}else v=`translate(${f}, ${p}) ${v}`}const T=e.querySelector(`g[data-mermaid-wrapper][data-mermaid-id="${h}"][data-mermaid-clone="true"]`);let l;if(T){l=T;const k=l.querySelector('svg[data-type="mermaid"]');k&&l.removeChild(k)}else l=document.createElementNS("http://www.w3.org/2000/svg","g"),l.setAttribute("data-mermaid-wrapper","true"),l.setAttribute("data-mermaid-clone","true"),l.setAttribute("data-mermaid-id",h);l.setAttribute("transform",v);const u=n.cloneNode(!0);if(u.setAttribute("width",m.toString()),u.setAttribute("height",y.toString()),u.setAttribute("data-mermaid-transformed","true"),u.style.width="",u.style.height="",u.style.maxWidth="",u.style.maxHeight="",u.style.transform="",u.style.transformOrigin="",u.style.display="block",u.style.overflow="visible",u.style.opacity="1",!u.getAttribute("viewBox")){const k=u.getAttribute("width"),b=u.getAttribute("height");if(k&&b){const O=parseFloat(k.replace(/px|%/,"")||"0"),P=parseFloat(b.replace(/px|%/,"")||"0");O>0&&P>0&&u.setAttribute("viewBox",`0 0 ${O} ${P}`)}}l.appendChild(u),T||(w&&w.parentNode?w.parentNode.insertBefore(l,w.nextSibling):e.appendChild(l)),c&&(c.style.opacity="0",c.style.pointerEvents="none")}catch(f){console.error("[transformMermaidSvgToMarkmapSvg] error: ",f)}});await Promise.all(i)}static injectMermaidHtml(e,t,r){const a=[],i=t.split(`
1
+ "use strict";var j=Object.create;var N=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var R=(o,e,t)=>e in o?N(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var _=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of U(e))!Y.call(o,a)&&a!==t&&N(o,a,{get:()=>e[a],enumerable:!(r=G(e,a))||r.enumerable});return o};var Z=(o,e,t)=>(t=o!=null?j(X(o)):{},_(e||!o||!o.__esModule?N(t,"default",{value:o,enumerable:!0}):t,o));var g=(o,e,t)=>R(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-B00mKJ2E.js"),x=require("lodash");require("spritejs");require("lz-string");require("clipper-lib");require("lineclip");require("xss");require("react-dom");require("react");const J=require("markmap-view"),Q=require("markmap-lib"),ee=require("./ObserverMap-DTz9zucn.js");function te(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const $=te(J);class re{constructor(){g(this,"threadEngine")}registerBackgroundThread(e){return this.threadEngine=e,this}}class ae extends re{constructor(){super(...arguments);g(this,"emitEventType",d.EmitEventType.CopyNode)}async consume(t){const{msgType:r,dataType:a,emitEventType:i}=t;if(r===d.EPostMessageType.FullWork&&a===d.EDataType.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var a;const{workId:r}=t;r&&await((a=this.threadEngine)==null?void 0:a.consumeFull(t))}}class se{constructor(e){g(this,"builders",new Map);this.builders=new Map(e.map(t=>[t,this.build(t)]))}build(e){switch(e){case d.EmitEventType.CopyNode:return new ae}}registerForBackgroundThread(e){return this.builders.forEach(t=>{t&&t.registerBackgroundThread(e)}),this}async consumeForBackgroundThread(e){for(const t of this.builders.values())if(await(t==null?void 0:t.consume(e)))return!0;return!1}}let C=null,A=null,L=!1;function F(o){return!o||typeof o!="string"?!1:/```\s*mermaid[\s\S]*?```/i.test(o)}async function ie(){return C||A||(A=import("mermaid").then(o=>(C=o,A=null,o)).catch(o=>{throw A=null,o}),A)}async function ne(){const o=await ie();return L||(o.default.initialize({startOnLoad:!1,theme:"default"}),L=!0),o}function oe(){return(C==null?void 0:C.default)||null}const M=class M{constructor(){g(this,"mermaidCodeBlocksByWorkId",new Map)}static getInstance(){return M.instance||(M.instance=new M),M.instance}generateId(){return`mermaid-${Math.random().toString(36).substr(2,9)}`}createContainer(e,t,r){if(t&&r){let a=this.mermaidCodeBlocksByWorkId.get(r);a||(a=new Map,this.mermaidCodeBlocksByWorkId.set(r,a)),a.set(e,t)}return`<div class="mermaid-container" data-mermaid-id="${e}"><div class="mermaid-placeholder" id="${e}">正在渲染图表...</div></div>`}getCode(e,t){const r=this.mermaidCodeBlocksByWorkId.get(t);return r==null?void 0:r.get(e)}clear(e){e?this.mermaidCodeBlocksByWorkId.delete(e):this.mermaidCodeBlocksByWorkId.clear()}extendMarkdown(e,t){const r=e.md.renderer,a=r.rules.fence,i=this;r.rules.fence=(s,n,c,h,f)=>{const p=s[n];if(p.info.trim()==="mermaid"){const y=i.generateId();return i.createContainer(y,p.content,t)}return a?a(s,n,c,h,f):""}}static generateId(){return M.getInstance().generateId()}static createContainer(e,t,r){return M.getInstance().createContainer(e,t,r)}static getCode(e,t){return M.getInstance().getCode(e,t)}static clear(e){M.getInstance().clear(e)}static extendMarkdown(e,t){M.getInstance().extendMarkdown(e,t)}};g(M,"instance",null);let E=M;class I{static checkNodeHasMermaid(e){if(!e)return!1;if(e.content&&typeof e.content=="string"&&(e.content.includes('class="mermaid-container"')||e.content.includes("class='mermaid-container'")||e.content.includes("data-mermaid-id=")||e.content.includes("mermaid-placeholder")))return!0;if(e.children&&Array.isArray(e.children)){for(const t of e.children)if(I.checkNodeHasMermaid(t))return!0}return!1}static async renderMermaidAfterDOMUpdate(e,t){await I.renderMermaidBlocks(e,t)}static async renderMermaidBlocks(e,t){if(!e)return;try{await ne()}catch(n){console.error("[renderMermaidBlocks] error: ",n);return}const r=oe();if(!r)return;let a=null,i=!1;for(let n=0;n<30;n++){const c=e.querySelectorAll("foreignObject");if(a=e.querySelectorAll(".mermaid-container"),a.length>0||(c.length>0&&(i=!0),await new Promise(h=>setTimeout(h,50)),i&&n>=20))break}if(!a||a.length===0)return;const s=Array.from(a).map(async(n,c)=>{const h=n,f=h.getAttribute("data-mermaid-id"),p=f?E.getCode(f,t):void 0,m=h.querySelector(".mermaid-placeholder");if(!(!m||!p))try{const w=`mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}-${Date.now()}-${c}`,{svg:v}=await r.render(w,p);if(m&&m.parentNode){const T=document.createElement("div");T.innerHTML=v;const l=T.querySelector("svg");if(l){if(!l.getAttribute("viewBox")&&l.getAttribute("width")&&l.getAttribute("height")){const S=l.getAttribute("width"),k=l.getAttribute("height"),b=parseFloat((S==null?void 0:S.replace(/px|%/,""))||"0"),O=parseFloat((k==null?void 0:k.replace(/px|%/,""))||"0");b>0&&O>0&&l.setAttribute("viewBox",`0 0 ${b} ${O}`)}l.style.display="block",l.style.maxWidth="100%",l.style.width="auto",l.style.height="auto",l.style.overflow="visible",l.style.verticalAlign="top",l.style.objectFit="contain";const u=document.createElement("div");u.className="mermaid-wrapper",u.style.width="100%",u.style.height="auto",u.style.overflow="hidden",u.style.display="inline-block",u.style.verticalAlign="top",u.style.margin="0",u.style.padding="0",u.style.boxSizing="border-box",u.style.position="relative",this.isSafari()&&(u.style.clipPath="inset(100% 0 0 0)",u.style.pointerEvents="none"),u.appendChild(l),l.style.width="100%",l.style.height="100%",l.style.maxWidth="100%",l.style.maxHeight="100%",l.style.objectFit="contain",l.setAttribute("data-type","mermaid"),this.isSafari()&&(l.style.opacity="0"),m.parentNode.replaceChild(u,m)}else m.outerHTML=v}}catch(y){const w=y instanceof Error?y.message:String(y);m&&(m.textContent=`Mermaid 渲染失败: ${w}`,m.style.color="red",m.style.fontSize="12px")}});await Promise.all(s)}static isSafari(){const e=navigator.userAgent.toLowerCase(),t=e.indexOf("safari")!==-1&&e.indexOf("chrome")===-1&&e.indexOf("chromium")===-1,r=!!(navigator.vendor&&navigator.vendor.indexOf("Apple")!==-1);return t||r}static async transformMermaidSvgToMarkmapSvg(e){if(!e)return;await new Promise(s=>setTimeout(s,200));const t=e.querySelectorAll('g[data-mermaid-wrapper][data-mermaid-clone="true"]'),r=e.querySelectorAll("foreignObject"),a=new Set;if(r.forEach(s=>{const n=s.querySelector(".mermaid-container"),c=n==null?void 0:n.getAttribute("data-mermaid-id");c&&a.add(c)}),t.forEach(s=>{const n=s.getAttribute("data-mermaid-id");n&&!a.has(n)&&s.remove()}),r.length===0)return;const i=Array.from(r).map(async s=>{let n=s.querySelector('svg[data-type="mermaid"]');if(!n){const f=s.querySelector(".mermaid-wrapper");f&&(n=f.querySelector('svg[data-type="mermaid"]'))}if(!n)return;const c=s.querySelector(".mermaid-container"),h=c==null?void 0:c.getAttribute("data-mermaid-id");if(h)try{const f=parseFloat(s.getAttribute("x")||"0"),p=parseFloat(s.getAttribute("y")||"0"),m=parseFloat(s.getAttribute("width")||"0"),y=parseFloat(s.getAttribute("height")||"0");if(m<=0||y<=0)return;const w=s.parentElement;if(!w||w.tagName!=="g")return;let v=w.getAttribute("transform");if(!v)v=`translate(${f}, ${p})`;else{const k=v.match(/translate\(([^,]+),([^)]+)\)/);if(k){const b=parseFloat(k[1]),O=parseFloat(k[2]),P=b+f,K=O+p;v=v.replace(/translate\([^)]+\)/,`translate(${P}, ${K})`)}else v=`translate(${f}, ${p}) ${v}`}const T=e.querySelector(`g[data-mermaid-wrapper][data-mermaid-id="${h}"][data-mermaid-clone="true"]`);let l;if(T){l=T;const k=l.querySelector('svg[data-type="mermaid"]');k&&l.removeChild(k)}else l=document.createElementNS("http://www.w3.org/2000/svg","g"),l.setAttribute("data-mermaid-wrapper","true"),l.setAttribute("data-mermaid-clone","true"),l.setAttribute("data-mermaid-id",h);l.setAttribute("transform",v);const u=n.cloneNode(!0);if(u.setAttribute("width",m.toString()),u.setAttribute("height",y.toString()),u.setAttribute("data-mermaid-transformed","true"),u.style.width="",u.style.height="",u.style.maxWidth="",u.style.maxHeight="",u.style.transform="",u.style.transformOrigin="",u.style.display="block",u.style.overflow="visible",u.style.opacity="1",!u.getAttribute("viewBox")){const k=u.getAttribute("width"),b=u.getAttribute("height");if(k&&b){const O=parseFloat(k.replace(/px|%/,"")||"0"),P=parseFloat(b.replace(/px|%/,"")||"0");O>0&&P>0&&u.setAttribute("viewBox",`0 0 ${O} ${P}`)}}l.appendChild(u),T||(w&&w.parentNode?w.parentNode.insertBefore(l,w.nextSibling):e.appendChild(l)),c&&(c.style.opacity="0",c.style.pointerEvents="none")}catch(f){console.error("[transformMermaidSvgToMarkmapSvg] error: ",f)}});await Promise.all(i)}static injectMermaidHtml(e,t,r){const a=[],i=t.split(`
2
2
  `);let s="",n=!1,c=[],h=-1;for(let p=0;p<i.length;p++){const m=i[p],y=m.match(/^(#{1,6})\s+(.+)$/);if(y&&(s=y[2].trim()),m.trim().startsWith("```mermaid"))n=!0,c=[],h=p;else if(n&&m.trim()==="```"){n=!1;const w=c.join(`
3
3
  `);w&&s&&a.push({title:s,content:w,index:h}),c=[]}else n&&c.push(m)}const f=p=>{if(!p)return;const m=p.content||"",y=I.decodeHtmlEntities(m);for(const w of a)if(y.includes(w.title)||m.includes(w.title)){const v=E.generateId(),T=E.createContainer(v,w.content,r);p.content?p.content=p.content+T:p.content=T;break}p.children&&p.children.length>0&&p.children.forEach(w=>{f(w)})};return f(e),e}static decodeHtmlEntities(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value}static hasMermaidSvg(e){return e.querySelectorAll("svg[data-type='mermaid']").length>0}}class H extends Q.Transformer{constructor(t){super(t);g(this,"currentWorkId",null)}setWorkId(t){this.currentWorkId=t,t&&E.extendMarkdown(this,t)}transform(t,r){this.currentWorkId?E.clear(this.currentWorkId):E.clear();const a=this.convertKatexToText(t),i=super.transform(a,r);return i.root&&this.processKatexInRoot(i.root),i}convertKatexToText(t){if(!t)return t;let r=t.replace(/\$\$([\s\S]*?)\$\$/g,(a,i)=>i.replace(/\\/g,"").replace(/\{/g,"").replace(/\}/g,"").replace(/\\over/g,"/").replace(/\\pm/g,"±").replace(/\\sqrt/g,"√").replace(/\\frac/g,"/").trim());return r=r.replace(/\$([^$\n]+?)\$/g,(a,i)=>i.replace(/\\/g,"").replace(/\{/g,"").replace(/\}/g,"").replace(/\\over/g,"/").replace(/\\pm/g,"±").replace(/\\sqrt/g,"√").replace(/\\frac/g,"/").trim()),r}processKatexInRoot(t){if(t){if(t.content&&typeof t.content=="string"&&(t.content.includes("katex")||t.content.includes("katex-mathml"))){const r=t.content.match(/<annotation[^>]*encoding="application\/x-tex">([^<]+)<\/annotation>/);if(r){const a=r[1].replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/\\/g,"").replace(/\{/g,"").replace(/\}/g,"").replace(/\\over/g,"/").replace(/\\pm/g,"±").replace(/\\sqrt/g,"√").replace(/\\frac/g,"/").trim();t.content=t.content.replace(/<div[^>]*xmlns="http:\/\/www\.w3\.org\/1999\/xhtml"[^>]*>Katex:\s*<span[^>]*class="katex"[^>]*>[\s\S]*?<\/span><\/div>/g,a)}else{const a=document.createElement("div");a.innerHTML=t.content;const i=a.querySelector(".katex");if(i){let s=i.textContent||"";s=s.replace(/^Katex:\s*/i,"").trim(),t.content=t.content.replace(/<div[^>]*xmlns="http:\/\/www\.w3\.org\/1999\/xhtml"[^>]*>Katex:\s*<span[^>]*class="katex"[^>]*>[\s\S]*?<\/span><\/div>/g,s||"公式")}else{const s=t.content.replace(/<[^>]+>/g," ").replace(/\s+/g," ").replace(/^Katex:\s*/i,"").trim();t.content=s||"公式"}}}t.children&&Array.isArray(t.children)&&t.children.forEach(r=>{this.processKatexInRoot(r)})}}static async waitForImagesInForeignObjects(t,r=1e4){if(!t)return;const a=t.querySelectorAll("foreignObject.markmap-foreign img");if(a.length===0)return;const i=[],s=new Set;a.forEach(n=>{const c=n.src||n.getAttribute("src");if(!c||s.has(c)||(s.add(c),n.complete&&n.naturalWidth>0))return;const h=new Promise(f=>{const p=setTimeout(()=>{f()},r);if(n.complete&&n.naturalWidth>0){clearTimeout(p),f();return}const m=()=>{clearTimeout(p),n.removeEventListener("load",m),n.removeEventListener("error",y),f()},y=()=>{clearTimeout(p),n.removeEventListener("load",m),n.removeEventListener("error",y),f()};n.addEventListener("load",m),n.addEventListener("error",y),!n.src&&c&&(n.src=c)});i.push(h)}),i.length>0&&await Promise.all(i)}}const W=new H,{loadCSS:ce,loadJS:le,Markmap:he}=$,{scripts:B,styles:q}=W.getAssets();q&&ce(q);B&&le(B,{getMarkmap:()=>$});async function de(o){const e=o.querySelectorAll("img"),t=Array.from(e).map(i=>{if(!i.crossOrigin&&i.src&&!i.src.startsWith("data:")&&(i.crossOrigin="anonymous",i.complete)){const s=i.src;i.src="",i.src=s}return i.complete&&i.crossOrigin?Promise.resolve():new Promise(s=>{i.onload=()=>{s(void 0)},i.onerror=()=>{s(void 0)}})});return o.querySelectorAll("svg").forEach(i=>{i.querySelectorAll("image").forEach(n=>{n.href&&!n.href.baseVal.startsWith("data:")&&(n.getAttribute("crossorigin")||n.setAttribute("crossorigin","anonymous"),t.push(new Promise(c=>{const h=new Image;h.crossOrigin="anonymous",h.onload=()=>{c(void 0)},h.onerror=()=>{c(void 0)},h.src=n.href.baseVal})))})}),await Promise.all(t)}async function me(o){const r=Date.now();let a=!1;for(;Date.now()-r<5e3;){const i=o.querySelectorAll("path");if(i.length>0&&(a=Array.from(i).some(s=>{const n=s.getAttribute("d")||"";return n!=="M0,0C0,0,0,0,0,0"&&n.length>10}),a))break;await new Promise(s=>setTimeout(s,50))}}async function ue(o){const e=o.querySelectorAll("svg");if(!e.length)return;const t=[];for(let r=0;r<e.length;r++){const a=e[r];t.push(me(a))}await Promise.all(t)}async function V(o){if(I.hasMermaidSvg(o)){const r=Date.now();let a=!1;for(;Date.now()-r<5e3&&!a;){const i=o.querySelectorAll("foreignObject");if(i.length>0){let s=!0;for(const n of Array.from(i)){const c=parseFloat(n.getAttribute("width")||"0"),h=parseFloat(n.getAttribute("height")||"0");if(n.querySelector(".mermaid-container")&&(c<50||h<50)){s=!1;break}}if(s){a=!0;break}}else a=!0;await new Promise(s=>setTimeout(s,50))}}}async function pe(o,e={}){const{width:t=o.offsetWidth,height:r=o.offsetHeight}=e,a=o.offsetWidth||t,i=o.offsetHeight||r;try{const{loadSvgToImageLib:s,getSvgToImageLib:n}=await Promise.resolve().then(()=>require("./svgToImageLoader-B3gIDAQo.js"));let c=n();if(!c)try{c=await s()}catch(m){return console.error("[loadSvgToImageLib] error: ",m),null}const h=o.style.width,f=o.style.height,p=o.style.display;o.style.width||(o.style.width=`${a}px`),o.style.height||(o.style.height=`${i}px`),(!o.style.display||o.style.display==="none")&&(o.style.display="block");try{await new Promise(y=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{y()})})});const m=await c.toPng(o,{width:a,height:i,quality:1});return o.style.width=h,o.style.height=f,o.style.display=p,new Promise(y=>{const w=new Image;w.crossOrigin="anonymous",w.onload=()=>{y(w)},w.onerror=()=>{y(null)},w.src=m})}catch(m){return o.style.width=h,o.style.height=f,o.style.display=p,console.error("[divToImageElement] error: ",m),null}}catch(s){return console.error("[divToImageElement] error: ",s),null}}class ge{constructor(e){g(this,"toolsType",d.EToolsKey.BackgroundSVG);g(this,"vNodes");g(this,"workOptions");g(this,"workId");g(this,"markmapInstance",null);g(this,"isDestroyed",!1);g(this,"element");g(this,"manager");const{vNodes:t,workId:r,toolsOpt:a,manager:i}=e;this.workId=r,this.vNodes=t,this.workOptions=a,this.manager=i,this.element=this.createElement(),this.manager.fullLayer.appendChild(this.element),this.vNodes.setInfo(this.workId,{workShape:this})}get fullLayer(){return this.manager.fullLayer}get collector(){return this.manager.master.control.collector}get scenePath(){return this.manager.master.control.viewContainerManager.getCurScenePath(this.manager.viewId)}async init(){await this.render()}createElement(){const{type:e}=this.workOptions;let t;return e===d.ESVGType.markmap?(t=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.classList.add("svg")):(t=document.createElement("img"),t.classList.add("img")),t.id=this.workId,t.setAttribute("data-id",this.workId),t}async render(e){this.isDestroyed||!this.element||!this.element.parentNode||(this.updateElementPosition(e),await this.updateSvg(e))}isSameSize(e){const{width:t,height:r}=e,{width:a,height:i}=this.workOptions,s=t*this.manager.camera.scale,n=r*this.manager.camera.scale,c=a*this.manager.camera.scale,h=i*this.manager.camera.scale;return s===c&&n===h}isSamePosition(e){const{centerX:t,centerY:r}=e,{centerX:a,centerY:i}=this.workOptions,s=this.manager.getPagePoint(a,i),n=this.manager.getPagePoint(t,r);return x.isEqual(n,s)}isSameZIndex(e){const{zIndex:t}=e,{zIndex:r}=this.workOptions;return t===r}isSameState(e){const{state:t}=e,{state:r}=this.workOptions;return x.isEqual(t,r)}isSameData(e){const{data:t}=e,{data:r}=this.workOptions;return x.isEqual(t,r)}updateElementPosition(e){if(this.isDestroyed||!this.element||!this.fullLayer)return;const{centerX:t,centerY:r,width:a,height:i,zIndex:s}=this.workOptions,n=this.manager.getPagePoint(t,r),c=a*this.manager.camera.scale,h=i*this.manager.camera.scale;(!e||e&&!this.isSameSize(e))&&(this.element.setAttribute("width",`${c}`),this.element.setAttribute("height",`${h}`),this.element.style.width=`${c}px`,this.element.style.height=`${h}px`),(!e||e&&!this.isSamePosition(e))&&(this.element.style.left=`${n.x}px`,this.element.style.top=`${n.y}px`),(!e||e&&!this.isSameZIndex(e))&&(this.element.style.zIndex=(s||0).toString())}async updateSvg(e){const{type:t,state:r}=this.workOptions;if(t===d.ESVGType.markmap){const{data:a}=this.workOptions;if(this.markmapInstance||(this.markmapInstance=he.create(this.element,this.manager.markmapOptions),this.markmapInstance.handleClick=async(n,c)=>{var p,m,y;(p=this.markmapInstance)==null||p.toggleNode(c);const h=this.serializeData((m=this.markmapInstance)==null?void 0:m.state.data);this.setWorkOptions({...this.workOptions,state:h},!1),I.checkNodeHasMermaid(c)&&await I.renderMermaidAfterDOMUpdate(this.element,this.workId),this.scenePath&&this.collector&&((y=this.collector)==null||y.dispatch({type:d.EPostMessageType.UpdateNode,workId:this.workId,opt:this.workOptions,isSync:!0,viewId:this.manager.viewId,scenePath:this.scenePath}))}),e&&this.isSameState(e)&&this.isSameSize(e)&&this.isSameData(e))return;W.setWorkId(this.workId);const i=W.transform(a);let{root:s}=i;a&&F(a)&&(s=I.injectMermaidHtml(s,a,this.workId));try{r&&Array.isArray(r)&&this.transformState(r,s),await this.markmapInstance.setData(s),!this.isDestroyed&&this.element&&this.fullLayer&&this.markmapInstance&&(window.markmapInstance=this.markmapInstance,a&&F(a)&&await I.renderMermaidAfterDOMUpdate(this.element,this.workId),await this.fit(!e||e&&!this.isSameData(e)))}catch(n){console.error("[updateSvg] error: ",n)}}else{const{src:a,crossOrigin:i}=this.workOptions;this.element.src=a,this.element.crossOrigin=x.isString(i)?i:"anonymous";try{await new Promise((s,n)=>{this.element.onload=()=>{s()},this.element.onerror=function(){n()}})}catch(s){console.error("[updateSvg] error: ",s)}}}async fit(e=!0){var t;!this.isDestroyed&&this.element&&this.fullLayer&&this.markmapInstance&&(e&&this.element&&await H.waitForImagesInForeignObjects(this.element),await((t=this.markmapInstance)==null?void 0:t.fit()),this.element&&I.isSafari()&&I.hasMermaidSvg(this.element)&&(await V(this.element),await I.transformMermaidSvgToMarkmapSvg(this.element)))}serializeData(e){var a;const t=[e],r=[];for(;t.length>0;){const i=t.pop();i&&(i!=null&&i.children&&t.push(...i.children),r.push(((a=i==null?void 0:i.payload)==null?void 0:a.fold)||0))}return r}transformState(e,t){const r=[t];for(;r.length>0;){const a=r.pop();a&&(a!=null&&a.children&&r.push(...a.children),a.payload?a.payload.fold=e.shift():e.shift())}}async updateCamera(){this.updateElementPosition(),await this.fit(!1)}async setWorkOptions(e,t=!0){if(!x.isEqual(this.workOptions,e)){const r=x.clone(this.workOptions);this.workOptions=e,t&&await this.render(r)}}destroy(){this.isDestroyed=!0,this.element.remove()}getRectFromLayer(){const e=this.element.getBoundingClientRect();return{x:e.x,y:e.y,w:e.width,h:e.height}}}function D(o){const{toolsType:e,...t}=o;switch(e){case d.EToolsKey.BackgroundSVG:return new ge(t);default:return}}class z{constructor(e){g(this,"viewId");g(this,"fullLayer");g(this,"curNodeMap");this.viewId=e,this.curNodeMap=new ee.ObserverMap}init(e){this.fullLayer=e}get(e){return this.curNodeMap.get(e)}setInfo(e,t){const r=this.curNodeMap.get(e)||{name:e,workShape:t.workShape};t.workShape&&(r.workShape=t.workShape),this.curNodeMap.set(e,r)}getNodeRectFormShape(e){const t=this.curNodeMap.get(e);if(t&&t.workShape)return t.workShape.getRectFromLayer()}delete(e){const t=this.curNodeMap.get(e);t&&t.workShape.destroy(),this.curNodeMap.delete(e)}clear(){for(const e of this.curNodeMap.values())e.workShape.destroy();this.curNodeMap.clear()}}class fe{constructor(e,t){g(this,"opt");g(this,"viewId");g(this,"fullLayer");g(this,"vNodes");g(this,"master");g(this,"cameraOpt");g(this,"methodBuilder");g(this,"updateCamera",x.throttle(async e=>{const{cameraOpt:t}=e;t&&!x.isEqual(this.cameraOpt,t)&&await this.setCameraOpt(t)},100));this.viewId=e,this.opt=t,this.master=t.master,this.fullLayer=t.container,this.methodBuilder=new se([d.EmitEventType.CopyNode]).registerForBackgroundThread(this),this.vNodes=new z(e),this.vNodes.init(this.fullLayer)}get camera(){return this.cameraOpt||{scale:1,centerX:0,centerY:0,width:0,height:0}}get view(){var e;return(e=this.master.control.viewContainerManager.getView(this.viewId))==null?void 0:e.viewData}get markmapOptions(){return this.master.control.pluginOptions.extras.markmap.options}getPagePoint(e,t){const{scale:r,centerX:a,centerY:i,width:s,height:n}=this.camera;return{x:(e-a)*r+s/2,y:(t-i)*r+n/2}}async setCameraOpt(e){this.cameraOpt=e;for(const t of this.vNodes.curNodeMap.values()){const{workShape:r}=t;r&&await r.updateCamera()}}clearAll(){this.vNodes.clear()}canUseFullLayer(e){return e===d.EToolsKey.BackgroundSVG}async consumeFull(e){const{toolsType:t,opt:r,workId:a}=e;if(a!=null&&a.toString()&&t&&this.canUseFullLayer(t))switch(t){case d.EToolsKey.BackgroundSVG:await this.setFullWork({toolsType:t,opt:r,workId:a});break}}async setFullWork(e){const{workId:t,opt:r,toolsType:a}=e;if(t&&r&&a){const i=t.toString();let s;const n=this.vNodes.get(i);return!n||!n.workShape?(s=this.createWorkShapeNode({toolsOpt:r,toolsType:d.EToolsKey.BackgroundSVG,workId:i}),s&&await s.init()):(s=n.workShape,await s.setWorkOptions(r)),s}}createWorkShapeNode(e){return D({...e,vNodes:this.vNodes,manager:this})}removeWork(e){const{workId:t}=e,r=t==null?void 0:t.toString();r&&this.removeNode(r)}removeNode(e){this.vNodes.delete(e)}async on(e){if(!await this.methodBuilder.consumeForBackgroundThread(e)){const{msgType:t,toolsType:r}=e;switch(t){case d.EPostMessageType.Destroy:{this.destroy();break}case d.EPostMessageType.Clear:{this.clearAll();break}case d.EPostMessageType.UpdateCamera:{this.updateCamera(e);break}case d.EPostMessageType.UpdateTools:{this.toggleFullLayer(r===d.EToolsKey.Clicker);break}case d.EPostMessageType.BackgroundSVGUpdate:case d.EPostMessageType.UpdateNode:case d.EPostMessageType.FullWork:{r&&this.canUseFullLayer(r)&&await this.consumeFull(e);break}case d.EPostMessageType.BackgroundSVGDelete:{this.removeWork(e);break}}}}toggleFullLayer(e){this.fullLayer.classList.toggle("appliance-plugin-background-svg-active",e)}destroy(){this.vNodes.clear()}}class ye{constructor(e,t){g(this,"viewId");g(this,"fullLayer");g(this,"master");g(this,"vNodes");g(this,"cameraOpt");g(this,"opt");g(this,"workShapes",new Map);this.viewId=e,this.opt=t,this.master=t.master,this.fullLayer=t.container,this.vNodes=new z(e),this.vNodes.init(this.fullLayer)}get camera(){return this.cameraOpt||{scale:1,centerX:0,centerY:0,width:0,height:0}}get view(){var e;return(e=this.master.control.viewContainerManager.getView(this.viewId))==null?void 0:e.viewData}get markmapOptions(){return this.master.control.pluginOptions.extras.markmap.options}createOffscreenCanvas(e){const{width:t,height:r}=e.canvasOpt,a=new OffscreenCanvas(e.canvasOpt.width,e.canvasOpt.height);a.width=t,a.height=r}async setCameraOpt(e){this.cameraOpt=e;for(const t of this.vNodes.curNodeMap.values()){const{workShape:r}=t;r&&await r.updateCamera()}}getPagePoint(e,t){const{scale:r,centerX:a,centerY:i,width:s,height:n}=this.camera;return{x:(e-a)*r+s/2,y:(t-i)*r+n/2}}async getSnapshot(e){const{scenePath:t,scenes:r,cameraOpt:a}=e;if(t&&r&&a){await this.setCameraOpt(a);for(const[i,s]of Object.entries(r))if(s!=null&&s.type&&(s==null?void 0:s.toolsType)===d.EToolsKey.BackgroundSVG)switch(s==null?void 0:s.type){case d.EPostMessageType.UpdateNode:case d.EPostMessageType.FullWork:{const{opt:n}=s,c={...s,opt:n,workId:i,msgType:d.EPostMessageType.FullWork,dataType:d.EDataType.Service,viewId:this.viewId};await this.runFullWork(c);break}}try{if(t){await V(this.fullLayer),await de(this.fullLayer),await ue(this.fullLayer);const i=await pe(this.fullLayer);i&&this.opt.post({sp:[{type:d.EPostMessageType.Snapshot,scenePath:t,imageElement:i,viewId:this.viewId,index:1}]})}}catch(i){const s=i&&i instanceof Error?i.message:i==null?void 0:i.toString();this.opt.post({sp:[{type:d.EPostMessageType.ReportError,reportString:`[SnapshotThreadImpl] getSnapshotRender error: ${s}`}]})}}}createWorkShapeNode(e){return D({...e,vNodes:this.vNodes,manager:this})}async setFullWork(e){const{workId:t,opt:r,toolsType:a}=e;if(t&&r&&a){const i=t.toString();let s;const n=this.vNodes.get(i);return!n||!n.workShape?(s=this.createWorkShapeNode({toolsOpt:r,toolsType:d.EToolsKey.BackgroundSVG,workId:i}),s&&await s.init()):(s=n.workShape,await s.setWorkOptions(r)),s}}async runFullWork(e){const{toolsType:t,opt:r,workId:a}=e;await this.setFullWork({toolsType:t,opt:r,workId:a})}destroy(){this.fullLayer.innerHTML="",this.fullLayer.style.width="",this.fullLayer.style.height=""}}class we{constructor(e){g(this,"backgroundThreadMap",new Map);g(this,"snapshotThread");g(this,"master");g(this,"post",e=>{const{sp:t}=e;t&&this.master.collectorSyncData(t)});this.master=e,this.backgroundThreadMap=new Map}createBackgroundThread(e,t){return new fe(e,t)}createSnapshotThread(e,t){return new ye(e,t)}async consume(e){var t,r,a,i,s,n;for(const c of e.values()){const{msgType:h,viewId:f,layerOpt:p,offscreenCanvasOpt:m,cameraOpt:y,tasksqueue:w,mainTasksqueueCount:v}=c;if(h===d.EPostMessageType.Console){console.log(this);continue}if(h===d.EPostMessageType.Init){const l=(t=this.master.control.viewContainerManager.getView(f))==null?void 0:t.displayer,u=(r=l==null?void 0:l.backgroundContainerRef)==null?void 0:r.current;if(l&&u&&p&&m){const S=this.backgroundThreadMap.get(f);S==null||S.destroy();const k=this.createBackgroundThread(f,{displayer:l,container:u,layerOpt:p,master:this.master,canvasOpt:m,post:this.post});this.backgroundThreadMap.set(f,k),k&&y&&await k.setCameraOpt(y)}continue}if(h===d.EPostMessageType.Snapshot){const l=(a=this.master.control.viewContainerManager.getView(f))==null?void 0:a.displayer,S=(s=((i=this.master.control.viewContainerManager.mainView)==null?void 0:i.displayer).backgroundSnapshotContainerRef)==null?void 0:s.current;if(l&&S&&y){(n=this.snapshotThread)==null||n.destroy(),S.style.width=`${y.width}px`,S.style.height=`${y.height}px`;const k={...d.ViewContainerManager.defaultLayerOpt,offscreen:!1,width:y.width,height:y.height},b={...d.ViewContainerManager.defaultScreenCanvasOpt,width:y.width,height:y.height};this.snapshotThread=this.createSnapshotThread(f,{displayer:l,container:S,layerOpt:k,master:this.master,canvasOpt:b,post:this.post}),await this.snapshotThread.getSnapshot(c),this.snapshotThread.destroy(),this.snapshotThread=void 0;continue}}if(h===d.EPostMessageType.TasksQueue&&(w!=null&&w.size)){for(const[l,u]of this.backgroundThreadMap.entries()){const S=w.get(l);S&&(await u.on(S),v&&this.post({workerTasksqueueCount:v}))}continue}if(f===d.Storage_ViewId_ALL){for(const l of this.backgroundThreadMap.values())await l.on(c);h===d.EPostMessageType.Destroy&&this.backgroundThreadMap.clear();continue}const T=this.backgroundThreadMap.get(f);T&&(await T.on(c),h===d.EPostMessageType.Destroy&&this.backgroundThreadMap.delete(f))}}async consumeTargetOne(e,t){const r=this.backgroundThreadMap.get(e);r&&await r.on(t)}destroy(){var e;(e=this.snapshotThread)==null||e.destroy(),this.snapshotThread=void 0;for(const t of this.backgroundThreadMap.values())t.destroy();this.backgroundThreadMap.clear()}}exports.BackgroundThreadManagerImpl=we;