lakelib 0.1.24 → 0.1.25
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 +3 -3
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.js +15 -15
- package/lib/lake.js.map +1 -1
- package/lib/types/i18n/types.d.ts +6 -6
- package/package.json +20 -20
package/dist/lake.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Lake=function(e){"use strict";class t extends HTMLElement{}void 0!==customElements.get("lake-box")&&customElements.define("lake-box",t);class i extends HTMLElement{}void 0!==customElements.get("lake-bookmark")&&customElements.define("lake-bookmark",i);const n=new Map([["plus",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm48-88a8,8,0,0,1-8,8H136v32a8,8,0,0,1-16,0V136H88a8,8,0,0,1,0-16h32V88a8,8,0,0,1,16,0v32h32A8,8,0,0,1,176,128Z"></path></svg>'],["more",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["left",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"></path></svg>'],["right",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path></svg>'],["down",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"></path></svg>'],["check",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"></path></svg>'],["checkCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>'],["warningCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"></path></svg>'],["file",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"></path></svg>'],["open",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6.25 4.5A1.75 1.75 0 0 0 4.5 6.25v11.5c0 .966.783 1.75 1.75 1.75h11.5a1.75 1.75 0 0 0 1.75-1.75v-4a.75.75 0 0 1 1.5 0v4A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25A3.25 3.25 0 0 1 6.25 3h4a.75.75 0 0 1 0 1.5h-4ZM13 3.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 .75.75v6.5a.75.75 0 0 1-1.5 0V5.56l-5.22 5.22a.75.75 0 0 1-1.06-1.06l5.22-5.22h-4.69a.75.75 0 0 1-.75-.75Z" fill="#000000"/></svg>'],["download",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"></path></svg>'],["copy",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"></path></svg>'],["remove",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"></path></svg>'],["maximize",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,80v32a8,8,0,0,1-16,0V88H160a8,8,0,0,1,0-16h32A8,8,0,0,1,200,80ZM96,168H72V144a8,8,0,0,0-16,0v32a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16ZM232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"></path></svg>'],["close",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path></svg>'],["zoomIn",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["zoomOut",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["circleNotch",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"></path></svg>'],["selectAll",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M104,40a8,8,0,0,1,8-8h32a8,8,0,0,1,0,16H112A8,8,0,0,1,104,40Zm40,168H112a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM208,32H184a8,8,0,0,0,0,16h24V72a8,8,0,0,0,16,0V48A16,16,0,0,0,208,32Zm8,72a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V112A8,8,0,0,0,216,104Zm0,72a8,8,0,0,0-8,8v24H184a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V184A8,8,0,0,0,216,176ZM40,152a8,8,0,0,0,8-8V112a8,8,0,0,0-16,0v32A8,8,0,0,0,40,152Zm32,56H48V184a8,8,0,0,0-16,0v24a16,16,0,0,0,16,16H72a8,8,0,0,0,0-16ZM40,80a8,8,0,0,0,8-8V48H72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,48V72A8,8,0,0,0,40,80ZM176,184H80a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8h96a8,8,0,0,1,8,8v96A8,8,0,0,1,176,184Zm-8-96H88v80h80Z"></path></svg>'],["undo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,144a64.07,64.07,0,0,1-64,64H80a8,8,0,0,1,0-16h88a48,48,0,0,0,0-96H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48A8,8,0,0,1,85.66,45.66L51.31,80H168A64.07,64.07,0,0,1,232,144Z"></path></svg>'],["redo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.34,130.34,204.69,96H88a48,48,0,0,0,0,96h88a8,8,0,0,1,0,16H88A64,64,0,0,1,88,80H204.69L170.34,45.66a8,8,0,0,1,11.32-11.32l48,48a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32-11.32Z"></path></svg>'],["heading",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,56V200a8,8,0,0,1-16,0V136H64v64a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v64H192V56a8,8,0,0,1,16,0Z"></path></svg>'],["heading1",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm75.77,49a8,8,0,0,0-8.21.39l-24,16a8,8,0,1,0,8.88,13.32L216,127V208a8,8,0,0,0,16,0V112A8,8,0,0,0,227.77,105Z"></path></svg>'],["heading2",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm88,144H208l33.55-44.74a32,32,0,1,0-55.73-29.93,8,8,0,1,0,15.08,5.34,16.28,16.28,0,0,1,2.32-4.3,16,16,0,1,1,25.54,19.27L185.6,203.2A8,8,0,0,0,192,216h48a8,8,0,0,0,0-16Z"></path></svg>'],["heading3",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm73.52,90.63,21-30A8,8,0,0,0,240,104H192a8,8,0,0,0,0,16h32.63l-19.18,27.41A8,8,0,0,0,212,160a20,20,0,1,1-14.29,34,8,8,0,1,0-11.42,11.19A36,36,0,0,0,248,180,36.07,36.07,0,0,0,225.52,146.63Z"></path></svg>'],["heading4",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,112h-8V144a8,8,0,0,0-16,0v24H195.1l20.49-61.47a8,8,0,0,0-15.18-5.06l-24,72A8,8,0,0,0,184,184h40v24a8,8,0,0,0,16,0V184h8a8,8,0,0,0,0-16Z"></path></svg>'],["heading5",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm60,88a38.8,38.8,0,0,0-9.41,1.14L206.78,120H240a8,8,0,0,0,0-16H200a8,8,0,0,0-7.89,6.68l-8,48a8,8,0,0,0,13.6,6.92A19.73,19.73,0,0,1,212,160a20,20,0,0,1,0,40,19.73,19.73,0,0,1-14.29-5.6,8,8,0,1,0-11.42,11.2A35.54,35.54,0,0,0,212,216a36,36,0,0,0,0-72Z"></path></svg>'],["heading6",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,124a36,36,0,1,1-67.34-17.68c.07-.14.14-.28.22-.42l32.25-54a8,8,0,0,1,13.74,8.2l-16.69,28c.6,0,1.21-.05,1.82-.05A36,36,0,0,1,248,180Zm-16,0a20,20,0,1,0-20,20A20,20,0,0,0,232,180Z"></path></svg>'],["paragraph",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,40H96a64,64,0,0,0,0,128h40v40a8,8,0,0,0,16,0V56h24V208a8,8,0,0,0,16,0V56h16a8,8,0,0,0,0-16ZM136,152H96a48,48,0,0,1,0-96h40Z"></path></svg>'],["blockQuote",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M100,56H40A16,16,0,0,0,24,72v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,100,56Zm0,80H40V72h60ZM216,56H156a16,16,0,0,0-16,16v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,216,56Zm0,80H156V72h60Z"></path></svg>'],["list",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M88,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Zm128,56H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM56,56H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Z"></path></svg>'],["numberedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM104,72H216a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16ZM216,184H104a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM43.58,55.16,48,52.94V104a8,8,0,0,0,16,0V40a8,8,0,0,0-11.58-7.16l-16,8a8,8,0,0,0,7.16,14.32ZM79.77,156.72a23.73,23.73,0,0,0-9.6-15.95,24.86,24.86,0,0,0-34.11,4.7,23.63,23.63,0,0,0-3.57,6.46,8,8,0,1,0,15,5.47,7.84,7.84,0,0,1,1.18-2.13,8.76,8.76,0,0,1,12-1.59A7.91,7.91,0,0,1,63.93,159a7.64,7.64,0,0,1-1.57,5.78,1,1,0,0,0-.08.11L33.59,203.21A8,8,0,0,0,40,216H72a8,8,0,0,0,0-16H56l19.08-25.53A23.47,23.47,0,0,0,79.77,156.72Z"></path></svg>'],["bulletedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z"></path></svg>'],["checklist",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H128a8,8,0,0,1,0-16h88A8,8,0,0,1,224,128ZM128,72h88a8,8,0,0,0,0-16H128a8,8,0,0,0,0,16Zm88,112H128a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16ZM82.34,42.34,56,68.69,45.66,58.34A8,8,0,0,0,34.34,69.66l16,16a8,8,0,0,0,11.32,0l32-32A8,8,0,0,0,82.34,42.34Zm0,64L56,132.69,45.66,122.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Zm0,64L56,196.69,45.66,186.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Z"></path></svg>'],["alignLeft",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,48H168a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm176,24H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-48,40H40a8,8,0,0,0,0,16H168a8,8,0,0,0,0-16Z"></path></svg>'],["alignCenter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM64,96a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Zm152,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-24,40H64a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Z"></path></svg>'],["alignRight",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["alignJustify",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["increaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM34.34,141.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0,0-11.32l-40-40A8,8,0,0,0,34.34,61.66L68.69,96,34.34,130.34A8,8,0,0,0,34.34,141.66Z"></path></svg>'],["decreaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM72,144a8,8,0,0,0,5.66-13.66L43.31,96,77.66,61.66A8,8,0,0,0,66.34,50.34l-40,40a8,8,0,0,0,0,11.32l40,40A8,8,0,0,0,72,144Z"></path></svg>'],["formatPainter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,88H216V64a16,16,0,0,0-16-16H48A16,16,0,0,0,32,64V88H16a8,8,0,0,0,0,16H32v24a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V104h16v50L131.6,182.65A16.07,16.07,0,0,0,120,198v34a8,8,0,0,0,16,0V198l100.4-28.68A16.07,16.07,0,0,0,248,154V104A16,16,0,0,0,232,88Zm-32,40H48V64H200v64Z"></path></svg>'],["bold",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.48,115.7A44,44,0,0,0,140,40H72a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8h80a48,48,0,0,0,18.48-92.3ZM80,56h60a28,28,0,0,1,0,56H80Zm72,136H80V128h72a32,32,0,0,1,0,64Z"></path></svg>'],["italic",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,56a8,8,0,0,1-8,8H157.77L115.1,192H144a8,8,0,0,1,0,16H64a8,8,0,0,1,0-16H98.23L140.9,64H112a8,8,0,0,1,0-16h80A8,8,0,0,1,200,56Z"></path></svg>'],["underline",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,224a8,8,0,0,1-8,8H64a8,8,0,0,1,0-16H192A8,8,0,0,1,200,224Zm-72-24a64.07,64.07,0,0,0,64-64V56a8,8,0,0,0-16,0v80a48,48,0,0,1-96,0V56a8,8,0,0,0-16,0v80A64.07,64.07,0,0,0,128,200Z"></path></svg>'],["strikethrough",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"></path></svg>'],["superscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.736 3.5c-.543 0-.986.495-.986 1.023a.75.75 0 0 1-1.5 0C16.25 3.278 17.258 2 18.736 2c.855 0 1.684.4 2.15 1.117.49.751.5 1.724-.057 2.672-.285.484-.673.847-1.045 1.141-.187.148-.379.284-.557.41l-.078.056a17.45 17.45 0 0 0-.432.311c-.356.268-.619.511-.78.793h2.514a.75.75 0 0 1 0 1.5H17a.75.75 0 0 1-.75-.75c0-1.396.821-2.182 1.565-2.741.157-.119.32-.234.472-.341l.074-.052c.177-.126.34-.243.493-.363.306-.242.532-.47.682-.724.31-.53.229-.886.093-1.094-.158-.244-.486-.435-.893-.435Z" fill="#000000"/><path d="M15.26 4.71c.06.562.385 1.043.847 1.318L10.987 12l5.583 6.512a.75.75 0 1 1-1.14.976L10 13.152l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 1 1 1.139-.976L10 10.848l5.26-6.137Z" fill="#000000"/></svg>'],["subscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16.488 4.43a.75.75 0 0 1 .082 1.058L10.988 12l5.032 5.871c-.302.41-.555.906-.682 1.51L10 13.151l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 0 1 1.139-.976L10 10.848l5.43-6.336a.75.75 0 0 1 1.058-.081ZM17.75 15.523c0-.528.444-1.023.986-1.023.407 0 .735.19.893.434.136.21.218.566-.093 1.095-.15.255-.376.482-.682.724-.152.12-.316.237-.493.363l-.074.052c-.152.107-.315.222-.472.34-.744.56-1.565 1.346-1.565 2.742 0 .414.336.75.75.75h3.451a.75.75 0 0 0 0-1.5h-2.513c.16-.282.423-.525.779-.793.137-.103.279-.203.432-.312l.078-.054c.178-.127.37-.264.557-.41.372-.295.76-.658 1.045-1.142.557-.948.546-1.921.058-2.672C20.42 13.4 19.59 13 18.736 13c-1.478 0-2.486 1.278-2.486 2.523a.75.75 0 0 0 1.5 0Z" fill="#000000"/></svg>'],["code",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M93.31,70,28,128l65.27,58a8,8,0,1,1-10.62,12l-72-64a8,8,0,0,1,0-12l72-64A8,8,0,1,1,93.31,70Zm152,52-72-64a8,8,0,0,0-10.62,12L228,128l-65.27,58a8,8,0,1,0,10.62,12l72-64a8,8,0,0,0,0-12Z"></path></svg>'],["removeFormat",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M225,80.4,183.6,39a24,24,0,0,0-33.94,0L31,157.66a24,24,0,0,0,0,33.94l30.06,30.06A8,8,0,0,0,66.74,224H216a8,8,0,0,0,0-16h-84.7L225,114.34A24,24,0,0,0,225,80.4ZM108.68,208H70.05L42.33,180.28a8,8,0,0,1,0-11.31L96,115.31,148.69,168Zm105-105L160,156.69,107.31,104,161,50.34a8,8,0,0,1,11.32,0l41.38,41.38a8,8,0,0,1,0,11.31Z"></path></svg>'],["moreStyle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["fontColor",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><polyline points="192 168 128 32 64 168" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="173.18" y1="128" x2="82.82" y2="128" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["fontColorAccent",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="40" y1="216" x2="216" y2="216" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["highlight",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.38 14.003A2.5 2.5 0 0 0 2 16.5v3A2.5 2.5 0 0 0 4.5 22h15a2.5 2.5 0 0 0 2.5-2.5v-3a2.5 2.5 0 0 0-2.5-2.5h-5.954l-1.316 1.314a3.237 3.237 0 0 1-.203.186H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869 2 2 0 0 1 .092-.744l.285-.884Z" fill="#000000"/><path d="M18.648 2.944a3.218 3.218 0 0 1-.002 4.551l-7.123 7.111a2.25 2.25 0 0 1-.942.563l-4.294 1.289a1 1 0 0 1-1.239-1.265l1.362-4.228c.11-.34.298-.65.552-.902l7.132-7.122a3.22 3.22 0 0 1 4.554.003Zm-3.494 1.059-7.133 7.121a.75.75 0 0 0-.184.301l-1.07 3.322 3.382-1.015a.75.75 0 0 0 .315-.187l7.121-7.11a1.718 1.718 0 1 0-2.43-2.432Z" fill="#000000"/></svg>'],["highlightAccent",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.004 15.631a2 2 0 0 0 2.571 1.784l4.293-1.288a3.25 3.25 0 0 0 1.159-.627H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869Z" fill="#000000"/></svg>'],["link",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"></path></svg>'],["unlink",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M190.63,65.37a32,32,0,0,0-45.19-.06L133.79,77.52a8,8,0,0,1-11.58-11l11.72-12.29a1.59,1.59,0,0,1,.13-.13,48,48,0,0,1,67.88,67.88,1.59,1.59,0,0,1-.13.13l-12.29,11.72a8,8,0,0,1-11-11.58l12.21-11.65A32,32,0,0,0,190.63,65.37ZM122.21,178.48l-11.65,12.21a32,32,0,0,1-45.25-45.25l12.21-11.65a8,8,0,0,0-11-11.58L54.19,133.93a1.59,1.59,0,0,0-.13.13,48,48,0,0,0,67.88,67.88,1.59,1.59,0,0,0,.13-.13l11.72-12.29a8,8,0,1,0-11.58-11ZM208,152H184a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16ZM48,104H72a8,8,0,0,0,0-16H48a8,8,0,0,0,0,16Zm112,72a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V184A8,8,0,0,0,160,176ZM96,80a8,8,0,0,0,8-8V48a8,8,0,0,0-16,0V72A8,8,0,0,0,96,80Z"></path></svg>'],["hr",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"></path></svg>'],["codeBlock",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"></path></svg>'],["image",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"></path></svg>'],["video",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M164.44,121.34l-48-32A8,8,0,0,0,104,96v64a8,8,0,0,0,12.44,6.66l48-32a8,8,0,0,0,0-13.32ZM120,145.05V111l25.58,17ZM234.33,69.52a24,24,0,0,0-14.49-16.4C185.56,39.88,131,40,128,40s-57.56-.12-91.84,13.12a24,24,0,0,0-14.49,16.4C19.08,79.5,16,97.74,16,128s3.08,48.5,5.67,58.48a24,24,0,0,0,14.49,16.41C69,215.56,120.4,216,127.34,216h1.32c6.94,0,58.37-.44,91.18-13.11a24,24,0,0,0,14.49-16.41c2.59-10,5.67-28.22,5.67-58.48S236.92,79.5,234.33,69.52Zm-15.49,113a8,8,0,0,1-4.77,5.49c-31.65,12.22-85.48,12-86,12H128c-.54,0-54.33.2-86-12a8,8,0,0,1-4.77-5.49C34.8,173.39,32,156.57,32,128s2.8-45.39,5.16-54.47A8,8,0,0,1,41.93,68c30.52-11.79,81.66-12,85.85-12h.27c.54,0,54.38-.18,86,12a8,8,0,0,1,4.77,5.49C221.2,82.61,224,99.43,224,128S221.2,173.39,218.84,182.47Z"></path></svg>'],["attachment",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"></path></svg>'],["emoji",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216ZM80,108a12,12,0,1,1,12,12A12,12,0,0,1,80,108Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,176,108Zm-1.07,48c-10.29,17.79-27.4,28-46.93,28s-36.63-10.2-46.92-28a8,8,0,1,1,13.84-8c7.47,12.91,19.21,20,33.08,20s25.61-7.1,33.07-20a8,8,0,0,1,13.86,8Z"></path></svg>'],["specialCharacter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 32 32"><path d="M22.7373,25A14.3093,14.3093,0,0,0,27,15C27,8.42,22.58,4,16,4S5,8.42,5,15A14.3093,14.3093,0,0,0,9.2627,25H4v2h8V24.7617A12.5683,12.5683,0,0,1,7,15c0-5.4673,3.5327-9,9-9s9,3.5327,9,9a12.5683,12.5683,0,0,1-5,9.7617V27h8V25Z"/></svg>'],["equation",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M184,72V56H80.65l53.6,67a8,8,0,0,1,0,10l-53.6,67H184V184a8,8,0,0,1,16,0v24a8,8,0,0,1-8,8H64a8,8,0,0,1-6.25-13l60-75-60-75A8,8,0,0,1,64,40H192a8,8,0,0,1,8,8V72a8,8,0,0,1-16,0Z"></path></svg>'],["table",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z"></path></svg>']]);function s(e,...t){let i=e[0];for(let n=0;n<t.length;n++){i+=String(t[n]),i+=e[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}const o=new Map([["&","&"],["<","<"],[">",">"],['"',"""],[" "," "]]);function r(e){return e.replace(/[&<>"\xA0]/g,(e=>{var t;return null!==(t=o.get(e))&&void 0!==t?t:""}))}function a(e,...t){let i=e[0];for(let n=0;n<t.length;n++){i+=r(String(t[n])),i+=e[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}function l(e){const t=e.split("-");let i="";for(let e=0;e<t.length;e++){const n=t[e];i+=e>0?n.charAt(0).toUpperCase()+n.substring(1):n}return i}function c(e,t,i){return void 0===i&&(i=","),(i+e+i).indexOf(i+t+i)>=0}function d(e){const t=(new TextEncoder).encode(e);let i="";return t.forEach((e=>{i+=String.fromCharCode(e)})),window.btoa(i)}function h(e){const t=window.atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return(new TextDecoder).decode(i)}function p(e){const t=Number.parseInt(e,10).toString(16).toLowerCase();return t.length>1?t:`0${t}`}function u(e){return e.replace(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)/gi,((e,t,i,n,s)=>void 0===s?`#${p(t)}${p(i)}${p(n)}`:`#${p(t)}${p(i)}${p(n)}${function(e){const t=Math.round(255*Number.parseFloat(e)).toString(16);return t.length>1?t:`0${t}`}(s)}`))}function m(e){e=e.replace(/"/gi,'"');const t={},i=/\s*([\w-]+)\s*:([^;]*)(;|$)/g;let n;for(;null!==(n=i.exec(e));){const e=n[1].toLowerCase().trim(),i=u(n[2]).trim();t[e]=i}return t}function g(e){return e.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>|$)/gi,"$1</lake-box>").replace(/<anchor\s*\/>/gi,'<lake-bookmark type="anchor"></lake-bookmark>').replace(/<focus\s*\/>/gi,'<lake-bookmark type="focus"></lake-bookmark>')}function f(e){return e.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"<anchor />").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"<focus />")}function v(e,t){if("undefined"==typeof window)return e;const i=(t=null!=t?t:navigator.userAgent).indexOf("Mac OS X")>=0?"⌘":"Ctrl";return e.replace(/(^|\+|\s)mod(\+|\s|$)/g,`$1${i}$2`)}function w(e){let t=0;for(e/=1024;e>1024&&t<2;)e/=1024,t++;return`${e>0?Math.max(e,.1).toFixed(1):0} ${["KB","MB","GB"][t]}`}function y(e,t){const i=l(t),n=window.getComputedStyle(e,null);return u(e.style[i]||n.getPropertyValue(t)||"")}function x(e,t){const i=[];if("string"!=typeof e)return i.push(e),i;if(""===e)return i;if("text"===t){const t=document.createTextNode(e);return i.push(t),i}if("html"===t||/<.+>/.test(e)){const t=document.createElement("div");t.innerHTML=e;for(const e of t.childNodes)i.push(e);return i}const n=document.querySelectorAll(e);for(const e of n)i.push(e);return i}const b=new Set(["h1","h2","h3","h4","h5","h6","div","p","blockquote","ul","ol","li","table","tr","th","td"]),k=new Set(["span","strong","em","i","u","s","sup","sub","code"]),C=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),S=new Set(["h1","h2","h3","h4","h5","h6"]),B=new Set(["ol","ul","li"]),_=new Set(["table","tr","td"]);function A(...e){window.LAKE_DEBUG&&console.log.apply(console.log,e)}const L={};let T=0;class E{constructor(e){e=null!=e?e:[],this.nodeList=Array.isArray(e)?e:[e];for(let e=0;e<this.nodeList.length;e++)this.nodeList[e].lakeId||(this.nodeList[e].lakeId=++T);this.length=this.nodeList.length}get id(){return this.get(0).lakeId}get name(){if(0===this.length)return"";return this.get(0).nodeName.toLowerCase()}get isElement(){if(0===this.length)return!1;return this.get(0).nodeType===Node.ELEMENT_NODE}get isText(){if(0===this.length)return!1;return this.get(0).nodeType===Node.TEXT_NODE}get isBlock(){return 0!==this.length&&b.has(this.name)}get isMark(){return 0!==this.length&&k.has(this.name)}get isVoid(){return 0!==this.length&&C.has(this.name)}get isHeading(){return 0!==this.length&&S.has(this.name)}get isList(){return 0!==this.length&&B.has(this.name)}get isTable(){return 0!==this.length&&_.has(this.name)}get isBookmark(){return"lake-bookmark"===this.name}get isBox(){return"lake-box"===this.name}get isInlineBox(){return this.isBox&&"inline"===this.attr("type")}get isBlockBox(){return this.isBox&&"block"===this.attr("type")}get isContainer(){if(0===this.length)return!1;const e=this.get(0);return this.isElement&&"true"===e.getAttribute("contenteditable")}get isOutside(){return 0===this.closest('[contenteditable="true"]').length}get isInside(){return!this.isOutside&&!this.isContainer}get isTopInside(){if(0===this.length)return!1;const e=this.parent();return 0!==e.length&&(this.isInside&&e.isContainer)}get isContentEditable(){if(0===this.length)return!1;if(this.isText){const e=this.get(0).parentNode;return!!e&&e.isContentEditable}if(!this.isElement)return!1;return this.get(0).isContentEditable}get isIndivisible(){return this.isContainer||this.isTable}get isEmpty(){if(this.isBox)return!1;const e=this.text();if(!(""===e||/^[\r\n\u200B\u2060]+$/.test(e)))return!1;if(this.isElement){if(this.find("lake-box").length>0)return!1;if(this.find("br").length>1)return!1}return!0}get(e){return this.nodeList[e]}getAll(){return this.nodeList}eq(e){const t=this.get(e);return new E(t)}each(e){const t=this.getAll();for(let i=0;i<t.length;i++)if(!1===e(t[i],i))return this;return this}eachElement(e){const t=this.getAll();for(let i=0;i<t.length;i++)if(t[i].nodeType===Node.ELEMENT_NODE&&!1===e(t[i],i))return this;return this}reverse(){const e=this.getAll().reverse();return new E(e)}matches(e){if(!this.isElement)return!1;return this.get(0).matches(e)}contains(e){e instanceof E&&(e=e.get(0));return this.get(0).contains(e)}isSibling(e){if(0===this.length)return!1;const t=this.get(0).parentNode;return t&&t===e.parent().get(0)}find(e){if("string"==typeof e){const t=this.get(0).querySelectorAll(e);return new E(Array.from(t))}let t=this.eq(0);for(const i of e)if(t=t.children()[i],!t)return new E;return t}closest(e){if(this.isText){const t=this.get(0).parentNode;return t?new E(t.closest(e)):new E}if(!this.isElement)return new E;const t=this.get(0);return new E(t.closest(e))}closestBlock(){let e=this.eq(0);for(;e.length>0&&!e.isTopInside&&!e.isBlock;)e=e.parent();return e.isBlock?e:new E}closestOperableBlock(){const e=this.closest("lake-box"),t=e.length>0?e.closestBlock():this.closestBlock();if(0===t.length)return t;if(t.isTable)return new E;const i=t.parent();return"li"===t.name&&i.isList?i:t}closestContainer(){return this.closest('div[contenteditable="true"]')}closestScroller(){let e=this.eq(0);for(;e.length>0&&e.isElement;){if(["scroll","auto"].indexOf(e.computedCSS("overflow-y"))>=0)return e;e=e.parent()}return new E}parent(){const e=this.get(0);return new E(e.parentNode)}prev(){const e=this.get(0);return new E(e.previousSibling)}next(){const e=this.get(0);return new E(e.nextSibling)}first(){const e=this.get(0);return new E(e.firstChild)}last(){const e=this.get(0);return new E(e.lastChild)}index(){let e=-1,t=this.get(0);for(;t;)e++,t=t.previousSibling;return e}path(){const e=[];let t=this.eq(0);if(t.isContainer)return e;for(;t.length>0;){const i=t.parent();if(0===i.length)break;if(e.push(t.index()),i.isContainer)break;t=i}return e.reverse()}children(){const e=[];let t=this.first();for(;t.length>0;)e.push(t),t=t.next();return e}*getWalker(){for(const e of function*e(t){if(t.isBox)return;let i=t.first();for(;i.length>0;){const t=i.next();yield i,yield*e(i),i=t}}(this.eq(0)))yield e}on(e,t){return this.eachElement((i=>{i.addEventListener(e,t,!1);const n=i.lakeId;L[n]||(L[n]=[]),L[n].push({type:e,listener:t})}))}off(e,t){return this.eachElement((i=>{var n;const s=i.lakeId,o=null!==(n=L[s])&&void 0!==n?n:[];for(let n=0;n<o.length;n++){const s=o[n];e&&(e!==s.type||t&&t!==s.listener)||(i.removeEventListener(s.type,s.listener,!1),o[n]={type:"",listener:()=>{}})}L[s]=o.filter((e=>""!==e.type))}))}emit(e,t){return this.eachElement((i=>{const n=i.lakeId,s=L[n];for(const i of s)i.type===e&&i.listener(null!=t?t:new Event(e))}))}getEventListeners(e){const t=this.get(e).lakeId;return L[t]}focus(){return this.get(0).focus(),this}blur(){return this.get(0).blur(),this}clone(e=!1){const t=this.get(0);return new E(t.cloneNode(e))}hasAttr(e){return this.get(0).hasAttribute(e)}attr(e,t){var i;if("object"==typeof e){for(const t of Object.keys(e))this.attr(t,e[t]);return this}if(void 0===t){return null!==(i=this.get(0).getAttribute(e))&&void 0!==i?i:""}return this.eachElement((i=>{i.setAttribute(e,t)}))}removeAttr(e){return this.eachElement((t=>{t.removeAttribute(e)}))}hasClass(e){return c(this.get(0).className,e," ")}addClass(e){if(Array.isArray(e)){for(const t of e)this.addClass(t);return this}return this.eachElement((t=>{c(t.className,e," ")||t.classList.add(e)}))}removeClass(e){if(Array.isArray(e)){for(const t of e)this.removeClass(t);return this}return this.eachElement((t=>{c(t.className,e," ")&&(t.classList.remove(e),""===t.className&&t.removeAttribute("class"))}))}computedCSS(e){return y(this.get(0),e)}css(e,t){if("object"==typeof e){for(const t of Object.keys(e))this.css(t,e[t]);return this}if(void 0===t){return u(this.get(0).style[l(e)])}return this.eachElement((i=>{i.style[l(e)]=t,""===i.getAttribute("style")&&i.removeAttribute("style")}))}width(){return this.get(0).offsetWidth}innerWidth(){const e=Number.parseInt(this.computedCSS("padding-left"),10)||0,t=Number.parseInt(this.computedCSS("padding-right"),10)||0;return this.width()-e-t}height(){return this.get(0).offsetHeight}show(e="block"){return this.css("display",e),this}hide(){return this.css("display","none"),this}html(e){if(void 0===e){return this.get(0).innerHTML}return this.eachElement((t=>{t.innerHTML=e}))}text(e){var t;if(void 0===e){const e=this.get(0);if(this.isText)return null!==(t=e.nodeValue)&&void 0!==t?t:"";return e.innerText.replace(/^\n+|\n+$/,"")}return this.eachElement((t=>{t.innerText=e}))}value(e){if(void 0===e){return this.get(0).value}return this.eachElement((t=>{t.value=e}))}outerHTML(){return this.get(0).outerHTML}empty(){return this.html(""),this}prepend(e){const t=this.get(0);if("string"==typeof e){const i=x(e).reverse();for(const e of i)t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e);return this}return e instanceof E&&(e=e.get(0)),t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e),this}append(e){const t=this.get(0);if("string"==typeof e){const i=x(e);for(const e of i)t.appendChild(e);return this}return e instanceof E&&(e=e.get(0)),t.appendChild(e),this}before(e){const t=this.get(0);if(!t.parentNode)return this;if("string"==typeof e){const i=x(e);for(const e of i)t.parentNode.insertBefore(e,t);return this}return e instanceof E&&(e=e.get(0)),t.parentNode.insertBefore(e,t),this}after(e){const t=this.get(0);if(!t.parentNode)return this;if("string"==typeof e){const i=x(e).reverse();for(const e of i)t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e);return this}return e instanceof E&&(e=e.get(0)),t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e),this}replaceWith(e){const t=this.get(0);if(!t.parentNode)return this;let i;return i=e instanceof E?e.get(0):x(e)[0],t.parentNode.replaceChild(i,t),this}remove(e=!1){return this.each((t=>{if(t.parentNode){if(e){let e=t.firstChild;for(;e;){const i=e.nextSibling;t.parentNode.insertBefore(e,t),e=i}}t.parentNode.removeChild(t)}})),this}splitText(e){if(!this.isText)return new E;const t=this.get(0).splitText(e);return new E(t)}toString(){if(0===this.length)return"";const e=this.get(0);let t=this.isText?e.nodeValue:this.outerHTML();return t&&t.length>50&&(t=`${t.substring(0,50)} ...`),`node (${e.lakeId}): ${t}`}info(){A(this.toString())}}function I(e){if(e instanceof E)return e;const t=x(e);return new E(t)}class M{constructor(e){this.range=null!=e?e:document.createRange()}get startNode(){return new E(this.range.startContainer)}get startOffset(){return this.range.startOffset}get endNode(){return new E(this.range.endContainer)}get endOffset(){return this.range.endOffset}get commonAncestor(){return new E(this.range.commonAncestorContainer)}get isCollapsed(){return this.range.collapsed}get isBox(){return this.commonAncestor.closest("lake-box").length>0}get isBoxStart(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.compareBeforeNode(t)>=0}get isBoxCenter(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.isCollapsed&&this.startNode.get(0)===t.get(0)&&0===this.startOffset}get isBoxEnd(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.compareAfterNode(t)<=0}get isInsideBox(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return(!this.isCollapsed||this.startNode.get(0)!==t.get(0)||0!==this.startOffset)&&(this.compareBeforeNode(t)<0&&this.compareAfterNode(t)>0)}get isInoperative(){if(this.commonAncestor.isOutside)return!0;const e=this.startNode.closest("td"),t=this.endNode.closest("td");return e.length>0&&t.length>0&&e.get(0)!==t.get(0)}get(){return this.range}getRect(){const e=this.clone();let t,i,n;if(e.isCollapsed){let s="left";if(e.startNode.isElement){const t=e.startNode.children();0===t.length?e.selectNode(e.startNode):e.startOffset<t.length?e.setEnd(e.startNode,e.startOffset+1):(e.setStart(e.startNode,e.startOffset-1),s="right")}else if(e.startNode.isText){const t=e.startNode.text();e.startOffset<t.length?e.setEnd(e.startNode,e.startOffset+1):e.startOffset>0&&(e.setStart(e.startNode,e.startOffset-1),s="right")}t=e.get().getBoundingClientRect(),i="left"===s?t.x:t.right,n=1}else t=e.get().getBoundingClientRect(),i=t.x,n=t.width;const s=t.height;return DOMRect.fromRect({x:i,y:s>0?t.y:0,width:n>0?n:1,height:s>0?s:1})}comparePoint(e,t){return this.range.comparePoint(e.get(0),t)}compareBeforeNode(e){const t=new M;return e.isText?t.setStart(e,0):t.setStartBefore(e),t.collapseToStart(),this.comparePoint(t.startNode,t.startOffset)}compareAfterNode(e){var t;const i=new M;if(e.isText){const n=null!==(t=e.get(0).nodeValue)&&void 0!==t?t:"";i.setStart(e,n.length)}else i.setStartAfter(e);return i.collapseToStart(),this.comparePoint(i.startNode,i.startOffset)}intersectsNode(e){return this.range.intersectsNode(e.get(0))}setStart(e,t){this.range.setStart(e.get(0),t)}setStartBefore(e){this.range.setStartBefore(e.get(0))}setStartAfter(e){this.range.setStartAfter(e.get(0))}setEnd(e,t){this.range.setEnd(e.get(0),t)}setEndBefore(e){this.range.setEndBefore(e.get(0))}setEndAfter(e){this.range.setEndAfter(e.get(0))}collapseToStart(){this.range.collapse(!0)}collapseToEnd(){this.range.collapse(!1)}selectNode(e){this.range.selectNode(e.get(0))}selectNodeContents(e){this.range.selectNodeContents(e.get(0))}selectBox(e){const t=e.find(".lake-box-container");if(0===t.length)throw new Error(`The box "${e.attr("name")}" (id=${e.id}) cannot be selected because it has not been rendered yet.`);this.setStart(t,0),this.collapseToStart()}selectBoxStart(e){const t=e.find(".lake-box-strip");if(0===t.length)throw new Error(`The box "${e.attr("name")}" (id=${e.id}) cannot be selected because it has not been rendered yet.`);this.selectNodeContents(t.eq(0)),this.collapseToStart()}selectBoxEnd(e){const t=e.find(".lake-box-strip");if(0===t.length)throw new Error(`The box "${e.attr("name")}" (id=${e.id}) cannot be selected because it has not been rendered yet.`);this.selectNodeContents(t.eq(1)),this.collapseToStart()}shrinkBefore(e){if(e.isBox)return void this.selectBoxStart(e);if(e.isText)return this.setStartBefore(e),void this.collapseToStart();let t;for(this.setStart(e,0);this.startNode.isElement&&(t=this.startNode.children()[0])&&t.isElement&&!t.isVoid;){if(t.isBox)return void this.selectBoxStart(t);this.setStart(t,0)}this.collapseToStart()}shrinkAfter(e){if(e.isBox)return void this.selectBoxEnd(e);if(e.isText)return this.setEndAfter(e),void this.collapseToEnd();let t;for(this.setEnd(e,e.children().length);this.endNode.isElement&&this.endOffset>0&&(t=this.endNode.children()[this.endOffset-1])&&t.isElement&&!t.isVoid;){if(t.isBox)return void this.selectBoxEnd(t);this.setEnd(t,t.children().length)}this.collapseToEnd(),this.adjustBr()}shrink(){const e=this.isCollapsed;let t;for(;this.startNode.isElement&&(t=this.startNode.children()[this.startOffset])&&t.isElement&&!t.isVoid&&!t.isBox;)this.setStart(t,0);if(e)this.collapseToStart();else for(;this.endNode.isElement&&this.endOffset>0&&(t=this.endNode.children()[this.endOffset-1])&&t.isElement&&!t.isVoid&&!t.isBox;)this.setEnd(t,t.children().length)}adjustBox(){const e=this.startNode.closest("lake-box");if(e.length>0){const t=this.clone();t.collapseToStart(),t.isBoxEnd?this.setStartAfter(e):this.setStartBefore(e)}const t=this.endNode.closest("lake-box");if(t.length>0){const e=this.clone();e.collapseToEnd(),e.isBoxStart?this.setEndBefore(t):this.setEndAfter(t)}}adjustTable(){const e=this.startNode.closest("table"),t=this.endNode.closest("table");if(0===e.length&&t.length>0&&t.isInside)return this.setEndBefore(t),void this.shrink();0===t.length&&e.length>0&&e.isInside&&(this.setStartAfter(e),this.shrink())}adjustBlock(){if(!this.isCollapsed){if(this.endNode.isElement&&0===this.endOffset){let e=this.endNode;for(;0===e.prev().length;)e=e.parent();this.setEndBefore(e)}return void this.shrink()}if(this.startNode.isText)return;const e=this.startNode.children()[this.startOffset];e&&(e.isBlockBox||e.isBlock)&&this.shrinkBefore(e)}adjust(){this.adjustBox(),this.adjustTable(),this.adjustBlock()}adjustBr(){if(!this.isCollapsed)return;const e=this.getPrevNode(),t=this.getNextNode();"br"===e.name&&0===t.length&&(this.setStartBefore(e),this.collapseToStart())}getPrevNode(){let e;return e=this.startNode.isText?0===this.startOffset?this.startNode.prev():this.startNode:this.startNode.children()[this.startOffset-1],null!=e?e:new E}getNextNode(){let e;return e=this.endNode.isText?this.endOffset===this.endNode.text().length?this.endNode.next():this.endNode:this.endNode.children()[this.endOffset],null!=e?e:new E}getBoxes(){if(this.isCollapsed){const e=this.startNode.closest("lake-box");return e.length>0?[e]:[]}const e=[],t=this.clone();t.adjustBox();for(const i of t.commonAncestor.getWalker())i.isBox&&t.intersectsNode(i)&&e.push(i);return e}getBlocks(){if(this.isCollapsed){const e=this.startNode.closestOperableBlock();return e.isTable?[]:e.isInside?[e]:[]}const e=this.startNode.closestOperableBlock(),t=this.endNode.closestOperableBlock();if(e.isInside&&e.get(0)&&e.get(0)===t.get(0))return e.isTable?[]:[e];const i=[],n=this.clone();n.collapseToEnd();for(const e of this.commonAncestor.getWalker())e.isBlock&&!e.isTable&&e.isTopInside&&0!==n.comparePoint(e,0)&&this.intersectsNode(e)&&i.push(e);if(i.length>0)return i;for(const n of this.commonAncestor.getWalker())n.isBlock&&!n.isTable&&(e.isSibling(n)||t.isSibling(n))&&this.intersectsNode(n)&&i.push(n);return i}getMarks(e=!1){const t=[];if(this.commonAncestor.isText&&e&&0===this.startOffset&&this.endOffset===this.commonAncestor.text().length)return t.push(this.commonAncestor),t;const i=this.clone();i.collapseToStart();const n=this.clone();n.collapseToEnd();for(const s of this.commonAncestor.getWalker()){const o=document.createRange();if(o.setStartAfter(s.get(0)),o.collapse(!0),n.compareBeforeNode(s)>=0)break;i.compareAfterNode(s)>0&&(s.isMark||s.isText&&e)&&t.push(s)}return t}getStartText(){const e=this.startNode,t=this.startOffset;let i=e.closestBlock();if(i.isOutside&&(i=e.closestContainer()),0===i.length)return"";const n=new M;n.setStartBefore(i),n.setEnd(e,t);const s=I("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"":o}getEndText(){const e=this.endNode,t=this.endOffset;let i=e.closestBlock();if(i.isOutside&&(i=e.closestContainer()),0===i.length)return"";const n=new M;n.setStart(e,t),n.setEndAfter(i);const s=I("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"":o}clone(){return new M(this.range.cloneRange())}cloneContents(){return this.range.cloneContents()}info(){A("--- range information ---"),A("start node:",this.startNode.toString(),", offset:",this.startOffset),A("end node:",this.endNode.toString(),", offset:",this.endOffset)}}function P(e,t,i){const n=new M;let s;if(e.isText){s=e.parent();const i=e.splitText(t);n.setStartAfter(e),""===e.text()&&e.remove(),""===i.text()&&i.remove()}else n.setStart(e,t),s=e;if("body"===s.name||"html"===s.name)return null;if(s.get(0)===i.get(0))return null;n.collapseToStart();const o=s.clone();let r=s.first();for(;r.length>0&&!(n.compareBeforeNode(r)>=0);){const e=r.next();o.append(r),r=e}return s.before(o),s.parent().length>0&&s.parent().get(0)!==i.get(0)?P(s.parent(),s.index(),i):{start:o,end:s}}function D(e){const t=I("<br />");let i=e;for(;i.isBlock;){let e=i.last();for(;e.isText&&e.isEmpty;)e=e.prev();if(!e.isBlock&&"br"!==e.name){i.append(t);break}i=e}return t}function Z(e){if(0===e.length)return;const t=[];let i=e.first();for(;i.length>0;){const e=i.next();i.isText&&""===i.text()||t.push(i),i=e}(1===t.length&&"br"===t[0].name||2===t.length&&"br"===t[0].name&&t[1].isBookmark)&&t[0].remove(),2===t.length&&t[0].isBookmark&&"br"===t[1].name&&t[1].remove()}function N(e){if(e.isText)return{node:e,offset:e.text().length};const t=new M;return t.setEndAfter(e),{node:t.endNode,offset:t.endOffset}}function O(e,t){const i=t;if(["ul","ol"].indexOf(e.name)>=0){const t=e.find("li");e=t.eq(t.length-1)}if(["ul","ol"].indexOf(t.name)>=0){const e=t.find("li");t=e.eq(0)}if(e.isText||t.isText||e.isVoid||t.isVoid)return N(e);Z(e),Z(t),e.isBlock&&e.isEmpty&&t.isEmpty&&D(e);const n=e.last(),s=t.first();let o=s;for(;o.length>0;){const t=o.next();e.append(o),o=t}return i.remove(),n.length>0&&s.length>0&&n.isElement&&!n.isBox&&n.clone(!1).get(0).isEqualNode(s.clone(!1).get(0))?O(n,s):0===n.length?{node:e,offset:0}:N(n)}function H(e){let t=e;for(;t.length>0;){let e=t.first();if(e.isText&&e.isEmpty&&(e=e.next()),t.isElement&&!t.isVoid&&0===e.length)break;t=e}return t}function z(e,t){if(t=null!=t?t:I("<p />"),0===e.length)return t;const i=H(t=t.clone(!0));e[0].before(t);for(const t of e)i.append(t);return t}function $(e){for(const t of e.getWalker())if(t.isText){const e=t.text();""===e?t.remove():e.length>1&&/\u200B/.test(e)&&(t.get(0).nodeValue=e.replace(/\u200B/g,""))}}function V(e,t){const i=e.get(0),n=I(a`<${t} />`);for(const e of i.attributes)n.attr(e.name,e.value);let s=e.first();for(;s.length>0;){const e=s.next();n.append(s),s=e}return e.replaceWith(n),n}function F(e){if(0===e.length)return;const t=e[0],i=e[e.length-1],n=[];let s=t.prev();for(;s.length>0&&"ol"===s.name;)n.push(s),s=s.prev();n.reverse(),n.push(...e);let o=i.next();for(;o.length>0&&"ol"===o.name;)n.push(o),o=o.next();let r=1;for(const e of n){const t=e.prev();if(0!==t.length&&"ol"===t.name||(r=1),"ol"===e.name){"ol"===t.name&&t.attr("indent")!==e.attr("indent")&&(r=1);const i=e.attr("start"),n=r.toString(10);i!==n&&e.attr("start",n),r++}}}function R(e,t){if(e.isList){let i=Number.parseInt(e.attr("indent"),10)||0;if("increase"===t?i++:i--,i<=0)i=0;else if(i>10)return;return 0===i?e.removeAttr("indent"):e.attr("indent",i.toString(10)),void F([e])}let i=Number.parseInt(e.css("margin-left"),10)||0;"decrease"!==t||0!==i||""===e.css("text-indent")?("increase"===t?i+=40:i-=40,i<=0&&(i=0),0===i?e.css("margin-left",""):e.css("margin-left",`${i}px`)):e.css("text-indent","")}const j=new Set;function q(){}const W={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:q,afterNodeAdded:q,beforeNodeMorphed:q,afterNodeMorphed:q,beforeNodeRemoved:q,afterNodeRemoved:q,beforeAttributeUpdated:q,afterAttributeUpdated:q,beforeChildrenUpdated:q},head:{style:"merge",shouldPreserve:e=>"true"===e.getAttribute("im-preserve"),shouldReAppend:e=>"true"===e.getAttribute("im-re-append"),shouldRemove:q,afterHeadMorphed:q}};function U(e,t){return!e.deadIds.has(t)}function K(e,t,i){return(e.idMap.get(i)||j).has(t)}function G(e,t){const i=e.idMap.get(t)||j;for(const t of i)e.deadIds.add(t)}function X(e,t,i){const n=e.idMap.get(t)||j;let s=0;for(const t of n)U(e,t)&&K(e,t,i)&&++s;return s}function Q(e,t){const i=e.parentElement,n=e.querySelectorAll("[id]");for(const e of n){let n=e;for(;n!==i&&null!=n;){let i=t.get(n);null==i&&(i=new Set,t.set(n,i)),i.add(e.id),n=n.parentElement}}}function Y(e,t){const i=new Map;return Q(e,i),Q(t,i),i}function J(e,t,i){return{target:e,newContent:t,config:i=function(e){const t={};return Object.assign(t,W),Object.assign(t,e),t.callbacks={},Object.assign(t.callbacks,W.callbacks),Object.assign(t.callbacks,e.callbacks),t.head={},Object.assign(t.head,W.head),Object.assign(t.head,e.head),t}(i),morphStyle:i.morphStyle,ignoreActive:i.ignoreActive,ignoreActiveValue:i.ignoreActiveValue,idMap:Y(e,t),deadIds:new Set,callbacks:i.callbacks,head:i.head}}function ee(e,t,i){return null!=e&&null!=t&&(e.nodeType===t.nodeType&&e.tagName===t.tagName&&(""!==e.id&&e.id===t.id||X(i,e,t)>0))}function te(e,t){return null!=e&&null!=t&&(e.nodeType===t.nodeType&&e.tagName===t.tagName)}function ie(e,t){G(t,e),!1!==t.callbacks.beforeNodeRemoved(e)&&(e.remove(),t.callbacks.afterNodeRemoved(e))}function ne(e,t,i){let n=e;for(;n&&n!==t;){const e=n;n=n.nextSibling,ie(e,i)}return G(i,t),t.nextSibling}function se(e,t,i,n,s){const o=X(s,i,t);let r=null;if(o>0){r=n;let t=0;for(;null!=r;){if(ee(i,r,s))return r;if(t+=X(s,r,e),t>o)return null;r=r.nextSibling}}return r}function oe(e,t,i,n,s){let o=n,r=i.nextSibling,a=0;for(;null!=o;){if(X(s,o,e)>0)return null;if(te(i,o))return o;if(te(r,o)&&(a++,r=r?r.nextSibling:null,a>=2))return null;o=o?o.nextSibling:null}return o}function re(e,t,i){return te(e,t)?.5+X(i,e,t):0}function ae(e,t,i,n){return!("value"!==e||!n.ignoreActiveValue||t!==document.activeElement)||!1===n.callbacks.beforeAttributeUpdated(e,t,i)}function le(e,t,i){var n;if(!i.ignoreActive||e!==document.activeElement)return null==t?!1===i.callbacks.beforeNodeRemoved(e)?e:(e.remove(),i.callbacks.afterNodeRemoved(e),null):te(e,t)?(!1===i.callbacks.beforeNodeMorphed(e,t)||(function(e,t,i){const n=e.nodeType;if(1===n){const n=e.attributes,s=t.attributes;for(const e of n)ae(e.name,t,"update",i)||t.getAttribute(e.name)!==e.value&&(t.setAttribute(e.name,e.value),i.callbacks.afterAttributeUpdated(e.name,t,"update"));for(let n=s.length-1;n>=0;n--){const o=s[n];ae(o.name,t,"remove",i)||e.hasAttribute(o.name)||(t.removeAttribute(o.name),i.callbacks.afterAttributeUpdated(o.name,t,"remove"))}}8!==n&&3!==n||t.nodeValue!==e.nodeValue&&(t.nodeValue=e.nodeValue)}(t,e,i),!1===i.callbacks.beforeChildrenUpdated(e,t)||function(e,t){return t.ignoreActiveValue&&e===document.activeElement}(e,i)||ce(t,e,i),i.callbacks.afterNodeMorphed(e,t)),e):!1===i.callbacks.beforeNodeRemoved(e)||!1===i.callbacks.beforeNodeAdded(t)?e:(null===(n=e.parentElement)||void 0===n||n.replaceChild(t,e),i.callbacks.afterNodeAdded(t),i.callbacks.afterNodeRemoved(e),t)}function ce(e,t,i){let n,s=e.firstChild,o=t.firstChild;for(;s;){if(n=s,s=n.nextSibling,null==o){if(!1===i.callbacks.beforeNodeAdded(n))return;t.appendChild(n),i.callbacks.afterNodeAdded(n),G(i,n);continue}if(ee(n,o,i)){le(o,n,i),o=o.nextSibling,G(i,n);continue}const r=se(e,t,n,o,i);if(r){o=ne(o,r,i),le(r,n,i),G(i,n);continue}const a=oe(e,0,n,o,i);if(a)o=ne(o,a,i),le(a,n,i),G(i,n);else{if(!1===i.callbacks.beforeNodeAdded(n))return;t.insertBefore(n,o),i.callbacks.afterNodeAdded(n),G(i,n)}}for(;null!==o;){const e=o;o=o.nextSibling,ie(e,i)}}function de(e,t,i){if("innerHTML"===i.morphStyle)return ce(t,e,i),e.children;if("outerHTML"===i.morphStyle||null==i.morphStyle){const n=function(e,t,i){let n;n=e.firstChild;let s=n,o=0;for(;n;){const e=re(n,t,i);e>o&&(s=n,o=e),n=n.nextSibling}return s}(t,e,i),s=null==n?void 0:n.previousSibling,o=null==n?void 0:n.nextSibling,r=le(e,n,i);return n?function(e,t,i){var n,s;const o=[],r=[];let a=e;for(;null!=a;)o.push(a),a=a.previousSibling;for(;o.length>0;){const e=o.pop();r.push(e),e&&(null===(n=t.parentElement)||void 0===n||n.insertBefore(e,t))}r.push(t);let l=i;for(;null!=l;)o.push(l),r.push(l),l=l.nextSibling;for(;o.length>0;){const e=o.pop();e&&(null===(s=t.parentElement)||void 0===s||s.insertBefore(e,t.nextSibling))}return r}(s,r,o):[]}throw`Do not understand how to morph style ${i.morphStyle}`}function he(e,t,i={}){const n=function(e){if(null==e)return document.createElement("div");if(e instanceof Node){if(e.generatedByIdiomorph)return e;const t=document.createElement("div");return t.append(e),t}const t=document.createElement("div");for(const i of[...e])t.append(i);return t}(t.get(0)),s=J(e.get(0),n,i);de(e.get(0),n,s)}function pe(e){const t=e.get(0).getBoundingClientRect();let i=t.left,n=t.right,s=t.top,o=t.bottom,r=window.innerWidth,a=window.innerHeight;const l=e.closestScroller();if(l.length>0){const e=l.get(0).getBoundingClientRect(),t=e.x,c=e.y;i-=t,n-=t,s-=c,o-=c,r=e.width,a=e.height}return{left:i,right:r-n,top:s,bottom:a-o}}function ue(e,t){const i=pe(e);(i.left<0||i.right<0||i.top<0||i.bottom<0)&&e.get(0).scrollIntoView(t)}const me=new Map;function ge(e){let t=me.get(e);return t||(t=new Map,me.set(e,t),t)}function fe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ve={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function s(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,n,o,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,o||e,r),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,n,s=[];if(0===this._eventsCount)return s;for(n in e=this._events)t.call(e,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},a.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,o=n.length,r=new Array(o);s<o;s++)r[s]=n[s].fn;return r},a.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,s,o,r){var a=i?i+e:e;if(!this._events[a])return!1;var l,c,d=this._events[a],h=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),h){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,s),!0;case 5:return d.fn.call(d.context,t,n,s,o),!0;case 6:return d.fn.call(d.context,t,n,s,o,r),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];d.fn.apply(d.context,l)}else{var p,u=d.length;for(c=0;c<u;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),h){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,n);break;case 4:d[c].fn.call(d[c].context,t,n,s);break;default:if(!l)for(p=1,l=new Array(h-1);p<h;p++)l[p-1]=arguments[p];d[c].fn.apply(d[c].context,l)}}return!0},a.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,n,s){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return r(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||s&&!a.once||n&&a.context!==n||r(this,o);else{for(var l=0,c=[],d=a.length;l<d;l++)(a[l].fn!==t||s&&!a[l].once||n&&a[l].context!==n)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:r(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&r(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a}(ve);var we=fe(ve.exports);const ye=new Map,xe=new Map;class be{constructor(e){this.config=e,this.root=e.root,this.node=I(a`
|
|
2
2
|
<button type="button" name="${e.name}" class="lake-button" />
|
|
3
|
-
`),e.type&&this.node.addClass(`lake-${e.type}-button`),void 0!==e.tabIndex&&this.node.attr("tabindex",e.tabIndex.toString())}render(){const e=this.config,t=this.node;t.addClass(`lake-${e.text?"text":"icon"}-button`),e.tooltip&&t.attr("title",e.tooltip),e.icon&&t.append(e.icon),e.text&&t.append(`<span>${e.text}</span>`),this.root.append(t),t.on("mouseenter",(()=>{t.attr("disabled")||t.hasClass("lake-button-selected")||t.addClass("lake-button-hovered")})),t.on("mouseleave",(()=>{t.attr("disabled")||t.removeClass("lake-button-hovered")})),t.on("click",(t=>{t.preventDefault(),e.onClick()}))}}const ke=/^\{.*\}$/,Ce=/(\{(?:[^{}]+|\{(?:[^{}]+)*\})*\})/g,Se=e=>e.substring(1,e.length-1),Be=(e,t=!0,i="",n="")=>e.split(Ce).map((e=>{if(!e.match(Ce))return e;const t=Se(e);if(t.startsWith("{"))return((e,t)=>{let[i,n]=e.split(":");n||(n=i,i=t);const s=n.split("|"),[o,r,a,l,c,d]=s,h=s.filter((e=>void 0!==e)).length;return 1===h?{k:i,r:o}:2===h?{k:i,o:o,r:r}:3===h?{k:i,z:o,o:r,r:a}:{k:i,z:o,o:r,t:a,f:l,m:c,r:d}})(Se(t),n);const s=(e=>{const[t="",...i]=e.split("|"),[n="",s]=t.split(":"),[o,r]=n.split("?");return{k:o,i:s,n:""===r,f:i}})(t);return n=s.k||n,!i&&(i=n),s})).map((e=>{if("string"==typeof e)return e;e.k||(e.k=i||"0");const n=(e=>Object.fromEntries(Object.keys(e).map((t=>{const i=e[t];return[t,Array.isArray(i)?i.map((e=>null==e?void 0:e.trim())):i===!!i?i:null==i?void 0:i.trim()]}))))(e);return t?(s=n,Object.fromEntries(Object.entries(s).map((([e,t])=>"i"!==e&&t&&"0"!=t&&[e,t])).filter(Boolean))):n;var s})),_e=(e,t,i)=>t.reduce(((t,i)=>{var n,s,o;return null!==(s=i.match(ke)?(e=>{var i;return null!==(i=e[t])&&void 0!==i?i:e["*"]})((o=i,Object.fromEntries(Se(o).split(",").map((e=>e.split(":"))).reduce(((e,t)=>2===t.length?[...e,t.map((e=>e.trim()))]:(e[e.length-1][1]+=","+t[0],e)),[])))):null===(n=e[i])||void 0===n?void 0:n.call(e,t))&&void 0!==s?s:t}),i),Ae=/\?\?/g,Le=(e,t,i,n)=>{const s=n[0],o=s&&"object"==typeof s&&s.constructor===Object;return((e,t,i,n)=>e.map((e=>{if("string"==typeof e)return e;const{k:s="0",f:o=[]}=e,r=n[s];if((e=>!(!e.o&&!e.r))(e))return(("boolean"==typeof r?r?e.o:e.r:((e,{z:t,o:i,t:n,f:s,m:o,r:r},a)=>{switch(t&&0==a?"zero":e.select(a)){case"zero":return t;case"one":return i;case"two":return n;case"few":return null!=s?s:r;case"many":return null!=o?o:r;default:return r}})(t,e,r))||"").replace(Ae,r);const a=o.length?_e(i,o,r):r;return(""+(null!=a?a:"")).trim()})).join(""))(e,t,i,1===n.length&&o?s:n)},Te=(e,t)=>{const i={},n=new Intl.PluralRules(e);return(e,...s)=>Le(((e,t)=>e[t]||(e[t]=Be(t)))(i,e),n,t,s)};const Ee=(e={},t)=>"string"==typeof e?t.bind(null,e):Object.assign(Object.defineProperty((()=>""),"name",{writable:!0}),e),Ie=(e,t)=>new Proxy(Ee(e,t),{get:(e,i)=>i===Symbol.iterator?[][Symbol.iterator].bind(Object.values(e).map((e=>Ee(e,t)))):Ie(e[i],t)});const Me={"en-US":{toolbar:{undo:`Undo (${v("mod+Z")})`,redo:`Redo (${v("mod+Y")})`,selectAll:`Select all (${v("mod+A")})`,paragraph:"Paragraph",blockQuote:"Block quotation",numberedList:"Numbered list",bulletedList:"Bulleted list",checklist:"Checklist",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Align justify",increaseIndent:"Increase indent",decreaseIndent:"Decrease indent",bold:`Bold (${v("mod+B")})`,italic:`Italic (${v("mod+I")})`,underline:`Underline (${v("mod+U")})`,strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",code:"Inline code",removeFormat:"Remove format",formatPainter:"Format painter",link:"Link",hr:"Horizontal line",video:"Video",codeBlock:"Code block",heading:"Heading",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",list:"List",align:"Alignment",indent:"Indent",fontFamily:"Font family",fontSize:"Font size",moreStyle:"More style",fontColor:"Font color",highlight:"Highlight",image:"Image",file:"File",emoji:"Emoji",equation:"Equation",removeColor:"Remove color"},slash:{heading1:"Heading 1",heading1Desc:"Create a heading level 1",heading2:"Heading 2",heading2Desc:"Create a heading level 2",heading3:"Heading 3",heading3Desc:"Create a heading level 3",heading4:"Heading 4",heading4Desc:"Create a heading level 4",heading5:"Heading 5",heading5Desc:"Create a heading level 5",heading6:"Heading 6",heading6Desc:"Create a heading level 6",paragraph:"Paragraph",paragraphDesc:"Create a paragraph",blockQuote:"Block quotation",blockQuoteDesc:"Create a block quotation",numberedList:"Numbered list",numberedListDesc:"Create a numbered list",bulletedList:"Bulleted list",bulletedListDesc:"Create a bulleted list",checklist:"Checklist",checklistDesc:"Create a checklist",hr:"Horizontal line",hrDesc:"Insert a horizontal line",codeBlock:"Code block",codeBlockDesc:"Insert a code block",video:"Video",videoDesc:"Insert a video from YouTube",equation:"Equation",equationDesc:"Insert TeX expression in text",image:"Image",imageDesc:"Upload an image",file:"File",fileDesc:"Upload a file"},link:{newLink:"New link",url:"Link URL",title:"Link title",copy:"Copy link to clipboard",open:"Open link in new tab",save:"Save",unlink:"Remove link"},image:{view:"Full screen",remove:"Delete",previous:"Previous",next:"Next",close:"Close (Esc)",loadingError:"The image cannot be loaded",zoomOut:"Zoom out",zoomIn:"Zoom in"},file:{download:"Download",remove:"Delete"},video:{embed:"Embed video",remove:"Delete",description:"Paste a link to embed a video from YouTube.",url:"Link",urlError:"Please enter a valid link."},codeBlock:{langType:"Select language"},equation:{save:"Done",placeholder:"Type a TeX expression"}},"zh-CN":{toolbar:{undo:`撤消 (${v("mod+Z")})`,redo:`重做 (${v("mod+Y")})`,selectAll:`全选 (${v("mod+A")})`,paragraph:"正文",blockQuote:"引用",numberedList:"编号",bulletedList:"项目符号",checklist:"任务列表",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignJustify:"两端对齐",increaseIndent:"增加缩进",decreaseIndent:"减少缩进",bold:`粗体 (${v("mod+B")})`,italic:`斜体 (${v("mod+I")})`,underline:`下划线 (${v("mod+U")})`,strikethrough:"删除线",superscript:"上标",subscript:"下标",code:"行内代码",removeFormat:"清除格式",formatPainter:"格式刷",link:"链接",hr:"分割线",video:"视频",codeBlock:"代码块",heading:"标题",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3",heading4:"标题 4",heading5:"标题 5",heading6:"标题 6",list:"列表",align:"对齐方式",indent:"缩进",fontFamily:"字体",fontSize:"文字大小",moreStyle:"更多样式",fontColor:"文字颜色",highlight:"文字背景",image:"图片",file:"文件",emoji:"表情",equation:"公式",removeColor:"默认"},slash:{heading1:"标题 1",heading1Desc:"创建标题 1",heading2:"标题 2",heading2Desc:"创建标题 2",heading3:"标题 3",heading3Desc:"创建标题 3",heading4:"标题 4",heading4Desc:"创建标题 4",heading5:"标题 5",heading5Desc:"创建标题 5",heading6:"标题 6",heading6Desc:"创建标题 6",paragraph:"正文",paragraphDesc:"把当前段落改成正文",blockQuote:"引用",blockQuoteDesc:"创建引用",numberedList:"编号",numberedListDesc:"创建编号列表",bulletedList:"项目符号",bulletedListDesc:"创建项目符号列表",checklist:"任务列表",checklistDesc:"创建任务列表",hr:"分割线",hrDesc:"插入分割线",codeBlock:"代码块",codeBlockDesc:"插入代码块",video:"视频",videoDesc:"插入 YouTube 视频",equation:"公式",equationDesc:"支持 TeX 语法",image:"图片",imageDesc:"上传图片",file:"文件",fileDesc:"上传文件"},link:{newLink:"新链接",url:"链接 URL",title:"链接文本",copy:"复制到剪贴板",open:"打开链接",save:"确定",unlink:"取消链接"},image:{view:"查看大图",remove:"删除",previous:"上一张",next:"下一张",close:"关闭 (Esc)",loadingError:"图片加载失败",zoomOut:"缩小",zoomIn:"放大"},file:{download:"下载",remove:"删除"},video:{embed:"嵌入视频",remove:"删除",description:"在下面的输入框里,粘贴 YouTube 链接。",url:"链接",urlError:"请输入有效的链接。"},codeBlock:{langType:"选择代码语言"},equation:{save:"确定",placeholder:"请输入 TeX 公式"}},ja:{toolbar:{undo:`元に戻す (${v("mod+Z")})`,redo:`やり直し (${v("mod+Y")})`,selectAll:`すべて選択 (${v("mod+A")})`,paragraph:"テキスト",blockQuote:"引用ブロック",numberedList:"番号付きリスト",bulletedList:"箇条書きリスト",checklist:"タスクリスト",alignLeft:"左揃え",alignCenter:"中心揃え",alignRight:"右揃え",alignJustify:"左右に並べ替え",increaseIndent:"インデントを増やす",decreaseIndent:"インデントを減らす",bold:`太字 (${v("mod+B")})`,italic:`斜体 (${v("mod+I")})`,underline:`下線 (${v("mod+U")})`,strikethrough:"取り消し線",superscript:"上付き文字",subscript:"下付き文字",code:"インラインコード",removeFormat:"形式を削除",formatPainter:"形式ペインタ",link:"リンク",hr:"区切り線",video:"動画",codeBlock:"コードブロック",heading:"タイトル",heading1:"タイトル 1",heading2:"タイトル 2",heading3:"タイトル 3",heading4:"タイトル 4",heading5:"タイトル 5",heading6:"タイトル 6",list:"リスト",align:"文字揃え",indent:"インデント",fontFamily:"フォント",fontSize:"文字サイズ",moreStyle:"その他のスタイル",fontColor:"文字色",highlight:"文字の背景",image:"画像",file:"ファイル",emoji:"絵文字",equation:"公式",removeColor:"デフォルト"},slash:{heading1:"タイトル 1",heading1Desc:"レベル 1 のタイトルを作成",heading2:"タイトル 2",heading2Desc:"レベル 2 のタイトルを作成",heading3:"タイトル 3",heading3Desc:"レベル 3 のタイトルを作成",heading4:"タイトル 4",heading4Desc:"レベル 4 のタイトルを作成",heading5:"タイトル 5",heading5Desc:"レベル 5 のタイトルを作成",heading6:"タイトル 6",heading6Desc:"レベル 6 のタイトルを作成",paragraph:"テキスト",paragraphDesc:"段落を作成",blockQuote:"引用ブロック",blockQuoteDesc:"引用ブロックを作成",numberedList:"番号付きリスト",numberedListDesc:"番号付きリストを作成",bulletedList:"箇条書きリスト",bulletedListDesc:"箇条書きリストを作成",checklist:"タスクリスト",checklistDesc:"タスクリストを作成",hr:"区切り線",hrDesc:"水平線を挿入",codeBlock:"コードブロック",codeBlockDesc:"コードブロックを挿入",video:"動画",videoDesc:"YouTube から動画を挿入",equation:"公式",equationDesc:"TeX 式を挿入",image:"画像",imageDesc:"画像をアップロード",file:"ファイル",fileDesc:"ファイルをアップロード"},link:{newLink:"新しいリンク",url:"リンク URL",title:"リンク文字",copy:"クリップボードにコピー",open:"リンクを開く",save:"確認",unlink:"リンクを削除"},image:{view:"大きな画像を見る",remove:"削除",previous:"前の画像",next:"次の画像",close:"閉じる (Esc)",loadingError:"画像を読み込めません",zoomOut:"縮小",zoomIn:"拡大"},file:{download:"ダウンロード",remove:"削除"},video:{embed:"動画を埋め込む",remove:"削除",description:"下の入力欄に YouTube リンクを貼り付けてください。",url:"リンク",urlError:"有効なリンクを入力してください。"},codeBlock:{langType:"コード言語を選択"},equation:{save:"確認",placeholder:"TeX 公式を入力してください。"}},ko:{toolbar:{undo:`작업취소 (${v("mod+Z")})`,redo:`작업재개 (${v("mod+Y")})`,selectAll:`전체 선택 (${v("mod+A")})`,paragraph:"텍스트",blockQuote:"인용문",numberedList:"순서 목록",bulletedList:"비순서 목록",checklist:"체크리스트",alignLeft:"왼쪽 정렬",alignCenter:"가운데 정렬",alignRight:"오른쪽 정렬",alignJustify:"좌우로 정렬",increaseIndent:"들여쓰기 증가",decreaseIndent:"들여쓰기 줄이기",bold:`굵게 (${v("mod+B")})`,italic:`기울임꼴 (${v("mod+I")})`,underline:`밑줄 (${v("mod+U")})`,strikethrough:"취소선",superscript:"위첨자",subscript:"아래 첨자",code:"인라인 코드",removeFormat:"형식 지우기",formatPainter:"형식 페인터",link:"링크",hr:"구분선",video:"동영상",codeBlock:"코드 블록",heading:"제목",heading1:"제목 1",heading2:"제목 2",heading3:"제목 3",heading4:"제목 4",heading5:"제목 5",heading6:"제목 6",list:"목록",align:"정렬",indent:"들여쓰기",fontFamily:"글꼴",fontSize:"글자 크기",moreStyle:"더 많은 스타일",fontColor:"글자 색상",highlight:"글자 배경",image:"이미지",file:"파일",emoji:"이모지",equation:"수식",removeColor:"기본색"},slash:{heading1:"제목 1",heading1Desc:"1 단계 제목을 작성",heading2:"제목 2",heading2Desc:"2 단계 제목을 작성",heading3:"제목 3",heading3Desc:"3 단계 제목을 작성",heading4:"제목 4",heading4Desc:"4 단계 제목을 작성",heading5:"제목 5",heading5Desc:"5 단계 제목을 작성",heading6:"제목 6",heading6Desc:"6 단계 제목을 작성",paragraph:"텍스트",paragraphDesc:"단락을 작성",blockQuote:"인용문",blockQuoteDesc:"인용문을 작성",numberedList:"순서 목록",numberedListDesc:"순서 목록을 작성",bulletedList:"비순서 목록",bulletedListDesc:"비순서 목록을 작성",checklist:"체크리스트",checklistDesc:"체크리스트를 작성",hr:"구분선",hrDesc:"구분선을 삽입",codeBlock:"코드 블록",codeBlockDesc:"코드 블록을 삽입",video:"동영상",videoDesc:"유튜브 동영상을 삽입",equation:"수식",equationDesc:"텍스 표현식을 삽입",image:"이미지",imageDesc:"이미지를 업로드",file:"파일",fileDesc:"파일을 업로드"},link:{newLink:"새 링크",url:"링크 URL",title:"링크 텍스트",copy:"클립보드에 복사",open:"링크 열기",save:"확인",unlink:"링크 제거"},image:{view:"큰 이미지 보기",remove:"삭제",previous:"이전 이미지",next:"다음 이미지",close:"닫기 (Esc)",loadingError:"이미지를 로드할 수 없습니다",zoomOut:"축소",zoomIn:"확대"},file:{download:"다운로드",remove:"삭제"},video:{embed:"동영상 삽입",remove:"삭제",description:"아래 입력란에 YouTube 링크를 붙여넣으세요.",url:"링크",urlError:"유효한 링크를 입력하세요."},codeBlock:{langType:"코드언어 선택"},equation:{save:"확인",placeholder:"TeX 수식을 입력하세요"}}},Pe=Object.keys(Me),De={},Ze={},Ne=e=>{De[e]||(De[e]=Me[e],(e=>{Ze[e]={}})(e))},Oe=e=>function(e,t,i={}){return Ie(t,Te(e,i))}(e,De[e],Ze[e]);Pe.forEach(Ne);class He{constructor(e){this.documentClickListener=e=>{const t=new E(e.target),i=this.node.find(".lake-dropdown-title");t.closest(".lake-dropdown-title").get(0)!==i.get(0)&&this.hideMenu()},this.config=e,this.root=e.root,this.locale=e.locale||Oe("en-US");const t=e.placement||"bottom";if(this.node=I(a`
|
|
3
|
+
`),e.type&&this.node.addClass(`lake-${e.type}-button`),void 0!==e.tabIndex&&this.node.attr("tabindex",e.tabIndex.toString())}render(){const e=this.config,t=this.node;t.addClass(`lake-${e.text?"text":"icon"}-button`),e.tooltip&&t.attr("title",e.tooltip),e.icon&&t.append(e.icon),e.text&&t.append(`<span>${e.text}</span>`),this.root.append(t),t.on("mouseenter",(()=>{t.attr("disabled")||t.hasClass("lake-button-selected")||t.addClass("lake-button-hovered")})),t.on("mouseleave",(()=>{t.attr("disabled")||t.removeClass("lake-button-hovered")})),t.on("click",(t=>{t.preventDefault(),e.onClick()}))}}const ke=/^\{.*\}$/,Ce=/(\{(?:[^{}]+|\{(?:[^{}]+)*\})*\})/g,Se=e=>e.substring(1,e.length-1),Be=(e,t=!0,i="",n="")=>e.split(Ce).map((e=>{if(!e.match(Ce))return e;const t=Se(e);if(t.startsWith("{"))return((e,t)=>{let[i,n]=e.split(":");n||(n=i,i=t);const s=n.split("|"),[o,r,a,l,c,d]=s,h=s.filter((e=>void 0!==e)).length;return 1===h?{k:i,r:o}:2===h?{k:i,o:o,r:r}:3===h?{k:i,z:o,o:r,r:a}:{k:i,z:o,o:r,t:a,f:l,m:c,r:d}})(Se(t),n);const s=(e=>{const[t="",...i]=e.split("|"),[n="",s]=t.split(":"),[o,r]=n.split("?");return{k:o,i:s,n:""===r,f:i}})(t);return n=s.k||n,!i&&(i=n),s})).map((e=>{if("string"==typeof e)return e;e.k||(e.k=i||"0");const n=(e=>Object.fromEntries(Object.keys(e).map((t=>{const i=e[t];return[t,Array.isArray(i)?i.map((e=>null==e?void 0:e.trim())):i===!!i?i:null==i?void 0:i.trim()]}))))(e);return t?(s=n,Object.fromEntries(Object.entries(s).map((([e,t])=>"i"!==e&&t&&"0"!=t&&[e,t])).filter(Boolean))):n;var s})),_e=(e,t,i)=>t.reduce(((t,i)=>{var n,s,o;return null!==(s=i.match(ke)?(e=>{var i;return null!==(i=e[t])&&void 0!==i?i:e["*"]})((o=i,Object.fromEntries(Se(o).split(",").map((e=>e.split(":"))).reduce(((e,t)=>2===t.length?[...e,t.map((e=>e.trim()))]:(e[e.length-1][1]+=","+t[0],e)),[])))):null===(n=e[i])||void 0===n?void 0:n.call(e,t))&&void 0!==s?s:t}),i),Ae=/\?\?/g,Le=(e,t,i,n)=>{const s=n[0],o=s&&"object"==typeof s&&s.constructor===Object;return((e,t,i,n)=>e.map((e=>{if("string"==typeof e)return e;const{k:s="0",f:o=[]}=e,r=n[s];if((e=>!(!e.o&&!e.r))(e))return(("boolean"==typeof r?r?e.o:e.r:((e,{z:t,o:i,t:n,f:s,m:o,r:r},a)=>{switch(t&&0==a?"zero":e.select(a)){case"zero":return t;case"one":return i;case"two":return n;case"few":return null!=s?s:r;case"many":return null!=o?o:r;default:return r}})(t,e,r))||"").replace(Ae,r);const a=o.length?_e(i,o,r):r;return(""+(null!=a?a:"")).trim()})).join(""))(e,t,i,1===n.length&&o?s:n)},Te=(e,t)=>{const i={},n=new Intl.PluralRules(e);return(e,...s)=>Le(((e,t)=>e[t]||(e[t]=Be(t)))(i,e),n,t,s)};const Ee=(e={},t)=>"string"==typeof e?t.bind(null,e):Object.assign(Object.defineProperty((()=>""),"name",{writable:!0}),e),Ie=(e,t)=>new Proxy(Ee(e,t),{get:(e,i)=>i===Symbol.iterator?[][Symbol.iterator].bind(Object.values(e).map((e=>Ee(e,t)))):Ie(e[i],t)});const Me={"en-US":{toolbar:{undo:`Undo (${v("mod+Z")})`,redo:`Redo (${v("mod+Y")})`,selectAll:`Select all (${v("mod+A")})`,paragraph:"Paragraph",blockQuote:"Block quotation",numberedList:"Numbered list",bulletedList:"Bulleted list",checklist:"Checklist",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Align justify",increaseIndent:"Increase indent",decreaseIndent:"Decrease indent",bold:`Bold (${v("mod+B")})`,italic:`Italic (${v("mod+I")})`,underline:`Underline (${v("mod+U")})`,strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",code:"Inline code",removeFormat:"Remove format",formatPainter:"Format painter",link:"Link",hr:"Horizontal line",video:"Video",codeBlock:"Code block",heading:"Heading",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",list:"List",align:"Alignment",indent:"Indent",fontFamily:"Font family",fontSize:"Font size",moreStyle:"More style",fontColor:"Font color",highlight:"Highlight",image:"Image",file:"File",emoji:"Emoji",equation:"Mathematical formula",removeColor:"Remove color"},slash:{heading1:"Heading 1",heading1Desc:"Create a heading level 1",heading2:"Heading 2",heading2Desc:"Create a heading level 2",heading3:"Heading 3",heading3Desc:"Create a heading level 3",heading4:"Heading 4",heading4Desc:"Create a heading level 4",heading5:"Heading 5",heading5Desc:"Create a heading level 5",heading6:"Heading 6",heading6Desc:"Create a heading level 6",paragraph:"Paragraph",paragraphDesc:"Create a paragraph",blockQuote:"Block quotation",blockQuoteDesc:"Create a block quotation",numberedList:"Numbered list",numberedListDesc:"Create a numbered list",bulletedList:"Bulleted list",bulletedListDesc:"Create a bulleted list",checklist:"Checklist",checklistDesc:"Create a checklist",hr:"Horizontal line",hrDesc:"Insert a horizontal line",codeBlock:"Code block",codeBlockDesc:"Insert a code block",video:"Video",videoDesc:"Insert a video from YouTube",equation:"Mathematical formula",equationDesc:"Insert a TeX expression",image:"Image",imageDesc:"Upload an image",file:"File",fileDesc:"Upload a file"},link:{newLink:"New link",url:"Link URL",title:"Link title",copy:"Copy link to clipboard",open:"Open link in new tab",save:"Save",unlink:"Remove link"},image:{view:"Full screen",remove:"Delete",previous:"Previous",next:"Next",close:"Close (Esc)",loadingError:"The image cannot be loaded",zoomOut:"Zoom out",zoomIn:"Zoom in"},file:{download:"Download",remove:"Delete"},video:{embed:"Embed video",remove:"Delete",description:"Paste a link to embed a video from YouTube.",url:"Link",urlError:"Please enter a valid link."},codeBlock:{langType:"Select language"},equation:{save:"Done",placeholder:"Type a TeX expression"}},"zh-CN":{toolbar:{undo:`撤消 (${v("mod+Z")})`,redo:`重做 (${v("mod+Y")})`,selectAll:`全选 (${v("mod+A")})`,paragraph:"正文",blockQuote:"引用",numberedList:"编号",bulletedList:"项目符号",checklist:"任务列表",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignJustify:"两端对齐",increaseIndent:"增加缩进",decreaseIndent:"减少缩进",bold:`粗体 (${v("mod+B")})`,italic:`斜体 (${v("mod+I")})`,underline:`下划线 (${v("mod+U")})`,strikethrough:"删除线",superscript:"上标",subscript:"下标",code:"行内代码",removeFormat:"清除格式",formatPainter:"格式刷",link:"链接",hr:"分割线",video:"视频",codeBlock:"代码块",heading:"标题",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3",heading4:"标题 4",heading5:"标题 5",heading6:"标题 6",list:"列表",align:"对齐方式",indent:"缩进",fontFamily:"字体",fontSize:"文字大小",moreStyle:"更多样式",fontColor:"文字颜色",highlight:"文字背景",image:"图片",file:"文件",emoji:"表情",equation:"数学公式",removeColor:"默认"},slash:{heading1:"标题 1",heading1Desc:"创建标题 1",heading2:"标题 2",heading2Desc:"创建标题 2",heading3:"标题 3",heading3Desc:"创建标题 3",heading4:"标题 4",heading4Desc:"创建标题 4",heading5:"标题 5",heading5Desc:"创建标题 5",heading6:"标题 6",heading6Desc:"创建标题 6",paragraph:"正文",paragraphDesc:"把当前段落改成正文",blockQuote:"引用",blockQuoteDesc:"创建引用",numberedList:"编号",numberedListDesc:"创建编号列表",bulletedList:"项目符号",bulletedListDesc:"创建项目符号列表",checklist:"任务列表",checklistDesc:"创建任务列表",hr:"分割线",hrDesc:"插入分割线",codeBlock:"代码块",codeBlockDesc:"插入代码块",video:"视频",videoDesc:"插入 YouTube 视频",equation:"数学公式",equationDesc:"支持 TeX 语法",image:"图片",imageDesc:"上传图片",file:"文件",fileDesc:"上传文件"},link:{newLink:"新链接",url:"链接 URL",title:"链接文本",copy:"复制到剪贴板",open:"打开链接",save:"确定",unlink:"取消链接"},image:{view:"查看大图",remove:"删除",previous:"上一张",next:"下一张",close:"关闭 (Esc)",loadingError:"图片加载失败",zoomOut:"缩小",zoomIn:"放大"},file:{download:"下载",remove:"删除"},video:{embed:"嵌入视频",remove:"删除",description:"在下面的输入框里,粘贴 YouTube 链接。",url:"链接",urlError:"请输入有效的链接。"},codeBlock:{langType:"选择代码语言"},equation:{save:"确定",placeholder:"请输入 TeX 表达式"}},ja:{toolbar:{undo:`元に戻す (${v("mod+Z")})`,redo:`やり直し (${v("mod+Y")})`,selectAll:`すべて選択 (${v("mod+A")})`,paragraph:"テキスト",blockQuote:"引用ブロック",numberedList:"番号付きリスト",bulletedList:"箇条書きリスト",checklist:"タスクリスト",alignLeft:"左揃え",alignCenter:"中心揃え",alignRight:"右揃え",alignJustify:"左右に並べ替え",increaseIndent:"インデントを増やす",decreaseIndent:"インデントを減らす",bold:`太字 (${v("mod+B")})`,italic:`斜体 (${v("mod+I")})`,underline:`下線 (${v("mod+U")})`,strikethrough:"取り消し線",superscript:"上付き文字",subscript:"下付き文字",code:"インラインコード",removeFormat:"形式を削除",formatPainter:"形式ペインタ",link:"リンク",hr:"区切り線",video:"動画",codeBlock:"コードブロック",heading:"タイトル",heading1:"タイトル 1",heading2:"タイトル 2",heading3:"タイトル 3",heading4:"タイトル 4",heading5:"タイトル 5",heading6:"タイトル 6",list:"リスト",align:"文字揃え",indent:"インデント",fontFamily:"フォント",fontSize:"文字サイズ",moreStyle:"その他のスタイル",fontColor:"文字色",highlight:"文字の背景",image:"画像",file:"ファイル",emoji:"絵文字",equation:"数学公式",removeColor:"デフォルト"},slash:{heading1:"タイトル 1",heading1Desc:"レベル 1 のタイトルを作成",heading2:"タイトル 2",heading2Desc:"レベル 2 のタイトルを作成",heading3:"タイトル 3",heading3Desc:"レベル 3 のタイトルを作成",heading4:"タイトル 4",heading4Desc:"レベル 4 のタイトルを作成",heading5:"タイトル 5",heading5Desc:"レベル 5 のタイトルを作成",heading6:"タイトル 6",heading6Desc:"レベル 6 のタイトルを作成",paragraph:"テキスト",paragraphDesc:"段落を作成",blockQuote:"引用ブロック",blockQuoteDesc:"引用ブロックを作成",numberedList:"番号付きリスト",numberedListDesc:"番号付きリストを作成",bulletedList:"箇条書きリスト",bulletedListDesc:"箇条書きリストを作成",checklist:"タスクリスト",checklistDesc:"タスクリストを作成",hr:"区切り線",hrDesc:"水平線を挿入",codeBlock:"コードブロック",codeBlockDesc:"コードブロックを挿入",video:"動画",videoDesc:"YouTube から動画を挿入",equation:"数学公式",equationDesc:"TeX 数式を挿入",image:"画像",imageDesc:"画像をアップロード",file:"ファイル",fileDesc:"ファイルをアップロード"},link:{newLink:"新しいリンク",url:"リンク URL",title:"リンク文字",copy:"クリップボードにコピー",open:"リンクを開く",save:"確認",unlink:"リンクを削除"},image:{view:"大きな画像を見る",remove:"削除",previous:"前の画像",next:"次の画像",close:"閉じる (Esc)",loadingError:"画像を読み込めません",zoomOut:"縮小",zoomIn:"拡大"},file:{download:"ダウンロード",remove:"削除"},video:{embed:"動画を埋め込む",remove:"削除",description:"下の入力欄に YouTube リンクを貼り付けてください。",url:"リンク",urlError:"有効なリンクを入力してください。"},codeBlock:{langType:"コード言語を選択"},equation:{save:"確認",placeholder:"TeX 数式を入力してください。"}},ko:{toolbar:{undo:`작업취소 (${v("mod+Z")})`,redo:`작업재개 (${v("mod+Y")})`,selectAll:`전체 선택 (${v("mod+A")})`,paragraph:"텍스트",blockQuote:"인용문",numberedList:"순서 목록",bulletedList:"비순서 목록",checklist:"체크리스트",alignLeft:"왼쪽 정렬",alignCenter:"가운데 정렬",alignRight:"오른쪽 정렬",alignJustify:"좌우로 정렬",increaseIndent:"들여쓰기 증가",decreaseIndent:"들여쓰기 줄이기",bold:`굵게 (${v("mod+B")})`,italic:`기울임꼴 (${v("mod+I")})`,underline:`밑줄 (${v("mod+U")})`,strikethrough:"취소선",superscript:"위첨자",subscript:"아래 첨자",code:"인라인 코드",removeFormat:"형식 지우기",formatPainter:"형식 페인터",link:"링크",hr:"구분선",video:"동영상",codeBlock:"코드 블록",heading:"제목",heading1:"제목 1",heading2:"제목 2",heading3:"제목 3",heading4:"제목 4",heading5:"제목 5",heading6:"제목 6",list:"목록",align:"정렬",indent:"들여쓰기",fontFamily:"글꼴",fontSize:"글자 크기",moreStyle:"더 많은 스타일",fontColor:"글자 색상",highlight:"글자 배경",image:"이미지",file:"파일",emoji:"이모지",equation:"수학 공식",removeColor:"기본색"},slash:{heading1:"제목 1",heading1Desc:"1 단계 제목을 작성",heading2:"제목 2",heading2Desc:"2 단계 제목을 작성",heading3:"제목 3",heading3Desc:"3 단계 제목을 작성",heading4:"제목 4",heading4Desc:"4 단계 제목을 작성",heading5:"제목 5",heading5Desc:"5 단계 제목을 작성",heading6:"제목 6",heading6Desc:"6 단계 제목을 작성",paragraph:"텍스트",paragraphDesc:"단락을 작성",blockQuote:"인용문",blockQuoteDesc:"인용문을 작성",numberedList:"순서 목록",numberedListDesc:"순서 목록을 작성",bulletedList:"비순서 목록",bulletedListDesc:"비순서 목록을 작성",checklist:"체크리스트",checklistDesc:"체크리스트를 작성",hr:"구분선",hrDesc:"구분선을 삽입",codeBlock:"코드 블록",codeBlockDesc:"코드 블록을 삽입",video:"동영상",videoDesc:"유튜브 동영상을 삽입",equation:"수학 공식",equationDesc:"TeX 수식을 삽입",image:"이미지",imageDesc:"이미지를 업로드",file:"파일",fileDesc:"파일을 업로드"},link:{newLink:"새 링크",url:"링크 URL",title:"링크 텍스트",copy:"클립보드에 복사",open:"링크 열기",save:"확인",unlink:"링크 제거"},image:{view:"큰 이미지 보기",remove:"삭제",previous:"이전 이미지",next:"다음 이미지",close:"닫기 (Esc)",loadingError:"이미지를 로드할 수 없습니다",zoomOut:"축소",zoomIn:"확대"},file:{download:"다운로드",remove:"삭제"},video:{embed:"동영상 삽입",remove:"삭제",description:"아래 입력란에 YouTube 링크를 붙여넣으세요.",url:"링크",urlError:"유효한 링크를 입력하세요."},codeBlock:{langType:"코드언어 선택"},equation:{save:"확인",placeholder:"TeX 수식을 입력하세요"}}},Pe=Object.keys(Me),De={},Ze={},Ne=e=>{De[e]||(De[e]=Me[e],(e=>{Ze[e]={}})(e))},Oe=e=>function(e,t,i={}){return Ie(t,Te(e,i))}(e,De[e],Ze[e]);Pe.forEach(Ne);class He{constructor(e){this.documentClickListener=e=>{const t=new E(e.target),i=this.node.find(".lake-dropdown-title");t.closest(".lake-dropdown-title").get(0)!==i.get(0)&&this.hideMenu()},this.config=e,this.root=e.root,this.locale=e.locale||Oe("en-US");const t=e.placement||"bottom";if(this.node=I(a`
|
|
4
4
|
<div class="lake-dropdown lake-${e.menuType}-dropdown" name="${e.name}" placement="${t}">
|
|
5
5
|
<button type="button" name="${e.name}" class="lake-dropdown-title">
|
|
6
6
|
<div class="lake-dropdown-${e.icon?"icon":"text"}"></div>
|
|
@@ -15,7 +15,7 @@ var Lake=function(e){"use strict";class t extends HTMLElement{}void 0!==customEl
|
|
|
15
15
|
<span class="lake-box-strip"><br /></span>
|
|
16
16
|
<div class="lake-box-container" contenteditable="false"></div>
|
|
17
17
|
<span class="lake-box-strip"><br /></span>
|
|
18
|
-
`;class Ve{constructor(e){if(this.event=new we,"string"==typeof e){const t=ye.get(e);if(void 0===t)throw new Error(`The box "${e}" has not been defined yet.`);const i=r(t.type),n=r(t.name);this.node=I(a`<lake-box type="${i}" name="${n}"></lake-box>`),t.value&&(this.value=t.value)}else{this.node=I(e);const t=ye.get(this.name);if(void 0===t)throw new Error(`The box "${this.name}" has not been defined yet.`);t.value&&!this.node.hasAttr("value")&&(this.value=t.value)}}addFramework(){let e=this.getContainer();0===e.length?(this.node.html($e),e=this.getContainer()):(e.off("mouseenter"),e.off("mouseleave"),e.off("click")),e.on("mouseenter",(()=>{e.hasClass("lake-box-selected")||e.hasClass("lake-box-focused")||e.hasClass("lake-box-activated")||e.addClass("lake-box-hovered")})),e.on("mouseleave",(()=>{e.removeClass("lake-box-hovered")})),e.on("click",(()=>{A(`The box "${this.name}" (id = ${this.node.id}) value:`),A(this.value)})),"block"===this.type&&this.node.isContentEditable&&e.attr("draggable","true")}get type(){return this.node.attr("type")}get name(){return this.node.attr("name")}get value(){const e=this.node.attr("value");return""===e?{}:JSON.parse(h(e))}set value(e){this.node.attr("value",d(JSON.stringify(e)))}updateValue(e,t){const i=this.value;if("string"==typeof e)i[e]=t;else for(const t of Object.keys(e))i[t]=e[t];this.value=i}getEditor(){const e=this.node.closest("div[contenteditable]"),t=e.length>0?xe.get(e.id):void 0;if(!t)throw new Error(`The box "${this.name}" (id=${this.node.id}) is not rendered in the editor.`);return t}getContainer(){return this.node.find(".lake-box-container")}setToolbar(e){let t;try{t=this.getEditor()}catch(e){}let i=null;const n=()=>{i&&i.position()};this.event.on("focus",(()=>{i=new ze({root:t?t.popupContainer:I(document.body),box:this,items:e,locale:t?t.locale:void 0}),i.render(),t&&t.root.on("scroll",n)})),this.event.on("blur",(()=>{i&&(i.unmount(),i=null),t&&t.root.off("scroll",n)}))}render(){const e=ye.get(this.name);if(void 0===e)return;this.event.emit("beforeunmount"),this.event.removeAllListeners(),this.addFramework();const t=e.render(this);if(void 0!==t){const e=this.getContainer();e.empty(),e.append(t)}A(`The box "${this.name}" (id: ${this.node.id}) rendered`)}unmount(){this.event.emit("blur"),this.event.emit("beforeunmount"),this.event.removeAllListeners(),this.node.empty(),A(`The box "${this.name}" (id: ${this.node.id}) unmounted`)}getHTML(){const e=ye.get(this.name);return void 0===e?"":void 0===e.html?this.node.outerHTML():e.html(this)}}function Fe(e){const t=ge(0);if("string"==typeof e){const i=new Ve(e);return t.set(i.node.id,i),i}const i=(e=I(e)).closestContainer();if(0===i.length){let i=t.get(e.id);return i||(i=new Ve(e),t.set(e.id,i),i)}const n=ge(i.id);let s=t.get(e.id);return s?(n.set(e.id,s),t.delete(e.id),s):(s=n.get(e.id),s||(s=new Ve(e),n.set(e.id,s),s))}function Re(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function je(e){const t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=t=>{t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress&&e.onProgress(t)});const i=new FormData,n=e.data||{};Object.keys(n).forEach((e=>{const t=n[e];Array.isArray(t)?t.forEach((t=>{i.append(`${e}[]`,t)})):i.append(e,t)}));const s=e.filename||"file";e.file instanceof Blob?i.append(s,e.file,e.file.name):i.append(s,e.file),t.onerror=t=>{e.onError&&e.onError(t)},t.onload=()=>{if(t.status<200||t.status>=300){if(!e.onError)return;return e.onError(function(e,t){const i=`Cannot ${e.method} ${e.action} ${t.status}'`,n=new Error(i);return n.status=t.status,n.method=e.method,n.url=e.action,n}(e,t),Re(t))}if(e.onSuccess)return e.onSuccess(Re(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const o=e.headers||{};return null!==o["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(o).forEach((e=>{null!==o[e]&&t.setRequestHeader(e,o[e])})),t.send(i),t}function qe(e){const{editor:t,name:i,file:n,onError:s,onSuccess:o}=e,{requestMethod:r,requestAction:a,requestTypes:l}=t.config[i];if(l.indexOf(n.type)<0)throw s&&s(`File "${n.name}" is not allowed for uploading.`),new Error(`Cannot upload file "${n.name}" because its type "${n.type}" is not found in ['${l.join("', '")}'].`);const c=t.selection.insertBox(i,{url:URL.createObjectURL(n),status:"uploading",name:n.name,size:n.size,type:n.type,lastModified:n.lastModified});let d=je({onProgress:e=>{const t=c.node.find(".lake-percent"),i=Math.round(e.percent);t.text(`${i<100?i:99} %`)},onError:(e,t)=>{d=null,A(e.toString(),t),c.updateValue("status","error"),c.render(),s&&s(e.toString())},onSuccess:e=>{if(d=null,!e.url)return c.updateValue("status","error"),c.render(),void(s&&s("Cannot find the url field."));c.updateValue({status:"done",url:e.url}),c.render(),t.history.save(),o&&o()},file:n,action:a,method:r});return c.event.on("beforeunmount",(()=>{d&&(d.abort(),A("Upload canceled"))})),c}var We=Object.freeze({__proto__:null,appendBreak:D,camelCase:l,changeTagName:V,debug:A,denormalizeValue:f,encode:r,fileSize:w,fixNumberedList:F,fromBase64:h,getBox:Fe,getCSS:y,getDeepElement:H,inString:c,mergeNodes:O,modifierText:v,morph:he,nodePosition:pe,normalizeValue:g,parseStyle:m,query:I,removeBreak:Z,removeZWS:$,request:je,safeTemplate:a,scrollToNode:ue,setBlockIndent:R,splitNodes:P,template:s,toBase64:d,toHex:u,toNodeList:x,uploadFile:qe,wrapNodeList:z});class Ue{constructor(e){this.fragment=null!=e?e:document.createDocumentFragment()}get(){return this.fragment}find(e){const t=[];let i=new E(this.fragment.firstChild);for(;i.length>0;)i.matches(e)?t.push(i.get(0)):i.isElement&&i.find(e).each((e=>{t.push(e)})),i=i.next();return new E(t)}append(e){I(e).each((e=>{this.fragment.appendChild(e)}))}}const Ke={id:/^[\w-]+$/,class:/^[\w- ]+$/,style:{"text-align":["left","center","right","justify","start","end"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function Ge(){return{h1:Object.assign({},Ke),h2:Object.assign({},Ke),h3:Object.assign({},Ke),h4:Object.assign({},Ke),h5:Object.assign({},Ke),h6:Object.assign({},Ke),p:Object.assign({},Ke),blockquote:Object.assign(Object.assign({},Ke),{type:["info","tip","success","warning","error","danger"]}),ul:Object.assign(Object.assign({},Ke),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},Ke),{start:/^\d+$/,indent:/^\d+$/}),li:{value:["true","false"]},table:{style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/}},tr:{style:{height:/^-?\d+(px|%)$/i}},th:"td",td:{colspan:/^\d+$/,rowspan:/^\d+$/,style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/,"text-align":["left","center","right","justify"]}},"lake-box":{type:["inline","block"],name:/^[\w-]+$/,value:/^[^"]+$/,focus:["start","center","end"]},br:{},hr:{},img:{src:/^[^"]+$/,width:/^-?\d+px$/i,height:/^-?\d+px$/i,"data-lake-value":/^[^"]+$/,alt:/^[^"]+$/,style:{width:/^-?\d+px$/i,height:/^-?\d+px$/i}},span:{class:/^[\w- ]+$/,style:{color:/^[^"]+$/,"background-color":/^[^"]+$/,"font-family":/^[^;]+$/,"font-size":/^[^"]+$/}},b:"strong",strong:{},em:"i",i:{},u:{},s:{},sub:{},sup:{},code:{},a:{class:/^[\w- ]+$/,name:/^[\w-]+$/,href:/^[^"]+$/,target:/^[\w-]+$/,rel:/^[^"]+$/,download:/^[^"]+$/},"lake-bookmark":{type:["anchor","focus"]}}}class Xe{constructor(e,t=Ge()){this.rules=t,this.source="string"==typeof e?this.parseHTML(e):e}parseHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");return new E(t.querySelector("body"))}static matchRule(e,t){return"string"==typeof e?e===t:Array.isArray(e)?e.indexOf(t)>=0:e instanceof RegExp&&e.test(t)}static getOpenTagString(e,t){let i=e.name,n=t[i];if(!n)return"";"string"==typeof n&&(i=n,n=t[i]);const s=e.get(0);if(!s.hasAttributes())return i;const o=new Map;for(const e of s.attributes)if(n[e.name]&&("style"!==e.name&&Xe.matchRule(n[e.name],e.value)&&o.set(e.name,e.value),"style"===e.name)){const t=n.style,i=new Map,s=m(e.value);for(const e of Object.keys(s)){const n=s[e];t[e]&&Xe.matchRule(t[e],n)&&i.set(e,n)}o.set("style",i)}let r=i;for(const[e,t]of o)if("style"===e){let e="";for(const[i,n]of t)e+=`${i}: ${n.replace(/"/g,""")}; `;""!==e&&(r+=` style="${e.trim()}"`)}else r+=` ${e}="${t}"`;return r}static getClosedTagString(e,t){let i=e.name;const n=t[i];return n?("string"==typeof n&&(i=n),i):""}static getTrimmedText(e){const t=e.parent(),i=e.prev(),n=e.next();let s=e.text();return(i.isBlock||i.isBlockBox)&&(n.isBlock||n.isBlockBox)||0===i.length&&0===n.length&&t.isBlock?s=s.replace(/^[\u0020\t\r\n]+|[\u0020\t\r\n]+$/g,""):i.isBlock||i.isBlockBox||0===i.length&&t.isBlock?s=s.replace(/^[\u0020\t\r\n]+/,""):(n.isBlock||n.isBlockBox||0===n.length&&t.isBlock)&&(s=s.replace(/[\u0020\t\r\n]+$/,"")),s}getHTML(){const e=this.rules;let t="";for(const i of function*t(i){let n=i.first();for(;n.length>0;){const i=n.next();if(n.isText)yield r(Xe.getTrimmedText(n));else if(n.isVoid){const t=Xe.getOpenTagString(n,e);""!==t&&(yield`<${t} />`)}else if(n.isElement){const i=Xe.getOpenTagString(n,e),s=Xe.getClosedTagString(n,e);""!==i&&(yield`<${i}>`),n.isBox||(yield*t(n)),""!==s&&(yield`</${s}>`)}n=i}}(this.source))t+=i;return t.trim()}getFragment(){const e=this.getHTML(),t=this.parseHTML(e),i=document.createDocumentFragment();let n=t.first();for(;n.length>0;){const e=n.next();i.appendChild(n.get(0)),n=e}return i}}class Qe{constructor(e){this.content=e}getHTML(){let e=this.content;return e=e.replace(/ {2}/g," "),e=r(e.trim()),e=`<p>${e}</p>`,e=e.replace(/(\r\n){2,}/g,"</p><p><br /></p><p>"),e=e.replace(/\r\n/g,"</p><p>"),e=e.replace(/[\r\n]{2,}/g,"</p><p><br /></p><p>"),e=e.replace(/[\r\n]/g,"</p><p>"),e}getFragment(){return new Xe(this.getHTML()).getFragment()}}function Ye(e,t){if(e.commonAncestor.isOutside)return;const i=(t=I(t)).get(0),n=e.get();n.insertNode(i),n.setEndAfter(i),n.collapse(!1)}function Je(e){if(e.commonAncestor.isOutside)return{anchor:new E,focus:new E};const t=e.startNode.closest("lake-box");if(t.length>0)return e.isBoxStart?t.attr("focus","start"):e.isBoxEnd?t.attr("focus","end"):t.attr("focus","center"),{anchor:new E,focus:t};if(e.isCollapsed){const t=e.clone();t.collapseToEnd();const i=I('<lake-bookmark type="focus" />');return Ye(t,i),{anchor:new E,focus:i}}const i=e.clone();i.collapseToStart();const n=I('<lake-bookmark type="anchor" />');Ye(i,n);const s=e.clone();s.collapseToEnd();const o=I('<lake-bookmark type="focus" />');return Ye(s,o),{anchor:n,focus:o}}function et(e,t){const i=e.prev(),n=e.next();if(i.isText||n.isText){const t=e.parent();e.remove(),t.get(0).normalize()}else if(0===i.length&&0===n.length){if(e.parent().isMark&&t){const i=new E(document.createTextNode(""));e.before(i),t.setStartAfter(i),t.collapseToStart()}e.remove()}else e.remove()}function tt(e,t){const i=t.anchor,n=t.focus;if(i.length>0&&0===n.length)et(i);else{if(n.length>0&&0===i.length){if(n.isBox){const t=Fe(n);0===t.getContainer().length&&t.render();const i=n.attr("focus");return"start"===i?e.selectBoxStart(n):"center"===i?e.selectBox(n):e.selectBoxEnd(n),void n.removeAttr("focus")}return e.setStartBefore(n),e.collapseToStart(),void et(n,e)}if(i.length>0&&n.length>0){const t=new M;t.selectNode(i),t.collapseToEnd(),-1===t.compareAfterNode(n)?(e.setStartBefore(n),et(n),e.setEndBefore(i),et(i)):(e.setStartBefore(i),et(i),e.setEndBefore(n),et(n))}}}function it(e){if(e.commonAncestor.isOutside)return;F(e.getBlocks())}function nt(e){if(e.isCollapsed)return;if(e.adjustBox(),e.adjustTable(),e.isInoperative)return;const t=e.startNode.closestBlock(),i=e.endNode.closestBlock(),n=t.get(0)===i.get(0);if(e.get().deleteContents(),e.adjustBlock(),n){const t=e.getBlocks()[0];if(t&&t.isEmpty){const i=D(t);e.setStartBefore(i),e.collapseToStart()}return}const s=e.getBlocks()[0];if(!s)return;const o=s.prev();if(0===o.length)return;const r=Je(e);O(o,s),tt(e,r),it(e)}function st(e,t){if(t instanceof Ue&&(t=t.get()),e.commonAncestor.isOutside)return;e.isCollapsed?e.adjustBox():nt(e);Z(e.startNode.closestBlock());const i=Je(e);i.focus.before(t),tt(e,i),e.adjustBlock()}function ot(e,t){if(e.commonAncestor.isOutside)return;if(e.isCollapsed){if(e.commonAncestor.closest("lake-box").isBlockBox)return}if("string"!=typeof t){const i=e.getBlocks();for(const e of i)e.css(t);return}const i=I(t),n=i.name,s=i.get(0).attributes,o=e.getBlocks();if(o.length>0){const t=Je(e);for(const e of o)if(e.name===n&&0===i.first().length)for(const t of s)e.attr(t.name,t.value);else{const t=i.clone(!0);t.isList&&e.isList&&""!==e.attr("indent")&&t.attr("indent",e.attr("indent"));const n=H(t);let s=e.first();for(;s.length>0;){const e=s.next();n.append(s),n.name!==s.name&&"li"!==s.name||s.remove(!0),s=e}e.replaceWith(t)}return tt(e,t),void it(e)}const r=Je(e),a=function(e){const t=e.commonAncestor.closest('div[contenteditable="true"],td');let i=[];if(0===t.length)return i;let n=t.first(),s=!0;for(;n.length>0;){if(n.isMark||n.isText||n.isBookmark||n.isInlineBox)i.push(n);else{if(!s)break;i=[]}e.intersectsNode(n)&&(s=!1),n=n.next()}return i}(e),l=z(a,i);if(tt(e,r),it(e),l.isEmpty){const t=D(l);e.setStartBefore(t),e.collapseToStart()}}function rt(e){if(e.commonAncestor.isOutside)return{start:null,end:null};e.isCollapsed?e.adjustBox():nt(e);const t=e.startNode,i=t.closestOperableBlock();if(0===i.length)return{start:null,end:null};let n=i.parent();n.isOutside&&(n=t.closestContainer());const s=P(t,e.startOffset,n);let o=null,r=null;return s&&(o=s.start,r=s.end),!s&&t.isBlock&&(e.startOffset>0&&(o=t.children()[e.startOffset-1]),r=t.children()[e.startOffset],r&&!r.isBlock&&(r=null)),o&&o.isEmpty&&D(o),r&&(r.isEmpty&&D(r),e.shrinkBefore(r)),it(e),{start:o,end:r}}function at(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function lt(e,t,i){let n=null,s=null,o=e.closestBlock();0===o.length&&(o=e.closestContainer());const r=P(e,t,o);return r&&(i?(at(r.start),at(r.end),r.start.isEmpty||(n=r.start),r.end.isEmpty||(s=r.end)):(n=r.start,s=r.end)),{start:n,end:s}}function ct(e,t=!0){if(e.commonAncestor.isOutside)return{start:null,center:null,end:null};if(e.adjustBox(),e.isCollapsed){const i=lt(e.startNode,e.startOffset,t);return i.start?(e.setStartAfter(i.start),e.collapseToStart()):i.end&&(e.setStartBefore(i.end),e.collapseToStart()),{start:i.start,center:null,end:i.end}}const i=lt(e.startNode,e.startOffset,t);i.start?e.setStartAfter(i.start):i.end&&e.setStartBefore(i.end);const n=lt(e.endNode,e.endOffset,t);return n.start?e.setEndAfter(n.start):n.end&&e.setEndBefore(n.end),{start:i.start,center:n.start,end:n.end}}function dt(e,t){const i=e.text();let n=e;for(;n.length>0;){const e=n.parent();if(!e.isMark||i!==e.text()||!n.isText&&n.name===t&&""!==n.attr("style"))break;n=e}return n}function ht(e,t){if(e.commonAncestor.isOutside)return;let i=I(t);const n=i.name,s=m(i.attr("style"));if(e.isCollapsed){if(e.isBox){const t=e.startNode.closest("lake-box");if("block"===Fe(t).type){const i=I("<p><br /></p>");e.isBoxStart?t.before(i):t.after(i),e.shrinkAfter(i)}else e.adjustBox()}Z(e.startNode.closestBlock());const t=new E(document.createTextNode("")),o=ct(e);if(o.start){const e=function(e){if(!e.isMark)return null;let t=e.clone(),i=e.last();for(;i.length>0;){if(i.isMark){const e=i.clone();t.append(e),t=e}i=i.last()}return t}(o.start);if(e)if(e.name===n)e.css(s),i=e;else{H(e).append(t),i.append(e)}}return""===i.text()&&i.append(t),Ye(e,i),function(e){const t=e.prev();t.length>0&&t.isText&&t.isEmpty&&t.remove();const i=e.next();i.length>0&&i.isText&&i.isEmpty&&i.remove()}(i),void e.shrinkAfter(i)}ct(e);const o=e.getMarks(!0),r=Je(e);for(const e of o)if(!e.isEmpty&&e.isText){const t=dt(e,n);if(t.isMark&&t.name===n)t.css(s);else{const e=i.clone();t.before(e),e.append(t)}}tt(e,r)}function pt(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function ut(e,t){if(e.commonAncestor.isOutside)return;let i;if(t){i=I(t).name}if(e.isCollapsed){if(e.isBox)return;if(i&&0===e.commonAncestor.closest(i).length)return;const t=ct(e,!1);if(!t.start)return;t.end&&pt(t.end);const n=new E(document.createTextNode("")),s=function(e,t){if(!e.isMark||!t)return null;let i=e.clone(),n=e.last();for(;n.length>0;){if(n.isMark&&n.name!==t){const e=n.clone();i.append(e),i=e}n=n.last()}if(i.name===t){if(!(i.first().length>0))return null;i=i.first()}return i}(t.start,i);if(!s)return t.start.after(n),pt(t.start),n.prev().isText?(e.setStartAfter(n.prev()),e.collapseToStart(),void n.remove()):(e.setStartAfter(n),void e.collapseToStart());return H(s).append(n),t.start.after(s),pt(t.start),void e.shrinkAfter(s)}ct(e);const n=e.getMarks(),s=Je(e);for(const e of n)if(!i||e.name===i){const t=e.parent();e.remove(!e.isEmpty),t.length>0&&t.get(0).normalize()}$(e.commonAncestor),tt(e,s)}function mt(e,t){if(e.commonAncestor.isOutside)return null;const i=I(t);if(e.isCollapsed){let t=e.commonAncestor.closest("a");if(0===t.length){t=i.clone(!0);return Z(e.startNode.closestBlock()),Ye(e,t),t}return""!==i.attr("href")&&t.attr({href:i.attr("href")}),t}ct(e);const n=Je(e);for(const t of e.commonAncestor.getWalker())"a"===t.name&&e.intersectsNode(t)&&t.remove(!0);const s=i.clone(!1);n.anchor.after(s);let o=s.next();for(;o.length>0;){const e=o.next();if(!o.isMark&&!o.isText)break;s.append(o),o=e}return 0===s.first().length&&s.remove(),tt(e,n),s}function gt(e,t,i){if(e.commonAncestor.isOutside)return null;const n=Fe(t);i&&(n.value=i);const s=document.createDocumentFragment();if(s.appendChild(n.node.get(0)),"inline"===n.type)return st(e,s),n.render(),e.selectBoxEnd(n.node),Fe(n.node);const o=rt(e);return o.start&&(e.setEndAfter(o.start),e.collapseToEnd()),o.end&&o.end.isEmpty&&o.end.remove(),st(e,s),n.render(),e.selectBoxEnd(n.node),o.start&&o.start.isEmpty&&o.start.remove(),Fe(n.node)}function ft(e){const t=e.node.closestContainer();if(e.unmount(),e.node.remove(),t.length>0){ge(t.id).delete(e.node.id);ge(0).set(e.node.id,e)}return e}function vt(e){if(e.commonAncestor.isOutside)return null;const t=e.commonAncestor.closest("lake-box");if(0===t.length)return null;const i=Fe(t);if("block"===i.type){const n=I("<p><br /></p>");return t.before(n),e.shrinkAfter(n),ft(i)}e.setStartBefore(t),e.collapseToStart();const n=t.parent();if(ft(i),n.isEmpty){const t=D(n);e.setStartBefore(t),e.collapseToStart()}return i}var wt={exports:{}};function yt(e,t=100,i={}){if("function"!=typeof e)throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw new RangeError("`wait` must not be negative.");const{immediate:n}="boolean"==typeof i?{immediate:i}:i;let s,o,r,a,l;function c(){const t=s,i=o;return s=void 0,o=void 0,l=e.apply(t,i),l}function d(){const e=Date.now()-a;e<t&&e>=0?r=setTimeout(d,t-e):(r=void 0,n||(l=c()))}const h=function(...e){if(s&&this!==s)throw new Error("Debounced method called with different contexts.");s=this,o=e,a=Date.now();const i=n&&!r;return r||(r=setTimeout(d,t)),i&&(l=c()),l};return h.clear=()=>{r&&(clearTimeout(r),r=void 0)},h.flush=()=>{r&&h.trigger()},h.trigger=()=>{l=c(),h.clear()},h}wt.exports.debounce=yt,wt.exports=yt;var xt=fe(wt.exports),bt=fe((function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var n,s,o;if(Array.isArray(t)){if((n=t.length)!=i.length)return!1;for(s=n;0!=s--;)if(!e(t[s],i[s]))return!1;return!0}if(t instanceof Map&&i instanceof Map){if(t.size!==i.size)return!1;for(s of t.entries())if(!i.has(s[0]))return!1;for(s of t.entries())if(!e(s[1],i.get(s[0])))return!1;return!0}if(t instanceof Set&&i instanceof Set){if(t.size!==i.size)return!1;for(s of t.entries())if(!i.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(i)){if((n=t.length)!=i.length)return!1;for(s=n;0!=s--;)if(t[s]!==i[s])return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(s=n;0!=s--;)if(!Object.prototype.hasOwnProperty.call(i,o[s]))return!1;for(s=n;0!=s--;){var r=o[s];if(!e(t[r],i[r]))return!1}return!0}return t!=t&&i!=i}));function kt(e){const t=e.get(0),i={};if(t.hasAttributes())for(const e of t.attributes)i[e.name]=e.value;return i}class Ct{constructor(e){const t=window.getSelection();if(!t)throw new Error("Selection object is null.");this.selection=t,this.container=e,this.range=this.getCurrentRange()}getCurrentRange(){if(this.selection.rangeCount>0){const e=this.selection.getRangeAt(0);return new M(e)}return new M}sync(){this.container.contains(this.range.commonAncestor)&&(this.selection.removeAllRanges(),this.selection.addRange(this.range.get()))}updateByRange(){const e=this.getCurrentRange();this.container.contains(e.commonAncestor)&&(this.range.startNode.get(0)===e.startNode.get(0)&&this.range.startOffset===e.startOffset&&this.range.endNode.get(0)===e.endNode.get(0)&&this.range.endOffset===e.endOffset||(this.range=e))}updateByBookmark(){const e=this.range,t=this.container,i=t.find("lake-box[focus]");if(i.length>0)return tt(e,{anchor:new E,focus:i}),void this.sync();tt(e,{anchor:t.find('lake-bookmark[type="anchor"]'),focus:t.find('lake-bookmark[type="focus"]')}),this.sync()}getAppliedItems(){const e=[];return function(e,t){let i=t.startNode;for(i.isText&&(i=i.parent());i.length>0&&i.isInside;)e.push({node:i,name:i.name,attributes:kt(i),styles:m(i.attr("style"))}),i=i.parent()}(e,this.range),function(e,t){const i=t.startNode;let n;if(i.isText&&i.text().length===t.startOffset){const e=i.next();e.length>0&&e.isElement&&(n=e)}if(i.isElement){const e=i.children();if(e.length>0){const i=e[t.startOffset];i&&i.isElement&&(n=i)}}if(n){let t=n;for(;t.length>0;)t.isElement&&e.push({node:t,name:t.name,attributes:kt(t),styles:m(t.attr("style"))}),t=t.first()}}(e,this.range),e}insertBookmark(){return Je(this.range)}toBookmark(e){return tt(this.range,e)}insertNode(e){return Ye(this.range,e)}insertFragment(e){return st(this.range,e)}deleteContents(){return nt(this.range)}setBlocks(e){return ot(this.range,e)}splitBlock(){return rt(this.range)}splitMarks(e){return ct(this.range,e)}addMark(e){return ht(this.range,e)}removeMark(e){return ut(this.range,e)}fixList(){return it(this.range)}insertLink(e){return mt(this.range,e)}selectBox(e){let t=e;t=e instanceof Ve?e.node:e,this.range.selectBox(t)}insertBox(e,t){const i=gt(this.range,e,t);if(!i)throw new Error(`The box "${e}" cannot be inserted outside the editor.`);return i}removeBox(e=null){return e&&this.selectBox(e),vt(this.range)}}class St{constructor(e){this.commandMap=new Map,this.selection=e}add(e,t){this.commandMap.set(e,t)}delete(e){this.commandMap.delete(e)}getNames(){return Array.from(this.commandMap.keys())}has(e){return void 0!==this.commandMap.get(e)}getItem(e){const t=this.commandMap.get(e);if(void 0===t)throw new Error(`Command "${e}" has not been defined yet.`);return t}isDisabled(e){const t=this.getItem(e);if(!t.isDisabled)return!1;const i=this.selection.getAppliedItems();return t.isDisabled(i)}isSelected(e){const t=this.getItem(e);if(!t.isSelected)return!1;const i=this.selection.getAppliedItems();return t.isSelected(i)}selectedValues(e){const t=this.getItem(e);if(!t.selectedValues)return[];const i=this.selection.getAppliedItems();return t.selectedValues(i)}execute(e,...t){const i=this.selection.container,n=this.selection.range;i.contains(n.commonAncestor)||n.shrinkAfter(i);this.getItem(e).execute.apply(this,t),A(`Command "${e}" executed`)}}class Bt{constructor(e){this.canSave=!0,this.list=[],this.index=0,this.limit=100,this.event=new we,this.selection=e,this.container=e.container}removeBookmark(e){return e.replace(/(<lake-box[^>]+)\s+focus="\w+"([^>]*>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"")}getValue(e){return new Xe(e).getHTML()}addIdToBoxes(e){e.find("lake-box").each((e=>{const t=new E(e),i=`${t.attr("name")}-${t.attr("value")}`;t.attr("id",i)}))}removeIdfromBoxes(e){e.find("lake-box").each((e=>{new E(e).removeAttr("id")}))}morphContainer(e){const t=this.container,i={beforeChildrenUpdated:e=>{if("lake-box"===new E(e).name)return!1},afterAttributeUpdated:(e,i)=>{const n=new E(i);if(["name","value"].indexOf(e)>=0&&"lake-box"===n.name){Fe(n).unmount();ge(t.id).delete(n.id)}}},n=e.clone(!0);this.addIdToBoxes(t),this.addIdToBoxes(n),he(t,n,{callbacks:i}),this.removeIdfromBoxes(t),this.removeIdfromBoxes(n)}get canUndo(){return this.index>1&&!!this.list[this.index-2]}get canRedo(){return!!this.list[this.index]}cloneContainer(){const e=this.selection.range,t=this.container.clone(!0);if(t.find("lake-box").each((e=>{Fe(e).getContainer().empty()})),!this.container.contains(e.commonAncestor))return t;if(e.isInsideBox){const i=e.commonAncestor.closest("lake-box").path(),n=t.find(i),s=e.clone();return s.selectBox(n),Je(s),t}const i=e.startNode.path(),n=e.endNode.path(),s=t.find(i),o=t.find(n),r=e.clone();return r.setStart(s,e.startOffset),r.setEnd(o,e.endOffset),Je(r),t}undo(){if(!this.list[this.index-2])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index>1;){const t=this.list[this.index-2];if(!t)break;this.index--;const i=this.getValue(t);if(this.removeBookmark(i)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("undo",i);break}}this.selection.updateByBookmark(),A(`History undone (index: ${this.index})`)}redo(){if(!this.list[this.index])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index<this.list.length;){const t=this.list[this.index];if(!t)break;this.index++;const i=this.getValue(t);if(this.removeBookmark(i)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("redo",i);break}}this.selection.updateByBookmark(),A(`History redone (index: ${this.index})`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(e={}){var t,i,n;const s=null!==(t=e.inputType)&&void 0!==t?t:"",o=null!==(i=e.update)&&void 0!==i&&i,r=null===(n=e.emitEvent)||void 0===n||n;if(!this.canSave)return;const a=this.cloneContainer(),l=this.getValue(a);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(l)||(o?this.list.splice(this.index-1,1/0,a):(this.list.splice(this.index,1/0,a),this.index++),this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),A(`History saved (index: ${this.index}, inputType: "${s}", update: ${o}, emitEvent: ${r})`),r&&this.event.emit("save",f(l),{inputType:s,update:o,emitEvent:r}))}}var _t={};Object.defineProperty(_t,"__esModule",{value:!0});for(var At="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Lt={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Tt={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:At?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Et={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},It=1;It<20;It++)Et["f"+It]=111+It;function Mt(e,t,i){t&&!("byKey"in t)&&(i=t,t=null),Array.isArray(e)||(e=[e]);var n=e.map((function(e){return Pt(e,t)})),s=function(e){return n.some((function(t){return Dt(t,e)}))};return null==i?s:s(i)}function Pt(e,t){var i=t&&t.byKey,n={},s=(e=e.replace("++","+add")).split("+"),o=s.length;for(var r in Lt)n[Lt[r]]=!1;var a=!0,l=!1,c=void 0;try{for(var d,h=s[Symbol.iterator]();!(a=(d=h.next()).done);a=!0){var p=d.value,u=p.endsWith("?")&&p.length>1;u&&(p=p.slice(0,-1));var m=Nt(p),g=Lt[m];if(p.length>1&&!g&&!Tt[p]&&!Et[m])throw new TypeError('Unknown modifier: "'+p+'"');1!==o&&g||(i?n.key=m:n.which=Zt(p)),g&&(n[g]=!u||null)}}catch(e){l=!0,c=e}finally{try{!a&&h.return&&h.return()}finally{if(l)throw c}}return n}function Dt(e,t){for(var i in e){var n=e[i],s=void 0;if(null!=n&&((null!=(s="key"===i&&null!=t.key?t.key.toLowerCase():"which"===i?91===n&&93===t.which?91:t.which:t[i])||!1!==n)&&s!==n))return!1}return!0}function Zt(e){return e=Nt(e),Et[e]||e.toUpperCase().charCodeAt(0)}function Nt(e){return e=e.toLowerCase(),e=Tt[e]||e}_t.default=Mt,_t.isHotkey=Mt,_t.isCodeHotkey=function(e,t){return Mt(e,t)};var Ot=_t.isKeyHotkey=function(e,t){return Mt(e,{byKey:!0},t)};_t.parseHotkey=Pt,_t.compareHotkey=Dt,_t.toKeyCode=Zt,_t.toKeyName=Nt;class Ht{constructor(e){this.keydownEventList=[],this.keyupEventList=[],this.container=e,this.container.on("keydown",(e=>{const t=e;if(!t.isComposing&&!t.defaultPrevented)for(const e of this.keydownEventList)if(Ot(e.type,t)&&!1===e.listener(t))break})),this.container.on("keyup",(e=>{const t=e;if(!t.isComposing&&!t.defaultPrevented)for(const e of this.keyupEventList)if(Ot(e.type,t)&&!1===e.listener(t))break}))}setKeydown(e,t){this.keydownEventList.push({type:e,listener:t})}setKeyup(e,t){this.keyupEventList.push({type:e,listener:t})}keydown(e){for(const t of this.keydownEventList)if(t.type===e&&!1===t.listener(new KeyboardEvent(e)))break}keyup(e){for(const t of this.keyupEventList)if(t.type===e&&!1===t.listener(new KeyboardEvent(e)))break}}const zt={value:"<p><br /></p>",readonly:!1,spellcheck:!1,tabIndex:0,placeholder:"",indentWithTab:!0,lang:"en-US",minChangeSize:5,historySize:100,onMessage:(e,t)=>{"success"!==e?"warning"!==e?"error"===e&&console.error(t):console.warn(t):console.log(t)},slash:!1};class $t{constructor(e){if(this.unsavedInputData="",this.unsavedInputCount=0,this.state={appliedItems:[],disabledNameMap:new Map,selectedNameMap:new Map,selectedValuesMap:new Map},this.unmountPluginMap=new Map,this.isComposing=!1,this.event=new we,this.box=$t.box,this.copyListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("copy",e)},this.cutListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("cut",e)},this.pasteListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("paste",e)},this.selectionchangeListener=()=>{this.updateSelectionRange(),this.updateBoxSelectionStyle(),this.emitStateChangeEvent()},this.clickListener=e=>{const t=new E(e.target);t.get(0).isConnected&&this.event.emit("click",t)},this.resizeListener=()=>{this.event.emit("resize")},this.scrollListener=()=>{this.event.emit("scroll")},this.updateSelectionRange=xt((()=>{this.selection.updateByRange()}),1,{immediate:!0}),this.updateBoxSelectionStyle=xt((()=>{if(0===this.root.first().length)return;const e=this.selection.range,t=e.clone();t.adjustBox(),this.container.find("lake-box").each((i=>{const n=Fe(i),s=n.getContainer();if(0!==s.length){if(e.compareBeforeNode(s)<0&&e.compareAfterNode(s)>0&&(!e.isCollapsed||e.startNode.get(0)!==s.get(0)||0!==e.startOffset))return s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.removeClass("lake-box-focused"),s.addClass("lake-box-activated"),void n.event.emit("focus");if(t.intersectsNode(n.node))return s.removeClass("lake-box-activated"),void(e.isCollapsed?(s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.addClass("lake-box-focused"),n.event.emit("focus")):(s.removeClass("lake-box-focused"),s.addClass("lake-box-selected"),n.event.emit("blur")));s.removeClass("lake-box-activated"),s.removeClass("lake-box-focused"),s.removeClass("lake-box-selected"),n.event.emit("blur")}}))}),50,{immediate:!0}),this.emitStateChangeEvent=xt((()=>{const e=this.command.getNames();let t=this.selection.getAppliedItems();t.length>0&&!this.container.contains(t[0].node)&&(t=[]);const i=new Map,n=new Map,s=new Map;if(t.length>0)for(const o of e){const e=this.command.getItem(o);if(e.isDisabled&&e.isDisabled(t)&&i.set(o,!0),e.isSelected&&e.isSelected(t)&&n.set(o,!0),e.selectedValues){const i=e.selectedValues(t);i.length>0&&s.set(o,i)}}const o={appliedItems:t,disabledNameMap:i,selectedNameMap:n,selectedValuesMap:s};bt(o,this.state)||(this.toolbar&&this.toolbar.updateState(o),this.event.emit("statechange",o),this.state=o)}),50,{immediate:!1}),!e.root)throw new Error("The root of the config must be specified.");this.root=I(e.root),this.toolbar=e.toolbar,this.config=Object.assign({},zt);for(const t of Object.keys(e))this.config[t]=e[t];this.containerWrapper=I('<div class="lake-container-wrapper" />'),this.container=I('<div class="lake-container" />'),this.overlayContainer=I('<div class="lake-overlay" />'),this.popupContainer=I('<div class="lake-popup lake-custom-properties" />'),this.readonly=this.config.readonly,this.root.addClass("lake-custom-properties"),this.container.attr({contenteditable:this.readonly?"false":"true",spellcheck:this.config.spellcheck?"true":"false",tabindex:this.config.tabIndex.toString()}),""!==this.config.placeholder&&this.container.attr("placeholder",this.config.placeholder),this.selection=new Ct(this.container),this.command=new St(this.selection),this.history=new Bt(this.selection),this.history.limit=this.config.historySize,this.keystroke=new Ht(this.container),xe.set(this.container.id,this)}togglePlaceholderClass(e){const t="lake-placeholder";"<p><br /></p>"===(e=f(e)).replace("<focus />","")?this.container.addClass(t):this.container.removeClass(t)}moveBoxStripText(){const e=this.selection,t=e.range,i=t.startNode.closest(".lake-box-strip"),n=i.closest("lake-box");if("inline"===Fe(n).type)t.isBoxStart?(t.setStartBefore(n),t.collapseToStart()):(t.setStartAfter(n),t.collapseToStart());else{const e=I("<p />");t.isBoxStart?n.before(e):n.after(e),t.setStart(e,0),t.collapseToStart()}const s=i.text();i.html("<br />"),e.insertNode(document.createTextNode(s))}resetUnsavedInputData(){this.unsavedInputData="",this.unsavedInputCount=0}handleInputEvent(e){var t;this.selection.updateByRange();const i=this.selection.range;if(i.isInsideBox)return;if(i.isBoxStart||i.isBoxEnd)return this.moveBoxStripText(),void this.history.save();if("insertText"===(e instanceof CompositionEvent?"insertText":e.inputType)){const i=null!==(t=e.data)&&void 0!==t?t:"";return i.length>1?void this.history.save({inputType:"insertText",update:!1}):(this.unsavedInputData+=i,this.unsavedInputCount++,void(this.unsavedInputData.length<this.config.minChangeSize?this.history.save({inputType:"insertText",update:this.unsavedInputCount>1}):(this.history.save({inputType:"insertText",update:!0}),this.resetUnsavedInputData())))}this.history.save()}bindInputEvents(){this.container.on("compositionstart",(()=>{this.isComposing=!0,this.container.removeClass("lake-placeholder")})),this.container.on("compositionend",(e=>{this.isComposing=!1,this.handleInputEvent(e)})),this.container.on("input",(e=>{const t=e;this.isComposing=t.isComposing,this.isComposing||this.handleInputEvent(e)}))}bindHistoryEvents(){const e=e=>{this.fixContent()&&(this.history.save({update:!0,emitEvent:!1}),e=this.getValue()),this.emitStateChangeEvent(),this.togglePlaceholderClass(e),this.scrollToCaret(),this.event.emit("change",e)};this.history.event.on("undo",(t=>{this.renderBoxes(),e(t),this.resetUnsavedInputData()})),this.history.event.on("redo",(t=>{this.renderBoxes(),e(t),this.resetUnsavedInputData()})),this.history.event.on("save",((t,i)=>{this.removeBoxGarbage(),e(t),"insertText"!==i.inputType&&(this.selection.sync(),this.resetUnsavedInputData())}))}get hasFocus(){const e=document.activeElement;return!!e&&I(e).closest(".lake-container").get(0)===this.container.get(0)}get locale(){return Oe(this.config.lang)}fixContent(){const e=this.selection.range;let t=!1,i=this.container.children();for(const e of i)(e.isBlock||e.isMark)&&""===e.html()&&(e.remove(),t=!0,A(`Content fixed: empty tag "${e.name}" was removed`));if(i=this.container.children(),0===i.length)this.container.html("<p><br /></p>"),e.shrinkBefore(this.container),t=!0,A("Content fixed: default paragraph was added");else if(1===i.length){const n=i[0];if(n.isVoid){const i=I("<p />");n.before(i),i.append(n),e.shrinkAfter(i),t=!0,A(`Content fixed: void element "${n.name}" was wrapped in paragraph`)}}return e.adjustBr(),t}setPluginConfig(e,t){"object"!=typeof this.config[e]&&(this.config[e]={});for(const i of Object.keys(t))void 0===this.config[e][i]&&(this.config[e][i]=t[i])}removeBoxGarbage(){const e=ge(this.container.id);for(const t of e.values())t.node.get(0).isConnected||(t.unmount(),e.delete(t.node.id))}renderBoxes(){this.removeBoxGarbage();const e=this.container,t=ge(e.id);e.find("lake-box").each((e=>{const i=I(e);if(t.get(i.id))return;Fe(i).render()}))}focus(){this.container.focus()}blur(){this.container.blur()}scrollToCaret(){const e=this.selection.range;if(e.isBox)return;const t=e.getRect();if(0===t.x||0===t.y)return;const i=this.container.get(0).getBoundingClientRect(),n=I('<div class="lake-artificial-caret" />'),s=t.x-i.x,o=t.y-i.y;n.css({position:"absolute",top:`${o}px`,left:`${s}px`,width:`${t.width}px`,height:`${t.height}px`,"z-index":"-1"}),this.overlayContainer.find(".lake-artificial-caret").remove(),this.overlayContainer.append(n),ue(n,{behavior:"instant",block:"center",inline:"nearest"}),n.remove()}setValue(e){e=g(e);const t=new Xe(e),i=t.getFragment();this.container.empty(),this.togglePlaceholderClass(t.getHTML()),this.container.append(i),this.renderBoxes(),this.selection.updateByBookmark()}getValue(){const e=this.history.cloneContainer();let t=new Xe(e).getHTML();return t=f(t),t}render(){const e=g(this.config.value),t=new Xe(e),i=t.getFragment();this.root.empty(),this.root.append(this.containerWrapper),this.containerWrapper.append(this.container),this.containerWrapper.append(this.overlayContainer),I(document.body).append(this.popupContainer),this.togglePlaceholderClass(t.getHTML()),this.container.append(i),this.unmountPluginMap=$t.plugin.loadAll(this),this.readonly||(this.selection.updateByBookmark(),this.history.save({emitEvent:!1})),this.renderBoxes(),this.toolbar&&this.toolbar.render(this),this.root.on("scroll",this.scrollListener),document.addEventListener("copy",this.copyListener),window.addEventListener("resize",this.resizeListener),this.readonly||(document.addEventListener("cut",this.cutListener),document.addEventListener("paste",this.pasteListener),document.addEventListener("selectionchange",this.selectionchangeListener),document.addEventListener("click",this.clickListener),this.bindInputEvents(),this.bindHistoryEvents())}unmount(){this.updateSelectionRange.flush(),this.updateBoxSelectionStyle.flush(),this.emitStateChangeEvent.flush();for(const e of this.unmountPluginMap.keys()){const t=this.unmountPluginMap.get(e);t&&(t(),A(`The plugin "${e}" unmounted`))}this.toolbar&&this.toolbar.unmount(),this.removeBoxGarbage(),this.container.find("lake-box").each((e=>{Fe(I(e)).unmount()})),this.event.removeAllListeners(),this.history.event.removeAllListeners(),this.root.off(),this.root.removeClass("lake-custom-properties"),this.root.empty(),this.popupContainer.remove(),document.removeEventListener("copy",this.copyListener),window.removeEventListener("resize",this.resizeListener),this.readonly||(document.removeEventListener("cut",this.cutListener),document.removeEventListener("paste",this.pasteListener),document.removeEventListener("selectionchange",this.selectionchangeListener),document.removeEventListener("click",this.clickListener))}}$t.version="0.1.24",$t.box=new class{add(e){ye.set(e.name,e)}remove(e){ye.delete(e)}getNames(){return Array.from(ye.keys())}},$t.plugin=new class{constructor(){this.pluginMap=new Map}add(e,t){if(this.pluginMap.get(e))throw new Error(`Plugin "${e}" is already defined.`);this.pluginMap.set(e,t)}loadAll(e){const t=new Map;for(const i of this.pluginMap.keys()){const n=this.pluginMap.get(i);if(n&&!1!==e.config[i]){const s=n(e);s&&t.set(i,s)}}return t}};const Vt=[{icon:n.get("numberedList"),value:"numbered",text:e=>e.toolbar.numberedList()},{icon:n.get("bulletedList"),value:"bulleted",text:e=>e.toolbar.bulletedList()},{icon:n.get("checklist"),value:"checklist",text:e=>e.toolbar.checklist()}],Ft=[{icon:n.get("alignLeft"),value:"left",text:e=>e.toolbar.alignLeft()},{icon:n.get("alignCenter"),value:"center",text:e=>e.toolbar.alignCenter()},{icon:n.get("alignRight"),value:"right",text:e=>e.toolbar.alignRight()},{icon:n.get("alignJustify"),value:"justify",text:e=>e.toolbar.alignJustify()}],Rt=[{icon:n.get("increaseIndent"),value:"increase",text:e=>e.toolbar.increaseIndent()},{icon:n.get("decreaseIndent"),value:"decrease",text:e=>e.toolbar.decreaseIndent()}],jt=[{icon:n.get("italic"),value:"italic",text:e=>e.toolbar.italic()},{icon:n.get("underline"),value:"underline",text:e=>e.toolbar.underline()},{icon:n.get("strikethrough"),value:"strikethrough",text:e=>e.toolbar.strikethrough()},{icon:n.get("superscript"),value:"superscript",text:e=>e.toolbar.superscript()},{icon:n.get("subscript"),value:"subscript",text:e=>e.toolbar.subscript()},{icon:n.get("code"),value:"code",text:e=>e.toolbar.code()}],qt=["#f5222d","#fa541c","#fa8c16","#faad14","#fadb14","#a0d911","#52c41a","#13c2c2","#1677ff","#2f54eb","#722ed1","#eb2f96","#fff1f0","#fff2e8","#fff7e6","#fffbe6","#feffe6","#fcffe6","#f6ffed","#e6fffb","#e6f4ff","#f0f5ff","#f9f0ff","#fff0f6","#ffccc7","#ffd8bf","#ffe7ba","#fff1b8","#ffffb8","#f4ffb8","#d9f7be","#b5f5ec","#bae0ff","#d6e4ff","#efdbff","#ffd6e7","#ffa39e","#ffbb96","#ffd591","#ffe58f","#fffb8f","#eaff8f","#b7eb8f","#87e8de","#91caff","#adc6ff","#d3adf7","#ffadd2","#ff7875","#ff9c6e","#ffc069","#ffd666","#fff566","#d3f261","#95de64","#5cdbd3","#69b1ff","#85a5ff","#b37feb","#ff85c0","#ff4d4f","#ff7a45","#ffa940","#ffc53d","#ffec3d","#bae637","#73d13d","#36cfc9","#4096ff","#597ef7","#9254de","#f759ab","#cf1322","#d4380d","#d46b08","#d48806","#d4b106","#7cb305","#389e0d","#08979c","#0958d9","#1d39c4","#531dab","#c41d7f","#a8071a","#ad2102","#ad4e00","#ad6800","#ad8b00","#5b8c00","#237804","#006d75","#003eb3","#10239e","#391085","#9e1068","#820014","#871400","#873800","#874d00","#876800","#3f6600","#135200","#00474f","#002c8c","#061178","#22075e","#780650","#5c0011","#610b00","#612500","#613400","#614700","#254000","#092b00","#002329","#001d66","#030852","#120338","#520339","#000000","#1f1f1f","#262626","#434343","#595959","#8c8c8c","#bfbfbf","#d9d9d9","#f0f0f0","#f5f5f5","#fafafa","#ffffff"],Wt=[{icon:n.get("removeFormat"),value:"",text:e=>e.toolbar.removeColor()}];for(const e of qt)Wt.push({value:e.toLowerCase(),text:e.toUpperCase()});const Ut=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Kt=[{name:"undo",type:"button",icon:n.get("undo"),tooltip:e=>e.toolbar.undo(),onClick:(e,t)=>{e.command.execute(t)}},{name:"redo",type:"button",icon:n.get("redo"),tooltip:e=>e.toolbar.redo(),onClick:(e,t)=>{e.command.execute(t)}},{name:"selectAll",type:"button",icon:n.get("selectAll"),tooltip:e=>e.toolbar.selectAll(),onClick:(e,t)=>{e.command.execute(t)}},{name:"paragraph",type:"button",icon:n.get("paragraph"),tooltip:e=>e.toolbar.paragraph(),isSelected:e=>!!e.find((e=>"p"===e.name)),onClick:e=>{e.command.execute("heading","p")}},{name:"blockQuote",type:"button",icon:n.get("blockQuote"),tooltip:e=>e.toolbar.blockQuote(),onClick:(e,t)=>{e.command.execute(t)}},{name:"numberedList",type:"button",icon:n.get("numberedList"),tooltip:e=>e.toolbar.numberedList(),isSelected:e=>!!e.find((e=>"ol"===e.name)),onClick:e=>{e.command.execute("list","numbered")}},{name:"bulletedList",type:"button",icon:n.get("bulletedList"),tooltip:e=>e.toolbar.bulletedList(),isSelected:e=>!!e.find((e=>"ul"===e.name&&!e.node.hasAttr("type"))),onClick:e=>{e.command.execute("list","bulleted")}},{name:"checklist",type:"button",icon:n.get("checklist"),tooltip:e=>e.toolbar.checklist(),isSelected:e=>!!e.find((e=>"ul"===e.name&&"checklist"===e.node.attr("type"))),onClick:e=>{e.command.execute("list","checklist")}},{name:"alignLeft",type:"button",icon:n.get("alignLeft"),tooltip:e=>e.toolbar.alignLeft(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"left"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","left")}},{name:"alignCenter",type:"button",icon:n.get("alignCenter"),tooltip:e=>e.toolbar.alignCenter(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"center"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","center")}},{name:"alignRight",type:"button",icon:n.get("alignRight"),tooltip:e=>e.toolbar.alignRight(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"right"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","right")}},{name:"alignJustify",type:"button",icon:n.get("alignJustify"),tooltip:e=>e.toolbar.alignJustify(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"justify"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","justify")}},{name:"increaseIndent",type:"button",icon:n.get("increaseIndent"),tooltip:e=>e.toolbar.increaseIndent(),onClick:e=>{e.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:n.get("decreaseIndent"),tooltip:e=>e.toolbar.decreaseIndent(),onClick:e=>{e.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:n.get("bold"),tooltip:e=>e.toolbar.bold(),onClick:(e,t)=>{e.command.execute(t)}},{name:"italic",type:"button",icon:n.get("italic"),tooltip:e=>e.toolbar.italic(),onClick:(e,t)=>{e.command.execute(t)}},{name:"underline",type:"button",icon:n.get("underline"),tooltip:e=>e.toolbar.underline(),onClick:(e,t)=>{e.command.execute(t)}},{name:"strikethrough",type:"button",icon:n.get("strikethrough"),tooltip:e=>e.toolbar.strikethrough(),onClick:(e,t)=>{e.command.execute(t)}},{name:"superscript",type:"button",icon:n.get("superscript"),tooltip:e=>e.toolbar.superscript(),onClick:(e,t)=>{e.command.execute(t)}},{name:"subscript",type:"button",icon:n.get("subscript"),tooltip:e=>e.toolbar.subscript(),onClick:(e,t)=>{e.command.execute(t)}},{name:"code",type:"button",icon:n.get("code"),tooltip:e=>e.toolbar.code(),onClick:(e,t)=>{e.command.execute(t)}},{name:"removeFormat",type:"button",icon:n.get("removeFormat"),tooltip:e=>e.toolbar.removeFormat(),onClick:(e,t)=>{e.command.execute(t)}},{name:"formatPainter",type:"button",icon:n.get("formatPainter"),tooltip:e=>e.toolbar.formatPainter(),onClick:(e,t)=>{e.command.execute(t)}},{name:"link",type:"button",icon:n.get("link"),tooltip:e=>e.toolbar.link(),onClick:(e,t)=>{e.command.execute(t)}},{name:"hr",type:"button",icon:n.get("hr"),tooltip:e=>e.toolbar.hr(),onClick:(e,t)=>{e.command.execute(t)}},{name:"codeBlock",type:"button",icon:n.get("codeBlock"),tooltip:e=>e.toolbar.codeBlock(),onClick:(e,t)=>{e.command.execute(t)}},{name:"video",type:"button",icon:n.get("video"),tooltip:e=>e.toolbar.video(),onClick:(e,t)=>{e.command.execute(t)}},{name:"equation",type:"button",icon:n.get("equation"),tooltip:e=>e.toolbar.equation(),onClick:(e,t)=>{e.command.execute(t)}},{name:"heading",type:"dropdown",downIcon:n.get("down"),defaultValue:"p",tooltip:e=>e.toolbar.heading(),width:"100px",menuType:"list",menuItems:[{value:"h1",text:e=>`<span style="font-weight: bold; font-size: 26px;">${e.toolbar.heading1()}</span>`},{value:"h2",text:e=>`<span style="font-weight: bold; font-size: 24px;">${e.toolbar.heading2()}</span>`},{value:"h3",text:e=>`<span style="font-weight: bold; font-size: 22px;">${e.toolbar.heading3()}</span>`},{value:"h4",text:e=>`<span style="font-weight: bold; font-size: 20px;">${e.toolbar.heading4()}</span>`},{value:"h5",text:e=>`<span style="font-weight: bold; font-size: 18px;">${e.toolbar.heading5()}</span>`},{value:"h6",text:e=>`<span style="font-weight: bold; font-size: 16px;">${e.toolbar.heading6()}</span>`},{value:"p",text:e=>e.toolbar.paragraph()}],onSelect:(e,t)=>{e.command.execute("heading",t)}},{name:"list",type:"dropdown",downIcon:n.get("down"),icon:n.get("list"),tooltip:e=>e.toolbar.list(),menuType:"list",menuItems:Vt,onSelect:(e,t)=>{e.command.execute("list",t)}},{name:"align",type:"dropdown",downIcon:n.get("down"),icon:n.get("alignLeft"),tooltip:e=>e.toolbar.align(),menuType:"list",menuItems:Ft,onSelect:(e,t)=>{e.command.execute("align",t)}},{name:"indent",type:"dropdown",downIcon:n.get("down"),icon:n.get("increaseIndent"),tooltip:e=>e.toolbar.indent(),menuType:"list",menuItems:Rt,onSelect:(e,t)=>{e.command.execute("indent",t)}},{name:"fontFamily",type:"dropdown",downIcon:n.get("down"),defaultValue:"Segoe UI",tooltip:e=>e.toolbar.fontFamily(),width:"100px",menuType:"list",menuItems:[{value:"Arial",text:'<span style="font-family: Arial;">Arial</span>'},{value:"Arial Black",text:"<span style=\"font-family: 'Arial Black';\">Arial Black</span>"},{value:"Comic Sans MS",text:"<span style=\"font-family: 'Comic Sans MS';\">Comic Sans MS</span>"},{value:"Courier New",text:"<span style=\"font-family: 'Courier New';\">Courier New</span>"},{value:"Georgia",text:'<span style="font-family: Georgia;">Georgia</span>'},{value:"Helvetica",text:'<span style="font-family: Helvetica;">Helvetica</span>'},{value:"Impact",text:'<span style="font-family: Impact;">Impact</span>'},{value:"Segoe UI",text:"<span style=\"font-family: 'Segoe UI';\">Segoe UI</span>"},{value:"Tahoma",text:'<span style="font-family: Tahoma;">Tahoma</span>'},{value:"Times New Roman",text:"<span style=\"font-family: 'Times New Roman';\">Times New Roman</span>"},{value:"Trebuchet MS",text:"<span style=\"font-family: 'Trebuchet MS';\">Trebuchet MS</span>"},{value:"Verdana",text:'<span style="font-family: Verdana;">Verdana</span>'}],onSelect:(e,t)=>{e.command.execute("fontFamily",t)}},{name:"fontSize",type:"dropdown",downIcon:n.get("down"),defaultValue:"16px",tooltip:e=>e.toolbar.fontSize(),width:"65px",menuType:"list",menuItems:[{value:"12px",text:"12px"},{value:"14px",text:"14px"},{value:"16px",text:"16px"},{value:"18px",text:"18px"},{value:"22px",text:"22px"},{value:"24px",text:"24px"},{value:"32px",text:"32px"}],onSelect:(e,t)=>{e.command.execute("fontSize",t)}},{name:"moreStyle",type:"dropdown",icon:n.get("more"),tooltip:e=>e.toolbar.moreStyle(),menuType:"list",menuItems:jt,selectedValues:e=>{var t;const i=[];for(const n of e)if(n.node.isMark){const e=null!==(t=Ut.get(n.name))&&void 0!==t?t:n.name;i.push(e)}return i},onSelect:(e,t)=>{e.command.execute(t)}},{name:"fontColor",type:"dropdown",downIcon:n.get("down"),icon:n.get("fontColor"),accentIcon:n.get("fontColorAccent"),defaultValue:"#f5222d",tooltip:e=>e.toolbar.fontColor(),menuType:"color",menuItems:Wt,menuWidth:"296px",onSelect:(e,t)=>{e.command.execute("fontColor",t)}},{name:"highlight",type:"dropdown",downIcon:n.get("down"),icon:n.get("highlight"),accentIcon:n.get("highlightAccent"),defaultValue:"#fadb14",tooltip:e=>e.toolbar.highlight(),menuType:"color",menuItems:Wt,menuWidth:"296px",onSelect:(e,t)=>{e.command.execute("highlight",t)}},{name:"image",type:"upload",icon:n.get("image"),tooltip:e=>e.toolbar.image(),accept:"image/*",multiple:!0},{name:"file",type:"upload",icon:n.get("attachment"),tooltip:e=>e.toolbar.file(),accept:"*",multiple:!0}],Gt=["undo","redo","|","heading","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],Xt=new Map;for(const e of Kt)Xt.set(e.name,e);var Qt={type:"block",name:"hr",render:e=>{const t=e.getEditor(),i=e.getContainer(),n=I('<div class="lake-hr"><hr /></div>');i.empty(),i.append(n),n.on("click",(()=>{t.selection.selectBox(e)}))},html:()=>"<hr />"};const Yt="#57606a",Jt="#444d56",ei="#953800",ti="#0550ae",ii="#444d56",ni="#24292e",si="#005cc5",oi="#0550ae",ri="#444d56",ai="#444d56",li="#0a3069",ci="#0550ae",di="#0550ae",hi="#116329",pi="#0550ae",ui="#cf222e",mi="#24292f",gi="#cf222e",fi="#57606a",vi="#57606a",wi="#8250df",yi="#0550ae",xi="#f6f8fa",bi="#cf222e",ki="#0550ae",Ci="#005cc5",Si="#444d56",Bi="#444d56";function _i(e){const{HighlightStyle:t,tags:i}=e;return t.define([{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:Yt},{tag:[i.name],color:Jt},{tag:[i.variableName,i.self],color:ei},{tag:[i.typeName,i.tagName],color:ti},{tag:[i.propertyName,i.attributeName],color:ii},{tag:[i.className],color:ni},{tag:[i.labelName],color:si},{tag:[i.namespace],color:oi},{tag:[i.macroName],color:ri},{tag:[i.literal],color:ai},{tag:[i.string,i.docString,i.character,i.attributeValue,i.unit],color:li},{tag:[i.number,i.integer,i.float],color:ci},{tag:[i.bool,i.null,i.atom],color:di},{tag:[i.regexp,i.escape,i.url],color:hi},{tag:[i.color],color:pi},{tag:[i.keyword,i.operatorKeyword,i.controlKeyword,i.definitionKeyword,i.moduleKeyword],color:ui},{tag:[i.modifier],color:mi},{tag:[i.operator,i.derefOperator,i.arithmeticOperator,i.logicOperator,i.bitwiseOperator,i.compareOperator,i.updateOperator,i.definitionOperator,i.typeOperator,i.controlOperator],color:gi},{tag:[i.punctuation,i.separator,i.bracket,i.angleBracket,i.squareBracket,i.paren,i.brace,i.contentSeparator],color:fi},{tag:[i.content],color:vi},{tag:[i.meta,i.documentMeta,i.annotation,i.processingInstruction],color:wi},{tag:i.heading,fontWeight:"bold",color:yi},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.link,textDecoration:"underline"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:[i.invalid,i.inserted,i.deleted,i.changed],color:xi},{tag:[i.definition(i.name)],color:bi},{tag:[i.constant(i.name)],color:ki},{tag:[i.function(i.variableName)],color:Ci},{tag:[i.standard(i.name)],color:Si},{tag:[i.special(i.variableName)],color:Bi}])}var Ai={type:"block",name:"codeBlock",render:e=>{var t;const i=e.getEditor(),s=I('<div class="lake-code-block" />'),o=e.getContainer();o.css("width",i.container.innerWidth()-2+"px"),o.empty(),o.append(s);const r=s.get(0);if(!r)return;const a=window.LakeCodeMirror;if(!a)return i.readonly?void e.node.hide():(s.addClass("lake-code-block-error"),s.text('\n The code cannot be displayed because window.LakeCodeMirror is not found.\n Please check if the "lake-codemirror" library is added to this page.\n '.trim()),void s.on("click",(()=>{i.selection.selectBox(e)})));const{EditorState:l,Compartment:c,EditorView:d,keymap:h,history:p,defaultKeymap:u,historyKeymap:m,indentWithTab:g,syntaxHighlighting:f}=a,v=a.langItems,w=i.config.codeBlock,y=v.filter((e=>w.langList.indexOf(e.value)>=0)),x=new Map;for(const e of y)x.set(e.value,e);const b=e.value,k=x.get(b.lang),C=new c,S=xt((t=>{i.selection.updateByRange(),i.isComposing||(e.updateValue("code",t),i.history.save())}),1,{immediate:!1}),B=d.updateListener.of((e=>{e.docChanged&&S(e.state.doc.toString())})),_=new d({parent:r,doc:null!==(t=b.code)&&void 0!==t?t:"",extensions:[l.readOnly.of(i.readonly),d.editable.of(!i.readonly),p(),h.of([...u,...m,g]),f(_i(a)),C.of(k&&k.component?k.component():[]),B]});s.find('[contenteditable="true"]').attr("tabindex","-1");const L=new He({root:s,name:"langType",downIcon:n.get("down"),defaultValue:k?b.lang:w.defaultLang,tooltip:i.locale.codeBlock.langType(),menuType:"list",menuHeight:"200px",menuItems:y.map((e=>({value:e.value,text:e.text}))),onSelect:t=>{e.updateValue({lang:t}),e.unmount(),e.render(),i.selection.selectBox(e),i.history.save()}});L.render();const T=()=>{o.css("width",i.container.innerWidth()-2+"px")};i.event.on("resize",T),s.on("click",(()=>{_.hasFocus||_.focus()})),e.event.on("beforeunmount",(()=>{L.unmount(),_.destroy(),i.event.off("resize",T),A("CodeMirror destroyed")}))}};function Li(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))}
|
|
18
|
+
`;class Ve{constructor(e){if(this.event=new we,"string"==typeof e){const t=ye.get(e);if(void 0===t)throw new Error(`The box "${e}" has not been defined yet.`);const i=r(t.type),n=r(t.name);this.node=I(a`<lake-box type="${i}" name="${n}"></lake-box>`),t.value&&(this.value=t.value)}else{this.node=I(e);const t=ye.get(this.name);if(void 0===t)throw new Error(`The box "${this.name}" has not been defined yet.`);t.value&&!this.node.hasAttr("value")&&(this.value=t.value)}}addFramework(){let e=this.getContainer();0===e.length?(this.node.html($e),e=this.getContainer()):(e.off("mouseenter"),e.off("mouseleave"),e.off("click")),e.on("mouseenter",(()=>{e.hasClass("lake-box-selected")||e.hasClass("lake-box-focused")||e.hasClass("lake-box-activated")||e.addClass("lake-box-hovered")})),e.on("mouseleave",(()=>{e.removeClass("lake-box-hovered")})),e.on("click",(()=>{A(`The box "${this.name}" (id = ${this.node.id}) value:`),A(this.value)})),"block"===this.type&&this.node.isContentEditable&&e.attr("draggable","true")}get type(){return this.node.attr("type")}get name(){return this.node.attr("name")}get value(){const e=this.node.attr("value");return""===e?{}:JSON.parse(h(e))}set value(e){this.node.attr("value",d(JSON.stringify(e)))}updateValue(e,t){const i=this.value;if("string"==typeof e)i[e]=t;else for(const t of Object.keys(e))i[t]=e[t];this.value=i}getEditor(){const e=this.node.closest("div[contenteditable]"),t=e.length>0?xe.get(e.id):void 0;if(!t)throw new Error(`The box "${this.name}" (id=${this.node.id}) is not rendered in the editor.`);return t}getContainer(){return this.node.find(".lake-box-container")}setToolbar(e){let t;try{t=this.getEditor()}catch(e){}let i=null;const n=()=>{i&&i.position()};this.event.on("focus",(()=>{i=new ze({root:t?t.popupContainer:I(document.body),box:this,items:e,locale:t?t.locale:void 0}),i.render(),t&&t.root.on("scroll",n)})),this.event.on("blur",(()=>{i&&(i.unmount(),i=null),t&&t.root.off("scroll",n)}))}render(){const e=ye.get(this.name);if(void 0===e)return;this.event.emit("beforeunmount"),this.event.removeAllListeners(),this.addFramework();const t=e.render(this);if(void 0!==t){const e=this.getContainer();e.empty(),e.append(t)}A(`The box "${this.name}" (id: ${this.node.id}) rendered`)}unmount(){this.event.emit("blur"),this.event.emit("beforeunmount"),this.event.removeAllListeners(),this.node.empty(),A(`The box "${this.name}" (id: ${this.node.id}) unmounted`)}getHTML(){const e=ye.get(this.name);return void 0===e?"":void 0===e.html?this.node.outerHTML():e.html(this)}}function Fe(e){const t=ge(0);if("string"==typeof e){const i=new Ve(e);return t.set(i.node.id,i),i}const i=(e=I(e)).closestContainer();if(0===i.length){let i=t.get(e.id);return i||(i=new Ve(e),t.set(e.id,i),i)}const n=ge(i.id);let s=t.get(e.id);return s?(n.set(e.id,s),t.delete(e.id),s):(s=n.get(e.id),s||(s=new Ve(e),n.set(e.id,s),s))}function Re(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function je(e){const t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=t=>{t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress&&e.onProgress(t)});const i=new FormData,n=e.data||{};Object.keys(n).forEach((e=>{const t=n[e];Array.isArray(t)?t.forEach((t=>{i.append(`${e}[]`,t)})):i.append(e,t)}));const s=e.filename||"file";e.file instanceof Blob?i.append(s,e.file,e.file.name):i.append(s,e.file),t.onerror=t=>{e.onError&&e.onError(t)},t.onload=()=>{if(t.status<200||t.status>=300){if(!e.onError)return;return e.onError(function(e,t){const i=`Cannot ${e.method} ${e.action} ${t.status}'`,n=new Error(i);return n.status=t.status,n.method=e.method,n.url=e.action,n}(e,t),Re(t))}if(e.onSuccess)return e.onSuccess(Re(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const o=e.headers||{};return null!==o["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(o).forEach((e=>{null!==o[e]&&t.setRequestHeader(e,o[e])})),t.send(i),t}function qe(e){const{editor:t,name:i,file:n,onError:s,onSuccess:o}=e,{requestMethod:r,requestAction:a,requestTypes:l}=t.config[i];if(l.indexOf(n.type)<0)throw s&&s(`File "${n.name}" is not allowed for uploading.`),new Error(`Cannot upload file "${n.name}" because its type "${n.type}" is not found in ['${l.join("', '")}'].`);const c=t.selection.insertBox(i,{url:URL.createObjectURL(n),status:"uploading",name:n.name,size:n.size,type:n.type,lastModified:n.lastModified});let d=je({onProgress:e=>{const t=c.node.find(".lake-percent"),i=Math.round(e.percent);t.text(`${i<100?i:99} %`)},onError:(e,t)=>{d=null,A(e.toString(),t),c.updateValue("status","error"),c.render(),s&&s(e.toString())},onSuccess:e=>{if(d=null,!e.url)return c.updateValue("status","error"),c.render(),void(s&&s("Cannot find the url field."));c.updateValue({status:"done",url:e.url}),c.render(),t.history.save(),o&&o()},file:n,action:a,method:r});return c.event.on("beforeunmount",(()=>{d&&(d.abort(),A("Upload canceled"))})),c}var We=Object.freeze({__proto__:null,appendBreak:D,camelCase:l,changeTagName:V,debug:A,denormalizeValue:f,encode:r,fileSize:w,fixNumberedList:F,fromBase64:h,getBox:Fe,getCSS:y,getDeepElement:H,inString:c,mergeNodes:O,modifierText:v,morph:he,nodePosition:pe,normalizeValue:g,parseStyle:m,query:I,removeBreak:Z,removeZWS:$,request:je,safeTemplate:a,scrollToNode:ue,setBlockIndent:R,splitNodes:P,template:s,toBase64:d,toHex:u,toNodeList:x,uploadFile:qe,wrapNodeList:z});class Ue{constructor(e){this.fragment=null!=e?e:document.createDocumentFragment()}get(){return this.fragment}find(e){const t=[];let i=new E(this.fragment.firstChild);for(;i.length>0;)i.matches(e)?t.push(i.get(0)):i.isElement&&i.find(e).each((e=>{t.push(e)})),i=i.next();return new E(t)}append(e){I(e).each((e=>{this.fragment.appendChild(e)}))}}const Ke={id:/^[\w-]+$/,class:/^[\w- ]+$/,style:{"text-align":["left","center","right","justify","start","end"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function Ge(){return{h1:Object.assign({},Ke),h2:Object.assign({},Ke),h3:Object.assign({},Ke),h4:Object.assign({},Ke),h5:Object.assign({},Ke),h6:Object.assign({},Ke),p:Object.assign({},Ke),blockquote:Object.assign(Object.assign({},Ke),{type:["info","tip","success","warning","error","danger"]}),ul:Object.assign(Object.assign({},Ke),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},Ke),{start:/^\d+$/,indent:/^\d+$/}),li:{value:["true","false"]},table:{style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/}},tr:{style:{height:/^-?\d+(px|%)$/i}},th:"td",td:{colspan:/^\d+$/,rowspan:/^\d+$/,style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/,"text-align":["left","center","right","justify"]}},"lake-box":{type:["inline","block"],name:/^[\w-]+$/,value:/^[^"]+$/,focus:["start","center","end"]},br:{},hr:{},img:{src:/^[^"]+$/,width:/^-?\d+px$/i,height:/^-?\d+px$/i,"data-lake-value":/^[^"]+$/,alt:/^[^"]+$/,style:{width:/^-?\d+px$/i,height:/^-?\d+px$/i}},span:{class:/^[\w- ]+$/,style:{color:/^[^"]+$/,"background-color":/^[^"]+$/,"font-family":/^[^;]+$/,"font-size":/^[^"]+$/}},b:"strong",strong:{},em:"i",i:{},u:{},s:{},sub:{},sup:{},code:{},a:{class:/^[\w- ]+$/,name:/^[\w-]+$/,href:/^[^"]+$/,target:/^[\w-]+$/,rel:/^[^"]+$/,download:/^[^"]+$/},"lake-bookmark":{type:["anchor","focus"]}}}class Xe{constructor(e,t=Ge()){this.rules=t,this.source="string"==typeof e?this.parseHTML(e):e}parseHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");return new E(t.querySelector("body"))}static matchRule(e,t){return"string"==typeof e?e===t:Array.isArray(e)?e.indexOf(t)>=0:e instanceof RegExp&&e.test(t)}static getOpenTagString(e,t){let i=e.name,n=t[i];if(!n)return"";"string"==typeof n&&(i=n,n=t[i]);const s=e.get(0);if(!s.hasAttributes())return i;const o=new Map;for(const e of s.attributes)if(n[e.name]&&("style"!==e.name&&Xe.matchRule(n[e.name],e.value)&&o.set(e.name,e.value),"style"===e.name)){const t=n.style,i=new Map,s=m(e.value);for(const e of Object.keys(s)){const n=s[e];t[e]&&Xe.matchRule(t[e],n)&&i.set(e,n)}o.set("style",i)}let r=i;for(const[e,t]of o)if("style"===e){let e="";for(const[i,n]of t)e+=`${i}: ${n.replace(/"/g,""")}; `;""!==e&&(r+=` style="${e.trim()}"`)}else r+=` ${e}="${t}"`;return r}static getClosedTagString(e,t){let i=e.name;const n=t[i];return n?("string"==typeof n&&(i=n),i):""}static getTrimmedText(e){const t=e.parent(),i=e.prev(),n=e.next();let s=e.text();return(i.isBlock||i.isBlockBox)&&(n.isBlock||n.isBlockBox)||0===i.length&&0===n.length&&t.isBlock?s=s.replace(/^[\u0020\t\r\n]+|[\u0020\t\r\n]+$/g,""):i.isBlock||i.isBlockBox||0===i.length&&t.isBlock?s=s.replace(/^[\u0020\t\r\n]+/,""):(n.isBlock||n.isBlockBox||0===n.length&&t.isBlock)&&(s=s.replace(/[\u0020\t\r\n]+$/,"")),s}getHTML(){const e=this.rules;let t="";for(const i of function*t(i){let n=i.first();for(;n.length>0;){const i=n.next();if(n.isText)yield r(Xe.getTrimmedText(n));else if(n.isVoid){const t=Xe.getOpenTagString(n,e);""!==t&&(yield`<${t} />`)}else if(n.isElement){const i=Xe.getOpenTagString(n,e),s=Xe.getClosedTagString(n,e);""!==i&&(yield`<${i}>`),n.isBox||(yield*t(n)),""!==s&&(yield`</${s}>`)}n=i}}(this.source))t+=i;return t.trim()}getFragment(){const e=this.getHTML(),t=this.parseHTML(e),i=document.createDocumentFragment();let n=t.first();for(;n.length>0;){const e=n.next();i.appendChild(n.get(0)),n=e}return i}}class Qe{constructor(e){this.content=e}getHTML(){let e=this.content;return e=e.replace(/ {2}/g," "),e=r(e.trim()),e=`<p>${e}</p>`,e=e.replace(/(\r\n){2,}/g,"</p><p><br /></p><p>"),e=e.replace(/\r\n/g,"</p><p>"),e=e.replace(/[\r\n]{2,}/g,"</p><p><br /></p><p>"),e=e.replace(/[\r\n]/g,"</p><p>"),e}getFragment(){return new Xe(this.getHTML()).getFragment()}}function Ye(e,t){if(e.commonAncestor.isOutside)return;const i=(t=I(t)).get(0),n=e.get();n.insertNode(i),n.setEndAfter(i),n.collapse(!1)}function Je(e){if(e.commonAncestor.isOutside)return{anchor:new E,focus:new E};const t=e.startNode.closest("lake-box");if(t.length>0)return e.isBoxStart?t.attr("focus","start"):e.isBoxEnd?t.attr("focus","end"):t.attr("focus","center"),{anchor:new E,focus:t};if(e.isCollapsed){const t=e.clone();t.collapseToEnd();const i=I('<lake-bookmark type="focus" />');return Ye(t,i),{anchor:new E,focus:i}}const i=e.clone();i.collapseToStart();const n=I('<lake-bookmark type="anchor" />');Ye(i,n);const s=e.clone();s.collapseToEnd();const o=I('<lake-bookmark type="focus" />');return Ye(s,o),{anchor:n,focus:o}}function et(e,t){const i=e.prev(),n=e.next();if(i.isText||n.isText){const t=e.parent();e.remove(),t.get(0).normalize()}else if(0===i.length&&0===n.length){if(e.parent().isMark&&t){const i=new E(document.createTextNode(""));e.before(i),t.setStartAfter(i),t.collapseToStart()}e.remove()}else e.remove()}function tt(e,t){const i=t.anchor,n=t.focus;if(i.length>0&&0===n.length)et(i);else{if(n.length>0&&0===i.length){if(n.isBox){const t=Fe(n);0===t.getContainer().length&&t.render();const i=n.attr("focus");return"start"===i?e.selectBoxStart(n):"center"===i?e.selectBox(n):e.selectBoxEnd(n),void n.removeAttr("focus")}return e.setStartBefore(n),e.collapseToStart(),void et(n,e)}if(i.length>0&&n.length>0){const t=new M;t.selectNode(i),t.collapseToEnd(),-1===t.compareAfterNode(n)?(e.setStartBefore(n),et(n),e.setEndBefore(i),et(i)):(e.setStartBefore(i),et(i),e.setEndBefore(n),et(n))}}}function it(e){if(e.commonAncestor.isOutside)return;F(e.getBlocks())}function nt(e){if(e.isCollapsed)return;if(e.adjustBox(),e.adjustTable(),e.isInoperative)return;const t=e.startNode.closestBlock(),i=e.endNode.closestBlock(),n=t.get(0)===i.get(0);if(e.get().deleteContents(),e.adjustBlock(),n){const t=e.getBlocks()[0];if(t&&t.isEmpty){const i=D(t);e.setStartBefore(i),e.collapseToStart()}return}const s=e.getBlocks()[0];if(!s)return;const o=s.prev();if(0===o.length)return;const r=Je(e);O(o,s),tt(e,r),it(e)}function st(e,t){if(t instanceof Ue&&(t=t.get()),e.commonAncestor.isOutside)return;e.isCollapsed?e.adjustBox():nt(e);Z(e.startNode.closestBlock());const i=Je(e);i.focus.before(t),tt(e,i),e.adjustBlock()}function ot(e,t){if(e.commonAncestor.isOutside)return;if(e.isCollapsed){if(e.commonAncestor.closest("lake-box").isBlockBox)return}if("string"!=typeof t){const i=e.getBlocks();for(const e of i)e.css(t);return}const i=I(t),n=i.name,s=i.get(0).attributes,o=e.getBlocks();if(o.length>0){const t=Je(e);for(const e of o)if(e.name===n&&0===i.first().length)for(const t of s)e.attr(t.name,t.value);else{const t=i.clone(!0);t.isList&&e.isList&&""!==e.attr("indent")&&t.attr("indent",e.attr("indent"));const n=H(t);let s=e.first();for(;s.length>0;){const e=s.next();n.append(s),n.name!==s.name&&"li"!==s.name||s.remove(!0),s=e}e.replaceWith(t)}return tt(e,t),void it(e)}const r=Je(e),a=function(e){const t=e.commonAncestor.closest('div[contenteditable="true"],td');let i=[];if(0===t.length)return i;let n=t.first(),s=!0;for(;n.length>0;){if(n.isMark||n.isText||n.isBookmark||n.isInlineBox)i.push(n);else{if(!s)break;i=[]}e.intersectsNode(n)&&(s=!1),n=n.next()}return i}(e),l=z(a,i);if(tt(e,r),it(e),l.isEmpty){const t=D(l);e.setStartBefore(t),e.collapseToStart()}}function rt(e){if(e.commonAncestor.isOutside)return{start:null,end:null};e.isCollapsed?e.adjustBox():nt(e);const t=e.startNode,i=t.closestOperableBlock();if(0===i.length)return{start:null,end:null};let n=i.parent();n.isOutside&&(n=t.closestContainer());const s=P(t,e.startOffset,n);let o=null,r=null;return s&&(o=s.start,r=s.end),!s&&t.isBlock&&(e.startOffset>0&&(o=t.children()[e.startOffset-1]),r=t.children()[e.startOffset],r&&!r.isBlock&&(r=null)),o&&o.isEmpty&&D(o),r&&(r.isEmpty&&D(r),e.shrinkBefore(r)),it(e),{start:o,end:r}}function at(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function lt(e,t,i){let n=null,s=null,o=e.closestBlock();0===o.length&&(o=e.closestContainer());const r=P(e,t,o);return r&&(i?(at(r.start),at(r.end),r.start.isEmpty||(n=r.start),r.end.isEmpty||(s=r.end)):(n=r.start,s=r.end)),{start:n,end:s}}function ct(e,t=!0){if(e.commonAncestor.isOutside)return{start:null,center:null,end:null};if(e.adjustBox(),e.isCollapsed){const i=lt(e.startNode,e.startOffset,t);return i.start?(e.setStartAfter(i.start),e.collapseToStart()):i.end&&(e.setStartBefore(i.end),e.collapseToStart()),{start:i.start,center:null,end:i.end}}const i=lt(e.startNode,e.startOffset,t);i.start?e.setStartAfter(i.start):i.end&&e.setStartBefore(i.end);const n=lt(e.endNode,e.endOffset,t);return n.start?e.setEndAfter(n.start):n.end&&e.setEndBefore(n.end),{start:i.start,center:n.start,end:n.end}}function dt(e,t){const i=e.text();let n=e;for(;n.length>0;){const e=n.parent();if(!e.isMark||i!==e.text()||!n.isText&&n.name===t&&""!==n.attr("style"))break;n=e}return n}function ht(e,t){if(e.commonAncestor.isOutside)return;let i=I(t);const n=i.name,s=m(i.attr("style"));if(e.isCollapsed){if(e.isBox){const t=e.startNode.closest("lake-box");if("block"===Fe(t).type){const i=I("<p><br /></p>");e.isBoxStart?t.before(i):t.after(i),e.shrinkAfter(i)}else e.adjustBox()}Z(e.startNode.closestBlock());const t=new E(document.createTextNode("")),o=ct(e);if(o.start){const e=function(e){if(!e.isMark)return null;let t=e.clone(),i=e.last();for(;i.length>0;){if(i.isMark){const e=i.clone();t.append(e),t=e}i=i.last()}return t}(o.start);if(e)if(e.name===n)e.css(s),i=e;else{H(e).append(t),i.append(e)}}return""===i.text()&&i.append(t),Ye(e,i),function(e){const t=e.prev();t.length>0&&t.isText&&t.isEmpty&&t.remove();const i=e.next();i.length>0&&i.isText&&i.isEmpty&&i.remove()}(i),void e.shrinkAfter(i)}ct(e);const o=e.getMarks(!0),r=Je(e);for(const e of o)if(!e.isEmpty&&e.isText){const t=dt(e,n);if(t.isMark&&t.name===n)t.css(s);else{const e=i.clone();t.before(e),e.append(t)}}tt(e,r)}function pt(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function ut(e,t){if(e.commonAncestor.isOutside)return;let i;if(t){i=I(t).name}if(e.isCollapsed){if(e.isBox)return;if(i&&0===e.commonAncestor.closest(i).length)return;const t=ct(e,!1);if(!t.start)return;t.end&&pt(t.end);const n=new E(document.createTextNode("")),s=function(e,t){if(!e.isMark||!t)return null;let i=e.clone(),n=e.last();for(;n.length>0;){if(n.isMark&&n.name!==t){const e=n.clone();i.append(e),i=e}n=n.last()}if(i.name===t){if(!(i.first().length>0))return null;i=i.first()}return i}(t.start,i);if(!s)return t.start.after(n),pt(t.start),n.prev().isText?(e.setStartAfter(n.prev()),e.collapseToStart(),void n.remove()):(e.setStartAfter(n),void e.collapseToStart());return H(s).append(n),t.start.after(s),pt(t.start),void e.shrinkAfter(s)}ct(e);const n=e.getMarks(),s=Je(e);for(const e of n)if(!i||e.name===i){const t=e.parent();e.remove(!e.isEmpty),t.length>0&&t.get(0).normalize()}$(e.commonAncestor),tt(e,s)}function mt(e,t){if(e.commonAncestor.isOutside)return null;const i=I(t);if(e.isCollapsed){let t=e.commonAncestor.closest("a");if(0===t.length){t=i.clone(!0);return Z(e.startNode.closestBlock()),Ye(e,t),t}return""!==i.attr("href")&&t.attr({href:i.attr("href")}),t}ct(e);const n=Je(e);for(const t of e.commonAncestor.getWalker())"a"===t.name&&e.intersectsNode(t)&&t.remove(!0);const s=i.clone(!1);n.anchor.after(s);let o=s.next();for(;o.length>0;){const e=o.next();if(!o.isMark&&!o.isText)break;s.append(o),o=e}return 0===s.first().length&&s.remove(),tt(e,n),s}function gt(e,t,i){if(e.commonAncestor.isOutside)return null;const n=Fe(t);i&&(n.value=i);const s=document.createDocumentFragment();if(s.appendChild(n.node.get(0)),"inline"===n.type)return st(e,s),n.render(),e.selectBoxEnd(n.node),Fe(n.node);const o=rt(e);return o.start&&(e.setEndAfter(o.start),e.collapseToEnd()),o.end&&o.end.isEmpty&&o.end.remove(),st(e,s),n.render(),e.selectBoxEnd(n.node),o.start&&o.start.isEmpty&&o.start.remove(),Fe(n.node)}function ft(e){const t=e.node.closestContainer();if(e.unmount(),e.node.remove(),t.length>0){ge(t.id).delete(e.node.id);ge(0).set(e.node.id,e)}return e}function vt(e){if(e.commonAncestor.isOutside)return null;const t=e.commonAncestor.closest("lake-box");if(0===t.length)return null;const i=Fe(t);if("block"===i.type){const n=I("<p><br /></p>");return t.before(n),e.shrinkAfter(n),ft(i)}e.setStartBefore(t),e.collapseToStart();const n=t.parent();if(ft(i),n.isEmpty){const t=D(n);e.setStartBefore(t),e.collapseToStart()}return i}var wt={exports:{}};function yt(e,t=100,i={}){if("function"!=typeof e)throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw new RangeError("`wait` must not be negative.");const{immediate:n}="boolean"==typeof i?{immediate:i}:i;let s,o,r,a,l;function c(){const t=s,i=o;return s=void 0,o=void 0,l=e.apply(t,i),l}function d(){const e=Date.now()-a;e<t&&e>=0?r=setTimeout(d,t-e):(r=void 0,n||(l=c()))}const h=function(...e){if(s&&this!==s)throw new Error("Debounced method called with different contexts.");s=this,o=e,a=Date.now();const i=n&&!r;return r||(r=setTimeout(d,t)),i&&(l=c()),l};return h.clear=()=>{r&&(clearTimeout(r),r=void 0)},h.flush=()=>{r&&h.trigger()},h.trigger=()=>{l=c(),h.clear()},h}wt.exports.debounce=yt,wt.exports=yt;var xt=fe(wt.exports),bt=fe((function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var n,s,o;if(Array.isArray(t)){if((n=t.length)!=i.length)return!1;for(s=n;0!=s--;)if(!e(t[s],i[s]))return!1;return!0}if(t instanceof Map&&i instanceof Map){if(t.size!==i.size)return!1;for(s of t.entries())if(!i.has(s[0]))return!1;for(s of t.entries())if(!e(s[1],i.get(s[0])))return!1;return!0}if(t instanceof Set&&i instanceof Set){if(t.size!==i.size)return!1;for(s of t.entries())if(!i.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(i)){if((n=t.length)!=i.length)return!1;for(s=n;0!=s--;)if(t[s]!==i[s])return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(s=n;0!=s--;)if(!Object.prototype.hasOwnProperty.call(i,o[s]))return!1;for(s=n;0!=s--;){var r=o[s];if(!e(t[r],i[r]))return!1}return!0}return t!=t&&i!=i}));function kt(e){const t=e.get(0),i={};if(t.hasAttributes())for(const e of t.attributes)i[e.name]=e.value;return i}class Ct{constructor(e){const t=window.getSelection();if(!t)throw new Error("Selection object is null.");this.selection=t,this.container=e,this.range=this.getCurrentRange()}getCurrentRange(){if(this.selection.rangeCount>0){const e=this.selection.getRangeAt(0);return new M(e)}return new M}sync(){this.container.contains(this.range.commonAncestor)&&(this.selection.removeAllRanges(),this.selection.addRange(this.range.get()))}updateByRange(){const e=this.getCurrentRange();this.container.contains(e.commonAncestor)&&(this.range.startNode.get(0)===e.startNode.get(0)&&this.range.startOffset===e.startOffset&&this.range.endNode.get(0)===e.endNode.get(0)&&this.range.endOffset===e.endOffset||(this.range=e))}updateByBookmark(){const e=this.range,t=this.container,i=t.find("lake-box[focus]");if(i.length>0)return tt(e,{anchor:new E,focus:i}),void this.sync();tt(e,{anchor:t.find('lake-bookmark[type="anchor"]'),focus:t.find('lake-bookmark[type="focus"]')}),this.sync()}getAppliedItems(){const e=[];return function(e,t){let i=t.startNode;for(i.isText&&(i=i.parent());i.length>0&&i.isInside;)e.push({node:i,name:i.name,attributes:kt(i),styles:m(i.attr("style"))}),i=i.parent()}(e,this.range),function(e,t){const i=t.startNode;let n;if(i.isText&&i.text().length===t.startOffset){const e=i.next();e.length>0&&e.isElement&&(n=e)}if(i.isElement){const e=i.children();if(e.length>0){const i=e[t.startOffset];i&&i.isElement&&(n=i)}}if(n){let t=n;for(;t.length>0;)t.isElement&&e.push({node:t,name:t.name,attributes:kt(t),styles:m(t.attr("style"))}),t=t.first()}}(e,this.range),e}insertBookmark(){return Je(this.range)}toBookmark(e){return tt(this.range,e)}insertNode(e){return Ye(this.range,e)}insertFragment(e){return st(this.range,e)}deleteContents(){return nt(this.range)}setBlocks(e){return ot(this.range,e)}splitBlock(){return rt(this.range)}splitMarks(e){return ct(this.range,e)}addMark(e){return ht(this.range,e)}removeMark(e){return ut(this.range,e)}fixList(){return it(this.range)}insertLink(e){return mt(this.range,e)}selectBox(e){let t=e;t=e instanceof Ve?e.node:e,this.range.selectBox(t)}insertBox(e,t){const i=gt(this.range,e,t);if(!i)throw new Error(`The box "${e}" cannot be inserted outside the editor.`);return i}removeBox(e=null){return e&&this.selectBox(e),vt(this.range)}}class St{constructor(e){this.commandMap=new Map,this.selection=e}add(e,t){this.commandMap.set(e,t)}delete(e){this.commandMap.delete(e)}getNames(){return Array.from(this.commandMap.keys())}has(e){return void 0!==this.commandMap.get(e)}getItem(e){const t=this.commandMap.get(e);if(void 0===t)throw new Error(`Command "${e}" has not been defined yet.`);return t}isDisabled(e){const t=this.getItem(e);if(!t.isDisabled)return!1;const i=this.selection.getAppliedItems();return t.isDisabled(i)}isSelected(e){const t=this.getItem(e);if(!t.isSelected)return!1;const i=this.selection.getAppliedItems();return t.isSelected(i)}selectedValues(e){const t=this.getItem(e);if(!t.selectedValues)return[];const i=this.selection.getAppliedItems();return t.selectedValues(i)}execute(e,...t){const i=this.selection.container,n=this.selection.range;i.contains(n.commonAncestor)||n.shrinkAfter(i);this.getItem(e).execute.apply(this,t),A(`Command "${e}" executed`)}}class Bt{constructor(e){this.canSave=!0,this.list=[],this.index=0,this.limit=100,this.event=new we,this.selection=e,this.container=e.container}removeBookmark(e){return e.replace(/(<lake-box[^>]+)\s+focus="\w+"([^>]*>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"")}getValue(e){return new Xe(e).getHTML()}addIdToBoxes(e){e.find("lake-box").each((e=>{const t=new E(e),i=`${t.attr("name")}-${t.attr("value")}`;t.attr("id",i)}))}removeIdfromBoxes(e){e.find("lake-box").each((e=>{new E(e).removeAttr("id")}))}morphContainer(e){const t=this.container,i={beforeChildrenUpdated:e=>{if("lake-box"===new E(e).name)return!1},afterAttributeUpdated:(e,i)=>{const n=new E(i);if(["name","value"].indexOf(e)>=0&&"lake-box"===n.name){Fe(n).unmount();ge(t.id).delete(n.id)}}},n=e.clone(!0);this.addIdToBoxes(t),this.addIdToBoxes(n),he(t,n,{callbacks:i}),this.removeIdfromBoxes(t),this.removeIdfromBoxes(n)}get canUndo(){return this.index>1&&!!this.list[this.index-2]}get canRedo(){return!!this.list[this.index]}cloneContainer(){const e=this.selection.range,t=this.container.clone(!0);if(t.find("lake-box").each((e=>{Fe(e).getContainer().empty()})),!this.container.contains(e.commonAncestor))return t;if(e.isInsideBox){const i=e.commonAncestor.closest("lake-box").path(),n=t.find(i),s=e.clone();return s.selectBox(n),Je(s),t}const i=e.startNode.path(),n=e.endNode.path(),s=t.find(i),o=t.find(n),r=e.clone();return r.setStart(s,e.startOffset),r.setEnd(o,e.endOffset),Je(r),t}undo(){if(!this.list[this.index-2])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index>1;){const t=this.list[this.index-2];if(!t)break;this.index--;const i=this.getValue(t);if(this.removeBookmark(i)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("undo",i);break}}this.selection.updateByBookmark(),A(`History undone (index: ${this.index})`)}redo(){if(!this.list[this.index])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index<this.list.length;){const t=this.list[this.index];if(!t)break;this.index++;const i=this.getValue(t);if(this.removeBookmark(i)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("redo",i);break}}this.selection.updateByBookmark(),A(`History redone (index: ${this.index})`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(e={}){var t,i,n;const s=null!==(t=e.inputType)&&void 0!==t?t:"",o=null!==(i=e.update)&&void 0!==i&&i,r=null===(n=e.emitEvent)||void 0===n||n;if(!this.canSave)return;const a=this.cloneContainer(),l=this.getValue(a);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(l)||(o?this.list.splice(this.index-1,1/0,a):(this.list.splice(this.index,1/0,a),this.index++),this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),A(`History saved (index: ${this.index}, inputType: "${s}", update: ${o}, emitEvent: ${r})`),r&&this.event.emit("save",f(l),{inputType:s,update:o,emitEvent:r}))}}var _t={};Object.defineProperty(_t,"__esModule",{value:!0});for(var At="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Lt={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Tt={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:At?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Et={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},It=1;It<20;It++)Et["f"+It]=111+It;function Mt(e,t,i){t&&!("byKey"in t)&&(i=t,t=null),Array.isArray(e)||(e=[e]);var n=e.map((function(e){return Pt(e,t)})),s=function(e){return n.some((function(t){return Dt(t,e)}))};return null==i?s:s(i)}function Pt(e,t){var i=t&&t.byKey,n={},s=(e=e.replace("++","+add")).split("+"),o=s.length;for(var r in Lt)n[Lt[r]]=!1;var a=!0,l=!1,c=void 0;try{for(var d,h=s[Symbol.iterator]();!(a=(d=h.next()).done);a=!0){var p=d.value,u=p.endsWith("?")&&p.length>1;u&&(p=p.slice(0,-1));var m=Nt(p),g=Lt[m];if(p.length>1&&!g&&!Tt[p]&&!Et[m])throw new TypeError('Unknown modifier: "'+p+'"');1!==o&&g||(i?n.key=m:n.which=Zt(p)),g&&(n[g]=!u||null)}}catch(e){l=!0,c=e}finally{try{!a&&h.return&&h.return()}finally{if(l)throw c}}return n}function Dt(e,t){for(var i in e){var n=e[i],s=void 0;if(null!=n&&((null!=(s="key"===i&&null!=t.key?t.key.toLowerCase():"which"===i?91===n&&93===t.which?91:t.which:t[i])||!1!==n)&&s!==n))return!1}return!0}function Zt(e){return e=Nt(e),Et[e]||e.toUpperCase().charCodeAt(0)}function Nt(e){return e=e.toLowerCase(),e=Tt[e]||e}_t.default=Mt,_t.isHotkey=Mt,_t.isCodeHotkey=function(e,t){return Mt(e,t)};var Ot=_t.isKeyHotkey=function(e,t){return Mt(e,{byKey:!0},t)};_t.parseHotkey=Pt,_t.compareHotkey=Dt,_t.toKeyCode=Zt,_t.toKeyName=Nt;class Ht{constructor(e){this.keydownEventList=[],this.keyupEventList=[],this.container=e,this.container.on("keydown",(e=>{const t=e;if(!t.isComposing&&!t.defaultPrevented)for(const e of this.keydownEventList)if(Ot(e.type,t)&&!1===e.listener(t))break})),this.container.on("keyup",(e=>{const t=e;if(!t.isComposing&&!t.defaultPrevented)for(const e of this.keyupEventList)if(Ot(e.type,t)&&!1===e.listener(t))break}))}setKeydown(e,t){this.keydownEventList.push({type:e,listener:t})}setKeyup(e,t){this.keyupEventList.push({type:e,listener:t})}keydown(e){for(const t of this.keydownEventList)if(t.type===e&&!1===t.listener(new KeyboardEvent(e)))break}keyup(e){for(const t of this.keyupEventList)if(t.type===e&&!1===t.listener(new KeyboardEvent(e)))break}}const zt={value:"<p><br /></p>",readonly:!1,spellcheck:!1,tabIndex:0,placeholder:"",indentWithTab:!0,lang:"en-US",minChangeSize:5,historySize:100,onMessage:(e,t)=>{"success"!==e?"warning"!==e?"error"===e&&console.error(t):console.warn(t):console.log(t)},slash:!1};class $t{constructor(e){if(this.unsavedInputData="",this.unsavedInputCount=0,this.state={appliedItems:[],disabledNameMap:new Map,selectedNameMap:new Map,selectedValuesMap:new Map},this.unmountPluginMap=new Map,this.isComposing=!1,this.event=new we,this.box=$t.box,this.copyListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("copy",e)},this.cutListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("cut",e)},this.pasteListener=e=>{const t=this.selection.getCurrentRange();this.container.contains(t.commonAncestor)&&this.event.emit("paste",e)},this.selectionchangeListener=()=>{this.updateSelectionRange(),this.updateBoxSelectionStyle(),this.emitStateChangeEvent()},this.clickListener=e=>{const t=new E(e.target);t.get(0).isConnected&&this.event.emit("click",t)},this.resizeListener=()=>{this.event.emit("resize")},this.scrollListener=()=>{this.event.emit("scroll")},this.updateSelectionRange=xt((()=>{this.selection.updateByRange()}),1,{immediate:!0}),this.updateBoxSelectionStyle=xt((()=>{if(0===this.root.first().length)return;const e=this.selection.range,t=e.clone();t.adjustBox(),this.container.find("lake-box").each((i=>{const n=Fe(i),s=n.getContainer();if(0!==s.length){if(e.compareBeforeNode(s)<0&&e.compareAfterNode(s)>0&&(!e.isCollapsed||e.startNode.get(0)!==s.get(0)||0!==e.startOffset))return s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.removeClass("lake-box-focused"),s.addClass("lake-box-activated"),void n.event.emit("focus");if(t.intersectsNode(n.node))return s.removeClass("lake-box-activated"),void(e.isCollapsed?(s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.addClass("lake-box-focused"),n.event.emit("focus")):(s.removeClass("lake-box-focused"),s.addClass("lake-box-selected"),n.event.emit("blur")));s.removeClass("lake-box-activated"),s.removeClass("lake-box-focused"),s.removeClass("lake-box-selected"),n.event.emit("blur")}}))}),50,{immediate:!0}),this.emitStateChangeEvent=xt((()=>{const e=this.command.getNames();let t=this.selection.getAppliedItems();t.length>0&&!this.container.contains(t[0].node)&&(t=[]);const i=new Map,n=new Map,s=new Map;if(t.length>0)for(const o of e){const e=this.command.getItem(o);if(e.isDisabled&&e.isDisabled(t)&&i.set(o,!0),e.isSelected&&e.isSelected(t)&&n.set(o,!0),e.selectedValues){const i=e.selectedValues(t);i.length>0&&s.set(o,i)}}const o={appliedItems:t,disabledNameMap:i,selectedNameMap:n,selectedValuesMap:s};bt(o,this.state)||(this.toolbar&&this.toolbar.updateState(o),this.event.emit("statechange",o),this.state=o)}),50,{immediate:!1}),!e.root)throw new Error("The root of the config must be specified.");this.root=I(e.root),this.toolbar=e.toolbar,this.config=Object.assign({},zt);for(const t of Object.keys(e))this.config[t]=e[t];this.containerWrapper=I('<div class="lake-container-wrapper" />'),this.container=I('<div class="lake-container" />'),this.overlayContainer=I('<div class="lake-overlay" />'),this.popupContainer=I('<div class="lake-popup lake-custom-properties" />'),this.readonly=this.config.readonly,this.root.addClass("lake-custom-properties"),this.container.attr({contenteditable:this.readonly?"false":"true",spellcheck:this.config.spellcheck?"true":"false",tabindex:this.config.tabIndex.toString()}),""!==this.config.placeholder&&this.container.attr("placeholder",this.config.placeholder),this.selection=new Ct(this.container),this.command=new St(this.selection),this.history=new Bt(this.selection),this.history.limit=this.config.historySize,this.keystroke=new Ht(this.container),xe.set(this.container.id,this)}togglePlaceholderClass(e){const t="lake-placeholder";"<p><br /></p>"===(e=f(e)).replace("<focus />","")?this.container.addClass(t):this.container.removeClass(t)}moveBoxStripText(){const e=this.selection,t=e.range,i=t.startNode.closest(".lake-box-strip"),n=i.closest("lake-box");if("inline"===Fe(n).type)t.isBoxStart?(t.setStartBefore(n),t.collapseToStart()):(t.setStartAfter(n),t.collapseToStart());else{const e=I("<p />");t.isBoxStart?n.before(e):n.after(e),t.setStart(e,0),t.collapseToStart()}const s=i.text();i.html("<br />"),e.insertNode(document.createTextNode(s))}resetUnsavedInputData(){this.unsavedInputData="",this.unsavedInputCount=0}handleInputEvent(e){var t;this.selection.updateByRange();const i=this.selection.range;if(i.isInsideBox)return;if(i.isBoxStart||i.isBoxEnd)return this.moveBoxStripText(),void this.history.save();if("insertText"===(e instanceof CompositionEvent?"insertText":e.inputType)){const i=null!==(t=e.data)&&void 0!==t?t:"";return i.length>1?void this.history.save({inputType:"insertText",update:!1}):(this.unsavedInputData+=i,this.unsavedInputCount++,void(this.unsavedInputData.length<this.config.minChangeSize?this.history.save({inputType:"insertText",update:this.unsavedInputCount>1}):(this.history.save({inputType:"insertText",update:!0}),this.resetUnsavedInputData())))}this.history.save()}bindInputEvents(){this.container.on("compositionstart",(()=>{this.isComposing=!0,this.container.removeClass("lake-placeholder")})),this.container.on("compositionend",(e=>{this.isComposing=!1,this.handleInputEvent(e)})),this.container.on("input",(e=>{const t=e;this.isComposing=t.isComposing,this.isComposing||this.handleInputEvent(e)}))}bindHistoryEvents(){const e=e=>{this.fixContent()&&(this.history.save({update:!0,emitEvent:!1}),e=this.getValue()),this.emitStateChangeEvent(),this.togglePlaceholderClass(e),this.scrollToCaret(),this.event.emit("change",e)};this.history.event.on("undo",(t=>{this.renderBoxes(),e(t),this.resetUnsavedInputData()})),this.history.event.on("redo",(t=>{this.renderBoxes(),e(t),this.resetUnsavedInputData()})),this.history.event.on("save",((t,i)=>{this.removeBoxGarbage(),e(t),"insertText"!==i.inputType&&(this.selection.sync(),this.resetUnsavedInputData())}))}get hasFocus(){const e=document.activeElement;return!!e&&I(e).closest(".lake-container").get(0)===this.container.get(0)}get locale(){return Oe(this.config.lang)}fixContent(){const e=this.selection.range;let t=!1,i=this.container.children();for(const e of i)(e.isBlock||e.isMark)&&""===e.html()&&(e.remove(),t=!0,A(`Content fixed: empty tag "${e.name}" was removed`));if(i=this.container.children(),0===i.length)this.container.html("<p><br /></p>"),e.shrinkBefore(this.container),t=!0,A("Content fixed: default paragraph was added");else if(1===i.length){const n=i[0];if(n.isVoid){const i=I("<p />");n.before(i),i.append(n),e.shrinkAfter(i),t=!0,A(`Content fixed: void element "${n.name}" was wrapped in paragraph`)}}return e.adjustBr(),t}setPluginConfig(e,t){"object"!=typeof this.config[e]&&(this.config[e]={});for(const i of Object.keys(t))void 0===this.config[e][i]&&(this.config[e][i]=t[i])}removeBoxGarbage(){const e=ge(this.container.id);for(const t of e.values())t.node.get(0).isConnected||(t.unmount(),e.delete(t.node.id))}renderBoxes(){this.removeBoxGarbage();const e=this.container,t=ge(e.id);e.find("lake-box").each((e=>{const i=I(e);if(t.get(i.id))return;Fe(i).render()}))}focus(){this.container.focus()}blur(){this.container.blur()}scrollToCaret(){const e=this.selection.range;if(e.isBox)return;const t=e.getRect();if(0===t.x||0===t.y)return;const i=this.container.get(0).getBoundingClientRect(),n=I('<div class="lake-artificial-caret" />'),s=t.x-i.x,o=t.y-i.y;n.css({position:"absolute",top:`${o}px`,left:`${s}px`,width:`${t.width}px`,height:`${t.height}px`,"z-index":"-1"}),this.overlayContainer.find(".lake-artificial-caret").remove(),this.overlayContainer.append(n),ue(n,{behavior:"instant",block:"center",inline:"nearest"}),n.remove()}setValue(e){e=g(e);const t=new Xe(e),i=t.getFragment();this.container.empty(),this.togglePlaceholderClass(t.getHTML()),this.container.append(i),this.renderBoxes(),this.selection.updateByBookmark()}getValue(){const e=this.history.cloneContainer();let t=new Xe(e).getHTML();return t=f(t),t}render(){const e=g(this.config.value),t=new Xe(e),i=t.getFragment();this.root.empty(),this.root.append(this.containerWrapper),this.containerWrapper.append(this.container),this.containerWrapper.append(this.overlayContainer),I(document.body).append(this.popupContainer),this.togglePlaceholderClass(t.getHTML()),this.container.append(i),this.unmountPluginMap=$t.plugin.loadAll(this),this.readonly||(this.selection.updateByBookmark(),this.history.save({emitEvent:!1})),this.renderBoxes(),this.toolbar&&this.toolbar.render(this),this.root.on("scroll",this.scrollListener),document.addEventListener("copy",this.copyListener),window.addEventListener("resize",this.resizeListener),this.readonly||(document.addEventListener("cut",this.cutListener),document.addEventListener("paste",this.pasteListener),document.addEventListener("selectionchange",this.selectionchangeListener),document.addEventListener("click",this.clickListener),this.bindInputEvents(),this.bindHistoryEvents())}unmount(){this.updateSelectionRange.flush(),this.updateBoxSelectionStyle.flush(),this.emitStateChangeEvent.flush();for(const e of this.unmountPluginMap.keys()){const t=this.unmountPluginMap.get(e);t&&(t(),A(`The plugin "${e}" unmounted`))}this.toolbar&&this.toolbar.unmount(),this.removeBoxGarbage(),this.container.find("lake-box").each((e=>{Fe(I(e)).unmount()})),this.event.removeAllListeners(),this.history.event.removeAllListeners(),this.root.off(),this.root.removeClass("lake-custom-properties"),this.root.empty(),this.popupContainer.remove(),document.removeEventListener("copy",this.copyListener),window.removeEventListener("resize",this.resizeListener),this.readonly||(document.removeEventListener("cut",this.cutListener),document.removeEventListener("paste",this.pasteListener),document.removeEventListener("selectionchange",this.selectionchangeListener),document.removeEventListener("click",this.clickListener))}}$t.version="0.1.25",$t.box=new class{add(e){ye.set(e.name,e)}remove(e){ye.delete(e)}getNames(){return Array.from(ye.keys())}},$t.plugin=new class{constructor(){this.pluginMap=new Map}add(e,t){if(this.pluginMap.get(e))throw new Error(`Plugin "${e}" is already defined.`);this.pluginMap.set(e,t)}loadAll(e){const t=new Map;for(const i of this.pluginMap.keys()){const n=this.pluginMap.get(i);if(n&&!1!==e.config[i]){const s=n(e);s&&t.set(i,s)}}return t}};const Vt=[{icon:n.get("numberedList"),value:"numbered",text:e=>e.toolbar.numberedList()},{icon:n.get("bulletedList"),value:"bulleted",text:e=>e.toolbar.bulletedList()},{icon:n.get("checklist"),value:"checklist",text:e=>e.toolbar.checklist()}],Ft=[{icon:n.get("alignLeft"),value:"left",text:e=>e.toolbar.alignLeft()},{icon:n.get("alignCenter"),value:"center",text:e=>e.toolbar.alignCenter()},{icon:n.get("alignRight"),value:"right",text:e=>e.toolbar.alignRight()},{icon:n.get("alignJustify"),value:"justify",text:e=>e.toolbar.alignJustify()}],Rt=[{icon:n.get("increaseIndent"),value:"increase",text:e=>e.toolbar.increaseIndent()},{icon:n.get("decreaseIndent"),value:"decrease",text:e=>e.toolbar.decreaseIndent()}],jt=[{icon:n.get("italic"),value:"italic",text:e=>e.toolbar.italic()},{icon:n.get("underline"),value:"underline",text:e=>e.toolbar.underline()},{icon:n.get("strikethrough"),value:"strikethrough",text:e=>e.toolbar.strikethrough()},{icon:n.get("superscript"),value:"superscript",text:e=>e.toolbar.superscript()},{icon:n.get("subscript"),value:"subscript",text:e=>e.toolbar.subscript()},{icon:n.get("code"),value:"code",text:e=>e.toolbar.code()}],qt=["#f5222d","#fa541c","#fa8c16","#faad14","#fadb14","#a0d911","#52c41a","#13c2c2","#1677ff","#2f54eb","#722ed1","#eb2f96","#fff1f0","#fff2e8","#fff7e6","#fffbe6","#feffe6","#fcffe6","#f6ffed","#e6fffb","#e6f4ff","#f0f5ff","#f9f0ff","#fff0f6","#ffccc7","#ffd8bf","#ffe7ba","#fff1b8","#ffffb8","#f4ffb8","#d9f7be","#b5f5ec","#bae0ff","#d6e4ff","#efdbff","#ffd6e7","#ffa39e","#ffbb96","#ffd591","#ffe58f","#fffb8f","#eaff8f","#b7eb8f","#87e8de","#91caff","#adc6ff","#d3adf7","#ffadd2","#ff7875","#ff9c6e","#ffc069","#ffd666","#fff566","#d3f261","#95de64","#5cdbd3","#69b1ff","#85a5ff","#b37feb","#ff85c0","#ff4d4f","#ff7a45","#ffa940","#ffc53d","#ffec3d","#bae637","#73d13d","#36cfc9","#4096ff","#597ef7","#9254de","#f759ab","#cf1322","#d4380d","#d46b08","#d48806","#d4b106","#7cb305","#389e0d","#08979c","#0958d9","#1d39c4","#531dab","#c41d7f","#a8071a","#ad2102","#ad4e00","#ad6800","#ad8b00","#5b8c00","#237804","#006d75","#003eb3","#10239e","#391085","#9e1068","#820014","#871400","#873800","#874d00","#876800","#3f6600","#135200","#00474f","#002c8c","#061178","#22075e","#780650","#5c0011","#610b00","#612500","#613400","#614700","#254000","#092b00","#002329","#001d66","#030852","#120338","#520339","#000000","#1f1f1f","#262626","#434343","#595959","#8c8c8c","#bfbfbf","#d9d9d9","#f0f0f0","#f5f5f5","#fafafa","#ffffff"],Wt=[{icon:n.get("removeFormat"),value:"",text:e=>e.toolbar.removeColor()}];for(const e of qt)Wt.push({value:e.toLowerCase(),text:e.toUpperCase()});const Ut=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Kt=[{name:"undo",type:"button",icon:n.get("undo"),tooltip:e=>e.toolbar.undo(),onClick:(e,t)=>{e.command.execute(t)}},{name:"redo",type:"button",icon:n.get("redo"),tooltip:e=>e.toolbar.redo(),onClick:(e,t)=>{e.command.execute(t)}},{name:"selectAll",type:"button",icon:n.get("selectAll"),tooltip:e=>e.toolbar.selectAll(),onClick:(e,t)=>{e.command.execute(t)}},{name:"paragraph",type:"button",icon:n.get("paragraph"),tooltip:e=>e.toolbar.paragraph(),isSelected:e=>!!e.find((e=>"p"===e.name)),onClick:e=>{e.command.execute("heading","p")}},{name:"blockQuote",type:"button",icon:n.get("blockQuote"),tooltip:e=>e.toolbar.blockQuote(),onClick:(e,t)=>{e.command.execute(t)}},{name:"numberedList",type:"button",icon:n.get("numberedList"),tooltip:e=>e.toolbar.numberedList(),isSelected:e=>!!e.find((e=>"ol"===e.name)),onClick:e=>{e.command.execute("list","numbered")}},{name:"bulletedList",type:"button",icon:n.get("bulletedList"),tooltip:e=>e.toolbar.bulletedList(),isSelected:e=>!!e.find((e=>"ul"===e.name&&!e.node.hasAttr("type"))),onClick:e=>{e.command.execute("list","bulleted")}},{name:"checklist",type:"button",icon:n.get("checklist"),tooltip:e=>e.toolbar.checklist(),isSelected:e=>!!e.find((e=>"ul"===e.name&&"checklist"===e.node.attr("type"))),onClick:e=>{e.command.execute("list","checklist")}},{name:"alignLeft",type:"button",icon:n.get("alignLeft"),tooltip:e=>e.toolbar.alignLeft(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"left"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","left")}},{name:"alignCenter",type:"button",icon:n.get("alignCenter"),tooltip:e=>e.toolbar.alignCenter(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"center"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","center")}},{name:"alignRight",type:"button",icon:n.get("alignRight"),tooltip:e=>e.toolbar.alignRight(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"right"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","right")}},{name:"alignJustify",type:"button",icon:n.get("alignJustify"),tooltip:e=>e.toolbar.alignJustify(),isSelected:e=>!!e.find((e=>e.node.isBlock&&"justify"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","justify")}},{name:"increaseIndent",type:"button",icon:n.get("increaseIndent"),tooltip:e=>e.toolbar.increaseIndent(),onClick:e=>{e.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:n.get("decreaseIndent"),tooltip:e=>e.toolbar.decreaseIndent(),onClick:e=>{e.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:n.get("bold"),tooltip:e=>e.toolbar.bold(),onClick:(e,t)=>{e.command.execute(t)}},{name:"italic",type:"button",icon:n.get("italic"),tooltip:e=>e.toolbar.italic(),onClick:(e,t)=>{e.command.execute(t)}},{name:"underline",type:"button",icon:n.get("underline"),tooltip:e=>e.toolbar.underline(),onClick:(e,t)=>{e.command.execute(t)}},{name:"strikethrough",type:"button",icon:n.get("strikethrough"),tooltip:e=>e.toolbar.strikethrough(),onClick:(e,t)=>{e.command.execute(t)}},{name:"superscript",type:"button",icon:n.get("superscript"),tooltip:e=>e.toolbar.superscript(),onClick:(e,t)=>{e.command.execute(t)}},{name:"subscript",type:"button",icon:n.get("subscript"),tooltip:e=>e.toolbar.subscript(),onClick:(e,t)=>{e.command.execute(t)}},{name:"code",type:"button",icon:n.get("code"),tooltip:e=>e.toolbar.code(),onClick:(e,t)=>{e.command.execute(t)}},{name:"removeFormat",type:"button",icon:n.get("removeFormat"),tooltip:e=>e.toolbar.removeFormat(),onClick:(e,t)=>{e.command.execute(t)}},{name:"formatPainter",type:"button",icon:n.get("formatPainter"),tooltip:e=>e.toolbar.formatPainter(),onClick:(e,t)=>{e.command.execute(t)}},{name:"link",type:"button",icon:n.get("link"),tooltip:e=>e.toolbar.link(),onClick:(e,t)=>{e.command.execute(t)}},{name:"hr",type:"button",icon:n.get("hr"),tooltip:e=>e.toolbar.hr(),onClick:(e,t)=>{e.command.execute(t)}},{name:"codeBlock",type:"button",icon:n.get("codeBlock"),tooltip:e=>e.toolbar.codeBlock(),onClick:(e,t)=>{e.command.execute(t)}},{name:"video",type:"button",icon:n.get("video"),tooltip:e=>e.toolbar.video(),onClick:(e,t)=>{e.command.execute(t)}},{name:"equation",type:"button",icon:n.get("equation"),tooltip:e=>e.toolbar.equation(),onClick:(e,t)=>{e.command.execute(t)}},{name:"heading",type:"dropdown",downIcon:n.get("down"),defaultValue:"p",tooltip:e=>e.toolbar.heading(),width:"100px",menuType:"list",menuItems:[{value:"h1",text:e=>`<span style="font-weight: bold; font-size: 26px;">${e.toolbar.heading1()}</span>`},{value:"h2",text:e=>`<span style="font-weight: bold; font-size: 24px;">${e.toolbar.heading2()}</span>`},{value:"h3",text:e=>`<span style="font-weight: bold; font-size: 22px;">${e.toolbar.heading3()}</span>`},{value:"h4",text:e=>`<span style="font-weight: bold; font-size: 20px;">${e.toolbar.heading4()}</span>`},{value:"h5",text:e=>`<span style="font-weight: bold; font-size: 18px;">${e.toolbar.heading5()}</span>`},{value:"h6",text:e=>`<span style="font-weight: bold; font-size: 16px;">${e.toolbar.heading6()}</span>`},{value:"p",text:e=>e.toolbar.paragraph()}],onSelect:(e,t)=>{e.command.execute("heading",t)}},{name:"list",type:"dropdown",downIcon:n.get("down"),icon:n.get("list"),tooltip:e=>e.toolbar.list(),menuType:"list",menuItems:Vt,onSelect:(e,t)=>{e.command.execute("list",t)}},{name:"align",type:"dropdown",downIcon:n.get("down"),icon:n.get("alignLeft"),tooltip:e=>e.toolbar.align(),menuType:"list",menuItems:Ft,onSelect:(e,t)=>{e.command.execute("align",t)}},{name:"indent",type:"dropdown",downIcon:n.get("down"),icon:n.get("increaseIndent"),tooltip:e=>e.toolbar.indent(),menuType:"list",menuItems:Rt,onSelect:(e,t)=>{e.command.execute("indent",t)}},{name:"fontFamily",type:"dropdown",downIcon:n.get("down"),defaultValue:"Segoe UI",tooltip:e=>e.toolbar.fontFamily(),width:"100px",menuType:"list",menuItems:[{value:"Arial",text:'<span style="font-family: Arial;">Arial</span>'},{value:"Arial Black",text:"<span style=\"font-family: 'Arial Black';\">Arial Black</span>"},{value:"Comic Sans MS",text:"<span style=\"font-family: 'Comic Sans MS';\">Comic Sans MS</span>"},{value:"Courier New",text:"<span style=\"font-family: 'Courier New';\">Courier New</span>"},{value:"Georgia",text:'<span style="font-family: Georgia;">Georgia</span>'},{value:"Helvetica",text:'<span style="font-family: Helvetica;">Helvetica</span>'},{value:"Impact",text:'<span style="font-family: Impact;">Impact</span>'},{value:"Segoe UI",text:"<span style=\"font-family: 'Segoe UI';\">Segoe UI</span>"},{value:"Tahoma",text:'<span style="font-family: Tahoma;">Tahoma</span>'},{value:"Times New Roman",text:"<span style=\"font-family: 'Times New Roman';\">Times New Roman</span>"},{value:"Trebuchet MS",text:"<span style=\"font-family: 'Trebuchet MS';\">Trebuchet MS</span>"},{value:"Verdana",text:'<span style="font-family: Verdana;">Verdana</span>'}],onSelect:(e,t)=>{e.command.execute("fontFamily",t)}},{name:"fontSize",type:"dropdown",downIcon:n.get("down"),defaultValue:"16px",tooltip:e=>e.toolbar.fontSize(),width:"65px",menuType:"list",menuItems:[{value:"12px",text:"12px"},{value:"14px",text:"14px"},{value:"16px",text:"16px"},{value:"18px",text:"18px"},{value:"22px",text:"22px"},{value:"24px",text:"24px"},{value:"32px",text:"32px"}],onSelect:(e,t)=>{e.command.execute("fontSize",t)}},{name:"moreStyle",type:"dropdown",icon:n.get("more"),tooltip:e=>e.toolbar.moreStyle(),menuType:"list",menuItems:jt,selectedValues:e=>{var t;const i=[];for(const n of e)if(n.node.isMark){const e=null!==(t=Ut.get(n.name))&&void 0!==t?t:n.name;i.push(e)}return i},onSelect:(e,t)=>{e.command.execute(t)}},{name:"fontColor",type:"dropdown",downIcon:n.get("down"),icon:n.get("fontColor"),accentIcon:n.get("fontColorAccent"),defaultValue:"#f5222d",tooltip:e=>e.toolbar.fontColor(),menuType:"color",menuItems:Wt,menuWidth:"296px",onSelect:(e,t)=>{e.command.execute("fontColor",t)}},{name:"highlight",type:"dropdown",downIcon:n.get("down"),icon:n.get("highlight"),accentIcon:n.get("highlightAccent"),defaultValue:"#fadb14",tooltip:e=>e.toolbar.highlight(),menuType:"color",menuItems:Wt,menuWidth:"296px",onSelect:(e,t)=>{e.command.execute("highlight",t)}},{name:"image",type:"upload",icon:n.get("image"),tooltip:e=>e.toolbar.image(),accept:"image/*",multiple:!0},{name:"file",type:"upload",icon:n.get("attachment"),tooltip:e=>e.toolbar.file(),accept:"*",multiple:!0}],Gt=["undo","redo","|","heading","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],Xt=new Map;for(const e of Kt)Xt.set(e.name,e);var Qt={type:"block",name:"hr",render:e=>{const t=e.getEditor(),i=e.getContainer(),n=I('<div class="lake-hr"><hr /></div>');i.empty(),i.append(n),n.on("click",(()=>{t.selection.selectBox(e)}))},html:()=>"<hr />"};const Yt="#57606a",Jt="#444d56",ei="#953800",ti="#0550ae",ii="#444d56",ni="#24292e",si="#005cc5",oi="#0550ae",ri="#444d56",ai="#444d56",li="#0a3069",ci="#0550ae",di="#0550ae",hi="#116329",pi="#0550ae",ui="#cf222e",mi="#24292f",gi="#cf222e",fi="#57606a",vi="#57606a",wi="#8250df",yi="#0550ae",xi="#f6f8fa",bi="#cf222e",ki="#0550ae",Ci="#005cc5",Si="#444d56",Bi="#444d56";function _i(e){const{HighlightStyle:t,tags:i}=e;return t.define([{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:Yt},{tag:[i.name],color:Jt},{tag:[i.variableName,i.self],color:ei},{tag:[i.typeName,i.tagName],color:ti},{tag:[i.propertyName,i.attributeName],color:ii},{tag:[i.className],color:ni},{tag:[i.labelName],color:si},{tag:[i.namespace],color:oi},{tag:[i.macroName],color:ri},{tag:[i.literal],color:ai},{tag:[i.string,i.docString,i.character,i.attributeValue,i.unit],color:li},{tag:[i.number,i.integer,i.float],color:ci},{tag:[i.bool,i.null,i.atom],color:di},{tag:[i.regexp,i.escape,i.url],color:hi},{tag:[i.color],color:pi},{tag:[i.keyword,i.operatorKeyword,i.controlKeyword,i.definitionKeyword,i.moduleKeyword],color:ui},{tag:[i.modifier],color:mi},{tag:[i.operator,i.derefOperator,i.arithmeticOperator,i.logicOperator,i.bitwiseOperator,i.compareOperator,i.updateOperator,i.definitionOperator,i.typeOperator,i.controlOperator],color:gi},{tag:[i.punctuation,i.separator,i.bracket,i.angleBracket,i.squareBracket,i.paren,i.brace,i.contentSeparator],color:fi},{tag:[i.content],color:vi},{tag:[i.meta,i.documentMeta,i.annotation,i.processingInstruction],color:wi},{tag:i.heading,fontWeight:"bold",color:yi},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.link,textDecoration:"underline"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:[i.invalid,i.inserted,i.deleted,i.changed],color:xi},{tag:[i.definition(i.name)],color:bi},{tag:[i.constant(i.name)],color:ki},{tag:[i.function(i.variableName)],color:Ci},{tag:[i.standard(i.name)],color:Si},{tag:[i.special(i.variableName)],color:Bi}])}var Ai={type:"block",name:"codeBlock",render:e=>{var t;const i=e.getEditor(),s=I('<div class="lake-code-block" />'),o=e.getContainer();o.css("width",i.container.innerWidth()-2+"px"),o.empty(),o.append(s);const r=s.get(0);if(!r)return;const a=window.LakeCodeMirror;if(!a)return i.readonly?void e.node.hide():(s.addClass("lake-code-block-error"),s.text('\n The code cannot be displayed because window.LakeCodeMirror is not found.\n Please check if the "lake-codemirror" library is added to this page.\n '.trim()),void s.on("click",(()=>{i.selection.selectBox(e)})));const{EditorState:l,Compartment:c,EditorView:d,keymap:h,history:p,defaultKeymap:u,historyKeymap:m,indentWithTab:g,syntaxHighlighting:f}=a,v=a.langItems,w=i.config.codeBlock,y=v.filter((e=>w.langList.indexOf(e.value)>=0)),x=new Map;for(const e of y)x.set(e.value,e);const b=e.value,k=x.get(b.lang),C=new c,S=xt((t=>{i.selection.updateByRange(),i.isComposing||(e.updateValue("code",t),i.history.save())}),1,{immediate:!1}),B=d.updateListener.of((e=>{e.docChanged&&S(e.state.doc.toString())})),_=new d({parent:r,doc:null!==(t=b.code)&&void 0!==t?t:"",extensions:[l.readOnly.of(i.readonly),d.editable.of(!i.readonly),p(),h.of([...u,...m,g]),f(_i(a)),C.of(k&&k.component?k.component():[]),B]});s.find('[contenteditable="true"]').attr("tabindex","-1");const L=new He({root:s,name:"langType",downIcon:n.get("down"),defaultValue:k?b.lang:w.defaultLang,tooltip:i.locale.codeBlock.langType(),menuType:"list",menuHeight:"200px",menuItems:y.map((e=>({value:e.value,text:e.text}))),onSelect:t=>{e.updateValue({lang:t}),e.unmount(),e.render(),i.selection.selectBox(e),i.history.save()}});L.render();const T=()=>{o.css("width",i.container.innerWidth()-2+"px")};i.event.on("resize",T),s.on("click",(()=>{_.hasFocus||_.focus()})),e.event.on("beforeunmount",(()=>{L.unmount(),_.destroy(),i.event.off("resize",T),A("CodeMirror destroyed")}))}};function Li(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))}
|
|
19
19
|
/*!
|
|
20
20
|
* PhotoSwipe Lightbox 5.4.4 - https://photoswipe.com
|
|
21
21
|
* (c) 2024 Dmytro Semenov
|
|
@@ -24,7 +24,7 @@ function Ti(e,t,i){const n=document.createElement(t);return e&&(n.className=e),i
|
|
|
24
24
|
/*!
|
|
25
25
|
* PhotoSwipe 5.4.4 - https://photoswipe.com
|
|
26
26
|
* (c) 2024 Dmytro Semenov
|
|
27
|
-
*/function Wi(e,t,i){const n=document.createElement(t);return e&&(n.className=e),i&&i.appendChild(n),n}function Ui(e,t){return e.x=t.x,e.y=t.y,void 0!==t.id&&(e.id=t.id),e}function Ki(e){e.x=Math.round(e.x),e.y=Math.round(e.y)}function Gi(e,t){const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)}function Xi(e,t){return e.x===t.x&&e.y===t.y}function Qi(e,t,i){return Math.min(Math.max(e,t),i)}function Yi(e,t,i){let n=`translate3d(${e}px,${t||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}function Ji(e,t,i,n){e.style.transform=Yi(t,i,n)}const en="cubic-bezier(.4,0,.22,1)";function tn(e,t,i,n){e.style.transition=t?`${t} ${i}ms ${n||en}`:"none"}function nn(e,t,i){e.style.width="number"==typeof t?`${t}px`:t,e.style.height="number"==typeof i?`${i}px`:i}const sn="idle",on="loading",rn="loaded",an="error";function ln(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let cn=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{cn=!0}}))}catch(e){}class dn{constructor(){this._pool=[]}add(e,t,i,n){this._toggleListener(e,t,i,n)}remove(e,t,i,n){this._toggleListener(e,t,i,n,!0)}removeAll(){this._pool.forEach((e=>{this._toggleListener(e.target,e.type,e.listener,e.passive,!0,!0)})),this._pool=[]}_toggleListener(e,t,i,n,s,o){if(!e)return;const r=s?"removeEventListener":"addEventListener";t.split(" ").forEach((t=>{if(t){o||(s?this._pool=this._pool.filter((n=>n.type!==t||n.listener!==i||n.target!==e)):this._pool.push({target:e,type:t,listener:i,passive:n}));const a=!!cn&&{passive:n||!1};e[r](t,i,a)}}))}}function hn(e,t){if(e.getViewportSizeFn){const i=e.getViewportSizeFn(e,t);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function pn(e,t,i,n,s){let o=0;if(t.paddingFn)o=t.paddingFn(i,n,s)[e];else if(t.padding)o=t.padding[e];else{const i="padding"+e[0].toUpperCase()+e.slice(1);t[i]&&(o=t[i])}return Number(o)||0}function un(e,t,i,n){return{x:t.x-pn("left",e,t,i,n)-pn("right",e,t,i,n),y:t.y-pn("top",e,t,i,n)-pn("bottom",e,t,i,n)}}class mn{constructor(e){this.slide=e,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(e){this.currZoomLevel=e,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(e){const{pswp:t}=this.slide,i=this.slide["x"===e?"width":"height"]*this.currZoomLevel,n=pn("x"===e?"left":"top",t.options,t.viewportSize,this.slide.data,this.slide.index),s=this.slide.panAreaSize[e];this.center[e]=Math.round((s-i)/2)+n,this.max[e]=i>s?Math.round(s-i)+n:this.center[e],this.min[e]=i>s?n:this.center[e]}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(e,t){return Qi(t,this.max[e],this.min[e])}}class gn{constructor(e,t,i,n){this.pswp=n,this.options=e,this.itemData=t,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(e,t,i){const n={x:e,y:t};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(e){const t=e+"ZoomLevel",i=this.options[t];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}_getSecondary(){let e=this._parseZoomLevelOption("secondary");return e||(e=Math.min(1,3*this.fit),this.elementSize&&e*this.elementSize.x>4e3&&(e=4e3/this.elementSize.x),e)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,4*this.fit)}}class fn{constructor(e,t,i){this.data=e,this.index=t,this.pswp=i,this.isActive=t===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 gn(i.options,e,t,i),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:t}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=Wi("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 mn(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(e){e&&!this.isActive?this.activate():!e&&this.isActive&&this.deactivate()}append(e){this.holderElement=e,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:e}=this;!this.heavyAppended&&e.opener.isOpen&&!e.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(e){const t=this.currentResolution||this.zoomLevels.initial;if(!t)return;const i=Math.round(this.width*t)||this.pswp.viewportSize.x,n=Math.round(this.height*t)||this.pswp.viewportSize.y;(this.sizeChanged(i,n)||e)&&this.content.setDisplayedSize(i,n)}sizeChanged(e,t){return(e!==this.prevDisplayedWidth||t!==this.prevDisplayedHeight)&&(this.prevDisplayedWidth=e,this.prevDisplayedHeight=t,!0)}getPlaceholderElement(){var e;return null===(e=this.content.placeholder)||void 0===e?void 0:e.element}zoomTo(e,t,i,n){const{pswp:s}=this;if(!this.isZoomable()||s.mainScroll.isShifted())return;s.dispatch("beforeZoomTo",{destZoomLevel:e,centerPoint:t,transitionDuration:i}),s.animations.stopAllPan();const o=this.currZoomLevel;n||(e=Qi(e,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(e),this.pan.x=this.calculateZoomToPanOffset("x",t,o),this.pan.y=this.calculateZoomToPanOffset("y",t,o),Ki(this.pan);const r=()=>{this._setResolution(e),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(e){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,e,this.pswp.options.zoomAnimationDuration)}setZoomLevel(e){this.currZoomLevel=e,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(e,t,i){if(0===this.bounds.max[e]-this.bounds.min[e])return this.bounds.center[e];t||(t=this.pswp.getViewportCenterPoint()),i||(i=this.zoomLevels.initial);const n=this.currZoomLevel/i;return this.bounds.correctPan(e,(this.pan[e]-t[e])*n+t[e])}panTo(e,t){this.pan.x=this.bounds.correctPan("x",e),this.pan.y=this.bounds.correctPan("y",t),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),Ui(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(e,t,i){i/=this.currentResolution||this.zoomLevels.initial,Ji(this.container,e,t,i)}calculateSize(){const{pswp:e}=this;Ui(this.panAreaSize,un(e.options,e.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),e.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const e=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return Yi(this.pan.x,this.pan.y,e)}_setResolution(e){e!==this.currentResolution&&(this.currentResolution=e,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}class vn{constructor(e){this.gestures=e,this.pswp=e.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&Ui(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:e,prevP1:t,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+(e.y-t.y);if(!this.pswp.dispatch("verticalDrag",{panY:i}).defaultPrevented){this._setPanWithFriction("y",i,.6);const e=1-Math.abs(this._getVerticalDragRatio(n.pan.y));this.pswp.applyBgOpacity(e),n.applyCurrentZoomPan()}}else{this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),n&&(Ki(n.pan),n.applyCurrentZoomPan()))}}end(){const{velocity:e}=this.gestures,{mainScroll:t,currSlide:i}=this.pswp;let n=0;if(this.pswp.animations.stopAll(),t.isShifted()){const i=(t.x-t.getCurrSlideX())/this.pswp.viewportSize.x;e.x<-.5&&i<0||e.x<.1&&i<-.5?(n=1,e.x=Math.min(e.x,0)):(e.x>.5&&i>0||e.x>-.1&&i>.5)&&(n=-1,e.x=Math.max(e.x,0)),t.moveIndexBy(n,!0,e.x)}i&&i.currZoomLevel>i.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(e){const{velocity:t}=this.gestures,{currSlide:i}=this.pswp;if(!i)return;const{pan:n,bounds:s}=i,o=n[e],r=this.pswp.bgOpacity<1&&"y"===e,a=o+function(e,t){return e*t/(1-t)}(t[e],.995);if(r){const e=this._getVerticalDragRatio(o),t=this._getVerticalDragRatio(a);if(e<0&&t<-.4||e>0&&t>.4)return void this.pswp.close()}const l=s.correctPan(e,a);if(o===l)return;const c=l===a?1:.82,d=this.pswp.bgOpacity,h=l-o;this.pswp.animations.startSpring({name:"panGesture"+e,isPan:!0,start:o,end:l,velocity:t[e],dampingRatio:c,onUpdate:t=>{if(r&&this.pswp.bgOpacity<1){const e=1-(l-t)/h;this.pswp.applyBgOpacity(Qi(d+(1-d)*e,0,1))}n[e]=Math.floor(t),i.applyCurrentZoomPan()}})}_panOrMoveMainScroll(e){const{p1:t,dragAxis:i,prevP1:n,isMultitouch:s}=this.gestures,{currSlide:o,mainScroll:r}=this.pswp,a=t[e]-n[e],l=r.x+a;if(!a||!o)return!1;if("x"===e&&!o.isPannable()&&!s)return r.moveTo(l,!0),!0;const{bounds:c}=o,d=o.pan[e]+a;if(this.pswp.options.allowPanToNext&&"x"===i&&"x"===e&&!s){const t=r.getCurrSlideX(),i=r.x-t,n=a>0,s=!n;if(d>c.min[e]&&n){if(c.min[e]<=this.startPan[e])return r.moveTo(l,!0),!0;this._setPanWithFriction(e,d)}else if(d<c.max[e]&&s){if(this.startPan[e]<=c.max[e])return r.moveTo(l,!0),!0;this._setPanWithFriction(e,d)}else if(0!==i){if(i>0)return r.moveTo(Math.max(l,t),!0),!0;if(i<0)return r.moveTo(Math.min(l,t),!0),!0}else this._setPanWithFriction(e,d)}else"y"===e&&(r.isShifted()||c.min.y===c.max.y)||this._setPanWithFriction(e,d);return!1}_getVerticalDragRatio(e){var t,i;return(e-(null!==(t=null===(i=this.pswp.currSlide)||void 0===i?void 0:i.bounds.center.y)&&void 0!==t?t:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(e,t,i){const{currSlide:n}=this.pswp;if(!n)return;const{pan:s,bounds:o}=n;if(o.correctPan(e,t)!==t||i){const n=Math.round(t-s[e]);s[e]+=n*(i||.35)}else s[e]=t}}function wn(e,t,i){return e.x=(t.x+i.x)/2,e.y=(t.y+i.y)/2,e}class yn{constructor(e){this.gestures=e,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:e}=this.gestures.pswp;e&&(this._startZoomLevel=e.currZoomLevel,Ui(this._startPan,e.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){const{p1:e,startP1:t,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;wn(this._startZoomPoint,t,n),wn(this._zoomPoint,e,i);let l=1/Gi(t,n)*Gi(e,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 e=1-(r-l)/(r/1.2);s.dispatch("pinchClose",{bgOpacity:e}).defaultPrevented||s.applyBgOpacity(e)}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:e}=this.gestures,{currSlide:t}=e;(!t||t.currZoomLevel<t.zoomLevels.initial)&&!this._wasOverFitZoomLevel&&e.options.pinchToClose?e.close():this.correctZoomPan()}_calculatePanForZoomLevel(e,t){const i=t/this._startZoomLevel;return this._zoomPoint[e]-(this._startZoomPoint[e]-this._startPan[e])*i}correctZoomPan(e){const{pswp:t}=this.gestures,{currSlide:i}=t;if(null==i||!i.isZoomable())return;0===this._zoomPoint.x&&(e=!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=t.bgOpacity,a=t.bgOpacity<1,l=Ui({x:0,y:0},i.pan);let c=Ui({x:0,y:0},l);e&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=n,Ui(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 d=!Xi(c,l);if(!d&&!o&&!a)return i._setResolution(s),void i.applyCurrentZoomPan();t.animations.stopAllPan(),t.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:e=>{if(e/=1e3,d||o){if(d&&(i.pan.x=l.x+(c.x-l.x)*e,i.pan.y=l.y+(c.y-l.y)*e),o){const t=n+(s-n)*e;i.setZoomLevel(t)}i.applyCurrentZoomPan()}a&&t.bgOpacity<1&&t.applyBgOpacity(Qi(r+(1-r)*e,0,1))},onComplete:()=>{i._setResolution(s),i.applyCurrentZoomPan()}})}}function xn(e){return!!e.target.closest(".pswp__container")}class bn{constructor(e){this.gestures=e}click(e,t){const i=t.target.classList,n=i.contains("pswp__img"),s=i.contains("pswp__item")||i.contains("pswp__zoom-wrap");n?this._doClickOrTapAction("imageClick",e,t):s&&this._doClickOrTapAction("bgClick",e,t)}tap(e,t){xn(t)&&this._doClickOrTapAction("tap",e,t)}doubleTap(e,t){xn(t)&&this._doClickOrTapAction("doubleTap",e,t)}_doClickOrTapAction(e,t,i){var n;const{pswp:s}=this.gestures,{currSlide:o}=s,r=e+"Action",a=s.options[r];if(!s.dispatch(r,{point:t,originalEvent:i}).defaultPrevented)if("function"!=typeof a)switch(a){case"close":case"next":s[a]();break;case"zoom":null==o||o.toggleZoom(t);break;case"zoom-or-close":null!=o&&o.isZoomable()&&o.zoomLevels.secondary!==o.zoomLevels.initial?o.toggleZoom(t):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,t,i)}}class kn{constructor(e){this.pswp=e,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||(e.options.allowPanToNext=!1),this.drag=new vn(this),this.zoomLevels=new yn(this),this.tapHandler=new bn(this),e.on("bindEvents",(()=>{e.events.add(e.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),e.scrollWrap&&(e.scrollWrap.ontouchmove=()=>{},e.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")}))}_bindEvents(e,t,i,n){const{pswp:s}=this,{events:o}=s,r=n?e+n:"";o.add(s.scrollWrap,e+t,this.onPointerDown.bind(this)),o.add(window,e+"move",this.onPointerMove.bind(this)),o.add(window,e+i,this.onPointerUp.bind(this)),r&&o.add(s.scrollWrap,r,this.onPointerUp.bind(this))}onPointerDown(e){const t="mousedown"===e.type||"mouse"===e.pointerType;if(t&&e.button>0)return;const{pswp:i}=this;i.opener.isOpen?i.dispatch("pointerDown",{originalEvent:e}).defaultPrevented||(t&&(i.mouseDetected(),this._preventPointerEventBehaviour(e,"down")),i.animations.stopAll(),this._updatePoints(e,"down"),1===this._numActivePoints&&(this.dragAxis=null,Ui(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1):e.preventDefault()}onPointerMove(e){this._preventPointerEventBehaviour(e,"move"),this._numActivePoints&&(this._updatePoints(e,"move"),this.pswp.dispatch("pointerMove",{originalEvent:e}).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,Ui(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(e){this._numActivePoints&&(this._updatePoints(e,"up"),this.pswp.dispatch("pointerUp",{originalEvent:e}).defaultPrevented||(0===this._numActivePoints&&(this._rafStopLoop(),this.isDragging?this._finishDrag():this.isZooming||this.isMultitouch||this._finishTap(e)),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?Xi(this.p1,this.prevP1)||this.drag.change():Xi(this.p1,this.prevP1)&&Xi(this.p2,this.prevP2)||this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(e){const t=Date.now(),i=t-this._intervalTime;i<50&&!e||(this.velocity.x=this._getVelocity("x",i),this.velocity.y=this._getVelocity("y",i),this._intervalTime=t,Ui(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(e){const{mainScroll:t}=this.pswp;if(t.isShifted())return void t.moveIndexBy(0,!0);if(e.type.indexOf("cancel")>0)return;if("mouseup"===e.type||"mouse"===e.pointerType)return void this.tapHandler.click(this.startP1,e);const i=this.pswp.options.doubleTapAction?300:0;this._tapTimer?(this._clearTapTimer(),Gi(this._lastStartP1,this.startP1)<25&&this.tapHandler.doubleTap(this.startP1,e)):(Ui(this._lastStartP1,this.startP1),this._tapTimer=setTimeout((()=>{this.tapHandler.tap(this.startP1,e),this._clearTapTimer()}),i))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(e,t){const i=this.p1[e]-this._intervalP1[e];return Math.abs(i)>1&&t>5?i/t:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(e,t){this.pswp.applyFilters("preventPointerEvent",!0,e,t)&&e.preventDefault()}_updatePoints(e,t){if(this._pointerEventEnabled){const i=e,n=this._ongoingPointers.findIndex((e=>e.id===i.pointerId));"up"===t&&n>-1?this._ongoingPointers.splice(n,1):"down"===t&&-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&&Ui(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&Ui(this.p2,this._ongoingPointers[1])}else{const i=e;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(e,this.p1),"up"===t?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){Ui(this.prevP1,this.p1),Ui(this.prevP2,this.p2)}_updateStartPoints(){Ui(this.startP1,this.p1),Ui(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const e=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(0!==e){const t=e>0?"x":"y";Math.abs(this.p1[t]-this.startP1[t])>=10&&(this.dragAxis=t)}}}_convertEventPosToPoint(e,t){return t.x=e.pageX-this.pswp.offset.x,t.y=e.pageY-this.pswp.offset.y,"pointerId"in e?t.id=e.pointerId:void 0!==e.identifier&&(t.id=e.identifier),t}_onClick(e){this.pswp.mainScroll.isShifted()&&(e.preventDefault(),e.stopPropagation())}}class Cn{constructor(e){this.pswp=e,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(e){const{pswp:t}=this,i=Math.round(t.viewportSize.x+t.viewportSize.x*t.options.spacing),n=i!==this.slideWidth;n&&(this.slideWidth=i,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach(((t,i)=>{n&&Ji(t.el,(i+this._containerShiftIndex)*this.slideWidth),e&&t.slide&&t.slide.resize()}))}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let e=0;e<3;e++){const t=Wi("pswp__item","div",this.pswp.container);t.setAttribute("role","group"),t.setAttribute("aria-roledescription","slide"),t.setAttribute("aria-hidden","true"),t.style.display=1===e?"block":"none",this.itemHolders.push({el:t})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(e,t,i){const{pswp:n}=this;let s=n.potentialIndex+e;const o=n.getNumItems();if(n.canLoop()){s=n.getLoopedIndex(s);const t=(e+o)%o;e=t<=o/2?t:t-o}else s<0?s=0:s>=o&&(s=o-1),e=s-n.potentialIndex;n.potentialIndex=s,this._currPositionIndex-=e,n.animations.stopMainScroll();const r=this.getCurrSlideX();if(t){n.animations.startSpring({isMainScroll:!0,start:this.x,end:r,velocity:i||0,naturalFrequency:30,dampingRatio:1,onUpdate:e=>{this.moveTo(e)},onComplete:()=>{this.updateCurrItem(),n.appendHeavy()}});let e=n.potentialIndex-n.currIndex;if(n.canLoop()){const t=(e+o)%o;e=t<=o/2?t:t-o}Math.abs(e)>1&&this.updateCurrItem()}else this.moveTo(r),this.updateCurrItem();return Boolean(e)}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var e;const{pswp:t}=this,i=this._prevPositionIndex-this._currPositionIndex;if(!i)return;this._prevPositionIndex=this._currPositionIndex,t.currIndex=t.potentialIndex;let n,s=Math.abs(i);s>=3&&(this._containerShiftIndex+=i+(i>0?-3:3),s=3,this.itemHolders.forEach((e=>{var t;null===(t=e.slide)||void 0===t||t.destroy(),e.slide=void 0})));for(let e=0;e<s;e++)i>0?(n=this.itemHolders.shift(),n&&(this.itemHolders[2]=n,this._containerShiftIndex++,Ji(n.el,(this._containerShiftIndex+2)*this.slideWidth),t.setContent(n,t.currIndex-s+e+2))):(n=this.itemHolders.pop(),n&&(this.itemHolders.unshift(n),this._containerShiftIndex--,Ji(n.el,this._containerShiftIndex*this.slideWidth),t.setContent(n,t.currIndex+s-e-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),t.animations.stopAllPan(),this.itemHolders.forEach(((e,t)=>{e.slide&&e.slide.setIsActive(1===t)})),t.currSlide=null===(e=this.itemHolders[1])||void 0===e?void 0:e.slide,t.contentLoader.updateLazy(i),t.currSlide&&t.currSlide.applyCurrentZoomPan(),t.dispatch("change")}moveTo(e,t){if(!this.pswp.canLoop()&&t){let t=(this.slideWidth*this._currPositionIndex-e)/this.slideWidth;t+=this.pswp.currIndex;const i=Math.round(e-this.x);(t<0&&i>0||t>=this.pswp.getNumItems()-1&&i<0)&&(e=this.x+.35*i)}this.x=e,this.pswp.container&&Ji(this.pswp.container,e),this.pswp.dispatch("moveMainScroll",{x:e,dragging:null!=t&&t})}}const Sn={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},Bn=(e,t)=>t?e:Sn[e];class _n{constructor(e){this.pswp=e,this._wasFocused=!1,e.on("bindEvents",(()=>{e.options.trapFocus&&(e.options.initialPointerPos||this._focusRoot(),e.events.add(document,"focusin",this._onFocusIn.bind(this))),e.events.add(document,"keydown",this._onKeyDown.bind(this))}));const t=document.activeElement;e.on("destroy",(()=>{e.options.returnFocus&&t&&this._wasFocused&&t.focus()}))}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(e){const{pswp:t}=this;if(t.dispatch("keydown",{originalEvent:e}).defaultPrevented)return;if(function(e){return"button"in e&&1===e.button||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey}(e))return;let i,n,s=!1;const o="key"in e;switch(o?e.key:e.keyCode){case Bn("Escape",o):t.options.escKey&&(i="close");break;case Bn("z",o):i="toggleZoom";break;case Bn("ArrowLeft",o):n="x";break;case Bn("ArrowUp",o):n="y";break;case Bn("ArrowRight",o):n="x",s=!0;break;case Bn("ArrowDown",o):s=!0,n="y";break;case Bn("Tab",o):this._focusRoot()}if(n){e.preventDefault();const{currSlide:o}=t;t.options.arrowKeys&&"x"===n&&t.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&&(e.preventDefault(),t[i]())}_onFocusIn(e){const{template:t}=this.pswp;t&&document!==e.target&&t!==e.target&&!t.contains(e.target)&&t.focus()}}const An="cubic-bezier(.4,0,.22,1)";class Ln{constructor(e){var t;this.props=e;const{target:i,onComplete:n,transform:s,onFinish:o=(()=>{}),duration:r=333,easing:a=An}=e;this.onFinish=o;const l=s?"transform":"opacity",c=null!==(t=e[l])&&void 0!==t?t:"";this._target=i,this._onComplete=n,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout((()=>{tn(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(e){e.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),tn(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}class Tn{constructor(e,t,i){this.velocity=1e3*e,this._dampingRatio=t||.75,this._naturalFrequency=i||12,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(e,t){let i,n=0;t/=1e3;const s=Math.E**(-this._dampingRatio*this._naturalFrequency*t);if(1===this._dampingRatio)i=this.velocity+this._naturalFrequency*e,n=(e+i*t)*s,this.velocity=n*-this._naturalFrequency+i*s;else if(this._dampingRatio<1){i=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*e+this.velocity);const o=Math.cos(this._dampedFrequency*t),r=Math.sin(this._dampedFrequency*t);n=s*(e*o+i*r),this.velocity=n*-this._naturalFrequency*this._dampingRatio+s*(-this._dampedFrequency*e*r+this._dampedFrequency*i*o)}return n}}class En{constructor(e){this.props=e,this._raf=0;const{start:t,end:i,velocity:n,onUpdate:s,onComplete:o,onFinish:r=(()=>{}),dampingRatio:a,naturalFrequency:l}=e;this.onFinish=r;const c=new Tn(n,a,l);let d=Date.now(),h=t-i;const p=()=>{this._raf&&(h=c.easeFrame(h,Date.now()-d),Math.abs(h)<1&&Math.abs(c.velocity)<50?(s(i),o&&o(),this.onFinish()):(d=Date.now(),s(h+i),this._raf=requestAnimationFrame(p)))};this._raf=requestAnimationFrame(p)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class In{constructor(){this.activeAnimations=[]}startSpring(e){this._start(e,!0)}startTransition(e){this._start(e)}_start(e,t){const i=t?new En(e):new Ln(e);return this.activeAnimations.push(i),i.onFinish=()=>this.stop(i),i}stop(e){e.destroy();const t=this.activeAnimations.indexOf(e);t>-1&&this.activeAnimations.splice(t,1)}stopAll(){this.activeAnimations.forEach((e=>{e.destroy()})),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter((e=>!e.props.isPan||(e.destroy(),!1)))}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter((e=>!e.props.isMainScroll||(e.destroy(),!1)))}isPanRunning(){return this.activeAnimations.some((e=>e.props.isPan))}}class Mn{constructor(e){this.pswp=e,e.events.add(e.element,"wheel",this._onWheel.bind(this))}_onWheel(e){e.preventDefault();const{currSlide:t}=this.pswp;let{deltaX:i,deltaY:n}=e;if(t&&!this.pswp.dispatch("wheel",{originalEvent:e}).defaultPrevented)if(e.ctrlKey||this.pswp.options.wheelToZoom){if(t.isZoomable()){let i=-n;1===e.deltaMode?i*=.05:i*=e.deltaMode?1:.002,i=2**i;const s=t.currZoomLevel*i;t.zoomTo(s,{x:e.clientX,y:e.clientY})}}else t.isPannable()&&(1===e.deltaMode&&(i*=18,n*=18),t.panTo(t.pan.x-i,t.pan.y-n))}}class Pn{constructor(e,t){var i;const n=t.name||t.className;let s=t.html;if(!1===e.options[n])return;"string"==typeof e.options[n+"SVG"]&&(s=e.options[n+"SVG"]),e.dispatch("uiElementCreate",{data:t});let o="";t.isButton?(o+="pswp__button ",o+=t.className||`pswp__button--${t.name}`):o+=t.className||`pswp__${t.name}`;let r=t.isButton?t.tagName||"button":t.tagName||"div";r=r.toLowerCase();const a=Wi(o,r);if(t.isButton){"button"===r&&(a.type="button");let{title:i}=t;const{ariaLabel:s}=t;"string"==typeof e.options[n+"Title"]&&(i=e.options[n+"Title"]),i&&(a.title=i);const o=s||i;o&&a.setAttribute("aria-label",o)}a.innerHTML=function(e){if("string"==typeof e)return e;if(!e||!e.isCustomSVG)return"";const t=e;let i='<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';return i=i.split("%d").join(t.size||32),t.outlineID&&(i+='<use class="pswp__icn-shadow" xlink:href="#'+t.outlineID+'"/>'),i+=t.inner,i+="</svg>",i}(s),t.onInit&&t.onInit(a,e),t.onClick&&(a.onclick=i=>{"string"==typeof t.onClick?e[t.onClick]():"function"==typeof t.onClick&&t.onClick(i,a,e)});const l=t.appendTo||"bar";let c=e.element;"bar"===l?(e.topBar||(e.topBar=Wi("pswp__top-bar pswp__hide-on-close","div",e.scrollWrap)),c=e.topBar):(a.classList.add("pswp__hide-on-close"),"wrapper"===l&&(c=e.scrollWrap)),null===(i=c)||void 0===i||i.appendChild(e.applyFilters("uiElement",a,t))}}function Dn(e,t,i){e.classList.add("pswp__button--arrow"),e.setAttribute("aria-controls","pswp__items"),t.on("change",(()=>{t.options.loop||(e.disabled=i?!(t.currIndex<t.getNumItems()-1):!(t.currIndex>0))}))}const Zn={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:Dn},Nn={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:(e,t)=>{Dn(e,t,!0)}},On={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"},Hn={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"},zn={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:(e,t)=>{let i,n=null;const s=t=>{var n,s;i!==t&&(i=t,n="active",s=t,e.classList.toggle("pswp__preloader--"+n,s))},o=()=>{var e;if(null===(e=t.currSlide)||void 0===e||!e.content.isLoading())return s(!1),void(n&&(clearTimeout(n),n=null));n||(n=setTimeout((()=>{var e;s(Boolean(null===(e=t.currSlide)||void 0===e?void 0:e.content.isLoading())),n=null}),t.options.preloaderDelay))};t.on("change",o),t.on("loadComplete",(e=>{t.currSlide===e.slide&&o()})),t.ui&&(t.ui.updatePreloaderVisibility=o)}},$n={name:"counter",order:5,onInit:(e,t)=>{t.on("change",(()=>{e.innerText=t.currIndex+1+t.options.indexIndicatorSep+t.getNumItems()}))}};function Vn(e,t){e.classList.toggle("pswp--zoomed-in",t)}class Fn{constructor(e){this.pswp=e,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){const{pswp:e}=this;this.isRegistered=!1,this.uiElementsData=[On,Zn,Nn,Hn,zn,$n],e.dispatch("uiRegister"),this.uiElementsData.sort(((e,t)=>(e.order||0)-(t.order||0))),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach((e=>{this.registerElement(e)})),e.on("change",(()=>{var t;null===(t=e.element)||void 0===t||t.classList.toggle("pswp--one-slide",1===e.getNumItems())})),e.on("zoomPanUpdate",(()=>this._onZoomPanUpdate()))}registerElement(e){this.isRegistered?this.items.push(new Pn(this.pswp,e)):this.uiElementsData.push(e)}_onZoomPanUpdate(){const{template:e,currSlide:t,options:i}=this.pswp;if(this.pswp.opener.isClosing||!e||!t)return;let{currZoomLevel:n}=t;if(this.pswp.opener.isOpen||(n=t.zoomLevels.initial),n===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=n;const s=t.zoomLevels.initial-t.zoomLevels.secondary;if(Math.abs(s)<.01||!t.isZoomable())return Vn(e,!1),void e.classList.remove("pswp--zoom-allowed");e.classList.add("pswp--zoom-allowed");Vn(e,(n===t.zoomLevels.initial?t.zoomLevels.secondary:t.zoomLevels.initial)<=n),"zoom"!==i.imageClickAction&&"zoom-or-close"!==i.imageClickAction||e.classList.add("pswp--click-to-zoom")}}class Rn{constructor(e,t){this.type=e,this.defaultPrevented=!1,t&&Object.assign(this,t)}preventDefault(){this.defaultPrevented=!0}}class jn{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(e,t,i=100){var n,s,o;this._filters[e]||(this._filters[e]=[]),null===(n=this._filters[e])||void 0===n||n.push({fn:t,priority:i}),null===(s=this._filters[e])||void 0===s||s.sort(((e,t)=>e.priority-t.priority)),null===(o=this.pswp)||void 0===o||o.addFilter(e,t,i)}removeFilter(e,t){this._filters[e]&&(this._filters[e]=this._filters[e].filter((e=>e.fn!==t))),this.pswp&&this.pswp.removeFilter(e,t)}applyFilters(e,...t){var i;return null===(i=this._filters[e])||void 0===i||i.forEach((e=>{t[0]=e.fn.apply(this,t)})),t[0]}on(e,t){var i,n;this._listeners[e]||(this._listeners[e]=[]),null===(i=this._listeners[e])||void 0===i||i.push(t),null===(n=this.pswp)||void 0===n||n.on(e,t)}off(e,t){var i;this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter((e=>t!==e))),null===(i=this.pswp)||void 0===i||i.off(e,t)}dispatch(e,t){var i;if(this.pswp)return this.pswp.dispatch(e,t);const n=new Rn(e,t);return null===(i=this._listeners[e])||void 0===i||i.forEach((e=>{e.call(this,n)})),n}}class qn{constructor(e,t){if(this.element=Wi("pswp__img pswp__img--placeholder",e?"img":"div",t),e){const t=this.element;t.decoding="async",t.alt="",t.src=e,t.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(e,t){this.element&&("IMG"===this.element.tagName?(nn(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=Yi(0,0,e/250)):nn(this.element,e,t))}destroy(){var e;null!==(e=this.element)&&void 0!==e&&e.parentNode&&this.element.remove(),this.element=null}}class Wn{constructor(e,t,i){this.instance=t,this.data=e,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=sn,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(e,t){if(this.slide&&this.usePlaceholder())if(this.placeholder){const e=this.placeholder.element;e&&!e.parentElement&&this.slide.container.prepend(e)}else{const e=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new qn(e,this.slide.container)}this.element&&!t||this.instance.dispatch("contentLoad",{content:this,isLazy:e}).defaultPrevented||(this.isImageContent()?(this.element=Wi("pswp__img","img"),this.displayedImageWidth&&this.loadImage(e)):(this.element=Wi("pswp__content","div"),this.element.innerHTML=this.data.html||""),t&&this.slide&&this.slide.updateContentSize(!0))}loadImage(e){var t,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:e}).defaultPrevented)return;const n=this.element;this.updateSrcsetSizes(),this.data.srcset&&(n.srcset=this.data.srcset),n.src=null!==(t=this.data.src)&&void 0!==t?t:"",n.alt=null!==(i=this.data.alt)&&void 0!==i?i:"",this.state=on,n.complete?this.onLoaded():(n.onload=()=>{this.onLoaded()},n.onerror=()=>{this.onError()})}setSlide(e){this.slide=e,this.hasSlide=!0,this.instance=e.pswp}onLoaded(){this.state=rn,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!==rn&&this.state!==an||this.removePlaceholder())}onError(){this.state=an,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===on,this)}isError(){return this.state===an}isImageContent(){return"image"===this.type}setDisplayedSize(e,t){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(e,t),!this.instance.dispatch("contentResize",{content:this,width:e,height:t}).defaultPrevented&&(nn(this.element,e,t),this.isImageContent()&&!this.isError()))){const i=!this.displayedImageWidth&&e;this.displayedImageWidth=e,this.displayedImageHeight=t,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:e,height:t,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==an,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const e=this.element,t=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!e.dataset.largestUsedSize||t>parseInt(e.dataset.largestUsedSize,10))&&(e.sizes=t+"px",e.dataset.largestUsedSize=String(t))}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 e,t;let i=Wi("pswp__error-msg","div");i.innerText=null!==(e=null===(t=this.instance.options)||void 0===t?void 0:t.errorMsg)&&void 0!==e?e:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=Wi("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===an)return void this.displayError();if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const e="decode"in this.element;this.isImageContent()?e&&this.slide&&(!this.slide.isActive||ln())?(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&&!ln()?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!==rn&&this.state!==an||this.removePlaceholder()))}}function Un(e,t,i){const n=t.createContentFromData(e,i);let s;const{options:o}=t;if(o){let r;s=new gn(o,e,-1),r=t.pswp?t.pswp.viewportSize:hn(o,t);const a=un(o,r,e,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 Kn{constructor(e){this.pswp=e,this.limit=Math.max(e.options.preload[0]+e.options.preload[1]+1,5),this._cachedItems=[]}updateLazy(e){const{pswp:t}=this;if(t.dispatch("lazyLoad").defaultPrevented)return;const{preload:i}=t.options,n=void 0===e||e>=0;let s;for(s=0;s<=i[1];s++)this.loadSlideByIndex(t.currIndex+(n?s:-s));for(s=1;s<=i[0];s++)this.loadSlideByIndex(t.currIndex+(n?-s:s))}loadSlideByIndex(e){const t=this.pswp.getLoopedIndex(e);let i=this.getContentByIndex(t);i||(i=function(e,t){const i=t.getItemData(e);if(!t.dispatch("lazyLoadSlide",{index:e,itemData:i}).defaultPrevented)return Un(i,t,e)}(t,this.pswp),i&&this.addToCache(i))}getContentBySlide(e){let t=this.getContentByIndex(e.index);return t||(t=this.pswp.createContentFromData(e.data,e.index),this.addToCache(t)),t.setSlide(e),t}addToCache(e){if(this.removeByIndex(e.index),this._cachedItems.push(e),this._cachedItems.length>this.limit){const e=this._cachedItems.findIndex((e=>!e.isAttached&&!e.hasSlide));if(-1!==e){this._cachedItems.splice(e,1)[0].destroy()}}}removeByIndex(e){const t=this._cachedItems.findIndex((t=>t.index===e));-1!==t&&this._cachedItems.splice(t,1)}getContentByIndex(e){return this._cachedItems.find((t=>t.index===e))}destroy(){this._cachedItems.forEach((e=>e.destroy())),this._cachedItems=[]}}class Gn extends jn{getNumItems(){var e;let t=0;const i=null===(e=this.options)||void 0===e?void 0:e.dataSource;i&&"length"in i?t=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(t=i.items.length));const n=this.dispatch("numItems",{dataSource:i,numItems:t});return this.applyFilters("numItems",n.numItems,i)}createContentFromData(e,t){return new Wn(e,this,t)}getItemData(e){var t;const i=null===(t=this.options)||void 0===t?void 0:t.dataSource;let n={};Array.isArray(i)?n=i[e]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),n=i.items[e]);let s=n;s instanceof Element&&(s=this._domElementToItemData(s));const o=this.dispatch("itemData",{itemData:s||{},index:e});return this.applyFilters("itemData",o.itemData,e)}_getGalleryDOMElements(e){var t,i;return null!==(t=this.options)&&void 0!==t&&t.children||null!==(i=this.options)&&void 0!==i&&i.childSelector?function(e,t,i=document){let n=[];if(e instanceof Element)n=[e];else if(e instanceof NodeList||Array.isArray(e))n=Array.from(e);else{const s="string"==typeof e?e:t;s&&(n=Array.from(i.querySelectorAll(s)))}return n}(this.options.children,this.options.childSelector,e)||[]:[e]}_domElementToItemData(e){const t={element:e},i="A"===e.tagName?e:e.querySelector("a");if(i){t.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(t.srcset=i.dataset.pswpSrcset),t.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,t.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,t.w=t.width,t.h=t.height,i.dataset.pswpType&&(t.type=i.dataset.pswpType);const s=e.querySelector("img");var n;if(s)t.msrc=s.currentSrc||s.src,t.alt=null!==(n=s.getAttribute("alt"))&&void 0!==n?n:"";(i.dataset.pswpCropped||i.dataset.cropped)&&(t.thumbCropped=!0)}return this.applyFilters("domItemData",t,e,i)}lazyLoadData(e,t){return Un(e,this,t)}}const Xn=.003;class Qn{constructor(e){this.pswp=e,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),e.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;const e=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,e&&e.currZoomLevel*e.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 e=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,e&&e.zoomLevels.initial*e.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){const{pswp:e}=this,t=this.pswp.currSlide,{options:i}=e;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&&e._initialThumbBounds?this._thumbBounds=e._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=null==t?void 0:t.getPlaceholderElement(),e.animations.stopAll(),this._useAnimation=Boolean(this._duration&&this._duration>50),this._animateZoom=Boolean(this._thumbBounds)&&(null==t?void 0:t.content.usePlaceholder())&&(!this.isClosing||!e.mainScroll.isShifted()),this._animateZoom)?this._animateRootOpacity=null!==(n=i.showHideOpacity)&&void 0!==n&&n:(this._animateRootOpacity=!0,this.isOpening&&t&&(t.zoomAndPanToInitial(),t.applyCurrentZoomPan()));if(this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>Xn,this._opacityElement=this._animateRootOpacity?e.element:e.bg,!this._useAnimation)return this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,void(this.isOpening&&(e.element&&(e.element.style.opacity=String(Xn)),e.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,e.container&&(e.container.style.overflow="hidden",e.container.style.width=e.viewportSize.x+"px")):this._croppedZoom=!1;this.isOpening?(this._animateRootOpacity?(e.element&&(e.element.style.opacity=String(Xn)),e.applyBgOpacity(1)):(this._animateBgOpacity&&e.bg&&(e.bg.style.opacity=String(Xn)),e.element&&(e.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(Xn)))):this.isClosing&&(e.mainScroll.itemHolders[0]&&(e.mainScroll.itemHolders[0].el.style.display="none"),e.mainScroll.itemHolders[2]&&(e.mainScroll.itemHolders[2].el.style.display="none"),this._croppedZoom&&0!==e.mainScroll.x&&(e.mainScroll.resetPosition(),e.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&"IMG"===this._placeholder.tagName?new Promise((e=>{let t=!1,i=!0;var n;(n=this._placeholder,"decode"in n?n.decode().catch((()=>{})):n.complete?Promise.resolve(n):new Promise(((e,t)=>{n.onload=()=>e(n),n.onerror=t}))).finally((()=>{t=!0,i||e(!0)})),setTimeout((()=>{i=!1,t&&e(!0)}),50),setTimeout(e,250)})).finally((()=>this._initiate())):this._initiate()}_initiate(){var e,t;null===(e=this.pswp.element)||void 0===e||e.style.setProperty("--pswp-transition-duration",this._duration+"ms"),this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),null===(t=this.pswp.element)||void 0===t||t.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:e}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,e.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd"),e.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed)e.destroy();else if(this.isOpen){var t;this._animateZoom&&e.container&&(e.container.style.overflow="visible",e.container.style.width="100%"),null===(t=e.currSlide)||void 0===t||t.applyCurrentZoomPan()}}_animateToOpenState(){const{pswp:e}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)"),this._animateTo(this._cropContainer2,"transform","none")),e.currSlide&&(e.currSlide.zoomAndPanToInitial(),this._animateTo(e.currSlide.container,"transform",e.currSlide.getCurrentTransform()))),this._animateBgOpacity&&e.bg&&this._animateTo(e.bg,"opacity",String(e.options.bgOpacity)),this._animateRootOpacity&&e.element&&this._animateTo(e.element,"opacity","1")}_animateToClosedState(){const{pswp:e}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&e.bgOpacity>.01&&e.bg&&this._animateTo(e.bg,"opacity","0"),this._animateRootOpacity&&e.element&&this._animateTo(e.element,"opacity","0")}_setClosedStateZoomPan(e){if(!this._thumbBounds)return;const{pswp:t}=this,{innerRect:i}=this._thumbBounds,{currSlide:n,viewportSize:s}=t;if(this._croppedZoom&&i&&this._cropContainer1&&this._cropContainer2){const t=-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;e?(this._animateTo(this._cropContainer1,"transform",Yi(t,n)),this._animateTo(this._cropContainer2,"transform",Yi(o,r))):(Ji(this._cropContainer1,t,n),Ji(this._cropContainer2,o,r))}n&&(Ui(n.pan,i||this._thumbBounds),n.currZoomLevel=this._thumbBounds.w/n.width,e?this._animateTo(n.container,"transform",n.getCurrentTransform()):n.applyCurrentZoomPan())}_animateTo(e,t,i){if(!this._duration)return void(e.style[t]=i);const{animations:n}=this.pswp,s={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{n.activeAnimations.length||this._onAnimationComplete()},target:e};s[t]=i,n.startTransition(s)}}const Yn={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 Jn extends Gn{constructor(e){super(),this.options=this._prepareOptions(e||{}),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 dn,this.animations=new In,this.mainScroll=new Cn(this),this.gestures=new kn(this),this.opener=new Qn(this),this.keyboard=new _n(this),this.contentLoader=new Kn(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch("init"),this.dispatch("beforeOpen"),this._createMainStructure();let e="pswp--open";return this.gestures.supportsTouch&&(e+=" pswp--touch"),this.options.mainClass&&(e+=" "+this.options.mainClass),this.element&&(this.element.className+=" "+e),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new Mn(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:e}=this.mainScroll;e[0]&&(e[0].el.style.display="block",this.setContent(e[0],this.currIndex-1)),e[2]&&(e[2].el.style.display="block",this.setContent(e[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(e){const t=this.getNumItems();return this.options.loop&&(e>t-1&&(e-=t),e<0&&(e+=t)),Qi(e,0,t-1)}appendHeavy(){this.mainScroll.itemHolders.forEach((e=>{var t;null===(t=e.slide)||void 0===t||t.appendHeavy()}))}goTo(e){this.mainScroll.moveIndexBy(this.getLoopedIndex(e)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...e){var t;null===(t=this.currSlide)||void 0===t||t.zoomTo(...e)}toggleZoom(){var e;null===(e=this.currSlide)||void 0===e||e.toggleZoom()}close(){this.opener.isOpen&&!this.isDestroying&&(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){var e;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===(e=this.element)||void 0===e||e.remove(),this.mainScroll.itemHolders.forEach((e=>{var t;null===(t=e.slide)||void 0===t||t.destroy()})),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(e){this.contentLoader.removeByIndex(e),this.mainScroll.itemHolders.forEach(((t,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===e)&&(this.setContent(t,e,!0),1===i&&(this.currSlide=t.slide,null===(r=t.slide)||void 0===r||r.setIsActive(!0)))})),this.dispatch("change")}setContent(e,t,i){if(this.canLoop()&&(t=this.getLoopedIndex(t)),e.slide){if(e.slide.index===t&&!i)return;e.slide.destroy(),e.slide=void 0}if(!this.canLoop()&&(t<0||t>=this.getNumItems()))return;const n=this.getItemData(t);e.slide=new fn(n,t,this),t===this.currIndex&&(this.currSlide=e.slide),e.slide.append(e.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(e){if(this.isDestroying)return;const t=hn(this.options,this);!e&&Xi(t,this._prevViewportSize)||(Ui(this._prevViewportSize,t),this.dispatch("beforeResize"),Ui(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(e){this.bgOpacity=Math.max(e,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){var e;this.hasMouse||(this.hasMouse=!0,null===(e=this.element)||void 0===e||e.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(e,t){this.offset.x=e,this.offset.y=t,this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=Wi("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=Wi("pswp__bg","div",this.element),this.scrollWrap=Wi("pswp__scroll-wrap","section",this.element),this.container=Wi("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 Fn(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return function(e,t,i){const n=i.dispatch("thumbBounds",{index:e,itemData:t,instance:i});if(n.thumbBounds)return n.thumbBounds;const{element:s}=t;let o,r;if(s&&!1!==i.options.thumbSelector){const e=i.options.thumbSelector||"img";r=s.matches(e)?s:s.querySelector(e)}return r=i.applyFilters("thumbEl",r,t,e),r&&(o=t.thumbCropped?function(e,t,i){const n=e.getBoundingClientRect(),s=n.width/t,o=n.height/i,r=s>o?s:o,a=(n.width-t*r)/2,l=(n.height-i*r)/2,c={x:n.left+a,y:n.top+l,w:t*r};return c.innerRect={w:n.width,h:n.height,x:a,y:l},c}(r,t.width||t.w||0,t.height||t.h||0):function(e){const t=e.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width}}(r)),i.applyFilters("thumbBounds",o,t,e)}(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(e){return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(e.showHideAnimationType="none",e.zoomAnimationDuration=0),{...Yn,...e}}}class es{constructor(e){this.config=e,this.root=e.root,this.box=e.box}bindEvents(e){const t=this.box,i=t.getContainer(),n=e.closest(".lake-resizer").find(".lake-resizer-info"),s=e.attr("class").indexOf("-right")>=0,o=i.width(),r=i.height()/o;let a=0,l=0;const c=e=>{const t=e.clientX-a,o=Math.round(s?l+t:l-t),c=Math.round(r*o);n.text(`${o} x ${c}`),i.css({width:`${o}px`,height:`${c}px`}),this.config.onResize&&this.config.onResize(o,c)};e.on("pointerdown",(t=>{const s=t,o=e.get(0);try{o.setPointerCapture(s.pointerId)}catch(e){}a=s.clientX,l=i.width(),n.show(),e.on("pointermove",c)})),e.on("pointerup",(()=>{e.off("pointermove"),n.hide(),l=t.getContainer().width();const i=Math.round(r*l);this.config.onStop(l,i)})),e.on("pointercancel",(()=>{e.off("pointermove"),n.hide()}))}render(){const{width:e,height:t}=this.config,i=I(a`
|
|
27
|
+
*/function Wi(e,t,i){const n=document.createElement(t);return e&&(n.className=e),i&&i.appendChild(n),n}function Ui(e,t){return e.x=t.x,e.y=t.y,void 0!==t.id&&(e.id=t.id),e}function Ki(e){e.x=Math.round(e.x),e.y=Math.round(e.y)}function Gi(e,t){const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)}function Xi(e,t){return e.x===t.x&&e.y===t.y}function Qi(e,t,i){return Math.min(Math.max(e,t),i)}function Yi(e,t,i){let n=`translate3d(${e}px,${t||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}function Ji(e,t,i,n){e.style.transform=Yi(t,i,n)}const en="cubic-bezier(.4,0,.22,1)";function tn(e,t,i,n){e.style.transition=t?`${t} ${i}ms ${n||en}`:"none"}function nn(e,t,i){e.style.width="number"==typeof t?`${t}px`:t,e.style.height="number"==typeof i?`${i}px`:i}const sn="idle",on="loading",rn="loaded",an="error";function ln(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let cn=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{cn=!0}}))}catch(e){}class dn{constructor(){this._pool=[]}add(e,t,i,n){this._toggleListener(e,t,i,n)}remove(e,t,i,n){this._toggleListener(e,t,i,n,!0)}removeAll(){this._pool.forEach((e=>{this._toggleListener(e.target,e.type,e.listener,e.passive,!0,!0)})),this._pool=[]}_toggleListener(e,t,i,n,s,o){if(!e)return;const r=s?"removeEventListener":"addEventListener";t.split(" ").forEach((t=>{if(t){o||(s?this._pool=this._pool.filter((n=>n.type!==t||n.listener!==i||n.target!==e)):this._pool.push({target:e,type:t,listener:i,passive:n}));const a=!!cn&&{passive:n||!1};e[r](t,i,a)}}))}}function hn(e,t){if(e.getViewportSizeFn){const i=e.getViewportSizeFn(e,t);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function pn(e,t,i,n,s){let o=0;if(t.paddingFn)o=t.paddingFn(i,n,s)[e];else if(t.padding)o=t.padding[e];else{const i="padding"+e[0].toUpperCase()+e.slice(1);t[i]&&(o=t[i])}return Number(o)||0}function un(e,t,i,n){return{x:t.x-pn("left",e,t,i,n)-pn("right",e,t,i,n),y:t.y-pn("top",e,t,i,n)-pn("bottom",e,t,i,n)}}class mn{constructor(e){this.slide=e,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(e){this.currZoomLevel=e,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(e){const{pswp:t}=this.slide,i=this.slide["x"===e?"width":"height"]*this.currZoomLevel,n=pn("x"===e?"left":"top",t.options,t.viewportSize,this.slide.data,this.slide.index),s=this.slide.panAreaSize[e];this.center[e]=Math.round((s-i)/2)+n,this.max[e]=i>s?Math.round(s-i)+n:this.center[e],this.min[e]=i>s?n:this.center[e]}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(e,t){return Qi(t,this.max[e],this.min[e])}}class gn{constructor(e,t,i,n){this.pswp=n,this.options=e,this.itemData=t,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(e,t,i){const n={x:e,y:t};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(e){const t=e+"ZoomLevel",i=this.options[t];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}_getSecondary(){let e=this._parseZoomLevelOption("secondary");return e||(e=Math.min(1,3*this.fit),this.elementSize&&e*this.elementSize.x>4e3&&(e=4e3/this.elementSize.x),e)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,4*this.fit)}}class fn{constructor(e,t,i){this.data=e,this.index=t,this.pswp=i,this.isActive=t===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 gn(i.options,e,t,i),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:t}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=Wi("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 mn(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(e){e&&!this.isActive?this.activate():!e&&this.isActive&&this.deactivate()}append(e){this.holderElement=e,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:e}=this;!this.heavyAppended&&e.opener.isOpen&&!e.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(e){const t=this.currentResolution||this.zoomLevels.initial;if(!t)return;const i=Math.round(this.width*t)||this.pswp.viewportSize.x,n=Math.round(this.height*t)||this.pswp.viewportSize.y;(this.sizeChanged(i,n)||e)&&this.content.setDisplayedSize(i,n)}sizeChanged(e,t){return(e!==this.prevDisplayedWidth||t!==this.prevDisplayedHeight)&&(this.prevDisplayedWidth=e,this.prevDisplayedHeight=t,!0)}getPlaceholderElement(){var e;return null===(e=this.content.placeholder)||void 0===e?void 0:e.element}zoomTo(e,t,i,n){const{pswp:s}=this;if(!this.isZoomable()||s.mainScroll.isShifted())return;s.dispatch("beforeZoomTo",{destZoomLevel:e,centerPoint:t,transitionDuration:i}),s.animations.stopAllPan();const o=this.currZoomLevel;n||(e=Qi(e,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(e),this.pan.x=this.calculateZoomToPanOffset("x",t,o),this.pan.y=this.calculateZoomToPanOffset("y",t,o),Ki(this.pan);const r=()=>{this._setResolution(e),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(e){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,e,this.pswp.options.zoomAnimationDuration)}setZoomLevel(e){this.currZoomLevel=e,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(e,t,i){if(0===this.bounds.max[e]-this.bounds.min[e])return this.bounds.center[e];t||(t=this.pswp.getViewportCenterPoint()),i||(i=this.zoomLevels.initial);const n=this.currZoomLevel/i;return this.bounds.correctPan(e,(this.pan[e]-t[e])*n+t[e])}panTo(e,t){this.pan.x=this.bounds.correctPan("x",e),this.pan.y=this.bounds.correctPan("y",t),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),Ui(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(e,t,i){i/=this.currentResolution||this.zoomLevels.initial,Ji(this.container,e,t,i)}calculateSize(){const{pswp:e}=this;Ui(this.panAreaSize,un(e.options,e.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),e.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const e=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return Yi(this.pan.x,this.pan.y,e)}_setResolution(e){e!==this.currentResolution&&(this.currentResolution=e,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}class vn{constructor(e){this.gestures=e,this.pswp=e.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&Ui(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:e,prevP1:t,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+(e.y-t.y);if(!this.pswp.dispatch("verticalDrag",{panY:i}).defaultPrevented){this._setPanWithFriction("y",i,.6);const e=1-Math.abs(this._getVerticalDragRatio(n.pan.y));this.pswp.applyBgOpacity(e),n.applyCurrentZoomPan()}}else{this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),n&&(Ki(n.pan),n.applyCurrentZoomPan()))}}end(){const{velocity:e}=this.gestures,{mainScroll:t,currSlide:i}=this.pswp;let n=0;if(this.pswp.animations.stopAll(),t.isShifted()){const i=(t.x-t.getCurrSlideX())/this.pswp.viewportSize.x;e.x<-.5&&i<0||e.x<.1&&i<-.5?(n=1,e.x=Math.min(e.x,0)):(e.x>.5&&i>0||e.x>-.1&&i>.5)&&(n=-1,e.x=Math.max(e.x,0)),t.moveIndexBy(n,!0,e.x)}i&&i.currZoomLevel>i.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(e){const{velocity:t}=this.gestures,{currSlide:i}=this.pswp;if(!i)return;const{pan:n,bounds:s}=i,o=n[e],r=this.pswp.bgOpacity<1&&"y"===e,a=o+function(e,t){return e*t/(1-t)}(t[e],.995);if(r){const e=this._getVerticalDragRatio(o),t=this._getVerticalDragRatio(a);if(e<0&&t<-.4||e>0&&t>.4)return void this.pswp.close()}const l=s.correctPan(e,a);if(o===l)return;const c=l===a?1:.82,d=this.pswp.bgOpacity,h=l-o;this.pswp.animations.startSpring({name:"panGesture"+e,isPan:!0,start:o,end:l,velocity:t[e],dampingRatio:c,onUpdate:t=>{if(r&&this.pswp.bgOpacity<1){const e=1-(l-t)/h;this.pswp.applyBgOpacity(Qi(d+(1-d)*e,0,1))}n[e]=Math.floor(t),i.applyCurrentZoomPan()}})}_panOrMoveMainScroll(e){const{p1:t,dragAxis:i,prevP1:n,isMultitouch:s}=this.gestures,{currSlide:o,mainScroll:r}=this.pswp,a=t[e]-n[e],l=r.x+a;if(!a||!o)return!1;if("x"===e&&!o.isPannable()&&!s)return r.moveTo(l,!0),!0;const{bounds:c}=o,d=o.pan[e]+a;if(this.pswp.options.allowPanToNext&&"x"===i&&"x"===e&&!s){const t=r.getCurrSlideX(),i=r.x-t,n=a>0,s=!n;if(d>c.min[e]&&n){if(c.min[e]<=this.startPan[e])return r.moveTo(l,!0),!0;this._setPanWithFriction(e,d)}else if(d<c.max[e]&&s){if(this.startPan[e]<=c.max[e])return r.moveTo(l,!0),!0;this._setPanWithFriction(e,d)}else if(0!==i){if(i>0)return r.moveTo(Math.max(l,t),!0),!0;if(i<0)return r.moveTo(Math.min(l,t),!0),!0}else this._setPanWithFriction(e,d)}else"y"===e&&(r.isShifted()||c.min.y===c.max.y)||this._setPanWithFriction(e,d);return!1}_getVerticalDragRatio(e){var t,i;return(e-(null!==(t=null===(i=this.pswp.currSlide)||void 0===i?void 0:i.bounds.center.y)&&void 0!==t?t:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(e,t,i){const{currSlide:n}=this.pswp;if(!n)return;const{pan:s,bounds:o}=n;if(o.correctPan(e,t)!==t||i){const n=Math.round(t-s[e]);s[e]+=n*(i||.35)}else s[e]=t}}function wn(e,t,i){return e.x=(t.x+i.x)/2,e.y=(t.y+i.y)/2,e}class yn{constructor(e){this.gestures=e,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:e}=this.gestures.pswp;e&&(this._startZoomLevel=e.currZoomLevel,Ui(this._startPan,e.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){const{p1:e,startP1:t,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;wn(this._startZoomPoint,t,n),wn(this._zoomPoint,e,i);let l=1/Gi(t,n)*Gi(e,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 e=1-(r-l)/(r/1.2);s.dispatch("pinchClose",{bgOpacity:e}).defaultPrevented||s.applyBgOpacity(e)}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:e}=this.gestures,{currSlide:t}=e;(!t||t.currZoomLevel<t.zoomLevels.initial)&&!this._wasOverFitZoomLevel&&e.options.pinchToClose?e.close():this.correctZoomPan()}_calculatePanForZoomLevel(e,t){const i=t/this._startZoomLevel;return this._zoomPoint[e]-(this._startZoomPoint[e]-this._startPan[e])*i}correctZoomPan(e){const{pswp:t}=this.gestures,{currSlide:i}=t;if(null==i||!i.isZoomable())return;0===this._zoomPoint.x&&(e=!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=t.bgOpacity,a=t.bgOpacity<1,l=Ui({x:0,y:0},i.pan);let c=Ui({x:0,y:0},l);e&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=n,Ui(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 d=!Xi(c,l);if(!d&&!o&&!a)return i._setResolution(s),void i.applyCurrentZoomPan();t.animations.stopAllPan(),t.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:e=>{if(e/=1e3,d||o){if(d&&(i.pan.x=l.x+(c.x-l.x)*e,i.pan.y=l.y+(c.y-l.y)*e),o){const t=n+(s-n)*e;i.setZoomLevel(t)}i.applyCurrentZoomPan()}a&&t.bgOpacity<1&&t.applyBgOpacity(Qi(r+(1-r)*e,0,1))},onComplete:()=>{i._setResolution(s),i.applyCurrentZoomPan()}})}}function xn(e){return!!e.target.closest(".pswp__container")}class bn{constructor(e){this.gestures=e}click(e,t){const i=t.target.classList,n=i.contains("pswp__img"),s=i.contains("pswp__item")||i.contains("pswp__zoom-wrap");n?this._doClickOrTapAction("imageClick",e,t):s&&this._doClickOrTapAction("bgClick",e,t)}tap(e,t){xn(t)&&this._doClickOrTapAction("tap",e,t)}doubleTap(e,t){xn(t)&&this._doClickOrTapAction("doubleTap",e,t)}_doClickOrTapAction(e,t,i){var n;const{pswp:s}=this.gestures,{currSlide:o}=s,r=e+"Action",a=s.options[r];if(!s.dispatch(r,{point:t,originalEvent:i}).defaultPrevented)if("function"!=typeof a)switch(a){case"close":case"next":s[a]();break;case"zoom":null==o||o.toggleZoom(t);break;case"zoom-or-close":null!=o&&o.isZoomable()&&o.zoomLevels.secondary!==o.zoomLevels.initial?o.toggleZoom(t):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,t,i)}}class kn{constructor(e){this.pswp=e,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||(e.options.allowPanToNext=!1),this.drag=new vn(this),this.zoomLevels=new yn(this),this.tapHandler=new bn(this),e.on("bindEvents",(()=>{e.events.add(e.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),e.scrollWrap&&(e.scrollWrap.ontouchmove=()=>{},e.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")}))}_bindEvents(e,t,i,n){const{pswp:s}=this,{events:o}=s,r=n?e+n:"";o.add(s.scrollWrap,e+t,this.onPointerDown.bind(this)),o.add(window,e+"move",this.onPointerMove.bind(this)),o.add(window,e+i,this.onPointerUp.bind(this)),r&&o.add(s.scrollWrap,r,this.onPointerUp.bind(this))}onPointerDown(e){const t="mousedown"===e.type||"mouse"===e.pointerType;if(t&&e.button>0)return;const{pswp:i}=this;i.opener.isOpen?i.dispatch("pointerDown",{originalEvent:e}).defaultPrevented||(t&&(i.mouseDetected(),this._preventPointerEventBehaviour(e,"down")),i.animations.stopAll(),this._updatePoints(e,"down"),1===this._numActivePoints&&(this.dragAxis=null,Ui(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1):e.preventDefault()}onPointerMove(e){this._preventPointerEventBehaviour(e,"move"),this._numActivePoints&&(this._updatePoints(e,"move"),this.pswp.dispatch("pointerMove",{originalEvent:e}).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,Ui(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(e){this._numActivePoints&&(this._updatePoints(e,"up"),this.pswp.dispatch("pointerUp",{originalEvent:e}).defaultPrevented||(0===this._numActivePoints&&(this._rafStopLoop(),this.isDragging?this._finishDrag():this.isZooming||this.isMultitouch||this._finishTap(e)),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?Xi(this.p1,this.prevP1)||this.drag.change():Xi(this.p1,this.prevP1)&&Xi(this.p2,this.prevP2)||this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(e){const t=Date.now(),i=t-this._intervalTime;i<50&&!e||(this.velocity.x=this._getVelocity("x",i),this.velocity.y=this._getVelocity("y",i),this._intervalTime=t,Ui(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(e){const{mainScroll:t}=this.pswp;if(t.isShifted())return void t.moveIndexBy(0,!0);if(e.type.indexOf("cancel")>0)return;if("mouseup"===e.type||"mouse"===e.pointerType)return void this.tapHandler.click(this.startP1,e);const i=this.pswp.options.doubleTapAction?300:0;this._tapTimer?(this._clearTapTimer(),Gi(this._lastStartP1,this.startP1)<25&&this.tapHandler.doubleTap(this.startP1,e)):(Ui(this._lastStartP1,this.startP1),this._tapTimer=setTimeout((()=>{this.tapHandler.tap(this.startP1,e),this._clearTapTimer()}),i))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(e,t){const i=this.p1[e]-this._intervalP1[e];return Math.abs(i)>1&&t>5?i/t:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(e,t){this.pswp.applyFilters("preventPointerEvent",!0,e,t)&&e.preventDefault()}_updatePoints(e,t){if(this._pointerEventEnabled){const i=e,n=this._ongoingPointers.findIndex((e=>e.id===i.pointerId));"up"===t&&n>-1?this._ongoingPointers.splice(n,1):"down"===t&&-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&&Ui(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&Ui(this.p2,this._ongoingPointers[1])}else{const i=e;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(e,this.p1),"up"===t?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){Ui(this.prevP1,this.p1),Ui(this.prevP2,this.p2)}_updateStartPoints(){Ui(this.startP1,this.p1),Ui(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const e=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(0!==e){const t=e>0?"x":"y";Math.abs(this.p1[t]-this.startP1[t])>=10&&(this.dragAxis=t)}}}_convertEventPosToPoint(e,t){return t.x=e.pageX-this.pswp.offset.x,t.y=e.pageY-this.pswp.offset.y,"pointerId"in e?t.id=e.pointerId:void 0!==e.identifier&&(t.id=e.identifier),t}_onClick(e){this.pswp.mainScroll.isShifted()&&(e.preventDefault(),e.stopPropagation())}}class Cn{constructor(e){this.pswp=e,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(e){const{pswp:t}=this,i=Math.round(t.viewportSize.x+t.viewportSize.x*t.options.spacing),n=i!==this.slideWidth;n&&(this.slideWidth=i,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach(((t,i)=>{n&&Ji(t.el,(i+this._containerShiftIndex)*this.slideWidth),e&&t.slide&&t.slide.resize()}))}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let e=0;e<3;e++){const t=Wi("pswp__item","div",this.pswp.container);t.setAttribute("role","group"),t.setAttribute("aria-roledescription","slide"),t.setAttribute("aria-hidden","true"),t.style.display=1===e?"block":"none",this.itemHolders.push({el:t})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(e,t,i){const{pswp:n}=this;let s=n.potentialIndex+e;const o=n.getNumItems();if(n.canLoop()){s=n.getLoopedIndex(s);const t=(e+o)%o;e=t<=o/2?t:t-o}else s<0?s=0:s>=o&&(s=o-1),e=s-n.potentialIndex;n.potentialIndex=s,this._currPositionIndex-=e,n.animations.stopMainScroll();const r=this.getCurrSlideX();if(t){n.animations.startSpring({isMainScroll:!0,start:this.x,end:r,velocity:i||0,naturalFrequency:30,dampingRatio:1,onUpdate:e=>{this.moveTo(e)},onComplete:()=>{this.updateCurrItem(),n.appendHeavy()}});let e=n.potentialIndex-n.currIndex;if(n.canLoop()){const t=(e+o)%o;e=t<=o/2?t:t-o}Math.abs(e)>1&&this.updateCurrItem()}else this.moveTo(r),this.updateCurrItem();return Boolean(e)}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var e;const{pswp:t}=this,i=this._prevPositionIndex-this._currPositionIndex;if(!i)return;this._prevPositionIndex=this._currPositionIndex,t.currIndex=t.potentialIndex;let n,s=Math.abs(i);s>=3&&(this._containerShiftIndex+=i+(i>0?-3:3),s=3,this.itemHolders.forEach((e=>{var t;null===(t=e.slide)||void 0===t||t.destroy(),e.slide=void 0})));for(let e=0;e<s;e++)i>0?(n=this.itemHolders.shift(),n&&(this.itemHolders[2]=n,this._containerShiftIndex++,Ji(n.el,(this._containerShiftIndex+2)*this.slideWidth),t.setContent(n,t.currIndex-s+e+2))):(n=this.itemHolders.pop(),n&&(this.itemHolders.unshift(n),this._containerShiftIndex--,Ji(n.el,this._containerShiftIndex*this.slideWidth),t.setContent(n,t.currIndex+s-e-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),t.animations.stopAllPan(),this.itemHolders.forEach(((e,t)=>{e.slide&&e.slide.setIsActive(1===t)})),t.currSlide=null===(e=this.itemHolders[1])||void 0===e?void 0:e.slide,t.contentLoader.updateLazy(i),t.currSlide&&t.currSlide.applyCurrentZoomPan(),t.dispatch("change")}moveTo(e,t){if(!this.pswp.canLoop()&&t){let t=(this.slideWidth*this._currPositionIndex-e)/this.slideWidth;t+=this.pswp.currIndex;const i=Math.round(e-this.x);(t<0&&i>0||t>=this.pswp.getNumItems()-1&&i<0)&&(e=this.x+.35*i)}this.x=e,this.pswp.container&&Ji(this.pswp.container,e),this.pswp.dispatch("moveMainScroll",{x:e,dragging:null!=t&&t})}}const Sn={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},Bn=(e,t)=>t?e:Sn[e];class _n{constructor(e){this.pswp=e,this._wasFocused=!1,e.on("bindEvents",(()=>{e.options.trapFocus&&(e.options.initialPointerPos||this._focusRoot(),e.events.add(document,"focusin",this._onFocusIn.bind(this))),e.events.add(document,"keydown",this._onKeyDown.bind(this))}));const t=document.activeElement;e.on("destroy",(()=>{e.options.returnFocus&&t&&this._wasFocused&&t.focus()}))}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(e){const{pswp:t}=this;if(t.dispatch("keydown",{originalEvent:e}).defaultPrevented)return;if(function(e){return"button"in e&&1===e.button||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey}(e))return;let i,n,s=!1;const o="key"in e;switch(o?e.key:e.keyCode){case Bn("Escape",o):t.options.escKey&&(i="close");break;case Bn("z",o):i="toggleZoom";break;case Bn("ArrowLeft",o):n="x";break;case Bn("ArrowUp",o):n="y";break;case Bn("ArrowRight",o):n="x",s=!0;break;case Bn("ArrowDown",o):s=!0,n="y";break;case Bn("Tab",o):this._focusRoot()}if(n){e.preventDefault();const{currSlide:o}=t;t.options.arrowKeys&&"x"===n&&t.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&&(e.preventDefault(),t[i]())}_onFocusIn(e){const{template:t}=this.pswp;t&&document!==e.target&&t!==e.target&&!t.contains(e.target)&&t.focus()}}const An="cubic-bezier(.4,0,.22,1)";class Ln{constructor(e){var t;this.props=e;const{target:i,onComplete:n,transform:s,onFinish:o=()=>{},duration:r=333,easing:a=An}=e;this.onFinish=o;const l=s?"transform":"opacity",c=null!==(t=e[l])&&void 0!==t?t:"";this._target=i,this._onComplete=n,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout((()=>{tn(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(e){e.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),tn(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}class Tn{constructor(e,t,i){this.velocity=1e3*e,this._dampingRatio=t||.75,this._naturalFrequency=i||12,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(e,t){let i,n=0;t/=1e3;const s=Math.E**(-this._dampingRatio*this._naturalFrequency*t);if(1===this._dampingRatio)i=this.velocity+this._naturalFrequency*e,n=(e+i*t)*s,this.velocity=n*-this._naturalFrequency+i*s;else if(this._dampingRatio<1){i=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*e+this.velocity);const o=Math.cos(this._dampedFrequency*t),r=Math.sin(this._dampedFrequency*t);n=s*(e*o+i*r),this.velocity=n*-this._naturalFrequency*this._dampingRatio+s*(-this._dampedFrequency*e*r+this._dampedFrequency*i*o)}return n}}class En{constructor(e){this.props=e,this._raf=0;const{start:t,end:i,velocity:n,onUpdate:s,onComplete:o,onFinish:r=()=>{},dampingRatio:a,naturalFrequency:l}=e;this.onFinish=r;const c=new Tn(n,a,l);let d=Date.now(),h=t-i;const p=()=>{this._raf&&(h=c.easeFrame(h,Date.now()-d),Math.abs(h)<1&&Math.abs(c.velocity)<50?(s(i),o&&o(),this.onFinish()):(d=Date.now(),s(h+i),this._raf=requestAnimationFrame(p)))};this._raf=requestAnimationFrame(p)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class In{constructor(){this.activeAnimations=[]}startSpring(e){this._start(e,!0)}startTransition(e){this._start(e)}_start(e,t){const i=t?new En(e):new Ln(e);return this.activeAnimations.push(i),i.onFinish=()=>this.stop(i),i}stop(e){e.destroy();const t=this.activeAnimations.indexOf(e);t>-1&&this.activeAnimations.splice(t,1)}stopAll(){this.activeAnimations.forEach((e=>{e.destroy()})),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter((e=>!e.props.isPan||(e.destroy(),!1)))}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter((e=>!e.props.isMainScroll||(e.destroy(),!1)))}isPanRunning(){return this.activeAnimations.some((e=>e.props.isPan))}}class Mn{constructor(e){this.pswp=e,e.events.add(e.element,"wheel",this._onWheel.bind(this))}_onWheel(e){e.preventDefault();const{currSlide:t}=this.pswp;let{deltaX:i,deltaY:n}=e;if(t&&!this.pswp.dispatch("wheel",{originalEvent:e}).defaultPrevented)if(e.ctrlKey||this.pswp.options.wheelToZoom){if(t.isZoomable()){let i=-n;1===e.deltaMode?i*=.05:i*=e.deltaMode?1:.002,i=2**i;const s=t.currZoomLevel*i;t.zoomTo(s,{x:e.clientX,y:e.clientY})}}else t.isPannable()&&(1===e.deltaMode&&(i*=18,n*=18),t.panTo(t.pan.x-i,t.pan.y-n))}}class Pn{constructor(e,t){var i;const n=t.name||t.className;let s=t.html;if(!1===e.options[n])return;"string"==typeof e.options[n+"SVG"]&&(s=e.options[n+"SVG"]),e.dispatch("uiElementCreate",{data:t});let o="";t.isButton?(o+="pswp__button ",o+=t.className||`pswp__button--${t.name}`):o+=t.className||`pswp__${t.name}`;let r=t.isButton?t.tagName||"button":t.tagName||"div";r=r.toLowerCase();const a=Wi(o,r);if(t.isButton){"button"===r&&(a.type="button");let{title:i}=t;const{ariaLabel:s}=t;"string"==typeof e.options[n+"Title"]&&(i=e.options[n+"Title"]),i&&(a.title=i);const o=s||i;o&&a.setAttribute("aria-label",o)}a.innerHTML=function(e){if("string"==typeof e)return e;if(!e||!e.isCustomSVG)return"";const t=e;let i='<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';return i=i.split("%d").join(t.size||32),t.outlineID&&(i+='<use class="pswp__icn-shadow" xlink:href="#'+t.outlineID+'"/>'),i+=t.inner,i+="</svg>",i}(s),t.onInit&&t.onInit(a,e),t.onClick&&(a.onclick=i=>{"string"==typeof t.onClick?e[t.onClick]():"function"==typeof t.onClick&&t.onClick(i,a,e)});const l=t.appendTo||"bar";let c=e.element;"bar"===l?(e.topBar||(e.topBar=Wi("pswp__top-bar pswp__hide-on-close","div",e.scrollWrap)),c=e.topBar):(a.classList.add("pswp__hide-on-close"),"wrapper"===l&&(c=e.scrollWrap)),null===(i=c)||void 0===i||i.appendChild(e.applyFilters("uiElement",a,t))}}function Dn(e,t,i){e.classList.add("pswp__button--arrow"),e.setAttribute("aria-controls","pswp__items"),t.on("change",(()=>{t.options.loop||(e.disabled=i?!(t.currIndex<t.getNumItems()-1):!(t.currIndex>0))}))}const Zn={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:Dn},Nn={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:(e,t)=>{Dn(e,t,!0)}},On={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"},Hn={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"},zn={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:(e,t)=>{let i,n=null;const s=t=>{var n,s;i!==t&&(i=t,n="active",s=t,e.classList.toggle("pswp__preloader--"+n,s))},o=()=>{var e;if(null===(e=t.currSlide)||void 0===e||!e.content.isLoading())return s(!1),void(n&&(clearTimeout(n),n=null));n||(n=setTimeout((()=>{var e;s(Boolean(null===(e=t.currSlide)||void 0===e?void 0:e.content.isLoading())),n=null}),t.options.preloaderDelay))};t.on("change",o),t.on("loadComplete",(e=>{t.currSlide===e.slide&&o()})),t.ui&&(t.ui.updatePreloaderVisibility=o)}},$n={name:"counter",order:5,onInit:(e,t)=>{t.on("change",(()=>{e.innerText=t.currIndex+1+t.options.indexIndicatorSep+t.getNumItems()}))}};function Vn(e,t){e.classList.toggle("pswp--zoomed-in",t)}class Fn{constructor(e){this.pswp=e,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){const{pswp:e}=this;this.isRegistered=!1,this.uiElementsData=[On,Zn,Nn,Hn,zn,$n],e.dispatch("uiRegister"),this.uiElementsData.sort(((e,t)=>(e.order||0)-(t.order||0))),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach((e=>{this.registerElement(e)})),e.on("change",(()=>{var t;null===(t=e.element)||void 0===t||t.classList.toggle("pswp--one-slide",1===e.getNumItems())})),e.on("zoomPanUpdate",(()=>this._onZoomPanUpdate()))}registerElement(e){this.isRegistered?this.items.push(new Pn(this.pswp,e)):this.uiElementsData.push(e)}_onZoomPanUpdate(){const{template:e,currSlide:t,options:i}=this.pswp;if(this.pswp.opener.isClosing||!e||!t)return;let{currZoomLevel:n}=t;if(this.pswp.opener.isOpen||(n=t.zoomLevels.initial),n===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=n;const s=t.zoomLevels.initial-t.zoomLevels.secondary;if(Math.abs(s)<.01||!t.isZoomable())return Vn(e,!1),void e.classList.remove("pswp--zoom-allowed");e.classList.add("pswp--zoom-allowed");Vn(e,(n===t.zoomLevels.initial?t.zoomLevels.secondary:t.zoomLevels.initial)<=n),"zoom"!==i.imageClickAction&&"zoom-or-close"!==i.imageClickAction||e.classList.add("pswp--click-to-zoom")}}class Rn{constructor(e,t){this.type=e,this.defaultPrevented=!1,t&&Object.assign(this,t)}preventDefault(){this.defaultPrevented=!0}}class jn{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(e,t,i=100){var n,s,o;this._filters[e]||(this._filters[e]=[]),null===(n=this._filters[e])||void 0===n||n.push({fn:t,priority:i}),null===(s=this._filters[e])||void 0===s||s.sort(((e,t)=>e.priority-t.priority)),null===(o=this.pswp)||void 0===o||o.addFilter(e,t,i)}removeFilter(e,t){this._filters[e]&&(this._filters[e]=this._filters[e].filter((e=>e.fn!==t))),this.pswp&&this.pswp.removeFilter(e,t)}applyFilters(e,...t){var i;return null===(i=this._filters[e])||void 0===i||i.forEach((e=>{t[0]=e.fn.apply(this,t)})),t[0]}on(e,t){var i,n;this._listeners[e]||(this._listeners[e]=[]),null===(i=this._listeners[e])||void 0===i||i.push(t),null===(n=this.pswp)||void 0===n||n.on(e,t)}off(e,t){var i;this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter((e=>t!==e))),null===(i=this.pswp)||void 0===i||i.off(e,t)}dispatch(e,t){var i;if(this.pswp)return this.pswp.dispatch(e,t);const n=new Rn(e,t);return null===(i=this._listeners[e])||void 0===i||i.forEach((e=>{e.call(this,n)})),n}}class qn{constructor(e,t){if(this.element=Wi("pswp__img pswp__img--placeholder",e?"img":"div",t),e){const t=this.element;t.decoding="async",t.alt="",t.src=e,t.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(e,t){this.element&&("IMG"===this.element.tagName?(nn(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=Yi(0,0,e/250)):nn(this.element,e,t))}destroy(){var e;null!==(e=this.element)&&void 0!==e&&e.parentNode&&this.element.remove(),this.element=null}}class Wn{constructor(e,t,i){this.instance=t,this.data=e,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=sn,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(e,t){if(this.slide&&this.usePlaceholder())if(this.placeholder){const e=this.placeholder.element;e&&!e.parentElement&&this.slide.container.prepend(e)}else{const e=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new qn(e,this.slide.container)}this.element&&!t||this.instance.dispatch("contentLoad",{content:this,isLazy:e}).defaultPrevented||(this.isImageContent()?(this.element=Wi("pswp__img","img"),this.displayedImageWidth&&this.loadImage(e)):(this.element=Wi("pswp__content","div"),this.element.innerHTML=this.data.html||""),t&&this.slide&&this.slide.updateContentSize(!0))}loadImage(e){var t,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:e}).defaultPrevented)return;const n=this.element;this.updateSrcsetSizes(),this.data.srcset&&(n.srcset=this.data.srcset),n.src=null!==(t=this.data.src)&&void 0!==t?t:"",n.alt=null!==(i=this.data.alt)&&void 0!==i?i:"",this.state=on,n.complete?this.onLoaded():(n.onload=()=>{this.onLoaded()},n.onerror=()=>{this.onError()})}setSlide(e){this.slide=e,this.hasSlide=!0,this.instance=e.pswp}onLoaded(){this.state=rn,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!==rn&&this.state!==an||this.removePlaceholder())}onError(){this.state=an,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===on,this)}isError(){return this.state===an}isImageContent(){return"image"===this.type}setDisplayedSize(e,t){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(e,t),!this.instance.dispatch("contentResize",{content:this,width:e,height:t}).defaultPrevented&&(nn(this.element,e,t),this.isImageContent()&&!this.isError()))){const i=!this.displayedImageWidth&&e;this.displayedImageWidth=e,this.displayedImageHeight=t,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:e,height:t,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==an,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const e=this.element,t=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!e.dataset.largestUsedSize||t>parseInt(e.dataset.largestUsedSize,10))&&(e.sizes=t+"px",e.dataset.largestUsedSize=String(t))}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 e,t;let i=Wi("pswp__error-msg","div");i.innerText=null!==(e=null===(t=this.instance.options)||void 0===t?void 0:t.errorMsg)&&void 0!==e?e:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=Wi("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===an)return void this.displayError();if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const e="decode"in this.element;this.isImageContent()?e&&this.slide&&(!this.slide.isActive||ln())?(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&&!ln()?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!==rn&&this.state!==an||this.removePlaceholder()))}}function Un(e,t,i){const n=t.createContentFromData(e,i);let s;const{options:o}=t;if(o){let r;s=new gn(o,e,-1),r=t.pswp?t.pswp.viewportSize:hn(o,t);const a=un(o,r,e,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 Kn{constructor(e){this.pswp=e,this.limit=Math.max(e.options.preload[0]+e.options.preload[1]+1,5),this._cachedItems=[]}updateLazy(e){const{pswp:t}=this;if(t.dispatch("lazyLoad").defaultPrevented)return;const{preload:i}=t.options,n=void 0===e||e>=0;let s;for(s=0;s<=i[1];s++)this.loadSlideByIndex(t.currIndex+(n?s:-s));for(s=1;s<=i[0];s++)this.loadSlideByIndex(t.currIndex+(n?-s:s))}loadSlideByIndex(e){const t=this.pswp.getLoopedIndex(e);let i=this.getContentByIndex(t);i||(i=function(e,t){const i=t.getItemData(e);if(!t.dispatch("lazyLoadSlide",{index:e,itemData:i}).defaultPrevented)return Un(i,t,e)}(t,this.pswp),i&&this.addToCache(i))}getContentBySlide(e){let t=this.getContentByIndex(e.index);return t||(t=this.pswp.createContentFromData(e.data,e.index),this.addToCache(t)),t.setSlide(e),t}addToCache(e){if(this.removeByIndex(e.index),this._cachedItems.push(e),this._cachedItems.length>this.limit){const e=this._cachedItems.findIndex((e=>!e.isAttached&&!e.hasSlide));if(-1!==e){this._cachedItems.splice(e,1)[0].destroy()}}}removeByIndex(e){const t=this._cachedItems.findIndex((t=>t.index===e));-1!==t&&this._cachedItems.splice(t,1)}getContentByIndex(e){return this._cachedItems.find((t=>t.index===e))}destroy(){this._cachedItems.forEach((e=>e.destroy())),this._cachedItems=[]}}class Gn extends jn{getNumItems(){var e;let t=0;const i=null===(e=this.options)||void 0===e?void 0:e.dataSource;i&&"length"in i?t=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(t=i.items.length));const n=this.dispatch("numItems",{dataSource:i,numItems:t});return this.applyFilters("numItems",n.numItems,i)}createContentFromData(e,t){return new Wn(e,this,t)}getItemData(e){var t;const i=null===(t=this.options)||void 0===t?void 0:t.dataSource;let n={};Array.isArray(i)?n=i[e]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),n=i.items[e]);let s=n;s instanceof Element&&(s=this._domElementToItemData(s));const o=this.dispatch("itemData",{itemData:s||{},index:e});return this.applyFilters("itemData",o.itemData,e)}_getGalleryDOMElements(e){var t,i;return null!==(t=this.options)&&void 0!==t&&t.children||null!==(i=this.options)&&void 0!==i&&i.childSelector?function(e,t,i=document){let n=[];if(e instanceof Element)n=[e];else if(e instanceof NodeList||Array.isArray(e))n=Array.from(e);else{const s="string"==typeof e?e:t;s&&(n=Array.from(i.querySelectorAll(s)))}return n}(this.options.children,this.options.childSelector,e)||[]:[e]}_domElementToItemData(e){const t={element:e},i="A"===e.tagName?e:e.querySelector("a");if(i){t.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(t.srcset=i.dataset.pswpSrcset),t.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,t.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,t.w=t.width,t.h=t.height,i.dataset.pswpType&&(t.type=i.dataset.pswpType);const s=e.querySelector("img");var n;if(s)t.msrc=s.currentSrc||s.src,t.alt=null!==(n=s.getAttribute("alt"))&&void 0!==n?n:"";(i.dataset.pswpCropped||i.dataset.cropped)&&(t.thumbCropped=!0)}return this.applyFilters("domItemData",t,e,i)}lazyLoadData(e,t){return Un(e,this,t)}}const Xn=.003;class Qn{constructor(e){this.pswp=e,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),e.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;const e=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,e&&e.currZoomLevel*e.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 e=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,e&&e.zoomLevels.initial*e.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){const{pswp:e}=this,t=this.pswp.currSlide,{options:i}=e;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&&e._initialThumbBounds?this._thumbBounds=e._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=null==t?void 0:t.getPlaceholderElement(),e.animations.stopAll(),this._useAnimation=Boolean(this._duration&&this._duration>50),this._animateZoom=Boolean(this._thumbBounds)&&(null==t?void 0:t.content.usePlaceholder())&&(!this.isClosing||!e.mainScroll.isShifted()),this._animateZoom)?this._animateRootOpacity=null!==(n=i.showHideOpacity)&&void 0!==n&&n:(this._animateRootOpacity=!0,this.isOpening&&t&&(t.zoomAndPanToInitial(),t.applyCurrentZoomPan()));if(this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>Xn,this._opacityElement=this._animateRootOpacity?e.element:e.bg,!this._useAnimation)return this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,void(this.isOpening&&(e.element&&(e.element.style.opacity=String(Xn)),e.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,e.container&&(e.container.style.overflow="hidden",e.container.style.width=e.viewportSize.x+"px")):this._croppedZoom=!1;this.isOpening?(this._animateRootOpacity?(e.element&&(e.element.style.opacity=String(Xn)),e.applyBgOpacity(1)):(this._animateBgOpacity&&e.bg&&(e.bg.style.opacity=String(Xn)),e.element&&(e.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(Xn)))):this.isClosing&&(e.mainScroll.itemHolders[0]&&(e.mainScroll.itemHolders[0].el.style.display="none"),e.mainScroll.itemHolders[2]&&(e.mainScroll.itemHolders[2].el.style.display="none"),this._croppedZoom&&0!==e.mainScroll.x&&(e.mainScroll.resetPosition(),e.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&"IMG"===this._placeholder.tagName?new Promise((e=>{let t=!1,i=!0;var n;(n=this._placeholder,"decode"in n?n.decode().catch((()=>{})):n.complete?Promise.resolve(n):new Promise(((e,t)=>{n.onload=()=>e(n),n.onerror=t}))).finally((()=>{t=!0,i||e(!0)})),setTimeout((()=>{i=!1,t&&e(!0)}),50),setTimeout(e,250)})).finally((()=>this._initiate())):this._initiate()}_initiate(){var e,t;null===(e=this.pswp.element)||void 0===e||e.style.setProperty("--pswp-transition-duration",this._duration+"ms"),this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),null===(t=this.pswp.element)||void 0===t||t.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:e}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,e.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd"),e.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed)e.destroy();else if(this.isOpen){var t;this._animateZoom&&e.container&&(e.container.style.overflow="visible",e.container.style.width="100%"),null===(t=e.currSlide)||void 0===t||t.applyCurrentZoomPan()}}_animateToOpenState(){const{pswp:e}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)"),this._animateTo(this._cropContainer2,"transform","none")),e.currSlide&&(e.currSlide.zoomAndPanToInitial(),this._animateTo(e.currSlide.container,"transform",e.currSlide.getCurrentTransform()))),this._animateBgOpacity&&e.bg&&this._animateTo(e.bg,"opacity",String(e.options.bgOpacity)),this._animateRootOpacity&&e.element&&this._animateTo(e.element,"opacity","1")}_animateToClosedState(){const{pswp:e}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&e.bgOpacity>.01&&e.bg&&this._animateTo(e.bg,"opacity","0"),this._animateRootOpacity&&e.element&&this._animateTo(e.element,"opacity","0")}_setClosedStateZoomPan(e){if(!this._thumbBounds)return;const{pswp:t}=this,{innerRect:i}=this._thumbBounds,{currSlide:n,viewportSize:s}=t;if(this._croppedZoom&&i&&this._cropContainer1&&this._cropContainer2){const t=-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;e?(this._animateTo(this._cropContainer1,"transform",Yi(t,n)),this._animateTo(this._cropContainer2,"transform",Yi(o,r))):(Ji(this._cropContainer1,t,n),Ji(this._cropContainer2,o,r))}n&&(Ui(n.pan,i||this._thumbBounds),n.currZoomLevel=this._thumbBounds.w/n.width,e?this._animateTo(n.container,"transform",n.getCurrentTransform()):n.applyCurrentZoomPan())}_animateTo(e,t,i){if(!this._duration)return void(e.style[t]=i);const{animations:n}=this.pswp,s={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{n.activeAnimations.length||this._onAnimationComplete()},target:e};s[t]=i,n.startTransition(s)}}const Yn={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 Jn extends Gn{constructor(e){super(),this.options=this._prepareOptions(e||{}),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 dn,this.animations=new In,this.mainScroll=new Cn(this),this.gestures=new kn(this),this.opener=new Qn(this),this.keyboard=new _n(this),this.contentLoader=new Kn(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch("init"),this.dispatch("beforeOpen"),this._createMainStructure();let e="pswp--open";return this.gestures.supportsTouch&&(e+=" pswp--touch"),this.options.mainClass&&(e+=" "+this.options.mainClass),this.element&&(this.element.className+=" "+e),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new Mn(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:e}=this.mainScroll;e[0]&&(e[0].el.style.display="block",this.setContent(e[0],this.currIndex-1)),e[2]&&(e[2].el.style.display="block",this.setContent(e[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(e){const t=this.getNumItems();return this.options.loop&&(e>t-1&&(e-=t),e<0&&(e+=t)),Qi(e,0,t-1)}appendHeavy(){this.mainScroll.itemHolders.forEach((e=>{var t;null===(t=e.slide)||void 0===t||t.appendHeavy()}))}goTo(e){this.mainScroll.moveIndexBy(this.getLoopedIndex(e)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...e){var t;null===(t=this.currSlide)||void 0===t||t.zoomTo(...e)}toggleZoom(){var e;null===(e=this.currSlide)||void 0===e||e.toggleZoom()}close(){this.opener.isOpen&&!this.isDestroying&&(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){var e;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===(e=this.element)||void 0===e||e.remove(),this.mainScroll.itemHolders.forEach((e=>{var t;null===(t=e.slide)||void 0===t||t.destroy()})),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(e){this.contentLoader.removeByIndex(e),this.mainScroll.itemHolders.forEach(((t,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===e)&&(this.setContent(t,e,!0),1===i&&(this.currSlide=t.slide,null===(r=t.slide)||void 0===r||r.setIsActive(!0)))})),this.dispatch("change")}setContent(e,t,i){if(this.canLoop()&&(t=this.getLoopedIndex(t)),e.slide){if(e.slide.index===t&&!i)return;e.slide.destroy(),e.slide=void 0}if(!this.canLoop()&&(t<0||t>=this.getNumItems()))return;const n=this.getItemData(t);e.slide=new fn(n,t,this),t===this.currIndex&&(this.currSlide=e.slide),e.slide.append(e.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(e){if(this.isDestroying)return;const t=hn(this.options,this);!e&&Xi(t,this._prevViewportSize)||(Ui(this._prevViewportSize,t),this.dispatch("beforeResize"),Ui(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(e){this.bgOpacity=Math.max(e,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){var e;this.hasMouse||(this.hasMouse=!0,null===(e=this.element)||void 0===e||e.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(e,t){this.offset.x=e,this.offset.y=t,this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=Wi("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=Wi("pswp__bg","div",this.element),this.scrollWrap=Wi("pswp__scroll-wrap","section",this.element),this.container=Wi("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 Fn(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return function(e,t,i){const n=i.dispatch("thumbBounds",{index:e,itemData:t,instance:i});if(n.thumbBounds)return n.thumbBounds;const{element:s}=t;let o,r;if(s&&!1!==i.options.thumbSelector){const e=i.options.thumbSelector||"img";r=s.matches(e)?s:s.querySelector(e)}return r=i.applyFilters("thumbEl",r,t,e),r&&(o=t.thumbCropped?function(e,t,i){const n=e.getBoundingClientRect(),s=n.width/t,o=n.height/i,r=s>o?s:o,a=(n.width-t*r)/2,l=(n.height-i*r)/2,c={x:n.left+a,y:n.top+l,w:t*r};return c.innerRect={w:n.width,h:n.height,x:a,y:l},c}(r,t.width||t.w||0,t.height||t.h||0):function(e){const t=e.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width}}(r)),i.applyFilters("thumbBounds",o,t,e)}(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(e){return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(e.showHideAnimationType="none",e.zoomAnimationDuration=0),{...Yn,...e}}}class es{constructor(e){this.config=e,this.root=e.root,this.box=e.box}bindEvents(e){const t=this.box,i=t.getContainer(),n=e.closest(".lake-resizer").find(".lake-resizer-info"),s=e.attr("class").indexOf("-right")>=0,o=i.width(),r=i.height()/o;let a=0,l=0;const c=e=>{const t=e.clientX-a,o=Math.round(s?l+t:l-t),c=Math.round(r*o);n.text(`${o} x ${c}`),i.css({width:`${o}px`,height:`${c}px`}),this.config.onResize&&this.config.onResize(o,c)};e.on("pointerdown",(t=>{const s=t,o=e.get(0);try{o.setPointerCapture(s.pointerId)}catch(e){}a=s.clientX,l=i.width(),n.show(),e.on("pointermove",c)})),e.on("pointerup",(()=>{e.off("pointermove"),n.hide(),l=t.getContainer().width();const i=Math.round(r*l);this.config.onStop(l,i)})),e.on("pointercancel",(()=>{e.off("pointermove"),n.hide()}))}render(){const{width:e,height:t}=this.config,i=I(a`
|
|
28
28
|
<div class="lake-resizer">
|
|
29
29
|
<div class="lake-resizer-top-left"></div>
|
|
30
30
|
<div class="lake-resizer-top-right"></div>
|