@logicflow/extension 2.1.5 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@logicflow/core"),require("@logicflow/vue-node-registry")):"function"==typeof define&&define.amd?define(["exports","@logicflow/core","@logicflow/vue-node-registry"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Extension={},e.Core,e.VueNodeRegistry)}(this,(function(e,t,n){"use strict";var i=40,o=40,r=40,a=40,s=40,l=40,u=100,c=80,d=100,h=80,f={rect:{radius:5,stroke:"rgb(24, 125, 255)"},circle:{r:18,stroke:"rgb(24, 125, 255)"},polygon:{stroke:"rgb(24, 125, 255)"},polyline:{stroke:"rgb(24, 125, 255)",hoverStroke:"rgb(24, 125, 255)",selectedStroke:"rgb(24, 125, 255)"},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"white",height:14,stroke:"transparent",radius:3}}},p=function(e,t){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},p(e,t)};function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},v.apply(this,arguments)};function m(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}function y(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function b(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function x(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(o=2&s[0]?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function w(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function E(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function C(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var N=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),_=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new N;function S(){return _.next()}var M=function(e){function t(t,n){return t.id||(t.id="Event_".concat(S())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),e.call(this,t,n)||this}return g(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedTargetRules=function(){var t=e.prototype.getConnectedTargetRules.call(this);return t.push({message:"起始节点不能作为边的终点",validate:function(){return!1}}),t},t.extendKey="StartEventModel",t}(t.CircleNodeModel),T=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t.extendKey="StartEventNode",t}(t.CircleNode),A={type:"bpmn:startEvent",view:T,model:M},k=function(e){function t(t,n){return t.id||(t.id="Event_".concat(S())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),e.call(this,t,n)||this}return g(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedSourceRules=function(){var t=e.prototype.getConnectedSourceRules.call(this);return t.push({message:"结束节点不能作为边的起点",validate:function(){return!1}}),t},t.extendKey="EndEventModel",t}(t.CircleNodeModel),R=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},n.prototype.getShape=function(){var n=this.props.model,i=n.getNodeStyle(),o=n,r=o.x,a=o.y,s=o.r,l=e.prototype.getShape.call(this);return t.h("g",{},l,t.h("circle",v(v({},i),{cx:r,cy:a,r:s-5})))},n.extendKey="EndEventView",n}(t.CircleNode),D={type:"bpmn:endEvent",view:R,model:k},O=function(e){function t(t,n){return t.id||(t.id="Flow_".concat(S())),e.call(this,t,n)||this}return g(t,e),t.extendKey="SequenceFlowModel",t}(t.PolylineEdgeModel),P=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t.extendKey="SequenceFlowEdge",t}(t.PolylineEdge),I={type:"bpmn:sequenceFlow",view:P,model:O},L=function(e){function t(t,n){var i=this;return t.id||(t.id="Gateway_".concat(S())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),(i=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],i}return g(t,e),t.extendKey="ExclusiveGatewayModel",t}(t.PolygonNodeModel),B=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getShape=function(){var e=this.props.model,n=e,i=n.x,o=n.y,r=n.width,a=n.height,s=n.points,l=e.getNodeStyle();return t.h("g",{transform:"matrix(1 0 0 1 ".concat(i-r/2," ").concat(o-a/2,")")},t.h("polygon",v(v({},l),{x:i,y:o,points:s})),t.h("path",v({d:"m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z"},l)))},n.extendKey="ExclusiveGatewayNode",n}(t.PolygonNode),j={type:"bpmn:exclusiveGateway",view:B,model:L},F=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(S())),e.call(this,t,n)||this}return g(t,e),t.extendKey="ServiceTaskModel",t}(t.RectNodeModel),H=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-o/2+5,y:i-r/2+5,width:30,height:30,viewBox:"0 0 1274 1024"},t.h("path",{fill:a.stroke,d:"M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z"}))},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",v({x:n-o/2,y:i-r/2,rx:a,ry:a,width:o,height:r},s)),this.getLabelShape()])},n.extendKey="ServiceTaskNode",n}(t.RectNode),W={type:"bpmn:serviceTask",view:H,model:F},z=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(S())),e.call(this,t,n)||this}return g(t,e),t.extendKey="UserTaskModel",t}(t.RectNodeModel),G=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-o/2+5,y:i-r/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},t.h("path",{fill:a.stroke,d:"M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z"}))},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",v(v({},s),{x:n-o/2,y:i-r/2,rx:a,ry:a,width:o,height:r})),this.getLabelShape()])},n.extendKey="UserTaskNode",n}(t.RectNode),U={type:"bpmn:userTask",view:G,model:z},q={pluginName:"bpmnElement",install:function(e){e.setTheme(f),e.register(A),e.register(D),e.register(j),e.register(U),e.register(W),e.options.customBpmnEdge||(e.register(I),e.setDefaultEdgeType("bpmn:sequenceFlow"))}},X=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),V=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new X;function K(){return V.next()}function Y(e){return Object.prototype.toString.call(e)}function $(e){var t=e;return"[object Object]"===Y(e)?(t={},Object.keys(e).forEach((function(n){var i=n;"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=$(e[n])}))):Array.isArray(e)&&(t=[],e.forEach((function(e,n){t[n]=$(e)}))),t}function Z(e){return null==e?"":e.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var J="\t\n";function Q(e,t,n){var i=function(e){return" ".repeat(e)}(n);if(0!==e&&!1!==e&&!e)return J+i+"<".concat(t," />");var o="";if("#text"===t)return J+i+Z(String(e));if("#cdata-section"===t)return J+i+"<![CDATA["+e+"]]>";if("#comment"===t)return J+i+"\x3c!--"+e+"--\x3e";if("-"==="".concat(t).charAt(0))return" "+t.substring(1)+'="'+function(e){var t=e;try{"string"!=typeof t&&(t=JSON.parse(e))}catch(n){t=JSON.stringify($(e)).replace(/"/g,"'")}return Z(String(t))}(e)+'"';if(Array.isArray(e))e.forEach((function(e){o+=Q(e,t,n+1)}));else if("[object Object]"===Y(e)){var r=Object.keys(e),a="",s="";o+=(0===n?"":J+i)+"<"+t,r.forEach((function(t){"-"===t.charAt(0)?a+=Q(e[t],t,n+1):s+=Q(e[t],t,n+1)})),o+=a+(""!==s?">".concat(s).concat(J+i,"</").concat(t,">"):" />")}else o+=J+i+"<".concat(t,">").concat(Z(String(e)),"</").concat(t,">");return o}function ee(e){var t="";for(var n in e)t+=Q(e[n],n,0);return t}var te=function(){};(te.ObjTree=function(){return this}).VERSION="0.23",te.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',te.ObjTree.prototype.attr_prefix="-",te.ObjTree.prototype.parseXML=function(e){var t;if(window.DOMParser){var n=new DOMParser,i=n.parseFromString(e,"application/xml");if(!i)return;t=i.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(e),t=n.documentElement);if(t)return this.parseDOM(t)},te.ObjTree.prototype.parseHTTP=function(e,t,n){var i,o={};for(var r in t)o[r]=t[r];if(o.method||(void 0===o.postBody&&void 0===o.postbody&&void 0===o.parameters?o.method="get":o.method="post"),n){o.asynchronous=!0;var a=this,s=n,l=o.onComplete;o.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else o.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)o.uri=e,(u=new HTTP.Request(o))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,o))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},te.ObjTree.prototype.parseDOM=function(e){if(e){if(this.__force_array={},this.force_array)for(var t=0;t<this.force_array.length;t++)this.__force_array[this.force_array[t]]=1;var n=this.parseElement(e);if(this.__force_array[e.nodeName]&&(n=[n]),11!=e.nodeType){var i={};i[e.nodeName]=n,n=i}return n}},te.ObjTree.prototype.parseElement=function(e){if(7!=e.nodeType){if(3==e.nodeType||4==e.nodeType||8==e.nodeType){if(null==e.nodeValue.match(/[^\x00-\x20]/))return;return e.nodeValue}var t=null,n={};if(e.attributes&&e.attributes.length){t={};for(var i=0;i<e.attributes.length;i++){if("string"==typeof(s=e.attributes[i].nodeName)){var o=e.attributes[i].nodeValue;try{o=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){o=e.attributes[i].nodeValue}o&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}if(e.childNodes&&e.childNodes.length){var r=!0;t&&(r=!1);for(i=0;i<e.childNodes.length&&r;i++){var a=e.childNodes[i].nodeType;3!=a&&4!=a&&8!=a&&(r=!1)}if(r){t||(t="");for(i=0;i<e.childNodes.length;i++)t+=e.childNodes[i].nodeValue}else{t||(t={});for(i=0;i<e.childNodes.length;i++){var s;if("string"==typeof(s=e.childNodes[i].nodeName))(o=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}else null===t&&(t={});return t}},te.ObjTree.prototype.addNode=function(e,t,n,i){this.__force_array[t]?(1==n&&(e[t]=[]),e[t][e[t].length]=i):1==n?e[t]=i:2==n?e[t]=[e[t],i]:e[t][e[t].length]=i},te.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},te.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var o in t)if(t.hasOwnProperty(o)){var r=t[o];o.charAt(0)!=this.attr_prefix?void 0===r||null==r?n[n.length]="<"+o+" />":"object"==typeof r&&r.constructor==Array?n[n.length]=this.array_to_xml(o,r):n[n.length]="object"==typeof r?this.hash_to_xml(o,r):this.scalar_to_xml(o,r):i[i.length]=" "+o.substring(1)+'="'+this.xml_escape(r)+'"'}var a=i.join(""),s=n.join("");return void 0===e||null==e||(s=n.length>0?s.match(/\n/)?"<"+e+a+">\n"+s+"</"+e+">\n":"<"+e+a+">"+s+"</"+e+">\n":"<"+e+a+" />\n"),s},te.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var o=t[i];void 0===o||null==o?n[n.length]="<"+e+" />":"object"==typeof o&&o.constructor==Array?n[n.length]=this.array_to_xml(e,o):n[n.length]="object"==typeof o?this.hash_to_xml(e,o):this.scalar_to_xml(e,o)}return n.join("")},te.ObjTree.prototype.scalar_to_xml=function(e,t){return"#text"==e?this.xml_escape(t):"<"+e+">"+this.xml_escape(t)+"</"+e+">\n"},te.ObjTree.prototype.xml_escape=Z;var ne,ie=function(e){return(new te.ObjTree).parseXML(e)};!function(e){e.START="bpmn:startEvent",e.END="bpmn:endEvent",e.GATEWAY="bpmn:exclusiveGateway",e.USER="bpmn:userTask",e.SYSTEM="bpmn:serviceTask",e.FLOW="bpmn:sequenceFlow"}(ne||(ne={}));var oe=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef"],re=["properties","startPoint","endPoint","pointsList"],ae=function(e){return String(e||"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&apos;/g,"'")};function se(e){var t=e?re.concat(e):re;return function(e){return function e(n){var i={};return"string"==typeof n?n:Array.isArray(n)?n.map((function(t){return e(t)})):(Object.entries(n).forEach((function(n){var o=E(n,2),r=o[0],a=o[1];"object"!=typeof a?0===r.indexOf("-")||["#text","#cdata-section","#comment"].includes(r)?i[r]=a:i["-".concat(r)]=a:t.includes(r)?i["-".concat(r)]=e(a):i[r]=e(a)})),i)}(e)}}function le(e){var t={};return Object.entries(e).forEach((function(e){var n=E(e,2),i=n[0],o=n[1];0===i.indexOf("-")?t[i.substring(1)]=$(o):"string"==typeof o?t[i]=o:"[object Object]"===Object.prototype.toString.call(o)?t[i]=le(o):Array.isArray(o)?t[i]=o.map((function(e){return le(e)})):t[i]=o})),t}function ue(e,t){e["bpmndi:BPMNEdge"]=t.edges.map((function(e){var t,n=e.id,i=e.pointsList.map((function(e){return{"-x":e.x,"-y":e.y}})),o={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(o["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),o})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,o=80,r=e.x,a=e.y,s=fe.shapeConfigMap.get(e.type);s&&(i=s.width,o=s.height),r-=i/2,a-=o/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":r,"-y":a,"-width":i,"-height":o}};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(l["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),l}))}function ce(e){var t=[],n=[],i=e["bpmn:definitions"];if(i){var o=i["bpmn:process"],r=i["bpmndi:BPMNDiagram"],a=null==r?void 0:r["bpmndi:BPMNPlane"];if(!o||!a)return{nodes:t,edges:n};Object.keys(o).forEach((function(e){if(0===e.indexOf("bpmn:")){var i=o[e];if(e===ne.FLOW){var r=a["bpmndi:BPMNEdge"],s=(Array.isArray(r),r);n=function(e,t){var n=[];if(Array.isArray(e))e.forEach((function(e){var i;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(he(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(he(i,e))}return n}(i,s)}else{var l=a["bpmndi:BPMNShape"],u=(Array.isArray(l),l);t=t.concat(function(e,t,n){var i=[];if(Array.isArray(e))e.forEach((function(e){var o=de(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}));else{var o=de(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}return i}(i,u,e))}}}))}return{nodes:t,edges:n}}function de(e,t,n){var i,o,r=Number(e["dc:Bounds"]["-x"]),a=Number(e["dc:Bounds"]["-y"]),s=ae(n["-name"]),l=fe.shapeConfigMap.get(t);if(l&&(r+=l.width/2,a+=l.height/2),Object.entries(n).forEach((function(e){var t=E(e,2),n=t[0],o=t[1];-1===oe.indexOf(n)&&(i||(i={}),i[n]=o)})),i&&(i=le(i)),s&&(o={x:r,y:a,value:s},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var u=e["bpmndi:BPMNLabel"]["dc:Bounds"];o.x=Number(u["-x"])+Number(u["-width"])/2,o.y=Number(u["-y"])+Number(u["-height"])/2}var c={id:e["-bpmnElement"],type:t,x:r,y:a,properties:i};return o&&(c.text=o),c}function he(e,t){var n,i,o=t["-name"]?ae("".concat(t["-name"])):"";if(o){var r=void 0;e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"]&&(r=e["bpmndi:BPMNLabel"]["dc:Bounds"]);var a=0;if(o.split("\n").forEach((function(e){a<e.length&&(a=e.length)})),r)n={value:o,x:Number(r["-x"])+10*a/2,y:Number(r["-y"])+7};else{var s=e["di:waypoint"]||[],l=s[0],u=s[s.length-1]||l;n={value:o,x:(Number((null==l?void 0:l["-x"])||0)+Number((null==u?void 0:u["-x"])||0))/2,y:(Number((null==l?void 0:l["-y"])||0)+Number((null==u?void 0:u["-y"])||0))/2}}}Object.entries(t).forEach((function(e){var t=E(e,2),n=t[0],o=t[1];-1===oe.indexOf(n)&&(i||(i={}),i[n]=o)})),i&&(i=le(i));var c={id:t["-id"],type:ne.FLOW,pointsList:e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:i};return n&&(c.text=n),c}var fe=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i=v({},n.processAttributes);!function(e,t,n){var i=new Map;t.nodes.forEach((function(t){var o,r={"-id":t.id};if((null===(o=t.text)||void 0===o?void 0:o.value)&&(r["-name"]=t.text.value),t.properties){var a=se(n)(t.properties);Object.assign(r,a)}i.set(t.id,r),e[t.type]?Array.isArray(e[t.type])?e[t.type].push(r):e[t.type]=[e[t.type],r]:e[t.type]=r}));var o=t.edges.map((function(e){var t,o,r=i.get(e.targetNodeId);r["bpmn:incoming"]?Array.isArray(r["bpmn:incoming"])?r["bpmn:incoming"].push(e.id):r["bpmn:incoming"]=[r["bpmn:incoming"],e.id]:r["bpmn:incoming"]=e.id;var a={"-id":e.id,"-sourceRef":e.sourceNodeId,"-targetRef":e.targetNodeId};if((null===(t=e.text)||void 0===t?void 0:t.value)&&(a["-name"]=null===(o=e.text)||void 0===o?void 0:o.value),e.properties){var s=se(n)(e.properties);Object.assign(a,s)}return a}));t.edges.forEach((function(e){var t=i.get(e.sourceNodeId);t["bpmn:outgoing"]?Array.isArray(t["bpmn:outgoing"])?t["bpmn:outgoing"].push(e.id):t["bpmn:outgoing"]=[t["bpmn:outgoing"],e.id]:t["bpmn:outgoing"]=e.id})),e[ne.FLOW]=o}(i,e,t);var o={"-id":"BPMNPlane_1","-bpmnElement":i["-id"]};ue(o,e);var r=n.definitionAttributes;return r["bpmn:process"]=i,r["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":o},{"bpmn:definitions":r}},this.adapterIn=function(e){if(e)return ce(e)},t.adapterIn=function(e){return n.adapterIn(e)},t.adapterOut=function(e,t){return n.adapterOut(e,t)},this.processAttributes={"-isExecutable":"true","-id":"Process_".concat(K())},this.definitionAttributes={"-id":"Definitions_".concat(K()),"-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.0"}}return e.prototype.setCustomShape=function(t,n){e.shapeConfigMap.set(t,n)},e.pluginName="bpmn-adapter",e.shapeConfigMap=new Map,e}();fe.shapeConfigMap.set(ne.START,{width:i,height:o}),fe.shapeConfigMap.set(ne.END,{width:r,height:a}),fe.shapeConfigMap.set(ne.GATEWAY,{width:s,height:l}),fe.shapeConfigMap.set(ne.SYSTEM,{width:u,height:c}),fe.shapeConfigMap.set(ne.USER,{width:d,height:h});var pe=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t="string"==typeof e?n.sanitizeNameAttributes(e):e,i=ie(t);return n.adapterIn(i)},n.adapterXmlOut=function(e,t){return ee(n.adapterOut(e,t))};var i=t.lf;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n}return g(t,e),t.prototype.sanitizeNameAttributes=function(e){return e.replace(/name="([^"]*)"/g,(function(e,t){var n=t.replace(/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return'name="'.concat(n,'"')}))},t.pluginName="bpmnXmlAdapter",t}(fe);function ge(){this.targetRules.push({message:"分组外的节点不允许连接分组内的",validate:function(e,t){var n=!!e.properties.parent,i=!!t.properties.parent;return!(!n&&i)}})}var ve=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),me=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new ve;function ye(){return me.next()}var be=Object.freeze({__proto__:null,genBpmnId:ye,groupRule:ge});function xe(e){var n=E(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var i,o=this.props.model,r=o.getNodeStyle(),a=o,s=a.x,l=a.y,u=a.r,c=a.width,d=a.height,h=a.properties,f=e.prototype.getShape.call(this),p=h.definitionType,g=((null===(i=n.endEvent)||void 0===i?void 0:i.get(p))||{}).icon,m=Array.isArray(g)?t.h.apply(void 0,C(["g",{transform:"matrix(1 0 0 1 ".concat(s-c/2," ").concat(l-d/2,")")}],E(g),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(s-c/2," ").concat(l-d/2,")"),d:g,style:"fill: black; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;"});return t.h("g",{},f,t.h("circle",v(v({},r),{strokeWidth:2,cx:s,cy:l,r:u-2})),m)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(ye())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.endEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=v(v({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(ye())),o=e.call(this,t,i)||this,ge.call(o),o}return g(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedSourceRules=function(){var t=this,n=e.prototype.getConnectedSourceRules.call(this),i={message:"结束节点不能作为边的起点",validate:function(e,n){return e!==t}};return n.push(i),n},t}(t.CircleNodeModel);return{type:"bpmn:endEvent",view:i,model:o}}function we(e){var n=E(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties.definitionType,h=((null===(e=n.intermediateCatchEvent)||void 0===e?void 0:e.get(d))||{}).icon,f=Array.isArray(h)?t.h.apply(void 0,C(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],E(h),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:h});return t.h("g",{},t.h("circle",v(v({},o),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",v(v({},o),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),f)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(ye())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.intermediateCatchEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=v(v({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(ye())),o=e.call(this,t,i)||this,ge.call(o),o}return g(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateCatchEvent",view:i,model:o}}function Ee(e){var n=E(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties,h=d.definitionType,f=d.isInterrupting,p=((null===(e=n.startEvent)||void 0===e?void 0:e.get(h))||{}).icon,g=Array.isArray(p)?t.h.apply(void 0,C(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],E(p),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:p,style:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"});return t.h("g",{},t.h("circle",v(v({},o),{cx:a,cy:s,r:l,strokeDasharray:f?"5,5":"",strokeWidth:2})),g)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a;t.id||(t.id="Event_".concat(ye())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var s=((null===(o=n.startEvent)||void 0===o?void 0:o.get(null===(r=t.properties)||void 0===r?void 0:r.definitionType))||{}).properties,l=void 0===s?{}:s;return t.properties=v(v({},l),t.properties),(null===(a=t.properties)||void 0===a?void 0:a.definitionType)&&(t.properties.definitionId="Definition_".concat(ye())),e.call(this,t,i)||this}return g(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedTargetRules=function(){var t=this,n=e.prototype.getConnectedTargetRules.call(this),i={message:"起始节点不能作为边的终点",validate:function(e,n){return n!==t}};return n.push(i),n},t}(t.CircleNodeModel);return{type:"bpmn:startEvent",view:i,model:o}}function Ce(e){var n=E(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties,h=d.definitionType,f=d.cancelActivity,p=((null===(e=n.boundaryEvent)||void 0===e?void 0:e.get(h))||{}).icon,g=Array.isArray(p)?t.h.apply(void 0,C(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],E(p),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:p});return t.h("g",{},t.h("circle",v(v({},o),{cx:a,cy:s,r:l,strokeDasharray:f?"":"5,5",strokeWidth:1.5})),t.h("circle",v(v({},o),{cx:a,cy:s,r:l-3,strokeDasharray:f?"":"5,5",strokeWidth:1.5})),g)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(ye())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.boundaryEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=v(v({attachedToRef:"",cancelActivity:!0},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(ye())),o=e.call(this,t,i)||this,ge.call(o),o}return g(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.r=20,this.autoToFront=!1,this.zIndex=99999},t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:boundaryEvent",view:i,model:o}}function Ne(e){var n=E(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties.definitionType,h=((null===(e=n.intermediateThrowEvent)||void 0===e?void 0:e.get(d))||{}).icon,f=Array.isArray(h)?t.h.apply(void 0,C(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],E(h),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:h,style:"fill: black"});return t.h("g",{},t.h("circle",v(v({},o),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",v(v({},o),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),f)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(ye())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.intermediateThrowEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=v(v({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(ye())),o=e.call(this,t,i)||this,ge.call(o),o}return g(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateThrowEvent",view:i,model:o}}var _e=[t.h("circle",{cx:18,cy:18,r:11,style:"stroke-linecap: round;stroke-linejoin: round;stroke: rgb(34, 36, 42);stroke-width: 2px;fill: white"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"})],Se=[t.h("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);"})],Me="m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z",Te="m 23,10 0,12.5 -12.5,0 0,5 12.5,0 0,12.5 5,0 0,-12.5 12.5,0 0,-5 -12.5,0 0,-12.5 -5,0 z",Ae=t.h("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;"}),ke="M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z",Re="M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z",De="m44,60 m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",Oe="m47,61 m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",Pe="m 50,73 c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",Ie=Object.freeze({__proto__:null,compensationIcon:"m 7.92,18 9,-6.5 0,13 z m 9.3,-0.4 8.7,-6.1 0,13 -8.7,-6.1 z",conditionalIcon:"M 10.5,8.5 l 14.5,0 l 0,18 l -14.5,0 Z M 12.5,11.5 l 10.5,0 M 12.5,14.5 l 10.5,0 M 12.5,17.5 l 10.5,0 M 12.5,20.5 l 10.5,0 M 12.5,23.5 l 10.5,0 M 12.5,26.5 l 10.5,0 ",errorIcon:"m 7.2,25.991999999999997 0.09350000000000001,-0.025300000000000003 7.3392,-9.610700000000001 7.667000000000001,8.9661 4.7003,-18.2204 -5.8707,11.6501 -7.299600000000001,-9.585400000000002 z",escalationIcon:"M 18,7.2 l 8,20 l -8,-7 l -8,7 Z",exclusiveIcon:Me,inclusiveIcon:Ae,linkIcon:"m 20.52,9.468 0,4.4375 -13.5,0 0,6.75 13.5,0 0,4.4375 9.84375,-7.8125 -9.84375,-7.8125 z",loopMarker:Pe,manualTaskIcon:"M0.5,3.751L4.583,0.5009999999999999C4.583,0.5009999999999999,15.749,0.5839999999999999,16.666,0.5839999999999999S14.249,3.5009999999999994,15.166,3.5009999999999994S26.833,3.5009999999999994,27.75,3.5009999999999994C28.916,5.209,27.582,6.667999999999999,26.916,7.167999999999999S27.791,9.084999999999999,25.916,11.584999999999999C25.166,11.834999999999999,26.666,13.459999999999999,24.583000000000002,14.918C23.416,15.501,25.166,16.46,23.333000000000002,17.750999999999998C22.166,17.750999999999998,2.5000000000000036,17.833999999999996,2.5000000000000036,17.833999999999996L0.5000000000000036,16.500999999999998V3.751ZM13.5,7L27,7M13.5,11L26,11M14,14.5L25,14.5M8.2,3.1L15,3.1",messageIcon:"m 8.459999999999999,11.34 l 0,12.6 l 18.900000000000002,0 l 0,-12.6 z l 9.450000000000001,5.4 l 9.450000000000001,-5.4",parallelIcon:Te,parallelMarker:De,scriptTaskIcon:"M6.402,0.5H20.902C20.902,0.5,15.069,3.333,15.069,6.083S19.486,12.083,19.486,15.25S15.319,20.333,15.319,20.333H0.235C0.235,20.333,5.235,17.665999999999997,5.235,15.332999999999998S0.6520000000000001,8.582999999999998,0.6520000000000001,6.082999999999998S6.402,0.5,6.402,0.5ZM3.5,4.5L13.5,4.5M3.8,8.5L13.8,8.5M6.3,12.5L16.3,12.5M6.5,16.5L16.5,16.5",sequentialMarker:Oe,serviceTaskIcon:ke,signalIcon:"M 18,7.2 l 9,16.2 l -18,0 Z",style:{throw:"fill: rgb(34, 36, 42); stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;",catch:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;",nonIntermediate:"stroke-width: 1.5; stroke-dash-array: 6",intermediate:"stroke-width: 1.5"},terminateIcon:Se,timerIcon:_e,userTaskIcon:Re});function Le(e,n,i){var o=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),i.prototype.getShape=function(){var e=this.props.model,i=e,o=i.x,r=i.y,a=i.width,s=i.height,l=i.points,u=e.getNodeStyle();return t.h("g",{transform:"matrix(1 0 0 1 ".concat(o-a/2," ").concat(r-s/2,")")},t.h(t.Polygon,v(v({},u),{x:o,y:r,points:l})),"string"==typeof n?t.h("path",v(v({d:n},u),{fill:"rgb(34, 36, 42)",strokeWidth:1})):n)},i}(t.PolygonNode);return{type:e,view:o,model:function(e){function t(t,n){var o=this;return t.id||(t.id="Gateway_".concat(ye())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),t.properties=v(v({},i||{}),t.properties),(o=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],ge.call(o),o}return g(t,e),t}(t.PolygonNodeModel)}}var Be={parallel:De,sequential:Oe,loop:Pe};function je(e,n,i){var o=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),i.prototype.getLabelShape=function(){var e=this.props.model,i=e.x,o=e.y,r=e.width,a=e.height,s=e.getNodeStyle(),l=Array.isArray(n)?t.h.apply(void 0,C(["g",{transform:"matrix(1 0 0 1 ".concat(i-r/2," ").concat(o-a/2,")")}],E(n),!1)):t.h("path",{fill:s.stroke,d:n});return t.h("svg",{x:i-r/2+5,y:o-a/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},l)},i.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.radius,s=e.properties,l=e.getNodeStyle();return t.h("g",{},[t.h("rect",v(v({},l),{x:n-o/2,y:i-r/2,rx:a,ry:a,width:o,height:r,opacity:.95})),this.getLabelShape(),t.h("g",{transform:"matrix(1 0 0 1 ".concat(n-o/2," ").concat(i-r/2,")")},t.h("path",{fill:"white",strokeLinecap:"round",strokeLinejoin:"round",stroke:"rgb(34, 36, 42)",strokeWidth:"2",d:Be[s.multiInstanceType]||""}))])},i}(t.RectNode),r=function(e){function t(t,n){var o,r=this;t.id||(t.id="Activity_".concat(ye()));var a=v(v({},i||{}),t.properties);return t.properties=a,r=e.call(this,t,n)||this,null===(o=null==a?void 0:a.boundaryEvents)||void 0===o||o.forEach((function(e){r.addBoundaryEvent(e)})),r.deleteProperty("boundaryEvents"),ge.call(r),r}return g(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.isTaskNode=!0,this.boundaryEvents=[]},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return this.properties.isBoundaryEventTouchingTask&&(t.stroke="#00acff",t.strokeWidth=2),t},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return t.stroke="transparent",!t.hover&&(t.hover={}),t.hover.stroke="transparent",t},t.prototype.setTouching=function(e){this.setProperty("isBoundaryEventTouchingTask",e)},t.prototype.addBoundaryEvent=function(e){if(this.setTouching(!1),this.boundaryEvents.find((function(t){return t===e})))return!1;var t=this.graphModel.getNodeModelById(e);return null==t||t.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(e),!0},t.prototype.deleteBoundaryEvent=function(e){this.boundaryEvents=this.boundaryEvents.filter((function(t){return t!==e}))},t}(t.RectNodeModel);return{type:e,view:o,model:r}}var Fe="object"==typeof global&&global&&global.Object===Object&&global,He="object"==typeof self&&self&&self.Object===Object&&self,We=Fe||He||Function("return this")(),ze=We.Symbol,Ge=Object.prototype,Ue=Ge.hasOwnProperty,qe=Ge.toString,Xe=ze?ze.toStringTag:void 0;var Ve=Object.prototype.toString;var Ke="[object Null]",Ye="[object Undefined]",$e=ze?ze.toStringTag:void 0;function Ze(e){return null==e?void 0===e?Ye:Ke:$e&&$e in Object(e)?function(e){var t=Ue.call(e,Xe),n=e[Xe];try{e[Xe]=void 0;var i=!0}catch(e){}var o=qe.call(e);return i&&(t?e[Xe]=n:delete e[Xe]),o}(e):function(e){return Ve.call(e)}(e)}function Je(e){return null!=e&&"object"==typeof e}var Qe="[object Symbol]";function et(e){return"symbol"==typeof e||Je(e)&&Ze(e)==Qe}var tt=NaN;function nt(e){return"number"==typeof e?e:et(e)?tt:+e}function it(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o}var ot=Array.isArray,rt=1/0,at=ze?ze.prototype:void 0,st=at?at.toString:void 0;function lt(e){if("string"==typeof e)return e;if(ot(e))return it(e,lt)+"";if(et(e))return st?st.call(e):"";var t=e+"";return"0"==t&&1/e==-rt?"-0":t}function ut(e,t){return function(n,i){var o;if(void 0===n&&void 0===i)return t;if(void 0!==n&&(o=n),void 0!==i){if(void 0===o)return i;"string"==typeof n||"string"==typeof i?(n=lt(n),i=lt(i)):(n=nt(n),i=nt(i)),o=e(n,i)}return o}}var ct=ut((function(e,t){return e+t}),0),dt=/\s/;function ht(e){for(var t=e.length;t--&&dt.test(e.charAt(t)););return t}var ft=/^\s+/;function pt(e){return e?e.slice(0,ht(e)+1).replace(ft,""):e}function gt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var vt=NaN,mt=/^[-+]0x[0-9a-f]+$/i,yt=/^0b[01]+$/i,bt=/^0o[0-7]+$/i,xt=parseInt;function wt(e){if("number"==typeof e)return e;if(et(e))return vt;if(gt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=gt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=pt(e);var n=yt.test(e);return n||bt.test(e)?xt(e.slice(2),n?2:8):mt.test(e)?vt:+e}var Et=1/0,Ct=17976931348623157e292;function Nt(e){return e?(e=wt(e))===Et||e===-Et?(e<0?-1:1)*Ct:e==e?e:0:0===e?e:0}function _t(e){var t=Nt(e),n=t%1;return t==t?n?t-n:t:0}function St(e){return e}var Mt="[object AsyncFunction]",Tt="[object Function]",At="[object GeneratorFunction]",kt="[object Proxy]";function Rt(e){if(!gt(e))return!1;var t=Ze(e);return t==Tt||t==At||t==Mt||t==kt}var Dt,Ot=We["__core-js_shared__"],Pt=(Dt=/[^.]+$/.exec(Ot&&Ot.keys&&Ot.keys.IE_PROTO||""))?"Symbol(src)_1."+Dt:"";var It=Function.prototype.toString;function Lt(e){if(null!=e){try{return It.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Bt=/^\[object .+?Constructor\]$/,jt=Function.prototype,Ft=Object.prototype,Ht=jt.toString,Wt=Ft.hasOwnProperty,zt=RegExp("^"+Ht.call(Wt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Gt(e){return!(!gt(e)||function(e){return!!Pt&&Pt in e}(e))&&(Rt(e)?zt:Bt).test(Lt(e))}function Ut(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Gt(n)?n:void 0}var qt=Ut(We,"WeakMap"),Xt=qt&&new qt,Vt=Xt?function(e,t){return Xt.set(e,t),e}:St,Kt=Object.create,Yt=function(){function e(){}return function(t){if(!gt(t))return{};if(Kt)return Kt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function $t(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Yt(e.prototype),i=e.apply(n,t);return gt(i)?i:n}}var Zt=1;function Jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Qt=Math.max;function en(e,t,n,i){for(var o=-1,r=e.length,a=n.length,s=-1,l=t.length,u=Qt(r-a,0),c=Array(l+u),d=!i;++s<l;)c[s]=t[s];for(;++o<a;)(d||o<r)&&(c[n[o]]=e[o]);for(;u--;)c[s++]=e[o++];return c}var tn=Math.max;function nn(e,t,n,i){for(var o=-1,r=e.length,a=-1,s=n.length,l=-1,u=t.length,c=tn(r-s,0),d=Array(c+u),h=!i;++o<c;)d[o]=e[o];for(var f=o;++l<u;)d[f+l]=t[l];for(;++a<s;)(h||o<r)&&(d[f+n[a]]=e[o++]);return d}function on(){}var rn=4294967295;function an(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=rn,this.__views__=[]}function sn(){}an.prototype=Yt(on.prototype),an.prototype.constructor=an;var ln=Xt?function(e){return Xt.get(e)}:sn,un={},cn=Object.prototype.hasOwnProperty;function dn(e){for(var t=e.name+"",n=un[t],i=cn.call(un,t)?n.length:0;i--;){var o=n[i],r=o.func;if(null==r||r==e)return o.name}return t}function hn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function fn(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}function pn(e){if(e instanceof an)return e.clone();var t=new hn(e.__wrapped__,e.__chain__);return t.__actions__=fn(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}hn.prototype=Yt(on.prototype),hn.prototype.constructor=hn;var gn=Object.prototype.hasOwnProperty;function vn(e){if(Je(e)&&!ot(e)&&!(e instanceof an)){if(e instanceof hn)return e;if(gn.call(e,"__wrapped__"))return pn(e)}return new hn(e)}function mn(e){var t=dn(e),n=vn[t];if("function"!=typeof n||!(t in an.prototype))return!1;if(e===n)return!0;var i=ln(n);return!!i&&e===i[0]}vn.prototype=on.prototype,vn.prototype.constructor=vn;var yn=Date.now;function bn(e){var t=0,n=0;return function(){var i=yn(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var xn=bn(Vt),wn=/\{\n\/\* \[wrapped with (.+)\] \*/,En=/,? & /;var Cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function Nn(e){return function(){return e}}var _n=function(){try{var e=Ut(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Sn=_n?function(e,t){return _n(e,"toString",{configurable:!0,enumerable:!1,value:Nn(t),writable:!0})}:St,Mn=bn(Sn);function Tn(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););return e}function An(e,t,n,i){for(var o=e.length,r=n+(i?1:-1);i?r--:++r<o;)if(t(e[r],r,e))return r;return-1}function kn(e){return e!=e}function Rn(e,t,n){return t==t?function(e,t,n){for(var i=n-1,o=e.length;++i<o;)if(e[i]===t)return i;return-1}(e,t,n):An(e,kn,n)}function Dn(e,t){return!!(null==e?0:e.length)&&Rn(e,t,0)>-1}var On=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function Pn(e,t,n){var i=t+"";return Mn(e,function(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(Cn,"{\n/* [wrapped with "+t+"] */\n")}(i,function(e,t){return Tn(On,(function(n){var i="_."+n[0];t&n[1]&&!Dn(e,i)&&e.push(i)})),e.sort()}(function(e){var t=e.match(wn);return t?t[1].split(En):[]}(i),n)))}var In=1,Ln=2,Bn=4,jn=8,Fn=32,Hn=64;function Wn(e,t,n,i,o,r,a,s,l,u){var c=t&jn;t|=c?Fn:Hn,(t&=~(c?Hn:Fn))&Bn||(t&=~(In|Ln));var d=[e,t,o,c?r:void 0,c?a:void 0,c?void 0:r,c?void 0:a,s,l,u],h=n.apply(void 0,d);return mn(e)&&xn(h,d),h.placeholder=i,Pn(h,e,t)}function zn(e){return e.placeholder}var Gn=9007199254740991,Un=/^(?:0|[1-9]\d*)$/;function qn(e,t){var n=typeof e;return!!(t=null==t?Gn:t)&&("number"==n||"symbol"!=n&&Un.test(e))&&e>-1&&e%1==0&&e<t}var Xn=Math.min;var Vn="__lodash_placeholder__";function Kn(e,t){for(var n=-1,i=e.length,o=0,r=[];++n<i;){var a=e[n];a!==t&&a!==Vn||(e[n]=Vn,r[o++]=n)}return r}var Yn=1,$n=2,Zn=8,Jn=16,Qn=128,ei=512;function ti(e,t,n,i,o,r,a,s,l,u){var c=t&Qn,d=t&Yn,h=t&$n,f=t&(Zn|Jn),p=t&ei,g=h?void 0:$t(e);return function v(){for(var m=arguments.length,y=Array(m),b=m;b--;)y[b]=arguments[b];if(f)var x=zn(v),w=function(e,t){for(var n=e.length,i=0;n--;)e[n]===t&&++i;return i}(y,x);if(i&&(y=en(y,i,o,f)),r&&(y=nn(y,r,a,f)),m-=w,f&&m<u){var E=Kn(y,x);return Wn(e,t,ti,v.placeholder,n,y,E,s,l,u-m)}var C=d?n:this,N=h?C[e]:e;return m=y.length,s?y=function(e,t){for(var n=e.length,i=Xn(t.length,n),o=fn(e);i--;){var r=t[i];e[i]=qn(r,n)?o[r]:void 0}return e}(y,s):p&&m>1&&y.reverse(),c&&l<m&&(y.length=l),this&&this!==We&&this instanceof v&&(N=g||$t(N)),N.apply(C,y)}}var ni=1;var ii="__lodash_placeholder__",oi=1,ri=2,ai=4,si=8,li=128,ui=256,ci=Math.min;var di="Expected a function",hi=1,fi=2,pi=8,gi=16,vi=32,mi=64,yi=Math.max;function bi(e,t,n,i,o,r,a,s){var l=t&fi;if(!l&&"function"!=typeof e)throw new TypeError(di);var u=i?i.length:0;if(u||(t&=~(vi|mi),i=o=void 0),a=void 0===a?a:yi(_t(a),0),s=void 0===s?s:_t(s),u-=o?o.length:0,t&mi){var c=i,d=o;i=o=void 0}var h=l?void 0:ln(e),f=[e,t,n,i,o,c,d,r,a,s];if(h&&function(e,t){var n=e[1],i=t[1],o=n|i,r=o<(oi|ri|li),a=i==li&&n==si||i==li&&n==ui&&e[7].length<=t[8]||i==(li|ui)&&t[7].length<=t[8]&&n==si;if(!r&&!a)return e;i&oi&&(e[2]=t[2],o|=n&oi?0:ai);var s=t[3];if(s){var l=e[3];e[3]=l?en(l,s,t[4]):s,e[4]=l?Kn(e[3],ii):t[4]}(s=t[5])&&(l=e[5],e[5]=l?nn(l,s,t[6]):s,e[6]=l?Kn(e[5],ii):t[6]),(s=t[7])&&(e[7]=s),i&li&&(e[8]=null==e[8]?t[8]:ci(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(f,h),e=f[0],t=f[1],n=f[2],i=f[3],o=f[4],!(s=f[9]=void 0===f[9]?l?0:e.length:yi(f[9]-u,0))&&t&(pi|gi)&&(t&=~(pi|gi)),t&&t!=hi)p=t==pi||t==gi?function(e,t,n){var i=$t(e);return function o(){for(var r=arguments.length,a=Array(r),s=r,l=zn(o);s--;)a[s]=arguments[s];var u=r<3&&a[0]!==l&&a[r-1]!==l?[]:Kn(a,l);return(r-=u.length)<n?Wn(e,t,ti,o.placeholder,void 0,a,u,void 0,void 0,n-r):Jt(this&&this!==We&&this instanceof o?i:e,this,a)}}(e,t,s):t!=vi&&t!=(hi|vi)||o.length?ti.apply(void 0,f):function(e,t,n,i){var o=t&ni,r=$t(e);return function t(){for(var a=-1,s=arguments.length,l=-1,u=i.length,c=Array(u+s),d=this&&this!==We&&this instanceof t?r:e;++l<u;)c[l]=i[l];for(;s--;)c[l++]=arguments[++a];return Jt(d,o?n:this,c)}}(e,t,n,i);else var p=function(e,t,n){var i=t&Zt,o=$t(e);return function t(){return(this&&this!==We&&this instanceof t?o:e).apply(i?n:this,arguments)}}(e,t,n);return Pn((h?Vt:xn)(p,f),e,t)}var xi=128;function wi(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,bi(e,xi,void 0,void 0,void 0,void 0,t)}function Ei(e,t,n){"__proto__"==t&&_n?_n(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ci(e,t){return e===t||e!=e&&t!=t}var Ni=Object.prototype.hasOwnProperty;function _i(e,t,n){var i=e[t];Ni.call(e,t)&&Ci(i,n)&&(void 0!==n||t in e)||Ei(e,t,n)}function Si(e,t,n,i){var o=!n;n||(n={});for(var r=-1,a=t.length;++r<a;){var s=t[r],l=i?i(n[s],e[s],s,n,e):void 0;void 0===l&&(l=e[s]),o?Ei(n,s,l):_i(n,s,l)}return n}var Mi=Math.max;function Ti(e,t,n){return t=Mi(void 0===t?e.length-1:t,0),function(){for(var i=arguments,o=-1,r=Mi(i.length-t,0),a=Array(r);++o<r;)a[o]=i[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=i[o];return s[t]=n(a),Jt(e,this,s)}}function Ai(e,t){return Mn(Ti(e,t,St),e+"")}var ki=9007199254740991;function Ri(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=ki}function Di(e){return null!=e&&Ri(e.length)&&!Rt(e)}function Oi(e,t,n){if(!gt(n))return!1;var i=typeof t;return!!("number"==i?Di(n)&&qn(t,n.length):"string"==i&&t in n)&&Ci(n[t],e)}function Pi(e){return Ai((function(t,n){var i=-1,o=n.length,r=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(o--,r):void 0,a&&Oi(n[0],n[1],a)&&(r=o<3?void 0:r,o=1),t=Object(t);++i<o;){var s=n[i];s&&e(t,s,i,r)}return t}))}var Ii=Object.prototype;function Li(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ii)}function Bi(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}function ji(e){return Je(e)&&"[object Arguments]"==Ze(e)}var Fi=Object.prototype,Hi=Fi.hasOwnProperty,Wi=Fi.propertyIsEnumerable,zi=ji(function(){return arguments}())?ji:function(e){return Je(e)&&Hi.call(e,"callee")&&!Wi.call(e,"callee")};function Gi(){return!1}var Ui="object"==typeof e&&e&&!e.nodeType&&e,qi=Ui&&"object"==typeof module&&module&&!module.nodeType&&module,Xi=qi&&qi.exports===Ui?We.Buffer:void 0,Vi=(Xi?Xi.isBuffer:void 0)||Gi,Ki={};function Yi(e){return function(t){return e(t)}}Ki["[object Float32Array]"]=Ki["[object Float64Array]"]=Ki["[object Int8Array]"]=Ki["[object Int16Array]"]=Ki["[object Int32Array]"]=Ki["[object Uint8Array]"]=Ki["[object Uint8ClampedArray]"]=Ki["[object Uint16Array]"]=Ki["[object Uint32Array]"]=!0,Ki["[object Arguments]"]=Ki["[object Array]"]=Ki["[object ArrayBuffer]"]=Ki["[object Boolean]"]=Ki["[object DataView]"]=Ki["[object Date]"]=Ki["[object Error]"]=Ki["[object Function]"]=Ki["[object Map]"]=Ki["[object Number]"]=Ki["[object Object]"]=Ki["[object RegExp]"]=Ki["[object Set]"]=Ki["[object String]"]=Ki["[object WeakMap]"]=!1;var $i="object"==typeof e&&e&&!e.nodeType&&e,Zi=$i&&"object"==typeof module&&module&&!module.nodeType&&module,Ji=Zi&&Zi.exports===$i&&Fe.process,Qi=function(){try{var e=Zi&&Zi.require&&Zi.require("util").types;return e||Ji&&Ji.binding&&Ji.binding("util")}catch(e){}}(),eo=Qi&&Qi.isTypedArray,to=eo?Yi(eo):function(e){return Je(e)&&Ri(e.length)&&!!Ki[Ze(e)]},no=Object.prototype.hasOwnProperty;function io(e,t){var n=ot(e),i=!n&&zi(e),o=!n&&!i&&Vi(e),r=!n&&!i&&!o&&to(e),a=n||i||o||r,s=a?Bi(e.length,String):[],l=s.length;for(var u in e)!t&&!no.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||r&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||qn(u,l))||s.push(u);return s}function oo(e,t){return function(n){return e(t(n))}}var ro=oo(Object.keys,Object),ao=Object.prototype.hasOwnProperty;function so(e){if(!Li(e))return ro(e);var t=[];for(var n in Object(e))ao.call(e,n)&&"constructor"!=n&&t.push(n);return t}function lo(e){return Di(e)?io(e):so(e)}var uo=Object.prototype.hasOwnProperty,co=Pi((function(e,t){if(Li(t)||Di(t))Si(t,lo(t),e);else for(var n in t)uo.call(t,n)&&_i(e,n,t[n])}));var ho=Object.prototype.hasOwnProperty;function fo(e){if(!gt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Li(e),n=[];for(var i in e)("constructor"!=i||!t&&ho.call(e,i))&&n.push(i);return n}function po(e){return Di(e)?io(e,!0):fo(e)}var go=Pi((function(e,t){Si(t,po(t),e)})),vo=Pi((function(e,t,n,i){Si(t,po(t),e,i)})),mo=Pi((function(e,t,n,i){Si(t,lo(t),e,i)})),yo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bo=/^\w*$/;function xo(e,t){if(ot(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!et(e))||(bo.test(e)||!yo.test(e)||null!=t&&e in Object(t))}var wo=Ut(Object,"create");var Eo=Object.prototype.hasOwnProperty;var Co=Object.prototype.hasOwnProperty;function No(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function _o(e,t){for(var n=e.length;n--;)if(Ci(e[n][0],t))return n;return-1}No.prototype.clear=function(){this.__data__=wo?wo(null):{},this.size=0},No.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},No.prototype.get=function(e){var t=this.__data__;if(wo){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Eo.call(t,e)?t[e]:void 0},No.prototype.has=function(e){var t=this.__data__;return wo?void 0!==t[e]:Co.call(t,e)},No.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=wo&&void 0===t?"__lodash_hash_undefined__":t,this};var So=Array.prototype.splice;function Mo(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Mo.prototype.clear=function(){this.__data__=[],this.size=0},Mo.prototype.delete=function(e){var t=this.__data__,n=_o(t,e);return!(n<0)&&(n==t.length-1?t.pop():So.call(t,n,1),--this.size,!0)},Mo.prototype.get=function(e){var t=this.__data__,n=_o(t,e);return n<0?void 0:t[n][1]},Mo.prototype.has=function(e){return _o(this.__data__,e)>-1},Mo.prototype.set=function(e,t){var n=this.__data__,i=_o(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var To=Ut(We,"Map");function Ao(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function ko(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}ko.prototype.clear=function(){this.size=0,this.__data__={hash:new No,map:new(To||Mo),string:new No}},ko.prototype.delete=function(e){var t=Ao(this,e).delete(e);return this.size-=t?1:0,t},ko.prototype.get=function(e){return Ao(this,e).get(e)},ko.prototype.has=function(e){return Ao(this,e).has(e)},ko.prototype.set=function(e,t){var n=Ao(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};var Ro="Expected a function";function Do(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Ro);var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(Do.Cache||ko),n}Do.Cache=ko;var Oo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Po=/\\(\\)?/g,Io=function(e){var t=Do(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Oo,(function(e,n,i,o){t.push(i?o.replace(Po,"$1"):n||e)})),t}));function Lo(e){return null==e?"":lt(e)}function Bo(e,t){return ot(e)?e:xo(e,t)?[e]:Io(Lo(e))}var jo=1/0;function Fo(e){if("string"==typeof e||et(e))return e;var t=e+"";return"0"==t&&1/e==-jo?"-0":t}function Ho(e,t){for(var n=0,i=(t=Bo(t,e)).length;null!=e&&n<i;)e=e[Fo(t[n++])];return n&&n==i?e:void 0}function Wo(e,t,n){var i=null==e?void 0:Ho(e,t);return void 0===i?n:i}function zo(e,t){for(var n=-1,i=t.length,o=Array(i),r=null==e;++n<i;)o[n]=r?void 0:Wo(e,t[n]);return o}function Go(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}var Uo=ze?ze.isConcatSpreadable:void 0;function qo(e){return ot(e)||zi(e)||!!(Uo&&e&&e[Uo])}function Xo(e,t,n,i,o){var r=-1,a=e.length;for(n||(n=qo),o||(o=[]);++r<a;){var s=e[r];t>0&&n(s)?t>1?Xo(s,t-1,n,i,o):Go(o,s):i||(o[o.length]=s)}return o}function Vo(e){return(null==e?0:e.length)?Xo(e,1):[]}function Ko(e){return Mn(Ti(e,void 0,Vo),e+"")}var Yo=Ko(zo),$o=oo(Object.getPrototypeOf,Object),Zo="[object Object]",Jo=Function.prototype,Qo=Object.prototype,er=Jo.toString,tr=Qo.hasOwnProperty,nr=er.call(Object);function ir(e){if(!Je(e)||Ze(e)!=Zo)return!1;var t=$o(e);if(null===t)return!0;var n=tr.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&er.call(n)==nr}var or="[object DOMException]",rr="[object Error]";function ar(e){if(!Je(e))return!1;var t=Ze(e);return t==rr||t==or||"string"==typeof e.message&&"string"==typeof e.name&&!ir(e)}var sr=Ai((function(e,t){try{return Jt(e,void 0,t)}catch(e){return ar(e)?e:new Error(e)}})),lr="Expected a function";function ur(e,t){var n;if("function"!=typeof t)throw new TypeError(lr);return e=_t(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var cr=Ai((function(e,t,n){var i=1;if(n.length){var o=Kn(n,zn(cr));i|=32}return bi(e,i,t,n,o)}));cr.placeholder={};var dr=Ko((function(e,t){return Tn(t,(function(t){t=Fo(t),Ei(e,t,cr(e[t],e))})),e})),hr=Ai((function(e,t,n){var i=3;if(n.length){var o=Kn(n,zn(hr));i|=32}return bi(t,i,e,n,o)}));function fr(e,t,n){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(o);++i<o;)r[i]=e[i+t];return r}function pr(e,t,n){var i=e.length;return n=void 0===n?i:n,!t&&n>=i?e:fr(e,t,n)}hr.placeholder={};var gr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function vr(e){return gr.test(e)}var mr="\\ud800-\\udfff",yr="["+mr+"]",br="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",xr="\\ud83c[\\udffb-\\udfff]",wr="[^"+mr+"]",Er="(?:\\ud83c[\\udde6-\\uddff]){2}",Cr="[\\ud800-\\udbff][\\udc00-\\udfff]",Nr="(?:"+br+"|"+xr+")"+"?",_r="[\\ufe0e\\ufe0f]?",Sr=_r+Nr+("(?:\\u200d(?:"+[wr,Er,Cr].join("|")+")"+_r+Nr+")*"),Mr="(?:"+[wr+br+"?",br,Er,Cr,yr].join("|")+")",Tr=RegExp(xr+"(?="+xr+")|"+Mr+Sr,"g");function Ar(e){return vr(e)?function(e){return e.match(Tr)||[]}(e):function(e){return e.split("")}(e)}function kr(e){return function(t){var n=vr(t=Lo(t))?Ar(t):void 0,i=n?n[0]:t.charAt(0),o=n?pr(n,1).join(""):t.slice(1);return i[e]()+o}}var Rr=kr("toUpperCase");function Dr(e){return Rr(Lo(e).toLowerCase())}function Or(e,t,n,i){var o=-1,r=null==e?0:e.length;for(i&&r&&(n=e[++o]);++o<r;)n=t(n,e[o],o,e);return n}function Pr(e){return function(t){return null==e?void 0:e[t]}}var Ir=Pr({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Lr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Br=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");function jr(e){return(e=Lo(e))&&e.replace(Lr,Ir).replace(Br,"")}var Fr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Hr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Wr="\\ud800-\\udfff",zr="\\u2700-\\u27bf",Gr="a-z\\xdf-\\xf6\\xf8-\\xff",Ur="A-Z\\xc0-\\xd6\\xd8-\\xde",qr="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Xr="["+qr+"]",Vr="\\d+",Kr="["+zr+"]",Yr="["+Gr+"]",$r="[^"+Wr+qr+Vr+zr+Gr+Ur+"]",Zr="(?:\\ud83c[\\udde6-\\uddff]){2}",Jr="[\\ud800-\\udbff][\\udc00-\\udfff]",Qr="["+Ur+"]",ea="(?:"+Yr+"|"+$r+")",ta="(?:"+Qr+"|"+$r+")",na="(?:['’](?:d|ll|m|re|s|t|ve))?",ia="(?:['’](?:D|LL|M|RE|S|T|VE))?",oa="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",ra="[\\ufe0e\\ufe0f]?",aa=ra+oa+("(?:\\u200d(?:"+["[^"+Wr+"]",Zr,Jr].join("|")+")"+ra+oa+")*"),sa="(?:"+[Kr,Zr,Jr].join("|")+")"+aa,la=RegExp([Qr+"?"+Yr+"+"+na+"(?="+[Xr,Qr,"$"].join("|")+")",ta+"+"+ia+"(?="+[Xr,Qr+ea,"$"].join("|")+")",Qr+"?"+ea+"+"+na,Qr+"+"+ia,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Vr,sa].join("|"),"g");function ua(e,t,n){return e=Lo(e),void 0===(t=n?void 0:t)?function(e){return Hr.test(e)}(e)?function(e){return e.match(la)||[]}(e):function(e){return e.match(Fr)||[]}(e):e.match(t)||[]}var ca=RegExp("['’]","g");function da(e){return function(t){return Or(ua(jr(t).replace(ca,"")),e,"")}}var ha=da((function(e,t,n){return t=t.toLowerCase(),e+(n?Dr(t):t)}));var fa=We.isFinite,pa=Math.min;function ga(e){var t=Math[e];return function(e,n){if(e=wt(e),(n=null==n?0:pa(_t(n),292))&&fa(e)){var i=(Lo(e)+"e").split("e");return+((i=(Lo(t(i[0]+"e"+(+i[1]+n)))+"e").split("e"))[0]+"e"+(+i[1]-n))}return t(e)}}var va=ga("ceil");function ma(e){var t=vn(e);return t.__chain__=!0,t}var ya=Math.ceil,ba=Math.max;function xa(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function wa(e){var t=this.__data__=new Mo(e);this.size=t.size}function Ea(e,t){return e&&Si(t,lo(t),e)}wa.prototype.clear=function(){this.__data__=new Mo,this.size=0},wa.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},wa.prototype.get=function(e){return this.__data__.get(e)},wa.prototype.has=function(e){return this.__data__.has(e)},wa.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Mo){var i=n.__data__;if(!To||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new ko(i)}return n.set(e,t),this.size=n.size,this};var Ca="object"==typeof e&&e&&!e.nodeType&&e,Na=Ca&&"object"==typeof module&&module&&!module.nodeType&&module,_a=Na&&Na.exports===Ca?We.Buffer:void 0,Sa=_a?_a.allocUnsafe:void 0;function Ma(e,t){if(t)return e.slice();var n=e.length,i=Sa?Sa(n):new e.constructor(n);return e.copy(i),i}function Ta(e,t){for(var n=-1,i=null==e?0:e.length,o=0,r=[];++n<i;){var a=e[n];t(a,n,e)&&(r[o++]=a)}return r}function Aa(){return[]}var ka=Object.prototype.propertyIsEnumerable,Ra=Object.getOwnPropertySymbols,Da=Ra?function(e){return null==e?[]:(e=Object(e),Ta(Ra(e),(function(t){return ka.call(e,t)})))}:Aa;var Oa=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Go(t,Da(e)),e=$o(e);return t}:Aa;function Pa(e,t,n){var i=t(e);return ot(e)?i:Go(i,n(e))}function Ia(e){return Pa(e,lo,Da)}function La(e){return Pa(e,po,Oa)}var Ba=Ut(We,"DataView"),ja=Ut(We,"Promise"),Fa=Ut(We,"Set"),Ha="[object Map]",Wa="[object Promise]",za="[object Set]",Ga="[object WeakMap]",Ua="[object DataView]",qa=Lt(Ba),Xa=Lt(To),Va=Lt(ja),Ka=Lt(Fa),Ya=Lt(qt),$a=Ze;(Ba&&$a(new Ba(new ArrayBuffer(1)))!=Ua||To&&$a(new To)!=Ha||ja&&$a(ja.resolve())!=Wa||Fa&&$a(new Fa)!=za||qt&&$a(new qt)!=Ga)&&($a=function(e){var t=Ze(e),n="[object Object]"==t?e.constructor:void 0,i=n?Lt(n):"";if(i)switch(i){case qa:return Ua;case Xa:return Ha;case Va:return Wa;case Ka:return za;case Ya:return Ga}return t});var Za=$a,Ja=Object.prototype.hasOwnProperty;var Qa=We.Uint8Array;function es(e){var t=new e.constructor(e.byteLength);return new Qa(t).set(new Qa(e)),t}var ts=/\w*$/;var ns=ze?ze.prototype:void 0,is=ns?ns.valueOf:void 0;function os(e,t){var n=t?es(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var rs="[object Boolean]",as="[object Date]",ss="[object Map]",ls="[object Number]",us="[object RegExp]",cs="[object Set]",ds="[object String]",hs="[object Symbol]",fs="[object ArrayBuffer]",ps="[object DataView]",gs="[object Float32Array]",vs="[object Float64Array]",ms="[object Int8Array]",ys="[object Int16Array]",bs="[object Int32Array]",xs="[object Uint8Array]",ws="[object Uint8ClampedArray]",Es="[object Uint16Array]",Cs="[object Uint32Array]";function Ns(e,t,n){var i,o=e.constructor;switch(t){case fs:return es(e);case rs:case as:return new o(+e);case ps:return function(e,t){var n=t?es(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case gs:case vs:case ms:case ys:case bs:case xs:case ws:case Es:case Cs:return os(e,n);case ss:return new o;case ls:case ds:return new o(e);case us:return function(e){var t=new e.constructor(e.source,ts.exec(e));return t.lastIndex=e.lastIndex,t}(e);case cs:return new o;case hs:return i=e,is?Object(is.call(i)):{}}}function _s(e){return"function"!=typeof e.constructor||Li(e)?{}:Yt($o(e))}var Ss=Qi&&Qi.isMap,Ms=Ss?Yi(Ss):function(e){return Je(e)&&"[object Map]"==Za(e)};var Ts=Qi&&Qi.isSet,As=Ts?Yi(Ts):function(e){return Je(e)&&"[object Set]"==Za(e)},ks=1,Rs=2,Ds=4,Os="[object Arguments]",Ps="[object Function]",Is="[object GeneratorFunction]",Ls="[object Object]",Bs={};function js(e,t,n,i,o,r){var a,s=t&ks,l=t&Rs,u=t&Ds;if(n&&(a=o?n(e,i,o,r):n(e)),void 0!==a)return a;if(!gt(e))return e;var c=ot(e);if(c){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ja.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return fn(e,a)}else{var d=Za(e),h=d==Ps||d==Is;if(Vi(e))return Ma(e,s);if(d==Ls||d==Os||h&&!o){if(a=l||h?{}:_s(e),!s)return l?function(e,t){return Si(e,Oa(e),t)}(e,function(e,t){return e&&Si(t,po(t),e)}(a,e)):function(e,t){return Si(e,Da(e),t)}(e,Ea(a,e))}else{if(!Bs[d])return o?e:{};a=Ns(e,d,s)}}r||(r=new wa);var f=r.get(e);if(f)return f;r.set(e,a),As(e)?e.forEach((function(i){a.add(js(i,t,n,i,e,r))})):Ms(e)&&e.forEach((function(i,o){a.set(o,js(i,t,n,o,e,r))}));var p=c?void 0:(u?l?La:Ia:l?po:lo)(e);return Tn(p||e,(function(i,o){p&&(i=e[o=i]),_i(a,o,js(i,t,n,o,e,r))})),a}Bs[Os]=Bs["[object Array]"]=Bs["[object ArrayBuffer]"]=Bs["[object DataView]"]=Bs["[object Boolean]"]=Bs["[object Date]"]=Bs["[object Float32Array]"]=Bs["[object Float64Array]"]=Bs["[object Int8Array]"]=Bs["[object Int16Array]"]=Bs["[object Int32Array]"]=Bs["[object Map]"]=Bs["[object Number]"]=Bs[Ls]=Bs["[object RegExp]"]=Bs["[object Set]"]=Bs["[object String]"]=Bs["[object Symbol]"]=Bs["[object Uint8Array]"]=Bs["[object Uint8ClampedArray]"]=Bs["[object Uint16Array]"]=Bs["[object Uint32Array]"]=!0,Bs["[object Error]"]=Bs[Ps]=Bs["[object WeakMap]"]=!1;function Fs(e){return js(e,5)}function Hs(){var e=arguments.length;if(!e)return[];for(var t=Array(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Go(ot(n)?fn(n):[n],Xo(t,1))}function Ws(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ko;++t<n;)this.add(e[t])}function zs(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function Gs(e,t){return e.has(t)}Ws.prototype.add=Ws.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ws.prototype.has=function(e){return this.__data__.has(e)};var Us=1,qs=2;function Xs(e,t,n,i,o,r){var a=n&Us,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var u=r.get(e),c=r.get(t);if(u&&c)return u==t&&c==e;var d=-1,h=!0,f=n&qs?new Ws:void 0;for(r.set(e,t),r.set(t,e);++d<s;){var p=e[d],g=t[d];if(i)var v=a?i(g,p,d,t,e,r):i(p,g,d,e,t,r);if(void 0!==v){if(v)continue;h=!1;break}if(f){if(!zs(t,(function(e,t){if(!Gs(f,t)&&(p===e||o(p,e,n,i,r)))return f.push(t)}))){h=!1;break}}else if(p!==g&&!o(p,g,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h}function Vs(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Ks(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Ys=1,$s=2,Zs="[object Boolean]",Js="[object Date]",Qs="[object Error]",el="[object Map]",tl="[object Number]",nl="[object RegExp]",il="[object Set]",ol="[object String]",rl="[object Symbol]",al="[object ArrayBuffer]",sl="[object DataView]",ll=ze?ze.prototype:void 0,ul=ll?ll.valueOf:void 0;var cl=1,dl=Object.prototype.hasOwnProperty;var hl=1,fl="[object Arguments]",pl="[object Array]",gl="[object Object]",vl=Object.prototype.hasOwnProperty;function ml(e,t,n,i,o,r){var a=ot(e),s=ot(t),l=a?pl:Za(e),u=s?pl:Za(t),c=(l=l==fl?gl:l)==gl,d=(u=u==fl?gl:u)==gl,h=l==u;if(h&&Vi(e)){if(!Vi(t))return!1;a=!0,c=!1}if(h&&!c)return r||(r=new wa),a||to(e)?Xs(e,t,n,i,o,r):function(e,t,n,i,o,r,a){switch(n){case sl:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case al:return!(e.byteLength!=t.byteLength||!r(new Qa(e),new Qa(t)));case Zs:case Js:case tl:return Ci(+e,+t);case Qs:return e.name==t.name&&e.message==t.message;case nl:case ol:return e==t+"";case el:var s=Vs;case il:var l=i&Ys;if(s||(s=Ks),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;i|=$s,a.set(e,t);var c=Xs(s(e),s(t),i,o,r,a);return a.delete(e),c;case rl:if(ul)return ul.call(e)==ul.call(t)}return!1}(e,t,l,n,i,o,r);if(!(n&hl)){var f=c&&vl.call(e,"__wrapped__"),p=d&&vl.call(t,"__wrapped__");if(f||p){var g=f?e.value():e,v=p?t.value():t;return r||(r=new wa),o(g,v,n,i,r)}}return!!h&&(r||(r=new wa),function(e,t,n,i,o,r){var a=n&cl,s=Ia(e),l=s.length;if(l!=Ia(t).length&&!a)return!1;for(var u=l;u--;){var c=s[u];if(!(a?c in t:dl.call(t,c)))return!1}var d=r.get(e),h=r.get(t);if(d&&h)return d==t&&h==e;var f=!0;r.set(e,t),r.set(t,e);for(var p=a;++u<l;){var g=e[c=s[u]],v=t[c];if(i)var m=a?i(v,g,c,t,e,r):i(g,v,c,e,t,r);if(!(void 0===m?g===v||o(g,v,n,i,r):m)){f=!1;break}p||(p="constructor"==c)}if(f&&!p){var y=e.constructor,b=t.constructor;y==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(f=!1)}return r.delete(e),r.delete(t),f}(e,t,n,i,o,r))}function yl(e,t,n,i,o){return e===t||(null==e||null==t||!Je(e)&&!Je(t)?e!=e&&t!=t:ml(e,t,n,i,yl,o))}var bl=1,xl=2;function wl(e,t,n,i){var o=n.length,r=o,a=!i;if(null==e)return!r;for(e=Object(e);o--;){var s=n[o];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<r;){var l=(s=n[o])[0],u=e[l],c=s[1];if(a&&s[2]){if(void 0===u&&!(l in e))return!1}else{var d=new wa;if(i)var h=i(u,c,l,e,t,d);if(!(void 0===h?yl(c,u,bl|xl,i,d):h))return!1}}return!0}function El(e){return e==e&&!gt(e)}function Cl(e){for(var t=lo(e),n=t.length;n--;){var i=t[n],o=e[i];t[n]=[i,o,El(o)]}return t}function Nl(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function _l(e){var t=Cl(e);return 1==t.length&&t[0][2]?Nl(t[0][0],t[0][1]):function(n){return n===e||wl(n,e,t)}}function Sl(e,t){return null!=e&&t in Object(e)}function Ml(e,t,n){for(var i=-1,o=(t=Bo(t,e)).length,r=!1;++i<o;){var a=Fo(t[i]);if(!(r=null!=e&&n(e,a)))break;e=e[a]}return r||++i!=o?r:!!(o=null==e?0:e.length)&&Ri(o)&&qn(a,o)&&(ot(e)||zi(e))}function Tl(e,t){return null!=e&&Ml(e,t,Sl)}var Al=1,kl=2;function Rl(e,t){return xo(e)&&El(t)?Nl(Fo(e),t):function(n){var i=Wo(n,e);return void 0===i&&i===t?Tl(n,e):yl(t,i,Al|kl)}}function Dl(e){return function(t){return null==t?void 0:t[e]}}function Ol(e){return xo(e)?Dl(Fo(e)):function(e){return function(t){return Ho(t,e)}}(e)}function Pl(e){return"function"==typeof e?e:null==e?St:"object"==typeof e?ot(e)?Rl(e[0],e[1]):_l(e):Ol(e)}function Il(e,t,n){var i=n.length;if(null==e)return!i;for(e=Object(e);i--;){var o=n[i],r=t[o],a=e[o];if(void 0===a&&!(o in e)||!r(a))return!1}return!0}function Ll(e,t,n,i){for(var o=-1,r=null==e?0:e.length;++o<r;){var a=e[o];t(i,a,n(a),e)}return i}function Bl(e){return function(t,n,i){for(var o=-1,r=Object(t),a=i(t),s=a.length;s--;){var l=a[e?s:++o];if(!1===n(r[l],l,r))break}return t}}var jl=Bl();function Fl(e,t){return e&&jl(e,t,lo)}function Hl(e,t){return function(n,i){if(null==n)return n;if(!Di(n))return e(n,i);for(var o=n.length,r=t?o:-1,a=Object(n);(t?r--:++r<o)&&!1!==i(a[r],r,a););return n}}var Wl=Hl(Fl);function zl(e,t,n,i){return Wl(e,(function(e,o,r){t(i,e,n(e),r)})),i}function Gl(e,t){return function(n,i){var o=ot(n)?Ll:zl,r=t?t():{};return o(n,e,Pl(i),r)}}var Ul=Object.prototype.hasOwnProperty,ql=Gl((function(e,t,n){Ul.call(e,n)?++e[n]:Ei(e,n,1)}));function Xl(e,t,n){var i=bi(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=Xl.placeholder,i}Xl.placeholder={};function Vl(e,t,n){var i=bi(e,16,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=Vl.placeholder,i}Vl.placeholder={};var Kl=function(){return We.Date.now()},Yl="Expected a function",$l=Math.max,Zl=Math.min;function Jl(e,t,n){var i,o,r,a,s,l,u=0,c=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError(Yl);function f(t){var n=i,r=o;return i=o=void 0,u=t,a=e.apply(r,n)}function p(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-u>=r}function g(){var e=Kl();if(p(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return d?Zl(n,r-(e-u)):n}(e))}function v(e){return s=void 0,h&&i?f(e):(i=o=void 0,a)}function m(){var e=Kl(),n=p(e);if(i=arguments,o=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(g,t),c?f(e):a}(l);if(d)return clearTimeout(s),s=setTimeout(g,t),f(l)}return void 0===s&&(s=setTimeout(g,t)),a}return t=wt(t)||0,gt(n)&&(c=!!n.leading,r=(d="maxWait"in n)?$l(wt(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,i=l=o=s=void 0},m.flush=function(){return void 0===s?a:v(Kl())},m}var Ql=Object.prototype,eu=Ql.hasOwnProperty,tu=Ai((function(e,t){e=Object(e);var n=-1,i=t.length,o=i>2?t[2]:void 0;for(o&&Oi(t[0],t[1],o)&&(i=1);++n<i;)for(var r=t[n],a=po(r),s=-1,l=a.length;++s<l;){var u=a[s],c=e[u];(void 0===c||Ci(c,Ql[u])&&!eu.call(e,u))&&(e[u]=r[u])}return e}));function nu(e,t,n){(void 0!==n&&!Ci(e[t],n)||void 0===n&&!(t in e))&&Ei(e,t,n)}function iu(e){return Je(e)&&Di(e)}function ou(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ru(e){return Si(e,po(e))}function au(e,t,n,i,o){e!==t&&jl(t,(function(r,a){if(o||(o=new wa),gt(r))!function(e,t,n,i,o,r,a){var s=ou(e,n),l=ou(t,n),u=a.get(l);if(u)nu(e,n,u);else{var c=r?r(s,l,n+"",e,t,a):void 0,d=void 0===c;if(d){var h=ot(l),f=!h&&Vi(l),p=!h&&!f&&to(l);c=l,h||f||p?ot(s)?c=s:iu(s)?c=fn(s):f?(d=!1,c=Ma(l,!0)):p?(d=!1,c=os(l,!0)):c=[]:ir(l)||zi(l)?(c=s,zi(s)?c=ru(s):gt(s)&&!Rt(s)||(c=_s(l))):d=!1}d&&(a.set(l,c),o(c,l,i,r,a),a.delete(l)),nu(e,n,c)}}(e,t,a,n,au,i,o);else{var s=i?i(ou(e,a),r,a+"",e,t,o):void 0;void 0===s&&(s=r),nu(e,a,s)}}),po)}function su(e,t,n,i,o,r){return gt(e)&&gt(t)&&(r.set(t,e),au(e,t,void 0,su,r),r.delete(t)),e}var lu=Pi((function(e,t,n,i){au(e,t,n,i)})),uu=Ai((function(e){return e.push(void 0,su),Jt(lu,void 0,e)}));function cu(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)}var du=Ai((function(e,t){return cu(e,1,t)})),hu=Ai((function(e,t,n){return cu(e,wt(t)||0,n)}));function fu(e,t,n){for(var i=-1,o=null==e?0:e.length;++i<o;)if(n(t,e[i]))return!0;return!1}var pu=200;function gu(e,t,n,i){var o=-1,r=Dn,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=it(t,Yi(n))),i?(r=fu,a=!1):t.length>=pu&&(r=Gs,a=!1,t=new Ws(t));e:for(;++o<s;){var c=e[o],d=null==n?c:n(c);if(c=i||0!==c?c:0,a&&d==d){for(var h=u;h--;)if(t[h]===d)continue e;l.push(c)}else r(t,d,i)||l.push(c)}return l}var vu=Ai((function(e,t){return iu(e)?gu(e,Xo(t,1,iu,!0)):[]}));function mu(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var yu=Ai((function(e,t){var n=mu(t);return iu(n)&&(n=void 0),iu(e)?gu(e,Xo(t,1,iu,!0),Pl(n)):[]})),bu=Ai((function(e,t){var n=mu(t);return iu(n)&&(n=void 0),iu(e)?gu(e,Xo(t,1,iu,!0),void 0,n):[]})),xu=ut((function(e,t){return e/t}),1);function wu(e,t,n,i){for(var o=e.length,r=i?o:-1;(i?r--:++r<o)&&t(e[r],r,e););return n?fr(e,i?0:r,i?r+1:o):fr(e,i?r+1:0,i?o:r)}function Eu(e){return"function"==typeof e?e:St}function Cu(e,t){return(ot(e)?Tn:Wl)(e,Eu(t))}function Nu(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}var _u=Bl(!0);function Su(e,t){return e&&_u(e,t,lo)}var Mu=Hl(Su,!0);function Tu(e,t){return(ot(e)?Nu:Mu)(e,Eu(t))}function Au(e){return function(t){var n=Za(t);return"[object Map]"==n?Vs(t):"[object Set]"==n?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return it(t,(function(t){return[t,e[t]]}))}(t,e(t))}}var ku=Au(lo),Ru=Au(po),Du=Pr({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),Ou=/[&<>"']/g,Pu=RegExp(Ou.source);function Iu(e){return(e=Lo(e))&&Pu.test(e)?e.replace(Ou,Du):e}var Lu=/[\\^$.*+?()[\]{}|]/g,Bu=RegExp(Lu.source);function ju(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(!t(e[n],n,e))return!1;return!0}function Fu(e,t){var n=!0;return Wl(e,(function(e,i,o){return n=!!t(e,i,o)})),n}var Hu=4294967295;function Wu(e){return e?xa(_t(e),0,Hu):0}function zu(e,t){var n=[];return Wl(e,(function(e,i,o){t(e,i,o)&&n.push(e)})),n}function Gu(e,t){return(ot(e)?Ta:zu)(e,Pl(t))}function Uu(e){return function(t,n,i){var o=Object(t);if(!Di(t)){var r=Pl(n);t=lo(t),n=function(e){return r(o[e],e,o)}}var a=e(t,n,i);return a>-1?o[r?t[a]:a]:void 0}}var qu=Math.max;function Xu(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=null==n?0:_t(n);return o<0&&(o=qu(i+o,0)),An(e,Pl(t),o)}var Vu=Uu(Xu);function Ku(e,t,n){var i;return n(e,(function(e,n,o){if(t(e,n,o))return i=n,!1})),i}var Yu=Math.max,$u=Math.min;function Zu(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return void 0!==n&&(o=_t(n),o=n<0?Yu(i+o,0):$u(o,i-1)),An(e,Pl(t),o,!0)}var Ju=Uu(Zu);function Qu(e){return e&&e.length?e[0]:void 0}function ec(e,t){var n=-1,i=Di(e)?Array(e.length):[];return Wl(e,(function(e,o,r){i[++n]=t(e,o,r)})),i}function tc(e,t){return(ot(e)?it:ec)(e,Pl(t))}var nc=1/0;var ic=1/0;var oc=ga("floor");function rc(e){return Ko((function(t){var n=t.length,i=n,o=hn.prototype.thru;for(e&&t.reverse();i--;){var r=t[i];if("function"!=typeof r)throw new TypeError("Expected a function");if(o&&!a&&"wrapper"==dn(r))var a=new hn([],!0)}for(i=a?i:n;++i<n;){var s=dn(r=t[i]),l="wrapper"==s?ln(r):void 0;a=l&&mn(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[dn(l[0])].apply(a,l[3]):1==r.length&&mn(r)?a[s]():a.thru(r)}return function(){var e=arguments,i=e[0];if(a&&1==e.length&&ot(i))return a.plant(i).value();for(var o=0,r=n?t[o].apply(this,e):i;++o<n;)r=t[o].call(this,r);return r}}))}var ac=rc(),sc=rc(!0);function lc(e,t){return Ta(t,(function(t){return Rt(e[t])}))}var uc=Object.prototype.hasOwnProperty,cc=Gl((function(e,t,n){uc.call(e,n)?e[n].push(t):Ei(e,n,[t])}));function dc(e,t){return e>t}function hc(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=wt(t),n=wt(n)),e(t,n)}}var fc=hc(dc),pc=hc((function(e,t){return e>=t})),gc=Object.prototype.hasOwnProperty;function vc(e,t){return null!=e&&gc.call(e,t)}function mc(e,t){return null!=e&&Ml(e,t,vc)}var yc=Math.max,bc=Math.min;var xc="[object String]";function wc(e){return"string"==typeof e||!ot(e)&&Je(e)&&Ze(e)==xc}function Ec(e,t){return it(t,(function(t){return e[t]}))}function Cc(e){return null==e?[]:Ec(e,lo(e))}var Nc=Math.max;var _c=Math.max;var Sc=Math.min;function Mc(e,t,n){for(var i=n?fu:Dn,o=e[0].length,r=e.length,a=r,s=Array(r),l=1/0,u=[];a--;){var c=e[a];a&&t&&(c=it(c,Yi(t))),l=Sc(c.length,l),s[a]=!n&&(t||o>=120&&c.length>=120)?new Ws(a&&c):void 0}c=e[0];var d=-1,h=s[0];e:for(;++d<o&&u.length<l;){var f=c[d],p=t?t(f):f;if(f=n||0!==f?f:0,!(h?Gs(h,p):i(u,p,n))){for(a=r;--a;){var g=s[a];if(!(g?Gs(g,p):i(e[a],p,n)))continue e}h&&h.push(p),u.push(f)}}return u}function Tc(e){return iu(e)?e:[]}var Ac=Ai((function(e){var t=it(e,Tc);return t.length&&t[0]===e[0]?Mc(t):[]})),kc=Ai((function(e){var t=mu(e),n=it(e,Tc);return t===mu(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?Mc(n,Pl(t)):[]})),Rc=Ai((function(e){var t=mu(e),n=it(e,Tc);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?Mc(n,void 0,t):[]}));function Dc(e,t){return function(n,i){return function(e,t,n,i){return Fl(e,(function(e,o,r){t(i,n(e),o,r)})),i}(n,e,t(i),{})}}var Oc=Object.prototype.toString,Pc=Dc((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Oc.call(t)),e[t]=n}),Nn(St)),Ic=Object.prototype,Lc=Ic.hasOwnProperty,Bc=Ic.toString,jc=Dc((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Bc.call(t)),Lc.call(e,t)?e[t].push(n):e[t]=[n]}),Pl);function Fc(e,t){return t.length<2?e:Ho(e,fr(t,0,-1))}function Hc(e,t,n){var i=null==(e=Fc(e,t=Bo(t,e)))?e:e[Fo(mu(t))];return null==i?void 0:Jt(i,e,n)}var Wc=Ai(Hc),zc=Ai((function(e,t,n){var i=-1,o="function"==typeof t,r=Di(e)?Array(e.length):[];return Wl(e,(function(e){r[++i]=o?Jt(t,e,n):Hc(e,t,n)})),r}));var Gc=Qi&&Qi.isArrayBuffer,Uc=Gc?Yi(Gc):function(e){return Je(e)&&"[object ArrayBuffer]"==Ze(e)};var qc=Qi&&Qi.isDate,Xc=qc?Yi(qc):function(e){return Je(e)&&"[object Date]"==Ze(e)};var Vc=Object.prototype.hasOwnProperty;function Kc(e){if(null==e)return!0;if(Di(e)&&(ot(e)||"string"==typeof e||"function"==typeof e.splice||Vi(e)||to(e)||zi(e)))return!e.length;var t=Za(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Li(e))return!so(e).length;for(var n in e)if(Vc.call(e,n))return!1;return!0}function Yc(e,t){return yl(e,t)}var $c=We.isFinite;function Zc(e){return"number"==typeof e&&$c(e)}function Jc(e){return"number"==typeof e&&e==_t(e)}var Qc="[object Number]";function ed(e){return"number"==typeof e||Je(e)&&Ze(e)==Qc}var td=Ot?Rt:Gi;function nd(e){return null==e}var id=Qi&&Qi.isRegExp,od=id?Yi(id):function(e){return Je(e)&&"[object RegExp]"==Ze(e)},rd=9007199254740991;var ad=Array.prototype.join;var sd=da((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),ld=Gl((function(e,t,n){Ei(e,n,t)}));var ud=Math.max,cd=Math.min;var dd=da((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),hd=kr("toLowerCase");function fd(e,t){return e<t}var pd=hc(fd),gd=hc((function(e,t){return e<=t}));function vd(e,t,n){for(var i=-1,o=e.length;++i<o;){var r=e[i],a=t(r);if(null!=a&&(void 0===s?a==a&&!et(a):n(a,s)))var s=a,l=r}return l}function md(e,t){for(var n,i=-1,o=e.length;++i<o;){var r=t(e[i]);void 0!==r&&(n=void 0===n?r:n+r)}return n}var yd=NaN;function bd(e,t){var n=null==e?0:e.length;return n?md(e,t)/n:yd}var xd=Pi((function(e,t,n){au(e,t,n)})),wd=Ai((function(e,t){return function(n){return Hc(n,e,t)}})),Ed=Ai((function(e,t){return function(n){return Hc(e,n,t)}}));function Cd(e,t,n){var i=lo(t),o=lc(t,i),r=!(gt(n)&&"chain"in n&&!n.chain),a=Rt(e);return Tn(o,(function(n){var i=t[n];e[n]=i,a&&(e.prototype[n]=function(){var t=this.__chain__;if(r||t){var n=e(this.__wrapped__);return(n.__actions__=fn(this.__actions__)).push({func:i,args:arguments,thisArg:e}),n.__chain__=t,n}return i.apply(e,Go([this.value()],arguments))})})),e}var Nd=ut((function(e,t){return e*t}),1),_d="Expected a function";function Sd(e){if("function"!=typeof e)throw new TypeError(_d);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var Md="[object Map]",Td="[object Set]",Ad=ze?ze.iterator:void 0;function kd(e){if(!e)return[];if(Di(e))return wc(e)?Ar(e):fn(e);if(Ad&&e[Ad])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ad]());var t=Za(e);return(t==Md?Vs:t==Td?Ks:Cc)(e)}function Rd(e,t){var n=e.length;if(n)return qn(t+=t<0?n:0,n)?e[t]:void 0}function Dd(e,t){return null==(e=Fc(e,t=Bo(t,e)))||delete e[Fo(mu(t))]}function Od(e){return ir(e)?void 0:e}var Pd=Ko((function(e,t){var n={};if(null==e)return n;var i=!1;t=it(t,(function(t){return t=Bo(t,e),i||(i=t.length>1),t})),Si(e,La(e),n),i&&(n=js(n,7,Od));for(var o=t.length;o--;)Dd(n,t[o]);return n}));function Id(e,t,n,i){if(!gt(e))return e;for(var o=-1,r=(t=Bo(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var l=Fo(t[o]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=a){var c=s[l];void 0===(u=i?i(c,l,s):void 0)&&(u=gt(c)?c:qn(t[o+1])?[]:{})}_i(s,l,u),s=s[l]}return e}function Ld(e,t,n){for(var i=-1,o=t.length,r={};++i<o;){var a=t[i],s=Ho(e,a);n(s,a)&&Id(r,Bo(a,e),s)}return r}function Bd(e,t){if(null==e)return{};var n=it(La(e),(function(e){return[e]}));return t=Pl(t),Ld(e,n,(function(e,n){return t(e,n[0])}))}function jd(e,t){if(e!==t){var n=void 0!==e,i=null===e,o=e==e,r=et(e),a=void 0!==t,s=null===t,l=t==t,u=et(t);if(!s&&!u&&!r&&e>t||r&&a&&l&&!s&&!u||i&&a&&l||!n&&l||!o)return 1;if(!i&&!r&&!u&&e<t||u&&n&&o&&!i&&!r||s&&n&&o||!a&&o||!l)return-1}return 0}function Fd(e,t,n){t=t.length?it(t,(function(e){return ot(e)?function(t){return Ho(t,1===e.length?e[0]:e)}:e})):[St];var i=-1;t=it(t,Yi(Pl));var o=ec(e,(function(e,n,o){var r=it(t,(function(t){return t(e)}));return{criteria:r,index:++i,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(o,(function(e,t){return function(e,t,n){for(var i=-1,o=e.criteria,r=t.criteria,a=o.length,s=n.length;++i<a;){var l=jd(o[i],r[i]);if(l)return i>=s?l:l*("desc"==n[i]?-1:1)}return e.index-t.index}(e,t,n)}))}function Hd(e){return Ko((function(t){return t=it(t,Yi(Pl)),Ai((function(n){var i=this;return e(t,(function(e){return Jt(e,i,n)}))}))}))}var Wd=Hd(it),zd=Ai,Gd=Math.min,Ud=zd((function(e,t){var n=(t=1==t.length&&ot(t[0])?it(t[0],Yi(Pl)):it(Xo(t,1),Yi(Pl))).length;return Ai((function(i){for(var o=-1,r=Gd(i.length,n);++o<r;)i[o]=t[o].call(this,i[o]);return Jt(e,this,i)}))})),qd=Hd(ju),Xd=Hd(zs),Vd=9007199254740991,Kd=Math.floor;function Yd(e,t){var n="";if(!e||t<1||t>Vd)return n;do{t%2&&(n+=e),(t=Kd(t/2))&&(e+=e)}while(t);return n}var $d=Dl("length"),Zd="\\ud800-\\udfff",Jd="["+Zd+"]",Qd="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",eh="\\ud83c[\\udffb-\\udfff]",th="[^"+Zd+"]",nh="(?:\\ud83c[\\udde6-\\uddff]){2}",ih="[\\ud800-\\udbff][\\udc00-\\udfff]",oh="(?:"+Qd+"|"+eh+")"+"?",rh="[\\ufe0e\\ufe0f]?",ah=rh+oh+("(?:\\u200d(?:"+[th,nh,ih].join("|")+")"+rh+oh+")*"),sh="(?:"+[th+Qd+"?",Qd,nh,ih,Jd].join("|")+")",lh=RegExp(eh+"(?="+eh+")|"+sh+ah,"g");function uh(e){return vr(e)?function(e){for(var t=lh.lastIndex=0;lh.test(e);)++t;return t}(e):$d(e)}var ch=Math.ceil;function dh(e,t){var n=(t=void 0===t?" ":lt(t)).length;if(n<2)return n?Yd(t,e):t;var i=Yd(t,ch(e/uh(t)));return vr(t)?pr(Ar(i),0,e).join(""):i.slice(0,e)}var hh=Math.ceil,fh=Math.floor;var ph=/^\s+/,gh=We.parseInt;var vh=Ai((function(e,t){return bi(e,32,void 0,t,Kn(t,zn(vh)))}));vh.placeholder={};var mh=Ai((function(e,t){return bi(e,64,void 0,t,Kn(t,zn(mh)))}));mh.placeholder={};var yh=Gl((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var bh=Ko((function(e,t){return null==e?{}:function(e,t){return Ld(e,t,(function(t,n){return Tl(e,n)}))}(e,t)}));function xh(e,t,n,i){for(var o=n-1,r=e.length;++o<r;)if(i(e[o],t))return o;return-1}var wh=Array.prototype.splice;function Eh(e,t,n,i){var o=i?xh:Rn,r=-1,a=t.length,s=e;for(e===t&&(t=fn(t)),n&&(s=it(e,Yi(n)));++r<a;)for(var l=0,u=t[r],c=n?n(u):u;(l=o(s,c,l,i))>-1;)s!==e&&wh.call(s,l,1),wh.call(e,l,1);return e}function Ch(e,t){return e&&e.length&&t&&t.length?Eh(e,t):e}var Nh=Ai(Ch);var _h=Array.prototype.splice;function Sh(e,t){for(var n=e?t.length:0,i=n-1;n--;){var o=t[n];if(n==i||o!==r){var r=o;qn(o)?_h.call(e,o,1):Dd(e,o)}}return e}var Mh=Ko((function(e,t){var n=null==e?0:e.length,i=zo(e,t);return Sh(e,it(t,(function(e){return qn(e,n)?+e:e})).sort(jd)),i})),Th=Math.floor,Ah=Math.random;function kh(e,t){return e+Th(Ah()*(t-e+1))}var Rh=parseFloat,Dh=Math.min,Oh=Math.random;var Ph=Math.ceil,Ih=Math.max;function Lh(e){return function(t,n,i){return i&&"number"!=typeof i&&Oi(t,n,i)&&(n=i=void 0),t=Nt(t),void 0===n?(n=t,t=0):n=Nt(n),function(e,t,n,i){for(var o=-1,r=Ih(Ph((t-e)/(n||1)),0),a=Array(r);r--;)a[i?r:++o]=e,e+=n;return a}(t,n,i=void 0===i?t<n?1:-1:Nt(i),e)}}var Bh=Lh(),jh=Lh(!0),Fh=Ko((function(e,t){return bi(e,256,void 0,void 0,void 0,t)}));function Hh(e,t,n,i,o){return o(e,(function(e,o,r){n=i?(i=!1,e):t(n,e,o,r)})),n}function Wh(e,t,n){var i=ot(e)?Or:Hh,o=arguments.length<3;return i(e,Pl(t),n,o,Wl)}function zh(e,t,n,i){var o=null==e?0:e.length;for(i&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}var Gh=Array.prototype.reverse;function Uh(e){return null==e?e:Gh.call(e)}var qh=ga("round");function Xh(e){var t=e.length;return t?e[kh(0,t-1)]:void 0}function Vh(e){return Xh(Cc(e))}function Kh(e,t){var n=-1,i=e.length,o=i-1;for(t=void 0===t?i:t;++n<t;){var r=kh(n,o),a=e[r];e[r]=e[n],e[n]=a}return e.length=t,e}function Yh(e,t){return Kh(fn(e),xa(t,0,e.length))}function $h(e,t){var n=Cc(e);return Kh(n,xa(t,0,n.length))}function Zh(e){return Kh(fn(e))}function Jh(e){return Kh(Cc(e))}var Qh=da((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));function ef(e,t){var n;return Wl(e,(function(e,i,o){return!(n=t(e,i,o))})),!!n}var tf=Ai((function(e,t){if(null==e)return[];var n=t.length;return n>1&&Oi(e,t[0],t[1])?t=[]:n>2&&Oi(t[0],t[1],t[2])&&(t=[t[0]]),Fd(e,Xo(t,1),[])})),nf=4294967294,of=Math.floor,rf=Math.min;function af(e,t,n,i){var o=0,r=null==e?0:e.length;if(0===r)return 0;for(var a=(t=n(t))!=t,s=null===t,l=et(t),u=void 0===t;o<r;){var c=of((o+r)/2),d=n(e[c]),h=void 0!==d,f=null===d,p=d==d,g=et(d);if(a)var v=i||p;else v=u?p&&(i||h):s?p&&h&&(i||!f):l?p&&h&&!f&&(i||!g):!f&&!g&&(i?d<=t:d<t);v?o=c+1:r=c}return rf(r,nf)}var sf=2147483647;function lf(e,t,n){var i=0,o=null==e?i:e.length;if("number"==typeof t&&t==t&&o<=sf){for(;i<o;){var r=i+o>>>1,a=e[r];null!==a&&!et(a)&&(n?a<=t:a<t)?i=r+1:o=r}return o}return af(e,t,St,n)}function uf(e,t){for(var n=-1,i=e.length,o=0,r=[];++n<i;){var a=e[n],s=t?t(a):a;if(!n||!Ci(s,l)){var l=s;r[o++]=0===a?0:a}}return r}var cf=Math.max;var df=da((function(e,t,n){return e+(n?" ":"")+Rr(t)}));var hf=ut((function(e,t){return e-t}),0);var ff=Object.prototype,pf=ff.hasOwnProperty;function gf(e,t,n,i){return void 0===e||Ci(e,ff[n])&&!pf.call(i,n)?t:e}var vf={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function mf(e){return"\\"+vf[e]}var yf=/<%=([\s\S]+?)%>/g,bf={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:yf,variable:"",imports:{_:{escape:Iu}}},xf=/\b__p \+= '';/g,wf=/\b(__p \+=) '' \+/g,Ef=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Cf=/[()=,{}\[\]\/\s]/,Nf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_f=/($^)/,Sf=/['\n\r\u2028\u2029\\]/g,Mf=Object.prototype.hasOwnProperty;function Tf(e,t){return t(e)}var Af=4294967295,kf=Math.min;function Rf(e,t){var n=e;return n instanceof an&&(n=n.value()),Or(t,(function(e,t){return t.func.apply(t.thisArg,Go([e],t.args))}),n)}function Df(){return Rf(this.__wrapped__,this.__actions__)}var Of=9007199254740991;function Pf(e,t){for(var n=e.length;n--&&Rn(t,e[n],0)>-1;);return n}function If(e,t){for(var n=-1,i=e.length;++n<i&&Rn(t,e[n],0)>-1;);return n}var Lf=/^\s+/;var Bf=/\w*$/;var jf=Pr({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Ff=/&(?:amp|lt|gt|quot|#39);/g,Hf=RegExp(Ff.source);var Wf=Fa&&1/Ks(new Fa([,-0]))[1]==1/0?function(e){return new Fa(e)}:sn,zf=200;function Gf(e,t,n){var i=-1,o=Dn,r=e.length,a=!0,s=[],l=s;if(n)a=!1,o=fu;else if(r>=zf){var u=t?null:Wf(e);if(u)return Ks(u);a=!1,o=Gs,l=new Ws}else l=t?[]:s;e:for(;++i<r;){var c=e[i],d=t?t(c):c;if(c=n||0!==c?c:0,a&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue e;t&&l.push(d),s.push(c)}else o(l,d,n)||(l!==s&&l.push(d),s.push(c))}return s}var Uf=Ai((function(e){return Gf(Xo(e,1,iu,!0))})),qf=Ai((function(e){var t=mu(e);return iu(t)&&(t=void 0),Gf(Xo(e,1,iu,!0),Pl(t))})),Xf=Ai((function(e){var t=mu(e);return t="function"==typeof t?t:void 0,Gf(Xo(e,1,iu,!0),void 0,t)}));function Vf(e,t){return e&&e.length?Gf(e,Pl(t)):[]}var Kf=0;var Yf=Math.max;function $f(e){if(!e||!e.length)return[];var t=0;return e=Ta(e,(function(e){if(iu(e))return t=Yf(e.length,t),!0})),Bi(t,(function(t){return it(e,Dl(t))}))}function Zf(e,t){if(!e||!e.length)return[];var n=$f(e);return null==t?n:it(n,(function(e){return Jt(t,void 0,e)}))}function Jf(e,t,n,i){return Id(e,t,n(Ho(e,t)),i)}var Qf=da((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}));var ep=Ai((function(e,t){return iu(e)?gu(e,t):[]}));var tp=Ko((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return zo(t,e)};return!(t>1||this.__actions__.length)&&i instanceof an&&qn(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Tf,args:[o],thisArg:void 0}),new hn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(o)}));function np(e,t,n){var i=e.length;if(i<2)return i?Gf(e[0]):[];for(var o=-1,r=Array(i);++o<i;)for(var a=e[o],s=-1;++s<i;)s!=o&&(r[o]=gu(r[o]||a,e[s],t,n));return Gf(Xo(r,1),t,n)}var ip=Ai((function(e){return np(Ta(e,iu))})),op=Ai((function(e){var t=mu(e);return iu(t)&&(t=void 0),np(Ta(e,iu),Pl(t))})),rp=Ai((function(e){var t=mu(e);return t="function"==typeof t?t:void 0,np(Ta(e,iu),void 0,t)})),ap=Ai($f);function sp(e,t,n){for(var i=-1,o=e.length,r=t.length,a={};++i<o;){var s=i<r?t[i]:void 0;n(a,e[i],s)}return a}var lp=Ai((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Zf(e,n)})),up={chunk:function(e,t,n){t=(n?Oi(e,t,n):void 0===t)?1:ba(_t(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,r=0,a=Array(ya(i/t));o<i;)a[r++]=fr(e,o,o+=t);return a},compact:function(e){for(var t=-1,n=null==e?0:e.length,i=0,o=[];++t<n;){var r=e[t];r&&(o[i++]=r)}return o},concat:Hs,difference:vu,differenceBy:yu,differenceWith:bu,drop:function(e,t,n){var i=null==e?0:e.length;return i?fr(e,(t=n||void 0===t?1:_t(t))<0?0:t,i):[]},dropRight:function(e,t,n){var i=null==e?0:e.length;return i?fr(e,0,(t=i-(t=n||void 0===t?1:_t(t)))<0?0:t):[]},dropRightWhile:function(e,t){return e&&e.length?wu(e,Pl(t),!0,!0):[]},dropWhile:function(e,t){return e&&e.length?wu(e,Pl(t),!0):[]},fill:function(e,t,n,i){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&Oi(e,t,n)&&(n=0,i=o),function(e,t,n,i){var o=e.length;for((n=_t(n))<0&&(n=-n>o?0:o+n),(i=void 0===i||i>o?o:_t(i))<0&&(i+=o),i=n>i?0:Wu(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},findIndex:Xu,findLastIndex:Zu,first:Qu,flatten:Vo,flattenDeep:function(e){return(null==e?0:e.length)?Xo(e,ic):[]},flattenDepth:function(e,t){return(null==e?0:e.length)?Xo(e,t=void 0===t?1:_t(t)):[]},fromPairs:function(e){for(var t=-1,n=null==e?0:e.length,i={};++t<n;){var o=e[t];i[o[0]]=o[1]}return i},head:Qu,indexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=null==n?0:_t(n);return o<0&&(o=_c(i+o,0)),Rn(e,t,o)},initial:function(e){return(null==e?0:e.length)?fr(e,0,-1):[]},intersection:Ac,intersectionBy:kc,intersectionWith:Rc,join:function(e,t){return null==e?"":ad.call(e,t)},last:mu,lastIndexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return void 0!==n&&(o=(o=_t(n))<0?ud(i+o,0):cd(o,i-1)),t==t?function(e,t,n){for(var i=n+1;i--;)if(e[i]===t)return i;return i}(e,t,o):An(e,kn,o,!0)},nth:function(e,t){return e&&e.length?Rd(e,_t(t)):void 0},pull:Nh,pullAll:Ch,pullAllBy:function(e,t,n){return e&&e.length&&t&&t.length?Eh(e,t,Pl(n)):e},pullAllWith:function(e,t,n){return e&&e.length&&t&&t.length?Eh(e,t,void 0,n):e},pullAt:Mh,remove:function(e,t){var n=[];if(!e||!e.length)return n;var i=-1,o=[],r=e.length;for(t=Pl(t);++i<r;){var a=e[i];t(a,i,e)&&(n.push(a),o.push(i))}return Sh(e,o),n},reverse:Uh,slice:function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&Oi(e,t,n)?(t=0,n=i):(t=null==t?0:_t(t),n=void 0===n?i:_t(n)),fr(e,t,n)):[]},sortedIndex:function(e,t){return lf(e,t)},sortedIndexBy:function(e,t,n){return af(e,t,Pl(n))},sortedIndexOf:function(e,t){var n=null==e?0:e.length;if(n){var i=lf(e,t);if(i<n&&Ci(e[i],t))return i}return-1},sortedLastIndex:function(e,t){return lf(e,t,!0)},sortedLastIndexBy:function(e,t,n){return af(e,t,Pl(n),!0)},sortedLastIndexOf:function(e,t){if(null==e?0:e.length){var n=lf(e,t,!0)-1;if(Ci(e[n],t))return n}return-1},sortedUniq:function(e){return e&&e.length?uf(e):[]},sortedUniqBy:function(e,t){return e&&e.length?uf(e,Pl(t)):[]},tail:function(e){var t=null==e?0:e.length;return t?fr(e,1,t):[]},take:function(e,t,n){return e&&e.length?fr(e,0,(t=n||void 0===t?1:_t(t))<0?0:t):[]},takeRight:function(e,t,n){var i=null==e?0:e.length;return i?fr(e,(t=i-(t=n||void 0===t?1:_t(t)))<0?0:t,i):[]},takeRightWhile:function(e,t){return e&&e.length?wu(e,Pl(t),!1,!0):[]},takeWhile:function(e,t){return e&&e.length?wu(e,Pl(t)):[]},union:Uf,unionBy:qf,unionWith:Xf,uniq:function(e){return e&&e.length?Gf(e):[]},uniqBy:Vf,uniqWith:function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Gf(e,void 0,t):[]},unzip:$f,unzipWith:Zf,without:ep,xor:ip,xorBy:op,xorWith:rp,zip:ap,zipObject:function(e,t){return sp(e||[],t||[],_i)},zipObjectDeep:function(e,t){return sp(e||[],t||[],Id)},zipWith:lp},cp={countBy:ql,each:Cu,eachRight:Tu,every:function(e,t,n){var i=ot(e)?ju:Fu;return n&&Oi(e,t,n)&&(t=void 0),i(e,Pl(t))},filter:Gu,find:Vu,findLast:Ju,flatMap:function(e,t){return Xo(tc(e,t),1)},flatMapDeep:function(e,t){return Xo(tc(e,t),nc)},flatMapDepth:function(e,t,n){return n=void 0===n?1:_t(n),Xo(tc(e,t),n)},forEach:Cu,forEachRight:Tu,groupBy:cc,includes:function(e,t,n,i){e=Di(e)?e:Cc(e),n=n&&!i?_t(n):0;var o=e.length;return n<0&&(n=Nc(o+n,0)),wc(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Rn(e,t,n)>-1},invokeMap:zc,keyBy:ld,map:tc,orderBy:function(e,t,n,i){return null==e?[]:(ot(t)||(t=null==t?[]:[t]),ot(n=i?void 0:n)||(n=null==n?[]:[n]),Fd(e,t,n))},partition:yh,reduce:Wh,reduceRight:function(e,t,n){var i=ot(e)?zh:Hh,o=arguments.length<3;return i(e,Pl(t),n,o,Mu)},reject:function(e,t){return(ot(e)?Ta:zu)(e,Sd(Pl(t)))},sample:function(e){return(ot(e)?Xh:Vh)(e)},sampleSize:function(e,t,n){return t=(n?Oi(e,t,n):void 0===t)?1:_t(t),(ot(e)?Yh:$h)(e,t)},shuffle:function(e){return(ot(e)?Zh:Jh)(e)},size:function(e){if(null==e)return 0;if(Di(e))return wc(e)?uh(e):e.length;var t=Za(e);return"[object Map]"==t||"[object Set]"==t?e.size:so(e).length},some:function(e,t,n){var i=ot(e)?zs:ef;return n&&Oi(e,t,n)&&(t=void 0),i(e,Pl(t))},sortBy:tf},dp=Kl,hp={after:function(e,t){if("function"!=typeof t)throw new TypeError("Expected a function");return e=_t(e),function(){if(--e<1)return t.apply(this,arguments)}},ary:wi,before:ur,bind:cr,bindKey:hr,curry:Xl,curryRight:Vl,debounce:Jl,defer:du,delay:hu,flip:function(e){return bi(e,512)},memoize:Do,negate:Sd,once:function(e){return ur(2,e)},overArgs:Ud,partial:vh,partialRight:mh,rearg:Fh,rest:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return Ai(e,t=void 0===t?t:_t(t))},spread:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=null==t?0:cf(_t(t),0),Ai((function(n){var i=n[t],o=pr(n,0,t);return i&&Go(o,i),Jt(e,this,o)}))},throttle:function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return gt(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Jl(e,t,{leading:i,maxWait:t,trailing:o})},unary:function(e){return wi(e,1)},wrap:function(e,t){return vh(Eu(t),e)}},fp={castArray:function(){if(!arguments.length)return[];var e=arguments[0];return ot(e)?e:[e]},clone:function(e){return js(e,4)},cloneDeep:Fs,cloneDeepWith:function(e,t){return js(e,5,t="function"==typeof t?t:void 0)},cloneWith:function(e,t){return js(e,4,t="function"==typeof t?t:void 0)},conformsTo:function(e,t){return null==t||Il(e,t,lo(t))},eq:Ci,gt:fc,gte:pc,isArguments:zi,isArray:ot,isArrayBuffer:Uc,isArrayLike:Di,isArrayLikeObject:iu,isBoolean:function(e){return!0===e||!1===e||Je(e)&&"[object Boolean]"==Ze(e)},isBuffer:Vi,isDate:Xc,isElement:function(e){return Je(e)&&1===e.nodeType&&!ir(e)},isEmpty:Kc,isEqual:Yc,isEqualWith:function(e,t,n){var i=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===i?yl(e,t,void 0,n):!!i},isError:ar,isFinite:Zc,isFunction:Rt,isInteger:Jc,isLength:Ri,isMap:Ms,isMatch:function(e,t){return e===t||wl(e,t,Cl(t))},isMatchWith:function(e,t,n){return n="function"==typeof n?n:void 0,wl(e,t,Cl(t),n)},isNaN:function(e){return ed(e)&&e!=+e},isNative:function(e){if(td(e))throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Gt(e)},isNil:nd,isNull:function(e){return null===e},isNumber:ed,isObject:gt,isObjectLike:Je,isPlainObject:ir,isRegExp:od,isSafeInteger:function(e){return Jc(e)&&e>=-9007199254740991&&e<=rd},isSet:As,isString:wc,isSymbol:et,isTypedArray:to,isUndefined:function(e){return void 0===e},isWeakMap:function(e){return Je(e)&&"[object WeakMap]"==Za(e)},isWeakSet:function(e){return Je(e)&&"[object WeakSet]"==Ze(e)},lt:pd,lte:gd,toArray:kd,toFinite:Nt,toInteger:_t,toLength:Wu,toNumber:wt,toPlainObject:ru,toSafeInteger:function(e){return e?xa(_t(e),-9007199254740991,Of):0===e?e:0},toString:Lo},pp={add:ct,ceil:va,divide:xu,floor:oc,max:function(e){return e&&e.length?vd(e,St,dc):void 0},maxBy:function(e,t){return e&&e.length?vd(e,Pl(t),dc):void 0},mean:function(e){return bd(e,St)},meanBy:function(e,t){return bd(e,Pl(t))},min:function(e){return e&&e.length?vd(e,St,fd):void 0},minBy:function(e,t){return e&&e.length?vd(e,Pl(t),fd):void 0},multiply:Nd,round:qh,subtract:hf,sum:function(e){return e&&e.length?md(e,St):0},sumBy:function(e,t){return e&&e.length?md(e,Pl(t)):0}},gp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=wt(n))==n?n:0),void 0!==t&&(t=(t=wt(t))==t?t:0),xa(wt(e),t,n)},vp=function(e,t,n){return t=Nt(t),void 0===n?(n=t,t=0):n=Nt(n),function(e,t,n){return e>=bc(t,n)&&e<yc(t,n)}(e=wt(e),t,n)},mp=function(e,t,n){if(n&&"boolean"!=typeof n&&Oi(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=Nt(e),void 0===t?(t=e,e=0):t=Nt(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=Oh();return Dh(e+o*(t-e+Rh("1e-"+((o+"").length-1))),t)}return kh(e,t)},yp={assign:co,assignIn:go,assignInWith:vo,assignWith:mo,at:Yo,create:function(e,t){var n=Yt(e);return null==t?n:Ea(n,t)},defaults:tu,defaultsDeep:uu,entries:ku,entriesIn:Ru,extend:go,extendWith:vo,findKey:function(e,t){return Ku(e,Pl(t),Fl)},findLastKey:function(e,t){return Ku(e,Pl(t),Su)},forIn:function(e,t){return null==e?e:jl(e,Eu(t),po)},forInRight:function(e,t){return null==e?e:_u(e,Eu(t),po)},forOwn:function(e,t){return e&&Fl(e,Eu(t))},forOwnRight:function(e,t){return e&&Su(e,Eu(t))},functions:function(e){return null==e?[]:lc(e,lo(e))},functionsIn:function(e){return null==e?[]:lc(e,po(e))},get:Wo,has:mc,hasIn:Tl,invert:Pc,invertBy:jc,invoke:Wc,keys:lo,keysIn:po,mapKeys:function(e,t){var n={};return t=Pl(t),Fl(e,(function(e,i,o){Ei(n,t(e,i,o),e)})),n},mapValues:function(e,t){var n={};return t=Pl(t),Fl(e,(function(e,i,o){Ei(n,i,t(e,i,o))})),n},merge:xd,mergeWith:lu,omit:Pd,omitBy:function(e,t){return Bd(e,Sd(Pl(t)))},pick:bh,pickBy:Bd,result:function(e,t,n){var i=-1,o=(t=Bo(t,e)).length;for(o||(o=1,e=void 0);++i<o;){var r=null==e?void 0:e[Fo(t[i])];void 0===r&&(i=o,r=n),e=Rt(r)?r.call(e):r}return e},set:function(e,t,n){return null==e?e:Id(e,t,n)},setWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Id(e,t,n,i)},toPairs:ku,toPairsIn:Ru,transform:function(e,t,n){var i=ot(e),o=i||Vi(e)||to(e);if(t=Pl(t),null==n){var r=e&&e.constructor;n=o?i?new r:[]:gt(e)&&Rt(r)?Yt($o(e)):{}}return(o?Tn:Fl)(e,(function(e,i,o){return t(n,e,i,o)})),n},unset:function(e,t){return null==e||Dd(e,t)},update:function(e,t,n){return null==e?e:Jf(e,t,Eu(n))},updateWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Jf(e,t,Eu(n),i)},values:Cc,valuesIn:function(e){return null==e?[]:Ec(e,po(e))}},bp={at:tp,chain:ma,commit:function(){return new hn(this.value(),this.__chain__)},lodash:vn,next:function(){void 0===this.__values__&&(this.__values__=kd(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},plant:function(e){for(var t,n=this;n instanceof on;){var i=pn(n);i.__index__=0,i.__values__=void 0,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},reverse:function(){var e=this.__wrapped__;if(e instanceof an){var t=e;return this.__actions__.length&&(t=new an(this)),(t=t.reverse()).__actions__.push({func:Tf,args:[Uh],thisArg:void 0}),new hn(t,this.__chain__)}return this.thru(Uh)},tap:function(e,t){return t(e),e},thru:Tf,toIterator:function(){return this},toJSON:Df,value:Df,valueOf:Df,wrapperChain:function(){return ma(this)}},xp={camelCase:ha,capitalize:Dr,deburr:jr,endsWith:function(e,t,n){e=Lo(e),t=lt(t);var i=e.length,o=n=void 0===n?i:xa(_t(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},escape:Iu,escapeRegExp:function(e){return(e=Lo(e))&&Bu.test(e)?e.replace(Lu,"\\$&"):e},kebabCase:sd,lowerCase:dd,lowerFirst:hd,pad:function(e,t,n){e=Lo(e);var i=(t=_t(t))?uh(e):0;if(!t||i>=t)return e;var o=(t-i)/2;return dh(fh(o),n)+e+dh(hh(o),n)},padEnd:function(e,t,n){e=Lo(e);var i=(t=_t(t))?uh(e):0;return t&&i<t?e+dh(t-i,n):e},padStart:function(e,t,n){e=Lo(e);var i=(t=_t(t))?uh(e):0;return t&&i<t?dh(t-i,n)+e:e},parseInt:function(e,t,n){return n||null==t?t=0:t&&(t=+t),gh(Lo(e).replace(ph,""),t||0)},repeat:function(e,t,n){return t=(n?Oi(e,t,n):void 0===t)?1:_t(t),Yd(Lo(e),t)},replace:function(){var e=arguments,t=Lo(e[0]);return e.length<3?t:t.replace(e[1],e[2])},snakeCase:Qh,split:function(e,t,n){return n&&"number"!=typeof n&&Oi(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=Lo(e))&&("string"==typeof t||null!=t&&!od(t))&&!(t=lt(t))&&vr(e)?pr(Ar(e),0,n):e.split(t,n):[]},startCase:df,startsWith:function(e,t,n){return e=Lo(e),n=null==n?0:xa(_t(n),0,e.length),t=lt(t),e.slice(n,n+t.length)==t},template:function(e,t,n){var i=bf.imports._.templateSettings||bf;n&&Oi(e,t,n)&&(t=void 0),e=Lo(e),t=vo({},t,i,gf);var o,r,a=vo({},t.imports,i.imports,gf),s=lo(a),l=Ec(a,s),u=0,c=t.interpolate||_f,d="__p += '",h=RegExp((t.escape||_f).source+"|"+c.source+"|"+(c===yf?Nf:_f).source+"|"+(t.evaluate||_f).source+"|$","g"),f=Mf.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(h,(function(t,n,i,a,s,l){return i||(i=a),d+=e.slice(u,l).replace(Sf,mf),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),s&&(r=!0,d+="';\n"+s+";\n__p += '"),i&&(d+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),u=l+t.length,t})),d+="';\n";var p=Mf.call(t,"variable")&&t.variable;if(p){if(Cf.test(p))throw new Error("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(r?d.replace(xf,""):d).replace(wf,"$1").replace(Ef,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(r?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=sr((function(){return Function(s,f+"return "+d).apply(void 0,l)}));if(g.source=d,ar(g))throw g;return g},templateSettings:bf,toLower:function(e){return Lo(e).toLowerCase()},toUpper:function(e){return Lo(e).toUpperCase()},trim:function(e,t,n){if((e=Lo(e))&&(n||void 0===t))return pt(e);if(!e||!(t=lt(t)))return e;var i=Ar(e),o=Ar(t);return pr(i,If(i,o),Pf(i,o)+1).join("")},trimEnd:function(e,t,n){if((e=Lo(e))&&(n||void 0===t))return e.slice(0,ht(e)+1);if(!e||!(t=lt(t)))return e;var i=Ar(e);return pr(i,0,Pf(i,Ar(t))+1).join("")},trimStart:function(e,t,n){if((e=Lo(e))&&(n||void 0===t))return e.replace(Lf,"");if(!e||!(t=lt(t)))return e;var i=Ar(e);return pr(i,If(i,Ar(t))).join("")},truncate:function(e,t){var n=30,i="...";if(gt(t)){var o="separator"in t?t.separator:o;n="length"in t?_t(t.length):n,i="omission"in t?lt(t.omission):i}var r=(e=Lo(e)).length;if(vr(e)){var a=Ar(e);r=a.length}if(n>=r)return e;var s=n-uh(i);if(s<1)return i;var l=a?pr(a,0,s).join(""):e.slice(0,s);if(void 0===o)return l+i;if(a&&(s+=l.length-s),od(o)){if(e.slice(s).search(o)){var u,c=l;for(o.global||(o=RegExp(o.source,Lo(Bf.exec(o))+"g")),o.lastIndex=0;u=o.exec(c);)var d=u.index;l=l.slice(0,void 0===d?s:d)}}else if(e.indexOf(lt(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+i},unescape:function(e){return(e=Lo(e))&&Hf.test(e)?e.replace(Ff,jf):e},upperCase:Qf,upperFirst:Rr,words:ua},wp={attempt:sr,bindAll:dr,cond:function(e){var t=null==e?0:e.length,n=Pl;return e=t?it(e,(function(e){if("function"!=typeof e[1])throw new TypeError("Expected a function");return[n(e[0]),e[1]]})):[],Ai((function(n){for(var i=-1;++i<t;){var o=e[i];if(Jt(o[0],this,n))return Jt(o[1],this,n)}}))},conforms:function(e){return function(e){var t=lo(e);return function(n){return Il(n,e,t)}}(js(e,1))},constant:Nn,defaultTo:function(e,t){return null==e||e!=e?t:e},flow:ac,flowRight:sc,identity:St,iteratee:function(e){return Pl("function"==typeof e?e:js(e,1))},matches:function(e){return _l(js(e,1))},matchesProperty:function(e,t){return Rl(e,js(t,1))},method:wd,methodOf:Ed,mixin:Cd,noop:sn,nthArg:function(e){return e=_t(e),Ai((function(t){return Rd(t,e)}))},over:Wd,overEvery:qd,overSome:Xd,property:Ol,propertyOf:function(e){return function(t){return null==e?void 0:Ho(e,t)}},range:Bh,rangeRight:jh,stubArray:Aa,stubFalse:Gi,stubObject:function(){return{}},stubString:function(){return""},stubTrue:function(){return!0},times:function(e,t){if((e=_t(e))<1||e>9007199254740991)return[];var n=Af,i=kf(e,Af);t=Eu(t),e-=Af;for(var o=Bi(i,t);++n<e;)t(n);return o},toPath:function(e){return ot(e)?it(e,Fo):et(e)?[e]:fn(Io(Lo(e)))},uniqueId:function(e){var t=++Kf;return Lo(e)+t}};var Ep=Math.max,Cp=Math.min;var Np=Math.min;var _p,Sp,Mp=4294967295,Tp=Array.prototype,Ap=Object.prototype.hasOwnProperty,kp=ze?ze.iterator:void 0,Rp=Math.max,Dp=Math.min,Op=function(e){return function(t,n,i){if(null==i){var o=gt(n),r=o&&lo(n),a=r&&r.length&&lc(n,r);(a?a.length:o)||(i=n,n=t,t=this)}return e(t,n,i)}}(Cd);vn.after=hp.after,vn.ary=hp.ary,vn.assign=yp.assign,vn.assignIn=yp.assignIn,vn.assignInWith=yp.assignInWith,vn.assignWith=yp.assignWith,vn.at=yp.at,vn.before=hp.before,vn.bind=hp.bind,vn.bindAll=wp.bindAll,vn.bindKey=hp.bindKey,vn.castArray=fp.castArray,vn.chain=bp.chain,vn.chunk=up.chunk,vn.compact=up.compact,vn.concat=up.concat,vn.cond=wp.cond,vn.conforms=wp.conforms,vn.constant=wp.constant,vn.countBy=cp.countBy,vn.create=yp.create,vn.curry=hp.curry,vn.curryRight=hp.curryRight,vn.debounce=hp.debounce,vn.defaults=yp.defaults,vn.defaultsDeep=yp.defaultsDeep,vn.defer=hp.defer,vn.delay=hp.delay,vn.difference=up.difference,vn.differenceBy=up.differenceBy,vn.differenceWith=up.differenceWith,vn.drop=up.drop,vn.dropRight=up.dropRight,vn.dropRightWhile=up.dropRightWhile,vn.dropWhile=up.dropWhile,vn.fill=up.fill,vn.filter=cp.filter,vn.flatMap=cp.flatMap,vn.flatMapDeep=cp.flatMapDeep,vn.flatMapDepth=cp.flatMapDepth,vn.flatten=up.flatten,vn.flattenDeep=up.flattenDeep,vn.flattenDepth=up.flattenDepth,vn.flip=hp.flip,vn.flow=wp.flow,vn.flowRight=wp.flowRight,vn.fromPairs=up.fromPairs,vn.functions=yp.functions,vn.functionsIn=yp.functionsIn,vn.groupBy=cp.groupBy,vn.initial=up.initial,vn.intersection=up.intersection,vn.intersectionBy=up.intersectionBy,vn.intersectionWith=up.intersectionWith,vn.invert=yp.invert,vn.invertBy=yp.invertBy,vn.invokeMap=cp.invokeMap,vn.iteratee=wp.iteratee,vn.keyBy=cp.keyBy,vn.keys=lo,vn.keysIn=yp.keysIn,vn.map=cp.map,vn.mapKeys=yp.mapKeys,vn.mapValues=yp.mapValues,vn.matches=wp.matches,vn.matchesProperty=wp.matchesProperty,vn.memoize=hp.memoize,vn.merge=yp.merge,vn.mergeWith=yp.mergeWith,vn.method=wp.method,vn.methodOf=wp.methodOf,vn.mixin=Op,vn.negate=Sd,vn.nthArg=wp.nthArg,vn.omit=yp.omit,vn.omitBy=yp.omitBy,vn.once=hp.once,vn.orderBy=cp.orderBy,vn.over=wp.over,vn.overArgs=hp.overArgs,vn.overEvery=wp.overEvery,vn.overSome=wp.overSome,vn.partial=hp.partial,vn.partialRight=hp.partialRight,vn.partition=cp.partition,vn.pick=yp.pick,vn.pickBy=yp.pickBy,vn.property=wp.property,vn.propertyOf=wp.propertyOf,vn.pull=up.pull,vn.pullAll=up.pullAll,vn.pullAllBy=up.pullAllBy,vn.pullAllWith=up.pullAllWith,vn.pullAt=up.pullAt,vn.range=wp.range,vn.rangeRight=wp.rangeRight,vn.rearg=hp.rearg,vn.reject=cp.reject,vn.remove=up.remove,vn.rest=hp.rest,vn.reverse=up.reverse,vn.sampleSize=cp.sampleSize,vn.set=yp.set,vn.setWith=yp.setWith,vn.shuffle=cp.shuffle,vn.slice=up.slice,vn.sortBy=cp.sortBy,vn.sortedUniq=up.sortedUniq,vn.sortedUniqBy=up.sortedUniqBy,vn.split=xp.split,vn.spread=hp.spread,vn.tail=up.tail,vn.take=up.take,vn.takeRight=up.takeRight,vn.takeRightWhile=up.takeRightWhile,vn.takeWhile=up.takeWhile,vn.tap=bp.tap,vn.throttle=hp.throttle,vn.thru=Tf,vn.toArray=fp.toArray,vn.toPairs=yp.toPairs,vn.toPairsIn=yp.toPairsIn,vn.toPath=wp.toPath,vn.toPlainObject=fp.toPlainObject,vn.transform=yp.transform,vn.unary=hp.unary,vn.union=up.union,vn.unionBy=up.unionBy,vn.unionWith=up.unionWith,vn.uniq=up.uniq,vn.uniqBy=up.uniqBy,vn.uniqWith=up.uniqWith,vn.unset=yp.unset,vn.unzip=up.unzip,vn.unzipWith=up.unzipWith,vn.update=yp.update,vn.updateWith=yp.updateWith,vn.values=yp.values,vn.valuesIn=yp.valuesIn,vn.without=up.without,vn.words=xp.words,vn.wrap=hp.wrap,vn.xor=up.xor,vn.xorBy=up.xorBy,vn.xorWith=up.xorWith,vn.zip=up.zip,vn.zipObject=up.zipObject,vn.zipObjectDeep=up.zipObjectDeep,vn.zipWith=up.zipWith,vn.entries=yp.toPairs,vn.entriesIn=yp.toPairsIn,vn.extend=yp.assignIn,vn.extendWith=yp.assignInWith,Op(vn,vn),vn.add=pp.add,vn.attempt=wp.attempt,vn.camelCase=xp.camelCase,vn.capitalize=xp.capitalize,vn.ceil=pp.ceil,vn.clamp=gp,vn.clone=fp.clone,vn.cloneDeep=fp.cloneDeep,vn.cloneDeepWith=fp.cloneDeepWith,vn.cloneWith=fp.cloneWith,vn.conformsTo=fp.conformsTo,vn.deburr=xp.deburr,vn.defaultTo=wp.defaultTo,vn.divide=pp.divide,vn.endsWith=xp.endsWith,vn.eq=fp.eq,vn.escape=xp.escape,vn.escapeRegExp=xp.escapeRegExp,vn.every=cp.every,vn.find=cp.find,vn.findIndex=up.findIndex,vn.findKey=yp.findKey,vn.findLast=cp.findLast,vn.findLastIndex=up.findLastIndex,vn.findLastKey=yp.findLastKey,vn.floor=pp.floor,vn.forEach=cp.forEach,vn.forEachRight=cp.forEachRight,vn.forIn=yp.forIn,vn.forInRight=yp.forInRight,vn.forOwn=yp.forOwn,vn.forOwnRight=yp.forOwnRight,vn.get=yp.get,vn.gt=fp.gt,vn.gte=fp.gte,vn.has=yp.has,vn.hasIn=yp.hasIn,vn.head=up.head,vn.identity=St,vn.includes=cp.includes,vn.indexOf=up.indexOf,vn.inRange=vp,vn.invoke=yp.invoke,vn.isArguments=fp.isArguments,vn.isArray=ot,vn.isArrayBuffer=fp.isArrayBuffer,vn.isArrayLike=fp.isArrayLike,vn.isArrayLikeObject=fp.isArrayLikeObject,vn.isBoolean=fp.isBoolean,vn.isBuffer=fp.isBuffer,vn.isDate=fp.isDate,vn.isElement=fp.isElement,vn.isEmpty=fp.isEmpty,vn.isEqual=fp.isEqual,vn.isEqualWith=fp.isEqualWith,vn.isError=fp.isError,vn.isFinite=fp.isFinite,vn.isFunction=fp.isFunction,vn.isInteger=fp.isInteger,vn.isLength=fp.isLength,vn.isMap=fp.isMap,vn.isMatch=fp.isMatch,vn.isMatchWith=fp.isMatchWith,vn.isNaN=fp.isNaN,vn.isNative=fp.isNative,vn.isNil=fp.isNil,vn.isNull=fp.isNull,vn.isNumber=fp.isNumber,vn.isObject=gt,vn.isObjectLike=fp.isObjectLike,vn.isPlainObject=fp.isPlainObject,vn.isRegExp=fp.isRegExp,vn.isSafeInteger=fp.isSafeInteger,vn.isSet=fp.isSet,vn.isString=fp.isString,vn.isSymbol=fp.isSymbol,vn.isTypedArray=fp.isTypedArray,vn.isUndefined=fp.isUndefined,vn.isWeakMap=fp.isWeakMap,vn.isWeakSet=fp.isWeakSet,vn.join=up.join,vn.kebabCase=xp.kebabCase,vn.last=mu,vn.lastIndexOf=up.lastIndexOf,vn.lowerCase=xp.lowerCase,vn.lowerFirst=xp.lowerFirst,vn.lt=fp.lt,vn.lte=fp.lte,vn.max=pp.max,vn.maxBy=pp.maxBy,vn.mean=pp.mean,vn.meanBy=pp.meanBy,vn.min=pp.min,vn.minBy=pp.minBy,vn.stubArray=wp.stubArray,vn.stubFalse=wp.stubFalse,vn.stubObject=wp.stubObject,vn.stubString=wp.stubString,vn.stubTrue=wp.stubTrue,vn.multiply=pp.multiply,vn.nth=up.nth,vn.noop=wp.noop,vn.now=dp,vn.pad=xp.pad,vn.padEnd=xp.padEnd,vn.padStart=xp.padStart,vn.parseInt=xp.parseInt,vn.random=mp,vn.reduce=cp.reduce,vn.reduceRight=cp.reduceRight,vn.repeat=xp.repeat,vn.replace=xp.replace,vn.result=yp.result,vn.round=pp.round,vn.sample=cp.sample,vn.size=cp.size,vn.snakeCase=xp.snakeCase,vn.some=cp.some,vn.sortedIndex=up.sortedIndex,vn.sortedIndexBy=up.sortedIndexBy,vn.sortedIndexOf=up.sortedIndexOf,vn.sortedLastIndex=up.sortedLastIndex,vn.sortedLastIndexBy=up.sortedLastIndexBy,vn.sortedLastIndexOf=up.sortedLastIndexOf,vn.startCase=xp.startCase,vn.startsWith=xp.startsWith,vn.subtract=pp.subtract,vn.sum=pp.sum,vn.sumBy=pp.sumBy,vn.template=xp.template,vn.times=wp.times,vn.toFinite=fp.toFinite,vn.toInteger=_t,vn.toLength=fp.toLength,vn.toLower=xp.toLower,vn.toNumber=fp.toNumber,vn.toSafeInteger=fp.toSafeInteger,vn.toString=fp.toString,vn.toUpper=xp.toUpper,vn.trim=xp.trim,vn.trimEnd=xp.trimEnd,vn.trimStart=xp.trimStart,vn.truncate=xp.truncate,vn.unescape=xp.unescape,vn.uniqueId=wp.uniqueId,vn.upperCase=xp.upperCase,vn.upperFirst=xp.upperFirst,vn.each=cp.forEach,vn.eachRight=cp.forEachRight,vn.first=up.head,Op(vn,(_p={},Fl(vn,(function(e,t){Ap.call(vn.prototype,t)||(_p[t]=e)})),_p),{chain:!1}),vn.VERSION="4.17.21",(vn.templateSettings=xp.templateSettings).imports._=vn,Tn(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){vn[e].placeholder=vn})),Tn(["drop","take"],(function(e,t){an.prototype[e]=function(n){n=void 0===n?1:Rp(_t(n),0);var i=this.__filtered__&&!t?new an(this):this.clone();return i.__filtered__?i.__takeCount__=Dp(n,i.__takeCount__):i.__views__.push({size:Dp(n,Mp),type:e+(i.__dir__<0?"Right":"")}),i},an.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Tn(["filter","map","takeWhile"],(function(e,t){var n=t+1,i=1==n||3==n;an.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Pl(e),type:n}),t.__filtered__=t.__filtered__||i,t}})),Tn(["head","last"],(function(e,t){var n="take"+(t?"Right":"");an.prototype[e]=function(){return this[n](1).value()[0]}})),Tn(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");an.prototype[e]=function(){return this.__filtered__?new an(this):this[n](1)}})),an.prototype.compact=function(){return this.filter(St)},an.prototype.find=function(e){return this.filter(e).head()},an.prototype.findLast=function(e){return this.reverse().find(e)},an.prototype.invokeMap=Ai((function(e,t){return"function"==typeof e?new an(this):this.map((function(n){return Hc(n,e,t)}))})),an.prototype.reject=function(e){return this.filter(Sd(Pl(e)))},an.prototype.slice=function(e,t){e=_t(e);var n=this;return n.__filtered__&&(e>0||t<0)?new an(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=_t(t))<0?n.dropRight(-t):n.take(t-e)),n)},an.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},an.prototype.toArray=function(){return this.take(Mp)},Fl(an.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=vn[i?"take"+("last"==t?"Right":""):t],r=i||/^find/.test(t);o&&(vn.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,s=t instanceof an,l=a[0],u=s||ot(t),c=function(e){var t=o.apply(vn,Go([e],a));return i&&d?t[0]:t};u&&n&&"function"==typeof l&&1!=l.length&&(s=u=!1);var d=this.__chain__,h=!!this.__actions__.length,f=r&&!d,p=s&&!h;if(!r&&u){t=p?t:new an(this);var g=e.apply(t,a);return g.__actions__.push({func:Tf,args:[c],thisArg:void 0}),new hn(g,d)}return f&&p?e.apply(this,a):(g=this.thru(c),f?i?g.value()[0]:g.value():g)})})),Tn(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Tp[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);vn.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var o=this.value();return t.apply(ot(o)?o:[],e)}return this[n]((function(n){return t.apply(ot(n)?n:[],e)}))}})),Fl(an.prototype,(function(e,t){var n=vn[t];if(n){var i=n.name+"";Ap.call(un,i)||(un[i]=[]),un[i].push({name:t,func:n})}})),un[ti(void 0,2).name]=[{name:"wrapper",func:void 0}],an.prototype.clone=function(){var e=new an(this.__wrapped__);return e.__actions__=fn(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=fn(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=fn(this.__views__),e},an.prototype.reverse=function(){if(this.__filtered__){var e=new an(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},an.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=ot(e),i=t<0,o=n?e.length:0,r=function(e,t,n){for(var i=-1,o=n.length;++i<o;){var r=n[i],a=r.size;switch(r.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=Cp(t,e+a);break;case"takeRight":e=Ep(e,t-a)}}return{start:e,end:t}}(0,o,this.__views__),a=r.start,s=r.end,l=s-a,u=i?s:a-1,c=this.__iteratees__,d=c.length,h=0,f=Np(l,this.__takeCount__);if(!n||!i&&o==l&&f==l)return Rf(e,this.__actions__);var p=[];e:for(;l--&&h<f;){for(var g=-1,v=e[u+=t];++g<d;){var m=c[g],y=m.iteratee,b=m.type,x=y(v);if(2==b)v=x;else if(!x){if(1==b)continue e;break e}}p[h++]=v}return p},vn.prototype.at=bp.at,vn.prototype.chain=bp.wrapperChain,vn.prototype.commit=bp.commit,vn.prototype.next=bp.next,vn.prototype.plant=bp.plant,vn.prototype.reverse=bp.reverse,vn.prototype.toJSON=vn.prototype.valueOf=vn.prototype.value=bp.value,vn.prototype.first=vn.prototype.head,kp&&(vn.prototype[kp]=bp.toIterator),Sp={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(t){e=t}throw e}},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;var Pp=0;function Ip(e,t,n,i,o,r){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)"ref"==s?a=t[s]:l[s]=t[s];var u={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Pp,__i:-1,__u:0,__source:o,__self:r};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return Sp.vnode&&Sp.vnode(u),u}var Lp=t.LogicFlowUtil.StepDrag,Bp=function(e){function n(n){var i=e.call(this)||this;return i.updatePosition=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.x,a=o.y;i.nodeModel.x=r+t/2,i.nodeModel.y=a+n/2,i.nodeModel.moveText(t/2,n/2)},i.getResize=function(e){var t=e.index,n=e.deltaX,i=e.deltaY,o=e.width,r=e.height,a=e.PCTResizeInfo,s=e.pct,l=void 0===s?1:s,u=e.freezeWidth,c=void 0!==u&&u,d=e.freezeHeight,h=void 0!==d&&d,f={width:o,height:r,deltaX:n,deltaY:i};if(a){var p=0,g=0;switch(t){case 0:g=(-1*n-i)/4;break;case 1:g=(n-i)/4;break;case 2:g=(n+i)/4;break;case 3:g=(-1*n+i)/4}0!==g&&(p=Math.round(g/a.ResizeBasis.basisHeight*1e5)/1e3),a.ResizePCT.widthPCT=Math.max(Math.min(a.ResizePCT.widthPCT+p,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit),a.ResizePCT.heightPCT=Math.max(Math.min(a.ResizePCT.heightPCT+p,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit);var v=Math.round(a.ResizePCT.widthPCT*a.ResizeBasis.basisWidth/100),m=Math.round(a.ResizePCT.heightPCT*a.ResizeBasis.basisHeight/100);switch(t){case 0:n=o-v,i=r-m;break;case 1:n=v-o,i=r-m;break;case 2:n=v-o,i=m-r;break;case 3:n=o-v,i=m-r}return f.width=v,f.height=m,f.deltaX=n/l,f.deltaY=i/l,f}switch(t){case 0:f.width=c?o:o-n*l,f.height=h?r:r-i*l;break;case 1:f.width=c?o:o+n*l,f.height=h?r:r-i*l;break;case 2:f.width=c?o:o+n*l,f.height=h?r:r+i*l;break;case 3:f.width=c?o:o-n*l,f.height=h?r:r+i*l}return f},i.updateEdgePointByAnchors=function(){var e=i.nodeModel,t=e.id,n=e.anchors,o=i.getNodeEdges(t);o.sourceEdges.forEach((function(e){var t=n.find((function(t){return t.id===e.sourceAnchorId}));t&&e.updateStartPoint({x:t.x,y:t.y})})),o.targetEdges.forEach((function(e){var t=n.find((function(t){return t.id===e.targetAnchorId}));t&&e.updateEndPoint({x:t.x,y:t.y})}))},i.updateRect=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.x,a=o.y,s=o.width,l=o.height,u=o.radius,c=o.PCTResizeInfo,d=i.nodeModel,h=d.minWidth,f=d.minHeight,p=d.maxWidth,g=d.maxHeight,v=i.index,m=h===p,y=f===g,b=i.getResize({index:v,deltaX:t,deltaY:n,width:s,height:l,PCTResizeInfo:c,pct:1,freezeWidth:m,freezeHeight:y});if(b.width<h||b.width>p||b.height<f||b.height>g)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:m?0:b.deltaX,deltaY:y?0:b.deltaY}),i.nodeModel.width=b.width,i.nodeModel.height=b.height,i.nodeModel.setProperties({nodeSize:{width:b.width,height:b.height}});var x={x:r,y:a,width:s,height:l,radius:u},w={x:i.nodeModel.x,y:i.nodeModel.y,width:i.nodeModel.width,height:i.nodeModel.height,radius:u};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:x,afterNode:w})}},i.updateEllipse=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.rx,a=o.ry,s=o.x,l=o.y,u=o.PCTResizeInfo,c=i.index,d=i.nodeModel,h=d.minWidth,f=d.minHeight,p=d.maxWidth,g=d.maxHeight,m=h===p,y=f===g,b=r,x=a,w=i.getResize({index:c,deltaX:t,deltaY:n,width:b,height:x,PCTResizeInfo:u,pct:.5,freezeWidth:m,freezeHeight:y});if(w.width<h/2||w.width>p/2||w.height<f/2||w.height>g/2)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:m?0:w.deltaX,deltaY:y?0:w.deltaY}),i.nodeModel.rx=w.width,i.nodeModel.ry=w.height,i.nodeModel.setProperties({nodeSize:{rx:w.width,ry:w.height}});var E={x:s,y:l},C={rx:w.width,ry:w.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:v(v({},E),{rx:r,ry:a}),afterNode:C})}},i.updateDiamond=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.rx,a=o.ry,s=o.x,l=o.y,u=o.PCTResizeInfo,c=i.index,d=i.nodeModel,h=d.minWidth,f=d.minHeight,p=d.maxWidth,g=d.maxHeight,v=h===p,m=f===g,y=r,b=a,x=i.getResize({index:c,deltaX:t,deltaY:n,width:y,height:b,PCTResizeInfo:u,pct:.5,freezeWidth:v,freezeHeight:m});if(x.width<h/2||x.width>p/2||x.height<f/2||x.height>g/2)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:v?0:x.deltaX,deltaY:m?0:x.deltaY}),i.nodeModel.rx=x.width,i.nodeModel.ry=x.height,i.nodeModel.setProperties({nodeSize:{rx:x.width,ry:x.height}});var w={x:s,y:l,rx:r,ry:a},E={rx:x.width,ry:x.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:w,afterNode:E})}},i.eventEmit=function(e){var t=e.deltaX,n=e.deltaY,o=e.beforeNode,r=e.afterNode,a=i.nodeModel,s=a.id,l=a.modelType,u=a.type,c=v({id:s,modelType:l,type:u},o),d=v({id:s,modelType:l,type:u},r);i.graphModel.eventCenter.emit("node:resize",{preData:c,data:d,deltaX:t,deltaY:n,index:i.index,model:i.nodeModel})},i.onDragging=function(e){var n,o=e.deltaX,r=e.deltaY,a=i.graphModel.transformModel,s=i.nodeModel.modelType;o=(n=E(a.fixDeltaXY(o,r),2))[0],r=n[1],s===t.ModelType.RECT_NODE||s===t.ModelType.HTML_NODE?i.updateRect({deltaX:o,deltaY:r}):s===t.ModelType.ELLIPSE_NODE?i.updateEllipse({deltaX:o,deltaY:r}):s===t.ModelType.DIAMOND_NODE&&i.updateDiamond({deltaX:o,deltaY:r})},i.onDragEnd=function(){var e=i.graphModel.gridSize,t=void 0===e?1:e,n=t*Math.round(i.nodeModel.x/t),o=t*Math.round(i.nodeModel.y/t);i.nodeModel.moveTo(n,o),i.updateEdgePointByAnchors()},i.index=n.index,i.nodeModel=n.model,i.graphModel=n.graphModel,i.dragHandler=new Lp({onDragging:i.onDragging,onDragEnd:i.onDragEnd,step:1}),i}return g(n,e),n.prototype.getNodeEdges=function(e){for(var t=this.graphModel.edges,n=[],i=[],o=0;o<t.length;o++){var r=t[o];r.sourceNodeId===e?n.push(r):t[o].targetNodeId===e&&i.push(r)}return{sourceEdges:n,targetEdges:i}},n.prototype.render=function(){var e=this.props,n=e.x,i=e.y,o=e.index,r=e.model.getControlPointStyle();return Ip("g",{className:"lf-resize-control-".concat(o),children:Ip(t.Rect,v({className:"lf-node-control",x:n,y:i},r,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(t.Component),jp=function(e){function n(){var t=e.call(this)||this;return t.state={},t}return g(n,e),n.prototype.getResizeControl=function(){var e=this.props,t=e.model,n=e.graphModel,i=t.x,o=t.y,r=t.width,a=t.height,s={minX:i-r/2,minY:o-a/2,maxX:i+r/2,maxY:o+a/2},l=s.minX,u=s.minY,c=s.maxX,d=s.maxY;return[{x:l,y:u},{x:c,y:u},{x:c,y:d},{x:l,y:d}].map((function(e,i){return Ip(Bp,v({index:i},e,{model:t,graphModel:n}))}))},n.prototype.getGroupSolid=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getResizeOutlineStyle();return Ip(t.Rect,v({},a,{x:n,y:i,width:o,height:r}))},n.prototype.render=function(){return Ip("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(t.Component),Fp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return g(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.EllipseNodeModel),Hp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Ip(jp,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){var e=this.props,t=e.model,n=e.graphModel.editConfigModel.isSilentMode;return Ip("g",{children:[this.getResizeShape(),t.isSelected&&!n?this.getControlGroup():""]})},t}(t.EllipseNode),Wp={type:"ellipse",view:Hp,model:Fp},zp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return g(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.gridSize=1},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.DiamondNodeModel),Gp=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Ip(jp,{model:t,graphModel:n})},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.points,i=e.getNodeStyle();return Ip("g",{children:Ip(t.Polygon,v({},i,{points:n}))})},n.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Ip("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},n}(t.DiamondNode),Up={type:"diamond",view:Gp,model:zp},qp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return g(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.HtmlNodeModel),Xp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Ip(jp,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Ip("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},t}(t.HtmlNode),Vp={type:"html",view:Xp,model:qp},Kp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return g(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.RectNodeModel),Yp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Ip(jp,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Ip("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},t}(t.RectNode),$p={type:"rect",view:Yp,model:Kp},Zp={pluginName:"nodeResize",step:0,install:function(e){e.register(Wp),e.register(Up),e.register(Vp),e.register($p)}},Jp=function(e){function t(){var t=e.apply(this,C([],E(arguments),!1))||this;return t.isGroup=!0,t.isFolded=!1,t.unfoldedWidth=500,t.unfoldedHeight=300,t.childrenLastFoldStatus={},t}return g(t,e),t.prototype.initNodeData=function(t){var n=this;e.prototype.initNodeData.call(this,t);var i=[];ot(t.children)&&(i=t.children),this.children=new Set(i),this.width=500,this.height=300,this.foldedWidth=80,this.foldedHeight=60,this.zIndex=-1e4,this.radius=0,this.text.editable=!1,this.text.draggable=!1,this.isRestrict=!1,this.resizable=!1,this.autoToFront=!1,this.foldable=!1,void 0===this.properties.isFolded&&(this.properties.isFolded=!1),this.isFolded=!!this.properties.isFolded,setTimeout((function(){n.isFolded&&n.foldGroup(n.isFolded)}))},t.prototype.getResizeOutlineStyle=function(){var t=e.prototype.getResizeOutlineStyle.call(this);return t.stroke="none",t},t.prototype.foldGroup=function(e){var t=this;if(e!==this.isFolded){this.setProperty("isFolded",e),this.isFolded=e,e?(this.x=this.x-this.width/2+this.foldedWidth/2,this.y=this.y-this.height/2+this.foldedHeight/2,this.unfoldedWidth=this.width,this.unfoldedHeight=this.height,this.width=this.foldedWidth,this.height=this.foldedHeight):(this.width=this.unfoldedWidth,this.height=this.unfoldedHeight,this.x=this.x+this.width/2-this.foldedWidth/2,this.y=this.y+this.height/2-this.foldedHeight/2);var n=C(C([],E(this.incoming.edges),!1),E(this.outgoing.edges),!1);this.children.forEach((function(i){var o=t.graphModel.getElement(i);if(o){var r=o.isFolded;if(o.isGroup&&!o.isFolded&&o.foldGroup(e),o.isGroup&&!e){var a=t.childrenLastFoldStatus[i];void 0!==a&&a!==o.isFolded&&o.foldGroup(a)}t.childrenLastFoldStatus[i]=!!r,o.visible=!e;var s=o.incoming.edges,l=o.outgoing.edges;n=C(C(C([],E(n),!1),E(s),!1),E(l),!1)}})),this.foldEdge(e,n)}},t.prototype.getAnchorStyle=function(t){var n=e.prototype.getAnchorStyle.call(this,t);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},t.prototype.foldEdge=function(e,t){var n=this;t.forEach((function(t,i){var o=t.id,r=t.sourceNodeId,a=t.targetNodeId,s=t.startPoint,l=t.endPoint,u=t.type,c=t.text,d=t.getProperties(),h={id:"".concat(o,"__").concat(i),sourceNodeId:r,targetNodeId:a,startPoint:s,endPoint:l,type:u,properties:d,text:null==c?void 0:c.value};t.virtual&&n.graphModel.deleteEdgeById(t.id);var f=n.graphModel.group.getNodeGroup(a);f||(f=n.graphModel.getNodeModelById(a));var p=n.graphModel.group.getNodeGroup(r);p||(p=n.graphModel.getNodeModelById(r)),e&&!1!==t.visible&&(n.children.has(r)||n.id===r?(h.startPoint=void 0,h.sourceNodeId=n.id):(h.endPoint=void 0,h.targetNodeId=n.id),f.id===n.id&&p.id===n.id||n.createVirtualEdge(h),t.visible=!1),e||!1!==t.visible||(f&&f.isGroup&&f.isFolded?(h.targetNodeId=f.id,h.endPoint=void 0,n.createVirtualEdge(h)):p&&p.isGroup&&p.isFolded?(h.sourceNodeId=p.id,h.startPoint=void 0,n.createVirtualEdge(h)):t.visible=!0)}))},t.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isFoldedEdge=!0},t.prototype.isInRange=function(e){var t=e.minX,n=e.minY,i=e.maxX,o=e.maxY;return t>=this.x-this.width/2&&i<=this.x+this.width/2&&n>=this.y-this.height/2&&o<=this.y+this.height/2},t.prototype.isAllowMoveTo=function(e){var t=e.minX,n=e.minY,i=e.maxX,o=e.maxY;return{x:t>=this.x-this.width/2&&i<=this.x+this.width/2,y:n>=this.y-this.height/2&&o<=this.y+this.height/2}},t.prototype.setAllowAppendChild=function(e){this.setProperty("groupAddable",e)},t.prototype.addChild=function(e){this.children.add(e),this.graphModel.eventCenter.emit("group:add-node",{data:this.getData()})},t.prototype.removeChild=function(e){this.children.delete(e),this.graphModel.eventCenter.emit("group:remove-node",{data:this.getData()})},t.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},t.prototype.getData=function(){var t=this,n=e.prototype.getData.call(this);n.children=[],this.children.forEach((function(e){var i=t.graphModel.getNodeModelById(e);i&&!i.virtual&&n.children.push(e)}));var i=n.properties;return null==i||delete i.groupAddable,null==i||delete i.isFolded,n},t.prototype.getHistoryData=function(){var t=e.prototype.getData.call(this);t.children=C([],E(this.children),!1),t.isGroup=!0;var n=t.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(t.x=t.x+this.unfoldedWidth/2-this.foldedWidth/2,t.y=t.y+this.unfoldedHeight/2-this.foldedHeight/2),t},t.prototype.isAllowAppendIn=function(e){return!0},t.prototype.toBack=function(){this.zIndex--},t}(Kp),Qp=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getControlGroup=function(){var t=this.props.model,n=t.resizable,i=t.properties;return n&&!i.isFolded?e.prototype.getControlGroup.call(this):null},n.prototype.getAddableShape=function(){var e=this.props.model,n=e.width,i=e.height,o=e.x,r=e.y,a=e.radius,s=e.properties,l=e.getAddableOutlineStyle;if(!s.groupAddable)return null;var u=this.props.model.getNodeStyle().strokeWidth,c=void 0===u?0:u,d=l(),h=n+c+8,f=i+c+8;return t.h("rect",v(v({},d),{width:h,height:f,x:o-h/2,y:r-f/2,rx:a,ry:a}))},n.prototype.getFoldIcon=function(){var e=this.props.model,n=e.x-e.width/2+5,i=e.y-e.height/2+5;if(!e.foldable)return null;var o=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:e.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 t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:e.x-e.width/2+5,y:e.y-e.height/2+5,onClick:function(){e.foldGroup(!e.properties.isFolded)}}),o])},n.prototype.getResizeShape=function(){return t.h("g",{},[this.getAddableShape(),e.prototype.getResizeShape.call(this),this.getFoldIcon()])},n}(Yp),eg={type:"group",view:Qp,model:Jp},tg=-1e4,ng=function(){function e(e){var t=e.lf,n=this;this.topGroupZIndex=tg,this.nodeGroupMap=new Map,this.graphRendered=function(e){var t=e.data;t&&t.nodes&&(t.nodes.forEach((function(e){e.children&&e.children.forEach((function(t){n.nodeGroupMap.set(t,e.id)}))})),n.checkAndCorrectTopGroupZIndex(t.nodes))},this.appendNodeToGroup=function(e){var t=e.data,i=n.nodeGroupMap.get(t.id);if(i){var o=n.lf.getNodeModelById(i);o.removeChild(t.id),n.nodeGroupMap.delete(t.id),o.setAllowAppendChild(!1)}var r=n.lf.getNodeModelById(t.id),a=null==r?void 0:r.getBounds();if(a&&r){var s=n.getGroup(a,t);if(r.isGroup&&(t.children.forEach((function(e){n.nodeGroupMap.set(e,t.id)})),n.checkAndCorrectTopGroupZIndex([t]),n.nodeSelected({data:t,isSelected:!1,isMultiple:!1})),!s)return;if(!s.isAllowAppendIn(t))return void n.lf.emit("group:not-allowed",{group:s.getData(),node:t});s.addChild(t.id),n.nodeGroupMap.set(t.id,s.id),s.setAllowAppendChild(!1)}},this.deleteGroupChild=function(e){var t=e.data;t.children&&t.children.forEach((function(e){n.nodeGroupMap.delete(e),n.lf.deleteNode(e)}));var i=n.nodeGroupMap.get(t.id);i&&(n.lf.getNodeModelById(i).removeChild(t.id),n.nodeGroupMap.delete(t.id))},this.setActiveGroup=function(e){var t=e.data,i=n.lf.getNodeModelById(t.id),o=null==i?void 0:i.getBounds();if(i&&o){var r=n.getGroup(o,t);if(n.activeGroup&&n.activeGroup.setAllowAppendChild(!1),!r||i.isGroup&&r.id===t.id)return;if(!r.isAllowAppendIn(t))return;n.activeGroup=r,n.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(e){var t=tg;return e.isGroup&&(t=Math.max(t,e.zIndex)),e.children&&e.children.forEach((function(e){"object"==typeof e&&(e=e.id);var i=n.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var o=n.findNodeAndChildMaxZIndex(i);t=Math.max(o,t)}})),t},this.checkAndCorrectTopGroupZIndex=function(e){var t=tg;if(e.forEach((function(e){var i=n.lf.getNodeModelById(e.id);if(i){var o=n.findNodeAndChildMaxZIndex(i);o>t&&(t=o)}})),!(n.topGroupZIndex>=t)){for(var i=n.lf.graphModel.nodes.filter((function(e){return e.isGroup})),o=n.topGroupZIndex,r=0;r<i.length;r++){var a=i[r];a.zIndex>o&&(o=a.zIndex)}n.topGroupZIndex=o}},this.nodeSelected=function(e){var t=e.data,i=e.isMultiple,o=e.isSelected,r=n.lf.getNodeModelById(t.id);if(n.toFrontGroup(r),n.topGroupZIndex>-1e3){n.topGroupZIndex=tg;for(var a=n.lf.graphModel.nodes.filter((function(e){return e.isGroup})).sort((function(e,t){return e.zIndex-t.zIndex})),s=0,l=0;l<a.length;l++){var u=a[l];u.zIndex!==s&&(n.topGroupZIndex++,s=u.zIndex),u.setZIndex(n.topGroupZIndex)}}if(i&&o)if(null==r?void 0:r.isGroup)r.children.forEach((function(e){var t=n.lf.graphModel.getElement(e);null==t||t.setSelected(!1)}));else{var c=n.nodeGroupMap.get(t.id);if(c){var d=n.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==r||r.setSelected(!1))}}},this.toFrontGroup=function(e){e&&e.isGroup&&(n.topGroupZIndex++,e.setZIndex(n.topGroupZIndex),e.children&&e.children.forEach((function(e){var t=n.lf.getNodeModelById(e);n.toFrontGroup(t)})))},t.register(eg),this.lf=t,t.graphModel.addNodeMoveRules((function(e,i,o){if(e.isGroup){var r=n.getNodeAllChild(e);return t.graphModel.moveNodes(r,i,o,!0),!0}var a=t.getNodeModelById(n.nodeGroupMap.get(e.id));if(a&&a.isRestrict){var s=e.getBounds(),l=s.minX,u=s.minY,c=s.maxX,d=s.maxY;return a.isAllowMoveTo({minX:l+i,minY:u+o,maxX:c+i,maxY:d+o})}return!0})),t.graphModel.group=this,t.on("node:add,node:drop,node:dnd-add",this.appendNodeToGroup),t.on("node:delete",this.deleteGroupChild),t.on("node:dnd-drag,node:drag",this.setActiveGroup),t.on("node:click",this.nodeSelected),t.on("graph:rendered",this.graphRendered),t.addElements=function(e,i){var o=e.nodes,r=e.edges,a={},s={nodes:[],edges:[]},l=[];return Cu(o,(function(e){var o=e.id,r=e.children,u=m(e,["children"]),c=t.addNode(u);if(!c)return{nodes:[],edges:[]};o&&(a[o]=c.id),s.nodes.push(c);var d=n.createAllChildNodes(a,r,c,i).edgesArray;l.push.apply(l,C([],E(d),!1))})),l.forEach((function(e){n.createEdgeModel(e,a,i)})),Cu(r,(function(e){var t=n.createEdgeModel(e,a,0);s.edges.push(t)})),s}}return e.prototype.createAllChildNodes=function(e,n,i,o){var r=this,a=this.lf,s=[],l=[],u=[];null==n||n.forEach((function(n){var c=a.getNodeModelById(n);if(c){var d=c.x,h=c.y,f=c.properties,p=c.type,g=c.rotate,v=c.children,m={x:d+o,y:h+o,properties:f,type:p,rotate:g},y=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",b=a.addNode(m,y);if(i.addChild(b.id),e[n]=b.id,u.push(b),c.incoming.edges.forEach((function(e){l.push(e)})),c.outgoing.edges.forEach((function(e){l.push(e)})),v instanceof Set){var x=r.createAllChildNodes(e,v,b,o),w=x.nodesArray,N=x.edgesArray;u.push.apply(u,C([],E(w),!1)),s.push.apply(s,C([],E(N),!1))}}}));var c=l.filter((function(t){return e[t.sourceNodeId]&&e[t.targetNodeId]})).map((function(e){return e.getData()}));return{nodesArray:u,edgesArray:s.concat(c)}},e.prototype.createEdgeModel=function(e,t,n){var i=this.lf,o=e.sourceNodeId,r=e.targetNodeId;t[o]&&(o=t[o]),t[r]&&(r=t[r]);var a=e.type,s=e.startPoint,l=e.endPoint,u=e.pointsList,c=e.text,d={x:((null==s?void 0:s.x)||0)+n,y:((null==s?void 0:s.y)||0)+n},h={x:((null==l?void 0:l.x)||0)+n,y:((null==l?void 0:l.y)||0)+n},f=[];u&&u.length>0&&(f=u.map((function(e){return e.x+=n,e.y+=n,e})));var p={type:a,startPoint:d,endPoint:h,sourceNodeId:o,targetNodeId:r,pointsList:f};return gt(c)&&!Kc(c)&&(p.text=v(v({},c),{x:(null==c?void 0:c.x)+n,y:(null==c?void 0:c.y)+n})),i.graphModel.addEdge(p)},e.prototype.getNodeAllChild=function(e){var t=this,n=[];return e.children&&e.children.forEach((function(e){n.push(e);var i=t.lf.getNodeModelById(e);(null==i?void 0:i.isGroup)&&(n=n.concat(t.getNodeAllChild(i)))})),n},e.prototype.getGroup=function(e,t){var n=this.lf.graphModel.nodes.filter((function(n){return n.isGroup&&n.isInRange(e)&&n.id!==t.id}));if(0!==n.length){if(1===n.length)return n[0];for(var i=n[n.length-1],o=n.length-2;o>=0;o--)n[o].zIndex>i.zIndex&&(i=n[o]);return i}},e.prototype.getNodeGroup=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="group",e}();function ig(){var e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getFoldIcon=function(){var e=this.props.model,n=e,i=n.x,o=n.y,r=n.width,a=n.height,s=n.properties,l=n.foldable,u=e.x-e.width/2+5,c=e.y-e.height/2+5;if(!l)return null;var d=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:s.isFolded?"M ".concat(u+3,",").concat(c+6," ").concat(u+11,",").concat(c+6," M").concat(u+7,",").concat(c+2," ").concat(u+7,",").concat(c+10):"M ".concat(u+3,",").concat(c+6," ").concat(u+11,",").concat(c+6," ")});return t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:i-r/2+5,y:o-a/2+5,onClick:function(t){var n,i;t.stopPropagation(),null===(i=(n=e).foldGroup)||void 0===i||i.call(n,!s.isFolded)}}),d])},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getNodeStyle(),s=v(v({},a),{x:n-o/2,y:i-r/2,width:o,height:r,stroke:"black",strokeWidth:2,strokeDasharray:"0 0"});return t.h("g",{},[t.h("rect",v({},s)),this.getFoldIcon()])},n}(Qp),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.foldable=!0,this.resizable=!0,this.width=400,this.height=200,this.resetWidthHeight(),this.isTaskNode=!0,this.boundaryEvents=[]},t.prototype.resetWidthHeight=function(){var e,t,n=null===(e=this.properties.iniProp)||void 0===e?void 0:e.width,i=null===(t=this.properties.iniProp)||void 0===t?void 0:t.height;n&&(this.width=n),i&&(this.height=i)},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.stroke="#989891",t.strokeWidth=1,t.strokeDasharray="3 3",this.isSelected&&(t.stroke="rgb(124, 15, 255)"),this.properties.isBoundaryEventTouchingTask&&(t.stroke="#00acff",t.strokeWidth=2),t},t.prototype.addChild=function(t){var n=this.graphModel.getElement(t);null==n||n.setProperties({parent:this.id}),e.prototype.addChild.call(this,t)},t.prototype.getAnchorStyle=function(){var t=e.prototype.getAnchorStyle.call(this);return t.stroke="#000",t.fill="#fff",t.hover||(t.hover={}),t.hover.stroke="transparent",t},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return t.stroke="transparent",t.hover||(t.hover={}),t.hover.stroke="transparent",t},t.prototype.setTouching=function(e){this.setProperty("isBoundaryEventTouchingTask",e)},t.prototype.addBoundaryEvent=function(e){if(this.setTouching(!1),this.boundaryEvents.find((function(t){return t===e})))return!1;var t=this.graphModel.getNodeModelById(e);return null==t||t.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(e),!0},t.prototype.deleteBoundaryEvent=function(e){this.boundaryEvents=this.boundaryEvents.filter((function(t){return t!==e}))},t}(Jp);return{type:"bpmn:subProcess",view:e,model:n}}function og(e){var t=je("bpmn:serviceTask",ke),n=je("bpmn:userTask",Re);e.register(t),e.register(n),e.register(ig()),function(e){function t(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=e.id,s=n-o/2,l=n+o/2,u=i-r/2,c=i+r/2,d=t.x,h=t.y;return d>s-5&&d<l+5&&h>u-5&&h<c+5&&!(d>s+5&&d<l-5&&h>u+5&&h<c-5)?a:null}e.on("node:drag,node:dnd-drag",(function(n){var i,o,r=n.data;if("bpmn:boundaryEvent"===r.type){var a=e.graphModel.nodes;try{for(var s=w(a),l=s.next();!l.done;l=s.next()){var u=l.value;u.isTaskNode&&(t(u,r)?u.setTouching(!0):u.setTouching(!1))}}catch(e){i={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})),e.on("node:drop,node:dnd-add",(function(n){var i,o,r=n.data,a=r.type,s=r.id;if("bpmn:boundaryEvent"===a){var l=e.graphModel.nodes;try{for(var u=w(l),c=u.next();!c.done;c=u.next()){var d,h=c.value;if(h.isTaskNode)if(null!==(d=t(h,r))){var f=e.graphModel.getNodeModelById(s),p=e.graphModel.getNodeModelById(d),g=f.properties.attachedToRef;return g&&g!==d&&e.graphModel.getNodeModelById(g).deleteBoundaryEvent(s),void p.addBoundaryEvent(s)}}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}}})),e.graphModel.addNodeMoveRules((function(t,n,i){if(t.isTaskNode){var o=t.boundaryEvents;return e.graphModel.moveNodes(o,n,i,!0),!0}return!0}))}(e)}function rg(e){var n=function(t){function n(n,i){n.id||(n.id="Flow_".concat(ye()));var o=v(v(v({},e||{}),n.properties),{isDefaultFlow:!1});return n.properties=o,t.call(this,n,i)||this}return g(n,t),n.extendKey="SequenceFlowModel",n}(t.PolylineEdgeModel),i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getStartArrow=function(){return this.props.model.properties.isDefaultFlow?t.h("path",{refX:15,stroke:"#000000",strokeWidth:2,d:"M 20 5 10 -5 z"}):t.h("path",{d:""})},n.extendKey="SequenceFlowEdge",n}(t.PolylineEdge);return{type:"bpmn:sequenceFlow",view:i,model:n}}var ag=rg();var sg=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:_e,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function lg(e){function t(t){t.forEach((function(t){var n,i;n=t.nodes,i=t.definition,n.forEach((function(t){(null==e?void 0:e[t])||(e[t]=new Map);var n=null==e?void 0:e[t];i.forEach((function(e){n.set(e.type,e)}))}))}))}return function(){return[e,t]}}var ug=function(){function e(e){var t=e.lf;t.definition={},t.useDefinition=lg(t.definition);var n=E(t.useDefinition(),2);n[0];(0,n[1])(sg),function(e){e.register(Ee(e)),e.register(xe(e)),e.register(we(e)),e.register(Ne(e)),e.register(Ce(e))}(t),function(e){var t=Le("bpmn:exclusiveGateway",Me),n=Le("bpmn:parallelGateway",Te),i=Le("bpmn:inclusiveGateway",Ae);e.register(t),e.register(i),e.register(n)}(t),function(e){e.register(ag)}(t),og(t),t.setDefaultEdgeType("bpmn:sequenceFlow")}return e.pluginName="BpmnElementsPlugin",e}(),cg=40,dg=40,hg=40,fg=40,pg=100,gg=80,vg=100,mg=80,yg=100,bg=80,xg=100,wg=80,Eg=100,Cg=80,Ng=100,_g=80,Sg=100,Mg=80,Tg=100,Ag=80,kg=function(){};(kg.ObjTree=function(){return this}).VERSION="0.23",kg.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',kg.ObjTree.prototype.attr_prefix="-",kg.ObjTree.prototype.parseXML=function(e){var t;if(window.DOMParser){var n=new DOMParser,i=n.parseFromString(e,"application/xml");if(!i)return;t=i.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(e),t=n.documentElement);if(t)return this.parseDOM(t)},kg.ObjTree.prototype.parseHTTP=function(e,t,n){var i,o={};for(var r in t)o[r]=t[r];if(o.method||(void 0===o.postBody&&void 0===o.postbody&&void 0===o.parameters?o.method="get":o.method="post"),n){o.asynchronous=!0;var a=this,s=n,l=o.onComplete;o.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else o.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)o.uri=e,(u=new HTTP.Request(o))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,o))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},kg.ObjTree.prototype.parseDOM=function(e){if(e){if(this.__force_array={},this.force_array)for(var t=0;t<this.force_array.length;t++)this.__force_array[this.force_array[t]]=1;var n=this.parseElement(e);if(this.__force_array[e.nodeName]&&(n=[n]),11!==e.nodeType){var i={};i[e.nodeName]=n,n=i}return n}},kg.ObjTree.prototype.parseElement=function(e){if(7!==e.nodeType){if(3===e.nodeType||4===e.nodeType||8===e.nodeType){if(null==e.nodeValue.match(/[^\x00-\x20]/))return;return e.nodeValue}var t=null,n={};if(e.attributes&&e.attributes.length){t={};for(var i=0;i<e.attributes.length;i++){if("string"==typeof(s=e.attributes[i].nodeName)){var o=e.attributes[i].nodeValue;try{o=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){o=e.attributes[i].nodeValue}null!=o&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}if(e.childNodes&&e.childNodes.length){var r=!0;t&&(r=!1);for(i=0;i<e.childNodes.length&&r;i++){var a=e.childNodes[i].nodeType;3!==a&&4!==a&&8!==a&&(r=!1)}if(r){t||(t="");for(i=0;i<e.childNodes.length;i++)t+=e.childNodes[i].nodeValue}else{t||(t={});for(i=0;i<e.childNodes.length;i++){var s;if("string"==typeof(s=e.childNodes[i].nodeName))(o=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}else null===t&&(t={});return t}},kg.ObjTree.prototype.addNode=function(e,t,n,i){this.__force_array[t]?(1===n&&(e[t]=[]),e[t][e[t].length]=i):1===n?e[t]=i:2===n?e[t]=[e[t],i]:e[t][e[t].length]=i},kg.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},kg.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var o in t)if(mc(t,o)){var r=t[o];o.charAt(0)!==this.attr_prefix?void 0===r||null==r?n[n.length]="<".concat(o," />"):"object"==typeof r&&r.constructor===Array?n[n.length]=this.array_to_xml(o,r):n[n.length]="object"==typeof r?this.hash_to_xml(o,r):this.scalar_to_xml(o,r):i[i.length]=" ".concat(o.substring(1),'="').concat(this.xml_escape(r),'"')}var a=i.join(""),s=n.join("");return void 0===e||null==e||(s=n.length>0?s.match(/\n/)?"<".concat(e).concat(a,">\n").concat(s,"</").concat(e,">\n"):"<".concat(e).concat(a,">").concat(s,"</").concat(e,">\n"):"<".concat(e).concat(a," />\n")),s},kg.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var o=t[i];void 0===o||null==o?n[n.length]="<".concat(e," />"):"object"==typeof o&&o.constructor===Array?n[n.length]=this.array_to_xml(e,o):n[n.length]="object"==typeof o?this.hash_to_xml(e,o):this.scalar_to_xml(e,o)}return n.join("")},kg.ObjTree.prototype.scalar_to_xml=function(e,t){return"#text"===e?this.xml_escape(t):"<".concat(e,">").concat(this.xml_escape(t),"</").concat(e,">\n")},kg.ObjTree.prototype.xml_escape=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};function Rg(e){return Object.prototype.toString.call(e)}function Dg(e){return" ".repeat(e)}function Og(e){return"[object Object]"===Rg(e)?Object.keys(e).reduce((function(t,n){var i=n;return"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=Og(e[n]),t}),{}):Array.isArray(e)?e.map((function(e){return Og(e)})):e}var Pg,Ig="\t\n";function Lg(e,t,n){var i=Dg(n),o="",r=Ig+i;if("-json"===t)return"";if("#text"===t)return r+e;if("#cdata-section"===t)return"".concat(r,"<![CDATA[").concat(e,"]]>");if("#comment"===t)return"".concat(r,"\x3c!--").concat(e,"--\x3e");if("-"==="".concat(t).charAt(0))return" ".concat(t.substring(1),'="').concat(function(e){var t=e;try{"string"!=typeof t&&(t=JSON.parse(e))}catch(n){t=JSON.stringify(Og(e)).replace(/"/g,"'")}return t}(e),'"');if(Array.isArray(e))o+=e.map((function(e){return Lg(e,t,n+1)})).join("");else if("[object Object]"===Rg(e)){var a=Object.keys(e),s="",l=e["-json"]?Ig+Dg(n+1)+e["-json"]:"";o+="".concat(0===n?"":r,"<").concat(t),a.forEach((function(t){"-"===t.charAt(0)?s+=Lg(e[t],t,n+1):l+=Lg(e[t],t,n+1)})),o+=s+(""!==l?">".concat(l).concat(r,"</").concat(t,">"):" />")}else o+="".concat(r,"<").concat(t,">").concat(e.toString(),"</").concat(t,">");return o}!function(e){e.START="bpmn:startEvent",e.END="bpmn:endEvent",e.INTERMEDIATE_CATCH="bpmn:intermediateCatchEvent",e.INTERMEDIATE_THROW="bpmn:intermediateThrowEvent",e.BOUNDARY="bpmn:boundaryEvent",e.PARALLEL_GATEWAY="bpmn:parallelGateway",e.INCLUSIVE_GATEWAY="bpmn:inclusiveGateway",e.EXCLUSIVE_GATEWAY="bpmn:exclusiveGateway",e.USER="bpmn:userTask",e.SYSTEM="bpmn:serviceTask",e.FLOW="bpmn:sequenceFlow",e.SUBPROCESS="bpmn:subProcess"}(Pg||(Pg={}));var Bg=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],jg=["properties","startPoint","endPoint","pointsList"],Fg={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Hg=function(e,t){return Object.keys(t||{}).forEach((function(n){if(e[n]){var i=t[n],o=i.in,r=i.out;o&&(e[n].in=o),r&&(e[n].out=r)}else e[n]=t[n]})),e},Wg={"bpmn:startEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Wg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:intermediateCatchEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Wg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:intermediateThrowEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Wg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:boundaryEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Wg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:sequenceFlow":{out:function(e){var t=e.properties,n=t.expressionType,i=t.condition;return i?"cdata"===n?{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[${'.concat(i,"}]]></bpmn:conditionExpression>")}:{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">'.concat(i,"</bpmn:conditionExpression>")}:{json:""}}},"bpmn:timerEventDefinition":{out:function(e){var t=e.properties,n=t.timerType,i=t.timerValue,o=t.definitionId;return{json:'<bpmn:timerEventDefinition id="'.concat(o,'"').concat(n&&i?">".concat("<bpmn:".concat(n,' xsi:type="bpmn:tFormalExpression">').concat(i,"</bpmn:").concat(n,">"),"</bpmn:timerEventDefinition>"):"/>")}},in:function(e,t){var n,i,o,r=e,a=t["-id"],s="",l="";try{for(var u=w(Object.keys(t)),c=u.next();!c.done;c=u.next()){var d=c.value;d.includes("bpmn:")&&(s=E(d.split(":"),2)[1],l=null===(o=t[d])||void 0===o?void 0:o["#text"])}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return{"-definitionId":a,"-definitionType":r,"-timerType":s,"-timerValue":l}}},"bpmn:conditionExpression":{in:function(e,t){var n,i="",o="";return t["#cdata-section"]?(o="cdata",i=(null===(n=/^\$\{(.*)\}$/g.exec(t["#cdata-section"]))||void 0===n?void 0:n[1])||""):t["#text"]&&(o="normal",i=t["#text"]),{"-condition":i,"-expressionType":o}}}};function zg(e){var t=null!=e?e:{},n=t.retainedAttrsFields,i=t.excludeFields,o=t.transformer,r=new Set(C(C([],E(jg),!1),E(n||[]),!1)),a={in:new Set(C(C([],E(Fg.in),!1),E((null==i?void 0:i.in)||[]),!1)),out:new Set(C(C([],E(Fg.out),!1),E((null==i?void 0:i.out)||[]),!1))};return Wg=Hg(Wg,o),function(e){var t=e.nodes,n=e.edges;return function e(i,o){var s,l;if(1!==(null==i?void 0:i.flag)){var u;if((u=Wg[i.type])&&u.out){var c=u.out(i),d=Object.keys(c);d.length>0&&d.forEach((function(e){i[e]=c[e]}))}(null==i?void 0:i.children)&&(i.children=i.children.map((function(e){return t.find((function(t){return t.id===e}))||n.find((function(t){return t.id===e}))||{}})));var h={};if("string"==typeof i)return i;if(Array.isArray(i))return i.map((function(t){return e(t,"")})).filter((function(e){return null!=e}));try{for(var f=w(Object.entries(i)),p=f.next();!p.done;p=f.next()){var g=E(p.value,2),v=g[0],m=g[1];if(1===(null==m?void 0:m.flag))return;var y=[o,v].filter((function(e){return e})).join(".");a.out.has(y)||("object"!=typeof m?0===v.indexOf("-")||["#text","#cdata-section","#comment"].includes(v)?h[v]=m:h["-".concat(v)]=m:r.has(y)?h["-".concat(v)]=e(m,y):h[v]=e(m,y))}}catch(e){s={error:e}}finally{try{p&&!p.done&&(l=f.return)&&l.call(f)}finally{if(s)throw s.error}}return h}}(e,"")}}function Gg(e){var t,n,i={};try{for(var o=w(Object.entries(e)),r=o.next();!r.done;r=o.next()){var a=E(r.value,2),s=a[0],l=a[1];0===s.indexOf("-")?i[s.substring(1)]=Og(l):"string"==typeof l?i[s]=l:"[object Object]"===Object.prototype.toString.call(l)?i[s]=Gg(l):Array.isArray(l)?i[s]=l.map((function(e){return Gg(e)})):i[s]=l}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i}function Ug(e,t){e["bpmndi:BPMNEdge"]=t.edges.map((function(e){var t,n=e.id,i=e.pointsList.map((function(e){return{"-x":e.x,"-y":e.y}})),o={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(o["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),o})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,o=80,r=e.x,a=e.y,s=Yg.shapeConfigMap.get(e.type);s&&(i=s.width,o=s.height),r-=i/2,a-=o/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":r,"-y":a,"-width":i,"-height":o}};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(l["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),l}))}var qg=["bpmn:incoming","bpmn:outgoing"];function Xg(e,t){var n=[],i=[],o=new Map,r=null!=t?t:{},a=r.transformer,s=r.excludeFields,l={in:new Set(C(C([],E(Fg.in),!1),E((null==s?void 0:s.in)||[]),!1)),out:new Set(C(C([],E(Fg.out),!1),E((null==s?void 0:s.out)||[]),!1))};Wg=Hg(Wg,a);var u,c,d=e["bpmn:definitions"];if(d){var h=d["bpmn:process"];u=h,c=[function(e){function t(e){e["-children"]||(e["-children"]=[]),Object.keys(e).forEach((function(t){var n;0!==t.indexOf("bpmn:")||qg.includes(t)||(h[t]||(h[t]=[]),!Array.isArray(h[t])&&(h[t]=[h[t]]),Array.isArray(e[t])?(n=h[t]).push.apply(n,C([],E(e[t]),!1)):h[t].push(e[t]),Array.isArray(e[t])?e[t].forEach((function(n){!t.includes("Flow")&&e["-children"].push(n["-id"])})):!t.includes("Flow")&&e["-children"].push(e[t]["-id"]),delete e[t])}))}if("bpmn:subProcess"===e){var n=h[e];Array.isArray(n)?n.forEach((function(n){"bpmn:subProcess"===e&&t(n)})):t(n)}},function(e){function t(e){var n;o.set(e["-id"],e),Array.isArray(e)?e.forEach((function(e){t(e)})):"object"==typeof e&&(n=e,Object.keys(n).forEach((function(e){var i,o;if(e.includes("bpmn:")){var r={};Wg[e]&&Wg[e].in?(r=null===(o=(i=Wg[e]).in)||void 0===o?void 0:o.call(i,e,vn.cloneDeep(n[e])),delete n[e]):t(n[e]);var a=void 0;(a=Reflect.ownKeys(r)).length>0&&a.forEach((function(e){Reflect.set(n,e,r[e])}))}})))}t(h[e])},function(e){if(0===e.indexOf("bpmn:")){var t=h[e];if("bpmn:sequenceFlow"===e){var r=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNEdge"];i=function(e,t){var n=[];if(Array.isArray(e))e.forEach((function(e){var i;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(Kg(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(Kg(i,e))}return n}(t,r)}else{var a=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if("bpmn:boundaryEvent"===e){var s=h[e],l=function(e){var t=e["-attachedToRef"],n=o.get(t);n["-boundaryEvents"]||(n["-boundaryEvents"]=[]),n["-boundaryEvents"].push(e["-id"])};Array.isArray(s)?s.forEach((function(e){l(e)})):l(s)}n=n.concat(function(e,t,n){var i=[];if(Array.isArray(e))e.forEach((function(e){var o=Vg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}));else{var o=Vg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}return i}(t,a,e))}}}],c.forEach((function(e){try{Object.keys(u).forEach((function(t){try{e(t)}catch(e){}}))}catch(e){}}))}var f=function(e,t,n){Object.keys(e).forEach((function(i){var o=n?"".concat(n,".").concat(i):i;t.has(o)?delete e[i]:"object"==typeof e[i]&&f(e[i],t,o)}))};return n.forEach((function(e){var n,i;if(null===(n=null==t?void 0:t.mapping)||void 0===n?void 0:n.in){var o=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,r=e.type;o[r]&&(e.type=o[r])}f(e,l.in,"")})),i.forEach((function(e){var n,i;if(null===(n=null==t?void 0:t.mapping)||void 0===n?void 0:n.in){var o=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,r=e.type;o[r]&&(e.type=o[r])}f(e,l.in,"")})),{nodes:n,edges:i}}function Vg(e,t,n){var i=Number(e["dc:Bounds"]["-x"]),o=Number(e["dc:Bounds"]["-y"]),r=n["-children"],a=n["-name"],s=Yg.shapeConfigMap.get(t);s&&(i+=s.width/2,o+=s.height/2);var l,u={};if(Object.entries(n).forEach((function(e){var t=E(e,2),n=t[0],i=t[1];Bg.includes(n)||(u[n]=i)})),u=Gg(u),a&&(l={x:i,y:o,value:a},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var c=e["bpmndi:BPMNLabel"]["dc:Bounds"];l.x=Number(c["-x"])+Number(c["-width"])/2,l.y=Number(c["-y"])+Number(c["-height"])/2}var d={id:e["-bpmnElement"],type:t,x:i,y:o,properties:u};return r&&(d.children=r),l&&(d.text=l),d}function Kg(e,t){var n,i=t["-name"]?"".concat(t["-name"]):"";if(i){var o=e["bpmndi:BPMNLabel"]["dc:Bounds"],r=0;i.split("\n").forEach((function(e){r<e.length&&(r=e.length)})),n={value:i,x:Number(o["-x"])+10*r/2,y:Number(o["-y"])+7}}var a={};Object.entries(t).forEach((function(e){var t=E(e,2),n=t[0],i=t[1];Bg.includes(n)||(a[n]=i)})),a=Gg(a);var s=e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),l={id:t["-id"],type:Pg.FLOW,pointsList:s,sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:a};return n&&(l.text=n),l}var Yg=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i,o,r=v({},n.processAttributes);!function(e,t,n){var i,o=new Map,r=zg(n)(t);r.nodes.forEach((function(t){var n=t["-id"],i=t["-type"],r=t.text,a=t.children,s=m(t,["-id","-type","text","children"]),l={"-id":n};(null==r?void 0:r["-value"])&&(l["-name"]=r["-value"]),s["-json"]&&(l["-json"]=s["-json"]),s["-properties"]&&Object.assign(l,s["-properties"]),a&&(l.children=a),e[i]||(e[i]=[]),e[i].push(l),o.set(n,l)}));var a=r.edges.map((function(e){var t=e["-id"],n=e["-sourceNodeId"],i=e["-targetNodeId"],r=e.text,a=m(e,["-id","-sourceNodeId","-targetNodeId","text"]),s=o.get(i);s["bpmn:incoming"]||(s["bpmn:incoming"]=[]),s["bpmn:incoming"].push(t);var l={"-id":t,"-sourceRef":n,"-targetRef":i};return(null==r?void 0:r["-value"])&&(l["-name"]=r["-value"]),a["-json"]&&(l["-json"]=a["-json"]),a["-properties"]&&Object.assign(l,a["-properties"]),l}));t.edges.forEach((function(e){var t=e.sourceNodeId,n=e.id,i=o.get(t);i["bpmn:outgoing"]||(i["bpmn:outgoing"]=[]),i["bpmn:outgoing"].push(n)})),null===(i=e["bpmn:subProcess"])||void 0===i||i.forEach((function(t){var n={"bpmn:incoming":new Set,"bpmn:outgoing":new Set},i=[];t.children.forEach((function(i){var r,a=o.get(i["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach((function(e){a[e]&&a[e].forEach((function(t){n[e].add(t)}))}));var s=null===(r=e[i["-type"]])||void 0===r?void 0:r.findIndex((function(e){return e["-id"]===i["-id"]}));s>=0&&e[i["-type"]].splice(s,1),o.delete(i["-id"]),t[i["-type"]]||(t[i["-type"]]=[]),t[i["-type"]].push(a)}));var r=n["bpmn:incoming"];n["bpmn:outgoing"].forEach((function(e){r.has(e)&&i.push(e)}));for(var s,l=function(e){var n=a.findIndex((function(t){return t["-id"]===i[e]}));n>=0?(t["bpmn:sequenceFlow"]||(t["bpmn:sequenceFlow"]=[]),t["bpmn:sequenceFlow"].push(a[n]),a.splice(n,1)):e++,s=e},u=0;u<i.length;)l(u),u=s;delete t.children})),e[Pg.FLOW]=a}(r,e,t);var a={"-id":"BPMNPlane_1","-bpmnElement":r["-id"]};Ug(a,e);var s=n.definitionAttributes;s["bpmn:process"]=r,s["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":a};var l={"bpmn:definitions":s};if(null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.out){var u=null===(o=null==t?void 0:t.mapping)||void 0===o?void 0:o.out,c=function(e){Array.isArray(e)&&e.forEach((function(e){return c(e)})),"object"==typeof e&&Object.keys(e).forEach((function(t){var n;(n=u[t])?(e[n]=vn.cloneDeep(e[t]),delete e[t],c(e[n])):c(e[t])}))};c(l)}return l},this.adapterIn=function(e,t){if(e)return Xg(e,t)},t.adapterIn=this.adapterIn,t.adapterOut=this.adapterOut,this.processAttributes={"-isExecutable":"true","-id":"Process"},this.definitionAttributes={"-id":"Definitions","-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.10"}}return e.prototype.setCustomShape=function(t,n){e.shapeConfigMap.set(t,n)},e.pluginName="bpmn-adapter",e.shapeConfigMap=new Map,e}();Yg.shapeConfigMap.set(Pg.START,{width:cg,height:dg}),Yg.shapeConfigMap.set(Pg.END,{width:hg,height:fg}),Yg.shapeConfigMap.set(Pg.INTERMEDIATE_CATCH,{width:vg,height:mg}),Yg.shapeConfigMap.set(Pg.INTERMEDIATE_THROW,{width:vg,height:mg}),Yg.shapeConfigMap.set(Pg.BOUNDARY,{width:pg,height:gg}),Yg.shapeConfigMap.set(Pg.PARALLEL_GATEWAY,{width:yg,height:bg}),Yg.shapeConfigMap.set(Pg.INCLUSIVE_GATEWAY,{width:xg,height:wg}),Yg.shapeConfigMap.set(Pg.EXCLUSIVE_GATEWAY,{width:Eg,height:Cg}),Yg.shapeConfigMap.set(Pg.SYSTEM,{width:Ng,height:_g}),Yg.shapeConfigMap.set(Pg.USER,{width:Sg,height:Mg}),Yg.shapeConfigMap.set(Pg.SUBPROCESS,{width:Tg,height:Ag});var $g=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t,i=(t=e,(new kg.ObjTree).parseXML(t));return n.adapterIn(i,n.props)},n.adapterXmlOut=function(e){return function(e){var t="";for(var n in e)t+=Lg(e[n],n,0);return t}(n.adapterOut(e,n.props))};var i=t.lf,o=t.props;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n.props=o,n}return g(t,e),t.pluginName="BPMNAdapter",t}(Yg),Zg={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},Jg={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function Qg(e){switch(e){case"bpmn:sequenceFlow":return Zg.SEQUENCE_FLOW;case"bpmn:startEvent":return Zg.START_EVENT;case"bpmn:endEvent":return Zg.END_EVENT;case"bpmn:userTask":return Zg.USER_TASK;case"bpmn:exclusiveGateway":return Zg.EXCLUSIVE_GATEWAY;default:return e}}function ev(e,t,n){var i=t.x,o=t.y,r=e.x-i,a=e.y-o;return{x:r*Math.cos(n)-a*Math.sin(n)+i,y:r*Math.sin(n)+a*Math.cos(n)+o}}var tv=function(e){function n(){var n=e.apply(this,C([],E(arguments),!1))||this;return n.childrenPositionMap=new Map,n.onNodeRotate=function(e){var t=e.model,i=n.props,o=i.model,r=i.graphModel,a=o.transformWithContainer,s=o.isRestrict,l=n.childrenPositionMap;if(a&&!s&&t.id===o.id){var u={x:o.x,y:o.y};Cu(Array.from(o.children),(function(e){var n=r.getNodeModelById(e);if(n){var i={x:n.x,y:n.y};l.has(n.id)?i=l.get(n.id):l.set(n.id,i);var o=t.rotate*(180/Math.PI);o<0&&(o+=360);var a=o*(Math.PI/180),s=ev(i,u,a);n.moveTo(s.x,s.y),n.rotate=t.rotate}}))}},n.onNodeResize=function(e){var i=e.deltaX,o=e.deltaY,r=e.index,a=e.model,s=e.preData,l=n.props,u=l.model,c=l.graphModel,d=u.transformWithContainer,h=u.isRestrict;if(d&&!h&&a.id===u.id){var f=s.properties||{},p=f.width,g=f.height;Cu(Array.from(u.children),(function(e){var n=c.getNodeModelById(e);if(n){var a=n.width/p*i,s=n.height/g*o;t.handleResize({deltaX:a,deltaY:s,index:r,nodeModel:n,graphModel:c,cancelCallback:function(){}})}}))}},n.onNodeMouseMove=function(){},n.graphRendered=function(){var e=n.props.model;e.isCollapsed&&e.toggleCollapse(!0)},n}return g(n,e),n.prototype.componentDidMount=function(){e.prototype.componentDidMount.call(this);var t=this.props.graphModel.eventCenter;t.on("node:rotate",this.onNodeRotate),t.on("node:resize",this.onNodeResize),t.on("node:mousemove",this.onNodeMouseMove),t.on("graph:rendered",this.graphRendered)},n.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this);var t=this.props.graphModel.eventCenter;t.off("node:rotate",this.onNodeRotate),t.off("node:resize",this.onNodeResize),t.off("node:mousemove",this.onNodeMouseMove),t.off("graph:rendered",this.graphRendered)},n.prototype.getNodesInGroup=function(e,t){var n=this,i=[];return e.isGroup&&Cu(Array.from(e.children),(function(e){i.push(e);var o=t.getNodeModelById(e);(null==o?void 0:o.isGroup)&&(i=i.concat(n.getNodesInGroup(o,t)))})),i},n.prototype.getResizeControl=function(){var t=this.props.model,n=t.resizable,i=t.isCollapsed;return n&&!i?e.prototype.getResizeControl.call(this):null},n.prototype.getAppendAreaShape=function(){var e=this.props.model,n=e.width,i=e.height,o=e.x,r=e.y,a=e.radius;if(!e.groupAddable)return null;var s=e.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=e.getAddableOutlineStyle(),c=n+l+8,d=i+l+8;return t.h("rect",v(v({},u),{width:c,height:d,x:o-c/2,y:r-d/2,rx:a,ry:a}))},n.prototype.getCollapseIcon=function(e,t){return"M ".concat(e+3,",").concat(t+6," ").concat(e+11,",").concat(t+6," M").concat(e+7,",").concat(t+2," ").concat(e+7,",").concat(t+10)},n.prototype.getExpandIcon=function(e,t){return"M ".concat(e+3,",").concat(t+6," ").concat(e+11,",").concat(t+6," ")},n.prototype.getOperateIcon=function(){var e=this.props.model,n=e.x,i=e.y,o=n-e.width/2+10,r=i-e.height/2+10;if(!e.collapsible)return null;var a=(null==e?void 0:e.isCollapsed)?this.getCollapseIcon(o,r):this.getExpandIcon(o,r),s=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:a});return t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#f4f5f6",stroke:"#cecece",cursor:"pointer",x:o,y:r,onClick:function(){e.toggleCollapse(!e.isCollapsed)}}),s])},n.prototype.getShape=function(){return t.h("g",{},[this.getAppendAreaShape(),e.prototype.getShape.call(this),this.getOperateIcon()])},n}(t.RectNode),nv=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.isGroup=!0,i.isRestrict=!1,i.autoResize=!1,i.collapsible=!0,i.isCollapsed=!1,i.groupAddable=!1,i.transformWithContainer=!1,i.childrenLastCollapseStateDict=new Map,i.childrenLastCollapseStateDict=new Map,i.initNodeData(t),i.setAttributes(),i}return g(n,e),n.prototype.initNodeData=function(t){var n;e.prototype.initNodeData.call(this,t);var i=null!==(n=t.properties)&&void 0!==n?n:{},o=i.children,r=i.width,a=i.height,s=i.collapsedWidth,l=i.collapsedHeight,u=i.collapsible,c=i.isCollapsed,d=i.zIndex,h=i.isRestrict,f=i.autoResize,p=i.autoToFront,g=i.transformWithContainer;this.children=o?new Set(o):new Set,this.zIndex=null!=d?d:-1e4,this.isCollapsed=null!=c&&c,this.setProperties({isCollapsed:null!=c&&c});var v=null!=r?r:400,m=null!=a?a:230;this.width=v,this.height=m,this.expandWidth=v,this.expandHeight=m,this.collapsedWidth=null!=s?s:80,this.collapsedHeight=null!=l?l:60,this.isRestrict=null!=h&&h,this.transformWithContainer=null!=g&&g,this.autoResize=null!=f&&f,this.collapsible=null==u||u,this.autoToFront=null!=p&&p,this.text.editable=!1,this.text.draggable=!1},n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this)},n.prototype.getData=function(){var t=this,n=e.prototype.getData.call(this),i=[];return Cu(Array.from(this.children),(function(e){var n=t.graphModel.getNodeModelById(e);n&&!n.virtual&&i.push(e)})),n.children=i,n.properties&&(n.properties.children=i,n.properties.isCollapsed=this.isCollapsed),n},n.prototype.getNodesInGroup=function(e){var t=[];return e.isGroup&&Cu(Array.from(e.children),(function(e){t.push(e)})),t},n.prototype.getMoveDistance=function(t,n,i){void 0===i&&(i=!1);var o=E(e.prototype.getMoveDistance.call(this,t,n,i),2),r=o[0],a=o[1],s=this.getNodesInGroup(this);return this.graphModel.moveNodes(s,t,n,i),[r,a]},n.prototype.getHistoryData=function(){var t=e.prototype.getHistoryData.call(this);t.children=Array.from(this.children),t.isGroup=!0;var n=this,i=n.x,o=n.y,r=n.collapsedWidth,a=n.collapsedHeight,s=n.expandWidth,l=n.expandHeight;return n.isCollapsed&&(t.x=i+s/2-r/2,t.y=o+l/2-a/2,t.text&&(t.text.x=t.text.x+s/2-r/2,t.text.y=t.text.y+l/2-a/2)),t},n.prototype.toggleCollapse=function(e){var n=this,i=this.graphModel,o=!!e;this.isCollapsed=o,this.setProperties({isCollapsed:o}),i.eventCenter.emit("dynamicGroup:collapse",{collapse:o,nodeModel:this}),o?this.collapse():this.expand();var r=C(C([],E(this.incoming.edges),!1),E(this.outgoing.edges),!1);Cu(Array.from(this.children),(function(i){var o,a,s=n.graphModel.elementsModelMap.get(i);if(s){var l=s.isCollapsed;if(s.isGroup){var u=s;if(u.isCollapsed||u.toggleCollapse(e),!e){var c=null===(o=n.childrenLastCollapseStateDict)||void 0===o?void 0:o.get(i);void 0!==c&&c!==s.isCollapsed&&u.toggleCollapse(c)}}if(null===(a=n.childrenLastCollapseStateDict)||void 0===a||a.set(i,!!l),s.visible=!e,s.BaseType===t.ElementType.NODE){var d=s.incoming.edges,h=s.outgoing.edges;r=C(C(C([],E(r),!1),E(d),!1),E(h),!1)}}})),this.collapseEdge(o,r)},n.prototype.collapse=function(){var e=this,t=e.x,n=e.y,i=e.text,o=e.width,r=e.height,a=e.collapsedWidth,s=e.collapsedHeight;this.x=t-o/2+a/2,this.y=n-r/2+s/2,this.text.x=i.x-o/2+a/2,this.text.y=i.y-r/2+s/2,this.expandWidth=o,this.expandHeight=r,this.width=a,this.height=s},n.prototype.expand=function(){var e=this,t=e.x,n=e.y,i=e.text,o=e.expandWidth,r=e.expandHeight,a=e.collapsedWidth,s=e.collapsedHeight;this.width=o,this.height=r,this.x=t+this.width/2-a/2,this.y=n+this.height/2-s/2,this.text.x=i.x+this.width/2-a/2,this.text.y=i.y+this.height/2-s/2},n.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isCollapsedEdge=!0},n.prototype.collapseEdge=function(e,t){var n=this,i=this.graphModel;Cu(t,(function(t,o){var r,a=t.getData(),s=a.targetNodeId,l=a.sourceNodeId,u=v(v({},a),{id:"".concat(a.id,"__").concat(o),text:null===(r=a.text)||void 0===r?void 0:r.value});t.virtual&&i.deleteEdgeById(t.id);var c=i.dynamicGroup.getGroupByNodeId(s);c||(c=i.getNodeModelById(s));var d=i.dynamicGroup.getGroupByNodeId(l);d||(d=i.getNodeModelById(l)),e&&t.visible&&(n.children.has(l)||n.id===l?(u.startPoint=void 0,u.sourceNodeId=n.id):(u.endPoint=void 0,u.targetNodeId=n.id),c.id===n.id&&d.id===n.id||n.createVirtualEdge(u),t.visible=!1),e||t.visible||(c&&c.isGroup&&c.isCollapsed?(u.targetNodeId=c.id,u.endPoint=void 0,n.createVirtualEdge(u)):d&&d.isGroup&&d.isCollapsed?(u.sourceNodeId=d.id,u.startPoint=void 0,n.createVirtualEdge(u)):t.visible=!0)}))},n.prototype.isAllowAppendIn=function(e){return!0},n.prototype.setAllowAppendChild=function(e){this.groupAddable=e},n.prototype.addChild=function(e){this.children.add(e);var t=this.getData();this.graphModel.eventCenter.emit("group:add-node",{data:t,childId:e})},n.prototype.removeChild=function(e){this.children.delete(e);var t=this.getData();this.graphModel.eventCenter.emit("group:remove-node",{data:t})},n.prototype.toBack=function(){this.zIndex--},n.prototype.getResizeOutlineStyle=function(){var t=e.prototype.getResizeOutlineStyle.call(this);return t.stroke="none",t},n.prototype.getAnchorStyle=function(){var t=e.prototype.getAnchorStyle.call(this);return t.stroke="transparent",t.fill="transparent",t.hover&&(t.hover.fill="transparent",t.hover.stroke="transparent"),t},n.prototype.getAddableOutlineStyle=function(){return{stroke:"#feb663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},y([t.observable],n.prototype,"isCollapsed",void 0),y([t.observable],n.prototype,"groupAddable",void 0),y([t.observable],n.prototype,"transformWithContainer",void 0),n}(t.RectNodeModel);var iv,ov={type:"dynamic-group",view:tv,model:nv},rv=-1e4,av=function(){function e(e){var t=e.lf,n=e.options,i=this;this.topGroupZIndex=rv,this.nodeGroupMap=new Map,this.onSelectionDrop=function(){i.lf.graphModel.getSelectElements().nodes.forEach((function(e){i.addNodeToGroup(e)}))},this.onNodeAddOrDrop=function(e){var t=e.data;i.addNodeToGroup(t)},this.addNodeToGroup=function(e){var t=i.nodeGroupMap.get(e.id);t&&((a=i.lf.getNodeModelById(t)).removeChild(e.id),i.nodeGroupMap.delete(e.id),a.setAllowAppendChild(!1));var n=i.lf.getNodeModelById(e.id),o=null==n?void 0:n.getBounds();if(n&&o){if(n.isGroup){var r=n;Cu(Array.from(r.children),(function(t){i.nodeGroupMap.set(t,e.id)})),i.calibrateTopGroupZIndex([e]),i.onNodeSelect({data:e,isSelected:!1,isMultiple:!1})}var a;if(a=i.getGroupByBounds(o,e))a.isAllowAppendIn(e)?(a.addChild(e.id),a.setAllowAppendChild(!1)):i.lf.emit("group:not-allowed",{group:a.getData(),node:e})}},this.onGroupAddNode=function(e){var t=e.data,n=e.childId;i.nodeGroupMap.set(n,t.id)},this.removeNodeFromGroup=function(e){var t=e.data;e.model.isGroup&&t.children&&Cu(Array.from(t.children),(function(e){i.nodeGroupMap.delete(e),i.lf.deleteNode(e)}));var n=i.nodeGroupMap.get(t.id);if(n){var o=i.lf.getNodeModelById(n);o&&o.removeChild(t.id),i.nodeGroupMap.delete(t.id)}},this.onSelectionDrag=function(){i.lf.graphModel.getSelectElements().nodes.forEach((function(e){i.setActiveGroup(e)}))},this.onNodeDrag=function(e){var t=e.data;i.setActiveGroup(t)},this.setActiveGroup=function(e){var t=i.lf.getNodeModelById(e.id),n=null==t?void 0:t.getBounds();if(t&&n){var o=i.getGroupByBounds(n,e);if(i.activeGroup&&i.activeGroup.setAllowAppendChild(!1),!o||t.isGroup&&o.id===e.id)return;if(!o.isAllowAppendIn(e))return;i.activeGroup=o,i.activeGroup.setAllowAppendChild(!0)}},this.onNodeSelect=function(e){var t=e.data,n=e.isMultiple,o=e.isSelected,r=i.lf.getNodeModelById(t.id);if(i.sendNodeToFront(r),i.topGroupZIndex>-1e3){var a=i.lf.graphModel.nodes;i.topGroupZIndex=rv;var s=tf(Gu(a,(function(e){return!!e.isGroup})),"zIndex"),l=0;Cu(s,(function(e){e.zIndex!==l&&(i.topGroupZIndex++,l=e.zIndex),e.setZIndex(i.topGroupZIndex)}))}if(n&&o)if(null==r?void 0:r.isGroup){var u=r.children;Cu(Array.from(u),(function(e){var t=i.lf.getNodeModelById(e);null==t||t.setSelected(!1)}))}else{var c=i.nodeGroupMap.get(t.id);if(c){var d=i.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==r||r.setSelected(!1))}}},this.onNodeMove=function(e){var t=e.deltaX,n=e.deltaY,o=e.data,r=o.id,a=o.x,s=o.y,l=o.properties;if(l){var u=l.width,c=l.height,d=i.nodeGroupMap.get(r);if(d){var h=i.lf.getNodeModelById(d);if(h&&h.isRestrict&&h.autoResize){var f=a+t/2,p=s+n/2,g=f-u/2,v=p-c/2,m=f+u/2,y=p+c/2,b=!1,x=h.getBounds(),w=Object.assign({},x);if(g<w.minX&&(w.minX=g,b=!0),v<w.minY&&(w.minY=v,b=!0),m>w.maxX&&(w.maxX=m,b=!0),y>w.maxY&&(w.maxY=y,b=!0),b){var E=w.minX+(w.maxX-w.minX)/2,C=w.minY+(w.maxY-w.minY)/2,N=w.maxX-w.minX,_=w.maxY-w.minY;h.moveTo(E,C),h.width=N,h.height=_}}}}},this.onGraphRendered=function(e){var t=e.data;Cu(t.nodes,(function(e){e.children&&Cu(e.children,(function(t){i.nodeGroupMap.set(t,e.id)}))})),i.calibrateTopGroupZIndex(t.nodes)},t.register(ov),this.lf=t,co(this,n),this.init()}return e.prototype.getGroupByNodeId=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},e.prototype.getGroupByBounds=function(e,t){var n=Gu(this.lf.graphModel.nodes,(function(n){return!!n.isGroup&&function(e,t){var n=e.minX,i=e.minY,o=e.maxX,r=e.maxY,a=t.x,s=t.y,l=t.width,u=t.height;return n>=a-l/2&&o<=a+l/2&&i>=s-u/2&&r<=s+u/2}(e,n)&&n.id!==t.id})),i=n.length;if(i<=1)return n[0];for(var o=n[i-1],r=i-2;r>=0;r--)n[r].zIndex>o.zIndex&&(o=n[r]);return o},e.prototype.sendNodeToFront=function(e){var t=this;if(e&&e.isGroup&&(this.topGroupZIndex++,e.setZIndex(this.topGroupZIndex),e.children)){var n=e.children;Cu(Array.from(n),(function(e){var n=t.lf.getNodeModelById(e);t.sendNodeToFront(n)}))}},e.prototype.getMaxZIndex=function(e){var t=this,n=rv;if(e.isGroup&&(n=Math.max(n,e.zIndex)),e.children){var i=e.children;Cu(Array.from(i),(function(e){var i=t.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var o=t.getMaxZIndex(i);n=Math.max(n,o)}}))}return n},e.prototype.calibrateTopGroupZIndex=function(e){var t=this,n=rv;if(Cu(e,(function(e){var i=t.lf.getNodeModelById(e.id);if(i){var o=t.getMaxZIndex(i);o>n&&(n=o)}})),!(this.topGroupZIndex>=n)){var i=Gu(this.lf.graphModel.nodes,(function(e){return!!e.isGroup})),o=this.topGroupZIndex;Cu(i,(function(e){e.zIndex>o&&(o=e.zIndex)})),this.topGroupZIndex=o}},e.prototype.removeChildrenInGroupNodeData=function(e){var t,n=Fs(e);return delete n.children,(null===(t=n.properties)||void 0===t?void 0:t.children)&&delete n.properties.children,n},e.prototype.initGroupChildNodes=function(e,n,i,o){var r=this,a=[],s=[],l=[];Cu(Array.from(n),(function(n){var u=r.lf.getNodeModelById(n);if(u){var c=u.children,d=u.getData(),h=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",f=t.transformNodeData(r.removeChildrenInGroupNodeData(d),o),p=r.lf.addNode(f,h);if(i.addChild(p.id),e[n]=p.id,a.push(p),l.push.apply(l,C([],E(C(C([],E(p.incoming.edges),!1),E(p.outgoing.edges),!1)),!1)),c instanceof Set){var g=r.initGroupChildNodes(e,c,p,o),v=g.childNodes,m=g.edgesData;a.push.apply(a,C([],E(v),!1)),s.push.apply(s,C([],E(m),!1))}}}));var u=tc(Gu(l,(function(t){return mc(e,t.sourceNodeId)&&mc(e,t.targetNodeId)})),(function(e){return e.getData()}));return{childNodes:a,edgesData:s.concat(u)}},e.prototype.createEdge=function(e,n,i){var o,r,a=e.sourceNodeId,s=e.targetNodeId,l=null!==(o=n[a])&&void 0!==o?o:a,u=null!==(r=n[s])&&void 0!==r?r:s,c=Fs(e);return e.id&&"object"==typeof e.text&&null!==e.text&&(c=t.transformEdgeData(e,i)),this.lf.graphModel.addEdge(v(v({},c),{sourceNodeId:l,targetNodeId:u}))},e.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,o){if(e.children)for(var r=e.children,a=e.x+t/2,s=e.y+n/2,l=a-i/2,u=s-o/2,c=a+i/2,d=s+o/2,h=Array.from(r),f=0;f<h.length;f++){var p=h[f],g=this.lf.getNodeModelById(p);if(g){var v=g.getBounds(),m=v.minX,y=v.minY,b=v.maxX,x=v.maxY;if(!(l<=m&&u<=y&&c>=b&&d>=x))return!1}}return!0},e.prototype.init=function(){var e=this,t=this.lf,n=t.graphModel;n.addNodeMoveRules((function(t,n,i){if(t.isGroup)return!0;var o=e.nodeGroupMap.get(t.id),r=e.lf.getNodeModelById(o);return!r||!r.isRestrict||(!!r.autoResize||function(e,t,n,i){var o=e.minX,r=e.minY,a=e.maxX,s=e.maxY,l=t.x,u=t.y,c=t.width,d=t.height;return{x:l+n>=o+c/2&&l+n<=a-c/2,y:u+i>=r+d/2&&u+i<=s-d/2}}(r.getBounds(),t,n,i))})),n.addNodeResizeRules((function(t,n,i,o,r){return!t.isGroup||!t.isRestrict||e.checkGroupBoundsWithChildren(t,n,i,o,r)})),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(n,i){var o=n.nodes,r=n.edges;void 0===i&&(i=40);var a={},s={nodes:[],edges:[]},l=[];return Cu(o,(function(n){var o,r,u=n.id,c=null!==(r=null===(o=n.properties)||void 0===o?void 0:o.children)&&void 0!==r?r:n.children,d=t.addNode(e.removeChildrenInGroupNodeData(n));if(u&&(a[u]=d.id),s.nodes.push(d),d.isGroup){var h=e.initGroupChildNodes(a,c,d,i).edgesData;l.push.apply(l,C([],E(h),!1))}})),Cu(l,(function(t){e.createEdge(t,a,i)})),Cu(r,(function(t){s.edges.push(e.createEdge(t,a,i))})),s},this.render()},e.prototype.render=function(){},e.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)},e.pluginName="dynamicGroup",e}();!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(iv||(iv={}));var sv=function(e,t,n,i){return void 0===i&&(i=0),cv(e,t,n)<=i};function lv(e){return e*e}function uv(e,t){return lv(e.x-t.x)+lv(e.y-t.y)}var cv=function(e,t,n){return Math.sqrt(function(e,t,n){var i=uv(t,n);if(0===i)return uv(e,t);var o=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/i;return o=Math.max(0,Math.min(1,o)),uv(e,{x:t.x+o*(n.x-t.x),y:t.y+o*(n.y-t.y)})}(e,t,n))},dv=function(e,t,n){var i=function(e){var t=e.x,n=e.y,i=e.width,o=e.height;return{minX:t-i/2,minY:n-o/2,maxX:t+i/2,maxY:n+o/2,x:t,y:n,width:i,height:o,centerX:t,centerY:n}}(e),o=function(e,t){var n;return e.x===t.x?n=iv.VERTICAL:e.y===t.y&&(n=iv.HORIZONTAL),n}(t,n),r=Math.max(t.x,n.x),a=Math.min(t.x,n.x),s=Math.max(t.y,n.y),l=Math.min(t.y,n.y),u=e.x,c=e.y,d=e.width,h=e.height;if(o===iv.HORIZONTAL){if(r>=i.maxX&&a<=i.minX)return{startCrossPoint:{x:t.x>n.x?u+d/2:u-d/2,y:t.y},endCrossPoint:{x:t.x>n.x?u-d/2:u+d/2,y:t.y}}}else if(o===iv.VERTICAL&&s>=i.maxY&&l<=i.minY)return{startCrossPoint:{x:t.x,y:t.y>n.y?c+h/2:c-h/2},endCrossPoint:{x:t.x,y:t.y>n.y?c-h/2:c+h/2}}},hv=function(e,t,n){void 0===n&&(n=0);for(var i=e.x,o=e.y,r=t.pointsList,a=0;a<r.length-1;a++)if(sv({x:i,y:o},r[a],r[a+1],n)){var s=dv(e,r[a],r[a+1]);if(s)return{crossIndex:a+1,crossPoints:s}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},fv=function(){function e(e){var t=e.lf;this._lf=t,this.deviation=20,this.dndAdd=!0,this.dropAdd=!0,this.eventHandler()}return e.prototype.eventHandler=function(){var e=this;this.dndAdd&&this._lf.on("node:dnd-add",(function(t){var n=t.data;e.insetNode(n)})),this.dropAdd&&this._lf.on("node:drop",(function(t){for(var n=t.data,i=e._lf.graphModel.edges,o=n.id,r=!0,a=0;a<i.length;a++)if(i[a].sourceNodeId===o||i[a].targetNodeId===o){r=!1;break}r&&e.insetNode(n)}))},e.prototype.checkRuleBeforeInsetNode=function(e,n,i,o,r){var a=this._lf.getNodeModelById(e),s=this._lf.getNodeModelById(n),l=a.getAnchorInfo(i),u=s.getAnchorInfo(o),c=a.isAllowConnectedAsSource(r,l,u),d=s.isAllowConnectedAsTarget(r,l,u),h=t.formatAnchorConnectValidateData(c),f=h.isAllPass,p=h.msg,g=t.formatAnchorConnectValidateData(d),v=g.isAllPass;return{isPass:f&&v,sourceMsg:p,targetMsg:g.msg}},e.prototype.insetNode=function(e){var n=this,i=this._lf.graphModel.edges,o=this._lf.getNodeModelById(e.id),r=null==o?void 0:o.getDefaultAnchor();if(!r||0===r.length)this._lf.graphModel.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:e,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(o)for(var a=0;a<i.length;a++){var s=hv(o,i[a],this.deviation),l=s.crossIndex,u=s.crossPoints;if(l>=0){var c=i[a],d=c.sourceNodeId,h=c.targetNodeId,f=c.id,p=c.type,g=c.pointsList,v=c.sourceAnchorId,m=c.targetAnchorId,y=Fs(g[0]),b=Fs(u.startCrossPoint);this._lf.deleteEdge(f);var x=this.checkRuleBeforeInsetNode(d,h,v,m,e);if(this._lf.addEdge({type:p,sourceNodeId:d,targetNodeId:e.id,startPoint:y,endPoint:b,pointsList:C(C([],E(g.slice(0,l)),!1),[u.startCrossPoint],!1)}),this._lf.addEdge({type:p,sourceNodeId:e.id,targetNodeId:h,startPoint:Fs(u.endCrossPoint),endPoint:Fs(g[g.length-1]),pointsList:C([u.endCrossPoint],E(g.slice(l)),!1)}),x.isPass)break;this._lf.graphModel.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:e,msg:x.targetMsg||x.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},e.pluginName="insertNodeInPolyline",e}(),pv="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},gv={};!function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,i(n)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var i="";for(var r in e)t.call(e,r)&&e[r]&&(i=o(i,r));return i}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}({get exports(){return gv},set exports(e){gv=e}});var vv=gv,mv=function(e){function n(n){var i=e.call(this,n)||this;i.textRef=t.createRef(),i.setHoverOn=function(){var e=i.props.element;e.isDragging||i.state.isHovered||(i.setState({isHovered:!0}),e.setHovered(!0))},i.setHoverOff=function(){var e=i.props.element;i.state.isHovered&&(i.setState({isHovered:!1}),e.setHovered(!1))},i.handleMouseDown=function(e){var t,n=i.props,o=n.label,r=n.graphModel.editConfigModel.nodeTextDraggable;!(null!==(t=o.draggable)&&void 0!==t?t:r)||i.state.isDragging||i.state.isEditing||i.stepDrag.handleMouseDown(e)},i.handleMouseUp=function(e){i.state.isDragging&&i.stepDrag.handleMouseUp(e)},i.handleDragging=function(e){var t=e.deltaX,n=e.deltaY;i.state.isDragging||i.setState({isDragging:!0});var o=i.props,r=o.label,a=o.graphModel,s=E(a.transformModel.fixDeltaXY(t,n),2),l=s[0],u=s[1];i.setElementModelLabelInfo({x:r.x+l,y:r.y+u}),a.eventCenter.emit("label:drag",{data:r.getData(),model:r})},i.handleDragEnd=function(){i.setState({isDragging:!1})},i.handleClick=function(e){var t=i.props,n=t.label,o=t.element,r=t.graphModel;o.setSelected(!i.state.isSelected),i.setState({isSelected:!i.state.isSelected}),i.setElementModelLabelInfo({isSelected:!0}),r.eventCenter.emit("label:click",{data:n.getData(),e:e,model:o})},i.handleDbClick=function(e){var n=i.props,o=n.label,r=n.element;if(n.graphModel.eventCenter.emit("label:dblclick",{data:o.getData(),e:e,model:r}),o.editable){if(r.setSelected(),r.setElementState(t.ElementState.TEXT_EDIT),i.setState({isEditing:!0}),i.textRef.current){i.textRef.current.contentEditable="true",i.textRef.current.focus();var a=document.createRange(),s=window.getSelection();a.selectNodeContents(i.textRef.current),a.collapse(!1),null==s||s.removeAllRanges(),null==s||s.addRange(a)}}else r.setSelected(!0)},i.handleBlur=function(e){var t=i.props,n=t.label,o=t.element;t.graphModel.eventCenter.emit("label:blur",{e:e,model:o,data:n.getData(),element:i.textRef.current}),i.setState({isDragging:!1,isHovered:!1,isSelected:!1})},i.handleInput=function(e){var t=i.props,n=t.label;t.graphModel.eventCenter.emit("label:input",{e:e,data:n.getData()})},i.reCalcLabelSize=function(){};var o=n.label,r=n.graphModel,a=r.gridSize,s=r.eventCenter;return i.stepDrag=new t.StepDrag({onDragging:i.handleDragging,onDragEnd:i.handleDragEnd,step:a,eventType:"LABEL",model:o,eventCenter:s}),i.state={isEditing:!1,isHovered:!1,isDragging:!1,isSelected:!1},i}return g(n,e),n.prototype.setElementModelLabelInfo=function(e){var t=this.props,n=t.label,i=t.element,o=t.graphModel,r=i.properties._label,a=Xu(r,(function(e){return e.id===n.id})),s=r[a];r[a]=v(v({},s),e);var l=o.getElement(i.id);null==l||l.setProperty("_label",r)},n.prototype.componentDidMount=function(){var e=this,n=this.props,i=n.label,o=n.element;n.graphModel.eventCenter.on("blank:click,node:click,edge:click,label:click",(function(n){var r,a,s,l,u=n.data;if(("label"!==(null==u?void 0:u.type)||"label"===u.type&&u.id!==i.id||e.state.isSelected)&&e.setState({isSelected:!1}),("label"!==(null==u?void 0:u.type)||"label"==u.type&&u.id!==i.id)&&e.state.isEditing){e.setState({isEditing:!1});var c=null!==(a=null===(r=e.textRef.current)||void 0===r?void 0:r.innerText)&&void 0!==a?a:"",d=null!==(l=null===(s=e.textRef.current)||void 0===s?void 0:s.innerHTML)&&void 0!==l?l:"";e.setElementModelLabelInfo({value:c,content:d,isSelected:!1}),o.setElementState(t.ElementState.DEFAULT)}("label"!==(null==u?void 0:u.type)||"label"==u.type&&u.id!==i.id)&&e.textRef.current&&(e.textRef.current.contentEditable="false")}))},n.prototype.componentDidUpdate=function(){},n.prototype.componentWillUnmount=function(){this.props.graphModel.eventCenter.off("blank:click,node:click,edge:click")},n.prototype.render=function(){var e,t=this.props,n=t.label,i=t.element,o=t.graphModel,r=this.state,a=r.isDragging,s=r.isHovered,l=r.isSelected,u=r.isEditing,c=o.transformModel.getTransformStyle().transform,d=n.id,h=n.x,f=n.y,p=n.zIndex,g=n.vertical,m=n.style,y=n.rotate,b=n.content,x=n.labelWidth,w=n.textOverflowMode,E=null!=x?x:"node"===i.BaseType?i.width-20:80,C={left:"".concat(h-E/2,"px"),top:"".concat(f-10,"px"),width:"".concat(E,"px"),height:"20px",zIndex:null!=p?p:1,transform:y?"".concat(c," rotate(").concat(y,"deg)"):"".concat(c," rotate(").concat(g?-.25:0,"turn)")};return Ip("div",{id:"element-container-".concat(d),className:vv("lf-label-editor-container"),style:C,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:Ip("div",{ref:this.textRef,id:"editor-container-".concat(d),className:vv("lf-label-editor",(e={"lf-label-editor-dragging":a,"lf-label-editor-editing":u,"lf-label-editor-hover":!u&&(s||l)},e["lf-label-editor-".concat(w)]=!u,e)),onInput:this.handleInput,style:v({maxWidth:"".concat(E,"px"),boxSizing:"border-box",display:"inline-block",background:u||"edge"===i.BaseType?"#fff":"transparent"},m),dangerouslySetInnerHTML:{__html:b}})})},n=y([t.observer],n)}(t.Component),yv=t.LogicFlowUtil.createUuid,bv=function(){function e(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=null!==(i=e.id)&&void 0!==i?i:yv(),this.initLabelData(e)}return e.prototype.initLabelData=function(e){co(this,e)},e.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:t.toJS(this.style),draggable:this.draggable,editable:this.editable,labelWidth:this.labelWidth,textOverflowMode:this.textOverflowMode,vertical:this.vertical}},y([t.observable],e.prototype,"x",void 0),y([t.observable],e.prototype,"y",void 0),y([t.observable],e.prototype,"content",void 0),y([t.observable],e.prototype,"value",void 0),y([t.observable],e.prototype,"rotate",void 0),y([t.observable],e.prototype,"style",void 0),y([t.observable],e.prototype,"zIndex",void 0),y([t.observable],e.prototype,"vertical",void 0),y([t.observable],e.prototype,"editable",void 0),y([t.observable],e.prototype,"draggable",void 0),y([t.observable],e.prototype,"labelWidth",void 0),y([t.observable],e.prototype,"textOverflowMode",void 0),e}(),xv={};!function(e){"classList"in document.createElement("_")||function(e){if("Element"in e){var t="classList",n="prototype",i=e.Element[n],o=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},a=Array[n].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},s=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},l=function(e,t){if(""===t)throw new s("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new s("INVALID_CHARACTER_ERR","String contains an invalid character");return a.call(e,t)},u=function(e){for(var t=r.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],i=0,o=n.length;i<o;i++)this.push(n[i]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},c=u[n]=[],d=function(){return new u(this)};if(s[n]=Error[n],c.item=function(e){return this[e]||null},c.contains=function(e){return-1!==l(this,e+="")},c.add=function(){var e,t=arguments,n=0,i=t.length,o=!1;do{-1===l(this,e=t[n]+"")&&(this.push(e),o=!0)}while(++n<i);o&&this._updateClassName()},c.remove=function(){var e,t,n=arguments,i=0,o=n.length,r=!1;do{for(t=l(this,e=n[i]+"");-1!==t;)this.splice(t,1),r=!0,t=l(this,e)}while(++i<o);r&&this._updateClassName()},c.toggle=function(e,t){e+="";var n=this.contains(e),i=n?!0!==t&&"remove":!1!==t&&"add";return i&&this[i](e),!0===t||!1===t?t:!n},c.toString=function(){return this.join(" ")},o.defineProperty){var h={get:d,enumerable:!0,configurable:!0};try{o.defineProperty(i,t,h)}catch(e){-2146823252===e.number&&(h.enumerable=!1,o.defineProperty(i,t,h))}}else o[n].__defineGetter__&&i.__defineGetter__(t,d)}}(self),function(e){if(e.URL=e.URL||e.webkitURL,e.Blob&&e.URL)try{return void new Blob}catch(e){}var t=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||function(e){var t=function(e){return Object.prototype.toString.call(e).match(/^\[object\s(.*)\]$/)[1]},n=function(){this.data=[]},i=function(e,t,n){this.data=e,this.size=e.length,this.type=t,this.encoding=n},o=n.prototype,r=i.prototype,a=e.FileReaderSync,s=function(e){this.code=this[this.name=e]},l="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),u=l.length,c=e.URL||e.webkitURL||e,d=c.createObjectURL,h=c.revokeObjectURL,f=c,p=e.btoa,g=e.atob,v=e.ArrayBuffer,m=e.Uint8Array,y=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(i.fake=r.fake=!0;u--;)s.prototype[l[u]]=u+1;return c.createObjectURL||(f=e.URL=function(e){var t,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");return n.href=e,"origin"in n||("data:"===n.protocol.toLowerCase()?n.origin=null:(t=e.match(y),n.origin=t&&t[1])),n}),f.createObjectURL=function(e){var t,n=e.type;return null===n&&(n="application/octet-stream"),e instanceof i?(t="data:"+n,"base64"===e.encoding?t+";base64,"+e.data:"URI"===e.encoding?t+","+decodeURIComponent(e.data):p?t+";base64,"+p(e.data):t+","+encodeURIComponent(e.data)):d?d.call(c,e):void 0},f.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&h&&h.call(c,e)},o.append=function(e){var n=this.data;if(m&&(e instanceof v||e instanceof m)){for(var o="",r=new m(e),l=0,u=r.length;l<u;l++)o+=String.fromCharCode(r[l]);n.push(o)}else if("Blob"===t(e)||"File"===t(e)){if(!a)throw new s("NOT_READABLE_ERR");var c=new a;n.push(c.readAsBinaryString(e))}else e instanceof i?"base64"===e.encoding&&g?n.push(g(e.data)):"URI"===e.encoding?n.push(decodeURIComponent(e.data)):"raw"===e.encoding&&n.push(e.data):("string"!=typeof e&&(e+=""),n.push(unescape(encodeURIComponent(e))))},o.getBlob=function(e){return arguments.length||(e=null),new i(this.data.join(""),e,"raw")},o.toString=function(){return"[object BlobBuilder]"},r.slice=function(e,t,n){var o=arguments.length;return o<3&&(n=null),new i(this.data.slice(e,o>1?t:this.data.length),n,this.encoding)},r.toString=function(){return"[object Blob]"},r.close=function(){this.size=0,delete this.data},n}(e);e.Blob=function(e,n){var i=n&&n.type||"",o=new t;if(e)for(var r=0,a=e.length;r<a;r++)Uint8Array&&e[r]instanceof Uint8Array?o.append(e[r].buffer):o.append(e[r]);var s=o.getBlob(i);return!s.slice&&s.webkitSlice&&(s.slice=s.webkitSlice),s};var n=Object.getPrototypeOf||function(e){return e.__proto__};e.Blob.prototype=n(new e.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||pv.content||pv),function(t,n){"undefined"!=typeof process&&process&&process.versions&&process.versions.electron?t.MediumEditor=n:e.exports=n}(pv,function(){function e(e,t){return this.init(e,t)}var t,n,i,o,r,a,s,l,u,c,d;return e.extensions={},function(t){function n(e,t){var n,i=Array.prototype.slice.call(arguments,2);t=t||{};for(var o=0;o<i.length;o++){var r=i[o];if(r)for(n in r)r.hasOwnProperty(n)&&void 0!==r[n]&&(e||!1===t.hasOwnProperty(n))&&(t[n]=r[n])}return t}var i=!1;try{var o=document.createElement("div"),r=document.createTextNode(" ");o.appendChild(r),i=o.contains(r)}catch(e){}var a={isIE:"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent),isEdge:null!==/Edge\/\d+/.exec(navigator.userAgent),isFF:navigator.userAgent.toLowerCase().indexOf("firefox")>-1,isMac:t.navigator.platform.toUpperCase().indexOf("MAC")>=0,keyCode:{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DELETE:46,K:75,M:77,V:86},isMetaCtrlKey:function(e){return!!(a.isMac&&e.metaKey||!a.isMac&&e.ctrlKey)},isKey:function(e,t){var n=a.getKeyCode(e);return!1===Array.isArray(t)?n===t:-1!==t.indexOf(n)},getKeyCode:function(e){var t=e.which;return null===t&&(t=null!==e.charCode?e.charCode:e.keyCode),t},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 e=[!0].concat(Array.prototype.slice.call(arguments));return n.apply(this,e)},defaults:function(){var e=[!1].concat(Array.prototype.slice.call(arguments));return n.apply(this,e)},createLink:function(e,t,n,i){var o=e.createElement("a");return a.moveTextRangeIntoElement(t[0],t[t.length-1],o),o.setAttribute("href",n),i&&("_blank"===i&&o.setAttribute("rel","noopener noreferrer"),o.setAttribute("target",i)),o},findOrCreateMatchingTextNodes:function(e,t,n){for(var i=e.createTreeWalker(t,NodeFilter.SHOW_ALL,null,!1),o=[],r=0,s=!1,l=null,u=null;null!==(l=i.nextNode());)if(!(l.nodeType>3))if(3===l.nodeType){if(!s&&n.start<r+l.nodeValue.length&&(s=!0,u=a.splitStartNodeIfNeeded(l,n.start,r)),s&&a.splitEndNodeIfNeeded(l,u,n.end,r),s&&r===n.end)break;if(s&&r>n.end+1)throw new Error("PerformLinking overshot the target!");s&&o.push(u||l),r+=l.nodeValue.length,null!==u&&(r+=u.nodeValue.length,i.nextNode()),u=null}else"img"===l.tagName.toLowerCase()&&(!s&&n.start<=r&&(s=!0),s&&o.push(l));return o},splitStartNodeIfNeeded:function(e,t,n){return t!==n?e.splitText(t-n):null},splitEndNodeIfNeeded:function(e,t,n,i){var o,r;o=i+e.nodeValue.length+(t?t.nodeValue.length:0)-1,r=n-i-(t?e.nodeValue.length:0),o>=n&&i!==o&&0!==r&&(t||e).splitText(r)},splitByBlockElements:function(t){if(3!==t.nodeType&&1!==t.nodeType)return[];var n=[],i=e.util.blockContainerElementNames.join(",");if(3===t.nodeType||0===t.querySelectorAll(i).length)return[t];for(var o=0;o<t.childNodes.length;o++){var r=t.childNodes[o];if(3===r.nodeType)n.push(r);else if(1===r.nodeType){0===r.querySelectorAll(i).length?n.push(r):n=n.concat(e.util.splitByBlockElements(r))}}return n},findAdjacentTextNodeWithContent:function(e,t,n){var i,o=!1,r=n.createNodeIterator(e,NodeFilter.SHOW_TEXT,null,!1);for(i=r.nextNode();i;){if(i===t)o=!0;else if(o&&3===i.nodeType&&i.nodeValue&&i.nodeValue.trim().length>0)break;i=r.nextNode()}return i},findPreviousSibling:function(e){if(!e||a.isMediumEditorElement(e))return!1;for(var t=e.previousSibling;!t&&!a.isMediumEditorElement(e.parentNode);)t=(e=e.parentNode).previousSibling;return t},isDescendant:function(e,t,n){if(!e||!t)return!1;if(e===t)return!!n;if(1!==e.nodeType)return!1;if(i||3!==t.nodeType)return e.contains(t);for(var o=t.parentNode;null!==o;){if(o===e)return!0;o=o.parentNode}return!1},isElement:function(e){return!(!e||1!==e.nodeType)},throttle:function(e,t){var n,i,o,r=null,a=0,s=function(){a=Date.now(),r=null,o=e.apply(n,i),r||(n=i=null)};return t||0===t||(t=50),function(){var l=Date.now(),u=t-(l-a);return n=this,i=arguments,u<=0||u>t?(r&&(clearTimeout(r),r=null),a=l,o=e.apply(n,i),r||(n=i=null)):r||(r=setTimeout(s,u)),o}},traverseUp:function(e,t){if(!e)return!1;do{if(1===e.nodeType){if(t(e))return e;if(a.isMediumEditorElement(e))return!1}e=e.parentNode}while(e);return!1},htmlEntities:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},insertHTMLCommand:function(t,n){var i,o,r,s,l,u,c,d=!1,h=["insertHTML",!1,n];if(!e.util.isEdge&&t.queryCommandSupported("insertHTML"))try{return t.execCommand.apply(t,h)}catch(e){}if((i=t.getSelection()).rangeCount){if(c=(o=i.getRangeAt(0)).commonAncestorContainer,a.isMediumEditorElement(c)&&!c.firstChild)o.selectNode(c.appendChild(t.createTextNode("")));else if(3===c.nodeType&&0===o.startOffset&&o.endOffset===c.nodeValue.length||3!==c.nodeType&&c.innerHTML===o.toString()){for(;!a.isMediumEditorElement(c)&&c.parentNode&&1===c.parentNode.childNodes.length&&!a.isMediumEditorElement(c.parentNode);)c=c.parentNode;o.selectNode(c)}for(o.deleteContents(),(r=t.createElement("div")).innerHTML=n,s=t.createDocumentFragment();r.firstChild;)l=r.firstChild,u=s.appendChild(l);o.insertNode(s),u&&((o=o.cloneRange()).setStartAfter(u),o.collapse(!0),e.selection.selectRange(t,o)),d=!0}return t.execCommand.callListeners&&t.execCommand.callListeners(h,d),d},execFormatBlock:function(t,n){var i=a.getTopBlockContainer(e.selection.getSelectionStart(t));if("blockquote"===n){if(i&&Array.prototype.slice.call(i.childNodes).some((function(e){return a.isBlockContainer(e)})))return t.execCommand("outdent",!1,null);if(a.isIE)return t.execCommand("indent",!1,n)}if(i&&n===i.nodeName.toLowerCase()&&(n="p"),a.isIE&&(n="<"+n+">"),i&&"blockquote"===i.nodeName.toLowerCase()){if(a.isIE&&"<p>"===n)return t.execCommand("outdent",!1,n);if((a.isFF||a.isEdge)&&"p"===n)return Array.prototype.slice.call(i.childNodes).some((function(e){return!a.isBlockContainer(e)}))&&t.execCommand("formatBlock",!1,n),t.execCommand("outdent",!1,n)}return t.execCommand("formatBlock",!1,n)},setTargetBlank:function(e,t){var n,i=t||!1;if("a"===e.nodeName.toLowerCase())e.target="_blank",e.rel="noopener noreferrer";else for(e=e.getElementsByTagName("a"),n=0;n<e.length;n+=1)!1!==i&&i!==e[n].attributes.href.value||(e[n].target="_blank",e[n].rel="noopener noreferrer")},removeTargetBlank:function(e,t){var n;if("a"===e.nodeName.toLowerCase())e.removeAttribute("target"),e.removeAttribute("rel");else for(e=e.getElementsByTagName("a"),n=0;n<e.length;n+=1)t===e[n].attributes.href.value&&(e[n].removeAttribute("target"),e[n].removeAttribute("rel"))},addClassToAnchors:function(e,t){var n,i,o=t.split(" ");if("a"===e.nodeName.toLowerCase())for(i=0;i<o.length;i+=1)e.classList.add(o[i]);else{var r=e.getElementsByTagName("a");if(0===r.length){var s=a.getClosestTag(e,"a");e=s?[s]:[]}else e=r;for(n=0;n<e.length;n+=1)for(i=0;i<o.length;i+=1)e[n].classList.add(o[i])}},isListItem:function(e){if(!e)return!1;if("li"===e.nodeName.toLowerCase())return!0;for(var t=e.parentNode,n=t.nodeName.toLowerCase();"li"===n||!a.isBlockContainer(t)&&"div"!==n;){if("li"===n)return!0;if(!(t=t.parentNode))return!1;n=t.nodeName.toLowerCase()}return!1},cleanListDOM:function(t,n){if("li"===n.nodeName.toLowerCase()){var i=n.parentElement;"p"===i.parentElement.nodeName.toLowerCase()&&(a.unwrap(i.parentElement,t),e.selection.moveCursor(t,n.firstChild,n.firstChild.textContent.length))}},splitOffDOMTree:function(e,t,n){for(var i=t,o=null,r=!n;i!==e;){var a,s=i.parentNode,l=s.cloneNode(!1),u=r?i:s.firstChild;for(o&&(r?l.appendChild(o):a=o),o=l;u;){var c=u.nextSibling;u===i?(u.hasChildNodes()?u=u.cloneNode(!1):u.parentNode.removeChild(u),u.textContent&&o.appendChild(u),u=r?c:null):(u.parentNode.removeChild(u),(u.hasChildNodes()||u.textContent)&&o.appendChild(u),u=c)}a&&o.appendChild(a),i=s}return o},moveTextRangeIntoElement:function(e,t,n){if(!e||!t)return!1;var i=a.findCommonRoot(e,t);if(!i)return!1;if(t===e){var o=e.parentNode,r=e.nextSibling;return o.removeChild(e),n.appendChild(e),r?o.insertBefore(n,r):o.appendChild(n),n.hasChildNodes()}for(var s,l,u,c=[],d=0;d<i.childNodes.length;d++)if(u=i.childNodes[d],s){if(a.isDescendant(u,t,!0)){l=u;break}c.push(u)}else a.isDescendant(u,e,!0)&&(s=u);var h=l.nextSibling,f=i.ownerDocument.createDocumentFragment();return s===e?(s.parentNode.removeChild(s),f.appendChild(s)):f.appendChild(a.splitOffDOMTree(s,e)),c.forEach((function(e){e.parentNode.removeChild(e),f.appendChild(e)})),l===t?(l.parentNode.removeChild(l),f.appendChild(l)):f.appendChild(a.splitOffDOMTree(l,t,!0)),n.appendChild(f),l.parentNode===i?i.insertBefore(n,l):h?i.insertBefore(n,h):i.appendChild(n),n.hasChildNodes()},depthOfNode:function(e){for(var t=0,n=e;null!==n.parentNode;)n=n.parentNode,t++;return t},findCommonRoot:function(e,t){for(var n=a.depthOfNode(e),i=a.depthOfNode(t),o=e,r=t;n!==i;)n>i?(o=o.parentNode,n-=1):(r=r.parentNode,i-=1);for(;o!==r;)o=o.parentNode,r=r.parentNode;return o},isElementAtBeginningOfBlock:function(e){for(var t;!a.isBlockContainer(e)&&!a.isMediumEditorElement(e);){for(t=e;t=t.previousSibling;)if((3===t.nodeType?t.nodeValue:t.textContent).length>0)return!1;e=e.parentNode}return!0},isMediumEditorElement:function(e){return e&&e.getAttribute&&!!e.getAttribute("data-medium-editor-element")},getContainerEditorElement:function(e){return a.traverseUp(e,(function(e){return a.isMediumEditorElement(e)}))},isBlockContainer:function(e){return e&&3!==e.nodeType&&-1!==a.blockContainerElementNames.indexOf(e.nodeName.toLowerCase())},getClosestBlockContainer:function(e){return a.traverseUp(e,(function(e){return a.isBlockContainer(e)||a.isMediumEditorElement(e)}))},getTopBlockContainer:function(e){var t=!!a.isBlockContainer(e)&&e;return a.traverseUp(e,(function(e){return a.isBlockContainer(e)&&(t=e),!(t||!a.isMediumEditorElement(e))&&(t=e,!0)})),t},getFirstSelectableLeafNode:function(e){for(;e&&e.firstChild;)e=e.firstChild;if("table"===(e=a.traverseUp(e,(function(e){return-1===a.emptyElementNames.indexOf(e.nodeName.toLowerCase())}))).nodeName.toLowerCase()){var t=e.querySelector("th, td");t&&(e=t)}return e},getFirstTextNode:function(e){return a.warn("getFirstTextNode is deprecated and will be removed in version 6.0.0"),a._getFirstTextNode(e)},_getFirstTextNode:function(e){if(3===e.nodeType)return e;for(var t=0;t<e.childNodes.length;t++){var n=a._getFirstTextNode(e.childNodes[t]);if(null!==n)return n}return null},ensureUrlHasProtocol:function(e){return-1===e.indexOf("://")?"http://"+e:e},warn:function(){void 0!==t.console&&"function"==typeof t.console.warn&&t.console.warn.apply(t.console,arguments)},deprecated:function(e,t,n){var i=e+" is deprecated, please use "+t+" instead.";n&&(i+=" Will be removed in "+n),a.warn(i)},deprecatedMethod:function(e,t,n,i){a.deprecated(e,t,i),"function"==typeof this[t]&&this[t].apply(this,n)},cleanupAttrs:function(e,t){t.forEach((function(t){e.removeAttribute(t)}))},cleanupTags:function(e,t){-1!==t.indexOf(e.nodeName.toLowerCase())&&e.parentNode.removeChild(e)},unwrapTags:function(t,n){-1!==n.indexOf(t.nodeName.toLowerCase())&&e.util.unwrap(t,document)},getClosestTag:function(e,t){return a.traverseUp(e,(function(e){return e.nodeName.toLowerCase()===t.toLowerCase()}))},unwrap:function(e,t){for(var n=t.createDocumentFragment(),i=Array.prototype.slice.call(e.childNodes),o=0;o<i.length;o++)n.appendChild(i[o]);n.childNodes.length?e.parentNode.replaceChild(n,e):e.parentNode.removeChild(e)},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}};e.util=a}(window),(t=function(t){e.util.extend(this,t)}).extend=function(t){var n,i=this;n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},e.util.extend(n,i);var o=function(){this.constructor=n};return o.prototype=i.prototype,n.prototype=new o,t&&e.util.extend(n.prototype,t),n},t.prototype={init:function(){},base:void 0,name:void 0,checkState:void 0,destroy:void 0,queryCommandState:void 0,isActive:void 0,isAlreadyApplied:void 0,setActive:void 0,setInactive:void 0,getInteractionElements:void 0,window:void 0,document:void 0,getEditorElements:function(){return this.base.elements},getEditorId:function(){return this.base.id},getEditorOption:function(e){return this.base.options[e]}},["execAction","on","off","subscribe","trigger"].forEach((function(e){t.prototype[e]=function(){return this.base[e].apply(this.base,arguments)}})),e.Extension=t,function(){function t(t){return e.util.isBlockContainer(t)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}var n={findMatchingSelectionParent:function(t,n){var i,o=n.getSelection();return 0!==o.rangeCount&&(i=o.getRangeAt(0).commonAncestorContainer,e.util.traverseUp(i,t))},getSelectionElement:function(t){return this.findMatchingSelectionParent((function(t){return e.util.isMediumEditorElement(t)}),t)},exportSelection:function(e,t){if(!e)return null;var n=null,i=t.getSelection();if(i.rangeCount>0){var o,r=i.getRangeAt(0),a=r.cloneRange();a.selectNodeContents(e),a.setEnd(r.startContainer,r.startOffset),n={start:o=a.toString().length,end:o+r.toString().length},this.doesRangeStartWithImages(r,t)&&(n.startsWithImage=!0);var s=this.getTrailingImageCount(e,n,r.endContainer,r.endOffset);if(s&&(n.trailingImageCount=s),0!==o){var l=this.getIndexRelativeToAdjacentEmptyBlocks(t,e,r.startContainer,r.startOffset);-1!==l&&(n.emptyBlocksIndex=l)}}return n},importSelection:function(e,t,n,i){if(e&&t){var o=n.createRange();o.setStart(t,0),o.collapse(!0);var r,a=t,s=[],l=0,u=!1,c=!1,d=0,h=!1,f=!1,p=null;for((i||e.startsWithImage||void 0!==e.emptyBlocksIndex)&&(f=!0);!h&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||c){if(e.trailingImageCount&&c&&("img"===a.nodeName.toLowerCase()&&d++,d===e.trailingImageCount)){for(var g=0;a.parentNode.childNodes[g]!==a;)g++;o.setEnd(a.parentNode,g+1),h=!0}if(!h&&1===a.nodeType)for(var v=a.childNodes.length-1;v>=0;)s.push(a.childNodes[v]),v-=1}else r=l+a.length,!u&&e.start>=l&&e.start<=r&&(f||e.start<r?(o.setStart(a,e.start-l),u=!0):p=a),u&&e.end>=l&&e.end<=r&&(e.trailingImageCount?c=!0:(o.setEnd(a,e.end-l),h=!0)),l=r;h||(a=s.pop())}!u&&p&&(o.setStart(p,p.length),o.setEnd(p,p.length)),void 0!==e.emptyBlocksIndex&&(o=this.importSelectionMoveCursorPastBlocks(n,t,e.emptyBlocksIndex,o)),i&&(o=this.importSelectionMoveCursorPastAnchor(e,o)),this.selectRange(n,o)}},importSelectionMoveCursorPastAnchor:function(t,n){if(t.start===t.end&&3===n.startContainer.nodeType&&n.startOffset===n.startContainer.nodeValue.length&&e.util.traverseUp(n.startContainer,(function(e){return"a"===e.nodeName.toLowerCase()}))){for(var i=n.startContainer,o=n.startContainer.parentNode;null!==o&&"a"!==o.nodeName.toLowerCase();)o.childNodes[o.childNodes.length-1]!==i?o=null:(i=o,o=o.parentNode);if(null!==o&&"a"===o.nodeName.toLowerCase()){for(var r=null,a=0;null===r&&a<o.parentNode.childNodes.length;a++)o.parentNode.childNodes[a]===o&&(r=a);n.setStart(o.parentNode,r+1),n.collapse(!0)}}return n},importSelectionMoveCursorPastBlocks:function(n,i,o,r){var a,s,l=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),u=r.startContainer,c=0;for(o=o||1,a=3===u.nodeType&&e.util.isBlockContainer(u.previousSibling)?u.previousSibling:e.util.getClosestBlockContainer(u);l.nextNode();)if(s){if(s=l.currentNode,++c===o)break;if(s.textContent.length>0)break}else a===l.currentNode&&(s=l.currentNode);return s||(s=a),r.setStart(e.util.getFirstSelectableLeafNode(s),0),r},getIndexRelativeToAdjacentEmptyBlocks:function(n,i,o,r){if(o.textContent.length>0&&r>0)return-1;var a=o;if(3!==a.nodeType&&(a=o.childNodes[r]),a){if(!e.util.isElementAtBeginningOfBlock(a))return-1;var s=e.util.findPreviousSibling(a);if(!s)return-1;if(s.nodeValue)return-1}for(var l=e.util.getClosestBlockContainer(o),u=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),c=0;u.nextNode();){var d=""===u.currentNode.textContent;if((d||c>0)&&(c+=1),u.currentNode===l)return c;d||(c=0)}return c},doesRangeStartWithImages:function(e,t){if(0!==e.startOffset||1!==e.startContainer.nodeType)return!1;if("img"===e.startContainer.nodeName.toLowerCase())return!0;var n=e.startContainer.querySelector("img");if(!n)return!1;for(var i=t.createTreeWalker(e.startContainer,NodeFilter.SHOW_ALL,null,!1);i.nextNode();){var o=i.currentNode;if(o===n)break;if(o.nodeValue)return!1}return!0},getTrailingImageCount:function(e,t,n,i){if(0===i||1!==n.nodeType)return 0;if("img"!==n.nodeName.toLowerCase()&&!n.querySelector("img"))return 0;for(var o=n.childNodes[i-1];o.hasChildNodes();)o=o.lastChild;for(var r,a=e,s=[],l=0,u=!1,c=!1,d=!1,h=0;!d&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||c){if("img"===a.nodeName.toLowerCase()&&h++,a===o)d=!0;else if(1===a.nodeType)for(var f=a.childNodes.length-1;f>=0;)s.push(a.childNodes[f]),f-=1}else h=0,r=l+a.length,!u&&t.start>=l&&t.start<=r&&(u=!0),u&&t.end>=l&&t.end<=r&&(c=!0),l=r;d||(a=s.pop())}return h},selectionContainsContent:function(e){var t=e.getSelection();if(!t||t.isCollapsed||!t.rangeCount)return!1;if(""!==t.toString().trim())return!0;var n=this.getSelectedParentElement(t.getRangeAt(0));return!(!n||!("img"===n.nodeName.toLowerCase()||1===n.nodeType&&n.querySelector("img")))},selectionInContentEditableFalse:function(e){var t,n=this.findMatchingSelectionParent((function(e){var n=e&&e.getAttribute("contenteditable");return"true"===n&&(t=!0),"#text"!==e.nodeName&&"false"===n}),e);return!t&&n},getSelectionHtml:function(e){var t,n,i,o="",r=e.getSelection();if(r.rangeCount){for(i=e.createElement("div"),t=0,n=r.rangeCount;t<n;t+=1)i.appendChild(r.getRangeAt(t).cloneContents());o=i.innerHTML}return o},getCaretOffsets:function(e,t){var n,i;return t||(t=window.getSelection().getRangeAt(0)),n=t.cloneRange(),i=t.cloneRange(),n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset),i.selectNodeContents(e),i.setStart(t.endContainer,t.endOffset),{left:n.toString().length,right:i.toString().length}},rangeSelectsSingleNode:function(e){var t=e.startContainer;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===e.startOffset+1},getSelectedParentElement:function(e){return e?this.rangeSelectsSingleNode(e)&&3!==e.startContainer.childNodes[e.startOffset].nodeType?e.startContainer.childNodes[e.startOffset]:3===e.startContainer.nodeType?e.startContainer.parentNode:e.startContainer:null},getSelectedElements:function(e){var t,n,i,o=e.getSelection();if(!o.rangeCount||o.isCollapsed||!o.getRangeAt(0).commonAncestorContainer)return[];if(3===(t=o.getRangeAt(0)).commonAncestorContainer.nodeType){for(n=[],i=t.commonAncestorContainer;i.parentNode&&1===i.parentNode.childNodes.length;)n.push(i.parentNode),i=i.parentNode;return n}return[].filter.call(t.commonAncestorContainer.getElementsByTagName("*"),(function(e){return"function"!=typeof o.containsNode||o.containsNode(e,!0)}))},selectNode:function(e,t){var n=t.createRange();n.selectNodeContents(e),this.selectRange(t,n)},select:function(e,t,n,i,o){var r=e.createRange();return r.setStart(t,n),i?r.setEnd(i,o):r.collapse(!0),this.selectRange(e,r),r},clearSelection:function(e,t){t?e.getSelection().collapseToStart():e.getSelection().collapseToEnd()},moveCursor:function(e,t,n){this.select(e,t,n)},getSelectionRange:function(e){var t=e.getSelection();return 0===t.rangeCount?null:t.getRangeAt(0)},selectRange:function(e,t){var n=e.getSelection();n.removeAllRanges(),n.addRange(t)},getSelectionStart:function(e){var t=e.getSelection().anchorNode;return t&&3===t.nodeType?t.parentNode:t}};e.selection=n}(),function(){function t(t,n){return!!t&&t.some((function(t){if("function"!=typeof t.getInteractionElements)return!1;var i=t.getInteractionElements();return!!i&&(Array.isArray(i)||(i=[i]),i.some((function(t){return e.util.isDescendant(t,n,!0)})))}))}var n=function(e){this.base=e,this.options=this.base.options,this.events=[],this.disabledEvents={},this.customEvents={},this.listeners={}};n.prototype={InputEventOnContenteditableSupported:!e.util.isIE&&!e.util.isEdge,attachDOMEvent:function(t,n,i,o){var r=this.base.options.contentWindow,a=this.base.options.ownerDocument;t=e.util.isElement(t)||[r,a].indexOf(t)>-1?[t]:t,Array.prototype.forEach.call(t,function(e){e.addEventListener(n,i,o),this.events.push([e,n,i,o])}.bind(this))},detachDOMEvent:function(t,n,i,o){var r,a,s=this.base.options.contentWindow,l=this.base.options.ownerDocument;t&&(t=e.util.isElement(t)||[s,l].indexOf(t)>-1?[t]:t,Array.prototype.forEach.call(t,function(e){-1!==(r=this.indexOfListener(e,n,i,o))&&(a=this.events.splice(r,1)[0])[0].removeEventListener(a[1],a[2],a[3])}.bind(this)))},indexOfListener:function(e,t,n,i){var o,r,a;for(o=0,r=this.events.length;o<r;o+=1)if((a=this.events[o])[0]===e&&a[1]===t&&a[2]===n&&a[3]===i)return o;return-1},detachAllDOMEvents:function(){for(var e=this.events.pop();e;)e[0].removeEventListener(e[1],e[2],e[3]),e=this.events.pop()},detachAllEventsFromElement:function(e){for(var t=this.events.filter((function(t){return t&&t[0].getAttribute&&t[0].getAttribute("medium-editor-index")===e.getAttribute("medium-editor-index")})),n=0,i=t.length;n<i;n++){var o=t[n];this.detachDOMEvent(o[0],o[1],o[2],o[3])}},attachAllEventsToElement:function(e){this.listeners.editableInput&&(this.contentCache[e.getAttribute("medium-editor-index")]=e.innerHTML),this.eventsCache&&this.eventsCache.forEach((function(t){this.attachDOMEvent(e,t.name,t.handler.bind(this))}),this)},enableCustomEvent:function(e){void 0!==this.disabledEvents[e]&&delete this.disabledEvents[e]},disableCustomEvent:function(e){this.disabledEvents[e]=!0},attachCustomEvent:function(e,t){this.setupListener(e),this.customEvents[e]||(this.customEvents[e]=[]),this.customEvents[e].push(t)},detachCustomEvent:function(e,t){var n=this.indexOfCustomListener(e,t);-1!==n&&this.customEvents[e].splice(n,1)},indexOfCustomListener:function(e,t){return this.customEvents[e]&&this.customEvents[e].length?this.customEvents[e].indexOf(t):-1},detachAllCustomEvents:function(){this.customEvents={}},triggerCustomEvent:function(e,t,n){this.customEvents[e]&&!this.disabledEvents[e]&&this.customEvents[e].forEach((function(e){e(t,n)}))},destroy:function(){this.detachAllDOMEvents(),this.detachAllCustomEvents(),this.detachExecCommand(),this.base.elements&&this.base.elements.forEach((function(e){e.removeAttribute("data-medium-focused")}))},attachToExecCommand:function(){this.execCommandListener||(this.execCommandListener=function(e){this.handleDocumentExecCommand(e)}.bind(this),this.wrapExecCommand(),this.options.ownerDocument.execCommand.listeners.push(this.execCommandListener))},detachExecCommand:function(){var e=this.options.ownerDocument;if(this.execCommandListener&&e.execCommand.listeners){var t=e.execCommand.listeners.indexOf(this.execCommandListener);-1!==t&&e.execCommand.listeners.splice(t,1),e.execCommand.listeners.length||this.unwrapExecCommand()}},wrapExecCommand:function(){var e=this.options.ownerDocument;if(!e.execCommand.listeners){var t=function(t,n){e.execCommand.listeners&&e.execCommand.listeners.forEach((function(e){e({command:t[0],value:t[2],args:t,result:n})}))},n=function(){var n=e.execCommand.orig.apply(this,arguments);if(!e.execCommand.listeners)return n;var i=Array.prototype.slice.call(arguments);return t(i,n),n};n.orig=e.execCommand,n.listeners=[],n.callListeners=t,e.execCommand=n}},unwrapExecCommand:function(){var e=this.options.ownerDocument;e.execCommand.orig&&(e.execCommand=e.execCommand.orig)},setupListener:function(e){if(!this.listeners[e]){switch(e){case"externalInteraction":this.attachDOMEvent(this.options.ownerDocument.body,"mousedown",this.handleBodyMousedown.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"click",this.handleBodyClick.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"focus",this.handleBodyFocus.bind(this),!0);break;case"blur":case"focus":this.setupListener("externalInteraction");break;case"editableInput":this.contentCache={},this.base.elements.forEach((function(e){this.contentCache[e.getAttribute("medium-editor-index")]=e.innerHTML}),this),this.InputEventOnContenteditableSupported&&this.attachToEachElement("input",this.handleInput),this.InputEventOnContenteditableSupported||(this.setupListener("editableKeypress"),this.keypressUpdateInput=!0,this.attachDOMEvent(document,"selectionchange",this.handleDocumentSelectionChange.bind(this)),this.attachToExecCommand());break;case"editableClick":this.attachToEachElement("click",this.handleClick);break;case"editableBlur":this.attachToEachElement("blur",this.handleBlur);break;case"editableKeypress":this.attachToEachElement("keypress",this.handleKeypress);break;case"editableKeyup":this.attachToEachElement("keyup",this.handleKeyup);break;case"editableKeydown":this.attachToEachElement("keydown",this.handleKeydown);break;case"editableKeydownSpace":case"editableKeydownEnter":case"editableKeydownTab":case"editableKeydownDelete":this.setupListener("editableKeydown");break;case"editableMouseover":this.attachToEachElement("mouseover",this.handleMouseover);break;case"editableDrag":this.attachToEachElement("dragover",this.handleDragging),this.attachToEachElement("dragleave",this.handleDragging);break;case"editableDrop":this.attachToEachElement("drop",this.handleDrop);break;case"editablePaste":this.attachToEachElement("paste",this.handlePaste)}this.listeners[e]=!0}},attachToEachElement:function(e,t){this.eventsCache||(this.eventsCache=[]),this.base.elements.forEach((function(n){this.attachDOMEvent(n,e,t.bind(this))}),this),this.eventsCache.push({name:e,handler:t})},cleanupElement:function(e){var t=e.getAttribute("medium-editor-index");t&&(this.detachAllEventsFromElement(e),this.contentCache&&delete this.contentCache[t])},focusElement:function(e){e.focus(),this.updateFocus(e,{target:e,type:"focus"})},updateFocus:function(n,i){var o,r=this.base.getFocusedElement();r&&"click"===i.type&&this.lastMousedownTarget&&(e.util.isDescendant(r,this.lastMousedownTarget,!0)||t(this.base.extensions,this.lastMousedownTarget))&&(o=r),o||this.base.elements.some((function(t){return!o&&e.util.isDescendant(t,n,!0)&&(o=t),!!o}),this);var a=!e.util.isDescendant(r,n,!0)&&!t(this.base.extensions,n);o!==r&&(r&&a&&(r.removeAttribute("data-medium-focused"),this.triggerCustomEvent("blur",i,r)),o&&(o.setAttribute("data-medium-focused",!0),this.triggerCustomEvent("focus",i,o))),a&&this.triggerCustomEvent("externalInteraction",i)},updateInput:function(e,t){if(this.contentCache){var n=e.getAttribute("medium-editor-index"),i=e.innerHTML;i!==this.contentCache[n]&&this.triggerCustomEvent("editableInput",t,e),this.contentCache[n]=i}},handleDocumentSelectionChange:function(t){if(t.currentTarget&&t.currentTarget.activeElement){var n,i=t.currentTarget.activeElement;this.base.elements.some((function(t){return!!e.util.isDescendant(t,i,!0)&&(n=t,!0)}),this),n&&this.updateInput(n,{target:i,currentTarget:n})}},handleDocumentExecCommand:function(){var e=this.base.getFocusedElement();e&&this.updateInput(e,{target:e,currentTarget:e})},handleBodyClick:function(e){this.updateFocus(e.target,e)},handleBodyFocus:function(e){this.updateFocus(e.target,e)},handleBodyMousedown:function(e){this.lastMousedownTarget=e.target},handleInput:function(e){this.updateInput(e.currentTarget,e)},handleClick:function(e){this.triggerCustomEvent("editableClick",e,e.currentTarget)},handleBlur:function(e){this.triggerCustomEvent("editableBlur",e,e.currentTarget)},handleKeypress:function(e){if(this.triggerCustomEvent("editableKeypress",e,e.currentTarget),this.keypressUpdateInput){var t={target:e.target,currentTarget:e.currentTarget};setTimeout(function(){this.updateInput(t.currentTarget,t)}.bind(this),0)}},handleKeyup:function(e){this.triggerCustomEvent("editableKeyup",e,e.currentTarget)},handleMouseover:function(e){this.triggerCustomEvent("editableMouseover",e,e.currentTarget)},handleDragging:function(e){this.triggerCustomEvent("editableDrag",e,e.currentTarget)},handleDrop:function(e){this.triggerCustomEvent("editableDrop",e,e.currentTarget)},handlePaste:function(e){this.triggerCustomEvent("editablePaste",e,e.currentTarget)},handleKeydown:function(t){return this.triggerCustomEvent("editableKeydown",t,t.currentTarget),e.util.isKey(t,e.util.keyCode.SPACE)?this.triggerCustomEvent("editableKeydownSpace",t,t.currentTarget):e.util.isKey(t,e.util.keyCode.ENTER)||t.ctrlKey&&e.util.isKey(t,e.util.keyCode.M)?this.triggerCustomEvent("editableKeydownEnter",t,t.currentTarget):e.util.isKey(t,e.util.keyCode.TAB)?this.triggerCustomEvent("editableKeydownTab",t,t.currentTarget):e.util.isKey(t,[e.util.keyCode.DELETE,e.util.keyCode.BACKSPACE])?this.triggerCustomEvent("editableKeydownDelete",t,t.currentTarget):void 0}},e.Events=n}(),n=e.Extension.extend({action:void 0,aria:void 0,tagNames:void 0,style:void 0,useQueryState:void 0,contentDefault:void 0,contentFA:void 0,classList:void 0,attrs:void 0,constructor:function(t){n.isBuiltInButton(t)?e.Extension.call(this,this.defaults[t]):e.Extension.call(this,t)},init:function(){e.Extension.prototype.init.apply(this,arguments),this.button=this.createButton(),this.on(this.button,"click",this.handleClick.bind(this))},getButton:function(){return this.button},getAction:function(){return"function"==typeof this.action?this.action(this.base.options):this.action},getAria:function(){return"function"==typeof this.aria?this.aria(this.base.options):this.aria},getTagNames:function(){return"function"==typeof this.tagNames?this.tagNames(this.base.options):this.tagNames},createButton:function(){var e=this.document.createElement("button"),t=this.contentDefault,n=this.getAria(),i=this.getEditorOption("buttonLabels");return e.classList.add("medium-editor-action"),e.classList.add("medium-editor-action-"+this.name),this.classList&&this.classList.forEach((function(t){e.classList.add(t)})),e.setAttribute("data-action",this.getAction()),n&&(e.setAttribute("title",n),e.setAttribute("aria-label",n)),this.attrs&&Object.keys(this.attrs).forEach((function(t){e.setAttribute(t,this.attrs[t])}),this),"fontawesome"===i&&this.contentFA&&(t=this.contentFA),e.innerHTML=t,e},handleClick:function(e){e.preventDefault(),e.stopPropagation();var t=this.getAction();t&&this.execAction(t)},isActive:function(){return this.button.classList.contains(this.getEditorOption("activeButtonClass"))},setInactive:function(){this.button.classList.remove(this.getEditorOption("activeButtonClass")),delete this.knownState},setActive:function(){this.button.classList.add(this.getEditorOption("activeButtonClass")),delete this.knownState},queryCommandState:function(){var e=null;return this.useQueryState&&(e=this.base.queryCommandState(this.getAction())),e},isAlreadyApplied:function(e){var t,n,i=!1,o=this.getTagNames();return!1===this.knownState||!0===this.knownState?this.knownState:(o&&o.length>0&&(i=-1!==o.indexOf(e.nodeName.toLowerCase())),!i&&this.style&&(t=this.style.value.split("|"),n=this.window.getComputedStyle(e,null).getPropertyValue(this.style.prop),t.forEach((function(e){this.knownState||((i=-1!==n.indexOf(e))||"text-decoration"!==this.style.prop)&&(this.knownState=i)}),this)),i)}}),n.isBuiltInButton=function(t){return"string"==typeof t&&e.extensions.button.prototype.defaults.hasOwnProperty(t)},e.extensions.button=n,e.extensions.button.prototype.defaults={bold:{name:"bold",action:"bold",aria:"bold",tagNames:["b","strong"],style:{prop:"font-weight",value:"700|bold"},useQueryState:!0,contentDefault:"<b>B</b>",contentFA:'<i class="fa fa-bold"></i>'},italic:{name:"italic",action:"italic",aria:"italic",tagNames:["i","em"],style:{prop:"font-style",value:"italic"},useQueryState:!0,contentDefault:"<b><i>I</i></b>",contentFA:'<i class="fa fa-italic"></i>'},underline:{name:"underline",action:"underline",aria:"underline",tagNames:["u"],style:{prop:"text-decoration",value:"underline"},useQueryState:!0,contentDefault:"<b><u>U</u></b>",contentFA:'<i class="fa fa-underline"></i>'},strikethrough:{name:"strikethrough",action:"strikethrough",aria:"strike through",tagNames:["strike"],style:{prop:"text-decoration",value:"line-through"},useQueryState:!0,contentDefault:"<s>A</s>",contentFA:'<i class="fa fa-strikethrough"></i>'},superscript:{name:"superscript",action:"superscript",aria:"superscript",tagNames:["sup"],contentDefault:"<b>x<sup>1</sup></b>",contentFA:'<i class="fa fa-superscript"></i>'},subscript:{name:"subscript",action:"subscript",aria:"subscript",tagNames:["sub"],contentDefault:"<b>x<sub>1</sub></b>",contentFA:'<i class="fa fa-subscript"></i>'},image:{name:"image",action:"image",aria:"image",tagNames:["img"],contentDefault:"<b>image</b>",contentFA:'<i class="fa fa-picture-o"></i>'},html:{name:"html",action:"html",aria:"evaluate html",tagNames:["iframe","object"],contentDefault:"<b>html</b>",contentFA:'<i class="fa fa-code"></i>'},orderedlist:{name:"orderedlist",action:"insertorderedlist",aria:"ordered list",tagNames:["ol"],useQueryState:!0,contentDefault:"<b>1.</b>",contentFA:'<i class="fa fa-list-ol"></i>'},unorderedlist:{name:"unorderedlist",action:"insertunorderedlist",aria:"unordered list",tagNames:["ul"],useQueryState:!0,contentDefault:"<b>&bull;</b>",contentFA:'<i class="fa fa-list-ul"></i>'},indent:{name:"indent",action:"indent",aria:"indent",tagNames:[],contentDefault:"<b>&rarr;</b>",contentFA:'<i class="fa fa-indent"></i>'},outdent:{name:"outdent",action:"outdent",aria:"outdent",tagNames:[],contentDefault:"<b>&larr;</b>",contentFA:'<i class="fa fa-outdent"></i>'},justifyCenter:{name:"justifyCenter",action:"justifyCenter",aria:"center justify",tagNames:[],style:{prop:"text-align",value:"center"},contentDefault:"<b>C</b>",contentFA:'<i class="fa fa-align-center"></i>'},justifyFull:{name:"justifyFull",action:"justifyFull",aria:"full justify",tagNames:[],style:{prop:"text-align",value:"justify"},contentDefault:"<b>J</b>",contentFA:'<i class="fa fa-align-justify"></i>'},justifyLeft:{name:"justifyLeft",action:"justifyLeft",aria:"left justify",tagNames:[],style:{prop:"text-align",value:"left"},contentDefault:"<b>L</b>",contentFA:'<i class="fa fa-align-left"></i>'},justifyRight:{name:"justifyRight",action:"justifyRight",aria:"right justify",tagNames:[],style:{prop:"text-align",value:"right"},contentDefault:"<b>R</b>",contentFA:'<i class="fa fa-align-right"></i>'},removeFormat:{name:"removeFormat",aria:"remove formatting",action:"removeFormat",contentDefault:"<b>X</b>",contentFA:'<i class="fa fa-eraser"></i>'},quote:{name:"quote",action:"append-blockquote",aria:"blockquote",tagNames:["blockquote"],contentDefault:"<b>&ldquo;</b>",contentFA:'<i class="fa fa-quote-right"></i>'},pre:{name:"pre",action:"append-pre",aria:"preformatted text",tagNames:["pre"],contentDefault:"<b>0101</b>",contentFA:'<i class="fa fa-code fa-lg"></i>'},h1:{name:"h1",action:"append-h1",aria:"header type one",tagNames:["h1"],contentDefault:"<b>H1</b>",contentFA:'<i class="fa fa-header"><sup>1</sup>'},h2:{name:"h2",action:"append-h2",aria:"header type two",tagNames:["h2"],contentDefault:"<b>H2</b>",contentFA:'<i class="fa fa-header"><sup>2</sup>'},h3:{name:"h3",action:"append-h3",aria:"header type three",tagNames:["h3"],contentDefault:"<b>H3</b>",contentFA:'<i class="fa fa-header"><sup>3</sup>'},h4:{name:"h4",action:"append-h4",aria:"header type four",tagNames:["h4"],contentDefault:"<b>H4</b>",contentFA:'<i class="fa fa-header"><sup>4</sup>'},h5:{name:"h5",action:"append-h5",aria:"header type five",tagNames:["h5"],contentDefault:"<b>H5</b>",contentFA:'<i class="fa fa-header"><sup>5</sup>'},h6:{name:"h6",action:"append-h6",aria:"header type six",tagNames:["h6"],contentDefault:"<b>H6</b>",contentFA:'<i class="fa fa-header"><sup>6</sup>'}},i=e.extensions.button.extend({init:function(){e.extensions.button.prototype.init.apply(this,arguments)},formSaveLabel:"&#10003;",formCloseLabel:"&times;",activeClass:"medium-editor-toolbar-form-active",hasForm:!0,getForm:function(){},isDisplayed:function(){return!!this.hasForm&&this.getForm().classList.contains(this.activeClass)},showForm:function(){this.hasForm&&this.getForm().classList.add(this.activeClass)},hideForm:function(){this.hasForm&&this.getForm().classList.remove(this.activeClass)},showToolbarDefaultActions:function(){var e=this.base.getExtensionByName("toolbar");e&&e.showToolbarDefaultActions()},hideToolbarDefaultActions:function(){var e=this.base.getExtensionByName("toolbar");e&&e.hideToolbarDefaultActions()},setToolbarPosition:function(){var e=this.base.getExtensionByName("toolbar");e&&e.setToolbarPosition()}}),e.extensions.form=i,o=e.extensions.form.extend({customClassOption:null,customClassOptionText:"Button",linkValidation:!1,placeholderText:"Paste or type a link",targetCheckbox:!1,targetCheckboxText:"Open in new window",name:"anchor",action:"createLink",aria:"link",tagNames:["a"],contentDefault:"<b>#</b>",contentFA:'<i class="fa fa-link"></i>',init:function(){e.extensions.form.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this))},handleClick:function(t){t.preventDefault(),t.stopPropagation();var n=e.selection.getSelectionRange(this.document);return"a"===n.startContainer.nodeName.toLowerCase()||"a"===n.endContainer.nodeName.toLowerCase()||e.util.getClosestTag(e.selection.getSelectedParentElement(n),"a")?this.execAction("unlink"):(this.isDisplayed()||this.showForm(),!1)},handleKeydown:function(t){e.util.isKey(t,e.util.keyCode.K)&&e.util.isMetaCtrlKey(t)&&!t.shiftKey&&this.handleClick(t)},getForm:function(){return this.form||(this.form=this.createForm()),this.form},getTemplate:function(){var e=['<input type="text" class="medium-editor-toolbar-input" placeholder="',this.placeholderText,'">'];return e.push('<a href="#" class="medium-editor-toolbar-save">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':this.formSaveLabel,"</a>"),e.push('<a href="#" class="medium-editor-toolbar-close">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':this.formCloseLabel,"</a>"),this.targetCheckbox&&e.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-target" id="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">','<label for="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">',this.targetCheckboxText,"</label>","</div>"),this.customClassOption&&e.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-button">',"<label>",this.customClassOptionText,"</label>","</div>"),e.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(t){var n=this.getInput(),i=this.getAnchorTargetCheckbox(),o=this.getAnchorButtonCheckbox();if("string"==typeof(t=t||{value:""})&&(t={value:t}),this.base.saveSelection(),this.hideToolbarDefaultActions(),e.extensions.form.prototype.showForm.apply(this),this.setToolbarPosition(),n.value=t.value,n.focus(),i&&(i.checked="_blank"===t.target),o){var r=t.buttonClass?t.buttonClass.split(" "):[];o.checked=-1!==r.indexOf(this.customClassOption)}},destroy:function(){if(!this.form)return!1;this.form.parentNode&&this.form.parentNode.removeChild(this.form),delete this.form},getFormOpts:function(){var e=this.getAnchorTargetCheckbox(),t=this.getAnchorButtonCheckbox(),n={value:this.getInput().value.trim()};return this.linkValidation&&(n.value=this.checkLinkFormat(n.value)),n.target="_self",e&&e.checked&&(n.target="_blank"),t&&t.checked&&(n.buttonClass=this.customClassOption),n},doFormSave:function(){var e=this.getFormOpts();this.completeFormSave(e)},completeFormSave:function(e){this.base.restoreSelection(),this.execAction(this.action,e),this.base.checkSelection()},ensureEncodedUri:function(e){return e===decodeURI(e)?encodeURI(e):e},ensureEncodedUriComponent:function(e){return e===decodeURIComponent(e)?encodeURIComponent(e):e},ensureEncodedParam:function(e){var t=e.split("="),n=t[0],i=t[1];return n+(void 0===i?"":"="+this.ensureEncodedUriComponent(i))},ensureEncodedQuery:function(e){return e.split("&").map(this.ensureEncodedParam.bind(this)).join("&")},checkLinkFormat:function(e){var t=/^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#/i.test(e),n="",i=e.match(/^(.*?)(?:\?(.*?))?(?:#(.*))?$/),o=i[1],r=i[2],a=i[3];if(/^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/.test(e))return"tel:"+e;if(!t){var s=o.split("/")[0];(s.match(/.+(\.|:).+/)||"localhost"===s)&&(n="http://")}return n+this.ensureEncodedUri(o)+(void 0===r?"":"?"+this.ensureEncodedQuery(r))+(void 0===a?"":"#"+a)},doFormCancel:function(){this.base.restoreSelection(),this.base.checkSelection()},attachFormEvents:function(e){var t=e.querySelector(".medium-editor-toolbar-close"),n=e.querySelector(".medium-editor-toolbar-save"),i=e.querySelector(".medium-editor-toolbar-input");this.on(e,"click",this.handleFormClick.bind(this)),this.on(i,"keyup",this.handleTextboxKeyup.bind(this)),this.on(t,"click",this.handleCloseClick.bind(this)),this.on(n,"click",this.handleSaveClick.bind(this),!0)},createForm:function(){var e=this.document.createElement("div");return e.className="medium-editor-toolbar-form",e.id="medium-editor-toolbar-form-anchor-"+this.getEditorId(),e.innerHTML=this.getTemplate(),this.attachFormEvents(e),e},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(t){if(t.keyCode===e.util.keyCode.ENTER)return t.preventDefault(),void this.doFormSave();t.keyCode===e.util.keyCode.ESCAPE&&(t.preventDefault(),this.doFormCancel())},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),e.extensions.anchor=o,r=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 e=this.document.createElement("div");return e.id="medium-editor-anchor-preview-"+this.getEditorId(),e.className="medium-editor-anchor-preview",e.innerHTML=this.getTemplate(),this.on(e,"click",this.handleClick.bind(this)),e},getTemplate:function(){return'<div class="medium-editor-toolbar-anchor-preview" id="medium-editor-toolbar-anchor-preview"> <a class="medium-editor-toolbar-anchor-preview-inner"></a></div>'},destroy:function(){this.anchorPreview&&(this.anchorPreview.parentNode&&this.anchorPreview.parentNode.removeChild(this.anchorPreview),delete this.anchorPreview)},hidePreview:function(){this.anchorPreview&&this.anchorPreview.classList.remove("medium-editor-anchor-preview-active"),this.activeAnchor=null},showPreview:function(e){return!(!this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")&&!e.getAttribute("data-disable-preview"))||(this.previewValueSelector&&(this.anchorPreview.querySelector(this.previewValueSelector).textContent=e.attributes.href.value,this.anchorPreview.querySelector(this.previewValueSelector).href=e.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=e,this.positionPreview(),this.attachPreviewHandlers(),this)},positionPreview:function(e){e=e||this.activeAnchor;var t,n,i,o,r,a=this.window.innerWidth,s=this.anchorPreview.offsetHeight,l=e.getBoundingClientRect(),u=this.diffLeft,c=this.diffTop,d=this.getEditorOption("elementsContainer"),h=["absolute","fixed"].indexOf(window.getComputedStyle(d).getPropertyValue("position"))>-1,f={};t=this.anchorPreview.offsetWidth/2;var p=this.base.getExtensionByName("toolbar");p&&(u=p.diffLeft,c=p.diffTop),n=u-t,h?(o=d.getBoundingClientRect(),["top","left"].forEach((function(e){f[e]=l[e]-o[e]})),f.width=l.width,f.height=l.height,l=f,a=o.width,r=d.scrollTop):r=this.window.pageYOffset,i=l.left+l.width/2,r+=s+l.top+l.height-c-this.anchorPreview.offsetHeight,this.anchorPreview.style.top=Math.round(r)+"px",this.anchorPreview.style.right="initial",i<t?(this.anchorPreview.style.left=n+t+"px",this.anchorPreview.style.right="initial"):a-i<t?(this.anchorPreview.style.left="auto",this.anchorPreview.style.right=0):(this.anchorPreview.style.left=n+i+"px",this.anchorPreview.style.right="initial")},attachToEditables:function(){this.subscribe("editableMouseover",this.handleEditableMouseover.bind(this)),this.subscribe("positionedToolbar",this.handlePositionedToolbar.bind(this))},handlePositionedToolbar:function(){this.showWhenToolbarIsVisible||this.hidePreview()},handleClick:function(e){var t=this.base.getExtensionByName("anchor"),n=this.activeAnchor;t&&n&&(e.preventDefault(),this.base.selectElement(this.activeAnchor),this.base.delay(function(){if(n){var e={value:n.attributes.href.value,target:n.getAttribute("target"),buttonClass:n.getAttribute("class")};t.showForm(e),n=null}}.bind(this))),this.hidePreview()},handleAnchorMouseout:function(){this.anchorToPreview=null,this.off(this.activeAnchor,"mouseout",this.instanceHandleAnchorMouseout),this.instanceHandleAnchorMouseout=null},handleEditableMouseover:function(t){var n=e.util.getClosestTag(t.target,"a");if(!1!==n){if(!this.showOnEmptyLinks&&(!/href=["']\S+["']/.test(n.outerHTML)||/href=["']#\S+["']/.test(n.outerHTML)))return!0;var i=this.base.getExtensionByName("toolbar");if(!this.showWhenToolbarIsVisible&&i&&i.isDisplayed&&i.isDisplayed())return!0;this.activeAnchor&&this.activeAnchor!==n&&this.detachPreviewHandlers(),this.anchorToPreview=n,this.instanceHandleAnchorMouseout=this.handleAnchorMouseout.bind(this),this.on(this.anchorToPreview,"mouseout",this.instanceHandleAnchorMouseout),this.base.delay(function(){this.anchorToPreview&&this.showPreview(this.anchorToPreview)}.bind(this))}},handlePreviewMouseover:function(){this.lastOver=(new Date).getTime(),this.hovering=!0},handlePreviewMouseout:function(e){e.relatedTarget&&/anchor-preview/.test(e.relatedTarget.className)||(this.hovering=!1)},updatePreview:function(){if(this.hovering)return!0;(new Date).getTime()-this.lastOver>this.hideDelay&&this.detachPreviewHandlers()},detachPreviewHandlers:function(){clearInterval(this.intervalTimer),this.instanceHandlePreviewMouseover&&(this.off(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.activeAnchor&&(this.off(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout))),this.hidePreview(),this.hovering=this.instanceHandlePreviewMouseover=this.instanceHandlePreviewMouseout=null},attachPreviewHandlers:function(){this.lastOver=(new Date).getTime(),this.hovering=!0,this.instanceHandlePreviewMouseover=this.handlePreviewMouseover.bind(this),this.instanceHandlePreviewMouseout=this.handlePreviewMouseout.bind(this),this.intervalTimer=setInterval(this.updatePreview.bind(this),200),this.on(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.on(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout)}}),e.extensions.anchorPreview=r,function(){var t,n,i,o,r;function a(t){return!e.util.getClosestTag(t,"a")}t=[" ","\t","\n","\r"," "," "," "," "," ","\u2028","\u2029"],i="(((?:(https?://|ftps?://|nntp://)|www\\d{0,3}[.]|[a-z0-9.\\-]+[.]("+(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")+")\\/)\\S+(?:[^\\s`!\\[\\]{};:'\".,?«»“”‘’])))|(([a-z0-9\\-]+\\.)?[a-z0-9\\-]+\\.("+n+"))",o=new RegExp("^("+n+")$","i"),r=new RegExp(i,"gi");var s=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 e=0,t=0;t<this.window._mediumEditors.length;t++){var n=this.window._mediumEditors[t];null!==n&&void 0!==n.getExtensionByName("autoLink")&&e++}return 1===e},destroy:function(){this.document.queryCommandSupported("AutoUrlDetect")&&this.isLastInstance()&&this.document.execCommand("AutoUrlDetect",!1,!0)},onBlur:function(e,t){this.performLinking(t)},onKeypress:function(t){this.disableEventHandling||e.util.isKey(t,[e.util.keyCode.SPACE,e.util.keyCode.ENTER])&&(clearTimeout(this.performLinkingTimeout),this.performLinkingTimeout=setTimeout(function(){try{var e=this.base.exportSelection();this.performLinking(t.target)&&this.base.importSelection(e,!0)}catch(e){window.console&&window.console.error("Failed to perform linking",e),this.disableEventHandling=!0}}.bind(this),0))},performLinking:function(t){var n=e.util.splitByBlockElements(t),i=!1;0===n.length&&(n=[t]);for(var o=0;o<n.length;o++)i=this.removeObsoleteAutoLinkSpans(n[o])||i,i=this.performLinkingWithinElement(n[o])||i;return this.base.events.updateInput(t,{target:t,currentTarget:t}),i},removeObsoleteAutoLinkSpans:function(t){if(!t||3===t.nodeType)return!1;for(var n=t.querySelectorAll('span[data-auto-link="true"]'),i=!1,o=0;o<n.length;o++){var r=n[o].textContent;if(-1===r.indexOf("://")&&(r=e.util.ensureUrlHasProtocol(r)),n[o].getAttribute("data-href")!==r&&a(n[o])){i=!0;var s=r.replace(/\s+$/,"");if(n[o].getAttribute("data-href")===s){var l=r.length-s.length,u=e.util.splitOffDOMTree(n[o],this.splitTextBeforeEnd(n[o],l));n[o].parentNode.insertBefore(u,n[o].nextSibling)}else e.util.unwrap(n[o],this.document)}}return i},splitTextBeforeEnd:function(e,t){for(var n,i,o,r=this.document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),a=!0;a;)a=null!==r.lastChild();for(;t>0&&null!==o;)(i=(n=r.currentNode).nodeValue).length>t?(o=n.splitText(i.length-t),t=0):(o=r.previousNode(),t-=i.length);return o},performLinkingWithinElement:function(t){for(var n=this.findLinkableText(t),i=0;i<n.length;i++){var o=e.util.findOrCreateMatchingTextNodes(this.document,t,n[i]);this.shouldNotLink(o)||this.createAutoLink(o,n[i].href)}return!1},shouldNotLink:function(t){for(var n=!1,i=0;i<t.length&&!1===n;i++)n=!!e.util.traverseUp(t[i],(function(e){return"a"===e.nodeName.toLowerCase()||e.getAttribute&&"true"===e.getAttribute("data-auto-link")}));return n},findLinkableText:function(e){for(var n=e.textContent,i=null,a=[];null!==(i=r.exec(n));){var s=i.index+i[0].length;!(0!==i.index&&-1===t.indexOf(n[i.index-1])||s!==n.length&&-1===t.indexOf(n[s]))&&(-1!==i[0].indexOf("/")||o.test(i[0].split(".").pop().split("?").shift()))&&a.push({href:i[0],start:i.index,end:s})}return a},createAutoLink:function(t,n){n=e.util.ensureUrlHasProtocol(n);var i=e.util.createLink(this.document,t,n,this.getEditorOption("targetBlank")?"_blank":null),o=this.document.createElement("span");for(o.setAttribute("data-auto-link","true"),o.setAttribute("data-href",n),i.insertBefore(o,i.firstChild);i.childNodes.length>1;)o.appendChild(i.childNodes[1])}});e.extensions.autoLink=s}(),function(){var t="medium-editor-dragover";function n(n){var i=e.util.getContainerEditorElement(n);Array.prototype.slice.call(i.parentElement.querySelectorAll("."+t)).forEach((function(e){e.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(e){e.preventDefault(),e.dataTransfer.dropEffect="copy";var i=e.target.classList?e.target:e.target.parentElement;n(i),"dragover"===e.type&&i.classList.add(t)},handleDrop:function(e){e.preventDefault(),e.stopPropagation(),this.base.selectElement(e.target);var t=this.base.exportSelection();t.start=t.end,this.base.importSelection(t),e.dataTransfer.files&&Array.prototype.slice.call(e.dataTransfer.files).forEach((function(e){this.isAllowedFile(e)&&e.type.match("image")&&this.insertImageFile(e)}),this),n(e.target)},isAllowedFile:function(e){return this.allowedTypes.some((function(t){return!!e.type.match(t)}))},insertImageFile:function(t){if("function"==typeof FileReader){var n=new FileReader;n.readAsDataURL(t),n.addEventListener("load",function(t){var n=this.document.createElement("img");n.src=t.target.result,e.util.insertHTMLCommand(this.document,n.outerHTML)}.bind(this))}}});e.extensions.fileDragging=i}(),a=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(e){var t=e.key.charCodeAt(0);this.keys[t]||(this.keys[t]=[]),this.keys[t].push(e)}),this)},handleKeydown:function(t){var n=e.util.getKeyCode(t);if(this.keys[n]){var i=e.util.isMetaCtrlKey(t),o=!!t.shiftKey,r=!!t.altKey;this.keys[n].forEach((function(e){e.meta!==i||e.shift!==o||e.alt!==r&&void 0!==e.alt||(t.preventDefault(),t.stopPropagation(),"function"==typeof e.command?e.command.apply(this):!1!==e.command&&this.execAction(e.command))}),this)}}}),e.extensions.keyboardCommands=a,s=e.extensions.form.extend({name:"fontname",action:"fontName",aria:"change font name",contentDefault:"&#xB1;",contentFA:'<i class="fa fa-font"></i>',fonts:["","Arial","Verdana","Times New Roman"],init:function(){e.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(e){if(e.preventDefault(),e.stopPropagation(),!this.isDisplayed()){var t=this.document.queryCommandValue("fontName")+"";this.showForm(t)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getSelect().value=""},showForm:function(e){var t=this.getSelect();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),t.value=e||"",t.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 e,t=this.document,n=t.createElement("div"),i=t.createElement("select"),o=t.createElement("a"),r=t.createElement("a");n.className="medium-editor-toolbar-form",n.id="medium-editor-toolbar-form-fontname-"+this.getEditorId(),this.on(n,"click",this.handleFormClick.bind(this));for(var a=0;a<this.fonts.length;a++)(e=t.createElement("option")).innerHTML=this.fonts[a],e.value=this.fonts[a],i.appendChild(e);return i.className="medium-editor-toolbar-select",n.appendChild(i),this.on(i,"change",this.handleFontChange.bind(this)),r.setAttribute("href","#"),r.className="medium-editor-toobar-save",r.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"&#10003;",n.appendChild(r),this.on(r,"click",this.handleSaveClick.bind(this),!0),o.setAttribute("href","#"),o.className="medium-editor-toobar-close",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"&times;",n.appendChild(o),this.on(o,"click",this.handleCloseClick.bind(this)),n},getSelect:function(){return this.getForm().querySelector("select.medium-editor-toolbar-select")},clearFontName:function(){e.selection.getSelectedElements(this.document).forEach((function(e){"font"===e.nodeName.toLowerCase()&&e.hasAttribute("face")&&e.removeAttribute("face")}))},handleFontChange:function(){var e=this.getSelect().value;""===e?this.clearFontName():this.execAction("fontName",{value:e})},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),e.extensions.fontName=s,l=e.extensions.form.extend({name:"fontsize",action:"fontSize",aria:"increase/decrease font size",contentDefault:"&#xB1;",contentFA:'<i class="fa fa-text-height"></i>',init:function(){e.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(e){if(e.preventDefault(),e.stopPropagation(),!this.isDisplayed()){var t=this.document.queryCommandValue("fontSize")+"";this.showForm(t)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getInput().value=""},showForm:function(e){var t=this.getInput();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),t.value=e||"",t.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 e=this.document,t=e.createElement("div"),n=e.createElement("input"),i=e.createElement("a"),o=e.createElement("a");return t.className="medium-editor-toolbar-form",t.id="medium-editor-toolbar-form-fontsize-"+this.getEditorId(),this.on(t,"click",this.handleFormClick.bind(this)),n.setAttribute("type","range"),n.setAttribute("min","1"),n.setAttribute("max","7"),n.className="medium-editor-toolbar-input",t.appendChild(n),this.on(n,"change",this.handleSliderChange.bind(this)),o.setAttribute("href","#"),o.className="medium-editor-toobar-save",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"&#10003;",t.appendChild(o),this.on(o,"click",this.handleSaveClick.bind(this),!0),i.setAttribute("href","#"),i.className="medium-editor-toobar-close",i.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"&times;",t.appendChild(i),this.on(i,"click",this.handleCloseClick.bind(this)),t},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},clearFontSize:function(){e.selection.getSelectedElements(this.document).forEach((function(e){"font"===e.nodeName.toLowerCase()&&e.hasAttribute("size")&&e.removeAttribute("size")}))},handleSliderChange:function(){var e=this.getInput().value;"4"===e?this.clearFontSize():this.execAction("fontSize",{value:e})},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),e.extensions.fontSize=l,function(){var t="%ME_PASTEBIN%",n=null,i=null,o=function(e){e.stopPropagation()};function r(e,t,n){var i=e.clipboardData||t.clipboardData||n.dataTransfer,o={};if(!i)return o;if(i.getData){var r=i.getData("Text");r&&r.length>0&&(o["text/plain"]=r)}if(i.types)for(var a=0;a<i.types.length;a++){var s=i.types[a];o[s]=i.getData(s)}return o}var a=e.Extension.extend({forcePlainText:!0,cleanPastedHTML:!1,preCleanReplacements:[],cleanReplacements:[],cleanAttrs:["class","style","dir"],cleanTags:["meta"],unwrapTags:[],init:function(){e.Extension.prototype.init.apply(this,arguments),(this.forcePlainText||this.cleanPastedHTML)&&(this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.getEditorElements().forEach((function(e){this.on(e,"paste",this.handlePaste.bind(this))}),this),this.subscribe("addElement",this.handleAddElement.bind(this)))},handleAddElement:function(e,t){this.on(t,"paste",this.handlePaste.bind(this))},destroy:function(){(this.forcePlainText||this.cleanPastedHTML)&&this.removePasteBin()},handlePaste:function(e,t){if(!e.defaultPrevented){var n=r(e,this.window,this.document),i=n["text/html"],o=n["text/plain"];this.window.clipboardData&&void 0===e.clipboardData&&!i&&(i=o),(i||o)&&(e.preventDefault(),this.doPaste(i,o,t))}},doPaste:function(t,n,i){var o,r,a="";if(this.cleanPastedHTML&&t)return this.cleanPaste(t);if(n){if(this.getEditorOption("disableReturn")||i&&i.getAttribute("data-disable-return"))a=e.util.htmlEntities(n);else if((o=n.split(/[\r\n]+/g)).length>1)for(r=0;r<o.length;r+=1)""!==o[r]&&(a+="<p>"+e.util.htmlEntities(o[r])+"</p>");else a=e.util.htmlEntities(o[0]);e.util.insertHTMLCommand(this.document,a)}},handlePasteBinPaste:function(e){if(e.defaultPrevented)this.removePasteBin();else{var t=r(e,this.window,this.document),n=t["text/html"],o=t["text/plain"],a=i;if(!this.cleanPastedHTML||n)return e.preventDefault(),this.removePasteBin(),this.doPaste(n,o,a),void this.trigger("editablePaste",{currentTarget:a,target:a},a);setTimeout(function(){this.cleanPastedHTML&&(n=this.getPasteBinHtml()),this.removePasteBin(),this.doPaste(n,o,a),this.trigger("editablePaste",{currentTarget:a,target:a},a)}.bind(this),0)}},handleKeydown:function(t,n){e.util.isKey(t,e.util.keyCode.V)&&e.util.isMetaCtrlKey(t)&&(t.stopImmediatePropagation(),this.removePasteBin(),this.createPasteBin(n))},createPasteBin:function(r){var a,s=e.selection.getSelectionRange(this.document),l=this.window.pageYOffset;i=r,s&&((a=s.getClientRects()).length?l+=a[0].top:void 0!==s.startContainer.getBoundingClientRect?l+=s.startContainer.getBoundingClientRect().top:l+=s.getBoundingClientRect().top),n=s;var u=this.document.createElement("div");u.id=this.pasteBinId="medium-editor-pastebin-"+ +Date.now(),u.setAttribute("style","border: 1px red solid; position: absolute; top: "+l+"px; width: 10px; height: 10px; overflow: hidden; opacity: 0"),u.setAttribute("contentEditable",!0),u.innerHTML=t,this.document.body.appendChild(u),this.on(u,"focus",o),this.on(u,"focusin",o),this.on(u,"focusout",o),u.focus(),e.selection.selectNode(u,this.document),this.boundHandlePaste||(this.boundHandlePaste=this.handlePasteBinPaste.bind(this)),this.on(u,"paste",this.boundHandlePaste)},removePasteBin:function(){null!==n&&(e.selection.selectRange(this.document,n),n=null),null!==i&&(i=null);var t=this.getPasteBin();t&&t&&(this.off(t,"focus",o),this.off(t,"focusin",o),this.off(t,"focusout",o),this.off(t,"paste",this.boundHandlePaste),t.parentElement.removeChild(t))},getPasteBin:function(){return this.document.getElementById(this.pasteBinId)},getPasteBinHtml:function(){var e=this.getPasteBin();if(!e)return!1;if(e.firstChild&&"mcepastebin"===e.firstChild.id)return!1;var n=e.innerHTML;return!(!n||n===t)&&n},cleanPaste:function(e){var t,n,i,o,r=/<p|<br|<div/.test(e),a=[].concat(this.preCleanReplacements||[],[[new RegExp(/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g),""],[new RegExp(/<!--StartFragment-->|<!--EndFragment-->/g),""],[new RegExp(/<br>$/i),""],[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi),""],[new RegExp(/<\/b>(<br[^>]*>)?$/gi),""],[new RegExp(/<span class="Apple-converted-space">\s+<\/span>/g)," "],[new RegExp(/<br class="Apple-interchange-newline">/g),"<br>"],[new RegExp(/<span[^>]*(font-style:italic;font-weight:(bold|700)|font-weight:(bold|700);font-style:italic)[^>]*>/gi),'<span class="replace-with italic bold">'],[new RegExp(/<span[^>]*font-style:italic[^>]*>/gi),'<span class="replace-with italic">'],[new RegExp(/<span[^>]*font-weight:(bold|700)[^>]*>/gi),'<span class="replace-with bold">'],[new RegExp(/&lt;(\/?)(i|b|a)&gt;/gi),"<$1$2>"],[new RegExp(/&lt;a(?:(?!href).)+href=(?:&quot;|&rdquo;|&ldquo;|"|“|”)(((?!&quot;|&rdquo;|&ldquo;|"|“|”).)*)(?:&quot;|&rdquo;|&ldquo;|"|“|”)(?:(?!&gt;).)*&gt;/gi),'<a href="$1">'],[new RegExp(/<\/p>\n+/gi),"</p>"],[new RegExp(/\n+<p/gi),"<p"],[new RegExp(/<\/?o:[a-z]*>/gi),""],[new RegExp(/<!\[if !supportLists\]>(((?!<!).)*)<!\[endif]\>/gi),"$1"]],this.cleanReplacements||[]);for(t=0;t<a.length;t+=1)e=e.replace(a[t][0],a[t][1]);if(!r)return this.pasteHTML(e);for((i=this.document.createElement("div")).innerHTML="<p>"+e.split("<br><br>").join("</p><p>")+"</p>",n=i.querySelectorAll("a,p,div,br"),t=0;t<n.length;t+=1)switch((o=n[t]).innerHTML=o.innerHTML.replace(/\n/gi," "),o.nodeName.toLowerCase()){case"p":case"div":this.filterCommonBlocks(o);break;case"br":this.filterLineBreak(o)}this.pasteHTML(i.innerHTML)},pasteHTML:function(t,n){n=e.util.defaults({},n,{cleanAttrs:this.cleanAttrs,cleanTags:this.cleanTags,unwrapTags:this.unwrapTags});var i,o,r,a,s=this.document.createDocumentFragment();for(s.appendChild(this.document.createElement("body")),(a=s.querySelector("body")).innerHTML=t,this.cleanupSpans(a),i=a.querySelectorAll("*"),r=0;r<i.length;r+=1)"a"===(o=i[r]).nodeName.toLowerCase()&&this.getEditorOption("targetBlank")&&e.util.setTargetBlank(o),e.util.cleanupAttrs(o,n.cleanAttrs),e.util.cleanupTags(o,n.cleanTags),e.util.unwrapTags(o,n.unwrapTags);e.util.insertHTMLCommand(this.document,a.innerHTML.replace(/&nbsp;/g," "))},isCommonBlock:function(e){return e&&("p"===e.nodeName.toLowerCase()||"div"===e.nodeName.toLowerCase())},filterCommonBlocks:function(e){/^\s*$/.test(e.textContent)&&e.parentNode&&e.parentNode.removeChild(e)},filterLineBreak:function(e){this.isCommonBlock(e.previousElementSibling)?this.removeWithParent(e):!this.isCommonBlock(e.parentNode)||e.parentNode.firstChild!==e&&e.parentNode.lastChild!==e?e.parentNode&&1===e.parentNode.childElementCount&&""===e.parentNode.textContent&&this.removeWithParent(e):this.removeWithParent(e)},removeWithParent:function(e){e&&e.parentNode&&(e.parentNode.parentNode&&1===e.parentNode.childElementCount?e.parentNode.parentNode.removeChild(e.parentNode):e.parentNode.removeChild(e))},cleanupSpans:function(t){var n,i,o,r=t.querySelectorAll(".replace-with"),a=function(e){return e&&"#text"!==e.nodeName&&"false"===e.getAttribute("contenteditable")};for(n=0;n<r.length;n+=1)i=r[n],o=this.document.createElement(i.classList.contains("bold")?"b":"i"),i.classList.contains("bold")&&i.classList.contains("italic")?o.innerHTML="<i>"+i.innerHTML+"</i>":o.innerHTML=i.innerHTML,i.parentNode.replaceChild(o,i);for(r=t.querySelectorAll("span"),n=0;n<r.length;n+=1){if(i=r[n],e.util.traverseUp(i,a))return!1;e.util.unwrap(i,this.document)}}});e.extensions.paste=a}(),u=e.Extension.extend({name:"placeholder",text:"Type your text",hideOnClick:!0,init:function(){e.Extension.prototype.init.apply(this,arguments),this.initPlaceholders(),this.attachEventHandlers()},initPlaceholders:function(){this.getEditorElements().forEach(this.initElement,this)},handleAddElement:function(e,t){this.initElement(t)},initElement:function(e){e.getAttribute("data-placeholder")||e.setAttribute("data-placeholder",this.text),this.updatePlaceholder(e)},destroy:function(){this.getEditorElements().forEach(this.cleanupElement,this)},handleRemoveElement:function(e,t){this.cleanupElement(t)},cleanupElement:function(e){e.getAttribute("data-placeholder")===this.text&&e.removeAttribute("data-placeholder")},showPlaceholder:function(t){t&&(e.util.isFF&&0===t.childNodes.length?(t.classList.add("medium-editor-placeholder-relative"),t.classList.remove("medium-editor-placeholder")):(t.classList.add("medium-editor-placeholder"),t.classList.remove("medium-editor-placeholder-relative")))},hidePlaceholder:function(e){e&&(e.classList.remove("medium-editor-placeholder"),e.classList.remove("medium-editor-placeholder-relative"))},updatePlaceholder:function(e,t){if(e.querySelector("img, blockquote, ul, ol, table")||""!==e.textContent.replace(/^\s+|\s+$/g,""))return this.hidePlaceholder(e);t||this.showPlaceholder(e)},attachEventHandlers:function(){this.hideOnClick&&this.subscribe("focus",this.handleFocus.bind(this)),this.subscribe("editableInput",this.handleInput.bind(this)),this.subscribe("blur",this.handleBlur.bind(this)),this.subscribe("addElement",this.handleAddElement.bind(this)),this.subscribe("removeElement",this.handleRemoveElement.bind(this))},handleInput:function(e,t){var n=this.hideOnClick&&t===this.base.getFocusedElement();this.updatePlaceholder(t,n)},handleFocus:function(e,t){this.hidePlaceholder(t)},handleBlur:function(e,t){this.updatePlaceholder(t)}}),e.extensions.placeholder=u,c=e.Extension.extend({name:"toolbar",align:"center",allowMultiParagraphSelection:!0,buttons:["bold","italic","underline","anchor","h2","h3","quote"],diffLeft:0,diffTop:-10,firstButtonClass:"medium-editor-button-first",lastButtonClass:"medium-editor-button-last",standardizeSelectionStart:!1,static:!1,sticky:!1,stickyTopOffset:0,updateOnEmptySelection:!1,relativeContainer:null,init:function(){e.Extension.prototype.init.apply(this,arguments),this.initThrottledMethods(),this.relativeContainer?this.relativeContainer.appendChild(this.getToolbarElement()):this.getEditorOption("elementsContainer").appendChild(this.getToolbarElement())},forEachExtension:function(e,t){return this.base.extensions.forEach((function(n){if(n!==this)return e.apply(t||this,arguments)}),this)},createToolbar:function(){var e=this.document.createElement("div");return e.id="medium-editor-toolbar-"+this.getEditorId(),e.className="medium-editor-toolbar",this.static?e.className+=" static-toolbar":this.relativeContainer?e.className+=" medium-editor-relative-toolbar":e.className+=" medium-editor-stalker-toolbar",e.appendChild(this.createToolbarButtons()),this.forEachExtension((function(t){t.hasForm&&e.appendChild(t.getForm())})),this.attachEventHandlers(),e},createToolbarButtons:function(){var t,n,i,o,r,a,s=this.document.createElement("ul");return s.id="medium-editor-toolbar-actions"+this.getEditorId(),s.className="medium-editor-toolbar-actions",s.style.display="block",this.buttons.forEach((function(i){"string"==typeof i?(r=i,a=null):(r=i.name,a=i),(o=this.base.addBuiltInExtension(r,a))&&"function"==typeof o.getButton&&(n=o.getButton(this.base),t=this.document.createElement("li"),e.util.isElement(n)?t.appendChild(n):t.innerHTML=n,s.appendChild(t))}),this),(i=s.querySelectorAll("button")).length>0&&(i[0].classList.add(this.firstButtonClass),i[i.length-1].classList.add(this.lastButtonClass)),s},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(t){if(t&&t.target&&e.util.isDescendant(this.getToolbarElement(),t.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"block"===this.getToolbarActionsElement().style.display},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(e){e.hasForm&&e.isDisplayed()&&e.hideForm()}))},multipleBlockElementsSelected:function(){var t=new RegExp("<("+e.util.blockContainerElementNames.join("|")+")[^>]*>","g"),n=e.selection.getSelectionHtml(this.document).replace(/<[^\/>][^>]*><\/[^>]+>/gim,"").match(t);return!!n&&n.length>1},modifySelection:function(){var t=this.window.getSelection().getRangeAt(0);if(this.standardizeSelectionStart&&t.startContainer.nodeValue&&t.startOffset===t.startContainer.nodeValue.length){var n=e.util.findAdjacentTextNodeWithContent(e.selection.getSelectionElement(this.window),t.startContainer,this.document);if(n){for(var i=0;0===n.nodeValue.substr(i,1).trim().length;)i+=1;t=e.selection.select(this.document,n,i,t.endContainer,t.endOffset)}}},checkState:function(){if(!this.base.preventSelectionUpdates){if(!this.base.getFocusedElement()||e.selection.selectionInContentEditableFalse(this.window))return this.hideToolbar();var t=e.selection.getSelectionElement(this.window);return!t||-1===this.getEditorElements().indexOf(t)||t.getAttribute("data-disable-toolbar")?this.hideToolbar():this.updateOnEmptySelection&&this.static?this.showAndUpdateToolbar():!e.selection.selectionContainsContent(this.document)||!1===this.allowMultiParagraphSelection&&this.multipleBlockElementsSelected()?this.hideToolbar():void this.showAndUpdateToolbar()}},showAndUpdateToolbar:function(){this.modifySelection(),this.setToolbarButtonStates(),this.trigger("positionToolbar",{},this.base.getFocusedElement()),this.showToolbarDefaultActions(),this.setToolbarPosition()},setToolbarButtonStates:function(){this.forEachExtension((function(e){"function"==typeof e.isActive&&"function"==typeof e.setInactive&&e.setInactive()})),this.checkActiveButtons()},checkActiveButtons:function(){var t,n=[],i=null,o=e.selection.getSelectionRange(this.document),r=function(e){"function"==typeof e.checkState?e.checkState(t):"function"==typeof e.isActive&&"function"==typeof e.isAlreadyApplied&&"function"==typeof e.setActive&&!e.isActive()&&e.isAlreadyApplied(t)&&e.setActive()};if(o&&(this.forEachExtension((function(e){"function"!=typeof e.queryCommandState||null===(i=e.queryCommandState())?n.push(e):i&&"function"==typeof e.setActive&&e.setActive()})),t=e.selection.getSelectedParentElement(o),this.getEditorElements().some((function(n){return e.util.isDescendant(n,t,!0)}))))for(;t&&(n.forEach(r),!e.util.isMediumEditorElement(t));)t=t.parentNode},positionToolbarIfShown:function(){this.isDisplayed()&&this.setToolbarPosition()},setToolbarPosition:function(){var e=this.base.getFocusedElement(),t=this.window.getSelection();if(!e)return this;!this.static&&t.isCollapsed||(this.showToolbar(),this.relativeContainer||(this.static?this.positionStaticToolbar(e):this.positionToolbar(t)),this.trigger("positionedToolbar",{},this.base.getFocusedElement()))},positionStaticToolbar:function(e){this.getToolbarElement().style.left="0";var t,n=this.document.documentElement&&this.document.documentElement.scrollTop||this.document.body.scrollTop,i=this.window.innerWidth,o=this.getToolbarElement(),r=e.getBoundingClientRect(),a=r.top+n,s=r.left+r.width/2,l=o.offsetHeight,u=o.offsetWidth,c=u/2;switch(this.sticky?n>a+e.offsetHeight-l-this.stickyTopOffset?(o.style.top=a+e.offsetHeight-l+"px",o.classList.remove("medium-editor-sticky-toolbar")):n>a-l-this.stickyTopOffset?(o.classList.add("medium-editor-sticky-toolbar"),o.style.top=this.stickyTopOffset+"px"):(o.classList.remove("medium-editor-sticky-toolbar"),o.style.top=a-l+"px"):o.style.top=a-l+"px",this.align){case"left":t=r.left;break;case"right":t=r.right-u;break;case"center":t=s-c}t<0?t=0:t+u>i&&(t=i-Math.ceil(u)-1),o.style.left=t+"px"},positionToolbar:function(e){this.getToolbarElement().style.left="0",this.getToolbarElement().style.right="initial";var t=e.getRangeAt(0),n=t.getBoundingClientRect();(!n||0===n.height&&0===n.width&&t.startContainer===t.endContainer)&&(n=1===t.startContainer.nodeType&&t.startContainer.querySelector("img")?t.startContainer.querySelector("img").getBoundingClientRect():t.startContainer.getBoundingClientRect());var i,o,r=this.window.innerWidth,a=this.getToolbarElement(),s=a.offsetHeight,l=a.offsetWidth/2,u=this.diffLeft-l,c=this.getEditorOption("elementsContainer"),d=["absolute","fixed"].indexOf(window.getComputedStyle(c).getPropertyValue("position"))>-1,h={},f={};d?(o=c.getBoundingClientRect(),["top","left"].forEach((function(e){f[e]=n[e]-o[e]})),f.width=n.width,f.height=n.height,n=f,r=o.width,h.top=c.scrollTop):h.top=this.window.pageYOffset,i=n.left+n.width/2,h.top+=n.top-s,n.top<50?(a.classList.add("medium-toolbar-arrow-over"),a.classList.remove("medium-toolbar-arrow-under"),h.top+=50+n.height-this.diffTop):(a.classList.add("medium-toolbar-arrow-under"),a.classList.remove("medium-toolbar-arrow-over"),h.top+=this.diffTop),i<l?(h.left=u+l,h.right="initial"):r-i<l?(h.left="auto",h.right=0):(h.left=u+i,h.right="initial"),["top","left","right"].forEach((function(e){a.style[e]=h[e]+(isNaN(h[e])?"":"px")}))}}),e.extensions.toolbar=c,d=e.Extension.extend({init:function(){e.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(e){var t="medium-editor-dragover";e.preventDefault(),e.dataTransfer.dropEffect="copy","dragover"===e.type?e.target.classList.add(t):"dragleave"===e.type&&e.target.classList.remove(t)},handleDrop:function(t){t.preventDefault(),t.stopPropagation(),t.dataTransfer.files&&Array.prototype.slice.call(t.dataTransfer.files,0).some(function(t){var n,i;t.type.match("image")&&((n=new FileReader).readAsDataURL(t),i="medium-img-"+ +new Date,e.util.insertHTMLCommand(this.document,'<img class="medium-editor-image-loading" id="'+i+'" />'),n.onload=function(){var e=this.document.getElementById(i);e&&(e.removeAttribute("id"),e.removeAttribute("class"),e.src=n.result)}.bind(this))}.bind(this)),t.target.classList.remove("medium-editor-dragover")}}),e.extensions.imageDragging=d,function(){function t(t){var n=e.selection.getSelectionStart(this.options.ownerDocument),i=n.textContent,o=e.selection.getCaretOffsets(n);(void 0===i[o.left-1]||""===i[o.left-1].trim()||void 0!==i[o.left]&&""===i[o.left].trim())&&t.preventDefault()}function n(t,n){if(this.options.disableReturn||n.getAttribute("data-disable-return"))t.preventDefault();else if(this.options.disableDoubleReturn||n.getAttribute("data-disable-double-return")){var i=e.selection.getSelectionStart(this.options.ownerDocument);(i&&""===i.textContent.trim()&&"li"!==i.nodeName.toLowerCase()||i.previousElementSibling&&"br"!==i.previousElementSibling.nodeName.toLowerCase()&&""===i.previousElementSibling.textContent.trim())&&t.preventDefault()}}function i(t){var n=e.selection.getSelectionStart(this.options.ownerDocument);"pre"===(n&&n.nodeName.toLowerCase())&&(t.preventDefault(),e.util.insertHTMLCommand(this.options.ownerDocument," ")),e.util.isListItem(n)&&(t.preventDefault(),t.shiftKey?this.options.ownerDocument.execCommand("outdent",!1,null):this.options.ownerDocument.execCommand("indent",!1,null))}function o(t){var n,i=e.selection.getSelectionStart(this.options.ownerDocument),o=i.nodeName.toLowerCase(),r=/^(\s+|<br\/?>)?$/i,a=/h\d/i;e.util.isKey(t,[e.util.keyCode.BACKSPACE,e.util.keyCode.ENTER])&&i.previousElementSibling&&a.test(o)&&0===e.selection.getCaretOffsets(i).left?e.util.isKey(t,e.util.keyCode.BACKSPACE)&&r.test(i.previousElementSibling.innerHTML)?(i.previousElementSibling.parentNode.removeChild(i.previousElementSibling),t.preventDefault()):!this.options.disableDoubleReturn&&e.util.isKey(t,e.util.keyCode.ENTER)&&((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.previousElementSibling.parentNode.insertBefore(n,i),t.preventDefault()):e.util.isKey(t,e.util.keyCode.DELETE)&&i.nextElementSibling&&i.previousElementSibling&&!a.test(o)&&r.test(i.innerHTML)&&a.test(i.nextElementSibling.nodeName.toLowerCase())?(e.selection.moveCursor(this.options.ownerDocument,i.nextElementSibling),i.previousElementSibling.parentNode.removeChild(i),t.preventDefault()):e.util.isKey(t,e.util.keyCode.BACKSPACE)&&"li"===o&&r.test(i.innerHTML)&&!i.previousElementSibling&&!i.parentElement.previousElementSibling&&i.nextElementSibling&&"li"===i.nextElementSibling.nodeName.toLowerCase()?((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.parentElement.parentElement.insertBefore(n,i.parentElement),e.selection.moveCursor(this.options.ownerDocument,n),i.parentElement.removeChild(i),t.preventDefault()):e.util.isKey(t,e.util.keyCode.BACKSPACE)&&!1!==e.util.getClosestTag(i,"blockquote")&&0===e.selection.getCaretOffsets(i).left?(t.preventDefault(),e.util.execFormatBlock(this.options.ownerDocument,"p")):e.util.isKey(t,e.util.keyCode.ENTER)&&!1!==e.util.getClosestTag(i,"blockquote")&&0===e.selection.getCaretOffsets(i).right?((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.parentElement.insertBefore(n,i.nextSibling),e.selection.moveCursor(this.options.ownerDocument,n),t.preventDefault()):e.util.isKey(t,e.util.keyCode.BACKSPACE)&&e.util.isMediumEditorElement(i.parentElement)&&!i.previousElementSibling&&i.nextElementSibling&&r.test(i.innerHTML)&&(t.preventDefault(),e.selection.moveCursor(this.options.ownerDocument,i.nextSibling),i.parentElement.removeChild(i))}function r(t){var n=e.selection.getSelectionStart(this.options.ownerDocument);n&&(e.util.isMediumEditorElement(n)&&0===n.children.length&&!e.util.isBlockContainer(n)&&this.options.ownerDocument.execCommand("formatBlock",!1,"p"),!e.util.isKey(t,e.util.keyCode.ENTER)||e.util.isListItem(n)||e.util.isBlockContainer(n)||("a"===n.nodeName.toLowerCase()?this.options.ownerDocument.execCommand("unlink",!1,null):t.shiftKey||t.ctrlKey||this.options.ownerDocument.execCommand("formatBlock",!1,"p")))}function a(e,t){var n=t.parentNode.querySelector('textarea[medium-editor-textarea-id="'+t.getAttribute("medium-editor-textarea-id")+'"]');n&&(n.value=t.innerHTML.trim())}function s(e){e._mediumEditors||(e._mediumEditors=[null]),this.id||(this.id=e._mediumEditors.length),e._mediumEditors[this.id]=this}function l(e){e._mediumEditors&&e._mediumEditors[this.id]&&(e._mediumEditors[this.id]=null)}function u(t,n,i){var o=[];if(t||(t=[]),"string"==typeof t&&(t=n.querySelectorAll(t)),e.util.isElement(t)&&(t=[t]),i)for(var r=0;r<t.length;r++){var a=t[r];!e.util.isElement(a)||a.getAttribute("data-medium-editor-element")||a.getAttribute("medium-editor-textarea-id")||o.push(a)}else o=Array.prototype.slice.apply(t);return o}function c(e){var t=e.parentNode.querySelector('textarea[medium-editor-textarea-id="'+e.getAttribute("medium-editor-textarea-id")+'"]');t&&(t.classList.remove("medium-editor-hidden"),t.removeAttribute("medium-editor-textarea-id")),e.parentNode&&e.parentNode.removeChild(e)}function d(e,t,n){return e=function(e,t){return Object.keys(t).forEach((function(n){void 0===e[n]&&(e[n]=t[n])})),e}(e,{window:n.options.contentWindow,document:n.options.ownerDocument,base:n}),"function"==typeof e.init&&e.init(),e.name||(e.name=t),e}function h(){return!this.elements.every((function(e){return!!e.getAttribute("data-disable-toolbar")}))&&!1!==this.options.toolbar}function f(){return!!h.call(this)&&!1!==this.options.anchorPreview}function p(){return!1!==this.options.placeholder}function g(){return!1!==this.options.autoLink}function v(){return!1!==this.options.imageDragging}function m(){return!1!==this.options.keyboardCommands}function y(){return!this.options.extensions.imageDragging}function b(e){for(var t=this.options.ownerDocument.createElement("div"),n=Date.now(),i="medium-editor-"+n,o=e.attributes;this.options.ownerDocument.getElementById(i);)n++,i="medium-editor-"+n;t.className=e.className,t.id=i,t.innerHTML=e.value,e.setAttribute("medium-editor-textarea-id",i);for(var r=0,a=o.length;r<a;r++)t.hasAttribute(o[r].nodeName)||t.setAttribute(o[r].nodeName,o[r].value);return e.form&&this.on(e.form,"reset",function(e){e.defaultPrevented||this.resetContent(this.options.ownerDocument.getElementById(i))}.bind(this)),e.classList.add("medium-editor-hidden"),e.parentNode.insertBefore(t,e),t}function x(t,i){if(!t.getAttribute("data-medium-editor-element")){"textarea"===t.nodeName.toLowerCase()&&(t=b.call(this,t),this.instanceHandleEditableInput||(this.instanceHandleEditableInput=a.bind(this),this.subscribe("editableInput",this.instanceHandleEditableInput))),this.options.disableEditing||t.getAttribute("data-disable-editing")||(t.setAttribute("contentEditable",!0),t.setAttribute("spellcheck",this.options.spellcheck)),this.instanceHandleEditableKeydownEnter||(t.getAttribute("data-disable-return")||t.getAttribute("data-disable-double-return"))&&(this.instanceHandleEditableKeydownEnter=n.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter)),this.options.disableReturn||t.getAttribute("data-disable-return")||this.on(t,"keyup",r.bind(this));var o=e.util.guid();t.setAttribute("data-medium-editor-element",!0),t.classList.add("medium-editor-element"),t.setAttribute("role","textbox"),t.setAttribute("aria-multiline",!0),t.setAttribute("data-medium-editor-editor-index",i),t.setAttribute("medium-editor-index",o),S[o]=t.innerHTML,this.events.attachAllEventsToElement(t)}return t}function w(){this.subscribe("editableKeydownTab",i.bind(this)),this.subscribe("editableKeydownDelete",o.bind(this)),this.subscribe("editableKeydownEnter",o.bind(this)),this.options.disableExtraSpaces&&this.subscribe("editableKeydownSpace",t.bind(this)),this.instanceHandleEditableKeydownEnter||(this.options.disableReturn||this.options.disableDoubleReturn)&&(this.instanceHandleEditableKeydownEnter=n.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter))}function E(){if(this.extensions=[],Object.keys(this.options.extensions).forEach((function(e){"toolbar"!==e&&this.options.extensions[e]&&this.extensions.push(d(this.options.extensions[e],e,this))}),this),y.call(this)){var t=this.options.fileDragging;t||(t={},v.call(this)||(t.allowedTypes=[])),this.addBuiltInExtension("fileDragging",t)}var n={paste:!0,"anchor-preview":f.call(this),autoLink:g.call(this),keyboardCommands:m.call(this),placeholder:p.call(this)};Object.keys(n).forEach((function(e){n[e]&&this.addBuiltInExtension(e)}),this);var i=this.options.extensions.toolbar;if(!i&&h.call(this)){var o=e.util.extend({},this.options.toolbar,{allowMultiParagraphSelection:this.options.allowMultiParagraphSelection});i=new e.extensions.toolbar(o)}i&&this.extensions.push(d(i,"toolbar",this))}function C(t,n){return n&&[["allowMultiParagraphSelection","toolbar.allowMultiParagraphSelection"]].forEach((function(t){n.hasOwnProperty(t[0])&&void 0!==n[t[0]]&&e.util.deprecated(t[0],t[1],"v6.0.0")})),e.util.defaults({},n,t)}function N(t,n){var i,o;if(i=/^append-(.+)$/gi.exec(t))return e.util.execFormatBlock(this.options.ownerDocument,i[1]);if("fontSize"===t)return n.size&&e.util.deprecated(".size option for fontSize command",".value","6.0.0"),o=n.value||n.size,this.options.ownerDocument.execCommand("fontSize",!1,o);if("fontName"===t)return n.name&&e.util.deprecated(".name option for fontName command",".value","6.0.0"),o=n.value||n.name,this.options.ownerDocument.execCommand("fontName",!1,o);if("createLink"===t)return this.createLink(n);if("image"===t){var r=this.options.contentWindow.getSelection().toString().trim();return this.options.ownerDocument.execCommand("insertImage",!1,r)}if("html"===t){var a=this.options.contentWindow.getSelection().toString().trim();return e.util.insertHTMLCommand(this.options.ownerDocument,a)}if(/justify([A-Za-z]*)$/g.exec(t)){var s=this.options.ownerDocument.execCommand(t,!1,null),l=e.selection.getSelectedParentElement(e.selection.getSelectionRange(this.options.ownerDocument));return l&&_.call(this,e.util.getTopBlockContainer(l)),s}return o=n&&n.value,this.options.ownerDocument.execCommand(t,!1,o)}function _(t){if(t){var n,i=Array.prototype.slice.call(t.childNodes).filter((function(e){var t="div"===e.nodeName.toLowerCase();return t&&!n&&(n=e.style.textAlign),t}));i.length&&(this.saveSelection(),i.forEach((function(t){if(t.style.textAlign===n){var i=t.lastChild;if(i){e.util.unwrap(t,this.options.ownerDocument);var o=this.options.ownerDocument.createElement("BR");i.parentNode.insertBefore(o,i.nextSibling)}}}),this),t.style.textAlign=n,this.restoreSelection())}}var S={};e.prototype={init:function(e,t){return this.options=C.call(this,this.defaults,t),this.origElements=e,this.options.elementsContainer||(this.options.elementsContainer=this.options.ownerDocument.body),this.setup()},setup:function(){this.isActive||(s.call(this,this.options.contentWindow),this.events=new e.Events(this),this.elements=[],this.addElements(this.origElements),0!==this.elements.length&&(this.isActive=!0,E.call(this),w.call(this)))},destroy:function(){this.isActive&&(this.isActive=!1,this.extensions.forEach((function(e){"function"==typeof e.destroy&&e.destroy()}),this),this.events.destroy(),this.elements.forEach((function(e){this.options.spellcheck&&(e.innerHTML=e.innerHTML),e.removeAttribute("contentEditable"),e.removeAttribute("spellcheck"),e.removeAttribute("data-medium-editor-element"),e.classList.remove("medium-editor-element"),e.removeAttribute("role"),e.removeAttribute("aria-multiline"),e.removeAttribute("medium-editor-index"),e.removeAttribute("data-medium-editor-editor-index"),e.getAttribute("medium-editor-textarea-id")&&c(e)}),this),this.elements=[],this.instanceHandleEditableKeydownEnter=null,this.instanceHandleEditableInput=null,l.call(this,this.options.contentWindow))},on:function(e,t,n,i){return this.events.attachDOMEvent(e,t,n,i),this},off:function(e,t,n,i){return this.events.detachDOMEvent(e,t,n,i),this},subscribe:function(e,t){return this.events.attachCustomEvent(e,t),this},unsubscribe:function(e,t){return this.events.detachCustomEvent(e,t),this},trigger:function(e,t,n){return this.events.triggerCustomEvent(e,t,n),this},delay:function(e){var t=this;return setTimeout((function(){t.isActive&&e()}),this.options.delay)},serialize:function(){var e,t={},n=this.elements.length;for(e=0;e<n;e+=1)t[""!==this.elements[e].id?this.elements[e].id:"element-"+e]={value:this.elements[e].innerHTML.trim()};return t},getExtensionByName:function(e){var t;return this.extensions&&this.extensions.length&&this.extensions.some((function(n){return n.name===e&&(t=n,!0)})),t},addBuiltInExtension:function(t,n){var i,o=this.getExtensionByName(t);if(o)return o;switch(t){case"anchor":i=e.util.extend({},this.options.anchor,n),o=new e.extensions.anchor(i);break;case"anchor-preview":o=new e.extensions.anchorPreview(this.options.anchorPreview);break;case"autoLink":o=new e.extensions.autoLink;break;case"fileDragging":o=new e.extensions.fileDragging(n);break;case"fontname":o=new e.extensions.fontName(this.options.fontName);break;case"fontsize":o=new e.extensions.fontSize(n);break;case"keyboardCommands":o=new e.extensions.keyboardCommands(this.options.keyboardCommands);break;case"paste":o=new e.extensions.paste(this.options.paste);break;case"placeholder":o=new e.extensions.placeholder(this.options.placeholder);break;default:e.extensions.button.isBuiltInButton(t)&&(n?(i=e.util.defaults({},n,e.extensions.button.prototype.defaults[t]),o=new e.extensions.button(i)):o=new e.extensions.button(t))}return o&&this.extensions.push(d(o,t,this)),o},stopSelectionUpdates:function(){this.preventSelectionUpdates=!0},startSelectionUpdates:function(){this.preventSelectionUpdates=!1},checkSelection:function(){var e=this.getExtensionByName("toolbar");return e&&e.checkState(),this},queryCommandState:function(e){var t,n=null;(t=/^full-(.+)$/gi.exec(e))&&(e=t[1]);try{n=this.options.ownerDocument.queryCommandState(e)}catch(e){n=null}return n},execAction:function(t,n){var i,o;return(i=/^full-(.+)$/gi.exec(t))?(this.saveSelection(),this.selectAllContents(),o=N.call(this,i[1],n),this.restoreSelection()):o=N.call(this,t,n),"insertunorderedlist"!==t&&"insertorderedlist"!==t||e.util.cleanListDOM(this.options.ownerDocument,this.getSelectedParentElement()),this.checkSelection(),o},getSelectedParentElement:function(t){return void 0===t&&(t=this.options.contentWindow.getSelection().getRangeAt(0)),e.selection.getSelectedParentElement(t)},selectAllContents:function(){var t=e.selection.getSelectionElement(this.options.contentWindow);if(t){for(;1===t.children.length;)t=t.children[0];this.selectElement(t)}},selectElement:function(t){e.selection.selectNode(t,this.options.ownerDocument);var n=e.selection.getSelectionElement(this.options.contentWindow);n&&this.events.focusElement(n)},getFocusedElement:function(){var e;return this.elements.some((function(t){return!e&&t.getAttribute("data-medium-focused")&&(e=t),!!e}),this),e},exportSelection:function(){var t=e.selection.getSelectionElement(this.options.contentWindow),n=this.elements.indexOf(t),i=null;return n>=0&&(i=e.selection.exportSelection(t,this.options.ownerDocument)),null!==i&&0!==n&&(i.editableElementIndex=n),i},saveSelection:function(){this.selectionState=this.exportSelection()},importSelection:function(t,n){if(t){var i=this.elements[t.editableElementIndex||0];e.selection.importSelection(t,i,this.options.ownerDocument,n)}},restoreSelection:function(){this.importSelection(this.selectionState)},createLink:function(t){var n,i=e.selection.getSelectionElement(this.options.contentWindow),o={};if(-1!==this.elements.indexOf(i)){try{if(this.events.disableCustomEvent("editableInput"),t.url&&e.util.deprecated(".url option for createLink",".value","6.0.0"),(n=t.url||t.value)&&n.trim().length>0){var r=this.options.contentWindow.getSelection();if(r){var a,s,l,u,c=r.getRangeAt(0),d=c.commonAncestorContainer;if(3===c.endContainer.nodeType&&3!==c.startContainer.nodeType&&0===c.startOffset&&c.startContainer.firstChild===c.endContainer&&(d=c.endContainer),s=e.util.getClosestBlockContainer(c.startContainer),l=e.util.getClosestBlockContainer(c.endContainer),3!==d.nodeType&&0!==d.textContent.length&&s===l){var h=s||i,f=this.options.ownerDocument.createDocumentFragment();this.execAction("unlink"),a=this.exportSelection(),f.appendChild(h.cloneNode(!0)),i===h?e.selection.select(this.options.ownerDocument,h.firstChild,0,h.lastChild,3===h.lastChild.nodeType?h.lastChild.nodeValue.length:h.lastChild.childNodes.length):e.selection.select(this.options.ownerDocument,h,0,h,h.childNodes.length);var p=this.exportSelection();0===(u=e.util.findOrCreateMatchingTextNodes(this.options.ownerDocument,f,{start:a.start-p.start,end:a.end-p.start,editableElementIndex:a.editableElementIndex})).length&&((f=this.options.ownerDocument.createDocumentFragment()).appendChild(d.cloneNode(!0)),u=[f.firstChild.firstChild,f.firstChild.lastChild]),e.util.createLink(this.options.ownerDocument,u,n.trim());var g=(f.firstChild.innerHTML.match(/^\s+/)||[""])[0].length;e.util.insertHTMLCommand(this.options.ownerDocument,f.firstChild.innerHTML.replace(/^\s+/,"")),a.start-=g,a.end-=g,this.importSelection(a)}else this.options.ownerDocument.execCommand("createLink",!1,n);this.options.targetBlank||"_blank"===t.target?e.util.setTargetBlank(e.selection.getSelectionStart(this.options.ownerDocument),n):e.util.removeTargetBlank(e.selection.getSelectionStart(this.options.ownerDocument),n),t.buttonClass&&e.util.addClassToAnchors(e.selection.getSelectionStart(this.options.ownerDocument),t.buttonClass)}}if(this.options.targetBlank||"_blank"===t.target||t.buttonClass){(o=this.options.ownerDocument.createEvent("HTMLEvents")).initEvent("input",!0,!0,this.options.contentWindow);for(var v=0,m=this.elements.length;v<m;v+=1)this.elements[v].dispatchEvent(o)}}finally{this.events.enableCustomEvent("editableInput")}this.events.triggerCustomEvent("editableInput",o,i)}},cleanPaste:function(e){this.getExtensionByName("paste").cleanPaste(e)},pasteHTML:function(e,t){this.getExtensionByName("paste").pasteHTML(e,t)},setContent:function(e,t){if(t=t||0,this.elements[t]){var n=this.elements[t];n.innerHTML=e,this.checkContentChanged(n)}},getContent:function(e){return e=e||0,this.elements[e]?this.elements[e].innerHTML.trim():null},checkContentChanged:function(t){t=t||e.selection.getSelectionElement(this.options.contentWindow),this.events.updateInput(t,{target:t,currentTarget:t})},resetContent:function(e){if(e){var t=this.elements.indexOf(e);-1!==t&&this.setContent(S[e.getAttribute("medium-editor-index")],t)}else this.elements.forEach((function(e,t){this.setContent(S[e.getAttribute("medium-editor-index")],t)}),this)},addElements:function(e){var t=u(e,this.options.ownerDocument,!0);if(0===t.length)return!1;t.forEach((function(e){e=x.call(this,e,this.id),this.elements.push(e),this.trigger("addElement",{target:e,currentTarget:e},e)}),this)},removeElements:function(e){var t=u(e,this.options.ownerDocument).map((function(e){return e.getAttribute("medium-editor-textarea-id")&&e.parentNode?e.parentNode.querySelector('div[medium-editor-textarea-id="'+e.getAttribute("medium-editor-textarea-id")+'"]'):e}));this.elements=this.elements.filter((function(e){return-1===t.indexOf(e)||(this.events.cleanupElement(e),e.getAttribute("medium-editor-textarea-id")&&c(e),this.trigger("removeElement",{target:e,currentTarget:e},e),!1)}),this)}},e.getEditorFromElement=function(e){var t=e.getAttribute("data-medium-editor-editor-index"),n=e&&e.ownerDocument&&(e.ownerDocument.defaultView||e.ownerDocument.parentWindow);return n&&n._mediumEditors&&n._mediumEditors[t]?n._mediumEditors[t]:null}}(),e.prototype.defaults={activeButtonClass:"medium-editor-button-active",buttonLabels:!1,delay:0,disableReturn:!1,disableDoubleReturn:!1,disableExtraSpaces:!1,disableEditing:!1,autoLink:!1,elementsContainer:!1,contentWindow:window,ownerDocument:document,targetBlank:!1,extensions:{},spellcheck:!0},e.parseVersionString=function(e){var t=e.split("-"),n=t[0].split("."),i=t.length>1?t[1]:"";return{major:parseInt(n[0],10),minor:parseInt(n[1],10),revision:parseInt(n[2],10),preRelease:i,toString:function(){return[n[0],n[1],n[2]].join(".")+(i?"-"+i:"")}}},e.version=e.parseVersionString.call(this,"5.23.3"),e}())}({get exports(){return xv},set exports(e){xv=e}});var wv=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Ev=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),Cv=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{!i&&s.return&&s.return()}finally{if(o)throw r}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};String.prototype.startsWith=String.prototype.startsWith||function(e){return 0===this.indexOf(e)},String.prototype.padStart=String.prototype.padStart||function(e,t){for(var n=this;n.length<e;)n=t+n;return n};var Nv={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function _v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(t>0?e.toFixed(t).replace(/0+$/,"").replace(/\.$/,""):e.toString())||"0"}var Sv=function(){function e(t,n,i,o){wv(this,e);var r=this;if(void 0===t);else if(Array.isArray(t))this.rgba=t;else if(void 0===i){var a=t&&""+t;a&&function(t){if(t.startsWith("hsl")){var n=t.match(/([\-\d\.e]+)/g).map(Number),i=Cv(n,4),o=i[0],a=i[1],s=i[2],l=i[3];void 0===l&&(l=1),o/=360,a/=100,s/=100,r.hsla=[o,a,s,l]}else if(t.startsWith("rgb")){var u=t.match(/([\-\d\.e]+)/g).map(Number),c=Cv(u,4),d=c[0],h=c[1],f=c[2],p=c[3];void 0===p&&(p=1),r.rgba=[d,h,f,p]}else t.startsWith("#")?r.rgba=e.hexToRgb(t):r.rgba=e.nameToRgb(t)||e.hexToRgb(t)}(a.toLowerCase())}else this.rgba=[t,n,i,void 0===o?1:o]}return Ev(e,[{key:"printRGB",value:function(e){var t=(e?this.rgba:this.rgba.slice(0,3)).map((function(e,t){return _v(e,3===t?3:0)}));return e?"rgba("+t+")":"rgb("+t+")"}},{key:"printHSL",value:function(e){var t=[360,100,100,1],n=["","%","%",""],i=(e?this.hsla:this.hsla.slice(0,3)).map((function(e,i){return _v(e*t[i],3===i?3:1)+n[i]}));return e?"hsla("+i+")":"hsl("+i+")"}},{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=e.hslToRgb(this._hsla)},set:function(e){3===e.length&&(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=e.rgbToHsl(this._rgba)},set:function(e){3===e.length&&(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(){return"#"+this.rgba.map((function(e,t){return t<3?e.toString(16):Math.round(255*e).toString(16)})).map((function(e){return e.padStart(2,"0")})).join("")},set:function(t){this.rgba=e.hexToRgb(t)}}],[{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(e){return parseInt(e,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(t){var n=t.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),i=Nv[n];return void 0===i?i:e.hexToRgb(i.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=Cv(e,4),n=t[0],i=t[1],o=t[2],r=t[3];n/=255,i/=255,o/=255;var a=Math.max(n,i,o),s=Math.min(n,i,o),l=void 0,u=void 0,c=(a+s)/2;if(a===s)l=u=0;else{var d=a-s;switch(u=c>.5?d/(2-a-s):d/(a+s),a){case n:l=(i-o)/d+(i<o?6:0);break;case i:l=(o-n)/d+2;break;case o:l=(n-i)/d+4}l/=6}return[l,u,c,r]}},{key:"hslToRgb",value:function(e){var t=Cv(e,4),n=t[0],i=t[1],o=t[2],r=t[3],a=void 0,s=void 0,l=void 0;if(0===i)a=s=l=o;else{var u=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},c=o<.5?o*(1+i):o+i-o*i,d=2*o-c;a=u(d,c,n+1/3),s=u(d,c,n),l=u(d,c,n-1/3)}var h=[255*a,255*s,255*l].map(Math.round);return h[3]=r,h}}]),e}(),Mv=function(){function e(){wv(this,e),this._events=[]}return Ev(e,[{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(t,n,i){this._events=this._events.filter((function(o){var r=!0;return t&&t!==o.target&&(r=!1),n&&n!==o.type&&(r=!1),i&&i!==o.handler&&(r=!1),r&&e._doRemove(o.target,o.type,o.handler),!r}))}},{key:"destroy",value:function(){this._events.forEach((function(t){return e._doRemove(t.target,t.type,t.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(e,t,n){e.removeEventListener(t,n,!1)}}]),e}();function Tv(e,t,n){var i=!1;function o(e,t,n){return Math.max(t,Math.min(e,n))}function r(e,r,a){if(a&&(i=!0),i){e.preventDefault();var s=t.getBoundingClientRect(),l=s.width,u=s.height,c=r.clientX,d=r.clientY,h=o(c-s.left,0,l),f=o(d-s.top,0,u);n(h/l,f/u)}}function a(e,t){1===(void 0===e.buttons?e.which:e.buttons)?r(e,e,t):i=!1}function s(e,t){1===e.touches.length?r(e,e.touches[0],t):i=!1}e.add(t,"mousedown",(function(e){a(e,!0)})),e.add(t,"touchstart",(function(e){s(e,!0)})),e.add(window,"mousemove",a),e.add(t,"touchmove",s),e.add(window,"mouseup",(function(e){i=!1})),e.add(t,"touchend",(function(e){i=!1})),e.add(t,"touchcancel",(function(e){i=!1}))}var Av="keydown",kv="mousedown",Rv="focusin";function Dv(e,t){return(t||document).querySelector(e)}function Ov(e,t,n,i,o){e.add(t,Av,(function(e){n.indexOf(e.key)>=0&&i(e)}))}var Pv=function(){function e(t){wv(this,e),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Mv,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return Ev(e,[{key:"setOptions",value:function(e){var t=this;if(e){var n=this.settings;if(e instanceof HTMLElement)n.parent=e;else{n.parent&&e.parent&&n.parent!==e.parent&&(this._events.remove(n.parent),this._popupInited=!1),function(e,t){for(var n in e)t[n]=e[n]}(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 i=e.color||e.colour;i&&this._setColor(i)}var o=n.parent;if(o&&n.popup&&!this._popupInited){var r=function(e){return t.openHandler(e)};this._events.add(o,"click",r),Ov(this._events,o,[" ","Spacebar","Enter"],r),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===Av?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)if(t===kv||t===Rv){var i=(this.__containedEvent||0)+100;e.timeStamp>i&&(n=!0)}else!function(e){e.preventDefault(),e.stopPropagation()}(e),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",t!==kv&&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("string"==typeof e&&(e=e.trim()),e){t=t||{};var n=void 0;try{n=new Sv(e)}catch(e){if(t.failSilently)return;throw e}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(){if(!this.settings.parent)return!1;if(this.domElement){var e=this._toggleDOM(!0);return this._setPosition(),e}var t,n,i=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',o=(t=i,(n=document.createElement("div")).innerHTML=t,n.firstElementChild);return this.domElement=o,this._domH=Dv(".picker_hue",o),this._domSL=Dv(".picker_sl",o),this._domA=Dv(".picker_alpha",o),this._domEdit=Dv(".picker_editor input",o),this._domSample=Dv(".picker_sample",o),this._domOkay=Dv(".picker_done button",o),this._domCancel=Dv(".picker_cancel button",o),o.classList.add("layout_"+this.settings.layout),this.settings.alpha||o.classList.add("no_alpha"),this.settings.editor||o.classList.add("no_editor"),this.settings.cancelButton||o.classList.add("no_cancel"),this._ifPopup((function(){return o.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(e,t,n){i.add(e,t,n)}o(n,"click",(function(e){return e.preventDefault()})),Tv(i,this._domH,(function(e,n){return t._setHSLA(e)})),Tv(i,this._domSL,(function(e,n){return t._setHSLA(null,e,1-n)})),this.settings.alpha&&Tv(i,this._domA,(function(e,n){return t._setHSLA(null,null,null,1-n)}));var r=this._domEdit;o(r,"input",(function(e){t._setColor(this.value,{fromEditor:!0,failSilently:!0})})),o(r,"focus",(function(e){var t=this;t.selectionStart===t.selectionEnd&&t.select()})),this._ifPopup((function(){var t=function(t){return e.closeHandler(t)};o(window,kv,t),o(window,Rv,t),Ov(i,n,["Esc","Escape"],t);var r=function(t){e.__containedEvent=t.timeStamp};o(n,kv,r),o(n,Rv,r),o(e._domCancel,"click",t)}));var a=function(t){e._ifPopup((function(){return e.closeHandler(t)})),e.onDone&&e.onDone(e.colour)};o(this._domOkay,"click",a),Ov(i,n,["Enter"],a)}},{key:"_setPosition",value:function(){var e=this.settings.parent,t=this.domElement;e!==t.parentNode&&e.appendChild(t),this._ifPopup((function(n){"static"===getComputedStyle(e).position&&(e.style.position="relative");var i=!0===n?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(e){e===i?t.classList.add(e):t.classList.remove(e)})),t.classList.add(i)}))}},{key:"_setHSLA",value:function(e,t,n,i,o){o=o||{};var r=this.colour,a=r.hsla;[e,t,n,i].forEach((function(e,t){(e||0===e)&&(a[t]=e)})),r.hsla=a,this._updateUI(o),this.onChange&&!o.silent&&this.onChange(r)}},{key:"_updateUI",value:function(e){if(this.domElement){e=e||{};var t=this.colour,n=t.hsla,i="hsl("+360*n[0]+", 100%, 50%)",o=t.hslString,r=t.hslaString,a=this._domH,s=this._domSL,l=this._domA,u=Dv(".picker_selector",a),c=Dv(".picker_selector",s),d=Dv(".picker_selector",l);y(0,u,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=i,y(0,c,n[1]),b(0,c,1-n[2]),s.style.color=o,b(0,d,1-n[3]);var h=o,f=h.replace("hsl","hsla").replace(")",", 0)"),p="linear-gradient("+[h,f]+")";if(this._domA.style.background=p+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!e.fromEditor){var g=this.settings.editorFormat,v=this.settings.alpha,m=void 0;switch(g){case"rgb":m=t.printRGB(v);break;case"hsl":m=t.printHSL(v);break;default:m=t.printHex(v)}this._domEdit.value=m}this._domSample.style.color=r}function y(e,t,n){t.style.left=100*n+"%"}function b(e,t,n){t.style.top=100*n+"%"}}},{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}}]),e}(),Iv=document.createElement("style");Iv.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(Iv),Pv.StyleElement=Iv;var Lv={};!function(e){e.exports=function(){var e="object",t="function",n="undefined",i=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],o=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],r=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],a=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"];function s(n,i){var o=typeof n[i];return o==t||!(o!=e||!n[i])||"unknown"==o}function l(t,n){return!(typeof t[n]!=e||!t[n])}function u(e,t){return typeof e[t]!=n}function c(e){return function(t,n){for(var i=n.length;i--;)if(!e(t,n[i]))return!1;return!0}}var d=c(s),h=c(l),f=c(u);function p(e){return e&&d(e,a)&&f(e,r)}function g(e){return l(e,"body")?e.body:e.getElementsByTagName("body")[0]}var v,m,y=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,i=e.length;n<i;++n)t(e[n],n)},b={},x=typeof window!=n&&typeof document!=n,w={isHostMethod:s,isHostObject:l,isHostProperty:u,areHostMethods:d,areHostObjects:h,areHostProperties:f,isTextRange:p,getBody:g,forEach:y},E={version:"1.3.1",initialized:!1,isBrowser:x,supported:!0,util:w,features:{},modules:b,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==n||rangyAutoInitialize}};function C(e){typeof console!=n&&s(console,"log")}function N(e,t){x&&t?alert(e):C(e)}function _(e){E.initialized=!0,E.supported=!1,N("Rangy is not supported in this environment. Reason: "+e,E.config.alertOnFail)}function S(e){N("Rangy warning: "+e,E.config.alertOnWarn)}E.fail=_,E.warn=S,{}.hasOwnProperty?(w.extend=v=function(e,t,n){var i,o;for(var r in t)t.hasOwnProperty(r)&&(i=e[r],o=t[r],n&&null!==i&&"object"==typeof i&&null!==o&&"object"==typeof o&&v(i,o,!0),e[r]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},w.createOptions=function(e,t){var n={};return v(n,t),e&&v(n,e),n}):_("hasOwnProperty not supported"),x||_("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(e){}}e||(e=function(e){for(var t=[],n=0,i=e.length;n<i;++n)t[n]=e[n];return t}),w.toArray=e}(),x&&(s(document,"addEventListener")?m=function(e,t,n){e.addEventListener(t,n,!1)}:s(document,"attachEvent")?m=function(e,t,n){e.attachEvent("on"+t,n)}:_("Document does not have required addEventListener or attachEvent method"),w.addListener=m);var M=[];function T(e){return e.message||e.description||String(e)}function A(){if(x&&!E.initialized){var e,t=!1,n=!1;s(document,"createRange")&&(e=document.createRange(),d(e,o)&&f(e,i)&&(t=!0));var r=g(document);if(r&&"body"==r.nodeName.toLowerCase())if(r&&s(r,"createTextRange")&&p(e=r.createTextRange())&&(n=!0),t||n){var a;for(var l in E.initialized=!0,E.features={implementsDomRange:t,implementsTextRange:n},b)(a=b[l])instanceof P&&a.init(a,E);for(var u=0,c=M.length;u<c;++u)try{M[u](E)}catch(e){C("Rangy init listener threw an exception. Continuing. Detail: "+T(e))}}else _("Neither Range nor TextRange are available");else _("No body element found")}}function k(e,t,n){n&&(e+=" in module "+n.name),E.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function R(e,t,n,i){e[t]=function(){return k(t,n,i),e[n].apply(e,w.toArray(arguments))}}w.deprecationNotice=k,w.createAliasForDeprecatedMethod=R,E.init=A,E.addInitListener=function(e){E.initialized?e(E):M.push(e)};var D=[];function O(e){e=e||window,A();for(var t=0,n=D.length;t<n;++t)D[t](e)}function P(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function I(e,t,n){var i=new P(e,t,(function(t){if(!t.initialized){t.initialized=!0;try{n(E,t),t.supported=!0}catch(t){C("Module '"+e+"' failed to load: "+T(t)),t.stack&&C(t.stack)}}}));return b[e]=i,i}function L(){}function B(){}E.addShimListener=function(e){D.push(e)},x&&(E.shim=E.createMissingNativeApi=O,R(E,"createMissingNativeApi","shim")),P.prototype={init:function(){for(var e,t,n=this.dependencies||[],i=0,o=n.length;i<o;++i){if(t=n[i],!((e=b[t])&&e instanceof P))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){E.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){E.warn("DEPRECATED: "+e+" in module "+this.name+" is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},E.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var i=I(e,n,t);E.initialized&&E.supported&&i.init()},E.createCoreModule=function(e,t,n){I(e,t,n)},E.RangePrototype=L,E.rangePrototype=new L,E.selectionPrototype=new B,E.createCoreModule("DomUtil",[],(function(e,t){var n="undefined",i=e.util,o=i.getBody;i.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),i.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var r=document.createElement("div");i.areHostMethods(r,["insertBefore","appendChild","cloneNode"]||!i.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),i.isHostProperty(r,"innerHTML")||t.fail("Element is missing innerHTML property");var a=document.createTextNode("test");i.areHostMethods(a,["splitText","deleteData","insertData","appendData","cloneNode"]||!i.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"])||!i.areHostProperties(a,["data"]))||t.fail("Incomplete Text Node implementation");var s=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1};function l(e){var t;return typeof e.namespaceURI==n||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function u(e){var t=e.parentNode;return 1==t.nodeType?t:null}function c(e){for(var t=0;e=e.previousSibling;)++t;return t}function d(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function h(e,t){var n,i=[];for(n=e;n;n=n.parentNode)i.push(n);for(n=t;n;n=n.parentNode)if(s(i,n))return n;return null}function f(e,t,n){for(var i=n?t:t.parentNode;i;){if(i===e)return!0;i=i.parentNode}return!1}function p(e,t){return f(e,t,!0)}function g(e,t,n){for(var i,o=n?e:e.parentNode;o;){if((i=o.parentNode)===t)return o;o=i}return null}function v(e){var t=e.nodeType;return 3==t||4==t||8==t}function m(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function y(e,t){var n=t.nextSibling,i=t.parentNode;return n?i.insertBefore(e,n):i.appendChild(e),e}function b(e,t,n){var i=e.cloneNode(!1);if(i.deleteData(0,t),e.deleteData(t,e.length-t),y(i,e),n)for(var o,r=0;o=n[r++];)o.node==e&&o.offset>t?(o.node=i,o.offset-=t):o.node==e.parentNode&&o.offset>c(e)&&++o.offset;return i}function x(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=n)return e.ownerDocument;if(typeof e.document!=n)return e.document;if(e.parentNode)return x(e.parentNode);throw t.createError("getDocument: no document found for node")}function w(e){var i=x(e);if(typeof i.defaultView!=n)return i.defaultView;if(typeof i.parentWindow!=n)return i.parentWindow;throw t.createError("Cannot get a window object for node")}function E(e){if(typeof e.contentDocument!=n)return e.contentDocument;if(typeof e.contentWindow!=n)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function C(e){if(typeof e.contentWindow!=n)return e.contentWindow;if(typeof e.contentDocument!=n)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function N(e){return e&&i.isHostMethod(e,"setTimeout")&&i.isHostObject(e,"document")}function _(e,t,n){var o;if(e?i.isHostProperty(e,"nodeType")?o=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?E(e):x(e):N(e)&&(o=e.document):o=document,!o)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return o}function S(e){for(var t;t=e.parentNode;)e=t;return e}function M(e,n,i,o){var r,a,s,l,u;if(e==i)return n===o?0:n<o?-1:1;if(r=g(i,e,!0))return n<=c(r)?-1:1;if(r=g(e,i,!0))return c(r)<o?-1:1;if(!(a=h(e,i)))throw new Error("comparePoints error: nodes have no common ancestor");if((s=e===a?a:g(e,a,!0))===(l=i===a?a:g(i,a,!0)))throw t.createError("comparePoints got to case 4 and childA and childB are the same!");for(u=a.firstChild;u;){if(u===s)return-1;if(u===l)return 1;u=u.nextSibling}}var T,A=!1;function k(e){try{return e.parentNode,!1}catch(e){return!0}}function R(e){if(!e)return"[No node]";if(A&&k(e))return"[Broken node]";if(v(e))return'"'+e.data+'"';if(1==e.nodeType){var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">[index:"+c(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function D(e){for(var t,n=x(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function O(e,t,n){var i=o(e),r=e.createElement("div");r.contentEditable=""+!!n,t&&(r.innerHTML=t);var a=i.firstChild;return a?i.insertBefore(r,a):i.appendChild(r),r}function P(e){return e.parentNode.removeChild(e)}function I(e){this.root=e,this._next=e}function L(e){return new I(e)}function B(e,t){this.node=e,this.offset=t}function j(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="<br />",A=k(n),e.features.crashyTextNodes=A}(),typeof window.getComputedStyle!=n?T=function(e,t){return w(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=n?T=function(e,t){return e.currentStyle?e.currentStyle[t]:""}:t.fail("No means of obtaining computed style properties found"),I.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},B.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+R(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},j.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},j.prototype.toString=function(){return this.message},e.dom={arrayContains:s,isHtmlNamespace:l,parentElement:u,getNodeIndex:c,getNodeLength:d,getCommonAncestor:h,isAncestorOf:f,isOrIsAncestorOf:p,getClosestAncestorIn:g,isCharacterDataNode:v,isTextOrCommentNode:m,insertAfter:y,splitDataNode:b,getDocument:x,getWindow:w,getIframeWindow:C,getIframeDocument:E,getBody:o,isWindow:N,getContentDocument:_,getRootContainer:S,comparePoints:M,isBrokenNode:k,inspectNode:R,getComputedStyleProperty:T,createTestElement:O,removeNode:P,fragmentFromNodeChildren:D,createIterator:L,DomPosition:B},e.DOMException=j})),E.createCoreModule("DomRange",["DomUtil"],(function(e,t){var n=e.dom,i=e.util,o=n.DomPosition,r=e.DOMException,a=n.isCharacterDataNode,s=n.getNodeIndex,l=n.isOrIsAncestorOf,u=n.getDocument,c=n.comparePoints,d=n.splitDataNode,h=n.getClosestAncestorIn,f=n.getNodeLength,p=n.arrayContains,g=n.getRootContainer,v=e.features.crashyTextNodes,m=n.removeNode;function y(e,t){return 3!=e.nodeType&&(l(e,t.startContainer)||l(e,t.endContainer))}function b(e){return e.document||u(e.startContainer)}function x(e){return g(e.startContainer)}function w(e){return new o(e.parentNode,s(e))}function E(e){return new o(e.parentNode,s(e)+1)}function C(e,t,i){var o=11==e.nodeType?e.firstChild:e;return a(t)?i==t.length?n.insertAfter(e,t):t.parentNode.insertBefore(e,0==i?t:d(t,i)):i>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[i]),o}function N(e,t,n){if($(e),$(t),b(t)!=b(e))throw new r("WRONG_DOCUMENT_ERR");var i=c(e.startContainer,e.startOffset,t.endContainer,t.endOffset),o=c(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return n?i<=0&&o>=0:i<0&&o>0}function _(e){for(var t,n,i,o=b(e.range).createDocumentFragment();n=e.next();){if(t=e.isPartiallySelectedSubtree(),n=n.cloneNode(!t),t&&(i=e.getSubtreeIterator(),n.appendChild(_(i)),i.detach()),10==n.nodeType)throw new r("HIERARCHY_REQUEST_ERR");o.appendChild(n)}return o}function S(e,t,i){var o,r,a,s;for(i=i||{stop:!1};a=e.next();)if(e.isPartiallySelectedSubtree()){if(!1===t(a))return void(i.stop=!0);if(S(s=e.getSubtreeIterator(),t,i),s.detach(),i.stop)return}else for(o=n.createIterator(a);r=o.next();)if(!1===t(r))return void(i.stop=!0)}function M(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(M(t=e.getSubtreeIterator()),t.detach()):e.remove()}function T(e){for(var t,n,i=b(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),n=e.getSubtreeIterator(),t.appendChild(T(n)),n.detach()):e.remove(),10==t.nodeType)throw new r("HIERARCHY_REQUEST_ERR");i.appendChild(t)}return i}function A(e,t,n){var i,o=!(!t||!t.length),r=!!n;o&&(i=new RegExp("^("+t.join("|")+")$"));var s=[];return S(new R(e,!1),(function(t){if((!o||i.test(t.nodeType))&&(!r||n(t))){var l=e.startContainer;if(t!=l||!a(l)||e.startOffset!=l.length){var u=e.endContainer;t==u&&a(u)&&0==e.endOffset||s.push(t)}}})),s}function k(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+n.inspectNode(e.startContainer)+":"+e.startOffset+", "+n.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function R(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&a(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||a(this.sc)?h(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||a(this.ec)?h(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}R.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 e=this._current=this._next;return e&&(this._next=e!==this._last?e.nextSibling:null,a(e)&&this.clonePartiallySelectedTextNodes&&(e===this.ec&&(e=e.cloneNode(!0)).deleteData(this.eo,e.length-this.eo),this._current===this.sc&&(e=e.cloneNode(!0)).deleteData(0,this.so))),e},remove:function(){var e,t,n=this._current;!a(n)||n!==this.sc&&n!==this.ec?n.parentNode&&m(n):(e=n===this.sc?this.so:0)!=(t=n===this.ec?this.eo:n.length)&&n.deleteData(e,t-e)},isPartiallySelectedSubtree:function(){return y(this._current,this.range)},getSubtreeIterator:function(){var e;if(this.isSingleCharacterDataNode)(e=this.range.cloneRange()).collapse(!1);else{e=new me(b(this.range));var t=this._current,n=t,i=0,o=t,r=f(t);l(t,this.sc)&&(n=this.sc,i=this.so),l(t,this.ec)&&(o=this.ec,r=this.eo),ve(e,n,i,o,r)}return new R(e,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var D=[1,3,4,5,7,8,10],O=[2,9,11],P=[5,6,10,12],I=[1,3,4,5,7,8,10,11],L=[1,3,4,5,7,8];function B(e){return function(t,n){for(var i,o=n?t:t.parentNode;o;){if(i=o.nodeType,p(e,i))return o;o=o.parentNode}return null}}var j=B([9,11]),F=B(P),H=B([6,10,12]),W=B([1]);function z(e,t){if(H(e,t))throw new r("INVALID_NODE_TYPE_ERR")}function G(e,t){if(!p(t,e.nodeType))throw new r("INVALID_NODE_TYPE_ERR")}function U(e,t){if(t<0||t>(a(e)?e.length:e.childNodes.length))throw new r("INDEX_SIZE_ERR")}function q(e,t){if(j(e,!0)!==j(t,!0))throw new r("WRONG_DOCUMENT_ERR")}function X(e){if(F(e,!0))throw new r("NO_MODIFICATION_ALLOWED_ERR")}function V(e,t){if(!e)throw new r(t)}function K(e,t){return t<=(a(e)?e.length:e.childNodes.length)}function Y(e){return!!e.startContainer&&!!e.endContainer&&!(v&&(n.isBrokenNode(e.startContainer)||n.isBrokenNode(e.endContainer)))&&g(e.startContainer)==g(e.endContainer)&&K(e.startContainer,e.startOffset)&&K(e.endContainer,e.endOffset)}function $(e){if(!Y(e))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+e.inspect()+")")}var Z=document.createElement("style"),J=!1;try{Z.innerHTML="<b>x</b>",J=3==Z.firstChild.nodeType}catch(e){}e.features.htmlParsingConforms=J;var Q=J?function(e){var t=this.startContainer,i=u(t);if(!t)throw new r("INVALID_STATE_ERR");var o=null;return 1==t.nodeType?o=t:a(t)&&(o=n.parentElement(t)),(o=null===o||"HTML"==o.nodeName&&n.isHtmlNamespace(u(o).documentElement)&&n.isHtmlNamespace(o)?i.createElement("body"):o.cloneNode(!1)).innerHTML=e,n.fragmentFromNodeChildren(o)}:function(e){var t=b(this).createElement("body");return t.innerHTML=e,n.fragmentFromNodeChildren(t)};function ee(e,t){$(e);var n=e.startContainer,i=e.startOffset,o=e.endContainer,r=e.endOffset,l=n===o;a(o)&&r>0&&r<o.length&&d(o,r,t),a(n)&&i>0&&i<n.length&&(n=d(n,i,t),l?(r-=i,o=n):o==n.parentNode&&r>=s(n)&&r++,i=0),e.setStartAndEnd(n,i,o,r)}function te(e){$(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}var ne=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ie=0,oe=1,re=2,ae=3,se=0,le=1,ue=2,ce=3;function de(e){e.START_TO_START=ie,e.START_TO_END=oe,e.END_TO_END=re,e.END_TO_START=ae,e.NODE_BEFORE=se,e.NODE_AFTER=le,e.NODE_BEFORE_AND_AFTER=ue,e.NODE_INSIDE=ce}function he(e){de(e),de(e.prototype)}function fe(e,t){return function(){$(this);var n,i=this.startContainer,o=this.startOffset,r=this.commonAncestorContainer,a=new R(this,!0);i!==r&&(i=(n=E(h(i,r,!0))).node,o=n.offset),S(a,X),a.reset();var s=e(a);return a.detach(),t(this,i,o,i,o),s}}function pe(t,n){function o(e,t){return function(n){G(n,D),G(g(n),O);var i=(e?w:E)(n);(t?r:l)(this,i.node,i.offset)}}function r(e,t,i){var o=e.endContainer,r=e.endOffset;t===e.startContainer&&i===e.startOffset||(g(t)==g(o)&&1!=c(t,i,o,r)||(o=t,r=i),n(e,t,i,o,r))}function l(e,t,i){var o=e.startContainer,r=e.startOffset;t===e.endContainer&&i===e.endOffset||(g(t)==g(o)&&-1!=c(t,i,o,r)||(o=t,r=i),n(e,o,r,t,i))}var u=function(){};u.prototype=e.rangePrototype,t.prototype=new u,i.extend(t.prototype,{setStart:function(e,t){z(e,!0),U(e,t),r(this,e,t)},setEnd:function(e,t){z(e,!0),U(e,t),l(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],i=e[1],o=t,r=i;switch(e.length){case 3:r=e[2];break;case 4:o=e[2],r=e[3]}z(t,!0),U(t,i),z(o,!0),U(o,r),n(this,t,i,o,r)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:o(!0,!0),setStartAfter:o(!1,!0),setEndBefore:o(!0,!1),setEndAfter:o(!1,!1),collapse:function(e){$(this),e?n(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):n(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){z(e,!0),n(this,e,0,e,f(e))},selectNode:function(e){z(e,!1),G(e,D);var t=w(e),i=E(e);n(this,t.node,t.offset,i.node,i.offset)},extractContents:fe(T,n),deleteContents:fe(M,n),canSurroundContents:function(){$(this),X(this.startContainer),X(this.endContainer);var e=new R(this,!0),t=e._first&&y(e._first,this)||e._last&&y(e._last,this);return e.detach(),!t},splitBoundaries:function(){ee(this)},splitBoundariesPreservingPositions:function(e){ee(this,e)},normalizeBoundaries:function(){$(this);var e,t=this.startContainer,i=this.startOffset,o=this.endContainer,r=this.endOffset,l=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(o=e,r=e.length,e.appendData(t.data),m(t))},u=function(e){var n=e.previousSibling;if(n&&n.nodeType==e.nodeType){t=e;var a=e.length;if(i=n.length,e.insertData(0,n.data),m(n),t==o)r+=i,o=t;else if(o==e.parentNode){var l=s(e);r==l?(o=e,r=a):r>l&&r--}}},c=!0;if(a(o))r==o.length?l(o):0==r&&(e=o.previousSibling)&&e.nodeType==o.nodeType&&(r=e.length,t==o&&(c=!1),e.appendData(o.data),m(o),o=e);else{if(r>0){var d=o.childNodes[r-1];d&&a(d)&&l(d)}c=!this.collapsed}if(c){if(a(t))0==i?u(t):i==t.length&&(e=t.nextSibling)&&e.nodeType==t.nodeType&&(o==e&&(o=t,r+=t.length),t.appendData(e.data),m(e));else if(i<t.childNodes.length){var h=t.childNodes[i];h&&a(h)&&u(h)}}else t=o,i=r;n(this,t,i,o,r)},collapseToPoint:function(e,t){z(e,!0),U(e,t),this.setStartAndEnd(e,t)},parentElement:function(){return $(this),this.commonAncestorContainer?W(this.commonAncestorContainer,!0):null}}),he(t)}function ge(e){e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e.commonAncestorContainer=e.collapsed?e.startContainer:n.getCommonAncestor(e.startContainer,e.endContainer)}function ve(e,t,i,o,r){e.startContainer=t,e.startOffset=i,e.endContainer=o,e.endOffset=r,e.document=n.getDocument(t),ge(e)}function me(e){ve(this,e,0,e,0)}i.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){var n,i,o,r;$(this),q(this.startContainer,t.startContainer);var a=e==ae||e==ie?"start":"end",s=e==oe||e==ie?"start":"end";return n=this[a+"Container"],i=this[a+"Offset"],o=t[s+"Container"],r=t[s+"Offset"],c(n,i,o,r)},insertNode:function(e){if($(this),G(e,I),X(this.startContainer),l(e,this.startContainer))throw new r("HIERARCHY_REQUEST_ERR");var t=C(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){var e,t;if($(this),this.collapsed)return b(this).createDocumentFragment();if(this.startContainer===this.endContainer&&a(this.startContainer))return(e=this.startContainer.cloneNode(!0)).data=e.data.slice(this.startOffset,this.endOffset),(t=b(this).createDocumentFragment()).appendChild(e),t;var n=new R(this,!0);return e=_(n),n.detach(),e},canSurroundContents:function(){$(this),X(this.startContainer),X(this.endContainer);var e=new R(this,!0),t=e._first&&y(e._first,this)||e._last&&y(e._last,this);return e.detach(),!t},surroundContents:function(e){if(G(e,L),!this.canSurroundContents())throw new r("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);C(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){$(this);for(var e,t=new me(b(this)),n=ne.length;n--;)t[e=ne[n]]=this[e];return t},toString:function(){$(this);var e=this.startContainer;if(e===this.endContainer&&a(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new R(this,!0);return S(n,(function(e){3!=e.nodeType&&4!=e.nodeType||t.push(e.data)})),n.detach(),t.join("")},compareNode:function(e){$(this);var t=e.parentNode,n=s(e);if(!t)throw new r("NOT_FOUND_ERR");var i=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return i<0?o>0?ue:se:o>0?le:ce},comparePoint:function(e,t){return $(this),V(e,"HIERARCHY_REQUEST_ERR"),q(e,this.startContainer),c(e,t,this.startContainer,this.startOffset)<0?-1:c(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:Q,toHtml:function(){return te(this)},intersectsNode:function(e,t){if($(this),g(e)!=x(this))return!1;var n=e.parentNode,i=s(e);if(!n)return!0;var o=c(n,i,this.endContainer,this.endOffset),r=c(n,i+1,this.startContainer,this.startOffset);return t?o<=0&&r>=0:o<0&&r>0},isPointInRange:function(e,t){return $(this),V(e,"HIERARCHY_REQUEST_ERR"),q(e,this.startContainer),c(e,t,this.startContainer,this.startOffset)>=0&&c(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return N(this,e,!1)},intersectsOrTouchesRange:function(e){return N(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=c(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=c(this.endContainer,this.endOffset,e.endContainer,e.endOffset),i=this.cloneRange();return-1==t&&i.setStart(e.startContainer,e.startOffset),1==n&&i.setEnd(e.endContainer,e.endOffset),i}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==c(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==c(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new r("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==ce},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,f(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var i=n.pop();return t.setEnd(i,i.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return $(this),A(this,e,t)},getDocument:function(){return b(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var i=b(this),o=e.createRange(i);t=t||n.getBody(i),o.selectNodeContents(t);var r=this.intersection(o),a=0,s=0;return r&&(o.setEnd(r.startContainer,r.startOffset),s=(a=o.toString().length)+r.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var i,o,r,a,s=[t],l=!1,u=!1;!u&&(i=s.pop());)if(3==i.nodeType)o=n+i.length,!l&&e.start>=n&&e.start<=o&&(this.setStart(i,e.start-n),l=!0),l&&e.end>=n&&e.end<=o&&(this.setEnd(i,e.end-n),u=!0),n=o;else for(r=(a=i.childNodes).length;r--;)s.push(a[r])},getName:function(){return"DomRange"},equals:function(e){return me.rangesEqual(this,e)},isValid:function(){return Y(this)},inspect:function(){return k(this)},detach:function(){}}),pe(me,ve),i.extend(me,{rangeProperties:ne,RangeIterator:R,copyComparisonConstants:he,createPrototypeRange:pe,inspect:k,toHtml:te,getRangeDocument:b,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=me})),E.createCoreModule("WrappedRange",["DomRange"],(function(e,t){var n,i,o=e.dom,r=e.util,a=o.DomPosition,s=e.DomRange,l=o.getBody,u=o.getContentDocument,c=o.isCharacterDataNode;if(e.features.implementsDomRange&&function(){var i,a,c=s.rangeProperties;function d(e){for(var t,n=c.length;n--;)e[t=c[n]]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function h(e,t,n,i,o){var r=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==i||e.endOffset!=o,s=!e.equals(e.nativeRange);(r||a||s)&&(e.setEnd(i,o),e.setStart(t,n))}n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,d(this)},s.createPrototypeRange(n,h),(i=n.prototype).selectNode=function(e){this.nativeRange.selectNode(e),d(this)},i.cloneContents=function(){return this.nativeRange.cloneContents()},i.surroundContents=function(e){this.nativeRange.surroundContents(e),d(this)},i.collapse=function(e){this.nativeRange.collapse(e),d(this)},i.cloneRange=function(){return new n(this.nativeRange.cloneRange())},i.refresh=function(){d(this)},i.toString=function(){return this.nativeRange.toString()};var f=document.createTextNode("test");l(document).appendChild(f);var p=document.createRange();p.setStart(f,0),p.setEnd(f,0);try{p.setStart(f,1),i.setStart=function(e,t){this.nativeRange.setStart(e,t),d(this)},i.setEnd=function(e,t){this.nativeRange.setEnd(e,t),d(this)},a=function(e){return function(t){this.nativeRange[e](t),d(this)}}}catch(e){i.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}d(this)},i.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}d(this)},a=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(i){this.nativeRange[t](n),this.nativeRange[e](n)}d(this)}}}i.setStartBefore=a("setStartBefore","setEndBefore"),i.setStartAfter=a("setStartAfter","setEndAfter"),i.setEndBefore=a("setEndBefore","setStartBefore"),i.setEndAfter=a("setEndAfter","setStartAfter"),i.selectNodeContents=function(e){this.setStartAndEnd(e,0,o.getNodeLength(e))},p.selectNodeContents(f),p.setEnd(f,3);var g=document.createRange();g.selectNodeContents(f),g.setEnd(f,4),g.setStart(f,2),-1==p.compareBoundaryPoints(p.START_TO_END,g)&&1==p.compareBoundaryPoints(p.END_TO_START,g)?i.compareBoundaryPoints=function(e,t){return e==(t=t.nativeRange||t).START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:i.compareBoundaryPoints=function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var v=document.createElement("div");v.innerHTML="123";var m=v.firstChild,y=l(document);y.appendChild(v),p.setStart(m,1),p.setEnd(m,2),p.deleteContents(),"13"==m.data&&(i.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},i.extractContents=function(){var e=this.nativeRange.extractContents();return d(this),e}),y.removeChild(v),y=null,r.isHostMethod(p,"createContextualFragment")&&(i.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),l(document).removeChild(f),i.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return(e=u(e,t,"createNativeRange")).createRange()}}(),e.features.implementsTextRange){var d=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var i=n.parentElement();(n=e.duplicate()).collapse(!1);var r=n.parentElement(),a=i==r?i:o.getCommonAncestor(i,r);return a==t?a:o.getCommonAncestor(t,a)},h=function(e){return 0==e.compareEndPoints("StartToEnd",e)},f=function(e,t,n,i,r){var s=e.duplicate();s.collapse(n);var l=s.parentElement();if(o.isOrIsAncestorOf(t,l)||(l=t),!l.canHaveHTML){var u=new a(l.parentNode,o.getNodeIndex(l));return{boundaryPosition:u,nodeInfo:{nodeIndex:u.offset,containerElement:u.node}}}var d=o.getDocument(l).createElement("span");d.parentNode&&o.removeNode(d);for(var h,f,p,g,v,m=n?"StartToStart":"StartToEnd",y=r&&r.containerElement==l?r.nodeIndex:0,b=l.childNodes.length,x=b,w=x;w==b?l.appendChild(d):l.insertBefore(d,l.childNodes[w]),s.moveToElementText(d),0!=(h=s.compareEndPoints(m,e))&&y!=x;){if(-1==h){if(x==y+1)break;y=w}else x=x==y+1?y:w;w=Math.floor((y+x)/2),l.removeChild(d)}if(v=d.nextSibling,-1==h&&v&&c(v)){var E;if(s.setEndPoint(n?"EndToStart":"EndToEnd",e),/[\r\n]/.test(v.data)){var C=s.duplicate(),N=C.text.replace(/\r\n/g,"\r").length;for(E=C.moveStart("character",N);-1==(h=C.compareEndPoints("StartToEnd",C));)E++,C.moveStart("character",1)}else E=s.text.length;g=new a(v,E)}else f=(i||!n)&&d.previousSibling,g=(p=(i||n)&&d.nextSibling)&&c(p)?new a(p,0):f&&c(f)?new a(f,f.data.length):new a(l,o.getNodeIndex(d));return o.removeNode(d),{boundaryPosition:g,nodeInfo:{nodeIndex:w,containerElement:l}}},p=function(e,t){var n,i,r,a,s=e.offset,u=o.getDocument(e.node),d=l(u).createTextRange(),h=c(e.node);return h?i=(n=e.node).parentNode:(n=s<(a=e.node.childNodes).length?a[s]:null,i=e.node),(r=u.createElement("span")).innerHTML="&#feff;",n?i.insertBefore(r,n):i.appendChild(r),d.moveToElementText(r),d.collapse(!t),i.removeChild(r),h&&d[t?"moveStart":"moveEnd"]("character",s),d};(i=function(e){this.textRange=e,this.refresh()}).prototype=new s(document),i.prototype.refresh=function(){var e,t,n,i=d(this.textRange);h(this.textRange)?t=e=f(this.textRange,i,!0,!0).boundaryPosition:(e=(n=f(this.textRange,i,!0,!1)).boundaryPosition,t=f(this.textRange,i,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(e.node,e.offset),this.setEnd(t.node,t.offset)},i.prototype.getName=function(){return"WrappedTextRange"},s.copyComparisonConstants(i);var g=function(e){if(e.collapsed)return p(new a(e.startContainer,e.startOffset),!0);var t=p(new a(e.startContainer,e.startOffset),!0),n=p(new a(e.endContainer,e.endOffset),!1),i=l(s.getRangeDocument(e)).createTextRange();return i.setEndPoint("StartToStart",t),i.setEndPoint("EndToEnd",n),i};if(i.rangeToTextRange=g,i.prototype.toTextRange=function(){return g(this)},e.WrappedTextRange=i,!e.features.implementsDomRange||e.config.preferTextRange){var v=Function("return this;")();void 0===v.Range&&(v.Range=i),e.createNativeRange=function(e){return e=u(e,t,"createNativeRange"),l(e).createTextRange()},e.WrappedRange=i}}e.createRange=function(n){return n=u(n,t,"createRange"),new e.WrappedRange(e.createNativeRange(n))},e.createRangyRange=function(e){return e=u(e,t,"createRangyRange"),new s(e)},r.createAliasForDeprecatedMethod(e,"createIframeRange","createRange"),r.createAliasForDeprecatedMethod(e,"createIframeRangyRange","createRangyRange"),e.addShimListener((function(t){var n=t.document;void 0===n.createRange&&(n.createRange=function(){return e.createRange(n)}),n=t=null}))})),E.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(e,t){e.config.checkSelectionRanges=!0;var n,i,o="boolean",r="number",a=e.dom,s=e.util,l=s.isHostMethod,u=e.DomRange,c=e.WrappedRange,d=e.DOMException,h=a.DomPosition,f=e.features,p="Control",g=a.getDocument,v=a.getBody,m=u.rangesEqual;function y(e){return"string"==typeof e?/^backward(s)?$/i.test(e):!!e}function b(e,n){if(e){if(a.isWindow(e))return e;if(e instanceof $)return e.win;var i=a.getContentDocument(e,t,n);return a.getWindow(i)}return window}function x(e){return b(e,"getWinSelection").getSelection()}function w(e){return b(e,"getDocSelection").document.selection}function E(e){var t=!1;return e.anchorNode&&(t=1==a.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)),t}var C=l(window,"getSelection"),N=s.isHostObject(document,"selection");f.implementsWinGetSelection=C,f.implementsDocSelection=N;var _=N&&(!C||e.config.preferTextRange);if(_)n=w,e.isSelectionValid=function(e){var t=b(e,"isSelectionValid").document,n=t.selection;return"None"!=n.type||g(n.createRange().parentElement())==t};else{if(!C)return t.fail("Neither document.selection or window.getSelection() detected."),!1;n=x,e.isSelectionValid=function(){return!0}}e.getNativeSelection=n;var S=n();if(!S)return t.fail("Native selection was null (possibly issue 138?)"),!1;var M=e.createNativeRange(document),T=v(document),A=s.areHostProperties(S,["anchorNode","focusNode","anchorOffset","focusOffset"]);f.selectionHasAnchorAndFocus=A;var k=l(S,"extend");f.selectionHasExtend=k;var R=l(S,"setBaseAndExtent");f.selectionHasSetBaseAndExtent=R;var D=typeof S.rangeCount==r;f.selectionHasRangeCount=D;var O=!1,P=!0,I=k?function(t,n){var i=u.getRangeDocument(n),o=e.createRange(i);o.collapseToPoint(n.endContainer,n.endOffset),t.addRange(G(o)),t.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(S,["addRange","getRangeAt","removeAllRanges"])&&typeof S.rangeCount==r&&f.implementsDomRange&&function(){var t=window.getSelection();if(t){for(var n=t.rangeCount,i=n>1,o=[],r=E(t),s=0;s<n;++s)o[s]=t.getRangeAt(s);var l=a.createTestElement(document,"",!1),u=l.appendChild(document.createTextNode("   ")),c=document.createRange();if(c.setStart(u,1),c.collapse(!0),t.removeAllRanges(),t.addRange(c),P=1==t.rangeCount,t.removeAllRanges(),!i){var d=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(d&&parseInt(d[1])>=36)O=!1;else{var h=c.cloneRange();c.setStart(u,0),h.setEnd(u,3),h.setStart(u,2),t.addRange(c),t.addRange(h),O=2==t.rangeCount}}for(a.removeNode(l),t.removeAllRanges(),s=0;s<n;++s)0==s&&r?I?I(t,o[s]):(e.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),t.addRange(o[s])):t.addRange(o[s])}}(),f.selectionSupportsMultipleRanges=O,f.collapsedNonEditableSelectionsSupported=P;var L,B,j=!1;function F(e,t,n){var i=n?"end":"start",o=n?"start":"end";e.anchorNode=t[i+"Container"],e.anchorOffset=t[i+"Offset"],e.focusNode=t[o+"Container"],e.focusOffset=t[o+"Offset"]}function H(e){var t=e.nativeSelection;e.anchorNode=t.anchorNode,e.anchorOffset=t.anchorOffset,e.focusNode=t.focusNode,e.focusOffset=t.focusOffset}function W(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0,z(e)}function z(e){e.type=0==e.rangeCount?"None":i(e)?"Caret":"Range"}function G(t){var n;return t instanceof u?((n=e.createNativeRange(t.getDocument())).setEnd(t.endContainer,t.endOffset),n.setStart(t.startContainer,t.startOffset)):t instanceof c?n=t.nativeRange:f.implementsDomRange&&t instanceof a.getWindow(t.startContainer).Range&&(n=t),n}function U(e){if(!e.length||1!=e[0].nodeType)return!1;for(var t=1,n=e.length;t<n;++t)if(!a.isAncestorOf(e[0],e[t]))return!1;return!0}function q(e){var n=e.getNodes();if(!U(n))throw t.createError("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return n[0]}function X(e){return!!e&&void 0!==e.text}function V(e,t){var n=new c(t);e._ranges=[n],F(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed,z(e)}function K(t){if(t._ranges.length=0,"None"==t.docSelection.type)W(t);else{var n=t.docSelection.createRange();if(X(n))V(t,n);else{t.rangeCount=n.length;for(var i,o=g(n.item(0)),r=0;r<t.rangeCount;++r)(i=e.createRange(o)).selectNode(n.item(r)),t._ranges.push(i);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed,F(t,t._ranges[t.rangeCount-1],!1),z(t)}}}function Y(e,n){for(var i=e.docSelection.createRange(),o=q(n),r=g(i.item(0)),a=v(r).createControlRange(),s=0,l=i.length;s<l;++s)a.add(i.item(s));try{a.add(o)}catch(e){throw t.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}a.select(),K(e)}function $(e,t,n){this.nativeSelection=e,this.docSelection=t,this._ranges=[],this.win=n,this.refresh()}function Z(e){e.win=e.anchorNode=e.focusNode=e._ranges=null,e.rangeCount=e.anchorOffset=e.focusOffset=0,e.detached=!0,z(e)}T&&l(T,"createControlRange")&&(L=T.createControlRange(),s.areHostProperties(L,["item","add"])&&(j=!0)),f.implementsControlRange=j,i=A?function(e){return e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset}:function(e){return!!e.rangeCount&&e.getRangeAt(e.rangeCount-1).collapsed},l(S,"getRangeAt")?B=function(e,t){try{return e.getRangeAt(t)}catch(e){return null}}:A&&(B=function(t){var n=g(t.anchorNode),i=e.createRange(n);return i.setStartAndEnd(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),i.collapsed!==this.isCollapsed&&i.setStartAndEnd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset),i}),$.prototype=e.selectionPrototype;var J=[];function Q(e,t){for(var n,i,o=J.length;o--;)if(i=(n=J[o]).selection,"deleteAll"==t)Z(i);else if(n.win==e)return"delete"==t?(J.splice(o,1),!0):i;return"deleteAll"==t&&(J.length=0),null}var ee=function(e){if(e&&e instanceof $)return e.refresh(),e;var t=Q(e=b(e,"getNativeSelection")),i=n(e),o=N?w(e):null;return t?(t.nativeSelection=i,t.docSelection=o,t.refresh()):(t=new $(i,o,e),J.push({win:e,selection:t})),t};e.getSelection=ee,s.createAliasForDeprecatedMethod(e,"getIframeSelection","getSelection");var te,ne=$.prototype;function ie(e,n){for(var i,o=g(n[0].startContainer),r=v(o).createControlRange(),a=0,s=n.length;a<s;++a){i=q(n[a]);try{r.add(i)}catch(e){throw t.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),K(e)}if(!_&&A&&s.areHostMethods(S,["removeAllRanges","addRange"])){ne.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),W(this)};var oe=function(e,t){I(e.nativeSelection,t),e.refresh()};ne.addRange=D?function(t,n){if(j&&N&&this.docSelection.type==p)Y(this,t);else if(y(n)&&k)oe(this,t);else{var o;O?o=this.rangeCount:(this.removeAllRanges(),o=0);var r=G(t).cloneRange();try{this.nativeSelection.addRange(r)}catch(e){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==o+1){if(e.config.checkSelectionRanges){var a=B(this.nativeSelection,this.rangeCount-1);a&&!m(a,t)&&(t=new c(a))}this._ranges[this.rangeCount-1]=t,F(this,t,re(this.nativeSelection)),this.isCollapsed=i(this),z(this)}else this.refresh()}}:function(e,t){y(t)&&k?oe(this,e):(this.nativeSelection.addRange(G(e)),this.refresh())},ne.setRanges=function(e){if(j&&N&&e.length>1)ie(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;t<n;++t)this.addRange(e[t])}}}else{if(!(l(S,"empty")&&l(M,"select")&&j&&_))return t.fail("No means of selecting a Range or TextRange was found"),!1;ne.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var e;if(this.anchorNode)e=g(this.anchorNode);else if(this.docSelection.type==p){var t=this.docSelection.createRange();t.length&&(e=g(t.item(0)))}e&&(v(e).createTextRange().select(),this.docSelection.empty())}}catch(e){}W(this)},ne.addRange=function(t){this.docSelection.type==p?Y(this,t):(e.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,F(this,t,!1),z(this))},ne.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?ie(this,e):t&&this.addRange(e[0])}}if(ne.getRangeAt=function(e){if(e<0||e>=this.rangeCount)throw new d("INDEX_SIZE_ERR");return this._ranges[e].cloneRange()},_)te=function(t){var n;e.isSelectionValid(t.win)?n=t.docSelection.createRange():(n=v(t.win.document).createTextRange()).collapse(!0),t.docSelection.type==p?K(t):X(n)?V(t,n):W(t)};else if(l(S,"getRangeAt")&&typeof S.rangeCount==r)te=function(t){if(j&&N&&t.docSelection.type==p)K(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,o=t.rangeCount;n<o;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));F(t,t._ranges[t.rangeCount-1],re(t.nativeSelection)),t.isCollapsed=i(t),z(t)}else W(t)};else{if(!A||typeof S.isCollapsed!=o||typeof M.collapsed!=o||!f.implementsDomRange)return t.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;te=function(e){var t,n=e.nativeSelection;n.anchorNode?(t=B(n,0),e._ranges=[t],e.rangeCount=1,H(e),e.isCollapsed=i(e),z(e)):W(e)}}ne.refresh=function(e){var t=e?this._ranges.slice(0):null,n=this.anchorNode,i=this.anchorOffset;if(te(this),e){var o=t.length;if(o!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=i)return!0;for(;o--;)if(!m(t[o],this._ranges[o]))return!0;return!1}};var re,ae=function(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var i=0,o=n.length;i<o;++i)m(t,n[i])||e.addRange(n[i]);e.rangeCount||W(e)};function se(e,t){if(e.win.document!=g(t))throw new d("WRONG_DOCUMENT_ERR")}function le(e,t){if(t<0||t>(a.isCharacterDataNode(e)?e.length:e.childNodes.length))throw new d("INDEX_SIZE_ERR")}function ue(t){return function(n,i){var o;this.rangeCount?(o=this.getRangeAt(0))["set"+(t?"Start":"End")](n,i):(o=e.createRange(this.win.document)).setStartAndEnd(n,i),this.setSingleRange(o,this.isBackward())}}function ce(e){var t=[],n=new h(e.anchorNode,e.anchorOffset),i=new h(e.focusNode,e.focusOffset),o="function"==typeof e.getName?e.getName():"Selection";if(void 0!==e.rangeCount)for(var r=0,a=e.rangeCount;r<a;++r)t[r]=u.inspect(e.getRangeAt(r));return"["+o+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}ne.removeRange=j&&N?function(e){if(this.docSelection.type==p){for(var t=this.docSelection.createRange(),n=q(e),i=g(t.item(0)),o=v(i).createControlRange(),r=!1,a=0,s=t.length;a<s;++a)t.item(a)!==n||r?o.add(t.item(a)):r=!0;o.select(),K(this)}else ae(this,e)}:function(e){ae(this,e)},!_&&A&&f.implementsDomRange?(re=E,ne.isBackward=function(){return re(this)}):re=ne.isBackward=function(){return!1},ne.isBackwards=ne.isBackward,ne.toString=function(){for(var e=[],t=0,n=this.rangeCount;t<n;++t)e[t]=""+this._ranges[t];return e.join("")},ne.collapse=function(t,n){se(this,t);var i=e.createRange(t);i.collapseToPoint(t,n),this.setSingleRange(i),this.isCollapsed=!0},ne.collapseToStart=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},ne.collapseToEnd=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var e=this._ranges[this.rangeCount-1];this.collapse(e.endContainer,e.endOffset)},ne.selectAllChildren=function(t){se(this,t);var n=e.createRange(t);n.selectNodeContents(t),this.setSingleRange(n)},R?ne.setBaseAndExtent=function(e,t,n,i){this.nativeSelection.setBaseAndExtent(e,t,n,i),this.refresh()}:k&&(ne.setBaseAndExtent=function(t,n,i,o){le(t,n),le(i,o),se(this,t),se(this,i);var r=e.createRange(node),s=-1==a.comparePoints(t,n,i,o);s?r.setStartAndEnd(i,o,t,n):r.setStartAndEnd(t,n,i,o),this.setSingleRange(r,s)}),ne.deleteFromDocument=function(){if(j&&N&&this.docSelection.type==p){for(var e,t=this.docSelection.createRange();t.length;)e=t.item(0),t.remove(e),a.removeNode(e);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var i=0,o=n.length;i<o;++i)n[i].deleteContents();this.addRange(n[o-1])}}},ne.eachRange=function(e,t){for(var n=0,i=this._ranges.length;n<i;++n)if(e(this.getRangeAt(n)))return t},ne.getAllRanges=function(){var e=[];return this.eachRange((function(t){e.push(t)})),e},ne.setSingleRange=function(e,t){this.removeAllRanges(),this.addRange(e,t)},ne.callMethodOnEachRange=function(e,t){var n=[];return this.eachRange((function(i){n.push(i[e].apply(i,t||[]))})),n},ne.setStart=ue(!0),ne.setEnd=ue(!1),e.rangePrototype.select=function(e){ee(this.getDocument()).setSingleRange(this,e)},ne.changeEachRange=function(e){var t=[],n=this.isBackward();this.eachRange((function(n){e(n),t.push(n)})),this.removeAllRanges(),n&&1==t.length?this.addRange(t[0],"backward"):this.setRanges(t)},ne.containsNode=function(e,t){return this.eachRange((function(n){return n.containsNode(e,t)}),!0)||!1},ne.getBookmark=function(e){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[e])}},ne.moveToBookmark=function(t){for(var n,i,o=[],r=0;n=t.rangeBookmarks[r++];)(i=e.createRange(this.win)).moveToBookmark(n),o.push(i);t.backward?this.setSingleRange(o[0],"backward"):this.setRanges(o)},ne.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},ne.restoreRanges=function(e){this.removeAllRanges();for(var t,n=0;t=e.ranges[n];++n)this.addRange(t,e.backward&&0==n)},ne.toHtml=function(){var e=[];return this.eachRange((function(t){e.push(u.toHtml(t))})),e.join("")},f.implementsTextRange&&(ne.getNativeTextRange=function(){var n;if(n=this.docSelection){var i=n.createRange();if(X(i))return i;throw t.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return e.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw t.createError("getNativeTextRange: selection contains no range")}),ne.getName=function(){return"WrappedSelection"},ne.inspect=function(){return ce(this)},ne.detach=function(){Q(this.win,"delete"),Z(this)},$.detachAll=function(){Q(null,"deleteAll")},$.inspect=ce,$.isDirectionBackward=y,e.Selection=$,e.selectionPrototype=ne,e.addShimListener((function(e){void 0===e.getSelection&&(e.getSelection=function(){return ee(e)}),e=null}))}));var j=!1,F=function(e){j||(j=!0,!E.initialized&&E.config.autoInitialize&&A())};return x&&("complete"==document.readyState?F():(s(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",F,!1),m(window,"load",F))),E}()}({get exports(){return Lv},set exports(e){Lv=e}});var Bv={};!function(e){var t;e.exports=((t=Lv).createModule("ClassApplier",["WrappedSelection"],(function(e,t){var n=e.dom,i=n.DomPosition,o=n.arrayContains,r=e.util,a=r.forEach,s="span",l=r.isHostMethod(document,"createElementNS");function u(e,t){for(var n in e)if(e.hasOwnProperty(n)&&!1===t(n,e[n]))return!1;return!0}function c(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function d(e,t){return!!e&&new RegExp("(?:^|\\s)"+t+"(?:\\s|$)").test(e)}function h(e,t){return"object"==typeof e.classList?e.classList.contains(t):d("string"==typeof e.className?e.className:e.getAttribute("class"),t)}function f(e,t){if("object"==typeof e.classList)e.classList.add(t);else{var n="string"==typeof e.className,i=n?e.className:e.getAttribute("class");i?d(i,t)||(i+=" "+t):i=t,n?e.className=i:e.setAttribute("class",i)}}var p=function(){function e(e,t,n){return t&&n?" ":""}return function(t,n){if("object"==typeof t.classList)t.classList.remove(n);else{var i="string"==typeof t.className,o=i?t.className:t.getAttribute("class");o=o.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),e),i?t.className=o:t.setAttribute("class",o)}}}();function g(e){return"string"==typeof e.className?e.className:e.getAttribute("class")}function v(e){return e&&e.split(/\s+/).sort().join(" ")}function m(e){return v(g(e))}function y(e,t){return m(e)==m(t)}function b(e,t){for(var n=t.split(/\s+/),i=0,o=n.length;i<o;++i)if(!h(e,c(n[i])))return!1;return!0}function x(e){var t=e.parentNode;return t&&1==t.nodeType&&!/^(textarea|style|script|select|iframe)$/i.test(t.nodeName)}function w(e,t,n,i,o){var r=e.node,a=e.offset,s=r,l=a;r==i&&a>o&&++l,r!=t||a!=n&&a!=n+1||(s=i,l+=o-n),r==t&&a>n+1&&--l,e.node=s,e.offset=l}function E(e,t,n){e.node==t&&e.offset>n&&--e.offset}function C(e,t,i,o){-1==i&&(i=t.childNodes.length);var r=e.parentNode,s=n.getNodeIndex(e);a(o,(function(e){w(e,r,s,t,i)})),t.childNodes.length==i?t.appendChild(e):t.insertBefore(e,t.childNodes[i])}function N(e,t){var i=e.parentNode,o=n.getNodeIndex(e);a(t,(function(e){E(e,i,o)})),n.removeNode(e)}function _(e,t,n,i,o){for(var r,a=[];r=e.firstChild;)C(r,t,n++,o),a.push(r);return N(e,o),a}function S(e,t){return _(e,e.parentNode,n.getNodeIndex(e),!0,t)}function M(e,t){var n=e.cloneRange();n.selectNodeContents(t);var i=n.intersection(e);return""!=(i?i.toString():"")}function T(e){for(var t,n=e.getNodes([3]),i=0;(t=n[i])&&!M(e,t);)++i;for(var o=n.length-1;(t=n[o])&&!M(e,t);)--o;return n.slice(i,o+1)}function A(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n,i,o,r=0,a=e.attributes.length;r<a;++r)if("class"!=(o=(n=e.attributes[r]).name)){if(null===n!=(null===(i=t.attributes.getNamedItem(o))))return!1;if(n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}function k(e,t){for(var n,i=0,r=e.attributes.length;i<r;++i)if(n=e.attributes[i].name,(!t||!o(t,n))&&e.attributes[i].specified&&"class"!=n)return!0;return!1}var R=n.getComputedStyleProperty,D="boolean"==typeof document.createElement("div").isContentEditable?function(e){return e&&1==e.nodeType&&e.isContentEditable}:function(e){return!(!e||1!=e.nodeType||"false"==e.contentEditable)&&("true"==e.contentEditable||D(e.parentNode))};function O(e){var t;return e&&1==e.nodeType&&((t=e.parentNode)&&9==t.nodeType&&"on"==t.designMode||D(e)&&!D(e.parentNode))}function P(e){return(D(e)||1!=e.nodeType&&D(e.parentNode))&&!O(e)}var I=/^inline(-block|-table)?$/i;function L(e){return e&&1==e.nodeType&&!I.test(R(e,"display"))}var B=/[^\r\n\t\f \u200B]/;function j(e){if(0==e.data.length)return!0;if(B.test(e.data))return!1;switch(R(e.parentNode,"whiteSpace")){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(e.data))return!1}return L(e.previousSibling)||L(e.nextSibling)}function F(e){var t,n,o=[];for(t=0;n=e[t++];)o.push(new i(n.startContainer,n.startOffset),new i(n.endContainer,n.endOffset));return o}function H(e,t){for(var n,i,o,r=0,a=e.length;r<a;++r)n=e[r],i=t[2*r],o=t[2*r+1],n.setStartAndEnd(i.node,i.offset,o.node,o.offset)}function W(e,t){return n.isCharacterDataNode(e)?0==t?!!e.previousSibling:t!=e.length||!!e.nextSibling:t>0&&t<e.childNodes.length}function z(e,i,o,r){var a,s,l=0==o;if(n.isAncestorOf(i,e))return e;if(n.isCharacterDataNode(i)){var u=n.getNodeIndex(i);if(0==o)o=u;else{if(o!=i.length)throw t.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+o+" in "+i.data);o=u+1}i=i.parentNode}if(W(i,o)){a=i.cloneNode(!1),s=i.parentNode,a.id&&a.removeAttribute("id");for(var c,d=0;c=i.childNodes[o];)C(c,a,d++,r);return C(a,s,n.getNodeIndex(i)+1,r),i==e?a:z(e,s,n.getNodeIndex(a),r)}if(e!=i){a=i.parentNode;var h=n.getNodeIndex(i);return l||h++,z(e,a,h,r)}return e}function G(e,t){return e.namespaceURI==t.namespaceURI&&e.tagName.toLowerCase()==t.tagName.toLowerCase()&&y(e,t)&&A(e,t)&&"inline"==R(e,"display")&&"inline"==R(t,"display")}function U(e){var t=e?"nextSibling":"previousSibling";return function(n,i){var o=n.parentNode,r=n[t];if(r){if(r&&3==r.nodeType)return r}else if(i&&(r=o[t])&&1==r.nodeType&&G(o,r)){var a=r[e?"firstChild":"lastChild"];if(a&&3==a.nodeType)return a}return null}}var q=U(!1),X=U(!0);function V(e){this.isElementMerge=1==e.nodeType,this.textNodes=[];var t=this.isElementMerge?e.lastChild:e;t&&(this.textNodes[0]=t)}V.prototype={doMerge:function(e){var t=this.textNodes,i=t[0];if(t.length>1){var o,r=n.getNodeIndex(i),s=[],l=0;a(t,(function(u,c){o=u.parentNode,c>0&&(o.removeChild(u),o.hasChildNodes()||n.removeNode(o),e&&a(e,(function(e){e.node==u&&(e.node=i,e.offset+=l),e.node==o&&e.offset>r&&(--e.offset,e.offset==r+1&&c<t.length-1&&(e.node=i,e.offset=l))}))),s[c]=u.data,l+=u.data.length})),i.data=s.join("")}return i.data},getLength:function(){for(var e=this.textNodes.length,t=0;e--;)t+=this.textNodes[e].length;return t},toString:function(){var e=[];return a(this.textNodes,(function(t,n){e[n]="'"+t.data+"'"})),"[Merge("+e.join(",")+")]"}};var K=["elementTagName","ignoreWhiteSpace","applyToEditableOnly","useExistingElements","removeEmptyElements","onElementCreate"],Y={};function $(e,t,n){var i,o,r,a,s=this;s.cssClass=s.className=e;var l=null,d={};if("object"==typeof t&&null!==t){for(void 0!==t.elementTagName&&(t.elementTagName=t.elementTagName.toLowerCase()),n=t.tagNames,l=t.elementProperties,d=t.elementAttributes,o=0;a=K[o++];)t.hasOwnProperty(a)&&(s[a]=t[a]);i=t.normalize}else i=t;s.normalize=void 0===i||i,s.attrExceptions=[];var h=document.createElement(s.elementTagName);s.elementProperties=s.copyPropertiesToElement(l,h,!0),u(d,(function(e,t){s.attrExceptions.push(e),d[e]=""+t})),s.elementAttributes=d,s.elementSortedClassName=s.elementProperties.hasOwnProperty("className")?v(s.elementProperties.className+" "+e):e,s.applyToAnyTagName=!1;var f=typeof n;if("string"==f)"*"==n?s.applyToAnyTagName=!0:s.tagNames=c(n.toLowerCase()).split(/\s*,\s*/);else if("object"==f&&"number"==typeof n.length)for(s.tagNames=[],o=0,r=n.length;o<r;++o)"*"==n[o]?s.applyToAnyTagName=!0:s.tagNames.push(n[o].toLowerCase());else s.tagNames=[s.elementTagName]}function Z(e,t,n){return new $(e,t,n)}$.prototype={elementTagName:s,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(e,t,n){var i,o,r,a,s,l,u={};for(var c in e)if(e.hasOwnProperty(c))if(a=e[c],s=t[c],"className"==c)f(t,a),f(t,this.className),t[c]=v(t[c]),n&&(u[c]=a);else if("style"==c){for(i in o=s,n&&(u[c]=r={}),e[c])e[c].hasOwnProperty(i)&&(o[i]=a[i],n&&(r[i]=o[i]));this.attrExceptions.push(c)}else t[c]=a,n&&(u[c]=t[c],l=Y.hasOwnProperty(c)?Y[c]:c,this.attrExceptions.push(l));return n?u:""},copyAttributesToElement:function(e,t){for(var n in e)e.hasOwnProperty(n)&&!/^class(?:Name)?$/i.test(n)&&t.setAttribute(n,e[n])},appliesToElement:function(e){return o(this.tagNames,e.tagName.toLowerCase())},getEmptyElements:function(e){var t=this;return e.getNodes([1],(function(e){return t.appliesToElement(e)&&!e.hasChildNodes()}))},hasClass:function(e){return 1==e.nodeType&&(this.applyToAnyTagName||this.appliesToElement(e))&&h(e,this.className)},getSelfOrAncestorWithClass:function(e){for(;e;){if(this.hasClass(e))return e;e=e.parentNode}return null},isModifiable:function(e){return!this.applyToEditableOnly||P(e)},isIgnorableWhiteSpaceNode:function(e){return this.ignoreWhiteSpace&&e&&3==e.nodeType&&j(e)},postApply:function(e,t,n,i){var o,r,s=e[0],l=e[e.length-1],u=[],c=s,d=l,h=0,f=l.length;a(e,(function(e){(r=q(e,!i))?(o||(o=new V(r),u.push(o)),o.textNodes.push(e),e===s&&(c=o.textNodes[0],h=c.length),e===l&&(d=o.textNodes[0],f=o.getLength())):o=null}));var p=X(l,!i);if(p&&(o||(o=new V(l),u.push(o)),o.textNodes.push(p)),u.length){for(var g=0,v=u.length;g<v;++g)u[g].doMerge(n);t.setStartAndEnd(c,h,d,f)}},createContainer:function(e){var t=n.getDocument(e),i=l&&!n.isHtmlNamespace(e)&&e.namespaceURI?t.createElementNS(e.namespaceURI,this.elementTagName):t.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,i,!1),this.copyAttributesToElement(this.elementAttributes,i),f(i,this.className),this.onElementCreate&&this.onElementCreate(i,this),i},elementHasProperties:function(e,t){var n=this;return u(t,(function(t,i){if("className"==t)return b(e,i);if("object"==typeof i){if(!n.elementHasProperties(e[t],i))return!1}else if(e[t]!==i)return!1}))},elementHasAttributes:function(e,t){return u(t,(function(t,n){if(e.getAttribute(t)!==n)return!1}))},applyToTextNode:function(e,t){if(x(e)){var n=e.parentNode;if(1==n.childNodes.length&&this.useExistingElements&&this.appliesToElement(n)&&this.elementHasProperties(n,this.elementProperties)&&this.elementHasAttributes(n,this.elementAttributes))f(n,this.className);else{var i=e.parentNode,o=this.createContainer(i);i.insertBefore(o,e),o.appendChild(e)}}},isRemovable:function(e){return e.tagName.toLowerCase()==this.elementTagName&&m(e)==this.elementSortedClassName&&this.elementHasProperties(e,this.elementProperties)&&!k(e,this.attrExceptions)&&this.elementHasAttributes(e,this.elementAttributes)&&this.isModifiable(e)},isEmptyContainer:function(e){var t=e.childNodes.length;return 1==e.nodeType&&this.isRemovable(e)&&(0==t||1==t&&this.isEmptyContainer(e.firstChild))},removeEmptyContainers:function(e){var t=this,n=e.getNodes([1],(function(e){return t.isEmptyContainer(e)})),i=[e],o=F(i);a(n,(function(e){N(e,o)})),H(i,o)},undoToTextNode:function(e,t,n,i){if(!t.containsNode(n)){var o=t.cloneRange();o.selectNode(n),o.isPointInRange(t.endContainer,t.endOffset)&&(z(n,t.endContainer,t.endOffset,i),t.setEndAfter(n)),o.isPointInRange(t.startContainer,t.startOffset)&&(n=z(n,t.startContainer,t.startOffset,i))}this.isRemovable(n)?S(n,i):p(n,this.className)},splitAncestorWithClass:function(e,t,n){var i=this.getSelfOrAncestorWithClass(e);i&&z(i,e,t,n)},undoToAncestor:function(e,t){this.isRemovable(e)?S(e,t):p(e,this.className)},applyToRange:function(e,t){var n=this,i=F((t=t||[])||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e);var o=T(e);if(o.length){a(o,(function(e){n.isIgnorableWhiteSpaceNode(e)||n.getSelfOrAncestorWithClass(e)||!n.isModifiable(e)||n.applyToTextNode(e,i)}));var r=o[o.length-1];e.setStartAndEnd(o[0],0,r,r.length),n.normalize&&n.postApply(o,e,i,!1),H(t,i)}var s=n.getEmptyElements(e);a(s,(function(e){f(e,n.className)}))},applyToRanges:function(e){for(var t=e.length;t--;)this.applyToRange(e[t],e);return e},applyToSelection:function(t){var n=e.getSelection(t);n.setRanges(this.applyToRanges(n.getAllRanges()))},undoToRange:function(e,t){var n=this,i=F(t=t||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e,i);var o,r,s=T(e),l=s[s.length-1];if(s.length){n.splitAncestorWithClass(e.endContainer,e.endOffset,i),n.splitAncestorWithClass(e.startContainer,e.startOffset,i);for(var u=0,c=s.length;u<c;++u)o=s[u],(r=n.getSelfOrAncestorWithClass(o))&&n.isModifiable(o)&&n.undoToAncestor(r,i);e.setStartAndEnd(s[0],0,l,l.length),n.normalize&&n.postApply(s,e,i,!0),H(t,i)}var d=n.getEmptyElements(e);a(d,(function(e){p(e,n.className)}))},undoToRanges:function(e){for(var t=e.length;t--;)this.undoToRange(e[t],e);return e},undoToSelection:function(t){var n=e.getSelection(t),i=e.getSelection(t).getAllRanges();this.undoToRanges(i),n.setRanges(i)},isAppliedToRange:function(e){if(e.collapsed||""==e.toString())return!!this.getSelfOrAncestorWithClass(e.commonAncestorContainer);var t=e.getNodes([3]);if(t.length)for(var n,i=0;n=t[i++];)if(!this.isIgnorableWhiteSpaceNode(n)&&M(e,n)&&this.isModifiable(n)&&!this.getSelfOrAncestorWithClass(n))return!1;return!0},isAppliedToRanges:function(e){var t=e.length;if(0==t)return!1;for(;t--;)if(!this.isAppliedToRange(e[t]))return!1;return!0},isAppliedToSelection:function(t){var n=e.getSelection(t);return this.isAppliedToRanges(n.getAllRanges())},toggleRange:function(e){this.isAppliedToRange(e)?this.undoToRange(e):this.applyToRange(e)},toggleSelection:function(e){this.isAppliedToSelection(e)?this.undoToSelection(e):this.applyToSelection(e)},getElementsWithClassIntersectingRange:function(e){var t=[],n=this;return e.getNodes([3],(function(e){var i=n.getSelfOrAncestorWithClass(e);i&&!o(t,i)&&t.push(i)})),t},detach:function(){}},$.util={hasClass:h,addClass:f,removeClass:p,getClass:g,hasSameClasses:y,hasAllClasses:b,replaceWithOwnChildren:S,elementsHaveSameNonClassAttributes:A,elementHasNonClassAttributes:k,splitNodeAt:z,isEditableElement:D,isEditingHost:O,isEditable:P},e.CssClassApplier=e.ClassApplier=$,e.createClassApplier=Z,r.createAliasForDeprecatedMethod(e,"createCssClassApplier","createClassApplier",t)})),t)}({get exports(){return Bv},set exports(e){Bv=e}});var jv={toolbar:{allowMultiParagraphSelection:!0,buttons:["bold","colorpicker","italic","underline","strikethrough","quote","justifyLeft","justifyCenter","justifyRight","justifyFull","superscript","subscript","orderedlist","unorderedlist","pre","removeFormat","outdent","indent","h2","h3"],standardizeSelectionStart:!1,updateOnEmptySelection:!1},placeholder:{text:"请输入内容",hideOnClick:!0},disableEditing:!0},Fv=xv.extensions.button.extend({name:"colorpicker",tagNames:["mark"],contentDefault:"<b>Color</b>",aria:"Color Picker",action:"colorPicker",init:function(){var e=this;Lv.init(),xv.extensions.button.prototype.init.call(this),this.colorPicker=new Pv({parent:this.button,color:"#000",onDone:function(t){e.coloredText&&e.coloredText.isAppliedToSelection()&&e.coloredText.undoToSelection(),e.coloredText=Lv.createClassApplier("colored",{elementTagName:"span",elementProperties:{style:{color:t.hex}},normalize:!0}),e.coloredText.toggleSelection(),e.base.checkContentChanged(),e.setInactive()}})},getButton:function(){return this.button},handleClick:function(){this.setActive(),this.colorPicker.show()},isAlreadyApplied:function(e){return"mark"===e.nodeName.toLowerCase()},isActive:function(){return this.button.classList.contains("medium-editor-button-active")},setInactive:function(){this.button.classList.remove("medium-editor-button-active")},setActive:function(){this.button.classList.add("medium-editor-button-active")}}),Hv=function(e){function n(t){var n=e.call(this,t)||this;n.labelMap=new Map;var i=t.lf,o=t.graphModel;return n.lf=i,n.graphModel=o,n.state={tick:0},n}return g(n,e),n.prototype.componentDidMount=function(){var e=this,t=this.props.graphModel;this.editor=new xv(".lf-label-editor",xd(jv,{autoLink:!0,extensions:{colorPicker:new Fv}})),t.eventCenter.on("text:update,node:mousemove,node:resize,node:rotate,node:drag,label:drop,node:drop",(function(){})),t.eventCenter.on("node:properties-change,node:properties-delete",(function(){e.setState({tick:e.state.tick+1})}))},n.prototype.componentDidUpdate=function(){var e;this.editor&&this.editor.elements.length>0?this.editor.addElements(".lf-label-editor"):(null===(e=this.editor)||void 0===e||e.destroy(),this.editor=new xv(".lf-label-editor",xd(jv,{autoLink:!0,extensions:{colorPicker:new Fv}})))},n.prototype.componentWillUnmount=function(){var e;null===(e=this.editor)||void 0===e||e.destroy()},n.prototype.getLabels=function(){var e=this,t=this.props,n=t.lf.extension,i=t.graphModel,o=C(C([],E(i.nodes),!1),E(i.edges),!1);if(n.label){var r=[];return Cu(o,(function(t){var n,o;Cu(null!==(o=null===(n=t.getData().properties)||void 0===n?void 0:n._label)&&void 0!==o?o:[],(function(n){var o=e.labelMap,a=new bv(n,t,i);o.set(a.id,a),r.push(Ip(mv,{label:a,element:t,graphModel:i},a.id))}))})),r}return null},n.prototype.render=function(){return Ip("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},n.toolName="label-edit-tool",n=y([t.observer],n)}(t.Component),Wv=function(){function e(e){var n,i,o,r=e.lf,a=e.options;this.labelInitPositionMap=new Map,this.lf=r,this.options=null!=a?a:{},this.textOverflowMode=null!==(n=a.textOverflowMode)&&void 0!==n?n:"default",this.isMultiple=null===(i=a.isMultiple)||void 0===i||i,this.labelWidth=a.labelWidth,this.maxCount=null!==(o=a.maxCount)&&void 0!==o?o:1/0,r.graphModel.editConfigModel.updateTextMode(t.TextMode.LABEL),this.addEventListeners(),this.rewriteShortcut(),r.tool.registerTool(Hv.toolName,Hv),r.tool.disableTool("text-edit-tool")}return e.prototype.formatConfig=function(e,n){var i=e.editConfigModel,o=i.nodeTextEdit,r=i.edgeTextEdit,a=i.nodeTextDraggable,s=i.edgeTextDraggable,l=this,u=l.textOverflowMode,c=l.isMultiple,d=l.maxCount,h=l.labelWidth,f=n.text,p=n.zIndex,g=n.properties,m=g._label,y=g._labelOption,b=m,x=void 0===y?{}:y,w=x.isMultiple,E=x.maxCount,C=[];if(ot(b)){var N=null!=E?E:d;C=c&&w?b.length>N?b.slice(0,N):b:[b[0]]}else if(gt(b))C=[b];else if("string"==typeof b||!b){var _=v(v({},f),{content:b||(null==f?void 0:f.value),draggable:"edge"===n.BaseType?s:a});C=_.value?[_]:[]}return"edge"===n.BaseType&&(C=tc(C,(function(e){return e}))),tc(C,(function(e){e.id||(e.id=t.createUuid());var i=e.value,l=e.content,c=e.vertical,d=e.editable,f=e.draggable,g=e.textOverflowMode,m="node"===n.BaseType?o:r,y="node"===n.BaseType?a:s;return v(v({},e),{zIndex:p,labelWidth:h,content:null!=l?l:i,vertical:null!=c&&c,editable:Boolean(m)&&d,draggable:Boolean(y)&&f,textOverflowMode:null!=g?g:u})}))},e.prototype.setupLabels=function(e){var t=this;Cu(e.sortElements,(function(n){t.rewriteInnerMethods(n);var i=t.formatConfig(e,n);n.setProperty("_label",i)}))},e.prototype.addLabel=function(e,n){var i,o,r,a=this.isMultiple,s=this.maxCount,l=e.properties,u=null!==(i=l._label)&&void 0!==i?i:[],c=null!==(o=l._labelOption)&&void 0!==o?o:{},d=u.length,h={id:t.createUuid(),x:n.x,y:n.y,content:"Label".concat(d+1),value:"Label".concat(d+1),style:{},draggable:!0,editable:!0,vertical:!1};!a||a&&!1===c.isMultiple||d>=(null!==(r=null==c?void 0:c.maxCount)&&void 0!==r?r:s)||(u.push(h),e.setProperty("_label",u))},e.prototype.addEventListeners=function(){var e=this,n=this.lf.graphModel,i=n.eventCenter,o=n.editConfigModel;i.on("graph:rendered",(function(t){var n=t.graphModel;e.setupLabels(n)})),i.on("node:dbclick,edge:dbclick",(function(i){var r=i.e,a=i.data,s=n.getElement(a.id),l=n.getPointByClient({x:r.clientX,y:r.clientY}).canvasOverlayPosition,u={x:l.x,y:l.y};s&&o.textMode===t.TextMode.LABEL&&e.addLabel(s,u)})),i.on("node:resize",(function(e){var t,n,i=e.preData,o=e.data,r=e.model,a=null!==(t=i.properties)&&void 0!==t?t:{},s=a.width,l=a.height,u=a._label,c=void 0===u?[]:u,d=null!==(n=o.properties)&&void 0!==n?n:{},h=d.width,f=d.height;if(s&&l&&h&&f){var p={x:i.x,y:i.y,width:s,height:l},g={x:o.x,y:o.y,width:h,height:f},m=tc(c,(function(e){var t,n,i,o,r,a,s,l,u,c,d,h=e.x,f=e.y,m=(n=g,i={x:h,y:f},o=(t=p).x,r=t.y,a=t.width,s=t.height,l=n.x,u=n.y,c=n.width,d=n.height,{x:l+(i.x-o)/a*c,y:u+(i.y-r)/s*d});return v(v({},e),m)}));r.setProperty("_label",m)}})),i.on("node:rotate",(function(t){var n=t.model,i=n.x,o=n.y,r=n.rotate,a=n.properties._label,s={x:i,y:o},l=tc(void 0===a?[]:a,(function(t){if(!t.id)return t;var n={x:t.x,y:t.y};e.labelInitPositionMap.has(t.id)?n=e.labelInitPositionMap.get(t.id):e.labelInitPositionMap.set(t.id,n);var i=r*(180/Math.PI);i<0&&(i+=360);var o=i*(Math.PI/180),a=ev(n,s,o);return v(v(v({},t),a),{rotate:i})}));n.setProperty("_label",l)})),i.on("node:dnd-add,node:add,edge:add",(function(t){var i=t.data,o=n.getElement(i.id);if(o){e.rewriteInnerMethods(o);var r=o.properties._label;if(!ot(r)||0===r.length||!r[0].id){var a=e.formatConfig(n,i);o.setProperty("_label",a)}}}))},e.prototype.rewriteInnerMethods=function(e){e.moveText=function(t,n){if(e.text){var i=e.text,o=i.x,r=i.y,a=i.value,s=i.draggable,l=i.editable;e.text={value:a,editable:l,draggable:s,x:o+t,y:r+n};var u=Fs(e.getProperties());if(ot(u._label)){var c=tc(u._label,(function(e){return v(v({},e),{x:e.x+t,y:e.y+n})}));null==e||e.setProperty("_label",c)}}}},e.prototype.rewriteShortcut=function(){var e=this,n=this.lf,i=n.keyboard,o=n.graphModel,r=i.options.keyboard;i.off(["backspace"]),i.on(["backspace"],(function(){if(!(null==r?void 0:r.enabled))return!0;if(o.textEditElement)return!0;var n=o.getSelectElements(!0);e.lf.clearSelectElements();var i=e.lf.graphModel.editConfigModel;return n.edges.forEach((function(n){var r=n.properties;if(r&&!Kc(r._label)&&i.textMode===t.TextMode.LABEL){var a=r._label.filter((function(e){return!e.isSelected}));if(!Yc(a.length,r._label.length)){var s=o.getEdgeModelById(n.id);return void(null==s||s.setProperty("_label",a))}}n.id&&e.lf.deleteEdge(n.id)})),n.nodes.forEach((function(n){var r=n.properties;if(r&&!Kc(r._label)&&i.textMode===t.TextMode.LABEL){var a=r._label.filter((function(e){return!e.isSelected}));if(!Yc(a.length,r._label.length)){var s=o.getNodeModelById(n.id);return void(null==s||s.setProperty("_label",a))}}n.id&&e.lf.deleteNode(n.id)})),!1}))},e.prototype.updateTextMode=function(e){var n=this.lf.graphModel.editConfigModel;e!==n.textMode&&(n.updateTextMode(e),e===t.TextMode.LABEL?(this.lf.tool.enableTool(Hv.toolName),this.lf.tool.disableTool("text-edit-tool")):e===t.TextMode.TEXT&&(this.lf.tool.enableTool("text-edit-tool"),this.lf.tool.disableTool(Hv.toolName)))},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="label",e}(),zv={};function Gv(e){return e.startsWith("data:text/plain")}function Uv(e){return b(this,void 0,void 0,(function(){return x(this,(function(t){return zv[e]?[2,zv[e]]:[2,new Promise((function(t,n){try{fetch(e).then((function(e){return e.blob()})).then((function(i){var o=new FileReader;o.onloadend=function(){t(zv[e]=o.result)},o.onerror=n,o.readAsDataURL(i)})).catch((function(){t(zv[e]=e)}))}catch(t){return zv[e]=e}}))]}))}))}function qv(e,t){return b(this,void 0,void 0,(function(){var n,i;return x(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),(n=e.getAttribute(t)||"").startsWith("data:")?[2]:[4,Uv(n)];case 1:return Gv(i=o.sent())?[2]:(e.setAttribute(t,i),[3,3]);case 2:return o.sent(),[3,3];case 3:return[2]}}))}))}function Xv(e,t){return b(this,void 0,void 0,(function(){var n;return x(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t.startsWith("data:")?[2]:[4,Uv(t)];case 1:return Gv(n=i.sent())?[2]:(e.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return i.sent(),[3,3];case 3:return[2]}}))}))}function Vv(e){return b(this,void 0,void 0,(function(){var t,n,i,o,r,a,s,l,u;return x(this,(function(c){switch(c.label){case 0:for(t=[e],i=[];t.length;)(n=t.shift()).children.length&&t.push.apply(t,C([],E(n.children),!1)),n instanceof HTMLElement&&(o=n.style,r=o.background,a=o.backgroundImage,(s=r.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(u=s[1],i.push(Xv(n,u))),(l=a.match(/url\(["']?(.*?)["']?\)/))&&l[1]&&(u=l[1],i.push(Xv(n,u)))),n instanceof HTMLImageElement?i.push(qv(n,"src")):n instanceof SVGImageElement&&i.push(qv(n,"href"));return[4,Promise.all(i)];case 1:return c.sent(),[2]}}))}))}function Kv(e,t,n){var i=document.createElement("canvas");i.width=t,i.height=n;var o=i.getContext("2d");return o&&o.drawImage(e,0,0,e.width,e.height,0,0,t,n),i}var Yv=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.customCssRules="",this.useGlobalRules=!0,t.getSnapshot=function(e,t){return b(n,void 0,void 0,(function(){return x(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshot(e,t)];case 1:return[2,n.sent()]}}))}))},t.getSnapshotBlob=function(e,t,i){return b(n,void 0,void 0,(function(){return x(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBlob(e,t,i)];case 1:return[2,n.sent()]}}))}))},t.getSnapshotBase64=function(e,t,i){return b(n,void 0,void 0,(function(){return x(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBase64(e,t,i)];case 1:return[2,n.sent()]}}))}))}}return e.prototype.getSvgRootElement=function(e){return e.container.querySelector(".lf-canvas-overlay")},e.prototype.triggerDownload=function(e){var t=new MouseEvent("click",{view:document.defaultView,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",this.fileName),n.setAttribute("href",e),n.setAttribute("target","_blank"),n.dispatchEvent(t)},e.prototype.removeAnchor=function(e){for(var t=e.childNodes,n=e.childNodes&&e.childNodes.length,i=0;i<n;i++){var o=t[i];(o.classList&&Array.from(o.classList)||[]).indexOf("lf-anchor")>-1&&(e.removeChild(e.childNodes[i]),n--,i--)}},e.prototype.removeRotateControl=function(e){for(var t=e.childNodes,n=e.childNodes&&e.childNodes.length,i=0;i<n;i++){var o=t[i];(o.classList&&Array.from(o.classList)||[]).indexOf("lf-rotate-control")>-1&&(e.removeChild(e.childNodes[i]),n--,i--)}},e.prototype.convertImageToBase64=function(e){return b(this,void 0,void 0,(function(){return x(this,(function(t){return[2,new Promise((function(t,n){var i=new Image;i.crossOrigin="anonymous",i.onload=function(){var e=document.createElement("canvas");e.width=i.width,e.height=i.height;var n=e.getContext("2d");null==n||n.drawImage(i,0,0);var o=e.toDataURL("image/png");t(o)},i.onerror=function(){n(new Error("Failed to load image: ".concat(e)))},i.src=e}))]}))}))},e.prototype.isRelativePath=function(e){return!(e.startsWith("data:")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//"))},e.prototype.processImages=function(e){return b(this,void 0,void 0,(function(){var t,n,i,o,r,a,s,l,u,c;return x(this,(function(d){switch(d.label){case 0:t=e.getElementsByTagName("image"),o=0,d.label=1;case 1:if(!(o<t.length))return[3,6];if(l=t[o],!(n=l.getAttributeNS("http://www.w3.org/1999/xlink","href")||l.getAttribute("href"))||!this.isRelativePath(n))return[3,5];d.label=2;case 2:return d.trys.push([2,4,,5]),[4,this.convertImageToBase64(n)];case 3:return c=d.sent(),l.setAttributeNS("http://www.w3.org/1999/xlink","href",c),l.setAttribute("href",c),[3,5];case 4:return d.sent(),[3,5];case 5:return o++,[3,1];case 6:i=e.getElementsByTagName("foreignObject"),o=0,d.label=7;case 7:if(!(o<i.length))return[3,14];r=i[o],a=r.getElementsByTagName("img"),s=0,d.label=8;case 8:if(!(s<a.length))return[3,13];if(l=a[s],!(u=l.getAttribute("src"))||!this.isRelativePath(u))return[3,12];d.label=9;case 9:return d.trys.push([9,11,,12]),[4,this.convertImageToBase64(u)];case 10:return c=d.sent(),l.setAttribute("src",c),[3,12];case 11:return d.sent(),[3,12];case 12:return s++,[3,8];case 13:return o++,[3,7];case 14:return[2]}}))}))},e.prototype.cloneSvg=function(e){return b(this,arguments,void 0,(function(e,t){var n,i,o,r,a,s,l,u,c,d,h=this;return void 0===t&&(t=!0),x(this,(function(f){switch(f.label){case 0:if(n=e.cloneNode(!0),i=n.lastChild,o=null===(d=null==i?void 0:i.childNodes)||void 0===d?void 0:d.length)for(r=0;r<o;r++)a=null==i?void 0:i.childNodes[r],(s=a.classList&&Array.from(a.classList))&&s.indexOf("lf-base")<0?(null==i||i.removeChild(i.childNodes[r]),o--,r--):(l=null==i?void 0:i.childNodes[r])&&l.childNodes.forEach((function(e){var t=e;h.removeAnchor(t.firstChild),h.removeRotateControl(t.firstChild)}));return[4,this.processImages(n)];case 1:return f.sent(),t&&((u=document.createElement("style")).innerHTML=this.getClassRules(),(c=document.createElement("foreignObject")).appendChild(u),n.appendChild(c)),[2,n]}}))}))},e.prototype.getClassRules=function(){var e="";if(this.useGlobalRules)for(var t=document.styleSheets,n=0;n<t.length;n++){var i=t[n];try{for(var o=0;o<i.cssRules.length;o++)e+=i.cssRules[o].cssText}catch(e){}}return this.customCssRules&&(e+=this.customCssRules),e},e.prototype.getCanvasDimensionsByBrowser=function(){var e=navigator.userAgent,t=65535,n=4096;return-1!==e.indexOf("Chrome")||-1!==e.indexOf("Edge")?(t=65535,n=4096):-1!==e.indexOf("Firefox")&&(t=32767,n=3814),{maxCanvasDimension:t,otherMaxCanvasDimension:n}},e.prototype.getCanvasData=function(e,t){return b(this,void 0,void 0,(function(){var n,i,o,r,a,s,l,u,c,d,h,f,p,g,v,m,y,b,w,E,C,N,_,S,M,T,A,k,R,D,O,P,I,L,B,j,F,H,W;return x(this,(function(x){switch(x.label){case 0:return n=t.width,i=t.height,o=t.backgroundColor,r=t.padding,a=void 0===r?40:r,[4,this.cloneSvg(e,!1)];case 1:return s=x.sent(),(l=window.devicePixelRatio||1)<1&&(l=1),u=this.lf.graphModel.rootEl.querySelector(".lf-base"),c=u.getBoundingClientRect(),d=this.lf.container.querySelector(".lf-canvas-overlay"),h=d.getBoundingClientRect(),f=c.x-h.x,p=c.y-h.y,g=this.lf.graphModel,v=g.transformModel,m=v.SCALE_X,y=v.SCALE_Y,b=v.TRANSLATE_X,w=v.TRANSLATE_Y,E=t.safetyFactor||1.1,C=c.width/m*E,N=c.height/y*E,_=Math.ceil(C),S=Math.ceil(N),(M=document.createElement("canvas")).style.width="".concat(_,"px"),M.style.height="".concat(S,"px"),T=t.safetyMargin||40,A=this.getCanvasDimensionsByBrowser(),k=A.maxCanvasDimension,R=A.otherMaxCanvasDimension,O=R,I=S*l+2*a+T,L=1,B=1,(P=_*l+2*a+T)>(D=k)&&I>O?(L=D/P,B=O/I):P>O&&I>D?(L=O/P,B=D/I):P>D&&I<O?B=L=D/P:P<O&&I>D&&(B=L=D/I),(L<1||B<1)&&(P=Math.floor(P*L),I=Math.floor(I*B)),s.lastChild.style.transform="matrix(".concat(L,", 0, 0, ").concat(B,", ").concat((-f+b)*(1/m)*L+a/l,", ").concat((-p+w)*(1/y)*B+a/l,")"),M.width=P,M.height=I,(j=M.getContext("2d"))&&(j.clearRect(0,0,M.width,M.height),j.scale(l*L,l*B),o?(j.fillStyle=o,j.fillRect(0,0,M.width,M.height)):j.clearRect(0,0,M.width,M.height)),F=new Image,(H=document.createElement("style")).innerHTML=this.getClassRules(),(W=document.createElement("foreignObject")).appendChild(H),s.appendChild(W),[2,new Promise((function(e){F.onload=function(){var t=navigator.userAgent.indexOf("Firefox")>-1;try{t?createImageBitmap(F,{resizeWidth:n&&i?Kv(M,n,i).width:M.width,resizeHeight:n&&i?Kv(M,n,i).height:M.height}).then((function(t){null==j||j.drawImage(t,0,0),e(n&&i?Kv(M,n,i):M)})):(null==j||j.drawImage(F,0,0),e(n&&i?Kv(M,n,i):M))}catch(t){null==j||j.drawImage(F,0,0),e(n&&i?Kv(M,n,i):M)}};var t="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(s)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");F.src=t}))]}}))}))},e.prototype.withExportPreparation=function(e,t){return b(this,void 0,void 0,(function(){var n,i,o,r,a,s=this;return x(this,(function(l){switch(l.label){case 0:n=this.lf.graphModel.getPartial(),i=(null!=t?t:{}).partial,o=void 0===i?n:i,r=this.lf.getEditConfig(),this.lf.updateEditConfig({isSilentMode:!0,stopScrollGraph:!0,stopMoveGraph:!0}),l.label=1;case 1:return l.trys.push([1,,6,7]),n===o?[3,3]:(this.lf.graphModel.setPartial(o),[4,new Promise((function(t){s.lf.graphModel.eventCenter.once("graph:updated",(function(){return b(s,void 0,void 0,(function(){var i;return x(this,(function(o){switch(o.label){case 0:return[4,e()];case 1:return i=o.sent(),this.lf.graphModel.setPartial(n),t(i),[2]}}))}))}))}))]);case 2:return a=l.sent(),[3,5];case 3:return[4,e()];case 4:a=l.sent(),l.label=5;case 5:return[3,7];case 6:return this.lf.updateEditConfig(r),[7];case 7:return[2,a]}}))}))},e.prototype.getSnapshot=function(e,t){return b(this,void 0,void 0,(function(){var n=this;return x(this,(function(i){switch(i.label){case 0:return[4,this.withExportPreparation((function(){return n.snapshot(e,t)}),t)];case 1:return i.sent(),[2]}}))}))},e.prototype.snapshot=function(e,t){return b(this,void 0,void 0,(function(){var n,i,o,r,a,s,l,u,c,d=this;return x(this,(function(h){switch(h.label){case 0:return i=(n=null!=t?t:{}).fileType,o=void 0===i?"png":i,r=n.quality,this.fileName="".concat(null!=e?e:"logic-flow.".concat(Date.now()),".").concat(o),[4,Vv(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"!==o?[3,3]:[4,this.cloneSvg(a)];case 2:return s=h.sent(),l=(new XMLSerializer).serializeToString(s),u=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(u),this.triggerDownload(c),[3,4];case 3:this.getCanvasData(a,null!=t?t:{}).then((function(e){var t=e.toDataURL("image/".concat(o),r).replace("image/".concat(o),"image/octet-stream");d.triggerDownload(t)})),h.label=4;case 4:return[2]}}))}))},e.prototype.getSnapshotBlob=function(e,t,n){return b(this,void 0,void 0,(function(){var i=this;return x(this,(function(o){switch(o.label){case 0:return[4,this.withExportPreparation((function(){return i.snapshotBlob(n,t,e)}),n)];case 1:return[2,o.sent()]}}))}))},e.prototype.snapshotBlob=function(e,t,n){return b(this,void 0,void 0,(function(){var i,o,r,a=this;return x(this,(function(s){switch(s.label){case 0:return i=(null!=e?e:{}).fileType,o=void 0===i?t:i,[4,Vv(r=this.getSvgRootElement(this.lf))];case 1:return s.sent(),[2,new Promise((function(t){a.getCanvasData(r,v({backgroundColor:n},null!=e?e:{})).then((function(e){e.toBlob((function(n){t({data:n,width:e.width,height:e.height})}),"image/".concat(null!=o?o:"png"))}))}))]}}))}))},e.prototype.getSnapshotBase64=function(e,t,n){return b(this,void 0,void 0,(function(){var i=this;return x(this,(function(o){switch(o.label){case 0:return[4,this.withExportPreparation((function(){return i._getSnapshotBase64(e,t,n)}),n)];case 1:return[2,o.sent()]}}))}))},e.prototype._getSnapshotBase64=function(e,t,n){return b(this,void 0,void 0,(function(){var i,o,r,a=this;return x(this,(function(s){switch(s.label){case 0:return i=(null!=n?n:{}).fileType,o=void 0===i?t:i,[4,Vv(r=this.getSvgRootElement(this.lf))];case 1:return s.sent(),[2,new Promise((function(t){a.getCanvasData(r,v({backgroundColor:e},null!=n?n:{})).then((function(e){var n=e.toDataURL("image/".concat(null!=o?o:"png"));t({data:n,width:e.width,height:e.height})}))}))]}}))}))},e.pluginName="snapshot",e}(),$v=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.paths=[],t.getPathes=function(){if(!n.startNodeType)throw new Error("需要预先指定开始节点类型");return n.getPathes()},t.setRawPaths=function(e){n.setPathes(e)},t.getRawPathes=function(){return n.paths},t.setStartNodeType=function(e){n.startNodeType=e}}return e.prototype.setPathes=function(e){this.paths=e.map((function(e){return{routeId:e.routeId,name:e.name,elements:e.elements,type:e.type,similarElement:null,weight:0}}))},e.prototype.getPathes=function(){var e=this,t=this.lf.getGraphRawData(),n=new Map,i=[];t.nodes.forEach((function(t){n.set(t.id,{id:t.id,data:t,nextNodes:[]}),t.type===e.startNodeType&&i.push(t.id)})),t.edges.forEach((function(e){var t=n.get(e.sourceNodeId);null==t||t.nextNodes.push(e.targetNodeId)}));var o=[];return i.forEach((function(t){var i=n.get(t);i&&(o=o.concat(e.findPathElements(i,n,[])))})),this.getNewPathes(o)},e.prototype.findPathElements=function(e,t,n){void 0===n&&(n=[]);var i=C([],E(n),!1);if(i.push(e.id),0===e.nextNodes.length)return[i];for(var o=[],r=0;r<e.nextNodes.length;r++){var a=t.get(e.nextNodes[r]),s=void 0;if(a){var l=i.indexOf(a.id);s=-1!==l?[C(C([],E(i.slice(l)),!1),[a.id],!1)]:this.findPathElements(a,t,C([],E(i),!1)),o=o.concat(s)}}return o},e.prototype.getNewPathes=function(e){var t=this,n=[],i=new Set;e.forEach((function(e){var o=t.getNewId("path"),r=t.getNewId("路径"),a=t.isLoopPath(e),s=e.join(",");i.has(s)||(i.add(s),n.push({routeId:o,name:r,elements:e,type:a,weight:0,similarElement:""}))}));var o=JSON.parse(JSON.stringify(this.paths));return n.forEach((function(e){for(var n=0;n<o.length;n++){var i=o[n],r=t.similar2Path(C([],E(e.elements),!1),C([],E(i.elements),!1));r>e.weight&&i.weight<=r&&(e.weight=r,e.similarElement=i,r===i.weight&&i.similarElement?(i.similarElement.similarElement=null,i.similarElement.weight=0,i.similarElement=null,i.weight=0):(i.similarElement=e,i.weight=r))}})),n.forEach((function(e){e.similarElement&&e.similarElement.similarElement===e&&(e.routeId=e.similarElement.routeId,e.name=e.similarElement.name),delete e.similarElement,delete e.weight})),this.setPathes(n),n},e.prototype.similar2Path=function(e,t){var n=0,i=e.length+t.length;e.sort(),t.sort();for(var o=e.shift(),r=t.shift();void 0!==o&&void 0!==r;)o===r?(n++,o=e.shift(),r=t.shift()):o<r?o=e.shift():o>r&&(r=t.shift());return n/i*200},e.prototype.getNewId=function(e){return"".concat(e,"_").concat(S())},e.prototype.isLoopPath=function(e){var t=e.length;return e.indexOf(e[t-1])!==t-1?1:0},e.pluginName="flowPath",e}(),Zv=-1,Jv=0,Qv=1,em=function(){function e(e){var t=e.lf,n=this;this.levelHeight=[],this.newNodeMap=new Map,this.lf=t,this.trunk=[],t.layout=function(e){var t=n.lf.getGraphRawData();n.lf.setStartNodeType(e);var i=n.lf.getPathes();return n.levelHeight=[],n.newNodeMap=new Map,n.layout(t,i)}}return e.prototype.layout=function(e,t){var n=this,i=[];t.forEach((function(e){var t=e.elements;t.length>i.length?i=t:t.length===i.length&&JSON.stringify(t)===JSON.stringify(n.trunk)&&(i=n.trunk)})),this.trunk=i;for(var o=this.formatData(e),r={nodes:[],edges:[]},a=i.length-1;a>=0;a--)this.setNodePosition(i[a],o,r,a,1);this.lf.graphModel.graphDataToModel(r)},e.prototype.setNodePosition=function(e,t,n,i,o){var r=this,a=t[e],s=a.text,l=a.type,u=a.next,c=a.properties,d=160*i+40,h=120*o,f={id:e,x:d,text:s,y:h,type:l,properties:c};return s&&"object"==typeof s&&(f.text=v(v({},s),{x:d+s.x,y:h+s.y})),this.newNodeMap.set(f.id,{x:f.x,y:f.y,type:l}),n.nodes.push(f),a.isFixed=!0,this.addLevelHeight(i,1),u&&u.length>0&&u.forEach((function(o){if(!t[o.nodeId].isFixed){var a=r.getLevelHeight(i+1);r.addLevelHeight(i,1),r.setNodePosition(o.nodeId,t,n,i+1,a+1)}n.edges.push(v({id:o.edgeId,type:o.edgeType,sourceNodeId:e,targetNodeId:o.nodeId,properties:o.properties,text:o.text},r.getEdgeDataPoints(e,o.nodeId)))})),f},e.prototype.getEdgeDataPoints=function(e,t){var n=this.newNodeMap.get(e),i=this.newNodeMap.get(t),o=this.getShape(e),r=o.width,a=o.height,s=this.getShape(t),l=s.width,u=s.height,c=this.getRelativePosition(n,i),d={x:n.x,y:n.y},h={x:i.x,y:i.y};switch(c){case Jv:d.x=n.x+r/2,h.x=i.x-l/2;break;case Zv:d.y=n.y+a/2,h.x=i.x-l/2;break;case Qv:d.x=n.x+r/2,h.y=i.y+u/2}return{startPoint:d,endPoint:h}},e.prototype.getRelativePosition=function(e,t){var n=e.y,i=t.y;return n<i?-1:n===i?0:1},e.prototype.getShape=function(e){var t,n,i=this.lf.getNodeModelById(e);return{height:null!==(t=null==i?void 0:i.height)&&void 0!==t?t:0,width:null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0}},e.prototype.formatData=function(e){var t=e.nodes.reduce((function(e,t){var n=t.type,i=t.properties,o=t.text,r=t.x,a=t.y;return o&&"object"==typeof o&&(o.x=o.x-r,o.y=o.y-a),e[t.id]={type:n,properties:i,text:o,prev:[],next:[]},e}),{});return e.edges.forEach((function(e){var n=e.sourceNodeId,i=e.targetNodeId,o=e.id,r=e.properties,a=e.text,s=a;"object"==typeof a&&(s=a.value),t[n].next.push({edgeId:o,nodeId:i,edgeType:e.type,properties:r,text:s}),t[i].prev.push({edgeId:o,nodeId:n,properties:r,text:s})})),t},e.prototype.addLevelHeight=function(e,t,n){void 0===t&&(t=1),void 0===n&&(n=!1);var i=this.levelHeight[e];i||(i={positiveHeight:0,negativeHeight:0},this.levelHeight[e]=i),n?i.negativeHeight-=t:i.positiveHeight+=t},e.prototype.getLevelHeight=function(e,t){void 0===t&&(t=!1);var n=this.levelHeight[e];return n?t?n.negativeHeight:n.positiveHeight:0},e.pluginName="AutoLayout",e}(),tm=function(){function e(e){var t=e.lf,n=e.options;this.enable=!0,this.type="default",this.currentDistance=1/0,this.thresholdDistance=100,this.reverseDirection=!1,this.virtualEdgeStyle={strokeDasharray:"10,10",stroke:"#acacac"},this.lf=t,co(this,n)}return e.prototype.render=function(){this.addEventListeners()},e.prototype.addEventListeners=function(){var e=this;this.lf.graphModel.eventCenter.on("node:dragstart",(function(t){var n=t.data;if("anchor"!==e.type&&e.enable){var i=e.lf.graphModel,o=n.id;e.currentNode=i.getNodeModelById(o)}})),this.lf.graphModel.eventCenter.on("node:drag",(function(){"anchor"!==e.type&&e.handleNodeDrag()})),this.lf.graphModel.eventCenter.on("anchor:dragstart",(function(t){var n=t.data,i=t.nodeModel;e.enable&&"node"!==e.type&&(e.currentNode=i,e.currentAnchor=n)})),this.lf.graphModel.eventCenter.on("anchor:drag",(function(t){var n=t.e,i=n.clientX,o=n.clientY;e.enable&&"node"!==e.type&&e.handleAnchorDrag(i,o)})),this.lf.graphModel.eventCenter.on("node:drop",(function(){e.enable&&"anchor"!==e.type&&e.handleDrop()})),this.lf.graphModel.eventCenter.on("anchor:dragend",(function(n){var i=n.e,o=n.edgeModel;if(e.enable&&"node"!==e.type){var r=e.lf.graphModel.getPointByClient({x:i.clientX,y:i.clientY}).canvasOverlayPosition,a=r.x,s=r.y;if(o&&e.virtualEdge){var l=e.virtualEdge.id,u=o.targetNodeId,c=e.lf.graphModel.getNodeModelById(u);if(c&&t.isInNode({x:a,y:s},c,10))return void e.lf.deleteEdge(l)}e.handleDrop()}}))},e.prototype.handleNodeDrag=function(){var e=this.lf.graphModel.nodes;if(!nd(this.virtualEdge)){var n=this.virtualEdge,i=n.startPoint,o=n.endPoint,r=n.id;t.twoPointDistance(i,o)>this.thresholdDistance&&(this.lf.deleteEdge(r),this.virtualEdge=void 0)}this.currentNode&&this.findClosestAnchorOfNode(this.currentNode,e),this.currentDistance<this.thresholdDistance&&this.addVirtualEdge()},e.prototype.handleDrop=function(){this.addActualEdge(),this.resetData()},e.prototype.handleAnchorDrag=function(e,n){var i=this.lf.graphModel,o=i.getPointByClient({x:e,y:n}).canvasOverlayPosition,r=o.x,a=o.y;if(!nd(r)&&!nd(a)){var s={x:r,y:a},l=i.nodes;if(!nd(this.virtualEdge)){var u=this.virtualEdge,c=u.endPoint,d=u.id;t.twoPointDistance(s,c)>this.thresholdDistance&&(this.lf.deleteEdge(d),this.virtualEdge=void 0)}this.findClosestAnchorOfAnchor(s,l),this.currentDistance<this.thresholdDistance&&this.addVirtualEdge()}},e.prototype.findClosestAnchorOfNode=function(e,n){var i=this;if(!nd(e)&&!Kc(e)){var o,r,a,s,l=e.anchors,u=void 0===l?[]:l,c=e.id;n.forEach((function(e){if(!Yc(e.id,c)){var n=e.anchors;(void 0===n?[]:n).forEach((function(n){u.forEach((function(l){if(i.anchorAllowConnect(e,n,l)){var u=t.twoPointDistance(l,n);(!o||u<o)&&(o=u,r=l,a=n,s=e)}}))}))}})),this.currentDistance=o,this.currentAnchor=r,this.closestAnchor=a,this.closestNode=s}},e.prototype.findClosestAnchorOfAnchor=function(e,n){var i=this;if(!nd(e)){var o,r,a,s=this.currentNode,l=this.currentAnchor;n.forEach((function(n){if(s){var u=n.anchors;(void 0===u?[]:u).forEach((function(s){var u;if(!Yc(null===(u=i.currentAnchor)||void 0===u?void 0:u.id,s.id)&&i.anchorAllowConnect(n,s,l)){var c=t.twoPointDistance(e,s);(!o||c<o)&&(o=c,r=s,a=n)}}))}})),this.currentDistance=o,this.closestAnchor=r,this.closestNode=a}},e.prototype.anchorAllowConnect=function(e,t,n){var i=this.currentNode;if(i){var o=(this.reverseDirection?e.isAllowConnectedAsSource(i,t,n):i.isAllowConnectedAsSource(e,n,t)).isAllPass,r=(this.reverseDirection?i.isAllowConnectedAsTarget(e,t,n):e.isAllowConnectedAsTarget(i,n,t)).isAllPass;return o&&r}},e.prototype.sameEdgeIsExist=function(e){if(nd(this.closestNode)||nd(this.currentNode)||nd(this.closestAnchor)||nd(this.currentAnchor))return!1;if(nd(e))return!1;var t=this,n=t.closestNode.id,i=t.currentNode.id,o=t.closestAnchor.id,r=t.currentAnchor.id,a=t.reverseDirection,s=e.sourceNodeId,l=e.targetNodeId,u=e.sourceAnchorId,c=e.targetAnchorId;return a?Yc(n,s)&&Yc(i,l)&&Yc(o,u)&&Yc(r,c):Yc(i,s)&&Yc(n,l)&&Yc(r,u)&&Yc(o,c)},e.prototype.addVirtualEdge=function(){var e=this,t=Wh(this.lf.graphModel.edges,(function(t,n){return n.virtual?t:t||e.sameEdgeIsExist(n)}),!1);if(!t){if(!nd(this.virtualEdge)){var n=this.virtualEdge.id;if(this.sameEdgeIsExist(this.virtualEdge))return;this.lf.deleteEdge(n)}var i=this,o=i.reverseDirection,r=i.currentNode,a=i.closestNode,s=i.currentAnchor,l=i.closestAnchor;if(!Kc(r)&&!Kc(a)){var u={style:this.virtualEdgeStyle};this.virtualEdge=this.lf.addEdge(o?{sourceNodeId:null==a?void 0:a.id,targetNodeId:null==r?void 0:r.id,sourceAnchorId:null==l?void 0:l.id,targetAnchorId:null==s?void 0:s.id,properties:u}:{sourceNodeId:null==r?void 0:r.id,targetNodeId:null==a?void 0:a.id,sourceAnchorId:null==s?void 0:s.id,targetAnchorId:null==l?void 0:l.id,properties:u}),this.virtualEdge.virtual=!0}}},e.prototype.addActualEdge=function(){if(!nd(this.virtualEdge)){var e=this.virtualEdge,t=e.type,n=e.sourceNodeId,i=e.targetNodeId,o=e.sourceAnchorId,r=e.targetAnchorId,a=e.startPoint,s=e.endPoint,l=e.pointsList;this.lf.deleteEdge(this.virtualEdge.id),this.lf.addEdge({type:t,sourceNodeId:n,targetNodeId:i,sourceAnchorId:o,targetAnchorId:r,startPoint:a,endPoint:s,pointsList:l})}},e.prototype.setVirtualEdgeStyle=function(e){this.virtualEdgeStyle=v(v({},this.virtualEdgeStyle),e)},e.prototype.setThresholdDistance=function(e){Zc(e)&&(this.thresholdDistance=e)},e.prototype.setReverseDirection=function(e){this.reverseDirection=e},e.prototype.setEnable=function(e){this.enable=e,e||this.resetData()},e.prototype.resetData=function(){this.closestNode=void 0,this.currentDistance=1/0,this.currentNode=void 0,this.currentAnchor=void 0,this.closestAnchor=void 0,this.virtualEdge=void 0},e.pluginName="proximityConnect",e}(),nm=function(){function e(e){var t=e.lf,n=this;this.controlItems=[{key:"zoom-out",iconClass:"lf-control-zoomOut",title:"缩小流程图",text:"缩小",onClick:function(){n.lf.zoom(!1)}},{key:"zoom-in",iconClass:"lf-control-zoomIn",title:"放大流程图",text:"放大",onClick:function(){n.lf.zoom(!0)}},{key:"reset",iconClass:"lf-control-fit",title:"恢复流程原有尺寸",text:"适应",onClick:function(){n.lf.resetZoom()}},{key:"undo",iconClass:"lf-control-undo",title:"回到上一步",text:"上一步",onClick:function(){n.lf.undo()}},{key:"redo",iconClass:"lf-control-redo",title:"移到下一步",text:"下一步",onClick:function(){n.lf.redo()}}],this.lf=t}return e.prototype.render=function(e,t){this.destroy();var n=this.getControlTool();this.toolEl=n,t.appendChild(n),this.domContainer=t},e.prototype.destroy=function(){this.domContainer&&this.toolEl&&this.domContainer.contains(this.toolEl)&&this.domContainer.removeChild(this.toolEl)},e.prototype.addItem=function(e){this.controlItems.push(e)},e.prototype.removeItem=function(e){var t=this.controlItems.findIndex((function(t){return t.key===e}));return-1==t?null:this.controlItems.splice(t,1)[0]},e.prototype.getControlTool=function(){var e=this,t="lf-control-item",n="lf-control-item disabled",i=document.createElement("div"),o=[];return i.className="lf-control",this.controlItems.forEach((function(i){var r=document.createElement("div"),a=document.createElement("i"),s=document.createElement("span");switch(r.className=n,i.onClick&&(r.onclick=i.onClick.bind(null,e.lf)),i.onMouseEnter&&(r.onmouseenter=i.onMouseEnter.bind(null,e.lf)),i.onMouseLeave&&(r.onmouseleave=i.onMouseLeave.bind(null,e.lf)),a.className=i.iconClass,s.className="lf-control-text",s.title=i.title,s.innerText=i.text,r.append(a,s),i.text){case"上一步":e.lf.on("history:change",(function(e){var i=e.data.undoAble;r.className=i?t:n}));break;case"下一步":e.lf.on("history:change",(function(e){var i=e.data.redoAble;r.className=i?t:n}));break;default:r.className=t}o.push(r)})),i.append.apply(i,C([],E(o),!1)),i},e.pluginName="control",e}(),im="lf:defaultNodeMenu",om="lf:defaultEdgeMenu",rm="lf:defaultGraphMenu",am="lf:defaultSelectionMenu",sm={nodeMenu:im,edgeMenu:om,graphMenu:rm,selectionMenu:am},lm={nodeMenu:[],edgeMenu:[],graphMenu:[],selectionMenu:[]},um=function(){function e(e){var t=e.lf,n=this;this.__currentData=null,this.__isSilentMode=!1,this.lf=t,this.__menuDOM=document.createElement("ul"),this.__isSilentMode=t.graphModel.editConfigModel.isSilentMode,this.menuTypeMap=new Map,this.init(),this.lf.setMenuConfig=function(e){n.setMenuConfig(e)},this.lf.addMenuConfig=function(e){n.addMenuConfig(e)},this.lf.setMenuByType=function(e){n.setMenuByType(e)},this.lf.changeMenuItemDisableStatus=function(e,t,i){n.changeMenuItemDisableStatus(e,t,i)},this.lf.getMenuConfig=function(e){return n.getMenuConfig(e)},this.lf.resetMenuConfigByType=function(e){n.resetMenuConfigByType(e)}}return e.prototype.init=function(){var e,t,n,i=this;lm.nodeMenu=[{text:"删除",callback:function(e){i.lf.deleteNode(e.id)}},{text:"编辑文本",callback:function(e){i.lf.graphModel.editText(e.id)}},{text:"复制",callback:function(e){i.lf.cloneNode(e.id)}}],null===(e=this.menuTypeMap)||void 0===e||e.set(im,lm.nodeMenu),lm.edgeMenu=[{text:"删除",callback:function(e){i.lf.deleteEdge(e.id)}},{text:"编辑文本",callback:function(e){i.lf.graphModel.editText(e.id)}}],null===(t=this.menuTypeMap)||void 0===t||t.set(om,lm.edgeMenu),lm.graphMenu=[],lm.selectionMenu=[{text:"删除",callback:function(e){i.lf.clearSelectElements(),e.edges.forEach((function(e){return i.lf.deleteEdge(e.id)})),e.nodes.forEach((function(e){return i.lf.deleteNode(e.id)}))}}],null===(n=this.menuTypeMap)||void 0===n||n.set(am,lm.selectionMenu)},e.prototype.showMenu=function(e,t,n,i){if(!this.__isSilentMode&&n&&n.length){var o=this.__menuDOM;if(o){if(o.innerHTML="",o.append.apply(o,C([],E(this.__getMenuDom(n)),!1)),!o.children.length)return;if(o.style.display="block",!i)return o.style.top="".concat(t,"px"),void(o.style.left="".concat(e,"px"));var r=i.width,a=i.height,s=i.clientX,l=i.clientY,u=this.lf.graphModel,c=o.offsetWidth,d=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f=h-s,p=u.rootEl.getBoundingClientRect(),g=p.left+p.width;g<h&&(f=g-s),f<c&&(d=!1),o.style.left="".concat(d?e:e-r,"px");var v=o.offsetHeight,m=!0,y=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=y-l,x=p.top+p.height;x<y&&(b=x-l),b<v&&(m=!1),o.style.top="".concat(m?t:t-a,"px")}}},e.prototype.processMenuConfig=function(e,t){var n=this;if(e){["nodeMenu","edgeMenu","graphMenu","selectionMenu"].forEach((function(i){var o,r,a,s,l=e[i],u=sm[i];if(void 0!==l)if("set"===t)null===(o=n.menuTypeMap)||void 0===o||o.set(u,l||[]);else if("add"===t&&Array.isArray(l)){var c=null!==(a=null===(r=n.menuTypeMap)||void 0===r?void 0:r.get(u))&&void 0!==a?a:[];null===(s=n.menuTypeMap)||void 0===s||s.set(u,c.concat(l))}}))}},e.prototype.createImageElement=function(e,t){var n=document.createElement("img");return n.src=e,n.alt=t,n.style.width="16px",n.style.height="16px",n.style.objectFit="contain",n},e.prototype.isImageFile=function(e){return[".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"].some((function(t){return e.toLowerCase().includes(t)}))},e.prototype.processIcon=function(e,t,n){var i;if("string"==typeof t){var o=t;if(o.startsWith("data:image/")){var r=this.createImageElement(o,n||"icon");e.appendChild(r)}else if(this.isImageFile(o)){r=this.createImageElement(o,n||"icon");e.appendChild(r)}else if(o.includes("<")&&o.includes(">"))e.innerHTML=o;else if(o.includes(" ")||o.startsWith(".")){var a=o.replace(/^\./,"").split(" ");(i=e.classList).add.apply(i,C([],E(a),!1))}else e.classList.add(o)}},e.prototype.__getMenuDom=function(e){var t=this,n=[];return e&&e.length>0&&e.forEach((function(e){var i=document.createElement("li");if(e.className?i.className="lf-menu-item ".concat(e.disabled?"lf-menu-item__disabled":""," ").concat(e.className):i.className="lf-menu-item ".concat(e.disabled?"lf-menu-item__disabled":""),e.icon){var o=document.createElement("span");o.className="lf-menu-item-icon",t.processIcon(o,e.icon,e.text),i.appendChild(o)}var r=document.createElement("span");r.className="lf-menu-item-text",e.text&&(r.innerText=e.text),i.appendChild(r),e.disabled&&i.setAttribute("disabled","true"),i.onclickCallback=e.callback,n.push(i)})),n},e.prototype.updateMenuItemDOMStatus=function(e,t){if(this.__menuDOM&&"none"!==this.__menuDOM.style.display){var n=Array.from(this.__menuDOM.querySelectorAll(".lf-menu-item")).find((function(t){var n=t.querySelector(".lf-menu-item-text");return(null==n?void 0:n.textContent)===e}));if(n){var i=n;t?(i.classList.add("lf-menu-item__disabled"),i.setAttribute("disabled","true")):(i.classList.remove("lf-menu-item__disabled"),i.removeAttribute("disabled"))}}},e.prototype.setupSilentModeListener=function(){var e=this;this.__editConfigChangeHandler=function(t){var n=t.data.isSilentMode;n!==e.__isSilentMode&&(e.__isSilentMode=n,e.updateMenuVisibility(!n))},this.lf.on("editConfig:changed",this.__editConfigChangeHandler)},e.prototype.updateMenuVisibility=function(e){this.__menuDOM&&(e?this.__currentData&&(this.__menuDOM.style.display="block"):(this.__menuDOM.style.display="none",this.__currentData=null))},e.prototype.refreshCurrentMenu=function(){var e,t,n,i,o,r,a,s,l,u,c;if(this.__menuDOM&&"none"!==this.__menuDOM.style.display&&this.__currentData){var d=this.__menuDOM.style,h=d.left,f=d.top,p=[];if(this.__currentData&&"object"==typeof this.__currentData)if("sourceNodeId"in this.__currentData&&"targetNodeId"in this.__currentData){if(v=this.lf.graphModel.getEdgeModelById(this.__currentData.id)){var g=null===(t=this.menuTypeMap)||void 0===t?void 0:t.get(v.type);p=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(i=null===(n=this.menuTypeMap)||void 0===n?void 0:n.get(om))&&void 0!==i?i:[])}}else if("id"in this.__currentData&&"type"in this.__currentData){var v;if(v=this.lf.graphModel.getNodeModelById(this.__currentData.id)){g=null===(o=this.menuTypeMap)||void 0===o?void 0:o.get(v.type);p=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(a=null===(r=this.menuTypeMap)||void 0===r?void 0:r.get(im))&&void 0!==a?a:[])}}else p="nodes"in this.__currentData&&"edges"in this.__currentData?null!==(l=null===(s=this.menuTypeMap)||void 0===s?void 0:s.get(am))&&void 0!==l?l:[]:null!==(c=null===(u=this.menuTypeMap)||void 0===u?void 0:u.get(rm))&&void 0!==c?c:[];p&&p.length>0?(this.__menuDOM.innerHTML="",(e=this.__menuDOM).append.apply(e,C([],E(this.__getMenuDom(p)),!1)),h&&(this.__menuDOM.style.left=h),f&&(this.__menuDOM.style.top=f)):(this.__menuDOM.style.display="none",this.__currentData=null)}},e.prototype.setMenuByType=function(e){var t,n=e.type,i=e.menu;n&&i&&(null===(t=this.menuTypeMap)||void 0===t||t.set(n,i),this.refreshCurrentMenu())},e.prototype.getMenuConfig=function(e){var t,n;return null!==(n=null===(t=this.menuTypeMap)||void 0===t?void 0:t.get(sm[e]))&&void 0!==n?n:[]},e.prototype.resetMenuConfigByType=function(e){var t;this.setMenuConfig(((t={})[e]=lm[e],t))},e.prototype.resetAllMenuConfig=function(){this.setMenuConfig(lm)},e.prototype.setMenuConfig=function(e){this.processMenuConfig(e,"set"),this.refreshCurrentMenu()},e.prototype.addMenuConfig=function(e){this.processMenuConfig(e,"add"),this.refreshCurrentMenu()},e.prototype.changeMenuItem=function(e,t){if("add"===e)this.addMenuConfig(t);else{if("reset"!==e)throw new Error("The first parameter of changeMenuConfig should be 'add' or 'reset'");this.setMenuConfig(t)}},e.prototype.changeMenuItemDisableStatus=function(e,t,n){var i,o;if(e&&t){var r=null!==(o=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(sm[e]))&&void 0!==o?o:[];if(r.length){var a=r.find((function(e){return e.text===t}));a&&(a.disabled=n,this.updateMenuItemDOMStatus(t,n))}}},e.prototype.render=function(e,t){var n=this;e.graphModel.editConfigModel.isSilentMode||(this.__container=t,this.__currentData=null,this.setupSilentModeListener(),this.__menuDOM&&(this.__menuDOM.className="lf-menu",t.appendChild(this.__menuDOM),this.__menuDOM.addEventListener("click",(function(e){e.stopPropagation();for(var t=e.target;-1===Array.from(t.classList).indexOf("lf-menu-item")&&-1===Array.from(t.classList).indexOf("lf-menu");)t=null==t?void 0:t.parentElement;Array.from(t.classList).indexOf("lf-menu-item__disabled")>-1||Array.from(t.classList).indexOf("lf-menu-item")>-1&&(t.onclickCallback(n.__currentData,t),n.__menuDOM&&(n.__menuDOM.style.display="none"),n.__currentData=null)}),!0)),this.lf.on("node:contextmenu",(function(e){var t,i,o=e.data,r=e.position,a=e.e,s=r.domOverlayPosition,l=s.x,u=s.y,c=o.id,d=n.lf.graphModel.getNodeModelById(c);if(d&&!n.__isSilentMode){var h=[],f=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(d.type);h=d&&d.menu&&Array.isArray(d.menu)?d.menu:f||(null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(im)),n.__currentData=o,n.showMenu(l,u,h,{width:d.width,height:d.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(e){var t,i,o,r=e.data,a=e.position,s=e.e,l=a.domOverlayPosition,u=l.x,c=l.y,d=r.id,h=n.lf.graphModel.getEdgeModelById(d);if(h&&!n.__isSilentMode){var f=[],p=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(h.type);f=h&&h.menu&&Array.isArray(h.menu)?h.menu:p||(null!==(o=null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(om))&&void 0!==o?o:[]),n.__currentData=r,n.showMenu(u,c,f,{width:h.width,height:h.height,clientX:s.clientX,clientY:s.clientY})}})),this.lf.on("blank:contextmenu",(function(e){var t,i,o=e.position;if(!n.__isSilentMode){var r=null!==(i=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(rm))&&void 0!==i?i:[],a=o.domOverlayPosition,s=a.x,l=a.y;n.__currentData=v({},o.canvasOverlayPosition),n.showMenu(s,l,r)}})),this.lf.on("selection:contextmenu",(function(e){var t,i=e.data,o=e.position;if(!n.__isSilentMode){var r=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(am),a=o.domOverlayPosition,s=a.x,l=a.y;n.__currentData=i,n.showMenu(s,l,r)}})),this.lf.on("node:mousedown",(function(){n.__menuDOM.style.display="none"})),this.lf.on("edge:click",(function(){n.__menuDOM.style.display="none"})),this.lf.on("blank:click",(function(){n.__menuDOM.style.display="none"})))},e.prototype.destroy=function(){var e;this.__editConfigChangeHandler&&this.lf.off("editConfig:changed",this.__editConfigChangeHandler),this.__menuDOM&&(null===(e=null==this?void 0:this.__container)||void 0===e||e.removeChild(this.__menuDOM),this.__menuDOM=void 0)},e.pluginName="menu",e}(),cm="menu-common",dm=function(){function e(e){var t=e.lf,n=this;this.menuTypeMap=new Map,this.listenDelete=function(){n.hideContextMenu()},this.lf=t,this.__menuDOM=document.createElement("div"),this.__menuDOM.className="lf-inner-context",this.menuTypeMap.set(cm,[]),this.lf.setContextMenuByType=function(e,t){n.setContextMenuByType(e,t)},this.lf.setContextMenuItems=function(e){n.setContextMenuItems(e)},this.lf.showContextMenu=function(e){n.showContextMenu(e)},this.lf.hideContextMenu=function(){n.hideContextMenu()}}return e.prototype.render=function(e,t){var n=this;this.container=t,e.on("node:click",(function(e){var t=e.data;n._activeData=t,n.createContextMenu()})),e.on("edge:click",(function(e){var t=e.data;n._activeData=t,n.createContextMenu()})),e.on("blank:click",(function(){n.hideContextMenu()}))},e.prototype.setContextMenuByType=function(e,t){this.menuTypeMap.set(e,t)},e.prototype.hideContextMenu=function(){this.__menuDOM.innerHTML="",this.__menuDOM.style.display="none",this.isShow&&this.container.removeChild(this.__menuDOM),this.lf.off("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!1},e.prototype.showContextMenu=function(e){e&&e.id&&(this._activeData=e,this.createContextMenu())},e.prototype.setContextMenuItems=function(e){this.menuTypeMap.set(cm,e)},e.prototype.getContextMenuPosition=function(){var e=this._activeData,t=this.lf.graphModel.getElement(e.id);if(t){var n,i;if("edge"===t.BaseType){n=Number.MIN_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER;var o=t.getData();n=Math.max(o.startPoint.x,n),i=Math.min(o.startPoint.y,i),n=Math.max(o.endPoint.x,n),i=Math.min(o.endPoint.y,i),o.pointsList&&o.pointsList.forEach((function(e){n=Math.max(e.x,n),i=Math.min(e.y,i)}))}return"node"===t.BaseType&&(n=e.x+t.width/2,i=e.y-t.height/2),this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([n,i])}},e.prototype.createContextMenu=function(){var e=this;if(!this.lf.options.isSilentMode){var t=C(C([],E(this.menuTypeMap.get(this._activeData.type)||[]),!1),E(this.menuTypeMap.get(cm)||[]),!1),n=document.createDocumentFragment();t.forEach((function(t){var i=document.createElement("div");i.className="lf-context-item";var o=document.createElement("img");o.src=t.icon,o.className="lf-context-img",t.className&&(i.className="".concat(i.className," ").concat(t.className)),o.addEventListener("click",(function(){e.hideContextMenu(),t.callback?t.callback(e._activeData):e.addNode({sourceId:e._activeData.id,x:e._activeData.x,y:e._activeData.y,properties:t.properties,type:t.type})})),i.appendChild(o),n.appendChild(i)})),this.__menuDOM.innerHTML="",this.__menuDOM.appendChild(n),this.showMenu()}},e.prototype.addNode=function(e,t){var n=void 0!==t;void 0===t&&(t=e.y);var i=this.lf.getNodeModelById(e.sourceId);if(i){var o=e.x-i.width+200,r=t-e.y/2-20,a=e.x+i.width+200,s=t+e.y/2+20;if(this.lf.getAreaElement([o,r],[a,s]).length)return t+=100,void this.addNode(e,t);if(e.type){var l=this.lf.addNode({type:e.type,x:e.x+200,y:t,properties:e.properties}),u=void 0,c=void 0;n&&(u={x:e.x,y:e.y+i.height/2},c={x:l.x-l.width/2,y:l.y}),this.lf.addEdge({sourceNodeId:e.sourceId,targetNodeId:l.id,startPoint:u,endPoint:c})}}},e.prototype.showMenu=function(){var e=this.getContextMenuPosition();if(e){var t=E(e,2),n=t[0],i=t[1];this.__menuDOM.style.display="flex",this.__menuDOM.style.top="".concat(i,"px"),this.__menuDOM.style.left="".concat(n+10,"px"),this.container.appendChild(this.__menuDOM),!this.isShow&&this.lf.on("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!0}},e.pluginName="contextMenu",e}(),hm=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.lf.setPatternItems=function(e){n.setPatternItems(e)}}return e.prototype.render=function(e,t){var n=this;this.destroy(),this.shapeList&&0!==this.shapeList.length?(this.panelEl=document.createElement("div"),this.panelEl.className="lf-dndpanel",this.shapeList.forEach((function(e){var t;null===(t=n.panelEl)||void 0===t||t.appendChild(n.createDndItem(e))})),t.appendChild(this.panelEl),this.domContainer=t):this.domContainer=t},e.prototype.destroy=function(){this.domContainer&&this.panelEl&&this.domContainer.contains(this.panelEl)&&this.domContainer.removeChild(this.panelEl)},e.prototype.setPatternItems=function(e){this.shapeList=e,this.domContainer&&this.render(this.lf,this.domContainer)},e.prototype.createDndItem=function(e){var t=this,n=document.createElement("div");n.className=e.className?"lf-dnd-item ".concat(e.className):"lf-dnd-item";var i=document.createElement("div");if(i.className="lf-dnd-shape",e.icon&&(i.style.backgroundImage="url(".concat(e.icon,")")),n.appendChild(i),e.label){var o=document.createElement("div");o.innerText=e.label,o.className="lf-dnd-text",n.appendChild(o)}return e.disabled?(n.classList.add("disabled"),n.onmousedown=function(){e.callback&&e.callback(t.lf,t.domContainer)},n):(n.onmousedown=function(){e.type&&t.lf.dnd.startDrag({type:e.type,properties:e.properties,text:e.text}),e.callback&&e.callback(t.lf,t.domContainer)},n.ondblclick=function(n){t.lf.graphModel.eventCenter.emit("dnd:panel-dbclick",{e:n,data:e})},n.onclick=function(n){t.lf.graphModel.eventCenter.emit("dnd:panel-click",{e:n,data:e})},n.oncontextmenu=function(n){t.lf.graphModel.eventCenter.emit("dnd:panel-contextmenu",{e:n,data:e})},n)},e.pluginName="dndPanel",e}(),fm=function(){function e(e){var t=e.lf,i=e.LogicFlow,o=e.options,r=this;this.width=200,this.height=150,this.scale=1,this.translateX=0,this.translateY=0,this.showEdge=!1,this.viewPortTop=0,this.viewPortLeft=0,this.viewPortWidth=150,this.viewPortHeight=75,this.isShow=!1,this.isShowHeader=!1,this.isShowCloseIcon=!1,this.headerTitle="导航",this.disabledPlugins=["miniMap","control","selectionSelect"],this.onGraphResize=function(){r.updateViewPortBounds(),r.isShow&&r.updateViewPort()},this.render=function(e,t){r.container=t,r.lf.on("history:change",(function(){r.isShow&&r.setView()})),r.lf.on("graph:transform",(function(){r.isShow&&r.setView(!1)}))},this.show=function(e,t){r.isShow||(r.initMiniMap(),r.lf.on("graph:resize",r.onGraphResize),r.createMiniMap(e,t),r.setView(!0)),r.isShow=!0},this.hide=function(){r.isShow&&(n.destroyTeleportContainer(r.lfMap.graphModel.flowId),r.lf.off("graph:resize",r.onGraphResize),r.lfMap.destroy(),r.translateX=0,r.translateY=0,r.removeMiniMap(),r.lf.emit("miniMap:close",{})),r.isShow=!1},this.updatePosition=function(e){if("object"==typeof e)void 0===e.left&&void 0===e.right||(r.leftPosition=e.left,r.rightPosition=e.right),void 0===e.top&&void 0===e.bottom||(r.topPosition=e.top,r.bottomPosition=e.bottom);else switch(e){case"left-top":r.leftPosition=0,r.rightPosition=void 0,r.topPosition=0,r.bottomPosition=void 0;break;case"right-top":r.leftPosition=void 0,r.rightPosition=0,r.topPosition=0,r.bottomPosition=void 0;break;case"left-bottom":r.leftPosition=0,r.rightPosition=void 0,r.topPosition=void 0,r.bottomPosition=0;break;case"right-bottom":r.leftPosition=void 0,r.rightPosition=0,r.topPosition=void 0,r.bottomPosition=0}r.updateMiniMapPosition()},this.reset=function(){r.lf.resetTranslate(),r.lf.resetZoom()},this.setShowEdge=function(e){r.showEdge!==e&&(r.showEdge=e,r.setView())},this.startDrag=function(e){document.addEventListener("mousemove",r.drag),document.addEventListener("mouseup",r.drop);var t=e.x,n=e.y;r.startPosition={x:t,y:n}},this.drag=function(e){var t=e.x,n=e.y,i=(t-r.startPosition.x)/r.scale,o=(n-r.startPosition.y)/r.scale,a=r.viewPortLeft+i+r.viewPortWidth/r.scale/2,s=r.viewPortTop+o+r.viewPortHeight/r.scale/2;r.startPosition={x:t,y:n},r.lf.focusOn({coordinate:{x:a,y:s}})},this.drop=function(){document.removeEventListener("mousemove",r.drag),document.removeEventListener("mouseup",r.drop)},this.mapClick=function(e){var t=e.offsetX,n=e.offsetY,i=r.translateX+t/r.scale,o=r.translateY+n/r.scale;r.lf.focusOn({coordinate:{x:i,y:o}})},this.lf=t,this.LFCtor=i,o&&this.setOption(o),this.viewPortWidth=t.graphModel.width,this.viewPortHeight=t.graphModel.height;var a={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=a,this.elementAreaBounds=a,this.viewPortBounds=a}return e.prototype.setOption=function(e){var t=e.width,n=void 0===t?150:t,i=e.height,o=void 0===i?220:i,r=e.showEdge,a=void 0!==r&&r,s=e.isShowHeader,l=void 0!==s&&s,u=e.isShowCloseIcon,c=void 0!==u&&u,d=e.leftPosition,h=e.topPosition,f=e.rightPosition,p=void 0===f?0:f,g=e.bottomPosition,v=void 0===g?0:g,m=e.headerTitle,y=void 0===m?"导航":m;this.width=n,this.height=o,this.showEdge=a,this.isShowHeader=l,this.isShowCloseIcon=c,this.leftPosition=d,this.rightPosition=void 0!==d?void 0:p,this.topPosition=h,this.bottomPosition=void 0!==h?void 0:v,this.headerTitle=y},e.prototype.initMiniMap=function(){var e=document.createElement("div");e.className="lf-mini-map-graph",e.style.width="".concat(this.width,"px"),e.style.height="".concat(this.height,"px"),this.lfMap=new this.LFCtor({container:e,grid:!1,isSilentMode:!0,stopZoomGraph:!0,stopScrollGraph:!0,stopMoveGraph:!1,history:!1,snapline:!1,disabledPlugins:this.disabledPlugins}),n.createTeleportContainer(e,this.lfMap.graphModel.flowId),this.miniMapWrap=e,this.createViewPort(),e.addEventListener("click",this.mapClick)},e.prototype.createMiniMap=function(e,t){var n,i=document.createElement("div");this.miniMapContainer=i,i.appendChild(this.miniMapWrap),i.style.position="absolute",void 0===e&&void 0===t||(this.leftPosition=e||0,this.topPosition=t||0,this.rightPosition=void 0,this.bottomPosition=void 0),this.updateMiniMapPosition(),i.className="lf-mini-map",this.isShowCloseIcon||i.classList.add("lf-mini-map-no-close-icon"),this.isShowHeader||i.classList.add("lf-mini-map-no-header"),null===(n=this.container)||void 0===n||n.appendChild(i),this.miniMapWrap.appendChild(this.viewport);var o=document.createElement("div");o.className="lf-mini-map-header",o.innerText=this.headerTitle,i.appendChild(o);var r=document.createElement("span");r.className="lf-mini-map-close",r.addEventListener("click",this.hide),i.appendChild(r)},e.prototype.updateMiniMapPosition=function(){if(this.miniMapContainer){var e=this.miniMapContainer.style;void 0!==this.rightPosition?(e.right="".concat(this.rightPosition,"px"),e.left=""):(e.left="".concat(this.leftPosition,"px"),e.right=""),void 0!==this.bottomPosition?(e.bottom="".concat(this.bottomPosition,"px"),e.top=""):(e.top="".concat(this.topPosition,"px"),e.bottom="")}},e.prototype.removeMiniMap=function(){var e;this.miniMapContainer&&(null===(e=this.container)||void 0===e||e.removeChild(this.miniMapContainer))},e.prototype.updateBounds=function(e){e&&this.updateElementAreaBounds(e),this.updateViewPortBounds(),this.bounds={left:Math.min(this.elementAreaBounds.left,this.viewPortBounds.left),right:Math.max(this.elementAreaBounds.right,this.viewPortBounds.right),top:Math.min(this.elementAreaBounds.top,this.viewPortBounds.top),bottom:Math.max(this.elementAreaBounds.bottom,this.viewPortBounds.bottom)}},e.prototype.updateElementAreaBounds=function(e){var t={left:0,right:0,top:0,bottom:0},n=e.nodes;n&&n.length>0&&n.forEach((function(e){var n,i,o=e.x,r=e.y,a=null!==(n=e.width)&&void 0!==n?n:200,s=null!==(i=e.height)&&void 0!==i?i:200,l=o-a/2,u=o+a/2,c=r-s/2,d=r+s/2;t.left=Math.min(l,t.left),t.right=Math.max(u,t.right),t.top=Math.min(c,t.top),t.bottom=Math.max(d,t.bottom)})),this.elementAreaBounds=t},e.prototype.updateViewPortBounds=function(){var e=this.lf.getTransform(),t=e.TRANSLATE_X,n=e.TRANSLATE_Y,i=e.SCALE_X,o=e.SCALE_Y,r=this.lf.graphModel,a=r.width,s=r.height;this.viewPortBounds={left:-t/i,right:(-t+a)/i,top:-n/o,bottom:(-n+s)/o}},e.prototype.resetData=function(e){var t=e.nodes,n=e.edges;return t.forEach((function(e){e.text=void 0})),this.showEdge&&n.forEach((function(e){e.text=void 0})),{nodes:t,edges:this.showEdge?n:[]}},e.prototype.setView=function(e){var t,n;if(void 0===e&&(e=!0),e){var i=this.lf.getGraphRawData(),o=this.resetData(i),r=this.lf.viewMap,a=this.lf.graphModel.modelMap,s=this.lfMap.viewMap;try{for(var l=w(r.keys()),u=l.next();!u.done;u=l.next()){var c=u.value;s.has(c)||this.lfMap.register({type:c,view:r.get(c),model:a.get(c)})}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}this.lfMap.render(o),this.updateBounds(o)}else this.updateBounds();var d=this.bounds,h=d.left,f=d.top,p=d.right-h,g=d.bottom-f,v=this.width/p,m=this.height/g,y=Math.min(v,m);this.scale=y;var b=h-(this.width/y-p)/2,x=f-(this.height/y-g)/2;if(this.lfMap.graphModel.transformModel.translate(-b+this.translateX,-x+this.translateY),this.translateX=b,this.translateY=x,this.miniMapWrap.firstChild){var E=this.miniMapWrap.firstChild.style;E.pointerEvents="none",E.transform="matrix(".concat(y,", 0, 0, ").concat(y,", 0, 0)"),E.transformOrigin="left top",E.height="".concat(this.height/y,"px"),E.width="".concat(this.width/y,"px"),this.updateViewPort()}},e.prototype.updateViewPort=function(){var e=this.viewport.style,t=this.lf.getTransform(),n=t.TRANSLATE_X,i=t.TRANSLATE_Y,o=t.SCALE_X,r=t.SCALE_Y,a=this.lf.graphModel,s=a.width,l=a.height;this.viewPortLeft=-n/o,this.viewPortTop=-i/r,this.viewPortWidth=s/o*this.scale,this.viewPortHeight=l/r*this.scale,e.width="".concat(this.viewPortWidth,"px"),e.height="".concat(this.viewPortHeight,"px"),e.left="".concat((this.viewPortLeft-this.translateX)*this.scale,"px"),e.top="".concat((this.viewPortTop-this.translateY)*this.scale,"px")},e.prototype.createViewPort=function(){var e=document.createElement("div");e.className="lf-minimap-viewport",e.addEventListener("mousedown",this.startDrag),e.addEventListener("click",(function(e){e.stopPropagation()})),this.viewport=e},e.prototype.destroy=function(){n.destroyTeleportContainer(this.lfMap.graphModel.flowId),this.lf.off("graph:resize",this.onGraphResize)},e.pluginName="miniMap",e}(),pm=function(){function e(e){var t,n=e.lf,i=e.options,o=this;this.disabled=!0,this.isWholeNode=!0,this.isWholeEdge=!0,this.exclusiveMode=!1,this.mouseDownInfo=null,this.originalStopMoveGraph=!1,this.handleBlankMouseDown=function(e){var t=e.e;o.handleMouseDown(t)},this.draw=function(e){var t=o.lf.getPointByClient(e.clientX,e.clientY).domOverlayPosition,n=t.x,i=t.y;if(o.endPoint={x:n,y:i},o.startPoint){var r=o.startPoint,a=r.x,s=r.y,l=a,u=s,c=n-a,d=i-s;n<a&&(l=n,c=a-n),i<s&&(u=i,d=s-i),o.wrapper&&(o.wrapper.style.left="".concat(l,"px"),o.wrapper.style.top="".concat(u,"px"),o.wrapper.style.width="".concat(c,"px"),o.wrapper.style.height="".concat(d,"px"))}},this.drawOff=function(e){if(o.mouseDownInfo){var t=o.mouseDownInfo,n=t.x,i=t.y,r=t.time;if(Math.abs(e.clientX-n)<5&&Math.abs(e.clientY-i)<5&&Date.now()-r<200)return o.lf.clearSelectElements(),void o.cleanupSelectionState()}var a=Fs(o.startPoint),s=Fs(o.endPoint);if(document.removeEventListener("mousemove",o.draw),o.exclusiveMode||document.removeEventListener("mouseup",o.drawOff),o.lf.updateEditConfig({stopMoveGraph:o.originalStopMoveGraph}),a&&s){n=a.x,i=a.y;var l=s.x,u=s.y,c=[Math.min(n,l),Math.min(i,u)],d=[Math.max(n,l),Math.max(i,u)];if(o.lf.emit("selection:selected-area",{topLeft:c,bottomRight:d}),Math.abs(l-n)<10&&Math.abs(u-i)<10)return void(o.wrapper&&(o.wrapper.oncontextmenu=null,o.container&&o.wrapper.parentNode===o.container&&o.container.removeChild(o.wrapper),o.wrapper=void 0));var h=o.lf.graphModel.getAreaElement(c,d,o.isWholeEdge,o.isWholeNode,!0),f=o.lf.graphModel,p=f.dynamicGroup,g=f.group,v=[],m=o.lf.getSelectElements(),y=new Set(C(C([],E(m.nodes.map((function(e){return e.id}))),!1),E(m.edges.map((function(e){return e.id}))),!1));h.forEach((function(e){if(g){var t=g.getNodeGroup(e.id);if(h.includes(t))return}if(p){t=p.getGroupByNodeId(e.id);if(h.includes(t))return}o.exclusiveMode&&y.has(e.id)?o.lf.deselectElementById(e.id):(o.lf.selectElementById(e.id,!0),v.push(e))})),o.startPoint=void 0,o.endPoint=void 0,v.length>0&&o.lf.emit("selection:drop",{e:e}),o.lf.emit("selection:selected",{elements:v,leftTopPoint:c,rightBottomPoint:d})}o.wrapper&&(o.wrapper.oncontextmenu=null,o.container&&o.wrapper.parentNode===o.container&&o.container.removeChild(o.wrapper),o.wrapper=void 0)},this.lf=n,this.exclusiveMode=null!==(t=null==i?void 0:i.exclusiveMode)&&void 0!==t&&t,n.openSelectionSelect=function(){o.openSelectionSelect()},n.closeSelectionSelect=function(){o.closeSelectionSelect()},n.setSelectionSelectMode=function(e){o.setExclusiveMode(e)},this.handleMouseDown=this.handleMouseDown.bind(this),this.draw=this.draw.bind(this),this.drawOff=this.drawOff.bind(this)}return e.prototype.render=function(e,t){this.container=t},e.prototype.cleanupSelectionState=function(){this.wrapper&&(this.wrapper.oncontextmenu=null,this.container&&this.wrapper.parentNode===this.container&&this.container.removeChild(this.wrapper),this.wrapper=void 0),this.startPoint=void 0,this.endPoint=void 0,this.mouseDownInfo=null,document.removeEventListener("mousemove",this.draw),document.removeEventListener("mouseup",this.drawOff)},e.prototype.setExclusiveMode=function(e){void 0===e&&(e=!1),this.exclusiveMode!==e&&(this.cleanupSelectionState(),this.exclusiveMode=e,this.container&&!this.disabled&&(this.removeEventListeners(),this.addEventListeners()))},e.prototype.addEventListeners=function(){this.container&&(this.exclusiveMode?(this.container.style.pointerEvents="auto",this.container.addEventListener("mousedown",this.handleMouseDown)):(this.container.style.pointerEvents="none",this.lf.on("blank:mousedown",this.handleBlankMouseDown)))},e.prototype.removeEventListeners=function(){this.container&&(this.container.style.pointerEvents="none",this.container.removeEventListener("mousedown",this.handleMouseDown)),this.lf.off("blank:mousedown",this.handleBlankMouseDown)},e.prototype.handleMouseDown=function(e){var t;if(this.container&&!this.disabled&&!(2===e.button)){this.cleanupSelectionState(),this.mouseDownInfo={x:e.clientX,y:e.clientY,time:Date.now()},this.originalStopMoveGraph=this.lf.getEditConfig().stopMoveGraph,this.lf.updateEditConfig({stopMoveGraph:!0});var n=this.lf.getPointByClient(e.clientX,e.clientY).domOverlayPosition,i=n.x,o=n.y;this.startPoint={x:i,y:o},this.endPoint={x:i,y:o};var r=document.createElement("div");r.className="lf-selection-select",r.oncontextmenu=function(e){e.preventDefault()},r.style.top="".concat(this.startPoint.y,"px"),r.style.left="".concat(this.startPoint.x,"px"),null===(t=this.container)||void 0===t||t.appendChild(r),this.wrapper=r,document.addEventListener("mousemove",this.draw),document.addEventListener("mouseup",this.drawOff)}},e.prototype.setSelectionSense=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),this.isWholeEdge=e,this.isWholeNode=t},e.prototype.openSelectionSelect=function(){this.disabled||this.closeSelectionSelect(),this.container&&(this.cleanupSelectionState(),this.addEventListeners(),this.open())},e.prototype.closeSelectionSelect=function(){if(this.container){if(this.wrapper&&this.startPoint&&this.endPoint){var e=Fs(this.endPoint),t=new MouseEvent("mouseup",{clientX:e.x,clientY:e.y});this.drawOff(t)}this.cleanupSelectionState(),this.removeEventListeners(),this.close()}},e.prototype.open=function(){this.disabled=!1},e.prototype.close=function(){this.disabled=!0},e.pluginName="selectionSelect",e}(),gm=function(e,t){var n=[],i=[],o=function(e,i,r){e&&(r&&i.unshift.apply(i,C([],E(t.getEdgeModels({sourceNodeId:e.id,targetNodeId:null==r?void 0:r.id}).map((function(e){return e.id}))),!1)),i.includes(e.id)?n.push(i):(i.unshift(e.id),e.incoming.nodes.length?e.incoming.nodes.forEach((function(t){o(t,i.slice(),e)})):n.push(i)))},r=function(e,n,o){e&&(o&&n.push.apply(n,C([],E(t.getEdgeModels({sourceNodeId:null==o?void 0:o.id,targetNodeId:e.id}).map((function(e){return e.id}))),!1)),n.includes(e.id)?i.push(n):(n.push(e.id),e.outgoing.nodes.length?e.outgoing.nodes.forEach((function(t){r(t,n.slice(),e)})):i.push(n)))};return o(e,[]),r(e,[]),C([],E(new Set(C(C([],E(n.flat()),!1),E(i.flat()),!1))),!1)},vm=function(){function e(e){var t=e.lf,n=e.options;this.mode="path",this.enable=!0,this.tempStyles={};var i=n.mode,o=void 0===i?"path":i,r=n.enable,a=void 0===r||r;this.lf=t,this.mode=o,this.enable=a}return e.prototype.setMode=function(e){this.mode=e},e.prototype.setEnable=function(e){this.enable=e},e.prototype.highlightSingle=function(e){var t=this.lf.getModelById(e);"node"===(null==t?void 0:t.BaseType)?t.updateStyles(this.tempStyles[e]):"edge"===(null==t?void 0:t.BaseType)&&(t.updateStyles(this.tempStyles[e]),t.sourceNode.updateStyles(this.tempStyles[t.sourceNode.id]),t.targetNode.updateStyles(this.tempStyles[t.targetNode.id])),this.lf.emit("highlight:single",{data:t})},e.prototype.highlightNeighbours=function(e){var t=this,n=this.lf.getModelById(e),i=[];if("node"===(null==n?void 0:n.BaseType)){n.updateStyles(this.tempStyles[e]);var o=n.incoming,r=o.nodes,a=o.edges,s=n.outgoing,l=s.nodes,u=s.edges;Hs(r,l).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),Hs(a,u).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),i=Vf(Hs(i,r,l,a,u),"id")}else"edge"===(null==n?void 0:n.BaseType)&&(n.updateStyles(this.tempStyles[e]),n.sourceNode.updateStyles(this.tempStyles[n.sourceNode.id]),n.targetNode.updateStyles(this.tempStyles[n.targetNode.id]),i=[n.sourceNode,n.targetNode]);this.lf.emit("highlight:neighbours",{data:n,relateElements:i})},e.prototype.highlightPath=function(e){var t=this,n=function(e,t){var n=t.getModelById(e);return gm("node"===(null==n?void 0:n.BaseType)?n:null==n?void 0:n.targetNode,t)}(e,this.lf),i=[];n.forEach((function(e){var n=t.lf.getModelById(e);null==n||n.updateStyles(t.tempStyles[e]),i.push(n)})),this.lf.emit("highlight:path",{data:this.lf.getModelById(e),relateElements:i})},e.prototype.highlight=function(e,t){var n=this;(void 0===t&&(t=this.mode),this.enable)&&(Object.keys(this.tempStyles).length&&this.restoreHighlight(),Object.values(this.lf.graphModel.modelsMap).forEach((function(e){var t="node"===e.BaseType?e.getNodeStyle():e.getEdgeStyle();n.tempStyles[e.id]=v({},t),e.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),neighbour:this.highlightNeighbours.bind(this),path:this.highlightPath.bind(this)}[t](e))},e.prototype.restoreHighlight=function(){var e=this;Object.keys(this.tempStyles).length&&(Object.values(this.lf.graphModel.modelsMap).forEach((function(t){var n,i=null!==(n=e.tempStyles[t.id])&&void 0!==n?n:{};t.updateStyles(v({},i))})),this.tempStyles={})},e.prototype.render=function(){var e=this;this.lf.on("node:mouseenter",(function(t){var n=t.data;return e.highlight(n.id)})),this.lf.on("edge:mouseenter",(function(t){var n=t.data;return e.highlight(n.id)})),this.lf.on("node:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("edge:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("history:change",this.restoreHighlight.bind(this))},e.prototype.destroy=function(){},e.pluginName="highlight",e}(),mm={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function ym(e,t,n,i){var o,r="",a="";e[0]===t[0]?r=e[1]>t[1]?"t":"b":e[1]===t[1]&&(r=e[0]>t[0]?"l":"r"),t[0]===n[0]?a=t[1]>n[1]?"t":"b":t[1]===n[1]&&(a=t[0]>n[0]?"l":"r");var s=Math.min(Math.hypot(t[0]-e[0],t[1]-e[1])/2,Math.hypot(n[0]-t[0],n[1]-t[1])/2,i)||.2*i,l="".concat(r).concat(a),u=mm[l]||"-",c="L ".concat(e[0]," ").concat(e[1]);if("-"===u)c+="L ".concat(t[0]," ").concat(t[1]," L ").concat(n[0]," ").concat(n[1]);else{var d=E(function(e,t,n,i){var o=[e[0],e[1]],r=[e[0],e[1]];switch(n){case"tl":return"tr"===t?(o[1]+=i,r[0]+=i):"lb"===t&&(o[0]+=i,r[1]+=i),[o,r];case"tr":return"tl"===t?(o[1]+=i,r[0]-=i):"rb"===t&&(o[0]-=i,r[1]+=i),[o,r];case"bl":return"br"===t?(o[1]-=i,r[0]+=i):"lt"===t&&(o[0]+=i,r[1]-=i),[o,r];case"br":return"bl"===t?(o[1]-=i,r[0]-=i):"rt"===t&&(o[0]-=i,r[1]-=i),[o,r];default:return[]}}(t,l,u,s),2),h=d[0],f=d[1];h&&f&&(c+="L ".concat(h[0]," ").concat(h[1]," Q ").concat(t[0]," ").concat(t[1]," ").concat(f[0]," ").concat(f[1]),o=E(f,2),t[0]=o[0],t[1]=o[1])}return c}function bm(e,t){var n=0,i="";if(2===e.length)i+="M".concat(e[n][0]," ").concat(e[n++][1]," L ").concat(e[n][0]," ").concat(e[n][1]);else{for(i+="M".concat(e[n][0]," ").concat(e[n++][1]);n+1<e.length;){i+=ym(e[n-1],e[n],e[1+n++],t)}i+="L ".concat(e[n][0]," ").concat(e[n][1])}return i}var xm=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getEdge=function(){var e=this.props.model,n=e.points,i=e.isAnimation,o=e.arrowConfig,r=e.radius,a=void 0===r?5:r,s=e.getEdgeStyle(),l=e.getEdgeAnimationStyle(),u=function(e){for(var t=e,n=1;n<t.length-1;){var i=E(t[n-1],2),o=i[0],r=i[1],a=E(t[n],2),s=a[0],l=a[1],u=E(t[n+1],2),c=u[0],d=u[1];o===s&&s===c||r===l&&l===d?t.splice(n,1):n++}return t}(n.split(" ").map((function(e){return e.split(",").map((function(e){return+e}))}))),c=bm(u,a),d=v(v(v({style:i?l:{}},s),o),{fill:"none"});return t.h("path",v({d:c},d))},n}(t.PolylineEdge),wm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t}(t.PolylineEdgeModel),Em=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.id,i=e.x,o=e.y,r=e.width,a=e.height,s=e.properties,l=this.props.model.getNodeStyle();return t.h("svg",{x:i-r/2,y:o-a/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[s.labelText?t.h("text",{x:0,y:-5,fontSize:"16px",fill:l.stroke},s.labelText):"",s.disabledDelete?"":t.h("text",{x:s.labelText?50:0,y:-5,fontSize:"24px",cursor:"pointer",fill:l.stroke,onclick:this.handleCustomDeleteIconClick.bind(this,n)},"x")])},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.id,s=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",v(v({},s),{x:n-o/2,y:i-r/2,width:o,height:r,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(e){this.props.graphModel.deleteNode(e)},n}(t.PolygonNode),Cm=function(e){function t(){var t=e.apply(this,C([],E(arguments),!1))||this;return t.d=10,t.isResize=!1,t}return g(t,e),t.prototype.initNodeData=function(t){t.text={value:"",x:t.x,y:t.y,draggable:!1,editable:!1},e.prototype.initNodeData.call(this,t),this.zIndex=0,this.draggable=!0},t.prototype.setAttributes=function(){var e,t=this;this.points=[],(null===(e=this.properties)||void 0===e?void 0:e.node_selection_ids).length>1&&setTimeout((function(){var e;t.updatePointsByNodes((null===(e=t.properties)||void 0===e?void 0:e.node_selection_ids)||[])}))},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.stroke=this.properties.strokeColor||"#008000",t.strokeDasharray="10 5",t},t.prototype.getDefaultAnchor=function(){return[]},t.prototype.updatePoints=function(e){this.points=e},t.prototype.updateCoordinate=function(e){var t=e.x,n=e.y;this.x=t,this.y=n},t.prototype.updatePointsByNodes=function(e){var t=this,n=[],i=1/0,o=1/0,r=-1/0,a=-1/0;e.forEach((function(e){var n=t.graphModel.getNodeModelById(e);if(n){var s=n.width,l=n.height,u=n.x,c=n.y;i=Math.min(i,u-s/2-t.d),o=Math.min(o,c-l/2-t.d),r=Math.max(r,u+s/2+t.d),a=Math.max(a,c+l/2+t.d)}})),n.push([i,o],[r,o],[r,a],[i,a]),[i,o,r,a].some((function(e){return Math.abs(e)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(r+i)/2,y:(a+o)/2}))},t.prototype.resize=function(t){var n;this.isResize=!0;for(var i=t.width,o=t.height,r=i/this.width,a=o/this.height,s=(this.properties.node_selection_ids||[]).slice(),l=[],u=new Set;s.length;){var c=s.shift(),d=null===(n=this.graphModel.nodesMap[c])||void 0===n?void 0:n.model;d&&(Sm(d)?u.has(d.id)||(u.add(d.id),s.push.apply(s,C([],E(d.properties.node_selection_ids||[]),!1))):l.push(d))}var h=this.x-this.width/2,f=this.y-this.height/2,p=e.prototype.resize.call(this,t),g=this.x-this.width/2,v=this.y-this.height/2;return l.forEach((function(e){e.width=e.width*r,e.height=e.height*a;var t=(e.x-h)*r+g-e.x,n=(e.y-f)*a+v-e.y;e.move(t,n,!0)})),this.isResize=!1,p},t}(t.PolygonNodeModel),Nm="node-selection",_m=function(){function e(e){var t=e.lf;this.selectNodes=[],this.d=10,this.lf=t,t.register({type:Nm,view:Em,model:Cm})}return Object.defineProperty(e.prototype,"selectNodesIds",{get:function(){return this.selectNodes.map((function(e){return e.id}))},enumerable:!1,configurable:!0}),e.prototype.addNodeSelection=function(){this.lf.addNode({type:"node-selection",text:"",properties:{node_selection_ids:this.selectNodesIds},x:0,y:0}).updatePointsByNodes(this.selectNodesIds)},e.prototype.updateNodeSelection=function(){var e,t=this.getNodeSelection();t&&(this.lf.setProperties(t.id,{node_selection_ids:this.selectNodesIds}),null===(e=this.lf.getNodeModelById(t.id))||void 0===e||e.updatePointsByNodes(this.selectNodesIds))},e.prototype.getNodeSelection=function(){var e=this,t=this.selectNodesIds,n=this.lf.getGraphRawData(),i=t.filter((function(t){return t!==e.currentClickNode.id}));return n.nodes.find((function(e){if("node-selection"===e.type){var t=Wo(e,"properties.node_selection_ids",[]);return i.every((function(e){return t.includes(e)}))}return!1}))},e.prototype.onNodeChange=function(e,t){var n=e.graphModel.nodes.filter((function(e){return!!Sm(e)&&(e.properties.node_selection_ids||[]).includes(t.id)}));Promise.resolve().then((function(){n.forEach((function(e){e.updatePointsByNodes(e.properties.node_selection_ids||[])}))}))},e.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!==Nm){t.currentClickNode=n.data;var o=!1;t.selectNodesIds.includes(n.data.id)&&(null===(i=t.lf.getNodeModelById(n.data.id))||void 0===i||i.setSelected(!1),o=!0);var r=e.getSelectElements(!0).nodes;t.selectNodes=r,1===t.selectNodes.length?o?t.updateNodeSelection():t.addNodeSelection():t.selectNodes.length>1&&t.updateNodeSelection()}})),e.graphModel.addNodeMoveRules((function(n,i,o){if(t.onNodeChange(e,n),Sm(n)&&!n.isResize){var r=n.properties.node_selection_ids||[];return e.graphModel.moveNodes(r,i,o,!0),!0}return!0})),e.graphModel.addNodeResizeRules((function(n){return Sm(n)||t.onNodeChange(e,n),!0}))},e.pluginName="node-selection",e}(),Sm=function(e){return!(!e||e.type!==Nm)},Mm=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return g(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.properties;return t.h("text",{x:n-o/2+5,y:i-r/2+16,fontSize:12,fill:"blue"},a.moreText)},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",v(v({},a),{fill:"#FFFFFF",x:n-o/2,y:i-r/2})),this.getLabelShape()])},n}(t.RectNode),Tm={pluginName:"rectLabelNode",install:function(e){e.register({type:"rect-label",model:t.RectNodeModel,view:Mm})}};e.AutoLayout=em,e.BPMNAdapter=$g,e.BPMNBaseAdapter=Yg,e.BPMNElements=ug,e.BoundaryEventFactory=Ce,e.BpmnAdapter=fe,e.BpmnElement=q,e.BpmnXmlAdapter=pe,e.ContextMenu=dm,e.Control=nm,e.CurvedEdge=xm,e.CurvedEdgeModel=wm,e.DiamondResize=Up,e.DiamondResizeModel=zp,e.DiamondResizeView=Gp,e.DndPanel=hm,e.DynamicGroup=av,e.DynamicGroupNode=tv,e.DynamicGroupNodeModel=nv,e.EllipseResize=Wp,e.EllipseResizeModel=Fp,e.EllipseResizeView=Hp,e.EndEventFactory=xe,e.EndEventModel=k,e.EndEventView=R,e.ExclusiveGatewayModel=L,e.ExclusiveGatewayView=B,e.FlowPath=$v,e.GatewayNodeFactory=Le,e.Group=ng,e.GroupNode=Qp,e.GroupNodeModel=Jp,e.Highlight=vm,e.HtmlResize=Vp,e.HtmlResizeModel=qp,e.HtmlResizeView=Xp,e.InsertNodeInPolyline=fv,e.IntermediateCatchEventFactory=we,e.IntermediateThrowEventFactory=Ne,e.Label=Wv,e.Menu=um,e.MiniMap=fm,e.NodeResize=Zp,e.NodeSelection=_m,e.ProximityConnect=tm,e.RectLabelNode=Tm,e.RectResize=$p,e.RectResizeModel=Kp,e.RectResizeView=Yp,e.SelectionSelect=pm,e.SequenceFlowModel=O,e.SequenceFlowView=P,e.ServiceTaskModel=F,e.ServiceTaskView=H,e.Snapshot=Yv,e.StartEventFactory=Ee,e.StartEventModel=M,e.StartEventView=T,e.SubProcessFactory=ig,e.TaskNodeFactory=je,e.UserTaskModel=z,e.UserTaskView=G,e.bpmnUtils=be,e.convertNormalToXml=zg,e.convertXmlToNormal=Gg,e.dynamicGroup=ov,e.escapeXml=Z,e.gateway={exclusive:0,inclusive:1,parallel:2},e.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],e.getCurvedEdgePath=bm,e.handleAttributes=$,e.icons=Ie,e.lfJson2Xml=ee,e.lfXml2Json=ie,e.multiInstanceIcon=Be,e.sequenceFlowFactory=rg,e.toLogicflowData=function(e){var t={nodes:[],edges:[]},n=e.flowElementList;return n&&n.length>0&&n.forEach((function(e){if(e.type===Zg.SEQUENCE_FLOW){var n=function(e){var t=e.incoming,n=e.outgoing,i=e.properties,o=e.key,r=e.type,a=i.text,s=i.name,l=i.startPoint,u=i.endPoint,c=i.pointsList,d={id:o,type:Jg[r],sourceNodeId:t[0],targetNodeId:n[0],text:a||s,properties:{}};l&&(d.startPoint=JSON.parse(l)),u&&(d.endPoint=JSON.parse(u)),c&&(d.pointsList=JSON.parse(c));var h=["startPoint","endPoint","pointsList","text"];return Object.keys(e.properties).forEach((function(t){-1===h.indexOf(t)&&(d.properties[t]=e.properties[t])})),d}(e);t.edges.push(n)}else{var i=function(e){var t=e.properties,n=e.key,i=e.type,o=e.bounds,r=t.x,a=t.y,s=t.text;if(void 0===r){var l=E(o,2),u=l[0],c=u.x,d=u.y,h=l[1];r=(c+h.x)/2,a=(d+h.y)/2}var f={id:n,type:Jg[i],x:r,y:a,text:s,properties:{}},p=["x","y","text"];return Object.keys(e.properties).forEach((function(t){-1===p.indexOf(t)&&(f.properties[t]=e.properties[t])})),f}(e);t.nodes.push(i)}})),t},e.toNormalJson=le,e.toTurboData=function(e){var t=new Map,n={flowElementList:[]};return e.nodes.forEach((function(e){var i=function(e){var t=e.id,n=e.type,i=e.x,o=e.y,r=e.text,a=void 0===r?"":r,s=e.properties;return{incoming:[],outgoing:[],dockers:[],type:Qg(n),properties:v(v({},s),{name:a&&a.value||"",x:i,y:o,text:a}),key:t}}(e);n.flowElementList.push(i),t.set(e.id,i)})),e.edges.forEach((function(e){var i=function(e){var t=e.id,n=e.type,i=e.sourceNodeId,o=e.targetNodeId,r=e.startPoint,a=e.endPoint,s=e.pointsList,l=e.text,u=void 0===l?"":l,c=e.properties;return{incoming:[i],outgoing:[o],type:Qg(n),dockers:[],properties:v(v({},c),{name:u&&u.value||"",text:u,startPoint:JSON.stringify(r),endPoint:JSON.stringify(a),pointsList:JSON.stringify(s)}),key:t}}(e);t.get(e.sourceNodeId).outgoing.push(i.key),t.get(e.targetNodeId).incoming.push(i.key),n.flowElementList.push(i)})),n},e.toXmlJson=se,e.useDefinition=lg}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@logicflow/core")):"function"==typeof define&&define.amd?define(["exports","@logicflow/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Extension={},e.Core)}(this,(function(e,t){"use strict";var n=40,i=40,o=40,r=40,a=40,s=40,l=100,u=80,c=100,d=80,h={rect:{radius:5,stroke:"rgb(24, 125, 255)"},circle:{r:18,stroke:"rgb(24, 125, 255)"},polygon:{stroke:"rgb(24, 125, 255)"},polyline:{stroke:"rgb(24, 125, 255)",hoverStroke:"rgb(24, 125, 255)",selectedStroke:"rgb(24, 125, 255)"},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"white",height:14,stroke:"transparent",radius:3}}},f=function(e,t){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},f(e,t)};function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var g=function(){return g=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},g.apply(this,arguments)};function v(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}function m(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function y(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function b(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(o=2&s[0]?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function x(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function E(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var C=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),N=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new C;function _(){return N.next()}var S=function(e){function t(t,n){return t.id||(t.id="Event_".concat(_())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),e.call(this,t,n)||this}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedTargetRules=function(){var t=e.prototype.getConnectedTargetRules.call(this);return t.push({message:"起始节点不能作为边的终点",validate:function(){return!1}}),t},t.extendKey="StartEventModel",t}(t.CircleNodeModel),M=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.extendKey="StartEventNode",t}(t.CircleNode),T={type:"bpmn:startEvent",view:M,model:S},A=function(e){function t(t,n){return t.id||(t.id="Event_".concat(_())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),e.call(this,t,n)||this}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedSourceRules=function(){var t=e.prototype.getConnectedSourceRules.call(this);return t.push({message:"结束节点不能作为边的起点",validate:function(){return!1}}),t},t.extendKey="EndEventModel",t}(t.CircleNodeModel),k=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},n.prototype.getShape=function(){var n=this.props.model,i=n.getNodeStyle(),o=n,r=o.x,a=o.y,s=o.r,l=e.prototype.getShape.call(this);return t.h("g",{},l,t.h("circle",g(g({},i),{cx:r,cy:a,r:s-5})))},n.extendKey="EndEventView",n}(t.CircleNode),R={type:"bpmn:endEvent",view:k,model:A},D=function(e){function t(t,n){return t.id||(t.id="Flow_".concat(_())),e.call(this,t,n)||this}return p(t,e),t.extendKey="SequenceFlowModel",t}(t.PolylineEdgeModel),O=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.extendKey="SequenceFlowEdge",t}(t.PolylineEdge),P={type:"bpmn:sequenceFlow",view:O,model:D},I=function(e){function t(t,n){var i=this;return t.id||(t.id="Gateway_".concat(_())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),(i=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],i}return p(t,e),t.extendKey="ExclusiveGatewayModel",t}(t.PolygonNodeModel),L=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getShape=function(){var e=this.props.model,n=e,i=n.x,o=n.y,r=n.width,a=n.height,s=n.points,l=e.getNodeStyle();return t.h("g",{transform:"matrix(1 0 0 1 ".concat(i-r/2," ").concat(o-a/2,")")},t.h("polygon",g(g({},l),{x:i,y:o,points:s})),t.h("path",g({d:"m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z"},l)))},n.extendKey="ExclusiveGatewayNode",n}(t.PolygonNode),B={type:"bpmn:exclusiveGateway",view:L,model:I},j=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(_())),e.call(this,t,n)||this}return p(t,e),t.extendKey="ServiceTaskModel",t}(t.RectNodeModel),F=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-o/2+5,y:i-r/2+5,width:30,height:30,viewBox:"0 0 1274 1024"},t.h("path",{fill:a.stroke,d:"M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z"}))},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",g({x:n-o/2,y:i-r/2,rx:a,ry:a,width:o,height:r},s)),this.getLabelShape()])},n.extendKey="ServiceTaskNode",n}(t.RectNode),H={type:"bpmn:serviceTask",view:F,model:j},W=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(_())),e.call(this,t,n)||this}return p(t,e),t.extendKey="UserTaskModel",t}(t.RectNodeModel),z=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-o/2+5,y:i-r/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},t.h("path",{fill:a.stroke,d:"M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z"}))},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",g(g({},s),{x:n-o/2,y:i-r/2,rx:a,ry:a,width:o,height:r})),this.getLabelShape()])},n.extendKey="UserTaskNode",n}(t.RectNode),G={type:"bpmn:userTask",view:z,model:W},U={pluginName:"bpmnElement",install:function(e){e.setTheme(h),e.register(T),e.register(R),e.register(B),e.register(G),e.register(H),e.options.customBpmnEdge||(e.register(P),e.setDefaultEdgeType("bpmn:sequenceFlow"))}},q=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),X=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new q;function V(){return X.next()}function K(e){return Object.prototype.toString.call(e)}function Y(e){var t=e;return"[object Object]"===K(e)?(t={},Object.keys(e).forEach((function(n){var i=n;"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=Y(e[n])}))):Array.isArray(e)&&(t=[],e.forEach((function(e,n){t[n]=Y(e)}))),t}function $(e){return null==e?"":e.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var Z="\t\n";function J(e,t,n){var i=function(e){return" ".repeat(e)}(n);if(0!==e&&!1!==e&&!e)return Z+i+"<".concat(t," />");var o="";if("#text"===t)return Z+i+$(String(e));if("#cdata-section"===t)return Z+i+"<![CDATA["+e+"]]>";if("#comment"===t)return Z+i+"\x3c!--"+e+"--\x3e";if("-"==="".concat(t).charAt(0))return" "+t.substring(1)+'="'+function(e){var t=e;try{"string"!=typeof t&&(t=JSON.parse(e))}catch(n){t=JSON.stringify(Y(e)).replace(/"/g,"'")}return $(String(t))}(e)+'"';if(Array.isArray(e))e.forEach((function(e){o+=J(e,t,n+1)}));else if("[object Object]"===K(e)){var r=Object.keys(e),a="",s="";o+=(0===n?"":Z+i)+"<"+t,r.forEach((function(t){"-"===t.charAt(0)?a+=J(e[t],t,n+1):s+=J(e[t],t,n+1)})),o+=a+(""!==s?">".concat(s).concat(Z+i,"</").concat(t,">"):" />")}else o+=Z+i+"<".concat(t,">").concat($(String(e)),"</").concat(t,">");return o}function Q(e){var t="";for(var n in e)t+=J(e[n],n,0);return t}var ee=function(){};(ee.ObjTree=function(){return this}).VERSION="0.23",ee.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',ee.ObjTree.prototype.attr_prefix="-",ee.ObjTree.prototype.parseXML=function(e){var t;if(window.DOMParser){var n=new DOMParser,i=n.parseFromString(e,"application/xml");if(!i)return;t=i.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(e),t=n.documentElement);if(t)return this.parseDOM(t)},ee.ObjTree.prototype.parseHTTP=function(e,t,n){var i,o={};for(var r in t)o[r]=t[r];if(o.method||(void 0===o.postBody&&void 0===o.postbody&&void 0===o.parameters?o.method="get":o.method="post"),n){o.asynchronous=!0;var a=this,s=n,l=o.onComplete;o.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else o.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)o.uri=e,(u=new HTTP.Request(o))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,o))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},ee.ObjTree.prototype.parseDOM=function(e){if(e){if(this.__force_array={},this.force_array)for(var t=0;t<this.force_array.length;t++)this.__force_array[this.force_array[t]]=1;var n=this.parseElement(e);if(this.__force_array[e.nodeName]&&(n=[n]),11!=e.nodeType){var i={};i[e.nodeName]=n,n=i}return n}},ee.ObjTree.prototype.parseElement=function(e){if(7!=e.nodeType){if(3==e.nodeType||4==e.nodeType||8==e.nodeType){if(null==e.nodeValue.match(/[^\x00-\x20]/))return;return e.nodeValue}var t=null,n={};if(e.attributes&&e.attributes.length){t={};for(var i=0;i<e.attributes.length;i++){if("string"==typeof(s=e.attributes[i].nodeName)){var o=e.attributes[i].nodeValue;try{o=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){o=e.attributes[i].nodeValue}o&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}if(e.childNodes&&e.childNodes.length){var r=!0;t&&(r=!1);for(i=0;i<e.childNodes.length&&r;i++){var a=e.childNodes[i].nodeType;3!=a&&4!=a&&8!=a&&(r=!1)}if(r){t||(t="");for(i=0;i<e.childNodes.length;i++)t+=e.childNodes[i].nodeValue}else{t||(t={});for(i=0;i<e.childNodes.length;i++){var s;if("string"==typeof(s=e.childNodes[i].nodeName))(o=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}else null===t&&(t={});return t}},ee.ObjTree.prototype.addNode=function(e,t,n,i){this.__force_array[t]?(1==n&&(e[t]=[]),e[t][e[t].length]=i):1==n?e[t]=i:2==n?e[t]=[e[t],i]:e[t][e[t].length]=i},ee.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},ee.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var o in t)if(t.hasOwnProperty(o)){var r=t[o];o.charAt(0)!=this.attr_prefix?void 0===r||null==r?n[n.length]="<"+o+" />":"object"==typeof r&&r.constructor==Array?n[n.length]=this.array_to_xml(o,r):n[n.length]="object"==typeof r?this.hash_to_xml(o,r):this.scalar_to_xml(o,r):i[i.length]=" "+o.substring(1)+'="'+this.xml_escape(r)+'"'}var a=i.join(""),s=n.join("");return void 0===e||null==e||(s=n.length>0?s.match(/\n/)?"<"+e+a+">\n"+s+"</"+e+">\n":"<"+e+a+">"+s+"</"+e+">\n":"<"+e+a+" />\n"),s},ee.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var o=t[i];void 0===o||null==o?n[n.length]="<"+e+" />":"object"==typeof o&&o.constructor==Array?n[n.length]=this.array_to_xml(e,o):n[n.length]="object"==typeof o?this.hash_to_xml(e,o):this.scalar_to_xml(e,o)}return n.join("")},ee.ObjTree.prototype.scalar_to_xml=function(e,t){return"#text"==e?this.xml_escape(t):"<"+e+">"+this.xml_escape(t)+"</"+e+">\n"},ee.ObjTree.prototype.xml_escape=$;var te,ne=function(e){return(new ee.ObjTree).parseXML(e)};!function(e){e.START="bpmn:startEvent",e.END="bpmn:endEvent",e.GATEWAY="bpmn:exclusiveGateway",e.USER="bpmn:userTask",e.SYSTEM="bpmn:serviceTask",e.FLOW="bpmn:sequenceFlow"}(te||(te={}));var ie=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef"],oe=["properties","startPoint","endPoint","pointsList"],re=function(e){return String(e||"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&apos;/g,"'")};function ae(e){var t=e?oe.concat(e):oe;return function(e){return function e(n){var i={};return"string"==typeof n?n:Array.isArray(n)?n.map((function(t){return e(t)})):(Object.entries(n).forEach((function(n){var o=w(n,2),r=o[0],a=o[1];"object"!=typeof a?0===r.indexOf("-")||["#text","#cdata-section","#comment"].includes(r)?i[r]=a:i["-".concat(r)]=a:t.includes(r)?i["-".concat(r)]=e(a):i[r]=e(a)})),i)}(e)}}function se(e){var t={};return Object.entries(e).forEach((function(e){var n=w(e,2),i=n[0],o=n[1];0===i.indexOf("-")?t[i.substring(1)]=Y(o):"string"==typeof o?t[i]=o:"[object Object]"===Object.prototype.toString.call(o)?t[i]=se(o):Array.isArray(o)?t[i]=o.map((function(e){return se(e)})):t[i]=o})),t}function le(e,t){e["bpmndi:BPMNEdge"]=t.edges.map((function(e){var t,n=e.id,i=e.pointsList.map((function(e){return{"-x":e.x,"-y":e.y}})),o={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(o["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),o})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,o=80,r=e.x,a=e.y,s=he.shapeConfigMap.get(e.type);s&&(i=s.width,o=s.height),r-=i/2,a-=o/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":r,"-y":a,"-width":i,"-height":o}};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(l["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),l}))}function ue(e){var t=[],n=[],i=e["bpmn:definitions"];if(i){var o=i["bpmn:process"],r=i["bpmndi:BPMNDiagram"],a=null==r?void 0:r["bpmndi:BPMNPlane"];if(!o||!a)return{nodes:t,edges:n};Object.keys(o).forEach((function(e){if(0===e.indexOf("bpmn:")){var i=o[e];if(e===te.FLOW){var r=a["bpmndi:BPMNEdge"],s=(Array.isArray(r),r);n=function(e,t){var n=[];if(Array.isArray(e))e.forEach((function(e){var i;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(de(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(de(i,e))}return n}(i,s)}else{var l=a["bpmndi:BPMNShape"],u=(Array.isArray(l),l);t=t.concat(function(e,t,n){var i=[];if(Array.isArray(e))e.forEach((function(e){var o=ce(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}));else{var o=ce(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}return i}(i,u,e))}}}))}return{nodes:t,edges:n}}function ce(e,t,n){var i,o,r=Number(e["dc:Bounds"]["-x"]),a=Number(e["dc:Bounds"]["-y"]),s=re(n["-name"]),l=he.shapeConfigMap.get(t);if(l&&(r+=l.width/2,a+=l.height/2),Object.entries(n).forEach((function(e){var t=w(e,2),n=t[0],o=t[1];-1===ie.indexOf(n)&&(i||(i={}),i[n]=o)})),i&&(i=se(i)),s&&(o={x:r,y:a,value:s},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var u=e["bpmndi:BPMNLabel"]["dc:Bounds"];o.x=Number(u["-x"])+Number(u["-width"])/2,o.y=Number(u["-y"])+Number(u["-height"])/2}var c={id:e["-bpmnElement"],type:t,x:r,y:a,properties:i};return o&&(c.text=o),c}function de(e,t){var n,i,o=t["-name"]?re("".concat(t["-name"])):"";if(o){var r=void 0;e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"]&&(r=e["bpmndi:BPMNLabel"]["dc:Bounds"]);var a=0;if(o.split("\n").forEach((function(e){a<e.length&&(a=e.length)})),r)n={value:o,x:Number(r["-x"])+10*a/2,y:Number(r["-y"])+7};else{var s=e["di:waypoint"]||[],l=s[0],u=s[s.length-1]||l;n={value:o,x:(Number((null==l?void 0:l["-x"])||0)+Number((null==u?void 0:u["-x"])||0))/2,y:(Number((null==l?void 0:l["-y"])||0)+Number((null==u?void 0:u["-y"])||0))/2}}}Object.entries(t).forEach((function(e){var t=w(e,2),n=t[0],o=t[1];-1===ie.indexOf(n)&&(i||(i={}),i[n]=o)})),i&&(i=se(i));var c={id:t["-id"],type:te.FLOW,pointsList:e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:i};return n&&(c.text=n),c}var he=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i=g({},n.processAttributes);!function(e,t,n){var i=new Map;t.nodes.forEach((function(t){var o,r={"-id":t.id};if((null===(o=t.text)||void 0===o?void 0:o.value)&&(r["-name"]=t.text.value),t.properties){var a=ae(n)(t.properties);Object.assign(r,a)}i.set(t.id,r),e[t.type]?Array.isArray(e[t.type])?e[t.type].push(r):e[t.type]=[e[t.type],r]:e[t.type]=r}));var o=t.edges.map((function(e){var t,o,r=i.get(e.targetNodeId);r["bpmn:incoming"]?Array.isArray(r["bpmn:incoming"])?r["bpmn:incoming"].push(e.id):r["bpmn:incoming"]=[r["bpmn:incoming"],e.id]:r["bpmn:incoming"]=e.id;var a={"-id":e.id,"-sourceRef":e.sourceNodeId,"-targetRef":e.targetNodeId};if((null===(t=e.text)||void 0===t?void 0:t.value)&&(a["-name"]=null===(o=e.text)||void 0===o?void 0:o.value),e.properties){var s=ae(n)(e.properties);Object.assign(a,s)}return a}));t.edges.forEach((function(e){var t=i.get(e.sourceNodeId);t["bpmn:outgoing"]?Array.isArray(t["bpmn:outgoing"])?t["bpmn:outgoing"].push(e.id):t["bpmn:outgoing"]=[t["bpmn:outgoing"],e.id]:t["bpmn:outgoing"]=e.id})),e[te.FLOW]=o}(i,e,t);var o={"-id":"BPMNPlane_1","-bpmnElement":i["-id"]};le(o,e);var r=n.definitionAttributes;return r["bpmn:process"]=i,r["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":o},{"bpmn:definitions":r}},this.adapterIn=function(e){if(e)return ue(e)},t.adapterIn=function(e){return n.adapterIn(e)},t.adapterOut=function(e,t){return n.adapterOut(e,t)},this.processAttributes={"-isExecutable":"true","-id":"Process_".concat(V())},this.definitionAttributes={"-id":"Definitions_".concat(V()),"-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.0"}}return e.prototype.setCustomShape=function(t,n){e.shapeConfigMap.set(t,n)},e.pluginName="bpmn-adapter",e.shapeConfigMap=new Map,e}();he.shapeConfigMap.set(te.START,{width:n,height:i}),he.shapeConfigMap.set(te.END,{width:o,height:r}),he.shapeConfigMap.set(te.GATEWAY,{width:a,height:s}),he.shapeConfigMap.set(te.SYSTEM,{width:l,height:u}),he.shapeConfigMap.set(te.USER,{width:c,height:d});var fe=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t="string"==typeof e?n.sanitizeNameAttributes(e):e,i=ne(t);return n.adapterIn(i)},n.adapterXmlOut=function(e,t){return Q(n.adapterOut(e,t))};var i=t.lf;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n}return p(t,e),t.prototype.sanitizeNameAttributes=function(e){return e.replace(/name="([^"]*)"/g,(function(e,t){var n=t.replace(/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return'name="'.concat(n,'"')}))},t.pluginName="bpmnXmlAdapter",t}(he);function pe(){this.targetRules.push({message:"分组外的节点不允许连接分组内的",validate:function(e,t){var n=!!e.properties.parent,i=!!t.properties.parent;return!(!n&&i)}})}var ge=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),ve=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new ge;function me(){return ve.next()}var ye=Object.freeze({__proto__:null,genBpmnId:me,groupRule:pe});function be(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var i,o=this.props.model,r=o.getNodeStyle(),a=o,s=a.x,l=a.y,u=a.r,c=a.width,d=a.height,h=a.properties,f=e.prototype.getShape.call(this),p=h.definitionType,v=((null===(i=n.endEvent)||void 0===i?void 0:i.get(p))||{}).icon,m=Array.isArray(v)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(s-c/2," ").concat(l-d/2,")")}],w(v),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(s-c/2," ").concat(l-d/2,")"),d:v,style:"fill: black; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;"});return t.h("g",{},f,t.h("circle",g(g({},r),{strokeWidth:2,cx:s,cy:l,r:u-2})),m)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.endEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=g(g({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),o=e.call(this,t,i)||this,pe.call(o),o}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedSourceRules=function(){var t=this,n=e.prototype.getConnectedSourceRules.call(this),i={message:"结束节点不能作为边的起点",validate:function(e,n){return e!==t}};return n.push(i),n},t}(t.CircleNodeModel);return{type:"bpmn:endEvent",view:i,model:o}}function xe(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties.definitionType,h=((null===(e=n.intermediateCatchEvent)||void 0===e?void 0:e.get(d))||{}).icon,f=Array.isArray(h)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],w(h),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:h});return t.h("g",{},t.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",g(g({},o),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),f)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.intermediateCatchEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=g(g({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),o=e.call(this,t,i)||this,pe.call(o),o}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateCatchEvent",view:i,model:o}}function we(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties,h=d.definitionType,f=d.isInterrupting,p=((null===(e=n.startEvent)||void 0===e?void 0:e.get(h))||{}).icon,v=Array.isArray(p)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],w(p),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:p,style:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"});return t.h("g",{},t.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeDasharray:f?"5,5":"",strokeWidth:2})),v)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var s=((null===(o=n.startEvent)||void 0===o?void 0:o.get(null===(r=t.properties)||void 0===r?void 0:r.definitionType))||{}).properties,l=void 0===s?{}:s;return t.properties=g(g({},l),t.properties),(null===(a=t.properties)||void 0===a?void 0:a.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),e.call(this,t,i)||this}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedTargetRules=function(){var t=this,n=e.prototype.getConnectedTargetRules.call(this),i={message:"起始节点不能作为边的终点",validate:function(e,n){return n!==t}};return n.push(i),n},t}(t.CircleNodeModel);return{type:"bpmn:startEvent",view:i,model:o}}function Ee(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties,h=d.definitionType,f=d.cancelActivity,p=((null===(e=n.boundaryEvent)||void 0===e?void 0:e.get(h))||{}).icon,v=Array.isArray(p)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],w(p),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:p});return t.h("g",{},t.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeDasharray:f?"":"5,5",strokeWidth:1.5})),t.h("circle",g(g({},o),{cx:a,cy:s,r:l-3,strokeDasharray:f?"":"5,5",strokeWidth:1.5})),v)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.boundaryEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=g(g({attachedToRef:"",cancelActivity:!0},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),o=e.call(this,t,i)||this,pe.call(o),o}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.r=20,this.autoToFront=!1,this.zIndex=99999},t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:boundaryEvent",view:i,model:o}}function Ce(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties.definitionType,h=((null===(e=n.intermediateThrowEvent)||void 0===e?void 0:e.get(d))||{}).icon,f=Array.isArray(h)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],w(h),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:h,style:"fill: black"});return t.h("g",{},t.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",g(g({},o),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),f)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.intermediateThrowEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=g(g({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),o=e.call(this,t,i)||this,pe.call(o),o}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateThrowEvent",view:i,model:o}}var Ne=[t.h("circle",{cx:18,cy:18,r:11,style:"stroke-linecap: round;stroke-linejoin: round;stroke: rgb(34, 36, 42);stroke-width: 2px;fill: white"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"}),t.h("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;"})],_e=[t.h("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);"})],Se="m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z",Me="m 23,10 0,12.5 -12.5,0 0,5 12.5,0 0,12.5 5,0 0,-12.5 12.5,0 0,-5 -12.5,0 0,-12.5 -5,0 z",Te=t.h("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;"}),Ae="M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z",ke="M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z",Re="m44,60 m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",De="m47,61 m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",Oe="m 50,73 c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",Pe=Object.freeze({__proto__:null,compensationIcon:"m 7.92,18 9,-6.5 0,13 z m 9.3,-0.4 8.7,-6.1 0,13 -8.7,-6.1 z",conditionalIcon:"M 10.5,8.5 l 14.5,0 l 0,18 l -14.5,0 Z M 12.5,11.5 l 10.5,0 M 12.5,14.5 l 10.5,0 M 12.5,17.5 l 10.5,0 M 12.5,20.5 l 10.5,0 M 12.5,23.5 l 10.5,0 M 12.5,26.5 l 10.5,0 ",errorIcon:"m 7.2,25.991999999999997 0.09350000000000001,-0.025300000000000003 7.3392,-9.610700000000001 7.667000000000001,8.9661 4.7003,-18.2204 -5.8707,11.6501 -7.299600000000001,-9.585400000000002 z",escalationIcon:"M 18,7.2 l 8,20 l -8,-7 l -8,7 Z",exclusiveIcon:Se,inclusiveIcon:Te,linkIcon:"m 20.52,9.468 0,4.4375 -13.5,0 0,6.75 13.5,0 0,4.4375 9.84375,-7.8125 -9.84375,-7.8125 z",loopMarker:Oe,manualTaskIcon:"M0.5,3.751L4.583,0.5009999999999999C4.583,0.5009999999999999,15.749,0.5839999999999999,16.666,0.5839999999999999S14.249,3.5009999999999994,15.166,3.5009999999999994S26.833,3.5009999999999994,27.75,3.5009999999999994C28.916,5.209,27.582,6.667999999999999,26.916,7.167999999999999S27.791,9.084999999999999,25.916,11.584999999999999C25.166,11.834999999999999,26.666,13.459999999999999,24.583000000000002,14.918C23.416,15.501,25.166,16.46,23.333000000000002,17.750999999999998C22.166,17.750999999999998,2.5000000000000036,17.833999999999996,2.5000000000000036,17.833999999999996L0.5000000000000036,16.500999999999998V3.751ZM13.5,7L27,7M13.5,11L26,11M14,14.5L25,14.5M8.2,3.1L15,3.1",messageIcon:"m 8.459999999999999,11.34 l 0,12.6 l 18.900000000000002,0 l 0,-12.6 z l 9.450000000000001,5.4 l 9.450000000000001,-5.4",parallelIcon:Me,parallelMarker:Re,scriptTaskIcon:"M6.402,0.5H20.902C20.902,0.5,15.069,3.333,15.069,6.083S19.486,12.083,19.486,15.25S15.319,20.333,15.319,20.333H0.235C0.235,20.333,5.235,17.665999999999997,5.235,15.332999999999998S0.6520000000000001,8.582999999999998,0.6520000000000001,6.082999999999998S6.402,0.5,6.402,0.5ZM3.5,4.5L13.5,4.5M3.8,8.5L13.8,8.5M6.3,12.5L16.3,12.5M6.5,16.5L16.5,16.5",sequentialMarker:De,serviceTaskIcon:Ae,signalIcon:"M 18,7.2 l 9,16.2 l -18,0 Z",style:{throw:"fill: rgb(34, 36, 42); stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;",catch:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;",nonIntermediate:"stroke-width: 1.5; stroke-dash-array: 6",intermediate:"stroke-width: 1.5"},terminateIcon:_e,timerIcon:Ne,userTaskIcon:ke});function Ie(e,n,i){var o=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getShape=function(){var e=this.props.model,i=e,o=i.x,r=i.y,a=i.width,s=i.height,l=i.points,u=e.getNodeStyle();return t.h("g",{transform:"matrix(1 0 0 1 ".concat(o-a/2," ").concat(r-s/2,")")},t.h(t.Polygon,g(g({},u),{x:o,y:r,points:l})),"string"==typeof n?t.h("path",g(g({d:n},u),{fill:"rgb(34, 36, 42)",strokeWidth:1})):n)},i}(t.PolygonNode);return{type:e,view:o,model:function(e){function t(t,n){var o=this;return t.id||(t.id="Gateway_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),t.properties=g(g({},i||{}),t.properties),(o=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],pe.call(o),o}return p(t,e),t}(t.PolygonNodeModel)}}var Le={parallel:Re,sequential:De,loop:Oe};function Be(e,n,i){var o=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getLabelShape=function(){var e=this.props.model,i=e.x,o=e.y,r=e.width,a=e.height,s=e.getNodeStyle(),l=Array.isArray(n)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(i-r/2," ").concat(o-a/2,")")}],w(n),!1)):t.h("path",{fill:s.stroke,d:n});return t.h("svg",{x:i-r/2+5,y:o-a/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},l)},i.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.radius,s=e.properties,l=e.getNodeStyle();return t.h("g",{},[t.h("rect",g(g({},l),{x:n-o/2,y:i-r/2,rx:a,ry:a,width:o,height:r,opacity:.95})),this.getLabelShape(),t.h("g",{transform:"matrix(1 0 0 1 ".concat(n-o/2," ").concat(i-r/2,")")},t.h("path",{fill:"white",strokeLinecap:"round",strokeLinejoin:"round",stroke:"rgb(34, 36, 42)",strokeWidth:"2",d:Le[s.multiInstanceType]||""}))])},i}(t.RectNode),r=function(e){function t(t,n){var o,r=this;t.id||(t.id="Activity_".concat(me()));var a=g(g({},i||{}),t.properties);return t.properties=a,r=e.call(this,t,n)||this,null===(o=null==a?void 0:a.boundaryEvents)||void 0===o||o.forEach((function(e){r.addBoundaryEvent(e)})),r.deleteProperty("boundaryEvents"),pe.call(r),r}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.isTaskNode=!0,this.boundaryEvents=[]},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return this.properties.isBoundaryEventTouchingTask&&(t.stroke="#00acff",t.strokeWidth=2),t},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return t.stroke="transparent",!t.hover&&(t.hover={}),t.hover.stroke="transparent",t},t.prototype.setTouching=function(e){this.setProperty("isBoundaryEventTouchingTask",e)},t.prototype.addBoundaryEvent=function(e){if(this.setTouching(!1),this.boundaryEvents.find((function(t){return t===e})))return!1;var t=this.graphModel.getNodeModelById(e);return null==t||t.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(e),!0},t.prototype.deleteBoundaryEvent=function(e){this.boundaryEvents=this.boundaryEvents.filter((function(t){return t!==e}))},t}(t.RectNodeModel);return{type:e,view:o,model:r}}var je="object"==typeof global&&global&&global.Object===Object&&global,Fe="object"==typeof self&&self&&self.Object===Object&&self,He=je||Fe||Function("return this")(),We=He.Symbol,ze=Object.prototype,Ge=ze.hasOwnProperty,Ue=ze.toString,qe=We?We.toStringTag:void 0;var Xe=Object.prototype.toString;var Ve="[object Null]",Ke="[object Undefined]",Ye=We?We.toStringTag:void 0;function $e(e){return null==e?void 0===e?Ke:Ve:Ye&&Ye in Object(e)?function(e){var t=Ge.call(e,qe),n=e[qe];try{e[qe]=void 0;var i=!0}catch(e){}var o=Ue.call(e);return i&&(t?e[qe]=n:delete e[qe]),o}(e):function(e){return Xe.call(e)}(e)}function Ze(e){return null!=e&&"object"==typeof e}var Je="[object Symbol]";function Qe(e){return"symbol"==typeof e||Ze(e)&&$e(e)==Je}var et=NaN;function tt(e){return"number"==typeof e?e:Qe(e)?et:+e}function nt(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o}var it=Array.isArray,ot=1/0,rt=We?We.prototype:void 0,at=rt?rt.toString:void 0;function st(e){if("string"==typeof e)return e;if(it(e))return nt(e,st)+"";if(Qe(e))return at?at.call(e):"";var t=e+"";return"0"==t&&1/e==-ot?"-0":t}function lt(e,t){return function(n,i){var o;if(void 0===n&&void 0===i)return t;if(void 0!==n&&(o=n),void 0!==i){if(void 0===o)return i;"string"==typeof n||"string"==typeof i?(n=st(n),i=st(i)):(n=tt(n),i=tt(i)),o=e(n,i)}return o}}var ut=lt((function(e,t){return e+t}),0),ct=/\s/;function dt(e){for(var t=e.length;t--&&ct.test(e.charAt(t)););return t}var ht=/^\s+/;function ft(e){return e?e.slice(0,dt(e)+1).replace(ht,""):e}function pt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var gt=NaN,vt=/^[-+]0x[0-9a-f]+$/i,mt=/^0b[01]+$/i,yt=/^0o[0-7]+$/i,bt=parseInt;function xt(e){if("number"==typeof e)return e;if(Qe(e))return gt;if(pt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=pt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=ft(e);var n=mt.test(e);return n||yt.test(e)?bt(e.slice(2),n?2:8):vt.test(e)?gt:+e}var wt=1/0,Et=17976931348623157e292;function Ct(e){return e?(e=xt(e))===wt||e===-wt?(e<0?-1:1)*Et:e==e?e:0:0===e?e:0}function Nt(e){var t=Ct(e),n=t%1;return t==t?n?t-n:t:0}function _t(e){return e}var St="[object AsyncFunction]",Mt="[object Function]",Tt="[object GeneratorFunction]",At="[object Proxy]";function kt(e){if(!pt(e))return!1;var t=$e(e);return t==Mt||t==Tt||t==St||t==At}var Rt,Dt=He["__core-js_shared__"],Ot=(Rt=/[^.]+$/.exec(Dt&&Dt.keys&&Dt.keys.IE_PROTO||""))?"Symbol(src)_1."+Rt:"";var Pt=Function.prototype.toString;function It(e){if(null!=e){try{return Pt.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Lt=/^\[object .+?Constructor\]$/,Bt=Function.prototype,jt=Object.prototype,Ft=Bt.toString,Ht=jt.hasOwnProperty,Wt=RegExp("^"+Ft.call(Ht).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function zt(e){return!(!pt(e)||function(e){return!!Ot&&Ot in e}(e))&&(kt(e)?Wt:Lt).test(It(e))}function Gt(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return zt(n)?n:void 0}var Ut=Gt(He,"WeakMap"),qt=Ut&&new Ut,Xt=qt?function(e,t){return qt.set(e,t),e}:_t,Vt=Object.create,Kt=function(){function e(){}return function(t){if(!pt(t))return{};if(Vt)return Vt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Yt(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Kt(e.prototype),i=e.apply(n,t);return pt(i)?i:n}}var $t=1;function Zt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Jt=Math.max;function Qt(e,t,n,i){for(var o=-1,r=e.length,a=n.length,s=-1,l=t.length,u=Jt(r-a,0),c=Array(l+u),d=!i;++s<l;)c[s]=t[s];for(;++o<a;)(d||o<r)&&(c[n[o]]=e[o]);for(;u--;)c[s++]=e[o++];return c}var en=Math.max;function tn(e,t,n,i){for(var o=-1,r=e.length,a=-1,s=n.length,l=-1,u=t.length,c=en(r-s,0),d=Array(c+u),h=!i;++o<c;)d[o]=e[o];for(var f=o;++l<u;)d[f+l]=t[l];for(;++a<s;)(h||o<r)&&(d[f+n[a]]=e[o++]);return d}function nn(){}var on=4294967295;function rn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=on,this.__views__=[]}function an(){}rn.prototype=Kt(nn.prototype),rn.prototype.constructor=rn;var sn=qt?function(e){return qt.get(e)}:an,ln={},un=Object.prototype.hasOwnProperty;function cn(e){for(var t=e.name+"",n=ln[t],i=un.call(ln,t)?n.length:0;i--;){var o=n[i],r=o.func;if(null==r||r==e)return o.name}return t}function dn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function hn(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}function fn(e){if(e instanceof rn)return e.clone();var t=new dn(e.__wrapped__,e.__chain__);return t.__actions__=hn(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}dn.prototype=Kt(nn.prototype),dn.prototype.constructor=dn;var pn=Object.prototype.hasOwnProperty;function gn(e){if(Ze(e)&&!it(e)&&!(e instanceof rn)){if(e instanceof dn)return e;if(pn.call(e,"__wrapped__"))return fn(e)}return new dn(e)}function vn(e){var t=cn(e),n=gn[t];if("function"!=typeof n||!(t in rn.prototype))return!1;if(e===n)return!0;var i=sn(n);return!!i&&e===i[0]}gn.prototype=nn.prototype,gn.prototype.constructor=gn;var mn=Date.now;function yn(e){var t=0,n=0;return function(){var i=mn(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var bn=yn(Xt),xn=/\{\n\/\* \[wrapped with (.+)\] \*/,wn=/,? & /;var En=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function Cn(e){return function(){return e}}var Nn=function(){try{var e=Gt(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_n=Nn?function(e,t){return Nn(e,"toString",{configurable:!0,enumerable:!1,value:Cn(t),writable:!0})}:_t,Sn=yn(_n);function Mn(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););return e}function Tn(e,t,n,i){for(var o=e.length,r=n+(i?1:-1);i?r--:++r<o;)if(t(e[r],r,e))return r;return-1}function An(e){return e!=e}function kn(e,t,n){return t==t?function(e,t,n){for(var i=n-1,o=e.length;++i<o;)if(e[i]===t)return i;return-1}(e,t,n):Tn(e,An,n)}function Rn(e,t){return!!(null==e?0:e.length)&&kn(e,t,0)>-1}var Dn=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function On(e,t,n){var i=t+"";return Sn(e,function(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(En,"{\n/* [wrapped with "+t+"] */\n")}(i,function(e,t){return Mn(Dn,(function(n){var i="_."+n[0];t&n[1]&&!Rn(e,i)&&e.push(i)})),e.sort()}(function(e){var t=e.match(xn);return t?t[1].split(wn):[]}(i),n)))}var Pn=1,In=2,Ln=4,Bn=8,jn=32,Fn=64;function Hn(e,t,n,i,o,r,a,s,l,u){var c=t&Bn;t|=c?jn:Fn,(t&=~(c?Fn:jn))&Ln||(t&=~(Pn|In));var d=[e,t,o,c?r:void 0,c?a:void 0,c?void 0:r,c?void 0:a,s,l,u],h=n.apply(void 0,d);return vn(e)&&bn(h,d),h.placeholder=i,On(h,e,t)}function Wn(e){return e.placeholder}var zn=9007199254740991,Gn=/^(?:0|[1-9]\d*)$/;function Un(e,t){var n=typeof e;return!!(t=null==t?zn:t)&&("number"==n||"symbol"!=n&&Gn.test(e))&&e>-1&&e%1==0&&e<t}var qn=Math.min;var Xn="__lodash_placeholder__";function Vn(e,t){for(var n=-1,i=e.length,o=0,r=[];++n<i;){var a=e[n];a!==t&&a!==Xn||(e[n]=Xn,r[o++]=n)}return r}var Kn=1,Yn=2,$n=8,Zn=16,Jn=128,Qn=512;function ei(e,t,n,i,o,r,a,s,l,u){var c=t&Jn,d=t&Kn,h=t&Yn,f=t&($n|Zn),p=t&Qn,g=h?void 0:Yt(e);return function v(){for(var m=arguments.length,y=Array(m),b=m;b--;)y[b]=arguments[b];if(f)var x=Wn(v),w=function(e,t){for(var n=e.length,i=0;n--;)e[n]===t&&++i;return i}(y,x);if(i&&(y=Qt(y,i,o,f)),r&&(y=tn(y,r,a,f)),m-=w,f&&m<u){var E=Vn(y,x);return Hn(e,t,ei,v.placeholder,n,y,E,s,l,u-m)}var C=d?n:this,N=h?C[e]:e;return m=y.length,s?y=function(e,t){for(var n=e.length,i=qn(t.length,n),o=hn(e);i--;){var r=t[i];e[i]=Un(r,n)?o[r]:void 0}return e}(y,s):p&&m>1&&y.reverse(),c&&l<m&&(y.length=l),this&&this!==He&&this instanceof v&&(N=g||Yt(N)),N.apply(C,y)}}var ti=1;var ni="__lodash_placeholder__",ii=1,oi=2,ri=4,ai=8,si=128,li=256,ui=Math.min;var ci="Expected a function",di=1,hi=2,fi=8,pi=16,gi=32,vi=64,mi=Math.max;function yi(e,t,n,i,o,r,a,s){var l=t&hi;if(!l&&"function"!=typeof e)throw new TypeError(ci);var u=i?i.length:0;if(u||(t&=~(gi|vi),i=o=void 0),a=void 0===a?a:mi(Nt(a),0),s=void 0===s?s:Nt(s),u-=o?o.length:0,t&vi){var c=i,d=o;i=o=void 0}var h=l?void 0:sn(e),f=[e,t,n,i,o,c,d,r,a,s];if(h&&function(e,t){var n=e[1],i=t[1],o=n|i,r=o<(ii|oi|si),a=i==si&&n==ai||i==si&&n==li&&e[7].length<=t[8]||i==(si|li)&&t[7].length<=t[8]&&n==ai;if(!r&&!a)return e;i&ii&&(e[2]=t[2],o|=n&ii?0:ri);var s=t[3];if(s){var l=e[3];e[3]=l?Qt(l,s,t[4]):s,e[4]=l?Vn(e[3],ni):t[4]}(s=t[5])&&(l=e[5],e[5]=l?tn(l,s,t[6]):s,e[6]=l?Vn(e[5],ni):t[6]),(s=t[7])&&(e[7]=s),i&si&&(e[8]=null==e[8]?t[8]:ui(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(f,h),e=f[0],t=f[1],n=f[2],i=f[3],o=f[4],!(s=f[9]=void 0===f[9]?l?0:e.length:mi(f[9]-u,0))&&t&(fi|pi)&&(t&=~(fi|pi)),t&&t!=di)p=t==fi||t==pi?function(e,t,n){var i=Yt(e);return function o(){for(var r=arguments.length,a=Array(r),s=r,l=Wn(o);s--;)a[s]=arguments[s];var u=r<3&&a[0]!==l&&a[r-1]!==l?[]:Vn(a,l);return(r-=u.length)<n?Hn(e,t,ei,o.placeholder,void 0,a,u,void 0,void 0,n-r):Zt(this&&this!==He&&this instanceof o?i:e,this,a)}}(e,t,s):t!=gi&&t!=(di|gi)||o.length?ei.apply(void 0,f):function(e,t,n,i){var o=t&ti,r=Yt(e);return function t(){for(var a=-1,s=arguments.length,l=-1,u=i.length,c=Array(u+s),d=this&&this!==He&&this instanceof t?r:e;++l<u;)c[l]=i[l];for(;s--;)c[l++]=arguments[++a];return Zt(d,o?n:this,c)}}(e,t,n,i);else var p=function(e,t,n){var i=t&$t,o=Yt(e);return function t(){return(this&&this!==He&&this instanceof t?o:e).apply(i?n:this,arguments)}}(e,t,n);return On((h?Xt:bn)(p,f),e,t)}var bi=128;function xi(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,yi(e,bi,void 0,void 0,void 0,void 0,t)}function wi(e,t,n){"__proto__"==t&&Nn?Nn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ei(e,t){return e===t||e!=e&&t!=t}var Ci=Object.prototype.hasOwnProperty;function Ni(e,t,n){var i=e[t];Ci.call(e,t)&&Ei(i,n)&&(void 0!==n||t in e)||wi(e,t,n)}function _i(e,t,n,i){var o=!n;n||(n={});for(var r=-1,a=t.length;++r<a;){var s=t[r],l=i?i(n[s],e[s],s,n,e):void 0;void 0===l&&(l=e[s]),o?wi(n,s,l):Ni(n,s,l)}return n}var Si=Math.max;function Mi(e,t,n){return t=Si(void 0===t?e.length-1:t,0),function(){for(var i=arguments,o=-1,r=Si(i.length-t,0),a=Array(r);++o<r;)a[o]=i[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=i[o];return s[t]=n(a),Zt(e,this,s)}}function Ti(e,t){return Sn(Mi(e,t,_t),e+"")}var Ai=9007199254740991;function ki(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Ai}function Ri(e){return null!=e&&ki(e.length)&&!kt(e)}function Di(e,t,n){if(!pt(n))return!1;var i=typeof t;return!!("number"==i?Ri(n)&&Un(t,n.length):"string"==i&&t in n)&&Ei(n[t],e)}function Oi(e){return Ti((function(t,n){var i=-1,o=n.length,r=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(o--,r):void 0,a&&Di(n[0],n[1],a)&&(r=o<3?void 0:r,o=1),t=Object(t);++i<o;){var s=n[i];s&&e(t,s,i,r)}return t}))}var Pi=Object.prototype;function Ii(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Pi)}function Li(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}function Bi(e){return Ze(e)&&"[object Arguments]"==$e(e)}var ji=Object.prototype,Fi=ji.hasOwnProperty,Hi=ji.propertyIsEnumerable,Wi=Bi(function(){return arguments}())?Bi:function(e){return Ze(e)&&Fi.call(e,"callee")&&!Hi.call(e,"callee")};function zi(){return!1}var Gi="object"==typeof e&&e&&!e.nodeType&&e,Ui=Gi&&"object"==typeof module&&module&&!module.nodeType&&module,qi=Ui&&Ui.exports===Gi?He.Buffer:void 0,Xi=(qi?qi.isBuffer:void 0)||zi,Vi={};function Ki(e){return function(t){return e(t)}}Vi["[object Float32Array]"]=Vi["[object Float64Array]"]=Vi["[object Int8Array]"]=Vi["[object Int16Array]"]=Vi["[object Int32Array]"]=Vi["[object Uint8Array]"]=Vi["[object Uint8ClampedArray]"]=Vi["[object Uint16Array]"]=Vi["[object Uint32Array]"]=!0,Vi["[object Arguments]"]=Vi["[object Array]"]=Vi["[object ArrayBuffer]"]=Vi["[object Boolean]"]=Vi["[object DataView]"]=Vi["[object Date]"]=Vi["[object Error]"]=Vi["[object Function]"]=Vi["[object Map]"]=Vi["[object Number]"]=Vi["[object Object]"]=Vi["[object RegExp]"]=Vi["[object Set]"]=Vi["[object String]"]=Vi["[object WeakMap]"]=!1;var Yi="object"==typeof e&&e&&!e.nodeType&&e,$i=Yi&&"object"==typeof module&&module&&!module.nodeType&&module,Zi=$i&&$i.exports===Yi&&je.process,Ji=function(){try{var e=$i&&$i.require&&$i.require("util").types;return e||Zi&&Zi.binding&&Zi.binding("util")}catch(e){}}(),Qi=Ji&&Ji.isTypedArray,eo=Qi?Ki(Qi):function(e){return Ze(e)&&ki(e.length)&&!!Vi[$e(e)]},to=Object.prototype.hasOwnProperty;function no(e,t){var n=it(e),i=!n&&Wi(e),o=!n&&!i&&Xi(e),r=!n&&!i&&!o&&eo(e),a=n||i||o||r,s=a?Li(e.length,String):[],l=s.length;for(var u in e)!t&&!to.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||r&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Un(u,l))||s.push(u);return s}function io(e,t){return function(n){return e(t(n))}}var oo=io(Object.keys,Object),ro=Object.prototype.hasOwnProperty;function ao(e){if(!Ii(e))return oo(e);var t=[];for(var n in Object(e))ro.call(e,n)&&"constructor"!=n&&t.push(n);return t}function so(e){return Ri(e)?no(e):ao(e)}var lo=Object.prototype.hasOwnProperty,uo=Oi((function(e,t){if(Ii(t)||Ri(t))_i(t,so(t),e);else for(var n in t)lo.call(t,n)&&Ni(e,n,t[n])}));var co=Object.prototype.hasOwnProperty;function ho(e){if(!pt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Ii(e),n=[];for(var i in e)("constructor"!=i||!t&&co.call(e,i))&&n.push(i);return n}function fo(e){return Ri(e)?no(e,!0):ho(e)}var po=Oi((function(e,t){_i(t,fo(t),e)})),go=Oi((function(e,t,n,i){_i(t,fo(t),e,i)})),vo=Oi((function(e,t,n,i){_i(t,so(t),e,i)})),mo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,yo=/^\w*$/;function bo(e,t){if(it(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Qe(e))||(yo.test(e)||!mo.test(e)||null!=t&&e in Object(t))}var xo=Gt(Object,"create");var wo=Object.prototype.hasOwnProperty;var Eo=Object.prototype.hasOwnProperty;function Co(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function No(e,t){for(var n=e.length;n--;)if(Ei(e[n][0],t))return n;return-1}Co.prototype.clear=function(){this.__data__=xo?xo(null):{},this.size=0},Co.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Co.prototype.get=function(e){var t=this.__data__;if(xo){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return wo.call(t,e)?t[e]:void 0},Co.prototype.has=function(e){var t=this.__data__;return xo?void 0!==t[e]:Eo.call(t,e)},Co.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=xo&&void 0===t?"__lodash_hash_undefined__":t,this};var _o=Array.prototype.splice;function So(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}So.prototype.clear=function(){this.__data__=[],this.size=0},So.prototype.delete=function(e){var t=this.__data__,n=No(t,e);return!(n<0)&&(n==t.length-1?t.pop():_o.call(t,n,1),--this.size,!0)},So.prototype.get=function(e){var t=this.__data__,n=No(t,e);return n<0?void 0:t[n][1]},So.prototype.has=function(e){return No(this.__data__,e)>-1},So.prototype.set=function(e,t){var n=this.__data__,i=No(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var Mo=Gt(He,"Map");function To(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Ao(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Ao.prototype.clear=function(){this.size=0,this.__data__={hash:new Co,map:new(Mo||So),string:new Co}},Ao.prototype.delete=function(e){var t=To(this,e).delete(e);return this.size-=t?1:0,t},Ao.prototype.get=function(e){return To(this,e).get(e)},Ao.prototype.has=function(e){return To(this,e).has(e)},Ao.prototype.set=function(e,t){var n=To(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};var ko="Expected a function";function Ro(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(ko);var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(Ro.Cache||Ao),n}Ro.Cache=Ao;var Do=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Oo=/\\(\\)?/g,Po=function(e){var t=Ro(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Do,(function(e,n,i,o){t.push(i?o.replace(Oo,"$1"):n||e)})),t}));function Io(e){return null==e?"":st(e)}function Lo(e,t){return it(e)?e:bo(e,t)?[e]:Po(Io(e))}var Bo=1/0;function jo(e){if("string"==typeof e||Qe(e))return e;var t=e+"";return"0"==t&&1/e==-Bo?"-0":t}function Fo(e,t){for(var n=0,i=(t=Lo(t,e)).length;null!=e&&n<i;)e=e[jo(t[n++])];return n&&n==i?e:void 0}function Ho(e,t,n){var i=null==e?void 0:Fo(e,t);return void 0===i?n:i}function Wo(e,t){for(var n=-1,i=t.length,o=Array(i),r=null==e;++n<i;)o[n]=r?void 0:Ho(e,t[n]);return o}function zo(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}var Go=We?We.isConcatSpreadable:void 0;function Uo(e){return it(e)||Wi(e)||!!(Go&&e&&e[Go])}function qo(e,t,n,i,o){var r=-1,a=e.length;for(n||(n=Uo),o||(o=[]);++r<a;){var s=e[r];t>0&&n(s)?t>1?qo(s,t-1,n,i,o):zo(o,s):i||(o[o.length]=s)}return o}function Xo(e){return(null==e?0:e.length)?qo(e,1):[]}function Vo(e){return Sn(Mi(e,void 0,Xo),e+"")}var Ko=Vo(Wo),Yo=io(Object.getPrototypeOf,Object),$o="[object Object]",Zo=Function.prototype,Jo=Object.prototype,Qo=Zo.toString,er=Jo.hasOwnProperty,tr=Qo.call(Object);function nr(e){if(!Ze(e)||$e(e)!=$o)return!1;var t=Yo(e);if(null===t)return!0;var n=er.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Qo.call(n)==tr}var ir="[object DOMException]",or="[object Error]";function rr(e){if(!Ze(e))return!1;var t=$e(e);return t==or||t==ir||"string"==typeof e.message&&"string"==typeof e.name&&!nr(e)}var ar=Ti((function(e,t){try{return Zt(e,void 0,t)}catch(e){return rr(e)?e:new Error(e)}})),sr="Expected a function";function lr(e,t){var n;if("function"!=typeof t)throw new TypeError(sr);return e=Nt(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var ur=Ti((function(e,t,n){var i=1;if(n.length){var o=Vn(n,Wn(ur));i|=32}return yi(e,i,t,n,o)}));ur.placeholder={};var cr=Vo((function(e,t){return Mn(t,(function(t){t=jo(t),wi(e,t,ur(e[t],e))})),e})),dr=Ti((function(e,t,n){var i=3;if(n.length){var o=Vn(n,Wn(dr));i|=32}return yi(t,i,e,n,o)}));function hr(e,t,n){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(o);++i<o;)r[i]=e[i+t];return r}function fr(e,t,n){var i=e.length;return n=void 0===n?i:n,!t&&n>=i?e:hr(e,t,n)}dr.placeholder={};var pr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function gr(e){return pr.test(e)}var vr="\\ud800-\\udfff",mr="["+vr+"]",yr="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",br="\\ud83c[\\udffb-\\udfff]",xr="[^"+vr+"]",wr="(?:\\ud83c[\\udde6-\\uddff]){2}",Er="[\\ud800-\\udbff][\\udc00-\\udfff]",Cr="(?:"+yr+"|"+br+")"+"?",Nr="[\\ufe0e\\ufe0f]?",_r=Nr+Cr+("(?:\\u200d(?:"+[xr,wr,Er].join("|")+")"+Nr+Cr+")*"),Sr="(?:"+[xr+yr+"?",yr,wr,Er,mr].join("|")+")",Mr=RegExp(br+"(?="+br+")|"+Sr+_r,"g");function Tr(e){return gr(e)?function(e){return e.match(Mr)||[]}(e):function(e){return e.split("")}(e)}function Ar(e){return function(t){var n=gr(t=Io(t))?Tr(t):void 0,i=n?n[0]:t.charAt(0),o=n?fr(n,1).join(""):t.slice(1);return i[e]()+o}}var kr=Ar("toUpperCase");function Rr(e){return kr(Io(e).toLowerCase())}function Dr(e,t,n,i){var o=-1,r=null==e?0:e.length;for(i&&r&&(n=e[++o]);++o<r;)n=t(n,e[o],o,e);return n}function Or(e){return function(t){return null==e?void 0:e[t]}}var Pr=Or({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Ir=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Lr=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");function Br(e){return(e=Io(e))&&e.replace(Ir,Pr).replace(Lr,"")}var jr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Fr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Hr="\\ud800-\\udfff",Wr="\\u2700-\\u27bf",zr="a-z\\xdf-\\xf6\\xf8-\\xff",Gr="A-Z\\xc0-\\xd6\\xd8-\\xde",Ur="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",qr="["+Ur+"]",Xr="\\d+",Vr="["+Wr+"]",Kr="["+zr+"]",Yr="[^"+Hr+Ur+Xr+Wr+zr+Gr+"]",$r="(?:\\ud83c[\\udde6-\\uddff]){2}",Zr="[\\ud800-\\udbff][\\udc00-\\udfff]",Jr="["+Gr+"]",Qr="(?:"+Kr+"|"+Yr+")",ea="(?:"+Jr+"|"+Yr+")",ta="(?:['’](?:d|ll|m|re|s|t|ve))?",na="(?:['’](?:D|LL|M|RE|S|T|VE))?",ia="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",oa="[\\ufe0e\\ufe0f]?",ra=oa+ia+("(?:\\u200d(?:"+["[^"+Hr+"]",$r,Zr].join("|")+")"+oa+ia+")*"),aa="(?:"+[Vr,$r,Zr].join("|")+")"+ra,sa=RegExp([Jr+"?"+Kr+"+"+ta+"(?="+[qr,Jr,"$"].join("|")+")",ea+"+"+na+"(?="+[qr,Jr+Qr,"$"].join("|")+")",Jr+"?"+Qr+"+"+ta,Jr+"+"+na,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Xr,aa].join("|"),"g");function la(e,t,n){return e=Io(e),void 0===(t=n?void 0:t)?function(e){return Fr.test(e)}(e)?function(e){return e.match(sa)||[]}(e):function(e){return e.match(jr)||[]}(e):e.match(t)||[]}var ua=RegExp("['’]","g");function ca(e){return function(t){return Dr(la(Br(t).replace(ua,"")),e,"")}}var da=ca((function(e,t,n){return t=t.toLowerCase(),e+(n?Rr(t):t)}));var ha=He.isFinite,fa=Math.min;function pa(e){var t=Math[e];return function(e,n){if(e=xt(e),(n=null==n?0:fa(Nt(n),292))&&ha(e)){var i=(Io(e)+"e").split("e");return+((i=(Io(t(i[0]+"e"+(+i[1]+n)))+"e").split("e"))[0]+"e"+(+i[1]-n))}return t(e)}}var ga=pa("ceil");function va(e){var t=gn(e);return t.__chain__=!0,t}var ma=Math.ceil,ya=Math.max;function ba(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function xa(e){var t=this.__data__=new So(e);this.size=t.size}function wa(e,t){return e&&_i(t,so(t),e)}xa.prototype.clear=function(){this.__data__=new So,this.size=0},xa.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},xa.prototype.get=function(e){return this.__data__.get(e)},xa.prototype.has=function(e){return this.__data__.has(e)},xa.prototype.set=function(e,t){var n=this.__data__;if(n instanceof So){var i=n.__data__;if(!Mo||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ao(i)}return n.set(e,t),this.size=n.size,this};var Ea="object"==typeof e&&e&&!e.nodeType&&e,Ca=Ea&&"object"==typeof module&&module&&!module.nodeType&&module,Na=Ca&&Ca.exports===Ea?He.Buffer:void 0,_a=Na?Na.allocUnsafe:void 0;function Sa(e,t){if(t)return e.slice();var n=e.length,i=_a?_a(n):new e.constructor(n);return e.copy(i),i}function Ma(e,t){for(var n=-1,i=null==e?0:e.length,o=0,r=[];++n<i;){var a=e[n];t(a,n,e)&&(r[o++]=a)}return r}function Ta(){return[]}var Aa=Object.prototype.propertyIsEnumerable,ka=Object.getOwnPropertySymbols,Ra=ka?function(e){return null==e?[]:(e=Object(e),Ma(ka(e),(function(t){return Aa.call(e,t)})))}:Ta;var Da=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)zo(t,Ra(e)),e=Yo(e);return t}:Ta;function Oa(e,t,n){var i=t(e);return it(e)?i:zo(i,n(e))}function Pa(e){return Oa(e,so,Ra)}function Ia(e){return Oa(e,fo,Da)}var La=Gt(He,"DataView"),Ba=Gt(He,"Promise"),ja=Gt(He,"Set"),Fa="[object Map]",Ha="[object Promise]",Wa="[object Set]",za="[object WeakMap]",Ga="[object DataView]",Ua=It(La),qa=It(Mo),Xa=It(Ba),Va=It(ja),Ka=It(Ut),Ya=$e;(La&&Ya(new La(new ArrayBuffer(1)))!=Ga||Mo&&Ya(new Mo)!=Fa||Ba&&Ya(Ba.resolve())!=Ha||ja&&Ya(new ja)!=Wa||Ut&&Ya(new Ut)!=za)&&(Ya=function(e){var t=$e(e),n="[object Object]"==t?e.constructor:void 0,i=n?It(n):"";if(i)switch(i){case Ua:return Ga;case qa:return Fa;case Xa:return Ha;case Va:return Wa;case Ka:return za}return t});var $a=Ya,Za=Object.prototype.hasOwnProperty;var Ja=He.Uint8Array;function Qa(e){var t=new e.constructor(e.byteLength);return new Ja(t).set(new Ja(e)),t}var es=/\w*$/;var ts=We?We.prototype:void 0,ns=ts?ts.valueOf:void 0;function is(e,t){var n=t?Qa(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var os="[object Boolean]",rs="[object Date]",as="[object Map]",ss="[object Number]",ls="[object RegExp]",us="[object Set]",cs="[object String]",ds="[object Symbol]",hs="[object ArrayBuffer]",fs="[object DataView]",ps="[object Float32Array]",gs="[object Float64Array]",vs="[object Int8Array]",ms="[object Int16Array]",ys="[object Int32Array]",bs="[object Uint8Array]",xs="[object Uint8ClampedArray]",ws="[object Uint16Array]",Es="[object Uint32Array]";function Cs(e,t,n){var i,o=e.constructor;switch(t){case hs:return Qa(e);case os:case rs:return new o(+e);case fs:return function(e,t){var n=t?Qa(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case ps:case gs:case vs:case ms:case ys:case bs:case xs:case ws:case Es:return is(e,n);case as:return new o;case ss:case cs:return new o(e);case ls:return function(e){var t=new e.constructor(e.source,es.exec(e));return t.lastIndex=e.lastIndex,t}(e);case us:return new o;case ds:return i=e,ns?Object(ns.call(i)):{}}}function Ns(e){return"function"!=typeof e.constructor||Ii(e)?{}:Kt(Yo(e))}var _s=Ji&&Ji.isMap,Ss=_s?Ki(_s):function(e){return Ze(e)&&"[object Map]"==$a(e)};var Ms=Ji&&Ji.isSet,Ts=Ms?Ki(Ms):function(e){return Ze(e)&&"[object Set]"==$a(e)},As=1,ks=2,Rs=4,Ds="[object Arguments]",Os="[object Function]",Ps="[object GeneratorFunction]",Is="[object Object]",Ls={};function Bs(e,t,n,i,o,r){var a,s=t&As,l=t&ks,u=t&Rs;if(n&&(a=o?n(e,i,o,r):n(e)),void 0!==a)return a;if(!pt(e))return e;var c=it(e);if(c){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Za.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return hn(e,a)}else{var d=$a(e),h=d==Os||d==Ps;if(Xi(e))return Sa(e,s);if(d==Is||d==Ds||h&&!o){if(a=l||h?{}:Ns(e),!s)return l?function(e,t){return _i(e,Da(e),t)}(e,function(e,t){return e&&_i(t,fo(t),e)}(a,e)):function(e,t){return _i(e,Ra(e),t)}(e,wa(a,e))}else{if(!Ls[d])return o?e:{};a=Cs(e,d,s)}}r||(r=new xa);var f=r.get(e);if(f)return f;r.set(e,a),Ts(e)?e.forEach((function(i){a.add(Bs(i,t,n,i,e,r))})):Ss(e)&&e.forEach((function(i,o){a.set(o,Bs(i,t,n,o,e,r))}));var p=c?void 0:(u?l?Ia:Pa:l?fo:so)(e);return Mn(p||e,(function(i,o){p&&(i=e[o=i]),Ni(a,o,Bs(i,t,n,o,e,r))})),a}Ls[Ds]=Ls["[object Array]"]=Ls["[object ArrayBuffer]"]=Ls["[object DataView]"]=Ls["[object Boolean]"]=Ls["[object Date]"]=Ls["[object Float32Array]"]=Ls["[object Float64Array]"]=Ls["[object Int8Array]"]=Ls["[object Int16Array]"]=Ls["[object Int32Array]"]=Ls["[object Map]"]=Ls["[object Number]"]=Ls[Is]=Ls["[object RegExp]"]=Ls["[object Set]"]=Ls["[object String]"]=Ls["[object Symbol]"]=Ls["[object Uint8Array]"]=Ls["[object Uint8ClampedArray]"]=Ls["[object Uint16Array]"]=Ls["[object Uint32Array]"]=!0,Ls["[object Error]"]=Ls[Os]=Ls["[object WeakMap]"]=!1;function js(e){return Bs(e,5)}function Fs(){var e=arguments.length;if(!e)return[];for(var t=Array(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return zo(it(n)?hn(n):[n],qo(t,1))}function Hs(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Ao;++t<n;)this.add(e[t])}function Ws(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function zs(e,t){return e.has(t)}Hs.prototype.add=Hs.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Hs.prototype.has=function(e){return this.__data__.has(e)};var Gs=1,Us=2;function qs(e,t,n,i,o,r){var a=n&Gs,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var u=r.get(e),c=r.get(t);if(u&&c)return u==t&&c==e;var d=-1,h=!0,f=n&Us?new Hs:void 0;for(r.set(e,t),r.set(t,e);++d<s;){var p=e[d],g=t[d];if(i)var v=a?i(g,p,d,t,e,r):i(p,g,d,e,t,r);if(void 0!==v){if(v)continue;h=!1;break}if(f){if(!Ws(t,(function(e,t){if(!zs(f,t)&&(p===e||o(p,e,n,i,r)))return f.push(t)}))){h=!1;break}}else if(p!==g&&!o(p,g,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h}function Xs(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Vs(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Ks=1,Ys=2,$s="[object Boolean]",Zs="[object Date]",Js="[object Error]",Qs="[object Map]",el="[object Number]",tl="[object RegExp]",nl="[object Set]",il="[object String]",ol="[object Symbol]",rl="[object ArrayBuffer]",al="[object DataView]",sl=We?We.prototype:void 0,ll=sl?sl.valueOf:void 0;var ul=1,cl=Object.prototype.hasOwnProperty;var dl=1,hl="[object Arguments]",fl="[object Array]",pl="[object Object]",gl=Object.prototype.hasOwnProperty;function vl(e,t,n,i,o,r){var a=it(e),s=it(t),l=a?fl:$a(e),u=s?fl:$a(t),c=(l=l==hl?pl:l)==pl,d=(u=u==hl?pl:u)==pl,h=l==u;if(h&&Xi(e)){if(!Xi(t))return!1;a=!0,c=!1}if(h&&!c)return r||(r=new xa),a||eo(e)?qs(e,t,n,i,o,r):function(e,t,n,i,o,r,a){switch(n){case al:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rl:return!(e.byteLength!=t.byteLength||!r(new Ja(e),new Ja(t)));case $s:case Zs:case el:return Ei(+e,+t);case Js:return e.name==t.name&&e.message==t.message;case tl:case il:return e==t+"";case Qs:var s=Xs;case nl:var l=i&Ks;if(s||(s=Vs),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;i|=Ys,a.set(e,t);var c=qs(s(e),s(t),i,o,r,a);return a.delete(e),c;case ol:if(ll)return ll.call(e)==ll.call(t)}return!1}(e,t,l,n,i,o,r);if(!(n&dl)){var f=c&&gl.call(e,"__wrapped__"),p=d&&gl.call(t,"__wrapped__");if(f||p){var g=f?e.value():e,v=p?t.value():t;return r||(r=new xa),o(g,v,n,i,r)}}return!!h&&(r||(r=new xa),function(e,t,n,i,o,r){var a=n&ul,s=Pa(e),l=s.length;if(l!=Pa(t).length&&!a)return!1;for(var u=l;u--;){var c=s[u];if(!(a?c in t:cl.call(t,c)))return!1}var d=r.get(e),h=r.get(t);if(d&&h)return d==t&&h==e;var f=!0;r.set(e,t),r.set(t,e);for(var p=a;++u<l;){var g=e[c=s[u]],v=t[c];if(i)var m=a?i(v,g,c,t,e,r):i(g,v,c,e,t,r);if(!(void 0===m?g===v||o(g,v,n,i,r):m)){f=!1;break}p||(p="constructor"==c)}if(f&&!p){var y=e.constructor,b=t.constructor;y==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(f=!1)}return r.delete(e),r.delete(t),f}(e,t,n,i,o,r))}function ml(e,t,n,i,o){return e===t||(null==e||null==t||!Ze(e)&&!Ze(t)?e!=e&&t!=t:vl(e,t,n,i,ml,o))}var yl=1,bl=2;function xl(e,t,n,i){var o=n.length,r=o,a=!i;if(null==e)return!r;for(e=Object(e);o--;){var s=n[o];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<r;){var l=(s=n[o])[0],u=e[l],c=s[1];if(a&&s[2]){if(void 0===u&&!(l in e))return!1}else{var d=new xa;if(i)var h=i(u,c,l,e,t,d);if(!(void 0===h?ml(c,u,yl|bl,i,d):h))return!1}}return!0}function wl(e){return e==e&&!pt(e)}function El(e){for(var t=so(e),n=t.length;n--;){var i=t[n],o=e[i];t[n]=[i,o,wl(o)]}return t}function Cl(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function Nl(e){var t=El(e);return 1==t.length&&t[0][2]?Cl(t[0][0],t[0][1]):function(n){return n===e||xl(n,e,t)}}function _l(e,t){return null!=e&&t in Object(e)}function Sl(e,t,n){for(var i=-1,o=(t=Lo(t,e)).length,r=!1;++i<o;){var a=jo(t[i]);if(!(r=null!=e&&n(e,a)))break;e=e[a]}return r||++i!=o?r:!!(o=null==e?0:e.length)&&ki(o)&&Un(a,o)&&(it(e)||Wi(e))}function Ml(e,t){return null!=e&&Sl(e,t,_l)}var Tl=1,Al=2;function kl(e,t){return bo(e)&&wl(t)?Cl(jo(e),t):function(n){var i=Ho(n,e);return void 0===i&&i===t?Ml(n,e):ml(t,i,Tl|Al)}}function Rl(e){return function(t){return null==t?void 0:t[e]}}function Dl(e){return bo(e)?Rl(jo(e)):function(e){return function(t){return Fo(t,e)}}(e)}function Ol(e){return"function"==typeof e?e:null==e?_t:"object"==typeof e?it(e)?kl(e[0],e[1]):Nl(e):Dl(e)}function Pl(e,t,n){var i=n.length;if(null==e)return!i;for(e=Object(e);i--;){var o=n[i],r=t[o],a=e[o];if(void 0===a&&!(o in e)||!r(a))return!1}return!0}function Il(e,t,n,i){for(var o=-1,r=null==e?0:e.length;++o<r;){var a=e[o];t(i,a,n(a),e)}return i}function Ll(e){return function(t,n,i){for(var o=-1,r=Object(t),a=i(t),s=a.length;s--;){var l=a[e?s:++o];if(!1===n(r[l],l,r))break}return t}}var Bl=Ll();function jl(e,t){return e&&Bl(e,t,so)}function Fl(e,t){return function(n,i){if(null==n)return n;if(!Ri(n))return e(n,i);for(var o=n.length,r=t?o:-1,a=Object(n);(t?r--:++r<o)&&!1!==i(a[r],r,a););return n}}var Hl=Fl(jl);function Wl(e,t,n,i){return Hl(e,(function(e,o,r){t(i,e,n(e),r)})),i}function zl(e,t){return function(n,i){var o=it(n)?Il:Wl,r=t?t():{};return o(n,e,Ol(i),r)}}var Gl=Object.prototype.hasOwnProperty,Ul=zl((function(e,t,n){Gl.call(e,n)?++e[n]:wi(e,n,1)}));function ql(e,t,n){var i=yi(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=ql.placeholder,i}ql.placeholder={};function Xl(e,t,n){var i=yi(e,16,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=Xl.placeholder,i}Xl.placeholder={};var Vl=function(){return He.Date.now()},Kl="Expected a function",Yl=Math.max,$l=Math.min;function Zl(e,t,n){var i,o,r,a,s,l,u=0,c=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError(Kl);function f(t){var n=i,r=o;return i=o=void 0,u=t,a=e.apply(r,n)}function p(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-u>=r}function g(){var e=Vl();if(p(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return d?$l(n,r-(e-u)):n}(e))}function v(e){return s=void 0,h&&i?f(e):(i=o=void 0,a)}function m(){var e=Vl(),n=p(e);if(i=arguments,o=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(g,t),c?f(e):a}(l);if(d)return clearTimeout(s),s=setTimeout(g,t),f(l)}return void 0===s&&(s=setTimeout(g,t)),a}return t=xt(t)||0,pt(n)&&(c=!!n.leading,r=(d="maxWait"in n)?Yl(xt(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,i=l=o=s=void 0},m.flush=function(){return void 0===s?a:v(Vl())},m}var Jl=Object.prototype,Ql=Jl.hasOwnProperty,eu=Ti((function(e,t){e=Object(e);var n=-1,i=t.length,o=i>2?t[2]:void 0;for(o&&Di(t[0],t[1],o)&&(i=1);++n<i;)for(var r=t[n],a=fo(r),s=-1,l=a.length;++s<l;){var u=a[s],c=e[u];(void 0===c||Ei(c,Jl[u])&&!Ql.call(e,u))&&(e[u]=r[u])}return e}));function tu(e,t,n){(void 0!==n&&!Ei(e[t],n)||void 0===n&&!(t in e))&&wi(e,t,n)}function nu(e){return Ze(e)&&Ri(e)}function iu(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ou(e){return _i(e,fo(e))}function ru(e,t,n,i,o){e!==t&&Bl(t,(function(r,a){if(o||(o=new xa),pt(r))!function(e,t,n,i,o,r,a){var s=iu(e,n),l=iu(t,n),u=a.get(l);if(u)tu(e,n,u);else{var c=r?r(s,l,n+"",e,t,a):void 0,d=void 0===c;if(d){var h=it(l),f=!h&&Xi(l),p=!h&&!f&&eo(l);c=l,h||f||p?it(s)?c=s:nu(s)?c=hn(s):f?(d=!1,c=Sa(l,!0)):p?(d=!1,c=is(l,!0)):c=[]:nr(l)||Wi(l)?(c=s,Wi(s)?c=ou(s):pt(s)&&!kt(s)||(c=Ns(l))):d=!1}d&&(a.set(l,c),o(c,l,i,r,a),a.delete(l)),tu(e,n,c)}}(e,t,a,n,ru,i,o);else{var s=i?i(iu(e,a),r,a+"",e,t,o):void 0;void 0===s&&(s=r),tu(e,a,s)}}),fo)}function au(e,t,n,i,o,r){return pt(e)&&pt(t)&&(r.set(t,e),ru(e,t,void 0,au,r),r.delete(t)),e}var su=Oi((function(e,t,n,i){ru(e,t,n,i)})),lu=Ti((function(e){return e.push(void 0,au),Zt(su,void 0,e)}));function uu(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)}var cu=Ti((function(e,t){return uu(e,1,t)})),du=Ti((function(e,t,n){return uu(e,xt(t)||0,n)}));function hu(e,t,n){for(var i=-1,o=null==e?0:e.length;++i<o;)if(n(t,e[i]))return!0;return!1}var fu=200;function pu(e,t,n,i){var o=-1,r=Rn,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=nt(t,Ki(n))),i?(r=hu,a=!1):t.length>=fu&&(r=zs,a=!1,t=new Hs(t));e:for(;++o<s;){var c=e[o],d=null==n?c:n(c);if(c=i||0!==c?c:0,a&&d==d){for(var h=u;h--;)if(t[h]===d)continue e;l.push(c)}else r(t,d,i)||l.push(c)}return l}var gu=Ti((function(e,t){return nu(e)?pu(e,qo(t,1,nu,!0)):[]}));function vu(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var mu=Ti((function(e,t){var n=vu(t);return nu(n)&&(n=void 0),nu(e)?pu(e,qo(t,1,nu,!0),Ol(n)):[]})),yu=Ti((function(e,t){var n=vu(t);return nu(n)&&(n=void 0),nu(e)?pu(e,qo(t,1,nu,!0),void 0,n):[]})),bu=lt((function(e,t){return e/t}),1);function xu(e,t,n,i){for(var o=e.length,r=i?o:-1;(i?r--:++r<o)&&t(e[r],r,e););return n?hr(e,i?0:r,i?r+1:o):hr(e,i?r+1:0,i?o:r)}function wu(e){return"function"==typeof e?e:_t}function Eu(e,t){return(it(e)?Mn:Hl)(e,wu(t))}function Cu(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}var Nu=Ll(!0);function _u(e,t){return e&&Nu(e,t,so)}var Su=Fl(_u,!0);function Mu(e,t){return(it(e)?Cu:Su)(e,wu(t))}function Tu(e){return function(t){var n=$a(t);return"[object Map]"==n?Xs(t):"[object Set]"==n?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return nt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}var Au=Tu(so),ku=Tu(fo),Ru=Or({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),Du=/[&<>"']/g,Ou=RegExp(Du.source);function Pu(e){return(e=Io(e))&&Ou.test(e)?e.replace(Du,Ru):e}var Iu=/[\\^$.*+?()[\]{}|]/g,Lu=RegExp(Iu.source);function Bu(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(!t(e[n],n,e))return!1;return!0}function ju(e,t){var n=!0;return Hl(e,(function(e,i,o){return n=!!t(e,i,o)})),n}var Fu=4294967295;function Hu(e){return e?ba(Nt(e),0,Fu):0}function Wu(e,t){var n=[];return Hl(e,(function(e,i,o){t(e,i,o)&&n.push(e)})),n}function zu(e,t){return(it(e)?Ma:Wu)(e,Ol(t))}function Gu(e){return function(t,n,i){var o=Object(t);if(!Ri(t)){var r=Ol(n);t=so(t),n=function(e){return r(o[e],e,o)}}var a=e(t,n,i);return a>-1?o[r?t[a]:a]:void 0}}var Uu=Math.max;function qu(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=null==n?0:Nt(n);return o<0&&(o=Uu(i+o,0)),Tn(e,Ol(t),o)}var Xu=Gu(qu);function Vu(e,t,n){var i;return n(e,(function(e,n,o){if(t(e,n,o))return i=n,!1})),i}var Ku=Math.max,Yu=Math.min;function $u(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return void 0!==n&&(o=Nt(n),o=n<0?Ku(i+o,0):Yu(o,i-1)),Tn(e,Ol(t),o,!0)}var Zu=Gu($u);function Ju(e){return e&&e.length?e[0]:void 0}function Qu(e,t){var n=-1,i=Ri(e)?Array(e.length):[];return Hl(e,(function(e,o,r){i[++n]=t(e,o,r)})),i}function ec(e,t){return(it(e)?nt:Qu)(e,Ol(t))}var tc=1/0;var nc=1/0;var ic=pa("floor");function oc(e){return Vo((function(t){var n=t.length,i=n,o=dn.prototype.thru;for(e&&t.reverse();i--;){var r=t[i];if("function"!=typeof r)throw new TypeError("Expected a function");if(o&&!a&&"wrapper"==cn(r))var a=new dn([],!0)}for(i=a?i:n;++i<n;){var s=cn(r=t[i]),l="wrapper"==s?sn(r):void 0;a=l&&vn(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[cn(l[0])].apply(a,l[3]):1==r.length&&vn(r)?a[s]():a.thru(r)}return function(){var e=arguments,i=e[0];if(a&&1==e.length&&it(i))return a.plant(i).value();for(var o=0,r=n?t[o].apply(this,e):i;++o<n;)r=t[o].call(this,r);return r}}))}var rc=oc(),ac=oc(!0);function sc(e,t){return Ma(t,(function(t){return kt(e[t])}))}var lc=Object.prototype.hasOwnProperty,uc=zl((function(e,t,n){lc.call(e,n)?e[n].push(t):wi(e,n,[t])}));function cc(e,t){return e>t}function dc(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=xt(t),n=xt(n)),e(t,n)}}var hc=dc(cc),fc=dc((function(e,t){return e>=t})),pc=Object.prototype.hasOwnProperty;function gc(e,t){return null!=e&&pc.call(e,t)}function vc(e,t){return null!=e&&Sl(e,t,gc)}var mc=Math.max,yc=Math.min;var bc="[object String]";function xc(e){return"string"==typeof e||!it(e)&&Ze(e)&&$e(e)==bc}function wc(e,t){return nt(t,(function(t){return e[t]}))}function Ec(e){return null==e?[]:wc(e,so(e))}var Cc=Math.max;var Nc=Math.max;var _c=Math.min;function Sc(e,t,n){for(var i=n?hu:Rn,o=e[0].length,r=e.length,a=r,s=Array(r),l=1/0,u=[];a--;){var c=e[a];a&&t&&(c=nt(c,Ki(t))),l=_c(c.length,l),s[a]=!n&&(t||o>=120&&c.length>=120)?new Hs(a&&c):void 0}c=e[0];var d=-1,h=s[0];e:for(;++d<o&&u.length<l;){var f=c[d],p=t?t(f):f;if(f=n||0!==f?f:0,!(h?zs(h,p):i(u,p,n))){for(a=r;--a;){var g=s[a];if(!(g?zs(g,p):i(e[a],p,n)))continue e}h&&h.push(p),u.push(f)}}return u}function Mc(e){return nu(e)?e:[]}var Tc=Ti((function(e){var t=nt(e,Mc);return t.length&&t[0]===e[0]?Sc(t):[]})),Ac=Ti((function(e){var t=vu(e),n=nt(e,Mc);return t===vu(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?Sc(n,Ol(t)):[]})),kc=Ti((function(e){var t=vu(e),n=nt(e,Mc);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?Sc(n,void 0,t):[]}));function Rc(e,t){return function(n,i){return function(e,t,n,i){return jl(e,(function(e,o,r){t(i,n(e),o,r)})),i}(n,e,t(i),{})}}var Dc=Object.prototype.toString,Oc=Rc((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Dc.call(t)),e[t]=n}),Cn(_t)),Pc=Object.prototype,Ic=Pc.hasOwnProperty,Lc=Pc.toString,Bc=Rc((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Lc.call(t)),Ic.call(e,t)?e[t].push(n):e[t]=[n]}),Ol);function jc(e,t){return t.length<2?e:Fo(e,hr(t,0,-1))}function Fc(e,t,n){var i=null==(e=jc(e,t=Lo(t,e)))?e:e[jo(vu(t))];return null==i?void 0:Zt(i,e,n)}var Hc=Ti(Fc),Wc=Ti((function(e,t,n){var i=-1,o="function"==typeof t,r=Ri(e)?Array(e.length):[];return Hl(e,(function(e){r[++i]=o?Zt(t,e,n):Fc(e,t,n)})),r}));var zc=Ji&&Ji.isArrayBuffer,Gc=zc?Ki(zc):function(e){return Ze(e)&&"[object ArrayBuffer]"==$e(e)};var Uc=Ji&&Ji.isDate,qc=Uc?Ki(Uc):function(e){return Ze(e)&&"[object Date]"==$e(e)};var Xc=Object.prototype.hasOwnProperty;function Vc(e){if(null==e)return!0;if(Ri(e)&&(it(e)||"string"==typeof e||"function"==typeof e.splice||Xi(e)||eo(e)||Wi(e)))return!e.length;var t=$a(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Ii(e))return!ao(e).length;for(var n in e)if(Xc.call(e,n))return!1;return!0}function Kc(e,t){return ml(e,t)}var Yc=He.isFinite;function $c(e){return"number"==typeof e&&Yc(e)}function Zc(e){return"number"==typeof e&&e==Nt(e)}var Jc="[object Number]";function Qc(e){return"number"==typeof e||Ze(e)&&$e(e)==Jc}var ed=Dt?kt:zi;function td(e){return null==e}var nd=Ji&&Ji.isRegExp,id=nd?Ki(nd):function(e){return Ze(e)&&"[object RegExp]"==$e(e)},od=9007199254740991;var rd=Array.prototype.join;var ad=ca((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),sd=zl((function(e,t,n){wi(e,n,t)}));var ld=Math.max,ud=Math.min;var cd=ca((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),dd=Ar("toLowerCase");function hd(e,t){return e<t}var fd=dc(hd),pd=dc((function(e,t){return e<=t}));function gd(e,t,n){for(var i=-1,o=e.length;++i<o;){var r=e[i],a=t(r);if(null!=a&&(void 0===s?a==a&&!Qe(a):n(a,s)))var s=a,l=r}return l}function vd(e,t){for(var n,i=-1,o=e.length;++i<o;){var r=t(e[i]);void 0!==r&&(n=void 0===n?r:n+r)}return n}var md=NaN;function yd(e,t){var n=null==e?0:e.length;return n?vd(e,t)/n:md}var bd=Oi((function(e,t,n){ru(e,t,n)})),xd=Ti((function(e,t){return function(n){return Fc(n,e,t)}})),wd=Ti((function(e,t){return function(n){return Fc(e,n,t)}}));function Ed(e,t,n){var i=so(t),o=sc(t,i),r=!(pt(n)&&"chain"in n&&!n.chain),a=kt(e);return Mn(o,(function(n){var i=t[n];e[n]=i,a&&(e.prototype[n]=function(){var t=this.__chain__;if(r||t){var n=e(this.__wrapped__);return(n.__actions__=hn(this.__actions__)).push({func:i,args:arguments,thisArg:e}),n.__chain__=t,n}return i.apply(e,zo([this.value()],arguments))})})),e}var Cd=lt((function(e,t){return e*t}),1),Nd="Expected a function";function _d(e){if("function"!=typeof e)throw new TypeError(Nd);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var Sd="[object Map]",Md="[object Set]",Td=We?We.iterator:void 0;function Ad(e){if(!e)return[];if(Ri(e))return xc(e)?Tr(e):hn(e);if(Td&&e[Td])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Td]());var t=$a(e);return(t==Sd?Xs:t==Md?Vs:Ec)(e)}function kd(e,t){var n=e.length;if(n)return Un(t+=t<0?n:0,n)?e[t]:void 0}function Rd(e,t){return null==(e=jc(e,t=Lo(t,e)))||delete e[jo(vu(t))]}function Dd(e){return nr(e)?void 0:e}var Od=Vo((function(e,t){var n={};if(null==e)return n;var i=!1;t=nt(t,(function(t){return t=Lo(t,e),i||(i=t.length>1),t})),_i(e,Ia(e),n),i&&(n=Bs(n,7,Dd));for(var o=t.length;o--;)Rd(n,t[o]);return n}));function Pd(e,t,n,i){if(!pt(e))return e;for(var o=-1,r=(t=Lo(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var l=jo(t[o]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=a){var c=s[l];void 0===(u=i?i(c,l,s):void 0)&&(u=pt(c)?c:Un(t[o+1])?[]:{})}Ni(s,l,u),s=s[l]}return e}function Id(e,t,n){for(var i=-1,o=t.length,r={};++i<o;){var a=t[i],s=Fo(e,a);n(s,a)&&Pd(r,Lo(a,e),s)}return r}function Ld(e,t){if(null==e)return{};var n=nt(Ia(e),(function(e){return[e]}));return t=Ol(t),Id(e,n,(function(e,n){return t(e,n[0])}))}function Bd(e,t){if(e!==t){var n=void 0!==e,i=null===e,o=e==e,r=Qe(e),a=void 0!==t,s=null===t,l=t==t,u=Qe(t);if(!s&&!u&&!r&&e>t||r&&a&&l&&!s&&!u||i&&a&&l||!n&&l||!o)return 1;if(!i&&!r&&!u&&e<t||u&&n&&o&&!i&&!r||s&&n&&o||!a&&o||!l)return-1}return 0}function jd(e,t,n){t=t.length?nt(t,(function(e){return it(e)?function(t){return Fo(t,1===e.length?e[0]:e)}:e})):[_t];var i=-1;t=nt(t,Ki(Ol));var o=Qu(e,(function(e,n,o){var r=nt(t,(function(t){return t(e)}));return{criteria:r,index:++i,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(o,(function(e,t){return function(e,t,n){for(var i=-1,o=e.criteria,r=t.criteria,a=o.length,s=n.length;++i<a;){var l=Bd(o[i],r[i]);if(l)return i>=s?l:l*("desc"==n[i]?-1:1)}return e.index-t.index}(e,t,n)}))}function Fd(e){return Vo((function(t){return t=nt(t,Ki(Ol)),Ti((function(n){var i=this;return e(t,(function(e){return Zt(e,i,n)}))}))}))}var Hd=Fd(nt),Wd=Ti,zd=Math.min,Gd=Wd((function(e,t){var n=(t=1==t.length&&it(t[0])?nt(t[0],Ki(Ol)):nt(qo(t,1),Ki(Ol))).length;return Ti((function(i){for(var o=-1,r=zd(i.length,n);++o<r;)i[o]=t[o].call(this,i[o]);return Zt(e,this,i)}))})),Ud=Fd(Bu),qd=Fd(Ws),Xd=9007199254740991,Vd=Math.floor;function Kd(e,t){var n="";if(!e||t<1||t>Xd)return n;do{t%2&&(n+=e),(t=Vd(t/2))&&(e+=e)}while(t);return n}var Yd=Rl("length"),$d="\\ud800-\\udfff",Zd="["+$d+"]",Jd="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Qd="\\ud83c[\\udffb-\\udfff]",eh="[^"+$d+"]",th="(?:\\ud83c[\\udde6-\\uddff]){2}",nh="[\\ud800-\\udbff][\\udc00-\\udfff]",ih="(?:"+Jd+"|"+Qd+")"+"?",oh="[\\ufe0e\\ufe0f]?",rh=oh+ih+("(?:\\u200d(?:"+[eh,th,nh].join("|")+")"+oh+ih+")*"),ah="(?:"+[eh+Jd+"?",Jd,th,nh,Zd].join("|")+")",sh=RegExp(Qd+"(?="+Qd+")|"+ah+rh,"g");function lh(e){return gr(e)?function(e){for(var t=sh.lastIndex=0;sh.test(e);)++t;return t}(e):Yd(e)}var uh=Math.ceil;function ch(e,t){var n=(t=void 0===t?" ":st(t)).length;if(n<2)return n?Kd(t,e):t;var i=Kd(t,uh(e/lh(t)));return gr(t)?fr(Tr(i),0,e).join(""):i.slice(0,e)}var dh=Math.ceil,hh=Math.floor;var fh=/^\s+/,ph=He.parseInt;var gh=Ti((function(e,t){return yi(e,32,void 0,t,Vn(t,Wn(gh)))}));gh.placeholder={};var vh=Ti((function(e,t){return yi(e,64,void 0,t,Vn(t,Wn(vh)))}));vh.placeholder={};var mh=zl((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var yh=Vo((function(e,t){return null==e?{}:function(e,t){return Id(e,t,(function(t,n){return Ml(e,n)}))}(e,t)}));function bh(e,t,n,i){for(var o=n-1,r=e.length;++o<r;)if(i(e[o],t))return o;return-1}var xh=Array.prototype.splice;function wh(e,t,n,i){var o=i?bh:kn,r=-1,a=t.length,s=e;for(e===t&&(t=hn(t)),n&&(s=nt(e,Ki(n)));++r<a;)for(var l=0,u=t[r],c=n?n(u):u;(l=o(s,c,l,i))>-1;)s!==e&&xh.call(s,l,1),xh.call(e,l,1);return e}function Eh(e,t){return e&&e.length&&t&&t.length?wh(e,t):e}var Ch=Ti(Eh);var Nh=Array.prototype.splice;function _h(e,t){for(var n=e?t.length:0,i=n-1;n--;){var o=t[n];if(n==i||o!==r){var r=o;Un(o)?Nh.call(e,o,1):Rd(e,o)}}return e}var Sh=Vo((function(e,t){var n=null==e?0:e.length,i=Wo(e,t);return _h(e,nt(t,(function(e){return Un(e,n)?+e:e})).sort(Bd)),i})),Mh=Math.floor,Th=Math.random;function Ah(e,t){return e+Mh(Th()*(t-e+1))}var kh=parseFloat,Rh=Math.min,Dh=Math.random;var Oh=Math.ceil,Ph=Math.max;function Ih(e){return function(t,n,i){return i&&"number"!=typeof i&&Di(t,n,i)&&(n=i=void 0),t=Ct(t),void 0===n?(n=t,t=0):n=Ct(n),function(e,t,n,i){for(var o=-1,r=Ph(Oh((t-e)/(n||1)),0),a=Array(r);r--;)a[i?r:++o]=e,e+=n;return a}(t,n,i=void 0===i?t<n?1:-1:Ct(i),e)}}var Lh=Ih(),Bh=Ih(!0),jh=Vo((function(e,t){return yi(e,256,void 0,void 0,void 0,t)}));function Fh(e,t,n,i,o){return o(e,(function(e,o,r){n=i?(i=!1,e):t(n,e,o,r)})),n}function Hh(e,t,n){var i=it(e)?Dr:Fh,o=arguments.length<3;return i(e,Ol(t),n,o,Hl)}function Wh(e,t,n,i){var o=null==e?0:e.length;for(i&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}var zh=Array.prototype.reverse;function Gh(e){return null==e?e:zh.call(e)}var Uh=pa("round");function qh(e){var t=e.length;return t?e[Ah(0,t-1)]:void 0}function Xh(e){return qh(Ec(e))}function Vh(e,t){var n=-1,i=e.length,o=i-1;for(t=void 0===t?i:t;++n<t;){var r=Ah(n,o),a=e[r];e[r]=e[n],e[n]=a}return e.length=t,e}function Kh(e,t){return Vh(hn(e),ba(t,0,e.length))}function Yh(e,t){var n=Ec(e);return Vh(n,ba(t,0,n.length))}function $h(e){return Vh(hn(e))}function Zh(e){return Vh(Ec(e))}var Jh=ca((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));function Qh(e,t){var n;return Hl(e,(function(e,i,o){return!(n=t(e,i,o))})),!!n}var ef=Ti((function(e,t){if(null==e)return[];var n=t.length;return n>1&&Di(e,t[0],t[1])?t=[]:n>2&&Di(t[0],t[1],t[2])&&(t=[t[0]]),jd(e,qo(t,1),[])})),tf=4294967294,nf=Math.floor,of=Math.min;function rf(e,t,n,i){var o=0,r=null==e?0:e.length;if(0===r)return 0;for(var a=(t=n(t))!=t,s=null===t,l=Qe(t),u=void 0===t;o<r;){var c=nf((o+r)/2),d=n(e[c]),h=void 0!==d,f=null===d,p=d==d,g=Qe(d);if(a)var v=i||p;else v=u?p&&(i||h):s?p&&h&&(i||!f):l?p&&h&&!f&&(i||!g):!f&&!g&&(i?d<=t:d<t);v?o=c+1:r=c}return of(r,tf)}var af=2147483647;function sf(e,t,n){var i=0,o=null==e?i:e.length;if("number"==typeof t&&t==t&&o<=af){for(;i<o;){var r=i+o>>>1,a=e[r];null!==a&&!Qe(a)&&(n?a<=t:a<t)?i=r+1:o=r}return o}return rf(e,t,_t,n)}function lf(e,t){for(var n=-1,i=e.length,o=0,r=[];++n<i;){var a=e[n],s=t?t(a):a;if(!n||!Ei(s,l)){var l=s;r[o++]=0===a?0:a}}return r}var uf=Math.max;var cf=ca((function(e,t,n){return e+(n?" ":"")+kr(t)}));var df=lt((function(e,t){return e-t}),0);var hf=Object.prototype,ff=hf.hasOwnProperty;function pf(e,t,n,i){return void 0===e||Ei(e,hf[n])&&!ff.call(i,n)?t:e}var gf={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function vf(e){return"\\"+gf[e]}var mf=/<%=([\s\S]+?)%>/g,yf={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:mf,variable:"",imports:{_:{escape:Pu}}},bf=/\b__p \+= '';/g,xf=/\b(__p \+=) '' \+/g,wf=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ef=/[()=,{}\[\]\/\s]/,Cf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nf=/($^)/,_f=/['\n\r\u2028\u2029\\]/g,Sf=Object.prototype.hasOwnProperty;function Mf(e,t){return t(e)}var Tf=4294967295,Af=Math.min;function kf(e,t){var n=e;return n instanceof rn&&(n=n.value()),Dr(t,(function(e,t){return t.func.apply(t.thisArg,zo([e],t.args))}),n)}function Rf(){return kf(this.__wrapped__,this.__actions__)}var Df=9007199254740991;function Of(e,t){for(var n=e.length;n--&&kn(t,e[n],0)>-1;);return n}function Pf(e,t){for(var n=-1,i=e.length;++n<i&&kn(t,e[n],0)>-1;);return n}var If=/^\s+/;var Lf=/\w*$/;var Bf=Or({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),jf=/&(?:amp|lt|gt|quot|#39);/g,Ff=RegExp(jf.source);var Hf=ja&&1/Vs(new ja([,-0]))[1]==1/0?function(e){return new ja(e)}:an,Wf=200;function zf(e,t,n){var i=-1,o=Rn,r=e.length,a=!0,s=[],l=s;if(n)a=!1,o=hu;else if(r>=Wf){var u=t?null:Hf(e);if(u)return Vs(u);a=!1,o=zs,l=new Hs}else l=t?[]:s;e:for(;++i<r;){var c=e[i],d=t?t(c):c;if(c=n||0!==c?c:0,a&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue e;t&&l.push(d),s.push(c)}else o(l,d,n)||(l!==s&&l.push(d),s.push(c))}return s}var Gf=Ti((function(e){return zf(qo(e,1,nu,!0))})),Uf=Ti((function(e){var t=vu(e);return nu(t)&&(t=void 0),zf(qo(e,1,nu,!0),Ol(t))})),qf=Ti((function(e){var t=vu(e);return t="function"==typeof t?t:void 0,zf(qo(e,1,nu,!0),void 0,t)}));function Xf(e,t){return e&&e.length?zf(e,Ol(t)):[]}var Vf=0;var Kf=Math.max;function Yf(e){if(!e||!e.length)return[];var t=0;return e=Ma(e,(function(e){if(nu(e))return t=Kf(e.length,t),!0})),Li(t,(function(t){return nt(e,Rl(t))}))}function $f(e,t){if(!e||!e.length)return[];var n=Yf(e);return null==t?n:nt(n,(function(e){return Zt(t,void 0,e)}))}function Zf(e,t,n,i){return Pd(e,t,n(Fo(e,t)),i)}var Jf=ca((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}));var Qf=Ti((function(e,t){return nu(e)?pu(e,t):[]}));var ep=Vo((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return Wo(t,e)};return!(t>1||this.__actions__.length)&&i instanceof rn&&Un(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Mf,args:[o],thisArg:void 0}),new dn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(o)}));function tp(e,t,n){var i=e.length;if(i<2)return i?zf(e[0]):[];for(var o=-1,r=Array(i);++o<i;)for(var a=e[o],s=-1;++s<i;)s!=o&&(r[o]=pu(r[o]||a,e[s],t,n));return zf(qo(r,1),t,n)}var np=Ti((function(e){return tp(Ma(e,nu))})),ip=Ti((function(e){var t=vu(e);return nu(t)&&(t=void 0),tp(Ma(e,nu),Ol(t))})),op=Ti((function(e){var t=vu(e);return t="function"==typeof t?t:void 0,tp(Ma(e,nu),void 0,t)})),rp=Ti(Yf);function ap(e,t,n){for(var i=-1,o=e.length,r=t.length,a={};++i<o;){var s=i<r?t[i]:void 0;n(a,e[i],s)}return a}var sp=Ti((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,$f(e,n)})),lp={chunk:function(e,t,n){t=(n?Di(e,t,n):void 0===t)?1:ya(Nt(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,r=0,a=Array(ma(i/t));o<i;)a[r++]=hr(e,o,o+=t);return a},compact:function(e){for(var t=-1,n=null==e?0:e.length,i=0,o=[];++t<n;){var r=e[t];r&&(o[i++]=r)}return o},concat:Fs,difference:gu,differenceBy:mu,differenceWith:yu,drop:function(e,t,n){var i=null==e?0:e.length;return i?hr(e,(t=n||void 0===t?1:Nt(t))<0?0:t,i):[]},dropRight:function(e,t,n){var i=null==e?0:e.length;return i?hr(e,0,(t=i-(t=n||void 0===t?1:Nt(t)))<0?0:t):[]},dropRightWhile:function(e,t){return e&&e.length?xu(e,Ol(t),!0,!0):[]},dropWhile:function(e,t){return e&&e.length?xu(e,Ol(t),!0):[]},fill:function(e,t,n,i){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&Di(e,t,n)&&(n=0,i=o),function(e,t,n,i){var o=e.length;for((n=Nt(n))<0&&(n=-n>o?0:o+n),(i=void 0===i||i>o?o:Nt(i))<0&&(i+=o),i=n>i?0:Hu(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},findIndex:qu,findLastIndex:$u,first:Ju,flatten:Xo,flattenDeep:function(e){return(null==e?0:e.length)?qo(e,nc):[]},flattenDepth:function(e,t){return(null==e?0:e.length)?qo(e,t=void 0===t?1:Nt(t)):[]},fromPairs:function(e){for(var t=-1,n=null==e?0:e.length,i={};++t<n;){var o=e[t];i[o[0]]=o[1]}return i},head:Ju,indexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=null==n?0:Nt(n);return o<0&&(o=Nc(i+o,0)),kn(e,t,o)},initial:function(e){return(null==e?0:e.length)?hr(e,0,-1):[]},intersection:Tc,intersectionBy:Ac,intersectionWith:kc,join:function(e,t){return null==e?"":rd.call(e,t)},last:vu,lastIndexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return void 0!==n&&(o=(o=Nt(n))<0?ld(i+o,0):ud(o,i-1)),t==t?function(e,t,n){for(var i=n+1;i--;)if(e[i]===t)return i;return i}(e,t,o):Tn(e,An,o,!0)},nth:function(e,t){return e&&e.length?kd(e,Nt(t)):void 0},pull:Ch,pullAll:Eh,pullAllBy:function(e,t,n){return e&&e.length&&t&&t.length?wh(e,t,Ol(n)):e},pullAllWith:function(e,t,n){return e&&e.length&&t&&t.length?wh(e,t,void 0,n):e},pullAt:Sh,remove:function(e,t){var n=[];if(!e||!e.length)return n;var i=-1,o=[],r=e.length;for(t=Ol(t);++i<r;){var a=e[i];t(a,i,e)&&(n.push(a),o.push(i))}return _h(e,o),n},reverse:Gh,slice:function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&Di(e,t,n)?(t=0,n=i):(t=null==t?0:Nt(t),n=void 0===n?i:Nt(n)),hr(e,t,n)):[]},sortedIndex:function(e,t){return sf(e,t)},sortedIndexBy:function(e,t,n){return rf(e,t,Ol(n))},sortedIndexOf:function(e,t){var n=null==e?0:e.length;if(n){var i=sf(e,t);if(i<n&&Ei(e[i],t))return i}return-1},sortedLastIndex:function(e,t){return sf(e,t,!0)},sortedLastIndexBy:function(e,t,n){return rf(e,t,Ol(n),!0)},sortedLastIndexOf:function(e,t){if(null==e?0:e.length){var n=sf(e,t,!0)-1;if(Ei(e[n],t))return n}return-1},sortedUniq:function(e){return e&&e.length?lf(e):[]},sortedUniqBy:function(e,t){return e&&e.length?lf(e,Ol(t)):[]},tail:function(e){var t=null==e?0:e.length;return t?hr(e,1,t):[]},take:function(e,t,n){return e&&e.length?hr(e,0,(t=n||void 0===t?1:Nt(t))<0?0:t):[]},takeRight:function(e,t,n){var i=null==e?0:e.length;return i?hr(e,(t=i-(t=n||void 0===t?1:Nt(t)))<0?0:t,i):[]},takeRightWhile:function(e,t){return e&&e.length?xu(e,Ol(t),!1,!0):[]},takeWhile:function(e,t){return e&&e.length?xu(e,Ol(t)):[]},union:Gf,unionBy:Uf,unionWith:qf,uniq:function(e){return e&&e.length?zf(e):[]},uniqBy:Xf,uniqWith:function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?zf(e,void 0,t):[]},unzip:Yf,unzipWith:$f,without:Qf,xor:np,xorBy:ip,xorWith:op,zip:rp,zipObject:function(e,t){return ap(e||[],t||[],Ni)},zipObjectDeep:function(e,t){return ap(e||[],t||[],Pd)},zipWith:sp},up={countBy:Ul,each:Eu,eachRight:Mu,every:function(e,t,n){var i=it(e)?Bu:ju;return n&&Di(e,t,n)&&(t=void 0),i(e,Ol(t))},filter:zu,find:Xu,findLast:Zu,flatMap:function(e,t){return qo(ec(e,t),1)},flatMapDeep:function(e,t){return qo(ec(e,t),tc)},flatMapDepth:function(e,t,n){return n=void 0===n?1:Nt(n),qo(ec(e,t),n)},forEach:Eu,forEachRight:Mu,groupBy:uc,includes:function(e,t,n,i){e=Ri(e)?e:Ec(e),n=n&&!i?Nt(n):0;var o=e.length;return n<0&&(n=Cc(o+n,0)),xc(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&kn(e,t,n)>-1},invokeMap:Wc,keyBy:sd,map:ec,orderBy:function(e,t,n,i){return null==e?[]:(it(t)||(t=null==t?[]:[t]),it(n=i?void 0:n)||(n=null==n?[]:[n]),jd(e,t,n))},partition:mh,reduce:Hh,reduceRight:function(e,t,n){var i=it(e)?Wh:Fh,o=arguments.length<3;return i(e,Ol(t),n,o,Su)},reject:function(e,t){return(it(e)?Ma:Wu)(e,_d(Ol(t)))},sample:function(e){return(it(e)?qh:Xh)(e)},sampleSize:function(e,t,n){return t=(n?Di(e,t,n):void 0===t)?1:Nt(t),(it(e)?Kh:Yh)(e,t)},shuffle:function(e){return(it(e)?$h:Zh)(e)},size:function(e){if(null==e)return 0;if(Ri(e))return xc(e)?lh(e):e.length;var t=$a(e);return"[object Map]"==t||"[object Set]"==t?e.size:ao(e).length},some:function(e,t,n){var i=it(e)?Ws:Qh;return n&&Di(e,t,n)&&(t=void 0),i(e,Ol(t))},sortBy:ef},cp=Vl,dp={after:function(e,t){if("function"!=typeof t)throw new TypeError("Expected a function");return e=Nt(e),function(){if(--e<1)return t.apply(this,arguments)}},ary:xi,before:lr,bind:ur,bindKey:dr,curry:ql,curryRight:Xl,debounce:Zl,defer:cu,delay:du,flip:function(e){return yi(e,512)},memoize:Ro,negate:_d,once:function(e){return lr(2,e)},overArgs:Gd,partial:gh,partialRight:vh,rearg:jh,rest:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return Ti(e,t=void 0===t?t:Nt(t))},spread:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=null==t?0:uf(Nt(t),0),Ti((function(n){var i=n[t],o=fr(n,0,t);return i&&zo(o,i),Zt(e,this,o)}))},throttle:function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return pt(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Zl(e,t,{leading:i,maxWait:t,trailing:o})},unary:function(e){return xi(e,1)},wrap:function(e,t){return gh(wu(t),e)}},hp={castArray:function(){if(!arguments.length)return[];var e=arguments[0];return it(e)?e:[e]},clone:function(e){return Bs(e,4)},cloneDeep:js,cloneDeepWith:function(e,t){return Bs(e,5,t="function"==typeof t?t:void 0)},cloneWith:function(e,t){return Bs(e,4,t="function"==typeof t?t:void 0)},conformsTo:function(e,t){return null==t||Pl(e,t,so(t))},eq:Ei,gt:hc,gte:fc,isArguments:Wi,isArray:it,isArrayBuffer:Gc,isArrayLike:Ri,isArrayLikeObject:nu,isBoolean:function(e){return!0===e||!1===e||Ze(e)&&"[object Boolean]"==$e(e)},isBuffer:Xi,isDate:qc,isElement:function(e){return Ze(e)&&1===e.nodeType&&!nr(e)},isEmpty:Vc,isEqual:Kc,isEqualWith:function(e,t,n){var i=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===i?ml(e,t,void 0,n):!!i},isError:rr,isFinite:$c,isFunction:kt,isInteger:Zc,isLength:ki,isMap:Ss,isMatch:function(e,t){return e===t||xl(e,t,El(t))},isMatchWith:function(e,t,n){return n="function"==typeof n?n:void 0,xl(e,t,El(t),n)},isNaN:function(e){return Qc(e)&&e!=+e},isNative:function(e){if(ed(e))throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return zt(e)},isNil:td,isNull:function(e){return null===e},isNumber:Qc,isObject:pt,isObjectLike:Ze,isPlainObject:nr,isRegExp:id,isSafeInteger:function(e){return Zc(e)&&e>=-9007199254740991&&e<=od},isSet:Ts,isString:xc,isSymbol:Qe,isTypedArray:eo,isUndefined:function(e){return void 0===e},isWeakMap:function(e){return Ze(e)&&"[object WeakMap]"==$a(e)},isWeakSet:function(e){return Ze(e)&&"[object WeakSet]"==$e(e)},lt:fd,lte:pd,toArray:Ad,toFinite:Ct,toInteger:Nt,toLength:Hu,toNumber:xt,toPlainObject:ou,toSafeInteger:function(e){return e?ba(Nt(e),-9007199254740991,Df):0===e?e:0},toString:Io},fp={add:ut,ceil:ga,divide:bu,floor:ic,max:function(e){return e&&e.length?gd(e,_t,cc):void 0},maxBy:function(e,t){return e&&e.length?gd(e,Ol(t),cc):void 0},mean:function(e){return yd(e,_t)},meanBy:function(e,t){return yd(e,Ol(t))},min:function(e){return e&&e.length?gd(e,_t,hd):void 0},minBy:function(e,t){return e&&e.length?gd(e,Ol(t),hd):void 0},multiply:Cd,round:Uh,subtract:df,sum:function(e){return e&&e.length?vd(e,_t):0},sumBy:function(e,t){return e&&e.length?vd(e,Ol(t)):0}},pp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=xt(n))==n?n:0),void 0!==t&&(t=(t=xt(t))==t?t:0),ba(xt(e),t,n)},gp=function(e,t,n){return t=Ct(t),void 0===n?(n=t,t=0):n=Ct(n),function(e,t,n){return e>=yc(t,n)&&e<mc(t,n)}(e=xt(e),t,n)},vp=function(e,t,n){if(n&&"boolean"!=typeof n&&Di(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=Ct(e),void 0===t?(t=e,e=0):t=Ct(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=Dh();return Rh(e+o*(t-e+kh("1e-"+((o+"").length-1))),t)}return Ah(e,t)},mp={assign:uo,assignIn:po,assignInWith:go,assignWith:vo,at:Ko,create:function(e,t){var n=Kt(e);return null==t?n:wa(n,t)},defaults:eu,defaultsDeep:lu,entries:Au,entriesIn:ku,extend:po,extendWith:go,findKey:function(e,t){return Vu(e,Ol(t),jl)},findLastKey:function(e,t){return Vu(e,Ol(t),_u)},forIn:function(e,t){return null==e?e:Bl(e,wu(t),fo)},forInRight:function(e,t){return null==e?e:Nu(e,wu(t),fo)},forOwn:function(e,t){return e&&jl(e,wu(t))},forOwnRight:function(e,t){return e&&_u(e,wu(t))},functions:function(e){return null==e?[]:sc(e,so(e))},functionsIn:function(e){return null==e?[]:sc(e,fo(e))},get:Ho,has:vc,hasIn:Ml,invert:Oc,invertBy:Bc,invoke:Hc,keys:so,keysIn:fo,mapKeys:function(e,t){var n={};return t=Ol(t),jl(e,(function(e,i,o){wi(n,t(e,i,o),e)})),n},mapValues:function(e,t){var n={};return t=Ol(t),jl(e,(function(e,i,o){wi(n,i,t(e,i,o))})),n},merge:bd,mergeWith:su,omit:Od,omitBy:function(e,t){return Ld(e,_d(Ol(t)))},pick:yh,pickBy:Ld,result:function(e,t,n){var i=-1,o=(t=Lo(t,e)).length;for(o||(o=1,e=void 0);++i<o;){var r=null==e?void 0:e[jo(t[i])];void 0===r&&(i=o,r=n),e=kt(r)?r.call(e):r}return e},set:function(e,t,n){return null==e?e:Pd(e,t,n)},setWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Pd(e,t,n,i)},toPairs:Au,toPairsIn:ku,transform:function(e,t,n){var i=it(e),o=i||Xi(e)||eo(e);if(t=Ol(t),null==n){var r=e&&e.constructor;n=o?i?new r:[]:pt(e)&&kt(r)?Kt(Yo(e)):{}}return(o?Mn:jl)(e,(function(e,i,o){return t(n,e,i,o)})),n},unset:function(e,t){return null==e||Rd(e,t)},update:function(e,t,n){return null==e?e:Zf(e,t,wu(n))},updateWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Zf(e,t,wu(n),i)},values:Ec,valuesIn:function(e){return null==e?[]:wc(e,fo(e))}},yp={at:ep,chain:va,commit:function(){return new dn(this.value(),this.__chain__)},lodash:gn,next:function(){void 0===this.__values__&&(this.__values__=Ad(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},plant:function(e){for(var t,n=this;n instanceof nn;){var i=fn(n);i.__index__=0,i.__values__=void 0,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},reverse:function(){var e=this.__wrapped__;if(e instanceof rn){var t=e;return this.__actions__.length&&(t=new rn(this)),(t=t.reverse()).__actions__.push({func:Mf,args:[Gh],thisArg:void 0}),new dn(t,this.__chain__)}return this.thru(Gh)},tap:function(e,t){return t(e),e},thru:Mf,toIterator:function(){return this},toJSON:Rf,value:Rf,valueOf:Rf,wrapperChain:function(){return va(this)}},bp={camelCase:da,capitalize:Rr,deburr:Br,endsWith:function(e,t,n){e=Io(e),t=st(t);var i=e.length,o=n=void 0===n?i:ba(Nt(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},escape:Pu,escapeRegExp:function(e){return(e=Io(e))&&Lu.test(e)?e.replace(Iu,"\\$&"):e},kebabCase:ad,lowerCase:cd,lowerFirst:dd,pad:function(e,t,n){e=Io(e);var i=(t=Nt(t))?lh(e):0;if(!t||i>=t)return e;var o=(t-i)/2;return ch(hh(o),n)+e+ch(dh(o),n)},padEnd:function(e,t,n){e=Io(e);var i=(t=Nt(t))?lh(e):0;return t&&i<t?e+ch(t-i,n):e},padStart:function(e,t,n){e=Io(e);var i=(t=Nt(t))?lh(e):0;return t&&i<t?ch(t-i,n)+e:e},parseInt:function(e,t,n){return n||null==t?t=0:t&&(t=+t),ph(Io(e).replace(fh,""),t||0)},repeat:function(e,t,n){return t=(n?Di(e,t,n):void 0===t)?1:Nt(t),Kd(Io(e),t)},replace:function(){var e=arguments,t=Io(e[0]);return e.length<3?t:t.replace(e[1],e[2])},snakeCase:Jh,split:function(e,t,n){return n&&"number"!=typeof n&&Di(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=Io(e))&&("string"==typeof t||null!=t&&!id(t))&&!(t=st(t))&&gr(e)?fr(Tr(e),0,n):e.split(t,n):[]},startCase:cf,startsWith:function(e,t,n){return e=Io(e),n=null==n?0:ba(Nt(n),0,e.length),t=st(t),e.slice(n,n+t.length)==t},template:function(e,t,n){var i=yf.imports._.templateSettings||yf;n&&Di(e,t,n)&&(t=void 0),e=Io(e),t=go({},t,i,pf);var o,r,a=go({},t.imports,i.imports,pf),s=so(a),l=wc(a,s),u=0,c=t.interpolate||Nf,d="__p += '",h=RegExp((t.escape||Nf).source+"|"+c.source+"|"+(c===mf?Cf:Nf).source+"|"+(t.evaluate||Nf).source+"|$","g"),f=Sf.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(h,(function(t,n,i,a,s,l){return i||(i=a),d+=e.slice(u,l).replace(_f,vf),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),s&&(r=!0,d+="';\n"+s+";\n__p += '"),i&&(d+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),u=l+t.length,t})),d+="';\n";var p=Sf.call(t,"variable")&&t.variable;if(p){if(Ef.test(p))throw new Error("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(r?d.replace(bf,""):d).replace(xf,"$1").replace(wf,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(r?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=ar((function(){return Function(s,f+"return "+d).apply(void 0,l)}));if(g.source=d,rr(g))throw g;return g},templateSettings:yf,toLower:function(e){return Io(e).toLowerCase()},toUpper:function(e){return Io(e).toUpperCase()},trim:function(e,t,n){if((e=Io(e))&&(n||void 0===t))return ft(e);if(!e||!(t=st(t)))return e;var i=Tr(e),o=Tr(t);return fr(i,Pf(i,o),Of(i,o)+1).join("")},trimEnd:function(e,t,n){if((e=Io(e))&&(n||void 0===t))return e.slice(0,dt(e)+1);if(!e||!(t=st(t)))return e;var i=Tr(e);return fr(i,0,Of(i,Tr(t))+1).join("")},trimStart:function(e,t,n){if((e=Io(e))&&(n||void 0===t))return e.replace(If,"");if(!e||!(t=st(t)))return e;var i=Tr(e);return fr(i,Pf(i,Tr(t))).join("")},truncate:function(e,t){var n=30,i="...";if(pt(t)){var o="separator"in t?t.separator:o;n="length"in t?Nt(t.length):n,i="omission"in t?st(t.omission):i}var r=(e=Io(e)).length;if(gr(e)){var a=Tr(e);r=a.length}if(n>=r)return e;var s=n-lh(i);if(s<1)return i;var l=a?fr(a,0,s).join(""):e.slice(0,s);if(void 0===o)return l+i;if(a&&(s+=l.length-s),id(o)){if(e.slice(s).search(o)){var u,c=l;for(o.global||(o=RegExp(o.source,Io(Lf.exec(o))+"g")),o.lastIndex=0;u=o.exec(c);)var d=u.index;l=l.slice(0,void 0===d?s:d)}}else if(e.indexOf(st(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+i},unescape:function(e){return(e=Io(e))&&Ff.test(e)?e.replace(jf,Bf):e},upperCase:Jf,upperFirst:kr,words:la},xp={attempt:ar,bindAll:cr,cond:function(e){var t=null==e?0:e.length,n=Ol;return e=t?nt(e,(function(e){if("function"!=typeof e[1])throw new TypeError("Expected a function");return[n(e[0]),e[1]]})):[],Ti((function(n){for(var i=-1;++i<t;){var o=e[i];if(Zt(o[0],this,n))return Zt(o[1],this,n)}}))},conforms:function(e){return function(e){var t=so(e);return function(n){return Pl(n,e,t)}}(Bs(e,1))},constant:Cn,defaultTo:function(e,t){return null==e||e!=e?t:e},flow:rc,flowRight:ac,identity:_t,iteratee:function(e){return Ol("function"==typeof e?e:Bs(e,1))},matches:function(e){return Nl(Bs(e,1))},matchesProperty:function(e,t){return kl(e,Bs(t,1))},method:xd,methodOf:wd,mixin:Ed,noop:an,nthArg:function(e){return e=Nt(e),Ti((function(t){return kd(t,e)}))},over:Hd,overEvery:Ud,overSome:qd,property:Dl,propertyOf:function(e){return function(t){return null==e?void 0:Fo(e,t)}},range:Lh,rangeRight:Bh,stubArray:Ta,stubFalse:zi,stubObject:function(){return{}},stubString:function(){return""},stubTrue:function(){return!0},times:function(e,t){if((e=Nt(e))<1||e>9007199254740991)return[];var n=Tf,i=Af(e,Tf);t=wu(t),e-=Tf;for(var o=Li(i,t);++n<e;)t(n);return o},toPath:function(e){return it(e)?nt(e,jo):Qe(e)?[e]:hn(Po(Io(e)))},uniqueId:function(e){var t=++Vf;return Io(e)+t}};var wp=Math.max,Ep=Math.min;var Cp=Math.min;var Np,_p,Sp=4294967295,Mp=Array.prototype,Tp=Object.prototype.hasOwnProperty,Ap=We?We.iterator:void 0,kp=Math.max,Rp=Math.min,Dp=function(e){return function(t,n,i){if(null==i){var o=pt(n),r=o&&so(n),a=r&&r.length&&sc(n,r);(a?a.length:o)||(i=n,n=t,t=this)}return e(t,n,i)}}(Ed);gn.after=dp.after,gn.ary=dp.ary,gn.assign=mp.assign,gn.assignIn=mp.assignIn,gn.assignInWith=mp.assignInWith,gn.assignWith=mp.assignWith,gn.at=mp.at,gn.before=dp.before,gn.bind=dp.bind,gn.bindAll=xp.bindAll,gn.bindKey=dp.bindKey,gn.castArray=hp.castArray,gn.chain=yp.chain,gn.chunk=lp.chunk,gn.compact=lp.compact,gn.concat=lp.concat,gn.cond=xp.cond,gn.conforms=xp.conforms,gn.constant=xp.constant,gn.countBy=up.countBy,gn.create=mp.create,gn.curry=dp.curry,gn.curryRight=dp.curryRight,gn.debounce=dp.debounce,gn.defaults=mp.defaults,gn.defaultsDeep=mp.defaultsDeep,gn.defer=dp.defer,gn.delay=dp.delay,gn.difference=lp.difference,gn.differenceBy=lp.differenceBy,gn.differenceWith=lp.differenceWith,gn.drop=lp.drop,gn.dropRight=lp.dropRight,gn.dropRightWhile=lp.dropRightWhile,gn.dropWhile=lp.dropWhile,gn.fill=lp.fill,gn.filter=up.filter,gn.flatMap=up.flatMap,gn.flatMapDeep=up.flatMapDeep,gn.flatMapDepth=up.flatMapDepth,gn.flatten=lp.flatten,gn.flattenDeep=lp.flattenDeep,gn.flattenDepth=lp.flattenDepth,gn.flip=dp.flip,gn.flow=xp.flow,gn.flowRight=xp.flowRight,gn.fromPairs=lp.fromPairs,gn.functions=mp.functions,gn.functionsIn=mp.functionsIn,gn.groupBy=up.groupBy,gn.initial=lp.initial,gn.intersection=lp.intersection,gn.intersectionBy=lp.intersectionBy,gn.intersectionWith=lp.intersectionWith,gn.invert=mp.invert,gn.invertBy=mp.invertBy,gn.invokeMap=up.invokeMap,gn.iteratee=xp.iteratee,gn.keyBy=up.keyBy,gn.keys=so,gn.keysIn=mp.keysIn,gn.map=up.map,gn.mapKeys=mp.mapKeys,gn.mapValues=mp.mapValues,gn.matches=xp.matches,gn.matchesProperty=xp.matchesProperty,gn.memoize=dp.memoize,gn.merge=mp.merge,gn.mergeWith=mp.mergeWith,gn.method=xp.method,gn.methodOf=xp.methodOf,gn.mixin=Dp,gn.negate=_d,gn.nthArg=xp.nthArg,gn.omit=mp.omit,gn.omitBy=mp.omitBy,gn.once=dp.once,gn.orderBy=up.orderBy,gn.over=xp.over,gn.overArgs=dp.overArgs,gn.overEvery=xp.overEvery,gn.overSome=xp.overSome,gn.partial=dp.partial,gn.partialRight=dp.partialRight,gn.partition=up.partition,gn.pick=mp.pick,gn.pickBy=mp.pickBy,gn.property=xp.property,gn.propertyOf=xp.propertyOf,gn.pull=lp.pull,gn.pullAll=lp.pullAll,gn.pullAllBy=lp.pullAllBy,gn.pullAllWith=lp.pullAllWith,gn.pullAt=lp.pullAt,gn.range=xp.range,gn.rangeRight=xp.rangeRight,gn.rearg=dp.rearg,gn.reject=up.reject,gn.remove=lp.remove,gn.rest=dp.rest,gn.reverse=lp.reverse,gn.sampleSize=up.sampleSize,gn.set=mp.set,gn.setWith=mp.setWith,gn.shuffle=up.shuffle,gn.slice=lp.slice,gn.sortBy=up.sortBy,gn.sortedUniq=lp.sortedUniq,gn.sortedUniqBy=lp.sortedUniqBy,gn.split=bp.split,gn.spread=dp.spread,gn.tail=lp.tail,gn.take=lp.take,gn.takeRight=lp.takeRight,gn.takeRightWhile=lp.takeRightWhile,gn.takeWhile=lp.takeWhile,gn.tap=yp.tap,gn.throttle=dp.throttle,gn.thru=Mf,gn.toArray=hp.toArray,gn.toPairs=mp.toPairs,gn.toPairsIn=mp.toPairsIn,gn.toPath=xp.toPath,gn.toPlainObject=hp.toPlainObject,gn.transform=mp.transform,gn.unary=dp.unary,gn.union=lp.union,gn.unionBy=lp.unionBy,gn.unionWith=lp.unionWith,gn.uniq=lp.uniq,gn.uniqBy=lp.uniqBy,gn.uniqWith=lp.uniqWith,gn.unset=mp.unset,gn.unzip=lp.unzip,gn.unzipWith=lp.unzipWith,gn.update=mp.update,gn.updateWith=mp.updateWith,gn.values=mp.values,gn.valuesIn=mp.valuesIn,gn.without=lp.without,gn.words=bp.words,gn.wrap=dp.wrap,gn.xor=lp.xor,gn.xorBy=lp.xorBy,gn.xorWith=lp.xorWith,gn.zip=lp.zip,gn.zipObject=lp.zipObject,gn.zipObjectDeep=lp.zipObjectDeep,gn.zipWith=lp.zipWith,gn.entries=mp.toPairs,gn.entriesIn=mp.toPairsIn,gn.extend=mp.assignIn,gn.extendWith=mp.assignInWith,Dp(gn,gn),gn.add=fp.add,gn.attempt=xp.attempt,gn.camelCase=bp.camelCase,gn.capitalize=bp.capitalize,gn.ceil=fp.ceil,gn.clamp=pp,gn.clone=hp.clone,gn.cloneDeep=hp.cloneDeep,gn.cloneDeepWith=hp.cloneDeepWith,gn.cloneWith=hp.cloneWith,gn.conformsTo=hp.conformsTo,gn.deburr=bp.deburr,gn.defaultTo=xp.defaultTo,gn.divide=fp.divide,gn.endsWith=bp.endsWith,gn.eq=hp.eq,gn.escape=bp.escape,gn.escapeRegExp=bp.escapeRegExp,gn.every=up.every,gn.find=up.find,gn.findIndex=lp.findIndex,gn.findKey=mp.findKey,gn.findLast=up.findLast,gn.findLastIndex=lp.findLastIndex,gn.findLastKey=mp.findLastKey,gn.floor=fp.floor,gn.forEach=up.forEach,gn.forEachRight=up.forEachRight,gn.forIn=mp.forIn,gn.forInRight=mp.forInRight,gn.forOwn=mp.forOwn,gn.forOwnRight=mp.forOwnRight,gn.get=mp.get,gn.gt=hp.gt,gn.gte=hp.gte,gn.has=mp.has,gn.hasIn=mp.hasIn,gn.head=lp.head,gn.identity=_t,gn.includes=up.includes,gn.indexOf=lp.indexOf,gn.inRange=gp,gn.invoke=mp.invoke,gn.isArguments=hp.isArguments,gn.isArray=it,gn.isArrayBuffer=hp.isArrayBuffer,gn.isArrayLike=hp.isArrayLike,gn.isArrayLikeObject=hp.isArrayLikeObject,gn.isBoolean=hp.isBoolean,gn.isBuffer=hp.isBuffer,gn.isDate=hp.isDate,gn.isElement=hp.isElement,gn.isEmpty=hp.isEmpty,gn.isEqual=hp.isEqual,gn.isEqualWith=hp.isEqualWith,gn.isError=hp.isError,gn.isFinite=hp.isFinite,gn.isFunction=hp.isFunction,gn.isInteger=hp.isInteger,gn.isLength=hp.isLength,gn.isMap=hp.isMap,gn.isMatch=hp.isMatch,gn.isMatchWith=hp.isMatchWith,gn.isNaN=hp.isNaN,gn.isNative=hp.isNative,gn.isNil=hp.isNil,gn.isNull=hp.isNull,gn.isNumber=hp.isNumber,gn.isObject=pt,gn.isObjectLike=hp.isObjectLike,gn.isPlainObject=hp.isPlainObject,gn.isRegExp=hp.isRegExp,gn.isSafeInteger=hp.isSafeInteger,gn.isSet=hp.isSet,gn.isString=hp.isString,gn.isSymbol=hp.isSymbol,gn.isTypedArray=hp.isTypedArray,gn.isUndefined=hp.isUndefined,gn.isWeakMap=hp.isWeakMap,gn.isWeakSet=hp.isWeakSet,gn.join=lp.join,gn.kebabCase=bp.kebabCase,gn.last=vu,gn.lastIndexOf=lp.lastIndexOf,gn.lowerCase=bp.lowerCase,gn.lowerFirst=bp.lowerFirst,gn.lt=hp.lt,gn.lte=hp.lte,gn.max=fp.max,gn.maxBy=fp.maxBy,gn.mean=fp.mean,gn.meanBy=fp.meanBy,gn.min=fp.min,gn.minBy=fp.minBy,gn.stubArray=xp.stubArray,gn.stubFalse=xp.stubFalse,gn.stubObject=xp.stubObject,gn.stubString=xp.stubString,gn.stubTrue=xp.stubTrue,gn.multiply=fp.multiply,gn.nth=lp.nth,gn.noop=xp.noop,gn.now=cp,gn.pad=bp.pad,gn.padEnd=bp.padEnd,gn.padStart=bp.padStart,gn.parseInt=bp.parseInt,gn.random=vp,gn.reduce=up.reduce,gn.reduceRight=up.reduceRight,gn.repeat=bp.repeat,gn.replace=bp.replace,gn.result=mp.result,gn.round=fp.round,gn.sample=up.sample,gn.size=up.size,gn.snakeCase=bp.snakeCase,gn.some=up.some,gn.sortedIndex=lp.sortedIndex,gn.sortedIndexBy=lp.sortedIndexBy,gn.sortedIndexOf=lp.sortedIndexOf,gn.sortedLastIndex=lp.sortedLastIndex,gn.sortedLastIndexBy=lp.sortedLastIndexBy,gn.sortedLastIndexOf=lp.sortedLastIndexOf,gn.startCase=bp.startCase,gn.startsWith=bp.startsWith,gn.subtract=fp.subtract,gn.sum=fp.sum,gn.sumBy=fp.sumBy,gn.template=bp.template,gn.times=xp.times,gn.toFinite=hp.toFinite,gn.toInteger=Nt,gn.toLength=hp.toLength,gn.toLower=bp.toLower,gn.toNumber=hp.toNumber,gn.toSafeInteger=hp.toSafeInteger,gn.toString=hp.toString,gn.toUpper=bp.toUpper,gn.trim=bp.trim,gn.trimEnd=bp.trimEnd,gn.trimStart=bp.trimStart,gn.truncate=bp.truncate,gn.unescape=bp.unescape,gn.uniqueId=xp.uniqueId,gn.upperCase=bp.upperCase,gn.upperFirst=bp.upperFirst,gn.each=up.forEach,gn.eachRight=up.forEachRight,gn.first=lp.head,Dp(gn,(Np={},jl(gn,(function(e,t){Tp.call(gn.prototype,t)||(Np[t]=e)})),Np),{chain:!1}),gn.VERSION="4.17.21",(gn.templateSettings=bp.templateSettings).imports._=gn,Mn(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){gn[e].placeholder=gn})),Mn(["drop","take"],(function(e,t){rn.prototype[e]=function(n){n=void 0===n?1:kp(Nt(n),0);var i=this.__filtered__&&!t?new rn(this):this.clone();return i.__filtered__?i.__takeCount__=Rp(n,i.__takeCount__):i.__views__.push({size:Rp(n,Sp),type:e+(i.__dir__<0?"Right":"")}),i},rn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Mn(["filter","map","takeWhile"],(function(e,t){var n=t+1,i=1==n||3==n;rn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ol(e),type:n}),t.__filtered__=t.__filtered__||i,t}})),Mn(["head","last"],(function(e,t){var n="take"+(t?"Right":"");rn.prototype[e]=function(){return this[n](1).value()[0]}})),Mn(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");rn.prototype[e]=function(){return this.__filtered__?new rn(this):this[n](1)}})),rn.prototype.compact=function(){return this.filter(_t)},rn.prototype.find=function(e){return this.filter(e).head()},rn.prototype.findLast=function(e){return this.reverse().find(e)},rn.prototype.invokeMap=Ti((function(e,t){return"function"==typeof e?new rn(this):this.map((function(n){return Fc(n,e,t)}))})),rn.prototype.reject=function(e){return this.filter(_d(Ol(e)))},rn.prototype.slice=function(e,t){e=Nt(e);var n=this;return n.__filtered__&&(e>0||t<0)?new rn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=Nt(t))<0?n.dropRight(-t):n.take(t-e)),n)},rn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},rn.prototype.toArray=function(){return this.take(Sp)},jl(rn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=gn[i?"take"+("last"==t?"Right":""):t],r=i||/^find/.test(t);o&&(gn.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,s=t instanceof rn,l=a[0],u=s||it(t),c=function(e){var t=o.apply(gn,zo([e],a));return i&&d?t[0]:t};u&&n&&"function"==typeof l&&1!=l.length&&(s=u=!1);var d=this.__chain__,h=!!this.__actions__.length,f=r&&!d,p=s&&!h;if(!r&&u){t=p?t:new rn(this);var g=e.apply(t,a);return g.__actions__.push({func:Mf,args:[c],thisArg:void 0}),new dn(g,d)}return f&&p?e.apply(this,a):(g=this.thru(c),f?i?g.value()[0]:g.value():g)})})),Mn(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Mp[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);gn.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var o=this.value();return t.apply(it(o)?o:[],e)}return this[n]((function(n){return t.apply(it(n)?n:[],e)}))}})),jl(rn.prototype,(function(e,t){var n=gn[t];if(n){var i=n.name+"";Tp.call(ln,i)||(ln[i]=[]),ln[i].push({name:t,func:n})}})),ln[ei(void 0,2).name]=[{name:"wrapper",func:void 0}],rn.prototype.clone=function(){var e=new rn(this.__wrapped__);return e.__actions__=hn(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=hn(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=hn(this.__views__),e},rn.prototype.reverse=function(){if(this.__filtered__){var e=new rn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},rn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=it(e),i=t<0,o=n?e.length:0,r=function(e,t,n){for(var i=-1,o=n.length;++i<o;){var r=n[i],a=r.size;switch(r.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=Ep(t,e+a);break;case"takeRight":e=wp(e,t-a)}}return{start:e,end:t}}(0,o,this.__views__),a=r.start,s=r.end,l=s-a,u=i?s:a-1,c=this.__iteratees__,d=c.length,h=0,f=Cp(l,this.__takeCount__);if(!n||!i&&o==l&&f==l)return kf(e,this.__actions__);var p=[];e:for(;l--&&h<f;){for(var g=-1,v=e[u+=t];++g<d;){var m=c[g],y=m.iteratee,b=m.type,x=y(v);if(2==b)v=x;else if(!x){if(1==b)continue e;break e}}p[h++]=v}return p},gn.prototype.at=yp.at,gn.prototype.chain=yp.wrapperChain,gn.prototype.commit=yp.commit,gn.prototype.next=yp.next,gn.prototype.plant=yp.plant,gn.prototype.reverse=yp.reverse,gn.prototype.toJSON=gn.prototype.valueOf=gn.prototype.value=yp.value,gn.prototype.first=gn.prototype.head,Ap&&(gn.prototype[Ap]=yp.toIterator),_p={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(t){e=t}throw e}},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;var Op=0;function Pp(e,t,n,i,o,r){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)"ref"==s?a=t[s]:l[s]=t[s];var u={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Op,__i:-1,__u:0,__source:o,__self:r};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return _p.vnode&&_p.vnode(u),u}var Ip=t.LogicFlowUtil.StepDrag,Lp=function(e){function n(n){var i=e.call(this)||this;return i.updatePosition=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.x,a=o.y;i.nodeModel.x=r+t/2,i.nodeModel.y=a+n/2,i.nodeModel.moveText(t/2,n/2)},i.getResize=function(e){var t=e.index,n=e.deltaX,i=e.deltaY,o=e.width,r=e.height,a=e.PCTResizeInfo,s=e.pct,l=void 0===s?1:s,u=e.freezeWidth,c=void 0!==u&&u,d=e.freezeHeight,h=void 0!==d&&d,f={width:o,height:r,deltaX:n,deltaY:i};if(a){var p=0,g=0;switch(t){case 0:g=(-1*n-i)/4;break;case 1:g=(n-i)/4;break;case 2:g=(n+i)/4;break;case 3:g=(-1*n+i)/4}0!==g&&(p=Math.round(g/a.ResizeBasis.basisHeight*1e5)/1e3),a.ResizePCT.widthPCT=Math.max(Math.min(a.ResizePCT.widthPCT+p,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit),a.ResizePCT.heightPCT=Math.max(Math.min(a.ResizePCT.heightPCT+p,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit);var v=Math.round(a.ResizePCT.widthPCT*a.ResizeBasis.basisWidth/100),m=Math.round(a.ResizePCT.heightPCT*a.ResizeBasis.basisHeight/100);switch(t){case 0:n=o-v,i=r-m;break;case 1:n=v-o,i=r-m;break;case 2:n=v-o,i=m-r;break;case 3:n=o-v,i=m-r}return f.width=v,f.height=m,f.deltaX=n/l,f.deltaY=i/l,f}switch(t){case 0:f.width=c?o:o-n*l,f.height=h?r:r-i*l;break;case 1:f.width=c?o:o+n*l,f.height=h?r:r-i*l;break;case 2:f.width=c?o:o+n*l,f.height=h?r:r+i*l;break;case 3:f.width=c?o:o-n*l,f.height=h?r:r+i*l}return f},i.updateEdgePointByAnchors=function(){var e=i.nodeModel,t=e.id,n=e.anchors,o=i.getNodeEdges(t);o.sourceEdges.forEach((function(e){var t=n.find((function(t){return t.id===e.sourceAnchorId}));t&&e.updateStartPoint({x:t.x,y:t.y})})),o.targetEdges.forEach((function(e){var t=n.find((function(t){return t.id===e.targetAnchorId}));t&&e.updateEndPoint({x:t.x,y:t.y})}))},i.updateRect=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.x,a=o.y,s=o.width,l=o.height,u=o.radius,c=o.PCTResizeInfo,d=i.nodeModel,h=d.minWidth,f=d.minHeight,p=d.maxWidth,g=d.maxHeight,v=i.index,m=h===p,y=f===g,b=i.getResize({index:v,deltaX:t,deltaY:n,width:s,height:l,PCTResizeInfo:c,pct:1,freezeWidth:m,freezeHeight:y});if(b.width<h||b.width>p||b.height<f||b.height>g)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:m?0:b.deltaX,deltaY:y?0:b.deltaY}),i.nodeModel.width=b.width,i.nodeModel.height=b.height,i.nodeModel.setProperties({nodeSize:{width:b.width,height:b.height}});var x={x:r,y:a,width:s,height:l,radius:u},w={x:i.nodeModel.x,y:i.nodeModel.y,width:i.nodeModel.width,height:i.nodeModel.height,radius:u};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:x,afterNode:w})}},i.updateEllipse=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.rx,a=o.ry,s=o.x,l=o.y,u=o.PCTResizeInfo,c=i.index,d=i.nodeModel,h=d.minWidth,f=d.minHeight,p=d.maxWidth,v=d.maxHeight,m=h===p,y=f===v,b=r,x=a,w=i.getResize({index:c,deltaX:t,deltaY:n,width:b,height:x,PCTResizeInfo:u,pct:.5,freezeWidth:m,freezeHeight:y});if(w.width<h/2||w.width>p/2||w.height<f/2||w.height>v/2)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:m?0:w.deltaX,deltaY:y?0:w.deltaY}),i.nodeModel.rx=w.width,i.nodeModel.ry=w.height,i.nodeModel.setProperties({nodeSize:{rx:w.width,ry:w.height}});var E={x:s,y:l},C={rx:w.width,ry:w.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:g(g({},E),{rx:r,ry:a}),afterNode:C})}},i.updateDiamond=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.rx,a=o.ry,s=o.x,l=o.y,u=o.PCTResizeInfo,c=i.index,d=i.nodeModel,h=d.minWidth,f=d.minHeight,p=d.maxWidth,g=d.maxHeight,v=h===p,m=f===g,y=r,b=a,x=i.getResize({index:c,deltaX:t,deltaY:n,width:y,height:b,PCTResizeInfo:u,pct:.5,freezeWidth:v,freezeHeight:m});if(x.width<h/2||x.width>p/2||x.height<f/2||x.height>g/2)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:v?0:x.deltaX,deltaY:m?0:x.deltaY}),i.nodeModel.rx=x.width,i.nodeModel.ry=x.height,i.nodeModel.setProperties({nodeSize:{rx:x.width,ry:x.height}});var w={x:s,y:l,rx:r,ry:a},E={rx:x.width,ry:x.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:w,afterNode:E})}},i.eventEmit=function(e){var t=e.deltaX,n=e.deltaY,o=e.beforeNode,r=e.afterNode,a=i.nodeModel,s=a.id,l=a.modelType,u=a.type,c=g({id:s,modelType:l,type:u},o),d=g({id:s,modelType:l,type:u},r);i.graphModel.eventCenter.emit("node:resize",{preData:c,data:d,deltaX:t,deltaY:n,index:i.index,model:i.nodeModel})},i.onDragging=function(e){var n,o=e.deltaX,r=e.deltaY,a=i.graphModel.transformModel,s=i.nodeModel.modelType;o=(n=w(a.fixDeltaXY(o,r),2))[0],r=n[1],s===t.ModelType.RECT_NODE||s===t.ModelType.HTML_NODE?i.updateRect({deltaX:o,deltaY:r}):s===t.ModelType.ELLIPSE_NODE?i.updateEllipse({deltaX:o,deltaY:r}):s===t.ModelType.DIAMOND_NODE&&i.updateDiamond({deltaX:o,deltaY:r})},i.onDragEnd=function(){var e=i.graphModel.gridSize,t=void 0===e?1:e,n=t*Math.round(i.nodeModel.x/t),o=t*Math.round(i.nodeModel.y/t);i.nodeModel.moveTo(n,o),i.updateEdgePointByAnchors()},i.index=n.index,i.nodeModel=n.model,i.graphModel=n.graphModel,i.dragHandler=new Ip({onDragging:i.onDragging,onDragEnd:i.onDragEnd,step:1}),i}return p(n,e),n.prototype.getNodeEdges=function(e){for(var t=this.graphModel.edges,n=[],i=[],o=0;o<t.length;o++){var r=t[o];r.sourceNodeId===e?n.push(r):t[o].targetNodeId===e&&i.push(r)}return{sourceEdges:n,targetEdges:i}},n.prototype.render=function(){var e=this.props,n=e.x,i=e.y,o=e.index,r=e.model.getControlPointStyle();return Pp("g",{className:"lf-resize-control-".concat(o),children:Pp(t.Rect,g({className:"lf-node-control",x:n,y:i},r,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(t.Component),Bp=function(e){function n(){var t=e.call(this)||this;return t.state={},t}return p(n,e),n.prototype.getResizeControl=function(){var e=this.props,t=e.model,n=e.graphModel,i=t.x,o=t.y,r=t.width,a=t.height,s={minX:i-r/2,minY:o-a/2,maxX:i+r/2,maxY:o+a/2},l=s.minX,u=s.minY,c=s.maxX,d=s.maxY;return[{x:l,y:u},{x:c,y:u},{x:c,y:d},{x:l,y:d}].map((function(e,i){return Pp(Lp,g({index:i},e,{model:t,graphModel:n}))}))},n.prototype.getGroupSolid=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getResizeOutlineStyle();return Pp(t.Rect,g({},a,{x:n,y:i,width:o,height:r}))},n.prototype.render=function(){return Pp("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(t.Component),jp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.EllipseNodeModel),Fp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pp(Bp,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){var e=this.props,t=e.model,n=e.graphModel.editConfigModel.isSilentMode;return Pp("g",{children:[this.getResizeShape(),t.isSelected&&!n?this.getControlGroup():""]})},t}(t.EllipseNode),Hp={type:"ellipse",view:Fp,model:jp},Wp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.gridSize=1},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.DiamondNodeModel),zp=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pp(Bp,{model:t,graphModel:n})},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.points,i=e.getNodeStyle();return Pp("g",{children:Pp(t.Polygon,g({},i,{points:n}))})},n.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Pp("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},n}(t.DiamondNode),Gp={type:"diamond",view:zp,model:Wp},Up=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.HtmlNodeModel),qp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pp(Bp,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Pp("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},t}(t.HtmlNode),Xp={type:"html",view:qp,model:Up},Vp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.RectNodeModel),Kp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pp(Bp,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Pp("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},t}(t.RectNode),Yp={type:"rect",view:Kp,model:Vp},$p={pluginName:"nodeResize",step:0,install:function(e){e.register(Hp),e.register(Gp),e.register(Xp),e.register(Yp)}},Zp=function(e){function t(){var t=e.apply(this,E([],w(arguments),!1))||this;return t.isGroup=!0,t.isFolded=!1,t.unfoldedWidth=500,t.unfoldedHeight=300,t.childrenLastFoldStatus={},t}return p(t,e),t.prototype.initNodeData=function(t){var n=this;e.prototype.initNodeData.call(this,t);var i=[];it(t.children)&&(i=t.children),this.children=new Set(i),this.width=500,this.height=300,this.foldedWidth=80,this.foldedHeight=60,this.zIndex=-1e4,this.radius=0,this.text.editable=!1,this.text.draggable=!1,this.isRestrict=!1,this.resizable=!1,this.autoToFront=!1,this.foldable=!1,void 0===this.properties.isFolded&&(this.properties.isFolded=!1),this.isFolded=!!this.properties.isFolded,setTimeout((function(){n.isFolded&&n.foldGroup(n.isFolded)}))},t.prototype.getResizeOutlineStyle=function(){var t=e.prototype.getResizeOutlineStyle.call(this);return t.stroke="none",t},t.prototype.foldGroup=function(e){var t=this;if(e!==this.isFolded){this.setProperty("isFolded",e),this.isFolded=e,e?(this.x=this.x-this.width/2+this.foldedWidth/2,this.y=this.y-this.height/2+this.foldedHeight/2,this.unfoldedWidth=this.width,this.unfoldedHeight=this.height,this.width=this.foldedWidth,this.height=this.foldedHeight):(this.width=this.unfoldedWidth,this.height=this.unfoldedHeight,this.x=this.x+this.width/2-this.foldedWidth/2,this.y=this.y+this.height/2-this.foldedHeight/2);var n=E(E([],w(this.incoming.edges),!1),w(this.outgoing.edges),!1);this.children.forEach((function(i){var o=t.graphModel.getElement(i);if(o){var r=o.isFolded;if(o.isGroup&&!o.isFolded&&o.foldGroup(e),o.isGroup&&!e){var a=t.childrenLastFoldStatus[i];void 0!==a&&a!==o.isFolded&&o.foldGroup(a)}t.childrenLastFoldStatus[i]=!!r,o.visible=!e;var s=o.incoming.edges,l=o.outgoing.edges;n=E(E(E([],w(n),!1),w(s),!1),w(l),!1)}})),this.foldEdge(e,n)}},t.prototype.getAnchorStyle=function(t){var n=e.prototype.getAnchorStyle.call(this,t);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},t.prototype.foldEdge=function(e,t){var n=this;t.forEach((function(t,i){var o=t.id,r=t.sourceNodeId,a=t.targetNodeId,s=t.startPoint,l=t.endPoint,u=t.type,c=t.text,d=t.getProperties(),h={id:"".concat(o,"__").concat(i),sourceNodeId:r,targetNodeId:a,startPoint:s,endPoint:l,type:u,properties:d,text:null==c?void 0:c.value};t.virtual&&n.graphModel.deleteEdgeById(t.id);var f=n.graphModel.group.getNodeGroup(a);f||(f=n.graphModel.getNodeModelById(a));var p=n.graphModel.group.getNodeGroup(r);p||(p=n.graphModel.getNodeModelById(r)),e&&!1!==t.visible&&(n.children.has(r)||n.id===r?(h.startPoint=void 0,h.sourceNodeId=n.id):(h.endPoint=void 0,h.targetNodeId=n.id),f.id===n.id&&p.id===n.id||n.createVirtualEdge(h),t.visible=!1),e||!1!==t.visible||(f&&f.isGroup&&f.isFolded?(h.targetNodeId=f.id,h.endPoint=void 0,n.createVirtualEdge(h)):p&&p.isGroup&&p.isFolded?(h.sourceNodeId=p.id,h.startPoint=void 0,n.createVirtualEdge(h)):t.visible=!0)}))},t.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isFoldedEdge=!0},t.prototype.isInRange=function(e){var t=e.minX,n=e.minY,i=e.maxX,o=e.maxY;return t>=this.x-this.width/2&&i<=this.x+this.width/2&&n>=this.y-this.height/2&&o<=this.y+this.height/2},t.prototype.isAllowMoveTo=function(e){var t=e.minX,n=e.minY,i=e.maxX,o=e.maxY;return{x:t>=this.x-this.width/2&&i<=this.x+this.width/2,y:n>=this.y-this.height/2&&o<=this.y+this.height/2}},t.prototype.setAllowAppendChild=function(e){this.setProperty("groupAddable",e)},t.prototype.addChild=function(e){this.children.add(e),this.graphModel.eventCenter.emit("group:add-node",{data:this.getData()})},t.prototype.removeChild=function(e){this.children.delete(e),this.graphModel.eventCenter.emit("group:remove-node",{data:this.getData()})},t.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},t.prototype.getData=function(){var t=this,n=e.prototype.getData.call(this);n.children=[],this.children.forEach((function(e){var i=t.graphModel.getNodeModelById(e);i&&!i.virtual&&n.children.push(e)}));var i=n.properties;return null==i||delete i.groupAddable,null==i||delete i.isFolded,n},t.prototype.getHistoryData=function(){var t=e.prototype.getData.call(this);t.children=E([],w(this.children),!1),t.isGroup=!0;var n=t.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(t.x=t.x+this.unfoldedWidth/2-this.foldedWidth/2,t.y=t.y+this.unfoldedHeight/2-this.foldedHeight/2),t},t.prototype.isAllowAppendIn=function(e){return!0},t.prototype.toBack=function(){this.zIndex--},t}(Vp),Jp=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getControlGroup=function(){var t=this.props.model,n=t.resizable,i=t.properties;return n&&!i.isFolded?e.prototype.getControlGroup.call(this):null},n.prototype.getAddableShape=function(){var e=this.props.model,n=e.width,i=e.height,o=e.x,r=e.y,a=e.radius,s=e.properties,l=e.getAddableOutlineStyle;if(!s.groupAddable)return null;var u=this.props.model.getNodeStyle().strokeWidth,c=void 0===u?0:u,d=l(),h=n+c+8,f=i+c+8;return t.h("rect",g(g({},d),{width:h,height:f,x:o-h/2,y:r-f/2,rx:a,ry:a}))},n.prototype.getFoldIcon=function(){var e=this.props.model,n=e.x-e.width/2+5,i=e.y-e.height/2+5;if(!e.foldable)return null;var o=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:e.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 t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:e.x-e.width/2+5,y:e.y-e.height/2+5,onClick:function(){e.foldGroup(!e.properties.isFolded)}}),o])},n.prototype.getResizeShape=function(){return t.h("g",{},[this.getAddableShape(),e.prototype.getResizeShape.call(this),this.getFoldIcon()])},n}(Kp),Qp={type:"group",view:Jp,model:Zp},eg=-1e4,tg=function(){function e(e){var t=e.lf,n=this;this.topGroupZIndex=eg,this.nodeGroupMap=new Map,this.graphRendered=function(e){var t=e.data;t&&t.nodes&&(t.nodes.forEach((function(e){e.children&&e.children.forEach((function(t){n.nodeGroupMap.set(t,e.id)}))})),n.checkAndCorrectTopGroupZIndex(t.nodes))},this.appendNodeToGroup=function(e){var t=e.data,i=n.nodeGroupMap.get(t.id);if(i){var o=n.lf.getNodeModelById(i);o.removeChild(t.id),n.nodeGroupMap.delete(t.id),o.setAllowAppendChild(!1)}var r=n.lf.getNodeModelById(t.id),a=null==r?void 0:r.getBounds();if(a&&r){var s=n.getGroup(a,t);if(r.isGroup&&(t.children.forEach((function(e){n.nodeGroupMap.set(e,t.id)})),n.checkAndCorrectTopGroupZIndex([t]),n.nodeSelected({data:t,isSelected:!1,isMultiple:!1})),!s)return;if(!s.isAllowAppendIn(t))return void n.lf.emit("group:not-allowed",{group:s.getData(),node:t});s.addChild(t.id),n.nodeGroupMap.set(t.id,s.id),s.setAllowAppendChild(!1)}},this.deleteGroupChild=function(e){var t=e.data;t.children&&t.children.forEach((function(e){n.nodeGroupMap.delete(e),n.lf.deleteNode(e)}));var i=n.nodeGroupMap.get(t.id);i&&(n.lf.getNodeModelById(i).removeChild(t.id),n.nodeGroupMap.delete(t.id))},this.setActiveGroup=function(e){var t=e.data,i=n.lf.getNodeModelById(t.id),o=null==i?void 0:i.getBounds();if(i&&o){var r=n.getGroup(o,t);if(n.activeGroup&&n.activeGroup.setAllowAppendChild(!1),!r||i.isGroup&&r.id===t.id)return;if(!r.isAllowAppendIn(t))return;n.activeGroup=r,n.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(e){var t=eg;return e.isGroup&&(t=Math.max(t,e.zIndex)),e.children&&e.children.forEach((function(e){"object"==typeof e&&(e=e.id);var i=n.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var o=n.findNodeAndChildMaxZIndex(i);t=Math.max(o,t)}})),t},this.checkAndCorrectTopGroupZIndex=function(e){var t=eg;if(e.forEach((function(e){var i=n.lf.getNodeModelById(e.id);if(i){var o=n.findNodeAndChildMaxZIndex(i);o>t&&(t=o)}})),!(n.topGroupZIndex>=t)){for(var i=n.lf.graphModel.nodes.filter((function(e){return e.isGroup})),o=n.topGroupZIndex,r=0;r<i.length;r++){var a=i[r];a.zIndex>o&&(o=a.zIndex)}n.topGroupZIndex=o}},this.nodeSelected=function(e){var t=e.data,i=e.isMultiple,o=e.isSelected,r=n.lf.getNodeModelById(t.id);if(n.toFrontGroup(r),n.topGroupZIndex>-1e3){n.topGroupZIndex=eg;for(var a=n.lf.graphModel.nodes.filter((function(e){return e.isGroup})).sort((function(e,t){return e.zIndex-t.zIndex})),s=0,l=0;l<a.length;l++){var u=a[l];u.zIndex!==s&&(n.topGroupZIndex++,s=u.zIndex),u.setZIndex(n.topGroupZIndex)}}if(i&&o)if(null==r?void 0:r.isGroup)r.children.forEach((function(e){var t=n.lf.graphModel.getElement(e);null==t||t.setSelected(!1)}));else{var c=n.nodeGroupMap.get(t.id);if(c){var d=n.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==r||r.setSelected(!1))}}},this.toFrontGroup=function(e){e&&e.isGroup&&(n.topGroupZIndex++,e.setZIndex(n.topGroupZIndex),e.children&&e.children.forEach((function(e){var t=n.lf.getNodeModelById(e);n.toFrontGroup(t)})))},t.register(Qp),this.lf=t,t.graphModel.addNodeMoveRules((function(e,i,o){if(e.isGroup){var r=n.getNodeAllChild(e);return t.graphModel.moveNodes(r,i,o,!0),!0}var a=t.getNodeModelById(n.nodeGroupMap.get(e.id));if(a&&a.isRestrict){var s=e.getBounds(),l=s.minX,u=s.minY,c=s.maxX,d=s.maxY;return a.isAllowMoveTo({minX:l+i,minY:u+o,maxX:c+i,maxY:d+o})}return!0})),t.graphModel.group=this,t.on("node:add,node:drop,node:dnd-add",this.appendNodeToGroup),t.on("node:delete",this.deleteGroupChild),t.on("node:dnd-drag,node:drag",this.setActiveGroup),t.on("node:click",this.nodeSelected),t.on("graph:rendered",this.graphRendered),t.addElements=function(e,i){var o=e.nodes,r=e.edges,a={},s={nodes:[],edges:[]},l=[];return Eu(o,(function(e){var o=e.id,r=e.children,u=v(e,["children"]),c=t.addNode(u);if(!c)return{nodes:[],edges:[]};o&&(a[o]=c.id),s.nodes.push(c);var d=n.createAllChildNodes(a,r,c,i).edgesArray;l.push.apply(l,E([],w(d),!1))})),l.forEach((function(e){n.createEdgeModel(e,a,i)})),Eu(r,(function(e){var t=n.createEdgeModel(e,a,0);s.edges.push(t)})),s}}return e.prototype.createAllChildNodes=function(e,n,i,o){var r=this,a=this.lf,s=[],l=[],u=[];null==n||n.forEach((function(n){var c=a.getNodeModelById(n);if(c){var d=c.x,h=c.y,f=c.properties,p=c.type,g=c.rotate,v=c.children,m={x:d+o,y:h+o,properties:f,type:p,rotate:g},y=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",b=a.addNode(m,y);if(i.addChild(b.id),e[n]=b.id,u.push(b),c.incoming.edges.forEach((function(e){l.push(e)})),c.outgoing.edges.forEach((function(e){l.push(e)})),v instanceof Set){var x=r.createAllChildNodes(e,v,b,o),C=x.nodesArray,N=x.edgesArray;u.push.apply(u,E([],w(C),!1)),s.push.apply(s,E([],w(N),!1))}}}));var c=l.filter((function(t){return e[t.sourceNodeId]&&e[t.targetNodeId]})).map((function(e){return e.getData()}));return{nodesArray:u,edgesArray:s.concat(c)}},e.prototype.createEdgeModel=function(e,t,n){var i=this.lf,o=e.sourceNodeId,r=e.targetNodeId;t[o]&&(o=t[o]),t[r]&&(r=t[r]);var a=e.type,s=e.startPoint,l=e.endPoint,u=e.pointsList,c=e.text,d={x:((null==s?void 0:s.x)||0)+n,y:((null==s?void 0:s.y)||0)+n},h={x:((null==l?void 0:l.x)||0)+n,y:((null==l?void 0:l.y)||0)+n},f=[];u&&u.length>0&&(f=u.map((function(e){return e.x+=n,e.y+=n,e})));var p={type:a,startPoint:d,endPoint:h,sourceNodeId:o,targetNodeId:r,pointsList:f};return pt(c)&&!Vc(c)&&(p.text=g(g({},c),{x:(null==c?void 0:c.x)+n,y:(null==c?void 0:c.y)+n})),i.graphModel.addEdge(p)},e.prototype.getNodeAllChild=function(e){var t=this,n=[];return e.children&&e.children.forEach((function(e){n.push(e);var i=t.lf.getNodeModelById(e);(null==i?void 0:i.isGroup)&&(n=n.concat(t.getNodeAllChild(i)))})),n},e.prototype.getGroup=function(e,t){var n=this.lf.graphModel.nodes.filter((function(n){return n.isGroup&&n.isInRange(e)&&n.id!==t.id}));if(0!==n.length){if(1===n.length)return n[0];for(var i=n[n.length-1],o=n.length-2;o>=0;o--)n[o].zIndex>i.zIndex&&(i=n[o]);return i}},e.prototype.getNodeGroup=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="group",e}();function ng(){var e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getFoldIcon=function(){var e=this.props.model,n=e,i=n.x,o=n.y,r=n.width,a=n.height,s=n.properties,l=n.foldable,u=e.x-e.width/2+5,c=e.y-e.height/2+5;if(!l)return null;var d=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:s.isFolded?"M ".concat(u+3,",").concat(c+6," ").concat(u+11,",").concat(c+6," M").concat(u+7,",").concat(c+2," ").concat(u+7,",").concat(c+10):"M ".concat(u+3,",").concat(c+6," ").concat(u+11,",").concat(c+6," ")});return t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:i-r/2+5,y:o-a/2+5,onClick:function(t){var n,i;t.stopPropagation(),null===(i=(n=e).foldGroup)||void 0===i||i.call(n,!s.isFolded)}}),d])},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getNodeStyle(),s=g(g({},a),{x:n-o/2,y:i-r/2,width:o,height:r,stroke:"black",strokeWidth:2,strokeDasharray:"0 0"});return t.h("g",{},[t.h("rect",g({},s)),this.getFoldIcon()])},n}(Jp),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.foldable=!0,this.resizable=!0,this.width=400,this.height=200,this.resetWidthHeight(),this.isTaskNode=!0,this.boundaryEvents=[]},t.prototype.resetWidthHeight=function(){var e,t,n=null===(e=this.properties.iniProp)||void 0===e?void 0:e.width,i=null===(t=this.properties.iniProp)||void 0===t?void 0:t.height;n&&(this.width=n),i&&(this.height=i)},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.stroke="#989891",t.strokeWidth=1,t.strokeDasharray="3 3",this.isSelected&&(t.stroke="rgb(124, 15, 255)"),this.properties.isBoundaryEventTouchingTask&&(t.stroke="#00acff",t.strokeWidth=2),t},t.prototype.addChild=function(t){var n=this.graphModel.getElement(t);null==n||n.setProperties({parent:this.id}),e.prototype.addChild.call(this,t)},t.prototype.getAnchorStyle=function(){var t=e.prototype.getAnchorStyle.call(this);return t.stroke="#000",t.fill="#fff",t.hover||(t.hover={}),t.hover.stroke="transparent",t},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return t.stroke="transparent",t.hover||(t.hover={}),t.hover.stroke="transparent",t},t.prototype.setTouching=function(e){this.setProperty("isBoundaryEventTouchingTask",e)},t.prototype.addBoundaryEvent=function(e){if(this.setTouching(!1),this.boundaryEvents.find((function(t){return t===e})))return!1;var t=this.graphModel.getNodeModelById(e);return null==t||t.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(e),!0},t.prototype.deleteBoundaryEvent=function(e){this.boundaryEvents=this.boundaryEvents.filter((function(t){return t!==e}))},t}(Zp);return{type:"bpmn:subProcess",view:e,model:n}}function ig(e){var t=Be("bpmn:serviceTask",Ae),n=Be("bpmn:userTask",ke);e.register(t),e.register(n),e.register(ng()),function(e){function t(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=e.id,s=n-o/2,l=n+o/2,u=i-r/2,c=i+r/2,d=t.x,h=t.y;return d>s-5&&d<l+5&&h>u-5&&h<c+5&&!(d>s+5&&d<l-5&&h>u+5&&h<c-5)?a:null}e.on("node:drag,node:dnd-drag",(function(n){var i,o,r=n.data;if("bpmn:boundaryEvent"===r.type){var a=e.graphModel.nodes;try{for(var s=x(a),l=s.next();!l.done;l=s.next()){var u=l.value;u.isTaskNode&&(t(u,r)?u.setTouching(!0):u.setTouching(!1))}}catch(e){i={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})),e.on("node:drop,node:dnd-add",(function(n){var i,o,r=n.data,a=r.type,s=r.id;if("bpmn:boundaryEvent"===a){var l=e.graphModel.nodes;try{for(var u=x(l),c=u.next();!c.done;c=u.next()){var d,h=c.value;if(h.isTaskNode)if(null!==(d=t(h,r))){var f=e.graphModel.getNodeModelById(s),p=e.graphModel.getNodeModelById(d),g=f.properties.attachedToRef;return g&&g!==d&&e.graphModel.getNodeModelById(g).deleteBoundaryEvent(s),void p.addBoundaryEvent(s)}}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}}})),e.graphModel.addNodeMoveRules((function(t,n,i){if(t.isTaskNode){var o=t.boundaryEvents;return e.graphModel.moveNodes(o,n,i,!0),!0}return!0}))}(e)}function og(e){var n=function(t){function n(n,i){n.id||(n.id="Flow_".concat(me()));var o=g(g(g({},e||{}),n.properties),{isDefaultFlow:!1});return n.properties=o,t.call(this,n,i)||this}return p(n,t),n.extendKey="SequenceFlowModel",n}(t.PolylineEdgeModel),i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getStartArrow=function(){return this.props.model.properties.isDefaultFlow?t.h("path",{refX:15,stroke:"#000000",strokeWidth:2,d:"M 20 5 10 -5 z"}):t.h("path",{d:""})},n.extendKey="SequenceFlowEdge",n}(t.PolylineEdge);return{type:"bpmn:sequenceFlow",view:i,model:n}}var rg=og();var ag=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:Ne,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function sg(e){function t(t){t.forEach((function(t){var n,i;n=t.nodes,i=t.definition,n.forEach((function(t){(null==e?void 0:e[t])||(e[t]=new Map);var n=null==e?void 0:e[t];i.forEach((function(e){n.set(e.type,e)}))}))}))}return function(){return[e,t]}}var lg=function(){function e(e){var t=e.lf;t.definition={},t.useDefinition=sg(t.definition);var n=w(t.useDefinition(),2);n[0];(0,n[1])(ag),function(e){e.register(we(e)),e.register(be(e)),e.register(xe(e)),e.register(Ce(e)),e.register(Ee(e))}(t),function(e){var t=Ie("bpmn:exclusiveGateway",Se),n=Ie("bpmn:parallelGateway",Me),i=Ie("bpmn:inclusiveGateway",Te);e.register(t),e.register(i),e.register(n)}(t),function(e){e.register(rg)}(t),ig(t),t.setDefaultEdgeType("bpmn:sequenceFlow")}return e.pluginName="BpmnElementsPlugin",e}(),ug=40,cg=40,dg=40,hg=40,fg=100,pg=80,gg=100,vg=80,mg=100,yg=80,bg=100,xg=80,wg=100,Eg=80,Cg=100,Ng=80,_g=100,Sg=80,Mg=100,Tg=80,Ag=function(){};(Ag.ObjTree=function(){return this}).VERSION="0.23",Ag.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',Ag.ObjTree.prototype.attr_prefix="-",Ag.ObjTree.prototype.parseXML=function(e){var t;if(window.DOMParser){var n=new DOMParser,i=n.parseFromString(e,"application/xml");if(!i)return;t=i.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(e),t=n.documentElement);if(t)return this.parseDOM(t)},Ag.ObjTree.prototype.parseHTTP=function(e,t,n){var i,o={};for(var r in t)o[r]=t[r];if(o.method||(void 0===o.postBody&&void 0===o.postbody&&void 0===o.parameters?o.method="get":o.method="post"),n){o.asynchronous=!0;var a=this,s=n,l=o.onComplete;o.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else o.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)o.uri=e,(u=new HTTP.Request(o))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,o))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},Ag.ObjTree.prototype.parseDOM=function(e){if(e){if(this.__force_array={},this.force_array)for(var t=0;t<this.force_array.length;t++)this.__force_array[this.force_array[t]]=1;var n=this.parseElement(e);if(this.__force_array[e.nodeName]&&(n=[n]),11!==e.nodeType){var i={};i[e.nodeName]=n,n=i}return n}},Ag.ObjTree.prototype.parseElement=function(e){if(7!==e.nodeType){if(3===e.nodeType||4===e.nodeType||8===e.nodeType){if(null==e.nodeValue.match(/[^\x00-\x20]/))return;return e.nodeValue}var t=null,n={};if(e.attributes&&e.attributes.length){t={};for(var i=0;i<e.attributes.length;i++){if("string"==typeof(s=e.attributes[i].nodeName)){var o=e.attributes[i].nodeValue;try{o=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){o=e.attributes[i].nodeValue}null!=o&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}if(e.childNodes&&e.childNodes.length){var r=!0;t&&(r=!1);for(i=0;i<e.childNodes.length&&r;i++){var a=e.childNodes[i].nodeType;3!==a&&4!==a&&8!==a&&(r=!1)}if(r){t||(t="");for(i=0;i<e.childNodes.length;i++)t+=e.childNodes[i].nodeValue}else{t||(t={});for(i=0;i<e.childNodes.length;i++){var s;if("string"==typeof(s=e.childNodes[i].nodeName))(o=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}else null===t&&(t={});return t}},Ag.ObjTree.prototype.addNode=function(e,t,n,i){this.__force_array[t]?(1===n&&(e[t]=[]),e[t][e[t].length]=i):1===n?e[t]=i:2===n?e[t]=[e[t],i]:e[t][e[t].length]=i},Ag.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},Ag.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var o in t)if(vc(t,o)){var r=t[o];o.charAt(0)!==this.attr_prefix?void 0===r||null==r?n[n.length]="<".concat(o," />"):"object"==typeof r&&r.constructor===Array?n[n.length]=this.array_to_xml(o,r):n[n.length]="object"==typeof r?this.hash_to_xml(o,r):this.scalar_to_xml(o,r):i[i.length]=" ".concat(o.substring(1),'="').concat(this.xml_escape(r),'"')}var a=i.join(""),s=n.join("");return void 0===e||null==e||(s=n.length>0?s.match(/\n/)?"<".concat(e).concat(a,">\n").concat(s,"</").concat(e,">\n"):"<".concat(e).concat(a,">").concat(s,"</").concat(e,">\n"):"<".concat(e).concat(a," />\n")),s},Ag.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var o=t[i];void 0===o||null==o?n[n.length]="<".concat(e," />"):"object"==typeof o&&o.constructor===Array?n[n.length]=this.array_to_xml(e,o):n[n.length]="object"==typeof o?this.hash_to_xml(e,o):this.scalar_to_xml(e,o)}return n.join("")},Ag.ObjTree.prototype.scalar_to_xml=function(e,t){return"#text"===e?this.xml_escape(t):"<".concat(e,">").concat(this.xml_escape(t),"</").concat(e,">\n")},Ag.ObjTree.prototype.xml_escape=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};function kg(e){return Object.prototype.toString.call(e)}function Rg(e){return" ".repeat(e)}function Dg(e){return"[object Object]"===kg(e)?Object.keys(e).reduce((function(t,n){var i=n;return"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=Dg(e[n]),t}),{}):Array.isArray(e)?e.map((function(e){return Dg(e)})):e}var Og,Pg="\t\n";function Ig(e,t,n){var i=Rg(n),o="",r=Pg+i;if("-json"===t)return"";if("#text"===t)return r+e;if("#cdata-section"===t)return"".concat(r,"<![CDATA[").concat(e,"]]>");if("#comment"===t)return"".concat(r,"\x3c!--").concat(e,"--\x3e");if("-"==="".concat(t).charAt(0))return" ".concat(t.substring(1),'="').concat(function(e){var t=e;try{"string"!=typeof t&&(t=JSON.parse(e))}catch(n){t=JSON.stringify(Dg(e)).replace(/"/g,"'")}return t}(e),'"');if(Array.isArray(e))o+=e.map((function(e){return Ig(e,t,n+1)})).join("");else if("[object Object]"===kg(e)){var a=Object.keys(e),s="",l=e["-json"]?Pg+Rg(n+1)+e["-json"]:"";o+="".concat(0===n?"":r,"<").concat(t),a.forEach((function(t){"-"===t.charAt(0)?s+=Ig(e[t],t,n+1):l+=Ig(e[t],t,n+1)})),o+=s+(""!==l?">".concat(l).concat(r,"</").concat(t,">"):" />")}else o+="".concat(r,"<").concat(t,">").concat(e.toString(),"</").concat(t,">");return o}!function(e){e.START="bpmn:startEvent",e.END="bpmn:endEvent",e.INTERMEDIATE_CATCH="bpmn:intermediateCatchEvent",e.INTERMEDIATE_THROW="bpmn:intermediateThrowEvent",e.BOUNDARY="bpmn:boundaryEvent",e.PARALLEL_GATEWAY="bpmn:parallelGateway",e.INCLUSIVE_GATEWAY="bpmn:inclusiveGateway",e.EXCLUSIVE_GATEWAY="bpmn:exclusiveGateway",e.USER="bpmn:userTask",e.SYSTEM="bpmn:serviceTask",e.FLOW="bpmn:sequenceFlow",e.SUBPROCESS="bpmn:subProcess"}(Og||(Og={}));var Lg=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],Bg=["properties","startPoint","endPoint","pointsList"],jg={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Fg=function(e,t){return Object.keys(t||{}).forEach((function(n){if(e[n]){var i=t[n],o=i.in,r=i.out;o&&(e[n].in=o),r&&(e[n].out=r)}else e[n]=t[n]})),e},Hg={"bpmn:startEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Hg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:intermediateCatchEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Hg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:intermediateThrowEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Hg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:boundaryEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Hg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:sequenceFlow":{out:function(e){var t=e.properties,n=t.expressionType,i=t.condition;return i?"cdata"===n?{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[${'.concat(i,"}]]></bpmn:conditionExpression>")}:{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">'.concat(i,"</bpmn:conditionExpression>")}:{json:""}}},"bpmn:timerEventDefinition":{out:function(e){var t=e.properties,n=t.timerType,i=t.timerValue,o=t.definitionId;return{json:'<bpmn:timerEventDefinition id="'.concat(o,'"').concat(n&&i?">".concat("<bpmn:".concat(n,' xsi:type="bpmn:tFormalExpression">').concat(i,"</bpmn:").concat(n,">"),"</bpmn:timerEventDefinition>"):"/>")}},in:function(e,t){var n,i,o,r=e,a=t["-id"],s="",l="";try{for(var u=x(Object.keys(t)),c=u.next();!c.done;c=u.next()){var d=c.value;d.includes("bpmn:")&&(s=w(d.split(":"),2)[1],l=null===(o=t[d])||void 0===o?void 0:o["#text"])}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return{"-definitionId":a,"-definitionType":r,"-timerType":s,"-timerValue":l}}},"bpmn:conditionExpression":{in:function(e,t){var n,i="",o="";return t["#cdata-section"]?(o="cdata",i=(null===(n=/^\$\{(.*)\}$/g.exec(t["#cdata-section"]))||void 0===n?void 0:n[1])||""):t["#text"]&&(o="normal",i=t["#text"]),{"-condition":i,"-expressionType":o}}}};function Wg(e){var t=null!=e?e:{},n=t.retainedAttrsFields,i=t.excludeFields,o=t.transformer,r=new Set(E(E([],w(Bg),!1),w(n||[]),!1)),a={in:new Set(E(E([],w(jg.in),!1),w((null==i?void 0:i.in)||[]),!1)),out:new Set(E(E([],w(jg.out),!1),w((null==i?void 0:i.out)||[]),!1))};return Hg=Fg(Hg,o),function(e){var t=e.nodes,n=e.edges;return function e(i,o){var s,l;if(1!==(null==i?void 0:i.flag)){var u;if((u=Hg[i.type])&&u.out){var c=u.out(i),d=Object.keys(c);d.length>0&&d.forEach((function(e){i[e]=c[e]}))}(null==i?void 0:i.children)&&(i.children=i.children.map((function(e){return t.find((function(t){return t.id===e}))||n.find((function(t){return t.id===e}))||{}})));var h={};if("string"==typeof i)return i;if(Array.isArray(i))return i.map((function(t){return e(t,"")})).filter((function(e){return null!=e}));try{for(var f=x(Object.entries(i)),p=f.next();!p.done;p=f.next()){var g=w(p.value,2),v=g[0],m=g[1];if(1===(null==m?void 0:m.flag))return;var y=[o,v].filter((function(e){return e})).join(".");a.out.has(y)||("object"!=typeof m?0===v.indexOf("-")||["#text","#cdata-section","#comment"].includes(v)?h[v]=m:h["-".concat(v)]=m:r.has(y)?h["-".concat(v)]=e(m,y):h[v]=e(m,y))}}catch(e){s={error:e}}finally{try{p&&!p.done&&(l=f.return)&&l.call(f)}finally{if(s)throw s.error}}return h}}(e,"")}}function zg(e){var t,n,i={};try{for(var o=x(Object.entries(e)),r=o.next();!r.done;r=o.next()){var a=w(r.value,2),s=a[0],l=a[1];0===s.indexOf("-")?i[s.substring(1)]=Dg(l):"string"==typeof l?i[s]=l:"[object Object]"===Object.prototype.toString.call(l)?i[s]=zg(l):Array.isArray(l)?i[s]=l.map((function(e){return zg(e)})):i[s]=l}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i}function Gg(e,t){e["bpmndi:BPMNEdge"]=t.edges.map((function(e){var t,n=e.id,i=e.pointsList.map((function(e){return{"-x":e.x,"-y":e.y}})),o={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(o["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),o})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,o=80,r=e.x,a=e.y,s=Kg.shapeConfigMap.get(e.type);s&&(i=s.width,o=s.height),r-=i/2,a-=o/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":r,"-y":a,"-width":i,"-height":o}};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(l["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),l}))}var Ug=["bpmn:incoming","bpmn:outgoing"];function qg(e,t){var n=[],i=[],o=new Map,r=null!=t?t:{},a=r.transformer,s=r.excludeFields,l={in:new Set(E(E([],w(jg.in),!1),w((null==s?void 0:s.in)||[]),!1)),out:new Set(E(E([],w(jg.out),!1),w((null==s?void 0:s.out)||[]),!1))};Hg=Fg(Hg,a);var u,c,d=e["bpmn:definitions"];if(d){var h=d["bpmn:process"];u=h,c=[function(e){function t(e){e["-children"]||(e["-children"]=[]),Object.keys(e).forEach((function(t){var n;0!==t.indexOf("bpmn:")||Ug.includes(t)||(h[t]||(h[t]=[]),!Array.isArray(h[t])&&(h[t]=[h[t]]),Array.isArray(e[t])?(n=h[t]).push.apply(n,E([],w(e[t]),!1)):h[t].push(e[t]),Array.isArray(e[t])?e[t].forEach((function(n){!t.includes("Flow")&&e["-children"].push(n["-id"])})):!t.includes("Flow")&&e["-children"].push(e[t]["-id"]),delete e[t])}))}if("bpmn:subProcess"===e){var n=h[e];Array.isArray(n)?n.forEach((function(n){"bpmn:subProcess"===e&&t(n)})):t(n)}},function(e){function t(e){var n;o.set(e["-id"],e),Array.isArray(e)?e.forEach((function(e){t(e)})):"object"==typeof e&&(n=e,Object.keys(n).forEach((function(e){var i,o;if(e.includes("bpmn:")){var r={};Hg[e]&&Hg[e].in?(r=null===(o=(i=Hg[e]).in)||void 0===o?void 0:o.call(i,e,gn.cloneDeep(n[e])),delete n[e]):t(n[e]);var a=void 0;(a=Reflect.ownKeys(r)).length>0&&a.forEach((function(e){Reflect.set(n,e,r[e])}))}})))}t(h[e])},function(e){if(0===e.indexOf("bpmn:")){var t=h[e];if("bpmn:sequenceFlow"===e){var r=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNEdge"];i=function(e,t){var n=[];if(Array.isArray(e))e.forEach((function(e){var i;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(Vg(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(Vg(i,e))}return n}(t,r)}else{var a=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if("bpmn:boundaryEvent"===e){var s=h[e],l=function(e){var t=e["-attachedToRef"],n=o.get(t);n["-boundaryEvents"]||(n["-boundaryEvents"]=[]),n["-boundaryEvents"].push(e["-id"])};Array.isArray(s)?s.forEach((function(e){l(e)})):l(s)}n=n.concat(function(e,t,n){var i=[];if(Array.isArray(e))e.forEach((function(e){var o=Xg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}));else{var o=Xg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}return i}(t,a,e))}}}],c.forEach((function(e){try{Object.keys(u).forEach((function(t){try{e(t)}catch(e){}}))}catch(e){}}))}var f=function(e,t,n){Object.keys(e).forEach((function(i){var o=n?"".concat(n,".").concat(i):i;t.has(o)?delete e[i]:"object"==typeof e[i]&&f(e[i],t,o)}))};return n.forEach((function(e){var n,i;if(null===(n=null==t?void 0:t.mapping)||void 0===n?void 0:n.in){var o=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,r=e.type;o[r]&&(e.type=o[r])}f(e,l.in,"")})),i.forEach((function(e){var n,i;if(null===(n=null==t?void 0:t.mapping)||void 0===n?void 0:n.in){var o=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,r=e.type;o[r]&&(e.type=o[r])}f(e,l.in,"")})),{nodes:n,edges:i}}function Xg(e,t,n){var i=Number(e["dc:Bounds"]["-x"]),o=Number(e["dc:Bounds"]["-y"]),r=n["-children"],a=n["-name"],s=Kg.shapeConfigMap.get(t);s&&(i+=s.width/2,o+=s.height/2);var l,u={};if(Object.entries(n).forEach((function(e){var t=w(e,2),n=t[0],i=t[1];Lg.includes(n)||(u[n]=i)})),u=zg(u),a&&(l={x:i,y:o,value:a},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var c=e["bpmndi:BPMNLabel"]["dc:Bounds"];l.x=Number(c["-x"])+Number(c["-width"])/2,l.y=Number(c["-y"])+Number(c["-height"])/2}var d={id:e["-bpmnElement"],type:t,x:i,y:o,properties:u};return r&&(d.children=r),l&&(d.text=l),d}function Vg(e,t){var n,i=t["-name"]?"".concat(t["-name"]):"";if(i){var o=e["bpmndi:BPMNLabel"]["dc:Bounds"],r=0;i.split("\n").forEach((function(e){r<e.length&&(r=e.length)})),n={value:i,x:Number(o["-x"])+10*r/2,y:Number(o["-y"])+7}}var a={};Object.entries(t).forEach((function(e){var t=w(e,2),n=t[0],i=t[1];Lg.includes(n)||(a[n]=i)})),a=zg(a);var s=e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),l={id:t["-id"],type:Og.FLOW,pointsList:s,sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:a};return n&&(l.text=n),l}var Kg=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i,o,r=g({},n.processAttributes);!function(e,t,n){var i,o=new Map,r=Wg(n)(t);r.nodes.forEach((function(t){var n=t["-id"],i=t["-type"],r=t.text,a=t.children,s=v(t,["-id","-type","text","children"]),l={"-id":n};(null==r?void 0:r["-value"])&&(l["-name"]=r["-value"]),s["-json"]&&(l["-json"]=s["-json"]),s["-properties"]&&Object.assign(l,s["-properties"]),a&&(l.children=a),e[i]||(e[i]=[]),e[i].push(l),o.set(n,l)}));var a=r.edges.map((function(e){var t=e["-id"],n=e["-sourceNodeId"],i=e["-targetNodeId"],r=e.text,a=v(e,["-id","-sourceNodeId","-targetNodeId","text"]),s=o.get(i);s["bpmn:incoming"]||(s["bpmn:incoming"]=[]),s["bpmn:incoming"].push(t);var l={"-id":t,"-sourceRef":n,"-targetRef":i};return(null==r?void 0:r["-value"])&&(l["-name"]=r["-value"]),a["-json"]&&(l["-json"]=a["-json"]),a["-properties"]&&Object.assign(l,a["-properties"]),l}));t.edges.forEach((function(e){var t=e.sourceNodeId,n=e.id,i=o.get(t);i["bpmn:outgoing"]||(i["bpmn:outgoing"]=[]),i["bpmn:outgoing"].push(n)})),null===(i=e["bpmn:subProcess"])||void 0===i||i.forEach((function(t){var n={"bpmn:incoming":new Set,"bpmn:outgoing":new Set},i=[];t.children.forEach((function(i){var r,a=o.get(i["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach((function(e){a[e]&&a[e].forEach((function(t){n[e].add(t)}))}));var s=null===(r=e[i["-type"]])||void 0===r?void 0:r.findIndex((function(e){return e["-id"]===i["-id"]}));s>=0&&e[i["-type"]].splice(s,1),o.delete(i["-id"]),t[i["-type"]]||(t[i["-type"]]=[]),t[i["-type"]].push(a)}));var r=n["bpmn:incoming"];n["bpmn:outgoing"].forEach((function(e){r.has(e)&&i.push(e)}));for(var s,l=function(e){var n=a.findIndex((function(t){return t["-id"]===i[e]}));n>=0?(t["bpmn:sequenceFlow"]||(t["bpmn:sequenceFlow"]=[]),t["bpmn:sequenceFlow"].push(a[n]),a.splice(n,1)):e++,s=e},u=0;u<i.length;)l(u),u=s;delete t.children})),e[Og.FLOW]=a}(r,e,t);var a={"-id":"BPMNPlane_1","-bpmnElement":r["-id"]};Gg(a,e);var s=n.definitionAttributes;s["bpmn:process"]=r,s["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":a};var l={"bpmn:definitions":s};if(null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.out){var u=null===(o=null==t?void 0:t.mapping)||void 0===o?void 0:o.out,c=function(e){Array.isArray(e)&&e.forEach((function(e){return c(e)})),"object"==typeof e&&Object.keys(e).forEach((function(t){var n;(n=u[t])?(e[n]=gn.cloneDeep(e[t]),delete e[t],c(e[n])):c(e[t])}))};c(l)}return l},this.adapterIn=function(e,t){if(e)return qg(e,t)},t.adapterIn=this.adapterIn,t.adapterOut=this.adapterOut,this.processAttributes={"-isExecutable":"true","-id":"Process"},this.definitionAttributes={"-id":"Definitions","-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.10"}}return e.prototype.setCustomShape=function(t,n){e.shapeConfigMap.set(t,n)},e.pluginName="bpmn-adapter",e.shapeConfigMap=new Map,e}();Kg.shapeConfigMap.set(Og.START,{width:ug,height:cg}),Kg.shapeConfigMap.set(Og.END,{width:dg,height:hg}),Kg.shapeConfigMap.set(Og.INTERMEDIATE_CATCH,{width:gg,height:vg}),Kg.shapeConfigMap.set(Og.INTERMEDIATE_THROW,{width:gg,height:vg}),Kg.shapeConfigMap.set(Og.BOUNDARY,{width:fg,height:pg}),Kg.shapeConfigMap.set(Og.PARALLEL_GATEWAY,{width:mg,height:yg}),Kg.shapeConfigMap.set(Og.INCLUSIVE_GATEWAY,{width:bg,height:xg}),Kg.shapeConfigMap.set(Og.EXCLUSIVE_GATEWAY,{width:wg,height:Eg}),Kg.shapeConfigMap.set(Og.SYSTEM,{width:Cg,height:Ng}),Kg.shapeConfigMap.set(Og.USER,{width:_g,height:Sg}),Kg.shapeConfigMap.set(Og.SUBPROCESS,{width:Mg,height:Tg});var Yg=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t,i=(t=e,(new Ag.ObjTree).parseXML(t));return n.adapterIn(i,n.props)},n.adapterXmlOut=function(e){return function(e){var t="";for(var n in e)t+=Ig(e[n],n,0);return t}(n.adapterOut(e,n.props))};var i=t.lf,o=t.props;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n.props=o,n}return p(t,e),t.pluginName="BPMNAdapter",t}(Kg),$g={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},Zg={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function Jg(e){switch(e){case"bpmn:sequenceFlow":return $g.SEQUENCE_FLOW;case"bpmn:startEvent":return $g.START_EVENT;case"bpmn:endEvent":return $g.END_EVENT;case"bpmn:userTask":return $g.USER_TASK;case"bpmn:exclusiveGateway":return $g.EXCLUSIVE_GATEWAY;default:return e}}function Qg(e,t,n){var i=t.x,o=t.y,r=e.x-i,a=e.y-o;return{x:r*Math.cos(n)-a*Math.sin(n)+i,y:r*Math.sin(n)+a*Math.cos(n)+o}}var ev=function(e){function n(){var n=e.apply(this,E([],w(arguments),!1))||this;return n.childrenPositionMap=new Map,n.onNodeRotate=function(e){var t=e.model,i=n.props,o=i.model,r=i.graphModel,a=o.transformWithContainer,s=o.isRestrict,l=n.childrenPositionMap;if(a&&!s&&t.id===o.id){var u={x:o.x,y:o.y};Eu(Array.from(o.children),(function(e){var n=r.getNodeModelById(e);if(n){var i={x:n.x,y:n.y};l.has(n.id)?i=l.get(n.id):l.set(n.id,i);var o=t.rotate*(180/Math.PI);o<0&&(o+=360);var a=o*(Math.PI/180),s=Qg(i,u,a);n.moveTo(s.x,s.y),n.rotate=t.rotate}}))}},n.onNodeResize=function(e){var i=e.deltaX,o=e.deltaY,r=e.index,a=e.model,s=e.preData,l=n.props,u=l.model,c=l.graphModel,d=u.transformWithContainer,h=u.isRestrict;if(d&&!h&&a.id===u.id){var f=s.properties||{},p=f.width,g=f.height;Eu(Array.from(u.children),(function(e){var n=c.getNodeModelById(e);if(n){var a=n.width/p*i,s=n.height/g*o;t.handleResize({deltaX:a,deltaY:s,index:r,nodeModel:n,graphModel:c,cancelCallback:function(){}})}}))}},n.onNodeMouseMove=function(){},n.graphRendered=function(){var e=n.props.model;e.isCollapsed&&e.toggleCollapse(!0)},n}return p(n,e),n.prototype.componentDidMount=function(){e.prototype.componentDidMount.call(this);var t=this.props.graphModel.eventCenter;t.on("node:rotate",this.onNodeRotate),t.on("node:resize",this.onNodeResize),t.on("node:mousemove",this.onNodeMouseMove),t.on("graph:rendered",this.graphRendered)},n.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this);var t=this.props.graphModel.eventCenter;t.off("node:rotate",this.onNodeRotate),t.off("node:resize",this.onNodeResize),t.off("node:mousemove",this.onNodeMouseMove),t.off("graph:rendered",this.graphRendered)},n.prototype.getNodesInGroup=function(e,t){var n=this,i=[];return e.isGroup&&Eu(Array.from(e.children),(function(e){i.push(e);var o=t.getNodeModelById(e);(null==o?void 0:o.isGroup)&&(i=i.concat(n.getNodesInGroup(o,t)))})),i},n.prototype.getResizeControl=function(){var t=this.props.model,n=t.resizable,i=t.isCollapsed;return n&&!i?e.prototype.getResizeControl.call(this):null},n.prototype.getAppendAreaShape=function(){var e=this.props.model,n=e.width,i=e.height,o=e.x,r=e.y,a=e.radius;if(!e.groupAddable)return null;var s=e.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=e.getAddableOutlineStyle(),c=n+l+8,d=i+l+8;return t.h("rect",g(g({},u),{width:c,height:d,x:o-c/2,y:r-d/2,rx:a,ry:a}))},n.prototype.getCollapseIcon=function(e,t){return"M ".concat(e+3,",").concat(t+6," ").concat(e+11,",").concat(t+6," M").concat(e+7,",").concat(t+2," ").concat(e+7,",").concat(t+10)},n.prototype.getExpandIcon=function(e,t){return"M ".concat(e+3,",").concat(t+6," ").concat(e+11,",").concat(t+6," ")},n.prototype.getOperateIcon=function(){var e=this.props.model,n=e.x,i=e.y,o=n-e.width/2+10,r=i-e.height/2+10;if(!e.collapsible)return null;var a=(null==e?void 0:e.isCollapsed)?this.getCollapseIcon(o,r):this.getExpandIcon(o,r),s=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:a});return t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#f4f5f6",stroke:"#cecece",cursor:"pointer",x:o,y:r,onClick:function(){e.toggleCollapse(!e.isCollapsed)}}),s])},n.prototype.getShape=function(){return t.h("g",{},[this.getAppendAreaShape(),e.prototype.getShape.call(this),this.getOperateIcon()])},n}(t.RectNode),tv=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.isGroup=!0,i.isRestrict=!1,i.autoResize=!1,i.collapsible=!0,i.isCollapsed=!1,i.groupAddable=!1,i.transformWithContainer=!1,i.childrenLastCollapseStateDict=new Map,i.childrenLastCollapseStateDict=new Map,i.initNodeData(t),i.setAttributes(),i}return p(n,e),n.prototype.initNodeData=function(t){var n;e.prototype.initNodeData.call(this,t);var i=null!==(n=t.properties)&&void 0!==n?n:{},o=i.children,r=i.width,a=i.height,s=i.collapsedWidth,l=i.collapsedHeight,u=i.collapsible,c=i.isCollapsed,d=i.zIndex,h=i.isRestrict,f=i.autoResize,p=i.autoToFront,g=i.transformWithContainer;this.children=o?new Set(o):new Set,this.zIndex=null!=d?d:-1e4,this.isCollapsed=null!=c&&c,this.setProperties({isCollapsed:null!=c&&c});var v=null!=r?r:400,m=null!=a?a:230;this.width=v,this.height=m,this.expandWidth=v,this.expandHeight=m,this.collapsedWidth=null!=s?s:80,this.collapsedHeight=null!=l?l:60,this.isRestrict=null!=h&&h,this.transformWithContainer=null!=g&&g,this.autoResize=null!=f&&f,this.collapsible=null==u||u,this.autoToFront=null!=p&&p,this.text.editable=!1,this.text.draggable=!1},n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this)},n.prototype.getData=function(){var t=this,n=e.prototype.getData.call(this),i=[];return Eu(Array.from(this.children),(function(e){var n=t.graphModel.getNodeModelById(e);n&&!n.virtual&&i.push(e)})),n.children=i,n.properties&&(n.properties.children=i,n.properties.isCollapsed=this.isCollapsed),n},n.prototype.getNodesInGroup=function(e){var t=[];return e.isGroup&&Eu(Array.from(e.children),(function(e){t.push(e)})),t},n.prototype.getMoveDistance=function(t,n,i){void 0===i&&(i=!1);var o=w(e.prototype.getMoveDistance.call(this,t,n,i),2),r=o[0],a=o[1],s=this.getNodesInGroup(this);return this.graphModel.moveNodes(s,t,n,i),[r,a]},n.prototype.getHistoryData=function(){var t=e.prototype.getHistoryData.call(this);t.children=Array.from(this.children),t.isGroup=!0;var n=this,i=n.x,o=n.y,r=n.collapsedWidth,a=n.collapsedHeight,s=n.expandWidth,l=n.expandHeight;return n.isCollapsed&&(t.x=i+s/2-r/2,t.y=o+l/2-a/2,t.text&&(t.text.x=t.text.x+s/2-r/2,t.text.y=t.text.y+l/2-a/2)),t},n.prototype.toggleCollapse=function(e){var n=this,i=this.graphModel,o=!!e;this.isCollapsed=o,this.setProperties({isCollapsed:o}),i.eventCenter.emit("dynamicGroup:collapse",{collapse:o,nodeModel:this}),o?this.collapse():this.expand();var r=E(E([],w(this.incoming.edges),!1),w(this.outgoing.edges),!1);Eu(Array.from(this.children),(function(i){var o,a,s=n.graphModel.elementsModelMap.get(i);if(s){var l=s.isCollapsed;if(s.isGroup){var u=s;if(u.isCollapsed||u.toggleCollapse(e),!e){var c=null===(o=n.childrenLastCollapseStateDict)||void 0===o?void 0:o.get(i);void 0!==c&&c!==s.isCollapsed&&u.toggleCollapse(c)}}if(null===(a=n.childrenLastCollapseStateDict)||void 0===a||a.set(i,!!l),s.visible=!e,s.BaseType===t.ElementType.NODE){var d=s.incoming.edges,h=s.outgoing.edges;r=E(E(E([],w(r),!1),w(d),!1),w(h),!1)}}})),this.collapseEdge(o,r)},n.prototype.collapse=function(){var e=this,t=e.x,n=e.y,i=e.text,o=e.width,r=e.height,a=e.collapsedWidth,s=e.collapsedHeight;this.x=t-o/2+a/2,this.y=n-r/2+s/2,this.text.x=i.x-o/2+a/2,this.text.y=i.y-r/2+s/2,this.expandWidth=o,this.expandHeight=r,this.width=a,this.height=s},n.prototype.expand=function(){var e=this,t=e.x,n=e.y,i=e.text,o=e.expandWidth,r=e.expandHeight,a=e.collapsedWidth,s=e.collapsedHeight;this.width=o,this.height=r,this.x=t+this.width/2-a/2,this.y=n+this.height/2-s/2,this.text.x=i.x+this.width/2-a/2,this.text.y=i.y+this.height/2-s/2},n.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isCollapsedEdge=!0},n.prototype.collapseEdge=function(e,t){var n=this,i=this.graphModel;Eu(t,(function(t,o){var r,a=t.getData(),s=a.targetNodeId,l=a.sourceNodeId,u=g(g({},a),{id:"".concat(a.id,"__").concat(o),text:null===(r=a.text)||void 0===r?void 0:r.value});t.virtual&&i.deleteEdgeById(t.id);var c=i.dynamicGroup.getGroupByNodeId(s);c||(c=i.getNodeModelById(s));var d=i.dynamicGroup.getGroupByNodeId(l);d||(d=i.getNodeModelById(l)),e&&t.visible&&(n.children.has(l)||n.id===l?(u.startPoint=void 0,u.sourceNodeId=n.id):(u.endPoint=void 0,u.targetNodeId=n.id),c.id===n.id&&d.id===n.id||n.createVirtualEdge(u),t.visible=!1),e||t.visible||(c&&c.isGroup&&c.isCollapsed?(u.targetNodeId=c.id,u.endPoint=void 0,n.createVirtualEdge(u)):d&&d.isGroup&&d.isCollapsed?(u.sourceNodeId=d.id,u.startPoint=void 0,n.createVirtualEdge(u)):t.visible=!0)}))},n.prototype.isAllowAppendIn=function(e){return!0},n.prototype.setAllowAppendChild=function(e){this.groupAddable=e},n.prototype.addChild=function(e){this.children.add(e);var t=this.getData();this.graphModel.eventCenter.emit("group:add-node",{data:t,childId:e})},n.prototype.removeChild=function(e){this.children.delete(e);var t=this.getData();this.graphModel.eventCenter.emit("group:remove-node",{data:t})},n.prototype.toBack=function(){this.zIndex--},n.prototype.getResizeOutlineStyle=function(){var t=e.prototype.getResizeOutlineStyle.call(this);return t.stroke="none",t},n.prototype.getAnchorStyle=function(){var t=e.prototype.getAnchorStyle.call(this);return t.stroke="transparent",t.fill="transparent",t.hover&&(t.hover.fill="transparent",t.hover.stroke="transparent"),t},n.prototype.getAddableOutlineStyle=function(){return{stroke:"#feb663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},m([t.observable],n.prototype,"isCollapsed",void 0),m([t.observable],n.prototype,"groupAddable",void 0),m([t.observable],n.prototype,"transformWithContainer",void 0),n}(t.RectNodeModel);var nv,iv={type:"dynamic-group",view:ev,model:tv},ov=-1e4,rv=function(){function e(e){var t=e.lf,n=e.options,i=this;this.topGroupZIndex=ov,this.nodeGroupMap=new Map,this.onSelectionDrop=function(){i.lf.graphModel.getSelectElements().nodes.forEach((function(e){i.addNodeToGroup(e)}))},this.onNodeAddOrDrop=function(e){var t=e.data;i.addNodeToGroup(t)},this.addNodeToGroup=function(e){var t=i.nodeGroupMap.get(e.id);t&&((a=i.lf.getNodeModelById(t)).removeChild(e.id),i.nodeGroupMap.delete(e.id),a.setAllowAppendChild(!1));var n=i.lf.getNodeModelById(e.id),o=null==n?void 0:n.getBounds();if(n&&o){if(n.isGroup){var r=n;Eu(Array.from(r.children),(function(t){i.nodeGroupMap.set(t,e.id)})),i.calibrateTopGroupZIndex([e]),i.onNodeSelect({data:e,isSelected:!1,isMultiple:!1})}var a;if(a=i.getGroupByBounds(o,e))a.isAllowAppendIn(e)?(a.addChild(e.id),a.setAllowAppendChild(!1)):i.lf.emit("group:not-allowed",{group:a.getData(),node:e})}},this.onGroupAddNode=function(e){var t=e.data,n=e.childId;i.nodeGroupMap.set(n,t.id)},this.removeNodeFromGroup=function(e){var t=e.data;e.model.isGroup&&t.children&&Eu(Array.from(t.children),(function(e){i.nodeGroupMap.delete(e),i.lf.deleteNode(e)}));var n=i.nodeGroupMap.get(t.id);if(n){var o=i.lf.getNodeModelById(n);o&&o.removeChild(t.id),i.nodeGroupMap.delete(t.id)}},this.onSelectionDrag=function(){i.lf.graphModel.getSelectElements().nodes.forEach((function(e){i.setActiveGroup(e)}))},this.onNodeDrag=function(e){var t=e.data;i.setActiveGroup(t)},this.setActiveGroup=function(e){var t=i.lf.getNodeModelById(e.id),n=null==t?void 0:t.getBounds();if(t&&n){var o=i.getGroupByBounds(n,e);if(i.activeGroup&&i.activeGroup.setAllowAppendChild(!1),!o||t.isGroup&&o.id===e.id)return;if(!o.isAllowAppendIn(e))return;i.activeGroup=o,i.activeGroup.setAllowAppendChild(!0)}},this.onNodeSelect=function(e){var t=e.data,n=e.isMultiple,o=e.isSelected,r=i.lf.getNodeModelById(t.id);if(i.sendNodeToFront(r),i.topGroupZIndex>-1e3){var a=i.lf.graphModel.nodes;i.topGroupZIndex=ov;var s=ef(zu(a,(function(e){return!!e.isGroup})),"zIndex"),l=0;Eu(s,(function(e){e.zIndex!==l&&(i.topGroupZIndex++,l=e.zIndex),e.setZIndex(i.topGroupZIndex)}))}if(n&&o)if(null==r?void 0:r.isGroup){var u=r.children;Eu(Array.from(u),(function(e){var t=i.lf.getNodeModelById(e);null==t||t.setSelected(!1)}))}else{var c=i.nodeGroupMap.get(t.id);if(c){var d=i.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==r||r.setSelected(!1))}}},this.onNodeMove=function(e){var t=e.deltaX,n=e.deltaY,o=e.data,r=o.id,a=o.x,s=o.y,l=o.properties;if(l){var u=l.width,c=l.height,d=i.nodeGroupMap.get(r);if(d){var h=i.lf.getNodeModelById(d);if(h&&h.isRestrict&&h.autoResize){var f=a+t/2,p=s+n/2,g=f-u/2,v=p-c/2,m=f+u/2,y=p+c/2,b=!1,x=h.getBounds(),w=Object.assign({},x);if(g<w.minX&&(w.minX=g,b=!0),v<w.minY&&(w.minY=v,b=!0),m>w.maxX&&(w.maxX=m,b=!0),y>w.maxY&&(w.maxY=y,b=!0),b){var E=w.minX+(w.maxX-w.minX)/2,C=w.minY+(w.maxY-w.minY)/2,N=w.maxX-w.minX,_=w.maxY-w.minY;h.moveTo(E,C),h.width=N,h.height=_}}}}},this.onGraphRendered=function(e){var t=e.data;Eu(t.nodes,(function(e){e.children&&Eu(e.children,(function(t){i.nodeGroupMap.set(t,e.id)}))})),i.calibrateTopGroupZIndex(t.nodes)},t.register(iv),this.lf=t,uo(this,n),this.init()}return e.prototype.getGroupByNodeId=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},e.prototype.getGroupByBounds=function(e,t){var n=zu(this.lf.graphModel.nodes,(function(n){return!!n.isGroup&&function(e,t){var n=e.minX,i=e.minY,o=e.maxX,r=e.maxY,a=t.x,s=t.y,l=t.width,u=t.height;return n>=a-l/2&&o<=a+l/2&&i>=s-u/2&&r<=s+u/2}(e,n)&&n.id!==t.id})),i=n.length;if(i<=1)return n[0];for(var o=n[i-1],r=i-2;r>=0;r--)n[r].zIndex>o.zIndex&&(o=n[r]);return o},e.prototype.sendNodeToFront=function(e){var t=this;if(e&&e.isGroup&&(this.topGroupZIndex++,e.setZIndex(this.topGroupZIndex),e.children)){var n=e.children;Eu(Array.from(n),(function(e){var n=t.lf.getNodeModelById(e);t.sendNodeToFront(n)}))}},e.prototype.getMaxZIndex=function(e){var t=this,n=ov;if(e.isGroup&&(n=Math.max(n,e.zIndex)),e.children){var i=e.children;Eu(Array.from(i),(function(e){var i=t.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var o=t.getMaxZIndex(i);n=Math.max(n,o)}}))}return n},e.prototype.calibrateTopGroupZIndex=function(e){var t=this,n=ov;if(Eu(e,(function(e){var i=t.lf.getNodeModelById(e.id);if(i){var o=t.getMaxZIndex(i);o>n&&(n=o)}})),!(this.topGroupZIndex>=n)){var i=zu(this.lf.graphModel.nodes,(function(e){return!!e.isGroup})),o=this.topGroupZIndex;Eu(i,(function(e){e.zIndex>o&&(o=e.zIndex)})),this.topGroupZIndex=o}},e.prototype.removeChildrenInGroupNodeData=function(e){var t,n=js(e);return delete n.children,(null===(t=n.properties)||void 0===t?void 0:t.children)&&delete n.properties.children,n},e.prototype.initGroupChildNodes=function(e,n,i,o){var r=this,a=[],s=[],l=[];Eu(Array.from(n),(function(n){var u=r.lf.getNodeModelById(n);if(u){var c=u.children,d=u.getData(),h=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",f=t.transformNodeData(r.removeChildrenInGroupNodeData(d),o),p=r.lf.addNode(f,h);if(i.addChild(p.id),e[n]=p.id,a.push(p),l.push.apply(l,E([],w(E(E([],w(p.incoming.edges),!1),w(p.outgoing.edges),!1)),!1)),c instanceof Set){var g=r.initGroupChildNodes(e,c,p,o),v=g.childNodes,m=g.edgesData;a.push.apply(a,E([],w(v),!1)),s.push.apply(s,E([],w(m),!1))}}}));var u=ec(zu(l,(function(t){return vc(e,t.sourceNodeId)&&vc(e,t.targetNodeId)})),(function(e){return e.getData()}));return{childNodes:a,edgesData:s.concat(u)}},e.prototype.createEdge=function(e,n,i){var o,r,a=e.sourceNodeId,s=e.targetNodeId,l=null!==(o=n[a])&&void 0!==o?o:a,u=null!==(r=n[s])&&void 0!==r?r:s,c=js(e);return e.id&&"object"==typeof e.text&&null!==e.text&&(c=t.transformEdgeData(e,i)),this.lf.graphModel.addEdge(g(g({},c),{sourceNodeId:l,targetNodeId:u}))},e.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,o){if(e.children)for(var r=e.children,a=e.x+t/2,s=e.y+n/2,l=a-i/2,u=s-o/2,c=a+i/2,d=s+o/2,h=Array.from(r),f=0;f<h.length;f++){var p=h[f],g=this.lf.getNodeModelById(p);if(g){var v=g.getBounds(),m=v.minX,y=v.minY,b=v.maxX,x=v.maxY;if(!(l<=m&&u<=y&&c>=b&&d>=x))return!1}}return!0},e.prototype.init=function(){var e=this,t=this.lf,n=t.graphModel;n.addNodeMoveRules((function(t,n,i){if(t.isGroup)return!0;var o=e.nodeGroupMap.get(t.id),r=e.lf.getNodeModelById(o);return!r||!r.isRestrict||(!!r.autoResize||function(e,t,n,i){var o=e.minX,r=e.minY,a=e.maxX,s=e.maxY,l=t.x,u=t.y,c=t.width,d=t.height;return{x:l+n>=o+c/2&&l+n<=a-c/2,y:u+i>=r+d/2&&u+i<=s-d/2}}(r.getBounds(),t,n,i))})),n.addNodeResizeRules((function(t,n,i,o,r){return!t.isGroup||!t.isRestrict||e.checkGroupBoundsWithChildren(t,n,i,o,r)})),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(n,i){var o=n.nodes,r=n.edges;void 0===i&&(i=40);var a={},s={nodes:[],edges:[]},l=[];return Eu(o,(function(n){var o,r,u=n.id,c=null!==(r=null===(o=n.properties)||void 0===o?void 0:o.children)&&void 0!==r?r:n.children,d=t.addNode(e.removeChildrenInGroupNodeData(n));if(u&&(a[u]=d.id),s.nodes.push(d),d.isGroup){var h=e.initGroupChildNodes(a,c,d,i).edgesData;l.push.apply(l,E([],w(h),!1))}})),Eu(l,(function(t){e.createEdge(t,a,i)})),Eu(r,(function(t){s.edges.push(e.createEdge(t,a,i))})),s},this.render()},e.prototype.render=function(){},e.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)},e.pluginName="dynamicGroup",e}();!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(nv||(nv={}));var av=function(e,t,n,i){return void 0===i&&(i=0),uv(e,t,n)<=i};function sv(e){return e*e}function lv(e,t){return sv(e.x-t.x)+sv(e.y-t.y)}var uv=function(e,t,n){return Math.sqrt(function(e,t,n){var i=lv(t,n);if(0===i)return lv(e,t);var o=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/i;return o=Math.max(0,Math.min(1,o)),lv(e,{x:t.x+o*(n.x-t.x),y:t.y+o*(n.y-t.y)})}(e,t,n))},cv=function(e,t,n){var i=function(e){var t=e.x,n=e.y,i=e.width,o=e.height;return{minX:t-i/2,minY:n-o/2,maxX:t+i/2,maxY:n+o/2,x:t,y:n,width:i,height:o,centerX:t,centerY:n}}(e),o=function(e,t){var n;return e.x===t.x?n=nv.VERTICAL:e.y===t.y&&(n=nv.HORIZONTAL),n}(t,n),r=Math.max(t.x,n.x),a=Math.min(t.x,n.x),s=Math.max(t.y,n.y),l=Math.min(t.y,n.y),u=e.x,c=e.y,d=e.width,h=e.height;if(o===nv.HORIZONTAL){if(r>=i.maxX&&a<=i.minX)return{startCrossPoint:{x:t.x>n.x?u+d/2:u-d/2,y:t.y},endCrossPoint:{x:t.x>n.x?u-d/2:u+d/2,y:t.y}}}else if(o===nv.VERTICAL&&s>=i.maxY&&l<=i.minY)return{startCrossPoint:{x:t.x,y:t.y>n.y?c+h/2:c-h/2},endCrossPoint:{x:t.x,y:t.y>n.y?c-h/2:c+h/2}}},dv=function(e,t,n){void 0===n&&(n=0);for(var i=e.x,o=e.y,r=t.pointsList,a=0;a<r.length-1;a++)if(av({x:i,y:o},r[a],r[a+1],n)){var s=cv(e,r[a],r[a+1]);if(s)return{crossIndex:a+1,crossPoints:s}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},hv=function(){function e(e){var t=e.lf;this._lf=t,this.deviation=20,this.dndAdd=!0,this.dropAdd=!0,this.eventHandler()}return e.prototype.eventHandler=function(){var e=this;this.dndAdd&&this._lf.on("node:dnd-add",(function(t){var n=t.data;e.insetNode(n)})),this.dropAdd&&this._lf.on("node:drop",(function(t){for(var n=t.data,i=e._lf.graphModel.edges,o=n.id,r=!0,a=0;a<i.length;a++)if(i[a].sourceNodeId===o||i[a].targetNodeId===o){r=!1;break}r&&e.insetNode(n)}))},e.prototype.checkRuleBeforeInsetNode=function(e,n,i,o,r){var a=this._lf.getNodeModelById(e),s=this._lf.getNodeModelById(n),l=a.getAnchorInfo(i),u=s.getAnchorInfo(o),c=a.isAllowConnectedAsSource(r,l,u),d=s.isAllowConnectedAsTarget(r,l,u),h=t.formatAnchorConnectValidateData(c),f=h.isAllPass,p=h.msg,g=t.formatAnchorConnectValidateData(d),v=g.isAllPass;return{isPass:f&&v,sourceMsg:p,targetMsg:g.msg}},e.prototype.insetNode=function(e){var n=this,i=this._lf.graphModel.edges,o=this._lf.getNodeModelById(e.id),r=null==o?void 0:o.getDefaultAnchor();if(!r||0===r.length)this._lf.graphModel.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:e,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(o)for(var a=0;a<i.length;a++){var s=dv(o,i[a],this.deviation),l=s.crossIndex,u=s.crossPoints;if(l>=0){var c=i[a],d=c.sourceNodeId,h=c.targetNodeId,f=c.id,p=c.type,g=c.pointsList,v=c.sourceAnchorId,m=c.targetAnchorId,y=js(g[0]),b=js(u.startCrossPoint);this._lf.deleteEdge(f);var x=this.checkRuleBeforeInsetNode(d,h,v,m,e);if(this._lf.addEdge({type:p,sourceNodeId:d,targetNodeId:e.id,startPoint:y,endPoint:b,pointsList:E(E([],w(g.slice(0,l)),!1),[u.startCrossPoint],!1)}),this._lf.addEdge({type:p,sourceNodeId:e.id,targetNodeId:h,startPoint:js(u.endCrossPoint),endPoint:js(g[g.length-1]),pointsList:E([u.endCrossPoint],w(g.slice(l)),!1)}),x.isPass)break;this._lf.graphModel.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:e,msg:x.targetMsg||x.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},e.pluginName="insertNodeInPolyline",e}(),fv="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},pv={};!function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,i(n)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var i="";for(var r in e)t.call(e,r)&&e[r]&&(i=o(i,r));return i}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}({get exports(){return pv},set exports(e){pv=e}});var gv=pv,vv=function(e){function n(n){var i=e.call(this,n)||this;i.textRef=t.createRef(),i.setHoverOn=function(){var e=i.props.element;e.isDragging||i.state.isHovered||(i.setState({isHovered:!0}),e.setHovered(!0))},i.setHoverOff=function(){var e=i.props.element;i.state.isHovered&&(i.setState({isHovered:!1}),e.setHovered(!1))},i.handleMouseDown=function(e){var t,n=i.props,o=n.label,r=n.graphModel.editConfigModel.nodeTextDraggable;!(null!==(t=o.draggable)&&void 0!==t?t:r)||i.state.isDragging||i.state.isEditing||i.stepDrag.handleMouseDown(e)},i.handleMouseUp=function(e){i.state.isDragging&&i.stepDrag.handleMouseUp(e)},i.handleDragging=function(e){var t=e.deltaX,n=e.deltaY;i.state.isDragging||i.setState({isDragging:!0});var o=i.props,r=o.label,a=o.graphModel,s=w(a.transformModel.fixDeltaXY(t,n),2),l=s[0],u=s[1];i.setElementModelLabelInfo({x:r.x+l,y:r.y+u}),a.eventCenter.emit("label:drag",{data:r.getData(),model:r})},i.handleDragEnd=function(){i.setState({isDragging:!1})},i.handleClick=function(e){var t=i.props,n=t.label,o=t.element,r=t.graphModel;o.setSelected(!i.state.isSelected),i.setState({isSelected:!i.state.isSelected}),i.setElementModelLabelInfo({isSelected:!0}),r.eventCenter.emit("label:click",{data:n.getData(),e:e,model:o})},i.handleDbClick=function(e){var n=i.props,o=n.label,r=n.element;if(n.graphModel.eventCenter.emit("label:dblclick",{data:o.getData(),e:e,model:r}),o.editable){if(r.setSelected(),r.setElementState(t.ElementState.TEXT_EDIT),i.setState({isEditing:!0}),i.textRef.current){i.textRef.current.contentEditable="true",i.textRef.current.focus();var a=document.createRange(),s=window.getSelection();a.selectNodeContents(i.textRef.current),a.collapse(!1),null==s||s.removeAllRanges(),null==s||s.addRange(a)}}else r.setSelected(!0)},i.handleBlur=function(e){var t=i.props,n=t.label,o=t.element;t.graphModel.eventCenter.emit("label:blur",{e:e,model:o,data:n.getData(),element:i.textRef.current}),i.setState({isDragging:!1,isHovered:!1,isSelected:!1})},i.handleInput=function(e){var t=i.props,n=t.label;t.graphModel.eventCenter.emit("label:input",{e:e,data:n.getData()})},i.reCalcLabelSize=function(){};var o=n.label,r=n.graphModel,a=r.gridSize,s=r.eventCenter;return i.stepDrag=new t.StepDrag({onDragging:i.handleDragging,onDragEnd:i.handleDragEnd,step:a,eventType:"LABEL",model:o,eventCenter:s}),i.state={isEditing:!1,isHovered:!1,isDragging:!1,isSelected:!1},i}return p(n,e),n.prototype.setElementModelLabelInfo=function(e){var t=this.props,n=t.label,i=t.element,o=t.graphModel,r=i.properties._label,a=qu(r,(function(e){return e.id===n.id})),s=r[a];r[a]=g(g({},s),e);var l=o.getElement(i.id);null==l||l.setProperty("_label",r)},n.prototype.componentDidMount=function(){var e=this,n=this.props,i=n.label,o=n.element;n.graphModel.eventCenter.on("blank:click,node:click,edge:click,label:click",(function(n){var r,a,s,l,u=n.data;if(("label"!==(null==u?void 0:u.type)||"label"===u.type&&u.id!==i.id||e.state.isSelected)&&e.setState({isSelected:!1}),("label"!==(null==u?void 0:u.type)||"label"==u.type&&u.id!==i.id)&&e.state.isEditing){e.setState({isEditing:!1});var c=null!==(a=null===(r=e.textRef.current)||void 0===r?void 0:r.innerText)&&void 0!==a?a:"",d=null!==(l=null===(s=e.textRef.current)||void 0===s?void 0:s.innerHTML)&&void 0!==l?l:"";e.setElementModelLabelInfo({value:c,content:d,isSelected:!1}),o.setElementState(t.ElementState.DEFAULT)}("label"!==(null==u?void 0:u.type)||"label"==u.type&&u.id!==i.id)&&e.textRef.current&&(e.textRef.current.contentEditable="false")}))},n.prototype.componentDidUpdate=function(){},n.prototype.componentWillUnmount=function(){this.props.graphModel.eventCenter.off("blank:click,node:click,edge:click")},n.prototype.render=function(){var e,t=this.props,n=t.label,i=t.element,o=t.graphModel,r=this.state,a=r.isDragging,s=r.isHovered,l=r.isSelected,u=r.isEditing,c=o.transformModel.getTransformStyle().transform,d=n.id,h=n.x,f=n.y,p=n.zIndex,v=n.vertical,m=n.style,y=n.rotate,b=n.content,x=n.labelWidth,w=n.textOverflowMode,E=null!=x?x:"node"===i.BaseType?i.width-20:80,C={left:"".concat(h-E/2,"px"),top:"".concat(f-10,"px"),width:"".concat(E,"px"),height:"20px",zIndex:null!=p?p:1,transform:y?"".concat(c," rotate(").concat(y,"deg)"):"".concat(c," rotate(").concat(v?-.25:0,"turn)")};return Pp("div",{id:"element-container-".concat(d),className:gv("lf-label-editor-container"),style:C,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:Pp("div",{ref:this.textRef,id:"editor-container-".concat(d),className:gv("lf-label-editor",(e={"lf-label-editor-dragging":a,"lf-label-editor-editing":u,"lf-label-editor-hover":!u&&(s||l)},e["lf-label-editor-".concat(w)]=!u,e)),onInput:this.handleInput,style:g({maxWidth:"".concat(E,"px"),boxSizing:"border-box",display:"inline-block",background:u||"edge"===i.BaseType?"#fff":"transparent"},m),dangerouslySetInnerHTML:{__html:b}})})},n=m([t.observer],n)}(t.Component),mv=t.LogicFlowUtil.createUuid,yv=function(){function e(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=null!==(i=e.id)&&void 0!==i?i:mv(),this.initLabelData(e)}return e.prototype.initLabelData=function(e){uo(this,e)},e.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:t.toJS(this.style),draggable:this.draggable,editable:this.editable,labelWidth:this.labelWidth,textOverflowMode:this.textOverflowMode,vertical:this.vertical}},m([t.observable],e.prototype,"x",void 0),m([t.observable],e.prototype,"y",void 0),m([t.observable],e.prototype,"content",void 0),m([t.observable],e.prototype,"value",void 0),m([t.observable],e.prototype,"rotate",void 0),m([t.observable],e.prototype,"style",void 0),m([t.observable],e.prototype,"zIndex",void 0),m([t.observable],e.prototype,"vertical",void 0),m([t.observable],e.prototype,"editable",void 0),m([t.observable],e.prototype,"draggable",void 0),m([t.observable],e.prototype,"labelWidth",void 0),m([t.observable],e.prototype,"textOverflowMode",void 0),e}(),bv={};!function(e){"classList"in document.createElement("_")||function(e){if("Element"in e){var t="classList",n="prototype",i=e.Element[n],o=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},a=Array[n].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},s=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},l=function(e,t){if(""===t)throw new s("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new s("INVALID_CHARACTER_ERR","String contains an invalid character");return a.call(e,t)},u=function(e){for(var t=r.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],i=0,o=n.length;i<o;i++)this.push(n[i]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},c=u[n]=[],d=function(){return new u(this)};if(s[n]=Error[n],c.item=function(e){return this[e]||null},c.contains=function(e){return-1!==l(this,e+="")},c.add=function(){var e,t=arguments,n=0,i=t.length,o=!1;do{-1===l(this,e=t[n]+"")&&(this.push(e),o=!0)}while(++n<i);o&&this._updateClassName()},c.remove=function(){var e,t,n=arguments,i=0,o=n.length,r=!1;do{for(t=l(this,e=n[i]+"");-1!==t;)this.splice(t,1),r=!0,t=l(this,e)}while(++i<o);r&&this._updateClassName()},c.toggle=function(e,t){e+="";var n=this.contains(e),i=n?!0!==t&&"remove":!1!==t&&"add";return i&&this[i](e),!0===t||!1===t?t:!n},c.toString=function(){return this.join(" ")},o.defineProperty){var h={get:d,enumerable:!0,configurable:!0};try{o.defineProperty(i,t,h)}catch(e){-2146823252===e.number&&(h.enumerable=!1,o.defineProperty(i,t,h))}}else o[n].__defineGetter__&&i.__defineGetter__(t,d)}}(self),function(e){if(e.URL=e.URL||e.webkitURL,e.Blob&&e.URL)try{return void new Blob}catch(e){}var t=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||function(e){var t=function(e){return Object.prototype.toString.call(e).match(/^\[object\s(.*)\]$/)[1]},n=function(){this.data=[]},i=function(e,t,n){this.data=e,this.size=e.length,this.type=t,this.encoding=n},o=n.prototype,r=i.prototype,a=e.FileReaderSync,s=function(e){this.code=this[this.name=e]},l="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),u=l.length,c=e.URL||e.webkitURL||e,d=c.createObjectURL,h=c.revokeObjectURL,f=c,p=e.btoa,g=e.atob,v=e.ArrayBuffer,m=e.Uint8Array,y=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(i.fake=r.fake=!0;u--;)s.prototype[l[u]]=u+1;return c.createObjectURL||(f=e.URL=function(e){var t,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");return n.href=e,"origin"in n||("data:"===n.protocol.toLowerCase()?n.origin=null:(t=e.match(y),n.origin=t&&t[1])),n}),f.createObjectURL=function(e){var t,n=e.type;return null===n&&(n="application/octet-stream"),e instanceof i?(t="data:"+n,"base64"===e.encoding?t+";base64,"+e.data:"URI"===e.encoding?t+","+decodeURIComponent(e.data):p?t+";base64,"+p(e.data):t+","+encodeURIComponent(e.data)):d?d.call(c,e):void 0},f.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&h&&h.call(c,e)},o.append=function(e){var n=this.data;if(m&&(e instanceof v||e instanceof m)){for(var o="",r=new m(e),l=0,u=r.length;l<u;l++)o+=String.fromCharCode(r[l]);n.push(o)}else if("Blob"===t(e)||"File"===t(e)){if(!a)throw new s("NOT_READABLE_ERR");var c=new a;n.push(c.readAsBinaryString(e))}else e instanceof i?"base64"===e.encoding&&g?n.push(g(e.data)):"URI"===e.encoding?n.push(decodeURIComponent(e.data)):"raw"===e.encoding&&n.push(e.data):("string"!=typeof e&&(e+=""),n.push(unescape(encodeURIComponent(e))))},o.getBlob=function(e){return arguments.length||(e=null),new i(this.data.join(""),e,"raw")},o.toString=function(){return"[object BlobBuilder]"},r.slice=function(e,t,n){var o=arguments.length;return o<3&&(n=null),new i(this.data.slice(e,o>1?t:this.data.length),n,this.encoding)},r.toString=function(){return"[object Blob]"},r.close=function(){this.size=0,delete this.data},n}(e);e.Blob=function(e,n){var i=n&&n.type||"",o=new t;if(e)for(var r=0,a=e.length;r<a;r++)Uint8Array&&e[r]instanceof Uint8Array?o.append(e[r].buffer):o.append(e[r]);var s=o.getBlob(i);return!s.slice&&s.webkitSlice&&(s.slice=s.webkitSlice),s};var n=Object.getPrototypeOf||function(e){return e.__proto__};e.Blob.prototype=n(new e.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||fv.content||fv),function(t,n){"undefined"!=typeof process&&process&&process.versions&&process.versions.electron?t.MediumEditor=n:e.exports=n}(fv,function(){function e(e,t){return this.init(e,t)}var t,n,i,o,r,a,s,l,u,c,d;return e.extensions={},function(t){function n(e,t){var n,i=Array.prototype.slice.call(arguments,2);t=t||{};for(var o=0;o<i.length;o++){var r=i[o];if(r)for(n in r)r.hasOwnProperty(n)&&void 0!==r[n]&&(e||!1===t.hasOwnProperty(n))&&(t[n]=r[n])}return t}var i=!1;try{var o=document.createElement("div"),r=document.createTextNode(" ");o.appendChild(r),i=o.contains(r)}catch(e){}var a={isIE:"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent),isEdge:null!==/Edge\/\d+/.exec(navigator.userAgent),isFF:navigator.userAgent.toLowerCase().indexOf("firefox")>-1,isMac:t.navigator.platform.toUpperCase().indexOf("MAC")>=0,keyCode:{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DELETE:46,K:75,M:77,V:86},isMetaCtrlKey:function(e){return!!(a.isMac&&e.metaKey||!a.isMac&&e.ctrlKey)},isKey:function(e,t){var n=a.getKeyCode(e);return!1===Array.isArray(t)?n===t:-1!==t.indexOf(n)},getKeyCode:function(e){var t=e.which;return null===t&&(t=null!==e.charCode?e.charCode:e.keyCode),t},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 e=[!0].concat(Array.prototype.slice.call(arguments));return n.apply(this,e)},defaults:function(){var e=[!1].concat(Array.prototype.slice.call(arguments));return n.apply(this,e)},createLink:function(e,t,n,i){var o=e.createElement("a");return a.moveTextRangeIntoElement(t[0],t[t.length-1],o),o.setAttribute("href",n),i&&("_blank"===i&&o.setAttribute("rel","noopener noreferrer"),o.setAttribute("target",i)),o},findOrCreateMatchingTextNodes:function(e,t,n){for(var i=e.createTreeWalker(t,NodeFilter.SHOW_ALL,null,!1),o=[],r=0,s=!1,l=null,u=null;null!==(l=i.nextNode());)if(!(l.nodeType>3))if(3===l.nodeType){if(!s&&n.start<r+l.nodeValue.length&&(s=!0,u=a.splitStartNodeIfNeeded(l,n.start,r)),s&&a.splitEndNodeIfNeeded(l,u,n.end,r),s&&r===n.end)break;if(s&&r>n.end+1)throw new Error("PerformLinking overshot the target!");s&&o.push(u||l),r+=l.nodeValue.length,null!==u&&(r+=u.nodeValue.length,i.nextNode()),u=null}else"img"===l.tagName.toLowerCase()&&(!s&&n.start<=r&&(s=!0),s&&o.push(l));return o},splitStartNodeIfNeeded:function(e,t,n){return t!==n?e.splitText(t-n):null},splitEndNodeIfNeeded:function(e,t,n,i){var o,r;o=i+e.nodeValue.length+(t?t.nodeValue.length:0)-1,r=n-i-(t?e.nodeValue.length:0),o>=n&&i!==o&&0!==r&&(t||e).splitText(r)},splitByBlockElements:function(t){if(3!==t.nodeType&&1!==t.nodeType)return[];var n=[],i=e.util.blockContainerElementNames.join(",");if(3===t.nodeType||0===t.querySelectorAll(i).length)return[t];for(var o=0;o<t.childNodes.length;o++){var r=t.childNodes[o];if(3===r.nodeType)n.push(r);else if(1===r.nodeType){0===r.querySelectorAll(i).length?n.push(r):n=n.concat(e.util.splitByBlockElements(r))}}return n},findAdjacentTextNodeWithContent:function(e,t,n){var i,o=!1,r=n.createNodeIterator(e,NodeFilter.SHOW_TEXT,null,!1);for(i=r.nextNode();i;){if(i===t)o=!0;else if(o&&3===i.nodeType&&i.nodeValue&&i.nodeValue.trim().length>0)break;i=r.nextNode()}return i},findPreviousSibling:function(e){if(!e||a.isMediumEditorElement(e))return!1;for(var t=e.previousSibling;!t&&!a.isMediumEditorElement(e.parentNode);)t=(e=e.parentNode).previousSibling;return t},isDescendant:function(e,t,n){if(!e||!t)return!1;if(e===t)return!!n;if(1!==e.nodeType)return!1;if(i||3!==t.nodeType)return e.contains(t);for(var o=t.parentNode;null!==o;){if(o===e)return!0;o=o.parentNode}return!1},isElement:function(e){return!(!e||1!==e.nodeType)},throttle:function(e,t){var n,i,o,r=null,a=0,s=function(){a=Date.now(),r=null,o=e.apply(n,i),r||(n=i=null)};return t||0===t||(t=50),function(){var l=Date.now(),u=t-(l-a);return n=this,i=arguments,u<=0||u>t?(r&&(clearTimeout(r),r=null),a=l,o=e.apply(n,i),r||(n=i=null)):r||(r=setTimeout(s,u)),o}},traverseUp:function(e,t){if(!e)return!1;do{if(1===e.nodeType){if(t(e))return e;if(a.isMediumEditorElement(e))return!1}e=e.parentNode}while(e);return!1},htmlEntities:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},insertHTMLCommand:function(t,n){var i,o,r,s,l,u,c,d=!1,h=["insertHTML",!1,n];if(!e.util.isEdge&&t.queryCommandSupported("insertHTML"))try{return t.execCommand.apply(t,h)}catch(e){}if((i=t.getSelection()).rangeCount){if(c=(o=i.getRangeAt(0)).commonAncestorContainer,a.isMediumEditorElement(c)&&!c.firstChild)o.selectNode(c.appendChild(t.createTextNode("")));else if(3===c.nodeType&&0===o.startOffset&&o.endOffset===c.nodeValue.length||3!==c.nodeType&&c.innerHTML===o.toString()){for(;!a.isMediumEditorElement(c)&&c.parentNode&&1===c.parentNode.childNodes.length&&!a.isMediumEditorElement(c.parentNode);)c=c.parentNode;o.selectNode(c)}for(o.deleteContents(),(r=t.createElement("div")).innerHTML=n,s=t.createDocumentFragment();r.firstChild;)l=r.firstChild,u=s.appendChild(l);o.insertNode(s),u&&((o=o.cloneRange()).setStartAfter(u),o.collapse(!0),e.selection.selectRange(t,o)),d=!0}return t.execCommand.callListeners&&t.execCommand.callListeners(h,d),d},execFormatBlock:function(t,n){var i=a.getTopBlockContainer(e.selection.getSelectionStart(t));if("blockquote"===n){if(i&&Array.prototype.slice.call(i.childNodes).some((function(e){return a.isBlockContainer(e)})))return t.execCommand("outdent",!1,null);if(a.isIE)return t.execCommand("indent",!1,n)}if(i&&n===i.nodeName.toLowerCase()&&(n="p"),a.isIE&&(n="<"+n+">"),i&&"blockquote"===i.nodeName.toLowerCase()){if(a.isIE&&"<p>"===n)return t.execCommand("outdent",!1,n);if((a.isFF||a.isEdge)&&"p"===n)return Array.prototype.slice.call(i.childNodes).some((function(e){return!a.isBlockContainer(e)}))&&t.execCommand("formatBlock",!1,n),t.execCommand("outdent",!1,n)}return t.execCommand("formatBlock",!1,n)},setTargetBlank:function(e,t){var n,i=t||!1;if("a"===e.nodeName.toLowerCase())e.target="_blank",e.rel="noopener noreferrer";else for(e=e.getElementsByTagName("a"),n=0;n<e.length;n+=1)!1!==i&&i!==e[n].attributes.href.value||(e[n].target="_blank",e[n].rel="noopener noreferrer")},removeTargetBlank:function(e,t){var n;if("a"===e.nodeName.toLowerCase())e.removeAttribute("target"),e.removeAttribute("rel");else for(e=e.getElementsByTagName("a"),n=0;n<e.length;n+=1)t===e[n].attributes.href.value&&(e[n].removeAttribute("target"),e[n].removeAttribute("rel"))},addClassToAnchors:function(e,t){var n,i,o=t.split(" ");if("a"===e.nodeName.toLowerCase())for(i=0;i<o.length;i+=1)e.classList.add(o[i]);else{var r=e.getElementsByTagName("a");if(0===r.length){var s=a.getClosestTag(e,"a");e=s?[s]:[]}else e=r;for(n=0;n<e.length;n+=1)for(i=0;i<o.length;i+=1)e[n].classList.add(o[i])}},isListItem:function(e){if(!e)return!1;if("li"===e.nodeName.toLowerCase())return!0;for(var t=e.parentNode,n=t.nodeName.toLowerCase();"li"===n||!a.isBlockContainer(t)&&"div"!==n;){if("li"===n)return!0;if(!(t=t.parentNode))return!1;n=t.nodeName.toLowerCase()}return!1},cleanListDOM:function(t,n){if("li"===n.nodeName.toLowerCase()){var i=n.parentElement;"p"===i.parentElement.nodeName.toLowerCase()&&(a.unwrap(i.parentElement,t),e.selection.moveCursor(t,n.firstChild,n.firstChild.textContent.length))}},splitOffDOMTree:function(e,t,n){for(var i=t,o=null,r=!n;i!==e;){var a,s=i.parentNode,l=s.cloneNode(!1),u=r?i:s.firstChild;for(o&&(r?l.appendChild(o):a=o),o=l;u;){var c=u.nextSibling;u===i?(u.hasChildNodes()?u=u.cloneNode(!1):u.parentNode.removeChild(u),u.textContent&&o.appendChild(u),u=r?c:null):(u.parentNode.removeChild(u),(u.hasChildNodes()||u.textContent)&&o.appendChild(u),u=c)}a&&o.appendChild(a),i=s}return o},moveTextRangeIntoElement:function(e,t,n){if(!e||!t)return!1;var i=a.findCommonRoot(e,t);if(!i)return!1;if(t===e){var o=e.parentNode,r=e.nextSibling;return o.removeChild(e),n.appendChild(e),r?o.insertBefore(n,r):o.appendChild(n),n.hasChildNodes()}for(var s,l,u,c=[],d=0;d<i.childNodes.length;d++)if(u=i.childNodes[d],s){if(a.isDescendant(u,t,!0)){l=u;break}c.push(u)}else a.isDescendant(u,e,!0)&&(s=u);var h=l.nextSibling,f=i.ownerDocument.createDocumentFragment();return s===e?(s.parentNode.removeChild(s),f.appendChild(s)):f.appendChild(a.splitOffDOMTree(s,e)),c.forEach((function(e){e.parentNode.removeChild(e),f.appendChild(e)})),l===t?(l.parentNode.removeChild(l),f.appendChild(l)):f.appendChild(a.splitOffDOMTree(l,t,!0)),n.appendChild(f),l.parentNode===i?i.insertBefore(n,l):h?i.insertBefore(n,h):i.appendChild(n),n.hasChildNodes()},depthOfNode:function(e){for(var t=0,n=e;null!==n.parentNode;)n=n.parentNode,t++;return t},findCommonRoot:function(e,t){for(var n=a.depthOfNode(e),i=a.depthOfNode(t),o=e,r=t;n!==i;)n>i?(o=o.parentNode,n-=1):(r=r.parentNode,i-=1);for(;o!==r;)o=o.parentNode,r=r.parentNode;return o},isElementAtBeginningOfBlock:function(e){for(var t;!a.isBlockContainer(e)&&!a.isMediumEditorElement(e);){for(t=e;t=t.previousSibling;)if((3===t.nodeType?t.nodeValue:t.textContent).length>0)return!1;e=e.parentNode}return!0},isMediumEditorElement:function(e){return e&&e.getAttribute&&!!e.getAttribute("data-medium-editor-element")},getContainerEditorElement:function(e){return a.traverseUp(e,(function(e){return a.isMediumEditorElement(e)}))},isBlockContainer:function(e){return e&&3!==e.nodeType&&-1!==a.blockContainerElementNames.indexOf(e.nodeName.toLowerCase())},getClosestBlockContainer:function(e){return a.traverseUp(e,(function(e){return a.isBlockContainer(e)||a.isMediumEditorElement(e)}))},getTopBlockContainer:function(e){var t=!!a.isBlockContainer(e)&&e;return a.traverseUp(e,(function(e){return a.isBlockContainer(e)&&(t=e),!(t||!a.isMediumEditorElement(e))&&(t=e,!0)})),t},getFirstSelectableLeafNode:function(e){for(;e&&e.firstChild;)e=e.firstChild;if("table"===(e=a.traverseUp(e,(function(e){return-1===a.emptyElementNames.indexOf(e.nodeName.toLowerCase())}))).nodeName.toLowerCase()){var t=e.querySelector("th, td");t&&(e=t)}return e},getFirstTextNode:function(e){return a.warn("getFirstTextNode is deprecated and will be removed in version 6.0.0"),a._getFirstTextNode(e)},_getFirstTextNode:function(e){if(3===e.nodeType)return e;for(var t=0;t<e.childNodes.length;t++){var n=a._getFirstTextNode(e.childNodes[t]);if(null!==n)return n}return null},ensureUrlHasProtocol:function(e){return-1===e.indexOf("://")?"http://"+e:e},warn:function(){void 0!==t.console&&"function"==typeof t.console.warn&&t.console.warn.apply(t.console,arguments)},deprecated:function(e,t,n){var i=e+" is deprecated, please use "+t+" instead.";n&&(i+=" Will be removed in "+n),a.warn(i)},deprecatedMethod:function(e,t,n,i){a.deprecated(e,t,i),"function"==typeof this[t]&&this[t].apply(this,n)},cleanupAttrs:function(e,t){t.forEach((function(t){e.removeAttribute(t)}))},cleanupTags:function(e,t){-1!==t.indexOf(e.nodeName.toLowerCase())&&e.parentNode.removeChild(e)},unwrapTags:function(t,n){-1!==n.indexOf(t.nodeName.toLowerCase())&&e.util.unwrap(t,document)},getClosestTag:function(e,t){return a.traverseUp(e,(function(e){return e.nodeName.toLowerCase()===t.toLowerCase()}))},unwrap:function(e,t){for(var n=t.createDocumentFragment(),i=Array.prototype.slice.call(e.childNodes),o=0;o<i.length;o++)n.appendChild(i[o]);n.childNodes.length?e.parentNode.replaceChild(n,e):e.parentNode.removeChild(e)},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}};e.util=a}(window),(t=function(t){e.util.extend(this,t)}).extend=function(t){var n,i=this;n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},e.util.extend(n,i);var o=function(){this.constructor=n};return o.prototype=i.prototype,n.prototype=new o,t&&e.util.extend(n.prototype,t),n},t.prototype={init:function(){},base:void 0,name:void 0,checkState:void 0,destroy:void 0,queryCommandState:void 0,isActive:void 0,isAlreadyApplied:void 0,setActive:void 0,setInactive:void 0,getInteractionElements:void 0,window:void 0,document:void 0,getEditorElements:function(){return this.base.elements},getEditorId:function(){return this.base.id},getEditorOption:function(e){return this.base.options[e]}},["execAction","on","off","subscribe","trigger"].forEach((function(e){t.prototype[e]=function(){return this.base[e].apply(this.base,arguments)}})),e.Extension=t,function(){function t(t){return e.util.isBlockContainer(t)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}var n={findMatchingSelectionParent:function(t,n){var i,o=n.getSelection();return 0!==o.rangeCount&&(i=o.getRangeAt(0).commonAncestorContainer,e.util.traverseUp(i,t))},getSelectionElement:function(t){return this.findMatchingSelectionParent((function(t){return e.util.isMediumEditorElement(t)}),t)},exportSelection:function(e,t){if(!e)return null;var n=null,i=t.getSelection();if(i.rangeCount>0){var o,r=i.getRangeAt(0),a=r.cloneRange();a.selectNodeContents(e),a.setEnd(r.startContainer,r.startOffset),n={start:o=a.toString().length,end:o+r.toString().length},this.doesRangeStartWithImages(r,t)&&(n.startsWithImage=!0);var s=this.getTrailingImageCount(e,n,r.endContainer,r.endOffset);if(s&&(n.trailingImageCount=s),0!==o){var l=this.getIndexRelativeToAdjacentEmptyBlocks(t,e,r.startContainer,r.startOffset);-1!==l&&(n.emptyBlocksIndex=l)}}return n},importSelection:function(e,t,n,i){if(e&&t){var o=n.createRange();o.setStart(t,0),o.collapse(!0);var r,a=t,s=[],l=0,u=!1,c=!1,d=0,h=!1,f=!1,p=null;for((i||e.startsWithImage||void 0!==e.emptyBlocksIndex)&&(f=!0);!h&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||c){if(e.trailingImageCount&&c&&("img"===a.nodeName.toLowerCase()&&d++,d===e.trailingImageCount)){for(var g=0;a.parentNode.childNodes[g]!==a;)g++;o.setEnd(a.parentNode,g+1),h=!0}if(!h&&1===a.nodeType)for(var v=a.childNodes.length-1;v>=0;)s.push(a.childNodes[v]),v-=1}else r=l+a.length,!u&&e.start>=l&&e.start<=r&&(f||e.start<r?(o.setStart(a,e.start-l),u=!0):p=a),u&&e.end>=l&&e.end<=r&&(e.trailingImageCount?c=!0:(o.setEnd(a,e.end-l),h=!0)),l=r;h||(a=s.pop())}!u&&p&&(o.setStart(p,p.length),o.setEnd(p,p.length)),void 0!==e.emptyBlocksIndex&&(o=this.importSelectionMoveCursorPastBlocks(n,t,e.emptyBlocksIndex,o)),i&&(o=this.importSelectionMoveCursorPastAnchor(e,o)),this.selectRange(n,o)}},importSelectionMoveCursorPastAnchor:function(t,n){if(t.start===t.end&&3===n.startContainer.nodeType&&n.startOffset===n.startContainer.nodeValue.length&&e.util.traverseUp(n.startContainer,(function(e){return"a"===e.nodeName.toLowerCase()}))){for(var i=n.startContainer,o=n.startContainer.parentNode;null!==o&&"a"!==o.nodeName.toLowerCase();)o.childNodes[o.childNodes.length-1]!==i?o=null:(i=o,o=o.parentNode);if(null!==o&&"a"===o.nodeName.toLowerCase()){for(var r=null,a=0;null===r&&a<o.parentNode.childNodes.length;a++)o.parentNode.childNodes[a]===o&&(r=a);n.setStart(o.parentNode,r+1),n.collapse(!0)}}return n},importSelectionMoveCursorPastBlocks:function(n,i,o,r){var a,s,l=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),u=r.startContainer,c=0;for(o=o||1,a=3===u.nodeType&&e.util.isBlockContainer(u.previousSibling)?u.previousSibling:e.util.getClosestBlockContainer(u);l.nextNode();)if(s){if(s=l.currentNode,++c===o)break;if(s.textContent.length>0)break}else a===l.currentNode&&(s=l.currentNode);return s||(s=a),r.setStart(e.util.getFirstSelectableLeafNode(s),0),r},getIndexRelativeToAdjacentEmptyBlocks:function(n,i,o,r){if(o.textContent.length>0&&r>0)return-1;var a=o;if(3!==a.nodeType&&(a=o.childNodes[r]),a){if(!e.util.isElementAtBeginningOfBlock(a))return-1;var s=e.util.findPreviousSibling(a);if(!s)return-1;if(s.nodeValue)return-1}for(var l=e.util.getClosestBlockContainer(o),u=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),c=0;u.nextNode();){var d=""===u.currentNode.textContent;if((d||c>0)&&(c+=1),u.currentNode===l)return c;d||(c=0)}return c},doesRangeStartWithImages:function(e,t){if(0!==e.startOffset||1!==e.startContainer.nodeType)return!1;if("img"===e.startContainer.nodeName.toLowerCase())return!0;var n=e.startContainer.querySelector("img");if(!n)return!1;for(var i=t.createTreeWalker(e.startContainer,NodeFilter.SHOW_ALL,null,!1);i.nextNode();){var o=i.currentNode;if(o===n)break;if(o.nodeValue)return!1}return!0},getTrailingImageCount:function(e,t,n,i){if(0===i||1!==n.nodeType)return 0;if("img"!==n.nodeName.toLowerCase()&&!n.querySelector("img"))return 0;for(var o=n.childNodes[i-1];o.hasChildNodes();)o=o.lastChild;for(var r,a=e,s=[],l=0,u=!1,c=!1,d=!1,h=0;!d&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||c){if("img"===a.nodeName.toLowerCase()&&h++,a===o)d=!0;else if(1===a.nodeType)for(var f=a.childNodes.length-1;f>=0;)s.push(a.childNodes[f]),f-=1}else h=0,r=l+a.length,!u&&t.start>=l&&t.start<=r&&(u=!0),u&&t.end>=l&&t.end<=r&&(c=!0),l=r;d||(a=s.pop())}return h},selectionContainsContent:function(e){var t=e.getSelection();if(!t||t.isCollapsed||!t.rangeCount)return!1;if(""!==t.toString().trim())return!0;var n=this.getSelectedParentElement(t.getRangeAt(0));return!(!n||!("img"===n.nodeName.toLowerCase()||1===n.nodeType&&n.querySelector("img")))},selectionInContentEditableFalse:function(e){var t,n=this.findMatchingSelectionParent((function(e){var n=e&&e.getAttribute("contenteditable");return"true"===n&&(t=!0),"#text"!==e.nodeName&&"false"===n}),e);return!t&&n},getSelectionHtml:function(e){var t,n,i,o="",r=e.getSelection();if(r.rangeCount){for(i=e.createElement("div"),t=0,n=r.rangeCount;t<n;t+=1)i.appendChild(r.getRangeAt(t).cloneContents());o=i.innerHTML}return o},getCaretOffsets:function(e,t){var n,i;return t||(t=window.getSelection().getRangeAt(0)),n=t.cloneRange(),i=t.cloneRange(),n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset),i.selectNodeContents(e),i.setStart(t.endContainer,t.endOffset),{left:n.toString().length,right:i.toString().length}},rangeSelectsSingleNode:function(e){var t=e.startContainer;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===e.startOffset+1},getSelectedParentElement:function(e){return e?this.rangeSelectsSingleNode(e)&&3!==e.startContainer.childNodes[e.startOffset].nodeType?e.startContainer.childNodes[e.startOffset]:3===e.startContainer.nodeType?e.startContainer.parentNode:e.startContainer:null},getSelectedElements:function(e){var t,n,i,o=e.getSelection();if(!o.rangeCount||o.isCollapsed||!o.getRangeAt(0).commonAncestorContainer)return[];if(3===(t=o.getRangeAt(0)).commonAncestorContainer.nodeType){for(n=[],i=t.commonAncestorContainer;i.parentNode&&1===i.parentNode.childNodes.length;)n.push(i.parentNode),i=i.parentNode;return n}return[].filter.call(t.commonAncestorContainer.getElementsByTagName("*"),(function(e){return"function"!=typeof o.containsNode||o.containsNode(e,!0)}))},selectNode:function(e,t){var n=t.createRange();n.selectNodeContents(e),this.selectRange(t,n)},select:function(e,t,n,i,o){var r=e.createRange();return r.setStart(t,n),i?r.setEnd(i,o):r.collapse(!0),this.selectRange(e,r),r},clearSelection:function(e,t){t?e.getSelection().collapseToStart():e.getSelection().collapseToEnd()},moveCursor:function(e,t,n){this.select(e,t,n)},getSelectionRange:function(e){var t=e.getSelection();return 0===t.rangeCount?null:t.getRangeAt(0)},selectRange:function(e,t){var n=e.getSelection();n.removeAllRanges(),n.addRange(t)},getSelectionStart:function(e){var t=e.getSelection().anchorNode;return t&&3===t.nodeType?t.parentNode:t}};e.selection=n}(),function(){function t(t,n){return!!t&&t.some((function(t){if("function"!=typeof t.getInteractionElements)return!1;var i=t.getInteractionElements();return!!i&&(Array.isArray(i)||(i=[i]),i.some((function(t){return e.util.isDescendant(t,n,!0)})))}))}var n=function(e){this.base=e,this.options=this.base.options,this.events=[],this.disabledEvents={},this.customEvents={},this.listeners={}};n.prototype={InputEventOnContenteditableSupported:!e.util.isIE&&!e.util.isEdge,attachDOMEvent:function(t,n,i,o){var r=this.base.options.contentWindow,a=this.base.options.ownerDocument;t=e.util.isElement(t)||[r,a].indexOf(t)>-1?[t]:t,Array.prototype.forEach.call(t,function(e){e.addEventListener(n,i,o),this.events.push([e,n,i,o])}.bind(this))},detachDOMEvent:function(t,n,i,o){var r,a,s=this.base.options.contentWindow,l=this.base.options.ownerDocument;t&&(t=e.util.isElement(t)||[s,l].indexOf(t)>-1?[t]:t,Array.prototype.forEach.call(t,function(e){-1!==(r=this.indexOfListener(e,n,i,o))&&(a=this.events.splice(r,1)[0])[0].removeEventListener(a[1],a[2],a[3])}.bind(this)))},indexOfListener:function(e,t,n,i){var o,r,a;for(o=0,r=this.events.length;o<r;o+=1)if((a=this.events[o])[0]===e&&a[1]===t&&a[2]===n&&a[3]===i)return o;return-1},detachAllDOMEvents:function(){for(var e=this.events.pop();e;)e[0].removeEventListener(e[1],e[2],e[3]),e=this.events.pop()},detachAllEventsFromElement:function(e){for(var t=this.events.filter((function(t){return t&&t[0].getAttribute&&t[0].getAttribute("medium-editor-index")===e.getAttribute("medium-editor-index")})),n=0,i=t.length;n<i;n++){var o=t[n];this.detachDOMEvent(o[0],o[1],o[2],o[3])}},attachAllEventsToElement:function(e){this.listeners.editableInput&&(this.contentCache[e.getAttribute("medium-editor-index")]=e.innerHTML),this.eventsCache&&this.eventsCache.forEach((function(t){this.attachDOMEvent(e,t.name,t.handler.bind(this))}),this)},enableCustomEvent:function(e){void 0!==this.disabledEvents[e]&&delete this.disabledEvents[e]},disableCustomEvent:function(e){this.disabledEvents[e]=!0},attachCustomEvent:function(e,t){this.setupListener(e),this.customEvents[e]||(this.customEvents[e]=[]),this.customEvents[e].push(t)},detachCustomEvent:function(e,t){var n=this.indexOfCustomListener(e,t);-1!==n&&this.customEvents[e].splice(n,1)},indexOfCustomListener:function(e,t){return this.customEvents[e]&&this.customEvents[e].length?this.customEvents[e].indexOf(t):-1},detachAllCustomEvents:function(){this.customEvents={}},triggerCustomEvent:function(e,t,n){this.customEvents[e]&&!this.disabledEvents[e]&&this.customEvents[e].forEach((function(e){e(t,n)}))},destroy:function(){this.detachAllDOMEvents(),this.detachAllCustomEvents(),this.detachExecCommand(),this.base.elements&&this.base.elements.forEach((function(e){e.removeAttribute("data-medium-focused")}))},attachToExecCommand:function(){this.execCommandListener||(this.execCommandListener=function(e){this.handleDocumentExecCommand(e)}.bind(this),this.wrapExecCommand(),this.options.ownerDocument.execCommand.listeners.push(this.execCommandListener))},detachExecCommand:function(){var e=this.options.ownerDocument;if(this.execCommandListener&&e.execCommand.listeners){var t=e.execCommand.listeners.indexOf(this.execCommandListener);-1!==t&&e.execCommand.listeners.splice(t,1),e.execCommand.listeners.length||this.unwrapExecCommand()}},wrapExecCommand:function(){var e=this.options.ownerDocument;if(!e.execCommand.listeners){var t=function(t,n){e.execCommand.listeners&&e.execCommand.listeners.forEach((function(e){e({command:t[0],value:t[2],args:t,result:n})}))},n=function(){var n=e.execCommand.orig.apply(this,arguments);if(!e.execCommand.listeners)return n;var i=Array.prototype.slice.call(arguments);return t(i,n),n};n.orig=e.execCommand,n.listeners=[],n.callListeners=t,e.execCommand=n}},unwrapExecCommand:function(){var e=this.options.ownerDocument;e.execCommand.orig&&(e.execCommand=e.execCommand.orig)},setupListener:function(e){if(!this.listeners[e]){switch(e){case"externalInteraction":this.attachDOMEvent(this.options.ownerDocument.body,"mousedown",this.handleBodyMousedown.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"click",this.handleBodyClick.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"focus",this.handleBodyFocus.bind(this),!0);break;case"blur":case"focus":this.setupListener("externalInteraction");break;case"editableInput":this.contentCache={},this.base.elements.forEach((function(e){this.contentCache[e.getAttribute("medium-editor-index")]=e.innerHTML}),this),this.InputEventOnContenteditableSupported&&this.attachToEachElement("input",this.handleInput),this.InputEventOnContenteditableSupported||(this.setupListener("editableKeypress"),this.keypressUpdateInput=!0,this.attachDOMEvent(document,"selectionchange",this.handleDocumentSelectionChange.bind(this)),this.attachToExecCommand());break;case"editableClick":this.attachToEachElement("click",this.handleClick);break;case"editableBlur":this.attachToEachElement("blur",this.handleBlur);break;case"editableKeypress":this.attachToEachElement("keypress",this.handleKeypress);break;case"editableKeyup":this.attachToEachElement("keyup",this.handleKeyup);break;case"editableKeydown":this.attachToEachElement("keydown",this.handleKeydown);break;case"editableKeydownSpace":case"editableKeydownEnter":case"editableKeydownTab":case"editableKeydownDelete":this.setupListener("editableKeydown");break;case"editableMouseover":this.attachToEachElement("mouseover",this.handleMouseover);break;case"editableDrag":this.attachToEachElement("dragover",this.handleDragging),this.attachToEachElement("dragleave",this.handleDragging);break;case"editableDrop":this.attachToEachElement("drop",this.handleDrop);break;case"editablePaste":this.attachToEachElement("paste",this.handlePaste)}this.listeners[e]=!0}},attachToEachElement:function(e,t){this.eventsCache||(this.eventsCache=[]),this.base.elements.forEach((function(n){this.attachDOMEvent(n,e,t.bind(this))}),this),this.eventsCache.push({name:e,handler:t})},cleanupElement:function(e){var t=e.getAttribute("medium-editor-index");t&&(this.detachAllEventsFromElement(e),this.contentCache&&delete this.contentCache[t])},focusElement:function(e){e.focus(),this.updateFocus(e,{target:e,type:"focus"})},updateFocus:function(n,i){var o,r=this.base.getFocusedElement();r&&"click"===i.type&&this.lastMousedownTarget&&(e.util.isDescendant(r,this.lastMousedownTarget,!0)||t(this.base.extensions,this.lastMousedownTarget))&&(o=r),o||this.base.elements.some((function(t){return!o&&e.util.isDescendant(t,n,!0)&&(o=t),!!o}),this);var a=!e.util.isDescendant(r,n,!0)&&!t(this.base.extensions,n);o!==r&&(r&&a&&(r.removeAttribute("data-medium-focused"),this.triggerCustomEvent("blur",i,r)),o&&(o.setAttribute("data-medium-focused",!0),this.triggerCustomEvent("focus",i,o))),a&&this.triggerCustomEvent("externalInteraction",i)},updateInput:function(e,t){if(this.contentCache){var n=e.getAttribute("medium-editor-index"),i=e.innerHTML;i!==this.contentCache[n]&&this.triggerCustomEvent("editableInput",t,e),this.contentCache[n]=i}},handleDocumentSelectionChange:function(t){if(t.currentTarget&&t.currentTarget.activeElement){var n,i=t.currentTarget.activeElement;this.base.elements.some((function(t){return!!e.util.isDescendant(t,i,!0)&&(n=t,!0)}),this),n&&this.updateInput(n,{target:i,currentTarget:n})}},handleDocumentExecCommand:function(){var e=this.base.getFocusedElement();e&&this.updateInput(e,{target:e,currentTarget:e})},handleBodyClick:function(e){this.updateFocus(e.target,e)},handleBodyFocus:function(e){this.updateFocus(e.target,e)},handleBodyMousedown:function(e){this.lastMousedownTarget=e.target},handleInput:function(e){this.updateInput(e.currentTarget,e)},handleClick:function(e){this.triggerCustomEvent("editableClick",e,e.currentTarget)},handleBlur:function(e){this.triggerCustomEvent("editableBlur",e,e.currentTarget)},handleKeypress:function(e){if(this.triggerCustomEvent("editableKeypress",e,e.currentTarget),this.keypressUpdateInput){var t={target:e.target,currentTarget:e.currentTarget};setTimeout(function(){this.updateInput(t.currentTarget,t)}.bind(this),0)}},handleKeyup:function(e){this.triggerCustomEvent("editableKeyup",e,e.currentTarget)},handleMouseover:function(e){this.triggerCustomEvent("editableMouseover",e,e.currentTarget)},handleDragging:function(e){this.triggerCustomEvent("editableDrag",e,e.currentTarget)},handleDrop:function(e){this.triggerCustomEvent("editableDrop",e,e.currentTarget)},handlePaste:function(e){this.triggerCustomEvent("editablePaste",e,e.currentTarget)},handleKeydown:function(t){return this.triggerCustomEvent("editableKeydown",t,t.currentTarget),e.util.isKey(t,e.util.keyCode.SPACE)?this.triggerCustomEvent("editableKeydownSpace",t,t.currentTarget):e.util.isKey(t,e.util.keyCode.ENTER)||t.ctrlKey&&e.util.isKey(t,e.util.keyCode.M)?this.triggerCustomEvent("editableKeydownEnter",t,t.currentTarget):e.util.isKey(t,e.util.keyCode.TAB)?this.triggerCustomEvent("editableKeydownTab",t,t.currentTarget):e.util.isKey(t,[e.util.keyCode.DELETE,e.util.keyCode.BACKSPACE])?this.triggerCustomEvent("editableKeydownDelete",t,t.currentTarget):void 0}},e.Events=n}(),n=e.Extension.extend({action:void 0,aria:void 0,tagNames:void 0,style:void 0,useQueryState:void 0,contentDefault:void 0,contentFA:void 0,classList:void 0,attrs:void 0,constructor:function(t){n.isBuiltInButton(t)?e.Extension.call(this,this.defaults[t]):e.Extension.call(this,t)},init:function(){e.Extension.prototype.init.apply(this,arguments),this.button=this.createButton(),this.on(this.button,"click",this.handleClick.bind(this))},getButton:function(){return this.button},getAction:function(){return"function"==typeof this.action?this.action(this.base.options):this.action},getAria:function(){return"function"==typeof this.aria?this.aria(this.base.options):this.aria},getTagNames:function(){return"function"==typeof this.tagNames?this.tagNames(this.base.options):this.tagNames},createButton:function(){var e=this.document.createElement("button"),t=this.contentDefault,n=this.getAria(),i=this.getEditorOption("buttonLabels");return e.classList.add("medium-editor-action"),e.classList.add("medium-editor-action-"+this.name),this.classList&&this.classList.forEach((function(t){e.classList.add(t)})),e.setAttribute("data-action",this.getAction()),n&&(e.setAttribute("title",n),e.setAttribute("aria-label",n)),this.attrs&&Object.keys(this.attrs).forEach((function(t){e.setAttribute(t,this.attrs[t])}),this),"fontawesome"===i&&this.contentFA&&(t=this.contentFA),e.innerHTML=t,e},handleClick:function(e){e.preventDefault(),e.stopPropagation();var t=this.getAction();t&&this.execAction(t)},isActive:function(){return this.button.classList.contains(this.getEditorOption("activeButtonClass"))},setInactive:function(){this.button.classList.remove(this.getEditorOption("activeButtonClass")),delete this.knownState},setActive:function(){this.button.classList.add(this.getEditorOption("activeButtonClass")),delete this.knownState},queryCommandState:function(){var e=null;return this.useQueryState&&(e=this.base.queryCommandState(this.getAction())),e},isAlreadyApplied:function(e){var t,n,i=!1,o=this.getTagNames();return!1===this.knownState||!0===this.knownState?this.knownState:(o&&o.length>0&&(i=-1!==o.indexOf(e.nodeName.toLowerCase())),!i&&this.style&&(t=this.style.value.split("|"),n=this.window.getComputedStyle(e,null).getPropertyValue(this.style.prop),t.forEach((function(e){this.knownState||((i=-1!==n.indexOf(e))||"text-decoration"!==this.style.prop)&&(this.knownState=i)}),this)),i)}}),n.isBuiltInButton=function(t){return"string"==typeof t&&e.extensions.button.prototype.defaults.hasOwnProperty(t)},e.extensions.button=n,e.extensions.button.prototype.defaults={bold:{name:"bold",action:"bold",aria:"bold",tagNames:["b","strong"],style:{prop:"font-weight",value:"700|bold"},useQueryState:!0,contentDefault:"<b>B</b>",contentFA:'<i class="fa fa-bold"></i>'},italic:{name:"italic",action:"italic",aria:"italic",tagNames:["i","em"],style:{prop:"font-style",value:"italic"},useQueryState:!0,contentDefault:"<b><i>I</i></b>",contentFA:'<i class="fa fa-italic"></i>'},underline:{name:"underline",action:"underline",aria:"underline",tagNames:["u"],style:{prop:"text-decoration",value:"underline"},useQueryState:!0,contentDefault:"<b><u>U</u></b>",contentFA:'<i class="fa fa-underline"></i>'},strikethrough:{name:"strikethrough",action:"strikethrough",aria:"strike through",tagNames:["strike"],style:{prop:"text-decoration",value:"line-through"},useQueryState:!0,contentDefault:"<s>A</s>",contentFA:'<i class="fa fa-strikethrough"></i>'},superscript:{name:"superscript",action:"superscript",aria:"superscript",tagNames:["sup"],contentDefault:"<b>x<sup>1</sup></b>",contentFA:'<i class="fa fa-superscript"></i>'},subscript:{name:"subscript",action:"subscript",aria:"subscript",tagNames:["sub"],contentDefault:"<b>x<sub>1</sub></b>",contentFA:'<i class="fa fa-subscript"></i>'},image:{name:"image",action:"image",aria:"image",tagNames:["img"],contentDefault:"<b>image</b>",contentFA:'<i class="fa fa-picture-o"></i>'},html:{name:"html",action:"html",aria:"evaluate html",tagNames:["iframe","object"],contentDefault:"<b>html</b>",contentFA:'<i class="fa fa-code"></i>'},orderedlist:{name:"orderedlist",action:"insertorderedlist",aria:"ordered list",tagNames:["ol"],useQueryState:!0,contentDefault:"<b>1.</b>",contentFA:'<i class="fa fa-list-ol"></i>'},unorderedlist:{name:"unorderedlist",action:"insertunorderedlist",aria:"unordered list",tagNames:["ul"],useQueryState:!0,contentDefault:"<b>&bull;</b>",contentFA:'<i class="fa fa-list-ul"></i>'},indent:{name:"indent",action:"indent",aria:"indent",tagNames:[],contentDefault:"<b>&rarr;</b>",contentFA:'<i class="fa fa-indent"></i>'},outdent:{name:"outdent",action:"outdent",aria:"outdent",tagNames:[],contentDefault:"<b>&larr;</b>",contentFA:'<i class="fa fa-outdent"></i>'},justifyCenter:{name:"justifyCenter",action:"justifyCenter",aria:"center justify",tagNames:[],style:{prop:"text-align",value:"center"},contentDefault:"<b>C</b>",contentFA:'<i class="fa fa-align-center"></i>'},justifyFull:{name:"justifyFull",action:"justifyFull",aria:"full justify",tagNames:[],style:{prop:"text-align",value:"justify"},contentDefault:"<b>J</b>",contentFA:'<i class="fa fa-align-justify"></i>'},justifyLeft:{name:"justifyLeft",action:"justifyLeft",aria:"left justify",tagNames:[],style:{prop:"text-align",value:"left"},contentDefault:"<b>L</b>",contentFA:'<i class="fa fa-align-left"></i>'},justifyRight:{name:"justifyRight",action:"justifyRight",aria:"right justify",tagNames:[],style:{prop:"text-align",value:"right"},contentDefault:"<b>R</b>",contentFA:'<i class="fa fa-align-right"></i>'},removeFormat:{name:"removeFormat",aria:"remove formatting",action:"removeFormat",contentDefault:"<b>X</b>",contentFA:'<i class="fa fa-eraser"></i>'},quote:{name:"quote",action:"append-blockquote",aria:"blockquote",tagNames:["blockquote"],contentDefault:"<b>&ldquo;</b>",contentFA:'<i class="fa fa-quote-right"></i>'},pre:{name:"pre",action:"append-pre",aria:"preformatted text",tagNames:["pre"],contentDefault:"<b>0101</b>",contentFA:'<i class="fa fa-code fa-lg"></i>'},h1:{name:"h1",action:"append-h1",aria:"header type one",tagNames:["h1"],contentDefault:"<b>H1</b>",contentFA:'<i class="fa fa-header"><sup>1</sup>'},h2:{name:"h2",action:"append-h2",aria:"header type two",tagNames:["h2"],contentDefault:"<b>H2</b>",contentFA:'<i class="fa fa-header"><sup>2</sup>'},h3:{name:"h3",action:"append-h3",aria:"header type three",tagNames:["h3"],contentDefault:"<b>H3</b>",contentFA:'<i class="fa fa-header"><sup>3</sup>'},h4:{name:"h4",action:"append-h4",aria:"header type four",tagNames:["h4"],contentDefault:"<b>H4</b>",contentFA:'<i class="fa fa-header"><sup>4</sup>'},h5:{name:"h5",action:"append-h5",aria:"header type five",tagNames:["h5"],contentDefault:"<b>H5</b>",contentFA:'<i class="fa fa-header"><sup>5</sup>'},h6:{name:"h6",action:"append-h6",aria:"header type six",tagNames:["h6"],contentDefault:"<b>H6</b>",contentFA:'<i class="fa fa-header"><sup>6</sup>'}},i=e.extensions.button.extend({init:function(){e.extensions.button.prototype.init.apply(this,arguments)},formSaveLabel:"&#10003;",formCloseLabel:"&times;",activeClass:"medium-editor-toolbar-form-active",hasForm:!0,getForm:function(){},isDisplayed:function(){return!!this.hasForm&&this.getForm().classList.contains(this.activeClass)},showForm:function(){this.hasForm&&this.getForm().classList.add(this.activeClass)},hideForm:function(){this.hasForm&&this.getForm().classList.remove(this.activeClass)},showToolbarDefaultActions:function(){var e=this.base.getExtensionByName("toolbar");e&&e.showToolbarDefaultActions()},hideToolbarDefaultActions:function(){var e=this.base.getExtensionByName("toolbar");e&&e.hideToolbarDefaultActions()},setToolbarPosition:function(){var e=this.base.getExtensionByName("toolbar");e&&e.setToolbarPosition()}}),e.extensions.form=i,o=e.extensions.form.extend({customClassOption:null,customClassOptionText:"Button",linkValidation:!1,placeholderText:"Paste or type a link",targetCheckbox:!1,targetCheckboxText:"Open in new window",name:"anchor",action:"createLink",aria:"link",tagNames:["a"],contentDefault:"<b>#</b>",contentFA:'<i class="fa fa-link"></i>',init:function(){e.extensions.form.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this))},handleClick:function(t){t.preventDefault(),t.stopPropagation();var n=e.selection.getSelectionRange(this.document);return"a"===n.startContainer.nodeName.toLowerCase()||"a"===n.endContainer.nodeName.toLowerCase()||e.util.getClosestTag(e.selection.getSelectedParentElement(n),"a")?this.execAction("unlink"):(this.isDisplayed()||this.showForm(),!1)},handleKeydown:function(t){e.util.isKey(t,e.util.keyCode.K)&&e.util.isMetaCtrlKey(t)&&!t.shiftKey&&this.handleClick(t)},getForm:function(){return this.form||(this.form=this.createForm()),this.form},getTemplate:function(){var e=['<input type="text" class="medium-editor-toolbar-input" placeholder="',this.placeholderText,'">'];return e.push('<a href="#" class="medium-editor-toolbar-save">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':this.formSaveLabel,"</a>"),e.push('<a href="#" class="medium-editor-toolbar-close">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':this.formCloseLabel,"</a>"),this.targetCheckbox&&e.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-target" id="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">','<label for="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">',this.targetCheckboxText,"</label>","</div>"),this.customClassOption&&e.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-button">',"<label>",this.customClassOptionText,"</label>","</div>"),e.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(t){var n=this.getInput(),i=this.getAnchorTargetCheckbox(),o=this.getAnchorButtonCheckbox();if("string"==typeof(t=t||{value:""})&&(t={value:t}),this.base.saveSelection(),this.hideToolbarDefaultActions(),e.extensions.form.prototype.showForm.apply(this),this.setToolbarPosition(),n.value=t.value,n.focus(),i&&(i.checked="_blank"===t.target),o){var r=t.buttonClass?t.buttonClass.split(" "):[];o.checked=-1!==r.indexOf(this.customClassOption)}},destroy:function(){if(!this.form)return!1;this.form.parentNode&&this.form.parentNode.removeChild(this.form),delete this.form},getFormOpts:function(){var e=this.getAnchorTargetCheckbox(),t=this.getAnchorButtonCheckbox(),n={value:this.getInput().value.trim()};return this.linkValidation&&(n.value=this.checkLinkFormat(n.value)),n.target="_self",e&&e.checked&&(n.target="_blank"),t&&t.checked&&(n.buttonClass=this.customClassOption),n},doFormSave:function(){var e=this.getFormOpts();this.completeFormSave(e)},completeFormSave:function(e){this.base.restoreSelection(),this.execAction(this.action,e),this.base.checkSelection()},ensureEncodedUri:function(e){return e===decodeURI(e)?encodeURI(e):e},ensureEncodedUriComponent:function(e){return e===decodeURIComponent(e)?encodeURIComponent(e):e},ensureEncodedParam:function(e){var t=e.split("="),n=t[0],i=t[1];return n+(void 0===i?"":"="+this.ensureEncodedUriComponent(i))},ensureEncodedQuery:function(e){return e.split("&").map(this.ensureEncodedParam.bind(this)).join("&")},checkLinkFormat:function(e){var t=/^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#/i.test(e),n="",i=e.match(/^(.*?)(?:\?(.*?))?(?:#(.*))?$/),o=i[1],r=i[2],a=i[3];if(/^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/.test(e))return"tel:"+e;if(!t){var s=o.split("/")[0];(s.match(/.+(\.|:).+/)||"localhost"===s)&&(n="http://")}return n+this.ensureEncodedUri(o)+(void 0===r?"":"?"+this.ensureEncodedQuery(r))+(void 0===a?"":"#"+a)},doFormCancel:function(){this.base.restoreSelection(),this.base.checkSelection()},attachFormEvents:function(e){var t=e.querySelector(".medium-editor-toolbar-close"),n=e.querySelector(".medium-editor-toolbar-save"),i=e.querySelector(".medium-editor-toolbar-input");this.on(e,"click",this.handleFormClick.bind(this)),this.on(i,"keyup",this.handleTextboxKeyup.bind(this)),this.on(t,"click",this.handleCloseClick.bind(this)),this.on(n,"click",this.handleSaveClick.bind(this),!0)},createForm:function(){var e=this.document.createElement("div");return e.className="medium-editor-toolbar-form",e.id="medium-editor-toolbar-form-anchor-"+this.getEditorId(),e.innerHTML=this.getTemplate(),this.attachFormEvents(e),e},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(t){if(t.keyCode===e.util.keyCode.ENTER)return t.preventDefault(),void this.doFormSave();t.keyCode===e.util.keyCode.ESCAPE&&(t.preventDefault(),this.doFormCancel())},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),e.extensions.anchor=o,r=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 e=this.document.createElement("div");return e.id="medium-editor-anchor-preview-"+this.getEditorId(),e.className="medium-editor-anchor-preview",e.innerHTML=this.getTemplate(),this.on(e,"click",this.handleClick.bind(this)),e},getTemplate:function(){return'<div class="medium-editor-toolbar-anchor-preview" id="medium-editor-toolbar-anchor-preview"> <a class="medium-editor-toolbar-anchor-preview-inner"></a></div>'},destroy:function(){this.anchorPreview&&(this.anchorPreview.parentNode&&this.anchorPreview.parentNode.removeChild(this.anchorPreview),delete this.anchorPreview)},hidePreview:function(){this.anchorPreview&&this.anchorPreview.classList.remove("medium-editor-anchor-preview-active"),this.activeAnchor=null},showPreview:function(e){return!(!this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")&&!e.getAttribute("data-disable-preview"))||(this.previewValueSelector&&(this.anchorPreview.querySelector(this.previewValueSelector).textContent=e.attributes.href.value,this.anchorPreview.querySelector(this.previewValueSelector).href=e.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=e,this.positionPreview(),this.attachPreviewHandlers(),this)},positionPreview:function(e){e=e||this.activeAnchor;var t,n,i,o,r,a=this.window.innerWidth,s=this.anchorPreview.offsetHeight,l=e.getBoundingClientRect(),u=this.diffLeft,c=this.diffTop,d=this.getEditorOption("elementsContainer"),h=["absolute","fixed"].indexOf(window.getComputedStyle(d).getPropertyValue("position"))>-1,f={};t=this.anchorPreview.offsetWidth/2;var p=this.base.getExtensionByName("toolbar");p&&(u=p.diffLeft,c=p.diffTop),n=u-t,h?(o=d.getBoundingClientRect(),["top","left"].forEach((function(e){f[e]=l[e]-o[e]})),f.width=l.width,f.height=l.height,l=f,a=o.width,r=d.scrollTop):r=this.window.pageYOffset,i=l.left+l.width/2,r+=s+l.top+l.height-c-this.anchorPreview.offsetHeight,this.anchorPreview.style.top=Math.round(r)+"px",this.anchorPreview.style.right="initial",i<t?(this.anchorPreview.style.left=n+t+"px",this.anchorPreview.style.right="initial"):a-i<t?(this.anchorPreview.style.left="auto",this.anchorPreview.style.right=0):(this.anchorPreview.style.left=n+i+"px",this.anchorPreview.style.right="initial")},attachToEditables:function(){this.subscribe("editableMouseover",this.handleEditableMouseover.bind(this)),this.subscribe("positionedToolbar",this.handlePositionedToolbar.bind(this))},handlePositionedToolbar:function(){this.showWhenToolbarIsVisible||this.hidePreview()},handleClick:function(e){var t=this.base.getExtensionByName("anchor"),n=this.activeAnchor;t&&n&&(e.preventDefault(),this.base.selectElement(this.activeAnchor),this.base.delay(function(){if(n){var e={value:n.attributes.href.value,target:n.getAttribute("target"),buttonClass:n.getAttribute("class")};t.showForm(e),n=null}}.bind(this))),this.hidePreview()},handleAnchorMouseout:function(){this.anchorToPreview=null,this.off(this.activeAnchor,"mouseout",this.instanceHandleAnchorMouseout),this.instanceHandleAnchorMouseout=null},handleEditableMouseover:function(t){var n=e.util.getClosestTag(t.target,"a");if(!1!==n){if(!this.showOnEmptyLinks&&(!/href=["']\S+["']/.test(n.outerHTML)||/href=["']#\S+["']/.test(n.outerHTML)))return!0;var i=this.base.getExtensionByName("toolbar");if(!this.showWhenToolbarIsVisible&&i&&i.isDisplayed&&i.isDisplayed())return!0;this.activeAnchor&&this.activeAnchor!==n&&this.detachPreviewHandlers(),this.anchorToPreview=n,this.instanceHandleAnchorMouseout=this.handleAnchorMouseout.bind(this),this.on(this.anchorToPreview,"mouseout",this.instanceHandleAnchorMouseout),this.base.delay(function(){this.anchorToPreview&&this.showPreview(this.anchorToPreview)}.bind(this))}},handlePreviewMouseover:function(){this.lastOver=(new Date).getTime(),this.hovering=!0},handlePreviewMouseout:function(e){e.relatedTarget&&/anchor-preview/.test(e.relatedTarget.className)||(this.hovering=!1)},updatePreview:function(){if(this.hovering)return!0;(new Date).getTime()-this.lastOver>this.hideDelay&&this.detachPreviewHandlers()},detachPreviewHandlers:function(){clearInterval(this.intervalTimer),this.instanceHandlePreviewMouseover&&(this.off(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.activeAnchor&&(this.off(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout))),this.hidePreview(),this.hovering=this.instanceHandlePreviewMouseover=this.instanceHandlePreviewMouseout=null},attachPreviewHandlers:function(){this.lastOver=(new Date).getTime(),this.hovering=!0,this.instanceHandlePreviewMouseover=this.handlePreviewMouseover.bind(this),this.instanceHandlePreviewMouseout=this.handlePreviewMouseout.bind(this),this.intervalTimer=setInterval(this.updatePreview.bind(this),200),this.on(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.on(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout)}}),e.extensions.anchorPreview=r,function(){var t,n,i,o,r;function a(t){return!e.util.getClosestTag(t,"a")}t=[" ","\t","\n","\r"," "," "," "," "," ","\u2028","\u2029"],i="(((?:(https?://|ftps?://|nntp://)|www\\d{0,3}[.]|[a-z0-9.\\-]+[.]("+(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")+")\\/)\\S+(?:[^\\s`!\\[\\]{};:'\".,?«»“”‘’])))|(([a-z0-9\\-]+\\.)?[a-z0-9\\-]+\\.("+n+"))",o=new RegExp("^("+n+")$","i"),r=new RegExp(i,"gi");var s=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 e=0,t=0;t<this.window._mediumEditors.length;t++){var n=this.window._mediumEditors[t];null!==n&&void 0!==n.getExtensionByName("autoLink")&&e++}return 1===e},destroy:function(){this.document.queryCommandSupported("AutoUrlDetect")&&this.isLastInstance()&&this.document.execCommand("AutoUrlDetect",!1,!0)},onBlur:function(e,t){this.performLinking(t)},onKeypress:function(t){this.disableEventHandling||e.util.isKey(t,[e.util.keyCode.SPACE,e.util.keyCode.ENTER])&&(clearTimeout(this.performLinkingTimeout),this.performLinkingTimeout=setTimeout(function(){try{var e=this.base.exportSelection();this.performLinking(t.target)&&this.base.importSelection(e,!0)}catch(e){window.console&&window.console.error("Failed to perform linking",e),this.disableEventHandling=!0}}.bind(this),0))},performLinking:function(t){var n=e.util.splitByBlockElements(t),i=!1;0===n.length&&(n=[t]);for(var o=0;o<n.length;o++)i=this.removeObsoleteAutoLinkSpans(n[o])||i,i=this.performLinkingWithinElement(n[o])||i;return this.base.events.updateInput(t,{target:t,currentTarget:t}),i},removeObsoleteAutoLinkSpans:function(t){if(!t||3===t.nodeType)return!1;for(var n=t.querySelectorAll('span[data-auto-link="true"]'),i=!1,o=0;o<n.length;o++){var r=n[o].textContent;if(-1===r.indexOf("://")&&(r=e.util.ensureUrlHasProtocol(r)),n[o].getAttribute("data-href")!==r&&a(n[o])){i=!0;var s=r.replace(/\s+$/,"");if(n[o].getAttribute("data-href")===s){var l=r.length-s.length,u=e.util.splitOffDOMTree(n[o],this.splitTextBeforeEnd(n[o],l));n[o].parentNode.insertBefore(u,n[o].nextSibling)}else e.util.unwrap(n[o],this.document)}}return i},splitTextBeforeEnd:function(e,t){for(var n,i,o,r=this.document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),a=!0;a;)a=null!==r.lastChild();for(;t>0&&null!==o;)(i=(n=r.currentNode).nodeValue).length>t?(o=n.splitText(i.length-t),t=0):(o=r.previousNode(),t-=i.length);return o},performLinkingWithinElement:function(t){for(var n=this.findLinkableText(t),i=0;i<n.length;i++){var o=e.util.findOrCreateMatchingTextNodes(this.document,t,n[i]);this.shouldNotLink(o)||this.createAutoLink(o,n[i].href)}return!1},shouldNotLink:function(t){for(var n=!1,i=0;i<t.length&&!1===n;i++)n=!!e.util.traverseUp(t[i],(function(e){return"a"===e.nodeName.toLowerCase()||e.getAttribute&&"true"===e.getAttribute("data-auto-link")}));return n},findLinkableText:function(e){for(var n=e.textContent,i=null,a=[];null!==(i=r.exec(n));){var s=i.index+i[0].length;!(0!==i.index&&-1===t.indexOf(n[i.index-1])||s!==n.length&&-1===t.indexOf(n[s]))&&(-1!==i[0].indexOf("/")||o.test(i[0].split(".").pop().split("?").shift()))&&a.push({href:i[0],start:i.index,end:s})}return a},createAutoLink:function(t,n){n=e.util.ensureUrlHasProtocol(n);var i=e.util.createLink(this.document,t,n,this.getEditorOption("targetBlank")?"_blank":null),o=this.document.createElement("span");for(o.setAttribute("data-auto-link","true"),o.setAttribute("data-href",n),i.insertBefore(o,i.firstChild);i.childNodes.length>1;)o.appendChild(i.childNodes[1])}});e.extensions.autoLink=s}(),function(){var t="medium-editor-dragover";function n(n){var i=e.util.getContainerEditorElement(n);Array.prototype.slice.call(i.parentElement.querySelectorAll("."+t)).forEach((function(e){e.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(e){e.preventDefault(),e.dataTransfer.dropEffect="copy";var i=e.target.classList?e.target:e.target.parentElement;n(i),"dragover"===e.type&&i.classList.add(t)},handleDrop:function(e){e.preventDefault(),e.stopPropagation(),this.base.selectElement(e.target);var t=this.base.exportSelection();t.start=t.end,this.base.importSelection(t),e.dataTransfer.files&&Array.prototype.slice.call(e.dataTransfer.files).forEach((function(e){this.isAllowedFile(e)&&e.type.match("image")&&this.insertImageFile(e)}),this),n(e.target)},isAllowedFile:function(e){return this.allowedTypes.some((function(t){return!!e.type.match(t)}))},insertImageFile:function(t){if("function"==typeof FileReader){var n=new FileReader;n.readAsDataURL(t),n.addEventListener("load",function(t){var n=this.document.createElement("img");n.src=t.target.result,e.util.insertHTMLCommand(this.document,n.outerHTML)}.bind(this))}}});e.extensions.fileDragging=i}(),a=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(e){var t=e.key.charCodeAt(0);this.keys[t]||(this.keys[t]=[]),this.keys[t].push(e)}),this)},handleKeydown:function(t){var n=e.util.getKeyCode(t);if(this.keys[n]){var i=e.util.isMetaCtrlKey(t),o=!!t.shiftKey,r=!!t.altKey;this.keys[n].forEach((function(e){e.meta!==i||e.shift!==o||e.alt!==r&&void 0!==e.alt||(t.preventDefault(),t.stopPropagation(),"function"==typeof e.command?e.command.apply(this):!1!==e.command&&this.execAction(e.command))}),this)}}}),e.extensions.keyboardCommands=a,s=e.extensions.form.extend({name:"fontname",action:"fontName",aria:"change font name",contentDefault:"&#xB1;",contentFA:'<i class="fa fa-font"></i>',fonts:["","Arial","Verdana","Times New Roman"],init:function(){e.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(e){if(e.preventDefault(),e.stopPropagation(),!this.isDisplayed()){var t=this.document.queryCommandValue("fontName")+"";this.showForm(t)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getSelect().value=""},showForm:function(e){var t=this.getSelect();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),t.value=e||"",t.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 e,t=this.document,n=t.createElement("div"),i=t.createElement("select"),o=t.createElement("a"),r=t.createElement("a");n.className="medium-editor-toolbar-form",n.id="medium-editor-toolbar-form-fontname-"+this.getEditorId(),this.on(n,"click",this.handleFormClick.bind(this));for(var a=0;a<this.fonts.length;a++)(e=t.createElement("option")).innerHTML=this.fonts[a],e.value=this.fonts[a],i.appendChild(e);return i.className="medium-editor-toolbar-select",n.appendChild(i),this.on(i,"change",this.handleFontChange.bind(this)),r.setAttribute("href","#"),r.className="medium-editor-toobar-save",r.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"&#10003;",n.appendChild(r),this.on(r,"click",this.handleSaveClick.bind(this),!0),o.setAttribute("href","#"),o.className="medium-editor-toobar-close",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"&times;",n.appendChild(o),this.on(o,"click",this.handleCloseClick.bind(this)),n},getSelect:function(){return this.getForm().querySelector("select.medium-editor-toolbar-select")},clearFontName:function(){e.selection.getSelectedElements(this.document).forEach((function(e){"font"===e.nodeName.toLowerCase()&&e.hasAttribute("face")&&e.removeAttribute("face")}))},handleFontChange:function(){var e=this.getSelect().value;""===e?this.clearFontName():this.execAction("fontName",{value:e})},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),e.extensions.fontName=s,l=e.extensions.form.extend({name:"fontsize",action:"fontSize",aria:"increase/decrease font size",contentDefault:"&#xB1;",contentFA:'<i class="fa fa-text-height"></i>',init:function(){e.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(e){if(e.preventDefault(),e.stopPropagation(),!this.isDisplayed()){var t=this.document.queryCommandValue("fontSize")+"";this.showForm(t)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getInput().value=""},showForm:function(e){var t=this.getInput();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),t.value=e||"",t.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 e=this.document,t=e.createElement("div"),n=e.createElement("input"),i=e.createElement("a"),o=e.createElement("a");return t.className="medium-editor-toolbar-form",t.id="medium-editor-toolbar-form-fontsize-"+this.getEditorId(),this.on(t,"click",this.handleFormClick.bind(this)),n.setAttribute("type","range"),n.setAttribute("min","1"),n.setAttribute("max","7"),n.className="medium-editor-toolbar-input",t.appendChild(n),this.on(n,"change",this.handleSliderChange.bind(this)),o.setAttribute("href","#"),o.className="medium-editor-toobar-save",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"&#10003;",t.appendChild(o),this.on(o,"click",this.handleSaveClick.bind(this),!0),i.setAttribute("href","#"),i.className="medium-editor-toobar-close",i.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"&times;",t.appendChild(i),this.on(i,"click",this.handleCloseClick.bind(this)),t},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},clearFontSize:function(){e.selection.getSelectedElements(this.document).forEach((function(e){"font"===e.nodeName.toLowerCase()&&e.hasAttribute("size")&&e.removeAttribute("size")}))},handleSliderChange:function(){var e=this.getInput().value;"4"===e?this.clearFontSize():this.execAction("fontSize",{value:e})},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),e.extensions.fontSize=l,function(){var t="%ME_PASTEBIN%",n=null,i=null,o=function(e){e.stopPropagation()};function r(e,t,n){var i=e.clipboardData||t.clipboardData||n.dataTransfer,o={};if(!i)return o;if(i.getData){var r=i.getData("Text");r&&r.length>0&&(o["text/plain"]=r)}if(i.types)for(var a=0;a<i.types.length;a++){var s=i.types[a];o[s]=i.getData(s)}return o}var a=e.Extension.extend({forcePlainText:!0,cleanPastedHTML:!1,preCleanReplacements:[],cleanReplacements:[],cleanAttrs:["class","style","dir"],cleanTags:["meta"],unwrapTags:[],init:function(){e.Extension.prototype.init.apply(this,arguments),(this.forcePlainText||this.cleanPastedHTML)&&(this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.getEditorElements().forEach((function(e){this.on(e,"paste",this.handlePaste.bind(this))}),this),this.subscribe("addElement",this.handleAddElement.bind(this)))},handleAddElement:function(e,t){this.on(t,"paste",this.handlePaste.bind(this))},destroy:function(){(this.forcePlainText||this.cleanPastedHTML)&&this.removePasteBin()},handlePaste:function(e,t){if(!e.defaultPrevented){var n=r(e,this.window,this.document),i=n["text/html"],o=n["text/plain"];this.window.clipboardData&&void 0===e.clipboardData&&!i&&(i=o),(i||o)&&(e.preventDefault(),this.doPaste(i,o,t))}},doPaste:function(t,n,i){var o,r,a="";if(this.cleanPastedHTML&&t)return this.cleanPaste(t);if(n){if(this.getEditorOption("disableReturn")||i&&i.getAttribute("data-disable-return"))a=e.util.htmlEntities(n);else if((o=n.split(/[\r\n]+/g)).length>1)for(r=0;r<o.length;r+=1)""!==o[r]&&(a+="<p>"+e.util.htmlEntities(o[r])+"</p>");else a=e.util.htmlEntities(o[0]);e.util.insertHTMLCommand(this.document,a)}},handlePasteBinPaste:function(e){if(e.defaultPrevented)this.removePasteBin();else{var t=r(e,this.window,this.document),n=t["text/html"],o=t["text/plain"],a=i;if(!this.cleanPastedHTML||n)return e.preventDefault(),this.removePasteBin(),this.doPaste(n,o,a),void this.trigger("editablePaste",{currentTarget:a,target:a},a);setTimeout(function(){this.cleanPastedHTML&&(n=this.getPasteBinHtml()),this.removePasteBin(),this.doPaste(n,o,a),this.trigger("editablePaste",{currentTarget:a,target:a},a)}.bind(this),0)}},handleKeydown:function(t,n){e.util.isKey(t,e.util.keyCode.V)&&e.util.isMetaCtrlKey(t)&&(t.stopImmediatePropagation(),this.removePasteBin(),this.createPasteBin(n))},createPasteBin:function(r){var a,s=e.selection.getSelectionRange(this.document),l=this.window.pageYOffset;i=r,s&&((a=s.getClientRects()).length?l+=a[0].top:void 0!==s.startContainer.getBoundingClientRect?l+=s.startContainer.getBoundingClientRect().top:l+=s.getBoundingClientRect().top),n=s;var u=this.document.createElement("div");u.id=this.pasteBinId="medium-editor-pastebin-"+ +Date.now(),u.setAttribute("style","border: 1px red solid; position: absolute; top: "+l+"px; width: 10px; height: 10px; overflow: hidden; opacity: 0"),u.setAttribute("contentEditable",!0),u.innerHTML=t,this.document.body.appendChild(u),this.on(u,"focus",o),this.on(u,"focusin",o),this.on(u,"focusout",o),u.focus(),e.selection.selectNode(u,this.document),this.boundHandlePaste||(this.boundHandlePaste=this.handlePasteBinPaste.bind(this)),this.on(u,"paste",this.boundHandlePaste)},removePasteBin:function(){null!==n&&(e.selection.selectRange(this.document,n),n=null),null!==i&&(i=null);var t=this.getPasteBin();t&&t&&(this.off(t,"focus",o),this.off(t,"focusin",o),this.off(t,"focusout",o),this.off(t,"paste",this.boundHandlePaste),t.parentElement.removeChild(t))},getPasteBin:function(){return this.document.getElementById(this.pasteBinId)},getPasteBinHtml:function(){var e=this.getPasteBin();if(!e)return!1;if(e.firstChild&&"mcepastebin"===e.firstChild.id)return!1;var n=e.innerHTML;return!(!n||n===t)&&n},cleanPaste:function(e){var t,n,i,o,r=/<p|<br|<div/.test(e),a=[].concat(this.preCleanReplacements||[],[[new RegExp(/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g),""],[new RegExp(/<!--StartFragment-->|<!--EndFragment-->/g),""],[new RegExp(/<br>$/i),""],[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi),""],[new RegExp(/<\/b>(<br[^>]*>)?$/gi),""],[new RegExp(/<span class="Apple-converted-space">\s+<\/span>/g)," "],[new RegExp(/<br class="Apple-interchange-newline">/g),"<br>"],[new RegExp(/<span[^>]*(font-style:italic;font-weight:(bold|700)|font-weight:(bold|700);font-style:italic)[^>]*>/gi),'<span class="replace-with italic bold">'],[new RegExp(/<span[^>]*font-style:italic[^>]*>/gi),'<span class="replace-with italic">'],[new RegExp(/<span[^>]*font-weight:(bold|700)[^>]*>/gi),'<span class="replace-with bold">'],[new RegExp(/&lt;(\/?)(i|b|a)&gt;/gi),"<$1$2>"],[new RegExp(/&lt;a(?:(?!href).)+href=(?:&quot;|&rdquo;|&ldquo;|"|“|”)(((?!&quot;|&rdquo;|&ldquo;|"|“|”).)*)(?:&quot;|&rdquo;|&ldquo;|"|“|”)(?:(?!&gt;).)*&gt;/gi),'<a href="$1">'],[new RegExp(/<\/p>\n+/gi),"</p>"],[new RegExp(/\n+<p/gi),"<p"],[new RegExp(/<\/?o:[a-z]*>/gi),""],[new RegExp(/<!\[if !supportLists\]>(((?!<!).)*)<!\[endif]\>/gi),"$1"]],this.cleanReplacements||[]);for(t=0;t<a.length;t+=1)e=e.replace(a[t][0],a[t][1]);if(!r)return this.pasteHTML(e);for((i=this.document.createElement("div")).innerHTML="<p>"+e.split("<br><br>").join("</p><p>")+"</p>",n=i.querySelectorAll("a,p,div,br"),t=0;t<n.length;t+=1)switch((o=n[t]).innerHTML=o.innerHTML.replace(/\n/gi," "),o.nodeName.toLowerCase()){case"p":case"div":this.filterCommonBlocks(o);break;case"br":this.filterLineBreak(o)}this.pasteHTML(i.innerHTML)},pasteHTML:function(t,n){n=e.util.defaults({},n,{cleanAttrs:this.cleanAttrs,cleanTags:this.cleanTags,unwrapTags:this.unwrapTags});var i,o,r,a,s=this.document.createDocumentFragment();for(s.appendChild(this.document.createElement("body")),(a=s.querySelector("body")).innerHTML=t,this.cleanupSpans(a),i=a.querySelectorAll("*"),r=0;r<i.length;r+=1)"a"===(o=i[r]).nodeName.toLowerCase()&&this.getEditorOption("targetBlank")&&e.util.setTargetBlank(o),e.util.cleanupAttrs(o,n.cleanAttrs),e.util.cleanupTags(o,n.cleanTags),e.util.unwrapTags(o,n.unwrapTags);e.util.insertHTMLCommand(this.document,a.innerHTML.replace(/&nbsp;/g," "))},isCommonBlock:function(e){return e&&("p"===e.nodeName.toLowerCase()||"div"===e.nodeName.toLowerCase())},filterCommonBlocks:function(e){/^\s*$/.test(e.textContent)&&e.parentNode&&e.parentNode.removeChild(e)},filterLineBreak:function(e){this.isCommonBlock(e.previousElementSibling)?this.removeWithParent(e):!this.isCommonBlock(e.parentNode)||e.parentNode.firstChild!==e&&e.parentNode.lastChild!==e?e.parentNode&&1===e.parentNode.childElementCount&&""===e.parentNode.textContent&&this.removeWithParent(e):this.removeWithParent(e)},removeWithParent:function(e){e&&e.parentNode&&(e.parentNode.parentNode&&1===e.parentNode.childElementCount?e.parentNode.parentNode.removeChild(e.parentNode):e.parentNode.removeChild(e))},cleanupSpans:function(t){var n,i,o,r=t.querySelectorAll(".replace-with"),a=function(e){return e&&"#text"!==e.nodeName&&"false"===e.getAttribute("contenteditable")};for(n=0;n<r.length;n+=1)i=r[n],o=this.document.createElement(i.classList.contains("bold")?"b":"i"),i.classList.contains("bold")&&i.classList.contains("italic")?o.innerHTML="<i>"+i.innerHTML+"</i>":o.innerHTML=i.innerHTML,i.parentNode.replaceChild(o,i);for(r=t.querySelectorAll("span"),n=0;n<r.length;n+=1){if(i=r[n],e.util.traverseUp(i,a))return!1;e.util.unwrap(i,this.document)}}});e.extensions.paste=a}(),u=e.Extension.extend({name:"placeholder",text:"Type your text",hideOnClick:!0,init:function(){e.Extension.prototype.init.apply(this,arguments),this.initPlaceholders(),this.attachEventHandlers()},initPlaceholders:function(){this.getEditorElements().forEach(this.initElement,this)},handleAddElement:function(e,t){this.initElement(t)},initElement:function(e){e.getAttribute("data-placeholder")||e.setAttribute("data-placeholder",this.text),this.updatePlaceholder(e)},destroy:function(){this.getEditorElements().forEach(this.cleanupElement,this)},handleRemoveElement:function(e,t){this.cleanupElement(t)},cleanupElement:function(e){e.getAttribute("data-placeholder")===this.text&&e.removeAttribute("data-placeholder")},showPlaceholder:function(t){t&&(e.util.isFF&&0===t.childNodes.length?(t.classList.add("medium-editor-placeholder-relative"),t.classList.remove("medium-editor-placeholder")):(t.classList.add("medium-editor-placeholder"),t.classList.remove("medium-editor-placeholder-relative")))},hidePlaceholder:function(e){e&&(e.classList.remove("medium-editor-placeholder"),e.classList.remove("medium-editor-placeholder-relative"))},updatePlaceholder:function(e,t){if(e.querySelector("img, blockquote, ul, ol, table")||""!==e.textContent.replace(/^\s+|\s+$/g,""))return this.hidePlaceholder(e);t||this.showPlaceholder(e)},attachEventHandlers:function(){this.hideOnClick&&this.subscribe("focus",this.handleFocus.bind(this)),this.subscribe("editableInput",this.handleInput.bind(this)),this.subscribe("blur",this.handleBlur.bind(this)),this.subscribe("addElement",this.handleAddElement.bind(this)),this.subscribe("removeElement",this.handleRemoveElement.bind(this))},handleInput:function(e,t){var n=this.hideOnClick&&t===this.base.getFocusedElement();this.updatePlaceholder(t,n)},handleFocus:function(e,t){this.hidePlaceholder(t)},handleBlur:function(e,t){this.updatePlaceholder(t)}}),e.extensions.placeholder=u,c=e.Extension.extend({name:"toolbar",align:"center",allowMultiParagraphSelection:!0,buttons:["bold","italic","underline","anchor","h2","h3","quote"],diffLeft:0,diffTop:-10,firstButtonClass:"medium-editor-button-first",lastButtonClass:"medium-editor-button-last",standardizeSelectionStart:!1,static:!1,sticky:!1,stickyTopOffset:0,updateOnEmptySelection:!1,relativeContainer:null,init:function(){e.Extension.prototype.init.apply(this,arguments),this.initThrottledMethods(),this.relativeContainer?this.relativeContainer.appendChild(this.getToolbarElement()):this.getEditorOption("elementsContainer").appendChild(this.getToolbarElement())},forEachExtension:function(e,t){return this.base.extensions.forEach((function(n){if(n!==this)return e.apply(t||this,arguments)}),this)},createToolbar:function(){var e=this.document.createElement("div");return e.id="medium-editor-toolbar-"+this.getEditorId(),e.className="medium-editor-toolbar",this.static?e.className+=" static-toolbar":this.relativeContainer?e.className+=" medium-editor-relative-toolbar":e.className+=" medium-editor-stalker-toolbar",e.appendChild(this.createToolbarButtons()),this.forEachExtension((function(t){t.hasForm&&e.appendChild(t.getForm())})),this.attachEventHandlers(),e},createToolbarButtons:function(){var t,n,i,o,r,a,s=this.document.createElement("ul");return s.id="medium-editor-toolbar-actions"+this.getEditorId(),s.className="medium-editor-toolbar-actions",s.style.display="block",this.buttons.forEach((function(i){"string"==typeof i?(r=i,a=null):(r=i.name,a=i),(o=this.base.addBuiltInExtension(r,a))&&"function"==typeof o.getButton&&(n=o.getButton(this.base),t=this.document.createElement("li"),e.util.isElement(n)?t.appendChild(n):t.innerHTML=n,s.appendChild(t))}),this),(i=s.querySelectorAll("button")).length>0&&(i[0].classList.add(this.firstButtonClass),i[i.length-1].classList.add(this.lastButtonClass)),s},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(t){if(t&&t.target&&e.util.isDescendant(this.getToolbarElement(),t.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"block"===this.getToolbarActionsElement().style.display},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(e){e.hasForm&&e.isDisplayed()&&e.hideForm()}))},multipleBlockElementsSelected:function(){var t=new RegExp("<("+e.util.blockContainerElementNames.join("|")+")[^>]*>","g"),n=e.selection.getSelectionHtml(this.document).replace(/<[^\/>][^>]*><\/[^>]+>/gim,"").match(t);return!!n&&n.length>1},modifySelection:function(){var t=this.window.getSelection().getRangeAt(0);if(this.standardizeSelectionStart&&t.startContainer.nodeValue&&t.startOffset===t.startContainer.nodeValue.length){var n=e.util.findAdjacentTextNodeWithContent(e.selection.getSelectionElement(this.window),t.startContainer,this.document);if(n){for(var i=0;0===n.nodeValue.substr(i,1).trim().length;)i+=1;t=e.selection.select(this.document,n,i,t.endContainer,t.endOffset)}}},checkState:function(){if(!this.base.preventSelectionUpdates){if(!this.base.getFocusedElement()||e.selection.selectionInContentEditableFalse(this.window))return this.hideToolbar();var t=e.selection.getSelectionElement(this.window);return!t||-1===this.getEditorElements().indexOf(t)||t.getAttribute("data-disable-toolbar")?this.hideToolbar():this.updateOnEmptySelection&&this.static?this.showAndUpdateToolbar():!e.selection.selectionContainsContent(this.document)||!1===this.allowMultiParagraphSelection&&this.multipleBlockElementsSelected()?this.hideToolbar():void this.showAndUpdateToolbar()}},showAndUpdateToolbar:function(){this.modifySelection(),this.setToolbarButtonStates(),this.trigger("positionToolbar",{},this.base.getFocusedElement()),this.showToolbarDefaultActions(),this.setToolbarPosition()},setToolbarButtonStates:function(){this.forEachExtension((function(e){"function"==typeof e.isActive&&"function"==typeof e.setInactive&&e.setInactive()})),this.checkActiveButtons()},checkActiveButtons:function(){var t,n=[],i=null,o=e.selection.getSelectionRange(this.document),r=function(e){"function"==typeof e.checkState?e.checkState(t):"function"==typeof e.isActive&&"function"==typeof e.isAlreadyApplied&&"function"==typeof e.setActive&&!e.isActive()&&e.isAlreadyApplied(t)&&e.setActive()};if(o&&(this.forEachExtension((function(e){"function"!=typeof e.queryCommandState||null===(i=e.queryCommandState())?n.push(e):i&&"function"==typeof e.setActive&&e.setActive()})),t=e.selection.getSelectedParentElement(o),this.getEditorElements().some((function(n){return e.util.isDescendant(n,t,!0)}))))for(;t&&(n.forEach(r),!e.util.isMediumEditorElement(t));)t=t.parentNode},positionToolbarIfShown:function(){this.isDisplayed()&&this.setToolbarPosition()},setToolbarPosition:function(){var e=this.base.getFocusedElement(),t=this.window.getSelection();if(!e)return this;!this.static&&t.isCollapsed||(this.showToolbar(),this.relativeContainer||(this.static?this.positionStaticToolbar(e):this.positionToolbar(t)),this.trigger("positionedToolbar",{},this.base.getFocusedElement()))},positionStaticToolbar:function(e){this.getToolbarElement().style.left="0";var t,n=this.document.documentElement&&this.document.documentElement.scrollTop||this.document.body.scrollTop,i=this.window.innerWidth,o=this.getToolbarElement(),r=e.getBoundingClientRect(),a=r.top+n,s=r.left+r.width/2,l=o.offsetHeight,u=o.offsetWidth,c=u/2;switch(this.sticky?n>a+e.offsetHeight-l-this.stickyTopOffset?(o.style.top=a+e.offsetHeight-l+"px",o.classList.remove("medium-editor-sticky-toolbar")):n>a-l-this.stickyTopOffset?(o.classList.add("medium-editor-sticky-toolbar"),o.style.top=this.stickyTopOffset+"px"):(o.classList.remove("medium-editor-sticky-toolbar"),o.style.top=a-l+"px"):o.style.top=a-l+"px",this.align){case"left":t=r.left;break;case"right":t=r.right-u;break;case"center":t=s-c}t<0?t=0:t+u>i&&(t=i-Math.ceil(u)-1),o.style.left=t+"px"},positionToolbar:function(e){this.getToolbarElement().style.left="0",this.getToolbarElement().style.right="initial";var t=e.getRangeAt(0),n=t.getBoundingClientRect();(!n||0===n.height&&0===n.width&&t.startContainer===t.endContainer)&&(n=1===t.startContainer.nodeType&&t.startContainer.querySelector("img")?t.startContainer.querySelector("img").getBoundingClientRect():t.startContainer.getBoundingClientRect());var i,o,r=this.window.innerWidth,a=this.getToolbarElement(),s=a.offsetHeight,l=a.offsetWidth/2,u=this.diffLeft-l,c=this.getEditorOption("elementsContainer"),d=["absolute","fixed"].indexOf(window.getComputedStyle(c).getPropertyValue("position"))>-1,h={},f={};d?(o=c.getBoundingClientRect(),["top","left"].forEach((function(e){f[e]=n[e]-o[e]})),f.width=n.width,f.height=n.height,n=f,r=o.width,h.top=c.scrollTop):h.top=this.window.pageYOffset,i=n.left+n.width/2,h.top+=n.top-s,n.top<50?(a.classList.add("medium-toolbar-arrow-over"),a.classList.remove("medium-toolbar-arrow-under"),h.top+=50+n.height-this.diffTop):(a.classList.add("medium-toolbar-arrow-under"),a.classList.remove("medium-toolbar-arrow-over"),h.top+=this.diffTop),i<l?(h.left=u+l,h.right="initial"):r-i<l?(h.left="auto",h.right=0):(h.left=u+i,h.right="initial"),["top","left","right"].forEach((function(e){a.style[e]=h[e]+(isNaN(h[e])?"":"px")}))}}),e.extensions.toolbar=c,d=e.Extension.extend({init:function(){e.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(e){var t="medium-editor-dragover";e.preventDefault(),e.dataTransfer.dropEffect="copy","dragover"===e.type?e.target.classList.add(t):"dragleave"===e.type&&e.target.classList.remove(t)},handleDrop:function(t){t.preventDefault(),t.stopPropagation(),t.dataTransfer.files&&Array.prototype.slice.call(t.dataTransfer.files,0).some(function(t){var n,i;t.type.match("image")&&((n=new FileReader).readAsDataURL(t),i="medium-img-"+ +new Date,e.util.insertHTMLCommand(this.document,'<img class="medium-editor-image-loading" id="'+i+'" />'),n.onload=function(){var e=this.document.getElementById(i);e&&(e.removeAttribute("id"),e.removeAttribute("class"),e.src=n.result)}.bind(this))}.bind(this)),t.target.classList.remove("medium-editor-dragover")}}),e.extensions.imageDragging=d,function(){function t(t){var n=e.selection.getSelectionStart(this.options.ownerDocument),i=n.textContent,o=e.selection.getCaretOffsets(n);(void 0===i[o.left-1]||""===i[o.left-1].trim()||void 0!==i[o.left]&&""===i[o.left].trim())&&t.preventDefault()}function n(t,n){if(this.options.disableReturn||n.getAttribute("data-disable-return"))t.preventDefault();else if(this.options.disableDoubleReturn||n.getAttribute("data-disable-double-return")){var i=e.selection.getSelectionStart(this.options.ownerDocument);(i&&""===i.textContent.trim()&&"li"!==i.nodeName.toLowerCase()||i.previousElementSibling&&"br"!==i.previousElementSibling.nodeName.toLowerCase()&&""===i.previousElementSibling.textContent.trim())&&t.preventDefault()}}function i(t){var n=e.selection.getSelectionStart(this.options.ownerDocument);"pre"===(n&&n.nodeName.toLowerCase())&&(t.preventDefault(),e.util.insertHTMLCommand(this.options.ownerDocument," ")),e.util.isListItem(n)&&(t.preventDefault(),t.shiftKey?this.options.ownerDocument.execCommand("outdent",!1,null):this.options.ownerDocument.execCommand("indent",!1,null))}function o(t){var n,i=e.selection.getSelectionStart(this.options.ownerDocument),o=i.nodeName.toLowerCase(),r=/^(\s+|<br\/?>)?$/i,a=/h\d/i;e.util.isKey(t,[e.util.keyCode.BACKSPACE,e.util.keyCode.ENTER])&&i.previousElementSibling&&a.test(o)&&0===e.selection.getCaretOffsets(i).left?e.util.isKey(t,e.util.keyCode.BACKSPACE)&&r.test(i.previousElementSibling.innerHTML)?(i.previousElementSibling.parentNode.removeChild(i.previousElementSibling),t.preventDefault()):!this.options.disableDoubleReturn&&e.util.isKey(t,e.util.keyCode.ENTER)&&((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.previousElementSibling.parentNode.insertBefore(n,i),t.preventDefault()):e.util.isKey(t,e.util.keyCode.DELETE)&&i.nextElementSibling&&i.previousElementSibling&&!a.test(o)&&r.test(i.innerHTML)&&a.test(i.nextElementSibling.nodeName.toLowerCase())?(e.selection.moveCursor(this.options.ownerDocument,i.nextElementSibling),i.previousElementSibling.parentNode.removeChild(i),t.preventDefault()):e.util.isKey(t,e.util.keyCode.BACKSPACE)&&"li"===o&&r.test(i.innerHTML)&&!i.previousElementSibling&&!i.parentElement.previousElementSibling&&i.nextElementSibling&&"li"===i.nextElementSibling.nodeName.toLowerCase()?((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.parentElement.parentElement.insertBefore(n,i.parentElement),e.selection.moveCursor(this.options.ownerDocument,n),i.parentElement.removeChild(i),t.preventDefault()):e.util.isKey(t,e.util.keyCode.BACKSPACE)&&!1!==e.util.getClosestTag(i,"blockquote")&&0===e.selection.getCaretOffsets(i).left?(t.preventDefault(),e.util.execFormatBlock(this.options.ownerDocument,"p")):e.util.isKey(t,e.util.keyCode.ENTER)&&!1!==e.util.getClosestTag(i,"blockquote")&&0===e.selection.getCaretOffsets(i).right?((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.parentElement.insertBefore(n,i.nextSibling),e.selection.moveCursor(this.options.ownerDocument,n),t.preventDefault()):e.util.isKey(t,e.util.keyCode.BACKSPACE)&&e.util.isMediumEditorElement(i.parentElement)&&!i.previousElementSibling&&i.nextElementSibling&&r.test(i.innerHTML)&&(t.preventDefault(),e.selection.moveCursor(this.options.ownerDocument,i.nextSibling),i.parentElement.removeChild(i))}function r(t){var n=e.selection.getSelectionStart(this.options.ownerDocument);n&&(e.util.isMediumEditorElement(n)&&0===n.children.length&&!e.util.isBlockContainer(n)&&this.options.ownerDocument.execCommand("formatBlock",!1,"p"),!e.util.isKey(t,e.util.keyCode.ENTER)||e.util.isListItem(n)||e.util.isBlockContainer(n)||("a"===n.nodeName.toLowerCase()?this.options.ownerDocument.execCommand("unlink",!1,null):t.shiftKey||t.ctrlKey||this.options.ownerDocument.execCommand("formatBlock",!1,"p")))}function a(e,t){var n=t.parentNode.querySelector('textarea[medium-editor-textarea-id="'+t.getAttribute("medium-editor-textarea-id")+'"]');n&&(n.value=t.innerHTML.trim())}function s(e){e._mediumEditors||(e._mediumEditors=[null]),this.id||(this.id=e._mediumEditors.length),e._mediumEditors[this.id]=this}function l(e){e._mediumEditors&&e._mediumEditors[this.id]&&(e._mediumEditors[this.id]=null)}function u(t,n,i){var o=[];if(t||(t=[]),"string"==typeof t&&(t=n.querySelectorAll(t)),e.util.isElement(t)&&(t=[t]),i)for(var r=0;r<t.length;r++){var a=t[r];!e.util.isElement(a)||a.getAttribute("data-medium-editor-element")||a.getAttribute("medium-editor-textarea-id")||o.push(a)}else o=Array.prototype.slice.apply(t);return o}function c(e){var t=e.parentNode.querySelector('textarea[medium-editor-textarea-id="'+e.getAttribute("medium-editor-textarea-id")+'"]');t&&(t.classList.remove("medium-editor-hidden"),t.removeAttribute("medium-editor-textarea-id")),e.parentNode&&e.parentNode.removeChild(e)}function d(e,t,n){return e=function(e,t){return Object.keys(t).forEach((function(n){void 0===e[n]&&(e[n]=t[n])})),e}(e,{window:n.options.contentWindow,document:n.options.ownerDocument,base:n}),"function"==typeof e.init&&e.init(),e.name||(e.name=t),e}function h(){return!this.elements.every((function(e){return!!e.getAttribute("data-disable-toolbar")}))&&!1!==this.options.toolbar}function f(){return!!h.call(this)&&!1!==this.options.anchorPreview}function p(){return!1!==this.options.placeholder}function g(){return!1!==this.options.autoLink}function v(){return!1!==this.options.imageDragging}function m(){return!1!==this.options.keyboardCommands}function y(){return!this.options.extensions.imageDragging}function b(e){for(var t=this.options.ownerDocument.createElement("div"),n=Date.now(),i="medium-editor-"+n,o=e.attributes;this.options.ownerDocument.getElementById(i);)n++,i="medium-editor-"+n;t.className=e.className,t.id=i,t.innerHTML=e.value,e.setAttribute("medium-editor-textarea-id",i);for(var r=0,a=o.length;r<a;r++)t.hasAttribute(o[r].nodeName)||t.setAttribute(o[r].nodeName,o[r].value);return e.form&&this.on(e.form,"reset",function(e){e.defaultPrevented||this.resetContent(this.options.ownerDocument.getElementById(i))}.bind(this)),e.classList.add("medium-editor-hidden"),e.parentNode.insertBefore(t,e),t}function x(t,i){if(!t.getAttribute("data-medium-editor-element")){"textarea"===t.nodeName.toLowerCase()&&(t=b.call(this,t),this.instanceHandleEditableInput||(this.instanceHandleEditableInput=a.bind(this),this.subscribe("editableInput",this.instanceHandleEditableInput))),this.options.disableEditing||t.getAttribute("data-disable-editing")||(t.setAttribute("contentEditable",!0),t.setAttribute("spellcheck",this.options.spellcheck)),this.instanceHandleEditableKeydownEnter||(t.getAttribute("data-disable-return")||t.getAttribute("data-disable-double-return"))&&(this.instanceHandleEditableKeydownEnter=n.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter)),this.options.disableReturn||t.getAttribute("data-disable-return")||this.on(t,"keyup",r.bind(this));var o=e.util.guid();t.setAttribute("data-medium-editor-element",!0),t.classList.add("medium-editor-element"),t.setAttribute("role","textbox"),t.setAttribute("aria-multiline",!0),t.setAttribute("data-medium-editor-editor-index",i),t.setAttribute("medium-editor-index",o),S[o]=t.innerHTML,this.events.attachAllEventsToElement(t)}return t}function w(){this.subscribe("editableKeydownTab",i.bind(this)),this.subscribe("editableKeydownDelete",o.bind(this)),this.subscribe("editableKeydownEnter",o.bind(this)),this.options.disableExtraSpaces&&this.subscribe("editableKeydownSpace",t.bind(this)),this.instanceHandleEditableKeydownEnter||(this.options.disableReturn||this.options.disableDoubleReturn)&&(this.instanceHandleEditableKeydownEnter=n.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter))}function E(){if(this.extensions=[],Object.keys(this.options.extensions).forEach((function(e){"toolbar"!==e&&this.options.extensions[e]&&this.extensions.push(d(this.options.extensions[e],e,this))}),this),y.call(this)){var t=this.options.fileDragging;t||(t={},v.call(this)||(t.allowedTypes=[])),this.addBuiltInExtension("fileDragging",t)}var n={paste:!0,"anchor-preview":f.call(this),autoLink:g.call(this),keyboardCommands:m.call(this),placeholder:p.call(this)};Object.keys(n).forEach((function(e){n[e]&&this.addBuiltInExtension(e)}),this);var i=this.options.extensions.toolbar;if(!i&&h.call(this)){var o=e.util.extend({},this.options.toolbar,{allowMultiParagraphSelection:this.options.allowMultiParagraphSelection});i=new e.extensions.toolbar(o)}i&&this.extensions.push(d(i,"toolbar",this))}function C(t,n){return n&&[["allowMultiParagraphSelection","toolbar.allowMultiParagraphSelection"]].forEach((function(t){n.hasOwnProperty(t[0])&&void 0!==n[t[0]]&&e.util.deprecated(t[0],t[1],"v6.0.0")})),e.util.defaults({},n,t)}function N(t,n){var i,o;if(i=/^append-(.+)$/gi.exec(t))return e.util.execFormatBlock(this.options.ownerDocument,i[1]);if("fontSize"===t)return n.size&&e.util.deprecated(".size option for fontSize command",".value","6.0.0"),o=n.value||n.size,this.options.ownerDocument.execCommand("fontSize",!1,o);if("fontName"===t)return n.name&&e.util.deprecated(".name option for fontName command",".value","6.0.0"),o=n.value||n.name,this.options.ownerDocument.execCommand("fontName",!1,o);if("createLink"===t)return this.createLink(n);if("image"===t){var r=this.options.contentWindow.getSelection().toString().trim();return this.options.ownerDocument.execCommand("insertImage",!1,r)}if("html"===t){var a=this.options.contentWindow.getSelection().toString().trim();return e.util.insertHTMLCommand(this.options.ownerDocument,a)}if(/justify([A-Za-z]*)$/g.exec(t)){var s=this.options.ownerDocument.execCommand(t,!1,null),l=e.selection.getSelectedParentElement(e.selection.getSelectionRange(this.options.ownerDocument));return l&&_.call(this,e.util.getTopBlockContainer(l)),s}return o=n&&n.value,this.options.ownerDocument.execCommand(t,!1,o)}function _(t){if(t){var n,i=Array.prototype.slice.call(t.childNodes).filter((function(e){var t="div"===e.nodeName.toLowerCase();return t&&!n&&(n=e.style.textAlign),t}));i.length&&(this.saveSelection(),i.forEach((function(t){if(t.style.textAlign===n){var i=t.lastChild;if(i){e.util.unwrap(t,this.options.ownerDocument);var o=this.options.ownerDocument.createElement("BR");i.parentNode.insertBefore(o,i.nextSibling)}}}),this),t.style.textAlign=n,this.restoreSelection())}}var S={};e.prototype={init:function(e,t){return this.options=C.call(this,this.defaults,t),this.origElements=e,this.options.elementsContainer||(this.options.elementsContainer=this.options.ownerDocument.body),this.setup()},setup:function(){this.isActive||(s.call(this,this.options.contentWindow),this.events=new e.Events(this),this.elements=[],this.addElements(this.origElements),0!==this.elements.length&&(this.isActive=!0,E.call(this),w.call(this)))},destroy:function(){this.isActive&&(this.isActive=!1,this.extensions.forEach((function(e){"function"==typeof e.destroy&&e.destroy()}),this),this.events.destroy(),this.elements.forEach((function(e){this.options.spellcheck&&(e.innerHTML=e.innerHTML),e.removeAttribute("contentEditable"),e.removeAttribute("spellcheck"),e.removeAttribute("data-medium-editor-element"),e.classList.remove("medium-editor-element"),e.removeAttribute("role"),e.removeAttribute("aria-multiline"),e.removeAttribute("medium-editor-index"),e.removeAttribute("data-medium-editor-editor-index"),e.getAttribute("medium-editor-textarea-id")&&c(e)}),this),this.elements=[],this.instanceHandleEditableKeydownEnter=null,this.instanceHandleEditableInput=null,l.call(this,this.options.contentWindow))},on:function(e,t,n,i){return this.events.attachDOMEvent(e,t,n,i),this},off:function(e,t,n,i){return this.events.detachDOMEvent(e,t,n,i),this},subscribe:function(e,t){return this.events.attachCustomEvent(e,t),this},unsubscribe:function(e,t){return this.events.detachCustomEvent(e,t),this},trigger:function(e,t,n){return this.events.triggerCustomEvent(e,t,n),this},delay:function(e){var t=this;return setTimeout((function(){t.isActive&&e()}),this.options.delay)},serialize:function(){var e,t={},n=this.elements.length;for(e=0;e<n;e+=1)t[""!==this.elements[e].id?this.elements[e].id:"element-"+e]={value:this.elements[e].innerHTML.trim()};return t},getExtensionByName:function(e){var t;return this.extensions&&this.extensions.length&&this.extensions.some((function(n){return n.name===e&&(t=n,!0)})),t},addBuiltInExtension:function(t,n){var i,o=this.getExtensionByName(t);if(o)return o;switch(t){case"anchor":i=e.util.extend({},this.options.anchor,n),o=new e.extensions.anchor(i);break;case"anchor-preview":o=new e.extensions.anchorPreview(this.options.anchorPreview);break;case"autoLink":o=new e.extensions.autoLink;break;case"fileDragging":o=new e.extensions.fileDragging(n);break;case"fontname":o=new e.extensions.fontName(this.options.fontName);break;case"fontsize":o=new e.extensions.fontSize(n);break;case"keyboardCommands":o=new e.extensions.keyboardCommands(this.options.keyboardCommands);break;case"paste":o=new e.extensions.paste(this.options.paste);break;case"placeholder":o=new e.extensions.placeholder(this.options.placeholder);break;default:e.extensions.button.isBuiltInButton(t)&&(n?(i=e.util.defaults({},n,e.extensions.button.prototype.defaults[t]),o=new e.extensions.button(i)):o=new e.extensions.button(t))}return o&&this.extensions.push(d(o,t,this)),o},stopSelectionUpdates:function(){this.preventSelectionUpdates=!0},startSelectionUpdates:function(){this.preventSelectionUpdates=!1},checkSelection:function(){var e=this.getExtensionByName("toolbar");return e&&e.checkState(),this},queryCommandState:function(e){var t,n=null;(t=/^full-(.+)$/gi.exec(e))&&(e=t[1]);try{n=this.options.ownerDocument.queryCommandState(e)}catch(e){n=null}return n},execAction:function(t,n){var i,o;return(i=/^full-(.+)$/gi.exec(t))?(this.saveSelection(),this.selectAllContents(),o=N.call(this,i[1],n),this.restoreSelection()):o=N.call(this,t,n),"insertunorderedlist"!==t&&"insertorderedlist"!==t||e.util.cleanListDOM(this.options.ownerDocument,this.getSelectedParentElement()),this.checkSelection(),o},getSelectedParentElement:function(t){return void 0===t&&(t=this.options.contentWindow.getSelection().getRangeAt(0)),e.selection.getSelectedParentElement(t)},selectAllContents:function(){var t=e.selection.getSelectionElement(this.options.contentWindow);if(t){for(;1===t.children.length;)t=t.children[0];this.selectElement(t)}},selectElement:function(t){e.selection.selectNode(t,this.options.ownerDocument);var n=e.selection.getSelectionElement(this.options.contentWindow);n&&this.events.focusElement(n)},getFocusedElement:function(){var e;return this.elements.some((function(t){return!e&&t.getAttribute("data-medium-focused")&&(e=t),!!e}),this),e},exportSelection:function(){var t=e.selection.getSelectionElement(this.options.contentWindow),n=this.elements.indexOf(t),i=null;return n>=0&&(i=e.selection.exportSelection(t,this.options.ownerDocument)),null!==i&&0!==n&&(i.editableElementIndex=n),i},saveSelection:function(){this.selectionState=this.exportSelection()},importSelection:function(t,n){if(t){var i=this.elements[t.editableElementIndex||0];e.selection.importSelection(t,i,this.options.ownerDocument,n)}},restoreSelection:function(){this.importSelection(this.selectionState)},createLink:function(t){var n,i=e.selection.getSelectionElement(this.options.contentWindow),o={};if(-1!==this.elements.indexOf(i)){try{if(this.events.disableCustomEvent("editableInput"),t.url&&e.util.deprecated(".url option for createLink",".value","6.0.0"),(n=t.url||t.value)&&n.trim().length>0){var r=this.options.contentWindow.getSelection();if(r){var a,s,l,u,c=r.getRangeAt(0),d=c.commonAncestorContainer;if(3===c.endContainer.nodeType&&3!==c.startContainer.nodeType&&0===c.startOffset&&c.startContainer.firstChild===c.endContainer&&(d=c.endContainer),s=e.util.getClosestBlockContainer(c.startContainer),l=e.util.getClosestBlockContainer(c.endContainer),3!==d.nodeType&&0!==d.textContent.length&&s===l){var h=s||i,f=this.options.ownerDocument.createDocumentFragment();this.execAction("unlink"),a=this.exportSelection(),f.appendChild(h.cloneNode(!0)),i===h?e.selection.select(this.options.ownerDocument,h.firstChild,0,h.lastChild,3===h.lastChild.nodeType?h.lastChild.nodeValue.length:h.lastChild.childNodes.length):e.selection.select(this.options.ownerDocument,h,0,h,h.childNodes.length);var p=this.exportSelection();0===(u=e.util.findOrCreateMatchingTextNodes(this.options.ownerDocument,f,{start:a.start-p.start,end:a.end-p.start,editableElementIndex:a.editableElementIndex})).length&&((f=this.options.ownerDocument.createDocumentFragment()).appendChild(d.cloneNode(!0)),u=[f.firstChild.firstChild,f.firstChild.lastChild]),e.util.createLink(this.options.ownerDocument,u,n.trim());var g=(f.firstChild.innerHTML.match(/^\s+/)||[""])[0].length;e.util.insertHTMLCommand(this.options.ownerDocument,f.firstChild.innerHTML.replace(/^\s+/,"")),a.start-=g,a.end-=g,this.importSelection(a)}else this.options.ownerDocument.execCommand("createLink",!1,n);this.options.targetBlank||"_blank"===t.target?e.util.setTargetBlank(e.selection.getSelectionStart(this.options.ownerDocument),n):e.util.removeTargetBlank(e.selection.getSelectionStart(this.options.ownerDocument),n),t.buttonClass&&e.util.addClassToAnchors(e.selection.getSelectionStart(this.options.ownerDocument),t.buttonClass)}}if(this.options.targetBlank||"_blank"===t.target||t.buttonClass){(o=this.options.ownerDocument.createEvent("HTMLEvents")).initEvent("input",!0,!0,this.options.contentWindow);for(var v=0,m=this.elements.length;v<m;v+=1)this.elements[v].dispatchEvent(o)}}finally{this.events.enableCustomEvent("editableInput")}this.events.triggerCustomEvent("editableInput",o,i)}},cleanPaste:function(e){this.getExtensionByName("paste").cleanPaste(e)},pasteHTML:function(e,t){this.getExtensionByName("paste").pasteHTML(e,t)},setContent:function(e,t){if(t=t||0,this.elements[t]){var n=this.elements[t];n.innerHTML=e,this.checkContentChanged(n)}},getContent:function(e){return e=e||0,this.elements[e]?this.elements[e].innerHTML.trim():null},checkContentChanged:function(t){t=t||e.selection.getSelectionElement(this.options.contentWindow),this.events.updateInput(t,{target:t,currentTarget:t})},resetContent:function(e){if(e){var t=this.elements.indexOf(e);-1!==t&&this.setContent(S[e.getAttribute("medium-editor-index")],t)}else this.elements.forEach((function(e,t){this.setContent(S[e.getAttribute("medium-editor-index")],t)}),this)},addElements:function(e){var t=u(e,this.options.ownerDocument,!0);if(0===t.length)return!1;t.forEach((function(e){e=x.call(this,e,this.id),this.elements.push(e),this.trigger("addElement",{target:e,currentTarget:e},e)}),this)},removeElements:function(e){var t=u(e,this.options.ownerDocument).map((function(e){return e.getAttribute("medium-editor-textarea-id")&&e.parentNode?e.parentNode.querySelector('div[medium-editor-textarea-id="'+e.getAttribute("medium-editor-textarea-id")+'"]'):e}));this.elements=this.elements.filter((function(e){return-1===t.indexOf(e)||(this.events.cleanupElement(e),e.getAttribute("medium-editor-textarea-id")&&c(e),this.trigger("removeElement",{target:e,currentTarget:e},e),!1)}),this)}},e.getEditorFromElement=function(e){var t=e.getAttribute("data-medium-editor-editor-index"),n=e&&e.ownerDocument&&(e.ownerDocument.defaultView||e.ownerDocument.parentWindow);return n&&n._mediumEditors&&n._mediumEditors[t]?n._mediumEditors[t]:null}}(),e.prototype.defaults={activeButtonClass:"medium-editor-button-active",buttonLabels:!1,delay:0,disableReturn:!1,disableDoubleReturn:!1,disableExtraSpaces:!1,disableEditing:!1,autoLink:!1,elementsContainer:!1,contentWindow:window,ownerDocument:document,targetBlank:!1,extensions:{},spellcheck:!0},e.parseVersionString=function(e){var t=e.split("-"),n=t[0].split("."),i=t.length>1?t[1]:"";return{major:parseInt(n[0],10),minor:parseInt(n[1],10),revision:parseInt(n[2],10),preRelease:i,toString:function(){return[n[0],n[1],n[2]].join(".")+(i?"-"+i:"")}}},e.version=e.parseVersionString.call(this,"5.23.3"),e}())}({get exports(){return bv},set exports(e){bv=e}});var xv=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},wv=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),Ev=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{!i&&s.return&&s.return()}finally{if(o)throw r}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};String.prototype.startsWith=String.prototype.startsWith||function(e){return 0===this.indexOf(e)},String.prototype.padStart=String.prototype.padStart||function(e,t){for(var n=this;n.length<e;)n=t+n;return n};var Cv={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function Nv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(t>0?e.toFixed(t).replace(/0+$/,"").replace(/\.$/,""):e.toString())||"0"}var _v=function(){function e(t,n,i,o){xv(this,e);var r=this;if(void 0===t);else if(Array.isArray(t))this.rgba=t;else if(void 0===i){var a=t&&""+t;a&&function(t){if(t.startsWith("hsl")){var n=t.match(/([\-\d\.e]+)/g).map(Number),i=Ev(n,4),o=i[0],a=i[1],s=i[2],l=i[3];void 0===l&&(l=1),o/=360,a/=100,s/=100,r.hsla=[o,a,s,l]}else if(t.startsWith("rgb")){var u=t.match(/([\-\d\.e]+)/g).map(Number),c=Ev(u,4),d=c[0],h=c[1],f=c[2],p=c[3];void 0===p&&(p=1),r.rgba=[d,h,f,p]}else t.startsWith("#")?r.rgba=e.hexToRgb(t):r.rgba=e.nameToRgb(t)||e.hexToRgb(t)}(a.toLowerCase())}else this.rgba=[t,n,i,void 0===o?1:o]}return wv(e,[{key:"printRGB",value:function(e){var t=(e?this.rgba:this.rgba.slice(0,3)).map((function(e,t){return Nv(e,3===t?3:0)}));return e?"rgba("+t+")":"rgb("+t+")"}},{key:"printHSL",value:function(e){var t=[360,100,100,1],n=["","%","%",""],i=(e?this.hsla:this.hsla.slice(0,3)).map((function(e,i){return Nv(e*t[i],3===i?3:1)+n[i]}));return e?"hsla("+i+")":"hsl("+i+")"}},{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=e.hslToRgb(this._hsla)},set:function(e){3===e.length&&(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=e.rgbToHsl(this._rgba)},set:function(e){3===e.length&&(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(){return"#"+this.rgba.map((function(e,t){return t<3?e.toString(16):Math.round(255*e).toString(16)})).map((function(e){return e.padStart(2,"0")})).join("")},set:function(t){this.rgba=e.hexToRgb(t)}}],[{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(e){return parseInt(e,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(t){var n=t.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),i=Cv[n];return void 0===i?i:e.hexToRgb(i.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=Ev(e,4),n=t[0],i=t[1],o=t[2],r=t[3];n/=255,i/=255,o/=255;var a=Math.max(n,i,o),s=Math.min(n,i,o),l=void 0,u=void 0,c=(a+s)/2;if(a===s)l=u=0;else{var d=a-s;switch(u=c>.5?d/(2-a-s):d/(a+s),a){case n:l=(i-o)/d+(i<o?6:0);break;case i:l=(o-n)/d+2;break;case o:l=(n-i)/d+4}l/=6}return[l,u,c,r]}},{key:"hslToRgb",value:function(e){var t=Ev(e,4),n=t[0],i=t[1],o=t[2],r=t[3],a=void 0,s=void 0,l=void 0;if(0===i)a=s=l=o;else{var u=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},c=o<.5?o*(1+i):o+i-o*i,d=2*o-c;a=u(d,c,n+1/3),s=u(d,c,n),l=u(d,c,n-1/3)}var h=[255*a,255*s,255*l].map(Math.round);return h[3]=r,h}}]),e}(),Sv=function(){function e(){xv(this,e),this._events=[]}return wv(e,[{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(t,n,i){this._events=this._events.filter((function(o){var r=!0;return t&&t!==o.target&&(r=!1),n&&n!==o.type&&(r=!1),i&&i!==o.handler&&(r=!1),r&&e._doRemove(o.target,o.type,o.handler),!r}))}},{key:"destroy",value:function(){this._events.forEach((function(t){return e._doRemove(t.target,t.type,t.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(e,t,n){e.removeEventListener(t,n,!1)}}]),e}();function Mv(e,t,n){var i=!1;function o(e,t,n){return Math.max(t,Math.min(e,n))}function r(e,r,a){if(a&&(i=!0),i){e.preventDefault();var s=t.getBoundingClientRect(),l=s.width,u=s.height,c=r.clientX,d=r.clientY,h=o(c-s.left,0,l),f=o(d-s.top,0,u);n(h/l,f/u)}}function a(e,t){1===(void 0===e.buttons?e.which:e.buttons)?r(e,e,t):i=!1}function s(e,t){1===e.touches.length?r(e,e.touches[0],t):i=!1}e.add(t,"mousedown",(function(e){a(e,!0)})),e.add(t,"touchstart",(function(e){s(e,!0)})),e.add(window,"mousemove",a),e.add(t,"touchmove",s),e.add(window,"mouseup",(function(e){i=!1})),e.add(t,"touchend",(function(e){i=!1})),e.add(t,"touchcancel",(function(e){i=!1}))}var Tv="keydown",Av="mousedown",kv="focusin";function Rv(e,t){return(t||document).querySelector(e)}function Dv(e,t,n,i,o){e.add(t,Tv,(function(e){n.indexOf(e.key)>=0&&i(e)}))}var Ov=function(){function e(t){xv(this,e),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Sv,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return wv(e,[{key:"setOptions",value:function(e){var t=this;if(e){var n=this.settings;if(e instanceof HTMLElement)n.parent=e;else{n.parent&&e.parent&&n.parent!==e.parent&&(this._events.remove(n.parent),this._popupInited=!1),function(e,t){for(var n in e)t[n]=e[n]}(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 i=e.color||e.colour;i&&this._setColor(i)}var o=n.parent;if(o&&n.popup&&!this._popupInited){var r=function(e){return t.openHandler(e)};this._events.add(o,"click",r),Dv(this._events,o,[" ","Spacebar","Enter"],r),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===Tv?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)if(t===Av||t===kv){var i=(this.__containedEvent||0)+100;e.timeStamp>i&&(n=!0)}else!function(e){e.preventDefault(),e.stopPropagation()}(e),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",t!==Av&&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("string"==typeof e&&(e=e.trim()),e){t=t||{};var n=void 0;try{n=new _v(e)}catch(e){if(t.failSilently)return;throw e}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(){if(!this.settings.parent)return!1;if(this.domElement){var e=this._toggleDOM(!0);return this._setPosition(),e}var t,n,i=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',o=(t=i,(n=document.createElement("div")).innerHTML=t,n.firstElementChild);return this.domElement=o,this._domH=Rv(".picker_hue",o),this._domSL=Rv(".picker_sl",o),this._domA=Rv(".picker_alpha",o),this._domEdit=Rv(".picker_editor input",o),this._domSample=Rv(".picker_sample",o),this._domOkay=Rv(".picker_done button",o),this._domCancel=Rv(".picker_cancel button",o),o.classList.add("layout_"+this.settings.layout),this.settings.alpha||o.classList.add("no_alpha"),this.settings.editor||o.classList.add("no_editor"),this.settings.cancelButton||o.classList.add("no_cancel"),this._ifPopup((function(){return o.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(e,t,n){i.add(e,t,n)}o(n,"click",(function(e){return e.preventDefault()})),Mv(i,this._domH,(function(e,n){return t._setHSLA(e)})),Mv(i,this._domSL,(function(e,n){return t._setHSLA(null,e,1-n)})),this.settings.alpha&&Mv(i,this._domA,(function(e,n){return t._setHSLA(null,null,null,1-n)}));var r=this._domEdit;o(r,"input",(function(e){t._setColor(this.value,{fromEditor:!0,failSilently:!0})})),o(r,"focus",(function(e){var t=this;t.selectionStart===t.selectionEnd&&t.select()})),this._ifPopup((function(){var t=function(t){return e.closeHandler(t)};o(window,Av,t),o(window,kv,t),Dv(i,n,["Esc","Escape"],t);var r=function(t){e.__containedEvent=t.timeStamp};o(n,Av,r),o(n,kv,r),o(e._domCancel,"click",t)}));var a=function(t){e._ifPopup((function(){return e.closeHandler(t)})),e.onDone&&e.onDone(e.colour)};o(this._domOkay,"click",a),Dv(i,n,["Enter"],a)}},{key:"_setPosition",value:function(){var e=this.settings.parent,t=this.domElement;e!==t.parentNode&&e.appendChild(t),this._ifPopup((function(n){"static"===getComputedStyle(e).position&&(e.style.position="relative");var i=!0===n?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(e){e===i?t.classList.add(e):t.classList.remove(e)})),t.classList.add(i)}))}},{key:"_setHSLA",value:function(e,t,n,i,o){o=o||{};var r=this.colour,a=r.hsla;[e,t,n,i].forEach((function(e,t){(e||0===e)&&(a[t]=e)})),r.hsla=a,this._updateUI(o),this.onChange&&!o.silent&&this.onChange(r)}},{key:"_updateUI",value:function(e){if(this.domElement){e=e||{};var t=this.colour,n=t.hsla,i="hsl("+360*n[0]+", 100%, 50%)",o=t.hslString,r=t.hslaString,a=this._domH,s=this._domSL,l=this._domA,u=Rv(".picker_selector",a),c=Rv(".picker_selector",s),d=Rv(".picker_selector",l);y(0,u,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=i,y(0,c,n[1]),b(0,c,1-n[2]),s.style.color=o,b(0,d,1-n[3]);var h=o,f=h.replace("hsl","hsla").replace(")",", 0)"),p="linear-gradient("+[h,f]+")";if(this._domA.style.background=p+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!e.fromEditor){var g=this.settings.editorFormat,v=this.settings.alpha,m=void 0;switch(g){case"rgb":m=t.printRGB(v);break;case"hsl":m=t.printHSL(v);break;default:m=t.printHex(v)}this._domEdit.value=m}this._domSample.style.color=r}function y(e,t,n){t.style.left=100*n+"%"}function b(e,t,n){t.style.top=100*n+"%"}}},{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}}]),e}(),Pv=document.createElement("style");Pv.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(Pv),Ov.StyleElement=Pv;var Iv={};!function(e){e.exports=function(){var e="object",t="function",n="undefined",i=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],o=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],r=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],a=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"];function s(n,i){var o=typeof n[i];return o==t||!(o!=e||!n[i])||"unknown"==o}function l(t,n){return!(typeof t[n]!=e||!t[n])}function u(e,t){return typeof e[t]!=n}function c(e){return function(t,n){for(var i=n.length;i--;)if(!e(t,n[i]))return!1;return!0}}var d=c(s),h=c(l),f=c(u);function p(e){return e&&d(e,a)&&f(e,r)}function g(e){return l(e,"body")?e.body:e.getElementsByTagName("body")[0]}var v,m,y=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,i=e.length;n<i;++n)t(e[n],n)},b={},x=typeof window!=n&&typeof document!=n,w={isHostMethod:s,isHostObject:l,isHostProperty:u,areHostMethods:d,areHostObjects:h,areHostProperties:f,isTextRange:p,getBody:g,forEach:y},E={version:"1.3.1",initialized:!1,isBrowser:x,supported:!0,util:w,features:{},modules:b,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==n||rangyAutoInitialize}};function C(e){typeof console!=n&&s(console,"log")}function N(e,t){x&&t?alert(e):C(e)}function _(e){E.initialized=!0,E.supported=!1,N("Rangy is not supported in this environment. Reason: "+e,E.config.alertOnFail)}function S(e){N("Rangy warning: "+e,E.config.alertOnWarn)}E.fail=_,E.warn=S,{}.hasOwnProperty?(w.extend=v=function(e,t,n){var i,o;for(var r in t)t.hasOwnProperty(r)&&(i=e[r],o=t[r],n&&null!==i&&"object"==typeof i&&null!==o&&"object"==typeof o&&v(i,o,!0),e[r]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},w.createOptions=function(e,t){var n={};return v(n,t),e&&v(n,e),n}):_("hasOwnProperty not supported"),x||_("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(e){}}e||(e=function(e){for(var t=[],n=0,i=e.length;n<i;++n)t[n]=e[n];return t}),w.toArray=e}(),x&&(s(document,"addEventListener")?m=function(e,t,n){e.addEventListener(t,n,!1)}:s(document,"attachEvent")?m=function(e,t,n){e.attachEvent("on"+t,n)}:_("Document does not have required addEventListener or attachEvent method"),w.addListener=m);var M=[];function T(e){return e.message||e.description||String(e)}function A(){if(x&&!E.initialized){var e,t=!1,n=!1;s(document,"createRange")&&(e=document.createRange(),d(e,o)&&f(e,i)&&(t=!0));var r=g(document);if(r&&"body"==r.nodeName.toLowerCase())if(r&&s(r,"createTextRange")&&p(e=r.createTextRange())&&(n=!0),t||n){var a;for(var l in E.initialized=!0,E.features={implementsDomRange:t,implementsTextRange:n},b)(a=b[l])instanceof P&&a.init(a,E);for(var u=0,c=M.length;u<c;++u)try{M[u](E)}catch(e){C("Rangy init listener threw an exception. Continuing. Detail: "+T(e))}}else _("Neither Range nor TextRange are available");else _("No body element found")}}function k(e,t,n){n&&(e+=" in module "+n.name),E.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function R(e,t,n,i){e[t]=function(){return k(t,n,i),e[n].apply(e,w.toArray(arguments))}}w.deprecationNotice=k,w.createAliasForDeprecatedMethod=R,E.init=A,E.addInitListener=function(e){E.initialized?e(E):M.push(e)};var D=[];function O(e){e=e||window,A();for(var t=0,n=D.length;t<n;++t)D[t](e)}function P(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function I(e,t,n){var i=new P(e,t,(function(t){if(!t.initialized){t.initialized=!0;try{n(E,t),t.supported=!0}catch(t){C("Module '"+e+"' failed to load: "+T(t)),t.stack&&C(t.stack)}}}));return b[e]=i,i}function L(){}function B(){}E.addShimListener=function(e){D.push(e)},x&&(E.shim=E.createMissingNativeApi=O,R(E,"createMissingNativeApi","shim")),P.prototype={init:function(){for(var e,t,n=this.dependencies||[],i=0,o=n.length;i<o;++i){if(t=n[i],!((e=b[t])&&e instanceof P))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){E.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){E.warn("DEPRECATED: "+e+" in module "+this.name+" is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},E.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var i=I(e,n,t);E.initialized&&E.supported&&i.init()},E.createCoreModule=function(e,t,n){I(e,t,n)},E.RangePrototype=L,E.rangePrototype=new L,E.selectionPrototype=new B,E.createCoreModule("DomUtil",[],(function(e,t){var n="undefined",i=e.util,o=i.getBody;i.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),i.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var r=document.createElement("div");i.areHostMethods(r,["insertBefore","appendChild","cloneNode"]||!i.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),i.isHostProperty(r,"innerHTML")||t.fail("Element is missing innerHTML property");var a=document.createTextNode("test");i.areHostMethods(a,["splitText","deleteData","insertData","appendData","cloneNode"]||!i.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"])||!i.areHostProperties(a,["data"]))||t.fail("Incomplete Text Node implementation");var s=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1};function l(e){var t;return typeof e.namespaceURI==n||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function u(e){var t=e.parentNode;return 1==t.nodeType?t:null}function c(e){for(var t=0;e=e.previousSibling;)++t;return t}function d(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function h(e,t){var n,i=[];for(n=e;n;n=n.parentNode)i.push(n);for(n=t;n;n=n.parentNode)if(s(i,n))return n;return null}function f(e,t,n){for(var i=n?t:t.parentNode;i;){if(i===e)return!0;i=i.parentNode}return!1}function p(e,t){return f(e,t,!0)}function g(e,t,n){for(var i,o=n?e:e.parentNode;o;){if((i=o.parentNode)===t)return o;o=i}return null}function v(e){var t=e.nodeType;return 3==t||4==t||8==t}function m(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function y(e,t){var n=t.nextSibling,i=t.parentNode;return n?i.insertBefore(e,n):i.appendChild(e),e}function b(e,t,n){var i=e.cloneNode(!1);if(i.deleteData(0,t),e.deleteData(t,e.length-t),y(i,e),n)for(var o,r=0;o=n[r++];)o.node==e&&o.offset>t?(o.node=i,o.offset-=t):o.node==e.parentNode&&o.offset>c(e)&&++o.offset;return i}function x(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=n)return e.ownerDocument;if(typeof e.document!=n)return e.document;if(e.parentNode)return x(e.parentNode);throw t.createError("getDocument: no document found for node")}function w(e){var i=x(e);if(typeof i.defaultView!=n)return i.defaultView;if(typeof i.parentWindow!=n)return i.parentWindow;throw t.createError("Cannot get a window object for node")}function E(e){if(typeof e.contentDocument!=n)return e.contentDocument;if(typeof e.contentWindow!=n)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function C(e){if(typeof e.contentWindow!=n)return e.contentWindow;if(typeof e.contentDocument!=n)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function N(e){return e&&i.isHostMethod(e,"setTimeout")&&i.isHostObject(e,"document")}function _(e,t,n){var o;if(e?i.isHostProperty(e,"nodeType")?o=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?E(e):x(e):N(e)&&(o=e.document):o=document,!o)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return o}function S(e){for(var t;t=e.parentNode;)e=t;return e}function M(e,n,i,o){var r,a,s,l,u;if(e==i)return n===o?0:n<o?-1:1;if(r=g(i,e,!0))return n<=c(r)?-1:1;if(r=g(e,i,!0))return c(r)<o?-1:1;if(!(a=h(e,i)))throw new Error("comparePoints error: nodes have no common ancestor");if((s=e===a?a:g(e,a,!0))===(l=i===a?a:g(i,a,!0)))throw t.createError("comparePoints got to case 4 and childA and childB are the same!");for(u=a.firstChild;u;){if(u===s)return-1;if(u===l)return 1;u=u.nextSibling}}var T,A=!1;function k(e){try{return e.parentNode,!1}catch(e){return!0}}function R(e){if(!e)return"[No node]";if(A&&k(e))return"[Broken node]";if(v(e))return'"'+e.data+'"';if(1==e.nodeType){var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">[index:"+c(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function D(e){for(var t,n=x(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function O(e,t,n){var i=o(e),r=e.createElement("div");r.contentEditable=""+!!n,t&&(r.innerHTML=t);var a=i.firstChild;return a?i.insertBefore(r,a):i.appendChild(r),r}function P(e){return e.parentNode.removeChild(e)}function I(e){this.root=e,this._next=e}function L(e){return new I(e)}function B(e,t){this.node=e,this.offset=t}function j(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="<br />",A=k(n),e.features.crashyTextNodes=A}(),typeof window.getComputedStyle!=n?T=function(e,t){return w(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=n?T=function(e,t){return e.currentStyle?e.currentStyle[t]:""}:t.fail("No means of obtaining computed style properties found"),I.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},B.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+R(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},j.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},j.prototype.toString=function(){return this.message},e.dom={arrayContains:s,isHtmlNamespace:l,parentElement:u,getNodeIndex:c,getNodeLength:d,getCommonAncestor:h,isAncestorOf:f,isOrIsAncestorOf:p,getClosestAncestorIn:g,isCharacterDataNode:v,isTextOrCommentNode:m,insertAfter:y,splitDataNode:b,getDocument:x,getWindow:w,getIframeWindow:C,getIframeDocument:E,getBody:o,isWindow:N,getContentDocument:_,getRootContainer:S,comparePoints:M,isBrokenNode:k,inspectNode:R,getComputedStyleProperty:T,createTestElement:O,removeNode:P,fragmentFromNodeChildren:D,createIterator:L,DomPosition:B},e.DOMException=j})),E.createCoreModule("DomRange",["DomUtil"],(function(e,t){var n=e.dom,i=e.util,o=n.DomPosition,r=e.DOMException,a=n.isCharacterDataNode,s=n.getNodeIndex,l=n.isOrIsAncestorOf,u=n.getDocument,c=n.comparePoints,d=n.splitDataNode,h=n.getClosestAncestorIn,f=n.getNodeLength,p=n.arrayContains,g=n.getRootContainer,v=e.features.crashyTextNodes,m=n.removeNode;function y(e,t){return 3!=e.nodeType&&(l(e,t.startContainer)||l(e,t.endContainer))}function b(e){return e.document||u(e.startContainer)}function x(e){return g(e.startContainer)}function w(e){return new o(e.parentNode,s(e))}function E(e){return new o(e.parentNode,s(e)+1)}function C(e,t,i){var o=11==e.nodeType?e.firstChild:e;return a(t)?i==t.length?n.insertAfter(e,t):t.parentNode.insertBefore(e,0==i?t:d(t,i)):i>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[i]),o}function N(e,t,n){if($(e),$(t),b(t)!=b(e))throw new r("WRONG_DOCUMENT_ERR");var i=c(e.startContainer,e.startOffset,t.endContainer,t.endOffset),o=c(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return n?i<=0&&o>=0:i<0&&o>0}function _(e){for(var t,n,i,o=b(e.range).createDocumentFragment();n=e.next();){if(t=e.isPartiallySelectedSubtree(),n=n.cloneNode(!t),t&&(i=e.getSubtreeIterator(),n.appendChild(_(i)),i.detach()),10==n.nodeType)throw new r("HIERARCHY_REQUEST_ERR");o.appendChild(n)}return o}function S(e,t,i){var o,r,a,s;for(i=i||{stop:!1};a=e.next();)if(e.isPartiallySelectedSubtree()){if(!1===t(a))return void(i.stop=!0);if(S(s=e.getSubtreeIterator(),t,i),s.detach(),i.stop)return}else for(o=n.createIterator(a);r=o.next();)if(!1===t(r))return void(i.stop=!0)}function M(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(M(t=e.getSubtreeIterator()),t.detach()):e.remove()}function T(e){for(var t,n,i=b(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),n=e.getSubtreeIterator(),t.appendChild(T(n)),n.detach()):e.remove(),10==t.nodeType)throw new r("HIERARCHY_REQUEST_ERR");i.appendChild(t)}return i}function A(e,t,n){var i,o=!(!t||!t.length),r=!!n;o&&(i=new RegExp("^("+t.join("|")+")$"));var s=[];return S(new R(e,!1),(function(t){if((!o||i.test(t.nodeType))&&(!r||n(t))){var l=e.startContainer;if(t!=l||!a(l)||e.startOffset!=l.length){var u=e.endContainer;t==u&&a(u)&&0==e.endOffset||s.push(t)}}})),s}function k(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+n.inspectNode(e.startContainer)+":"+e.startOffset+", "+n.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function R(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&a(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||a(this.sc)?h(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||a(this.ec)?h(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}R.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 e=this._current=this._next;return e&&(this._next=e!==this._last?e.nextSibling:null,a(e)&&this.clonePartiallySelectedTextNodes&&(e===this.ec&&(e=e.cloneNode(!0)).deleteData(this.eo,e.length-this.eo),this._current===this.sc&&(e=e.cloneNode(!0)).deleteData(0,this.so))),e},remove:function(){var e,t,n=this._current;!a(n)||n!==this.sc&&n!==this.ec?n.parentNode&&m(n):(e=n===this.sc?this.so:0)!=(t=n===this.ec?this.eo:n.length)&&n.deleteData(e,t-e)},isPartiallySelectedSubtree:function(){return y(this._current,this.range)},getSubtreeIterator:function(){var e;if(this.isSingleCharacterDataNode)(e=this.range.cloneRange()).collapse(!1);else{e=new me(b(this.range));var t=this._current,n=t,i=0,o=t,r=f(t);l(t,this.sc)&&(n=this.sc,i=this.so),l(t,this.ec)&&(o=this.ec,r=this.eo),ve(e,n,i,o,r)}return new R(e,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var D=[1,3,4,5,7,8,10],O=[2,9,11],P=[5,6,10,12],I=[1,3,4,5,7,8,10,11],L=[1,3,4,5,7,8];function B(e){return function(t,n){for(var i,o=n?t:t.parentNode;o;){if(i=o.nodeType,p(e,i))return o;o=o.parentNode}return null}}var j=B([9,11]),F=B(P),H=B([6,10,12]),W=B([1]);function z(e,t){if(H(e,t))throw new r("INVALID_NODE_TYPE_ERR")}function G(e,t){if(!p(t,e.nodeType))throw new r("INVALID_NODE_TYPE_ERR")}function U(e,t){if(t<0||t>(a(e)?e.length:e.childNodes.length))throw new r("INDEX_SIZE_ERR")}function q(e,t){if(j(e,!0)!==j(t,!0))throw new r("WRONG_DOCUMENT_ERR")}function X(e){if(F(e,!0))throw new r("NO_MODIFICATION_ALLOWED_ERR")}function V(e,t){if(!e)throw new r(t)}function K(e,t){return t<=(a(e)?e.length:e.childNodes.length)}function Y(e){return!!e.startContainer&&!!e.endContainer&&!(v&&(n.isBrokenNode(e.startContainer)||n.isBrokenNode(e.endContainer)))&&g(e.startContainer)==g(e.endContainer)&&K(e.startContainer,e.startOffset)&&K(e.endContainer,e.endOffset)}function $(e){if(!Y(e))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+e.inspect()+")")}var Z=document.createElement("style"),J=!1;try{Z.innerHTML="<b>x</b>",J=3==Z.firstChild.nodeType}catch(e){}e.features.htmlParsingConforms=J;var Q=J?function(e){var t=this.startContainer,i=u(t);if(!t)throw new r("INVALID_STATE_ERR");var o=null;return 1==t.nodeType?o=t:a(t)&&(o=n.parentElement(t)),(o=null===o||"HTML"==o.nodeName&&n.isHtmlNamespace(u(o).documentElement)&&n.isHtmlNamespace(o)?i.createElement("body"):o.cloneNode(!1)).innerHTML=e,n.fragmentFromNodeChildren(o)}:function(e){var t=b(this).createElement("body");return t.innerHTML=e,n.fragmentFromNodeChildren(t)};function ee(e,t){$(e);var n=e.startContainer,i=e.startOffset,o=e.endContainer,r=e.endOffset,l=n===o;a(o)&&r>0&&r<o.length&&d(o,r,t),a(n)&&i>0&&i<n.length&&(n=d(n,i,t),l?(r-=i,o=n):o==n.parentNode&&r>=s(n)&&r++,i=0),e.setStartAndEnd(n,i,o,r)}function te(e){$(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}var ne=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ie=0,oe=1,re=2,ae=3,se=0,le=1,ue=2,ce=3;function de(e){e.START_TO_START=ie,e.START_TO_END=oe,e.END_TO_END=re,e.END_TO_START=ae,e.NODE_BEFORE=se,e.NODE_AFTER=le,e.NODE_BEFORE_AND_AFTER=ue,e.NODE_INSIDE=ce}function he(e){de(e),de(e.prototype)}function fe(e,t){return function(){$(this);var n,i=this.startContainer,o=this.startOffset,r=this.commonAncestorContainer,a=new R(this,!0);i!==r&&(i=(n=E(h(i,r,!0))).node,o=n.offset),S(a,X),a.reset();var s=e(a);return a.detach(),t(this,i,o,i,o),s}}function pe(t,n){function o(e,t){return function(n){G(n,D),G(g(n),O);var i=(e?w:E)(n);(t?r:l)(this,i.node,i.offset)}}function r(e,t,i){var o=e.endContainer,r=e.endOffset;t===e.startContainer&&i===e.startOffset||(g(t)==g(o)&&1!=c(t,i,o,r)||(o=t,r=i),n(e,t,i,o,r))}function l(e,t,i){var o=e.startContainer,r=e.startOffset;t===e.endContainer&&i===e.endOffset||(g(t)==g(o)&&-1!=c(t,i,o,r)||(o=t,r=i),n(e,o,r,t,i))}var u=function(){};u.prototype=e.rangePrototype,t.prototype=new u,i.extend(t.prototype,{setStart:function(e,t){z(e,!0),U(e,t),r(this,e,t)},setEnd:function(e,t){z(e,!0),U(e,t),l(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],i=e[1],o=t,r=i;switch(e.length){case 3:r=e[2];break;case 4:o=e[2],r=e[3]}z(t,!0),U(t,i),z(o,!0),U(o,r),n(this,t,i,o,r)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:o(!0,!0),setStartAfter:o(!1,!0),setEndBefore:o(!0,!1),setEndAfter:o(!1,!1),collapse:function(e){$(this),e?n(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):n(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){z(e,!0),n(this,e,0,e,f(e))},selectNode:function(e){z(e,!1),G(e,D);var t=w(e),i=E(e);n(this,t.node,t.offset,i.node,i.offset)},extractContents:fe(T,n),deleteContents:fe(M,n),canSurroundContents:function(){$(this),X(this.startContainer),X(this.endContainer);var e=new R(this,!0),t=e._first&&y(e._first,this)||e._last&&y(e._last,this);return e.detach(),!t},splitBoundaries:function(){ee(this)},splitBoundariesPreservingPositions:function(e){ee(this,e)},normalizeBoundaries:function(){$(this);var e,t=this.startContainer,i=this.startOffset,o=this.endContainer,r=this.endOffset,l=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(o=e,r=e.length,e.appendData(t.data),m(t))},u=function(e){var n=e.previousSibling;if(n&&n.nodeType==e.nodeType){t=e;var a=e.length;if(i=n.length,e.insertData(0,n.data),m(n),t==o)r+=i,o=t;else if(o==e.parentNode){var l=s(e);r==l?(o=e,r=a):r>l&&r--}}},c=!0;if(a(o))r==o.length?l(o):0==r&&(e=o.previousSibling)&&e.nodeType==o.nodeType&&(r=e.length,t==o&&(c=!1),e.appendData(o.data),m(o),o=e);else{if(r>0){var d=o.childNodes[r-1];d&&a(d)&&l(d)}c=!this.collapsed}if(c){if(a(t))0==i?u(t):i==t.length&&(e=t.nextSibling)&&e.nodeType==t.nodeType&&(o==e&&(o=t,r+=t.length),t.appendData(e.data),m(e));else if(i<t.childNodes.length){var h=t.childNodes[i];h&&a(h)&&u(h)}}else t=o,i=r;n(this,t,i,o,r)},collapseToPoint:function(e,t){z(e,!0),U(e,t),this.setStartAndEnd(e,t)},parentElement:function(){return $(this),this.commonAncestorContainer?W(this.commonAncestorContainer,!0):null}}),he(t)}function ge(e){e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e.commonAncestorContainer=e.collapsed?e.startContainer:n.getCommonAncestor(e.startContainer,e.endContainer)}function ve(e,t,i,o,r){e.startContainer=t,e.startOffset=i,e.endContainer=o,e.endOffset=r,e.document=n.getDocument(t),ge(e)}function me(e){ve(this,e,0,e,0)}i.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){var n,i,o,r;$(this),q(this.startContainer,t.startContainer);var a=e==ae||e==ie?"start":"end",s=e==oe||e==ie?"start":"end";return n=this[a+"Container"],i=this[a+"Offset"],o=t[s+"Container"],r=t[s+"Offset"],c(n,i,o,r)},insertNode:function(e){if($(this),G(e,I),X(this.startContainer),l(e,this.startContainer))throw new r("HIERARCHY_REQUEST_ERR");var t=C(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){var e,t;if($(this),this.collapsed)return b(this).createDocumentFragment();if(this.startContainer===this.endContainer&&a(this.startContainer))return(e=this.startContainer.cloneNode(!0)).data=e.data.slice(this.startOffset,this.endOffset),(t=b(this).createDocumentFragment()).appendChild(e),t;var n=new R(this,!0);return e=_(n),n.detach(),e},canSurroundContents:function(){$(this),X(this.startContainer),X(this.endContainer);var e=new R(this,!0),t=e._first&&y(e._first,this)||e._last&&y(e._last,this);return e.detach(),!t},surroundContents:function(e){if(G(e,L),!this.canSurroundContents())throw new r("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);C(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){$(this);for(var e,t=new me(b(this)),n=ne.length;n--;)t[e=ne[n]]=this[e];return t},toString:function(){$(this);var e=this.startContainer;if(e===this.endContainer&&a(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new R(this,!0);return S(n,(function(e){3!=e.nodeType&&4!=e.nodeType||t.push(e.data)})),n.detach(),t.join("")},compareNode:function(e){$(this);var t=e.parentNode,n=s(e);if(!t)throw new r("NOT_FOUND_ERR");var i=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return i<0?o>0?ue:se:o>0?le:ce},comparePoint:function(e,t){return $(this),V(e,"HIERARCHY_REQUEST_ERR"),q(e,this.startContainer),c(e,t,this.startContainer,this.startOffset)<0?-1:c(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:Q,toHtml:function(){return te(this)},intersectsNode:function(e,t){if($(this),g(e)!=x(this))return!1;var n=e.parentNode,i=s(e);if(!n)return!0;var o=c(n,i,this.endContainer,this.endOffset),r=c(n,i+1,this.startContainer,this.startOffset);return t?o<=0&&r>=0:o<0&&r>0},isPointInRange:function(e,t){return $(this),V(e,"HIERARCHY_REQUEST_ERR"),q(e,this.startContainer),c(e,t,this.startContainer,this.startOffset)>=0&&c(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return N(this,e,!1)},intersectsOrTouchesRange:function(e){return N(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=c(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=c(this.endContainer,this.endOffset,e.endContainer,e.endOffset),i=this.cloneRange();return-1==t&&i.setStart(e.startContainer,e.startOffset),1==n&&i.setEnd(e.endContainer,e.endOffset),i}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==c(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==c(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new r("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==ce},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,f(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var i=n.pop();return t.setEnd(i,i.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return $(this),A(this,e,t)},getDocument:function(){return b(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var i=b(this),o=e.createRange(i);t=t||n.getBody(i),o.selectNodeContents(t);var r=this.intersection(o),a=0,s=0;return r&&(o.setEnd(r.startContainer,r.startOffset),s=(a=o.toString().length)+r.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var i,o,r,a,s=[t],l=!1,u=!1;!u&&(i=s.pop());)if(3==i.nodeType)o=n+i.length,!l&&e.start>=n&&e.start<=o&&(this.setStart(i,e.start-n),l=!0),l&&e.end>=n&&e.end<=o&&(this.setEnd(i,e.end-n),u=!0),n=o;else for(r=(a=i.childNodes).length;r--;)s.push(a[r])},getName:function(){return"DomRange"},equals:function(e){return me.rangesEqual(this,e)},isValid:function(){return Y(this)},inspect:function(){return k(this)},detach:function(){}}),pe(me,ve),i.extend(me,{rangeProperties:ne,RangeIterator:R,copyComparisonConstants:he,createPrototypeRange:pe,inspect:k,toHtml:te,getRangeDocument:b,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=me})),E.createCoreModule("WrappedRange",["DomRange"],(function(e,t){var n,i,o=e.dom,r=e.util,a=o.DomPosition,s=e.DomRange,l=o.getBody,u=o.getContentDocument,c=o.isCharacterDataNode;if(e.features.implementsDomRange&&function(){var i,a,c=s.rangeProperties;function d(e){for(var t,n=c.length;n--;)e[t=c[n]]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function h(e,t,n,i,o){var r=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==i||e.endOffset!=o,s=!e.equals(e.nativeRange);(r||a||s)&&(e.setEnd(i,o),e.setStart(t,n))}n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,d(this)},s.createPrototypeRange(n,h),(i=n.prototype).selectNode=function(e){this.nativeRange.selectNode(e),d(this)},i.cloneContents=function(){return this.nativeRange.cloneContents()},i.surroundContents=function(e){this.nativeRange.surroundContents(e),d(this)},i.collapse=function(e){this.nativeRange.collapse(e),d(this)},i.cloneRange=function(){return new n(this.nativeRange.cloneRange())},i.refresh=function(){d(this)},i.toString=function(){return this.nativeRange.toString()};var f=document.createTextNode("test");l(document).appendChild(f);var p=document.createRange();p.setStart(f,0),p.setEnd(f,0);try{p.setStart(f,1),i.setStart=function(e,t){this.nativeRange.setStart(e,t),d(this)},i.setEnd=function(e,t){this.nativeRange.setEnd(e,t),d(this)},a=function(e){return function(t){this.nativeRange[e](t),d(this)}}}catch(e){i.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}d(this)},i.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}d(this)},a=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(i){this.nativeRange[t](n),this.nativeRange[e](n)}d(this)}}}i.setStartBefore=a("setStartBefore","setEndBefore"),i.setStartAfter=a("setStartAfter","setEndAfter"),i.setEndBefore=a("setEndBefore","setStartBefore"),i.setEndAfter=a("setEndAfter","setStartAfter"),i.selectNodeContents=function(e){this.setStartAndEnd(e,0,o.getNodeLength(e))},p.selectNodeContents(f),p.setEnd(f,3);var g=document.createRange();g.selectNodeContents(f),g.setEnd(f,4),g.setStart(f,2),-1==p.compareBoundaryPoints(p.START_TO_END,g)&&1==p.compareBoundaryPoints(p.END_TO_START,g)?i.compareBoundaryPoints=function(e,t){return e==(t=t.nativeRange||t).START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:i.compareBoundaryPoints=function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var v=document.createElement("div");v.innerHTML="123";var m=v.firstChild,y=l(document);y.appendChild(v),p.setStart(m,1),p.setEnd(m,2),p.deleteContents(),"13"==m.data&&(i.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},i.extractContents=function(){var e=this.nativeRange.extractContents();return d(this),e}),y.removeChild(v),y=null,r.isHostMethod(p,"createContextualFragment")&&(i.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),l(document).removeChild(f),i.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return(e=u(e,t,"createNativeRange")).createRange()}}(),e.features.implementsTextRange){var d=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var i=n.parentElement();(n=e.duplicate()).collapse(!1);var r=n.parentElement(),a=i==r?i:o.getCommonAncestor(i,r);return a==t?a:o.getCommonAncestor(t,a)},h=function(e){return 0==e.compareEndPoints("StartToEnd",e)},f=function(e,t,n,i,r){var s=e.duplicate();s.collapse(n);var l=s.parentElement();if(o.isOrIsAncestorOf(t,l)||(l=t),!l.canHaveHTML){var u=new a(l.parentNode,o.getNodeIndex(l));return{boundaryPosition:u,nodeInfo:{nodeIndex:u.offset,containerElement:u.node}}}var d=o.getDocument(l).createElement("span");d.parentNode&&o.removeNode(d);for(var h,f,p,g,v,m=n?"StartToStart":"StartToEnd",y=r&&r.containerElement==l?r.nodeIndex:0,b=l.childNodes.length,x=b,w=x;w==b?l.appendChild(d):l.insertBefore(d,l.childNodes[w]),s.moveToElementText(d),0!=(h=s.compareEndPoints(m,e))&&y!=x;){if(-1==h){if(x==y+1)break;y=w}else x=x==y+1?y:w;w=Math.floor((y+x)/2),l.removeChild(d)}if(v=d.nextSibling,-1==h&&v&&c(v)){var E;if(s.setEndPoint(n?"EndToStart":"EndToEnd",e),/[\r\n]/.test(v.data)){var C=s.duplicate(),N=C.text.replace(/\r\n/g,"\r").length;for(E=C.moveStart("character",N);-1==(h=C.compareEndPoints("StartToEnd",C));)E++,C.moveStart("character",1)}else E=s.text.length;g=new a(v,E)}else f=(i||!n)&&d.previousSibling,g=(p=(i||n)&&d.nextSibling)&&c(p)?new a(p,0):f&&c(f)?new a(f,f.data.length):new a(l,o.getNodeIndex(d));return o.removeNode(d),{boundaryPosition:g,nodeInfo:{nodeIndex:w,containerElement:l}}},p=function(e,t){var n,i,r,a,s=e.offset,u=o.getDocument(e.node),d=l(u).createTextRange(),h=c(e.node);return h?i=(n=e.node).parentNode:(n=s<(a=e.node.childNodes).length?a[s]:null,i=e.node),(r=u.createElement("span")).innerHTML="&#feff;",n?i.insertBefore(r,n):i.appendChild(r),d.moveToElementText(r),d.collapse(!t),i.removeChild(r),h&&d[t?"moveStart":"moveEnd"]("character",s),d};(i=function(e){this.textRange=e,this.refresh()}).prototype=new s(document),i.prototype.refresh=function(){var e,t,n,i=d(this.textRange);h(this.textRange)?t=e=f(this.textRange,i,!0,!0).boundaryPosition:(e=(n=f(this.textRange,i,!0,!1)).boundaryPosition,t=f(this.textRange,i,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(e.node,e.offset),this.setEnd(t.node,t.offset)},i.prototype.getName=function(){return"WrappedTextRange"},s.copyComparisonConstants(i);var g=function(e){if(e.collapsed)return p(new a(e.startContainer,e.startOffset),!0);var t=p(new a(e.startContainer,e.startOffset),!0),n=p(new a(e.endContainer,e.endOffset),!1),i=l(s.getRangeDocument(e)).createTextRange();return i.setEndPoint("StartToStart",t),i.setEndPoint("EndToEnd",n),i};if(i.rangeToTextRange=g,i.prototype.toTextRange=function(){return g(this)},e.WrappedTextRange=i,!e.features.implementsDomRange||e.config.preferTextRange){var v=Function("return this;")();void 0===v.Range&&(v.Range=i),e.createNativeRange=function(e){return e=u(e,t,"createNativeRange"),l(e).createTextRange()},e.WrappedRange=i}}e.createRange=function(n){return n=u(n,t,"createRange"),new e.WrappedRange(e.createNativeRange(n))},e.createRangyRange=function(e){return e=u(e,t,"createRangyRange"),new s(e)},r.createAliasForDeprecatedMethod(e,"createIframeRange","createRange"),r.createAliasForDeprecatedMethod(e,"createIframeRangyRange","createRangyRange"),e.addShimListener((function(t){var n=t.document;void 0===n.createRange&&(n.createRange=function(){return e.createRange(n)}),n=t=null}))})),E.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(e,t){e.config.checkSelectionRanges=!0;var n,i,o="boolean",r="number",a=e.dom,s=e.util,l=s.isHostMethod,u=e.DomRange,c=e.WrappedRange,d=e.DOMException,h=a.DomPosition,f=e.features,p="Control",g=a.getDocument,v=a.getBody,m=u.rangesEqual;function y(e){return"string"==typeof e?/^backward(s)?$/i.test(e):!!e}function b(e,n){if(e){if(a.isWindow(e))return e;if(e instanceof $)return e.win;var i=a.getContentDocument(e,t,n);return a.getWindow(i)}return window}function x(e){return b(e,"getWinSelection").getSelection()}function w(e){return b(e,"getDocSelection").document.selection}function E(e){var t=!1;return e.anchorNode&&(t=1==a.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)),t}var C=l(window,"getSelection"),N=s.isHostObject(document,"selection");f.implementsWinGetSelection=C,f.implementsDocSelection=N;var _=N&&(!C||e.config.preferTextRange);if(_)n=w,e.isSelectionValid=function(e){var t=b(e,"isSelectionValid").document,n=t.selection;return"None"!=n.type||g(n.createRange().parentElement())==t};else{if(!C)return t.fail("Neither document.selection or window.getSelection() detected."),!1;n=x,e.isSelectionValid=function(){return!0}}e.getNativeSelection=n;var S=n();if(!S)return t.fail("Native selection was null (possibly issue 138?)"),!1;var M=e.createNativeRange(document),T=v(document),A=s.areHostProperties(S,["anchorNode","focusNode","anchorOffset","focusOffset"]);f.selectionHasAnchorAndFocus=A;var k=l(S,"extend");f.selectionHasExtend=k;var R=l(S,"setBaseAndExtent");f.selectionHasSetBaseAndExtent=R;var D=typeof S.rangeCount==r;f.selectionHasRangeCount=D;var O=!1,P=!0,I=k?function(t,n){var i=u.getRangeDocument(n),o=e.createRange(i);o.collapseToPoint(n.endContainer,n.endOffset),t.addRange(G(o)),t.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(S,["addRange","getRangeAt","removeAllRanges"])&&typeof S.rangeCount==r&&f.implementsDomRange&&function(){var t=window.getSelection();if(t){for(var n=t.rangeCount,i=n>1,o=[],r=E(t),s=0;s<n;++s)o[s]=t.getRangeAt(s);var l=a.createTestElement(document,"",!1),u=l.appendChild(document.createTextNode("   ")),c=document.createRange();if(c.setStart(u,1),c.collapse(!0),t.removeAllRanges(),t.addRange(c),P=1==t.rangeCount,t.removeAllRanges(),!i){var d=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(d&&parseInt(d[1])>=36)O=!1;else{var h=c.cloneRange();c.setStart(u,0),h.setEnd(u,3),h.setStart(u,2),t.addRange(c),t.addRange(h),O=2==t.rangeCount}}for(a.removeNode(l),t.removeAllRanges(),s=0;s<n;++s)0==s&&r?I?I(t,o[s]):(e.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),t.addRange(o[s])):t.addRange(o[s])}}(),f.selectionSupportsMultipleRanges=O,f.collapsedNonEditableSelectionsSupported=P;var L,B,j=!1;function F(e,t,n){var i=n?"end":"start",o=n?"start":"end";e.anchorNode=t[i+"Container"],e.anchorOffset=t[i+"Offset"],e.focusNode=t[o+"Container"],e.focusOffset=t[o+"Offset"]}function H(e){var t=e.nativeSelection;e.anchorNode=t.anchorNode,e.anchorOffset=t.anchorOffset,e.focusNode=t.focusNode,e.focusOffset=t.focusOffset}function W(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0,z(e)}function z(e){e.type=0==e.rangeCount?"None":i(e)?"Caret":"Range"}function G(t){var n;return t instanceof u?((n=e.createNativeRange(t.getDocument())).setEnd(t.endContainer,t.endOffset),n.setStart(t.startContainer,t.startOffset)):t instanceof c?n=t.nativeRange:f.implementsDomRange&&t instanceof a.getWindow(t.startContainer).Range&&(n=t),n}function U(e){if(!e.length||1!=e[0].nodeType)return!1;for(var t=1,n=e.length;t<n;++t)if(!a.isAncestorOf(e[0],e[t]))return!1;return!0}function q(e){var n=e.getNodes();if(!U(n))throw t.createError("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return n[0]}function X(e){return!!e&&void 0!==e.text}function V(e,t){var n=new c(t);e._ranges=[n],F(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed,z(e)}function K(t){if(t._ranges.length=0,"None"==t.docSelection.type)W(t);else{var n=t.docSelection.createRange();if(X(n))V(t,n);else{t.rangeCount=n.length;for(var i,o=g(n.item(0)),r=0;r<t.rangeCount;++r)(i=e.createRange(o)).selectNode(n.item(r)),t._ranges.push(i);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed,F(t,t._ranges[t.rangeCount-1],!1),z(t)}}}function Y(e,n){for(var i=e.docSelection.createRange(),o=q(n),r=g(i.item(0)),a=v(r).createControlRange(),s=0,l=i.length;s<l;++s)a.add(i.item(s));try{a.add(o)}catch(e){throw t.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}a.select(),K(e)}function $(e,t,n){this.nativeSelection=e,this.docSelection=t,this._ranges=[],this.win=n,this.refresh()}function Z(e){e.win=e.anchorNode=e.focusNode=e._ranges=null,e.rangeCount=e.anchorOffset=e.focusOffset=0,e.detached=!0,z(e)}T&&l(T,"createControlRange")&&(L=T.createControlRange(),s.areHostProperties(L,["item","add"])&&(j=!0)),f.implementsControlRange=j,i=A?function(e){return e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset}:function(e){return!!e.rangeCount&&e.getRangeAt(e.rangeCount-1).collapsed},l(S,"getRangeAt")?B=function(e,t){try{return e.getRangeAt(t)}catch(e){return null}}:A&&(B=function(t){var n=g(t.anchorNode),i=e.createRange(n);return i.setStartAndEnd(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),i.collapsed!==this.isCollapsed&&i.setStartAndEnd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset),i}),$.prototype=e.selectionPrototype;var J=[];function Q(e,t){for(var n,i,o=J.length;o--;)if(i=(n=J[o]).selection,"deleteAll"==t)Z(i);else if(n.win==e)return"delete"==t?(J.splice(o,1),!0):i;return"deleteAll"==t&&(J.length=0),null}var ee=function(e){if(e&&e instanceof $)return e.refresh(),e;var t=Q(e=b(e,"getNativeSelection")),i=n(e),o=N?w(e):null;return t?(t.nativeSelection=i,t.docSelection=o,t.refresh()):(t=new $(i,o,e),J.push({win:e,selection:t})),t};e.getSelection=ee,s.createAliasForDeprecatedMethod(e,"getIframeSelection","getSelection");var te,ne=$.prototype;function ie(e,n){for(var i,o=g(n[0].startContainer),r=v(o).createControlRange(),a=0,s=n.length;a<s;++a){i=q(n[a]);try{r.add(i)}catch(e){throw t.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),K(e)}if(!_&&A&&s.areHostMethods(S,["removeAllRanges","addRange"])){ne.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),W(this)};var oe=function(e,t){I(e.nativeSelection,t),e.refresh()};ne.addRange=D?function(t,n){if(j&&N&&this.docSelection.type==p)Y(this,t);else if(y(n)&&k)oe(this,t);else{var o;O?o=this.rangeCount:(this.removeAllRanges(),o=0);var r=G(t).cloneRange();try{this.nativeSelection.addRange(r)}catch(e){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==o+1){if(e.config.checkSelectionRanges){var a=B(this.nativeSelection,this.rangeCount-1);a&&!m(a,t)&&(t=new c(a))}this._ranges[this.rangeCount-1]=t,F(this,t,re(this.nativeSelection)),this.isCollapsed=i(this),z(this)}else this.refresh()}}:function(e,t){y(t)&&k?oe(this,e):(this.nativeSelection.addRange(G(e)),this.refresh())},ne.setRanges=function(e){if(j&&N&&e.length>1)ie(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;t<n;++t)this.addRange(e[t])}}}else{if(!(l(S,"empty")&&l(M,"select")&&j&&_))return t.fail("No means of selecting a Range or TextRange was found"),!1;ne.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var e;if(this.anchorNode)e=g(this.anchorNode);else if(this.docSelection.type==p){var t=this.docSelection.createRange();t.length&&(e=g(t.item(0)))}e&&(v(e).createTextRange().select(),this.docSelection.empty())}}catch(e){}W(this)},ne.addRange=function(t){this.docSelection.type==p?Y(this,t):(e.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,F(this,t,!1),z(this))},ne.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?ie(this,e):t&&this.addRange(e[0])}}if(ne.getRangeAt=function(e){if(e<0||e>=this.rangeCount)throw new d("INDEX_SIZE_ERR");return this._ranges[e].cloneRange()},_)te=function(t){var n;e.isSelectionValid(t.win)?n=t.docSelection.createRange():(n=v(t.win.document).createTextRange()).collapse(!0),t.docSelection.type==p?K(t):X(n)?V(t,n):W(t)};else if(l(S,"getRangeAt")&&typeof S.rangeCount==r)te=function(t){if(j&&N&&t.docSelection.type==p)K(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,o=t.rangeCount;n<o;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));F(t,t._ranges[t.rangeCount-1],re(t.nativeSelection)),t.isCollapsed=i(t),z(t)}else W(t)};else{if(!A||typeof S.isCollapsed!=o||typeof M.collapsed!=o||!f.implementsDomRange)return t.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;te=function(e){var t,n=e.nativeSelection;n.anchorNode?(t=B(n,0),e._ranges=[t],e.rangeCount=1,H(e),e.isCollapsed=i(e),z(e)):W(e)}}ne.refresh=function(e){var t=e?this._ranges.slice(0):null,n=this.anchorNode,i=this.anchorOffset;if(te(this),e){var o=t.length;if(o!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=i)return!0;for(;o--;)if(!m(t[o],this._ranges[o]))return!0;return!1}};var re,ae=function(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var i=0,o=n.length;i<o;++i)m(t,n[i])||e.addRange(n[i]);e.rangeCount||W(e)};function se(e,t){if(e.win.document!=g(t))throw new d("WRONG_DOCUMENT_ERR")}function le(e,t){if(t<0||t>(a.isCharacterDataNode(e)?e.length:e.childNodes.length))throw new d("INDEX_SIZE_ERR")}function ue(t){return function(n,i){var o;this.rangeCount?(o=this.getRangeAt(0))["set"+(t?"Start":"End")](n,i):(o=e.createRange(this.win.document)).setStartAndEnd(n,i),this.setSingleRange(o,this.isBackward())}}function ce(e){var t=[],n=new h(e.anchorNode,e.anchorOffset),i=new h(e.focusNode,e.focusOffset),o="function"==typeof e.getName?e.getName():"Selection";if(void 0!==e.rangeCount)for(var r=0,a=e.rangeCount;r<a;++r)t[r]=u.inspect(e.getRangeAt(r));return"["+o+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}ne.removeRange=j&&N?function(e){if(this.docSelection.type==p){for(var t=this.docSelection.createRange(),n=q(e),i=g(t.item(0)),o=v(i).createControlRange(),r=!1,a=0,s=t.length;a<s;++a)t.item(a)!==n||r?o.add(t.item(a)):r=!0;o.select(),K(this)}else ae(this,e)}:function(e){ae(this,e)},!_&&A&&f.implementsDomRange?(re=E,ne.isBackward=function(){return re(this)}):re=ne.isBackward=function(){return!1},ne.isBackwards=ne.isBackward,ne.toString=function(){for(var e=[],t=0,n=this.rangeCount;t<n;++t)e[t]=""+this._ranges[t];return e.join("")},ne.collapse=function(t,n){se(this,t);var i=e.createRange(t);i.collapseToPoint(t,n),this.setSingleRange(i),this.isCollapsed=!0},ne.collapseToStart=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},ne.collapseToEnd=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var e=this._ranges[this.rangeCount-1];this.collapse(e.endContainer,e.endOffset)},ne.selectAllChildren=function(t){se(this,t);var n=e.createRange(t);n.selectNodeContents(t),this.setSingleRange(n)},R?ne.setBaseAndExtent=function(e,t,n,i){this.nativeSelection.setBaseAndExtent(e,t,n,i),this.refresh()}:k&&(ne.setBaseAndExtent=function(t,n,i,o){le(t,n),le(i,o),se(this,t),se(this,i);var r=e.createRange(node),s=-1==a.comparePoints(t,n,i,o);s?r.setStartAndEnd(i,o,t,n):r.setStartAndEnd(t,n,i,o),this.setSingleRange(r,s)}),ne.deleteFromDocument=function(){if(j&&N&&this.docSelection.type==p){for(var e,t=this.docSelection.createRange();t.length;)e=t.item(0),t.remove(e),a.removeNode(e);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var i=0,o=n.length;i<o;++i)n[i].deleteContents();this.addRange(n[o-1])}}},ne.eachRange=function(e,t){for(var n=0,i=this._ranges.length;n<i;++n)if(e(this.getRangeAt(n)))return t},ne.getAllRanges=function(){var e=[];return this.eachRange((function(t){e.push(t)})),e},ne.setSingleRange=function(e,t){this.removeAllRanges(),this.addRange(e,t)},ne.callMethodOnEachRange=function(e,t){var n=[];return this.eachRange((function(i){n.push(i[e].apply(i,t||[]))})),n},ne.setStart=ue(!0),ne.setEnd=ue(!1),e.rangePrototype.select=function(e){ee(this.getDocument()).setSingleRange(this,e)},ne.changeEachRange=function(e){var t=[],n=this.isBackward();this.eachRange((function(n){e(n),t.push(n)})),this.removeAllRanges(),n&&1==t.length?this.addRange(t[0],"backward"):this.setRanges(t)},ne.containsNode=function(e,t){return this.eachRange((function(n){return n.containsNode(e,t)}),!0)||!1},ne.getBookmark=function(e){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[e])}},ne.moveToBookmark=function(t){for(var n,i,o=[],r=0;n=t.rangeBookmarks[r++];)(i=e.createRange(this.win)).moveToBookmark(n),o.push(i);t.backward?this.setSingleRange(o[0],"backward"):this.setRanges(o)},ne.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},ne.restoreRanges=function(e){this.removeAllRanges();for(var t,n=0;t=e.ranges[n];++n)this.addRange(t,e.backward&&0==n)},ne.toHtml=function(){var e=[];return this.eachRange((function(t){e.push(u.toHtml(t))})),e.join("")},f.implementsTextRange&&(ne.getNativeTextRange=function(){var n;if(n=this.docSelection){var i=n.createRange();if(X(i))return i;throw t.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return e.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw t.createError("getNativeTextRange: selection contains no range")}),ne.getName=function(){return"WrappedSelection"},ne.inspect=function(){return ce(this)},ne.detach=function(){Q(this.win,"delete"),Z(this)},$.detachAll=function(){Q(null,"deleteAll")},$.inspect=ce,$.isDirectionBackward=y,e.Selection=$,e.selectionPrototype=ne,e.addShimListener((function(e){void 0===e.getSelection&&(e.getSelection=function(){return ee(e)}),e=null}))}));var j=!1,F=function(e){j||(j=!0,!E.initialized&&E.config.autoInitialize&&A())};return x&&("complete"==document.readyState?F():(s(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",F,!1),m(window,"load",F))),E}()}({get exports(){return Iv},set exports(e){Iv=e}});var Lv={};!function(e){var t;e.exports=((t=Iv).createModule("ClassApplier",["WrappedSelection"],(function(e,t){var n=e.dom,i=n.DomPosition,o=n.arrayContains,r=e.util,a=r.forEach,s="span",l=r.isHostMethod(document,"createElementNS");function u(e,t){for(var n in e)if(e.hasOwnProperty(n)&&!1===t(n,e[n]))return!1;return!0}function c(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function d(e,t){return!!e&&new RegExp("(?:^|\\s)"+t+"(?:\\s|$)").test(e)}function h(e,t){return"object"==typeof e.classList?e.classList.contains(t):d("string"==typeof e.className?e.className:e.getAttribute("class"),t)}function f(e,t){if("object"==typeof e.classList)e.classList.add(t);else{var n="string"==typeof e.className,i=n?e.className:e.getAttribute("class");i?d(i,t)||(i+=" "+t):i=t,n?e.className=i:e.setAttribute("class",i)}}var p=function(){function e(e,t,n){return t&&n?" ":""}return function(t,n){if("object"==typeof t.classList)t.classList.remove(n);else{var i="string"==typeof t.className,o=i?t.className:t.getAttribute("class");o=o.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),e),i?t.className=o:t.setAttribute("class",o)}}}();function g(e){return"string"==typeof e.className?e.className:e.getAttribute("class")}function v(e){return e&&e.split(/\s+/).sort().join(" ")}function m(e){return v(g(e))}function y(e,t){return m(e)==m(t)}function b(e,t){for(var n=t.split(/\s+/),i=0,o=n.length;i<o;++i)if(!h(e,c(n[i])))return!1;return!0}function x(e){var t=e.parentNode;return t&&1==t.nodeType&&!/^(textarea|style|script|select|iframe)$/i.test(t.nodeName)}function w(e,t,n,i,o){var r=e.node,a=e.offset,s=r,l=a;r==i&&a>o&&++l,r!=t||a!=n&&a!=n+1||(s=i,l+=o-n),r==t&&a>n+1&&--l,e.node=s,e.offset=l}function E(e,t,n){e.node==t&&e.offset>n&&--e.offset}function C(e,t,i,o){-1==i&&(i=t.childNodes.length);var r=e.parentNode,s=n.getNodeIndex(e);a(o,(function(e){w(e,r,s,t,i)})),t.childNodes.length==i?t.appendChild(e):t.insertBefore(e,t.childNodes[i])}function N(e,t){var i=e.parentNode,o=n.getNodeIndex(e);a(t,(function(e){E(e,i,o)})),n.removeNode(e)}function _(e,t,n,i,o){for(var r,a=[];r=e.firstChild;)C(r,t,n++,o),a.push(r);return N(e,o),a}function S(e,t){return _(e,e.parentNode,n.getNodeIndex(e),!0,t)}function M(e,t){var n=e.cloneRange();n.selectNodeContents(t);var i=n.intersection(e);return""!=(i?i.toString():"")}function T(e){for(var t,n=e.getNodes([3]),i=0;(t=n[i])&&!M(e,t);)++i;for(var o=n.length-1;(t=n[o])&&!M(e,t);)--o;return n.slice(i,o+1)}function A(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n,i,o,r=0,a=e.attributes.length;r<a;++r)if("class"!=(o=(n=e.attributes[r]).name)){if(null===n!=(null===(i=t.attributes.getNamedItem(o))))return!1;if(n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}function k(e,t){for(var n,i=0,r=e.attributes.length;i<r;++i)if(n=e.attributes[i].name,(!t||!o(t,n))&&e.attributes[i].specified&&"class"!=n)return!0;return!1}var R=n.getComputedStyleProperty,D="boolean"==typeof document.createElement("div").isContentEditable?function(e){return e&&1==e.nodeType&&e.isContentEditable}:function(e){return!(!e||1!=e.nodeType||"false"==e.contentEditable)&&("true"==e.contentEditable||D(e.parentNode))};function O(e){var t;return e&&1==e.nodeType&&((t=e.parentNode)&&9==t.nodeType&&"on"==t.designMode||D(e)&&!D(e.parentNode))}function P(e){return(D(e)||1!=e.nodeType&&D(e.parentNode))&&!O(e)}var I=/^inline(-block|-table)?$/i;function L(e){return e&&1==e.nodeType&&!I.test(R(e,"display"))}var B=/[^\r\n\t\f \u200B]/;function j(e){if(0==e.data.length)return!0;if(B.test(e.data))return!1;switch(R(e.parentNode,"whiteSpace")){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(e.data))return!1}return L(e.previousSibling)||L(e.nextSibling)}function F(e){var t,n,o=[];for(t=0;n=e[t++];)o.push(new i(n.startContainer,n.startOffset),new i(n.endContainer,n.endOffset));return o}function H(e,t){for(var n,i,o,r=0,a=e.length;r<a;++r)n=e[r],i=t[2*r],o=t[2*r+1],n.setStartAndEnd(i.node,i.offset,o.node,o.offset)}function W(e,t){return n.isCharacterDataNode(e)?0==t?!!e.previousSibling:t!=e.length||!!e.nextSibling:t>0&&t<e.childNodes.length}function z(e,i,o,r){var a,s,l=0==o;if(n.isAncestorOf(i,e))return e;if(n.isCharacterDataNode(i)){var u=n.getNodeIndex(i);if(0==o)o=u;else{if(o!=i.length)throw t.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+o+" in "+i.data);o=u+1}i=i.parentNode}if(W(i,o)){a=i.cloneNode(!1),s=i.parentNode,a.id&&a.removeAttribute("id");for(var c,d=0;c=i.childNodes[o];)C(c,a,d++,r);return C(a,s,n.getNodeIndex(i)+1,r),i==e?a:z(e,s,n.getNodeIndex(a),r)}if(e!=i){a=i.parentNode;var h=n.getNodeIndex(i);return l||h++,z(e,a,h,r)}return e}function G(e,t){return e.namespaceURI==t.namespaceURI&&e.tagName.toLowerCase()==t.tagName.toLowerCase()&&y(e,t)&&A(e,t)&&"inline"==R(e,"display")&&"inline"==R(t,"display")}function U(e){var t=e?"nextSibling":"previousSibling";return function(n,i){var o=n.parentNode,r=n[t];if(r){if(r&&3==r.nodeType)return r}else if(i&&(r=o[t])&&1==r.nodeType&&G(o,r)){var a=r[e?"firstChild":"lastChild"];if(a&&3==a.nodeType)return a}return null}}var q=U(!1),X=U(!0);function V(e){this.isElementMerge=1==e.nodeType,this.textNodes=[];var t=this.isElementMerge?e.lastChild:e;t&&(this.textNodes[0]=t)}V.prototype={doMerge:function(e){var t=this.textNodes,i=t[0];if(t.length>1){var o,r=n.getNodeIndex(i),s=[],l=0;a(t,(function(u,c){o=u.parentNode,c>0&&(o.removeChild(u),o.hasChildNodes()||n.removeNode(o),e&&a(e,(function(e){e.node==u&&(e.node=i,e.offset+=l),e.node==o&&e.offset>r&&(--e.offset,e.offset==r+1&&c<t.length-1&&(e.node=i,e.offset=l))}))),s[c]=u.data,l+=u.data.length})),i.data=s.join("")}return i.data},getLength:function(){for(var e=this.textNodes.length,t=0;e--;)t+=this.textNodes[e].length;return t},toString:function(){var e=[];return a(this.textNodes,(function(t,n){e[n]="'"+t.data+"'"})),"[Merge("+e.join(",")+")]"}};var K=["elementTagName","ignoreWhiteSpace","applyToEditableOnly","useExistingElements","removeEmptyElements","onElementCreate"],Y={};function $(e,t,n){var i,o,r,a,s=this;s.cssClass=s.className=e;var l=null,d={};if("object"==typeof t&&null!==t){for(void 0!==t.elementTagName&&(t.elementTagName=t.elementTagName.toLowerCase()),n=t.tagNames,l=t.elementProperties,d=t.elementAttributes,o=0;a=K[o++];)t.hasOwnProperty(a)&&(s[a]=t[a]);i=t.normalize}else i=t;s.normalize=void 0===i||i,s.attrExceptions=[];var h=document.createElement(s.elementTagName);s.elementProperties=s.copyPropertiesToElement(l,h,!0),u(d,(function(e,t){s.attrExceptions.push(e),d[e]=""+t})),s.elementAttributes=d,s.elementSortedClassName=s.elementProperties.hasOwnProperty("className")?v(s.elementProperties.className+" "+e):e,s.applyToAnyTagName=!1;var f=typeof n;if("string"==f)"*"==n?s.applyToAnyTagName=!0:s.tagNames=c(n.toLowerCase()).split(/\s*,\s*/);else if("object"==f&&"number"==typeof n.length)for(s.tagNames=[],o=0,r=n.length;o<r;++o)"*"==n[o]?s.applyToAnyTagName=!0:s.tagNames.push(n[o].toLowerCase());else s.tagNames=[s.elementTagName]}function Z(e,t,n){return new $(e,t,n)}$.prototype={elementTagName:s,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(e,t,n){var i,o,r,a,s,l,u={};for(var c in e)if(e.hasOwnProperty(c))if(a=e[c],s=t[c],"className"==c)f(t,a),f(t,this.className),t[c]=v(t[c]),n&&(u[c]=a);else if("style"==c){for(i in o=s,n&&(u[c]=r={}),e[c])e[c].hasOwnProperty(i)&&(o[i]=a[i],n&&(r[i]=o[i]));this.attrExceptions.push(c)}else t[c]=a,n&&(u[c]=t[c],l=Y.hasOwnProperty(c)?Y[c]:c,this.attrExceptions.push(l));return n?u:""},copyAttributesToElement:function(e,t){for(var n in e)e.hasOwnProperty(n)&&!/^class(?:Name)?$/i.test(n)&&t.setAttribute(n,e[n])},appliesToElement:function(e){return o(this.tagNames,e.tagName.toLowerCase())},getEmptyElements:function(e){var t=this;return e.getNodes([1],(function(e){return t.appliesToElement(e)&&!e.hasChildNodes()}))},hasClass:function(e){return 1==e.nodeType&&(this.applyToAnyTagName||this.appliesToElement(e))&&h(e,this.className)},getSelfOrAncestorWithClass:function(e){for(;e;){if(this.hasClass(e))return e;e=e.parentNode}return null},isModifiable:function(e){return!this.applyToEditableOnly||P(e)},isIgnorableWhiteSpaceNode:function(e){return this.ignoreWhiteSpace&&e&&3==e.nodeType&&j(e)},postApply:function(e,t,n,i){var o,r,s=e[0],l=e[e.length-1],u=[],c=s,d=l,h=0,f=l.length;a(e,(function(e){(r=q(e,!i))?(o||(o=new V(r),u.push(o)),o.textNodes.push(e),e===s&&(c=o.textNodes[0],h=c.length),e===l&&(d=o.textNodes[0],f=o.getLength())):o=null}));var p=X(l,!i);if(p&&(o||(o=new V(l),u.push(o)),o.textNodes.push(p)),u.length){for(var g=0,v=u.length;g<v;++g)u[g].doMerge(n);t.setStartAndEnd(c,h,d,f)}},createContainer:function(e){var t=n.getDocument(e),i=l&&!n.isHtmlNamespace(e)&&e.namespaceURI?t.createElementNS(e.namespaceURI,this.elementTagName):t.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,i,!1),this.copyAttributesToElement(this.elementAttributes,i),f(i,this.className),this.onElementCreate&&this.onElementCreate(i,this),i},elementHasProperties:function(e,t){var n=this;return u(t,(function(t,i){if("className"==t)return b(e,i);if("object"==typeof i){if(!n.elementHasProperties(e[t],i))return!1}else if(e[t]!==i)return!1}))},elementHasAttributes:function(e,t){return u(t,(function(t,n){if(e.getAttribute(t)!==n)return!1}))},applyToTextNode:function(e,t){if(x(e)){var n=e.parentNode;if(1==n.childNodes.length&&this.useExistingElements&&this.appliesToElement(n)&&this.elementHasProperties(n,this.elementProperties)&&this.elementHasAttributes(n,this.elementAttributes))f(n,this.className);else{var i=e.parentNode,o=this.createContainer(i);i.insertBefore(o,e),o.appendChild(e)}}},isRemovable:function(e){return e.tagName.toLowerCase()==this.elementTagName&&m(e)==this.elementSortedClassName&&this.elementHasProperties(e,this.elementProperties)&&!k(e,this.attrExceptions)&&this.elementHasAttributes(e,this.elementAttributes)&&this.isModifiable(e)},isEmptyContainer:function(e){var t=e.childNodes.length;return 1==e.nodeType&&this.isRemovable(e)&&(0==t||1==t&&this.isEmptyContainer(e.firstChild))},removeEmptyContainers:function(e){var t=this,n=e.getNodes([1],(function(e){return t.isEmptyContainer(e)})),i=[e],o=F(i);a(n,(function(e){N(e,o)})),H(i,o)},undoToTextNode:function(e,t,n,i){if(!t.containsNode(n)){var o=t.cloneRange();o.selectNode(n),o.isPointInRange(t.endContainer,t.endOffset)&&(z(n,t.endContainer,t.endOffset,i),t.setEndAfter(n)),o.isPointInRange(t.startContainer,t.startOffset)&&(n=z(n,t.startContainer,t.startOffset,i))}this.isRemovable(n)?S(n,i):p(n,this.className)},splitAncestorWithClass:function(e,t,n){var i=this.getSelfOrAncestorWithClass(e);i&&z(i,e,t,n)},undoToAncestor:function(e,t){this.isRemovable(e)?S(e,t):p(e,this.className)},applyToRange:function(e,t){var n=this,i=F((t=t||[])||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e);var o=T(e);if(o.length){a(o,(function(e){n.isIgnorableWhiteSpaceNode(e)||n.getSelfOrAncestorWithClass(e)||!n.isModifiable(e)||n.applyToTextNode(e,i)}));var r=o[o.length-1];e.setStartAndEnd(o[0],0,r,r.length),n.normalize&&n.postApply(o,e,i,!1),H(t,i)}var s=n.getEmptyElements(e);a(s,(function(e){f(e,n.className)}))},applyToRanges:function(e){for(var t=e.length;t--;)this.applyToRange(e[t],e);return e},applyToSelection:function(t){var n=e.getSelection(t);n.setRanges(this.applyToRanges(n.getAllRanges()))},undoToRange:function(e,t){var n=this,i=F(t=t||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e,i);var o,r,s=T(e),l=s[s.length-1];if(s.length){n.splitAncestorWithClass(e.endContainer,e.endOffset,i),n.splitAncestorWithClass(e.startContainer,e.startOffset,i);for(var u=0,c=s.length;u<c;++u)o=s[u],(r=n.getSelfOrAncestorWithClass(o))&&n.isModifiable(o)&&n.undoToAncestor(r,i);e.setStartAndEnd(s[0],0,l,l.length),n.normalize&&n.postApply(s,e,i,!0),H(t,i)}var d=n.getEmptyElements(e);a(d,(function(e){p(e,n.className)}))},undoToRanges:function(e){for(var t=e.length;t--;)this.undoToRange(e[t],e);return e},undoToSelection:function(t){var n=e.getSelection(t),i=e.getSelection(t).getAllRanges();this.undoToRanges(i),n.setRanges(i)},isAppliedToRange:function(e){if(e.collapsed||""==e.toString())return!!this.getSelfOrAncestorWithClass(e.commonAncestorContainer);var t=e.getNodes([3]);if(t.length)for(var n,i=0;n=t[i++];)if(!this.isIgnorableWhiteSpaceNode(n)&&M(e,n)&&this.isModifiable(n)&&!this.getSelfOrAncestorWithClass(n))return!1;return!0},isAppliedToRanges:function(e){var t=e.length;if(0==t)return!1;for(;t--;)if(!this.isAppliedToRange(e[t]))return!1;return!0},isAppliedToSelection:function(t){var n=e.getSelection(t);return this.isAppliedToRanges(n.getAllRanges())},toggleRange:function(e){this.isAppliedToRange(e)?this.undoToRange(e):this.applyToRange(e)},toggleSelection:function(e){this.isAppliedToSelection(e)?this.undoToSelection(e):this.applyToSelection(e)},getElementsWithClassIntersectingRange:function(e){var t=[],n=this;return e.getNodes([3],(function(e){var i=n.getSelfOrAncestorWithClass(e);i&&!o(t,i)&&t.push(i)})),t},detach:function(){}},$.util={hasClass:h,addClass:f,removeClass:p,getClass:g,hasSameClasses:y,hasAllClasses:b,replaceWithOwnChildren:S,elementsHaveSameNonClassAttributes:A,elementHasNonClassAttributes:k,splitNodeAt:z,isEditableElement:D,isEditingHost:O,isEditable:P},e.CssClassApplier=e.ClassApplier=$,e.createClassApplier=Z,r.createAliasForDeprecatedMethod(e,"createCssClassApplier","createClassApplier",t)})),t)}({get exports(){return Lv},set exports(e){Lv=e}});var Bv={toolbar:{allowMultiParagraphSelection:!0,buttons:["bold","colorpicker","italic","underline","strikethrough","quote","justifyLeft","justifyCenter","justifyRight","justifyFull","superscript","subscript","orderedlist","unorderedlist","pre","removeFormat","outdent","indent","h2","h3"],standardizeSelectionStart:!1,updateOnEmptySelection:!1},placeholder:{text:"请输入内容",hideOnClick:!0},disableEditing:!0},jv=bv.extensions.button.extend({name:"colorpicker",tagNames:["mark"],contentDefault:"<b>Color</b>",aria:"Color Picker",action:"colorPicker",init:function(){var e=this;Iv.init(),bv.extensions.button.prototype.init.call(this),this.colorPicker=new Ov({parent:this.button,color:"#000",onDone:function(t){e.coloredText&&e.coloredText.isAppliedToSelection()&&e.coloredText.undoToSelection(),e.coloredText=Iv.createClassApplier("colored",{elementTagName:"span",elementProperties:{style:{color:t.hex}},normalize:!0}),e.coloredText.toggleSelection(),e.base.checkContentChanged(),e.setInactive()}})},getButton:function(){return this.button},handleClick:function(){this.setActive(),this.colorPicker.show()},isAlreadyApplied:function(e){return"mark"===e.nodeName.toLowerCase()},isActive:function(){return this.button.classList.contains("medium-editor-button-active")},setInactive:function(){this.button.classList.remove("medium-editor-button-active")},setActive:function(){this.button.classList.add("medium-editor-button-active")}}),Fv=function(e){function n(t){var n=e.call(this,t)||this;n.labelMap=new Map;var i=t.lf,o=t.graphModel;return n.lf=i,n.graphModel=o,n.state={tick:0},n}return p(n,e),n.prototype.componentDidMount=function(){var e=this,t=this.props.graphModel;this.editor=new bv(".lf-label-editor",bd(Bv,{autoLink:!0,extensions:{colorPicker:new jv}})),t.eventCenter.on("text:update,node:mousemove,node:resize,node:rotate,node:drag,label:drop,node:drop",(function(){})),t.eventCenter.on("node:properties-change,node:properties-delete",(function(){e.setState({tick:e.state.tick+1})}))},n.prototype.componentDidUpdate=function(){var e;this.editor&&this.editor.elements.length>0?this.editor.addElements(".lf-label-editor"):(null===(e=this.editor)||void 0===e||e.destroy(),this.editor=new bv(".lf-label-editor",bd(Bv,{autoLink:!0,extensions:{colorPicker:new jv}})))},n.prototype.componentWillUnmount=function(){var e;null===(e=this.editor)||void 0===e||e.destroy()},n.prototype.getLabels=function(){var e=this,t=this.props,n=t.lf.extension,i=t.graphModel,o=E(E([],w(i.nodes),!1),w(i.edges),!1);if(n.label){var r=[];return Eu(o,(function(t){var n,o;Eu(null!==(o=null===(n=t.getData().properties)||void 0===n?void 0:n._label)&&void 0!==o?o:[],(function(n){var o=e.labelMap,a=new yv(n,t,i);o.set(a.id,a),r.push(Pp(vv,{label:a,element:t,graphModel:i},a.id))}))})),r}return null},n.prototype.render=function(){return Pp("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},n.toolName="label-edit-tool",n=m([t.observer],n)}(t.Component),Hv=function(){function e(e){var n,i,o,r=e.lf,a=e.options;this.labelInitPositionMap=new Map,this.lf=r,this.options=null!=a?a:{},this.textOverflowMode=null!==(n=a.textOverflowMode)&&void 0!==n?n:"default",this.isMultiple=null===(i=a.isMultiple)||void 0===i||i,this.labelWidth=a.labelWidth,this.maxCount=null!==(o=a.maxCount)&&void 0!==o?o:1/0,r.graphModel.editConfigModel.updateTextMode(t.TextMode.LABEL),this.addEventListeners(),this.rewriteShortcut(),r.tool.registerTool(Fv.toolName,Fv),r.tool.disableTool("text-edit-tool")}return e.prototype.formatConfig=function(e,n){var i=e.editConfigModel,o=i.nodeTextEdit,r=i.edgeTextEdit,a=i.nodeTextDraggable,s=i.edgeTextDraggable,l=this,u=l.textOverflowMode,c=l.isMultiple,d=l.maxCount,h=l.labelWidth,f=n.text,p=n.zIndex,v=n.properties,m=v._label,y=v._labelOption,b=m,x=void 0===y?{}:y,w=x.isMultiple,E=x.maxCount,C=[];if(it(b)){var N=null!=E?E:d;C=c&&w?b.length>N?b.slice(0,N):b:[b[0]]}else if(pt(b))C=[b];else if("string"==typeof b||!b){var _=g(g({},f),{content:b||(null==f?void 0:f.value),draggable:"edge"===n.BaseType?s:a});C=_.value?[_]:[]}return"edge"===n.BaseType&&(C=ec(C,(function(e){return e}))),ec(C,(function(e){e.id||(e.id=t.createUuid());var i=e.value,l=e.content,c=e.vertical,d=e.editable,f=e.draggable,v=e.textOverflowMode,m="node"===n.BaseType?o:r,y="node"===n.BaseType?a:s;return g(g({},e),{zIndex:p,labelWidth:h,content:null!=l?l:i,vertical:null!=c&&c,editable:Boolean(m)&&d,draggable:Boolean(y)&&f,textOverflowMode:null!=v?v:u})}))},e.prototype.setupLabels=function(e){var t=this;Eu(e.sortElements,(function(n){t.rewriteInnerMethods(n);var i=t.formatConfig(e,n);n.setProperty("_label",i)}))},e.prototype.addLabel=function(e,n){var i,o,r,a=this.isMultiple,s=this.maxCount,l=e.properties,u=null!==(i=l._label)&&void 0!==i?i:[],c=null!==(o=l._labelOption)&&void 0!==o?o:{},d=u.length,h={id:t.createUuid(),x:n.x,y:n.y,content:"Label".concat(d+1),value:"Label".concat(d+1),style:{},draggable:!0,editable:!0,vertical:!1};!a||a&&!1===c.isMultiple||d>=(null!==(r=null==c?void 0:c.maxCount)&&void 0!==r?r:s)||(u.push(h),e.setProperty("_label",u))},e.prototype.addEventListeners=function(){var e=this,n=this.lf.graphModel,i=n.eventCenter,o=n.editConfigModel;i.on("graph:rendered",(function(t){var n=t.graphModel;e.setupLabels(n)})),i.on("node:dbclick,edge:dbclick",(function(i){var r=i.e,a=i.data,s=n.getElement(a.id),l=n.getPointByClient({x:r.clientX,y:r.clientY}).canvasOverlayPosition,u={x:l.x,y:l.y};s&&o.textMode===t.TextMode.LABEL&&e.addLabel(s,u)})),i.on("node:resize",(function(e){var t,n,i=e.preData,o=e.data,r=e.model,a=null!==(t=i.properties)&&void 0!==t?t:{},s=a.width,l=a.height,u=a._label,c=void 0===u?[]:u,d=null!==(n=o.properties)&&void 0!==n?n:{},h=d.width,f=d.height;if(s&&l&&h&&f){var p={x:i.x,y:i.y,width:s,height:l},v={x:o.x,y:o.y,width:h,height:f},m=ec(c,(function(e){var t,n,i,o,r,a,s,l,u,c,d,h=e.x,f=e.y,m=(n=v,i={x:h,y:f},o=(t=p).x,r=t.y,a=t.width,s=t.height,l=n.x,u=n.y,c=n.width,d=n.height,{x:l+(i.x-o)/a*c,y:u+(i.y-r)/s*d});return g(g({},e),m)}));r.setProperty("_label",m)}})),i.on("node:rotate",(function(t){var n=t.model,i=n.x,o=n.y,r=n.rotate,a=n.properties._label,s={x:i,y:o},l=ec(void 0===a?[]:a,(function(t){if(!t.id)return t;var n={x:t.x,y:t.y};e.labelInitPositionMap.has(t.id)?n=e.labelInitPositionMap.get(t.id):e.labelInitPositionMap.set(t.id,n);var i=r*(180/Math.PI);i<0&&(i+=360);var o=i*(Math.PI/180),a=Qg(n,s,o);return g(g(g({},t),a),{rotate:i})}));n.setProperty("_label",l)})),i.on("node:dnd-add,node:add,edge:add",(function(t){var i=t.data,o=n.getElement(i.id);if(o){e.rewriteInnerMethods(o);var r=o.properties._label;if(!it(r)||0===r.length||!r[0].id){var a=e.formatConfig(n,i);o.setProperty("_label",a)}}}))},e.prototype.rewriteInnerMethods=function(e){e.moveText=function(t,n){if(e.text){var i=e.text,o=i.x,r=i.y,a=i.value,s=i.draggable,l=i.editable;e.text={value:a,editable:l,draggable:s,x:o+t,y:r+n};var u=js(e.getProperties());if(it(u._label)){var c=ec(u._label,(function(e){return g(g({},e),{x:e.x+t,y:e.y+n})}));null==e||e.setProperty("_label",c)}}}},e.prototype.rewriteShortcut=function(){var e=this,n=this.lf,i=n.keyboard,o=n.graphModel,r=i.options.keyboard;i.off(["backspace"]),i.on(["backspace"],(function(){if(!(null==r?void 0:r.enabled))return!0;if(o.textEditElement)return!0;var n=o.getSelectElements(!0);e.lf.clearSelectElements();var i=e.lf.graphModel.editConfigModel;return n.edges.forEach((function(n){var r=n.properties;if(r&&!Vc(r._label)&&i.textMode===t.TextMode.LABEL){var a=r._label.filter((function(e){return!e.isSelected}));if(!Kc(a.length,r._label.length)){var s=o.getEdgeModelById(n.id);return void(null==s||s.setProperty("_label",a))}}n.id&&e.lf.deleteEdge(n.id)})),n.nodes.forEach((function(n){var r=n.properties;if(r&&!Vc(r._label)&&i.textMode===t.TextMode.LABEL){var a=r._label.filter((function(e){return!e.isSelected}));if(!Kc(a.length,r._label.length)){var s=o.getNodeModelById(n.id);return void(null==s||s.setProperty("_label",a))}}n.id&&e.lf.deleteNode(n.id)})),!1}))},e.prototype.updateTextMode=function(e){var n=this.lf.graphModel.editConfigModel;e!==n.textMode&&(n.updateTextMode(e),e===t.TextMode.LABEL?(this.lf.tool.enableTool(Fv.toolName),this.lf.tool.disableTool("text-edit-tool")):e===t.TextMode.TEXT&&(this.lf.tool.enableTool("text-edit-tool"),this.lf.tool.disableTool(Fv.toolName)))},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="label",e}(),Wv={};function zv(e){return e.startsWith("data:text/plain")}function Gv(e){return y(this,void 0,void 0,(function(){return b(this,(function(t){return Wv[e]?[2,Wv[e]]:[2,new Promise((function(t,n){try{fetch(e).then((function(e){return e.blob()})).then((function(i){var o=new FileReader;o.onloadend=function(){t(Wv[e]=o.result)},o.onerror=n,o.readAsDataURL(i)})).catch((function(){t(Wv[e]=e)}))}catch(t){return Wv[e]=e}}))]}))}))}function Uv(e,t){return y(this,void 0,void 0,(function(){var n,i;return b(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),(n=e.getAttribute(t)||"").startsWith("data:")?[2]:[4,Gv(n)];case 1:return zv(i=o.sent())?[2]:(e.setAttribute(t,i),[3,3]);case 2:return o.sent(),[3,3];case 3:return[2]}}))}))}function qv(e,t){return y(this,void 0,void 0,(function(){var n;return b(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t.startsWith("data:")?[2]:[4,Gv(t)];case 1:return zv(n=i.sent())?[2]:(e.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return i.sent(),[3,3];case 3:return[2]}}))}))}function Xv(e){return y(this,void 0,void 0,(function(){var t,n,i,o,r,a,s,l,u;return b(this,(function(c){switch(c.label){case 0:for(t=[e],i=[];t.length;)(n=t.shift()).children.length&&t.push.apply(t,E([],w(n.children),!1)),n instanceof HTMLElement&&(o=n.style,r=o.background,a=o.backgroundImage,(s=r.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(u=s[1],i.push(qv(n,u))),(l=a.match(/url\(["']?(.*?)["']?\)/))&&l[1]&&(u=l[1],i.push(qv(n,u)))),n instanceof HTMLImageElement?i.push(Uv(n,"src")):n instanceof SVGImageElement&&i.push(Uv(n,"href"));return[4,Promise.all(i)];case 1:return c.sent(),[2]}}))}))}function Vv(e,t,n){var i=document.createElement("canvas");i.width=t,i.height=n;var o=i.getContext("2d");return o&&o.drawImage(e,0,0,e.width,e.height,0,0,t,n),i}var Kv=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.customCssRules="",this.useGlobalRules=!0,t.getSnapshot=function(e,t){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshot(e,t)];case 1:return[2,n.sent()]}}))}))},t.getSnapshotBlob=function(e,t,i){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBlob(e,t,i)];case 1:return[2,n.sent()]}}))}))},t.getSnapshotBase64=function(e,t,i){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBase64(e,t,i)];case 1:return[2,n.sent()]}}))}))}}return e.prototype.getSvgRootElement=function(e){return e.container.querySelector(".lf-canvas-overlay")},e.prototype.triggerDownload=function(e){var t=new MouseEvent("click",{view:document.defaultView,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",this.fileName),n.setAttribute("href",e),n.setAttribute("target","_blank"),n.dispatchEvent(t)},e.prototype.removeAnchor=function(e){for(var t=e.childNodes,n=e.childNodes&&e.childNodes.length,i=0;i<n;i++){var o=t[i];(o.classList&&Array.from(o.classList)||[]).indexOf("lf-anchor")>-1&&(e.removeChild(e.childNodes[i]),n--,i--)}},e.prototype.removeRotateControl=function(e){for(var t=e.childNodes,n=e.childNodes&&e.childNodes.length,i=0;i<n;i++){var o=t[i];(o.classList&&Array.from(o.classList)||[]).indexOf("lf-rotate-control")>-1&&(e.removeChild(e.childNodes[i]),n--,i--)}},e.prototype.convertImageToBase64=function(e){return y(this,void 0,void 0,(function(){return b(this,(function(t){return[2,new Promise((function(t,n){var i=new Image;i.crossOrigin="anonymous",i.onload=function(){var e=document.createElement("canvas");e.width=i.width,e.height=i.height;var n=e.getContext("2d");null==n||n.drawImage(i,0,0);var o=e.toDataURL("image/png");t(o)},i.onerror=function(){n(new Error("Failed to load image: ".concat(e)))},i.src=e}))]}))}))},e.prototype.isRelativePath=function(e){return!(e.startsWith("data:")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//"))},e.prototype.processImages=function(e){return y(this,void 0,void 0,(function(){var t,n,i,o,r,a,s,l,u,c;return b(this,(function(d){switch(d.label){case 0:t=e.getElementsByTagName("image"),o=0,d.label=1;case 1:if(!(o<t.length))return[3,6];if(l=t[o],!(n=l.getAttributeNS("http://www.w3.org/1999/xlink","href")||l.getAttribute("href"))||!this.isRelativePath(n))return[3,5];d.label=2;case 2:return d.trys.push([2,4,,5]),[4,this.convertImageToBase64(n)];case 3:return c=d.sent(),l.setAttributeNS("http://www.w3.org/1999/xlink","href",c),l.setAttribute("href",c),[3,5];case 4:return d.sent(),[3,5];case 5:return o++,[3,1];case 6:i=e.getElementsByTagName("foreignObject"),o=0,d.label=7;case 7:if(!(o<i.length))return[3,14];r=i[o],a=r.getElementsByTagName("img"),s=0,d.label=8;case 8:if(!(s<a.length))return[3,13];if(l=a[s],!(u=l.getAttribute("src"))||!this.isRelativePath(u))return[3,12];d.label=9;case 9:return d.trys.push([9,11,,12]),[4,this.convertImageToBase64(u)];case 10:return c=d.sent(),l.setAttribute("src",c),[3,12];case 11:return d.sent(),[3,12];case 12:return s++,[3,8];case 13:return o++,[3,7];case 14:return[2]}}))}))},e.prototype.cloneSvg=function(e){return y(this,arguments,void 0,(function(e,t){var n,i,o,r,a,s,l,u,c,d,h=this;return void 0===t&&(t=!0),b(this,(function(f){switch(f.label){case 0:if(n=e.cloneNode(!0),i=n.lastChild,o=null===(d=null==i?void 0:i.childNodes)||void 0===d?void 0:d.length)for(r=0;r<o;r++)a=null==i?void 0:i.childNodes[r],(s=a.classList&&Array.from(a.classList))&&s.indexOf("lf-base")<0?(null==i||i.removeChild(i.childNodes[r]),o--,r--):(l=null==i?void 0:i.childNodes[r])&&l.childNodes.forEach((function(e){var t=e;h.removeAnchor(t.firstChild),h.removeRotateControl(t.firstChild)}));return[4,this.processImages(n)];case 1:return f.sent(),t&&((u=document.createElement("style")).innerHTML=this.getClassRules(),(c=document.createElement("foreignObject")).appendChild(u),n.appendChild(c)),[2,n]}}))}))},e.prototype.getClassRules=function(){var e="";if(this.useGlobalRules)for(var t=document.styleSheets,n=0;n<t.length;n++){var i=t[n];try{for(var o=0;o<i.cssRules.length;o++)e+=i.cssRules[o].cssText}catch(e){}}return this.customCssRules&&(e+=this.customCssRules),e},e.prototype.getCanvasDimensionsByBrowser=function(){var e=navigator.userAgent,t=65535,n=4096;return-1!==e.indexOf("Chrome")||-1!==e.indexOf("Edge")?(t=65535,n=4096):-1!==e.indexOf("Firefox")&&(t=32767,n=3814),{maxCanvasDimension:t,otherMaxCanvasDimension:n}},e.prototype.getCanvasData=function(e,t){return y(this,void 0,void 0,(function(){var n,i,o,r,a,s,l,u,c,d,h,f,p,g,v,m,y,x,w,E,C,N,_,S,M,T,A,k,R,D,O,P,I,L,B,j,F,H,W;return b(this,(function(b){switch(b.label){case 0:return n=t.width,i=t.height,o=t.backgroundColor,r=t.padding,a=void 0===r?40:r,[4,this.cloneSvg(e,!1)];case 1:return s=b.sent(),(l=window.devicePixelRatio||1)<1&&(l=1),u=this.lf.graphModel.rootEl.querySelector(".lf-base"),c=u.getBoundingClientRect(),d=this.lf.container.querySelector(".lf-canvas-overlay"),h=d.getBoundingClientRect(),f=c.x-h.x,p=c.y-h.y,g=this.lf.graphModel,v=g.transformModel,m=v.SCALE_X,y=v.SCALE_Y,x=v.TRANSLATE_X,w=v.TRANSLATE_Y,E=t.safetyFactor||1.1,C=c.width/m*E,N=c.height/y*E,_=Math.ceil(C),S=Math.ceil(N),(M=document.createElement("canvas")).style.width="".concat(_,"px"),M.style.height="".concat(S,"px"),T=t.safetyMargin||40,A=this.getCanvasDimensionsByBrowser(),k=A.maxCanvasDimension,R=A.otherMaxCanvasDimension,O=R,I=S*l+2*a+T,L=1,B=1,(P=_*l+2*a+T)>(D=k)&&I>O?(L=D/P,B=O/I):P>O&&I>D?(L=O/P,B=D/I):P>D&&I<O?B=L=D/P:P<O&&I>D&&(B=L=D/I),(L<1||B<1)&&(P=Math.floor(P*L),I=Math.floor(I*B)),s.lastChild.style.transform="matrix(".concat(L,", 0, 0, ").concat(B,", ").concat((-f+x)*(1/m)*L+a/l,", ").concat((-p+w)*(1/y)*B+a/l,")"),M.width=P,M.height=I,(j=M.getContext("2d"))&&(j.clearRect(0,0,M.width,M.height),j.scale(l*L,l*B),o?(j.fillStyle=o,j.fillRect(0,0,M.width,M.height)):j.clearRect(0,0,M.width,M.height)),F=new Image,(H=document.createElement("style")).innerHTML=this.getClassRules(),(W=document.createElement("foreignObject")).appendChild(H),s.appendChild(W),[2,new Promise((function(e){F.onload=function(){var t=navigator.userAgent.indexOf("Firefox")>-1;try{t?createImageBitmap(F,{resizeWidth:n&&i?Vv(M,n,i).width:M.width,resizeHeight:n&&i?Vv(M,n,i).height:M.height}).then((function(t){null==j||j.drawImage(t,0,0),e(n&&i?Vv(M,n,i):M)})):(null==j||j.drawImage(F,0,0),e(n&&i?Vv(M,n,i):M))}catch(t){null==j||j.drawImage(F,0,0),e(n&&i?Vv(M,n,i):M)}};var t="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(s)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");F.src=t}))]}}))}))},e.prototype.withExportPreparation=function(e,t){return y(this,void 0,void 0,(function(){var n,i,o,r,a,s=this;return b(this,(function(l){switch(l.label){case 0:n=this.lf.graphModel.getPartial(),i=(null!=t?t:{}).partial,o=void 0===i?n:i,r=this.lf.getEditConfig(),this.lf.updateEditConfig({isSilentMode:!0,stopScrollGraph:!0,stopMoveGraph:!0}),l.label=1;case 1:return l.trys.push([1,,6,7]),n===o?[3,3]:(this.lf.graphModel.setPartial(o),[4,new Promise((function(t){s.lf.graphModel.eventCenter.once("graph:updated",(function(){return y(s,void 0,void 0,(function(){var i;return b(this,(function(o){switch(o.label){case 0:return[4,e()];case 1:return i=o.sent(),this.lf.graphModel.setPartial(n),t(i),[2]}}))}))}))}))]);case 2:return a=l.sent(),[3,5];case 3:return[4,e()];case 4:a=l.sent(),l.label=5;case 5:return[3,7];case 6:return this.lf.updateEditConfig(r),[7];case 7:return[2,a]}}))}))},e.prototype.getSnapshot=function(e,t){return y(this,void 0,void 0,(function(){var n=this;return b(this,(function(i){switch(i.label){case 0:return[4,this.withExportPreparation((function(){return n.snapshot(e,t)}),t)];case 1:return i.sent(),[2]}}))}))},e.prototype.snapshot=function(e,t){return y(this,void 0,void 0,(function(){var n,i,o,r,a,s,l,u,c,d=this;return b(this,(function(h){switch(h.label){case 0:return i=(n=null!=t?t:{}).fileType,o=void 0===i?"png":i,r=n.quality,this.fileName="".concat(null!=e?e:"logic-flow.".concat(Date.now()),".").concat(o),[4,Xv(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"!==o?[3,3]:[4,this.cloneSvg(a)];case 2:return s=h.sent(),l=(new XMLSerializer).serializeToString(s),u=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(u),this.triggerDownload(c),[3,4];case 3:this.getCanvasData(a,null!=t?t:{}).then((function(e){var t=e.toDataURL("image/".concat(o),r).replace("image/".concat(o),"image/octet-stream");d.triggerDownload(t)})),h.label=4;case 4:return[2]}}))}))},e.prototype.getSnapshotBlob=function(e,t,n){return y(this,void 0,void 0,(function(){var i=this;return b(this,(function(o){switch(o.label){case 0:return[4,this.withExportPreparation((function(){return i.snapshotBlob(n,t,e)}),n)];case 1:return[2,o.sent()]}}))}))},e.prototype.snapshotBlob=function(e,t,n){return y(this,void 0,void 0,(function(){var i,o,r,a=this;return b(this,(function(s){switch(s.label){case 0:return i=(null!=e?e:{}).fileType,o=void 0===i?t:i,[4,Xv(r=this.getSvgRootElement(this.lf))];case 1:return s.sent(),[2,new Promise((function(t){a.getCanvasData(r,g({backgroundColor:n},null!=e?e:{})).then((function(e){e.toBlob((function(n){t({data:n,width:e.width,height:e.height})}),"image/".concat(null!=o?o:"png"))}))}))]}}))}))},e.prototype.getSnapshotBase64=function(e,t,n){return y(this,void 0,void 0,(function(){var i=this;return b(this,(function(o){switch(o.label){case 0:return[4,this.withExportPreparation((function(){return i._getSnapshotBase64(e,t,n)}),n)];case 1:return[2,o.sent()]}}))}))},e.prototype._getSnapshotBase64=function(e,t,n){return y(this,void 0,void 0,(function(){var i,o,r,a=this;return b(this,(function(s){switch(s.label){case 0:return i=(null!=n?n:{}).fileType,o=void 0===i?t:i,[4,Xv(r=this.getSvgRootElement(this.lf))];case 1:return s.sent(),[2,new Promise((function(t){a.getCanvasData(r,g({backgroundColor:e},null!=n?n:{})).then((function(e){var n=e.toDataURL("image/".concat(null!=o?o:"png"));t({data:n,width:e.width,height:e.height})}))}))]}}))}))},e.pluginName="snapshot",e}(),Yv=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.paths=[],t.getPathes=function(){if(!n.startNodeType)throw new Error("需要预先指定开始节点类型");return n.getPathes()},t.setRawPaths=function(e){n.setPathes(e)},t.getRawPathes=function(){return n.paths},t.setStartNodeType=function(e){n.startNodeType=e}}return e.prototype.setPathes=function(e){this.paths=e.map((function(e){return{routeId:e.routeId,name:e.name,elements:e.elements,type:e.type,similarElement:null,weight:0}}))},e.prototype.getPathes=function(){var e=this,t=this.lf.getGraphRawData(),n=new Map,i=[];t.nodes.forEach((function(t){n.set(t.id,{id:t.id,data:t,nextNodes:[]}),t.type===e.startNodeType&&i.push(t.id)})),t.edges.forEach((function(e){var t=n.get(e.sourceNodeId);null==t||t.nextNodes.push(e.targetNodeId)}));var o=[];return i.forEach((function(t){var i=n.get(t);i&&(o=o.concat(e.findPathElements(i,n,[])))})),this.getNewPathes(o)},e.prototype.findPathElements=function(e,t,n){void 0===n&&(n=[]);var i=E([],w(n),!1);if(i.push(e.id),0===e.nextNodes.length)return[i];for(var o=[],r=0;r<e.nextNodes.length;r++){var a=t.get(e.nextNodes[r]),s=void 0;if(a){var l=i.indexOf(a.id);s=-1!==l?[E(E([],w(i.slice(l)),!1),[a.id],!1)]:this.findPathElements(a,t,E([],w(i),!1)),o=o.concat(s)}}return o},e.prototype.getNewPathes=function(e){var t=this,n=[],i=new Set;e.forEach((function(e){var o=t.getNewId("path"),r=t.getNewId("路径"),a=t.isLoopPath(e),s=e.join(",");i.has(s)||(i.add(s),n.push({routeId:o,name:r,elements:e,type:a,weight:0,similarElement:""}))}));var o=JSON.parse(JSON.stringify(this.paths));return n.forEach((function(e){for(var n=0;n<o.length;n++){var i=o[n],r=t.similar2Path(E([],w(e.elements),!1),E([],w(i.elements),!1));r>e.weight&&i.weight<=r&&(e.weight=r,e.similarElement=i,r===i.weight&&i.similarElement?(i.similarElement.similarElement=null,i.similarElement.weight=0,i.similarElement=null,i.weight=0):(i.similarElement=e,i.weight=r))}})),n.forEach((function(e){e.similarElement&&e.similarElement.similarElement===e&&(e.routeId=e.similarElement.routeId,e.name=e.similarElement.name),delete e.similarElement,delete e.weight})),this.setPathes(n),n},e.prototype.similar2Path=function(e,t){var n=0,i=e.length+t.length;e.sort(),t.sort();for(var o=e.shift(),r=t.shift();void 0!==o&&void 0!==r;)o===r?(n++,o=e.shift(),r=t.shift()):o<r?o=e.shift():o>r&&(r=t.shift());return n/i*200},e.prototype.getNewId=function(e){return"".concat(e,"_").concat(_())},e.prototype.isLoopPath=function(e){var t=e.length;return e.indexOf(e[t-1])!==t-1?1:0},e.pluginName="flowPath",e}(),$v=-1,Zv=0,Jv=1,Qv=function(){function e(e){var t=e.lf,n=this;this.levelHeight=[],this.newNodeMap=new Map,this.lf=t,this.trunk=[],t.layout=function(e){var t=n.lf.getGraphRawData();n.lf.setStartNodeType(e);var i=n.lf.getPathes();return n.levelHeight=[],n.newNodeMap=new Map,n.layout(t,i)}}return e.prototype.layout=function(e,t){var n=this,i=[];t.forEach((function(e){var t=e.elements;t.length>i.length?i=t:t.length===i.length&&JSON.stringify(t)===JSON.stringify(n.trunk)&&(i=n.trunk)})),this.trunk=i;for(var o=this.formatData(e),r={nodes:[],edges:[]},a=i.length-1;a>=0;a--)this.setNodePosition(i[a],o,r,a,1);this.lf.graphModel.graphDataToModel(r)},e.prototype.setNodePosition=function(e,t,n,i,o){var r=this,a=t[e],s=a.text,l=a.type,u=a.next,c=a.properties,d=160*i+40,h=120*o,f={id:e,x:d,text:s,y:h,type:l,properties:c};return s&&"object"==typeof s&&(f.text=g(g({},s),{x:d+s.x,y:h+s.y})),this.newNodeMap.set(f.id,{x:f.x,y:f.y,type:l}),n.nodes.push(f),a.isFixed=!0,this.addLevelHeight(i,1),u&&u.length>0&&u.forEach((function(o){if(!t[o.nodeId].isFixed){var a=r.getLevelHeight(i+1);r.addLevelHeight(i,1),r.setNodePosition(o.nodeId,t,n,i+1,a+1)}n.edges.push(g({id:o.edgeId,type:o.edgeType,sourceNodeId:e,targetNodeId:o.nodeId,properties:o.properties,text:o.text},r.getEdgeDataPoints(e,o.nodeId)))})),f},e.prototype.getEdgeDataPoints=function(e,t){var n=this.newNodeMap.get(e),i=this.newNodeMap.get(t),o=this.getShape(e),r=o.width,a=o.height,s=this.getShape(t),l=s.width,u=s.height,c=this.getRelativePosition(n,i),d={x:n.x,y:n.y},h={x:i.x,y:i.y};switch(c){case Zv:d.x=n.x+r/2,h.x=i.x-l/2;break;case $v:d.y=n.y+a/2,h.x=i.x-l/2;break;case Jv:d.x=n.x+r/2,h.y=i.y+u/2}return{startPoint:d,endPoint:h}},e.prototype.getRelativePosition=function(e,t){var n=e.y,i=t.y;return n<i?-1:n===i?0:1},e.prototype.getShape=function(e){var t,n,i=this.lf.getNodeModelById(e);return{height:null!==(t=null==i?void 0:i.height)&&void 0!==t?t:0,width:null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0}},e.prototype.formatData=function(e){var t=e.nodes.reduce((function(e,t){var n=t.type,i=t.properties,o=t.text,r=t.x,a=t.y;return o&&"object"==typeof o&&(o.x=o.x-r,o.y=o.y-a),e[t.id]={type:n,properties:i,text:o,prev:[],next:[]},e}),{});return e.edges.forEach((function(e){var n=e.sourceNodeId,i=e.targetNodeId,o=e.id,r=e.properties,a=e.text,s=a;"object"==typeof a&&(s=a.value),t[n].next.push({edgeId:o,nodeId:i,edgeType:e.type,properties:r,text:s}),t[i].prev.push({edgeId:o,nodeId:n,properties:r,text:s})})),t},e.prototype.addLevelHeight=function(e,t,n){void 0===t&&(t=1),void 0===n&&(n=!1);var i=this.levelHeight[e];i||(i={positiveHeight:0,negativeHeight:0},this.levelHeight[e]=i),n?i.negativeHeight-=t:i.positiveHeight+=t},e.prototype.getLevelHeight=function(e,t){void 0===t&&(t=!1);var n=this.levelHeight[e];return n?t?n.negativeHeight:n.positiveHeight:0},e.pluginName="AutoLayout",e}(),em=function(){function e(e){var t=e.lf,n=e.options;this.enable=!0,this.type="default",this.currentDistance=1/0,this.thresholdDistance=100,this.reverseDirection=!1,this.virtualEdgeStyle={strokeDasharray:"10,10",stroke:"#acacac"},this.lf=t,uo(this,n)}return e.prototype.render=function(){this.addEventListeners()},e.prototype.addEventListeners=function(){var e=this;this.lf.graphModel.eventCenter.on("node:dragstart",(function(t){var n=t.data;if("anchor"!==e.type&&e.enable){var i=e.lf.graphModel,o=n.id;e.currentNode=i.getNodeModelById(o)}})),this.lf.graphModel.eventCenter.on("node:drag",(function(){"anchor"!==e.type&&e.handleNodeDrag()})),this.lf.graphModel.eventCenter.on("anchor:dragstart",(function(t){var n=t.data,i=t.nodeModel;e.enable&&"node"!==e.type&&(e.currentNode=i,e.currentAnchor=n)})),this.lf.graphModel.eventCenter.on("anchor:drag",(function(t){var n=t.e,i=n.clientX,o=n.clientY;e.enable&&"node"!==e.type&&e.handleAnchorDrag(i,o)})),this.lf.graphModel.eventCenter.on("node:drop",(function(){e.enable&&"anchor"!==e.type&&e.handleDrop()})),this.lf.graphModel.eventCenter.on("anchor:dragend",(function(n){var i=n.e,o=n.edgeModel;if(e.enable&&"node"!==e.type){var r=e.lf.graphModel.getPointByClient({x:i.clientX,y:i.clientY}).canvasOverlayPosition,a=r.x,s=r.y;if(o&&e.virtualEdge){var l=e.virtualEdge.id,u=o.targetNodeId,c=e.lf.graphModel.getNodeModelById(u);if(c&&t.isInNode({x:a,y:s},c,10))return void e.lf.deleteEdge(l)}e.handleDrop()}}))},e.prototype.handleNodeDrag=function(){var e=this.lf.graphModel.nodes;if(!td(this.virtualEdge)){var n=this.virtualEdge,i=n.startPoint,o=n.endPoint,r=n.id;t.twoPointDistance(i,o)>this.thresholdDistance&&(this.lf.deleteEdge(r),this.virtualEdge=void 0)}this.currentNode&&this.findClosestAnchorOfNode(this.currentNode,e),this.currentDistance<this.thresholdDistance&&this.addVirtualEdge()},e.prototype.handleDrop=function(){this.addActualEdge(),this.resetData()},e.prototype.handleAnchorDrag=function(e,n){var i=this.lf.graphModel,o=i.getPointByClient({x:e,y:n}).canvasOverlayPosition,r=o.x,a=o.y;if(!td(r)&&!td(a)){var s={x:r,y:a},l=i.nodes;if(!td(this.virtualEdge)){var u=this.virtualEdge,c=u.endPoint,d=u.id;t.twoPointDistance(s,c)>this.thresholdDistance&&(this.lf.deleteEdge(d),this.virtualEdge=void 0)}this.findClosestAnchorOfAnchor(s,l),this.currentDistance<this.thresholdDistance&&this.addVirtualEdge()}},e.prototype.findClosestAnchorOfNode=function(e,n){var i=this;if(!td(e)&&!Vc(e)){var o,r,a,s,l=e.anchors,u=void 0===l?[]:l,c=e.id;n.forEach((function(e){if(!Kc(e.id,c)){var n=e.anchors;(void 0===n?[]:n).forEach((function(n){u.forEach((function(l){if(i.anchorAllowConnect(e,n,l)){var u=t.twoPointDistance(l,n);(!o||u<o)&&(o=u,r=l,a=n,s=e)}}))}))}})),this.currentDistance=o,this.currentAnchor=r,this.closestAnchor=a,this.closestNode=s}},e.prototype.findClosestAnchorOfAnchor=function(e,n){var i=this;if(!td(e)){var o,r,a,s=this.currentNode,l=this.currentAnchor;n.forEach((function(n){if(s){var u=n.anchors;(void 0===u?[]:u).forEach((function(s){var u;if(!Kc(null===(u=i.currentAnchor)||void 0===u?void 0:u.id,s.id)&&i.anchorAllowConnect(n,s,l)){var c=t.twoPointDistance(e,s);(!o||c<o)&&(o=c,r=s,a=n)}}))}})),this.currentDistance=o,this.closestAnchor=r,this.closestNode=a}},e.prototype.anchorAllowConnect=function(e,t,n){var i=this.currentNode;if(i){var o=(this.reverseDirection?e.isAllowConnectedAsSource(i,t,n):i.isAllowConnectedAsSource(e,n,t)).isAllPass,r=(this.reverseDirection?i.isAllowConnectedAsTarget(e,t,n):e.isAllowConnectedAsTarget(i,n,t)).isAllPass;return o&&r}},e.prototype.sameEdgeIsExist=function(e){if(td(this.closestNode)||td(this.currentNode)||td(this.closestAnchor)||td(this.currentAnchor))return!1;if(td(e))return!1;var t=this,n=t.closestNode.id,i=t.currentNode.id,o=t.closestAnchor.id,r=t.currentAnchor.id,a=t.reverseDirection,s=e.sourceNodeId,l=e.targetNodeId,u=e.sourceAnchorId,c=e.targetAnchorId;return a?Kc(n,s)&&Kc(i,l)&&Kc(o,u)&&Kc(r,c):Kc(i,s)&&Kc(n,l)&&Kc(r,u)&&Kc(o,c)},e.prototype.addVirtualEdge=function(){var e=this,t=Hh(this.lf.graphModel.edges,(function(t,n){return n.virtual?t:t||e.sameEdgeIsExist(n)}),!1);if(!t){if(!td(this.virtualEdge)){var n=this.virtualEdge.id;if(this.sameEdgeIsExist(this.virtualEdge))return;this.lf.deleteEdge(n)}var i=this,o=i.reverseDirection,r=i.currentNode,a=i.closestNode,s=i.currentAnchor,l=i.closestAnchor;if(!Vc(r)&&!Vc(a)){var u={style:this.virtualEdgeStyle};this.virtualEdge=this.lf.addEdge(o?{sourceNodeId:null==a?void 0:a.id,targetNodeId:null==r?void 0:r.id,sourceAnchorId:null==l?void 0:l.id,targetAnchorId:null==s?void 0:s.id,properties:u}:{sourceNodeId:null==r?void 0:r.id,targetNodeId:null==a?void 0:a.id,sourceAnchorId:null==s?void 0:s.id,targetAnchorId:null==l?void 0:l.id,properties:u}),this.virtualEdge.virtual=!0}}},e.prototype.addActualEdge=function(){if(!td(this.virtualEdge)){var e=this.virtualEdge,t=e.type,n=e.sourceNodeId,i=e.targetNodeId,o=e.sourceAnchorId,r=e.targetAnchorId,a=e.startPoint,s=e.endPoint,l=e.pointsList;this.lf.deleteEdge(this.virtualEdge.id),this.lf.addEdge({type:t,sourceNodeId:n,targetNodeId:i,sourceAnchorId:o,targetAnchorId:r,startPoint:a,endPoint:s,pointsList:l})}},e.prototype.setVirtualEdgeStyle=function(e){this.virtualEdgeStyle=g(g({},this.virtualEdgeStyle),e)},e.prototype.setThresholdDistance=function(e){$c(e)&&(this.thresholdDistance=e)},e.prototype.setReverseDirection=function(e){this.reverseDirection=e},e.prototype.setEnable=function(e){this.enable=e,e||this.resetData()},e.prototype.resetData=function(){this.closestNode=void 0,this.currentDistance=1/0,this.currentNode=void 0,this.currentAnchor=void 0,this.closestAnchor=void 0,this.virtualEdge=void 0},e.pluginName="proximityConnect",e}(),tm=function(){function e(e){var t=e.lf,n=this;this.controlItems=[{key:"zoom-out",iconClass:"lf-control-zoomOut",title:"缩小流程图",text:"缩小",onClick:function(){n.lf.zoom(!1)}},{key:"zoom-in",iconClass:"lf-control-zoomIn",title:"放大流程图",text:"放大",onClick:function(){n.lf.zoom(!0)}},{key:"reset",iconClass:"lf-control-fit",title:"恢复流程原有尺寸",text:"适应",onClick:function(){n.lf.resetZoom()}},{key:"undo",iconClass:"lf-control-undo",title:"回到上一步",text:"上一步",onClick:function(){n.lf.undo()}},{key:"redo",iconClass:"lf-control-redo",title:"移到下一步",text:"下一步",onClick:function(){n.lf.redo()}}],this.lf=t}return e.prototype.render=function(e,t){this.destroy();var n=this.getControlTool();this.toolEl=n,t.appendChild(n),this.domContainer=t},e.prototype.destroy=function(){this.domContainer&&this.toolEl&&this.domContainer.contains(this.toolEl)&&this.domContainer.removeChild(this.toolEl)},e.prototype.addItem=function(e){this.controlItems.push(e)},e.prototype.removeItem=function(e){var t=this.controlItems.findIndex((function(t){return t.key===e}));return-1==t?null:this.controlItems.splice(t,1)[0]},e.prototype.getControlTool=function(){var e=this,t="lf-control-item",n="lf-control-item disabled",i=document.createElement("div"),o=[];return i.className="lf-control",this.controlItems.forEach((function(i){var r=document.createElement("div"),a=document.createElement("i"),s=document.createElement("span");switch(r.className=n,i.onClick&&(r.onclick=i.onClick.bind(null,e.lf)),i.onMouseEnter&&(r.onmouseenter=i.onMouseEnter.bind(null,e.lf)),i.onMouseLeave&&(r.onmouseleave=i.onMouseLeave.bind(null,e.lf)),a.className=i.iconClass,s.className="lf-control-text",s.title=i.title,s.innerText=i.text,r.append(a,s),i.text){case"上一步":e.lf.on("history:change",(function(e){var i=e.data.undoAble;r.className=i?t:n}));break;case"下一步":e.lf.on("history:change",(function(e){var i=e.data.redoAble;r.className=i?t:n}));break;default:r.className=t}o.push(r)})),i.append.apply(i,E([],w(o),!1)),i},e.pluginName="control",e}(),nm="lf:defaultNodeMenu",im="lf:defaultEdgeMenu",om="lf:defaultGraphMenu",rm="lf:defaultSelectionMenu",am={nodeMenu:nm,edgeMenu:im,graphMenu:om,selectionMenu:rm},sm={nodeMenu:[],edgeMenu:[],graphMenu:[],selectionMenu:[]},lm=function(){function e(e){var t=e.lf,n=this;this.__currentData=null,this.__isSilentMode=!1,this.lf=t,this.__menuDOM=document.createElement("ul"),this.__isSilentMode=t.graphModel.editConfigModel.isSilentMode,this.menuTypeMap=new Map,this.init(),this.lf.setMenuConfig=function(e){n.setMenuConfig(e)},this.lf.addMenuConfig=function(e){n.addMenuConfig(e)},this.lf.setMenuByType=function(e){n.setMenuByType(e)},this.lf.changeMenuItemDisableStatus=function(e,t,i){n.changeMenuItemDisableStatus(e,t,i)},this.lf.getMenuConfig=function(e){return n.getMenuConfig(e)},this.lf.resetMenuConfigByType=function(e){n.resetMenuConfigByType(e)}}return e.prototype.init=function(){var e,t,n,i=this;sm.nodeMenu=[{text:"删除",callback:function(e){i.lf.deleteNode(e.id)}},{text:"编辑文本",callback:function(e){i.lf.graphModel.editText(e.id)}},{text:"复制",callback:function(e){i.lf.cloneNode(e.id)}}],null===(e=this.menuTypeMap)||void 0===e||e.set(nm,sm.nodeMenu),sm.edgeMenu=[{text:"删除",callback:function(e){i.lf.deleteEdge(e.id)}},{text:"编辑文本",callback:function(e){i.lf.graphModel.editText(e.id)}}],null===(t=this.menuTypeMap)||void 0===t||t.set(im,sm.edgeMenu),sm.graphMenu=[],sm.selectionMenu=[{text:"删除",callback:function(e){i.lf.clearSelectElements(),e.edges.forEach((function(e){return i.lf.deleteEdge(e.id)})),e.nodes.forEach((function(e){return i.lf.deleteNode(e.id)}))}}],null===(n=this.menuTypeMap)||void 0===n||n.set(rm,sm.selectionMenu)},e.prototype.showMenu=function(e,t,n,i){if(!this.__isSilentMode&&n&&n.length){var o=this.__menuDOM;if(o){if(o.innerHTML="",o.append.apply(o,E([],w(this.__getMenuDom(n)),!1)),!o.children.length)return;if(o.style.display="block",!i)return o.style.top="".concat(t,"px"),void(o.style.left="".concat(e,"px"));var r=i.width,a=i.height,s=i.clientX,l=i.clientY,u=this.lf.graphModel,c=o.offsetWidth,d=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f=h-s,p=u.rootEl.getBoundingClientRect(),g=p.left+p.width;g<h&&(f=g-s),f<c&&(d=!1),o.style.left="".concat(d?e:e-r,"px");var v=o.offsetHeight,m=!0,y=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=y-l,x=p.top+p.height;x<y&&(b=x-l),b<v&&(m=!1),o.style.top="".concat(m?t:t-a,"px")}}},e.prototype.processMenuConfig=function(e,t){var n=this;if(e){["nodeMenu","edgeMenu","graphMenu","selectionMenu"].forEach((function(i){var o,r,a,s,l=e[i],u=am[i];if(void 0!==l)if("set"===t)null===(o=n.menuTypeMap)||void 0===o||o.set(u,l||[]);else if("add"===t&&Array.isArray(l)){var c=null!==(a=null===(r=n.menuTypeMap)||void 0===r?void 0:r.get(u))&&void 0!==a?a:[];null===(s=n.menuTypeMap)||void 0===s||s.set(u,c.concat(l))}}))}},e.prototype.createImageElement=function(e,t){var n=document.createElement("img");return n.src=e,n.alt=t,n.style.width="16px",n.style.height="16px",n.style.objectFit="contain",n},e.prototype.isImageFile=function(e){return[".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"].some((function(t){return e.toLowerCase().includes(t)}))},e.prototype.processIcon=function(e,t,n){var i;if("string"==typeof t){var o=t;if(o.startsWith("data:image/")){var r=this.createImageElement(o,n||"icon");e.appendChild(r)}else if(this.isImageFile(o)){r=this.createImageElement(o,n||"icon");e.appendChild(r)}else if(o.includes("<")&&o.includes(">"))e.innerHTML=o;else if(o.includes(" ")||o.startsWith(".")){var a=o.replace(/^\./,"").split(" ");(i=e.classList).add.apply(i,E([],w(a),!1))}else e.classList.add(o)}},e.prototype.__getMenuDom=function(e){var t=this,n=[];return e&&e.length>0&&e.forEach((function(e){var i=document.createElement("li");if(e.className?i.className="lf-menu-item ".concat(e.disabled?"lf-menu-item__disabled":""," ").concat(e.className):i.className="lf-menu-item ".concat(e.disabled?"lf-menu-item__disabled":""),e.icon){var o=document.createElement("span");o.className="lf-menu-item-icon",t.processIcon(o,e.icon,e.text),i.appendChild(o)}var r=document.createElement("span");r.className="lf-menu-item-text",e.text&&(r.innerText=e.text),i.appendChild(r),e.disabled&&i.setAttribute("disabled","true"),i.onclickCallback=e.callback,n.push(i)})),n},e.prototype.updateMenuItemDOMStatus=function(e,t){if(this.__menuDOM&&"none"!==this.__menuDOM.style.display){var n=Array.from(this.__menuDOM.querySelectorAll(".lf-menu-item")).find((function(t){var n=t.querySelector(".lf-menu-item-text");return(null==n?void 0:n.textContent)===e}));if(n){var i=n;t?(i.classList.add("lf-menu-item__disabled"),i.setAttribute("disabled","true")):(i.classList.remove("lf-menu-item__disabled"),i.removeAttribute("disabled"))}}},e.prototype.setupSilentModeListener=function(){var e=this;this.__editConfigChangeHandler=function(t){var n=t.data.isSilentMode;n!==e.__isSilentMode&&(e.__isSilentMode=n,e.updateMenuVisibility(!n))},this.lf.on("editConfig:changed",this.__editConfigChangeHandler)},e.prototype.updateMenuVisibility=function(e){this.__menuDOM&&(e?this.__currentData&&(this.__menuDOM.style.display="block"):(this.__menuDOM.style.display="none",this.__currentData=null))},e.prototype.refreshCurrentMenu=function(){var e,t,n,i,o,r,a,s,l,u,c;if(this.__menuDOM&&"none"!==this.__menuDOM.style.display&&this.__currentData){var d=this.__menuDOM.style,h=d.left,f=d.top,p=[];if(this.__currentData&&"object"==typeof this.__currentData)if("sourceNodeId"in this.__currentData&&"targetNodeId"in this.__currentData){if(v=this.lf.graphModel.getEdgeModelById(this.__currentData.id)){var g=null===(t=this.menuTypeMap)||void 0===t?void 0:t.get(v.type);p=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(i=null===(n=this.menuTypeMap)||void 0===n?void 0:n.get(im))&&void 0!==i?i:[])}}else if("id"in this.__currentData&&"type"in this.__currentData){var v;if(v=this.lf.graphModel.getNodeModelById(this.__currentData.id)){g=null===(o=this.menuTypeMap)||void 0===o?void 0:o.get(v.type);p=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(a=null===(r=this.menuTypeMap)||void 0===r?void 0:r.get(nm))&&void 0!==a?a:[])}}else p="nodes"in this.__currentData&&"edges"in this.__currentData?null!==(l=null===(s=this.menuTypeMap)||void 0===s?void 0:s.get(rm))&&void 0!==l?l:[]:null!==(c=null===(u=this.menuTypeMap)||void 0===u?void 0:u.get(om))&&void 0!==c?c:[];p&&p.length>0?(this.__menuDOM.innerHTML="",(e=this.__menuDOM).append.apply(e,E([],w(this.__getMenuDom(p)),!1)),h&&(this.__menuDOM.style.left=h),f&&(this.__menuDOM.style.top=f)):(this.__menuDOM.style.display="none",this.__currentData=null)}},e.prototype.setMenuByType=function(e){var t,n=e.type,i=e.menu;n&&i&&(null===(t=this.menuTypeMap)||void 0===t||t.set(n,i),this.refreshCurrentMenu())},e.prototype.getMenuConfig=function(e){var t,n;return null!==(n=null===(t=this.menuTypeMap)||void 0===t?void 0:t.get(am[e]))&&void 0!==n?n:[]},e.prototype.resetMenuConfigByType=function(e){var t;this.setMenuConfig(((t={})[e]=sm[e],t))},e.prototype.resetAllMenuConfig=function(){this.setMenuConfig(sm)},e.prototype.setMenuConfig=function(e){this.processMenuConfig(e,"set"),this.refreshCurrentMenu()},e.prototype.addMenuConfig=function(e){this.processMenuConfig(e,"add"),this.refreshCurrentMenu()},e.prototype.changeMenuItem=function(e,t){if("add"===e)this.addMenuConfig(t);else{if("reset"!==e)throw new Error("The first parameter of changeMenuConfig should be 'add' or 'reset'");this.setMenuConfig(t)}},e.prototype.changeMenuItemDisableStatus=function(e,t,n){var i,o;if(e&&t){var r=null!==(o=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(am[e]))&&void 0!==o?o:[];if(r.length){var a=r.find((function(e){return e.text===t}));a&&(a.disabled=n,this.updateMenuItemDOMStatus(t,n))}}},e.prototype.render=function(e,t){var n=this;e.graphModel.editConfigModel.isSilentMode||(this.__container=t,this.__currentData=null,this.setupSilentModeListener(),this.__menuDOM&&(this.__menuDOM.className="lf-menu",t.appendChild(this.__menuDOM),this.__menuDOM.addEventListener("click",(function(e){e.stopPropagation();for(var t=e.target;-1===Array.from(t.classList).indexOf("lf-menu-item")&&-1===Array.from(t.classList).indexOf("lf-menu");)t=null==t?void 0:t.parentElement;Array.from(t.classList).indexOf("lf-menu-item__disabled")>-1||Array.from(t.classList).indexOf("lf-menu-item")>-1&&(t.onclickCallback(n.__currentData,t),n.__menuDOM&&(n.__menuDOM.style.display="none"),n.__currentData=null)}),!0)),this.lf.on("node:contextmenu",(function(e){var t,i,o=e.data,r=e.position,a=e.e,s=r.domOverlayPosition,l=s.x,u=s.y,c=o.id,d=n.lf.graphModel.getNodeModelById(c);if(d&&!n.__isSilentMode){var h=[],f=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(d.type);h=d&&d.menu&&Array.isArray(d.menu)?d.menu:f||(null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(nm)),n.__currentData=o,n.showMenu(l,u,h,{width:d.width,height:d.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(e){var t,i,o,r=e.data,a=e.position,s=e.e,l=a.domOverlayPosition,u=l.x,c=l.y,d=r.id,h=n.lf.graphModel.getEdgeModelById(d);if(h&&!n.__isSilentMode){var f=[],p=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(h.type);f=h&&h.menu&&Array.isArray(h.menu)?h.menu:p||(null!==(o=null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(im))&&void 0!==o?o:[]),n.__currentData=r,n.showMenu(u,c,f,{width:h.width,height:h.height,clientX:s.clientX,clientY:s.clientY})}})),this.lf.on("blank:contextmenu",(function(e){var t,i,o=e.position;if(!n.__isSilentMode){var r=null!==(i=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(om))&&void 0!==i?i:[],a=o.domOverlayPosition,s=a.x,l=a.y;n.__currentData=g({},o.canvasOverlayPosition),n.showMenu(s,l,r)}})),this.lf.on("selection:contextmenu",(function(e){var t,i=e.data,o=e.position;if(!n.__isSilentMode){var r=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(rm),a=o.domOverlayPosition,s=a.x,l=a.y;n.__currentData=i,n.showMenu(s,l,r)}})),this.lf.on("node:mousedown",(function(){n.__menuDOM.style.display="none"})),this.lf.on("edge:click",(function(){n.__menuDOM.style.display="none"})),this.lf.on("blank:click",(function(){n.__menuDOM.style.display="none"})))},e.prototype.destroy=function(){var e;this.__editConfigChangeHandler&&this.lf.off("editConfig:changed",this.__editConfigChangeHandler),this.__menuDOM&&(null===(e=null==this?void 0:this.__container)||void 0===e||e.removeChild(this.__menuDOM),this.__menuDOM=void 0)},e.pluginName="menu",e}(),um="menu-common",cm=function(){function e(e){var t=e.lf,n=this;this.menuTypeMap=new Map,this.listenDelete=function(){n.hideContextMenu()},this.lf=t,this.__menuDOM=document.createElement("div"),this.__menuDOM.className="lf-inner-context",this.menuTypeMap.set(um,[]),this.lf.setContextMenuByType=function(e,t){n.setContextMenuByType(e,t)},this.lf.setContextMenuItems=function(e){n.setContextMenuItems(e)},this.lf.showContextMenu=function(e){n.showContextMenu(e)},this.lf.hideContextMenu=function(){n.hideContextMenu()}}return e.prototype.render=function(e,t){var n=this;this.container=t,e.on("node:click",(function(e){var t=e.data;n._activeData=t,n.createContextMenu()})),e.on("edge:click",(function(e){var t=e.data;n._activeData=t,n.createContextMenu()})),e.on("blank:click",(function(){n.hideContextMenu()}))},e.prototype.setContextMenuByType=function(e,t){this.menuTypeMap.set(e,t)},e.prototype.hideContextMenu=function(){this.__menuDOM.innerHTML="",this.__menuDOM.style.display="none",this.isShow&&this.container.removeChild(this.__menuDOM),this.lf.off("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!1},e.prototype.showContextMenu=function(e){e&&e.id&&(this._activeData=e,this.createContextMenu())},e.prototype.setContextMenuItems=function(e){this.menuTypeMap.set(um,e)},e.prototype.getContextMenuPosition=function(){var e=this._activeData,t=this.lf.graphModel.getElement(e.id);if(t){var n,i;if("edge"===t.BaseType){n=Number.MIN_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER;var o=t.getData();n=Math.max(o.startPoint.x,n),i=Math.min(o.startPoint.y,i),n=Math.max(o.endPoint.x,n),i=Math.min(o.endPoint.y,i),o.pointsList&&o.pointsList.forEach((function(e){n=Math.max(e.x,n),i=Math.min(e.y,i)}))}return"node"===t.BaseType&&(n=e.x+t.width/2,i=e.y-t.height/2),this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([n,i])}},e.prototype.createContextMenu=function(){var e=this;if(!this.lf.options.isSilentMode){var t=E(E([],w(this.menuTypeMap.get(this._activeData.type)||[]),!1),w(this.menuTypeMap.get(um)||[]),!1),n=document.createDocumentFragment();t.forEach((function(t){var i=document.createElement("div");i.className="lf-context-item";var o=document.createElement("img");o.src=t.icon,o.className="lf-context-img",t.className&&(i.className="".concat(i.className," ").concat(t.className)),o.addEventListener("click",(function(){e.hideContextMenu(),t.callback?t.callback(e._activeData):e.addNode({sourceId:e._activeData.id,x:e._activeData.x,y:e._activeData.y,properties:t.properties,type:t.type})})),i.appendChild(o),n.appendChild(i)})),this.__menuDOM.innerHTML="",this.__menuDOM.appendChild(n),this.showMenu()}},e.prototype.addNode=function(e,t){var n=void 0!==t;void 0===t&&(t=e.y);var i=this.lf.getNodeModelById(e.sourceId);if(i){var o=e.x-i.width+200,r=t-e.y/2-20,a=e.x+i.width+200,s=t+e.y/2+20;if(this.lf.getAreaElement([o,r],[a,s]).length)return t+=100,void this.addNode(e,t);if(e.type){var l=this.lf.addNode({type:e.type,x:e.x+200,y:t,properties:e.properties}),u=void 0,c=void 0;n&&(u={x:e.x,y:e.y+i.height/2},c={x:l.x-l.width/2,y:l.y}),this.lf.addEdge({sourceNodeId:e.sourceId,targetNodeId:l.id,startPoint:u,endPoint:c})}}},e.prototype.showMenu=function(){var e=this.getContextMenuPosition();if(e){var t=w(e,2),n=t[0],i=t[1];this.__menuDOM.style.display="flex",this.__menuDOM.style.top="".concat(i,"px"),this.__menuDOM.style.left="".concat(n+10,"px"),this.container.appendChild(this.__menuDOM),!this.isShow&&this.lf.on("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!0}},e.pluginName="contextMenu",e}(),dm=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.lf.setPatternItems=function(e){n.setPatternItems(e)}}return e.prototype.render=function(e,t){var n=this;this.destroy(),this.shapeList&&0!==this.shapeList.length?(this.panelEl=document.createElement("div"),this.panelEl.className="lf-dndpanel",this.shapeList.forEach((function(e){var t;null===(t=n.panelEl)||void 0===t||t.appendChild(n.createDndItem(e))})),t.appendChild(this.panelEl),this.domContainer=t):this.domContainer=t},e.prototype.destroy=function(){this.domContainer&&this.panelEl&&this.domContainer.contains(this.panelEl)&&this.domContainer.removeChild(this.panelEl)},e.prototype.setPatternItems=function(e){this.shapeList=e,this.domContainer&&this.render(this.lf,this.domContainer)},e.prototype.createDndItem=function(e){var t=this,n=document.createElement("div");n.className=e.className?"lf-dnd-item ".concat(e.className):"lf-dnd-item";var i=document.createElement("div");if(i.className="lf-dnd-shape",e.icon&&(i.style.backgroundImage="url(".concat(e.icon,")")),n.appendChild(i),e.label){var o=document.createElement("div");o.innerText=e.label,o.className="lf-dnd-text",n.appendChild(o)}return e.disabled?(n.classList.add("disabled"),n.onmousedown=function(){e.callback&&e.callback(t.lf,t.domContainer)},n):(n.onmousedown=function(){e.type&&t.lf.dnd.startDrag({type:e.type,properties:e.properties,text:e.text}),e.callback&&e.callback(t.lf,t.domContainer)},n.ondblclick=function(n){t.lf.graphModel.eventCenter.emit("dnd:panel-dbclick",{e:n,data:e})},n.onclick=function(n){t.lf.graphModel.eventCenter.emit("dnd:panel-click",{e:n,data:e})},n.oncontextmenu=function(n){t.lf.graphModel.eventCenter.emit("dnd:panel-contextmenu",{e:n,data:e})},n)},e.pluginName="dndPanel",e}(),hm=function(){function e(e){var t=e.lf,n=e.LogicFlow,i=e.options,o=this;this.width=200,this.height=150,this.scale=1,this.translateX=0,this.translateY=0,this.showEdge=!1,this.viewPortTop=0,this.viewPortLeft=0,this.viewPortWidth=150,this.viewPortHeight=75,this.isShow=!1,this.isShowHeader=!1,this.isShowCloseIcon=!1,this.headerTitle="导航",this.disabledPlugins=["miniMap","control","selectionSelect"],this.onGraphResize=function(){o.updateViewPortBounds(),o.isShow&&o.updateViewPort()},this.render=function(e,t){o.container=t,o.lf.on("history:change",(function(){o.isShow&&o.setView()})),o.lf.on("graph:transform",(function(){o.isShow&&o.setView(!1)}))},this.show=function(e,t){o.isShow||(o.initMiniMap(),o.lf.on("graph:resize",o.onGraphResize),o.createMiniMap(e,t),o.setView(!0)),o.isShow=!0},this.hide=function(){o.isShow&&(o.lf.off("graph:resize",o.onGraphResize),o.lfMap.destroy(),o.translateX=0,o.translateY=0,o.removeMiniMap(),o.lf.emit("miniMap:close",{})),o.isShow=!1},this.updatePosition=function(e){if("object"==typeof e)void 0===e.left&&void 0===e.right||(o.leftPosition=e.left,o.rightPosition=e.right),void 0===e.top&&void 0===e.bottom||(o.topPosition=e.top,o.bottomPosition=e.bottom);else switch(e){case"left-top":o.leftPosition=0,o.rightPosition=void 0,o.topPosition=0,o.bottomPosition=void 0;break;case"right-top":o.leftPosition=void 0,o.rightPosition=0,o.topPosition=0,o.bottomPosition=void 0;break;case"left-bottom":o.leftPosition=0,o.rightPosition=void 0,o.topPosition=void 0,o.bottomPosition=0;break;case"right-bottom":o.leftPosition=void 0,o.rightPosition=0,o.topPosition=void 0,o.bottomPosition=0}o.updateMiniMapPosition()},this.reset=function(){o.lf.resetTranslate(),o.lf.resetZoom()},this.setShowEdge=function(e){o.showEdge!==e&&(o.showEdge=e,o.setView())},this.startDrag=function(e){document.addEventListener("mousemove",o.drag),document.addEventListener("mouseup",o.drop);var t=e.x,n=e.y;o.startPosition={x:t,y:n}},this.drag=function(e){var t=e.x,n=e.y,i=(t-o.startPosition.x)/o.scale,r=(n-o.startPosition.y)/o.scale,a=o.viewPortLeft+i+o.viewPortWidth/o.scale/2,s=o.viewPortTop+r+o.viewPortHeight/o.scale/2;o.startPosition={x:t,y:n},o.lf.focusOn({coordinate:{x:a,y:s}})},this.drop=function(){document.removeEventListener("mousemove",o.drag),document.removeEventListener("mouseup",o.drop)},this.mapClick=function(e){var t=e.offsetX,n=e.offsetY,i=o.translateX+t/o.scale,r=o.translateY+n/o.scale;o.lf.focusOn({coordinate:{x:i,y:r}})},this.lf=t,this.LFCtor=n,i&&this.setOption(i),this.viewPortWidth=t.graphModel.width,this.viewPortHeight=t.graphModel.height;var r={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=r,this.elementAreaBounds=r,this.viewPortBounds=r}return e.prototype.setOption=function(e){var t=e.width,n=void 0===t?150:t,i=e.height,o=void 0===i?220:i,r=e.showEdge,a=void 0!==r&&r,s=e.isShowHeader,l=void 0!==s&&s,u=e.isShowCloseIcon,c=void 0!==u&&u,d=e.leftPosition,h=e.topPosition,f=e.rightPosition,p=void 0===f?0:f,g=e.bottomPosition,v=void 0===g?0:g,m=e.headerTitle,y=void 0===m?"导航":m;this.width=n,this.height=o,this.showEdge=a,this.isShowHeader=l,this.isShowCloseIcon=c,this.leftPosition=d,this.rightPosition=void 0!==d?void 0:p,this.topPosition=h,this.bottomPosition=void 0!==h?void 0:v,this.headerTitle=y},e.prototype.initMiniMap=function(){var e=document.createElement("div");e.className="lf-mini-map-graph",e.style.width="".concat(this.width,"px"),e.style.height="".concat(this.height,"px"),this.lfMap=new this.LFCtor({container:e,grid:!1,isSilentMode:!0,stopZoomGraph:!0,stopScrollGraph:!0,stopMoveGraph:!1,history:!1,snapline:!1,disabledPlugins:this.disabledPlugins,isMiniMap:!0}),this.miniMapWrap=e,this.createViewPort(),e.addEventListener("click",this.mapClick)},e.prototype.createMiniMap=function(e,t){var n,i=document.createElement("div");this.miniMapContainer=i,i.appendChild(this.miniMapWrap),i.style.position="absolute",void 0===e&&void 0===t||(this.leftPosition=e||0,this.topPosition=t||0,this.rightPosition=void 0,this.bottomPosition=void 0),this.updateMiniMapPosition(),i.className="lf-mini-map",this.isShowCloseIcon||i.classList.add("lf-mini-map-no-close-icon"),this.isShowHeader||i.classList.add("lf-mini-map-no-header"),null===(n=this.container)||void 0===n||n.appendChild(i),this.miniMapWrap.appendChild(this.viewport);var o=document.createElement("div");o.className="lf-mini-map-header",o.innerText=this.headerTitle,i.appendChild(o);var r=document.createElement("span");r.className="lf-mini-map-close",r.addEventListener("click",this.hide),i.appendChild(r)},e.prototype.updateMiniMapPosition=function(){if(this.miniMapContainer){var e=this.miniMapContainer.style;void 0!==this.rightPosition?(e.right="".concat(this.rightPosition,"px"),e.left=""):(e.left="".concat(this.leftPosition,"px"),e.right=""),void 0!==this.bottomPosition?(e.bottom="".concat(this.bottomPosition,"px"),e.top=""):(e.top="".concat(this.topPosition,"px"),e.bottom="")}},e.prototype.removeMiniMap=function(){var e;this.miniMapContainer&&(null===(e=this.container)||void 0===e||e.removeChild(this.miniMapContainer))},e.prototype.updateBounds=function(e){e&&this.updateElementAreaBounds(e),this.updateViewPortBounds(),this.bounds={left:Math.min(this.elementAreaBounds.left,this.viewPortBounds.left),right:Math.max(this.elementAreaBounds.right,this.viewPortBounds.right),top:Math.min(this.elementAreaBounds.top,this.viewPortBounds.top),bottom:Math.max(this.elementAreaBounds.bottom,this.viewPortBounds.bottom)}},e.prototype.updateElementAreaBounds=function(e){var t={left:0,right:0,top:0,bottom:0},n=e.nodes;n&&n.length>0&&n.forEach((function(e){var n,i,o=e.x,r=e.y,a=null!==(n=e.width)&&void 0!==n?n:200,s=null!==(i=e.height)&&void 0!==i?i:200,l=o-a/2,u=o+a/2,c=r-s/2,d=r+s/2;t.left=Math.min(l,t.left),t.right=Math.max(u,t.right),t.top=Math.min(c,t.top),t.bottom=Math.max(d,t.bottom)})),this.elementAreaBounds=t},e.prototype.updateViewPortBounds=function(){var e=this.lf.getTransform(),t=e.TRANSLATE_X,n=e.TRANSLATE_Y,i=e.SCALE_X,o=e.SCALE_Y,r=this.lf.graphModel,a=r.width,s=r.height;this.viewPortBounds={left:-t/i,right:(-t+a)/i,top:-n/o,bottom:(-n+s)/o}},e.prototype.resetData=function(e){var t=e.nodes,n=e.edges;return t.forEach((function(e){e.text=void 0})),this.showEdge&&n.forEach((function(e){e.text=void 0})),{nodes:t,edges:this.showEdge?n:[]}},e.prototype.setView=function(e){var t,n;if(void 0===e&&(e=!0),e){var i=this.lf.getGraphRawData(),o=this.resetData(i),r=this.lf.viewMap,a=this.lf.graphModel.modelMap,s=this.lfMap.viewMap;try{for(var l=x(r.keys()),u=l.next();!u.done;u=l.next()){var c=u.value;s.has(c)||this.lfMap.register({type:c,view:r.get(c),model:a.get(c)})}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}this.lfMap.render(o),this.updateBounds(o)}else this.updateBounds();var d=this.bounds,h=d.left,f=d.top,p=d.right-h,g=d.bottom-f,v=this.width/p,m=this.height/g,y=Math.min(v,m);this.scale=y;var b=h-(this.width/y-p)/2,w=f-(this.height/y-g)/2;if(this.lfMap.graphModel.transformModel.translate(-b+this.translateX,-w+this.translateY),this.translateX=b,this.translateY=w,this.miniMapWrap.firstChild){var E=this.miniMapWrap.firstChild.style;E.pointerEvents="none",E.transform="matrix(".concat(y,", 0, 0, ").concat(y,", 0, 0)"),E.transformOrigin="left top",E.height="".concat(this.height/y,"px"),E.width="".concat(this.width/y,"px"),this.updateViewPort()}},e.prototype.updateViewPort=function(){var e=this.viewport.style,t=this.lf.getTransform(),n=t.TRANSLATE_X,i=t.TRANSLATE_Y,o=t.SCALE_X,r=t.SCALE_Y,a=this.lf.graphModel,s=a.width,l=a.height;this.viewPortLeft=-n/o,this.viewPortTop=-i/r,this.viewPortWidth=s/o*this.scale,this.viewPortHeight=l/r*this.scale,e.width="".concat(this.viewPortWidth,"px"),e.height="".concat(this.viewPortHeight,"px"),e.left="".concat((this.viewPortLeft-this.translateX)*this.scale,"px"),e.top="".concat((this.viewPortTop-this.translateY)*this.scale,"px")},e.prototype.createViewPort=function(){var e=document.createElement("div");e.className="lf-minimap-viewport",e.addEventListener("mousedown",this.startDrag),e.addEventListener("click",(function(e){e.stopPropagation()})),this.viewport=e},e.prototype.destroy=function(){this.lf.off("graph:resize",this.onGraphResize)},e.pluginName="miniMap",e}(),fm=function(){function e(e){var t,n=e.lf,i=e.options,o=this;this.disabled=!0,this.isWholeNode=!0,this.isWholeEdge=!0,this.originStatusSaved=!1,this.exclusiveMode=!1,this.mouseDownInfo=null,this.originalStopMoveGraph=!1,this.handleBlankMouseDown=function(e){var t=e.e;o.handleMouseDown(t)},this.draw=function(e){var t=o.lf.getPointByClient(e.clientX,e.clientY).domOverlayPosition,n=t.x,i=t.y;if(o.endPoint={x:n,y:i},o.startPoint){var r=o.startPoint,a=r.x,s=r.y,l=a,u=s,c=n-a,d=i-s;n<a&&(l=n,c=a-n),i<s&&(u=i,d=s-i),o.wrapper&&(o.wrapper.style.left="".concat(l,"px"),o.wrapper.style.top="".concat(u,"px"),o.wrapper.style.width="".concat(c,"px"),o.wrapper.style.height="".concat(d,"px"))}},this.drawOff=function(e){if(o.lf.updateEditConfig({stopMoveGraph:o.originalStopMoveGraph}),o.originStatusSaved=!1,o.mouseDownInfo){var t=o.mouseDownInfo,n=t.x,i=t.y,r=t.time;if(Math.abs(e.clientX-n)<5&&Math.abs(e.clientY-i)<5&&Date.now()-r<200)return o.lf.clearSelectElements(),void o.cleanupSelectionState()}var a=js(o.startPoint),s=js(o.endPoint);if(document.removeEventListener("mousemove",o.draw),o.exclusiveMode||document.removeEventListener("mouseup",o.drawOff),a&&s){n=a.x,i=a.y;var l=s.x,u=s.y,c=[Math.min(n,l),Math.min(i,u)],d=[Math.max(n,l),Math.max(i,u)];if(o.lf.emit("selection:selected-area",{topLeft:c,bottomRight:d}),Math.abs(l-n)<10&&Math.abs(u-i)<10)return void(o.wrapper&&(o.wrapper.oncontextmenu=null,o.container&&o.wrapper.parentNode===o.container&&o.container.removeChild(o.wrapper),o.wrapper=void 0));var h=o.lf.graphModel.getAreaElement(c,d,o.isWholeEdge,o.isWholeNode,!0),f=o.lf.graphModel,p=f.dynamicGroup,g=f.group,v=[],m=o.lf.getSelectElements(),y=new Set(E(E([],w(m.nodes.map((function(e){return e.id}))),!1),w(m.edges.map((function(e){return e.id}))),!1));h.forEach((function(e){if(g){var t=g.getNodeGroup(e.id);if(h.includes(t))return}if(p){t=p.getGroupByNodeId(e.id);if(h.includes(t))return}o.exclusiveMode&&y.has(e.id)?o.lf.deselectElementById(e.id):(o.lf.selectElementById(e.id,!0),v.push(e))})),o.startPoint=void 0,o.endPoint=void 0,v.length>0&&o.lf.emit("selection:drop",{e:e}),o.lf.emit("selection:selected",{elements:v,leftTopPoint:c,rightBottomPoint:d})}o.wrapper&&(o.wrapper.oncontextmenu=null,o.container&&o.wrapper.parentNode===o.container&&o.container.removeChild(o.wrapper),o.wrapper=void 0)},this.lf=n,this.exclusiveMode=null!==(t=null==i?void 0:i.exclusiveMode)&&void 0!==t&&t,n.openSelectionSelect=function(){o.openSelectionSelect()},n.closeSelectionSelect=function(){o.closeSelectionSelect()},n.setSelectionSelectMode=function(e){o.setExclusiveMode(e)},this.handleMouseDown=this.handleMouseDown.bind(this),this.draw=this.draw.bind(this),this.drawOff=this.drawOff.bind(this)}return e.prototype.render=function(e,t){this.container=t},e.prototype.cleanupSelectionState=function(){this.wrapper&&(this.wrapper.oncontextmenu=null,this.container&&this.wrapper.parentNode===this.container&&this.container.removeChild(this.wrapper),this.wrapper=void 0),this.startPoint=void 0,this.endPoint=void 0,this.mouseDownInfo=null,document.removeEventListener("mousemove",this.draw),document.removeEventListener("mouseup",this.drawOff)},e.prototype.setExclusiveMode=function(e){void 0===e&&(e=!1),this.exclusiveMode!==e&&(this.cleanupSelectionState(),this.exclusiveMode=e,this.container&&!this.disabled&&(this.removeEventListeners(),this.addEventListeners()))},e.prototype.addEventListeners=function(){this.container&&(this.exclusiveMode?(this.container.style.pointerEvents="auto",this.container.addEventListener("mousedown",this.handleMouseDown)):(this.container.style.pointerEvents="none",this.lf.on("blank:mousedown",this.handleBlankMouseDown)))},e.prototype.removeEventListeners=function(){this.container&&(this.container.style.pointerEvents="none",this.container.removeEventListener("mousedown",this.handleMouseDown)),this.lf.off("blank:mousedown",this.handleBlankMouseDown)},e.prototype.handleMouseDown=function(e){var t;if(this.container&&!this.disabled&&!(2===e.button)){this.cleanupSelectionState(),this.mouseDownInfo={x:e.clientX,y:e.clientY,time:Date.now()},this.originStatusSaved||(this.originalStopMoveGraph=this.lf.getEditConfig().stopMoveGraph,this.originStatusSaved=!0),this.lf.updateEditConfig({stopMoveGraph:!0});var n=this.lf.getPointByClient(e.clientX,e.clientY).domOverlayPosition,i=n.x,o=n.y;this.startPoint={x:i,y:o},this.endPoint={x:i,y:o};var r=document.createElement("div");r.className="lf-selection-select",r.oncontextmenu=function(e){e.preventDefault()},r.style.top="".concat(this.startPoint.y,"px"),r.style.left="".concat(this.startPoint.x,"px"),null===(t=this.container)||void 0===t||t.appendChild(r),this.wrapper=r,document.addEventListener("mousemove",this.draw),document.addEventListener("mouseup",this.drawOff)}},e.prototype.setSelectionSense=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),this.isWholeEdge=e,this.isWholeNode=t},e.prototype.openSelectionSelect=function(){this.disabled||this.closeSelectionSelect(),this.container&&(this.cleanupSelectionState(),this.addEventListeners(),this.open())},e.prototype.closeSelectionSelect=function(){if(this.container){if(this.wrapper&&this.startPoint&&this.endPoint){var e=js(this.endPoint),t=new MouseEvent("mouseup",{clientX:e.x,clientY:e.y});this.drawOff(t)}this.cleanupSelectionState(),this.removeEventListeners(),this.close()}},e.prototype.open=function(){this.disabled=!1},e.prototype.close=function(){this.disabled=!0},e.pluginName="selectionSelect",e}(),pm=function(e,t){var n=[],i=[],o=function(e,i,r){e&&(r&&i.unshift.apply(i,E([],w(t.getEdgeModels({sourceNodeId:e.id,targetNodeId:null==r?void 0:r.id}).map((function(e){return e.id}))),!1)),i.includes(e.id)?n.push(i):(i.unshift(e.id),e.incoming.nodes.length?e.incoming.nodes.forEach((function(t){o(t,i.slice(),e)})):n.push(i)))},r=function(e,n,o){e&&(o&&n.push.apply(n,E([],w(t.getEdgeModels({sourceNodeId:null==o?void 0:o.id,targetNodeId:e.id}).map((function(e){return e.id}))),!1)),n.includes(e.id)?i.push(n):(n.push(e.id),e.outgoing.nodes.length?e.outgoing.nodes.forEach((function(t){r(t,n.slice(),e)})):i.push(n)))};return o(e,[]),r(e,[]),E([],w(new Set(E(E([],w(n.flat()),!1),w(i.flat()),!1))),!1)},gm=function(){function e(e){var t=e.lf,n=e.options;this.mode="path",this.enable=!0,this.tempStyles={};var i=n.mode,o=void 0===i?"path":i,r=n.enable,a=void 0===r||r;this.lf=t,this.mode=o,this.enable=a}return e.prototype.setMode=function(e){this.mode=e},e.prototype.setEnable=function(e){this.enable=e},e.prototype.highlightSingle=function(e){var t=this.lf.getModelById(e);"node"===(null==t?void 0:t.BaseType)?t.updateStyles(this.tempStyles[e]):"edge"===(null==t?void 0:t.BaseType)&&(t.updateStyles(this.tempStyles[e]),t.sourceNode.updateStyles(this.tempStyles[t.sourceNode.id]),t.targetNode.updateStyles(this.tempStyles[t.targetNode.id])),this.lf.emit("highlight:single",{data:t})},e.prototype.highlightNeighbours=function(e){var t=this,n=this.lf.getModelById(e),i=[];if("node"===(null==n?void 0:n.BaseType)){n.updateStyles(this.tempStyles[e]);var o=n.incoming,r=o.nodes,a=o.edges,s=n.outgoing,l=s.nodes,u=s.edges;Fs(r,l).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),Fs(a,u).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),i=Xf(Fs(i,r,l,a,u),"id")}else"edge"===(null==n?void 0:n.BaseType)&&(n.updateStyles(this.tempStyles[e]),n.sourceNode.updateStyles(this.tempStyles[n.sourceNode.id]),n.targetNode.updateStyles(this.tempStyles[n.targetNode.id]),i=[n.sourceNode,n.targetNode]);this.lf.emit("highlight:neighbours",{data:n,relateElements:i})},e.prototype.highlightPath=function(e){var t=this,n=function(e,t){var n=t.getModelById(e);return pm("node"===(null==n?void 0:n.BaseType)?n:null==n?void 0:n.targetNode,t)}(e,this.lf),i=[];n.forEach((function(e){var n=t.lf.getModelById(e);null==n||n.updateStyles(t.tempStyles[e]),i.push(n)})),this.lf.emit("highlight:path",{data:this.lf.getModelById(e),relateElements:i})},e.prototype.highlight=function(e,t){var n=this;(void 0===t&&(t=this.mode),this.enable)&&(Object.keys(this.tempStyles).length&&this.restoreHighlight(),Object.values(this.lf.graphModel.modelsMap).forEach((function(e){var t="node"===e.BaseType?e.getNodeStyle():e.getEdgeStyle();n.tempStyles[e.id]=g({},t),e.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),neighbour:this.highlightNeighbours.bind(this),path:this.highlightPath.bind(this)}[t](e))},e.prototype.restoreHighlight=function(){var e=this;Object.keys(this.tempStyles).length&&(Object.values(this.lf.graphModel.modelsMap).forEach((function(t){var n,i=null!==(n=e.tempStyles[t.id])&&void 0!==n?n:{};t.updateStyles(g({},i))})),this.tempStyles={})},e.prototype.render=function(){var e=this;this.lf.on("node:mouseenter",(function(t){var n=t.data;return e.highlight(n.id)})),this.lf.on("edge:mouseenter",(function(t){var n=t.data;return e.highlight(n.id)})),this.lf.on("node:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("edge:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("history:change",this.restoreHighlight.bind(this))},e.prototype.destroy=function(){},e.pluginName="highlight",e}(),vm={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function mm(e,t,n,i){var o,r="",a="";e[0]===t[0]?r=e[1]>t[1]?"t":"b":e[1]===t[1]&&(r=e[0]>t[0]?"l":"r"),t[0]===n[0]?a=t[1]>n[1]?"t":"b":t[1]===n[1]&&(a=t[0]>n[0]?"l":"r");var s=Math.min(Math.hypot(t[0]-e[0],t[1]-e[1])/2,Math.hypot(n[0]-t[0],n[1]-t[1])/2,i)||.2*i,l="".concat(r).concat(a),u=vm[l]||"-",c="L ".concat(e[0]," ").concat(e[1]);if("-"===u)c+="L ".concat(t[0]," ").concat(t[1]," L ").concat(n[0]," ").concat(n[1]);else{var d=w(function(e,t,n,i){var o=[e[0],e[1]],r=[e[0],e[1]];switch(n){case"tl":return"tr"===t?(o[1]+=i,r[0]+=i):"lb"===t&&(o[0]+=i,r[1]+=i),[o,r];case"tr":return"tl"===t?(o[1]+=i,r[0]-=i):"rb"===t&&(o[0]-=i,r[1]+=i),[o,r];case"bl":return"br"===t?(o[1]-=i,r[0]+=i):"lt"===t&&(o[0]+=i,r[1]-=i),[o,r];case"br":return"bl"===t?(o[1]-=i,r[0]-=i):"rt"===t&&(o[0]-=i,r[1]-=i),[o,r];default:return[]}}(t,l,u,s),2),h=d[0],f=d[1];h&&f&&(c+="L ".concat(h[0]," ").concat(h[1]," Q ").concat(t[0]," ").concat(t[1]," ").concat(f[0]," ").concat(f[1]),o=w(f,2),t[0]=o[0],t[1]=o[1])}return c}function ym(e,t){var n=0,i="";if(2===e.length)i+="M".concat(e[n][0]," ").concat(e[n++][1]," L ").concat(e[n][0]," ").concat(e[n][1]);else{for(i+="M".concat(e[n][0]," ").concat(e[n++][1]);n+1<e.length;){i+=mm(e[n-1],e[n],e[1+n++],t)}i+="L ".concat(e[n][0]," ").concat(e[n][1])}return i}var bm=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getEdge=function(){var e=this.props.model,n=e.points,i=e.isAnimation,o=e.arrowConfig,r=e.radius,a=void 0===r?5:r,s=e.getEdgeStyle(),l=e.getEdgeAnimationStyle(),u=function(e){for(var t=e,n=1;n<t.length-1;){var i=w(t[n-1],2),o=i[0],r=i[1],a=w(t[n],2),s=a[0],l=a[1],u=w(t[n+1],2),c=u[0],d=u[1];o===s&&s===c||r===l&&l===d?t.splice(n,1):n++}return t}(n.split(" ").map((function(e){return e.split(",").map((function(e){return+e}))}))),c=ym(u,a),d=g(g(g({style:i?l:{}},s),o),{fill:"none"});return t.h("path",g({d:c},d))},n}(t.PolylineEdge),xm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t}(t.PolylineEdgeModel),wm=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.id,i=e.x,o=e.y,r=e.width,a=e.height,s=e.properties,l=this.props.model.getNodeStyle();return t.h("svg",{x:i-r/2,y:o-a/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[s.labelText?t.h("text",{x:0,y:-5,fontSize:"16px",fill:l.stroke},s.labelText):"",s.disabledDelete?"":t.h("text",{x:s.labelText?50:0,y:-5,fontSize:"24px",cursor:"pointer",fill:l.stroke,onclick:this.handleCustomDeleteIconClick.bind(this,n)},"x")])},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.id,s=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",g(g({},s),{x:n-o/2,y:i-r/2,width:o,height:r,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(e){this.props.graphModel.deleteNode(e)},n}(t.PolygonNode),Em=function(e){function t(){var t=e.apply(this,E([],w(arguments),!1))||this;return t.d=10,t.isResize=!1,t}return p(t,e),t.prototype.initNodeData=function(t){t.text={value:"",x:t.x,y:t.y,draggable:!1,editable:!1},e.prototype.initNodeData.call(this,t),this.zIndex=0,this.draggable=!0},t.prototype.setAttributes=function(){var e,t=this;this.points=[],(null===(e=this.properties)||void 0===e?void 0:e.node_selection_ids).length>1&&setTimeout((function(){var e;t.updatePointsByNodes((null===(e=t.properties)||void 0===e?void 0:e.node_selection_ids)||[])}))},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.stroke=this.properties.strokeColor||"#008000",t.strokeDasharray="10 5",t},t.prototype.getDefaultAnchor=function(){return[]},t.prototype.updatePoints=function(e){this.points=e},t.prototype.updateCoordinate=function(e){var t=e.x,n=e.y;this.x=t,this.y=n},t.prototype.updatePointsByNodes=function(e){var t=this,n=[],i=1/0,o=1/0,r=-1/0,a=-1/0;e.forEach((function(e){var n=t.graphModel.getNodeModelById(e);if(n){var s=n.width,l=n.height,u=n.x,c=n.y;i=Math.min(i,u-s/2-t.d),o=Math.min(o,c-l/2-t.d),r=Math.max(r,u+s/2+t.d),a=Math.max(a,c+l/2+t.d)}})),n.push([i,o],[r,o],[r,a],[i,a]),[i,o,r,a].some((function(e){return Math.abs(e)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(r+i)/2,y:(a+o)/2}))},t.prototype.resize=function(t){var n;this.isResize=!0;for(var i=t.width,o=t.height,r=i/this.width,a=o/this.height,s=(this.properties.node_selection_ids||[]).slice(),l=[],u=new Set;s.length;){var c=s.shift(),d=null===(n=this.graphModel.nodesMap[c])||void 0===n?void 0:n.model;d&&(_m(d)?u.has(d.id)||(u.add(d.id),s.push.apply(s,E([],w(d.properties.node_selection_ids||[]),!1))):l.push(d))}var h=this.x-this.width/2,f=this.y-this.height/2,p=e.prototype.resize.call(this,t),g=this.x-this.width/2,v=this.y-this.height/2;return l.forEach((function(e){e.width=e.width*r,e.height=e.height*a;var t=(e.x-h)*r+g-e.x,n=(e.y-f)*a+v-e.y;e.move(t,n,!0)})),this.isResize=!1,p},t}(t.PolygonNodeModel),Cm="node-selection",Nm=function(){function e(e){var t=e.lf;this.selectNodes=[],this.d=10,this.lf=t,t.register({type:Cm,view:wm,model:Em})}return Object.defineProperty(e.prototype,"selectNodesIds",{get:function(){return this.selectNodes.map((function(e){return e.id}))},enumerable:!1,configurable:!0}),e.prototype.addNodeSelection=function(){this.lf.addNode({type:"node-selection",text:"",properties:{node_selection_ids:this.selectNodesIds},x:0,y:0}).updatePointsByNodes(this.selectNodesIds)},e.prototype.updateNodeSelection=function(){var e,t=this.getNodeSelection();t&&(this.lf.setProperties(t.id,{node_selection_ids:this.selectNodesIds}),null===(e=this.lf.getNodeModelById(t.id))||void 0===e||e.updatePointsByNodes(this.selectNodesIds))},e.prototype.getNodeSelection=function(){var e=this,t=this.selectNodesIds,n=this.lf.getGraphRawData(),i=t.filter((function(t){return t!==e.currentClickNode.id}));return n.nodes.find((function(e){if("node-selection"===e.type){var t=Ho(e,"properties.node_selection_ids",[]);return i.every((function(e){return t.includes(e)}))}return!1}))},e.prototype.onNodeChange=function(e,t){var n=e.graphModel.nodes.filter((function(e){return!!_m(e)&&(e.properties.node_selection_ids||[]).includes(t.id)}));Promise.resolve().then((function(){n.forEach((function(e){e.updatePointsByNodes(e.properties.node_selection_ids||[])}))}))},e.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!==Cm){t.currentClickNode=n.data;var o=!1;t.selectNodesIds.includes(n.data.id)&&(null===(i=t.lf.getNodeModelById(n.data.id))||void 0===i||i.setSelected(!1),o=!0);var r=e.getSelectElements(!0).nodes;t.selectNodes=r,1===t.selectNodes.length?o?t.updateNodeSelection():t.addNodeSelection():t.selectNodes.length>1&&t.updateNodeSelection()}})),e.graphModel.addNodeMoveRules((function(n,i,o){if(t.onNodeChange(e,n),_m(n)&&!n.isResize){var r=n.properties.node_selection_ids||[];return e.graphModel.moveNodes(r,i,o,!0),!0}return!0})),e.graphModel.addNodeResizeRules((function(n){return _m(n)||t.onNodeChange(e,n),!0}))},e.pluginName="node-selection",e}(),_m=function(e){return!(!e||e.type!==Cm)},Sm=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.properties;return t.h("text",{x:n-o/2+5,y:i-r/2+16,fontSize:12,fill:"blue"},a.moreText)},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",g(g({},a),{fill:"#FFFFFF",x:n-o/2,y:i-r/2})),this.getLabelShape()])},n}(t.RectNode),Mm={pluginName:"rectLabelNode",install:function(e){e.register({type:"rect-label",model:t.RectNodeModel,view:Sm})}};e.AutoLayout=Qv,e.BPMNAdapter=Yg,e.BPMNBaseAdapter=Kg,e.BPMNElements=lg,e.BoundaryEventFactory=Ee,e.BpmnAdapter=he,e.BpmnElement=U,e.BpmnXmlAdapter=fe,e.ContextMenu=cm,e.Control=tm,e.CurvedEdge=bm,e.CurvedEdgeModel=xm,e.DiamondResize=Gp,e.DiamondResizeModel=Wp,e.DiamondResizeView=zp,e.DndPanel=dm,e.DynamicGroup=rv,e.DynamicGroupNode=ev,e.DynamicGroupNodeModel=tv,e.EllipseResize=Hp,e.EllipseResizeModel=jp,e.EllipseResizeView=Fp,e.EndEventFactory=be,e.EndEventModel=A,e.EndEventView=k,e.ExclusiveGatewayModel=I,e.ExclusiveGatewayView=L,e.FlowPath=Yv,e.GatewayNodeFactory=Ie,e.Group=tg,e.GroupNode=Jp,e.GroupNodeModel=Zp,e.Highlight=gm,e.HtmlResize=Xp,e.HtmlResizeModel=Up,e.HtmlResizeView=qp,e.InsertNodeInPolyline=hv,e.IntermediateCatchEventFactory=xe,e.IntermediateThrowEventFactory=Ce,e.Label=Hv,e.Menu=lm,e.MiniMap=hm,e.NodeResize=$p,e.NodeSelection=Nm,e.ProximityConnect=em,e.RectLabelNode=Mm,e.RectResize=Yp,e.RectResizeModel=Vp,e.RectResizeView=Kp,e.SelectionSelect=fm,e.SequenceFlowModel=D,e.SequenceFlowView=O,e.ServiceTaskModel=j,e.ServiceTaskView=F,e.Snapshot=Kv,e.StartEventFactory=we,e.StartEventModel=S,e.StartEventView=M,e.SubProcessFactory=ng,e.TaskNodeFactory=Be,e.UserTaskModel=W,e.UserTaskView=z,e.bpmnUtils=ye,e.convertNormalToXml=Wg,e.convertXmlToNormal=zg,e.dynamicGroup=iv,e.escapeXml=$,e.gateway={exclusive:0,inclusive:1,parallel:2},e.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],e.getCurvedEdgePath=ym,e.handleAttributes=Y,e.icons=Pe,e.lfJson2Xml=Q,e.lfXml2Json=ne,e.multiInstanceIcon=Le,e.sequenceFlowFactory=og,e.toLogicflowData=function(e){var t={nodes:[],edges:[]},n=e.flowElementList;return n&&n.length>0&&n.forEach((function(e){if(e.type===$g.SEQUENCE_FLOW){var n=function(e){var t=e.incoming,n=e.outgoing,i=e.properties,o=e.key,r=e.type,a=i.text,s=i.name,l=i.startPoint,u=i.endPoint,c=i.pointsList,d={id:o,type:Zg[r],sourceNodeId:t[0],targetNodeId:n[0],text:a||s,properties:{}};l&&(d.startPoint=JSON.parse(l)),u&&(d.endPoint=JSON.parse(u)),c&&(d.pointsList=JSON.parse(c));var h=["startPoint","endPoint","pointsList","text"];return Object.keys(e.properties).forEach((function(t){-1===h.indexOf(t)&&(d.properties[t]=e.properties[t])})),d}(e);t.edges.push(n)}else{var i=function(e){var t=e.properties,n=e.key,i=e.type,o=e.bounds,r=t.x,a=t.y,s=t.text;if(void 0===r){var l=w(o,2),u=l[0],c=u.x,d=u.y,h=l[1];r=(c+h.x)/2,a=(d+h.y)/2}var f={id:n,type:Zg[i],x:r,y:a,text:s,properties:{}},p=["x","y","text"];return Object.keys(e.properties).forEach((function(t){-1===p.indexOf(t)&&(f.properties[t]=e.properties[t])})),f}(e);t.nodes.push(i)}})),t},e.toNormalJson=se,e.toTurboData=function(e){var t=new Map,n={flowElementList:[]};return e.nodes.forEach((function(e){var i=function(e){var t=e.id,n=e.type,i=e.x,o=e.y,r=e.text,a=void 0===r?"":r,s=e.properties;return{incoming:[],outgoing:[],dockers:[],type:Jg(n),properties:g(g({},s),{name:a&&a.value||"",x:i,y:o,text:a}),key:t}}(e);n.flowElementList.push(i),t.set(e.id,i)})),e.edges.forEach((function(e){var i=function(e){var t=e.id,n=e.type,i=e.sourceNodeId,o=e.targetNodeId,r=e.startPoint,a=e.endPoint,s=e.pointsList,l=e.text,u=void 0===l?"":l,c=e.properties;return{incoming:[i],outgoing:[o],type:Jg(n),dockers:[],properties:g(g({},c),{name:u&&u.value||"",text:u,startPoint:JSON.stringify(r),endPoint:JSON.stringify(a),pointsList:JSON.stringify(s)}),key:t}}(e);t.get(e.sourceNodeId).outgoing.push(i.key),t.get(e.targetNodeId).incoming.push(i.key),n.flowElementList.push(i)})),n},e.toXmlJson=ae,e.useDefinition=sg}));
2
2
  //# sourceMappingURL=index.min.js.map