function e(e){const{changedTouches:t}=e,n=t[0];let i="";switch(e.type){case"touchstart":i="mousedown";break;case"touchmove":i="mousemove";break;case"touchend":i="mouseup";break;default:return}const{screenX:s,screenY:o,clientX:r,clientY:a}=n,l=new MouseEvent(i,{bubbles:!0,cancelable:!0,view:window,detail:1,screenX:s,screenY:o,clientX:r,clientY:a,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});t.length<2&&(n.target.dispatchEvent(l),e.preventDefault())}document.addEventListener("touchstart",e,!0),document.addEventListener("touchmove",e,!0),document.addEventListener("touchend",e,!0),document.addEventListener("touchcancel",e,!0); /** * Namespaces or tools therefor. * @module namespaces * @license MIT */ const t={HTML:"http://www.w3.org/1999/xhtml",MATH:"http://www.w3.org/1998/Math/MathML",SE:"http://svg-edit.googlecode.com",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"},n=function(){const e={};return Object.entries(t).forEach(([t,n])=>{e[n]=t.toLowerCase()}),e};(()=>{if(!("SVGPathSeg"in window)){class e{constructor(e,t,n){this.pathSegType=e,this.pathSegTypeAsLetter=t,this._owningPathSegList=n}_segmentChanged(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)}}e.prototype.classname="SVGPathSeg",e.PATHSEG_UNKNOWN=0,e.PATHSEG_CLOSEPATH=1,e.PATHSEG_MOVETO_ABS=2,e.PATHSEG_MOVETO_REL=3,e.PATHSEG_LINETO_ABS=4,e.PATHSEG_LINETO_REL=5,e.PATHSEG_CURVETO_CUBIC_ABS=6,e.PATHSEG_CURVETO_CUBIC_REL=7,e.PATHSEG_CURVETO_QUADRATIC_ABS=8,e.PATHSEG_CURVETO_QUADRATIC_REL=9,e.PATHSEG_ARC_ABS=10,e.PATHSEG_ARC_REL=11,e.PATHSEG_LINETO_HORIZONTAL_ABS=12,e.PATHSEG_LINETO_HORIZONTAL_REL=13,e.PATHSEG_LINETO_VERTICAL_ABS=14,e.PATHSEG_LINETO_VERTICAL_REL=15,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19;class t extends e{constructor(t){super(e.PATHSEG_CLOSEPATH,"z",t)}toString(){return"[object SVGPathSegClosePath]"}_asPathString(){return this.pathSegTypeAsLetter}clone(){return new t(void 0)}}class n extends e{constructor(t,n,i){super(e.PATHSEG_MOVETO_ABS,"M",t),this._x=n,this._y=i}toString(){return"[object SVGPathSegMovetoAbs]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}clone(){return new n(void 0,this._x,this._y)}}Object.defineProperties(n.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0}});class i extends e{constructor(t,n,i){super(e.PATHSEG_MOVETO_REL,"m",t),this._x=n,this._y=i}toString(){return"[object SVGPathSegMovetoRel]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}clone(){return new i(void 0,this._x,this._y)}}Object.defineProperties(i.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0}});class s extends e{constructor(t,n,i){super(e.PATHSEG_LINETO_ABS,"L",t),this._x=n,this._y=i}toString(){return"[object SVGPathSegLinetoAbs]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}clone(){return new s(void 0,this._x,this._y)}}Object.defineProperties(s.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0}});class o extends e{constructor(t,n,i){super(e.PATHSEG_LINETO_REL,"l",t),this._x=n,this._y=i}toString(){return"[object SVGPathSegLinetoRel]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}clone(){return new o(void 0,this._x,this._y)}}Object.defineProperties(o.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0}});class r extends e{constructor(t,n,i,s,o,r,a){super(e.PATHSEG_CURVETO_CUBIC_ABS,"C",t),this._x=n,this._y=i,this._x1=s,this._y1=o,this._x2=r,this._y2=a}toString(){return"[object SVGPathSegCurvetoCubicAbs]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}clone(){return new r(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}Object.defineProperties(r.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get(){return this._x1},set(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get(){return this._y1},set(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get(){return this._x2},set(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get(){return this._y2},set(e){this._y2=e,this._segmentChanged()},enumerable:!0}});class a extends e{constructor(t,n,i,s,o,r,a){super(e.PATHSEG_CURVETO_CUBIC_REL,"c",t),this._x=n,this._y=i,this._x1=s,this._y1=o,this._x2=r,this._y2=a}toString(){return"[object SVGPathSegCurvetoCubicRel]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}clone(){return new a(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}Object.defineProperties(a.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get(){return this._x1},set(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get(){return this._y1},set(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get(){return this._x2},set(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get(){return this._y2},set(e){this._y2=e,this._segmentChanged()},enumerable:!0}});class l extends e{constructor(t,n,i,s,o){super(e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t),this._x=n,this._y=i,this._x1=s,this._y1=o}toString(){return"[object SVGPathSegCurvetoQuadraticAbs]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}clone(){return new l(void 0,this._x,this._y,this._x1,this._y1)}}Object.defineProperties(l.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get(){return this._x1},set(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get(){return this._y1},set(e){this._y1=e,this._segmentChanged()},enumerable:!0}});class c extends e{constructor(t,n,i,s,o){super(e.PATHSEG_CURVETO_QUADRATIC_REL,"q",t),this._x=n,this._y=i,this._x1=s,this._y1=o}toString(){return"[object SVGPathSegCurvetoQuadraticRel]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}clone(){return new c(void 0,this._x,this._y,this._x1,this._y1)}}Object.defineProperties(c.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get(){return this._x1},set(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get(){return this._y1},set(e){this._y1=e,this._segmentChanged()},enumerable:!0}});class u extends e{constructor(t,n,i,s,o,r,a,l){super(e.PATHSEG_ARC_ABS,"A",t),this._x=n,this._y=i,this._r1=s,this._r2=o,this._angle=r,this._largeArcFlag=a,this._sweepFlag=l}toString(){return"[object SVGPathSegArcAbs]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y}clone(){return new u(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}Object.defineProperties(u.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get(){return this._r1},set(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get(){return this._r2},set(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get(){return this._angle},set(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get(){return this._largeArcFlag},set(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get(){return this._sweepFlag},set(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});class d extends e{constructor(t,n,i,s,o,r,a,l){super(e.PATHSEG_ARC_REL,"a",t),this._x=n,this._y=i,this._r1=s,this._r2=o,this._angle=r,this._largeArcFlag=a,this._sweepFlag=l}toString(){return"[object SVGPathSegArcRel]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y}clone(){return new d(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}Object.defineProperties(d.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get(){return this._r1},set(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get(){return this._r2},set(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get(){return this._angle},set(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get(){return this._largeArcFlag},set(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get(){return this._sweepFlag},set(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});class h extends e{constructor(t,n){super(e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t),this._x=n}toString(){return"[object SVGPathSegLinetoHorizontalAbs]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x}clone(){return new h(void 0,this._x)}}Object.defineProperty(h.prototype,"x",{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0});class p extends e{constructor(t,n){super(e.PATHSEG_LINETO_HORIZONTAL_REL,"h",t),this._x=n}toString(){return"[object SVGPathSegLinetoHorizontalRel]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x}clone(){return new p(void 0,this._x)}}Object.defineProperty(p.prototype,"x",{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0});class g extends e{constructor(t,n){super(e.PATHSEG_LINETO_VERTICAL_ABS,"V",t),this._y=n}toString(){return"[object SVGPathSegLinetoVerticalAbs]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._y}clone(){return new g(void 0,this._y)}}Object.defineProperty(g.prototype,"y",{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0});class f extends e{constructor(t,n){super(e.PATHSEG_LINETO_VERTICAL_REL,"v",t),this._y=n}toString(){return"[object SVGPathSegLinetoVerticalRel]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._y}clone(){return new f(void 0,this._y)}}Object.defineProperty(f.prototype,"y",{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0});class m extends e{constructor(t,n,i,s,o){super(e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t),this._x=n,this._y=i,this._x2=s,this._y2=o}toString(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}clone(){return new m(void 0,this._x,this._y,this._x2,this._y2)}}Object.defineProperties(m.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get(){return this._x2},set(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get(){return this._y2},set(e){this._y2=e,this._segmentChanged()},enumerable:!0}});class _ extends e{constructor(t,n,i,s,o){super(e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t),this._x=n,this._y=i,this._x2=s,this._y2=o}toString(){return"[object SVGPathSegCurvetoCubicSmoothRel]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}clone(){return new _(void 0,this._x,this._y,this._x2,this._y2)}}Object.defineProperties(_.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get(){return this._x2},set(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get(){return this._y2},set(e){this._y2=e,this._segmentChanged()},enumerable:!0}});class y extends e{constructor(t,n,i){super(e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t),this._x=n,this._y=i}toString(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}clone(){return new y(void 0,this._x,this._y)}}Object.defineProperties(y.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0}});class b extends e{constructor(t,n,i){super(e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t),this._x=n,this._y=i}toString(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"}_asPathString(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}clone(){return new b(void 0,this._x,this._y)}}Object.defineProperties(b.prototype,{x:{get(){return this._x},set(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get(){return this._y},set(e){this._y=e,this._segmentChanged()},enumerable:!0}}),SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new t(void 0)},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(e,t){return new n(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(e,t){return new i(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new s(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new o(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,i,s,o){return new r(void 0,e,t,n,i,s,o)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,i,s,o){return new a(void 0,e,t,n,i,s,o)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,i){return new l(void 0,e,t,n,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(e,t,n,i){return new c(void 0,e,t,n,i)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(e,t,n,i,s,o,r){return new u(void 0,e,t,n,i,s,o,r)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,i,s,o,r){return new d(void 0,e,t,n,i,s,o,r)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(e){return new h(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(e){return new p(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new g(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new f(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,i){return new m(void 0,e,t,n,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,i){return new _(void 0,e,t,n,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new y(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new b(void 0,e,t)},"getPathSegAtLength"in SVGPathElement.prototype||(SVGPathElement.prototype.getPathSegAtLength=function(e){if(void 0===e||!isFinite(e))throw new Error("Invalid arguments.");const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",this.getAttribute("d"));let n=t.pathSegList.numberOfItems-1;if(n<=0)return 0;do{if(t.pathSegList.removeItem(n),e>t.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=i,window.SVGPathSegLinetoAbs=s,window.SVGPathSegLinetoRel=o,window.SVGPathSegCurvetoCubicAbs=r,window.SVGPathSegCurvetoCubicRel=a,window.SVGPathSegCurvetoQuadraticAbs=l,window.SVGPathSegCurvetoQuadraticRel=c,window.SVGPathSegArcAbs=u,window.SVGPathSegArcRel=d,window.SVGPathSegLinetoHorizontalAbs=h,window.SVGPathSegLinetoHorizontalRel=p,window.SVGPathSegLinetoVerticalAbs=g,window.SVGPathSegLinetoVerticalRel=f,window.SVGPathSegCurvetoCubicSmoothAbs=m,window.SVGPathSegCurvetoCubicSmoothRel=_,window.SVGPathSegCurvetoQuadraticSmoothAbs=y,window.SVGPathSegCurvetoQuadraticSmoothRel=b}if(!("SVGPathSegList"in window)||!("appendItem"in window.SVGPathSegList.prototype)){class e{constructor(e){this._pathElement=e,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}_checkPathSynchronizedToList(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())}_updateListFromPathMutations(e){if(!this._pathElement)return;let t=!1;e.forEach(e=>{"d"===e.attributeName&&(t=!0)}),t&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}_writeListToPath(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",e._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}segmentChanged(e){this._writeListToPath()}clear(){this._checkPathSynchronizedToList(),this._list.forEach(e=>{e._owningPathSegList=null}),this._list=[],this._writeListToPath()}initialize(e){return this._checkPathSynchronizedToList(),this._list=[e],e._owningPathSegList=this,this._writeListToPath(),e}_checkValidIndex(e){if(isNaN(e)||e<0||e>=this.numberOfItems)throw new Error("INDEX_SIZE_ERR")}getItem(e){return this._checkPathSynchronizedToList(),this._checkValidIndex(e),this._list[e]}insertItemBefore(e,t){return this._checkPathSynchronizedToList(),t>this.numberOfItems&&(t=this.numberOfItems),e._owningPathSegList&&(e=e.clone()),this._list.splice(t,0,e),e._owningPathSegList=this,this._writeListToPath(),e}replaceItem(e,t){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._checkValidIndex(t),this._list[t]=e,e._owningPathSegList=this,this._writeListToPath(),e}removeItem(e){this._checkPathSynchronizedToList(),this._checkValidIndex(e);const t=this._list[e];return this._list.splice(e,1),this._writeListToPath(),t}appendItem(e){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._list.push(e),e._owningPathSegList=this,this._writeListToPath(),e}_parsePath(e){if(!e||!e.length)return[];const t=this;const n=new class{constructor(){this.pathSegList=[]}appendSegment(e){this.pathSegList.push(e)}},i=new class{constructor(e){this._string=e,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}_isCurrentSpace(){const e=this._string[this._currentIndex];return e<=" "&&(" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e)}_skipOptionalSpaces(){for(;this._currentIndex="0"&&e<="9")&&t!==SVGPathSeg.PATHSEG_CLOSEPATH?t===SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:t===SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:t:SVGPathSeg.PATHSEG_UNKNOWN}initialCommandIsMoveTo(){if(!this.hasMoreData())return!0;const e=this.peekSegmentType();return e===SVGPathSeg.PATHSEG_MOVETO_ABS||e===SVGPathSeg.PATHSEG_MOVETO_REL}_parseNumber(){let e=0,t=0,n=1,i=0,s=1,o=1;const r=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!==this._string.charAt(this._currentIndex))return;const a=this._currentIndex;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==a){let e=this._currentIndex-1,n=1;for(;e>=a;)t+=n*(this._string.charAt(e--)-"0"),n*=10}if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)n*=10,i+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==r&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)e*=10,e+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}let l=t+i;return l*=s,e&&(l*=10**(o*e)),r!==this._currentIndex?(this._skipOptionalSpacesOrDelimiter(),l):void 0}_parseArcFlag(){if(this._currentIndex>=this._endIndex)return;let e=!1;const t=this._string.charAt(this._currentIndex++);if("0"===t)e=!1;else{if("1"!==t)return;e=!0}return this._skipOptionalSpacesOrDelimiter(),e}parseSegment(){const e=this._string[this._currentIndex];let n=this._pathSegTypeFromChar(e);if(n===SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand===SVGPathSeg.PATHSEG_UNKNOWN)return null;if(n=this._nextCommandHelper(e,this._previousCommand),n===SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=n,n){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(t);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:{const e={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,e.x,e.y,e.x1,e.y1,e.x2,e.y2)}case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:{const e={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,e.x,e.y,e.x1,e.y1,e.x2,e.y2)}case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:{const e={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(t,e.x,e.y,e.x2,e.y2)}case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:{const e={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,e.x,e.y,e.x2,e.y2)}case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:{const e={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,e.x,e.y,e.x1,e.y1)}case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:{const e={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(t,e.x,e.y,e.x1,e.y1)}case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:{const e={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(t,e.x,e.y,e.x1,e.y1,e.arcAngle,e.arcLarge,e.arcSweep)}case SVGPathSeg.PATHSEG_ARC_ABS:{const e={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(t,e.x,e.y,e.x1,e.y1,e.arcAngle,e.arcLarge,e.arcSweep)}default:throw new Error("Unknown path seg type.")}}}(e);if(!i.initialCommandIsMoveTo())return[];for(;i.hasMoreData();){const e=i.parseSegment();if(!e)return[];n.appendSegment(e)}return n.pathSegList}static _pathSegArrayAsString(e){let t="",n=!0;return e.forEach(e=>{n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()}),t}}e.prototype.classname="SVGPathSegList",Object.defineProperty(e.prototype,"numberOfItems",{get(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get(){return this._pathSegList||(this._pathSegList=new e(this)),this._pathSegList},enumerable:!0},normalizedPathSegList:{get(){return this.pathSegList},enumerable:!0},animatedPathSegList:{get(){return this.pathSegList},enumerable:!0},animatedNormalizedPathSegList:{get(){return this.pathSegList},enumerable:!0}}),window.SVGPathSegList=e}})();const i=jQuery,{userAgent:s}=(Boolean(document.createElementNS&&document.createElementNS(t.SVG,"svg").createSVGRect),navigator),o=document.createElementNS(t.SVG,"svg"),r=Boolean(window.opera),a=s.includes("AppleWebKit"),l=s.includes("Gecko/"),c=s.includes("MSIE"),u=s.includes("Chrome/"),d=(s.includes("Windows"),s.includes("Macintosh")),h="ontouchstart"in window,p=Boolean(o.querySelector),g=Boolean(document.evaluate),f=function(){const e=document.createElementNS(t.SVG,"path");e.setAttribute("d","M0,0 10,10");const n=e.pathSegList,i=e.createSVGPathSegLinetoAbs(5,5);try{return n.replaceItem(i,1),!0}catch(e){}return!1}(),m=function(){const e=document.createElementNS(t.SVG,"path");e.setAttribute("d","M0,0 10,10");const n=e.pathSegList,i=e.createSVGPathSegLinetoAbs(5,5);try{return n.insertItemBefore(i,1),!0}catch(e){}return!1}(),_=function(){const e=document.createElementNS(t.SVG,"svg"),n=document.createElementNS(t.SVG,"svg");document.documentElement.append(e),n.setAttribute("x",5),e.append(n);const i=document.createElementNS(t.SVG,"text");i.textContent="a",n.append(i);try{return 0===i.getStartPositionOfChar(0).x}catch(e){return!1}finally{e.remove()}}(),y=function(){const e=document.createElementNS(t.SVG,"svg");document.documentElement.append(e);const n=document.createElementNS(t.SVG,"path");n.setAttribute("d","M0,0 C0,0 10,10 10,0"),e.append(n);const i=n.getBBox();return e.remove(),i.height>4&&i.height<5}(),b=function(){const e=document.createElementNS(t.SVG,"svg");document.documentElement.append(e);const n=document.createElementNS(t.SVG,"path");n.setAttribute("d","M0,0 10,0");const i=document.createElementNS(t.SVG,"path");i.setAttribute("d","M5,0 15,0");const s=document.createElementNS(t.SVG,"g");s.append(n,i),e.append(s);const o=s.getBBox();return e.remove(),15===o.width}(),v=(function(){const e=document.createElementNS(t.SVG,"rect");e.setAttribute("x",.1);const n=!e.cloneNode(!1).getAttribute("x").includes(",");n||i.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the latest version in which the problems have been fixed.')}(),function(){const e=document.createElementNS(t.SVG,"rect");return e.setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===e.style.vectorEffect}());let x=function(){const e=document.createElementNS(t.SVG,"rect").transform.baseVal,n=o.createSVGTransform();e.appendItem(n);const i=e.getItem(0),s=e=>e&&"object"==typeof e&&"function"==typeof e.setMatrix&&"angle"in e;return s(i)&&s(n)&&i.type===n.type&&i.angle===n.angle&&i.matrix.a===n.matrix.a&&i.matrix.b===n.matrix.b&&i.matrix.c===n.matrix.c&&i.matrix.d===n.matrix.d&&i.matrix.e===n.matrix.e&&i.matrix.f===n.matrix.f}();const w=()=>a,S=()=>l,k=()=>c,C=()=>u,A=()=>d,E=()=>h,G=()=>v; /** * A jQuery module to work with SVG attributes. * @module jQueryAttr * @license MIT */ function P(e){const t=e.fn.attr;return e.fn.attr=function(e,n){const i=this.length;if(!i)return t.call(this,e,n);for(let s=0;s{for(let n=0,i=t._xforms.length;n=0)return this._xforms[e];const t=new Error("DOMException with code=INDEX_SIZE_ERR");throw t.code=1,t}insertItemBefore(e,t){let n=null;if(t>=0)if(t=0&&(this._removeFromOtherLists(e),this._xforms[t]=e,n=e,this._list._update()),n}removeItem(e){if(e=0){const t=this._xforms[e],n=new Array(this.numberOfItems-1);let i;for(i=0;inew RegExp("^-?[\\d\\.]+"+e+"$").test(t)));if("id"===e){let e=!1;try{const i=B.getElement(t);e=Qe(i)||i===n}catch(e){}return e}return!0},W=document.createElementNS(t.SVG,"svg"),$=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},Y=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},Q=function(...e){const t=e.reduceRight((e,t)=>t.multiply(e));return Math.abs(t.a)<1e-14&&(t.a=0),Math.abs(t.b)<1e-14&&(t.b=0),Math.abs(t.c)<1e-14&&(t.c=0),Math.abs(t.d)<1e-14&&(t.d=0),Math.abs(t.e)<1e-14&&(t.e=0),Math.abs(t.f)<1e-14&&(t.f=0),t},K=function(e){if(!e)return!1;let t=e.numberOfItems;for(;t--;){const n=e.getItem(t);if(1===n.type&&!Y(n.matrix))return!0}return!1},Z=function(e,t,n,i,s){const o=$(e,t,s),r=$(e+n,t,s),a=$(e,t+i,s),l=$(e+n,t+i,s),c=Math.min(o.x,r.x,a.x,l.x),u=Math.max(o.x,r.x,a.x,l.x),d=Math.min(o.y,r.y,a.y,l.y);return{tl:o,tr:r,bl:a,br:l,aabox:{x:c,y:d,width:u-c,height:Math.max(o.y,r.y,a.y,l.y)-d}}},J=function(e,t,n){if(Qe(e))return W.createSVGTransformFromMatrix(W.createSVGMatrix());if(t=t||0,n=n||e.numberOfItems-1,(t=Number.parseInt(t))>(n=Number.parseInt(n))){const e=n;n=t,t=e}let i=W.createSVGMatrix();for(let s=t;s<=n;++s){const t=s>=0&&se.x&&t.ye.y},ie=P(jQuery),se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",oe="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use,clipPath".split(",");let re=null,ae=null,le=null,ce=null;const ue=function(e){re=e,ae=e.getDOMDocument(),le=e.getDOMContainer(),ce=e.getSVGRoot()},de=e=>e.replace(/()/,"$1$2"),he=function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")};function pe(e){if(e=me(e),window.btoa)return window.btoa(e);const t=new Array(4*Math.floor((e.length+2)/3));let n=0,i=0;do{const s=e.charCodeAt(n++),o=e.charCodeAt(n++),r=e.charCodeAt(n++),a=s>>2,l=(3&s)<<4|o>>4;let c=(15&o)<<2|r>>6,u=63&r;Number.isNaN(o)?(c=64,u=64):Number.isNaN(r)&&(u=64),t[i++]=se.charAt(a),t[i++]=se.charAt(l),t[i++]=se.charAt(c),t[i++]=se.charAt(u)}while(n>4,l=(15&s)<<4|o>>2,c=(3&o)<<6|r;t+=String.fromCharCode(a),64!==o&&(t+=String.fromCharCode(l)),64!==r&&(t+=String.fromCharCode(c))}while(nSVG-edit "],{type:"text/html"});return ye(e)}(),ve=function(e){let t,n;e.includes("0?n=n[0]:(n=e.ownerDocument.createElementNS(t.SVG,"defs"),e.firstChild?e.insertBefore(n,e.firstChild.nextSibling):e.append(n)),n},Ge=function(e){const t=e.pathSegList,n=t.numberOfItems,i=[[],[]],s=t.getItem(0);let o=[s.x,s.y];const r=function(e,t,n,i){return function(s){return 1-s**3*o[e]+3-s**2*s*t[e]+3*(1-s)*s**2*n[e]+s**3*i[e]}};for(let e=0;e0&&e<1&&i[n].push(a(e));continue}const d=l**2-4*u*c;if(d<0)continue;const h=(-l+Math.sqrt(d))/(2*c);h>0&&h<1&&i[n].push(a(h));const p=(-l-Math.sqrt(d))/(2*c);p>0&&p<1&&i[n].push(a(p))}o=s}else i[0].push(n.x),i[1].push(n.y)}const a=Math.min.apply(null,i[0]),l=Math.max.apply(null,i[0])-a,c=Math.min.apply(null,i[1]);return{x:a,y:c,width:l,height:Math.max.apply(null,i[1])-c}};function Pe(e){if(b)try{return e.getBBox()}catch(e){}const t=ie.data(e,"ref");let n,i,s=null;t?(i=ie(t).children().clone().attr("visibility","hidden"),ie(ce).append(i),s=i.filter("line, path")):s=ie(e).find("line, path");let o=!1;if(s.length)if(s.each((function(){const e=this.getBBox();e.width&&e.height||(o=!0)})),o){const s=t?i:ie(e).children();n=Re(s)}else n=e.getBBox();else n=e.getBBox();return t&&i.remove(),n}const Ne=function(e){const t=e||re.geSelectedElements()[0];if(1!==e.nodeType)return null;const n=t.nodeName;let i=null;switch(n){case"text":""===t.textContent?(t.textContent="a",i=t.getBBox(),t.textContent=""):t.getBBox&&(i=t.getBBox());break;case"path":y?t.getBBox&&(i=t.getBBox()):i=Ge(t);break;case"g":case"a":i=Pe(t);break;default:if("use"===n&&(i=Pe(t)),"use"===n||"foreignObject"===n&&w()){if(i||(i=t.getBBox()),!w()){const{x:e,y:n,width:s,height:o}=i;i={width:s,height:o,x:e+Number.parseFloat(t.getAttribute("x")||0),y:n+Number.parseFloat(t.getAttribute("y")||0)}}}else if(oe.includes(n))if(t)try{i=t.getBBox()}catch(e){const n=t.getExtentOfChar(0),s=t.getComputedTextLength();i={x:n.x,y:n.y,width:s,height:n.height}}else{const e=ie(t).closest("foreignObject");e.length&&e[0].getBBox&&(i=e[0].getBBox())}}return i&&(i=xe(i)),i},Ie=function(e){let t="";return ie.each(e,(function(e,[n,i]){t+=n;for(let e=0;e-.001&&n<.001||(n<-89.99||n>89.99))}(o,r)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))a=Me(e,t,n),i=a;else if("rect"===e.tagName){const s=e.getAttribute("rx"),o=e.getAttribute("ry");(s||o)&&(a=Me(e,t,n),i=a)}}if(!a){const{matrix:e}=J(s);i=Z(i.x,i.y,i.width,i.height,e).aabox}}return i};function Ve(e){const t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}const Re=function(e,t,n){if(!e||!e.length)return!1;let i;if(ie.each(e,(function(){i||this.parentNode&&(i=je(this,t,n))})),void 0===i)return null;let s=i.x+i.width,o=i.y+i.height,r=i.x,a=i.y;if(1===e.length){const t=Ve(e[0]);r-=t,a-=t,s+=t,o+=t}else ie.each(e,(function(e,i){const l=je(i,t,n);if(l){const e=Ve(i);r=Math.min(r,l.x-e),a=Math.min(a,l.y-e),1===i.nodeType&&(s=Math.max(s,l.x+l.width+e),o=Math.max(o,l.y+l.height+e))}}));return i.x=r,i.y=a,i.width=s-r,i.height=o-a,i},Be=function(e){e||(e=ie(re.getSVGContent()).children());const t=[];return ie(e).children().each((function(e,n){n.getBBox&&t.push(n)})),t.reverse()},Ue=function(e){return e||(e=Be()),Re(e,re.addSVGElementFromJson,re.pathActions)},De=function(e,t){if(!e)return 0;const n=e.numberOfItems;for(let i=0;i{e.getAttribute(t)===String(n)&&e.removeAttribute(t)})},We=function(e){const t=re.getBaseUnit();let n=re.getSnappingStep();return"px"!==t&&(n*=D()[t]),e=Math.round(e/n)*n},$e=function(e){return String(e).replace(/[.\\+*?[^\]$(){}=!<>|:-]/g,"\\$&")},Ye=function(e){ie(e).click((function(e){e.preventDefault()}))},Qe=e=>null==e;var Ke=Object.freeze({__proto__:null,init:ue,dropXMLInternalSubset:de,toXml:he,fromXml:function(e){return ie("

").html(e).text()},encode64:pe,decode64:ge,decodeUTF8:fe,encodeUTF8:me,dataURLToObjectURL:_e,createObjectURL:ye,blankPageObjectURL:be,convertToXMLReferences:function(e){let t="";return[...e].forEach(e=>{const n=e.charCodeAt();t+=n<=127?e:`&#${n};`}),t},text2xml:ve,bboxToObj:xe,walkTree:we,walkTreePost:Se,getUrlFromAttr:ke,get getHref(){return Ce},get setHref(){return Ae},findDefs:Ee,getPathBBox:Ge,getBBox:Ne,getPathDFromSegments:Ie,getPathDFromElement:Te,getExtraAttributesForConvertToPath:Le,getBBoxOfElementAsPath:Me,convertToPath:Oe,getBBoxWithTransform:je,getStrokedBBox:Re,getVisibleElements:Be,getStrokedBBoxDefaultVisible:Ue,getRotationAngleFromTransformList:De,get getRotationAngle(){return Fe},getRefElem:ze,getElem:He,assignAttributes:qe,cleanupElement:Xe,snapToGrid:We,regexEscape:$e,preventClickDefault:Ye,isNullish:Qe,mock:({getHref:e,setHref:t,getRotationAngle:n})=>{Ce=e,Ae=t,Fe=n},$q:e=>document.querySelector(e),$qq:e=>[...document.querySelectorAll(e)]}); /** * Adds context menu functionality. * @module contextmenu * @license Apache-2.0 * @author Adam Bender */const Ze=jQuery;let Je={};const et=function(){Object.values(Je).forEach(e=>{!function(e){Object.keys(Je).length||Ze("#cmenu_canvas").append("

  • ");const t=e.shortcut||"";Ze("#cmenu_canvas").append("
  • "+e.label+""+t+"
  • ")}(e)})};function tt(){return(tt=Object.assign||function(e){for(var t=1;t{n in t&&(e[n]=t[n])})}function it(e,t){return st(e,tt({},t,{returnDefault:!0}))}async function st(e,{global:t,returnDefault:n}){return"svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules?(await ot(e),window[t]):function e(t,n={},{returnDefault:i=!1}={}){if(Array.isArray(t))return Promise.all(t.map(t=>e(t,n)));return new Promise((e,s)=>{const o="$importModule$"+Math.random().toString(32).slice(2),r=document.createElement("script");function a(){s(new Error("Failed to import: "+t)),c()}function l(){e(window[o]),c()}const c=()=>{delete window[o],r.removeEventListener("error",a),r.removeEventListener("load",l),r.remove(),URL.revokeObjectURL(r.src),r.src=""};nt(r,n),r.defer="defer",r.type="module",r.addEventListener("error",a),r.addEventListener("load",l);const u=`import * as m from '${function(e){const t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}(t).replace(/'/g,"\\'")}'; window.${o} = ${i?"m.default || ":""}m;`,d=new Blob([u],{type:"text/javascript"});r.src=URL.createObjectURL(d),document.head.append(r)})}(e,void 0,{returnDefault:n})}function ot(e,t={}){return Array.isArray(e)?Promise.all(e.map(e=>ot(e,t))):new Promise((n,i)=>{const s=document.createElement("script");function o(){i(new Error("Failed to import: "+e)),a()}function r(){n(),a()}const a=()=>{s.removeEventListener("error",o),s.removeEventListener("load",r),s.remove(),s.src=""};s.defer="defer",nt(s,t),s.addEventListener("error",o),s.addEventListener("load",r),s.src=e,document.head.append(s)})}const rt={true:!0,false:!1,null:null};function at(e,t={ok:"Ok",cancel:"Cancel"}){e("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");const n=e("#dialog_box"),i=e("#dialog_buttons"),s=e("#dialog_content");function o(o,r,a,l,c,u){s.html("

    "+r.replace(/\n/g,"

    ")+"

    ").toggleClass("prompt","prompt"===o),i.empty();const d=e('').appendTo(i);return new Promise((h,p)=>{let g,f;if("alert"!==o&&e('').appendTo(i).click((function(){n.hide(),h(!1)})),"prompt"===o)g=e('').prependTo(i),g.val(a||""),g.bind("keydown","return",(function(){d.click()}));else if("select"===o){const t=e('
    ');if(g=e(`').appendTo(n),f.val(u.value),u.tooltip&&n.attr("title",u.tooltip),f.prop("checked",Boolean(u.checked)),t.append(e("
    ").append(n))}e.each(l||[],(function(t,n){"object"==typeof n?g.append(e("