polotno 2.8.2 → 2.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.TextElement=exports.usePrevious=exports.getLineHeight=exports.useFontLoader=exports.getDir=exports.isRTLText=void 0;const react_1=__importDefault(require("react")),mobx_react_lite_1=require("mobx-react-lite"),react_konva_1=require("react-konva"),react_konva_utils_1=require("react-konva-utils"),mobx_1=require("mobx"),konva_1=__importDefault(require("konva")),svg_round_corners_1=require("svg-round-corners"),use_color_1=require("./use-color"),loader_1=require("../utils/loader"),fonts_1=require("../utils/fonts"),flags_1=require("../utils/flags"),text_1=require("../utils/text"),apply_filters_1=require("./apply-filters"),use_fadein_1=require("./use-fadein"),highlighter_1=require("./highlighter"),screen_1=require("../utils/screen"),mobx_state_tree_1=require("mobx-state-tree");konva_1.default._fixTextRendering=!0;const styleNode=document.createElement("style");styleNode.type="text/css",document.head.appendChild(styleNode);const initialStyles={border:"none",padding:"0px",overflow:"hidden",background:"none",outline:"none",resize:"none",overflowWrap:"break-word",whiteSpace:"pre-wrap",userSelect:"text",wordBreak:"normal"};function isRTL(e){var t="֑-߿‏‫‮יִ-﷽ﹰ-ﻼ";return new RegExp("^[^"+t+"]*?["+t+"]").test(e)}function isRTLText(e){e=e.replace(/\s/g,"");let t=0;for(var r=0;r<e.length;r++){isRTL(e[r])&&(t+=1)}return t>e.length/2}function getDir(e){return isRTLText(e)?"rtl":"ltr"}exports.isRTLText=isRTLText,exports.getDir=getDir;const TextInput=(0,mobx_react_lite_1.observer)((({textNodeRef:e,element:t,onBlur:r,selectAll:n,cursorPosition:i})=>{const[o,a]=react_1.default.useState(initialStyles),l=e.current;react_1.default.useLayoutEffect((()=>{const e={};e.width=l.width()-2*l.padding()+"px",e.height=l.height()-2*l.padding()+l.fontSize()*l.lineHeight()+"px",e.fontSize=l.fontSize()+"px",e.lineHeight=l.lineHeight()+.01,e.fontFamily=l.fontFamily(),e.textAlign=l.align(),e.color=l.fill(),e.fontWeight=t.fontWeight,e.fontStyle=t.fontStyle,e.letterSpacing=t.letterSpacing+"em";const r=`\n .polotno-input::placeholder {\n color: ${o.color};\n opacity: 0.6;\n }\n `;styleNode.innerHTML="",styleNode.appendChild(document.createTextNode(r)),JSON.stringify(e)!==JSON.stringify(o)&&a(e)}));const s=react_1.default.useRef(null);react_1.default.useEffect((()=>{const e=setTimeout((()=>{var e;const t=s.current;if(!t)return;null===(e=s.current)||void 0===e||e.focus();const r=i||t.value.length;t.selectionStart=t.selectionEnd=r,n&&(null==t||t.select(),document.execCommand("selectAll",!1,null))}));return()=>{clearTimeout(e)}}),[]),react_1.default.useEffect((()=>{window.addEventListener("blur",r);const e=e=>{var t;(null===(t=s.current)||void 0===t?void 0:t.contains(e.target))||r()};return window.addEventListener("touchstart",e),()=>{window.removeEventListener("blur",r),window.removeEventListener("touchstart",e)}}),[]);let d=0;const c=l.textArr.length*l.lineHeight()*l.fontSize();"middle"===t.verticalAlign&&(d=(t.a.height-c)/2),"bottom"===t.verticalAlign&&(d=t.a.height-c);const u=(0,text_1.removeTags)(t.text);return react_1.default.createElement(react_konva_utils_1.Html,null,react_1.default.createElement("textarea",{className:"polotno-input",ref:s,dir:getDir(u),style:Object.assign(Object.assign(Object.assign({},initialStyles),o),{paddingTop:d+"px"}),value:u,onChange:e=>{t.set({text:e.target.value})},placeholder:t.placeholder,onBlur:r}))})),useEditor=e=>{const[t,r]=react_1.default.useState(!1),n=react_1.default.useRef(!1);return react_1.default.useEffect((()=>{var t=!0;return setTimeout((()=>{t&&(e._editModeEnabled&&(n.current=!0),r(!0),setTimeout((()=>{n.current=!1}),50))}),50),()=>{t=!1}}),[]),{editorEnabled:t&&e._editModeEnabled,selectAll:n.current}},useFontLoader=(e,t)=>{const[r,n]=react_1.default.useReducer((e=>e+1),0),i=react_1.default.useRef((0,fonts_1.isFontLoaded)(t));return react_1.default.useLayoutEffect((()=>{if(i.current=(0,fonts_1.isFontLoaded)(t),i.current)return;let r=!0;return(async()=>{i.current=!1,n();const o=(0,loader_1.incrementLoader)(`text ${t}`);await e.loadFont(t),setTimeout(o,100),r&&(i.current=!0,n())})(),()=>{r=!1}}),[t]),[i.current]};exports.useFontLoader=useFontLoader;const getLineHeight=({fontLoaded:e,fontFamily:t,fontSize:r,lineHeight:n})=>react_1.default.useMemo((()=>{if("number"==typeof n)return n;const e=document.createElement("div");e.style.fontFamily=t,e.style.fontSize=r+"px",e.style.lineHeight=n,e.innerText="Test text",document.body.appendChild(e);const i=e.offsetHeight;return document.body.removeChild(e),i/r}),[e,t,r,n]);function getRelativePointerPosition(e){var t=e.getAbsoluteTransform().copy();t.invert();var r=e.getStage().getPointerPosition();return t.point(r)}function getCursorPosition(e){var t;const r=e.target,n=getRelativePointerPosition(r),i=r.textArr,o=Math.floor(n.y/(r.fontSize()*r.lineHeight())),a=i.slice(0,o).reduce(((e,t)=>e+t.text.length),o),l=null!==(t=i[o])&&void 0!==t?t:i[0];let s=0;"right"===r.align()?s=r.width()-l.width:"center"===r.align()&&(s=r.width()/2-l.width/2);return a+Math.round((n.x-s)/l.width*l.text.length)}function usePrevious(e){const t=react_1.default.useRef(e),r=react_1.default.useRef(e);return react_1.default.useMemo((()=>{r.current=t.current,t.current=e}),[e]),r.current}function findFitFontSize(e,t){const r=e.fontSize(),n=e.height(),i=(0,text_1.removeTags)(t.text);let o=t.a.fontSize;e.height(void 0);const a=Math.round(2*t.a.fontSize)-1;for(let r=1;r<a;r++){const r=t.a.height&&e.height()>t.a.height,n=i.split("\n").join(" ").split(/[\s-]+/);let a=e.textArr.map((e=>e.text)).join(";");const l=n.find((e=>!a.includes(e)||(a=a.replace(e,""),!1)));if(!(r||l))break;o-=.5,e.fontSize(o)}return e.fontSize(r),e.height(n),o}function generateBackgroundShape({lines:e,lineHeight:t,width:r,align:n="left",padding:i=0,cornerRadius:o=0}){var a;e.forEach(((e,t)=>{e.cx=r/2,"right"===n?e.cx=r-e.width/2:"left"===n&&(e.cx=e.width/2),"justify"!==n||e.lastInParagraph||(e.width=r),"justify"===n&&(e.cx=e.width/2)}));let l=`M ${null===(a=e[0])||void 0===a?void 0:a.cx} ${-i}`;e.forEach(((r,n)=>{const{cx:o}=r,a=e[n-1];a&&a.width>r.width?l+=` L ${o+r.width/2+i} ${n*t+i}`:l+=` L ${o+r.width/2+i} ${n*t-i}`;const s=e[n+1];s&&s.width>r.width?l+=` L ${o+r.width/2+i} ${(n+1)*t-i}`:l+=` L ${o+r.width/2+i} ${(n+1)*t+i}`}));for(var s=e.length-1;s>=0;s--){const r=e[s],{cx:n}=r,o=e[s+1];o&&o.width>r.width?l+=` L ${n-r.width/2-i} ${(s+1)*t-i}`:l+=` L ${n-r.width/2-i} ${(s+1)*t+i}`;const a=e[s-1];a&&a.width>r.width?l+=` L ${n-r.width/2-i} ${s*t+i}`:l+=` L ${n-r.width/2-i} ${s*t-i}`}l+=" Z";const d=(0,svg_round_corners_1.parsePath)(l);return(0,svg_round_corners_1.roundCommands)(d,o).path}exports.getLineHeight=getLineHeight,exports.usePrevious=usePrevious,exports.TextElement=(0,mobx_react_lite_1.observer)((({element:e,store:t})=>{const r=react_1.default.useRef(null),n=react_1.default.useRef(null),{editorEnabled:i,selectAll:o}=useEditor(e),[a,l]=react_1.default.useState(!1),[s,d]=react_1.default.useState(!1),c=react_1.default.useRef(e.a.height),u=t.selectedElements.indexOf(e)>=0,{textVerticalResizeEnabled:f}=flags_1.flags,h=usePrevious(e.fontFamily),[g,_]=react_1.default.useState([]);react_1.default.useEffect((()=>{var e,t;const n=null!==(t=null===(e=r.current)||void 0===e?void 0:e.textArr)&&void 0!==t?t:[];JSON.stringify(n)!==JSON.stringify(g)&&_(n)})),react_1.default.useEffect((()=>{if(e.a.width)return;const t=r.current;t.width(600),e.set({width:1.4*t.getTextWidth()})}),[]),react_1.default.useLayoutEffect((()=>(0,mobx_1.autorun)((()=>{const t=r.current;(0,apply_filters_1.applyFilter)(t,e)}))));const[x]=(0,exports.useFontLoader)(t,e.fontFamily),p=(0,text_1.removeTags)(e.text),v=()=>{const e=r.current.clone({height:void 0}),t=Math.ceil(e.fontSize()*e.lineHeight()*e.textArr.length+1);return e.destroy(),t};react_1.default.useLayoutEffect((()=>{if(!x)return;const{textOverflow:n}=flags_1.flags;if(e.a.height)if("change-font-size"!==n||s||t.isPlaying){if("resize"===n){const n=v();f&&e.a.height<n&&t.history.ignore((()=>{var t;(0,mobx_state_tree_1.isAlive)(e)&&e.set({height:n}),null===(t=r.current)||void 0===t||t.height(n)}),!1,!0),f||e.a.height===n||t.history.ignore((()=>{var t;(0,mobx_state_tree_1.isAlive)(e)&&e.set({height:n}),null===(t=r.current)||void 0===t||t.height(n)}),!1,!0)}}else{const n=findFitFontSize(r.current,e);if(n!==e.a.fontSize)return void t.history.ignore((()=>{e.set({fontSize:n})}),!1,!0);const i=v();e.a.height===i||f||t.history.ignore((()=>{e.set({height:i})}),!1,!0)}else{const r=v();t.history.ignore((()=>{e.set({height:r})}),!1,!0)}})),react_1.default.useLayoutEffect((()=>{const t=r.current;t&&(t.width(t.width()+1e-8),t._setTextData(),(0,apply_filters_1.applyFilter)(t,e))}),[x]);const m=react_1.default.useRef(null),y=react_1.default.useRef(0),w=r=>{r.evt.preventDefault();const n=t.selectedShapes.find((t=>t===e));n&&e.contentEditable&&(y.current=getCursorPosition(r),e.toggleEditMode())},S=!p&&e.placeholder?.6:e.a.opacity;(0,use_fadein_1.useFadeIn)(r,S);const b=(0,exports.getLineHeight)({fontLoaded:x,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),E=e.selectable||"admin"===t.role,L=(0,use_color_1.useColor)(e),T=react_1.default.useMemo((()=>e.backgroundEnabled?generateBackgroundShape({lines:JSON.parse(JSON.stringify(g)),cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*b*.5),lineHeight:b*e.a.fontSize,padding:e.backgroundPadding*(e.a.fontSize*b*.5),width:e.a.width,align:e.align}):""),[e.backgroundEnabled,e.backgroundCornerRadius,e.a.fontSize,b,e.backgroundPadding,e.a.width,e.align,g]),z=(0,screen_1.useMobile)();let k=0;return"middle"===e.verticalAlign?k=(e.a.height-g.length*b*e.a.fontSize)/2:"bottom"===e.verticalAlign&&(k=e.a.height-g.length*b*e.a.fontSize),react_1.default.createElement(react_1.default.Fragment,null,react_1.default.createElement(react_konva_1.Path,{ref:n,x:e.a.x,y:e.a.y,rotation:e.a.rotation,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity,data:T,fill:e.backgroundColor,offsetY:-k}),react_1.default.createElement(react_konva_1.Text,Object.assign({ref:r,id:e.id,name:"element",hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,text:p||e.placeholder},L,{stroke:e.stroke,lineJoin:"round",strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:`"${e.fontFamily}", "${h}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:z?e.draggable&&u:e.draggable,preventDefault:!z||u,opacity:S,visible:!e._editModeEnabled,ellipsis:"ellipsis"===flags_1.flags.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:b,letterSpacing:e.letterSpacing*e.a.fontSize,listening:E,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},onClick:w,onTap:w,onTransformStart:()=>{d(!0),c.current=r.current.height()},onTransform:t=>{var r,i;const o=t.target;null===(r=n.current)||void 0===r||r.setAttrs({x:o.x(),y:o.y(),rotation:o.rotation(),scale:o.scale()});const a=(null===(i=o.getStage())||void 0===i?void 0:i.findOne("Transformer")).getActiveAnchor();if("middle-left"===a||"middle-right"===a){const t=o.scaleX(),r=o.width()*t,n=e.a.fontSize;let i=r;r<n&&(i=n,m.current&&o.position(m.current)),o.width(i),o.scaleX(1),o.scaleY(1);const a=v();if("ellipsis"!==flags_1.flags.textOverflow){const t=Math.max(a,c.current);o.height(t),e.set({height:o.height()})}e.set({x:o.x(),y:o.y(),width:o.width(),rotation:o.rotation()}),(0,apply_filters_1.applyFilter)(o,e)}if("top-center"===a||"bottom-center"===a){let r="resize"===flags_1.flags.textOverflow?v():b*e.a.fontSize;t.target.height(Math.max(r,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}m.current=t.target.position()},onTransformEnd:t=>{var r;const i=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:Math.round(e.a.fontSize*i),width:Math.ceil(t.target.width()*i),x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*i,shadowBlur:e.shadowBlur*i,shadowOffsetX:e.shadowOffsetX*i,shadowOffsetY:e.shadowOffsetY*i,strokeWidth:e.strokeWidth*i}),null===(r=n.current)||void 0===r||r.setAttrs({scaleX:1,scaleY:1}),d(!1)}})),i&&react_1.default.createElement(react_konva_1.Group,{x:e.a.x,y:e.a.y,rotation:e.a.rotation},react_1.default.createElement(TextInput,{textNodeRef:r,element:e,selectAll:o,cursorPosition:y.current,onBlur:()=>{e.toggleEditMode(!1)}})),!s&&(a||u)&&react_1.default.createElement(highlighter_1.Highlighter,{element:e}))}));
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.TextElement=exports.usePrevious=exports.getLineHeight=exports.useFontLoader=exports.getDir=exports.isRTLText=void 0;const react_1=__importDefault(require("react")),mobx_react_lite_1=require("mobx-react-lite"),react_konva_1=require("react-konva"),react_konva_utils_1=require("react-konva-utils"),mobx_1=require("mobx"),konva_1=__importDefault(require("konva")),svg_round_corners_1=require("svg-round-corners"),use_color_1=require("./use-color"),loader_1=require("../utils/loader"),fonts_1=require("../utils/fonts"),flags_1=require("../utils/flags"),text_1=require("../utils/text"),apply_filters_1=require("./apply-filters"),use_fadein_1=require("./use-fadein"),highlighter_1=require("./highlighter"),screen_1=require("../utils/screen"),mobx_state_tree_1=require("mobx-state-tree");konva_1.default._fixTextRendering=!0;const styleNode=document.createElement("style");styleNode.type="text/css",document.head.appendChild(styleNode);const initialStyles={border:"none",padding:"0px",overflow:"hidden",background:"none",outline:"none",resize:"none",overflowWrap:"break-word",whiteSpace:"pre-wrap",userSelect:"text",wordBreak:"normal"};function isRTL(e){var t="֑-߿‏‫‮יִ-﷽ﹰ-ﻼ";return new RegExp("^[^"+t+"]*?["+t+"]").test(e)}function isRTLText(e){e=e.replace(/\s/g,"");let t=0;for(var r=0;r<e.length;r++){isRTL(e[r])&&(t+=1)}return t>e.length/2}function getDir(e){return isRTLText(e)?"rtl":"ltr"}exports.isRTLText=isRTLText,exports.getDir=getDir;const TextInput=(0,mobx_react_lite_1.observer)((({textNodeRef:e,element:t,onBlur:r,selectAll:n,cursorPosition:i})=>{const[o,a]=react_1.default.useState(initialStyles),l=e.current;react_1.default.useLayoutEffect((()=>{const e={};e.width=l.width()-2*l.padding()+"px",e.height=l.height()-2*l.padding()+l.fontSize()*l.lineHeight()+"px",e.fontSize=l.fontSize()+"px",e.lineHeight=l.lineHeight()+.01,e.fontFamily=l.fontFamily(),e.textAlign=l.align(),e.color=l.fill(),e.fontWeight=t.fontWeight,e.fontStyle=t.fontStyle,e.letterSpacing=t.letterSpacing+"em";const r=`\n .polotno-input::placeholder {\n color: ${o.color};\n opacity: 0.6;\n }\n `;styleNode.innerHTML="",styleNode.appendChild(document.createTextNode(r)),JSON.stringify(e)!==JSON.stringify(o)&&a(e)}));const s=react_1.default.useRef(null);react_1.default.useEffect((()=>{const e=setTimeout((()=>{var e;const t=s.current;if(!t)return;null===(e=s.current)||void 0===e||e.focus();const r=i||t.value.length;t.selectionStart=t.selectionEnd=r,n&&(null==t||t.select(),document.execCommand("selectAll",!1,null))}));return()=>{clearTimeout(e)}}),[]),react_1.default.useEffect((()=>{window.addEventListener("blur",r);const e=e=>{var t;(null===(t=s.current)||void 0===t?void 0:t.contains(e.target))||r()};return window.addEventListener("touchstart",e),()=>{window.removeEventListener("blur",r),window.removeEventListener("touchstart",e)}}),[]);let u=0;const d=l.textArr.length*l.lineHeight()*l.fontSize();"middle"===t.verticalAlign&&(u=(t.a.height-d)/2),"bottom"===t.verticalAlign&&(u=t.a.height-d);const c=(0,text_1.removeTags)(t.text);return react_1.default.createElement(react_konva_utils_1.Html,null,react_1.default.createElement("textarea",{className:"polotno-input",ref:s,dir:getDir(c),style:Object.assign(Object.assign(Object.assign({},initialStyles),o),{paddingTop:u+"px"}),value:c,onChange:e=>{t.set({text:e.target.value})},placeholder:t.placeholder,onBlur:r}))})),useEditor=e=>{const[t,r]=react_1.default.useState(!1),n=react_1.default.useRef(!1);return react_1.default.useEffect((()=>{var t=!0;return setTimeout((()=>{t&&(e._editModeEnabled&&(n.current=!0),r(!0),setTimeout((()=>{n.current=!1}),50))}),50),()=>{t=!1}}),[]),{editorEnabled:t&&e._editModeEnabled,selectAll:n.current}},useFontLoader=(e,t)=>{const[r,n]=react_1.default.useReducer((e=>e+1),0),i=react_1.default.useRef((0,fonts_1.isFontLoaded)(t));return react_1.default.useLayoutEffect((()=>{if(i.current=(0,fonts_1.isFontLoaded)(t),i.current)return;let r=!0;return(async()=>{i.current=!1,n();const o=(0,loader_1.incrementLoader)(`text ${t}`);await e.loadFont(t),setTimeout(o,100),r&&(i.current=!0,n())})(),()=>{r=!1}}),[t]),[i.current]};exports.useFontLoader=useFontLoader;const getLineHeight=({fontLoaded:e,fontFamily:t,fontSize:r,lineHeight:n})=>react_1.default.useMemo((()=>{if("number"==typeof n)return n;const e=document.createElement("div");e.style.fontFamily=t,e.style.fontSize=r+"px",e.style.lineHeight=n,e.innerText="Test text",document.body.appendChild(e);const i=e.offsetHeight;return document.body.removeChild(e),i/r}),[e,t,r,n]);function getRelativePointerPosition(e){var t=e.getAbsoluteTransform().copy();t.invert();var r=e.getStage().getPointerPosition();return t.point(r)}function getCursorPosition(e){var t;const r=e.target,n=getRelativePointerPosition(r),i=r.textArr,o=Math.floor(n.y/(r.fontSize()*r.lineHeight())),a=i.slice(0,o).reduce(((e,t)=>e+t.text.length),o),l=null!==(t=i[o])&&void 0!==t?t:i[0];let s=0;"right"===r.align()?s=r.width()-l.width:"center"===r.align()&&(s=r.width()/2-l.width/2);return a+Math.round((n.x-s)/l.width*l.text.length)}function usePrevious(e){const t=react_1.default.useRef(e),r=react_1.default.useRef(e);return react_1.default.useMemo((()=>{r.current=t.current,t.current=e}),[e]),r.current}function isNonSpaceSeparatedLanguage(e){return/[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\uFF00-\uFFEF\u4E00-\u9FAF\uAC00-\uD7AF]/.test(e)}function findFitFontSize(e,t){const r=e.fontSize(),n=e.height(),i=(0,text_1.removeTags)(t.text);let o=t.a.fontSize;e.height(void 0);const a=Math.round(2*t.a.fontSize)-1;for(let r=1;r<a;r++){const r=t.a.height&&e.height()>t.a.height;let n=i.split("\n").join(" ").split(/[\s-]+/).reduce(((e,t)=>isNonSpaceSeparatedLanguage(t)?e.concat(t.split("")):e.concat(t)),[]),a=e.textArr.map((e=>e.text)).join(";");const l=n.find((e=>!a.includes(e)||(a=a.replace(e,""),!1)));if(!(r||l))break;o-=.5,e.fontSize(o)}return e.fontSize(r),e.height(n),o}function generateBackgroundShape({lines:e,lineHeight:t,width:r,align:n="left",padding:i=0,cornerRadius:o=0}){var a;e.forEach(((e,t)=>{e.cx=r/2,"right"===n?e.cx=r-e.width/2:"left"===n&&(e.cx=e.width/2),"justify"!==n||e.lastInParagraph||(e.width=r),"justify"===n&&(e.cx=e.width/2)}));let l=`M ${null===(a=e[0])||void 0===a?void 0:a.cx} ${-i}`;e.forEach(((r,n)=>{const{cx:o}=r,a=e[n-1];a&&a.width>r.width?l+=` L ${o+r.width/2+i} ${n*t+i}`:l+=` L ${o+r.width/2+i} ${n*t-i}`;const s=e[n+1];s&&s.width>r.width?l+=` L ${o+r.width/2+i} ${(n+1)*t-i}`:l+=` L ${o+r.width/2+i} ${(n+1)*t+i}`}));for(var s=e.length-1;s>=0;s--){const r=e[s],{cx:n}=r,o=e[s+1];o&&o.width>r.width?l+=` L ${n-r.width/2-i} ${(s+1)*t-i}`:l+=` L ${n-r.width/2-i} ${(s+1)*t+i}`;const a=e[s-1];a&&a.width>r.width?l+=` L ${n-r.width/2-i} ${s*t+i}`:l+=` L ${n-r.width/2-i} ${s*t-i}`}l+=" Z";const u=(0,svg_round_corners_1.parsePath)(l);return(0,svg_round_corners_1.roundCommands)(u,o).path}exports.getLineHeight=getLineHeight,exports.usePrevious=usePrevious,exports.TextElement=(0,mobx_react_lite_1.observer)((({element:e,store:t})=>{const r=react_1.default.useRef(null),n=react_1.default.useRef(null),{editorEnabled:i,selectAll:o}=useEditor(e),[a,l]=react_1.default.useState(!1),[s,u]=react_1.default.useState(!1),d=react_1.default.useRef(e.a.height),c=t.selectedElements.indexOf(e)>=0,{textVerticalResizeEnabled:f}=flags_1.flags,h=usePrevious(e.fontFamily),[g,_]=react_1.default.useState([]);react_1.default.useEffect((()=>{var e,t;const n=null!==(t=null===(e=r.current)||void 0===e?void 0:e.textArr)&&void 0!==t?t:[];JSON.stringify(n)!==JSON.stringify(g)&&_(n)})),react_1.default.useEffect((()=>{if(e.a.width)return;const t=r.current;t.width(600),e.set({width:1.4*t.getTextWidth()})}),[]),react_1.default.useLayoutEffect((()=>(0,mobx_1.autorun)((()=>{const t=r.current;(0,apply_filters_1.applyFilter)(t,e)}))));const[p]=(0,exports.useFontLoader)(t,e.fontFamily),x=(0,text_1.removeTags)(e.text),v=()=>{const e=r.current.clone({height:void 0}),t=Math.ceil(e.fontSize()*e.lineHeight()*e.textArr.length+1);return e.destroy(),t};react_1.default.useLayoutEffect((()=>{if(!p)return;const{textOverflow:n}=flags_1.flags;if(e.a.height)if("change-font-size"!==n||s||t.isPlaying){if("resize"===n){const n=v();f&&e.a.height<n&&t.history.ignore((()=>{var t;(0,mobx_state_tree_1.isAlive)(e)&&e.set({height:n}),null===(t=r.current)||void 0===t||t.height(n)}),!1,!0),f||e.a.height===n||t.history.ignore((()=>{var t;(0,mobx_state_tree_1.isAlive)(e)&&e.set({height:n}),null===(t=r.current)||void 0===t||t.height(n)}),!1,!0)}}else{const n=findFitFontSize(r.current,e);if(n!==e.a.fontSize)return void t.history.ignore((()=>{e.set({fontSize:n})}),!1,!0);const i=v();e.a.height===i||f||t.history.ignore((()=>{e.set({height:i})}),!1,!0)}else{const r=v();t.history.ignore((()=>{e.set({height:r})}),!1,!0)}})),react_1.default.useLayoutEffect((()=>{const t=r.current;t&&(t.width(t.width()+1e-8),t._setTextData(),(0,apply_filters_1.applyFilter)(t,e))}),[p]);const m=react_1.default.useRef(null),y=react_1.default.useRef(0),w=r=>{r.evt.preventDefault();const n=t.selectedShapes.find((t=>t===e));n&&e.contentEditable&&(y.current=getCursorPosition(r),e.toggleEditMode())},S=!x&&e.placeholder?.6:e.a.opacity;(0,use_fadein_1.useFadeIn)(r,S);const b=(0,exports.getLineHeight)({fontLoaded:p,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),E=e.selectable||"admin"===t.role,L=(0,use_color_1.useColor)(e),F=react_1.default.useMemo((()=>e.backgroundEnabled?generateBackgroundShape({lines:JSON.parse(JSON.stringify(g)),cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*b*.5),lineHeight:b*e.a.fontSize,padding:e.backgroundPadding*(e.a.fontSize*b*.5),width:e.a.width,align:e.align}):""),[e.backgroundEnabled,e.backgroundCornerRadius,e.a.fontSize,b,e.backgroundPadding,e.a.width,e.align,g]),T=(0,screen_1.useMobile)();let z=0;return"middle"===e.verticalAlign?z=(e.a.height-g.length*b*e.a.fontSize)/2:"bottom"===e.verticalAlign&&(z=e.a.height-g.length*b*e.a.fontSize),react_1.default.createElement(react_1.default.Fragment,null,react_1.default.createElement(react_konva_1.Path,{ref:n,x:e.a.x,y:e.a.y,rotation:e.a.rotation,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity,data:F,fill:e.backgroundColor,offsetY:-z}),react_1.default.createElement(react_konva_1.Text,Object.assign({ref:r,id:e.id,name:"element",hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,text:x||e.placeholder},L,{stroke:e.stroke,lineJoin:"round",strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:`"${e.fontFamily}", "${h}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:T?e.draggable&&c:e.draggable,preventDefault:!T||c,opacity:S,visible:!e._editModeEnabled,ellipsis:"ellipsis"===flags_1.flags.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:b,letterSpacing:e.letterSpacing*e.a.fontSize,listening:E,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},onClick:w,onTap:w,onTransformStart:()=>{u(!0),d.current=r.current.height()},onTransform:t=>{var r,i;const o=t.target;null===(r=n.current)||void 0===r||r.setAttrs({x:o.x(),y:o.y(),rotation:o.rotation(),scale:o.scale()});const a=(null===(i=o.getStage())||void 0===i?void 0:i.findOne("Transformer")).getActiveAnchor();if("middle-left"===a||"middle-right"===a){const t=o.scaleX(),r=o.width()*t,n=e.a.fontSize;let i=r;r<n&&(i=n,m.current&&o.position(m.current)),o.width(i),o.scaleX(1),o.scaleY(1);const a=v();if("ellipsis"!==flags_1.flags.textOverflow){const t=Math.max(a,d.current);o.height(t),e.set({height:o.height()})}e.set({x:o.x(),y:o.y(),width:o.width(),rotation:o.rotation()}),(0,apply_filters_1.applyFilter)(o,e)}if("top-center"===a||"bottom-center"===a){let r="resize"===flags_1.flags.textOverflow?v():b*e.a.fontSize;t.target.height(Math.max(r,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}m.current=t.target.position()},onTransformEnd:t=>{var r;const i=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:Math.round(e.a.fontSize*i),width:Math.ceil(t.target.width()*i),x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*i,shadowBlur:e.shadowBlur*i,shadowOffsetX:e.shadowOffsetX*i,shadowOffsetY:e.shadowOffsetY*i,strokeWidth:e.strokeWidth*i}),null===(r=n.current)||void 0===r||r.setAttrs({scaleX:1,scaleY:1}),u(!1)}})),i&&react_1.default.createElement(react_konva_1.Group,{x:e.a.x,y:e.a.y,rotation:e.a.rotation},react_1.default.createElement(TextInput,{textNodeRef:r,element:e,selectAll:o,cursorPosition:y.current,onBlur:()=>{e.toggleEditMode(!1)}})),!s&&(a||c)&&react_1.default.createElement(highlighter_1.Highlighter,{element:e}))}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "description": "Design Editor Framework",
5
5
  "author": "Anton Lavrenov",
6
6
  "keywords": [
@@ -80,11 +80,13 @@
80
80
  "react": "^18.3.1",
81
81
  "react-dom": "^18.3.1",
82
82
  "size-limit": "^11.1.4",
83
+ "skia-canvas": "^1.0.1",
83
84
  "svg-path-bounds": "^1.0.2",
84
85
  "ts-jest": "^29",
85
86
  "typescript": "^5.4.5",
86
87
  "uglifyjs-folder": "^3.3.0",
87
- "vitest": "^0.34.6"
88
+ "vitest": "^0.34.6",
89
+ "webdriverio": "^8.38.2"
88
90
  },
89
91
  "homepage": "https://polotno.com/",
90
92
  "scripts": {
package/polotno.bundle.js CHANGED
@@ -26,7 +26,7 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
26
26
  color: ${o.color};
27
27
  opacity: 0.6;
28
28
  }
29
- `;iq.innerHTML="",iq.appendChild(document.createTextNode(n)),JSON.stringify(e)!==JSON.stringify(o)&&a(e)});let s=c(w).useRef(null);c(w).useEffect(()=>{let e=setTimeout(()=>{let e=s.current;if(!e)return;s.current?.focus();let t=i||e.value.length;e.selectionStart=e.selectionEnd=t,r&&(e?.select(),document.execCommand("selectAll",!1,null))});return()=>{clearTimeout(e)}},[]),c(w).useEffect(()=>{window.addEventListener("blur",n);let e=e=>{s.current?.contains(e.target)||n()};return window.addEventListener("touchstart",e),()=>{window.removeEventListener("blur",n),window.removeEventListener("touchstart",e)}},[]);let u=0,d=l.textArr.length*l.lineHeight()*l.fontSize();"middle"===t.verticalAlign&&(u=(t.a.height-d)/2),"bottom"===t.verticalAlign&&(u=t.a.height-d);let h=iM(t.text);return(0,v.jsx)(r8,{children:(0,v.jsx)("textarea",{className:"polotno-input",ref:s,dir:iW(h),style:{...iG,...o,paddingTop:u+"px"},value:h,onChange:e=>{t.set({text:e.target.value})},placeholder:t.placeholder,onBlur:n})})}),iK=e=>{let[t,n]=c(w).useState(!1),r=c(w).useRef(!1);return c(w).useEffect(()=>{var t=!0;return setTimeout(()=>{t&&(e._editModeEnabled&&(r.current=!0),n(!0),setTimeout(()=>{r.current=!1},50))},50),()=>{t=!1}},[]),{editorEnabled:t&&e._editModeEnabled,selectAll:r.current}},iY=(e,t)=>{let[n,r]=c(w).useReducer(e=>e+1,0),i=c(w).useRef(iP(t));return c(w).useLayoutEffect(()=>{if(i.current=iP(t),i.current)return;let n=!0;return(async()=>{i.current=!1,r();let o=iv(`text ${t}`);await e.loadFont(t),setTimeout(o,100),n&&(i.current=!0,r())})(),()=>{n=!1}},[t]),[i.current]},iX=({fontLoaded:e,fontFamily:t,fontSize:n,lineHeight:r})=>c(w).useMemo(()=>{if("number"==typeof r)return r;let e=document.createElement("div");e.style.fontFamily=t,e.style.fontSize=n+"px",e.style.lineHeight=r,e.innerText="Test text",document.body.appendChild(e);let i=e.offsetHeight;return document.body.removeChild(e),i/n},[e,t,n,r]);function iZ(e){let t=c(w).useRef(e),n=c(w).useRef(e);return c(w).useMemo(()=>{n.current=t.current,t.current=e},[e]),n.current}let iQ=N(({element:e,store:t})=>{let n=c(w).useRef(null),r=c(w).useRef(null),{editorEnabled:i,selectAll:o}=iK(e),[a,l]=c(w).useState(!1),[s,u]=c(w).useState(!1),d=c(w).useRef(e.a.height),h=t.selectedElements.indexOf(e)>=0,{textVerticalResizeEnabled:f}=iR,p=iZ(e.fontFamily),[g,m]=c(w).useState([]);c(w).useEffect(()=>{let e=n.current?.textArr??[];JSON.stringify(e)!==JSON.stringify(g)&&m(e)}),c(w).useEffect(()=>{if(e.a.width)return;let t=n.current;t.width(600),e.set({width:1.4*t.getTextWidth()})},[]),c(w).useLayoutEffect(()=>(0,x.autorun)(()=>{iD(n.current,e)}));let[y]=iY(t,e.fontFamily),b=iM(e.text),_=()=>{let e=n.current.clone({height:void 0}),t=Math.ceil(e.fontSize()*e.lineHeight()*e.textArr.length+1);return e.destroy(),t};c(w).useLayoutEffect(()=>{if(!y)return;let{textOverflow:r}=iR;if(!e.a.height){let n=_();t.history.ignore(()=>{e.set({height:n})},!1,!0);return}if("change-font-size"!==r||s||t.isPlaying){if("resize"===r){let r=_();f&&e.a.height<r&&t.history.ignore(()=>{(0,iV.isAlive)(e)&&e.set({height:r}),n.current?.height(r)},!1,!0),f||e.a.height===r||t.history.ignore(()=>{(0,iV.isAlive)(e)&&e.set({height:r}),n.current?.height(r)},!1,!0)}}else{let r=function(e,t){let n=e.fontSize(),r=e.height(),i=iM(t.text),o=t.a.fontSize;e.height(void 0);let a=Math.round(2*t.a.fontSize)-1;for(let n=1;n<a;n++){let n=t.a.height&&e.height()>t.a.height,r=i.split("\n").join(" ").split(/[\s-]+/),a=e.textArr.map(e=>e.text).join(";"),l=r.find(e=>!a.includes(e)||(a=a.replace(e,""),!1));if(!(n||l))break;o-=.5,e.fontSize(o)}return e.fontSize(n),e.height(r),o}(n.current,e);if(r!==e.a.fontSize){t.history.ignore(()=>{e.set({fontSize:r})},!1,!0);return}let i=_();e.a.height===i||f||t.history.ignore(()=>{e.set({height:i})},!1,!0)}}),c(w).useLayoutEffect(()=>{let t=n.current;t&&(t.width(t.width()+1e-8),t._setTextData(),iD(t,e))},[y]);let E=c(w).useRef(null),S=c(w).useRef(0),C=n=>{n.evt.preventDefault(),t.selectedShapes.find(t=>t===e)&&e.contentEditable&&(S.current=function(e){var t,n;let r=e.target,i=((t=r.getAbsoluteTransform().copy()).invert(),n=r.getStage().getPointerPosition(),t.point(n)),o=r.textArr,a=Math.floor(i.y/(r.fontSize()*r.lineHeight())),l=o.slice(0,a).reduce((e,t)=>e+t.text.length,a),s=o[a]??o[0],u=0;return"right"===r.align()?u=r.width()-s.width:"center"===r.align()&&(u=r.width()/2-s.width/2),l+Math.round((i.x-u)/s.width*s.text.length)}(n),e.toggleEditMode())},O=!b&&e.placeholder?.6:e.a.opacity;ih(n,O);let k=iX({fontLoaded:y,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),P=e.selectable||"admin"===t.role,T=ic(e),A=c(w).useMemo(()=>e.backgroundEnabled?function({lines:e,lineHeight:t,width:n,align:r="left",padding:i=0,cornerRadius:o=0}){let a,l;e.forEach((e,t)=>{e.cx=n/2,"right"===r?e.cx=n-e.width/2:"left"===r&&(e.cx=e.width/2),"justify"!==r||e.lastInParagraph||(e.width=n),"justify"===r&&(e.cx=e.width/2)});let s=`M ${e[0]?.cx} ${-i}`;e.forEach((n,r)=>{let{cx:o}=n,a=e[r-1];a&&a.width>n.width?s+=` L ${o+n.width/2+i} ${r*t+i}`:s+=` L ${o+n.width/2+i} ${r*t-i}`;let l=e[r+1];l&&l.width>n.width?s+=` L ${o+n.width/2+i} ${(r+1)*t-i}`:s+=` L ${o+n.width/2+i} ${(r+1)*t+i}`});for(var u,c=e.length-1;c>=0;c--){let n=e[c],{cx:r}=n,o=e[c+1];o&&o.width>n.width?s+=` L ${r-n.width/2-i} ${(c+1)*t-i}`:s+=` L ${r-n.width/2-i} ${(c+1)*t+i}`;let a=e[c-1];a&&a.width>n.width?s+=` L ${r-n.width/2-i} ${c*t+i}`:s+=` L ${r-n.width/2-i} ${c*t-i}`}return(u=function(e){let t=/-?[0-9]*\.?\d+/g;return[...e.matchAll(/[MmLlSsQqLlHhVvCcSsQqTtAaZz]/g)].map(e=>({marker:e[0],index:e.index})).reduceRight((t,n)=>{let r=e.substring(n.index,t.length?t[t.length-1].index:e.length);return t.concat([{marker:n.marker,index:n.index,chunk:r.length>0?r.substr(1,r.length-1):r}])},[]).reverse().flatMap(e=>{let n=e.chunk.match(t),r=n?n.map(parseFloat):[];return function(e,t){let n=[];switch(e.toUpperCase()){case"M":for(let r=0;r<t.length;r+=2){let i;i=e===e.toUpperCase()?0===r?"M":"L":0===r?"m":"l",n.push({marker:i,values:{x:t[r],y:t[r+1]}})}break;case"L":for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case"H":for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:t[r],y:0}});break;case"V":for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:0,y:t[r]}});break;case"C":for(let r=0;r<t.length;r+=6)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x2:t[r+2],y2:t[r+3],x:t[r+4],y:t[r+5]}});break;case"S":for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x2:t[r],y2:t[r+1],x:t[r+2],y:t[r+3]}});break;case"Q":for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x:t[r+2],y:t[r+3]}});break;case"T":for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case"A":for(let r=0;r<t.length;r+=7)n.push({marker:e,values:{radiusX:t[r],radiusY:t[r+1],rotation:t[r+2],largeArc:t[r+3],sweep:t[r+4],x:t[r+5],y:t[r+6]}});break;case"Z":n.push({marker:e,values:{x:0,y:0}})}return n}(e.marker,r)}).map(r7)}(s+=" Z"),a=[],l=[],u.forEach(e=>{"M"===e.marker&&a.push([]),a[a.length-1].push(e)}),a.forEach(e=>{e.map(ie),function e(t,n){let r=["x","y"].every(e=>0===Math.round(Math.abs(t[n].values[e]-t[0].values[e])));"L"===t[n].marker&&r&&(t[n].overlap=!0,e(t,n-1)),"Z"===t[n].marker&&e(t,n-1)}(e,e.length-1);let t="Z"==e[e.length-1].marker;e.filter(e=>!e.overlap).map((e,n,r)=>{let i,a,s;let u=function e(t,n,r){var i;let o=n-1,a=r[(o%(i=r.length)+i)%i];return"Z"!==a.marker?a:e(t,o,r)}(e,n,r),c=function e(t,n,r){var i;let o=n+1,a=r[(o%(i=r.length)+i)%i];return"Z"===a.marker?e(t,o,r):a}(e,n,r),d=it(e.values,u.values),h=it(e.values,c.values),f=h-d,p=180/Math.PI*f,g=Math.min(o,Math.abs(function(e,t,n){let r=ir(e.values,n.values);return Math.min(ir(t.values,e.values),r)}(e,u,c)/2*Math.tan(f/2))),m=(a=0,(s=180/Math.PI*f)<0&&s>=-180||s>180&&s<360?i=ii(f/2,-g):(i=ii(f/2,g),a=1,i===1/0&&(i=g)),{offset:i,sweepFlag:a}),v=m.offset,y=m.sweepFlag,b=(0==n||n==r.length-1)&&!t;switch(e.marker){case"M":case"L":let w=[e.values.x+Math.sin(d)*v,e.values.y+Math.cos(d)*v],x=[e.values.x+Math.sin(h)*v,e.values.y+Math.cos(h)*v];b?l.push({marker:e.marker,values:e.values}):l.push({marker:e.marker,values:{x:parseFloat(w[0].toFixed(3)),y:parseFloat(w[1].toFixed(3))}}),b||"L"!==c.marker&&"M"!==c.marker||l.push({marker:"A",radius:g,values:{radiusX:parseFloat(g.toFixed(3)),radiusY:parseFloat(g.toFixed(3)),rotation:p,largeArc:0,sweep:y,x:parseFloat(x[0].toFixed(3)),y:parseFloat(x[1].toFixed(3))}});break;case"C":case"S":case"Q":case"T":case"A":case"Z":l.push({marker:e.marker,values:e.values})}})}),{path:function(e){let t=["radiusX","radiusY","rotation","largeArc","sweep","x1","y1","x2","y2","x","y"];return e.map(e=>{let n="";if("Z"!==e.marker){let r=Object.keys(e.values);n=t.filter(e=>-1!==r.indexOf(e)).map(t=>e.values[t]).join()}return`${e.marker}${n}`}).join("").trim()}(l),commands:l}).path}({lines:JSON.parse(JSON.stringify(g)),cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*k*.5),lineHeight:k*e.a.fontSize,padding:e.backgroundPadding*(e.a.fontSize*k*.5),width:e.a.width,align:e.align}):"",[e.backgroundEnabled,e.backgroundCornerRadius,e.a.fontSize,k,e.backgroundPadding,e.a.width,e.align,g]),N=iH(),j=0;return"middle"===e.verticalAlign?j=(e.a.height-g.length*k*e.a.fontSize)/2:"bottom"===e.verticalAlign&&(j=e.a.height-g.length*k*e.a.fontSize),(0,v.jsxs)(c(w).Fragment,{children:[(0,v.jsx)(r0,{ref:r,x:e.a.x,y:e.a.y,rotation:e.a.rotation,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity,data:A,fill:e.backgroundColor,offsetY:-j}),(0,v.jsx)(rJ,{ref:n,id:e.id,name:"element",hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,text:b||e.placeholder,...T,stroke:e.stroke,lineJoin:"round",strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:`"${e.fontFamily}", "${p}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:N?e.draggable&&h:e.draggable,preventDefault:!N||h,opacity:O,visible:!e._editModeEnabled,ellipsis:"ellipsis"===iR.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:k,letterSpacing:e.letterSpacing*e.a.fontSize,listening:P,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},onClick:C,onTap:C,onTransformStart:()=>{u(!0),d.current=n.current.height()},onTransform:t=>{let n=t.target;r.current?.setAttrs({x:n.x(),y:n.y(),rotation:n.rotation(),scale:n.scale()});let i=(n.getStage()?.findOne("Transformer")).getActiveAnchor();if("middle-left"===i||"middle-right"===i){let t=n.scaleX(),r=n.width()*t,i=e.a.fontSize,o=r;r<i&&(o=i,E.current&&n.position(E.current)),n.width(o),n.scaleX(1),n.scaleY(1);let a=_();if("ellipsis"!==iR.textOverflow){let t=Math.max(a,d.current);n.height(t),e.set({height:n.height()})}e.set({x:n.x(),y:n.y(),width:n.width(),rotation:n.rotation()}),iD(n,e)}if("top-center"===i||"bottom-center"===i){let n="resize"===iR.textOverflow?_():k*e.a.fontSize;t.target.height(Math.max(n,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}E.current=t.target.position()},onTransformEnd:t=>{let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:Math.round(e.a.fontSize*n),width:Math.ceil(t.target.width()*n),x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*n,shadowBlur:e.shadowBlur*n,shadowOffsetX:e.shadowOffsetX*n,shadowOffsetY:e.shadowOffsetY*n,strokeWidth:e.strokeWidth*n}),r.current?.setAttrs({scaleX:1,scaleY:1}),u(!1)}}),i&&(0,v.jsx)(rK,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,children:(0,v.jsx)(i$,{textNodeRef:n,element:e,selectAll:o,cursorPosition:S.current,onBlur:()=>{e.toggleEditMode(!1)}})}),!s&&(a||h)&&(0,v.jsx)(iz,{element:e})]})});var w=g("8NFma"),x=g("2SBKn"),w=g("8NFma");function iJ(e){let t={fill:"",stroke:""};if(e.getAttribute("fill")&&"none"!==e.getAttribute("fill")&&(t.fill=e.getAttribute("fill")),!t.fill&&e.style.fill&&"none"!==e.style.fill&&(t.fill=e.style.fill),e.getAttribute("stroke")&&(t.stroke=e.getAttribute("stroke")),!t.stroke&&e.style.stroke&&(t.stroke=e.style.stroke),!t.stroke&&!t.fill){let n=e.ownerSVGElement,r=n&&n!==e&&iJ(n);r?.fill==="currentColor"||r?.stroke==="currentColor"||(t.fill="black")}return t}let i0=["path","rect","circle"];function i1(e){for(var t=[],n=e.getElementsByTagName("*"),r=0,i=n.length;r<i;r++){let e=n[r];!function(e){for(;e.parentNode;){if("defs"===e.nodeName)return!0;e=e.parentNode}return!1}(e)&&(null!==e.getAttribute("fill")&&t.push(e),null!==e.getAttribute("stroke")?t.push(e):e.style&&e.style.fill?t.push(e):i0.indexOf(e.nodeName)>=0&&t.push(e))}return t}async function i2(e){let t=await fetch(e);return i5(await t.text())}async function i3(e){let t=await fetch(e,{mode:"cors"});return await t.text()}function i5(e){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(e)))}async function i4(e){let t=await i3(e),n=new DOMParser().parseFromString(t,"image/svg+xml").documentElement.getAttribute("viewBox"),[r,i,o,a]=n?.split(" ")||[];return{width:parseFloat(o),height:parseFloat(a)}}function i6(e){var t=new DOMParser().parseFromString(e,"image/svg+xml");let n=t.documentElement.getAttribute("viewBox"),[r,i,o,a]=n?.split(" ")||[],l=t.documentElement.getAttribute("width");l||t.documentElement.setAttribute("width",o+"px");let s=t.documentElement.getAttribute("height");if((!s||s.indexOf("%")>=0)&&t.documentElement.setAttribute("height",a+"px"),l&&l.indexOf("%")>=0&&s&&-1===s.indexOf("%")){let e=parseFloat(s)/parseFloat(a);t.documentElement.setAttribute("width",e*parseFloat(o)+"px")}if(s&&s.indexOf("%")>=0&&l&&-1===l.indexOf("%")){let e=parseFloat(l)/parseFloat(o);t.documentElement.setAttribute("height",e*parseFloat(a)+"px")}return"100%"===l&&"100%"===s&&(t.documentElement.setAttribute("width",o+"px"),t.documentElement.setAttribute("height",a+"px")),new XMLSerializer().serializeToString(t)}let i8=(e,t)=>{if(!e||!t)return!1;if("currentColor"===t&&"black"===e)return!0;let n=c(R).Util.colorToRGBA(e),r=c(R).Util.colorToRGBA(t);if(n&&r)return n.r===r.r&&n.g===r.g&&n.b===r.b&&n.a===r.a};function i9(e,t){var n=new DOMParser().parseFromString(e,"image/svg+xml");let r=i1(n),i=Array.from(t.keys());return r.forEach(e=>{let{fill:r,stroke:o}=iJ(e);[{prop:"fill",color:r},{prop:"stroke",color:o}].forEach(({prop:r,color:o})=>{let a=i.find(e=>i8(e,o));if(a){let i=t.get(a);if(il(i)){let{rotation:t,stops:o}=iu(i),a=o.map(e=>({offset:100*e.offset+"%","stop-color":e.color})),l="color"+Math.round(1e8*Math.random());(function(e,t,n,r){var i=e.namespaceURI,o=document.createElementNS(i,"linearGradient");let a=c(R).Util.degToRad(n+90),l=(Math.cos(a)+1)/2,s=(Math.sin(a)+1)/2,u=(Math.cos(a+Math.PI)+1)/2,d=(Math.sin(a+Math.PI)+1)/2;o.setAttribute("x1",100*l+"%"),o.setAttribute("y1",100*s+"%"),o.setAttribute("x2",100*u+"%"),o.setAttribute("y2",100*d+"%"),o.setAttribute("gradientUnits","userSpaceOnUse"),o.setAttribute("id",t);for(var h=0;h<r.length;h++){var f=r[h],p=document.createElementNS(i,"stop");for(var g in f)f.hasOwnProperty(g)&&p.setAttribute(g,f[g]);o.appendChild(p)}(e.querySelector("defs")||e.insertBefore(document.createElementNS(i,"defs"),e.firstChild)).appendChild(o)})(n.children[0],l,t,a),e.style[r]=null,e.setAttribute(r,`url('#${l}')`)}else e.style[r]=t.get(a)}})}),i5(new XMLSerializer().serializeToString(n))}let i7=e=>{let[t,n]=c(w).useState([]);return c(w).useEffect(()=>{let t=!1;return(async()=>{n([]);let r=function(e){let t=i1(new DOMParser().parseFromString(e,"image/svg+xml")),n=[];return t.forEach(e=>{let{fill:t,stroke:r}=iJ(e);[t,r].forEach(e=>{e&&("currentColor"===e&&(e="black"),c(R).Util.colorToRGBA(e)&&-1===n.indexOf(e)&&n.push(e))})}),n}(await i3(e));t||n(r)})(),()=>{t=!0}},[e]),t};function oe(){return document.createElement("canvas")}async function ot(e){return e.indexOf("data:image/svg+xml")>=0||e.indexOf(".svg")>=0?i5(i6(await i3(e))):e}let on=e=>{let[t,n]=c(w).useState(e);return c(w).useEffect(()=>{(async()=>{let r=await ot(e);r!==t&&n(r)})()},[e]),t};function or(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}let oi=(e,t,n)=>{let r=c(w).useMemo(()=>{let{flipX:r,flipY:i}=e,o="svg"===e.type||e.src.indexOf("data:image/svg+xml")>=0||e.src.indexOf(".svg")>=0,a=navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&o||e.maskSrc;if(!r&&!i&&!a)return t;if(!t||!t.width||!t.height)return null;let l=oe(),s=1;"svg"===e.type&&(s=Math.max(e.a.width/t.width*n,e.a.height/t.height*n)),l.width=Math.max(t.width*s,1),l.height=Math.max(t.height*s,1);let u=r?-l.width:0,c=i?-l.height:0;return l.getContext("2d")?.scale(r?-1:1,i?-1:1),l.getContext("2d")?.drawImage(t,u,c,l.width,l.height),l},[e.maskSrc,e.flipX,e.flipY,t,e.a.width,e.a.height,n]);return c(w).useEffect(()=>()=>{r&&"CANVAS"===r.nodeName&&c(R).Util.releaseCanvas(r)},[r]),r},oo=(e,t)=>{let[n,r]=od(e.maskSrc,"anonymous");return oh(e.maskSrc?r:"loaded",e.id+"-mask"),c(w).useMemo(()=>{if(!n||!t||!t.width||!t.height)return t;let r=oe();r.width=Math.max(t.width,1),r.height=Math.max(t.height,1);let i=r.getContext("2d");if(!i)return t;i.drawImage(t,0,0),i.globalCompositeOperation="source-in";let o=function(e,t){let n,r;let i=t.width/t.height;return i>=e.width/e.height?(n=e.width,r=e.width/i):(n=e.height*i,r=e.height),{x:(e.width-n)/2,y:(e.height-r)/2,width:n,height:r}}(n,e);return i.drawImage(n,o.x,o.y,o.width,o.height,0,0,t.width,t.height),r},[t,n,e.a.width,e.a.height])},oa=(e,t,n,r,i=0,o=!1)=>{let a=Math.floor(Math.max(e.a.width*r,1)),l=Math.floor(Math.max(e.a.height*r,1)),s=Math.min(i*r,a/2,l/2),u=Math.max(e.a.width/n.width,e.a.height/n.height)*r,d=e.page._exportingOrRendering&&iR.imageDownScalingEnabled&&u<1&&!o,h=0===n.x&&0===n.y&&n.width===t?.width&&n.height===t?.height,f=c(w).useMemo(()=>{if(!t||!t.width||!t.height)return;let e=0===s,n=!d;if(!h||!e||!n)return oe()},[t,s,d,h]);return c(w).useLayoutEffect(()=>{if(!f||!t)return;f.width=a,f.height=l;let e=f.getContext("2d");if(!e)return;s&&(e.beginPath(),e.moveTo(s,0),e.lineTo(a-s,0),e.arc(a-s,s,s,3*Math.PI/2,0,!1),e.lineTo(a,l-s),e.arc(a-s,l-s,s,0,Math.PI/2,!1),e.lineTo(s,l),e.arc(s,l-s,s,Math.PI/2,Math.PI,!1),e.lineTo(0,s),e.arc(s,s,s,Math.PI,3*Math.PI/2,!1),e.clip());let r=d?function(e,t){let n=oe();n.width=e.width,n.height=e.height;let r=Math.max(1,Math.floor(n.width*t)),i=Math.max(1,Math.floor(n.height*t));n.getContext("2d")?.drawImage(e,0,0,n.width,n.height);let o=function(e,t,n,r,i,o,a){for(var l=new ImageData(t,n),s=new Int32Array(e.data.buffer),u=e.width,c=new Int32Array(l.data.buffer),d=l.width,h=t/o,f=n/a,p=Math.round(1/h),g=Math.round(1/f),m=p*g,v=0;v<l.height;v++)for(var y=0;y<d;y++){for(var b=0+Math.round(y/h)+(0+Math.round(v/f))*u,w=0,x=0,_=0,E=0,S=0;S<g;S++)for(var C=0;C<p;C++){var O=s[b+C+S*u];w+=O<<24>>>24,x+=O<<16>>>24,_+=O<<8>>>24,E+=O>>>24}w=Math.round(w/m),x=Math.round(x/m),_=Math.round(_/m),E=Math.round(E/m),c[y+v*d]=E<<24|_<<16|x<<8|w}return l}(n.getContext("2d").getImageData(0,0,n.width,n.height),r,i,0,0,n.width,n.height);return n.width=r,n.height=i,n.getContext("2d")?.putImageData(o,0,0),n}(t,u):t,i=d?{x:Math.floor(n.x*u),y:Math.floor(n.y*u),width:Math.floor(n.width*u),height:Math.floor(n.height*u)}:n;e.drawImage(r,i.x,i.y,i.width,i.height,0,0,f.width,f.height)},[f,e.a.width,e.a.height,n.x,n.y,n.width,n.height,i,r,o,e.page._exportingOrRendering,d]),c(w).useEffect(()=>()=>{f&&"CANVAS"===f.nodeName&&c(R).Util.releaseCanvas(f)},[f]),f||t},ol=(e,t,n,r)=>{let[i,o]=od(on(e.clipSrc||""),"anonymous");oh(e.clipSrc?o:"loaded",e.id+"-clip");let a=c(w).useMemo(()=>{if(t&&i)return oe()},[t,i]);return c(w).useLayoutEffect(()=>{if(!i||!t||!t.width||!t.height||!i||!i.width||!i.height||!a)return;let r=oe(),o=Math.max(e.a.width/i.width*n,e.a.height/i.height*n);r.width=i.width*o,r.height=i.height*o,r.getContext("2d")?.drawImage(i,0,0,r.width,r.height),a.width=Math.max(t.width,1),a.height=Math.max(t.height,1);let l=a.getContext("2d");l&&(l.save(),l.drawImage(r,0,0,t.width,t.height),c(R).Util.releaseCanvas(r),l.globalCompositeOperation="source-in",l.drawImage(t,0,0,a.width,a.height),l.restore())},[a,t,i,e.a.width,e.a.height,n,...r]),e.clipSrc&&i?a:t},os=oe(),ou=N(({element:e})=>{let t=Math.min(30,e.a.width/4,e.a.height/4),n=c(w).useRef(null);return c(w).useEffect(()=>{let e=n.current;if(!e)return;let t=new(c(R)).Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}}),(0,v.jsxs)(rK,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,v.jsx)(rX,{width:e.a.width,height:e.a.height,fill:"rgba(124, 173, 212, 0.8)"}),(0,v.jsx)("Arc",{ref:n,x:e.a.width/2,y:e.a.height/2,fill:"white",outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})}),oc=N(({element:e})=>{let t="Can not load the image...",n=Math.max(10,Math.min(30,e.a.width/t.length));return(0,v.jsxs)(rK,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,v.jsx)(rX,{width:e.a.width,height:e.a.height,fill:"rgba(223, 102, 102, 0.8)"}),(0,v.jsx)(rJ,{text:t,fontSize:n,width:e.a.width,height:e.a.height,align:"center",fill:"white",verticalAlign:"middle",padding:5})]})}),od=c(r5),oh=(e,t)=>{let n=c(w).useRef(),r=()=>{n.current?.(),n.current=void 0};c(w).useEffect(()=>r,[]),c(w).useLayoutEffect(()=>{"loading"!==e||n.current||(n.current=iv(`image ${t}`)),"loading"!==e&&r(),"failed"===e&&iw(`image ${t}`)},[e])},of=({image:e,status:t,type:n})=>{let r=c(w).useRef();return c(w).useEffect(()=>{r.current=e||r.current},[e]),"failed"!==t||"failed"!==t&&"svg"===n?r.current:void 0},op=e=>{let[t,n]=c(w).useReducer(e=>e+1,0),r=c(w).useRef("loading"),i=c(w).useRef(e.src),o=c(w).useRef(e.src);return(o.current!==e.src&&(o.current=e.src,r.current="loading"),c(w).useEffect(()=>{if("svg"!==e.type||!e.src)return;let t=!1;return(async()=>{r.current="loading",n();let o=i9(i6(await i3(e.src)),e.colorsReplace);t||(i.current=o,r.current="loaded",n())})(),()=>{t=!0}},[e.src,JSON.stringify(e.colorsReplace)]),"svg"!==e.type)?[e.src,"loaded"]:[i.current,r.current]},og=N(({element:e,store:t})=>{let n,r;let[i,o]=c(w).useState(!1),a=c(w).useRef(null),l=c(w).useRef(null),[s,u]=c(w).useState(!1),d=t.selectedElements.indexOf(e)>=0,[h,f]=op(e),[p,g]=od(h,"anonymous");oh("svg"!==e.type||"loaded"===f?g:"loading",e.id);let m=of({image:p,status:g,type:e.type}),y=oo(e,oi(e,p||m,t._elementsPixelRatio))||os,{cropX:b,cropY:_,cropWidth:E,cropHeight:S}=e;"loaded"!==g&&(b=_=0,E=S=1);let C=y.width*E,O=y.height*S,k=e.a.width/e.a.height,P=C/O,T="svg"===e.type;T?(n=C,r=O):k>=P?(n=C,r=C/k):(n=O*k,r=O);let A={x:y.width*b,y:y.height*_,width:n,height:r},N=e.cornerRadius??0,j=e.page._exportingOrRendering?1:Math.min(2,t.scale),L=t._elementsPixelRatio*j,I=ol(e,oa(e,y,A,L,N,i||e._cropModeEnabled||"svg"===e.type),L,[A,N,L]),M=Math.max(e.a.width/n,e.a.height/r);c(w).useEffect(()=>{if(!e._cropModeEnabled)return;let t=a.current?.getStage();function n(t){e._cropModeEnabled&&t.target!==l.current&&e.toggleCropMode(!1)}function r(n){e._cropModeEnabled&&n.target.parentNode!==t.content&&e.toggleCropMode(!1)}return document.body.addEventListener("click",r),t?.on("click",n),t?.on("tap",n),()=>{document.body.removeEventListener("click",r),document.body.removeEventListener("touchstart",r),t?.off("click",n),t?.off("click",n)}},[e._cropModeEnabled]),c(w).useLayoutEffect(()=>{if(!i&&!e._cropModeEnabled)return iD(a.current,e),(0,x.autorun)(()=>{iD(a.current,e)},{delay:100})},[I,e.page._exportingOrRendering,i,E,S,e._cropModeEnabled]),c(w).useLayoutEffect(()=>{i||e._cropModeEnabled?a.current?.clearCache():iD(a.current,e)},[i,e.a.width,e.a.height,e._cropModeEnabled]),c(w).useEffect(()=>{iD(a.current,e)},[e.shadowEnabled,e.shadowBlur,e.cornerRadius,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let D=c(w).useRef(null),F=c(w).useRef(null),z=c(w).useRef(null);c(w).useLayoutEffect(()=>{e._cropModeEnabled&&(F.current.nodes([D.current]),z.current.nodes([l.current]))},[e._cropModeEnabled]);var B=c(w).useRef(null),U=c(w).useRef(0),H=c(w).useRef(!1);let V=t=>{t.evt.touches?.length>2&&t.target.stopDrag(),Math.round(t.target.x())>0&&(t.target.x(0),t.target.scaleX(1)),Math.round(t.target.y())>0&&(t.target.y(0),t.target.scaleY(1));let i=t.target.width()*t.target.scaleX(),o=t.target.height()*t.target.scaleY(),a=Math.min(1,n/i),l=Math.min(1,r/o),s=Math.min(1-a,Math.max(0,Math.round(-t.target.x())/i)),u=Math.min(1-l,Math.max(0,Math.round(-t.target.y())/o));t.target.setAttrs({x:-s*y.width,y:-u*y.height,scaleX:1,scaleY:1}),e.set({cropX:s,cropY:u,cropWidth:a,cropHeight:l})},q=()=>{"svg"!==e.type&&e.contentEditable&&setTimeout(()=>{e.toggleCropMode(!0)})},G="svg"===e.type&&m,W="loading"===g&&!G,$="failed"===g,K=!W&&!$,Y=c(w).useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),X=K?e.a.opacity:0;ih(a,X);let Z=e.selectable||"admin"===t.role,Q=iH();return(0,v.jsxs)(c(w).Fragment,{children:[W&&(0,v.jsx)(ou,{element:e}),$&&(0,v.jsx)(oc,{element:e}),(0,v.jsx)(rQ,{ref:a,name:"element",id:e.id,image:I,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.rotation,opacity:X,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:A,listening:Z,draggable:Q?e.draggable&&d:e.draggable,preventDefault:!Q||d,hideInExport:!e.showInExport,onMouseEnter:()=>{u(!0)},onMouseLeave:()=>{u(!1)},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDblClick:q,onDblTap:q,onTransformStart:()=>{o(!0),Y.current={cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight}},onTransform:t=>{let i=t.currentTarget,o=1e-7>Math.abs(i.scaleX()-1)?1:i.scaleX(),a=1e-7>Math.abs(i.scaleY()-1)?1:i.scaleY();i.scaleX(1),i.scaleY(1);let l=t.target.getStage()?.findOne("Transformer"),s=Math.min(1-n/y.width,Math.max(0,e.cropX)),u=Math.min(1-r/y.height,Math.max(0,e.cropY)),c=l.getActiveAnchor(),d=!(c.indexOf("middle")>=0||c.indexOf("center")>=0),h=!d&&o<1&&Y.current.cropHeight>r/y.height,f=d?e.cropWidth:e.cropWidth*o;h&&(f=e.cropWidth);let p=!d&&a<1&&Y.current.cropWidth>n/y.width,g=d?e.cropHeight:e.cropHeight*a;p&&(g=e.cropHeight),T&&(f=e.cropWidth,g=e.cropHeight),e.set({cropX:s,cropY:u,x:i.x(),y:i.y(),width:i.width()*o,height:i.height()*a,rotation:t.target.rotation(),cropWidth:Math.min(f,1-s),cropHeight:Math.min(g,1-u)})},onTransformEnd:t=>{let i=t.currentTarget;e.set({width:i.width(),height:i.height(),x:i.x(),y:i.y(),rotation:t.target.rotation(),cropWidth:n/y.width,cropHeight:r/y.height}),o(!1)}}),(0,v.jsx)(rX,{x:e.x,y:e.y,width:Math.max(e.a.width-e.borderSize,0),height:Math.max(e.a.height-e.borderSize,0),opacity:X,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,stroke:e.borderColor,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,N-e.borderSize),hideInExport:!e.showInExport}),e._cropModeEnabled&&(0,v.jsxs)(r9,{selector:".page-abs-container",enabled:!0,children:[(0,v.jsx)(rX,{x:-window.innerWidth/t.scale,y:-window.innerWidth/t.scale,width:window.innerWidth/t.scale*3,height:window.innerWidth/t.scale*3,fill:"rgba(0,0,0,0.3)"}),(0,v.jsx)(rQ,{listening:!1,image:I,x:e.x,y:e.y,width:e.a.width,height:e.a.height,rotation:e.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),(0,v.jsxs)(rK,{x:e.x,y:e.y,rotation:e.rotation,scaleX:M,scaleY:M,children:[(0,v.jsx)(rQ,{image:y,ref:l,opacity:.4,draggable:!0,x:-e.cropX*y.width,y:-e.cropY*y.height,onDragMove:V,onTransform:V,onTouchMove:e=>{e.evt.preventDefault();let t=e.target.getStage().getPointersPositions();var n=t[0],r=t[1];let i=e.target;if(n&&!r&&!i.isDragging()&&H.current&&(i.startDrag(),H.current=!1),n&&r){c(R).hitOnDragEnabled=!0,i.isDragging()&&(H.current=!0,i.stopDrag());let t=e.target.getAbsoluteTransform().copy();t.invert();var o={x:n.x,y:n.y},a={x:r.x,y:r.y};if(!B.current){B.current=or(o,a);return}var l=or(o,a),s=Math.sqrt(Math.pow(a.x-o.x,2)+Math.pow(a.y-o.y,2));U.current||(U.current=s);let g=i.position();var u={x:l.x-g.x,y:l.y-g.y},d=s/U.current;i.scaleX(d),i.scaleY(d);let m=t.point(l),v=t.point(B.current);var h=m.x-v.x,f=m.y-v.y,p={x:Math.min(0,l.x-u.x*d+h),y:Math.min(0,l.y-u.y*d+f)};i.position(p),U.current=s,B.current=l,V(e)}},onTouchEnd:e=>{U.current=0,B.current=null,c(R).hitOnDragEnabled=!1}}),(0,v.jsx)(r1,{ref:z,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2}),(0,v.jsx)(rX,{width:n,height:r,ref:D,listening:!1,onTransform:t=>{t.target.x()<-e.cropX*y.width-1e-9&&(t.target.x(-e.cropX*y.width),t.target.scaleX(1)),t.target.y()<-e.cropY*y.height-1e-9&&(t.target.y(-e.cropY*y.height),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/y.width)),r=Math.min(1,Math.max(0,t.target.y()/y.height+e.cropY)),i=t.target.width()*t.target.scaleX(),o=t.target.height()*t.target.scaleY(),a=Math.min(1-n,i/y.width),l=Math.min(1-r,o/y.height),s=t.target.getAbsolutePosition(t.target.getParent().getParent());t.target.scale({x:1,y:1}),t.target.position({x:0,y:0}),e.set({x:s.x,y:s.y,cropX:n,cropY:r,cropWidth:a,cropHeight:l,width:Math.min(i*M,y.width*(1-n)*M),height:Math.min(o*M,y.height*(1-r)*M)})}}),(0,v.jsx)(r1,{ref:F,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,visible:e.resizable,keepRatio:!1,rotateEnabled:!1,anchorFill:"rgb(240, 240, 240)",anchorStrokeWidth:2,borderStrokeWidth:2})]})]}),(s||d)&&(0,v.jsx)(iz,{element:e})]})});var w=g("8NFma"),om=g("1BElU");window,Pl=g("1BElU"),function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,(function(t){return e[t]}).bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */e.exports=function(){let{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object,{freeze:o,seal:a,create:l}=Object,{apply:s,construct:u}="undefined"!=typeof Reflect&&Reflect;s||(s=function(e,t,n){return e.apply(t,n)}),o||(o=function(e){return e}),a||(a=function(e){return e}),u||(u=function(e,t){return new e(...t)});let c=x(Array.prototype.forEach),d=x(Array.prototype.pop),h=x(Array.prototype.push),f=x(String.prototype.toLowerCase),p=x(String.prototype.toString),g=x(String.prototype.match),m=x(String.prototype.replace),v=x(String.prototype.indexOf),y=x(String.prototype.trim),b=x(RegExp.prototype.test),w=(G=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(G,t)});function x(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return s(e,t,r)}}function _(e,r,i){var o;i=null!==(o=i)&&void 0!==o?o:f,t&&t(e,null);let a=r.length;for(;a--;){let t=r[a];if("string"==typeof t){let e=i(t);e!==t&&(n(r)||(r[a]=e),t=e)}e[t]=!0}return e}function E(t){let n=l(null);for(let[r,i]of e(t))n[r]=i;return n}function S(e,t){for(;null!==e;){let n=i(e,t);if(n){if(n.get)return x(n.get);if("function"==typeof n.value)return x(n.value)}e=r(e)}return function(e){return console.warn("fallback value for",e),null}}let C=o(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),O=o(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),k=o(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=o(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),T=o(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),A=o(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),N=o(["#text"]),j=o(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),R=o(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),L=o(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),I=o(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),M=a(/\{\{[\w\W]*|[\w\W]*\}\}/gm),D=a(/<%[\w\W]*|[\w\W]*%>/gm),F=a(/\${[\w\W]*}/gm),z=a(/^data-[\-\w.\u00B7-\uFFFF]/),B=a(/^aria-[\-\w]+$/),U=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),H=a(/^(?:\w+script|data):/i),V=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),q=a(/^html$/i);var G,W=Object.freeze({__proto__:null,MUSTACHE_EXPR:M,ERB_EXPR:D,TMPLIT_EXPR:F,DATA_ATTR:z,ARIA_ATTR:B,IS_ALLOWED_URI:U,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:V,DOCTYPE_NAME:q});let $=()=>"undefined"==typeof window?null:window,K=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;t&&t.hasAttribute("data-tt-policy-suffix")&&(n=t.getAttribute("data-tt-policy-suffix"));let r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};return function t(){let n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$(),i=e=>t(e);if(i.version="3.0.5",i.removed=[],!r||!r.document||9!==r.document.nodeType)return i.isSupported=!1,i;let a=r.document,l=a.currentScript,{document:s}=r,{DocumentFragment:u,HTMLTemplateElement:x,Node:M,Element:D,NodeFilter:F,NamedNodeMap:z=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:B,DOMParser:H,trustedTypes:V}=r,G=D.prototype,Y=S(G,"cloneNode"),X=S(G,"nextSibling"),Z=S(G,"childNodes"),Q=S(G,"parentNode");if("function"==typeof x){let e=s.createElement("template");e.content&&e.content.ownerDocument&&(s=e.content.ownerDocument)}let J,ee="",{implementation:et,createNodeIterator:en,createDocumentFragment:er,getElementsByTagName:ei}=s,{importNode:eo}=a,ea={};i.isSupported="function"==typeof e&&"function"==typeof Q&&et&&void 0!==et.createHTMLDocument;let{MUSTACHE_EXPR:el,ERB_EXPR:es,TMPLIT_EXPR:eu,DATA_ATTR:ec,ARIA_ATTR:ed,IS_SCRIPT_OR_DATA:eh,ATTR_WHITESPACE:ef}=W,{IS_ALLOWED_URI:ep}=W,eg=null,em=_({},[...C,...O,...k,...T,...N]),ev=null,ey=_({},[...j,...R,...L,...I]),eb=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ew=null,ex=null,e_=!0,eE=!0,eS=!1,eC=!0,eO=!1,ek=!1,eP=!1,eT=!1,eA=!1,eN=!1,ej=!1,eR=!0,eL=!1,eI=!0,eM=!1,eD={},eF=null,ez=_({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),eB=null,eU=_({},["audio","video","img","source","image","track"]),eH=null,eV=_({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),eq="http://www.w3.org/1998/Math/MathML",eG="http://www.w3.org/2000/svg",eW="http://www.w3.org/1999/xhtml",e$=eW,eK=!1,eY=null,eX=_({},[eq,eG,eW],p),eZ=["application/xhtml+xml","text/html"],eQ,eJ=null,e0=s.createElement("form"),e1=function(e){return e instanceof RegExp||e instanceof Function},e2=function(e){if(!eJ||eJ!==e){if(e&&"object"==typeof e||(e={}),e=E(e),eQ="application/xhtml+xml"===(n=n=-1===eZ.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE)?p:f,eg="ALLOWED_TAGS"in e?_({},e.ALLOWED_TAGS,eQ):em,ev="ALLOWED_ATTR"in e?_({},e.ALLOWED_ATTR,eQ):ey,eY="ALLOWED_NAMESPACES"in e?_({},e.ALLOWED_NAMESPACES,p):eX,eH="ADD_URI_SAFE_ATTR"in e?_(E(eV),e.ADD_URI_SAFE_ATTR,eQ):eV,eB="ADD_DATA_URI_TAGS"in e?_(E(eU),e.ADD_DATA_URI_TAGS,eQ):eU,eF="FORBID_CONTENTS"in e?_({},e.FORBID_CONTENTS,eQ):ez,ew="FORBID_TAGS"in e?_({},e.FORBID_TAGS,eQ):{},ex="FORBID_ATTR"in e?_({},e.FORBID_ATTR,eQ):{},eD="USE_PROFILES"in e&&e.USE_PROFILES,e_=!1!==e.ALLOW_ARIA_ATTR,eE=!1!==e.ALLOW_DATA_ATTR,eS=e.ALLOW_UNKNOWN_PROTOCOLS||!1,eC=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,eO=e.SAFE_FOR_TEMPLATES||!1,ek=e.WHOLE_DOCUMENT||!1,eA=e.RETURN_DOM||!1,eN=e.RETURN_DOM_FRAGMENT||!1,ej=e.RETURN_TRUSTED_TYPE||!1,eT=e.FORCE_BODY||!1,eR=!1!==e.SANITIZE_DOM,eL=e.SANITIZE_NAMED_PROPS||!1,eI=!1!==e.KEEP_CONTENT,eM=e.IN_PLACE||!1,ep=e.ALLOWED_URI_REGEXP||U,e$=e.NAMESPACE||eW,eb=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&e1(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(eb.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&e1(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(eb.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(eb.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),eO&&(eE=!1),eN&&(eA=!0),eD&&(eg=_({},[...N]),ev=[],!0===eD.html&&(_(eg,C),_(ev,j)),!0===eD.svg&&(_(eg,O),_(ev,R),_(ev,I)),!0===eD.svgFilters&&(_(eg,k),_(ev,R),_(ev,I)),!0===eD.mathMl&&(_(eg,T),_(ev,L),_(ev,I))),e.ADD_TAGS&&(eg===em&&(eg=E(eg)),_(eg,e.ADD_TAGS,eQ)),e.ADD_ATTR&&(ev===ey&&(ev=E(ev)),_(ev,e.ADD_ATTR,eQ)),e.ADD_URI_SAFE_ATTR&&_(eH,e.ADD_URI_SAFE_ATTR,eQ),e.FORBID_CONTENTS&&(eF===ez&&(eF=E(eF)),_(eF,e.FORBID_CONTENTS,eQ)),eI&&(eg["#text"]=!0),ek&&_(eg,["html","head","body"]),eg.table&&(_(eg,["tbody"]),delete ew.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ee=(J=e.TRUSTED_TYPES_POLICY).createHTML("")}else void 0===J&&(J=K(V,l)),null!==J&&"string"==typeof ee&&(ee=J.createHTML(""));o&&o(e),eJ=e}},e3=_({},["mi","mo","mn","ms","mtext"]),e5=_({},["foreignobject","desc","title","annotation-xml"]),e4=_({},["title","style","font","a","script"]),e6=_({},O);_(e6,k),_(e6,P);let e8=_({},T);_(e8,A);let e9=function(e){let t=Q(e);t&&t.tagName||(t={namespaceURI:e$,tagName:"template"});let r=f(e.tagName),i=f(t.tagName);return!!eY[e.namespaceURI]&&(e.namespaceURI===eG?t.namespaceURI===eW?"svg"===r:t.namespaceURI===eq?"svg"===r&&("annotation-xml"===i||e3[i]):!!e6[r]:e.namespaceURI===eq?t.namespaceURI===eW?"math"===r:t.namespaceURI===eG?"math"===r&&e5[i]:!!e8[r]:e.namespaceURI===eW?!(t.namespaceURI===eG&&!e5[i])&&!(t.namespaceURI===eq&&!e3[i])&&!e8[r]&&(e4[r]||!e6[r]):!("application/xhtml+xml"!==n||!eY[e.namespaceURI]))},e7=function(e){h(i.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},te=function(e,t){try{h(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){h(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!ev[e]){if(eA||eN)try{e7(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}}},tt=function(e){let t,r;if(eT)e="<remove></remove>"+e;else{let t=g(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===n&&e$===eW&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let i=J?J.createHTML(e):e;if(e$===eW)try{t=(new H).parseFromString(i,n)}catch(e){}if(!t||!t.documentElement){t=et.createDocument(e$,"template",null);try{t.documentElement.innerHTML=eK?ee:i}catch(e){}}let o=t.body||t.documentElement;return e&&r&&o.insertBefore(s.createTextNode(r),o.childNodes[0]||null),e$===eW?ei.call(t,ek?"html":"body")[0]:ek?t.documentElement:o},tn=function(e){return en.call(e.ownerDocument||e,e,F.SHOW_ELEMENT|F.SHOW_COMMENT|F.SHOW_TEXT,null,!1)},tr=function(e){return"object"==typeof M?e instanceof M:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},ti=function(e,t,n){ea[e]&&c(ea[e],e=>{e.call(i,t,n,eJ)})},to=function(e){let t;if(ti("beforeSanitizeElements",e,null),e instanceof B&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof z)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes))return e7(e),!0;let n=eQ(e.nodeName);if(ti("uponSanitizeElement",e,{tagName:n,allowedTags:eg}),e.hasChildNodes()&&!tr(e.firstElementChild)&&(!tr(e.content)||!tr(e.content.firstElementChild))&&b(/<[/\w]/g,e.innerHTML)&&b(/<[/\w]/g,e.textContent))return e7(e),!0;if(!eg[n]||ew[n]){if(!ew[n]&&tl(n)&&(eb.tagNameCheck instanceof RegExp&&b(eb.tagNameCheck,n)||eb.tagNameCheck instanceof Function&&eb.tagNameCheck(n)))return!1;if(eI&&!eF[n]){let t=Q(e)||e.parentNode,n=Z(e)||e.childNodes;if(n&&t)for(let r=n.length-1;r>=0;--r)t.insertBefore(Y(n[r],!0),X(e))}return e7(e),!0}return e instanceof D&&!e9(e)?(e7(e),!0):("noscript"===n||"noembed"===n||"noframes"===n)&&b(/<\/no(script|embed|frames)/i,e.innerHTML)?(e7(e),!0):(eO&&3===e.nodeType&&(t=m(t=e.textContent,el," "),t=m(t,es," "),t=m(t,eu," "),e.textContent!==t&&(h(i.removed,{element:e.cloneNode()}),e.textContent=t)),ti("afterSanitizeElements",e,null),!1)},ta=function(e,t,n){if(eR&&("id"===t||"name"===t)&&(n in s||n in e0))return!1;if(eE&&!ex[t]&&b(ec,t));else if(e_&&b(ed,t));else if(!ev[t]||ex[t]){if(!(tl(e)&&(eb.tagNameCheck instanceof RegExp&&b(eb.tagNameCheck,e)||eb.tagNameCheck instanceof Function&&eb.tagNameCheck(e))&&(eb.attributeNameCheck instanceof RegExp&&b(eb.attributeNameCheck,t)||eb.attributeNameCheck instanceof Function&&eb.attributeNameCheck(t))||"is"===t&&eb.allowCustomizedBuiltInElements&&(eb.tagNameCheck instanceof RegExp&&b(eb.tagNameCheck,n)||eb.tagNameCheck instanceof Function&&eb.tagNameCheck(n))))return!1}else if(eH[t]);else if(b(ep,m(n,ef,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==v(n,"data:")||!eB[e]){if(eS&&!b(eh,m(n,ef,"")));else if(n)return!1}return!0},tl=function(e){return e.indexOf("-")>0},ts=function(e){let t,n,r,o;ti("beforeSanitizeAttributes",e,null);let{attributes:a}=e;if(!a)return;let l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ev};for(o=a.length;o--;){let{name:s,namespaceURI:u}=t=a[o];if(n="value"===s?t.value:y(t.value),r=eQ(s),l.attrName=r,l.attrValue=n,l.keepAttr=!0,l.forceKeepAttr=void 0,ti("uponSanitizeAttribute",e,l),n=l.attrValue,l.forceKeepAttr||(te(s,e),!l.keepAttr))continue;if(!eC&&b(/\/>/i,n)){te(s,e);continue}eO&&(n=m(n,el," "),n=m(n,es," "),n=m(n,eu," "));let c=eQ(e.nodeName);if(ta(c,r,n)){if(eL&&("id"===r||"name"===r)&&(te(s,e),n="user-content-"+n),J&&"object"==typeof V&&"function"==typeof V.getAttributeType){if(u);else switch(V.getAttributeType(c,r)){case"TrustedHTML":n=J.createHTML(n);break;case"TrustedScriptURL":n=J.createScriptURL(n)}}try{u?e.setAttributeNS(u,s,n):e.setAttribute(s,n),d(i.removed)}catch(e){}}}ti("afterSanitizeAttributes",e,null)},tu=function e(t){let n;let r=tn(t);for(ti("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)ti("uponSanitizeShadowNode",n,null),to(n)||(n.content instanceof u&&e(n.content),ts(n));ti("afterSanitizeShadowDOM",t,null)};return i.sanitize=function(e){let t,n,r,o,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((eK=!e)&&(e="<!-->"),"string"!=typeof e&&!tr(e)){if("function"!=typeof e.toString)throw w("toString is not a function");if("string"!=typeof(e=e.toString()))throw w("dirty is not a string, aborting")}if(!i.isSupported)return e;if(eP||e2(l),i.removed=[],"string"==typeof e&&(eM=!1),eM){if(e.nodeName){let t=eQ(e.nodeName);if(!eg[t]||ew[t])throw w("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof M)1===(n=(t=tt("<!---->")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===n.nodeName||"HTML"===n.nodeName?t=n:t.appendChild(n);else{if(!eA&&!eO&&!ek&&-1===e.indexOf("<"))return J&&ej?J.createHTML(e):e;if(!(t=tt(e)))return eA?null:ej?ee:""}t&&eT&&e7(t.firstChild);let s=tn(eM?e:t);for(;r=s.nextNode();)to(r)||(r.content instanceof u&&tu(r.content),ts(r));if(eM)return e;if(eA){if(eN)for(o=er.call(t.ownerDocument);t.firstChild;)o.appendChild(t.firstChild);else o=t;return(ev.shadowroot||ev.shadowrootmode)&&(o=eo.call(a,o,!0)),o}let c=ek?t.outerHTML:t.innerHTML;return ek&&eg["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&b(q,t.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+t.ownerDocument.doctype.name+">\n"+c),eO&&(c=m(c,el," "),c=m(c,es," "),c=m(c,eu," ")),J&&ej?J.createHTML(c):c},i.setConfig=function(e){e2(e),eP=!0},i.clearConfig=function(){eJ=null,eP=!1},i.isValidAttribute=function(e,t,n){return eJ||e2({}),ta(eQ(e),eQ(t),n)},i.addHook=function(e,t){"function"==typeof t&&(ea[e]=ea[e]||[],h(ea[e],t))},i.removeHook=function(e){if(ea[e])return d(ea[e])},i.removeHooks=function(e){ea[e]&&(ea[e]=[])},i.removeAllHooks=function(){ea={}},i}()}()},function(e,t){e.exports=Pl},function(e,t,n){n.r(t);var r=n(1),i=n.n(r),o=n(0),a=n.n(o);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=i.a.import("modules/clipboard"),p=i.a.import("delta"),g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(s,e);var t,n,r,o=(t=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=h(s);return e=t?Reflect.construct(n,arguments,h(this).constructor):n.apply(this,arguments),e&&("object"===l(e)||"function"==typeof e)?e:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this)});function s(e,t){var n;return function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,s),(n=o.call(this,e,t)).allowed=t.allowed,n.keepSelection=t.keepSelection,n.substituteBlockElements=t.substituteBlockElements,n.magicPasteLinks=t.magicPasteLinks,n.hooks=t.hooks,n}return n=[{key:"onPaste",value:function(e){var t,n,r,o,l,s,u,c,d,h=this;e.preventDefault();var f,g,m,v,y,b=this.quill.getSelection();e.clipboardData&&e.clipboardData.getData||!window.clipboardData||!window.clipboardData.getData?(f=e.clipboardData.getData("text/plain"),g=e.clipboardData.getData("text/html"),m=null===(v=e.clipboardData)||void 0===v||null===(y=v.items)||void 0===y?void 0:y[0]):f=window.clipboardData.getData("Text");var w=(new p).retain(b.index).delete(b.length),x=this.getDOMPurifyOptions(),_=!1,E=f;if(!g&&x.ALLOWED_TAGS.includes("a")&&this.isURL(f)&&b.length>0&&this.magicPasteLinks)E=this.quill.getText(b.index,b.length),w=w.insert(E,{link:f});else if(!g&&x.ALLOWED_TAGS.includes("img")&&m&&"file"===m.kind&&m.type.match(/^image\//i)){var S=m.getAsFile(),C=new FileReader;C.onload=function(e){h.quill.insertEmbed(b.index,"image",e.target.result),h.keepSelection||h.quill.setSelection(b.index+1)},C.readAsDataURL(S)}else g||(_=!0,g=E),"function"==typeof(null===(t=this.hooks)||void 0===t?void 0:t.beforeSanitizeElements)&&a.a.addHook("beforeSanitizeElements",this.hooks.beforeSanitizeElements),"function"==typeof(null===(n=this.hooks)||void 0===n?void 0:n.uponSanitizeElement)&&a.a.addHook("uponSanitizeElement",this.hooks.uponSanitizeElement),"function"==typeof(null===(r=this.hooks)||void 0===r?void 0:r.afterSanitizeElements)&&a.a.addHook("afterSanitizeElements",this.hooks.afterSanitizeElements),"function"==typeof(null===(o=this.hooks)||void 0===o?void 0:o.beforeSanitizeAttributes)&&a.a.addHook("beforeSanitizeAttributes",this.hooks.beforeSanitizeAttributes),"function"==typeof(null===(l=this.hooks)||void 0===l?void 0:l.uponSanitizeAttribute)&&a.a.addHook("uponSanitizeAttribute",this.hooks.uponSanitizeAttribute),"function"==typeof(null===(s=this.hooks)||void 0===s?void 0:s.afterSanitizeAttributes)&&a.a.addHook("afterSanitizeAttributes",this.hooks.afterSanitizeAttributes),"function"==typeof(null===(u=this.hooks)||void 0===u?void 0:u.beforeSanitizeShadowDOM)&&a.a.addHook("beforeSanitizeShadowDOM",this.hooks.beforeSanitizeShadowDOM),"function"==typeof(null===(c=this.hooks)||void 0===c?void 0:c.uponSanitizeShadowNode)&&a.a.addHook("uponSanitizeShadowNode",this.hooks.uponSanitizeShadowNode),"function"==typeof(null===(d=this.hooks)||void 0===d?void 0:d.afterSanitizeShadowDOM)&&a.a.addHook("afterSanitizeShadowDOM",this.hooks.afterSanitizeShadowDOM),_?(E=a.a.sanitize(g,x),w=w.insert(E)):(E=!1!==this.substituteBlockElements?(g=this.substitute(g,x)).innerHTML:a.a.sanitize(g,x),w=w.concat(this.convert(E)));this.quill.updateContents(w,i.a.sources.USER),_||(w=this.convert(E)),this.keepSelection?this.quill.setSelection(b.index,w.length(),i.a.sources.SILENT):this.quill.setSelection(b.index+w.length(),i.a.sources.SILENT),this.quill.scrollIntoView(),a.a.removeAllHooks()}},{key:"getDOMPurifyOptions",value:function(){var e,t,n={};if(null!==(e=this.allowed)&&void 0!==e&&e.tags&&(n.ALLOWED_TAGS=this.allowed.tags),null!==(t=this.allowed)&&void 0!==t&&t.attributes&&(n.ALLOWED_ATTR=this.allowed.attributes),void 0===n.ALLOWED_TAGS||void 0===n.ALLOWED_ATTR){var r,i=!1;void 0===n.ALLOWED_TAGS&&(i=!0,n.ALLOWED_TAGS=["p","br","span"]);var o=!1;void 0===n.ALLOWED_ATTR&&(o=!0,n.ALLOWED_ATTR=["class"]);var a=this.quill.getModule("toolbar");null==a||null===(r=a.controls)||void 0===r||r.forEach(function(e){switch(e[0]){case"bold":i&&(n.ALLOWED_TAGS.push("b"),n.ALLOWED_TAGS.push("strong"));break;case"italic":i&&(n.ALLOWED_TAGS.push("i"),n.ALLOWED_TAGS.push("em"));break;case"underline":i&&n.ALLOWED_TAGS.push("u");break;case"strike":i&&n.ALLOWED_TAGS.push("s");break;case"color":case"background":o&&n.ALLOWED_ATTR.push("style");break;case"script":i&&("super"===e[1].value?n.ALLOWED_TAGS.push("sup"):"sub"===e[1].value&&n.ALLOWED_TAGS.push("sub"));break;case"header":if(i){var t=function(e){"1"===e?n.ALLOWED_TAGS.push("h1"):"2"===e?n.ALLOWED_TAGS.push("h2"):"3"===e?n.ALLOWED_TAGS.push("h3"):"4"===e?n.ALLOWED_TAGS.push("h4"):"5"===e?n.ALLOWED_TAGS.push("h5"):"6"===e&&n.ALLOWED_TAGS.push("h6")};e[1].value?t(e[1].value):e[1].options&&e[1].options.length&&[].forEach.call(e[1].options,function(e){e.value&&t(e.value)})}break;case"code-block":i&&n.ALLOWED_TAGS.push("pre"),o&&n.ALLOWED_ATTR.push("spellcheck");break;case"list":i&&("ordered"===e[1].value?n.ALLOWED_TAGS.push("ol"):"bullet"===e[1].value&&n.ALLOWED_TAGS.push("ul"),n.ALLOWED_TAGS.push("li"));break;case"link":i&&n.ALLOWED_TAGS.push("a"),o&&(n.ALLOWED_ATTR.push("href"),n.ALLOWED_ATTR.push("target"),n.ALLOWED_ATTR.push("rel"));break;case"image":i&&n.ALLOWED_TAGS.push("img"),o&&(n.ALLOWED_ATTR.push("src"),n.ALLOWED_ATTR.push("title"),n.ALLOWED_ATTR.push("alt"));break;case"video":i&&n.ALLOWED_TAGS.push("iframe"),o&&(n.ALLOWED_ATTR.push("frameborder"),n.ALLOWED_ATTR.push("allowfullscreen"),n.ALLOWED_ATTR.push("src"));break;case"blockquote":i&&n.ALLOWED_TAGS.push(e[0])}})}return n}},{key:"substitute",value:function(e,t){var n,r=["h1","h2","h3","h4","h5","h6"],i=["p","div","section","article","fieldset","address","aside","blockquote","canvas","dl","figcaption","figure","footer","form","header","main","nav","noscript","ol","pre","table","tfoot","ul","video"],o=["li","dt","dd","hr"];a.a.addHook("uponSanitizeElement",function(e,a,l){for(var s=0;!n&&s<3;)t.ALLOWED_TAGS.includes(i[s])&&(n=i[s]),++s;if(n&&e.tagName&&!t.ALLOWED_TAGS.includes(e.tagName.toLowerCase())){var u=e.tagName.toLowerCase();r.includes(u)?e.innerHTML="<".concat(n,"><b>").concat(e.innerHTML,"</b></").concat(n,">"):i.includes(u)?e.innerHTML="<".concat(n,">").concat(e.innerHTML,"</").concat(n,">"):o.includes(u)&&(e.innerHTML="".concat(e.innerHTML,"<br>"))}}),e=a.a.sanitize(e,u(u({},t),{RETURN_DOM:!0,WHOLE_DOCUMENT:!1})),a.a.removeAllHooks();var l,s=function(e){var t=document.createElement(e.tagName.toLowerCase()),n=e.attributes;return n.length&&Array.from(n).forEach(function(e){return t.setAttribute(e.nodeName,e.value)}),t},c=0,d=document.createElement("body");return function e(t,n){for(n(t,c),t=c<=1?t.firstChild:void 0;t;)++c,e(t,n),t=t.nextSibling;--c}(e,function(e,t){if(1===t){if(e.tagName&&i.includes(e.tagName.toLowerCase())){l&&(l=void 0);var r=s(e);r.innerHTML=e.innerHTML,d.appendChild(r)}else if(void 0===l&&(l=document.createElement(n),d.appendChild(l)),e.tagName){var o=s(e);e.innerHTML&&(o.innerHTML=e.innerHTML),l.appendChild(o)}else{var a=document.createTextNode(e.textContent);l.appendChild(a)}}}),d}},{key:"isURL",value:function(e){return!!/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+\x2D?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+\x2D?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:(?![\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])[\s\S])*)?$/i.test(e)}}],c(s.prototype,n),r&&c(s,r),s}(f);i.a.register("modules/clipboard",g,!0),t.default=g}]);var x=g("2SBKn"),ov={};Pf=ov,Pp=function(e,t,n,r){var i,o,a,l,s,u,c,d,h,f,p,g,m,v,y,b,w,x,_,E,S,C,O,k,P,T,A,N,j,R,L,I,M,D,F,z,B,U,H,V,q,G,W,$,K,Y,X,Z,Q,J,ee,et,en=(o=[],(i={}).joinUrl=function(t,n){return t?e.resolve(t,n):n},i.getConstantUniqueIdFor=function(e){return 0>o.indexOf(e)&&o.push(e),o.indexOf(e)},i.clone=function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},a=function(e){return"object"==typeof e&&null!==e&&Object.prototype.toString.apply(e).match(/\[object (Canvas|HTMLCanvasElement)\]/i)},i.parseOptionalParameters=function(e){var t={canvas:null,options:{}};return null==e[0]||a(e[0])?(t.canvas=e[0]||null,t.options=i.clone(e[1])):t.options=i.clone(e[0]),t},i),er=(l={},s=function(e,t,n){var r=e[t];return e[t]=function(){var e=Array.prototype.slice.call(arguments);return n.apply(this,[e,r])},r},l.baseUrlRespectingXhr=function(e,t){return function(){var n=new e;return s(n,"open",function(e,n){var r=e.shift(),i=e.shift(),o=en.joinUrl(t,i);return n.apply(this,[r,o].concat(e))}),n}},l.finishNotifyingXhr=function(e){var t,n=0,r=0,i=!1,o=new Promise(function(e){t=function(){n-r<=0&&i&&e({totalCount:n})}}),a=function(){var i=new e;return s(i,"send",function(e,t){return n+=1,t.apply(this,arguments)}),i.addEventListener("load",function(){r+=1,t()}),i};return a.waitForRequestsToFinish=function(){return i=!0,t(),o},a},l),ei=(u={},c=function(e){return Array.prototype.slice.call(e)},u.addClassName=function(e,t){e.className+=" "+t},u.addClassNameRecursively=function(e,t){u.addClassName(e,t),e.parentNode!==e.ownerDocument&&u.addClassNameRecursively(e.parentNode,t)},d=function(e,t){var n=e.parentStyleSheet,r=c(n.cssRules).indexOf(e);n.insertRule(t,r+1),n.deleteRule(r)},h=function(e,t){var n=e.cssText.replace(/^[^\{]+/,"");d(e,t+" "+n)},f=function(e){e.textContent=c(e.sheet.cssRules).reduce(function(e,t){return e+t.cssText},"")},p=function(e){var t=document.implementation.createHTMLDocument(""),n=document.createElement("style");n.textContent=e.textContent,t.body.appendChild(n),e.sheet=n.sheet},g=function(e,t,n){var r="((?:^|[^.#:\\w])|(?=\\W))("+t.join("|")+")(?=\\W|$)";c(e.querySelectorAll("style")).forEach(function(e){void 0===e.sheet&&p(e);var t=c(e.sheet.cssRules).filter(function(e){return e.selectorText&&RegExp(r,"i").test(e.selectorText)});t.length&&(t.forEach(function(e){var t=e.selectorText.replace(RegExp(r,"gi"),function(e,t,r){return t+n(r)});t!==e.selectorText&&h(e,t)}),f(e))})},u.rewriteCssSelectorWith=function(e,t,n){g(e,[t],function(){return n})},u.lowercaseCssTypeSelectors=function(e,t){g(e,t,function(e){return e.toLowerCase()})},u.findHtmlOnlyNodeNames=function(e){var t,n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),r={},i={};do t=n.currentNode.tagName.toLowerCase(),"http://www.w3.org/1999/xhtml"===n.currentNode.namespaceURI?r[t]=!0:i[t]=!0;while(n.nextNode())return Object.keys(r).filter(function(e){return!i[e]})},m={},v=function(e){return Array.prototype.slice.call(e)},y={active:!0,hover:!0,focus:!1,target:!1},m.fakeUserAction=function(e,t,n){var r=e.querySelector(t),i="rasterizehtml"+n;r&&(y[n]?u.addClassNameRecursively(r,i):u.addClassName(r,i),u.rewriteCssSelectorWith(e,":"+n,"."+i))},m.persistInputValues=function(e){var t=e.querySelectorAll("input"),n=e.querySelectorAll("textarea"),r=function(e){return"checkbox"===e.type||"radio"===e.type};v(t).filter(r).forEach(function(e){e.checked?e.setAttribute("checked",""):e.removeAttribute("checked")}),v(t).filter(function(e){return!r(e)}).forEach(function(e){e.setAttribute("value",e.value)}),v(n).forEach(function(e){e.textContent=e.value})},m.rewriteTagNameSelectorsToLowerCase=function(e){u.lowercaseCssTypeSelectors(e,u.findHtmlOnlyNodeNames(e))},m),eo=(b=window,w={},x=function(e,t,n,r){var i=e.createElement(t);return i.style.visibility="hidden",i.style.width=n+"px",i.style.height=r+"px",i.style.position="absolute",i.style.top=-1e4-r+"px",i.style.left=-1e4-n+"px",e.getElementsByTagName("body")[0].appendChild(i),i},w.executeJavascript=function(e,t){return new Promise(function(n){var r=x(b.document,"iframe",t.width,t.height),i=e.outerHTML,o=[],a=t.executeJsTimeout||0,l=function(){b.document.getElementsByTagName("body")[0].removeChild(r)},s=function(){n({document:r.contentDocument,errors:o,cleanUp:l})},u=r.contentWindow.XMLHttpRequest,c=er.finishNotifyingXhr(u),d=er.baseUrlRespectingXhr(c,t.baseUrl);r.onload=function(){(a>0?new Promise(function(e){setTimeout(e,a)}):Promise.resolve()).then(c.waitForRequestsToFinish).then(s)},r.contentDocument.open(),r.contentWindow.XMLHttpRequest=d,r.contentWindow.onerror=function(e){o.push({resourceType:"scriptExecution",msg:e})},r.contentDocument.write("<!DOCTYPE html>"),r.contentDocument.write(i),r.contentDocument.close()})},_=function(e,t,n){var r=e.createElement("iframe");return r.style.width=t+"px",r.style.height=n+"px",r.style.visibility="hidden",r.style.position="absolute",r.style.top=-1e4-n+"px",r.style.left=-1e4-t+"px",r.style.borderWidth=0,r.sandbox="allow-same-origin",r.scrolling="no",r},E=function(e,t,n){var r=Math.floor(e/n),i=Math.floor(t/n);return _(b.document,r,i)},S=function(e,t){var n=e.querySelector(t);if(n)return n;if(e.ownerDocument.querySelector(t)===e)return e;throw{message:"Clipping selector not found"}},C=function(e,t,n,r,i){var o,a,l,s,u,c,d,h,f=Math.max(e.scrollWidth,e.clientWidth),p=Math.max(e.scrollHeight,e.clientHeight);return t?(a=(d=S(e,t).getBoundingClientRect()).top,l=d.left,s=d.width,u=d.height):(a=0,l=0,s=f,u=p),h={width:Math.max((o={width:s,height:u}).width*i,n),height:Math.max(o.height*i,r)},c=b.getComputedStyle(e.ownerDocument.documentElement).fontSize,{left:l,top:a,width:h.width,height:h.height,viewportWidth:f,viewportHeight:p,rootFontSize:c}},O=function(e,t){var n=e.tagName;return t.querySelector(n)},k=function(e){var t=e.tagName.toLowerCase();return"html"===t||"body"===t?e.outerHTML:'<body style="margin: 0;">'+e.outerHTML+"</body>"},w.calculateDocumentContentSize=function(e,t){return new Promise(function(n,r){var i,o=t.zoom||1;i=E(t.width,t.height,o),b.document.getElementsByTagName("body")[0].appendChild(i),i.onload=function(){var a,l=i.contentDocument;try{a=C(O(e,l),t.clip,t.width,t.height,o),n(a)}catch(e){r(e)}finally{b.document.getElementsByTagName("body")[0].removeChild(i)}},i.contentDocument.open(),i.contentDocument.write("<!DOCTYPE html>"),i.contentDocument.write(k(e)),i.contentDocument.close()})},w.parseHtmlFragment=function(e){var t=b.document.implementation.createHTMLDocument("");t.documentElement.innerHTML=e;var n=t.querySelector("body").firstChild;if(!n)throw"Invalid source";return n},P=function(e,t){var n,r,i,o,a=/<html((?:\s+[^>]*)?)>/im.exec(t),l=b.document.implementation.createHTMLDocument("");if(a)for(r=0,n="<div"+a[1]+"></div>",l.documentElement.innerHTML=n,i=l.querySelector("div");r<i.attributes.length;r++)o=i.attributes[r],e.documentElement.setAttribute(o.name,o.value)},w.parseHTML=function(e){var t=b.document.implementation.createHTMLDocument("");return t.documentElement.innerHTML=e,P(t,e),t},T=function(e){try{return n.failOnParseError(e)}catch(e){throw{message:"Invalid source",originalError:e}}},w.validateXHTML=function(e){T(new DOMParser().parseFromString(e,"application/xml"))},A=null,w.loadDocument=function(e,t){return new Promise(function(n,r){var i,o,a=new window.XMLHttpRequest,l=(i=en.joinUrl(t.baseUrl,e),"none"===(o=t.cache)||"repeated"===o?((null===A||"repeated"!==o)&&(A=Date.now()),i+"?_="+A):i),s=function(e){r({message:"Unable to load page",originalError:e})};a.addEventListener("load",function(){200===a.status||0===a.status?n(a.responseXML):s(a.statusText)},!1),a.addEventListener("error",function(e){s(e)},!1);try{a.open("GET",l,!0),a.responseType="document",a.send(null)}catch(e){s(e)}}).then(function(e){return T(e)})},w),ea=(N=window,R={},L=function(e,t){return t?URL.createObjectURL(new Blob([e],{type:"image/svg+xml"})):"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e)},I=function(e){e instanceof Blob&&URL.revokeObjectURL(e)},M='<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"><foreignObject></foreignObject></svg>',D=function(e){return new Promise(function(t,n){var r=document.createElement("canvas"),i=new Image;i.onload=function(){var e=r.getContext("2d");try{e.drawImage(i,0,0),r.toDataURL("image/png"),t(!0)}catch(e){t(!1)}},i.onerror=n,i.src=e})},F=function(){var e=L(M,!0);return D(e).then(function(t){return I(e),!t&&D(L(M,!1)).then(function(e){return e})},function(){return!1})},z=function(){if(N.Blob)try{return new Blob(["<b></b>"],{type:"text/xml"}),!0}catch(e){}return!1},R.renderSvg=function(e){return new Promise(function(t,n){var r,i,o=function(){i.onload=null,i.onerror=null},a=function(){r&&I(r)};(i=new Image).onload=function(){o(),a(),t(i)},i.onerror=function(){a(),n()},(void 0===j&&(j=new Promise(function(e,t){z()&&N.URL?F().then(function(t){e(!t)},function(){t()}):e(!1)})),j).then(function(t){return L(e,t)}).then(function(e){r=e,i.src=r},n)})},R),el=(B={},U=function(e,t){var n=t||1,r={width:e.width,height:e.height,"font-size":e.rootFontSize};return 1!==n&&(r.style="transform:scale("+n+"); transform-origin: 0 0;"),r},H=function(e){var t,n;return t=Math.round(e.viewportWidth),n=Math.round(e.viewportHeight),{x:-e.left,y:-e.top,width:t,height:n}},V=function(e){var t=e.style||"";e.style=t+"float: left;"},q=function(e){e.externalResourcesRequired=!0},G=function(e){var t=Object.keys(e);return t.length?" "+t.map(function(t){return t+'="'+e[t]+'"'}).join(" "):""},W=function(e,n,r){var i=t.serializeToString(e);eo.validateXHTML(i);var o=H(n);return V(o),q(o),'<svg xmlns="http://www.w3.org/2000/svg"'+G(U(n,r))+'><style scoped="">html::-webkit-scrollbar { display: none; }</style><foreignObject'+G(o)+">"+i+"</foreignObject></svg>"},B.getSvgForDocument=function(e,t,n){return ei.rewriteTagNameSelectorsToLowerCase(e),W(e,t,n)},B.drawDocumentAsSvg=function(e,t){return["hover","active","focus","target"].forEach(function(n){t[n]&&ei.fakeUserAction(e,t[n],n)}),eo.calculateDocumentContentSize(e,t).then(function(n){return B.getSvgForDocument(e,n,t.zoom)})},B),es=($={},K=function(e){return{message:"Error rendering page",originalError:e}},Y=function(e){return ea.renderSvg(e).then(function(t){return{image:t,svg:e}},function(e){throw K(e)})},X=function(e,t){try{t.getContext("2d").drawImage(e,0,0)}catch(e){throw K(e)}},$.rasterize=function(e,t,n){var i;return(i=en.clone(n)).inlineScripts=!0===n.executeJs,r.inlineReferences(e,i).then(function(t){return n.executeJs?eo.executeJavascript(e,n).then(function(e){var t=e.document;return ei.persistInputValues(t),{document:t,errors:e.errors,cleanUp:e.cleanUp}}).then(function(e){return{element:e.document.documentElement,errors:t.concat(e.errors),cleanUp:e.cleanUp}}):{element:e,errors:t,cleanUp:function(){}}}).then(function(e){var r;return(r=e.element,el.drawDocumentAsSvg(r,n).then(Y).then(function(e){return t&&X(e.image,t),e})).then(function(t){return e.cleanUp(),{image:t.image,svg:t.svg,errors:e.errors}})})},$);return Z={},Q=function(e,t){var n=e?e.width:300,r=e?e.height:200;return{width:void 0!==t.width?t.width:n,height:void 0!==t.height?t.height:r}},J=function(e){var t,n=Q(e.canvas,e.options);return(t=en.clone(e.options)).width=n.width,t.height=n.height,t},Z.drawDocument=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),n=en.parseOptionalParameters(t),r=e.documentElement?e.documentElement:e;return es.rasterize(r,n.canvas,J(n))},ee=function(e,t,n){var r=eo.parseHTML(e);return Z.drawDocument(r,t,n)},Z.drawHTML=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),n=en.parseOptionalParameters(t);return ee(e,n.canvas,n.options)},et=function(e,t,n){var r=document.implementation.createHTMLDocument("");r.replaceChild(e.documentElement,r.documentElement);var i=n?en.clone(n):{};return n.baseUrl||(i.baseUrl=t),{document:r,options:i}},Z.drawURL=function(){var e,t,n=arguments[0],r=Array.prototype.slice.call(arguments,1),i=en.parseOptionalParameters(r);return e=i.canvas,t=i.options,eo.loadDocument(n,t).then(function(r){var i=et(r,n,t);return Z.drawDocument(i.document,e,i.options)})},Z},void 0===Pf&&void 0!==window&&(Pf=window),"function"==typeof define&&define.amd?define(["url","xmlserializer","sane-domparser-error","inlineresources"],function(e,t,n,r){return Pf.rasterizeHTML=Pp(e,t,n,r)}):ov?ov=Pp(g("kRFNf"),g("l4MZj"),g("lDFX4"),g("6cJtK")):Pf.rasterizeHTML=Pp(Pf.url,Pf.xmlserializer,Pf.sanedomparsererror,Pf.inlineresources);let oy=`
29
+ `;iq.innerHTML="",iq.appendChild(document.createTextNode(n)),JSON.stringify(e)!==JSON.stringify(o)&&a(e)});let s=c(w).useRef(null);c(w).useEffect(()=>{let e=setTimeout(()=>{let e=s.current;if(!e)return;s.current?.focus();let t=i||e.value.length;e.selectionStart=e.selectionEnd=t,r&&(e?.select(),document.execCommand("selectAll",!1,null))});return()=>{clearTimeout(e)}},[]),c(w).useEffect(()=>{window.addEventListener("blur",n);let e=e=>{s.current?.contains(e.target)||n()};return window.addEventListener("touchstart",e),()=>{window.removeEventListener("blur",n),window.removeEventListener("touchstart",e)}},[]);let u=0,d=l.textArr.length*l.lineHeight()*l.fontSize();"middle"===t.verticalAlign&&(u=(t.a.height-d)/2),"bottom"===t.verticalAlign&&(u=t.a.height-d);let h=iM(t.text);return(0,v.jsx)(r8,{children:(0,v.jsx)("textarea",{className:"polotno-input",ref:s,dir:iW(h),style:{...iG,...o,paddingTop:u+"px"},value:h,onChange:e=>{t.set({text:e.target.value})},placeholder:t.placeholder,onBlur:n})})}),iK=e=>{let[t,n]=c(w).useState(!1),r=c(w).useRef(!1);return c(w).useEffect(()=>{var t=!0;return setTimeout(()=>{t&&(e._editModeEnabled&&(r.current=!0),n(!0),setTimeout(()=>{r.current=!1},50))},50),()=>{t=!1}},[]),{editorEnabled:t&&e._editModeEnabled,selectAll:r.current}},iY=(e,t)=>{let[n,r]=c(w).useReducer(e=>e+1,0),i=c(w).useRef(iP(t));return c(w).useLayoutEffect(()=>{if(i.current=iP(t),i.current)return;let n=!0;return(async()=>{i.current=!1,r();let o=iv(`text ${t}`);await e.loadFont(t),setTimeout(o,100),n&&(i.current=!0,r())})(),()=>{n=!1}},[t]),[i.current]},iX=({fontLoaded:e,fontFamily:t,fontSize:n,lineHeight:r})=>c(w).useMemo(()=>{if("number"==typeof r)return r;let e=document.createElement("div");e.style.fontFamily=t,e.style.fontSize=n+"px",e.style.lineHeight=r,e.innerText="Test text",document.body.appendChild(e);let i=e.offsetHeight;return document.body.removeChild(e),i/n},[e,t,n,r]);function iZ(e){let t=c(w).useRef(e),n=c(w).useRef(e);return c(w).useMemo(()=>{n.current=t.current,t.current=e},[e]),n.current}let iQ=N(({element:e,store:t})=>{let n=c(w).useRef(null),r=c(w).useRef(null),{editorEnabled:i,selectAll:o}=iK(e),[a,l]=c(w).useState(!1),[s,u]=c(w).useState(!1),d=c(w).useRef(e.a.height),h=t.selectedElements.indexOf(e)>=0,{textVerticalResizeEnabled:f}=iR,p=iZ(e.fontFamily),[g,m]=c(w).useState([]);c(w).useEffect(()=>{let e=n.current?.textArr??[];JSON.stringify(e)!==JSON.stringify(g)&&m(e)}),c(w).useEffect(()=>{if(e.a.width)return;let t=n.current;t.width(600),e.set({width:1.4*t.getTextWidth()})},[]),c(w).useLayoutEffect(()=>(0,x.autorun)(()=>{iD(n.current,e)}));let[y]=iY(t,e.fontFamily),b=iM(e.text),_=()=>{let e=n.current.clone({height:void 0}),t=Math.ceil(e.fontSize()*e.lineHeight()*e.textArr.length+1);return e.destroy(),t};c(w).useLayoutEffect(()=>{if(!y)return;let{textOverflow:r}=iR;if(!e.a.height){let n=_();t.history.ignore(()=>{e.set({height:n})},!1,!0);return}if("change-font-size"!==r||s||t.isPlaying){if("resize"===r){let r=_();f&&e.a.height<r&&t.history.ignore(()=>{(0,iV.isAlive)(e)&&e.set({height:r}),n.current?.height(r)},!1,!0),f||e.a.height===r||t.history.ignore(()=>{(0,iV.isAlive)(e)&&e.set({height:r}),n.current?.height(r)},!1,!0)}}else{let r=function(e,t){let n=e.fontSize(),r=e.height(),i=iM(t.text),o=t.a.fontSize;e.height(void 0);let a=Math.round(2*t.a.fontSize)-1;for(let n=1;n<a;n++){let n=t.a.height&&e.height()>t.a.height,r=i.split("\n").join(" ").split(/[\s-]+/).reduce((e,t)=>/[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\uFF00-\uFFEF\u4E00-\u9FAF\uAC00-\uD7AF]/.test(t)?e.concat(t.split("")):e.concat(t),[]),a=e.textArr.map(e=>e.text).join(";"),l=r.find(e=>!a.includes(e)||(a=a.replace(e,""),!1));if(!(n||l))break;o-=.5,e.fontSize(o)}return e.fontSize(n),e.height(r),o}(n.current,e);if(r!==e.a.fontSize){t.history.ignore(()=>{e.set({fontSize:r})},!1,!0);return}let i=_();e.a.height===i||f||t.history.ignore(()=>{e.set({height:i})},!1,!0)}}),c(w).useLayoutEffect(()=>{let t=n.current;t&&(t.width(t.width()+1e-8),t._setTextData(),iD(t,e))},[y]);let E=c(w).useRef(null),S=c(w).useRef(0),C=n=>{n.evt.preventDefault(),t.selectedShapes.find(t=>t===e)&&e.contentEditable&&(S.current=function(e){var t,n;let r=e.target,i=((t=r.getAbsoluteTransform().copy()).invert(),n=r.getStage().getPointerPosition(),t.point(n)),o=r.textArr,a=Math.floor(i.y/(r.fontSize()*r.lineHeight())),l=o.slice(0,a).reduce((e,t)=>e+t.text.length,a),s=o[a]??o[0],u=0;return"right"===r.align()?u=r.width()-s.width:"center"===r.align()&&(u=r.width()/2-s.width/2),l+Math.round((i.x-u)/s.width*s.text.length)}(n),e.toggleEditMode())},O=!b&&e.placeholder?.6:e.a.opacity;ih(n,O);let k=iX({fontLoaded:y,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),P=e.selectable||"admin"===t.role,T=ic(e),A=c(w).useMemo(()=>e.backgroundEnabled?function({lines:e,lineHeight:t,width:n,align:r="left",padding:i=0,cornerRadius:o=0}){let a,l;e.forEach((e,t)=>{e.cx=n/2,"right"===r?e.cx=n-e.width/2:"left"===r&&(e.cx=e.width/2),"justify"!==r||e.lastInParagraph||(e.width=n),"justify"===r&&(e.cx=e.width/2)});let s=`M ${e[0]?.cx} ${-i}`;e.forEach((n,r)=>{let{cx:o}=n,a=e[r-1];a&&a.width>n.width?s+=` L ${o+n.width/2+i} ${r*t+i}`:s+=` L ${o+n.width/2+i} ${r*t-i}`;let l=e[r+1];l&&l.width>n.width?s+=` L ${o+n.width/2+i} ${(r+1)*t-i}`:s+=` L ${o+n.width/2+i} ${(r+1)*t+i}`});for(var u,c=e.length-1;c>=0;c--){let n=e[c],{cx:r}=n,o=e[c+1];o&&o.width>n.width?s+=` L ${r-n.width/2-i} ${(c+1)*t-i}`:s+=` L ${r-n.width/2-i} ${(c+1)*t+i}`;let a=e[c-1];a&&a.width>n.width?s+=` L ${r-n.width/2-i} ${c*t+i}`:s+=` L ${r-n.width/2-i} ${c*t-i}`}return(u=function(e){let t=/-?[0-9]*\.?\d+/g;return[...e.matchAll(/[MmLlSsQqLlHhVvCcSsQqTtAaZz]/g)].map(e=>({marker:e[0],index:e.index})).reduceRight((t,n)=>{let r=e.substring(n.index,t.length?t[t.length-1].index:e.length);return t.concat([{marker:n.marker,index:n.index,chunk:r.length>0?r.substr(1,r.length-1):r}])},[]).reverse().flatMap(e=>{let n=e.chunk.match(t),r=n?n.map(parseFloat):[];return function(e,t){let n=[];switch(e.toUpperCase()){case"M":for(let r=0;r<t.length;r+=2){let i;i=e===e.toUpperCase()?0===r?"M":"L":0===r?"m":"l",n.push({marker:i,values:{x:t[r],y:t[r+1]}})}break;case"L":for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case"H":for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:t[r],y:0}});break;case"V":for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:0,y:t[r]}});break;case"C":for(let r=0;r<t.length;r+=6)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x2:t[r+2],y2:t[r+3],x:t[r+4],y:t[r+5]}});break;case"S":for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x2:t[r],y2:t[r+1],x:t[r+2],y:t[r+3]}});break;case"Q":for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x:t[r+2],y:t[r+3]}});break;case"T":for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case"A":for(let r=0;r<t.length;r+=7)n.push({marker:e,values:{radiusX:t[r],radiusY:t[r+1],rotation:t[r+2],largeArc:t[r+3],sweep:t[r+4],x:t[r+5],y:t[r+6]}});break;case"Z":n.push({marker:e,values:{x:0,y:0}})}return n}(e.marker,r)}).map(r7)}(s+=" Z"),a=[],l=[],u.forEach(e=>{"M"===e.marker&&a.push([]),a[a.length-1].push(e)}),a.forEach(e=>{e.map(ie),function e(t,n){let r=["x","y"].every(e=>0===Math.round(Math.abs(t[n].values[e]-t[0].values[e])));"L"===t[n].marker&&r&&(t[n].overlap=!0,e(t,n-1)),"Z"===t[n].marker&&e(t,n-1)}(e,e.length-1);let t="Z"==e[e.length-1].marker;e.filter(e=>!e.overlap).map((e,n,r)=>{let i,a,s;let u=function e(t,n,r){var i;let o=n-1,a=r[(o%(i=r.length)+i)%i];return"Z"!==a.marker?a:e(t,o,r)}(e,n,r),c=function e(t,n,r){var i;let o=n+1,a=r[(o%(i=r.length)+i)%i];return"Z"===a.marker?e(t,o,r):a}(e,n,r),d=it(e.values,u.values),h=it(e.values,c.values),f=h-d,p=180/Math.PI*f,g=Math.min(o,Math.abs(function(e,t,n){let r=ir(e.values,n.values);return Math.min(ir(t.values,e.values),r)}(e,u,c)/2*Math.tan(f/2))),m=(a=0,(s=180/Math.PI*f)<0&&s>=-180||s>180&&s<360?i=ii(f/2,-g):(i=ii(f/2,g),a=1,i===1/0&&(i=g)),{offset:i,sweepFlag:a}),v=m.offset,y=m.sweepFlag,b=(0==n||n==r.length-1)&&!t;switch(e.marker){case"M":case"L":let w=[e.values.x+Math.sin(d)*v,e.values.y+Math.cos(d)*v],x=[e.values.x+Math.sin(h)*v,e.values.y+Math.cos(h)*v];b?l.push({marker:e.marker,values:e.values}):l.push({marker:e.marker,values:{x:parseFloat(w[0].toFixed(3)),y:parseFloat(w[1].toFixed(3))}}),b||"L"!==c.marker&&"M"!==c.marker||l.push({marker:"A",radius:g,values:{radiusX:parseFloat(g.toFixed(3)),radiusY:parseFloat(g.toFixed(3)),rotation:p,largeArc:0,sweep:y,x:parseFloat(x[0].toFixed(3)),y:parseFloat(x[1].toFixed(3))}});break;case"C":case"S":case"Q":case"T":case"A":case"Z":l.push({marker:e.marker,values:e.values})}})}),{path:function(e){let t=["radiusX","radiusY","rotation","largeArc","sweep","x1","y1","x2","y2","x","y"];return e.map(e=>{let n="";if("Z"!==e.marker){let r=Object.keys(e.values);n=t.filter(e=>-1!==r.indexOf(e)).map(t=>e.values[t]).join()}return`${e.marker}${n}`}).join("").trim()}(l),commands:l}).path}({lines:JSON.parse(JSON.stringify(g)),cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*k*.5),lineHeight:k*e.a.fontSize,padding:e.backgroundPadding*(e.a.fontSize*k*.5),width:e.a.width,align:e.align}):"",[e.backgroundEnabled,e.backgroundCornerRadius,e.a.fontSize,k,e.backgroundPadding,e.a.width,e.align,g]),N=iH(),j=0;return"middle"===e.verticalAlign?j=(e.a.height-g.length*k*e.a.fontSize)/2:"bottom"===e.verticalAlign&&(j=e.a.height-g.length*k*e.a.fontSize),(0,v.jsxs)(c(w).Fragment,{children:[(0,v.jsx)(r0,{ref:r,x:e.a.x,y:e.a.y,rotation:e.a.rotation,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity,data:A,fill:e.backgroundColor,offsetY:-j}),(0,v.jsx)(rJ,{ref:n,id:e.id,name:"element",hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,text:b||e.placeholder,...T,stroke:e.stroke,lineJoin:"round",strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:`"${e.fontFamily}", "${p}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:N?e.draggable&&h:e.draggable,preventDefault:!N||h,opacity:O,visible:!e._editModeEnabled,ellipsis:"ellipsis"===iR.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:k,letterSpacing:e.letterSpacing*e.a.fontSize,listening:P,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},onClick:C,onTap:C,onTransformStart:()=>{u(!0),d.current=n.current.height()},onTransform:t=>{let n=t.target;r.current?.setAttrs({x:n.x(),y:n.y(),rotation:n.rotation(),scale:n.scale()});let i=(n.getStage()?.findOne("Transformer")).getActiveAnchor();if("middle-left"===i||"middle-right"===i){let t=n.scaleX(),r=n.width()*t,i=e.a.fontSize,o=r;r<i&&(o=i,E.current&&n.position(E.current)),n.width(o),n.scaleX(1),n.scaleY(1);let a=_();if("ellipsis"!==iR.textOverflow){let t=Math.max(a,d.current);n.height(t),e.set({height:n.height()})}e.set({x:n.x(),y:n.y(),width:n.width(),rotation:n.rotation()}),iD(n,e)}if("top-center"===i||"bottom-center"===i){let n="resize"===iR.textOverflow?_():k*e.a.fontSize;t.target.height(Math.max(n,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}E.current=t.target.position()},onTransformEnd:t=>{let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:Math.round(e.a.fontSize*n),width:Math.ceil(t.target.width()*n),x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*n,shadowBlur:e.shadowBlur*n,shadowOffsetX:e.shadowOffsetX*n,shadowOffsetY:e.shadowOffsetY*n,strokeWidth:e.strokeWidth*n}),r.current?.setAttrs({scaleX:1,scaleY:1}),u(!1)}}),i&&(0,v.jsx)(rK,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,children:(0,v.jsx)(i$,{textNodeRef:n,element:e,selectAll:o,cursorPosition:S.current,onBlur:()=>{e.toggleEditMode(!1)}})}),!s&&(a||h)&&(0,v.jsx)(iz,{element:e})]})});var w=g("8NFma"),x=g("2SBKn"),w=g("8NFma");function iJ(e){let t={fill:"",stroke:""};if(e.getAttribute("fill")&&"none"!==e.getAttribute("fill")&&(t.fill=e.getAttribute("fill")),!t.fill&&e.style.fill&&"none"!==e.style.fill&&(t.fill=e.style.fill),e.getAttribute("stroke")&&(t.stroke=e.getAttribute("stroke")),!t.stroke&&e.style.stroke&&(t.stroke=e.style.stroke),!t.stroke&&!t.fill){let n=e.ownerSVGElement,r=n&&n!==e&&iJ(n);r?.fill==="currentColor"||r?.stroke==="currentColor"||(t.fill="black")}return t}let i0=["path","rect","circle"];function i1(e){for(var t=[],n=e.getElementsByTagName("*"),r=0,i=n.length;r<i;r++){let e=n[r];!function(e){for(;e.parentNode;){if("defs"===e.nodeName)return!0;e=e.parentNode}return!1}(e)&&(null!==e.getAttribute("fill")&&t.push(e),null!==e.getAttribute("stroke")?t.push(e):e.style&&e.style.fill?t.push(e):i0.indexOf(e.nodeName)>=0&&t.push(e))}return t}async function i2(e){let t=await fetch(e);return i5(await t.text())}async function i3(e){let t=await fetch(e,{mode:"cors"});return await t.text()}function i5(e){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(e)))}async function i4(e){let t=await i3(e),n=new DOMParser().parseFromString(t,"image/svg+xml").documentElement.getAttribute("viewBox"),[r,i,o,a]=n?.split(" ")||[];return{width:parseFloat(o),height:parseFloat(a)}}function i6(e){var t=new DOMParser().parseFromString(e,"image/svg+xml");let n=t.documentElement.getAttribute("viewBox"),[r,i,o,a]=n?.split(" ")||[],l=t.documentElement.getAttribute("width");l||t.documentElement.setAttribute("width",o+"px");let s=t.documentElement.getAttribute("height");if((!s||s.indexOf("%")>=0)&&t.documentElement.setAttribute("height",a+"px"),l&&l.indexOf("%")>=0&&s&&-1===s.indexOf("%")){let e=parseFloat(s)/parseFloat(a);t.documentElement.setAttribute("width",e*parseFloat(o)+"px")}if(s&&s.indexOf("%")>=0&&l&&-1===l.indexOf("%")){let e=parseFloat(l)/parseFloat(o);t.documentElement.setAttribute("height",e*parseFloat(a)+"px")}return"100%"===l&&"100%"===s&&(t.documentElement.setAttribute("width",o+"px"),t.documentElement.setAttribute("height",a+"px")),new XMLSerializer().serializeToString(t)}let i8=(e,t)=>{if(!e||!t)return!1;if("currentColor"===t&&"black"===e)return!0;let n=c(R).Util.colorToRGBA(e),r=c(R).Util.colorToRGBA(t);if(n&&r)return n.r===r.r&&n.g===r.g&&n.b===r.b&&n.a===r.a};function i9(e,t){var n=new DOMParser().parseFromString(e,"image/svg+xml");let r=i1(n),i=Array.from(t.keys());return r.forEach(e=>{let{fill:r,stroke:o}=iJ(e);[{prop:"fill",color:r},{prop:"stroke",color:o}].forEach(({prop:r,color:o})=>{let a=i.find(e=>i8(e,o));if(a){let i=t.get(a);if(il(i)){let{rotation:t,stops:o}=iu(i),a=o.map(e=>({offset:100*e.offset+"%","stop-color":e.color})),l="color"+Math.round(1e8*Math.random());(function(e,t,n,r){var i=e.namespaceURI,o=document.createElementNS(i,"linearGradient");let a=c(R).Util.degToRad(n+90),l=(Math.cos(a)+1)/2,s=(Math.sin(a)+1)/2,u=(Math.cos(a+Math.PI)+1)/2,d=(Math.sin(a+Math.PI)+1)/2;o.setAttribute("x1",100*l+"%"),o.setAttribute("y1",100*s+"%"),o.setAttribute("x2",100*u+"%"),o.setAttribute("y2",100*d+"%"),o.setAttribute("gradientUnits","userSpaceOnUse"),o.setAttribute("id",t);for(var h=0;h<r.length;h++){var f=r[h],p=document.createElementNS(i,"stop");for(var g in f)f.hasOwnProperty(g)&&p.setAttribute(g,f[g]);o.appendChild(p)}(e.querySelector("defs")||e.insertBefore(document.createElementNS(i,"defs"),e.firstChild)).appendChild(o)})(n.children[0],l,t,a),e.style[r]=null,e.setAttribute(r,`url('#${l}')`)}else e.style[r]=t.get(a)}})}),i5(new XMLSerializer().serializeToString(n))}let i7=e=>{let[t,n]=c(w).useState([]);return c(w).useEffect(()=>{let t=!1;return(async()=>{n([]);let r=function(e){let t=i1(new DOMParser().parseFromString(e,"image/svg+xml")),n=[];return t.forEach(e=>{let{fill:t,stroke:r}=iJ(e);[t,r].forEach(e=>{e&&("currentColor"===e&&(e="black"),c(R).Util.colorToRGBA(e)&&-1===n.indexOf(e)&&n.push(e))})}),n}(await i3(e));t||n(r)})(),()=>{t=!0}},[e]),t};function oe(){return document.createElement("canvas")}async function ot(e){return e.indexOf("data:image/svg+xml")>=0||e.indexOf(".svg")>=0?i5(i6(await i3(e))):e}let on=e=>{let[t,n]=c(w).useState(e);return c(w).useEffect(()=>{(async()=>{let r=await ot(e);r!==t&&n(r)})()},[e]),t};function or(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}let oi=(e,t,n)=>{let r=c(w).useMemo(()=>{let{flipX:r,flipY:i}=e,o="svg"===e.type||e.src.indexOf("data:image/svg+xml")>=0||e.src.indexOf(".svg")>=0,a=navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&o||e.maskSrc;if(!r&&!i&&!a)return t;if(!t||!t.width||!t.height)return null;let l=oe(),s=1;"svg"===e.type&&(s=Math.max(e.a.width/t.width*n,e.a.height/t.height*n)),l.width=Math.max(t.width*s,1),l.height=Math.max(t.height*s,1);let u=r?-l.width:0,c=i?-l.height:0;return l.getContext("2d")?.scale(r?-1:1,i?-1:1),l.getContext("2d")?.drawImage(t,u,c,l.width,l.height),l},[e.maskSrc,e.flipX,e.flipY,t,e.a.width,e.a.height,n]);return c(w).useEffect(()=>()=>{r&&"CANVAS"===r.nodeName&&c(R).Util.releaseCanvas(r)},[r]),r},oo=(e,t)=>{let[n,r]=od(e.maskSrc,"anonymous");return oh(e.maskSrc?r:"loaded",e.id+"-mask"),c(w).useMemo(()=>{if(!n||!t||!t.width||!t.height)return t;let r=oe();r.width=Math.max(t.width,1),r.height=Math.max(t.height,1);let i=r.getContext("2d");if(!i)return t;i.drawImage(t,0,0),i.globalCompositeOperation="source-in";let o=function(e,t){let n,r;let i=t.width/t.height;return i>=e.width/e.height?(n=e.width,r=e.width/i):(n=e.height*i,r=e.height),{x:(e.width-n)/2,y:(e.height-r)/2,width:n,height:r}}(n,e);return i.drawImage(n,o.x,o.y,o.width,o.height,0,0,t.width,t.height),r},[t,n,e.a.width,e.a.height])},oa=(e,t,n,r,i=0,o=!1)=>{let a=Math.floor(Math.max(e.a.width*r,1)),l=Math.floor(Math.max(e.a.height*r,1)),s=Math.min(i*r,a/2,l/2),u=Math.max(e.a.width/n.width,e.a.height/n.height)*r,d=e.page._exportingOrRendering&&iR.imageDownScalingEnabled&&u<1&&!o,h=0===n.x&&0===n.y&&n.width===t?.width&&n.height===t?.height,f=c(w).useMemo(()=>{if(!t||!t.width||!t.height)return;let e=0===s,n=!d;if(!h||!e||!n)return oe()},[t,s,d,h]);return c(w).useLayoutEffect(()=>{if(!f||!t)return;f.width=a,f.height=l;let e=f.getContext("2d");if(!e)return;s&&(e.beginPath(),e.moveTo(s,0),e.lineTo(a-s,0),e.arc(a-s,s,s,3*Math.PI/2,0,!1),e.lineTo(a,l-s),e.arc(a-s,l-s,s,0,Math.PI/2,!1),e.lineTo(s,l),e.arc(s,l-s,s,Math.PI/2,Math.PI,!1),e.lineTo(0,s),e.arc(s,s,s,Math.PI,3*Math.PI/2,!1),e.clip());let r=d?function(e,t){let n=oe();n.width=e.width,n.height=e.height;let r=Math.max(1,Math.floor(n.width*t)),i=Math.max(1,Math.floor(n.height*t));n.getContext("2d")?.drawImage(e,0,0,n.width,n.height);let o=function(e,t,n,r,i,o,a){for(var l=new ImageData(t,n),s=new Int32Array(e.data.buffer),u=e.width,c=new Int32Array(l.data.buffer),d=l.width,h=t/o,f=n/a,p=Math.round(1/h),g=Math.round(1/f),m=p*g,v=0;v<l.height;v++)for(var y=0;y<d;y++){for(var b=0+Math.round(y/h)+(0+Math.round(v/f))*u,w=0,x=0,_=0,E=0,S=0;S<g;S++)for(var C=0;C<p;C++){var O=s[b+C+S*u];w+=O<<24>>>24,x+=O<<16>>>24,_+=O<<8>>>24,E+=O>>>24}w=Math.round(w/m),x=Math.round(x/m),_=Math.round(_/m),E=Math.round(E/m),c[y+v*d]=E<<24|_<<16|x<<8|w}return l}(n.getContext("2d").getImageData(0,0,n.width,n.height),r,i,0,0,n.width,n.height);return n.width=r,n.height=i,n.getContext("2d")?.putImageData(o,0,0),n}(t,u):t,i=d?{x:Math.floor(n.x*u),y:Math.floor(n.y*u),width:Math.floor(n.width*u),height:Math.floor(n.height*u)}:n;e.drawImage(r,i.x,i.y,i.width,i.height,0,0,f.width,f.height)},[f,e.a.width,e.a.height,n.x,n.y,n.width,n.height,i,r,o,e.page._exportingOrRendering,d]),c(w).useEffect(()=>()=>{f&&"CANVAS"===f.nodeName&&c(R).Util.releaseCanvas(f)},[f]),f||t},ol=(e,t,n,r)=>{let[i,o]=od(on(e.clipSrc||""),"anonymous");oh(e.clipSrc?o:"loaded",e.id+"-clip");let a=c(w).useMemo(()=>{if(t&&i)return oe()},[t,i]);return c(w).useLayoutEffect(()=>{if(!i||!t||!t.width||!t.height||!i||!i.width||!i.height||!a)return;let r=oe(),o=Math.max(e.a.width/i.width*n,e.a.height/i.height*n);r.width=i.width*o,r.height=i.height*o,r.getContext("2d")?.drawImage(i,0,0,r.width,r.height),a.width=Math.max(t.width,1),a.height=Math.max(t.height,1);let l=a.getContext("2d");l&&(l.save(),l.drawImage(r,0,0,t.width,t.height),c(R).Util.releaseCanvas(r),l.globalCompositeOperation="source-in",l.drawImage(t,0,0,a.width,a.height),l.restore())},[a,t,i,e.a.width,e.a.height,n,...r]),e.clipSrc&&i?a:t},os=oe(),ou=N(({element:e})=>{let t=Math.min(30,e.a.width/4,e.a.height/4),n=c(w).useRef(null);return c(w).useEffect(()=>{let e=n.current;if(!e)return;let t=new(c(R)).Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}}),(0,v.jsxs)(rK,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,v.jsx)(rX,{width:e.a.width,height:e.a.height,fill:"rgba(124, 173, 212, 0.8)"}),(0,v.jsx)("Arc",{ref:n,x:e.a.width/2,y:e.a.height/2,fill:"white",outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})}),oc=N(({element:e})=>{let t="Can not load the image...",n=Math.max(10,Math.min(30,e.a.width/t.length));return(0,v.jsxs)(rK,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,v.jsx)(rX,{width:e.a.width,height:e.a.height,fill:"rgba(223, 102, 102, 0.8)"}),(0,v.jsx)(rJ,{text:t,fontSize:n,width:e.a.width,height:e.a.height,align:"center",fill:"white",verticalAlign:"middle",padding:5})]})}),od=c(r5),oh=(e,t)=>{let n=c(w).useRef(),r=()=>{n.current?.(),n.current=void 0};c(w).useEffect(()=>r,[]),c(w).useLayoutEffect(()=>{"loading"!==e||n.current||(n.current=iv(`image ${t}`)),"loading"!==e&&r(),"failed"===e&&iw(`image ${t}`)},[e])},of=({image:e,status:t,type:n})=>{let r=c(w).useRef();return c(w).useEffect(()=>{r.current=e||r.current},[e]),"failed"!==t||"failed"!==t&&"svg"===n?r.current:void 0},op=e=>{let[t,n]=c(w).useReducer(e=>e+1,0),r=c(w).useRef("loading"),i=c(w).useRef(e.src),o=c(w).useRef(e.src);return(o.current!==e.src&&(o.current=e.src,r.current="loading"),c(w).useEffect(()=>{if("svg"!==e.type||!e.src)return;let t=!1;return(async()=>{r.current="loading",n();let o=i9(i6(await i3(e.src)),e.colorsReplace);t||(i.current=o,r.current="loaded",n())})(),()=>{t=!0}},[e.src,JSON.stringify(e.colorsReplace)]),"svg"!==e.type)?[e.src,"loaded"]:[i.current,r.current]},og=N(({element:e,store:t})=>{let n,r;let[i,o]=c(w).useState(!1),a=c(w).useRef(null),l=c(w).useRef(null),[s,u]=c(w).useState(!1),d=t.selectedElements.indexOf(e)>=0,[h,f]=op(e),[p,g]=od(h,"anonymous");oh("svg"!==e.type||"loaded"===f?g:"loading",e.id);let m=of({image:p,status:g,type:e.type}),y=oo(e,oi(e,p||m,t._elementsPixelRatio))||os,{cropX:b,cropY:_,cropWidth:E,cropHeight:S}=e;"loaded"!==g&&(b=_=0,E=S=1);let C=y.width*E,O=y.height*S,k=e.a.width/e.a.height,P=C/O,T="svg"===e.type;T?(n=C,r=O):k>=P?(n=C,r=C/k):(n=O*k,r=O);let A={x:y.width*b,y:y.height*_,width:n,height:r},N=e.cornerRadius??0,j=e.page._exportingOrRendering?1:Math.min(2,t.scale),L=t._elementsPixelRatio*j,I=ol(e,oa(e,y,A,L,N,i||e._cropModeEnabled||"svg"===e.type),L,[A,N,L]),M=Math.max(e.a.width/n,e.a.height/r);c(w).useEffect(()=>{if(!e._cropModeEnabled)return;let t=a.current?.getStage();function n(t){e._cropModeEnabled&&t.target!==l.current&&e.toggleCropMode(!1)}function r(n){e._cropModeEnabled&&n.target.parentNode!==t.content&&e.toggleCropMode(!1)}return document.body.addEventListener("click",r),t?.on("click",n),t?.on("tap",n),()=>{document.body.removeEventListener("click",r),document.body.removeEventListener("touchstart",r),t?.off("click",n),t?.off("click",n)}},[e._cropModeEnabled]),c(w).useLayoutEffect(()=>{if(!i&&!e._cropModeEnabled)return iD(a.current,e),(0,x.autorun)(()=>{iD(a.current,e)},{delay:100})},[I,e.page._exportingOrRendering,i,E,S,e._cropModeEnabled]),c(w).useLayoutEffect(()=>{i||e._cropModeEnabled?a.current?.clearCache():iD(a.current,e)},[i,e.a.width,e.a.height,e._cropModeEnabled]),c(w).useEffect(()=>{iD(a.current,e)},[e.shadowEnabled,e.shadowBlur,e.cornerRadius,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let D=c(w).useRef(null),F=c(w).useRef(null),z=c(w).useRef(null);c(w).useLayoutEffect(()=>{e._cropModeEnabled&&(F.current.nodes([D.current]),z.current.nodes([l.current]))},[e._cropModeEnabled]);var B=c(w).useRef(null),U=c(w).useRef(0),H=c(w).useRef(!1);let V=t=>{t.evt.touches?.length>2&&t.target.stopDrag(),Math.round(t.target.x())>0&&(t.target.x(0),t.target.scaleX(1)),Math.round(t.target.y())>0&&(t.target.y(0),t.target.scaleY(1));let i=t.target.width()*t.target.scaleX(),o=t.target.height()*t.target.scaleY(),a=Math.min(1,n/i),l=Math.min(1,r/o),s=Math.min(1-a,Math.max(0,Math.round(-t.target.x())/i)),u=Math.min(1-l,Math.max(0,Math.round(-t.target.y())/o));t.target.setAttrs({x:-s*y.width,y:-u*y.height,scaleX:1,scaleY:1}),e.set({cropX:s,cropY:u,cropWidth:a,cropHeight:l})},q=()=>{"svg"!==e.type&&e.contentEditable&&setTimeout(()=>{e.toggleCropMode(!0)})},G="svg"===e.type&&m,W="loading"===g&&!G,$="failed"===g,K=!W&&!$,Y=c(w).useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),X=K?e.a.opacity:0;ih(a,X);let Z=e.selectable||"admin"===t.role,Q=iH();return(0,v.jsxs)(c(w).Fragment,{children:[W&&(0,v.jsx)(ou,{element:e}),$&&(0,v.jsx)(oc,{element:e}),(0,v.jsx)(rQ,{ref:a,name:"element",id:e.id,image:I,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.rotation,opacity:X,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:A,listening:Z,draggable:Q?e.draggable&&d:e.draggable,preventDefault:!Q||d,hideInExport:!e.showInExport,onMouseEnter:()=>{u(!0)},onMouseLeave:()=>{u(!1)},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDblClick:q,onDblTap:q,onTransformStart:()=>{o(!0),Y.current={cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight}},onTransform:t=>{let i=t.currentTarget,o=1e-7>Math.abs(i.scaleX()-1)?1:i.scaleX(),a=1e-7>Math.abs(i.scaleY()-1)?1:i.scaleY();i.scaleX(1),i.scaleY(1);let l=t.target.getStage()?.findOne("Transformer"),s=Math.min(1-n/y.width,Math.max(0,e.cropX)),u=Math.min(1-r/y.height,Math.max(0,e.cropY)),c=l.getActiveAnchor(),d=!(c.indexOf("middle")>=0||c.indexOf("center")>=0),h=!d&&o<1&&Y.current.cropHeight>r/y.height,f=d?e.cropWidth:e.cropWidth*o;h&&(f=e.cropWidth);let p=!d&&a<1&&Y.current.cropWidth>n/y.width,g=d?e.cropHeight:e.cropHeight*a;p&&(g=e.cropHeight),T&&(f=e.cropWidth,g=e.cropHeight),e.set({cropX:s,cropY:u,x:i.x(),y:i.y(),width:i.width()*o,height:i.height()*a,rotation:t.target.rotation(),cropWidth:Math.min(f,1-s),cropHeight:Math.min(g,1-u)})},onTransformEnd:t=>{let i=t.currentTarget;e.set({width:i.width(),height:i.height(),x:i.x(),y:i.y(),rotation:t.target.rotation(),cropWidth:n/y.width,cropHeight:r/y.height}),o(!1)}}),(0,v.jsx)(rX,{x:e.x,y:e.y,width:Math.max(e.a.width-e.borderSize,0),height:Math.max(e.a.height-e.borderSize,0),opacity:X,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,stroke:e.borderColor,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,N-e.borderSize),hideInExport:!e.showInExport}),e._cropModeEnabled&&(0,v.jsxs)(r9,{selector:".page-abs-container",enabled:!0,children:[(0,v.jsx)(rX,{x:-window.innerWidth/t.scale,y:-window.innerWidth/t.scale,width:window.innerWidth/t.scale*3,height:window.innerWidth/t.scale*3,fill:"rgba(0,0,0,0.3)"}),(0,v.jsx)(rQ,{listening:!1,image:I,x:e.x,y:e.y,width:e.a.width,height:e.a.height,rotation:e.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),(0,v.jsxs)(rK,{x:e.x,y:e.y,rotation:e.rotation,scaleX:M,scaleY:M,children:[(0,v.jsx)(rQ,{image:y,ref:l,opacity:.4,draggable:!0,x:-e.cropX*y.width,y:-e.cropY*y.height,onDragMove:V,onTransform:V,onTouchMove:e=>{e.evt.preventDefault();let t=e.target.getStage().getPointersPositions();var n=t[0],r=t[1];let i=e.target;if(n&&!r&&!i.isDragging()&&H.current&&(i.startDrag(),H.current=!1),n&&r){c(R).hitOnDragEnabled=!0,i.isDragging()&&(H.current=!0,i.stopDrag());let t=e.target.getAbsoluteTransform().copy();t.invert();var o={x:n.x,y:n.y},a={x:r.x,y:r.y};if(!B.current){B.current=or(o,a);return}var l=or(o,a),s=Math.sqrt(Math.pow(a.x-o.x,2)+Math.pow(a.y-o.y,2));U.current||(U.current=s);let g=i.position();var u={x:l.x-g.x,y:l.y-g.y},d=s/U.current;i.scaleX(d),i.scaleY(d);let m=t.point(l),v=t.point(B.current);var h=m.x-v.x,f=m.y-v.y,p={x:Math.min(0,l.x-u.x*d+h),y:Math.min(0,l.y-u.y*d+f)};i.position(p),U.current=s,B.current=l,V(e)}},onTouchEnd:e=>{U.current=0,B.current=null,c(R).hitOnDragEnabled=!1}}),(0,v.jsx)(r1,{ref:z,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2}),(0,v.jsx)(rX,{width:n,height:r,ref:D,listening:!1,onTransform:t=>{t.target.x()<-e.cropX*y.width-1e-9&&(t.target.x(-e.cropX*y.width),t.target.scaleX(1)),t.target.y()<-e.cropY*y.height-1e-9&&(t.target.y(-e.cropY*y.height),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/y.width)),r=Math.min(1,Math.max(0,t.target.y()/y.height+e.cropY)),i=t.target.width()*t.target.scaleX(),o=t.target.height()*t.target.scaleY(),a=Math.min(1-n,i/y.width),l=Math.min(1-r,o/y.height),s=t.target.getAbsolutePosition(t.target.getParent().getParent());t.target.scale({x:1,y:1}),t.target.position({x:0,y:0}),e.set({x:s.x,y:s.y,cropX:n,cropY:r,cropWidth:a,cropHeight:l,width:Math.min(i*M,y.width*(1-n)*M),height:Math.min(o*M,y.height*(1-r)*M)})}}),(0,v.jsx)(r1,{ref:F,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,visible:e.resizable,keepRatio:!1,rotateEnabled:!1,anchorFill:"rgb(240, 240, 240)",anchorStrokeWidth:2,borderStrokeWidth:2})]})]}),(s||d)&&(0,v.jsx)(iz,{element:e})]})});var w=g("8NFma"),om=g("1BElU");window,Pl=g("1BElU"),function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,(function(t){return e[t]}).bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */e.exports=function(){let{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object,{freeze:o,seal:a,create:l}=Object,{apply:s,construct:u}="undefined"!=typeof Reflect&&Reflect;s||(s=function(e,t,n){return e.apply(t,n)}),o||(o=function(e){return e}),a||(a=function(e){return e}),u||(u=function(e,t){return new e(...t)});let c=x(Array.prototype.forEach),d=x(Array.prototype.pop),h=x(Array.prototype.push),f=x(String.prototype.toLowerCase),p=x(String.prototype.toString),g=x(String.prototype.match),m=x(String.prototype.replace),v=x(String.prototype.indexOf),y=x(String.prototype.trim),b=x(RegExp.prototype.test),w=(G=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(G,t)});function x(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return s(e,t,r)}}function _(e,r,i){var o;i=null!==(o=i)&&void 0!==o?o:f,t&&t(e,null);let a=r.length;for(;a--;){let t=r[a];if("string"==typeof t){let e=i(t);e!==t&&(n(r)||(r[a]=e),t=e)}e[t]=!0}return e}function E(t){let n=l(null);for(let[r,i]of e(t))n[r]=i;return n}function S(e,t){for(;null!==e;){let n=i(e,t);if(n){if(n.get)return x(n.get);if("function"==typeof n.value)return x(n.value)}e=r(e)}return function(e){return console.warn("fallback value for",e),null}}let C=o(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),O=o(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),k=o(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=o(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),T=o(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),A=o(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),N=o(["#text"]),j=o(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),R=o(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),L=o(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),I=o(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),M=a(/\{\{[\w\W]*|[\w\W]*\}\}/gm),D=a(/<%[\w\W]*|[\w\W]*%>/gm),F=a(/\${[\w\W]*}/gm),z=a(/^data-[\-\w.\u00B7-\uFFFF]/),B=a(/^aria-[\-\w]+$/),U=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),H=a(/^(?:\w+script|data):/i),V=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),q=a(/^html$/i);var G,W=Object.freeze({__proto__:null,MUSTACHE_EXPR:M,ERB_EXPR:D,TMPLIT_EXPR:F,DATA_ATTR:z,ARIA_ATTR:B,IS_ALLOWED_URI:U,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:V,DOCTYPE_NAME:q});let $=()=>"undefined"==typeof window?null:window,K=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;t&&t.hasAttribute("data-tt-policy-suffix")&&(n=t.getAttribute("data-tt-policy-suffix"));let r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};return function t(){let n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$(),i=e=>t(e);if(i.version="3.0.5",i.removed=[],!r||!r.document||9!==r.document.nodeType)return i.isSupported=!1,i;let a=r.document,l=a.currentScript,{document:s}=r,{DocumentFragment:u,HTMLTemplateElement:x,Node:M,Element:D,NodeFilter:F,NamedNodeMap:z=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:B,DOMParser:H,trustedTypes:V}=r,G=D.prototype,Y=S(G,"cloneNode"),X=S(G,"nextSibling"),Z=S(G,"childNodes"),Q=S(G,"parentNode");if("function"==typeof x){let e=s.createElement("template");e.content&&e.content.ownerDocument&&(s=e.content.ownerDocument)}let J,ee="",{implementation:et,createNodeIterator:en,createDocumentFragment:er,getElementsByTagName:ei}=s,{importNode:eo}=a,ea={};i.isSupported="function"==typeof e&&"function"==typeof Q&&et&&void 0!==et.createHTMLDocument;let{MUSTACHE_EXPR:el,ERB_EXPR:es,TMPLIT_EXPR:eu,DATA_ATTR:ec,ARIA_ATTR:ed,IS_SCRIPT_OR_DATA:eh,ATTR_WHITESPACE:ef}=W,{IS_ALLOWED_URI:ep}=W,eg=null,em=_({},[...C,...O,...k,...T,...N]),ev=null,ey=_({},[...j,...R,...L,...I]),eb=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ew=null,ex=null,e_=!0,eE=!0,eS=!1,eC=!0,eO=!1,ek=!1,eP=!1,eT=!1,eA=!1,eN=!1,ej=!1,eR=!0,eL=!1,eI=!0,eM=!1,eD={},eF=null,ez=_({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),eB=null,eU=_({},["audio","video","img","source","image","track"]),eH=null,eV=_({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),eq="http://www.w3.org/1998/Math/MathML",eG="http://www.w3.org/2000/svg",eW="http://www.w3.org/1999/xhtml",e$=eW,eK=!1,eY=null,eX=_({},[eq,eG,eW],p),eZ=["application/xhtml+xml","text/html"],eQ,eJ=null,e0=s.createElement("form"),e1=function(e){return e instanceof RegExp||e instanceof Function},e2=function(e){if(!eJ||eJ!==e){if(e&&"object"==typeof e||(e={}),e=E(e),eQ="application/xhtml+xml"===(n=n=-1===eZ.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE)?p:f,eg="ALLOWED_TAGS"in e?_({},e.ALLOWED_TAGS,eQ):em,ev="ALLOWED_ATTR"in e?_({},e.ALLOWED_ATTR,eQ):ey,eY="ALLOWED_NAMESPACES"in e?_({},e.ALLOWED_NAMESPACES,p):eX,eH="ADD_URI_SAFE_ATTR"in e?_(E(eV),e.ADD_URI_SAFE_ATTR,eQ):eV,eB="ADD_DATA_URI_TAGS"in e?_(E(eU),e.ADD_DATA_URI_TAGS,eQ):eU,eF="FORBID_CONTENTS"in e?_({},e.FORBID_CONTENTS,eQ):ez,ew="FORBID_TAGS"in e?_({},e.FORBID_TAGS,eQ):{},ex="FORBID_ATTR"in e?_({},e.FORBID_ATTR,eQ):{},eD="USE_PROFILES"in e&&e.USE_PROFILES,e_=!1!==e.ALLOW_ARIA_ATTR,eE=!1!==e.ALLOW_DATA_ATTR,eS=e.ALLOW_UNKNOWN_PROTOCOLS||!1,eC=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,eO=e.SAFE_FOR_TEMPLATES||!1,ek=e.WHOLE_DOCUMENT||!1,eA=e.RETURN_DOM||!1,eN=e.RETURN_DOM_FRAGMENT||!1,ej=e.RETURN_TRUSTED_TYPE||!1,eT=e.FORCE_BODY||!1,eR=!1!==e.SANITIZE_DOM,eL=e.SANITIZE_NAMED_PROPS||!1,eI=!1!==e.KEEP_CONTENT,eM=e.IN_PLACE||!1,ep=e.ALLOWED_URI_REGEXP||U,e$=e.NAMESPACE||eW,eb=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&e1(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(eb.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&e1(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(eb.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(eb.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),eO&&(eE=!1),eN&&(eA=!0),eD&&(eg=_({},[...N]),ev=[],!0===eD.html&&(_(eg,C),_(ev,j)),!0===eD.svg&&(_(eg,O),_(ev,R),_(ev,I)),!0===eD.svgFilters&&(_(eg,k),_(ev,R),_(ev,I)),!0===eD.mathMl&&(_(eg,T),_(ev,L),_(ev,I))),e.ADD_TAGS&&(eg===em&&(eg=E(eg)),_(eg,e.ADD_TAGS,eQ)),e.ADD_ATTR&&(ev===ey&&(ev=E(ev)),_(ev,e.ADD_ATTR,eQ)),e.ADD_URI_SAFE_ATTR&&_(eH,e.ADD_URI_SAFE_ATTR,eQ),e.FORBID_CONTENTS&&(eF===ez&&(eF=E(eF)),_(eF,e.FORBID_CONTENTS,eQ)),eI&&(eg["#text"]=!0),ek&&_(eg,["html","head","body"]),eg.table&&(_(eg,["tbody"]),delete ew.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ee=(J=e.TRUSTED_TYPES_POLICY).createHTML("")}else void 0===J&&(J=K(V,l)),null!==J&&"string"==typeof ee&&(ee=J.createHTML(""));o&&o(e),eJ=e}},e3=_({},["mi","mo","mn","ms","mtext"]),e5=_({},["foreignobject","desc","title","annotation-xml"]),e4=_({},["title","style","font","a","script"]),e6=_({},O);_(e6,k),_(e6,P);let e8=_({},T);_(e8,A);let e9=function(e){let t=Q(e);t&&t.tagName||(t={namespaceURI:e$,tagName:"template"});let r=f(e.tagName),i=f(t.tagName);return!!eY[e.namespaceURI]&&(e.namespaceURI===eG?t.namespaceURI===eW?"svg"===r:t.namespaceURI===eq?"svg"===r&&("annotation-xml"===i||e3[i]):!!e6[r]:e.namespaceURI===eq?t.namespaceURI===eW?"math"===r:t.namespaceURI===eG?"math"===r&&e5[i]:!!e8[r]:e.namespaceURI===eW?!(t.namespaceURI===eG&&!e5[i])&&!(t.namespaceURI===eq&&!e3[i])&&!e8[r]&&(e4[r]||!e6[r]):!("application/xhtml+xml"!==n||!eY[e.namespaceURI]))},e7=function(e){h(i.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},te=function(e,t){try{h(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){h(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!ev[e]){if(eA||eN)try{e7(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}}},tt=function(e){let t,r;if(eT)e="<remove></remove>"+e;else{let t=g(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===n&&e$===eW&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let i=J?J.createHTML(e):e;if(e$===eW)try{t=(new H).parseFromString(i,n)}catch(e){}if(!t||!t.documentElement){t=et.createDocument(e$,"template",null);try{t.documentElement.innerHTML=eK?ee:i}catch(e){}}let o=t.body||t.documentElement;return e&&r&&o.insertBefore(s.createTextNode(r),o.childNodes[0]||null),e$===eW?ei.call(t,ek?"html":"body")[0]:ek?t.documentElement:o},tn=function(e){return en.call(e.ownerDocument||e,e,F.SHOW_ELEMENT|F.SHOW_COMMENT|F.SHOW_TEXT,null,!1)},tr=function(e){return"object"==typeof M?e instanceof M:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},ti=function(e,t,n){ea[e]&&c(ea[e],e=>{e.call(i,t,n,eJ)})},to=function(e){let t;if(ti("beforeSanitizeElements",e,null),e instanceof B&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof z)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes))return e7(e),!0;let n=eQ(e.nodeName);if(ti("uponSanitizeElement",e,{tagName:n,allowedTags:eg}),e.hasChildNodes()&&!tr(e.firstElementChild)&&(!tr(e.content)||!tr(e.content.firstElementChild))&&b(/<[/\w]/g,e.innerHTML)&&b(/<[/\w]/g,e.textContent))return e7(e),!0;if(!eg[n]||ew[n]){if(!ew[n]&&tl(n)&&(eb.tagNameCheck instanceof RegExp&&b(eb.tagNameCheck,n)||eb.tagNameCheck instanceof Function&&eb.tagNameCheck(n)))return!1;if(eI&&!eF[n]){let t=Q(e)||e.parentNode,n=Z(e)||e.childNodes;if(n&&t)for(let r=n.length-1;r>=0;--r)t.insertBefore(Y(n[r],!0),X(e))}return e7(e),!0}return e instanceof D&&!e9(e)?(e7(e),!0):("noscript"===n||"noembed"===n||"noframes"===n)&&b(/<\/no(script|embed|frames)/i,e.innerHTML)?(e7(e),!0):(eO&&3===e.nodeType&&(t=m(t=e.textContent,el," "),t=m(t,es," "),t=m(t,eu," "),e.textContent!==t&&(h(i.removed,{element:e.cloneNode()}),e.textContent=t)),ti("afterSanitizeElements",e,null),!1)},ta=function(e,t,n){if(eR&&("id"===t||"name"===t)&&(n in s||n in e0))return!1;if(eE&&!ex[t]&&b(ec,t));else if(e_&&b(ed,t));else if(!ev[t]||ex[t]){if(!(tl(e)&&(eb.tagNameCheck instanceof RegExp&&b(eb.tagNameCheck,e)||eb.tagNameCheck instanceof Function&&eb.tagNameCheck(e))&&(eb.attributeNameCheck instanceof RegExp&&b(eb.attributeNameCheck,t)||eb.attributeNameCheck instanceof Function&&eb.attributeNameCheck(t))||"is"===t&&eb.allowCustomizedBuiltInElements&&(eb.tagNameCheck instanceof RegExp&&b(eb.tagNameCheck,n)||eb.tagNameCheck instanceof Function&&eb.tagNameCheck(n))))return!1}else if(eH[t]);else if(b(ep,m(n,ef,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==v(n,"data:")||!eB[e]){if(eS&&!b(eh,m(n,ef,"")));else if(n)return!1}return!0},tl=function(e){return e.indexOf("-")>0},ts=function(e){let t,n,r,o;ti("beforeSanitizeAttributes",e,null);let{attributes:a}=e;if(!a)return;let l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ev};for(o=a.length;o--;){let{name:s,namespaceURI:u}=t=a[o];if(n="value"===s?t.value:y(t.value),r=eQ(s),l.attrName=r,l.attrValue=n,l.keepAttr=!0,l.forceKeepAttr=void 0,ti("uponSanitizeAttribute",e,l),n=l.attrValue,l.forceKeepAttr||(te(s,e),!l.keepAttr))continue;if(!eC&&b(/\/>/i,n)){te(s,e);continue}eO&&(n=m(n,el," "),n=m(n,es," "),n=m(n,eu," "));let c=eQ(e.nodeName);if(ta(c,r,n)){if(eL&&("id"===r||"name"===r)&&(te(s,e),n="user-content-"+n),J&&"object"==typeof V&&"function"==typeof V.getAttributeType){if(u);else switch(V.getAttributeType(c,r)){case"TrustedHTML":n=J.createHTML(n);break;case"TrustedScriptURL":n=J.createScriptURL(n)}}try{u?e.setAttributeNS(u,s,n):e.setAttribute(s,n),d(i.removed)}catch(e){}}}ti("afterSanitizeAttributes",e,null)},tu=function e(t){let n;let r=tn(t);for(ti("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)ti("uponSanitizeShadowNode",n,null),to(n)||(n.content instanceof u&&e(n.content),ts(n));ti("afterSanitizeShadowDOM",t,null)};return i.sanitize=function(e){let t,n,r,o,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((eK=!e)&&(e="<!-->"),"string"!=typeof e&&!tr(e)){if("function"!=typeof e.toString)throw w("toString is not a function");if("string"!=typeof(e=e.toString()))throw w("dirty is not a string, aborting")}if(!i.isSupported)return e;if(eP||e2(l),i.removed=[],"string"==typeof e&&(eM=!1),eM){if(e.nodeName){let t=eQ(e.nodeName);if(!eg[t]||ew[t])throw w("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof M)1===(n=(t=tt("<!---->")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===n.nodeName||"HTML"===n.nodeName?t=n:t.appendChild(n);else{if(!eA&&!eO&&!ek&&-1===e.indexOf("<"))return J&&ej?J.createHTML(e):e;if(!(t=tt(e)))return eA?null:ej?ee:""}t&&eT&&e7(t.firstChild);let s=tn(eM?e:t);for(;r=s.nextNode();)to(r)||(r.content instanceof u&&tu(r.content),ts(r));if(eM)return e;if(eA){if(eN)for(o=er.call(t.ownerDocument);t.firstChild;)o.appendChild(t.firstChild);else o=t;return(ev.shadowroot||ev.shadowrootmode)&&(o=eo.call(a,o,!0)),o}let c=ek?t.outerHTML:t.innerHTML;return ek&&eg["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&b(q,t.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+t.ownerDocument.doctype.name+">\n"+c),eO&&(c=m(c,el," "),c=m(c,es," "),c=m(c,eu," ")),J&&ej?J.createHTML(c):c},i.setConfig=function(e){e2(e),eP=!0},i.clearConfig=function(){eJ=null,eP=!1},i.isValidAttribute=function(e,t,n){return eJ||e2({}),ta(eQ(e),eQ(t),n)},i.addHook=function(e,t){"function"==typeof t&&(ea[e]=ea[e]||[],h(ea[e],t))},i.removeHook=function(e){if(ea[e])return d(ea[e])},i.removeHooks=function(e){ea[e]&&(ea[e]=[])},i.removeAllHooks=function(){ea={}},i}()}()},function(e,t){e.exports=Pl},function(e,t,n){n.r(t);var r=n(1),i=n.n(r),o=n(0),a=n.n(o);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=i.a.import("modules/clipboard"),p=i.a.import("delta"),g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(s,e);var t,n,r,o=(t=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=h(s);return e=t?Reflect.construct(n,arguments,h(this).constructor):n.apply(this,arguments),e&&("object"===l(e)||"function"==typeof e)?e:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this)});function s(e,t){var n;return function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,s),(n=o.call(this,e,t)).allowed=t.allowed,n.keepSelection=t.keepSelection,n.substituteBlockElements=t.substituteBlockElements,n.magicPasteLinks=t.magicPasteLinks,n.hooks=t.hooks,n}return n=[{key:"onPaste",value:function(e){var t,n,r,o,l,s,u,c,d,h=this;e.preventDefault();var f,g,m,v,y,b=this.quill.getSelection();e.clipboardData&&e.clipboardData.getData||!window.clipboardData||!window.clipboardData.getData?(f=e.clipboardData.getData("text/plain"),g=e.clipboardData.getData("text/html"),m=null===(v=e.clipboardData)||void 0===v||null===(y=v.items)||void 0===y?void 0:y[0]):f=window.clipboardData.getData("Text");var w=(new p).retain(b.index).delete(b.length),x=this.getDOMPurifyOptions(),_=!1,E=f;if(!g&&x.ALLOWED_TAGS.includes("a")&&this.isURL(f)&&b.length>0&&this.magicPasteLinks)E=this.quill.getText(b.index,b.length),w=w.insert(E,{link:f});else if(!g&&x.ALLOWED_TAGS.includes("img")&&m&&"file"===m.kind&&m.type.match(/^image\//i)){var S=m.getAsFile(),C=new FileReader;C.onload=function(e){h.quill.insertEmbed(b.index,"image",e.target.result),h.keepSelection||h.quill.setSelection(b.index+1)},C.readAsDataURL(S)}else g||(_=!0,g=E),"function"==typeof(null===(t=this.hooks)||void 0===t?void 0:t.beforeSanitizeElements)&&a.a.addHook("beforeSanitizeElements",this.hooks.beforeSanitizeElements),"function"==typeof(null===(n=this.hooks)||void 0===n?void 0:n.uponSanitizeElement)&&a.a.addHook("uponSanitizeElement",this.hooks.uponSanitizeElement),"function"==typeof(null===(r=this.hooks)||void 0===r?void 0:r.afterSanitizeElements)&&a.a.addHook("afterSanitizeElements",this.hooks.afterSanitizeElements),"function"==typeof(null===(o=this.hooks)||void 0===o?void 0:o.beforeSanitizeAttributes)&&a.a.addHook("beforeSanitizeAttributes",this.hooks.beforeSanitizeAttributes),"function"==typeof(null===(l=this.hooks)||void 0===l?void 0:l.uponSanitizeAttribute)&&a.a.addHook("uponSanitizeAttribute",this.hooks.uponSanitizeAttribute),"function"==typeof(null===(s=this.hooks)||void 0===s?void 0:s.afterSanitizeAttributes)&&a.a.addHook("afterSanitizeAttributes",this.hooks.afterSanitizeAttributes),"function"==typeof(null===(u=this.hooks)||void 0===u?void 0:u.beforeSanitizeShadowDOM)&&a.a.addHook("beforeSanitizeShadowDOM",this.hooks.beforeSanitizeShadowDOM),"function"==typeof(null===(c=this.hooks)||void 0===c?void 0:c.uponSanitizeShadowNode)&&a.a.addHook("uponSanitizeShadowNode",this.hooks.uponSanitizeShadowNode),"function"==typeof(null===(d=this.hooks)||void 0===d?void 0:d.afterSanitizeShadowDOM)&&a.a.addHook("afterSanitizeShadowDOM",this.hooks.afterSanitizeShadowDOM),_?(E=a.a.sanitize(g,x),w=w.insert(E)):(E=!1!==this.substituteBlockElements?(g=this.substitute(g,x)).innerHTML:a.a.sanitize(g,x),w=w.concat(this.convert(E)));this.quill.updateContents(w,i.a.sources.USER),_||(w=this.convert(E)),this.keepSelection?this.quill.setSelection(b.index,w.length(),i.a.sources.SILENT):this.quill.setSelection(b.index+w.length(),i.a.sources.SILENT),this.quill.scrollIntoView(),a.a.removeAllHooks()}},{key:"getDOMPurifyOptions",value:function(){var e,t,n={};if(null!==(e=this.allowed)&&void 0!==e&&e.tags&&(n.ALLOWED_TAGS=this.allowed.tags),null!==(t=this.allowed)&&void 0!==t&&t.attributes&&(n.ALLOWED_ATTR=this.allowed.attributes),void 0===n.ALLOWED_TAGS||void 0===n.ALLOWED_ATTR){var r,i=!1;void 0===n.ALLOWED_TAGS&&(i=!0,n.ALLOWED_TAGS=["p","br","span"]);var o=!1;void 0===n.ALLOWED_ATTR&&(o=!0,n.ALLOWED_ATTR=["class"]);var a=this.quill.getModule("toolbar");null==a||null===(r=a.controls)||void 0===r||r.forEach(function(e){switch(e[0]){case"bold":i&&(n.ALLOWED_TAGS.push("b"),n.ALLOWED_TAGS.push("strong"));break;case"italic":i&&(n.ALLOWED_TAGS.push("i"),n.ALLOWED_TAGS.push("em"));break;case"underline":i&&n.ALLOWED_TAGS.push("u");break;case"strike":i&&n.ALLOWED_TAGS.push("s");break;case"color":case"background":o&&n.ALLOWED_ATTR.push("style");break;case"script":i&&("super"===e[1].value?n.ALLOWED_TAGS.push("sup"):"sub"===e[1].value&&n.ALLOWED_TAGS.push("sub"));break;case"header":if(i){var t=function(e){"1"===e?n.ALLOWED_TAGS.push("h1"):"2"===e?n.ALLOWED_TAGS.push("h2"):"3"===e?n.ALLOWED_TAGS.push("h3"):"4"===e?n.ALLOWED_TAGS.push("h4"):"5"===e?n.ALLOWED_TAGS.push("h5"):"6"===e&&n.ALLOWED_TAGS.push("h6")};e[1].value?t(e[1].value):e[1].options&&e[1].options.length&&[].forEach.call(e[1].options,function(e){e.value&&t(e.value)})}break;case"code-block":i&&n.ALLOWED_TAGS.push("pre"),o&&n.ALLOWED_ATTR.push("spellcheck");break;case"list":i&&("ordered"===e[1].value?n.ALLOWED_TAGS.push("ol"):"bullet"===e[1].value&&n.ALLOWED_TAGS.push("ul"),n.ALLOWED_TAGS.push("li"));break;case"link":i&&n.ALLOWED_TAGS.push("a"),o&&(n.ALLOWED_ATTR.push("href"),n.ALLOWED_ATTR.push("target"),n.ALLOWED_ATTR.push("rel"));break;case"image":i&&n.ALLOWED_TAGS.push("img"),o&&(n.ALLOWED_ATTR.push("src"),n.ALLOWED_ATTR.push("title"),n.ALLOWED_ATTR.push("alt"));break;case"video":i&&n.ALLOWED_TAGS.push("iframe"),o&&(n.ALLOWED_ATTR.push("frameborder"),n.ALLOWED_ATTR.push("allowfullscreen"),n.ALLOWED_ATTR.push("src"));break;case"blockquote":i&&n.ALLOWED_TAGS.push(e[0])}})}return n}},{key:"substitute",value:function(e,t){var n,r=["h1","h2","h3","h4","h5","h6"],i=["p","div","section","article","fieldset","address","aside","blockquote","canvas","dl","figcaption","figure","footer","form","header","main","nav","noscript","ol","pre","table","tfoot","ul","video"],o=["li","dt","dd","hr"];a.a.addHook("uponSanitizeElement",function(e,a,l){for(var s=0;!n&&s<3;)t.ALLOWED_TAGS.includes(i[s])&&(n=i[s]),++s;if(n&&e.tagName&&!t.ALLOWED_TAGS.includes(e.tagName.toLowerCase())){var u=e.tagName.toLowerCase();r.includes(u)?e.innerHTML="<".concat(n,"><b>").concat(e.innerHTML,"</b></").concat(n,">"):i.includes(u)?e.innerHTML="<".concat(n,">").concat(e.innerHTML,"</").concat(n,">"):o.includes(u)&&(e.innerHTML="".concat(e.innerHTML,"<br>"))}}),e=a.a.sanitize(e,u(u({},t),{RETURN_DOM:!0,WHOLE_DOCUMENT:!1})),a.a.removeAllHooks();var l,s=function(e){var t=document.createElement(e.tagName.toLowerCase()),n=e.attributes;return n.length&&Array.from(n).forEach(function(e){return t.setAttribute(e.nodeName,e.value)}),t},c=0,d=document.createElement("body");return function e(t,n){for(n(t,c),t=c<=1?t.firstChild:void 0;t;)++c,e(t,n),t=t.nextSibling;--c}(e,function(e,t){if(1===t){if(e.tagName&&i.includes(e.tagName.toLowerCase())){l&&(l=void 0);var r=s(e);r.innerHTML=e.innerHTML,d.appendChild(r)}else if(void 0===l&&(l=document.createElement(n),d.appendChild(l)),e.tagName){var o=s(e);e.innerHTML&&(o.innerHTML=e.innerHTML),l.appendChild(o)}else{var a=document.createTextNode(e.textContent);l.appendChild(a)}}}),d}},{key:"isURL",value:function(e){return!!/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+\x2D?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+\x2D?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:(?![\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])[\s\S])*)?$/i.test(e)}}],c(s.prototype,n),r&&c(s,r),s}(f);i.a.register("modules/clipboard",g,!0),t.default=g}]);var x=g("2SBKn"),ov={};Pf=ov,Pp=function(e,t,n,r){var i,o,a,l,s,u,c,d,h,f,p,g,m,v,y,b,w,x,_,E,S,C,O,k,P,T,A,N,j,R,L,I,M,D,F,z,B,U,H,V,q,G,W,$,K,Y,X,Z,Q,J,ee,et,en=(o=[],(i={}).joinUrl=function(t,n){return t?e.resolve(t,n):n},i.getConstantUniqueIdFor=function(e){return 0>o.indexOf(e)&&o.push(e),o.indexOf(e)},i.clone=function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},a=function(e){return"object"==typeof e&&null!==e&&Object.prototype.toString.apply(e).match(/\[object (Canvas|HTMLCanvasElement)\]/i)},i.parseOptionalParameters=function(e){var t={canvas:null,options:{}};return null==e[0]||a(e[0])?(t.canvas=e[0]||null,t.options=i.clone(e[1])):t.options=i.clone(e[0]),t},i),er=(l={},s=function(e,t,n){var r=e[t];return e[t]=function(){var e=Array.prototype.slice.call(arguments);return n.apply(this,[e,r])},r},l.baseUrlRespectingXhr=function(e,t){return function(){var n=new e;return s(n,"open",function(e,n){var r=e.shift(),i=e.shift(),o=en.joinUrl(t,i);return n.apply(this,[r,o].concat(e))}),n}},l.finishNotifyingXhr=function(e){var t,n=0,r=0,i=!1,o=new Promise(function(e){t=function(){n-r<=0&&i&&e({totalCount:n})}}),a=function(){var i=new e;return s(i,"send",function(e,t){return n+=1,t.apply(this,arguments)}),i.addEventListener("load",function(){r+=1,t()}),i};return a.waitForRequestsToFinish=function(){return i=!0,t(),o},a},l),ei=(u={},c=function(e){return Array.prototype.slice.call(e)},u.addClassName=function(e,t){e.className+=" "+t},u.addClassNameRecursively=function(e,t){u.addClassName(e,t),e.parentNode!==e.ownerDocument&&u.addClassNameRecursively(e.parentNode,t)},d=function(e,t){var n=e.parentStyleSheet,r=c(n.cssRules).indexOf(e);n.insertRule(t,r+1),n.deleteRule(r)},h=function(e,t){var n=e.cssText.replace(/^[^\{]+/,"");d(e,t+" "+n)},f=function(e){e.textContent=c(e.sheet.cssRules).reduce(function(e,t){return e+t.cssText},"")},p=function(e){var t=document.implementation.createHTMLDocument(""),n=document.createElement("style");n.textContent=e.textContent,t.body.appendChild(n),e.sheet=n.sheet},g=function(e,t,n){var r="((?:^|[^.#:\\w])|(?=\\W))("+t.join("|")+")(?=\\W|$)";c(e.querySelectorAll("style")).forEach(function(e){void 0===e.sheet&&p(e);var t=c(e.sheet.cssRules).filter(function(e){return e.selectorText&&RegExp(r,"i").test(e.selectorText)});t.length&&(t.forEach(function(e){var t=e.selectorText.replace(RegExp(r,"gi"),function(e,t,r){return t+n(r)});t!==e.selectorText&&h(e,t)}),f(e))})},u.rewriteCssSelectorWith=function(e,t,n){g(e,[t],function(){return n})},u.lowercaseCssTypeSelectors=function(e,t){g(e,t,function(e){return e.toLowerCase()})},u.findHtmlOnlyNodeNames=function(e){var t,n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),r={},i={};do t=n.currentNode.tagName.toLowerCase(),"http://www.w3.org/1999/xhtml"===n.currentNode.namespaceURI?r[t]=!0:i[t]=!0;while(n.nextNode())return Object.keys(r).filter(function(e){return!i[e]})},m={},v=function(e){return Array.prototype.slice.call(e)},y={active:!0,hover:!0,focus:!1,target:!1},m.fakeUserAction=function(e,t,n){var r=e.querySelector(t),i="rasterizehtml"+n;r&&(y[n]?u.addClassNameRecursively(r,i):u.addClassName(r,i),u.rewriteCssSelectorWith(e,":"+n,"."+i))},m.persistInputValues=function(e){var t=e.querySelectorAll("input"),n=e.querySelectorAll("textarea"),r=function(e){return"checkbox"===e.type||"radio"===e.type};v(t).filter(r).forEach(function(e){e.checked?e.setAttribute("checked",""):e.removeAttribute("checked")}),v(t).filter(function(e){return!r(e)}).forEach(function(e){e.setAttribute("value",e.value)}),v(n).forEach(function(e){e.textContent=e.value})},m.rewriteTagNameSelectorsToLowerCase=function(e){u.lowercaseCssTypeSelectors(e,u.findHtmlOnlyNodeNames(e))},m),eo=(b=window,w={},x=function(e,t,n,r){var i=e.createElement(t);return i.style.visibility="hidden",i.style.width=n+"px",i.style.height=r+"px",i.style.position="absolute",i.style.top=-1e4-r+"px",i.style.left=-1e4-n+"px",e.getElementsByTagName("body")[0].appendChild(i),i},w.executeJavascript=function(e,t){return new Promise(function(n){var r=x(b.document,"iframe",t.width,t.height),i=e.outerHTML,o=[],a=t.executeJsTimeout||0,l=function(){b.document.getElementsByTagName("body")[0].removeChild(r)},s=function(){n({document:r.contentDocument,errors:o,cleanUp:l})},u=r.contentWindow.XMLHttpRequest,c=er.finishNotifyingXhr(u),d=er.baseUrlRespectingXhr(c,t.baseUrl);r.onload=function(){(a>0?new Promise(function(e){setTimeout(e,a)}):Promise.resolve()).then(c.waitForRequestsToFinish).then(s)},r.contentDocument.open(),r.contentWindow.XMLHttpRequest=d,r.contentWindow.onerror=function(e){o.push({resourceType:"scriptExecution",msg:e})},r.contentDocument.write("<!DOCTYPE html>"),r.contentDocument.write(i),r.contentDocument.close()})},_=function(e,t,n){var r=e.createElement("iframe");return r.style.width=t+"px",r.style.height=n+"px",r.style.visibility="hidden",r.style.position="absolute",r.style.top=-1e4-n+"px",r.style.left=-1e4-t+"px",r.style.borderWidth=0,r.sandbox="allow-same-origin",r.scrolling="no",r},E=function(e,t,n){var r=Math.floor(e/n),i=Math.floor(t/n);return _(b.document,r,i)},S=function(e,t){var n=e.querySelector(t);if(n)return n;if(e.ownerDocument.querySelector(t)===e)return e;throw{message:"Clipping selector not found"}},C=function(e,t,n,r,i){var o,a,l,s,u,c,d,h,f=Math.max(e.scrollWidth,e.clientWidth),p=Math.max(e.scrollHeight,e.clientHeight);return t?(a=(d=S(e,t).getBoundingClientRect()).top,l=d.left,s=d.width,u=d.height):(a=0,l=0,s=f,u=p),h={width:Math.max((o={width:s,height:u}).width*i,n),height:Math.max(o.height*i,r)},c=b.getComputedStyle(e.ownerDocument.documentElement).fontSize,{left:l,top:a,width:h.width,height:h.height,viewportWidth:f,viewportHeight:p,rootFontSize:c}},O=function(e,t){var n=e.tagName;return t.querySelector(n)},k=function(e){var t=e.tagName.toLowerCase();return"html"===t||"body"===t?e.outerHTML:'<body style="margin: 0;">'+e.outerHTML+"</body>"},w.calculateDocumentContentSize=function(e,t){return new Promise(function(n,r){var i,o=t.zoom||1;i=E(t.width,t.height,o),b.document.getElementsByTagName("body")[0].appendChild(i),i.onload=function(){var a,l=i.contentDocument;try{a=C(O(e,l),t.clip,t.width,t.height,o),n(a)}catch(e){r(e)}finally{b.document.getElementsByTagName("body")[0].removeChild(i)}},i.contentDocument.open(),i.contentDocument.write("<!DOCTYPE html>"),i.contentDocument.write(k(e)),i.contentDocument.close()})},w.parseHtmlFragment=function(e){var t=b.document.implementation.createHTMLDocument("");t.documentElement.innerHTML=e;var n=t.querySelector("body").firstChild;if(!n)throw"Invalid source";return n},P=function(e,t){var n,r,i,o,a=/<html((?:\s+[^>]*)?)>/im.exec(t),l=b.document.implementation.createHTMLDocument("");if(a)for(r=0,n="<div"+a[1]+"></div>",l.documentElement.innerHTML=n,i=l.querySelector("div");r<i.attributes.length;r++)o=i.attributes[r],e.documentElement.setAttribute(o.name,o.value)},w.parseHTML=function(e){var t=b.document.implementation.createHTMLDocument("");return t.documentElement.innerHTML=e,P(t,e),t},T=function(e){try{return n.failOnParseError(e)}catch(e){throw{message:"Invalid source",originalError:e}}},w.validateXHTML=function(e){T(new DOMParser().parseFromString(e,"application/xml"))},A=null,w.loadDocument=function(e,t){return new Promise(function(n,r){var i,o,a=new window.XMLHttpRequest,l=(i=en.joinUrl(t.baseUrl,e),"none"===(o=t.cache)||"repeated"===o?((null===A||"repeated"!==o)&&(A=Date.now()),i+"?_="+A):i),s=function(e){r({message:"Unable to load page",originalError:e})};a.addEventListener("load",function(){200===a.status||0===a.status?n(a.responseXML):s(a.statusText)},!1),a.addEventListener("error",function(e){s(e)},!1);try{a.open("GET",l,!0),a.responseType="document",a.send(null)}catch(e){s(e)}}).then(function(e){return T(e)})},w),ea=(N=window,R={},L=function(e,t){return t?URL.createObjectURL(new Blob([e],{type:"image/svg+xml"})):"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e)},I=function(e){e instanceof Blob&&URL.revokeObjectURL(e)},M='<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"><foreignObject></foreignObject></svg>',D=function(e){return new Promise(function(t,n){var r=document.createElement("canvas"),i=new Image;i.onload=function(){var e=r.getContext("2d");try{e.drawImage(i,0,0),r.toDataURL("image/png"),t(!0)}catch(e){t(!1)}},i.onerror=n,i.src=e})},F=function(){var e=L(M,!0);return D(e).then(function(t){return I(e),!t&&D(L(M,!1)).then(function(e){return e})},function(){return!1})},z=function(){if(N.Blob)try{return new Blob(["<b></b>"],{type:"text/xml"}),!0}catch(e){}return!1},R.renderSvg=function(e){return new Promise(function(t,n){var r,i,o=function(){i.onload=null,i.onerror=null},a=function(){r&&I(r)};(i=new Image).onload=function(){o(),a(),t(i)},i.onerror=function(){a(),n()},(void 0===j&&(j=new Promise(function(e,t){z()&&N.URL?F().then(function(t){e(!t)},function(){t()}):e(!1)})),j).then(function(t){return L(e,t)}).then(function(e){r=e,i.src=r},n)})},R),el=(B={},U=function(e,t){var n=t||1,r={width:e.width,height:e.height,"font-size":e.rootFontSize};return 1!==n&&(r.style="transform:scale("+n+"); transform-origin: 0 0;"),r},H=function(e){var t,n;return t=Math.round(e.viewportWidth),n=Math.round(e.viewportHeight),{x:-e.left,y:-e.top,width:t,height:n}},V=function(e){var t=e.style||"";e.style=t+"float: left;"},q=function(e){e.externalResourcesRequired=!0},G=function(e){var t=Object.keys(e);return t.length?" "+t.map(function(t){return t+'="'+e[t]+'"'}).join(" "):""},W=function(e,n,r){var i=t.serializeToString(e);eo.validateXHTML(i);var o=H(n);return V(o),q(o),'<svg xmlns="http://www.w3.org/2000/svg"'+G(U(n,r))+'><style scoped="">html::-webkit-scrollbar { display: none; }</style><foreignObject'+G(o)+">"+i+"</foreignObject></svg>"},B.getSvgForDocument=function(e,t,n){return ei.rewriteTagNameSelectorsToLowerCase(e),W(e,t,n)},B.drawDocumentAsSvg=function(e,t){return["hover","active","focus","target"].forEach(function(n){t[n]&&ei.fakeUserAction(e,t[n],n)}),eo.calculateDocumentContentSize(e,t).then(function(n){return B.getSvgForDocument(e,n,t.zoom)})},B),es=($={},K=function(e){return{message:"Error rendering page",originalError:e}},Y=function(e){return ea.renderSvg(e).then(function(t){return{image:t,svg:e}},function(e){throw K(e)})},X=function(e,t){try{t.getContext("2d").drawImage(e,0,0)}catch(e){throw K(e)}},$.rasterize=function(e,t,n){var i;return(i=en.clone(n)).inlineScripts=!0===n.executeJs,r.inlineReferences(e,i).then(function(t){return n.executeJs?eo.executeJavascript(e,n).then(function(e){var t=e.document;return ei.persistInputValues(t),{document:t,errors:e.errors,cleanUp:e.cleanUp}}).then(function(e){return{element:e.document.documentElement,errors:t.concat(e.errors),cleanUp:e.cleanUp}}):{element:e,errors:t,cleanUp:function(){}}}).then(function(e){var r;return(r=e.element,el.drawDocumentAsSvg(r,n).then(Y).then(function(e){return t&&X(e.image,t),e})).then(function(t){return e.cleanUp(),{image:t.image,svg:t.svg,errors:e.errors}})})},$);return Z={},Q=function(e,t){var n=e?e.width:300,r=e?e.height:200;return{width:void 0!==t.width?t.width:n,height:void 0!==t.height?t.height:r}},J=function(e){var t,n=Q(e.canvas,e.options);return(t=en.clone(e.options)).width=n.width,t.height=n.height,t},Z.drawDocument=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),n=en.parseOptionalParameters(t),r=e.documentElement?e.documentElement:e;return es.rasterize(r,n.canvas,J(n))},ee=function(e,t,n){var r=eo.parseHTML(e);return Z.drawDocument(r,t,n)},Z.drawHTML=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),n=en.parseOptionalParameters(t);return ee(e,n.canvas,n.options)},et=function(e,t,n){var r=document.implementation.createHTMLDocument("");r.replaceChild(e.documentElement,r.documentElement);var i=n?en.clone(n):{};return n.baseUrl||(i.baseUrl=t),{document:r,options:i}},Z.drawURL=function(){var e,t,n=arguments[0],r=Array.prototype.slice.call(arguments,1),i=en.parseOptionalParameters(r);return e=i.canvas,t=i.options,eo.loadDocument(n,t).then(function(r){var i=et(r,n,t);return Z.drawDocument(i.document,e,i.options)})},Z},void 0===Pf&&void 0!==window&&(Pf=window),"function"==typeof define&&define.amd?define(["url","xmlserializer","sane-domparser-error","inlineresources"],function(e,t,n,r){return Pf.rasterizeHTML=Pp(e,t,n,r)}):ov?ov=Pp(g("kRFNf"),g("l4MZj"),g("lDFX4"),g("6cJtK")):Pf.rasterizeHTML=Pp(Pf.url,Pf.xmlserializer,Pf.sanedomparsererror,Pf.inlineresources);let oy=`
30
30
  p {
31
31
  margin: 0;
32
32
  padding: 0;