34 lines
314 KiB
Java
34 lines
314 KiB
Java
import{R as Go,J as Bt,O as Uo}from"./NodeContainer.vue_vue_type_style_index_0_lang-hKTylTLH-Banxh0Pc.js";import{o as $o}from"./index-Crt100Db-kwMQ9qxI.js";import{P as qo}from"./propStore-Cl0CojEU-DVRhovlH.js";import{h as io,w as oo,i as ne,e as Qn,f as Jn,g as ro,S as ao,j as Tn,O as Zt,l as so,G as Jt,m as Be,n as lo,V as An,y as Ko,o as Xo,v as Vo,q as Yo,M as Zo,p as Qo,r as Jo,N as er,t as tr,x as Ze,z as nr,D as ir,E as or,F as rr,W as li,H as ci,I as co,J as ar,K as sr,Q as lr,R as Wn,U as en,X as cr,Y as dr,_ as uo,a as ur,L as kt,T as ho,b as hr}from"./NodeStyle-B8zHc98v-CG4nvzST.js";import{aP as pr,c5 as Gn,cd as po,b_ as Re,ce as fr,cf as tn,bY as fo,h as di,c1 as gr,cg as mr,v as ui,aC as vr}from"./antd-vue-vendor-BPnV8VqP.js";import{n as go}from"./_commonjsHelpers-B52_cu2H-BG14nIm9.js";import{s as yr}from"./LoopIcon.vue_vue_type_script_setup_true_lang-C5lzCc06-DA3RGWsk.js";import{d as br,f as Dn,e as wr,aC as Cr,h as Er,o as xr,as as Nr,u as hi,aG as Sr,aF as Tr,au as Ar,aB as kr}from"./vue-vendor-C7Zq48Yl.js";import{O as Or}from"./useNode-BoUed8Qy-C7AZqKSZ.js";import{l as _r}from"./runStore-Oe6fP2qb-B0I25-TS.js";var Rr=Object.defineProperty,Mr=Object.defineProperties,Dr=Object.getOwnPropertyDescriptors,pi=Object.getOwnPropertySymbols,Pr=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,fi=(r,e,t)=>e in r?Rr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ei=(r,e)=>{for(var t in e||(e={}))Pr.call(e,t)&&fi(r,t,e[t]);if(pi)for(var t of pi(e))Lr.call(e,t)&&fi(r,t,e[t]);return r},ti=(r,e)=>Mr(r,Dr(e)),gi={width:40,height:40},mi={width:40,height:40},vi={width:40,height:40},yi={width:100,height:80},bi={width:100,height:80},Ir=(function(){function r(){globalThis._ids=this,this._ids=new Set}return r.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,function(e){var t=Math.random()*16|0,n=e==="x"?t:t&3|8;return n.toString(16)})},r.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},r})(),Br=(globalThis==null?void 0:globalThis._ids)||new Ir;function Ht(){return Br.next()}var mo=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){mo(e,r);function e(t,n){return t.id||(t.id="Event_".concat(Ht())),t.text||(t.text=""),t.text&&typeof t.text=="string"&&(t.text={value:t.text,x:t.x,y:t.y+40}),r.call(this,t,n)||this}return e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedTargetRules=function(){var t=r.prototype.getConnectedTargetRules.call(this),n={message:"起始节点不能作为边的终点",validate:function(){return!1}};return t.push(n),t},e.extendKey="StartEventModel",e})(io);(function(r){mo(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.extendKey="StartEventNode",e})(oo);var vo=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),dn=function(){return dn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},dn.apply(this,arguments)};(function(r){vo(e,r);function e(t,n){return t.id||(t.id="Event_".concat(Ht())),t.text||(t.text=""),t.text&&typeof t.text=="string"&&(t.text={value:t.text,x:t.x,y:t.y+40}),r.call(this,t,n)||this}return e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedSourceRules=function(){var t=r.prototype.getConnectedSourceRules.call(this),n={message:"结束节点不能作为边的起点",validate:function(){return!1}};return t.push(n),t},e.extendKey="EndEventModel",e})(io);(function(r){vo(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},e.prototype.getShape=function(){var t=this.props.model,n=t.getNodeStyle(),i=t,o=i.x,s=i.y,c=i.r,a=r.prototype.getShape.call(this);return ne("g",{},a,ne("circle",dn(dn({},n),{cx:o,cy:s,r:c-5})))},e.extendKey="EndEventView",e})(oo);var yo=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){yo(e,r);function e(t,n){return t.id||(t.id="Flow_".concat(Ht())),r.call(this,t,n)||this}return e.extendKey="SequenceFlowModel",e})(Qn);(function(r){yo(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.extendKey="SequenceFlowEdge",e})(Jn);var bo=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Kt=function(){return Kt=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Kt.apply(this,arguments)};(function(r){bo(e,r);function e(t,n){var i=this;return t.id||(t.id="Gateway_".concat(Ht())),t.text||(t.text=""),t.text&&typeof t.text=="string"&&(t.text={value:t.text,x:t.x,y:t.y+40}),i=r.call(this,t,n)||this,i.points=[[25,0],[50,25],[25,50],[0,25]],i}return e.extendKey="ExclusiveGatewayModel",e})(ro);(function(r){bo(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getShape=function(){var t=this.props.model,n=t,i=n.x,o=n.y,s=n.width,c=n.height,a=n.points,l=t.getNodeStyle();return ne("g",{transform:"matrix(1 0 0 1 ".concat(i-s/2," ").concat(o-c/2,")")},ne("polygon",Kt(Kt({},l),{x:i,y:o,points:a})),ne("path",Kt({d:"m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z"},l)))},e.extendKey="ExclusiveGatewayNode",e})(ao);var wo=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Un=function(){return Un=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Un.apply(this,arguments)};(function(r){wo(e,r);function e(t,n){return t.id||(t.id="Activity_".concat(Ht())),r.call(this,t,n)||this}return e.extendKey="ServiceTaskModel",e})(Tn);(function(r){wo(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getLabelShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,s=t.height,c=t.getNodeStyle();return ne("svg",{x:n-o/2+5,y:i-s/2+5,width:30,height:30,viewBox:"0 0 1274 1024"},ne("path",{fill:c.stroke,d:"M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z"}))},e.prototype.getShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,s=t.height,c=t.radius,a=t.getNodeStyle();return ne("g",{},[ne("rect",Un({x:n-o/2,y:i-s/2,rx:c,ry:c,width:o,height:s},a)),this.getLabelShape()])},e.extendKey="ServiceTaskNode",e})(Zt);var Co=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),un=function(){return un=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},un.apply(this,arguments)};(function(r){Co(e,r);function e(t,n){return t.id||(t.id="Activity_".concat(Ht())),r.call(this,t,n)||this}return e.extendKey="UserTaskModel",e})(Tn);(function(r){Co(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getLabelShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,s=t.height,c=t.getNodeStyle();return ne("svg",{x:n-o/2+5,y:i-s/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},ne("path",{fill:c.stroke,d:"M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z"}))},e.prototype.getShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,s=t.height,c=t.radius,a=t.getNodeStyle();return ne("g",{},[ne("rect",un(un({},a),{x:n-o/2,y:i-s/2,rx:c,ry:c,width:o,height:s})),this.getLabelShape()])},e.extendKey="UserTaskNode",e})(Zt);var jr=(function(){function r(){globalThis._ids=this,this._ids=new Set}return r.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,function(e){var t=Math.random()*16|0,n=e==="x"?t:t&3|8;return n.toString(16)})},r.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},r})(),Hr=(globalThis==null?void 0:globalThis._ids)||new jr;function wi(){return Hr.next()}function Eo(r){return Object.prototype.toString.call(r)}function Fr(r){return" ".repeat(r)}function hn(r){var e=r;return Eo(r)==="[object Object]"?(e={},Object.keys(r).forEach(function(t){var n=t;t.charAt(0)==="-"&&(n=t.substring(1)),e[n]=hn(r[t])})):Array.isArray(r)&&(e=[],r.forEach(function(t,n){e[n]=hn(t)})),e}function pn(r){return r==null?"":r.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function zr(r){var e=r;try{typeof e!="string"&&(e=JSON.parse(r))}catch(t){e=JSON.stringify(hn(r)).replace(/"/g,"'")}return pn(String(e))}var St=`
|
||
`;function sn(r,e,t){var n=Fr(t);if(r!==0&&r!==!1&&!r)return St+n+"<".concat(e," />");var i="";if(e==="#text")return St+n+pn(String(r));if(e==="#cdata-section")return St+n+"<![CDATA["+r+"]]>";if(e==="#comment")return St+n+"<!--"+r+"-->";if("".concat(e).charAt(0)==="-")return" "+e.substring(1)+'="'+zr(r)+'"';if(Array.isArray(r))r.forEach(function(a){i+=sn(a,e,t+1)});else if(Eo(r)==="[object Object]"){var o=Object.keys(r),s="",c="";i+=(t===0?"":St+n)+"<"+e,o.forEach(function(a){a.charAt(0)==="-"?s+=sn(r[a],a,t+1):c+=sn(r[a],a,t+1)}),i+=s+(c!==""?">".concat(c).concat(St+n,"</").concat(e,">"):" />")}else i+=St+n+"<".concat(e,">").concat(pn(String(r)),"</").concat(e,">");return i}function Wr(r){var e="";for(var t in r)e+=sn(r[t],t,0);return e}var Je=function(){};Je.ObjTree=function(){return this};Je.ObjTree.VERSION="0.23";Je.ObjTree.prototype.xmlDecl=`<?xml version="1.0" encoding="UTF-8" ?>
|
||
`;Je.ObjTree.prototype.attr_prefix="-";Je.ObjTree.prototype.parseXML=function(r){var e;if(window.DOMParser){var t=new DOMParser,n=t.parseFromString(r,"application/xml");if(!n)return;e=n.documentElement}else window.ActiveXObject&&(t=new ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.loadXML(r),e=t.documentElement);if(e)return this.parseDOM(e)};Je.ObjTree.prototype.parseHTTP=function(r,e,t){var n={};for(var i in e)n[i]=e[i];if(n.method||(typeof n.postBody=="undefined"&&typeof n.postbody=="undefined"&&typeof n.parameters=="undefined"?n.method="get":n.method="post"),t){n.asynchronous=!0;var o=this,s=t,c=n.onComplete;n.onComplete=function(d){var u;d&&d.responseXML&&d.responseXML.documentElement&&(u=o.parseDOM(d.responseXML.documentElement)),s(u,d),c&&c(d)}}else n.asynchronous=!1;var a;if(typeof HTTP!="undefined"&&HTTP.Request){n.uri=r;var l=new HTTP.Request(n);l&&(a=l.transport)}else if(typeof Ajax!="undefined"&&Ajax.Request){var l=new Ajax.Request(r,n);l&&(a=l.transport)}if(t)return a;if(a&&a.responseXML&&a.responseXML.documentElement)return this.parseDOM(a.responseXML.documentElement)};Je.ObjTree.prototype.parseDOM=function(r){if(r){if(this.__force_array={},this.force_array)for(var e=0;e<this.force_array.length;e++)this.__force_array[this.force_array[e]]=1;var t=this.parseElement(r);if(this.__force_array[r.nodeName]&&(t=[t]),r.nodeType!=11){var n={};n[r.nodeName]=t,t=n}return t}};Je.ObjTree.prototype.parseElement=function(r){if(r.nodeType!=7){if(r.nodeType==3||r.nodeType==4||r.nodeType==8){var e=r.nodeValue.match(/[^\x00-\x20]/);return e==null?void 0:r.nodeValue}var t=null,n={};if(r.attributes&&r.attributes.length){t={};for(var i=0;i<r.attributes.length;i++){var o=r.attributes[i].nodeName;if(typeof o=="string"){var s=r.attributes[i].nodeValue;try{s=JSON.parse(r.attributes[i].nodeValue.replace(/'/g,'"'))}catch(l){s=r.attributes[i].nodeValue}s&&(o=this.attr_prefix+o,typeof n[o]=="undefined"&&(n[o]=0),n[o]++,this.addNode(t,o,n[o],s))}}}if(r.childNodes&&r.childNodes.length){var c=!0;t&&(c=!1);for(var i=0;i<r.childNodes.length&&c;i++){var a=r.childNodes[i].nodeType;a==3||a==4||a==8||(c=!1)}if(c){t||(t="");for(var i=0;i<r.childNodes.length;i++)t+=r.childNodes[i].nodeValue}else{t||(t={});for(var i=0;i<r.childNodes.length;i++){var o=r.childNodes[i].nodeName;if(typeof o=="string"){var s=this.parseElement(r.childNodes[i]);s&&(typeof n[o]=="undefined"&&(n[o]=0),n[o]++,this.addNode(t,o,n[o],s))}}}}else t===null&&(t={});return t}};Je.ObjTree.prototype.addNode=function(r,e,t,n){this.__force_array[e]?(t==1&&(r[e]=[]),r[e][r[e].length]=n):t==1?r[e]=n:t==2?r[e]=[r[e],n]:r[e][r[e].length]=n};Je.ObjTree.prototype.writeXML=function(r){var e=this.hash_to_xml(null,r);return this.xmlDecl+e};Je.ObjTree.prototype.hash_to_xml=function(r,e){var t=[],n=[];for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];i.charAt(0)!=this.attr_prefix?typeof o=="undefined"||o==null?t[t.length]="<"+i+" />":typeof o=="object"&&o.constructor==Array?t[t.length]=this.array_to_xml(i,o):typeof o=="object"?t[t.length]=this.hash_to_xml(i,o):t[t.length]=this.scalar_to_xml(i,o):n[n.length]=" "+i.substring(1)+'="'+this.xml_escape(o)+'"'}var s=n.join(""),c=t.join("");return typeof r=="undefined"||r==null||(t.length>0?c.match(/\n/)?c="<"+r+s+`>
|
||
`+c+"</"+r+`>
|
||
`:c="<"+r+s+">"+c+"</"+r+`>
|
||
`:c="<"+r+s+` />
|
||
`),c};Je.ObjTree.prototype.array_to_xml=function(r,e){for(var t=[],n=0;n<e.length;n++){var i=e[n];typeof i=="undefined"||i==null?t[t.length]="<"+r+" />":typeof i=="object"&&i.constructor==Array?t[t.length]=this.array_to_xml(r,i):typeof i=="object"?t[t.length]=this.hash_to_xml(r,i):t[t.length]=this.scalar_to_xml(r,i)}return t.join("")};Je.ObjTree.prototype.scalar_to_xml=function(r,e){return r=="#text"?this.xml_escape(e):"<"+r+">"+this.xml_escape(e)+"</"+r+`>
|
||
`};Je.ObjTree.prototype.xml_escape=pn;var Gr=function(r){return new Je.ObjTree().parseXML(r)},Ur=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),$n=function(){return $n=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},$n.apply(this,arguments)},kn=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},vt;(function(r){r.START="bpmn:startEvent",r.END="bpmn:endEvent",r.GATEWAY="bpmn:exclusiveGateway",r.USER="bpmn:userTask",r.SYSTEM="bpmn:serviceTask",r.FLOW="bpmn:sequenceFlow"})(vt||(vt={}));var xo=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef"],Ci=["properties","startPoint","endPoint","pointsList"],No=function(r){return String(r||"").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'")};function Ei(r){var e=r?Ci.concat(r):Ci;return function(t){function n(i){var o={};return typeof i=="string"?i:Array.isArray(i)?i.map(function(s){return n(s)}):(Object.entries(i).forEach(function(s){var c=kn(s,2),a=c[0],l=c[1];typeof l!="object"?a.indexOf("-")===0||["#text","#cdata-section","#comment"].includes(a)?o[a]=l:o["-".concat(a)]=l:e.includes(a)?o["-".concat(a)]=n(l):o[a]=n(l)}),o)}return n(t)}}function fn(r){var e={};return Object.entries(r).forEach(function(t){var n=kn(t,2),i=n[0],o=n[1];i.indexOf("-")===0?e[i.substring(1)]=hn(o):typeof o=="string"?e[i]=o:Object.prototype.toString.call(o)==="[object Object]"?e[i]=fn(o):Array.isArray(o)?e[i]=o.map(function(s){return fn(s)}):e[i]=o}),e}function $r(r,e,t){var n=new Map;e.nodes.forEach(function(o){var s,c={"-id":o.id};if(!((s=o.text)===null||s===void 0)&&s.value&&(c["-name"]=o.text.value),o.properties){var a=Ei(t)(o.properties);Object.assign(c,a)}n.set(o.id,c),r[o.type]?Array.isArray(r[o.type])?r[o.type].push(c):r[o.type]=[r[o.type],c]:r[o.type]=c});var i=e.edges.map(function(o){var s,c,a=n.get(o.targetNodeId);a["bpmn:incoming"]?Array.isArray(a["bpmn:incoming"])?a["bpmn:incoming"].push(o.id):a["bpmn:incoming"]=[a["bpmn:incoming"],o.id]:a["bpmn:incoming"]=o.id;var l={"-id":o.id,"-sourceRef":o.sourceNodeId,"-targetRef":o.targetNodeId};if(!((s=o.text)===null||s===void 0)&&s.value&&(l["-name"]=(c=o.text)===null||c===void 0?void 0:c.value),o.properties){var d=Ei(t)(o.properties);Object.assign(l,d)}return l});e.edges.forEach(function(o){var s=n.get(o.sourceNodeId);s["bpmn:outgoing"]?Array.isArray(s["bpmn:outgoing"])?s["bpmn:outgoing"].push(o.id):s["bpmn:outgoing"]=[s["bpmn:outgoing"],o.id]:s["bpmn:outgoing"]=o.id}),r[vt.FLOW]=i}function qr(r,e){r["bpmndi:BPMNEdge"]=e.edges.map(function(t){var n,i=t.id,o=t.pointsList.map(function(c){var a=c.x,l=c.y;return{"-x":a,"-y":l}}),s={"-id":"".concat(i,"_di"),"-bpmnElement":i,"di:waypoint":o};return!((n=t.text)===null||n===void 0)&&n.value&&(s["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-t.text.value.length*10/2,"-y":t.text.y-7,"-width":t.text.value.length*10,"-height":14}}),s}),r["bpmndi:BPMNShape"]=e.nodes.map(function(t){var n,i=t.id,o=100,s=80,c=t.x,a=t.y,l=Ct.shapeConfigMap.get(t.type);l&&(o=l.width,s=l.height),c-=o/2,a-=s/2;var d={"-id":"".concat(i,"_di"),"-bpmnElement":i,"dc:Bounds":{"-x":c,"-y":a,"-width":o,"-height":s}};return!((n=t.text)===null||n===void 0)&&n.value&&(d["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-t.text.value.length*10/2,"-y":t.text.y-7,"-width":t.text.value.length*10,"-height":14}}),d})}function Kr(r){var e=[],t=[],n=r["bpmn:definitions"];if(n){var i=n["bpmn:process"],o=n["bpmndi:BPMNDiagram"],s=o==null?void 0:o["bpmndi:BPMNPlane"];if(!i||!s)return{nodes:e,edges:t};Object.keys(i).forEach(function(c){if(c.indexOf("bpmn:")===0){var a=i[c];if(c===vt.FLOW){var l=s["bpmndi:BPMNEdge"],d=(Array.isArray(l),l);t=Vr(a,d)}else{var u=s["bpmndi:BPMNShape"],h=(Array.isArray(u),u);e=e.concat(Xr(a,h,c))}}})}return{nodes:e,edges:t}}function Xr(r,e,t){var n=[];if(Array.isArray(r))r.forEach(function(s){var c;Array.isArray(e)?c=e.find(function(l){return l["-bpmnElement"]===s["-id"]}):c=e;var a=xi(c,t,s);n.push(a)});else{var i=void 0;Array.isArray(e)?i=e.find(function(s){return s["-bpmnElement"]===r["-id"]}):i=e;var o=xi(i,t,r);n.push(o)}return n}function xi(r,e,t){var n=Number(r["dc:Bounds"]["-x"]),i=Number(r["dc:Bounds"]["-y"]),o=No(t["-name"]),s=Ct.shapeConfigMap.get(e);s&&(n+=s.width/2,i+=s.height/2);var c;Object.entries(t).forEach(function(u){var h=kn(u,2),p=h[0],v=h[1];xo.indexOf(p)===-1&&(c||(c={}),c[p]=v)}),c&&(c=fn(c));var a;if(o&&(a={x:n,y:i,value:o},r["bpmndi:BPMNLabel"]&&r["bpmndi:BPMNLabel"]["dc:Bounds"])){var l=r["bpmndi:BPMNLabel"]["dc:Bounds"];a.x=Number(l["-x"])+Number(l["-width"])/2,a.y=Number(l["-y"])+Number(l["-height"])/2}var d={id:r["-bpmnElement"],type:e,x:n,y:i,properties:c};return a&&(d.text=a),d}function Vr(r,e){var t=[];if(Array.isArray(r))r.forEach(function(i){var o;Array.isArray(e)?o=e.find(function(s){return s["-bpmnElement"]===i["-id"]}):o=e,t.push(Ni(o,i))});else{var n=void 0;Array.isArray(e)?n=e.find(function(i){return i["-bpmnElement"]===r["-id"]}):n=e,t.push(Ni(n,r))}return t}function Ni(r,e){var t,n=e["-name"]?No("".concat(e["-name"])):"";if(n){var i=void 0;r["bpmndi:BPMNLabel"]&&r["bpmndi:BPMNLabel"]["dc:Bounds"]&&(i=r["bpmndi:BPMNLabel"]["dc:Bounds"]);var o=0;if(n.split(`
|
||
`).forEach(function(p){o<p.length&&(o=p.length)}),i)t={value:n,x:Number(i["-x"])+o*10/2,y:Number(i["-y"])+7};else{var s=r["di:waypoint"]||[],c=s[0],a=s[s.length-1]||c,l=(Number((c==null?void 0:c["-x"])||0)+Number((a==null?void 0:a["-x"])||0))/2,d=(Number((c==null?void 0:c["-y"])||0)+Number((a==null?void 0:a["-y"])||0))/2;t={value:n,x:l,y:d}}}var u;Object.entries(e).forEach(function(p){var v=kn(p,2),y=v[0],b=v[1];xo.indexOf(y)===-1&&(u||(u={}),u[y]=b)}),u&&(u=fn(u));var h={id:e["-id"],type:vt.FLOW,pointsList:r["di:waypoint"].map(function(p){return{x:Number(p["-x"]),y:Number(p["-y"])}}),sourceNodeId:e["-sourceRef"],targetNodeId:e["-targetRef"],properties:u};return t&&(h.text=t),h}var Ct=(function(){function r(e){var t=e.lf,n=this;this.adapterOut=function(i,o){var s=$n({},n.processAttributes);$r(s,i,o);var c={"-id":"BPMNPlane_1","-bpmnElement":s["-id"]};qr(c,i);var a=n.definitionAttributes;a["bpmn:process"]=s,a["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":c};var l={"bpmn:definitions":a};return l},this.adapterIn=function(i){if(i)return Kr(i)},t.adapterIn=function(i){return n.adapterIn(i)},t.adapterOut=function(i,o){return n.adapterOut(i,o)},this.processAttributes={"-isExecutable":"true","-id":"Process_".concat(wi())},this.definitionAttributes={"-id":"Definitions_".concat(wi()),"-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.0"}}return r.prototype.setCustomShape=function(e,t){r.shapeConfigMap.set(e,t)},r.pluginName="bpmn-adapter",r.shapeConfigMap=new Map,r})();Ct.shapeConfigMap.set(vt.START,{width:gi.width,height:gi.height});Ct.shapeConfigMap.set(vt.END,{width:mi.width,height:mi.height});Ct.shapeConfigMap.set(vt.GATEWAY,{width:vi.width,height:vi.height});Ct.shapeConfigMap.set(vt.SYSTEM,{width:yi.width,height:yi.height});Ct.shapeConfigMap.set(vt.USER,{width:bi.width,height:bi.height});(function(r){Ur(e,r);function e(t){var n=r.call(this,t)||this;n.adapterXmlIn=function(o){var s=typeof o=="string"?n.sanitizeNameAttributes(o):o,c=Gr(s);return n.adapterIn(c)},n.adapterXmlOut=function(o,s){var c=n.adapterOut(o,s);return Wr(c)};var i=t.lf;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n}return e.prototype.sanitizeNameAttributes=function(t){return t.replace(/name="([^"]*)"/g,function(n,i){var o=i.replace(/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">");return'name="'.concat(o,'"')})},e.pluginName="bpmnXmlAdapter",e})(Ct);var Yr=(function(){function r(){globalThis._ids=this,this._ids=new Set}return r.prototype.generateId=function(){var e="xxxxxxx".replace(/[x]/g,function(t){var n=Math.random()*16|0,i=t==="x"?n:n&3|8;return i.toString(16)});return e},r.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},r})(),Zr=(globalThis==null?void 0:globalThis._ids)||new Yr;function Qr(){return Zr.next()}ne("circle",{cx:18,cy:18,r:11,style:"stroke-linecap: round;stroke-linejoin: round;stroke: rgb(34, 36, 42);stroke-width: 2px;fill: white"}),ne("path",{d:"M 18,18 l 2.25,-7.5 m -2.25,7.5 l 5.25,1.5",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 2px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(0,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(30,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(60,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(90,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(120,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(150,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(180,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(210,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(240,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(270,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(300,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),ne("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(330,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"});ne("circle",{cx:18,cy:18,r:10,style:"stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 4px; fill: rgb(34, 36, 42);"});ne("circle",{cx:25,cy:25,r:13,style:"stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 2.5px; fill: white;"});var Jr=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Ot=function(){return Ot=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ot.apply(this,arguments)},ea=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},ta=so,na=(function(r){Jr(e,r);function e(t){var n=r.call(this)||this;return n.updatePosition=function(i){var o=i.deltaX,s=i.deltaY,c=n.nodeModel,a=c.x,l=c.y;n.nodeModel.x=a+o/2,n.nodeModel.y=l+s/2,n.nodeModel.moveText(o/2,s/2)},n.getResize=function(i){var o=i.index,s=i.deltaX,c=i.deltaY,a=i.width,l=i.height,d=i.PCTResizeInfo,u=i.pct,h=u===void 0?1:u,p=i.freezeWidth,v=p===void 0?!1:p,y=i.freezeHeight,b=y===void 0?!1:y,k={width:a,height:l,deltaX:s,deltaY:c};if(d){var B=4,W=0,K=0;switch(o){case 0:K=(s*-1-c)/B;break;case 1:K=(s-c)/B;break;case 2:K=(s+c)/B;break;case 3:K=(s*-1+c)/B;break}K!==0&&(W=Math.round(K/d.ResizeBasis.basisHeight*1e5)/1e3),d.ResizePCT.widthPCT=Math.max(Math.min(d.ResizePCT.widthPCT+W,d.ScaleLimit.maxScaleLimit),d.ScaleLimit.minScaleLimit),d.ResizePCT.heightPCT=Math.max(Math.min(d.ResizePCT.heightPCT+W,d.ScaleLimit.maxScaleLimit),d.ScaleLimit.minScaleLimit);var le=Math.round(d.ResizePCT.widthPCT*d.ResizeBasis.basisWidth/100),G=Math.round(d.ResizePCT.heightPCT*d.ResizeBasis.basisHeight/100);switch(o){case 0:s=a-le,c=l-G;break;case 1:s=le-a,c=l-G;break;case 2:s=le-a,c=G-l;break;case 3:s=a-le,c=G-l;break}return k.width=le,k.height=G,k.deltaX=s/h,k.deltaY=c/h,k}switch(o){case 0:k.width=v?a:a-s*h,k.height=b?l:l-c*h;break;case 1:k.width=v?a:a+s*h,k.height=b?l:l-c*h;break;case 2:k.width=v?a:a+s*h,k.height=b?l:l+c*h;break;case 3:k.width=v?a:a-s*h,k.height=b?l:l+c*h;break}return k},n.updateEdgePointByAnchors=function(){var i=n.nodeModel,o=i.id,s=i.anchors,c=n.getNodeEdges(o);c.sourceEdges.forEach(function(a){var l=s.find(function(d){return d.id===a.sourceAnchorId});l&&a.updateStartPoint({x:l.x,y:l.y})}),c.targetEdges.forEach(function(a){var l=s.find(function(d){return d.id===a.targetAnchorId});l&&a.updateEndPoint({x:l.x,y:l.y})})},n.updateRect=function(i){var o=i.deltaX,s=i.deltaY,c=n.nodeModel,a=c.x,l=c.y,d=c.width,u=c.height,h=c.radius,p=c.PCTResizeInfo,v=n.nodeModel,y=v.minWidth,b=v.minHeight,k=v.maxWidth,B=v.maxHeight,W=n.index,K=y===k,le=b===B,G=n.getResize({index:W,deltaX:o,deltaY:s,width:d,height:u,PCTResizeInfo:p,pct:1,freezeWidth:K,freezeHeight:le});if(G.width<y||G.width>k||G.height<b||G.height>B){n.dragHandler.cancelDrag();return}n.updatePosition({deltaX:K?0:G.deltaX,deltaY:le?0:G.deltaY}),n.nodeModel.width=G.width,n.nodeModel.height=G.height,n.nodeModel.setProperties({nodeSize:{width:G.width,height:G.height}});var L={x:a,y:l,width:d,height:u,radius:h},ue={x:n.nodeModel.x,y:n.nodeModel.y,width:n.nodeModel.width,height:n.nodeModel.height,radius:h};n.updateEdgePointByAnchors(),n.eventEmit({deltaX:o,deltaY:s,beforeNode:L,afterNode:ue})},n.updateEllipse=function(i){var o=i.deltaX,s=i.deltaY,c=n.nodeModel,a=c.rx,l=c.ry,d=c.x,u=c.y,h=c.PCTResizeInfo,p=n.index,v=n.nodeModel,y=v.minWidth,b=v.minHeight,k=v.maxWidth,B=v.maxHeight,W=y===k,K=b===B,le=a,G=l,L=n.getResize({index:p,deltaX:o,deltaY:s,width:le,height:G,PCTResizeInfo:h,pct:1/2,freezeWidth:W,freezeHeight:K});if(L.width<y/2||L.width>k/2||L.height<b/2||L.height>B/2){n.dragHandler.cancelDrag();return}n.updatePosition({deltaX:W?0:L.deltaX,deltaY:K?0:L.deltaY}),n.nodeModel.rx=L.width,n.nodeModel.ry=L.height,n.nodeModel.setProperties({nodeSize:{rx:L.width,ry:L.height}});var ue={x:d,y:u},Q={rx:L.width,ry:L.height,x:n.nodeModel.x,y:n.nodeModel.y};n.updateEdgePointByAnchors(),n.eventEmit({deltaX:o,deltaY:s,beforeNode:Ot(Ot({},ue),{rx:a,ry:l}),afterNode:Q})},n.updateDiamond=function(i){var o=i.deltaX,s=i.deltaY,c=n.nodeModel,a=c.rx,l=c.ry,d=c.x,u=c.y,h=c.PCTResizeInfo,p=n.index,v=n.nodeModel,y=v.minWidth,b=v.minHeight,k=v.maxWidth,B=v.maxHeight,W=y===k,K=b===B,le=a,G=l,L=n.getResize({index:p,deltaX:o,deltaY:s,width:le,height:G,PCTResizeInfo:h,pct:1/2,freezeWidth:W,freezeHeight:K});if(L.width<y/2||L.width>k/2||L.height<b/2||L.height>B/2){n.dragHandler.cancelDrag();return}n.updatePosition({deltaX:W?0:L.deltaX,deltaY:K?0:L.deltaY}),n.nodeModel.rx=L.width,n.nodeModel.ry=L.height,n.nodeModel.setProperties({nodeSize:{rx:L.width,ry:L.height}});var ue={x:d,y:u,rx:a,ry:l},Q={rx:L.width,ry:L.height,x:n.nodeModel.x,y:n.nodeModel.y};n.updateEdgePointByAnchors(),n.eventEmit({deltaX:o,deltaY:s,beforeNode:ue,afterNode:Q})},n.eventEmit=function(i){var o=i.deltaX,s=i.deltaY,c=i.beforeNode,a=i.afterNode,l=n.nodeModel,d=l.id,u=l.modelType,h=l.type,p=Ot({id:d,modelType:u,type:h},c),v=Ot({id:d,modelType:u,type:h},a);n.graphModel.eventCenter.emit("node:resize",{preData:p,data:v,deltaX:o,deltaY:s,index:n.index,model:n.nodeModel})},n.onDragging=function(i){var o,s=i.deltaX,c=i.deltaY,a=n.graphModel.transformModel,l=n.nodeModel.modelType;o=ea(a.fixDeltaXY(s,c),2),s=o[0],c=o[1],l===Jt.RECT_NODE||l===Jt.HTML_NODE?n.updateRect({deltaX:s,deltaY:c}):l===Jt.ELLIPSE_NODE?n.updateEllipse({deltaX:s,deltaY:c}):l===Jt.DIAMOND_NODE&&n.updateDiamond({deltaX:s,deltaY:c})},n.onDragEnd=function(){var i=n.graphModel.gridSize,o=i===void 0?1:i,s=o*Math.round(n.nodeModel.x/o),c=o*Math.round(n.nodeModel.y/o);n.nodeModel.moveTo(s,c),n.updateEdgePointByAnchors()},n.index=t.index,n.nodeModel=t.model,n.graphModel=t.graphModel,n.dragHandler=new ta({onDragging:n.onDragging,onDragEnd:n.onDragEnd,step:1}),n}return e.prototype.getNodeEdges=function(t){for(var n=this.graphModel,i=n.edges,o=[],s=[],c=0;c<i.length;c++){var a=i[c];a.sourceNodeId===t?o.push(a):i[c].targetNodeId===t&&s.push(a)}return{sourceEdges:o,targetEdges:s}},e.prototype.render=function(){var t=this.props,n=t.x,i=t.y,o=t.index,s=t.model,c=s.getControlPointStyle();return Be("g",{className:"lf-resize-control-".concat(o),children:Be(lo,Ot({className:"lf-node-control",x:n,y:i},c,{onMouseDown:this.dragHandler.handleMouseDown}))})},e})(An),ia=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),gn=function(){return gn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},gn.apply(this,arguments)},On=(function(r){ia(e,r);function e(){var t=r.call(this)||this;return t.state={},t}return e.prototype.getResizeControl=function(){var t=this.props,n=t.model,i=t.graphModel,o=n.x,s=n.y,c=n.width,a=n.height,l={minX:o-c/2,minY:s-a/2,maxX:o+c/2,maxY:s+a/2},d=l.minX,u=l.minY,h=l.maxX,p=l.maxY,v=[{x:d,y:u},{x:h,y:u},{x:h,y:p},{x:d,y:p}];return v.map(function(y,b){return Be(na,gn({index:b},y,{model:n,graphModel:i}))})},e.prototype.getGroupSolid=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,s=t.height,c=t.getResizeOutlineStyle();return Be(lo,gn({},c,{x:n,y:i,width:o,height:s}))},e.prototype.render=function(){return Be("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},e})(An),So=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){So(e,r);function e(t,n){var i=r.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return e.prototype.initNodeData=function(t){r.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var t=r.prototype.getOutlineStyle.call(this),n=this.graphModel.editConfigModel.isSilentMode;return n||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(t===void 0&&(t=!0),t){var n={widthPCT:100,heightPCT:100},i={basisWidth:this.rx,basisHeight:this.ry},o={maxScaleLimit:Math.min(this.maxWidth/(this.rx*2)*100,this.maxHeight/(this.ry*2)*100),minScaleLimit:Math.max(this.minWidth/(this.rx*2)*100,this.minHeight/(this.ry*2)*100)};this.PCTResizeInfo={ResizePCT:n,ResizeBasis:i,ScaleLimit:o}}else delete this.PCTResizeInfo},e})(Ko);(function(r){So(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getControlGroup=function(){var t=this.props,n=t.model,i=t.graphModel;return Be(On,{model:n,graphModel:i})},e.prototype.getResizeShape=function(){return r.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,n=t.model,i=t.graphModel.editConfigModel.isSilentMode;return Be("g",{children:[this.getResizeShape(),n.isSelected&&!i?this.getControlGroup():""]})},e})(Xo);var To=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),qn=function(){return qn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},qn.apply(this,arguments)};(function(r){To(e,r);function e(t,n){var i=r.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return e.prototype.initNodeData=function(t){r.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.gridSize=1},e.prototype.getOutlineStyle=function(){var t=r.prototype.getOutlineStyle.call(this),n=this.graphModel.editConfigModel.isSilentMode;return n||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(t===void 0&&(t=!0),t){var n={widthPCT:100,heightPCT:100},i={basisWidth:this.rx,basisHeight:this.ry},o={maxScaleLimit:Math.min(this.maxWidth/(this.rx*2)*100,this.maxHeight/(this.ry*2)*100),minScaleLimit:Math.max(this.minWidth/(this.rx*2)*100,this.minHeight/(this.ry*2)*100)};this.PCTResizeInfo={ResizePCT:n,ResizeBasis:i,ScaleLimit:o}}else delete this.PCTResizeInfo},e})(Vo);(function(r){To(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getControlGroup=function(){var t=this.props,n=t.model,i=t.graphModel;return Be(On,{model:n,graphModel:i})},e.prototype.getResizeShape=function(){var t=this.props.model,n=t.points,i=t.getNodeStyle();return Be("g",{children:Be(Yo,qn({},i,{points:n}))})},e.prototype.getShape=function(){var t=this.props,n=t.model.isSelected,i=t.graphModel.editConfigModel.isSilentMode;return Be("g",{children:[this.getResizeShape(),n&&!i?this.getControlGroup():""]})},e})(Zo);var Ao=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){Ao(e,r);function e(t,n){var i=r.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return e.prototype.initNodeData=function(t){r.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var t=r.prototype.getOutlineStyle.call(this),n=this.graphModel.editConfigModel.isSilentMode;return n||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(t===void 0&&(t=!0),t){var n={widthPCT:100,heightPCT:100},i={basisWidth:this.width,basisHeight:this.height},o={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:n,ResizeBasis:i,ScaleLimit:o}}else delete this.PCTResizeInfo},e})(Qo);(function(r){Ao(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getControlGroup=function(){var t=this.props,n=t.model,i=t.graphModel;return Be(On,{model:n,graphModel:i})},e.prototype.getResizeShape=function(){return r.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,n=t.model.isSelected,i=t.graphModel.editConfigModel.isSilentMode;return Be("g",{children:[this.getResizeShape(),n&&!i?this.getControlGroup():""]})},e})(Jo);var ko=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),oa=(function(r){ko(e,r);function e(t,n){var i=r.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return e.prototype.initNodeData=function(t){r.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var t=r.prototype.getOutlineStyle.call(this),n=this.graphModel.editConfigModel.isSilentMode;return n||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(t===void 0&&(t=!0),t){var n={widthPCT:100,heightPCT:100},i={basisWidth:this.width,basisHeight:this.height},o={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:n,ResizeBasis:i,ScaleLimit:o}}else delete this.PCTResizeInfo},e})(Tn),ra=(function(r){ko(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getControlGroup=function(){var t=this.props,n=t.model,i=t.graphModel;return Be(On,{model:n,graphModel:i})},e.prototype.getResizeShape=function(){return r.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,n=t.model.isSelected,i=t.graphModel.editConfigModel.isSilentMode;return Be("g",{children:[this.getResizeShape(),n&&!i?this.getControlGroup():""]})},e})(Zt),Oo=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),mn=function(){return mn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},mn.apply(this,arguments)},Tt=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},At=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},Si=500,Ti=300,aa=-1e4;(function(r){Oo(e,r);function e(){var t=r.apply(this,At([],Tt(arguments),!1))||this;return t.isGroup=!0,t.isFolded=!1,t.unfoldedWidth=Si,t.unfoldedHeight=Ti,t.childrenLastFoldStatus={},t}return e.prototype.initNodeData=function(t){var n=this;r.prototype.initNodeData.call(this,t);var i=[];pr(t.children)&&(i=t.children),this.children=new Set(i),this.width=Si,this.height=Ti,this.foldedWidth=80,this.foldedHeight=60,this.zIndex=aa,this.radius=0,this.text.editable=!1,this.text.draggable=!1,this.isRestrict=!1,this.resizable=!1,this.autoToFront=!1,this.foldable=!1,this.properties.isFolded===void 0&&(this.properties.isFolded=!1),this.isFolded=!!this.properties.isFolded,setTimeout(function(){n.isFolded&&n.foldGroup(n.isFolded)})},e.prototype.getResizeOutlineStyle=function(){var t=r.prototype.getResizeOutlineStyle.call(this);return t.stroke="none",t},e.prototype.foldGroup=function(t){var n=this;if(t!==this.isFolded){this.setProperty("isFolded",t),this.isFolded=t,t?(this.x=this.x-this.width/2+this.foldedWidth/2,this.y=this.y-this.height/2+this.foldedHeight/2,this.unfoldedWidth=this.width,this.unfoldedHeight=this.height,this.width=this.foldedWidth,this.height=this.foldedHeight):(this.width=this.unfoldedWidth,this.height=this.unfoldedHeight,this.x=this.x+this.width/2-this.foldedWidth/2,this.y=this.y+this.height/2-this.foldedHeight/2);var i=At(At([],Tt(this.incoming.edges),!1),Tt(this.outgoing.edges),!1);this.children.forEach(function(o){var s=n.graphModel.getElement(o);if(s){var c=s.isFolded;if(s.isGroup&&!s.isFolded&&s.foldGroup(t),s.isGroup&&!t){var a=n.childrenLastFoldStatus[o];a!==void 0&&a!==s.isFolded&&s.foldGroup(a)}n.childrenLastFoldStatus[o]=!!c,s.visible=!t;var l=s.incoming.edges,d=s.outgoing.edges;i=At(At(At([],Tt(i),!1),Tt(l),!1),Tt(d),!1)}}),this.foldEdge(t,i)}},e.prototype.getAnchorStyle=function(t){var n=r.prototype.getAnchorStyle.call(this,t);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},e.prototype.foldEdge=function(t,n){var i=this;n.forEach(function(o,s){var c=o.id,a=o.sourceNodeId,l=o.targetNodeId,d=o.startPoint,u=o.endPoint,h=o.type,p=o.text,v=o.getProperties(),y={id:"".concat(c,"__").concat(s),sourceNodeId:a,targetNodeId:l,startPoint:d,endPoint:u,type:h,properties:v,text:p==null?void 0:p.value};o.virtual&&i.graphModel.deleteEdgeById(o.id);var b=i.graphModel.group.getNodeGroup(l);b||(b=i.graphModel.getNodeModelById(l));var k=i.graphModel.group.getNodeGroup(a);k||(k=i.graphModel.getNodeModelById(a)),t&&o.visible!==!1&&(i.children.has(a)||i.id===a?(y.startPoint=void 0,y.sourceNodeId=i.id):(y.endPoint=void 0,y.targetNodeId=i.id),(b.id!==i.id||k.id!==i.id)&&i.createVirtualEdge(y),o.visible=!1),!t&&o.visible===!1&&(b&&b.isGroup&&b.isFolded?(y.targetNodeId=b.id,y.endPoint=void 0,i.createVirtualEdge(y)):k&&k.isGroup&&k.isFolded?(y.sourceNodeId=k.id,y.startPoint=void 0,i.createVirtualEdge(y)):o.visible=!0)})},e.prototype.createVirtualEdge=function(t){t.pointsList=void 0;var n=this.graphModel.addEdge(t);n.virtual=!0,n.text.editable=!1,n.isFoldedEdge=!0},e.prototype.isInRange=function(t){var n=t.minX,i=t.minY,o=t.maxX,s=t.maxY;return n>=this.x-this.width/2&&o<=this.x+this.width/2&&i>=this.y-this.height/2&&s<=this.y+this.height/2},e.prototype.isAllowMoveTo=function(t){var n=t.minX,i=t.minY,o=t.maxX,s=t.maxY;return{x:n>=this.x-this.width/2&&o<=this.x+this.width/2,y:i>=this.y-this.height/2&&s<=this.y+this.height/2}},e.prototype.setAllowAppendChild=function(t){this.setProperty("groupAddable",t)},e.prototype.addChild=function(t){this.children.add(t),this.graphModel.eventCenter.emit("group:add-node",{data:this.getData()})},e.prototype.removeChild=function(t){this.children.delete(t),this.graphModel.eventCenter.emit("group:remove-node",{data:this.getData()})},e.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},e.prototype.getData=function(){var t=this,n=r.prototype.getData.call(this);n.children=[],this.children.forEach(function(o){var s=t.graphModel.getNodeModelById(o);s&&!s.virtual&&n.children.push(o)});var i=n.properties;return i==null||delete i.groupAddable,i==null||delete i.isFolded,n},e.prototype.getHistoryData=function(){var t=r.prototype.getData.call(this);t.children=At([],Tt(this.children),!1),t.isGroup=!0;var n=t.properties;return n==null||delete n.groupAddable,n!=null&&n.isFolded&&(t.x=t.x+this.unfoldedWidth/2-this.foldedWidth/2,t.y=t.y+this.unfoldedHeight/2-this.foldedHeight/2),t},e.prototype.isAllowAppendIn=function(t){return!0},e.prototype.toBack=function(){this.zIndex--},e})(oa);(function(r){Oo(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getControlGroup=function(){var t=this.props.model,n=t.resizable,i=t.properties;return n&&!i.isFolded?r.prototype.getControlGroup.call(this):null},e.prototype.getAddableShape=function(){var t=this.props.model,n=t.width,i=t.height,o=t.x,s=t.y,c=t.radius,a=t.properties,l=t.getAddableOutlineStyle;if(!a.groupAddable)return null;var d=this.props.model.getNodeStyle().strokeWidth,u=d===void 0?0:d,h=l(),p=n+u+8,v=i+u+8;return ne("rect",mn(mn({},h),{width:p,height:v,x:o-p/2,y:s-v/2,rx:c,ry:c}))},e.prototype.getFoldIcon=function(){var t=this.props.model,n=t.x-t.width/2+5,i=t.y-t.height/2+5;if(!t.foldable)return null;var o=ne("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:t.properties.isFolded?"M ".concat(n+3,",").concat(i+6," ").concat(n+11,",").concat(i+6," M").concat(n+7,",").concat(i+2," ").concat(n+7,",").concat(i+10):"M ".concat(n+3,",").concat(i+6," ").concat(n+11,",").concat(i+6," ")});return ne("g",{},[ne("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:t.x-t.width/2+5,y:t.y-t.height/2+5,onClick:function(){t.foldGroup(!t.properties.isFolded)}}),o])},e.prototype.getResizeShape=function(){return ne("g",{},[this.getAddableShape(),r.prototype.getResizeShape.call(this),this.getFoldIcon()])},e})(ra);var Ai=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Xt=function(){return Xt=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Xt.apply(this,arguments)};function sa(r){var e=(function(n){Ai(i,n);function i(o,s){o.id||(o.id="Flow_".concat(Qr()));var c=Xt(Xt(Xt({},{}),o.properties),{isDefaultFlow:!1});return o.properties=c,n.call(this,o,s)||this}return i.extendKey="SequenceFlowModel",i})(Qn),t=(function(n){Ai(i,n);function i(){return n!==null&&n.apply(this,arguments)||this}return i.prototype.getStartArrow=function(){var o=this.props.model,s=o.properties.isDefaultFlow;return s?ne("path",{refX:15,stroke:"#000000",strokeWidth:2,d:"M 20 5 10 -5 z"}):ne("path",{d:""})},i.extendKey="SequenceFlowEdge",i})(Jn);return{type:"bpmn:sequenceFlow",view:t,model:e}}sa();var ki={width:40,height:40},Oi={width:40,height:40},_i={width:100,height:80},vn={width:100,height:80},Ri={width:100,height:80},Mi={width:100,height:80},Di={width:100,height:80},Pi={width:100,height:80},Li={width:100,height:80},Ii={width:100,height:80},et=function(){};et.ObjTree=function(){return this};et.ObjTree.VERSION="0.23";et.ObjTree.prototype.xmlDecl=`<?xml version="1.0" encoding="UTF-8" ?>
|
||
`;et.ObjTree.prototype.attr_prefix="-";et.ObjTree.prototype.parseXML=function(r){var e;if(window.DOMParser){var t=new DOMParser,n=t.parseFromString(r,"application/xml");if(!n)return;e=n.documentElement}else window.ActiveXObject&&(t=new ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.loadXML(r),e=t.documentElement);if(e){var i=this.parseDOM(e);return i}};et.ObjTree.prototype.parseHTTP=function(r,e,t){var n={};for(var i in e)n[i]=e[i];if(n.method||(typeof n.postBody=="undefined"&&typeof n.postbody=="undefined"&&typeof n.parameters=="undefined"?n.method="get":n.method="post"),t){n.asynchronous=!0;var o=this,s=t,c=n.onComplete;n.onComplete=function(d){var u;d&&d.responseXML&&d.responseXML.documentElement&&(u=o.parseDOM(d.responseXML.documentElement)),s(u,d),c&&c(d)}}else n.asynchronous=!1;var a;if(typeof HTTP!="undefined"&&HTTP.Request){n.uri=r;var l=new HTTP.Request(n);l&&(a=l.transport)}else if(typeof Ajax!="undefined"&&Ajax.Request){var l=new Ajax.Request(r,n);l&&(a=l.transport)}if(t)return a;if(a&&a.responseXML&&a.responseXML.documentElement)return this.parseDOM(a.responseXML.documentElement)};et.ObjTree.prototype.parseDOM=function(r){if(r){if(this.__force_array={},this.force_array)for(var e=0;e<this.force_array.length;e++)this.__force_array[this.force_array[e]]=1;var t=this.parseElement(r);if(this.__force_array[r.nodeName]&&(t=[t]),r.nodeType!==11){var n={};n[r.nodeName]=t,t=n}return t}};et.ObjTree.prototype.parseElement=function(r){if(r.nodeType!==7){if(r.nodeType===3||r.nodeType===4||r.nodeType===8){var e=r.nodeValue.match(/[^\x00-\x20]/);return e==null?void 0:r.nodeValue}var t=null,n={};if(r.attributes&&r.attributes.length){t={};for(var i=0;i<r.attributes.length;i++){var o=r.attributes[i].nodeName;if(typeof o=="string"){var s=r.attributes[i].nodeValue;try{s=JSON.parse(r.attributes[i].nodeValue.replace(/'/g,'"'))}catch(l){s=r.attributes[i].nodeValue}s!=null&&(o=this.attr_prefix+o,typeof n[o]=="undefined"&&(n[o]=0),n[o]++,this.addNode(t,o,n[o],s))}}}if(r.childNodes&&r.childNodes.length){var c=!0;t&&(c=!1);for(var i=0;i<r.childNodes.length&&c;i++){var a=r.childNodes[i].nodeType;a===3||a===4||a===8||(c=!1)}if(c){t||(t="");for(var i=0;i<r.childNodes.length;i++)t+=r.childNodes[i].nodeValue}else{t||(t={});for(var i=0;i<r.childNodes.length;i++){var o=r.childNodes[i].nodeName;if(typeof o=="string"){var s=this.parseElement(r.childNodes[i]);s&&(typeof n[o]=="undefined"&&(n[o]=0),n[o]++,this.addNode(t,o,n[o],s))}}}}else t===null&&(t={});return t}};et.ObjTree.prototype.addNode=function(r,e,t,n){this.__force_array[e]?(t===1&&(r[e]=[]),r[e][r[e].length]=n):t===1?r[e]=n:t===2?r[e]=[r[e],n]:r[e][r[e].length]=n};et.ObjTree.prototype.writeXML=function(r){var e=this.hash_to_xml(null,r);return this.xmlDecl+e};et.ObjTree.prototype.hash_to_xml=function(r,e){var t=[],n=[];for(var i in e)if(Gn(e,i)){var o=e[i];i.charAt(0)!==this.attr_prefix?typeof o=="undefined"||o==null?t[t.length]="<".concat(i," />"):typeof o=="object"&&o.constructor===Array?t[t.length]=this.array_to_xml(i,o):typeof o=="object"?t[t.length]=this.hash_to_xml(i,o):t[t.length]=this.scalar_to_xml(i,o):n[n.length]=" ".concat(i.substring(1),'="').concat(this.xml_escape(o),'"')}var s=n.join(""),c=t.join("");return typeof r=="undefined"||r==null||(t.length>0?c.match(/\n/)?c="<".concat(r).concat(s,`>
|
||
`).concat(c,"</").concat(r,`>
|
||
`):c="<".concat(r).concat(s,">").concat(c,"</").concat(r,`>
|
||
`):c="<".concat(r).concat(s,` />
|
||
`)),c};et.ObjTree.prototype.array_to_xml=function(r,e){for(var t=[],n=0;n<e.length;n++){var i=e[n];typeof i=="undefined"||i==null?t[t.length]="<".concat(r," />"):typeof i=="object"&&i.constructor===Array?t[t.length]=this.array_to_xml(r,i):typeof i=="object"?t[t.length]=this.hash_to_xml(r,i):t[t.length]=this.scalar_to_xml(r,i)}return t.join("")};et.ObjTree.prototype.scalar_to_xml=function(r,e){return r==="#text"?this.xml_escape(e):"<".concat(r,">").concat(this.xml_escape(e),"</").concat(r,`>
|
||
`)};et.ObjTree.prototype.xml_escape=function(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};var la=function(r){return new et.ObjTree().parseXML(r)};function _o(r){return Object.prototype.toString.call(r)}function Bi(r){return" ".repeat(r)}function yn(r){return _o(r)==="[object Object]"?Object.keys(r).reduce(function(e,t){var n=t;return t.charAt(0)==="-"&&(n=t.substring(1)),e[n]=yn(r[t]),e},{}):Array.isArray(r)?r.map(function(e){return yn(e)}):r}function ca(r){var e=r;try{typeof e!="string"&&(e=JSON.parse(r))}catch(t){e=JSON.stringify(yn(r)).replace(/"/g,"'")}return e}var ji=`
|
||
`;function ln(r,e,t){var n=Bi(t),i="",o=ji+n;if(e==="-json")return"";if(e==="#text")return o+r;if(e==="#cdata-section")return"".concat(o,"<![CDATA[").concat(r,"]]>");if(e==="#comment")return"".concat(o,"<!--").concat(r,"-->");if("".concat(e).charAt(0)==="-")return" ".concat(e.substring(1),'="').concat(ca(r),'"');if(Array.isArray(r))i+=r.map(function(l){return ln(l,e,t+1)}).join("");else if(_o(r)==="[object Object]"){var s=Object.keys(r),c="",a=r["-json"]?ji+Bi(t+1)+r["-json"]:"";i+="".concat(t===0?"":o,"<").concat(e),s.forEach(function(l){l.charAt(0)==="-"?c+=ln(r[l],l,t+1):a+=ln(r[l],l,t+1)}),i+=c+(a!==""?">".concat(a).concat(o,"</").concat(e,">"):" />")}else i+="".concat(o,"<").concat(e,">").concat(r.toString(),"</").concat(e,">");return i}function da(r){var e="";for(var t in r)e+=ln(r[t],t,0);return e}var ua=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Kn=function(){return Kn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Kn.apply(this,arguments)},Hi=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},ni=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},qe=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},pt=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},Qe;(function(r){r.START="bpmn:startEvent",r.END="bpmn:endEvent",r.INTERMEDIATE_CATCH="bpmn:intermediateCatchEvent",r.INTERMEDIATE_THROW="bpmn:intermediateThrowEvent",r.BOUNDARY="bpmn:boundaryEvent",r.PARALLEL_GATEWAY="bpmn:parallelGateway",r.INCLUSIVE_GATEWAY="bpmn:inclusiveGateway",r.EXCLUSIVE_GATEWAY="bpmn:exclusiveGateway",r.USER="bpmn:userTask",r.SYSTEM="bpmn:serviceTask",r.FLOW="bpmn:sequenceFlow",r.SUBPROCESS="bpmn:subProcess"})(Qe||(Qe={}));var Ro=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],ha=["properties","startPoint","endPoint","pointsList"],bn={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Mo=function(r,e){var t=Object.keys(e||{});return t.forEach(function(n){if(r[n]){var i=e[n],o=i.in,s=i.out;o&&(r[n].in=o),s&&(r[n].out=s)}else r[n]=e[n]}),r},dt={"bpmn:startEvent":{out:function(r){var e,t,n=r.properties;return((t=(e=dt[n.definitionType])===null||e===void 0?void 0:e.out)===null||t===void 0?void 0:t.call(e,r))||{}}},"bpmn:intermediateCatchEvent":{out:function(r){var e,t,n=r.properties;return((t=(e=dt[n.definitionType])===null||e===void 0?void 0:e.out)===null||t===void 0?void 0:t.call(e,r))||{}}},"bpmn:intermediateThrowEvent":{out:function(r){var e,t,n=r.properties;return((t=(e=dt[n.definitionType])===null||e===void 0?void 0:e.out)===null||t===void 0?void 0:t.call(e,r))||{}}},"bpmn:boundaryEvent":{out:function(r){var e,t,n=r.properties;return((t=(e=dt[n.definitionType])===null||e===void 0?void 0:e.out)===null||t===void 0?void 0:t.call(e,r))||{}}},"bpmn:sequenceFlow":{out:function(r){var e=r.properties,t=e.expressionType,n=e.condition;return n?t==="cdata"?{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[${'.concat(n,"}]]></bpmn:conditionExpression>")}:{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">'.concat(n,"</bpmn:conditionExpression>")}:{json:""}}},"bpmn:timerEventDefinition":{out:function(r){var e=r.properties,t=e.timerType,n=e.timerValue,i=e.definitionId,o=function(){return"<bpmn:".concat(t,' xsi:type="bpmn:tFormalExpression">').concat(n,"</bpmn:").concat(t,">")};return{json:'<bpmn:timerEventDefinition id="'.concat(i,'"').concat(t&&n?">".concat(o(),"</bpmn:timerEventDefinition>"):"/>")}},in:function(r,e){var t,n,i,o,s=r,c=e["-id"],a="",l="";try{for(var d=ni(Object.keys(e)),u=d.next();!u.done;u=d.next()){var h=u.value;h.includes("bpmn:")&&(i=qe(h.split(":"),2),a=i[1],l=(o=e[h])===null||o===void 0?void 0:o["#text"])}}catch(p){t={error:p}}finally{try{u&&!u.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}return{"-definitionId":c,"-definitionType":s,"-timerType":a,"-timerValue":l}}},"bpmn:conditionExpression":{in:function(r,e){var t,n="",i="";return e["#cdata-section"]?(i="cdata",n=((t=/^\$\{(.*)\}$/g.exec(e["#cdata-section"]))===null||t===void 0?void 0:t[1])||""):e["#text"]&&(i="normal",n=e["#text"]),{"-condition":n,"-expressionType":i}}}};function pa(r){var e=r!=null?r:{},t=e.retainedAttrsFields,n=e.excludeFields,i=e.transformer,o=new Set(pt(pt([],qe(ha),!1),qe(t||[]),!1)),s={in:new Set(pt(pt([],qe(bn.in),!1),qe((n==null?void 0:n.in)||[]),!1)),out:new Set(pt(pt([],qe(bn.out),!1),qe((n==null?void 0:n.out)||[]),!1))};return dt=Mo(dt,i),function(c){var a=c.nodes,l=c.edges;function d(u,h){var p,v;if((u==null?void 0:u.flag)!==1){var y;if((y=dt[u.type])&&y.out){var b=y.out(u),k=Object.keys(b);k.length>0&&k.forEach(function(Q){u[Q]=b[Q]})}u!=null&&u.children&&(u.children=u.children.map(function(Q){var je=a.find(function(Le){return Le.id===Q})||l.find(function(Le){return Le.id===Q});return je||{}}));var B={};if(typeof u=="string")return u;if(Array.isArray(u))return u.map(function(Q){return d(Q,"")}).filter(function(Q){return Q!=null});try{for(var W=ni(Object.entries(u)),K=W.next();!K.done;K=W.next()){var le=qe(K.value,2),G=le[0],L=le[1];if((L==null?void 0:L.flag)===1)return;var ue=[h,G].filter(function(Q){return Q}).join(".");s.out.has(ue)||(typeof L!="object"?G.indexOf("-")===0||["#text","#cdata-section","#comment"].includes(G)?B[G]=L:B["-".concat(G)]=L:o.has(ue)?B["-".concat(G)]=d(L,ue):B[G]=d(L,ue))}}catch(Q){p={error:Q}}finally{try{K&&!K.done&&(v=W.return)&&v.call(W)}finally{if(p)throw p.error}}return B}}return d(c,"")}}function wn(r){var e,t,n={};try{for(var i=ni(Object.entries(r)),o=i.next();!o.done;o=i.next()){var s=qe(o.value,2),c=s[0],a=s[1];c.indexOf("-")===0?n[c.substring(1)]=yn(a):typeof a=="string"?n[c]=a:Object.prototype.toString.call(a)==="[object Object]"?n[c]=wn(a):Array.isArray(a)?n[c]=a.map(function(l){return wn(l)}):n[c]=a}}catch(l){e={error:l}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n}function fa(r,e,t){var n,i=new Map,o=pa(t)(e);o.nodes.forEach(function(c){var a=c["-id"],l=c["-type"],d=c.text,u=c.children,h=Hi(c,["-id","-type","text","children"]),p={"-id":a};d!=null&&d["-value"]&&(p["-name"]=d["-value"]),h["-json"]&&(p["-json"]=h["-json"]),h["-properties"]&&Object.assign(p,h["-properties"]),u&&(p.children=u),r[l]||(r[l]=[]),r[l].push(p),i.set(a,p)});var s=o.edges.map(function(c){var a=c["-id"],l=c["-sourceNodeId"],d=c["-targetNodeId"],u=c.text,h=Hi(c,["-id","-sourceNodeId","-targetNodeId","text"]),p=i.get(d);p["bpmn:incoming"]||(p["bpmn:incoming"]=[]),p["bpmn:incoming"].push(a);var v={"-id":a,"-sourceRef":l,"-targetRef":d};return u!=null&&u["-value"]&&(v["-name"]=u["-value"]),h["-json"]&&(v["-json"]=h["-json"]),h["-properties"]&&Object.assign(v,h["-properties"]),v});return e.edges.forEach(function(c){var a=c.sourceNodeId,l=c.id,d=i.get(a);d["bpmn:outgoing"]||(d["bpmn:outgoing"]=[]),d["bpmn:outgoing"].push(l)}),(n=r["bpmn:subProcess"])===null||n===void 0||n.forEach(function(c){var a={"bpmn:incoming":new Set,"bpmn:outgoing":new Set},l=[];c.children.forEach(function(y){var b,k=i.get(y["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach(function(W){k[W]&&k[W].forEach(function(K){a[W].add(K)})});var B=(b=r[y["-type"]])===null||b===void 0?void 0:b.findIndex(function(W){return W["-id"]===y["-id"]});B>=0&&r[y["-type"]].splice(B,1),i.delete(y["-id"]),c[y["-type"]]||(c[y["-type"]]=[]),c[y["-type"]].push(k)});var d=a["bpmn:incoming"],u=a["bpmn:outgoing"];u.forEach(function(y){d.has(y)&&l.push(y)});for(var h=function(y){var b=s.findIndex(function(k){return k["-id"]===l[y]});b>=0?(c["bpmn:sequenceFlow"]||(c["bpmn:sequenceFlow"]=[]),c["bpmn:sequenceFlow"].push(s[b]),s.splice(b,1)):y++,p=y},p,v=0;v<l.length;)h(v),v=p;delete c.children}),r[Qe.FLOW]=s,r}function ga(r,e){r["bpmndi:BPMNEdge"]=e.edges.map(function(t){var n,i=t.id,o=t.pointsList.map(function(c){var a=c.x,l=c.y;return{"-x":a,"-y":l}}),s={"-id":"".concat(i,"_di"),"-bpmnElement":i,"di:waypoint":o};return!((n=t.text)===null||n===void 0)&&n.value&&(s["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-t.text.value.length*10/2,"-y":t.text.y-7,"-width":t.text.value.length*10,"-height":14}}),s}),r["bpmndi:BPMNShape"]=e.nodes.map(function(t){var n,i=t.id,o=100,s=80,c=t.x,a=t.y,l=rt.shapeConfigMap.get(t.type);l&&(o=l.width,s=l.height),c-=o/2,a-=s/2;var d={"-id":"".concat(i,"_di"),"-bpmnElement":i,"dc:Bounds":{"-x":c,"-y":a,"-width":o,"-height":s}};return!((n=t.text)===null||n===void 0)&&n.value&&(d["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-t.text.value.length*10/2,"-y":t.text.y-7,"-width":t.text.value.length*10,"-height":14}}),d})}var ma=["bpmn:incoming","bpmn:outgoing"];function va(r,e){var t=[],n=[],i=new Map,o=e!=null?e:{},s=o.transformer,c=o.excludeFields,a={in:new Set(pt(pt([],qe(bn.in),!1),qe((c==null?void 0:c.in)||[]),!1)),out:new Set(pt(pt([],qe(bn.out),!1),qe((c==null?void 0:c.out)||[]),!1))};dt=Mo(dt,s);var l=r["bpmn:definitions"];if(l){var d=l["bpmn:process"];(function(h,p){p.forEach(function(v){try{Object.keys(h).forEach(function(y){try{v(y)}catch(b){}})}catch(y){}})})(d,[function(h){function p(y){y["-children"]||(y["-children"]=[]),Object.keys(y).forEach(function(b){var k;b.indexOf("bpmn:")===0&&!ma.includes(b)&&(d[b]||(d[b]=[]),!Array.isArray(d[b])&&(d[b]=[d[b]]),Array.isArray(y[b])?(k=d[b]).push.apply(k,pt([],qe(y[b]),!1)):d[b].push(y[b]),Array.isArray(y[b])?y[b].forEach(function(B){!b.includes("Flow")&&y["-children"].push(B["-id"])}):!b.includes("Flow")&&y["-children"].push(y[b]["-id"]),delete y[b])})}if(h==="bpmn:subProcess"){var v=d[h];Array.isArray(v)?v.forEach(function(y){h==="bpmn:subProcess"&&p(y)}):p(v)}},function(h){var p=function(y){Object.keys(y).forEach(function(b){var k,B;if(b.includes("bpmn:")){var W={};dt[b]&&dt[b].in?(W=(B=(k=dt[b]).in)===null||B===void 0?void 0:B.call(k,b,po.cloneDeep(y[b])),delete y[b]):v(y[b]);var K=void 0;(K=Reflect.ownKeys(W)).length>0&&K.forEach(function(le){Reflect.set(y,le,W[le])})}})};function v(y){i.set(y["-id"],y),Array.isArray(y)?y.forEach(function(b){v(b)}):typeof y=="object"&&p(y)}v(d[h])},function(h){if(h.indexOf("bpmn:")===0){var p=d[h];if(h==="bpmn:sequenceFlow"){var v=l["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNEdge"];n=ba(p,v)}else{var y=l["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if(h==="bpmn:boundaryEvent"){var b=d[h],k=function(B){var W=B["-attachedToRef"],K=i.get(W);K["-boundaryEvents"]||(K["-boundaryEvents"]=[]),K["-boundaryEvents"].push(B["-id"])};Array.isArray(b)?b.forEach(function(B){k(B)}):k(b)}t=t.concat(ya(p,y,h))}}}])}var u=function(h,p,v){Object.keys(h).forEach(function(y){var b=v?"".concat(v,".").concat(y):y;p.has(b)?delete h[y]:typeof h[y]=="object"&&u(h[y],p,b)})};return t.forEach(function(h){var p,v;if(!((p=e==null?void 0:e.mapping)===null||p===void 0)&&p.in){var y=(v=e==null?void 0:e.mapping)===null||v===void 0?void 0:v.in,b=h.type;y[b]&&(h.type=y[b])}u(h,a.in,"")}),n.forEach(function(h){var p,v;if(!((p=e==null?void 0:e.mapping)===null||p===void 0)&&p.in){var y=(v=e==null?void 0:e.mapping)===null||v===void 0?void 0:v.in,b=h.type;y[b]&&(h.type=y[b])}u(h,a.in,"")}),{nodes:t,edges:n}}function ya(r,e,t){var n=[];if(Array.isArray(r))r.forEach(function(s){var c;Array.isArray(e)?c=e.find(function(l){return l["-bpmnElement"]===s["-id"]}):c=e;var a=Fi(c,t,s);n.push(a)});else{var i=void 0;Array.isArray(e)?i=e.find(function(s){return s["-bpmnElement"]===r["-id"]}):i=e;var o=Fi(i,t,r);n.push(o)}return n}function Fi(r,e,t){var n=Number(r["dc:Bounds"]["-x"]),i=Number(r["dc:Bounds"]["-y"]),o=t["-children"],s=t["-name"],c=rt.shapeConfigMap.get(e);c&&(n+=c.width/2,i+=c.height/2);var a={};Object.entries(t).forEach(function(h){var p=qe(h,2),v=p[0],y=p[1];Ro.includes(v)||(a[v]=y)}),a=wn(a);var l;if(s&&(l={x:n,y:i,value:s},r["bpmndi:BPMNLabel"]&&r["bpmndi:BPMNLabel"]["dc:Bounds"])){var d=r["bpmndi:BPMNLabel"]["dc:Bounds"];l.x=Number(d["-x"])+Number(d["-width"])/2,l.y=Number(d["-y"])+Number(d["-height"])/2}var u={id:r["-bpmnElement"],type:e,x:n,y:i,properties:a};return o&&(u.children=o),l&&(u.text=l),u}function ba(r,e){var t=[];if(Array.isArray(r))r.forEach(function(i){var o;Array.isArray(e)?o=e.find(function(s){return s["-bpmnElement"]===i["-id"]}):o=e,t.push(zi(o,i))});else{var n=void 0;Array.isArray(e)?n=e.find(function(i){return i["-bpmnElement"]===r["-id"]}):n=e,t.push(zi(n,r))}return t}function zi(r,e){var t,n=e["-name"]?"".concat(e["-name"]):"";if(n){var i=r["bpmndi:BPMNLabel"]["dc:Bounds"],o=0;n.split(`
|
||
`).forEach(function(l){o<l.length&&(o=l.length)}),t={value:n,x:Number(i["-x"])+o*10/2,y:Number(i["-y"])+7}}var s={};Object.entries(e).forEach(function(l){var d=qe(l,2),u=d[0],h=d[1];Ro.includes(u)||(s[u]=h)}),s=wn(s);var c=r["di:waypoint"].map(function(l){return{x:Number(l["-x"]),y:Number(l["-y"])}}),a={id:e["-id"],type:Qe.FLOW,pointsList:c,sourceNodeId:e["-sourceRef"],targetNodeId:e["-targetRef"],properties:s};return t&&(a.text=t),a}var rt=(function(){function r(e){var t=e.lf,n=this;this.adapterOut=function(i,o){var s,c,a=Kn({},n.processAttributes);fa(a,i,o);var l={"-id":"BPMNPlane_1","-bpmnElement":a["-id"]};ga(l,i);var d=n.definitionAttributes;d["bpmn:process"]=a,d["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":l};var u={"bpmn:definitions":d};if(!((s=o==null?void 0:o.mapping)===null||s===void 0)&&s.out){var h=(c=o==null?void 0:o.mapping)===null||c===void 0?void 0:c.out,p=function(v){Array.isArray(v)&&v.forEach(function(y){return p(y)}),typeof v=="object"&&Object.keys(v).forEach(function(y){var b;(b=h[y])?(v[b]=po.cloneDeep(v[y]),delete v[y],p(v[b])):p(v[y])})};p(u)}return u},this.adapterIn=function(i,o){if(i)return va(i,o)},t.adapterIn=this.adapterIn,t.adapterOut=this.adapterOut,this.processAttributes={"-isExecutable":"true","-id":"Process"},this.definitionAttributes={"-id":"Definitions","-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.10"}}return r.prototype.setCustomShape=function(e,t){r.shapeConfigMap.set(e,t)},r.pluginName="bpmn-adapter",r.shapeConfigMap=new Map,r})();rt.shapeConfigMap.set(Qe.START,{width:ki.width,height:ki.height});rt.shapeConfigMap.set(Qe.END,{width:Oi.width,height:Oi.height});rt.shapeConfigMap.set(Qe.INTERMEDIATE_CATCH,{width:vn.width,height:vn.height});rt.shapeConfigMap.set(Qe.INTERMEDIATE_THROW,{width:vn.width,height:vn.height});rt.shapeConfigMap.set(Qe.BOUNDARY,{width:_i.width,height:_i.height});rt.shapeConfigMap.set(Qe.PARALLEL_GATEWAY,{width:Ri.width,height:Ri.height});rt.shapeConfigMap.set(Qe.INCLUSIVE_GATEWAY,{width:Mi.width,height:Mi.height});rt.shapeConfigMap.set(Qe.EXCLUSIVE_GATEWAY,{width:Di.width,height:Di.height});rt.shapeConfigMap.set(Qe.SYSTEM,{width:Pi.width,height:Pi.height});rt.shapeConfigMap.set(Qe.USER,{width:Li.width,height:Li.height});rt.shapeConfigMap.set(Qe.SUBPROCESS,{width:Ii.width,height:Ii.height});(function(r){ua(e,r);function e(t){var n=r.call(this,t)||this;n.adapterXmlIn=function(s){var c=la(s);return n.adapterIn(c,n.props)},n.adapterXmlOut=function(s){var c=n.adapterOut(s,n.props);return da(c)};var i=t.lf,o=t.props;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n.props=o,n}return e.pluginName="BPMNAdapter",e})(rt);function wa(r,e,t){var n=e.x,i=e.y,o=r.x,s=r.y,c=o-n,a=s-i,l=c*Math.cos(t)-a*Math.sin(t),d=c*Math.sin(t)+a*Math.cos(t),u=l+n,h=d+i;return{x:u,y:h}}var Ca=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Cn=function(){return Cn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Cn.apply(this,arguments)},Ea=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},xa=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},Na=(function(r){Ca(e,r);function e(){var t=r.apply(this,xa([],Ea(arguments),!1))||this;return t.childrenPositionMap=new Map,t.onNodeRotate=function(n){var i=n.model,o=t.props,s=o.model,c=o.graphModel,a=s.transformWithContainer,l=s.isRestrict,d=t.childrenPositionMap;if(!(!a||l)&&i.id===s.id){var u={x:s.x,y:s.y};Re(Array.from(s.children),function(h){var p=c.getNodeModelById(h);if(p){var v={x:p.x,y:p.y};d.has(p.id)?v=d.get(p.id):d.set(p.id,v);var y=i.rotate*(180/Math.PI);y<0&&(y+=360);var b=y*(Math.PI/180),k=wa(v,u,b);p.moveTo(k.x,k.y),p.rotate=i.rotate}})}},t.onNodeResize=function(n){var i=n.deltaX,o=n.deltaY,s=n.index,c=n.model,a=n.preData,l=t.props,d=l.model,u=l.graphModel,h=d.transformWithContainer,p=d.isRestrict;if(!(!h||p)&&c.id===d.id){var v=a.properties,y=v||{},b=y.width,k=y.height;Re(Array.from(d.children),function(B){var W=u.getNodeModelById(B);if(W){var K=W.width/b*i,le=W.height/k*o;er({deltaX:K,deltaY:le,index:s,nodeModel:W,graphModel:u,cancelCallback:function(){}})}})}},t.onNodeMouseMove=function(){},t.graphRendered=function(){var n=t.props.model;n.isCollapsed&&n.toggleCollapse(!0)},t}return e.prototype.componentDidMount=function(){r.prototype.componentDidMount.call(this);var t=this.props.graphModel.eventCenter;t.on("node:rotate",this.onNodeRotate),t.on("node:resize",this.onNodeResize),t.on("node:mousemove",this.onNodeMouseMove),t.on("graph:rendered",this.graphRendered)},e.prototype.componentWillUnmount=function(){r.prototype.componentWillUnmount.call(this);var t=this.props.graphModel.eventCenter;t.off("node:rotate",this.onNodeRotate),t.off("node:resize",this.onNodeResize),t.off("node:mousemove",this.onNodeMouseMove),t.off("graph:rendered",this.graphRendered)},e.prototype.getNodesInGroup=function(t,n){var i=this,o=[];return t.isGroup&&Re(Array.from(t.children),function(s){o.push(s);var c=n.getNodeModelById(s);c!=null&&c.isGroup&&(o=o.concat(i.getNodesInGroup(c,n)))}),o},e.prototype.getResizeControl=function(){var t=this.props.model,n=t.resizable,i=t.isCollapsed,o=n&&!i;return o?r.prototype.getResizeControl.call(this):null},e.prototype.getAppendAreaShape=function(){var t=this.props.model,n=t.width,i=t.height,o=t.x,s=t.y,c=t.radius,a=t.groupAddable;if(!a)return null;var l=t.getNodeStyle().strokeWidth,d=l===void 0?0:l,u=t.getAddableOutlineStyle(),h=n+d+8,p=i+d+8;return ne("rect",Cn(Cn({},u),{width:h,height:p,x:o-h/2,y:s-p/2,rx:c,ry:c}))},e.prototype.getCollapseIcon=function(t,n){return"M ".concat(t+3,",").concat(n+6," ").concat(t+11,",").concat(n+6," M").concat(t+7,",").concat(n+2," ").concat(t+7,",").concat(n+10)},e.prototype.getExpandIcon=function(t,n){return"M ".concat(t+3,",").concat(n+6," ").concat(t+11,",").concat(n+6," ")},e.prototype.getOperateIcon=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,s=t.height,c=n-o/2+10,a=i-s/2+10;if(!t.collapsible)return null;var l=t!=null&&t.isCollapsed?this.getCollapseIcon(c,a):this.getExpandIcon(c,a),d=ne("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:l});return ne("g",{},[ne("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#f4f5f6",stroke:"#cecece",cursor:"pointer",x:c,y:a,onClick:function(){t.toggleCollapse(!t.isCollapsed)}}),d])},e.prototype.getShape=function(){return ne("g",{},[this.getAppendAreaShape(),r.prototype.getShape.call(this),this.getOperateIcon()])},e})(Zt),Sa=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),En=function(){return En=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},En.apply(this,arguments)},Pn=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(s=r[c])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Pt=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},$t=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},Ta=400,Aa=230,ka=80,Oa=60,_a=-1e4,Ra=(function(r){Sa(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.isGroup=!0,i.isRestrict=!1,i.autoResize=!1,i.collapsible=!0,i.isCollapsed=!1,i.groupAddable=!1,i.transformWithContainer=!1,i.childrenLastCollapseStateDict=new Map,i.childrenLastCollapseStateDict=new Map,i.initNodeData(t),i.setAttributes(),i}return e.prototype.initNodeData=function(t){var n;r.prototype.initNodeData.call(this,t);var i=(n=t.properties)!==null&&n!==void 0?n:{},o=i.children,s=i.width,c=i.height,a=i.collapsedWidth,l=i.collapsedHeight,d=i.collapsible,u=i.isCollapsed,h=i.zIndex,p=i.isRestrict,v=i.autoResize,y=i.autoToFront,b=i.transformWithContainer;this.children=o?new Set(o):new Set,this.zIndex=h!=null?h:_a,this.isCollapsed=u!=null?u:!1,this.setProperties({isCollapsed:u!=null?u:!1});var k=s!=null?s:Ta,B=c!=null?c:Aa;this.width=k,this.height=B,this.expandWidth=k,this.expandHeight=B,this.collapsedWidth=a!=null?a:ka,this.collapsedHeight=l!=null?l:Oa,this.isRestrict=p!=null?p:!1,this.transformWithContainer=b!=null?b:!1,this.autoResize=v!=null?v:!1,this.collapsible=d!=null?d:!0,this.autoToFront=y!=null?y:!1,this.text.editable=!1,this.text.draggable=!1},e.prototype.setAttributes=function(){r.prototype.setAttributes.call(this)},e.prototype.getData=function(){var t=this,n=r.prototype.getData.call(this),i=[];return Re(Array.from(this.children),function(o){var s=t.graphModel.getNodeModelById(o);s&&!s.virtual&&i.push(o)}),n.children=i,n.properties&&(n.properties.children=i,n.properties.isCollapsed=this.isCollapsed),n},e.prototype.getNodesInGroup=function(t){var n=[];return t.isGroup&&Re(Array.from(t.children),function(i){n.push(i)}),n},e.prototype.getMoveDistance=function(t,n,i){i===void 0&&(i=!1);var o=Pt(r.prototype.getMoveDistance.call(this,t,n,i),2),s=o[0],c=o[1],a=this.getNodesInGroup(this);return this.graphModel.moveNodes(a,t,n,i),[s,c]},e.prototype.getHistoryData=function(){var t=r.prototype.getHistoryData.call(this);t.children=Array.from(this.children),t.isGroup=!0;var n=this,i=n.x,o=n.y,s=n.collapsedWidth,c=n.collapsedHeight,a=n.expandWidth,l=n.expandHeight,d=n.isCollapsed;return d&&(t.x=i+a/2-s/2,t.y=o+l/2-c/2,t.text&&(t.text.x=t.text.x+a/2-s/2,t.text.y=t.text.y+l/2-c/2)),t},e.prototype.toggleCollapse=function(t){var n=this,i=this.graphModel,o=!!t;this.isCollapsed=o,this.setProperties({isCollapsed:o}),i.eventCenter.emit("dynamicGroup:collapse",{collapse:o,nodeModel:this}),o?this.collapse():this.expand();var s=$t($t([],Pt(this.incoming.edges),!1),Pt(this.outgoing.edges),!1),c=Array.from(this.children);Re(c,function(a){var l,d,u=n.graphModel.elementsModelMap.get(a);if(u){var h=u.isCollapsed;if(u.isGroup){var p=u;if(p.isCollapsed||p.toggleCollapse(t),!t){var v=(l=n.childrenLastCollapseStateDict)===null||l===void 0?void 0:l.get(a);v!==void 0&&v!==u.isCollapsed&&p.toggleCollapse(v)}}if((d=n.childrenLastCollapseStateDict)===null||d===void 0||d.set(a,!!h),u.visible=!t,u.BaseType===tr.NODE){var y=u.incoming.edges,b=u.outgoing.edges;s=$t($t($t([],Pt(s),!1),Pt(y),!1),Pt(b),!1)}}}),this.collapseEdge(o,s)},e.prototype.collapse=function(){var t=this,n=t.x,i=t.y,o=t.text,s=t.width,c=t.height,a=t.collapsedWidth,l=t.collapsedHeight;this.x=n-s/2+a/2,this.y=i-c/2+l/2,this.text.x=o.x-s/2+a/2,this.text.y=o.y-c/2+l/2,this.expandWidth=s,this.expandHeight=c,this.width=a,this.height=l},e.prototype.expand=function(){var t=this,n=t.x,i=t.y,o=t.text,s=t.expandWidth,c=t.expandHeight,a=t.collapsedWidth,l=t.collapsedHeight;this.width=s,this.height=c,this.x=n+this.width/2-a/2,this.y=i+this.height/2-l/2,this.text.x=o.x+this.width/2-a/2,this.text.y=o.y+this.height/2-l/2},e.prototype.createVirtualEdge=function(t){t.pointsList=void 0;var n=this.graphModel.addEdge(t);n.virtual=!0,n.text.editable=!1,n.isCollapsedEdge=!0},e.prototype.collapseEdge=function(t,n){var i=this,o=this.graphModel;Re(n,function(s,c){var a,l=s.getData(),d=l.targetNodeId,u=l.sourceNodeId,h=En(En({},l),{id:"".concat(l.id,"__").concat(c),text:(a=l.text)===null||a===void 0?void 0:a.value});s.virtual&&o.deleteEdgeById(s.id);var p=o.dynamicGroup.getGroupByNodeId(d);p||(p=o.getNodeModelById(d));var v=o.dynamicGroup.getGroupByNodeId(u);v||(v=o.getNodeModelById(u)),t&&s.visible&&(i.children.has(u)||i.id===u?(h.startPoint=void 0,h.sourceNodeId=i.id):(h.endPoint=void 0,h.targetNodeId=i.id),(p.id!==i.id||v.id!==i.id)&&i.createVirtualEdge(h),s.visible=!1),!t&&!s.visible&&(p&&p.isGroup&&p.isCollapsed?(h.targetNodeId=p.id,h.endPoint=void 0,i.createVirtualEdge(h)):v&&v.isGroup&&v.isCollapsed?(h.sourceNodeId=v.id,h.startPoint=void 0,i.createVirtualEdge(h)):s.visible=!0)})},e.prototype.isAllowAppendIn=function(t){return!0},e.prototype.setAllowAppendChild=function(t){this.groupAddable=t},e.prototype.addChild=function(t){this.children.add(t);var n=this.getData();this.graphModel.eventCenter.emit("group:add-node",{data:n,childId:t})},e.prototype.removeChild=function(t){this.children.delete(t);var n=this.getData();this.graphModel.eventCenter.emit("group:remove-node",{data:n})},e.prototype.toBack=function(){this.zIndex--},e.prototype.getResizeOutlineStyle=function(){var t=r.prototype.getResizeOutlineStyle.call(this);return t.stroke="none",t},e.prototype.getAnchorStyle=function(){var t=r.prototype.getAnchorStyle.call(this);return t.stroke="transparent",t.fill="transparent",t.hover&&(t.hover.fill="transparent",t.hover.stroke="transparent"),t},e.prototype.getAddableOutlineStyle=function(){return{stroke:"#feb663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},Pn([Ze],e.prototype,"isCollapsed",void 0),Pn([Ze],e.prototype,"groupAddable",void 0),Pn([Ze],e.prototype,"transformWithContainer",void 0),e})(Tn);function Ma(r,e){var t=r.minX,n=r.minY,i=r.maxX,o=r.maxY,s=e.x,c=e.y,a=e.width,l=e.height;return t>=s-a/2&&i<=s+a/2&&n>=c-l/2&&o<=c+l/2}function Da(r,e,t,n){var i=r.minX,o=r.minY,s=r.maxX,c=r.maxY,a=e.x,l=e.y,d=e.width,u=e.height,h=i+d/2,p=o+u/2,v=s-d/2,y=c-u/2;return{x:a+t>=h&&a+t<=v,y:l+n>=p&&l+n<=y}}var xn=function(){return xn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},xn.apply(this,arguments)},Lt=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},It=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},ii={type:"dynamic-group",view:Na,model:Ra},Pa=-1e3,nn=-1e4,Ps=(function(){function r(e){var t=e.lf,n=e.options,i=this;this.topGroupZIndex=nn,this.nodeGroupMap=new Map,this.onSelectionDrop=function(){var o=i.lf.graphModel.getSelectElements().nodes;o.forEach(function(s){i.addNodeToGroup(s)})},this.onNodeAddOrDrop=function(o){var s=o.data;i.addNodeToGroup(s)},this.addNodeToGroup=function(o){var s=i.nodeGroupMap.get(o.id);if(s){var c=i.lf.getNodeModelById(s);c.removeChild(o.id),i.nodeGroupMap.delete(o.id),c.setAllowAppendChild(!1)}var a=i.lf.getNodeModelById(o.id),l=a==null?void 0:a.getBounds();if(a&&l){if(a.isGroup){var d=a;Re(Array.from(d.children),function(p){i.nodeGroupMap.set(p,o.id)}),i.calibrateTopGroupZIndex([o]),i.onNodeSelect({data:o,isSelected:!1,isMultiple:!1})}var c=i.getGroupByBounds(l,o);if(c){var u=c.isAllowAppendIn(o);u?(c.addChild(o.id),c.setAllowAppendChild(!1)):i.lf.emit("group:not-allowed",{group:c.getData(),node:o})}}},this.onGroupAddNode=function(o){var s=o.data,c=o.childId;i.nodeGroupMap.set(c,s.id)},this.removeNodeFromGroup=function(o){var s=o.data,c=o.model;c.isGroup&&s.children&&Re(Array.from(s.children),function(d){i.nodeGroupMap.delete(d),i.lf.deleteNode(d)});var a=i.nodeGroupMap.get(s.id);if(a){var l=i.lf.getNodeModelById(a);l&&l.removeChild(s.id),i.nodeGroupMap.delete(s.id)}},this.onSelectionDrag=function(){var o=i.lf.graphModel.getSelectElements().nodes;o.forEach(function(s){i.setActiveGroup(s)})},this.onNodeDrag=function(o){var s=o.data;i.setActiveGroup(s)},this.setActiveGroup=function(o){var s=i.lf.getNodeModelById(o.id),c=s==null?void 0:s.getBounds();if(s&&c){var a=i.getGroupByBounds(c,o);if(i.activeGroup&&i.activeGroup.setAllowAppendChild(!1),!a||s.isGroup&&a.id===o.id)return;var l=a.isAllowAppendIn(o);if(!l)return;i.activeGroup=a,i.activeGroup.setAllowAppendChild(!0)}},this.onNodeSelect=function(o){var s=o.data,c=o.isMultiple,a=o.isSelected,l=i.lf.getNodeModelById(s.id);if(i.sendNodeToFront(l),i.topGroupZIndex>Pa){var d=i.lf.graphModel.nodes;i.topGroupZIndex=nn;var u=fr(tn(d,function(b){return!!b.isGroup}),"zIndex"),h=0;Re(u,function(b){b.zIndex!==h&&(i.topGroupZIndex++,h=b.zIndex),b.setZIndex(i.topGroupZIndex)})}if(c&&a)if(l!=null&&l.isGroup){var p=l.children;Re(Array.from(p),function(b){var k=i.lf.getNodeModelById(b);k==null||k.setSelected(!1)})}else{var v=i.nodeGroupMap.get(s.id);if(v){var y=i.lf.getNodeModelById(v);y!=null&&y.isSelected&&(l==null||l.setSelected(!1))}}},this.onNodeMove=function(o){var s=o.deltaX,c=o.deltaY,a=o.data,l=a.id,d=a.x,u=a.y,h=a.properties;if(h){var p=h.width,v=h.height,y=i.nodeGroupMap.get(l);if(y){var b=i.lf.getNodeModelById(y);if(!(!b||!b.isRestrict||!b.autoResize)){var k=d+s/2,B=u+c/2,W=k-p/2,K=B-v/2,le=k+p/2,G=B+v/2,L=!1,ue=b.getBounds(),Q=Object.assign({},ue);if(W<Q.minX&&(Q.minX=W,L=!0),K<Q.minY&&(Q.minY=K,L=!0),le>Q.maxX&&(Q.maxX=le,L=!0),G>Q.maxY&&(Q.maxY=G,L=!0),!!L){var je=Q.minX+(Q.maxX-Q.minX)/2,Le=Q.minY+(Q.maxY-Q.minY)/2,tt=Q.maxX-Q.minX,w=Q.maxY-Q.minY;b.moveTo(je,Le),b.width=tt,b.height=w}}}}},this.onGraphRendered=function(o){var s=o.data;Re(s.nodes,function(c){c.children&&Re(c.children,function(a){i.nodeGroupMap.set(a,c.id)})}),i.calibrateTopGroupZIndex(s.nodes)},t.register(ii),this.lf=t,fo(this,n),this.init()}return r.prototype.getGroupByNodeId=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},r.prototype.getGroupByBounds=function(e,t){var n=this.lf.graphModel.nodes,i=tn(n,function(a){return!!a.isGroup&&Ma(e,a)&&a.id!==t.id}),o=i.length;if(o<=1)return i[0];for(var s=i[o-1],c=o-2;c>=0;c--)i[c].zIndex>s.zIndex&&(s=i[c]);return s},r.prototype.sendNodeToFront=function(e){var t=this;if(!(!e||!e.isGroup)&&(this.topGroupZIndex++,e.setZIndex(this.topGroupZIndex),e.children)){var n=e.children;Re(Array.from(n),function(i){var o=t.lf.getNodeModelById(i);t.sendNodeToFront(o)})}},r.prototype.getMaxZIndex=function(e){var t=this,n=nn;if(e.isGroup&&(n=Math.max(n,e.zIndex)),e.children){var i=e.children;Re(Array.from(i),function(o){var s=t.lf.getNodeModelById(o);if(s!=null&&s.isGroup){var c=t.getMaxZIndex(s);n=Math.max(n,c)}})}return n},r.prototype.calibrateTopGroupZIndex=function(e){var t=this,n=nn;if(Re(e,function(c){var a=t.lf.getNodeModelById(c.id);if(a){var l=t.getMaxZIndex(a);l>n&&(n=l)}}),!(this.topGroupZIndex>=n)){var i=this.lf.graphModel.nodes,o=tn(i,function(c){return!!c.isGroup}),s=this.topGroupZIndex;Re(o,function(c){c.zIndex>s&&(s=c.zIndex)}),this.topGroupZIndex=s}},r.prototype.removeChildrenInGroupNodeData=function(e){var t,n=di(e);return delete n.children,!((t=n.properties)===null||t===void 0)&&t.children&&delete n.properties.children,n},r.prototype.initGroupChildNodes=function(e,t,n,i){var o=this,s=[],c=[],a=[];Re(Array.from(t),function(u){var h=o.lf.getNodeModelById(u);if(h){var p=h.children,v=h.getData(),y=nr.NODE_GROUP_COPY||"node:group-copy-add",b=ir(o.removeChildrenInGroupNodeData(v),i),k=o.lf.addNode(b,y);if(n.addChild(k.id),e[u]=k.id,s.push(k),a.push.apply(a,It([],Lt(It(It([],Lt(k.incoming.edges),!1),Lt(k.outgoing.edges),!1)),!1)),p instanceof Set){var B=o.initGroupChildNodes(e,p,k,i),W=B.childNodes,K=B.edgesData;s.push.apply(s,It([],Lt(W),!1)),c.push.apply(c,It([],Lt(K),!1))}}});var l=tn(a,function(u){return Gn(e,u.sourceNodeId)&&Gn(e,u.targetNodeId)}),d=gr(l,function(u){return u.getData()});return{childNodes:s,edgesData:c.concat(d)}},r.prototype.createEdge=function(e,t,n){var i,o,s=e.sourceNodeId,c=e.targetNodeId,a=(i=t[s])!==null&&i!==void 0?i:s,l=(o=t[c])!==null&&o!==void 0?o:c,d=di(e);return e.id&&typeof e.text=="object"&&e.text!==null&&(d=or(e,n)),this.lf.graphModel.addEdge(xn(xn({},d),{sourceNodeId:a,targetNodeId:l}))},r.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,o){if(e.children)for(var s=e.children,c=e.x,a=e.y,l=c+t/2,d=a+n/2,u=l-i/2,h=d-o/2,p=l+i/2,v=d+o/2,y=Array.from(s),b=0;b<y.length;b++){var k=y[b],B=this.lf.getNodeModelById(k);if(B){var W=B.getBounds(),K=W.minX,le=W.minY,G=W.maxX,L=W.maxY,ue=u<=K&&h<=le&&p>=G&&v>=L;if(!ue)return!1}}return!0},r.prototype.init=function(){var e=this,t=this.lf,n=t.graphModel;n.addNodeMoveRules(function(i,o,s){if(i.isGroup)return!0;var c=e.nodeGroupMap.get(i.id),a=e.lf.getNodeModelById(c);if(a&&a.isRestrict){if(a.autoResize)return!0;var l=a.getBounds();return Da(l,i,o,s)}return!0}),n.addNodeResizeRules(function(i,o,s,c,a){return i.isGroup&&i.isRestrict?e.checkGroupBoundsWithChildren(i,o,s,c,a):!0}),n.dynamicGroup=this,t.on("node:add,node:drop,node:dnd-add",this.onNodeAddOrDrop),t.on("selection:drop",this.onSelectionDrop),t.on("node:delete",this.removeNodeFromGroup),t.on("node:drag,node:dnd-drag",this.onNodeDrag),t.on("selection:drag",this.onSelectionDrag),t.on("node:click",this.onNodeSelect),t.on("node:mousemove",this.onNodeMove),t.on("graph:rendered",this.onGraphRendered),t.on("group:add-node",this.onGroupAddNode),t.addElements=function(i,o){var s=i.nodes,c=i.edges;o===void 0&&(o=40);var a={},l={nodes:[],edges:[]},d=[];return Re(s,function(u){var h,p,v=u.id,y=(p=(h=u.properties)===null||h===void 0?void 0:h.children)!==null&&p!==void 0?p:u.children,b=t.addNode(e.removeChildrenInGroupNodeData(u));if(v&&(a[v]=b.id),l.nodes.push(b),b.isGroup){var k=e.initGroupChildNodes(a,y,b,o).edgesData;d.push.apply(d,It([],Lt(k),!1))}}),Re(d,function(u){e.createEdge(u,a,o)}),Re(c,function(u){l.edges.push(e.createEdge(u,a,o))}),l},this.render()},r.prototype.render=function(){},r.prototype.destroy=function(){this.lf.off("node:add,node:drop,node:dnd-add",this.onNodeAddOrDrop),this.lf.off("selection:drop",this.onSelectionDrop),this.lf.off("node:delete",this.removeNodeFromGroup),this.lf.off("node:drag,node:dnd-drag",this.onNodeDrag),this.lf.off("selection:drag",this.onSelectionDrag),this.lf.off("node:click",this.onNodeSelect),this.lf.off("node:mousemove",this.onNodeMove),this.lf.off("graph:rendered",this.onGraphRendered),this.lf.off("group:add-node",this.onGroupAddNode)},r.pluginName="dynamicGroup",r})(),Wi;(function(r){r.HORIZONTAL="horizontal",r.VERTICAL="vertical"})(Wi||(Wi={}));var La=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Vt=function(){return Vt=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Vt.apply(this,arguments)},Ia=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(s=r[c])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ba=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},ja=(function(r){La(e,r);function e(t){var n=r.call(this,t)||this;n.textRef=rr(),n.setHoverOn=function(){var a=n.props.element;a.isDragging||n.state.isHovered||(n.setState({isHovered:!0}),a.setHovered(!0))},n.setHoverOff=function(){var a=n.props.element;n.state.isHovered&&(n.setState({isHovered:!1}),a.setHovered(!1))},n.handleMouseDown=function(a){var l,d=n.props,u=d.label,h=d.graphModel,p=h.editConfigModel.nodeTextDraggable;((l=u.draggable)!==null&&l!==void 0?l:p)&&!n.state.isDragging&&!n.state.isEditing&&n.stepDrag.handleMouseDown(a)},n.handleMouseUp=function(a){n.state.isDragging&&n.stepDrag.handleMouseUp(a)},n.handleDragging=function(a){var l=a.deltaX,d=a.deltaY;n.state.isDragging||n.setState({isDragging:!0});var u=n.props,h=u.label,p=u.graphModel,v=p.transformModel,y=Ba(v.fixDeltaXY(l,d),2),b=y[0],k=y[1];n.setElementModelLabelInfo({x:h.x+b,y:h.y+k}),p.eventCenter.emit("label:drag",{data:h.getData(),model:h})},n.handleDragEnd=function(){n.setState({isDragging:!1})},n.handleClick=function(a){var l=n.props,d=l.label,u=l.element,h=l.graphModel;u.setSelected(!n.state.isSelected),n.setState({isSelected:!n.state.isSelected}),n.setElementModelLabelInfo({isSelected:!0}),h.eventCenter.emit("label:click",{data:d.getData(),e:a,model:u})},n.handleDbClick=function(a){var l=n.props,d=l.label,u=l.element,h=l.graphModel;if(h.eventCenter.emit("label:dblclick",{data:d.getData(),e:a,model:u}),!d.editable){u.setSelected(!0);return}if(u.setSelected(),u.setElementState(li.TEXT_EDIT),n.setState({isEditing:!0}),n.textRef.current){n.textRef.current.contentEditable="true",n.textRef.current.focus();var p=document.createRange(),v=window.getSelection();p.selectNodeContents(n.textRef.current),p.collapse(!1),v==null||v.removeAllRanges(),v==null||v.addRange(p)}},n.handleBlur=function(a){var l=n.props,d=l.label,u=l.element,h=l.graphModel.eventCenter;h.emit("label:blur",{e:a,model:u,data:d.getData(),element:n.textRef.current}),n.setState({isDragging:!1,isHovered:!1,isSelected:!1})},n.handleInput=function(a){var l=n.props,d=l.label,u=l.graphModel;u.eventCenter.emit("label:input",{e:a,data:d.getData()})},n.reCalcLabelSize=function(){};var i=t.label,o=t.graphModel,s=o.gridSize,c=o.eventCenter;return n.stepDrag=new so({onDragging:n.handleDragging,onDragEnd:n.handleDragEnd,step:s,eventType:"LABEL",model:i,eventCenter:c}),n.state={isEditing:!1,isHovered:!1,isDragging:!1,isSelected:!1},n}return e.prototype.setElementModelLabelInfo=function(t){var n=this.props,i=n.label,o=n.element,s=n.graphModel,c=o.properties._label,a=c,l=mr(a,function(h){return h.id===i.id}),d=a[l];a[l]=Vt(Vt({},d),t);var u=s.getElement(o.id);u==null||u.setProperty("_label",a)},e.prototype.componentDidMount=function(){var t=this,n=this.props,i=n.label,o=n.element,s=n.graphModel;s.eventCenter.on("blank:click,node:click,edge:click,label:click",function(c){var a,l,d,u,h=c.data;if(((h==null?void 0:h.type)!=="label"||h.type==="label"&&h.id!==i.id||t.state.isSelected)&&t.setState({isSelected:!1}),((h==null?void 0:h.type)!=="label"||h.type=="label"&&h.id!==i.id)&&t.state.isEditing){t.setState({isEditing:!1});var p=(l=(a=t.textRef.current)===null||a===void 0?void 0:a.innerText)!==null&&l!==void 0?l:"",v=(u=(d=t.textRef.current)===null||d===void 0?void 0:d.innerHTML)!==null&&u!==void 0?u:"";t.setElementModelLabelInfo({value:p,content:v,isSelected:!1}),o.setElementState(li.DEFAULT)}((h==null?void 0:h.type)!=="label"||h.type=="label"&&h.id!==i.id)&&t.textRef.current&&(t.textRef.current.contentEditable="false")})},e.prototype.componentDidUpdate=function(){},e.prototype.componentWillUnmount=function(){var t=this.props.graphModel;t.eventCenter.off("blank:click,node:click,edge:click")},e.prototype.render=function(){var t,n=this.props,i=n.label,o=n.element,s=n.graphModel,c=this.state,a=c.isDragging,l=c.isHovered,d=c.isSelected,u=c.isEditing,h=s.transformModel,p=h.getTransformStyle().transform,v=i.id,y=i.x,b=i.y,k=i.zIndex,B=i.vertical,W=i.style,K=i.rotate,le=i.content,G=i.labelWidth,L=i.textOverflowMode,ue=G!=null?G:o.BaseType==="node"?o.width-20:80,Q={left:"".concat(y-ue/2,"px"),top:"".concat(b-10,"px"),width:"".concat(ue,"px"),height:"20px",zIndex:k!=null?k:1,transform:K?"".concat(p," rotate(").concat(K,"deg)"):"".concat(p," rotate(").concat(B?-.25:0,"turn)")};return Be("div",{id:"element-container-".concat(v),className:ci("lf-label-editor-container"),style:Q,onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onClick:this.handleClick,onDblClick:this.handleDbClick,onBlur:this.handleBlur,onMouseEnter:this.setHoverOn,onMouseOver:this.setHoverOn,onMouseLeave:this.setHoverOff,children:Be("div",{ref:this.textRef,id:"editor-container-".concat(v),className:ci("lf-label-editor",(t={"lf-label-editor-dragging":a,"lf-label-editor-editing":u,"lf-label-editor-hover":!u&&(l||d)},t["lf-label-editor-".concat(L)]=!u,t)),onInput:this.handleInput,style:Vt({maxWidth:"".concat(ue,"px"),boxSizing:"border-box",display:"inline-block",background:u||o.BaseType==="edge"?"#fff":"transparent"},W),dangerouslySetInnerHTML:{__html:le}})})},e=Ia([co],e),e})(An),ct=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(s=r[c])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ha=ar,Fa=(function(){function r(e,t,n){var i;this.type="label",this.content="",this.value="",this.style={},this.vertical=!1,this.editable=!0,this.draggable=!0,this.textOverflowMode="default",this.element=t,this.graphModel=n,this.id=(i=e.id)!==null&&i!==void 0?i:Ha(),this.initLabelData(e)}return r.prototype.initLabelData=function(e){fo(this,e)},r.prototype.getData=function(){return{id:this.id,x:this.x,y:this.y,type:"label",content:this.content,value:this.value,rotate:this.rotate,style:sr(this.style),draggable:this.draggable,editable:this.editable,labelWidth:this.labelWidth,textOverflowMode:this.textOverflowMode,vertical:this.vertical}},ct([Ze],r.prototype,"x",void 0),ct([Ze],r.prototype,"y",void 0),ct([Ze],r.prototype,"content",void 0),ct([Ze],r.prototype,"value",void 0),ct([Ze],r.prototype,"rotate",void 0),ct([Ze],r.prototype,"style",void 0),ct([Ze],r.prototype,"zIndex",void 0),ct([Ze],r.prototype,"vertical",void 0),ct([Ze],r.prototype,"editable",void 0),ct([Ze],r.prototype,"draggable",void 0),ct([Ze],r.prototype,"labelWidth",void 0),ct([Ze],r.prototype,"textOverflowMode",void 0),r})(),Xn={exports:{}},Ln=Xn.exports,Gi;function za(){return Gi||(Gi=1,(function(r){/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */"classList"in document.createElement("_")||(function(e){if("Element"in e){var t="classList",n="prototype",i=e.Element[n],o=Object,s=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[n].indexOf||function(v){for(var y=0,b=this.length;y<b;y++)if(y in this&&this[y]===v)return y;return-1},a=function(v,y){this.name=v,this.code=DOMException[v],this.message=y},l=function(v,y){if(y==="")throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(y))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return c.call(v,y)},d=function(v){for(var y=s.call(v.getAttribute("class")||""),b=y?y.split(/\s+/):[],k=0,B=b.length;k<B;k++)this.push(b[k]);this._updateClassName=function(){v.setAttribute("class",this.toString())}},u=d[n]=[],h=function(){return new d(this)};if(a[n]=Error[n],u.item=function(v){return this[v]||null},u.contains=function(v){return v+="",l(this,v)!==-1},u.add=function(){var v=arguments,y=0,b=v.length,k,B=!1;do k=v[y]+"",l(this,k)===-1&&(this.push(k),B=!0);while(++y<b);B&&this._updateClassName()},u.remove=function(){var v=arguments,y=0,b=v.length,k,B=!1,W;do for(k=v[y]+"",W=l(this,k);W!==-1;)this.splice(W,1),B=!0,W=l(this,k);while(++y<b);B&&this._updateClassName()},u.toggle=function(v,y){v+="";var b=this.contains(v),k=b?y!==!0&&"remove":y!==!1&&"add";return k&&this[k](v),y===!0||y===!1?y:!b},u.toString=function(){return this.join(" ")},o.defineProperty){var p={get:h,enumerable:!0,configurable:!0};try{o.defineProperty(i,t,p)}catch(v){v.number===-2146823252&&(p.enumerable=!1,o.defineProperty(i,t,p))}}else o[n].__defineGetter__&&i.__defineGetter__(t,h)}})(self);/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */(function(e){if(e.URL=e.URL||e.webkitURL,e.Blob&&e.URL)try{new Blob;return}catch(i){}var t=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||(function(i){var o=function(L){return Object.prototype.toString.call(L).match(/^\[object\s(.*)\]$/)[1]},s=function(){this.data=[]},c=function(L,ue,Q){this.data=L,this.size=L.length,this.type=ue,this.encoding=Q},a=s.prototype,l=c.prototype,d=i.FileReaderSync,u=function(L){this.code=this[this.name=L]},h="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),p=h.length,v=i.URL||i.webkitURL||i,y=v.createObjectURL,b=v.revokeObjectURL,k=v,B=i.btoa,W=i.atob,K=i.ArrayBuffer,le=i.Uint8Array,G=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(c.fake=l.fake=!0;p--;)u.prototype[h[p]]=p+1;return v.createObjectURL||(k=i.URL=function(L){var ue=document.createElementNS("http://www.w3.org/1999/xhtml","a"),Q;return ue.href=L,"origin"in ue||(ue.protocol.toLowerCase()==="data:"?ue.origin=null:(Q=L.match(G),ue.origin=Q&&Q[1])),ue}),k.createObjectURL=function(L){var ue=L.type,Q;if(ue===null&&(ue="application/octet-stream"),L instanceof c)return Q="data:"+ue,L.encoding==="base64"?Q+";base64,"+L.data:L.encoding==="URI"?Q+","+decodeURIComponent(L.data):B?Q+";base64,"+B(L.data):Q+","+encodeURIComponent(L.data);if(y)return y.call(v,L)},k.revokeObjectURL=function(L){L.substring(0,5)!=="data:"&&b&&b.call(v,L)},a.append=function(L){var ue=this.data;if(le&&(L instanceof K||L instanceof le)){for(var Q="",je=new le(L),Le=0,tt=je.length;Le<tt;Le++)Q+=String.fromCharCode(je[Le]);ue.push(Q)}else if(o(L)==="Blob"||o(L)==="File")if(d){var w=new d;ue.push(w.readAsBinaryString(L))}else throw new u("NOT_READABLE_ERR");else L instanceof c?L.encoding==="base64"&&W?ue.push(W(L.data)):L.encoding==="URI"?ue.push(decodeURIComponent(L.data)):L.encoding==="raw"&&ue.push(L.data):(typeof L!="string"&&(L+=""),ue.push(unescape(encodeURIComponent(L))))},a.getBlob=function(L){return arguments.length||(L=null),new c(this.data.join(""),L,"raw")},a.toString=function(){return"[object BlobBuilder]"},l.slice=function(L,ue,Q){var je=arguments.length;return je<3&&(Q=null),new c(this.data.slice(L,je>1?ue:this.data.length),Q,this.encoding)},l.toString=function(){return"[object Blob]"},l.close=function(){this.size=0,delete this.data},s})(e);e.Blob=function(i,o){var s=o&&o.type||"",c=new t;if(i)for(var a=0,l=i.length;a<l;a++)Uint8Array&&i[a]instanceof Uint8Array?c.append(i[a].buffer):c.append(i[a]);var d=c.getBlob(s);return!d.slice&&d.webkitSlice&&(d.slice=d.webkitSlice),d};var n=Object.getPrototypeOf||function(i){return i.__proto__};e.Blob.prototype=n(new e.Blob)})(typeof self!="undefined"&&self||typeof window!="undefined"&&window||Ln.content||Ln),(function(e,t){var n=typeof process!="undefined"&&process&&process.versions&&process.versions.electron;n?e.MediumEditor=t:r.exports=t})(Ln,(function(){function e(t,n){return this.init(t,n)}return e.extensions={},(function(t){function n(a,l){var d,u=Array.prototype.slice.call(arguments,2);l=l||{};for(var h=0;h<u.length;h++){var p=u[h];if(p)for(d in p)p.hasOwnProperty(d)&&typeof p[d]!="undefined"&&(a||l.hasOwnProperty(d)===!1)&&(l[d]=p[d])}return l}var i=!1;try{var o=document.createElement("div"),s=document.createTextNode(" ");o.appendChild(s),i=o.contains(s)}catch(a){}var c={isIE:navigator.appName==="Microsoft Internet Explorer"||navigator.appName==="Netscape"&&new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)!==null,isEdge:/Edge\/\d+/.exec(navigator.userAgent)!==null,isFF:navigator.userAgent.toLowerCase().indexOf("firefox")>-1,isMac:t.navigator.platform.toUpperCase().indexOf("MAC")>=0,keyCode:{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DELETE:46,K:75,M:77,V:86},isMetaCtrlKey:function(a){return!!(c.isMac&&a.metaKey||!c.isMac&&a.ctrlKey)},isKey:function(a,l){var d=c.getKeyCode(a);return Array.isArray(l)===!1?d===l:l.indexOf(d)!==-1},getKeyCode:function(a){var l=a.which;return l===null&&(l=a.charCode!==null?a.charCode:a.keyCode),l},blockContainerElementNames:["p","h1","h2","h3","h4","h5","h6","blockquote","pre","ul","li","ol","address","article","aside","audio","canvas","dd","dl","dt","fieldset","figcaption","figure","footer","form","header","hgroup","main","nav","noscript","output","section","video","table","thead","tbody","tfoot","tr","th","td"],emptyElementNames:["br","col","colgroup","hr","img","input","source","wbr"],extend:function(){var a=[!0].concat(Array.prototype.slice.call(arguments));return n.apply(this,a)},defaults:function(){var a=[!1].concat(Array.prototype.slice.call(arguments));return n.apply(this,a)},createLink:function(a,l,d,u){var h=a.createElement("a");return c.moveTextRangeIntoElement(l[0],l[l.length-1],h),h.setAttribute("href",d),u&&(u==="_blank"&&h.setAttribute("rel","noopener noreferrer"),h.setAttribute("target",u)),h},findOrCreateMatchingTextNodes:function(a,l,d){for(var u=a.createTreeWalker(l,NodeFilter.SHOW_ALL,null,!1),h=[],p=0,v=!1,y=null,b=null;(y=u.nextNode())!==null;)if(!(y.nodeType>3))if(y.nodeType===3){if(!v&&d.start<p+y.nodeValue.length&&(v=!0,b=c.splitStartNodeIfNeeded(y,d.start,p)),v&&c.splitEndNodeIfNeeded(y,b,d.end,p),v&&p===d.end)break;if(v&&p>d.end+1)throw new Error("PerformLinking overshot the target!");v&&h.push(b||y),p+=y.nodeValue.length,b!==null&&(p+=b.nodeValue.length,u.nextNode()),b=null}else y.tagName.toLowerCase()==="img"&&(!v&&d.start<=p&&(v=!0),v&&h.push(y));return h},splitStartNodeIfNeeded:function(a,l,d){return l!==d?a.splitText(l-d):null},splitEndNodeIfNeeded:function(a,l,d,u){var h,p;h=u+a.nodeValue.length+(l?l.nodeValue.length:0)-1,p=d-u-(l?a.nodeValue.length:0),h>=d&&u!==h&&p!==0&&(l||a).splitText(p)},splitByBlockElements:function(a){if(a.nodeType!==3&&a.nodeType!==1)return[];var l=[],d=e.util.blockContainerElementNames.join(",");if(a.nodeType===3||a.querySelectorAll(d).length===0)return[a];for(var u=0;u<a.childNodes.length;u++){var h=a.childNodes[u];if(h.nodeType===3)l.push(h);else if(h.nodeType===1){var p=h.querySelectorAll(d);p.length===0?l.push(h):l=l.concat(e.util.splitByBlockElements(h))}}return l},findAdjacentTextNodeWithContent:function(a,l,d){var u=!1,h,p=d.createNodeIterator(a,NodeFilter.SHOW_TEXT,null,!1);for(h=p.nextNode();h;){if(h===l)u=!0;else if(u&&h.nodeType===3&&h.nodeValue&&h.nodeValue.trim().length>0)break;h=p.nextNode()}return h},findPreviousSibling:function(a){if(!a||c.isMediumEditorElement(a))return!1;for(var l=a.previousSibling;!l&&!c.isMediumEditorElement(a.parentNode);)a=a.parentNode,l=a.previousSibling;return l},isDescendant:function(a,l,d){if(!a||!l)return!1;if(a===l)return!!d;if(a.nodeType!==1)return!1;if(i||l.nodeType!==3)return a.contains(l);for(var u=l.parentNode;u!==null;){if(u===a)return!0;u=u.parentNode}return!1},isElement:function(a){return!!(a&&a.nodeType===1)},throttle:function(a,l){var d=50,u,h,p,v=null,y=0,b=function(){y=Date.now(),v=null,p=a.apply(u,h),v||(u=h=null)};return!l&&l!==0&&(l=d),function(){var k=Date.now(),B=l-(k-y);return u=this,h=arguments,B<=0||B>l?(v&&(clearTimeout(v),v=null),y=k,p=a.apply(u,h),v||(u=h=null)):v||(v=setTimeout(b,B)),p}},traverseUp:function(a,l){if(!a)return!1;do{if(a.nodeType===1){if(l(a))return a;if(c.isMediumEditorElement(a))return!1}a=a.parentNode}while(a);return!1},htmlEntities:function(a){return String(a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},insertHTMLCommand:function(a,l){var d,u,h,p,v,y,b,k=!1,B=["insertHTML",!1,l];if(!e.util.isEdge&&a.queryCommandSupported("insertHTML"))try{return a.execCommand.apply(a,B)}catch(W){}if(d=a.getSelection(),d.rangeCount){if(u=d.getRangeAt(0),b=u.commonAncestorContainer,c.isMediumEditorElement(b)&&!b.firstChild)u.selectNode(b.appendChild(a.createTextNode("")));else if(b.nodeType===3&&u.startOffset===0&&u.endOffset===b.nodeValue.length||b.nodeType!==3&&b.innerHTML===u.toString()){for(;!c.isMediumEditorElement(b)&&b.parentNode&&b.parentNode.childNodes.length===1&&!c.isMediumEditorElement(b.parentNode);)b=b.parentNode;u.selectNode(b)}for(u.deleteContents(),h=a.createElement("div"),h.innerHTML=l,p=a.createDocumentFragment();h.firstChild;)v=h.firstChild,y=p.appendChild(v);u.insertNode(p),y&&(u=u.cloneRange(),u.setStartAfter(y),u.collapse(!0),e.selection.selectRange(a,u)),k=!0}return a.execCommand.callListeners&&a.execCommand.callListeners(B,k),k},execFormatBlock:function(a,l){var d=c.getTopBlockContainer(e.selection.getSelectionStart(a)),u;if(l==="blockquote"){if(d&&(u=Array.prototype.slice.call(d.childNodes),u.some(function(h){return c.isBlockContainer(h)})))return a.execCommand("outdent",!1,null);if(c.isIE)return a.execCommand("indent",!1,l)}if(d&&l===d.nodeName.toLowerCase()&&(l="p"),c.isIE&&(l="<"+l+">"),d&&d.nodeName.toLowerCase()==="blockquote"){if(c.isIE&&l==="<p>")return a.execCommand("outdent",!1,l);if((c.isFF||c.isEdge)&&l==="p")return u=Array.prototype.slice.call(d.childNodes),u.some(function(h){return!c.isBlockContainer(h)})&&a.execCommand("formatBlock",!1,l),a.execCommand("outdent",!1,l)}return a.execCommand("formatBlock",!1,l)},setTargetBlank:function(a,l){var d,u=l||!1;if(a.nodeName.toLowerCase()==="a")a.target="_blank",a.rel="noopener noreferrer";else for(a=a.getElementsByTagName("a"),d=0;d<a.length;d+=1)(u===!1||u===a[d].attributes.href.value)&&(a[d].target="_blank",a[d].rel="noopener noreferrer")},removeTargetBlank:function(a,l){var d;if(a.nodeName.toLowerCase()==="a")a.removeAttribute("target"),a.removeAttribute("rel");else for(a=a.getElementsByTagName("a"),d=0;d<a.length;d+=1)l===a[d].attributes.href.value&&(a[d].removeAttribute("target"),a[d].removeAttribute("rel"))},addClassToAnchors:function(a,l){var d=l.split(" "),u,h;if(a.nodeName.toLowerCase()==="a")for(h=0;h<d.length;h+=1)a.classList.add(d[h]);else{var p=a.getElementsByTagName("a");if(p.length===0){var v=c.getClosestTag(a,"a");a=v?[v]:[]}else a=p;for(u=0;u<a.length;u+=1)for(h=0;h<d.length;h+=1)a[u].classList.add(d[h])}},isListItem:function(a){if(!a)return!1;if(a.nodeName.toLowerCase()==="li")return!0;for(var l=a.parentNode,d=l.nodeName.toLowerCase();d==="li"||!c.isBlockContainer(l)&&d!=="div";){if(d==="li")return!0;if(l=l.parentNode,l)d=l.nodeName.toLowerCase();else return!1}return!1},cleanListDOM:function(a,l){if(l.nodeName.toLowerCase()==="li"){var d=l.parentElement;d.parentElement.nodeName.toLowerCase()==="p"&&(c.unwrap(d.parentElement,a),e.selection.moveCursor(a,l.firstChild,l.firstChild.textContent.length))}},splitOffDOMTree:function(a,l,d){for(var u=l,h=null,p=!d;u!==a;){var v=u.parentNode,y=v.cloneNode(!1),b=p?u:v.firstChild,k;for(h&&(p?y.appendChild(h):k=h),h=y;b;){var B=b.nextSibling;b===u?(b.hasChildNodes()?b=b.cloneNode(!1):b.parentNode.removeChild(b),b.textContent&&h.appendChild(b),b=p?B:null):(b.parentNode.removeChild(b),(b.hasChildNodes()||b.textContent)&&h.appendChild(b),b=B)}k&&h.appendChild(k),u=v}return h},moveTextRangeIntoElement:function(a,l,d){if(!a||!l)return!1;var u=c.findCommonRoot(a,l);if(!u)return!1;if(l===a){var h=a.parentNode,p=a.nextSibling;return h.removeChild(a),d.appendChild(a),p?h.insertBefore(d,p):h.appendChild(d),d.hasChildNodes()}for(var v=[],y,b,k,B=0;B<u.childNodes.length;B++)if(k=u.childNodes[B],!y)c.isDescendant(k,a,!0)&&(y=k);else if(c.isDescendant(k,l,!0)){b=k;break}else v.push(k);var W=b.nextSibling,K=u.ownerDocument.createDocumentFragment();return y===a?(y.parentNode.removeChild(y),K.appendChild(y)):K.appendChild(c.splitOffDOMTree(y,a)),v.forEach(function(le){le.parentNode.removeChild(le),K.appendChild(le)}),b===l?(b.parentNode.removeChild(b),K.appendChild(b)):K.appendChild(c.splitOffDOMTree(b,l,!0)),d.appendChild(K),b.parentNode===u?u.insertBefore(d,b):W?u.insertBefore(d,W):u.appendChild(d),d.hasChildNodes()},depthOfNode:function(a){for(var l=0,d=a;d.parentNode!==null;)d=d.parentNode,l++;return l},findCommonRoot:function(a,l){for(var d=c.depthOfNode(a),u=c.depthOfNode(l),h=a,p=l;d!==u;)d>u?(h=h.parentNode,d-=1):(p=p.parentNode,u-=1);for(;h!==p;)h=h.parentNode,p=p.parentNode;return h},isElementAtBeginningOfBlock:function(a){for(var l,d;!c.isBlockContainer(a)&&!c.isMediumEditorElement(a);){for(d=a;d=d.previousSibling;)if(l=d.nodeType===3?d.nodeValue:d.textContent,l.length>0)return!1;a=a.parentNode}return!0},isMediumEditorElement:function(a){return a&&a.getAttribute&&!!a.getAttribute("data-medium-editor-element")},getContainerEditorElement:function(a){return c.traverseUp(a,function(l){return c.isMediumEditorElement(l)})},isBlockContainer:function(a){return a&&a.nodeType!==3&&c.blockContainerElementNames.indexOf(a.nodeName.toLowerCase())!==-1},getClosestBlockContainer:function(a){return c.traverseUp(a,function(l){return c.isBlockContainer(l)||c.isMediumEditorElement(l)})},getTopBlockContainer:function(a){var l=c.isBlockContainer(a)?a:!1;return c.traverseUp(a,function(d){return c.isBlockContainer(d)&&(l=d),!l&&c.isMediumEditorElement(d)?(l=d,!0):!1}),l},getFirstSelectableLeafNode:function(a){for(;a&&a.firstChild;)a=a.firstChild;if(a=c.traverseUp(a,function(d){return c.emptyElementNames.indexOf(d.nodeName.toLowerCase())===-1}),a.nodeName.toLowerCase()==="table"){var l=a.querySelector("th, td");l&&(a=l)}return a},getFirstTextNode:function(a){return c.warn("getFirstTextNode is deprecated and will be removed in version 6.0.0"),c._getFirstTextNode(a)},_getFirstTextNode:function(a){if(a.nodeType===3)return a;for(var l=0;l<a.childNodes.length;l++){var d=c._getFirstTextNode(a.childNodes[l]);if(d!==null)return d}return null},ensureUrlHasProtocol:function(a){return a.indexOf("://")===-1?"http://"+a:a},warn:function(){t.console!==void 0&&typeof t.console.warn=="function"&&t.console.warn.apply(t.console,arguments)},deprecated:function(a,l,d){var u=a+" is deprecated, please use "+l+" instead.";d&&(u+=" Will be removed in "+d),c.warn(u)},deprecatedMethod:function(a,l,d,u){c.deprecated(a,l,u),typeof this[l]=="function"&&this[l].apply(this,d)},cleanupAttrs:function(a,l){l.forEach(function(d){a.removeAttribute(d)})},cleanupTags:function(a,l){l.indexOf(a.nodeName.toLowerCase())!==-1&&a.parentNode.removeChild(a)},unwrapTags:function(a,l){l.indexOf(a.nodeName.toLowerCase())!==-1&&e.util.unwrap(a,document)},getClosestTag:function(a,l){return c.traverseUp(a,function(d){return d.nodeName.toLowerCase()===l.toLowerCase()})},unwrap:function(a,l){for(var d=l.createDocumentFragment(),u=Array.prototype.slice.call(a.childNodes),h=0;h<u.length;h++)d.appendChild(u[h]);d.childNodes.length?a.parentNode.replaceChild(d,a):a.parentNode.removeChild(a)},guid:function(){function a(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}};e.util=c})(window),(function(){var t=function(n){e.util.extend(this,n)};t.extend=function(n){var i=this,o;n&&n.hasOwnProperty("constructor")?o=n.constructor:o=function(){return i.apply(this,arguments)},e.util.extend(o,i);var s=function(){this.constructor=o};return s.prototype=i.prototype,o.prototype=new s,n&&e.util.extend(o.prototype,n),o},t.prototype={init:function(){},base:void 0,name:void 0,checkState:void 0,destroy:void 0,queryCommandState:void 0,isActive:void 0,isAlreadyApplied:void 0,setActive:void 0,setInactive:void 0,getInteractionElements:void 0,window:void 0,document:void 0,getEditorElements:function(){return this.base.elements},getEditorId:function(){return this.base.id},getEditorOption:function(n){return this.base.options[n]}},["execAction","on","off","subscribe","trigger"].forEach(function(n){t.prototype[n]=function(){return this.base[n].apply(this.base,arguments)}}),e.Extension=t})(),(function(){function t(i){return e.util.isBlockContainer(i)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}var n={findMatchingSelectionParent:function(i,o){var s=o.getSelection(),c,a;return s.rangeCount===0?!1:(c=s.getRangeAt(0),a=c.commonAncestorContainer,e.util.traverseUp(a,i))},getSelectionElement:function(i){return this.findMatchingSelectionParent(function(o){return e.util.isMediumEditorElement(o)},i)},exportSelection:function(i,o){if(!i)return null;var s=null,c=o.getSelection();if(c.rangeCount>0){var a=c.getRangeAt(0),l=a.cloneRange(),d;l.selectNodeContents(i),l.setEnd(a.startContainer,a.startOffset),d=l.toString().length,s={start:d,end:d+a.toString().length},this.doesRangeStartWithImages(a,o)&&(s.startsWithImage=!0);var u=this.getTrailingImageCount(i,s,a.endContainer,a.endOffset);if(u&&(s.trailingImageCount=u),d!==0){var h=this.getIndexRelativeToAdjacentEmptyBlocks(o,i,a.startContainer,a.startOffset);h!==-1&&(s.emptyBlocksIndex=h)}}return s},importSelection:function(i,o,s,c){if(!(!i||!o)){var a=s.createRange();a.setStart(o,0),a.collapse(!0);var l=o,d=[],u=0,h=!1,p=!1,v=0,y=!1,b,k=!1,B=null;for((c||i.startsWithImage||typeof i.emptyBlocksIndex!="undefined")&&(k=!0);!y&&l;){if(l.nodeType>3){l=d.pop();continue}if(l.nodeType===3&&!p)b=u+l.length,!h&&i.start>=u&&i.start<=b&&(k||i.start<b?(a.setStart(l,i.start-u),h=!0):B=l),h&&i.end>=u&&i.end<=b&&(i.trailingImageCount?p=!0:(a.setEnd(l,i.end-u),y=!0)),u=b;else{if(i.trailingImageCount&&p&&(l.nodeName.toLowerCase()==="img"&&v++,v===i.trailingImageCount)){for(var W=0;l.parentNode.childNodes[W]!==l;)W++;a.setEnd(l.parentNode,W+1),y=!0}if(!y&&l.nodeType===1)for(var K=l.childNodes.length-1;K>=0;)d.push(l.childNodes[K]),K-=1}y||(l=d.pop())}!h&&B&&(a.setStart(B,B.length),a.setEnd(B,B.length)),typeof i.emptyBlocksIndex!="undefined"&&(a=this.importSelectionMoveCursorPastBlocks(s,o,i.emptyBlocksIndex,a)),c&&(a=this.importSelectionMoveCursorPastAnchor(i,a)),this.selectRange(s,a)}},importSelectionMoveCursorPastAnchor:function(i,o){var s=function(u){return u.nodeName.toLowerCase()==="a"};if(i.start===i.end&&o.startContainer.nodeType===3&&o.startOffset===o.startContainer.nodeValue.length&&e.util.traverseUp(o.startContainer,s)){for(var c=o.startContainer,a=o.startContainer.parentNode;a!==null&&a.nodeName.toLowerCase()!=="a";)a.childNodes[a.childNodes.length-1]!==c?a=null:(c=a,a=a.parentNode);if(a!==null&&a.nodeName.toLowerCase()==="a"){for(var l=null,d=0;l===null&&d<a.parentNode.childNodes.length;d++)a.parentNode.childNodes[d]===a&&(l=d);o.setStart(a.parentNode,l+1),o.collapse(!0)}}return o},importSelectionMoveCursorPastBlocks:function(i,o,s,c){var a=i.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,t,!1),l=c.startContainer,d,u,h=0;for(s=s||1,l.nodeType===3&&e.util.isBlockContainer(l.previousSibling)?d=l.previousSibling:d=e.util.getClosestBlockContainer(l);a.nextNode();)if(!u)d===a.currentNode&&(u=a.currentNode);else if(u=a.currentNode,h++,h===s||u.textContent.length>0)break;return u||(u=d),c.setStart(e.util.getFirstSelectableLeafNode(u),0),c},getIndexRelativeToAdjacentEmptyBlocks:function(i,o,s,c){if(s.textContent.length>0&&c>0)return-1;var a=s;if(a.nodeType!==3&&(a=s.childNodes[c]),a){if(!e.util.isElementAtBeginningOfBlock(a))return-1;var l=e.util.findPreviousSibling(a);if(l){if(l.nodeValue)return-1}else return-1}for(var d=e.util.getClosestBlockContainer(s),u=i.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,t,!1),h=0;u.nextNode();){var p=u.currentNode.textContent==="";if((p||h>0)&&(h+=1),u.currentNode===d)return h;p||(h=0)}return h},doesRangeStartWithImages:function(i,o){if(i.startOffset!==0||i.startContainer.nodeType!==1)return!1;if(i.startContainer.nodeName.toLowerCase()==="img")return!0;var s=i.startContainer.querySelector("img");if(!s)return!1;for(var c=o.createTreeWalker(i.startContainer,NodeFilter.SHOW_ALL,null,!1);c.nextNode();){var a=c.currentNode;if(a===s)break;if(a.nodeValue)return!1}return!0},getTrailingImageCount:function(i,o,s,c){if(c===0||s.nodeType!==1||s.nodeName.toLowerCase()!=="img"&&!s.querySelector("img"))return 0;for(var a=s.childNodes[c-1];a.hasChildNodes();)a=a.lastChild;for(var l=i,d=[],u=0,h=!1,p=!1,v=!1,y,b=0;!v&&l;){if(l.nodeType>3){l=d.pop();continue}if(l.nodeType===3&&!p)b=0,y=u+l.length,!h&&o.start>=u&&o.start<=y&&(h=!0),h&&o.end>=u&&o.end<=y&&(p=!0),u=y;else if(l.nodeName.toLowerCase()==="img"&&b++,l===a)v=!0;else if(l.nodeType===1)for(var k=l.childNodes.length-1;k>=0;)d.push(l.childNodes[k]),k-=1;v||(l=d.pop())}return b},selectionContainsContent:function(i){var o=i.getSelection();if(!o||o.isCollapsed||!o.rangeCount)return!1;if(o.toString().trim()!=="")return!0;var s=this.getSelectedParentElement(o.getRangeAt(0));return!!(s&&(s.nodeName.toLowerCase()==="img"||s.nodeType===1&&s.querySelector("img")))},selectionInContentEditableFalse:function(i){var o,s=this.findMatchingSelectionParent(function(c){var a=c&&c.getAttribute("contenteditable");return a==="true"&&(o=!0),c.nodeName!=="#text"&&a==="false"},i);return!o&&s},getSelectionHtml:function(i){var o,s="",c=i.getSelection(),a,l;if(c.rangeCount){for(l=i.createElement("div"),o=0,a=c.rangeCount;o<a;o+=1)l.appendChild(c.getRangeAt(o).cloneContents());s=l.innerHTML}return s},getCaretOffsets:function(i,o){var s,c;return o||(o=window.getSelection().getRangeAt(0)),s=o.cloneRange(),c=o.cloneRange(),s.selectNodeContents(i),s.setEnd(o.endContainer,o.endOffset),c.selectNodeContents(i),c.setStart(o.endContainer,o.endOffset),{left:s.toString().length,right:c.toString().length}},rangeSelectsSingleNode:function(i){var o=i.startContainer;return o===i.endContainer&&o.hasChildNodes()&&i.endOffset===i.startOffset+1},getSelectedParentElement:function(i){return i?this.rangeSelectsSingleNode(i)&&i.startContainer.childNodes[i.startOffset].nodeType!==3?i.startContainer.childNodes[i.startOffset]:i.startContainer.nodeType===3?i.startContainer.parentNode:i.startContainer:null},getSelectedElements:function(i){var o=i.getSelection(),s,c,a;if(!o.rangeCount||o.isCollapsed||!o.getRangeAt(0).commonAncestorContainer)return[];if(s=o.getRangeAt(0),s.commonAncestorContainer.nodeType===3){for(c=[],a=s.commonAncestorContainer;a.parentNode&&a.parentNode.childNodes.length===1;)c.push(a.parentNode),a=a.parentNode;return c}return[].filter.call(s.commonAncestorContainer.getElementsByTagName("*"),function(l){return typeof o.containsNode=="function"?o.containsNode(l,!0):!0})},selectNode:function(i,o){var s=o.createRange();s.selectNodeContents(i),this.selectRange(o,s)},select:function(i,o,s,c,a){var l=i.createRange();return l.setStart(o,s),c?l.setEnd(c,a):l.collapse(!0),this.selectRange(i,l),l},clearSelection:function(i,o){o?i.getSelection().collapseToStart():i.getSelection().collapseToEnd()},moveCursor:function(i,o,s){this.select(i,o,s)},getSelectionRange:function(i){var o=i.getSelection();return o.rangeCount===0?null:o.getRangeAt(0)},selectRange:function(i,o){var s=i.getSelection();s.removeAllRanges(),s.addRange(o)},getSelectionStart:function(i){var o=i.getSelection().anchorNode,s=o&&o.nodeType===3?o.parentNode:o;return s}};e.selection=n})(),(function(){function t(i,o){return i?i.some(function(s){if(typeof s.getInteractionElements!="function")return!1;var c=s.getInteractionElements();return c?(Array.isArray(c)||(c=[c]),c.some(function(a){return e.util.isDescendant(a,o,!0)})):!1}):!1}var n=function(i){this.base=i,this.options=this.base.options,this.events=[],this.disabledEvents={},this.customEvents={},this.listeners={}};n.prototype={InputEventOnContenteditableSupported:!e.util.isIE&&!e.util.isEdge,attachDOMEvent:function(i,o,s,c){var a=this.base.options.contentWindow,l=this.base.options.ownerDocument;i=e.util.isElement(i)||[a,l].indexOf(i)>-1?[i]:i,Array.prototype.forEach.call(i,function(d){d.addEventListener(o,s,c),this.events.push([d,o,s,c])}.bind(this))},detachDOMEvent:function(i,o,s,c){var a,l,d=this.base.options.contentWindow,u=this.base.options.ownerDocument;i&&(i=e.util.isElement(i)||[d,u].indexOf(i)>-1?[i]:i,Array.prototype.forEach.call(i,function(h){a=this.indexOfListener(h,o,s,c),a!==-1&&(l=this.events.splice(a,1)[0],l[0].removeEventListener(l[1],l[2],l[3]))}.bind(this)))},indexOfListener:function(i,o,s,c){var a,l,d;for(a=0,l=this.events.length;a<l;a=a+1)if(d=this.events[a],d[0]===i&&d[1]===o&&d[2]===s&&d[3]===c)return a;return-1},detachAllDOMEvents:function(){for(var i=this.events.pop();i;)i[0].removeEventListener(i[1],i[2],i[3]),i=this.events.pop()},detachAllEventsFromElement:function(i){for(var o=this.events.filter(function(l){return l&&l[0].getAttribute&&l[0].getAttribute("medium-editor-index")===i.getAttribute("medium-editor-index")}),s=0,c=o.length;s<c;s++){var a=o[s];this.detachDOMEvent(a[0],a[1],a[2],a[3])}},attachAllEventsToElement:function(i){this.listeners.editableInput&&(this.contentCache[i.getAttribute("medium-editor-index")]=i.innerHTML),this.eventsCache&&this.eventsCache.forEach(function(o){this.attachDOMEvent(i,o.name,o.handler.bind(this))},this)},enableCustomEvent:function(i){this.disabledEvents[i]!==void 0&&delete this.disabledEvents[i]},disableCustomEvent:function(i){this.disabledEvents[i]=!0},attachCustomEvent:function(i,o){this.setupListener(i),this.customEvents[i]||(this.customEvents[i]=[]),this.customEvents[i].push(o)},detachCustomEvent:function(i,o){var s=this.indexOfCustomListener(i,o);s!==-1&&this.customEvents[i].splice(s,1)},indexOfCustomListener:function(i,o){return!this.customEvents[i]||!this.customEvents[i].length?-1:this.customEvents[i].indexOf(o)},detachAllCustomEvents:function(){this.customEvents={}},triggerCustomEvent:function(i,o,s){this.customEvents[i]&&!this.disabledEvents[i]&&this.customEvents[i].forEach(function(c){c(o,s)})},destroy:function(){this.detachAllDOMEvents(),this.detachAllCustomEvents(),this.detachExecCommand(),this.base.elements&&this.base.elements.forEach(function(i){i.removeAttribute("data-medium-focused")})},attachToExecCommand:function(){this.execCommandListener||(this.execCommandListener=function(i){this.handleDocumentExecCommand(i)}.bind(this),this.wrapExecCommand(),this.options.ownerDocument.execCommand.listeners.push(this.execCommandListener))},detachExecCommand:function(){var i=this.options.ownerDocument;if(!(!this.execCommandListener||!i.execCommand.listeners)){var o=i.execCommand.listeners.indexOf(this.execCommandListener);o!==-1&&i.execCommand.listeners.splice(o,1),i.execCommand.listeners.length||this.unwrapExecCommand()}},wrapExecCommand:function(){var i=this.options.ownerDocument;if(!i.execCommand.listeners){var o=function(c,a){i.execCommand.listeners&&i.execCommand.listeners.forEach(function(l){l({command:c[0],value:c[2],args:c,result:a})})},s=function(){var c=i.execCommand.orig.apply(this,arguments);if(!i.execCommand.listeners)return c;var a=Array.prototype.slice.call(arguments);return o(a,c),c};s.orig=i.execCommand,s.listeners=[],s.callListeners=o,i.execCommand=s}},unwrapExecCommand:function(){var i=this.options.ownerDocument;i.execCommand.orig&&(i.execCommand=i.execCommand.orig)},setupListener:function(i){if(!this.listeners[i]){switch(i){case"externalInteraction":this.attachDOMEvent(this.options.ownerDocument.body,"mousedown",this.handleBodyMousedown.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"click",this.handleBodyClick.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"focus",this.handleBodyFocus.bind(this),!0);break;case"blur":this.setupListener("externalInteraction");break;case"focus":this.setupListener("externalInteraction");break;case"editableInput":this.contentCache={},this.base.elements.forEach(function(o){this.contentCache[o.getAttribute("medium-editor-index")]=o.innerHTML},this),this.InputEventOnContenteditableSupported&&this.attachToEachElement("input",this.handleInput),this.InputEventOnContenteditableSupported||(this.setupListener("editableKeypress"),this.keypressUpdateInput=!0,this.attachDOMEvent(document,"selectionchange",this.handleDocumentSelectionChange.bind(this)),this.attachToExecCommand());break;case"editableClick":this.attachToEachElement("click",this.handleClick);break;case"editableBlur":this.attachToEachElement("blur",this.handleBlur);break;case"editableKeypress":this.attachToEachElement("keypress",this.handleKeypress);break;case"editableKeyup":this.attachToEachElement("keyup",this.handleKeyup);break;case"editableKeydown":this.attachToEachElement("keydown",this.handleKeydown);break;case"editableKeydownSpace":this.setupListener("editableKeydown");break;case"editableKeydownEnter":this.setupListener("editableKeydown");break;case"editableKeydownTab":this.setupListener("editableKeydown");break;case"editableKeydownDelete":this.setupListener("editableKeydown");break;case"editableMouseover":this.attachToEachElement("mouseover",this.handleMouseover);break;case"editableDrag":this.attachToEachElement("dragover",this.handleDragging),this.attachToEachElement("dragleave",this.handleDragging);break;case"editableDrop":this.attachToEachElement("drop",this.handleDrop);break;case"editablePaste":this.attachToEachElement("paste",this.handlePaste);break}this.listeners[i]=!0}},attachToEachElement:function(i,o){this.eventsCache||(this.eventsCache=[]),this.base.elements.forEach(function(s){this.attachDOMEvent(s,i,o.bind(this))},this),this.eventsCache.push({name:i,handler:o})},cleanupElement:function(i){var o=i.getAttribute("medium-editor-index");o&&(this.detachAllEventsFromElement(i),this.contentCache&&delete this.contentCache[o])},focusElement:function(i){i.focus(),this.updateFocus(i,{target:i,type:"focus"})},updateFocus:function(i,o){var s=this.base.getFocusedElement(),c;s&&o.type==="click"&&this.lastMousedownTarget&&(e.util.isDescendant(s,this.lastMousedownTarget,!0)||t(this.base.extensions,this.lastMousedownTarget))&&(c=s),c||this.base.elements.some(function(l){return!c&&e.util.isDescendant(l,i,!0)&&(c=l),!!c},this);var a=!e.util.isDescendant(s,i,!0)&&!t(this.base.extensions,i);c!==s&&(s&&a&&(s.removeAttribute("data-medium-focused"),this.triggerCustomEvent("blur",o,s)),c&&(c.setAttribute("data-medium-focused",!0),this.triggerCustomEvent("focus",o,c))),a&&this.triggerCustomEvent("externalInteraction",o)},updateInput:function(i,o){if(this.contentCache){var s=i.getAttribute("medium-editor-index"),c=i.innerHTML;c!==this.contentCache[s]&&this.triggerCustomEvent("editableInput",o,i),this.contentCache[s]=c}},handleDocumentSelectionChange:function(i){if(i.currentTarget&&i.currentTarget.activeElement){var o=i.currentTarget.activeElement,s;this.base.elements.some(function(c){return e.util.isDescendant(c,o,!0)?(s=c,!0):!1},this),s&&this.updateInput(s,{target:o,currentTarget:s})}},handleDocumentExecCommand:function(){var i=this.base.getFocusedElement();i&&this.updateInput(i,{target:i,currentTarget:i})},handleBodyClick:function(i){this.updateFocus(i.target,i)},handleBodyFocus:function(i){this.updateFocus(i.target,i)},handleBodyMousedown:function(i){this.lastMousedownTarget=i.target},handleInput:function(i){this.updateInput(i.currentTarget,i)},handleClick:function(i){this.triggerCustomEvent("editableClick",i,i.currentTarget)},handleBlur:function(i){this.triggerCustomEvent("editableBlur",i,i.currentTarget)},handleKeypress:function(i){if(this.triggerCustomEvent("editableKeypress",i,i.currentTarget),this.keypressUpdateInput){var o={target:i.target,currentTarget:i.currentTarget};setTimeout(function(){this.updateInput(o.currentTarget,o)}.bind(this),0)}},handleKeyup:function(i){this.triggerCustomEvent("editableKeyup",i,i.currentTarget)},handleMouseover:function(i){this.triggerCustomEvent("editableMouseover",i,i.currentTarget)},handleDragging:function(i){this.triggerCustomEvent("editableDrag",i,i.currentTarget)},handleDrop:function(i){this.triggerCustomEvent("editableDrop",i,i.currentTarget)},handlePaste:function(i){this.triggerCustomEvent("editablePaste",i,i.currentTarget)},handleKeydown:function(i){if(this.triggerCustomEvent("editableKeydown",i,i.currentTarget),e.util.isKey(i,e.util.keyCode.SPACE))return this.triggerCustomEvent("editableKeydownSpace",i,i.currentTarget);if(e.util.isKey(i,e.util.keyCode.ENTER)||i.ctrlKey&&e.util.isKey(i,e.util.keyCode.M))return this.triggerCustomEvent("editableKeydownEnter",i,i.currentTarget);if(e.util.isKey(i,e.util.keyCode.TAB))return this.triggerCustomEvent("editableKeydownTab",i,i.currentTarget);if(e.util.isKey(i,[e.util.keyCode.DELETE,e.util.keyCode.BACKSPACE]))return this.triggerCustomEvent("editableKeydownDelete",i,i.currentTarget)}},e.Events=n})(),(function(){var t=e.Extension.extend({action:void 0,aria:void 0,tagNames:void 0,style:void 0,useQueryState:void 0,contentDefault:void 0,contentFA:void 0,classList:void 0,attrs:void 0,constructor:function(n){t.isBuiltInButton(n)?e.Extension.call(this,this.defaults[n]):e.Extension.call(this,n)},init:function(){e.Extension.prototype.init.apply(this,arguments),this.button=this.createButton(),this.on(this.button,"click",this.handleClick.bind(this))},getButton:function(){return this.button},getAction:function(){return typeof this.action=="function"?this.action(this.base.options):this.action},getAria:function(){return typeof this.aria=="function"?this.aria(this.base.options):this.aria},getTagNames:function(){return typeof this.tagNames=="function"?this.tagNames(this.base.options):this.tagNames},createButton:function(){var n=this.document.createElement("button"),i=this.contentDefault,o=this.getAria(),s=this.getEditorOption("buttonLabels");return n.classList.add("medium-editor-action"),n.classList.add("medium-editor-action-"+this.name),this.classList&&this.classList.forEach(function(c){n.classList.add(c)}),n.setAttribute("data-action",this.getAction()),o&&(n.setAttribute("title",o),n.setAttribute("aria-label",o)),this.attrs&&Object.keys(this.attrs).forEach(function(c){n.setAttribute(c,this.attrs[c])},this),s==="fontawesome"&&this.contentFA&&(i=this.contentFA),n.innerHTML=i,n},handleClick:function(n){n.preventDefault(),n.stopPropagation();var i=this.getAction();i&&this.execAction(i)},isActive:function(){return this.button.classList.contains(this.getEditorOption("activeButtonClass"))},setInactive:function(){this.button.classList.remove(this.getEditorOption("activeButtonClass")),delete this.knownState},setActive:function(){this.button.classList.add(this.getEditorOption("activeButtonClass")),delete this.knownState},queryCommandState:function(){var n=null;return this.useQueryState&&(n=this.base.queryCommandState(this.getAction())),n},isAlreadyApplied:function(n){var i=!1,o=this.getTagNames(),s,c;return this.knownState===!1||this.knownState===!0?this.knownState:(o&&o.length>0&&(i=o.indexOf(n.nodeName.toLowerCase())!==-1),!i&&this.style&&(s=this.style.value.split("|"),c=this.window.getComputedStyle(n,null).getPropertyValue(this.style.prop),s.forEach(function(a){this.knownState||(i=c.indexOf(a)!==-1,(i||this.style.prop!=="text-decoration")&&(this.knownState=i))},this)),i)}});t.isBuiltInButton=function(n){return typeof n=="string"&&e.extensions.button.prototype.defaults.hasOwnProperty(n)},e.extensions.button=t})(),(function(){e.extensions.button.prototype.defaults={bold:{name:"bold",action:"bold",aria:"bold",tagNames:["b","strong"],style:{prop:"font-weight",value:"700|bold"},useQueryState:!0,contentDefault:"<b>B</b>",contentFA:'<i class="fa fa-bold"></i>'},italic:{name:"italic",action:"italic",aria:"italic",tagNames:["i","em"],style:{prop:"font-style",value:"italic"},useQueryState:!0,contentDefault:"<b><i>I</i></b>",contentFA:'<i class="fa fa-italic"></i>'},underline:{name:"underline",action:"underline",aria:"underline",tagNames:["u"],style:{prop:"text-decoration",value:"underline"},useQueryState:!0,contentDefault:"<b><u>U</u></b>",contentFA:'<i class="fa fa-underline"></i>'},strikethrough:{name:"strikethrough",action:"strikethrough",aria:"strike through",tagNames:["strike"],style:{prop:"text-decoration",value:"line-through"},useQueryState:!0,contentDefault:"<s>A</s>",contentFA:'<i class="fa fa-strikethrough"></i>'},superscript:{name:"superscript",action:"superscript",aria:"superscript",tagNames:["sup"],contentDefault:"<b>x<sup>1</sup></b>",contentFA:'<i class="fa fa-superscript"></i>'},subscript:{name:"subscript",action:"subscript",aria:"subscript",tagNames:["sub"],contentDefault:"<b>x<sub>1</sub></b>",contentFA:'<i class="fa fa-subscript"></i>'},image:{name:"image",action:"image",aria:"image",tagNames:["img"],contentDefault:"<b>image</b>",contentFA:'<i class="fa fa-picture-o"></i>'},html:{name:"html",action:"html",aria:"evaluate html",tagNames:["iframe","object"],contentDefault:"<b>html</b>",contentFA:'<i class="fa fa-code"></i>'},orderedlist:{name:"orderedlist",action:"insertorderedlist",aria:"ordered list",tagNames:["ol"],useQueryState:!0,contentDefault:"<b>1.</b>",contentFA:'<i class="fa fa-list-ol"></i>'},unorderedlist:{name:"unorderedlist",action:"insertunorderedlist",aria:"unordered list",tagNames:["ul"],useQueryState:!0,contentDefault:"<b>•</b>",contentFA:'<i class="fa fa-list-ul"></i>'},indent:{name:"indent",action:"indent",aria:"indent",tagNames:[],contentDefault:"<b>→</b>",contentFA:'<i class="fa fa-indent"></i>'},outdent:{name:"outdent",action:"outdent",aria:"outdent",tagNames:[],contentDefault:"<b>←</b>",contentFA:'<i class="fa fa-outdent"></i>'},justifyCenter:{name:"justifyCenter",action:"justifyCenter",aria:"center justify",tagNames:[],style:{prop:"text-align",value:"center"},contentDefault:"<b>C</b>",contentFA:'<i class="fa fa-align-center"></i>'},justifyFull:{name:"justifyFull",action:"justifyFull",aria:"full justify",tagNames:[],style:{prop:"text-align",value:"justify"},contentDefault:"<b>J</b>",contentFA:'<i class="fa fa-align-justify"></i>'},justifyLeft:{name:"justifyLeft",action:"justifyLeft",aria:"left justify",tagNames:[],style:{prop:"text-align",value:"left"},contentDefault:"<b>L</b>",contentFA:'<i class="fa fa-align-left"></i>'},justifyRight:{name:"justifyRight",action:"justifyRight",aria:"right justify",tagNames:[],style:{prop:"text-align",value:"right"},contentDefault:"<b>R</b>",contentFA:'<i class="fa fa-align-right"></i>'},removeFormat:{name:"removeFormat",aria:"remove formatting",action:"removeFormat",contentDefault:"<b>X</b>",contentFA:'<i class="fa fa-eraser"></i>'},quote:{name:"quote",action:"append-blockquote",aria:"blockquote",tagNames:["blockquote"],contentDefault:"<b>“</b>",contentFA:'<i class="fa fa-quote-right"></i>'},pre:{name:"pre",action:"append-pre",aria:"preformatted text",tagNames:["pre"],contentDefault:"<b>0101</b>",contentFA:'<i class="fa fa-code fa-lg"></i>'},h1:{name:"h1",action:"append-h1",aria:"header type one",tagNames:["h1"],contentDefault:"<b>H1</b>",contentFA:'<i class="fa fa-header"><sup>1</sup>'},h2:{name:"h2",action:"append-h2",aria:"header type two",tagNames:["h2"],contentDefault:"<b>H2</b>",contentFA:'<i class="fa fa-header"><sup>2</sup>'},h3:{name:"h3",action:"append-h3",aria:"header type three",tagNames:["h3"],contentDefault:"<b>H3</b>",contentFA:'<i class="fa fa-header"><sup>3</sup>'},h4:{name:"h4",action:"append-h4",aria:"header type four",tagNames:["h4"],contentDefault:"<b>H4</b>",contentFA:'<i class="fa fa-header"><sup>4</sup>'},h5:{name:"h5",action:"append-h5",aria:"header type five",tagNames:["h5"],contentDefault:"<b>H5</b>",contentFA:'<i class="fa fa-header"><sup>5</sup>'},h6:{name:"h6",action:"append-h6",aria:"header type six",tagNames:["h6"],contentDefault:"<b>H6</b>",contentFA:'<i class="fa fa-header"><sup>6</sup>'}}})(),(function(){var t=e.extensions.button.extend({init:function(){e.extensions.button.prototype.init.apply(this,arguments)},formSaveLabel:"✓",formCloseLabel:"×",activeClass:"medium-editor-toolbar-form-active",hasForm:!0,getForm:function(){},isDisplayed:function(){return this.hasForm?this.getForm().classList.contains(this.activeClass):!1},showForm:function(){this.hasForm&&this.getForm().classList.add(this.activeClass)},hideForm:function(){this.hasForm&&this.getForm().classList.remove(this.activeClass)},showToolbarDefaultActions:function(){var n=this.base.getExtensionByName("toolbar");n&&n.showToolbarDefaultActions()},hideToolbarDefaultActions:function(){var n=this.base.getExtensionByName("toolbar");n&&n.hideToolbarDefaultActions()},setToolbarPosition:function(){var n=this.base.getExtensionByName("toolbar");n&&n.setToolbarPosition()}});e.extensions.form=t})(),(function(){var t=e.extensions.form.extend({customClassOption:null,customClassOptionText:"Button",linkValidation:!1,placeholderText:"Paste or type a link",targetCheckbox:!1,targetCheckboxText:"Open in new window",name:"anchor",action:"createLink",aria:"link",tagNames:["a"],contentDefault:"<b>#</b>",contentFA:'<i class="fa fa-link"></i>',init:function(){e.extensions.form.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this))},handleClick:function(n){n.preventDefault(),n.stopPropagation();var i=e.selection.getSelectionRange(this.document);return i.startContainer.nodeName.toLowerCase()==="a"||i.endContainer.nodeName.toLowerCase()==="a"||e.util.getClosestTag(e.selection.getSelectedParentElement(i),"a")?this.execAction("unlink"):(this.isDisplayed()||this.showForm(),!1)},handleKeydown:function(n){e.util.isKey(n,e.util.keyCode.K)&&e.util.isMetaCtrlKey(n)&&!n.shiftKey&&this.handleClick(n)},getForm:function(){return this.form||(this.form=this.createForm()),this.form},getTemplate:function(){var n=['<input type="text" class="medium-editor-toolbar-input" placeholder="',this.placeholderText,'">'];return n.push('<a href="#" class="medium-editor-toolbar-save">',this.getEditorOption("buttonLabels")==="fontawesome"?'<i class="fa fa-check"></i>':this.formSaveLabel,"</a>"),n.push('<a href="#" class="medium-editor-toolbar-close">',this.getEditorOption("buttonLabels")==="fontawesome"?'<i class="fa fa-times"></i>':this.formCloseLabel,"</a>"),this.targetCheckbox&&n.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-target" id="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">','<label for="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">',this.targetCheckboxText,"</label>","</div>"),this.customClassOption&&n.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-button">',"<label>",this.customClassOptionText,"</label>","</div>"),n.join("")},isDisplayed:function(){return e.extensions.form.prototype.isDisplayed.apply(this)},hideForm:function(){e.extensions.form.prototype.hideForm.apply(this),this.getInput().value=""},showForm:function(n){var i=this.getInput(),o=this.getAnchorTargetCheckbox(),s=this.getAnchorButtonCheckbox();if(n=n||{value:""},typeof n=="string"&&(n={value:n}),this.base.saveSelection(),this.hideToolbarDefaultActions(),e.extensions.form.prototype.showForm.apply(this),this.setToolbarPosition(),i.value=n.value,i.focus(),o&&(o.checked=n.target==="_blank"),s){var c=n.buttonClass?n.buttonClass.split(" "):[];s.checked=c.indexOf(this.customClassOption)!==-1}},destroy:function(){if(!this.form)return!1;this.form.parentNode&&this.form.parentNode.removeChild(this.form),delete this.form},getFormOpts:function(){var n=this.getAnchorTargetCheckbox(),i=this.getAnchorButtonCheckbox(),o={value:this.getInput().value.trim()};return this.linkValidation&&(o.value=this.checkLinkFormat(o.value)),o.target="_self",n&&n.checked&&(o.target="_blank"),i&&i.checked&&(o.buttonClass=this.customClassOption),o},doFormSave:function(){var n=this.getFormOpts();this.completeFormSave(n)},completeFormSave:function(n){this.base.restoreSelection(),this.execAction(this.action,n),this.base.checkSelection()},ensureEncodedUri:function(n){return n===decodeURI(n)?encodeURI(n):n},ensureEncodedUriComponent:function(n){return n===decodeURIComponent(n)?encodeURIComponent(n):n},ensureEncodedParam:function(n){var i=n.split("="),o=i[0],s=i[1];return o+(s===void 0?"":"="+this.ensureEncodedUriComponent(s))},ensureEncodedQuery:function(n){return n.split("&").map(this.ensureEncodedParam.bind(this)).join("&")},checkLinkFormat:function(n){var i=/^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#/i,o=i.test(n),s="",c=/^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/,a=n.match(/^(.*?)(?:\?(.*?))?(?:#(.*))?$/),l=a[1],d=a[2],u=a[3];if(c.test(n))return"tel:"+n;if(!o){var h=l.split("/")[0];(h.match(/.+(\.|:).+/)||h==="localhost")&&(s="http://")}return s+this.ensureEncodedUri(l)+(d===void 0?"":"?"+this.ensureEncodedQuery(d))+(u===void 0?"":"#"+u)},doFormCancel:function(){this.base.restoreSelection(),this.base.checkSelection()},attachFormEvents:function(n){var i=n.querySelector(".medium-editor-toolbar-close"),o=n.querySelector(".medium-editor-toolbar-save"),s=n.querySelector(".medium-editor-toolbar-input");this.on(n,"click",this.handleFormClick.bind(this)),this.on(s,"keyup",this.handleTextboxKeyup.bind(this)),this.on(i,"click",this.handleCloseClick.bind(this)),this.on(o,"click",this.handleSaveClick.bind(this),!0)},createForm:function(){var n=this.document,i=n.createElement("div");return i.className="medium-editor-toolbar-form",i.id="medium-editor-toolbar-form-anchor-"+this.getEditorId(),i.innerHTML=this.getTemplate(),this.attachFormEvents(i),i},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},getAnchorTargetCheckbox:function(){return this.getForm().querySelector(".medium-editor-toolbar-anchor-target")},getAnchorButtonCheckbox:function(){return this.getForm().querySelector(".medium-editor-toolbar-anchor-button")},handleTextboxKeyup:function(n){if(n.keyCode===e.util.keyCode.ENTER){n.preventDefault(),this.doFormSave();return}n.keyCode===e.util.keyCode.ESCAPE&&(n.preventDefault(),this.doFormCancel())},handleFormClick:function(n){n.stopPropagation()},handleSaveClick:function(n){n.preventDefault(),this.doFormSave()},handleCloseClick:function(n){n.preventDefault(),this.doFormCancel()}});e.extensions.anchor=t})(),(function(){var t=e.Extension.extend({name:"anchor-preview",hideDelay:500,previewValueSelector:"a",showWhenToolbarIsVisible:!1,showOnEmptyLinks:!0,init:function(){this.anchorPreview=this.createPreview(),this.getEditorOption("elementsContainer").appendChild(this.anchorPreview),this.attachToEditables()},getInteractionElements:function(){return this.getPreviewElement()},getPreviewElement:function(){return this.anchorPreview},createPreview:function(){var n=this.document.createElement("div");return n.id="medium-editor-anchor-preview-"+this.getEditorId(),n.className="medium-editor-anchor-preview",n.innerHTML=this.getTemplate(),this.on(n,"click",this.handleClick.bind(this)),n},getTemplate:function(){return'<div class="medium-editor-toolbar-anchor-preview" id="medium-editor-toolbar-anchor-preview"> <a class="medium-editor-toolbar-anchor-preview-inner"></a></div>'},destroy:function(){this.anchorPreview&&(this.anchorPreview.parentNode&&this.anchorPreview.parentNode.removeChild(this.anchorPreview),delete this.anchorPreview)},hidePreview:function(){this.anchorPreview&&this.anchorPreview.classList.remove("medium-editor-anchor-preview-active"),this.activeAnchor=null},showPreview:function(n){return this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")||n.getAttribute("data-disable-preview")?!0:(this.previewValueSelector&&(this.anchorPreview.querySelector(this.previewValueSelector).textContent=n.attributes.href.value,this.anchorPreview.querySelector(this.previewValueSelector).href=n.attributes.href.value),this.anchorPreview.classList.add("medium-toolbar-arrow-over"),this.anchorPreview.classList.remove("medium-toolbar-arrow-under"),this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")||this.anchorPreview.classList.add("medium-editor-anchor-preview-active"),this.activeAnchor=n,this.positionPreview(),this.attachPreviewHandlers(),this)},positionPreview:function(n){n=n||this.activeAnchor;var i=this.window.innerWidth,o=this.anchorPreview.offsetHeight,s=n.getBoundingClientRect(),c=this.diffLeft,a=this.diffTop,l=this.getEditorOption("elementsContainer"),d=["absolute","fixed"].indexOf(window.getComputedStyle(l).getPropertyValue("position"))>-1,u={},h,p,v,y,b;h=this.anchorPreview.offsetWidth/2;var k=this.base.getExtensionByName("toolbar");k&&(c=k.diffLeft,a=k.diffTop),p=c-h,d?(y=l.getBoundingClientRect(),["top","left"].forEach(function(B){u[B]=s[B]-y[B]}),u.width=s.width,u.height=s.height,s=u,i=y.width,b=l.scrollTop):b=this.window.pageYOffset,v=s.left+s.width/2,b+=o+s.top+s.height-a-this.anchorPreview.offsetHeight,this.anchorPreview.style.top=Math.round(b)+"px",this.anchorPreview.style.right="initial",v<h?(this.anchorPreview.style.left=p+h+"px",this.anchorPreview.style.right="initial"):i-v<h?(this.anchorPreview.style.left="auto",this.anchorPreview.style.right=0):(this.anchorPreview.style.left=p+v+"px",this.anchorPreview.style.right="initial")},attachToEditables:function(){this.subscribe("editableMouseover",this.handleEditableMouseover.bind(this)),this.subscribe("positionedToolbar",this.handlePositionedToolbar.bind(this))},handlePositionedToolbar:function(){this.showWhenToolbarIsVisible||this.hidePreview()},handleClick:function(n){var i=this.base.getExtensionByName("anchor"),o=this.activeAnchor;i&&o&&(n.preventDefault(),this.base.selectElement(this.activeAnchor),this.base.delay(function(){if(o){var s={value:o.attributes.href.value,target:o.getAttribute("target"),buttonClass:o.getAttribute("class")};i.showForm(s),o=null}}.bind(this))),this.hidePreview()},handleAnchorMouseout:function(){this.anchorToPreview=null,this.off(this.activeAnchor,"mouseout",this.instanceHandleAnchorMouseout),this.instanceHandleAnchorMouseout=null},handleEditableMouseover:function(n){var i=e.util.getClosestTag(n.target,"a");if(i!==!1){if(!this.showOnEmptyLinks&&(!/href=["']\S+["']/.test(i.outerHTML)||/href=["']#\S+["']/.test(i.outerHTML)))return!0;var o=this.base.getExtensionByName("toolbar");if(!this.showWhenToolbarIsVisible&&o&&o.isDisplayed&&o.isDisplayed())return!0;this.activeAnchor&&this.activeAnchor!==i&&this.detachPreviewHandlers(),this.anchorToPreview=i,this.instanceHandleAnchorMouseout=this.handleAnchorMouseout.bind(this),this.on(this.anchorToPreview,"mouseout",this.instanceHandleAnchorMouseout),this.base.delay(function(){this.anchorToPreview&&this.showPreview(this.anchorToPreview)}.bind(this))}},handlePreviewMouseover:function(){this.lastOver=new Date().getTime(),this.hovering=!0},handlePreviewMouseout:function(n){(!n.relatedTarget||!/anchor-preview/.test(n.relatedTarget.className))&&(this.hovering=!1)},updatePreview:function(){if(this.hovering)return!0;var n=new Date().getTime()-this.lastOver;n>this.hideDelay&&this.detachPreviewHandlers()},detachPreviewHandlers:function(){clearInterval(this.intervalTimer),this.instanceHandlePreviewMouseover&&(this.off(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.activeAnchor&&(this.off(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout))),this.hidePreview(),this.hovering=this.instanceHandlePreviewMouseover=this.instanceHandlePreviewMouseout=null},attachPreviewHandlers:function(){this.lastOver=new Date().getTime(),this.hovering=!0,this.instanceHandlePreviewMouseover=this.handlePreviewMouseover.bind(this),this.instanceHandlePreviewMouseout=this.handlePreviewMouseout.bind(this),this.intervalTimer=setInterval(this.updatePreview.bind(this),200),this.on(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.on(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout)}});e.extensions.anchorPreview=t})(),(function(){var t,n,i,o,s;t=[" "," ",`
|
||
`,"\r"," "," "," "," "," ","\u2028","\u2029"],n="com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw",i="(((?:(https?://|ftps?://|nntp://)|www\\d{0,3}[.]|[a-z0-9.\\-]+[.]("+n+")\\/)\\S+(?:[^\\s`!\\[\\]{};:'\".,?«»“”‘’])))|(([a-z0-9\\-]+\\.)?[a-z0-9\\-]+\\.("+n+"))",o=new RegExp("^("+n+")$","i"),s=new RegExp(i,"gi");function c(l){return!e.util.getClosestTag(l,"a")}var a=e.Extension.extend({init:function(){e.Extension.prototype.init.apply(this,arguments),this.disableEventHandling=!1,this.subscribe("editableKeypress",this.onKeypress.bind(this)),this.subscribe("editableBlur",this.onBlur.bind(this)),this.document.execCommand("AutoUrlDetect",!1,!1)},isLastInstance:function(){for(var l=0,d=0;d<this.window._mediumEditors.length;d++){var u=this.window._mediumEditors[d];u!==null&&u.getExtensionByName("autoLink")!==void 0&&l++}return l===1},destroy:function(){this.document.queryCommandSupported("AutoUrlDetect")&&this.isLastInstance()&&this.document.execCommand("AutoUrlDetect",!1,!0)},onBlur:function(l,d){this.performLinking(d)},onKeypress:function(l){this.disableEventHandling||e.util.isKey(l,[e.util.keyCode.SPACE,e.util.keyCode.ENTER])&&(clearTimeout(this.performLinkingTimeout),this.performLinkingTimeout=setTimeout(function(){try{var d=this.base.exportSelection();this.performLinking(l.target)&&this.base.importSelection(d,!0)}catch(u){window.console&&window.console.error("Failed to perform linking",u),this.disableEventHandling=!0}}.bind(this),0))},performLinking:function(l){var d=e.util.splitByBlockElements(l),u=!1;d.length===0&&(d=[l]);for(var h=0;h<d.length;h++)u=this.removeObsoleteAutoLinkSpans(d[h])||u,u=this.performLinkingWithinElement(d[h])||u;return this.base.events.updateInput(l,{target:l,currentTarget:l}),u},removeObsoleteAutoLinkSpans:function(l){if(!l||l.nodeType===3)return!1;for(var d=l.querySelectorAll('span[data-auto-link="true"]'),u=!1,h=0;h<d.length;h++){var p=d[h].textContent;if(p.indexOf("://")===-1&&(p=e.util.ensureUrlHasProtocol(p)),d[h].getAttribute("data-href")!==p&&c(d[h])){u=!0;var v=p.replace(/\s+$/,"");if(d[h].getAttribute("data-href")===v){var y=p.length-v.length,b=e.util.splitOffDOMTree(d[h],this.splitTextBeforeEnd(d[h],y));d[h].parentNode.insertBefore(b,d[h].nextSibling)}else e.util.unwrap(d[h],this.document)}}return u},splitTextBeforeEnd:function(l,d){for(var u=this.document.createTreeWalker(l,NodeFilter.SHOW_TEXT,null,!1),h=!0;h;)h=u.lastChild()!==null;for(var p,v,y;d>0&&y!==null;)p=u.currentNode,v=p.nodeValue,v.length>d?(y=p.splitText(v.length-d),d=0):(y=u.previousNode(),d-=v.length);return y},performLinkingWithinElement:function(l){for(var d=this.findLinkableText(l),u=!1,h=0;h<d.length;h++){var p=e.util.findOrCreateMatchingTextNodes(this.document,l,d[h]);this.shouldNotLink(p)||this.createAutoLink(p,d[h].href)}return u},shouldNotLink:function(l){for(var d=!1,u=0;u<l.length&&d===!1;u++)d=!!e.util.traverseUp(l[u],function(h){return h.nodeName.toLowerCase()==="a"||h.getAttribute&&h.getAttribute("data-auto-link")==="true"});return d},findLinkableText:function(l){for(var d=l.textContent,u=null,h=[];(u=s.exec(d))!==null;){var p=!0,v=u.index+u[0].length;p=(u.index===0||t.indexOf(d[u.index-1])!==-1)&&(v===d.length||t.indexOf(d[v])!==-1),p=p&&(u[0].indexOf("/")!==-1||o.test(u[0].split(".").pop().split("?").shift())),p&&h.push({href:u[0],start:u.index,end:v})}return h},createAutoLink:function(l,d){d=e.util.ensureUrlHasProtocol(d);var u=e.util.createLink(this.document,l,d,this.getEditorOption("targetBlank")?"_blank":null),h=this.document.createElement("span");for(h.setAttribute("data-auto-link","true"),h.setAttribute("data-href",d),u.insertBefore(h,u.firstChild);u.childNodes.length>1;)h.appendChild(u.childNodes[1])}});e.extensions.autoLink=a})(),(function(){var t="medium-editor-dragover";function n(o){var s=e.util.getContainerEditorElement(o),c=Array.prototype.slice.call(s.parentElement.querySelectorAll("."+t));c.forEach(function(a){a.classList.remove(t)})}var i=e.Extension.extend({name:"fileDragging",allowedTypes:["image"],init:function(){e.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(o){o.preventDefault(),o.dataTransfer.dropEffect="copy";var s=o.target.classList?o.target:o.target.parentElement;n(s),o.type==="dragover"&&s.classList.add(t)},handleDrop:function(o){o.preventDefault(),o.stopPropagation(),this.base.selectElement(o.target);var s=this.base.exportSelection();s.start=s.end,this.base.importSelection(s),o.dataTransfer.files&&Array.prototype.slice.call(o.dataTransfer.files).forEach(function(c){this.isAllowedFile(c)&&c.type.match("image")&&this.insertImageFile(c)},this),n(o.target)},isAllowedFile:function(o){return this.allowedTypes.some(function(s){return!!o.type.match(s)})},insertImageFile:function(o){if(typeof FileReader=="function"){var s=new FileReader;s.readAsDataURL(o),s.addEventListener("load",function(c){var a=this.document.createElement("img");a.src=c.target.result,e.util.insertHTMLCommand(this.document,a.outerHTML)}.bind(this))}}});e.extensions.fileDragging=i})(),(function(){var t=e.Extension.extend({name:"keyboard-commands",commands:[{command:"bold",key:"B",meta:!0,shift:!1,alt:!1},{command:"italic",key:"I",meta:!0,shift:!1,alt:!1},{command:"underline",key:"U",meta:!0,shift:!1,alt:!1}],init:function(){e.Extension.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.keys={},this.commands.forEach(function(n){var i=n.key.charCodeAt(0);this.keys[i]||(this.keys[i]=[]),this.keys[i].push(n)},this)},handleKeydown:function(n){var i=e.util.getKeyCode(n);if(this.keys[i]){var o=e.util.isMetaCtrlKey(n),s=!!n.shiftKey,c=!!n.altKey;this.keys[i].forEach(function(a){a.meta===o&&a.shift===s&&(a.alt===c||a.alt===void 0)&&(n.preventDefault(),n.stopPropagation(),typeof a.command=="function"?a.command.apply(this):a.command!==!1&&this.execAction(a.command))},this)}}});e.extensions.keyboardCommands=t})(),(function(){var t=e.extensions.form.extend({name:"fontname",action:"fontName",aria:"change font name",contentDefault:"±",contentFA:'<i class="fa fa-font"></i>',fonts:["","Arial","Verdana","Times New Roman"],init:function(){e.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(n){if(n.preventDefault(),n.stopPropagation(),!this.isDisplayed()){var i=this.document.queryCommandValue("fontName")+"";this.showForm(i)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return this.getForm().style.display==="block"},hideForm:function(){this.getForm().style.display="none",this.getSelect().value=""},showForm:function(n){var i=this.getSelect();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),i.value=n||"",i.focus()},destroy:function(){if(!this.form)return!1;this.form.parentNode&&this.form.parentNode.removeChild(this.form),delete this.form},doFormSave:function(){this.base.restoreSelection(),this.base.checkSelection()},doFormCancel:function(){this.base.restoreSelection(),this.clearFontName(),this.base.checkSelection()},createForm:function(){var n=this.document,i=n.createElement("div"),o=n.createElement("select"),s=n.createElement("a"),c=n.createElement("a"),a;i.className="medium-editor-toolbar-form",i.id="medium-editor-toolbar-form-fontname-"+this.getEditorId(),this.on(i,"click",this.handleFormClick.bind(this));for(var l=0;l<this.fonts.length;l++)a=n.createElement("option"),a.innerHTML=this.fonts[l],a.value=this.fonts[l],o.appendChild(a);return o.className="medium-editor-toolbar-select",i.appendChild(o),this.on(o,"change",this.handleFontChange.bind(this)),c.setAttribute("href","#"),c.className="medium-editor-toobar-save",c.innerHTML=this.getEditorOption("buttonLabels")==="fontawesome"?'<i class="fa fa-check"></i>':"✓",i.appendChild(c),this.on(c,"click",this.handleSaveClick.bind(this),!0),s.setAttribute("href","#"),s.className="medium-editor-toobar-close",s.innerHTML=this.getEditorOption("buttonLabels")==="fontawesome"?'<i class="fa fa-times"></i>':"×",i.appendChild(s),this.on(s,"click",this.handleCloseClick.bind(this)),i},getSelect:function(){return this.getForm().querySelector("select.medium-editor-toolbar-select")},clearFontName:function(){e.selection.getSelectedElements(this.document).forEach(function(n){n.nodeName.toLowerCase()==="font"&&n.hasAttribute("face")&&n.removeAttribute("face")})},handleFontChange:function(){var n=this.getSelect().value;n===""?this.clearFontName():this.execAction("fontName",{value:n})},handleFormClick:function(n){n.stopPropagation()},handleSaveClick:function(n){n.preventDefault(),this.doFormSave()},handleCloseClick:function(n){n.preventDefault(),this.doFormCancel()}});e.extensions.fontName=t})(),(function(){var t=e.extensions.form.extend({name:"fontsize",action:"fontSize",aria:"increase/decrease font size",contentDefault:"±",contentFA:'<i class="fa fa-text-height"></i>',init:function(){e.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(n){if(n.preventDefault(),n.stopPropagation(),!this.isDisplayed()){var i=this.document.queryCommandValue("fontSize")+"";this.showForm(i)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return this.getForm().style.display==="block"},hideForm:function(){this.getForm().style.display="none",this.getInput().value=""},showForm:function(n){var i=this.getInput();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),i.value=n||"",i.focus()},destroy:function(){if(!this.form)return!1;this.form.parentNode&&this.form.parentNode.removeChild(this.form),delete this.form},doFormSave:function(){this.base.restoreSelection(),this.base.checkSelection()},doFormCancel:function(){this.base.restoreSelection(),this.clearFontSize(),this.base.checkSelection()},createForm:function(){var n=this.document,i=n.createElement("div"),o=n.createElement("input"),s=n.createElement("a"),c=n.createElement("a");return i.className="medium-editor-toolbar-form",i.id="medium-editor-toolbar-form-fontsize-"+this.getEditorId(),this.on(i,"click",this.handleFormClick.bind(this)),o.setAttribute("type","range"),o.setAttribute("min","1"),o.setAttribute("max","7"),o.className="medium-editor-toolbar-input",i.appendChild(o),this.on(o,"change",this.handleSliderChange.bind(this)),c.setAttribute("href","#"),c.className="medium-editor-toobar-save",c.innerHTML=this.getEditorOption("buttonLabels")==="fontawesome"?'<i class="fa fa-check"></i>':"✓",i.appendChild(c),this.on(c,"click",this.handleSaveClick.bind(this),!0),s.setAttribute("href","#"),s.className="medium-editor-toobar-close",s.innerHTML=this.getEditorOption("buttonLabels")==="fontawesome"?'<i class="fa fa-times"></i>':"×",i.appendChild(s),this.on(s,"click",this.handleCloseClick.bind(this)),i},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},clearFontSize:function(){e.selection.getSelectedElements(this.document).forEach(function(n){n.nodeName.toLowerCase()==="font"&&n.hasAttribute("size")&&n.removeAttribute("size")})},handleSliderChange:function(){var n=this.getInput().value;n==="4"?this.clearFontSize():this.execAction("fontSize",{value:n})},handleFormClick:function(n){n.stopPropagation()},handleSaveClick:function(n){n.preventDefault(),this.doFormSave()},handleCloseClick:function(n){n.preventDefault(),this.doFormCancel()}});e.extensions.fontSize=t})(),(function(){var t="%ME_PASTEBIN%",n=null,i=null,o=function(l){l.stopPropagation()};function s(){return[[new RegExp(/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g),""],[new RegExp(/<!--StartFragment-->|<!--EndFragment-->/g),""],[new RegExp(/<br>$/i),""],[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi),""],[new RegExp(/<\/b>(<br[^>]*>)?$/gi),""],[new RegExp(/<span class="Apple-converted-space">\s+<\/span>/g)," "],[new RegExp(/<br class="Apple-interchange-newline">/g),"<br>"],[new RegExp(/<span[^>]*(font-style:italic;font-weight:(bold|700)|font-weight:(bold|700);font-style:italic)[^>]*>/gi),'<span class="replace-with italic bold">'],[new RegExp(/<span[^>]*font-style:italic[^>]*>/gi),'<span class="replace-with italic">'],[new RegExp(/<span[^>]*font-weight:(bold|700)[^>]*>/gi),'<span class="replace-with bold">'],[new RegExp(/<(\/?)(i|b|a)>/gi),"<$1$2>"],[new RegExp(/<a(?:(?!href).)+href=(?:"|”|“|"|“|”)(((?!"|”|“|"|“|”).)*)(?:"|”|“|"|“|”)(?:(?!>).)*>/gi),'<a href="$1">'],[new RegExp(/<\/p>\n+/gi),"</p>"],[new RegExp(/\n+<p/gi),"<p"],[new RegExp(/<\/?o:[a-z]*>/gi),""],[new RegExp(/<!\[if !supportLists\]>(((?!<!).)*)<!\[endif]\>/gi),"$1"]]}function c(l,d,u){var h=l.clipboardData||d.clipboardData||u.dataTransfer,p={};if(!h)return p;if(h.getData){var v=h.getData("Text");v&&v.length>0&&(p["text/plain"]=v)}if(h.types)for(var y=0;y<h.types.length;y++){var b=h.types[y];p[b]=h.getData(b)}return p}var a=e.Extension.extend({forcePlainText:!0,cleanPastedHTML:!1,preCleanReplacements:[],cleanReplacements:[],cleanAttrs:["class","style","dir"],cleanTags:["meta"],unwrapTags:[],init:function(){e.Extension.prototype.init.apply(this,arguments),(this.forcePlainText||this.cleanPastedHTML)&&(this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.getEditorElements().forEach(function(l){this.on(l,"paste",this.handlePaste.bind(this))},this),this.subscribe("addElement",this.handleAddElement.bind(this)))},handleAddElement:function(l,d){this.on(d,"paste",this.handlePaste.bind(this))},destroy:function(){(this.forcePlainText||this.cleanPastedHTML)&&this.removePasteBin()},handlePaste:function(l,d){if(!l.defaultPrevented){var u=c(l,this.window,this.document),h=u["text/html"],p=u["text/plain"];this.window.clipboardData&&l.clipboardData===void 0&&!h&&(h=p),(h||p)&&(l.preventDefault(),this.doPaste(h,p,d))}},doPaste:function(l,d,u){var h,p="",v;if(this.cleanPastedHTML&&l)return this.cleanPaste(l);if(d){if(this.getEditorOption("disableReturn")||u&&u.getAttribute("data-disable-return"))p=e.util.htmlEntities(d);else if(h=d.split(/[\r\n]+/g),h.length>1)for(v=0;v<h.length;v+=1)h[v]!==""&&(p+="<p>"+e.util.htmlEntities(h[v])+"</p>");else p=e.util.htmlEntities(h[0]);e.util.insertHTMLCommand(this.document,p)}},handlePasteBinPaste:function(l){if(l.defaultPrevented){this.removePasteBin();return}var d=c(l,this.window,this.document),u=d["text/html"],h=d["text/plain"],p=i;if(!this.cleanPastedHTML||u){l.preventDefault(),this.removePasteBin(),this.doPaste(u,h,p),this.trigger("editablePaste",{currentTarget:p,target:p},p);return}setTimeout(function(){this.cleanPastedHTML&&(u=this.getPasteBinHtml()),this.removePasteBin(),this.doPaste(u,h,p),this.trigger("editablePaste",{currentTarget:p,target:p},p)}.bind(this),0)},handleKeydown:function(l,d){e.util.isKey(l,e.util.keyCode.V)&&e.util.isMetaCtrlKey(l)&&(l.stopImmediatePropagation(),this.removePasteBin(),this.createPasteBin(d))},createPasteBin:function(l){var d,u=e.selection.getSelectionRange(this.document),h=this.window.pageYOffset;i=l,u&&(d=u.getClientRects(),d.length?h+=d[0].top:u.startContainer.getBoundingClientRect!==void 0?h+=u.startContainer.getBoundingClientRect().top:h+=u.getBoundingClientRect().top),n=u;var p=this.document.createElement("div");p.id=this.pasteBinId="medium-editor-pastebin-"+ +Date.now(),p.setAttribute("style","border: 1px red solid; position: absolute; top: "+h+"px; width: 10px; height: 10px; overflow: hidden; opacity: 0"),p.setAttribute("contentEditable",!0),p.innerHTML=t,this.document.body.appendChild(p),this.on(p,"focus",o),this.on(p,"focusin",o),this.on(p,"focusout",o),p.focus(),e.selection.selectNode(p,this.document),this.boundHandlePaste||(this.boundHandlePaste=this.handlePasteBinPaste.bind(this)),this.on(p,"paste",this.boundHandlePaste)},removePasteBin:function(){n!==null&&(e.selection.selectRange(this.document,n),n=null),i!==null&&(i=null);var l=this.getPasteBin();l&&l&&(this.off(l,"focus",o),this.off(l,"focusin",o),this.off(l,"focusout",o),this.off(l,"paste",this.boundHandlePaste),l.parentElement.removeChild(l))},getPasteBin:function(){return this.document.getElementById(this.pasteBinId)},getPasteBinHtml:function(){var l=this.getPasteBin();if(!l||l.firstChild&&l.firstChild.id==="mcepastebin")return!1;var d=l.innerHTML;return!d||d===t?!1:d},cleanPaste:function(l){var d,u,h,p,v=/<p|<br|<div/.test(l),y=[].concat(this.preCleanReplacements||[],s(),this.cleanReplacements||[]);for(d=0;d<y.length;d+=1)l=l.replace(y[d][0],y[d][1]);if(!v)return this.pasteHTML(l);for(h=this.document.createElement("div"),h.innerHTML="<p>"+l.split("<br><br>").join("</p><p>")+"</p>",u=h.querySelectorAll("a,p,div,br"),d=0;d<u.length;d+=1)switch(p=u[d],p.innerHTML=p.innerHTML.replace(/\n/gi," "),p.nodeName.toLowerCase()){case"p":case"div":this.filterCommonBlocks(p);break;case"br":this.filterLineBreak(p);break}this.pasteHTML(h.innerHTML)},pasteHTML:function(l,d){d=e.util.defaults({},d,{cleanAttrs:this.cleanAttrs,cleanTags:this.cleanTags,unwrapTags:this.unwrapTags});var u,h,p,v,y=this.document.createDocumentFragment();for(y.appendChild(this.document.createElement("body")),v=y.querySelector("body"),v.innerHTML=l,this.cleanupSpans(v),u=v.querySelectorAll("*"),p=0;p<u.length;p+=1)h=u[p],h.nodeName.toLowerCase()==="a"&&this.getEditorOption("targetBlank")&&e.util.setTargetBlank(h),e.util.cleanupAttrs(h,d.cleanAttrs),e.util.cleanupTags(h,d.cleanTags),e.util.unwrapTags(h,d.unwrapTags);e.util.insertHTMLCommand(this.document,v.innerHTML.replace(/ /g," "))},isCommonBlock:function(l){return l&&(l.nodeName.toLowerCase()==="p"||l.nodeName.toLowerCase()==="div")},filterCommonBlocks:function(l){/^\s*$/.test(l.textContent)&&l.parentNode&&l.parentNode.removeChild(l)},filterLineBreak:function(l){this.isCommonBlock(l.previousElementSibling)?this.removeWithParent(l):this.isCommonBlock(l.parentNode)&&(l.parentNode.firstChild===l||l.parentNode.lastChild===l)?this.removeWithParent(l):l.parentNode&&l.parentNode.childElementCount===1&&l.parentNode.textContent===""&&this.removeWithParent(l)},removeWithParent:function(l){l&&l.parentNode&&(l.parentNode.parentNode&&l.parentNode.childElementCount===1?l.parentNode.parentNode.removeChild(l.parentNode):l.parentNode.removeChild(l))},cleanupSpans:function(l){var d,u,h,p=l.querySelectorAll(".replace-with"),v=function(y){return y&&y.nodeName!=="#text"&&y.getAttribute("contenteditable")==="false"};for(d=0;d<p.length;d+=1)u=p[d],h=this.document.createElement(u.classList.contains("bold")?"b":"i"),u.classList.contains("bold")&&u.classList.contains("italic")?h.innerHTML="<i>"+u.innerHTML+"</i>":h.innerHTML=u.innerHTML,u.parentNode.replaceChild(h,u);for(p=l.querySelectorAll("span"),d=0;d<p.length;d+=1){if(u=p[d],e.util.traverseUp(u,v))return!1;e.util.unwrap(u,this.document)}}});e.extensions.paste=a})(),(function(){var t=e.Extension.extend({name:"placeholder",text:"Type your text",hideOnClick:!0,init:function(){e.Extension.prototype.init.apply(this,arguments),this.initPlaceholders(),this.attachEventHandlers()},initPlaceholders:function(){this.getEditorElements().forEach(this.initElement,this)},handleAddElement:function(n,i){this.initElement(i)},initElement:function(n){n.getAttribute("data-placeholder")||n.setAttribute("data-placeholder",this.text),this.updatePlaceholder(n)},destroy:function(){this.getEditorElements().forEach(this.cleanupElement,this)},handleRemoveElement:function(n,i){this.cleanupElement(i)},cleanupElement:function(n){n.getAttribute("data-placeholder")===this.text&&n.removeAttribute("data-placeholder")},showPlaceholder:function(n){n&&(e.util.isFF&&n.childNodes.length===0?(n.classList.add("medium-editor-placeholder-relative"),n.classList.remove("medium-editor-placeholder")):(n.classList.add("medium-editor-placeholder"),n.classList.remove("medium-editor-placeholder-relative")))},hidePlaceholder:function(n){n&&(n.classList.remove("medium-editor-placeholder"),n.classList.remove("medium-editor-placeholder-relative"))},updatePlaceholder:function(n,i){if(n.querySelector("img, blockquote, ul, ol, table")||n.textContent.replace(/^\s+|\s+$/g,"")!=="")return this.hidePlaceholder(n);i||this.showPlaceholder(n)},attachEventHandlers:function(){this.hideOnClick&&this.subscribe("focus",this.handleFocus.bind(this)),this.subscribe("editableInput",this.handleInput.bind(this)),this.subscribe("blur",this.handleBlur.bind(this)),this.subscribe("addElement",this.handleAddElement.bind(this)),this.subscribe("removeElement",this.handleRemoveElement.bind(this))},handleInput:function(n,i){var o=this.hideOnClick&&i===this.base.getFocusedElement();this.updatePlaceholder(i,o)},handleFocus:function(n,i){this.hidePlaceholder(i)},handleBlur:function(n,i){this.updatePlaceholder(i)}});e.extensions.placeholder=t})(),(function(){var t=e.Extension.extend({name:"toolbar",align:"center",allowMultiParagraphSelection:!0,buttons:["bold","italic","underline","anchor","h2","h3","quote"],diffLeft:0,diffTop:-10,firstButtonClass:"medium-editor-button-first",lastButtonClass:"medium-editor-button-last",standardizeSelectionStart:!1,static:!1,sticky:!1,stickyTopOffset:0,updateOnEmptySelection:!1,relativeContainer:null,init:function(){e.Extension.prototype.init.apply(this,arguments),this.initThrottledMethods(),this.relativeContainer?this.relativeContainer.appendChild(this.getToolbarElement()):this.getEditorOption("elementsContainer").appendChild(this.getToolbarElement())},forEachExtension:function(n,i){return this.base.extensions.forEach(function(o){if(o!==this)return n.apply(i||this,arguments)},this)},createToolbar:function(){var n=this.document.createElement("div");return n.id="medium-editor-toolbar-"+this.getEditorId(),n.className="medium-editor-toolbar",this.static?n.className+=" static-toolbar":this.relativeContainer?n.className+=" medium-editor-relative-toolbar":n.className+=" medium-editor-stalker-toolbar",n.appendChild(this.createToolbarButtons()),this.forEachExtension(function(i){i.hasForm&&n.appendChild(i.getForm())}),this.attachEventHandlers(),n},createToolbarButtons:function(){var n=this.document.createElement("ul"),i,o,s,c,a,l;return n.id="medium-editor-toolbar-actions"+this.getEditorId(),n.className="medium-editor-toolbar-actions",n.style.display="block",this.buttons.forEach(function(d){typeof d=="string"?(a=d,l=null):(a=d.name,l=d),c=this.base.addBuiltInExtension(a,l),c&&typeof c.getButton=="function"&&(o=c.getButton(this.base),i=this.document.createElement("li"),e.util.isElement(o)?i.appendChild(o):i.innerHTML=o,n.appendChild(i))},this),s=n.querySelectorAll("button"),s.length>0&&(s[0].classList.add(this.firstButtonClass),s[s.length-1].classList.add(this.lastButtonClass)),n},destroy:function(){this.toolbar&&(this.toolbar.parentNode&&this.toolbar.parentNode.removeChild(this.toolbar),delete this.toolbar)},getInteractionElements:function(){return this.getToolbarElement()},getToolbarElement:function(){return this.toolbar||(this.toolbar=this.createToolbar()),this.toolbar},getToolbarActionsElement:function(){return this.getToolbarElement().querySelector(".medium-editor-toolbar-actions")},initThrottledMethods:function(){this.throttledPositionToolbar=e.util.throttle(function(){this.base.isActive&&this.positionToolbarIfShown()}.bind(this))},attachEventHandlers:function(){this.subscribe("blur",this.handleBlur.bind(this)),this.subscribe("focus",this.handleFocus.bind(this)),this.subscribe("editableClick",this.handleEditableClick.bind(this)),this.subscribe("editableKeyup",this.handleEditableKeyup.bind(this)),this.on(this.document.documentElement,"mouseup",this.handleDocumentMouseup.bind(this)),this.static&&this.sticky&&this.on(this.window,"scroll",this.handleWindowScroll.bind(this),!0),this.on(this.window,"resize",this.handleWindowResize.bind(this))},handleWindowScroll:function(){this.positionToolbarIfShown()},handleWindowResize:function(){this.throttledPositionToolbar()},handleDocumentMouseup:function(n){if(n&&n.target&&e.util.isDescendant(this.getToolbarElement(),n.target))return!1;this.checkState()},handleEditableClick:function(){setTimeout(function(){this.checkState()}.bind(this),0)},handleEditableKeyup:function(){this.checkState()},handleBlur:function(){clearTimeout(this.hideTimeout),clearTimeout(this.delayShowTimeout),this.hideTimeout=setTimeout(function(){this.hideToolbar()}.bind(this),1)},handleFocus:function(){this.checkState()},isDisplayed:function(){return this.getToolbarElement().classList.contains("medium-editor-toolbar-active")},showToolbar:function(){clearTimeout(this.hideTimeout),this.isDisplayed()||(this.getToolbarElement().classList.add("medium-editor-toolbar-active"),this.trigger("showToolbar",{},this.base.getFocusedElement()))},hideToolbar:function(){this.isDisplayed()&&(this.getToolbarElement().classList.remove("medium-editor-toolbar-active"),this.trigger("hideToolbar",{},this.base.getFocusedElement()))},isToolbarDefaultActionsDisplayed:function(){return this.getToolbarActionsElement().style.display==="block"},hideToolbarDefaultActions:function(){this.isToolbarDefaultActionsDisplayed()&&(this.getToolbarActionsElement().style.display="none")},showToolbarDefaultActions:function(){this.hideExtensionForms(),this.isToolbarDefaultActionsDisplayed()||(this.getToolbarActionsElement().style.display="block"),this.delayShowTimeout=this.base.delay(function(){this.showToolbar()}.bind(this))},hideExtensionForms:function(){this.forEachExtension(function(n){n.hasForm&&n.isDisplayed()&&n.hideForm()})},multipleBlockElementsSelected:function(){var n=/<[^\/>][^>]*><\/[^>]+>/gim,i=new RegExp("<("+e.util.blockContainerElementNames.join("|")+")[^>]*>","g"),o=e.selection.getSelectionHtml(this.document).replace(n,""),s=o.match(i);return!!s&&s.length>1},modifySelection:function(){var n=this.window.getSelection(),i=n.getRangeAt(0);if(this.standardizeSelectionStart&&i.startContainer.nodeValue&&i.startOffset===i.startContainer.nodeValue.length){var o=e.util.findAdjacentTextNodeWithContent(e.selection.getSelectionElement(this.window),i.startContainer,this.document);if(o){for(var s=0;o.nodeValue.substr(s,1).trim().length===0;)s=s+1;i=e.selection.select(this.document,o,s,i.endContainer,i.endOffset)}}},checkState:function(){if(!this.base.preventSelectionUpdates){if(!this.base.getFocusedElement()||e.selection.selectionInContentEditableFalse(this.window))return this.hideToolbar();var n=e.selection.getSelectionElement(this.window);if(!n||this.getEditorElements().indexOf(n)===-1||n.getAttribute("data-disable-toolbar"))return this.hideToolbar();if(this.updateOnEmptySelection&&this.static)return this.showAndUpdateToolbar();if(!e.selection.selectionContainsContent(this.document)||this.allowMultiParagraphSelection===!1&&this.multipleBlockElementsSelected())return this.hideToolbar();this.showAndUpdateToolbar()}},showAndUpdateToolbar:function(){this.modifySelection(),this.setToolbarButtonStates(),this.trigger("positionToolbar",{},this.base.getFocusedElement()),this.showToolbarDefaultActions(),this.setToolbarPosition()},setToolbarButtonStates:function(){this.forEachExtension(function(n){typeof n.isActive=="function"&&typeof n.setInactive=="function"&&n.setInactive()}),this.checkActiveButtons()},checkActiveButtons:function(){var n=[],i=null,o=e.selection.getSelectionRange(this.document),s,c=function(a){typeof a.checkState=="function"?a.checkState(s):typeof a.isActive=="function"&&typeof a.isAlreadyApplied=="function"&&typeof a.setActive=="function"&&!a.isActive()&&a.isAlreadyApplied(s)&&a.setActive()};if(o&&(this.forEachExtension(function(a){if(typeof a.queryCommandState=="function"&&(i=a.queryCommandState(),i!==null)){i&&typeof a.setActive=="function"&&a.setActive();return}n.push(a)}),s=e.selection.getSelectedParentElement(o),!!this.getEditorElements().some(function(a){return e.util.isDescendant(a,s,!0)})))for(;s&&(n.forEach(c),!e.util.isMediumEditorElement(s));)s=s.parentNode},positionToolbarIfShown:function(){this.isDisplayed()&&this.setToolbarPosition()},setToolbarPosition:function(){var n=this.base.getFocusedElement(),i=this.window.getSelection();if(!n)return this;(this.static||!i.isCollapsed)&&(this.showToolbar(),this.relativeContainer||(this.static?this.positionStaticToolbar(n):this.positionToolbar(i)),this.trigger("positionedToolbar",{},this.base.getFocusedElement()))},positionStaticToolbar:function(n){this.getToolbarElement().style.left="0";var i=this.document.documentElement&&this.document.documentElement.scrollTop||this.document.body.scrollTop,o=this.window.innerWidth,s=this.getToolbarElement(),c=n.getBoundingClientRect(),a=c.top+i,l=c.left+c.width/2,d=s.offsetHeight,u=s.offsetWidth,h=u/2,p;switch(this.sticky?i>a+n.offsetHeight-d-this.stickyTopOffset?(s.style.top=a+n.offsetHeight-d+"px",s.classList.remove("medium-editor-sticky-toolbar")):i>a-d-this.stickyTopOffset?(s.classList.add("medium-editor-sticky-toolbar"),s.style.top=this.stickyTopOffset+"px"):(s.classList.remove("medium-editor-sticky-toolbar"),s.style.top=a-d+"px"):s.style.top=a-d+"px",this.align){case"left":p=c.left;break;case"right":p=c.right-u;break;case"center":p=l-h;break}p<0?p=0:p+u>o&&(p=o-Math.ceil(u)-1),s.style.left=p+"px"},positionToolbar:function(n){this.getToolbarElement().style.left="0",this.getToolbarElement().style.right="initial";var i=n.getRangeAt(0),o=i.getBoundingClientRect();(!o||o.height===0&&o.width===0&&i.startContainer===i.endContainer)&&(i.startContainer.nodeType===1&&i.startContainer.querySelector("img")?o=i.startContainer.querySelector("img").getBoundingClientRect():o=i.startContainer.getBoundingClientRect());var s=this.window.innerWidth,c=this.getToolbarElement(),a=c.offsetHeight,l=c.offsetWidth,d=l/2,u=50,h=this.diffLeft-d,p=this.getEditorOption("elementsContainer"),v=["absolute","fixed"].indexOf(window.getComputedStyle(p).getPropertyValue("position"))>-1,y={},b={},k,B;v?(B=p.getBoundingClientRect(),["top","left"].forEach(function(W){b[W]=o[W]-B[W]}),b.width=o.width,b.height=o.height,o=b,s=B.width,y.top=p.scrollTop):y.top=this.window.pageYOffset,k=o.left+o.width/2,y.top+=o.top-a,o.top<u?(c.classList.add("medium-toolbar-arrow-over"),c.classList.remove("medium-toolbar-arrow-under"),y.top+=u+o.height-this.diffTop):(c.classList.add("medium-toolbar-arrow-under"),c.classList.remove("medium-toolbar-arrow-over"),y.top+=this.diffTop),k<d?(y.left=h+d,y.right="initial"):s-k<d?(y.left="auto",y.right=0):(y.left=h+k,y.right="initial"),["top","left","right"].forEach(function(W){c.style[W]=y[W]+(isNaN(y[W])?"":"px")})}});e.extensions.toolbar=t})(),(function(){var t=e.Extension.extend({init:function(){e.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(n){var i="medium-editor-dragover";n.preventDefault(),n.dataTransfer.dropEffect="copy",n.type==="dragover"?n.target.classList.add(i):n.type==="dragleave"&&n.target.classList.remove(i)},handleDrop:function(n){var i="medium-editor-dragover",o;n.preventDefault(),n.stopPropagation(),n.dataTransfer.files&&(o=Array.prototype.slice.call(n.dataTransfer.files,0),o.some(function(s){if(s.type.match("image")){var c,a;c=new FileReader,c.readAsDataURL(s),a="medium-img-"+ +new Date,e.util.insertHTMLCommand(this.document,'<img class="medium-editor-image-loading" id="'+a+'" />'),c.onload=function(){var l=this.document.getElementById(a);l&&(l.removeAttribute("id"),l.removeAttribute("class"),l.src=c.result)}.bind(this)}}.bind(this))),n.target.classList.remove(i)}});e.extensions.imageDragging=t})(),(function(){function t(w){var O=e.selection.getSelectionStart(this.options.ownerDocument),A=O.textContent,U=e.selection.getCaretOffsets(O);(A[U.left-1]===void 0||A[U.left-1].trim()===""||A[U.left]!==void 0&&A[U.left].trim()==="")&&w.preventDefault()}function n(w,O){if(this.options.disableReturn||O.getAttribute("data-disable-return"))w.preventDefault();else if(this.options.disableDoubleReturn||O.getAttribute("data-disable-double-return")){var A=e.selection.getSelectionStart(this.options.ownerDocument);(A&&A.textContent.trim()===""&&A.nodeName.toLowerCase()!=="li"||A.previousElementSibling&&A.previousElementSibling.nodeName.toLowerCase()!=="br"&&A.previousElementSibling.textContent.trim()==="")&&w.preventDefault()}}function i(w){var O=e.selection.getSelectionStart(this.options.ownerDocument),A=O&&O.nodeName.toLowerCase();A==="pre"&&(w.preventDefault(),e.util.insertHTMLCommand(this.options.ownerDocument," ")),e.util.isListItem(O)&&(w.preventDefault(),w.shiftKey?this.options.ownerDocument.execCommand("outdent",!1,null):this.options.ownerDocument.execCommand("indent",!1,null))}function o(w){var O,A=e.selection.getSelectionStart(this.options.ownerDocument),U=A.nodeName.toLowerCase(),pe=/^(\s+|<br\/?>)?$/i,me=/h\d/i;e.util.isKey(w,[e.util.keyCode.BACKSPACE,e.util.keyCode.ENTER])&&A.previousElementSibling&&me.test(U)&&e.selection.getCaretOffsets(A).left===0?e.util.isKey(w,e.util.keyCode.BACKSPACE)&&pe.test(A.previousElementSibling.innerHTML)?(A.previousElementSibling.parentNode.removeChild(A.previousElementSibling),w.preventDefault()):!this.options.disableDoubleReturn&&e.util.isKey(w,e.util.keyCode.ENTER)&&(O=this.options.ownerDocument.createElement("p"),O.innerHTML="<br>",A.previousElementSibling.parentNode.insertBefore(O,A),w.preventDefault()):e.util.isKey(w,e.util.keyCode.DELETE)&&A.nextElementSibling&&A.previousElementSibling&&!me.test(U)&&pe.test(A.innerHTML)&&me.test(A.nextElementSibling.nodeName.toLowerCase())?(e.selection.moveCursor(this.options.ownerDocument,A.nextElementSibling),A.previousElementSibling.parentNode.removeChild(A),w.preventDefault()):e.util.isKey(w,e.util.keyCode.BACKSPACE)&&U==="li"&&pe.test(A.innerHTML)&&!A.previousElementSibling&&!A.parentElement.previousElementSibling&&A.nextElementSibling&&A.nextElementSibling.nodeName.toLowerCase()==="li"?(O=this.options.ownerDocument.createElement("p"),O.innerHTML="<br>",A.parentElement.parentElement.insertBefore(O,A.parentElement),e.selection.moveCursor(this.options.ownerDocument,O),A.parentElement.removeChild(A),w.preventDefault()):e.util.isKey(w,e.util.keyCode.BACKSPACE)&&e.util.getClosestTag(A,"blockquote")!==!1&&e.selection.getCaretOffsets(A).left===0?(w.preventDefault(),e.util.execFormatBlock(this.options.ownerDocument,"p")):e.util.isKey(w,e.util.keyCode.ENTER)&&e.util.getClosestTag(A,"blockquote")!==!1&&e.selection.getCaretOffsets(A).right===0?(O=this.options.ownerDocument.createElement("p"),O.innerHTML="<br>",A.parentElement.insertBefore(O,A.nextSibling),e.selection.moveCursor(this.options.ownerDocument,O),w.preventDefault()):e.util.isKey(w,e.util.keyCode.BACKSPACE)&&e.util.isMediumEditorElement(A.parentElement)&&!A.previousElementSibling&&A.nextElementSibling&&pe.test(A.innerHTML)&&(w.preventDefault(),e.selection.moveCursor(this.options.ownerDocument,A.nextSibling),A.parentElement.removeChild(A))}function s(w){var O=e.selection.getSelectionStart(this.options.ownerDocument),A;O&&(e.util.isMediumEditorElement(O)&&O.children.length===0&&!e.util.isBlockContainer(O)&&this.options.ownerDocument.execCommand("formatBlock",!1,"p"),e.util.isKey(w,e.util.keyCode.ENTER)&&!e.util.isListItem(O)&&!e.util.isBlockContainer(O)&&(A=O.nodeName.toLowerCase(),A==="a"?this.options.ownerDocument.execCommand("unlink",!1,null):!w.shiftKey&&!w.ctrlKey&&this.options.ownerDocument.execCommand("formatBlock",!1,"p")))}function c(w,O){var A=O.parentNode.querySelector('textarea[medium-editor-textarea-id="'+O.getAttribute("medium-editor-textarea-id")+'"]');A&&(A.value=O.innerHTML.trim())}function a(w){w._mediumEditors||(w._mediumEditors=[null]),this.id||(this.id=w._mediumEditors.length),w._mediumEditors[this.id]=this}function l(w){!w._mediumEditors||!w._mediumEditors[this.id]||(w._mediumEditors[this.id]=null)}function d(w,O,A){var U=[];if(w||(w=[]),typeof w=="string"&&(w=O.querySelectorAll(w)),e.util.isElement(w)&&(w=[w]),A)for(var pe=0;pe<w.length;pe++){var me=w[pe];e.util.isElement(me)&&!me.getAttribute("data-medium-editor-element")&&!me.getAttribute("medium-editor-textarea-id")&&U.push(me)}else U=Array.prototype.slice.apply(w);return U}function u(w){var O=w.parentNode.querySelector('textarea[medium-editor-textarea-id="'+w.getAttribute("medium-editor-textarea-id")+'"]');O&&(O.classList.remove("medium-editor-hidden"),O.removeAttribute("medium-editor-textarea-id")),w.parentNode&&w.parentNode.removeChild(w)}function h(w,O){return Object.keys(O).forEach(function(A){w[A]===void 0&&(w[A]=O[A])}),w}function p(w,O,A){var U={window:A.options.contentWindow,document:A.options.ownerDocument,base:A};return w=h(w,U),typeof w.init=="function"&&w.init(),w.name||(w.name=O),w}function v(){return this.elements.every(function(w){return!!w.getAttribute("data-disable-toolbar")})?!1:this.options.toolbar!==!1}function y(){return v.call(this)?this.options.anchorPreview!==!1:!1}function b(){return this.options.placeholder!==!1}function k(){return this.options.autoLink!==!1}function B(){return this.options.imageDragging!==!1}function W(){return this.options.keyboardCommands!==!1}function K(){return!this.options.extensions.imageDragging}function le(w){for(var O=this.options.ownerDocument.createElement("div"),A=Date.now(),U="medium-editor-"+A,pe=w.attributes;this.options.ownerDocument.getElementById(U);)A++,U="medium-editor-"+A;O.className=w.className,O.id=U,O.innerHTML=w.value,w.setAttribute("medium-editor-textarea-id",U);for(var me=0,Fe=pe.length;me<Fe;me++)O.hasAttribute(pe[me].nodeName)||O.setAttribute(pe[me].nodeName,pe[me].value);return w.form&&this.on(w.form,"reset",function(Ie){Ie.defaultPrevented||this.resetContent(this.options.ownerDocument.getElementById(U))}.bind(this)),w.classList.add("medium-editor-hidden"),w.parentNode.insertBefore(O,w),O}function G(w,O){if(!w.getAttribute("data-medium-editor-element")){w.nodeName.toLowerCase()==="textarea"&&(w=le.call(this,w),this.instanceHandleEditableInput||(this.instanceHandleEditableInput=c.bind(this),this.subscribe("editableInput",this.instanceHandleEditableInput))),!this.options.disableEditing&&!w.getAttribute("data-disable-editing")&&(w.setAttribute("contentEditable",!0),w.setAttribute("spellcheck",this.options.spellcheck)),this.instanceHandleEditableKeydownEnter||(w.getAttribute("data-disable-return")||w.getAttribute("data-disable-double-return"))&&(this.instanceHandleEditableKeydownEnter=n.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter)),!this.options.disableReturn&&!w.getAttribute("data-disable-return")&&this.on(w,"keyup",s.bind(this));var A=e.util.guid();w.setAttribute("data-medium-editor-element",!0),w.classList.add("medium-editor-element"),w.setAttribute("role","textbox"),w.setAttribute("aria-multiline",!0),w.setAttribute("data-medium-editor-editor-index",O),w.setAttribute("medium-editor-index",A),tt[A]=w.innerHTML,this.events.attachAllEventsToElement(w)}return w}function L(){this.subscribe("editableKeydownTab",i.bind(this)),this.subscribe("editableKeydownDelete",o.bind(this)),this.subscribe("editableKeydownEnter",o.bind(this)),this.options.disableExtraSpaces&&this.subscribe("editableKeydownSpace",t.bind(this)),this.instanceHandleEditableKeydownEnter||(this.options.disableReturn||this.options.disableDoubleReturn)&&(this.instanceHandleEditableKeydownEnter=n.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter))}function ue(){if(this.extensions=[],Object.keys(this.options.extensions).forEach(function(pe){pe!=="toolbar"&&this.options.extensions[pe]&&this.extensions.push(p(this.options.extensions[pe],pe,this))},this),K.call(this)){var w=this.options.fileDragging;w||(w={},B.call(this)||(w.allowedTypes=[])),this.addBuiltInExtension("fileDragging",w)}var O={paste:!0,"anchor-preview":y.call(this),autoLink:k.call(this),keyboardCommands:W.call(this),placeholder:b.call(this)};Object.keys(O).forEach(function(pe){O[pe]&&this.addBuiltInExtension(pe)},this);var A=this.options.extensions.toolbar;if(!A&&v.call(this)){var U=e.util.extend({},this.options.toolbar,{allowMultiParagraphSelection:this.options.allowMultiParagraphSelection});A=new e.extensions.toolbar(U)}A&&this.extensions.push(p(A,"toolbar",this))}function Q(w,O){var A=[["allowMultiParagraphSelection","toolbar.allowMultiParagraphSelection"]];return O&&A.forEach(function(U){O.hasOwnProperty(U[0])&&O[U[0]]!==void 0&&e.util.deprecated(U[0],U[1],"v6.0.0")}),e.util.defaults({},O,w)}function je(w,O){var A=/^append-(.+)$/gi,U=/justify([A-Za-z]*)$/g,pe,me;if(pe=A.exec(w),pe)return e.util.execFormatBlock(this.options.ownerDocument,pe[1]);if(w==="fontSize")return O.size&&e.util.deprecated(".size option for fontSize command",".value","6.0.0"),me=O.value||O.size,this.options.ownerDocument.execCommand("fontSize",!1,me);if(w==="fontName")return O.name&&e.util.deprecated(".name option for fontName command",".value","6.0.0"),me=O.value||O.name,this.options.ownerDocument.execCommand("fontName",!1,me);if(w==="createLink")return this.createLink(O);if(w==="image"){var Fe=this.options.contentWindow.getSelection().toString().trim();return this.options.ownerDocument.execCommand("insertImage",!1,Fe)}if(w==="html"){var Ie=this.options.contentWindow.getSelection().toString().trim();return e.util.insertHTMLCommand(this.options.ownerDocument,Ie)}if(U.exec(w)){var ut=this.options.ownerDocument.execCommand(w,!1,null),ft=e.selection.getSelectedParentElement(e.selection.getSelectionRange(this.options.ownerDocument));return ft&&Le.call(this,e.util.getTopBlockContainer(ft)),ut}return me=O&&O.value,this.options.ownerDocument.execCommand(w,!1,me)}function Le(w){if(w){var O,A=Array.prototype.slice.call(w.childNodes).filter(function(U){var pe=U.nodeName.toLowerCase()==="div";return pe&&!O&&(O=U.style.textAlign),pe});A.length&&(this.saveSelection(),A.forEach(function(U){if(U.style.textAlign===O){var pe=U.lastChild;if(pe){e.util.unwrap(U,this.options.ownerDocument);var me=this.options.ownerDocument.createElement("BR");pe.parentNode.insertBefore(me,pe.nextSibling)}}},this),w.style.textAlign=O,this.restoreSelection())}}var tt={};e.prototype={init:function(w,O){return this.options=Q.call(this,this.defaults,O),this.origElements=w,this.options.elementsContainer||(this.options.elementsContainer=this.options.ownerDocument.body),this.setup()},setup:function(){this.isActive||(a.call(this,this.options.contentWindow),this.events=new e.Events(this),this.elements=[],this.addElements(this.origElements),this.elements.length!==0&&(this.isActive=!0,ue.call(this),L.call(this)))},destroy:function(){this.isActive&&(this.isActive=!1,this.extensions.forEach(function(w){typeof w.destroy=="function"&&w.destroy()},this),this.events.destroy(),this.elements.forEach(function(w){this.options.spellcheck&&(w.innerHTML=w.innerHTML),w.removeAttribute("contentEditable"),w.removeAttribute("spellcheck"),w.removeAttribute("data-medium-editor-element"),w.classList.remove("medium-editor-element"),w.removeAttribute("role"),w.removeAttribute("aria-multiline"),w.removeAttribute("medium-editor-index"),w.removeAttribute("data-medium-editor-editor-index"),w.getAttribute("medium-editor-textarea-id")&&u(w)},this),this.elements=[],this.instanceHandleEditableKeydownEnter=null,this.instanceHandleEditableInput=null,l.call(this,this.options.contentWindow))},on:function(w,O,A,U){return this.events.attachDOMEvent(w,O,A,U),this},off:function(w,O,A,U){return this.events.detachDOMEvent(w,O,A,U),this},subscribe:function(w,O){return this.events.attachCustomEvent(w,O),this},unsubscribe:function(w,O){return this.events.detachCustomEvent(w,O),this},trigger:function(w,O,A){return this.events.triggerCustomEvent(w,O,A),this},delay:function(w){var O=this;return setTimeout(function(){O.isActive&&w()},this.options.delay)},serialize:function(){var w,O,A={},U=this.elements.length;for(w=0;w<U;w+=1)O=this.elements[w].id!==""?this.elements[w].id:"element-"+w,A[O]={value:this.elements[w].innerHTML.trim()};return A},getExtensionByName:function(w){var O;return this.extensions&&this.extensions.length&&this.extensions.some(function(A){return A.name===w?(O=A,!0):!1}),O},addBuiltInExtension:function(w,O){var A=this.getExtensionByName(w),U;if(A)return A;switch(w){case"anchor":U=e.util.extend({},this.options.anchor,O),A=new e.extensions.anchor(U);break;case"anchor-preview":A=new e.extensions.anchorPreview(this.options.anchorPreview);break;case"autoLink":A=new e.extensions.autoLink;break;case"fileDragging":A=new e.extensions.fileDragging(O);break;case"fontname":A=new e.extensions.fontName(this.options.fontName);break;case"fontsize":A=new e.extensions.fontSize(O);break;case"keyboardCommands":A=new e.extensions.keyboardCommands(this.options.keyboardCommands);break;case"paste":A=new e.extensions.paste(this.options.paste);break;case"placeholder":A=new e.extensions.placeholder(this.options.placeholder);break;default:e.extensions.button.isBuiltInButton(w)&&(O?(U=e.util.defaults({},O,e.extensions.button.prototype.defaults[w]),A=new e.extensions.button(U)):A=new e.extensions.button(w))}return A&&this.extensions.push(p(A,w,this)),A},stopSelectionUpdates:function(){this.preventSelectionUpdates=!0},startSelectionUpdates:function(){this.preventSelectionUpdates=!1},checkSelection:function(){var w=this.getExtensionByName("toolbar");return w&&w.checkState(),this},queryCommandState:function(w){var O=/^full-(.+)$/gi,A,U=null;A=O.exec(w),A&&(w=A[1]);try{U=this.options.ownerDocument.queryCommandState(w)}catch(pe){U=null}return U},execAction:function(w,O){var A=/^full-(.+)$/gi,U,pe;return U=A.exec(w),U?(this.saveSelection(),this.selectAllContents(),pe=je.call(this,U[1],O),this.restoreSelection()):pe=je.call(this,w,O),(w==="insertunorderedlist"||w==="insertorderedlist")&&e.util.cleanListDOM(this.options.ownerDocument,this.getSelectedParentElement()),this.checkSelection(),pe},getSelectedParentElement:function(w){return w===void 0&&(w=this.options.contentWindow.getSelection().getRangeAt(0)),e.selection.getSelectedParentElement(w)},selectAllContents:function(){var w=e.selection.getSelectionElement(this.options.contentWindow);if(w){for(;w.children.length===1;)w=w.children[0];this.selectElement(w)}},selectElement:function(w){e.selection.selectNode(w,this.options.ownerDocument);var O=e.selection.getSelectionElement(this.options.contentWindow);O&&this.events.focusElement(O)},getFocusedElement:function(){var w;return this.elements.some(function(O){return!w&&O.getAttribute("data-medium-focused")&&(w=O),!!w},this),w},exportSelection:function(){var w=e.selection.getSelectionElement(this.options.contentWindow),O=this.elements.indexOf(w),A=null;return O>=0&&(A=e.selection.exportSelection(w,this.options.ownerDocument)),A!==null&&O!==0&&(A.editableElementIndex=O),A},saveSelection:function(){this.selectionState=this.exportSelection()},importSelection:function(w,O){if(w){var A=this.elements[w.editableElementIndex||0];e.selection.importSelection(w,A,this.options.ownerDocument,O)}},restoreSelection:function(){this.importSelection(this.selectionState)},createLink:function(w){var O=e.selection.getSelectionElement(this.options.contentWindow),A={},U;if(this.elements.indexOf(O)!==-1){try{if(this.events.disableCustomEvent("editableInput"),w.url&&e.util.deprecated(".url option for createLink",".value","6.0.0"),U=w.url||w.value,U&&U.trim().length>0){var pe=this.options.contentWindow.getSelection();if(pe){var me=pe.getRangeAt(0),Fe=me.commonAncestorContainer,Ie,ut,ft,yt;if(me.endContainer.nodeType===3&&me.startContainer.nodeType!==3&&me.startOffset===0&&me.startContainer.firstChild===me.endContainer&&(Fe=me.endContainer),ut=e.util.getClosestBlockContainer(me.startContainer),ft=e.util.getClosestBlockContainer(me.endContainer),Fe.nodeType!==3&&Fe.textContent.length!==0&&ut===ft){var Ke=ut||O,nt=this.options.ownerDocument.createDocumentFragment();this.execAction("unlink"),Ie=this.exportSelection(),nt.appendChild(Ke.cloneNode(!0)),O===Ke?e.selection.select(this.options.ownerDocument,Ke.firstChild,0,Ke.lastChild,Ke.lastChild.nodeType===3?Ke.lastChild.nodeValue.length:Ke.lastChild.childNodes.length):e.selection.select(this.options.ownerDocument,Ke,0,Ke,Ke.childNodes.length);var T=this.exportSelection();yt=e.util.findOrCreateMatchingTextNodes(this.options.ownerDocument,nt,{start:Ie.start-T.start,end:Ie.end-T.start,editableElementIndex:Ie.editableElementIndex}),yt.length===0&&(nt=this.options.ownerDocument.createDocumentFragment(),nt.appendChild(Fe.cloneNode(!0)),yt=[nt.firstChild.firstChild,nt.firstChild.lastChild]),e.util.createLink(this.options.ownerDocument,yt,U.trim());var H=(nt.firstChild.innerHTML.match(/^\s+/)||[""])[0].length;e.util.insertHTMLCommand(this.options.ownerDocument,nt.firstChild.innerHTML.replace(/^\s+/,"")),Ie.start-=H,Ie.end-=H,this.importSelection(Ie)}else this.options.ownerDocument.execCommand("createLink",!1,U);this.options.targetBlank||w.target==="_blank"?e.util.setTargetBlank(e.selection.getSelectionStart(this.options.ownerDocument),U):e.util.removeTargetBlank(e.selection.getSelectionStart(this.options.ownerDocument),U),w.buttonClass&&e.util.addClassToAnchors(e.selection.getSelectionStart(this.options.ownerDocument),w.buttonClass)}}if(this.options.targetBlank||w.target==="_blank"||w.buttonClass){A=this.options.ownerDocument.createEvent("HTMLEvents"),A.initEvent("input",!0,!0,this.options.contentWindow);for(var I=0,V=this.elements.length;I<V;I+=1)this.elements[I].dispatchEvent(A)}}finally{this.events.enableCustomEvent("editableInput")}this.events.triggerCustomEvent("editableInput",A,O)}},cleanPaste:function(w){this.getExtensionByName("paste").cleanPaste(w)},pasteHTML:function(w,O){this.getExtensionByName("paste").pasteHTML(w,O)},setContent:function(w,O){if(O=O||0,this.elements[O]){var A=this.elements[O];A.innerHTML=w,this.checkContentChanged(A)}},getContent:function(w){return w=w||0,this.elements[w]?this.elements[w].innerHTML.trim():null},checkContentChanged:function(w){w=w||e.selection.getSelectionElement(this.options.contentWindow),this.events.updateInput(w,{target:w,currentTarget:w})},resetContent:function(w){if(w){var O=this.elements.indexOf(w);O!==-1&&this.setContent(tt[w.getAttribute("medium-editor-index")],O);return}this.elements.forEach(function(A,U){this.setContent(tt[A.getAttribute("medium-editor-index")],U)},this)},addElements:function(w){var O=d(w,this.options.ownerDocument,!0);if(O.length===0)return!1;O.forEach(function(A){A=G.call(this,A,this.id),this.elements.push(A),this.trigger("addElement",{target:A,currentTarget:A},A)},this)},removeElements:function(w){var O=d(w,this.options.ownerDocument),A=O.map(function(U){return U.getAttribute("medium-editor-textarea-id")&&U.parentNode?U.parentNode.querySelector('div[medium-editor-textarea-id="'+U.getAttribute("medium-editor-textarea-id")+'"]'):U});this.elements=this.elements.filter(function(U){return A.indexOf(U)!==-1?(this.events.cleanupElement(U),U.getAttribute("medium-editor-textarea-id")&&u(U),this.trigger("removeElement",{target:U,currentTarget:U},U),!1):!0},this)}},e.getEditorFromElement=function(w){var O=w.getAttribute("data-medium-editor-editor-index"),A=w&&w.ownerDocument&&(w.ownerDocument.defaultView||w.ownerDocument.parentWindow);return A&&A._mediumEditors&&A._mediumEditors[O]?A._mediumEditors[O]:null}})(),(function(){e.prototype.defaults={activeButtonClass:"medium-editor-button-active",buttonLabels:!1,delay:0,disableReturn:!1,disableDoubleReturn:!1,disableExtraSpaces:!1,disableEditing:!1,autoLink:!1,elementsContainer:!1,contentWindow:window,ownerDocument:document,targetBlank:!1,extensions:{},spellcheck:!0}})(),e.parseVersionString=function(t){var n=t.split("-"),i=n[0].split("."),o=n.length>1?n[1]:"";return{major:parseInt(i[0],10),minor:parseInt(i[1],10),revision:parseInt(i[2],10),preRelease:o,toString:function(){return[i[0],i[1],i[2]].join(".")+(o?"-"+o:"")}}},e.version=e.parseVersionString.call(this,"5.23.3"),e})())})(Xn)),Xn.exports}var Wa=za();const on=go(Wa);/*!
|
||
* vanilla-picker v2.12.3
|
||
* https://vanilla-picker.js.org
|
||
*
|
||
* Copyright 2017-2024 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
|
||
* Released under the ISC license.
|
||
*/var oi=function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")},ri=(function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}})(),rn=(function(){function r(e,t){var n=[],i=!0,o=!1,s=void 0;try{for(var c=e[Symbol.iterator](),a;!(i=(a=c.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,s=l}finally{try{!i&&c.return&&c.return()}finally{if(o)throw s}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})();String.prototype.startsWith=String.prototype.startsWith||function(r){return this.indexOf(r)===0};String.prototype.padStart=String.prototype.padStart||function(r,e){for(var t=this;t.length<r;)t=e+t;return t};var Ga={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function Ui(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=e>0?r.toFixed(e).replace(/0+$/,"").replace(/\.$/,""):r.toString();return t||"0"}var Ua=(function(){function r(e,t,n,i){oi(this,r);var o=this;function s(a){if(a.startsWith("hsl")){var l=a.match(/([\-\d\.e]+)/g).map(Number),d=rn(l,4),u=d[0],h=d[1],p=d[2],v=d[3];v===void 0&&(v=1),u/=360,h/=100,p/=100,o.hsla=[u,h,p,v]}else if(a.startsWith("rgb")){var y=a.match(/([\-\d\.e]+)/g).map(Number),b=rn(y,4),k=b[0],B=b[1],W=b[2],K=b[3];K===void 0&&(K=1),o.rgba=[k,B,W,K]}else a.startsWith("#")?o.rgba=r.hexToRgb(a):o.rgba=r.nameToRgb(a)||r.hexToRgb(a)}if(e!==void 0)if(Array.isArray(e))this.rgba=e;else if(n===void 0){var c=e&&""+e;c&&s(c.toLowerCase())}else this.rgba=[e,t,n,i===void 0?1:i]}return ri(r,[{key:"printRGB",value:function(e){var t=e?this.rgba:this.rgba.slice(0,3),n=t.map(function(i,o){return Ui(i,o===3?3:0)});return e?"rgba("+n+")":"rgb("+n+")"}},{key:"printHSL",value:function(e){var t=[360,100,100,1],n=["","%","%",""],i=e?this.hsla:this.hsla.slice(0,3),o=i.map(function(s,c){return Ui(s*t[c],c===3?3:1)+n[c]});return e?"hsla("+o+")":"hsl("+o+")"}},{key:"printHex",value:function(e){var t=this.hex;return e?t:t.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=r.hslToRgb(this._hsla)},set:function(e){e.length===3&&(e[3]=1),this._rgba=e,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=r.rgbToHsl(this._rgba)},set:function(e){e.length===3&&(e[3]=1),this._hsla=e,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){var e=this.rgba,t=e.map(function(n,i){return i<3?n.toString(16):Math.round(n*255).toString(16)});return"#"+t.map(function(n){return n.padStart(2,"0")}).join("")},set:function(e){this.rgba=r.hexToRgb(e)}}],[{key:"hexToRgb",value:function(e){var t=(e.startsWith("#")?e.slice(1):e).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!t.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+e);var n=t.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map(function(i){return parseInt(i,16)});return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(e){var t=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),n=Ga[t];return n===void 0?n:r.hexToRgb(n.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=rn(e,4),n=t[0],i=t[1],o=t[2],s=t[3];n/=255,i/=255,o/=255;var c=Math.max(n,i,o),a=Math.min(n,i,o),l=void 0,d=void 0,u=(c+a)/2;if(c===a)l=d=0;else{var h=c-a;switch(d=u>.5?h/(2-c-a):h/(c+a),c){case n:l=(i-o)/h+(i<o?6:0);break;case i:l=(o-n)/h+2;break;case o:l=(n-i)/h+4;break}l/=6}return[l,d,u,s]}},{key:"hslToRgb",value:function(e){var t=rn(e,4),n=t[0],i=t[1],o=t[2],s=t[3],c=void 0,a=void 0,l=void 0;if(i===0)c=a=l=o;else{var d=function(v,y,b){return b<0&&(b+=1),b>1&&(b-=1),b<.16666666666666666?v+(y-v)*6*b:b<.5?y:b<.6666666666666666?v+(y-v)*(.6666666666666666-b)*6:v},u=o<.5?o*(1+i):o+i-o*i,h=2*o-u;c=d(h,u,n+1/3),a=d(h,u,n),l=d(h,u,n-1/3)}var p=[c*255,a*255,l*255].map(Math.round);return p[3]=s,p}}]),r})(),$a=(function(){function r(){oi(this,r),this._events=[]}return ri(r,[{key:"add",value:function(e,t,n){e.addEventListener(t,n,!1),this._events.push({target:e,type:t,handler:n})}},{key:"remove",value:function(e,t,n){this._events=this._events.filter(function(i){var o=!0;return e&&e!==i.target&&(o=!1),t&&t!==i.type&&(o=!1),n&&n!==i.handler&&(o=!1),o&&r._doRemove(i.target,i.type,i.handler),!o})}},{key:"destroy",value:function(){this._events.forEach(function(e){return r._doRemove(e.target,e.type,e.handler)}),this._events=[]}}],[{key:"_doRemove",value:function(e,t,n){e.removeEventListener(t,n,!1)}}]),r})();function qa(r){var e=document.createElement("div");return e.innerHTML=r,e.firstElementChild}function In(r,e,t){var n=!1;function i(a,l,d){return Math.max(l,Math.min(a,d))}function o(a,l,d){if(d&&(n=!0),!!n){a.preventDefault();var u=e.getBoundingClientRect(),h=u.width,p=u.height,v=l.clientX,y=l.clientY,b=i(v-u.left,0,h),k=i(y-u.top,0,p);t(b/h,k/p)}}function s(a,l){var d=a.buttons===void 0?a.which:a.buttons;d===1?o(a,a,l):n=!1}function c(a,l){a.touches.length===1?o(a,a.touches[0],l):n=!1}r.add(e,"mousedown",function(a){s(a,!0)}),r.add(e,"touchstart",function(a){c(a,!0)}),r.add(window,"mousemove",s),r.add(e,"touchmove",c),r.add(window,"mouseup",function(a){n=!1}),r.add(e,"touchend",function(a){n=!1}),r.add(e,"touchcancel",function(a){n=!1})}var Ka=`linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,
|
||
linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em`,Xa=360,Do="keydown",an="mousedown",Bn="focusin";function mt(r,e){return(e||document).querySelector(r)}function Va(r){r.preventDefault(),r.stopPropagation()}function jn(r,e,t,n,i){r.add(e,Do,function(o){t.indexOf(o.key)>=0&&n(o)})}var Po=(function(){function r(e){oi(this,r),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new $a,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(e)}return ri(r,[{key:"setOptions",value:function(e){var t=this;if(!e)return;var n=this.settings;function i(a,l,d){for(var u in a)l[u]=a[u]}if(e instanceof HTMLElement)n.parent=e;else{n.parent&&e.parent&&n.parent!==e.parent&&(this._events.remove(n.parent),this._popupInited=!1),i(e,n),e.onChange&&(this.onChange=e.onChange),e.onDone&&(this.onDone=e.onDone),e.onOpen&&(this.onOpen=e.onOpen),e.onClose&&(this.onClose=e.onClose);var o=e.color||e.colour;o&&this._setColor(o)}var s=n.parent;if(s&&n.popup&&!this._popupInited){var c=function(a){return t.openHandler(a)};this._events.add(s,"click",c),jn(this._events,s,[" ","Spacebar","Enter"],c),this._popupInited=!0}else e.parent&&!n.popup&&this.show()}},{key:"openHandler",value:function(e){if(this.show()){e&&e.preventDefault(),this.settings.parent.style.pointerEvents="none";var t=e&&e.type===Do?this._domEdit:this.domElement;setTimeout(function(){return t.focus()},100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(e){var t=e&&e.type,n=!1;if(!e)n=!0;else if(t===an||t===Bn){var i=(this.__containedEvent||0)+100;e.timeStamp>i&&(n=!0)}else Va(e),n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",t!==an&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(e,t){this.closeHandler(),this.setOptions(e),t&&this.openHandler()}},{key:"setColor",value:function(e,t){this._setColor(e,{silent:t})}},{key:"_setColor",value:function(e,t){if(typeof e=="string"&&(e=e.trim()),!!e){t=t||{};var n=void 0;try{n=new Ua(e)}catch(o){if(t.failSilently)return;throw o}if(!this.settings.alpha){var i=n.hsla;i[3]=1,n.hsla=i}this.colour=this.color=n,this._setHSLA(null,null,null,null,t)}}},{key:"setColour",value:function(e,t){this.setColor(e,t)}},{key:"show",value:function(){var e=this.settings.parent;if(!e)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var n=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',i=qa(n);return this.domElement=i,this._domH=mt(".picker_hue",i),this._domSL=mt(".picker_sl",i),this._domA=mt(".picker_alpha",i),this._domEdit=mt(".picker_editor input",i),this._domSample=mt(".picker_sample",i),this._domOkay=mt(".picker_done button",i),this._domCancel=mt(".picker_cancel button",i),i.classList.add("layout_"+this.settings.layout),this.settings.alpha||i.classList.add("no_alpha"),this.settings.editor||i.classList.add("no_editor"),this.settings.cancelButton||i.classList.add("no_cancel"),this._ifPopup(function(){return i.classList.add("popup")}),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var e=this,t=this,n=this.domElement,i=this._events;function o(a,l,d){i.add(a,l,d)}o(n,"click",function(a){return a.preventDefault()}),In(i,this._domH,function(a,l){return t._setHSLA(a)}),In(i,this._domSL,function(a,l){return t._setHSLA(null,a,1-l)}),this.settings.alpha&&In(i,this._domA,function(a,l){return t._setHSLA(null,null,null,1-l)});var s=this._domEdit;o(s,"input",function(a){t._setColor(this.value,{fromEditor:!0,failSilently:!0})}),o(s,"focus",function(a){var l=this;l.selectionStart===l.selectionEnd&&l.select()}),this._ifPopup(function(){var a=function(d){return e.closeHandler(d)};o(window,an,a),o(window,Bn,a),jn(i,n,["Esc","Escape"],a);var l=function(d){e.__containedEvent=d.timeStamp};o(n,an,l),o(n,Bn,l),o(e._domCancel,"click",a)});var c=function(a){e._ifPopup(function(){return e.closeHandler(a)}),e.onDone&&e.onDone(e.colour)};o(this._domOkay,"click",c),jn(i,n,["Enter"],c)}},{key:"_setPosition",value:function(){var e=this.settings.parent,t=this.domElement;e!==t.parentNode&&e.appendChild(t),this._ifPopup(function(n){getComputedStyle(e).position==="static"&&(e.style.position="relative");var i=n===!0?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach(function(o){o===i?t.classList.add(o):t.classList.remove(o)}),t.classList.add(i)})}},{key:"_setHSLA",value:function(e,t,n,i,o){o=o||{};var s=this.colour,c=s.hsla;[e,t,n,i].forEach(function(a,l){(a||a===0)&&(c[l]=a)}),s.hsla=c,this._updateUI(o),this.onChange&&!o.silent&&this.onChange(s)}},{key:"_updateUI",value:function(e){if(!this.domElement)return;e=e||{};var t=this.colour,n=t.hsla,i="hsl("+n[0]*Xa+", 100%, 50%)",o=t.hslString,s=t.hslaString,c=this._domH,a=this._domSL,l=this._domA,d=mt(".picker_selector",c),u=mt(".picker_selector",a),h=mt(".picker_selector",l);function p(le,G,L){G.style.left=L*100+"%"}function v(le,G,L){G.style.top=L*100+"%"}p(c,d,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=i,p(a,u,n[1]),v(a,u,1-n[2]),a.style.color=o,v(l,h,1-n[3]);var y=o,b=y.replace("hsl","hsla").replace(")",", 0)"),k="linear-gradient("+[y,b]+")";if(this._domA.style.background=k+", "+Ka,!e.fromEditor){var B=this.settings.editorFormat,W=this.settings.alpha,K=void 0;switch(B){case"rgb":K=t.printRGB(W);break;case"hsl":K=t.printHSL(W);break;default:K=t.printHex(W)}this._domEdit.value=K}this._domSample.style.color=s}},{key:"_ifPopup",value:function(e,t){this.settings.parent&&this.settings.popup?e&&e(this.settings.popup):t&&t()}},{key:"_toggleDOM",value:function(e){var t=this.domElement;if(!t)return!1;var n=e?"":"none",i=t.style.display!==n;return i&&(t.style.display=n),i}}]),r})();{var Hn=document.createElement("style");Hn.textContent='.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}',document.documentElement.firstElementChild.appendChild(Hn),Po.StyleElement=Hn}var $i={exports:{}},qi;function Lo(){return qi||(qi=1,(function(r,e){(function(t,n){r.exports=t()})(function(){var t="object",n="function",i="undefined",o=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],s=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],c=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],a=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"];function l(T,H){var I=typeof T[H];return I==n||!!(I==t&&T[H])||I=="unknown"}function d(T,H){return!!(typeof T[H]==t&&T[H])}function u(T,H){return typeof T[H]!=i}function h(T){return function(H,I){for(var V=I.length;V--;)if(!T(H,I[V]))return!1;return!0}}var p=h(l),v=h(d),y=h(u);function b(T){return T&&p(T,a)&&y(T,c)}function k(T){return d(T,"body")?T.body:T.getElementsByTagName("body")[0]}var B=[].forEach?function(T,H){T.forEach(H)}:function(T,H){for(var I=0,V=T.length;I<V;++I)H(T[I],I)},W={},K=typeof window!=i&&typeof document!=i,le={isHostMethod:l,isHostObject:d,isHostProperty:u,areHostMethods:p,areHostObjects:v,areHostProperties:y,isTextRange:b,getBody:k,forEach:B},G={version:"1.3.2",initialized:!1,isBrowser:K,supported:!0,util:le,features:{},modules:W,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==i?!0:rangyAutoInitialize}};function L(T){typeof console!=i&&l(console,"log")}function ue(T,H){K&&H?alert(T):L(T)}function Q(T){G.initialized=!0,G.supported=!1,ue("Rangy is not supported in this environment. Reason: "+T,G.config.alertOnFail)}G.fail=Q;function je(T){ue("Rangy warning: "+T,G.config.alertOnWarn)}G.warn=je;var Le;({}).hasOwnProperty?(le.extend=Le=function(T,H,I){var V,ee;for(var ce in H)ce==="__proto__"||ce==="constructor"||ce==="prototype"||H.hasOwnProperty(ce)&&(V=T[ce],ee=H[ce],I&&V!==null&&typeof V=="object"&&ee!==null&&typeof ee=="object"&&Le(V,ee,!0),T[ce]=ee);return H.hasOwnProperty("toString")&&(T.toString=H.toString),T},le.createOptions=function(T,H){var I={};return Le(I,H),T&&Le(I,T),I}):Q("hasOwnProperty not supported"),K||Q("Rangy can only run in a browser"),(function(){var T;if(K){var H=document.createElement("div");H.appendChild(document.createElement("span"));var I=[].slice;try{I.call(H.childNodes,0)[0].nodeType==1&&(T=function(V){return I.call(V,0)})}catch(V){}}T||(T=function(V){for(var ee=[],ce=0,de=V.length;ce<de;++ce)ee[ce]=V[ce];return ee}),le.toArray=T})();var tt;K&&(l(document,"addEventListener")?tt=function(T,H,I){T.addEventListener(H,I,!1)}:l(document,"attachEvent")?tt=function(T,H,I){T.attachEvent("on"+H,I)}:Q("Document does not have required addEventListener or attachEvent method"),le.addListener=tt);var w=[];function O(T){return T.message||T.description||String(T)}function A(){if(!(!K||G.initialized)){var T,H=!1,I=!1;l(document,"createRange")&&(T=document.createRange(),p(T,s)&&y(T,o)&&(H=!0));var V=k(document);if(!V||V.nodeName.toLowerCase()!="body"){Q("No body element found");return}if(V&&l(V,"createTextRange")&&(T=V.createTextRange(),b(T)&&(I=!0)),!H&&!I){Q("Neither Range nor TextRange are available");return}G.initialized=!0,G.features={implementsDomRange:H,implementsTextRange:I};var ee,ce;for(var de in W)(ee=W[de])instanceof Ie&&ee.init(ee,G);for(var ke=0,_e=w.length;ke<_e;++ke)try{w[ke](G)}catch(Me){ce="Rangy init listener threw an exception. Continuing. Detail: "+O(Me),L(ce)}}}function U(T,H,I){I&&(T+=" in module "+I.name),G.warn("DEPRECATED: "+T+" is deprecated. Please use "+H+" instead.")}function pe(T,H,I,V){T[H]=function(){return U(H,I,V),T[I].apply(T,le.toArray(arguments))}}le.deprecationNotice=U,le.createAliasForDeprecatedMethod=pe,G.init=A,G.addInitListener=function(T){G.initialized?T(G):w.push(T)};var me=[];G.addShimListener=function(T){me.push(T)};function Fe(T){T=T||window,A();for(var H=0,I=me.length;H<I;++H)me[H](T)}K&&(G.shim=G.createMissingNativeApi=Fe,pe(G,"createMissingNativeApi","shim"));function Ie(T,H,I){this.name=T,this.dependencies=H,this.initialized=!1,this.supported=!1,this.initializer=I}Ie.prototype={init:function(){for(var T=this.dependencies||[],H=0,I=T.length,V,ee;H<I;++H){if(ee=T[H],V=W[ee],!V||!(V instanceof Ie))throw new Error("required module '"+ee+"' not found");if(V.init(),!V.supported)throw new Error("required module '"+ee+"' not supported")}this.initializer(this)},fail:function(T){throw this.initialized=!0,this.supported=!1,new Error(T)},warn:function(T){G.warn("Module "+this.name+": "+T)},deprecationNotice:function(T,H){G.warn("DEPRECATED: "+T+" in module "+this.name+" is deprecated. Please use "+H+" instead")},createError:function(T){return new Error("Error in Rangy "+this.name+" module: "+T)}};function ut(T,H,I){var V=new Ie(T,H,function(ee){if(!ee.initialized){ee.initialized=!0;try{I(G,ee),ee.supported=!0}catch(de){var ce="Module '"+T+"' failed to load: "+O(de);L(ce),de.stack&&L(de.stack)}}});return W[T]=V,V}G.createModule=function(T){var H,I;arguments.length==2?(H=arguments[1],I=[]):(H=arguments[2],I=arguments[1]);var V=ut(T,I,H);G.initialized&&G.supported&&V.init()},G.createCoreModule=function(T,H,I){ut(T,H,I)};function ft(){}G.RangePrototype=ft,G.rangePrototype=new ft;function yt(){}G.selectionPrototype=new yt,G.createCoreModule("DomUtil",[],function(T,H){var I="undefined",V=T.util,ee=V.getBody;V.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||H.fail("document missing a Node creation method"),V.isHostMethod(document,"getElementsByTagName")||H.fail("document missing getElementsByTagName method");var ce=document.createElement("div");V.areHostMethods(ce,["insertBefore","appendChild","cloneNode"])||H.fail("Incomplete Element implementation"),V.isHostProperty(ce,"innerHTML")||H.fail("Element is missing innerHTML property");var de=document.createTextNode("test");V.areHostMethods(de,["splitText","deleteData","insertData","appendData","cloneNode"])||H.fail("Incomplete Text Node implementation");var ke=(function(_,q){for(var fe=_.length;fe--;)if(_[fe]===q)return!0;return!1});function _e(_){var q;return typeof _.namespaceURI==I||(q=_.namespaceURI)===null||q=="http://www.w3.org/1999/xhtml"}function Me(_){var q=_.parentNode;return q.nodeType==1?q:null}function Ne(_){for(var q=0;_=_.previousSibling;)++q;return q}function He(_){switch(_.nodeType){case 7:case 10:return 0;case 3:case 8:return _.length;default:return _.childNodes.length}}function ze(_,q){var fe=[],re;for(re=_;re;re=re.parentNode)fe.push(re);for(re=q;re;re=re.parentNode)if(ke(fe,re))return re;return null}function m(_,q,fe){for(var re=fe?q:q.parentNode;re;){if(re===_)return!0;re=re.parentNode}return!1}function C(_,q){return m(_,q,!0)}function E(_,q,fe){for(var re,Oe=fe?_:_.parentNode;Oe;){if(re=Oe.parentNode,re===q)return Oe;Oe=re}return null}function R(_){var q=_.nodeType;return q==3||q==4||q==8}function x(_){if(!_)return!1;var q=_.nodeType;return q==3||q==8}function j(_,q){var fe=q.nextSibling,re=q.parentNode;return fe?re.insertBefore(_,fe):re.appendChild(_),_}function D(_,q,fe){var re=_.cloneNode(!1);if(re.deleteData(0,q),_.deleteData(q,_.length-q),j(re,_),fe)for(var Oe=0,Se;Se=fe[Oe++];)Se.node==_&&Se.offset>q?(Se.node=re,Se.offset-=q):Se.node==_.parentNode&&Se.offset>Ne(_)&&++Se.offset;return re}function F(_){if(_.nodeType==9)return _;if(typeof _.ownerDocument!=I)return _.ownerDocument;if(typeof _.document!=I)return _.document;if(_.parentNode)return F(_.parentNode);throw H.createError("getDocument: no document found for node")}function ae(_){var q=F(_);if(typeof q.defaultView!=I)return q.defaultView;if(typeof q.parentWindow!=I)return q.parentWindow;throw H.createError("Cannot get a window object for node")}function te(_){if(typeof _.contentDocument!=I)return _.contentDocument;if(typeof _.contentWindow!=I)return _.contentWindow.document;throw H.createError("getIframeDocument: No Document object found for iframe element")}function X(_){if(typeof _.contentWindow!=I)return _.contentWindow;if(typeof _.contentDocument!=I)return _.contentDocument.defaultView;throw H.createError("getIframeWindow: No Window object found for iframe element")}function Ce(_){return _&&V.isHostMethod(_,"setTimeout")&&V.isHostObject(_,"document")}function ve(_,q,fe){var re;if(_?V.isHostProperty(_,"nodeType")?re=_.nodeType==1&&_.tagName.toLowerCase()=="iframe"?te(_):F(_):Ce(_)&&(re=_.document):re=document,!re)throw q.createError(fe+"(): Parameter must be a Window object or DOM node");return re}function be(_){for(var q;q=_.parentNode;)_=q;return _}function We(_,q,fe,re){var Oe,Se,ht,st,Ve;if(_==fe)return q===re?0:q<re?-1:1;if(Oe=E(fe,_,!0))return q<=Ne(Oe)?-1:1;if(Oe=E(_,fe,!0))return Ne(Oe)<re?-1:1;if(Se=ze(_,fe),!Se)throw new Error("comparePoints error: nodes have no common ancestor");if(ht=_===Se?Se:E(_,Se,!0),st=fe===Se?Se:E(fe,Se,!0),ht===st)throw H.createError("comparePoints got to case 4 and childA and childB are the same!");for(Ve=Se.firstChild;Ve;){if(Ve===ht)return-1;if(Ve===st)return 1;Ve=Ve.nextSibling}}var Y=!1;function ie(_){var q;try{return q=_.parentNode,!1}catch(fe){return!0}}(function(){var _=document.createElement("b");_.innerHTML="1";var q=_.firstChild;_.innerHTML="<br />",Y=ie(q),T.features.crashyTextNodes=Y})();function Ee(_){if(!_)return"[No node]";if(Y&&ie(_))return"[Broken node]";if(R(_))return'"'+_.data+'"';if(_.nodeType==1){var q=_.id?' id="'+_.id+'"':"";return"<"+_.nodeName+q+">[index:"+Ne(_)+",length:"+_.childNodes.length+"]["+(_.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return _.nodeName}function Ae(_){for(var q=F(_).createDocumentFragment(),fe;fe=_.firstChild;)q.appendChild(fe);return q}var De;typeof window.getComputedStyle!=I?De=function(_,q){return ae(_).getComputedStyle(_,null)[q]}:typeof document.documentElement.currentStyle!=I?De=function(_,q){return _.currentStyle?_.currentStyle[q]:""}:H.fail("No means of obtaining computed style properties found");function at(_,q,fe){var re=ee(_),Oe=_.createElement("div");Oe.contentEditable=""+!!fe,q&&(Oe.innerHTML=q);var Se=re.firstChild;return Se?re.insertBefore(Oe,Se):re.appendChild(Oe),Oe}function Xe(_){return _.parentNode.removeChild(_)}function Ge(_){this.root=_,this._next=_}Ge.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var _=this._current=this._next,q,fe;if(this._current)if(q=_.firstChild,q)this._next=q;else{for(fe=null;_!==this.root&&!(fe=_.nextSibling);)_=_.parentNode;this._next=fe}return this._current},detach:function(){this._current=this._next=this.root=null}};function Ue(_){return new Ge(_)}function $e(_,q){this.node=_,this.offset=q}$e.prototype={equals:function(_){return!!_&&this.node===_.node&&this.offset==_.offset},inspect:function(){return"[DomPosition("+Ee(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}};function it(_){this.code=this[_],this.codeName=_,this.message="DOMException: "+this.codeName}it.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},it.prototype.toString=function(){return this.message},T.dom={arrayContains:ke,isHtmlNamespace:_e,parentElement:Me,getNodeIndex:Ne,getNodeLength:He,getCommonAncestor:ze,isAncestorOf:m,isOrIsAncestorOf:C,getClosestAncestorIn:E,isCharacterDataNode:R,isTextOrCommentNode:x,insertAfter:j,splitDataNode:D,getDocument:F,getWindow:ae,getIframeWindow:X,getIframeDocument:te,getBody:ee,isWindow:Ce,getContentDocument:ve,getRootContainer:be,comparePoints:We,isBrokenNode:ie,inspectNode:Ee,getComputedStyleProperty:De,createTestElement:at,removeNode:Xe,fragmentFromNodeChildren:Ae,createIterator:Ue,DomPosition:$e},T.DOMException=it}),G.createCoreModule("DomRange",["DomUtil"],function(T,H){var I=T.dom,V=T.util,ee=I.DomPosition,ce=T.DOMException,de=I.isCharacterDataNode,ke=I.getNodeIndex,_e=I.isOrIsAncestorOf,Me=I.getDocument,Ne=I.comparePoints,He=I.splitDataNode,ze=I.getClosestAncestorIn,m=I.getNodeLength,C=I.arrayContains,E=I.getRootContainer,R=T.features.crashyTextNodes,x=I.removeNode;function j(g,N){return g.nodeType!=3&&(_e(g,N.startContainer)||_e(g,N.endContainer))}function D(g){return g.document||Me(g.startContainer)}function F(g){return E(g.startContainer)}function ae(g){return new ee(g.parentNode,ke(g))}function te(g){return new ee(g.parentNode,ke(g)+1)}function X(g,N,M){var $=g.nodeType==11?g.firstChild:g;return de(N)?M==N.length?I.insertAfter(g,N):N.parentNode.insertBefore(g,M==0?N:He(N,M)):M>=N.childNodes.length?N.appendChild(g):N.insertBefore(g,N.childNodes[M]),$}function Ce(g,N,M){if(Te(g),Te(N),D(N)!=D(g))throw new ce("WRONG_DOCUMENT_ERR");var $=Ne(g.startContainer,g.startOffset,N.endContainer,N.endOffset),oe=Ne(g.endContainer,g.endOffset,N.startContainer,N.startOffset);return M?$<=0&&oe>=0:$<0&&oe>0}function ve(g){for(var N,M,$=D(g.range).createDocumentFragment(),oe;M=g.next();){if(N=g.isPartiallySelectedSubtree(),M=M.cloneNode(!N),N&&(oe=g.getSubtreeIterator(),M.appendChild(ve(oe)),oe.detach()),M.nodeType==10)throw new ce("HIERARCHY_REQUEST_ERR");$.appendChild(M)}return $}function be(g,N,M){var $,oe;M=M||{stop:!1};for(var we,z;we=g.next();)if(g.isPartiallySelectedSubtree()){if(N(we)===!1){M.stop=!0;return}else if(z=g.getSubtreeIterator(),be(z,N,M),z.detach(),M.stop)return}else for($=I.createIterator(we);oe=$.next();)if(N(oe)===!1){M.stop=!0;return}}function We(g){for(var N;g.next();)g.isPartiallySelectedSubtree()?(N=g.getSubtreeIterator(),We(N),N.detach()):g.remove()}function Y(g){for(var N,M=D(g.range).createDocumentFragment(),$;N=g.next();){if(g.isPartiallySelectedSubtree()?(N=N.cloneNode(!1),$=g.getSubtreeIterator(),N.appendChild(Y($)),$.detach()):g.remove(),N.nodeType==10)throw new ce("HIERARCHY_REQUEST_ERR");M.appendChild(N)}return M}function ie(g,N,M){var $=!!(N&&N.length),oe,we=!!M;$&&(oe=new RegExp("^("+N.join("|")+")$"));var z=[];return be(new Ae(g,!1),function(J){if(!($&&!oe.test(J.nodeType))&&!(we&&!M(J))){var se=g.startContainer;if(!(J==se&&de(se)&&g.startOffset==se.length)){var ye=g.endContainer;J==ye&&de(ye)&&g.endOffset==0||z.push(J)}}}),z}function Ee(g){var N=typeof g.getName=="undefined"?"Range":g.getName();return"["+N+"("+I.inspectNode(g.startContainer)+":"+g.startOffset+", "+I.inspectNode(g.endContainer)+":"+g.endOffset+")]"}function Ae(g,N){if(this.range=g,this.clonePartiallySelectedTextNodes=N,!g.collapsed){this.sc=g.startContainer,this.so=g.startOffset,this.ec=g.endContainer,this.eo=g.endOffset;var M=g.commonAncestorContainer;this.sc===this.ec&&de(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===M&&!de(this.sc)?this.sc.childNodes[this.so]:ze(this.sc,M,!0),this._last=this.ec===M&&!de(this.ec)?this.ec.childNodes[this.eo-1]:ze(this.ec,M,!0))}}Ae.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){var g=this._current=this._next;return g&&(this._next=g!==this._last?g.nextSibling:null,de(g)&&this.clonePartiallySelectedTextNodes&&(g===this.ec&&(g=g.cloneNode(!0)).deleteData(this.eo,g.length-this.eo),this._current===this.sc&&(g=g.cloneNode(!0)).deleteData(0,this.so))),g},remove:function(){var g=this._current,N,M;de(g)&&(g===this.sc||g===this.ec)?(N=g===this.sc?this.so:0,M=g===this.ec?this.eo:g.length,N!=M&&g.deleteData(N,M-N)):g.parentNode&&x(g)},isPartiallySelectedSubtree:function(){var g=this._current;return j(g,this.range)},getSubtreeIterator:function(){var g;if(this.isSingleCharacterDataNode)g=this.range.cloneRange(),g.collapse(!1);else{g=new Pe(D(this.range));var N=this._current,M=N,$=0,oe=N,we=m(N);_e(N,this.sc)&&(M=this.sc,$=this.so),_e(N,this.ec)&&(oe=this.ec,we=this.eo),xe(g,M,$,oe,we)}return new Ae(g,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var De=[1,3,4,5,7,8,10],at=[2,9,11],Xe=[5,6,10,12],Ge=[1,3,4,5,7,8,10,11],Ue=[1,3,4,5,7,8];function $e(g){return function(N,M){for(var $,oe=M?N:N.parentNode;oe;){if($=oe.nodeType,C(g,$))return oe;oe=oe.parentNode}return null}}var it=$e([9,11]),_=$e(Xe),q=$e([6,10,12]),fe=$e([1]);function re(g,N){if(q(g,N))throw new ce("INVALID_NODE_TYPE_ERR")}function Oe(g,N){if(!C(N,g.nodeType))throw new ce("INVALID_NODE_TYPE_ERR")}function Se(g,N){if(N<0||N>(de(g)?g.length:g.childNodes.length))throw new ce("INDEX_SIZE_ERR")}function ht(g,N){if(it(g,!0)!==it(N,!0))throw new ce("WRONG_DOCUMENT_ERR")}function st(g){if(_(g,!0))throw new ce("NO_MODIFICATION_ALLOWED_ERR")}function Ve(g,N){if(!g)throw new ce(N)}function Ft(g,N){return N<=(de(g)?g.length:g.childNodes.length)}function Et(g){return!!g.startContainer&&!!g.endContainer&&!(R&&(I.isBrokenNode(g.startContainer)||I.isBrokenNode(g.endContainer)))&&E(g.startContainer)==E(g.endContainer)&&Ft(g.startContainer,g.startOffset)&&Ft(g.endContainer,g.endOffset)}function Te(g){if(!Et(g))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+g.inspect()+")")}var zt=document.createElement("style"),bt=!1;try{zt.innerHTML="<b>x</b>",bt=zt.firstChild.nodeType==3}catch(g){}T.features.htmlParsingConforms=bt;var Wt=bt?(function(g){var N=this.startContainer,M=Me(N);if(!N)throw new ce("INVALID_STATE_ERR");var $=null;return N.nodeType==1?$=N:de(N)&&($=I.parentElement(N)),$===null||$.nodeName=="HTML"&&I.isHtmlNamespace(Me($).documentElement)&&I.isHtmlNamespace($)?$=M.createElement("body"):$=$.cloneNode(!1),$.innerHTML=g,I.fragmentFromNodeChildren($)}):(function(g){var N=D(this),M=N.createElement("body");return M.innerHTML=g,I.fragmentFromNodeChildren(M)});function _t(g,N){Te(g);var M=g.startContainer,$=g.startOffset,oe=g.endContainer,we=g.endOffset,z=M===oe;de(oe)&&we>0&&we<oe.length&&He(oe,we,N),de(M)&&$>0&&$<M.length&&(M=He(M,$,N),z?(we-=$,oe=M):oe==M.parentNode&&we>=ke(M)&&we++,$=0),g.setStartAndEnd(M,$,oe,we)}function ge(g){Te(g);var N=g.commonAncestorContainer.parentNode.cloneNode(!1);return N.appendChild(g.cloneContents()),N.innerHTML}var Rt=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],Mt=0,xt=1,Qt=2,wt=3,Nt=0,Gt=1,Ut=2,Dt=3;V.extend(T.rangePrototype,{compareBoundaryPoints:function(g,N){Te(this),ht(this.startContainer,N.startContainer);var M,$,oe,we,z=g==wt||g==Mt?"start":"end",J=g==xt||g==Mt?"start":"end";return M=this[z+"Container"],$=this[z+"Offset"],oe=N[J+"Container"],we=N[J+"Offset"],Ne(M,$,oe,we)},insertNode:function(g){if(Te(this),Oe(g,Ge),st(this.startContainer),_e(g,this.startContainer))throw new ce("HIERARCHY_REQUEST_ERR");var N=X(g,this.startContainer,this.startOffset);this.setStartBefore(N)},cloneContents:function(){Te(this);var g,N;if(this.collapsed)return D(this).createDocumentFragment();if(this.startContainer===this.endContainer&&de(this.startContainer))return g=this.startContainer.cloneNode(!0),g.data=g.data.slice(this.startOffset,this.endOffset),N=D(this).createDocumentFragment(),N.appendChild(g),N;var M=new Ae(this,!0);return g=ve(M),M.detach(),g},canSurroundContents:function(){Te(this),st(this.startContainer),st(this.endContainer);var g=new Ae(this,!0),N=g._first&&j(g._first,this)||g._last&&j(g._last,this);return g.detach(),!N},surroundContents:function(g){if(Oe(g,Ue),!this.canSurroundContents())throw new ce("INVALID_STATE_ERR");var N=this.extractContents();if(g.hasChildNodes())for(;g.lastChild;)g.removeChild(g.lastChild);X(g,this.startContainer,this.startOffset),g.appendChild(N),this.selectNode(g)},cloneRange:function(){Te(this);for(var g=new Pe(D(this)),N=Rt.length,M;N--;)M=Rt[N],g[M]=this[M];return g},toString:function(){Te(this);var g=this.startContainer;if(g===this.endContainer&&de(g))return g.nodeType==3||g.nodeType==4?g.data.slice(this.startOffset,this.endOffset):"";var N=[],M=new Ae(this,!0);return be(M,function($){($.nodeType==3||$.nodeType==4)&&N.push($.data)}),M.detach(),N.join("")},compareNode:function(g){Te(this);var N=g.parentNode,M=ke(g);if(!N)throw new ce("NOT_FOUND_ERR");var $=this.comparePoint(N,M),oe=this.comparePoint(N,M+1);return $<0?oe>0?Ut:Nt:oe>0?Gt:Dt},comparePoint:function(g,N){return Te(this),Ve(g,"HIERARCHY_REQUEST_ERR"),ht(g,this.startContainer),Ne(g,N,this.startContainer,this.startOffset)<0?-1:Ne(g,N,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:Wt,toHtml:function(){return ge(this)},intersectsNode:function(g,N){if(Te(this),E(g)!=F(this))return!1;var M=g.parentNode,$=ke(g);if(!M)return!0;var oe=Ne(M,$,this.endContainer,this.endOffset),we=Ne(M,$+1,this.startContainer,this.startOffset);return N?oe<=0&&we>=0:oe<0&&we>0},isPointInRange:function(g,N){return Te(this),Ve(g,"HIERARCHY_REQUEST_ERR"),ht(g,this.startContainer),Ne(g,N,this.startContainer,this.startOffset)>=0&&Ne(g,N,this.endContainer,this.endOffset)<=0},intersectsRange:function(g){return Ce(this,g,!1)},intersectsOrTouchesRange:function(g){return Ce(this,g,!0)},intersection:function(g){if(this.intersectsRange(g)){var N=Ne(this.startContainer,this.startOffset,g.startContainer,g.startOffset),M=Ne(this.endContainer,this.endOffset,g.endContainer,g.endOffset),$=this.cloneRange();return N==-1&&$.setStart(g.startContainer,g.startOffset),M==1&&$.setEnd(g.endContainer,g.endOffset),$}return null},union:function(g){if(this.intersectsOrTouchesRange(g)){var N=this.cloneRange();return Ne(g.startContainer,g.startOffset,this.startContainer,this.startOffset)==-1&&N.setStart(g.startContainer,g.startOffset),Ne(g.endContainer,g.endOffset,this.endContainer,this.endOffset)==1&&N.setEnd(g.endContainer,g.endOffset),N}else throw new ce("Ranges do not intersect")},containsNode:function(g,N){return N?this.intersectsNode(g,!1):this.compareNode(g)==Dt},containsNodeContents:function(g){return this.comparePoint(g,0)>=0&&this.comparePoint(g,m(g))<=0},containsRange:function(g){var N=this.intersection(g);return N!==null&&g.equals(N)},containsNodeText:function(g){var N=this.cloneRange();N.selectNode(g);var M=N.getNodes([3]);if(M.length>0){N.setStart(M[0],0);var $=M.pop();return N.setEnd($,$.length),this.containsRange(N)}else return this.containsNodeContents(g)},getNodes:function(g,N){return Te(this),ie(this,g,N)},getDocument:function(){return D(this)},collapseBefore:function(g){this.setEndBefore(g),this.collapse(!1)},collapseAfter:function(g){this.setStartAfter(g),this.collapse(!0)},getBookmark:function(g){var N=D(this),M=T.createRange(N);g=g||I.getBody(N),M.selectNodeContents(g);var $=this.intersection(M),oe=0,we=0;return $&&(M.setEnd($.startContainer,$.startOffset),oe=M.toString().length,we=oe+$.toString().length),{start:oe,end:we,containerNode:g}},moveToBookmark:function(g){var N=g.containerNode,M=0;this.setStart(N,0),this.collapse(!0);for(var $=[N],oe,we=!1,z=!1,J,se,ye;!z&&(oe=$.pop());)if(oe.nodeType==3)J=M+oe.length,!we&&g.start>=M&&g.start<=J&&(this.setStart(oe,g.start-M),we=!0),we&&g.end>=M&&g.end<=J&&(this.setEnd(oe,g.end-M),z=!0),M=J;else for(ye=oe.childNodes,se=ye.length;se--;)$.push(ye[se])},getName:function(){return"DomRange"},equals:function(g){return Pe.rangesEqual(this,g)},isValid:function(){return Et(this)},inspect:function(){return Ee(this)},detach:function(){}});function f(g){g.START_TO_START=Mt,g.START_TO_END=xt,g.END_TO_END=Qt,g.END_TO_START=wt,g.NODE_BEFORE=Nt,g.NODE_AFTER=Gt,g.NODE_BEFORE_AND_AFTER=Ut,g.NODE_INSIDE=Dt}function S(g){f(g),f(g.prototype)}function P(g,N){return function(){Te(this);var M=this.startContainer,$=this.startOffset,oe=this.commonAncestorContainer,we=new Ae(this,!0),z,J;M!==oe&&(z=ze(M,oe,!0),J=te(z),M=J.node,$=J.offset),be(we,st),we.reset();var se=g(we);return we.detach(),N(this,M,$,M,$),se}}function Z(g,N){function M(z,J){return function(se){Oe(se,De),Oe(E(se),at);var ye=(z?ae:te)(se);(J?$:oe)(this,ye.node,ye.offset)}}function $(z,J,se){var ye=z.endContainer,Ye=z.endOffset;(J!==z.startContainer||se!==z.startOffset)&&((E(J)!=E(ye)||Ne(J,se,ye,Ye)==1)&&(ye=J,Ye=se),N(z,J,se,ye,Ye))}function oe(z,J,se){var ye=z.startContainer,Ye=z.startOffset;(J!==z.endContainer||se!==z.endOffset)&&((E(J)!=E(ye)||Ne(J,se,ye,Ye)==-1)&&(ye=J,Ye=se),N(z,ye,Ye,J,se))}var we=function(){};we.prototype=T.rangePrototype,g.prototype=new we,V.extend(g.prototype,{setStart:function(z,J){re(z,!0),Se(z,J),$(this,z,J)},setEnd:function(z,J){re(z,!0),Se(z,J),oe(this,z,J)},setStartAndEnd:function(){var z=arguments,J=z[0],se=z[1],ye=J,Ye=se;switch(z.length){case 3:Ye=z[2];break;case 4:ye=z[2],Ye=z[3];break}re(J,!0),Se(J,se),re(ye,!0),Se(ye,Ye),N(this,J,se,ye,Ye)},setBoundary:function(z,J,se){this["set"+(se?"Start":"End")](z,J)},setStartBefore:M(!0,!0),setStartAfter:M(!1,!0),setEndBefore:M(!0,!1),setEndAfter:M(!1,!1),collapse:function(z){Te(this),z?N(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):N(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(z){re(z,!0),N(this,z,0,z,m(z))},selectNode:function(z){re(z,!1),Oe(z,De);var J=ae(z),se=te(z);N(this,J.node,J.offset,se.node,se.offset)},extractContents:P(Y,N),deleteContents:P(We,N),canSurroundContents:function(){Te(this),st(this.startContainer),st(this.endContainer);var z=new Ae(this,!0),J=z._first&&j(z._first,this)||z._last&&j(z._last,this);return z.detach(),!J},splitBoundaries:function(){_t(this)},splitBoundariesPreservingPositions:function(z){_t(this,z)},normalizeBoundaries:function(){Te(this);var z=this.startContainer,J=this.startOffset,se=this.endContainer,ye=this.endOffset,Ye=function(ot){var gt=ot.nextSibling;gt&>.nodeType==ot.nodeType&&(se=ot,ye=ot.length,ot.appendData(gt.data),x(gt))},ai=function(ot){var gt=ot.previousSibling;if(gt&>.nodeType==ot.nodeType){z=ot;var Wo=ot.length;if(J=gt.length,ot.insertData(0,gt.data),x(gt),z==se)ye+=J,se=z;else if(se==ot.parentNode){var si=ke(ot);ye==si?(se=ot,ye=Wo):ye>si&&ye--}}},_n=!0,lt;if(de(se))ye==se.length?Ye(se):ye==0&&(lt=se.previousSibling,lt&<.nodeType==se.nodeType&&(ye=lt.length,z==se&&(_n=!1),lt.appendData(se.data),x(se),se=lt));else{if(ye>0){var Rn=se.childNodes[ye-1];Rn&&de(Rn)&&Ye(Rn)}_n=!this.collapsed}if(_n){if(de(z))J==0?ai(z):J==z.length&&(lt=z.nextSibling,lt&<.nodeType==z.nodeType&&(se==lt&&(se=z,ye+=z.length),z.appendData(lt.data),x(lt)));else if(J<z.childNodes.length){var Mn=z.childNodes[J];Mn&&de(Mn)&&ai(Mn)}}else z=se,J=ye;N(this,z,J,se,ye)},collapseToPoint:function(z,J){re(z,!0),Se(z,J),this.setStartAndEnd(z,J)},parentElement:function(){Te(this);var z=this.commonAncestorContainer;return z?fe(this.commonAncestorContainer,!0):null}}),S(g)}function he(g){g.collapsed=g.startContainer===g.endContainer&&g.startOffset===g.endOffset,g.commonAncestorContainer=g.collapsed?g.startContainer:I.getCommonAncestor(g.startContainer,g.endContainer)}function xe(g,N,M,$,oe){g.startContainer=N,g.startOffset=M,g.endContainer=$,g.endOffset=oe,g.document=I.getDocument(N),he(g)}function Pe(g){xe(this,g,0,g,0)}Z(Pe,xe),V.extend(Pe,{rangeProperties:Rt,RangeIterator:Ae,copyComparisonConstants:S,createPrototypeRange:Z,inspect:Ee,toHtml:ge,getRangeDocument:D,rangesEqual:function(g,N){return g.startContainer===N.startContainer&&g.startOffset===N.startOffset&&g.endContainer===N.endContainer&&g.endOffset===N.endOffset}}),T.DomRange=Pe}),G.createCoreModule("WrappedRange",["DomRange"],function(T,H){var I,V,ee=T.dom,ce=T.util,de=ee.DomPosition,ke=T.DomRange,_e=ee.getBody,Me=ee.getContentDocument,Ne=ee.isCharacterDataNode;if(T.features.implementsDomRange&&(function(){var x,j=ke.rangeProperties;function D(Y){for(var ie=j.length,Ee;ie--;)Ee=j[ie],Y[Ee]=Y.nativeRange[Ee];Y.collapsed=Y.startContainer===Y.endContainer&&Y.startOffset===Y.endOffset}function F(Y,ie,Ee,Ae,De){var at=Y.startContainer!==ie||Y.startOffset!=Ee,Xe=Y.endContainer!==Ae||Y.endOffset!=De,Ge=!Y.equals(Y.nativeRange);(at||Xe||Ge)&&(Y.setEnd(Ae,De),Y.setStart(ie,Ee))}var ae;I=function(Y){if(!Y)throw H.createError("WrappedRange: Range must be specified");this.nativeRange=Y,D(this)},ke.createPrototypeRange(I,F),x=I.prototype,x.selectNode=function(Y){this.nativeRange.selectNode(Y),D(this)},x.cloneContents=function(){return this.nativeRange.cloneContents()},x.surroundContents=function(Y){this.nativeRange.surroundContents(Y),D(this)},x.collapse=function(Y){this.nativeRange.collapse(Y),D(this)},x.cloneRange=function(){return new I(this.nativeRange.cloneRange())},x.refresh=function(){D(this)},x.toString=function(){return this.nativeRange.toString()};var te=document.createTextNode("test");_e(document).appendChild(te);var X=document.createRange();X.setStart(te,0),X.setEnd(te,0);try{X.setStart(te,1),x.setStart=function(Y,ie){this.nativeRange.setStart(Y,ie),D(this)},x.setEnd=function(Y,ie){this.nativeRange.setEnd(Y,ie),D(this)},ae=function(Y){return function(ie){this.nativeRange[Y](ie),D(this)}}}catch(Y){x.setStart=function(ie,Ee){try{this.nativeRange.setStart(ie,Ee)}catch(Ae){this.nativeRange.setEnd(ie,Ee),this.nativeRange.setStart(ie,Ee)}D(this)},x.setEnd=function(ie,Ee){try{this.nativeRange.setEnd(ie,Ee)}catch(Ae){this.nativeRange.setStart(ie,Ee),this.nativeRange.setEnd(ie,Ee)}D(this)},ae=function(ie,Ee){return function(Ae){try{this.nativeRange[ie](Ae)}catch(De){this.nativeRange[Ee](Ae),this.nativeRange[ie](Ae)}D(this)}}}x.setStartBefore=ae("setStartBefore","setEndBefore"),x.setStartAfter=ae("setStartAfter","setEndAfter"),x.setEndBefore=ae("setEndBefore","setStartBefore"),x.setEndAfter=ae("setEndAfter","setStartAfter"),x.selectNodeContents=function(Y){this.setStartAndEnd(Y,0,ee.getNodeLength(Y))},X.selectNodeContents(te),X.setEnd(te,3);var Ce=document.createRange();Ce.selectNodeContents(te),Ce.setEnd(te,4),Ce.setStart(te,2),X.compareBoundaryPoints(X.START_TO_END,Ce)==-1&&X.compareBoundaryPoints(X.END_TO_START,Ce)==1?x.compareBoundaryPoints=function(Y,ie){return ie=ie.nativeRange||ie,Y==ie.START_TO_END?Y=ie.END_TO_START:Y==ie.END_TO_START&&(Y=ie.START_TO_END),this.nativeRange.compareBoundaryPoints(Y,ie)}:x.compareBoundaryPoints=function(Y,ie){return this.nativeRange.compareBoundaryPoints(Y,ie.nativeRange||ie)};var ve=document.createElement("div");ve.innerHTML="123";var be=ve.firstChild,We=_e(document);We.appendChild(ve),X.setStart(be,1),X.setEnd(be,2),X.deleteContents(),be.data=="13"&&(x.deleteContents=function(){this.nativeRange.deleteContents(),D(this)},x.extractContents=function(){var Y=this.nativeRange.extractContents();return D(this),Y}),We.removeChild(ve),We=null,ce.isHostMethod(X,"createContextualFragment")&&(x.createContextualFragment=function(Y){return this.nativeRange.createContextualFragment(Y)}),_e(document).removeChild(te),x.getName=function(){return"WrappedRange"},T.WrappedRange=I,T.createNativeRange=function(Y){return Y=Me(Y,H,"createNativeRange"),Y.createRange()}})(),T.features.implementsTextRange){var He=function(x){var j=x.parentElement(),D=x.duplicate();D.collapse(!0);var F=D.parentElement();D=x.duplicate(),D.collapse(!1);var ae=D.parentElement(),te=F==ae?F:ee.getCommonAncestor(F,ae);return te==j?te:ee.getCommonAncestor(j,te)},ze=function(x){return x.compareEndPoints("StartToEnd",x)==0},m=function(x,j,D,F,ae){var te=x.duplicate();te.collapse(D);var X=te.parentElement();if(ee.isOrIsAncestorOf(j,X)||(X=j),!X.canHaveHTML){var Ce=new de(X.parentNode,ee.getNodeIndex(X));return{boundaryPosition:Ce,nodeInfo:{nodeIndex:Ce.offset,containerElement:Ce.node}}}var ve=ee.getDocument(X).createElement("span");ve.parentNode&&ee.removeNode(ve);for(var be,We=D?"StartToStart":"StartToEnd",Y,ie,Ee,Ae,De=ae&&ae.containerElement==X?ae.nodeIndex:0,at=X.childNodes.length,Xe=at,Ge=Xe;Ge==at?X.appendChild(ve):X.insertBefore(ve,X.childNodes[Ge]),te.moveToElementText(ve),be=te.compareEndPoints(We,x),!(be==0||De==Xe);){if(be==-1){if(Xe==De+1)break;De=Ge}else Xe=Xe==De+1?De:Ge;Ge=Math.floor((De+Xe)/2),X.removeChild(ve)}if(Ae=ve.nextSibling,be==-1&&Ae&&Ne(Ae)){te.setEndPoint(D?"EndToStart":"EndToEnd",x);var Ue;if(/[\r\n]/.test(Ae.data)){var $e=te.duplicate(),it=$e.text.replace(/\r\n/g,"\r").length;for(Ue=$e.moveStart("character",it);(be=$e.compareEndPoints("StartToEnd",$e))==-1;)Ue++,$e.moveStart("character",1)}else Ue=te.text.length;Ee=new de(Ae,Ue)}else Y=(F||!D)&&ve.previousSibling,ie=(F||D)&&ve.nextSibling,ie&&Ne(ie)?Ee=new de(ie,0):Y&&Ne(Y)?Ee=new de(Y,Y.data.length):Ee=new de(X,ee.getNodeIndex(ve));return ee.removeNode(ve),{boundaryPosition:Ee,nodeInfo:{nodeIndex:Ge,containerElement:X}}},C=function(x,j){var D,F,ae=x.offset,te=ee.getDocument(x.node),X,Ce,ve=_e(te).createTextRange(),be=Ne(x.node);return be?(D=x.node,F=D.parentNode):(Ce=x.node.childNodes,D=ae<Ce.length?Ce[ae]:null,F=x.node),X=te.createElement("span"),X.innerHTML="&#feff;",D?F.insertBefore(X,D):F.appendChild(X),ve.moveToElementText(X),ve.collapse(!j),F.removeChild(X),be&&ve[j?"moveStart":"moveEnd"]("character",ae),ve};V=function(x){this.textRange=x,this.refresh()},V.prototype=new ke(document),V.prototype.refresh=function(){var x,j,D,F=He(this.textRange);ze(this.textRange)?j=x=m(this.textRange,F,!0,!0).boundaryPosition:(D=m(this.textRange,F,!0,!1),x=D.boundaryPosition,j=m(this.textRange,F,!1,!1,D.nodeInfo).boundaryPosition),this.setStart(x.node,x.offset),this.setEnd(j.node,j.offset)},V.prototype.getName=function(){return"WrappedTextRange"},ke.copyComparisonConstants(V);var E=function(x){if(x.collapsed)return C(new de(x.startContainer,x.startOffset),!0);var j=C(new de(x.startContainer,x.startOffset),!0),D=C(new de(x.endContainer,x.endOffset),!1),F=_e(ke.getRangeDocument(x)).createTextRange();return F.setEndPoint("StartToStart",j),F.setEndPoint("EndToEnd",D),F};if(V.rangeToTextRange=E,V.prototype.toTextRange=function(){return E(this)},T.WrappedTextRange=V,!T.features.implementsDomRange||T.config.preferTextRange){var R=(function(x){return x("return this;")()})(Function);typeof R.Range=="undefined"&&(R.Range=V),T.createNativeRange=function(x){return x=Me(x,H,"createNativeRange"),_e(x).createTextRange()},T.WrappedRange=V}}T.createRange=function(x){return x=Me(x,H,"createRange"),new T.WrappedRange(T.createNativeRange(x))},T.createRangyRange=function(x){return x=Me(x,H,"createRangyRange"),new ke(x)},ce.createAliasForDeprecatedMethod(T,"createIframeRange","createRange"),ce.createAliasForDeprecatedMethod(T,"createIframeRangyRange","createRangyRange"),T.addShimListener(function(x){var j=x.document;typeof j.createRange=="undefined"&&(j.createRange=function(){return T.createRange(j)}),j=x=null})}),G.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],function(T,H){T.config.checkSelectionRanges=!0;var I="boolean",V="number",ee=T.dom,ce=T.util,de=ce.isHostMethod,ke=T.DomRange,_e=T.WrappedRange,Me=T.DOMException,Ne=ee.DomPosition,He,ze,m=T.features,C="Control",E=ee.getDocument,R=ee.getBody,x=ke.rangesEqual;function j(f){return typeof f=="string"?/^backward(s)?$/i.test(f):!!f}function D(f,S){if(f){if(ee.isWindow(f))return f;if(f instanceof Te)return f.win;var P=ee.getContentDocument(f,H,S);return ee.getWindow(P)}else return window}function F(f){return D(f,"getWinSelection").getSelection()}function ae(f){return D(f,"getDocSelection").document.selection}function te(f){var S=!1;return f.anchorNode&&(S=ee.comparePoints(f.anchorNode,f.anchorOffset,f.focusNode,f.focusOffset)==1),S}var X=de(window,"getSelection"),Ce=ce.isHostObject(document,"selection");m.implementsWinGetSelection=X,m.implementsDocSelection=Ce;var ve=Ce&&(!X||T.config.preferTextRange);if(ve)He=ae,T.isSelectionValid=function(f){var S=D(f,"isSelectionValid").document,P=S.selection;return P.type!="None"||E(P.createRange().parentElement())==S};else if(X)He=F,T.isSelectionValid=function(){return!0};else return H.fail("Neither document.selection or window.getSelection() detected."),!1;T.getNativeSelection=He;var be=He();if(!be)return H.fail("Native selection was null (possibly issue 138?)"),!1;var We=T.createNativeRange(document),Y=R(document),ie=ce.areHostProperties(be,["anchorNode","focusNode","anchorOffset","focusOffset"]);m.selectionHasAnchorAndFocus=ie;var Ee=de(be,"extend");m.selectionHasExtend=Ee;var Ae=de(be,"setBaseAndExtent");m.selectionHasSetBaseAndExtent=Ae;var De=typeof be.rangeCount==V;m.selectionHasRangeCount=De;var at=!1,Xe=!0,Ge=Ee?function(f,S){var P=ke.getRangeDocument(S),Z=T.createRange(P);Z.collapseToPoint(S.endContainer,S.endOffset),f.addRange(re(Z)),f.extend(S.startContainer,S.startOffset)}:null;ce.areHostMethods(be,["addRange","getRangeAt","removeAllRanges"])&&typeof be.rangeCount==V&&m.implementsDomRange&&(function(){var f=window.getSelection();if(f){for(var S=f.rangeCount,P=S>1,Z=[],he=te(f),xe=0;xe<S;++xe)Z[xe]=f.getRangeAt(xe);var Pe=ee.createTestElement(document,"",!1),g=Pe.appendChild(document.createTextNode(" ")),N=document.createRange();if(N.setStart(g,1),N.collapse(!0),f.removeAllRanges(),f.addRange(N),Xe=f.rangeCount==1,f.removeAllRanges(),!P){var M=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(M&&parseInt(M[1])>=36)at=!1;else{var $=N.cloneRange();N.setStart(g,0),$.setEnd(g,3),$.setStart(g,2),f.addRange(N),f.addRange($),at=f.rangeCount==2}}for(ee.removeNode(Pe),f.removeAllRanges(),xe=0;xe<S;++xe)xe==0&&he?Ge?Ge(f,Z[xe]):(T.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),f.addRange(Z[xe])):f.addRange(Z[xe])}})(),m.selectionSupportsMultipleRanges=at,m.collapsedNonEditableSelectionsSupported=Xe;var Ue=!1,$e;Y&&de(Y,"createControlRange")&&($e=Y.createControlRange(),ce.areHostProperties($e,["item","add"])&&(Ue=!0)),m.implementsControlRange=Ue,ie?ze=function(f){return f.anchorNode===f.focusNode&&f.anchorOffset===f.focusOffset}:ze=function(f){return f.rangeCount?f.getRangeAt(f.rangeCount-1).collapsed:!1};function it(f,S,P){var Z=P?"end":"start",he=P?"start":"end";f.anchorNode=S[Z+"Container"],f.anchorOffset=S[Z+"Offset"],f.focusNode=S[he+"Container"],f.focusOffset=S[he+"Offset"]}function _(f){var S=f.nativeSelection;f.anchorNode=S.anchorNode,f.anchorOffset=S.anchorOffset,f.focusNode=S.focusNode,f.focusOffset=S.focusOffset}function q(f){f.anchorNode=f.focusNode=null,f.anchorOffset=f.focusOffset=0,f.rangeCount=0,f.isCollapsed=!0,f._ranges.length=0,fe(f)}function fe(f){f.type=f.rangeCount==0?"None":ze(f)?"Caret":"Range"}function re(f){var S;return f instanceof ke?(S=T.createNativeRange(f.getDocument()),S.setEnd(f.endContainer,f.endOffset),S.setStart(f.startContainer,f.startOffset)):f instanceof _e?S=f.nativeRange:m.implementsDomRange&&f instanceof ee.getWindow(f.startContainer).Range&&(S=f),S}function Oe(f){if(!f.length||f[0].nodeType!=1)return!1;for(var S=1,P=f.length;S<P;++S)if(!ee.isAncestorOf(f[0],f[S]))return!1;return!0}function Se(f){var S=f.getNodes();if(!Oe(S))throw H.createError("getSingleElementFromRange: range "+f.inspect()+" did not consist of a single element");return S[0]}function ht(f){return!!f&&typeof f.text!="undefined"}function st(f,S){var P=new _e(S);f._ranges=[P],it(f,P,!1),f.rangeCount=1,f.isCollapsed=P.collapsed,fe(f)}function Ve(f){if(f._ranges.length=0,f.docSelection.type=="None")q(f);else{var S=f.docSelection.createRange();if(ht(S))st(f,S);else{f.rangeCount=S.length;for(var P,Z=E(S.item(0)),he=0;he<f.rangeCount;++he)P=T.createRange(Z),P.selectNode(S.item(he)),f._ranges.push(P);f.isCollapsed=f.rangeCount==1&&f._ranges[0].collapsed,it(f,f._ranges[f.rangeCount-1],!1),fe(f)}}}function Ft(f,S){for(var P=f.docSelection.createRange(),Z=Se(S),he=E(P.item(0)),xe=R(he).createControlRange(),Pe=0,g=P.length;Pe<g;++Pe)xe.add(P.item(Pe));try{xe.add(Z)}catch(N){throw H.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}xe.select(),Ve(f)}var Et;de(be,"getRangeAt")?Et=function(f,S){try{return f.getRangeAt(S)}catch(P){return null}}:ie&&(Et=function(f){var S=E(f.anchorNode),P=T.createRange(S);return P.setStartAndEnd(f.anchorNode,f.anchorOffset,f.focusNode,f.focusOffset),P.collapsed!==this.isCollapsed&&P.setStartAndEnd(f.focusNode,f.focusOffset,f.anchorNode,f.anchorOffset),P});function Te(f,S,P){this.nativeSelection=f,this.docSelection=S,this._ranges=[],this.win=P,this.refresh()}Te.prototype=T.selectionPrototype;function zt(f){f.win=f.anchorNode=f.focusNode=f._ranges=null,f.rangeCount=f.anchorOffset=f.focusOffset=0,f.detached=!0,fe(f)}var bt=[];function Wt(f,S){for(var P=bt.length,Z,he;P--;)if(Z=bt[P],he=Z.selection,S=="deleteAll")zt(he);else if(Z.win==f)return S=="delete"?(bt.splice(P,1),!0):he;return S=="deleteAll"&&(bt.length=0),null}var _t=function(f){if(f&&f instanceof Te)return f.refresh(),f;f=D(f,"getNativeSelection");var S=Wt(f),P=He(f),Z=Ce?ae(f):null;return S?(S.nativeSelection=P,S.docSelection=Z,S.refresh()):(S=new Te(P,Z,f),bt.push({win:f,selection:S})),S};T.getSelection=_t,ce.createAliasForDeprecatedMethod(T,"getIframeSelection","getSelection");var ge=Te.prototype;function Rt(f,S){for(var P=E(S[0].startContainer),Z=R(P).createControlRange(),he=0,xe,Pe=S.length;he<Pe;++he){xe=Se(S[he]);try{Z.add(xe)}catch(g){throw H.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}Z.select(),Ve(f)}if(!ve&&ie&&ce.areHostMethods(be,["removeAllRanges","addRange"])){ge.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),q(this)};var Mt=function(f,S){Ge(f.nativeSelection,S),f.refresh()};De?ge.addRange=function(f,S){if(Ue&&Ce&&this.docSelection.type==C)Ft(this,f);else if(j(S)&&Ee)Mt(this,f);else{var P;at?P=this.rangeCount:(this.removeAllRanges(),P=0);var Z=re(f).cloneRange();try{this.nativeSelection.addRange(Z)}catch(xe){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==P+1){if(T.config.checkSelectionRanges){var he=Et(this.nativeSelection,this.rangeCount-1);he&&!x(he,f)&&(f=new _e(he))}this._ranges[this.rangeCount-1]=f,it(this,f,wt(this.nativeSelection)),this.isCollapsed=ze(this),fe(this)}else this.refresh()}}:ge.addRange=function(f,S){j(S)&&Ee?Mt(this,f):(this.nativeSelection.addRange(re(f)),this.refresh())},ge.setRanges=function(f){if(Ue&&Ce&&f.length>1)Rt(this,f);else{this.removeAllRanges();for(var S=0,P=f.length;S<P;++S)this.addRange(f[S])}}}else if(de(be,"empty")&&de(We,"select")&&Ue&&ve)ge.removeAllRanges=function(){try{if(this.docSelection.empty(),this.docSelection.type!="None"){var f;if(this.anchorNode)f=E(this.anchorNode);else if(this.docSelection.type==C){var S=this.docSelection.createRange();S.length&&(f=E(S.item(0)))}if(f){var P=R(f).createTextRange();P.select(),this.docSelection.empty()}}}catch(Z){}q(this)},ge.addRange=function(f){this.docSelection.type==C?Ft(this,f):(T.WrappedTextRange.rangeToTextRange(f).select(),this._ranges[0]=f,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,it(this,f,!1),fe(this))},ge.setRanges=function(f){this.removeAllRanges();var S=f.length;S>1?Rt(this,f):S&&this.addRange(f[0])};else return H.fail("No means of selecting a Range or TextRange was found"),!1;ge.getRangeAt=function(f){if(f<0||f>=this.rangeCount)throw new Me("INDEX_SIZE_ERR");return this._ranges[f].cloneRange()};var xt;if(ve)xt=function(f){var S;T.isSelectionValid(f.win)?S=f.docSelection.createRange():(S=R(f.win.document).createTextRange(),S.collapse(!0)),f.docSelection.type==C?Ve(f):ht(S)?st(f,S):q(f)};else if(de(be,"getRangeAt")&&typeof be.rangeCount==V)xt=function(f){if(Ue&&Ce&&f.docSelection.type==C)Ve(f);else if(f._ranges.length=f.rangeCount=f.nativeSelection.rangeCount,f.rangeCount){for(var S=0,P=f.rangeCount;S<P;++S)f._ranges[S]=new T.WrappedRange(f.nativeSelection.getRangeAt(S));it(f,f._ranges[f.rangeCount-1],wt(f.nativeSelection)),f.isCollapsed=ze(f),fe(f)}else q(f)};else if(ie&&typeof be.isCollapsed==I&&typeof We.collapsed==I&&m.implementsDomRange)xt=function(f){var S,P=f.nativeSelection;P.anchorNode?(S=Et(P,0),f._ranges=[S],f.rangeCount=1,_(f),f.isCollapsed=ze(f),fe(f)):q(f)};else return H.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;ge.refresh=function(f){var S=f?this._ranges.slice(0):null,P=this.anchorNode,Z=this.anchorOffset;if(xt(this),f){var he=S.length;if(he!=this._ranges.length||this.anchorNode!=P||this.anchorOffset!=Z)return!0;for(;he--;)if(!x(S[he],this._ranges[he]))return!0;return!1}};var Qt=function(f,S){var P=f.getAllRanges();f.removeAllRanges();for(var Z=0,he=P.length;Z<he;++Z)x(S,P[Z])||f.addRange(P[Z]);f.rangeCount||q(f)};Ue&&Ce?ge.removeRange=function(f){if(this.docSelection.type==C){for(var S=this.docSelection.createRange(),P=Se(f),Z=E(S.item(0)),he=R(Z).createControlRange(),xe,Pe=!1,g=0,N=S.length;g<N;++g)xe=S.item(g),xe!==P||Pe?he.add(S.item(g)):Pe=!0;he.select(),Ve(this)}else Qt(this,f)}:ge.removeRange=function(f){Qt(this,f)};var wt;!ve&&ie&&m.implementsDomRange?(wt=te,ge.isBackward=function(){return wt(this)}):wt=ge.isBackward=function(){return!1},ge.isBackwards=ge.isBackward,ge.toString=function(){for(var f=[],S=0,P=this.rangeCount;S<P;++S)f[S]=""+this._ranges[S];return f.join("")};function Nt(f,S){if(f.win.document!=E(S))throw new Me("WRONG_DOCUMENT_ERR")}function Gt(f,S){if(S<0||S>(ee.isCharacterDataNode(f)?f.length:f.childNodes.length))throw new Me("INDEX_SIZE_ERR")}ge.collapse=function(f,S){Nt(this,f);var P=T.createRange(f);P.collapseToPoint(f,S),this.setSingleRange(P),this.isCollapsed=!0},ge.collapseToStart=function(){if(this.rangeCount){var f=this._ranges[0];this.collapse(f.startContainer,f.startOffset)}else throw new Me("INVALID_STATE_ERR")},ge.collapseToEnd=function(){if(this.rangeCount){var f=this._ranges[this.rangeCount-1];this.collapse(f.endContainer,f.endOffset)}else throw new Me("INVALID_STATE_ERR")},ge.selectAllChildren=function(f){Nt(this,f);var S=T.createRange(f);S.selectNodeContents(f),this.setSingleRange(S)},Ae?ge.setBaseAndExtent=function(f,S,P,Z){this.nativeSelection.setBaseAndExtent(f,S,P,Z),this.refresh()}:Ee&&(ge.setBaseAndExtent=function(f,S,P,Z){Gt(f,S),Gt(P,Z),Nt(this,f),Nt(this,P);var he=T.createRange(node),xe=ee.comparePoints(f,S,P,Z)==-1;xe?he.setStartAndEnd(P,Z,f,S):he.setStartAndEnd(f,S,P,Z),this.setSingleRange(he,xe)}),ge.deleteFromDocument=function(){if(Ue&&Ce&&this.docSelection.type==C){for(var f=this.docSelection.createRange(),S;f.length;)S=f.item(0),f.remove(S),ee.removeNode(S);this.refresh()}else if(this.rangeCount){var P=this.getAllRanges();if(P.length){this.removeAllRanges();for(var Z=0,he=P.length;Z<he;++Z)P[Z].deleteContents();this.addRange(P[he-1])}}},ge.eachRange=function(f,S){for(var P=0,Z=this._ranges.length;P<Z;++P)if(f(this.getRangeAt(P)))return S},ge.getAllRanges=function(){var f=[];return this.eachRange(function(S){f.push(S)}),f},ge.setSingleRange=function(f,S){this.removeAllRanges(),this.addRange(f,S)},ge.callMethodOnEachRange=function(f,S){var P=[];return this.eachRange(function(Z){P.push(Z[f].apply(Z,S||[]))}),P};function Ut(f){return function(S,P){var Z;this.rangeCount?(Z=this.getRangeAt(0),Z["set"+(f?"Start":"End")](S,P)):(Z=T.createRange(this.win.document),Z.setStartAndEnd(S,P)),this.setSingleRange(Z,this.isBackward())}}ge.setStart=Ut(!0),ge.setEnd=Ut(!1),T.rangePrototype.select=function(f){_t(this.getDocument()).setSingleRange(this,f)},ge.changeEachRange=function(f){var S=[],P=this.isBackward();this.eachRange(function(Z){f(Z),S.push(Z)}),this.removeAllRanges(),P&&S.length==1?this.addRange(S[0],"backward"):this.setRanges(S)},ge.containsNode=function(f,S){return this.eachRange(function(P){return P.containsNode(f,S)},!0)||!1},ge.getBookmark=function(f){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[f])}},ge.moveToBookmark=function(f){for(var S=[],P=0,Z,he;Z=f.rangeBookmarks[P++];)he=T.createRange(this.win),he.moveToBookmark(Z),S.push(he);f.backward?this.setSingleRange(S[0],"backward"):this.setRanges(S)},ge.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},ge.restoreRanges=function(f){this.removeAllRanges();for(var S=0,P;P=f.ranges[S];++S)this.addRange(P,f.backward&&S==0)},ge.toHtml=function(){var f=[];return this.eachRange(function(S){f.push(ke.toHtml(S))}),f.join("")},m.implementsTextRange&&(ge.getNativeTextRange=function(){var f;if(f=this.docSelection){var S=f.createRange();if(ht(S))return S;throw H.createError("getNativeTextRange: selection is a control selection")}else{if(this.rangeCount>0)return T.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw H.createError("getNativeTextRange: selection contains no range")}});function Dt(f){var S=[],P=new Ne(f.anchorNode,f.anchorOffset),Z=new Ne(f.focusNode,f.focusOffset),he=typeof f.getName=="function"?f.getName():"Selection";if(typeof f.rangeCount!="undefined")for(var xe=0,Pe=f.rangeCount;xe<Pe;++xe)S[xe]=ke.inspect(f.getRangeAt(xe));return"["+he+"(Ranges: "+S.join(", ")+")(anchor: "+P.inspect()+", focus: "+Z.inspect()+"]"}ge.getName=function(){return"WrappedSelection"},ge.inspect=function(){return Dt(this)},ge.detach=function(){Wt(this.win,"delete"),zt(this)},Te.detachAll=function(){Wt(null,"deleteAll")},Te.inspect=Dt,Te.isDirectionBackward=j,T.Selection=Te,T.selectionPrototype=ge,T.addShimListener(function(f){typeof f.getSelection=="undefined"&&(f.getSelection=function(){return _t(f)}),f=null})});var Ke=!1,nt=function(T){Ke||(Ke=!0,!G.initialized&&G.config.autoInitialize&&A())};return K&&(document.readyState=="complete"?nt():(l(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",nt,!1),tt(window,"load",nt))),G})})($i)),$i.exports}var Ya=Lo();const Ki=go(Ya);var Xi={exports:{}},Vi;function Za(){return Vi||(Vi=1,(function(r,e){(function(t,n){r.exports=t(Lo())})(function(t){return t.createModule("ClassApplier",["WrappedSelection"],function(n,i){var o=n.dom,s=o.DomPosition,c=o.arrayContains,a=n.util,l=a.forEach,d="span",u=a.isHostMethod(document,"createElementNS");function h(m,C){for(var E in m)if(m.hasOwnProperty(E)&&C(E,m[E])===!1)return!1;return!0}function p(m){return m.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function v(m,C){return!!m&&new RegExp("(?:^|\\s)"+C+"(?:\\s|$)").test(m)}function y(m,C){if(typeof m.classList=="object")return m.classList.contains(C);var E=typeof m.className=="string",R=E?m.className:m.getAttribute("class");return v(R,C)}function b(m,C){if(typeof m.classList=="object")m.classList.add(C);else{var E=typeof m.className=="string",R=E?m.className:m.getAttribute("class");R?v(R,C)||(R+=" "+C):R=C,E?m.className=R:m.setAttribute("class",R)}}var k=(function(){function m(C,E,R){return E&&R?" ":""}return function(C,E){if(typeof C.classList=="object")C.classList.remove(E);else{var R=typeof C.className=="string",x=R?C.className:C.getAttribute("class");x=x.replace(new RegExp("(^|\\s)"+E+"(\\s|$)"),m),R?C.className=x:C.setAttribute("class",x)}}})();function B(m){var C=typeof m.className=="string";return C?m.className:m.getAttribute("class")}function W(m){return m&&m.split(/\s+/).sort().join(" ")}function K(m){return W(B(m))}function le(m,C){return K(m)==K(C)}function G(m,C){for(var E=C.split(/\s+/),R=0,x=E.length;R<x;++R)if(!y(m,p(E[R])))return!1;return!0}function L(m){var C=m.parentNode;return C&&C.nodeType==1&&!/^(textarea|style|script|select|iframe)$/i.test(C.nodeName)}function ue(m,C,E,R,x){var j=m.node,D=m.offset,F=j,ae=D;j==R&&D>x&&++ae,j==C&&(D==E||D==E+1)&&(F=R,ae+=x-E),j==C&&D>E+1&&--ae,m.node=F,m.offset=ae}function Q(m,C,E){m.node==C&&m.offset>E&&--m.offset}function je(m,C,E,R){E==-1&&(E=C.childNodes.length);var x=m.parentNode,j=o.getNodeIndex(m);l(R,function(D){ue(D,x,j,C,E)}),C.childNodes.length==E?C.appendChild(m):C.insertBefore(m,C.childNodes[E])}function Le(m,C){var E=m.parentNode,R=o.getNodeIndex(m);l(C,function(x){Q(x,E,R)}),o.removeNode(m)}function tt(m,C,E,R,x){for(var j,D=[];j=m.firstChild;)je(j,C,E++,x),D.push(j);return Le(m,x),D}function w(m,C){return tt(m,m.parentNode,o.getNodeIndex(m),!0,C)}function O(m,C){var E=m.cloneRange();E.selectNodeContents(C);var R=E.intersection(m),x=R?R.toString():"";return x!=""}function A(m){for(var C=m.getNodes([3]),E=0,R;(R=C[E])&&!O(m,R);)++E;for(var x=C.length-1;(R=C[x])&&!O(m,R);)--x;return C.slice(E,x+1)}function U(m,C){if(m.attributes.length!=C.attributes.length)return!1;for(var E=0,R=m.attributes.length,x,j,D;E<R;++E)if(x=m.attributes[E],D=x.name,D!="class"&&(j=C.attributes.getNamedItem(D),x===null!=(j===null)||x.specified!=j.specified||x.specified&&x.nodeValue!==j.nodeValue))return!1;return!0}function pe(m,C){for(var E=0,R=m.attributes.length,x;E<R;++E)if(x=m.attributes[E].name,!(C&&c(C,x))&&m.attributes[E].specified&&x!="class")return!0;return!1}var me=o.getComputedStyleProperty,Fe=(function(){var m=document.createElement("div");return typeof m.isContentEditable=="boolean"?function(C){return C&&C.nodeType==1&&C.isContentEditable}:function(C){return!C||C.nodeType!=1||C.contentEditable=="false"?!1:C.contentEditable=="true"||Fe(C.parentNode)}})();function Ie(m){var C;return m&&m.nodeType==1&&((C=m.parentNode)&&C.nodeType==9&&C.designMode=="on"||Fe(m)&&!Fe(m.parentNode))}function ut(m){return(Fe(m)||m.nodeType!=1&&Fe(m.parentNode))&&!Ie(m)}var ft=/^inline(-block|-table)?$/i;function yt(m){return m&&m.nodeType==1&&!ft.test(me(m,"display"))}var Ke=/[^\r\n\t\f \u200B]/;function nt(m){if(m.data.length==0)return!0;if(Ke.test(m.data))return!1;var C=me(m.parentNode,"whiteSpace");switch(C){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(m.data))return!1}return yt(m.previousSibling)||yt(m.nextSibling)}function T(m){var C=[],E,R;for(E=0;R=m[E++];)C.push(new s(R.startContainer,R.startOffset),new s(R.endContainer,R.endOffset));return C}function H(m,C){for(var E=0,R,x,j,D=m.length;E<D;++E)R=m[E],x=C[E*2],j=C[E*2+1],R.setStartAndEnd(x.node,x.offset,j.node,j.offset)}function I(m,C){return o.isCharacterDataNode(m)?C==0?!!m.previousSibling:C==m.length?!!m.nextSibling:!0:C>0&&C<m.childNodes.length}function V(m,C,E,R){var x,j,D=E==0;if(o.isAncestorOf(C,m))return m;if(o.isCharacterDataNode(C)){var F=o.getNodeIndex(C);if(E==0)E=F;else if(E==C.length)E=F+1;else throw i.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+E+" in "+C.data);C=C.parentNode}if(I(C,E)){x=C.cloneNode(!1),j=C.parentNode,x.id&&x.removeAttribute("id");for(var ae,te=0;ae=C.childNodes[E];)je(ae,x,te++,R);return je(x,j,o.getNodeIndex(C)+1,R),C==m?x:V(m,j,o.getNodeIndex(x),R)}else if(m!=C){x=C.parentNode;var X=o.getNodeIndex(C);return D||X++,V(m,x,X,R)}return m}function ee(m,C){return m.namespaceURI==C.namespaceURI&&m.tagName.toLowerCase()==C.tagName.toLowerCase()&&le(m,C)&&U(m,C)&&me(m,"display")=="inline"&&me(C,"display")=="inline"}function ce(m){var C=m?"nextSibling":"previousSibling";return function(E,R){var x=E.parentNode,j=E[C];if(j){if(j&&j.nodeType==3)return j}else if(R&&(j=x[C],j&&j.nodeType==1&&ee(x,j))){var D=j[m?"firstChild":"lastChild"];if(D&&D.nodeType==3)return D}return null}}var de=ce(!1),ke=ce(!0);function _e(m){this.isElementMerge=m.nodeType==1,this.textNodes=[];var C=this.isElementMerge?m.lastChild:m;C&&(this.textNodes[0]=C)}_e.prototype={doMerge:function(m){var C=this.textNodes,E=C[0];if(C.length>1){var R=o.getNodeIndex(E),x=[],j=0,D;l(C,function(F,ae){D=F.parentNode,ae>0&&(D.removeChild(F),D.hasChildNodes()||o.removeNode(D),m&&l(m,function(te){te.node==F&&(te.node=E,te.offset+=j),te.node==D&&te.offset>R&&(--te.offset,te.offset==R+1&&ae<C.length-1&&(te.node=E,te.offset=j))})),x[ae]=F.data,j+=F.data.length}),E.data=x.join("")}return E.data},getLength:function(){for(var m=this.textNodes.length,C=0;m--;)C+=this.textNodes[m].length;return C},toString:function(){var m=[];return l(this.textNodes,function(C,E){m[E]="'"+C.data+"'"}),"[Merge("+m.join(",")+")]"}};var Me=["elementTagName","ignoreWhiteSpace","applyToEditableOnly","useExistingElements","removeEmptyElements","onElementCreate"],Ne={};function He(m,C,E){var R,x,j,D,F=this;F.cssClass=F.className=m;var ae=null,te={};if(typeof C=="object"&&C!==null){for(typeof C.elementTagName!="undefined"&&(C.elementTagName=C.elementTagName.toLowerCase()),E=C.tagNames,ae=C.elementProperties,te=C.elementAttributes,x=0;D=Me[x++];)C.hasOwnProperty(D)&&(F[D]=C[D]);R=C.normalize}else R=C;F.normalize=typeof R=="undefined"?!0:R,F.attrExceptions=[];var X=document.createElement(F.elementTagName);F.elementProperties=F.copyPropertiesToElement(ae,X,!0),h(te,function(ve,be){F.attrExceptions.push(ve),te[ve]=""+be}),F.elementAttributes=te,F.elementSortedClassName=F.elementProperties.hasOwnProperty("className")?W(F.elementProperties.className+" "+m):m,F.applyToAnyTagName=!1;var Ce=typeof E;if(Ce=="string")E=="*"?F.applyToAnyTagName=!0:F.tagNames=p(E.toLowerCase()).split(/\s*,\s*/);else if(Ce=="object"&&typeof E.length=="number")for(F.tagNames=[],x=0,j=E.length;x<j;++x)E[x]=="*"?F.applyToAnyTagName=!0:F.tagNames.push(E[x].toLowerCase());else F.tagNames=[F.elementTagName]}He.prototype={elementTagName:d,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(m,C,E){var R,x,j={},D,F,ae,te;for(var X in m)if(m.hasOwnProperty(X))if(F=m[X],ae=C[X],X=="className")b(C,F),b(C,this.className),C[X]=W(C[X]),E&&(j[X]=F);else if(X=="style"){x=ae,E&&(j[X]=D={});for(R in m[X])m[X].hasOwnProperty(R)&&(x[R]=F[R],E&&(D[R]=x[R]));this.attrExceptions.push(X)}else C[X]=F,E&&(j[X]=C[X],te=Ne.hasOwnProperty(X)?Ne[X]:X,this.attrExceptions.push(te));return E?j:""},copyAttributesToElement:function(m,C){for(var E in m)m.hasOwnProperty(E)&&!/^class(?:Name)?$/i.test(E)&&C.setAttribute(E,m[E])},appliesToElement:function(m){return c(this.tagNames,m.tagName.toLowerCase())},getEmptyElements:function(m){var C=this;return m.getNodes([1],function(E){return C.appliesToElement(E)&&!E.hasChildNodes()})},hasClass:function(m){return m.nodeType==1&&(this.applyToAnyTagName||this.appliesToElement(m))&&y(m,this.className)},getSelfOrAncestorWithClass:function(m){for(;m;){if(this.hasClass(m))return m;m=m.parentNode}return null},isModifiable:function(m){return!this.applyToEditableOnly||ut(m)},isIgnorableWhiteSpaceNode:function(m){return this.ignoreWhiteSpace&&m&&m.nodeType==3&&nt(m)},postApply:function(m,C,E,R){var x=m[0],j=m[m.length-1],D=[],F,ae=x,te=j,X=0,Ce=j.length,ve;l(m,function(ie){ve=de(ie,!R),ve?(F||(F=new _e(ve),D.push(F)),F.textNodes.push(ie),ie===x&&(ae=F.textNodes[0],X=ae.length),ie===j&&(te=F.textNodes[0],Ce=F.getLength())):F=null});var be=ke(j,!R);if(be&&(F||(F=new _e(j),D.push(F)),F.textNodes.push(be)),D.length){for(var We=0,Y=D.length;We<Y;++We)D[We].doMerge(E);C.setStartAndEnd(ae,X,te,Ce)}},createContainer:function(m){var C=o.getDocument(m),E=u&&!o.isHtmlNamespace(m)&&m.namespaceURI?C.createElementNS(m.namespaceURI,this.elementTagName):C.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,E,!1),this.copyAttributesToElement(this.elementAttributes,E),b(E,this.className),this.onElementCreate&&this.onElementCreate(E,this),E},elementHasProperties:function(m,C){var E=this;return h(C,function(R,x){if(R=="className")return G(m,x);if(typeof x=="object"){if(!E.elementHasProperties(m[R],x))return!1}else if(m[R]!==x)return!1})},elementHasAttributes:function(m,C){return h(C,function(E,R){if(m.getAttribute(E)!==R)return!1})},applyToTextNode:function(m,C){if(L(m)){var E=m.parentNode;if(E.childNodes.length==1&&this.useExistingElements&&this.appliesToElement(E)&&this.elementHasProperties(E,this.elementProperties)&&this.elementHasAttributes(E,this.elementAttributes))b(E,this.className);else{var R=m.parentNode,x=this.createContainer(R);R.insertBefore(x,m),x.appendChild(m)}}},isRemovable:function(m){return m.tagName.toLowerCase()==this.elementTagName&&K(m)==this.elementSortedClassName&&this.elementHasProperties(m,this.elementProperties)&&!pe(m,this.attrExceptions)&&this.elementHasAttributes(m,this.elementAttributes)&&this.isModifiable(m)},isEmptyContainer:function(m){var C=m.childNodes.length;return m.nodeType==1&&this.isRemovable(m)&&(C==0||C==1&&this.isEmptyContainer(m.firstChild))},removeEmptyContainers:function(m){var C=this,E=m.getNodes([1],function(j){return C.isEmptyContainer(j)}),R=[m],x=T(R);l(E,function(j){Le(j,x)}),H(R,x)},undoToTextNode:function(m,C,E,R){if(!C.containsNode(E)){var x=C.cloneRange();x.selectNode(E),x.isPointInRange(C.endContainer,C.endOffset)&&(V(E,C.endContainer,C.endOffset,R),C.setEndAfter(E)),x.isPointInRange(C.startContainer,C.startOffset)&&(E=V(E,C.startContainer,C.startOffset,R))}this.isRemovable(E)?w(E,R):k(E,this.className)},splitAncestorWithClass:function(m,C,E){var R=this.getSelfOrAncestorWithClass(m);R&&V(R,m,C,E)},undoToAncestor:function(m,C){this.isRemovable(m)?w(m,C):k(m,this.className)},applyToRange:function(m,C){var E=this;C=C||[];var R=T(C||[]);m.splitBoundariesPreservingPositions(R),E.removeEmptyElements&&E.removeEmptyContainers(m);var x=A(m);if(x.length){l(x,function(F){!E.isIgnorableWhiteSpaceNode(F)&&!E.getSelfOrAncestorWithClass(F)&&E.isModifiable(F)&&E.applyToTextNode(F,R)});var j=x[x.length-1];m.setStartAndEnd(x[0],0,j,j.length),E.normalize&&E.postApply(x,m,R,!1),H(C,R)}var D=E.getEmptyElements(m);l(D,function(F){b(F,E.className)})},applyToRanges:function(m){for(var C=m.length;C--;)this.applyToRange(m[C],m);return m},applyToSelection:function(m){var C=n.getSelection(m);C.setRanges(this.applyToRanges(C.getAllRanges()))},undoToRange:function(m,C){var E=this;C=C||[];var R=T(C);m.splitBoundariesPreservingPositions(R),E.removeEmptyElements&&E.removeEmptyContainers(m,R);var x=A(m),j,D,F=x[x.length-1];if(x.length){E.splitAncestorWithClass(m.endContainer,m.endOffset,R),E.splitAncestorWithClass(m.startContainer,m.startOffset,R);for(var ae=0,te=x.length;ae<te;++ae)j=x[ae],D=E.getSelfOrAncestorWithClass(j),D&&E.isModifiable(j)&&E.undoToAncestor(D,R);m.setStartAndEnd(x[0],0,F,F.length),E.normalize&&E.postApply(x,m,R,!0),H(C,R)}var X=E.getEmptyElements(m);l(X,function(Ce){k(Ce,E.className)})},undoToRanges:function(m){for(var C=m.length;C--;)this.undoToRange(m[C],m);return m},undoToSelection:function(m){var C=n.getSelection(m),E=n.getSelection(m).getAllRanges();this.undoToRanges(E),C.setRanges(E)},isAppliedToRange:function(m){if(m.collapsed||m.toString()=="")return!!this.getSelfOrAncestorWithClass(m.commonAncestorContainer);var C=m.getNodes([3]);if(C.length){for(var E=0,R;R=C[E++];)if(!this.isIgnorableWhiteSpaceNode(R)&&O(m,R)&&this.isModifiable(R)&&!this.getSelfOrAncestorWithClass(R))return!1}return!0},isAppliedToRanges:function(m){var C=m.length;if(C==0)return!1;for(;C--;)if(!this.isAppliedToRange(m[C]))return!1;return!0},isAppliedToSelection:function(m){var C=n.getSelection(m);return this.isAppliedToRanges(C.getAllRanges())},toggleRange:function(m){this.isAppliedToRange(m)?this.undoToRange(m):this.applyToRange(m)},toggleSelection:function(m){this.isAppliedToSelection(m)?this.undoToSelection(m):this.applyToSelection(m)},getElementsWithClassIntersectingRange:function(m){var C=[],E=this;return m.getNodes([3],function(R){var x=E.getSelfOrAncestorWithClass(R);x&&!c(C,x)&&C.push(x)}),C},detach:function(){}};function ze(m,C,E){return new He(m,C,E)}He.util={hasClass:y,addClass:b,removeClass:k,getClass:B,hasSameClasses:le,hasAllClasses:G,replaceWithOwnChildren:w,elementsHaveSameNonClassAttributes:U,elementHasNonClassAttributes:pe,splitNodeAt:V,isEditableElement:Fe,isEditingHost:Ie,isEditable:ut},n.CssClassApplier=n.ClassApplier=He,n.createClassApplier=ze,a.createAliasForDeprecatedMethod(n,"createCssClassApplier","createClassApplier",i)}),t})})(Xi)),Xi.exports}Za();var Yi={toolbar:{allowMultiParagraphSelection:!0,buttons:["bold","colorpicker","italic","underline","strikethrough","quote","justifyLeft","justifyCenter","justifyRight","justifyFull","superscript","subscript","orderedlist","unorderedlist","pre","removeFormat","outdent","indent","h2","h3"],standardizeSelectionStart:!1,updateOnEmptySelection:!1},placeholder:{text:"请输入内容",hideOnClick:!0},disableEditing:!0};function Zi(r){var e,t,n=((e=r==null?void 0:r.extensions)===null||e===void 0?void 0:e.button)||((t=r==null?void 0:r.extensions)===null||t===void 0?void 0:t.button),i=(r==null?void 0:r.Extension)||(r==null?void 0:r.Extension),o=n||i;return o?o.extend({name:"colorpicker",tagNames:["mark"],contentDefault:"<b>Color</b>",aria:"Color Picker",action:"colorPicker",init:function(){var s=this,c,a;try{Ki.init()}catch(l){}try{(a=(c=n==null?void 0:n.prototype)===null||c===void 0?void 0:c.init)===null||a===void 0||a.call(this)}catch(l){}this.colorPicker=new Po({parent:this.button||void 0,color:"#000",onDone:function(l){var d,u,h,p,v;try{s.coloredText&&!((u=(d=s.coloredText).isAppliedToSelection)===null||u===void 0)&&u.call(d)&&s.coloredText.undoToSelection(),s.coloredText=Ki.createClassApplier("colored",{elementTagName:"span",elementProperties:{style:{color:l.hex}},normalize:!0}),s.coloredText.toggleSelection(),(p=(h=s.base)===null||h===void 0?void 0:h.checkContentChanged)===null||p===void 0||p.call(h),(v=s.setInactive)===null||v===void 0||v.call(s)}catch(y){}}})},getButton:function(){return this.button},handleClick:function(){var s,c,a;(s=this.setActive)===null||s===void 0||s.call(this),(a=(c=this.colorPicker)===null||c===void 0?void 0:c.show)===null||a===void 0||a.call(c)},isAlreadyApplied:function(s){var c,a;return((a=(c=s==null?void 0:s.nodeName)===null||c===void 0?void 0:c.toLowerCase)===null||a===void 0?void 0:a.call(c))==="mark"},isActive:function(){var s,c;return(c=(s=this.button)===null||s===void 0?void 0:s.classList)===null||c===void 0?void 0:c.contains("medium-editor-button-active")},setInactive:function(){var s,c;(c=(s=this.button)===null||s===void 0?void 0:s.classList)===null||c===void 0||c.remove("medium-editor-button-active")},setActive:function(){var s,c;(c=(s=this.button)===null||s===void 0?void 0:s.classList)===null||c===void 0||c.add("medium-editor-button-active")}}):(function(){function s(){}return s})()}var Qa=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Ja=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(s=r[c])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Qi=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},Ji=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))};(function(r){Qa(e,r);function e(t){var n=r.call(this,t)||this;n.labelMap=new Map;var i=t.lf,o=t.graphModel;return n.lf=i,n.graphModel=o,n.state={tick:0},n}return e.prototype.componentDidMount=function(){var t=this,n=this.props.graphModel;this.editor=new on(".lf-label-editor",ui(Yi,{autoLink:!0,extensions:{colorPicker:new(Zi(on))}})),n.eventCenter.on("text:update,node:mousemove,node:resize,node:rotate,node:drag,label:drop,node:drop",function(){}),n.eventCenter.on("node:properties-change,node:properties-delete",function(){t.setState({tick:t.state.tick+1})})},e.prototype.componentDidUpdate=function(){var t;this.editor&&this.editor.elements.length>0?this.editor.addElements(".lf-label-editor"):((t=this.editor)===null||t===void 0||t.destroy(),this.editor=new on(".lf-label-editor",ui(Yi,{autoLink:!0,extensions:{colorPicker:new(Zi(on))}})))},e.prototype.componentWillUnmount=function(){var t;(t=this.editor)===null||t===void 0||t.destroy()},e.prototype.getLabels=function(){var t=this,n=this.props,i=n.lf.extension,o=n.graphModel,s=Ji(Ji([],Qi(o.nodes),!1),Qi(o.edges),!1),c=i.label;if(c){var a=[];return Re(s,function(l){var d,u,h=l.getData(),p=(u=(d=h.properties)===null||d===void 0?void 0:d._label)!==null&&u!==void 0?u:[];Re(p,function(v){var y=t.labelMap,b=new Fa(v,l,o);y.set(b.id,b),a.push(Be(ja,{label:b,element:l,graphModel:o},b.id))})}),a}return null},e.prototype.render=function(){return Be("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},e.toolName="label-edit-tool",e=Ja([co],e),e})(An);var Io=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),jt=function(){return jt=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},jt.apply(this,arguments)},Yt=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},es={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function ts(r){for(var e=r,t=1;t<e.length-1;){var n=Yt(e[t-1],2),i=n[0],o=n[1],s=Yt(e[t],2),c=s[0],a=s[1],l=Yt(e[t+1],2),d=l[0],u=l[1];i===c&&c===d||o===a&&a===u?e.splice(t,1):t++}return e}function ns(r,e,t,n){var i=[r[0],r[1]],o=[r[0],r[1]];switch(t){case"tl":return e==="tr"?(i[1]+=n,o[0]+=n):e==="lb"&&(i[0]+=n,o[1]+=n),[i,o];case"tr":return e==="tl"?(i[1]+=n,o[0]-=n):e==="rb"&&(i[0]-=n,o[1]+=n),[i,o];case"bl":return e==="br"?(i[1]-=n,o[0]+=n):e==="lt"&&(i[0]+=n,o[1]-=n),[i,o];case"br":return e==="bl"?(i[1]-=n,o[0]-=n):e==="rt"&&(i[0]-=n,o[1]-=n),[i,o];default:return[]}}function is(r,e,t,n){var i,o=1,s="",c="";Math.abs(r[0]-e[0])<=o?s=r[1]>e[1]?"t":"b":Math.abs(r[1]-e[1])<=o&&(s=r[0]>e[0]?"l":"r"),Math.abs(e[0]-t[0])<=o?c=e[1]>t[1]?"t":"b":Math.abs(e[1]-t[1])<=o&&(c=e[0]>t[0]?"l":"r");var a=Math.min(Math.hypot(e[0]-r[0],e[1]-r[1])/2,Math.hypot(t[0]-e[0],t[1]-e[1])/2,n)||1/5*n,l="".concat(s).concat(c),d=es[l]||"-",u="L ".concat(r[0]," ").concat(r[1]);if(d==="-")u+="L ".concat(e[0]," ").concat(e[1]," L ").concat(t[0]," ").concat(t[1]);else{var h=Yt(ns(e,l,d,a),2),p=h[0],v=h[1];p&&v&&(u+="L ".concat(p[0]," ").concat(p[1]," Q ").concat(e[0]," ").concat(e[1]," ").concat(v[0]," ").concat(v[1]),i=Yt(v,2),e[0]=i[0],e[1]=i[1])}return u}function os(r,e){var t=0,n="";if(r.length===2)n+="M".concat(r[t][0]," ").concat(r[t++][1]," L ").concat(r[t][0]," ").concat(r[t][1]);else{for(n+="M".concat(r[t][0]," ").concat(r[t++][1]);t+1<r.length;){var i=r[t-1],o=r[t],s=r[t+++1];n+=is(i,o,s,e)}n+="L ".concat(r[t][0]," ").concat(r[t][1])}return n}(function(r){Io(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEdge=function(){var t=this.props.model,n=t.points,i=t.isAnimation,o=t.arrowConfig,s=t.radius,c=s===void 0?5:s,a=t.getEdgeStyle(),l=t.getEdgeAnimationStyle(),d=ts(n.split(" ").map(function(p){return p.split(",").map(function(v){return+v})})),u=os(d,c),h=jt(jt(jt({style:i?l:{}},a),o),{fill:"none"});return ne("path",jt({d:u},h))},e})(Jn);(function(r){Io(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e})(Qn);var Bo=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Nn=function(){return Nn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Nn.apply(this,arguments)},eo=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o},to=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))},rs=(function(r){Bo(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getLabelShape=function(){var t=this.props.model,n=t.id,i=t.x,o=t.y,s=t.width,c=t.height,a=t.properties,l=this.props.model.getNodeStyle();return ne("svg",{x:i-s/2,y:o-c/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[a.labelText?ne("text",{x:0,y:-5,fontSize:"16px",fill:l.stroke},a.labelText):"",a.disabledDelete?"":ne("text",{x:a.labelText?50:0,y:-5,fontSize:"24px",cursor:"pointer",fill:l.stroke,onclick:this.handleCustomDeleteIconClick.bind(this,n)},"x")])},e.prototype.getShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,s=t.height,c=t.id,a=this.props.model.getNodeStyle();return ne("g",{},[ne("rect",Nn(Nn({},a),{x:n-o/2,y:i-s/2,width:o,height:s,id:c})),this.getLabelShape()])},e.prototype.toFront=function(){},e.prototype.handleCustomDeleteIconClick=function(t){var n=this.props.graphModel;n.deleteNode(t)},e})(ao),as=(function(r){Bo(e,r);function e(){var t=r.apply(this,to([],eo(arguments),!1))||this;return t.d=10,t.isResize=!1,t}return e.prototype.initNodeData=function(t){t.text={value:"",x:t.x,y:t.y,draggable:!1,editable:!1},r.prototype.initNodeData.call(this,t),this.zIndex=0,this.draggable=!0},e.prototype.setAttributes=function(){var t=this,n;this.points=[],((n=this.properties)===null||n===void 0?void 0:n.node_selection_ids).length>1&&setTimeout(function(){var i;t.updatePointsByNodes(((i=t.properties)===null||i===void 0?void 0:i.node_selection_ids)||[])})},e.prototype.getNodeStyle=function(){var t=r.prototype.getNodeStyle.call(this);return t.stroke=this.properties.strokeColor||"#008000",t.strokeDasharray="10 5",t},e.prototype.getDefaultAnchor=function(){return[]},e.prototype.updatePoints=function(t){this.points=t},e.prototype.updateCoordinate=function(t){var n=t.x,i=t.y;this.x=n,this.y=i},e.prototype.updatePointsByNodes=function(t){var n=this,i=[],o=1/0,s=1/0,c=-1/0,a=-1/0;t.forEach(function(l){var d=n.graphModel.getNodeModelById(l);if(d){var u=d.width,h=d.height,p=d.x,v=d.y;o=Math.min(o,p-u/2-n.d),s=Math.min(s,v-h/2-n.d),c=Math.max(c,p+u/2+n.d),a=Math.max(a,v+h/2+n.d)}}),i.push([o,s],[c,s],[c,a],[o,a]),![o,s,c,a].some(function(l){return Math.abs(l)===1/0})&&(this.updatePoints(i),this.updateCoordinate({x:(c+o)/2,y:(a+s)/2}))},e.prototype.resize=function(t){var n;this.isResize=!0;for(var i=t.width,o=t.height,s={x:i/this.width,y:o/this.height},c=(this.properties.node_selection_ids||[]).slice(),a=[],l=new Set;c.length;){var d=c.shift(),u=(n=this.graphModel.nodesMap[d])===null||n===void 0?void 0:n.model;if(u){if(!cn(u)){a.push(u);continue}l.has(u.id)||(l.add(u.id),c.push.apply(c,to([],eo(u.properties.node_selection_ids||[]),!1)))}}var h={x:this.x-this.width/2,y:this.y-this.height/2},p=r.prototype.resize.call(this,t),v={x:this.x-this.width/2,y:this.y-this.height/2};return a.forEach(function(y){y.width=y.width*s.x,y.height=y.height*s.y;var b=(y.x-h.x)*s.x+v.x-y.x,k=(y.y-h.y)*s.y+v.y-y.y;y.move(b,k,!0)}),this.isResize=!1,p},e})(ro),Vn="node-selection";(function(){function r(e){var t=e.lf;this.selectNodes=[],this.d=10,this.lf=t,t.register({type:Vn,view:rs,model:as})}return Object.defineProperty(r.prototype,"selectNodesIds",{get:function(){return this.selectNodes.map(function(e){return e.id})},enumerable:!1,configurable:!0}),r.prototype.addNodeSelection=function(){var e=this.lf.addNode({type:"node-selection",text:"",properties:{node_selection_ids:this.selectNodesIds},x:0,y:0});e.updatePointsByNodes(this.selectNodesIds)},r.prototype.updateNodeSelection=function(){var e,t=this.getNodeSelection();t&&(this.lf.setProperties(t.id,{node_selection_ids:this.selectNodesIds}),(e=this.lf.getNodeModelById(t.id))===null||e===void 0||e.updatePointsByNodes(this.selectNodesIds))},r.prototype.getNodeSelection=function(){var e=this,t=this.selectNodesIds,n=this.lf.getGraphRawData(),i=t.filter(function(o){return o!==e.currentClickNode.id});return n.nodes.find(function(o){if(o.type==="node-selection"){var s=vr(o,"properties.node_selection_ids",[]);return i.every(function(c){return s.includes(c)})}return!1})},r.prototype.onNodeChange=function(e,t){var n=e.graphModel.nodes.filter(function(i){if(!cn(i))return!1;var o=i.properties.node_selection_ids||[];return o.includes(t.id)});Promise.resolve().then(function(){n.forEach(function(i){i.updatePointsByNodes(i.properties.node_selection_ids||[])})})},r.prototype.render=function(e){var t=this;this.lf=e,e.on("node:click",function(n){var i;if(!(!n.e.shiftKey||n.data.type===Vn)){t.currentClickNode=n.data;var o=!1;t.selectNodesIds.includes(n.data.id)&&((i=t.lf.getNodeModelById(n.data.id))===null||i===void 0||i.setSelected(!1),o=!0);var s=e.getSelectElements(!0).nodes;t.selectNodes=s,t.selectNodes.length===1?o?t.updateNodeSelection():t.addNodeSelection():t.selectNodes.length>1&&t.updateNodeSelection()}}),e.graphModel.addNodeMoveRules(function(n,i,o){if(t.onNodeChange(e,n),cn(n)&&!n.isResize){var s=n.properties.node_selection_ids||[];return e.graphModel.moveNodes(s,i,o,!0),!0}return!0}),e.graphModel.addNodeResizeRules(function(n){return cn(n)||t.onNodeChange(e,n),!0})},r.pluginName="node-selection",r})();var cn=function(r){return!!(r&&r.type===Vn)},ss=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Sn=function(){return Sn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Sn.apply(this,arguments)};(function(r){ss(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getLabelShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,s=t.height,c=t.properties;return ne("text",{x:n-o/2+5,y:i-s/2+16,fontSize:12,fill:"blue"},c.moreText)},e.prototype.getShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,s=t.height,c=this.props.model.getNodeStyle();return ne("g",{},[ne("rect",Sn(Sn({},c),{fill:"#FFFFFF",x:n-o/2,y:i-s/2})),this.getLabelShape()])},e})(Zt);const jo="2 2 20 20",Ho=`
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="${jo}">
|
||
<path fill="currentColor" d="M17 13h-4v4h-2v-4H7v-2h4V7h2v4h4m-5-9A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2"/>
|
||
</svg>
|
||
`,ls=`
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="${jo}">
|
||
<path fill="currentColor" d="M12 20a8 8 0 0 1-8-8a8 8 0 0 1 8-8a8 8 0 0 1 8 8a8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2" />
|
||
</svg>
|
||
`,Yn=18,cs=Yn/2;class ds extends lr{constructor(e){super(e)}setHtml(e){const t=document.createElement("div");t.className=`${Wn}-content`,t.dataset.nodeId=this.props.model.id,this.root=t,e.appendChild(t),super.renderVueComponent()}confirmUpdate(e){}getAnchorShape(e){const{x:t,y:n,type:i,allowAdd:o}=e,s=i==="top",c=i==="left",a=typeof o=="boolean"?o:i==="right",l=(()=>{const u=c?"targetAnchorId":"sourceAnchorId";return this.props.graphModel.edges.some(h=>h[u]===e.id)})(),d=a?u=>{u.preventDefault(),u.stopPropagation(),this.props.graphModel.$J.doAction("toggle-add-node-drawer",{event:u,node:this.props.model,anchor:e})}:void 0;return ne("foreignObject",ti(ei({},e),{width:Yn,height:Yn,x:c||s?t-10:t-8,y:n-cs,style:{"pointer-events":a?void 0:"none"}}),[ne("div",{className:[`${Wn}-anchor`,`${c?"left":"right"}`,`${l?"has-edge":""}`,`${a?"has-add":""}`].join(" "),onClick:d,dangerouslySetInnerHTML:{__html:`${ls}${a?Ho:""}`}})])}}function us(r){const e={getActionRender:n.bind(r),getActionShape:t.bind(r)};function t(){if(this.props.model.isDisabled)return ne("g",{});const{startPoint:i,endPoint:o}=this.props.model;return ne("foreignObject",{style:{},x:(i.x+o.x-en)/2+5,y:(i.y+o.y-en)/2+5,width:en,height:en},e.getActionRender())}function n(){const{isSilentMode:i}=this.props.graphModel.editConfigModel,o=i?!1:this.props.model.isHovered;return ne("div",{className:`${Wn}-edge-action ${o?"hover":""}`,onClick:s=>{s.preventDefault(),s.stopPropagation(),this.props.graphModel.deleteEdgeById(this.props.model.id),this.props.graphModel.$J.repaintGraph()},dangerouslySetInnerHTML:{__html:Ho}})}return e}class hs extends cr{constructor(){super(),this.$hook=us(this)}getEdge(){const e=super.getEdge(),t=this.props.model.isHovered,{isSilentMode:n}=this.props.graphModel.editConfigModel;return!n&&t&&(e.props.stroke="#1890ff"),e}getAppendWidth(){const e=this.$hook;return ne("g",{},super.getAppendWidth(),e.getActionShape())}getStartArrow(){return ne("g",{})}getEndArrow(){return ne("g",{})}toFront(){}}class ps extends dr{get isDisabled(){var e,t;return(t=(e=this.properties)==null?void 0:e.disabled)!=null?t:!1}initEdgeData(e){e.id||(e.id=uo()),super.initEdgeData(e)}getData(){return{id:this.id,type:this.type,sourceNodeId:this.sourceNodeId,targetNodeId:this.targetNodeId,sourceAnchorId:this.sourceAnchorId,targetAnchorId:this.targetAnchorId,pointsList:this.pointsList,properties:this.properties}}getEdgeStyle(){const e=super.getEdgeStyle();return e.stroke="#afafaf",e.strokeWidth=2,e}getOutlineStyle(){const e=super.getOutlineStyle();return e.stroke="none",e.hover&&(e.hover.stroke="none"),e}getEdgeAnimationStyle(){var e;const t=super.getEdgeAnimationStyle(),n=(e=this.properties)==null?void 0:e.runStatus;return n==="running"?t.stroke="#67b7ff":n==="success"?t.stroke="#52c41a":n==="fail"&&(t.stroke="#f5222d"),t}}const fs={type:"base-line-edge",view:hs,model:ps};class gs extends ii.view{constructor(e){super(e),this.$super=new ds(e)}getOperateIcon(){return ne("g",{})}get ref(){return this.$super.ref}set ref(e){this.$super.ref=e}get currentProperties(){return this.$super.currentProperties}set currentProperties(e){this.$super.currentProperties=e}get preProperties(){return this.$super.preProperties}set preProperties(e){this.$super.preProperties=e}get rootEl(){return this.$super.rootEl}setHtml(e){this.$super.setHtml.call(this,e)}shouldUpdate(){return this.$super.shouldUpdate.call(this)}componentDidMount(){this.$super.componentDidMount.call(this)}componentDidUpdate(){this.$super.componentDidUpdate.call(this)}componentWillUnmount(){this.$super.componentWillUnmount.call(this)}getShape(){return ne("g",{},[this.getAppendAreaShape(),this.$super.getShape.call(this),this.getOperateIcon()])}confirmUpdate(e){this.$super.confirmUpdate.call(this,e)}getAnchorShape(e){return this.$super.getAnchorShape.call(this,e)}get root(){return this.$super.root}set root(e){this.$super.root=e}get vm(){return this.$super.vm}set vm(e){this.$super.vm=e}getComponentContainer(){return this.$super.getComponentContainer.call(this)}targetId(){return this.$super.targetId.call(this)}renderVueComponent(){this.$super.renderVueComponent.call(this)}unmountVueComponent(){this.$super.unmountVueComponent.call(this)}unmount(){this.$super.unmount.call(this)}}const Zn=new Map;function qt(r){let e=Zn.get(r);return e||(e={},Zn.set(r,e)),e}function ms(r){var e;return r.id||(r.id=uo()),r.properties=ti(ei({},r.properties),{collapsible:!1,autoToFront:!1,transformWithContainer:!1,isRestrict:!0,autoResize:!0,children:(e=r.properties.children)!=null?e:[]}),r}class vs extends ii.model{constructor(e,t){super(ms(e),t),this.$super=new ur(e,t),this.sourceRules.push(...this.$super.sourceRules),this.targetRules.push(...this.$super.targetRules),this.setTempData()}get $children(){var e,t,n;return(n=(t=(e=this.$super)==null?void 0:e.properties)==null?void 0:t.children)!=null?n:[]}isAllowAppendIn(e){return this.$children.includes(e.id)}getOutlineStyle(){const e=super.getOutlineStyle();return e.stroke="none",e.hover&&(e.hover.stroke="none"),e}addChild(e){super.addChild(e);const t=[...this.$children];t.push(e),this.$super.properties.children=t,this.graphModel.$J.$groupUtils.recalcGroupSize(this.id)}removeChild(e){super.removeChild(e);const t=[...this.$children];this.$super.properties.children=t.filter(n=>n!==e),this.graphModel.$J.$groupUtils.recalcGroupSize(this.id)}getAddableOutlineStyle(){return{stroke:"none",fill:"transparent"}}get width(){var e,t;const n=qt(this);return(t=(e=this.$super)==null?void 0:e.width)!=null?t:n.width}set width(e){if(!this.$super){const t=qt(this);t.width=e;return}this.$super.width=e}get height(){var e,t;const n=qt(this);return(t=(e=this.$super)==null?void 0:e.height)!=null?t:n.height}set height(e){if(!this.$super){const t=qt(this);t.height=e;return}this.$super.height=e}get nodeConfig(){var e;return(e=this.$super)==null?void 0:e.nodeConfig}getDefaultAnchor(){return this.$super.getDefaultAnchor.call(this)}getAnchorLineStyle(...e){return this.$super.getAnchorLineStyle.call(this,...e)}setAttributes(){var e,t;return((t=(e=this.$super)==null?void 0:e.setAttributes)!=null?t:super.setAttributes).call(this)}getNodeStyle(){var e,t;return((t=(e=this.$super)==null?void 0:e.getNodeStyle)!=null?t:super.getNodeStyle).call(this)}setTempData(){const e=qt(this);Object.keys(e).forEach(t=>{this[t]=e[t]}),Zn.delete(this)}}const Fn=320,zn=240,ys=br({__name:"LoopBodyNode",props:{node:{},graph:{}},setup(r){const e=r,t=Dn(),n=_r(),i=Dn(Fn),o=Dn(zn),{containerRef:s,containerProps:c,$node:a,runStatus:l}=Or(e,{hideAction:!0,addNodeDialogConfig:{addPayload:{edgeType:fs.type},offset:{showTop:0,showRight:300}},updateHeightImmediate:!1,disableResizeListener:!0,listenForeignObjectResize:!0,onParentResize(h){i.value=h.width,i.value<Fn&&(i.value=Fn),o.value=h.height,o.value<zn&&(o.value=zn),e.node.setProperties({width:i.value,height:o.value})},addNodeIsShow:h=>Es(h)}),d=wr(()=>{var h;return zo((h=a.value)==null?void 0:h.id)});function u(){return n.nodeSteps.find(h=>h.node.id===d.value)}return Er(()=>{const{graph:h,node:p}=e,v=h.getNodeEdges(p.id),y=l.value[0];for(const b of v)y&&y!=="waiting"?b.openEdgeAnimation():b.closeEdgeAnimation()}),xr(()=>{}),(h,p)=>(Nr(),Cr(hi(Go),Sr({ref_key:"containerRef",ref:s,class:"loop-body-node",width:i.value,runGetStepFn:u},hi(c)),{default:Tr(()=>[Ar("div",{ref_key:"contentRef",ref:t,style:kr({width:"100%",height:o.value-50-16+"px",backgroundColor:"transparent",position:"relative",borderRadius:"8px",pointerEvents:"none"})},null,4)]),_:1},16,["width"]))}});class bs extends gs{}class ws extends vs{}const no={type:Bt.LOOP_BODY,label:"循环体",components:{icon:yr,setting:Uo},lfNode:{type:Bt.LOOP_BODY,view:bs,model:ws,component:ys},params:{width:320,height:240},methods:{createNode:Fo,getDefaultAnchor(r){const e=r.find(n=>n.type==="left"),t=r.find(n=>n.type==="right");return[{id:`${this.id}_${kt.LINK_LOOP}`,type:kt.LINK_LOOP,x:this.x,y:this.y-this.height/2},{id:`${this.id}_${kt.LOOP_START}`,type:kt.LOOP_START,allowAdd:!0,x:e.x+30,y:this.y+25},{id:`${this.id}_${kt.LOOP_END}`,type:kt.LOOP_END,allowAdd:!1,x:t.x-30,y:this.y+25}]}},hooks:{beforeRemoveNode(){return!1}}};function Fo(r){var e;const{loopNodeId:t}=r;return{id:t+ho,type:no.type,x:r.x,y:r.y,properties:{text:(e=r.text)!=null?e:no.label,options:{},inputParams:[],outputParams:[]}}}const Cs=qo();function Es(r){return r===Bt.LOOP||r===Bt.END?!1:r===Bt.LOOP_CONTINUE||r===Bt.LOOP_BREAK?!0:$o.isShow(r)}function Ls(r){const e=Cs.nodeGroupMap.get(r);return zo(e)}function zo(r){if(r)return r.slice(0,-ho.length)}const xs=320;function Is(r,e){if(!r||!e)return;const t=r.id,n={x:r.x,y:r.y+r.height+xs},i=Fo(ti(ei({},n),{loopNodeId:t})),o=e.addNode(i),s=`${t}_${hr.LINK_BODY}`,c=`${o.id}_${kt.LINK_LOOP}`;setTimeout(()=>{e.addEdge({sourceNodeId:t,sourceAnchorId:s,targetNodeId:o.id,targetAnchorId:c,properties:{disabled:!0}})},50)}export{Ps as B,Es as E,Is as F,Ls as H,us as c,ds as d,no as n,fs as p,ys as y};
|