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/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+"";if(e==="#comment")return St+n+"";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,""):" />")}else i+=St+n+"<".concat(e,">").concat(pn(String(r)),"");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=` `;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":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+" `:c="<"+r+s+">"+c+" `:c="<"+r+s+` /> `),c};Je.ObjTree.prototype.array_to_xml=function(r,e){for(var t=[],n=0;n":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)+" `};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;t0)&&!(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/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;t0)&&!(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.widthk||G.heightB){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.widthk/2||L.heightB/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.widthk/2||L.heightB/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;c0)&&!(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=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 `;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"):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," `):c="<".concat(r).concat(s,">").concat(c," `):c="<".concat(r).concat(s,` /> `)),c};et.ObjTree.prototype.array_to_xml=function(r,e){for(var t=[],n=0;n"):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)," `)};et.ObjTree.prototype.xml_escape=function(r){return r.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,"");if(e==="#comment")return"".concat(o,"");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,""):" />")}else i+="".concat(o,"<").concat(e,">").concat(r.toString(),"");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=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")}:{json:''.concat(n,"")}:{json:""}}},"bpmn:timerEventDefinition":{out:function(r){var e=r.properties,t=e.timerType,n=e.timerValue,i=e.definitionId,o=function(){return"').concat(n,"")};return{json:'".concat(o(),""):"/>")}},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;v0&&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){o0)&&!(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=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=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;t0)&&!(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;nPa){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(WQ.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=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=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;y1?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-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.startd.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;u0)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,""")},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==="

")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;du?(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;l0){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=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&&d0)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-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;a0&&(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",contentFA:''},italic:{name:"italic",action:"italic",aria:"italic",tagNames:["i","em"],style:{prop:"font-style",value:"italic"},useQueryState:!0,contentDefault:"I",contentFA:''},underline:{name:"underline",action:"underline",aria:"underline",tagNames:["u"],style:{prop:"text-decoration",value:"underline"},useQueryState:!0,contentDefault:"U",contentFA:''},strikethrough:{name:"strikethrough",action:"strikethrough",aria:"strike through",tagNames:["strike"],style:{prop:"text-decoration",value:"line-through"},useQueryState:!0,contentDefault:"A",contentFA:''},superscript:{name:"superscript",action:"superscript",aria:"superscript",tagNames:["sup"],contentDefault:"x1",contentFA:''},subscript:{name:"subscript",action:"subscript",aria:"subscript",tagNames:["sub"],contentDefault:"x1",contentFA:''},image:{name:"image",action:"image",aria:"image",tagNames:["img"],contentDefault:"image",contentFA:''},html:{name:"html",action:"html",aria:"evaluate html",tagNames:["iframe","object"],contentDefault:"html",contentFA:''},orderedlist:{name:"orderedlist",action:"insertorderedlist",aria:"ordered list",tagNames:["ol"],useQueryState:!0,contentDefault:"1.",contentFA:''},unorderedlist:{name:"unorderedlist",action:"insertunorderedlist",aria:"unordered list",tagNames:["ul"],useQueryState:!0,contentDefault:"",contentFA:''},indent:{name:"indent",action:"indent",aria:"indent",tagNames:[],contentDefault:"",contentFA:''},outdent:{name:"outdent",action:"outdent",aria:"outdent",tagNames:[],contentDefault:"",contentFA:''},justifyCenter:{name:"justifyCenter",action:"justifyCenter",aria:"center justify",tagNames:[],style:{prop:"text-align",value:"center"},contentDefault:"C",contentFA:''},justifyFull:{name:"justifyFull",action:"justifyFull",aria:"full justify",tagNames:[],style:{prop:"text-align",value:"justify"},contentDefault:"J",contentFA:''},justifyLeft:{name:"justifyLeft",action:"justifyLeft",aria:"left justify",tagNames:[],style:{prop:"text-align",value:"left"},contentDefault:"L",contentFA:''},justifyRight:{name:"justifyRight",action:"justifyRight",aria:"right justify",tagNames:[],style:{prop:"text-align",value:"right"},contentDefault:"R",contentFA:''},removeFormat:{name:"removeFormat",aria:"remove formatting",action:"removeFormat",contentDefault:"X",contentFA:''},quote:{name:"quote",action:"append-blockquote",aria:"blockquote",tagNames:["blockquote"],contentDefault:"",contentFA:''},pre:{name:"pre",action:"append-pre",aria:"preformatted text",tagNames:["pre"],contentDefault:"0101",contentFA:''},h1:{name:"h1",action:"append-h1",aria:"header type one",tagNames:["h1"],contentDefault:"H1",contentFA:'1'},h2:{name:"h2",action:"append-h2",aria:"header type two",tagNames:["h2"],contentDefault:"H2",contentFA:'2'},h3:{name:"h3",action:"append-h3",aria:"header type three",tagNames:["h3"],contentDefault:"H3",contentFA:'3'},h4:{name:"h4",action:"append-h4",aria:"header type four",tagNames:["h4"],contentDefault:"H4",contentFA:'4'},h5:{name:"h5",action:"append-h5",aria:"header type five",tagNames:["h5"],contentDefault:"H5",contentFA:'5'},h6:{name:"h6",action:"append-h6",aria:"header type six",tagNames:["h6"],contentDefault:"H6",contentFA:'6'}}})(),(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:"#",contentFA:'',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=[''];return n.push('',this.getEditorOption("buttonLabels")==="fontawesome"?'':this.formSaveLabel,""),n.push('',this.getEditorOption("buttonLabels")==="fontawesome"?'':this.formCloseLabel,""),this.targetCheckbox&&n.push('

','','","
"),this.customClassOption&&n.push('
','',"","
"),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'
'},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",vthis.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;d0&&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;h1;)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:'',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
':"✓",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.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:'',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.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.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]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g),""],[new RegExp(/|/g),""],[new RegExp(/
$/i),""],[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi),""],[new RegExp(/<\/b>(]*>)?$/gi),""],[new RegExp(/\s+<\/span>/g)," "],[new RegExp(/
/g),"
"],[new RegExp(/]*(font-style:italic;font-weight:(bold|700)|font-weight:(bold|700);font-style:italic)[^>]*>/gi),''],[new RegExp(/]*font-style:italic[^>]*>/gi),''],[new RegExp(/]*font-weight:(bold|700)[^>]*>/gi),''],[new RegExp(/<(\/?)(i|b|a)>/gi),"<$1$2>"],[new RegExp(/<a(?:(?!href).)+href=(?:"|”|“|"|“|”)(((?!"|”|“|"|“|”).)*)(?:"|”|“|"|“|”)(?:(?!>).)*>/gi),''],[new RegExp(/<\/p>\n+/gi),"

"],[new RegExp(/\n+

/gi),""],[new RegExp(/(((?!/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;y1)for(v=0;v"+e.util.htmlEntities(h[v])+"

");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=/"+l.split("

").join("

")+"

",u=h.querySelectorAll("a,p,div,br"),d=0;d"+u.innerHTML+"
":h.innerHTML=u.innerHTML,u.parentNode.replaceChild(h,u);for(p=l.querySelectorAll("span"),d=0;d0&&(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'),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+|)?$/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="
",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="
",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="
",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=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;I1?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;n1&&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+(i1&&(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||'
',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;Iq?(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",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="x",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&&we0&&$=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(J1,Z=[],he=te(f),xe=0;xe=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;xe1)Rt(this,f);else{this.removeAllRanges();for(var S=0,P=f.length;S1?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(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;Z0)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;xex&&++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;E0&&C1){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&&aeColor
",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;n0?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;t0)&&!(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;te[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+10)&&!(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;n1&&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 `,ls=` `,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.valueEs(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};