lakelib 0.0.4 → 0.0.6

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 CHANGED
@@ -1,8 +1,8 @@
1
- var Lake=function(t){"use strict";class e extends HTMLElement{}customElements.define("lake-box",e);class i extends HTMLElement{}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>'],["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>'],["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>'],["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>'],["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>'],["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>'],["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(t,...e){let i=t[0];for(let n=0;n<e.length;n++){i+=String(e[n]),i+=t[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}const o=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],[" ","&nbsp;"]]);function r(t){return t.replace(/[&<>"\xA0]/g,(t=>{var e;return null!==(e=o.get(t))&&void 0!==e?e:""}))}function a(t,...e){let i=t[0];for(let n=0;n<e.length;n++){i+=r(String(e[n])),i+=t[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}function l(t){const e=t.split("-");let i="";return e.forEach(((t,e)=>{i+=e>0?t.charAt(0).toUpperCase()+t.substring(1):t})),i}function h(t,e,i){return void 0===i&&(i=","),(i+t+i).indexOf(i+e+i)>=0}function c(t){const e=Number.parseInt(t,10).toString(16).toLowerCase();return e.length>1?e:`0${e}`}function d(t){return t.replace(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)/gi,((t,e,i,n,s)=>void 0===s?`#${c(e)}${c(i)}${c(n)}`:`#${c(e)}${c(i)}${c(n)}${function(t){const e=Math.round(255*Number.parseFloat(t)).toString(16);return e.length>1?e:`0${e}`}(s)}`))}function p(t){t=t.replace(/&quot;/gi,'"');const e={},i=/\s*([\w-]+)\s*:([^;]*)(;|$)/g;let n;for(;null!==(n=i.exec(t));){const t=n[1].toLowerCase().trim(),i=d(n[2]).trim();e[t]=i}return e}function u(t){return t.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<anchor\s*\/>/gi,'<lake-bookmark type="anchor"></lake-bookmark>').replace(/<focus\s*\/>/gi,'<lake-bookmark type="focus"></lake-bookmark>')}function m(t){return t.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 f(t,e){const i=(e=null!=e?e:navigator.userAgent).indexOf("Mac OS X")>=0?"⌘":"Ctrl";return t.replace(/(^|\+|\s)mod(\+|\s|$)/g,`$1${i}$2`)}function g(t,e){for(const i in t)if(!1===e(i,t[i]))break}function v(t,e){const i=l(e),n=window.getComputedStyle(t,null);return d(t.style[i]||n.getPropertyValue(e)||"")}function w(t,e){const i=[];if("string"!=typeof t)return i.push(t),i;if(""===t)return i;if("text"===e){const e=document.createTextNode(t);return i.push(e),i}if("html"===e||/<.+>/.test(t)){const e=document.createElement("div");e.innerHTML=t;for(const t of e.childNodes)i.push(t);return i}const n=document.querySelectorAll(t);for(const t of n)i.push(t);return i}const y=Node,x=new Set(["h1","h2","h3","h4","h5","h6","div","p","blockquote","ul","ol","li","table","tr","th","td"]),b=new Set(["span","strong","em","i","u","s","sup","sub","code"]),k=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_=new Set(["h1","h2","h3","h4","h5","h6"]),S=new Set(["ol","ul","li"]),C=new Set(["table","tr","td"]);function A(...t){window.LAKE_DEBUG&&console.log.apply(console.log,t)}const B={};let L=0;class T{constructor(t){t=null!=t?t:[],this.nodeList=Array.isArray(t)?t:[t];for(let t=0;t<this.nodeList.length;t++)this.nodeList[t].lakeId||(this.nodeList[t].lakeId=++L);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===y.ELEMENT_NODE}get isText(){if(0===this.length)return!1;return this.get(0).nodeType===y.TEXT_NODE}get isBlock(){return 0!==this.length&&x.has(this.name)}get isMark(){return 0!==this.length&&b.has(this.name)}get isVoid(){return 0!==this.length&&k.has(this.name)}get isHeading(){return 0!==this.length&&_.has(this.name)}get isList(){return 0!==this.length&&S.has(this.name)}get isTable(){return 0!==this.length&&C.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 t=this.get(0);return this.isElement&&"true"===t.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 t=this.parent();return 0!==t.length&&(this.isInside&&t.isContainer)}get isContentEditable(){if(0===this.length)return!1;if(this.isText){const t=this.get(0).parentNode;return!!t&&t.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 t=this.text(),e=""===t||/^[\r\n\u200B\u2060]+$/.test(t);return this.isElement&&e?0===this.find("lake-box").length:e}isSibling(t){if(0===this.length)return!1;const e=this.get(0).parentNode;return e&&e===t.parent().get(0)}get(t){return this.nodeList[t]}getAll(){return this.nodeList}eq(t){const e=this.get(t);return new T(e)}each(t){const e=this.getAll();for(let i=0;i<e.length;i++)if(!1===t(e[i],i))return this;return this}eachElement(t){const e=this.getAll();for(let i=0;i<e.length;i++)if(e[i].nodeType===y.ELEMENT_NODE&&!1===t(e[i],i))return this;return this}reverse(){const t=this.getAll().reverse();return new T(t)}matches(t){if(!this.isElement)return!1;return this.get(0).matches(t)}find(t){if("string"==typeof t){const e=this.get(0).querySelectorAll(t);return new T(Array.from(e))}let e=this.eq(0);for(const i of t)if(e=e.children()[i],!e)return new T;return e}closest(t){if(this.isText){const e=this.get(0).parentNode;return e?new T(e.closest(t)):new T}if(!this.isElement)return new T;const e=this.get(0);return new T(e.closest(t))}closestBlock(){let t=this.eq(0);for(;t.length>0&&!t.isTopInside&&!t.isBlock;)t=t.parent();return t.isBlock?t:new T}closestOperableBlock(){const t=this.closest("lake-box"),e=t.length>0?t.closestBlock():this.closestBlock();if(0===e.length)return e;if(e.isTable)return new T;const i=e.parent();return"li"===e.name&&i.isList?i:e}closestContainer(){return this.closest('div[contenteditable="true"]')}parent(){const t=this.get(0);return new T(t.parentNode)}prev(){const t=this.get(0);return new T(t.previousSibling)}next(){const t=this.get(0);return new T(t.nextSibling)}first(){const t=this.get(0);return new T(t.firstChild)}last(){const t=this.get(0);return new T(t.lastChild)}index(){let t=-1,e=this.get(0);for(;e;)t++,e=e.previousSibling;return t}path(){const t=[];let e=this.eq(0);if(e.isContainer)return t;for(;e.length>0;){const i=e.parent();if(0===i.length)break;if(t.push(e.index()),i.isContainer)break;e=i}return t.reverse()}children(){const t=[];let e=this.first();for(;e.length>0;)t.push(e),e=e.next();return t}*getWalker(){for(const t of function*t(e){if(e.isBox)return;let i=e.first();for(;i.length>0;){const e=i.next();yield i,yield*t(i),i=e}}(this.eq(0)))yield t}on(t,e){return this.eachElement((i=>{i.addEventListener(t,e,!1);const n=i.lakeId;B[n]||(B[n]=[]),B[n].push({type:t,listener:e})}))}off(t,e){return this.eachElement((i=>{var n;const s=i.lakeId,o=null!==(n=B[s])&&void 0!==n?n:[];o.forEach(((n,s)=>{t&&(t!==n.type||e&&e!==n.listener)||(i.removeEventListener(n.type,n.listener,!1),o[s]={type:"",listener:()=>{}})})),B[s]=o.filter((t=>""!==t.type))}))}emit(t,e){return this.eachElement((i=>{const n=i.lakeId;B[n].forEach((i=>{i.type===t&&i.listener(null!=e?e:new Event(t))}))}))}getEventListeners(t){const e=this.get(t).lakeId;return B[e]}focus(){return this.get(0).focus(),this}blur(){return this.get(0).blur(),this}clone(t=!1){const e=this.get(0);return new T(e.cloneNode(t))}hasAttr(t){return this.get(0).hasAttribute(t)}attr(t,e){var i;if("object"==typeof t)return g(t,((t,e)=>{this.attr(t,e)})),this;if(void 0===e){return null!==(i=this.get(0).getAttribute(t))&&void 0!==i?i:""}return this.eachElement((i=>{i.setAttribute(t,e)}))}removeAttr(t){return this.eachElement((e=>{e.removeAttribute(t)}))}hasClass(t){return h(this.get(0).className,t," ")}addClass(t){return Array.isArray(t)?(t.forEach((t=>{this.addClass(t)})),this):this.eachElement((e=>{h(e.className,t," ")||e.classList.add(t)}))}removeClass(t){return Array.isArray(t)?(t.forEach((t=>{this.removeClass(t)})),this):this.eachElement((e=>{h(e.className,t," ")&&(e.classList.remove(t),""===e.className&&e.removeAttribute("class"))}))}computedCSS(t){return v(this.get(0),t)}css(t,e){if("object"==typeof t)return g(t,((t,e)=>{this.css(t,e)})),this;if(void 0===e){return d(this.get(0).style[l(t)])}return this.eachElement((i=>{i.style[l(t)]=e,""===i.getAttribute("style")&&i.removeAttribute("style")}))}width(){return this.get(0).offsetWidth}innerWidth(){const t=parseInt(this.computedCSS("padding-left"),10)||0,e=parseInt(this.computedCSS("padding-right"),10)||0;return this.width()-t-e}height(){return this.get(0).offsetHeight}show(t="block"){return this.css("display",t),this}hide(){return this.css("display","none"),this}html(t){if(void 0===t){return this.get(0).innerHTML}return this.eachElement((e=>{e.innerHTML=t}))}text(t){var e;if(void 0===t){const t=this.get(0);if(this.isText)return null!==(e=t.nodeValue)&&void 0!==e?e:"";return t.innerText.replace(/^\n+|\n+$/,"")}return this.eachElement((e=>{e.innerText=t}))}outerHTML(){return this.get(0).outerHTML}empty(){return this.html(""),this}prepend(t){if("string"==typeof t)return this.eachElement((e=>{w(t).reverse().forEach((t=>{e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t),this}append(t){if("string"==typeof t)return this.eachElement((e=>{w(t).forEach((t=>{e.appendChild(t)}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.appendChild(t),this}before(t){if("string"==typeof t)return this.each((e=>{w(t).forEach((t=>{e.parentNode&&e.parentNode.insertBefore(t,e)}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.parentNode?(e.parentNode.insertBefore(t,e),this):this}after(t){if("string"==typeof t)return this.each((e=>{w(t).reverse().forEach((t=>{e.parentNode&&(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t))}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.parentNode?(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),this):this}replaceWith(t){return this.each((e=>{let i;i=t instanceof T?t.get(0):w(t)[0],e.parentNode&&e.parentNode.replaceChild(i,e)}))}remove(t=!1){return this.each((e=>{if(e.parentNode){if(t){let t=e.firstChild;for(;t;){const i=t.nextSibling;e.parentNode.insertBefore(t,e),t=i}}e.parentNode.removeChild(e)}})),this}splitText(t){if(!this.isText)return new T;const e=this.get(0).splitText(t);return new T(e)}toString(){if(0===this.length)return"";const t=this.get(0);let e=this.isText?t.nodeValue:this.outerHTML();return e&&e.length>50&&(e=`${e.substring(0,50)} ...`),`node (${t.lakeId}): ${e}`}debug(){A(this.toString())}}function I(t){if(t instanceof T)return t;const e=w(t);return new T(e)}class E{constructor(t){this.range=null!=t?t: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 isBoxLeft(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return this.compareBeforeNode(e)>=0}get isBoxCenter(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return this.isCollapsed&&this.startNode.get(0)===e.get(0)&&0===this.startOffset}get isBoxRight(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return this.compareAfterNode(e)<=0}get isInsideBox(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return(!this.isCollapsed||this.startNode.get(0)!==e.get(0)||0!==this.startOffset)&&(this.compareBeforeNode(e)<0&&this.compareAfterNode(e)>0)}get isInoperative(){if(this.commonAncestor.isOutside)return!0;const t=this.startNode.closest("td"),e=this.endNode.closest("td");return t.length>0&&e.length>0&&t.get(0)!==e.get(0)}get(){return this.range}comparePoint(t,e){return this.range.comparePoint(t.get(0),e)}compareBeforeNode(t){const e=new E;return t.isText?e.setStart(t,0):e.setStartBefore(t),e.collapseToStart(),this.comparePoint(e.startNode,e.startOffset)}compareAfterNode(t){var e;const i=new E;if(t.isText){const n=null!==(e=t.get(0).nodeValue)&&void 0!==e?e:"";i.setStart(t,n.length)}else i.setStartAfter(t);return i.collapseToStart(),this.comparePoint(i.startNode,i.startOffset)}intersectsNode(t){return this.range.intersectsNode(t.get(0))}setStart(t,e){this.range.setStart(t.get(0),e)}setStartBefore(t){this.range.setStartBefore(t.get(0))}setStartAfter(t){this.range.setStartAfter(t.get(0))}setEnd(t,e){this.range.setEnd(t.get(0),e)}setEndBefore(t){this.range.setEndBefore(t.get(0))}setEndAfter(t){this.range.setEndAfter(t.get(0))}collapseToStart(){this.range.collapse(!0)}collapseToEnd(){this.range.collapse(!1)}selectNode(t){this.range.selectNode(t.get(0))}selectNodeContents(t){this.range.selectNodeContents(t.get(0))}selectBox(t){const e=t.find(".lake-box-container");if(0===e.length)throw new Error(`The box cannot be selected because the box '${t.attr("name")}' (id=${t.id}) has not been rendered yet.`);this.setStart(e,0),this.collapseToStart()}selectBoxLeft(t){const e=t.find(".lake-box-strip");if(0===e.length)throw new Error(`The box cannot be selected because the box '${t.attr("name")}' (id=${t.id}) has not been rendered yet.`);this.selectNodeContents(e.eq(0)),this.collapseToEnd()}selectBoxRight(t){const e=t.find(".lake-box-strip");if(0===e.length)throw new Error(`The box cannot be selected because the box '${t.attr("name")}' (id=${t.id}) has not been rendered yet.`);this.selectNodeContents(e.eq(1)),this.collapseToEnd()}shrinkBefore(t){if(t.isBox)return void this.selectBoxLeft(t);if(t.isText)return this.setStartBefore(t),void this.collapseToStart();let e;for(this.setStart(t,0);this.startNode.isElement&&(e=this.startNode.children()[0])&&e.isElement&&!e.isVoid;){if(e.isBox)return void this.selectBoxLeft(e);this.setStart(e,0)}this.collapseToStart()}shrinkAfter(t){if(t.isBox)return void this.selectBoxRight(t);if(t.isText)return this.setEndAfter(t),void this.collapseToEnd();let e;for(this.setEnd(t,t.children().length);this.endNode.isElement&&this.endOffset>0&&(e=this.endNode.children()[this.endOffset-1])&&e.isElement&&!e.isVoid;){if(e.isBox)return void this.selectBoxRight(e);this.setEnd(e,e.children().length)}this.collapseToEnd()}shrink(){const t=this.isCollapsed;let e;for(;this.startNode.isElement&&(e=this.startNode.children()[this.startOffset])&&e.isElement&&!e.isVoid&&!e.isBox;)this.setStart(e,0);if(t)this.collapseToStart();else for(;this.endNode.isElement&&this.endOffset>0&&(e=this.endNode.children()[this.endOffset-1])&&e.isElement&&!e.isVoid&&!e.isBox;)this.setEnd(e,e.children().length)}adaptBox(){const t=this.startNode.closest("lake-box");if(t.length>0){const e=this.clone();e.collapseToStart(),e.isBoxRight?this.setStartAfter(t):this.setStartBefore(t)}const e=this.endNode.closest("lake-box");if(e.length>0){const t=this.clone();t.collapseToEnd(),t.isBoxLeft?this.setEndBefore(e):this.setEndAfter(e)}}adaptTable(){const t=this.startNode.closest("table"),e=this.endNode.closest("table");if(0===t.length&&e.length>0&&e.isInside)return this.setEndBefore(e),void this.shrink();0===e.length&&t.length>0&&t.isInside&&(this.setStartAfter(t),this.shrink())}adaptBlock(){if(!this.isCollapsed){if(this.endNode.isElement&&0===this.endOffset){let t=this.endNode;for(;0===t.prev().length;)t=t.parent();this.setEndBefore(t)}return void this.shrink()}if(this.startNode.isText)return;const t=this.startNode.children()[this.startOffset];t&&(t.isBlockBox||t.isBlock)&&this.shrinkBefore(t)}adapt(){this.adaptBox(),this.adaptTable(),this.adaptBlock()}getPrevNode(){let t;return t=this.startNode.isText?0===this.startOffset?this.startNode.prev():this.startNode:this.startNode.children()[this.startOffset-1],null!=t?t:new T}getNextNode(){let t;return t=this.endNode.isText?this.endOffset===this.endNode.text().length?this.endNode.next():this.endNode:this.endNode.children()[this.endOffset],null!=t?t:new T}getBoxes(){if(this.isCollapsed){const t=this.startNode.closest("lake-box");return t.length>0?[t]:[]}const t=[],e=this.clone();e.adaptBox();for(const i of e.commonAncestor.getWalker())i.isBox&&e.intersectsNode(i)&&t.push(i);return t}getBlocks(){if(this.isCollapsed){const t=this.startNode.closestOperableBlock();return t.isTable?[]:t.isInside?[t]:[]}const t=this.startNode.closestOperableBlock(),e=this.endNode.closestOperableBlock();if(t.isInside&&t.get(0)&&t.get(0)===e.get(0))return t.isTable?[]:[t];const i=[],n=this.clone();n.collapseToEnd();for(const t of this.commonAncestor.getWalker())t.isBlock&&!t.isTable&&t.isTopInside&&0!==n.comparePoint(t,0)&&this.intersectsNode(t)&&i.push(t);if(i.length>0)return i;for(const n of this.commonAncestor.getWalker())n.isBlock&&!n.isTable&&(t.isSibling(n)||e.isSibling(n))&&this.intersectsNode(n)&&i.push(n);return i}getMarks(t=!1){const e=[];if(this.commonAncestor.isText&&t&&0===this.startOffset&&this.endOffset===this.commonAncestor.text().length)return e.push(this.commonAncestor),e;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&&t)&&e.push(s)}return e}getLeftText(){const t=this.startNode,e=this.startOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new E;n.setStartBefore(i),n.setEnd(t,e);const s=I("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"​":o}getRightText(){const t=this.endNode,e=this.endOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new E;n.setStart(t,e),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 E(this.range.cloneRange())}cloneContents(){return this.range.cloneContents()}debug(){A("--- range information ---"),A("start node:",this.startNode.toString(),", offset:",this.startOffset),A("end node:",this.endNode.toString(),", offset:",this.endOffset)}}function M(t,e,i){const n=new E;let s;if(t.isText){s=t.parent();const i=t.splitText(e);n.setStartAfter(t),""===t.text()&&t.remove(),""===i.text()&&i.remove()}else n.setStart(t,e),s=t;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 t=r.next();o.append(r),r=t}return s.before(o),s.parent().length>0&&s.parent().get(0)!==i.get(0)?M(s.parent(),s.index(),i):{left:o,right:s}}function P(t,e){let i=t;for(;i.length>0;){let t=i.first();for(;t.isText&&t.isEmpty;)t=t.next();if(i.isText||i.isBox)break;if(i.isElement&&1===i.children().length&&t.isBookmark){i.prepend(e);break}if(i.isElement&&!i.isVoid&&0===t.length){i.append(e);break}i=t}}function Z(t){if(0===t.length)return;const e=[];let i=t.first();for(;i.length>0;){const t=i.next();i.isText&&""===i.text()||e.push(i),i=t}(1===e.length&&"br"===e[0].name||2===e.length&&"br"===e[0].name&&e[1].isBookmark)&&e[0].remove(),2===e.length&&e[0].isBookmark&&"br"===e[1].name&&e[1].remove()}function z(t){if(t.isText)return{node:t,offset:t.text().length};const e=new E;return e.setEndAfter(t),{node:e.endNode,offset:e.endOffset}}function N(t,e){const i=e;if(["ul","ol"].indexOf(t.name)>=0){const e=t.find("li");t=e.eq(e.length-1)}if(["ul","ol"].indexOf(e.name)>=0){const t=e.find("li");e=t.eq(0)}if(t.isText||e.isText||t.isVoid||e.isVoid)return z(t);Z(t),Z(e),t.isBlock&&t.isEmpty&&e.isEmpty&&P(t,I("<br />"));const n=t.last(),s=e.first();let o=s;for(;o.length>0;){const e=o.next();t.append(o),o=e}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:t,offset:0}:z(n)}function O(t){let e=t;for(;e.length>0;){let t=e.first();if(t.isText&&t.isEmpty&&(t=t.next()),e.isElement&&!e.isVoid&&0===t.length)break;e=t}return e}function H(t,e){if(e=null!=e?e:I("<p />"),0===t.length)return e;const i=O(e=e.clone(!0));return t[0].before(e),t.forEach((t=>{i.append(t)})),e}function D(t){for(const e of t.getWalker())if(e.isText&&e.text().length>1){const t=e.text();/\u200B/.test(e.text())&&(e.get(0).nodeValue=t.replace(/\u200B/g,""))}}function $(t,e){const i=t.get(0),n=I(a`<${e} />`);for(const t of i.attributes)n.attr(t.name,t.value);let s=t.first();for(;s.length>0;){const t=s.next();n.append(s),s=t}return t.replaceWith(n),n}function V(t){if(0===t.length)return;const e=t[0],i=t[t.length-1],n=[];let s=e.prev();for(;s.length>0&&"ol"===s.name;)n.push(s),s=s.prev();n.reverse(),n.push(...t);let o=i.next();for(;o.length>0&&"ol"===o.name;)n.push(o),o=o.next();let r=1;for(const t of n){const e=t.prev();if(0!==e.length&&"ol"===e.name||(r=1),"ol"===t.name){"ol"===e.name&&e.attr("indent")!==t.attr("indent")&&(r=1);const i=t.attr("start"),n=r.toString(10);i!==n&&t.attr("start",n),r++}}}function F(t,e){if(t.isList){let i=Number.parseInt(t.attr("indent"),10)||0;if("increase"===e?i++:i--,i<=0)i=0;else if(i>10)return;return 0===i?t.removeAttr("indent"):t.attr("indent",i.toString(10)),void V([t])}let i=Number.parseInt(t.css("margin-left"),10)||0;"decrease"!==e||0!==i||""===t.css("text-indent")?("increase"===e?i+=40:i-=40,i<=0&&(i=0),0===i?t.css("margin-left",""):t.css("margin-left",`${i}px`)):t.css("text-indent","")}const R=new Set;function W(){}const j={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:W,afterNodeAdded:W,beforeNodeMorphed:W,afterNodeMorphed:W,beforeNodeRemoved:W,afterNodeRemoved:W,beforeAttributeUpdated:W,afterAttributeUpdated:W,beforeChildrenUpdated:W},head:{style:"merge",shouldPreserve:t=>"true"===t.getAttribute("im-preserve"),shouldReAppend:t=>"true"===t.getAttribute("im-re-append"),shouldRemove:W,afterHeadMorphed:W}};function U(t,e){return!t.deadIds.has(e)}function q(t,e,i){return(t.idMap.get(i)||R).has(e)}function K(t,e){const i=t.idMap.get(e)||R;for(const e of i)t.deadIds.add(e)}function G(t,e,i){const n=t.idMap.get(e)||R;let s=0;for(const e of n)U(t,e)&&q(t,e,i)&&++s;return s}function X(t,e){const i=t.parentElement,n=t.querySelectorAll("[id]");for(const t of n){let n=t;for(;n!==i&&null!=n;){let i=e.get(n);null==i&&(i=new Set,e.set(n,i)),i.add(t.id),n=n.parentElement}}}function J(t,e){const i=new Map;return X(t,i),X(e,i),i}function Y(t,e,i){return{target:t,newContent:e,config:i=function(t){const e={};return Object.assign(e,j),Object.assign(e,t),e.callbacks={},Object.assign(e.callbacks,j.callbacks),Object.assign(e.callbacks,t.callbacks),e.head={},Object.assign(e.head,j.head),Object.assign(e.head,t.head),e}(i),morphStyle:i.morphStyle,ignoreActive:i.ignoreActive,ignoreActiveValue:i.ignoreActiveValue,idMap:J(t,e),deadIds:new Set,callbacks:i.callbacks,head:i.head}}function Q(t,e,i){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName&&(""!==t.id&&t.id===e.id||G(i,t,e)>0))}function tt(t,e){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName)}function et(t,e){K(e,t),!1!==e.callbacks.beforeNodeRemoved(t)&&(t.remove(),e.callbacks.afterNodeRemoved(t))}function it(t,e,i){let n=t;for(;n&&n!==e;){const t=n;n=n.nextSibling,et(t,i)}return K(i,e),e.nextSibling}function nt(t,e,i,n,s){const o=G(s,i,e);let r=null;if(o>0){r=n;let e=0;for(;null!=r;){if(Q(i,r,s))return r;if(e+=G(s,r,t),e>o)return null;r=r.nextSibling}}return r}function st(t,e,i,n,s){let o=n,r=i.nextSibling,a=0;for(;null!=o;){if(G(s,o,t)>0)return null;if(tt(i,o))return o;if(tt(r,o)&&(a++,r=r?r.nextSibling:null,a>=2))return null;o=o?o.nextSibling:null}return o}function ot(t,e,i){return tt(t,e)?.5+G(i,t,e):0}function rt(t,e,i,n){return!("value"!==t||!n.ignoreActiveValue||e!==document.activeElement)||!1===n.callbacks.beforeAttributeUpdated(t,e,i)}function at(t,e,i){var n;if(!i.ignoreActive||t!==document.activeElement)return null==e?!1===i.callbacks.beforeNodeRemoved(t)?t:(t.remove(),i.callbacks.afterNodeRemoved(t),null):tt(t,e)?(!1===i.callbacks.beforeNodeMorphed(t,e)||(function(t,e,i){const n=t.nodeType;if(1===n){const n=t.attributes,s=e.attributes;for(const t of n)rt(t.name,e,"update",i)||e.getAttribute(t.name)!==t.value&&(e.setAttribute(t.name,t.value),i.callbacks.afterAttributeUpdated(t.name,e,"update"));for(let n=s.length-1;n>=0;n--){const o=s[n];rt(o.name,e,"remove",i)||t.hasAttribute(o.name)||(e.removeAttribute(o.name),i.callbacks.afterAttributeUpdated(o.name,e,"remove"))}}8!==n&&3!==n||e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue)}(e,t,i),!1===i.callbacks.beforeChildrenUpdated(t,e)||function(t,e){return e.ignoreActiveValue&&t===document.activeElement}(t,i)||lt(e,t,i),i.callbacks.afterNodeMorphed(t,e)),t):!1===i.callbacks.beforeNodeRemoved(t)||!1===i.callbacks.beforeNodeAdded(e)?t:(null===(n=t.parentElement)||void 0===n||n.replaceChild(e,t),i.callbacks.afterNodeAdded(e),i.callbacks.afterNodeRemoved(t),e)}function lt(t,e,i){let n,s=t.firstChild,o=e.firstChild;for(;s;){if(n=s,s=n.nextSibling,null==o){if(!1===i.callbacks.beforeNodeAdded(n))return;e.appendChild(n),i.callbacks.afterNodeAdded(n),K(i,n);continue}if(Q(n,o,i)){at(o,n,i),o=o.nextSibling,K(i,n);continue}const r=nt(t,e,n,o,i);if(r){o=it(o,r,i),at(r,n,i),K(i,n);continue}const a=st(t,0,n,o,i);if(a)o=it(o,a,i),at(a,n,i),K(i,n);else{if(!1===i.callbacks.beforeNodeAdded(n))return;e.insertBefore(n,o),i.callbacks.afterNodeAdded(n),K(i,n)}}for(;null!==o;){const t=o;o=o.nextSibling,et(t,i)}}function ht(t,e,i){if("innerHTML"===i.morphStyle)return lt(e,t,i),t.children;if("outerHTML"===i.morphStyle||null==i.morphStyle){const n=function(t,e,i){let n;n=t.firstChild;let s=n,o=0;for(;n;){const t=ot(n,e,i);t>o&&(s=n,o=t),n=n.nextSibling}return s}(e,t,i),s=null==n?void 0:n.previousSibling,o=null==n?void 0:n.nextSibling,r=at(t,n,i);return n?function(t,e,i){var n,s;const o=[],r=[];let a=t;for(;null!=a;)o.push(a),a=a.previousSibling;for(;o.length>0;){const t=o.pop();r.push(t),t&&(null===(n=e.parentElement)||void 0===n||n.insertBefore(t,e))}r.push(e);let l=i;for(;null!=l;)o.push(l),r.push(l),l=l.nextSibling;for(;o.length>0;){const t=o.pop();t&&(null===(s=e.parentElement)||void 0===s||s.insertBefore(t,e.nextSibling))}return r}(s,r,o):[]}throw`Do not understand how to morph style ${i.morphStyle}`}function ct(t,e,i={}){const n=function(t){if(null==t)return document.createElement("div");if(t instanceof Node){if(t.generatedByIdiomorph)return t;const e=document.createElement("div");return e.append(t),e}const e=document.createElement("div");for(const i of[...t])e.append(i);return e}(e.get(0)),s=Y(t.get(0),n,i);ht(t.get(0),n,s)}function dt(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(t){return e}}function pt(t){const e=new XMLHttpRequest;t.onProgress&&e.upload&&(e.upload.onprogress=e=>{e.total>0&&(e.percent=e.loaded/e.total*100),t.onProgress&&t.onProgress(e)});const i=new FormData,n=t.data||{};Object.keys(n).forEach((t=>{const e=n[t];Array.isArray(e)?e.forEach((e=>{i.append(`${t}[]`,e)})):i.append(t,e)}));const s=t.filename||"file";t.file instanceof Blob?i.append(s,t.file,t.file.name):i.append(s,t.file),e.onerror=e=>{t.onError&&t.onError(e)},e.onload=()=>{if(e.status<200||e.status>=300){if(!t.onError)return;return t.onError(function(t,e){const i=`Cannot ${t.method} ${t.action} ${e.status}'`,n=new Error(i);return n.status=e.status,n.method=t.method,n.url=t.action,n}(t,e),dt(e))}if(t.onSuccess)return t.onSuccess(dt(e),e)},e.open(t.method,t.action,!0),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);const o=t.headers||{};return null!==o["X-Requested-With"]&&e.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(o).forEach((t=>{null!==o[t]&&e.setRequestHeader(t,o[t])})),e.send(i),e}var ut=Object.freeze({__proto__:null,appendDeepest:P,camelCase:l,changeTagName:$,debug:A,denormalizeValue:m,encode:r,fixNumberedList:V,forEach:g,getCSS:v,getDeepest:O,inString:h,mergeNodes:N,modifierText:f,morph:ct,normalizeValue:u,parseStyle:p,query:I,removeBr:Z,removeZWS:D,request:pt,safeTemplate:a,setBlockIndent:F,splitNodes:M,template:s,toHex:d,toNodeList:w,wrapNodeList:H});class mt{constructor(t){this.fragment=null!=t?t:document.createDocumentFragment()}find(t){const e=[];let i=new T(this.fragment.firstChild);for(;i.length>0;)i.matches(t)?e.push(i.get(0)):i.isElement&&i.find(t).each((t=>{e.push(t)})),i=i.next();return new T(e)}append(t){t.each((t=>{this.fragment.appendChild(t)}))}}const ft="function"==typeof Buffer,gt="function"==typeof TextDecoder?new TextDecoder:void 0,vt="function"==typeof TextEncoder?new TextEncoder:void 0,wt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),yt=(t=>{let e={};return t.forEach(((t,i)=>e[t]=i)),e})(wt),xt=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,bt=String.fromCharCode.bind(String),kt="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),_t=t=>t.replace(/=/g,"").replace(/[+\/]/g,(t=>"+"==t?"-":"_")),St=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),Ct=t=>{let e,i,n,s,o="";const r=t.length%3;for(let r=0;r<t.length;){if((i=t.charCodeAt(r++))>255||(n=t.charCodeAt(r++))>255||(s=t.charCodeAt(r++))>255)throw new TypeError("invalid character found");e=i<<16|n<<8|s,o+=wt[e>>18&63]+wt[e>>12&63]+wt[e>>6&63]+wt[63&e]}return r?o.slice(0,r-3)+"===".substring(r):o},At="function"==typeof btoa?t=>btoa(t):ft?t=>Buffer.from(t,"binary").toString("base64"):Ct,Bt=ft?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let i=0,n=t.length;i<n;i+=4096)e.push(bt.apply(null,t.subarray(i,i+4096)));return At(e.join(""))},Lt=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?bt(192|e>>>6)+bt(128|63&e):bt(224|e>>>12&15)+bt(128|e>>>6&63)+bt(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return bt(240|e>>>18&7)+bt(128|e>>>12&63)+bt(128|e>>>6&63)+bt(128|63&e)},Tt=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,It=t=>t.replace(Tt,Lt),Et=ft?t=>Buffer.from(t,"utf8").toString("base64"):vt?t=>Bt(vt.encode(t)):t=>At(It(t)),Mt=(t,e=!1)=>e?_t(Et(t)):Et(t),Pt=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Zt=t=>{switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return bt(55296+(e>>>10))+bt(56320+(1023&e));case 3:return bt((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return bt((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},zt=t=>t.replace(Pt,Zt),Nt=t=>{if(t=t.replace(/\s+/g,""),!xt.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let e,i,n,s="";for(let o=0;o<t.length;)e=yt[t.charAt(o++)]<<18|yt[t.charAt(o++)]<<12|(i=yt[t.charAt(o++)])<<6|(n=yt[t.charAt(o++)]),s+=64===i?bt(e>>16&255):64===n?bt(e>>16&255,e>>8&255):bt(e>>16&255,e>>8&255,255&e);return s},Ot="function"==typeof atob?t=>atob(St(t)):ft?t=>Buffer.from(t,"base64").toString("binary"):Nt,Ht=ft?t=>kt(Buffer.from(t,"base64")):t=>kt(Ot(t).split("").map((t=>t.charCodeAt(0)))),Dt=ft?t=>Buffer.from(t,"base64").toString("utf8"):gt?t=>gt.decode(Ht(t)):t=>zt(Ot(t)),$t=t=>St(t.replace(/[-_]/g,(t=>"-"==t?"+":"/"))),Vt=t=>Dt($t(t)),Ft=Mt,Rt=Vt;var Wt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function jt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ut={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,n,o,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,o||t,r),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function r(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}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 t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];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(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,s,o,r){var a=i?i+t:t;if(!this._events[a])return!1;var l,h,c=this._events[a],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,s),!0;case 5:return c.fn.call(c.context,e,n,s,o),!0;case 6:return c.fn.call(c.context,e,n,s,o,r),!0}for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var p,u=c.length;for(h=0;h<u;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),d){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,n);break;case 4:c[h].fn.call(c[h].context,e,n,s);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(t,e,i){return o(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return o(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,s){var o=i?i+t:t;if(!this._events[o])return this;if(!e)return r(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||s&&!a.once||n&&a.context!==n||r(this,o);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==e||s&&!a[l].once||n&&a[l].context!==n)&&h.push(a[l]);h.length?this._events[o]=1===h.length?h[0]:h:r(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&r(this,e)):(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,t.exports=a}(Ut);var qt=jt(Ut.exports);const Kt=new Map,Gt=new Map,Xt={},Jt={},Yt=a`
1
+ var Lake=function(t){"use strict";class e extends HTMLElement{}customElements.define("lake-box",e);class i extends HTMLElement{}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>'],["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>'],["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>'],["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>'],["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>'],["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>'],["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(t,...e){let i=t[0];for(let n=0;n<e.length;n++){i+=String(e[n]),i+=t[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}const o=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],[" ","&nbsp;"]]);function r(t){return t.replace(/[&<>"\xA0]/g,(t=>{var e;return null!==(e=o.get(t))&&void 0!==e?e:""}))}function a(t,...e){let i=t[0];for(let n=0;n<e.length;n++){i+=r(String(e[n])),i+=t[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}function l(t){const e=t.split("-");let i="";return e.forEach(((t,e)=>{i+=e>0?t.charAt(0).toUpperCase()+t.substring(1):t})),i}function c(t,e,i){return void 0===i&&(i=","),(i+t+i).indexOf(i+e+i)>=0}function h(t){const e=Number.parseInt(t,10).toString(16).toLowerCase();return e.length>1?e:`0${e}`}function d(t){return t.replace(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)/gi,((t,e,i,n,s)=>void 0===s?`#${h(e)}${h(i)}${h(n)}`:`#${h(e)}${h(i)}${h(n)}${function(t){const e=Math.round(255*Number.parseFloat(t)).toString(16);return e.length>1?e:`0${e}`}(s)}`))}function p(t){t=t.replace(/&quot;/gi,'"');const e={},i=/\s*([\w-]+)\s*:([^;]*)(;|$)/g;let n;for(;null!==(n=i.exec(t));){const t=n[1].toLowerCase().trim(),i=d(n[2]).trim();e[t]=i}return e}function u(t){return t.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<anchor\s*\/>/gi,'<lake-bookmark type="anchor"></lake-bookmark>').replace(/<focus\s*\/>/gi,'<lake-bookmark type="focus"></lake-bookmark>')}function m(t){return t.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 f(t,e){const i=(e=null!=e?e:navigator.userAgent).indexOf("Mac OS X")>=0?"⌘":"Ctrl";return t.replace(/(^|\+|\s)mod(\+|\s|$)/g,`$1${i}$2`)}function g(t,e){for(const i in t)if(!1===e(i,t[i]))break}function v(t,e){const i=l(e),n=window.getComputedStyle(t,null);return d(t.style[i]||n.getPropertyValue(e)||"")}function w(t,e){const i=[];if("string"!=typeof t)return i.push(t),i;if(""===t)return i;if("text"===e){const e=document.createTextNode(t);return i.push(e),i}if("html"===e||/<.+>/.test(t)){const e=document.createElement("div");e.innerHTML=t;for(const t of e.childNodes)i.push(t);return i}const n=document.querySelectorAll(t);for(const t of n)i.push(t);return i}const y=Node,x=new Set(["h1","h2","h3","h4","h5","h6","div","p","blockquote","ul","ol","li","table","tr","th","td"]),b=new Set(["span","strong","em","i","u","s","sup","sub","code"]),k=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_=new Set(["h1","h2","h3","h4","h5","h6"]),S=new Set(["ol","ul","li"]),A=new Set(["table","tr","td"]);function C(...t){window.LAKE_DEBUG&&console.log.apply(console.log,t)}const B={};let E=0;class T{constructor(t){t=null!=t?t:[],this.nodeList=Array.isArray(t)?t:[t];for(let t=0;t<this.nodeList.length;t++)this.nodeList[t].lakeId||(this.nodeList[t].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===y.ELEMENT_NODE}get isText(){if(0===this.length)return!1;return this.get(0).nodeType===y.TEXT_NODE}get isBlock(){return 0!==this.length&&x.has(this.name)}get isMark(){return 0!==this.length&&b.has(this.name)}get isVoid(){return 0!==this.length&&k.has(this.name)}get isHeading(){return 0!==this.length&&_.has(this.name)}get isList(){return 0!==this.length&&S.has(this.name)}get isTable(){return 0!==this.length&&A.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 t=this.get(0);return this.isElement&&"true"===t.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 t=this.parent();return 0!==t.length&&(this.isInside&&t.isContainer)}get isContentEditable(){if(0===this.length)return!1;if(this.isText){const t=this.get(0).parentNode;return!!t&&t.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 t=this.text(),e=""===t||/^[\r\n\u200B\u2060]+$/.test(t);return this.isElement&&e?0===this.find("lake-box").length:e}isSibling(t){if(0===this.length)return!1;const e=this.get(0).parentNode;return e&&e===t.parent().get(0)}get(t){return this.nodeList[t]}getAll(){return this.nodeList}eq(t){const e=this.get(t);return new T(e)}each(t){const e=this.getAll();for(let i=0;i<e.length;i++)if(!1===t(e[i],i))return this;return this}eachElement(t){const e=this.getAll();for(let i=0;i<e.length;i++)if(e[i].nodeType===y.ELEMENT_NODE&&!1===t(e[i],i))return this;return this}reverse(){const t=this.getAll().reverse();return new T(t)}matches(t){if(!this.isElement)return!1;return this.get(0).matches(t)}find(t){if("string"==typeof t){const e=this.get(0).querySelectorAll(t);return new T(Array.from(e))}let e=this.eq(0);for(const i of t)if(e=e.children()[i],!e)return new T;return e}closest(t){if(this.isText){const e=this.get(0).parentNode;return e?new T(e.closest(t)):new T}if(!this.isElement)return new T;const e=this.get(0);return new T(e.closest(t))}closestBlock(){let t=this.eq(0);for(;t.length>0&&!t.isTopInside&&!t.isBlock;)t=t.parent();return t.isBlock?t:new T}closestOperableBlock(){const t=this.closest("lake-box"),e=t.length>0?t.closestBlock():this.closestBlock();if(0===e.length)return e;if(e.isTable)return new T;const i=e.parent();return"li"===e.name&&i.isList?i:e}closestContainer(){return this.closest('div[contenteditable="true"]')}parent(){const t=this.get(0);return new T(t.parentNode)}prev(){const t=this.get(0);return new T(t.previousSibling)}next(){const t=this.get(0);return new T(t.nextSibling)}first(){const t=this.get(0);return new T(t.firstChild)}last(){const t=this.get(0);return new T(t.lastChild)}index(){let t=-1,e=this.get(0);for(;e;)t++,e=e.previousSibling;return t}path(){const t=[];let e=this.eq(0);if(e.isContainer)return t;for(;e.length>0;){const i=e.parent();if(0===i.length)break;if(t.push(e.index()),i.isContainer)break;e=i}return t.reverse()}children(){const t=[];let e=this.first();for(;e.length>0;)t.push(e),e=e.next();return t}*getWalker(){for(const t of function*t(e){if(e.isBox)return;let i=e.first();for(;i.length>0;){const e=i.next();yield i,yield*t(i),i=e}}(this.eq(0)))yield t}on(t,e){return this.eachElement((i=>{i.addEventListener(t,e,!1);const n=i.lakeId;B[n]||(B[n]=[]),B[n].push({type:t,listener:e})}))}off(t,e){return this.eachElement((i=>{var n;const s=i.lakeId,o=null!==(n=B[s])&&void 0!==n?n:[];o.forEach(((n,s)=>{t&&(t!==n.type||e&&e!==n.listener)||(i.removeEventListener(n.type,n.listener,!1),o[s]={type:"",listener:()=>{}})})),B[s]=o.filter((t=>""!==t.type))}))}emit(t,e){return this.eachElement((i=>{const n=i.lakeId;B[n].forEach((i=>{i.type===t&&i.listener(null!=e?e:new Event(t))}))}))}getEventListeners(t){const e=this.get(t).lakeId;return B[e]}focus(){return this.get(0).focus(),this}blur(){return this.get(0).blur(),this}clone(t=!1){const e=this.get(0);return new T(e.cloneNode(t))}hasAttr(t){return this.get(0).hasAttribute(t)}attr(t,e){var i;if("object"==typeof t)return g(t,((t,e)=>{this.attr(t,e)})),this;if(void 0===e){return null!==(i=this.get(0).getAttribute(t))&&void 0!==i?i:""}return this.eachElement((i=>{i.setAttribute(t,e)}))}removeAttr(t){return this.eachElement((e=>{e.removeAttribute(t)}))}hasClass(t){return c(this.get(0).className,t," ")}addClass(t){return Array.isArray(t)?(t.forEach((t=>{this.addClass(t)})),this):this.eachElement((e=>{c(e.className,t," ")||e.classList.add(t)}))}removeClass(t){return Array.isArray(t)?(t.forEach((t=>{this.removeClass(t)})),this):this.eachElement((e=>{c(e.className,t," ")&&(e.classList.remove(t),""===e.className&&e.removeAttribute("class"))}))}computedCSS(t){return v(this.get(0),t)}css(t,e){if("object"==typeof t)return g(t,((t,e)=>{this.css(t,e)})),this;if(void 0===e){return d(this.get(0).style[l(t)])}return this.eachElement((i=>{i.style[l(t)]=e,""===i.getAttribute("style")&&i.removeAttribute("style")}))}width(){return this.get(0).offsetWidth}innerWidth(){const t=parseInt(this.computedCSS("padding-left"),10)||0,e=parseInt(this.computedCSS("padding-right"),10)||0;return this.width()-t-e}height(){return this.get(0).offsetHeight}show(t="block"){return this.css("display",t),this}hide(){return this.css("display","none"),this}html(t){if(void 0===t){return this.get(0).innerHTML}return this.eachElement((e=>{e.innerHTML=t}))}text(t){var e;if(void 0===t){const t=this.get(0);if(this.isText)return null!==(e=t.nodeValue)&&void 0!==e?e:"";return t.innerText.replace(/^\n+|\n+$/,"")}return this.eachElement((e=>{e.innerText=t}))}outerHTML(){return this.get(0).outerHTML}empty(){return this.html(""),this}prepend(t){if("string"==typeof t)return this.eachElement((e=>{w(t).reverse().forEach((t=>{e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t),this}append(t){if("string"==typeof t)return this.eachElement((e=>{w(t).forEach((t=>{e.appendChild(t)}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.appendChild(t),this}before(t){if("string"==typeof t)return this.each((e=>{w(t).forEach((t=>{e.parentNode&&e.parentNode.insertBefore(t,e)}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.parentNode?(e.parentNode.insertBefore(t,e),this):this}after(t){if("string"==typeof t)return this.each((e=>{w(t).reverse().forEach((t=>{e.parentNode&&(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t))}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.parentNode?(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),this):this}replaceWith(t){return this.each((e=>{let i;i=t instanceof T?t.get(0):w(t)[0],e.parentNode&&e.parentNode.replaceChild(i,e)}))}remove(t=!1){return this.each((e=>{if(e.parentNode){if(t){let t=e.firstChild;for(;t;){const i=t.nextSibling;e.parentNode.insertBefore(t,e),t=i}}e.parentNode.removeChild(e)}})),this}splitText(t){if(!this.isText)return new T;const e=this.get(0).splitText(t);return new T(e)}toString(){if(0===this.length)return"";const t=this.get(0);let e=this.isText?t.nodeValue:this.outerHTML();return e&&e.length>50&&(e=`${e.substring(0,50)} ...`),`node (${t.lakeId}): ${e}`}debug(){C(this.toString())}}function I(t){if(t instanceof T)return t;const e=w(t);return new T(e)}class L{constructor(t){this.range=null!=t?t: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 t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return this.compareBeforeNode(e)>=0}get isBoxCenter(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return this.isCollapsed&&this.startNode.get(0)===e.get(0)&&0===this.startOffset}get isBoxEnd(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return this.compareAfterNode(e)<=0}get isInsideBox(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return(!this.isCollapsed||this.startNode.get(0)!==e.get(0)||0!==this.startOffset)&&(this.compareBeforeNode(e)<0&&this.compareAfterNode(e)>0)}get isInoperative(){if(this.commonAncestor.isOutside)return!0;const t=this.startNode.closest("td"),e=this.endNode.closest("td");return t.length>0&&e.length>0&&t.get(0)!==e.get(0)}get(){return this.range}comparePoint(t,e){return this.range.comparePoint(t.get(0),e)}compareBeforeNode(t){const e=new L;return t.isText?e.setStart(t,0):e.setStartBefore(t),e.collapseToStart(),this.comparePoint(e.startNode,e.startOffset)}compareAfterNode(t){var e;const i=new L;if(t.isText){const n=null!==(e=t.get(0).nodeValue)&&void 0!==e?e:"";i.setStart(t,n.length)}else i.setStartAfter(t);return i.collapseToStart(),this.comparePoint(i.startNode,i.startOffset)}intersectsNode(t){return this.range.intersectsNode(t.get(0))}setStart(t,e){this.range.setStart(t.get(0),e)}setStartBefore(t){this.range.setStartBefore(t.get(0))}setStartAfter(t){this.range.setStartAfter(t.get(0))}setEnd(t,e){this.range.setEnd(t.get(0),e)}setEndBefore(t){this.range.setEndBefore(t.get(0))}setEndAfter(t){this.range.setEndAfter(t.get(0))}collapseToStart(){this.range.collapse(!0)}collapseToEnd(){this.range.collapse(!1)}selectNode(t){this.range.selectNode(t.get(0))}selectNodeContents(t){this.range.selectNodeContents(t.get(0))}selectBox(t){const e=t.find(".lake-box-container");if(0===e.length)throw new Error(`The box cannot be selected because the box '${t.attr("name")}' (id=${t.id}) has not been rendered yet.`);this.setStart(e,0),this.collapseToStart()}selectBoxStart(t){const e=t.find(".lake-box-strip");if(0===e.length)throw new Error(`The box cannot be selected because the box '${t.attr("name")}' (id=${t.id}) has not been rendered yet.`);this.selectNodeContents(e.eq(0)),this.collapseToStart()}selectBoxEnd(t){const e=t.find(".lake-box-strip");if(0===e.length)throw new Error(`The box cannot be selected because the box '${t.attr("name")}' (id=${t.id}) has not been rendered yet.`);this.selectNodeContents(e.eq(1)),this.collapseToStart()}shrinkBefore(t){if(t.isBox)return void this.selectBoxStart(t);if(t.isText)return this.setStartBefore(t),void this.collapseToStart();let e;for(this.setStart(t,0);this.startNode.isElement&&(e=this.startNode.children()[0])&&e.isElement&&!e.isVoid;){if(e.isBox)return void this.selectBoxStart(e);this.setStart(e,0)}this.collapseToStart()}shrinkAfter(t){if(t.isBox)return void this.selectBoxEnd(t);if(t.isText)return this.setEndAfter(t),void this.collapseToEnd();let e;for(this.setEnd(t,t.children().length);this.endNode.isElement&&this.endOffset>0&&(e=this.endNode.children()[this.endOffset-1])&&e.isElement&&!e.isVoid;){if(e.isBox)return void this.selectBoxEnd(e);this.setEnd(e,e.children().length)}this.collapseToEnd()}shrink(){const t=this.isCollapsed;let e;for(;this.startNode.isElement&&(e=this.startNode.children()[this.startOffset])&&e.isElement&&!e.isVoid&&!e.isBox;)this.setStart(e,0);if(t)this.collapseToStart();else for(;this.endNode.isElement&&this.endOffset>0&&(e=this.endNode.children()[this.endOffset-1])&&e.isElement&&!e.isVoid&&!e.isBox;)this.setEnd(e,e.children().length)}adaptBox(){const t=this.startNode.closest("lake-box");if(t.length>0){const e=this.clone();e.collapseToStart(),e.isBoxEnd?this.setStartAfter(t):this.setStartBefore(t)}const e=this.endNode.closest("lake-box");if(e.length>0){const t=this.clone();t.collapseToEnd(),t.isBoxStart?this.setEndBefore(e):this.setEndAfter(e)}}adaptTable(){const t=this.startNode.closest("table"),e=this.endNode.closest("table");if(0===t.length&&e.length>0&&e.isInside)return this.setEndBefore(e),void this.shrink();0===e.length&&t.length>0&&t.isInside&&(this.setStartAfter(t),this.shrink())}adaptBlock(){if(!this.isCollapsed){if(this.endNode.isElement&&0===this.endOffset){let t=this.endNode;for(;0===t.prev().length;)t=t.parent();this.setEndBefore(t)}return void this.shrink()}if(this.startNode.isText)return;const t=this.startNode.children()[this.startOffset];t&&(t.isBlockBox||t.isBlock)&&this.shrinkBefore(t)}adapt(){this.adaptBox(),this.adaptTable(),this.adaptBlock()}getPrevNode(){let t;return t=this.startNode.isText?0===this.startOffset?this.startNode.prev():this.startNode:this.startNode.children()[this.startOffset-1],null!=t?t:new T}getNextNode(){let t;return t=this.endNode.isText?this.endOffset===this.endNode.text().length?this.endNode.next():this.endNode:this.endNode.children()[this.endOffset],null!=t?t:new T}getBoxes(){if(this.isCollapsed){const t=this.startNode.closest("lake-box");return t.length>0?[t]:[]}const t=[],e=this.clone();e.adaptBox();for(const i of e.commonAncestor.getWalker())i.isBox&&e.intersectsNode(i)&&t.push(i);return t}getBlocks(){if(this.isCollapsed){const t=this.startNode.closestOperableBlock();return t.isTable?[]:t.isInside?[t]:[]}const t=this.startNode.closestOperableBlock(),e=this.endNode.closestOperableBlock();if(t.isInside&&t.get(0)&&t.get(0)===e.get(0))return t.isTable?[]:[t];const i=[],n=this.clone();n.collapseToEnd();for(const t of this.commonAncestor.getWalker())t.isBlock&&!t.isTable&&t.isTopInside&&0!==n.comparePoint(t,0)&&this.intersectsNode(t)&&i.push(t);if(i.length>0)return i;for(const n of this.commonAncestor.getWalker())n.isBlock&&!n.isTable&&(t.isSibling(n)||e.isSibling(n))&&this.intersectsNode(n)&&i.push(n);return i}getMarks(t=!1){const e=[];if(this.commonAncestor.isText&&t&&0===this.startOffset&&this.endOffset===this.commonAncestor.text().length)return e.push(this.commonAncestor),e;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&&t)&&e.push(s)}return e}getStartText(){const t=this.startNode,e=this.startOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new L;n.setStartBefore(i),n.setEnd(t,e);const s=I("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"​":o}getEndText(){const t=this.endNode,e=this.endOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new L;n.setStart(t,e),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 L(this.range.cloneRange())}cloneContents(){return this.range.cloneContents()}debug(){C("--- range information ---"),C("start node:",this.startNode.toString(),", offset:",this.startOffset),C("end node:",this.endNode.toString(),", offset:",this.endOffset)}}function M(t,e,i){const n=new L;let s;if(t.isText){s=t.parent();const i=t.splitText(e);n.setStartAfter(t),""===t.text()&&t.remove(),""===i.text()&&i.remove()}else n.setStart(t,e),s=t;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 t=r.next();o.append(r),r=t}return s.before(o),s.parent().length>0&&s.parent().get(0)!==i.get(0)?M(s.parent(),s.index(),i):{start:o,end:s}}function P(t,e){let i=t;for(;i.length>0;){let t=i.first();for(;t.isText&&t.isEmpty;)t=t.next();if(i.isText||i.isBox)break;if(i.isElement&&1===i.children().length&&t.isBookmark){i.prepend(e);break}if(i.isElement&&!i.isVoid&&0===t.length){i.append(e);break}i=t}}function O(t){if(0===t.length)return;const e=[];let i=t.first();for(;i.length>0;){const t=i.next();i.isText&&""===i.text()||e.push(i),i=t}(1===e.length&&"br"===e[0].name||2===e.length&&"br"===e[0].name&&e[1].isBookmark)&&e[0].remove(),2===e.length&&e[0].isBookmark&&"br"===e[1].name&&e[1].remove()}function z(t){if(t.isText)return{node:t,offset:t.text().length};const e=new L;return e.setEndAfter(t),{node:e.endNode,offset:e.endOffset}}function Z(t,e){const i=e;if(["ul","ol"].indexOf(t.name)>=0){const e=t.find("li");t=e.eq(e.length-1)}if(["ul","ol"].indexOf(e.name)>=0){const t=e.find("li");e=t.eq(0)}if(t.isText||e.isText||t.isVoid||e.isVoid)return z(t);O(t),O(e),t.isBlock&&t.isEmpty&&e.isEmpty&&P(t,I("<br />"));const n=t.last(),s=e.first();let o=s;for(;o.length>0;){const e=o.next();t.append(o),o=e}return i.remove(),n.length>0&&s.length>0&&n.isElement&&!n.isBox&&n.clone(!1).get(0).isEqualNode(s.clone(!1).get(0))?Z(n,s):0===n.length?{node:t,offset:0}:z(n)}function N(t){let e=t;for(;e.length>0;){let t=e.first();if(t.isText&&t.isEmpty&&(t=t.next()),e.isElement&&!e.isVoid&&0===t.length)break;e=t}return e}function H(t,e){if(e=null!=e?e:I("<p />"),0===t.length)return e;const i=N(e=e.clone(!0));return t[0].before(e),t.forEach((t=>{i.append(t)})),e}function D(t){for(const e of t.getWalker())if(e.isText&&e.text().length>1){const t=e.text();/\u200B/.test(e.text())&&(e.get(0).nodeValue=t.replace(/\u200B/g,""))}}function $(t,e){const i=t.get(0),n=I(a`<${e} />`);for(const t of i.attributes)n.attr(t.name,t.value);let s=t.first();for(;s.length>0;){const t=s.next();n.append(s),s=t}return t.replaceWith(n),n}function V(t){if(0===t.length)return;const e=t[0],i=t[t.length-1],n=[];let s=e.prev();for(;s.length>0&&"ol"===s.name;)n.push(s),s=s.prev();n.reverse(),n.push(...t);let o=i.next();for(;o.length>0&&"ol"===o.name;)n.push(o),o=o.next();let r=1;for(const t of n){const e=t.prev();if(0!==e.length&&"ol"===e.name||(r=1),"ol"===t.name){"ol"===e.name&&e.attr("indent")!==t.attr("indent")&&(r=1);const i=t.attr("start"),n=r.toString(10);i!==n&&t.attr("start",n),r++}}}function F(t,e){if(t.isList){let i=Number.parseInt(t.attr("indent"),10)||0;if("increase"===e?i++:i--,i<=0)i=0;else if(i>10)return;return 0===i?t.removeAttr("indent"):t.attr("indent",i.toString(10)),void V([t])}let i=Number.parseInt(t.css("margin-left"),10)||0;"decrease"!==e||0!==i||""===t.css("text-indent")?("increase"===e?i+=40:i-=40,i<=0&&(i=0),0===i?t.css("margin-left",""):t.css("margin-left",`${i}px`)):t.css("text-indent","")}const j=new Set;function R(){}const W={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:R,afterNodeAdded:R,beforeNodeMorphed:R,afterNodeMorphed:R,beforeNodeRemoved:R,afterNodeRemoved:R,beforeAttributeUpdated:R,afterAttributeUpdated:R,beforeChildrenUpdated:R},head:{style:"merge",shouldPreserve:t=>"true"===t.getAttribute("im-preserve"),shouldReAppend:t=>"true"===t.getAttribute("im-re-append"),shouldRemove:R,afterHeadMorphed:R}};function U(t,e){return!t.deadIds.has(e)}function q(t,e,i){return(t.idMap.get(i)||j).has(e)}function K(t,e){const i=t.idMap.get(e)||j;for(const e of i)t.deadIds.add(e)}function G(t,e,i){const n=t.idMap.get(e)||j;let s=0;for(const e of n)U(t,e)&&q(t,e,i)&&++s;return s}function X(t,e){const i=t.parentElement,n=t.querySelectorAll("[id]");for(const t of n){let n=t;for(;n!==i&&null!=n;){let i=e.get(n);null==i&&(i=new Set,e.set(n,i)),i.add(t.id),n=n.parentElement}}}function J(t,e){const i=new Map;return X(t,i),X(e,i),i}function Y(t,e,i){return{target:t,newContent:e,config:i=function(t){const e={};return Object.assign(e,W),Object.assign(e,t),e.callbacks={},Object.assign(e.callbacks,W.callbacks),Object.assign(e.callbacks,t.callbacks),e.head={},Object.assign(e.head,W.head),Object.assign(e.head,t.head),e}(i),morphStyle:i.morphStyle,ignoreActive:i.ignoreActive,ignoreActiveValue:i.ignoreActiveValue,idMap:J(t,e),deadIds:new Set,callbacks:i.callbacks,head:i.head}}function Q(t,e,i){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName&&(""!==t.id&&t.id===e.id||G(i,t,e)>0))}function tt(t,e){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName)}function et(t,e){K(e,t),!1!==e.callbacks.beforeNodeRemoved(t)&&(t.remove(),e.callbacks.afterNodeRemoved(t))}function it(t,e,i){let n=t;for(;n&&n!==e;){const t=n;n=n.nextSibling,et(t,i)}return K(i,e),e.nextSibling}function nt(t,e,i,n,s){const o=G(s,i,e);let r=null;if(o>0){r=n;let e=0;for(;null!=r;){if(Q(i,r,s))return r;if(e+=G(s,r,t),e>o)return null;r=r.nextSibling}}return r}function st(t,e,i,n,s){let o=n,r=i.nextSibling,a=0;for(;null!=o;){if(G(s,o,t)>0)return null;if(tt(i,o))return o;if(tt(r,o)&&(a++,r=r?r.nextSibling:null,a>=2))return null;o=o?o.nextSibling:null}return o}function ot(t,e,i){return tt(t,e)?.5+G(i,t,e):0}function rt(t,e,i,n){return!("value"!==t||!n.ignoreActiveValue||e!==document.activeElement)||!1===n.callbacks.beforeAttributeUpdated(t,e,i)}function at(t,e,i){var n;if(!i.ignoreActive||t!==document.activeElement)return null==e?!1===i.callbacks.beforeNodeRemoved(t)?t:(t.remove(),i.callbacks.afterNodeRemoved(t),null):tt(t,e)?(!1===i.callbacks.beforeNodeMorphed(t,e)||(function(t,e,i){const n=t.nodeType;if(1===n){const n=t.attributes,s=e.attributes;for(const t of n)rt(t.name,e,"update",i)||e.getAttribute(t.name)!==t.value&&(e.setAttribute(t.name,t.value),i.callbacks.afterAttributeUpdated(t.name,e,"update"));for(let n=s.length-1;n>=0;n--){const o=s[n];rt(o.name,e,"remove",i)||t.hasAttribute(o.name)||(e.removeAttribute(o.name),i.callbacks.afterAttributeUpdated(o.name,e,"remove"))}}8!==n&&3!==n||e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue)}(e,t,i),!1===i.callbacks.beforeChildrenUpdated(t,e)||function(t,e){return e.ignoreActiveValue&&t===document.activeElement}(t,i)||lt(e,t,i),i.callbacks.afterNodeMorphed(t,e)),t):!1===i.callbacks.beforeNodeRemoved(t)||!1===i.callbacks.beforeNodeAdded(e)?t:(null===(n=t.parentElement)||void 0===n||n.replaceChild(e,t),i.callbacks.afterNodeAdded(e),i.callbacks.afterNodeRemoved(t),e)}function lt(t,e,i){let n,s=t.firstChild,o=e.firstChild;for(;s;){if(n=s,s=n.nextSibling,null==o){if(!1===i.callbacks.beforeNodeAdded(n))return;e.appendChild(n),i.callbacks.afterNodeAdded(n),K(i,n);continue}if(Q(n,o,i)){at(o,n,i),o=o.nextSibling,K(i,n);continue}const r=nt(t,e,n,o,i);if(r){o=it(o,r,i),at(r,n,i),K(i,n);continue}const a=st(t,0,n,o,i);if(a)o=it(o,a,i),at(a,n,i),K(i,n);else{if(!1===i.callbacks.beforeNodeAdded(n))return;e.insertBefore(n,o),i.callbacks.afterNodeAdded(n),K(i,n)}}for(;null!==o;){const t=o;o=o.nextSibling,et(t,i)}}function ct(t,e,i){if("innerHTML"===i.morphStyle)return lt(e,t,i),t.children;if("outerHTML"===i.morphStyle||null==i.morphStyle){const n=function(t,e,i){let n;n=t.firstChild;let s=n,o=0;for(;n;){const t=ot(n,e,i);t>o&&(s=n,o=t),n=n.nextSibling}return s}(e,t,i),s=null==n?void 0:n.previousSibling,o=null==n?void 0:n.nextSibling,r=at(t,n,i);return n?function(t,e,i){var n,s;const o=[],r=[];let a=t;for(;null!=a;)o.push(a),a=a.previousSibling;for(;o.length>0;){const t=o.pop();r.push(t),t&&(null===(n=e.parentElement)||void 0===n||n.insertBefore(t,e))}r.push(e);let l=i;for(;null!=l;)o.push(l),r.push(l),l=l.nextSibling;for(;o.length>0;){const t=o.pop();t&&(null===(s=e.parentElement)||void 0===s||s.insertBefore(t,e.nextSibling))}return r}(s,r,o):[]}throw`Do not understand how to morph style ${i.morphStyle}`}function ht(t,e,i={}){const n=function(t){if(null==t)return document.createElement("div");if(t instanceof Node){if(t.generatedByIdiomorph)return t;const e=document.createElement("div");return e.append(t),e}const e=document.createElement("div");for(const i of[...t])e.append(i);return e}(e.get(0)),s=Y(t.get(0),n,i);ct(t.get(0),n,s)}function dt(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(t){return e}}function pt(t){const e=new XMLHttpRequest;t.onProgress&&e.upload&&(e.upload.onprogress=e=>{e.total>0&&(e.percent=e.loaded/e.total*100),t.onProgress&&t.onProgress(e)});const i=new FormData,n=t.data||{};Object.keys(n).forEach((t=>{const e=n[t];Array.isArray(e)?e.forEach((e=>{i.append(`${t}[]`,e)})):i.append(t,e)}));const s=t.filename||"file";t.file instanceof Blob?i.append(s,t.file,t.file.name):i.append(s,t.file),e.onerror=e=>{t.onError&&t.onError(e)},e.onload=()=>{if(e.status<200||e.status>=300){if(!t.onError)return;return t.onError(function(t,e){const i=`Cannot ${t.method} ${t.action} ${e.status}'`,n=new Error(i);return n.status=e.status,n.method=t.method,n.url=t.action,n}(t,e),dt(e))}if(t.onSuccess)return t.onSuccess(dt(e),e)},e.open(t.method,t.action,!0),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);const o=t.headers||{};return null!==o["X-Requested-With"]&&e.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(o).forEach((t=>{null!==o[t]&&e.setRequestHeader(t,o[t])})),e.send(i),e}var ut=Object.freeze({__proto__:null,appendDeepest:P,camelCase:l,changeTagName:$,debug:C,denormalizeValue:m,encode:r,fixNumberedList:V,forEach:g,getCSS:v,getDeepest:N,inString:c,mergeNodes:Z,modifierText:f,morph:ht,normalizeValue:u,parseStyle:p,query:I,removeBr:O,removeZWS:D,request:pt,safeTemplate:a,setBlockIndent:F,splitNodes:M,template:s,toHex:d,toNodeList:w,wrapNodeList:H});class mt{constructor(t){this.fragment=null!=t?t:document.createDocumentFragment()}find(t){const e=[];let i=new T(this.fragment.firstChild);for(;i.length>0;)i.matches(t)?e.push(i.get(0)):i.isElement&&i.find(t).each((t=>{e.push(t)})),i=i.next();return new T(e)}append(t){t.each((t=>{this.fragment.appendChild(t)}))}}const ft="function"==typeof Buffer,gt="function"==typeof TextDecoder?new TextDecoder:void 0,vt="function"==typeof TextEncoder?new TextEncoder:void 0,wt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),yt=(t=>{let e={};return t.forEach(((t,i)=>e[t]=i)),e})(wt),xt=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,bt=String.fromCharCode.bind(String),kt="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),_t=t=>t.replace(/=/g,"").replace(/[+\/]/g,(t=>"+"==t?"-":"_")),St=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),At=t=>{let e,i,n,s,o="";const r=t.length%3;for(let r=0;r<t.length;){if((i=t.charCodeAt(r++))>255||(n=t.charCodeAt(r++))>255||(s=t.charCodeAt(r++))>255)throw new TypeError("invalid character found");e=i<<16|n<<8|s,o+=wt[e>>18&63]+wt[e>>12&63]+wt[e>>6&63]+wt[63&e]}return r?o.slice(0,r-3)+"===".substring(r):o},Ct="function"==typeof btoa?t=>btoa(t):ft?t=>Buffer.from(t,"binary").toString("base64"):At,Bt=ft?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let i=0,n=t.length;i<n;i+=4096)e.push(bt.apply(null,t.subarray(i,i+4096)));return Ct(e.join(""))},Et=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?bt(192|e>>>6)+bt(128|63&e):bt(224|e>>>12&15)+bt(128|e>>>6&63)+bt(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return bt(240|e>>>18&7)+bt(128|e>>>12&63)+bt(128|e>>>6&63)+bt(128|63&e)},Tt=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,It=t=>t.replace(Tt,Et),Lt=ft?t=>Buffer.from(t,"utf8").toString("base64"):vt?t=>Bt(vt.encode(t)):t=>Ct(It(t)),Mt=(t,e=!1)=>e?_t(Lt(t)):Lt(t),Pt=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ot=t=>{switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return bt(55296+(e>>>10))+bt(56320+(1023&e));case 3:return bt((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return bt((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},zt=t=>t.replace(Pt,Ot),Zt=t=>{if(t=t.replace(/\s+/g,""),!xt.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let e,i,n,s="";for(let o=0;o<t.length;)e=yt[t.charAt(o++)]<<18|yt[t.charAt(o++)]<<12|(i=yt[t.charAt(o++)])<<6|(n=yt[t.charAt(o++)]),s+=64===i?bt(e>>16&255):64===n?bt(e>>16&255,e>>8&255):bt(e>>16&255,e>>8&255,255&e);return s},Nt="function"==typeof atob?t=>atob(St(t)):ft?t=>Buffer.from(t,"base64").toString("binary"):Zt,Ht=ft?t=>kt(Buffer.from(t,"base64")):t=>kt(Nt(t).split("").map((t=>t.charCodeAt(0)))),Dt=ft?t=>Buffer.from(t,"base64").toString("utf8"):gt?t=>gt.decode(Ht(t)):t=>zt(Nt(t)),$t=t=>St(t.replace(/[-_]/g,(t=>"-"==t?"+":"/"))),Vt=t=>Dt($t(t)),Ft=Mt,jt=Vt;var Rt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Wt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ut={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,n,o,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,o||t,r),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function r(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}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 t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];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(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,s,o,r){var a=i?i+t:t;if(!this._events[a])return!1;var l,c,h=this._events[a],d=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),d){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,n),!0;case 4:return h.fn.call(h.context,e,n,s),!0;case 5:return h.fn.call(h.context,e,n,s,o),!0;case 6:return h.fn.call(h.context,e,n,s,o,r),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];h.fn.apply(h.context,l)}else{var p,u=h.length;for(c=0;c<u;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,!0),d){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,e);break;case 3:h[c].fn.call(h[c].context,e,n);break;case 4:h[c].fn.call(h[c].context,e,n,s);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];h[c].fn.apply(h[c].context,l)}}return!0},a.prototype.on=function(t,e,i){return o(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return o(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,s){var o=i?i+t:t;if(!this._events[o])return this;if(!e)return r(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||s&&!a.once||n&&a.context!==n||r(this,o);else{for(var l=0,c=[],h=a.length;l<h;l++)(a[l].fn!==e||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(t){var e;return t?(e=i?i+t:t,this._events[e]&&r(this,e)):(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,t.exports=a}(Ut);var qt=Wt(Ut.exports);const Kt=new Map,Gt=new Map,Xt={},Jt={},Yt=a`
2
2
  <span class="lake-box-strip"><br /></span>
3
3
  <div class="lake-box-container" contenteditable="false"></div>
4
4
  <span class="lake-box-strip"><br /></span>
5
- `;class Qt{constructor(t){if(this.event=new qt,"string"==typeof t){const e=Kt.get(t);if(void 0===e)throw new Error(`Box '${t}' has not been defined yet.`);const i=r(e.type),n=r(e.name);this.node=I(a`<lake-box type="${i}" name="${n}"></lake-box>`),e.value&&(this.value=e.value)}else{this.node=I(t);const e=Kt.get(this.name);if(void 0===e)throw new Error(`Box '${this.name}' has not been defined yet.`);e.value&&!this.node.hasAttr("value")&&(this.value=e.value)}Xt[this.node.id]||(Xt[this.node.id]={}),Jt[this.node.id]||(Jt[this.node.id]={setup:[],cleanup:[]})}addFramework(){let t=this.getContainer();0===t.length?(this.node.html(Yt),t=this.getContainer()):(t.off("mouseenter"),t.off("mouseleave"),t.off("click")),t.on("mouseenter",(()=>{t.hasClass("lake-box-selected")||t.hasClass("lake-box-focused")||t.hasClass("lake-box-activated")||t.addClass("lake-box-hovered")})),t.on("mouseleave",(()=>{t.removeClass("lake-box-hovered")})),t.on("click",(()=>{A(`Box '${this.name}' (id = ${this.node.id}) value:`),A(this.value)}))}get type(){return this.node.attr("type")}get name(){return this.node.attr("name")}get value(){const t=this.node.attr("value");return""===t?{}:JSON.parse(Rt(t))}set value(t){this.node.attr("value",Ft(JSON.stringify(t)))}updateValue(t,e){const i=this.value;"string"==typeof t?i[t]=e:g(t,((t,e)=>{i[t]=e})),this.value=i}getData(t){return Xt[this.node.id][t]}setData(t,e){Xt[this.node.id][t]=e}getEditor(){const t=this.node.closest("div[contenteditable]");return t.length>0?Gt.get(t.id):void 0}getContainer(){return this.node.find(".lake-box-container")}useEffect(t){Jt[this.node.id].setup.push(t)}render(){Jt[this.node.id].setup=[],Jt[this.node.id].cleanup=[];const t=Kt.get(this.name);if(void 0===t)return;this.addFramework();const e=t.render(this);if(void 0!==e){const t=this.getContainer(),i=t.clone(!1);i.append(e),ct(t,i)}for(const t of Jt[this.node.id].setup){const e=t();void 0!==e&&Jt[this.node.id].cleanup.push(e)}A(`Box '${this.name}' (id = ${this.node.id}) rendered`)}unmount(){for(const t of Jt[this.node.id].cleanup)t();Xt[this.node.id]={},Jt[this.node.id].setup=[],Jt[this.node.id].cleanup=[],this.node.empty(),A(`Box '${this.name}' (id = ${this.node.id}) unmounted`)}getHTML(){const t=Kt.get(this.name);return void 0===t?"":void 0===t.html?this.node.outerHTML():t.html(this)}}const te={id:/^[\w-]+$/,class:/^[\w-]+$/,style:{"text-align":["left","center","right","justify","start","end"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function ee(){return{h1:Object.assign({},te),h2:Object.assign({},te),h3:Object.assign({},te),h4:Object.assign({},te),h5:Object.assign({},te),h6:Object.assign({},te),p:Object.assign({},te),blockquote:Object.assign(Object.assign({},te),{type:["success","info","warning","error"]}),ul:Object.assign(Object.assign({},te),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},te),{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:["left","center","right"]},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 ie{constructor(t,e=ee()){this.rules=e,this.source="string"==typeof t?this.parseHTML(t):t}parseHTML(t){const e=(new DOMParser).parseFromString(t,"text/html");return new T(e.querySelector("body"))}static matchRule(t,e){return"string"==typeof t?t===e:Array.isArray(t)?t.indexOf(e)>=0:t instanceof RegExp&&t.test(e)}static getOpenTagString(t,e){let i=t.name,n=e[i];if(!n)return"";"string"==typeof n&&(i=n,n=e[i]);const s=t.get(0);if(!s.hasAttributes())return i;const o=new Map;for(const t of s.attributes)if(n[t.name]&&("style"!==t.name&&ie.matchRule(n[t.name],t.value)&&o.set(t.name,t.value),"style"===t.name)){const e=n.style,i=new Map;g(p(t.value),((t,n)=>{e[t]&&ie.matchRule(e[t],n)&&i.set(t,n)})),o.set("style",i)}let r=i;for(const[t,e]of o)if("style"===t){let t="";for(const[i,n]of e)t+=`${i}: ${n.replace(/"/g,"&quot;")}; `;""!==t&&(r+=` style="${t.trim()}"`)}else r+=` ${t}="${e}"`;return r}static getClosedTagString(t,e){let i=t.name;const n=e[i];return n?("string"==typeof n&&(i=n),i):""}static getTrimmedText(t){const e=t.parent(),i=t.prev(),n=t.next();let s=t.text();return(i.isBlock||i.isBlockBox)&&(n.isBlock||n.isBlockBox)||0===i.length&&0===n.length&&e.isBlock?s=s.replace(/^[\u0020\t\r\n]+|[\u0020\t\r\n]+$/g,""):i.isBlock||i.isBlockBox||0===i.length&&e.isBlock?s=s.replace(/^[\u0020\t\r\n]+/,""):(n.isBlock||n.isBlockBox||0===n.length&&e.isBlock)&&(s=s.replace(/[\u0020\t\r\n]+$/,"")),s}getHTML(){const t=this.rules;let e="";for(const i of function*e(i){let n=i.first();for(;n.length>0;){const i=n.next();if(n.isText)yield r(ie.getTrimmedText(n));else if(n.isVoid){const e=ie.getOpenTagString(n,t);""!==e&&(yield`<${e} />`)}else if(n.isElement){const i=ie.getOpenTagString(n,t),s=ie.getClosedTagString(n,t);""!==i&&(yield`<${i}>`),n.isBox||(yield*e(n)),""!==s&&(yield`</${s}>`)}n=i}}(this.source))e+=i;return e.trim()}getNodeList(){const t=this.getHTML();return this.parseHTML(t).children()}getFragment(){const t=this.getHTML(),e=this.parseHTML(t),i=document.createDocumentFragment();let n=e.first();for(;n.length>0;){const t=n.next();i.appendChild(n.get(0)),n=t}return i}}class ne{constructor(t){this.content=t}getHTML(){let t=this.content;return t=t.replace(/ {2}/g,"  "),t=r(t.trim()),t=`<p>${t}</p>`,t=t.replace(/(\r\n){2,}/g,"</p><p><br /></p><p>"),t=t.replace(/\r\n/g,"</p><p>"),t=t.replace(/[\r\n]{2,}/g,"</p><p><br /></p><p>"),t=t.replace(/[\r\n]/g,"</p><p>"),t}getFragment(){return new ie(this.getHTML()).getFragment()}}function se(t,e){if(t.commonAncestor.isOutside)return;const i=(e=I(e)).get(0),n=t.get();n.insertNode(i),n.setEndAfter(i),n.collapse(!1)}function oe(t){if(t.commonAncestor.isOutside)return{anchor:new T,focus:new T};const e=t.startNode.closest("lake-box");if(e.length>0)return t.isBoxLeft?e.attr("focus","left"):t.isBoxRight?e.attr("focus","right"):e.attr("focus","center"),{anchor:new T,focus:e};if(t.isCollapsed){const e=t.clone();e.collapseToEnd();const i=I('<lake-bookmark type="focus" />');return se(e,i),{anchor:new T,focus:i}}const i=t.clone();i.collapseToStart();const n=I('<lake-bookmark type="anchor" />');se(i,n);const s=t.clone();s.collapseToEnd();const o=I('<lake-bookmark type="focus" />');return se(s,o),{anchor:n,focus:o}}function re(t,e){const i=t.prev(),n=t.next();if(i.isText&&n.isText){const e=t.parent();D(e),t.remove(),e.get(0).normalize()}else if(0===i.length&&0===n.length){if(t.parent().isMark&&e){const i=new T(document.createTextNode("​"));t.before(i),e.setStartAfter(i),e.collapseToStart()}t.remove()}else t.remove()}function ae(t,e){const i=e.anchor,n=e.focus;if(i.length>0&&0===n.length)re(i);else{if(n.length>0&&0===i.length){if(n.isBox){const e=new Qt(n);0===e.getContainer().length&&e.render();const i=n.attr("focus");return"left"===i?t.selectBoxLeft(n):"center"===i?t.selectBox(n):t.selectBoxRight(n),void n.removeAttr("focus")}return t.setStartBefore(n),t.collapseToStart(),void re(n,t)}if(i.length>0&&n.length>0){const e=new E;e.selectNode(i),e.collapseToEnd(),-1===e.compareAfterNode(n)?(t.setStartBefore(n),re(n),t.setEndBefore(i),re(i)):(t.setStartBefore(i),re(i),t.setEndBefore(n),re(n))}}}function le(t){if(t.commonAncestor.isOutside)return;V(t.getBlocks())}function he(t){if(t.isCollapsed)return;if(t.adapt(),t.isInoperative)return;const e=t.startNode.closestBlock(),i=t.endNode.closestBlock(),n=e.get(0)===i.get(0);if(t.get().deleteContents(),t.adaptBlock(),n){const e=t.getBlocks()[0];return void(e&&e.isEmpty&&(P(e,I("<br />")),t.shrinkAfter(e)))}const s=t.getBlocks()[0];if(!s)return;const o=s.prev();if(0===o.length)return;const r=oe(t);N(o,s),ae(t,r),le(t)}function ce(t,e){if(t.commonAncestor.isOutside)return;t.isCollapsed?t.adaptBox():he(t);Z(t.startNode.closestBlock());const i=oe(t);i.focus.before(e),ae(t,i),t.adaptBlock()}function de(t,e){const i=I(e),n=document.createDocumentFragment();i.each((t=>{n.appendChild(t)})),ce(t,n)}function pe(t,e){if(t.commonAncestor.isOutside)return;if(t.isCollapsed&&t.isBox)return;if("string"!=typeof e){const i=t.getBlocks();for(const t of i)t.css(e);return}const i=I(e),n=i.name,s=i.get(0).attributes,o=t.getBlocks();if(o.length>0){const e=oe(t);for(const t of o)if(t.name===n&&0===i.first().length)for(const e of s)t.attr(e.name,e.value);else{const e=i.clone(!0);t.isList&&""!==t.attr("indent")&&e.attr("indent",t.attr("indent"));const n=O(e);let s=t.first();for(;s.length>0;){const t=s.next();n.append(s),n.name!==s.name&&"li"!==s.name||s.remove(!0),s=t}t.replaceWith(e)}return ae(t,e),void le(t)}const r=oe(t),a=function(t){const e=t.commonAncestor.closest('div[contenteditable="true"],td');let i=[];if(0===e.length)return i;let n=e.first(),s=!0;for(;n.length>0;){if(n.isMark||n.isText||n.isBookmark||n.isInlineBox)i.push(n);else{if(!s)break;i=[]}t.intersectsNode(n)&&(s=!1),n=n.next()}return i}(t),l=H(a,i);ae(t,r),le(t),l.isEmpty&&(P(l,I("<br />")),t.shrinkAfter(l))}function ue(t){if(t.commonAncestor.isOutside)return{left:null,right:null};t.isCollapsed?t.adaptBox():he(t);const e=t.startNode,i=e.closestOperableBlock();if(0===i.length)return{left:null,right:null};let n=i.parent();n.isOutside&&(n=e.closestContainer());const s=M(e,t.startOffset,n);let o=null,r=null;return s&&(o=s.left,r=s.right),!s&&e.isBlock&&(t.startOffset>0&&(o=e.children()[t.startOffset-1]),r=e.children()[t.startOffset],r&&!r.isBlock&&(r=null)),o&&o.isEmpty&&P(o,I("<br />")),r&&(r.isEmpty?(P(r,I("<br />")),t.shrinkAfter(r)):t.shrinkBefore(r)),le(t),{left:o,right:r}}function me(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function fe(t,e,i){let n=null,s=null,o=t.closestBlock();0===o.length&&(o=t.closestContainer());const r=M(t,e,o);return r&&(i?(me(r.left),me(r.right),r.left.isEmpty||(n=r.left),r.right.isEmpty||(s=r.right)):(n=r.left,s=r.right)),{left:n,right:s}}function ge(t,e=!0){if(t.commonAncestor.isOutside)return{left:null,center:null,right:null};if(t.adaptBox(),t.isCollapsed){const i=fe(t.startNode,t.startOffset,e);return i.left?(t.setStartAfter(i.left),t.collapseToStart()):i.right&&(t.setStartBefore(i.right),t.collapseToStart()),{left:i.left,center:null,right:i.right}}const i=fe(t.startNode,t.startOffset,e);i.left?t.setStartAfter(i.left):i.right&&t.setStartBefore(i.right);const n=fe(t.endNode,t.endOffset,e);return n.left?t.setEndAfter(n.left):n.right&&t.setEndBefore(n.right),{left:i.left,center:n.left,right:n.right}}function ve(t,e){const i=t.text();let n=t;for(;n.length>0;){const t=n.parent();if(!t.isMark||i!==t.text()||!n.isText&&n.name===e&&""!==n.attr("style"))break;n=t}return n}function we(t,e){if(t.commonAncestor.isOutside)return;let i=I(e);const n=i.name,s=p(i.attr("style"));if(t.isCollapsed){if(t.isBox){const e=t.startNode.closest("lake-box");if("block"===new Qt(e).type){const i=I("<p><br /></p>");t.isBoxLeft?e.before(i):e.after(i),t.shrinkAfter(i)}else t.adaptBox()}Z(t.startNode.closestBlock());const e=new T(document.createTextNode("​")),o=ge(t);if(o.left){const t=function(t){if(!t.isMark)return null;let e=t.clone(),i=t.last();for(;i.length>0;){if(i.isMark){const t=i.clone();e.append(t),e=t}i=i.last()}return e}(o.left);t&&(t.name===n?(t.css(s),i=t):(P(t,e),i.append(t)))}return""===i.text()&&i.append(e),se(t,i),function(t){const e=t.prev();e.length>0&&e.isText&&e.isEmpty&&e.remove();const i=t.next();i.length>0&&i.isText&&i.isEmpty&&i.remove()}(i),void t.shrinkAfter(i)}ge(t);const o=t.getMarks(!0),r=oe(t);for(const t of o)if(!t.isEmpty&&t.isText){const e=ve(t,n);if(e.isMark&&e.name===n)e.css(s);else{const t=i.clone();e.before(t),t.append(e)}}ae(t,r)}function ye(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function xe(t,e){if(t.commonAncestor.isOutside)return;let i;if(e){i=I(e).name}if(t.isCollapsed){if(t.isBox)return;if(i&&0===t.commonAncestor.closest(i).length)return;const e=ge(t,!1);if(!e.left)return;e.right&&ye(e.right);const n=new T(document.createTextNode("​")),s=function(t,e){if(!t.isMark||!e)return null;let i=t.clone(),n=t.last();for(;n.length>0;){if(n.isMark&&n.name!==e){const t=n.clone();i.append(t),i=t}n=n.last()}if(i.name===e){if(!(i.first().length>0))return null;i=i.first()}return i}(e.left,i);return s?(P(s,n),e.left.after(s),ye(e.left),void t.shrinkAfter(s)):(e.left.after(n),ye(e.left),n.prev().isText?(t.setStartAfter(n.prev()),t.collapseToStart(),void n.remove()):(t.setStartAfter(n),void t.collapseToStart()))}ge(t);const n=t.getMarks(),s=oe(t);for(const t of n)if(!i||t.name===i){const e=t.parent();t.remove(!t.isEmpty),e.length>0&&e.get(0).normalize()}D(t.commonAncestor),ae(t,s)}function be(t,e){if(t.commonAncestor.isOutside)return null;const i=I(e);if(t.isCollapsed){let e=t.commonAncestor.closest("a");if(0===e.length){e=i.clone(!0);return Z(t.startNode.closestBlock()),se(t,e),e}return""!==i.attr("href")&&e.attr({href:i.attr("href")}),e}ge(t);const n=oe(t);for(const e of t.commonAncestor.getWalker())"a"===e.name&&t.intersectsNode(e)&&e.remove(!0);const s=i.clone(!1);n.anchor.after(s);let o=s.next();for(;o.length>0;){const t=o.next();if(!o.isMark&&!o.isText)break;s.append(o),o=t}return 0===s.first().length&&s.remove(),ae(t,n),s}class ke{constructor(t){this.config=t,this.root=t.root,this.node=I(a`
5
+ `;class Qt{constructor(t){if(this.event=new qt,"string"==typeof t){const e=Kt.get(t);if(void 0===e)throw new Error(`Box '${t}' has not been defined yet.`);const i=r(e.type),n=r(e.name);this.node=I(a`<lake-box type="${i}" name="${n}"></lake-box>`),e.value&&(this.value=e.value)}else{this.node=I(t);const e=Kt.get(this.name);if(void 0===e)throw new Error(`Box '${this.name}' has not been defined yet.`);e.value&&!this.node.hasAttr("value")&&(this.value=e.value)}Xt[this.node.id]||(Xt[this.node.id]={}),Jt[this.node.id]||(Jt[this.node.id]={setup:[],cleanup:[]})}addFramework(){let t=this.getContainer();0===t.length?(this.node.html(Yt),t=this.getContainer()):(t.off("mouseenter"),t.off("mouseleave"),t.off("click")),t.on("mousedown",(t=>{t.preventDefault()})),t.on("mouseenter",(()=>{t.hasClass("lake-box-selected")||t.hasClass("lake-box-focused")||t.hasClass("lake-box-activated")||t.addClass("lake-box-hovered")})),t.on("mouseleave",(()=>{t.removeClass("lake-box-hovered")})),t.on("click",(()=>{C(`Box '${this.name}' (id = ${this.node.id}) value:`),C(this.value)}))}get type(){return this.node.attr("type")}get name(){return this.node.attr("name")}get value(){const t=this.node.attr("value");return""===t?{}:JSON.parse(jt(t))}set value(t){this.node.attr("value",Ft(JSON.stringify(t)))}updateValue(t,e){const i=this.value;"string"==typeof t?i[t]=e:g(t,((t,e)=>{i[t]=e})),this.value=i}getData(t){return Xt[this.node.id][t]}setData(t,e){Xt[this.node.id][t]=e}getEditor(){const t=this.node.closest("div[contenteditable]");return t.length>0?Gt.get(t.id):void 0}getContainer(){return this.node.find(".lake-box-container")}useEffect(t){Jt[this.node.id].setup.push(t)}render(){Jt[this.node.id].setup=[],Jt[this.node.id].cleanup=[];const t=Kt.get(this.name);if(void 0===t)return;this.addFramework();const e=t.render(this);if(void 0!==e){const t=this.getContainer(),i=t.clone(!1);i.append(e),ht(t,i)}for(const t of Jt[this.node.id].setup){const e=t();void 0!==e&&Jt[this.node.id].cleanup.push(e)}C(`Box '${this.name}' (id = ${this.node.id}) rendered`)}unmount(){for(const t of Jt[this.node.id].cleanup)t();Xt[this.node.id]={},Jt[this.node.id].setup=[],Jt[this.node.id].cleanup=[],this.node.empty(),C(`Box '${this.name}' (id = ${this.node.id}) unmounted`)}getHTML(){const t=Kt.get(this.name);return void 0===t?"":void 0===t.html?this.node.outerHTML():t.html(this)}}const te={id:/^[\w-]+$/,class:/^[\w-]+$/,style:{"text-align":["left","center","right","justify","start","end"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function ee(){return{h1:Object.assign({},te),h2:Object.assign({},te),h3:Object.assign({},te),h4:Object.assign({},te),h5:Object.assign({},te),h6:Object.assign({},te),p:Object.assign({},te),blockquote:Object.assign(Object.assign({},te),{type:["success","info","warning","error"]}),ul:Object.assign(Object.assign({},te),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},te),{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 ie{constructor(t,e=ee()){this.rules=e,this.source="string"==typeof t?this.parseHTML(t):t}parseHTML(t){const e=(new DOMParser).parseFromString(t,"text/html");return new T(e.querySelector("body"))}static matchRule(t,e){return"string"==typeof t?t===e:Array.isArray(t)?t.indexOf(e)>=0:t instanceof RegExp&&t.test(e)}static getOpenTagString(t,e){let i=t.name,n=e[i];if(!n)return"";"string"==typeof n&&(i=n,n=e[i]);const s=t.get(0);if(!s.hasAttributes())return i;const o=new Map;for(const t of s.attributes)if(n[t.name]&&("style"!==t.name&&ie.matchRule(n[t.name],t.value)&&o.set(t.name,t.value),"style"===t.name)){const e=n.style,i=new Map;g(p(t.value),((t,n)=>{e[t]&&ie.matchRule(e[t],n)&&i.set(t,n)})),o.set("style",i)}let r=i;for(const[t,e]of o)if("style"===t){let t="";for(const[i,n]of e)t+=`${i}: ${n.replace(/"/g,"&quot;")}; `;""!==t&&(r+=` style="${t.trim()}"`)}else r+=` ${t}="${e}"`;return r}static getClosedTagString(t,e){let i=t.name;const n=e[i];return n?("string"==typeof n&&(i=n),i):""}static getTrimmedText(t){const e=t.parent(),i=t.prev(),n=t.next();let s=t.text();return(i.isBlock||i.isBlockBox)&&(n.isBlock||n.isBlockBox)||0===i.length&&0===n.length&&e.isBlock?s=s.replace(/^[\u0020\t\r\n]+|[\u0020\t\r\n]+$/g,""):i.isBlock||i.isBlockBox||0===i.length&&e.isBlock?s=s.replace(/^[\u0020\t\r\n]+/,""):(n.isBlock||n.isBlockBox||0===n.length&&e.isBlock)&&(s=s.replace(/[\u0020\t\r\n]+$/,"")),s}getHTML(){const t=this.rules;let e="";for(const i of function*e(i){let n=i.first();for(;n.length>0;){const i=n.next();if(n.isText)yield r(ie.getTrimmedText(n));else if(n.isVoid){const e=ie.getOpenTagString(n,t);""!==e&&(yield`<${e} />`)}else if(n.isElement){const i=ie.getOpenTagString(n,t),s=ie.getClosedTagString(n,t);""!==i&&(yield`<${i}>`),n.isBox||(yield*e(n)),""!==s&&(yield`</${s}>`)}n=i}}(this.source))e+=i;return e.trim()}getNodeList(){const t=this.getHTML();return this.parseHTML(t).children()}getFragment(){const t=this.getHTML(),e=this.parseHTML(t),i=document.createDocumentFragment();let n=e.first();for(;n.length>0;){const t=n.next();i.appendChild(n.get(0)),n=t}return i}}class ne{constructor(t){this.content=t}getHTML(){let t=this.content;return t=t.replace(/ {2}/g,"  "),t=r(t.trim()),t=`<p>${t}</p>`,t=t.replace(/(\r\n){2,}/g,"</p><p><br /></p><p>"),t=t.replace(/\r\n/g,"</p><p>"),t=t.replace(/[\r\n]{2,}/g,"</p><p><br /></p><p>"),t=t.replace(/[\r\n]/g,"</p><p>"),t}getFragment(){return new ie(this.getHTML()).getFragment()}}function se(t,e){if(t.commonAncestor.isOutside)return;const i=(e=I(e)).get(0),n=t.get();n.insertNode(i),n.setEndAfter(i),n.collapse(!1)}function oe(t){if(t.commonAncestor.isOutside)return{anchor:new T,focus:new T};const e=t.startNode.closest("lake-box");if(e.length>0)return t.isBoxStart?e.attr("focus","start"):t.isBoxEnd?e.attr("focus","end"):e.attr("focus","center"),{anchor:new T,focus:e};if(t.isCollapsed){const e=t.clone();e.collapseToEnd();const i=I('<lake-bookmark type="focus" />');return se(e,i),{anchor:new T,focus:i}}const i=t.clone();i.collapseToStart();const n=I('<lake-bookmark type="anchor" />');se(i,n);const s=t.clone();s.collapseToEnd();const o=I('<lake-bookmark type="focus" />');return se(s,o),{anchor:n,focus:o}}function re(t,e){const i=t.prev(),n=t.next();if(i.isText&&n.isText){const e=t.parent();D(e),t.remove(),e.get(0).normalize()}else if(0===i.length&&0===n.length){if(t.parent().isMark&&e){const i=new T(document.createTextNode("​"));t.before(i),e.setStartAfter(i),e.collapseToStart()}t.remove()}else t.remove()}function ae(t,e){const i=e.anchor,n=e.focus;if(i.length>0&&0===n.length)re(i);else{if(n.length>0&&0===i.length){if(n.isBox){const e=new Qt(n);0===e.getContainer().length&&e.render();const i=n.attr("focus");return"start"===i?t.selectBoxStart(n):"center"===i?t.selectBox(n):t.selectBoxEnd(n),void n.removeAttr("focus")}return t.setStartBefore(n),t.collapseToStart(),void re(n,t)}if(i.length>0&&n.length>0){const e=new L;e.selectNode(i),e.collapseToEnd(),-1===e.compareAfterNode(n)?(t.setStartBefore(n),re(n),t.setEndBefore(i),re(i)):(t.setStartBefore(i),re(i),t.setEndBefore(n),re(n))}}}function le(t){if(t.commonAncestor.isOutside)return;V(t.getBlocks())}function ce(t){if(t.isCollapsed)return;if(t.adapt(),t.isInoperative)return;const e=t.startNode.closestBlock(),i=t.endNode.closestBlock(),n=e.get(0)===i.get(0);if(t.get().deleteContents(),t.adaptBlock(),n){const e=t.getBlocks()[0];return void(e&&e.isEmpty&&(P(e,I("<br />")),t.shrinkAfter(e)))}const s=t.getBlocks()[0];if(!s)return;const o=s.prev();if(0===o.length)return;const r=oe(t);Z(o,s),ae(t,r),le(t)}function he(t,e){if(t.commonAncestor.isOutside)return;t.isCollapsed?t.adaptBox():ce(t);O(t.startNode.closestBlock());const i=oe(t);i.focus.before(e),ae(t,i),t.adaptBlock()}function de(t,e){const i=I(e),n=document.createDocumentFragment();i.each((t=>{n.appendChild(t)})),he(t,n)}function pe(t,e){if(t.commonAncestor.isOutside)return;if(t.isCollapsed&&t.isBox)return;if("string"!=typeof e){const i=t.getBlocks();for(const t of i)t.css(e);return}const i=I(e),n=i.name,s=i.get(0).attributes,o=t.getBlocks();if(o.length>0){const e=oe(t);for(const t of o)if(t.name===n&&0===i.first().length)for(const e of s)t.attr(e.name,e.value);else{const e=i.clone(!0);t.isList&&""!==t.attr("indent")&&e.attr("indent",t.attr("indent"));const n=N(e);let s=t.first();for(;s.length>0;){const t=s.next();n.append(s),n.name!==s.name&&"li"!==s.name||s.remove(!0),s=t}t.replaceWith(e)}return ae(t,e),void le(t)}const r=oe(t),a=function(t){const e=t.commonAncestor.closest('div[contenteditable="true"],td');let i=[];if(0===e.length)return i;let n=e.first(),s=!0;for(;n.length>0;){if(n.isMark||n.isText||n.isBookmark||n.isInlineBox)i.push(n);else{if(!s)break;i=[]}t.intersectsNode(n)&&(s=!1),n=n.next()}return i}(t),l=H(a,i);ae(t,r),le(t),l.isEmpty&&(P(l,I("<br />")),t.shrinkAfter(l))}function ue(t){if(t.commonAncestor.isOutside)return{start:null,end:null};t.isCollapsed?t.adaptBox():ce(t);const e=t.startNode,i=e.closestOperableBlock();if(0===i.length)return{start:null,end:null};let n=i.parent();n.isOutside&&(n=e.closestContainer());const s=M(e,t.startOffset,n);let o=null,r=null;return s&&(o=s.start,r=s.end),!s&&e.isBlock&&(t.startOffset>0&&(o=e.children()[t.startOffset-1]),r=e.children()[t.startOffset],r&&!r.isBlock&&(r=null)),o&&o.isEmpty&&P(o,I("<br />")),r&&(r.isEmpty?(P(r,I("<br />")),t.shrinkAfter(r)):t.shrinkBefore(r)),le(t),{start:o,end:r}}function me(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function fe(t,e,i){let n=null,s=null,o=t.closestBlock();0===o.length&&(o=t.closestContainer());const r=M(t,e,o);return r&&(i?(me(r.start),me(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 ge(t,e=!0){if(t.commonAncestor.isOutside)return{start:null,center:null,end:null};if(t.adaptBox(),t.isCollapsed){const i=fe(t.startNode,t.startOffset,e);return i.start?(t.setStartAfter(i.start),t.collapseToStart()):i.end&&(t.setStartBefore(i.end),t.collapseToStart()),{start:i.start,center:null,end:i.end}}const i=fe(t.startNode,t.startOffset,e);i.start?t.setStartAfter(i.start):i.end&&t.setStartBefore(i.end);const n=fe(t.endNode,t.endOffset,e);return n.start?t.setEndAfter(n.start):n.end&&t.setEndBefore(n.end),{start:i.start,center:n.start,end:n.end}}function ve(t,e){const i=t.text();let n=t;for(;n.length>0;){const t=n.parent();if(!t.isMark||i!==t.text()||!n.isText&&n.name===e&&""!==n.attr("style"))break;n=t}return n}function we(t,e){if(t.commonAncestor.isOutside)return;let i=I(e);const n=i.name,s=p(i.attr("style"));if(t.isCollapsed){if(t.isBox){const e=t.startNode.closest("lake-box");if("block"===new Qt(e).type){const i=I("<p><br /></p>");t.isBoxStart?e.before(i):e.after(i),t.shrinkAfter(i)}else t.adaptBox()}O(t.startNode.closestBlock());const e=new T(document.createTextNode("​")),o=ge(t);if(o.start){const t=function(t){if(!t.isMark)return null;let e=t.clone(),i=t.last();for(;i.length>0;){if(i.isMark){const t=i.clone();e.append(t),e=t}i=i.last()}return e}(o.start);t&&(t.name===n?(t.css(s),i=t):(P(t,e),i.append(t)))}return""===i.text()&&i.append(e),se(t,i),function(t){const e=t.prev();e.length>0&&e.isText&&e.isEmpty&&e.remove();const i=t.next();i.length>0&&i.isText&&i.isEmpty&&i.remove()}(i),void t.shrinkAfter(i)}ge(t);const o=t.getMarks(!0),r=oe(t);for(const t of o)if(!t.isEmpty&&t.isText){const e=ve(t,n);if(e.isMark&&e.name===n)e.css(s);else{const t=i.clone();e.before(t),t.append(e)}}ae(t,r)}function ye(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function xe(t,e){if(t.commonAncestor.isOutside)return;let i;if(e){i=I(e).name}if(t.isCollapsed){if(t.isBox)return;if(i&&0===t.commonAncestor.closest(i).length)return;const e=ge(t,!1);if(!e.start)return;e.end&&ye(e.end);const n=new T(document.createTextNode("​")),s=function(t,e){if(!t.isMark||!e)return null;let i=t.clone(),n=t.last();for(;n.length>0;){if(n.isMark&&n.name!==e){const t=n.clone();i.append(t),i=t}n=n.last()}if(i.name===e){if(!(i.first().length>0))return null;i=i.first()}return i}(e.start,i);return s?(P(s,n),e.start.after(s),ye(e.start),void t.shrinkAfter(s)):(e.start.after(n),ye(e.start),n.prev().isText?(t.setStartAfter(n.prev()),t.collapseToStart(),void n.remove()):(t.setStartAfter(n),void t.collapseToStart()))}ge(t);const n=t.getMarks(),s=oe(t);for(const t of n)if(!i||t.name===i){const e=t.parent();t.remove(!t.isEmpty),e.length>0&&e.get(0).normalize()}D(t.commonAncestor),ae(t,s)}function be(t,e){if(t.commonAncestor.isOutside)return null;const i=I(e);if(t.isCollapsed){let e=t.commonAncestor.closest("a");if(0===e.length){e=i.clone(!0);return O(t.startNode.closestBlock()),se(t,e),e}return""!==i.attr("href")&&e.attr({href:i.attr("href")}),e}ge(t);const n=oe(t);for(const e of t.commonAncestor.getWalker())"a"===e.name&&t.intersectsNode(e)&&e.remove(!0);const s=i.clone(!1);n.anchor.after(s);let o=s.next();for(;o.length>0;){const t=o.next();if(!o.isMark&&!o.isText)break;s.append(o),o=t}return 0===s.first().length&&s.remove(),ae(t,n),s}class ke{constructor(t){this.config=t,this.root=t.root,this.node=I(a`
6
6
  <button type="button" name="${t.name}" class="lake-button" />
7
7
  `),void 0!==t.tabIndex&&this.node.attr("tabindex",t.tabIndex.toString())}render(){const t=this.config,e=this.node;e.addClass(`lake-${t.text?"text":"icon"}-button`),t.tooltip&&e.attr("title",t.tooltip),t.icon&&e.append(t.icon),t.text&&e.append(`<span>${t.text}</span>`),this.root.append(e),e.on("mouseenter",(()=>{e.attr("disabled")||e.hasClass("lake-button-selected")||e.addClass("lake-button-hovered")})),e.on("mouseleave",(()=>{e.attr("disabled")||e.removeClass("lake-button-hovered")})),e.on("click",(e=>{e.preventDefault(),t.onClick()}))}}class _e{constructor(t){if(this.documentClickListener=t=>{const e=new T(t.target),i=this.node.find(".lake-dropdown-title"),n=this.node.find(".lake-dropdown-menu");e.closest(".lake-dropdown-title").get(0)!==i.get(0)&&(n.hide(),document.removeEventListener("click",this.documentClickListener))},this.config=t,this.root=t.root,this.node=I(a`
8
8
  <div class="lake-dropdown lake-${t.menuType}-dropdown" name="${t.name}">
@@ -11,42 +11,42 @@ var Lake=function(t){"use strict";class e extends HTMLElement{}customElements.de
11
11
  <div class="lake-dropdown-down-icon"></div>
12
12
  </button>
13
13
  </div>
14
- `),void 0!==t.tabIndex){this.node.find(".lake-dropdown-title").attr("tabindex",t.tabIndex.toString())}}static getValue(t){const e=t.attr("value");return""===e?[]:JSON.parse(Rt(e))}static setValue(t,e){t.attr("value",Ft(JSON.stringify(e)))}static getMenuMap(t){const e=new Map;for(const i of t){const t=i.text.replace(/<[^>]*>/g,"");e.set(i.value,t)}return e}updateColorAccent(t,e){const i=t.find(".lake-dropdown-icon svg").eq(1),n=i.find("line");n.length>0?n.attr("stroke",e):i.find("path").attr("fill",e)}apppendMenuItems(t){const e=this.config;for(const i of e.menuItems){const o=I(s`
14
+ `),void 0!==t.tabIndex){this.node.find(".lake-dropdown-title").attr("tabindex",t.tabIndex.toString())}}static getValue(t){const e=t.attr("value");return""===e?[]:JSON.parse(jt(e))}static setValue(t,e){t.attr("value",Ft(JSON.stringify(e)))}static getMenuMap(t){const e=new Map;for(const i of t){const t=i.text.replace(/<[^>]*>/g,"");e.set(i.value,t)}return e}updateColorAccent(t,e){const i=t.find(".lake-dropdown-icon svg").eq(1),n=i.find("line");n.length>0?n.attr("stroke",e):i.find("path").attr("fill",e)}apppendMenuItems(t){const e=this.config;for(const i of e.menuItems){const o=I(s`
15
15
  <li value="${r(i.value)}">
16
16
  <div class="lake-dropdown-menu-text">${i.text}</div>
17
17
  </li>
18
- `);if(t.append(o),"color"===e.menuType&&(o.attr("title",i.text),o.find(".lake-dropdown-menu-text").css("background-color",i.value)),i.icon){const t=I('<div class="lake-dropdown-menu-icon"></div>');t.append(i.icon),o.prepend(t)}const a=n.get("check");if(a){const t=I('<div class="lake-dropdown-menu-check"></div>');t.append(a),o.prepend(t)}}}showMenu(){const t=this.config,e=this.node,i=e.find(".lake-dropdown-menu");if(e.attr("disabled"))return;const n=_e.getValue(e);i.find(".lake-dropdown-menu-check").css("visibility","hidden"),i.find("li").each((t=>{const e=I(t);e.on("mouseenter",(()=>{e.hasClass("lake-dropdown-item-selected")||e.addClass("lake-dropdown-item-hovered")})),e.on("mouseleave",(()=>{e.removeClass("lake-dropdown-item-hovered")})),n.indexOf(e.attr("value"))>=0&&e.find(".lake-dropdown-menu-check").css("visibility","visible")})),i.css("visibility","hidden"),i.show("color"===t.menuType?"flex":"block");e.get(0).getBoundingClientRect().x+i.width()+50>window.innerWidth?(i.css("left","auto"),i.css("right","0")):(i.css("left",""),i.css("right","")),i.css("visibility",""),document.addEventListener("click",this.documentClickListener)}bindEvents(){const t=this.config,e=this.node,i=e.find(".lake-dropdown-title"),n=i.find(".lake-dropdown-text"),s=i.find(".lake-dropdown-icon"),o=i.find(".lake-dropdown-down-icon"),r=e.find(".lake-dropdown-menu");"color"===t.menuType?(s.on("mouseenter",(()=>{e.attr("disabled")||s.addClass("lake-dropdown-icon-hovered")})),s.on("mouseleave",(()=>{s.removeClass("lake-dropdown-icon-hovered")})),o.on("mouseenter",(()=>{e.attr("disabled")||o.addClass("lake-dropdown-down-icon-hovered")})),o.on("mouseleave",(()=>{o.removeClass("lake-dropdown-down-icon-hovered")}))):(i.on("mouseenter",(()=>{e.attr("disabled")||i.addClass("lake-dropdown-title-hovered")})),i.on("mouseleave",(()=>{i.removeClass("lake-dropdown-title-hovered")}))),"color"===t.menuType&&s.on("click",(i=>{if(i.preventDefault(),e.attr("disabled"))return;const n=e.attr("color")||t.defaultValue;t.onSelect(n)}));("color"===t.menuType&&o?o:i).on("click",(t=>{t.preventDefault(),this.showMenu()})),r.on("click",(s=>{s.preventDefault();const o=I(s.target).closest("li"),a=o.attr("value");_e.setValue(e,[a]),n.length>0&&n.text(o.text()),"color"===t.menuType&&""!==a&&(e.attr("color",a),this.updateColorAccent(i,a)),t.onSelect(a),r.hide(),document.removeEventListener("click",this.documentClickListener)}))}render(){var t;const e=this.config,i=this.node,n=i.find(".lake-dropdown-title");e.downIcon||n.addClass("lake-dropdown-title-no-down"),n.css("width",e.width),n.attr("title",e.tooltip);const s=n.find(".lake-dropdown-text"),o=n.find(".lake-dropdown-icon");e.icon&&o.append(e.icon),e.accentIcon&&o.append(e.accentIcon);const r=n.find(".lake-dropdown-down-icon");e.downIcon&&r.append(e.downIcon);const a=I('<ul class="lake-dropdown-menu" />');if(a.addClass(`lake-${e.menuType}-dropdown-menu`),_e.setValue(i,[e.defaultValue]),s.length>0){const i=_e.getMenuMap(e.menuItems);s.text(null!==(t=i.get(e.defaultValue))&&void 0!==t?t:e.defaultValue)}"color"===e.menuType&&this.updateColorAccent(n,e.defaultValue),this.apppendMenuItems(a),i.append(n),i.append(a),this.root.append(i),this.bindEvents()}unmount(){this.node.remove(),document.removeEventListener("click",this.documentClickListener)}}var Se=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Ce="object"==typeof Wt&&Wt&&Wt.Object===Object&&Wt,Ae="object"==typeof self&&self&&self.Object===Object&&self,Be=Ce||Ae||Function("return this")(),Le=Be,Te=function(){return Le.Date.now()},Ie=/\s/;var Ee=function(t){for(var e=t.length;e--&&Ie.test(t.charAt(e)););return e},Me=Ee,Pe=/^\s+/;var Ze=function(t){return t?t.slice(0,Me(t)+1).replace(Pe,""):t},ze=Be.Symbol,Ne=ze,Oe=Object.prototype,He=Oe.hasOwnProperty,De=Oe.toString,$e=Ne?Ne.toStringTag:void 0;var Ve=function(t){var e=He.call(t,$e),i=t[$e];try{t[$e]=void 0;var n=!0}catch(t){}var s=De.call(t);return n&&(e?t[$e]=i:delete t[$e]),s},Fe=Object.prototype.toString;var Re=Ve,We=function(t){return Fe.call(t)},je=ze?ze.toStringTag:void 0;var Ue=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":je&&je in Object(t)?Re(t):We(t)},qe=function(t){return null!=t&&"object"==typeof t};var Ke=Ze,Ge=Se,Xe=function(t){return"symbol"==typeof t||qe(t)&&"[object Symbol]"==Ue(t)},Je=/^[-+]0x[0-9a-f]+$/i,Ye=/^0b[01]+$/i,Qe=/^0o[0-7]+$/i,ti=parseInt;var ei=Se,ii=Te,ni=function(t){if("number"==typeof t)return t;if(Xe(t))return NaN;if(Ge(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ge(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ke(t);var i=Ye.test(t);return i||Qe.test(t)?ti(t.slice(2),i?2:8):Je.test(t)?NaN:+t},si=Math.max,oi=Math.min;var ri=function(t,e,i){var n,s,o,r,a,l,h=0,c=!1,d=!1,p=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function u(e){var i=n,o=s;return n=s=void 0,h=e,r=t.apply(o,i)}function m(t){var i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=o}function f(){var t=ii();if(m(t))return g(t);a=setTimeout(f,function(t){var i=e-(t-l);return d?oi(i,o-(t-h)):i}(t))}function g(t){return a=void 0,p&&n?u(t):(n=s=void 0,r)}function v(){var t=ii(),i=m(t);if(n=arguments,s=this,l=t,i){if(void 0===a)return function(t){return h=t,a=setTimeout(f,e),c?u(t):r}(l);if(d)return clearTimeout(a),a=setTimeout(f,e),u(l)}return void 0===a&&(a=setTimeout(f,e)),r}return e=ni(e)||0,ei(i)&&(c=!!i.leading,o=(d="maxWait"in i)?si(ni(i.maxWait)||0,e):o,p="trailing"in i?!!i.trailing:p),v.cancel=function(){void 0!==a&&clearTimeout(a),h=0,n=l=s=a=void 0},v.flush=function(){return void 0===a?r:g(ii())},v},ai=jt(ri);function li(t){const e=t.get(0),i={};if(e.hasAttributes())for(const t of e.attributes)i[t.name]=t.value;return i}class hi{constructor(t){const e=window.getSelection();if(!e)throw new Error("Selection object is null.");this.selection=e,this.container=t,this.range=this.getRangeFromNativeSelection()}getRangeFromNativeSelection(){if(this.selection.rangeCount>0){const t=this.selection.getRangeAt(0);return new E(t)}return new E}addRangeToNativeSelection(){this.selection.removeAllRanges(),this.selection.addRange(this.range.get())}syncByRange(){const t=this.getRangeFromNativeSelection();this.range.get()!==t.get()&&(this.range=t)}synByBookmark(){const t=this.range,e=this.container,i=e.find("lake-box[focus]");if(i.length>0)return ae(t,{anchor:new T,focus:i}),void this.addRangeToNativeSelection();ae(t,{anchor:e.find('lake-bookmark[type="anchor"]'),focus:e.find('lake-bookmark[type="focus"]')}),this.addRangeToNativeSelection()}getAppliedItems(){const t=[];return function(t,e){let i=e.startNode;for(i.isText&&(i=i.parent());i.length>0&&i.isInside;)t.push({node:i,name:i.name,attributes:li(i),styles:p(i.attr("style"))}),i=i.parent()}(t,this.range),function(t,e){const i=e.startNode;let n;if(i.isText&&i.text().length===e.startOffset){const t=i.next();t.length>0&&t.isElement&&(n=t)}if(i.isElement){const t=i.children();if(t.length>0){const i=t[e.startOffset];i&&i.isElement&&(n=i)}}if(n){let e=n;for(;e.length>0;)e.isElement&&t.push({node:e,name:e.name,attributes:li(e),styles:p(e.attr("style"))}),e=e.first()}}(t,this.range),t}insertBookmark(){return oe(this.range)}toBookmark(t){return ae(this.range,t)}insertNode(t){return se(this.range,t)}insertFragment(t){return ce(this.range,t)}insertContents(t){return de(this.range,t)}deleteContents(){return he(this.range)}setBlocks(t){return pe(this.range,t)}splitBlock(){return ue(this.range)}splitMarks(t){return ge(this.range,t)}addMark(t){return we(this.range,t)}removeMark(t){return xe(this.range,t)}fixList(){return le(this.range)}insertLink(t){return be(this.range,t)}}class ci{constructor(t){this.commandMap=new Map,this.event=new qt,this.selection=t}add(t,e){this.commandMap.set(t,e)}getNames(){return Array.from(this.commandMap.keys())}getItem(t){const e=this.commandMap.get(t);if(void 0===e)throw new Error(`Command '${t}' does not exist.`);return e}isDisabled(t){const e=this.getItem(t);if(!e.isDisabled)return!1;const i=this.selection.getAppliedItems();return e.isDisabled(i)}isSelected(t){const e=this.getItem(t);if(!e.isSelected)return!1;const i=this.selection.getAppliedItems();return e.isSelected(i)}selectedValues(t){const e=this.getItem(t);if(!e.selectedValues)return[];const i=this.selection.getAppliedItems();return e.selectedValues(i)}execute(t,...e){const i=this.getItem(t);this.event.emit("beforeexecute",t),i.execute.apply(this,e),this.event.emit("execute",t),A(`Command '${t}' executed`)}}var di,pi={exports:{}};di=pi,function(t){function e(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function i(t,i,n,s,o,r){return e((a=e(e(i,t),e(s,r)))<<(l=o)|a>>>32-l,n);var a,l}function n(t,e,n,s,o,r,a){return i(e&n|~e&s,t,e,o,r,a)}function s(t,e,n,s,o,r,a){return i(e&s|n&~s,t,e,o,r,a)}function o(t,e,n,s,o,r,a){return i(e^n^s,t,e,o,r,a)}function r(t,e,n,s,o,r,a){return i(n^(e|~s),t,e,o,r,a)}function a(t,i){var a,l,h,c,d;t[i>>5]|=128<<i%32,t[14+(i+64>>>9<<4)]=i;var p=1732584193,u=-271733879,m=-1732584194,f=271733878;for(a=0;a<t.length;a+=16)l=p,h=u,c=m,d=f,p=n(p,u,m,f,t[a],7,-680876936),f=n(f,p,u,m,t[a+1],12,-389564586),m=n(m,f,p,u,t[a+2],17,606105819),u=n(u,m,f,p,t[a+3],22,-1044525330),p=n(p,u,m,f,t[a+4],7,-176418897),f=n(f,p,u,m,t[a+5],12,1200080426),m=n(m,f,p,u,t[a+6],17,-1473231341),u=n(u,m,f,p,t[a+7],22,-45705983),p=n(p,u,m,f,t[a+8],7,1770035416),f=n(f,p,u,m,t[a+9],12,-1958414417),m=n(m,f,p,u,t[a+10],17,-42063),u=n(u,m,f,p,t[a+11],22,-1990404162),p=n(p,u,m,f,t[a+12],7,1804603682),f=n(f,p,u,m,t[a+13],12,-40341101),m=n(m,f,p,u,t[a+14],17,-1502002290),p=s(p,u=n(u,m,f,p,t[a+15],22,1236535329),m,f,t[a+1],5,-165796510),f=s(f,p,u,m,t[a+6],9,-1069501632),m=s(m,f,p,u,t[a+11],14,643717713),u=s(u,m,f,p,t[a],20,-373897302),p=s(p,u,m,f,t[a+5],5,-701558691),f=s(f,p,u,m,t[a+10],9,38016083),m=s(m,f,p,u,t[a+15],14,-660478335),u=s(u,m,f,p,t[a+4],20,-405537848),p=s(p,u,m,f,t[a+9],5,568446438),f=s(f,p,u,m,t[a+14],9,-1019803690),m=s(m,f,p,u,t[a+3],14,-187363961),u=s(u,m,f,p,t[a+8],20,1163531501),p=s(p,u,m,f,t[a+13],5,-1444681467),f=s(f,p,u,m,t[a+2],9,-51403784),m=s(m,f,p,u,t[a+7],14,1735328473),p=o(p,u=s(u,m,f,p,t[a+12],20,-1926607734),m,f,t[a+5],4,-378558),f=o(f,p,u,m,t[a+8],11,-2022574463),m=o(m,f,p,u,t[a+11],16,1839030562),u=o(u,m,f,p,t[a+14],23,-35309556),p=o(p,u,m,f,t[a+1],4,-1530992060),f=o(f,p,u,m,t[a+4],11,1272893353),m=o(m,f,p,u,t[a+7],16,-155497632),u=o(u,m,f,p,t[a+10],23,-1094730640),p=o(p,u,m,f,t[a+13],4,681279174),f=o(f,p,u,m,t[a],11,-358537222),m=o(m,f,p,u,t[a+3],16,-722521979),u=o(u,m,f,p,t[a+6],23,76029189),p=o(p,u,m,f,t[a+9],4,-640364487),f=o(f,p,u,m,t[a+12],11,-421815835),m=o(m,f,p,u,t[a+15],16,530742520),p=r(p,u=o(u,m,f,p,t[a+2],23,-995338651),m,f,t[a],6,-198630844),f=r(f,p,u,m,t[a+7],10,1126891415),m=r(m,f,p,u,t[a+14],15,-1416354905),u=r(u,m,f,p,t[a+5],21,-57434055),p=r(p,u,m,f,t[a+12],6,1700485571),f=r(f,p,u,m,t[a+3],10,-1894986606),m=r(m,f,p,u,t[a+10],15,-1051523),u=r(u,m,f,p,t[a+1],21,-2054922799),p=r(p,u,m,f,t[a+8],6,1873313359),f=r(f,p,u,m,t[a+15],10,-30611744),m=r(m,f,p,u,t[a+6],15,-1560198380),u=r(u,m,f,p,t[a+13],21,1309151649),p=r(p,u,m,f,t[a+4],6,-145523070),f=r(f,p,u,m,t[a+11],10,-1120210379),m=r(m,f,p,u,t[a+2],15,718787259),u=r(u,m,f,p,t[a+9],21,-343485551),p=e(p,l),u=e(u,h),m=e(m,c),f=e(f,d);return[p,u,m,f]}function l(t){var e,i="",n=32*t.length;for(e=0;e<n;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i}function h(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e<i.length;e+=1)i[e]=0;var n=8*t.length;for(e=0;e<n;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i}function c(t){var e,i,n="0123456789abcdef",s="";for(i=0;i<t.length;i+=1)e=t.charCodeAt(i),s+=n.charAt(e>>>4&15)+n.charAt(15&e);return s}function d(t){return unescape(encodeURIComponent(t))}function p(t){return function(t){return l(a(h(t),8*t.length))}(d(t))}function u(t,e){return function(t,e){var i,n,s=h(t),o=[],r=[];for(o[15]=r[15]=void 0,s.length>16&&(s=a(s,8*t.length)),i=0;i<16;i+=1)o[i]=909522486^s[i],r[i]=1549556828^s[i];return n=a(o.concat(h(e)),512+8*e.length),l(a(r.concat(n),640))}(d(t),d(e))}function m(t,e,i){return e?i?u(e,t):c(u(e,t)):i?p(t):c(p(t))}di.exports?di.exports=m:t.md5=m}(Wt);var ui=jt(pi.exports);const mi=new Map;class fi{constructor(t){this.list=[],this.index=0,this.canSave=!0,this.limit=100,this.event=new qt,this.selection=t,this.container=t.container}removeBookmark(t){return t.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(t){return new ie(t).getHTML()}addIdToBoxes(t){t.find("lake-box").each((t=>{const e=new T(t),i=ui(`${e.attr("type")}-${e.attr("name")}-${e.attr("value")}`);e.attr("id",i)}))}removeIdfromBoxes(t){t.find("lake-box").each((t=>{new T(t).removeAttr("id")}))}morphContainer(t){const e=this.container,i={beforeChildrenUpdated:t=>{if("lake-box"===new T(t).name)return!1},afterAttributeUpdated:(t,i)=>{const n=new T(i);if("value"===t&&"lake-box"===n.name){const t=mi.get(e.id);if(!t)return;t.delete(n.id)}}},n=t.clone(!0);this.addIdToBoxes(e),this.addIdToBoxes(n),ct(e,n,{callbacks:i}),this.removeIdfromBoxes(e),this.removeIdfromBoxes(n)}cloneContainer(){const t=this.selection.range,e=this.container.clone(!0);if(e.find("lake-box").each((t=>{new Qt(t).getContainer().empty()})),t.commonAncestor.isOutside)return e;if(t.isInsideBox)return e;const i=t.startNode.path(),n=t.endNode.path(),s=e.find(i),o=e.find(n),r=t.clone();return r.setStart(s,t.startOffset),r.setEnd(o,t.endOffset),oe(r),e}get count(){return this.list.length}get canUndo(){return this.index>1&&!!this.list[this.index-1]}get canRedo(){return!!this.list[this.index]}undo(){if(!this.list[this.index-1])return;this.selection.insertBookmark();const t=this.getValue(this.container);for(;this.index>0;){const e=this.list[this.index-1];if(!e)break;const i=this.getValue(e);if(this.removeBookmark(i)!==this.removeBookmark(t)){this.morphContainer(e),this.event.emit("undo",i);break}if(1===this.index)break;this.index--}this.selection.synByBookmark(),A(`History undone, the last index is ${this.index}`)}redo(){if(!this.list[this.index])return;this.selection.insertBookmark();const t=this.getValue(this.container);for(;this.index<this.list.length;){const e=this.list[this.index];if(!e)break;this.index++;const i=this.getValue(e);if(this.removeBookmark(i)!==this.removeBookmark(t)){this.morphContainer(e),this.event.emit("redo",i);break}}this.selection.synByBookmark(),A(`History redone, the last index is ${this.index}`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(){if(!this.canSave)return;const t=this.cloneContainer(),e=this.getValue(t);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(e)||(this.list.splice(this.index,1/0,t),this.index++,this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),this.event.emit("save",e),A(`History saved, the last index is ${this.index}`))}}var gi=["Shift","Meta","Alt","Control"],vi="object"==typeof navigator?navigator.platform:"",wi=/Mac|iPod|iPhone|iPad/.test(vi),yi=wi?"Meta":"Control",xi="Win32"===vi?["Control","Alt"]:wi?["Alt"]:[];function bi(t,e){return"function"==typeof t.getModifierState&&(t.getModifierState(e)||xi.includes(e)&&t.getModifierState("AltGraph"))}function ki(t){return t.trim().split(" ").map((function(t){var e=t.split(/\b\+/),i=e.pop();return[e=e.map((function(t){return"$mod"===t?yi:t})),i]}))}function _i(t,e){var i;void 0===e&&(e={});var n=null!=(i=e.timeout)?i:1e3,s=Object.keys(t).map((function(e){return[ki(e),t[e]]})),o=new Map,r=null;return function(t){t instanceof KeyboardEvent&&(s.forEach((function(e){var i=e[0],n=e[1],s=o.get(i)||i;!function(t,e){return!(e[1].toUpperCase()!==t.key.toUpperCase()&&e[1]!==t.code||e[0].find((function(e){return!bi(t,e)}))||gi.find((function(i){return!e[0].includes(i)&&e[1]!==i&&bi(t,i)})))}(t,s[0])?bi(t,t.key)||o.delete(i):s.length>1?o.set(i,s.slice(1)):(o.delete(i),n(t))})),r&&clearTimeout(r),r=setTimeout(o.clear.bind(o),n))}}const Si=new Map([["#","shift+#"]]);class Ci{constructor(t){this.keydownEventList=[],this.keyupEventList=[],this.container=t}normalizeType(t){var e;return t=(t=null!==(e=Si.get(t))&&void 0!==e?e:t).replace(/(^|\+|\s)mod(\+|\s|$)/g,"$1$mod$2").replace(/shift|control|alt|meta|enter|tab|backspace|delete|space|escape|arrow-left|arrow-right|arrow-up|arrow-down/,(t=>t.charAt(0).toUpperCase()+l(t.substring(1)))).replace(/(^|\+|\s)([a-z])(\+|\s|$)/g,((t,e,i,n)=>`${e}Key${i.toUpperCase()}${n}`))}setKeydown(t,e){t=this.normalizeType(t);const i=_i({[t]:t=>e(t)});this.keydownEventList.push({type:t,listener:e}),this.container.on("keydown",i)}setKeyup(t,e){t=this.normalizeType(t);const i=_i({[t]:t=>e(t)});this.keyupEventList.push({type:t,listener:e}),this.container.on("keyup",i)}keydown(t){t=this.normalizeType(t);for(const e of this.keydownEventList)if(e.type===t&&!1===e.listener(new Event(t)))break}keyup(t){t=this.normalizeType(t);for(const e of this.keyupEventList)if(e.type===t&&!1===e.listener(new Event(t)))break}}const Ai={value:"<p><br /><focus /></p>",readonly:!1,spellcheck:!1,tabIndex:0,indentWithTab:!0,minChangeSize:5,imageRequestMethod:"POST",imageRequestAction:"/upload",imageRequestTypes:["image/gif","image/jpeg","image/png","image/svg+xml"]};class Bi{constructor(t){if(this.unsavedInputData="",this.isComposing=!1,this.event=new qt,this.box=Bi.box,this.beforeunloadListener=()=>{this.commitUnsavedInputData()},this.selectionchangeListener=()=>{this.selection.syncByRange(),this.updateBoxSelectionStyle(),this.emitStateChangeEvent()},this.clickListener=t=>{const e=new T(t.target);e.closest(".lake-popup").length>0||this.event.emit("click",e)},this.resizeListener=()=>{this.event.emit("resize")},this.updateBoxSelectionStyle=ai((()=>{if(0===this.root.first().length)return;const t=this.selection.range,e=t.clone();e.adaptBox(),this.box.findAll(this).each((i=>{const n=new Qt(i),s=n.getContainer();if(0!==s.length){if(t.compareBeforeNode(s)<0&&t.compareAfterNode(s)>0&&(!t.isCollapsed||t.startNode.get(0)!==s.get(0)||0!==t.startOffset))return s.removeClass("lake-box-selected"),s.removeClass("lake-box-focused"),void s.addClass("lake-box-activated");if(e.intersectsNode(n.node))return s.removeClass("lake-box-activated"),void(t.isCollapsed?(s.removeClass("lake-box-selected"),s.addClass("lake-box-focused")):(s.removeClass("lake-box-focused"),s.addClass("lake-box-selected")));s.removeClass("lake-box-activated"),s.removeClass("lake-box-focused"),s.removeClass("lake-box-selected")}})),this.event.emit("boxselectionstylechange")}),50,{leading:!1,trailing:!0,maxWait:50}),this.emitStateChangeEvent=ai((()=>{const t=this.command.getNames();let e=this.selection.getAppliedItems();e.length>0&&e[0].node.closestContainer().get(0)!==this.container.get(0)&&(e=[]);const i=new Map,n=new Map,s=new Map;if(e.length>0)for(const o of t){const t=this.command.getItem(o);if(t.isDisabled&&t.isDisabled(e)&&i.set(o,!0),t.isSelected&&t.isSelected(e)&&n.set(o,!0),t.selectedValues){const i=t.selectedValues(e);i.length>0&&s.set(o,i)}}this.event.emit("statechange",{appliedItems:e,disabledNameMap:i,selectedNameMap:n,selectedValuesMap:s})}),100,{leading:!1,trailing:!0,maxWait:100}),this.emitChangeEvent=t=>{this.rectifyContent(),this.emitStateChangeEvent(),this.event.emit("change",t)},!t.root)throw new Error("The root of the config must be specified.");this.root=I(t.root),this.config=Object.assign(Object.assign({},Ai),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.selection=new hi(this.container),this.command=new ci(this.selection),this.history=new fi(this.selection),this.keystroke=new Ci(this.container),Gt.set(this.container.id,this)}inputInBoxStrip(){const t=this.selection,e=t.range,i=e.startNode.closest(".lake-box-strip"),n=i.closest("lake-box");if("inline"===new Qt(n).type)e.isBoxLeft?(e.setStartBefore(n),e.collapseToStart()):(e.setStartAfter(n),e.collapseToStart());else{const t=I("<p />");e.isBoxLeft?n.before(t):n.after(t),e.shrinkAfter(t)}const s=i.text();i.html("<br />"),t.insertNode(document.createTextNode(s))}bindInputEvents(){this.container.on("compositionstart",(()=>{this.isComposing=!0})),this.container.on("compositionend",(()=>{this.isComposing=!1})),this.container.on("beforeinput",(()=>{const t=this.selection.range;(t.isBoxLeft||t.isBoxRight)&&this.commitUnsavedInputData()})),this.container.on("input",(t=>{const e=t;window.setTimeout((()=>{var t;const i=this.selection.range;if(!i.isInsideBox)if(this.isComposing)this.event.emit("input",e);else{if("insertText"===e.inputType||"insertCompositionText"===e.inputType)if(i.isBoxLeft||i.isBoxRight)this.inputInBoxStrip();else if(this.unsavedInputData+=null!==(t=e.data)&&void 0!==t?t:"",this.unsavedInputData.length<this.config.minChangeSize)return void this.event.emit("input",e);this.history.save(),this.unsavedInputData="",this.event.emit("input",e)}}),0)})),this.command.event.on("beforeexecute",(()=>this.commitUnsavedInputData()))}bindHistoryEvents(){this.history.event.on("undo",(t=>{this.box.renderAll(this),this.emitChangeEvent(t)})),this.history.event.on("redo",(t=>{this.box.renderAll(this),this.emitChangeEvent(t)})),this.history.event.on("save",(t=>{this.box.rectifyInstances(this),this.emitChangeEvent(t)}))}bindFocusEvents(){this.container.on("focus",(()=>{this.root.addClass("lake-root-focused")})),this.container.on("blur",(()=>{this.root.removeClass("lake-root-focused")}))}rectifyContent(){let t=this.container.children();for(const e of t)(e.isBlock||e.isMark)&&""===e.html()&&(e.remove(),A("Rectifying content: empty tag was removed"));if(t=this.container.children(),0===t.length)return this.container.html("<p><br /></p>"),this.selection.range.shrinkAfter(this.container),void A("Rectifying content: default paragraph was added");if(1===t.length){const e=t[0];if(e.isVoid){const t=I("<p />");e.before(t),t.append(e),this.selection.range.shrinkAfter(t),A("Rectifying content: void element was wrapped in paragraph")}}}commitUnsavedInputData(){this.unsavedInputData.length>0&&(this.history.save(),this.unsavedInputData="")}prepareOperation(){this.commitUnsavedInputData(),this.history.pause()}commitOperation(){this.history.continue(),this.history.save()}focus(){this.container.focus()}blur(){this.container.blur()}setValue(t){t=u(t);const e=new ie(t).getFragment();this.container.empty(),this.container.append(e),Bi.box.renderAll(this),this.selection.synByBookmark()}getValue(){const t=this.selection.insertBookmark();let e=new ie(this.container).getHTML();return e=m(e),this.selection.toBookmark(t),e}insertBox(t,e){const i=function(t,e,i){if(t.commonAncestor.isOutside)return null;const n=new Qt(e);i&&(n.value=i);const s=document.createDocumentFragment();if(s.appendChild(n.node.get(0)),"inline"===n.type)return ce(t,s),n.render(),t.selectBoxRight(n.node),n;const o=ue(t);return o.left&&(t.setEndAfter(o.left),t.collapseToEnd()),o.right&&o.right.isEmpty&&o.right.remove(),ce(t,s),n.render(),t.selectBoxRight(n.node),o.left&&o.left.isEmpty&&o.left.remove(),n}(this.selection.range,t,e);if(!i)throw new Error(`Box '${t}' cannot be inserted outside the editor.`);return this.box.getInstances(this).set(i.node.id,i),i}removeBox(){const t=function(t){if(t.commonAncestor.isOutside)return null;const e=t.commonAncestor.closest("lake-box");if(0===e.length)return null;const i=new Qt(e);if("block"===i.type){const n=I("<p><br /></p>");return e.before(n),t.shrinkAfter(n),i.unmount(),e.remove(),i}t.setStartBefore(e),t.collapseToStart();const n=e.parent();return i.unmount(),e.remove(),n.isEmpty&&(P(n,I("<br />")),t.shrinkAfter(n)),i}(this.selection.range);if(t){this.box.getInstances(this).delete(t.node.id)}return t}render(){const t=u(this.config.value),e=new ie(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.container.append(e),this.readonly||(this.bindFocusEvents(),this.focus(),this.selection.synByBookmark(),this.history.save(),Bi.plugin.loadAll(this)),Bi.box.renderAll(this),this.readonly||(window.addEventListener("beforeunload",this.beforeunloadListener),document.addEventListener("selectionchange",this.selectionchangeListener),this.bindInputEvents(),this.bindHistoryEvents()),document.addEventListener("click",this.clickListener),window.addEventListener("resize",this.resizeListener)}unmount(){this.root.empty(),this.popupContainer.remove(),this.readonly||(window.removeEventListener("beforeunload",this.beforeunloadListener),document.removeEventListener("selectionchange",this.selectionchangeListener)),document.removeEventListener("click",this.clickListener),window.removeEventListener("resize",this.resizeListener)}}Bi.version="0.0.2",Bi.box=new class{add(t){Kt.set(t.name,t)}remove(t){Kt.delete(t)}getNames(){return Array.from(Kt.keys())}getInstances(t){let e=mi.get(t.container.id);return e||(e=new Map,mi.set(t.container.id,e),e)}rectifyInstances(t){const e=this.getInstances(t);for(const t of e.values())t.node.get(0).isConnected||(t.unmount(),e.delete(t.node.id))}findAll(t){return t.container.find("lake-box")}renderAll(t){this.rectifyInstances(t);const e=this.getInstances(t);this.findAll(t).each((t=>{const i=new T(t);if(e.get(i.id))return;const n=new Qt(i);n.render(),e.set(n.node.id,n)}))}},Bi.plugin=new class{constructor(){this.pluginList=[]}add(t){this.pluginList.push(t)}loadAll(t){this.pluginList.forEach((e=>{e(t)}))}};const Li=/^\{.*\}$/,Ti=/(\{(?:[^{}]+|\{(?:[^{}]+)*\})*\})/g,Ii=t=>t.substring(1,t.length-1),Ei=(t,e=!0,i="",n="")=>t.split(Ti).map((t=>{if(!t.match(Ti))return t;const e=Ii(t);if(e.startsWith("{"))return((t,e)=>{let[i,n]=t.split(":");n||(n=i,i=e);const s=n.split("|"),[o,r,a,l,h,c]=s,d=s.filter((t=>void 0!==t)).length;return 1===d?{k:i,r:o}:2===d?{k:i,o:o,r:r}:3===d?{k:i,z:o,o:r,r:a}:{k:i,z:o,o:r,t:a,f:l,m:h,r:c}})(Ii(e),n);const s=(t=>{const[e="",...i]=t.split("|"),[n="",s]=e.split(":"),[o,r]=n.split("?");return{k:o,i:s,n:""===r,f:i}})(e);return n=s.k||n,!i&&(i=n),s})).map((t=>{if("string"==typeof t)return t;t.k||(t.k=i||"0");const n=(t=>Object.fromEntries(Object.keys(t).map((e=>{const i=t[e];return[e,Array.isArray(i)?i.map((t=>null==t?void 0:t.trim())):i===!!i?i:null==i?void 0:i.trim()]}))))(t);return e?(s=n,Object.fromEntries(Object.entries(s).map((([t,e])=>"i"!==t&&e&&"0"!=e&&[t,e])).filter(Boolean))):n;var s})),Mi=(t,e,i)=>e.reduce(((e,i)=>{var n,s,o;return null!==(s=i.match(Li)?(t=>{var i;return null!==(i=t[e])&&void 0!==i?i:t["*"]})((o=i,Object.fromEntries(Ii(o).split(",").map((t=>t.split(":"))).reduce(((t,e)=>2===e.length?[...t,e.map((t=>t.trim()))]:(t[t.length-1][1]+=","+e[0],t)),[])))):null===(n=t[i])||void 0===n?void 0:n.call(t,e))&&void 0!==s?s:e}),i),Pi=/\?\?/g,Zi=(t,e,i,n)=>{const s=n[0],o=s&&"object"==typeof s&&s.constructor===Object;return((t,e,i,n)=>t.map((t=>{if("string"==typeof t)return t;const{k:s="0",f:o=[]}=t,r=n[s];if((t=>!(!t.o&&!t.r))(t))return(("boolean"==typeof r?r?t.o:t.r:((t,{z:e,o:i,t:n,f:s,m:o,r:r},a)=>{switch(e&&0==a?"zero":t.select(a)){case"zero":return e;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}})(e,t,r))||"").replace(Pi,r);const a=o.length?Mi(i,o,r):r;return(""+(null!=a?a:"")).trim()})).join(""))(t,e,i,1===n.length&&o?s:n)},zi=(t,e)=>{const i={},n=new Intl.PluralRules(t);return(t,...s)=>Zi(((t,e)=>t[e]||(t[e]=Ei(e)))(i,t),n,e,s)};const Ni=(t={},e)=>"string"==typeof t?e.bind(null,t):Object.assign(Object.defineProperty((()=>""),"name",{writable:!0}),t),Oi=(t,e)=>new Proxy(Ni(t,e),{get:(t,i)=>i===Symbol.iterator?[][Symbol.iterator].bind(Object.values(t).map((t=>Ni(t,e)))):Oi(t[i],e)});const Hi={"en-US":{toolbar:{undo:`Undo (${f("mod+Z")})`,redo:`Redo (${f("mod+Y")})`,selectAll:`Select all (${f("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 (${f("mod+B")})`,italic:`Italic (${f("mod+I")})`,underline:`Underline (${f("mod+U")})`,strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",code:"Inline code",removeFormat:"Remove format",formatPainter:"Format painter",link:"Link",hr:"Horizontal line",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",removeColor:"Remove color"},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"},codeBlock:{langType:"Select language"}},"zh-CN":{toolbar:{undo:`撤消 (${f("mod+Z")})`,redo:`重做 (${f("mod+Y")})`,selectAll:`全选 (${f("mod+A")})`,paragraph:"正文",blockQuote:"引用",numberedList:"编号",bulletedList:"项目符号",checklist:"任务列表",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignJustify:"两端对齐",increaseIndent:"增加缩进",decreaseIndent:"减少缩进",bold:`粗体 (${f("mod+B")})`,italic:`斜体 (${f("mod+I")})`,underline:`下划线 (${f("mod+U")})`,strikethrough:"删除线",superscript:"上标",subscript:"下标",code:"行内代码",removeFormat:"清除格式",formatPainter:"格式刷",link:"链接",hr:"分割线",codeBlock:"代码块",heading:"标题",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3",heading4:"标题 4",heading5:"标题 5",heading6:"标题 6",list:"列表",align:"对齐方式",indent:"缩进",fontFamily:"字体",fontSize:"文字大小",moreStyle:"更多样式",fontColor:"文字颜色",highlight:"文字背景",image:"图片",removeColor:"默认"},link:{newLink:"新链接",url:"链接 URL",title:"链接文本",copy:"复制到剪贴板",open:"打开链接",save:"确定",unlink:"取消链接"},image:{view:"查看大图",remove:"删除",previous:"上一张",next:"下一张",close:"关闭 (Esc)",loadingError:"图片加载失败",zoomOut:"缩小",zoomIn:"放大"},codeBlock:{langType:"选择代码语言"}},ja:{toolbar:{undo:`元に戻す (${f("mod+Z")})`,redo:`やり直し (${f("mod+Y")})`,selectAll:`すべて選択 (${f("mod+A")})`,paragraph:"テキスト",blockQuote:"ブロック引用",numberedList:"番号付きリスト",bulletedList:"箇条書きリスト",checklist:"タスクリスト",alignLeft:"左揃え",alignCenter:"中心揃え",alignRight:"右揃え",alignJustify:"左右に並べ替え",increaseIndent:"インデントを増やす",decreaseIndent:"インデントを減らす",bold:`太字 (${f("mod+B")})`,italic:`斜体 (${f("mod+I")})`,underline:`下線 (${f("mod+U")})`,strikethrough:"取り消し線",superscript:"上付き文字",subscript:"下付き文字",code:"インラインコード",removeFormat:"形式を削除",formatPainter:"形式ペインタ",link:"リンク",hr:"区切り線",codeBlock:"コードブロック",heading:"タイトル",heading1:"タイトル 1",heading2:"タイトル 2",heading3:"タイトル 3",heading4:"タイトル 4",heading5:"タイトル 5",heading6:"タイトル 6",list:"リスト",align:"文字揃え",indent:"インデント",fontFamily:"フォント",fontSize:"文字サイズ",moreStyle:"その他のスタイル",fontColor:"文字色",highlight:"文字の背景",image:"画像",removeColor:"デフォルト"},link:{newLink:"新しいリンク",url:"リンク URL",title:"リンク文字",copy:"クリップボードにコピー",open:"リンクを開く",save:"確認",unlink:"リンクを削除"},image:{view:"大きな画像を見る",remove:"削除",previous:"前の画像",next:"次の画像",close:"閉じる (Esc)",loadingError:"画像を読み込めません",zoomOut:"縮小",zoomIn:"拡大"},codeBlock:{langType:"コード言語を選択"}},ko:{toolbar:{undo:`작업취소 (${f("mod+Z")})`,redo:`작업재개 (${f("mod+Y")})`,selectAll:`전체 선택 (${f("mod+A")})`,paragraph:"텍스트",blockQuote:"인용문",numberedList:"순서 목록",bulletedList:"비순서 목록",checklist:"체크리스트",alignLeft:"왼쪽 정렬",alignCenter:"가운데 정렬",alignRight:"오른쪽 정렬",alignJustify:"좌우로 정렬",increaseIndent:"들여쓰기 증가",decreaseIndent:"들여쓰기 줄이기",bold:`굵게 (${f("mod+B")})`,italic:`기울임꼴 (${f("mod+I")})`,underline:`밑줄 (${f("mod+U")})`,strikethrough:"취소선",superscript:"위첨자",subscript:"아래 첨자",code:"인라인 코드",removeFormat:"형식 지우기",formatPainter:"형식 페인터",link:"링크",hr:"구분선",codeBlock:"코드 블록",heading:"제목",heading1:"제목 1",heading2:"제목 2",heading3:"제목 3",heading4:"제목 4",heading5:"제목 5",heading6:"제목 6",list:"목록",align:"정렬",indent:"들여쓰기",fontFamily:"글꼴",fontSize:"글자 크기",moreStyle:"더 많은 스타일",fontColor:"글자 색상",highlight:"글자 배경",image:"이미지",removeColor:"기본색"},link:{newLink:"새 링크",url:"링크 URL",title:"링크 텍스트",copy:"클립보드에 복사",open:"링크 열기",save:"확인",unlink:"링크 제거"},image:{view:"큰 이미지 보기",remove:"삭제",previous:"이전 이미지",next:"다음 이미지",close:"닫기 (Esc)",loadingError:"이미지를 로드할 수 없습니다",zoomOut:"축소",zoomIn:"확대"},codeBlock:{langType:"코드언어 선택"}}},Di=Object.keys(Hi),$i={},Vi={},Fi=t=>{$i[t]||($i[t]=Hi[t],(t=>{Vi[t]={}})(t))};Di.forEach(Fi);const Ri=(t=>function(t,e,i={}){return Oi(e,zi(t,i))}(t,$i[t],Vi[t]))(Di.indexOf(window.LAKE_LANGUAGE)>=0?window.LAKE_LANGUAGE:"en-US"),Wi=[{value:"h1",text:`<span style="font-weight: bold; font-size: 26px;">${Ri.toolbar.heading1()}</span>`},{value:"h2",text:`<span style="font-weight: bold; font-size: 24px;">${Ri.toolbar.heading2()}</span>`},{value:"h3",text:`<span style="font-weight: bold; font-size: 22px;">${Ri.toolbar.heading3()}</span>`},{value:"h4",text:`<span style="font-weight: bold; font-size: 20px;">${Ri.toolbar.heading4()}</span>`},{value:"h5",text:`<span style="font-weight: bold; font-size: 18px;">${Ri.toolbar.heading5()}</span>`},{value:"h6",text:`<span style="font-weight: bold; font-size: 16px;">${Ri.toolbar.heading6()}</span>`},{value:"p",text:Ri.toolbar.paragraph()}],ji=[{icon:n.get("numberedList"),value:"numbered",text:Ri.toolbar.numberedList()},{icon:n.get("bulletedList"),value:"bulleted",text:Ri.toolbar.bulletedList()},{icon:n.get("checklist"),value:"checklist",text:Ri.toolbar.checklist()}],Ui=[{icon:n.get("alignLeft"),value:"left",text:Ri.toolbar.alignLeft()},{icon:n.get("alignCenter"),value:"center",text:Ri.toolbar.alignCenter()},{icon:n.get("alignRight"),value:"right",text:Ri.toolbar.alignRight()},{icon:n.get("alignJustify"),value:"justify",text:Ri.toolbar.alignJustify()}],qi=[{icon:n.get("increaseIndent"),value:"increase",text:Ri.toolbar.increaseIndent()},{icon:n.get("decreaseIndent"),value:"decrease",text:Ri.toolbar.decreaseIndent()}],Ki=[{icon:n.get("italic"),value:"italic",text:Ri.toolbar.italic()},{icon:n.get("underline"),value:"underline",text:Ri.toolbar.underline()},{icon:n.get("strikethrough"),value:"strikethrough",text:Ri.toolbar.strikethrough()},{icon:n.get("superscript"),value:"superscript",text:Ri.toolbar.superscript()},{icon:n.get("subscript"),value:"subscript",text:Ri.toolbar.subscript()},{icon:n.get("code"),value:"code",text:Ri.toolbar.code()}],Gi=["#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"],Xi=[{icon:n.get("removeFormat"),value:"",text:Ri.toolbar.removeColor()}];for(const t of Gi)Xi.push({value:t.toLowerCase(),text:t.toUpperCase()});const Ji=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Yi=[{name:"undo",type:"button",icon:n.get("undo"),tooltip:Ri.toolbar.undo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"redo",type:"button",icon:n.get("redo"),tooltip:Ri.toolbar.redo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"selectAll",type:"button",icon:n.get("selectAll"),tooltip:Ri.toolbar.selectAll(),onClick:(t,e)=>{t.command.execute(e)}},{name:"paragraph",type:"button",icon:n.get("paragraph"),tooltip:Ri.toolbar.paragraph(),isSelected:t=>!!t.find((t=>"p"===t.name)),onClick:t=>{t.command.execute("heading","p")}},{name:"blockQuote",type:"button",icon:n.get("blockQuote"),tooltip:Ri.toolbar.blockQuote(),onClick:(t,e)=>{t.command.execute(e)}},{name:"numberedList",type:"button",icon:n.get("numberedList"),tooltip:Ri.toolbar.numberedList(),isSelected:t=>!!t.find((t=>"ol"===t.name)),onClick:t=>{t.command.execute("list","numbered")}},{name:"bulletedList",type:"button",icon:n.get("bulletedList"),tooltip:Ri.toolbar.bulletedList(),isSelected:t=>!!t.find((t=>"ul"===t.name&&!t.node.hasAttr("type"))),onClick:t=>{t.command.execute("list","bulleted")}},{name:"checklist",type:"button",icon:n.get("checklist"),tooltip:Ri.toolbar.checklist(),isSelected:t=>!!t.find((t=>"ul"===t.name&&"checklist"===t.node.attr("type"))),onClick:t=>{t.command.execute("list","checklist")}},{name:"alignLeft",type:"button",icon:n.get("alignLeft"),tooltip:Ri.toolbar.alignLeft(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"left"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","left")}},{name:"alignCenter",type:"button",icon:n.get("alignCenter"),tooltip:Ri.toolbar.alignCenter(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"center"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","center")}},{name:"alignRight",type:"button",icon:n.get("alignRight"),tooltip:Ri.toolbar.alignRight(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"right"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","right")}},{name:"alignJustify",type:"button",icon:n.get("alignJustify"),tooltip:Ri.toolbar.alignJustify(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"justify"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","justify")}},{name:"increaseIndent",type:"button",icon:n.get("increaseIndent"),tooltip:Ri.toolbar.increaseIndent(),onClick:t=>{t.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:n.get("decreaseIndent"),tooltip:Ri.toolbar.decreaseIndent(),onClick:t=>{t.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:n.get("bold"),tooltip:Ri.toolbar.bold(),onClick:(t,e)=>{t.command.execute(e)}},{name:"italic",type:"button",icon:n.get("italic"),tooltip:Ri.toolbar.italic(),onClick:(t,e)=>{t.command.execute(e)}},{name:"underline",type:"button",icon:n.get("underline"),tooltip:Ri.toolbar.underline(),onClick:(t,e)=>{t.command.execute(e)}},{name:"strikethrough",type:"button",icon:n.get("strikethrough"),tooltip:Ri.toolbar.strikethrough(),onClick:(t,e)=>{t.command.execute(e)}},{name:"superscript",type:"button",icon:n.get("superscript"),tooltip:Ri.toolbar.superscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"subscript",type:"button",icon:n.get("subscript"),tooltip:Ri.toolbar.subscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"code",type:"button",icon:n.get("code"),tooltip:Ri.toolbar.code(),onClick:(t,e)=>{t.command.execute(e)}},{name:"removeFormat",type:"button",icon:n.get("removeFormat"),tooltip:Ri.toolbar.removeFormat(),onClick:(t,e)=>{t.command.execute(e)}},{name:"formatPainter",type:"button",icon:n.get("formatPainter"),tooltip:Ri.toolbar.formatPainter(),onClick:(t,e)=>{t.command.execute(e)}},{name:"link",type:"button",icon:n.get("link"),tooltip:Ri.toolbar.link(),onClick:(t,e)=>{t.command.execute(e)}},{name:"hr",type:"button",icon:n.get("hr"),tooltip:Ri.toolbar.hr(),onClick:(t,e)=>{t.command.execute(e)}},{name:"codeBlock",type:"button",icon:n.get("codeBlock"),tooltip:Ri.toolbar.codeBlock(),onClick:(t,e)=>{t.command.execute(e)}},{name:"heading",type:"dropdown",downIcon:n.get("down"),defaultValue:"p",tooltip:Ri.toolbar.heading(),width:"100px",menuType:"list",menuItems:Wi,onSelect:(t,e)=>{t.command.execute("heading",e)}},{name:"list",type:"dropdown",downIcon:n.get("down"),icon:n.get("list"),defaultValue:"",tooltip:Ri.toolbar.list(),width:"auto",menuType:"list",menuItems:ji,onSelect:(t,e)=>{t.command.execute("list",e)}},{name:"align",type:"dropdown",downIcon:n.get("down"),icon:n.get("alignLeft"),defaultValue:"",tooltip:Ri.toolbar.align(),width:"auto",menuType:"list",menuItems:Ui,onSelect:(t,e)=>{t.command.execute("align",e)}},{name:"indent",type:"dropdown",downIcon:n.get("down"),icon:n.get("increaseIndent"),defaultValue:"",tooltip:Ri.toolbar.indent(),width:"auto",menuType:"list",menuItems:qi,onSelect:(t,e)=>{t.command.execute("indent",e)}},{name:"fontFamily",type:"dropdown",downIcon:n.get("down"),defaultValue:"Segoe UI",tooltip:Ri.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:(t,e)=>{t.command.execute("fontFamily",e)}},{name:"fontSize",type:"dropdown",downIcon:n.get("down"),defaultValue:"16px",tooltip:Ri.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:(t,e)=>{t.command.execute("fontSize",e)}},{name:"moreStyle",type:"dropdown",icon:n.get("more"),defaultValue:"",tooltip:Ri.toolbar.moreStyle(),width:"auto",menuType:"list",menuItems:Ki,selectedValues:t=>{var e;const i=[];for(const n of t)if(n.node.isMark){const t=null!==(e=Ji.get(n.name))&&void 0!==e?e:n.name;i.push(t)}return i},onSelect:(t,e)=>{t.command.execute(e)}},{name:"fontColor",type:"dropdown",downIcon:n.get("down"),icon:n.get("fontColor"),accentIcon:n.get("fontColorAccent"),defaultValue:"#f5222d",tooltip:Ri.toolbar.fontColor(),width:"auto",menuType:"color",menuItems:Xi,onSelect:(t,e)=>{t.command.execute("fontColor",e)}},{name:"highlight",type:"dropdown",downIcon:n.get("down"),icon:n.get("highlight"),accentIcon:n.get("highlightAccent"),defaultValue:"#fadb14",tooltip:Ri.toolbar.highlight(),width:"auto",menuType:"color",menuItems:Xi,onSelect:(t,e)=>{t.command.execute("highlight",e)}},{name:"image",type:"upload",icon:n.get("image"),tooltip:Ri.toolbar.image(),accept:"image/*",multiple:!0}];function Qi(t){const{editor:e,file:i,onError:n,onSuccess:s}=t,{imageRequestMethod:o,imageRequestAction:r,imageRequestTypes:a}=e.config;if(a.indexOf(i.type)<0)throw new Error(`Cannot upload file because its type '${i.type}' is not found in ['${a.join("', '")}'].`);const l=e.insertBox("image",{url:URL.createObjectURL(i),status:"uploading",name:i.name,size:i.size,type:i.type,lastModified:i.lastModified}),h=pt({onProgress:t=>{const e=l.node.find(".lake-percent"),i=Math.round(t.percent);e.text(`${i<100?i:99} %`)},onError:(t,e)=>{A(t.toString(),e),l.updateValue("status","error"),l.render(),n&&n()},onSuccess:t=>{if(!t.url)return l.updateValue("status","error"),l.render(),void(n&&n());l.updateValue({status:"done",url:t.url}),l.render(),e.history.save(),s&&s()},file:i,action:r,method:o});return l.setData("xhr",h),l}const tn=["undo","redo","|","heading","fontSize","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],en=new Map;Yi.forEach((t=>{en.set(t.name,t)}));function nn(t,e,i,n){return new(i||(i=Promise))((function(s,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))}
18
+ `);if(t.append(o),"color"===e.menuType&&(o.attr("title",i.text),o.find(".lake-dropdown-menu-text").css("background-color",i.value)),i.icon){const t=I('<div class="lake-dropdown-menu-icon"></div>');t.append(i.icon),o.prepend(t)}const a=n.get("check");if(a){const t=I('<div class="lake-dropdown-menu-check"></div>');t.append(a),o.prepend(t)}}}showMenu(){const t=this.config,e=this.node,i=e.find(".lake-dropdown-menu");if(e.attr("disabled"))return;const n=_e.getValue(e);i.find(".lake-dropdown-menu-check").css("visibility","hidden"),i.find("li").each((t=>{const e=I(t);e.on("mouseenter",(()=>{e.hasClass("lake-dropdown-item-selected")||e.addClass("lake-dropdown-item-hovered")})),e.on("mouseleave",(()=>{e.removeClass("lake-dropdown-item-hovered")})),n.indexOf(e.attr("value"))>=0&&e.find(".lake-dropdown-menu-check").css("visibility","visible")})),i.css("visibility","hidden"),i.show("color"===t.menuType?"flex":"block");e.get(0).getBoundingClientRect().x+i.width()+50>window.innerWidth?(i.css("left","auto"),i.css("right","0")):(i.css("left",""),i.css("right","")),i.css("visibility",""),document.addEventListener("click",this.documentClickListener)}bindEvents(){const t=this.config,e=this.node,i=e.find(".lake-dropdown-title"),n=i.find(".lake-dropdown-text"),s=i.find(".lake-dropdown-icon"),o=i.find(".lake-dropdown-down-icon"),r=e.find(".lake-dropdown-menu");"color"===t.menuType?(s.on("mouseenter",(()=>{e.attr("disabled")||s.addClass("lake-dropdown-icon-hovered")})),s.on("mouseleave",(()=>{s.removeClass("lake-dropdown-icon-hovered")})),o.on("mouseenter",(()=>{e.attr("disabled")||o.addClass("lake-dropdown-down-icon-hovered")})),o.on("mouseleave",(()=>{o.removeClass("lake-dropdown-down-icon-hovered")}))):(i.on("mouseenter",(()=>{e.attr("disabled")||i.addClass("lake-dropdown-title-hovered")})),i.on("mouseleave",(()=>{i.removeClass("lake-dropdown-title-hovered")}))),"color"===t.menuType&&s.on("click",(i=>{if(i.preventDefault(),e.attr("disabled"))return;const n=e.attr("color")||t.defaultValue;t.onSelect(n)}));("color"===t.menuType&&o?o:i).on("click",(t=>{t.preventDefault(),this.showMenu()})),r.on("click",(s=>{s.preventDefault();const o=I(s.target).closest("li"),a=o.attr("value");_e.setValue(e,[a]),n.length>0&&n.text(o.text()),"color"===t.menuType&&""!==a&&(e.attr("color",a),this.updateColorAccent(i,a)),t.onSelect(a),r.hide(),document.removeEventListener("click",this.documentClickListener)}))}render(){var t;const e=this.config,i=this.node,n=i.find(".lake-dropdown-title");e.downIcon||n.addClass("lake-dropdown-title-no-down"),n.css("width",e.width),n.attr("title",e.tooltip);const s=n.find(".lake-dropdown-text"),o=n.find(".lake-dropdown-icon");e.icon&&o.append(e.icon),e.accentIcon&&o.append(e.accentIcon);const r=n.find(".lake-dropdown-down-icon");e.downIcon&&r.append(e.downIcon);const a=I('<ul class="lake-dropdown-menu" />');if(a.addClass(`lake-${e.menuType}-dropdown-menu`),_e.setValue(i,[e.defaultValue]),s.length>0){const i=_e.getMenuMap(e.menuItems);s.text(null!==(t=i.get(e.defaultValue))&&void 0!==t?t:e.defaultValue)}"color"===e.menuType&&this.updateColorAccent(n,e.defaultValue),this.apppendMenuItems(a),i.append(n),i.append(a),this.root.append(i),this.bindEvents()}unmount(){this.node.remove(),document.removeEventListener("click",this.documentClickListener)}}var Se=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Ae="object"==typeof Rt&&Rt&&Rt.Object===Object&&Rt,Ce=Ae,Be="object"==typeof self&&self&&self.Object===Object&&self,Ee=Ce||Be||Function("return this")(),Te=Ee,Ie=function(){return Te.Date.now()},Le=/\s/;var Me=function(t){for(var e=t.length;e--&&Le.test(t.charAt(e)););return e},Pe=Me,Oe=/^\s+/;var ze=function(t){return t?t.slice(0,Pe(t)+1).replace(Oe,""):t},Ze=Ee.Symbol,Ne=Ze,He=Object.prototype,De=He.hasOwnProperty,$e=He.toString,Ve=Ne?Ne.toStringTag:void 0;var Fe=function(t){var e=De.call(t,Ve),i=t[Ve];try{t[Ve]=void 0;var n=!0}catch(t){}var s=$e.call(t);return n&&(e?t[Ve]=i:delete t[Ve]),s},je=Object.prototype.toString;var Re=Fe,We=function(t){return je.call(t)},Ue=Ze?Ze.toStringTag:void 0;var qe=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Ue&&Ue in Object(t)?Re(t):We(t)};var Ke=function(t){return null!=t&&"object"==typeof t},Ge=qe,Xe=Ke;var Je=ze,Ye=Se,Qe=function(t){return"symbol"==typeof t||Xe(t)&&"[object Symbol]"==Ge(t)},ti=/^[-+]0x[0-9a-f]+$/i,ei=/^0b[01]+$/i,ii=/^0o[0-7]+$/i,ni=parseInt;var si=Se,oi=Ie,ri=function(t){if("number"==typeof t)return t;if(Qe(t))return NaN;if(Ye(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ye(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Je(t);var i=ei.test(t);return i||ii.test(t)?ni(t.slice(2),i?2:8):ti.test(t)?NaN:+t},ai=Math.max,li=Math.min;var ci=function(t,e,i){var n,s,o,r,a,l,c=0,h=!1,d=!1,p=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function u(e){var i=n,o=s;return n=s=void 0,c=e,r=t.apply(o,i)}function m(t){var i=t-l;return void 0===l||i>=e||i<0||d&&t-c>=o}function f(){var t=oi();if(m(t))return g(t);a=setTimeout(f,function(t){var i=e-(t-l);return d?li(i,o-(t-c)):i}(t))}function g(t){return a=void 0,p&&n?u(t):(n=s=void 0,r)}function v(){var t=oi(),i=m(t);if(n=arguments,s=this,l=t,i){if(void 0===a)return function(t){return c=t,a=setTimeout(f,e),h?u(t):r}(l);if(d)return clearTimeout(a),a=setTimeout(f,e),u(l)}return void 0===a&&(a=setTimeout(f,e)),r}return e=ri(e)||0,si(i)&&(h=!!i.leading,o=(d="maxWait"in i)?ai(ri(i.maxWait)||0,e):o,p="trailing"in i?!!i.trailing:p),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=l=s=a=void 0},v.flush=function(){return void 0===a?r:g(oi())},v},hi=Wt(ci);var di=function(){this.__data__=[],this.size=0};var pi=function(t,e){return t===e||t!=t&&e!=e},ui=pi;var mi=function(t,e){for(var i=t.length;i--;)if(ui(t[i][0],e))return i;return-1},fi=mi,gi=Array.prototype.splice;var vi=function(t){var e=this.__data__,i=fi(e,t);return!(i<0)&&(i==e.length-1?e.pop():gi.call(e,i,1),--this.size,!0)},wi=mi;var yi=function(t){var e=this.__data__,i=wi(e,t);return i<0?void 0:e[i][1]},xi=mi;var bi=mi;var ki=function(t,e){var i=this.__data__,n=bi(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this},_i=di,Si=vi,Ai=yi,Ci=function(t){return xi(this.__data__,t)>-1},Bi=ki;function Ei(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Ei.prototype.clear=_i,Ei.prototype.delete=Si,Ei.prototype.get=Ai,Ei.prototype.has=Ci,Ei.prototype.set=Bi;var Ti=Ei,Ii=Ti;var Li=function(){this.__data__=new Ii,this.size=0};var Mi=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i};var Pi=function(t){return this.__data__.get(t)};var Oi=function(t){return this.__data__.has(t)},zi=qe,Zi=Se;var Ni,Hi=function(t){if(!Zi(t))return!1;var e=zi(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Di=Ee["__core-js_shared__"],$i=(Ni=/[^.]+$/.exec(Di&&Di.keys&&Di.keys.IE_PROTO||""))?"Symbol(src)_1."+Ni:"";var Vi=function(t){return!!$i&&$i in t},Fi=Function.prototype.toString;var ji=function(t){if(null!=t){try{return Fi.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Ri=Hi,Wi=Vi,Ui=Se,qi=ji,Ki=/^\[object .+?Constructor\]$/,Gi=Function.prototype,Xi=Object.prototype,Ji=Gi.toString,Yi=Xi.hasOwnProperty,Qi=RegExp("^"+Ji.call(Yi).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var tn=function(t){return!(!Ui(t)||Wi(t))&&(Ri(t)?Qi:Ki).test(qi(t))},en=function(t,e){return null==t?void 0:t[e]};var nn=function(t,e){var i=en(t,e);return tn(i)?i:void 0},sn=nn(Ee,"Map"),on=nn(Object,"create"),rn=on;var an=function(){this.__data__=rn?rn(null):{},this.size=0};var ln=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},cn=on,hn=Object.prototype.hasOwnProperty;var dn=function(t){var e=this.__data__;if(cn){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return hn.call(e,t)?e[t]:void 0},pn=on,un=Object.prototype.hasOwnProperty;var mn=on;var fn=an,gn=ln,vn=dn,wn=function(t){var e=this.__data__;return pn?void 0!==e[t]:un.call(e,t)},yn=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=mn&&void 0===e?"__lodash_hash_undefined__":e,this};function xn(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}xn.prototype.clear=fn,xn.prototype.delete=gn,xn.prototype.get=vn,xn.prototype.has=wn,xn.prototype.set=yn;var bn=xn,kn=Ti,_n=sn;var Sn=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var An=function(t,e){var i=t.__data__;return Sn(e)?i["string"==typeof e?"string":"hash"]:i.map},Cn=An;var Bn=An;var En=An;var Tn=An;var In=function(){this.size=0,this.__data__={hash:new bn,map:new(_n||kn),string:new bn}},Ln=function(t){var e=Cn(this,t).delete(t);return this.size-=e?1:0,e},Mn=function(t){return Bn(this,t).get(t)},Pn=function(t){return En(this,t).has(t)},On=function(t,e){var i=Tn(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this};function zn(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}zn.prototype.clear=In,zn.prototype.delete=Ln,zn.prototype.get=Mn,zn.prototype.has=Pn,zn.prototype.set=On;var Zn=zn,Nn=Ti,Hn=sn,Dn=Zn;var $n=Ti,Vn=Li,Fn=Mi,jn=Pi,Rn=Oi,Wn=function(t,e){var i=this.__data__;if(i instanceof Nn){var n=i.__data__;if(!Hn||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new Dn(n)}return i.set(t,e),this.size=i.size,this};function Un(t){var e=this.__data__=new $n(t);this.size=e.size}Un.prototype.clear=Vn,Un.prototype.delete=Fn,Un.prototype.get=jn,Un.prototype.has=Rn,Un.prototype.set=Wn;var qn=Un;var Kn=Zn,Gn=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Xn=function(t){return this.__data__.has(t)};function Jn(t){var e=-1,i=null==t?0:t.length;for(this.__data__=new Kn;++e<i;)this.add(t[e])}Jn.prototype.add=Jn.prototype.push=Gn,Jn.prototype.has=Xn;var Yn=function(t,e){for(var i=-1,n=null==t?0:t.length;++i<n;)if(e(t[i],i,t))return!0;return!1};var Qn=Jn,ts=Yn,es=function(t,e){return t.has(e)};var is=function(t,e,i,n,s,o){var r=1&i,a=t.length,l=e.length;if(a!=l&&!(r&&l>a))return!1;var c=o.get(t),h=o.get(e);if(c&&h)return c==e&&h==t;var d=-1,p=!0,u=2&i?new Qn:void 0;for(o.set(t,e),o.set(e,t);++d<a;){var m=t[d],f=e[d];if(n)var g=r?n(f,m,d,e,t,o):n(m,f,d,t,e,o);if(void 0!==g){if(g)continue;p=!1;break}if(u){if(!ts(e,(function(t,e){if(!es(u,e)&&(m===t||s(m,t,i,n,o)))return u.push(e)}))){p=!1;break}}else if(m!==f&&!s(m,f,i,n,o)){p=!1;break}}return o.delete(t),o.delete(e),p};var ns=function(t){var e=-1,i=Array(t.size);return t.forEach((function(t,n){i[++e]=[n,t]})),i};var ss=function(t){var e=-1,i=Array(t.size);return t.forEach((function(t){i[++e]=t})),i},os=Ee.Uint8Array,rs=pi,as=is,ls=ns,cs=ss,hs=Ze?Ze.prototype:void 0,ds=hs?hs.valueOf:void 0;var ps=function(t,e,i,n,s,o,r){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new os(t),new os(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return rs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=ls;case"[object Set]":var l=1&n;if(a||(a=cs),t.size!=e.size&&!l)return!1;var c=r.get(t);if(c)return c==e;n|=2,r.set(t,e);var h=as(a(t),a(e),n,s,o,r);return r.delete(t),h;case"[object Symbol]":if(ds)return ds.call(t)==ds.call(e)}return!1};var us=function(t,e){for(var i=-1,n=e.length,s=t.length;++i<n;)t[s+i]=e[i];return t},ms=Array.isArray,fs=us,gs=ms;var vs=function(t,e,i){var n=e(t);return gs(t)?n:fs(n,i(t))};var ws=function(t,e){for(var i=-1,n=null==t?0:t.length,s=0,o=[];++i<n;){var r=t[i];e(r,i,t)&&(o[s++]=r)}return o};var ys=ws,xs=function(){return[]},bs=Object.prototype.propertyIsEnumerable,ks=Object.getOwnPropertySymbols,_s=ks?function(t){return null==t?[]:(t=Object(t),ys(ks(t),(function(e){return bs.call(t,e)})))}:xs;var Ss=function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n},As=qe,Cs=Ke;var Bs=function(t){return Cs(t)&&"[object Arguments]"==As(t)},Es=Ke,Ts=Object.prototype,Is=Ts.hasOwnProperty,Ls=Ts.propertyIsEnumerable,Ms=Bs(function(){return arguments}())?Bs:function(t){return Es(t)&&Is.call(t,"callee")&&!Ls.call(t,"callee")},Ps=Ms,Os={exports:{}};var zs=function(){return!1};!function(t,e){var i=Ee,n=zs,s=e&&!e.nodeType&&e,o=s&&t&&!t.nodeType&&t,r=o&&o.exports===s?i.Buffer:void 0,a=(r?r.isBuffer:void 0)||n;t.exports=a}(Os,Os.exports);var Zs=Os.exports,Ns=/^(?:0|[1-9]\d*)$/;var Hs=function(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&Ns.test(t))&&t>-1&&t%1==0&&t<e};var Ds=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},$s=qe,Vs=Ds,Fs=Ke,js={};js["[object Float32Array]"]=js["[object Float64Array]"]=js["[object Int8Array]"]=js["[object Int16Array]"]=js["[object Int32Array]"]=js["[object Uint8Array]"]=js["[object Uint8ClampedArray]"]=js["[object Uint16Array]"]=js["[object Uint32Array]"]=!0,js["[object Arguments]"]=js["[object Array]"]=js["[object ArrayBuffer]"]=js["[object Boolean]"]=js["[object DataView]"]=js["[object Date]"]=js["[object Error]"]=js["[object Function]"]=js["[object Map]"]=js["[object Number]"]=js["[object Object]"]=js["[object RegExp]"]=js["[object Set]"]=js["[object String]"]=js["[object WeakMap]"]=!1;var Rs=function(t){return Fs(t)&&Vs(t.length)&&!!js[$s(t)]};var Ws=function(t){return function(e){return t(e)}},Us={exports:{}};!function(t,e){var i=Ae,n=e&&!e.nodeType&&e,s=n&&t&&!t.nodeType&&t,o=s&&s.exports===n&&i.process,r=function(){try{var t=s&&s.require&&s.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=r}(Us,Us.exports);var qs=Us.exports,Ks=Rs,Gs=Ws,Xs=qs&&qs.isTypedArray,Js=Xs?Gs(Xs):Ks,Ys=Ss,Qs=Ps,to=ms,eo=Zs,io=Hs,no=Js,so=Object.prototype.hasOwnProperty;var oo=function(t,e){var i=to(t),n=!i&&Qs(t),s=!i&&!n&&eo(t),o=!i&&!n&&!s&&no(t),r=i||n||s||o,a=r?Ys(t.length,String):[],l=a.length;for(var c in t)!e&&!so.call(t,c)||r&&("length"==c||s&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||io(c,l))||a.push(c);return a},ro=Object.prototype;var ao=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ro)};var lo=function(t,e){return function(i){return t(e(i))}}(Object.keys,Object),co=ao,ho=lo,po=Object.prototype.hasOwnProperty;var uo=Hi,mo=Ds;var fo=oo,go=function(t){if(!co(t))return ho(t);var e=[];for(var i in Object(t))po.call(t,i)&&"constructor"!=i&&e.push(i);return e},vo=function(t){return null!=t&&mo(t.length)&&!uo(t)};var wo=vs,yo=_s,xo=function(t){return vo(t)?fo(t):go(t)};var bo=function(t){return wo(t,xo,yo)},ko=Object.prototype.hasOwnProperty;var _o=function(t,e,i,n,s,o){var r=1&i,a=bo(t),l=a.length;if(l!=bo(e).length&&!r)return!1;for(var c=l;c--;){var h=a[c];if(!(r?h in e:ko.call(e,h)))return!1}var d=o.get(t),p=o.get(e);if(d&&p)return d==e&&p==t;var u=!0;o.set(t,e),o.set(e,t);for(var m=r;++c<l;){var f=t[h=a[c]],g=e[h];if(n)var v=r?n(g,f,h,e,t,o):n(f,g,h,t,e,o);if(!(void 0===v?f===g||s(f,g,i,n,o):v)){u=!1;break}m||(m="constructor"==h)}if(u&&!m){var w=t.constructor,y=e.constructor;w==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof w&&w instanceof w&&"function"==typeof y&&y instanceof y||(u=!1)}return o.delete(t),o.delete(e),u},So=nn(Ee,"DataView"),Ao=sn,Co=nn(Ee,"Promise"),Bo=nn(Ee,"Set"),Eo=nn(Ee,"WeakMap"),To=qe,Io=ji,Lo="[object Map]",Mo="[object Promise]",Po="[object Set]",Oo="[object WeakMap]",zo="[object DataView]",Zo=Io(So),No=Io(Ao),Ho=Io(Co),Do=Io(Bo),$o=Io(Eo),Vo=To;(So&&Vo(new So(new ArrayBuffer(1)))!=zo||Ao&&Vo(new Ao)!=Lo||Co&&Vo(Co.resolve())!=Mo||Bo&&Vo(new Bo)!=Po||Eo&&Vo(new Eo)!=Oo)&&(Vo=function(t){var e=To(t),i="[object Object]"==e?t.constructor:void 0,n=i?Io(i):"";if(n)switch(n){case Zo:return zo;case No:return Lo;case Ho:return Mo;case Do:return Po;case $o:return Oo}return e});var Fo=qn,jo=is,Ro=ps,Wo=_o,Uo=Vo,qo=ms,Ko=Zs,Go=Js,Xo="[object Arguments]",Jo="[object Array]",Yo="[object Object]",Qo=Object.prototype.hasOwnProperty;var tr=function(t,e,i,n,s,o){var r=qo(t),a=qo(e),l=r?Jo:Uo(t),c=a?Jo:Uo(e),h=(l=l==Xo?Yo:l)==Yo,d=(c=c==Xo?Yo:c)==Yo,p=l==c;if(p&&Ko(t)){if(!Ko(e))return!1;r=!0,h=!1}if(p&&!h)return o||(o=new Fo),r||Go(t)?jo(t,e,i,n,s,o):Ro(t,e,l,i,n,s,o);if(!(1&i)){var u=h&&Qo.call(t,"__wrapped__"),m=d&&Qo.call(e,"__wrapped__");if(u||m){var f=u?t.value():t,g=m?e.value():e;return o||(o=new Fo),s(f,g,i,n,o)}}return!!p&&(o||(o=new Fo),Wo(t,e,i,n,s,o))},er=Ke;var ir=function t(e,i,n,s,o){return e===i||(null==e||null==i||!er(e)&&!er(i)?e!=e&&i!=i:tr(e,i,n,s,t,o))},nr=ir;var sr=Wt((function(t,e){return nr(t,e)}));function or(t){const e=t.get(0),i={};if(e.hasAttributes())for(const t of e.attributes)i[t.name]=t.value;return i}class rr{constructor(t){const e=window.getSelection();if(!e)throw new Error("Selection object is null.");this.selection=e,this.container=t,this.range=this.getRangeFromNativeSelection()}getRangeFromNativeSelection(){if(this.selection.rangeCount>0){const t=this.selection.getRangeAt(0);return new L(t)}return new L}addRangeToNativeSelection(){this.selection.removeAllRanges(),this.selection.addRange(this.range.get())}syncByRange(){const t=this.getRangeFromNativeSelection();this.range.get()!==t.get()&&(this.range=t)}synByBookmark(){const t=this.range,e=this.container,i=e.find("lake-box[focus]");if(i.length>0)return ae(t,{anchor:new T,focus:i}),void this.addRangeToNativeSelection();ae(t,{anchor:e.find('lake-bookmark[type="anchor"]'),focus:e.find('lake-bookmark[type="focus"]')}),this.addRangeToNativeSelection()}getAppliedItems(){const t=[];return function(t,e){let i=e.startNode;for(i.isText&&(i=i.parent());i.length>0&&i.isInside;)t.push({node:i,name:i.name,attributes:or(i),styles:p(i.attr("style"))}),i=i.parent()}(t,this.range),function(t,e){const i=e.startNode;let n;if(i.isText&&i.text().length===e.startOffset){const t=i.next();t.length>0&&t.isElement&&(n=t)}if(i.isElement){const t=i.children();if(t.length>0){const i=t[e.startOffset];i&&i.isElement&&(n=i)}}if(n){let e=n;for(;e.length>0;)e.isElement&&t.push({node:e,name:e.name,attributes:or(e),styles:p(e.attr("style"))}),e=e.first()}}(t,this.range),t}insertBookmark(){return oe(this.range)}toBookmark(t){return ae(this.range,t)}insertNode(t){return se(this.range,t)}insertFragment(t){return he(this.range,t)}insertContents(t){return de(this.range,t)}deleteContents(){return ce(this.range)}setBlocks(t){return pe(this.range,t)}splitBlock(){return ue(this.range)}splitMarks(t){return ge(this.range,t)}addMark(t){return we(this.range,t)}removeMark(t){return xe(this.range,t)}fixList(){return le(this.range)}insertLink(t){return be(this.range,t)}}class ar{constructor(t){this.commandMap=new Map,this.event=new qt,this.selection=t}add(t,e){this.commandMap.set(t,e)}delete(t){this.commandMap.delete(t)}getNames(){return Array.from(this.commandMap.keys())}has(t){return void 0!==this.commandMap.get(t)}getItem(t){const e=this.commandMap.get(t);if(void 0===e)throw new Error(`Command '${t}' does not exist.`);return e}isDisabled(t){const e=this.getItem(t);if(!e.isDisabled)return!1;const i=this.selection.getAppliedItems();return e.isDisabled(i)}isSelected(t){const e=this.getItem(t);if(!e.isSelected)return!1;const i=this.selection.getAppliedItems();return e.isSelected(i)}selectedValues(t){const e=this.getItem(t);if(!e.selectedValues)return[];const i=this.selection.getAppliedItems();return e.selectedValues(i)}execute(t,...e){const i=this.getItem(t);this.event.emit("beforeexecute",t),i.execute.apply(this,e),this.event.emit("execute",t),C(`Command '${t}' executed`)}}var lr,cr={exports:{}};lr=cr,function(t){function e(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function i(t,i,n,s,o,r){return e((a=e(e(i,t),e(s,r)))<<(l=o)|a>>>32-l,n);var a,l}function n(t,e,n,s,o,r,a){return i(e&n|~e&s,t,e,o,r,a)}function s(t,e,n,s,o,r,a){return i(e&s|n&~s,t,e,o,r,a)}function o(t,e,n,s,o,r,a){return i(e^n^s,t,e,o,r,a)}function r(t,e,n,s,o,r,a){return i(n^(e|~s),t,e,o,r,a)}function a(t,i){var a,l,c,h,d;t[i>>5]|=128<<i%32,t[14+(i+64>>>9<<4)]=i;var p=1732584193,u=-271733879,m=-1732584194,f=271733878;for(a=0;a<t.length;a+=16)l=p,c=u,h=m,d=f,p=n(p,u,m,f,t[a],7,-680876936),f=n(f,p,u,m,t[a+1],12,-389564586),m=n(m,f,p,u,t[a+2],17,606105819),u=n(u,m,f,p,t[a+3],22,-1044525330),p=n(p,u,m,f,t[a+4],7,-176418897),f=n(f,p,u,m,t[a+5],12,1200080426),m=n(m,f,p,u,t[a+6],17,-1473231341),u=n(u,m,f,p,t[a+7],22,-45705983),p=n(p,u,m,f,t[a+8],7,1770035416),f=n(f,p,u,m,t[a+9],12,-1958414417),m=n(m,f,p,u,t[a+10],17,-42063),u=n(u,m,f,p,t[a+11],22,-1990404162),p=n(p,u,m,f,t[a+12],7,1804603682),f=n(f,p,u,m,t[a+13],12,-40341101),m=n(m,f,p,u,t[a+14],17,-1502002290),p=s(p,u=n(u,m,f,p,t[a+15],22,1236535329),m,f,t[a+1],5,-165796510),f=s(f,p,u,m,t[a+6],9,-1069501632),m=s(m,f,p,u,t[a+11],14,643717713),u=s(u,m,f,p,t[a],20,-373897302),p=s(p,u,m,f,t[a+5],5,-701558691),f=s(f,p,u,m,t[a+10],9,38016083),m=s(m,f,p,u,t[a+15],14,-660478335),u=s(u,m,f,p,t[a+4],20,-405537848),p=s(p,u,m,f,t[a+9],5,568446438),f=s(f,p,u,m,t[a+14],9,-1019803690),m=s(m,f,p,u,t[a+3],14,-187363961),u=s(u,m,f,p,t[a+8],20,1163531501),p=s(p,u,m,f,t[a+13],5,-1444681467),f=s(f,p,u,m,t[a+2],9,-51403784),m=s(m,f,p,u,t[a+7],14,1735328473),p=o(p,u=s(u,m,f,p,t[a+12],20,-1926607734),m,f,t[a+5],4,-378558),f=o(f,p,u,m,t[a+8],11,-2022574463),m=o(m,f,p,u,t[a+11],16,1839030562),u=o(u,m,f,p,t[a+14],23,-35309556),p=o(p,u,m,f,t[a+1],4,-1530992060),f=o(f,p,u,m,t[a+4],11,1272893353),m=o(m,f,p,u,t[a+7],16,-155497632),u=o(u,m,f,p,t[a+10],23,-1094730640),p=o(p,u,m,f,t[a+13],4,681279174),f=o(f,p,u,m,t[a],11,-358537222),m=o(m,f,p,u,t[a+3],16,-722521979),u=o(u,m,f,p,t[a+6],23,76029189),p=o(p,u,m,f,t[a+9],4,-640364487),f=o(f,p,u,m,t[a+12],11,-421815835),m=o(m,f,p,u,t[a+15],16,530742520),p=r(p,u=o(u,m,f,p,t[a+2],23,-995338651),m,f,t[a],6,-198630844),f=r(f,p,u,m,t[a+7],10,1126891415),m=r(m,f,p,u,t[a+14],15,-1416354905),u=r(u,m,f,p,t[a+5],21,-57434055),p=r(p,u,m,f,t[a+12],6,1700485571),f=r(f,p,u,m,t[a+3],10,-1894986606),m=r(m,f,p,u,t[a+10],15,-1051523),u=r(u,m,f,p,t[a+1],21,-2054922799),p=r(p,u,m,f,t[a+8],6,1873313359),f=r(f,p,u,m,t[a+15],10,-30611744),m=r(m,f,p,u,t[a+6],15,-1560198380),u=r(u,m,f,p,t[a+13],21,1309151649),p=r(p,u,m,f,t[a+4],6,-145523070),f=r(f,p,u,m,t[a+11],10,-1120210379),m=r(m,f,p,u,t[a+2],15,718787259),u=r(u,m,f,p,t[a+9],21,-343485551),p=e(p,l),u=e(u,c),m=e(m,h),f=e(f,d);return[p,u,m,f]}function l(t){var e,i="",n=32*t.length;for(e=0;e<n;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i}function c(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e<i.length;e+=1)i[e]=0;var n=8*t.length;for(e=0;e<n;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i}function h(t){var e,i,n="0123456789abcdef",s="";for(i=0;i<t.length;i+=1)e=t.charCodeAt(i),s+=n.charAt(e>>>4&15)+n.charAt(15&e);return s}function d(t){return unescape(encodeURIComponent(t))}function p(t){return function(t){return l(a(c(t),8*t.length))}(d(t))}function u(t,e){return function(t,e){var i,n,s=c(t),o=[],r=[];for(o[15]=r[15]=void 0,s.length>16&&(s=a(s,8*t.length)),i=0;i<16;i+=1)o[i]=909522486^s[i],r[i]=1549556828^s[i];return n=a(o.concat(c(e)),512+8*e.length),l(a(r.concat(n),640))}(d(t),d(e))}function m(t,e,i){return e?i?u(e,t):h(u(e,t)):i?p(t):h(p(t))}lr.exports?lr.exports=m:t.md5=m}(Rt);var hr=Wt(cr.exports);const dr=new Map;class pr{constructor(t){this.list=[],this.index=0,this.canSave=!0,this.limit=100,this.event=new qt,this.selection=t,this.container=t.container}removeBookmark(t){return t.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(t){return new ie(t).getHTML()}addIdToBoxes(t){t.find("lake-box").each((t=>{const e=new T(t),i=hr(`${e.attr("type")}-${e.attr("name")}-${e.attr("value")}`);e.attr("id",i)}))}removeIdfromBoxes(t){t.find("lake-box").each((t=>{new T(t).removeAttr("id")}))}morphContainer(t){const e=this.container,i={beforeChildrenUpdated:t=>{if("lake-box"===new T(t).name)return!1},afterAttributeUpdated:(t,i)=>{const n=new T(i);if("value"===t&&"lake-box"===n.name){const t=dr.get(e.id);if(!t)return;t.delete(n.id)}}},n=t.clone(!0);this.addIdToBoxes(e),this.addIdToBoxes(n),ht(e,n,{callbacks:i}),this.removeIdfromBoxes(e),this.removeIdfromBoxes(n)}cloneContainer(){const t=this.selection.range,e=this.container.clone(!0);if(e.find("lake-box").each((t=>{new Qt(t).getContainer().empty()})),t.commonAncestor.isOutside)return e;if(t.isInsideBox)return e;const i=t.startNode.path(),n=t.endNode.path(),s=e.find(i),o=e.find(n),r=t.clone();return r.setStart(s,t.startOffset),r.setEnd(o,t.endOffset),oe(r),e}get count(){return this.list.length}get canUndo(){return this.index>1&&!!this.list[this.index-1]}get canRedo(){return!!this.list[this.index]}undo(){if(!this.list[this.index-1])return;this.selection.insertBookmark();const t=this.getValue(this.container);for(;this.index>0;){const e=this.list[this.index-1];if(!e)break;const i=this.getValue(e);if(this.removeBookmark(i)!==this.removeBookmark(t)){this.morphContainer(e),this.event.emit("undo",i);break}if(1===this.index)break;this.index--}this.selection.synByBookmark(),C(`History undone, the last index is ${this.index}`)}redo(){if(!this.list[this.index])return;this.selection.insertBookmark();const t=this.getValue(this.container);for(;this.index<this.list.length;){const e=this.list[this.index];if(!e)break;this.index++;const i=this.getValue(e);if(this.removeBookmark(i)!==this.removeBookmark(t)){this.morphContainer(e),this.event.emit("redo",i);break}}this.selection.synByBookmark(),C(`History redone, the last index is ${this.index}`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(t=!0){if(!this.canSave)return;const e=this.cloneContainer(),i=this.getValue(e);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(i)||(this.list.splice(this.index,1/0,e),this.index++,this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),t&&this.event.emit("save",m(i)),C(`History saved, the last index is ${this.index}`))}}var ur=["Shift","Meta","Alt","Control"],mr="object"==typeof navigator?navigator.platform:"",fr=/Mac|iPod|iPhone|iPad/.test(mr),gr=fr?"Meta":"Control",vr="Win32"===mr?["Control","Alt"]:fr?["Alt"]:[];function wr(t,e){return"function"==typeof t.getModifierState&&(t.getModifierState(e)||vr.includes(e)&&t.getModifierState("AltGraph"))}function yr(t){return t.trim().split(" ").map((function(t){var e=t.split(/\b\+/),i=e.pop();return[e=e.map((function(t){return"$mod"===t?gr:t})),i]}))}function xr(t,e){var i;void 0===e&&(e={});var n=null!=(i=e.timeout)?i:1e3,s=Object.keys(t).map((function(e){return[yr(e),t[e]]})),o=new Map,r=null;return function(t){t instanceof KeyboardEvent&&(s.forEach((function(e){var i=e[0],n=e[1],s=o.get(i)||i;!function(t,e){return!(e[1].toUpperCase()!==t.key.toUpperCase()&&e[1]!==t.code||e[0].find((function(e){return!wr(t,e)}))||ur.find((function(i){return!e[0].includes(i)&&e[1]!==i&&wr(t,i)})))}(t,s[0])?wr(t,t.key)||o.delete(i):s.length>1?o.set(i,s.slice(1)):(o.delete(i),n(t))})),r&&clearTimeout(r),r=setTimeout(o.clear.bind(o),n))}}const br=new Map([["#","shift+#"]]);class kr{constructor(t){this.keydownEventList=[],this.keyupEventList=[],this.container=t}normalizeType(t){var e;return t=(t=null!==(e=br.get(t))&&void 0!==e?e:t).replace(/(^|\+|\s)mod(\+|\s|$)/g,"$1$mod$2").replace(/shift|control|alt|meta|enter|tab|backspace|delete|space|escape|arrow-left|arrow-right|arrow-up|arrow-down/,(t=>t.charAt(0).toUpperCase()+l(t.substring(1)))).replace(/(^|\+|\s)([a-z])(\+|\s|$)/g,((t,e,i,n)=>`${e}Key${i.toUpperCase()}${n}`))}setKeydown(t,e){t=this.normalizeType(t);const i=xr({[t]:t=>e(t)});this.keydownEventList.push({type:t,listener:e}),this.container.on("keydown",i)}setKeyup(t,e){t=this.normalizeType(t);const i=xr({[t]:t=>e(t)});this.keyupEventList.push({type:t,listener:e}),this.container.on("keyup",i)}keydown(t){t=this.normalizeType(t);for(const e of this.keydownEventList)if(e.type===t&&!1===e.listener(new Event(t)))break}keyup(t){t=this.normalizeType(t);for(const e of this.keyupEventList)if(e.type===t&&!1===e.listener(new Event(t)))break}}const _r={value:"<p><br /><focus /></p>",readonly:!1,spellcheck:!1,tabIndex:0,indentWithTab:!0,minChangeSize:5,imageRequestMethod:"POST",imageRequestAction:"/upload",imageRequestTypes:["image/gif","image/jpeg","image/png","image/svg+xml"]};class Sr{constructor(t){if(this.unsavedInputData="",this.stateData={appliedItems:[],disabledNameMap:new Map,selectedNameMap:new Map,selectedValuesMap:new Map},this.isComposing=!1,this.event=new qt,this.box=Sr.box,this.beforeunloadListener=()=>{this.history.save()},this.selectionchangeListener=()=>{this.selection.syncByRange(),this.updateBoxSelectionStyle(),this.emitStateChangeEvent()},this.clickListener=t=>{const e=new T(t.target);e.closest(".lake-popup").length>0||this.event.emit("click",e)},this.resizeListener=()=>{this.event.emit("resize")},this.updateBoxSelectionStyle=hi((()=>{if(0===this.root.first().length)return;const t=this.selection.range,e=t.clone();e.adaptBox(),this.box.findAll(this).each((i=>{const n=new Qt(i),s=n.getContainer();if(0!==s.length){if(t.compareBeforeNode(s)<0&&t.compareAfterNode(s)>0&&(!t.isCollapsed||t.startNode.get(0)!==s.get(0)||0!==t.startOffset))return s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.removeClass("lake-box-focused"),void s.addClass("lake-box-activated");if(e.intersectsNode(n.node))return s.removeClass("lake-box-activated"),void(t.isCollapsed?(s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.addClass("lake-box-focused")):(s.removeClass("lake-box-focused"),s.addClass("lake-box-selected")));s.removeClass("lake-box-activated"),s.removeClass("lake-box-focused"),s.removeClass("lake-box-selected")}})),this.event.emit("boxselectionstylechange")}),50,{leading:!1,trailing:!0,maxWait:50}),this.emitStateChangeEvent=hi((()=>{const t=this.command.getNames();let e=this.selection.getAppliedItems();e.length>0&&e[0].node.closestContainer().get(0)!==this.container.get(0)&&(e=[]);const i=new Map,n=new Map,s=new Map;if(e.length>0)for(const o of t){const t=this.command.getItem(o);if(t.isDisabled&&t.isDisabled(e)&&i.set(o,!0),t.isSelected&&t.isSelected(e)&&n.set(o,!0),t.selectedValues){const i=t.selectedValues(e);i.length>0&&s.set(o,i)}}const o={appliedItems:e,disabledNameMap:i,selectedNameMap:n,selectedValuesMap:s};sr(o,this.stateData)||(this.toolbar&&this.toolbar.updateState(o),this.event.emit("statechange",o),this.stateData=o)}),100,{leading:!1,trailing:!0,maxWait:100}),this.emitChangeEvent=t=>{this.rectifyContent(),this.emitStateChangeEvent(),this.event.emit("change",t)},!t.root)throw new Error("The root of the config must be specified.");this.root=I(t.root),this.toolbar=t.toolbar,this.config=Object.assign(Object.assign({},_r),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.selection=new rr(this.container),this.command=new ar(this.selection),this.history=new pr(this.selection),this.keystroke=new kr(this.container),Gt.set(this.container.id,this)}inputInBoxStrip(){const t=this.selection,e=t.range,i=e.startNode.closest(".lake-box-strip"),n=i.closest("lake-box");if("inline"===new Qt(n).type)e.isBoxStart?(e.setStartBefore(n),e.collapseToStart()):(e.setStartAfter(n),e.collapseToStart());else{const t=I("<p />");e.isBoxStart?n.before(t):n.after(t),e.shrinkAfter(t)}const s=i.text();i.html("<br />"),t.insertNode(document.createTextNode(s))}bindInputEvents(){this.container.on("compositionstart",(()=>{this.isComposing=!0})),this.container.on("compositionend",(()=>{this.isComposing=!1})),this.container.on("beforeinput",(t=>{const e=t,i=this.selection.range;(i.isBoxStart||i.isBoxEnd||"insertText"!==e.inputType&&"insertCompositionText"!==e.inputType)&&this.commitUnsavedInputData()})),this.container.on("input",(t=>{const e=t;window.setTimeout((()=>{var t;const i=this.selection.range;if(!i.isInsideBox)if(this.isComposing)this.event.emit("input",e);else{if(i.isBoxStart||i.isBoxEnd)return this.inputInBoxStrip(),this.history.save(),void this.event.emit("input",e);if(("insertText"===e.inputType||"insertCompositionText"===e.inputType)&&(this.unsavedInputData+=null!==(t=e.data)&&void 0!==t?t:"",this.unsavedInputData.length<this.config.minChangeSize))return this.event.emit("input",e),void this.emitChangeEvent(this.getValue());this.history.save(),this.event.emit("input",e)}}),0)})),this.command.event.on("beforeexecute",(()=>this.commitUnsavedInputData()))}bindHistoryEvents(){this.history.event.on("undo",(t=>{this.box.renderAll(this),this.emitChangeEvent(t)})),this.history.event.on("redo",(t=>{this.box.renderAll(this),this.emitChangeEvent(t)})),this.history.event.on("save",(t=>{this.box.rectifyInstances(this),this.emitChangeEvent(t)}))}bindFocusEvents(){this.container.on("focus",(()=>{this.root.addClass("lake-root-focused")})),this.container.on("blur",(()=>{this.root.removeClass("lake-root-focused")}))}rectifyContent(){let t=this.container.children();for(const e of t)(e.isBlock||e.isMark)&&""===e.html()&&(e.remove(),C("Rectifying content: empty tag was removed"));if(t=this.container.children(),0===t.length)return this.container.html("<p><br /></p>"),this.selection.range.shrinkAfter(this.container),void C("Rectifying content: default paragraph was added");if(1===t.length){const e=t[0];if(e.isVoid){const t=I("<p />");e.before(t),t.append(e),this.selection.range.shrinkAfter(t),C("Rectifying content: void element was wrapped in paragraph")}}}commitUnsavedInputData(){this.unsavedInputData.length>0&&(this.history.save(!1),this.unsavedInputData="")}prepareOperation(){this.commitUnsavedInputData(),this.history.pause()}commitOperation(){this.history.continue(),this.history.save()}focus(){this.container.focus()}blur(){this.container.blur()}setValue(t){t=u(t);const e=new ie(t).getFragment();this.container.empty(),this.container.append(e),Sr.box.renderAll(this),this.selection.synByBookmark()}getValue(){const t=this.selection.insertBookmark();let e=new ie(this.container).getHTML();return e=m(e),this.selection.toBookmark(t),e}insertBox(t,e){const i=function(t,e,i){if(t.commonAncestor.isOutside)return null;const n=new Qt(e);i&&(n.value=i);const s=document.createDocumentFragment();if(s.appendChild(n.node.get(0)),"inline"===n.type)return he(t,s),n.render(),t.selectBoxEnd(n.node),n;const o=ue(t);return o.start&&(t.setEndAfter(o.start),t.collapseToEnd()),o.end&&o.end.isEmpty&&o.end.remove(),he(t,s),n.render(),t.selectBoxEnd(n.node),o.start&&o.start.isEmpty&&o.start.remove(),n}(this.selection.range,t,e);if(!i)throw new Error(`Box '${t}' cannot be inserted outside the editor.`);return this.box.getInstances(this).set(i.node.id,i),i}removeBox(){const t=function(t){if(t.commonAncestor.isOutside)return null;const e=t.commonAncestor.closest("lake-box");if(0===e.length)return null;const i=new Qt(e);if("block"===i.type){const n=I("<p><br /></p>");return e.before(n),t.shrinkAfter(n),i.unmount(),e.remove(),i}t.setStartBefore(e),t.collapseToStart();const n=e.parent();return i.unmount(),e.remove(),n.isEmpty&&(P(n,I("<br />")),t.shrinkAfter(n)),i}(this.selection.range);if(t){this.box.getInstances(this).delete(t.node.id)}return t}render(){const t=u(this.config.value),e=new ie(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.container.append(e),this.readonly||(this.bindFocusEvents(),this.focus(),this.selection.synByBookmark(),this.history.save(),Sr.plugin.loadAll(this)),Sr.box.renderAll(this),this.toolbar&&this.toolbar.render(this),this.readonly||(window.addEventListener("beforeunload",this.beforeunloadListener),document.addEventListener("selectionchange",this.selectionchangeListener),this.bindInputEvents(),this.bindHistoryEvents()),document.addEventListener("click",this.clickListener),window.addEventListener("resize",this.resizeListener)}unmount(){this.root.empty(),this.popupContainer.remove(),this.readonly||(window.removeEventListener("beforeunload",this.beforeunloadListener),document.removeEventListener("selectionchange",this.selectionchangeListener)),document.removeEventListener("click",this.clickListener),window.removeEventListener("resize",this.resizeListener)}}Sr.version="0.0.6",Sr.box=new class{add(t){Kt.set(t.name,t)}remove(t){Kt.delete(t)}getNames(){return Array.from(Kt.keys())}getInstances(t){let e=dr.get(t.container.id);return e||(e=new Map,dr.set(t.container.id,e),e)}rectifyInstances(t){const e=this.getInstances(t);for(const t of e.values())t.node.get(0).isConnected||(t.unmount(),e.delete(t.node.id))}findAll(t){return t.container.find("lake-box")}renderAll(t){this.rectifyInstances(t);const e=this.getInstances(t);this.findAll(t).each((t=>{const i=new T(t);if(e.get(i.id))return;const n=new Qt(i);n.render(),e.set(n.node.id,n)}))}},Sr.plugin=new class{constructor(){this.pluginList=[]}add(t){this.pluginList.push(t)}loadAll(t){this.pluginList.forEach((e=>{e(t)}))}};const Ar=/^\{.*\}$/,Cr=/(\{(?:[^{}]+|\{(?:[^{}]+)*\})*\})/g,Br=t=>t.substring(1,t.length-1),Er=(t,e=!0,i="",n="")=>t.split(Cr).map((t=>{if(!t.match(Cr))return t;const e=Br(t);if(e.startsWith("{"))return((t,e)=>{let[i,n]=t.split(":");n||(n=i,i=e);const s=n.split("|"),[o,r,a,l,c,h]=s,d=s.filter((t=>void 0!==t)).length;return 1===d?{k:i,r:o}:2===d?{k:i,o:o,r:r}:3===d?{k:i,z:o,o:r,r:a}:{k:i,z:o,o:r,t:a,f:l,m:c,r:h}})(Br(e),n);const s=(t=>{const[e="",...i]=t.split("|"),[n="",s]=e.split(":"),[o,r]=n.split("?");return{k:o,i:s,n:""===r,f:i}})(e);return n=s.k||n,!i&&(i=n),s})).map((t=>{if("string"==typeof t)return t;t.k||(t.k=i||"0");const n=(t=>Object.fromEntries(Object.keys(t).map((e=>{const i=t[e];return[e,Array.isArray(i)?i.map((t=>null==t?void 0:t.trim())):i===!!i?i:null==i?void 0:i.trim()]}))))(t);return e?(s=n,Object.fromEntries(Object.entries(s).map((([t,e])=>"i"!==t&&e&&"0"!=e&&[t,e])).filter(Boolean))):n;var s})),Tr=(t,e,i)=>e.reduce(((e,i)=>{var n,s,o;return null!==(s=i.match(Ar)?(t=>{var i;return null!==(i=t[e])&&void 0!==i?i:t["*"]})((o=i,Object.fromEntries(Br(o).split(",").map((t=>t.split(":"))).reduce(((t,e)=>2===e.length?[...t,e.map((t=>t.trim()))]:(t[t.length-1][1]+=","+e[0],t)),[])))):null===(n=t[i])||void 0===n?void 0:n.call(t,e))&&void 0!==s?s:e}),i),Ir=/\?\?/g,Lr=(t,e,i,n)=>{const s=n[0],o=s&&"object"==typeof s&&s.constructor===Object;return((t,e,i,n)=>t.map((t=>{if("string"==typeof t)return t;const{k:s="0",f:o=[]}=t,r=n[s];if((t=>!(!t.o&&!t.r))(t))return(("boolean"==typeof r?r?t.o:t.r:((t,{z:e,o:i,t:n,f:s,m:o,r:r},a)=>{switch(e&&0==a?"zero":t.select(a)){case"zero":return e;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}})(e,t,r))||"").replace(Ir,r);const a=o.length?Tr(i,o,r):r;return(""+(null!=a?a:"")).trim()})).join(""))(t,e,i,1===n.length&&o?s:n)},Mr=(t,e)=>{const i={},n=new Intl.PluralRules(t);return(t,...s)=>Lr(((t,e)=>t[e]||(t[e]=Er(e)))(i,t),n,e,s)};const Pr=(t={},e)=>"string"==typeof t?e.bind(null,t):Object.assign(Object.defineProperty((()=>""),"name",{writable:!0}),t),Or=(t,e)=>new Proxy(Pr(t,e),{get:(t,i)=>i===Symbol.iterator?[][Symbol.iterator].bind(Object.values(t).map((t=>Pr(t,e)))):Or(t[i],e)});const zr={"en-US":{toolbar:{undo:`Undo (${f("mod+Z")})`,redo:`Redo (${f("mod+Y")})`,selectAll:`Select all (${f("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 (${f("mod+B")})`,italic:`Italic (${f("mod+I")})`,underline:`Underline (${f("mod+U")})`,strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",code:"Inline code",removeFormat:"Remove format",formatPainter:"Format painter",link:"Link",hr:"Horizontal line",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",removeColor:"Remove color"},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"},codeBlock:{langType:"Select language"}},"zh-CN":{toolbar:{undo:`撤消 (${f("mod+Z")})`,redo:`重做 (${f("mod+Y")})`,selectAll:`全选 (${f("mod+A")})`,paragraph:"正文",blockQuote:"引用",numberedList:"编号",bulletedList:"项目符号",checklist:"任务列表",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignJustify:"两端对齐",increaseIndent:"增加缩进",decreaseIndent:"减少缩进",bold:`粗体 (${f("mod+B")})`,italic:`斜体 (${f("mod+I")})`,underline:`下划线 (${f("mod+U")})`,strikethrough:"删除线",superscript:"上标",subscript:"下标",code:"行内代码",removeFormat:"清除格式",formatPainter:"格式刷",link:"链接",hr:"分割线",codeBlock:"代码块",heading:"标题",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3",heading4:"标题 4",heading5:"标题 5",heading6:"标题 6",list:"列表",align:"对齐方式",indent:"缩进",fontFamily:"字体",fontSize:"文字大小",moreStyle:"更多样式",fontColor:"文字颜色",highlight:"文字背景",image:"图片",removeColor:"默认"},link:{newLink:"新链接",url:"链接 URL",title:"链接文本",copy:"复制到剪贴板",open:"打开链接",save:"确定",unlink:"取消链接"},image:{view:"查看大图",remove:"删除",previous:"上一张",next:"下一张",close:"关闭 (Esc)",loadingError:"图片加载失败",zoomOut:"缩小",zoomIn:"放大"},codeBlock:{langType:"选择代码语言"}},ja:{toolbar:{undo:`元に戻す (${f("mod+Z")})`,redo:`やり直し (${f("mod+Y")})`,selectAll:`すべて選択 (${f("mod+A")})`,paragraph:"テキスト",blockQuote:"ブロック引用",numberedList:"番号付きリスト",bulletedList:"箇条書きリスト",checklist:"タスクリスト",alignLeft:"左揃え",alignCenter:"中心揃え",alignRight:"右揃え",alignJustify:"左右に並べ替え",increaseIndent:"インデントを増やす",decreaseIndent:"インデントを減らす",bold:`太字 (${f("mod+B")})`,italic:`斜体 (${f("mod+I")})`,underline:`下線 (${f("mod+U")})`,strikethrough:"取り消し線",superscript:"上付き文字",subscript:"下付き文字",code:"インラインコード",removeFormat:"形式を削除",formatPainter:"形式ペインタ",link:"リンク",hr:"区切り線",codeBlock:"コードブロック",heading:"タイトル",heading1:"タイトル 1",heading2:"タイトル 2",heading3:"タイトル 3",heading4:"タイトル 4",heading5:"タイトル 5",heading6:"タイトル 6",list:"リスト",align:"文字揃え",indent:"インデント",fontFamily:"フォント",fontSize:"文字サイズ",moreStyle:"その他のスタイル",fontColor:"文字色",highlight:"文字の背景",image:"画像",removeColor:"デフォルト"},link:{newLink:"新しいリンク",url:"リンク URL",title:"リンク文字",copy:"クリップボードにコピー",open:"リンクを開く",save:"確認",unlink:"リンクを削除"},image:{view:"大きな画像を見る",remove:"削除",previous:"前の画像",next:"次の画像",close:"閉じる (Esc)",loadingError:"画像を読み込めません",zoomOut:"縮小",zoomIn:"拡大"},codeBlock:{langType:"コード言語を選択"}},ko:{toolbar:{undo:`작업취소 (${f("mod+Z")})`,redo:`작업재개 (${f("mod+Y")})`,selectAll:`전체 선택 (${f("mod+A")})`,paragraph:"텍스트",blockQuote:"인용문",numberedList:"순서 목록",bulletedList:"비순서 목록",checklist:"체크리스트",alignLeft:"왼쪽 정렬",alignCenter:"가운데 정렬",alignRight:"오른쪽 정렬",alignJustify:"좌우로 정렬",increaseIndent:"들여쓰기 증가",decreaseIndent:"들여쓰기 줄이기",bold:`굵게 (${f("mod+B")})`,italic:`기울임꼴 (${f("mod+I")})`,underline:`밑줄 (${f("mod+U")})`,strikethrough:"취소선",superscript:"위첨자",subscript:"아래 첨자",code:"인라인 코드",removeFormat:"형식 지우기",formatPainter:"형식 페인터",link:"링크",hr:"구분선",codeBlock:"코드 블록",heading:"제목",heading1:"제목 1",heading2:"제목 2",heading3:"제목 3",heading4:"제목 4",heading5:"제목 5",heading6:"제목 6",list:"목록",align:"정렬",indent:"들여쓰기",fontFamily:"글꼴",fontSize:"글자 크기",moreStyle:"더 많은 스타일",fontColor:"글자 색상",highlight:"글자 배경",image:"이미지",removeColor:"기본색"},link:{newLink:"새 링크",url:"링크 URL",title:"링크 텍스트",copy:"클립보드에 복사",open:"링크 열기",save:"확인",unlink:"링크 제거"},image:{view:"큰 이미지 보기",remove:"삭제",previous:"이전 이미지",next:"다음 이미지",close:"닫기 (Esc)",loadingError:"이미지를 로드할 수 없습니다",zoomOut:"축소",zoomIn:"확대"},codeBlock:{langType:"코드언어 선택"}}},Zr=Object.keys(zr),Nr={},Hr={},Dr=t=>{Nr[t]||(Nr[t]=zr[t],(t=>{Hr[t]={}})(t))};Zr.forEach(Dr);const $r=(t=>function(t,e,i={}){return Or(e,Mr(t,i))}(t,Nr[t],Hr[t]))(Zr.indexOf(window.LAKE_LANGUAGE)>=0?window.LAKE_LANGUAGE:"en-US"),Vr=[{value:"h1",text:`<span style="font-weight: bold; font-size: 26px;">${$r.toolbar.heading1()}</span>`},{value:"h2",text:`<span style="font-weight: bold; font-size: 24px;">${$r.toolbar.heading2()}</span>`},{value:"h3",text:`<span style="font-weight: bold; font-size: 22px;">${$r.toolbar.heading3()}</span>`},{value:"h4",text:`<span style="font-weight: bold; font-size: 20px;">${$r.toolbar.heading4()}</span>`},{value:"h5",text:`<span style="font-weight: bold; font-size: 18px;">${$r.toolbar.heading5()}</span>`},{value:"h6",text:`<span style="font-weight: bold; font-size: 16px;">${$r.toolbar.heading6()}</span>`},{value:"p",text:$r.toolbar.paragraph()}],Fr=[{icon:n.get("numberedList"),value:"numbered",text:$r.toolbar.numberedList()},{icon:n.get("bulletedList"),value:"bulleted",text:$r.toolbar.bulletedList()},{icon:n.get("checklist"),value:"checklist",text:$r.toolbar.checklist()}],jr=[{icon:n.get("alignLeft"),value:"left",text:$r.toolbar.alignLeft()},{icon:n.get("alignCenter"),value:"center",text:$r.toolbar.alignCenter()},{icon:n.get("alignRight"),value:"right",text:$r.toolbar.alignRight()},{icon:n.get("alignJustify"),value:"justify",text:$r.toolbar.alignJustify()}],Rr=[{icon:n.get("increaseIndent"),value:"increase",text:$r.toolbar.increaseIndent()},{icon:n.get("decreaseIndent"),value:"decrease",text:$r.toolbar.decreaseIndent()}],Wr=[{icon:n.get("italic"),value:"italic",text:$r.toolbar.italic()},{icon:n.get("underline"),value:"underline",text:$r.toolbar.underline()},{icon:n.get("strikethrough"),value:"strikethrough",text:$r.toolbar.strikethrough()},{icon:n.get("superscript"),value:"superscript",text:$r.toolbar.superscript()},{icon:n.get("subscript"),value:"subscript",text:$r.toolbar.subscript()},{icon:n.get("code"),value:"code",text:$r.toolbar.code()}],Ur=["#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"],qr=[{icon:n.get("removeFormat"),value:"",text:$r.toolbar.removeColor()}];for(const t of Ur)qr.push({value:t.toLowerCase(),text:t.toUpperCase()});const Kr=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Gr=[{name:"undo",type:"button",icon:n.get("undo"),tooltip:$r.toolbar.undo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"redo",type:"button",icon:n.get("redo"),tooltip:$r.toolbar.redo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"selectAll",type:"button",icon:n.get("selectAll"),tooltip:$r.toolbar.selectAll(),onClick:(t,e)=>{t.command.execute(e)}},{name:"paragraph",type:"button",icon:n.get("paragraph"),tooltip:$r.toolbar.paragraph(),isSelected:t=>!!t.find((t=>"p"===t.name)),onClick:t=>{t.command.execute("heading","p")}},{name:"blockQuote",type:"button",icon:n.get("blockQuote"),tooltip:$r.toolbar.blockQuote(),onClick:(t,e)=>{t.command.execute(e)}},{name:"numberedList",type:"button",icon:n.get("numberedList"),tooltip:$r.toolbar.numberedList(),isSelected:t=>!!t.find((t=>"ol"===t.name)),onClick:t=>{t.command.execute("list","numbered")}},{name:"bulletedList",type:"button",icon:n.get("bulletedList"),tooltip:$r.toolbar.bulletedList(),isSelected:t=>!!t.find((t=>"ul"===t.name&&!t.node.hasAttr("type"))),onClick:t=>{t.command.execute("list","bulleted")}},{name:"checklist",type:"button",icon:n.get("checklist"),tooltip:$r.toolbar.checklist(),isSelected:t=>!!t.find((t=>"ul"===t.name&&"checklist"===t.node.attr("type"))),onClick:t=>{t.command.execute("list","checklist")}},{name:"alignLeft",type:"button",icon:n.get("alignLeft"),tooltip:$r.toolbar.alignLeft(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"left"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","left")}},{name:"alignCenter",type:"button",icon:n.get("alignCenter"),tooltip:$r.toolbar.alignCenter(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"center"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","center")}},{name:"alignRight",type:"button",icon:n.get("alignRight"),tooltip:$r.toolbar.alignRight(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"right"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","right")}},{name:"alignJustify",type:"button",icon:n.get("alignJustify"),tooltip:$r.toolbar.alignJustify(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"justify"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","justify")}},{name:"increaseIndent",type:"button",icon:n.get("increaseIndent"),tooltip:$r.toolbar.increaseIndent(),onClick:t=>{t.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:n.get("decreaseIndent"),tooltip:$r.toolbar.decreaseIndent(),onClick:t=>{t.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:n.get("bold"),tooltip:$r.toolbar.bold(),onClick:(t,e)=>{t.command.execute(e)}},{name:"italic",type:"button",icon:n.get("italic"),tooltip:$r.toolbar.italic(),onClick:(t,e)=>{t.command.execute(e)}},{name:"underline",type:"button",icon:n.get("underline"),tooltip:$r.toolbar.underline(),onClick:(t,e)=>{t.command.execute(e)}},{name:"strikethrough",type:"button",icon:n.get("strikethrough"),tooltip:$r.toolbar.strikethrough(),onClick:(t,e)=>{t.command.execute(e)}},{name:"superscript",type:"button",icon:n.get("superscript"),tooltip:$r.toolbar.superscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"subscript",type:"button",icon:n.get("subscript"),tooltip:$r.toolbar.subscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"code",type:"button",icon:n.get("code"),tooltip:$r.toolbar.code(),onClick:(t,e)=>{t.command.execute(e)}},{name:"removeFormat",type:"button",icon:n.get("removeFormat"),tooltip:$r.toolbar.removeFormat(),onClick:(t,e)=>{t.command.execute(e)}},{name:"formatPainter",type:"button",icon:n.get("formatPainter"),tooltip:$r.toolbar.formatPainter(),onClick:(t,e)=>{t.command.execute(e)}},{name:"link",type:"button",icon:n.get("link"),tooltip:$r.toolbar.link(),onClick:(t,e)=>{t.command.execute(e)}},{name:"hr",type:"button",icon:n.get("hr"),tooltip:$r.toolbar.hr(),onClick:(t,e)=>{t.command.execute(e)}},{name:"codeBlock",type:"button",icon:n.get("codeBlock"),tooltip:$r.toolbar.codeBlock(),onClick:(t,e)=>{t.command.execute(e)}},{name:"heading",type:"dropdown",downIcon:n.get("down"),defaultValue:"p",tooltip:$r.toolbar.heading(),width:"100px",menuType:"list",menuItems:Vr,onSelect:(t,e)=>{t.command.execute("heading",e)}},{name:"list",type:"dropdown",downIcon:n.get("down"),icon:n.get("list"),defaultValue:"",tooltip:$r.toolbar.list(),width:"auto",menuType:"list",menuItems:Fr,onSelect:(t,e)=>{t.command.execute("list",e)}},{name:"align",type:"dropdown",downIcon:n.get("down"),icon:n.get("alignLeft"),defaultValue:"",tooltip:$r.toolbar.align(),width:"auto",menuType:"list",menuItems:jr,onSelect:(t,e)=>{t.command.execute("align",e)}},{name:"indent",type:"dropdown",downIcon:n.get("down"),icon:n.get("increaseIndent"),defaultValue:"",tooltip:$r.toolbar.indent(),width:"auto",menuType:"list",menuItems:Rr,onSelect:(t,e)=>{t.command.execute("indent",e)}},{name:"fontFamily",type:"dropdown",downIcon:n.get("down"),defaultValue:"Segoe UI",tooltip:$r.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:(t,e)=>{t.command.execute("fontFamily",e)}},{name:"fontSize",type:"dropdown",downIcon:n.get("down"),defaultValue:"16px",tooltip:$r.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:(t,e)=>{t.command.execute("fontSize",e)}},{name:"moreStyle",type:"dropdown",icon:n.get("more"),defaultValue:"",tooltip:$r.toolbar.moreStyle(),width:"auto",menuType:"list",menuItems:Wr,selectedValues:t=>{var e;const i=[];for(const n of t)if(n.node.isMark){const t=null!==(e=Kr.get(n.name))&&void 0!==e?e:n.name;i.push(t)}return i},onSelect:(t,e)=>{t.command.execute(e)}},{name:"fontColor",type:"dropdown",downIcon:n.get("down"),icon:n.get("fontColor"),accentIcon:n.get("fontColorAccent"),defaultValue:"#f5222d",tooltip:$r.toolbar.fontColor(),width:"auto",menuType:"color",menuItems:qr,onSelect:(t,e)=>{t.command.execute("fontColor",e)}},{name:"highlight",type:"dropdown",downIcon:n.get("down"),icon:n.get("highlight"),accentIcon:n.get("highlightAccent"),defaultValue:"#fadb14",tooltip:$r.toolbar.highlight(),width:"auto",menuType:"color",menuItems:qr,onSelect:(t,e)=>{t.command.execute("highlight",e)}},{name:"image",type:"upload",icon:n.get("image"),tooltip:$r.toolbar.image(),accept:"image/*",multiple:!0}];function Xr(t){const{editor:e,file:i,onError:n,onSuccess:s}=t,{imageRequestMethod:o,imageRequestAction:r,imageRequestTypes:a}=e.config;if(a.indexOf(i.type)<0)throw new Error(`Cannot upload file because its type '${i.type}' is not found in ['${a.join("', '")}'].`);const l=e.insertBox("image",{url:URL.createObjectURL(i),status:"uploading",name:i.name,size:i.size,type:i.type,lastModified:i.lastModified}),c=pt({onProgress:t=>{const e=l.node.find(".lake-percent"),i=Math.round(t.percent);e.text(`${i<100?i:99} %`)},onError:(t,e)=>{C(t.toString(),e),l.updateValue("status","error"),l.render(),n&&n()},onSuccess:t=>{if(!t.url)return l.updateValue("status","error"),l.render(),void(n&&n());l.updateValue({status:"done",url:t.url}),l.render(),e.history.save(),s&&s()},file:i,action:r,method:o});return l.setData("xhr",c),l}const Jr=["undo","redo","|","heading","fontSize","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],Yr=new Map;Gr.forEach((t=>{Yr.set(t.name,t)}));function Qr(t,e,i,n){return new(i||(i=Promise))((function(s,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))}
19
19
  /*!
20
20
  * PhotoSwipe Lightbox 5.4.3 - https://photoswipe.com
21
21
  * (c) 2023 Dmytro Semenov
22
22
  */
23
- function sn(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i&&i.appendChild(n),n}function on(t,e,i){t.style.width="number"==typeof e?`${e}px`:e,t.style.height="number"==typeof i?`${i}px`:i}"function"==typeof SuppressedError&&SuppressedError;const rn="idle",an="loading",ln="loaded",hn="error";function cn(t,e,i=document){let n=[];if(t instanceof Element)n=[t];else if(t instanceof NodeList||Array.isArray(t))n=Array.from(t);else{const s="string"==typeof t?t:e;s&&(n=Array.from(i.querySelectorAll(s)))}return n}function dn(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let pn=class{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}},un=class{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,e,i=100){var n,s,o;this._filters[t]||(this._filters[t]=[]),null===(n=this._filters[t])||void 0===n||n.push({fn:e,priority:i}),null===(s=this._filters[t])||void 0===s||s.sort(((t,e)=>t.priority-e.priority)),null===(o=this.pswp)||void 0===o||o.addFilter(t,e,i)}removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter((t=>t.fn!==e))),this.pswp&&this.pswp.removeFilter(t,e)}applyFilters(t,...e){var i;return null===(i=this._filters[t])||void 0===i||i.forEach((t=>{e[0]=t.fn.apply(this,e)})),e[0]}on(t,e){var i,n;this._listeners[t]||(this._listeners[t]=[]),null===(i=this._listeners[t])||void 0===i||i.push(e),null===(n=this.pswp)||void 0===n||n.on(t,e)}off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter((t=>e!==t))),null===(i=this.pswp)||void 0===i||i.off(t,e)}dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);const n=new pn(t,e);return null===(i=this._listeners[t])||void 0===i||i.forEach((t=>{t.call(this,n)})),n}},mn=class{constructor(t,e){if(this.element=sn("pswp__img pswp__img--placeholder",t?"img":"div",e),t){const e=this.element;e.decoding="async",e.alt="",e.src=t,e.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,e){this.element&&("IMG"===this.element.tagName?(on(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=function(t,e,i){let n=`translate3d(${t}px,${e||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}(0,0,t/250)):on(this.element,t,e))}destroy(){var t;null!==(t=this.element)&&void 0!==t&&t.parentNode&&this.element.remove(),this.element=null}},fn=class{constructor(t,e,i){this.instance=e,this.data=t,this.index=i,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=rn,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout((()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)}),1e3)}load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){const t=this.placeholder.element;t&&!t.parentElement&&this.slide.container.prepend(t)}else{const t=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new mn(t,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=sn("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=sn("pswp__content","div"),this.element.innerHTML=this.data.html||""),e&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var e,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const n=this.element;this.updateSrcsetSizes(),this.data.srcset&&(n.srcset=this.data.srcset),n.src=null!==(e=this.data.src)&&void 0!==e?e:"",n.alt=null!==(i=this.data.alt)&&void 0!==i?i:"",this.state=an,n.complete?this.onLoaded():(n.onload=()=>{this.onLoaded()},n.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=ln,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),this.state!==ln&&this.state!==hn||this.removePlaceholder())}onError(){this.state=hn,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===an,this)}isError(){return this.state===hn}isImageContent(){return"image"===this.type}setDisplayedSize(t,e){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,e),!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented&&(on(this.element,t,e),this.isImageContent()&&!this.isError()))){const i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=e,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==hn,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=this.element,e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=e+"px",t.dataset.largestUsedSize=String(e))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented||(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,e;let i=sn("pswp__error-msg","div");i.innerText=null!==(t=null===(e=this.instance.options)||void 0===e?void 0:e.errorMsg)&&void 0!==t?t:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=sn("pswp__content pswp__error-msg-container","div"),this.element.appendChild(i),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===hn)return void this.displayError();if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||dn())?(this.isDecoding=!0,this.element.decode().catch((()=>{})).finally((()=>{this.isDecoding=!1,this.appendImage()}))):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){!this.instance.dispatch("contentActivate",{content:this}).defaultPrevented&&this.slide&&(this.isImageContent()&&this.isDecoding&&!dn()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,this.instance.dispatch("contentRemove",{content:this}).defaultPrevented||(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),this.state!==ln&&this.state!==hn||this.removePlaceholder()))}};function gn(t,e,i,n,s){let o=0;if(e.paddingFn)o=e.paddingFn(i,n,s)[t];else if(e.padding)o=e.padding[t];else{const i="padding"+t[0].toUpperCase()+t.slice(1);e[i]&&(o=e[i])}return Number(o)||0}let vn=class{constructor(t,e,i,n){this.pswp=n,this.options=t,this.itemData=e,this.index=i,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,e,i){const n={x:t,y:e};this.elementSize=n,this.panAreaSize=i;const s=i.x/n.x,o=i.y/n.y;this.fit=Math.min(1,s<o?s:o),this.fill=Math.min(1,s>o?s:o),this.vFill=Math.min(1,o),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){const e=t+"ZoomLevel",i=this.options[e];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,3*this.fit),this.elementSize&&t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,4*this.fit)}};function wn(t,e,i){const n=e.createContentFromData(t,i);let s;const{options:o}=e;if(o){let r;s=new vn(o,t,-1),r=e.pswp?e.pswp.viewportSize:function(t,e){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}(o,e);const a=function(t,e,i,n){return{x:e.x-gn("left",t,e,i,n)-gn("right",t,e,i,n),y:e.y-gn("top",t,e,i,n)-gn("bottom",t,e,i,n)}}(o,r,t,i);s.update(n.width,n.height,a)}return n.lazyLoad(),s&&n.setDisplayedSize(Math.ceil(n.width*s.initial),Math.ceil(n.height*s.initial)),n}let yn=class extends un{getNumItems(){var t;let e=0;const i=null===(t=this.options)||void 0===t?void 0:t.dataSource;i&&"length"in i?e=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(e=i.items.length));const n=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",n.numItems,i)}createContentFromData(t,e){return new fn(t,this,e)}getItemData(t){var e;const i=null===(e=this.options)||void 0===e?void 0:e.dataSource;let n={};Array.isArray(i)?n=i[t]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),n=i.items[t]);let s=n;s instanceof Element&&(s=this._domElementToItemData(s));const o=this.dispatch("itemData",{itemData:s||{},index:t});return this.applyFilters("itemData",o.itemData,t)}_getGalleryDOMElements(t){var e,i;return null!==(e=this.options)&&void 0!==e&&e.children||null!==(i=this.options)&&void 0!==i&&i.childSelector?cn(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){const e={element:t},i="A"===t.tagName?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset),e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,e.w=e.width,e.h=e.height,i.dataset.pswpType&&(e.type=i.dataset.pswpType);const s=t.querySelector("img");var n;if(s)e.msrc=s.currentSrc||s.src,e.alt=null!==(n=s.getAttribute("alt"))&&void 0!==n?n:"";(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=!0)}return this.applyFilters("domItemData",e,t,i)}lazyLoadData(t,e){return wn(t,this,e)}};class xn extends yn{constructor(t){super(),this.options=t||{},this._uid=0,this.shouldOpen=!1,this._preloadedContent=void 0,this.onThumbnailsClick=this.onThumbnailsClick.bind(this)}init(){cn(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.addEventListener("click",this.onThumbnailsClick,!1)}))}onThumbnailsClick(t){if(function(t){return"button"in t&&1===t.button||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}(t)||window.pswp)return;let e={x:t.clientX,y:t.clientY};e.x||e.y||(e=null);let i=this.getClickedIndex(t);i=this.applyFilters("clickedIndex",i,t,this);const n={gallery:t.currentTarget};i>=0&&(t.preventDefault(),this.loadAndOpen(i,n,e))}getClickedIndex(t){if(this.options.getClickedIndexFn)return this.options.getClickedIndexFn.call(this,t);const e=t.target,i=cn(this.options.children,this.options.childSelector,t.currentTarget).findIndex((t=>t===e||t.contains(e)));return-1!==i?i:this.options.children||this.options.childSelector?-1:0}loadAndOpen(t,e,i){if(window.pswp||!this.options)return!1;if(!e&&this.options.gallery&&this.options.children){const t=cn(this.options.gallery);t[0]&&(e={gallery:t[0]})}return this.options.index=t,this.options.initialPointerPos=i,this.shouldOpen=!0,this.preload(t,e),!0}preload(t,e){const{options:i}=this;e&&(i.dataSource=e);const n=[],s=typeof i.pswpModule;if("function"==typeof(o=i.pswpModule)&&o.prototype&&o.prototype.goTo)n.push(Promise.resolve(i.pswpModule));else{if("string"===s)throw new Error("pswpModule as string is no longer supported");if("function"!==s)throw new Error("pswpModule is not valid");n.push(i.pswpModule())}var o;"function"==typeof i.openPromise&&n.push(i.openPromise()),!1!==i.preloadFirstSlide&&t>=0&&(this._preloadedContent=function(t,e){const i=e.getItemData(t);if(!e.dispatch("lazyLoadSlide",{index:t,itemData:i}).defaultPrevented)return wn(i,e,t)}(t,this));const r=++this._uid;Promise.all(n).then((t=>{if(this.shouldOpen){const e=t[0];this._openPhotoswipe(e,r)}}))}_openPhotoswipe(t,e){if(e!==this._uid&&this.shouldOpen)return;if(this.shouldOpen=!1,window.pswp)return;const i="object"==typeof t?new t.default(this.options):new t(this.options);this.pswp=i,window.pswp=i,Object.keys(this._listeners).forEach((t=>{var e;null===(e=this._listeners[t])||void 0===e||e.forEach((e=>{i.on(t,e)}))})),Object.keys(this._filters).forEach((t=>{var e;null===(e=this._filters[t])||void 0===e||e.forEach((e=>{i.addFilter(t,e.fn,e.priority)}))})),this._preloadedContent&&(i.contentLoader.addToCache(this._preloadedContent),this._preloadedContent=void 0),i.on("destroy",(()=>{this.pswp=void 0,delete window.pswp})),i.init()}destroy(){var t;null===(t=this.pswp)||void 0===t||t.destroy(),this.shouldOpen=!1,this._listeners={},cn(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.removeEventListener("click",this.onThumbnailsClick,!1)}))}}
23
+ function ta(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i&&i.appendChild(n),n}function ea(t,e,i){t.style.width="number"==typeof e?`${e}px`:e,t.style.height="number"==typeof i?`${i}px`:i}"function"==typeof SuppressedError&&SuppressedError;const ia="idle",na="loading",sa="loaded",oa="error";function ra(t,e,i=document){let n=[];if(t instanceof Element)n=[t];else if(t instanceof NodeList||Array.isArray(t))n=Array.from(t);else{const s="string"==typeof t?t:e;s&&(n=Array.from(i.querySelectorAll(s)))}return n}function aa(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let la=class{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}},ca=class{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,e,i=100){var n,s,o;this._filters[t]||(this._filters[t]=[]),null===(n=this._filters[t])||void 0===n||n.push({fn:e,priority:i}),null===(s=this._filters[t])||void 0===s||s.sort(((t,e)=>t.priority-e.priority)),null===(o=this.pswp)||void 0===o||o.addFilter(t,e,i)}removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter((t=>t.fn!==e))),this.pswp&&this.pswp.removeFilter(t,e)}applyFilters(t,...e){var i;return null===(i=this._filters[t])||void 0===i||i.forEach((t=>{e[0]=t.fn.apply(this,e)})),e[0]}on(t,e){var i,n;this._listeners[t]||(this._listeners[t]=[]),null===(i=this._listeners[t])||void 0===i||i.push(e),null===(n=this.pswp)||void 0===n||n.on(t,e)}off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter((t=>e!==t))),null===(i=this.pswp)||void 0===i||i.off(t,e)}dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);const n=new la(t,e);return null===(i=this._listeners[t])||void 0===i||i.forEach((t=>{t.call(this,n)})),n}},ha=class{constructor(t,e){if(this.element=ta("pswp__img pswp__img--placeholder",t?"img":"div",e),t){const e=this.element;e.decoding="async",e.alt="",e.src=t,e.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,e){this.element&&("IMG"===this.element.tagName?(ea(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=function(t,e,i){let n=`translate3d(${t}px,${e||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}(0,0,t/250)):ea(this.element,t,e))}destroy(){var t;null!==(t=this.element)&&void 0!==t&&t.parentNode&&this.element.remove(),this.element=null}},da=class{constructor(t,e,i){this.instance=e,this.data=t,this.index=i,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=ia,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout((()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)}),1e3)}load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){const t=this.placeholder.element;t&&!t.parentElement&&this.slide.container.prepend(t)}else{const t=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new ha(t,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=ta("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=ta("pswp__content","div"),this.element.innerHTML=this.data.html||""),e&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var e,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const n=this.element;this.updateSrcsetSizes(),this.data.srcset&&(n.srcset=this.data.srcset),n.src=null!==(e=this.data.src)&&void 0!==e?e:"",n.alt=null!==(i=this.data.alt)&&void 0!==i?i:"",this.state=na,n.complete?this.onLoaded():(n.onload=()=>{this.onLoaded()},n.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=sa,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),this.state!==sa&&this.state!==oa||this.removePlaceholder())}onError(){this.state=oa,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===na,this)}isError(){return this.state===oa}isImageContent(){return"image"===this.type}setDisplayedSize(t,e){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,e),!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented&&(ea(this.element,t,e),this.isImageContent()&&!this.isError()))){const i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=e,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==oa,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=this.element,e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=e+"px",t.dataset.largestUsedSize=String(e))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented||(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,e;let i=ta("pswp__error-msg","div");i.innerText=null!==(t=null===(e=this.instance.options)||void 0===e?void 0:e.errorMsg)&&void 0!==t?t:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=ta("pswp__content pswp__error-msg-container","div"),this.element.appendChild(i),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===oa)return void this.displayError();if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||aa())?(this.isDecoding=!0,this.element.decode().catch((()=>{})).finally((()=>{this.isDecoding=!1,this.appendImage()}))):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){!this.instance.dispatch("contentActivate",{content:this}).defaultPrevented&&this.slide&&(this.isImageContent()&&this.isDecoding&&!aa()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,this.instance.dispatch("contentRemove",{content:this}).defaultPrevented||(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),this.state!==sa&&this.state!==oa||this.removePlaceholder()))}};function pa(t,e,i,n,s){let o=0;if(e.paddingFn)o=e.paddingFn(i,n,s)[t];else if(e.padding)o=e.padding[t];else{const i="padding"+t[0].toUpperCase()+t.slice(1);e[i]&&(o=e[i])}return Number(o)||0}let ua=class{constructor(t,e,i,n){this.pswp=n,this.options=t,this.itemData=e,this.index=i,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,e,i){const n={x:t,y:e};this.elementSize=n,this.panAreaSize=i;const s=i.x/n.x,o=i.y/n.y;this.fit=Math.min(1,s<o?s:o),this.fill=Math.min(1,s>o?s:o),this.vFill=Math.min(1,o),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){const e=t+"ZoomLevel",i=this.options[e];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,3*this.fit),this.elementSize&&t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,4*this.fit)}};function ma(t,e,i){const n=e.createContentFromData(t,i);let s;const{options:o}=e;if(o){let r;s=new ua(o,t,-1),r=e.pswp?e.pswp.viewportSize:function(t,e){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}(o,e);const a=function(t,e,i,n){return{x:e.x-pa("left",t,e,i,n)-pa("right",t,e,i,n),y:e.y-pa("top",t,e,i,n)-pa("bottom",t,e,i,n)}}(o,r,t,i);s.update(n.width,n.height,a)}return n.lazyLoad(),s&&n.setDisplayedSize(Math.ceil(n.width*s.initial),Math.ceil(n.height*s.initial)),n}let fa=class extends ca{getNumItems(){var t;let e=0;const i=null===(t=this.options)||void 0===t?void 0:t.dataSource;i&&"length"in i?e=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(e=i.items.length));const n=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",n.numItems,i)}createContentFromData(t,e){return new da(t,this,e)}getItemData(t){var e;const i=null===(e=this.options)||void 0===e?void 0:e.dataSource;let n={};Array.isArray(i)?n=i[t]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),n=i.items[t]);let s=n;s instanceof Element&&(s=this._domElementToItemData(s));const o=this.dispatch("itemData",{itemData:s||{},index:t});return this.applyFilters("itemData",o.itemData,t)}_getGalleryDOMElements(t){var e,i;return null!==(e=this.options)&&void 0!==e&&e.children||null!==(i=this.options)&&void 0!==i&&i.childSelector?ra(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){const e={element:t},i="A"===t.tagName?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset),e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,e.w=e.width,e.h=e.height,i.dataset.pswpType&&(e.type=i.dataset.pswpType);const s=t.querySelector("img");var n;if(s)e.msrc=s.currentSrc||s.src,e.alt=null!==(n=s.getAttribute("alt"))&&void 0!==n?n:"";(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=!0)}return this.applyFilters("domItemData",e,t,i)}lazyLoadData(t,e){return ma(t,this,e)}};class ga extends fa{constructor(t){super(),this.options=t||{},this._uid=0,this.shouldOpen=!1,this._preloadedContent=void 0,this.onThumbnailsClick=this.onThumbnailsClick.bind(this)}init(){ra(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.addEventListener("click",this.onThumbnailsClick,!1)}))}onThumbnailsClick(t){if(function(t){return"button"in t&&1===t.button||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}(t)||window.pswp)return;let e={x:t.clientX,y:t.clientY};e.x||e.y||(e=null);let i=this.getClickedIndex(t);i=this.applyFilters("clickedIndex",i,t,this);const n={gallery:t.currentTarget};i>=0&&(t.preventDefault(),this.loadAndOpen(i,n,e))}getClickedIndex(t){if(this.options.getClickedIndexFn)return this.options.getClickedIndexFn.call(this,t);const e=t.target,i=ra(this.options.children,this.options.childSelector,t.currentTarget).findIndex((t=>t===e||t.contains(e)));return-1!==i?i:this.options.children||this.options.childSelector?-1:0}loadAndOpen(t,e,i){if(window.pswp||!this.options)return!1;if(!e&&this.options.gallery&&this.options.children){const t=ra(this.options.gallery);t[0]&&(e={gallery:t[0]})}return this.options.index=t,this.options.initialPointerPos=i,this.shouldOpen=!0,this.preload(t,e),!0}preload(t,e){const{options:i}=this;e&&(i.dataSource=e);const n=[],s=typeof i.pswpModule;if("function"==typeof(o=i.pswpModule)&&o.prototype&&o.prototype.goTo)n.push(Promise.resolve(i.pswpModule));else{if("string"===s)throw new Error("pswpModule as string is no longer supported");if("function"!==s)throw new Error("pswpModule is not valid");n.push(i.pswpModule())}var o;"function"==typeof i.openPromise&&n.push(i.openPromise()),!1!==i.preloadFirstSlide&&t>=0&&(this._preloadedContent=function(t,e){const i=e.getItemData(t);if(!e.dispatch("lazyLoadSlide",{index:t,itemData:i}).defaultPrevented)return ma(i,e,t)}(t,this));const r=++this._uid;Promise.all(n).then((t=>{if(this.shouldOpen){const e=t[0];this._openPhotoswipe(e,r)}}))}_openPhotoswipe(t,e){if(e!==this._uid&&this.shouldOpen)return;if(this.shouldOpen=!1,window.pswp)return;const i="object"==typeof t?new t.default(this.options):new t(this.options);this.pswp=i,window.pswp=i,Object.keys(this._listeners).forEach((t=>{var e;null===(e=this._listeners[t])||void 0===e||e.forEach((e=>{i.on(t,e)}))})),Object.keys(this._filters).forEach((t=>{var e;null===(e=this._filters[t])||void 0===e||e.forEach((e=>{i.addFilter(t,e.fn,e.priority)}))})),this._preloadedContent&&(i.contentLoader.addToCache(this._preloadedContent),this._preloadedContent=void 0),i.on("destroy",(()=>{this.pswp=void 0,delete window.pswp})),i.init()}destroy(){var t;null===(t=this.pswp)||void 0===t||t.destroy(),this.shouldOpen=!1,this._listeners={},ra(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.removeEventListener("click",this.onThumbnailsClick,!1)}))}}
24
24
  /*!
25
25
  * PhotoSwipe 5.4.3 - https://photoswipe.com
26
26
  * (c) 2023 Dmytro Semenov
27
- */function bn(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i&&i.appendChild(n),n}function kn(t,e){return t.x=e.x,t.y=e.y,void 0!==e.id&&(t.id=e.id),t}function _n(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function Sn(t,e){const i=Math.abs(t.x-e.x),n=Math.abs(t.y-e.y);return Math.sqrt(i*i+n*n)}function Cn(t,e){return t.x===e.x&&t.y===e.y}function An(t,e,i){return Math.min(Math.max(t,e),i)}function Bn(t,e,i){let n=`translate3d(${t}px,${e||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}function Ln(t,e,i,n){t.style.transform=Bn(e,i,n)}const Tn="cubic-bezier(.4,0,.22,1)";function In(t,e,i,n){t.style.transition=e?`${e} ${i}ms ${n||Tn}`:"none"}function En(t,e,i){t.style.width="number"==typeof e?`${e}px`:e,t.style.height="number"==typeof i?`${i}px`:i}const Mn="idle",Pn="loading",Zn="loaded",zn="error";function Nn(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let On=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{On=!0}}))}catch(vi){}class Hn{constructor(){this._pool=[]}add(t,e,i,n){this._toggleListener(t,e,i,n)}remove(t,e,i,n){this._toggleListener(t,e,i,n,!0)}removeAll(){this._pool.forEach((t=>{this._toggleListener(t.target,t.type,t.listener,t.passive,!0,!0)})),this._pool=[]}_toggleListener(t,e,i,n,s,o){if(!t)return;const r=s?"removeEventListener":"addEventListener";e.split(" ").forEach((e=>{if(e){o||(s?this._pool=this._pool.filter((n=>n.type!==e||n.listener!==i||n.target!==t)):this._pool.push({target:t,type:e,listener:i,passive:n}));const a=!!On&&{passive:n||!1};t[r](e,i,a)}}))}}function Dn(t,e){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function $n(t,e,i,n,s){let o=0;if(e.paddingFn)o=e.paddingFn(i,n,s)[t];else if(e.padding)o=e.padding[t];else{const i="padding"+t[0].toUpperCase()+t.slice(1);e[i]&&(o=e[i])}return Number(o)||0}function Vn(t,e,i,n){return{x:e.x-$n("left",t,e,i,n)-$n("right",t,e,i,n),y:e.y-$n("top",t,e,i,n)-$n("bottom",t,e,i,n)}}class Fn{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(t){this.currZoomLevel=t,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(t){const{pswp:e}=this.slide,i=this.slide["x"===t?"width":"height"]*this.currZoomLevel,n=$n("x"===t?"left":"top",e.options,e.viewportSize,this.slide.data,this.slide.index),s=this.slide.panAreaSize[t];this.center[t]=Math.round((s-i)/2)+n,this.max[t]=i>s?Math.round(s-i)+n:this.center[t],this.min[t]=i>s?n:this.center[t]}reset(){this.center.x=0,this.center.y=0,this.max.x=0,this.max.y=0,this.min.x=0,this.min.y=0}correctPan(t,e){return An(e,this.max[t],this.min[t])}}class Rn{constructor(t,e,i,n){this.pswp=n,this.options=t,this.itemData=e,this.index=i,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,e,i){const n={x:t,y:e};this.elementSize=n,this.panAreaSize=i;const s=i.x/n.x,o=i.y/n.y;this.fit=Math.min(1,s<o?s:o),this.fill=Math.min(1,s>o?s:o),this.vFill=Math.min(1,o),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){const e=t+"ZoomLevel",i=this.options[e];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,3*this.fit),this.elementSize&&t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,4*this.fit)}}class Wn{constructor(t,e,i){this.data=t,this.index=e,this.pswp=i,this.isActive=e===i.currIndex,this.currentResolution=0,this.panAreaSize={x:0,y:0},this.pan={x:0,y:0},this.isFirstSlide=this.isActive&&!i.opener.isOpen,this.zoomLevels=new Rn(i.options,t,e,i),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:e}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=bn("pswp__zoom-wrap","div"),this.holderElement=null,this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.heavyAppended=!1,this.bounds=new Fn(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(t){t&&!this.isActive?this.activate():!t&&this.isActive&&this.deactivate()}append(t){this.holderElement=t,this.container.style.transformOrigin="0 0",this.data&&(this.calculateSize(),this.load(),this.updateContentSize(),this.appendHeavy(),this.holderElement.appendChild(this.container),this.zoomAndPanToInitial(),this.pswp.dispatch("firstZoomPan",{slide:this}),this.applyCurrentZoomPan(),this.pswp.dispatch("afterSetContent",{slide:this}),this.isActive&&this.activate())}load(){this.content.load(!1),this.pswp.dispatch("slideLoad",{slide:this})}appendHeavy(){const{pswp:t}=this;!this.heavyAppended&&t.opener.isOpen&&!t.mainScroll.isShifted()&&(this.isActive,1)&&(this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.append(),this.pswp.dispatch("appendHeavyContent",{slide:this})))}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.hasSlide=!1,this.content.remove(),this.container.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel!==this.zoomLevels.initial&&this.isActive?(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y)):(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize())}updateContentSize(t){const e=this.currentResolution||this.zoomLevels.initial;if(!e)return;const i=Math.round(this.width*e)||this.pswp.viewportSize.x,n=Math.round(this.height*e)||this.pswp.viewportSize.y;(this.sizeChanged(i,n)||t)&&this.content.setDisplayedSize(i,n)}sizeChanged(t,e){return(t!==this.prevDisplayedWidth||e!==this.prevDisplayedHeight)&&(this.prevDisplayedWidth=t,this.prevDisplayedHeight=e,!0)}getPlaceholderElement(){var t;return null===(t=this.content.placeholder)||void 0===t?void 0:t.element}zoomTo(t,e,i,n){const{pswp:s}=this;if(!this.isZoomable()||s.mainScroll.isShifted())return;s.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:e,transitionDuration:i}),s.animations.stopAllPan();const o=this.currZoomLevel;n||(t=An(t,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(t),this.pan.x=this.calculateZoomToPanOffset("x",e,o),this.pan.y=this.calculateZoomToPanOffset("y",e,o),_n(this.pan);const r=()=>{this._setResolution(t),this.applyCurrentZoomPan()};i?s.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:r,duration:i,easing:s.options.easing}):r()}toggleZoom(t){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,t,this.pswp.options.zoomAnimationDuration)}setZoomLevel(t){this.currZoomLevel=t,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(t,e,i){if(0===this.bounds.max[t]-this.bounds.min[t])return this.bounds.center[t];e||(e=this.pswp.getViewportCenterPoint()),i||(i=this.zoomLevels.initial);const n=this.currZoomLevel/i;return this.bounds.correctPan(t,(this.pan[t]-e[t])*n+e[t])}panTo(t,e){this.pan.x=this.bounds.correctPan("x",t),this.pan.y=this.bounds.correctPan("y",e),this.applyCurrentZoomPan()}isPannable(){return Boolean(this.width)&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return Boolean(this.width)&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel),this===this.pswp.currSlide&&this.pswp.dispatch("zoomPanUpdate",{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial,this.bounds.update(this.currZoomLevel),kn(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(t,e,i){i/=this.currentResolution||this.zoomLevels.initial,Ln(this.container,t,e,i)}calculateSize(){const{pswp:t}=this;kn(this.panAreaSize,Vn(t.options,t.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),t.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return Bn(this.pan.x,this.pan.y,t)}_setResolution(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}class jn{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&kn(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:t,prevP1:e,dragAxis:i}=this.gestures,{currSlide:n}=this.pswp;if("y"===i&&this.pswp.options.closeOnVerticalDrag&&n&&n.currZoomLevel<=n.zoomLevels.fit&&!this.gestures.isMultitouch){const i=n.pan.y+(t.y-e.y);if(!this.pswp.dispatch("verticalDrag",{panY:i}).defaultPrevented){this._setPanWithFriction("y",i,.6);const t=1-Math.abs(this._getVerticalDragRatio(n.pan.y));this.pswp.applyBgOpacity(t),n.applyCurrentZoomPan()}}else{this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),n&&(_n(n.pan),n.applyCurrentZoomPan()))}}end(){const{velocity:t}=this.gestures,{mainScroll:e,currSlide:i}=this.pswp;let n=0;if(this.pswp.animations.stopAll(),e.isShifted()){const i=(e.x-e.getCurrSlideX())/this.pswp.viewportSize.x;t.x<-.5&&i<0||t.x<.1&&i<-.5?(n=1,t.x=Math.min(t.x,0)):(t.x>.5&&i>0||t.x>-.1&&i>.5)&&(n=-1,t.x=Math.max(t.x,0)),e.moveIndexBy(n,!0,t.x)}i&&i.currZoomLevel>i.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(t){const{velocity:e}=this.gestures,{currSlide:i}=this.pswp;if(!i)return;const{pan:n,bounds:s}=i,o=n[t],r=this.pswp.bgOpacity<1&&"y"===t,a=o+function(t,e){return t*e/(1-e)}(e[t],.995);if(r){const t=this._getVerticalDragRatio(o),e=this._getVerticalDragRatio(a);if(t<0&&e<-.4||t>0&&e>.4)return void this.pswp.close()}const l=s.correctPan(t,a);if(o===l)return;const h=l===a?1:.82,c=this.pswp.bgOpacity,d=l-o;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:!0,start:o,end:l,velocity:e[t],dampingRatio:h,onUpdate:e=>{if(r&&this.pswp.bgOpacity<1){const t=1-(l-e)/d;this.pswp.applyBgOpacity(An(c+(1-c)*t,0,1))}n[t]=Math.floor(e),i.applyCurrentZoomPan()}})}_panOrMoveMainScroll(t){const{p1:e,dragAxis:i,prevP1:n,isMultitouch:s}=this.gestures,{currSlide:o,mainScroll:r}=this.pswp,a=e[t]-n[t],l=r.x+a;if(!a||!o)return!1;if("x"===t&&!o.isPannable()&&!s)return r.moveTo(l,!0),!0;const{bounds:h}=o,c=o.pan[t]+a;if(this.pswp.options.allowPanToNext&&"x"===i&&"x"===t&&!s){const e=r.getCurrSlideX(),i=r.x-e,n=a>0,s=!n;if(c>h.min[t]&&n){if(h.min[t]<=this.startPan[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,c)}else if(c<h.max[t]&&s){if(this.startPan[t]<=h.max[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,c)}else if(0!==i){if(i>0)return r.moveTo(Math.max(l,e),!0),!0;if(i<0)return r.moveTo(Math.min(l,e),!0),!0}else this._setPanWithFriction(t,c)}else"y"===t&&(r.isShifted()||h.min.y===h.max.y)||this._setPanWithFriction(t,c);return!1}_getVerticalDragRatio(t){var e,i;return(t-(null!==(e=null===(i=this.pswp.currSlide)||void 0===i?void 0:i.bounds.center.y)&&void 0!==e?e:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(t,e,i){const{currSlide:n}=this.pswp;if(!n)return;const{pan:s,bounds:o}=n;if(o.correctPan(t,e)!==e||i){const n=Math.round(e-s[t]);s[t]+=n*(i||.35)}else s[t]=e}}function Un(t,e,i){return t.x=(e.x+i.x)/2,t.y=(e.y+i.y)/2,t}class qn{constructor(t){this.gestures=t,this._startPan={x:0,y:0},this._startZoomPoint={x:0,y:0},this._zoomPoint={x:0,y:0},this._wasOverFitZoomLevel=!1,this._startZoomLevel=1}start(){const{currSlide:t}=this.gestures.pswp;t&&(this._startZoomLevel=t.currZoomLevel,kn(this._startPan,t.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){const{p1:t,startP1:e,p2:i,startP2:n,pswp:s}=this.gestures,{currSlide:o}=s;if(!o)return;const r=o.zoomLevels.min,a=o.zoomLevels.max;if(!o.isZoomable()||s.mainScroll.isShifted())return;Un(this._startZoomPoint,e,n),Un(this._zoomPoint,t,i);let l=1/Sn(e,n)*Sn(t,i)*this._startZoomLevel;if(l>o.zoomLevels.initial+o.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=!0),l<r)if(s.options.pinchToClose&&!this._wasOverFitZoomLevel&&this._startZoomLevel<=o.zoomLevels.initial){const t=1-(r-l)/(r/1.2);s.dispatch("pinchClose",{bgOpacity:t}).defaultPrevented||s.applyBgOpacity(t)}else l=r-.15*(r-l);else l>a&&(l=a+.05*(l-a));o.pan.x=this._calculatePanForZoomLevel("x",l),o.pan.y=this._calculatePanForZoomLevel("y",l),o.setZoomLevel(l),o.applyCurrentZoomPan()}end(){const{pswp:t}=this.gestures,{currSlide:e}=t;(!e||e.currZoomLevel<e.zoomLevels.initial)&&!this._wasOverFitZoomLevel&&t.options.pinchToClose?t.close():this.correctZoomPan()}_calculatePanForZoomLevel(t,e){const i=e/this._startZoomLevel;return this._zoomPoint[t]-(this._startZoomPoint[t]-this._startPan[t])*i}correctZoomPan(t){const{pswp:e}=this.gestures,{currSlide:i}=e;if(null==i||!i.isZoomable())return;0===this._zoomPoint.x&&(t=!0);const n=i.currZoomLevel;let s,o=!0;n<i.zoomLevels.initial?s=i.zoomLevels.initial:n>i.zoomLevels.max?s=i.zoomLevels.max:(o=!1,s=n);const r=e.bgOpacity,a=e.bgOpacity<1,l=kn({x:0,y:0},i.pan);let h=kn({x:0,y:0},l);t&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=n,kn(this._startPan,l)),o&&(h={x:this._calculatePanForZoomLevel("x",s),y:this._calculatePanForZoomLevel("y",s)}),i.setZoomLevel(s),h={x:i.bounds.correctPan("x",h.x),y:i.bounds.correctPan("y",h.y)},i.setZoomLevel(n);const c=!Cn(h,l);if(!c&&!o&&!a)return i._setResolution(s),void i.applyCurrentZoomPan();e.animations.stopAllPan(),e.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:t=>{if(t/=1e3,c||o){if(c&&(i.pan.x=l.x+(h.x-l.x)*t,i.pan.y=l.y+(h.y-l.y)*t),o){const e=n+(s-n)*t;i.setZoomLevel(e)}i.applyCurrentZoomPan()}a&&e.bgOpacity<1&&e.applyBgOpacity(An(r+(1-r)*t,0,1))},onComplete:()=>{i._setResolution(s),i.applyCurrentZoomPan()}})}}function Kn(t){return!!t.target.closest(".pswp__container")}class Gn{constructor(t){this.gestures=t}click(t,e){const i=e.target.classList,n=i.contains("pswp__img"),s=i.contains("pswp__item")||i.contains("pswp__zoom-wrap");n?this._doClickOrTapAction("imageClick",t,e):s&&this._doClickOrTapAction("bgClick",t,e)}tap(t,e){Kn(e)&&this._doClickOrTapAction("tap",t,e)}doubleTap(t,e){Kn(e)&&this._doClickOrTapAction("doubleTap",t,e)}_doClickOrTapAction(t,e,i){var n;const{pswp:s}=this.gestures,{currSlide:o}=s,r=t+"Action",a=s.options[r];if(!s.dispatch(r,{point:e,originalEvent:i}).defaultPrevented)if("function"!=typeof a)switch(a){case"close":case"next":s[a]();break;case"zoom":null==o||o.toggleZoom(e);break;case"zoom-or-close":null!=o&&o.isZoomable()&&o.zoomLevels.secondary!==o.zoomLevels.initial?o.toggleZoom(e):s.options.clickToCloseNonZoomable&&s.close();break;case"toggle-controls":null===(n=this.gestures.pswp.element)||void 0===n||n.classList.toggle("pswp--ui-visible")}else a.call(s,e,i)}}class Xn{constructor(t){this.pswp=t,this.dragAxis=null,this.p1={x:0,y:0},this.p2={x:0,y:0},this.prevP1={x:0,y:0},this.prevP2={x:0,y:0},this.startP1={x:0,y:0},this.startP2={x:0,y:0},this.velocity={x:0,y:0},this._lastStartP1={x:0,y:0},this._intervalP1={x:0,y:0},this._numActivePoints=0,this._ongoingPointers=[],this._touchEventEnabled="ontouchstart"in window,this._pointerEventEnabled=!!window.PointerEvent,this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1,this._numActivePoints=0,this._intervalTime=0,this._velocityCalculated=!1,this.isMultitouch=!1,this.isDragging=!1,this.isZooming=!1,this.raf=null,this._tapTimer=null,this.supportsTouch||(t.options.allowPanToNext=!1),this.drag=new jn(this),this.zoomLevels=new qn(this),this.tapHandler=new Gn(this),t.on("bindEvents",(()=>{t.events.add(t.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),t.scrollWrap&&(t.scrollWrap.ontouchmove=()=>{},t.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")}))}_bindEvents(t,e,i,n){const{pswp:s}=this,{events:o}=s,r=n?t+n:"";o.add(s.scrollWrap,t+e,this.onPointerDown.bind(this)),o.add(window,t+"move",this.onPointerMove.bind(this)),o.add(window,t+i,this.onPointerUp.bind(this)),r&&o.add(s.scrollWrap,r,this.onPointerUp.bind(this))}onPointerDown(t){const e="mousedown"===t.type||"mouse"===t.pointerType;if(e&&t.button>0)return;const{pswp:i}=this;i.opener.isOpen?i.dispatch("pointerDown",{originalEvent:t}).defaultPrevented||(e&&(i.mouseDetected(),this._preventPointerEventBehaviour(t,"down")),i.animations.stopAll(),this._updatePoints(t,"down"),1===this._numActivePoints&&(this.dragAxis=null,kn(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1):t.preventDefault()}onPointerMove(t){this._preventPointerEventBehaviour(t,"move"),this._numActivePoints&&(this._updatePoints(t,"move"),this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented||(1!==this._numActivePoints||this.isDragging?this._numActivePoints>1&&!this.isZooming&&(this._finishDrag(),this.isZooming=!0,this._updateStartPoints(),this.zoomLevels.start(),this._rafStopLoop(),this._rafRenderLoop()):(this.dragAxis||this._calculateDragDirection(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this._clearTapTimer(),this._updateStartPoints(),this._intervalTime=Date.now(),this._velocityCalculated=!1,kn(this._intervalP1,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this._rafStopLoop(),this._rafRenderLoop()))))}_finishDrag(){this.isDragging&&(this.isDragging=!1,this._velocityCalculated||this._updateVelocity(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(t){this._numActivePoints&&(this._updatePoints(t,"up"),this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented||(0===this._numActivePoints&&(this._rafStopLoop(),this.isDragging?this._finishDrag():this.isZooming||this.isMultitouch||this._finishTap(t)),this._numActivePoints<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),1===this._numActivePoints&&(this.dragAxis=null,this._updateStartPoints()))))}_rafRenderLoop(){(this.isDragging||this.isZooming)&&(this._updateVelocity(),this.isDragging?Cn(this.p1,this.prevP1)||this.drag.change():Cn(this.p1,this.prevP1)&&Cn(this.p2,this.prevP2)||this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(t){const e=Date.now(),i=e-this._intervalTime;i<50&&!t||(this.velocity.x=this._getVelocity("x",i),this.velocity.y=this._getVelocity("y",i),this._intervalTime=e,kn(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(t){const{mainScroll:e}=this.pswp;if(e.isShifted())return void e.moveIndexBy(0,!0);if(t.type.indexOf("cancel")>0)return;if("mouseup"===t.type||"mouse"===t.pointerType)return void this.tapHandler.click(this.startP1,t);const i=this.pswp.options.doubleTapAction?300:0;this._tapTimer?(this._clearTapTimer(),Sn(this._lastStartP1,this.startP1)<25&&this.tapHandler.doubleTap(this.startP1,t)):(kn(this._lastStartP1,this.startP1),this._tapTimer=setTimeout((()=>{this.tapHandler.tap(this.startP1,t),this._clearTapTimer()}),i))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(t,e){const i=this.p1[t]-this._intervalP1[t];return Math.abs(i)>1&&e>5?i/e:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(t,e){this.pswp.applyFilters("preventPointerEvent",!0,t,e)&&t.preventDefault()}_updatePoints(t,e){if(this._pointerEventEnabled){const i=t,n=this._ongoingPointers.findIndex((t=>t.id===i.pointerId));"up"===e&&n>-1?this._ongoingPointers.splice(n,1):"down"===e&&-1===n?this._ongoingPointers.push(this._convertEventPosToPoint(i,{x:0,y:0})):n>-1&&this._convertEventPosToPoint(i,this._ongoingPointers[n]),this._numActivePoints=this._ongoingPointers.length,this._numActivePoints>0&&kn(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&kn(this.p2,this._ongoingPointers[1])}else{const i=t;this._numActivePoints=0,i.type.indexOf("touch")>-1?i.touches&&i.touches.length>0&&(this._convertEventPosToPoint(i.touches[0],this.p1),this._numActivePoints++,i.touches.length>1&&(this._convertEventPosToPoint(i.touches[1],this.p2),this._numActivePoints++)):(this._convertEventPosToPoint(t,this.p1),"up"===e?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){kn(this.prevP1,this.p1),kn(this.prevP2,this.p2)}_updateStartPoints(){kn(this.startP1,this.p1),kn(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(0!==t){const e=t>0?"x":"y";Math.abs(this.p1[e]-this.startP1[e])>=10&&(this.dragAxis=e)}}}_convertEventPosToPoint(t,e){return e.x=t.pageX-this.pswp.offset.x,e.y=t.pageY-this.pswp.offset.y,"pointerId"in t?e.id=t.pointerId:void 0!==t.identifier&&(e.id=t.identifier),e}_onClick(t){this.pswp.mainScroll.isShifted()&&(t.preventDefault(),t.stopPropagation())}}class Jn{constructor(t){this.pswp=t,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(t){const{pswp:e}=this,i=Math.round(e.viewportSize.x+e.viewportSize.x*e.options.spacing),n=i!==this.slideWidth;n&&(this.slideWidth=i,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach(((e,i)=>{n&&Ln(e.el,(i+this._containerShiftIndex)*this.slideWidth),t&&e.slide&&e.slide.resize()}))}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let t=0;t<3;t++){const e=bn("pswp__item","div",this.pswp.container);e.setAttribute("role","group"),e.setAttribute("aria-roledescription","slide"),e.setAttribute("aria-hidden","true"),e.style.display=1===t?"block":"none",this.itemHolders.push({el:e})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(t,e,i){const{pswp:n}=this;let s=n.potentialIndex+t;const o=n.getNumItems();if(n.canLoop()){s=n.getLoopedIndex(s);const e=(t+o)%o;t=e<=o/2?e:e-o}else s<0?s=0:s>=o&&(s=o-1),t=s-n.potentialIndex;n.potentialIndex=s,this._currPositionIndex-=t,n.animations.stopMainScroll();const r=this.getCurrSlideX();if(e){n.animations.startSpring({isMainScroll:!0,start:this.x,end:r,velocity:i||0,naturalFrequency:30,dampingRatio:1,onUpdate:t=>{this.moveTo(t)},onComplete:()=>{this.updateCurrItem(),n.appendHeavy()}});let t=n.potentialIndex-n.currIndex;if(n.canLoop()){const e=(t+o)%o;t=e<=o/2?e:e-o}Math.abs(t)>1&&this.updateCurrItem()}else this.moveTo(r),this.updateCurrItem();return Boolean(t)}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var t;const{pswp:e}=this,i=this._prevPositionIndex-this._currPositionIndex;if(!i)return;this._prevPositionIndex=this._currPositionIndex,e.currIndex=e.potentialIndex;let n,s=Math.abs(i);s>=3&&(this._containerShiftIndex+=i+(i>0?-3:3),s=3);for(let t=0;t<s;t++)i>0?(n=this.itemHolders.shift(),n&&(this.itemHolders[2]=n,this._containerShiftIndex++,Ln(n.el,(this._containerShiftIndex+2)*this.slideWidth),e.setContent(n,e.currIndex-s+t+2))):(n=this.itemHolders.pop(),n&&(this.itemHolders.unshift(n),this._containerShiftIndex--,Ln(n.el,this._containerShiftIndex*this.slideWidth),e.setContent(n,e.currIndex+s-t-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),e.animations.stopAllPan(),this.itemHolders.forEach(((t,e)=>{t.slide&&t.slide.setIsActive(1===e)})),e.currSlide=null===(t=this.itemHolders[1])||void 0===t?void 0:t.slide,e.contentLoader.updateLazy(i),e.currSlide&&e.currSlide.applyCurrentZoomPan(),e.dispatch("change")}moveTo(t,e){if(!this.pswp.canLoop()&&e){let e=(this.slideWidth*this._currPositionIndex-t)/this.slideWidth;e+=this.pswp.currIndex;const i=Math.round(t-this.x);(e<0&&i>0||e>=this.pswp.getNumItems()-1&&i<0)&&(t=this.x+.35*i)}this.x=t,this.pswp.container&&Ln(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:null!=e&&e})}}const Yn={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},Qn=(t,e)=>e?t:Yn[t];class ts{constructor(t){this.pswp=t,this._wasFocused=!1,t.on("bindEvents",(()=>{t.options.trapFocus&&(t.options.initialPointerPos||this._focusRoot(),t.events.add(document,"focusin",this._onFocusIn.bind(this))),t.events.add(document,"keydown",this._onKeyDown.bind(this))}));const e=document.activeElement;t.on("destroy",(()=>{t.options.returnFocus&&e&&this._wasFocused&&e.focus()}))}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(t){const{pswp:e}=this;if(e.dispatch("keydown",{originalEvent:t}).defaultPrevented)return;if(function(t){return"button"in t&&1===t.button||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}(t))return;let i,n,s=!1;const o="key"in t;switch(o?t.key:t.keyCode){case Qn("Escape",o):e.options.escKey&&(i="close");break;case Qn("z",o):i="toggleZoom";break;case Qn("ArrowLeft",o):n="x";break;case Qn("ArrowUp",o):n="y";break;case Qn("ArrowRight",o):n="x",s=!0;break;case Qn("ArrowDown",o):s=!0,n="y";break;case Qn("Tab",o):this._focusRoot()}if(n){t.preventDefault();const{currSlide:o}=e;e.options.arrowKeys&&"x"===n&&e.getNumItems()>1?i=s?"next":"prev":o&&o.currZoomLevel>o.zoomLevels.fit&&(o.pan[n]+=s?-80:80,o.panTo(o.pan.x,o.pan.y))}i&&(t.preventDefault(),e[i]())}_onFocusIn(t){const{template:e}=this.pswp;e&&document!==t.target&&e!==t.target&&!e.contains(t.target)&&e.focus()}}const es="cubic-bezier(.4,0,.22,1)";class is{constructor(t){var e;this.props=t;const{target:i,onComplete:n,transform:s,onFinish:o=(()=>{}),duration:r=333,easing:a=es}=t;this.onFinish=o;const l=s?"transform":"opacity",h=null!==(e=t[l])&&void 0!==e?e:"";this._target=i,this._onComplete=n,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout((()=>{In(i,l,r,a),this._helperTimeout=setTimeout((()=>{i.addEventListener("transitionend",this._onTransitionEnd,!1),i.addEventListener("transitioncancel",this._onTransitionEnd,!1),this._helperTimeout=setTimeout((()=>{this._finalizeAnimation()}),r+500),i.style[l]=h}),30)}),0)}_onTransitionEnd(t){t.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),In(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}class ns{constructor(t,e,i){this.velocity=1e3*t,this._dampingRatio=e||.75,this._naturalFrequency=i||12,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(t,e){let i,n=0;e/=1e3;const s=Math.E**(-this._dampingRatio*this._naturalFrequency*e);if(1===this._dampingRatio)i=this.velocity+this._naturalFrequency*t,n=(t+i*e)*s,this.velocity=n*-this._naturalFrequency+i*s;else if(this._dampingRatio<1){i=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*t+this.velocity);const o=Math.cos(this._dampedFrequency*e),r=Math.sin(this._dampedFrequency*e);n=s*(t*o+i*r),this.velocity=n*-this._naturalFrequency*this._dampingRatio+s*(-this._dampedFrequency*t*r+this._dampedFrequency*i*o)}return n}}class ss{constructor(t){this.props=t,this._raf=0;const{start:e,end:i,velocity:n,onUpdate:s,onComplete:o,onFinish:r=(()=>{}),dampingRatio:a,naturalFrequency:l}=t;this.onFinish=r;const h=new ns(n,a,l);let c=Date.now(),d=e-i;const p=()=>{this._raf&&(d=h.easeFrame(d,Date.now()-c),Math.abs(d)<1&&Math.abs(h.velocity)<50?(s(i),o&&o(),this.onFinish()):(c=Date.now(),s(d+i),this._raf=requestAnimationFrame(p)))};this._raf=requestAnimationFrame(p)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class os{constructor(){this.activeAnimations=[]}startSpring(t){this._start(t,!0)}startTransition(t){this._start(t)}_start(t,e){const i=e?new ss(t):new is(t);return this.activeAnimations.push(i),i.onFinish=()=>this.stop(i),i}stop(t){t.destroy();const e=this.activeAnimations.indexOf(t);e>-1&&this.activeAnimations.splice(e,1)}stopAll(){this.activeAnimations.forEach((t=>{t.destroy()})),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isPan||(t.destroy(),!1)))}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isMainScroll||(t.destroy(),!1)))}isPanRunning(){return this.activeAnimations.some((t=>t.props.isPan))}}class rs{constructor(t){this.pswp=t,t.events.add(t.element,"wheel",this._onWheel.bind(this))}_onWheel(t){t.preventDefault();const{currSlide:e}=this.pswp;let{deltaX:i,deltaY:n}=t;if(e&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(e.isZoomable()){let i=-n;1===t.deltaMode?i*=.05:i*=t.deltaMode?1:.002,i=2**i;const s=e.currZoomLevel*i;e.zoomTo(s,{x:t.clientX,y:t.clientY})}}else e.isPannable()&&(1===t.deltaMode&&(i*=18,n*=18),e.panTo(e.pan.x-i,e.pan.y-n))}}class as{constructor(t,e){var i;const n=e.name||e.className;let s=e.html;if(!1===t.options[n])return;"string"==typeof t.options[n+"SVG"]&&(s=t.options[n+"SVG"]),t.dispatch("uiElementCreate",{data:e});let o="";e.isButton?(o+="pswp__button ",o+=e.className||`pswp__button--${e.name}`):o+=e.className||`pswp__${e.name}`;let r=e.isButton?e.tagName||"button":e.tagName||"div";r=r.toLowerCase();const a=bn(o,r);if(e.isButton){"button"===r&&(a.type="button");let{title:i}=e;const{ariaLabel:s}=e;"string"==typeof t.options[n+"Title"]&&(i=t.options[n+"Title"]),i&&(a.title=i);const o=s||i;o&&a.setAttribute("aria-label",o)}a.innerHTML=function(t){if("string"==typeof t)return t;if(!t||!t.isCustomSVG)return"";const e=t;let i='<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';return i=i.split("%d").join(e.size||32),e.outlineID&&(i+='<use class="pswp__icn-shadow" xlink:href="#'+e.outlineID+'"/>'),i+=e.inner,i+="</svg>",i}(s),e.onInit&&e.onInit(a,t),e.onClick&&(a.onclick=i=>{"string"==typeof e.onClick?t[e.onClick]():"function"==typeof e.onClick&&e.onClick(i,a,t)});const l=e.appendTo||"bar";let h=t.element;"bar"===l?(t.topBar||(t.topBar=bn("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap)),h=t.topBar):(a.classList.add("pswp__hide-on-close"),"wrapper"===l&&(h=t.scrollWrap)),null===(i=h)||void 0===i||i.appendChild(t.applyFilters("uiElement",a,e))}}function ls(t,e,i){t.classList.add("pswp__button--arrow"),t.setAttribute("aria-controls","pswp__items"),e.on("change",(()=>{e.options.loop||(t.disabled=i?!(e.currIndex<e.getNumItems()-1):!(e.currIndex>0))}))}const hs={name:"arrowPrev",className:"pswp__button--arrow--prev",title:"Previous",order:10,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'<path d="M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z" id="pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"prev",onInit:ls},cs={name:"arrowNext",className:"pswp__button--arrow--next",title:"Next",order:11,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'<use xlink:href="#pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"next",onInit:(t,e)=>{ls(t,e,!0)}},ds={name:"close",title:"Close",order:20,isButton:!0,html:{isCustomSVG:!0,inner:'<path d="M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z" id="pswp__icn-close"/>',outlineID:"pswp__icn-close"},onClick:"close"},ps={name:"zoom",title:"Zoom",order:10,isButton:!0,html:{isCustomSVG:!0,inner:'<path d="M17.426 19.926a6 6 0 1 1 1.5-1.5L23 22.5 21.5 24l-4.074-4.074z" id="pswp__icn-zoom"/><path fill="currentColor" class="pswp__zoom-icn-bar-h" d="M11 16v-2h6v2z"/><path fill="currentColor" class="pswp__zoom-icn-bar-v" d="M13 12h2v6h-2z"/>',outlineID:"pswp__icn-zoom"},onClick:"toggleZoom"},us={name:"preloader",appendTo:"bar",order:7,html:{isCustomSVG:!0,inner:'<path fill-rule="evenodd" clip-rule="evenodd" d="M21.2 16a5.2 5.2 0 1 1-5.2-5.2V8a8 8 0 1 0 8 8h-2.8Z" id="pswp__icn-loading"/>',outlineID:"pswp__icn-loading"},onInit:(t,e)=>{let i,n=null;const s=e=>{var n,s;i!==e&&(i=e,n="active",s=e,t.classList.toggle("pswp__preloader--"+n,s))},o=()=>{var t;if(null===(t=e.currSlide)||void 0===t||!t.content.isLoading())return s(!1),void(n&&(clearTimeout(n),n=null));n||(n=setTimeout((()=>{var t;s(Boolean(null===(t=e.currSlide)||void 0===t?void 0:t.content.isLoading())),n=null}),e.options.preloaderDelay))};e.on("change",o),e.on("loadComplete",(t=>{e.currSlide===t.slide&&o()})),e.ui&&(e.ui.updatePreloaderVisibility=o)}},ms={name:"counter",order:5,onInit:(t,e)=>{e.on("change",(()=>{t.innerText=e.currIndex+1+e.options.indexIndicatorSep+e.getNumItems()}))}};function fs(t,e){t.classList.toggle("pswp--zoomed-in",e)}class gs{constructor(t){this.pswp=t,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){const{pswp:t}=this;this.isRegistered=!1,this.uiElementsData=[ds,hs,cs,ps,us,ms],t.dispatch("uiRegister"),this.uiElementsData.sort(((t,e)=>(t.order||0)-(e.order||0))),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach((t=>{this.registerElement(t)})),t.on("change",(()=>{var e;null===(e=t.element)||void 0===e||e.classList.toggle("pswp--one-slide",1===t.getNumItems())})),t.on("zoomPanUpdate",(()=>this._onZoomPanUpdate()))}registerElement(t){this.isRegistered?this.items.push(new as(this.pswp,t)):this.uiElementsData.push(t)}_onZoomPanUpdate(){const{template:t,currSlide:e,options:i}=this.pswp;if(this.pswp.opener.isClosing||!t||!e)return;let{currZoomLevel:n}=e;if(this.pswp.opener.isOpen||(n=e.zoomLevels.initial),n===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=n;const s=e.zoomLevels.initial-e.zoomLevels.secondary;if(Math.abs(s)<.01||!e.isZoomable())return fs(t,!1),void t.classList.remove("pswp--zoom-allowed");t.classList.add("pswp--zoom-allowed");fs(t,(n===e.zoomLevels.initial?e.zoomLevels.secondary:e.zoomLevels.initial)<=n),"zoom"!==i.imageClickAction&&"zoom-or-close"!==i.imageClickAction||t.classList.add("pswp--click-to-zoom")}}class vs{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}}class ws{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,e,i=100){var n,s,o;this._filters[t]||(this._filters[t]=[]),null===(n=this._filters[t])||void 0===n||n.push({fn:e,priority:i}),null===(s=this._filters[t])||void 0===s||s.sort(((t,e)=>t.priority-e.priority)),null===(o=this.pswp)||void 0===o||o.addFilter(t,e,i)}removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter((t=>t.fn!==e))),this.pswp&&this.pswp.removeFilter(t,e)}applyFilters(t,...e){var i;return null===(i=this._filters[t])||void 0===i||i.forEach((t=>{e[0]=t.fn.apply(this,e)})),e[0]}on(t,e){var i,n;this._listeners[t]||(this._listeners[t]=[]),null===(i=this._listeners[t])||void 0===i||i.push(e),null===(n=this.pswp)||void 0===n||n.on(t,e)}off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter((t=>e!==t))),null===(i=this.pswp)||void 0===i||i.off(t,e)}dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);const n=new vs(t,e);return null===(i=this._listeners[t])||void 0===i||i.forEach((t=>{t.call(this,n)})),n}}class ys{constructor(t,e){if(this.element=bn("pswp__img pswp__img--placeholder",t?"img":"div",e),t){const e=this.element;e.decoding="async",e.alt="",e.src=t,e.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,e){this.element&&("IMG"===this.element.tagName?(En(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=Bn(0,0,t/250)):En(this.element,t,e))}destroy(){var t;null!==(t=this.element)&&void 0!==t&&t.parentNode&&this.element.remove(),this.element=null}}class xs{constructor(t,e,i){this.instance=e,this.data=t,this.index=i,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=Mn,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout((()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)}),1e3)}load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){const t=this.placeholder.element;t&&!t.parentElement&&this.slide.container.prepend(t)}else{const t=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new ys(t,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=bn("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=bn("pswp__content","div"),this.element.innerHTML=this.data.html||""),e&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var e,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const n=this.element;this.updateSrcsetSizes(),this.data.srcset&&(n.srcset=this.data.srcset),n.src=null!==(e=this.data.src)&&void 0!==e?e:"",n.alt=null!==(i=this.data.alt)&&void 0!==i?i:"",this.state=Pn,n.complete?this.onLoaded():(n.onload=()=>{this.onLoaded()},n.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=Zn,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),this.state!==Zn&&this.state!==zn||this.removePlaceholder())}onError(){this.state=zn,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===Pn,this)}isError(){return this.state===zn}isImageContent(){return"image"===this.type}setDisplayedSize(t,e){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,e),!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented&&(En(this.element,t,e),this.isImageContent()&&!this.isError()))){const i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=e,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==zn,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=this.element,e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=e+"px",t.dataset.largestUsedSize=String(e))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented||(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,e;let i=bn("pswp__error-msg","div");i.innerText=null!==(t=null===(e=this.instance.options)||void 0===e?void 0:e.errorMsg)&&void 0!==t?t:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=bn("pswp__content pswp__error-msg-container","div"),this.element.appendChild(i),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===zn)return void this.displayError();if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||Nn())?(this.isDecoding=!0,this.element.decode().catch((()=>{})).finally((()=>{this.isDecoding=!1,this.appendImage()}))):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){!this.instance.dispatch("contentActivate",{content:this}).defaultPrevented&&this.slide&&(this.isImageContent()&&this.isDecoding&&!Nn()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,this.instance.dispatch("contentRemove",{content:this}).defaultPrevented||(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),this.state!==Zn&&this.state!==zn||this.removePlaceholder()))}}function bs(t,e,i){const n=e.createContentFromData(t,i);let s;const{options:o}=e;if(o){let r;s=new Rn(o,t,-1),r=e.pswp?e.pswp.viewportSize:Dn(o,e);const a=Vn(o,r,t,i);s.update(n.width,n.height,a)}return n.lazyLoad(),s&&n.setDisplayedSize(Math.ceil(n.width*s.initial),Math.ceil(n.height*s.initial)),n}class ks{constructor(t){this.pswp=t,this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,5),this._cachedItems=[]}updateLazy(t){const{pswp:e}=this;if(e.dispatch("lazyLoad").defaultPrevented)return;const{preload:i}=e.options,n=void 0===t||t>=0;let s;for(s=0;s<=i[1];s++)this.loadSlideByIndex(e.currIndex+(n?s:-s));for(s=1;s<=i[0];s++)this.loadSlideByIndex(e.currIndex+(n?-s:s))}loadSlideByIndex(t){const e=this.pswp.getLoopedIndex(t);let i=this.getContentByIndex(e);i||(i=function(t,e){const i=e.getItemData(t);if(!e.dispatch("lazyLoadSlide",{index:t,itemData:i}).defaultPrevented)return bs(i,e,t)}(e,this.pswp),i&&this.addToCache(i))}getContentBySlide(t){let e=this.getContentByIndex(t.index);return e||(e=this.pswp.createContentFromData(t.data,t.index),this.addToCache(e)),e.setSlide(t),e}addToCache(t){if(this.removeByIndex(t.index),this._cachedItems.push(t),this._cachedItems.length>this.limit){const t=this._cachedItems.findIndex((t=>!t.isAttached&&!t.hasSlide));if(-1!==t){this._cachedItems.splice(t,1)[0].destroy()}}}removeByIndex(t){const e=this._cachedItems.findIndex((e=>e.index===t));-1!==e&&this._cachedItems.splice(e,1)}getContentByIndex(t){return this._cachedItems.find((e=>e.index===t))}destroy(){this._cachedItems.forEach((t=>t.destroy())),this._cachedItems=[]}}class _s extends ws{getNumItems(){var t;let e=0;const i=null===(t=this.options)||void 0===t?void 0:t.dataSource;i&&"length"in i?e=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(e=i.items.length));const n=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",n.numItems,i)}createContentFromData(t,e){return new xs(t,this,e)}getItemData(t){var e;const i=null===(e=this.options)||void 0===e?void 0:e.dataSource;let n={};Array.isArray(i)?n=i[t]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),n=i.items[t]);let s=n;s instanceof Element&&(s=this._domElementToItemData(s));const o=this.dispatch("itemData",{itemData:s||{},index:t});return this.applyFilters("itemData",o.itemData,t)}_getGalleryDOMElements(t){var e,i;return null!==(e=this.options)&&void 0!==e&&e.children||null!==(i=this.options)&&void 0!==i&&i.childSelector?function(t,e,i=document){let n=[];if(t instanceof Element)n=[t];else if(t instanceof NodeList||Array.isArray(t))n=Array.from(t);else{const s="string"==typeof t?t:e;s&&(n=Array.from(i.querySelectorAll(s)))}return n}(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){const e={element:t},i="A"===t.tagName?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset),e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,e.w=e.width,e.h=e.height,i.dataset.pswpType&&(e.type=i.dataset.pswpType);const s=t.querySelector("img");var n;if(s)e.msrc=s.currentSrc||s.src,e.alt=null!==(n=s.getAttribute("alt"))&&void 0!==n?n:"";(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=!0)}return this.applyFilters("domItemData",e,t,i)}lazyLoadData(t,e){return bs(t,this,e)}}const Ss=.003;class Cs{constructor(t){this.pswp=t,this.isClosed=!0,this.isOpen=!1,this.isClosing=!1,this.isOpening=!1,this._duration=void 0,this._useAnimation=!1,this._croppedZoom=!1,this._animateRootOpacity=!1,this._animateBgOpacity=!1,this._placeholder=void 0,this._opacityElement=void 0,this._cropContainer1=void 0,this._cropContainer2=void 0,this._thumbBounds=void 0,this._prepareOpen=this._prepareOpen.bind(this),t.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;const t=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,t&&t.currZoomLevel*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps(),setTimeout((()=>{this._start()}),this._croppedZoom?30:0)}_prepareOpen(){if(this.pswp.off("firstZoomPan",this._prepareOpen),!this.isOpening){const t=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,t&&t.zoomLevels.initial*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){const{pswp:t}=this,e=this.pswp.currSlide,{options:i}=t;var n,s;("fade"===i.showHideAnimationType?(i.showHideOpacity=!0,this._thumbBounds=void 0):"none"===i.showHideAnimationType?(i.showHideOpacity=!1,this._duration=0,this._thumbBounds=void 0):this.isOpening&&t._initialThumbBounds?this._thumbBounds=t._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=null==e?void 0:e.getPlaceholderElement(),t.animations.stopAll(),this._useAnimation=Boolean(this._duration&&this._duration>50),this._animateZoom=Boolean(this._thumbBounds)&&(null==e?void 0:e.content.usePlaceholder())&&(!this.isClosing||!t.mainScroll.isShifted()),this._animateZoom)?this._animateRootOpacity=null!==(n=i.showHideOpacity)&&void 0!==n&&n:(this._animateRootOpacity=!0,this.isOpening&&e&&(e.zoomAndPanToInitial(),e.applyCurrentZoomPan()));if(this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>Ss,this._opacityElement=this._animateRootOpacity?t.element:t.bg,!this._useAnimation)return this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,void(this.isOpening&&(t.element&&(t.element.style.opacity=String(Ss)),t.applyBgOpacity(1)));this._animateZoom&&this._thumbBounds&&this._thumbBounds.innerRect?(this._croppedZoom=!0,this._cropContainer1=this.pswp.container,this._cropContainer2=null===(s=this.pswp.currSlide)||void 0===s?void 0:s.holderElement,t.container&&(t.container.style.overflow="hidden",t.container.style.width=t.viewportSize.x+"px")):this._croppedZoom=!1;this.isOpening?(this._animateRootOpacity?(t.element&&(t.element.style.opacity=String(Ss)),t.applyBgOpacity(1)):(this._animateBgOpacity&&t.bg&&(t.bg.style.opacity=String(Ss)),t.element&&(t.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(Ss)))):this.isClosing&&(t.mainScroll.itemHolders[0]&&(t.mainScroll.itemHolders[0].el.style.display="none"),t.mainScroll.itemHolders[2]&&(t.mainScroll.itemHolders[2].el.style.display="none"),this._croppedZoom&&0!==t.mainScroll.x&&(t.mainScroll.resetPosition(),t.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&"IMG"===this._placeholder.tagName?new Promise((t=>{let e=!1,i=!0;var n;(n=this._placeholder,"decode"in n?n.decode().catch((()=>{})):n.complete?Promise.resolve(n):new Promise(((t,e)=>{n.onload=()=>t(n),n.onerror=e}))).finally((()=>{e=!0,i||t(!0)})),setTimeout((()=>{i=!1,e&&t(!0)}),50),setTimeout(t,250)})).finally((()=>this._initiate())):this._initiate()}_initiate(){var t,e;null===(t=this.pswp.element)||void 0===t||t.style.setProperty("--pswp-transition-duration",this._duration+"ms"),this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),null===(e=this.pswp.element)||void 0===e||e.classList.toggle("pswp--ui-visible",this.isOpening),this.isOpening?(this._placeholder&&(this._placeholder.style.opacity="1"),this._animateToOpenState()):this.isClosing&&this._animateToClosedState(),this._useAnimation||this._onAnimationComplete()}_onAnimationComplete(){const{pswp:t}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,t.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd"),t.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed)t.destroy();else if(this.isOpen){var e;this._animateZoom&&t.container&&(t.container.style.overflow="visible",t.container.style.width="100%"),null===(e=t.currSlide)||void 0===e||e.applyCurrentZoomPan()}}_animateToOpenState(){const{pswp:t}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)"),this._animateTo(this._cropContainer2,"transform","none")),t.currSlide&&(t.currSlide.zoomAndPanToInitial(),this._animateTo(t.currSlide.container,"transform",t.currSlide.getCurrentTransform()))),this._animateBgOpacity&&t.bg&&this._animateTo(t.bg,"opacity",String(t.options.bgOpacity)),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","1")}_animateToClosedState(){const{pswp:t}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&t.bgOpacity>.01&&t.bg&&this._animateTo(t.bg,"opacity","0"),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","0")}_setClosedStateZoomPan(t){if(!this._thumbBounds)return;const{pswp:e}=this,{innerRect:i}=this._thumbBounds,{currSlide:n,viewportSize:s}=e;if(this._croppedZoom&&i&&this._cropContainer1&&this._cropContainer2){const e=-s.x+(this._thumbBounds.x-i.x)+i.w,n=-s.y+(this._thumbBounds.y-i.y)+i.h,o=s.x-i.w,r=s.y-i.h;t?(this._animateTo(this._cropContainer1,"transform",Bn(e,n)),this._animateTo(this._cropContainer2,"transform",Bn(o,r))):(Ln(this._cropContainer1,e,n),Ln(this._cropContainer2,o,r))}n&&(kn(n.pan,i||this._thumbBounds),n.currZoomLevel=this._thumbBounds.w/n.width,t?this._animateTo(n.container,"transform",n.getCurrentTransform()):n.applyCurrentZoomPan())}_animateTo(t,e,i){if(!this._duration)return void(t.style[e]=i);const{animations:n}=this.pswp,s={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{n.activeAnimations.length||this._onAnimationComplete()},target:t};s[e]=i,n.startTransition(s)}}const As={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,maxWidthToAnimate:4e3,clickToCloseNonZoomable:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:"The image cannot be loaded",preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"};class Bs extends _s{constructor(t){super(),this.options=this._prepareOptions(t||{}),this.offset={x:0,y:0},this._prevViewportSize={x:0,y:0},this.viewportSize={x:0,y:0},this.bgOpacity=1,this.currIndex=0,this.potentialIndex=0,this.isOpen=!1,this.isDestroying=!1,this.hasMouse=!1,this._initialItemData={},this._initialThumbBounds=void 0,this.topBar=void 0,this.element=void 0,this.template=void 0,this.container=void 0,this.scrollWrap=void 0,this.currSlide=void 0,this.events=new Hn,this.animations=new os,this.mainScroll=new Jn(this),this.gestures=new Xn(this),this.opener=new Cs(this),this.keyboard=new ts(this),this.contentLoader=new ks(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch("init"),this.dispatch("beforeOpen"),this._createMainStructure();let t="pswp--open";return this.gestures.supportsTouch&&(t+=" pswp--touch"),this.options.mainClass&&(t+=" "+this.options.mainClass),this.element&&(this.element.className+=" "+t),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new rs(this),(Number.isNaN(this.currIndex)||this.currIndex<0||this.currIndex>=this.getNumItems())&&(this.currIndex=0),this.gestures.supportsTouch||this.mouseDetected(),this.updateSize(),this.offset.y=window.pageYOffset,this._initialItemData=this.getItemData(this.currIndex),this.dispatch("gettingData",{index:this.currIndex,data:this._initialItemData,slide:void 0}),this._initialThumbBounds=this.getThumbBounds(),this.dispatch("initialLayout"),this.on("openingAnimationEnd",(()=>{const{itemHolders:t}=this.mainScroll;t[0]&&(t[0].el.style.display="block",this.setContent(t[0],this.currIndex-1)),t[2]&&(t[2].el.style.display="block",this.setContent(t[2],this.currIndex+1)),this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,"resize",this._handlePageResize.bind(this)),this.events.add(window,"scroll",this._updatePageScrollOffset.bind(this)),this.dispatch("bindEvents")})),this.mainScroll.itemHolders[1]&&this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch("change"),this.opener.open(),this.dispatch("afterInit"),!0}getLoopedIndex(t){const e=this.getNumItems();return this.options.loop&&(t>e-1&&(t-=e),t<0&&(t+=e)),An(t,0,e-1)}appendHeavy(){this.mainScroll.itemHolders.forEach((t=>{var e;null===(e=t.slide)||void 0===e||e.appendHeavy()}))}goTo(t){this.mainScroll.moveIndexBy(this.getLoopedIndex(t)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...t){var e;null===(e=this.currSlide)||void 0===e||e.zoomTo(...t)}toggleZoom(){var t;null===(t=this.currSlide)||void 0===t||t.toggleZoom()}close(){this.opener.isOpen&&!this.isDestroying&&(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){var t;if(!this.isDestroying)return this.options.showHideAnimationType="none",void this.close();this.dispatch("destroy"),this._listeners={},this.scrollWrap&&(this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null),null===(t=this.element)||void 0===t||t.remove(),this.mainScroll.itemHolders.forEach((t=>{var e;null===(e=t.slide)||void 0===e||e.destroy()})),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(t){this.contentLoader.removeByIndex(t),this.mainScroll.itemHolders.forEach(((e,i)=>{var n,s;let o=(null!==(n=null===(s=this.currSlide)||void 0===s?void 0:s.index)&&void 0!==n?n:0)-1+i;var r;(this.canLoop()&&(o=this.getLoopedIndex(o)),o===t)&&(this.setContent(e,t,!0),1===i&&(this.currSlide=e.slide,null===(r=e.slide)||void 0===r||r.setIsActive(!0)))})),this.dispatch("change")}setContent(t,e,i){if(this.canLoop()&&(e=this.getLoopedIndex(e)),t.slide){if(t.slide.index===e&&!i)return;t.slide.destroy(),t.slide=void 0}if(!this.canLoop()&&(e<0||e>=this.getNumItems()))return;const n=this.getItemData(e);t.slide=new Wn(n,e,this),e===this.currIndex&&(this.currSlide=t.slide),t.slide.append(t.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(t){if(this.isDestroying)return;const e=Dn(this.options,this);!t&&Cn(e,this._prevViewportSize)||(kn(this._prevViewportSize,e),this.dispatch("beforeResize"),kn(this.viewportSize,this._prevViewportSize),this._updatePageScrollOffset(),this.dispatch("viewportSize"),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected(),this.dispatch("resize"))}applyBgOpacity(t){this.bgOpacity=Math.max(t,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){var t;this.hasMouse||(this.hasMouse=!0,null===(t=this.element)||void 0===t||t.classList.add("pswp--has_mouse"))}_handlePageResize(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout((()=>{this.updateSize()}),500)}_updatePageScrollOffset(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(t,e){this.offset.x=t,this.offset.y=e,this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=bn("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=bn("pswp__bg","div",this.element),this.scrollWrap=bn("pswp__scroll-wrap","section",this.element),this.container=bn("pswp__container","div",this.scrollWrap),this.scrollWrap.setAttribute("aria-roledescription","carousel"),this.container.setAttribute("aria-live","off"),this.container.setAttribute("id","pswp__items"),this.mainScroll.appendHolders(),this.ui=new gs(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return function(t,e,i){const n=i.dispatch("thumbBounds",{index:t,itemData:e,instance:i});if(n.thumbBounds)return n.thumbBounds;const{element:s}=e;let o,r;if(s&&!1!==i.options.thumbSelector){const t=i.options.thumbSelector||"img";r=s.matches(t)?s:s.querySelector(t)}return r=i.applyFilters("thumbEl",r,e,t),r&&(o=e.thumbCropped?function(t,e,i){const n=t.getBoundingClientRect(),s=n.width/e,o=n.height/i,r=s>o?s:o,a=(n.width-e*r)/2,l=(n.height-i*r)/2,h={x:n.left+a,y:n.top+l,w:e*r};return h.innerRect={w:n.width,h:n.height,x:a,y:l},h}(r,e.width||e.w||0,e.height||e.h||0):function(t){const e=t.getBoundingClientRect();return{x:e.left,y:e.top,w:e.width}}(r)),i.applyFilters("thumbBounds",o,e,t)}(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(t){return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(t.showHideAnimationType="none",t.zoomAnimationDuration=0),{...As,...t}}}function Ls(t,e){const i=e.getEditor();if(!i)return;const n=e.getContainer(),s=t.closest(".lake-resizer").find(".lake-resizer-info"),o=t.attr("class").indexOf("-right")>=0,r=n.width(),a=n.height()/r;let l=0,h=0;const c=t=>{const e=t.clientX-l,i=Math.round(o?h+e:h-e),r=Math.round(a*i);n.css({width:`${i}px`,height:`${r}px`}),s.text(`${i} x ${r}`)};t.on("pointerdown",(e=>{const i=e;t.get(0).setPointerCapture(i.pointerId),l=i.clientX,h=n.width(),s.show(),t.on("pointermove",c)})),t.on("pointerup",(()=>{t.off("pointermove"),s.hide(),h=e.getContainer().width();const n=Math.round(a*h);e.updateValue({width:h,height:n}),i.history.save()})),t.on("pointercancel",(()=>{t.off("pointermove"),s.hide()}))}function Ts(t){return nn(this,void 0,void 0,(function*(){const e=I("<img />");return e.css({position:"absolute",top:"0",left:"-8888px","z-index":"-1",visibility:"hidden"}),new Promise((i=>{e.on("load",(()=>{const t=e.get(0),n=t.width,s=t.height;e.remove(),e.removeAttr("style"),i({node:e,width:n,height:s})})),e.on("error",(()=>{e.remove(),i({node:e})})),e.attr("src",t),I(document.body).append(e)}))}))}function Is(t,e){return nn(this,void 0,void 0,(function*(){const i=e.value;e.getContainer().css({width:"",height:""});const s=I(a`
27
+ */function va(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i&&i.appendChild(n),n}function wa(t,e){return t.x=e.x,t.y=e.y,void 0!==e.id&&(t.id=e.id),t}function ya(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function xa(t,e){const i=Math.abs(t.x-e.x),n=Math.abs(t.y-e.y);return Math.sqrt(i*i+n*n)}function ba(t,e){return t.x===e.x&&t.y===e.y}function ka(t,e,i){return Math.min(Math.max(t,e),i)}function _a(t,e,i){let n=`translate3d(${t}px,${e||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}function Sa(t,e,i,n){t.style.transform=_a(e,i,n)}const Aa="cubic-bezier(.4,0,.22,1)";function Ca(t,e,i,n){t.style.transition=e?`${e} ${i}ms ${n||Aa}`:"none"}function Ba(t,e,i){t.style.width="number"==typeof e?`${e}px`:e,t.style.height="number"==typeof i?`${i}px`:i}const Ea="idle",Ta="loading",Ia="loaded",La="error";function Ma(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let Pa=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{Pa=!0}}))}catch(mr){}class Oa{constructor(){this._pool=[]}add(t,e,i,n){this._toggleListener(t,e,i,n)}remove(t,e,i,n){this._toggleListener(t,e,i,n,!0)}removeAll(){this._pool.forEach((t=>{this._toggleListener(t.target,t.type,t.listener,t.passive,!0,!0)})),this._pool=[]}_toggleListener(t,e,i,n,s,o){if(!t)return;const r=s?"removeEventListener":"addEventListener";e.split(" ").forEach((e=>{if(e){o||(s?this._pool=this._pool.filter((n=>n.type!==e||n.listener!==i||n.target!==t)):this._pool.push({target:t,type:e,listener:i,passive:n}));const a=!!Pa&&{passive:n||!1};t[r](e,i,a)}}))}}function za(t,e){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function Za(t,e,i,n,s){let o=0;if(e.paddingFn)o=e.paddingFn(i,n,s)[t];else if(e.padding)o=e.padding[t];else{const i="padding"+t[0].toUpperCase()+t.slice(1);e[i]&&(o=e[i])}return Number(o)||0}function Na(t,e,i,n){return{x:e.x-Za("left",t,e,i,n)-Za("right",t,e,i,n),y:e.y-Za("top",t,e,i,n)-Za("bottom",t,e,i,n)}}class Ha{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(t){this.currZoomLevel=t,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(t){const{pswp:e}=this.slide,i=this.slide["x"===t?"width":"height"]*this.currZoomLevel,n=Za("x"===t?"left":"top",e.options,e.viewportSize,this.slide.data,this.slide.index),s=this.slide.panAreaSize[t];this.center[t]=Math.round((s-i)/2)+n,this.max[t]=i>s?Math.round(s-i)+n:this.center[t],this.min[t]=i>s?n:this.center[t]}reset(){this.center.x=0,this.center.y=0,this.max.x=0,this.max.y=0,this.min.x=0,this.min.y=0}correctPan(t,e){return ka(e,this.max[t],this.min[t])}}class Da{constructor(t,e,i,n){this.pswp=n,this.options=t,this.itemData=e,this.index=i,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,e,i){const n={x:t,y:e};this.elementSize=n,this.panAreaSize=i;const s=i.x/n.x,o=i.y/n.y;this.fit=Math.min(1,s<o?s:o),this.fill=Math.min(1,s>o?s:o),this.vFill=Math.min(1,o),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){const e=t+"ZoomLevel",i=this.options[e];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,3*this.fit),this.elementSize&&t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,4*this.fit)}}class $a{constructor(t,e,i){this.data=t,this.index=e,this.pswp=i,this.isActive=e===i.currIndex,this.currentResolution=0,this.panAreaSize={x:0,y:0},this.pan={x:0,y:0},this.isFirstSlide=this.isActive&&!i.opener.isOpen,this.zoomLevels=new Da(i.options,t,e,i),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:e}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=va("pswp__zoom-wrap","div"),this.holderElement=null,this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.heavyAppended=!1,this.bounds=new Ha(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(t){t&&!this.isActive?this.activate():!t&&this.isActive&&this.deactivate()}append(t){this.holderElement=t,this.container.style.transformOrigin="0 0",this.data&&(this.calculateSize(),this.load(),this.updateContentSize(),this.appendHeavy(),this.holderElement.appendChild(this.container),this.zoomAndPanToInitial(),this.pswp.dispatch("firstZoomPan",{slide:this}),this.applyCurrentZoomPan(),this.pswp.dispatch("afterSetContent",{slide:this}),this.isActive&&this.activate())}load(){this.content.load(!1),this.pswp.dispatch("slideLoad",{slide:this})}appendHeavy(){const{pswp:t}=this;!this.heavyAppended&&t.opener.isOpen&&!t.mainScroll.isShifted()&&(this.isActive,1)&&(this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.append(),this.pswp.dispatch("appendHeavyContent",{slide:this})))}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.hasSlide=!1,this.content.remove(),this.container.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel!==this.zoomLevels.initial&&this.isActive?(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y)):(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize())}updateContentSize(t){const e=this.currentResolution||this.zoomLevels.initial;if(!e)return;const i=Math.round(this.width*e)||this.pswp.viewportSize.x,n=Math.round(this.height*e)||this.pswp.viewportSize.y;(this.sizeChanged(i,n)||t)&&this.content.setDisplayedSize(i,n)}sizeChanged(t,e){return(t!==this.prevDisplayedWidth||e!==this.prevDisplayedHeight)&&(this.prevDisplayedWidth=t,this.prevDisplayedHeight=e,!0)}getPlaceholderElement(){var t;return null===(t=this.content.placeholder)||void 0===t?void 0:t.element}zoomTo(t,e,i,n){const{pswp:s}=this;if(!this.isZoomable()||s.mainScroll.isShifted())return;s.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:e,transitionDuration:i}),s.animations.stopAllPan();const o=this.currZoomLevel;n||(t=ka(t,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(t),this.pan.x=this.calculateZoomToPanOffset("x",e,o),this.pan.y=this.calculateZoomToPanOffset("y",e,o),ya(this.pan);const r=()=>{this._setResolution(t),this.applyCurrentZoomPan()};i?s.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:r,duration:i,easing:s.options.easing}):r()}toggleZoom(t){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,t,this.pswp.options.zoomAnimationDuration)}setZoomLevel(t){this.currZoomLevel=t,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(t,e,i){if(0===this.bounds.max[t]-this.bounds.min[t])return this.bounds.center[t];e||(e=this.pswp.getViewportCenterPoint()),i||(i=this.zoomLevels.initial);const n=this.currZoomLevel/i;return this.bounds.correctPan(t,(this.pan[t]-e[t])*n+e[t])}panTo(t,e){this.pan.x=this.bounds.correctPan("x",t),this.pan.y=this.bounds.correctPan("y",e),this.applyCurrentZoomPan()}isPannable(){return Boolean(this.width)&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return Boolean(this.width)&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel),this===this.pswp.currSlide&&this.pswp.dispatch("zoomPanUpdate",{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial,this.bounds.update(this.currZoomLevel),wa(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(t,e,i){i/=this.currentResolution||this.zoomLevels.initial,Sa(this.container,t,e,i)}calculateSize(){const{pswp:t}=this;wa(this.panAreaSize,Na(t.options,t.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),t.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return _a(this.pan.x,this.pan.y,t)}_setResolution(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}class Va{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&wa(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:t,prevP1:e,dragAxis:i}=this.gestures,{currSlide:n}=this.pswp;if("y"===i&&this.pswp.options.closeOnVerticalDrag&&n&&n.currZoomLevel<=n.zoomLevels.fit&&!this.gestures.isMultitouch){const i=n.pan.y+(t.y-e.y);if(!this.pswp.dispatch("verticalDrag",{panY:i}).defaultPrevented){this._setPanWithFriction("y",i,.6);const t=1-Math.abs(this._getVerticalDragRatio(n.pan.y));this.pswp.applyBgOpacity(t),n.applyCurrentZoomPan()}}else{this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),n&&(ya(n.pan),n.applyCurrentZoomPan()))}}end(){const{velocity:t}=this.gestures,{mainScroll:e,currSlide:i}=this.pswp;let n=0;if(this.pswp.animations.stopAll(),e.isShifted()){const i=(e.x-e.getCurrSlideX())/this.pswp.viewportSize.x;t.x<-.5&&i<0||t.x<.1&&i<-.5?(n=1,t.x=Math.min(t.x,0)):(t.x>.5&&i>0||t.x>-.1&&i>.5)&&(n=-1,t.x=Math.max(t.x,0)),e.moveIndexBy(n,!0,t.x)}i&&i.currZoomLevel>i.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(t){const{velocity:e}=this.gestures,{currSlide:i}=this.pswp;if(!i)return;const{pan:n,bounds:s}=i,o=n[t],r=this.pswp.bgOpacity<1&&"y"===t,a=o+function(t,e){return t*e/(1-e)}(e[t],.995);if(r){const t=this._getVerticalDragRatio(o),e=this._getVerticalDragRatio(a);if(t<0&&e<-.4||t>0&&e>.4)return void this.pswp.close()}const l=s.correctPan(t,a);if(o===l)return;const c=l===a?1:.82,h=this.pswp.bgOpacity,d=l-o;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:!0,start:o,end:l,velocity:e[t],dampingRatio:c,onUpdate:e=>{if(r&&this.pswp.bgOpacity<1){const t=1-(l-e)/d;this.pswp.applyBgOpacity(ka(h+(1-h)*t,0,1))}n[t]=Math.floor(e),i.applyCurrentZoomPan()}})}_panOrMoveMainScroll(t){const{p1:e,dragAxis:i,prevP1:n,isMultitouch:s}=this.gestures,{currSlide:o,mainScroll:r}=this.pswp,a=e[t]-n[t],l=r.x+a;if(!a||!o)return!1;if("x"===t&&!o.isPannable()&&!s)return r.moveTo(l,!0),!0;const{bounds:c}=o,h=o.pan[t]+a;if(this.pswp.options.allowPanToNext&&"x"===i&&"x"===t&&!s){const e=r.getCurrSlideX(),i=r.x-e,n=a>0,s=!n;if(h>c.min[t]&&n){if(c.min[t]<=this.startPan[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,h)}else if(h<c.max[t]&&s){if(this.startPan[t]<=c.max[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,h)}else if(0!==i){if(i>0)return r.moveTo(Math.max(l,e),!0),!0;if(i<0)return r.moveTo(Math.min(l,e),!0),!0}else this._setPanWithFriction(t,h)}else"y"===t&&(r.isShifted()||c.min.y===c.max.y)||this._setPanWithFriction(t,h);return!1}_getVerticalDragRatio(t){var e,i;return(t-(null!==(e=null===(i=this.pswp.currSlide)||void 0===i?void 0:i.bounds.center.y)&&void 0!==e?e:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(t,e,i){const{currSlide:n}=this.pswp;if(!n)return;const{pan:s,bounds:o}=n;if(o.correctPan(t,e)!==e||i){const n=Math.round(e-s[t]);s[t]+=n*(i||.35)}else s[t]=e}}function Fa(t,e,i){return t.x=(e.x+i.x)/2,t.y=(e.y+i.y)/2,t}class ja{constructor(t){this.gestures=t,this._startPan={x:0,y:0},this._startZoomPoint={x:0,y:0},this._zoomPoint={x:0,y:0},this._wasOverFitZoomLevel=!1,this._startZoomLevel=1}start(){const{currSlide:t}=this.gestures.pswp;t&&(this._startZoomLevel=t.currZoomLevel,wa(this._startPan,t.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){const{p1:t,startP1:e,p2:i,startP2:n,pswp:s}=this.gestures,{currSlide:o}=s;if(!o)return;const r=o.zoomLevels.min,a=o.zoomLevels.max;if(!o.isZoomable()||s.mainScroll.isShifted())return;Fa(this._startZoomPoint,e,n),Fa(this._zoomPoint,t,i);let l=1/xa(e,n)*xa(t,i)*this._startZoomLevel;if(l>o.zoomLevels.initial+o.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=!0),l<r)if(s.options.pinchToClose&&!this._wasOverFitZoomLevel&&this._startZoomLevel<=o.zoomLevels.initial){const t=1-(r-l)/(r/1.2);s.dispatch("pinchClose",{bgOpacity:t}).defaultPrevented||s.applyBgOpacity(t)}else l=r-.15*(r-l);else l>a&&(l=a+.05*(l-a));o.pan.x=this._calculatePanForZoomLevel("x",l),o.pan.y=this._calculatePanForZoomLevel("y",l),o.setZoomLevel(l),o.applyCurrentZoomPan()}end(){const{pswp:t}=this.gestures,{currSlide:e}=t;(!e||e.currZoomLevel<e.zoomLevels.initial)&&!this._wasOverFitZoomLevel&&t.options.pinchToClose?t.close():this.correctZoomPan()}_calculatePanForZoomLevel(t,e){const i=e/this._startZoomLevel;return this._zoomPoint[t]-(this._startZoomPoint[t]-this._startPan[t])*i}correctZoomPan(t){const{pswp:e}=this.gestures,{currSlide:i}=e;if(null==i||!i.isZoomable())return;0===this._zoomPoint.x&&(t=!0);const n=i.currZoomLevel;let s,o=!0;n<i.zoomLevels.initial?s=i.zoomLevels.initial:n>i.zoomLevels.max?s=i.zoomLevels.max:(o=!1,s=n);const r=e.bgOpacity,a=e.bgOpacity<1,l=wa({x:0,y:0},i.pan);let c=wa({x:0,y:0},l);t&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=n,wa(this._startPan,l)),o&&(c={x:this._calculatePanForZoomLevel("x",s),y:this._calculatePanForZoomLevel("y",s)}),i.setZoomLevel(s),c={x:i.bounds.correctPan("x",c.x),y:i.bounds.correctPan("y",c.y)},i.setZoomLevel(n);const h=!ba(c,l);if(!h&&!o&&!a)return i._setResolution(s),void i.applyCurrentZoomPan();e.animations.stopAllPan(),e.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:t=>{if(t/=1e3,h||o){if(h&&(i.pan.x=l.x+(c.x-l.x)*t,i.pan.y=l.y+(c.y-l.y)*t),o){const e=n+(s-n)*t;i.setZoomLevel(e)}i.applyCurrentZoomPan()}a&&e.bgOpacity<1&&e.applyBgOpacity(ka(r+(1-r)*t,0,1))},onComplete:()=>{i._setResolution(s),i.applyCurrentZoomPan()}})}}function Ra(t){return!!t.target.closest(".pswp__container")}class Wa{constructor(t){this.gestures=t}click(t,e){const i=e.target.classList,n=i.contains("pswp__img"),s=i.contains("pswp__item")||i.contains("pswp__zoom-wrap");n?this._doClickOrTapAction("imageClick",t,e):s&&this._doClickOrTapAction("bgClick",t,e)}tap(t,e){Ra(e)&&this._doClickOrTapAction("tap",t,e)}doubleTap(t,e){Ra(e)&&this._doClickOrTapAction("doubleTap",t,e)}_doClickOrTapAction(t,e,i){var n;const{pswp:s}=this.gestures,{currSlide:o}=s,r=t+"Action",a=s.options[r];if(!s.dispatch(r,{point:e,originalEvent:i}).defaultPrevented)if("function"!=typeof a)switch(a){case"close":case"next":s[a]();break;case"zoom":null==o||o.toggleZoom(e);break;case"zoom-or-close":null!=o&&o.isZoomable()&&o.zoomLevels.secondary!==o.zoomLevels.initial?o.toggleZoom(e):s.options.clickToCloseNonZoomable&&s.close();break;case"toggle-controls":null===(n=this.gestures.pswp.element)||void 0===n||n.classList.toggle("pswp--ui-visible")}else a.call(s,e,i)}}class Ua{constructor(t){this.pswp=t,this.dragAxis=null,this.p1={x:0,y:0},this.p2={x:0,y:0},this.prevP1={x:0,y:0},this.prevP2={x:0,y:0},this.startP1={x:0,y:0},this.startP2={x:0,y:0},this.velocity={x:0,y:0},this._lastStartP1={x:0,y:0},this._intervalP1={x:0,y:0},this._numActivePoints=0,this._ongoingPointers=[],this._touchEventEnabled="ontouchstart"in window,this._pointerEventEnabled=!!window.PointerEvent,this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1,this._numActivePoints=0,this._intervalTime=0,this._velocityCalculated=!1,this.isMultitouch=!1,this.isDragging=!1,this.isZooming=!1,this.raf=null,this._tapTimer=null,this.supportsTouch||(t.options.allowPanToNext=!1),this.drag=new Va(this),this.zoomLevels=new ja(this),this.tapHandler=new Wa(this),t.on("bindEvents",(()=>{t.events.add(t.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),t.scrollWrap&&(t.scrollWrap.ontouchmove=()=>{},t.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")}))}_bindEvents(t,e,i,n){const{pswp:s}=this,{events:o}=s,r=n?t+n:"";o.add(s.scrollWrap,t+e,this.onPointerDown.bind(this)),o.add(window,t+"move",this.onPointerMove.bind(this)),o.add(window,t+i,this.onPointerUp.bind(this)),r&&o.add(s.scrollWrap,r,this.onPointerUp.bind(this))}onPointerDown(t){const e="mousedown"===t.type||"mouse"===t.pointerType;if(e&&t.button>0)return;const{pswp:i}=this;i.opener.isOpen?i.dispatch("pointerDown",{originalEvent:t}).defaultPrevented||(e&&(i.mouseDetected(),this._preventPointerEventBehaviour(t,"down")),i.animations.stopAll(),this._updatePoints(t,"down"),1===this._numActivePoints&&(this.dragAxis=null,wa(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1):t.preventDefault()}onPointerMove(t){this._preventPointerEventBehaviour(t,"move"),this._numActivePoints&&(this._updatePoints(t,"move"),this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented||(1!==this._numActivePoints||this.isDragging?this._numActivePoints>1&&!this.isZooming&&(this._finishDrag(),this.isZooming=!0,this._updateStartPoints(),this.zoomLevels.start(),this._rafStopLoop(),this._rafRenderLoop()):(this.dragAxis||this._calculateDragDirection(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this._clearTapTimer(),this._updateStartPoints(),this._intervalTime=Date.now(),this._velocityCalculated=!1,wa(this._intervalP1,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this._rafStopLoop(),this._rafRenderLoop()))))}_finishDrag(){this.isDragging&&(this.isDragging=!1,this._velocityCalculated||this._updateVelocity(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(t){this._numActivePoints&&(this._updatePoints(t,"up"),this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented||(0===this._numActivePoints&&(this._rafStopLoop(),this.isDragging?this._finishDrag():this.isZooming||this.isMultitouch||this._finishTap(t)),this._numActivePoints<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),1===this._numActivePoints&&(this.dragAxis=null,this._updateStartPoints()))))}_rafRenderLoop(){(this.isDragging||this.isZooming)&&(this._updateVelocity(),this.isDragging?ba(this.p1,this.prevP1)||this.drag.change():ba(this.p1,this.prevP1)&&ba(this.p2,this.prevP2)||this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(t){const e=Date.now(),i=e-this._intervalTime;i<50&&!t||(this.velocity.x=this._getVelocity("x",i),this.velocity.y=this._getVelocity("y",i),this._intervalTime=e,wa(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(t){const{mainScroll:e}=this.pswp;if(e.isShifted())return void e.moveIndexBy(0,!0);if(t.type.indexOf("cancel")>0)return;if("mouseup"===t.type||"mouse"===t.pointerType)return void this.tapHandler.click(this.startP1,t);const i=this.pswp.options.doubleTapAction?300:0;this._tapTimer?(this._clearTapTimer(),xa(this._lastStartP1,this.startP1)<25&&this.tapHandler.doubleTap(this.startP1,t)):(wa(this._lastStartP1,this.startP1),this._tapTimer=setTimeout((()=>{this.tapHandler.tap(this.startP1,t),this._clearTapTimer()}),i))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(t,e){const i=this.p1[t]-this._intervalP1[t];return Math.abs(i)>1&&e>5?i/e:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(t,e){this.pswp.applyFilters("preventPointerEvent",!0,t,e)&&t.preventDefault()}_updatePoints(t,e){if(this._pointerEventEnabled){const i=t,n=this._ongoingPointers.findIndex((t=>t.id===i.pointerId));"up"===e&&n>-1?this._ongoingPointers.splice(n,1):"down"===e&&-1===n?this._ongoingPointers.push(this._convertEventPosToPoint(i,{x:0,y:0})):n>-1&&this._convertEventPosToPoint(i,this._ongoingPointers[n]),this._numActivePoints=this._ongoingPointers.length,this._numActivePoints>0&&wa(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&wa(this.p2,this._ongoingPointers[1])}else{const i=t;this._numActivePoints=0,i.type.indexOf("touch")>-1?i.touches&&i.touches.length>0&&(this._convertEventPosToPoint(i.touches[0],this.p1),this._numActivePoints++,i.touches.length>1&&(this._convertEventPosToPoint(i.touches[1],this.p2),this._numActivePoints++)):(this._convertEventPosToPoint(t,this.p1),"up"===e?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){wa(this.prevP1,this.p1),wa(this.prevP2,this.p2)}_updateStartPoints(){wa(this.startP1,this.p1),wa(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(0!==t){const e=t>0?"x":"y";Math.abs(this.p1[e]-this.startP1[e])>=10&&(this.dragAxis=e)}}}_convertEventPosToPoint(t,e){return e.x=t.pageX-this.pswp.offset.x,e.y=t.pageY-this.pswp.offset.y,"pointerId"in t?e.id=t.pointerId:void 0!==t.identifier&&(e.id=t.identifier),e}_onClick(t){this.pswp.mainScroll.isShifted()&&(t.preventDefault(),t.stopPropagation())}}class qa{constructor(t){this.pswp=t,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(t){const{pswp:e}=this,i=Math.round(e.viewportSize.x+e.viewportSize.x*e.options.spacing),n=i!==this.slideWidth;n&&(this.slideWidth=i,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach(((e,i)=>{n&&Sa(e.el,(i+this._containerShiftIndex)*this.slideWidth),t&&e.slide&&e.slide.resize()}))}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let t=0;t<3;t++){const e=va("pswp__item","div",this.pswp.container);e.setAttribute("role","group"),e.setAttribute("aria-roledescription","slide"),e.setAttribute("aria-hidden","true"),e.style.display=1===t?"block":"none",this.itemHolders.push({el:e})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(t,e,i){const{pswp:n}=this;let s=n.potentialIndex+t;const o=n.getNumItems();if(n.canLoop()){s=n.getLoopedIndex(s);const e=(t+o)%o;t=e<=o/2?e:e-o}else s<0?s=0:s>=o&&(s=o-1),t=s-n.potentialIndex;n.potentialIndex=s,this._currPositionIndex-=t,n.animations.stopMainScroll();const r=this.getCurrSlideX();if(e){n.animations.startSpring({isMainScroll:!0,start:this.x,end:r,velocity:i||0,naturalFrequency:30,dampingRatio:1,onUpdate:t=>{this.moveTo(t)},onComplete:()=>{this.updateCurrItem(),n.appendHeavy()}});let t=n.potentialIndex-n.currIndex;if(n.canLoop()){const e=(t+o)%o;t=e<=o/2?e:e-o}Math.abs(t)>1&&this.updateCurrItem()}else this.moveTo(r),this.updateCurrItem();return Boolean(t)}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var t;const{pswp:e}=this,i=this._prevPositionIndex-this._currPositionIndex;if(!i)return;this._prevPositionIndex=this._currPositionIndex,e.currIndex=e.potentialIndex;let n,s=Math.abs(i);s>=3&&(this._containerShiftIndex+=i+(i>0?-3:3),s=3);for(let t=0;t<s;t++)i>0?(n=this.itemHolders.shift(),n&&(this.itemHolders[2]=n,this._containerShiftIndex++,Sa(n.el,(this._containerShiftIndex+2)*this.slideWidth),e.setContent(n,e.currIndex-s+t+2))):(n=this.itemHolders.pop(),n&&(this.itemHolders.unshift(n),this._containerShiftIndex--,Sa(n.el,this._containerShiftIndex*this.slideWidth),e.setContent(n,e.currIndex+s-t-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),e.animations.stopAllPan(),this.itemHolders.forEach(((t,e)=>{t.slide&&t.slide.setIsActive(1===e)})),e.currSlide=null===(t=this.itemHolders[1])||void 0===t?void 0:t.slide,e.contentLoader.updateLazy(i),e.currSlide&&e.currSlide.applyCurrentZoomPan(),e.dispatch("change")}moveTo(t,e){if(!this.pswp.canLoop()&&e){let e=(this.slideWidth*this._currPositionIndex-t)/this.slideWidth;e+=this.pswp.currIndex;const i=Math.round(t-this.x);(e<0&&i>0||e>=this.pswp.getNumItems()-1&&i<0)&&(t=this.x+.35*i)}this.x=t,this.pswp.container&&Sa(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:null!=e&&e})}}const Ka={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},Ga=(t,e)=>e?t:Ka[t];class Xa{constructor(t){this.pswp=t,this._wasFocused=!1,t.on("bindEvents",(()=>{t.options.trapFocus&&(t.options.initialPointerPos||this._focusRoot(),t.events.add(document,"focusin",this._onFocusIn.bind(this))),t.events.add(document,"keydown",this._onKeyDown.bind(this))}));const e=document.activeElement;t.on("destroy",(()=>{t.options.returnFocus&&e&&this._wasFocused&&e.focus()}))}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(t){const{pswp:e}=this;if(e.dispatch("keydown",{originalEvent:t}).defaultPrevented)return;if(function(t){return"button"in t&&1===t.button||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}(t))return;let i,n,s=!1;const o="key"in t;switch(o?t.key:t.keyCode){case Ga("Escape",o):e.options.escKey&&(i="close");break;case Ga("z",o):i="toggleZoom";break;case Ga("ArrowLeft",o):n="x";break;case Ga("ArrowUp",o):n="y";break;case Ga("ArrowRight",o):n="x",s=!0;break;case Ga("ArrowDown",o):s=!0,n="y";break;case Ga("Tab",o):this._focusRoot()}if(n){t.preventDefault();const{currSlide:o}=e;e.options.arrowKeys&&"x"===n&&e.getNumItems()>1?i=s?"next":"prev":o&&o.currZoomLevel>o.zoomLevels.fit&&(o.pan[n]+=s?-80:80,o.panTo(o.pan.x,o.pan.y))}i&&(t.preventDefault(),e[i]())}_onFocusIn(t){const{template:e}=this.pswp;e&&document!==t.target&&e!==t.target&&!e.contains(t.target)&&e.focus()}}const Ja="cubic-bezier(.4,0,.22,1)";class Ya{constructor(t){var e;this.props=t;const{target:i,onComplete:n,transform:s,onFinish:o=(()=>{}),duration:r=333,easing:a=Ja}=t;this.onFinish=o;const l=s?"transform":"opacity",c=null!==(e=t[l])&&void 0!==e?e:"";this._target=i,this._onComplete=n,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout((()=>{Ca(i,l,r,a),this._helperTimeout=setTimeout((()=>{i.addEventListener("transitionend",this._onTransitionEnd,!1),i.addEventListener("transitioncancel",this._onTransitionEnd,!1),this._helperTimeout=setTimeout((()=>{this._finalizeAnimation()}),r+500),i.style[l]=c}),30)}),0)}_onTransitionEnd(t){t.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),Ca(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}class Qa{constructor(t,e,i){this.velocity=1e3*t,this._dampingRatio=e||.75,this._naturalFrequency=i||12,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(t,e){let i,n=0;e/=1e3;const s=Math.E**(-this._dampingRatio*this._naturalFrequency*e);if(1===this._dampingRatio)i=this.velocity+this._naturalFrequency*t,n=(t+i*e)*s,this.velocity=n*-this._naturalFrequency+i*s;else if(this._dampingRatio<1){i=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*t+this.velocity);const o=Math.cos(this._dampedFrequency*e),r=Math.sin(this._dampedFrequency*e);n=s*(t*o+i*r),this.velocity=n*-this._naturalFrequency*this._dampingRatio+s*(-this._dampedFrequency*t*r+this._dampedFrequency*i*o)}return n}}class tl{constructor(t){this.props=t,this._raf=0;const{start:e,end:i,velocity:n,onUpdate:s,onComplete:o,onFinish:r=(()=>{}),dampingRatio:a,naturalFrequency:l}=t;this.onFinish=r;const c=new Qa(n,a,l);let h=Date.now(),d=e-i;const p=()=>{this._raf&&(d=c.easeFrame(d,Date.now()-h),Math.abs(d)<1&&Math.abs(c.velocity)<50?(s(i),o&&o(),this.onFinish()):(h=Date.now(),s(d+i),this._raf=requestAnimationFrame(p)))};this._raf=requestAnimationFrame(p)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class el{constructor(){this.activeAnimations=[]}startSpring(t){this._start(t,!0)}startTransition(t){this._start(t)}_start(t,e){const i=e?new tl(t):new Ya(t);return this.activeAnimations.push(i),i.onFinish=()=>this.stop(i),i}stop(t){t.destroy();const e=this.activeAnimations.indexOf(t);e>-1&&this.activeAnimations.splice(e,1)}stopAll(){this.activeAnimations.forEach((t=>{t.destroy()})),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isPan||(t.destroy(),!1)))}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isMainScroll||(t.destroy(),!1)))}isPanRunning(){return this.activeAnimations.some((t=>t.props.isPan))}}class il{constructor(t){this.pswp=t,t.events.add(t.element,"wheel",this._onWheel.bind(this))}_onWheel(t){t.preventDefault();const{currSlide:e}=this.pswp;let{deltaX:i,deltaY:n}=t;if(e&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(e.isZoomable()){let i=-n;1===t.deltaMode?i*=.05:i*=t.deltaMode?1:.002,i=2**i;const s=e.currZoomLevel*i;e.zoomTo(s,{x:t.clientX,y:t.clientY})}}else e.isPannable()&&(1===t.deltaMode&&(i*=18,n*=18),e.panTo(e.pan.x-i,e.pan.y-n))}}class nl{constructor(t,e){var i;const n=e.name||e.className;let s=e.html;if(!1===t.options[n])return;"string"==typeof t.options[n+"SVG"]&&(s=t.options[n+"SVG"]),t.dispatch("uiElementCreate",{data:e});let o="";e.isButton?(o+="pswp__button ",o+=e.className||`pswp__button--${e.name}`):o+=e.className||`pswp__${e.name}`;let r=e.isButton?e.tagName||"button":e.tagName||"div";r=r.toLowerCase();const a=va(o,r);if(e.isButton){"button"===r&&(a.type="button");let{title:i}=e;const{ariaLabel:s}=e;"string"==typeof t.options[n+"Title"]&&(i=t.options[n+"Title"]),i&&(a.title=i);const o=s||i;o&&a.setAttribute("aria-label",o)}a.innerHTML=function(t){if("string"==typeof t)return t;if(!t||!t.isCustomSVG)return"";const e=t;let i='<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';return i=i.split("%d").join(e.size||32),e.outlineID&&(i+='<use class="pswp__icn-shadow" xlink:href="#'+e.outlineID+'"/>'),i+=e.inner,i+="</svg>",i}(s),e.onInit&&e.onInit(a,t),e.onClick&&(a.onclick=i=>{"string"==typeof e.onClick?t[e.onClick]():"function"==typeof e.onClick&&e.onClick(i,a,t)});const l=e.appendTo||"bar";let c=t.element;"bar"===l?(t.topBar||(t.topBar=va("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap)),c=t.topBar):(a.classList.add("pswp__hide-on-close"),"wrapper"===l&&(c=t.scrollWrap)),null===(i=c)||void 0===i||i.appendChild(t.applyFilters("uiElement",a,e))}}function sl(t,e,i){t.classList.add("pswp__button--arrow"),t.setAttribute("aria-controls","pswp__items"),e.on("change",(()=>{e.options.loop||(t.disabled=i?!(e.currIndex<e.getNumItems()-1):!(e.currIndex>0))}))}const ol={name:"arrowPrev",className:"pswp__button--arrow--prev",title:"Previous",order:10,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'<path d="M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z" id="pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"prev",onInit:sl},rl={name:"arrowNext",className:"pswp__button--arrow--next",title:"Next",order:11,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'<use xlink:href="#pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"next",onInit:(t,e)=>{sl(t,e,!0)}},al={name:"close",title:"Close",order:20,isButton:!0,html:{isCustomSVG:!0,inner:'<path d="M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z" id="pswp__icn-close"/>',outlineID:"pswp__icn-close"},onClick:"close"},ll={name:"zoom",title:"Zoom",order:10,isButton:!0,html:{isCustomSVG:!0,inner:'<path d="M17.426 19.926a6 6 0 1 1 1.5-1.5L23 22.5 21.5 24l-4.074-4.074z" id="pswp__icn-zoom"/><path fill="currentColor" class="pswp__zoom-icn-bar-h" d="M11 16v-2h6v2z"/><path fill="currentColor" class="pswp__zoom-icn-bar-v" d="M13 12h2v6h-2z"/>',outlineID:"pswp__icn-zoom"},onClick:"toggleZoom"},cl={name:"preloader",appendTo:"bar",order:7,html:{isCustomSVG:!0,inner:'<path fill-rule="evenodd" clip-rule="evenodd" d="M21.2 16a5.2 5.2 0 1 1-5.2-5.2V8a8 8 0 1 0 8 8h-2.8Z" id="pswp__icn-loading"/>',outlineID:"pswp__icn-loading"},onInit:(t,e)=>{let i,n=null;const s=e=>{var n,s;i!==e&&(i=e,n="active",s=e,t.classList.toggle("pswp__preloader--"+n,s))},o=()=>{var t;if(null===(t=e.currSlide)||void 0===t||!t.content.isLoading())return s(!1),void(n&&(clearTimeout(n),n=null));n||(n=setTimeout((()=>{var t;s(Boolean(null===(t=e.currSlide)||void 0===t?void 0:t.content.isLoading())),n=null}),e.options.preloaderDelay))};e.on("change",o),e.on("loadComplete",(t=>{e.currSlide===t.slide&&o()})),e.ui&&(e.ui.updatePreloaderVisibility=o)}},hl={name:"counter",order:5,onInit:(t,e)=>{e.on("change",(()=>{t.innerText=e.currIndex+1+e.options.indexIndicatorSep+e.getNumItems()}))}};function dl(t,e){t.classList.toggle("pswp--zoomed-in",e)}class pl{constructor(t){this.pswp=t,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){const{pswp:t}=this;this.isRegistered=!1,this.uiElementsData=[al,ol,rl,ll,cl,hl],t.dispatch("uiRegister"),this.uiElementsData.sort(((t,e)=>(t.order||0)-(e.order||0))),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach((t=>{this.registerElement(t)})),t.on("change",(()=>{var e;null===(e=t.element)||void 0===e||e.classList.toggle("pswp--one-slide",1===t.getNumItems())})),t.on("zoomPanUpdate",(()=>this._onZoomPanUpdate()))}registerElement(t){this.isRegistered?this.items.push(new nl(this.pswp,t)):this.uiElementsData.push(t)}_onZoomPanUpdate(){const{template:t,currSlide:e,options:i}=this.pswp;if(this.pswp.opener.isClosing||!t||!e)return;let{currZoomLevel:n}=e;if(this.pswp.opener.isOpen||(n=e.zoomLevels.initial),n===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=n;const s=e.zoomLevels.initial-e.zoomLevels.secondary;if(Math.abs(s)<.01||!e.isZoomable())return dl(t,!1),void t.classList.remove("pswp--zoom-allowed");t.classList.add("pswp--zoom-allowed");dl(t,(n===e.zoomLevels.initial?e.zoomLevels.secondary:e.zoomLevels.initial)<=n),"zoom"!==i.imageClickAction&&"zoom-or-close"!==i.imageClickAction||t.classList.add("pswp--click-to-zoom")}}class ul{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}}class ml{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,e,i=100){var n,s,o;this._filters[t]||(this._filters[t]=[]),null===(n=this._filters[t])||void 0===n||n.push({fn:e,priority:i}),null===(s=this._filters[t])||void 0===s||s.sort(((t,e)=>t.priority-e.priority)),null===(o=this.pswp)||void 0===o||o.addFilter(t,e,i)}removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter((t=>t.fn!==e))),this.pswp&&this.pswp.removeFilter(t,e)}applyFilters(t,...e){var i;return null===(i=this._filters[t])||void 0===i||i.forEach((t=>{e[0]=t.fn.apply(this,e)})),e[0]}on(t,e){var i,n;this._listeners[t]||(this._listeners[t]=[]),null===(i=this._listeners[t])||void 0===i||i.push(e),null===(n=this.pswp)||void 0===n||n.on(t,e)}off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter((t=>e!==t))),null===(i=this.pswp)||void 0===i||i.off(t,e)}dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);const n=new ul(t,e);return null===(i=this._listeners[t])||void 0===i||i.forEach((t=>{t.call(this,n)})),n}}class fl{constructor(t,e){if(this.element=va("pswp__img pswp__img--placeholder",t?"img":"div",e),t){const e=this.element;e.decoding="async",e.alt="",e.src=t,e.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,e){this.element&&("IMG"===this.element.tagName?(Ba(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=_a(0,0,t/250)):Ba(this.element,t,e))}destroy(){var t;null!==(t=this.element)&&void 0!==t&&t.parentNode&&this.element.remove(),this.element=null}}class gl{constructor(t,e,i){this.instance=e,this.data=t,this.index=i,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=Ea,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout((()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)}),1e3)}load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){const t=this.placeholder.element;t&&!t.parentElement&&this.slide.container.prepend(t)}else{const t=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new fl(t,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=va("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=va("pswp__content","div"),this.element.innerHTML=this.data.html||""),e&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var e,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const n=this.element;this.updateSrcsetSizes(),this.data.srcset&&(n.srcset=this.data.srcset),n.src=null!==(e=this.data.src)&&void 0!==e?e:"",n.alt=null!==(i=this.data.alt)&&void 0!==i?i:"",this.state=Ta,n.complete?this.onLoaded():(n.onload=()=>{this.onLoaded()},n.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=Ia,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),this.state!==Ia&&this.state!==La||this.removePlaceholder())}onError(){this.state=La,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===Ta,this)}isError(){return this.state===La}isImageContent(){return"image"===this.type}setDisplayedSize(t,e){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,e),!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented&&(Ba(this.element,t,e),this.isImageContent()&&!this.isError()))){const i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=e,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==La,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=this.element,e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=e+"px",t.dataset.largestUsedSize=String(e))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented||(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,e;let i=va("pswp__error-msg","div");i.innerText=null!==(t=null===(e=this.instance.options)||void 0===e?void 0:e.errorMsg)&&void 0!==t?t:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=va("pswp__content pswp__error-msg-container","div"),this.element.appendChild(i),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===La)return void this.displayError();if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||Ma())?(this.isDecoding=!0,this.element.decode().catch((()=>{})).finally((()=>{this.isDecoding=!1,this.appendImage()}))):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){!this.instance.dispatch("contentActivate",{content:this}).defaultPrevented&&this.slide&&(this.isImageContent()&&this.isDecoding&&!Ma()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,this.instance.dispatch("contentRemove",{content:this}).defaultPrevented||(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),this.state!==Ia&&this.state!==La||this.removePlaceholder()))}}function vl(t,e,i){const n=e.createContentFromData(t,i);let s;const{options:o}=e;if(o){let r;s=new Da(o,t,-1),r=e.pswp?e.pswp.viewportSize:za(o,e);const a=Na(o,r,t,i);s.update(n.width,n.height,a)}return n.lazyLoad(),s&&n.setDisplayedSize(Math.ceil(n.width*s.initial),Math.ceil(n.height*s.initial)),n}class wl{constructor(t){this.pswp=t,this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,5),this._cachedItems=[]}updateLazy(t){const{pswp:e}=this;if(e.dispatch("lazyLoad").defaultPrevented)return;const{preload:i}=e.options,n=void 0===t||t>=0;let s;for(s=0;s<=i[1];s++)this.loadSlideByIndex(e.currIndex+(n?s:-s));for(s=1;s<=i[0];s++)this.loadSlideByIndex(e.currIndex+(n?-s:s))}loadSlideByIndex(t){const e=this.pswp.getLoopedIndex(t);let i=this.getContentByIndex(e);i||(i=function(t,e){const i=e.getItemData(t);if(!e.dispatch("lazyLoadSlide",{index:t,itemData:i}).defaultPrevented)return vl(i,e,t)}(e,this.pswp),i&&this.addToCache(i))}getContentBySlide(t){let e=this.getContentByIndex(t.index);return e||(e=this.pswp.createContentFromData(t.data,t.index),this.addToCache(e)),e.setSlide(t),e}addToCache(t){if(this.removeByIndex(t.index),this._cachedItems.push(t),this._cachedItems.length>this.limit){const t=this._cachedItems.findIndex((t=>!t.isAttached&&!t.hasSlide));if(-1!==t){this._cachedItems.splice(t,1)[0].destroy()}}}removeByIndex(t){const e=this._cachedItems.findIndex((e=>e.index===t));-1!==e&&this._cachedItems.splice(e,1)}getContentByIndex(t){return this._cachedItems.find((e=>e.index===t))}destroy(){this._cachedItems.forEach((t=>t.destroy())),this._cachedItems=[]}}class yl extends ml{getNumItems(){var t;let e=0;const i=null===(t=this.options)||void 0===t?void 0:t.dataSource;i&&"length"in i?e=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(e=i.items.length));const n=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",n.numItems,i)}createContentFromData(t,e){return new gl(t,this,e)}getItemData(t){var e;const i=null===(e=this.options)||void 0===e?void 0:e.dataSource;let n={};Array.isArray(i)?n=i[t]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),n=i.items[t]);let s=n;s instanceof Element&&(s=this._domElementToItemData(s));const o=this.dispatch("itemData",{itemData:s||{},index:t});return this.applyFilters("itemData",o.itemData,t)}_getGalleryDOMElements(t){var e,i;return null!==(e=this.options)&&void 0!==e&&e.children||null!==(i=this.options)&&void 0!==i&&i.childSelector?function(t,e,i=document){let n=[];if(t instanceof Element)n=[t];else if(t instanceof NodeList||Array.isArray(t))n=Array.from(t);else{const s="string"==typeof t?t:e;s&&(n=Array.from(i.querySelectorAll(s)))}return n}(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){const e={element:t},i="A"===t.tagName?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset),e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,e.w=e.width,e.h=e.height,i.dataset.pswpType&&(e.type=i.dataset.pswpType);const s=t.querySelector("img");var n;if(s)e.msrc=s.currentSrc||s.src,e.alt=null!==(n=s.getAttribute("alt"))&&void 0!==n?n:"";(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=!0)}return this.applyFilters("domItemData",e,t,i)}lazyLoadData(t,e){return vl(t,this,e)}}const xl=.003;class bl{constructor(t){this.pswp=t,this.isClosed=!0,this.isOpen=!1,this.isClosing=!1,this.isOpening=!1,this._duration=void 0,this._useAnimation=!1,this._croppedZoom=!1,this._animateRootOpacity=!1,this._animateBgOpacity=!1,this._placeholder=void 0,this._opacityElement=void 0,this._cropContainer1=void 0,this._cropContainer2=void 0,this._thumbBounds=void 0,this._prepareOpen=this._prepareOpen.bind(this),t.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;const t=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,t&&t.currZoomLevel*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps(),setTimeout((()=>{this._start()}),this._croppedZoom?30:0)}_prepareOpen(){if(this.pswp.off("firstZoomPan",this._prepareOpen),!this.isOpening){const t=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,t&&t.zoomLevels.initial*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){const{pswp:t}=this,e=this.pswp.currSlide,{options:i}=t;var n,s;("fade"===i.showHideAnimationType?(i.showHideOpacity=!0,this._thumbBounds=void 0):"none"===i.showHideAnimationType?(i.showHideOpacity=!1,this._duration=0,this._thumbBounds=void 0):this.isOpening&&t._initialThumbBounds?this._thumbBounds=t._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=null==e?void 0:e.getPlaceholderElement(),t.animations.stopAll(),this._useAnimation=Boolean(this._duration&&this._duration>50),this._animateZoom=Boolean(this._thumbBounds)&&(null==e?void 0:e.content.usePlaceholder())&&(!this.isClosing||!t.mainScroll.isShifted()),this._animateZoom)?this._animateRootOpacity=null!==(n=i.showHideOpacity)&&void 0!==n&&n:(this._animateRootOpacity=!0,this.isOpening&&e&&(e.zoomAndPanToInitial(),e.applyCurrentZoomPan()));if(this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>xl,this._opacityElement=this._animateRootOpacity?t.element:t.bg,!this._useAnimation)return this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,void(this.isOpening&&(t.element&&(t.element.style.opacity=String(xl)),t.applyBgOpacity(1)));this._animateZoom&&this._thumbBounds&&this._thumbBounds.innerRect?(this._croppedZoom=!0,this._cropContainer1=this.pswp.container,this._cropContainer2=null===(s=this.pswp.currSlide)||void 0===s?void 0:s.holderElement,t.container&&(t.container.style.overflow="hidden",t.container.style.width=t.viewportSize.x+"px")):this._croppedZoom=!1;this.isOpening?(this._animateRootOpacity?(t.element&&(t.element.style.opacity=String(xl)),t.applyBgOpacity(1)):(this._animateBgOpacity&&t.bg&&(t.bg.style.opacity=String(xl)),t.element&&(t.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(xl)))):this.isClosing&&(t.mainScroll.itemHolders[0]&&(t.mainScroll.itemHolders[0].el.style.display="none"),t.mainScroll.itemHolders[2]&&(t.mainScroll.itemHolders[2].el.style.display="none"),this._croppedZoom&&0!==t.mainScroll.x&&(t.mainScroll.resetPosition(),t.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&"IMG"===this._placeholder.tagName?new Promise((t=>{let e=!1,i=!0;var n;(n=this._placeholder,"decode"in n?n.decode().catch((()=>{})):n.complete?Promise.resolve(n):new Promise(((t,e)=>{n.onload=()=>t(n),n.onerror=e}))).finally((()=>{e=!0,i||t(!0)})),setTimeout((()=>{i=!1,e&&t(!0)}),50),setTimeout(t,250)})).finally((()=>this._initiate())):this._initiate()}_initiate(){var t,e;null===(t=this.pswp.element)||void 0===t||t.style.setProperty("--pswp-transition-duration",this._duration+"ms"),this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),null===(e=this.pswp.element)||void 0===e||e.classList.toggle("pswp--ui-visible",this.isOpening),this.isOpening?(this._placeholder&&(this._placeholder.style.opacity="1"),this._animateToOpenState()):this.isClosing&&this._animateToClosedState(),this._useAnimation||this._onAnimationComplete()}_onAnimationComplete(){const{pswp:t}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,t.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd"),t.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed)t.destroy();else if(this.isOpen){var e;this._animateZoom&&t.container&&(t.container.style.overflow="visible",t.container.style.width="100%"),null===(e=t.currSlide)||void 0===e||e.applyCurrentZoomPan()}}_animateToOpenState(){const{pswp:t}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)"),this._animateTo(this._cropContainer2,"transform","none")),t.currSlide&&(t.currSlide.zoomAndPanToInitial(),this._animateTo(t.currSlide.container,"transform",t.currSlide.getCurrentTransform()))),this._animateBgOpacity&&t.bg&&this._animateTo(t.bg,"opacity",String(t.options.bgOpacity)),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","1")}_animateToClosedState(){const{pswp:t}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&t.bgOpacity>.01&&t.bg&&this._animateTo(t.bg,"opacity","0"),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","0")}_setClosedStateZoomPan(t){if(!this._thumbBounds)return;const{pswp:e}=this,{innerRect:i}=this._thumbBounds,{currSlide:n,viewportSize:s}=e;if(this._croppedZoom&&i&&this._cropContainer1&&this._cropContainer2){const e=-s.x+(this._thumbBounds.x-i.x)+i.w,n=-s.y+(this._thumbBounds.y-i.y)+i.h,o=s.x-i.w,r=s.y-i.h;t?(this._animateTo(this._cropContainer1,"transform",_a(e,n)),this._animateTo(this._cropContainer2,"transform",_a(o,r))):(Sa(this._cropContainer1,e,n),Sa(this._cropContainer2,o,r))}n&&(wa(n.pan,i||this._thumbBounds),n.currZoomLevel=this._thumbBounds.w/n.width,t?this._animateTo(n.container,"transform",n.getCurrentTransform()):n.applyCurrentZoomPan())}_animateTo(t,e,i){if(!this._duration)return void(t.style[e]=i);const{animations:n}=this.pswp,s={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{n.activeAnimations.length||this._onAnimationComplete()},target:t};s[e]=i,n.startTransition(s)}}const kl={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,maxWidthToAnimate:4e3,clickToCloseNonZoomable:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:"The image cannot be loaded",preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"};class _l extends yl{constructor(t){super(),this.options=this._prepareOptions(t||{}),this.offset={x:0,y:0},this._prevViewportSize={x:0,y:0},this.viewportSize={x:0,y:0},this.bgOpacity=1,this.currIndex=0,this.potentialIndex=0,this.isOpen=!1,this.isDestroying=!1,this.hasMouse=!1,this._initialItemData={},this._initialThumbBounds=void 0,this.topBar=void 0,this.element=void 0,this.template=void 0,this.container=void 0,this.scrollWrap=void 0,this.currSlide=void 0,this.events=new Oa,this.animations=new el,this.mainScroll=new qa(this),this.gestures=new Ua(this),this.opener=new bl(this),this.keyboard=new Xa(this),this.contentLoader=new wl(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch("init"),this.dispatch("beforeOpen"),this._createMainStructure();let t="pswp--open";return this.gestures.supportsTouch&&(t+=" pswp--touch"),this.options.mainClass&&(t+=" "+this.options.mainClass),this.element&&(this.element.className+=" "+t),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new il(this),(Number.isNaN(this.currIndex)||this.currIndex<0||this.currIndex>=this.getNumItems())&&(this.currIndex=0),this.gestures.supportsTouch||this.mouseDetected(),this.updateSize(),this.offset.y=window.pageYOffset,this._initialItemData=this.getItemData(this.currIndex),this.dispatch("gettingData",{index:this.currIndex,data:this._initialItemData,slide:void 0}),this._initialThumbBounds=this.getThumbBounds(),this.dispatch("initialLayout"),this.on("openingAnimationEnd",(()=>{const{itemHolders:t}=this.mainScroll;t[0]&&(t[0].el.style.display="block",this.setContent(t[0],this.currIndex-1)),t[2]&&(t[2].el.style.display="block",this.setContent(t[2],this.currIndex+1)),this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,"resize",this._handlePageResize.bind(this)),this.events.add(window,"scroll",this._updatePageScrollOffset.bind(this)),this.dispatch("bindEvents")})),this.mainScroll.itemHolders[1]&&this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch("change"),this.opener.open(),this.dispatch("afterInit"),!0}getLoopedIndex(t){const e=this.getNumItems();return this.options.loop&&(t>e-1&&(t-=e),t<0&&(t+=e)),ka(t,0,e-1)}appendHeavy(){this.mainScroll.itemHolders.forEach((t=>{var e;null===(e=t.slide)||void 0===e||e.appendHeavy()}))}goTo(t){this.mainScroll.moveIndexBy(this.getLoopedIndex(t)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...t){var e;null===(e=this.currSlide)||void 0===e||e.zoomTo(...t)}toggleZoom(){var t;null===(t=this.currSlide)||void 0===t||t.toggleZoom()}close(){this.opener.isOpen&&!this.isDestroying&&(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){var t;if(!this.isDestroying)return this.options.showHideAnimationType="none",void this.close();this.dispatch("destroy"),this._listeners={},this.scrollWrap&&(this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null),null===(t=this.element)||void 0===t||t.remove(),this.mainScroll.itemHolders.forEach((t=>{var e;null===(e=t.slide)||void 0===e||e.destroy()})),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(t){this.contentLoader.removeByIndex(t),this.mainScroll.itemHolders.forEach(((e,i)=>{var n,s;let o=(null!==(n=null===(s=this.currSlide)||void 0===s?void 0:s.index)&&void 0!==n?n:0)-1+i;var r;(this.canLoop()&&(o=this.getLoopedIndex(o)),o===t)&&(this.setContent(e,t,!0),1===i&&(this.currSlide=e.slide,null===(r=e.slide)||void 0===r||r.setIsActive(!0)))})),this.dispatch("change")}setContent(t,e,i){if(this.canLoop()&&(e=this.getLoopedIndex(e)),t.slide){if(t.slide.index===e&&!i)return;t.slide.destroy(),t.slide=void 0}if(!this.canLoop()&&(e<0||e>=this.getNumItems()))return;const n=this.getItemData(e);t.slide=new $a(n,e,this),e===this.currIndex&&(this.currSlide=t.slide),t.slide.append(t.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(t){if(this.isDestroying)return;const e=za(this.options,this);!t&&ba(e,this._prevViewportSize)||(wa(this._prevViewportSize,e),this.dispatch("beforeResize"),wa(this.viewportSize,this._prevViewportSize),this._updatePageScrollOffset(),this.dispatch("viewportSize"),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected(),this.dispatch("resize"))}applyBgOpacity(t){this.bgOpacity=Math.max(t,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){var t;this.hasMouse||(this.hasMouse=!0,null===(t=this.element)||void 0===t||t.classList.add("pswp--has_mouse"))}_handlePageResize(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout((()=>{this.updateSize()}),500)}_updatePageScrollOffset(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(t,e){this.offset.x=t,this.offset.y=e,this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=va("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=va("pswp__bg","div",this.element),this.scrollWrap=va("pswp__scroll-wrap","section",this.element),this.container=va("pswp__container","div",this.scrollWrap),this.scrollWrap.setAttribute("aria-roledescription","carousel"),this.container.setAttribute("aria-live","off"),this.container.setAttribute("id","pswp__items"),this.mainScroll.appendHolders(),this.ui=new pl(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return function(t,e,i){const n=i.dispatch("thumbBounds",{index:t,itemData:e,instance:i});if(n.thumbBounds)return n.thumbBounds;const{element:s}=e;let o,r;if(s&&!1!==i.options.thumbSelector){const t=i.options.thumbSelector||"img";r=s.matches(t)?s:s.querySelector(t)}return r=i.applyFilters("thumbEl",r,e,t),r&&(o=e.thumbCropped?function(t,e,i){const n=t.getBoundingClientRect(),s=n.width/e,o=n.height/i,r=s>o?s:o,a=(n.width-e*r)/2,l=(n.height-i*r)/2,c={x:n.left+a,y:n.top+l,w:e*r};return c.innerRect={w:n.width,h:n.height,x:a,y:l},c}(r,e.width||e.w||0,e.height||e.h||0):function(t){const e=t.getBoundingClientRect();return{x:e.left,y:e.top,w:e.width}}(r)),i.applyFilters("thumbBounds",o,e,t)}(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(t){return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(t.showHideAnimationType="none",t.zoomAnimationDuration=0),{...kl,...t}}}function Sl(t,e){const i=e.getEditor();if(!i)return;const n=e.getContainer(),s=t.closest(".lake-resizer").find(".lake-resizer-info"),o=t.attr("class").indexOf("-right")>=0,r=n.width(),a=n.height()/r;let l=0,c=0;const h=t=>{const e=t.clientX-l,i=Math.round(o?c+e:c-e),r=Math.round(a*i);n.css({width:`${i}px`,height:`${r}px`}),s.text(`${i} x ${r}`)};t.on("pointerdown",(e=>{const i=e;t.get(0).setPointerCapture(i.pointerId),l=i.clientX,c=n.width(),s.show(),t.on("pointermove",h)})),t.on("pointerup",(()=>{t.off("pointermove"),s.hide(),c=e.getContainer().width();const n=Math.round(a*c);e.updateValue({width:c,height:n}),i.history.save()})),t.on("pointercancel",(()=>{t.off("pointermove"),s.hide()}))}function Al(t){return Qr(this,void 0,void 0,(function*(){const e=I("<img />");return e.css({position:"absolute",top:"0",left:"-8888px","z-index":"-1",visibility:"hidden"}),new Promise((i=>{e.on("load",(()=>{const t=e.get(0),n=t.width,s=t.height;e.remove(),e.removeAttr("style"),i({node:e,width:n,height:s})})),e.on("error",(()=>{e.remove(),i({node:e})})),e.attr("src",t),I(document.body).append(e)}))}))}function Cl(t,e){return Qr(this,void 0,void 0,(function*(){const i=e.value;e.getContainer().css({width:"",height:""});const s=I(a`
28
28
  <div class="lake-button-group">
29
- <button type="button" tabindex="-1" class="lake-button-remove" title="${Ri.image.remove()}"></button>
29
+ <button type="button" tabindex="-1" class="lake-button-remove" title="${$r.image.remove()}"></button>
30
30
  </div>
31
31
  `),o=s.find(".lake-button-remove"),r=n.get("remove");r&&o.append(r);const l=I(a`
32
32
  <div class="lake-error">
33
33
  <div class="lake-error-icon"></div>
34
34
  <div class="lake-error-name">${i.name||""}</div>
35
35
  </div>
36
- `),h=n.get("image");h&&l.find(".lake-error-icon").append(h),t.append(s),t.append(l)}))}const Es={type:"inline",name:"image",render:t=>{const e=t.getEditor();if(!e)return;const i=t.value,s=t.getContainer();if(i.width&&i.height&&0===s.find(".lake-progress").length){s.css({width:`${i.width}px`,height:`${i.height}px`}),s.empty();const t=I('<div class="lake-image-placeholder" />');s.append(t);const e=n.get("image");e&&t.append(e)}if(0===s.first().length&&s.append("<div />"),"loading"===i.status)return;const o=I('<div class="lake-image" />');let r;o.addClass(`lake-image-${i.status}`),r="uploading"===i.status?function(t,e){return nn(this,void 0,void 0,(function*(){const i=e.getEditor();if(!i)return;const s=e.value,o=yield Ts(s.url);if(!o.width||!o.height)return void(yield Is(t,e));const r=i.container.innerWidth()-2,l=o.width<r?o.width:r,h=Math.round(l*o.height/o.width);e.updateValue({width:l,height:h,originalWidth:o.width,originalHeight:o.height}),e.getContainer().css({width:`${l}px`,height:`${h}px`});const c=I(a`
36
+ `),c=n.get("image");c&&l.find(".lake-error-icon").append(c),t.append(s),t.append(l)}))}const Bl={type:"inline",name:"image",render:t=>{const e=t.getEditor();if(!e)return;const i=t.value,s=t.getContainer();if(i.width&&i.height&&0===s.find(".lake-progress").length){s.css({width:`${i.width}px`,height:`${i.height}px`}),s.empty();const t=I('<div class="lake-image-placeholder" />');s.append(t);const e=n.get("image");e&&t.append(e)}if(0===s.first().length&&s.append("<div />"),"loading"===i.status)return;const o=I('<div class="lake-image" />');let r;o.addClass(`lake-image-${i.status}`),r="uploading"===i.status?function(t,e){return Qr(this,void 0,void 0,(function*(){const i=e.getEditor();if(!i)return;const s=e.value,o=yield Al(s.url);if(!o.width||!o.height)return void(yield Cl(t,e));const r=i.container.innerWidth()-2,l=o.width<r?o.width:r,c=Math.round(l*o.height/o.width);e.updateValue({width:l,height:c,originalWidth:o.width,originalHeight:o.height}),e.getContainer().css({width:`${l}px`,height:`${c}px`});const h=I(a`
37
37
  <div class="lake-button-group">
38
- <button type="button" tabindex="-1" class="lake-button-remove" title="${Ri.image.remove()}"></button>
38
+ <button type="button" tabindex="-1" class="lake-button-remove" title="${$r.image.remove()}"></button>
39
39
  </div>
40
- `),d=c.find(".lake-button-remove"),p=n.get("remove");p&&d.append(p);const u=I(a`
40
+ `),d=h.find(".lake-button-remove"),p=n.get("remove");p&&d.append(p);const u=I(a`
41
41
  <div class="lake-progress">
42
42
  <div class="lake-percent">${Math.round(s.percent||0)} %</div>
43
43
  </div>
44
- `);l<80&&u.find(".lake-percent").hide();const m=n.get("circleNotch");m&&u.prepend(m);const f=o.node;o.node.addClass("lake-image-img"),f.attr({draggable:"false",alt:s.name}),t.append(c),t.append(u),t.append(f)}))}(o,t):"error"===i.status?Is(o,t):function(t,e){return nn(this,void 0,void 0,(function*(){const i=e.getEditor();if(!i)return;const s=e.value,o=yield Ts(s.url);if(!o.width||!o.height)return void(yield Is(t,e));let r=s.width,l=s.height;if(!r||!l){const t=i.container.innerWidth()-2;r=Math.round(o.width<t?o.width:t),l=Math.round(r*o.height/o.width),e.updateValue({width:r,height:l})}e.getContainer().css({width:`${r}px`,height:`${l}px`});const h=I(a`
44
+ `);l<80&&u.find(".lake-percent").hide();const m=n.get("circleNotch");m&&u.prepend(m);const f=o.node;o.node.addClass("lake-image-img"),f.attr({draggable:"false",alt:s.name}),t.append(h),t.append(u),t.append(f)}))}(o,t):"error"===i.status?Cl(o,t):function(t,e){return Qr(this,void 0,void 0,(function*(){const i=e.getEditor();if(!i)return;const s=e.value,o=yield Al(s.url);if(!o.width||!o.height)return void(yield Cl(t,e));let r=s.width,l=s.height;if(!r||!l){const t=i.container.innerWidth()-2;r=Math.round(o.width<t?o.width:t),l=Math.round(r*o.height/o.width),e.updateValue({width:r,height:l})}e.getContainer().css({width:`${r}px`,height:`${l}px`});const c=I(a`
45
45
  <div class="lake-button-group">
46
- <button type="button" tabindex="-1" class="lake-button-view" title="${Ri.image.view()}"></button>
47
- <button type="button" tabindex="-1" class="lake-button-remove" title="${Ri.image.remove()}"></button>
46
+ <button type="button" tabindex="-1" class="lake-button-view" title="${$r.image.view()}"></button>
47
+ <button type="button" tabindex="-1" class="lake-button-remove" title="${$r.image.remove()}"></button>
48
48
  </div>
49
- `),c=h.find(".lake-button-view"),d=n.get("maximize");d&&c.append(d),(r<80||null===xn)&&c.hide();const p=h.find(".lake-button-remove"),u=n.get("remove");u&&p.append(u);const m=I(a`
49
+ `),h=c.find(".lake-button-view"),d=n.get("maximize");d&&h.append(d),(r<80||null===ga)&&h.hide();const p=c.find(".lake-button-remove"),u=n.get("remove");u&&p.append(u);const m=I(a`
50
50
  <div class="lake-resizer">
51
51
  <div class="lake-resizer-top-left"></div>
52
52
  <div class="lake-resizer-top-right"></div>
@@ -54,21 +54,21 @@ function sn(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i
54
54
  <div class="lake-resizer-bottom-right"></div>
55
55
  <div class="lake-resizer-info">${r} x ${l}</div>
56
56
  </div>
57
- `),f=o.node;f.addClass("lake-image-img"),f.attr({draggable:"false",alt:s.name}),Ls(m.find(".lake-resizer-top-left"),e),Ls(m.find(".lake-resizer-top-right"),e),Ls(m.find(".lake-resizer-bottom-left"),e),Ls(m.find(".lake-resizer-bottom-right"),e),t.append(h),t.append(m),t.append(f)}))}(o,t),r.then((()=>{s.empty(),s.append(o),o.find(".lake-button-view").on("click",(()=>function(t){const e=t.getEditor();if(!e)return;const i=[];let s=0;const o=e.container.find('lake-box[name="image"]');o.each(((e,n)=>{const o=new Qt(e),r=o.value;"done"===r.status&&(i.push({id:n,src:r.originalUrl||r.url,width:r.originalWidth||r.width,height:r.originalHeight||r.height,alt:r.name}),t.node.id===o.node.id&&(s=n))}));const r=new xn({pswpModule:Bs,dataSource:i,mainClass:"lake-pswp",zoom:!1,arrowPrevSVG:n.get("left"),arrowNextSVG:n.get("right"),closeSVG:n.get("close"),arrowPrevTitle:Ri.image.previous(),arrowNextTitle:Ri.image.next(),closeTitle:Ri.image.close(),errorMsg:Ri.image.loadingError()});r.on("uiRegister",(()=>{const t=r.pswp;t.ui.registerElement({name:"zoom-out-button",order:8,isButton:!0,title:Ri.image.zoomOut(),html:n.get("zoomOut"),onClick:()=>{const e=t.currSlide,i=(e.zoomLevels.max-e.zoomLevels.min)/5,n=e.currZoomLevel-i;e.zoomTo(n,void 0,333)}}),t.ui.registerElement({name:"zoom-in-button",order:9,isButton:!0,title:Ri.image.zoomIn(),html:n.get("zoomIn"),onClick:()=>{const e=t.currSlide,i=(e.zoomLevels.max-e.zoomLevels.min)/5,n=e.currZoomLevel+i;e.zoomTo(n,void 0,333)}})})),r.addFilter("thumbEl",((t,e)=>{const i=o.eq(e.id).find(".lake-image-img");return i.length>0?i.get(0):t})),r.addFilter("placeholderSrc",((t,e)=>{const i=o.eq(e.data.id).find(".lake-image-img");return i.length>0?i.attr("src"):t})),r.on("openingAnimationEnd",(()=>{t.event.emit("openfullscreen")})),r.init(),r.loadAndOpen(s)}(t))),o.find(".lake-button-remove").on("click",(e=>{e.stopPropagation(),function(t){const e=t.getEditor();if(!e)return;const i=t.getData("xhr");i&&i.abort(),e.selection.range.selectBox(t.node),e.removeBox(),e.history.save()}(t)})),t.event.emit("render")})),o.on("click",(()=>{e.selection.range.selectBox(t.node)}))},html:t=>{const e=t.node.attr("value");return a`<img src="${t.value.url}" data-lake-value="${e}" />`}},Ms="text",Ps="#cf222e",Zs="#1f2328",zs="#005cc5",Ns="#0a3069",Os="#0550ae",Hs="#24292f",Ds="#24292e",$s="#0550ae",Vs="#57606a",Fs="#0550ae",Rs="#f6f8fa",Ws="#116329";function js(t){const{HighlightStyle:e,tags:i}=t;return e.define([{tag:i.keyword,color:Ps},{tag:[i.name,i.deleted,i.character,i.macroName],color:Zs},{tag:[i.propertyName],color:zs},{tag:[i.processingInstruction,i.string,i.inserted,i.special(i.string)],color:Ns},{tag:[i.function(i.variableName),i.labelName],color:zs},{tag:[i.color,i.constant(i.name),i.standard(i.name)],color:Os},{tag:[i.definition(i.name),i.separator],color:Zs},{tag:[i.className],color:Ds},{tag:[i.number,i.changed,i.annotation,i.modifier,i.self,i.namespace],color:$s},{tag:[i.typeName],color:Hs},{tag:[i.operator,i.operatorKeyword],color:Ps},{tag:[i.url,i.escape,i.regexp,i.link],color:Ws},{tag:[i.meta,i.comment],color:Vs},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.link,textDecoration:"underline"},{tag:i.heading,fontWeight:"bold",color:Fs},{tag:[i.atom,i.bool,i.special(i.variableName)],color:Zs},{tag:i.invalid,color:Rs},{tag:i.strikethrough,textDecoration:"line-through"}])}const Us={type:"block",name:"codeBlock",render:t=>{var e;const i=t.getEditor();if(!i)return;const s=I('<div class="lake-code-block" />'),o=t.getContainer();o.empty(),o.append(s);const r=s.get(0);if(!r)return;const a=window.CodeMirror;if(!a)return s.addClass("lake-code-block-error"),s.text("The code cannot be displayed because window.CodeMirror is not found. Please check if the CodeMirror file is added to this page."),void s.on("click",(()=>{i.selection.range.selectBox(t.node)}));const{EditorState:l,Compartment:h,EditorView:c,keymap:d,history:p,defaultKeymap:u,historyKeymap:m,indentWithTab:f,syntaxHighlighting:g,langItems:v}=a,w=new Map;for(const t of v)w.set(t.value,t);const y=t.value,x=w.get(y.lang),b=new h,k=c.updateListener.of((e=>{var n;e.docChanged&&(n=e.state.doc.toString(),window.setTimeout((()=>{i.isComposing||(t.updateValue("code",n),i.history.save())}),0))})),_=new c({parent:r,doc:null!==(e=y.code)&&void 0!==e?e:"",extensions:[l.readOnly.of(i.readonly),p(),d.of([...u,...m,f]),g(js(a)),b.of(x&&x.component?x.component():[]),k]});s.find('[contenteditable="true"]').attr("tabindex","-1");new _e({root:s,name:"langType",downIcon:n.get("down"),defaultValue:x?y.lang:Ms,tooltip:Ri.codeBlock.langType(),width:"auto",menuType:"list",menuItems:v.map((t=>({value:t.value,text:t.text}))),onSelect:e=>{const n=w.get(e);_.dispatch({effects:b.reconfigure(n&&n.component?n.component():[])}),t.updateValue({lang:e}),i.history.save()}}).render(),t.setData("codeEditor",_),t.useEffect((()=>()=>{_.destroy(),A("CodeMirror destroyed")}))}};const qs=Array.from(x).join(",");function Ks(t){const e=[t];for(const i of t.getWalker())e.push(i);for(const t of e)"div"===t.name?t.find(qs).length>0?t.remove(!0):$(t,"p"):(t.isHeading||["blockquote","li"].indexOf(t.name)>=0)&&t.find(qs).remove(!0)}function Gs(t,e){const i=t.selection,n=i.range;if(0===e.childNodes.length)return;const s=new T(e.firstChild);let o=new T(e.lastChild);0===n.getBlocks().length&&i.setBlocks("<p />"),function(t,e){const i=t.selection.range,n=i.startNode.closest("lake-box");if(n.length>0)if("inline"===new Qt(n).type)i.isBoxLeft?(i.setStartBefore(n),i.collapseToStart()):i.isBoxRight?(i.setStartAfter(n),i.collapseToStart()):t.removeBox();else{const e=I("<p />");i.isBoxLeft?(n.before(e),i.shrinkAfter(e)):i.isBoxRight?(n.after(e),i.shrinkAfter(e)):t.removeBox()}const s=i.startNode.closestBlock();if(e.isBlockBox){const i=new Qt(e),n=""!==e.attr("value")?i.value:void 0;return t.insertBox(i.name,n),void e.remove()}if(e.first().length>0&&Z(s),s.isEmpty&&"p"===s.name)return s.replaceWith(e),e.find("lake-box").each((t=>{new Qt(t).render()})),void i.shrinkAfter(e);let o=e.first();for(;o.length>0;){"li"===o.name&&(o=o.first());const e=o.next();t.selection.insertNode(o),o=e}e.remove()}(t,s);let r=new T(e.firstChild);for(;r.length>0;){const t=r.next();"br"===r.name&&r.remove(),r=t}if(o=new T(e.lastChild),e.childNodes.length>0){const t=i.splitBlock();t.left&&(n.setEndAfter(t.left),n.collapseToEnd()),t.right&&t.right.isEmpty&&t.right.remove(),i.insertFragment(e),n.shrinkAfter(o)}V(t.container.children().filter((t=>t.isBlock))),t.history.save()}function Xs(t){t.selection.setBlocks("<p />")}function Js(t){t.selection.setBlocks("<ol><li></li></ol>")}function Ys(t){t.selection.setBlocks("<ul><li></li></ul>")}function Qs(t,e){t.selection.setBlocks(`<ul type="checklist"><li value="${e}"></li></ul>`)}const to={start:"left",end:"right"};const eo="strong";const io="sub";const no="sup";const so="code";let oo=[];const ro="lake-format-painter";class ao{constructor(t){this.linkNode=null,this.event=new qt,this.root=t,this.container=I(a`
57
+ `),f=o.node;f.addClass("lake-image-img"),f.attr({draggable:"false",alt:s.name}),Sl(m.find(".lake-resizer-top-left"),e),Sl(m.find(".lake-resizer-top-right"),e),Sl(m.find(".lake-resizer-bottom-left"),e),Sl(m.find(".lake-resizer-bottom-right"),e),t.append(c),t.append(m),t.append(f)}))}(o,t),r.then((()=>{s.empty(),s.append(o),o.find(".lake-button-view").on("click",(()=>function(t){const e=t.getEditor();if(!e)return;const i=[];let s=0;const o=e.container.find('lake-box[name="image"]');o.each(((e,n)=>{const o=new Qt(e),r=o.value;"done"===r.status&&(i.push({id:n,src:r.originalUrl||r.url,width:r.originalWidth||r.width,height:r.originalHeight||r.height,alt:r.name}),t.node.id===o.node.id&&(s=n))}));const r=new ga({pswpModule:_l,dataSource:i,mainClass:"lake-pswp",zoom:!1,returnFocus:!1,arrowPrevSVG:n.get("left"),arrowNextSVG:n.get("right"),closeSVG:n.get("close"),arrowPrevTitle:$r.image.previous(),arrowNextTitle:$r.image.next(),closeTitle:$r.image.close(),errorMsg:$r.image.loadingError()});r.on("uiRegister",(()=>{const t=r.pswp;t.ui.registerElement({name:"zoom-out-button",order:8,isButton:!0,title:$r.image.zoomOut(),html:n.get("zoomOut"),onClick:()=>{const e=t.currSlide,i=(e.zoomLevels.max-e.zoomLevels.min)/5,n=e.currZoomLevel-i;e.zoomTo(n,void 0,333)}}),t.ui.registerElement({name:"zoom-in-button",order:9,isButton:!0,title:$r.image.zoomIn(),html:n.get("zoomIn"),onClick:()=>{const e=t.currSlide,i=(e.zoomLevels.max-e.zoomLevels.min)/5,n=e.currZoomLevel+i;e.zoomTo(n,void 0,333)}})})),r.addFilter("thumbEl",((t,e)=>{const i=o.eq(e.id).find(".lake-image-img");return i.length>0?i.get(0):t})),r.addFilter("placeholderSrc",((t,e)=>{const i=o.eq(e.data.id).find(".lake-image-img");return i.length>0?i.attr("src"):t})),r.on("openingAnimationEnd",(()=>{t.event.emit("openfullscreen")})),r.on("closingAnimationEnd",(()=>{t.event.emit("closefullscreen")})),r.init(),r.loadAndOpen(s)}(t))),o.find(".lake-button-remove").on("click",(e=>{e.stopPropagation(),function(t){const e=t.getEditor();if(!e)return;const i=t.getData("xhr");i&&i.abort(),e.selection.range.selectBox(t.node),e.removeBox(),e.history.save()}(t)})),t.event.emit("render")})),o.on("click",(()=>{e.selection.range.selectBox(t.node)}))},html:t=>{const e=t.node.attr("value");return a`<img src="${t.value.url}" data-lake-value="${e}" />`}},El="text",Tl="#57606a",Il="#444d56",Ll="#953800",Ml="#0550ae",Pl="#444d56",Ol="#24292e",zl="#005cc5",Zl="#0550ae",Nl="#444d56",Hl="#444d56",Dl="#0a3069",$l="#0550ae",Vl="#0550ae",Fl="#116329",jl="#0550ae",Rl="#cf222e",Wl="#24292f",Ul="#cf222e",ql="#57606a",Kl="#57606a",Gl="#8250df",Xl="#0550ae",Jl="#f6f8fa",Yl="#cf222e",Ql="#0550ae",tc="#005cc5",ec="#444d56",ic="#444d56";function nc(t){const{HighlightStyle:e,tags:i}=t;return e.define([{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:Tl},{tag:[i.name],color:Il},{tag:[i.variableName,i.self],color:Ll},{tag:[i.typeName,i.tagName],color:Ml},{tag:[i.propertyName,i.attributeName],color:Pl},{tag:[i.className],color:Ol},{tag:[i.labelName],color:zl},{tag:[i.namespace],color:Zl},{tag:[i.macroName],color:Nl},{tag:[i.literal],color:Hl},{tag:[i.string,i.docString,i.character,i.attributeValue,i.unit],color:Dl},{tag:[i.number,i.integer,i.float],color:$l},{tag:[i.bool,i.null,i.atom],color:Vl},{tag:[i.regexp,i.escape,i.url],color:Fl},{tag:[i.color],color:jl},{tag:[i.keyword,i.operatorKeyword,i.controlKeyword,i.definitionKeyword,i.moduleKeyword],color:Rl},{tag:[i.modifier],color:Wl},{tag:[i.operator,i.derefOperator,i.arithmeticOperator,i.logicOperator,i.bitwiseOperator,i.compareOperator,i.updateOperator,i.definitionOperator,i.typeOperator,i.controlOperator],color:Ul},{tag:[i.punctuation,i.separator,i.bracket,i.angleBracket,i.squareBracket,i.paren,i.brace,i.contentSeparator],color:ql},{tag:[i.content],color:Kl},{tag:[i.meta,i.documentMeta,i.annotation,i.processingInstruction],color:Gl},{tag:i.heading,fontWeight:"bold",color:Xl},{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:Jl},{tag:[i.definition(i.name)],color:Yl},{tag:[i.constant(i.name)],color:Ql},{tag:[i.function(i.variableName)],color:tc},{tag:[i.standard(i.name)],color:ec},{tag:[i.special(i.variableName)],color:ic}])}const sc={type:"block",name:"codeBlock",render:t=>{var e;const i=t.getEditor();if(!i)return;const s=I('<div class="lake-code-block" />'),o=t.getContainer();o.empty(),o.append(s);const r=s.get(0);if(!r)return;const a=window.CodeMirror;if(!a)return s.addClass("lake-code-block-error"),s.text("\n The code cannot be displayed because window.CodeMirror is not found.\n Please check if the CodeMirror file is added to this page.\n ".trim()),void s.on("click",(()=>{i.selection.range.selectBox(t.node)}));const{EditorState:l,Compartment:c,EditorView:h,keymap:d,history:p,defaultKeymap:u,historyKeymap:m,indentWithTab:f,syntaxHighlighting:g,langItems:v}=a,w=new Map;for(const t of v)w.set(t.value,t);const y=t.value,x=w.get(y.lang),b=new c,k=h.updateListener.of((e=>{var n;e.docChanged&&(n=e.state.doc.toString(),window.setTimeout((()=>{i.isComposing||(t.updateValue("code",n),i.history.save())}),0))})),_=new h({parent:r,doc:null!==(e=y.code)&&void 0!==e?e:"",extensions:[l.readOnly.of(i.readonly),p(),d.of([...u,...m,f]),g(nc(a)),b.of(x&&x.component?x.component():[]),k]});s.find('[contenteditable="true"]').attr("tabindex","-1");new _e({root:s,name:"langType",downIcon:n.get("down"),defaultValue:x?y.lang:El,tooltip:$r.codeBlock.langType(),width:"auto",menuType:"list",menuItems:v.map((t=>({value:t.value,text:t.text}))),onSelect:e=>{const n=w.get(e);_.dispatch({effects:b.reconfigure(n&&n.component?n.component():[])}),t.updateValue({lang:e}),i.history.save()}}).render(),t.setData("codeEditor",_),t.useEffect((()=>()=>{_.destroy(),C("CodeMirror destroyed")}))}};const oc=Array.from(x).join(",");function rc(t){const e=[t];for(const i of t.getWalker())e.push(i);for(const t of e)"div"===t.name?t.find(oc).length>0?t.remove(!0):$(t,"p"):(t.isHeading||["blockquote","li"].indexOf(t.name)>=0)&&t.find(oc).remove(!0)}function ac(t,e){const i=t.selection,n=i.range;if(0===e.childNodes.length)return;const s=new T(e.firstChild);let o=new T(e.lastChild);0===n.getBlocks().length&&i.setBlocks("<p />"),function(t,e){const i=t.selection.range,n=i.startNode.closest("lake-box");if(n.length>0)if("inline"===new Qt(n).type)i.isBoxStart?(i.setStartBefore(n),i.collapseToStart()):i.isBoxEnd?(i.setStartAfter(n),i.collapseToStart()):t.removeBox();else{const e=I("<p />");i.isBoxStart?(n.before(e),i.shrinkAfter(e)):i.isBoxEnd?(n.after(e),i.shrinkAfter(e)):t.removeBox()}const s=i.startNode.closestBlock();if(e.isBlockBox){const i=new Qt(e),n=""!==e.attr("value")?i.value:void 0;return t.insertBox(i.name,n),void e.remove()}if(e.first().length>0&&O(s),s.isEmpty&&"p"===s.name)return s.replaceWith(e),e.find("lake-box").each((t=>{new Qt(t).render()})),void i.shrinkAfter(e);let o=e.first();for(;o.length>0;){"li"===o.name&&(o=o.first());const e=o.next();t.selection.insertNode(o),o=e}e.remove()}(t,s);let r=new T(e.firstChild);for(;r.length>0;){const t=r.next();"br"===r.name&&r.remove(),r=t}if(o=new T(e.lastChild),e.childNodes.length>0){const t=i.splitBlock();t.start&&(n.setEndAfter(t.start),n.collapseToEnd()),t.end&&t.end.isEmpty&&t.end.remove(),i.insertFragment(e),n.shrinkAfter(o)}V(t.container.children().filter((t=>t.isBlock))),t.history.save()}function lc(t){t.selection.setBlocks("<p />")}function cc(t){t.selection.setBlocks("<ol><li></li></ol>")}function hc(t){t.selection.setBlocks("<ul><li></li></ul>")}function dc(t,e){t.selection.setBlocks(`<ul type="checklist"><li value="${e}"></li></ul>`)}const pc={start:"left",end:"right"};const uc="strong";const mc="sub";const fc="sup";const gc="code";let vc=[];const wc="lake-format-painter";class yc{constructor(t){this.linkNode=null,this.event=new qt,this.root=t,this.container=I(a`
58
58
  <div class="lake-link-popup">
59
- <div class="lake-row">${Ri.link.url()}</div>
59
+ <div class="lake-row">${$r.link.url()}</div>
60
60
  <div class="lake-row lake-url-row">
61
61
  <input type="text" name="url" />
62
62
  </div>
63
- <div class="lake-row">${Ri.link.title()}</div>
63
+ <div class="lake-row">${$r.link.title()}</div>
64
64
  <div class="lake-row">
65
65
  <input type="text" name="title" />
66
66
  </div>
67
67
  <div class="lake-row lake-button-row"></div>
68
68
  </div>
69
- `)}writeClipboardText(t){return nn(this,void 0,void 0,(function*(){let e=!1;try{window.LAKE_TEST?e=window.LAKE_ERROR:yield navigator.clipboard.writeText(t)}catch(t){e=!0}return new Promise((t=>{t(e)}))}))}appendCopyButton(){let t=null;const e=new ke({root:this.container.find(".lake-url-row"),name:"copy",icon:n.get("copy"),tooltip:Ri.link.copy(),onClick:()=>{if(!this.linkNode)return;const e=this.getInputValue("url");this.writeClipboardText(e).then((e=>{const i=this.container.find('button[name="copy"] svg');if(i.hide(),e)return i.eq(2).show("inline"),void this.event.emit("copy",e);i.eq(1).show("inline"),this.event.emit("copy",e),t&&window.clearTimeout(t),t=window.setTimeout((()=>{i.hide(),i.eq(0).show("inline")}),2e3)}))}});e.render();const i=n.get("checkCircle");i&&e.node.append(i);const s=n.get("warningCircle");s&&e.node.append(s)}appendOpenButton(){new ke({root:this.container.find(".lake-url-row"),name:"open",icon:n.get("open"),tooltip:Ri.link.open(),onClick:()=>{if(!this.linkNode)return;const t=this.getInputValue("url");window.open(t)}}).render()}appendSaveButton(){new ke({root:this.container.find(".lake-button-row"),name:"save",icon:n.get("check"),text:Ri.link.save(),onClick:()=>{this.linkNode&&(this.save(),this.hide(),this.event.emit("save"))}}).render()}appendUnlinkButton(){new ke({root:this.container.find(".lake-button-row"),name:"unlink",icon:n.get("unlink"),text:Ri.link.unlink(),onClick:()=>{this.linkNode&&(this.linkNode.remove(!0),this.hide(),this.event.emit("remove"))}}).render()}getInputValue(t){return this.container.find(`input[name="${t}"]`).get(0).value}setInputValue(t,e){this.container.find(`input[name="${t}"]`).get(0).value=e}save(){if(!this.linkNode)return;const t=this.getInputValue("url");let e=this.getInputValue("title");""!==t||""!==e?(""===e&&(e=t),this.linkNode.attr("href",t),this.linkNode.text(e)):this.linkNode.remove()}updatePosition(){if(!this.linkNode)return;const t=this.linkNode.get(0).getBoundingClientRect(),e=t.x+window.scrollX,i=t.y+window.scrollY;e<0||i<0?this.hide():(t.x+this.container.width()>window.innerWidth?this.container.css("left",`${e-this.container.width()+t.width}px`):this.container.css("left",`${e}px`),t.y+t.height+this.container.height()>window.innerHeight?this.container.css("top",i-this.container.height()+"px"):this.container.css("top",`${i+t.height}px`))}render(){this.appendCopyButton(),this.appendOpenButton(),this.appendSaveButton(),this.appendUnlinkButton(),this.root.append(this.container)}show(t){if(0===this.root.find(".lake-link-popup").length&&this.render(),this.linkNode&&this.linkNode.get(0)===t.get(0))return;this.linkNode=t;const e=t.attr("href"),i=t.text();this.setInputValue("url",e),i!==e&&this.setInputValue("title",i),this.container.css("visibility","hidden"),this.container.show(),this.updatePosition(),this.container.css("visibility",""),this.container.find('input[name="url"]').focus()}hide(){this.linkNode=null,this.container.hide()}}const lo=new Map([["#","h1"],["##","h2"],["###","h3"],["####","h4"],["#####","h5"],["######","h6"]]),ho=[{re:/\*\*(.+?)\*\*$/,getParameters:()=>["bold"]},{re:/__(.+?)__$/,getParameters:()=>["bold"]},{re:/_(.+?)_$/,getParameters:()=>["italic"]},{re:/\*(.+?)\*$/,getParameters:()=>["italic"]},{re:/==(.+?)==$/,getParameters:()=>["highlight","#fff566"]},{re:/~~(.+?)~~$/,getParameters:()=>["strikethrough"]},{re:/`(.+?)`$/,getParameters:()=>["code"]}],co=[{re:/^#+$/,getParameters:t=>{var e;return["heading",null!==(e=lo.get(t[0]))&&void 0!==e?e:"h6"]}},{re:/^\d+\.$/,getParameters:()=>["list","numbered"]},{re:/^[*\-+]$/,getParameters:()=>["list","bulleted"]},{re:/^\[\s?\]$/,getParameters:()=>["list","checklist",!1]},{re:/^\[x\]$/i,getParameters:()=>["list","checklist",!0]},{re:/^>$/,getParameters:()=>["blockQuote"]}],po=[{re:/^-+$/,getParameters:()=>["hr"]},{re:/^`+([a-z]*)$/i,getParameters:t=>t[1]?["codeBlock",{lang:t[1]}]:["codeBlock"]}];function uo(t){const e=t.clone(!0);e.find("lake-bookmark").remove(),""===e.html()&&t.prepend("<br />")}function mo(t,e){const i=t.selection.range,n=i.getRightText();if(t.selection.splitBlock(),e=i.getBlocks()[0])return""!==n||!e.isHeading&&"blockquote"!==e.name?void(e.isList&&"checklist"===e.attr("type")&&e.find("li").attr("value","false")):(t.selection.setBlocks("<p />"),void t.history.save());t.history.save()}function fo(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxLeft?(e.setStartBefore(i),e.collapseToStart(),mo(t,n)):e.isBoxRight?(e.setStartAfter(i),e.collapseToStart(),mo(t,n)):t.removeBox());const s=I("<p><br /></p>");e.isBoxLeft?i.before(s):e.isBoxRight?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function go(t){const e=t.selection.range,i=e.startNode.closestBlock();if(i.length>0&&!i.isContainer){const i=e.getPrevNode(),n=e.getRightText();if("br"!==i.name&&""===n)return t.selection.insertContents("<br /><br />"),void t.history.save()}t.selection.insertNode(I("<br />"))}function vo(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxLeft?(e.setStartBefore(i),e.collapseToStart(),go(t)):e.isBoxRight?(e.setStartAfter(i),e.collapseToStart(),go(t)):t.removeBox());const s=I("<p><br /></p>");e.isBoxLeft?i.before(s):e.isBoxRight?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function wo(t,e){const i=t.selection.range;let n=e.prev();if(0===n.length)return void("p"!==e.name&&t.selection.setBlocks("<p />"));if(n.isBox)return e.isEmpty&&e.remove(),void i.selectBoxRight(n);if("br"===n.name)return void n.remove();if(!n.isBlock){const t=new E;t.selectNodeContents(n),pe(t,"<p />"),n=t.startNode.closestBlock()}if(n.isEmpty)return void n.remove();const s=t.selection.insertBookmark();N(n,e),t.selection.toBookmark(s),t.selection.fixList()}function yo(t,e){const i=t.selection.range;let n=e.next();if(0===n.length)return void t.history.save();if(n.isBox)return e.isEmpty&&e.remove(),i.selectBoxLeft(n),void t.history.save();if(!n.isBlock){const t=new E;t.selectNodeContents(n),pe(t,"<p />"),n=n.closestBlock()}const s=t.selection.insertBookmark();N(e,n),t.selection.toBookmark(s),t.selection.fixList()}return Bi.box.add({type:"block",name:"hr",render:t=>{const e=t.getEditor();if(e)return t.useEffect((()=>{t.getContainer().find(".lake-hr").on("click",(()=>{e.selection.range.selectBox(t.node)}))})),'<div class="lake-hr"><hr /></div>'},html:()=>"<hr />"}),Bi.box.add(Es),Bi.box.add(Us),Bi.plugin.add((t=>{t.container.on("copy",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.startNode.closest("lake-box");if(0===n.length)return;if(i.isBoxLeft||i.isBoxRight)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=new Qt(n).getHTML();s.setData("text/html",o)}))})),Bi.plugin.add((t=>{t.container.on("cut",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.startNode.closest("lake-box");if(0===n.length)return;if(i.isBoxLeft||i.isBoxRight)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=new Qt(n).getHTML();s.setData("text/html",o),t.removeBox(),t.history.save()}))})),Bi.plugin.add((t=>{const{imageRequestTypes:e}=t.config;t.container.on("paste",(i=>{if(t.selection.range.isInsideBox)return;i.preventDefault();const n=i.clipboardData;if(!n)return;if(t.selection.deleteContents(),n.files.length>0){for(const i of n.files)e.indexOf(i.type)>=0&&Qi({editor:t,file:i});return}const s=n.types;if(1===s.length&&"text/plain"===s[0]){const e=n.getData("text/plain"),i=new ne(e).getFragment();return t.event.emit("beforepaste",i),void Gs(t,i)}const o=u(n.getData("text/html")),r=function(){const t=ee();return t.div=t.p,g(t,((t,e)=>{delete e.id,delete e.class})),t}(),a=new ie(o,r).getFragment();t.event.emit("beforepaste",a),function(t){let e=new T(t.firstChild);for(;e.length>0;){const t=e.next();e.isBlock&&Ks(e),e=t}let i=[];for(e=new T(t.firstChild);e.length>0;){const t=e.next();e.isMark||e.isText||e.isBookmark||e.isInlineBox?i.push(e):(H(i),i=[]),e=t}H(i)}(a),Gs(t,a),t.box.renderAll(t)}))})),Bi.plugin.add((t=>{t.command.add("undo",{execute:()=>{t.history.undo()}}),t.keystroke.setKeydown("mod+z",(e=>{t.selection.range.isInsideBox||(e.preventDefault(),t.command.execute("undo"))}))})),Bi.plugin.add((t=>{t.command.add("redo",{execute:()=>{t.history.redo()}});const e=e=>{t.selection.range.isInsideBox||(e.preventDefault(),t.command.execute("redo"))};t.keystroke.setKeydown("mod+y",e),t.keystroke.setKeydown("mod+shift+z",e)})),Bi.plugin.add((t=>{t.command.add("selectAll",{execute:()=>{const e=t.selection.range;e.selectNodeContents(t.container),e.shrink()}})})),Bi.plugin.add((t=>{t.command.add("heading",{selectedValues:t=>{const e=t.find((t=>t.node.isHeading||"p"===t.name));return e?[e.name]:[]},execute:e=>{t.selection.setBlocks(`<${e} />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("blockQuote",{isSelected:t=>!!t.find((t=>"blockquote"===t.name)),execute:()=>{t.selection.setBlocks("<blockquote />"),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("list",{selectedValues:t=>{let e;for(const i of t){if("ol"===i.name){e="numbered";break}if("ul"===i.name&&!i.node.hasAttr("type")){e="bulleted";break}if("ul"===i.name&&"checklist"===i.node.attr("type")){e="checklist";break}}return e?[e]:[]},execute:(e,i=!1)=>{const n=t.selection.range.getBlocks();let s=!1,o=!1,r=!1;for(const t of n)s||"ol"!==t.name||(s=!0),o||"ul"!==t.name||t.hasAttr("type")||(o=!0),r||"ul"!==t.name||"checklist"!==t.attr("type")||(r=!0);s?("numbered"===e&&Xs(t),"bulleted"===e&&Ys(t),"checklist"===e&&Qs(t,i)):o?("numbered"===e&&Js(t),"bulleted"===e&&Xs(t),"checklist"===e&&Qs(t,i)):r?("numbered"===e&&Js(t),"bulleted"===e&&Ys(t),"checklist"===e&&Xs(t)):("numbered"===e&&Js(t),"bulleted"===e&&Ys(t),"checklist"===e&&Qs(t,i)),t.history.save()}}),t.container.on("click",(e=>{const i=e;if(!i.target)return;const n=I(i.target);"li"===n.name&&""!==n.attr("value")&&i.offsetX<=18&&(n.attr("value",("true"!==n.attr("value")).toString()),t.history.save())}))})),Bi.plugin.add((t=>{t.command.add("align",{selectedValues:t=>{let e;for(const i of t)if(i.node.isBlock){e=i.node.computedCSS("text-align");break}return e?[to[e]||e]:[]},execute:e=>{t.selection.setBlocks({"text-align":e}),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("indent",{execute:e=>{const i=t.selection.range.getBlocks();for(const t of i)F(t,e);t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("bold",{isDisabled:t=>!!t.find((t=>t.node.isHeading)),isSelected:t=>!!t.find((t=>t.name===eo)),execute:()=>{t.command.isSelected("bold")?t.selection.removeMark(`<${eo} />`):t.selection.addMark(`<${eo} />`),t.history.save()}}),t.keystroke.setKeydown("mod+b",(e=>{e.preventDefault(),t.command.execute("bold")}))})),Bi.plugin.add((t=>{t.command.add("italic",{isSelected:t=>!!t.find((t=>"i"===t.name)),execute:()=>{t.command.isSelected("italic")?t.selection.removeMark("<i />"):t.selection.addMark("<i />"),t.history.save()}}),t.keystroke.setKeydown("mod+i",(e=>{e.preventDefault(),t.command.execute("italic")}))})),Bi.plugin.add((t=>{t.command.add("underline",{isSelected:t=>!!t.find((t=>"u"===t.name)),execute:()=>{t.command.isSelected("underline")?t.selection.removeMark("<u />"):t.selection.addMark("<u />"),t.history.save()}}),t.keystroke.setKeydown("mod+u",(e=>{e.preventDefault(),t.command.execute("underline")}))})),Bi.plugin.add((t=>{t.command.add("strikethrough",{isSelected:t=>!!t.find((t=>"s"===t.name)),execute:()=>{t.command.isSelected("strikethrough")?t.selection.removeMark("<s />"):t.selection.addMark("<s />"),t.history.save()}}),t.keystroke.setKeydown("mod+shift+x",(e=>{e.preventDefault(),t.command.execute("strikethrough")}))})),Bi.plugin.add((t=>{t.command.add("subscript",{isSelected:t=>!!t.find((t=>t.name===io)),execute:()=>{t.command.isSelected("subscript")?t.selection.removeMark(`<${io} />`):t.selection.addMark(`<${io} />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("superscript",{isSelected:t=>!!t.find((t=>t.name===no)),execute:()=>{t.command.isSelected("superscript")?t.selection.removeMark(`<${no} />`):t.selection.addMark(`<${no} />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("code",{isSelected:t=>!!t.find((t=>t.name===so)),execute:()=>{t.command.isSelected("code")?t.selection.removeMark(`<${so} />`):t.selection.addMark(`<${so} />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("fontFamily",{selectedValues:t=>{for(const e of t)if("span"===e.name){return[e.node.css("font-family").replace(/['"]/g,"")]}return[]},execute:e=>{t.selection.addMark(`<span style="font-family: ${e};" />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("fontSize",{isDisabled:t=>!!t.find((t=>t.node.isHeading)),selectedValues:t=>{for(const e of t)if("span"===e.name){return[e.node.css("font-size").replace(/\.\d+/,"")]}return[]},execute:e=>{t.selection.addMark(`<span style="font-size: ${e};" />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("fontColor",{selectedValues:t=>{for(const e of t)if("span"===e.name){return[d(e.node.computedCSS("color"))]}return[]},execute:e=>{t.selection.addMark(`<span style="color: ${e};" />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("highlight",{selectedValues:t=>{for(const e of t)if("span"===e.name){return[d(e.node.computedCSS("background-color"))]}return[]},execute:e=>{t.selection.addMark(`<span style="background-color: ${e};" />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("removeFormat",{execute:()=>{t.selection.removeMark(),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("formatPainter",{execute:()=>{t.container.addClass(ro);const e=t.selection.getAppliedItems();for(const t of e){const e=t.node.clone();e.isMark&&"a"!==e.name&&oo.push(e)}}}),t.container.on("click",(()=>{if(t.container.removeClass(ro),0!==oo.length){for(const e of oo)t.selection.addMark(e);oo=[],t.history.save()}})),t.event.on("click",(e=>{if(e.isInside)return;e.closest('button[name="formatPainter"]').length>0||(t.container.removeClass(ro),oo=[])}))})),Bi.plugin.add((t=>{const e=new ao(t.popupContainer);e.event.on("save",(()=>{t.history.save()})),e.event.on("remove",(()=>{t.history.save()})),t.root.on("scroll",(()=>{e.updatePosition()})),t.event.on("resize",(()=>{e.updatePosition()})),t.event.on("click",(t=>{if(t.closest('button[name="link"]').length>0)return;const i=t.closest("a");0!==i.length?i.isOutside||i.closest("lake-box").length>0||e.show(i):e.hide()})),t.command.add("link",{execute:()=>{const i=t.selection.insertLink(`<a href="">${Ri.link.newLink()}</a>`);i&&(t.history.save(),e.show(i))}})})),Bi.plugin.add((t=>{t.event.on("beforepaste",(t=>{new mt(t).find("hr").each((t=>{const e=I(t),i=new Qt("hr");e.replaceWith(i.node)}))})),t.command.add("hr",{execute:()=>{t.insertBox("hr"),t.history.save()}})})),Bi.plugin.add((t=>{t.event.on("beforepaste",(t=>{new mt(t).find("img").each((t=>{const e=I(t),i=new Qt("image"),n=e.attr("data-lake-value");""===n?i.value={url:e.attr("src"),status:"done"}:i.node.attr("value",n),e.replaceWith(i.node)}))})),t.command.add("image",{execute:e=>{t.insertBox("image",e),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("codeBlock",{execute:e=>{const i=t.insertBox("codeBlock",e);t.history.save();i.getData("codeEditor").focus()}})})),Bi.plugin.add((t=>{t.keystroke.setKeydown("space",(e=>{const i=t.selection.range;if(i.isBox)return;const n=function(t){const e=t.selection.range;let i=e.startNode,n=e.startOffset;if(0!==n){if(i.isElement){const t=i.children()[n-1];if(!t||!t.isText)return;i=t,n=i.text().length}if(!(n<1))return{node:i,offset:n}}}(t);if(!n)return;if(function(t,e){const i=t.selection,n=i.range,s=e.offset,o=e.node.text().slice(0,s);for(const e of ho){const r=e.re.exec(o);if(null!==r){t.prepareOperation();const o=i.insertBookmark(),a=o.focus.prev(),l=a.text(),h=`${l.replace(e.re,"$1")}​`;a.get(0).nodeValue=h,n.setStart(a,s-r[0].length),n.setEnd(a,s-(l.length-h.length)-1);const c=e.getParameters();return t.command.execute(c.shift(),...c),i.toBookmark(o),t.commitOperation(),!0}}return!1}(t,n))return void e.preventDefault();const s=i.getBlocks()[0];s&&(s.isHeading||"p"===s.name)&&function(t,e){const i=t.selection,n=e.offset;let s=e.node.text().slice(0,n);s=s.replace(/[\u200B\u2060]/g,"");for(const e of co){const n=e.re.exec(s);if(null!==n){t.prepareOperation();const s=i.insertBookmark();s.focus.prev().remove();const o=s.focus.closestBlock();uo(o),i.range.shrinkAfter(o);const r=e.getParameters(n);return t.command.execute(r.shift(),...r),i.toBookmark(s),t.commitOperation(),!0}}return!1}(t,n)&&e.preventDefault()})),t.keystroke.setKeydown("enter",(e=>{const i=t.selection.range;if(i.isBox)return;const n=i.getBlocks()[0];return!n||!n.isHeading&&"p"!==n.name||n.find("lake-box").length>0||""!==i.getRightText()?void 0:function(t,e){const i=t.selection;let n=e.text();n=n.replace(/[\u200B\u2060]/g,"");for(const s of po){const o=s.re.exec(n);if(null!==o){t.prepareOperation(),e.empty(),uo(e),i.range.shrinkAfter(e);const n=s.getParameters(o);return t.command.execute(n.shift(),...n),t.commitOperation(),!0}}return!1}(t,n)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("enter",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(e.preventDefault(),t.rectifyContent(),i.isBox)return fo(t),void t.history.save();if(i.adapt(),i.isInoperative)return;if(i.isBox)return fo(t),void t.history.save();let n=i.getBlocks()[0];if(n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),n.isEmpty&&"p"!==n.name)return t.selection.setBlocks("<p />"),void t.history.save();mo(t,n),t.history.save()}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("shift+enter",(e=>{const i=t.selection.range;if(!i.isInsideBox){if(t.rectifyContent(),e.preventDefault(),i.isBox)return vo(t),void t.history.save();if(i.adapt(),!i.isInoperative){if(i.isBox)return vo(t),void t.history.save();go(t),t.history.save()}}}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("backspace",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxLeft){const n=i.startNode.closest("lake-box"),s=n.prev();if(0===s.length){const i=n.closestBlock();return void(i.length>0&&!i.isContainer&&(e.preventDefault(),wo(t,i),t.history.save()))}if(s.isBlock)return s.isEmpty?(e.preventDefault(),s.remove(),t.selection.fixList(),void t.history.save()):(e.preventDefault(),void i.shrinkAfter(s));i.adaptBox()}if(i.isBox)return e.preventDefault(),t.removeBox(),void t.history.save();if(!i.isCollapsed)return e.preventDefault(),t.selection.deleteContents(),""===t.container.html().trim()&&t.setValue("<p><br /><focus /></p>"),void t.history.save();i.adapt();const n=i.getPrevNode();if(n.isBox)return e.preventDefault(),i.selectBox(n),t.removeBox(),void t.history.save();if("br"===n.name&&n.prev().length>0)return e.preventDefault(),i.setStartBefore(n),i.collapseToStart(),n.remove(),void t.history.save();if(""===i.getLeftText()){e.preventDefault();let n=i.getBlocks()[0];if(n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),""!==n.css("margin-left")||""!==n.css("text-indent")||""!==n.attr("indent"))return F(n,"decrease"),void t.history.save();if(n.isList||"blockquote"===n.name)return t.selection.setBlocks("<p />"),void t.history.save();wo(t,n),t.history.save()}}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("delete",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxRight){const n=i.startNode.closest("lake-box"),s=n.next();if(0===s.length){const i=n.closestBlock();return void(i.length>0&&!i.isContainer&&(e.preventDefault(),yo(t,i),t.history.save()))}if(s.isBlock)return s.isEmpty?(e.preventDefault(),s.remove(),t.selection.fixList(),void t.history.save()):(e.preventDefault(),void i.shrinkBefore(s));i.adaptBox()}if(i.isBox)return e.preventDefault(),t.removeBox(),void t.history.save();if(!i.isCollapsed)return e.preventDefault(),t.selection.deleteContents(),""===t.container.html().trim()&&t.setValue("<p><br /><focus /></p>"),void t.history.save();i.adapt();const n=i.getNextNode();if(n.isBox)return e.preventDefault(),i.selectBox(n),t.removeBox(),void t.history.save();"br"===n.name&&n.next().length>0&&(e.preventDefault(),i.setStartBefore(n),i.collapseToStart(),n.remove(),t.history.save());if(""===i.getRightText()){e.preventDefault();let n=i.getBlocks()[0];n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),yo(t,n),t.history.save()}}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("tab",(e=>{if(!1===t.config.indentWithTab)return;e.preventDefault();t.selection.range.getBlocks().forEach((t=>{"p"===t.name&&"2em"!==t.css("text-indent")?t.css("text-indent","2em"):F(t,"increase")})),t.history.save()}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("arrow-left",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(i.isBoxLeft){const t=n.prev();return t.isBlock||t.isBox?(e.preventDefault(),t.isInlineBox?void i.selectBox(t):void i.shrinkAfter(t)):(i.setStartBefore(n),void i.collapseToStart())}return i.isBoxRight?(e.preventDefault(),void i.selectBox(n)):(e.preventDefault(),void i.selectBoxLeft(n))}if(!i.isCollapsed)return;const s=i.getPrevNode();s.isBox&&(e.preventDefault(),i.selectBox(s))})),t.keystroke.setKeydown("arrow-right",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(i.isBoxLeft)return e.preventDefault(),void i.selectBox(n);if(i.isBoxRight){const t=n.next();return t.isBlock||t.isBox?(e.preventDefault(),t.isInlineBox?void i.selectBox(t):void i.shrinkBefore(t)):(i.setStartAfter(n),void i.collapseToStart())}return e.preventDefault(),void i.selectBoxRight(n)}if(!i.isCollapsed)return;const s=i.getNextNode();s.isBox&&(e.preventDefault(),i.selectBox(s))})),t.keystroke.setKeydown("arrow-up",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(n.isBlockBox){const t=n.prev();if(t.isBlock||t.isBox)return e.preventDefault(),void i.shrinkAfter(t)}i.setStartBefore(n),i.collapseToStart()}})),t.keystroke.setKeydown("arrow-down",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(n.isBlockBox){const t=n.next();if(t.isBlock||t.isBox)return e.preventDefault(),void i.shrinkBefore(t)}i.setStartAfter(n),i.collapseToStart()}}))})),t.Box=Qt,t.Button=ke,t.Dropdown=_e,t.Editor=Bi,t.Fragment=mt,t.HTMLParser=ie,t.Nodes=T,t.Range=E,t.TextParser=ne,t.Toolbar=class{constructor(t){this.items=t.items||tn,this.editor=t.editor,this.root=I(t.root),this.container=I('<div class="lake-toolbar" />'),this.root.addClass("lake-custom-properties")}appendDivider(){this.container.append('<div class="lake-toolbar-divider" />')}appendButton(t){const e=this.editor;new ke({root:this.container,name:t.name,icon:t.icon,tooltip:t.tooltip,tabIndex:-1,onClick:()=>{e.focus(),t.onClick(e,t.name)}}).render()}appendDropdown(t){const e=this.editor;new _e({root:this.container,name:t.name,icon:t.icon,accentIcon:t.accentIcon,downIcon:t.downIcon,defaultValue:t.defaultValue,tooltip:t.tooltip,width:t.width,menuType:t.menuType,menuItems:t.menuItems,tabIndex:-1,onSelect:i=>{e.focus(),t.onSelect(e,i)}}).render()}appendUpload(t){const e=this.editor,i=I(a`
70
- <div class="lake-upload" name="${t.name}">
69
+ `)}writeClipboardText(t){return Qr(this,void 0,void 0,(function*(){let e=!1;try{window.LAKE_TEST?e=window.LAKE_ERROR:yield navigator.clipboard.writeText(t)}catch(t){e=!0}return new Promise((t=>{t(e)}))}))}appendCopyButton(){let t=null;const e=new ke({root:this.container.find(".lake-url-row"),name:"copy",icon:n.get("copy"),tooltip:$r.link.copy(),onClick:()=>{if(!this.linkNode)return;const e=this.getInputValue("url");this.writeClipboardText(e).then((e=>{const i=this.container.find('button[name="copy"] svg');if(i.hide(),e)return i.eq(2).show("inline"),void this.event.emit("copy",e);i.eq(1).show("inline"),this.event.emit("copy",e),t&&window.clearTimeout(t),t=window.setTimeout((()=>{i.hide(),i.eq(0).show("inline")}),2e3)}))}});e.render();const i=n.get("checkCircle");i&&e.node.append(i);const s=n.get("warningCircle");s&&e.node.append(s)}appendOpenButton(){new ke({root:this.container.find(".lake-url-row"),name:"open",icon:n.get("open"),tooltip:$r.link.open(),onClick:()=>{if(!this.linkNode)return;const t=this.getInputValue("url");window.open(t)}}).render()}appendSaveButton(){new ke({root:this.container.find(".lake-button-row"),name:"save",icon:n.get("check"),text:$r.link.save(),onClick:()=>{if(!this.linkNode)return;const t=this.linkNode;this.save(),this.hide(),this.event.emit("save",t)}}).render()}appendUnlinkButton(){new ke({root:this.container.find(".lake-button-row"),name:"unlink",icon:n.get("unlink"),text:$r.link.unlink(),onClick:()=>{if(!this.linkNode)return;const t=this.linkNode.last();this.linkNode.remove(!0),this.hide(),this.event.emit("remove",t)}}).render()}getInputValue(t){return this.container.find(`input[name="${t}"]`).get(0).value}setInputValue(t,e){this.container.find(`input[name="${t}"]`).get(0).value=e}save(){if(!this.linkNode)return;const t=this.getInputValue("url");let e=this.getInputValue("title");""!==t||""!==e?(""===e&&(e=t),this.linkNode.attr("href",t),this.linkNode.text(e)):this.linkNode.remove()}updatePosition(){if(!this.linkNode)return;const t=this.linkNode.get(0).getBoundingClientRect(),e=t.x+window.scrollX,i=t.y+window.scrollY;e<0||i<0?this.hide():(t.x+this.container.width()>window.innerWidth?this.container.css("left",`${e-this.container.width()+t.width}px`):this.container.css("left",`${e}px`),t.y+t.height+this.container.height()>window.innerHeight?this.container.css("top",i-this.container.height()+"px"):this.container.css("top",`${i+t.height}px`))}render(){this.appendCopyButton(),this.appendOpenButton(),this.appendSaveButton(),this.appendUnlinkButton(),this.root.append(this.container)}show(t){if(0===this.root.find(".lake-link-popup").length&&this.render(),this.linkNode&&this.linkNode.get(0)===t.get(0))return;this.linkNode=t;const e=t.attr("href"),i=t.text();this.setInputValue("url",e),i!==e&&this.setInputValue("title",i),this.container.css("visibility","hidden"),this.container.show(),this.updatePosition(),this.container.css("visibility",""),this.container.find('input[name="url"]').focus()}hide(){this.linkNode=null,this.container.hide()}}const xc=new Map([["#","h1"],["##","h2"],["###","h3"],["####","h4"],["#####","h5"],["######","h6"]]),bc=[{re:/\*\*(.+?)\*\*$/,getParameters:()=>["bold"]},{re:/__(.+?)__$/,getParameters:()=>["bold"]},{re:/_(.+?)_$/,getParameters:()=>["italic"]},{re:/\*(.+?)\*$/,getParameters:()=>["italic"]},{re:/==(.+?)==$/,getParameters:()=>["highlight","#fff566"]},{re:/~~(.+?)~~$/,getParameters:()=>["strikethrough"]},{re:/`(.+?)`$/,getParameters:()=>["code"]}],kc=[{re:/^#+$/,getParameters:t=>{var e;return["heading",null!==(e=xc.get(t[0]))&&void 0!==e?e:"h6"]}},{re:/^\d+\.$/,getParameters:()=>["list","numbered"]},{re:/^[*\-+]$/,getParameters:()=>["list","bulleted"]},{re:/^\[\s?\]$/,getParameters:()=>["list","checklist",!1]},{re:/^\[x\]$/i,getParameters:()=>["list","checklist",!0]},{re:/^>$/,getParameters:()=>["blockQuote"]}],_c=[{re:/^-+$/,getParameters:()=>["hr"]},{re:/^`+([a-z]*)$/i,getParameters:t=>t[1]?["codeBlock",{lang:t[1]}]:["codeBlock"]}];function Sc(t){const e=t.clone(!0);e.find("lake-bookmark").remove(),""===e.html()&&t.prepend("<br />")}function Ac(t,e){const i=t.selection.range,n=i.getEndText();if(t.selection.splitBlock(),e=i.getBlocks()[0])return""!==n||!e.isHeading&&"blockquote"!==e.name?void(e.isList&&"checklist"===e.attr("type")&&e.find("li").attr("value","false")):(t.selection.setBlocks("<p />"),void t.history.save());t.history.save()}function Cc(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxStart?(e.setStartBefore(i),e.collapseToStart(),Ac(t,n)):e.isBoxEnd?(e.setStartAfter(i),e.collapseToStart(),Ac(t,n)):t.removeBox());const s=I("<p><br /></p>");e.isBoxStart?i.before(s):e.isBoxEnd?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function Bc(t){const e=t.selection.range,i=e.startNode.closestBlock();if(i.length>0&&!i.isContainer){const i=e.getPrevNode(),n=e.getEndText();if("br"!==i.name&&""===n)return t.selection.insertContents("<br /><br />"),void t.history.save()}t.selection.insertNode(I("<br />"))}function Ec(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxStart?(e.setStartBefore(i),e.collapseToStart(),Bc(t)):e.isBoxEnd?(e.setStartAfter(i),e.collapseToStart(),Bc(t)):t.removeBox());const s=I("<p><br /></p>");e.isBoxStart?i.before(s):e.isBoxEnd?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function Tc(t,e){const i=t.selection.range;let n=e.prev();if(0===n.length)return void("p"!==e.name&&t.selection.setBlocks("<p />"));if(n.isBox)return e.isEmpty&&e.remove(),void i.selectBoxEnd(n);if("br"===n.name)return void n.remove();if(!n.isBlock){const t=new L;t.selectNodeContents(n),pe(t,"<p />"),n=t.startNode.closestBlock()}if(n.isEmpty)return void n.remove();const s=t.selection.insertBookmark();Z(n,e),t.selection.toBookmark(s),t.selection.fixList()}function Ic(t,e){const i=t.selection.range;let n=e.next();if(0===n.length)return void t.history.save();if(n.isBox)return e.isEmpty&&e.remove(),i.selectBoxStart(n),void t.history.save();if(!n.isBlock){const t=new L;t.selectNodeContents(n),pe(t,"<p />"),n=n.closestBlock()}const s=t.selection.insertBookmark();Z(e,n),t.selection.toBookmark(s),t.selection.fixList()}return Sr.box.add({type:"block",name:"hr",render:t=>{const e=t.getEditor();if(e)return t.useEffect((()=>{t.getContainer().find(".lake-hr").on("click",(()=>{e.selection.range.selectBox(t.node)}))})),'<div class="lake-hr"><hr /></div>'},html:()=>"<hr />"}),Sr.box.add(Bl),Sr.box.add(sc),Sr.plugin.add((t=>{t.container.on("copy",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.startNode.closest("lake-box");if(0===n.length)return;if(i.isBoxStart||i.isBoxEnd)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=new Qt(n).getHTML();s.setData("text/html",o)}))})),Sr.plugin.add((t=>{t.container.on("cut",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.startNode.closest("lake-box");if(0===n.length)return;if(i.isBoxStart||i.isBoxEnd)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=new Qt(n).getHTML();s.setData("text/html",o),t.removeBox(),t.history.save()}))})),Sr.plugin.add((t=>{const{imageRequestTypes:e}=t.config;t.container.on("paste",(i=>{if(t.selection.range.isInsideBox)return;i.preventDefault();const n=i.clipboardData;if(!n)return;if(t.selection.deleteContents(),n.files.length>0){for(const i of n.files)e.indexOf(i.type)>=0&&Xr({editor:t,file:i});return}const s=n.types;if(1===s.length&&"text/plain"===s[0]){const e=n.getData("text/plain"),i=new ne(e).getFragment();return t.event.emit("beforepaste",i),void ac(t,i)}const o=u(n.getData("text/html")),r=function(){const t=ee();return t.div=t.p,g(t,((t,e)=>{delete e.id,delete e.class})),t}(),a=new ie(o,r).getFragment();t.event.emit("beforepaste",a),function(t){let e=new T(t.firstChild);for(;e.length>0;){const t=e.next();e.isBlock&&rc(e),e=t}let i=[];for(e=new T(t.firstChild);e.length>0;){const t=e.next();e.isMark||e.isText||e.isBookmark||e.isInlineBox?i.push(e):(H(i),i=[]),e=t}H(i)}(a),ac(t,a),t.box.renderAll(t)}))})),Sr.plugin.add((t=>{t.command.add("undo",{execute:()=>{t.history.undo()}}),t.keystroke.setKeydown("mod+z",(e=>{t.selection.range.isInsideBox||(e.preventDefault(),t.command.execute("undo"))}))})),Sr.plugin.add((t=>{t.command.add("redo",{execute:()=>{t.history.redo()}});const e=e=>{t.selection.range.isInsideBox||(e.preventDefault(),t.command.execute("redo"))};t.keystroke.setKeydown("mod+y",e),t.keystroke.setKeydown("mod+shift+z",e)})),Sr.plugin.add((t=>{t.command.add("selectAll",{execute:()=>{const e=t.selection.range;e.selectNodeContents(t.container),e.shrink()}})})),Sr.plugin.add((t=>{t.command.add("heading",{selectedValues:t=>{const e=t.find((t=>t.node.isHeading||"p"===t.name));return e?[e.name]:[]},execute:e=>{t.selection.setBlocks(`<${e} />`),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("blockQuote",{isSelected:t=>!!t.find((t=>"blockquote"===t.name)),execute:()=>{t.selection.setBlocks("<blockquote />"),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("list",{selectedValues:t=>{let e;for(const i of t){if("ol"===i.name){e="numbered";break}if("ul"===i.name&&!i.node.hasAttr("type")){e="bulleted";break}if("ul"===i.name&&"checklist"===i.node.attr("type")){e="checklist";break}}return e?[e]:[]},execute:(e,i=!1)=>{const n=t.selection.range.getBlocks();let s=!1,o=!1,r=!1;for(const t of n)s||"ol"!==t.name||(s=!0),o||"ul"!==t.name||t.hasAttr("type")||(o=!0),r||"ul"!==t.name||"checklist"!==t.attr("type")||(r=!0);s?("numbered"===e&&lc(t),"bulleted"===e&&hc(t),"checklist"===e&&dc(t,i)):o?("numbered"===e&&cc(t),"bulleted"===e&&lc(t),"checklist"===e&&dc(t,i)):r?("numbered"===e&&cc(t),"bulleted"===e&&hc(t),"checklist"===e&&lc(t)):("numbered"===e&&cc(t),"bulleted"===e&&hc(t),"checklist"===e&&dc(t,i)),t.history.save()}}),t.container.on("click",(e=>{const i=e;if(!i.target)return;const n=I(i.target);"li"===n.name&&""!==n.attr("value")&&i.offsetX<=18&&(n.attr("value",("true"!==n.attr("value")).toString()),t.history.save())}))})),Sr.plugin.add((t=>{t.command.add("align",{selectedValues:t=>{let e;for(const i of t)if(i.node.isBlock){e=i.node.computedCSS("text-align");break}return e?[pc[e]||e]:[]},execute:e=>{t.selection.setBlocks({"text-align":e}),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("indent",{execute:e=>{const i=t.selection.range.getBlocks();for(const t of i)F(t,e);t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("bold",{isDisabled:t=>!!t.find((t=>t.node.isHeading)),isSelected:t=>!!t.find((t=>t.name===uc)),execute:()=>{t.command.isSelected("bold")?t.selection.removeMark(`<${uc} />`):t.selection.addMark(`<${uc} />`),t.history.save()}}),t.keystroke.setKeydown("mod+b",(e=>{e.preventDefault(),t.command.execute("bold")}))})),Sr.plugin.add((t=>{t.command.add("italic",{isSelected:t=>!!t.find((t=>"i"===t.name)),execute:()=>{t.command.isSelected("italic")?t.selection.removeMark("<i />"):t.selection.addMark("<i />"),t.history.save()}}),t.keystroke.setKeydown("mod+i",(e=>{e.preventDefault(),t.command.execute("italic")}))})),Sr.plugin.add((t=>{t.command.add("underline",{isSelected:t=>!!t.find((t=>"u"===t.name)),execute:()=>{t.command.isSelected("underline")?t.selection.removeMark("<u />"):t.selection.addMark("<u />"),t.history.save()}}),t.keystroke.setKeydown("mod+u",(e=>{e.preventDefault(),t.command.execute("underline")}))})),Sr.plugin.add((t=>{t.command.add("strikethrough",{isSelected:t=>!!t.find((t=>"s"===t.name)),execute:()=>{t.command.isSelected("strikethrough")?t.selection.removeMark("<s />"):t.selection.addMark("<s />"),t.history.save()}}),t.keystroke.setKeydown("mod+shift+x",(e=>{e.preventDefault(),t.command.execute("strikethrough")}))})),Sr.plugin.add((t=>{t.command.add("subscript",{isSelected:t=>!!t.find((t=>t.name===mc)),execute:()=>{t.command.isSelected("subscript")?t.selection.removeMark(`<${mc} />`):t.selection.addMark(`<${mc} />`),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("superscript",{isSelected:t=>!!t.find((t=>t.name===fc)),execute:()=>{t.command.isSelected("superscript")?t.selection.removeMark(`<${fc} />`):t.selection.addMark(`<${fc} />`),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("code",{isSelected:t=>!!t.find((t=>t.name===gc)),execute:()=>{t.command.isSelected("code")?t.selection.removeMark(`<${gc} />`):t.selection.addMark(`<${gc} />`),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("fontFamily",{selectedValues:t=>{for(const e of t)if("span"===e.name){return[e.node.css("font-family").replace(/['"]/g,"")]}return[]},execute:e=>{t.selection.addMark(`<span style="font-family: ${e};" />`),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("fontSize",{isDisabled:t=>!!t.find((t=>t.node.isHeading)),selectedValues:t=>{for(const e of t)if("span"===e.name){return[e.node.css("font-size").replace(/\.\d+/,"")]}return[]},execute:e=>{t.selection.addMark(`<span style="font-size: ${e};" />`),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("fontColor",{selectedValues:t=>{for(const e of t)if("span"===e.name){return[d(e.node.computedCSS("color"))]}return[]},execute:e=>{t.selection.addMark(`<span style="color: ${e};" />`),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("highlight",{selectedValues:t=>{for(const e of t)if("span"===e.name){return[d(e.node.computedCSS("background-color"))]}return[]},execute:e=>{t.selection.addMark(`<span style="background-color: ${e};" />`),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("removeFormat",{execute:()=>{t.selection.removeMark(),t.history.save()}})})),Sr.plugin.add((t=>{t.command.add("formatPainter",{execute:()=>{t.container.addClass(wc);const e=t.selection.getAppliedItems();for(const t of e){const e=t.node.clone();e.isMark&&"a"!==e.name&&vc.push(e)}}}),t.container.on("click",(()=>{if(t.container.removeClass(wc),0!==vc.length){for(const e of vc)t.selection.addMark(e);vc=[],t.history.save()}})),t.event.on("click",(e=>{if(e.isInside)return;e.closest('button[name="formatPainter"]').length>0||(t.container.removeClass(wc),vc=[])}))})),Sr.plugin.add((t=>{const e=new yc(t.popupContainer);e.event.on("save",(e=>{const i=t.selection.range;i.setStartAfter(e),i.collapseToStart(),t.selection.addRangeToNativeSelection(),t.history.save()})),e.event.on("remove",(e=>{const i=t.selection.range;i.setStartAfter(e),i.collapseToStart(),t.selection.addRangeToNativeSelection(),t.history.save()})),t.root.on("scroll",(()=>{e.updatePosition()})),t.event.on("resize",(()=>{e.updatePosition()})),t.event.on("click",(t=>{if(t.closest('button[name="link"]').length>0)return;const i=t.closest("a");0!==i.length?i.isOutside||i.closest("lake-box").length>0||e.show(i):e.hide()})),t.command.add("link",{execute:()=>{const i=t.selection.insertLink(`<a href="">${$r.link.newLink()}</a>`);i&&(t.history.save(),e.show(i))}})})),Sr.plugin.add((t=>{t.event.on("beforepaste",(t=>{new mt(t).find("hr").each((t=>{const e=I(t),i=new Qt("hr");e.replaceWith(i.node)}))})),t.command.add("hr",{execute:()=>{t.insertBox("hr"),t.history.save()}})})),Sr.plugin.add((t=>{t.event.on("beforepaste",(t=>{new mt(t).find("img").each((t=>{const e=I(t),i=new Qt("image"),n=e.attr("data-lake-value");""===n?i.value={url:e.attr("src"),status:"done"}:i.node.attr("value",n),e.replaceWith(i.node)}))})),t.command.add("image",{execute:e=>{t.insertBox("image",e),t.history.save()}})})),Sr.plugin.add((t=>{window.CodeMirror&&t.command.add("codeBlock",{execute:e=>{const i=t.insertBox("codeBlock",e);t.history.save();i.getData("codeEditor").focus()}})})),Sr.plugin.add((t=>{t.keystroke.setKeydown("space",(e=>{const i=t.selection.range;if(i.isBox)return;const n=function(t){const e=t.selection.range;let i=e.startNode,n=e.startOffset;if(0!==n){if(i.isElement){const t=i.children()[n-1];if(!t||!t.isText)return;i=t,n=i.text().length}if(!(n<1))return{node:i,offset:n}}}(t);if(!n)return;if(function(t,e){const i=t.selection,n=i.range,s=e.offset,o=e.node.text().slice(0,s);for(const e of bc){const r=e.re.exec(o);if(null!==r){const o=e.getParameters(),a=o.shift();if(!t.command.has(a))return!1;t.prepareOperation();const l=i.insertBookmark(),c=l.focus.prev(),h=c.text(),d=`${h.replace(e.re,"$1")}​`;return c.get(0).nodeValue=d,n.setStart(c,s-r[0].length),n.setEnd(c,s-(h.length-d.length)-1),t.command.execute(a,...o),i.toBookmark(l),t.commitOperation(),!0}}return!1}(t,n))return void e.preventDefault();const s=i.getBlocks()[0];s&&(s.isHeading||"p"===s.name)&&function(t,e){const i=t.selection,n=e.offset;let s=e.node.text().slice(0,n);s=s.replace(/[\u200B\u2060]/g,"");for(const e of kc){const n=e.re.exec(s);if(null!==n){const s=e.getParameters(n),o=s.shift();if(!t.command.has(o))return!1;t.prepareOperation();const r=i.insertBookmark();r.focus.prev().remove();const a=r.focus.closestBlock();return Sc(a),i.range.shrinkAfter(a),t.command.execute(o,...s),i.toBookmark(r),t.commitOperation(),!0}}return!1}(t,n)&&e.preventDefault()})),t.keystroke.setKeydown("enter",(e=>{const i=t.selection.range;if(i.isBox)return;const n=i.getBlocks()[0];return!n||!n.isHeading&&"p"!==n.name||n.find("lake-box").length>0||""!==i.getEndText()?void 0:function(t,e){const i=t.selection;let n=e.text();n=n.replace(/[\u200B\u2060]/g,"");for(const s of _c){const o=s.re.exec(n);if(null!==o){const n=s.getParameters(o),r=n.shift();return!!t.command.has(r)&&(t.prepareOperation(),e.empty(),Sc(e),i.range.shrinkAfter(e),t.command.execute(r,...n),t.commitOperation(),!0)}}return!1}(t,n)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0}))})),Sr.plugin.add((t=>{t.keystroke.setKeydown("enter",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(e.preventDefault(),t.rectifyContent(),i.isBox)return Cc(t),void t.history.save();if(i.adapt(),i.isInoperative)return;if(i.isBox)return Cc(t),void t.history.save();let n=i.getBlocks()[0];if(n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),n.isEmpty&&"p"!==n.name)return t.selection.setBlocks("<p />"),void t.history.save();Ac(t,n),t.history.save()}))})),Sr.plugin.add((t=>{t.keystroke.setKeydown("shift+enter",(e=>{const i=t.selection.range;if(!i.isInsideBox){if(t.rectifyContent(),e.preventDefault(),i.isBox)return Ec(t),void t.history.save();if(i.adapt(),!i.isInoperative){if(i.isBox)return Ec(t),void t.history.save();Bc(t),t.history.save()}}}))})),Sr.plugin.add((t=>{t.keystroke.setKeydown("backspace",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxStart){const n=i.startNode.closest("lake-box"),s=n.prev();if(0===s.length){const i=n.closestBlock();return void(i.length>0&&!i.isContainer&&(e.preventDefault(),Tc(t,i),t.history.save()))}if(s.isBlock)return s.isEmpty?(e.preventDefault(),s.remove(),t.selection.fixList(),void t.history.save()):(e.preventDefault(),void i.shrinkAfter(s));i.adaptBox()}if(i.isBox)return e.preventDefault(),t.removeBox(),void t.history.save();if(!i.isCollapsed)return e.preventDefault(),t.selection.deleteContents(),""===t.container.html().trim()&&t.setValue("<p><br /><focus /></p>"),void t.history.save();i.adapt();const n=i.getPrevNode();if(n.isBox)return e.preventDefault(),i.selectBox(n),t.removeBox(),void t.history.save();if("br"===n.name&&n.prev().length>0)return e.preventDefault(),i.setStartBefore(n),i.collapseToStart(),n.remove(),void t.history.save();if(""===i.getStartText()){e.preventDefault();let n=i.getBlocks()[0];if(n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),""!==n.css("margin-left")||""!==n.css("text-indent")||""!==n.attr("indent"))return F(n,"decrease"),void t.history.save();if(n.isList||"blockquote"===n.name)return t.selection.setBlocks("<p />"),void t.history.save();Tc(t,n),t.history.save()}}))})),Sr.plugin.add((t=>{t.keystroke.setKeydown("delete",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxEnd){const n=i.startNode.closest("lake-box"),s=n.next();if(0===s.length){const i=n.closestBlock();return void(i.length>0&&!i.isContainer&&(e.preventDefault(),Ic(t,i),t.history.save()))}if(s.isBlock)return s.isEmpty?(e.preventDefault(),s.remove(),t.selection.fixList(),void t.history.save()):(e.preventDefault(),void i.shrinkBefore(s));i.adaptBox()}if(i.isBox)return e.preventDefault(),t.removeBox(),void t.history.save();if(!i.isCollapsed)return e.preventDefault(),t.selection.deleteContents(),""===t.container.html().trim()&&t.setValue("<p><br /><focus /></p>"),void t.history.save();i.adapt();const n=i.getNextNode();if(n.isBox)return e.preventDefault(),i.selectBox(n),t.removeBox(),void t.history.save();"br"===n.name&&n.next().length>0&&(e.preventDefault(),i.setStartBefore(n),i.collapseToStart(),n.remove(),t.history.save());if(""===i.getEndText()){e.preventDefault();let n=i.getBlocks()[0];n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),Ic(t,n),t.history.save()}}))})),Sr.plugin.add((t=>{t.keystroke.setKeydown("tab",(e=>{if(!1===t.config.indentWithTab)return;e.preventDefault();t.selection.range.getBlocks().forEach((t=>{"p"===t.name&&"2em"!==t.css("text-indent")?t.css("text-indent","2em"):F(t,"increase")})),t.history.save()}))})),Sr.plugin.add((t=>{t.keystroke.setKeydown("arrow-left",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(i.isBoxStart){const t=n.prev();return t.isBlock||t.isBox?(e.preventDefault(),t.isInlineBox?void i.selectBox(t):void i.shrinkAfter(t)):(i.setStartBefore(n),void i.collapseToStart())}return i.isBoxEnd?(e.preventDefault(),void i.selectBox(n)):(e.preventDefault(),void i.selectBoxStart(n))}if(!i.isCollapsed)return;const s=i.getPrevNode();s.isBox&&(e.preventDefault(),i.selectBox(s))})),t.keystroke.setKeydown("arrow-right",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(i.isBoxStart)return e.preventDefault(),void i.selectBox(n);if(i.isBoxEnd){const t=n.next();return t.isBlock||t.isBox?(e.preventDefault(),t.isInlineBox?void i.selectBox(t):void i.shrinkBefore(t)):(i.setStartAfter(n),void i.collapseToStart())}return e.preventDefault(),void i.selectBoxEnd(n)}if(!i.isCollapsed)return;const s=i.getNextNode();s.isBox&&(e.preventDefault(),i.selectBox(s))})),t.keystroke.setKeydown("arrow-up",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(n.isBlockBox){const t=n.prev();if(t.isBlock||t.isBox)return e.preventDefault(),void i.shrinkAfter(t)}i.setStartBefore(n),i.collapseToStart()}})),t.keystroke.setKeydown("arrow-down",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(n.isBlockBox){const t=n.next();if(t.isBlock||t.isBox)return e.preventDefault(),void i.shrinkBefore(t)}i.setStartAfter(n),i.collapseToStart()}}))})),Sr.plugin.add((t=>{t.keystroke.setKeydown("escape",(e=>{const i=t.selection,n=i.range;if(n.isBoxCenter||n.isInsideBox){e.preventDefault();const t=n.commonAncestor.closest("lake-box");return n.selectBoxEnd(t),void i.addRangeToNativeSelection()}t.root.hasClass("lake-root-focused")&&(e.preventDefault(),t.blur())}))})),t.Box=Qt,t.Button=ke,t.Dropdown=_e,t.Editor=Sr,t.Fragment=mt,t.HTMLParser=ie,t.Nodes=T,t.Range=L,t.TextParser=ne,t.Toolbar=class{constructor(t){this.allMenuMap=new Map,this.buttonItemList=[],this.dropdownItemList=[],this.items=t.items||Jr,this.root=I(t.root),this.container=I('<div class="lake-toolbar" />'),this.root.addClass("lake-custom-properties")}appendDivider(){this.container.append('<div class="lake-toolbar-divider" />')}appendButton(t,e){new ke({root:this.container,name:e.name,icon:e.icon,tooltip:e.tooltip,tabIndex:-1,onClick:()=>{t.focus(),e.onClick(t,e.name)}}).render()}appendDropdown(t,e){new _e({root:this.container,name:e.name,icon:e.icon,accentIcon:e.accentIcon,downIcon:e.downIcon,defaultValue:e.defaultValue,tooltip:e.tooltip,width:e.width,menuType:e.menuType,menuItems:e.menuItems,tabIndex:-1,onSelect:i=>{t.focus(),e.onSelect(t,i)}}).render()}appendUpload(t,e){const i=I(a`
70
+ <div class="lake-upload" name="${e.name}">
71
71
  <input type="file" />
72
72
  </div>
73
- `),n=i.find('input[type="file"]'),s=n.get(0);t.accept&&n.attr("accept",t.accept),!0===t.multiple&&n.attr("multiple","true");new ke({root:i,name:t.name,icon:t.icon,tooltip:t.tooltip,tabIndex:-1,onClick:()=>{e.focus(),s.click()}}).render(),this.container.append(i),n.on("click",(t=>t.stopPropagation())),n.on("change",(t=>{const i=t.target.files||[];for(const t of i)Qi({editor:e,file:t})}))}render(){const t=this.editor;this.root.empty(),this.root.append(this.container);const e=new Map,i=[],n=[];this.items.forEach((t=>{if("|"===t)return void this.appendDivider();let s;if("string"==typeof t){if(s=en.get(t),!s)return}else s=t;return"button"===s.type?(i.push(s),void this.appendButton(s)):"dropdown"===s.type?(e.set(s.name,_e.getMenuMap(s.menuItems)),n.push(s),void this.appendDropdown(s)):void("upload"===s.type&&this.appendUpload(s))})),t.event.on("statechange",(t=>{var s;const{appliedItems:o,disabledNameMap:r,selectedNameMap:a,selectedValuesMap:l}=t;for(const t of i){const e="lake-button-selected",i=this.container.find(`button[name="${t.name}"]`);let n=r.get(t.name);if(void 0===n&&(n=!!(t.isDisabled&&o.length>0)&&t.isDisabled(o)),n?(i.attr("disabled","true"),i.removeClass(e)):i.removeAttr("disabled"),!n){let n=a.get(t.name);void 0===n&&(n=!!(t.isSelected&&o.length>0)&&t.isSelected(o)),n?i.addClass(e):i.removeClass(e)}}for(const t of n){let i=l.get(t.name);void 0===i&&(i=t.selectedValues&&o.length>0?t.selectedValues(o):[]);const n=this.container.find(`div.lake-dropdown[name="${t.name}"]`);let a=r.get(t.name);if(void 0===a&&(a=!!(t.isDisabled&&o.length>0)&&t.isDisabled(o)),a?n.attr("disabled","true"):n.removeAttr("disabled"),!a){_e.setValue(n,i);const o=n.find(".lake-dropdown-text");if(o.length>0){const n=i[0]||t.defaultValue,r=e.get(t.name),a=null!==(s=r&&r.get(n))&&void 0!==s?s:n;o.text(a)}}}}))}},t.Utils=ut,t.addMark=we,t.deleteContents=he,t.fixList=le,t.icons=n,t.insertBookmark=oe,t.insertContents=de,t.insertFragment=ce,t.insertLink=be,t.insertNode=se,t.removeMark=xe,t.setBlocks=pe,t.splitBlock=ue,t.splitMarks=ge,t.toBookmark=ae,t}({});
73
+ `),n=i.find('input[type="file"]'),s=n.get(0);e.accept&&n.attr("accept",e.accept),!0===e.multiple&&n.attr("multiple","true");new ke({root:i,name:e.name,icon:e.icon,tooltip:e.tooltip,tabIndex:-1,onClick:()=>{t.focus(),s.click()}}).render(),this.container.append(i),n.on("click",(t=>t.stopPropagation())),n.on("change",(e=>{const i=e.target.files||[];for(const e of i)Xr({editor:t,file:e})}))}updateState(t){var e;const{appliedItems:i,disabledNameMap:n,selectedNameMap:s,selectedValuesMap:o}=t;for(const t of this.buttonItemList){const e="lake-button-selected",o=this.container.find(`button[name="${t.name}"]`);let r=n.get(t.name);if(void 0===r&&(r=!!(t.isDisabled&&i.length>0)&&t.isDisabled(i)),r?(o.attr("disabled","true"),o.removeClass(e)):o.removeAttr("disabled"),!r){let n=s.get(t.name);void 0===n&&(n=!!(t.isSelected&&i.length>0)&&t.isSelected(i)),n?o.addClass(e):o.removeClass(e)}}for(const t of this.dropdownItemList){let s=o.get(t.name);void 0===s&&(s=t.selectedValues&&i.length>0?t.selectedValues(i):[]);const r=this.container.find(`div.lake-dropdown[name="${t.name}"]`);let a=n.get(t.name);if(void 0===a&&(a=!!(t.isDisabled&&i.length>0)&&t.isDisabled(i)),a?r.attr("disabled","true"):r.removeAttr("disabled"),!a){_e.setValue(r,s);const i=r.find(".lake-dropdown-text");if(i.length>0){const n=s[0]||t.defaultValue,o=this.allMenuMap.get(t.name),r=null!==(e=o&&o.get(n))&&void 0!==e?e:n;i.text(r)}}}}render(t){this.root.empty(),this.root.append(this.container),this.items.forEach((e=>{if("|"===e)return void this.appendDivider();let i;if("string"==typeof e){if(i=Yr.get(e),!i)return}else i=e;return"button"===i.type?(this.buttonItemList.push(i),void this.appendButton(t,i)):"dropdown"===i.type?(this.allMenuMap.set(i.name,_e.getMenuMap(i.menuItems)),this.dropdownItemList.push(i),void this.appendDropdown(t,i)):void("upload"===i.type&&this.appendUpload(t,i))}))}},t.Utils=ut,t.addMark=we,t.deleteContents=ce,t.fixList=le,t.icons=n,t.insertBookmark=oe,t.insertContents=de,t.insertFragment=he,t.insertLink=be,t.insertNode=se,t.removeMark=xe,t.setBlocks=pe,t.splitBlock=ue,t.splitMarks=ge,t.toBookmark=ae,t}({});
74
74
  //# sourceMappingURL=lake.min.js.map