lakelib 0.2.0 → 0.2.1
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/lake.min.js +2 -2
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.js +5 -4
- package/lib/lake.js.map +1 -1
- package/package.json +5 -4
package/dist/lake.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Lake=function(e){"use strict";class t extends HTMLElement{}void 0!==customElements.get("lake-box")&&customElements.define("lake-box",t);class i extends HTMLElement{}void 0!==customElements.get("lake-bookmark")&&customElements.define("lake-bookmark",i);const n=new Map([["plus",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm48-88a8,8,0,0,1-8,8H136v32a8,8,0,0,1-16,0V136H88a8,8,0,0,1,0-16h32V88a8,8,0,0,1,16,0v32h32A8,8,0,0,1,176,128Z"></path></svg>'],["question",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>'],["more",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["left",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"></path></svg>'],["right",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path></svg>'],["down",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"></path></svg>'],["check",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"></path></svg>'],["checkCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>'],["warningCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"></path></svg>'],["file",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"></path></svg>'],["open",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6.25 4.5A1.75 1.75 0 0 0 4.5 6.25v11.5c0 .966.783 1.75 1.75 1.75h11.5a1.75 1.75 0 0 0 1.75-1.75v-4a.75.75 0 0 1 1.5 0v4A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25A3.25 3.25 0 0 1 6.25 3h4a.75.75 0 0 1 0 1.5h-4ZM13 3.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 .75.75v6.5a.75.75 0 0 1-1.5 0V5.56l-5.22 5.22a.75.75 0 0 1-1.06-1.06l5.22-5.22h-4.69a.75.75 0 0 1-.75-.75Z" fill="#000000"/></svg>'],["download",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"></path></svg>'],["copy",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"></path></svg>'],["remove",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"></path></svg>'],["maximize",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,80v32a8,8,0,0,1-16,0V88H160a8,8,0,0,1,0-16h32A8,8,0,0,1,200,80ZM96,168H72V144a8,8,0,0,0-16,0v32a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16ZM232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"></path></svg>'],["close",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path></svg>'],["zoomIn",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["zoomOut",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["circleNotch",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"></path></svg>'],["selectAll",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M104,40a8,8,0,0,1,8-8h32a8,8,0,0,1,0,16H112A8,8,0,0,1,104,40Zm40,168H112a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM208,32H184a8,8,0,0,0,0,16h24V72a8,8,0,0,0,16,0V48A16,16,0,0,0,208,32Zm8,72a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V112A8,8,0,0,0,216,104Zm0,72a8,8,0,0,0-8,8v24H184a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V184A8,8,0,0,0,216,176ZM40,152a8,8,0,0,0,8-8V112a8,8,0,0,0-16,0v32A8,8,0,0,0,40,152Zm32,56H48V184a8,8,0,0,0-16,0v24a16,16,0,0,0,16,16H72a8,8,0,0,0,0-16ZM40,80a8,8,0,0,0,8-8V48H72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,48V72A8,8,0,0,0,40,80ZM176,184H80a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8h96a8,8,0,0,1,8,8v96A8,8,0,0,1,176,184Zm-8-96H88v80h80Z"></path></svg>'],["undo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,144a64.07,64.07,0,0,1-64,64H80a8,8,0,0,1,0-16h88a48,48,0,0,0,0-96H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48A8,8,0,0,1,85.66,45.66L51.31,80H168A64.07,64.07,0,0,1,232,144Z"></path></svg>'],["redo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.34,130.34,204.69,96H88a48,48,0,0,0,0,96h88a8,8,0,0,1,0,16H88A64,64,0,0,1,88,80H204.69L170.34,45.66a8,8,0,0,1,11.32-11.32l48,48a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32-11.32Z"></path></svg>'],["heading",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,56V200a8,8,0,0,1-16,0V136H64v64a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v64H192V56a8,8,0,0,1,16,0Z"></path></svg>'],["heading1",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm75.77,49a8,8,0,0,0-8.21.39l-24,16a8,8,0,1,0,8.88,13.32L216,127V208a8,8,0,0,0,16,0V112A8,8,0,0,0,227.77,105Z"></path></svg>'],["heading2",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm88,144H208l33.55-44.74a32,32,0,1,0-55.73-29.93,8,8,0,1,0,15.08,5.34,16.28,16.28,0,0,1,2.32-4.3,16,16,0,1,1,25.54,19.27L185.6,203.2A8,8,0,0,0,192,216h48a8,8,0,0,0,0-16Z"></path></svg>'],["heading3",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm73.52,90.63,21-30A8,8,0,0,0,240,104H192a8,8,0,0,0,0,16h32.63l-19.18,27.41A8,8,0,0,0,212,160a20,20,0,1,1-14.29,34,8,8,0,1,0-11.42,11.19A36,36,0,0,0,248,180,36.07,36.07,0,0,0,225.52,146.63Z"></path></svg>'],["heading4",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,112h-8V144a8,8,0,0,0-16,0v24H195.1l20.49-61.47a8,8,0,0,0-15.18-5.06l-24,72A8,8,0,0,0,184,184h40v24a8,8,0,0,0,16,0V184h8a8,8,0,0,0,0-16Z"></path></svg>'],["heading5",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm60,88a38.8,38.8,0,0,0-9.41,1.14L206.78,120H240a8,8,0,0,0,0-16H200a8,8,0,0,0-7.89,6.68l-8,48a8,8,0,0,0,13.6,6.92A19.73,19.73,0,0,1,212,160a20,20,0,0,1,0,40,19.73,19.73,0,0,1-14.29-5.6,8,8,0,1,0-11.42,11.2A35.54,35.54,0,0,0,212,216a36,36,0,0,0,0-72Z"></path></svg>'],["heading6",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,124a36,36,0,1,1-67.34-17.68c.07-.14.14-.28.22-.42l32.25-54a8,8,0,0,1,13.74,8.2l-16.69,28c.6,0,1.21-.05,1.82-.05A36,36,0,0,1,248,180Zm-16,0a20,20,0,1,0-20,20A20,20,0,0,0,232,180Z"></path></svg>'],["paragraph",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,40H96a64,64,0,0,0,0,128h40v40a8,8,0,0,0,16,0V56h24V208a8,8,0,0,0,16,0V56h16a8,8,0,0,0,0-16ZM136,152H96a48,48,0,0,1,0-96h40Z"></path></svg>'],["blockQuote",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M100,56H40A16,16,0,0,0,24,72v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,100,56Zm0,80H40V72h60ZM216,56H156a16,16,0,0,0-16,16v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,216,56Zm0,80H156V72h60Z"></path></svg>'],["list",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M88,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Zm128,56H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM56,56H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Z"></path></svg>'],["numberedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM104,72H216a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16ZM216,184H104a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM43.58,55.16,48,52.94V104a8,8,0,0,0,16,0V40a8,8,0,0,0-11.58-7.16l-16,8a8,8,0,0,0,7.16,14.32ZM79.77,156.72a23.73,23.73,0,0,0-9.6-15.95,24.86,24.86,0,0,0-34.11,4.7,23.63,23.63,0,0,0-3.57,6.46,8,8,0,1,0,15,5.47,7.84,7.84,0,0,1,1.18-2.13,8.76,8.76,0,0,1,12-1.59A7.91,7.91,0,0,1,63.93,159a7.64,7.64,0,0,1-1.57,5.78,1,1,0,0,0-.08.11L33.59,203.21A8,8,0,0,0,40,216H72a8,8,0,0,0,0-16H56l19.08-25.53A23.47,23.47,0,0,0,79.77,156.72Z"></path></svg>'],["bulletedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z"></path></svg>'],["checklist",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H128a8,8,0,0,1,0-16h88A8,8,0,0,1,224,128ZM128,72h88a8,8,0,0,0,0-16H128a8,8,0,0,0,0,16Zm88,112H128a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16ZM82.34,42.34,56,68.69,45.66,58.34A8,8,0,0,0,34.34,69.66l16,16a8,8,0,0,0,11.32,0l32-32A8,8,0,0,0,82.34,42.34Zm0,64L56,132.69,45.66,122.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Zm0,64L56,196.69,45.66,186.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Z"></path></svg>'],["alignLeft",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,48H168a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm176,24H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-48,40H40a8,8,0,0,0,0,16H168a8,8,0,0,0,0-16Z"></path></svg>'],["alignCenter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM64,96a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Zm152,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-24,40H64a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Z"></path></svg>'],["alignRight",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["alignJustify",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["increaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM34.34,141.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0,0-11.32l-40-40A8,8,0,0,0,34.34,61.66L68.69,96,34.34,130.34A8,8,0,0,0,34.34,141.66Z"></path></svg>'],["decreaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM72,144a8,8,0,0,0,5.66-13.66L43.31,96,77.66,61.66A8,8,0,0,0,66.34,50.34l-40,40a8,8,0,0,0,0,11.32l40,40A8,8,0,0,0,72,144Z"></path></svg>'],["formatPainter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,88H216V64a16,16,0,0,0-16-16H48A16,16,0,0,0,32,64V88H16a8,8,0,0,0,0,16H32v24a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V104h16v50L131.6,182.65A16.07,16.07,0,0,0,120,198v34a8,8,0,0,0,16,0V198l100.4-28.68A16.07,16.07,0,0,0,248,154V104A16,16,0,0,0,232,88Zm-32,40H48V64H200v64Z"></path></svg>'],["bold",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.48,115.7A44,44,0,0,0,140,40H72a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8h80a48,48,0,0,0,18.48-92.3ZM80,56h60a28,28,0,0,1,0,56H80Zm72,136H80V128h72a32,32,0,0,1,0,64Z"></path></svg>'],["italic",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,56a8,8,0,0,1-8,8H157.77L115.1,192H144a8,8,0,0,1,0,16H64a8,8,0,0,1,0-16H98.23L140.9,64H112a8,8,0,0,1,0-16h80A8,8,0,0,1,200,56Z"></path></svg>'],["underline",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,224a8,8,0,0,1-8,8H64a8,8,0,0,1,0-16H192A8,8,0,0,1,200,224Zm-72-24a64.07,64.07,0,0,0,64-64V56a8,8,0,0,0-16,0v80a48,48,0,0,1-96,0V56a8,8,0,0,0-16,0v80A64.07,64.07,0,0,0,128,200Z"></path></svg>'],["strikethrough",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"></path></svg>'],["superscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.736 3.5c-.543 0-.986.495-.986 1.023a.75.75 0 0 1-1.5 0C16.25 3.278 17.258 2 18.736 2c.855 0 1.684.4 2.15 1.117.49.751.5 1.724-.057 2.672-.285.484-.673.847-1.045 1.141-.187.148-.379.284-.557.41l-.078.056a17.45 17.45 0 0 0-.432.311c-.356.268-.619.511-.78.793h2.514a.75.75 0 0 1 0 1.5H17a.75.75 0 0 1-.75-.75c0-1.396.821-2.182 1.565-2.741.157-.119.32-.234.472-.341l.074-.052c.177-.126.34-.243.493-.363.306-.242.532-.47.682-.724.31-.53.229-.886.093-1.094-.158-.244-.486-.435-.893-.435Z" fill="#000000"/><path d="M15.26 4.71c.06.562.385 1.043.847 1.318L10.987 12l5.583 6.512a.75.75 0 1 1-1.14.976L10 13.152l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 1 1 1.139-.976L10 10.848l5.26-6.137Z" fill="#000000"/></svg>'],["subscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16.488 4.43a.75.75 0 0 1 .082 1.058L10.988 12l5.032 5.871c-.302.41-.555.906-.682 1.51L10 13.151l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 0 1 1.139-.976L10 10.848l5.43-6.336a.75.75 0 0 1 1.058-.081ZM17.75 15.523c0-.528.444-1.023.986-1.023.407 0 .735.19.893.434.136.21.218.566-.093 1.095-.15.255-.376.482-.682.724-.152.12-.316.237-.493.363l-.074.052c-.152.107-.315.222-.472.34-.744.56-1.565 1.346-1.565 2.742 0 .414.336.75.75.75h3.451a.75.75 0 0 0 0-1.5h-2.513c.16-.282.423-.525.779-.793.137-.103.279-.203.432-.312l.078-.054c.178-.127.37-.264.557-.41.372-.295.76-.658 1.045-1.142.557-.948.546-1.921.058-2.672C20.42 13.4 19.59 13 18.736 13c-1.478 0-2.486 1.278-2.486 2.523a.75.75 0 0 0 1.5 0Z" fill="#000000"/></svg>'],["code",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M93.31,70,28,128l65.27,58a8,8,0,1,1-10.62,12l-72-64a8,8,0,0,1,0-12l72-64A8,8,0,1,1,93.31,70Zm152,52-72-64a8,8,0,0,0-10.62,12L228,128l-65.27,58a8,8,0,1,0,10.62,12l72-64a8,8,0,0,0,0-12Z"></path></svg>'],["removeFormat",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M225,80.4,183.6,39a24,24,0,0,0-33.94,0L31,157.66a24,24,0,0,0,0,33.94l30.06,30.06A8,8,0,0,0,66.74,224H216a8,8,0,0,0,0-16h-84.7L225,114.34A24,24,0,0,0,225,80.4ZM108.68,208H70.05L42.33,180.28a8,8,0,0,1,0-11.31L96,115.31,148.69,168Zm105-105L160,156.69,107.31,104,161,50.34a8,8,0,0,1,11.32,0l41.38,41.38a8,8,0,0,1,0,11.31Z"></path></svg>'],["moreStyle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["fontColor",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><polyline points="192 168 128 32 64 168" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="173.18" y1="128" x2="82.82" y2="128" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["fontColorAccent",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="40" y1="216" x2="216" y2="216" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["highlight",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.38 14.003A2.5 2.5 0 0 0 2 16.5v3A2.5 2.5 0 0 0 4.5 22h15a2.5 2.5 0 0 0 2.5-2.5v-3a2.5 2.5 0 0 0-2.5-2.5h-5.954l-1.316 1.314a3.237 3.237 0 0 1-.203.186H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869 2 2 0 0 1 .092-.744l.285-.884Z" fill="#000000"/><path d="M18.648 2.944a3.218 3.218 0 0 1-.002 4.551l-7.123 7.111a2.25 2.25 0 0 1-.942.563l-4.294 1.289a1 1 0 0 1-1.239-1.265l1.362-4.228c.11-.34.298-.65.552-.902l7.132-7.122a3.22 3.22 0 0 1 4.554.003Zm-3.494 1.059-7.133 7.121a.75.75 0 0 0-.184.301l-1.07 3.322 3.382-1.015a.75.75 0 0 0 .315-.187l7.121-7.11a1.718 1.718 0 1 0-2.43-2.432Z" fill="#000000"/></svg>'],["highlightAccent",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.004 15.631a2 2 0 0 0 2.571 1.784l4.293-1.288a3.25 3.25 0 0 0 1.159-.627H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869Z" fill="#000000"/></svg>'],["link",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"></path></svg>'],["unlink",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M190.63,65.37a32,32,0,0,0-45.19-.06L133.79,77.52a8,8,0,0,1-11.58-11l11.72-12.29a1.59,1.59,0,0,1,.13-.13,48,48,0,0,1,67.88,67.88,1.59,1.59,0,0,1-.13.13l-12.29,11.72a8,8,0,0,1-11-11.58l12.21-11.65A32,32,0,0,0,190.63,65.37ZM122.21,178.48l-11.65,12.21a32,32,0,0,1-45.25-45.25l12.21-11.65a8,8,0,0,0-11-11.58L54.19,133.93a1.59,1.59,0,0,0-.13.13,48,48,0,0,0,67.88,67.88,1.59,1.59,0,0,0,.13-.13l11.72-12.29a8,8,0,1,0-11.58-11ZM208,152H184a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16ZM48,104H72a8,8,0,0,0,0-16H48a8,8,0,0,0,0,16Zm112,72a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V184A8,8,0,0,0,160,176ZM96,80a8,8,0,0,0,8-8V48a8,8,0,0,0-16,0V72A8,8,0,0,0,96,80Z"></path></svg>'],["hr",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"></path></svg>'],["codeBlock",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"></path></svg>'],["image",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"></path></svg>'],["video",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M164.44,121.34l-48-32A8,8,0,0,0,104,96v64a8,8,0,0,0,12.44,6.66l48-32a8,8,0,0,0,0-13.32ZM120,145.05V111l25.58,17ZM234.33,69.52a24,24,0,0,0-14.49-16.4C185.56,39.88,131,40,128,40s-57.56-.12-91.84,13.12a24,24,0,0,0-14.49,16.4C19.08,79.5,16,97.74,16,128s3.08,48.5,5.67,58.48a24,24,0,0,0,14.49,16.41C69,215.56,120.4,216,127.34,216h1.32c6.94,0,58.37-.44,91.18-13.11a24,24,0,0,0,14.49-16.41c2.59-10,5.67-28.22,5.67-58.48S236.92,79.5,234.33,69.52Zm-15.49,113a8,8,0,0,1-4.77,5.49c-31.65,12.22-85.48,12-86,12H128c-.54,0-54.33.2-86-12a8,8,0,0,1-4.77-5.49C34.8,173.39,32,156.57,32,128s2.8-45.39,5.16-54.47A8,8,0,0,1,41.93,68c30.52-11.79,81.66-12,85.85-12h.27c.54,0,54.38-.18,86,12a8,8,0,0,1,4.77,5.49C221.2,82.61,224,99.43,224,128S221.2,173.39,218.84,182.47Z"></path></svg>'],["attachment",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"></path></svg>'],["emoji",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216ZM80,108a12,12,0,1,1,12,12A12,12,0,0,1,80,108Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,176,108Zm-1.07,48c-10.29,17.79-27.4,28-46.93,28s-36.63-10.2-46.92-28a8,8,0,1,1,13.84-8c7.47,12.91,19.21,20,33.08,20s25.61-7.1,33.07-20a8,8,0,0,1,13.86,8Z"></path></svg>'],["specialCharacter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 32 32"><path d="M22.7373,25A14.3093,14.3093,0,0,0,27,15C27,8.42,22.58,4,16,4S5,8.42,5,15A14.3093,14.3093,0,0,0,9.2627,25H4v2h8V24.7617A12.5683,12.5683,0,0,1,7,15c0-5.4673,3.5327-9,9-9s9,3.5327,9,9a12.5683,12.5683,0,0,1-5,9.7617V27h8V25Z"/></svg>'],["equation",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M184,72V56H80.65l53.6,67a8,8,0,0,1,0,10l-53.6,67H184V184a8,8,0,0,1,16,0v24a8,8,0,0,1-8,8H64a8,8,0,0,1-6.25-13l60-75-60-75A8,8,0,0,1,64,40H192a8,8,0,0,1,8,8V72a8,8,0,0,1-16,0Z"></path></svg>'],["table",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z"></path></svg>']]);function s(e,...t){let i=e[0];for(let n=0;n<t.length;n++){i+=String(t[n]),i+=e[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}const o=new Map([["&","&"],["<","<"],[">",">"],['"',"""],[" "," "]]);function r(e){return e.replace(/[&<>"\xA0]/g,(e=>{var t;return null!==(t=o.get(e))&&void 0!==t?t:""}))}function a(e,...t){let i=e[0];for(let n=0;n<t.length;n++){i+=r(String(t[n])),i+=e[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}function l(e){const t=e.split("-");let i="";for(let e=0;e<t.length;e++){const n=t[e];i+=e>0?n.charAt(0).toUpperCase()+n.substring(1):n}return i}function c(e,t,i){return void 0===i&&(i=","),(i+e+i).indexOf(i+t+i)>=0}function d(e){const t=(new TextEncoder).encode(e);let i="";return t.forEach((e=>{i+=String.fromCharCode(e)})),window.btoa(i)}function h(e){const t=window.atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return(new TextDecoder).decode(i)}function p(e){const t=Number.parseInt(e,10).toString(16).toLowerCase();return t.length>1?t:`0${t}`}function u(e){return e.replace(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)/gi,((e,t,i,n,s)=>void 0===s?`#${p(t)}${p(i)}${p(n)}`:`#${p(t)}${p(i)}${p(n)}${function(e){const t=Math.round(255*Number.parseFloat(e)).toString(16);return t.length>1?t:`0${t}`}(s)}`))}function m(e){e=e.replace(/"/gi,'"');const t={},i=/\s*([\w-]+)\s*:([^;]*)(;|$)/g;let n;for(;null!==(n=i.exec(e));){const e=n[1].toLowerCase().trim(),i=u(n[2]).trim();t[e]=i}return t}function g(e){return e.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>|$)/gi,"$1</lake-box>").replace(/<anchor\s*\/>/gi,'<lake-bookmark type="anchor"></lake-bookmark>').replace(/<focus\s*\/>/gi,'<lake-bookmark type="focus"></lake-bookmark>')}function f(e){return e.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"<anchor />").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"<focus />")}function v(e,t){if("undefined"==typeof window)return e;const i=(t=null!=t?t:navigator.userAgent).indexOf("Mac OS X")>=0?"⌘":"Ctrl";return e.replace(/(^|\+|\s)mod(\+|\s|$)/g,`$1${i}$2`)}function w(e){let t=0;for(e/=1024;e>1024&&t<2;)e/=1024,t++;return`${e>0?Math.max(e,.1).toFixed(1):0} ${["KB","MB","GB"][t]}`}function y(e,t){const i=l(t),n=window.getComputedStyle(e,null);return u(e.style[i]||n.getPropertyValue(t)||"")}function x(e,t){const i=[];if("string"!=typeof e)return i.push(e),i;if(""===e)return i;if("text"===t){const t=document.createTextNode(e);return i.push(t),i}if("html"===t||/<.+>/.test(e)){const t=document.createElement("div");t.innerHTML=e;for(const e of t.childNodes)i.push(e);return i}const n=document.querySelectorAll(e);for(const e of n)i.push(e);return i}const b=new Set(["h1","h2","h3","h4","h5","h6","div","p","blockquote","ul","ol","li","table","tr","th","td"]),k=new Set(["span","strong","em","i","u","s","sup","sub","code"]),C=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),S=new Set(["h1","h2","h3","h4","h5","h6"]),B=new Set(["ol","ul","li"]),_=new Set(["table","tr","td"]);function A(...e){window.LAKE_DEBUG&&console.log.apply(console.log,e)}const L={};let E=0;class T{constructor(e){e=null!=e?e:[],this.nodeList=Array.isArray(e)?e:[e];for(let e=0;e<this.nodeList.length;e++)this.nodeList[e].lakeId||(this.nodeList[e].lakeId=++E);this.length=this.nodeList.length}get id(){return this.get(0).lakeId}get name(){if(0===this.length)return"";return this.get(0).nodeName.toLowerCase()}get isElement(){if(0===this.length)return!1;return this.get(0).nodeType===Node.ELEMENT_NODE}get isText(){if(0===this.length)return!1;return this.get(0).nodeType===Node.TEXT_NODE}get isBlock(){return 0!==this.length&&b.has(this.name)}get isMark(){return 0!==this.length&&k.has(this.name)}get isVoid(){return 0!==this.length&&C.has(this.name)}get isHeading(){return 0!==this.length&&S.has(this.name)}get isList(){return 0!==this.length&&B.has(this.name)}get isTable(){return 0!==this.length&&_.has(this.name)}get isBookmark(){return"lake-bookmark"===this.name}get isBox(){return"lake-box"===this.name}get isInlineBox(){return this.isBox&&"inline"===this.attr("type")}get isBlockBox(){return this.isBox&&"block"===this.attr("type")}get isContainer(){if(0===this.length)return!1;const e=this.get(0);return this.isElement&&"true"===e.getAttribute("contenteditable")}get isOutside(){return 0===this.closest('[contenteditable="true"]').length}get isInside(){return!this.isOutside&&!this.isContainer}get isTopInside(){if(0===this.length)return!1;const e=this.parent();return 0!==e.length&&(this.isInside&&e.isContainer)}get isContentEditable(){if(0===this.length)return!1;if(this.isText){const e=this.get(0).parentNode;return!!e&&e.isContentEditable}if(!this.isElement)return!1;return this.get(0).isContentEditable}get isIndivisible(){return this.isContainer||this.isTable}get isEmpty(){if(this.isBox)return!1;const e=this.text();if(!(""===e||/^[\r\n\u200B\u2060]+$/.test(e)))return!1;if(this.isElement){if(this.find("lake-box").length>0)return!1;if(this.find("br").length>1)return!1}return!0}get(e){return this.nodeList[e]}getAll(){return this.nodeList}eq(e){const t=this.get(e);return new T(t)}each(e){const t=this.getAll();for(let i=0;i<t.length;i++)if(!1===e(t[i],i))return this;return this}eachElement(e){const t=this.getAll();for(let i=0;i<t.length;i++)if(t[i].nodeType===Node.ELEMENT_NODE&&!1===e(t[i],i))return this;return this}reverse(){const e=this.getAll().reverse();return new T(e)}matches(e){if(!this.isElement)return!1;return this.get(0).matches(e)}contains(e){e instanceof T&&(e=e.get(0));return this.get(0).contains(e)}isSibling(e){if(0===this.length)return!1;const t=this.get(0).parentNode;return t&&t===e.parent().get(0)}find(e){if("string"==typeof e){const t=this.get(0).querySelectorAll(e);return new T(Array.from(t))}let t=this.eq(0);for(const i of e)if(t=t.children()[i],!t)return new T;return t}closest(e){if(this.isText){const t=this.get(0).parentNode;return t?new T(t.closest(e)):new T}if(!this.isElement)return new T;const t=this.get(0);return new T(t.closest(e))}closestBlock(){let e=this.eq(0);for(;e.length>0&&!e.isTopInside&&!e.isBlock;)e=e.parent();return e.isBlock?e:new T}closestOperableBlock(){const e=this.closest("lake-box"),t=e.length>0?e.closestBlock():this.closestBlock();if(0===t.length)return t;if(t.isTable)return new T;const i=t.parent();return"li"===t.name&&i.isList?i:t}closestContainer(){return this.closest('div[contenteditable="true"]')}closestScroller(){let e=this.eq(0);for(;e.length>0&&e.isElement;){if(["scroll","auto"].indexOf(e.computedCSS("overflow-y"))>=0)return e;e=e.parent()}return new T}parent(){const e=this.get(0);return new T(e.parentNode)}prev(){const e=this.get(0);return new T(e.previousSibling)}next(){const e=this.get(0);return new T(e.nextSibling)}first(){const e=this.get(0);return new T(e.firstChild)}last(){const e=this.get(0);return new T(e.lastChild)}index(){let e=-1,t=this.get(0);for(;t;)e++,t=t.previousSibling;return e}path(){const e=[];let t=this.eq(0);if(t.isContainer)return e;for(;t.length>0;){const i=t.parent();if(0===i.length)break;if(e.push(t.index()),i.isContainer)break;t=i}return e.reverse()}children(){const e=[];let t=this.first();for(;t.length>0;)e.push(t),t=t.next();return e}*getWalker(){for(const e of function*e(t){if(t.isBox)return;let i=t.first();for(;i.length>0;){const t=i.next();yield i,yield*e(i),i=t}}(this.eq(0)))yield e}on(e,t){return this.eachElement((i=>{i.addEventListener(e,t,!1);const n=i.lakeId;L[n]||(L[n]=[]),L[n].push({type:e,listener:t})}))}off(e,t){return this.eachElement((i=>{var n;const s=i.lakeId,o=null!==(n=L[s])&&void 0!==n?n:[];for(let n=0;n<o.length;n++){const s=o[n];e&&(e!==s.type||t&&t!==s.listener)||(i.removeEventListener(s.type,s.listener,!1),o[n]={type:"",listener:()=>{}})}L[s]=o.filter((e=>""!==e.type))}))}emit(e,t){return this.eachElement((i=>{const n=i.lakeId,s=L[n];for(const i of s)i.type===e&&i.listener(null!=t?t:new Event(e))}))}getEventListeners(e){const t=this.get(e).lakeId;return L[t]}focus(){return this.get(0).focus(),this}blur(){return this.get(0).blur(),this}clone(e=!1){const t=this.get(0);return new T(t.cloneNode(e))}hasAttr(e){return this.get(0).hasAttribute(e)}attr(e,t){var i;if("object"==typeof e){for(const t of Object.keys(e))this.attr(t,e[t]);return this}if(void 0===t){return null!==(i=this.get(0).getAttribute(e))&&void 0!==i?i:""}return this.eachElement((i=>{i.setAttribute(e,t)}))}removeAttr(e){return this.eachElement((t=>{t.removeAttribute(e)}))}hasClass(e){return c(this.get(0).className,e," ")}addClass(e){if(Array.isArray(e)){for(const t of e)this.addClass(t);return this}return this.eachElement((t=>{c(t.className,e," ")||t.classList.add(e)}))}removeClass(e){if(Array.isArray(e)){for(const t of e)this.removeClass(t);return this}return this.eachElement((t=>{c(t.className,e," ")&&(t.classList.remove(e),""===t.className&&t.removeAttribute("class"))}))}computedCSS(e){return y(this.get(0),e)}css(e,t){if("object"==typeof e){for(const t of Object.keys(e))this.css(t,e[t]);return this}if(void 0===t){return u(this.get(0).style[l(e)])}return this.eachElement((i=>{i.style[l(e)]=t,""===i.getAttribute("style")&&i.removeAttribute("style")}))}width(){return this.get(0).offsetWidth}innerWidth(){const e=Number.parseInt(this.computedCSS("padding-left"),10)||0,t=Number.parseInt(this.computedCSS("padding-right"),10)||0;return this.width()-e-t}height(){return this.get(0).offsetHeight}show(e="block"){return this.css("display",e),this}hide(){return this.css("display","none"),this}html(e){if(void 0===e){return this.get(0).innerHTML}return this.eachElement((t=>{t.innerHTML=e}))}text(e){var t;if(void 0===e){const e=this.get(0);if(this.isText)return null!==(t=e.nodeValue)&&void 0!==t?t:"";return e.innerText.replace(/^\n+|\n+$/,"")}return this.eachElement((t=>{t.innerText=e}))}value(e){if(void 0===e){return this.get(0).value}return this.eachElement((t=>{t.value=e}))}outerHTML(){return this.get(0).outerHTML}empty(){return this.html(""),this}prepend(e){const t=this.get(0);if("string"==typeof e){const i=x(e).reverse();for(const e of i)t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e);return this}return e instanceof T&&(e=e.get(0)),t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e),this}append(e){const t=this.get(0);if("string"==typeof e){const i=x(e);for(const e of i)t.appendChild(e);return this}return e instanceof T&&(e=e.get(0)),t.appendChild(e),this}before(e){const t=this.get(0);if(!t.parentNode)return this;if("string"==typeof e){const i=x(e);for(const e of i)t.parentNode.insertBefore(e,t);return this}return e instanceof T&&(e=e.get(0)),t.parentNode.insertBefore(e,t),this}after(e){const t=this.get(0);if(!t.parentNode)return this;if("string"==typeof e){const i=x(e).reverse();for(const e of i)t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e);return this}return e instanceof T&&(e=e.get(0)),t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e),this}replaceWith(e){const t=this.get(0);if(!t.parentNode)return this;let i;return i=e instanceof T?e.get(0):x(e)[0],t.parentNode.replaceChild(i,t),this}remove(e=!1){return this.each((t=>{if(t.parentNode){if(e){let e=t.firstChild;for(;e;){const i=e.nextSibling;t.parentNode.insertBefore(e,t),e=i}}t.parentNode.removeChild(t)}})),this}splitText(e){if(!this.isText)return new T;const t=this.get(0).splitText(e);return new T(t)}toString(){if(0===this.length)return"";const e=this.get(0);let t=this.isText?e.nodeValue:this.outerHTML();return t&&t.length>50&&(t=`${t.substring(0,50)} ...`),`node (${e.lakeId}): ${t}`}info(){A(this.toString())}}function I(e){if(e instanceof T)return e;const t=x(e);return new T(t)}class M{constructor(e){this.range=null!=e?e:document.createRange()}get startNode(){return new T(this.range.startContainer)}get startOffset(){return this.range.startOffset}get endNode(){return new T(this.range.endContainer)}get endOffset(){return this.range.endOffset}get commonAncestor(){return new T(this.range.commonAncestorContainer)}get isCollapsed(){return this.range.collapsed}get isBox(){return this.commonAncestor.closest("lake-box").length>0}get isBoxStart(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.compareBeforeNode(t)>=0}get isBoxCenter(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.isCollapsed&&this.startNode.get(0)===t.get(0)&&0===this.startOffset}get isBoxEnd(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.compareAfterNode(t)<=0}get isInsideBox(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return(!this.isCollapsed||this.startNode.get(0)!==t.get(0)||0!==this.startOffset)&&(this.compareBeforeNode(t)<0&&this.compareAfterNode(t)>0)}get isInoperative(){if(this.commonAncestor.isOutside)return!0;const e=this.startNode.closest("td"),t=this.endNode.closest("td");return e.length>0&&t.length>0&&e.get(0)!==t.get(0)}get(){return this.range}getRect(){const e=this.clone();let t,i,n;if(e.isCollapsed){let s="left";if(e.startNode.isElement){const t=e.startNode.children();0===t.length?e.selectNode(e.startNode):e.startOffset<t.length?e.setEnd(e.startNode,e.startOffset+1):(e.setStart(e.startNode,e.startOffset-1),s="right")}else if(e.startNode.isText){const t=e.startNode.text();e.startOffset<t.length?e.setEnd(e.startNode,e.startOffset+1):e.startOffset>0&&(e.setStart(e.startNode,e.startOffset-1),s="right")}t=e.get().getBoundingClientRect(),i="left"===s?t.x:t.right,n=1}else t=e.get().getBoundingClientRect(),i=t.x,n=t.width;const s=t.height;return DOMRect.fromRect({x:i,y:s>0?t.y:0,width:n>0?n:1,height:s>0?s:1})}comparePoint(e,t){return this.range.comparePoint(e.get(0),t)}compareBeforeNode(e){const t=new M;return e.isText?t.setStart(e,0):t.setStartBefore(e),t.collapseToStart(),this.comparePoint(t.startNode,t.startOffset)}compareAfterNode(e){var t;const i=new M;if(e.isText){const n=null!==(t=e.get(0).nodeValue)&&void 0!==t?t:"";i.setStart(e,n.length)}else i.setStartAfter(e);return i.collapseToStart(),this.comparePoint(i.startNode,i.startOffset)}intersectsNode(e){return this.range.intersectsNode(e.get(0))}setStart(e,t){this.range.setStart(e.get(0),t)}setStartBefore(e){this.range.setStartBefore(e.get(0))}setStartAfter(e){this.range.setStartAfter(e.get(0))}setEnd(e,t){this.range.setEnd(e.get(0),t)}setEndBefore(e){this.range.setEndBefore(e.get(0))}setEndAfter(e){this.range.setEndAfter(e.get(0))}collapseToStart(){this.range.collapse(!0)}collapseToEnd(){this.range.collapse(!1)}selectNode(e){this.range.selectNode(e.get(0))}selectNodeContents(e){this.range.selectNodeContents(e.get(0))}selectBox(e){const t=e.find(".lake-box-container");if(0===t.length)throw new Error(`Box "${e.attr("name")}" (id=${e.id}) cannot be selected because it has not been rendered yet.`);this.setStart(t,0),this.collapseToStart()}selectBoxStart(e){const t=e.find(".lake-box-strip");if(0===t.length)throw new Error(`Box "${e.attr("name")}" (id=${e.id}) cannot be selected because it has not been rendered yet.`);this.selectNodeContents(t.eq(0)),this.collapseToStart()}selectBoxEnd(e){const t=e.find(".lake-box-strip");if(0===t.length)throw new Error(`Box "${e.attr("name")}" (id=${e.id}) cannot be selected because it has not been rendered yet.`);this.selectNodeContents(t.eq(1)),this.collapseToStart()}shrinkBefore(e){if(e.isBox)return void this.selectBoxStart(e);if(e.isText)return this.setStartBefore(e),void this.collapseToStart();let t;for(this.setStart(e,0);this.startNode.isElement&&(t=this.startNode.children()[0])&&t.isElement&&!t.isVoid;){if(t.isBox)return void this.selectBoxStart(t);this.setStart(t,0)}this.collapseToStart()}shrinkAfter(e){if(e.isBox)return void this.selectBoxEnd(e);if(e.isText)return this.setEndAfter(e),void this.collapseToEnd();let t;for(this.setEnd(e,e.children().length);this.endNode.isElement&&this.endOffset>0&&(t=this.endNode.children()[this.endOffset-1])&&t.isElement&&!t.isVoid;){if(t.isBox)return void this.selectBoxEnd(t);this.setEnd(t,t.children().length)}this.collapseToEnd(),this.adjustBr()}shrink(){const e=this.isCollapsed;let t;for(;this.startNode.isElement&&(t=this.startNode.children()[this.startOffset])&&t.isElement&&!t.isVoid&&!t.isBox;)this.setStart(t,0);if(e)this.collapseToStart();else for(;this.endNode.isElement&&this.endOffset>0&&(t=this.endNode.children()[this.endOffset-1])&&t.isElement&&!t.isVoid&&!t.isBox;)this.setEnd(t,t.children().length)}adjustBox(){const e=this.startNode.closest("lake-box");if(e.length>0){const t=this.clone();t.collapseToStart(),t.isBoxEnd?this.setStartAfter(e):this.setStartBefore(e)}const t=this.endNode.closest("lake-box");if(t.length>0){const e=this.clone();e.collapseToEnd(),e.isBoxStart?this.setEndBefore(t):this.setEndAfter(t)}}adjustTable(){const e=this.startNode.closest("table"),t=this.endNode.closest("table");if(0===e.length&&t.length>0&&t.isInside)return this.setEndBefore(t),void this.shrink();0===t.length&&e.length>0&&e.isInside&&(this.setStartAfter(e),this.shrink())}adjustBlock(){if(!this.isCollapsed){if(this.endNode.isElement&&0===this.endOffset){let e=this.endNode;for(;0===e.prev().length;)e=e.parent();this.setEndBefore(e)}return void this.shrink()}if(this.startNode.isText)return;const e=this.startNode.children()[this.startOffset];e&&(e.isBlockBox||e.isBlock)&&this.shrinkBefore(e)}adjust(){this.adjustBox(),this.adjustTable(),this.adjustBlock()}adjustBr(){if(!this.isCollapsed)return;const e=this.getPrevNode(),t=this.getNextNode();"br"===e.name&&0===t.length&&(this.setStartBefore(e),this.collapseToStart())}getPrevNode(){let e;return e=this.startNode.isText?0===this.startOffset?this.startNode.prev():this.startNode:this.startNode.children()[this.startOffset-1],null!=e?e:new T}getNextNode(){let e;return e=this.endNode.isText?this.endOffset===this.endNode.text().length?this.endNode.next():this.endNode:this.endNode.children()[this.endOffset],null!=e?e:new T}getBoxes(){if(this.isCollapsed){const e=this.startNode.closest("lake-box");return e.length>0?[e]:[]}const e=[],t=this.clone();t.adjustBox();for(const i of t.commonAncestor.getWalker())i.isBox&&t.intersectsNode(i)&&e.push(i);return e}getBlocks(){if(this.isCollapsed){const e=this.startNode.closestOperableBlock();return e.isTable?[]:e.isInside?[e]:[]}const e=this.startNode.closestOperableBlock(),t=this.endNode.closestOperableBlock();if(e.isInside&&e.get(0)&&e.get(0)===t.get(0))return e.isTable?[]:[e];const i=[],n=this.clone();n.collapseToEnd();for(const e of this.commonAncestor.getWalker())e.isBlock&&!e.isTable&&e.isTopInside&&0!==n.comparePoint(e,0)&&this.intersectsNode(e)&&i.push(e);if(i.length>0)return i;for(const n of this.commonAncestor.getWalker())n.isBlock&&!n.isTable&&(e.isSibling(n)||t.isSibling(n))&&this.intersectsNode(n)&&i.push(n);return i}getMarks(e=!1){const t=[];if(this.commonAncestor.isText&&e&&0===this.startOffset&&this.endOffset===this.commonAncestor.text().length)return t.push(this.commonAncestor),t;const i=this.clone();i.collapseToStart();const n=this.clone();n.collapseToEnd();for(const s of this.commonAncestor.getWalker()){const o=document.createRange();if(o.setStartAfter(s.get(0)),o.collapse(!0),n.compareBeforeNode(s)>=0)break;i.compareAfterNode(s)>0&&(s.isMark||s.isText&&e)&&t.push(s)}return t}getStartText(){const e=this.startNode,t=this.startOffset;let i=e.closestBlock();if(i.isOutside&&(i=e.closestContainer()),0===i.length)return"";const n=new M;n.setStartBefore(i),n.setEnd(e,t);const s=I("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"":o}getEndText(){const e=this.endNode,t=this.endOffset;let i=e.closestBlock();if(i.isOutside&&(i=e.closestContainer()),0===i.length)return"";const n=new M;n.setStart(e,t),n.setEndAfter(i);const s=I("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"":o}clone(){return new M(this.range.cloneRange())}cloneContents(){return this.range.cloneContents()}info(){A("--- range information ---"),A("start node:",this.startNode.toString(),", offset:",this.startOffset),A("end node:",this.endNode.toString(),", offset:",this.endOffset)}}function P(e,t,i){const n=new M;let s;if(e.isText){s=e.parent();const i=e.splitText(t);n.setStartAfter(e),""===e.text()&&e.remove(),""===i.text()&&i.remove()}else n.setStart(e,t),s=e;if("body"===s.name||"html"===s.name)return null;if(s.get(0)===i.get(0))return null;n.collapseToStart();const o=s.clone();let r=s.first();for(;r.length>0&&!(n.compareBeforeNode(r)>=0);){const e=r.next();o.append(r),r=e}return s.before(o),s.parent().length>0&&s.parent().get(0)!==i.get(0)?P(s.parent(),s.index(),i):{start:o,end:s}}function D(e){const t=I("<br />");let i=e;for(;i.isBlock;){let e=i.last();for(;e.isText&&e.isEmpty;)e=e.prev();if(!e.isBlock&&"br"!==e.name){i.append(t);break}i=e}return t}function Z(e){if(0===e.length)return;const t=[];let i=e.first();for(;i.length>0;){const e=i.next();i.isText&&""===i.text()||t.push(i),i=e}(1===t.length&&"br"===t[0].name||2===t.length&&"br"===t[0].name&&t[1].isBookmark)&&t[0].remove(),2===t.length&&t[0].isBookmark&&"br"===t[1].name&&t[1].remove()}function O(e){if(e.isText)return{node:e,offset:e.text().length};const t=new M;return t.setEndAfter(e),{node:t.endNode,offset:t.endOffset}}function N(e,t){const i=t;if(["ul","ol"].indexOf(e.name)>=0){const t=e.find("li");e=t.eq(t.length-1)}if(["ul","ol"].indexOf(t.name)>=0){const e=t.find("li");t=e.eq(0)}if(e.isText||t.isText||e.isVoid||t.isVoid)return O(e);Z(e),Z(t),e.isBlock&&e.isEmpty&&t.isEmpty&&D(e);const n=e.last(),s=t.first();let o=s;for(;o.length>0;){const t=o.next();e.append(o),o=t}return i.remove(),n.length>0&&s.length>0&&n.isElement&&!n.isBox&&n.clone(!1).get(0).isEqualNode(s.clone(!1).get(0))?N(n,s):0===n.length?{node:e,offset:0}:O(n)}function z(e){let t=e;for(;t.length>0;){let e=t.first();if(e.isText&&e.isEmpty&&(e=e.next()),t.isElement&&!t.isVoid&&0===e.length)break;t=e}return t}function H(e,t){if(t=null!=t?t:I("<p />"),0===e.length)return t;const i=z(t=t.clone(!0));e[0].before(t);for(const t of e)i.append(t);return t}function $(e){for(const t of e.getWalker())if(t.isText){const e=t.text();""===e?t.remove():e.length>1&&/\u200B/.test(e)&&(t.get(0).nodeValue=e.replace(/\u200B/g,""))}}function V(e,t){const i=e.get(0),n=I(a`<${t} />`);for(const e of i.attributes)n.attr(e.name,e.value);let s=e.first();for(;s.length>0;){const e=s.next();n.append(s),s=e}return e.replaceWith(n),n}function F(e){if(0===e.length)return;const t=e[0],i=e[e.length-1],n=[];let s=t.prev();for(;s.length>0&&"ol"===s.name;)n.push(s),s=s.prev();n.reverse(),n.push(...e);let o=i.next();for(;o.length>0&&"ol"===o.name;)n.push(o),o=o.next();let r=1;for(const e of n){const t=e.prev();if(0!==t.length&&"ol"===t.name||(r=1),"ol"===e.name){"ol"===t.name&&t.attr("indent")!==e.attr("indent")&&(r=1);const i=e.attr("start"),n=r.toString(10);i!==n&&e.attr("start",n),r++}}}function R(e,t){if(e.isList){let i=Number.parseInt(e.attr("indent"),10)||0;if("increase"===t?i++:i--,i<=0)i=0;else if(i>10)return;return 0===i?e.removeAttr("indent"):e.attr("indent",i.toString(10)),void F([e])}let i=Number.parseInt(e.css("margin-left"),10)||0;"decrease"!==t||0!==i||""===e.css("text-indent")?("increase"===t?i+=40:i-=40,i<=0&&(i=0),0===i?e.css("margin-left",""):e.css("margin-left",`${i}px`)):e.css("text-indent","")}const j=new Set;function q(){}const W={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:q,afterNodeAdded:q,beforeNodeMorphed:q,afterNodeMorphed:q,beforeNodeRemoved:q,afterNodeRemoved:q,beforeAttributeUpdated:q,afterAttributeUpdated:q,beforeChildrenUpdated:q},head:{style:"merge",shouldPreserve:e=>"true"===e.getAttribute("im-preserve"),shouldReAppend:e=>"true"===e.getAttribute("im-re-append"),shouldRemove:q,afterHeadMorphed:q}};function U(e,t){return!e.deadIds.has(t)}function K(e,t,i){return(e.idMap.get(i)||j).has(t)}function G(e,t){const i=e.idMap.get(t)||j;for(const t of i)e.deadIds.add(t)}function X(e,t,i){const n=e.idMap.get(t)||j;let s=0;for(const t of n)U(e,t)&&K(e,t,i)&&++s;return s}function Q(e,t){const i=e.parentElement,n=e.querySelectorAll("[id]");for(const e of n){let n=e;for(;n!==i&&null!=n;){let i=t.get(n);null==i&&(i=new Set,t.set(n,i)),i.add(e.id),n=n.parentElement}}}function Y(e,t){const i=new Map;return Q(e,i),Q(t,i),i}function J(e,t,i){return{target:e,newContent:t,config:i=function(e){const t={};return Object.assign(t,W),Object.assign(t,e),t.callbacks={},Object.assign(t.callbacks,W.callbacks),Object.assign(t.callbacks,e.callbacks),t.head={},Object.assign(t.head,W.head),Object.assign(t.head,e.head),t}(i),morphStyle:i.morphStyle,ignoreActive:i.ignoreActive,ignoreActiveValue:i.ignoreActiveValue,idMap:Y(e,t),deadIds:new Set,callbacks:i.callbacks,head:i.head}}function ee(e,t,i){return null!=e&&null!=t&&(e.nodeType===t.nodeType&&e.tagName===t.tagName&&(""!==e.id&&e.id===t.id||X(i,e,t)>0))}function te(e,t){return null!=e&&null!=t&&(e.nodeType===t.nodeType&&e.tagName===t.tagName)}function ie(e,t){G(t,e),!1!==t.callbacks.beforeNodeRemoved(e)&&(e.remove(),t.callbacks.afterNodeRemoved(e))}function ne(e,t,i){let n=e;for(;n&&n!==t;){const e=n;n=n.nextSibling,ie(e,i)}return G(i,t),t.nextSibling}function se(e,t,i,n,s){const o=X(s,i,t);let r=null;if(o>0){r=n;let t=0;for(;null!=r;){if(ee(i,r,s))return r;if(t+=X(s,r,e),t>o)return null;r=r.nextSibling}}return r}function oe(e,t,i,n,s){let o=n,r=i.nextSibling,a=0;for(;null!=o;){if(X(s,o,e)>0)return null;if(te(i,o))return o;if(te(r,o)&&(a++,r=r?r.nextSibling:null,a>=2))return null;o=o?o.nextSibling:null}return o}function re(e,t,i){return te(e,t)?.5+X(i,e,t):0}function ae(e,t,i,n){return!("value"!==e||!n.ignoreActiveValue||t!==document.activeElement)||!1===n.callbacks.beforeAttributeUpdated(e,t,i)}function le(e,t,i){var n;if(!i.ignoreActive||e!==document.activeElement)return null==t?!1===i.callbacks.beforeNodeRemoved(e)?e:(e.remove(),i.callbacks.afterNodeRemoved(e),null):te(e,t)?(!1===i.callbacks.beforeNodeMorphed(e,t)||(function(e,t,i){const n=e.nodeType;if(1===n){const n=e.attributes,s=t.attributes;for(const e of n)ae(e.name,t,"update",i)||t.getAttribute(e.name)!==e.value&&(t.setAttribute(e.name,e.value),i.callbacks.afterAttributeUpdated(e.name,t,"update"));for(let n=s.length-1;n>=0;n--){const o=s[n];ae(o.name,t,"remove",i)||e.hasAttribute(o.name)||(t.removeAttribute(o.name),i.callbacks.afterAttributeUpdated(o.name,t,"remove"))}}8!==n&&3!==n||t.nodeValue!==e.nodeValue&&(t.nodeValue=e.nodeValue)}(t,e,i),!1===i.callbacks.beforeChildrenUpdated(e,t)||function(e,t){return t.ignoreActiveValue&&e===document.activeElement}(e,i)||ce(t,e,i),i.callbacks.afterNodeMorphed(e,t)),e):!1===i.callbacks.beforeNodeRemoved(e)||!1===i.callbacks.beforeNodeAdded(t)?e:(null===(n=e.parentElement)||void 0===n||n.replaceChild(t,e),i.callbacks.afterNodeAdded(t),i.callbacks.afterNodeRemoved(e),t)}function ce(e,t,i){let n,s=e.firstChild,o=t.firstChild;for(;s;){if(n=s,s=n.nextSibling,null==o){if(!1===i.callbacks.beforeNodeAdded(n))return;t.appendChild(n),i.callbacks.afterNodeAdded(n),G(i,n);continue}if(ee(n,o,i)){le(o,n,i),o=o.nextSibling,G(i,n);continue}const r=se(e,t,n,o,i);if(r){o=ne(o,r,i),le(r,n,i),G(i,n);continue}const a=oe(e,0,n,o,i);if(a)o=ne(o,a,i),le(a,n,i),G(i,n);else{if(!1===i.callbacks.beforeNodeAdded(n))return;t.insertBefore(n,o),i.callbacks.afterNodeAdded(n),G(i,n)}}for(;null!==o;){const e=o;o=o.nextSibling,ie(e,i)}}function de(e,t,i){if("innerHTML"===i.morphStyle)return ce(t,e,i),e.children;if("outerHTML"===i.morphStyle||null==i.morphStyle){const n=function(e,t,i){let n;n=e.firstChild;let s=n,o=0;for(;n;){const e=re(n,t,i);e>o&&(s=n,o=e),n=n.nextSibling}return s}(t,e,i),s=null==n?void 0:n.previousSibling,o=null==n?void 0:n.nextSibling,r=le(e,n,i);return n?function(e,t,i){var n,s;const o=[],r=[];let a=e;for(;null!=a;)o.push(a),a=a.previousSibling;for(;o.length>0;){const e=o.pop();r.push(e),e&&(null===(n=t.parentElement)||void 0===n||n.insertBefore(e,t))}r.push(t);let l=i;for(;null!=l;)o.push(l),r.push(l),l=l.nextSibling;for(;o.length>0;){const e=o.pop();e&&(null===(s=t.parentElement)||void 0===s||s.insertBefore(e,t.nextSibling))}return r}(s,r,o):[]}throw`Do not understand how to morph style ${i.morphStyle}`}function he(e,t,i={}){const n=function(e){if(null==e)return document.createElement("div");if(e instanceof Node){if(e.generatedByIdiomorph)return e;const t=document.createElement("div");return t.append(e),t}const t=document.createElement("div");for(const i of[...e])t.append(i);return t}(t.get(0)),s=J(e.get(0),n,i);de(e.get(0),n,s)}function pe(e){const t=e.get(0).getBoundingClientRect();let i=t.left,n=t.right,s=t.top,o=t.bottom,r=window.innerWidth,a=window.innerHeight;const l=e.closestScroller();if(l.length>0){const e=l.get(0).getBoundingClientRect(),t=e.x,c=e.y;i-=t,n-=t,s-=c,o-=c,r=e.width,a=e.height}return{left:i,right:r-n,top:s,bottom:a-o}}function ue(e,t){const i=pe(e);(i.left<0||i.right<0||i.top<0||i.bottom<0)&&e.get(0).scrollIntoView(t)}const me=new Map;function ge(e){let t=me.get(e);return t||(t=new Map,me.set(e,t),t)}function fe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ve={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function s(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,n,o,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,o||e,r),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,n,s=[];if(0===this._eventsCount)return s;for(n in e=this._events)t.call(e,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},a.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,o=n.length,r=new Array(o);s<o;s++)r[s]=n[s].fn;return r},a.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,s,o,r){var a=i?i+e:e;if(!this._events[a])return!1;var l,c,d=this._events[a],h=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),h){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,s),!0;case 5:return d.fn.call(d.context,t,n,s,o),!0;case 6:return d.fn.call(d.context,t,n,s,o,r),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];d.fn.apply(d.context,l)}else{var p,u=d.length;for(c=0;c<u;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),h){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,n);break;case 4:d[c].fn.call(d[c].context,t,n,s);break;default:if(!l)for(p=1,l=new Array(h-1);p<h;p++)l[p-1]=arguments[p];d[c].fn.apply(d[c].context,l)}}return!0},a.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,n,s){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return r(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||s&&!a.once||n&&a.context!==n||r(this,o);else{for(var l=0,c=[],d=a.length;l<d;l++)(a[l].fn!==t||s&&!a[l].once||n&&a[l].context!==n)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:r(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&r(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a}(ve);var we=fe(ve.exports);const ye=new Map,xe=new Map;class be{constructor(e){this.config=e,this.root=e.root,this.node=I(a`
|
|
2
2
|
<button type="button" name="${e.name}" class="lake-button" />
|
|
3
|
-
`),e.type&&this.node.addClass(`lake-${e.type}-button`),void 0!==e.tabIndex&&this.node.attr("tabindex",e.tabIndex.toString())}render(){const e=this.config,t=this.node;t.addClass(`lake-${e.text?"text":"icon"}-button`),e.tooltip&&t.attr("title",e.tooltip),e.icon&&t.append(e.icon),e.text&&t.append(`<span>${e.text}</span>`),this.root.append(t),t.on("mouseenter",(()=>{t.attr("disabled")||t.hasClass("lake-button-selected")||t.addClass("lake-button-hovered")})),t.on("mouseleave",(()=>{t.attr("disabled")||t.removeClass("lake-button-hovered")})),t.on("click",(t=>{t.preventDefault(),e.onClick()}))}}const ke=/^\{.*\}$/,Ce=/(\{(?:[^{}]+|\{(?:[^{}]+)*\})*\})/g,Se=e=>e.substring(1,e.length-1),Be=(e,t=!0,i="",n="")=>e.split(Ce).map((e=>{if(!e.match(Ce))return e;const t=Se(e);if(t.startsWith("{"))return((e,t)=>{let[i,n]=e.split(":");n||(n=i,i=t);const s=n.split("|"),[o,r,a,l,c,d]=s,h=s.filter((e=>void 0!==e)).length;return 1===h?{k:i,r:o}:2===h?{k:i,o:o,r:r}:3===h?{k:i,z:o,o:r,r:a}:{k:i,z:o,o:r,t:a,f:l,m:c,r:d}})(Se(t),n);const s=(e=>{const[t="",...i]=e.split("|"),[n="",s]=t.split(":"),[o,r]=n.split("?");return{k:o,i:s,n:""===r,f:i}})(t);return n=s.k||n,!i&&(i=n),s})).map((e=>{if("string"==typeof e)return e;e.k||(e.k=i||"0");const n=(e=>Object.fromEntries(Object.keys(e).map((t=>{const i=e[t];return[t,Array.isArray(i)?i.map((e=>null==e?void 0:e.trim())):i===!!i?i:null==i?void 0:i.trim()]}))))(e);return t?(s=n,Object.fromEntries(Object.entries(s).map((([e,t])=>"i"!==e&&t&&"0"!=t&&[e,t])).filter(Boolean))):n;var s})),_e=(e,t,i)=>t.reduce(((t,i)=>{var n,s,o;return null!==(s=i.match(ke)?(e=>{var i;return null!==(i=e[t])&&void 0!==i?i:e["*"]})((o=i,Object.fromEntries(Se(o).split(",").map((e=>e.split(":"))).reduce(((e,t)=>2===t.length?[...e,t.map((e=>e.trim()))]:(e[e.length-1][1]+=","+t[0],e)),[])))):null===(n=e[i])||void 0===n?void 0:n.call(e,t))&&void 0!==s?s:t}),i),Ae=/\?\?/g,Le=(e,t,i,n)=>{const s=n[0],o=s&&"object"==typeof s&&s.constructor===Object;return((e,t,i,n)=>e.map((e=>{if("string"==typeof e)return e;const{k:s="0",f:o=[]}=e,r=n[s];if((e=>!(!e.o&&!e.r))(e))return(("boolean"==typeof r?r?e.o:e.r:((e,{z:t,o:i,t:n,f:s,m:o,r:r},a)=>{switch(t&&0==a?"zero":e.select(a)){case"zero":return t;case"one":return i;case"two":return n;case"few":return null!=s?s:r;case"many":return null!=o?o:r;default:return r}})(t,e,r))||"").replace(Ae,r);const a=o.length?_e(i,o,r):r;return(""+(null!=a?a:"")).trim()})).join(""))(e,t,i,1===n.length&&o?s:n)},Ee=(e,t)=>{const i={},n=new Intl.PluralRules(e);return(e,...s)=>Le(((e,t)=>e[t]||(e[t]=Be(t)))(i,e),n,t,s)};const Te=(e={},t)=>"string"==typeof e?t.bind(null,e):Object.assign(Object.defineProperty((()=>""),"name",{writable:!0}),e),Ie=(e,t)=>new Proxy(Te(e,t),{get:(e,i)=>i===Symbol.iterator?[][Symbol.iterator].bind(Object.values(e).map((e=>Te(e,t)))):Ie(e[i],t)});const Me={"en-US":{toolbar:{undo:`Undo (${v("mod+Z")})`,redo:`Redo (${v("mod+Y")})`,selectAll:`Select all (${v("mod+A")})`,paragraph:"Paragraph",blockQuote:"Block quotation",numberedList:"Numbered list",bulletedList:"Bulleted list",checklist:"Checklist",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Align justify",increaseIndent:"Increase indent",decreaseIndent:"Decrease indent",bold:`Bold (${v("mod+B")})`,italic:`Italic (${v("mod+I")})`,underline:`Underline (${v("mod+U")})`,strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",code:"Inline code",removeFormat:"Remove format",formatPainter:"Format painter",link:"Link",hr:"Horizontal line",video:"Video",codeBlock:"Code block",heading:"Heading",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",list:"List",align:"Alignment",indent:"Indent",fontFamily:"Font family",fontSize:"Font size",moreStyle:"More style",fontColor:"Font color",highlight:"Highlight",image:"Image",file:"File",emoji:"Emoji",equation:"Mathematical formula",removeColor:"Remove color"},slash:{heading1:"Heading 1",heading1Desc:"Create a heading level 1",heading2:"Heading 2",heading2Desc:"Create a heading level 2",heading3:"Heading 3",heading3Desc:"Create a heading level 3",heading4:"Heading 4",heading4Desc:"Create a heading level 4",heading5:"Heading 5",heading5Desc:"Create a heading level 5",heading6:"Heading 6",heading6Desc:"Create a heading level 6",paragraph:"Paragraph",paragraphDesc:"Create a paragraph",blockQuote:"Block quotation",blockQuoteDesc:"Create a block quotation",numberedList:"Numbered list",numberedListDesc:"Create a numbered list",bulletedList:"Bulleted list",bulletedListDesc:"Create a bulleted list",checklist:"Checklist",checklistDesc:"Create a checklist",hr:"Horizontal line",hrDesc:"Insert a horizontal line",codeBlock:"Code block",codeBlockDesc:"Insert a code block",video:"Video",videoDesc:"Insert a video from YouTube",equation:"Mathematical formula",equationDesc:"Insert a TeX expression",image:"Image",imageDesc:"Upload an image",file:"File",fileDesc:"Upload a file"},link:{newLink:"New link",url:"Link URL",title:"Link title",copy:"Copy link to clipboard",open:"Open link in new tab",save:"Save",unlink:"Remove link"},image:{view:"Full screen",remove:"Delete",previous:"Previous",next:"Next",close:"Close (Esc)",loadingError:"The image cannot be loaded",zoomOut:"Zoom out",zoomIn:"Zoom in"},file:{download:"Download",remove:"Delete"},video:{embed:"Embed video",remove:"Delete",description:"Paste a link to embed a video from YouTube.",url:"Link",urlError:"Please enter a valid link."},codeBlock:{langType:"Select language"},equation:{save:"Done",help:"Supported Functions",placeholder:"Type a TeX expression"}},"zh-CN":{toolbar:{undo:`撤消 (${v("mod+Z")})`,redo:`重做 (${v("mod+Y")})`,selectAll:`全选 (${v("mod+A")})`,paragraph:"正文",blockQuote:"引用",numberedList:"编号",bulletedList:"项目符号",checklist:"任务列表",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignJustify:"两端对齐",increaseIndent:"增加缩进",decreaseIndent:"减少缩进",bold:`粗体 (${v("mod+B")})`,italic:`斜体 (${v("mod+I")})`,underline:`下划线 (${v("mod+U")})`,strikethrough:"删除线",superscript:"上标",subscript:"下标",code:"行内代码",removeFormat:"清除格式",formatPainter:"格式刷",link:"链接",hr:"分割线",video:"视频",codeBlock:"代码块",heading:"标题",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3",heading4:"标题 4",heading5:"标题 5",heading6:"标题 6",list:"列表",align:"对齐方式",indent:"缩进",fontFamily:"字体",fontSize:"文字大小",moreStyle:"更多样式",fontColor:"文字颜色",highlight:"文字背景",image:"图片",file:"文件",emoji:"表情",equation:"数学公式",removeColor:"默认"},slash:{heading1:"标题 1",heading1Desc:"创建标题 1",heading2:"标题 2",heading2Desc:"创建标题 2",heading3:"标题 3",heading3Desc:"创建标题 3",heading4:"标题 4",heading4Desc:"创建标题 4",heading5:"标题 5",heading5Desc:"创建标题 5",heading6:"标题 6",heading6Desc:"创建标题 6",paragraph:"正文",paragraphDesc:"把当前段落改成正文",blockQuote:"引用",blockQuoteDesc:"创建引用",numberedList:"编号",numberedListDesc:"创建编号列表",bulletedList:"项目符号",bulletedListDesc:"创建项目符号列表",checklist:"任务列表",checklistDesc:"创建任务列表",hr:"分割线",hrDesc:"插入分割线",codeBlock:"代码块",codeBlockDesc:"插入代码块",video:"视频",videoDesc:"插入 YouTube 视频",equation:"数学公式",equationDesc:"支持 TeX 语法",image:"图片",imageDesc:"上传图片",file:"文件",fileDesc:"上传文件"},link:{newLink:"新链接",url:"链接 URL",title:"链接文本",copy:"复制到剪贴板",open:"打开链接",save:"确定",unlink:"取消链接"},image:{view:"查看大图",remove:"删除",previous:"上一张",next:"下一张",close:"关闭 (Esc)",loadingError:"图片加载失败",zoomOut:"缩小",zoomIn:"放大"},file:{download:"下载",remove:"删除"},video:{embed:"嵌入视频",remove:"删除",description:"在下面的输入框里,粘贴 YouTube 链接。",url:"链接",urlError:"请输入有效的链接。"},codeBlock:{langType:"选择代码语言"},equation:{save:"确定",help:"支持的功能",placeholder:"请输入 TeX 表达式"}},ja:{toolbar:{undo:`元に戻す (${v("mod+Z")})`,redo:`やり直し (${v("mod+Y")})`,selectAll:`すべて選択 (${v("mod+A")})`,paragraph:"テキスト",blockQuote:"引用ブロック",numberedList:"番号付きリスト",bulletedList:"箇条書きリスト",checklist:"タスクリスト",alignLeft:"左揃え",alignCenter:"中心揃え",alignRight:"右揃え",alignJustify:"左右に並べ替え",increaseIndent:"インデントを増やす",decreaseIndent:"インデントを減らす",bold:`太字 (${v("mod+B")})`,italic:`斜体 (${v("mod+I")})`,underline:`下線 (${v("mod+U")})`,strikethrough:"取り消し線",superscript:"上付き文字",subscript:"下付き文字",code:"インラインコード",removeFormat:"形式を削除",formatPainter:"形式ペインタ",link:"リンク",hr:"区切り線",video:"動画",codeBlock:"コードブロック",heading:"タイトル",heading1:"タイトル 1",heading2:"タイトル 2",heading3:"タイトル 3",heading4:"タイトル 4",heading5:"タイトル 5",heading6:"タイトル 6",list:"リスト",align:"文字揃え",indent:"インデント",fontFamily:"フォント",fontSize:"文字サイズ",moreStyle:"その他のスタイル",fontColor:"文字色",highlight:"文字の背景",image:"画像",file:"ファイル",emoji:"絵文字",equation:"数学公式",removeColor:"デフォルト"},slash:{heading1:"タイトル 1",heading1Desc:"レベル 1 のタイトルを作成",heading2:"タイトル 2",heading2Desc:"レベル 2 のタイトルを作成",heading3:"タイトル 3",heading3Desc:"レベル 3 のタイトルを作成",heading4:"タイトル 4",heading4Desc:"レベル 4 のタイトルを作成",heading5:"タイトル 5",heading5Desc:"レベル 5 のタイトルを作成",heading6:"タイトル 6",heading6Desc:"レベル 6 のタイトルを作成",paragraph:"テキスト",paragraphDesc:"段落を作成",blockQuote:"引用ブロック",blockQuoteDesc:"引用ブロックを作成",numberedList:"番号付きリスト",numberedListDesc:"番号付きリストを作成",bulletedList:"箇条書きリスト",bulletedListDesc:"箇条書きリストを作成",checklist:"タスクリスト",checklistDesc:"タスクリストを作成",hr:"区切り線",hrDesc:"水平線を挿入",codeBlock:"コードブロック",codeBlockDesc:"コードブロックを挿入",video:"動画",videoDesc:"YouTube から動画を挿入",equation:"数学公式",equationDesc:"TeX 数式を挿入",image:"画像",imageDesc:"画像をアップロード",file:"ファイル",fileDesc:"ファイルをアップロード"},link:{newLink:"新しいリンク",url:"リンク URL",title:"リンク文字",copy:"クリップボードにコピー",open:"リンクを開く",save:"確認",unlink:"リンクを削除"},image:{view:"大きな画像を見る",remove:"削除",previous:"前の画像",next:"次の画像",close:"閉じる (Esc)",loadingError:"画像を読み込めません",zoomOut:"縮小",zoomIn:"拡大"},file:{download:"ダウンロード",remove:"削除"},video:{embed:"動画を埋め込む",remove:"削除",description:"下の入力欄に YouTube リンクを貼り付けてください。",url:"リンク",urlError:"有効なリンクを入力してください。"},codeBlock:{langType:"コード言語を選択"},equation:{save:"確認",help:"サポートされている機能",placeholder:"TeX 数式を入力してください。"}},ko:{toolbar:{undo:`작업취소 (${v("mod+Z")})`,redo:`작업재개 (${v("mod+Y")})`,selectAll:`전체 선택 (${v("mod+A")})`,paragraph:"텍스트",blockQuote:"인용문",numberedList:"순서 목록",bulletedList:"비순서 목록",checklist:"체크리스트",alignLeft:"왼쪽 정렬",alignCenter:"가운데 정렬",alignRight:"오른쪽 정렬",alignJustify:"좌우로 정렬",increaseIndent:"들여쓰기 증가",decreaseIndent:"들여쓰기 줄이기",bold:`굵게 (${v("mod+B")})`,italic:`기울임꼴 (${v("mod+I")})`,underline:`밑줄 (${v("mod+U")})`,strikethrough:"취소선",superscript:"위첨자",subscript:"아래 첨자",code:"인라인 코드",removeFormat:"형식 지우기",formatPainter:"형식 페인터",link:"링크",hr:"구분선",video:"동영상",codeBlock:"코드 블록",heading:"제목",heading1:"제목 1",heading2:"제목 2",heading3:"제목 3",heading4:"제목 4",heading5:"제목 5",heading6:"제목 6",list:"목록",align:"정렬",indent:"들여쓰기",fontFamily:"글꼴",fontSize:"글자 크기",moreStyle:"더 많은 스타일",fontColor:"글자 색상",highlight:"글자 배경",image:"이미지",file:"파일",emoji:"이모지",equation:"수학 공식",removeColor:"기본색"},slash:{heading1:"제목 1",heading1Desc:"1 단계 제목을 작성",heading2:"제목 2",heading2Desc:"2 단계 제목을 작성",heading3:"제목 3",heading3Desc:"3 단계 제목을 작성",heading4:"제목 4",heading4Desc:"4 단계 제목을 작성",heading5:"제목 5",heading5Desc:"5 단계 제목을 작성",heading6:"제목 6",heading6Desc:"6 단계 제목을 작성",paragraph:"텍스트",paragraphDesc:"단락을 작성",blockQuote:"인용문",blockQuoteDesc:"인용문을 작성",numberedList:"순서 목록",numberedListDesc:"순서 목록을 작성",bulletedList:"비순서 목록",bulletedListDesc:"비순서 목록을 작성",checklist:"체크리스트",checklistDesc:"체크리스트를 작성",hr:"구분선",hrDesc:"구분선을 삽입",codeBlock:"코드 블록",codeBlockDesc:"코드 블록을 삽입",video:"동영상",videoDesc:"유튜브 동영상을 삽입",equation:"수학 공식",equationDesc:"TeX 수식을 삽입",image:"이미지",imageDesc:"이미지를 업로드",file:"파일",fileDesc:"파일을 업로드"},link:{newLink:"새 링크",url:"링크 URL",title:"링크 텍스트",copy:"클립보드에 복사",open:"링크 열기",save:"확인",unlink:"링크 제거"},image:{view:"큰 이미지 보기",remove:"삭제",previous:"이전 이미지",next:"다음 이미지",close:"닫기 (Esc)",loadingError:"이미지를 로드할 수 없습니다",zoomOut:"축소",zoomIn:"확대"},file:{download:"다운로드",remove:"삭제"},video:{embed:"동영상 삽입",remove:"삭제",description:"아래 입력란에 YouTube 링크를 붙여넣으세요.",url:"링크",urlError:"유효한 링크를 입력하세요."},codeBlock:{langType:"코드언어 선택"},equation:{save:"확인",help:"지원되는 기능",placeholder:"TeX 수식을 입력하세요"}}},Pe=Object.keys(Me),De={},Ze={},Oe=e=>{De[e]||(De[e]=Me[e],(e=>{Ze[e]={}})(e))},Ne=e=>function(e,t,i={}){return Ie(t,Ee(e,i))}(e,De[e],Ze[e]);Pe.forEach(Oe);class ze{constructor(e){this.documentClickListener=e=>{const t=new T(e.target),i=this.node.find(".lake-dropdown-title");t.closest(".lake-dropdown-title").get(0)!==i.get(0)&&this.hideMenu()},this.config=e,this.root=e.root,this.locale=e.locale||Ne("en-US");const t=e.placement||"bottom";if(this.node=I(a`
|
|
3
|
+
`),e.type&&this.node.addClass(`lake-${e.type}-button`),void 0!==e.tabIndex&&this.node.attr("tabindex",e.tabIndex.toString())}render(){const e=this.config,t=this.node;t.addClass(`lake-${e.text?"text":"icon"}-button`),e.tooltip&&t.attr("title",e.tooltip),e.icon&&t.append(e.icon),e.text&&t.append(`<span>${e.text}</span>`),this.root.append(t),t.on("mouseenter",(()=>{t.attr("disabled")||t.hasClass("lake-button-selected")||t.addClass("lake-button-hovered")})),t.on("mouseleave",(()=>{t.attr("disabled")||t.removeClass("lake-button-hovered")})),t.on("click",(t=>{t.preventDefault(),e.onClick()}))}}const ke=/^\{.*\}$/,Ce=/(\{(?:[^{}]+|\{(?:[^{}]+)*\})*\})/g,Se=e=>e.substring(1,e.length-1),Be=(e,t=!0,i="",n="")=>e.split(Ce).map((e=>{if(!e.match(Ce))return e;const t=Se(e);if(t.startsWith("{"))return((e,t)=>{let[i,n]=e.split(":");n||(n=i,i=t);const s=n.split("|"),[o,r,a,l,c,d]=s,h=s.filter((e=>void 0!==e)).length;return 1===h?{k:i,r:o}:2===h?{k:i,o:o,r:r}:3===h?{k:i,z:o,o:r,r:a}:{k:i,z:o,o:r,t:a,f:l,m:c,r:d}})(Se(t),n);const s=(e=>{const[t="",...i]=e.split("|"),[n="",s]=t.split(":"),[o,r]=n.split("?");return{k:o,i:s,n:""===r,f:i}})(t);return n=s.k||n,!i&&(i=n),s})).map((e=>{if("string"==typeof e)return e;e.k||(e.k=i||"0");const n=(e=>Object.fromEntries(Object.keys(e).map((t=>{const i=e[t];return[t,Array.isArray(i)?i.map((e=>null==e?void 0:e.trim())):i===!!i?i:null==i?void 0:i.trim()]}))))(e);return t?(s=n,Object.fromEntries(Object.entries(s).map((([e,t])=>"i"!==e&&t&&"0"!=t&&[e,t])).filter(Boolean))):n;var s})),_e=(e,t,i)=>t.reduce(((t,i)=>{var n,s,o;return null!==(s=i.match(ke)?(e=>{var i;return null!==(i=e[t])&&void 0!==i?i:e["*"]})((o=i,Object.fromEntries(Se(o).split(",").map((e=>e.split(":"))).reduce(((e,t)=>2===t.length?[...e,t.map((e=>e.trim()))]:(e[e.length-1][1]+=","+t[0],e)),[])))):null===(n=e[i])||void 0===n?void 0:n.call(e,t))&&void 0!==s?s:t}),i),Ae=/\?\?/g,Le=(e,t,i,n)=>{const s=n[0],o=s&&"object"==typeof s&&s.constructor===Object;return((e,t,i,n)=>e.map((e=>{if("string"==typeof e)return e;const{k:s="0",f:o=[]}=e,r=n[s];if((e=>!(!e.o&&!e.r))(e))return(("boolean"==typeof r?r?e.o:e.r:((e,{z:t,o:i,t:n,f:s,m:o,r:r},a)=>{switch(t&&0==a?"zero":e.select(a)){case"zero":return t;case"one":return i;case"two":return n;case"few":return null!=s?s:r;case"many":return null!=o?o:r;default:return r}})(t,e,r))||"").replace(Ae,r);const a=o.length?_e(i,o,r):r;return(""+(null!=a?a:"")).trim()})).join(""))(e,t,i,1===n.length&&o?s:n)},Ee=(e,t)=>{const i={},n=new Intl.PluralRules(e);return(e,...s)=>Le(((e,t)=>e[t]||(e[t]=Be(t)))(i,e),n,t,s)};const Te=(e={},t)=>"string"==typeof e?t.bind(null,e):Object.assign(Object.defineProperty((()=>""),"name",{writable:!0}),e),Ie=(e,t)=>new Proxy(Te(e,t),{get:(e,i)=>i===Symbol.iterator?[][Symbol.iterator].bind(Object.values(e).map((e=>Te(e,t)))):Ie(e[i],t)});const Me={"en-US":{toolbar:{undo:`Undo (${v("mod+Z")})`,redo:`Redo (${v("mod+Y")})`,selectAll:`Select all (${v("mod+A")})`,paragraph:"Paragraph",blockQuote:"Block quotation",numberedList:"Numbered list",bulletedList:"Bulleted list",checklist:"Checklist",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Align justify",increaseIndent:"Increase indent",decreaseIndent:"Decrease indent",bold:`Bold (${v("mod+B")})`,italic:`Italic (${v("mod+I")})`,underline:`Underline (${v("mod+U")})`,strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",code:"Inline code",removeFormat:"Remove format",formatPainter:"Format painter",link:"Link",hr:"Horizontal line",video:"Video",codeBlock:"Code block",heading:"Heading",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",list:"List",align:"Alignment",indent:"Indent",fontFamily:"Font family",fontSize:"Font size",moreStyle:"More style",fontColor:"Font color",highlight:"Highlight",image:"Image",file:"File",emoji:"Emoji",equation:"Mathematical formula",removeColor:"Remove color"},slash:{heading1:"Heading 1",heading1Desc:"Create a heading level 1",heading2:"Heading 2",heading2Desc:"Create a heading level 2",heading3:"Heading 3",heading3Desc:"Create a heading level 3",heading4:"Heading 4",heading4Desc:"Create a heading level 4",heading5:"Heading 5",heading5Desc:"Create a heading level 5",heading6:"Heading 6",heading6Desc:"Create a heading level 6",paragraph:"Paragraph",paragraphDesc:"Create a paragraph",blockQuote:"Block quotation",blockQuoteDesc:"Create a block quotation",numberedList:"Numbered list",numberedListDesc:"Create a numbered list",bulletedList:"Bulleted list",bulletedListDesc:"Create a bulleted list",checklist:"Checklist",checklistDesc:"Create a checklist",hr:"Horizontal line",hrDesc:"Insert a horizontal line",codeBlock:"Code block",codeBlockDesc:"Insert a code block",video:"Video",videoDesc:"Insert a video from YouTube",equation:"Mathematical formula",equationDesc:"Insert a TeX expression",image:"Image",imageDesc:"Upload an image",file:"File",fileDesc:"Upload a file"},link:{newLink:"New link",url:"Link URL",title:"Link title",copy:"Copy link to clipboard",open:"Open link in new tab",save:"Save",unlink:"Remove link"},image:{view:"Full screen",remove:"Delete",previous:"Previous",next:"Next",close:"Close (Esc)",loadingError:"The image cannot be loaded",zoomOut:"Zoom out",zoomIn:"Zoom in"},file:{download:"Download",remove:"Delete"},video:{embed:"Embed video",remove:"Delete",description:"Paste a link to embed a video from YouTube.",url:"Link",urlError:"Please enter a valid link."},codeBlock:{langType:"Select language"},equation:{save:"Done",help:"Supported functions",placeholder:"Type a TeX expression"}},"zh-CN":{toolbar:{undo:`撤消 (${v("mod+Z")})`,redo:`重做 (${v("mod+Y")})`,selectAll:`全选 (${v("mod+A")})`,paragraph:"正文",blockQuote:"引用",numberedList:"编号",bulletedList:"项目符号",checklist:"任务列表",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignJustify:"两端对齐",increaseIndent:"增加缩进",decreaseIndent:"减少缩进",bold:`粗体 (${v("mod+B")})`,italic:`斜体 (${v("mod+I")})`,underline:`下划线 (${v("mod+U")})`,strikethrough:"删除线",superscript:"上标",subscript:"下标",code:"行内代码",removeFormat:"清除格式",formatPainter:"格式刷",link:"链接",hr:"分割线",video:"视频",codeBlock:"代码块",heading:"标题",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3",heading4:"标题 4",heading5:"标题 5",heading6:"标题 6",list:"列表",align:"对齐方式",indent:"缩进",fontFamily:"字体",fontSize:"文字大小",moreStyle:"更多样式",fontColor:"文字颜色",highlight:"文字背景",image:"图片",file:"文件",emoji:"表情",equation:"数学公式",removeColor:"默认"},slash:{heading1:"标题 1",heading1Desc:"创建标题 1",heading2:"标题 2",heading2Desc:"创建标题 2",heading3:"标题 3",heading3Desc:"创建标题 3",heading4:"标题 4",heading4Desc:"创建标题 4",heading5:"标题 5",heading5Desc:"创建标题 5",heading6:"标题 6",heading6Desc:"创建标题 6",paragraph:"正文",paragraphDesc:"把当前段落改成正文",blockQuote:"引用",blockQuoteDesc:"创建引用",numberedList:"编号",numberedListDesc:"创建编号列表",bulletedList:"项目符号",bulletedListDesc:"创建项目符号列表",checklist:"任务列表",checklistDesc:"创建任务列表",hr:"分割线",hrDesc:"插入分割线",codeBlock:"代码块",codeBlockDesc:"插入代码块",video:"视频",videoDesc:"插入 YouTube 视频",equation:"数学公式",equationDesc:"支持 TeX 语法",image:"图片",imageDesc:"上传图片",file:"文件",fileDesc:"上传文件"},link:{newLink:"新链接",url:"链接 URL",title:"链接文本",copy:"复制到剪贴板",open:"打开链接",save:"确定",unlink:"取消链接"},image:{view:"查看大图",remove:"删除",previous:"上一张",next:"下一张",close:"关闭 (Esc)",loadingError:"图片加载失败",zoomOut:"缩小",zoomIn:"放大"},file:{download:"下载",remove:"删除"},video:{embed:"嵌入视频",remove:"删除",description:"在下面的输入框里,粘贴 YouTube 链接。",url:"链接",urlError:"请输入有效的链接。"},codeBlock:{langType:"选择代码语言"},equation:{save:"确定",help:"支持的功能",placeholder:"请输入 TeX 表达式"}},ja:{toolbar:{undo:`元に戻す (${v("mod+Z")})`,redo:`やり直し (${v("mod+Y")})`,selectAll:`すべて選択 (${v("mod+A")})`,paragraph:"テキスト",blockQuote:"引用ブロック",numberedList:"番号付きリスト",bulletedList:"箇条書きリスト",checklist:"タスクリスト",alignLeft:"左揃え",alignCenter:"中心揃え",alignRight:"右揃え",alignJustify:"左右に並べ替え",increaseIndent:"インデントを増やす",decreaseIndent:"インデントを減らす",bold:`太字 (${v("mod+B")})`,italic:`斜体 (${v("mod+I")})`,underline:`下線 (${v("mod+U")})`,strikethrough:"取り消し線",superscript:"上付き文字",subscript:"下付き文字",code:"インラインコード",removeFormat:"形式を削除",formatPainter:"形式ペインタ",link:"リンク",hr:"区切り線",video:"動画",codeBlock:"コードブロック",heading:"タイトル",heading1:"タイトル 1",heading2:"タイトル 2",heading3:"タイトル 3",heading4:"タイトル 4",heading5:"タイトル 5",heading6:"タイトル 6",list:"リスト",align:"文字揃え",indent:"インデント",fontFamily:"フォント",fontSize:"文字サイズ",moreStyle:"その他のスタイル",fontColor:"文字色",highlight:"文字の背景",image:"画像",file:"ファイル",emoji:"絵文字",equation:"数学公式",removeColor:"デフォルト"},slash:{heading1:"タイトル 1",heading1Desc:"レベル 1 のタイトルを作成",heading2:"タイトル 2",heading2Desc:"レベル 2 のタイトルを作成",heading3:"タイトル 3",heading3Desc:"レベル 3 のタイトルを作成",heading4:"タイトル 4",heading4Desc:"レベル 4 のタイトルを作成",heading5:"タイトル 5",heading5Desc:"レベル 5 のタイトルを作成",heading6:"タイトル 6",heading6Desc:"レベル 6 のタイトルを作成",paragraph:"テキスト",paragraphDesc:"段落を作成",blockQuote:"引用ブロック",blockQuoteDesc:"引用ブロックを作成",numberedList:"番号付きリスト",numberedListDesc:"番号付きリストを作成",bulletedList:"箇条書きリスト",bulletedListDesc:"箇条書きリストを作成",checklist:"タスクリスト",checklistDesc:"タスクリストを作成",hr:"区切り線",hrDesc:"水平線を挿入",codeBlock:"コードブロック",codeBlockDesc:"コードブロックを挿入",video:"動画",videoDesc:"YouTube から動画を挿入",equation:"数学公式",equationDesc:"TeX 数式を挿入",image:"画像",imageDesc:"画像をアップロード",file:"ファイル",fileDesc:"ファイルをアップロード"},link:{newLink:"新しいリンク",url:"リンク URL",title:"リンク文字",copy:"クリップボードにコピー",open:"リンクを開く",save:"確認",unlink:"リンクを削除"},image:{view:"大きな画像を見る",remove:"削除",previous:"前の画像",next:"次の画像",close:"閉じる (Esc)",loadingError:"画像を読み込めません",zoomOut:"縮小",zoomIn:"拡大"},file:{download:"ダウンロード",remove:"削除"},video:{embed:"動画を埋め込む",remove:"削除",description:"下の入力欄に YouTube リンクを貼り付けてください。",url:"リンク",urlError:"有効なリンクを入力してください。"},codeBlock:{langType:"コード言語を選択"},equation:{save:"確認",help:"サポートされている機能",placeholder:"TeX 数式を入力してください。"}},ko:{toolbar:{undo:`작업취소 (${v("mod+Z")})`,redo:`작업재개 (${v("mod+Y")})`,selectAll:`전체 선택 (${v("mod+A")})`,paragraph:"텍스트",blockQuote:"인용문",numberedList:"순서 목록",bulletedList:"비순서 목록",checklist:"체크리스트",alignLeft:"왼쪽 정렬",alignCenter:"가운데 정렬",alignRight:"오른쪽 정렬",alignJustify:"좌우로 정렬",increaseIndent:"들여쓰기 증가",decreaseIndent:"들여쓰기 줄이기",bold:`굵게 (${v("mod+B")})`,italic:`기울임꼴 (${v("mod+I")})`,underline:`밑줄 (${v("mod+U")})`,strikethrough:"취소선",superscript:"위첨자",subscript:"아래 첨자",code:"인라인 코드",removeFormat:"형식 지우기",formatPainter:"형식 페인터",link:"링크",hr:"구분선",video:"동영상",codeBlock:"코드 블록",heading:"제목",heading1:"제목 1",heading2:"제목 2",heading3:"제목 3",heading4:"제목 4",heading5:"제목 5",heading6:"제목 6",list:"목록",align:"정렬",indent:"들여쓰기",fontFamily:"글꼴",fontSize:"글자 크기",moreStyle:"더 많은 스타일",fontColor:"글자 색상",highlight:"글자 배경",image:"이미지",file:"파일",emoji:"이모지",equation:"수학 공식",removeColor:"기본색"},slash:{heading1:"제목 1",heading1Desc:"1 단계 제목을 작성",heading2:"제목 2",heading2Desc:"2 단계 제목을 작성",heading3:"제목 3",heading3Desc:"3 단계 제목을 작성",heading4:"제목 4",heading4Desc:"4 단계 제목을 작성",heading5:"제목 5",heading5Desc:"5 단계 제목을 작성",heading6:"제목 6",heading6Desc:"6 단계 제목을 작성",paragraph:"텍스트",paragraphDesc:"단락을 작성",blockQuote:"인용문",blockQuoteDesc:"인용문을 작성",numberedList:"순서 목록",numberedListDesc:"순서 목록을 작성",bulletedList:"비순서 목록",bulletedListDesc:"비순서 목록을 작성",checklist:"체크리스트",checklistDesc:"체크리스트를 작성",hr:"구분선",hrDesc:"구분선을 삽입",codeBlock:"코드 블록",codeBlockDesc:"코드 블록을 삽입",video:"동영상",videoDesc:"유튜브 동영상을 삽입",equation:"수학 공식",equationDesc:"TeX 수식을 삽입",image:"이미지",imageDesc:"이미지를 업로드",file:"파일",fileDesc:"파일을 업로드"},link:{newLink:"새 링크",url:"링크 URL",title:"링크 텍스트",copy:"클립보드에 복사",open:"링크 열기",save:"확인",unlink:"링크 제거"},image:{view:"큰 이미지 보기",remove:"삭제",previous:"이전 이미지",next:"다음 이미지",close:"닫기 (Esc)",loadingError:"이미지를 로드할 수 없습니다",zoomOut:"축소",zoomIn:"확대"},file:{download:"다운로드",remove:"삭제"},video:{embed:"동영상 삽입",remove:"삭제",description:"아래 입력란에 YouTube 링크를 붙여넣으세요.",url:"링크",urlError:"유효한 링크를 입력하세요."},codeBlock:{langType:"코드언어 선택"},equation:{save:"확인",help:"지원되는 기능",placeholder:"TeX 수식을 입력하세요"}}},Pe=Object.keys(Me),De={},Ze={},Oe=e=>{De[e]||(De[e]=Me[e],(e=>{Ze[e]={}})(e))},Ne=e=>function(e,t,i={}){return Ie(t,Ee(e,i))}(e,De[e],Ze[e]);Pe.forEach(Oe);class ze{constructor(e){this.documentClickListener=e=>{const t=new T(e.target),i=this.node.find(".lake-dropdown-title");t.closest(".lake-dropdown-title").get(0)!==i.get(0)&&this.hideMenu()},this.config=e,this.root=e.root,this.locale=e.locale||Ne("en-US");const t=e.placement||"bottom";if(this.node=I(a`
|
|
4
4
|
<div class="lake-dropdown lake-${e.menuType}-dropdown" name="${e.name}" placement="${t}">
|
|
5
5
|
<button type="button" name="${e.name}" class="lake-dropdown-title">
|
|
6
6
|
<div class="lake-dropdown-${e.icon?"icon":"text"}"></div>
|
|
@@ -15,7 +15,7 @@ var Lake=function(e){"use strict";class t extends HTMLElement{}void 0!==customEl
|
|
|
15
15
|
<span class="lake-box-strip"><br /></span>
|
|
16
16
|
<div class="lake-box-container" contenteditable="false"></div>
|
|
17
17
|
<span class="lake-box-strip"><br /></span>
|
|
18
|
-
`;class Ve{constructor(e){if(this.event=new we,"string"==typeof e){const t=ye.get(e);if(void 0===t)throw new Error(`Box "${e}" has not been defined yet.`);const i=r(t.type),n=r(t.name);this.node=I(a`<lake-box type="${i}" name="${n}"></lake-box>`),t.value&&(this.value=t.value)}else{this.node=I(e);const t=ye.get(this.name);if(void 0===t)throw new Error(`Box "${this.name}" has not been defined yet.`);t.value&&!this.node.hasAttr("value")&&(this.value=t.value)}}addFramework(){let e=this.getContainer();0===e.length?(this.node.html($e),e=this.getContainer()):(e.off("mouseenter"),e.off("mouseleave"),e.off("click")),e.on("mouseenter",(()=>{e.hasClass("lake-box-selected")||e.hasClass("lake-box-focused")||e.hasClass("lake-box-activated")||e.addClass("lake-box-hovered")})),e.on("mouseleave",(()=>{e.removeClass("lake-box-hovered")})),e.on("click",(()=>{A(`Box "${this.name}" (id = ${this.node.id}) value:`),A(this.value)})),"block"===this.type&&this.node.isContentEditable&&e.attr("draggable","true")}get type(){return this.node.attr("type")}get name(){return this.node.attr("name")}get value(){const e=this.node.attr("value");return""===e?{}:JSON.parse(h(e))}set value(e){this.node.attr("value",d(JSON.stringify(e)))}updateValue(e,t){const i=this.value;if("string"==typeof e)i[e]=t;else for(const t of Object.keys(e))i[t]=e[t];this.value=i}getEditor(){const e=this.node.closest("div[contenteditable]"),t=e.length>0?xe.get(e.id):void 0;if(!t)throw new Error(`Box "${this.name}" (id=${this.node.id}) is not rendered in the editor.`);return t}getContainer(){return this.node.find(".lake-box-container")}setToolbar(e){let t;try{t=this.getEditor()}catch(e){}let i=null;const n=()=>{i&&i.position()};this.event.on("focus",(()=>{i=new He({root:t?t.popupContainer:I(document.body),box:this,items:e,locale:t?t.locale:void 0}),i.render(),t&&t.root.on("scroll",n)})),this.event.on("blur",(()=>{i&&(i.unmount(),i=null),t&&t.root.off("scroll",n)}))}render(){const e=ye.get(this.name);if(void 0===e)return;this.event.emit("beforeunmount"),this.event.removeAllListeners(),this.addFramework();const t=e.render(this);if(void 0!==t){const e=this.getContainer();e.empty(),e.append(t)}A(`Box "${this.name}" (id: ${this.node.id}) rendered`)}unmount(){this.event.emit("blur"),this.event.emit("beforeunmount"),this.event.removeAllListeners(),this.node.empty(),A(`Box "${this.name}" (id: ${this.node.id}) unmounted`)}getHTML(){const e=ye.get(this.name);return void 0===e?"":void 0===e.html?this.node.outerHTML():e.html(this)}}function Fe(e){const t=ge(0);if("string"==typeof e){const i=new Ve(e);return t.set(i.node.id,i),i}const i=(e=I(e)).closestContainer();if(0===i.length){let i=t.get(e.id);return i||(i=new Ve(e),t.set(e.id,i),i)}const n=ge(i.id);let s=t.get(e.id);return s?(n.set(e.id,s),t.delete(e.id),s):(s=n.get(e.id),s||(s=new Ve(e),n.set(e.id,s),s))}function Re(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function je(e){const t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=t=>{t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress&&e.onProgress(t)});const i=new FormData,n=e.data||{};Object.keys(n).forEach((e=>{const t=n[e];Array.isArray(t)?t.forEach((t=>{i.append(`${e}[]`,t)})):i.append(e,t)}));const s=e.filename||"file";e.file instanceof Blob?i.append(s,e.file,e.file.name):i.append(s,e.file),t.onerror=t=>{e.onError&&e.onError(t)},t.onload=()=>{if(t.status<200||t.status>=300){if(!e.onError)return;return e.onError(function(e,t){const i=`Cannot ${e.method} ${e.action} ${t.status}'`,n=new Error(i);return n.status=t.status,n.method=e.method,n.url=e.action,n}(e,t),Re(t))}if(e.onSuccess)return e.onSuccess(Re(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const o=e.headers||{};return null!==o["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(o).forEach((e=>{null!==o[e]&&t.setRequestHeader(e,o[e])})),t.send(i),t}function qe(e){const{editor:t,name:i,file:n,onError:s,onSuccess:o}=e,{requestMethod:r,requestAction:a,requestTypes:l}=t.config[i];if(l.indexOf(n.type)<0)throw s&&s(`File "${n.name}" is not allowed for uploading.`),new Error(`Cannot upload file "${n.name}" because its type "${n.type}" is not found in ['${l.join("', '")}'].`);const c=t.selection.insertBox(i,{url:URL.createObjectURL(n),status:"uploading",name:n.name,size:n.size,type:n.type,lastModified:n.lastModified});let d=je({onProgress:e=>{const t=c.node.find(".lake-percent"),i=Math.round(e.percent);t.text(`${i<100?i:99} %`)},onError:(e,t)=>{d=null,A(e.toString(),t),c.updateValue("status","error"),c.render(),s&&s(e.toString())},onSuccess:e=>{if(d=null,!e.url)return c.updateValue("status","error"),c.render(),void(s&&s("Cannot find the url field."));c.updateValue({status:"done",url:e.url}),c.render(),t.history.save(),o&&o()},file:n,action:a,method:r});return c.event.on("beforeunmount",(()=>{d&&(d.abort(),A("Upload canceled"))})),c}var We=Object.freeze({__proto__:null,appendBreak:D,camelCase:l,changeTagName:V,debug:A,denormalizeValue:f,encode:r,fileSize:w,fixNumberedList:F,fromBase64:h,getBox:Fe,getCSS:y,getDeepElement:z,inString:c,mergeNodes:N,modifierText:v,morph:he,nodePosition:pe,normalizeValue:g,parseStyle:m,query:I,removeBreak:Z,removeZWS:$,request:je,safeTemplate:a,scrollToNode:ue,setBlockIndent:R,splitNodes:P,template:s,toBase64:d,toHex:u,toNodeList:x,uploadFile:qe,wrapNodeList:H});class Ue{constructor(e){this.fragment=null!=e?e:document.createDocumentFragment()}get(){return this.fragment}find(e){const t=[];let i=new T(this.fragment.firstChild);for(;i.length>0;)i.matches(e)?t.push(i.get(0)):i.isElement&&i.find(e).each((e=>{t.push(e)})),i=i.next();return new T(t)}append(e){I(e).each((e=>{this.fragment.appendChild(e)}))}}const Ke={id:/^[\w-]+$/,class:/^[\w- ]+$/,style:{"text-align":["left","center","right","justify","start","end"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function Ge(){return{h1:Object.assign({},Ke),h2:Object.assign({},Ke),h3:Object.assign({},Ke),h4:Object.assign({},Ke),h5:Object.assign({},Ke),h6:Object.assign({},Ke),p:Object.assign({},Ke),blockquote:Object.assign(Object.assign({},Ke),{type:["info","tip","success","warning","error","danger"]}),ul:Object.assign(Object.assign({},Ke),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},Ke),{start:/^\d+$/,indent:/^\d+$/}),li:{value:["true","false"]},table:{style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/}},tr:{style:{height:/^-?\d+(px|%)$/i}},th:"td",td:{colspan:/^\d+$/,rowspan:/^\d+$/,style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/,"text-align":["left","center","right","justify"]}},"lake-box":{type:["inline","block"],name:/^[\w-]+$/,value:/^[^"]+$/,focus:["start","center","end"]},br:{},hr:{},img:{src:/^[^"]+$/,width:/^-?\d+px$/i,height:/^-?\d+px$/i,"data-lake-value":/^[^"]+$/,alt:/^[^"]+$/,style:{width:/^-?\d+px$/i,height:/^-?\d+px$/i}},span:{class:/^[\w- ]+$/,style:{color:/^[^"]+$/,"background-color":/^[^"]+$/,"font-family":/^[^;]+$/,"font-size":/^[^"]+$/}},b:"strong",strong:{},em:"i",i:{},u:{},s:{},sub:{},sup:{},code:{},a:{class:/^[\w- ]+$/,name:/^[\w-]+$/,href:/^[^"]+$/,target:/^[\w-]+$/,rel:/^[^"]+$/,download:/^[^"]+$/},"lake-bookmark":{type:["anchor","focus"]}}}class Xe{constructor(e,t=Ge()){this.rules=t,this.source="string"==typeof e?this.parseHTML(e):e}parseHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");return new T(t.querySelector("body"))}static matchRule(e,t){return"string"==typeof e?e===t:Array.isArray(e)?e.indexOf(t)>=0:e instanceof RegExp&&e.test(t)}static getOpenTagString(e,t){let i=e.name,n=t[i];if(!n)return"";"string"==typeof n&&(i=n,n=t[i]);const s=e.get(0);if(!s.hasAttributes())return i;const o=new Map;for(const e of s.attributes)if(n[e.name]&&("style"!==e.name&&Xe.matchRule(n[e.name],e.value)&&o.set(e.name,e.value),"style"===e.name)){const t=n.style,i=new Map,s=m(e.value);for(const e of Object.keys(s)){const n=s[e];t[e]&&Xe.matchRule(t[e],n)&&i.set(e,n)}o.set("style",i)}let r=i;for(const[e,t]of o)if("style"===e){let e="";for(const[i,n]of t)e+=`${i}: ${n.replace(/"/g,""")}; `;""!==e&&(r+=` style="${e.trim()}"`)}else r+=` ${e}="${t}"`;return r}static getClosedTagString(e,t){let i=e.name;const n=t[i];return n?("string"==typeof n&&(i=n),i):""}static getTrimmedText(e){const t=e.parent(),i=e.prev(),n=e.next();let s=e.text();return(i.isBlock||i.isBlockBox)&&(n.isBlock||n.isBlockBox)||0===i.length&&0===n.length&&t.isBlock?s=s.replace(/^[\u0020\t\r\n]+|[\u0020\t\r\n]+$/g,""):i.isBlock||i.isBlockBox||0===i.length&&t.isBlock?s=s.replace(/^[\u0020\t\r\n]+/,""):(n.isBlock||n.isBlockBox||0===n.length&&t.isBlock)&&(s=s.replace(/[\u0020\t\r\n]+$/,"")),s}getHTML(){const e=this.rules;let t="";for(const i of function*t(i){let n=i.first();for(;n.length>0;){const i=n.next();if(n.isText)yield r(Xe.getTrimmedText(n));else if(n.isVoid){const t=Xe.getOpenTagString(n,e);""!==t&&(yield`<${t} />`)}else if(n.isElement){const i=Xe.getOpenTagString(n,e),s=Xe.getClosedTagString(n,e);""!==i&&(yield`<${i}>`),n.isBox||(yield*t(n)),""!==s&&(yield`</${s}>`)}n=i}}(this.source))t+=i;return t.trim()}getFragment(){const e=this.getHTML(),t=this.parseHTML(e),i=document.createDocumentFragment();let n=t.first();for(;n.length>0;){const e=n.next();i.appendChild(n.get(0)),n=e}return i}}class Qe{constructor(e){this.content=e}getHTML(){let e=this.content;return e=e.replace(/ {2}/g," "),e=r(e.trim()),e=`<p>${e}</p>`,e=e.replace(/(\r\n){2,}/g,"</p><p><br /></p><p>"),e=e.replace(/\r\n/g,"</p><p>"),e=e.replace(/[\r\n]{2,}/g,"</p><p><br /></p><p>"),e=e.replace(/[\r\n]/g,"</p><p>"),e}getFragment(){return new Xe(this.getHTML()).getFragment()}}function Ye(e,t){if(e.commonAncestor.isOutside)return;const i=(t=I(t)).get(0),n=e.get();n.insertNode(i),n.setEndAfter(i),n.collapse(!1)}function Je(e){if(e.commonAncestor.isOutside)return{anchor:new T,focus:new T};const t=e.startNode.closest("lake-box");if(t.length>0)return e.isBoxStart?t.attr("focus","start"):e.isBoxEnd?t.attr("focus","end"):t.attr("focus","center"),{anchor:new T,focus:t};if(e.isCollapsed){const t=e.clone();t.collapseToEnd();const i=I('<lake-bookmark type="focus" />');return Ye(t,i),{anchor:new T,focus:i}}const i=e.clone();i.collapseToStart();const n=I('<lake-bookmark type="anchor" />');Ye(i,n);const s=e.clone();s.collapseToEnd();const o=I('<lake-bookmark type="focus" />');return Ye(s,o),{anchor:n,focus:o}}function et(e,t){const i=e.prev(),n=e.next();if(i.isText||n.isText){const t=e.parent();e.remove(),t.get(0).normalize()}else if(0===i.length&&0===n.length){if(e.parent().isMark&&t){const i=new T(document.createTextNode(""));e.before(i),t.setStartAfter(i),t.collapseToStart()}e.remove()}else e.remove()}function tt(e,t){const i=t.anchor,n=t.focus;if(i.length>0&&0===n.length)et(i);else{if(n.length>0&&0===i.length){if(n.isBox){const t=Fe(n);0===t.getContainer().length&&t.render();const i=n.attr("focus");return"start"===i?e.selectBoxStart(n):"center"===i?e.selectBox(n):e.selectBoxEnd(n),void n.removeAttr("focus")}return e.setStartBefore(n),e.collapseToStart(),void et(n,e)}if(i.length>0&&n.length>0){const t=new M;t.selectNode(i),t.collapseToEnd(),-1===t.compareAfterNode(n)?(e.setStartBefore(n),et(n),e.setEndBefore(i),et(i)):(e.setStartBefore(i),et(i),e.setEndBefore(n),et(n))}}}function it(e){if(e.commonAncestor.isOutside)return;F(e.getBlocks())}function nt(e){if(e.isCollapsed)return;if(e.adjustBox(),e.adjustTable(),e.isInoperative)return;const t=e.startNode.closestBlock(),i=e.endNode.closestBlock(),n=t.get(0)===i.get(0);if(e.get().deleteContents(),e.adjustBlock(),n){const t=e.getBlocks()[0];if(t&&t.isEmpty){const i=D(t);e.setStartBefore(i),e.collapseToStart()}return}const s=e.getBlocks()[0];if(!s)return;const o=s.prev();if(0===o.length)return;const r=Je(e);N(o,s),tt(e,r),it(e)}function st(e,t){if(t instanceof Ue&&(t=t.get()),e.commonAncestor.isOutside)return;e.isCollapsed?e.adjustBox():nt(e);Z(e.startNode.closestBlock());const i=Je(e);i.focus.before(t),tt(e,i),e.adjustBlock()}function ot(e,t){if(e.commonAncestor.isOutside)return;if(e.isCollapsed){if(e.commonAncestor.closest("lake-box").isBlockBox)return}if("string"!=typeof t){const i=e.getBlocks();for(const e of i)e.css(t);return}const i=I(t),n=i.name,s=i.get(0).attributes,o=e.getBlocks();if(o.length>0){const t=Je(e);for(const e of o)if(e.name===n&&0===i.first().length)for(const t of s)e.attr(t.name,t.value);else{const t=i.clone(!0);t.isList&&e.isList&&""!==e.attr("indent")&&t.attr("indent",e.attr("indent"));const n=z(t);let s=e.first();for(;s.length>0;){const e=s.next();n.append(s),n.name!==s.name&&"li"!==s.name||s.remove(!0),s=e}e.replaceWith(t)}return tt(e,t),void it(e)}const r=Je(e),a=function(e){const t=e.commonAncestor.closest('div[contenteditable="true"],td');let i=[];if(0===t.length)return i;let n=t.first(),s=!0;for(;n.length>0;){if(n.isMark||n.isText||n.isBookmark||n.isInlineBox)i.push(n);else{if(!s)break;i=[]}e.intersectsNode(n)&&(s=!1),n=n.next()}return i}(e),l=H(a,i);if(tt(e,r),it(e),l.isEmpty){const t=D(l);e.setStartBefore(t),e.collapseToStart()}}function rt(e){if(e.commonAncestor.isOutside)return{start:null,end:null};e.isCollapsed?e.adjustBox():nt(e);const t=e.startNode,i=t.closestOperableBlock();if(0===i.length)return{start:null,end:null};let n=i.parent();n.isOutside&&(n=t.closestContainer());const s=P(t,e.startOffset,n);let o=null,r=null;return s&&(o=s.start,r=s.end),!s&&t.isBlock&&(e.startOffset>0&&(o=t.children()[e.startOffset-1]),r=t.children()[e.startOffset],r&&!r.isBlock&&(r=null)),o&&o.isEmpty&&D(o),r&&(r.isEmpty&&D(r),e.shrinkBefore(r)),it(e),{start:o,end:r}}function at(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function lt(e,t,i){let n=null,s=null,o=e.closestBlock();0===o.length&&(o=e.closestContainer());const r=P(e,t,o);return r&&(i?(at(r.start),at(r.end),r.start.isEmpty||(n=r.start),r.end.isEmpty||(s=r.end)):(n=r.start,s=r.end)),{start:n,end:s}}function ct(e,t=!0){if(e.commonAncestor.isOutside)return{start:null,center:null,end:null};if(e.adjustBox(),e.isCollapsed){const i=lt(e.startNode,e.startOffset,t);return i.start?(e.setStartAfter(i.start),e.collapseToStart()):i.end&&(e.setStartBefore(i.end),e.collapseToStart()),{start:i.start,center:null,end:i.end}}const i=lt(e.startNode,e.startOffset,t);i.start?e.setStartAfter(i.start):i.end&&e.setStartBefore(i.end);const n=lt(e.endNode,e.endOffset,t);return n.start?e.setEndAfter(n.start):n.end&&e.setEndBefore(n.end),{start:i.start,center:n.start,end:n.end}}function dt(e,t){const i=e.text();let n=e;for(;n.length>0;){const e=n.parent();if(!e.isMark||i!==e.text()||!n.isText&&n.name===t&&""!==n.attr("style"))break;n=e}return n}function ht(e,t){if(e.commonAncestor.isOutside)return;let i=I(t);const n=i.name,s=m(i.attr("style"));if(e.isCollapsed){if(e.isBox){const t=e.startNode.closest("lake-box");if("block"===Fe(t).type){const i=I("<p><br /></p>");e.isBoxStart?t.before(i):t.after(i),e.shrinkAfter(i)}else e.adjustBox()}Z(e.startNode.closestBlock());const t=new T(document.createTextNode("")),o=ct(e);if(o.start){const e=function(e){if(!e.isMark)return null;let t=e.clone(),i=e.last();for(;i.length>0;){if(i.isMark){const e=i.clone();t.append(e),t=e}i=i.last()}return t}(o.start);if(e)if(e.name===n)e.css(s),i=e;else{z(e).append(t),i.append(e)}}return""===i.text()&&i.append(t),Ye(e,i),function(e){const t=e.prev();t.length>0&&t.isText&&t.isEmpty&&t.remove();const i=e.next();i.length>0&&i.isText&&i.isEmpty&&i.remove()}(i),void e.shrinkAfter(i)}ct(e);const o=e.getMarks(!0),r=Je(e);for(const e of o)if(!e.isEmpty&&e.isText){const t=dt(e,n);if(t.isMark&&t.name===n)t.css(s);else{const e=i.clone();t.before(e),e.append(t)}}tt(e,r)}function pt(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function ut(e,t){if(e.commonAncestor.isOutside)return;let i;if(t){i=I(t).name}if(e.isCollapsed){if(e.isBox)return;if(i&&0===e.commonAncestor.closest(i).length)return;const t=ct(e,!1);if(!t.start)return;t.end&&pt(t.end);const n=new T(document.createTextNode("")),s=function(e,t){if(!e.isMark||!t)return null;let i=e.clone(),n=e.last();for(;n.length>0;){if(n.isMark&&n.name!==t){const e=n.clone();i.append(e),i=e}n=n.last()}if(i.name===t){if(!(i.first().length>0))return null;i=i.first()}return i}(t.start,i);if(!s)return t.start.after(n),pt(t.start),n.prev().isText?(e.setStartAfter(n.prev()),e.collapseToStart(),void n.remove()):(e.setStartAfter(n),void e.collapseToStart());return z(s).append(n),t.start.after(s),pt(t.start),void e.shrinkAfter(s)}ct(e);const n=e.getMarks(),s=Je(e);for(const e of n)if(!i||e.name===i){const t=e.parent();e.remove(!e.isEmpty),t.length>0&&t.get(0).normalize()}$(e.commonAncestor),tt(e,s)}function mt(e,t){if(e.commonAncestor.isOutside)return null;const i=I(t);if(e.isCollapsed){let t=e.commonAncestor.closest("a");if(0===t.length){t=i.clone(!0);return Z(e.startNode.closestBlock()),Ye(e,t),t}return""!==i.attr("href")&&t.attr({href:i.attr("href")}),t}ct(e);const n=Je(e);for(const t of e.commonAncestor.getWalker())"a"===t.name&&e.intersectsNode(t)&&t.remove(!0);const s=i.clone(!1);n.anchor.after(s);let o=s.next();for(;o.length>0;){const e=o.next();if(!o.isMark&&!o.isText)break;s.append(o),o=e}return 0===s.first().length&&s.remove(),tt(e,n),s}function gt(e,t,i){if(e.commonAncestor.isOutside)return null;const n=Fe(t);i&&(n.value=i);const s=document.createDocumentFragment();if(s.appendChild(n.node.get(0)),"inline"===n.type)return st(e,s),n.render(),e.selectBoxEnd(n.node),Fe(n.node);const o=rt(e);return o.start&&(e.setEndAfter(o.start),e.collapseToEnd()),o.end&&o.end.isEmpty&&o.end.remove(),st(e,s),n.render(),e.selectBoxEnd(n.node),o.start&&o.start.isEmpty&&o.start.remove(),Fe(n.node)}function ft(e){const t=e.node.closestContainer();if(e.unmount(),e.node.remove(),t.length>0){ge(t.id).delete(e.node.id);ge(0).set(e.node.id,e)}return e}function vt(e){if(e.commonAncestor.isOutside)return null;const t=e.commonAncestor.closest("lake-box");if(0===t.length)return null;const i=Fe(t);if("block"===i.type){const n=I("<p><br /></p>");return t.before(n),e.shrinkAfter(n),ft(i)}e.setStartBefore(t),e.collapseToStart();const n=t.parent();if(ft(i),n.isEmpty){const t=D(n);e.setStartBefore(t),e.collapseToStart()}return i}var wt={exports:{}};function yt(e,t=100,i={}){if("function"!=typeof e)throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw new RangeError("`wait` must not be negative.");const{immediate:n}="boolean"==typeof i?{immediate:i}:i;let s,o,r,a,l;function c(){const t=s,i=o;return s=void 0,o=void 0,l=e.apply(t,i),l}function d(){const e=Date.now()-a;e<t&&e>=0?r=setTimeout(d,t-e):(r=void 0,n||(l=c()))}const h=function(...e){if(s&&this!==s&&Object.getPrototypeOf(this)===Object.getPrototypeOf(s))throw new Error("Debounced method called with different contexts of the same prototype.");s=this,o=e,a=Date.now();const i=n&&!r;return r||(r=setTimeout(d,t)),i&&(l=c()),l};return h.clear=()=>{r&&(clearTimeout(r),r=void 0)},h.flush=()=>{r&&h.trigger()},h.trigger=()=>{l=c(),h.clear()},h}wt.exports.debounce=yt,wt.exports=yt;var xt=fe(wt.exports),bt=fe((function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var n,s,o;if(Array.isArray(t)){if((n=t.length)!=i.length)return!1;for(s=n;0!=s--;)if(!e(t[s],i[s]))return!1;return!0}if(t instanceof Map&&i instanceof Map){if(t.size!==i.size)return!1;for(s of t.entries())if(!i.has(s[0]))return!1;for(s of t.entries())if(!e(s[1],i.get(s[0])))return!1;return!0}if(t instanceof Set&&i instanceof Set){if(t.size!==i.size)return!1;for(s of t.entries())if(!i.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(i)){if((n=t.length)!=i.length)return!1;for(s=n;0!=s--;)if(t[s]!==i[s])return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(s=n;0!=s--;)if(!Object.prototype.hasOwnProperty.call(i,o[s]))return!1;for(s=n;0!=s--;){var r=o[s];if(!e(t[r],i[r]))return!1}return!0}return t!=t&&i!=i}));function kt(e){const t=e.get(0),i={};if(t.hasAttributes())for(const e of t.attributes)i[e.name]=e.value;return i}class Ct{constructor(e){const t=window.getSelection();if(!t)throw new Error("Selection object is null.");this.selection=t,this.container=e,this.range=this.getCurrentRange()}getCurrentRange(){if(this.selection.rangeCount>0){const e=this.selection.getRangeAt(0);return new M(e)}return new M}sync(){this.container.contains(this.range.commonAncestor)&&(this.selection.removeAllRanges(),this.selection.addRange(this.range.get()))}updateByRange(){const e=this.getCurrentRange();this.container.contains(e.commonAncestor)&&(this.range.startNode.get(0)===e.startNode.get(0)&&this.range.startOffset===e.startOffset&&this.range.endNode.get(0)===e.endNode.get(0)&&this.range.endOffset===e.endOffset||(this.range=e))}updateByBookmark(){const e=this.range,t=this.container,i=t.find("lake-box[focus]");if(i.length>0)return tt(e,{anchor:new T,focus:i}),void this.sync();tt(e,{anchor:t.find('lake-bookmark[type="anchor"]'),focus:t.find('lake-bookmark[type="focus"]')}),this.sync()}getAppliedItems(){const e=[];return function(e,t){let i=t.startNode;for(i.isText&&(i=i.parent());i.length>0&&i.isInside;)e.push({node:i,name:i.name,attributes:kt(i),styles:m(i.attr("style"))}),i=i.parent()}(e,this.range),function(e,t){const i=t.startNode;let n;if(i.isText&&i.text().length===t.startOffset){const e=i.next();e.length>0&&e.isElement&&(n=e)}if(i.isElement){const e=i.children();if(e.length>0){const i=e[t.startOffset];i&&i.isElement&&(n=i)}}if(n){let t=n;for(;t.length>0;)t.isElement&&e.push({node:t,name:t.name,attributes:kt(t),styles:m(t.attr("style"))}),t=t.first()}}(e,this.range),e}insertBookmark(){return Je(this.range)}toBookmark(e){return tt(this.range,e)}insertNode(e){return Ye(this.range,e)}insertFragment(e){return st(this.range,e)}deleteContents(){return nt(this.range)}setBlocks(e){return ot(this.range,e)}splitBlock(){return rt(this.range)}splitMarks(e){return ct(this.range,e)}addMark(e){return ht(this.range,e)}removeMark(e){return ut(this.range,e)}fixList(){return it(this.range)}insertLink(e){return mt(this.range,e)}selectBox(e){let t=e;t=e instanceof Ve?e.node:e,this.range.selectBox(t)}insertBox(e,t){const i=gt(this.range,e,t);if(!i)throw new Error(`Box "${e}" cannot be inserted outside the editor.`);return i}removeBox(e=null){return e&&this.selectBox(e),vt(this.range)}}class St{constructor(e){this.commandMap=new Map,this.selection=e}add(e,t){this.commandMap.set(e,t)}delete(e){this.commandMap.delete(e)}getNames(){return Array.from(this.commandMap.keys())}has(e){return void 0!==this.commandMap.get(e)}getItem(e){const t=this.commandMap.get(e);if(void 0===t)throw new Error(`Command "${e}" has not been defined yet.`);return t}isDisabled(e){const t=this.getItem(e);if(!t.isDisabled)return!1;const i=this.selection.getAppliedItems();return t.isDisabled(i)}isSelected(e){const t=this.getItem(e);if(!t.isSelected)return!1;const i=this.selection.getAppliedItems();return t.isSelected(i)}selectedValues(e){const t=this.getItem(e);if(!t.selectedValues)return[];const i=this.selection.getAppliedItems();return t.selectedValues(i)}execute(e,...t){const i=this.selection.container,n=this.selection.range;i.contains(n.commonAncestor)||n.shrinkAfter(i);this.getItem(e).execute.apply(this,t),A(`Command "${e}" executed`)}}class Bt{constructor(e){this.canSave=!0,this.list=[],this.index=0,this.limit=100,this.event=new we,this.selection=e,this.container=e.container}removeBookmark(e){return e.replace(/(<lake-box[^>]+)\s+focus="\w+"([^>]*>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"")}getValue(e){return new Xe(e).getHTML()}addIdToBoxes(e){e.find("lake-box").each((e=>{const t=new T(e),i=`${t.attr("name")}-${t.attr("value")}`;t.attr("id",i)}))}removeIdfromBoxes(e){e.find("lake-box").each((e=>{new T(e).removeAttr("id")}))}morphContainer(e){const t=this.container,i={beforeChildrenUpdated:e=>{if("lake-box"===new T(e).name)return!1},afterAttributeUpdated:(e,i)=>{const n=new T(i);if(["name","value"].indexOf(e)>=0&&"lake-box"===n.name){Fe(n).unmount();ge(t.id).delete(n.id)}}},n=e.clone(!0);this.addIdToBoxes(t),this.addIdToBoxes(n),he(t,n,{callbacks:i}),this.removeIdfromBoxes(t),this.removeIdfromBoxes(n)}get canUndo(){return this.index>1&&!!this.list[this.index-2]}get canRedo(){return!!this.list[this.index]}cloneContainer(){const e=this.selection.range,t=this.container.clone(!0);if(t.find("lake-box").each((e=>{Fe(e).getContainer().empty()})),!this.container.contains(e.commonAncestor))return t;if(e.isInsideBox){const i=e.commonAncestor.closest("lake-box").path(),n=t.find(i),s=e.clone();return s.selectBox(n),Je(s),t}const i=e.startNode.path(),n=e.endNode.path(),s=t.find(i),o=t.find(n),r=e.clone();return r.setStart(s,e.startOffset),r.setEnd(o,e.endOffset),Je(r),t}undo(){if(!this.list[this.index-2])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index>1;){const t=this.list[this.index-2];if(!t)break;this.index--;const i=this.getValue(t);if(this.removeBookmark(i)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("undo",i);break}}this.selection.updateByBookmark(),A(`History undone (index: ${this.index})`)}redo(){if(!this.list[this.index])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index<this.list.length;){const t=this.list[this.index];if(!t)break;this.index++;const i=this.getValue(t);if(this.removeBookmark(i)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("redo",i);break}}this.selection.updateByBookmark(),A(`History redone (index: ${this.index})`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(e={}){var t,i,n;const s=null!==(t=e.inputType)&&void 0!==t?t:"",o=null!==(i=e.update)&&void 0!==i&&i,r=null===(n=e.emitEvent)||void 0===n||n;if(!this.canSave)return;const a=this.cloneContainer(),l=this.getValue(a);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(l)||(o?this.list.splice(this.index-1,1/0,a):(this.list.splice(this.index,1/0,a),this.index++),this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),A(`History saved (index: ${this.index}, inputType: "${s}", update: ${o}, emitEvent: ${r})`),r&&this.event.emit("save",f(l),{inputType:s,update:o,emitEvent:r}))}}var _t={};Object.defineProperty(_t,"__esModule",{value:!0});for(var At="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Lt={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Et={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:At?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Tt={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},It=1;It<20;It++)Tt["f"+It]=111+It;function Mt(e,t,i){t&&!("byKey"in t)&&(i=t,t=null),Array.isArray(e)||(e=[e]);var n=e.map((function(e){return Pt(e,t)})),s=function(e){return n.some((function(t){return Dt(t,e)}))};return null==i?s:s(i)}function Pt(e,t){var i=t&&t.byKey,n={},s=(e=e.replace("++","+add")).split("+"),o=s.length;for(var r in Lt)n[Lt[r]]=!1;var a=!0,l=!1,c=void 0;try{for(var d,h=s[Symbol.iterator]();!(a=(d=h.next()).done);a=!0){var p=d.value,u=p.endsWith("?")&&p.length>1;u&&(p=p.slice(0,-1));var m=Ot(p),g=Lt[m];if(p.length>1&&!g&&!Et[p]&&!Tt[m])throw new TypeError('Unknown modifier: "'+p+'"');1!==o&&g||(i?n.key=m:n.which=Zt(p)),g&&(n[g]=!u||null)}}catch(e){l=!0,c=e}finally{try{!a&&h.return&&h.return()}finally{if(l)throw c}}return n}function Dt(e,t){for(var i in e){var n=e[i],s=void 0;if(null!=n&&((null!=(s="key"===i&&null!=t.key?t.key.toLowerCase():"which"===i?91===n&&93===t.which?91:t.which:t[i])||!1!==n)&&s!==n))return!1}return!0}function Zt(e){return e=Ot(e),Tt[e]||e.toUpperCase().charCodeAt(0)}function Ot(e){return e=e.toLowerCase(),e=Et[e]||e}_t.default=Mt,_t.isHotkey=Mt,_t.isCodeHotkey=function(e,t){return Mt(e,t)};var Nt=_t.isKeyHotkey=function(e,t){return Mt(e,{byKey:!0},t)};_t.parseHotkey=Pt,_t.compareHotkey=Dt,_t.toKeyCode=Zt,_t.toKeyName=Ot;class zt{constructor(e){this.keydownEventList=[],this.keyupEventList=[],this.container=e,this.container.on("keydown",(e=>{const t=e;if(!t.isComposing&&!t.defaultPrevented)for(const e of this.keydownEventList)if(Nt(e.type,t)&&!1===e.listener(t))break})),this.container.on("keyup",(e=>{const t=e;if(!t.isComposing&&!t.defaultPrevented)for(const e of this.keyupEventList)if(Nt(e.type,t)&&!1===e.listener(t))break}))}setKeydown(e,t){this.keydownEventList.push({type:e,listener:t})}setKeyup(e,t){this.keyupEventList.push({type:e,listener:t})}keydown(e){for(const t of this.keydownEventList)if(t.type===e&&!1===t.listener(new KeyboardEvent(e)))break}keyup(e){for(const t of this.keyupEventList)if(t.type===e&&!1===t.listener(new KeyboardEvent(e)))break}}const Ht={value:"<p><br /></p>",readonly:!1,spellcheck:!1,tabIndex:0,placeholder:"",indentWithTab:!0,lang:"en-US",minChangeSize:5,historySize:100,onMessage:(e,t)=>{"success"!==e?"warning"!==e?"error"===e&&console.error(t):console.warn(t):console.log(t)},slash:!1};class $t{constructor(e){if(this.unsavedInputData="",this.unsavedInputCount=0,this.state={appliedItems:[],disabledNameMap:new Map,selectedNameMap:new Map,selectedValuesMap:new Map},this.unmountPluginMap=new Map,this.isComposing=!1,this.event=new we,this.box=$t.box,this.copyListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("copy",e)},this.cutListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("cut",e)},this.pasteListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("paste",e)},this.selectionchangeListener=()=>{this.updateSelectionRange(),this.updateBoxSelectionStyle(),this.emitStateChangeEvent()},this.clickListener=e=>{const t=new T(e.target);t.get(0).isConnected&&this.event.emit("click",t)},this.resizeListener=()=>{this.event.emit("resize")},this.scrollListener=()=>{this.event.emit("scroll")},this.updateSelectionRange=xt((()=>{this.selection.updateByRange()}),1,{immediate:!0}),this.updateBoxSelectionStyle=xt((()=>{if(0===this.root.first().length)return;const e=this.selection.range,t=e.clone();t.adjustBox(),this.container.find("lake-box").each((i=>{const n=Fe(i),s=n.getContainer();if(0!==s.length){if(e.compareBeforeNode(s)<0&&e.compareAfterNode(s)>0&&(!e.isCollapsed||e.startNode.get(0)!==s.get(0)||0!==e.startOffset))return s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.removeClass("lake-box-focused"),s.addClass("lake-box-activated"),void n.event.emit("focus");if(t.intersectsNode(n.node))return s.removeClass("lake-box-activated"),void(e.isCollapsed?(s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.addClass("lake-box-focused"),n.event.emit("focus")):(s.removeClass("lake-box-focused"),s.addClass("lake-box-selected"),n.event.emit("blur")));s.removeClass("lake-box-activated"),s.removeClass("lake-box-focused"),s.removeClass("lake-box-selected"),n.event.emit("blur")}}))}),50,{immediate:!0}),this.emitStateChangeEvent=xt((()=>{const e=this.command.getNames();let t=this.selection.getAppliedItems();t.length>0&&!this.container.contains(t[0].node)&&(t=[]);const i=new Map,n=new Map,s=new Map;if(t.length>0)for(const o of e){const e=this.command.getItem(o);if(e.isDisabled&&e.isDisabled(t)&&i.set(o,!0),e.isSelected&&e.isSelected(t)&&n.set(o,!0),e.selectedValues){const i=e.selectedValues(t);i.length>0&&s.set(o,i)}}const o={appliedItems:t,disabledNameMap:i,selectedNameMap:n,selectedValuesMap:s};bt(o,this.state)||(this.toolbar&&this.toolbar.updateState(o),this.event.emit("statechange",o),this.state=o)}),50,{immediate:!1}),!e.root)throw new Error("The root of the config must be specified.");this.root=I(e.root),this.toolbar=e.toolbar,this.config=Object.assign({},Ht);for(const t of Object.keys(e))this.config[t]=e[t];this.containerWrapper=I('<div class="lake-container-wrapper" />'),this.container=I('<div class="lake-container" />'),this.overlayContainer=I('<div class="lake-overlay" />'),this.popupContainer=I('<div class="lake-popup lake-custom-properties" />'),this.readonly=this.config.readonly,this.root.addClass("lake-custom-properties"),this.container.attr({contenteditable:this.readonly?"false":"true",spellcheck:this.config.spellcheck?"true":"false",tabindex:this.config.tabIndex.toString()}),""!==this.config.placeholder&&this.container.attr("placeholder",this.config.placeholder),this.selection=new Ct(this.container),this.command=new St(this.selection),this.history=new Bt(this.selection),this.history.limit=this.config.historySize,this.keystroke=new zt(this.container),xe.set(this.container.id,this)}togglePlaceholderClass(e){const t="lake-placeholder";"<p><br /></p>"===(e=f(e)).replace("<focus />","")?this.container.addClass(t):this.container.removeClass(t)}moveBoxStripText(){const e=this.selection,t=e.range,i=t.startNode.closest(".lake-box-strip"),n=i.closest("lake-box");if("inline"===Fe(n).type)t.isBoxStart?(t.setStartBefore(n),t.collapseToStart()):(t.setStartAfter(n),t.collapseToStart());else{const e=I("<p />");t.isBoxStart?n.before(e):n.after(e),t.setStart(e,0),t.collapseToStart()}const s=i.text();i.html("<br />"),e.insertNode(document.createTextNode(s))}resetUnsavedInputData(){this.unsavedInputData="",this.unsavedInputCount=0}handleInputEvent(e){var t;this.selection.updateByRange();const i=this.selection.range;if(i.isInsideBox)return;if(i.isBoxStart||i.isBoxEnd)return this.moveBoxStripText(),void this.history.save();if("insertText"===(e instanceof CompositionEvent?"insertText":e.inputType)){const i=null!==(t=e.data)&&void 0!==t?t:"";return i.length>1?void this.history.save({inputType:"insertText",update:!1}):(this.unsavedInputData+=i,this.unsavedInputCount++,void(this.unsavedInputData.length<this.config.minChangeSize?this.history.save({inputType:"insertText",update:this.unsavedInputCount>1}):(this.history.save({inputType:"insertText",update:!0}),this.resetUnsavedInputData())))}this.history.save()}bindInputEvents(){this.container.on("compositionstart",(()=>{this.isComposing=!0,this.container.removeClass("lake-placeholder")})),this.container.on("compositionend",(e=>{this.isComposing=!1,this.handleInputEvent(e)})),this.container.on("input",(e=>{const t=e;this.isComposing=t.isComposing,this.isComposing||this.handleInputEvent(e)}))}bindHistoryEvents(){const e=e=>{this.fixContent()&&(this.history.save({update:!0,emitEvent:!1}),e=this.getValue()),this.emitStateChangeEvent(),this.togglePlaceholderClass(e),this.scrollToCaret(),this.event.emit("change",e)};this.history.event.on("undo",(t=>{this.renderBoxes(),e(t),this.resetUnsavedInputData()})),this.history.event.on("redo",(t=>{this.renderBoxes(),e(t),this.resetUnsavedInputData()})),this.history.event.on("save",((t,i)=>{this.removeBoxGarbage(),e(t),"insertText"!==i.inputType&&(this.selection.sync(),this.resetUnsavedInputData())}))}get hasFocus(){const e=document.activeElement;return!!e&&I(e).closest(".lake-container").get(0)===this.container.get(0)}get locale(){return Ne(this.config.lang)}fixContent(){const e=this.selection.range;let t=!1,i=this.container.children();for(const e of i)(e.isBlock||e.isMark)&&""===e.html()&&(e.remove(),t=!0,A(`Content fixed: empty tag "${e.name}" was removed`));if(i=this.container.children(),0===i.length)this.container.html("<p><br /></p>"),e.shrinkBefore(this.container),t=!0,A("Content fixed: default paragraph was added");else if(1===i.length){const n=i[0];if(n.isVoid){const i=I("<p />");n.before(i),i.append(n),e.shrinkAfter(i),t=!0,A(`Content fixed: void element "${n.name}" was wrapped in paragraph`)}}return e.adjustBr(),t}setPluginConfig(e,t){"object"!=typeof this.config[e]&&(this.config[e]={});for(const i of Object.keys(t))void 0===this.config[e][i]&&(this.config[e][i]=t[i])}removeBoxGarbage(){const e=ge(this.container.id);for(const t of e.values())t.node.get(0).isConnected||(t.unmount(),e.delete(t.node.id))}renderBoxes(){this.removeBoxGarbage();const e=this.container,t=ge(e.id);e.find("lake-box").each((e=>{const i=I(e);if(t.get(i.id))return;Fe(i).render()}))}focus(){this.container.focus()}blur(){this.container.blur()}scrollToCaret(){const e=this.selection.range;if(e.isBox)return;const t=e.getRect();if(0===t.x||0===t.y)return;const i=this.container.get(0).getBoundingClientRect(),n=I('<div class="lake-artificial-caret" />'),s=t.x-i.x,o=t.y-i.y;n.css({position:"absolute",top:`${o}px`,left:`${s}px`,width:`${t.width}px`,height:`${t.height}px`,"z-index":"-1"}),this.overlayContainer.find(".lake-artificial-caret").remove(),this.overlayContainer.append(n),ue(n,{behavior:"instant",block:"center",inline:"nearest"}),n.remove()}setValue(e){e=g(e);const t=new Xe(e),i=t.getFragment();this.container.empty(),this.togglePlaceholderClass(t.getHTML()),this.container.append(i),this.renderBoxes(),this.selection.updateByBookmark()}getValue(){const e=this.history.cloneContainer();let t=new Xe(e).getHTML();return t=f(t),t}render(){const e=g(this.config.value),t=new Xe(e),i=t.getFragment();this.root.empty(),this.root.append(this.containerWrapper),this.containerWrapper.append(this.container),this.containerWrapper.append(this.overlayContainer),I(document.body).append(this.popupContainer),this.togglePlaceholderClass(t.getHTML()),this.container.append(i),this.unmountPluginMap=$t.plugin.loadAll(this),this.readonly||(this.selection.updateByBookmark(),this.history.save({emitEvent:!1})),this.renderBoxes(),this.toolbar&&this.toolbar.render(this),this.root.on("scroll",this.scrollListener),document.addEventListener("copy",this.copyListener),window.addEventListener("resize",this.resizeListener),this.readonly||(document.addEventListener("cut",this.cutListener),document.addEventListener("paste",this.pasteListener),document.addEventListener("selectionchange",this.selectionchangeListener),document.addEventListener("click",this.clickListener),this.bindInputEvents(),this.bindHistoryEvents())}unmount(){this.updateSelectionRange.flush(),this.updateBoxSelectionStyle.flush(),this.emitStateChangeEvent.flush();for(const e of this.unmountPluginMap.keys()){const t=this.unmountPluginMap.get(e);t&&(t(),A(`Plugin "${e}" unmounted`))}this.toolbar&&this.toolbar.unmount(),this.removeBoxGarbage(),this.container.find("lake-box").each((e=>{Fe(I(e)).unmount()})),this.event.removeAllListeners(),this.history.event.removeAllListeners(),this.root.off(),this.root.removeClass("lake-custom-properties"),this.root.empty(),this.popupContainer.remove(),document.removeEventListener("copy",this.copyListener),window.removeEventListener("resize",this.resizeListener),this.readonly||(document.removeEventListener("cut",this.cutListener),document.removeEventListener("paste",this.pasteListener),document.removeEventListener("selectionchange",this.selectionchangeListener),document.removeEventListener("click",this.clickListener))}}$t.version="0.2.0",$t.box=new class{add(e){ye.set(e.name,e)}remove(e){ye.delete(e)}getNames(){return Array.from(ye.keys())}},$t.plugin=new class{constructor(){this.pluginMap=new Map}add(e,t){if(this.pluginMap.get(e))throw new Error(`Plugin "${e}" is already defined.`);this.pluginMap.set(e,t)}loadAll(e){const t=new Map;for(const i of this.pluginMap.keys()){const n=this.pluginMap.get(i);if(n&&!1!==e.config[i]){const s=n(e);s&&t.set(i,s)}}return t}};const Vt=[{icon:n.get("numberedList"),value:"numbered",text:e=>e.toolbar.numberedList()},{icon:n.get("bulletedList"),value:"bulleted",text:e=>e.toolbar.bulletedList()},{icon:n.get("checklist"),value:"checklist",text:e=>e.toolbar.checklist()}],Ft=[{icon:n.get("alignLeft"),value:"left",text:e=>e.toolbar.alignLeft()},{icon:n.get("alignCenter"),value:"center",text:e=>e.toolbar.alignCenter()},{icon:n.get("alignRight"),value:"right",text:e=>e.toolbar.alignRight()},{icon:n.get("alignJustify"),value:"justify",text:e=>e.toolbar.alignJustify()}],Rt=[{icon:n.get("increaseIndent"),value:"increase",text:e=>e.toolbar.increaseIndent()},{icon:n.get("decreaseIndent"),value:"decrease",text:e=>e.toolbar.decreaseIndent()}],jt=[{icon:n.get("italic"),value:"italic",text:e=>e.toolbar.italic()},{icon:n.get("underline"),value:"underline",text:e=>e.toolbar.underline()},{icon:n.get("strikethrough"),value:"strikethrough",text:e=>e.toolbar.strikethrough()},{icon:n.get("superscript"),value:"superscript",text:e=>e.toolbar.superscript()},{icon:n.get("subscript"),value:"subscript",text:e=>e.toolbar.subscript()},{icon:n.get("code"),value:"code",text:e=>e.toolbar.code()}],qt=["#f5222d","#fa541c","#fa8c16","#faad14","#fadb14","#a0d911","#52c41a","#13c2c2","#1677ff","#2f54eb","#722ed1","#eb2f96","#fff1f0","#fff2e8","#fff7e6","#fffbe6","#feffe6","#fcffe6","#f6ffed","#e6fffb","#e6f4ff","#f0f5ff","#f9f0ff","#fff0f6","#ffccc7","#ffd8bf","#ffe7ba","#fff1b8","#ffffb8","#f4ffb8","#d9f7be","#b5f5ec","#bae0ff","#d6e4ff","#efdbff","#ffd6e7","#ffa39e","#ffbb96","#ffd591","#ffe58f","#fffb8f","#eaff8f","#b7eb8f","#87e8de","#91caff","#adc6ff","#d3adf7","#ffadd2","#ff7875","#ff9c6e","#ffc069","#ffd666","#fff566","#d3f261","#95de64","#5cdbd3","#69b1ff","#85a5ff","#b37feb","#ff85c0","#ff4d4f","#ff7a45","#ffa940","#ffc53d","#ffec3d","#bae637","#73d13d","#36cfc9","#4096ff","#597ef7","#9254de","#f759ab","#cf1322","#d4380d","#d46b08","#d48806","#d4b106","#7cb305","#389e0d","#08979c","#0958d9","#1d39c4","#531dab","#c41d7f","#a8071a","#ad2102","#ad4e00","#ad6800","#ad8b00","#5b8c00","#237804","#006d75","#003eb3","#10239e","#391085","#9e1068","#820014","#871400","#873800","#874d00","#876800","#3f6600","#135200","#00474f","#002c8c","#061178","#22075e","#780650","#5c0011","#610b00","#612500","#613400","#614700","#254000","#092b00","#002329","#001d66","#030852","#120338","#520339","#000000","#1f1f1f","#262626","#434343","#595959","#8c8c8c","#bfbfbf","#d9d9d9","#f0f0f0","#f5f5f5","#fafafa","#ffffff"],Wt=[{icon:n.get("removeFormat"),value:"",text:e=>e.toolbar.removeColor()}];for(const e of qt)Wt.push({value:e.toLowerCase(),text:e.toUpperCase()});const Ut=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Kt=[{name:"undo",type:"button",icon:n.get("undo"),tooltip:e=>e.toolbar.undo(),onClick:(e,t)=>{e.command.execute(t)}},{name:"redo",type:"button",icon:n.get("redo"),tooltip:e=>e.toolbar.redo(),onClick:(e,t)=>{e.command.execute(t)}},{name:"selectAll",type:"button",icon:n.get("selectAll"),tooltip:e=>e.toolbar.selectAll(),onClick:(e,t)=>{e.command.execute(t)}},{name:"paragraph",type:"button",icon:n.get("paragraph"),tooltip:e=>e.toolbar.paragraph(),isSelected:e=>!!e.find((e=>"p"===e.name)),onClick:e=>{e.command.execute("heading","p")}},{name:"blockQuote",type:"button",icon:n.get("blockQuote"),tooltip:e=>e.toolbar.blockQuote(),onClick:(e,t)=>{e.command.execute(t)}},{name:"numberedList",type:"button",icon:n.get("numberedList"),tooltip:e=>e.toolbar.numberedList(),isSelected:e=>!!e.find((e=>"ol"===e.name)),onClick:e=>{e.command.execute("list","numbered")}},{name:"bulletedList",type:"button",icon:n.get("bulletedList"),tooltip:e=>e.toolbar.bulletedList(),isSelected:e=>!!e.find((e=>"ul"===e.name&&!e.node.hasAttr("type"))),onClick:e=>{e.command.execute("list","bulleted")}},{name:"checklist",type:"button",icon:n.get("checklist"),tooltip:e=>e.toolbar.checklist(),isSelected:e=>!!e.find((e=>"ul"===e.name&&"checklist"===e.node.attr("type"))),onClick:e=>{e.command.execute("list","checklist")}},{name:"alignLeft",type:"button",icon:n.get("alignLeft"),tooltip:e=>e.toolbar.alignLeft(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"left"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","left")}},{name:"alignCenter",type:"button",icon:n.get("alignCenter"),tooltip:e=>e.toolbar.alignCenter(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"center"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","center")}},{name:"alignRight",type:"button",icon:n.get("alignRight"),tooltip:e=>e.toolbar.alignRight(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"right"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","right")}},{name:"alignJustify",type:"button",icon:n.get("alignJustify"),tooltip:e=>e.toolbar.alignJustify(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"justify"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","justify")}},{name:"increaseIndent",type:"button",icon:n.get("increaseIndent"),tooltip:e=>e.toolbar.increaseIndent(),onClick:e=>{e.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:n.get("decreaseIndent"),tooltip:e=>e.toolbar.decreaseIndent(),onClick:e=>{e.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:n.get("bold"),tooltip:e=>e.toolbar.bold(),onClick:(e,t)=>{e.command.execute(t)}},{name:"italic",type:"button",icon:n.get("italic"),tooltip:e=>e.toolbar.italic(),onClick:(e,t)=>{e.command.execute(t)}},{name:"underline",type:"button",icon:n.get("underline"),tooltip:e=>e.toolbar.underline(),onClick:(e,t)=>{e.command.execute(t)}},{name:"strikethrough",type:"button",icon:n.get("strikethrough"),tooltip:e=>e.toolbar.strikethrough(),onClick:(e,t)=>{e.command.execute(t)}},{name:"superscript",type:"button",icon:n.get("superscript"),tooltip:e=>e.toolbar.superscript(),onClick:(e,t)=>{e.command.execute(t)}},{name:"subscript",type:"button",icon:n.get("subscript"),tooltip:e=>e.toolbar.subscript(),onClick:(e,t)=>{e.command.execute(t)}},{name:"code",type:"button",icon:n.get("code"),tooltip:e=>e.toolbar.code(),onClick:(e,t)=>{e.command.execute(t)}},{name:"removeFormat",type:"button",icon:n.get("removeFormat"),tooltip:e=>e.toolbar.removeFormat(),onClick:(e,t)=>{e.command.execute(t)}},{name:"formatPainter",type:"button",icon:n.get("formatPainter"),tooltip:e=>e.toolbar.formatPainter(),onClick:(e,t)=>{e.command.execute(t)}},{name:"link",type:"button",icon:n.get("link"),tooltip:e=>e.toolbar.link(),onClick:(e,t)=>{e.command.execute(t)}},{name:"hr",type:"button",icon:n.get("hr"),tooltip:e=>e.toolbar.hr(),onClick:(e,t)=>{e.command.execute(t)}},{name:"codeBlock",type:"button",icon:n.get("codeBlock"),tooltip:e=>e.toolbar.codeBlock(),onClick:(e,t)=>{e.command.execute(t)}},{name:"video",type:"button",icon:n.get("video"),tooltip:e=>e.toolbar.video(),onClick:(e,t)=>{e.command.execute(t)}},{name:"equation",type:"button",icon:n.get("equation"),tooltip:e=>e.toolbar.equation(),onClick:(e,t)=>{e.command.execute(t)}},{name:"heading",type:"dropdown",downIcon:n.get("down"),defaultValue:"p",tooltip:e=>e.toolbar.heading(),width:"100px",menuType:"list",menuItems:[{value:"h1",text:e=>`<span style="font-weight: bold; font-size: 26px;">${e.toolbar.heading1()}</span>`},{value:"h2",text:e=>`<span style="font-weight: bold; font-size: 24px;">${e.toolbar.heading2()}</span>`},{value:"h3",text:e=>`<span style="font-weight: bold; font-size: 22px;">${e.toolbar.heading3()}</span>`},{value:"h4",text:e=>`<span style="font-weight: bold; font-size: 20px;">${e.toolbar.heading4()}</span>`},{value:"h5",text:e=>`<span style="font-weight: bold; font-size: 18px;">${e.toolbar.heading5()}</span>`},{value:"h6",text:e=>`<span style="font-weight: bold; font-size: 16px;">${e.toolbar.heading6()}</span>`},{value:"p",text:e=>e.toolbar.paragraph()}],onSelect:(e,t)=>{e.command.execute("heading",t)}},{name:"list",type:"dropdown",downIcon:n.get("down"),icon:n.get("list"),tooltip:e=>e.toolbar.list(),menuType:"list",menuItems:Vt,onSelect:(e,t)=>{e.command.execute("list",t)}},{name:"align",type:"dropdown",downIcon:n.get("down"),icon:n.get("alignLeft"),tooltip:e=>e.toolbar.align(),menuType:"list",menuItems:Ft,onSelect:(e,t)=>{e.command.execute("align",t)}},{name:"indent",type:"dropdown",downIcon:n.get("down"),icon:n.get("increaseIndent"),tooltip:e=>e.toolbar.indent(),menuType:"list",menuItems:Rt,onSelect:(e,t)=>{e.command.execute("indent",t)}},{name:"fontFamily",type:"dropdown",downIcon:n.get("down"),defaultValue:"Segoe UI",tooltip:e=>e.toolbar.fontFamily(),width:"100px",menuType:"list",menuItems:[{value:"Arial",text:'<span style="font-family: Arial;">Arial</span>'},{value:"Arial Black",text:"<span style=\"font-family: 'Arial Black';\">Arial Black</span>"},{value:"Comic Sans MS",text:"<span style=\"font-family: 'Comic Sans MS';\">Comic Sans MS</span>"},{value:"Courier New",text:"<span style=\"font-family: 'Courier New';\">Courier New</span>"},{value:"Georgia",text:'<span style="font-family: Georgia;">Georgia</span>'},{value:"Helvetica",text:'<span style="font-family: Helvetica;">Helvetica</span>'},{value:"Impact",text:'<span style="font-family: Impact;">Impact</span>'},{value:"Segoe UI",text:"<span style=\"font-family: 'Segoe UI';\">Segoe UI</span>"},{value:"Tahoma",text:'<span style="font-family: Tahoma;">Tahoma</span>'},{value:"Times New Roman",text:"<span style=\"font-family: 'Times New Roman';\">Times New Roman</span>"},{value:"Trebuchet MS",text:"<span style=\"font-family: 'Trebuchet MS';\">Trebuchet MS</span>"},{value:"Verdana",text:'<span style="font-family: Verdana;">Verdana</span>'}],onSelect:(e,t)=>{e.command.execute("fontFamily",t)}},{name:"fontSize",type:"dropdown",downIcon:n.get("down"),defaultValue:"16px",tooltip:e=>e.toolbar.fontSize(),width:"65px",menuType:"list",menuItems:[{value:"12px",text:"12px"},{value:"14px",text:"14px"},{value:"16px",text:"16px"},{value:"18px",text:"18px"},{value:"22px",text:"22px"},{value:"24px",text:"24px"},{value:"32px",text:"32px"}],onSelect:(e,t)=>{e.command.execute("fontSize",t)}},{name:"moreStyle",type:"dropdown",icon:n.get("more"),tooltip:e=>e.toolbar.moreStyle(),menuType:"list",menuItems:jt,selectedValues:e=>{var t;const i=[];for(const n of e)if(n.node.isMark){const e=null!==(t=Ut.get(n.name))&&void 0!==t?t:n.name;i.push(e)}return i},onSelect:(e,t)=>{e.command.execute(t)}},{name:"fontColor",type:"dropdown",downIcon:n.get("down"),icon:n.get("fontColor"),accentIcon:n.get("fontColorAccent"),defaultValue:"#f5222d",tooltip:e=>e.toolbar.fontColor(),menuType:"color",menuItems:Wt,menuWidth:"296px",onSelect:(e,t)=>{e.command.execute("fontColor",t)}},{name:"highlight",type:"dropdown",downIcon:n.get("down"),icon:n.get("highlight"),accentIcon:n.get("highlightAccent"),defaultValue:"#fadb14",tooltip:e=>e.toolbar.highlight(),menuType:"color",menuItems:Wt,menuWidth:"296px",onSelect:(e,t)=>{e.command.execute("highlight",t)}},{name:"image",type:"upload",icon:n.get("image"),tooltip:e=>e.toolbar.image(),accept:"image/*",multiple:!0},{name:"file",type:"upload",icon:n.get("attachment"),tooltip:e=>e.toolbar.file(),accept:"*",multiple:!0}],Gt=["undo","redo","|","heading","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],Xt=new Map;for(const e of Kt)Xt.set(e.name,e);var Qt={type:"block",name:"hr",render:e=>{const t=e.getEditor(),i=e.getContainer(),n=I('<div class="lake-hr"><hr /></div>');i.empty(),i.append(n),n.on("click",(()=>{t.selection.selectBox(e)}))},html:()=>"<hr />"};const Yt="#57606a",Jt="#444d56",ei="#953800",ti="#0550ae",ii="#444d56",ni="#24292e",si="#005cc5",oi="#0550ae",ri="#444d56",ai="#444d56",li="#0a3069",ci="#0550ae",di="#0550ae",hi="#116329",pi="#0550ae",ui="#cf222e",mi="#24292f",gi="#cf222e",fi="#57606a",vi="#57606a",wi="#8250df",yi="#0550ae",xi="#f6f8fa",bi="#cf222e",ki="#0550ae",Ci="#005cc5",Si="#444d56",Bi="#444d56";function _i(e){const{HighlightStyle:t,tags:i}=e;return t.define([{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:Yt},{tag:[i.name],color:Jt},{tag:[i.variableName,i.self],color:ei},{tag:[i.typeName,i.tagName],color:ti},{tag:[i.propertyName,i.attributeName],color:ii},{tag:[i.className],color:ni},{tag:[i.labelName],color:si},{tag:[i.namespace],color:oi},{tag:[i.macroName],color:ri},{tag:[i.literal],color:ai},{tag:[i.string,i.docString,i.character,i.attributeValue,i.unit],color:li},{tag:[i.number,i.integer,i.float],color:ci},{tag:[i.bool,i.null,i.atom],color:di},{tag:[i.regexp,i.escape,i.url],color:hi},{tag:[i.color],color:pi},{tag:[i.keyword,i.operatorKeyword,i.controlKeyword,i.definitionKeyword,i.moduleKeyword],color:ui},{tag:[i.modifier],color:mi},{tag:[i.operator,i.derefOperator,i.arithmeticOperator,i.logicOperator,i.bitwiseOperator,i.compareOperator,i.updateOperator,i.definitionOperator,i.typeOperator,i.controlOperator],color:gi},{tag:[i.punctuation,i.separator,i.bracket,i.angleBracket,i.squareBracket,i.paren,i.brace,i.contentSeparator],color:fi},{tag:[i.content],color:vi},{tag:[i.meta,i.documentMeta,i.annotation,i.processingInstruction],color:wi},{tag:i.heading,fontWeight:"bold",color:yi},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.link,textDecoration:"underline"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:[i.invalid,i.inserted,i.deleted,i.changed],color:xi},{tag:[i.definition(i.name)],color:bi},{tag:[i.constant(i.name)],color:ki},{tag:[i.function(i.variableName)],color:Ci},{tag:[i.standard(i.name)],color:Si},{tag:[i.special(i.variableName)],color:Bi}])}var Ai={type:"block",name:"codeBlock",render:e=>{var t;const i=e.getEditor(),s=I('<div class="lake-code-block" />'),o=e.getContainer();o.css("width",i.container.innerWidth()-2+"px"),o.empty(),o.append(s);const r=s.get(0);if(!r)return;const a=window.LakeCodeMirror;if(!a)return i.readonly?void e.node.hide():(s.addClass("lake-code-block-error"),s.text('\n The code cannot be displayed because window.LakeCodeMirror is not found.\n Please check if the "lake-codemirror" library is added to this page.\n '.trim()),void s.on("click",(()=>{i.selection.selectBox(e)})));const{EditorState:l,Compartment:c,EditorView:d,keymap:h,history:p,defaultKeymap:u,historyKeymap:m,indentWithTab:g,syntaxHighlighting:f}=a,v=a.langItems,w=i.config.codeBlock,y=v.filter((e=>w.langList.indexOf(e.value)>=0)),x=new Map;for(const e of y)x.set(e.value,e);const b=e.value,k=x.get(b.lang),C=new c,S=xt((t=>{i.selection.updateByRange(),i.isComposing||(e.updateValue("code",t),i.history.save())}),1,{immediate:!1}),B=d.updateListener.of((e=>{e.docChanged&&S(e.state.doc.toString())})),_=new d({parent:r,doc:null!==(t=b.code)&&void 0!==t?t:"",extensions:[l.readOnly.of(i.readonly),d.editable.of(!i.readonly),p(),h.of([...u,...m,g]),f(_i(a)),C.of(k&&k.component?k.component():[]),B]});s.find('[contenteditable="true"]').attr("tabindex","-1");const L=new ze({root:s,name:"langType",downIcon:n.get("down"),defaultValue:k?b.lang:w.defaultLang,tooltip:i.locale.codeBlock.langType(),menuType:"list",menuHeight:"200px",menuItems:y.map((e=>({value:e.value,text:e.text}))),onSelect:t=>{e.updateValue({lang:t}),e.unmount(),e.render(),i.selection.selectBox(e),i.history.save()}});L.render();const E=()=>{o.css("width",i.container.innerWidth()-2+"px")};i.event.on("resize",E),s.on("click",(()=>{_.hasFocus||_.focus()})),e.event.on("beforeunmount",(()=>{L.unmount(),_.destroy(),i.event.off("resize",E),A("CodeMirror destroyed")}))}};function Li(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))}
|
|
18
|
+
`;class Ve{constructor(e){if(this.event=new we,"string"==typeof e){const t=ye.get(e);if(void 0===t)throw new Error(`Box "${e}" has not been defined yet.`);const i=r(t.type),n=r(t.name);this.node=I(a`<lake-box type="${i}" name="${n}"></lake-box>`),t.value&&(this.value=t.value)}else{this.node=I(e);const t=ye.get(this.name);if(void 0===t)throw new Error(`Box "${this.name}" has not been defined yet.`);t.value&&!this.node.hasAttr("value")&&(this.value=t.value)}}addFramework(){let e=this.getContainer();0===e.length?(this.node.html($e),e=this.getContainer()):(e.off("mouseenter"),e.off("mouseleave"),e.off("click")),e.on("mouseenter",(()=>{e.hasClass("lake-box-selected")||e.hasClass("lake-box-focused")||e.hasClass("lake-box-activated")||e.addClass("lake-box-hovered")})),e.on("mouseleave",(()=>{e.removeClass("lake-box-hovered")})),e.on("click",(()=>{A(`Box "${this.name}" (id = ${this.node.id}) value:`),A(this.value)})),"block"===this.type&&this.node.isContentEditable&&e.attr("draggable","true")}get type(){return this.node.attr("type")}get name(){return this.node.attr("name")}get value(){const e=this.node.attr("value");return""===e?{}:JSON.parse(h(e))}set value(e){this.node.attr("value",d(JSON.stringify(e)))}updateValue(e,t){const i=this.value;if("string"==typeof e)i[e]=t;else for(const t of Object.keys(e))i[t]=e[t];this.value=i}getEditor(){const e=this.node.closest("div[contenteditable]"),t=e.length>0?xe.get(e.id):void 0;if(!t)throw new Error(`Box "${this.name}" (id=${this.node.id}) is not rendered in the editor.`);return t}getContainer(){return this.node.find(".lake-box-container")}setToolbar(e){let t;try{t=this.getEditor()}catch(e){}let i=null;const n=()=>{i&&i.position()};this.event.on("focus",(()=>{i=new He({root:t?t.popupContainer:I(document.body),box:this,items:e,locale:t?t.locale:void 0}),i.render(),t&&t.root.on("scroll",n)})),this.event.on("blur",(()=>{i&&(i.unmount(),i=null),t&&t.root.off("scroll",n)}))}render(){const e=ye.get(this.name);if(void 0===e)return;this.event.emit("beforeunmount"),this.event.removeAllListeners(),this.addFramework();const t=e.render(this);if(void 0!==t){const e=this.getContainer();e.empty(),e.append(t)}A(`Box "${this.name}" (id: ${this.node.id}) rendered`)}unmount(){this.event.emit("blur"),this.event.emit("beforeunmount"),this.event.removeAllListeners(),this.node.empty(),A(`Box "${this.name}" (id: ${this.node.id}) unmounted`)}getHTML(){const e=ye.get(this.name);return void 0===e?"":void 0===e.html?this.node.outerHTML():e.html(this)}}function Fe(e){const t=ge(0);if("string"==typeof e){const i=new Ve(e);return t.set(i.node.id,i),i}const i=(e=I(e)).closestContainer();if(0===i.length){let i=t.get(e.id);return i||(i=new Ve(e),t.set(e.id,i),i)}const n=ge(i.id);let s=t.get(e.id);return s?(n.set(e.id,s),t.delete(e.id),s):(s=n.get(e.id),s||(s=new Ve(e),n.set(e.id,s),s))}function Re(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function je(e){const t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=t=>{t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress&&e.onProgress(t)});const i=new FormData,n=e.data||{};Object.keys(n).forEach((e=>{const t=n[e];Array.isArray(t)?t.forEach((t=>{i.append(`${e}[]`,t)})):i.append(e,t)}));const s=e.filename||"file";e.file instanceof Blob?i.append(s,e.file,e.file.name):i.append(s,e.file),t.onerror=t=>{e.onError&&e.onError(t)},t.onload=()=>{if(t.status<200||t.status>=300){if(!e.onError)return;return e.onError(function(e,t){const i=`Cannot ${e.method} ${e.action} ${t.status}'`,n=new Error(i);return n.status=t.status,n.method=e.method,n.url=e.action,n}(e,t),Re(t))}if(e.onSuccess)return e.onSuccess(Re(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const o=e.headers||{};return null!==o["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(o).forEach((e=>{null!==o[e]&&t.setRequestHeader(e,o[e])})),t.send(i),t}function qe(e){const{editor:t,name:i,file:n,onError:s,onSuccess:o}=e,{requestMethod:r,requestAction:a,requestTypes:l}=t.config[i];if(l.indexOf(n.type)<0)throw s&&s(`File "${n.name}" is not allowed for uploading.`),new Error(`Cannot upload file "${n.name}" because its type "${n.type}" is not found in ['${l.join("', '")}'].`);const c=t.selection.insertBox(i,{url:URL.createObjectURL(n),status:"uploading",name:n.name,size:n.size,type:n.type,lastModified:n.lastModified});let d=je({onProgress:e=>{const t=c.node.find(".lake-percent"),i=Math.round(e.percent);t.text(`${i<100?i:99} %`)},onError:(e,t)=>{d=null,A(e.toString(),t),c.updateValue("status","error"),c.render(),s&&s(e.toString())},onSuccess:e=>{if(d=null,!e.url)return c.updateValue("status","error"),c.render(),void(s&&s("Cannot find the url field."));c.updateValue({status:"done",url:e.url}),c.render(),t.history.save(),o&&o()},file:n,action:a,method:r});return c.event.on("beforeunmount",(()=>{d&&(d.abort(),A("Upload canceled"))})),c}var We=Object.freeze({__proto__:null,appendBreak:D,camelCase:l,changeTagName:V,debug:A,denormalizeValue:f,encode:r,fileSize:w,fixNumberedList:F,fromBase64:h,getBox:Fe,getCSS:y,getDeepElement:z,inString:c,mergeNodes:N,modifierText:v,morph:he,nodePosition:pe,normalizeValue:g,parseStyle:m,query:I,removeBreak:Z,removeZWS:$,request:je,safeTemplate:a,scrollToNode:ue,setBlockIndent:R,splitNodes:P,template:s,toBase64:d,toHex:u,toNodeList:x,uploadFile:qe,wrapNodeList:H});class Ue{constructor(e){this.fragment=null!=e?e:document.createDocumentFragment()}get(){return this.fragment}find(e){const t=[];let i=new T(this.fragment.firstChild);for(;i.length>0;)i.matches(e)?t.push(i.get(0)):i.isElement&&i.find(e).each((e=>{t.push(e)})),i=i.next();return new T(t)}append(e){I(e).each((e=>{this.fragment.appendChild(e)}))}}const Ke={id:/^[\w-]+$/,class:/^[\w- ]+$/,style:{"text-align":["left","center","right","justify","start","end"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function Ge(){return{h1:Object.assign({},Ke),h2:Object.assign({},Ke),h3:Object.assign({},Ke),h4:Object.assign({},Ke),h5:Object.assign({},Ke),h6:Object.assign({},Ke),p:Object.assign({},Ke),blockquote:Object.assign(Object.assign({},Ke),{type:["info","tip","success","warning","error","danger"]}),ul:Object.assign(Object.assign({},Ke),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},Ke),{start:/^\d+$/,indent:/^\d+$/}),li:{value:["true","false"]},table:{style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/}},tr:{style:{height:/^-?\d+(px|%)$/i}},th:"td",td:{colspan:/^\d+$/,rowspan:/^\d+$/,style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/,"text-align":["left","center","right","justify"]}},"lake-box":{type:["inline","block"],name:/^[\w-]+$/,value:/^[^"]+$/,focus:["start","center","end"]},br:{},hr:{},img:{src:/^[^"]+$/,width:/^-?\d+px$/i,height:/^-?\d+px$/i,"data-lake-value":/^[^"]+$/,alt:/^[^"]+$/,style:{width:/^-?\d+px$/i,height:/^-?\d+px$/i}},span:{class:/^[\w- ]+$/,style:{color:/^[^"]+$/,"background-color":/^[^"]+$/,"font-family":/^[^;]+$/,"font-size":/^[^"]+$/}},b:"strong",strong:{},em:"i",i:{},u:{},s:{},sub:{},sup:{},code:{},a:{class:/^[\w- ]+$/,name:/^[\w-]+$/,href:/^[^"]+$/,target:/^[\w-]+$/,rel:/^[^"]+$/,download:/^[^"]+$/},"lake-bookmark":{type:["anchor","focus"]}}}class Xe{constructor(e,t=Ge()){this.rules=t,this.source="string"==typeof e?this.parseHTML(e):e}parseHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");return new T(t.querySelector("body"))}static matchRule(e,t){return"string"==typeof e?e===t:Array.isArray(e)?e.indexOf(t)>=0:e instanceof RegExp&&e.test(t)}static getOpenTagString(e,t){let i=e.name,n=t[i];if(!n)return"";"string"==typeof n&&(i=n,n=t[i]);const s=e.get(0);if(!s.hasAttributes())return i;const o=new Map;for(const e of s.attributes)if(n[e.name]&&("style"!==e.name&&Xe.matchRule(n[e.name],e.value)&&o.set(e.name,e.value),"style"===e.name)){const t=n.style,i=new Map,s=m(e.value);for(const e of Object.keys(s)){const n=s[e];t[e]&&Xe.matchRule(t[e],n)&&i.set(e,n)}o.set("style",i)}let r=i;for(const[e,t]of o)if("style"===e){let e="";for(const[i,n]of t)e+=`${i}: ${n.replace(/"/g,""")}; `;""!==e&&(r+=` style="${e.trim()}"`)}else r+=` ${e}="${t}"`;return r}static getClosedTagString(e,t){let i=e.name;const n=t[i];return n?("string"==typeof n&&(i=n),i):""}static getTrimmedText(e){const t=e.parent(),i=e.prev(),n=e.next();let s=e.text();return(i.isBlock||i.isBlockBox)&&(n.isBlock||n.isBlockBox)||0===i.length&&0===n.length&&t.isBlock?s=s.replace(/^[\u0020\t\r\n]+|[\u0020\t\r\n]+$/g,""):i.isBlock||i.isBlockBox||0===i.length&&t.isBlock?s=s.replace(/^[\u0020\t\r\n]+/,""):(n.isBlock||n.isBlockBox||0===n.length&&t.isBlock)&&(s=s.replace(/[\u0020\t\r\n]+$/,"")),s}getHTML(){const e=this.rules;let t="";for(const i of function*t(i){let n=i.first();for(;n.length>0;){const i=n.next();if(n.isText)yield r(Xe.getTrimmedText(n));else if(n.isVoid){const t=Xe.getOpenTagString(n,e);""!==t&&(yield`<${t} />`)}else if(n.isElement){const i=Xe.getOpenTagString(n,e),s=Xe.getClosedTagString(n,e);""!==i&&(yield`<${i}>`),n.isBox||(yield*t(n)),""!==s&&(yield`</${s}>`)}n=i}}(this.source))t+=i;return t.trim()}getFragment(){const e=this.getHTML(),t=this.parseHTML(e),i=document.createDocumentFragment();let n=t.first();for(;n.length>0;){const e=n.next();i.appendChild(n.get(0)),n=e}return i}}class Qe{constructor(e){this.content=e}getHTML(){let e=this.content;return e=e.replace(/ {2}/g," "),e=r(e.trim()),e=`<p>${e}</p>`,e=e.replace(/(\r\n){2,}/g,"</p><p><br /></p><p>"),e=e.replace(/\r\n/g,"</p><p>"),e=e.replace(/[\r\n]{2,}/g,"</p><p><br /></p><p>"),e=e.replace(/[\r\n]/g,"</p><p>"),e}getFragment(){return new Xe(this.getHTML()).getFragment()}}function Ye(e,t){if(e.commonAncestor.isOutside)return;const i=(t=I(t)).get(0),n=e.get();n.insertNode(i),n.setEndAfter(i),n.collapse(!1)}function Je(e){if(e.commonAncestor.isOutside)return{anchor:new T,focus:new T};const t=e.startNode.closest("lake-box");if(t.length>0)return e.isBoxStart?t.attr("focus","start"):e.isBoxEnd?t.attr("focus","end"):t.attr("focus","center"),{anchor:new T,focus:t};if(e.isCollapsed){const t=e.clone();t.collapseToEnd();const i=I('<lake-bookmark type="focus" />');return Ye(t,i),{anchor:new T,focus:i}}const i=e.clone();i.collapseToStart();const n=I('<lake-bookmark type="anchor" />');Ye(i,n);const s=e.clone();s.collapseToEnd();const o=I('<lake-bookmark type="focus" />');return Ye(s,o),{anchor:n,focus:o}}function et(e,t){const i=e.prev(),n=e.next();if(i.isText||n.isText){const t=e.parent();e.remove(),t.get(0).normalize()}else if(0===i.length&&0===n.length){if(e.parent().isMark&&t){const i=new T(document.createTextNode(""));e.before(i),t.setStartAfter(i),t.collapseToStart()}e.remove()}else e.remove()}function tt(e,t){const i=t.anchor,n=t.focus;if(i.length>0&&0===n.length)et(i);else{if(n.length>0&&0===i.length){if(n.isBox){const t=Fe(n);0===t.getContainer().length&&t.render();const i=n.attr("focus");return"start"===i?e.selectBoxStart(n):"center"===i?e.selectBox(n):e.selectBoxEnd(n),void n.removeAttr("focus")}return e.setStartBefore(n),e.collapseToStart(),void et(n,e)}if(i.length>0&&n.length>0){const t=new M;t.selectNode(i),t.collapseToEnd(),-1===t.compareAfterNode(n)?(e.setStartBefore(n),et(n),e.setEndBefore(i),et(i)):(e.setStartBefore(i),et(i),e.setEndBefore(n),et(n))}}}function it(e){if(e.commonAncestor.isOutside)return;F(e.getBlocks())}function nt(e){if(e.isCollapsed)return;if(e.adjustBox(),e.adjustTable(),e.isInoperative)return;const t=e.startNode.closestBlock(),i=e.endNode.closestBlock(),n=t.get(0)===i.get(0);if(e.get().deleteContents(),e.adjustBlock(),n){const t=e.getBlocks()[0];if(t&&t.isEmpty){const i=D(t);e.setStartBefore(i),e.collapseToStart()}return}const s=e.getBlocks()[0];if(!s)return;const o=s.prev();if(0===o.length)return;const r=Je(e);N(o,s),tt(e,r),it(e)}function st(e,t){if(t instanceof Ue&&(t=t.get()),e.commonAncestor.isOutside)return;e.isCollapsed?e.adjustBox():nt(e);Z(e.startNode.closestBlock());const i=Je(e);i.focus.before(t),tt(e,i),e.adjustBlock()}function ot(e,t){if(e.commonAncestor.isOutside)return;if(e.isCollapsed){if(e.commonAncestor.closest("lake-box").isBlockBox)return}if("string"!=typeof t){const i=e.getBlocks();for(const e of i)e.css(t);return}const i=I(t),n=i.name,s=i.get(0).attributes,o=e.getBlocks();if(o.length>0){const t=Je(e);for(const e of o)if(e.name===n&&0===i.first().length)for(const t of s)e.attr(t.name,t.value);else{const t=i.clone(!0);t.isList&&e.isList&&""!==e.attr("indent")&&t.attr("indent",e.attr("indent"));const n=z(t);let s=e.first();for(;s.length>0;){const e=s.next();n.append(s),n.name!==s.name&&"li"!==s.name||s.remove(!0),s=e}e.replaceWith(t)}return tt(e,t),void it(e)}const r=Je(e),a=function(e){const t=e.commonAncestor.closest('div[contenteditable="true"],td');let i=[];if(0===t.length)return i;let n=t.first(),s=!0;for(;n.length>0;){if(n.isMark||n.isText||n.isBookmark||n.isInlineBox)i.push(n);else{if(!s)break;i=[]}e.intersectsNode(n)&&(s=!1),n=n.next()}return i}(e),l=H(a,i);if(tt(e,r),it(e),l.isEmpty){const t=D(l);e.setStartBefore(t),e.collapseToStart()}}function rt(e){if(e.commonAncestor.isOutside)return{start:null,end:null};e.isCollapsed?e.adjustBox():nt(e);const t=e.startNode,i=t.closestOperableBlock();if(0===i.length)return{start:null,end:null};let n=i.parent();n.isOutside&&(n=t.closestContainer());const s=P(t,e.startOffset,n);let o=null,r=null;return s&&(o=s.start,r=s.end),!s&&t.isBlock&&(e.startOffset>0&&(o=t.children()[e.startOffset-1]),r=t.children()[e.startOffset],r&&!r.isBlock&&(r=null)),o&&o.isEmpty&&D(o),r&&(r.isEmpty&&D(r),e.shrinkBefore(r)),it(e),{start:o,end:r}}function at(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function lt(e,t,i){let n=null,s=null,o=e.closestBlock();0===o.length&&(o=e.closestContainer());const r=P(e,t,o);return r&&(i?(at(r.start),at(r.end),r.start.isEmpty||(n=r.start),r.end.isEmpty||(s=r.end)):(n=r.start,s=r.end)),{start:n,end:s}}function ct(e,t=!0){if(e.commonAncestor.isOutside)return{start:null,center:null,end:null};if(e.adjustBox(),e.isCollapsed){const i=lt(e.startNode,e.startOffset,t);return i.start?(e.setStartAfter(i.start),e.collapseToStart()):i.end&&(e.setStartBefore(i.end),e.collapseToStart()),{start:i.start,center:null,end:i.end}}const i=lt(e.startNode,e.startOffset,t);i.start?e.setStartAfter(i.start):i.end&&e.setStartBefore(i.end);const n=lt(e.endNode,e.endOffset,t);return n.start?e.setEndAfter(n.start):n.end&&e.setEndBefore(n.end),{start:i.start,center:n.start,end:n.end}}function dt(e,t){const i=e.text();let n=e;for(;n.length>0;){const e=n.parent();if(!e.isMark||i!==e.text()||!n.isText&&n.name===t&&""!==n.attr("style"))break;n=e}return n}function ht(e,t){if(e.commonAncestor.isOutside)return;let i=I(t);const n=i.name,s=m(i.attr("style"));if(e.isCollapsed){if(e.isBox){const t=e.startNode.closest("lake-box");if("block"===Fe(t).type){const i=I("<p><br /></p>");e.isBoxStart?t.before(i):t.after(i),e.shrinkAfter(i)}else e.adjustBox()}Z(e.startNode.closestBlock());const t=new T(document.createTextNode("")),o=ct(e);if(o.start){const e=function(e){if(!e.isMark)return null;let t=e.clone(),i=e.last();for(;i.length>0;){if(i.isMark){const e=i.clone();t.append(e),t=e}i=i.last()}return t}(o.start);if(e)if(e.name===n)e.css(s),i=e;else{z(e).append(t),i.append(e)}}return""===i.text()&&i.append(t),Ye(e,i),function(e){const t=e.prev();t.length>0&&t.isText&&t.isEmpty&&t.remove();const i=e.next();i.length>0&&i.isText&&i.isEmpty&&i.remove()}(i),void e.shrinkAfter(i)}ct(e);const o=e.getMarks(!0),r=Je(e);for(const e of o)if(!e.isEmpty&&e.isText){const t=dt(e,n);if(t.isMark&&t.name===n)t.css(s);else{const e=i.clone();t.before(e),e.append(t)}}tt(e,r)}function pt(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function ut(e,t){if(e.commonAncestor.isOutside)return;let i;if(t){i=I(t).name}if(e.isCollapsed){if(e.isBox)return;if(i&&0===e.commonAncestor.closest(i).length)return;const t=ct(e,!1);if(!t.start)return;t.end&&pt(t.end);const n=new T(document.createTextNode("")),s=function(e,t){if(!e.isMark||!t)return null;let i=e.clone(),n=e.last();for(;n.length>0;){if(n.isMark&&n.name!==t){const e=n.clone();i.append(e),i=e}n=n.last()}if(i.name===t){if(!(i.first().length>0))return null;i=i.first()}return i}(t.start,i);if(!s)return t.start.after(n),pt(t.start),n.prev().isText?(e.setStartAfter(n.prev()),e.collapseToStart(),void n.remove()):(e.setStartAfter(n),void e.collapseToStart());return z(s).append(n),t.start.after(s),pt(t.start),void e.shrinkAfter(s)}ct(e);const n=e.getMarks(),s=Je(e);for(const e of n)if(!i||e.name===i){const t=e.parent();e.remove(!e.isEmpty),t.length>0&&t.get(0).normalize()}$(e.commonAncestor),tt(e,s)}function mt(e,t){if(e.commonAncestor.isOutside)return null;const i=I(t);if(e.isCollapsed){let t=e.commonAncestor.closest("a");if(0===t.length){t=i.clone(!0);return Z(e.startNode.closestBlock()),Ye(e,t),t}return""!==i.attr("href")&&t.attr({href:i.attr("href")}),t}ct(e);const n=Je(e);for(const t of e.commonAncestor.getWalker())"a"===t.name&&e.intersectsNode(t)&&t.remove(!0);const s=i.clone(!1);n.anchor.after(s);let o=s.next();for(;o.length>0;){const e=o.next();if(!o.isMark&&!o.isText)break;s.append(o),o=e}return 0===s.first().length&&s.remove(),tt(e,n),s}function gt(e,t,i){if(e.commonAncestor.isOutside)return null;const n=Fe(t);i&&(n.value=i);const s=document.createDocumentFragment();if(s.appendChild(n.node.get(0)),"inline"===n.type)return st(e,s),n.render(),e.selectBoxEnd(n.node),Fe(n.node);const o=rt(e);return o.start&&(e.setEndAfter(o.start),e.collapseToEnd()),o.end&&o.end.isEmpty&&o.end.remove(),st(e,s),n.render(),e.selectBoxEnd(n.node),o.start&&o.start.isEmpty&&o.start.remove(),Fe(n.node)}function ft(e){const t=e.node.closestContainer();if(e.unmount(),e.node.remove(),t.length>0){ge(t.id).delete(e.node.id);ge(0).set(e.node.id,e)}return e}function vt(e){if(e.commonAncestor.isOutside)return null;const t=e.commonAncestor.closest("lake-box");if(0===t.length)return null;const i=Fe(t);if("block"===i.type){const n=I("<p><br /></p>");return t.before(n),e.shrinkAfter(n),ft(i)}e.setStartBefore(t),e.collapseToStart();const n=t.parent();if(ft(i),n.isEmpty){const t=D(n);e.setStartBefore(t),e.collapseToStart()}return i}var wt={exports:{}};function yt(e,t=100,i={}){if("function"!=typeof e)throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw new RangeError("`wait` must not be negative.");const{immediate:n}="boolean"==typeof i?{immediate:i}:i;let s,o,r,a,l;function c(){const t=s,i=o;return s=void 0,o=void 0,l=e.apply(t,i),l}function d(){const e=Date.now()-a;e<t&&e>=0?r=setTimeout(d,t-e):(r=void 0,n||(l=c()))}const h=function(...e){if(s&&this!==s&&Object.getPrototypeOf(this)===Object.getPrototypeOf(s))throw new Error("Debounced method called with different contexts of the same prototype.");s=this,o=e,a=Date.now();const i=n&&!r;return r||(r=setTimeout(d,t)),i&&(l=c()),l};return h.clear=()=>{r&&(clearTimeout(r),r=void 0)},h.flush=()=>{r&&h.trigger()},h.trigger=()=>{l=c(),h.clear()},h}wt.exports.debounce=yt,wt.exports=yt;var xt=fe(wt.exports),bt=fe((function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var n,s,o;if(Array.isArray(t)){if((n=t.length)!=i.length)return!1;for(s=n;0!=s--;)if(!e(t[s],i[s]))return!1;return!0}if(t instanceof Map&&i instanceof Map){if(t.size!==i.size)return!1;for(s of t.entries())if(!i.has(s[0]))return!1;for(s of t.entries())if(!e(s[1],i.get(s[0])))return!1;return!0}if(t instanceof Set&&i instanceof Set){if(t.size!==i.size)return!1;for(s of t.entries())if(!i.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(i)){if((n=t.length)!=i.length)return!1;for(s=n;0!=s--;)if(t[s]!==i[s])return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(s=n;0!=s--;)if(!Object.prototype.hasOwnProperty.call(i,o[s]))return!1;for(s=n;0!=s--;){var r=o[s];if(!e(t[r],i[r]))return!1}return!0}return t!=t&&i!=i}));function kt(e){const t=e.get(0),i={};if(t.hasAttributes())for(const e of t.attributes)i[e.name]=e.value;return i}class Ct{constructor(e){const t=window.getSelection();if(!t)throw new Error("Selection object is null.");this.selection=t,this.container=e,this.range=this.getCurrentRange()}getCurrentRange(){if(this.selection.rangeCount>0){const e=this.selection.getRangeAt(0);return new M(e)}return new M}sync(){this.container.contains(this.range.commonAncestor)&&(this.selection.removeAllRanges(),this.selection.addRange(this.range.get()))}updateByRange(){const e=this.getCurrentRange();this.container.contains(e.commonAncestor)&&(this.range.startNode.get(0)===e.startNode.get(0)&&this.range.startOffset===e.startOffset&&this.range.endNode.get(0)===e.endNode.get(0)&&this.range.endOffset===e.endOffset||(this.range=e))}updateByBookmark(){const e=this.range,t=this.container,i=t.find("lake-box[focus]");if(i.length>0)return tt(e,{anchor:new T,focus:i}),void this.sync();tt(e,{anchor:t.find('lake-bookmark[type="anchor"]'),focus:t.find('lake-bookmark[type="focus"]')}),this.sync()}getAppliedItems(){const e=[];return function(e,t){let i=t.startNode;for(i.isText&&(i=i.parent());i.length>0&&i.isInside;)e.push({node:i,name:i.name,attributes:kt(i),styles:m(i.attr("style"))}),i=i.parent()}(e,this.range),function(e,t){const i=t.startNode;let n;if(i.isText&&i.text().length===t.startOffset){const e=i.next();e.length>0&&e.isElement&&(n=e)}if(i.isElement){const e=i.children();if(e.length>0){const i=e[t.startOffset];i&&i.isElement&&(n=i)}}if(n){let t=n;for(;t.length>0;)t.isElement&&e.push({node:t,name:t.name,attributes:kt(t),styles:m(t.attr("style"))}),t=t.first()}}(e,this.range),e}insertBookmark(){return Je(this.range)}toBookmark(e){return tt(this.range,e)}insertNode(e){return Ye(this.range,e)}insertFragment(e){return st(this.range,e)}deleteContents(){return nt(this.range)}setBlocks(e){return ot(this.range,e)}splitBlock(){return rt(this.range)}splitMarks(e){return ct(this.range,e)}addMark(e){return ht(this.range,e)}removeMark(e){return ut(this.range,e)}fixList(){return it(this.range)}insertLink(e){return mt(this.range,e)}selectBox(e){let t=e;t=e instanceof Ve?e.node:e,this.range.selectBox(t),this.sync()}insertBox(e,t){const i=gt(this.range,e,t);if(!i)throw new Error(`Box "${e}" cannot be inserted outside the editor.`);return i}removeBox(e=null){return e&&this.selectBox(e),vt(this.range)}}class St{constructor(e){this.commandMap=new Map,this.selection=e}add(e,t){this.commandMap.set(e,t)}delete(e){this.commandMap.delete(e)}getNames(){return Array.from(this.commandMap.keys())}has(e){return void 0!==this.commandMap.get(e)}getItem(e){const t=this.commandMap.get(e);if(void 0===t)throw new Error(`Command "${e}" has not been defined yet.`);return t}isDisabled(e){const t=this.getItem(e);if(!t.isDisabled)return!1;const i=this.selection.getAppliedItems();return t.isDisabled(i)}isSelected(e){const t=this.getItem(e);if(!t.isSelected)return!1;const i=this.selection.getAppliedItems();return t.isSelected(i)}selectedValues(e){const t=this.getItem(e);if(!t.selectedValues)return[];const i=this.selection.getAppliedItems();return t.selectedValues(i)}execute(e,...t){const i=this.selection.container,n=this.selection.range;i.contains(n.commonAncestor)||n.shrinkAfter(i);this.getItem(e).execute.apply(this,t),A(`Command "${e}" executed`)}}class Bt{constructor(e){this.canSave=!0,this.list=[],this.index=0,this.limit=100,this.event=new we,this.selection=e,this.container=e.container}removeBookmark(e){return e.replace(/(<lake-box[^>]+)\s+focus="\w+"([^>]*>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"")}getValue(e){return new Xe(e).getHTML()}addIdToBoxes(e){e.find("lake-box").each((e=>{const t=new T(e),i=`${t.attr("name")}-${t.attr("value")}`;t.attr("id",i)}))}removeIdfromBoxes(e){e.find("lake-box").each((e=>{new T(e).removeAttr("id")}))}morphContainer(e){const t=this.container,i={beforeChildrenUpdated:e=>{if("lake-box"===new T(e).name)return!1},afterAttributeUpdated:(e,i)=>{const n=new T(i);if(["name","value"].indexOf(e)>=0&&"lake-box"===n.name){Fe(n).unmount();ge(t.id).delete(n.id)}}},n=e.clone(!0);this.addIdToBoxes(t),this.addIdToBoxes(n),he(t,n,{callbacks:i}),this.removeIdfromBoxes(t),this.removeIdfromBoxes(n)}get canUndo(){return this.index>1&&!!this.list[this.index-2]}get canRedo(){return!!this.list[this.index]}cloneContainer(){const e=this.selection.range,t=this.container.clone(!0);if(t.find("lake-box").each((e=>{Fe(e).getContainer().empty()})),!this.container.contains(e.commonAncestor))return t;if(e.isInsideBox){const i=e.commonAncestor.closest("lake-box").path(),n=t.find(i),s=e.clone();return s.selectBox(n),Je(s),t}const i=e.startNode.path(),n=e.endNode.path(),s=t.find(i),o=t.find(n),r=e.clone();return r.setStart(s,e.startOffset),r.setEnd(o,e.endOffset),Je(r),t}undo(){if(!this.list[this.index-2])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index>1;){const t=this.list[this.index-2];if(!t)break;this.index--;const i=this.getValue(t);if(this.removeBookmark(i)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("undo",i);break}}this.selection.updateByBookmark(),A(`History undone (index: ${this.index})`)}redo(){if(!this.list[this.index])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index<this.list.length;){const t=this.list[this.index];if(!t)break;this.index++;const i=this.getValue(t);if(this.removeBookmark(i)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("redo",i);break}}this.selection.updateByBookmark(),A(`History redone (index: ${this.index})`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(e={}){var t,i,n;const s=null!==(t=e.inputType)&&void 0!==t?t:"",o=null!==(i=e.update)&&void 0!==i&&i,r=null===(n=e.emitEvent)||void 0===n||n;if(!this.canSave)return;const a=this.cloneContainer(),l=this.getValue(a);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(l)||(o?this.list.splice(this.index-1,1/0,a):(this.list.splice(this.index,1/0,a),this.index++),this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),A(`History saved (index: ${this.index}, inputType: "${s}", update: ${o}, emitEvent: ${r})`),r&&this.event.emit("save",f(l),{inputType:s,update:o,emitEvent:r}))}}var _t={};Object.defineProperty(_t,"__esModule",{value:!0});for(var At="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Lt={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Et={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:At?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Tt={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},It=1;It<20;It++)Tt["f"+It]=111+It;function Mt(e,t,i){t&&!("byKey"in t)&&(i=t,t=null),Array.isArray(e)||(e=[e]);var n=e.map((function(e){return Pt(e,t)})),s=function(e){return n.some((function(t){return Dt(t,e)}))};return null==i?s:s(i)}function Pt(e,t){var i=t&&t.byKey,n={},s=(e=e.replace("++","+add")).split("+"),o=s.length;for(var r in Lt)n[Lt[r]]=!1;var a=!0,l=!1,c=void 0;try{for(var d,h=s[Symbol.iterator]();!(a=(d=h.next()).done);a=!0){var p=d.value,u=p.endsWith("?")&&p.length>1;u&&(p=p.slice(0,-1));var m=Ot(p),g=Lt[m];if(p.length>1&&!g&&!Et[p]&&!Tt[m])throw new TypeError('Unknown modifier: "'+p+'"');1!==o&&g||(i?n.key=m:n.which=Zt(p)),g&&(n[g]=!u||null)}}catch(e){l=!0,c=e}finally{try{!a&&h.return&&h.return()}finally{if(l)throw c}}return n}function Dt(e,t){for(var i in e){var n=e[i],s=void 0;if(null!=n&&((null!=(s="key"===i&&null!=t.key?t.key.toLowerCase():"which"===i?91===n&&93===t.which?91:t.which:t[i])||!1!==n)&&s!==n))return!1}return!0}function Zt(e){return e=Ot(e),Tt[e]||e.toUpperCase().charCodeAt(0)}function Ot(e){return e=e.toLowerCase(),e=Et[e]||e}_t.default=Mt,_t.isHotkey=Mt,_t.isCodeHotkey=function(e,t){return Mt(e,t)};var Nt=_t.isKeyHotkey=function(e,t){return Mt(e,{byKey:!0},t)};_t.parseHotkey=Pt,_t.compareHotkey=Dt,_t.toKeyCode=Zt,_t.toKeyName=Ot;class zt{constructor(e){this.keydownEventList=[],this.keyupEventList=[],this.container=e,this.container.on("keydown",(e=>{const t=e;if(!t.isComposing&&!t.defaultPrevented)for(const e of this.keydownEventList)if(Nt(e.type,t)&&!1===e.listener(t))break})),this.container.on("keyup",(e=>{const t=e;if(!t.isComposing&&!t.defaultPrevented)for(const e of this.keyupEventList)if(Nt(e.type,t)&&!1===e.listener(t))break}))}setKeydown(e,t){this.keydownEventList.push({type:e,listener:t})}setKeyup(e,t){this.keyupEventList.push({type:e,listener:t})}keydown(e){for(const t of this.keydownEventList)if(t.type===e&&!1===t.listener(new KeyboardEvent(e)))break}keyup(e){for(const t of this.keyupEventList)if(t.type===e&&!1===t.listener(new KeyboardEvent(e)))break}}const Ht={value:"<p><br /></p>",readonly:!1,spellcheck:!1,tabIndex:0,placeholder:"",indentWithTab:!0,lang:"en-US",minChangeSize:5,historySize:100,onMessage:(e,t)=>{"success"!==e?"warning"!==e?"error"===e&&console.error(t):console.warn(t):console.log(t)},slash:!1};class $t{constructor(e){if(this.unsavedInputData="",this.unsavedInputCount=0,this.state={appliedItems:[],disabledNameMap:new Map,selectedNameMap:new Map,selectedValuesMap:new Map},this.unmountPluginMap=new Map,this.isComposing=!1,this.event=new we,this.box=$t.box,this.copyListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("copy",e)},this.cutListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("cut",e)},this.pasteListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("paste",e)},this.selectionchangeListener=()=>{this.updateSelectionRange(),this.updateBoxSelectionStyle(),this.emitStateChangeEvent()},this.clickListener=e=>{const t=new T(e.target);t.get(0).isConnected&&this.event.emit("click",t)},this.resizeListener=()=>{this.event.emit("resize")},this.scrollListener=()=>{this.event.emit("scroll")},this.updateSelectionRange=xt((()=>{this.selection.updateByRange()}),1,{immediate:!0}),this.updateBoxSelectionStyle=xt((()=>{if(0===this.root.first().length)return;const e=this.selection.getCurrentRange(),t=e.clone();t.adjustBox(),this.container.find("lake-box").each((i=>{const n=Fe(i),s=n.getContainer();if(0!==s.length){if(e.compareBeforeNode(s)<0&&e.compareAfterNode(s)>0&&(!e.isCollapsed||e.startNode.get(0)!==s.get(0)||0!==e.startOffset))return s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.removeClass("lake-box-focused"),s.addClass("lake-box-activated"),void n.event.emit("focus");if(t.intersectsNode(n.node))return s.removeClass("lake-box-activated"),void(e.isCollapsed?(s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.addClass("lake-box-focused"),n.event.emit("focus")):(s.removeClass("lake-box-focused"),s.addClass("lake-box-selected"),n.event.emit("blur")));s.removeClass("lake-box-activated"),s.removeClass("lake-box-focused"),s.removeClass("lake-box-selected"),n.event.emit("blur")}}))}),50,{immediate:!0}),this.emitStateChangeEvent=xt((()=>{const e=this.command.getNames();let t=this.selection.getAppliedItems();t.length>0&&!this.container.contains(t[0].node)&&(t=[]);const i=new Map,n=new Map,s=new Map;if(t.length>0)for(const o of e){const e=this.command.getItem(o);if(e.isDisabled&&e.isDisabled(t)&&i.set(o,!0),e.isSelected&&e.isSelected(t)&&n.set(o,!0),e.selectedValues){const i=e.selectedValues(t);i.length>0&&s.set(o,i)}}const o={appliedItems:t,disabledNameMap:i,selectedNameMap:n,selectedValuesMap:s};bt(o,this.state)||(this.toolbar&&this.toolbar.updateState(o),this.event.emit("statechange",o),this.state=o)}),50,{immediate:!1}),!e.root)throw new Error("The root of the config must be specified.");this.root=I(e.root),this.toolbar=e.toolbar,this.config=Object.assign({},Ht);for(const t of Object.keys(e))this.config[t]=e[t];this.containerWrapper=I('<div class="lake-container-wrapper" />'),this.container=I('<div class="lake-container" />'),this.overlayContainer=I('<div class="lake-overlay" />'),this.popupContainer=I('<div class="lake-popup lake-custom-properties" />'),this.readonly=this.config.readonly,this.root.addClass("lake-custom-properties"),this.container.attr({contenteditable:this.readonly?"false":"true",spellcheck:this.config.spellcheck?"true":"false",tabindex:this.config.tabIndex.toString()}),""!==this.config.placeholder&&this.container.attr("placeholder",this.config.placeholder),this.selection=new Ct(this.container),this.command=new St(this.selection),this.history=new Bt(this.selection),this.history.limit=this.config.historySize,this.keystroke=new zt(this.container),xe.set(this.container.id,this)}togglePlaceholderClass(e){const t="lake-placeholder";"<p><br /></p>"===(e=f(e)).replace("<focus />","")?this.container.addClass(t):this.container.removeClass(t)}moveBoxStripText(){const e=this.selection,t=e.range,i=t.startNode.closest(".lake-box-strip"),n=i.closest("lake-box");if("inline"===Fe(n).type)t.isBoxStart?(t.setStartBefore(n),t.collapseToStart()):(t.setStartAfter(n),t.collapseToStart());else{const e=I("<p />");t.isBoxStart?n.before(e):n.after(e),t.setStart(e,0),t.collapseToStart()}const s=i.text();i.html("<br />"),e.insertNode(document.createTextNode(s))}resetUnsavedInputData(){this.unsavedInputData="",this.unsavedInputCount=0}handleInputEvent(e){var t;this.selection.updateByRange();const i=this.selection.range;if(i.isInsideBox)return;if(i.isBoxStart||i.isBoxEnd)return this.moveBoxStripText(),void this.history.save();if("insertText"===(e instanceof CompositionEvent?"insertText":e.inputType)){const i=null!==(t=e.data)&&void 0!==t?t:"";return i.length>1?void this.history.save({inputType:"insertText",update:!1}):(this.unsavedInputData+=i,this.unsavedInputCount++,void(this.unsavedInputData.length<this.config.minChangeSize?this.history.save({inputType:"insertText",update:this.unsavedInputCount>1}):(this.history.save({inputType:"insertText",update:!0}),this.resetUnsavedInputData())))}this.history.save()}bindInputEvents(){this.container.on("compositionstart",(()=>{this.isComposing=!0,this.container.removeClass("lake-placeholder")})),this.container.on("compositionend",(e=>{this.isComposing=!1,this.handleInputEvent(e)})),this.container.on("input",(e=>{const t=e;this.isComposing=t.isComposing,this.isComposing||this.handleInputEvent(e)}))}bindHistoryEvents(){const e=e=>{this.fixContent()&&(this.history.save({update:!0,emitEvent:!1}),e=this.getValue()),this.emitStateChangeEvent(),this.togglePlaceholderClass(e),this.scrollToCaret(),this.event.emit("change",e)};this.history.event.on("undo",(t=>{this.renderBoxes(),e(t),this.resetUnsavedInputData()})),this.history.event.on("redo",(t=>{this.renderBoxes(),e(t),this.resetUnsavedInputData()})),this.history.event.on("save",((t,i)=>{this.removeBoxGarbage(),e(t),"insertText"!==i.inputType&&(this.selection.sync(),this.resetUnsavedInputData())}))}get hasFocus(){const e=document.activeElement;return!!e&&I(e).closest(".lake-container").get(0)===this.container.get(0)}get locale(){return Ne(this.config.lang)}fixContent(){const e=this.selection.range;let t=!1,i=this.container.children();for(const e of i)(e.isBlock||e.isMark)&&""===e.html()&&(e.remove(),t=!0,A(`Content fixed: empty tag "${e.name}" was removed`));if(i=this.container.children(),0===i.length)this.container.html("<p><br /></p>"),e.shrinkBefore(this.container),t=!0,A("Content fixed: default paragraph was added");else if(1===i.length){const n=i[0];if(n.isVoid){const i=I("<p />");n.before(i),i.append(n),e.shrinkAfter(i),t=!0,A(`Content fixed: void element "${n.name}" was wrapped in paragraph`)}}return e.adjustBr(),t}setPluginConfig(e,t){"object"!=typeof this.config[e]&&(this.config[e]={});for(const i of Object.keys(t))void 0===this.config[e][i]&&(this.config[e][i]=t[i])}removeBoxGarbage(){const e=ge(this.container.id);for(const t of e.values())t.node.get(0).isConnected||(t.unmount(),e.delete(t.node.id))}renderBoxes(){this.removeBoxGarbage();const e=this.container,t=ge(e.id);e.find("lake-box").each((e=>{const i=I(e);if(t.get(i.id))return;Fe(i).render()}))}focus(){this.container.focus()}blur(){this.container.blur()}scrollToCaret(){const e=this.selection.range;if(e.isBox)return;const t=e.getRect();if(0===t.x||0===t.y)return;const i=this.container.get(0).getBoundingClientRect(),n=I('<div class="lake-artificial-caret" />'),s=t.x-i.x,o=t.y-i.y;n.css({position:"absolute",top:`${o}px`,left:`${s}px`,width:`${t.width}px`,height:`${t.height}px`,"z-index":"-1"}),this.overlayContainer.find(".lake-artificial-caret").remove(),this.overlayContainer.append(n),ue(n,{behavior:"instant",block:"nearest",inline:"nearest"}),n.remove()}setValue(e){e=g(e);const t=new Xe(e),i=t.getFragment();this.container.empty(),this.togglePlaceholderClass(t.getHTML()),this.container.append(i),this.renderBoxes(),this.selection.updateByBookmark()}getValue(){const e=this.history.cloneContainer();let t=new Xe(e).getHTML();return t=f(t),t}render(){const e=g(this.config.value),t=new Xe(e),i=t.getFragment();this.root.empty(),this.root.append(this.containerWrapper),this.containerWrapper.append(this.container),this.containerWrapper.append(this.overlayContainer),I(document.body).append(this.popupContainer),this.togglePlaceholderClass(t.getHTML()),this.container.append(i),this.unmountPluginMap=$t.plugin.loadAll(this),this.readonly||(this.selection.updateByBookmark(),this.history.save({emitEvent:!1})),this.renderBoxes(),this.toolbar&&this.toolbar.render(this),this.root.on("scroll",this.scrollListener),document.addEventListener("copy",this.copyListener),window.addEventListener("resize",this.resizeListener),this.readonly||(document.addEventListener("cut",this.cutListener),document.addEventListener("paste",this.pasteListener),document.addEventListener("selectionchange",this.selectionchangeListener),document.addEventListener("click",this.clickListener),this.bindInputEvents(),this.bindHistoryEvents())}unmount(){this.updateSelectionRange.flush(),this.updateBoxSelectionStyle.flush(),this.emitStateChangeEvent.flush();for(const e of this.unmountPluginMap.keys()){const t=this.unmountPluginMap.get(e);t&&(t(),A(`Plugin "${e}" unmounted`))}this.toolbar&&this.toolbar.unmount(),this.removeBoxGarbage(),this.container.find("lake-box").each((e=>{Fe(I(e)).unmount()})),this.event.removeAllListeners(),this.history.event.removeAllListeners(),this.root.off(),this.root.removeClass("lake-custom-properties"),this.root.empty(),this.popupContainer.remove(),document.removeEventListener("copy",this.copyListener),window.removeEventListener("resize",this.resizeListener),this.readonly||(document.removeEventListener("cut",this.cutListener),document.removeEventListener("paste",this.pasteListener),document.removeEventListener("selectionchange",this.selectionchangeListener),document.removeEventListener("click",this.clickListener))}}$t.version="0.2.1",$t.box=new class{add(e){ye.set(e.name,e)}remove(e){ye.delete(e)}getNames(){return Array.from(ye.keys())}},$t.plugin=new class{constructor(){this.pluginMap=new Map}add(e,t){if(this.pluginMap.get(e))throw new Error(`Plugin "${e}" is already defined.`);this.pluginMap.set(e,t)}loadAll(e){const t=new Map;for(const i of this.pluginMap.keys()){const n=this.pluginMap.get(i);if(n&&!1!==e.config[i]){const s=n(e);s&&t.set(i,s)}}return t}};const Vt=[{icon:n.get("numberedList"),value:"numbered",text:e=>e.toolbar.numberedList()},{icon:n.get("bulletedList"),value:"bulleted",text:e=>e.toolbar.bulletedList()},{icon:n.get("checklist"),value:"checklist",text:e=>e.toolbar.checklist()}],Ft=[{icon:n.get("alignLeft"),value:"left",text:e=>e.toolbar.alignLeft()},{icon:n.get("alignCenter"),value:"center",text:e=>e.toolbar.alignCenter()},{icon:n.get("alignRight"),value:"right",text:e=>e.toolbar.alignRight()},{icon:n.get("alignJustify"),value:"justify",text:e=>e.toolbar.alignJustify()}],Rt=[{icon:n.get("increaseIndent"),value:"increase",text:e=>e.toolbar.increaseIndent()},{icon:n.get("decreaseIndent"),value:"decrease",text:e=>e.toolbar.decreaseIndent()}],jt=[{icon:n.get("italic"),value:"italic",text:e=>e.toolbar.italic()},{icon:n.get("underline"),value:"underline",text:e=>e.toolbar.underline()},{icon:n.get("strikethrough"),value:"strikethrough",text:e=>e.toolbar.strikethrough()},{icon:n.get("superscript"),value:"superscript",text:e=>e.toolbar.superscript()},{icon:n.get("subscript"),value:"subscript",text:e=>e.toolbar.subscript()},{icon:n.get("code"),value:"code",text:e=>e.toolbar.code()}],qt=["#f5222d","#fa541c","#fa8c16","#faad14","#fadb14","#a0d911","#52c41a","#13c2c2","#1677ff","#2f54eb","#722ed1","#eb2f96","#fff1f0","#fff2e8","#fff7e6","#fffbe6","#feffe6","#fcffe6","#f6ffed","#e6fffb","#e6f4ff","#f0f5ff","#f9f0ff","#fff0f6","#ffccc7","#ffd8bf","#ffe7ba","#fff1b8","#ffffb8","#f4ffb8","#d9f7be","#b5f5ec","#bae0ff","#d6e4ff","#efdbff","#ffd6e7","#ffa39e","#ffbb96","#ffd591","#ffe58f","#fffb8f","#eaff8f","#b7eb8f","#87e8de","#91caff","#adc6ff","#d3adf7","#ffadd2","#ff7875","#ff9c6e","#ffc069","#ffd666","#fff566","#d3f261","#95de64","#5cdbd3","#69b1ff","#85a5ff","#b37feb","#ff85c0","#ff4d4f","#ff7a45","#ffa940","#ffc53d","#ffec3d","#bae637","#73d13d","#36cfc9","#4096ff","#597ef7","#9254de","#f759ab","#cf1322","#d4380d","#d46b08","#d48806","#d4b106","#7cb305","#389e0d","#08979c","#0958d9","#1d39c4","#531dab","#c41d7f","#a8071a","#ad2102","#ad4e00","#ad6800","#ad8b00","#5b8c00","#237804","#006d75","#003eb3","#10239e","#391085","#9e1068","#820014","#871400","#873800","#874d00","#876800","#3f6600","#135200","#00474f","#002c8c","#061178","#22075e","#780650","#5c0011","#610b00","#612500","#613400","#614700","#254000","#092b00","#002329","#001d66","#030852","#120338","#520339","#000000","#1f1f1f","#262626","#434343","#595959","#8c8c8c","#bfbfbf","#d9d9d9","#f0f0f0","#f5f5f5","#fafafa","#ffffff"],Wt=[{icon:n.get("removeFormat"),value:"",text:e=>e.toolbar.removeColor()}];for(const e of qt)Wt.push({value:e.toLowerCase(),text:e.toUpperCase()});const Ut=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Kt=[{name:"undo",type:"button",icon:n.get("undo"),tooltip:e=>e.toolbar.undo(),onClick:(e,t)=>{e.command.execute(t)}},{name:"redo",type:"button",icon:n.get("redo"),tooltip:e=>e.toolbar.redo(),onClick:(e,t)=>{e.command.execute(t)}},{name:"selectAll",type:"button",icon:n.get("selectAll"),tooltip:e=>e.toolbar.selectAll(),onClick:(e,t)=>{e.command.execute(t)}},{name:"paragraph",type:"button",icon:n.get("paragraph"),tooltip:e=>e.toolbar.paragraph(),isSelected:e=>!!e.find((e=>"p"===e.name)),onClick:e=>{e.command.execute("heading","p")}},{name:"blockQuote",type:"button",icon:n.get("blockQuote"),tooltip:e=>e.toolbar.blockQuote(),onClick:(e,t)=>{e.command.execute(t)}},{name:"numberedList",type:"button",icon:n.get("numberedList"),tooltip:e=>e.toolbar.numberedList(),isSelected:e=>!!e.find((e=>"ol"===e.name)),onClick:e=>{e.command.execute("list","numbered")}},{name:"bulletedList",type:"button",icon:n.get("bulletedList"),tooltip:e=>e.toolbar.bulletedList(),isSelected:e=>!!e.find((e=>"ul"===e.name&&!e.node.hasAttr("type"))),onClick:e=>{e.command.execute("list","bulleted")}},{name:"checklist",type:"button",icon:n.get("checklist"),tooltip:e=>e.toolbar.checklist(),isSelected:e=>!!e.find((e=>"ul"===e.name&&"checklist"===e.node.attr("type"))),onClick:e=>{e.command.execute("list","checklist")}},{name:"alignLeft",type:"button",icon:n.get("alignLeft"),tooltip:e=>e.toolbar.alignLeft(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"left"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","left")}},{name:"alignCenter",type:"button",icon:n.get("alignCenter"),tooltip:e=>e.toolbar.alignCenter(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"center"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","center")}},{name:"alignRight",type:"button",icon:n.get("alignRight"),tooltip:e=>e.toolbar.alignRight(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"right"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","right")}},{name:"alignJustify",type:"button",icon:n.get("alignJustify"),tooltip:e=>e.toolbar.alignJustify(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"justify"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","justify")}},{name:"increaseIndent",type:"button",icon:n.get("increaseIndent"),tooltip:e=>e.toolbar.increaseIndent(),onClick:e=>{e.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:n.get("decreaseIndent"),tooltip:e=>e.toolbar.decreaseIndent(),onClick:e=>{e.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:n.get("bold"),tooltip:e=>e.toolbar.bold(),onClick:(e,t)=>{e.command.execute(t)}},{name:"italic",type:"button",icon:n.get("italic"),tooltip:e=>e.toolbar.italic(),onClick:(e,t)=>{e.command.execute(t)}},{name:"underline",type:"button",icon:n.get("underline"),tooltip:e=>e.toolbar.underline(),onClick:(e,t)=>{e.command.execute(t)}},{name:"strikethrough",type:"button",icon:n.get("strikethrough"),tooltip:e=>e.toolbar.strikethrough(),onClick:(e,t)=>{e.command.execute(t)}},{name:"superscript",type:"button",icon:n.get("superscript"),tooltip:e=>e.toolbar.superscript(),onClick:(e,t)=>{e.command.execute(t)}},{name:"subscript",type:"button",icon:n.get("subscript"),tooltip:e=>e.toolbar.subscript(),onClick:(e,t)=>{e.command.execute(t)}},{name:"code",type:"button",icon:n.get("code"),tooltip:e=>e.toolbar.code(),onClick:(e,t)=>{e.command.execute(t)}},{name:"removeFormat",type:"button",icon:n.get("removeFormat"),tooltip:e=>e.toolbar.removeFormat(),onClick:(e,t)=>{e.command.execute(t)}},{name:"formatPainter",type:"button",icon:n.get("formatPainter"),tooltip:e=>e.toolbar.formatPainter(),onClick:(e,t)=>{e.command.execute(t)}},{name:"link",type:"button",icon:n.get("link"),tooltip:e=>e.toolbar.link(),onClick:(e,t)=>{e.command.execute(t)}},{name:"hr",type:"button",icon:n.get("hr"),tooltip:e=>e.toolbar.hr(),onClick:(e,t)=>{e.command.execute(t)}},{name:"codeBlock",type:"button",icon:n.get("codeBlock"),tooltip:e=>e.toolbar.codeBlock(),onClick:(e,t)=>{e.command.execute(t)}},{name:"video",type:"button",icon:n.get("video"),tooltip:e=>e.toolbar.video(),onClick:(e,t)=>{e.command.execute(t)}},{name:"equation",type:"button",icon:n.get("equation"),tooltip:e=>e.toolbar.equation(),onClick:(e,t)=>{e.command.execute(t)}},{name:"heading",type:"dropdown",downIcon:n.get("down"),defaultValue:"p",tooltip:e=>e.toolbar.heading(),width:"100px",menuType:"list",menuItems:[{value:"h1",text:e=>`<span style="font-weight: bold; font-size: 26px;">${e.toolbar.heading1()}</span>`},{value:"h2",text:e=>`<span style="font-weight: bold; font-size: 24px;">${e.toolbar.heading2()}</span>`},{value:"h3",text:e=>`<span style="font-weight: bold; font-size: 22px;">${e.toolbar.heading3()}</span>`},{value:"h4",text:e=>`<span style="font-weight: bold; font-size: 20px;">${e.toolbar.heading4()}</span>`},{value:"h5",text:e=>`<span style="font-weight: bold; font-size: 18px;">${e.toolbar.heading5()}</span>`},{value:"h6",text:e=>`<span style="font-weight: bold; font-size: 16px;">${e.toolbar.heading6()}</span>`},{value:"p",text:e=>e.toolbar.paragraph()}],onSelect:(e,t)=>{e.command.execute("heading",t)}},{name:"list",type:"dropdown",downIcon:n.get("down"),icon:n.get("list"),tooltip:e=>e.toolbar.list(),menuType:"list",menuItems:Vt,onSelect:(e,t)=>{e.command.execute("list",t)}},{name:"align",type:"dropdown",downIcon:n.get("down"),icon:n.get("alignLeft"),tooltip:e=>e.toolbar.align(),menuType:"list",menuItems:Ft,onSelect:(e,t)=>{e.command.execute("align",t)}},{name:"indent",type:"dropdown",downIcon:n.get("down"),icon:n.get("increaseIndent"),tooltip:e=>e.toolbar.indent(),menuType:"list",menuItems:Rt,onSelect:(e,t)=>{e.command.execute("indent",t)}},{name:"fontFamily",type:"dropdown",downIcon:n.get("down"),defaultValue:"Segoe UI",tooltip:e=>e.toolbar.fontFamily(),width:"100px",menuType:"list",menuItems:[{value:"Arial",text:'<span style="font-family: Arial;">Arial</span>'},{value:"Arial Black",text:"<span style=\"font-family: 'Arial Black';\">Arial Black</span>"},{value:"Comic Sans MS",text:"<span style=\"font-family: 'Comic Sans MS';\">Comic Sans MS</span>"},{value:"Courier New",text:"<span style=\"font-family: 'Courier New';\">Courier New</span>"},{value:"Georgia",text:'<span style="font-family: Georgia;">Georgia</span>'},{value:"Helvetica",text:'<span style="font-family: Helvetica;">Helvetica</span>'},{value:"Impact",text:'<span style="font-family: Impact;">Impact</span>'},{value:"Segoe UI",text:"<span style=\"font-family: 'Segoe UI';\">Segoe UI</span>"},{value:"Tahoma",text:'<span style="font-family: Tahoma;">Tahoma</span>'},{value:"Times New Roman",text:"<span style=\"font-family: 'Times New Roman';\">Times New Roman</span>"},{value:"Trebuchet MS",text:"<span style=\"font-family: 'Trebuchet MS';\">Trebuchet MS</span>"},{value:"Verdana",text:'<span style="font-family: Verdana;">Verdana</span>'}],onSelect:(e,t)=>{e.command.execute("fontFamily",t)}},{name:"fontSize",type:"dropdown",downIcon:n.get("down"),defaultValue:"16px",tooltip:e=>e.toolbar.fontSize(),width:"65px",menuType:"list",menuItems:[{value:"12px",text:"12px"},{value:"14px",text:"14px"},{value:"16px",text:"16px"},{value:"18px",text:"18px"},{value:"22px",text:"22px"},{value:"24px",text:"24px"},{value:"32px",text:"32px"}],onSelect:(e,t)=>{e.command.execute("fontSize",t)}},{name:"moreStyle",type:"dropdown",icon:n.get("more"),tooltip:e=>e.toolbar.moreStyle(),menuType:"list",menuItems:jt,selectedValues:e=>{var t;const i=[];for(const n of e)if(n.node.isMark){const e=null!==(t=Ut.get(n.name))&&void 0!==t?t:n.name;i.push(e)}return i},onSelect:(e,t)=>{e.command.execute(t)}},{name:"fontColor",type:"dropdown",downIcon:n.get("down"),icon:n.get("fontColor"),accentIcon:n.get("fontColorAccent"),defaultValue:"#f5222d",tooltip:e=>e.toolbar.fontColor(),menuType:"color",menuItems:Wt,menuWidth:"296px",onSelect:(e,t)=>{e.command.execute("fontColor",t)}},{name:"highlight",type:"dropdown",downIcon:n.get("down"),icon:n.get("highlight"),accentIcon:n.get("highlightAccent"),defaultValue:"#fadb14",tooltip:e=>e.toolbar.highlight(),menuType:"color",menuItems:Wt,menuWidth:"296px",onSelect:(e,t)=>{e.command.execute("highlight",t)}},{name:"image",type:"upload",icon:n.get("image"),tooltip:e=>e.toolbar.image(),accept:"image/*",multiple:!0},{name:"file",type:"upload",icon:n.get("attachment"),tooltip:e=>e.toolbar.file(),accept:"*",multiple:!0}],Gt=["undo","redo","|","heading","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],Xt=new Map;for(const e of Kt)Xt.set(e.name,e);var Qt={type:"block",name:"hr",render:e=>{const t=e.getEditor(),i=e.getContainer(),n=I('<div class="lake-hr"><hr /></div>');i.empty(),i.append(n),n.on("click",(()=>{t.selection.selectBox(e)}))},html:()=>"<hr />"};const Yt="#57606a",Jt="#444d56",ei="#953800",ti="#0550ae",ii="#444d56",ni="#24292e",si="#005cc5",oi="#0550ae",ri="#444d56",ai="#444d56",li="#0a3069",ci="#0550ae",di="#0550ae",hi="#116329",pi="#0550ae",ui="#cf222e",mi="#24292f",gi="#cf222e",fi="#57606a",vi="#57606a",wi="#8250df",yi="#0550ae",xi="#f6f8fa",bi="#cf222e",ki="#0550ae",Ci="#005cc5",Si="#444d56",Bi="#444d56";function _i(e){const{HighlightStyle:t,tags:i}=e;return t.define([{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:Yt},{tag:[i.name],color:Jt},{tag:[i.variableName,i.self],color:ei},{tag:[i.typeName,i.tagName],color:ti},{tag:[i.propertyName,i.attributeName],color:ii},{tag:[i.className],color:ni},{tag:[i.labelName],color:si},{tag:[i.namespace],color:oi},{tag:[i.macroName],color:ri},{tag:[i.literal],color:ai},{tag:[i.string,i.docString,i.character,i.attributeValue,i.unit],color:li},{tag:[i.number,i.integer,i.float],color:ci},{tag:[i.bool,i.null,i.atom],color:di},{tag:[i.regexp,i.escape,i.url],color:hi},{tag:[i.color],color:pi},{tag:[i.keyword,i.operatorKeyword,i.controlKeyword,i.definitionKeyword,i.moduleKeyword],color:ui},{tag:[i.modifier],color:mi},{tag:[i.operator,i.derefOperator,i.arithmeticOperator,i.logicOperator,i.bitwiseOperator,i.compareOperator,i.updateOperator,i.definitionOperator,i.typeOperator,i.controlOperator],color:gi},{tag:[i.punctuation,i.separator,i.bracket,i.angleBracket,i.squareBracket,i.paren,i.brace,i.contentSeparator],color:fi},{tag:[i.content],color:vi},{tag:[i.meta,i.documentMeta,i.annotation,i.processingInstruction],color:wi},{tag:i.heading,fontWeight:"bold",color:yi},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.link,textDecoration:"underline"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:[i.invalid,i.inserted,i.deleted,i.changed],color:xi},{tag:[i.definition(i.name)],color:bi},{tag:[i.constant(i.name)],color:ki},{tag:[i.function(i.variableName)],color:Ci},{tag:[i.standard(i.name)],color:Si},{tag:[i.special(i.variableName)],color:Bi}])}var Ai={type:"block",name:"codeBlock",render:e=>{var t;const i=e.getEditor(),s=I('<div class="lake-code-block" />'),o=e.getContainer();o.css("width",i.container.innerWidth()-2+"px"),o.empty(),o.append(s);const r=s.get(0);if(!r)return;const a=window.LakeCodeMirror;if(!a)return i.readonly?void e.node.hide():(s.addClass("lake-code-block-error"),s.text('\n The code cannot be displayed because window.LakeCodeMirror is not found.\n Please check if the "lake-codemirror" library is added to this page.\n '.trim()),void s.on("click",(()=>{i.selection.selectBox(e)})));const{EditorState:l,Compartment:c,EditorView:d,keymap:h,history:p,defaultKeymap:u,historyKeymap:m,indentWithTab:g,syntaxHighlighting:f}=a,v=a.langItems,w=i.config.codeBlock,y=v.filter((e=>w.langList.indexOf(e.value)>=0)),x=new Map;for(const e of y)x.set(e.value,e);const b=e.value,k=x.get(b.lang),C=new c,S=xt((t=>{i.selection.updateByRange(),i.isComposing||(e.updateValue("code",t),i.history.save())}),1,{immediate:!1}),B=d.updateListener.of((e=>{e.docChanged&&S(e.state.doc.toString())})),_=new d({parent:r,doc:null!==(t=b.code)&&void 0!==t?t:"",extensions:[l.readOnly.of(i.readonly),d.editable.of(!i.readonly),p(),h.of([...u,...m,g]),f(_i(a)),C.of(k&&k.component?k.component():[]),B]});s.find('[contenteditable="true"]').attr("tabindex","-1");const L=new ze({root:s,name:"langType",downIcon:n.get("down"),defaultValue:k?b.lang:w.defaultLang,tooltip:i.locale.codeBlock.langType(),menuType:"list",menuHeight:"200px",menuItems:y.map((e=>({value:e.value,text:e.text}))),onSelect:t=>{e.updateValue({lang:t}),e.unmount(),e.render(),i.selection.selectBox(e),i.history.save()}});L.render();const E=()=>{o.css("width",i.container.innerWidth()-2+"px")};i.event.on("resize",E),s.on("click",(()=>{_.hasFocus||_.focus()})),e.event.on("beforeunmount",(()=>{L.unmount(),_.destroy(),i.event.off("resize",E),A("CodeMirror destroyed")}))}};function Li(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))}
|
|
19
19
|
/*!
|
|
20
20
|
* PhotoSwipe Lightbox 5.4.4 - https://photoswipe.com
|
|
21
21
|
* (c) 2024 Dmytro Semenov
|