@logicflow/extension 2.3.0-alpha.1 → 2.3.0
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 +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/dynamic-group/index.d.ts +1 -1
- package/es/dynamic-group/index.js +36 -100
- package/es/dynamic-group/titleText.js +2 -2
- package/es/pool/index.d.ts +5 -1
- package/es/pool/index.js +59 -18
- package/lib/dynamic-group/index.d.ts +1 -1
- package/lib/dynamic-group/index.js +36 -100
- package/lib/dynamic-group/titleText.js +2 -2
- package/lib/pool/index.d.ts +5 -1
- package/lib/pool/index.js +59 -18
- package/package.json +3 -3
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")):"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;e.ExtensionEventType=void 0,(n=e.ExtensionEventType||(e.ExtensionEventType={})).GROUP_ADD_NODE="group:add-node",n.GROUP_REMOVE_NODE="group:remove-node",n.GROUP_NOT_ALLOWED="group:not-allowed";var i="".concat(t.EventType.NODE_DRAG,",").concat(t.EventType.NODE_DND_DRAG),r="".concat(t.EventType.NODE_ADD,",").concat(t.EventType.NODE_DROP,",").concat(t.EventType.NODE_DND_ADD),o=40,a=40,s=40,l=40,u=40,d=40,c=100,h=80,p=100,f=80,g={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}}},v=function(e,t){return v=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])},v(e,t)};function m(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}v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var y=function(){return y=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},y.apply(this,arguments)};function b(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 r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function x(e,t,n,i){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function E(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(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 w(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=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(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function C(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 N(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}function _(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var S=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}(),M=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new S;function T(){return M.next()}var A=function(e){function t(t,n){return t.id||(t.id="Event_".concat(T())),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 m(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),O=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.extendKey="StartEventNode",t}(t.CircleNode),k={type:"bpmn:startEvent",view:O,model:A},D=function(e){function t(t,n){return t.id||(t.id="Event_".concat(T())),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 m(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 m(n,e),n.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},n.prototype.getShape=function(){var n=this.props.model,i=n.getNodeStyle(),r=n,o=r.x,a=r.y,s=r.r,l=e.prototype.getShape.call(this);return t.h("g",{},l,t.h("circle",y(y({},i),{cx:o,cy:a,r:s-5})))},n.extendKey="EndEventView",n}(t.CircleNode),P={type:"bpmn:endEvent",view:R,model:D},I=function(e){function t(t,n){return t.id||(t.id="Flow_".concat(T())),e.call(this,t,n)||this}return m(t,e),t.extendKey="SequenceFlowModel",t}(t.PolylineEdgeModel),L=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.extendKey="SequenceFlowEdge",t}(t.PolylineEdge),B={type:"bpmn:sequenceFlow",view:L,model:I},j=function(e){function t(t,n){var i=this;return t.id||(t.id="Gateway_".concat(T())),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 m(t,e),t.extendKey="ExclusiveGatewayModel",t}(t.PolygonNodeModel),z=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getShape=function(){var e=this.props.model,n=e,i=n.x,r=n.y,o=n.width,a=n.height,s=n.points,l=e.getNodeStyle();return t.h("g",{transform:"matrix(1 0 0 1 ".concat(i-o/2," ").concat(r-a/2,")")},t.h("polygon",y(y({},l),{x:i,y:r,points:s})),t.h("path",y({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),H={type:"bpmn:exclusiveGateway",view:z,model:j},F=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(T())),e.call(this,t,n)||this}return m(t,e),t.extendKey="ServiceTaskModel",t}(t.RectNodeModel),W=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-r/2+5,y:i-o/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,r=e.width,o=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",y({x:n-r/2,y:i-o/2,rx:a,ry:a,width:r,height:o},s)),this.getLabelShape()])},n.extendKey="ServiceTaskNode",n}(t.RectNode),G={type:"bpmn:serviceTask",view:W,model:F},U=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(T())),e.call(this,t,n)||this}return m(t,e),t.extendKey="UserTaskModel",t}(t.RectNodeModel),V=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-r/2+5,y:i-o/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,r=e.width,o=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",y(y({},s),{x:n-r/2,y:i-o/2,rx:a,ry:a,width:r,height:o})),this.getLabelShape()])},n.extendKey="UserTaskNode",n}(t.RectNode),X={type:"bpmn:userTask",view:V,model:U},q={pluginName:"bpmnElement",install:function(e){e.setTheme(g),e.register(k),e.register(P),e.register(H),e.register(X),e.register(G),e.options.customBpmnEdge||(e.register(B),e.setDefaultEdgeType("bpmn:sequenceFlow"))}},K=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}(),Y=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new K;function Q(){return Y.next()}function Z(e){return Object.prototype.toString.call(e)}function $(e){var t=e;return"[object Object]"===Z(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 J(e){return null==e?"":e.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var ee="\t\n";function te(e,t,n){var i=function(e){return" ".repeat(e)}(n);if(0!==e&&!1!==e&&!e)return ee+i+"<".concat(t," />");var r="";if("#text"===t)return ee+i+J(String(e));if("#cdata-section"===t)return ee+i+"<![CDATA["+e+"]]>";if("#comment"===t)return ee+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 J(String(t))}(e)+'"';if(Array.isArray(e))e.forEach((function(e){r+=te(e,t,n+1)}));else if("[object Object]"===Z(e)){var o=Object.keys(e),a="",s="";r+=(0===n?"":ee+i)+"<"+t,o.forEach((function(t){"-"===t.charAt(0)?a+=te(e[t],t,n+1):s+=te(e[t],t,n+1)})),r+=a+(""!==s?">".concat(s).concat(ee+i,"</").concat(t,">"):" />")}else r+=ee+i+"<".concat(t,">").concat(J(String(e)),"</").concat(t,">");return r}function ne(e){var t="";for(var n in e)t+=te(e[n],n,0);return t}var ie=function(){};(ie.ObjTree=function(){return this}).VERSION="0.23",ie.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',ie.ObjTree.prototype.attr_prefix="-",ie.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)},ie.ObjTree.prototype.parseHTTP=function(e,t,n){var i,r={};for(var o in t)r[o]=t[o];if(r.method||(void 0===r.postBody&&void 0===r.postbody&&void 0===r.parameters?r.method="get":r.method="post"),n){r.asynchronous=!0;var a=this,s=n,l=r.onComplete;r.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else r.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)r.uri=e,(u=new HTTP.Request(r))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,r))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},ie.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}},ie.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 r=e.attributes[i].nodeValue;try{r=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){r=e.attributes[i].nodeValue}r&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],r))}}}if(e.childNodes&&e.childNodes.length){var o=!0;t&&(o=!1);for(i=0;i<e.childNodes.length&&o;i++){var a=e.childNodes[i].nodeType;3!=a&&4!=a&&8!=a&&(o=!1)}if(o){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))(r=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],r))}}}else null===t&&(t={});return t}},ie.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},ie.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},ie.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];r.charAt(0)!=this.attr_prefix?void 0===o||null==o?n[n.length]="<"+r+" />":"object"==typeof o&&o.constructor==Array?n[n.length]=this.array_to_xml(r,o):n[n.length]="object"==typeof o?this.hash_to_xml(r,o):this.scalar_to_xml(r,o):i[i.length]=" "+r.substring(1)+'="'+this.xml_escape(o)+'"'}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},ie.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var r=t[i];void 0===r||null==r?n[n.length]="<"+e+" />":"object"==typeof r&&r.constructor==Array?n[n.length]=this.array_to_xml(e,r):n[n.length]="object"==typeof r?this.hash_to_xml(e,r):this.scalar_to_xml(e,r)}return n.join("")},ie.ObjTree.prototype.scalar_to_xml=function(e,t){return"#text"==e?this.xml_escape(t):"<"+e+">"+this.xml_escape(t)+"</"+e+">\n"},ie.ObjTree.prototype.xml_escape=J;var re,oe=function(e){return(new ie.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"}(re||(re={}));var ae=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef"],se=["properties","startPoint","endPoint","pointsList"],le=function(e){return String(e||"").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'")};function ue(e){var t=e?se.concat(e):se;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 r=N(n,2),o=r[0],a=r[1];"object"!=typeof a?0===o.indexOf("-")||["#text","#cdata-section","#comment"].includes(o)?i[o]=a:i["-".concat(o)]=a:t.includes(o)?i["-".concat(o)]=e(a):i[o]=e(a)})),i)}(e)}}function de(e){var t={};return Object.entries(e).forEach((function(e){var n=N(e,2),i=n[0],r=n[1];0===i.indexOf("-")?t[i.substring(1)]=$(r):"string"==typeof r?t[i]=r:"[object Object]"===Object.prototype.toString.call(r)?t[i]=de(r):Array.isArray(r)?t[i]=r.map((function(e){return de(e)})):t[i]=r})),t}function ce(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}})),r={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(r["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}}),r})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,r=80,o=e.x,a=e.y,s=ge.shapeConfigMap.get(e.type);s&&(i=s.width,r=s.height),o-=i/2,a-=r/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":o,"-y":a,"-width":i,"-height":r}};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 he(e){var t=[],n=[],i=e["bpmn:definitions"];if(i){var r=i["bpmn:process"],o=i["bpmndi:BPMNDiagram"],a=null==o?void 0:o["bpmndi:BPMNPlane"];if(!r||!a)return{nodes:t,edges:n};Object.keys(r).forEach((function(e){if(0===e.indexOf("bpmn:")){var i=r[e];if(e===re.FLOW){var o=a["bpmndi:BPMNEdge"],s=(Array.isArray(o),o);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(fe(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(fe(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 r=pe(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}));else{var r=pe(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}return i}(i,u,e))}}}))}return{nodes:t,edges:n}}function pe(e,t,n){var i,r,o=Number(e["dc:Bounds"]["-x"]),a=Number(e["dc:Bounds"]["-y"]),s=le(n["-name"]),l=ge.shapeConfigMap.get(t);if(l&&(o+=l.width/2,a+=l.height/2),Object.entries(n).forEach((function(e){var t=N(e,2),n=t[0],r=t[1];-1===ae.indexOf(n)&&(i||(i={}),i[n]=r)})),i&&(i=de(i)),s&&(r={x:o,y:a,value:s},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var u=e["bpmndi:BPMNLabel"]["dc:Bounds"];r.x=Number(u["-x"])+Number(u["-width"])/2,r.y=Number(u["-y"])+Number(u["-height"])/2}var d={id:e["-bpmnElement"],type:t,x:o,y:a,properties:i};return r&&(d.text=r),d}function fe(e,t){var n,i,r=t["-name"]?le("".concat(t["-name"])):"";if(r){var o=void 0;e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"]&&(o=e["bpmndi:BPMNLabel"]["dc:Bounds"]);var a=0;if(r.split("\n").forEach((function(e){a<e.length&&(a=e.length)})),o)n={value:r,x:Number(o["-x"])+10*a/2,y:Number(o["-y"])+7};else{var s=e["di:waypoint"]||[],l=s[0],u=s[s.length-1]||l;n={value:r,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=N(e,2),n=t[0],r=t[1];-1===ae.indexOf(n)&&(i||(i={}),i[n]=r)})),i&&(i=de(i));var d={id:t["-id"],type:re.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&&(d.text=n),d}var ge=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i=y({},n.processAttributes);!function(e,t,n){var i=new Map;t.nodes.forEach((function(t){var r,o={"-id":t.id};if((null===(r=t.text)||void 0===r?void 0:r.value)&&(o["-name"]=t.text.value),t.properties){var a=ue(n)(t.properties);Object.assign(o,a)}i.set(t.id,o),e[t.type]?Array.isArray(e[t.type])?e[t.type].push(o):e[t.type]=[e[t.type],o]:e[t.type]=o}));var r=t.edges.map((function(e){var t,r,o=i.get(e.targetNodeId);o["bpmn:incoming"]?Array.isArray(o["bpmn:incoming"])?o["bpmn:incoming"].push(e.id):o["bpmn:incoming"]=[o["bpmn:incoming"],e.id]:o["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===(r=e.text)||void 0===r?void 0:r.value),e.properties){var s=ue(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[re.FLOW]=r}(i,e,t);var r={"-id":"BPMNPlane_1","-bpmnElement":i["-id"]};ce(r,e);var o=n.definitionAttributes;return o["bpmn:process"]=i,o["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":r},{"bpmn:definitions":o}},this.adapterIn=function(e){if(e)return he(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(Q())},this.definitionAttributes={"-id":"Definitions_".concat(Q()),"-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}();ge.shapeConfigMap.set(re.START,{width:o,height:a}),ge.shapeConfigMap.set(re.END,{width:s,height:l}),ge.shapeConfigMap.set(re.GATEWAY,{width:u,height:d}),ge.shapeConfigMap.set(re.SYSTEM,{width:c,height:h}),ge.shapeConfigMap.set(re.USER,{width:p,height:f});var ve=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=oe(t);return n.adapterIn(i)},n.adapterXmlOut=function(e,t){return ne(n.adapterOut(e,t))};var i=t.lf;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n}return m(t,e),t.prototype.sanitizeNameAttributes=function(e){return e.replace(/name="([^"]*)"/g,(function(e,t){var n=t.replace(/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">");return'name="'.concat(n,'"')}))},t.pluginName="bpmnXmlAdapter",t}(ge);function me(){this.targetRules.push({message:"分组外的节点不允许连接分组内的",validate:function(e,t){var n=!!e.properties.parent,i=!!t.properties.parent;return!(!n&&i)}})}var ye=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}(),be=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new ye;function xe(){return be.next()}var Ee=Object.freeze({__proto__:null,genBpmnId:xe,groupRule:me});function we(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var i,r=this.props.model,o=r.getNodeStyle(),a=r,s=a.x,l=a.y,u=a.r,d=a.width,c=a.height,h=a.properties,p=e.prototype.getShape.call(this),f=h.definitionType,g=((null===(i=n.endEvent)||void 0===i?void 0:i.get(f))||{}).icon,v=Array.isArray(g)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(s-d/2," ").concat(l-c/2,")")}],N(g),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(s-d/2," ").concat(l-c/2,")"),d:g,style:"fill: black; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;"});return t.h("g",{},p,t.h("circle",y(y({},o),{strokeWidth:2,cx:s,cy:l,r:u-2})),v)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(xe())),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===(o=n.endEvent)||void 0===o?void 0:o.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=y(y({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),r=e.call(this,t,i)||this,me.call(r),r}return m(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:r}}function Ce(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,r=i.getNodeStyle(),o=i,a=o.x,s=o.y,l=o.r,u=o.width,d=o.height,c=o.properties.definitionType,h=((null===(e=n.intermediateCatchEvent)||void 0===e?void 0:e.get(c))||{}).icon,p=Array.isArray(h)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],N(h),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:h});return t.h("g",{},t.h("circle",y(y({},r),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",y(y({},r),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),p)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(xe())),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===(o=n.intermediateCatchEvent)||void 0===o?void 0:o.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=y(y({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),r=e.call(this,t,i)||this,me.call(r),r}return m(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateCatchEvent",view:i,model:r}}function Ne(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,r=i.getNodeStyle(),o=i,a=o.x,s=o.y,l=o.r,u=o.width,d=o.height,c=o.properties,h=c.definitionType,p=c.isInterrupting,f=((null===(e=n.startEvent)||void 0===e?void 0:e.get(h))||{}).icon,g=Array.isArray(f)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],N(f),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:f,style:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"});return t.h("g",{},t.h("circle",y(y({},r),{cx:a,cy:s,r:l,strokeDasharray:p?"5,5":"",strokeWidth:2})),g)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a;t.id||(t.id="Event_".concat(xe())),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===(r=n.startEvent)||void 0===r?void 0:r.get(null===(o=t.properties)||void 0===o?void 0:o.definitionType))||{}).properties,l=void 0===s?{}:s;return t.properties=y(y({},l),t.properties),(null===(a=t.properties)||void 0===a?void 0:a.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),e.call(this,t,i)||this}return m(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:r}}function _e(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,r=i.getNodeStyle(),o=i,a=o.x,s=o.y,l=o.r,u=o.width,d=o.height,c=o.properties,h=c.definitionType,p=c.cancelActivity,f=((null===(e=n.boundaryEvent)||void 0===e?void 0:e.get(h))||{}).icon,g=Array.isArray(f)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],N(f),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:f});return t.h("g",{},t.h("circle",y(y({},r),{cx:a,cy:s,r:l,strokeDasharray:p?"":"5,5",strokeWidth:1.5})),t.h("circle",y(y({},r),{cx:a,cy:s,r:l-3,strokeDasharray:p?"":"5,5",strokeWidth:1.5})),g)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(xe())),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===(o=n.boundaryEvent)||void 0===o?void 0:o.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=y(y({attachedToRef:"",cancelActivity:!0},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),r=e.call(this,t,i)||this,me.call(r),r}return m(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:r}}function Se(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,r=i.getNodeStyle(),o=i,a=o.x,s=o.y,l=o.r,u=o.width,d=o.height,c=o.properties.definitionType,h=((null===(e=n.intermediateThrowEvent)||void 0===e?void 0:e.get(c))||{}).icon,p=Array.isArray(h)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],N(h),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:h,style:"fill: black"});return t.h("g",{},t.h("circle",y(y({},r),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",y(y({},r),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),p)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(xe())),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===(o=n.intermediateThrowEvent)||void 0===o?void 0:o.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=y(y({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),r=e.call(this,t,i)||this,me.call(r),r}return m(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateThrowEvent",view:i,model:r}}var Me=[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;"})],Te=[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);"})],Ae="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",Oe="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",ke=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;"}),De="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",Pe="m44,60 m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",Ie="m47,61 m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",Le="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",Be=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:Ae,inclusiveIcon:ke,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:Le,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:Oe,parallelMarker:Pe,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:Ie,serviceTaskIcon:De,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:Te,timerIcon:Me,userTaskIcon:Re});function je(e,n,i){var r=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getShape=function(){var e=this.props.model,i=e,r=i.x,o=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(r-a/2," ").concat(o-s/2,")")},t.h(t.Polygon,y(y({},u),{x:r,y:o,points:l})),"string"==typeof n?t.h("path",y(y({d:n},u),{fill:"rgb(34, 36, 42)",strokeWidth:1})):n)},i}(t.PolygonNode);return{type:e,view:r,model:function(e){function t(t,n){var r=this;return t.id||(t.id="Gateway_".concat(xe())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),t.properties=y(y({},i||{}),t.properties),(r=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],me.call(r),r}return m(t,e),t}(t.PolygonNodeModel)}}var ze={parallel:Pe,sequential:Ie,loop:Le};function He(e,n,i){var r=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getLabelShape=function(){var e=this.props.model,i=e.x,r=e.y,o=e.width,a=e.height,s=e.getNodeStyle(),l=Array.isArray(n)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(i-o/2," ").concat(r-a/2,")")}],N(n),!1)):t.h("path",{fill:s.stroke,d:n});return t.h("svg",{x:i-o/2+5,y:r-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,r=e.width,o=e.height,a=e.radius,s=e.properties,l=e.getNodeStyle();return t.h("g",{},[t.h("rect",y(y({},l),{x:n-r/2,y:i-o/2,rx:a,ry:a,width:r,height:o,opacity:.95})),this.getLabelShape(),t.h("g",{transform:"matrix(1 0 0 1 ".concat(n-r/2," ").concat(i-o/2,")")},t.h("path",{fill:"white",strokeLinecap:"round",strokeLinejoin:"round",stroke:"rgb(34, 36, 42)",strokeWidth:"2",d:ze[s.multiInstanceType]||""}))])},i}(t.RectNode),o=function(e){function t(t,n){var r,o=this;t.id||(t.id="Activity_".concat(xe()));var a=y(y({},i||{}),t.properties);return t.properties=a,o=e.call(this,t,n)||this,null===(r=null==a?void 0:a.boundaryEvents)||void 0===r||r.forEach((function(e){o.addBoundaryEvent(e)})),o.deleteProperty("boundaryEvents"),me.call(o),o}return m(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:r,model:o}}var Fe="object"==typeof global&&global&&global.Object===Object&&global,We="object"==typeof self&&self&&self.Object===Object&&self,Ge=Fe||We||Function("return this")(),Ue=Ge.Symbol,Ve=Object.prototype,Xe=Ve.hasOwnProperty,qe=Ve.toString,Ke=Ue?Ue.toStringTag:void 0;var Ye=Object.prototype.toString;var Qe="[object Null]",Ze="[object Undefined]",$e=Ue?Ue.toStringTag:void 0;function Je(e){return null==e?void 0===e?Ze:Qe:$e&&$e in Object(e)?function(e){var t=Xe.call(e,Ke),n=e[Ke];try{e[Ke]=void 0;var i=!0}catch(e){}var r=qe.call(e);return i&&(t?e[Ke]=n:delete e[Ke]),r}(e):function(e){return Ye.call(e)}(e)}function et(e){return null!=e&&"object"==typeof e}var tt="[object Symbol]";function nt(e){return"symbol"==typeof e||et(e)&&Je(e)==tt}var it=NaN;function rt(e){return"number"==typeof e?e:nt(e)?it:+e}function ot(e,t){for(var n=-1,i=null==e?0:e.length,r=Array(i);++n<i;)r[n]=t(e[n],n,e);return r}var at=Array.isArray,st=1/0,lt=Ue?Ue.prototype:void 0,ut=lt?lt.toString:void 0;function dt(e){if("string"==typeof e)return e;if(at(e))return ot(e,dt)+"";if(nt(e))return ut?ut.call(e):"";var t=e+"";return"0"==t&&1/e==-st?"-0":t}function ct(e,t){return function(n,i){var r;if(void 0===n&&void 0===i)return t;if(void 0!==n&&(r=n),void 0!==i){if(void 0===r)return i;"string"==typeof n||"string"==typeof i?(n=dt(n),i=dt(i)):(n=rt(n),i=rt(i)),r=e(n,i)}return r}}var ht=ct((function(e,t){return e+t}),0),pt=/\s/;function ft(e){for(var t=e.length;t--&&pt.test(e.charAt(t)););return t}var gt=/^\s+/;function vt(e){return e?e.slice(0,ft(e)+1).replace(gt,""):e}function mt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var yt=NaN,bt=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,Et=/^0o[0-7]+$/i,wt=parseInt;function Ct(e){if("number"==typeof e)return e;if(nt(e))return yt;if(mt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=mt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=vt(e);var n=xt.test(e);return n||Et.test(e)?wt(e.slice(2),n?2:8):bt.test(e)?yt:+e}var Nt=1/0,_t=17976931348623157e292;function St(e){return e?(e=Ct(e))===Nt||e===-Nt?(e<0?-1:1)*_t:e==e?e:0:0===e?e:0}function Mt(e){var t=St(e),n=t%1;return t==t?n?t-n:t:0}function Tt(e){return e}var At="[object AsyncFunction]",Ot="[object Function]",kt="[object GeneratorFunction]",Dt="[object Proxy]";function Rt(e){if(!mt(e))return!1;var t=Je(e);return t==Ot||t==kt||t==At||t==Dt}var Pt,It=Ge["__core-js_shared__"],Lt=(Pt=/[^.]+$/.exec(It&&It.keys&&It.keys.IE_PROTO||""))?"Symbol(src)_1."+Pt:"";var Bt=Function.prototype.toString;function jt(e){if(null!=e){try{return Bt.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var zt=/^\[object .+?Constructor\]$/,Ht=Function.prototype,Ft=Object.prototype,Wt=Ht.toString,Gt=Ft.hasOwnProperty,Ut=RegExp("^"+Wt.call(Gt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Vt(e){return!(!mt(e)||function(e){return!!Lt&&Lt in e}(e))&&(Rt(e)?Ut:zt).test(jt(e))}function Xt(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Vt(n)?n:void 0}var qt=Xt(Ge,"WeakMap"),Kt=qt&&new qt,Yt=Kt?function(e,t){return Kt.set(e,t),e}:Tt,Qt=Object.create,Zt=function(){function e(){}return function(t){if(!mt(t))return{};if(Qt)return Qt(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=Zt(e.prototype),i=e.apply(n,t);return mt(i)?i:n}}var Jt=1;function en(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 tn=Math.max;function nn(e,t,n,i){for(var r=-1,o=e.length,a=n.length,s=-1,l=t.length,u=tn(o-a,0),d=Array(l+u),c=!i;++s<l;)d[s]=t[s];for(;++r<a;)(c||r<o)&&(d[n[r]]=e[r]);for(;u--;)d[s++]=e[r++];return d}var rn=Math.max;function on(e,t,n,i){for(var r=-1,o=e.length,a=-1,s=n.length,l=-1,u=t.length,d=rn(o-s,0),c=Array(d+u),h=!i;++r<d;)c[r]=e[r];for(var p=r;++l<u;)c[p+l]=t[l];for(;++a<s;)(h||r<o)&&(c[p+n[a]]=e[r++]);return c}function an(){}var sn=4294967295;function ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=sn,this.__views__=[]}function un(){}ln.prototype=Zt(an.prototype),ln.prototype.constructor=ln;var dn=Kt?function(e){return Kt.get(e)}:un,cn={},hn=Object.prototype.hasOwnProperty;function pn(e){for(var t=e.name+"",n=cn[t],i=hn.call(cn,t)?n.length:0;i--;){var r=n[i],o=r.func;if(null==o||o==e)return r.name}return t}function fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function gn(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}function vn(e){if(e instanceof ln)return e.clone();var t=new fn(e.__wrapped__,e.__chain__);return t.__actions__=gn(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}fn.prototype=Zt(an.prototype),fn.prototype.constructor=fn;var mn=Object.prototype.hasOwnProperty;function yn(e){if(et(e)&&!at(e)&&!(e instanceof ln)){if(e instanceof fn)return e;if(mn.call(e,"__wrapped__"))return vn(e)}return new fn(e)}function bn(e){var t=pn(e),n=yn[t];if("function"!=typeof n||!(t in ln.prototype))return!1;if(e===n)return!0;var i=dn(n);return!!i&&e===i[0]}yn.prototype=an.prototype,yn.prototype.constructor=yn;var xn=Date.now;function En(e){var t=0,n=0;return function(){var i=xn(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var wn=En(Yt),Cn=/\{\n\/\* \[wrapped with (.+)\] \*/,Nn=/,? & /;var _n=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function Sn(e){return function(){return e}}var Mn=function(){try{var e=Xt(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Tn=Mn?function(e,t){return Mn(e,"toString",{configurable:!0,enumerable:!1,value:Sn(t),writable:!0})}:Tt,An=En(Tn);function On(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););return e}function kn(e,t,n,i){for(var r=e.length,o=n+(i?1:-1);i?o--:++o<r;)if(t(e[o],o,e))return o;return-1}function Dn(e){return e!=e}function Rn(e,t,n){return t==t?function(e,t,n){for(var i=n-1,r=e.length;++i<r;)if(e[i]===t)return i;return-1}(e,t,n):kn(e,Dn,n)}function Pn(e,t){return!!(null==e?0:e.length)&&Rn(e,t,0)>-1}var In=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function Ln(e,t,n){var i=t+"";return An(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(_n,"{\n/* [wrapped with "+t+"] */\n")}(i,function(e,t){return On(In,(function(n){var i="_."+n[0];t&n[1]&&!Pn(e,i)&&e.push(i)})),e.sort()}(function(e){var t=e.match(Cn);return t?t[1].split(Nn):[]}(i),n)))}var Bn=1,jn=2,zn=4,Hn=8,Fn=32,Wn=64;function Gn(e,t,n,i,r,o,a,s,l,u){var d=t&Hn;t|=d?Fn:Wn,(t&=~(d?Wn:Fn))&zn||(t&=~(Bn|jn));var c=[e,t,r,d?o:void 0,d?a:void 0,d?void 0:o,d?void 0:a,s,l,u],h=n.apply(void 0,c);return bn(e)&&wn(h,c),h.placeholder=i,Ln(h,e,t)}function Un(e){return e.placeholder}var Vn=9007199254740991,Xn=/^(?:0|[1-9]\d*)$/;function qn(e,t){var n=typeof e;return!!(t=null==t?Vn:t)&&("number"==n||"symbol"!=n&&Xn.test(e))&&e>-1&&e%1==0&&e<t}var Kn=Math.min;var Yn="__lodash_placeholder__";function Qn(e,t){for(var n=-1,i=e.length,r=0,o=[];++n<i;){var a=e[n];a!==t&&a!==Yn||(e[n]=Yn,o[r++]=n)}return o}var Zn=1,$n=2,Jn=8,ei=16,ti=128,ni=512;function ii(e,t,n,i,r,o,a,s,l,u){var d=t&ti,c=t&Zn,h=t&$n,p=t&(Jn|ei),f=t&ni,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(p)var x=Un(v),E=function(e,t){for(var n=e.length,i=0;n--;)e[n]===t&&++i;return i}(y,x);if(i&&(y=nn(y,i,r,p)),o&&(y=on(y,o,a,p)),m-=E,p&&m<u){var w=Qn(y,x);return Gn(e,t,ii,v.placeholder,n,y,w,s,l,u-m)}var C=c?n:this,N=h?C[e]:e;return m=y.length,s?y=function(e,t){for(var n=e.length,i=Kn(t.length,n),r=gn(e);i--;){var o=t[i];e[i]=qn(o,n)?r[o]:void 0}return e}(y,s):f&&m>1&&y.reverse(),d&&l<m&&(y.length=l),this&&this!==Ge&&this instanceof v&&(N=g||$t(N)),N.apply(C,y)}}var ri=1;var oi="__lodash_placeholder__",ai=1,si=2,li=4,ui=8,di=128,ci=256,hi=Math.min;var pi="Expected a function",fi=1,gi=2,vi=8,mi=16,yi=32,bi=64,xi=Math.max;function Ei(e,t,n,i,r,o,a,s){var l=t&gi;if(!l&&"function"!=typeof e)throw new TypeError(pi);var u=i?i.length:0;if(u||(t&=~(yi|bi),i=r=void 0),a=void 0===a?a:xi(Mt(a),0),s=void 0===s?s:Mt(s),u-=r?r.length:0,t&bi){var d=i,c=r;i=r=void 0}var h=l?void 0:dn(e),p=[e,t,n,i,r,d,c,o,a,s];if(h&&function(e,t){var n=e[1],i=t[1],r=n|i,o=r<(ai|si|di),a=i==di&&n==ui||i==di&&n==ci&&e[7].length<=t[8]||i==(di|ci)&&t[7].length<=t[8]&&n==ui;if(!o&&!a)return e;i&ai&&(e[2]=t[2],r|=n&ai?0:li);var s=t[3];if(s){var l=e[3];e[3]=l?nn(l,s,t[4]):s,e[4]=l?Qn(e[3],oi):t[4]}(s=t[5])&&(l=e[5],e[5]=l?on(l,s,t[6]):s,e[6]=l?Qn(e[5],oi):t[6]),(s=t[7])&&(e[7]=s),i&di&&(e[8]=null==e[8]?t[8]:hi(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=r}(p,h),e=p[0],t=p[1],n=p[2],i=p[3],r=p[4],!(s=p[9]=void 0===p[9]?l?0:e.length:xi(p[9]-u,0))&&t&(vi|mi)&&(t&=~(vi|mi)),t&&t!=fi)f=t==vi||t==mi?function(e,t,n){var i=$t(e);return function r(){for(var o=arguments.length,a=Array(o),s=o,l=Un(r);s--;)a[s]=arguments[s];var u=o<3&&a[0]!==l&&a[o-1]!==l?[]:Qn(a,l);return(o-=u.length)<n?Gn(e,t,ii,r.placeholder,void 0,a,u,void 0,void 0,n-o):en(this&&this!==Ge&&this instanceof r?i:e,this,a)}}(e,t,s):t!=yi&&t!=(fi|yi)||r.length?ii.apply(void 0,p):function(e,t,n,i){var r=t&ri,o=$t(e);return function t(){for(var a=-1,s=arguments.length,l=-1,u=i.length,d=Array(u+s),c=this&&this!==Ge&&this instanceof t?o:e;++l<u;)d[l]=i[l];for(;s--;)d[l++]=arguments[++a];return en(c,r?n:this,d)}}(e,t,n,i);else var f=function(e,t,n){var i=t&Jt,r=$t(e);return function t(){return(this&&this!==Ge&&this instanceof t?r:e).apply(i?n:this,arguments)}}(e,t,n);return Ln((h?Yt:wn)(f,p),e,t)}var wi=128;function Ci(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,Ei(e,wi,void 0,void 0,void 0,void 0,t)}function Ni(e,t,n){"__proto__"==t&&Mn?Mn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function _i(e,t){return e===t||e!=e&&t!=t}var Si=Object.prototype.hasOwnProperty;function Mi(e,t,n){var i=e[t];Si.call(e,t)&&_i(i,n)&&(void 0!==n||t in e)||Ni(e,t,n)}function Ti(e,t,n,i){var r=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var s=t[o],l=i?i(n[s],e[s],s,n,e):void 0;void 0===l&&(l=e[s]),r?Ni(n,s,l):Mi(n,s,l)}return n}var Ai=Math.max;function Oi(e,t,n){return t=Ai(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=Ai(i.length-t,0),a=Array(o);++r<o;)a[r]=i[t+r];r=-1;for(var s=Array(t+1);++r<t;)s[r]=i[r];return s[t]=n(a),en(e,this,s)}}function ki(e,t){return An(Oi(e,t,Tt),e+"")}var Di=9007199254740991;function Ri(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Di}function Pi(e){return null!=e&&Ri(e.length)&&!Rt(e)}function Ii(e,t,n){if(!mt(n))return!1;var i=typeof t;return!!("number"==i?Pi(n)&&qn(t,n.length):"string"==i&&t in n)&&_i(n[t],e)}function Li(e){return ki((function(t,n){var i=-1,r=n.length,o=r>1?n[r-1]:void 0,a=r>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(r--,o):void 0,a&&Ii(n[0],n[1],a)&&(o=r<3?void 0:o,r=1),t=Object(t);++i<r;){var s=n[i];s&&e(t,s,i,o)}return t}))}var Bi=Object.prototype;function ji(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Bi)}function zi(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}function Hi(e){return et(e)&&"[object Arguments]"==Je(e)}var Fi=Object.prototype,Wi=Fi.hasOwnProperty,Gi=Fi.propertyIsEnumerable,Ui=Hi(function(){return arguments}())?Hi:function(e){return et(e)&&Wi.call(e,"callee")&&!Gi.call(e,"callee")};function Vi(){return!1}var Xi="object"==typeof e&&e&&!e.nodeType&&e,qi=Xi&&"object"==typeof module&&module&&!module.nodeType&&module,Ki=qi&&qi.exports===Xi?Ge.Buffer:void 0,Yi=(Ki?Ki.isBuffer:void 0)||Vi,Qi={};function Zi(e){return function(t){return e(t)}}Qi["[object Float32Array]"]=Qi["[object Float64Array]"]=Qi["[object Int8Array]"]=Qi["[object Int16Array]"]=Qi["[object Int32Array]"]=Qi["[object Uint8Array]"]=Qi["[object Uint8ClampedArray]"]=Qi["[object Uint16Array]"]=Qi["[object Uint32Array]"]=!0,Qi["[object Arguments]"]=Qi["[object Array]"]=Qi["[object ArrayBuffer]"]=Qi["[object Boolean]"]=Qi["[object DataView]"]=Qi["[object Date]"]=Qi["[object Error]"]=Qi["[object Function]"]=Qi["[object Map]"]=Qi["[object Number]"]=Qi["[object Object]"]=Qi["[object RegExp]"]=Qi["[object Set]"]=Qi["[object String]"]=Qi["[object WeakMap]"]=!1;var $i="object"==typeof e&&e&&!e.nodeType&&e,Ji=$i&&"object"==typeof module&&module&&!module.nodeType&&module,er=Ji&&Ji.exports===$i&&Fe.process,tr=function(){try{var e=Ji&&Ji.require&&Ji.require("util").types;return e||er&&er.binding&&er.binding("util")}catch(e){}}(),nr=tr&&tr.isTypedArray,ir=nr?Zi(nr):function(e){return et(e)&&Ri(e.length)&&!!Qi[Je(e)]},rr=Object.prototype.hasOwnProperty;function or(e,t){var n=at(e),i=!n&&Ui(e),r=!n&&!i&&Yi(e),o=!n&&!i&&!r&&ir(e),a=n||i||r||o,s=a?zi(e.length,String):[],l=s.length;for(var u in e)!t&&!rr.call(e,u)||a&&("length"==u||r&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||qn(u,l))||s.push(u);return s}function ar(e,t){return function(n){return e(t(n))}}var sr=ar(Object.keys,Object),lr=Object.prototype.hasOwnProperty;function ur(e){if(!ji(e))return sr(e);var t=[];for(var n in Object(e))lr.call(e,n)&&"constructor"!=n&&t.push(n);return t}function dr(e){return Pi(e)?or(e):ur(e)}var cr=Object.prototype.hasOwnProperty,hr=Li((function(e,t){if(ji(t)||Pi(t))Ti(t,dr(t),e);else for(var n in t)cr.call(t,n)&&Mi(e,n,t[n])}));var pr=Object.prototype.hasOwnProperty;function fr(e){if(!mt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ji(e),n=[];for(var i in e)("constructor"!=i||!t&&pr.call(e,i))&&n.push(i);return n}function gr(e){return Pi(e)?or(e,!0):fr(e)}var vr=Li((function(e,t){Ti(t,gr(t),e)})),mr=Li((function(e,t,n,i){Ti(t,gr(t),e,i)})),yr=Li((function(e,t,n,i){Ti(t,dr(t),e,i)})),br=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xr=/^\w*$/;function Er(e,t){if(at(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!nt(e))||(xr.test(e)||!br.test(e)||null!=t&&e in Object(t))}var wr=Xt(Object,"create");var Cr=Object.prototype.hasOwnProperty;var Nr=Object.prototype.hasOwnProperty;function _r(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 Sr(e,t){for(var n=e.length;n--;)if(_i(e[n][0],t))return n;return-1}_r.prototype.clear=function(){this.__data__=wr?wr(null):{},this.size=0},_r.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},_r.prototype.get=function(e){var t=this.__data__;if(wr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Cr.call(t,e)?t[e]:void 0},_r.prototype.has=function(e){var t=this.__data__;return wr?void 0!==t[e]:Nr.call(t,e)},_r.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=wr&&void 0===t?"__lodash_hash_undefined__":t,this};var Mr=Array.prototype.splice;function Tr(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])}}Tr.prototype.clear=function(){this.__data__=[],this.size=0},Tr.prototype.delete=function(e){var t=this.__data__,n=Sr(t,e);return!(n<0)&&(n==t.length-1?t.pop():Mr.call(t,n,1),--this.size,!0)},Tr.prototype.get=function(e){var t=this.__data__,n=Sr(t,e);return n<0?void 0:t[n][1]},Tr.prototype.has=function(e){return Sr(this.__data__,e)>-1},Tr.prototype.set=function(e,t){var n=this.__data__,i=Sr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var Ar=Xt(Ge,"Map");function Or(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 kr(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])}}kr.prototype.clear=function(){this.size=0,this.__data__={hash:new _r,map:new(Ar||Tr),string:new _r}},kr.prototype.delete=function(e){var t=Or(this,e).delete(e);return this.size-=t?1:0,t},kr.prototype.get=function(e){return Or(this,e).get(e)},kr.prototype.has=function(e){return Or(this,e).has(e)},kr.prototype.set=function(e,t){var n=Or(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};var Dr="Expected a function";function Rr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Dr);var n=function(){var i=arguments,r=t?t.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var a=e.apply(this,i);return n.cache=o.set(r,a)||o,a};return n.cache=new(Rr.Cache||kr),n}Rr.Cache=kr;var Pr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ir=/\\(\\)?/g,Lr=function(e){var t=Rr(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(Pr,(function(e,n,i,r){t.push(i?r.replace(Ir,"$1"):n||e)})),t}));function Br(e){return null==e?"":dt(e)}function jr(e,t){return at(e)?e:Er(e,t)?[e]:Lr(Br(e))}var zr=1/0;function Hr(e){if("string"==typeof e||nt(e))return e;var t=e+"";return"0"==t&&1/e==-zr?"-0":t}function Fr(e,t){for(var n=0,i=(t=jr(t,e)).length;null!=e&&n<i;)e=e[Hr(t[n++])];return n&&n==i?e:void 0}function Wr(e,t,n){var i=null==e?void 0:Fr(e,t);return void 0===i?n:i}function Gr(e,t){for(var n=-1,i=t.length,r=Array(i),o=null==e;++n<i;)r[n]=o?void 0:Wr(e,t[n]);return r}function Ur(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e}var Vr=Ue?Ue.isConcatSpreadable:void 0;function Xr(e){return at(e)||Ui(e)||!!(Vr&&e&&e[Vr])}function qr(e,t,n,i,r){var o=-1,a=e.length;for(n||(n=Xr),r||(r=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?qr(s,t-1,n,i,r):Ur(r,s):i||(r[r.length]=s)}return r}function Kr(e){return(null==e?0:e.length)?qr(e,1):[]}function Yr(e){return An(Oi(e,void 0,Kr),e+"")}var Qr=Yr(Gr),Zr=ar(Object.getPrototypeOf,Object),$r="[object Object]",Jr=Function.prototype,eo=Object.prototype,to=Jr.toString,no=eo.hasOwnProperty,io=to.call(Object);function ro(e){if(!et(e)||Je(e)!=$r)return!1;var t=Zr(e);if(null===t)return!0;var n=no.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&to.call(n)==io}var oo="[object DOMException]",ao="[object Error]";function so(e){if(!et(e))return!1;var t=Je(e);return t==ao||t==oo||"string"==typeof e.message&&"string"==typeof e.name&&!ro(e)}var lo=ki((function(e,t){try{return en(e,void 0,t)}catch(e){return so(e)?e:new Error(e)}})),uo="Expected a function";function co(e,t){var n;if("function"!=typeof t)throw new TypeError(uo);return e=Mt(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var ho=ki((function(e,t,n){var i=1;if(n.length){var r=Qn(n,Un(ho));i|=32}return Ei(e,i,t,n,r)}));ho.placeholder={};var po=Yr((function(e,t){return On(t,(function(t){t=Hr(t),Ni(e,t,ho(e[t],e))})),e})),fo=ki((function(e,t,n){var i=3;if(n.length){var r=Qn(n,Un(fo));i|=32}return Ei(t,i,e,n,r)}));function go(e,t,n){var i=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(n=n>r?r:n)<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(r);++i<r;)o[i]=e[i+t];return o}function vo(e,t,n){var i=e.length;return n=void 0===n?i:n,!t&&n>=i?e:go(e,t,n)}fo.placeholder={};var mo=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function yo(e){return mo.test(e)}var bo="\\ud800-\\udfff",xo="["+bo+"]",Eo="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",wo="\\ud83c[\\udffb-\\udfff]",Co="[^"+bo+"]",No="(?:\\ud83c[\\udde6-\\uddff]){2}",_o="[\\ud800-\\udbff][\\udc00-\\udfff]",So="(?:"+Eo+"|"+wo+")"+"?",Mo="[\\ufe0e\\ufe0f]?",To=Mo+So+("(?:\\u200d(?:"+[Co,No,_o].join("|")+")"+Mo+So+")*"),Ao="(?:"+[Co+Eo+"?",Eo,No,_o,xo].join("|")+")",Oo=RegExp(wo+"(?="+wo+")|"+Ao+To,"g");function ko(e){return yo(e)?function(e){return e.match(Oo)||[]}(e):function(e){return e.split("")}(e)}function Do(e){return function(t){var n=yo(t=Br(t))?ko(t):void 0,i=n?n[0]:t.charAt(0),r=n?vo(n,1).join(""):t.slice(1);return i[e]()+r}}var Ro=Do("toUpperCase");function Po(e){return Ro(Br(e).toLowerCase())}function Io(e,t,n,i){var r=-1,o=null==e?0:e.length;for(i&&o&&(n=e[++r]);++r<o;)n=t(n,e[r],r,e);return n}function Lo(e){return function(t){return null==e?void 0:e[t]}}var Bo=Lo({"À":"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"}),jo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,zo=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");function Ho(e){return(e=Br(e))&&e.replace(jo,Bo).replace(zo,"")}var Fo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Wo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Go="\\ud800-\\udfff",Uo="\\u2700-\\u27bf",Vo="a-z\\xdf-\\xf6\\xf8-\\xff",Xo="A-Z\\xc0-\\xd6\\xd8-\\xde",qo="\\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",Ko="["+qo+"]",Yo="\\d+",Qo="["+Uo+"]",Zo="["+Vo+"]",$o="[^"+Go+qo+Yo+Uo+Vo+Xo+"]",Jo="(?:\\ud83c[\\udde6-\\uddff]){2}",ea="[\\ud800-\\udbff][\\udc00-\\udfff]",ta="["+Xo+"]",na="(?:"+Zo+"|"+$o+")",ia="(?:"+ta+"|"+$o+")",ra="(?:['’](?:d|ll|m|re|s|t|ve))?",oa="(?:['’](?:D|LL|M|RE|S|T|VE))?",aa="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",sa="[\\ufe0e\\ufe0f]?",la=sa+aa+("(?:\\u200d(?:"+["[^"+Go+"]",Jo,ea].join("|")+")"+sa+aa+")*"),ua="(?:"+[Qo,Jo,ea].join("|")+")"+la,da=RegExp([ta+"?"+Zo+"+"+ra+"(?="+[Ko,ta,"$"].join("|")+")",ia+"+"+oa+"(?="+[Ko,ta+na,"$"].join("|")+")",ta+"?"+na+"+"+ra,ta+"+"+oa,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Yo,ua].join("|"),"g");function ca(e,t,n){return e=Br(e),void 0===(t=n?void 0:t)?function(e){return Wo.test(e)}(e)?function(e){return e.match(da)||[]}(e):function(e){return e.match(Fo)||[]}(e):e.match(t)||[]}var ha=RegExp("['’]","g");function pa(e){return function(t){return Io(ca(Ho(t).replace(ha,"")),e,"")}}var fa=pa((function(e,t,n){return t=t.toLowerCase(),e+(n?Po(t):t)}));var ga=Ge.isFinite,va=Math.min;function ma(e){var t=Math[e];return function(e,n){if(e=Ct(e),(n=null==n?0:va(Mt(n),292))&&ga(e)){var i=(Br(e)+"e").split("e");return+((i=(Br(t(i[0]+"e"+(+i[1]+n)))+"e").split("e"))[0]+"e"+(+i[1]-n))}return t(e)}}var ya=ma("ceil");function ba(e){var t=yn(e);return t.__chain__=!0,t}var xa=Math.ceil,Ea=Math.max;function wa(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Ca(e){var t=this.__data__=new Tr(e);this.size=t.size}function Na(e,t){return e&&Ti(t,dr(t),e)}Ca.prototype.clear=function(){this.__data__=new Tr,this.size=0},Ca.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ca.prototype.get=function(e){return this.__data__.get(e)},Ca.prototype.has=function(e){return this.__data__.has(e)},Ca.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Tr){var i=n.__data__;if(!Ar||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new kr(i)}return n.set(e,t),this.size=n.size,this};var _a="object"==typeof e&&e&&!e.nodeType&&e,Sa=_a&&"object"==typeof module&&module&&!module.nodeType&&module,Ma=Sa&&Sa.exports===_a?Ge.Buffer:void 0,Ta=Ma?Ma.allocUnsafe:void 0;function Aa(e,t){if(t)return e.slice();var n=e.length,i=Ta?Ta(n):new e.constructor(n);return e.copy(i),i}function Oa(e,t){for(var n=-1,i=null==e?0:e.length,r=0,o=[];++n<i;){var a=e[n];t(a,n,e)&&(o[r++]=a)}return o}function ka(){return[]}var Da=Object.prototype.propertyIsEnumerable,Ra=Object.getOwnPropertySymbols,Pa=Ra?function(e){return null==e?[]:(e=Object(e),Oa(Ra(e),(function(t){return Da.call(e,t)})))}:ka;var Ia=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ur(t,Pa(e)),e=Zr(e);return t}:ka;function La(e,t,n){var i=t(e);return at(e)?i:Ur(i,n(e))}function Ba(e){return La(e,dr,Pa)}function ja(e){return La(e,gr,Ia)}var za=Xt(Ge,"DataView"),Ha=Xt(Ge,"Promise"),Fa=Xt(Ge,"Set"),Wa="[object Map]",Ga="[object Promise]",Ua="[object Set]",Va="[object WeakMap]",Xa="[object DataView]",qa=jt(za),Ka=jt(Ar),Ya=jt(Ha),Qa=jt(Fa),Za=jt(qt),$a=Je;(za&&$a(new za(new ArrayBuffer(1)))!=Xa||Ar&&$a(new Ar)!=Wa||Ha&&$a(Ha.resolve())!=Ga||Fa&&$a(new Fa)!=Ua||qt&&$a(new qt)!=Va)&&($a=function(e){var t=Je(e),n="[object Object]"==t?e.constructor:void 0,i=n?jt(n):"";if(i)switch(i){case qa:return Xa;case Ka:return Wa;case Ya:return Ga;case Qa:return Ua;case Za:return Va}return t});var Ja=$a,es=Object.prototype.hasOwnProperty;var ts=Ge.Uint8Array;function ns(e){var t=new e.constructor(e.byteLength);return new ts(t).set(new ts(e)),t}var is=/\w*$/;var rs=Ue?Ue.prototype:void 0,os=rs?rs.valueOf:void 0;function as(e,t){var n=t?ns(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var ss="[object Boolean]",ls="[object Date]",us="[object Map]",ds="[object Number]",cs="[object RegExp]",hs="[object Set]",ps="[object String]",fs="[object Symbol]",gs="[object ArrayBuffer]",vs="[object DataView]",ms="[object Float32Array]",ys="[object Float64Array]",bs="[object Int8Array]",xs="[object Int16Array]",Es="[object Int32Array]",ws="[object Uint8Array]",Cs="[object Uint8ClampedArray]",Ns="[object Uint16Array]",_s="[object Uint32Array]";function Ss(e,t,n){var i,r=e.constructor;switch(t){case gs:return ns(e);case ss:case ls:return new r(+e);case vs:return function(e,t){var n=t?ns(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case ms:case ys:case bs:case xs:case Es:case ws:case Cs:case Ns:case _s:return as(e,n);case us:return new r;case ds:case ps:return new r(e);case cs:return function(e){var t=new e.constructor(e.source,is.exec(e));return t.lastIndex=e.lastIndex,t}(e);case hs:return new r;case fs:return i=e,os?Object(os.call(i)):{}}}function Ms(e){return"function"!=typeof e.constructor||ji(e)?{}:Zt(Zr(e))}var Ts=tr&&tr.isMap,As=Ts?Zi(Ts):function(e){return et(e)&&"[object Map]"==Ja(e)};var Os=tr&&tr.isSet,ks=Os?Zi(Os):function(e){return et(e)&&"[object Set]"==Ja(e)},Ds=1,Rs=2,Ps=4,Is="[object Arguments]",Ls="[object Function]",Bs="[object GeneratorFunction]",js="[object Object]",zs={};function Hs(e,t,n,i,r,o){var a,s=t&Ds,l=t&Rs,u=t&Ps;if(n&&(a=r?n(e,i,r,o):n(e)),void 0!==a)return a;if(!mt(e))return e;var d=at(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&es.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return gn(e,a)}else{var c=Ja(e),h=c==Ls||c==Bs;if(Yi(e))return Aa(e,s);if(c==js||c==Is||h&&!r){if(a=l||h?{}:Ms(e),!s)return l?function(e,t){return Ti(e,Ia(e),t)}(e,function(e,t){return e&&Ti(t,gr(t),e)}(a,e)):function(e,t){return Ti(e,Pa(e),t)}(e,Na(a,e))}else{if(!zs[c])return r?e:{};a=Ss(e,c,s)}}o||(o=new Ca);var p=o.get(e);if(p)return p;o.set(e,a),ks(e)?e.forEach((function(i){a.add(Hs(i,t,n,i,e,o))})):As(e)&&e.forEach((function(i,r){a.set(r,Hs(i,t,n,r,e,o))}));var f=d?void 0:(u?l?ja:Ba:l?gr:dr)(e);return On(f||e,(function(i,r){f&&(i=e[r=i]),Mi(a,r,Hs(i,t,n,r,e,o))})),a}zs[Is]=zs["[object Array]"]=zs["[object ArrayBuffer]"]=zs["[object DataView]"]=zs["[object Boolean]"]=zs["[object Date]"]=zs["[object Float32Array]"]=zs["[object Float64Array]"]=zs["[object Int8Array]"]=zs["[object Int16Array]"]=zs["[object Int32Array]"]=zs["[object Map]"]=zs["[object Number]"]=zs[js]=zs["[object RegExp]"]=zs["[object Set]"]=zs["[object String]"]=zs["[object Symbol]"]=zs["[object Uint8Array]"]=zs["[object Uint8ClampedArray]"]=zs["[object Uint16Array]"]=zs["[object Uint32Array]"]=!0,zs["[object Error]"]=zs[Ls]=zs["[object WeakMap]"]=!1;function Fs(e){return Hs(e,5)}function Ws(){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 Ur(at(n)?gn(n):[n],qr(t,1))}function Gs(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new kr;++t<n;)this.add(e[t])}function Us(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 Vs(e,t){return e.has(t)}Gs.prototype.add=Gs.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Gs.prototype.has=function(e){return this.__data__.has(e)};var Xs=1,qs=2;function Ks(e,t,n,i,r,o){var a=n&Xs,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var c=-1,h=!0,p=n&qs?new Gs:void 0;for(o.set(e,t),o.set(t,e);++c<s;){var f=e[c],g=t[c];if(i)var v=a?i(g,f,c,t,e,o):i(f,g,c,e,t,o);if(void 0!==v){if(v)continue;h=!1;break}if(p){if(!Us(t,(function(e,t){if(!Vs(p,t)&&(f===e||r(f,e,n,i,o)))return p.push(t)}))){h=!1;break}}else if(f!==g&&!r(f,g,n,i,o)){h=!1;break}}return o.delete(e),o.delete(t),h}function Ys(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Qs(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Zs=1,$s=2,Js="[object Boolean]",el="[object Date]",tl="[object Error]",nl="[object Map]",il="[object Number]",rl="[object RegExp]",ol="[object Set]",al="[object String]",sl="[object Symbol]",ll="[object ArrayBuffer]",ul="[object DataView]",dl=Ue?Ue.prototype:void 0,cl=dl?dl.valueOf:void 0;var hl=1,pl=Object.prototype.hasOwnProperty;var fl=1,gl="[object Arguments]",vl="[object Array]",ml="[object Object]",yl=Object.prototype.hasOwnProperty;function bl(e,t,n,i,r,o){var a=at(e),s=at(t),l=a?vl:Ja(e),u=s?vl:Ja(t),d=(l=l==gl?ml:l)==ml,c=(u=u==gl?ml:u)==ml,h=l==u;if(h&&Yi(e)){if(!Yi(t))return!1;a=!0,d=!1}if(h&&!d)return o||(o=new Ca),a||ir(e)?Ks(e,t,n,i,r,o):function(e,t,n,i,r,o,a){switch(n){case ul:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ll:return!(e.byteLength!=t.byteLength||!o(new ts(e),new ts(t)));case Js:case el:case il:return _i(+e,+t);case tl:return e.name==t.name&&e.message==t.message;case rl:case al:return e==t+"";case nl:var s=Ys;case ol:var l=i&Zs;if(s||(s=Qs),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;i|=$s,a.set(e,t);var d=Ks(s(e),s(t),i,r,o,a);return a.delete(e),d;case sl:if(cl)return cl.call(e)==cl.call(t)}return!1}(e,t,l,n,i,r,o);if(!(n&fl)){var p=d&&yl.call(e,"__wrapped__"),f=c&&yl.call(t,"__wrapped__");if(p||f){var g=p?e.value():e,v=f?t.value():t;return o||(o=new Ca),r(g,v,n,i,o)}}return!!h&&(o||(o=new Ca),function(e,t,n,i,r,o){var a=n&hl,s=Ba(e),l=s.length;if(l!=Ba(t).length&&!a)return!1;for(var u=l;u--;){var d=s[u];if(!(a?d in t:pl.call(t,d)))return!1}var c=o.get(e),h=o.get(t);if(c&&h)return c==t&&h==e;var p=!0;o.set(e,t),o.set(t,e);for(var f=a;++u<l;){var g=e[d=s[u]],v=t[d];if(i)var m=a?i(v,g,d,t,e,o):i(g,v,d,e,t,o);if(!(void 0===m?g===v||r(g,v,n,i,o):m)){p=!1;break}f||(f="constructor"==d)}if(p&&!f){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||(p=!1)}return o.delete(e),o.delete(t),p}(e,t,n,i,r,o))}function xl(e,t,n,i,r){return e===t||(null==e||null==t||!et(e)&&!et(t)?e!=e&&t!=t:bl(e,t,n,i,xl,r))}var El=1,wl=2;function Cl(e,t,n,i){var r=n.length,o=r,a=!i;if(null==e)return!o;for(e=Object(e);r--;){var s=n[r];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++r<o;){var l=(s=n[r])[0],u=e[l],d=s[1];if(a&&s[2]){if(void 0===u&&!(l in e))return!1}else{var c=new Ca;if(i)var h=i(u,d,l,e,t,c);if(!(void 0===h?xl(d,u,El|wl,i,c):h))return!1}}return!0}function Nl(e){return e==e&&!mt(e)}function _l(e){for(var t=dr(e),n=t.length;n--;){var i=t[n],r=e[i];t[n]=[i,r,Nl(r)]}return t}function Sl(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function Ml(e){var t=_l(e);return 1==t.length&&t[0][2]?Sl(t[0][0],t[0][1]):function(n){return n===e||Cl(n,e,t)}}function Tl(e,t){return null!=e&&t in Object(e)}function Al(e,t,n){for(var i=-1,r=(t=jr(t,e)).length,o=!1;++i<r;){var a=Hr(t[i]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++i!=r?o:!!(r=null==e?0:e.length)&&Ri(r)&&qn(a,r)&&(at(e)||Ui(e))}function Ol(e,t){return null!=e&&Al(e,t,Tl)}var kl=1,Dl=2;function Rl(e,t){return Er(e)&&Nl(t)?Sl(Hr(e),t):function(n){var i=Wr(n,e);return void 0===i&&i===t?Ol(n,e):xl(t,i,kl|Dl)}}function Pl(e){return function(t){return null==t?void 0:t[e]}}function Il(e){return Er(e)?Pl(Hr(e)):function(e){return function(t){return Fr(t,e)}}(e)}function Ll(e){return"function"==typeof e?e:null==e?Tt:"object"==typeof e?at(e)?Rl(e[0],e[1]):Ml(e):Il(e)}function Bl(e,t,n){var i=n.length;if(null==e)return!i;for(e=Object(e);i--;){var r=n[i],o=t[r],a=e[r];if(void 0===a&&!(r in e)||!o(a))return!1}return!0}function jl(e,t,n,i){for(var r=-1,o=null==e?0:e.length;++r<o;){var a=e[r];t(i,a,n(a),e)}return i}function zl(e){return function(t,n,i){for(var r=-1,o=Object(t),a=i(t),s=a.length;s--;){var l=a[e?s:++r];if(!1===n(o[l],l,o))break}return t}}var Hl=zl();function Fl(e,t){return e&&Hl(e,t,dr)}function Wl(e,t){return function(n,i){if(null==n)return n;if(!Pi(n))return e(n,i);for(var r=n.length,o=t?r:-1,a=Object(n);(t?o--:++o<r)&&!1!==i(a[o],o,a););return n}}var Gl=Wl(Fl);function Ul(e,t,n,i){return Gl(e,(function(e,r,o){t(i,e,n(e),o)})),i}function Vl(e,t){return function(n,i){var r=at(n)?jl:Ul,o=t?t():{};return r(n,e,Ll(i),o)}}var Xl=Object.prototype.hasOwnProperty,ql=Vl((function(e,t,n){Xl.call(e,n)?++e[n]:Ni(e,n,1)}));function Kl(e,t,n){var i=Ei(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=Kl.placeholder,i}Kl.placeholder={};function Yl(e,t,n){var i=Ei(e,16,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=Yl.placeholder,i}Yl.placeholder={};var Ql=function(){return Ge.Date.now()},Zl="Expected a function",$l=Math.max,Jl=Math.min;function eu(e,t,n){var i,r,o,a,s,l,u=0,d=!1,c=!1,h=!0;if("function"!=typeof e)throw new TypeError(Zl);function p(t){var n=i,o=r;return i=r=void 0,u=t,a=e.apply(o,n)}function f(e){var n=e-l;return void 0===l||n>=t||n<0||c&&e-u>=o}function g(){var e=Ql();if(f(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return c?Jl(n,o-(e-u)):n}(e))}function v(e){return s=void 0,h&&i?p(e):(i=r=void 0,a)}function m(){var e=Ql(),n=f(e);if(i=arguments,r=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(g,t),d?p(e):a}(l);if(c)return clearTimeout(s),s=setTimeout(g,t),p(l)}return void 0===s&&(s=setTimeout(g,t)),a}return t=Ct(t)||0,mt(n)&&(d=!!n.leading,o=(c="maxWait"in n)?$l(Ct(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,i=l=r=s=void 0},m.flush=function(){return void 0===s?a:v(Ql())},m}var tu=Object.prototype,nu=tu.hasOwnProperty,iu=ki((function(e,t){e=Object(e);var n=-1,i=t.length,r=i>2?t[2]:void 0;for(r&&Ii(t[0],t[1],r)&&(i=1);++n<i;)for(var o=t[n],a=gr(o),s=-1,l=a.length;++s<l;){var u=a[s],d=e[u];(void 0===d||_i(d,tu[u])&&!nu.call(e,u))&&(e[u]=o[u])}return e}));function ru(e,t,n){(void 0!==n&&!_i(e[t],n)||void 0===n&&!(t in e))&&Ni(e,t,n)}function ou(e){return et(e)&&Pi(e)}function au(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function su(e){return Ti(e,gr(e))}function lu(e,t,n,i,r){e!==t&&Hl(t,(function(o,a){if(r||(r=new Ca),mt(o))!function(e,t,n,i,r,o,a){var s=au(e,n),l=au(t,n),u=a.get(l);if(u)ru(e,n,u);else{var d=o?o(s,l,n+"",e,t,a):void 0,c=void 0===d;if(c){var h=at(l),p=!h&&Yi(l),f=!h&&!p&&ir(l);d=l,h||p||f?at(s)?d=s:ou(s)?d=gn(s):p?(c=!1,d=Aa(l,!0)):f?(c=!1,d=as(l,!0)):d=[]:ro(l)||Ui(l)?(d=s,Ui(s)?d=su(s):mt(s)&&!Rt(s)||(d=Ms(l))):c=!1}c&&(a.set(l,d),r(d,l,i,o,a),a.delete(l)),ru(e,n,d)}}(e,t,a,n,lu,i,r);else{var s=i?i(au(e,a),o,a+"",e,t,r):void 0;void 0===s&&(s=o),ru(e,a,s)}}),gr)}function uu(e,t,n,i,r,o){return mt(e)&&mt(t)&&(o.set(t,e),lu(e,t,void 0,uu,o),o.delete(t)),e}var du=Li((function(e,t,n,i){lu(e,t,n,i)})),cu=ki((function(e){return e.push(void 0,uu),en(du,void 0,e)}));function hu(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)}var pu=ki((function(e,t){return hu(e,1,t)})),fu=ki((function(e,t,n){return hu(e,Ct(t)||0,n)}));function gu(e,t,n){for(var i=-1,r=null==e?0:e.length;++i<r;)if(n(t,e[i]))return!0;return!1}var vu=200;function mu(e,t,n,i){var r=-1,o=Pn,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=ot(t,Zi(n))),i?(o=gu,a=!1):t.length>=vu&&(o=Vs,a=!1,t=new Gs(t));e:for(;++r<s;){var d=e[r],c=null==n?d:n(d);if(d=i||0!==d?d:0,a&&c==c){for(var h=u;h--;)if(t[h]===c)continue e;l.push(d)}else o(t,c,i)||l.push(d)}return l}var yu=ki((function(e,t){return ou(e)?mu(e,qr(t,1,ou,!0)):[]}));function bu(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var xu=ki((function(e,t){var n=bu(t);return ou(n)&&(n=void 0),ou(e)?mu(e,qr(t,1,ou,!0),Ll(n)):[]})),Eu=ki((function(e,t){var n=bu(t);return ou(n)&&(n=void 0),ou(e)?mu(e,qr(t,1,ou,!0),void 0,n):[]})),wu=ct((function(e,t){return e/t}),1);function Cu(e,t,n,i){for(var r=e.length,o=i?r:-1;(i?o--:++o<r)&&t(e[o],o,e););return n?go(e,i?0:o,i?o+1:r):go(e,i?o+1:0,i?r:o)}function Nu(e){return"function"==typeof e?e:Tt}function _u(e,t){return(at(e)?On:Gl)(e,Nu(t))}function Su(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}var Mu=zl(!0);function Tu(e,t){return e&&Mu(e,t,dr)}var Au=Wl(Tu,!0);function Ou(e,t){return(at(e)?Su:Au)(e,Nu(t))}function ku(e){return function(t){var n=Ja(t);return"[object Map]"==n?Ys(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 ot(t,(function(t){return[t,e[t]]}))}(t,e(t))}}var Du=ku(dr),Ru=ku(gr),Pu=Lo({"&":"&","<":"<",">":">",'"':""","'":"'"}),Iu=/[&<>"']/g,Lu=RegExp(Iu.source);function Bu(e){return(e=Br(e))&&Lu.test(e)?e.replace(Iu,Pu):e}var ju=/[\\^$.*+?()[\]{}|]/g,zu=RegExp(ju.source);function Hu(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 Gl(e,(function(e,i,r){return n=!!t(e,i,r)})),n}var Wu=4294967295;function Gu(e){return e?wa(Mt(e),0,Wu):0}function Uu(e,t){var n=[];return Gl(e,(function(e,i,r){t(e,i,r)&&n.push(e)})),n}function Vu(e,t){return(at(e)?Oa:Uu)(e,Ll(t))}function Xu(e){return function(t,n,i){var r=Object(t);if(!Pi(t)){var o=Ll(n);t=dr(t),n=function(e){return o(r[e],e,r)}}var a=e(t,n,i);return a>-1?r[o?t[a]:a]:void 0}}var qu=Math.max;function Ku(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=null==n?0:Mt(n);return r<0&&(r=qu(i+r,0)),kn(e,Ll(t),r)}var Yu=Xu(Ku);function Qu(e,t,n){var i;return n(e,(function(e,n,r){if(t(e,n,r))return i=n,!1})),i}var Zu=Math.max,$u=Math.min;function Ju(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i-1;return void 0!==n&&(r=Mt(n),r=n<0?Zu(i+r,0):$u(r,i-1)),kn(e,Ll(t),r,!0)}var ed=Xu(Ju);function td(e){return e&&e.length?e[0]:void 0}function nd(e,t){var n=-1,i=Pi(e)?Array(e.length):[];return Gl(e,(function(e,r,o){i[++n]=t(e,r,o)})),i}function id(e,t){return(at(e)?ot:nd)(e,Ll(t))}var rd=1/0;var od=1/0;var ad=ma("floor");function sd(e){return Yr((function(t){var n=t.length,i=n,r=fn.prototype.thru;for(e&&t.reverse();i--;){var o=t[i];if("function"!=typeof o)throw new TypeError("Expected a function");if(r&&!a&&"wrapper"==pn(o))var a=new fn([],!0)}for(i=a?i:n;++i<n;){var s=pn(o=t[i]),l="wrapper"==s?dn(o):void 0;a=l&&bn(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[pn(l[0])].apply(a,l[3]):1==o.length&&bn(o)?a[s]():a.thru(o)}return function(){var e=arguments,i=e[0];if(a&&1==e.length&&at(i))return a.plant(i).value();for(var r=0,o=n?t[r].apply(this,e):i;++r<n;)o=t[r].call(this,o);return o}}))}var ld=sd(),ud=sd(!0);function dd(e,t){return Oa(t,(function(t){return Rt(e[t])}))}var cd=Object.prototype.hasOwnProperty,hd=Vl((function(e,t,n){cd.call(e,n)?e[n].push(t):Ni(e,n,[t])}));function pd(e,t){return e>t}function fd(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=Ct(t),n=Ct(n)),e(t,n)}}var gd=fd(pd),vd=fd((function(e,t){return e>=t})),md=Object.prototype.hasOwnProperty;function yd(e,t){return null!=e&&md.call(e,t)}function bd(e,t){return null!=e&&Al(e,t,yd)}var xd=Math.max,Ed=Math.min;var wd="[object String]";function Cd(e){return"string"==typeof e||!at(e)&&et(e)&&Je(e)==wd}function Nd(e,t){return ot(t,(function(t){return e[t]}))}function _d(e){return null==e?[]:Nd(e,dr(e))}var Sd=Math.max;var Md=Math.max;var Td=Math.min;function Ad(e,t,n){for(var i=n?gu:Pn,r=e[0].length,o=e.length,a=o,s=Array(o),l=1/0,u=[];a--;){var d=e[a];a&&t&&(d=ot(d,Zi(t))),l=Td(d.length,l),s[a]=!n&&(t||r>=120&&d.length>=120)?new Gs(a&&d):void 0}d=e[0];var c=-1,h=s[0];e:for(;++c<r&&u.length<l;){var p=d[c],f=t?t(p):p;if(p=n||0!==p?p:0,!(h?Vs(h,f):i(u,f,n))){for(a=o;--a;){var g=s[a];if(!(g?Vs(g,f):i(e[a],f,n)))continue e}h&&h.push(f),u.push(p)}}return u}function Od(e){return ou(e)?e:[]}var kd=ki((function(e){var t=ot(e,Od);return t.length&&t[0]===e[0]?Ad(t):[]})),Dd=ki((function(e){var t=bu(e),n=ot(e,Od);return t===bu(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?Ad(n,Ll(t)):[]})),Rd=ki((function(e){var t=bu(e),n=ot(e,Od);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?Ad(n,void 0,t):[]}));function Pd(e,t){return function(n,i){return function(e,t,n,i){return Fl(e,(function(e,r,o){t(i,n(e),r,o)})),i}(n,e,t(i),{})}}var Id=Object.prototype.toString,Ld=Pd((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Id.call(t)),e[t]=n}),Sn(Tt)),Bd=Object.prototype,jd=Bd.hasOwnProperty,zd=Bd.toString,Hd=Pd((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=zd.call(t)),jd.call(e,t)?e[t].push(n):e[t]=[n]}),Ll);function Fd(e,t){return t.length<2?e:Fr(e,go(t,0,-1))}function Wd(e,t,n){var i=null==(e=Fd(e,t=jr(t,e)))?e:e[Hr(bu(t))];return null==i?void 0:en(i,e,n)}var Gd=ki(Wd),Ud=ki((function(e,t,n){var i=-1,r="function"==typeof t,o=Pi(e)?Array(e.length):[];return Gl(e,(function(e){o[++i]=r?en(t,e,n):Wd(e,t,n)})),o}));var Vd=tr&&tr.isArrayBuffer,Xd=Vd?Zi(Vd):function(e){return et(e)&&"[object ArrayBuffer]"==Je(e)};var qd=tr&&tr.isDate,Kd=qd?Zi(qd):function(e){return et(e)&&"[object Date]"==Je(e)};var Yd=Object.prototype.hasOwnProperty;function Qd(e){if(null==e)return!0;if(Pi(e)&&(at(e)||"string"==typeof e||"function"==typeof e.splice||Yi(e)||ir(e)||Ui(e)))return!e.length;var t=Ja(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(ji(e))return!ur(e).length;for(var n in e)if(Yd.call(e,n))return!1;return!0}function Zd(e,t){return xl(e,t)}var $d=Ge.isFinite;function Jd(e){return"number"==typeof e&&$d(e)}function ec(e){return"number"==typeof e&&e==Mt(e)}var tc="[object Number]";function nc(e){return"number"==typeof e||et(e)&&Je(e)==tc}var ic=It?Rt:Vi;function rc(e){return null==e}var oc=tr&&tr.isRegExp,ac=oc?Zi(oc):function(e){return et(e)&&"[object RegExp]"==Je(e)},sc=9007199254740991;var lc=Array.prototype.join;var uc=pa((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),dc=Vl((function(e,t,n){Ni(e,n,t)}));var cc=Math.max,hc=Math.min;var pc=pa((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),fc=Do("toLowerCase");function gc(e,t){return e<t}var vc=fd(gc),mc=fd((function(e,t){return e<=t}));function yc(e,t,n){for(var i=-1,r=e.length;++i<r;){var o=e[i],a=t(o);if(null!=a&&(void 0===s?a==a&&!nt(a):n(a,s)))var s=a,l=o}return l}function bc(e,t){for(var n,i=-1,r=e.length;++i<r;){var o=t(e[i]);void 0!==o&&(n=void 0===n?o:n+o)}return n}var xc=NaN;function Ec(e,t){var n=null==e?0:e.length;return n?bc(e,t)/n:xc}var wc=Li((function(e,t,n){lu(e,t,n)})),Cc=ki((function(e,t){return function(n){return Wd(n,e,t)}})),Nc=ki((function(e,t){return function(n){return Wd(e,n,t)}}));function _c(e,t,n){var i=dr(t),r=dd(t,i),o=!(mt(n)&&"chain"in n&&!n.chain),a=Rt(e);return On(r,(function(n){var i=t[n];e[n]=i,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=gn(this.__actions__)).push({func:i,args:arguments,thisArg:e}),n.__chain__=t,n}return i.apply(e,Ur([this.value()],arguments))})})),e}var Sc=ct((function(e,t){return e*t}),1),Mc="Expected a function";function Tc(e){if("function"!=typeof e)throw new TypeError(Mc);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 Ac="[object Map]",Oc="[object Set]",kc=Ue?Ue.iterator:void 0;function Dc(e){if(!e)return[];if(Pi(e))return Cd(e)?ko(e):gn(e);if(kc&&e[kc])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[kc]());var t=Ja(e);return(t==Ac?Ys:t==Oc?Qs:_d)(e)}function Rc(e,t){var n=e.length;if(n)return qn(t+=t<0?n:0,n)?e[t]:void 0}function Pc(e,t){return null==(e=Fd(e,t=jr(t,e)))||delete e[Hr(bu(t))]}function Ic(e){return ro(e)?void 0:e}var Lc=Yr((function(e,t){var n={};if(null==e)return n;var i=!1;t=ot(t,(function(t){return t=jr(t,e),i||(i=t.length>1),t})),Ti(e,ja(e),n),i&&(n=Hs(n,7,Ic));for(var r=t.length;r--;)Pc(n,t[r]);return n}));function Bc(e,t,n,i){if(!mt(e))return e;for(var r=-1,o=(t=jr(t,e)).length,a=o-1,s=e;null!=s&&++r<o;){var l=Hr(t[r]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(r!=a){var d=s[l];void 0===(u=i?i(d,l,s):void 0)&&(u=mt(d)?d:qn(t[r+1])?[]:{})}Mi(s,l,u),s=s[l]}return e}function jc(e,t,n){for(var i=-1,r=t.length,o={};++i<r;){var a=t[i],s=Fr(e,a);n(s,a)&&Bc(o,jr(a,e),s)}return o}function zc(e,t){if(null==e)return{};var n=ot(ja(e),(function(e){return[e]}));return t=Ll(t),jc(e,n,(function(e,n){return t(e,n[0])}))}function Hc(e,t){if(e!==t){var n=void 0!==e,i=null===e,r=e==e,o=nt(e),a=void 0!==t,s=null===t,l=t==t,u=nt(t);if(!s&&!u&&!o&&e>t||o&&a&&l&&!s&&!u||i&&a&&l||!n&&l||!r)return 1;if(!i&&!o&&!u&&e<t||u&&n&&r&&!i&&!o||s&&n&&r||!a&&r||!l)return-1}return 0}function Fc(e,t,n){t=t.length?ot(t,(function(e){return at(e)?function(t){return Fr(t,1===e.length?e[0]:e)}:e})):[Tt];var i=-1;t=ot(t,Zi(Ll));var r=nd(e,(function(e,n,r){var o=ot(t,(function(t){return t(e)}));return{criteria:o,index:++i,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(r,(function(e,t){return function(e,t,n){for(var i=-1,r=e.criteria,o=t.criteria,a=r.length,s=n.length;++i<a;){var l=Hc(r[i],o[i]);if(l)return i>=s?l:l*("desc"==n[i]?-1:1)}return e.index-t.index}(e,t,n)}))}function Wc(e){return Yr((function(t){return t=ot(t,Zi(Ll)),ki((function(n){var i=this;return e(t,(function(e){return en(e,i,n)}))}))}))}var Gc=Wc(ot),Uc=ki,Vc=Math.min,Xc=Uc((function(e,t){var n=(t=1==t.length&&at(t[0])?ot(t[0],Zi(Ll)):ot(qr(t,1),Zi(Ll))).length;return ki((function(i){for(var r=-1,o=Vc(i.length,n);++r<o;)i[r]=t[r].call(this,i[r]);return en(e,this,i)}))})),qc=Wc(Hu),Kc=Wc(Us),Yc=9007199254740991,Qc=Math.floor;function Zc(e,t){var n="";if(!e||t<1||t>Yc)return n;do{t%2&&(n+=e),(t=Qc(t/2))&&(e+=e)}while(t);return n}var $c=Pl("length"),Jc="\\ud800-\\udfff",eh="["+Jc+"]",th="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",nh="\\ud83c[\\udffb-\\udfff]",ih="[^"+Jc+"]",rh="(?:\\ud83c[\\udde6-\\uddff]){2}",oh="[\\ud800-\\udbff][\\udc00-\\udfff]",ah="(?:"+th+"|"+nh+")"+"?",sh="[\\ufe0e\\ufe0f]?",lh=sh+ah+("(?:\\u200d(?:"+[ih,rh,oh].join("|")+")"+sh+ah+")*"),uh="(?:"+[ih+th+"?",th,rh,oh,eh].join("|")+")",dh=RegExp(nh+"(?="+nh+")|"+uh+lh,"g");function ch(e){return yo(e)?function(e){for(var t=dh.lastIndex=0;dh.test(e);)++t;return t}(e):$c(e)}var hh=Math.ceil;function ph(e,t){var n=(t=void 0===t?" ":dt(t)).length;if(n<2)return n?Zc(t,e):t;var i=Zc(t,hh(e/ch(t)));return yo(t)?vo(ko(i),0,e).join(""):i.slice(0,e)}var fh=Math.ceil,gh=Math.floor;var vh=/^\s+/,mh=Ge.parseInt;var yh=ki((function(e,t){return Ei(e,32,void 0,t,Qn(t,Un(yh)))}));yh.placeholder={};var bh=ki((function(e,t){return Ei(e,64,void 0,t,Qn(t,Un(bh)))}));bh.placeholder={};var xh=Vl((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Eh=Yr((function(e,t){return null==e?{}:function(e,t){return jc(e,t,(function(t,n){return Ol(e,n)}))}(e,t)}));function wh(e,t,n,i){for(var r=n-1,o=e.length;++r<o;)if(i(e[r],t))return r;return-1}var Ch=Array.prototype.splice;function Nh(e,t,n,i){var r=i?wh:Rn,o=-1,a=t.length,s=e;for(e===t&&(t=gn(t)),n&&(s=ot(e,Zi(n)));++o<a;)for(var l=0,u=t[o],d=n?n(u):u;(l=r(s,d,l,i))>-1;)s!==e&&Ch.call(s,l,1),Ch.call(e,l,1);return e}function _h(e,t){return e&&e.length&&t&&t.length?Nh(e,t):e}var Sh=ki(_h);var Mh=Array.prototype.splice;function Th(e,t){for(var n=e?t.length:0,i=n-1;n--;){var r=t[n];if(n==i||r!==o){var o=r;qn(r)?Mh.call(e,r,1):Pc(e,r)}}return e}var Ah=Yr((function(e,t){var n=null==e?0:e.length,i=Gr(e,t);return Th(e,ot(t,(function(e){return qn(e,n)?+e:e})).sort(Hc)),i})),Oh=Math.floor,kh=Math.random;function Dh(e,t){return e+Oh(kh()*(t-e+1))}var Rh=parseFloat,Ph=Math.min,Ih=Math.random;var Lh=Math.ceil,Bh=Math.max;function jh(e){return function(t,n,i){return i&&"number"!=typeof i&&Ii(t,n,i)&&(n=i=void 0),t=St(t),void 0===n?(n=t,t=0):n=St(n),function(e,t,n,i){for(var r=-1,o=Bh(Lh((t-e)/(n||1)),0),a=Array(o);o--;)a[i?o:++r]=e,e+=n;return a}(t,n,i=void 0===i?t<n?1:-1:St(i),e)}}var zh=jh(),Hh=jh(!0),Fh=Yr((function(e,t){return Ei(e,256,void 0,void 0,void 0,t)}));function Wh(e,t,n,i,r){return r(e,(function(e,r,o){n=i?(i=!1,e):t(n,e,r,o)})),n}function Gh(e,t,n){var i=at(e)?Io:Wh,r=arguments.length<3;return i(e,Ll(t),n,r,Gl)}function Uh(e,t,n,i){var r=null==e?0:e.length;for(i&&r&&(n=e[--r]);r--;)n=t(n,e[r],r,e);return n}var Vh=Array.prototype.reverse;function Xh(e){return null==e?e:Vh.call(e)}var qh=ma("round");function Kh(e){var t=e.length;return t?e[Dh(0,t-1)]:void 0}function Yh(e){return Kh(_d(e))}function Qh(e,t){var n=-1,i=e.length,r=i-1;for(t=void 0===t?i:t;++n<t;){var o=Dh(n,r),a=e[o];e[o]=e[n],e[n]=a}return e.length=t,e}function Zh(e,t){return Qh(gn(e),wa(t,0,e.length))}function $h(e,t){var n=_d(e);return Qh(n,wa(t,0,n.length))}function Jh(e){return Qh(gn(e))}function ep(e){return Qh(_d(e))}var tp=pa((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));function np(e,t){var n;return Gl(e,(function(e,i,r){return!(n=t(e,i,r))})),!!n}var ip=ki((function(e,t){if(null==e)return[];var n=t.length;return n>1&&Ii(e,t[0],t[1])?t=[]:n>2&&Ii(t[0],t[1],t[2])&&(t=[t[0]]),Fc(e,qr(t,1),[])})),rp=4294967294,op=Math.floor,ap=Math.min;function sp(e,t,n,i){var r=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(t=n(t))!=t,s=null===t,l=nt(t),u=void 0===t;r<o;){var d=op((r+o)/2),c=n(e[d]),h=void 0!==c,p=null===c,f=c==c,g=nt(c);if(a)var v=i||f;else v=u?f&&(i||h):s?f&&h&&(i||!p):l?f&&h&&!p&&(i||!g):!p&&!g&&(i?c<=t:c<t);v?r=d+1:o=d}return ap(o,rp)}var lp=2147483647;function up(e,t,n){var i=0,r=null==e?i:e.length;if("number"==typeof t&&t==t&&r<=lp){for(;i<r;){var o=i+r>>>1,a=e[o];null!==a&&!nt(a)&&(n?a<=t:a<t)?i=o+1:r=o}return r}return sp(e,t,Tt,n)}function dp(e,t){for(var n=-1,i=e.length,r=0,o=[];++n<i;){var a=e[n],s=t?t(a):a;if(!n||!_i(s,l)){var l=s;o[r++]=0===a?0:a}}return o}var cp=Math.max;var hp=pa((function(e,t,n){return e+(n?" ":"")+Ro(t)}));var pp=ct((function(e,t){return e-t}),0);var fp=Object.prototype,gp=fp.hasOwnProperty;function vp(e,t,n,i){return void 0===e||_i(e,fp[n])&&!gp.call(i,n)?t:e}var mp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function yp(e){return"\\"+mp[e]}var bp=/<%=([\s\S]+?)%>/g,xp={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:bp,variable:"",imports:{_:{escape:Bu}}},Ep=/\b__p \+= '';/g,wp=/\b(__p \+=) '' \+/g,Cp=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Np=/[()=,{}\[\]\/\s]/,_p=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Sp=/($^)/,Mp=/['\n\r\u2028\u2029\\]/g,Tp=Object.prototype.hasOwnProperty;function Ap(e,t){return t(e)}var Op=4294967295,kp=Math.min;function Dp(e,t){var n=e;return n instanceof ln&&(n=n.value()),Io(t,(function(e,t){return t.func.apply(t.thisArg,Ur([e],t.args))}),n)}function Rp(){return Dp(this.__wrapped__,this.__actions__)}var Pp=9007199254740991;function Ip(e,t){for(var n=e.length;n--&&Rn(t,e[n],0)>-1;);return n}function Lp(e,t){for(var n=-1,i=e.length;++n<i&&Rn(t,e[n],0)>-1;);return n}var Bp=/^\s+/;var jp=/\w*$/;var zp=Lo({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Hp=/&(?:amp|lt|gt|quot|#39);/g,Fp=RegExp(Hp.source);var Wp=Fa&&1/Qs(new Fa([,-0]))[1]==1/0?function(e){return new Fa(e)}:un,Gp=200;function Up(e,t,n){var i=-1,r=Pn,o=e.length,a=!0,s=[],l=s;if(n)a=!1,r=gu;else if(o>=Gp){var u=t?null:Wp(e);if(u)return Qs(u);a=!1,r=Vs,l=new Gs}else l=t?[]:s;e:for(;++i<o;){var d=e[i],c=t?t(d):d;if(d=n||0!==d?d:0,a&&c==c){for(var h=l.length;h--;)if(l[h]===c)continue e;t&&l.push(c),s.push(d)}else r(l,c,n)||(l!==s&&l.push(c),s.push(d))}return s}var Vp=ki((function(e){return Up(qr(e,1,ou,!0))})),Xp=ki((function(e){var t=bu(e);return ou(t)&&(t=void 0),Up(qr(e,1,ou,!0),Ll(t))})),qp=ki((function(e){var t=bu(e);return t="function"==typeof t?t:void 0,Up(qr(e,1,ou,!0),void 0,t)}));function Kp(e,t){return e&&e.length?Up(e,Ll(t)):[]}var Yp=0;var Qp=Math.max;function Zp(e){if(!e||!e.length)return[];var t=0;return e=Oa(e,(function(e){if(ou(e))return t=Qp(e.length,t),!0})),zi(t,(function(t){return ot(e,Pl(t))}))}function $p(e,t){if(!e||!e.length)return[];var n=Zp(e);return null==t?n:ot(n,(function(e){return en(t,void 0,e)}))}function Jp(e,t,n,i){return Bc(e,t,n(Fr(e,t)),i)}var ef=pa((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}));var tf=ki((function(e,t){return ou(e)?mu(e,t):[]}));var nf=Yr((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,r=function(t){return Gr(t,e)};return!(t>1||this.__actions__.length)&&i instanceof ln&&qn(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Ap,args:[r],thisArg:void 0}),new fn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(r)}));function rf(e,t,n){var i=e.length;if(i<2)return i?Up(e[0]):[];for(var r=-1,o=Array(i);++r<i;)for(var a=e[r],s=-1;++s<i;)s!=r&&(o[r]=mu(o[r]||a,e[s],t,n));return Up(qr(o,1),t,n)}var of=ki((function(e){return rf(Oa(e,ou))})),af=ki((function(e){var t=bu(e);return ou(t)&&(t=void 0),rf(Oa(e,ou),Ll(t))})),sf=ki((function(e){var t=bu(e);return t="function"==typeof t?t:void 0,rf(Oa(e,ou),void 0,t)})),lf=ki(Zp);function uf(e,t,n){for(var i=-1,r=e.length,o=t.length,a={};++i<r;){var s=i<o?t[i]:void 0;n(a,e[i],s)}return a}var df=ki((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,$p(e,n)})),cf={chunk:function(e,t,n){t=(n?Ii(e,t,n):void 0===t)?1:Ea(Mt(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var r=0,o=0,a=Array(xa(i/t));r<i;)a[o++]=go(e,r,r+=t);return a},compact:function(e){for(var t=-1,n=null==e?0:e.length,i=0,r=[];++t<n;){var o=e[t];o&&(r[i++]=o)}return r},concat:Ws,difference:yu,differenceBy:xu,differenceWith:Eu,drop:function(e,t,n){var i=null==e?0:e.length;return i?go(e,(t=n||void 0===t?1:Mt(t))<0?0:t,i):[]},dropRight:function(e,t,n){var i=null==e?0:e.length;return i?go(e,0,(t=i-(t=n||void 0===t?1:Mt(t)))<0?0:t):[]},dropRightWhile:function(e,t){return e&&e.length?Cu(e,Ll(t),!0,!0):[]},dropWhile:function(e,t){return e&&e.length?Cu(e,Ll(t),!0):[]},fill:function(e,t,n,i){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&Ii(e,t,n)&&(n=0,i=r),function(e,t,n,i){var r=e.length;for((n=Mt(n))<0&&(n=-n>r?0:r+n),(i=void 0===i||i>r?r:Mt(i))<0&&(i+=r),i=n>i?0:Gu(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},findIndex:Ku,findLastIndex:Ju,first:td,flatten:Kr,flattenDeep:function(e){return(null==e?0:e.length)?qr(e,od):[]},flattenDepth:function(e,t){return(null==e?0:e.length)?qr(e,t=void 0===t?1:Mt(t)):[]},fromPairs:function(e){for(var t=-1,n=null==e?0:e.length,i={};++t<n;){var r=e[t];i[r[0]]=r[1]}return i},head:td,indexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=null==n?0:Mt(n);return r<0&&(r=Md(i+r,0)),Rn(e,t,r)},initial:function(e){return(null==e?0:e.length)?go(e,0,-1):[]},intersection:kd,intersectionBy:Dd,intersectionWith:Rd,join:function(e,t){return null==e?"":lc.call(e,t)},last:bu,lastIndexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i;return void 0!==n&&(r=(r=Mt(n))<0?cc(i+r,0):hc(r,i-1)),t==t?function(e,t,n){for(var i=n+1;i--;)if(e[i]===t)return i;return i}(e,t,r):kn(e,Dn,r,!0)},nth:function(e,t){return e&&e.length?Rc(e,Mt(t)):void 0},pull:Sh,pullAll:_h,pullAllBy:function(e,t,n){return e&&e.length&&t&&t.length?Nh(e,t,Ll(n)):e},pullAllWith:function(e,t,n){return e&&e.length&&t&&t.length?Nh(e,t,void 0,n):e},pullAt:Ah,remove:function(e,t){var n=[];if(!e||!e.length)return n;var i=-1,r=[],o=e.length;for(t=Ll(t);++i<o;){var a=e[i];t(a,i,e)&&(n.push(a),r.push(i))}return Th(e,r),n},reverse:Xh,slice:function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&Ii(e,t,n)?(t=0,n=i):(t=null==t?0:Mt(t),n=void 0===n?i:Mt(n)),go(e,t,n)):[]},sortedIndex:function(e,t){return up(e,t)},sortedIndexBy:function(e,t,n){return sp(e,t,Ll(n))},sortedIndexOf:function(e,t){var n=null==e?0:e.length;if(n){var i=up(e,t);if(i<n&&_i(e[i],t))return i}return-1},sortedLastIndex:function(e,t){return up(e,t,!0)},sortedLastIndexBy:function(e,t,n){return sp(e,t,Ll(n),!0)},sortedLastIndexOf:function(e,t){if(null==e?0:e.length){var n=up(e,t,!0)-1;if(_i(e[n],t))return n}return-1},sortedUniq:function(e){return e&&e.length?dp(e):[]},sortedUniqBy:function(e,t){return e&&e.length?dp(e,Ll(t)):[]},tail:function(e){var t=null==e?0:e.length;return t?go(e,1,t):[]},take:function(e,t,n){return e&&e.length?go(e,0,(t=n||void 0===t?1:Mt(t))<0?0:t):[]},takeRight:function(e,t,n){var i=null==e?0:e.length;return i?go(e,(t=i-(t=n||void 0===t?1:Mt(t)))<0?0:t,i):[]},takeRightWhile:function(e,t){return e&&e.length?Cu(e,Ll(t),!1,!0):[]},takeWhile:function(e,t){return e&&e.length?Cu(e,Ll(t)):[]},union:Vp,unionBy:Xp,unionWith:qp,uniq:function(e){return e&&e.length?Up(e):[]},uniqBy:Kp,uniqWith:function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Up(e,void 0,t):[]},unzip:Zp,unzipWith:$p,without:tf,xor:of,xorBy:af,xorWith:sf,zip:lf,zipObject:function(e,t){return uf(e||[],t||[],Mi)},zipObjectDeep:function(e,t){return uf(e||[],t||[],Bc)},zipWith:df},hf={countBy:ql,each:_u,eachRight:Ou,every:function(e,t,n){var i=at(e)?Hu:Fu;return n&&Ii(e,t,n)&&(t=void 0),i(e,Ll(t))},filter:Vu,find:Yu,findLast:ed,flatMap:function(e,t){return qr(id(e,t),1)},flatMapDeep:function(e,t){return qr(id(e,t),rd)},flatMapDepth:function(e,t,n){return n=void 0===n?1:Mt(n),qr(id(e,t),n)},forEach:_u,forEachRight:Ou,groupBy:hd,includes:function(e,t,n,i){e=Pi(e)?e:_d(e),n=n&&!i?Mt(n):0;var r=e.length;return n<0&&(n=Sd(r+n,0)),Cd(e)?n<=r&&e.indexOf(t,n)>-1:!!r&&Rn(e,t,n)>-1},invokeMap:Ud,keyBy:dc,map:id,orderBy:function(e,t,n,i){return null==e?[]:(at(t)||(t=null==t?[]:[t]),at(n=i?void 0:n)||(n=null==n?[]:[n]),Fc(e,t,n))},partition:xh,reduce:Gh,reduceRight:function(e,t,n){var i=at(e)?Uh:Wh,r=arguments.length<3;return i(e,Ll(t),n,r,Au)},reject:function(e,t){return(at(e)?Oa:Uu)(e,Tc(Ll(t)))},sample:function(e){return(at(e)?Kh:Yh)(e)},sampleSize:function(e,t,n){return t=(n?Ii(e,t,n):void 0===t)?1:Mt(t),(at(e)?Zh:$h)(e,t)},shuffle:function(e){return(at(e)?Jh:ep)(e)},size:function(e){if(null==e)return 0;if(Pi(e))return Cd(e)?ch(e):e.length;var t=Ja(e);return"[object Map]"==t||"[object Set]"==t?e.size:ur(e).length},some:function(e,t,n){var i=at(e)?Us:np;return n&&Ii(e,t,n)&&(t=void 0),i(e,Ll(t))},sortBy:ip},pf=Ql,ff={after:function(e,t){if("function"!=typeof t)throw new TypeError("Expected a function");return e=Mt(e),function(){if(--e<1)return t.apply(this,arguments)}},ary:Ci,before:co,bind:ho,bindKey:fo,curry:Kl,curryRight:Yl,debounce:eu,defer:pu,delay:fu,flip:function(e){return Ei(e,512)},memoize:Rr,negate:Tc,once:function(e){return co(2,e)},overArgs:Xc,partial:yh,partialRight:bh,rearg:Fh,rest:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return ki(e,t=void 0===t?t:Mt(t))},spread:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=null==t?0:cp(Mt(t),0),ki((function(n){var i=n[t],r=vo(n,0,t);return i&&Ur(r,i),en(e,this,r)}))},throttle:function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return mt(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),eu(e,t,{leading:i,maxWait:t,trailing:r})},unary:function(e){return Ci(e,1)},wrap:function(e,t){return yh(Nu(t),e)}},gf={castArray:function(){if(!arguments.length)return[];var e=arguments[0];return at(e)?e:[e]},clone:function(e){return Hs(e,4)},cloneDeep:Fs,cloneDeepWith:function(e,t){return Hs(e,5,t="function"==typeof t?t:void 0)},cloneWith:function(e,t){return Hs(e,4,t="function"==typeof t?t:void 0)},conformsTo:function(e,t){return null==t||Bl(e,t,dr(t))},eq:_i,gt:gd,gte:vd,isArguments:Ui,isArray:at,isArrayBuffer:Xd,isArrayLike:Pi,isArrayLikeObject:ou,isBoolean:function(e){return!0===e||!1===e||et(e)&&"[object Boolean]"==Je(e)},isBuffer:Yi,isDate:Kd,isElement:function(e){return et(e)&&1===e.nodeType&&!ro(e)},isEmpty:Qd,isEqual:Zd,isEqualWith:function(e,t,n){var i=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===i?xl(e,t,void 0,n):!!i},isError:so,isFinite:Jd,isFunction:Rt,isInteger:ec,isLength:Ri,isMap:As,isMatch:function(e,t){return e===t||Cl(e,t,_l(t))},isMatchWith:function(e,t,n){return n="function"==typeof n?n:void 0,Cl(e,t,_l(t),n)},isNaN:function(e){return nc(e)&&e!=+e},isNative:function(e){if(ic(e))throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Vt(e)},isNil:rc,isNull:function(e){return null===e},isNumber:nc,isObject:mt,isObjectLike:et,isPlainObject:ro,isRegExp:ac,isSafeInteger:function(e){return ec(e)&&e>=-9007199254740991&&e<=sc},isSet:ks,isString:Cd,isSymbol:nt,isTypedArray:ir,isUndefined:function(e){return void 0===e},isWeakMap:function(e){return et(e)&&"[object WeakMap]"==Ja(e)},isWeakSet:function(e){return et(e)&&"[object WeakSet]"==Je(e)},lt:vc,lte:mc,toArray:Dc,toFinite:St,toInteger:Mt,toLength:Gu,toNumber:Ct,toPlainObject:su,toSafeInteger:function(e){return e?wa(Mt(e),-9007199254740991,Pp):0===e?e:0},toString:Br},vf={add:ht,ceil:ya,divide:wu,floor:ad,max:function(e){return e&&e.length?yc(e,Tt,pd):void 0},maxBy:function(e,t){return e&&e.length?yc(e,Ll(t),pd):void 0},mean:function(e){return Ec(e,Tt)},meanBy:function(e,t){return Ec(e,Ll(t))},min:function(e){return e&&e.length?yc(e,Tt,gc):void 0},minBy:function(e,t){return e&&e.length?yc(e,Ll(t),gc):void 0},multiply:Sc,round:qh,subtract:pp,sum:function(e){return e&&e.length?bc(e,Tt):0},sumBy:function(e,t){return e&&e.length?bc(e,Ll(t)):0}},mf=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Ct(n))==n?n:0),void 0!==t&&(t=(t=Ct(t))==t?t:0),wa(Ct(e),t,n)},yf=function(e,t,n){return t=St(t),void 0===n?(n=t,t=0):n=St(n),function(e,t,n){return e>=Ed(t,n)&&e<xd(t,n)}(e=Ct(e),t,n)},bf=function(e,t,n){if(n&&"boolean"!=typeof n&&Ii(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=St(e),void 0===t?(t=e,e=0):t=St(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var r=Ih();return Ph(e+r*(t-e+Rh("1e-"+((r+"").length-1))),t)}return Dh(e,t)},xf={assign:hr,assignIn:vr,assignInWith:mr,assignWith:yr,at:Qr,create:function(e,t){var n=Zt(e);return null==t?n:Na(n,t)},defaults:iu,defaultsDeep:cu,entries:Du,entriesIn:Ru,extend:vr,extendWith:mr,findKey:function(e,t){return Qu(e,Ll(t),Fl)},findLastKey:function(e,t){return Qu(e,Ll(t),Tu)},forIn:function(e,t){return null==e?e:Hl(e,Nu(t),gr)},forInRight:function(e,t){return null==e?e:Mu(e,Nu(t),gr)},forOwn:function(e,t){return e&&Fl(e,Nu(t))},forOwnRight:function(e,t){return e&&Tu(e,Nu(t))},functions:function(e){return null==e?[]:dd(e,dr(e))},functionsIn:function(e){return null==e?[]:dd(e,gr(e))},get:Wr,has:bd,hasIn:Ol,invert:Ld,invertBy:Hd,invoke:Gd,keys:dr,keysIn:gr,mapKeys:function(e,t){var n={};return t=Ll(t),Fl(e,(function(e,i,r){Ni(n,t(e,i,r),e)})),n},mapValues:function(e,t){var n={};return t=Ll(t),Fl(e,(function(e,i,r){Ni(n,i,t(e,i,r))})),n},merge:wc,mergeWith:du,omit:Lc,omitBy:function(e,t){return zc(e,Tc(Ll(t)))},pick:Eh,pickBy:zc,result:function(e,t,n){var i=-1,r=(t=jr(t,e)).length;for(r||(r=1,e=void 0);++i<r;){var o=null==e?void 0:e[Hr(t[i])];void 0===o&&(i=r,o=n),e=Rt(o)?o.call(e):o}return e},set:function(e,t,n){return null==e?e:Bc(e,t,n)},setWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Bc(e,t,n,i)},toPairs:Du,toPairsIn:Ru,transform:function(e,t,n){var i=at(e),r=i||Yi(e)||ir(e);if(t=Ll(t),null==n){var o=e&&e.constructor;n=r?i?new o:[]:mt(e)&&Rt(o)?Zt(Zr(e)):{}}return(r?On:Fl)(e,(function(e,i,r){return t(n,e,i,r)})),n},unset:function(e,t){return null==e||Pc(e,t)},update:function(e,t,n){return null==e?e:Jp(e,t,Nu(n))},updateWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Jp(e,t,Nu(n),i)},values:_d,valuesIn:function(e){return null==e?[]:Nd(e,gr(e))}},Ef={at:nf,chain:ba,commit:function(){return new fn(this.value(),this.__chain__)},lodash:yn,next:function(){void 0===this.__values__&&(this.__values__=Dc(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 an;){var i=vn(n);i.__index__=0,i.__values__=void 0,t?r.__wrapped__=i:t=i;var r=i;n=n.__wrapped__}return r.__wrapped__=e,t},reverse:function(){var e=this.__wrapped__;if(e instanceof ln){var t=e;return this.__actions__.length&&(t=new ln(this)),(t=t.reverse()).__actions__.push({func:Ap,args:[Xh],thisArg:void 0}),new fn(t,this.__chain__)}return this.thru(Xh)},tap:function(e,t){return t(e),e},thru:Ap,toIterator:function(){return this},toJSON:Rp,value:Rp,valueOf:Rp,wrapperChain:function(){return ba(this)}},wf={camelCase:fa,capitalize:Po,deburr:Ho,endsWith:function(e,t,n){e=Br(e),t=dt(t);var i=e.length,r=n=void 0===n?i:wa(Mt(n),0,i);return(n-=t.length)>=0&&e.slice(n,r)==t},escape:Bu,escapeRegExp:function(e){return(e=Br(e))&&zu.test(e)?e.replace(ju,"\\$&"):e},kebabCase:uc,lowerCase:pc,lowerFirst:fc,pad:function(e,t,n){e=Br(e);var i=(t=Mt(t))?ch(e):0;if(!t||i>=t)return e;var r=(t-i)/2;return ph(gh(r),n)+e+ph(fh(r),n)},padEnd:function(e,t,n){e=Br(e);var i=(t=Mt(t))?ch(e):0;return t&&i<t?e+ph(t-i,n):e},padStart:function(e,t,n){e=Br(e);var i=(t=Mt(t))?ch(e):0;return t&&i<t?ph(t-i,n)+e:e},parseInt:function(e,t,n){return n||null==t?t=0:t&&(t=+t),mh(Br(e).replace(vh,""),t||0)},repeat:function(e,t,n){return t=(n?Ii(e,t,n):void 0===t)?1:Mt(t),Zc(Br(e),t)},replace:function(){var e=arguments,t=Br(e[0]);return e.length<3?t:t.replace(e[1],e[2])},snakeCase:tp,split:function(e,t,n){return n&&"number"!=typeof n&&Ii(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=Br(e))&&("string"==typeof t||null!=t&&!ac(t))&&!(t=dt(t))&&yo(e)?vo(ko(e),0,n):e.split(t,n):[]},startCase:hp,startsWith:function(e,t,n){return e=Br(e),n=null==n?0:wa(Mt(n),0,e.length),t=dt(t),e.slice(n,n+t.length)==t},template:function(e,t,n){var i=xp.imports._.templateSettings||xp;n&&Ii(e,t,n)&&(t=void 0),e=Br(e),t=mr({},t,i,vp);var r,o,a=mr({},t.imports,i.imports,vp),s=dr(a),l=Nd(a,s),u=0,d=t.interpolate||Sp,c="__p += '",h=RegExp((t.escape||Sp).source+"|"+d.source+"|"+(d===bp?_p:Sp).source+"|"+(t.evaluate||Sp).source+"|$","g"),p=Tp.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(h,(function(t,n,i,a,s,l){return i||(i=a),c+=e.slice(u,l).replace(Mp,yp),n&&(r=!0,c+="' +\n__e("+n+") +\n'"),s&&(o=!0,c+="';\n"+s+";\n__p += '"),i&&(c+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),u=l+t.length,t})),c+="';\n";var f=Tp.call(t,"variable")&&t.variable;if(f){if(Np.test(f))throw new Error("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(o?c.replace(Ep,""):c).replace(wp,"$1").replace(Cp,"$1;"),c="function("+(f||"obj")+") {\n"+(f?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var g=lo((function(){return Function(s,p+"return "+c).apply(void 0,l)}));if(g.source=c,so(g))throw g;return g},templateSettings:xp,toLower:function(e){return Br(e).toLowerCase()},toUpper:function(e){return Br(e).toUpperCase()},trim:function(e,t,n){if((e=Br(e))&&(n||void 0===t))return vt(e);if(!e||!(t=dt(t)))return e;var i=ko(e),r=ko(t);return vo(i,Lp(i,r),Ip(i,r)+1).join("")},trimEnd:function(e,t,n){if((e=Br(e))&&(n||void 0===t))return e.slice(0,ft(e)+1);if(!e||!(t=dt(t)))return e;var i=ko(e);return vo(i,0,Ip(i,ko(t))+1).join("")},trimStart:function(e,t,n){if((e=Br(e))&&(n||void 0===t))return e.replace(Bp,"");if(!e||!(t=dt(t)))return e;var i=ko(e);return vo(i,Lp(i,ko(t))).join("")},truncate:function(e,t){var n=30,i="...";if(mt(t)){var r="separator"in t?t.separator:r;n="length"in t?Mt(t.length):n,i="omission"in t?dt(t.omission):i}var o=(e=Br(e)).length;if(yo(e)){var a=ko(e);o=a.length}if(n>=o)return e;var s=n-ch(i);if(s<1)return i;var l=a?vo(a,0,s).join(""):e.slice(0,s);if(void 0===r)return l+i;if(a&&(s+=l.length-s),ac(r)){if(e.slice(s).search(r)){var u,d=l;for(r.global||(r=RegExp(r.source,Br(jp.exec(r))+"g")),r.lastIndex=0;u=r.exec(d);)var c=u.index;l=l.slice(0,void 0===c?s:c)}}else if(e.indexOf(dt(r),s)!=s){var h=l.lastIndexOf(r);h>-1&&(l=l.slice(0,h))}return l+i},unescape:function(e){return(e=Br(e))&&Fp.test(e)?e.replace(Hp,zp):e},upperCase:ef,upperFirst:Ro,words:ca},Cf={attempt:lo,bindAll:po,cond:function(e){var t=null==e?0:e.length,n=Ll;return e=t?ot(e,(function(e){if("function"!=typeof e[1])throw new TypeError("Expected a function");return[n(e[0]),e[1]]})):[],ki((function(n){for(var i=-1;++i<t;){var r=e[i];if(en(r[0],this,n))return en(r[1],this,n)}}))},conforms:function(e){return function(e){var t=dr(e);return function(n){return Bl(n,e,t)}}(Hs(e,1))},constant:Sn,defaultTo:function(e,t){return null==e||e!=e?t:e},flow:ld,flowRight:ud,identity:Tt,iteratee:function(e){return Ll("function"==typeof e?e:Hs(e,1))},matches:function(e){return Ml(Hs(e,1))},matchesProperty:function(e,t){return Rl(e,Hs(t,1))},method:Cc,methodOf:Nc,mixin:_c,noop:un,nthArg:function(e){return e=Mt(e),ki((function(t){return Rc(t,e)}))},over:Gc,overEvery:qc,overSome:Kc,property:Il,propertyOf:function(e){return function(t){return null==e?void 0:Fr(e,t)}},range:zh,rangeRight:Hh,stubArray:ka,stubFalse:Vi,stubObject:function(){return{}},stubString:function(){return""},stubTrue:function(){return!0},times:function(e,t){if((e=Mt(e))<1||e>9007199254740991)return[];var n=Op,i=kp(e,Op);t=Nu(t),e-=Op;for(var r=zi(i,t);++n<e;)t(n);return r},toPath:function(e){return at(e)?ot(e,Hr):nt(e)?[e]:gn(Lr(Br(e)))},uniqueId:function(e){var t=++Yp;return Br(e)+t}};var Nf=Math.max,_f=Math.min;var Sf=Math.min;var Mf,Tf,Af=4294967295,Of=Array.prototype,kf=Object.prototype.hasOwnProperty,Df=Ue?Ue.iterator:void 0,Rf=Math.max,Pf=Math.min,If=function(e){return function(t,n,i){if(null==i){var r=mt(n),o=r&&dr(n),a=o&&o.length&&dd(n,o);(a?a.length:r)||(i=n,n=t,t=this)}return e(t,n,i)}}(_c);yn.after=ff.after,yn.ary=ff.ary,yn.assign=xf.assign,yn.assignIn=xf.assignIn,yn.assignInWith=xf.assignInWith,yn.assignWith=xf.assignWith,yn.at=xf.at,yn.before=ff.before,yn.bind=ff.bind,yn.bindAll=Cf.bindAll,yn.bindKey=ff.bindKey,yn.castArray=gf.castArray,yn.chain=Ef.chain,yn.chunk=cf.chunk,yn.compact=cf.compact,yn.concat=cf.concat,yn.cond=Cf.cond,yn.conforms=Cf.conforms,yn.constant=Cf.constant,yn.countBy=hf.countBy,yn.create=xf.create,yn.curry=ff.curry,yn.curryRight=ff.curryRight,yn.debounce=ff.debounce,yn.defaults=xf.defaults,yn.defaultsDeep=xf.defaultsDeep,yn.defer=ff.defer,yn.delay=ff.delay,yn.difference=cf.difference,yn.differenceBy=cf.differenceBy,yn.differenceWith=cf.differenceWith,yn.drop=cf.drop,yn.dropRight=cf.dropRight,yn.dropRightWhile=cf.dropRightWhile,yn.dropWhile=cf.dropWhile,yn.fill=cf.fill,yn.filter=hf.filter,yn.flatMap=hf.flatMap,yn.flatMapDeep=hf.flatMapDeep,yn.flatMapDepth=hf.flatMapDepth,yn.flatten=cf.flatten,yn.flattenDeep=cf.flattenDeep,yn.flattenDepth=cf.flattenDepth,yn.flip=ff.flip,yn.flow=Cf.flow,yn.flowRight=Cf.flowRight,yn.fromPairs=cf.fromPairs,yn.functions=xf.functions,yn.functionsIn=xf.functionsIn,yn.groupBy=hf.groupBy,yn.initial=cf.initial,yn.intersection=cf.intersection,yn.intersectionBy=cf.intersectionBy,yn.intersectionWith=cf.intersectionWith,yn.invert=xf.invert,yn.invertBy=xf.invertBy,yn.invokeMap=hf.invokeMap,yn.iteratee=Cf.iteratee,yn.keyBy=hf.keyBy,yn.keys=dr,yn.keysIn=xf.keysIn,yn.map=hf.map,yn.mapKeys=xf.mapKeys,yn.mapValues=xf.mapValues,yn.matches=Cf.matches,yn.matchesProperty=Cf.matchesProperty,yn.memoize=ff.memoize,yn.merge=xf.merge,yn.mergeWith=xf.mergeWith,yn.method=Cf.method,yn.methodOf=Cf.methodOf,yn.mixin=If,yn.negate=Tc,yn.nthArg=Cf.nthArg,yn.omit=xf.omit,yn.omitBy=xf.omitBy,yn.once=ff.once,yn.orderBy=hf.orderBy,yn.over=Cf.over,yn.overArgs=ff.overArgs,yn.overEvery=Cf.overEvery,yn.overSome=Cf.overSome,yn.partial=ff.partial,yn.partialRight=ff.partialRight,yn.partition=hf.partition,yn.pick=xf.pick,yn.pickBy=xf.pickBy,yn.property=Cf.property,yn.propertyOf=Cf.propertyOf,yn.pull=cf.pull,yn.pullAll=cf.pullAll,yn.pullAllBy=cf.pullAllBy,yn.pullAllWith=cf.pullAllWith,yn.pullAt=cf.pullAt,yn.range=Cf.range,yn.rangeRight=Cf.rangeRight,yn.rearg=ff.rearg,yn.reject=hf.reject,yn.remove=cf.remove,yn.rest=ff.rest,yn.reverse=cf.reverse,yn.sampleSize=hf.sampleSize,yn.set=xf.set,yn.setWith=xf.setWith,yn.shuffle=hf.shuffle,yn.slice=cf.slice,yn.sortBy=hf.sortBy,yn.sortedUniq=cf.sortedUniq,yn.sortedUniqBy=cf.sortedUniqBy,yn.split=wf.split,yn.spread=ff.spread,yn.tail=cf.tail,yn.take=cf.take,yn.takeRight=cf.takeRight,yn.takeRightWhile=cf.takeRightWhile,yn.takeWhile=cf.takeWhile,yn.tap=Ef.tap,yn.throttle=ff.throttle,yn.thru=Ap,yn.toArray=gf.toArray,yn.toPairs=xf.toPairs,yn.toPairsIn=xf.toPairsIn,yn.toPath=Cf.toPath,yn.toPlainObject=gf.toPlainObject,yn.transform=xf.transform,yn.unary=ff.unary,yn.union=cf.union,yn.unionBy=cf.unionBy,yn.unionWith=cf.unionWith,yn.uniq=cf.uniq,yn.uniqBy=cf.uniqBy,yn.uniqWith=cf.uniqWith,yn.unset=xf.unset,yn.unzip=cf.unzip,yn.unzipWith=cf.unzipWith,yn.update=xf.update,yn.updateWith=xf.updateWith,yn.values=xf.values,yn.valuesIn=xf.valuesIn,yn.without=cf.without,yn.words=wf.words,yn.wrap=ff.wrap,yn.xor=cf.xor,yn.xorBy=cf.xorBy,yn.xorWith=cf.xorWith,yn.zip=cf.zip,yn.zipObject=cf.zipObject,yn.zipObjectDeep=cf.zipObjectDeep,yn.zipWith=cf.zipWith,yn.entries=xf.toPairs,yn.entriesIn=xf.toPairsIn,yn.extend=xf.assignIn,yn.extendWith=xf.assignInWith,If(yn,yn),yn.add=vf.add,yn.attempt=Cf.attempt,yn.camelCase=wf.camelCase,yn.capitalize=wf.capitalize,yn.ceil=vf.ceil,yn.clamp=mf,yn.clone=gf.clone,yn.cloneDeep=gf.cloneDeep,yn.cloneDeepWith=gf.cloneDeepWith,yn.cloneWith=gf.cloneWith,yn.conformsTo=gf.conformsTo,yn.deburr=wf.deburr,yn.defaultTo=Cf.defaultTo,yn.divide=vf.divide,yn.endsWith=wf.endsWith,yn.eq=gf.eq,yn.escape=wf.escape,yn.escapeRegExp=wf.escapeRegExp,yn.every=hf.every,yn.find=hf.find,yn.findIndex=cf.findIndex,yn.findKey=xf.findKey,yn.findLast=hf.findLast,yn.findLastIndex=cf.findLastIndex,yn.findLastKey=xf.findLastKey,yn.floor=vf.floor,yn.forEach=hf.forEach,yn.forEachRight=hf.forEachRight,yn.forIn=xf.forIn,yn.forInRight=xf.forInRight,yn.forOwn=xf.forOwn,yn.forOwnRight=xf.forOwnRight,yn.get=xf.get,yn.gt=gf.gt,yn.gte=gf.gte,yn.has=xf.has,yn.hasIn=xf.hasIn,yn.head=cf.head,yn.identity=Tt,yn.includes=hf.includes,yn.indexOf=cf.indexOf,yn.inRange=yf,yn.invoke=xf.invoke,yn.isArguments=gf.isArguments,yn.isArray=at,yn.isArrayBuffer=gf.isArrayBuffer,yn.isArrayLike=gf.isArrayLike,yn.isArrayLikeObject=gf.isArrayLikeObject,yn.isBoolean=gf.isBoolean,yn.isBuffer=gf.isBuffer,yn.isDate=gf.isDate,yn.isElement=gf.isElement,yn.isEmpty=gf.isEmpty,yn.isEqual=gf.isEqual,yn.isEqualWith=gf.isEqualWith,yn.isError=gf.isError,yn.isFinite=gf.isFinite,yn.isFunction=gf.isFunction,yn.isInteger=gf.isInteger,yn.isLength=gf.isLength,yn.isMap=gf.isMap,yn.isMatch=gf.isMatch,yn.isMatchWith=gf.isMatchWith,yn.isNaN=gf.isNaN,yn.isNative=gf.isNative,yn.isNil=gf.isNil,yn.isNull=gf.isNull,yn.isNumber=gf.isNumber,yn.isObject=mt,yn.isObjectLike=gf.isObjectLike,yn.isPlainObject=gf.isPlainObject,yn.isRegExp=gf.isRegExp,yn.isSafeInteger=gf.isSafeInteger,yn.isSet=gf.isSet,yn.isString=gf.isString,yn.isSymbol=gf.isSymbol,yn.isTypedArray=gf.isTypedArray,yn.isUndefined=gf.isUndefined,yn.isWeakMap=gf.isWeakMap,yn.isWeakSet=gf.isWeakSet,yn.join=cf.join,yn.kebabCase=wf.kebabCase,yn.last=bu,yn.lastIndexOf=cf.lastIndexOf,yn.lowerCase=wf.lowerCase,yn.lowerFirst=wf.lowerFirst,yn.lt=gf.lt,yn.lte=gf.lte,yn.max=vf.max,yn.maxBy=vf.maxBy,yn.mean=vf.mean,yn.meanBy=vf.meanBy,yn.min=vf.min,yn.minBy=vf.minBy,yn.stubArray=Cf.stubArray,yn.stubFalse=Cf.stubFalse,yn.stubObject=Cf.stubObject,yn.stubString=Cf.stubString,yn.stubTrue=Cf.stubTrue,yn.multiply=vf.multiply,yn.nth=cf.nth,yn.noop=Cf.noop,yn.now=pf,yn.pad=wf.pad,yn.padEnd=wf.padEnd,yn.padStart=wf.padStart,yn.parseInt=wf.parseInt,yn.random=bf,yn.reduce=hf.reduce,yn.reduceRight=hf.reduceRight,yn.repeat=wf.repeat,yn.replace=wf.replace,yn.result=xf.result,yn.round=vf.round,yn.sample=hf.sample,yn.size=hf.size,yn.snakeCase=wf.snakeCase,yn.some=hf.some,yn.sortedIndex=cf.sortedIndex,yn.sortedIndexBy=cf.sortedIndexBy,yn.sortedIndexOf=cf.sortedIndexOf,yn.sortedLastIndex=cf.sortedLastIndex,yn.sortedLastIndexBy=cf.sortedLastIndexBy,yn.sortedLastIndexOf=cf.sortedLastIndexOf,yn.startCase=wf.startCase,yn.startsWith=wf.startsWith,yn.subtract=vf.subtract,yn.sum=vf.sum,yn.sumBy=vf.sumBy,yn.template=wf.template,yn.times=Cf.times,yn.toFinite=gf.toFinite,yn.toInteger=Mt,yn.toLength=gf.toLength,yn.toLower=wf.toLower,yn.toNumber=gf.toNumber,yn.toSafeInteger=gf.toSafeInteger,yn.toString=gf.toString,yn.toUpper=wf.toUpper,yn.trim=wf.trim,yn.trimEnd=wf.trimEnd,yn.trimStart=wf.trimStart,yn.truncate=wf.truncate,yn.unescape=wf.unescape,yn.uniqueId=Cf.uniqueId,yn.upperCase=wf.upperCase,yn.upperFirst=wf.upperFirst,yn.each=hf.forEach,yn.eachRight=hf.forEachRight,yn.first=cf.head,If(yn,(Mf={},Fl(yn,(function(e,t){kf.call(yn.prototype,t)||(Mf[t]=e)})),Mf),{chain:!1}),yn.VERSION="4.17.21",(yn.templateSettings=wf.templateSettings).imports._=yn,On(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){yn[e].placeholder=yn})),On(["drop","take"],(function(e,t){ln.prototype[e]=function(n){n=void 0===n?1:Rf(Mt(n),0);var i=this.__filtered__&&!t?new ln(this):this.clone();return i.__filtered__?i.__takeCount__=Pf(n,i.__takeCount__):i.__views__.push({size:Pf(n,Af),type:e+(i.__dir__<0?"Right":"")}),i},ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),On(["filter","map","takeWhile"],(function(e,t){var n=t+1,i=1==n||3==n;ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ll(e),type:n}),t.__filtered__=t.__filtered__||i,t}})),On(["head","last"],(function(e,t){var n="take"+(t?"Right":"");ln.prototype[e]=function(){return this[n](1).value()[0]}})),On(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");ln.prototype[e]=function(){return this.__filtered__?new ln(this):this[n](1)}})),ln.prototype.compact=function(){return this.filter(Tt)},ln.prototype.find=function(e){return this.filter(e).head()},ln.prototype.findLast=function(e){return this.reverse().find(e)},ln.prototype.invokeMap=ki((function(e,t){return"function"==typeof e?new ln(this):this.map((function(n){return Wd(n,e,t)}))})),ln.prototype.reject=function(e){return this.filter(Tc(Ll(e)))},ln.prototype.slice=function(e,t){e=Mt(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=Mt(t))<0?n.dropRight(-t):n.take(t-e)),n)},ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ln.prototype.toArray=function(){return this.take(Af)},Fl(ln.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),r=yn[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);r&&(yn.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,s=t instanceof ln,l=a[0],u=s||at(t),d=function(e){var t=r.apply(yn,Ur([e],a));return i&&c?t[0]:t};u&&n&&"function"==typeof l&&1!=l.length&&(s=u=!1);var c=this.__chain__,h=!!this.__actions__.length,p=o&&!c,f=s&&!h;if(!o&&u){t=f?t:new ln(this);var g=e.apply(t,a);return g.__actions__.push({func:Ap,args:[d],thisArg:void 0}),new fn(g,c)}return p&&f?e.apply(this,a):(g=this.thru(d),p?i?g.value()[0]:g.value():g)})})),On(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Of[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);yn.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var r=this.value();return t.apply(at(r)?r:[],e)}return this[n]((function(n){return t.apply(at(n)?n:[],e)}))}})),Fl(ln.prototype,(function(e,t){var n=yn[t];if(n){var i=n.name+"";kf.call(cn,i)||(cn[i]=[]),cn[i].push({name:t,func:n})}})),cn[ii(void 0,2).name]=[{name:"wrapper",func:void 0}],ln.prototype.clone=function(){var e=new ln(this.__wrapped__);return e.__actions__=gn(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=gn(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=gn(this.__views__),e},ln.prototype.reverse=function(){if(this.__filtered__){var e=new ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=at(e),i=t<0,r=n?e.length:0,o=function(e,t,n){for(var i=-1,r=n.length;++i<r;){var o=n[i],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=_f(t,e+a);break;case"takeRight":e=Nf(e,t-a)}}return{start:e,end:t}}(0,r,this.__views__),a=o.start,s=o.end,l=s-a,u=i?s:a-1,d=this.__iteratees__,c=d.length,h=0,p=Sf(l,this.__takeCount__);if(!n||!i&&r==l&&p==l)return Dp(e,this.__actions__);var f=[];e:for(;l--&&h<p;){for(var g=-1,v=e[u+=t];++g<c;){var m=d[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}}f[h++]=v}return f},yn.prototype.at=Ef.at,yn.prototype.chain=Ef.wrapperChain,yn.prototype.commit=Ef.commit,yn.prototype.next=Ef.next,yn.prototype.plant=Ef.plant,yn.prototype.reverse=Ef.reverse,yn.prototype.toJSON=yn.prototype.valueOf=yn.prototype.value=Ef.value,yn.prototype.first=yn.prototype.head,Df&&(yn.prototype[Df]=Ef.toIterator),Tf={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(t){e=t}throw e}},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;var Lf=0;function Bf(e,t,n,i,r,o){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:--Lf,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return Tf.vnode&&Tf.vnode(u),u}var jf=t.LogicFlowUtil.StepDrag,zf=function(e){function n(n){var i=e.call(this)||this;return i.updatePosition=function(e){var t=e.deltaX,n=e.deltaY,r=i.nodeModel,o=r.x,a=r.y;i.nodeModel.x=o+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,r=e.width,o=e.height,a=e.PCTResizeInfo,s=e.pct,l=void 0===s?1:s,u=e.freezeWidth,d=void 0!==u&&u,c=e.freezeHeight,h=void 0!==c&&c,p={width:r,height:o,deltaX:n,deltaY:i};if(a){var f=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&&(f=Math.round(g/a.ResizeBasis.basisHeight*1e5)/1e3),a.ResizePCT.widthPCT=Math.max(Math.min(a.ResizePCT.widthPCT+f,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit),a.ResizePCT.heightPCT=Math.max(Math.min(a.ResizePCT.heightPCT+f,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=r-v,i=o-m;break;case 1:n=v-r,i=o-m;break;case 2:n=v-r,i=m-o;break;case 3:n=r-v,i=m-o}return p.width=v,p.height=m,p.deltaX=n/l,p.deltaY=i/l,p}switch(t){case 0:p.width=d?r:r-n*l,p.height=h?o:o-i*l;break;case 1:p.width=d?r:r+n*l,p.height=h?o:o-i*l;break;case 2:p.width=d?r:r+n*l,p.height=h?o:o+i*l;break;case 3:p.width=d?r:r-n*l,p.height=h?o:o+i*l}return p},i.updateEdgePointByAnchors=function(){var e=i.nodeModel,t=e.id,n=e.anchors,r=i.getNodeEdges(t);r.sourceEdges.forEach((function(e){var t=n.find((function(t){return t.id===e.sourceAnchorId}));t&&e.updateStartPoint({x:t.x,y:t.y})})),r.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,r=i.nodeModel,o=r.x,a=r.y,s=r.width,l=r.height,u=r.radius,d=r.PCTResizeInfo,c=i.nodeModel,h=c.minWidth,p=c.minHeight,f=c.maxWidth,g=c.maxHeight,v=i.index,m=h===f,y=p===g,b=i.getResize({index:v,deltaX:t,deltaY:n,width:s,height:l,PCTResizeInfo:d,pct:1,freezeWidth:m,freezeHeight:y});if(b.width<h||b.width>f||b.height<p||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:o,y:a,width:s,height:l,radius:u},E={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:E})}},i.updateEllipse=function(e){var t=e.deltaX,n=e.deltaY,r=i.nodeModel,o=r.rx,a=r.ry,s=r.x,l=r.y,u=r.PCTResizeInfo,d=i.index,c=i.nodeModel,h=c.minWidth,p=c.minHeight,f=c.maxWidth,g=c.maxHeight,v=h===f,m=p===g,b=o,x=a,E=i.getResize({index:d,deltaX:t,deltaY:n,width:b,height:x,PCTResizeInfo:u,pct:.5,freezeWidth:v,freezeHeight:m});if(E.width<h/2||E.width>f/2||E.height<p/2||E.height>g/2)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:v?0:E.deltaX,deltaY:m?0:E.deltaY}),i.nodeModel.rx=E.width,i.nodeModel.ry=E.height,i.nodeModel.setProperties({nodeSize:{rx:E.width,ry:E.height}});var w={x:s,y:l},C={rx:E.width,ry:E.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:y(y({},w),{rx:o,ry:a}),afterNode:C})}},i.updateDiamond=function(e){var t=e.deltaX,n=e.deltaY,r=i.nodeModel,o=r.rx,a=r.ry,s=r.x,l=r.y,u=r.PCTResizeInfo,d=i.index,c=i.nodeModel,h=c.minWidth,p=c.minHeight,f=c.maxWidth,g=c.maxHeight,v=h===f,m=p===g,y=o,b=a,x=i.getResize({index:d,deltaX:t,deltaY:n,width:y,height:b,PCTResizeInfo:u,pct:.5,freezeWidth:v,freezeHeight:m});if(x.width<h/2||x.width>f/2||x.height<p/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 E={x:s,y:l,rx:o,ry:a},w={rx:x.width,ry:x.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:E,afterNode:w})}},i.eventEmit=function(e){var t=e.deltaX,n=e.deltaY,r=e.beforeNode,o=e.afterNode,a=i.nodeModel,s=a.id,l=a.modelType,u=a.type,d=y({id:s,modelType:l,type:u},r),c=y({id:s,modelType:l,type:u},o);i.graphModel.eventCenter.emit("node:resize",{preData:d,data:c,deltaX:t,deltaY:n,index:i.index,model:i.nodeModel})},i.onDragging=function(e){var n,r=e.deltaX,o=e.deltaY,a=i.graphModel.transformModel,s=i.nodeModel.modelType;r=(n=N(a.fixDeltaXY(r,o),2))[0],o=n[1],s===t.ModelType.RECT_NODE||s===t.ModelType.HTML_NODE?i.updateRect({deltaX:r,deltaY:o}):s===t.ModelType.ELLIPSE_NODE?i.updateEllipse({deltaX:r,deltaY:o}):s===t.ModelType.DIAMOND_NODE&&i.updateDiamond({deltaX:r,deltaY:o})},i.onDragEnd=function(){var e=i.graphModel.gridSize,t=void 0===e?1:e,n=t*Math.round(i.nodeModel.x/t),r=t*Math.round(i.nodeModel.y/t);i.nodeModel.moveTo(n,r),i.updateEdgePointByAnchors()},i.index=n.index,i.nodeModel=n.model,i.graphModel=n.graphModel,i.dragHandler=new jf({onDragging:i.onDragging,onDragEnd:i.onDragEnd,step:1}),i}return m(n,e),n.prototype.getNodeEdges=function(e){for(var t=this.graphModel.edges,n=[],i=[],r=0;r<t.length;r++){var o=t[r];o.sourceNodeId===e?n.push(o):t[r].targetNodeId===e&&i.push(o)}return{sourceEdges:n,targetEdges:i}},n.prototype.render=function(){var e=this.props,n=e.x,i=e.y,r=e.index,o=e.model.getControlPointStyle();return Bf("g",{className:"lf-resize-control-".concat(r),children:Bf(t.Rect,y({className:"lf-node-control",x:n,y:i},o,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(t.Component),Hf=function(e){function n(){var t=e.call(this)||this;return t.state={},t}return m(n,e),n.prototype.getResizeControl=function(){var e=this.props,t=e.model,n=e.graphModel,i=t.x,r=t.y,o=t.width,a=t.height,s={minX:i-o/2,minY:r-a/2,maxX:i+o/2,maxY:r+a/2},l=s.minX,u=s.minY,d=s.maxX,c=s.maxY;return[{x:l,y:u},{x:d,y:u},{x:d,y:c},{x:l,y:c}].map((function(e,i){return Bf(zf,y({index:i},e,{model:t,graphModel:n}))}))},n.prototype.getGroupSolid=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.getResizeOutlineStyle();return Bf(t.Rect,y({},a,{x:n,y:i,width:r,height:o}))},n.prototype.render=function(){return Bf("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(t.Component),Ff=function(e){function t(t,n){var i=e.call(this,t,n)||this,r=t.properties.nodeSize;return r&&(i.rx=r.rx,i.ry=r.ry),i}return m(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),Wf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Bf(Hf,{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 Bf("g",{children:[this.getResizeShape(),t.isSelected&&!n?this.getControlGroup():""]})},t}(t.EllipseNode),Gf={type:"ellipse",view:Wf,model:Ff},Uf=function(e){function t(t,n){var i=e.call(this,t,n)||this,r=t.properties.nodeSize;return r&&(i.rx=r.rx,i.ry=r.ry),i}return m(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),Vf=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Bf(Hf,{model:t,graphModel:n})},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.points,i=e.getNodeStyle();return Bf("g",{children:Bf(t.Polygon,y({},i,{points:n}))})},n.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Bf("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},n}(t.DiamondNode),Xf={type:"diamond",view:Vf,model:Uf},qf=function(e){function t(t,n){var i=e.call(this,t,n)||this,r=t.properties.nodeSize;return r&&(i.width=r.width,i.height=r.height),i}return m(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),Kf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Bf(Hf,{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 Bf("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},t}(t.HtmlNode),Yf={type:"html",view:Kf,model:qf},Qf=function(e){function t(t,n){var i=e.call(this,t,n)||this,r=t.properties.nodeSize;return r&&(i.width=r.width,i.height=r.height),i}return m(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.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),Zf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Bf(Hf,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){return Bf("g",{children:this.getResizeShape()})},t}(t.RectNode),$f={type:"rect",view:Zf,model:Qf},Jf={pluginName:"nodeResize",step:0,install:function(e){e.register(Gf),e.register(Xf),e.register(Yf),e.register($f)}},eg=function(t){function n(){var e=t.apply(this,_([],N(arguments),!1))||this;return e.isGroup=!0,e.isFolded=!1,e.unfoldedWidth=500,e.unfoldedHeight=300,e.childrenLastFoldStatus={},e}return m(n,t),n.prototype.initNodeData=function(e){var n=this;t.prototype.initNodeData.call(this,e);var i=[];at(e.children)&&(i=e.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)}))},n.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=_(_([],N(this.incoming.edges),!1),N(this.outgoing.edges),!1);this.children.forEach((function(i){var r=t.graphModel.getElement(i);if(r){var o=r.isFolded;if(r.isGroup&&!r.isFolded&&r.foldGroup(e),r.isGroup&&!e){var a=t.childrenLastFoldStatus[i];void 0!==a&&a!==r.isFolded&&r.foldGroup(a)}t.childrenLastFoldStatus[i]=!!o,r.visible=!e;var s=r.incoming.edges,l=r.outgoing.edges;n=_(_(_([],N(n),!1),N(s),!1),N(l),!1)}})),this.foldEdge(e,n)}},n.prototype.getAnchorStyle=function(e){var n=t.prototype.getAnchorStyle.call(this,e);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},n.prototype.foldEdge=function(e,t){var n=this;t.forEach((function(t,i){var r=t.id,o=t.sourceNodeId,a=t.targetNodeId,s=t.startPoint,l=t.endPoint,u=t.type,d=t.text,c=t.getProperties(),h={id:"".concat(r,"__").concat(i),sourceNodeId:o,targetNodeId:a,startPoint:s,endPoint:l,type:u,properties:c,text:null==d?void 0:d.value};t.virtual&&n.graphModel.deleteEdgeById(t.id);var p=n.graphModel.group.getNodeGroup(a);p||(p=n.graphModel.getNodeModelById(a));var f=n.graphModel.group.getNodeGroup(o);f||(f=n.graphModel.getNodeModelById(o)),e&&!1!==t.visible&&(n.children.has(o)||n.id===o?(h.startPoint=void 0,h.sourceNodeId=n.id):(h.endPoint=void 0,h.targetNodeId=n.id),p.id===n.id&&f.id===n.id||n.createVirtualEdge(h),t.visible=!1),e||!1!==t.visible||(p&&p.isGroup&&p.isFolded?(h.targetNodeId=p.id,h.endPoint=void 0,n.createVirtualEdge(h)):f&&f.isGroup&&f.isFolded?(h.sourceNodeId=f.id,h.startPoint=void 0,n.createVirtualEdge(h)):t.visible=!0)}))},n.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isFoldedEdge=!0},n.prototype.isInRange=function(e){var t=e.minX,n=e.minY,i=e.maxX,r=e.maxY;return t>=this.x-this.width/2&&i<=this.x+this.width/2&&n>=this.y-this.height/2&&r<=this.y+this.height/2},n.prototype.isAllowMoveTo=function(e){var t=e.minX,n=e.minY,i=e.maxX,r=e.maxY;return{x:t>=this.x-this.width/2&&i<=this.x+this.width/2,y:n>=this.y-this.height/2&&r<=this.y+this.height/2}},n.prototype.setAllowAppendChild=function(e){this.setProperty("groupAddable",e)},n.prototype.addChild=function(t){this.children.add(t),this.graphModel.eventCenter.emit(e.ExtensionEventType.GROUP_ADD_NODE,{data:this.getData()})},n.prototype.removeChild=function(t){this.children.delete(t),this.graphModel.eventCenter.emit(e.ExtensionEventType.GROUP_REMOVE_NODE,{data:this.getData()})},n.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},n.prototype.getData=function(){var e=this,n=t.prototype.getData.call(this);n.children=[],this.children.forEach((function(t){var i=e.graphModel.getNodeModelById(t);i&&!i.virtual&&n.children.push(t)}));var i=n.properties;return null==i||delete i.groupAddable,null==i||delete i.isFolded,n},n.prototype.getHistoryData=function(){var e=t.prototype.getData.call(this);e.children=_([],N(this.children),!1),e.isGroup=!0;var n=e.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(e.x=e.x+this.unfoldedWidth/2-this.foldedWidth/2,e.y=e.y+this.unfoldedHeight/2-this.foldedHeight/2),e},n.prototype.isAllowAppendIn=function(e){return!0},n.prototype.toBack=function(){this.zIndex--},n}(Qf),tg=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(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,r=e.x,o=e.y,a=e.radius,s=e.properties,l=e.getAddableOutlineStyle;if(!s.groupAddable)return null;var u=this.props.model.getNodeStyle().strokeWidth,d=void 0===u?0:u,c=l(),h=n+d+8,p=i+d+8;return t.h("rect",y(y({},c),{width:h,height:p,x:r-h/2,y:o-p/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 r=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)}}),r])},n.prototype.getResizeShape=function(){return t.h("g",{},[this.getAddableShape(),e.prototype.getResizeShape.call(this),this.getFoldIcon()])},n}(Zf),ng={type:"group",view:tg,model:eg},ig=-1e4,rg=function(){function n(n){var o=n.lf,a=this;this.topGroupZIndex=ig,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){a.nodeGroupMap.set(t,e.id)}))})),a.checkAndCorrectTopGroupZIndex(t.nodes))},this.appendNodeToGroup=function(t){var n=t.data,i=a.nodeGroupMap.get(n.id);if(i){var r=a.lf.getNodeModelById(i);r.removeChild(n.id),a.nodeGroupMap.delete(n.id),r.setAllowAppendChild(!1)}var o=a.lf.getNodeModelById(n.id),s=null==o?void 0:o.getBounds();if(s&&o){var l=a.getGroup(s,n);if(o.isGroup&&(n.children.forEach((function(e){a.nodeGroupMap.set(e,n.id)})),a.checkAndCorrectTopGroupZIndex([n]),a.nodeSelected({data:n,isSelected:!1,isMultiple:!1})),!l)return;if(!l.isAllowAppendIn(n))return void a.lf.emit(e.ExtensionEventType.GROUP_NOT_ALLOWED,{group:l.getData(),node:n});l.addChild(n.id),a.nodeGroupMap.set(n.id,l.id),l.setAllowAppendChild(!1)}},this.deleteGroupChild=function(e){var t=e.data;t.children&&t.children.forEach((function(e){a.nodeGroupMap.delete(e),a.lf.deleteNode(e)}));var n=a.nodeGroupMap.get(t.id);n&&(a.lf.getNodeModelById(n).removeChild(t.id),a.nodeGroupMap.delete(t.id))},this.setActiveGroup=function(e){var t=e.data,n=a.lf.getNodeModelById(t.id),i=null==n?void 0:n.getBounds();if(n&&i){var r=a.getGroup(i,t);if(a.activeGroup&&a.activeGroup.setAllowAppendChild(!1),!r||n.isGroup&&r.id===t.id)return;if(!r.isAllowAppendIn(t))return;a.activeGroup=r,a.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(e){var t=ig;return e.isGroup&&(t=Math.max(t,e.zIndex)),e.children&&e.children.forEach((function(e){"object"==typeof e&&(e=e.id);var n=a.lf.getNodeModelById(e);if(null==n?void 0:n.isGroup){var i=a.findNodeAndChildMaxZIndex(n);t=Math.max(i,t)}})),t},this.checkAndCorrectTopGroupZIndex=function(e){var t=ig;if(e.forEach((function(e){var n=a.lf.getNodeModelById(e.id);if(n){var i=a.findNodeAndChildMaxZIndex(n);i>t&&(t=i)}})),!(a.topGroupZIndex>=t)){for(var n=a.lf.graphModel.nodes.filter((function(e){return e.isGroup})),i=a.topGroupZIndex,r=0;r<n.length;r++){var o=n[r];o.zIndex>i&&(i=o.zIndex)}a.topGroupZIndex=i}},this.nodeSelected=function(e){var t=e.data,n=e.isMultiple,i=e.isSelected,r=a.lf.getNodeModelById(t.id);if(a.toFrontGroup(r),a.topGroupZIndex>-1e3){a.topGroupZIndex=ig;for(var o=a.lf.graphModel.nodes.filter((function(e){return e.isGroup})).sort((function(e,t){return e.zIndex-t.zIndex})),s=0,l=0;l<o.length;l++){var u=o[l];u.zIndex!==s&&(a.topGroupZIndex++,s=u.zIndex),u.setZIndex(a.topGroupZIndex)}}if(n&&i)if(null==r?void 0:r.isGroup)r.children.forEach((function(e){var t=a.lf.graphModel.getElement(e);null==t||t.setSelected(!1)}));else{var d=a.nodeGroupMap.get(t.id);if(d){var c=a.lf.getNodeModelById(d);(null==c?void 0:c.isSelected)&&(null==r||r.setSelected(!1))}}},this.toFrontGroup=function(e){e&&e.isGroup&&(a.topGroupZIndex++,e.setZIndex(a.topGroupZIndex),e.children&&e.children.forEach((function(e){var t=a.lf.getNodeModelById(e);a.toFrontGroup(t)})))},o.register(ng),this.lf=o,o.graphModel.addNodeMoveRules((function(e,t,n){if(e.isGroup){var i=a.getNodeAllChild(e);return o.graphModel.moveNodes(i,t,n,!0),!0}var r=o.getNodeModelById(a.nodeGroupMap.get(e.id));if(r&&r.isRestrict){var s=e.getBounds(),l=s.minX,u=s.minY,d=s.maxX,c=s.maxY;return r.isAllowMoveTo({minX:l+t,minY:u+n,maxX:d+t,maxY:c+n})}return!0})),o.graphModel.group=this,o.on(r,this.appendNodeToGroup),o.on(t.EventType.NODE_DELETE,this.deleteGroupChild),o.on(i,this.setActiveGroup),o.on(t.EventType.NODE_CLICK,this.nodeSelected),o.on(t.EventType.GRAPH_RENDERED,this.graphRendered),o.addElements=function(e,t){var n=e.nodes,i=e.edges,r={},s={nodes:[],edges:[]},l=[];return _u(n,(function(e){var n=e.id,i=e.children,u=b(e,["children"]),d=o.addNode(u);if(!d)return{nodes:[],edges:[]};n&&(r[n]=d.id),s.nodes.push(d);var c=a.createAllChildNodes(r,i,d,t).edgesArray;l.push.apply(l,_([],N(c),!1))})),l.forEach((function(e){a.createEdgeModel(e,r,t)})),_u(i,(function(e){var t=a.createEdgeModel(e,r,0);s.edges.push(t)})),s}}return n.prototype.createAllChildNodes=function(e,n,i,r){var o=this,a=this.lf,s=[],l=[],u=[];null==n||n.forEach((function(n){var d=a.getNodeModelById(n);if(d){var c=d.x,h=d.y,p=d.properties,f=d.type,g=d.rotate,v=d.children,m={x:c+r,y:h+r,properties:p,type:f,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),d.incoming.edges.forEach((function(e){l.push(e)})),d.outgoing.edges.forEach((function(e){l.push(e)})),v instanceof Set){var x=o.createAllChildNodes(e,v,b,r),E=x.nodesArray,w=x.edgesArray;u.push.apply(u,_([],N(E),!1)),s.push.apply(s,_([],N(w),!1))}}}));var d=l.filter((function(t){return e[t.sourceNodeId]&&e[t.targetNodeId]})).map((function(e){return e.getData()}));return{nodesArray:u,edgesArray:s.concat(d)}},n.prototype.createEdgeModel=function(e,t,n){var i=this.lf,r=e.sourceNodeId,o=e.targetNodeId;t[r]&&(r=t[r]),t[o]&&(o=t[o]);var a=e.type,s=e.startPoint,l=e.endPoint,u=e.pointsList,d=e.text,c={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},p=[];u&&u.length>0&&(p=u.map((function(e){return e.x+=n,e.y+=n,e})));var f={type:a,startPoint:c,endPoint:h,sourceNodeId:r,targetNodeId:o,pointsList:p};return mt(d)&&!Qd(d)&&(f.text=y(y({},d),{x:(null==d?void 0:d.x)+n,y:(null==d?void 0:d.y)+n})),i.graphModel.addEdge(f)},n.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},n.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],r=n.length-2;r>=0;r--)n[r].zIndex>i.zIndex&&(i=n[r]);return i}},n.prototype.getNodeGroup=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},n.prototype.render=function(){},n.prototype.destroy=function(){},n.pluginName="group",n}();function og(){var e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getFoldIcon=function(){var e=this.props.model,n=e,i=n.x,r=n.y,o=n.width,a=n.height,s=n.properties,l=n.foldable,u=e.x-e.width/2+5,d=e.y-e.height/2+5;if(!l)return null;var c=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:s.isFolded?"M ".concat(u+3,",").concat(d+6," ").concat(u+11,",").concat(d+6," M").concat(u+7,",").concat(d+2," ").concat(u+7,",").concat(d+10):"M ".concat(u+3,",").concat(d+6," ").concat(u+11,",").concat(d+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-o/2+5,y:r-a/2+5,onClick:function(t){var n,i;t.stopPropagation(),null===(i=(n=e).foldGroup)||void 0===i||i.call(n,!s.isFolded)}}),c])},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.getNodeStyle(),s=y(y({},a),{x:n-r/2,y:i-o/2,width:r,height:o,stroke:"black",strokeWidth:2,strokeDasharray:"0 0"});return t.h("g",{},[t.h("rect",y({},s)),this.getFoldIcon()])},n}(tg),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(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}(eg);return{type:"bpmn:subProcess",view:e,model:n}}function ag(e){var t=He("bpmn:serviceTask",De),n=He("bpmn:userTask",Re);e.register(t),e.register(n),e.register(og()),function(e){function t(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=e.id,s=n-r/2,l=n+r/2,u=i-o/2,d=i+o/2,c=t.x,h=t.y;return c>s-5&&c<l+5&&h>u-5&&h<d+5&&!(c>s+5&&c<l-5&&h>u+5&&h<d-5)?a:null}e.on("node:drag,node:dnd-drag",(function(n){var i,r,o=n.data;if("bpmn:boundaryEvent"===o.type){var a=e.graphModel.nodes;try{for(var s=C(a),l=s.next();!l.done;l=s.next()){var u=l.value;u.isTaskNode&&(t(u,o)?u.setTouching(!0):u.setTouching(!1))}}catch(e){i={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}}})),e.on("node:drop,node:dnd-add",(function(n){var i,r,o=n.data,a=o.type,s=o.id;if("bpmn:boundaryEvent"===a){var l=e.graphModel.nodes;try{for(var u=C(l),d=u.next();!d.done;d=u.next()){var c,h=d.value;if(h.isTaskNode)if(null!==(c=t(h,o))){var p=e.graphModel.getNodeModelById(s),f=e.graphModel.getNodeModelById(c),g=p.properties.attachedToRef;return g&&g!==c&&e.graphModel.getNodeModelById(g).deleteBoundaryEvent(s),void f.addBoundaryEvent(s)}}}catch(e){i={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}}})),e.graphModel.addNodeMoveRules((function(t,n,i){if(t.isTaskNode){var r=t.boundaryEvents;return e.graphModel.moveNodes(r,n,i,!0),!0}return!0}))}(e)}function sg(e){var n=function(t){function n(n,i){n.id||(n.id="Flow_".concat(xe()));var r=y(y(y({},e||{}),n.properties),{isDefaultFlow:!1});return n.properties=r,t.call(this,n,i)||this}return m(n,t),n.extendKey="SequenceFlowModel",n}(t.PolylineEdgeModel),i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(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 lg=sg();var ug=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:Me,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function dg(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 cg=function(){function e(e){var t=e.lf;t.definition={},t.useDefinition=dg(t.definition);var n=N(t.useDefinition(),2);n[0];(0,n[1])(ug),function(e){e.register(Ne(e)),e.register(we(e)),e.register(Ce(e)),e.register(Se(e)),e.register(_e(e))}(t),function(e){var t=je("bpmn:exclusiveGateway",Ae),n=je("bpmn:parallelGateway",Oe),i=je("bpmn:inclusiveGateway",ke);e.register(t),e.register(i),e.register(n)}(t),function(e){e.register(lg)}(t),ag(t),t.setDefaultEdgeType("bpmn:sequenceFlow")}return e.pluginName="BpmnElementsPlugin",e}(),hg=40,pg=40,fg=40,gg=40,vg=100,mg=80,yg=100,bg=80,xg=100,Eg=80,wg=100,Cg=80,Ng=100,_g=80,Sg=100,Mg=80,Tg=100,Ag=80,Og=100,kg=80;function Dg(e){return Object.prototype.toString.call(e)}function Rg(e){return" ".repeat(e)}function Pg(e){return"[object Object]"===Dg(e)?Object.keys(e).reduce((function(t,n){var i=n;return"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=Pg(e[n]),t}),{}):Array.isArray(e)?e.map((function(e){return Pg(e)})):e}function Ig(e){return null==e?"":e.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Lg="\t\n";function Bg(e,t,n){var i=Rg(n),r="",o=Lg+i;if("-json"===t)return"";if(0!==e&&!1!==e&&!e)return"".concat(o,"<").concat(t," />");if("#text"===t)return o+Ig(String(e));if("#cdata-section"===t)return"".concat(o,"<![CDATA[").concat(e,"]]>");if("#comment"===t)return"".concat(o,"\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(Pg(e)).replace(/"/g,"'")}return Ig(String(t))}(e),'"');if(Array.isArray(e))r+=e.map((function(e){return Bg(e,t,n+1)})).join("");else if("[object Object]"===Dg(e)){var a=Object.keys(e),s="",l=e["-json"]?Lg+Rg(n+1)+e["-json"]:"";r+="".concat(0===n?"":o,"<").concat(t),a.forEach((function(t){"-"===t.charAt(0)?s+=Bg(e[t],t,n+1):l+=Bg(e[t],t,n+1)})),r+=s+(""!==l?">".concat(l).concat(o,"</").concat(t,">"):" />")}else r+="".concat(o,"<").concat(t,">").concat(Ig(String(e)),"</").concat(t,">");return r}var jg=function(){};(jg.ObjTree=function(){return this}).VERSION="0.23",jg.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',jg.ObjTree.prototype.attr_prefix="-",jg.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)},jg.ObjTree.prototype.parseHTTP=function(e,t,n){var i,r={};for(var o in t)r[o]=t[o];if(r.method||(void 0===r.postBody&&void 0===r.postbody&&void 0===r.parameters?r.method="get":r.method="post"),n){r.asynchronous=!0;var a=this,s=n,l=r.onComplete;r.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else r.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)r.uri=e,(u=new HTTP.Request(r))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,r))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},jg.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}},jg.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 r=e.attributes[i].nodeValue;try{r=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){r=e.attributes[i].nodeValue}null!=r&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],r))}}}if(e.childNodes&&e.childNodes.length){var o=!0;t&&(o=!1);for(i=0;i<e.childNodes.length&&o;i++){var a=e.childNodes[i].nodeType;3!==a&&4!==a&&8!==a&&(o=!1)}if(o){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))(r=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],r))}}}else null===t&&(t={});return t}},jg.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},jg.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},jg.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var r in t)if(bd(t,r)){var o=t[r];r.charAt(0)!==this.attr_prefix?void 0===o||null==o?n[n.length]="<".concat(r," />"):"object"==typeof o&&o.constructor===Array?n[n.length]=this.array_to_xml(r,o):n[n.length]="object"==typeof o?this.hash_to_xml(r,o):this.scalar_to_xml(r,o):i[i.length]=" ".concat(r.substring(1),'="').concat(this.xml_escape(o),'"')}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},jg.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var r=t[i];void 0===r||null==r?n[n.length]="<".concat(e," />"):"object"==typeof r&&r.constructor===Array?n[n.length]=this.array_to_xml(e,r):n[n.length]="object"==typeof r?this.hash_to_xml(e,r):this.scalar_to_xml(e,r)}return n.join("")},jg.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")},jg.ObjTree.prototype.xml_escape=Ig;var zg;!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"}(zg||(zg={}));var Hg=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],Fg=["properties","startPoint","endPoint","pointsList"],Wg={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Gg=function(e,t){return Object.keys(t||{}).forEach((function(n){if(e[n]){var i=t[n],r=i.in,o=i.out;r&&(e[n].in=r),o&&(e[n].out=o)}else e[n]=t[n]})),e},Ug={"bpmn:startEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Ug[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=Ug[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=Ug[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=Ug[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,r=t.definitionId;return{json:'<bpmn:timerEventDefinition id="'.concat(r,'"').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,r,o=e,a=t["-id"],s="",l="";try{for(var u=C(Object.keys(t)),d=u.next();!d.done;d=u.next()){var c=d.value;c.includes("bpmn:")&&(s=N(c.split(":"),2)[1],l=null===(r=t[c])||void 0===r?void 0:r["#text"])}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return{"-definitionId":a,"-definitionType":o,"-timerType":s,"-timerValue":l}}},"bpmn:conditionExpression":{in:function(e,t){var n,i="",r="";return t["#cdata-section"]?(r="cdata",i=(null===(n=/^\$\{(.*)\}$/g.exec(t["#cdata-section"]))||void 0===n?void 0:n[1])||""):t["#text"]&&(r="normal",i=t["#text"]),{"-condition":i,"-expressionType":r}}}};function Vg(e){var t=null!=e?e:{},n=t.retainedAttrsFields,i=t.excludeFields,r=t.transformer,o=new Set(_(_([],N(Fg),!1),N(n||[]),!1)),a={in:new Set(_(_([],N(Wg.in),!1),N((null==i?void 0:i.in)||[]),!1)),out:new Set(_(_([],N(Wg.out),!1),N((null==i?void 0:i.out)||[]),!1))};return Ug=Gg(Ug,r),function(e){var t=e.nodes,n=e.edges;return function e(i,r){var s,l;if(1!==(null==i?void 0:i.flag)){var u;if((u=Ug[i.type])&&u.out){var d=u.out(i),c=Object.keys(d);c.length>0&&c.forEach((function(e){i[e]=d[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 p=C(Object.entries(i)),f=p.next();!f.done;f=p.next()){var g=N(f.value,2),v=g[0],m=g[1];if(1===(null==m?void 0:m.flag))return;var y=[r,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:o.has(y)?h["-".concat(v)]=e(m,y):h[v]=e(m,y))}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}return h}}(e,"")}}function Xg(e){var t,n,i={};try{for(var r=C(Object.entries(e)),o=r.next();!o.done;o=r.next()){var a=N(o.value,2),s=a[0],l=a[1];0===s.indexOf("-")?i[s.substring(1)]=Pg(l):"string"==typeof l?i[s]=l:"[object Object]"===Object.prototype.toString.call(l)?i[s]=Xg(l):Array.isArray(l)?i[s]=l.map((function(e){return Xg(e)})):i[s]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return i}function qg(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}})),r={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(r["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}}),r})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,r=80,o=e.x,a=e.y,s=$g.shapeConfigMap.get(e.type);s&&(i=s.width,r=s.height),o-=i/2,a-=r/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":o,"-y":a,"-width":i,"-height":r}};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 Kg=["bpmn:incoming","bpmn:outgoing"];function Yg(e,t){var n=[],i=[],r=new Map,o=null!=t?t:{},a=o.transformer,s=o.excludeFields,l={in:new Set(_(_([],N(Wg.in),!1),N((null==s?void 0:s.in)||[]),!1)),out:new Set(_(_([],N(Wg.out),!1),N((null==s?void 0:s.out)||[]),!1))};Ug=Gg(Ug,a);var u,d,c=e["bpmn:definitions"];if(c){var h=c["bpmn:process"];u=h,d=[function(e){function t(e){e["-children"]||(e["-children"]=[]),Object.keys(e).forEach((function(t){var n;0!==t.indexOf("bpmn:")||Kg.includes(t)||(h[t]||(h[t]=[]),!Array.isArray(h[t])&&(h[t]=[h[t]]),Array.isArray(e[t])?(n=h[t]).push.apply(n,_([],N(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;r.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,r;if(e.includes("bpmn:")){var o={};Ug[e]&&Ug[e].in?(o=null===(r=(i=Ug[e]).in)||void 0===r?void 0:r.call(i,e,yn.cloneDeep(n[e])),delete n[e]):t(n[e]);var a=void 0;(a=Reflect.ownKeys(o)).length>0&&a.forEach((function(e){Reflect.set(n,e,o[e])}))}})))}t(h[e])},function(e){if(0===e.indexOf("bpmn:")){var t=h[e];if("bpmn:sequenceFlow"===e){var o=c["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(Zg(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(Zg(i,e))}return n}(t,o)}else{var a=c["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if("bpmn:boundaryEvent"===e){var s=h[e],l=function(e){var t=e["-attachedToRef"],n=r.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 r=Qg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}));else{var r=Qg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}return i}(t,a,e))}}}],d.forEach((function(e){try{Object.keys(u).forEach((function(t){try{e(t)}catch(e){}}))}catch(e){}}))}var p=function(e,t,n){Object.keys(e).forEach((function(i){var r=n?"".concat(n,".").concat(i):i;t.has(r)?delete e[i]:"object"==typeof e[i]&&p(e[i],t,r)}))};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 r=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,o=e.type;r[o]&&(e.type=r[o])}p(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 r=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,o=e.type;r[o]&&(e.type=r[o])}p(e,l.in,"")})),{nodes:n,edges:i}}function Qg(e,t,n){var i=Number(e["dc:Bounds"]["-x"]),r=Number(e["dc:Bounds"]["-y"]),o=n["-children"],a=n["-name"],s=$g.shapeConfigMap.get(t);s&&(i+=s.width/2,r+=s.height/2);var l,u={};if(Object.entries(n).forEach((function(e){var t=N(e,2),n=t[0],i=t[1];Hg.includes(n)||(u[n]=i)})),u=Xg(u),a&&(l={x:i,y:r,value:a},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var d=e["bpmndi:BPMNLabel"]["dc:Bounds"];l.x=Number(d["-x"])+Number(d["-width"])/2,l.y=Number(d["-y"])+Number(d["-height"])/2}var c={id:e["-bpmnElement"],type:t,x:i,y:r,properties:u};return o&&(c.children=o),l&&(c.text=l),c}function Zg(e,t){var n,i=t["-name"]?"".concat(t["-name"]):"";if(i){var r=e["bpmndi:BPMNLabel"]["dc:Bounds"],o=0;i.split("\n").forEach((function(e){o<e.length&&(o=e.length)})),n={value:i,x:Number(r["-x"])+10*o/2,y:Number(r["-y"])+7}}var a={};Object.entries(t).forEach((function(e){var t=N(e,2),n=t[0],i=t[1];Hg.includes(n)||(a[n]=i)})),a=Xg(a);var s=e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),l={id:t["-id"],type:zg.FLOW,pointsList:s,sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:a};return n&&(l.text=n),l}var $g=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i,r,o=y({},n.processAttributes);!function(e,t,n){var i,r=new Map,o=Vg(n)(t);o.nodes.forEach((function(t){var n=t["-id"],i=t["-type"],o=t.text,a=t.children,s=b(t,["-id","-type","text","children"]),l={"-id":n};(null==o?void 0:o["-value"])&&(l["-name"]=o["-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),r.set(n,l)}));var a=o.edges.map((function(e){var t=e["-id"],n=e["-sourceNodeId"],i=e["-targetNodeId"],o=e.text,a=b(e,["-id","-sourceNodeId","-targetNodeId","text"]),s=r.get(i);s["bpmn:incoming"]||(s["bpmn:incoming"]=[]),s["bpmn:incoming"].push(t);var l={"-id":t,"-sourceRef":n,"-targetRef":i};return(null==o?void 0:o["-value"])&&(l["-name"]=o["-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=r.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 o,a=r.get(i["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach((function(e){a[e]&&a[e].forEach((function(t){n[e].add(t)}))}));var s=null===(o=e[i["-type"]])||void 0===o?void 0:o.findIndex((function(e){return e["-id"]===i["-id"]}));s>=0&&e[i["-type"]].splice(s,1),r.delete(i["-id"]),t[i["-type"]]||(t[i["-type"]]=[]),t[i["-type"]].push(a)}));var o=n["bpmn:incoming"];n["bpmn:outgoing"].forEach((function(e){o.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[zg.FLOW]=a}(o,e,t);var a={"-id":"BPMNPlane_1","-bpmnElement":o["-id"]};qg(a,e);var s=n.definitionAttributes;s["bpmn:process"]=o,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===(r=null==t?void 0:t.mapping)||void 0===r?void 0:r.out,d=function(e){Array.isArray(e)&&e.forEach((function(e){return d(e)})),"object"==typeof e&&Object.keys(e).forEach((function(t){var n;(n=u[t])?(e[n]=yn.cloneDeep(e[t]),delete e[t],d(e[n])):d(e[t])}))};d(l)}return l},this.adapterIn=function(e,t){if(e)return Yg(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}();$g.shapeConfigMap.set(zg.START,{width:hg,height:pg}),$g.shapeConfigMap.set(zg.END,{width:fg,height:gg}),$g.shapeConfigMap.set(zg.INTERMEDIATE_CATCH,{width:yg,height:bg}),$g.shapeConfigMap.set(zg.INTERMEDIATE_THROW,{width:yg,height:bg}),$g.shapeConfigMap.set(zg.BOUNDARY,{width:vg,height:mg}),$g.shapeConfigMap.set(zg.PARALLEL_GATEWAY,{width:xg,height:Eg}),$g.shapeConfigMap.set(zg.INCLUSIVE_GATEWAY,{width:wg,height:Cg}),$g.shapeConfigMap.set(zg.EXCLUSIVE_GATEWAY,{width:Ng,height:_g}),$g.shapeConfigMap.set(zg.SYSTEM,{width:Sg,height:Mg}),$g.shapeConfigMap.set(zg.USER,{width:Tg,height:Ag}),$g.shapeConfigMap.set(zg.SUBPROCESS,{width:Og,height:kg});var Jg=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t,i=(t=e,(new jg.ObjTree).parseXML(t));return n.adapterIn(i,n.props)},n.adapterXmlOut=function(e){return function(e){var t="";for(var n in e)t+=Bg(e[n],n,0);return t}(n.adapterOut(e,n.props))};var i=t.lf,r=t.props;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n.props=r,n}return m(t,e),t.pluginName="BPMNAdapter",t}($g),ev={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},tv={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function nv(e){switch(e){case"bpmn:sequenceFlow":return ev.SEQUENCE_FLOW;case"bpmn:startEvent":return ev.START_EVENT;case"bpmn:endEvent":return ev.END_EVENT;case"bpmn:userTask":return ev.USER_TASK;case"bpmn:exclusiveGateway":return ev.EXCLUSIVE_GATEWAY;default:return e}}var iv="An invariant failed, however the error is obfuscated because this is a production build.",rv=[];Object.freeze(rv);var ov={};function av(){return++_m.mobxGuid}function sv(e){throw lv(!1,e),"X"}function lv(e,t){if(!e)throw new Error("[mobx] "+(t||iv))}function uv(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}Object.freeze(ov);var dv=function(){};function cv(e){return null!==e&&"object"==typeof e}function hv(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function pv(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function fv(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return cv(e)&&!0===e[n]}}function gv(e){return e instanceof Map}function vv(e){return e instanceof Set}function mv(e){return e&&e.toString?e.toString():new String(e).toString()}function yv(e){return null===e?null:"object"==typeof e?""+e:e}var bv="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,xv=Symbol("mobx administration"),Ev=function(){function e(e){void 0===e&&(e="Atom@"+av()),this.name=e,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=new Set,this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=Yv.NOT_TRACKING}return e.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach((function(e){return e()}))},e.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach((function(e){return e()}))},e.prototype.reportObserved=function(){return km(this)},e.prototype.reportChanged=function(){Am(),function(e){if(e.lowestObserverState===Yv.STALE)return;e.lowestObserverState=Yv.STALE,e.observers.forEach((function(t){t.dependenciesState===Yv.UP_TO_DATE&&(t.isTracing!==Qv.NONE&&Dm(t,e),t.onBecomeStale()),t.dependenciesState=Yv.STALE}))}(this),Om()},e.prototype.toString=function(){return this.name},e}(),wv=fv("Atom",Ev);function Cv(e,t,n){void 0===t&&(t=dv),void 0===n&&(n=dv);var i=new Ev(e);return t!==dv&&Wm("onBecomeObserved",i,t),n!==dv&&Fm(i,n),i}var Nv={identity:function(e,t){return e===t},structural:function(e,t){return My(e,t)},default:function(e,t){return Object.is(e,t)},shallow:function(e,t){return My(e,t,1)}},_v=function(e,t){return _v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},_v(e,t)};var Sv=function(){return Sv=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Sv.apply(this,arguments)};function Mv(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function Tv(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}function Av(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Tv(arguments[t]));return e}var Ov=Symbol("mobx did run lazy initializers"),kv=Symbol("mobx pending decorators"),Dv={},Rv={};function Pv(e){var t,n;if(!0!==e[Ov]){var i=e[kv];if(i){pv(e,Ov,!0);var r=Av(Object.getOwnPropertySymbols(i),Object.keys(i));try{for(var o=Mv(r),a=o.next();!a.done;a=o.next()){var s=i[a.value];s.propertyCreator(e,s.prop,s.descriptor,s.decoratorTarget,s.decoratorArguments)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}}}function Iv(e,t){return function(){var n,i,r=function(i,r,o,a){if(!0===a)return t(i,r,o,i,n),null;if(!Object.prototype.hasOwnProperty.call(i,kv)){var s=i[kv];pv(i,kv,Sv({},s))}return i[kv][r]={prop:r,propertyCreator:t,descriptor:o,decoratorTarget:i,decoratorArguments:n},function(e,t){var n=t?Dv:Rv;return n[e]||(n[e]={configurable:!0,enumerable:t,get:function(){return Pv(this),this[e]},set:function(t){Pv(this),this[e]=t}})}(r,e)};return(2===(i=arguments).length||3===i.length)&&("string"==typeof i[1]||"symbol"==typeof i[1])||4===i.length&&!0===i[3]?(n=rv,r.apply(null,arguments)):(n=Array.prototype.slice.call(arguments),r)}}function Lv(e,t,n){return qm(e)?e:Array.isArray(e)?qv.array(e,{name:n}):hv(e)?qv.object(e,void 0,{name:n}):gv(e)?qv.map(e,{name:n}):vv(e)?qv.set(e,{name:n}):e}function Bv(e){return e}function jv(e){lv(e);var t=Iv(!0,(function(t,n,i,r,o){var a=i?i.initializer?i.initializer.call(t):i.value:void 0;by(t).addObservableProp(n,a,e)})),n=("undefined"!=typeof process&&process.env,t);return n.enhancer=e,n}var zv={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Hv(e){return null==e?zv:"string"==typeof e?{name:e,deep:!0,proxy:!0}:e}Object.freeze(zv);var Fv=jv(Lv),Wv=jv((function(e,t,n){return null==e||Ny(e)||dy(e)||fy(e)||my(e)?e:Array.isArray(e)?qv.array(e,{name:n,deep:!1}):hv(e)?qv.object(e,void 0,{name:n,deep:!1}):gv(e)?qv.map(e,{name:n,deep:!1}):vv(e)?qv.set(e,{name:n,deep:!1}):sv(!1)})),Gv=jv(Bv),Uv=jv((function(e,t,n){return My(e,t)?t:e}));function Vv(e){return e.defaultDecorator?e.defaultDecorator.enhancer:!1===e.deep?Bv:Lv}var Xv={box:function(e,t){arguments.length>2&&Kv("box");var n=Hv(t);return new ym(e,Vv(n),n.name,!0,n.equals)},array:function(e,t){arguments.length>2&&Kv("array");var n=Hv(t);return function(e,t,n,i){void 0===n&&(n="ObservableArray@"+av());void 0===i&&(i=!1);var r=new ay(n,t,i);!function(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}(r.values,xv,r);var o=new Proxy(r.values,oy);if(r.proxy=o,e&&e.length){var a=vm(!0);r.spliceWithArray(0,0,e),mm(a)}return o}(e,Vv(n),n.name)},map:function(e,t){arguments.length>2&&Kv("map");var n=Hv(t);return new py(e,Vv(n),n.name)},set:function(e,t){arguments.length>2&&Kv("set");var n=Hv(t);return new vy(e,Vv(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&Kv("object");var i=Hv(n);if(!1===i.proxy)return Gm({},e,t,i);var r=Um(i),o=function(e){var t=new Proxy(e,$m);return e[xv].proxy=t,t}(Gm({},void 0,void 0,i));return Vm(o,e,t,r),o},ref:Gv,shallow:Wv,deep:Fv,struct:Uv},qv=function(e,t,n){if("string"==typeof arguments[1]||"symbol"==typeof arguments[1])return Fv.apply(null,arguments);if(qm(e))return e;var i=hv(e)?qv.object(e,t,n):Array.isArray(e)?qv.array(e,t):gv(e)?qv.map(e,t):vv(e)?qv.set(e,t):e;if(i!==e)return i;sv(!1)};function Kv(e){sv("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(Xv).forEach((function(e){return qv[e]=Xv[e]}));var Yv,Qv,Zv=Iv(!1,(function(e,t,n,i,r){var o=n.get,a=n.set,s=r[0]||{};by(e).addComputedProp(e,t,Sv({get:o,set:a,context:e},s))})),$v=Zv({equals:Nv.structural}),Jv=function(e,t,n){if("string"==typeof t)return Zv.apply(null,arguments);if(null!==e&&"object"==typeof e&&1===arguments.length)return Zv.apply(null,arguments);var i="object"==typeof t?t:{};return i.get=e,i.set="function"==typeof t?t:i.set,i.name=i.name||e.name||"",new bm(i)};Jv.struct=$v,function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Yv||(Yv={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Qv||(Qv={}));var em=function(e){this.cause=e};function tm(e){return e instanceof em}function nm(e){switch(e.dependenciesState){case Yv.UP_TO_DATE:return!1;case Yv.NOT_TRACKING:case Yv.STALE:return!0;case Yv.POSSIBLY_STALE:for(var t=um(!0),n=sm(),i=e.observing,r=i.length,o=0;o<r;o++){var a=i[o];if(xm(a)){if(_m.disableErrorBoundaries)a.get();else try{a.get()}catch(e){return lm(n),dm(t),!0}if(e.dependenciesState===Yv.STALE)return lm(n),dm(t),!0}}return cm(e),lm(n),dm(t),!1}}function im(e){var t=e.observers.size>0;_m.computationDepth>0&&t&&sv(!1),_m.allowStateChanges||!t&&"strict"!==_m.enforceActions||sv(!1)}function rm(e,t,n){var i=um(!0);cm(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++_m.runId;var r,o=_m.trackingDerivation;if(_m.trackingDerivation=e,!0===_m.disableErrorBoundaries)r=t.call(n);else try{r=t.call(n)}catch(e){r=new em(e)}return _m.trackingDerivation=o,function(e){for(var t=e.observing,n=e.observing=e.newObserving,i=Yv.UP_TO_DATE,r=0,o=e.unboundDepsCount,a=0;a<o;a++){0===(s=n[a]).diffValue&&(s.diffValue=1,r!==a&&(n[r]=s),r++),s.dependenciesState>i&&(i=s.dependenciesState)}n.length=r,e.newObserving=null,o=t.length;for(;o--;){0===(s=t[o]).diffValue&&Mm(s,e),s.diffValue=0}for(;r--;){var s;1===(s=n[r]).diffValue&&(s.diffValue=0,Sm(s,e))}i!==Yv.UP_TO_DATE&&(e.dependenciesState=i,e.onBecomeStale())}(e),dm(i),r}function om(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Mm(t[n],e);e.dependenciesState=Yv.NOT_TRACKING}function am(e){var t=sm();try{return e()}finally{lm(t)}}function sm(){var e=_m.trackingDerivation;return _m.trackingDerivation=null,e}function lm(e){_m.trackingDerivation=e}function um(e){var t=_m.allowStateReads;return _m.allowStateReads=e,t}function dm(e){_m.allowStateReads=e}function cm(e){if(e.dependenciesState!==Yv.UP_TO_DATE){e.dependenciesState=Yv.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=Yv.UP_TO_DATE}}var hm=0,pm=1,fm=Object.getOwnPropertyDescriptor((function(){}),"name");function gm(e,t,n){var i=function(){return function(e,t,n,i){var r=function(){var e=!1,t=0,n=sm();Am();var i=vm(!0),r=um(!0),o={prevDerivation:n,prevAllowStateChanges:i,prevAllowStateReads:r,notifySpy:e,startTime:t,actionId:pm++,parentActionId:hm};return hm=o.actionId,o}();try{return t.apply(n,i)}catch(e){throw r.error=e,e}finally{!function(e){hm!==e.actionId&&sv("invalid action stack. did you forget to finish an action?");hm=e.parentActionId,void 0!==e.error&&(_m.suppressReactionErrors=!0);mm(e.prevAllowStateChanges),dm(e.prevAllowStateReads),Om(),lm(e.prevDerivation),e.notifySpy&&!1;_m.suppressReactionErrors=!1}(r)}}(0,t,this,arguments)};return i.isMobxAction=!0,i}function vm(e){var t=_m.allowStateChanges;return _m.allowStateChanges=e,t}function mm(e){_m.allowStateChanges=e}fm&&fm.configurable;var ym=function(e){function t(t,n,i,r,o){void 0===i&&(i="ObservableValue@"+av()),void 0===r&&(r=!0),void 0===o&&(o=Nv.default);var a=e.call(this,i)||this;return a.enhancer=n,a.name=i,a.equals=o,a.hasUnreportedChange=!1,a.value=n(t,void 0,i),a}return function(e,t){function n(){this.constructor=e}_v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.prototype.set=function(e){this.value;if((e=this.prepareNewValue(e))!==_m.UNCHANGED){false,this.setNewValue(e)}},t.prototype.prepareNewValue=function(e){if(im(this),Jm(this)){var t=ty(this,{object:this,type:"update",newValue:e});if(!t)return _m.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value,this.name),this.equals(this.value,e)?_m.UNCHANGED:e},t.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),ny(this)&&ry(this,{type:"update",object:this,newValue:e,oldValue:t})},t.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},t.prototype.intercept=function(e){return ey(this,e)},t.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),iy(this,e)},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.value+"]"},t.prototype.valueOf=function(){return yv(this.get())},t.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Ev);fv("ObservableValue",ym);var bm=function(){function e(e){this.dependenciesState=Yv.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isBeingObserved=!1,this.isPendingUnobservation=!1,this.observers=new Set,this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Yv.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+av(),this.value=new em(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Qv.NONE,lv(e.get,"missing option for computed: get"),this.derivation=e.get,this.name=e.name||"ComputedValue@"+av(),e.set&&(this.setter=gm(this.name,e.set)),this.equals=e.equals||(e.compareStructural||e.struct?Nv.structural:Nv.default),this.scope=e.context,this.requiresReaction=!!e.requiresReaction,this.keepAlive=!!e.keepAlive}return e.prototype.onBecomeStale=function(){!function(e){if(e.lowestObserverState!==Yv.UP_TO_DATE)return;e.lowestObserverState=Yv.POSSIBLY_STALE,e.observers.forEach((function(t){t.dependenciesState===Yv.UP_TO_DATE&&(t.dependenciesState=Yv.POSSIBLY_STALE,t.isTracing!==Qv.NONE&&Dm(t,e),t.onBecomeStale())}))}(this)},e.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach((function(e){return e()}))},e.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach((function(e){return e()}))},e.prototype.get=function(){this.isComputing&&sv("Cycle detected in computation "+this.name+": "+this.derivation),0!==_m.inBatch||0!==this.observers.size||this.keepAlive?(km(this),nm(this)&&this.trackAndCompute()&&function(e){if(e.lowestObserverState===Yv.STALE)return;e.lowestObserverState=Yv.STALE,e.observers.forEach((function(t){t.dependenciesState===Yv.POSSIBLY_STALE?t.dependenciesState=Yv.STALE:t.dependenciesState===Yv.UP_TO_DATE&&(e.lowestObserverState=Yv.UP_TO_DATE)}))}(this)):nm(this)&&(this.warnAboutUntrackedRead(),Am(),this.value=this.computeValue(!1),Om());var e=this.value;if(tm(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(tm(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){lv(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else lv(!1,!1)},e.prototype.trackAndCompute=function(){var e=this.value,t=this.dependenciesState===Yv.NOT_TRACKING,n=this.computeValue(!0),i=t||tm(e)||tm(n)||!this.equals(e,n);return i&&(this.value=n),i},e.prototype.computeValue=function(e){var t;if(this.isComputing=!0,_m.computationDepth++,e)t=rm(this,this.derivation,this.scope);else if(!0===_m.disableErrorBoundaries)t=this.derivation.call(this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new em(e)}return _m.computationDepth--,this.isComputing=!1,t},e.prototype.suspend=function(){this.keepAlive||(om(this),this.value=void 0)},e.prototype.observe=function(e,t){var n=this,i=!0,r=void 0;return function(e,t){void 0===t&&(t=ov);var n,i=t&&t.name||e.name||"Autorun@"+av();if(t.scheduler||t.delay){var r=function(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Hm}(t),o=!1;n=new Pm(i,(function(){o||(o=!0,r((function(){o=!1,n.isDisposed||n.track(a)})))}),t.onError,t.requiresObservable)}else n=new Pm(i,(function(){this.track(a)}),t.onError,t.requiresObservable);function a(){e(n)}return n.schedule(),n.getDisposer()}((function(){var o=n.get();if(!i||t){var a=sm();e({type:"update",object:n,newValue:o,oldValue:r}),lm(a)}i=!1,r=o}))},e.prototype.warnAboutUntrackedRead=function(){},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return yv(this.get())},e.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},e}(),xm=fv("ComputedValue",bm),Em=function(){this.version=5,this.UNCHANGED={},this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.allowStateReads=!0,this.enforceActions=!1,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.computedConfigurable=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1},wm={};function Cm(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:wm}var Nm=!0,_m=function(){var e=Cm();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Nm=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Em).version&&(Nm=!1),Nm?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Em):(setTimeout((function(){sv("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Em)}();function Sm(e,t){e.observers.add(t),e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Mm(e,t){e.observers.delete(t),0===e.observers.size&&Tm(e)}function Tm(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,_m.pendingUnobservations.push(e))}function Am(){_m.inBatch++}function Om(){if(0==--_m.inBatch){Bm();for(var e=_m.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers.size&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBecomeUnobserved()),n instanceof bm&&n.suspend())}_m.pendingUnobservations=[]}}function km(e){var t=_m.trackingDerivation;return null!==t?(t.runId!==e.lastAccessedBy&&(e.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=e,e.isBeingObserved||(e.isBeingObserved=!0,e.onBecomeObserved())),!0):(0===e.observers.size&&_m.inBatch>0&&Tm(e),!1)}function Dm(e,t){if(e.isTracing===Qv.BREAK){var n=[];Rm(function(e,t){return Xm(_y(e,t))}(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof bm?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function Rm(e,t,n){t.length>=1e3?t.push("(and many more)"):(t.push(""+new Array(n).join("\t")+e.name),e.dependencies&&e.dependencies.forEach((function(e){return Rm(e,t,n+1)})))}var Pm=function(){function e(e,t,n,i){void 0===e&&(e="Reaction@"+av()),void 0===i&&(i=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=i,this.observing=[],this.newObserving=[],this.dependenciesState=Yv.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+av(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Qv.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,_m.pendingReactions.push(this),Bm())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Am(),this._isScheduled=!1,nm(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending}catch(e){this.reportExceptionInDerivation(e)}}Om()}},e.prototype.track=function(e){if(!this.isDisposed){Am(),this._isRunning=!0;var t=rm(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&om(this),tm(t)&&this.reportExceptionInDerivation(t.cause),Om()}},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(_m.disableErrorBoundaries)throw e;_m.suppressReactionErrors,_m.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Am(),om(this),Om()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e[xv]=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=!1;"boolean"==typeof e[e.length-1]&&(n=e.pop());var i=function(e){switch(e.length){case 0:return _m.trackingDerivation;case 1:return _y(e[0]);case 2:return _y(e[0],e[1])}}(e);if(!i)return sv(!1);i.isTracing,Qv.NONE;i.isTracing=n?Qv.BREAK:Qv.LOG}(this,e)},e}(),Im=100,Lm=function(e){return e()};function Bm(){_m.inBatch>0||_m.isRunningReactions||Lm(jm)}function jm(){_m.isRunningReactions=!0;for(var e=_m.pendingReactions,t=0;e.length>0;){++t===Im&&e.splice(0);for(var n=e.splice(0),i=0,r=n.length;i<r;i++)n[i].runReaction()}_m.isRunningReactions=!1}var zm=fv("Reaction",Pm);var Hm=function(e){return e()};function Fm(e,t,n){return Wm("onBecomeUnobserved",e,t)}function Wm(e,t,n,i){var r=_y(t),o=n,a=e+"Listeners";return r[a]?r[a].add(o):r[a]=new Set([o]),"function"!=typeof r[e]?sv(!1):function(){var e=r[a];e&&(e.delete(o),0===e.size&&delete r[a])}}function Gm(e,t,n,i){var r=Um(i=Hv(i));return Pv(e),by(e,i.name,r.enhancer),t&&Vm(e,t,n,r),e}function Um(e){return e.defaultDecorator||(!1===e.deep?Gv:Fv)}function Vm(e,t,n,i){var r,o;Am();try{var a=bv(t);try{for(var s=Mv(a),l=s.next();!l.done;l=s.next()){var u=l.value,d=Object.getOwnPropertyDescriptor(t,u);0;var c=n&&u in n?n[u]:d.get?Zv:i;0;var h=c(e,u,d,!0);h&&Object.defineProperty(e,u,h)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}finally{Om()}}function Xm(e){var t,n,i={name:e.name};return e.observing&&e.observing.length>0&&(i.dependencies=(t=e.observing,n=[],t.forEach((function(e){-1===n.indexOf(e)&&n.push(e)})),n).map(Xm)),i}function qm(e){return 1!==arguments.length&&sv(!1),function(e){return null!=e&&(Ny(e)||!!e[xv]||wv(e)||zm(e)||xm(e))}(e)}function Km(e,t,n){if(2!==arguments.length||my(e))if(Ny(e)){var i=e[xv];i.values.get(t)?i.write(t,n):i.addObservableProp(t,n,i.defaultEnhancer)}else if(fy(e))e.set(t,n);else if(my(e))e.add(t);else{if(!dy(e))return sv(!1);"number"!=typeof t&&(t=parseInt(t,10)),lv(t>=0,"Not a valid index: '"+t+"'"),Am(),t>=e.length&&(e.length=t+1),e[t]=n,Om()}else{Am();var r=t;try{for(var o in r)Km(e,o,r[o])}finally{Om()}}}function Ym(e,t){void 0===t&&(t=void 0),Am();try{return e.apply(t)}finally{Om()}}function Qm(e){return e[xv]}function Zm(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e}var $m={has:function(e,t){if(t===xv||"constructor"===t||t===Ov)return!0;var n=Qm(e);return Zm(t)?n.has(t):t in e},get:function(e,t){if(t===xv||"constructor"===t||t===Ov)return e[t];var n=Qm(e),i=n.values.get(t);if(i instanceof Ev){var r=i.get();return void 0===r&&n.has(t),r}return Zm(t)&&n.has(t),e[t]},set:function(e,t,n){return!!Zm(t)&&(Km(e,t,n),!0)},deleteProperty:function(e,t){return!!Zm(t)&&(Qm(e).remove(t),!0)},ownKeys:function(e){return Qm(e).keysAtom.reportObserved(),Reflect.ownKeys(e)},preventExtensions:function(e){return sv("Dynamic observable objects cannot be frozen"),!1}};function Jm(e){return void 0!==e.interceptors&&e.interceptors.length>0}function ey(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),uv((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ty(e,t){var n=sm();try{for(var i=Av(e.interceptors||[]),r=0,o=i.length;r<o&&(lv(!(t=i[r](t))||t.type,"Intercept handlers should return nothing or a change object"),t);r++);return t}finally{lm(n)}}function ny(e){return void 0!==e.changeListeners&&e.changeListeners.length>0}function iy(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),uv((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ry(e,t){var n=sm(),i=e.changeListeners;if(i){for(var r=0,o=(i=i.slice()).length;r<o;r++)i[r](t);lm(n)}}var oy={get:function(e,t){return t===xv?e[xv]:"length"===t?e[xv].getArrayLength():"number"==typeof t?sy.get.call(e,t):"string"!=typeof t||isNaN(t)?sy.hasOwnProperty(t)?sy[t]:e[t]:sy.get.call(e,parseInt(t))},set:function(e,t,n){return"length"===t&&e[xv].setArrayLength(n),"number"==typeof t&&sy.set.call(e,t,n),"symbol"==typeof t||isNaN(t)?e[t]=n:sy.set.call(e,parseInt(t),n),!0},preventExtensions:function(e){return sv("Observable arrays cannot be frozen"),!1}};var ay=function(){function e(e,t,n){this.owned=n,this.values=[],this.proxy=void 0,this.lastKnownLength=0,this.atom=new Ev(e||"ObservableArray@"+av()),this.enhancer=function(n,i){return t(n,i,e+"[..]")}}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.dehanceValues=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return ey(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.proxy,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),iy(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i<e-t;i++)n[i]=void 0;this.spliceWithArray(t,0,n)}else this.spliceWithArray(e,t-e)},e.prototype.updateArrayLength=function(e,t){if(e!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed.");this.lastKnownLength+=t},e.prototype.spliceWithArray=function(e,t,n){var i=this;im(this.atom);var r=this.values.length;if(void 0===e?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=1===arguments.length?r-e:null==t?0:Math.max(0,Math.min(t,r-e)),void 0===n&&(n=rv),Jm(this)){var o=ty(this,{object:this.proxy,type:"splice",index:e,removedCount:t,added:n});if(!o)return rv;t=o.removedCount,n=o.added}n=0===n.length?n:n.map((function(e){return i.enhancer(e,void 0)}));var a=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,a),this.dehanceValues(a)},e.prototype.spliceItemsIntoValues=function(e,t,n){var i;if(n.length<1e4)return(i=this.values).splice.apply(i,Av([e,t],n));var r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r},e.prototype.notifyArrayChildUpdate=function(e,t,n){var i=!this.owned&&!1,r=ny(this),o=r||i?{object:this.proxy,type:"update",index:e,newValue:t,oldValue:n}:null;this.atom.reportChanged(),r&&ry(this,o)},e.prototype.notifyArraySplice=function(e,t,n){var i=!this.owned&&!1,r=ny(this),o=r||i?{object:this.proxy,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom.reportChanged(),r&&ry(this,o)},e}(),sy={intercept:function(e){return this[xv].intercept(e)},observe:function(e,t){return void 0===t&&(t=!1),this[xv].observe(e,t)},clear:function(){return this.splice(0)},replace:function(e){var t=this[xv];return t.spliceWithArray(0,t.values.length,e)},toJS:function(){return this.slice()},toJSON:function(){return this.toJS()},splice:function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var r=this[xv];switch(arguments.length){case 0:return[];case 1:return r.spliceWithArray(e);case 2:return r.spliceWithArray(e,t)}return r.spliceWithArray(e,t,n)},spliceWithArray:function(e,t,n){return this[xv].spliceWithArray(e,t,n)},push:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this[xv];return n.spliceWithArray(n.values.length,0,e),n.values.length},pop:function(){return this.splice(Math.max(this[xv].values.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this[xv];return n.spliceWithArray(0,0,e),n.values.length},reverse:function(){var e=this.slice();return e.reverse.apply(e,arguments)},sort:function(e){var t=this.slice();return t.sort.apply(t,arguments)},remove:function(e){var t=this[xv],n=t.dehanceValues(t.values).indexOf(e);return n>-1&&(this.splice(n,1),!0)},get:function(e){var t=this[xv];if(t&&e<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[e])},set:function(e,t){var n=this[xv],i=n.values;if(e<i.length){im(n.atom);var r=i[e];if(Jm(n)){var o=ty(n,{type:"update",object:n.proxy,index:e,newValue:t});if(!o)return;t=o.newValue}(t=n.enhancer(t,r))!==r&&(i[e]=t,n.notifyArrayChildUpdate(e,t,r))}else{if(e!==i.length)throw new Error("[mobx.array] Index out of bounds, "+e+" is larger than "+i.length);n.spliceWithArray(e,0,[t])}}};["concat","flat","includes","indexOf","join","lastIndexOf","slice","toString","toLocaleString"].forEach((function(e){"function"==typeof Array.prototype[e]&&(sy[e]=function(){var t=this[xv];t.atom.reportObserved();var n=t.dehanceValues(t.values);return n[e].apply(n,arguments)})})),["every","filter","find","findIndex","flatMap","forEach","map","some"].forEach((function(e){"function"==typeof Array.prototype[e]&&(sy[e]=function(t,n){var i=this,r=this[xv];return r.atom.reportObserved(),r.dehanceValues(r.values)[e]((function(e,r){return t.call(n,e,r,i)}),n)})})),["reduce","reduceRight"].forEach((function(e){sy[e]=function(){var t=this,n=this[xv];n.atom.reportObserved();var i=arguments[0];return arguments[0]=function(e,r,o){return r=n.dehanceValue(r),i(e,r,o,t)},n.values[e].apply(n.values,arguments)}}));var ly,uy=fv("ObservableArrayAdministration",ay);function dy(e){return cv(e)&&uy(e[xv])}var cy,hy={},py=function(){function e(e,t,n){if(void 0===t&&(t=Lv),void 0===n&&(n="ObservableMap@"+av()),this.enhancer=t,this.name=n,this[ly]=hy,this._keysAtom=Cv(this.name+".keys()"),this[Symbol.toStringTag]="Map","function"!=typeof Map)throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");this._data=new Map,this._hasMap=new Map,this.merge(e)}return e.prototype._has=function(e){return this._data.has(e)},e.prototype.has=function(e){var t=this;if(!_m.trackingDerivation)return this._has(e);var n=this._hasMap.get(e);if(!n){var i=n=new ym(this._has(e),Bv,this.name+"."+mv(e)+"?",!1);this._hasMap.set(e,i),Fm(i,(function(){return t._hasMap.delete(e)}))}return n.get()},e.prototype.set=function(e,t){var n=this._has(e);if(Jm(this)){var i=ty(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!i)return this;t=i.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if((im(this._keysAtom),Jm(this))&&!(i=ty(this,{type:"delete",object:this,name:e})))return!1;if(this._has(e)){var n=ny(this),i=n?{type:"delete",object:this,oldValue:this._data.get(e).value,name:e}:null;return Ym((function(){t._keysAtom.reportChanged(),t._updateHasMapEntry(e,!1),t._data.get(e).setNewValue(void 0),t._data.delete(e)})),n&&ry(this,i),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap.get(e);n&&n.setNewValue(t)},e.prototype._updateValue=function(e,t){var n=this._data.get(e);if((t=n.prepareNewValue(t))!==_m.UNCHANGED){var i=!1,r=ny(this),o=r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;i,n.setNewValue(t),r&&ry(this,o)}},e.prototype._addValue=function(e,t){var n=this;im(this._keysAtom),Ym((function(){var i=new ym(t,n.enhancer,n.name+"."+mv(e),!1);n._data.set(e,i),t=i.value,n._updateHasMapEntry(e,!0),n._keysAtom.reportChanged()}));var i=ny(this);i&&ry(this,i?{type:"add",object:this,name:e,newValue:t}:null)},e.prototype.get=function(e){return this.has(e)?this.dehanceValue(this._data.get(e).get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return this._keysAtom.reportObserved(),this._data.keys()},e.prototype.values=function(){var e=this,t=this.keys();return ky({next:function(){var n=t.next(),i=n.done,r=n.value;return{done:i,value:i?void 0:e.get(r)}}})},e.prototype.entries=function(){var e=this,t=this.keys();return ky({next:function(){var n=t.next(),i=n.done,r=n.value;return{done:i,value:i?void 0:[r,e.get(r)]}}})},e.prototype[(ly=xv,Symbol.iterator)]=function(){return this.entries()},e.prototype.forEach=function(e,t){var n,i;try{for(var r=Mv(this),o=r.next();!o.done;o=r.next()){var a=Tv(o.value,2),s=a[0],l=a[1];e.call(t,l,s,this)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}},e.prototype.merge=function(e){var t=this;return fy(e)&&(e=e.toJS()),Ym((function(){var n=vm(!0);try{hv(e)?function(e){var t=new Set;for(var n in e)t.add(n);return Object.getOwnPropertySymbols(e).forEach((function(n){Object.getOwnPropertyDescriptor(e,n).enumerable&&t.add(n)})),Array.from(t)}(e).forEach((function(n){return t.set(n,e[n])})):Array.isArray(e)?e.forEach((function(e){var n=Tv(e,2),i=n[0],r=n[1];return t.set(i,r)})):gv(e)?(e.constructor!==Map&&sv("Cannot initialize from classes that inherit from Map: "+e.constructor.name),e.forEach((function(e,n){return t.set(n,e)}))):null!=e&&sv("Cannot initialize map from "+e)}finally{mm(n)}})),this},e.prototype.clear=function(){var e=this;Ym((function(){am((function(){var t,n;try{for(var i=Mv(e.keys()),r=i.next();!r.done;r=i.next()){var o=r.value;e.delete(o)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}))}))},e.prototype.replace=function(e){var t=this;return Ym((function(){var n,i,r,o,a=function(e){if(gv(e)||fy(e))return e;if(Array.isArray(e))return new Map(e);if(hv(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return sv("Cannot convert to map from '"+e+"'")}(e),s=new Map,l=!1;try{for(var u=Mv(t._data.keys()),d=u.next();!d.done;d=u.next()){var c=d.value;if(!a.has(c))if(t.delete(c))l=!0;else{var h=t._data.get(c);s.set(c,h)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}try{for(var p=Mv(a.entries()),f=p.next();!f.done;f=p.next()){var g=Tv(f.value,2),v=(c=g[0],h=g[1],t._data.has(c));if(t.set(c,h),t._data.has(c)){var m=t._data.get(c);s.set(c,m),v||(l=!0)}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}if(!l)if(t._data.size!==s.size)t._keysAtom.reportChanged();else for(var y=t._data.keys(),b=s.keys(),x=y.next(),E=b.next();!x.done;){if(x.value!==E.value){t._keysAtom.reportChanged();break}x=y.next(),E=b.next()}t._data=s})),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keysAtom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),e.prototype.toPOJO=function(){var e,t,n={};try{for(var i=Mv(this),r=i.next();!r.done;r=i.next()){var o=Tv(r.value,2),a=o[0],s=o[1];n["symbol"==typeof a?a:mv(a)]=s}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},e.prototype.toJS=function(){return new Map(this)},e.prototype.toJSON=function(){return this.toPOJO()},e.prototype.toString=function(){var e=this;return this.name+"[{ "+Array.from(this.keys()).map((function(t){return mv(t)+": "+e.get(t)})).join(", ")+" }]"},e.prototype.observe=function(e,t){return iy(this,e)},e.prototype.intercept=function(e){return ey(this,e)},e}(),fy=fv("ObservableMap",py),gy={},vy=function(){function e(e,t,n){if(void 0===t&&(t=Lv),void 0===n&&(n="ObservableSet@"+av()),this.name=n,this[cy]=gy,this._data=new Set,this._atom=Cv(this.name),this[Symbol.toStringTag]="Set","function"!=typeof Set)throw new Error("mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js");this.enhancer=function(e,i){return t(e,i,n)},e&&this.replace(e)}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.clear=function(){var e=this;Ym((function(){am((function(){var t,n;try{for(var i=Mv(e._data.values()),r=i.next();!r.done;r=i.next()){var o=r.value;e.delete(o)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}))}))},e.prototype.forEach=function(e,t){var n,i;try{for(var r=Mv(this),o=r.next();!o.done;o=r.next()){var a=o.value;e.call(t,a,a,this)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._atom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),e.prototype.add=function(e){var t=this;if((im(this._atom),Jm(this))&&!(i=ty(this,{type:"add",object:this,newValue:e})))return this;if(!this.has(e)){Ym((function(){t._data.add(t.enhancer(e,void 0)),t._atom.reportChanged()}));var n=ny(this),i=n?{type:"add",object:this,newValue:e}:null;n&&ry(this,i)}return this},e.prototype.delete=function(e){var t=this;if(Jm(this)&&!(i=ty(this,{type:"delete",object:this,oldValue:e})))return!1;if(this.has(e)){var n=ny(this),i=n?{type:"delete",object:this,oldValue:e}:null;return Ym((function(){t._atom.reportChanged(),t._data.delete(e)})),n&&ry(this,i),!0}return!1},e.prototype.has=function(e){return this._atom.reportObserved(),this._data.has(this.dehanceValue(e))},e.prototype.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return ky({next:function(){var i=e;return e+=1,i<n.length?{value:[t[i],n[i]],done:!1}:{done:!0}}})},e.prototype.keys=function(){return this.values()},e.prototype.values=function(){this._atom.reportObserved();var e=this,t=0,n=Array.from(this._data.values());return ky({next:function(){return t<n.length?{value:e.dehanceValue(n[t++]),done:!1}:{done:!0}}})},e.prototype.replace=function(e){var t=this;return my(e)&&(e=e.toJS()),Ym((function(){var n=vm(!0);try{Array.isArray(e)||vv(e)?(t.clear(),e.forEach((function(e){return t.add(e)}))):null!=e&&sv("Cannot initialize set from "+e)}finally{mm(n)}})),this},e.prototype.observe=function(e,t){return iy(this,e)},e.prototype.intercept=function(e){return ey(this,e)},e.prototype.toJS=function(){return new Set(this)},e.prototype.toString=function(){return this.name+"[ "+Array.from(this).join(", ")+" ]"},e.prototype[(cy=xv,Symbol.iterator)]=function(){return this.values()},e}(),my=fv("ObservableSet",vy),yy=function(){function e(e,t,n,i){void 0===t&&(t=new Map),this.target=e,this.values=t,this.name=n,this.defaultEnhancer=i,this.keysAtom=new Ev(n+".keys")}return e.prototype.read=function(e){return this.values.get(e).get()},e.prototype.write=function(e,t){var n=this.target,i=this.values.get(e);if(i instanceof bm)i.set(t);else{if(Jm(this)){if(!(a=ty(this,{type:"update",object:this.proxy||n,name:e,newValue:t})))return;t=a.newValue}if((t=i.prepareNewValue(t))!==_m.UNCHANGED){var r=ny(this),o=!1,a=r?{type:"update",object:this.proxy||n,oldValue:i.value,name:e,newValue:t}:null;o,i.setNewValue(t),r&&ry(this,a)}}},e.prototype.has=function(e){var t=this.pendingKeys||(this.pendingKeys=new Map),n=t.get(e);if(n)return n.get();var i=!!this.values.get(e);return n=new ym(i,Bv,this.name+"."+mv(e)+"?",!1),t.set(e,n),n.get()},e.prototype.addObservableProp=function(e,t,n){void 0===n&&(n=this.defaultEnhancer);var i=this.target;if(Jm(this)){var r=ty(this,{object:this.proxy||i,name:e,type:"add",newValue:t});if(!r)return;t=r.newValue}var o=new ym(t,n,this.name+"."+mv(e),!1);this.values.set(e,o),t=o.value,Object.defineProperty(i,e,function(e){return xy[e]||(xy[e]={configurable:!0,enumerable:!0,get:function(){return this[xv].read(e)},set:function(t){this[xv].write(e,t)}})}(e)),this.notifyPropertyAddition(e,t)},e.prototype.addComputedProp=function(e,t,n){var i=this.target;n.name=n.name||this.name+"."+mv(t),this.values.set(t,new bm(n)),(e===i||function(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!n||!1!==n.configurable&&!1!==n.writable}(e,t))&&Object.defineProperty(e,t,function(e){return Ey[e]||(Ey[e]={configurable:_m.computedConfigurable,enumerable:!1,get:function(){return wy(this).read(e)},set:function(t){wy(this).write(e,t)}})}(t))},e.prototype.remove=function(e){if(this.values.has(e)){var t=this.target;if(Jm(this))if(!(s=ty(this,{object:this.proxy||t,name:e,type:"remove"})))return;try{Am();var n=ny(this),i=!1,r=this.values.get(e),o=r&&r.get();if(r&&r.set(void 0),this.keysAtom.reportChanged(),this.values.delete(e),this.pendingKeys){var a=this.pendingKeys.get(e);a&&a.set(!1)}delete this.target[e];var s=n?{type:"remove",object:this.proxy||t,oldValue:o,name:e}:null;i,n&&ry(this,s)}finally{Om()}}},e.prototype.illegalAccess=function(e,t){},e.prototype.observe=function(e,t){return iy(this,e)},e.prototype.intercept=function(e){return ey(this,e)},e.prototype.notifyPropertyAddition=function(e,t){var n=ny(this),i=n?{type:"add",object:this.proxy||this.target,name:e,newValue:t}:null;if(n&&ry(this,i),this.pendingKeys){var r=this.pendingKeys.get(e);r&&r.set(!0)}this.keysAtom.reportChanged()},e.prototype.getKeys=function(){var e,t;this.keysAtom.reportObserved();var n=[];try{for(var i=Mv(this.values),r=i.next();!r.done;r=i.next()){var o=Tv(r.value,2),a=o[0];o[1]instanceof ym&&n.push(a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},e}();function by(e,t,n){if(void 0===t&&(t=""),void 0===n&&(n=Lv),Object.prototype.hasOwnProperty.call(e,xv))return e[xv];hv(e)||(t=(e.constructor.name||"ObservableObject")+"@"+av()),t||(t="ObservableObject@"+av());var i=new yy(e,new Map,mv(t),n);return pv(e,xv,i),i}var xy=Object.create(null),Ey=Object.create(null);function wy(e){var t=e[xv];return t||(Pv(e),e[xv])}var Cy=fv("ObservableObjectAdministration",yy);function Ny(e){return!!cv(e)&&(Pv(e),Cy(e[xv]))}function _y(e,t){if("object"==typeof e&&null!==e){if(dy(e))return void 0!==t&&sv(!1),e[xv].atom;if(my(e))return e[xv];if(fy(e)){var n=e;return void 0===t?n._keysAtom:((i=n._data.get(t)||n._hasMap.get(t))||sv(!1),i)}var i;if(Pv(e),t&&!e[xv]&&e[t],Ny(e))return t?((i=e[xv].values.get(t))||sv(!1),i):sv(!1);if(wv(e)||xm(e)||zm(e))return e}else if("function"==typeof e&&zm(e[xv]))return e[xv];return sv(!1)}var Sy=Object.prototype.toString;function My(e,t,n){return void 0===n&&(n=-1),Ty(e,t,n)}function Ty(e,t,n,i,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var o=typeof e;if("function"!==o&&"object"!==o&&"object"!=typeof t)return!1;var a=Sy.call(e);if(a!==Sy.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++}e=Ay(e),t=Ay(t);var s="[object Array]"===a;if(!s){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!("function"==typeof l&&l instanceof l&&"function"==typeof u&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),r=r||[];for(var d=(i=i||[]).length;d--;)if(i[d]===e)return r[d]===t;if(i.push(e),r.push(t),s){if((d=e.length)!==t.length)return!1;for(;d--;)if(!Ty(e[d],t[d],n-1,i,r))return!1}else{var c=Object.keys(e),h=void 0;if(d=c.length,Object.keys(t).length!==d)return!1;for(;d--;)if(!Oy(t,h=c[d])||!Ty(e[h],t[h],n-1,i,r))return!1}return i.pop(),r.pop(),!0}function Ay(e){return dy(e)?e.slice():gv(e)||fy(e)||vv(e)||my(e)?Array.from(e.entries()):e}function Oy(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ky(e){return e[Symbol.iterator]=Dy,e}function Dy(){return this}if("undefined"==typeof Proxy||"undefined"==typeof Symbol)throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");function Ry(e,t){var n=e.minX,i=e.minY,r=e.maxX,o=e.maxY,a=t.x,s=t.y,l=t.width,u=t.height;return n>=a-l/2&&r<=a+l/2&&i>=s-u/2&&o<=s+u/2}function Py(e,t){var n,i;if(!e.children||0===e.children.size)return null;var r=1/0,o=1/0,a=-1/0,s=-1/0,l=!1;try{for(var u=C(Array.from(e.children)),d=u.next();!d.done;d=u.next()){var c=t(d.value);if(c){l=!0;var h=c.getBounds();r=Math.min(r,h.minX),o=Math.min(o,h.minY),a=Math.max(a,h.maxX),s=Math.max(s,h.maxY)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return l?{minX:r,minY:o,maxX:a,maxY:s}:null}function Iy(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&e.maxX>=t.maxX&&e.maxY>=t.maxY}"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return function(){}},extras:{getDebugName:function(e,t){return(void 0!==t?_y(e,t):Ny(e)||fy(e)||my(e)?function(e){return e||sv("Expecting some object"),wv(e)||xm(e)||zm(e)||fy(e)||my(e)?e:(Pv(e),e[xv]?e[xv]:void sv(!1))}(e):_y(e)).name}},$mobx:xv});var Ly=10,By="0,0,0,0",jy="center";function zy(e){var t=e.x,n=e.y,i=e.width,r=e.height;return{bandLeft:t-i/2,bandTop:n-r/2+Ly,bandWidth:i,bandHeight:r-Ly}}function Hy(e){var t=zy(e),n=t.bandLeft,i=t.bandTop,r=t.bandWidth,o=t.bandHeight,a=e.overflowMode,s=e.fontSize,l=e.pad;return{foX:n,foY:i,foWidth:r,foHeight:"ellipsis"===a?l.top+s+2+l.bottom:o}}function Fy(e){if(null==e||""===e)return{top:0,right:0,bottom:0,left:0};if("number"==typeof e)return{top:t=Math.max(0,e),right:t,bottom:t,left:t};var t,n=String(e).split(/[\s,]+/).filter(Boolean).map((function(e){return parseFloat(e.replace(/px$/i,""))||0}));return 1===n.length?{top:t=n[0],right:t,bottom:t,left:t}:2===n.length?{top:n[0],right:n[1],bottom:n[0],left:n[1]}:3===n.length?{top:n[0],right:n[1],bottom:n[2],left:n[1]}:{top:n[0],right:n[1],bottom:n[2],left:n[3]}}function Wy(e){var t=Fy(e);return"".concat(t.top,"px ").concat(t.right,"px ").concat(t.bottom,"px ").concat(t.left,"px")}var Gy=function(n){function i(e,t){var i=n.call(this,e,t)||this;return i.isGroup=!0,i.isRestrict=!1,i.autoResize=!1,i.collapsible=!0,i.staticTextPosition=!0,i.isCollapsed=!1,i.groupAddable=!1,i.transformWithContainer=!1,i.childrenLastCollapseStateDict=new Map,i.childrenLastCollapseStateDict=new Map,i.initNodeData(e),i.setAttributes(),i}return m(i,n),i.prototype.initNodeData=function(e){var t;n.prototype.initNodeData.call(this,e);var i=null!==(t=e.properties)&&void 0!==t?t:{},r=i.children,o=i.width,a=i.height,s=i.collapsedWidth,l=i.collapsedHeight,u=i.collapsible,d=i.isCollapsed,c=i.zIndex,h=i.isRestrict,p=i.autoResize,f=i.autoToFront,g=i.transformWithContainer;this.children=r?new Set(r):new Set,this.zIndex=null!=c?c:-1e4,this.isCollapsed=null!=d&&d,this.setProperties({isCollapsed:null!=d&&d});var v=null!=o?o: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!=p&&p,this.collapsible=null==u||u,this.autoToFront=null!=f&&f,this.setTextPosition(),this.text.draggable=!1},i.prototype.setAttributes=function(){n.prototype.setAttributes.call(this),this.setTextPosition()},i.prototype.getTextStyle=function(){var e,t,i,r,o,a,s,l=n.prototype.getTextStyle.call(this),u=null!==(r=null!==(i=null===(t=null===(e=this.properties)||void 0===e?void 0:e.textStyle)||void 0===t?void 0:t.wrapPadding)&&void 0!==i?i:l.wrapPadding)&&void 0!==r?r:By,d=Fy(u),c=y(y({textAlign:jy},l),{wrapPadding:Wy(u)}),h=null!==(o=c.overflowMode)&&void 0!==o?o:"default",p=Number(null!==(a=c.fontSize)&&void 0!==a?a:12);return"ellipsis"===h&&(c.textHeight=d.top+p+2+d.bottom),c.textAnchor="left"===(s=c.textAlign)?"start":"right"===s?"end":"middle",c.dominantBaseline="hanging",Fs(c)},i.prototype.setProperties=function(e){n.prototype.setProperties.call(this,e)},i.prototype.getData=function(){var e=this,t=n.prototype.getData.call(this),i=[];return _u(Array.from(this.children),(function(t){var n=e.graphModel.getNodeModelById(t);n&&!n.virtual&&i.push(t)})),t.children=i,t.properties&&(t.properties.children=i,t.properties.isCollapsed=this.isCollapsed),t},i.prototype.getNodesInGroup=function(e){var t=[];return e.isGroup&&_u(Array.from(e.children),(function(e){t.push(e)})),t},i.prototype.getMoveDistance=function(e,t,i){void 0===i&&(i=!1);var r=N(n.prototype.getMoveDistance.call(this,e,t,i),2),o=r[0],a=r[1],s=this.getNodesInGroup(this);return this.graphModel.moveNodes(s,e,t,i),[o,a]},i.prototype.getHistoryData=function(){var e=n.prototype.getHistoryData.call(this);e.children=Array.from(this.children),e.isGroup=!0;var t=this,i=t.x,r=t.y,o=t.collapsedWidth,a=t.collapsedHeight,s=t.expandWidth,l=t.expandHeight;return t.isCollapsed&&(e.x=i+s/2-o/2,e.y=r+l/2-a/2,e.text&&(e.text.x=e.text.x+s/2-o/2,e.text.y=e.text.y+l/2-a/2)),e},i.prototype.toggleCollapse=function(e){var n=this,i=this.graphModel,r=!!e;this.isCollapsed=r,this.setProperties({isCollapsed:r}),i.eventCenter.emit("dynamicGroup:collapse",{collapse:r,nodeModel:this}),r?this.collapse():this.expand();var o=_(_([],N(this.incoming.edges),!1),N(this.outgoing.edges),!1);_u(Array.from(this.children),(function(i){var r,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 d=null===(r=n.childrenLastCollapseStateDict)||void 0===r?void 0:r.get(i);void 0!==d&&d!==s.isCollapsed&&u.toggleCollapse(d)}}if(null===(a=n.childrenLastCollapseStateDict)||void 0===a||a.set(i,!!l),s.visible=!e,s.BaseType===t.ElementType.NODE){var c=s.incoming.edges,h=s.outgoing.edges;o=_(_(_([],N(o),!1),N(c),!1),N(h),!1)}}})),this.collapseEdge(r,o)},i.prototype.getTitleHtmlRect=function(){var e,t,n,i,r,o=this.getTextStyle(),a=Fy(null!==(n=null===(t=null===(e=this.properties)||void 0===e?void 0:e.textStyle)||void 0===t?void 0:t.wrapPadding)&&void 0!==n?n:By),s="ellipsis"===(null!==(i=o.overflowMode)&&void 0!==i?i:"default")?"ellipsis":"autoWrap";return Hy({x:this.x,y:this.y,width:this.width,height:this.height,overflowMode:s,fontSize:Number(null!==(r=o.fontSize)&&void 0!==r?r:12),pad:a})},i.prototype.updateExpandedSize=function(e,t){this.expandWidth=e,this.expandHeight=t,this.setProperties({width:e,height:t})},i.prototype.setTextPosition=function(){var e,t,n,i,r=this,o=r.x,a=r.y,s=r.width,l=r.height,u=r.text;if(u)if(this.isCollapsed)u.x===o&&u.y===a||(this.text=y(y({},u),{x:o,y:a}));else{var d=this.getTextStyle(),c=Fy(null!==(n=null===(t=null===(e=this.properties)||void 0===e?void 0:e.textStyle)||void 0===t?void 0:t.wrapPadding)&&void 0!==n?n:By),h=function(e){var t=e.x,n=e.width,i=e.height,r=e.textAlign,o=e.pad,a=zy({x:t,y:e.y,width:n,height:i}),s=a.bandLeft,l=a.bandTop,u=a.bandWidth,d=s+o.left,c=s+u-o.right,h=l+o.top,p=d+Math.max(0,c-d)/2;return"left"===r?{x:d,y:h}:"right"===r?{x:c,y:h}:{x:p,y:h}}({x:o,y:a,width:s,height:l,textAlign:null!==(i=d.textAlign)&&void 0!==i?i:jy,pad:c}),p=h.x,f=h.y;p===u.x&&f===u.y||(this.text=y(y({},u),{x:p,y:f}))}},i.prototype.collapse=function(){var e=this,t=e.x,n=e.y,i=e.width,r=e.height,o=e.collapsedWidth,a=e.collapsedHeight;this.x=t-i/2+o/2,this.y=n-r/2+a/2,this.expandWidth=i,this.expandHeight=r,this.width=o,this.height=a,this.setTextPosition()},i.prototype.expand=function(){var e=this,t=e.x,n=e.y,i=e.expandWidth,r=e.expandHeight,o=e.collapsedWidth,a=e.collapsedHeight;this.width=i,this.height=r,this.x=t+this.width/2-o/2,this.y=n+this.height/2-a/2,this.setTextPosition()},i.prototype.createVirtualEdge=function(e,t){e.pointsList=void 0;var n=this.graphModel.addEdge(e);n.virtual=!0,n.text.editable=!1,n.isCollapsedEdge=!0;var i=this.graphModel.dynamicGroup;return null==i||i.registerCollapsedVirtualEdge(n.id,this.id,t),n},i.prototype.collapseEdge=function(e,t){var n=this,i=this.graphModel;_u(t,(function(t,r){var o,a=t.getData(),s=a.targetNodeId,l=a.sourceNodeId,u=y(y({},a),{id:"".concat(a.id,"__").concat(r),text:null===(o=a.text)||void 0===o?void 0:o.value});if(t.virtual){var d=i.dynamicGroup;return null==d||d.unregisterCollapsedVirtualEdge(t.id),void i.deleteEdgeById(t.id)}var c=i.dynamicGroup.getGroupByNodeId(s);c||(c=i.getNodeModelById(s));var h=i.dynamicGroup.getGroupByNodeId(l);if(h||(h=i.getNodeModelById(l)),e&&t.visible&&(n.children.has(l)||n.id===l?(u.startPoint=void 0,u.sourceNodeId=n.id,delete u.sourceAnchorId):(u.endPoint=void 0,u.targetNodeId=n.id,delete u.targetAnchorId),c.id===n.id&&h.id===n.id||n.createVirtualEdge(u,t.id),t.visible=!1),!e&&!t.visible){if(!i.getEdgeModelById(t.id))return;c&&c.isGroup&&c.isCollapsed?(u.targetNodeId=c.id,u.endPoint=void 0,delete u.targetAnchorId,n.createVirtualEdge(u,t.id)):h&&h.isGroup&&h.isCollapsed?(u.sourceNodeId=h.id,u.startPoint=void 0,delete u.sourceAnchorId,n.createVirtualEdge(u,t.id)):t.visible=!0}}))},i.prototype.isAllowAppendIn=function(e){return!0},i.prototype.setAllowAppendChild=function(e){this.groupAddable=e},i.prototype.addChild=function(t){this.children.add(t);var n=this.getData();this.graphModel.eventCenter.emit(e.ExtensionEventType.GROUP_ADD_NODE,{data:n,childId:t})},i.prototype.removeChild=function(t){this.children.delete(t);var n=this.getData();this.graphModel.eventCenter.emit(e.ExtensionEventType.GROUP_REMOVE_NODE,{data:n})},i.prototype.toBack=function(){this.zIndex--},i.prototype.isManualEdgeConnectAllowed=function(){var e,t=(null!==(e=this.properties)&&void 0!==e?e:{}).allowEdgeConnect;if(void 0!==t)return t;var n=this.graphModel.dynamicGroup;return!(null==n?void 0:n.disallowEdgeConnectToGroup)},i.prototype.getConnectedTargetRules=function(){var e=this,t=n.prototype.getConnectedTargetRules.call(this);return t.push({message:"分组节点不允许作为边的终点",validate:function(){return e.isManualEdgeConnectAllowed()}}),t},i.prototype.getConnectedSourceRules=function(){var e=this,t=n.prototype.getConnectedSourceRules.call(this);return t.push({message:"分组节点不允许作为边的起点",validate:function(){return e.isManualEdgeConnectAllowed()}}),t},i.prototype.getDefaultAnchor=function(){var e=n.prototype.getDefaultAnchor.call(this);return this.isManualEdgeConnectAllowed()?e:e.map((function(e){return y(y({},e),{edgeAddable:!1})}))},i.prototype.getAnchorStyle=function(){var e=n.prototype.getAnchorStyle.call(this);return e.stroke="transparent",e.fill="transparent",e.hover&&(e.hover.fill="transparent",e.hover.stroke="transparent"),e},i.prototype.getAddableOutlineStyle=function(){var e,t=this.graphModel.dynamicGroup,n=null!==(e=null==t?void 0:t.sensorOutline)&&void 0!==e?e:{},i=n.stroke,r=n.strokeWidth;return{stroke:null!=i?i:Uy.stroke,strokeWidth:null!=r?r:Uy.strokeWidth,strokeDasharray:"4 4",fill:"transparent"}},x([t.observable],i.prototype,"isCollapsed",void 0),x([t.observable],i.prototype,"groupAddable",void 0),x([t.observable],i.prototype,"transformWithContainer",void 0),i}(t.RectNodeModel),Uy={stroke:"#feb663",strokeWidth:2},Vy={defaultWidth:120,defaultHeight:120,titleSize:60,poolMinSize:20},Xy=120,qy=120,Ky=20,Yy=20,Qy=15,Zy=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.titleSize=Vy.titleSize,i.poolConfig=Vy,i.isPool=!0,i._defaultLaneCreated=!1,i}return m(t,e),Object.defineProperty(t.prototype,"isHorizontal",{get:function(){var e;return"horizontal"===(null===(e=this.properties)||void 0===e?void 0:e.direction)},enumerable:!1,configurable:!0}),t.prototype.initNodeData=function(t){var n,i;e.prototype.initNodeData.call(this,t),t.properties&&(this.width=(null===(n=t.properties)||void 0===n?void 0:n.width)||Vy.defaultWidth,this.height=(null===(i=t.properties)||void 0===i?void 0:i.height)||Vy.defaultHeight),this.autoResize=!1,this.isRestrict=!0,this.transformWithContainer=!0,this.resizable=!1,this.rotatable=!1,this.autoToFront=!1,this.text.editable=!0,this.updateTextPosition(),this.addEventListeners(),this.resizePool()},t.prototype.addEventListeners=function(){var e=this;this.graphModel.eventCenter.on("node:resize",(function(t){var n=t.data,i=t.index;if(e.children.has(n.id)){var r=e.graphModel.getNodeModelById(n.id);if(!r||!r.type||"lane"!==r.type)return;var o,a,s=e.getLanes(),l=void 0,u=void 0;if(e.isHorizontal){var d=s.reduce((function(e,t){return e+t.height}),0);l=r.width+Vy.titleSize,u=d}else{var c=s.reduce((function(e,t){return e+t.width}),0);u=r.height+Vy.titleSize,l=c}var h="number"==typeof i?i:2,p=0===h||1===h?-1:1;o=(0===h||3===h?-1:1)*(l-e.width),a=p*(u-e.height),e.width=l,e.height=u,e.move(o/2,a/2)}e.resizeChildren(),e.updateTextPosition()}))},t.prototype.getNodesInGroup=function(e){var t=this,n=[];return e.isGroup&&_u(Array.from(e.children),(function(e){var i=t.graphModel.getNodeModelById(e);i&&!i.isDragging&&n.push(e)})),n},t.prototype.updateTextPosition=function(){this.isHorizontal?(this.text.x=this.x-this.width/2+Vy.titleSize/2,this.text.y=this.y):(this.text.x=this.x,this.text.y=this.y-this.height/2+Vy.titleSize/2)},t.prototype.resizePool=function(){var e=this.getLanes();if(0!==e.length){var t=0,n=0;this.isHorizontal?(_u(e,(function(e){var i=e.width,r=e.height;t=Math.max(t,i),n+=r})),this.width=t+Vy.titleSize,this.height=n):(_u(e,(function(e){var i=e.width,r=e.height;t+=i,n=Math.max(n,r)})),this.width=t,this.height=n+Vy.titleSize),this.updateTextPosition()}},t.prototype.resizeChildrenWithNewLane=function(e,t){var n,i=this,r=this.getLanes();if(e&&t&&!Qd(r)){var o=[],a=r.find((function(e){return e.id===t}));if(o=r.filter((function(e){return e.id!==t})).slice().sort((function(e,t){return i.isHorizontal?e.y-t.y:e.x-t.x})),a){var s=null===(n=a.properties)||void 0===n?void 0:n.referenceLaneId,l=s?o.findIndex((function(e){return e.id===s})):0,u=["above","left"].includes(e)?Math.max(l,0):Math.min(l+1,o.length);o.splice(u,0,a)}if(this.isHorizontal){var d=this.width-Vy.titleSize,c=o.reduce((function(e,t){return e+t.height}),0),h=this.y-c/2;o.forEach((function(e,t){var n=h+e.height/2;e.text=y(y({},e.text),{x:e.x-d/2+Ky/2,y:e.y}),i.moveLane(e,e.x,n),t<o.length-1&&(h+=e.height)})),this.height=c}else{var p=this.height-Vy.titleSize,f=o.reduce((function(e,t){return e+t.width}),0),g=this.x-f/2;o.forEach((function(e,t){var n=g+e.width/2;e.text=y(y({},e.text),{x:e.x,y:e.y-p/2+Ky/2}),i.moveLane(e,n,e.y),t<o.length-1&&(g+=e.width)})),this.width=f}this.updateTextPosition()}},t.prototype.moveLane=function(e,t,n){var i=this,r=[];e.children&&e.children.size>0&&e.children.forEach((function(t){var n=i.graphModel.getNodeModelById(t);n&&!n.isDragging&&"lane"!==String(n.type)&&r.push({id:t,dx:n.x-e.x,dy:n.y-e.y})})),e.moveTo(t,n,!0),r.forEach((function(t){var n=t.id,r=t.dx,o=t.dy,a=i.graphModel.getNodeModelById(n);if(a){var s=a.x,l=a.y,u=e.x+r,d=e.y+o;a.moveTo(u,d);var c=a.incoming.edges,h=a.outgoing.edges;c.forEach((function(e){e.moveEndPoint(u-s,d-l)})),h.forEach((function(e){e.moveStartPoint(u-s,d-l)}))}}))},t.prototype.resizeChildren=function(){var e=this,t=this.getLanes();if(0!==t.length)if(this.isHorizontal){this.height=t.reduce((function(e,t){return e+t.height}),0);var n=t.slice().sort((function(e,t){return e.y-t.y}));t.forEach((function(t){t.width=e.width-Vy.titleSize;var i=n.findIndex((function(e){return e.id===t.id})),r=n.reduce((function(e,n,r){return r<i&&n.id!==t.id?e+n.height:e}),e.y-e.height/2);t.moveTo(e.x-e.width/2+Vy.titleSize+t.width/2,r+t.height/2,!0)}))}else{this.width=t.reduce((function(e,t){return e+t.width}),0);var i=Fs(t).sort((function(e,t){return e.x-t.x}));t.forEach((function(t){t.height=e.height-Vy.titleSize;var n=i.findIndex((function(e){return e.id===t.id})),r=i.reduce((function(e,i,r){return r<n&&i.id!==t.id?e+i.width:e}),e.x-e.width/2);t.moveTo(r+t.width/2,e.y-e.height/2+Vy.titleSize+t.height/2,!0)}))}},t.prototype.getLanes=function(){var e=this,t=[];return Array.from(this.children).forEach((function(n){var i=e.graphModel.getNodeModelById(n);i&&"lane"===String(i.type)&&t.push(i)})),t},t.prototype.addLane=function(e,t){var n,i,r,o,a=this.getLanes();if(0===a.length)return this.createDefaultLane(t);var s=this.x,l=this.y,u=a.find((function(e){return e.id===(null==t?void 0:t.id)})),d=u||a[0],c=null!==(n=null==d?void 0:d.width)&&void 0!==n?n:this.width,h=null!==(i=null==d?void 0:d.height)&&void 0!==i?i:this.height;this.isHorizontal&&["above","below"].includes(e)&&u&&(l="above"===e?u.y-u.height/2-h/2:u.y+u.height/2+h/2,s=u.x),!this.isHorizontal&&["left","right"].includes(e)&&u&&(s="left"===e?u.x-u.width/2-c/2:u.x+u.width/2+c/2,l=u.y);var p=Fs(t);p&&(delete p.id,delete p.children,null===(r=p.properties)||void 0===r||delete r.parent,null===(o=p.properties)||void 0===o||delete o.children);var f=wc(p,{type:"lane",x:s,y:l,width:c,height:h,text:"新泳道",properties:{parent:this.id,position:e,referenceLaneId:null==u?void 0:u.id},zIndex:this.zIndex},this.properties.laneConfig),g=this.graphModel.addNode(f);return this.setZIndex(this.zIndex-1),this.addChild(g.id),this.resizeChildrenWithNewLane(e,g.id),g},t.prototype.setZIndex=function(e){this.zIndex=Math.min(e,-100)},t.prototype.addChildAbove=function(e){return this.addLane("above",e)},t.prototype.addChildBelow=function(e){return this.addLane("below",e)},t.prototype.addChildLeft=function(e){return this.addLane("left",e)},t.prototype.addChildRight=function(e){return this.addLane("right",e)},t.prototype.createDefaultLane=function(e){var t=null;if(this.isHorizontal){var n=this.width-Vy.titleSize,i=this.height;t=this.graphModel.addNode(wc({type:"lane",x:this.x-this.width/2+Vy.titleSize+n/2,y:this.y,width:n,height:i,text:{x:this.x-this.width/2+Vy.titleSize/2,y:this.y,value:"泳道1"},properties:{parent:this.id,isHorizontal:this.isHorizontal},zIndex:this.zIndex},e))}else{n=this.width,i=this.height-Vy.titleSize;t=this.graphModel.addNode(wc({type:"lane",x:this.x,y:this.y-this.height/2+Vy.titleSize+(this.height-Vy.titleSize)/2,width:n,height:i,text:{x:this.x,y:this.y-this.height/2+Vy.titleSize/2,value:"泳道1"},properties:{parent:this.id},zIndex:this.zIndex},e))}return this.setZIndex(this.zIndex-1),this.addChild(t.id),this.resizeChildren(),this.updateTextPosition(),t},t.prototype.deleteChild=function(e){var t=this.getLanes();t.length<=1||t.find((function(t){return t.id===e}))&&(this.removeChild(e),this.graphModel.deleteNode(e),this.resizePool(),this.resizeChildren())},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.strokeWidth=2,t},t.prototype.getTextStyle=function(){var t=e.prototype.getTextStyle.call(this);return t.overflowMode="ellipsis",t.strokeWidth=2,t.textWidth=this.isHorizontal?this.height:this.width,t.textHeight=this.isHorizontal?this.width:this.height,this.isHorizontal&&(t.transform="rotate(-90deg)",t.textAlign="center"),t},t.prototype.getData=function(){var t=e.prototype.getData.call(this);return y(y({},t),{properties:y(y({},t.properties),{width:this.width,height:this.height})})},x([Jv],t.prototype,"isHorizontal",null),t}(Gy),$y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Jy={};!function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=r(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 o in e)t.call(e,o)&&e[o]&&(i=r(i,o));return i}function r(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}({get exports(){return Jy},set exports(e){Jy=e}});var eb=Jy,tb=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.getShape=function(){var t,n=this.props.model,i=n.text.value,r=n.getTextStyle();return function(e){return"autoWrap"===e||"ellipsis"===e}(null!==(t=r.overflowMode)&&void 0!==t?t:"default")?this.renderTitleHtmlText(i,r):e.prototype.getShape.call(this)},t.prototype.renderTitleHtmlText=function(e,t){var n,i=this.props,r=i.model,o=i.graphModel,a=r.text,s=a.editable,l=a.draggable,u=o.editConfigModel,d=t.overflowMode,c=Number(null!==(n=t.fontSize)&&void 0!==n?n:12),h=t.wrapPadding,p=Fy(h),f=Wy(h),g=Hy({x:r.x,y:r.y,width:r.width,height:r.height,overflowMode:d,fontSize:c,pad:p}),v=g.foX,m=g.foY,y=g.foWidth,b=g.foHeight,x="ellipsis"===d,E=String(e).split(/[\r\n]/g),w=u.nodeTextDraggable||l;return Bf("g",{className:eb({"lf-element-text":s,"lf-text-draggable":!s&&w,"lf-text-disabled":!s&&!w}),children:Bf("foreignObject",{width:y,height:b,x:v,y:m,style:{overflow:"visible",textAlign:"left"},children:Bf("div",{className:"lf-node-text-auto-wrap lf-dg-title-html",style:{boxSizing:"border-box",display:"flex",alignItems:"flex-start",justifyContent:"stretch",width:y,height:b,padding:f},children:Bf("div",{className:x?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:x?E.join(""):"",style:{textAlign:t.textAlign,fontSize:c,lineHeight:t.lineHeight,fontFamily:t.fontFamily,color:t.fill,width:"100%"},children:E.map((function(e){return Bf("div",{className:"lf-node-text--auto-wrap-inner",children:e})}))})})})})},t}(t.BaseText);function nb(e,t,n){var i=t.x,r=t.y,o=e.x-i,a=e.y-r;return{x:o*Math.cos(n)-a*Math.sin(n)+i,y:o*Math.sin(n)+a*Math.cos(n)+r}}var ib=function(e){function n(){var n=e.apply(this,_([],N(arguments),!1))||this;return n.childrenPositionMap=new Map,n.onNodeRotate=function(e){var t=e.model,i=n.props,r=i.model,o=i.graphModel,a=r.transformWithContainer,s=r.isRestrict,l=n.childrenPositionMap;if(a&&!s&&t.id===r.id){var u={x:r.x,y:r.y};_u(Array.from(r.children),(function(e){var n=o.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 r=t.rotate*(180/Math.PI);r<0&&(r+=360);var a=r*(Math.PI/180),s=nb(i,u,a);n.moveTo(s.x,s.y),n.rotate=t.rotate}}))}},n.onNodeResize=function(e){var i=e.deltaX,r=e.deltaY,o=e.index,a=e.model,s=e.preData,l=n.props,u=l.model,d=l.graphModel,c=u.transformWithContainer,h=u.isRestrict;if(c&&!h&&a.id===u.id){var p=s.properties||{},f=p.width,g=p.height;_u(Array.from(u.children),(function(e){var n=d.getNodeModelById(e);if(n){var a=n.width/f*i,s=n.height/g*r;t.handleResize({deltaX:a,deltaY:s,index:o,nodeModel:n,graphModel:d,cancelCallback:function(){}})}}))}},n.onNodeMouseMove=function(){},n.graphRendered=function(){var e=n.props.model;e.isCollapsed&&e.toggleCollapse(!0)},n}return m(n,e),n.prototype.componentDidMount=function(){e.prototype.componentDidMount.call(this);var n=this.props.graphModel.eventCenter;n.on(t.EventType.NODE_ROTATE,this.onNodeRotate),n.on(t.EventType.NODE_RESIZE,this.onNodeResize),n.on(t.EventType.NODE_MOUSEMOVE,this.onNodeMouseMove),n.on(t.EventType.GRAPH_RENDERED,this.graphRendered)},n.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this);var n=this.props.graphModel.eventCenter;n.off(t.EventType.NODE_ROTATE,this.onNodeRotate),n.off(t.EventType.NODE_RESIZE,this.onNodeResize),n.off(t.EventType.NODE_MOUSEMOVE,this.onNodeMouseMove),n.off(t.EventType.GRAPH_RENDERED,this.graphRendered)},n.prototype.getNodesInGroup=function(e,t){var n=this,i=[];return e.isGroup&&_u(Array.from(e.children),(function(e){i.push(e);var r=t.getNodeModelById(e);(null==r?void 0:r.isGroup)&&(i=i.concat(n.getNodesInGroup(r,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,r=e.x,o=e.y,a=e.radius;if(!e.groupAddable)return null;var s=e.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=e.getAddableOutlineStyle(),d=n+l+8,c=i+l+8;return t.h("rect",y(y({},u),{width:d,height:c,x:r-d/2,y:o-c/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,r=e.width,o=e.height,a=n-r/2+Ly,s=i-o/2+Ly;if(!e.collapsible)return null;var l=(null==e?void 0:e.isCollapsed)?this.getCollapseIcon(a,s):this.getExpandIcon(a,s),u=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:l});return t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#f4f5f6",stroke:"#cecece",cursor:"pointer",x:a,y:s,onPointerDown:function(e){e.stopPropagation()},onClick:function(t){t.stopPropagation(),e.toggleCollapse(!e.isCollapsed)},onDblClick:function(e){e.stopPropagation()}}),u])},n.prototype.getText=function(){var e,n=this.props,i=n.model,r=n.graphModel,o=r.editConfigModel;if(o.nodeTextMode!==t.TextMode.TEXT)return null;if(i.state===t.ElementState.TEXT_EDIT)return null;var a=null;if(i.text){var s=!1;o.nodeTextDraggable&&i.text.draggable&&(s=!0),a=t.h(tb,{editable:o.nodeTextEdit&&(null===(e=i.text.editable)||void 0===e||e),model:i,graphModel:r,draggable:s})}var l=this.getOperateIcon();return a||l?t.h("g",{},a,l):null},n.prototype.getShape=function(){return t.h("g",{},[this.getAppendAreaShape(),e.prototype.getShape.call(this)])},n}(t.RectNode),rb=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.componentDidMount=function(){var e,t,n,i=this.props,r=i.graphModel,o=i.model,a=r.nodes.findIndex((function(e){return e.id===o.id})),s=r.nodes.filter((function(e){return"pool"===String(e.type)})).length;o.setZIndex(-100*(s-a)),(null===(t=null===(e=o.properties)||void 0===e?void 0:e.children)||void 0===t?void 0:t.length)||o._defaultLaneCreated||o.virtual||(o.createDefaultLane(null===(n=o.properties)||void 0===n?void 0:n.laneConfig),o._defaultLaneCreated=!0)},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.properties,s=a.textStyle,l=void 0===s?{}:s,u=a.style,d=void 0===u?{}:u,c=e.isHorizontal,h=e.getNodeStyle(),p={fill:"#ffffff",stroke:"#000000",strokeWidth:1},f=n-r/2,g=i-o/2,v=y(y(y(y({},p),h),{x:f,y:g,width:c?Vy.titleSize:r,height:c?o:Vy.titleSize}),c&&l),m=y(y(y(y({},p),h),{x:c?f+Vy.titleSize:f,y:c?g:g+Vy.titleSize,width:c?r-Vy.titleSize:r,height:c?o:o-Vy.titleSize}),c&&d);return t.h("g",{},[t.h("rect",v),t.h("rect",m)])},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}(ib),ob={type:"dynamic-group",view:ib,model:Gy},ab=-1e4,sb=function(){function n(t){var n=t.lf,i=t.options,r=this;this.disallowEdgeConnectToGroup=!1,this.cascadeDeleteChildren=!0,this.topGroupZIndex=ab,this.activeGroups=new Set,this.nodeGroupMap=new Map,this.collapsedVirtualEdges=new Map,this.collapsedRealEdgeToGroup=new Map,this.onEdgeDelete=function(e){var t,n,i=e.data,o=r.collapsedVirtualEdges.get(i.id);if(o)return r.collapsedVirtualEdges.delete(i.id),r.collapsedRealEdgeToGroup.delete(o.realEdgeId),void(r.lf.getEdgeModelById(o.realEdgeId)&&r.lf.deleteEdge(o.realEdgeId));r.collapsedRealEdgeToGroup.get(i.id)&&r.collapsedRealEdgeToGroup.delete(i.id);try{for(var a=C(r.collapsedVirtualEdges.entries()),s=a.next();!s.done;s=a.next()){var l=N(s.value,2),u=l[0];l[1].realEdgeId===i.id&&r.collapsedVirtualEdges.delete(u)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}},this.onSelectionDrop=function(){r.clearDragTargetHighlight(),r.lf.graphModel.getSelectElements().nodes.forEach((function(e){r.addNodeToGroup(e)}))},this.onNodeAdd=function(e){var t=e.data;r.syncGroupChildren(t)},this.onNodeDndAdd=function(e){var t=e.data;r.syncGroupChildren(t),r.addNodeToGroup(t),r.clearDragTargetHighlight()},this.onNodeDrop=function(e){var t=e.data;r.clearDragTargetHighlight(),r.addNodeToGroup(t)},this.onNodeMouseUp=function(){r.clearDragTargetHighlight()},this.detachNodeFromGroup=function(e,t){var n=r.lf.getNodeModelById(e);n&&(n.removeChild(t),r.nodeGroupMap.delete(t),n.setAllowAppendChild(!1))},this.releaseGroupMembers=function(e){e.isCollapsed&&e.toggleCollapse(!1),_u(Array.from(e.children),(function(t){r.detachNodeFromGroup(e.id,t)}))},this.removeChildFromOtherGroups=function(e,t){var n=r.nodeGroupMap.get(e);if(n&&n!==t){var i=r.lf.getNodeModelById(n);null==i||i.removeChild(e)}_u(r.lf.graphModel.nodes,(function(n){var i;if(n.isGroup&&n.id!==t){var r=n;(null===(i=r.children)||void 0===i?void 0:i.has(e))&&r.removeChild(e)}}))},this.setNodeGroup=function(e,t){r.removeChildFromOtherGroups(t,e),r.nodeGroupMap.set(t,e)},this.syncGroupChildren=function(e){var t=r.lf.getNodeModelById(e.id);if(null==t?void 0:t.isGroup){var n=t;_u(Array.from(n.children),(function(t){r.setNodeGroup(e.id,t)})),r.calibrateTopGroupZIndex([e]),r.onNodeSelect({data:e,isSelected:!1,isMultiple:!1})}},this.addNodeToGroup=function(t){var n=r.lf.getNodeModelById(t.id),i=null==n?void 0:n.getBounds();if(n&&i){var o=r.nodeGroupMap.get(t.id),a=r.getGroupByBounds(i,t);if(!o||(null==a?void 0:a.id)!==o)if(a)if(o)if(a.isAllowAppendIn(t))r.detachNodeFromGroup(o,t.id),a.addChild(t.id);else{var s=r.lf.getNodeModelById(o);if(s&&Ry(i,s))return;r.detachNodeFromGroup(o,t.id),r.lf.emit(e.ExtensionEventType.GROUP_NOT_ALLOWED,{group:a.getData(),node:t})}else a.isAllowAppendIn(t)?a.addChild(t.id):r.lf.emit(e.ExtensionEventType.GROUP_NOT_ALLOWED,{group:a.getData(),node:t});else o&&r.detachNodeFromGroup(o,t.id)}},this.onGroupAddNode=function(e){var t=e.data,n=e.childId;r.setNodeGroup(t.id,n)},this.removeNodeFromGroup=function(e){var t=e.data,n=e.model;if(n.isGroup&&t.children){var i=n;r.cascadeDeleteChildren?_u(Array.from(i.children),(function(e){r.nodeGroupMap.delete(e),r.lf.deleteNode(e)})):r.releaseGroupMembers(i)}var o=r.nodeGroupMap.get(t.id);if(o){var a=r.lf.getNodeModelById(o);a&&a.removeChild(t.id),r.nodeGroupMap.delete(t.id)}},this.onSelectionDrag=function(){var e,t,n,i,o=r.lf.graphModel.getSelectElements().nodes,a=new Set;o.forEach((function(e){var t=r.getTargetGroupForNode(e);t&&a.add(t)}));try{for(var s=C(r.activeGroups),l=s.next();!l.done;l=s.next()){var u=l.value;a.has(u)||u.setAllowAppendChild(!1)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}try{for(var d=C(a),c=d.next();!c.done;c=d.next()){u=c.value;r.activeGroups.has(u)||u.setAllowAppendChild(!0)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}r.activeGroups=a},this.onNodeDrag=function(e){var t=e.data;r.setActiveGroup(t)},this.setActiveGroup=function(e){var t,n,i,o,a=r.getTargetGroupForNode(e),s=new Set;a&&s.add(a);try{for(var l=C(r.activeGroups),u=l.next();!u.done;u=l.next()){var d=u.value;s.has(d)||d.setAllowAppendChild(!1)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}try{for(var c=C(s),h=c.next();!h.done;h=c.next()){d=h.value;r.activeGroups.has(d)||d.setAllowAppendChild(!0)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}r.activeGroups=s},this.onNodeSelect=function(e){var t=e.data,n=e.isMultiple,i=e.isSelected,o=r.lf.getNodeModelById(t.id);if(r.sendNodeToFront(o),r.topGroupZIndex>-1e3){var a=r.lf.graphModel.nodes;r.topGroupZIndex=ab;var s=ip(Vu(a,(function(e){return!!e.isGroup})),"zIndex"),l=0;_u(s,(function(e){e.zIndex!==l&&(r.topGroupZIndex++,l=e.zIndex),e.setZIndex(r.topGroupZIndex)}))}if(n&&i)if(null==o?void 0:o.isGroup){var u=o.children;_u(Array.from(u),(function(e){var t=r.lf.getNodeModelById(e);null==t||t.setSelected(!1)}))}else{var d=r.nodeGroupMap.get(t.id);if(d){var c=r.lf.getNodeModelById(d);(null==c?void 0:c.isSelected)&&(null==o||o.setSelected(!1))}}},this.onNodeMove=function(e){var t=e.data.id,n=r.nodeGroupMap.get(t);if(n){var i=r.lf.getNodeModelById(n);if(i&&i.isRestrict&&i.autoResize){var o=r.lf.getNodeModelById(t);if(o){var a=o.getBounds(),s=a.minX,l=a.minY,u=a.maxX,d=a.maxY,c=!1,h=i.getBounds(),p=Object.assign({},h);if(s<p.minX&&(p.minX=s,c=!0),l<p.minY&&(p.minY=l,c=!0),u>p.maxX&&(p.maxX=u,c=!0),d>p.maxY&&(p.maxY=d,c=!0),c){var f=p.minX+(p.maxX-p.minX)/2,g=p.minY+(p.maxY-p.minY)/2,v=p.maxX-p.minX,m=p.maxY-p.minY;i.moveTo(f,g),i.width=v,i.height=m,i.updateExpandedSize(v,m),i.setTextPosition()}}}}},this.onNodeResize=function(e){var t=e.model;(null==t?void 0:t.isGroup)&&!t.isCollapsed&&t.setTextPosition()},this.onGraphRendered=function(e){var t=e.data;r.nodeGroupMap.clear(),r.collapsedVirtualEdges.clear(),r.collapsedRealEdgeToGroup.clear(),r.activeGroups.clear(),r.topGroupZIndex=ab,_u(t.nodes,(function(e){e.children&&_u(e.children,(function(t){r.nodeGroupMap.set(t,e.id)}))})),r.calibrateTopGroupZIndex(t.nodes)},n.register(ob),this.lf=n,hr(this,i),this.init()}return n.prototype.getGroupByNodeId=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},n.prototype.registerCollapsedVirtualEdge=function(e,t,n){this.collapsedVirtualEdges.set(e,{groupId:t,realEdgeId:n}),this.collapsedRealEdgeToGroup.set(n,t)},n.prototype.unregisterCollapsedVirtualEdge=function(e){var t=this.collapsedVirtualEdges.get(e);t&&(this.collapsedVirtualEdges.delete(e),this.collapsedRealEdgeToGroup.get(t.realEdgeId)===t.groupId&&this.collapsedRealEdgeToGroup.delete(t.realEdgeId))},n.prototype.getGroupByBounds=function(e,t){var n=Vu(this.lf.graphModel.nodes,(function(n){return!!n.isGroup&&Ry(e,n)&&n.id!==t.id})),i=n.length;if(i<=1)return n[0];for(var r=n[i-1],o=i-2;o>=0;o--)n[o].zIndex>r.zIndex&&(r=n[o]);return r},n.prototype.sendNodeToFront=function(e){var t=this;if(e&&e.isGroup&&(this.topGroupZIndex++,e.setZIndex(this.topGroupZIndex),e.children)){var n=e.children;_u(Array.from(n),(function(e){var n=t.lf.getNodeModelById(e);t.sendNodeToFront(n)}))}},n.prototype.getMaxZIndex=function(e){var t=this,n=ab;if(e.isGroup&&(n=Math.max(n,e.zIndex)),e.children){var i=e.children;_u(Array.from(i),(function(e){var i=t.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var r=t.getMaxZIndex(i);n=Math.max(n,r)}}))}return n},n.prototype.calibrateTopGroupZIndex=function(e){var t=this,n=ab;if(_u(e,(function(e){var i=t.lf.getNodeModelById(e.id);if(i){var r=t.getMaxZIndex(i);r>n&&(n=r)}})),!(this.topGroupZIndex>=n)){var i=Vu(this.lf.graphModel.nodes,(function(e){return!!e.isGroup})),r=this.topGroupZIndex;_u(i,(function(e){e.zIndex>r&&(r=e.zIndex)})),this.topGroupZIndex=r}},n.prototype.clearDragTargetHighlight=function(){var e,t;try{for(var n=C(this.activeGroups),i=n.next();!i.done;i=n.next()){i.value.setAllowAppendChild(!1)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.activeGroups.clear()},n.prototype.getTargetGroupForNode=function(e){var t=this.lf.getNodeModelById(e.id),n=null==t?void 0:t.getBounds();if(t&&n){var i=this.getGroupByBounds(n,e);if(i&&(!t.isGroup||i.id!==e.id)&&i.isAllowAppendIn(e))return i}},n.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},n.prototype.initGroupChildNodes=function(e,n,i,r){var o=this,a=[],s=[],l=[];_u(Array.from(n),(function(n){var u=o.lf.getNodeModelById(n);if(u){var d=u.children,c=u.getData(),h=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",p=t.transformNodeData(o.removeChildrenInGroupNodeData(c),r),f=o.lf.addNode(p,h);if(i.addChild(f.id),e[n]=f.id,a.push(f),l.push.apply(l,_([],N(_(_([],N(f.incoming.edges),!1),N(f.outgoing.edges),!1)),!1)),d instanceof Set){var g=o.initGroupChildNodes(e,d,f,r),v=g.childNodes,m=g.edgesData;a.push.apply(a,_([],N(v),!1)),s.push.apply(s,_([],N(m),!1))}}}));var u=id(Vu(l,(function(t){return bd(e,t.sourceNodeId)&&bd(e,t.targetNodeId)})),(function(e){return e.getData()}));return{childNodes:a,edgesData:s.concat(u)}},n.prototype.createEdge=function(e,n,i){var r,o,a=e.sourceNodeId,s=e.targetNodeId,l=null!==(r=n[a])&&void 0!==r?r:a,u=null!==(o=n[s])&&void 0!==o?o:s,d=Fs(e);return e.id&&"object"==typeof e.text&&null!==e.text&&(d=t.transformEdgeData(e,i)),this.lf.graphModel.addEdge(y(y({},d),{sourceNodeId:l,targetNodeId:u}))},n.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,r){var o=this,a=Py(e,(function(e){return o.lf.getNodeModelById(e)}));if(!a)return!0;var s=e.x+t/2,l=e.y+n/2;return Iy({minX:s-i/2,minY:l-r/2,maxX:s+i/2,maxY:l+r/2},a)},n.prototype.init=function(){var n=this,r=this.lf,o=r.graphModel;o.addNodeMoveRules((function(e,t,i){if(e.isGroup)return!0;var r=n.nodeGroupMap.get(e.id),o=n.lf.getNodeModelById(r);return!o||!o.isRestrict||(!!o.autoResize||function(e,t,n,i){var r=e.minX,o=e.minY,a=e.maxX,s=e.maxY,l=t.x,u=t.y,d=t.width,c=t.height;return{x:l+n>=r+d/2&&l+n<=a-d/2,y:u+i>=o+c/2&&u+i<=s-c/2}}(o.getBounds(),e,t,i))})),o.addNodeResizeRules((function(e,t,i,r,o){return!e.isGroup||n.checkGroupBoundsWithChildren(e,t,i,r,o)})),o.dynamicGroup=this,this.originDeleteNode=r.deleteNode.bind(r),r.deleteNode=function(e){var t=r.getNodeModelById(e);if(!n.cascadeDeleteChildren&&(null==t?void 0:t.isGroup)){var i=t;i.children.size>0&&n.releaseGroupMembers(i)}return n.originDeleteNode(e)},r.on(t.EventType.NODE_ADD,this.onNodeAdd),r.on(t.EventType.NODE_DND_ADD,this.onNodeDndAdd),r.on(t.EventType.NODE_DROP,this.onNodeDrop),r.on(t.EventType.NODE_MOUSEUP,this.onNodeMouseUp),r.on(t.EventType.SELECTION_DROP,this.onSelectionDrop),r.on(t.EventType.NODE_DELETE,this.removeNodeFromGroup),r.on(t.EventType.EDGE_DELETE,this.onEdgeDelete),r.on(i,this.onNodeDrag),r.on(t.EventType.SELECTION_DRAG,this.onSelectionDrag),r.on(t.EventType.NODE_CLICK,this.onNodeSelect),r.on(t.EventType.NODE_MOUSEMOVE,this.onNodeMove),r.on(t.EventType.NODE_RESIZE,this.onNodeResize),r.on(t.EventType.GRAPH_RENDERED,this.onGraphRendered),r.on(e.ExtensionEventType.GROUP_ADD_NODE,this.onGroupAddNode),r.addElements=function(e,t){var i=e.nodes,o=e.edges;void 0===t&&(t=40);var a={},s={nodes:[],edges:[]},l=[];return _u(i,(function(e){var i,o,u=e.id,d=null!==(o=null===(i=e.properties)||void 0===i?void 0:i.children)&&void 0!==o?o:e.children,c=r.addNode(n.removeChildrenInGroupNodeData(e));if(u&&(a[u]=c.id),s.nodes.push(c),c.isGroup){var h=n.initGroupChildNodes(a,d,c,t).edgesData;l.push.apply(l,_([],N(h),!1))}})),_u(l,(function(e){n.createEdge(e,a,t)})),_u(o,(function(e){s.edges.push(n.createEdge(e,a,t))})),s},this.render()},n.prototype.render=function(){},n.prototype.destroy=function(){this.lf.off(t.EventType.NODE_ADD,this.onNodeAdd),this.lf.off(t.EventType.NODE_DND_ADD,this.onNodeDndAdd),this.lf.off(t.EventType.NODE_DROP,this.onNodeDrop),this.lf.off(t.EventType.NODE_MOUSEUP,this.onNodeMouseUp),this.lf.off(t.EventType.SELECTION_DROP,this.onSelectionDrop),this.lf.off(t.EventType.NODE_DELETE,this.removeNodeFromGroup),this.lf.off(t.EventType.EDGE_DELETE,this.onEdgeDelete),this.lf.off(i,this.onNodeDrag),this.lf.off(t.EventType.SELECTION_DRAG,this.onSelectionDrag),this.lf.off(t.EventType.NODE_CLICK,this.onNodeSelect),this.lf.off(t.EventType.NODE_MOUSEMOVE,this.onNodeMove),this.lf.off(t.EventType.NODE_RESIZE,this.onNodeResize),this.lf.off(t.EventType.GRAPH_RENDERED,this.onGraphRendered),this.lf.off(e.ExtensionEventType.GROUP_ADD_NODE,this.onGroupAddNode),this.originDeleteNode&&(this.lf.deleteNode=this.originDeleteNode)},n.pluginName="dynamicGroup",n}(),lb=function(e){function t(){var t=e.apply(this,_([],N(arguments),!1))||this;return t.isLane=!0,t.defaultZIndex=-1,t}return m(t,e),t.prototype.initNodeData=function(t){var n;e.prototype.initNodeData.call(this,t),this.width=t.width||Xy,this.height=t.height||qy,this.draggable=!0,this.resizable=!0,this.rotatable=!1,this.defaultZIndex=t.zIndex||-1,this.setZIndex(this.defaultZIndex),this.autoToFront=!0,this.text.editable=!0,this.style.stroke="#000",this.style.strokeWidth=1,this.properties=y(y({},this.properties),{processRef:"",panels:["processRef"],direction:(null===(n=t.properties)||void 0===n?void 0:n.direction)||"vertical"}),this.collapsedWidth=this.width,this.collapsedHeight=this.height,this.expandWidth=this.width,this.expandHeight=this.height},t.prototype.setAttributes=function(){e.prototype.setAttributes.call(this),this.updateTextPosition()},t.prototype.setZIndex=function(e){this.zIndex=Math.min(e,this.defaultZIndex)||this.defaultZIndex},t.prototype.toggleCollapse=function(){this.isCollapsed=!1,this.setProperties({isCollapsed:!1})},t.prototype.getPoolId=function(){var e=this;try{if(!this.graphModel)return null;var t=this.graphModel.nodes.find((function(t){return t.children&&t.children.has(e.id)}));return(null==t?void 0:t.id)||null}catch(e){return null}},t.prototype.getPoolModel=function(){try{var e=this.getPoolId();return e&&(this.graphModel&&this.graphModel.getNodeModelById(e))||null}catch(e){return null}},t.prototype.changeAttribute=function(e){var t=e.width,n=e.height,i=e.x,r=e.y;t&&(this.width=t),n&&(this.height=n),i&&(this.x=i),r&&(this.y=r)},t.prototype.getData=function(){var t=e.prototype.getData.call(this);return y(y({},t),{properties:y(y({},t.properties),{width:this.width,height:this.height,processRef:this.properties.processRef,direction:this.properties.direction})})},t.prototype.isAllowAppendIn=function(e){return"lane"!==String(e.type)},t.prototype.getNodesInGroup=function(e){var t=this,n=[],i=e.properties.parent;return e.isDragging&&i&&n.push(i),_u(Array.from(e.children),(function(e){var i=t.graphModel.getNodeModelById(e);i&&!i.isDragging&&"lane"!==String(i.type)&&n.push(e)})),n},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.strokeWidth=2,t},t.prototype.getTextStyle=function(){var t=this.properties.isHorizontal,n=void 0!==t&&t,i=e.prototype.getTextStyle.call(this);return i.overflowMode="ellipsis",i.strokeWidth=2,i.textWidth=n?this.height:this.width,i.textHeight=n?this.width:this.height,n&&(i.transform="rotate(-90deg)",i.textAlign="center"),i},t.prototype.getSubNodes=function(){var e=this,t=[];return Array.from(this.children).forEach((function(n){var i=e.graphModel.getNodeModelById(n);i&&t.push(i)})),t},t.prototype.updateTextPosition=function(){this.properties.isHorizontal?(this.text.x=this.x-this.width/2+Ky/2,this.text.y=this.y):(this.text.x=this.x,this.text.y=this.y-this.height/2+Ky/2)},t}(Gy),ub=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getAppendAreaShape=function(){var e=this.props.model,n=e.width,i=e.height,r=e.x,o=e.y,a=e.radius;if(!e.groupAddable)return null;var s=e.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=e.getAddableOutlineStyle(),d=n+l+8,c=i+l+8;return t.h("rect",y(y({},u),{width:d,height:c,x:r-d/2,y:o-c/2,rx:a,ry:a}))},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.properties,s=a.textStyle,l=void 0===s?{}:s,u=a.isHorizontal,d=e.getNodeStyle(),c=n-r/2,h=i-o/2,p=y({x:n-r/2,y:i-o/2,width:r,height:o,stroke:"#000000",strokeWidth:2,fill:"transparent"},d),f=this.getOperateIcons(),g=y(y(y(y({},{fill:"#ffffff",stroke:"#000000",strokeWidth:1}),d),{x:u?c+Ky:c,y:u?h:h+Ky,width:u?r-Ky:r,height:u?o:Ky}),u?l:{});return t.h("g",{},_([this.getAppendAreaShape(),t.h("rect",g),t.h("rect",y({},p))],N(f),!1))},n.prototype.getOperateIcons=function(){var e=this.props.model;if(!e.isSelected)return[];var t=e.getPoolModel();if(!t)return[];var n=t.isHorizontal,i=e.getData();return[this.addBeforeLaneIcon(n,(function(){var e,r;return n?null===(e=t.addChildAbove)||void 0===e?void 0:e.call(t,i):null===(r=t.addChildRight)||void 0===r?void 0:r.call(t,i)})),this.addAfterLaneIcon(n,(function(){var e,r;return n?null===(e=t.addChildBelow)||void 0===e?void 0:e.call(t,i):null===(r=t.addChildLeft)||void 0===r?void 0:r.call(t,i)})),this.deleteLaneIcon((function(){var e;return null===(e=t.deleteChild)||void 0===e?void 0:e.call(t,i.id)}))]},n.prototype.addBeforeLaneIcon=function(e,n){var i=this.props.model,r=i.x,o=i.y,a=i.width,s=i.height,l=r+a/2+Qy,u=o-s/2,d={width:Yy/2,height:Yy,strokeWidth:1,fill:"#fff",stroke:"#000",x:l,y:u},c=[t.h("rect",y(y({},d),{x:l+Yy/2,strokeDasharray:"2 2"})),t.h("rect",d)];return e&&(c=[t.h("rect",y(y({},d),{width:Yy,height:Yy/2,strokeDasharray:"2 2"})),t.h("rect",y(y({},d),{width:Yy,height:Yy/2,y:u+Yy/2}))]),t.h("g",{cursor:"pointer",onClick:n},c)},n.prototype.addAfterLaneIcon=function(e,n){var i=this.props.model,r=i.x,o=i.y,a=i.width,s=i.height,l=r+a/2+Qy,u=o-s/2+Yy+Qy,d={width:Yy/2,height:Yy,strokeWidth:1,fill:"#fff",stroke:"#000",x:l,y:u},c=[t.h("rect",y(y({},d),{x:l+Yy/2})),t.h("rect",y(y({},d),{strokeDasharray:"2 2"}))];return e&&(c=[t.h("rect",y(y({},d),{width:Yy,height:Yy/2})),t.h("rect",y(y({},d),{width:Yy,height:Yy/2,y:u+Yy/2,strokeDasharray:"2 2"}))]),t.h("g",{cursor:"pointer",onClick:n},c)},n.prototype.deleteLaneIcon=function(e){var n=this.props.model,i=n.x,r=n.y,o=n.width,a=n.height,s=i+o/2+Qy,l=r-a/2+3*(Yy+Qy);return t.h("g",{cursor:"pointer",onClick:e,width:Yy,height:Yy,transform:"translate(".concat(s,", ").concat(l,")")},[t.h("rect",{width:Yy,height:Yy,fill:"transparent"}),t.h("path",{transform:"translate(2, 1) scale(".concat(Yy/18,")"),fill:"#000",d:"M1.6361705,0.07275847000000002L1.6362224,0.07267305000000002L5.1435161,2.2034403L6.3516493,1.28341734Q7.2009554,0.63665058,8.0902505,1.22722644L10.1215935,2.5762291Q11.006711,3.1640306,10.745867,4.1940317L10.4062386,5.5351257L13.625054,7.5778356L13.625001,7.5779204Q13.678322,7.6117587,13.721552,7.6577945Q13.764784,7.7038307,13.795207,7.7591715Q13.82563,7.8145118,13.841336,7.87568Q13.857041,7.9368477,13.857041,8Q13.85704,8.0492353,13.847435,8.0975251Q13.83783,8.145814900000001,13.818987,8.191302799999999Q13.800144,8.2367907,13.772791,8.2777286Q13.745438,8.318666499999999,13.710623,8.3534818Q13.675808,8.3882966,13.63487,8.4156504Q13.593931,8.4430046,13.548444,8.461846399999999Q13.502956,8.4806881,13.454666,8.4902935Q13.406377,8.4998994,13.357141,8.499899899999999Q13.211908,8.499899899999999,13.089283,8.4220805L13.08923,8.4221654L4.9074116,3.229857L1.1170242400000001,0.92732695L1.1170761599999999,0.92724147Q1.06204063,0.8938076500000001,1.0172748,0.84751782Q0.97250897,0.80122799,0.9409355500000001,0.74510445Q0.9093622,0.68898091,0.89304277,0.626688Q0.87672335,0.564395107,0.87672332,0.5Q0.8767232899999999,0.450764146,0.88632876,0.402474351Q0.8959341599999999,0.35418455,0.91477591,0.30869657Q0.93361765,0.26320857,0.9609716500000001,0.22227046Q0.9883256,0.18133234999999998,1.02314061,0.14651734Q1.05795562,0.11170232000000002,1.0988937,0.08434838Q1.13983184,0.056994409999999995,1.18531984,0.038152660000000005Q1.2308077800000001,0.019310890000000025,1.27909762,0.009705450000000004Q1.32738745,0.00010001999999997846,1.3766233300000001,0.00009998999999999425Q1.516567,0.00009998999999999425,1.6361705,0.07275847000000002ZM9.5175018,4.9711194L9.7764683,3.9485345Q9.8634167,3.6052005,9.5683784,3.4092672L7.537035,2.0602646Q7.240603,1.8634058,6.9575009,2.0789949L6.0496349,2.7703574L9.5175018,4.9711194ZM11.227273,14.5L11.227273,9.7307692L11.227173,9.7307692Q11.227173,9.6815329,11.217567,9.6332426Q11.207962,9.5849533,11.189119,9.539465Q11.170278,9.4939766,11.142924,9.4530392Q11.11557,9.4121017,11.080755,9.3772869Q11.04594,9.3424721,11.005002,9.3151178Q10.964064,9.2877636,10.918575,9.2689209Q10.873087,9.2500801,10.824797,9.2404747Q10.776508,9.2308693,10.727273,9.2308693Q10.678036,9.2308693,10.629745,9.2404747Q10.581455,9.2500801,10.535968,9.2689209Q10.4904804,9.2877636,10.449542,9.3151178Q10.4086046,9.3424721,10.3737898,9.377286Q10.338975,9.4121008,10.3116207,9.4530382Q10.2842674,9.4939766,10.2654257,9.539465Q10.2465839,9.5849533,10.2369785,9.6332426Q10.2273731,9.6815329,10.2273731,9.7307692L10.2272739,9.7307692L10.2272739,14.5Q10.2272739,15,9.727273,15L7.7207794,15L7.7207789,8.2500091L7.7206788,8.2500091Q7.7206783,8.2007728,7.7110729,8.152483Q7.7014675,8.104193200000001,7.6826253,8.0587053Q7.6637836,8.013217000000001,7.6364298,7.9722791Q7.6090755,7.9313412,7.5742612,7.8965263Q7.5394459,7.861711,7.4985075,7.8343568Q7.4575696,7.807003,7.4120817,7.7881613Q7.3665934,7.7693195,7.3183041,7.7597141Q7.2700143,7.7501092,7.2207789,7.7501092Q7.1715426,7.7501092,7.1232524,7.7597141Q7.0749626,7.7693195,7.0294747,7.7881613Q6.9839869,7.807003,6.943049,7.8343573Q6.9021111,7.861711,6.8672962,7.8965263Q6.8324809,7.9313412,6.8051271,7.9722791Q6.7777729,8.013217000000001,6.7589312,8.0587053Q6.7400894,8.1041937,6.7304845,8.1524839Q6.7208786,8.2007732,6.7208791,8.2500095L6.7207789,8.2500091L6.7207794,15L4.2142854,15L4.2142854,6.2692308L4.2141855,6.2692308Q4.2141852,6.2199945,4.204579799999999,6.1717048Q4.1949743999999995,6.123415,4.1761324,6.0779266Q4.1572905,6.0324383,4.1299367,5.9915004Q4.1025827,5.9505625,4.0677679,5.9157476Q4.0329528,5.8809328,3.9920146,5.8535786Q3.9510765,5.8262248,3.9055884,5.8073831Q3.8601003,5.7885418,3.811811,5.7789364Q3.7635212,5.769331,3.7142854,5.769331Q3.6650493,5.769331,3.6167595,5.7789364Q3.5684695,5.7885418,3.5229816,5.8073831Q3.4774938,5.8262248,3.4365554,5.8535786Q3.3956175,5.8809328,3.3608027,5.9157476Q3.3259873,5.9505625,3.2986333,5.9915004Q3.2712793,6.0324383,3.2524376,6.0779266Q3.2335958,6.123415,3.2239904,6.1717048Q3.214385,6.2199945,3.2143853,6.2692308L3.2142854,6.2692308L3.2142854,15L1.5000002,15Q1.0000001200000002,15,1.0000001200000002,14.5L1,5.4150848Q1,5.0384622,1.3766233300000001,5.0384622L1.3766233300000001,5.0383615Q1.42585915,5.0383615,1.47414887,5.0287557Q1.5224386,5.0191503,1.5679266,5.0003085Q1.6134146,4.9814663,1.6543528,4.954113Q1.695291,4.9267588,1.730106,4.8919439Q1.7649209,4.8571291,1.792275,4.8161907Q1.8196288,4.7752523,1.8384706,4.7297645Q1.8573124,4.6842766,1.8669178,4.6359868Q1.8765233,4.587697,1.8765234,4.5384617Q1.8765233,4.4892254000000005,1.8669178,4.4409355999999995Q1.8573124,4.3926458,1.8384707,4.3471577Q1.819629,4.3016696,1.792275,4.2607315Q1.7649209,4.2197936,1.730106,4.1849787Q1.695291,4.1501637,1.6543529,4.1228096Q1.6134148,4.0954556,1.5679268,4.0766139Q1.5224388,4.0577724,1.4741489300000001,4.048166999999999Q1.42585915,4.0385615999999995,1.3766233300000001,4.0385615999999995L1.3766233300000001,4.0384617Q0.8064074800000001,4.0384617,0.403203636,4.4416654Q0,4.8448691,0,5.4150848L9.000000000813912e-8,14.5Q2.9999999984209325e-8,15.121321,0.439339694,15.56066Q0.8786805,16.000002000000002,1.5000002,16.000002000000002L9.727273,16.000002000000002Q10.3485928,16.000002000000002,10.787933,15.56066Q11.227273,15.121321,11.227273,14.5Z"})])},n}(ib);var db,cb={type:"pool",view:rb,model:Zy},hb={type:"lane",view:ub,model:lb},pb=function(){function n(e){var t=e.lf,n=e.options,i=this;this.nodeLaneMap=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.nodeLaneMap.get(e.id);t&&((a=i.lf.getNodeModelById(t)).removeChild(e.id),i.nodeLaneMap.delete(e.id),a.setAllowAppendChild(!1));var n=i.lf.getNodeModelById(e.id),r=null==n?void 0:n.getBounds();if(n&&r){if(n.isGroup){var o=n;_u(Array.from(o.children),(function(t){i.nodeLaneMap.set(t,e.id)}))}var a;if(a=i.getLaneByBounds(r,e))if(a.isAllowAppendIn(e)){a.addChild(e.id),a.setAllowAppendChild(!1);var s=i.lf.getNodeModelById(e.id);null==s||s.setProperties(y(y({},s.properties),{parent:a.id}))}else i.lf.emit("lane:not-allowed",{lane:a.getData(),node:e})}},this.onGroupAddNode=function(e){var t=e.data,n=e.childId;i.nodeLaneMap.set(n,t.id)},this.removeNodeFromGroup=function(e){var t=e.data;e.model.isGroup&&t.children&&_u(Array.from(t.children),(function(e){i.nodeLaneMap.delete(e),i.lf.deleteNode(e)}));var n=i.nodeLaneMap.get(t.id);if(n){var r=i.lf.getNodeModelById(n);r&&r.removeChild(t.id),i.nodeLaneMap.delete(t.id);var o=i.lf.getNodeModelById(t.id),a=y(y({},null==o?void 0:o.properties),{parent:void 0,relativeDistanceX:void 0,relativeDistanceY:void 0});null==o||o.setProperties(a)}},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,n=i.lf.getNodeModelById(e.id),r=null==n?void 0:n.getBounds();if(n&&r){var o=i.getLaneByBounds(r,e);if(i.activeGroup&&i.activeGroup.setAllowAppendChild(!1),!o||n.isGroup&&o.id===e.id)return;if(!o.isAllowAppendIn(e))return;i.activeGroup=o,null===(t=i.activeGroup)||void 0===t||t.setAllowAppendChild(!0)}},this.onNodeSelect=function(e){var t=e.data,n=e.isMultiple,r=e.isSelected,o=i.lf.getNodeModelById(t.id);if(n&&r)if(null==o?void 0:o.isGroup){var a=o.children;_u(Array.from(a),(function(e){var t=i.lf.getNodeModelById(e);null==t||t.setSelected(!1)}))}else{var s=i.nodeLaneMap.get(t.id);if(s){var l=i.lf.getNodeModelById(s);(null==l?void 0:l.isSelected)&&(null==o||o.setSelected(!1))}}},this.onNodeMove=function(e){var t=e.data.id,n=i.nodeLaneMap.get(t);if(n){var r=i.lf.getNodeModelById(n);if(r&&r.isRestrict&&r.autoResize){var o=i.lf.getNodeModelById(t);if(o){var a=o.getBounds(),s=a.minX,l=a.minY,u=a.maxX,d=a.maxY,c=!1,h=r.getBounds(),p=Object.assign({},h);if(s<p.minX&&(p.minX=s,c=!0),l<p.minY&&(p.minY=l,c=!0),u>p.maxX&&(p.maxX=u,c=!0),d>p.maxY&&(p.maxY=d,c=!0),c){var f=p.minX+(p.maxX-p.minX)/2,g=p.minY+(p.maxY-p.minY)/2,v=p.maxX-p.minX,m=p.maxY-p.minY;r.moveTo(f,g),r.width=v,r.height=m,r.updateExpandedSize(v,m)}}}}},this.onGraphRendered=function(e){_u(e.data.nodes,(function(e){e.children&&_u(e.children,(function(t){i.nodeLaneMap.set(t,e.id)}))}))},t.register(cb),t.register(hb),this.lf=t,hr(this,n),this.init()}return n.prototype.getLaneByNodeId=function(e){var t=this.nodeLaneMap.get(e);if(t)return this.lf.getNodeModelById(t)},n.prototype.getLaneByBounds=function(e,t){var n=Vu(this.lf.graphModel.nodes,(function(n){return!!n.isGroup&&function(e,t){var n=e.minX,i=e.minY,r=e.maxX,o=e.maxY,a=t.x,s=t.y,l=t.width,u=t.height;return n>=a-l/2&&r<=a+l/2&&i>=s-u/2&&o<=s+u/2}(e,n)&&n.id!==t.id})),i=n.length;if(i<=1)return n[0];for(var r=n[i-1],o=i-2;o>=0;o--)n[o].zIndex>r.zIndex&&(r=n[o]);return r},n.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},n.prototype.initGroupChildNodes=function(e,n,i,r){var o=this,a=[],s=[],l=[];_u(Array.from(n),(function(n){var u=o.lf.getNodeModelById(n);if(u){var d=u.children,c=u.getData(),h=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",p=t.transformNodeData(o.removeChildrenInGroupNodeData(c),r),f=o.lf.addNode(p,h);if(i.addChild(f.id),e[n]=f.id,a.push(f),l.push.apply(l,_([],N(_(_([],N(f.incoming.edges),!1),N(f.outgoing.edges),!1)),!1)),d instanceof Set){var g=o.initGroupChildNodes(e,d,f,r),v=g.childNodes,m=g.edgesData;a.push.apply(a,_([],N(v),!1)),s.push.apply(s,_([],N(m),!1))}}}));var u=id(Vu(l,(function(t){return bd(e,t.sourceNodeId)&&bd(e,t.targetNodeId)})),(function(e){return e.getData()}));return{childNodes:a,edgesData:s.concat(u)}},n.prototype.createEdge=function(e,n,i){var r,o,a=e.sourceNodeId,s=e.targetNodeId,l=null!==(r=n[a])&&void 0!==r?r:a,u=null!==(o=n[s])&&void 0!==o?o:s,d=Fs(e);return e.id&&"object"==typeof e.text&&null!==e.text&&(d=t.transformEdgeData(e,i)),this.lf.graphModel.addEdge(y(y({},d),{sourceNodeId:l,targetNodeId:u}))},n.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,r){var o=this,a=Py(e,(function(e){return o.lf.getNodeModelById(e)}));if(!a)return!0;var s=e.x+t/2,l=e.y+n/2;return Iy({minX:s-i/2,minY:l-r/2,maxX:s+i/2,maxY:l+r/2},a)},n.prototype.init=function(){var n=this,o=this.lf,a=o.graphModel;a.addNodeMoveRules((function(e,t,i){if(e.isGroup)return!0;var r=n.nodeLaneMap.get(e.id),o=n.lf.getNodeModelById(r);return!o||!o.isRestrict||(!!o.autoResize||function(e,t,n,i){var r=e.minX,o=e.minY,a=e.maxX,s=e.maxY,l=t.x,u=t.y,d=t.width,c=t.height;return{x:l+n>=r+d/2&&l+n<=a-d/2,y:u+i>=o+c/2&&u+i<=s-c/2}}(o.getBounds(),e,t,i))})),a.addNodeResizeRules((function(e,t,i,r,o){return!e.isGroup||n.checkGroupBoundsWithChildren(e,t,i,r,o)})),a.dynamicGroup=this,o.on(r,this.onNodeAddOrDrop),o.on(t.EventType.SELECTION_DROP,this.onSelectionDrop),o.on(t.EventType.NODE_DELETE,this.removeNodeFromGroup),o.on(i,this.onNodeDrag),o.on(t.EventType.SELECTION_DRAG,this.onSelectionDrag),o.on(t.EventType.NODE_CLICK,this.onNodeSelect),o.on(t.EventType.NODE_MOUSEMOVE,this.onNodeMove),o.on(t.EventType.GRAPH_RENDERED,this.onGraphRendered),o.on(e.ExtensionEventType.GROUP_ADD_NODE,this.onGroupAddNode),o.addElements=function(e,t){var i=e.nodes,r=e.edges;void 0===t&&(t=40);var a={},s={nodes:[],edges:[]},l=[];return _u(i,(function(e){var i,r,u=e.id,d=null!==(r=null===(i=e.properties)||void 0===i?void 0:i.children)&&void 0!==r?r:e.children,c=o.addNode(n.removeChildrenInGroupNodeData(e));if(u&&(a[u]=c.id),s.nodes.push(c),c.isGroup){var h=n.initGroupChildNodes(a,d,c,t).edgesData;l.push.apply(l,_([],N(h),!1))}})),_u(l,(function(e){n.createEdge(e,a,t)})),_u(r,(function(e){s.edges.push(n.createEdge(e,a,t))})),s},this.render()},n.prototype.render=function(){},n.prototype.destroy=function(){this.lf.off(r,this.onNodeAddOrDrop),this.lf.off(t.EventType.SELECTION_DROP,this.onSelectionDrop),this.lf.off(t.EventType.NODE_DELETE,this.removeNodeFromGroup),this.lf.off(i,this.onNodeDrag),this.lf.off(t.EventType.SELECTION_DRAG,this.onSelectionDrag),this.lf.off(t.EventType.NODE_CLICK,this.onNodeSelect),this.lf.off(t.EventType.NODE_MOUSEMOVE,this.onNodeMove),this.lf.off(t.EventType.GRAPH_RENDERED,this.onGraphRendered),this.lf.off(e.ExtensionEventType.GROUP_ADD_NODE,this.onGroupAddNode)},n.pluginName="PoolElements",n}();!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(db||(db={}));var fb=function(e,t,n,i){return void 0===i&&(i=0),mb(e,t,n)<=i};function gb(e){return e*e}function vb(e,t){return gb(e.x-t.x)+gb(e.y-t.y)}var mb=function(e,t,n){return Math.sqrt(function(e,t,n){var i=vb(t,n);if(0===i)return vb(e,t);var r=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/i;return r=Math.max(0,Math.min(1,r)),vb(e,{x:t.x+r*(n.x-t.x),y:t.y+r*(n.y-t.y)})}(e,t,n))},yb=function(e,t,n){var i=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return{minX:t-i/2,minY:n-r/2,maxX:t+i/2,maxY:n+r/2,x:t,y:n,width:i,height:r,centerX:t,centerY:n}}(e),r=function(e,t){var n;return e.x===t.x?n=db.VERTICAL:e.y===t.y&&(n=db.HORIZONTAL),n}(t,n),o=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,d=e.y,c=e.width,h=e.height;if(r===db.HORIZONTAL){if(o>=i.maxX&&a<=i.minX)return{startCrossPoint:{x:t.x>n.x?u+c/2:u-c/2,y:t.y},endCrossPoint:{x:t.x>n.x?u-c/2:u+c/2,y:t.y}}}else if(r===db.VERTICAL&&s>=i.maxY&&l<=i.minY)return{startCrossPoint:{x:t.x,y:t.y>n.y?d+h/2:d-h/2},endCrossPoint:{x:t.x,y:t.y>n.y?d-h/2:d+h/2}}},bb=function(e,t,n){void 0===n&&(n=0);for(var i=e.x,r=e.y,o=t.pointsList,a=0;a<o.length-1;a++)if(fb({x:i,y:r},o[a],o[a+1],n)){var s=yb(e,o[a],o[a+1]);if(s)return{crossIndex:a+1,crossPoints:s}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},xb=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,r=n.id,o=!0,a=0;a<i.length;a++)if(i[a].sourceNodeId===r||i[a].targetNodeId===r){o=!1;break}o&&e.insetNode(n)}))},e.prototype.checkRuleBeforeInsetNode=function(e,n,i,r,o){var a=this._lf.getNodeModelById(e),s=this._lf.getNodeModelById(n),l=a.getAnchorInfo(i),u=s.getAnchorInfo(r),d=a.isAllowConnectedAsSource(o,l,u),c=s.isAllowConnectedAsTarget(o,l,u),h=t.formatAnchorConnectValidateData(d),p=h.isAllPass,f=h.msg,g=t.formatAnchorConnectValidateData(c),v=g.isAllPass;return{isPass:p&&v,sourceMsg:f,targetMsg:g.msg}},e.prototype.insetNode=function(e){var n=this,i=this._lf.graphModel.edges,r=this._lf.getNodeModelById(e.id),o=null==r?void 0:r.getDefaultAnchor();if(!o||0===o.length)this._lf.graphModel.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:e,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(r)for(var a=0;a<i.length;a++){var s=bb(r,i[a],this.deviation),l=s.crossIndex,u=s.crossPoints;if(l>=0){var d=i[a],c=d.sourceNodeId,h=d.targetNodeId,p=d.id,f=d.type,g=d.pointsList,v=d.sourceAnchorId,m=d.targetAnchorId,y=Fs(g[0]);this._lf.deleteEdge(p);var b=this.checkRuleBeforeInsetNode(c,h,v,m,e),x=t.getClosestAnchor(u.startCrossPoint,r).anchor;this._lf.addEdge({type:f,sourceNodeId:c,targetNodeId:e.id,startPoint:y,endPoint:x});var E=t.getClosestAnchor(u.endCrossPoint,r).anchor;if(this._lf.addEdge({type:f,sourceNodeId:e.id,targetNodeId:h,startPoint:Fs(E),endPoint:Fs(g[g.length-1])}),b.isPass)break;this._lf.graphModel.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:e,msg:b.targetMsg||b.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},e.pluginName="insertNodeInPolyline",e}(),Eb=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,r=n.label,o=n.graphModel.editConfigModel.nodeTextDraggable;!(null!==(t=r.draggable)&&void 0!==t?t:o)||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 r=i.props,o=r.label,a=r.graphModel,s=N(a.transformModel.fixDeltaXY(t,n),2),l=s[0],u=s[1];i.setElementModelLabelInfo({x:o.x+l,y:o.y+u}),a.eventCenter.emit("label:drag",{data:o.getData(),model:o})},i.handleDragEnd=function(){i.setState({isDragging:!1})},i.handleClick=function(e){var t=i.props,n=t.label,r=t.element,o=t.graphModel;r.setSelected(!i.state.isSelected),i.setState({isSelected:!i.state.isSelected}),i.setElementModelLabelInfo({isSelected:!0}),o.eventCenter.emit("label:click",{data:n.getData(),e:e,model:r})},i.handleDbClick=function(e){var n=i.props,r=n.label,o=n.element;if(n.graphModel.eventCenter.emit("label:dblclick",{data:r.getData(),e:e,model:o}),r.editable){if(o.setSelected(),o.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 o.setSelected(!0)},i.handleBlur=function(e){var t=i.props,n=t.label,r=t.element;t.graphModel.eventCenter.emit("label:blur",{e:e,model:r,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 r=n.label,o=n.graphModel,a=o.gridSize,s=o.eventCenter;return i.stepDrag=new t.StepDrag({onDragging:i.handleDragging,onDragEnd:i.handleDragEnd,step:a,eventType:"LABEL",model:r,eventCenter:s}),i.state={isEditing:!1,isHovered:!1,isDragging:!1,isSelected:!1},i}return m(n,e),n.prototype.setElementModelLabelInfo=function(e){var t=this.props,n=t.label,i=t.element,r=t.graphModel,o=i.properties._label,a=Ku(o,(function(e){return e.id===n.id})),s=o[a];o[a]=y(y({},s),e);var l=r.getElement(i.id);null==l||l.setProperty("_label",o)},n.prototype.componentDidMount=function(){var e=this,n=this.props,i=n.label,r=n.element;n.graphModel.eventCenter.on("blank:click,node:click,edge:click,label:click",(function(n){var o,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 d=null!==(a=null===(o=e.textRef.current)||void 0===o?void 0:o.innerText)&&void 0!==a?a:"",c=null!==(l=null===(s=e.textRef.current)||void 0===s?void 0:s.innerHTML)&&void 0!==l?l:"";e.setElementModelLabelInfo({value:d,content:c,isSelected:!1}),r.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,r=t.graphModel,o=this.state,a=o.isDragging,s=o.isHovered,l=o.isSelected,u=o.isEditing,d=r.transformModel.getTransformStyle().transform,c=n.id,h=n.x,p=n.y,f=n.zIndex,g=n.vertical,v=n.style,m=n.rotate,b=n.content,x=n.labelWidth,E=n.textOverflowMode,w=null!=x?x:"node"===i.BaseType?i.width-20:80,C={left:"".concat(h-w/2,"px"),top:"".concat(p-10,"px"),width:"".concat(w,"px"),height:"20px",zIndex:null!=f?f:1,transform:m?"".concat(d," rotate(").concat(m,"deg)"):"".concat(d," rotate(").concat(g?-.25:0,"turn)")};return Bf("div",{id:"element-container-".concat(c),className:eb("lf-label-editor-container"),style:C,onPointerDown:this.handleMouseDown,onPointerUp:this.handleMouseUp,onClick:this.handleClick,onDblClick:this.handleDbClick,onBlur:this.handleBlur,onMouseEnter:this.setHoverOn,onMouseOver:this.setHoverOn,onMouseLeave:this.setHoverOff,children:Bf("div",{ref:this.textRef,id:"editor-container-".concat(c),className:eb("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(E)]=!u,e)),onInput:this.handleInput,style:y({maxWidth:"".concat(w,"px"),boxSizing:"border-box",display:"inline-block",background:u||"edge"===i.BaseType?"#fff":"transparent"},v),dangerouslySetInnerHTML:{__html:b}})})},n=x([t.observer],n)}(t.Component),wb=t.LogicFlowUtil.createUuid,Cb=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:wb(),this.initLabelData(e)}return e.prototype.initLabelData=function(e){hr(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}},x([t.observable],e.prototype,"x",void 0),x([t.observable],e.prototype,"y",void 0),x([t.observable],e.prototype,"content",void 0),x([t.observable],e.prototype,"value",void 0),x([t.observable],e.prototype,"rotate",void 0),x([t.observable],e.prototype,"style",void 0),x([t.observable],e.prototype,"zIndex",void 0),x([t.observable],e.prototype,"vertical",void 0),x([t.observable],e.prototype,"editable",void 0),x([t.observable],e.prototype,"draggable",void 0),x([t.observable],e.prototype,"labelWidth",void 0),x([t.observable],e.prototype,"textOverflowMode",void 0),e}(),Nb={};!function(e){"classList"in document.createElement("_")||function(e){if("Element"in e){var t="classList",n="prototype",i=e.Element[n],r=Object,o=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=o.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],i=0,r=n.length;i<r;i++)this.push(n[i]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},d=u[n]=[],c=function(){return new u(this)};if(s[n]=Error[n],d.item=function(e){return this[e]||null},d.contains=function(e){return-1!==l(this,e+="")},d.add=function(){var e,t=arguments,n=0,i=t.length,r=!1;do{-1===l(this,e=t[n]+"")&&(this.push(e),r=!0)}while(++n<i);r&&this._updateClassName()},d.remove=function(){var e,t,n=arguments,i=0,r=n.length,o=!1;do{for(t=l(this,e=n[i]+"");-1!==t;)this.splice(t,1),o=!0,t=l(this,e)}while(++i<r);o&&this._updateClassName()},d.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},d.toString=function(){return this.join(" ")},r.defineProperty){var h={get:c,enumerable:!0,configurable:!0};try{r.defineProperty(i,t,h)}catch(e){-2146823252===e.number&&(h.enumerable=!1,r.defineProperty(i,t,h))}}else r[n].__defineGetter__&&i.__defineGetter__(t,c)}}(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},r=n.prototype,o=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,d=e.URL||e.webkitURL||e,c=d.createObjectURL,h=d.revokeObjectURL,p=d,f=e.btoa,g=e.atob,v=e.ArrayBuffer,m=e.Uint8Array,y=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(i.fake=o.fake=!0;u--;)s.prototype[l[u]]=u+1;return d.createObjectURL||(p=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}),p.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):f?t+";base64,"+f(e.data):t+","+encodeURIComponent(e.data)):c?c.call(d,e):void 0},p.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&h&&h.call(d,e)},r.append=function(e){var n=this.data;if(m&&(e instanceof v||e instanceof m)){for(var r="",o=new m(e),l=0,u=o.length;l<u;l++)r+=String.fromCharCode(o[l]);n.push(r)}else if("Blob"===t(e)||"File"===t(e)){if(!a)throw new s("NOT_READABLE_ERR");var d=new a;n.push(d.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))))},r.getBlob=function(e){return arguments.length||(e=null),new i(this.data.join(""),e,"raw")},r.toString=function(){return"[object BlobBuilder]"},o.slice=function(e,t,n){var r=arguments.length;return r<3&&(n=null),new i(this.data.slice(e,r>1?t:this.data.length),n,this.encoding)},o.toString=function(){return"[object Blob]"},o.close=function(){this.size=0,delete this.data},n}(e);e.Blob=function(e,n){var i=n&&n.type||"",r=new t;if(e)for(var o=0,a=e.length;o<a;o++)Uint8Array&&e[o]instanceof Uint8Array?r.append(e[o].buffer):r.append(e[o]);var s=r.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||$y.content||$y),function(t,n){"undefined"!=typeof process&&process&&process.versions&&process.versions.electron?t.MediumEditor=n:e.exports=n}($y,function(){function e(e,t){return this.init(e,t)}var t,n,i,r,o,a,s,l,u,d,c;return e.extensions={},function(t){function n(e,t){var n,i=Array.prototype.slice.call(arguments,2);t=t||{};for(var r=0;r<i.length;r++){var o=i[r];if(o)for(n in o)o.hasOwnProperty(n)&&void 0!==o[n]&&(e||!1===t.hasOwnProperty(n))&&(t[n]=o[n])}return t}var i=!1;try{var r=document.createElement("div"),o=document.createTextNode(" ");r.appendChild(o),i=r.contains(o)}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 r=e.createElement("a");return a.moveTextRangeIntoElement(t[0],t[t.length-1],r),r.setAttribute("href",n),i&&("_blank"===i&&r.setAttribute("rel","noopener noreferrer"),r.setAttribute("target",i)),r},findOrCreateMatchingTextNodes:function(e,t,n){for(var i=e.createTreeWalker(t,NodeFilter.SHOW_ALL,null,!1),r=[],o=0,s=!1,l=null,u=null;null!==(l=i.nextNode());)if(!(l.nodeType>3))if(3===l.nodeType){if(!s&&n.start<o+l.nodeValue.length&&(s=!0,u=a.splitStartNodeIfNeeded(l,n.start,o)),s&&a.splitEndNodeIfNeeded(l,u,n.end,o),s&&o===n.end)break;if(s&&o>n.end+1)throw new Error("PerformLinking overshot the target!");s&&r.push(u||l),o+=l.nodeValue.length,null!==u&&(o+=u.nodeValue.length,i.nextNode()),u=null}else"img"===l.tagName.toLowerCase()&&(!s&&n.start<=o&&(s=!0),s&&r.push(l));return r},splitStartNodeIfNeeded:function(e,t,n){return t!==n?e.splitText(t-n):null},splitEndNodeIfNeeded:function(e,t,n,i){var r,o;r=i+e.nodeValue.length+(t?t.nodeValue.length:0)-1,o=n-i-(t?e.nodeValue.length:0),r>=n&&i!==r&&0!==o&&(t||e).splitText(o)},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 r=0;r<t.childNodes.length;r++){var o=t.childNodes[r];if(3===o.nodeType)n.push(o);else if(1===o.nodeType){0===o.querySelectorAll(i).length?n.push(o):n=n.concat(e.util.splitByBlockElements(o))}}return n},findAdjacentTextNodeWithContent:function(e,t,n){var i,r=!1,o=n.createNodeIterator(e,NodeFilter.SHOW_TEXT,null,!1);for(i=o.nextNode();i;){if(i===t)r=!0;else if(r&&3===i.nodeType&&i.nodeValue&&i.nodeValue.trim().length>0)break;i=o.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 r=t.parentNode;null!==r;){if(r===e)return!0;r=r.parentNode}return!1},isElement:function(e){return!(!e||1!==e.nodeType)},throttle:function(e,t){var n,i,r,o=null,a=0,s=function(){a=Date.now(),o=null,r=e.apply(n,i),o||(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?(o&&(clearTimeout(o),o=null),a=l,r=e.apply(n,i),o||(n=i=null)):o||(o=setTimeout(s,u)),r}},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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},insertHTMLCommand:function(t,n){var i,r,o,s,l,u,d,c=!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(d=(r=i.getRangeAt(0)).commonAncestorContainer,a.isMediumEditorElement(d)&&!d.firstChild)r.selectNode(d.appendChild(t.createTextNode("")));else if(3===d.nodeType&&0===r.startOffset&&r.endOffset===d.nodeValue.length||3!==d.nodeType&&d.innerHTML===r.toString()){for(;!a.isMediumEditorElement(d)&&d.parentNode&&1===d.parentNode.childNodes.length&&!a.isMediumEditorElement(d.parentNode);)d=d.parentNode;r.selectNode(d)}for(r.deleteContents(),(o=t.createElement("div")).innerHTML=n,s=t.createDocumentFragment();o.firstChild;)l=o.firstChild,u=s.appendChild(l);r.insertNode(s),u&&((r=r.cloneRange()).setStartAfter(u),r.collapse(!0),e.selection.selectRange(t,r)),c=!0}return t.execCommand.callListeners&&t.execCommand.callListeners(h,c),c},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,r=t.split(" ");if("a"===e.nodeName.toLowerCase())for(i=0;i<r.length;i+=1)e.classList.add(r[i]);else{var o=e.getElementsByTagName("a");if(0===o.length){var s=a.getClosestTag(e,"a");e=s?[s]:[]}else e=o;for(n=0;n<e.length;n+=1)for(i=0;i<r.length;i+=1)e[n].classList.add(r[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,r=null,o=!n;i!==e;){var a,s=i.parentNode,l=s.cloneNode(!1),u=o?i:s.firstChild;for(r&&(o?l.appendChild(r):a=r),r=l;u;){var d=u.nextSibling;u===i?(u.hasChildNodes()?u=u.cloneNode(!1):u.parentNode.removeChild(u),u.textContent&&r.appendChild(u),u=o?d:null):(u.parentNode.removeChild(u),(u.hasChildNodes()||u.textContent)&&r.appendChild(u),u=d)}a&&r.appendChild(a),i=s}return r},moveTextRangeIntoElement:function(e,t,n){if(!e||!t)return!1;var i=a.findCommonRoot(e,t);if(!i)return!1;if(t===e){var r=e.parentNode,o=e.nextSibling;return r.removeChild(e),n.appendChild(e),o?r.insertBefore(n,o):r.appendChild(n),n.hasChildNodes()}for(var s,l,u,d=[],c=0;c<i.childNodes.length;c++)if(u=i.childNodes[c],s){if(a.isDescendant(u,t,!0)){l=u;break}d.push(u)}else a.isDescendant(u,e,!0)&&(s=u);var h=l.nextSibling,p=i.ownerDocument.createDocumentFragment();return s===e?(s.parentNode.removeChild(s),p.appendChild(s)):p.appendChild(a.splitOffDOMTree(s,e)),d.forEach((function(e){e.parentNode.removeChild(e),p.appendChild(e)})),l===t?(l.parentNode.removeChild(l),p.appendChild(l)):p.appendChild(a.splitOffDOMTree(l,t,!0)),n.appendChild(p),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),r=e,o=t;n!==i;)n>i?(r=r.parentNode,n-=1):(o=o.parentNode,i-=1);for(;r!==o;)r=r.parentNode,o=o.parentNode;return r},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),r=0;r<i.length;r++)n.appendChild(i[r]);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 r=function(){this.constructor=n};return r.prototype=i.prototype,n.prototype=new r,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,r=n.getSelection();return 0!==r.rangeCount&&(i=r.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 r,o=i.getRangeAt(0),a=o.cloneRange();a.selectNodeContents(e),a.setEnd(o.startContainer,o.startOffset),n={start:r=a.toString().length,end:r+o.toString().length},this.doesRangeStartWithImages(o,t)&&(n.startsWithImage=!0);var s=this.getTrailingImageCount(e,n,o.endContainer,o.endOffset);if(s&&(n.trailingImageCount=s),0!==r){var l=this.getIndexRelativeToAdjacentEmptyBlocks(t,e,o.startContainer,o.startOffset);-1!==l&&(n.emptyBlocksIndex=l)}}return n},importSelection:function(e,t,n,i){if(e&&t){var r=n.createRange();r.setStart(t,0),r.collapse(!0);var o,a=t,s=[],l=0,u=!1,d=!1,c=0,h=!1,p=!1,f=null;for((i||e.startsWithImage||void 0!==e.emptyBlocksIndex)&&(p=!0);!h&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||d){if(e.trailingImageCount&&d&&("img"===a.nodeName.toLowerCase()&&c++,c===e.trailingImageCount)){for(var g=0;a.parentNode.childNodes[g]!==a;)g++;r.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 o=l+a.length,!u&&e.start>=l&&e.start<=o&&(p||e.start<o?(r.setStart(a,e.start-l),u=!0):f=a),u&&e.end>=l&&e.end<=o&&(e.trailingImageCount?d=!0:(r.setEnd(a,e.end-l),h=!0)),l=o;h||(a=s.pop())}!u&&f&&(r.setStart(f,f.length),r.setEnd(f,f.length)),void 0!==e.emptyBlocksIndex&&(r=this.importSelectionMoveCursorPastBlocks(n,t,e.emptyBlocksIndex,r)),i&&(r=this.importSelectionMoveCursorPastAnchor(e,r)),this.selectRange(n,r)}},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,r=n.startContainer.parentNode;null!==r&&"a"!==r.nodeName.toLowerCase();)r.childNodes[r.childNodes.length-1]!==i?r=null:(i=r,r=r.parentNode);if(null!==r&&"a"===r.nodeName.toLowerCase()){for(var o=null,a=0;null===o&&a<r.parentNode.childNodes.length;a++)r.parentNode.childNodes[a]===r&&(o=a);n.setStart(r.parentNode,o+1),n.collapse(!0)}}return n},importSelectionMoveCursorPastBlocks:function(n,i,r,o){var a,s,l=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),u=o.startContainer,d=0;for(r=r||1,a=3===u.nodeType&&e.util.isBlockContainer(u.previousSibling)?u.previousSibling:e.util.getClosestBlockContainer(u);l.nextNode();)if(s){if(s=l.currentNode,++d===r)break;if(s.textContent.length>0)break}else a===l.currentNode&&(s=l.currentNode);return s||(s=a),o.setStart(e.util.getFirstSelectableLeafNode(s),0),o},getIndexRelativeToAdjacentEmptyBlocks:function(n,i,r,o){if(r.textContent.length>0&&o>0)return-1;var a=r;if(3!==a.nodeType&&(a=r.childNodes[o]),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(r),u=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),d=0;u.nextNode();){var c=""===u.currentNode.textContent;if((c||d>0)&&(d+=1),u.currentNode===l)return d;c||(d=0)}return d},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 r=i.currentNode;if(r===n)break;if(r.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 r=n.childNodes[i-1];r.hasChildNodes();)r=r.lastChild;for(var o,a=e,s=[],l=0,u=!1,d=!1,c=!1,h=0;!c&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||d){if("img"===a.nodeName.toLowerCase()&&h++,a===r)c=!0;else if(1===a.nodeType)for(var p=a.childNodes.length-1;p>=0;)s.push(a.childNodes[p]),p-=1}else h=0,o=l+a.length,!u&&t.start>=l&&t.start<=o&&(u=!0),u&&t.end>=l&&t.end<=o&&(d=!0),l=o;c||(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,r="",o=e.getSelection();if(o.rangeCount){for(i=e.createElement("div"),t=0,n=o.rangeCount;t<n;t+=1)i.appendChild(o.getRangeAt(t).cloneContents());r=i.innerHTML}return r},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,r=e.getSelection();if(!r.rangeCount||r.isCollapsed||!r.getRangeAt(0).commonAncestorContainer)return[];if(3===(t=r.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 r.containsNode||r.containsNode(e,!0)}))},selectNode:function(e,t){var n=t.createRange();n.selectNodeContents(e),this.selectRange(t,n)},select:function(e,t,n,i,r){var o=e.createRange();return o.setStart(t,n),i?o.setEnd(i,r):o.collapse(!0),this.selectRange(e,o),o},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,r){var o=this.base.options.contentWindow,a=this.base.options.ownerDocument;t=e.util.isElement(t)||[o,a].indexOf(t)>-1?[t]:t,Array.prototype.forEach.call(t,function(e){e.addEventListener(n,i,r),this.events.push([e,n,i,r])}.bind(this))},detachDOMEvent:function(t,n,i,r){var o,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!==(o=this.indexOfListener(e,n,i,r))&&(a=this.events.splice(o,1)[0])[0].removeEventListener(a[1],a[2],a[3])}.bind(this)))},indexOfListener:function(e,t,n,i){var r,o,a;for(r=0,o=this.events.length;r<o;r+=1)if((a=this.events[r])[0]===e&&a[1]===t&&a[2]===n&&a[3]===i)return r;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 r=t[n];this.detachDOMEvent(r[0],r[1],r[2],r[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 r,o=this.base.getFocusedElement();o&&"click"===i.type&&this.lastMousedownTarget&&(e.util.isDescendant(o,this.lastMousedownTarget,!0)||t(this.base.extensions,this.lastMousedownTarget))&&(r=o),r||this.base.elements.some((function(t){return!r&&e.util.isDescendant(t,n,!0)&&(r=t),!!r}),this);var a=!e.util.isDescendant(o,n,!0)&&!t(this.base.extensions,n);r!==o&&(o&&a&&(o.removeAttribute("data-medium-focused"),this.triggerCustomEvent("blur",i,o)),r&&(r.setAttribute("data-medium-focused",!0),this.triggerCustomEvent("focus",i,r))),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,r=this.getTagNames();return!1===this.knownState||!0===this.knownState?this.knownState:(r&&r.length>0&&(i=-1!==r.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>•</b>",contentFA:'<i class="fa fa-list-ul"></i>'},indent:{name:"indent",action:"indent",aria:"indent",tagNames:[],contentDefault:"<b>→</b>",contentFA:'<i class="fa fa-indent"></i>'},outdent:{name:"outdent",action:"outdent",aria:"outdent",tagNames:[],contentDefault:"<b>←</b>",contentFA:'<i class="fa fa-outdent"></i>'},justifyCenter:{name:"justifyCenter",action:"justifyCenter",aria:"center justify",tagNames:[],style:{prop:"text-align",value:"center"},contentDefault:"<b>C</b>",contentFA:'<i class="fa fa-align-center"></i>'},justifyFull:{name:"justifyFull",action:"justifyFull",aria:"full justify",tagNames:[],style:{prop:"text-align",value:"justify"},contentDefault:"<b>J</b>",contentFA:'<i class="fa fa-align-justify"></i>'},justifyLeft:{name:"justifyLeft",action:"justifyLeft",aria:"left justify",tagNames:[],style:{prop:"text-align",value:"left"},contentDefault:"<b>L</b>",contentFA:'<i class="fa fa-align-left"></i>'},justifyRight:{name:"justifyRight",action:"justifyRight",aria:"right justify",tagNames:[],style:{prop:"text-align",value:"right"},contentDefault:"<b>R</b>",contentFA:'<i class="fa fa-align-right"></i>'},removeFormat:{name:"removeFormat",aria:"remove formatting",action:"removeFormat",contentDefault:"<b>X</b>",contentFA:'<i class="fa fa-eraser"></i>'},quote:{name:"quote",action:"append-blockquote",aria:"blockquote",tagNames:["blockquote"],contentDefault:"<b>“</b>",contentFA:'<i class="fa fa-quote-right"></i>'},pre:{name:"pre",action:"append-pre",aria:"preformatted text",tagNames:["pre"],contentDefault:"<b>0101</b>",contentFA:'<i class="fa fa-code fa-lg"></i>'},h1:{name:"h1",action:"append-h1",aria:"header type one",tagNames:["h1"],contentDefault:"<b>H1</b>",contentFA:'<i class="fa fa-header"><sup>1</sup>'},h2:{name:"h2",action:"append-h2",aria:"header type two",tagNames:["h2"],contentDefault:"<b>H2</b>",contentFA:'<i class="fa fa-header"><sup>2</sup>'},h3:{name:"h3",action:"append-h3",aria:"header type three",tagNames:["h3"],contentDefault:"<b>H3</b>",contentFA:'<i class="fa fa-header"><sup>3</sup>'},h4:{name:"h4",action:"append-h4",aria:"header type four",tagNames:["h4"],contentDefault:"<b>H4</b>",contentFA:'<i class="fa fa-header"><sup>4</sup>'},h5:{name:"h5",action:"append-h5",aria:"header type five",tagNames:["h5"],contentDefault:"<b>H5</b>",contentFA:'<i class="fa fa-header"><sup>5</sup>'},h6:{name:"h6",action:"append-h6",aria:"header type six",tagNames:["h6"],contentDefault:"<b>H6</b>",contentFA:'<i class="fa fa-header"><sup>6</sup>'}},i=e.extensions.button.extend({init:function(){e.extensions.button.prototype.init.apply(this,arguments)},formSaveLabel:"✓",formCloseLabel:"×",activeClass:"medium-editor-toolbar-form-active",hasForm:!0,getForm:function(){},isDisplayed:function(){return!!this.hasForm&&this.getForm().classList.contains(this.activeClass)},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,r=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(),r=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),r){var o=t.buttonClass?t.buttonClass.split(" "):[];r.checked=-1!==o.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(/^(.*?)(?:\?(.*?))?(?:#(.*))?$/),r=i[1],o=i[2],a=i[3];if(/^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/.test(e))return"tel:"+e;if(!t){var s=r.split("/")[0];(s.match(/.+(\.|:).+/)||"localhost"===s)&&(n="http://")}return n+this.ensureEncodedUri(r)+(void 0===o?"":"?"+this.ensureEncodedQuery(o))+(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=r,o=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,r,o,a=this.window.innerWidth,s=this.anchorPreview.offsetHeight,l=e.getBoundingClientRect(),u=this.diffLeft,d=this.diffTop,c=this.getEditorOption("elementsContainer"),h=["absolute","fixed"].indexOf(window.getComputedStyle(c).getPropertyValue("position"))>-1,p={};t=this.anchorPreview.offsetWidth/2;var f=this.base.getExtensionByName("toolbar");f&&(u=f.diffLeft,d=f.diffTop),n=u-t,h?(r=c.getBoundingClientRect(),["top","left"].forEach((function(e){p[e]=l[e]-r[e]})),p.width=l.width,p.height=l.height,l=p,a=r.width,o=c.scrollTop):o=this.window.pageYOffset,i=l.left+l.width/2,o+=s+l.top+l.height-d-this.anchorPreview.offsetHeight,this.anchorPreview.style.top=Math.round(o)+"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=o,function(){var t,n,i,r,o;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+"))",r=new RegExp("^("+n+")$","i"),o=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 r=0;r<n.length;r++)i=this.removeObsoleteAutoLinkSpans(n[r])||i,i=this.performLinkingWithinElement(n[r])||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,r=0;r<n.length;r++){var o=n[r].textContent;if(-1===o.indexOf("://")&&(o=e.util.ensureUrlHasProtocol(o)),n[r].getAttribute("data-href")!==o&&a(n[r])){i=!0;var s=o.replace(/\s+$/,"");if(n[r].getAttribute("data-href")===s){var l=o.length-s.length,u=e.util.splitOffDOMTree(n[r],this.splitTextBeforeEnd(n[r],l));n[r].parentNode.insertBefore(u,n[r].nextSibling)}else e.util.unwrap(n[r],this.document)}}return i},splitTextBeforeEnd:function(e,t){for(var n,i,r,o=this.document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),a=!0;a;)a=null!==o.lastChild();for(;t>0&&null!==r;)(i=(n=o.currentNode).nodeValue).length>t?(r=n.splitText(i.length-t),t=0):(r=o.previousNode(),t-=i.length);return r},performLinkingWithinElement:function(t){for(var n=this.findLinkableText(t),i=0;i<n.length;i++){var r=e.util.findOrCreateMatchingTextNodes(this.document,t,n[i]);this.shouldNotLink(r)||this.createAutoLink(r,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=o.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("/")||r.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),r=this.document.createElement("span");for(r.setAttribute("data-auto-link","true"),r.setAttribute("data-href",n),i.insertBefore(r,i.firstChild);i.childNodes.length>1;)r.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),r=!!t.shiftKey,o=!!t.altKey;this.keys[n].forEach((function(e){e.meta!==i||e.shift!==r||e.alt!==o&&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:"±",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"),r=t.createElement("a"),o=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)),o.setAttribute("href","#"),o.className="medium-editor-toobar-save",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"✓",n.appendChild(o),this.on(o,"click",this.handleSaveClick.bind(this),!0),r.setAttribute("href","#"),r.className="medium-editor-toobar-close",r.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"×",n.appendChild(r),this.on(r,"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:"±",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"),r=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)),r.setAttribute("href","#"),r.className="medium-editor-toobar-save",r.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"✓",t.appendChild(r),this.on(r,"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>':"×",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,r=function(e){e.stopPropagation()};function o(e,t,n){var i=e.clipboardData||t.clipboardData||n.dataTransfer,r={};if(!i)return r;if(i.getData){var o=i.getData("Text");o&&o.length>0&&(r["text/plain"]=o)}if(i.types)for(var a=0;a<i.types.length;a++){var s=i.types[a];r[s]=i.getData(s)}return r}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=o(e,this.window,this.document),i=n["text/html"],r=n["text/plain"];this.window.clipboardData&&void 0===e.clipboardData&&!i&&(i=r),(i||r)&&(e.preventDefault(),this.doPaste(i,r,t))}},doPaste:function(t,n,i){var r,o,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((r=n.split(/[\r\n]+/g)).length>1)for(o=0;o<r.length;o+=1)""!==r[o]&&(a+="<p>"+e.util.htmlEntities(r[o])+"</p>");else a=e.util.htmlEntities(r[0]);e.util.insertHTMLCommand(this.document,a)}},handlePasteBinPaste:function(e){if(e.defaultPrevented)this.removePasteBin();else{var t=o(e,this.window,this.document),n=t["text/html"],r=t["text/plain"],a=i;if(!this.cleanPastedHTML||n)return e.preventDefault(),this.removePasteBin(),this.doPaste(n,r,a),void this.trigger("editablePaste",{currentTarget:a,target:a},a);setTimeout(function(){this.cleanPastedHTML&&(n=this.getPasteBinHtml()),this.removePasteBin(),this.doPaste(n,r,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(o){var a,s=e.selection.getSelectionRange(this.document),l=this.window.pageYOffset;i=o,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",r),this.on(u,"focusin",r),this.on(u,"focusout",r),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",r),this.off(t,"focusin",r),this.off(t,"focusout",r),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,r,o=/<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(/<(\/?)(i|b|a)>/gi),"<$1$2>"],[new RegExp(/<a(?:(?!href).)+href=(?:"|”|“|"|“|”)(((?!"|”|“|"|“|”).)*)(?:"|”|“|"|“|”)(?:(?!>).)*>/gi),'<a href="$1">'],[new RegExp(/<\/p>\n+/gi),"</p>"],[new RegExp(/\n+<p/gi),"<p"],[new RegExp(/<\/?o:[a-z]*>/gi),""],[new RegExp(/<!\[if !supportLists\]>(((?!<!).)*)<!\[endif]\>/gi),"$1"]],this.cleanReplacements||[]);for(t=0;t<a.length;t+=1)e=e.replace(a[t][0],a[t][1]);if(!o)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((r=n[t]).innerHTML=r.innerHTML.replace(/\n/gi," "),r.nodeName.toLowerCase()){case"p":case"div":this.filterCommonBlocks(r);break;case"br":this.filterLineBreak(r)}this.pasteHTML(i.innerHTML)},pasteHTML:function(t,n){n=e.util.defaults({},n,{cleanAttrs:this.cleanAttrs,cleanTags:this.cleanTags,unwrapTags:this.unwrapTags});var i,r,o,a,s=this.document.createDocumentFragment();for(s.appendChild(this.document.createElement("body")),(a=s.querySelector("body")).innerHTML=t,this.cleanupSpans(a),i=a.querySelectorAll("*"),o=0;o<i.length;o+=1)"a"===(r=i[o]).nodeName.toLowerCase()&&this.getEditorOption("targetBlank")&&e.util.setTargetBlank(r),e.util.cleanupAttrs(r,n.cleanAttrs),e.util.cleanupTags(r,n.cleanTags),e.util.unwrapTags(r,n.unwrapTags);e.util.insertHTMLCommand(this.document,a.innerHTML.replace(/ /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,r,o=t.querySelectorAll(".replace-with"),a=function(e){return e&&"#text"!==e.nodeName&&"false"===e.getAttribute("contenteditable")};for(n=0;n<o.length;n+=1)i=o[n],r=this.document.createElement(i.classList.contains("bold")?"b":"i"),i.classList.contains("bold")&&i.classList.contains("italic")?r.innerHTML="<i>"+i.innerHTML+"</i>":r.innerHTML=i.innerHTML,i.parentNode.replaceChild(r,i);for(o=t.querySelectorAll("span"),n=0;n<o.length;n+=1){if(i=o[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,d=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,r,o,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?(o=i,a=null):(o=i.name,a=i),(r=this.base.addBuiltInExtension(o,a))&&"function"==typeof r.getButton&&(n=r.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,r=e.selection.getSelectionRange(this.document),o=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(r&&(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(r),this.getEditorElements().some((function(n){return e.util.isDescendant(n,t,!0)}))))for(;t&&(n.forEach(o),!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,r=this.getToolbarElement(),o=e.getBoundingClientRect(),a=o.top+n,s=o.left+o.width/2,l=r.offsetHeight,u=r.offsetWidth,d=u/2;switch(this.sticky?n>a+e.offsetHeight-l-this.stickyTopOffset?(r.style.top=a+e.offsetHeight-l+"px",r.classList.remove("medium-editor-sticky-toolbar")):n>a-l-this.stickyTopOffset?(r.classList.add("medium-editor-sticky-toolbar"),r.style.top=this.stickyTopOffset+"px"):(r.classList.remove("medium-editor-sticky-toolbar"),r.style.top=a-l+"px"):r.style.top=a-l+"px",this.align){case"left":t=o.left;break;case"right":t=o.right-u;break;case"center":t=s-d}t<0?t=0:t+u>i&&(t=i-Math.ceil(u)-1),r.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,r,o=this.window.innerWidth,a=this.getToolbarElement(),s=a.offsetHeight,l=a.offsetWidth/2,u=this.diffLeft-l,d=this.getEditorOption("elementsContainer"),c=["absolute","fixed"].indexOf(window.getComputedStyle(d).getPropertyValue("position"))>-1,h={},p={};c?(r=d.getBoundingClientRect(),["top","left"].forEach((function(e){p[e]=n[e]-r[e]})),p.width=n.width,p.height=n.height,n=p,o=r.width,h.top=d.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"):o-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=d,c=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=c,function(){function t(t){var n=e.selection.getSelectionStart(this.options.ownerDocument),i=n.textContent,r=e.selection.getCaretOffsets(n);(void 0===i[r.left-1]||""===i[r.left-1].trim()||void 0!==i[r.left]&&""===i[r.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 r(t){var n,i=e.selection.getSelectionStart(this.options.ownerDocument),r=i.nodeName.toLowerCase(),o=/^(\s+|<br\/?>)?$/i,a=/h\d/i;e.util.isKey(t,[e.util.keyCode.BACKSPACE,e.util.keyCode.ENTER])&&i.previousElementSibling&&a.test(r)&&0===e.selection.getCaretOffsets(i).left?e.util.isKey(t,e.util.keyCode.BACKSPACE)&&o.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(r)&&o.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"===r&&o.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&&o.test(i.innerHTML)&&(t.preventDefault(),e.selection.moveCursor(this.options.ownerDocument,i.nextSibling),i.parentElement.removeChild(i))}function o(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 r=[];if(t||(t=[]),"string"==typeof t&&(t=n.querySelectorAll(t)),e.util.isElement(t)&&(t=[t]),i)for(var o=0;o<t.length;o++){var a=t[o];!e.util.isElement(a)||a.getAttribute("data-medium-editor-element")||a.getAttribute("medium-editor-textarea-id")||r.push(a)}else r=Array.prototype.slice.apply(t);return r}function d(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 c(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 p(){return!!h.call(this)&&!1!==this.options.anchorPreview}function f(){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,r=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 o=0,a=r.length;o<a;o++)t.hasAttribute(r[o].nodeName)||t.setAttribute(r[o].nodeName,r[o].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",o.bind(this));var r=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",r),S[r]=t.innerHTML,this.events.attachAllEventsToElement(t)}return t}function E(){this.subscribe("editableKeydownTab",i.bind(this)),this.subscribe("editableKeydownDelete",r.bind(this)),this.subscribe("editableKeydownEnter",r.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 w(){if(this.extensions=[],Object.keys(this.options.extensions).forEach((function(e){"toolbar"!==e&&this.options.extensions[e]&&this.extensions.push(c(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":p.call(this),autoLink:g.call(this),keyboardCommands:m.call(this),placeholder:f.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 r=e.util.extend({},this.options.toolbar,{allowMultiParagraphSelection:this.options.allowMultiParagraphSelection});i=new e.extensions.toolbar(r)}i&&this.extensions.push(c(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,r;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"),r=n.value||n.size,this.options.ownerDocument.execCommand("fontSize",!1,r);if("fontName"===t)return n.name&&e.util.deprecated(".name option for fontName command",".value","6.0.0"),r=n.value||n.name,this.options.ownerDocument.execCommand("fontName",!1,r);if("createLink"===t)return this.createLink(n);if("image"===t){var o=this.options.contentWindow.getSelection().toString().trim();return this.options.ownerDocument.execCommand("insertImage",!1,o)}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 r=n&&n.value,this.options.ownerDocument.execCommand(t,!1,r)}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 r=this.options.ownerDocument.createElement("BR");i.parentNode.insertBefore(r,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,w.call(this),E.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")&&d(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,r=this.getExtensionByName(t);if(r)return r;switch(t){case"anchor":i=e.util.extend({},this.options.anchor,n),r=new e.extensions.anchor(i);break;case"anchor-preview":r=new e.extensions.anchorPreview(this.options.anchorPreview);break;case"autoLink":r=new e.extensions.autoLink;break;case"fileDragging":r=new e.extensions.fileDragging(n);break;case"fontname":r=new e.extensions.fontName(this.options.fontName);break;case"fontsize":r=new e.extensions.fontSize(n);break;case"keyboardCommands":r=new e.extensions.keyboardCommands(this.options.keyboardCommands);break;case"paste":r=new e.extensions.paste(this.options.paste);break;case"placeholder":r=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]),r=new e.extensions.button(i)):r=new e.extensions.button(t))}return r&&this.extensions.push(c(r,t,this)),r},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,r;return(i=/^full-(.+)$/gi.exec(t))?(this.saveSelection(),this.selectAllContents(),r=N.call(this,i[1],n),this.restoreSelection()):r=N.call(this,t,n),"insertunorderedlist"!==t&&"insertorderedlist"!==t||e.util.cleanListDOM(this.options.ownerDocument,this.getSelectedParentElement()),this.checkSelection(),r},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),r={};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 o=this.options.contentWindow.getSelection();if(o){var a,s,l,u,d=o.getRangeAt(0),c=d.commonAncestorContainer;if(3===d.endContainer.nodeType&&3!==d.startContainer.nodeType&&0===d.startOffset&&d.startContainer.firstChild===d.endContainer&&(c=d.endContainer),s=e.util.getClosestBlockContainer(d.startContainer),l=e.util.getClosestBlockContainer(d.endContainer),3!==c.nodeType&&0!==c.textContent.length&&s===l){var h=s||i,p=this.options.ownerDocument.createDocumentFragment();this.execAction("unlink"),a=this.exportSelection(),p.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 f=this.exportSelection();0===(u=e.util.findOrCreateMatchingTextNodes(this.options.ownerDocument,p,{start:a.start-f.start,end:a.end-f.start,editableElementIndex:a.editableElementIndex})).length&&((p=this.options.ownerDocument.createDocumentFragment()).appendChild(c.cloneNode(!0)),u=[p.firstChild.firstChild,p.firstChild.lastChild]),e.util.createLink(this.options.ownerDocument,u,n.trim());var g=(p.firstChild.innerHTML.match(/^\s+/)||[""])[0].length;e.util.insertHTMLCommand(this.options.ownerDocument,p.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){(r=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(r)}}finally{this.events.enableCustomEvent("editableInput")}this.events.triggerCustomEvent("editableInput",r,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")&&d(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 Nb},set exports(e){Nb=e}});var _b=Nb,Sb=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Mb=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}}(),Tb=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,r=!1,o=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){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}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 Ab={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 Ob(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 kb=function(){function e(t,n,i,r){Sb(this,e);var o=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=Tb(n,4),r=i[0],a=i[1],s=i[2],l=i[3];void 0===l&&(l=1),r/=360,a/=100,s/=100,o.hsla=[r,a,s,l]}else if(t.startsWith("rgb")){var u=t.match(/([\-\d\.e]+)/g).map(Number),d=Tb(u,4),c=d[0],h=d[1],p=d[2],f=d[3];void 0===f&&(f=1),o.rgba=[c,h,p,f]}else t.startsWith("#")?o.rgba=e.hexToRgb(t):o.rgba=e.nameToRgb(t)||e.hexToRgb(t)}(a.toLowerCase())}else this.rgba=[t,n,i,void 0===r?1:r]}return Mb(e,[{key:"printRGB",value:function(e){var t=(e?this.rgba:this.rgba.slice(0,3)).map((function(e,t){return Ob(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 Ob(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=Ab[n];return void 0===i?i:e.hexToRgb(i.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=Tb(e,4),n=t[0],i=t[1],r=t[2],o=t[3];n/=255,i/=255,r/=255;var a=Math.max(n,i,r),s=Math.min(n,i,r),l=void 0,u=void 0,d=(a+s)/2;if(a===s)l=u=0;else{var c=a-s;switch(u=d>.5?c/(2-a-s):c/(a+s),a){case n:l=(i-r)/c+(i<r?6:0);break;case i:l=(r-n)/c+2;break;case r:l=(n-i)/c+4}l/=6}return[l,u,d,o]}},{key:"hslToRgb",value:function(e){var t=Tb(e,4),n=t[0],i=t[1],r=t[2],o=t[3],a=void 0,s=void 0,l=void 0;if(0===i)a=s=l=r;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},d=r<.5?r*(1+i):r+i-r*i,c=2*r-d;a=u(c,d,n+1/3),s=u(c,d,n),l=u(c,d,n-1/3)}var h=[255*a,255*s,255*l].map(Math.round);return h[3]=o,h}}]),e}(),Db=function(){function e(){Sb(this,e),this._events=[]}return Mb(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(r){var o=!0;return t&&t!==r.target&&(o=!1),n&&n!==r.type&&(o=!1),i&&i!==r.handler&&(o=!1),o&&e._doRemove(r.target,r.type,r.handler),!o}))}},{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 Rb(e,t,n){var i=!1;function r(e,t,n){return Math.max(t,Math.min(e,n))}function o(e,o,a){if(a&&(i=!0),i){e.preventDefault();var s=t.getBoundingClientRect(),l=s.width,u=s.height,d=o.clientX,c=o.clientY,h=r(d-s.left,0,l),p=r(c-s.top,0,u);n(h/l,p/u)}}function a(e,t){1===(void 0===e.buttons?e.which:e.buttons)?o(e,e,t):i=!1}function s(e,t){1===e.touches.length?o(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 Pb="keydown",Ib="mousedown",Lb="focusin";function Bb(e,t){return(t||document).querySelector(e)}function jb(e,t,n,i,r){e.add(t,Pb,(function(e){n.indexOf(e.key)>=0&&i(e)}))}var zb=function(){function e(t){Sb(this,e),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Db,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return Mb(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 r=n.parent;if(r&&n.popup&&!this._popupInited){var o=function(e){return t.openHandler(e)};this._events.add(r,"click",o),jb(this._events,r,[" ","Spacebar","Enter"],o),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===Pb?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===Ib||t===Lb){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!==Ib&&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 kb(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>',r=(t=i,(n=document.createElement("div")).innerHTML=t,n.firstElementChild);return this.domElement=r,this._domH=Bb(".picker_hue",r),this._domSL=Bb(".picker_sl",r),this._domA=Bb(".picker_alpha",r),this._domEdit=Bb(".picker_editor input",r),this._domSample=Bb(".picker_sample",r),this._domOkay=Bb(".picker_done button",r),this._domCancel=Bb(".picker_cancel button",r),r.classList.add("layout_"+this.settings.layout),this.settings.alpha||r.classList.add("no_alpha"),this.settings.editor||r.classList.add("no_editor"),this.settings.cancelButton||r.classList.add("no_cancel"),this._ifPopup((function(){return r.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 r(e,t,n){i.add(e,t,n)}r(n,"click",(function(e){return e.preventDefault()})),Rb(i,this._domH,(function(e,n){return t._setHSLA(e)})),Rb(i,this._domSL,(function(e,n){return t._setHSLA(null,e,1-n)})),this.settings.alpha&&Rb(i,this._domA,(function(e,n){return t._setHSLA(null,null,null,1-n)}));var o=this._domEdit;r(o,"input",(function(e){t._setColor(this.value,{fromEditor:!0,failSilently:!0})})),r(o,"focus",(function(e){var t=this;t.selectionStart===t.selectionEnd&&t.select()})),this._ifPopup((function(){var t=function(t){return e.closeHandler(t)};r(window,Ib,t),r(window,Lb,t),jb(i,n,["Esc","Escape"],t);var o=function(t){e.__containedEvent=t.timeStamp};r(n,Ib,o),r(n,Lb,o),r(e._domCancel,"click",t)}));var a=function(t){e._ifPopup((function(){return e.closeHandler(t)})),e.onDone&&e.onDone(e.colour)};r(this._domOkay,"click",a),jb(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,r){r=r||{};var o=this.colour,a=o.hsla;[e,t,n,i].forEach((function(e,t){(e||0===e)&&(a[t]=e)})),o.hsla=a,this._updateUI(r),this.onChange&&!r.silent&&this.onChange(o)}},{key:"_updateUI",value:function(e){if(this.domElement){e=e||{};var t=this.colour,n=t.hsla,i="hsl("+360*n[0]+", 100%, 50%)",r=t.hslString,o=t.hslaString,a=this._domH,s=this._domSL,l=this._domA,u=Bb(".picker_selector",a),d=Bb(".picker_selector",s),c=Bb(".picker_selector",l);y(0,u,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=i,y(0,d,n[1]),b(0,d,1-n[2]),s.style.color=r,b(0,c,1-n[3]);var h=r,p=h.replace("hsl","hsla").replace(")",", 0)"),f="linear-gradient("+[h,p]+")";if(this._domA.style.background=f+", 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=o}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}(),Hb=document.createElement("style");Hb.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(Hb),zb.StyleElement=Hb;var Fb={};!function(e){e.exports=function(){var e="object",t="function",n="undefined",i=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],r=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],o=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],a=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"];function s(n,i){var r=typeof n[i];return r==t||!(r!=e||!n[i])||"unknown"==r}function l(t,n){return!(typeof t[n]!=e||!t[n])}function u(e,t){return typeof e[t]!=n}function d(e){return function(t,n){for(var i=n.length;i--;)if(!e(t,n[i]))return!1;return!0}}var c=d(s),h=d(l),p=d(u);function f(e){return e&&c(e,a)&&p(e,o)}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,E={isHostMethod:s,isHostObject:l,isHostProperty:u,areHostMethods:c,areHostObjects:h,areHostProperties:p,isTextRange:f,getBody:g,forEach:y},w={version:"1.3.1",initialized:!1,isBrowser:x,supported:!0,util:E,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){w.initialized=!0,w.supported=!1,N("Rangy is not supported in this environment. Reason: "+e,w.config.alertOnFail)}function S(e){N("Rangy warning: "+e,w.config.alertOnWarn)}w.fail=_,w.warn=S,{}.hasOwnProperty?(E.extend=v=function(e,t,n){var i,r;for(var o in t)t.hasOwnProperty(o)&&(i=e[o],r=t[o],n&&null!==i&&"object"==typeof i&&null!==r&&"object"==typeof r&&v(i,r,!0),e[o]=r);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},E.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}),E.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"),E.addListener=m);var M=[];function T(e){return e.message||e.description||String(e)}function A(){if(x&&!w.initialized){var e,t=!1,n=!1;s(document,"createRange")&&(e=document.createRange(),c(e,r)&&p(e,i)&&(t=!0));var o=g(document);if(o&&"body"==o.nodeName.toLowerCase())if(o&&s(o,"createTextRange")&&f(e=o.createTextRange())&&(n=!0),t||n){var a;for(var l in w.initialized=!0,w.features={implementsDomRange:t,implementsTextRange:n},b)(a=b[l])instanceof P&&a.init(a,w);for(var u=0,d=M.length;u<d;++u)try{M[u](w)}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 O(e,t,n){n&&(e+=" in module "+n.name),w.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function k(e,t,n,i){e[t]=function(){return O(t,n,i),e[n].apply(e,E.toArray(arguments))}}E.deprecationNotice=O,E.createAliasForDeprecatedMethod=k,w.init=A,w.addInitListener=function(e){w.initialized?e(w):M.push(e)};var D=[];function R(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(w,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(){}w.addShimListener=function(e){D.push(e)},x&&(w.shim=w.createMissingNativeApi=R,k(w,"createMissingNativeApi","shim")),P.prototype={init:function(){for(var e,t,n=this.dependencies||[],i=0,r=n.length;i<r;++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){w.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){w.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)}},w.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);w.initialized&&w.supported&&i.init()},w.createCoreModule=function(e,t,n){I(e,t,n)},w.RangePrototype=L,w.rangePrototype=new L,w.selectionPrototype=new B,w.createCoreModule("DomUtil",[],(function(e,t){var n="undefined",i=e.util,r=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 o=document.createElement("div");i.areHostMethods(o,["insertBefore","appendChild","cloneNode"]||!i.areHostObjects(o,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),i.isHostProperty(o,"innerHTML")||t.fail("Element is missing innerHTML property");var a=document.createTextNode("test");i.areHostMethods(a,["splitText","deleteData","insertData","appendData","cloneNode"]||!i.areHostObjects(o,["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 d(e){for(var t=0;e=e.previousSibling;)++t;return t}function c(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 p(e,t,n){for(var i=n?t:t.parentNode;i;){if(i===e)return!0;i=i.parentNode}return!1}function f(e,t){return p(e,t,!0)}function g(e,t,n){for(var i,r=n?e:e.parentNode;r;){if((i=r.parentNode)===t)return r;r=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 r,o=0;r=n[o++];)r.node==e&&r.offset>t?(r.node=i,r.offset-=t):r.node==e.parentNode&&r.offset>d(e)&&++r.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 E(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 w(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 r;if(e?i.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?w(e):x(e):N(e)&&(r=e.document):r=document,!r)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return r}function S(e){for(var t;t=e.parentNode;)e=t;return e}function M(e,n,i,r){var o,a,s,l,u;if(e==i)return n===r?0:n<r?-1:1;if(o=g(i,e,!0))return n<=d(o)?-1:1;if(o=g(e,i,!0))return d(o)<r?-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 O(e){try{return e.parentNode,!1}catch(e){return!0}}function k(e){if(!e)return"[No node]";if(A&&O(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:"+d(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 R(e,t,n){var i=r(e),o=e.createElement("div");o.contentEditable=""+!!n,t&&(o.innerHTML=t);var a=i.firstChild;return a?i.insertBefore(o,a):i.appendChild(o),o}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=O(n),e.features.crashyTextNodes=A}(),typeof window.getComputedStyle!=n?T=function(e,t){return E(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("+k(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:d,getNodeLength:c,getCommonAncestor:h,isAncestorOf:p,isOrIsAncestorOf:f,getClosestAncestorIn:g,isCharacterDataNode:v,isTextOrCommentNode:m,insertAfter:y,splitDataNode:b,getDocument:x,getWindow:E,getIframeWindow:C,getIframeDocument:w,getBody:r,isWindow:N,getContentDocument:_,getRootContainer:S,comparePoints:M,isBrokenNode:O,inspectNode:k,getComputedStyleProperty:T,createTestElement:R,removeNode:P,fragmentFromNodeChildren:D,createIterator:L,DomPosition:B},e.DOMException=j})),w.createCoreModule("DomRange",["DomUtil"],(function(e,t){var n=e.dom,i=e.util,r=n.DomPosition,o=e.DOMException,a=n.isCharacterDataNode,s=n.getNodeIndex,l=n.isOrIsAncestorOf,u=n.getDocument,d=n.comparePoints,c=n.splitDataNode,h=n.getClosestAncestorIn,p=n.getNodeLength,f=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 E(e){return new r(e.parentNode,s(e))}function w(e){return new r(e.parentNode,s(e)+1)}function C(e,t,i){var r=11==e.nodeType?e.firstChild:e;return a(t)?i==t.length?n.insertAfter(e,t):t.parentNode.insertBefore(e,0==i?t:c(t,i)):i>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[i]),r}function N(e,t,n){if(Q(e),Q(t),b(t)!=b(e))throw new o("WRONG_DOCUMENT_ERR");var i=d(e.startContainer,e.startOffset,t.endContainer,t.endOffset),r=d(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return n?i<=0&&r>=0:i<0&&r>0}function _(e){for(var t,n,i,r=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 o("HIERARCHY_REQUEST_ERR");r.appendChild(n)}return r}function S(e,t,i){var r,o,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(r=n.createIterator(a);o=r.next();)if(!1===t(o))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 o("HIERARCHY_REQUEST_ERR");i.appendChild(t)}return i}function A(e,t,n){var i,r=!(!t||!t.length),o=!!n;r&&(i=new RegExp("^("+t.join("|")+")$"));var s=[];return S(new k(e,!1),(function(t){if((!r||i.test(t.nodeType))&&(!o||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 O(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+n.inspectNode(e.startContainer)+":"+e.startOffset+", "+n.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function k(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])}}k.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,r=t,o=p(t);l(t,this.sc)&&(n=this.sc,i=this.so),l(t,this.ec)&&(r=this.ec,o=this.eo),ve(e,n,i,r,o)}return new k(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],R=[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,r=n?t:t.parentNode;r;){if(i=r.nodeType,f(e,i))return r;r=r.parentNode}return null}}var j=B([9,11]),z=B(P),H=B([6,10,12]),F=B([1]);function W(e,t){if(H(e,t))throw new o("INVALID_NODE_TYPE_ERR")}function G(e,t){if(!f(t,e.nodeType))throw new o("INVALID_NODE_TYPE_ERR")}function U(e,t){if(t<0||t>(a(e)?e.length:e.childNodes.length))throw new o("INDEX_SIZE_ERR")}function V(e,t){if(j(e,!0)!==j(t,!0))throw new o("WRONG_DOCUMENT_ERR")}function X(e){if(z(e,!0))throw new o("NO_MODIFICATION_ALLOWED_ERR")}function q(e,t){if(!e)throw new o(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 Q(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"),$=!1;try{Z.innerHTML="<b>x</b>",$=3==Z.firstChild.nodeType}catch(e){}e.features.htmlParsingConforms=$;var J=$?function(e){var t=this.startContainer,i=u(t);if(!t)throw new o("INVALID_STATE_ERR");var r=null;return 1==t.nodeType?r=t:a(t)&&(r=n.parentElement(t)),(r=null===r||"HTML"==r.nodeName&&n.isHtmlNamespace(u(r).documentElement)&&n.isHtmlNamespace(r)?i.createElement("body"):r.cloneNode(!1)).innerHTML=e,n.fragmentFromNodeChildren(r)}:function(e){var t=b(this).createElement("body");return t.innerHTML=e,n.fragmentFromNodeChildren(t)};function ee(e,t){Q(e);var n=e.startContainer,i=e.startOffset,r=e.endContainer,o=e.endOffset,l=n===r;a(r)&&o>0&&o<r.length&&c(r,o,t),a(n)&&i>0&&i<n.length&&(n=c(n,i,t),l?(o-=i,r=n):r==n.parentNode&&o>=s(n)&&o++,i=0),e.setStartAndEnd(n,i,r,o)}function te(e){Q(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,re=1,oe=2,ae=3,se=0,le=1,ue=2,de=3;function ce(e){e.START_TO_START=ie,e.START_TO_END=re,e.END_TO_END=oe,e.END_TO_START=ae,e.NODE_BEFORE=se,e.NODE_AFTER=le,e.NODE_BEFORE_AND_AFTER=ue,e.NODE_INSIDE=de}function he(e){ce(e),ce(e.prototype)}function pe(e,t){return function(){Q(this);var n,i=this.startContainer,r=this.startOffset,o=this.commonAncestorContainer,a=new k(this,!0);i!==o&&(i=(n=w(h(i,o,!0))).node,r=n.offset),S(a,X),a.reset();var s=e(a);return a.detach(),t(this,i,r,i,r),s}}function fe(t,n){function r(e,t){return function(n){G(n,D),G(g(n),R);var i=(e?E:w)(n);(t?o:l)(this,i.node,i.offset)}}function o(e,t,i){var r=e.endContainer,o=e.endOffset;t===e.startContainer&&i===e.startOffset||(g(t)==g(r)&&1!=d(t,i,r,o)||(r=t,o=i),n(e,t,i,r,o))}function l(e,t,i){var r=e.startContainer,o=e.startOffset;t===e.endContainer&&i===e.endOffset||(g(t)==g(r)&&-1!=d(t,i,r,o)||(r=t,o=i),n(e,r,o,t,i))}var u=function(){};u.prototype=e.rangePrototype,t.prototype=new u,i.extend(t.prototype,{setStart:function(e,t){W(e,!0),U(e,t),o(this,e,t)},setEnd:function(e,t){W(e,!0),U(e,t),l(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],i=e[1],r=t,o=i;switch(e.length){case 3:o=e[2];break;case 4:r=e[2],o=e[3]}W(t,!0),U(t,i),W(r,!0),U(r,o),n(this,t,i,r,o)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:r(!0,!0),setStartAfter:r(!1,!0),setEndBefore:r(!0,!1),setEndAfter:r(!1,!1),collapse:function(e){Q(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){W(e,!0),n(this,e,0,e,p(e))},selectNode:function(e){W(e,!1),G(e,D);var t=E(e),i=w(e);n(this,t.node,t.offset,i.node,i.offset)},extractContents:pe(T,n),deleteContents:pe(M,n),canSurroundContents:function(){Q(this),X(this.startContainer),X(this.endContainer);var e=new k(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(){Q(this);var e,t=this.startContainer,i=this.startOffset,r=this.endContainer,o=this.endOffset,l=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(r=e,o=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==r)o+=i,r=t;else if(r==e.parentNode){var l=s(e);o==l?(r=e,o=a):o>l&&o--}}},d=!0;if(a(r))o==r.length?l(r):0==o&&(e=r.previousSibling)&&e.nodeType==r.nodeType&&(o=e.length,t==r&&(d=!1),e.appendData(r.data),m(r),r=e);else{if(o>0){var c=r.childNodes[o-1];c&&a(c)&&l(c)}d=!this.collapsed}if(d){if(a(t))0==i?u(t):i==t.length&&(e=t.nextSibling)&&e.nodeType==t.nodeType&&(r==e&&(r=t,o+=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=r,i=o;n(this,t,i,r,o)},collapseToPoint:function(e,t){W(e,!0),U(e,t),this.setStartAndEnd(e,t)},parentElement:function(){return Q(this),this.commonAncestorContainer?F(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,r,o){e.startContainer=t,e.startOffset=i,e.endContainer=r,e.endOffset=o,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,r,o;Q(this),V(this.startContainer,t.startContainer);var a=e==ae||e==ie?"start":"end",s=e==re||e==ie?"start":"end";return n=this[a+"Container"],i=this[a+"Offset"],r=t[s+"Container"],o=t[s+"Offset"],d(n,i,r,o)},insertNode:function(e){if(Q(this),G(e,I),X(this.startContainer),l(e,this.startContainer))throw new o("HIERARCHY_REQUEST_ERR");var t=C(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){var e,t;if(Q(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 k(this,!0);return e=_(n),n.detach(),e},canSurroundContents:function(){Q(this),X(this.startContainer),X(this.endContainer);var e=new k(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 o("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(){Q(this);for(var e,t=new me(b(this)),n=ne.length;n--;)t[e=ne[n]]=this[e];return t},toString:function(){Q(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 k(this,!0);return S(n,(function(e){3!=e.nodeType&&4!=e.nodeType||t.push(e.data)})),n.detach(),t.join("")},compareNode:function(e){Q(this);var t=e.parentNode,n=s(e);if(!t)throw new o("NOT_FOUND_ERR");var i=this.comparePoint(t,n),r=this.comparePoint(t,n+1);return i<0?r>0?ue:se:r>0?le:de},comparePoint:function(e,t){return Q(this),q(e,"HIERARCHY_REQUEST_ERR"),V(e,this.startContainer),d(e,t,this.startContainer,this.startOffset)<0?-1:d(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:J,toHtml:function(){return te(this)},intersectsNode:function(e,t){if(Q(this),g(e)!=x(this))return!1;var n=e.parentNode,i=s(e);if(!n)return!0;var r=d(n,i,this.endContainer,this.endOffset),o=d(n,i+1,this.startContainer,this.startOffset);return t?r<=0&&o>=0:r<0&&o>0},isPointInRange:function(e,t){return Q(this),q(e,"HIERARCHY_REQUEST_ERR"),V(e,this.startContainer),d(e,t,this.startContainer,this.startOffset)>=0&&d(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=d(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=d(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==d(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==d(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new o("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==de},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,p(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 Q(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),r=e.createRange(i);t=t||n.getBody(i),r.selectNodeContents(t);var o=this.intersection(r),a=0,s=0;return o&&(r.setEnd(o.startContainer,o.startOffset),s=(a=r.toString().length)+o.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,r,o,a,s=[t],l=!1,u=!1;!u&&(i=s.pop());)if(3==i.nodeType)r=n+i.length,!l&&e.start>=n&&e.start<=r&&(this.setStart(i,e.start-n),l=!0),l&&e.end>=n&&e.end<=r&&(this.setEnd(i,e.end-n),u=!0),n=r;else for(o=(a=i.childNodes).length;o--;)s.push(a[o])},getName:function(){return"DomRange"},equals:function(e){return me.rangesEqual(this,e)},isValid:function(){return Y(this)},inspect:function(){return O(this)},detach:function(){}}),fe(me,ve),i.extend(me,{rangeProperties:ne,RangeIterator:k,copyComparisonConstants:he,createPrototypeRange:fe,inspect:O,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})),w.createCoreModule("WrappedRange",["DomRange"],(function(e,t){var n,i,r=e.dom,o=e.util,a=r.DomPosition,s=e.DomRange,l=r.getBody,u=r.getContentDocument,d=r.isCharacterDataNode;if(e.features.implementsDomRange&&function(){var i,a,d=s.rangeProperties;function c(e){for(var t,n=d.length;n--;)e[t=d[n]]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function h(e,t,n,i,r){var o=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==i||e.endOffset!=r,s=!e.equals(e.nativeRange);(o||a||s)&&(e.setEnd(i,r),e.setStart(t,n))}n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,c(this)},s.createPrototypeRange(n,h),(i=n.prototype).selectNode=function(e){this.nativeRange.selectNode(e),c(this)},i.cloneContents=function(){return this.nativeRange.cloneContents()},i.surroundContents=function(e){this.nativeRange.surroundContents(e),c(this)},i.collapse=function(e){this.nativeRange.collapse(e),c(this)},i.cloneRange=function(){return new n(this.nativeRange.cloneRange())},i.refresh=function(){c(this)},i.toString=function(){return this.nativeRange.toString()};var p=document.createTextNode("test");l(document).appendChild(p);var f=document.createRange();f.setStart(p,0),f.setEnd(p,0);try{f.setStart(p,1),i.setStart=function(e,t){this.nativeRange.setStart(e,t),c(this)},i.setEnd=function(e,t){this.nativeRange.setEnd(e,t),c(this)},a=function(e){return function(t){this.nativeRange[e](t),c(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)}c(this)},i.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}c(this)},a=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(i){this.nativeRange[t](n),this.nativeRange[e](n)}c(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,r.getNodeLength(e))},f.selectNodeContents(p),f.setEnd(p,3);var g=document.createRange();g.selectNodeContents(p),g.setEnd(p,4),g.setStart(p,2),-1==f.compareBoundaryPoints(f.START_TO_END,g)&&1==f.compareBoundaryPoints(f.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),f.setStart(m,1),f.setEnd(m,2),f.deleteContents(),"13"==m.data&&(i.deleteContents=function(){this.nativeRange.deleteContents(),c(this)},i.extractContents=function(){var e=this.nativeRange.extractContents();return c(this),e}),y.removeChild(v),y=null,o.isHostMethod(f,"createContextualFragment")&&(i.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),l(document).removeChild(p),i.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return(e=u(e,t,"createNativeRange")).createRange()}}(),e.features.implementsTextRange){var c=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var i=n.parentElement();(n=e.duplicate()).collapse(!1);var o=n.parentElement(),a=i==o?i:r.getCommonAncestor(i,o);return a==t?a:r.getCommonAncestor(t,a)},h=function(e){return 0==e.compareEndPoints("StartToEnd",e)},p=function(e,t,n,i,o){var s=e.duplicate();s.collapse(n);var l=s.parentElement();if(r.isOrIsAncestorOf(t,l)||(l=t),!l.canHaveHTML){var u=new a(l.parentNode,r.getNodeIndex(l));return{boundaryPosition:u,nodeInfo:{nodeIndex:u.offset,containerElement:u.node}}}var c=r.getDocument(l).createElement("span");c.parentNode&&r.removeNode(c);for(var h,p,f,g,v,m=n?"StartToStart":"StartToEnd",y=o&&o.containerElement==l?o.nodeIndex:0,b=l.childNodes.length,x=b,E=x;E==b?l.appendChild(c):l.insertBefore(c,l.childNodes[E]),s.moveToElementText(c),0!=(h=s.compareEndPoints(m,e))&&y!=x;){if(-1==h){if(x==y+1)break;y=E}else x=x==y+1?y:E;E=Math.floor((y+x)/2),l.removeChild(c)}if(v=c.nextSibling,-1==h&&v&&d(v)){var w;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(w=C.moveStart("character",N);-1==(h=C.compareEndPoints("StartToEnd",C));)w++,C.moveStart("character",1)}else w=s.text.length;g=new a(v,w)}else p=(i||!n)&&c.previousSibling,g=(f=(i||n)&&c.nextSibling)&&d(f)?new a(f,0):p&&d(p)?new a(p,p.data.length):new a(l,r.getNodeIndex(c));return r.removeNode(c),{boundaryPosition:g,nodeInfo:{nodeIndex:E,containerElement:l}}},f=function(e,t){var n,i,o,a,s=e.offset,u=r.getDocument(e.node),c=l(u).createTextRange(),h=d(e.node);return h?i=(n=e.node).parentNode:(n=s<(a=e.node.childNodes).length?a[s]:null,i=e.node),(o=u.createElement("span")).innerHTML="&#feff;",n?i.insertBefore(o,n):i.appendChild(o),c.moveToElementText(o),c.collapse(!t),i.removeChild(o),h&&c[t?"moveStart":"moveEnd"]("character",s),c};(i=function(e){this.textRange=e,this.refresh()}).prototype=new s(document),i.prototype.refresh=function(){var e,t,n,i=c(this.textRange);h(this.textRange)?t=e=p(this.textRange,i,!0,!0).boundaryPosition:(e=(n=p(this.textRange,i,!0,!1)).boundaryPosition,t=p(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 f(new a(e.startContainer,e.startOffset),!0);var t=f(new a(e.startContainer,e.startOffset),!0),n=f(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)},o.createAliasForDeprecatedMethod(e,"createIframeRange","createRange"),o.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}))})),w.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(e,t){e.config.checkSelectionRanges=!0;var n,i,r="boolean",o="number",a=e.dom,s=e.util,l=s.isHostMethod,u=e.DomRange,d=e.WrappedRange,c=e.DOMException,h=a.DomPosition,p=e.features,f="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 Q)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 E(e){return b(e,"getDocSelection").document.selection}function w(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");p.implementsWinGetSelection=C,p.implementsDocSelection=N;var _=N&&(!C||e.config.preferTextRange);if(_)n=E,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"]);p.selectionHasAnchorAndFocus=A;var O=l(S,"extend");p.selectionHasExtend=O;var k=l(S,"setBaseAndExtent");p.selectionHasSetBaseAndExtent=k;var D=typeof S.rangeCount==o;p.selectionHasRangeCount=D;var R=!1,P=!0,I=O?function(t,n){var i=u.getRangeDocument(n),r=e.createRange(i);r.collapseToPoint(n.endContainer,n.endOffset),t.addRange(G(r)),t.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(S,["addRange","getRangeAt","removeAllRanges"])&&typeof S.rangeCount==o&&p.implementsDomRange&&function(){var t=window.getSelection();if(t){for(var n=t.rangeCount,i=n>1,r=[],o=w(t),s=0;s<n;++s)r[s]=t.getRangeAt(s);var l=a.createTestElement(document,"",!1),u=l.appendChild(document.createTextNode(" ")),d=document.createRange();if(d.setStart(u,1),d.collapse(!0),t.removeAllRanges(),t.addRange(d),P=1==t.rangeCount,t.removeAllRanges(),!i){var c=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(c&&parseInt(c[1])>=36)R=!1;else{var h=d.cloneRange();d.setStart(u,0),h.setEnd(u,3),h.setStart(u,2),t.addRange(d),t.addRange(h),R=2==t.rangeCount}}for(a.removeNode(l),t.removeAllRanges(),s=0;s<n;++s)0==s&&o?I?I(t,r[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(r[s])):t.addRange(r[s])}}(),p.selectionSupportsMultipleRanges=R,p.collapsedNonEditableSelectionsSupported=P;var L,B,j=!1;function z(e,t,n){var i=n?"end":"start",r=n?"start":"end";e.anchorNode=t[i+"Container"],e.anchorOffset=t[i+"Offset"],e.focusNode=t[r+"Container"],e.focusOffset=t[r+"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 F(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0,W(e)}function W(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 d?n=t.nativeRange:p.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 V(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 q(e,t){var n=new d(t);e._ranges=[n],z(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed,W(e)}function K(t){if(t._ranges.length=0,"None"==t.docSelection.type)F(t);else{var n=t.docSelection.createRange();if(X(n))q(t,n);else{t.rangeCount=n.length;for(var i,r=g(n.item(0)),o=0;o<t.rangeCount;++o)(i=e.createRange(r)).selectNode(n.item(o)),t._ranges.push(i);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed,z(t,t._ranges[t.rangeCount-1],!1),W(t)}}}function Y(e,n){for(var i=e.docSelection.createRange(),r=V(n),o=g(i.item(0)),a=v(o).createControlRange(),s=0,l=i.length;s<l;++s)a.add(i.item(s));try{a.add(r)}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 Q(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,W(e)}T&&l(T,"createControlRange")&&(L=T.createControlRange(),s.areHostProperties(L,["item","add"])&&(j=!0)),p.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}),Q.prototype=e.selectionPrototype;var $=[];function J(e,t){for(var n,i,r=$.length;r--;)if(i=(n=$[r]).selection,"deleteAll"==t)Z(i);else if(n.win==e)return"delete"==t?($.splice(r,1),!0):i;return"deleteAll"==t&&($.length=0),null}var ee=function(e){if(e&&e instanceof Q)return e.refresh(),e;var t=J(e=b(e,"getNativeSelection")),i=n(e),r=N?E(e):null;return t?(t.nativeSelection=i,t.docSelection=r,t.refresh()):(t=new Q(i,r,e),$.push({win:e,selection:t})),t};e.getSelection=ee,s.createAliasForDeprecatedMethod(e,"getIframeSelection","getSelection");var te,ne=Q.prototype;function ie(e,n){for(var i,r=g(n[0].startContainer),o=v(r).createControlRange(),a=0,s=n.length;a<s;++a){i=V(n[a]);try{o.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?)")}}o.select(),K(e)}if(!_&&A&&s.areHostMethods(S,["removeAllRanges","addRange"])){ne.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),F(this)};var re=function(e,t){I(e.nativeSelection,t),e.refresh()};ne.addRange=D?function(t,n){if(j&&N&&this.docSelection.type==f)Y(this,t);else if(y(n)&&O)re(this,t);else{var r;R?r=this.rangeCount:(this.removeAllRanges(),r=0);var o=G(t).cloneRange();try{this.nativeSelection.addRange(o)}catch(e){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==r+1){if(e.config.checkSelectionRanges){var a=B(this.nativeSelection,this.rangeCount-1);a&&!m(a,t)&&(t=new d(a))}this._ranges[this.rangeCount-1]=t,z(this,t,oe(this.nativeSelection)),this.isCollapsed=i(this),W(this)}else this.refresh()}}:function(e,t){y(t)&&O?re(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==f){var t=this.docSelection.createRange();t.length&&(e=g(t.item(0)))}e&&(v(e).createTextRange().select(),this.docSelection.empty())}}catch(e){}F(this)},ne.addRange=function(t){this.docSelection.type==f?Y(this,t):(e.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,z(this,t,!1),W(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 c("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==f?K(t):X(n)?q(t,n):F(t)};else if(l(S,"getRangeAt")&&typeof S.rangeCount==o)te=function(t){if(j&&N&&t.docSelection.type==f)K(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,r=t.rangeCount;n<r;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));z(t,t._ranges[t.rangeCount-1],oe(t.nativeSelection)),t.isCollapsed=i(t),W(t)}else F(t)};else{if(!A||typeof S.isCollapsed!=r||typeof M.collapsed!=r||!p.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),W(e)):F(e)}}ne.refresh=function(e){var t=e?this._ranges.slice(0):null,n=this.anchorNode,i=this.anchorOffset;if(te(this),e){var r=t.length;if(r!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=i)return!0;for(;r--;)if(!m(t[r],this._ranges[r]))return!0;return!1}};var oe,ae=function(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var i=0,r=n.length;i<r;++i)m(t,n[i])||e.addRange(n[i]);e.rangeCount||F(e)};function se(e,t){if(e.win.document!=g(t))throw new c("WRONG_DOCUMENT_ERR")}function le(e,t){if(t<0||t>(a.isCharacterDataNode(e)?e.length:e.childNodes.length))throw new c("INDEX_SIZE_ERR")}function ue(t){return function(n,i){var r;this.rangeCount?(r=this.getRangeAt(0))["set"+(t?"Start":"End")](n,i):(r=e.createRange(this.win.document)).setStartAndEnd(n,i),this.setSingleRange(r,this.isBackward())}}function de(e){var t=[],n=new h(e.anchorNode,e.anchorOffset),i=new h(e.focusNode,e.focusOffset),r="function"==typeof e.getName?e.getName():"Selection";if(void 0!==e.rangeCount)for(var o=0,a=e.rangeCount;o<a;++o)t[o]=u.inspect(e.getRangeAt(o));return"["+r+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}ne.removeRange=j&&N?function(e){if(this.docSelection.type==f){for(var t=this.docSelection.createRange(),n=V(e),i=g(t.item(0)),r=v(i).createControlRange(),o=!1,a=0,s=t.length;a<s;++a)t.item(a)!==n||o?r.add(t.item(a)):o=!0;r.select(),K(this)}else ae(this,e)}:function(e){ae(this,e)},!_&&A&&p.implementsDomRange?(oe=w,ne.isBackward=function(){return oe(this)}):oe=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 c("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},ne.collapseToEnd=function(){if(!this.rangeCount)throw new c("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)},k?ne.setBaseAndExtent=function(e,t,n,i){this.nativeSelection.setBaseAndExtent(e,t,n,i),this.refresh()}:O&&(ne.setBaseAndExtent=function(t,n,i,r){le(t,n),le(i,r),se(this,t),se(this,i);var o=e.createRange(node),s=-1==a.comparePoints(t,n,i,r);s?o.setStartAndEnd(i,r,t,n):o.setStartAndEnd(t,n,i,r),this.setSingleRange(o,s)}),ne.deleteFromDocument=function(){if(j&&N&&this.docSelection.type==f){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,r=n.length;i<r;++i)n[i].deleteContents();this.addRange(n[r-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,r=[],o=0;n=t.rangeBookmarks[o++];)(i=e.createRange(this.win)).moveToBookmark(n),r.push(i);t.backward?this.setSingleRange(r[0],"backward"):this.setRanges(r)},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("")},p.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 de(this)},ne.detach=function(){J(this.win,"delete"),Z(this)},Q.detachAll=function(){J(null,"deleteAll")},Q.inspect=de,Q.isDirectionBackward=y,e.Selection=Q,e.selectionPrototype=ne,e.addShimListener((function(e){void 0===e.getSelection&&(e.getSelection=function(){return ee(e)}),e=null}))}));var j=!1,z=function(e){j||(j=!0,!w.initialized&&w.config.autoInitialize&&A())};return x&&("complete"==document.readyState?z():(s(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",z,!1),m(window,"load",z))),w}()}({get exports(){return Fb},set exports(e){Fb=e}});var Wb=Fb,Gb={};!function(e){e.exports=function(e){return e.createModule("ClassApplier",["WrappedSelection"],(function(e,t){var n=e.dom,i=n.DomPosition,r=n.arrayContains,o=e.util,a=o.forEach,s="span",l=o.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 d(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function c(e,t){return!!e&&new RegExp("(?:^|\\s)"+t+"(?:\\s|$)").test(e)}function h(e,t){return"object"==typeof e.classList?e.classList.contains(t):c("string"==typeof e.className?e.className:e.getAttribute("class"),t)}function p(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?c(i,t)||(i+=" "+t):i=t,n?e.className=i:e.setAttribute("class",i)}}var f=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,r=i?t.className:t.getAttribute("class");r=r.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),e),i?t.className=r:t.setAttribute("class",r)}}}();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,r=n.length;i<r;++i)if(!h(e,d(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 E(e,t,n,i,r){var o=e.node,a=e.offset,s=o,l=a;o==i&&a>r&&++l,o!=t||a!=n&&a!=n+1||(s=i,l+=r-n),o==t&&a>n+1&&--l,e.node=s,e.offset=l}function w(e,t,n){e.node==t&&e.offset>n&&--e.offset}function C(e,t,i,r){-1==i&&(i=t.childNodes.length);var o=e.parentNode,s=n.getNodeIndex(e);a(r,(function(e){E(e,o,s,t,i)})),t.childNodes.length==i?t.appendChild(e):t.insertBefore(e,t.childNodes[i])}function N(e,t){var i=e.parentNode,r=n.getNodeIndex(e);a(t,(function(e){w(e,i,r)})),n.removeNode(e)}function _(e,t,n,i,r){for(var o,a=[];o=e.firstChild;)C(o,t,n++,r),a.push(o);return N(e,r),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 r=n.length-1;(t=n[r])&&!M(e,t);)--r;return n.slice(i,r+1)}function A(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n,i,r,o=0,a=e.attributes.length;o<a;++o)if("class"!=(r=(n=e.attributes[o]).name)){if(null===n!=(null===(i=t.attributes.getNamedItem(r))))return!1;if(n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}function O(e,t){for(var n,i=0,o=e.attributes.length;i<o;++i)if(n=e.attributes[i].name,(!t||!r(t,n))&&e.attributes[i].specified&&"class"!=n)return!0;return!1}var k=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 R(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))&&!R(e)}var I=/^inline(-block|-table)?$/i;function L(e){return e&&1==e.nodeType&&!I.test(k(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(k(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 z(e){var t,n,r=[];for(t=0;n=e[t++];)r.push(new i(n.startContainer,n.startOffset),new i(n.endContainer,n.endOffset));return r}function H(e,t){for(var n,i,r,o=0,a=e.length;o<a;++o)n=e[o],i=t[2*o],r=t[2*o+1],n.setStartAndEnd(i.node,i.offset,r.node,r.offset)}function F(e,t){return n.isCharacterDataNode(e)?0==t?!!e.previousSibling:t!=e.length||!!e.nextSibling:t>0&&t<e.childNodes.length}function W(e,i,r,o){var a,s,l=0==r;if(n.isAncestorOf(i,e))return e;if(n.isCharacterDataNode(i)){var u=n.getNodeIndex(i);if(0==r)r=u;else{if(r!=i.length)throw t.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+r+" in "+i.data);r=u+1}i=i.parentNode}if(F(i,r)){a=i.cloneNode(!1),s=i.parentNode,a.id&&a.removeAttribute("id");for(var d,c=0;d=i.childNodes[r];)C(d,a,c++,o);return C(a,s,n.getNodeIndex(i)+1,o),i==e?a:W(e,s,n.getNodeIndex(a),o)}if(e!=i){a=i.parentNode;var h=n.getNodeIndex(i);return l||h++,W(e,a,h,o)}return e}function G(e,t){return e.namespaceURI==t.namespaceURI&&e.tagName.toLowerCase()==t.tagName.toLowerCase()&&y(e,t)&&A(e,t)&&"inline"==k(e,"display")&&"inline"==k(t,"display")}function U(e){var t=e?"nextSibling":"previousSibling";return function(n,i){var r=n.parentNode,o=n[t];if(o){if(o&&3==o.nodeType)return o}else if(i&&(o=r[t])&&1==o.nodeType&&G(r,o)){var a=o[e?"firstChild":"lastChild"];if(a&&3==a.nodeType)return a}return null}}var V=U(!1),X=U(!0);function q(e){this.isElementMerge=1==e.nodeType,this.textNodes=[];var t=this.isElementMerge?e.lastChild:e;t&&(this.textNodes[0]=t)}q.prototype={doMerge:function(e){var t=this.textNodes,i=t[0];if(t.length>1){var r,o=n.getNodeIndex(i),s=[],l=0;a(t,(function(u,d){r=u.parentNode,d>0&&(r.removeChild(u),r.hasChildNodes()||n.removeNode(r),e&&a(e,(function(e){e.node==u&&(e.node=i,e.offset+=l),e.node==r&&e.offset>o&&(--e.offset,e.offset==o+1&&d<t.length-1&&(e.node=i,e.offset=l))}))),s[d]=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 Q(e,t,n){var i,r,o,a,s=this;s.cssClass=s.className=e;var l=null,c={};if("object"==typeof t&&null!==t){for(void 0!==t.elementTagName&&(t.elementTagName=t.elementTagName.toLowerCase()),n=t.tagNames,l=t.elementProperties,c=t.elementAttributes,r=0;a=K[r++];)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(c,(function(e,t){s.attrExceptions.push(e),c[e]=""+t})),s.elementAttributes=c,s.elementSortedClassName=s.elementProperties.hasOwnProperty("className")?v(s.elementProperties.className+" "+e):e,s.applyToAnyTagName=!1;var p=typeof n;if("string"==p)"*"==n?s.applyToAnyTagName=!0:s.tagNames=d(n.toLowerCase()).split(/\s*,\s*/);else if("object"==p&&"number"==typeof n.length)for(s.tagNames=[],r=0,o=n.length;r<o;++r)"*"==n[r]?s.applyToAnyTagName=!0:s.tagNames.push(n[r].toLowerCase());else s.tagNames=[s.elementTagName]}function Z(e,t,n){return new Q(e,t,n)}Q.prototype={elementTagName:s,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(e,t,n){var i,r,o,a,s,l,u={};for(var d in e)if(e.hasOwnProperty(d))if(a=e[d],s=t[d],"className"==d)p(t,a),p(t,this.className),t[d]=v(t[d]),n&&(u[d]=a);else if("style"==d){for(i in r=s,n&&(u[d]=o={}),e[d])e[d].hasOwnProperty(i)&&(r[i]=a[i],n&&(o[i]=r[i]));this.attrExceptions.push(d)}else t[d]=a,n&&(u[d]=t[d],l=Y.hasOwnProperty(d)?Y[d]:d,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 r(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 r,o,s=e[0],l=e[e.length-1],u=[],d=s,c=l,h=0,p=l.length;a(e,(function(e){(o=V(e,!i))?(r||(r=new q(o),u.push(r)),r.textNodes.push(e),e===s&&(d=r.textNodes[0],h=d.length),e===l&&(c=r.textNodes[0],p=r.getLength())):r=null}));var f=X(l,!i);if(f&&(r||(r=new q(l),u.push(r)),r.textNodes.push(f)),u.length){for(var g=0,v=u.length;g<v;++g)u[g].doMerge(n);t.setStartAndEnd(d,h,c,p)}},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),p(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))p(n,this.className);else{var i=e.parentNode,r=this.createContainer(i);i.insertBefore(r,e),r.appendChild(e)}}},isRemovable:function(e){return e.tagName.toLowerCase()==this.elementTagName&&m(e)==this.elementSortedClassName&&this.elementHasProperties(e,this.elementProperties)&&!O(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],r=z(i);a(n,(function(e){N(e,r)})),H(i,r)},undoToTextNode:function(e,t,n,i){if(!t.containsNode(n)){var r=t.cloneRange();r.selectNode(n),r.isPointInRange(t.endContainer,t.endOffset)&&(W(n,t.endContainer,t.endOffset,i),t.setEndAfter(n)),r.isPointInRange(t.startContainer,t.startOffset)&&(n=W(n,t.startContainer,t.startOffset,i))}this.isRemovable(n)?S(n,i):f(n,this.className)},splitAncestorWithClass:function(e,t,n){var i=this.getSelfOrAncestorWithClass(e);i&&W(i,e,t,n)},undoToAncestor:function(e,t){this.isRemovable(e)?S(e,t):f(e,this.className)},applyToRange:function(e,t){var n=this,i=z((t=t||[])||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e);var r=T(e);if(r.length){a(r,(function(e){n.isIgnorableWhiteSpaceNode(e)||n.getSelfOrAncestorWithClass(e)||!n.isModifiable(e)||n.applyToTextNode(e,i)}));var o=r[r.length-1];e.setStartAndEnd(r[0],0,o,o.length),n.normalize&&n.postApply(r,e,i,!1),H(t,i)}var s=n.getEmptyElements(e);a(s,(function(e){p(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=z(t=t||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e,i);var r,o,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,d=s.length;u<d;++u)r=s[u],(o=n.getSelfOrAncestorWithClass(r))&&n.isModifiable(r)&&n.undoToAncestor(o,i);e.setStartAndEnd(s[0],0,l,l.length),n.normalize&&n.postApply(s,e,i,!0),H(t,i)}var c=n.getEmptyElements(e);a(c,(function(e){f(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&&!r(t,i)&&t.push(i)})),t},detach:function(){}},Q.util={hasClass:h,addClass:p,removeClass:f,getClass:g,hasSameClasses:y,hasAllClasses:b,replaceWithOwnChildren:S,elementsHaveSameNonClassAttributes:A,elementHasNonClassAttributes:O,splitNodeAt:W,isEditableElement:D,isEditingHost:R,isEditable:P},e.CssClassApplier=e.ClassApplier=Q,e.createClassApplier=Z,o.createAliasForDeprecatedMethod(e,"createCssClassApplier","createClassApplier",t)})),e}(Fb)}({get exports(){return Gb},set exports(e){Gb=e}});var Ub={toolbar:{allowMultiParagraphSelection:!0,buttons:["bold","colorpicker","italic","underline","strikethrough","quote","justifyLeft","justifyCenter","justifyRight","justifyFull","superscript","subscript","orderedlist","unorderedlist","pre","removeFormat","outdent","indent","h2","h3"],standardizeSelectionStart:!1,updateOnEmptySelection:!1},placeholder:{text:"请输入内容",hideOnClick:!0},disableEditing:!0};function Vb(e){var t,n,i=(null===(t=null==e?void 0:e.extensions)||void 0===t?void 0:t.button)||(null===(n=null==e?void 0:e.extensions)||void 0===n?void 0:n.button),r=(null==e?void 0:e.Extension)||(null==e?void 0:e.Extension),o=i||r;return o?o.extend({name:"colorpicker",tagNames:["mark"],contentDefault:"<b>Color</b>",aria:"Color Picker",action:"colorPicker",init:function(){var e,t,n=this;try{Wb.init()}catch(e){}try{null===(t=null===(e=null==i?void 0:i.prototype)||void 0===e?void 0:e.init)||void 0===t||t.call(this)}catch(e){}this.colorPicker=new zb({parent:this.button||void 0,color:"#000",onDone:function(e){var t,i,r,o,a;try{n.coloredText&&(null===(i=(t=n.coloredText).isAppliedToSelection)||void 0===i?void 0:i.call(t))&&n.coloredText.undoToSelection(),n.coloredText=Wb.createClassApplier("colored",{elementTagName:"span",elementProperties:{style:{color:e.hex}},normalize:!0}),n.coloredText.toggleSelection(),null===(o=null===(r=n.base)||void 0===r?void 0:r.checkContentChanged)||void 0===o||o.call(r),null===(a=n.setInactive)||void 0===a||a.call(n)}catch(e){}}})},getButton:function(){return this.button},handleClick:function(){var e,t,n;null===(e=this.setActive)||void 0===e||e.call(this),null===(n=null===(t=this.colorPicker)||void 0===t?void 0:t.show)||void 0===n||n.call(t)},isAlreadyApplied:function(e){var t,n;return"mark"===(null===(n=null===(t=null==e?void 0:e.nodeName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t))},isActive:function(){var e,t;return null===(t=null===(e=this.button)||void 0===e?void 0:e.classList)||void 0===t?void 0:t.contains("medium-editor-button-active")},setInactive:function(){var e,t;null===(t=null===(e=this.button)||void 0===e?void 0:e.classList)||void 0===t||t.remove("medium-editor-button-active")},setActive:function(){var e,t;null===(t=null===(e=this.button)||void 0===e?void 0:e.classList)||void 0===t||t.add("medium-editor-button-active")}}):function(){}}var Xb=function(e){function n(t){var n=e.call(this,t)||this;n.labelMap=new Map;var i=t.lf,r=t.graphModel;return n.lf=i,n.graphModel=r,n.state={tick:0},n}return m(n,e),n.prototype.componentDidMount=function(){var e=this,t=this.props.graphModel;this.editor=new _b(".lf-label-editor",wc(Ub,{autoLink:!0,extensions:{colorPicker:new(Vb(_b))}})),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 _b(".lf-label-editor",wc(Ub,{autoLink:!0,extensions:{colorPicker:new(Vb(_b))}})))},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,r=_(_([],N(i.nodes),!1),N(i.edges),!1);if(n.label){var o=[];return _u(r,(function(t){var n,r;_u(null!==(r=null===(n=t.getData().properties)||void 0===n?void 0:n._label)&&void 0!==r?r:[],(function(n){var r=e.labelMap,a=new Cb(n,t,i);r.set(a.id,a),o.push(Bf(Eb,{label:a,element:t,graphModel:i},a.id))}))})),o}return null},n.prototype.render=function(){return Bf("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},n.toolName="label-edit-tool",n=x([t.observer],n)}(t.Component),qb=function(){function e(e){var n,i,r,o=e.lf,a=e.options;this.labelInitPositionMap=new Map,this.lf=o,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!==(r=a.maxCount)&&void 0!==r?r:1/0,o.graphModel.editConfigModel.updateTextMode(t.TextMode.LABEL),this.addEventListeners(),this.rewriteShortcut(),o.tool.registerTool(Xb.toolName,Xb),o.tool.disableTool("text-edit-tool")}return e.prototype.formatConfig=function(e,n){var i=e.editConfigModel,r=i.nodeTextEdit,o=i.edgeTextEdit,a=i.nodeTextDraggable,s=i.edgeTextDraggable,l=this,u=l.textOverflowMode,d=l.isMultiple,c=l.maxCount,h=l.labelWidth,p=n.text,f=n.zIndex,g=n.properties,v=g._label,m=g._labelOption,b=v,x=void 0===m?{}:m,E=x.isMultiple,w=x.maxCount,C=[];if(at(b)){var N=null!=w?w:c;C=d&&E?b.length>N?b.slice(0,N):b:[b[0]]}else if(mt(b))C=[b];else if("string"==typeof b||!b){var _=y(y({},p),{content:b||(null==p?void 0:p.value),draggable:"edge"===n.BaseType?s:a});C=_.value?[_]:[]}return"edge"===n.BaseType&&(C=id(C,(function(e){return e}))),id(C,(function(e){e.id||(e.id=t.createUuid());var i=e.value,l=e.content,d=e.vertical,c=e.editable,p=e.draggable,g=e.textOverflowMode,v="node"===n.BaseType?r:o,m="node"===n.BaseType?a:s;return y(y({},e),{zIndex:f,labelWidth:h,content:null!=l?l:i,vertical:null!=d&&d,editable:Boolean(v)&&c,draggable:Boolean(m)&&p,textOverflowMode:null!=g?g:u})}))},e.prototype.setupLabels=function(e){var t=this;_u(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,r,o,a=this.isMultiple,s=this.maxCount,l=e.properties,u=null!==(i=l._label)&&void 0!==i?i:[],d=null!==(r=l._labelOption)&&void 0!==r?r:{},c=u.length,h={id:t.createUuid(),x:n.x,y:n.y,content:"Label".concat(c+1),value:"Label".concat(c+1),style:{},draggable:!0,editable:!0,vertical:!1};!a||a&&!1===d.isMultiple||c>=(null!==(o=null==d?void 0:d.maxCount)&&void 0!==o?o:s)||(u.push(h),e.setProperty("_label",u))},e.prototype.addEventListeners=function(){var e=this,n=this.lf.graphModel,i=n.eventCenter,r=n.editConfigModel;i.on("graph:rendered",(function(t){var n=t.graphModel;e.setupLabels(n)})),i.on("node:dbclick,edge:dbclick",(function(i){var o=i.e,a=i.data,s=n.getElement(a.id),l=n.getPointByClient({x:o.clientX,y:o.clientY}).canvasOverlayPosition,u={x:l.x,y:l.y};s&&r.textMode===t.TextMode.LABEL&&e.addLabel(s,u)})),i.on("node:resize",(function(e){var t,n,i=e.preData,r=e.data,o=e.model,a=null!==(t=i.properties)&&void 0!==t?t:{},s=a.width,l=a.height,u=a._label,d=void 0===u?[]:u,c=null!==(n=r.properties)&&void 0!==n?n:{},h=c.width,p=c.height;if(s&&l&&h&&p){var f={x:i.x,y:i.y,width:s,height:l},g={x:r.x,y:r.y,width:h,height:p},v=id(d,(function(e){var t,n,i,r,o,a,s,l,u,d,c,h=e.x,p=e.y,v=(n=g,i={x:h,y:p},r=(t=f).x,o=t.y,a=t.width,s=t.height,l=n.x,u=n.y,d=n.width,c=n.height,{x:l+(i.x-r)/a*d,y:u+(i.y-o)/s*c});return y(y({},e),v)}));o.setProperty("_label",v)}})),i.on("node:rotate",(function(t){var n=t.model,i=n.x,r=n.y,o=n.rotate,a=n.properties._label,s={x:i,y:r},l=id(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=o*(180/Math.PI);i<0&&(i+=360);var r=i*(Math.PI/180),a=nb(n,s,r);return y(y(y({},t),a),{rotate:i})}));n.setProperty("_label",l)})),i.on("node:dnd-add,node:add,edge:add",(function(t){var i=t.data,r=n.getElement(i.id);if(r){e.rewriteInnerMethods(r);var o=r.properties._label;if(!at(o)||0===o.length||!o[0].id){var a=e.formatConfig(n,i);r.setProperty("_label",a)}}}))},e.prototype.rewriteInnerMethods=function(e){e.moveText=function(t,n){if(e.text){var i=e.text,r=i.x,o=i.y,a=i.value,s=i.draggable,l=i.editable;e.text={value:a,editable:l,draggable:s,x:r+t,y:o+n};var u=Fs(e.getProperties());if(at(u._label)){var d=id(u._label,(function(e){return y(y({},e),{x:e.x+t,y:e.y+n})}));null==e||e.setProperty("_label",d)}}}},e.prototype.rewriteShortcut=function(){var e=this,n=this.lf,i=n.keyboard,r=n.graphModel,o=i.options.keyboard;i.off(["backspace"]),i.on(["backspace"],(function(){if(!(null==o?void 0:o.enabled))return!0;if(r.textEditElement)return!0;var n=r.getSelectElements(!0);e.lf.clearSelectElements();var i=e.lf.graphModel.editConfigModel;return n.edges.forEach((function(n){var o=n.properties;if(o&&!Qd(o._label)&&i.textMode===t.TextMode.LABEL){var a=o._label.filter((function(e){return!e.isSelected}));if(!Zd(a.length,o._label.length)){var s=r.getEdgeModelById(n.id);return void(null==s||s.setProperty("_label",a))}}n.id&&e.lf.deleteEdge(n.id)})),n.nodes.forEach((function(n){var o=n.properties;if(o&&!Qd(o._label)&&i.textMode===t.TextMode.LABEL){var a=o._label.filter((function(e){return!e.isSelected}));if(!Zd(a.length,o._label.length)){var s=r.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(Xb.toolName),this.lf.tool.disableTool("text-edit-tool")):e===t.TextMode.TEXT&&(this.lf.tool.enableTool("text-edit-tool"),this.lf.tool.disableTool(Xb.toolName)))},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="label",e}(),Kb={};function Yb(e){return e.startsWith("data:text/plain")}function Qb(e){return E(this,void 0,void 0,(function(){return w(this,(function(t){return Kb[e]?[2,Kb[e]]:[2,new Promise((function(t,n){try{fetch(e).then((function(e){return e.blob()})).then((function(i){var r=new FileReader;r.onloadend=function(){t(Kb[e]=r.result)},r.onerror=n,r.readAsDataURL(i)})).catch((function(){t(Kb[e]=e)}))}catch(t){return Kb[e]=e}}))]}))}))}function Zb(e,t){return E(this,void 0,void 0,(function(){var n,i;return w(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(n=e.getAttribute(t)||"").startsWith("data:")?[2]:[4,Qb(n)];case 1:return Yb(i=r.sent())?[2]:(e.setAttribute(t,i),[3,3]);case 2:return r.sent(),[3,3];case 3:return[2]}}))}))}function $b(e,t){return E(this,void 0,void 0,(function(){var n;return w(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t.startsWith("data:")?[2]:[4,Qb(t)];case 1:return Yb(n=i.sent())?[2]:(e.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return i.sent(),[3,3];case 3:return[2]}}))}))}function Jb(e){return E(this,void 0,void 0,(function(){var t,n,i,r,o,a,s,l,u;return w(this,(function(d){switch(d.label){case 0:for(t=[e],i=[];t.length;)(n=t.shift()).children.length&&t.push.apply(t,_([],N(n.children),!1)),n instanceof HTMLElement&&(r=n.style,o=r.background,a=r.backgroundImage,(s=o.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(u=s[1],i.push($b(n,u))),(l=a.match(/url\(["']?(.*?)["']?\)/))&&l[1]&&(u=l[1],i.push($b(n,u)))),n instanceof HTMLImageElement?i.push(Zb(n,"src")):n instanceof SVGImageElement&&i.push(Zb(n,"href"));return[4,Promise.all(i)];case 1:return d.sent(),[2]}}))}))}function ex(e,t,n){var i=document.createElement("canvas");i.width=t,i.height=n;var r=i.getContext("2d");return r&&r.drawImage(e,0,0,e.width,e.height,0,0,t,n),i}var tx=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.customCssRules="",this.useGlobalRules=!0,t.getSnapshot=function(e,t){return E(n,void 0,void 0,(function(){return w(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 E(n,void 0,void 0,(function(){return w(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 E(n,void 0,void 0,(function(){return w(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 r=t[i];(r.classList&&Array.from(r.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 r=t[i];(r.classList&&Array.from(r.classList)||[]).indexOf("lf-rotate-control")>-1&&(e.removeChild(e.childNodes[i]),n--,i--)}},e.prototype.convertImageToBase64=function(e){return E(this,void 0,void 0,(function(){return w(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 r=e.toDataURL("image/png");t(r)},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 E(this,void 0,void 0,(function(){var t,n,i,r,o,a,s,l,u,d;return w(this,(function(c){switch(c.label){case 0:t=e.getElementsByTagName("image"),r=0,c.label=1;case 1:if(!(r<t.length))return[3,6];if(l=t[r],!(n=l.getAttributeNS("http://www.w3.org/1999/xlink","href")||l.getAttribute("href"))||!this.isRelativePath(n))return[3,5];c.label=2;case 2:return c.trys.push([2,4,,5]),[4,this.convertImageToBase64(n)];case 3:return d=c.sent(),l.setAttributeNS("http://www.w3.org/1999/xlink","href",d),l.setAttribute("href",d),[3,5];case 4:return c.sent(),[3,5];case 5:return r++,[3,1];case 6:i=e.getElementsByTagName("foreignObject"),r=0,c.label=7;case 7:if(!(r<i.length))return[3,14];o=i[r],a=o.getElementsByTagName("img"),s=0,c.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];c.label=9;case 9:return c.trys.push([9,11,,12]),[4,this.convertImageToBase64(u)];case 10:return d=c.sent(),l.setAttribute("src",d),[3,12];case 11:return c.sent(),[3,12];case 12:return s++,[3,8];case 13:return r++,[3,7];case 14:return[2]}}))}))},e.prototype.cloneSvg=function(e){return E(this,arguments,void 0,(function(e,t){var n,i,r,o,a,s,l,u,d,c,h=this;return void 0===t&&(t=!0),w(this,(function(p){switch(p.label){case 0:if(n=e.cloneNode(!0),i=n.lastChild,r=null===(c=null==i?void 0:i.childNodes)||void 0===c?void 0:c.length)for(o=0;o<r;o++)a=null==i?void 0:i.childNodes[o],(s=a.classList&&Array.from(a.classList))&&s.indexOf("lf-base")<0?(null==i||i.removeChild(i.childNodes[o]),r--,o--):(l=null==i?void 0:i.childNodes[o])&&l.childNodes.forEach((function(e){var t=e;h.removeAnchor(t.firstChild),h.removeRotateControl(t.firstChild)}));return[4,this.processImages(n)];case 1:return p.sent(),t&&((u=document.createElement("style")).innerHTML=this.getClassRules(),(d=document.createElement("foreignObject")).appendChild(u),n.appendChild(d)),[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 r=0;r<i.cssRules.length;r++)e+=i.cssRules[r].cssText}catch(e){}}return this.customCssRules&&(e+=this.customCssRules),e},e.prototype.getCanvasScaleRatio=function(e,t){var n=32767,i=268435456,r=e*t;if(e<=n&&t<=n&&r<=i)return 1;var o=n/e,a=n/t,s=i/r;return Math.min(o,a,s)},e.prototype.getCanvasData=function(e,t){return E(this,void 0,void 0,(function(){var n,i,r,o,a,s,l,u,d,c,h,p,f,g,v,m,y,b,x,E,C,N,_,S,M,T,A,O,k,D,R,P,I,L,B;return w(this,(function(w){switch(w.label){case 0:return n=t.width,i=t.height,r=t.backgroundColor,o=t.padding,a=void 0===o?40:o,[4,this.cloneSvg(e,!1)];case 1:return s=w.sent(),(l=window.devicePixelRatio||1)<1&&(l=1),u=this.lf.graphModel.rootEl.querySelector(".lf-base"),d=u.getBoundingClientRect(),c=this.lf.container.querySelector(".lf-canvas-overlay"),h=c.getBoundingClientRect(),p=d.x-h.x,f=d.y-h.y,g=this.lf.graphModel,v=g.transformModel,m=v.SCALE_X,y=v.SCALE_Y,b=v.TRANSLATE_X,x=v.TRANSLATE_Y,E=t.safetyFactor||1,C=d.width/m,N=d.height/y,_=C*(E-1),S=N*(E-1),M=Math.ceil(C+_),T=Math.ceil(N+S),(A=document.createElement("canvas")).style.width="".concat(M,"px"),A.style.height="".concat(T,"px"),O=t.safetyMargin||0,k=M*l,D=T*l,(R=this.getCanvasScaleRatio(k,D))<1&&(k=Math.floor(k*R),D=Math.floor(D*R)),s.lastChild.style.transform="matrix(".concat(R,", 0, 0, ").concat(R,", ").concat((-p+b)*(1/m)*R+a+_/2+O,", ").concat((-f+x)*(1/y)*R+a+S/2+O,")"),A.width=k+2*(a+O)*l,A.height=D+2*(a+O)*l,(P=A.getContext("2d"))&&(P.clearRect(0,0,A.width,A.height),P.scale(l,l),r?(P.fillStyle=r,P.fillRect(0,0,A.width,A.height)):P.clearRect(0,0,A.width,A.height)),I=new Image,(L=document.createElement("style")).innerHTML=this.getClassRules(),(B=document.createElement("foreignObject")).appendChild(L),s.appendChild(B),[2,new Promise((function(e){I.onload=function(){var t=navigator.userAgent.indexOf("Firefox")>-1;try{t?createImageBitmap(I,{resizeWidth:n&&i?ex(A,n,i).width:A.width,resizeHeight:n&&i?ex(A,n,i).height:A.height}).then((function(t){null==P||P.drawImage(t,0,0),e(n&&i?ex(A,n,i):A)})):(null==P||P.drawImage(I,0,0),e(n&&i?ex(A,n,i):A))}catch(t){null==P||P.drawImage(I,0,0),e(n&&i?ex(A,n,i):A)}};var t="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(s)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");I.src=t}))]}}))}))},e.prototype.withExportPreparation=function(e,t){return E(this,void 0,void 0,(function(){var n,i,r,o,a,s=this;return w(this,(function(l){switch(l.label){case 0:n=this.lf.graphModel.getPartial(),i=(null!=t?t:{}).partial,r=void 0===i?n:i,o=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===r?[3,3]:(this.lf.graphModel.setPartial(r),[4,new Promise((function(t){s.lf.graphModel.eventCenter.once("graph:updated",(function(){return E(s,void 0,void 0,(function(){var i;return w(this,(function(r){switch(r.label){case 0:return[4,e()];case 1:return i=r.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(o),[7];case 7:return[2,a]}}))}))},e.prototype.getSnapshot=function(e,t){return E(this,void 0,void 0,(function(){var n=this;return w(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 E(this,void 0,void 0,(function(){var n,i,r,o,a,s,l,u,d,c=this;return w(this,(function(h){switch(h.label){case 0:return i=(n=null!=t?t:{}).fileType,r=void 0===i?"png":i,o=n.quality,this.fileName="".concat(null!=e?e:"logic-flow.".concat(Date.now()),".").concat(r),[4,Jb(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"!==r?[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"}),d=URL.createObjectURL(u),this.triggerDownload(d),[3,4];case 3:this.getCanvasData(a,null!=t?t:{}).then((function(e){var t=e.toDataURL("image/".concat(r),o).replace("image/".concat(r),"image/octet-stream");c.triggerDownload(t)})),h.label=4;case 4:return[2]}}))}))},e.prototype.getSnapshotBlob=function(e,t,n){return E(this,void 0,void 0,(function(){var i=this;return w(this,(function(r){switch(r.label){case 0:return[4,this.withExportPreparation((function(){return i.snapshotBlob(n,t,e)}),n)];case 1:return[2,r.sent()]}}))}))},e.prototype.snapshotBlob=function(e,t,n){return E(this,void 0,void 0,(function(){var i,r,o,a,s,l=this;return w(this,(function(u){switch(u.label){case 0:return i=(null!=e?e:{}).fileType,r=void 0===i?t:i,[4,Jb(o=this.getSvgRootElement(this.lf))];case 1:return u.sent(),"svg"!==r?[3,3]:[4,this.cloneSvg(o)];case 2:return a=u.sent(),s=(new XMLSerializer).serializeToString(a),[2,{data:new Blob([s],{type:"image/svg+xml;charset=utf-8"}),width:0,height:0}];case 3:return[2,new Promise((function(t){l.getCanvasData(o,y({backgroundColor:n},null!=e?e:{})).then((function(e){e.toBlob((function(n){t({data:n,width:e.width,height:e.height})}),"image/".concat(null!=r?r:"png"))}))}))]}}))}))},e.prototype.getSnapshotBase64=function(e,t,n){return E(this,void 0,void 0,(function(){var i=this;return w(this,(function(r){switch(r.label){case 0:return[4,this.withExportPreparation((function(){return i._getSnapshotBase64(e,t,n)}),n)];case 1:return[2,r.sent()]}}))}))},e.prototype._getSnapshotBase64=function(e,t,n){return E(this,void 0,void 0,(function(){var i,r,o,a=this;return w(this,(function(s){switch(s.label){case 0:return i=(null!=n?n:{}).fileType,r=void 0===i?t:i,[4,Jb(o=this.getSvgRootElement(this.lf))];case 1:return s.sent(),[2,new Promise((function(t){a.getCanvasData(o,y({backgroundColor:e},null!=n?n:{})).then((function(e){var n=e.toDataURL("image/".concat(null!=r?r:"png"));t({data:n,width:e.width,height:e.height})}))}))]}}))}))},e.pluginName="snapshot",e}(),nx=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 r=[];return i.forEach((function(t){var i=n.get(t);i&&(r=r.concat(e.findPathElements(i,n,[])))})),this.getNewPathes(r)},e.prototype.findPathElements=function(e,t,n){void 0===n&&(n=[]);var i=_([],N(n),!1);if(i.push(e.id),0===e.nextNodes.length)return[i];for(var r=[],o=0;o<e.nextNodes.length;o++){var a=t.get(e.nextNodes[o]),s=void 0;if(a){var l=i.indexOf(a.id);s=-1!==l?[_(_([],N(i.slice(l)),!1),[a.id],!1)]:this.findPathElements(a,t,_([],N(i),!1)),r=r.concat(s)}}return r},e.prototype.getNewPathes=function(e){var t=this,n=[],i=new Set;e.forEach((function(e){var r=t.getNewId("path"),o=t.getNewId("路径"),a=t.isLoopPath(e),s=e.join(",");i.has(s)||(i.add(s),n.push({routeId:r,name:o,elements:e,type:a,weight:0,similarElement:""}))}));var r=JSON.parse(JSON.stringify(this.paths));return n.forEach((function(e){for(var n=0;n<r.length;n++){var i=r[n],o=t.similar2Path(_([],N(e.elements),!1),_([],N(i.elements),!1));o>e.weight&&i.weight<=o&&(e.weight=o,e.similarElement=i,o===i.weight&&i.similarElement?(i.similarElement.similarElement=null,i.similarElement.weight=0,i.similarElement=null,i.weight=0):(i.similarElement=e,i.weight=o))}})),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 r=e.shift(),o=t.shift();void 0!==r&&void 0!==o;)r===o?(n++,r=e.shift(),o=t.shift()):r<o?r=e.shift():r>o&&(o=t.shift());return n/i*200},e.prototype.getNewId=function(e){return"".concat(e,"_").concat(T())},e.prototype.isLoopPath=function(e){var t=e.length;return e.indexOf(e[t-1])!==t-1?1:0},e.pluginName="flowPath",e}(),ix=-1,rx=0,ox=1,ax=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 r=this.formatData(e),o={nodes:[],edges:[]},a=i.length-1;a>=0;a--)this.setNodePosition(i[a],r,o,a,1);this.lf.graphModel.graphDataToModel(o)},e.prototype.setNodePosition=function(e,t,n,i,r){var o=this,a=t[e],s=a.text,l=a.type,u=a.next,d=a.properties,c=160*i+40,h=120*r,p={id:e,x:c,text:s,y:h,type:l,properties:d};return s&&"object"==typeof s&&(p.text=y(y({},s),{x:c+s.x,y:h+s.y})),this.newNodeMap.set(p.id,{x:p.x,y:p.y,type:l}),n.nodes.push(p),a.isFixed=!0,this.addLevelHeight(i,1),u&&u.length>0&&u.forEach((function(r){if(!t[r.nodeId].isFixed){var a=o.getLevelHeight(i+1);o.addLevelHeight(i,1),o.setNodePosition(r.nodeId,t,n,i+1,a+1)}n.edges.push(y({id:r.edgeId,type:r.edgeType,sourceNodeId:e,targetNodeId:r.nodeId,properties:r.properties,text:r.text},o.getEdgeDataPoints(e,r.nodeId)))})),p},e.prototype.getEdgeDataPoints=function(e,t){var n=this.newNodeMap.get(e),i=this.newNodeMap.get(t),r=this.getShape(e),o=r.width,a=r.height,s=this.getShape(t),l=s.width,u=s.height,d=this.getRelativePosition(n,i),c={x:n.x,y:n.y},h={x:i.x,y:i.y};switch(d){case rx:c.x=n.x+o/2,h.x=i.x-l/2;break;case ix:c.y=n.y+a/2,h.x=i.x-l/2;break;case ox:c.x=n.x+o/2,h.y=i.y+u/2}return{startPoint:c,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,r=t.text,o=t.x,a=t.y;return r&&"object"==typeof r&&(r.x=r.x-o,r.y=r.y-a),e[t.id]={type:n,properties:i,text:r,prev:[],next:[]},e}),{});return e.edges.forEach((function(e){var n=e.sourceNodeId,i=e.targetNodeId,r=e.id,o=e.properties,a=e.text,s=a;"object"==typeof a&&(s=a.value),t[n].next.push({edgeId:r,nodeId:i,edgeType:e.type,properties:o,text:s}),t[i].prev.push({edgeId:r,nodeId:n,properties:o,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}(),sx=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,hr(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,r=n.id;e.currentNode=i.getNodeModelById(r)}})),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,r=n.clientY;e.enable&&"node"!==e.type&&e.handleAnchorDrag(i,r)})),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,r=n.edgeModel;if(e.enable&&"node"!==e.type){var o=e.lf.graphModel.getPointByClient({x:i.clientX,y:i.clientY}).canvasOverlayPosition,a=o.x,s=o.y;if(r&&e.virtualEdge){var l=e.virtualEdge.id,u=r.targetNodeId,d=e.lf.graphModel.getNodeModelById(u);if(d&&t.isInNode({x:a,y:s},d,10))return void e.lf.deleteEdge(l)}e.handleDrop()}}))},e.prototype.handleNodeDrag=function(){var e=this.lf.graphModel.nodes;if(!rc(this.virtualEdge)){var n=this.virtualEdge,i=n.startPoint,r=n.endPoint,o=n.id;t.twoPointDistance(i,r)>this.thresholdDistance&&(this.lf.deleteEdge(o),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,r=i.getPointByClient({x:e,y:n}).canvasOverlayPosition,o=r.x,a=r.y;if(!rc(o)&&!rc(a)){var s={x:o,y:a},l=i.nodes;if(!rc(this.virtualEdge)){var u=this.virtualEdge,d=u.endPoint,c=u.id;t.twoPointDistance(s,d)>this.thresholdDistance&&(this.lf.deleteEdge(c),this.virtualEdge=void 0)}this.findClosestAnchorOfAnchor(s,l),this.currentDistance<this.thresholdDistance&&this.addVirtualEdge()}},e.prototype.findClosestAnchorOfNode=function(e,n){var i=this;if(!rc(e)&&!Qd(e)){var r,o,a,s,l=e.anchors,u=void 0===l?[]:l,d=e.id;n.forEach((function(e){if(!Zd(e.id,d)){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);(!r||u<r)&&(r=u,o=l,a=n,s=e)}}))}))}})),this.currentDistance=r,this.currentAnchor=o,this.closestAnchor=a,this.closestNode=s}},e.prototype.findClosestAnchorOfAnchor=function(e,n){var i=this;if(!rc(e)){var r,o,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(!Zd(null===(u=i.currentAnchor)||void 0===u?void 0:u.id,s.id)&&i.anchorAllowConnect(n,s,l)){var d=t.twoPointDistance(e,s);(!r||d<r)&&(r=d,o=s,a=n)}}))}})),this.currentDistance=r,this.closestAnchor=o,this.closestNode=a}},e.prototype.anchorAllowConnect=function(e,t,n){var i=this.currentNode;if(i){var r=(this.reverseDirection?e.isAllowConnectedAsSource(i,t,n):i.isAllowConnectedAsSource(e,n,t)).isAllPass,o=(this.reverseDirection?i.isAllowConnectedAsTarget(e,t,n):e.isAllowConnectedAsTarget(i,n,t)).isAllPass;return r&&o}},e.prototype.sameEdgeIsExist=function(e){if(rc(this.closestNode)||rc(this.currentNode)||rc(this.closestAnchor)||rc(this.currentAnchor))return!1;if(rc(e))return!1;var t=this,n=t.closestNode.id,i=t.currentNode.id,r=t.closestAnchor.id,o=t.currentAnchor.id,a=t.reverseDirection,s=e.sourceNodeId,l=e.targetNodeId,u=e.sourceAnchorId,d=e.targetAnchorId;return a?Zd(n,s)&&Zd(i,l)&&Zd(r,u)&&Zd(o,d):Zd(i,s)&&Zd(n,l)&&Zd(o,u)&&Zd(r,d)},e.prototype.addVirtualEdge=function(){var e=this,t=Gh(this.lf.graphModel.edges,(function(t,n){return n.virtual?t:t||e.sameEdgeIsExist(n)}),!1);if(!t){if(!rc(this.virtualEdge)){var n=this.virtualEdge.id;if(this.sameEdgeIsExist(this.virtualEdge))return;this.lf.deleteEdge(n)}var i=this,r=i.reverseDirection,o=i.currentNode,a=i.closestNode,s=i.currentAnchor,l=i.closestAnchor;if(!Qd(o)&&!Qd(a)){var u={style:this.virtualEdgeStyle};this.virtualEdge=this.lf.addEdge(r?{sourceNodeId:null==a?void 0:a.id,targetNodeId:null==o?void 0:o.id,sourceAnchorId:null==l?void 0:l.id,targetAnchorId:null==s?void 0:s.id,properties:u}:{sourceNodeId:null==o?void 0:o.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(!rc(this.virtualEdge)){var e=this.virtualEdge,t=e.type,n=e.sourceNodeId,i=e.targetNodeId,r=e.sourceAnchorId,o=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:r,targetAnchorId:o,startPoint:a,endPoint:s,pointsList:l})}},e.prototype.setVirtualEdgeStyle=function(e){this.virtualEdgeStyle=y(y({},this.virtualEdgeStyle),e)},e.prototype.setThresholdDistance=function(e){Jd(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}(),lx=function(){function e(e){var t=e.lf,n=this;this.controlItems=[{key:"zoom-out",iconClass:"lf-control-zoomOut",title:"缩小流程图",text:"缩小",hideText:!1,onClick:function(){n.lf.zoom(!1)}},{key:"zoom-in",iconClass:"lf-control-zoomIn",title:"放大流程图",text:"放大",hideText:!1,onClick:function(){n.lf.zoom(!0)}},{key:"reset",iconClass:"lf-control-fit",title:"恢复流程原有尺寸",text:"适应",hideText:!1,onClick:function(){n.lf.resetZoom()}},{key:"undo",iconClass:"lf-control-undo",title:"回到上一步",text:"上一步",hideText:!1,onClick:function(){n.lf.undo()}},{key:"redo",iconClass:"lf-control-redo",title:"移到下一步",text:"下一步",hideText:!1,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=this.lf.graphModel.themeMode,n="lf-control-item-".concat(t," lf-control-item"),i="lf-control-item disabled",r=document.createElement("div"),o=[];return r.className="lf-control-".concat(t," lf-control"),_([],N(this.controlItems),!1).forEach((function(r){var a=document.createElement("div"),s=document.createElement("i");if(a.className=i,r.onClick&&(a.onclick=r.onClick.bind(null,e.lf)),r.onMouseEnter&&(a.onmouseenter=r.onMouseEnter.bind(null,e.lf)),r.onMouseLeave&&(a.onmouseleave=r.onMouseLeave.bind(null,e.lf)),s.className=r.iconClass,rc(r.hideText)||!0!==r.hideText){var l=document.createElement("span");l.className="lf-control-text-".concat(t," lf-control-text"),l.title=r.title,l.innerText=r.text,a.append(s,l)}else a.append(s);switch(r.key){case"undo":e.lf.on("history:change",(function(e){var t=e.data.undoAble;a.className=t?n:i}));break;case"redo":e.lf.on("history:change",(function(e){var t=e.data.redoAble;a.className=t?n:i}));break;default:a.className=n}o.push(a)})),r.append.apply(r,_([],N(o),!1)),r},e.pluginName="control",e}(),ux="lf:defaultNodeMenu",dx="lf:defaultEdgeMenu",cx="lf:defaultGraphMenu",hx="lf:defaultSelectionMenu",px={nodeMenu:ux,edgeMenu:dx,graphMenu:cx,selectionMenu:hx},fx={nodeMenu:[],edgeMenu:[],graphMenu:[],selectionMenu:[]},gx=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;fx.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(ux,fx.nodeMenu),fx.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(dx,fx.edgeMenu),fx.graphMenu=[],fx.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(hx,fx.selectionMenu)},e.prototype.showMenu=function(e,t,n,i){if(!this.__isSilentMode&&n&&n.length){var r=this.__menuDOM;if(r){if(r.innerHTML="",r.append.apply(r,_([],N(this.__getMenuDom(n)),!1)),!r.children.length)return;if(r.style.display="block",!i)return r.style.top="".concat(t,"px"),void(r.style.left="".concat(e,"px"));var o=i.width,a=i.height,s=i.clientX,l=i.clientY,u=this.lf.graphModel,d=r.offsetWidth,c=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,p=h-s,f=u.rootEl.getBoundingClientRect(),g=f.left+f.width;g<h&&(p=g-s),p<d&&(c=!1),r.style.left="".concat(c?e:e-o,"px");var v=r.offsetHeight,m=!0,y=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=y-l,x=f.top+f.height;x<y&&(b=x-l),b<v&&(m=!1),r.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 r,o,a,s,l=e[i],u=px[i];if(void 0!==l)if("set"===t)null===(r=n.menuTypeMap)||void 0===r||r.set(u,l||[]);else if("add"===t&&Array.isArray(l)){var d=null!==(a=null===(o=n.menuTypeMap)||void 0===o?void 0:o.get(u))&&void 0!==a?a:[];null===(s=n.menuTypeMap)||void 0===s||s.set(u,d.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 r=t;if(r.startsWith("data:image/")){var o=this.createImageElement(r,n||"icon");e.appendChild(o)}else if(this.isImageFile(r)){o=this.createImageElement(r,n||"icon");e.appendChild(o)}else if(r.includes("<")&&r.includes(">"))e.innerHTML=r;else if(r.includes(" ")||r.startsWith(".")){var a=r.replace(/^\./,"").split(" ");(i=e.classList).add.apply(i,_([],N(a),!1))}else e.classList.add(r)}},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 r=document.createElement("span");r.className="lf-menu-item-icon",t.processIcon(r,e.icon,e.text),i.appendChild(r)}var o=document.createElement("span");o.className="lf-menu-item-text",e.text&&(o.innerText=e.text),i.appendChild(o),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,r,o,a,s,l,u,d;if(this.__menuDOM&&"none"!==this.__menuDOM.style.display&&this.__currentData){var c=this.__menuDOM.style,h=c.left,p=c.top,f=[];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);f=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(i=null===(n=this.menuTypeMap)||void 0===n?void 0:n.get(dx))&&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===(r=this.menuTypeMap)||void 0===r?void 0:r.get(v.type);f=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(a=null===(o=this.menuTypeMap)||void 0===o?void 0:o.get(ux))&&void 0!==a?a:[])}}else f="nodes"in this.__currentData&&"edges"in this.__currentData?null!==(l=null===(s=this.menuTypeMap)||void 0===s?void 0:s.get(hx))&&void 0!==l?l:[]:null!==(d=null===(u=this.menuTypeMap)||void 0===u?void 0:u.get(cx))&&void 0!==d?d:[];f&&f.length>0?(this.__menuDOM.innerHTML="",(e=this.__menuDOM).append.apply(e,_([],N(this.__getMenuDom(f)),!1)),h&&(this.__menuDOM.style.left=h),p&&(this.__menuDOM.style.top=p)):(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(px[e]))&&void 0!==n?n:[]},e.prototype.resetMenuConfigByType=function(e){var t;this.setMenuConfig(((t={})[e]=fx[e],t))},e.prototype.resetAllMenuConfig=function(){this.setMenuConfig(fx)},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,r;if(e&&t){var o=null!==(r=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(px[e]))&&void 0!==r?r:[];if(o.length){var a=o.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,r=e.data,o=e.position,a=e.e,s=o.domOverlayPosition,l=s.x,u=s.y,d=r.id,c=n.lf.graphModel.getNodeModelById(d);if(c&&!n.__isSilentMode){var h=[],p=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(c.type);h=c&&c.menu&&Array.isArray(c.menu)?c.menu:p||(null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(ux)),n.__currentData=r,n.showMenu(l,u,h,{width:c.width,height:c.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(e){var t,i,r,o=e.data,a=e.position,s=e.e,l=a.domOverlayPosition,u=l.x,d=l.y,c=o.id,h=n.lf.graphModel.getEdgeModelById(c);if(h&&!n.__isSilentMode){var p=[],f=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(h.type);p=h&&h.menu&&Array.isArray(h.menu)?h.menu:f||(null!==(r=null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(dx))&&void 0!==r?r:[]),n.__currentData=o,n.showMenu(u,d,p,{width:h.width,height:h.height,clientX:s.clientX,clientY:s.clientY})}})),this.lf.on("blank:contextmenu",(function(e){var t,i,r=e.position;if(!n.__isSilentMode){var o=null!==(i=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(cx))&&void 0!==i?i:[],a=r.domOverlayPosition,s=a.x,l=a.y;n.__currentData=y({},r.canvasOverlayPosition),n.showMenu(s,l,o)}})),this.lf.on("selection:contextmenu",(function(e){var t,i=e.data,r=e.position;if(!n.__isSilentMode){var o=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(hx),a=r.domOverlayPosition,s=a.x,l=a.y;n.__currentData=i,n.showMenu(s,l,o)}})),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}(),vx="menu-common",mx=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(vx,[]),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(vx,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 r=t.getData();n=Math.max(r.startPoint.x,n),i=Math.min(r.startPoint.y,i),n=Math.max(r.endPoint.x,n),i=Math.min(r.endPoint.y,i),r.pointsList&&r.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=_(_([],N(this.menuTypeMap.get(this._activeData.type)||[]),!1),N(this.menuTypeMap.get(vx)||[]),!1),n=document.createDocumentFragment();t.forEach((function(t){var i=document.createElement("div");i.className="lf-context-item";var r=document.createElement("img");r.src=t.icon,r.className="lf-context-img",t.className&&(i.className="".concat(i.className," ").concat(t.className)),r.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(r),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 r=e.x-i.width+200,o=t-e.y/2-20,a=e.x+i.width+200,s=t+e.y/2+20;if(this.lf.getAreaElement([r,o],[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,d=void 0;n&&(u={x:e.x,y:e.y+i.height/2},d={x:l.x-l.width/2,y:l.y}),this.lf.addEdge({sourceNodeId:e.sourceId,targetNodeId:l.id,startPoint:u,endPoint:d})}}},e.prototype.showMenu=function(){var e=this.getContextMenuPosition();if(e){var t=N(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}(),yx=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.panelEl.addEventListener("touchmove",(function(e){e.preventDefault()}),{passive:!1}),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 r=document.createElement("div");r.innerText=e.label,r.className="lf-dnd-text",n.appendChild(r)}return e.disabled?(n.classList.add("disabled"),n.onpointerdown=function(){e.callback&&e.callback(t.lf,t.domContainer)},n):(n.onpointerdown=function(n){e.type&&t.lf.dnd.startDrag({type:e.type,properties:e.properties,text:e.text}),e.callback&&e.callback(t.lf,t.domContainer),n.preventDefault()},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}(),bx=function(){function e(e){var t=e.lf,n=e.LogicFlow,i=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&&(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("pointermove",r.drag),document.addEventListener("pointerup",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("pointermove",r.drag),document.removeEventListener("pointerup",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=n,i&&this.setOption(i),this.viewPortWidth=t.graphModel.width,this.viewPortHeight=t.graphModel.height;var o={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=o,this.elementAreaBounds=o,this.viewPortBounds=o}return e.prototype.setOption=function(e){var t=e.width,n=void 0===t?200:t,i=e.height,r=void 0===i?150:i,o=e.showEdge,a=void 0!==o&&o,s=e.isShowHeader,l=void 0!==s&&s,u=e.isShowCloseIcon,d=void 0!==u&&u,c=e.leftPosition,h=e.topPosition,p=e.rightPosition,f=void 0===p?0:p,g=e.bottomPosition,v=void 0===g?0:g,m=e.headerTitle,y=void 0===m?"导航":m;this.width=n,this.height=r,this.showEdge=a,this.isShowHeader=l,this.isShowCloseIcon=d,this.leftPosition=c,this.rightPosition=void 0!==c?void 0:f,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 r=document.createElement("div");r.className="lf-mini-map-header",r.innerText=this.headerTitle,i.appendChild(r);var o=document.createElement("span");o.className="lf-mini-map-close",o.addEventListener("click",this.hide),i.appendChild(o)},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,r=e.x,o=e.y,a=null!==(n=e.width)&&void 0!==n?n:200,s=null!==(i=e.height)&&void 0!==i?i:200,l=r-a/2,u=r+a/2,d=o-s/2,c=o+s/2;t.left=Math.min(l,t.left),t.right=Math.max(u,t.right),t.top=Math.min(d,t.top),t.bottom=Math.max(c,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,r=e.SCALE_Y,o=this.lf.graphModel,a=o.width,s=o.height;this.viewPortBounds={left:-t/i,right:(-t+a)/i,top:-n/r,bottom:(-n+s)/r}},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(),r=this.resetData(i),o=this.lf.viewMap,a=this.lf.graphModel.modelMap,s=this.lfMap.viewMap;try{for(var l=C(o.keys()),u=l.next();!u.done;u=l.next()){var d=u.value;s.has(d)||this.lfMap.register({type:d,view:o.get(d),model:a.get(d)})}}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(r),this.updateBounds(r)}else this.updateBounds();var c=this.bounds,h=c.left,p=c.top,f=c.right-h,g=c.bottom-p,v=this.width/f,m=this.height/g,y=Math.min(v,m);this.scale=y;var b=h-(this.width/y-f)/2,x=p-(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,r=t.SCALE_X,o=t.SCALE_Y,a=this.lf.graphModel,s=a.width,l=a.height;this.viewPortLeft=-n/r,this.viewPortTop=-i/o,this.viewPortWidth=s/r*this.scale,this.viewPortHeight=l/o*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.style.touchAction="none",e.addEventListener("pointerdown",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}(),xx=function(){function e(e){var t,n=e.lf,i=e.options,r=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;r.handleMouseDown(t)},this.draw=function(e){if(r.lf.graphModel.editConfigModel.isPinching)return r.lf.updateEditConfig({stopMoveGraph:r.originalStopMoveGraph}),r.originStatusSaved=!1,void r.cleanupSelectionState();var t=r.lf.getPointByClient(e.clientX,e.clientY).domOverlayPosition,n=t.x,i=t.y;if(r.endPoint={x:n,y:i},r.startPoint){var o=r.startPoint,a=o.x,s=o.y,l=a,u=s,d=n-a,c=i-s;n<a&&(l=n,d=a-n),i<s&&(u=i,c=s-i),r.wrapper&&(r.wrapper.style.left="".concat(l,"px"),r.wrapper.style.top="".concat(u,"px"),r.wrapper.style.width="".concat(d,"px"),r.wrapper.style.height="".concat(c,"px"))}},this.drawOff=function(e){if(r.lf.updateEditConfig({stopMoveGraph:r.originalStopMoveGraph}),r.originStatusSaved=!1,r.mouseDownInfo){var t=r.mouseDownInfo,n=t.x,i=t.y,o=t.time;if(Math.abs(e.clientX-n)<5&&Math.abs(e.clientY-i)<5&&Date.now()-o<200)return r.lf.clearSelectElements(),void r.cleanupSelectionState()}var a=Fs(r.startPoint),s=Fs(r.endPoint);if(document.removeEventListener("pointermove",r.draw),r.exclusiveMode||document.removeEventListener("pointerup",r.drawOff),a&&s){n=a.x,i=a.y;var l=s.x,u=s.y,d=[Math.min(n,l),Math.min(i,u)],c=[Math.max(n,l),Math.max(i,u)];if(r.lf.emit("selection:selected-area",{topLeft:d,bottomRight:c}),Math.abs(l-n)<10&&Math.abs(u-i)<10)return void(r.wrapper&&(r.wrapper.oncontextmenu=null,r.container&&r.wrapper.parentNode===r.container&&r.container.removeChild(r.wrapper),r.wrapper=void 0));var h=r.lf.graphModel.getAreaElement(d,c,r.isWholeEdge,r.isWholeNode,!0),p=r.lf.graphModel,f=p.dynamicGroup,g=p.group,v=[],m=r.lf.getSelectElements(),y=new Set(_(_([],N(m.nodes.map((function(e){return e.id}))),!1),N(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(f){t=f.getGroupByNodeId(e.id);if(h.includes(t))return}r.exclusiveMode&&y.has(e.id)?r.lf.deselectElementById(e.id):(r.lf.selectElementById(e.id,!0),v.push(e))})),r.startPoint=void 0,r.endPoint=void 0,v.length>0&&r.lf.emit("selection:drop",{e:e}),r.lf.emit("selection:selected",{elements:v,leftTopPoint:d,rightBottomPoint:c})}r.wrapper&&(r.wrapper.oncontextmenu=null,r.container&&r.wrapper.parentNode===r.container&&r.container.removeChild(r.wrapper),r.wrapper=void 0)},this.lf=n,this.exclusiveMode=null!==(t=null==i?void 0:i.exclusiveMode)&&void 0!==t&&t,n.openSelectionSelect=function(){r.openSelectionSelect()},n.closeSelectionSelect=function(){r.closeSelectionSelect()},n.setSelectionSelectMode=function(e){r.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("pointermove",this.draw),document.removeEventListener("pointerup",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.style.touchAction="none",this.container.addEventListener("pointerdown",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("pointerdown",this.handleMouseDown)),this.lf.off("blank:mousedown",this.handleBlankMouseDown)},e.prototype.handleMouseDown=function(e){var t;if(this.container&&!this.disabled&&!(this.lf.graphModel.editConfigModel.isPinching||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,r=n.y;this.startPoint={x:i,y:r},this.endPoint={x:i,y:r};var o=document.createElement("div");o.className="lf-selection-select",o.oncontextmenu=function(e){e.preventDefault()},o.style.top="".concat(this.startPoint.y,"px"),o.style.left="".concat(this.startPoint.x,"px"),null===(t=this.container)||void 0===t||t.appendChild(o),this.wrapper=o,document.addEventListener("pointermove",this.draw),document.addEventListener("pointerup",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 PointerEvent("pointerup",{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}(),Ex=function(e,t){var n=[],i=[],r=function(e,i,o){e&&(o&&i.unshift.apply(i,_([],N(t.getEdgeModels({sourceNodeId:e.id,targetNodeId:null==o?void 0:o.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){r(t,i.slice(),e)})):n.push(i)))},o=function(e,n,r){e&&(r&&n.push.apply(n,_([],N(t.getEdgeModels({sourceNodeId:null==r?void 0:r.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){o(t,n.slice(),e)})):i.push(n)))};return r(e,[]),o(e,[]),_([],N(new Set(_(_([],N(n.flat()),!1),N(i.flat()),!1))),!1)},wx=function(){function e(e){var t=e.lf,n=e.options;this.mode="path",this.enable=!0,this.tempStyles={};var i=n.mode,r=void 0===i?"path":i,o=n.enable,a=void 0===o||o;this.lf=t,this.mode=r,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 r=n.incoming,o=r.nodes,a=r.edges,s=n.outgoing,l=s.nodes,u=s.edges;Ws(o,l).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),Ws(a,u).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),i=Kp(Ws(i,o,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 Ex("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]=y({},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(y({},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}(),Cx={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function Nx(e,t,n,i){var r,o=function(e,t){var n=t[0]-e[0],i=t[1]-e[1],r=Math.abs(n),o=Math.abs(i);return o<=1&&r>1?n<0?"l":"r":r<=1&&o>1?i<0?"t":"b":r<=1&&o<=1?"":r<o?n<0?"l":"r":i<0?"t":"b"},a=o(e,t),s=o(t,n),l=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,u="".concat(a).concat(s),d=Cx[u]||"-",c="";if("-"===d)c+="L ".concat(t[0]," ").concat(t[1]);else{var h=N(function(e,t,n,i){var r=[e[0],e[1]],o=[e[0],e[1]];switch(n){case"tl":return"tr"===t?(r[1]+=i,o[0]+=i):"lb"===t&&(r[0]+=i,o[1]+=i),[r,o];case"tr":return"tl"===t?(r[1]+=i,o[0]-=i):"rb"===t&&(r[0]-=i,o[1]+=i),[r,o];case"bl":return"br"===t?(r[1]-=i,o[0]+=i):"lt"===t&&(r[0]+=i,o[1]-=i),[r,o];case"br":return"bl"===t?(r[1]-=i,o[0]-=i):"rt"===t&&(r[0]-=i,o[1]-=i),[r,o];default:return[]}}(t,u,d,l),2),p=h[0],f=h[1];p&&f&&(c+="L ".concat(p[0]," ").concat(p[1]," Q ").concat(t[0]," ").concat(t[1]," ").concat(f[0]," ").concat(f[1]),r=N(f,2),t[0]=r[0],t[1]=r[1])}return c}function _x(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+=Nx(e[n-1],e[n],e[1+n++],t)}i+="L ".concat(e[n][0]," ").concat(e[n][1])}return i}var Sx=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getEdge=function(){var e=this.props.model,n=e.points,i=e.isAnimation,r=e.arrowConfig,o=e.radius,a=void 0===o?5:o,s=e.getEdgeStyle(),l=e.getEdgeAnimationStyle(),u=function(e){for(var t=e,n=1;n<t.length-1;){var i=N(t[n-1],2),r=i[0],o=i[1],a=N(t[n],2),s=a[0],l=a[1],u=N(t[n+1],2),d=u[0],c=u[1];r===s&&s===d||o===l&&l===c?t.splice(n,1):n++}return t}(n.split(" ").map((function(e){return e.split(",").map((function(e){return+e}))}))),d=_x(u,a),c=y(y(y({style:i?l:{}},s),r),{fill:"none"});return t.h("path",y({d:d},c))},n}(t.PolylineEdge),Mx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t}(t.PolylineEdgeModel),Tx=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.id,i=e.x,r=e.y,o=e.width,a=e.height,s=e.properties,l=this.props.model.getNodeStyle();return t.h("svg",{x:i-o/2,y:r-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,r=e.width,o=e.height,a=e.id,s=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",y(y({},s),{x:n-r/2,y:i-o/2,width:r,height:o,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(e){this.props.graphModel.deleteNode(e)},n}(t.PolygonNode),Ax=function(e){function t(){var t=e.apply(this,_([],N(arguments),!1))||this;return t.d=10,t.isResize=!1,t}return m(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,r=1/0,o=-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,d=n.y;i=Math.min(i,u-s/2-t.d),r=Math.min(r,d-l/2-t.d),o=Math.max(o,u+s/2+t.d),a=Math.max(a,d+l/2+t.d)}})),n.push([i,r],[o,r],[o,a],[i,a]),[i,r,o,a].some((function(e){return Math.abs(e)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(o+i)/2,y:(a+r)/2}))},t.prototype.resize=function(t){var n;this.isResize=!0;for(var i=t.width,r=t.height,o=i/this.width,a=r/this.height,s=(this.properties.node_selection_ids||[]).slice(),l=[],u=new Set;s.length;){var d=s.shift(),c=null===(n=this.graphModel.nodesMap[d])||void 0===n?void 0:n.model;c&&(Dx(c)?u.has(c.id)||(u.add(c.id),s.push.apply(s,_([],N(c.properties.node_selection_ids||[]),!1))):l.push(c))}var h=this.x-this.width/2,p=this.y-this.height/2,f=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*o,e.height=e.height*a;var t=(e.x-h)*o+g-e.x,n=(e.y-p)*a+v-e.y;e.move(t,n,!0)})),this.isResize=!1,f},t}(t.PolygonNodeModel),Ox="node-selection",kx=function(){function e(e){var t=e.lf;this.selectNodes=[],this.d=10,this.lf=t,t.register({type:Ox,view:Tx,model:Ax})}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=Wr(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!!Dx(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!==Ox){t.currentClickNode=n.data;var r=!1;t.selectNodesIds.includes(n.data.id)&&(null===(i=t.lf.getNodeModelById(n.data.id))||void 0===i||i.setSelected(!1),r=!0);var o=e.getSelectElements(!0).nodes;t.selectNodes=o,1===t.selectNodes.length?r?t.updateNodeSelection():t.addNodeSelection():t.selectNodes.length>1&&t.updateNodeSelection()}})),e.graphModel.addNodeMoveRules((function(n,i,r){if(t.onNodeChange(e,n),Dx(n)&&!n.isResize){var o=n.properties.node_selection_ids||[];return e.graphModel.moveNodes(o,i,r,!0),!0}return!0})),e.graphModel.addNodeResizeRules((function(n){return Dx(n)||t.onNodeChange(e,n),!0}))},e.pluginName="node-selection",e}(),Dx=function(e){return!(!e||e.type!==Ox)},Rx=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.properties;return t.h("text",{x:n-r/2+5,y:i-o/2+16,fontSize:12,fill:"blue"},a.moreText)},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",y(y({},a),{fill:"#FFFFFF",x:n-r/2,y:i-o/2})),this.getLabelShape()])},n}(t.RectNode),Px={pluginName:"rectLabelNode",install:function(e){e.register({type:"rect-label",model:t.RectNodeModel,view:Rx})}};e.AutoLayout=ax,e.BPMNAdapter=Jg,e.BPMNBaseAdapter=$g,e.BPMNElements=cg,e.BoundaryEventFactory=_e,e.BpmnAdapter=ge,e.BpmnElement=q,e.BpmnXmlAdapter=ve,e.ContextMenu=mx,e.Control=lx,e.CurvedEdge=Sx,e.CurvedEdgeModel=Mx,e.DEFAULT_SENSOR_OUTLINE=Uy,e.DiamondResize=Xf,e.DiamondResizeModel=Uf,e.DiamondResizeView=Vf,e.DndPanel=yx,e.DynamicGroup=sb,e.DynamicGroupNode=ib,e.DynamicGroupNodeModel=Gy,e.EllipseResize=Gf,e.EllipseResizeModel=Ff,e.EllipseResizeView=Wf,e.EndEventFactory=we,e.EndEventModel=D,e.EndEventView=R,e.ExclusiveGatewayModel=j,e.ExclusiveGatewayView=z,e.FlowPath=nx,e.GatewayNodeFactory=je,e.Group=rg,e.GroupNode=tg,e.GroupNodeModel=eg,e.Highlight=wx,e.HtmlResize=Yf,e.HtmlResizeModel=qf,e.HtmlResizeView=Kf,e.InsertNodeInPolyline=xb,e.IntermediateCatchEventFactory=Ce,e.IntermediateThrowEventFactory=Se,e.Label=qb,e.LaneNode=hb,e.Menu=gx,e.MiniMap=bx,e.NODE_ADD_DROP_DND_EVENTS=r,e.NODE_DRAG_EVENTS=i,e.NodeResize=Jf,e.NodeSelection=kx,e.PoolElements=pb,e.PoolNode=cb,e.ProximityConnect=sx,e.RectLabelNode=Px,e.RectResize=$f,e.RectResizeModel=Qf,e.RectResizeView=Zf,e.SelectionSelect=xx,e.SequenceFlowModel=I,e.SequenceFlowView=L,e.ServiceTaskModel=F,e.ServiceTaskView=W,e.Snapshot=tx,e.StartEventFactory=Ne,e.StartEventModel=A,e.StartEventView=O,e.SubProcessFactory=og,e.TaskNodeFactory=He,e.UserTaskModel=U,e.UserTaskView=V,e.bpmnUtils=Ee,e.convertNormalToXml=Vg,e.convertXmlToNormal=Xg,e.dynamicGroup=ob,e.escapeXml=J,e.gateway={exclusive:0,inclusive:1,parallel:2},e.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],e.getCurvedEdgePath=_x,e.handleAttributes=$,e.icons=Be,e.lfJson2Xml=ne,e.lfXml2Json=oe,e.multiInstanceIcon=ze,e.sequenceFlowFactory=sg,e.toLogicflowData=function(e){var t={nodes:[],edges:[]},n=e.flowElementList;return n&&n.length>0&&n.forEach((function(e){if(e.type===ev.SEQUENCE_FLOW){var n=function(e){var t=e.incoming,n=e.outgoing,i=e.properties,r=e.key,o=e.type,a=i.text,s=i.name,l=i.startPoint,u=i.endPoint,d=i.pointsList,c={id:r,type:tv[o],sourceNodeId:t[0],targetNodeId:n[0],text:a||s,properties:{}};l&&(c.startPoint=JSON.parse(l)),u&&(c.endPoint=JSON.parse(u)),d&&(c.pointsList=JSON.parse(d));var h=["startPoint","endPoint","pointsList","text"];return Object.keys(e.properties).forEach((function(t){-1===h.indexOf(t)&&(c.properties[t]=e.properties[t])})),c}(e);t.edges.push(n)}else{var i=function(e){var t=e.properties,n=e.key,i=e.type,r=e.bounds,o=t.x,a=t.y,s=t.text;if(void 0===o){var l=N(r,2),u=l[0],d=u.x,c=u.y,h=l[1];o=(d+h.x)/2,a=(c+h.y)/2}var p={id:n,type:tv[i],x:o,y:a,text:s,properties:{}},f=["x","y","text"];return Object.keys(e.properties).forEach((function(t){-1===f.indexOf(t)&&(p.properties[t]=e.properties[t])})),p}(e);t.nodes.push(i)}})),t},e.toNormalJson=de,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,r=e.y,o=e.text,a=void 0===o?"":o,s=e.properties;return{incoming:[],outgoing:[],dockers:[],type:nv(n),properties:y(y({},s),{name:a&&a.value||"",x:i,y:r,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,r=e.targetNodeId,o=e.startPoint,a=e.endPoint,s=e.pointsList,l=e.text,u=void 0===l?"":l,d=e.properties;return{incoming:[i],outgoing:[r],type:nv(n),dockers:[],properties:y(y({},d),{name:u&&u.value||"",text:u,startPoint:JSON.stringify(o),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=ue,e.useDefinition=dg}));
|
|
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;e.ExtensionEventType=void 0,(n=e.ExtensionEventType||(e.ExtensionEventType={})).GROUP_ADD_NODE="group:add-node",n.GROUP_REMOVE_NODE="group:remove-node",n.GROUP_NOT_ALLOWED="group:not-allowed";var i="".concat(t.EventType.NODE_DRAG,",").concat(t.EventType.NODE_DND_DRAG),r="".concat(t.EventType.NODE_ADD,",").concat(t.EventType.NODE_DROP,",").concat(t.EventType.NODE_DND_ADD),o=40,a=40,s=40,l=40,u=40,d=40,c=100,h=80,p=100,f=80,g={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}}},v=function(e,t){return v=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])},v(e,t)};function m(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}v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var y=function(){return y=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},y.apply(this,arguments)};function b(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 r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function x(e,t,n,i){var r,o=arguments.length,a=o<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--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function E(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(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 w(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=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(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function C(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 N(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}function _(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var S=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}(),M=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new S;function T(){return M.next()}var A=function(e){function t(t,n){return t.id||(t.id="Event_".concat(T())),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 m(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),O=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.extendKey="StartEventNode",t}(t.CircleNode),k={type:"bpmn:startEvent",view:O,model:A},D=function(e){function t(t,n){return t.id||(t.id="Event_".concat(T())),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 m(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 m(n,e),n.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},n.prototype.getShape=function(){var n=this.props.model,i=n.getNodeStyle(),r=n,o=r.x,a=r.y,s=r.r,l=e.prototype.getShape.call(this);return t.h("g",{},l,t.h("circle",y(y({},i),{cx:o,cy:a,r:s-5})))},n.extendKey="EndEventView",n}(t.CircleNode),P={type:"bpmn:endEvent",view:R,model:D},I=function(e){function t(t,n){return t.id||(t.id="Flow_".concat(T())),e.call(this,t,n)||this}return m(t,e),t.extendKey="SequenceFlowModel",t}(t.PolylineEdgeModel),L=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.extendKey="SequenceFlowEdge",t}(t.PolylineEdge),B={type:"bpmn:sequenceFlow",view:L,model:I},j=function(e){function t(t,n){var i=this;return t.id||(t.id="Gateway_".concat(T())),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 m(t,e),t.extendKey="ExclusiveGatewayModel",t}(t.PolygonNodeModel),z=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getShape=function(){var e=this.props.model,n=e,i=n.x,r=n.y,o=n.width,a=n.height,s=n.points,l=e.getNodeStyle();return t.h("g",{transform:"matrix(1 0 0 1 ".concat(i-o/2," ").concat(r-a/2,")")},t.h("polygon",y(y({},l),{x:i,y:r,points:s})),t.h("path",y({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),H={type:"bpmn:exclusiveGateway",view:z,model:j},F=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(T())),e.call(this,t,n)||this}return m(t,e),t.extendKey="ServiceTaskModel",t}(t.RectNodeModel),W=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-r/2+5,y:i-o/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,r=e.width,o=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",y({x:n-r/2,y:i-o/2,rx:a,ry:a,width:r,height:o},s)),this.getLabelShape()])},n.extendKey="ServiceTaskNode",n}(t.RectNode),G={type:"bpmn:serviceTask",view:W,model:F},U=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(T())),e.call(this,t,n)||this}return m(t,e),t.extendKey="UserTaskModel",t}(t.RectNodeModel),V=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-r/2+5,y:i-o/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,r=e.width,o=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",y(y({},s),{x:n-r/2,y:i-o/2,rx:a,ry:a,width:r,height:o})),this.getLabelShape()])},n.extendKey="UserTaskNode",n}(t.RectNode),X={type:"bpmn:userTask",view:V,model:U},q={pluginName:"bpmnElement",install:function(e){e.setTheme(g),e.register(k),e.register(P),e.register(H),e.register(X),e.register(G),e.options.customBpmnEdge||(e.register(B),e.setDefaultEdgeType("bpmn:sequenceFlow"))}},K=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}(),Y=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new K;function Q(){return Y.next()}function Z(e){return Object.prototype.toString.call(e)}function $(e){var t=e;return"[object Object]"===Z(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 J(e){return null==e?"":e.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var ee="\t\n";function te(e,t,n){var i=function(e){return" ".repeat(e)}(n);if(0!==e&&!1!==e&&!e)return ee+i+"<".concat(t," />");var r="";if("#text"===t)return ee+i+J(String(e));if("#cdata-section"===t)return ee+i+"<![CDATA["+e+"]]>";if("#comment"===t)return ee+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 J(String(t))}(e)+'"';if(Array.isArray(e))e.forEach((function(e){r+=te(e,t,n+1)}));else if("[object Object]"===Z(e)){var o=Object.keys(e),a="",s="";r+=(0===n?"":ee+i)+"<"+t,o.forEach((function(t){"-"===t.charAt(0)?a+=te(e[t],t,n+1):s+=te(e[t],t,n+1)})),r+=a+(""!==s?">".concat(s).concat(ee+i,"</").concat(t,">"):" />")}else r+=ee+i+"<".concat(t,">").concat(J(String(e)),"</").concat(t,">");return r}function ne(e){var t="";for(var n in e)t+=te(e[n],n,0);return t}var ie=function(){};(ie.ObjTree=function(){return this}).VERSION="0.23",ie.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',ie.ObjTree.prototype.attr_prefix="-",ie.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)},ie.ObjTree.prototype.parseHTTP=function(e,t,n){var i,r={};for(var o in t)r[o]=t[o];if(r.method||(void 0===r.postBody&&void 0===r.postbody&&void 0===r.parameters?r.method="get":r.method="post"),n){r.asynchronous=!0;var a=this,s=n,l=r.onComplete;r.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else r.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)r.uri=e,(u=new HTTP.Request(r))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,r))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},ie.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}},ie.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 r=e.attributes[i].nodeValue;try{r=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){r=e.attributes[i].nodeValue}r&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],r))}}}if(e.childNodes&&e.childNodes.length){var o=!0;t&&(o=!1);for(i=0;i<e.childNodes.length&&o;i++){var a=e.childNodes[i].nodeType;3!=a&&4!=a&&8!=a&&(o=!1)}if(o){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))(r=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],r))}}}else null===t&&(t={});return t}},ie.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},ie.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},ie.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];r.charAt(0)!=this.attr_prefix?void 0===o||null==o?n[n.length]="<"+r+" />":"object"==typeof o&&o.constructor==Array?n[n.length]=this.array_to_xml(r,o):n[n.length]="object"==typeof o?this.hash_to_xml(r,o):this.scalar_to_xml(r,o):i[i.length]=" "+r.substring(1)+'="'+this.xml_escape(o)+'"'}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},ie.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var r=t[i];void 0===r||null==r?n[n.length]="<"+e+" />":"object"==typeof r&&r.constructor==Array?n[n.length]=this.array_to_xml(e,r):n[n.length]="object"==typeof r?this.hash_to_xml(e,r):this.scalar_to_xml(e,r)}return n.join("")},ie.ObjTree.prototype.scalar_to_xml=function(e,t){return"#text"==e?this.xml_escape(t):"<"+e+">"+this.xml_escape(t)+"</"+e+">\n"},ie.ObjTree.prototype.xml_escape=J;var re,oe=function(e){return(new ie.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"}(re||(re={}));var ae=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef"],se=["properties","startPoint","endPoint","pointsList"],le=function(e){return String(e||"").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'")};function ue(e){var t=e?se.concat(e):se;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 r=N(n,2),o=r[0],a=r[1];"object"!=typeof a?0===o.indexOf("-")||["#text","#cdata-section","#comment"].includes(o)?i[o]=a:i["-".concat(o)]=a:t.includes(o)?i["-".concat(o)]=e(a):i[o]=e(a)})),i)}(e)}}function de(e){var t={};return Object.entries(e).forEach((function(e){var n=N(e,2),i=n[0],r=n[1];0===i.indexOf("-")?t[i.substring(1)]=$(r):"string"==typeof r?t[i]=r:"[object Object]"===Object.prototype.toString.call(r)?t[i]=de(r):Array.isArray(r)?t[i]=r.map((function(e){return de(e)})):t[i]=r})),t}function ce(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}})),r={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(r["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}}),r})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,r=80,o=e.x,a=e.y,s=ge.shapeConfigMap.get(e.type);s&&(i=s.width,r=s.height),o-=i/2,a-=r/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":o,"-y":a,"-width":i,"-height":r}};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 he(e){var t=[],n=[],i=e["bpmn:definitions"];if(i){var r=i["bpmn:process"],o=i["bpmndi:BPMNDiagram"],a=null==o?void 0:o["bpmndi:BPMNPlane"];if(!r||!a)return{nodes:t,edges:n};Object.keys(r).forEach((function(e){if(0===e.indexOf("bpmn:")){var i=r[e];if(e===re.FLOW){var o=a["bpmndi:BPMNEdge"],s=(Array.isArray(o),o);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(fe(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(fe(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 r=pe(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}));else{var r=pe(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}return i}(i,u,e))}}}))}return{nodes:t,edges:n}}function pe(e,t,n){var i,r,o=Number(e["dc:Bounds"]["-x"]),a=Number(e["dc:Bounds"]["-y"]),s=le(n["-name"]),l=ge.shapeConfigMap.get(t);if(l&&(o+=l.width/2,a+=l.height/2),Object.entries(n).forEach((function(e){var t=N(e,2),n=t[0],r=t[1];-1===ae.indexOf(n)&&(i||(i={}),i[n]=r)})),i&&(i=de(i)),s&&(r={x:o,y:a,value:s},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var u=e["bpmndi:BPMNLabel"]["dc:Bounds"];r.x=Number(u["-x"])+Number(u["-width"])/2,r.y=Number(u["-y"])+Number(u["-height"])/2}var d={id:e["-bpmnElement"],type:t,x:o,y:a,properties:i};return r&&(d.text=r),d}function fe(e,t){var n,i,r=t["-name"]?le("".concat(t["-name"])):"";if(r){var o=void 0;e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"]&&(o=e["bpmndi:BPMNLabel"]["dc:Bounds"]);var a=0;if(r.split("\n").forEach((function(e){a<e.length&&(a=e.length)})),o)n={value:r,x:Number(o["-x"])+10*a/2,y:Number(o["-y"])+7};else{var s=e["di:waypoint"]||[],l=s[0],u=s[s.length-1]||l;n={value:r,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=N(e,2),n=t[0],r=t[1];-1===ae.indexOf(n)&&(i||(i={}),i[n]=r)})),i&&(i=de(i));var d={id:t["-id"],type:re.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&&(d.text=n),d}var ge=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i=y({},n.processAttributes);!function(e,t,n){var i=new Map;t.nodes.forEach((function(t){var r,o={"-id":t.id};if((null===(r=t.text)||void 0===r?void 0:r.value)&&(o["-name"]=t.text.value),t.properties){var a=ue(n)(t.properties);Object.assign(o,a)}i.set(t.id,o),e[t.type]?Array.isArray(e[t.type])?e[t.type].push(o):e[t.type]=[e[t.type],o]:e[t.type]=o}));var r=t.edges.map((function(e){var t,r,o=i.get(e.targetNodeId);o["bpmn:incoming"]?Array.isArray(o["bpmn:incoming"])?o["bpmn:incoming"].push(e.id):o["bpmn:incoming"]=[o["bpmn:incoming"],e.id]:o["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===(r=e.text)||void 0===r?void 0:r.value),e.properties){var s=ue(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[re.FLOW]=r}(i,e,t);var r={"-id":"BPMNPlane_1","-bpmnElement":i["-id"]};ce(r,e);var o=n.definitionAttributes;return o["bpmn:process"]=i,o["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":r},{"bpmn:definitions":o}},this.adapterIn=function(e){if(e)return he(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(Q())},this.definitionAttributes={"-id":"Definitions_".concat(Q()),"-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}();ge.shapeConfigMap.set(re.START,{width:o,height:a}),ge.shapeConfigMap.set(re.END,{width:s,height:l}),ge.shapeConfigMap.set(re.GATEWAY,{width:u,height:d}),ge.shapeConfigMap.set(re.SYSTEM,{width:c,height:h}),ge.shapeConfigMap.set(re.USER,{width:p,height:f});var ve=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=oe(t);return n.adapterIn(i)},n.adapterXmlOut=function(e,t){return ne(n.adapterOut(e,t))};var i=t.lf;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n}return m(t,e),t.prototype.sanitizeNameAttributes=function(e){return e.replace(/name="([^"]*)"/g,(function(e,t){var n=t.replace(/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">");return'name="'.concat(n,'"')}))},t.pluginName="bpmnXmlAdapter",t}(ge);function me(){this.targetRules.push({message:"分组外的节点不允许连接分组内的",validate:function(e,t){var n=!!e.properties.parent,i=!!t.properties.parent;return!(!n&&i)}})}var ye=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}(),be=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new ye;function xe(){return be.next()}var Ee=Object.freeze({__proto__:null,genBpmnId:xe,groupRule:me});function we(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var i,r=this.props.model,o=r.getNodeStyle(),a=r,s=a.x,l=a.y,u=a.r,d=a.width,c=a.height,h=a.properties,p=e.prototype.getShape.call(this),f=h.definitionType,g=((null===(i=n.endEvent)||void 0===i?void 0:i.get(f))||{}).icon,v=Array.isArray(g)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(s-d/2," ").concat(l-c/2,")")}],N(g),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(s-d/2," ").concat(l-c/2,")"),d:g,style:"fill: black; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;"});return t.h("g",{},p,t.h("circle",y(y({},o),{strokeWidth:2,cx:s,cy:l,r:u-2})),v)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(xe())),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===(o=n.endEvent)||void 0===o?void 0:o.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=y(y({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),r=e.call(this,t,i)||this,me.call(r),r}return m(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:r}}function Ce(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,r=i.getNodeStyle(),o=i,a=o.x,s=o.y,l=o.r,u=o.width,d=o.height,c=o.properties.definitionType,h=((null===(e=n.intermediateCatchEvent)||void 0===e?void 0:e.get(c))||{}).icon,p=Array.isArray(h)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],N(h),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:h});return t.h("g",{},t.h("circle",y(y({},r),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",y(y({},r),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),p)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(xe())),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===(o=n.intermediateCatchEvent)||void 0===o?void 0:o.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=y(y({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),r=e.call(this,t,i)||this,me.call(r),r}return m(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateCatchEvent",view:i,model:r}}function Ne(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,r=i.getNodeStyle(),o=i,a=o.x,s=o.y,l=o.r,u=o.width,d=o.height,c=o.properties,h=c.definitionType,p=c.isInterrupting,f=((null===(e=n.startEvent)||void 0===e?void 0:e.get(h))||{}).icon,g=Array.isArray(f)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],N(f),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:f,style:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"});return t.h("g",{},t.h("circle",y(y({},r),{cx:a,cy:s,r:l,strokeDasharray:p?"5,5":"",strokeWidth:2})),g)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a;t.id||(t.id="Event_".concat(xe())),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===(r=n.startEvent)||void 0===r?void 0:r.get(null===(o=t.properties)||void 0===o?void 0:o.definitionType))||{}).properties,l=void 0===s?{}:s;return t.properties=y(y({},l),t.properties),(null===(a=t.properties)||void 0===a?void 0:a.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),e.call(this,t,i)||this}return m(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:r}}function _e(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,r=i.getNodeStyle(),o=i,a=o.x,s=o.y,l=o.r,u=o.width,d=o.height,c=o.properties,h=c.definitionType,p=c.cancelActivity,f=((null===(e=n.boundaryEvent)||void 0===e?void 0:e.get(h))||{}).icon,g=Array.isArray(f)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],N(f),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:f});return t.h("g",{},t.h("circle",y(y({},r),{cx:a,cy:s,r:l,strokeDasharray:p?"":"5,5",strokeWidth:1.5})),t.h("circle",y(y({},r),{cx:a,cy:s,r:l-3,strokeDasharray:p?"":"5,5",strokeWidth:1.5})),g)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(xe())),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===(o=n.boundaryEvent)||void 0===o?void 0:o.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=y(y({attachedToRef:"",cancelActivity:!0},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),r=e.call(this,t,i)||this,me.call(r),r}return m(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:r}}function Se(e){var n=N(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,r=i.getNodeStyle(),o=i,a=o.x,s=o.y,l=o.r,u=o.width,d=o.height,c=o.properties.definitionType,h=((null===(e=n.intermediateThrowEvent)||void 0===e?void 0:e.get(c))||{}).icon,p=Array.isArray(h)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],N(h),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:h,style:"fill: black"});return t.h("g",{},t.h("circle",y(y({},r),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",y(y({},r),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),p)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(xe())),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===(o=n.intermediateThrowEvent)||void 0===o?void 0:o.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=y(y({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(xe())),r=e.call(this,t,i)||this,me.call(r),r}return m(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateThrowEvent",view:i,model:r}}var Me=[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;"})],Te=[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);"})],Ae="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",Oe="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",ke=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;"}),De="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",Pe="m44,60 m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",Ie="m47,61 m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",Le="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",Be=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:Ae,inclusiveIcon:ke,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:Le,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:Oe,parallelMarker:Pe,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:Ie,serviceTaskIcon:De,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:Te,timerIcon:Me,userTaskIcon:Re});function je(e,n,i){var r=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getShape=function(){var e=this.props.model,i=e,r=i.x,o=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(r-a/2," ").concat(o-s/2,")")},t.h(t.Polygon,y(y({},u),{x:r,y:o,points:l})),"string"==typeof n?t.h("path",y(y({d:n},u),{fill:"rgb(34, 36, 42)",strokeWidth:1})):n)},i}(t.PolygonNode);return{type:e,view:r,model:function(e){function t(t,n){var r=this;return t.id||(t.id="Gateway_".concat(xe())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),t.properties=y(y({},i||{}),t.properties),(r=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],me.call(r),r}return m(t,e),t}(t.PolygonNodeModel)}}var ze={parallel:Pe,sequential:Ie,loop:Le};function He(e,n,i){var r=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return m(i,e),i.prototype.getLabelShape=function(){var e=this.props.model,i=e.x,r=e.y,o=e.width,a=e.height,s=e.getNodeStyle(),l=Array.isArray(n)?t.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(i-o/2," ").concat(r-a/2,")")}],N(n),!1)):t.h("path",{fill:s.stroke,d:n});return t.h("svg",{x:i-o/2+5,y:r-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,r=e.width,o=e.height,a=e.radius,s=e.properties,l=e.getNodeStyle();return t.h("g",{},[t.h("rect",y(y({},l),{x:n-r/2,y:i-o/2,rx:a,ry:a,width:r,height:o,opacity:.95})),this.getLabelShape(),t.h("g",{transform:"matrix(1 0 0 1 ".concat(n-r/2," ").concat(i-o/2,")")},t.h("path",{fill:"white",strokeLinecap:"round",strokeLinejoin:"round",stroke:"rgb(34, 36, 42)",strokeWidth:"2",d:ze[s.multiInstanceType]||""}))])},i}(t.RectNode),o=function(e){function t(t,n){var r,o=this;t.id||(t.id="Activity_".concat(xe()));var a=y(y({},i||{}),t.properties);return t.properties=a,o=e.call(this,t,n)||this,null===(r=null==a?void 0:a.boundaryEvents)||void 0===r||r.forEach((function(e){o.addBoundaryEvent(e)})),o.deleteProperty("boundaryEvents"),me.call(o),o}return m(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:r,model:o}}var Fe="object"==typeof global&&global&&global.Object===Object&&global,We="object"==typeof self&&self&&self.Object===Object&&self,Ge=Fe||We||Function("return this")(),Ue=Ge.Symbol,Ve=Object.prototype,Xe=Ve.hasOwnProperty,qe=Ve.toString,Ke=Ue?Ue.toStringTag:void 0;var Ye=Object.prototype.toString;var Qe="[object Null]",Ze="[object Undefined]",$e=Ue?Ue.toStringTag:void 0;function Je(e){return null==e?void 0===e?Ze:Qe:$e&&$e in Object(e)?function(e){var t=Xe.call(e,Ke),n=e[Ke];try{e[Ke]=void 0;var i=!0}catch(e){}var r=qe.call(e);return i&&(t?e[Ke]=n:delete e[Ke]),r}(e):function(e){return Ye.call(e)}(e)}function et(e){return null!=e&&"object"==typeof e}var tt="[object Symbol]";function nt(e){return"symbol"==typeof e||et(e)&&Je(e)==tt}var it=NaN;function rt(e){return"number"==typeof e?e:nt(e)?it:+e}function ot(e,t){for(var n=-1,i=null==e?0:e.length,r=Array(i);++n<i;)r[n]=t(e[n],n,e);return r}var at=Array.isArray,st=1/0,lt=Ue?Ue.prototype:void 0,ut=lt?lt.toString:void 0;function dt(e){if("string"==typeof e)return e;if(at(e))return ot(e,dt)+"";if(nt(e))return ut?ut.call(e):"";var t=e+"";return"0"==t&&1/e==-st?"-0":t}function ct(e,t){return function(n,i){var r;if(void 0===n&&void 0===i)return t;if(void 0!==n&&(r=n),void 0!==i){if(void 0===r)return i;"string"==typeof n||"string"==typeof i?(n=dt(n),i=dt(i)):(n=rt(n),i=rt(i)),r=e(n,i)}return r}}var ht=ct((function(e,t){return e+t}),0),pt=/\s/;function ft(e){for(var t=e.length;t--&&pt.test(e.charAt(t)););return t}var gt=/^\s+/;function vt(e){return e?e.slice(0,ft(e)+1).replace(gt,""):e}function mt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var yt=NaN,bt=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,Et=/^0o[0-7]+$/i,wt=parseInt;function Ct(e){if("number"==typeof e)return e;if(nt(e))return yt;if(mt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=mt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=vt(e);var n=xt.test(e);return n||Et.test(e)?wt(e.slice(2),n?2:8):bt.test(e)?yt:+e}var Nt=1/0,_t=17976931348623157e292;function St(e){return e?(e=Ct(e))===Nt||e===-Nt?(e<0?-1:1)*_t:e==e?e:0:0===e?e:0}function Mt(e){var t=St(e),n=t%1;return t==t?n?t-n:t:0}function Tt(e){return e}var At="[object AsyncFunction]",Ot="[object Function]",kt="[object GeneratorFunction]",Dt="[object Proxy]";function Rt(e){if(!mt(e))return!1;var t=Je(e);return t==Ot||t==kt||t==At||t==Dt}var Pt,It=Ge["__core-js_shared__"],Lt=(Pt=/[^.]+$/.exec(It&&It.keys&&It.keys.IE_PROTO||""))?"Symbol(src)_1."+Pt:"";var Bt=Function.prototype.toString;function jt(e){if(null!=e){try{return Bt.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var zt=/^\[object .+?Constructor\]$/,Ht=Function.prototype,Ft=Object.prototype,Wt=Ht.toString,Gt=Ft.hasOwnProperty,Ut=RegExp("^"+Wt.call(Gt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Vt(e){return!(!mt(e)||function(e){return!!Lt&&Lt in e}(e))&&(Rt(e)?Ut:zt).test(jt(e))}function Xt(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Vt(n)?n:void 0}var qt=Xt(Ge,"WeakMap"),Kt=qt&&new qt,Yt=Kt?function(e,t){return Kt.set(e,t),e}:Tt,Qt=Object.create,Zt=function(){function e(){}return function(t){if(!mt(t))return{};if(Qt)return Qt(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=Zt(e.prototype),i=e.apply(n,t);return mt(i)?i:n}}var Jt=1;function en(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 tn=Math.max;function nn(e,t,n,i){for(var r=-1,o=e.length,a=n.length,s=-1,l=t.length,u=tn(o-a,0),d=Array(l+u),c=!i;++s<l;)d[s]=t[s];for(;++r<a;)(c||r<o)&&(d[n[r]]=e[r]);for(;u--;)d[s++]=e[r++];return d}var rn=Math.max;function on(e,t,n,i){for(var r=-1,o=e.length,a=-1,s=n.length,l=-1,u=t.length,d=rn(o-s,0),c=Array(d+u),h=!i;++r<d;)c[r]=e[r];for(var p=r;++l<u;)c[p+l]=t[l];for(;++a<s;)(h||r<o)&&(c[p+n[a]]=e[r++]);return c}function an(){}var sn=4294967295;function ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=sn,this.__views__=[]}function un(){}ln.prototype=Zt(an.prototype),ln.prototype.constructor=ln;var dn=Kt?function(e){return Kt.get(e)}:un,cn={},hn=Object.prototype.hasOwnProperty;function pn(e){for(var t=e.name+"",n=cn[t],i=hn.call(cn,t)?n.length:0;i--;){var r=n[i],o=r.func;if(null==o||o==e)return r.name}return t}function fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function gn(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}function vn(e){if(e instanceof ln)return e.clone();var t=new fn(e.__wrapped__,e.__chain__);return t.__actions__=gn(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}fn.prototype=Zt(an.prototype),fn.prototype.constructor=fn;var mn=Object.prototype.hasOwnProperty;function yn(e){if(et(e)&&!at(e)&&!(e instanceof ln)){if(e instanceof fn)return e;if(mn.call(e,"__wrapped__"))return vn(e)}return new fn(e)}function bn(e){var t=pn(e),n=yn[t];if("function"!=typeof n||!(t in ln.prototype))return!1;if(e===n)return!0;var i=dn(n);return!!i&&e===i[0]}yn.prototype=an.prototype,yn.prototype.constructor=yn;var xn=Date.now;function En(e){var t=0,n=0;return function(){var i=xn(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var wn=En(Yt),Cn=/\{\n\/\* \[wrapped with (.+)\] \*/,Nn=/,? & /;var _n=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function Sn(e){return function(){return e}}var Mn=function(){try{var e=Xt(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Tn=Mn?function(e,t){return Mn(e,"toString",{configurable:!0,enumerable:!1,value:Sn(t),writable:!0})}:Tt,An=En(Tn);function On(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););return e}function kn(e,t,n,i){for(var r=e.length,o=n+(i?1:-1);i?o--:++o<r;)if(t(e[o],o,e))return o;return-1}function Dn(e){return e!=e}function Rn(e,t,n){return t==t?function(e,t,n){for(var i=n-1,r=e.length;++i<r;)if(e[i]===t)return i;return-1}(e,t,n):kn(e,Dn,n)}function Pn(e,t){return!!(null==e?0:e.length)&&Rn(e,t,0)>-1}var In=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function Ln(e,t,n){var i=t+"";return An(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(_n,"{\n/* [wrapped with "+t+"] */\n")}(i,function(e,t){return On(In,(function(n){var i="_."+n[0];t&n[1]&&!Pn(e,i)&&e.push(i)})),e.sort()}(function(e){var t=e.match(Cn);return t?t[1].split(Nn):[]}(i),n)))}var Bn=1,jn=2,zn=4,Hn=8,Fn=32,Wn=64;function Gn(e,t,n,i,r,o,a,s,l,u){var d=t&Hn;t|=d?Fn:Wn,(t&=~(d?Wn:Fn))&zn||(t&=~(Bn|jn));var c=[e,t,r,d?o:void 0,d?a:void 0,d?void 0:o,d?void 0:a,s,l,u],h=n.apply(void 0,c);return bn(e)&&wn(h,c),h.placeholder=i,Ln(h,e,t)}function Un(e){return e.placeholder}var Vn=9007199254740991,Xn=/^(?:0|[1-9]\d*)$/;function qn(e,t){var n=typeof e;return!!(t=null==t?Vn:t)&&("number"==n||"symbol"!=n&&Xn.test(e))&&e>-1&&e%1==0&&e<t}var Kn=Math.min;var Yn="__lodash_placeholder__";function Qn(e,t){for(var n=-1,i=e.length,r=0,o=[];++n<i;){var a=e[n];a!==t&&a!==Yn||(e[n]=Yn,o[r++]=n)}return o}var Zn=1,$n=2,Jn=8,ei=16,ti=128,ni=512;function ii(e,t,n,i,r,o,a,s,l,u){var d=t&ti,c=t&Zn,h=t&$n,p=t&(Jn|ei),f=t&ni,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(p)var x=Un(v),E=function(e,t){for(var n=e.length,i=0;n--;)e[n]===t&&++i;return i}(y,x);if(i&&(y=nn(y,i,r,p)),o&&(y=on(y,o,a,p)),m-=E,p&&m<u){var w=Qn(y,x);return Gn(e,t,ii,v.placeholder,n,y,w,s,l,u-m)}var C=c?n:this,N=h?C[e]:e;return m=y.length,s?y=function(e,t){for(var n=e.length,i=Kn(t.length,n),r=gn(e);i--;){var o=t[i];e[i]=qn(o,n)?r[o]:void 0}return e}(y,s):f&&m>1&&y.reverse(),d&&l<m&&(y.length=l),this&&this!==Ge&&this instanceof v&&(N=g||$t(N)),N.apply(C,y)}}var ri=1;var oi="__lodash_placeholder__",ai=1,si=2,li=4,ui=8,di=128,ci=256,hi=Math.min;var pi="Expected a function",fi=1,gi=2,vi=8,mi=16,yi=32,bi=64,xi=Math.max;function Ei(e,t,n,i,r,o,a,s){var l=t&gi;if(!l&&"function"!=typeof e)throw new TypeError(pi);var u=i?i.length:0;if(u||(t&=~(yi|bi),i=r=void 0),a=void 0===a?a:xi(Mt(a),0),s=void 0===s?s:Mt(s),u-=r?r.length:0,t&bi){var d=i,c=r;i=r=void 0}var h=l?void 0:dn(e),p=[e,t,n,i,r,d,c,o,a,s];if(h&&function(e,t){var n=e[1],i=t[1],r=n|i,o=r<(ai|si|di),a=i==di&&n==ui||i==di&&n==ci&&e[7].length<=t[8]||i==(di|ci)&&t[7].length<=t[8]&&n==ui;if(!o&&!a)return e;i&ai&&(e[2]=t[2],r|=n&ai?0:li);var s=t[3];if(s){var l=e[3];e[3]=l?nn(l,s,t[4]):s,e[4]=l?Qn(e[3],oi):t[4]}(s=t[5])&&(l=e[5],e[5]=l?on(l,s,t[6]):s,e[6]=l?Qn(e[5],oi):t[6]),(s=t[7])&&(e[7]=s),i&di&&(e[8]=null==e[8]?t[8]:hi(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=r}(p,h),e=p[0],t=p[1],n=p[2],i=p[3],r=p[4],!(s=p[9]=void 0===p[9]?l?0:e.length:xi(p[9]-u,0))&&t&(vi|mi)&&(t&=~(vi|mi)),t&&t!=fi)f=t==vi||t==mi?function(e,t,n){var i=$t(e);return function r(){for(var o=arguments.length,a=Array(o),s=o,l=Un(r);s--;)a[s]=arguments[s];var u=o<3&&a[0]!==l&&a[o-1]!==l?[]:Qn(a,l);return(o-=u.length)<n?Gn(e,t,ii,r.placeholder,void 0,a,u,void 0,void 0,n-o):en(this&&this!==Ge&&this instanceof r?i:e,this,a)}}(e,t,s):t!=yi&&t!=(fi|yi)||r.length?ii.apply(void 0,p):function(e,t,n,i){var r=t&ri,o=$t(e);return function t(){for(var a=-1,s=arguments.length,l=-1,u=i.length,d=Array(u+s),c=this&&this!==Ge&&this instanceof t?o:e;++l<u;)d[l]=i[l];for(;s--;)d[l++]=arguments[++a];return en(c,r?n:this,d)}}(e,t,n,i);else var f=function(e,t,n){var i=t&Jt,r=$t(e);return function t(){return(this&&this!==Ge&&this instanceof t?r:e).apply(i?n:this,arguments)}}(e,t,n);return Ln((h?Yt:wn)(f,p),e,t)}var wi=128;function Ci(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,Ei(e,wi,void 0,void 0,void 0,void 0,t)}function Ni(e,t,n){"__proto__"==t&&Mn?Mn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function _i(e,t){return e===t||e!=e&&t!=t}var Si=Object.prototype.hasOwnProperty;function Mi(e,t,n){var i=e[t];Si.call(e,t)&&_i(i,n)&&(void 0!==n||t in e)||Ni(e,t,n)}function Ti(e,t,n,i){var r=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var s=t[o],l=i?i(n[s],e[s],s,n,e):void 0;void 0===l&&(l=e[s]),r?Ni(n,s,l):Mi(n,s,l)}return n}var Ai=Math.max;function Oi(e,t,n){return t=Ai(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=Ai(i.length-t,0),a=Array(o);++r<o;)a[r]=i[t+r];r=-1;for(var s=Array(t+1);++r<t;)s[r]=i[r];return s[t]=n(a),en(e,this,s)}}function ki(e,t){return An(Oi(e,t,Tt),e+"")}var Di=9007199254740991;function Ri(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Di}function Pi(e){return null!=e&&Ri(e.length)&&!Rt(e)}function Ii(e,t,n){if(!mt(n))return!1;var i=typeof t;return!!("number"==i?Pi(n)&&qn(t,n.length):"string"==i&&t in n)&&_i(n[t],e)}function Li(e){return ki((function(t,n){var i=-1,r=n.length,o=r>1?n[r-1]:void 0,a=r>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(r--,o):void 0,a&&Ii(n[0],n[1],a)&&(o=r<3?void 0:o,r=1),t=Object(t);++i<r;){var s=n[i];s&&e(t,s,i,o)}return t}))}var Bi=Object.prototype;function ji(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Bi)}function zi(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}function Hi(e){return et(e)&&"[object Arguments]"==Je(e)}var Fi=Object.prototype,Wi=Fi.hasOwnProperty,Gi=Fi.propertyIsEnumerable,Ui=Hi(function(){return arguments}())?Hi:function(e){return et(e)&&Wi.call(e,"callee")&&!Gi.call(e,"callee")};function Vi(){return!1}var Xi="object"==typeof e&&e&&!e.nodeType&&e,qi=Xi&&"object"==typeof module&&module&&!module.nodeType&&module,Ki=qi&&qi.exports===Xi?Ge.Buffer:void 0,Yi=(Ki?Ki.isBuffer:void 0)||Vi,Qi={};function Zi(e){return function(t){return e(t)}}Qi["[object Float32Array]"]=Qi["[object Float64Array]"]=Qi["[object Int8Array]"]=Qi["[object Int16Array]"]=Qi["[object Int32Array]"]=Qi["[object Uint8Array]"]=Qi["[object Uint8ClampedArray]"]=Qi["[object Uint16Array]"]=Qi["[object Uint32Array]"]=!0,Qi["[object Arguments]"]=Qi["[object Array]"]=Qi["[object ArrayBuffer]"]=Qi["[object Boolean]"]=Qi["[object DataView]"]=Qi["[object Date]"]=Qi["[object Error]"]=Qi["[object Function]"]=Qi["[object Map]"]=Qi["[object Number]"]=Qi["[object Object]"]=Qi["[object RegExp]"]=Qi["[object Set]"]=Qi["[object String]"]=Qi["[object WeakMap]"]=!1;var $i="object"==typeof e&&e&&!e.nodeType&&e,Ji=$i&&"object"==typeof module&&module&&!module.nodeType&&module,er=Ji&&Ji.exports===$i&&Fe.process,tr=function(){try{var e=Ji&&Ji.require&&Ji.require("util").types;return e||er&&er.binding&&er.binding("util")}catch(e){}}(),nr=tr&&tr.isTypedArray,ir=nr?Zi(nr):function(e){return et(e)&&Ri(e.length)&&!!Qi[Je(e)]},rr=Object.prototype.hasOwnProperty;function or(e,t){var n=at(e),i=!n&&Ui(e),r=!n&&!i&&Yi(e),o=!n&&!i&&!r&&ir(e),a=n||i||r||o,s=a?zi(e.length,String):[],l=s.length;for(var u in e)!t&&!rr.call(e,u)||a&&("length"==u||r&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||qn(u,l))||s.push(u);return s}function ar(e,t){return function(n){return e(t(n))}}var sr=ar(Object.keys,Object),lr=Object.prototype.hasOwnProperty;function ur(e){if(!ji(e))return sr(e);var t=[];for(var n in Object(e))lr.call(e,n)&&"constructor"!=n&&t.push(n);return t}function dr(e){return Pi(e)?or(e):ur(e)}var cr=Object.prototype.hasOwnProperty,hr=Li((function(e,t){if(ji(t)||Pi(t))Ti(t,dr(t),e);else for(var n in t)cr.call(t,n)&&Mi(e,n,t[n])}));var pr=Object.prototype.hasOwnProperty;function fr(e){if(!mt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ji(e),n=[];for(var i in e)("constructor"!=i||!t&&pr.call(e,i))&&n.push(i);return n}function gr(e){return Pi(e)?or(e,!0):fr(e)}var vr=Li((function(e,t){Ti(t,gr(t),e)})),mr=Li((function(e,t,n,i){Ti(t,gr(t),e,i)})),yr=Li((function(e,t,n,i){Ti(t,dr(t),e,i)})),br=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xr=/^\w*$/;function Er(e,t){if(at(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!nt(e))||(xr.test(e)||!br.test(e)||null!=t&&e in Object(t))}var wr=Xt(Object,"create");var Cr=Object.prototype.hasOwnProperty;var Nr=Object.prototype.hasOwnProperty;function _r(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 Sr(e,t){for(var n=e.length;n--;)if(_i(e[n][0],t))return n;return-1}_r.prototype.clear=function(){this.__data__=wr?wr(null):{},this.size=0},_r.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},_r.prototype.get=function(e){var t=this.__data__;if(wr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Cr.call(t,e)?t[e]:void 0},_r.prototype.has=function(e){var t=this.__data__;return wr?void 0!==t[e]:Nr.call(t,e)},_r.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=wr&&void 0===t?"__lodash_hash_undefined__":t,this};var Mr=Array.prototype.splice;function Tr(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])}}Tr.prototype.clear=function(){this.__data__=[],this.size=0},Tr.prototype.delete=function(e){var t=this.__data__,n=Sr(t,e);return!(n<0)&&(n==t.length-1?t.pop():Mr.call(t,n,1),--this.size,!0)},Tr.prototype.get=function(e){var t=this.__data__,n=Sr(t,e);return n<0?void 0:t[n][1]},Tr.prototype.has=function(e){return Sr(this.__data__,e)>-1},Tr.prototype.set=function(e,t){var n=this.__data__,i=Sr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var Ar=Xt(Ge,"Map");function Or(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 kr(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])}}kr.prototype.clear=function(){this.size=0,this.__data__={hash:new _r,map:new(Ar||Tr),string:new _r}},kr.prototype.delete=function(e){var t=Or(this,e).delete(e);return this.size-=t?1:0,t},kr.prototype.get=function(e){return Or(this,e).get(e)},kr.prototype.has=function(e){return Or(this,e).has(e)},kr.prototype.set=function(e,t){var n=Or(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};var Dr="Expected a function";function Rr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Dr);var n=function(){var i=arguments,r=t?t.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var a=e.apply(this,i);return n.cache=o.set(r,a)||o,a};return n.cache=new(Rr.Cache||kr),n}Rr.Cache=kr;var Pr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ir=/\\(\\)?/g,Lr=function(e){var t=Rr(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(Pr,(function(e,n,i,r){t.push(i?r.replace(Ir,"$1"):n||e)})),t}));function Br(e){return null==e?"":dt(e)}function jr(e,t){return at(e)?e:Er(e,t)?[e]:Lr(Br(e))}var zr=1/0;function Hr(e){if("string"==typeof e||nt(e))return e;var t=e+"";return"0"==t&&1/e==-zr?"-0":t}function Fr(e,t){for(var n=0,i=(t=jr(t,e)).length;null!=e&&n<i;)e=e[Hr(t[n++])];return n&&n==i?e:void 0}function Wr(e,t,n){var i=null==e?void 0:Fr(e,t);return void 0===i?n:i}function Gr(e,t){for(var n=-1,i=t.length,r=Array(i),o=null==e;++n<i;)r[n]=o?void 0:Wr(e,t[n]);return r}function Ur(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e}var Vr=Ue?Ue.isConcatSpreadable:void 0;function Xr(e){return at(e)||Ui(e)||!!(Vr&&e&&e[Vr])}function qr(e,t,n,i,r){var o=-1,a=e.length;for(n||(n=Xr),r||(r=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?qr(s,t-1,n,i,r):Ur(r,s):i||(r[r.length]=s)}return r}function Kr(e){return(null==e?0:e.length)?qr(e,1):[]}function Yr(e){return An(Oi(e,void 0,Kr),e+"")}var Qr=Yr(Gr),Zr=ar(Object.getPrototypeOf,Object),$r="[object Object]",Jr=Function.prototype,eo=Object.prototype,to=Jr.toString,no=eo.hasOwnProperty,io=to.call(Object);function ro(e){if(!et(e)||Je(e)!=$r)return!1;var t=Zr(e);if(null===t)return!0;var n=no.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&to.call(n)==io}var oo="[object DOMException]",ao="[object Error]";function so(e){if(!et(e))return!1;var t=Je(e);return t==ao||t==oo||"string"==typeof e.message&&"string"==typeof e.name&&!ro(e)}var lo=ki((function(e,t){try{return en(e,void 0,t)}catch(e){return so(e)?e:new Error(e)}})),uo="Expected a function";function co(e,t){var n;if("function"!=typeof t)throw new TypeError(uo);return e=Mt(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var ho=ki((function(e,t,n){var i=1;if(n.length){var r=Qn(n,Un(ho));i|=32}return Ei(e,i,t,n,r)}));ho.placeholder={};var po=Yr((function(e,t){return On(t,(function(t){t=Hr(t),Ni(e,t,ho(e[t],e))})),e})),fo=ki((function(e,t,n){var i=3;if(n.length){var r=Qn(n,Un(fo));i|=32}return Ei(t,i,e,n,r)}));function go(e,t,n){var i=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(n=n>r?r:n)<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(r);++i<r;)o[i]=e[i+t];return o}function vo(e,t,n){var i=e.length;return n=void 0===n?i:n,!t&&n>=i?e:go(e,t,n)}fo.placeholder={};var mo=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function yo(e){return mo.test(e)}var bo="\\ud800-\\udfff",xo="["+bo+"]",Eo="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",wo="\\ud83c[\\udffb-\\udfff]",Co="[^"+bo+"]",No="(?:\\ud83c[\\udde6-\\uddff]){2}",_o="[\\ud800-\\udbff][\\udc00-\\udfff]",So="(?:"+Eo+"|"+wo+")"+"?",Mo="[\\ufe0e\\ufe0f]?",To=Mo+So+("(?:\\u200d(?:"+[Co,No,_o].join("|")+")"+Mo+So+")*"),Ao="(?:"+[Co+Eo+"?",Eo,No,_o,xo].join("|")+")",Oo=RegExp(wo+"(?="+wo+")|"+Ao+To,"g");function ko(e){return yo(e)?function(e){return e.match(Oo)||[]}(e):function(e){return e.split("")}(e)}function Do(e){return function(t){var n=yo(t=Br(t))?ko(t):void 0,i=n?n[0]:t.charAt(0),r=n?vo(n,1).join(""):t.slice(1);return i[e]()+r}}var Ro=Do("toUpperCase");function Po(e){return Ro(Br(e).toLowerCase())}function Io(e,t,n,i){var r=-1,o=null==e?0:e.length;for(i&&o&&(n=e[++r]);++r<o;)n=t(n,e[r],r,e);return n}function Lo(e){return function(t){return null==e?void 0:e[t]}}var Bo=Lo({"À":"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"}),jo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,zo=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");function Ho(e){return(e=Br(e))&&e.replace(jo,Bo).replace(zo,"")}var Fo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Wo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Go="\\ud800-\\udfff",Uo="\\u2700-\\u27bf",Vo="a-z\\xdf-\\xf6\\xf8-\\xff",Xo="A-Z\\xc0-\\xd6\\xd8-\\xde",qo="\\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",Ko="["+qo+"]",Yo="\\d+",Qo="["+Uo+"]",Zo="["+Vo+"]",$o="[^"+Go+qo+Yo+Uo+Vo+Xo+"]",Jo="(?:\\ud83c[\\udde6-\\uddff]){2}",ea="[\\ud800-\\udbff][\\udc00-\\udfff]",ta="["+Xo+"]",na="(?:"+Zo+"|"+$o+")",ia="(?:"+ta+"|"+$o+")",ra="(?:['’](?:d|ll|m|re|s|t|ve))?",oa="(?:['’](?:D|LL|M|RE|S|T|VE))?",aa="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",sa="[\\ufe0e\\ufe0f]?",la=sa+aa+("(?:\\u200d(?:"+["[^"+Go+"]",Jo,ea].join("|")+")"+sa+aa+")*"),ua="(?:"+[Qo,Jo,ea].join("|")+")"+la,da=RegExp([ta+"?"+Zo+"+"+ra+"(?="+[Ko,ta,"$"].join("|")+")",ia+"+"+oa+"(?="+[Ko,ta+na,"$"].join("|")+")",ta+"?"+na+"+"+ra,ta+"+"+oa,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Yo,ua].join("|"),"g");function ca(e,t,n){return e=Br(e),void 0===(t=n?void 0:t)?function(e){return Wo.test(e)}(e)?function(e){return e.match(da)||[]}(e):function(e){return e.match(Fo)||[]}(e):e.match(t)||[]}var ha=RegExp("['’]","g");function pa(e){return function(t){return Io(ca(Ho(t).replace(ha,"")),e,"")}}var fa=pa((function(e,t,n){return t=t.toLowerCase(),e+(n?Po(t):t)}));var ga=Ge.isFinite,va=Math.min;function ma(e){var t=Math[e];return function(e,n){if(e=Ct(e),(n=null==n?0:va(Mt(n),292))&&ga(e)){var i=(Br(e)+"e").split("e");return+((i=(Br(t(i[0]+"e"+(+i[1]+n)))+"e").split("e"))[0]+"e"+(+i[1]-n))}return t(e)}}var ya=ma("ceil");function ba(e){var t=yn(e);return t.__chain__=!0,t}var xa=Math.ceil,Ea=Math.max;function wa(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Ca(e){var t=this.__data__=new Tr(e);this.size=t.size}function Na(e,t){return e&&Ti(t,dr(t),e)}Ca.prototype.clear=function(){this.__data__=new Tr,this.size=0},Ca.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ca.prototype.get=function(e){return this.__data__.get(e)},Ca.prototype.has=function(e){return this.__data__.has(e)},Ca.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Tr){var i=n.__data__;if(!Ar||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new kr(i)}return n.set(e,t),this.size=n.size,this};var _a="object"==typeof e&&e&&!e.nodeType&&e,Sa=_a&&"object"==typeof module&&module&&!module.nodeType&&module,Ma=Sa&&Sa.exports===_a?Ge.Buffer:void 0,Ta=Ma?Ma.allocUnsafe:void 0;function Aa(e,t){if(t)return e.slice();var n=e.length,i=Ta?Ta(n):new e.constructor(n);return e.copy(i),i}function Oa(e,t){for(var n=-1,i=null==e?0:e.length,r=0,o=[];++n<i;){var a=e[n];t(a,n,e)&&(o[r++]=a)}return o}function ka(){return[]}var Da=Object.prototype.propertyIsEnumerable,Ra=Object.getOwnPropertySymbols,Pa=Ra?function(e){return null==e?[]:(e=Object(e),Oa(Ra(e),(function(t){return Da.call(e,t)})))}:ka;var Ia=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ur(t,Pa(e)),e=Zr(e);return t}:ka;function La(e,t,n){var i=t(e);return at(e)?i:Ur(i,n(e))}function Ba(e){return La(e,dr,Pa)}function ja(e){return La(e,gr,Ia)}var za=Xt(Ge,"DataView"),Ha=Xt(Ge,"Promise"),Fa=Xt(Ge,"Set"),Wa="[object Map]",Ga="[object Promise]",Ua="[object Set]",Va="[object WeakMap]",Xa="[object DataView]",qa=jt(za),Ka=jt(Ar),Ya=jt(Ha),Qa=jt(Fa),Za=jt(qt),$a=Je;(za&&$a(new za(new ArrayBuffer(1)))!=Xa||Ar&&$a(new Ar)!=Wa||Ha&&$a(Ha.resolve())!=Ga||Fa&&$a(new Fa)!=Ua||qt&&$a(new qt)!=Va)&&($a=function(e){var t=Je(e),n="[object Object]"==t?e.constructor:void 0,i=n?jt(n):"";if(i)switch(i){case qa:return Xa;case Ka:return Wa;case Ya:return Ga;case Qa:return Ua;case Za:return Va}return t});var Ja=$a,es=Object.prototype.hasOwnProperty;var ts=Ge.Uint8Array;function ns(e){var t=new e.constructor(e.byteLength);return new ts(t).set(new ts(e)),t}var is=/\w*$/;var rs=Ue?Ue.prototype:void 0,os=rs?rs.valueOf:void 0;function as(e,t){var n=t?ns(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var ss="[object Boolean]",ls="[object Date]",us="[object Map]",ds="[object Number]",cs="[object RegExp]",hs="[object Set]",ps="[object String]",fs="[object Symbol]",gs="[object ArrayBuffer]",vs="[object DataView]",ms="[object Float32Array]",ys="[object Float64Array]",bs="[object Int8Array]",xs="[object Int16Array]",Es="[object Int32Array]",ws="[object Uint8Array]",Cs="[object Uint8ClampedArray]",Ns="[object Uint16Array]",_s="[object Uint32Array]";function Ss(e,t,n){var i,r=e.constructor;switch(t){case gs:return ns(e);case ss:case ls:return new r(+e);case vs:return function(e,t){var n=t?ns(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case ms:case ys:case bs:case xs:case Es:case ws:case Cs:case Ns:case _s:return as(e,n);case us:return new r;case ds:case ps:return new r(e);case cs:return function(e){var t=new e.constructor(e.source,is.exec(e));return t.lastIndex=e.lastIndex,t}(e);case hs:return new r;case fs:return i=e,os?Object(os.call(i)):{}}}function Ms(e){return"function"!=typeof e.constructor||ji(e)?{}:Zt(Zr(e))}var Ts=tr&&tr.isMap,As=Ts?Zi(Ts):function(e){return et(e)&&"[object Map]"==Ja(e)};var Os=tr&&tr.isSet,ks=Os?Zi(Os):function(e){return et(e)&&"[object Set]"==Ja(e)},Ds=1,Rs=2,Ps=4,Is="[object Arguments]",Ls="[object Function]",Bs="[object GeneratorFunction]",js="[object Object]",zs={};function Hs(e,t,n,i,r,o){var a,s=t&Ds,l=t&Rs,u=t&Ps;if(n&&(a=r?n(e,i,r,o):n(e)),void 0!==a)return a;if(!mt(e))return e;var d=at(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&es.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return gn(e,a)}else{var c=Ja(e),h=c==Ls||c==Bs;if(Yi(e))return Aa(e,s);if(c==js||c==Is||h&&!r){if(a=l||h?{}:Ms(e),!s)return l?function(e,t){return Ti(e,Ia(e),t)}(e,function(e,t){return e&&Ti(t,gr(t),e)}(a,e)):function(e,t){return Ti(e,Pa(e),t)}(e,Na(a,e))}else{if(!zs[c])return r?e:{};a=Ss(e,c,s)}}o||(o=new Ca);var p=o.get(e);if(p)return p;o.set(e,a),ks(e)?e.forEach((function(i){a.add(Hs(i,t,n,i,e,o))})):As(e)&&e.forEach((function(i,r){a.set(r,Hs(i,t,n,r,e,o))}));var f=d?void 0:(u?l?ja:Ba:l?gr:dr)(e);return On(f||e,(function(i,r){f&&(i=e[r=i]),Mi(a,r,Hs(i,t,n,r,e,o))})),a}zs[Is]=zs["[object Array]"]=zs["[object ArrayBuffer]"]=zs["[object DataView]"]=zs["[object Boolean]"]=zs["[object Date]"]=zs["[object Float32Array]"]=zs["[object Float64Array]"]=zs["[object Int8Array]"]=zs["[object Int16Array]"]=zs["[object Int32Array]"]=zs["[object Map]"]=zs["[object Number]"]=zs[js]=zs["[object RegExp]"]=zs["[object Set]"]=zs["[object String]"]=zs["[object Symbol]"]=zs["[object Uint8Array]"]=zs["[object Uint8ClampedArray]"]=zs["[object Uint16Array]"]=zs["[object Uint32Array]"]=!0,zs["[object Error]"]=zs[Ls]=zs["[object WeakMap]"]=!1;function Fs(e){return Hs(e,5)}function Ws(){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 Ur(at(n)?gn(n):[n],qr(t,1))}function Gs(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new kr;++t<n;)this.add(e[t])}function Us(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 Vs(e,t){return e.has(t)}Gs.prototype.add=Gs.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Gs.prototype.has=function(e){return this.__data__.has(e)};var Xs=1,qs=2;function Ks(e,t,n,i,r,o){var a=n&Xs,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var c=-1,h=!0,p=n&qs?new Gs:void 0;for(o.set(e,t),o.set(t,e);++c<s;){var f=e[c],g=t[c];if(i)var v=a?i(g,f,c,t,e,o):i(f,g,c,e,t,o);if(void 0!==v){if(v)continue;h=!1;break}if(p){if(!Us(t,(function(e,t){if(!Vs(p,t)&&(f===e||r(f,e,n,i,o)))return p.push(t)}))){h=!1;break}}else if(f!==g&&!r(f,g,n,i,o)){h=!1;break}}return o.delete(e),o.delete(t),h}function Ys(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Qs(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Zs=1,$s=2,Js="[object Boolean]",el="[object Date]",tl="[object Error]",nl="[object Map]",il="[object Number]",rl="[object RegExp]",ol="[object Set]",al="[object String]",sl="[object Symbol]",ll="[object ArrayBuffer]",ul="[object DataView]",dl=Ue?Ue.prototype:void 0,cl=dl?dl.valueOf:void 0;var hl=1,pl=Object.prototype.hasOwnProperty;var fl=1,gl="[object Arguments]",vl="[object Array]",ml="[object Object]",yl=Object.prototype.hasOwnProperty;function bl(e,t,n,i,r,o){var a=at(e),s=at(t),l=a?vl:Ja(e),u=s?vl:Ja(t),d=(l=l==gl?ml:l)==ml,c=(u=u==gl?ml:u)==ml,h=l==u;if(h&&Yi(e)){if(!Yi(t))return!1;a=!0,d=!1}if(h&&!d)return o||(o=new Ca),a||ir(e)?Ks(e,t,n,i,r,o):function(e,t,n,i,r,o,a){switch(n){case ul:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ll:return!(e.byteLength!=t.byteLength||!o(new ts(e),new ts(t)));case Js:case el:case il:return _i(+e,+t);case tl:return e.name==t.name&&e.message==t.message;case rl:case al:return e==t+"";case nl:var s=Ys;case ol:var l=i&Zs;if(s||(s=Qs),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;i|=$s,a.set(e,t);var d=Ks(s(e),s(t),i,r,o,a);return a.delete(e),d;case sl:if(cl)return cl.call(e)==cl.call(t)}return!1}(e,t,l,n,i,r,o);if(!(n&fl)){var p=d&&yl.call(e,"__wrapped__"),f=c&&yl.call(t,"__wrapped__");if(p||f){var g=p?e.value():e,v=f?t.value():t;return o||(o=new Ca),r(g,v,n,i,o)}}return!!h&&(o||(o=new Ca),function(e,t,n,i,r,o){var a=n&hl,s=Ba(e),l=s.length;if(l!=Ba(t).length&&!a)return!1;for(var u=l;u--;){var d=s[u];if(!(a?d in t:pl.call(t,d)))return!1}var c=o.get(e),h=o.get(t);if(c&&h)return c==t&&h==e;var p=!0;o.set(e,t),o.set(t,e);for(var f=a;++u<l;){var g=e[d=s[u]],v=t[d];if(i)var m=a?i(v,g,d,t,e,o):i(g,v,d,e,t,o);if(!(void 0===m?g===v||r(g,v,n,i,o):m)){p=!1;break}f||(f="constructor"==d)}if(p&&!f){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||(p=!1)}return o.delete(e),o.delete(t),p}(e,t,n,i,r,o))}function xl(e,t,n,i,r){return e===t||(null==e||null==t||!et(e)&&!et(t)?e!=e&&t!=t:bl(e,t,n,i,xl,r))}var El=1,wl=2;function Cl(e,t,n,i){var r=n.length,o=r,a=!i;if(null==e)return!o;for(e=Object(e);r--;){var s=n[r];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++r<o;){var l=(s=n[r])[0],u=e[l],d=s[1];if(a&&s[2]){if(void 0===u&&!(l in e))return!1}else{var c=new Ca;if(i)var h=i(u,d,l,e,t,c);if(!(void 0===h?xl(d,u,El|wl,i,c):h))return!1}}return!0}function Nl(e){return e==e&&!mt(e)}function _l(e){for(var t=dr(e),n=t.length;n--;){var i=t[n],r=e[i];t[n]=[i,r,Nl(r)]}return t}function Sl(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function Ml(e){var t=_l(e);return 1==t.length&&t[0][2]?Sl(t[0][0],t[0][1]):function(n){return n===e||Cl(n,e,t)}}function Tl(e,t){return null!=e&&t in Object(e)}function Al(e,t,n){for(var i=-1,r=(t=jr(t,e)).length,o=!1;++i<r;){var a=Hr(t[i]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++i!=r?o:!!(r=null==e?0:e.length)&&Ri(r)&&qn(a,r)&&(at(e)||Ui(e))}function Ol(e,t){return null!=e&&Al(e,t,Tl)}var kl=1,Dl=2;function Rl(e,t){return Er(e)&&Nl(t)?Sl(Hr(e),t):function(n){var i=Wr(n,e);return void 0===i&&i===t?Ol(n,e):xl(t,i,kl|Dl)}}function Pl(e){return function(t){return null==t?void 0:t[e]}}function Il(e){return Er(e)?Pl(Hr(e)):function(e){return function(t){return Fr(t,e)}}(e)}function Ll(e){return"function"==typeof e?e:null==e?Tt:"object"==typeof e?at(e)?Rl(e[0],e[1]):Ml(e):Il(e)}function Bl(e,t,n){var i=n.length;if(null==e)return!i;for(e=Object(e);i--;){var r=n[i],o=t[r],a=e[r];if(void 0===a&&!(r in e)||!o(a))return!1}return!0}function jl(e,t,n,i){for(var r=-1,o=null==e?0:e.length;++r<o;){var a=e[r];t(i,a,n(a),e)}return i}function zl(e){return function(t,n,i){for(var r=-1,o=Object(t),a=i(t),s=a.length;s--;){var l=a[e?s:++r];if(!1===n(o[l],l,o))break}return t}}var Hl=zl();function Fl(e,t){return e&&Hl(e,t,dr)}function Wl(e,t){return function(n,i){if(null==n)return n;if(!Pi(n))return e(n,i);for(var r=n.length,o=t?r:-1,a=Object(n);(t?o--:++o<r)&&!1!==i(a[o],o,a););return n}}var Gl=Wl(Fl);function Ul(e,t,n,i){return Gl(e,(function(e,r,o){t(i,e,n(e),o)})),i}function Vl(e,t){return function(n,i){var r=at(n)?jl:Ul,o=t?t():{};return r(n,e,Ll(i),o)}}var Xl=Object.prototype.hasOwnProperty,ql=Vl((function(e,t,n){Xl.call(e,n)?++e[n]:Ni(e,n,1)}));function Kl(e,t,n){var i=Ei(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=Kl.placeholder,i}Kl.placeholder={};function Yl(e,t,n){var i=Ei(e,16,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=Yl.placeholder,i}Yl.placeholder={};var Ql=function(){return Ge.Date.now()},Zl="Expected a function",$l=Math.max,Jl=Math.min;function eu(e,t,n){var i,r,o,a,s,l,u=0,d=!1,c=!1,h=!0;if("function"!=typeof e)throw new TypeError(Zl);function p(t){var n=i,o=r;return i=r=void 0,u=t,a=e.apply(o,n)}function f(e){var n=e-l;return void 0===l||n>=t||n<0||c&&e-u>=o}function g(){var e=Ql();if(f(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return c?Jl(n,o-(e-u)):n}(e))}function v(e){return s=void 0,h&&i?p(e):(i=r=void 0,a)}function m(){var e=Ql(),n=f(e);if(i=arguments,r=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(g,t),d?p(e):a}(l);if(c)return clearTimeout(s),s=setTimeout(g,t),p(l)}return void 0===s&&(s=setTimeout(g,t)),a}return t=Ct(t)||0,mt(n)&&(d=!!n.leading,o=(c="maxWait"in n)?$l(Ct(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,i=l=r=s=void 0},m.flush=function(){return void 0===s?a:v(Ql())},m}var tu=Object.prototype,nu=tu.hasOwnProperty,iu=ki((function(e,t){e=Object(e);var n=-1,i=t.length,r=i>2?t[2]:void 0;for(r&&Ii(t[0],t[1],r)&&(i=1);++n<i;)for(var o=t[n],a=gr(o),s=-1,l=a.length;++s<l;){var u=a[s],d=e[u];(void 0===d||_i(d,tu[u])&&!nu.call(e,u))&&(e[u]=o[u])}return e}));function ru(e,t,n){(void 0!==n&&!_i(e[t],n)||void 0===n&&!(t in e))&&Ni(e,t,n)}function ou(e){return et(e)&&Pi(e)}function au(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function su(e){return Ti(e,gr(e))}function lu(e,t,n,i,r){e!==t&&Hl(t,(function(o,a){if(r||(r=new Ca),mt(o))!function(e,t,n,i,r,o,a){var s=au(e,n),l=au(t,n),u=a.get(l);if(u)ru(e,n,u);else{var d=o?o(s,l,n+"",e,t,a):void 0,c=void 0===d;if(c){var h=at(l),p=!h&&Yi(l),f=!h&&!p&&ir(l);d=l,h||p||f?at(s)?d=s:ou(s)?d=gn(s):p?(c=!1,d=Aa(l,!0)):f?(c=!1,d=as(l,!0)):d=[]:ro(l)||Ui(l)?(d=s,Ui(s)?d=su(s):mt(s)&&!Rt(s)||(d=Ms(l))):c=!1}c&&(a.set(l,d),r(d,l,i,o,a),a.delete(l)),ru(e,n,d)}}(e,t,a,n,lu,i,r);else{var s=i?i(au(e,a),o,a+"",e,t,r):void 0;void 0===s&&(s=o),ru(e,a,s)}}),gr)}function uu(e,t,n,i,r,o){return mt(e)&&mt(t)&&(o.set(t,e),lu(e,t,void 0,uu,o),o.delete(t)),e}var du=Li((function(e,t,n,i){lu(e,t,n,i)})),cu=ki((function(e){return e.push(void 0,uu),en(du,void 0,e)}));function hu(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)}var pu=ki((function(e,t){return hu(e,1,t)})),fu=ki((function(e,t,n){return hu(e,Ct(t)||0,n)}));function gu(e,t,n){for(var i=-1,r=null==e?0:e.length;++i<r;)if(n(t,e[i]))return!0;return!1}var vu=200;function mu(e,t,n,i){var r=-1,o=Pn,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=ot(t,Zi(n))),i?(o=gu,a=!1):t.length>=vu&&(o=Vs,a=!1,t=new Gs(t));e:for(;++r<s;){var d=e[r],c=null==n?d:n(d);if(d=i||0!==d?d:0,a&&c==c){for(var h=u;h--;)if(t[h]===c)continue e;l.push(d)}else o(t,c,i)||l.push(d)}return l}var yu=ki((function(e,t){return ou(e)?mu(e,qr(t,1,ou,!0)):[]}));function bu(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var xu=ki((function(e,t){var n=bu(t);return ou(n)&&(n=void 0),ou(e)?mu(e,qr(t,1,ou,!0),Ll(n)):[]})),Eu=ki((function(e,t){var n=bu(t);return ou(n)&&(n=void 0),ou(e)?mu(e,qr(t,1,ou,!0),void 0,n):[]})),wu=ct((function(e,t){return e/t}),1);function Cu(e,t,n,i){for(var r=e.length,o=i?r:-1;(i?o--:++o<r)&&t(e[o],o,e););return n?go(e,i?0:o,i?o+1:r):go(e,i?o+1:0,i?r:o)}function Nu(e){return"function"==typeof e?e:Tt}function _u(e,t){return(at(e)?On:Gl)(e,Nu(t))}function Su(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}var Mu=zl(!0);function Tu(e,t){return e&&Mu(e,t,dr)}var Au=Wl(Tu,!0);function Ou(e,t){return(at(e)?Su:Au)(e,Nu(t))}function ku(e){return function(t){var n=Ja(t);return"[object Map]"==n?Ys(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 ot(t,(function(t){return[t,e[t]]}))}(t,e(t))}}var Du=ku(dr),Ru=ku(gr),Pu=Lo({"&":"&","<":"<",">":">",'"':""","'":"'"}),Iu=/[&<>"']/g,Lu=RegExp(Iu.source);function Bu(e){return(e=Br(e))&&Lu.test(e)?e.replace(Iu,Pu):e}var ju=/[\\^$.*+?()[\]{}|]/g,zu=RegExp(ju.source);function Hu(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 Gl(e,(function(e,i,r){return n=!!t(e,i,r)})),n}var Wu=4294967295;function Gu(e){return e?wa(Mt(e),0,Wu):0}function Uu(e,t){var n=[];return Gl(e,(function(e,i,r){t(e,i,r)&&n.push(e)})),n}function Vu(e,t){return(at(e)?Oa:Uu)(e,Ll(t))}function Xu(e){return function(t,n,i){var r=Object(t);if(!Pi(t)){var o=Ll(n);t=dr(t),n=function(e){return o(r[e],e,r)}}var a=e(t,n,i);return a>-1?r[o?t[a]:a]:void 0}}var qu=Math.max;function Ku(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=null==n?0:Mt(n);return r<0&&(r=qu(i+r,0)),kn(e,Ll(t),r)}var Yu=Xu(Ku);function Qu(e,t,n){var i;return n(e,(function(e,n,r){if(t(e,n,r))return i=n,!1})),i}var Zu=Math.max,$u=Math.min;function Ju(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i-1;return void 0!==n&&(r=Mt(n),r=n<0?Zu(i+r,0):$u(r,i-1)),kn(e,Ll(t),r,!0)}var ed=Xu(Ju);function td(e){return e&&e.length?e[0]:void 0}function nd(e,t){var n=-1,i=Pi(e)?Array(e.length):[];return Gl(e,(function(e,r,o){i[++n]=t(e,r,o)})),i}function id(e,t){return(at(e)?ot:nd)(e,Ll(t))}var rd=1/0;var od=1/0;var ad=ma("floor");function sd(e){return Yr((function(t){var n=t.length,i=n,r=fn.prototype.thru;for(e&&t.reverse();i--;){var o=t[i];if("function"!=typeof o)throw new TypeError("Expected a function");if(r&&!a&&"wrapper"==pn(o))var a=new fn([],!0)}for(i=a?i:n;++i<n;){var s=pn(o=t[i]),l="wrapper"==s?dn(o):void 0;a=l&&bn(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[pn(l[0])].apply(a,l[3]):1==o.length&&bn(o)?a[s]():a.thru(o)}return function(){var e=arguments,i=e[0];if(a&&1==e.length&&at(i))return a.plant(i).value();for(var r=0,o=n?t[r].apply(this,e):i;++r<n;)o=t[r].call(this,o);return o}}))}var ld=sd(),ud=sd(!0);function dd(e,t){return Oa(t,(function(t){return Rt(e[t])}))}var cd=Object.prototype.hasOwnProperty,hd=Vl((function(e,t,n){cd.call(e,n)?e[n].push(t):Ni(e,n,[t])}));function pd(e,t){return e>t}function fd(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=Ct(t),n=Ct(n)),e(t,n)}}var gd=fd(pd),vd=fd((function(e,t){return e>=t})),md=Object.prototype.hasOwnProperty;function yd(e,t){return null!=e&&md.call(e,t)}function bd(e,t){return null!=e&&Al(e,t,yd)}var xd=Math.max,Ed=Math.min;var wd="[object String]";function Cd(e){return"string"==typeof e||!at(e)&&et(e)&&Je(e)==wd}function Nd(e,t){return ot(t,(function(t){return e[t]}))}function _d(e){return null==e?[]:Nd(e,dr(e))}var Sd=Math.max;var Md=Math.max;var Td=Math.min;function Ad(e,t,n){for(var i=n?gu:Pn,r=e[0].length,o=e.length,a=o,s=Array(o),l=1/0,u=[];a--;){var d=e[a];a&&t&&(d=ot(d,Zi(t))),l=Td(d.length,l),s[a]=!n&&(t||r>=120&&d.length>=120)?new Gs(a&&d):void 0}d=e[0];var c=-1,h=s[0];e:for(;++c<r&&u.length<l;){var p=d[c],f=t?t(p):p;if(p=n||0!==p?p:0,!(h?Vs(h,f):i(u,f,n))){for(a=o;--a;){var g=s[a];if(!(g?Vs(g,f):i(e[a],f,n)))continue e}h&&h.push(f),u.push(p)}}return u}function Od(e){return ou(e)?e:[]}var kd=ki((function(e){var t=ot(e,Od);return t.length&&t[0]===e[0]?Ad(t):[]})),Dd=ki((function(e){var t=bu(e),n=ot(e,Od);return t===bu(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?Ad(n,Ll(t)):[]})),Rd=ki((function(e){var t=bu(e),n=ot(e,Od);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?Ad(n,void 0,t):[]}));function Pd(e,t){return function(n,i){return function(e,t,n,i){return Fl(e,(function(e,r,o){t(i,n(e),r,o)})),i}(n,e,t(i),{})}}var Id=Object.prototype.toString,Ld=Pd((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Id.call(t)),e[t]=n}),Sn(Tt)),Bd=Object.prototype,jd=Bd.hasOwnProperty,zd=Bd.toString,Hd=Pd((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=zd.call(t)),jd.call(e,t)?e[t].push(n):e[t]=[n]}),Ll);function Fd(e,t){return t.length<2?e:Fr(e,go(t,0,-1))}function Wd(e,t,n){var i=null==(e=Fd(e,t=jr(t,e)))?e:e[Hr(bu(t))];return null==i?void 0:en(i,e,n)}var Gd=ki(Wd),Ud=ki((function(e,t,n){var i=-1,r="function"==typeof t,o=Pi(e)?Array(e.length):[];return Gl(e,(function(e){o[++i]=r?en(t,e,n):Wd(e,t,n)})),o}));var Vd=tr&&tr.isArrayBuffer,Xd=Vd?Zi(Vd):function(e){return et(e)&&"[object ArrayBuffer]"==Je(e)};var qd=tr&&tr.isDate,Kd=qd?Zi(qd):function(e){return et(e)&&"[object Date]"==Je(e)};var Yd=Object.prototype.hasOwnProperty;function Qd(e){if(null==e)return!0;if(Pi(e)&&(at(e)||"string"==typeof e||"function"==typeof e.splice||Yi(e)||ir(e)||Ui(e)))return!e.length;var t=Ja(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(ji(e))return!ur(e).length;for(var n in e)if(Yd.call(e,n))return!1;return!0}function Zd(e,t){return xl(e,t)}var $d=Ge.isFinite;function Jd(e){return"number"==typeof e&&$d(e)}function ec(e){return"number"==typeof e&&e==Mt(e)}var tc="[object Number]";function nc(e){return"number"==typeof e||et(e)&&Je(e)==tc}var ic=It?Rt:Vi;function rc(e){return null==e}var oc=tr&&tr.isRegExp,ac=oc?Zi(oc):function(e){return et(e)&&"[object RegExp]"==Je(e)},sc=9007199254740991;var lc=Array.prototype.join;var uc=pa((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),dc=Vl((function(e,t,n){Ni(e,n,t)}));var cc=Math.max,hc=Math.min;var pc=pa((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),fc=Do("toLowerCase");function gc(e,t){return e<t}var vc=fd(gc),mc=fd((function(e,t){return e<=t}));function yc(e,t,n){for(var i=-1,r=e.length;++i<r;){var o=e[i],a=t(o);if(null!=a&&(void 0===s?a==a&&!nt(a):n(a,s)))var s=a,l=o}return l}function bc(e,t){for(var n,i=-1,r=e.length;++i<r;){var o=t(e[i]);void 0!==o&&(n=void 0===n?o:n+o)}return n}var xc=NaN;function Ec(e,t){var n=null==e?0:e.length;return n?bc(e,t)/n:xc}var wc=Li((function(e,t,n){lu(e,t,n)})),Cc=ki((function(e,t){return function(n){return Wd(n,e,t)}})),Nc=ki((function(e,t){return function(n){return Wd(e,n,t)}}));function _c(e,t,n){var i=dr(t),r=dd(t,i),o=!(mt(n)&&"chain"in n&&!n.chain),a=Rt(e);return On(r,(function(n){var i=t[n];e[n]=i,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=gn(this.__actions__)).push({func:i,args:arguments,thisArg:e}),n.__chain__=t,n}return i.apply(e,Ur([this.value()],arguments))})})),e}var Sc=ct((function(e,t){return e*t}),1),Mc="Expected a function";function Tc(e){if("function"!=typeof e)throw new TypeError(Mc);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 Ac="[object Map]",Oc="[object Set]",kc=Ue?Ue.iterator:void 0;function Dc(e){if(!e)return[];if(Pi(e))return Cd(e)?ko(e):gn(e);if(kc&&e[kc])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[kc]());var t=Ja(e);return(t==Ac?Ys:t==Oc?Qs:_d)(e)}function Rc(e,t){var n=e.length;if(n)return qn(t+=t<0?n:0,n)?e[t]:void 0}function Pc(e,t){return null==(e=Fd(e,t=jr(t,e)))||delete e[Hr(bu(t))]}function Ic(e){return ro(e)?void 0:e}var Lc=Yr((function(e,t){var n={};if(null==e)return n;var i=!1;t=ot(t,(function(t){return t=jr(t,e),i||(i=t.length>1),t})),Ti(e,ja(e),n),i&&(n=Hs(n,7,Ic));for(var r=t.length;r--;)Pc(n,t[r]);return n}));function Bc(e,t,n,i){if(!mt(e))return e;for(var r=-1,o=(t=jr(t,e)).length,a=o-1,s=e;null!=s&&++r<o;){var l=Hr(t[r]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(r!=a){var d=s[l];void 0===(u=i?i(d,l,s):void 0)&&(u=mt(d)?d:qn(t[r+1])?[]:{})}Mi(s,l,u),s=s[l]}return e}function jc(e,t,n){for(var i=-1,r=t.length,o={};++i<r;){var a=t[i],s=Fr(e,a);n(s,a)&&Bc(o,jr(a,e),s)}return o}function zc(e,t){if(null==e)return{};var n=ot(ja(e),(function(e){return[e]}));return t=Ll(t),jc(e,n,(function(e,n){return t(e,n[0])}))}function Hc(e,t){if(e!==t){var n=void 0!==e,i=null===e,r=e==e,o=nt(e),a=void 0!==t,s=null===t,l=t==t,u=nt(t);if(!s&&!u&&!o&&e>t||o&&a&&l&&!s&&!u||i&&a&&l||!n&&l||!r)return 1;if(!i&&!o&&!u&&e<t||u&&n&&r&&!i&&!o||s&&n&&r||!a&&r||!l)return-1}return 0}function Fc(e,t,n){t=t.length?ot(t,(function(e){return at(e)?function(t){return Fr(t,1===e.length?e[0]:e)}:e})):[Tt];var i=-1;t=ot(t,Zi(Ll));var r=nd(e,(function(e,n,r){var o=ot(t,(function(t){return t(e)}));return{criteria:o,index:++i,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(r,(function(e,t){return function(e,t,n){for(var i=-1,r=e.criteria,o=t.criteria,a=r.length,s=n.length;++i<a;){var l=Hc(r[i],o[i]);if(l)return i>=s?l:l*("desc"==n[i]?-1:1)}return e.index-t.index}(e,t,n)}))}function Wc(e){return Yr((function(t){return t=ot(t,Zi(Ll)),ki((function(n){var i=this;return e(t,(function(e){return en(e,i,n)}))}))}))}var Gc=Wc(ot),Uc=ki,Vc=Math.min,Xc=Uc((function(e,t){var n=(t=1==t.length&&at(t[0])?ot(t[0],Zi(Ll)):ot(qr(t,1),Zi(Ll))).length;return ki((function(i){for(var r=-1,o=Vc(i.length,n);++r<o;)i[r]=t[r].call(this,i[r]);return en(e,this,i)}))})),qc=Wc(Hu),Kc=Wc(Us),Yc=9007199254740991,Qc=Math.floor;function Zc(e,t){var n="";if(!e||t<1||t>Yc)return n;do{t%2&&(n+=e),(t=Qc(t/2))&&(e+=e)}while(t);return n}var $c=Pl("length"),Jc="\\ud800-\\udfff",eh="["+Jc+"]",th="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",nh="\\ud83c[\\udffb-\\udfff]",ih="[^"+Jc+"]",rh="(?:\\ud83c[\\udde6-\\uddff]){2}",oh="[\\ud800-\\udbff][\\udc00-\\udfff]",ah="(?:"+th+"|"+nh+")"+"?",sh="[\\ufe0e\\ufe0f]?",lh=sh+ah+("(?:\\u200d(?:"+[ih,rh,oh].join("|")+")"+sh+ah+")*"),uh="(?:"+[ih+th+"?",th,rh,oh,eh].join("|")+")",dh=RegExp(nh+"(?="+nh+")|"+uh+lh,"g");function ch(e){return yo(e)?function(e){for(var t=dh.lastIndex=0;dh.test(e);)++t;return t}(e):$c(e)}var hh=Math.ceil;function ph(e,t){var n=(t=void 0===t?" ":dt(t)).length;if(n<2)return n?Zc(t,e):t;var i=Zc(t,hh(e/ch(t)));return yo(t)?vo(ko(i),0,e).join(""):i.slice(0,e)}var fh=Math.ceil,gh=Math.floor;var vh=/^\s+/,mh=Ge.parseInt;var yh=ki((function(e,t){return Ei(e,32,void 0,t,Qn(t,Un(yh)))}));yh.placeholder={};var bh=ki((function(e,t){return Ei(e,64,void 0,t,Qn(t,Un(bh)))}));bh.placeholder={};var xh=Vl((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Eh=Yr((function(e,t){return null==e?{}:function(e,t){return jc(e,t,(function(t,n){return Ol(e,n)}))}(e,t)}));function wh(e,t,n,i){for(var r=n-1,o=e.length;++r<o;)if(i(e[r],t))return r;return-1}var Ch=Array.prototype.splice;function Nh(e,t,n,i){var r=i?wh:Rn,o=-1,a=t.length,s=e;for(e===t&&(t=gn(t)),n&&(s=ot(e,Zi(n)));++o<a;)for(var l=0,u=t[o],d=n?n(u):u;(l=r(s,d,l,i))>-1;)s!==e&&Ch.call(s,l,1),Ch.call(e,l,1);return e}function _h(e,t){return e&&e.length&&t&&t.length?Nh(e,t):e}var Sh=ki(_h);var Mh=Array.prototype.splice;function Th(e,t){for(var n=e?t.length:0,i=n-1;n--;){var r=t[n];if(n==i||r!==o){var o=r;qn(r)?Mh.call(e,r,1):Pc(e,r)}}return e}var Ah=Yr((function(e,t){var n=null==e?0:e.length,i=Gr(e,t);return Th(e,ot(t,(function(e){return qn(e,n)?+e:e})).sort(Hc)),i})),Oh=Math.floor,kh=Math.random;function Dh(e,t){return e+Oh(kh()*(t-e+1))}var Rh=parseFloat,Ph=Math.min,Ih=Math.random;var Lh=Math.ceil,Bh=Math.max;function jh(e){return function(t,n,i){return i&&"number"!=typeof i&&Ii(t,n,i)&&(n=i=void 0),t=St(t),void 0===n?(n=t,t=0):n=St(n),function(e,t,n,i){for(var r=-1,o=Bh(Lh((t-e)/(n||1)),0),a=Array(o);o--;)a[i?o:++r]=e,e+=n;return a}(t,n,i=void 0===i?t<n?1:-1:St(i),e)}}var zh=jh(),Hh=jh(!0),Fh=Yr((function(e,t){return Ei(e,256,void 0,void 0,void 0,t)}));function Wh(e,t,n,i,r){return r(e,(function(e,r,o){n=i?(i=!1,e):t(n,e,r,o)})),n}function Gh(e,t,n){var i=at(e)?Io:Wh,r=arguments.length<3;return i(e,Ll(t),n,r,Gl)}function Uh(e,t,n,i){var r=null==e?0:e.length;for(i&&r&&(n=e[--r]);r--;)n=t(n,e[r],r,e);return n}var Vh=Array.prototype.reverse;function Xh(e){return null==e?e:Vh.call(e)}var qh=ma("round");function Kh(e){var t=e.length;return t?e[Dh(0,t-1)]:void 0}function Yh(e){return Kh(_d(e))}function Qh(e,t){var n=-1,i=e.length,r=i-1;for(t=void 0===t?i:t;++n<t;){var o=Dh(n,r),a=e[o];e[o]=e[n],e[n]=a}return e.length=t,e}function Zh(e,t){return Qh(gn(e),wa(t,0,e.length))}function $h(e,t){var n=_d(e);return Qh(n,wa(t,0,n.length))}function Jh(e){return Qh(gn(e))}function ep(e){return Qh(_d(e))}var tp=pa((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));function np(e,t){var n;return Gl(e,(function(e,i,r){return!(n=t(e,i,r))})),!!n}var ip=ki((function(e,t){if(null==e)return[];var n=t.length;return n>1&&Ii(e,t[0],t[1])?t=[]:n>2&&Ii(t[0],t[1],t[2])&&(t=[t[0]]),Fc(e,qr(t,1),[])})),rp=4294967294,op=Math.floor,ap=Math.min;function sp(e,t,n,i){var r=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(t=n(t))!=t,s=null===t,l=nt(t),u=void 0===t;r<o;){var d=op((r+o)/2),c=n(e[d]),h=void 0!==c,p=null===c,f=c==c,g=nt(c);if(a)var v=i||f;else v=u?f&&(i||h):s?f&&h&&(i||!p):l?f&&h&&!p&&(i||!g):!p&&!g&&(i?c<=t:c<t);v?r=d+1:o=d}return ap(o,rp)}var lp=2147483647;function up(e,t,n){var i=0,r=null==e?i:e.length;if("number"==typeof t&&t==t&&r<=lp){for(;i<r;){var o=i+r>>>1,a=e[o];null!==a&&!nt(a)&&(n?a<=t:a<t)?i=o+1:r=o}return r}return sp(e,t,Tt,n)}function dp(e,t){for(var n=-1,i=e.length,r=0,o=[];++n<i;){var a=e[n],s=t?t(a):a;if(!n||!_i(s,l)){var l=s;o[r++]=0===a?0:a}}return o}var cp=Math.max;var hp=pa((function(e,t,n){return e+(n?" ":"")+Ro(t)}));var pp=ct((function(e,t){return e-t}),0);var fp=Object.prototype,gp=fp.hasOwnProperty;function vp(e,t,n,i){return void 0===e||_i(e,fp[n])&&!gp.call(i,n)?t:e}var mp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function yp(e){return"\\"+mp[e]}var bp=/<%=([\s\S]+?)%>/g,xp={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:bp,variable:"",imports:{_:{escape:Bu}}},Ep=/\b__p \+= '';/g,wp=/\b(__p \+=) '' \+/g,Cp=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Np=/[()=,{}\[\]\/\s]/,_p=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Sp=/($^)/,Mp=/['\n\r\u2028\u2029\\]/g,Tp=Object.prototype.hasOwnProperty;function Ap(e,t){return t(e)}var Op=4294967295,kp=Math.min;function Dp(e,t){var n=e;return n instanceof ln&&(n=n.value()),Io(t,(function(e,t){return t.func.apply(t.thisArg,Ur([e],t.args))}),n)}function Rp(){return Dp(this.__wrapped__,this.__actions__)}var Pp=9007199254740991;function Ip(e,t){for(var n=e.length;n--&&Rn(t,e[n],0)>-1;);return n}function Lp(e,t){for(var n=-1,i=e.length;++n<i&&Rn(t,e[n],0)>-1;);return n}var Bp=/^\s+/;var jp=/\w*$/;var zp=Lo({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Hp=/&(?:amp|lt|gt|quot|#39);/g,Fp=RegExp(Hp.source);var Wp=Fa&&1/Qs(new Fa([,-0]))[1]==1/0?function(e){return new Fa(e)}:un,Gp=200;function Up(e,t,n){var i=-1,r=Pn,o=e.length,a=!0,s=[],l=s;if(n)a=!1,r=gu;else if(o>=Gp){var u=t?null:Wp(e);if(u)return Qs(u);a=!1,r=Vs,l=new Gs}else l=t?[]:s;e:for(;++i<o;){var d=e[i],c=t?t(d):d;if(d=n||0!==d?d:0,a&&c==c){for(var h=l.length;h--;)if(l[h]===c)continue e;t&&l.push(c),s.push(d)}else r(l,c,n)||(l!==s&&l.push(c),s.push(d))}return s}var Vp=ki((function(e){return Up(qr(e,1,ou,!0))})),Xp=ki((function(e){var t=bu(e);return ou(t)&&(t=void 0),Up(qr(e,1,ou,!0),Ll(t))})),qp=ki((function(e){var t=bu(e);return t="function"==typeof t?t:void 0,Up(qr(e,1,ou,!0),void 0,t)}));function Kp(e,t){return e&&e.length?Up(e,Ll(t)):[]}var Yp=0;var Qp=Math.max;function Zp(e){if(!e||!e.length)return[];var t=0;return e=Oa(e,(function(e){if(ou(e))return t=Qp(e.length,t),!0})),zi(t,(function(t){return ot(e,Pl(t))}))}function $p(e,t){if(!e||!e.length)return[];var n=Zp(e);return null==t?n:ot(n,(function(e){return en(t,void 0,e)}))}function Jp(e,t,n,i){return Bc(e,t,n(Fr(e,t)),i)}var ef=pa((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}));var tf=ki((function(e,t){return ou(e)?mu(e,t):[]}));var nf=Yr((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,r=function(t){return Gr(t,e)};return!(t>1||this.__actions__.length)&&i instanceof ln&&qn(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Ap,args:[r],thisArg:void 0}),new fn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(r)}));function rf(e,t,n){var i=e.length;if(i<2)return i?Up(e[0]):[];for(var r=-1,o=Array(i);++r<i;)for(var a=e[r],s=-1;++s<i;)s!=r&&(o[r]=mu(o[r]||a,e[s],t,n));return Up(qr(o,1),t,n)}var of=ki((function(e){return rf(Oa(e,ou))})),af=ki((function(e){var t=bu(e);return ou(t)&&(t=void 0),rf(Oa(e,ou),Ll(t))})),sf=ki((function(e){var t=bu(e);return t="function"==typeof t?t:void 0,rf(Oa(e,ou),void 0,t)})),lf=ki(Zp);function uf(e,t,n){for(var i=-1,r=e.length,o=t.length,a={};++i<r;){var s=i<o?t[i]:void 0;n(a,e[i],s)}return a}var df=ki((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,$p(e,n)})),cf={chunk:function(e,t,n){t=(n?Ii(e,t,n):void 0===t)?1:Ea(Mt(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var r=0,o=0,a=Array(xa(i/t));r<i;)a[o++]=go(e,r,r+=t);return a},compact:function(e){for(var t=-1,n=null==e?0:e.length,i=0,r=[];++t<n;){var o=e[t];o&&(r[i++]=o)}return r},concat:Ws,difference:yu,differenceBy:xu,differenceWith:Eu,drop:function(e,t,n){var i=null==e?0:e.length;return i?go(e,(t=n||void 0===t?1:Mt(t))<0?0:t,i):[]},dropRight:function(e,t,n){var i=null==e?0:e.length;return i?go(e,0,(t=i-(t=n||void 0===t?1:Mt(t)))<0?0:t):[]},dropRightWhile:function(e,t){return e&&e.length?Cu(e,Ll(t),!0,!0):[]},dropWhile:function(e,t){return e&&e.length?Cu(e,Ll(t),!0):[]},fill:function(e,t,n,i){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&Ii(e,t,n)&&(n=0,i=r),function(e,t,n,i){var r=e.length;for((n=Mt(n))<0&&(n=-n>r?0:r+n),(i=void 0===i||i>r?r:Mt(i))<0&&(i+=r),i=n>i?0:Gu(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},findIndex:Ku,findLastIndex:Ju,first:td,flatten:Kr,flattenDeep:function(e){return(null==e?0:e.length)?qr(e,od):[]},flattenDepth:function(e,t){return(null==e?0:e.length)?qr(e,t=void 0===t?1:Mt(t)):[]},fromPairs:function(e){for(var t=-1,n=null==e?0:e.length,i={};++t<n;){var r=e[t];i[r[0]]=r[1]}return i},head:td,indexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=null==n?0:Mt(n);return r<0&&(r=Md(i+r,0)),Rn(e,t,r)},initial:function(e){return(null==e?0:e.length)?go(e,0,-1):[]},intersection:kd,intersectionBy:Dd,intersectionWith:Rd,join:function(e,t){return null==e?"":lc.call(e,t)},last:bu,lastIndexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i;return void 0!==n&&(r=(r=Mt(n))<0?cc(i+r,0):hc(r,i-1)),t==t?function(e,t,n){for(var i=n+1;i--;)if(e[i]===t)return i;return i}(e,t,r):kn(e,Dn,r,!0)},nth:function(e,t){return e&&e.length?Rc(e,Mt(t)):void 0},pull:Sh,pullAll:_h,pullAllBy:function(e,t,n){return e&&e.length&&t&&t.length?Nh(e,t,Ll(n)):e},pullAllWith:function(e,t,n){return e&&e.length&&t&&t.length?Nh(e,t,void 0,n):e},pullAt:Ah,remove:function(e,t){var n=[];if(!e||!e.length)return n;var i=-1,r=[],o=e.length;for(t=Ll(t);++i<o;){var a=e[i];t(a,i,e)&&(n.push(a),r.push(i))}return Th(e,r),n},reverse:Xh,slice:function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&Ii(e,t,n)?(t=0,n=i):(t=null==t?0:Mt(t),n=void 0===n?i:Mt(n)),go(e,t,n)):[]},sortedIndex:function(e,t){return up(e,t)},sortedIndexBy:function(e,t,n){return sp(e,t,Ll(n))},sortedIndexOf:function(e,t){var n=null==e?0:e.length;if(n){var i=up(e,t);if(i<n&&_i(e[i],t))return i}return-1},sortedLastIndex:function(e,t){return up(e,t,!0)},sortedLastIndexBy:function(e,t,n){return sp(e,t,Ll(n),!0)},sortedLastIndexOf:function(e,t){if(null==e?0:e.length){var n=up(e,t,!0)-1;if(_i(e[n],t))return n}return-1},sortedUniq:function(e){return e&&e.length?dp(e):[]},sortedUniqBy:function(e,t){return e&&e.length?dp(e,Ll(t)):[]},tail:function(e){var t=null==e?0:e.length;return t?go(e,1,t):[]},take:function(e,t,n){return e&&e.length?go(e,0,(t=n||void 0===t?1:Mt(t))<0?0:t):[]},takeRight:function(e,t,n){var i=null==e?0:e.length;return i?go(e,(t=i-(t=n||void 0===t?1:Mt(t)))<0?0:t,i):[]},takeRightWhile:function(e,t){return e&&e.length?Cu(e,Ll(t),!1,!0):[]},takeWhile:function(e,t){return e&&e.length?Cu(e,Ll(t)):[]},union:Vp,unionBy:Xp,unionWith:qp,uniq:function(e){return e&&e.length?Up(e):[]},uniqBy:Kp,uniqWith:function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Up(e,void 0,t):[]},unzip:Zp,unzipWith:$p,without:tf,xor:of,xorBy:af,xorWith:sf,zip:lf,zipObject:function(e,t){return uf(e||[],t||[],Mi)},zipObjectDeep:function(e,t){return uf(e||[],t||[],Bc)},zipWith:df},hf={countBy:ql,each:_u,eachRight:Ou,every:function(e,t,n){var i=at(e)?Hu:Fu;return n&&Ii(e,t,n)&&(t=void 0),i(e,Ll(t))},filter:Vu,find:Yu,findLast:ed,flatMap:function(e,t){return qr(id(e,t),1)},flatMapDeep:function(e,t){return qr(id(e,t),rd)},flatMapDepth:function(e,t,n){return n=void 0===n?1:Mt(n),qr(id(e,t),n)},forEach:_u,forEachRight:Ou,groupBy:hd,includes:function(e,t,n,i){e=Pi(e)?e:_d(e),n=n&&!i?Mt(n):0;var r=e.length;return n<0&&(n=Sd(r+n,0)),Cd(e)?n<=r&&e.indexOf(t,n)>-1:!!r&&Rn(e,t,n)>-1},invokeMap:Ud,keyBy:dc,map:id,orderBy:function(e,t,n,i){return null==e?[]:(at(t)||(t=null==t?[]:[t]),at(n=i?void 0:n)||(n=null==n?[]:[n]),Fc(e,t,n))},partition:xh,reduce:Gh,reduceRight:function(e,t,n){var i=at(e)?Uh:Wh,r=arguments.length<3;return i(e,Ll(t),n,r,Au)},reject:function(e,t){return(at(e)?Oa:Uu)(e,Tc(Ll(t)))},sample:function(e){return(at(e)?Kh:Yh)(e)},sampleSize:function(e,t,n){return t=(n?Ii(e,t,n):void 0===t)?1:Mt(t),(at(e)?Zh:$h)(e,t)},shuffle:function(e){return(at(e)?Jh:ep)(e)},size:function(e){if(null==e)return 0;if(Pi(e))return Cd(e)?ch(e):e.length;var t=Ja(e);return"[object Map]"==t||"[object Set]"==t?e.size:ur(e).length},some:function(e,t,n){var i=at(e)?Us:np;return n&&Ii(e,t,n)&&(t=void 0),i(e,Ll(t))},sortBy:ip},pf=Ql,ff={after:function(e,t){if("function"!=typeof t)throw new TypeError("Expected a function");return e=Mt(e),function(){if(--e<1)return t.apply(this,arguments)}},ary:Ci,before:co,bind:ho,bindKey:fo,curry:Kl,curryRight:Yl,debounce:eu,defer:pu,delay:fu,flip:function(e){return Ei(e,512)},memoize:Rr,negate:Tc,once:function(e){return co(2,e)},overArgs:Xc,partial:yh,partialRight:bh,rearg:Fh,rest:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return ki(e,t=void 0===t?t:Mt(t))},spread:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=null==t?0:cp(Mt(t),0),ki((function(n){var i=n[t],r=vo(n,0,t);return i&&Ur(r,i),en(e,this,r)}))},throttle:function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return mt(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),eu(e,t,{leading:i,maxWait:t,trailing:r})},unary:function(e){return Ci(e,1)},wrap:function(e,t){return yh(Nu(t),e)}},gf={castArray:function(){if(!arguments.length)return[];var e=arguments[0];return at(e)?e:[e]},clone:function(e){return Hs(e,4)},cloneDeep:Fs,cloneDeepWith:function(e,t){return Hs(e,5,t="function"==typeof t?t:void 0)},cloneWith:function(e,t){return Hs(e,4,t="function"==typeof t?t:void 0)},conformsTo:function(e,t){return null==t||Bl(e,t,dr(t))},eq:_i,gt:gd,gte:vd,isArguments:Ui,isArray:at,isArrayBuffer:Xd,isArrayLike:Pi,isArrayLikeObject:ou,isBoolean:function(e){return!0===e||!1===e||et(e)&&"[object Boolean]"==Je(e)},isBuffer:Yi,isDate:Kd,isElement:function(e){return et(e)&&1===e.nodeType&&!ro(e)},isEmpty:Qd,isEqual:Zd,isEqualWith:function(e,t,n){var i=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===i?xl(e,t,void 0,n):!!i},isError:so,isFinite:Jd,isFunction:Rt,isInteger:ec,isLength:Ri,isMap:As,isMatch:function(e,t){return e===t||Cl(e,t,_l(t))},isMatchWith:function(e,t,n){return n="function"==typeof n?n:void 0,Cl(e,t,_l(t),n)},isNaN:function(e){return nc(e)&&e!=+e},isNative:function(e){if(ic(e))throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Vt(e)},isNil:rc,isNull:function(e){return null===e},isNumber:nc,isObject:mt,isObjectLike:et,isPlainObject:ro,isRegExp:ac,isSafeInteger:function(e){return ec(e)&&e>=-9007199254740991&&e<=sc},isSet:ks,isString:Cd,isSymbol:nt,isTypedArray:ir,isUndefined:function(e){return void 0===e},isWeakMap:function(e){return et(e)&&"[object WeakMap]"==Ja(e)},isWeakSet:function(e){return et(e)&&"[object WeakSet]"==Je(e)},lt:vc,lte:mc,toArray:Dc,toFinite:St,toInteger:Mt,toLength:Gu,toNumber:Ct,toPlainObject:su,toSafeInteger:function(e){return e?wa(Mt(e),-9007199254740991,Pp):0===e?e:0},toString:Br},vf={add:ht,ceil:ya,divide:wu,floor:ad,max:function(e){return e&&e.length?yc(e,Tt,pd):void 0},maxBy:function(e,t){return e&&e.length?yc(e,Ll(t),pd):void 0},mean:function(e){return Ec(e,Tt)},meanBy:function(e,t){return Ec(e,Ll(t))},min:function(e){return e&&e.length?yc(e,Tt,gc):void 0},minBy:function(e,t){return e&&e.length?yc(e,Ll(t),gc):void 0},multiply:Sc,round:qh,subtract:pp,sum:function(e){return e&&e.length?bc(e,Tt):0},sumBy:function(e,t){return e&&e.length?bc(e,Ll(t)):0}},mf=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Ct(n))==n?n:0),void 0!==t&&(t=(t=Ct(t))==t?t:0),wa(Ct(e),t,n)},yf=function(e,t,n){return t=St(t),void 0===n?(n=t,t=0):n=St(n),function(e,t,n){return e>=Ed(t,n)&&e<xd(t,n)}(e=Ct(e),t,n)},bf=function(e,t,n){if(n&&"boolean"!=typeof n&&Ii(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=St(e),void 0===t?(t=e,e=0):t=St(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var r=Ih();return Ph(e+r*(t-e+Rh("1e-"+((r+"").length-1))),t)}return Dh(e,t)},xf={assign:hr,assignIn:vr,assignInWith:mr,assignWith:yr,at:Qr,create:function(e,t){var n=Zt(e);return null==t?n:Na(n,t)},defaults:iu,defaultsDeep:cu,entries:Du,entriesIn:Ru,extend:vr,extendWith:mr,findKey:function(e,t){return Qu(e,Ll(t),Fl)},findLastKey:function(e,t){return Qu(e,Ll(t),Tu)},forIn:function(e,t){return null==e?e:Hl(e,Nu(t),gr)},forInRight:function(e,t){return null==e?e:Mu(e,Nu(t),gr)},forOwn:function(e,t){return e&&Fl(e,Nu(t))},forOwnRight:function(e,t){return e&&Tu(e,Nu(t))},functions:function(e){return null==e?[]:dd(e,dr(e))},functionsIn:function(e){return null==e?[]:dd(e,gr(e))},get:Wr,has:bd,hasIn:Ol,invert:Ld,invertBy:Hd,invoke:Gd,keys:dr,keysIn:gr,mapKeys:function(e,t){var n={};return t=Ll(t),Fl(e,(function(e,i,r){Ni(n,t(e,i,r),e)})),n},mapValues:function(e,t){var n={};return t=Ll(t),Fl(e,(function(e,i,r){Ni(n,i,t(e,i,r))})),n},merge:wc,mergeWith:du,omit:Lc,omitBy:function(e,t){return zc(e,Tc(Ll(t)))},pick:Eh,pickBy:zc,result:function(e,t,n){var i=-1,r=(t=jr(t,e)).length;for(r||(r=1,e=void 0);++i<r;){var o=null==e?void 0:e[Hr(t[i])];void 0===o&&(i=r,o=n),e=Rt(o)?o.call(e):o}return e},set:function(e,t,n){return null==e?e:Bc(e,t,n)},setWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Bc(e,t,n,i)},toPairs:Du,toPairsIn:Ru,transform:function(e,t,n){var i=at(e),r=i||Yi(e)||ir(e);if(t=Ll(t),null==n){var o=e&&e.constructor;n=r?i?new o:[]:mt(e)&&Rt(o)?Zt(Zr(e)):{}}return(r?On:Fl)(e,(function(e,i,r){return t(n,e,i,r)})),n},unset:function(e,t){return null==e||Pc(e,t)},update:function(e,t,n){return null==e?e:Jp(e,t,Nu(n))},updateWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Jp(e,t,Nu(n),i)},values:_d,valuesIn:function(e){return null==e?[]:Nd(e,gr(e))}},Ef={at:nf,chain:ba,commit:function(){return new fn(this.value(),this.__chain__)},lodash:yn,next:function(){void 0===this.__values__&&(this.__values__=Dc(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 an;){var i=vn(n);i.__index__=0,i.__values__=void 0,t?r.__wrapped__=i:t=i;var r=i;n=n.__wrapped__}return r.__wrapped__=e,t},reverse:function(){var e=this.__wrapped__;if(e instanceof ln){var t=e;return this.__actions__.length&&(t=new ln(this)),(t=t.reverse()).__actions__.push({func:Ap,args:[Xh],thisArg:void 0}),new fn(t,this.__chain__)}return this.thru(Xh)},tap:function(e,t){return t(e),e},thru:Ap,toIterator:function(){return this},toJSON:Rp,value:Rp,valueOf:Rp,wrapperChain:function(){return ba(this)}},wf={camelCase:fa,capitalize:Po,deburr:Ho,endsWith:function(e,t,n){e=Br(e),t=dt(t);var i=e.length,r=n=void 0===n?i:wa(Mt(n),0,i);return(n-=t.length)>=0&&e.slice(n,r)==t},escape:Bu,escapeRegExp:function(e){return(e=Br(e))&&zu.test(e)?e.replace(ju,"\\$&"):e},kebabCase:uc,lowerCase:pc,lowerFirst:fc,pad:function(e,t,n){e=Br(e);var i=(t=Mt(t))?ch(e):0;if(!t||i>=t)return e;var r=(t-i)/2;return ph(gh(r),n)+e+ph(fh(r),n)},padEnd:function(e,t,n){e=Br(e);var i=(t=Mt(t))?ch(e):0;return t&&i<t?e+ph(t-i,n):e},padStart:function(e,t,n){e=Br(e);var i=(t=Mt(t))?ch(e):0;return t&&i<t?ph(t-i,n)+e:e},parseInt:function(e,t,n){return n||null==t?t=0:t&&(t=+t),mh(Br(e).replace(vh,""),t||0)},repeat:function(e,t,n){return t=(n?Ii(e,t,n):void 0===t)?1:Mt(t),Zc(Br(e),t)},replace:function(){var e=arguments,t=Br(e[0]);return e.length<3?t:t.replace(e[1],e[2])},snakeCase:tp,split:function(e,t,n){return n&&"number"!=typeof n&&Ii(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=Br(e))&&("string"==typeof t||null!=t&&!ac(t))&&!(t=dt(t))&&yo(e)?vo(ko(e),0,n):e.split(t,n):[]},startCase:hp,startsWith:function(e,t,n){return e=Br(e),n=null==n?0:wa(Mt(n),0,e.length),t=dt(t),e.slice(n,n+t.length)==t},template:function(e,t,n){var i=xp.imports._.templateSettings||xp;n&&Ii(e,t,n)&&(t=void 0),e=Br(e),t=mr({},t,i,vp);var r,o,a=mr({},t.imports,i.imports,vp),s=dr(a),l=Nd(a,s),u=0,d=t.interpolate||Sp,c="__p += '",h=RegExp((t.escape||Sp).source+"|"+d.source+"|"+(d===bp?_p:Sp).source+"|"+(t.evaluate||Sp).source+"|$","g"),p=Tp.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(h,(function(t,n,i,a,s,l){return i||(i=a),c+=e.slice(u,l).replace(Mp,yp),n&&(r=!0,c+="' +\n__e("+n+") +\n'"),s&&(o=!0,c+="';\n"+s+";\n__p += '"),i&&(c+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),u=l+t.length,t})),c+="';\n";var f=Tp.call(t,"variable")&&t.variable;if(f){if(Np.test(f))throw new Error("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(o?c.replace(Ep,""):c).replace(wp,"$1").replace(Cp,"$1;"),c="function("+(f||"obj")+") {\n"+(f?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var g=lo((function(){return Function(s,p+"return "+c).apply(void 0,l)}));if(g.source=c,so(g))throw g;return g},templateSettings:xp,toLower:function(e){return Br(e).toLowerCase()},toUpper:function(e){return Br(e).toUpperCase()},trim:function(e,t,n){if((e=Br(e))&&(n||void 0===t))return vt(e);if(!e||!(t=dt(t)))return e;var i=ko(e),r=ko(t);return vo(i,Lp(i,r),Ip(i,r)+1).join("")},trimEnd:function(e,t,n){if((e=Br(e))&&(n||void 0===t))return e.slice(0,ft(e)+1);if(!e||!(t=dt(t)))return e;var i=ko(e);return vo(i,0,Ip(i,ko(t))+1).join("")},trimStart:function(e,t,n){if((e=Br(e))&&(n||void 0===t))return e.replace(Bp,"");if(!e||!(t=dt(t)))return e;var i=ko(e);return vo(i,Lp(i,ko(t))).join("")},truncate:function(e,t){var n=30,i="...";if(mt(t)){var r="separator"in t?t.separator:r;n="length"in t?Mt(t.length):n,i="omission"in t?dt(t.omission):i}var o=(e=Br(e)).length;if(yo(e)){var a=ko(e);o=a.length}if(n>=o)return e;var s=n-ch(i);if(s<1)return i;var l=a?vo(a,0,s).join(""):e.slice(0,s);if(void 0===r)return l+i;if(a&&(s+=l.length-s),ac(r)){if(e.slice(s).search(r)){var u,d=l;for(r.global||(r=RegExp(r.source,Br(jp.exec(r))+"g")),r.lastIndex=0;u=r.exec(d);)var c=u.index;l=l.slice(0,void 0===c?s:c)}}else if(e.indexOf(dt(r),s)!=s){var h=l.lastIndexOf(r);h>-1&&(l=l.slice(0,h))}return l+i},unescape:function(e){return(e=Br(e))&&Fp.test(e)?e.replace(Hp,zp):e},upperCase:ef,upperFirst:Ro,words:ca},Cf={attempt:lo,bindAll:po,cond:function(e){var t=null==e?0:e.length,n=Ll;return e=t?ot(e,(function(e){if("function"!=typeof e[1])throw new TypeError("Expected a function");return[n(e[0]),e[1]]})):[],ki((function(n){for(var i=-1;++i<t;){var r=e[i];if(en(r[0],this,n))return en(r[1],this,n)}}))},conforms:function(e){return function(e){var t=dr(e);return function(n){return Bl(n,e,t)}}(Hs(e,1))},constant:Sn,defaultTo:function(e,t){return null==e||e!=e?t:e},flow:ld,flowRight:ud,identity:Tt,iteratee:function(e){return Ll("function"==typeof e?e:Hs(e,1))},matches:function(e){return Ml(Hs(e,1))},matchesProperty:function(e,t){return Rl(e,Hs(t,1))},method:Cc,methodOf:Nc,mixin:_c,noop:un,nthArg:function(e){return e=Mt(e),ki((function(t){return Rc(t,e)}))},over:Gc,overEvery:qc,overSome:Kc,property:Il,propertyOf:function(e){return function(t){return null==e?void 0:Fr(e,t)}},range:zh,rangeRight:Hh,stubArray:ka,stubFalse:Vi,stubObject:function(){return{}},stubString:function(){return""},stubTrue:function(){return!0},times:function(e,t){if((e=Mt(e))<1||e>9007199254740991)return[];var n=Op,i=kp(e,Op);t=Nu(t),e-=Op;for(var r=zi(i,t);++n<e;)t(n);return r},toPath:function(e){return at(e)?ot(e,Hr):nt(e)?[e]:gn(Lr(Br(e)))},uniqueId:function(e){var t=++Yp;return Br(e)+t}};var Nf=Math.max,_f=Math.min;var Sf=Math.min;var Mf,Tf,Af=4294967295,Of=Array.prototype,kf=Object.prototype.hasOwnProperty,Df=Ue?Ue.iterator:void 0,Rf=Math.max,Pf=Math.min,If=function(e){return function(t,n,i){if(null==i){var r=mt(n),o=r&&dr(n),a=o&&o.length&&dd(n,o);(a?a.length:r)||(i=n,n=t,t=this)}return e(t,n,i)}}(_c);yn.after=ff.after,yn.ary=ff.ary,yn.assign=xf.assign,yn.assignIn=xf.assignIn,yn.assignInWith=xf.assignInWith,yn.assignWith=xf.assignWith,yn.at=xf.at,yn.before=ff.before,yn.bind=ff.bind,yn.bindAll=Cf.bindAll,yn.bindKey=ff.bindKey,yn.castArray=gf.castArray,yn.chain=Ef.chain,yn.chunk=cf.chunk,yn.compact=cf.compact,yn.concat=cf.concat,yn.cond=Cf.cond,yn.conforms=Cf.conforms,yn.constant=Cf.constant,yn.countBy=hf.countBy,yn.create=xf.create,yn.curry=ff.curry,yn.curryRight=ff.curryRight,yn.debounce=ff.debounce,yn.defaults=xf.defaults,yn.defaultsDeep=xf.defaultsDeep,yn.defer=ff.defer,yn.delay=ff.delay,yn.difference=cf.difference,yn.differenceBy=cf.differenceBy,yn.differenceWith=cf.differenceWith,yn.drop=cf.drop,yn.dropRight=cf.dropRight,yn.dropRightWhile=cf.dropRightWhile,yn.dropWhile=cf.dropWhile,yn.fill=cf.fill,yn.filter=hf.filter,yn.flatMap=hf.flatMap,yn.flatMapDeep=hf.flatMapDeep,yn.flatMapDepth=hf.flatMapDepth,yn.flatten=cf.flatten,yn.flattenDeep=cf.flattenDeep,yn.flattenDepth=cf.flattenDepth,yn.flip=ff.flip,yn.flow=Cf.flow,yn.flowRight=Cf.flowRight,yn.fromPairs=cf.fromPairs,yn.functions=xf.functions,yn.functionsIn=xf.functionsIn,yn.groupBy=hf.groupBy,yn.initial=cf.initial,yn.intersection=cf.intersection,yn.intersectionBy=cf.intersectionBy,yn.intersectionWith=cf.intersectionWith,yn.invert=xf.invert,yn.invertBy=xf.invertBy,yn.invokeMap=hf.invokeMap,yn.iteratee=Cf.iteratee,yn.keyBy=hf.keyBy,yn.keys=dr,yn.keysIn=xf.keysIn,yn.map=hf.map,yn.mapKeys=xf.mapKeys,yn.mapValues=xf.mapValues,yn.matches=Cf.matches,yn.matchesProperty=Cf.matchesProperty,yn.memoize=ff.memoize,yn.merge=xf.merge,yn.mergeWith=xf.mergeWith,yn.method=Cf.method,yn.methodOf=Cf.methodOf,yn.mixin=If,yn.negate=Tc,yn.nthArg=Cf.nthArg,yn.omit=xf.omit,yn.omitBy=xf.omitBy,yn.once=ff.once,yn.orderBy=hf.orderBy,yn.over=Cf.over,yn.overArgs=ff.overArgs,yn.overEvery=Cf.overEvery,yn.overSome=Cf.overSome,yn.partial=ff.partial,yn.partialRight=ff.partialRight,yn.partition=hf.partition,yn.pick=xf.pick,yn.pickBy=xf.pickBy,yn.property=Cf.property,yn.propertyOf=Cf.propertyOf,yn.pull=cf.pull,yn.pullAll=cf.pullAll,yn.pullAllBy=cf.pullAllBy,yn.pullAllWith=cf.pullAllWith,yn.pullAt=cf.pullAt,yn.range=Cf.range,yn.rangeRight=Cf.rangeRight,yn.rearg=ff.rearg,yn.reject=hf.reject,yn.remove=cf.remove,yn.rest=ff.rest,yn.reverse=cf.reverse,yn.sampleSize=hf.sampleSize,yn.set=xf.set,yn.setWith=xf.setWith,yn.shuffle=hf.shuffle,yn.slice=cf.slice,yn.sortBy=hf.sortBy,yn.sortedUniq=cf.sortedUniq,yn.sortedUniqBy=cf.sortedUniqBy,yn.split=wf.split,yn.spread=ff.spread,yn.tail=cf.tail,yn.take=cf.take,yn.takeRight=cf.takeRight,yn.takeRightWhile=cf.takeRightWhile,yn.takeWhile=cf.takeWhile,yn.tap=Ef.tap,yn.throttle=ff.throttle,yn.thru=Ap,yn.toArray=gf.toArray,yn.toPairs=xf.toPairs,yn.toPairsIn=xf.toPairsIn,yn.toPath=Cf.toPath,yn.toPlainObject=gf.toPlainObject,yn.transform=xf.transform,yn.unary=ff.unary,yn.union=cf.union,yn.unionBy=cf.unionBy,yn.unionWith=cf.unionWith,yn.uniq=cf.uniq,yn.uniqBy=cf.uniqBy,yn.uniqWith=cf.uniqWith,yn.unset=xf.unset,yn.unzip=cf.unzip,yn.unzipWith=cf.unzipWith,yn.update=xf.update,yn.updateWith=xf.updateWith,yn.values=xf.values,yn.valuesIn=xf.valuesIn,yn.without=cf.without,yn.words=wf.words,yn.wrap=ff.wrap,yn.xor=cf.xor,yn.xorBy=cf.xorBy,yn.xorWith=cf.xorWith,yn.zip=cf.zip,yn.zipObject=cf.zipObject,yn.zipObjectDeep=cf.zipObjectDeep,yn.zipWith=cf.zipWith,yn.entries=xf.toPairs,yn.entriesIn=xf.toPairsIn,yn.extend=xf.assignIn,yn.extendWith=xf.assignInWith,If(yn,yn),yn.add=vf.add,yn.attempt=Cf.attempt,yn.camelCase=wf.camelCase,yn.capitalize=wf.capitalize,yn.ceil=vf.ceil,yn.clamp=mf,yn.clone=gf.clone,yn.cloneDeep=gf.cloneDeep,yn.cloneDeepWith=gf.cloneDeepWith,yn.cloneWith=gf.cloneWith,yn.conformsTo=gf.conformsTo,yn.deburr=wf.deburr,yn.defaultTo=Cf.defaultTo,yn.divide=vf.divide,yn.endsWith=wf.endsWith,yn.eq=gf.eq,yn.escape=wf.escape,yn.escapeRegExp=wf.escapeRegExp,yn.every=hf.every,yn.find=hf.find,yn.findIndex=cf.findIndex,yn.findKey=xf.findKey,yn.findLast=hf.findLast,yn.findLastIndex=cf.findLastIndex,yn.findLastKey=xf.findLastKey,yn.floor=vf.floor,yn.forEach=hf.forEach,yn.forEachRight=hf.forEachRight,yn.forIn=xf.forIn,yn.forInRight=xf.forInRight,yn.forOwn=xf.forOwn,yn.forOwnRight=xf.forOwnRight,yn.get=xf.get,yn.gt=gf.gt,yn.gte=gf.gte,yn.has=xf.has,yn.hasIn=xf.hasIn,yn.head=cf.head,yn.identity=Tt,yn.includes=hf.includes,yn.indexOf=cf.indexOf,yn.inRange=yf,yn.invoke=xf.invoke,yn.isArguments=gf.isArguments,yn.isArray=at,yn.isArrayBuffer=gf.isArrayBuffer,yn.isArrayLike=gf.isArrayLike,yn.isArrayLikeObject=gf.isArrayLikeObject,yn.isBoolean=gf.isBoolean,yn.isBuffer=gf.isBuffer,yn.isDate=gf.isDate,yn.isElement=gf.isElement,yn.isEmpty=gf.isEmpty,yn.isEqual=gf.isEqual,yn.isEqualWith=gf.isEqualWith,yn.isError=gf.isError,yn.isFinite=gf.isFinite,yn.isFunction=gf.isFunction,yn.isInteger=gf.isInteger,yn.isLength=gf.isLength,yn.isMap=gf.isMap,yn.isMatch=gf.isMatch,yn.isMatchWith=gf.isMatchWith,yn.isNaN=gf.isNaN,yn.isNative=gf.isNative,yn.isNil=gf.isNil,yn.isNull=gf.isNull,yn.isNumber=gf.isNumber,yn.isObject=mt,yn.isObjectLike=gf.isObjectLike,yn.isPlainObject=gf.isPlainObject,yn.isRegExp=gf.isRegExp,yn.isSafeInteger=gf.isSafeInteger,yn.isSet=gf.isSet,yn.isString=gf.isString,yn.isSymbol=gf.isSymbol,yn.isTypedArray=gf.isTypedArray,yn.isUndefined=gf.isUndefined,yn.isWeakMap=gf.isWeakMap,yn.isWeakSet=gf.isWeakSet,yn.join=cf.join,yn.kebabCase=wf.kebabCase,yn.last=bu,yn.lastIndexOf=cf.lastIndexOf,yn.lowerCase=wf.lowerCase,yn.lowerFirst=wf.lowerFirst,yn.lt=gf.lt,yn.lte=gf.lte,yn.max=vf.max,yn.maxBy=vf.maxBy,yn.mean=vf.mean,yn.meanBy=vf.meanBy,yn.min=vf.min,yn.minBy=vf.minBy,yn.stubArray=Cf.stubArray,yn.stubFalse=Cf.stubFalse,yn.stubObject=Cf.stubObject,yn.stubString=Cf.stubString,yn.stubTrue=Cf.stubTrue,yn.multiply=vf.multiply,yn.nth=cf.nth,yn.noop=Cf.noop,yn.now=pf,yn.pad=wf.pad,yn.padEnd=wf.padEnd,yn.padStart=wf.padStart,yn.parseInt=wf.parseInt,yn.random=bf,yn.reduce=hf.reduce,yn.reduceRight=hf.reduceRight,yn.repeat=wf.repeat,yn.replace=wf.replace,yn.result=xf.result,yn.round=vf.round,yn.sample=hf.sample,yn.size=hf.size,yn.snakeCase=wf.snakeCase,yn.some=hf.some,yn.sortedIndex=cf.sortedIndex,yn.sortedIndexBy=cf.sortedIndexBy,yn.sortedIndexOf=cf.sortedIndexOf,yn.sortedLastIndex=cf.sortedLastIndex,yn.sortedLastIndexBy=cf.sortedLastIndexBy,yn.sortedLastIndexOf=cf.sortedLastIndexOf,yn.startCase=wf.startCase,yn.startsWith=wf.startsWith,yn.subtract=vf.subtract,yn.sum=vf.sum,yn.sumBy=vf.sumBy,yn.template=wf.template,yn.times=Cf.times,yn.toFinite=gf.toFinite,yn.toInteger=Mt,yn.toLength=gf.toLength,yn.toLower=wf.toLower,yn.toNumber=gf.toNumber,yn.toSafeInteger=gf.toSafeInteger,yn.toString=gf.toString,yn.toUpper=wf.toUpper,yn.trim=wf.trim,yn.trimEnd=wf.trimEnd,yn.trimStart=wf.trimStart,yn.truncate=wf.truncate,yn.unescape=wf.unescape,yn.uniqueId=Cf.uniqueId,yn.upperCase=wf.upperCase,yn.upperFirst=wf.upperFirst,yn.each=hf.forEach,yn.eachRight=hf.forEachRight,yn.first=cf.head,If(yn,(Mf={},Fl(yn,(function(e,t){kf.call(yn.prototype,t)||(Mf[t]=e)})),Mf),{chain:!1}),yn.VERSION="4.17.21",(yn.templateSettings=wf.templateSettings).imports._=yn,On(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){yn[e].placeholder=yn})),On(["drop","take"],(function(e,t){ln.prototype[e]=function(n){n=void 0===n?1:Rf(Mt(n),0);var i=this.__filtered__&&!t?new ln(this):this.clone();return i.__filtered__?i.__takeCount__=Pf(n,i.__takeCount__):i.__views__.push({size:Pf(n,Af),type:e+(i.__dir__<0?"Right":"")}),i},ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),On(["filter","map","takeWhile"],(function(e,t){var n=t+1,i=1==n||3==n;ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ll(e),type:n}),t.__filtered__=t.__filtered__||i,t}})),On(["head","last"],(function(e,t){var n="take"+(t?"Right":"");ln.prototype[e]=function(){return this[n](1).value()[0]}})),On(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");ln.prototype[e]=function(){return this.__filtered__?new ln(this):this[n](1)}})),ln.prototype.compact=function(){return this.filter(Tt)},ln.prototype.find=function(e){return this.filter(e).head()},ln.prototype.findLast=function(e){return this.reverse().find(e)},ln.prototype.invokeMap=ki((function(e,t){return"function"==typeof e?new ln(this):this.map((function(n){return Wd(n,e,t)}))})),ln.prototype.reject=function(e){return this.filter(Tc(Ll(e)))},ln.prototype.slice=function(e,t){e=Mt(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=Mt(t))<0?n.dropRight(-t):n.take(t-e)),n)},ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ln.prototype.toArray=function(){return this.take(Af)},Fl(ln.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),r=yn[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);r&&(yn.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,s=t instanceof ln,l=a[0],u=s||at(t),d=function(e){var t=r.apply(yn,Ur([e],a));return i&&c?t[0]:t};u&&n&&"function"==typeof l&&1!=l.length&&(s=u=!1);var c=this.__chain__,h=!!this.__actions__.length,p=o&&!c,f=s&&!h;if(!o&&u){t=f?t:new ln(this);var g=e.apply(t,a);return g.__actions__.push({func:Ap,args:[d],thisArg:void 0}),new fn(g,c)}return p&&f?e.apply(this,a):(g=this.thru(d),p?i?g.value()[0]:g.value():g)})})),On(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Of[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);yn.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var r=this.value();return t.apply(at(r)?r:[],e)}return this[n]((function(n){return t.apply(at(n)?n:[],e)}))}})),Fl(ln.prototype,(function(e,t){var n=yn[t];if(n){var i=n.name+"";kf.call(cn,i)||(cn[i]=[]),cn[i].push({name:t,func:n})}})),cn[ii(void 0,2).name]=[{name:"wrapper",func:void 0}],ln.prototype.clone=function(){var e=new ln(this.__wrapped__);return e.__actions__=gn(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=gn(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=gn(this.__views__),e},ln.prototype.reverse=function(){if(this.__filtered__){var e=new ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=at(e),i=t<0,r=n?e.length:0,o=function(e,t,n){for(var i=-1,r=n.length;++i<r;){var o=n[i],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=_f(t,e+a);break;case"takeRight":e=Nf(e,t-a)}}return{start:e,end:t}}(0,r,this.__views__),a=o.start,s=o.end,l=s-a,u=i?s:a-1,d=this.__iteratees__,c=d.length,h=0,p=Sf(l,this.__takeCount__);if(!n||!i&&r==l&&p==l)return Dp(e,this.__actions__);var f=[];e:for(;l--&&h<p;){for(var g=-1,v=e[u+=t];++g<c;){var m=d[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}}f[h++]=v}return f},yn.prototype.at=Ef.at,yn.prototype.chain=Ef.wrapperChain,yn.prototype.commit=Ef.commit,yn.prototype.next=Ef.next,yn.prototype.plant=Ef.plant,yn.prototype.reverse=Ef.reverse,yn.prototype.toJSON=yn.prototype.valueOf=yn.prototype.value=Ef.value,yn.prototype.first=yn.prototype.head,Df&&(yn.prototype[Df]=Ef.toIterator),Tf={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(t){e=t}throw e}},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;var Lf=0;function Bf(e,t,n,i,r,o){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:--Lf,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return Tf.vnode&&Tf.vnode(u),u}var jf=t.LogicFlowUtil.StepDrag,zf=function(e){function n(n){var i=e.call(this)||this;return i.updatePosition=function(e){var t=e.deltaX,n=e.deltaY,r=i.nodeModel,o=r.x,a=r.y;i.nodeModel.x=o+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,r=e.width,o=e.height,a=e.PCTResizeInfo,s=e.pct,l=void 0===s?1:s,u=e.freezeWidth,d=void 0!==u&&u,c=e.freezeHeight,h=void 0!==c&&c,p={width:r,height:o,deltaX:n,deltaY:i};if(a){var f=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&&(f=Math.round(g/a.ResizeBasis.basisHeight*1e5)/1e3),a.ResizePCT.widthPCT=Math.max(Math.min(a.ResizePCT.widthPCT+f,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit),a.ResizePCT.heightPCT=Math.max(Math.min(a.ResizePCT.heightPCT+f,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=r-v,i=o-m;break;case 1:n=v-r,i=o-m;break;case 2:n=v-r,i=m-o;break;case 3:n=r-v,i=m-o}return p.width=v,p.height=m,p.deltaX=n/l,p.deltaY=i/l,p}switch(t){case 0:p.width=d?r:r-n*l,p.height=h?o:o-i*l;break;case 1:p.width=d?r:r+n*l,p.height=h?o:o-i*l;break;case 2:p.width=d?r:r+n*l,p.height=h?o:o+i*l;break;case 3:p.width=d?r:r-n*l,p.height=h?o:o+i*l}return p},i.updateEdgePointByAnchors=function(){var e=i.nodeModel,t=e.id,n=e.anchors,r=i.getNodeEdges(t);r.sourceEdges.forEach((function(e){var t=n.find((function(t){return t.id===e.sourceAnchorId}));t&&e.updateStartPoint({x:t.x,y:t.y})})),r.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,r=i.nodeModel,o=r.x,a=r.y,s=r.width,l=r.height,u=r.radius,d=r.PCTResizeInfo,c=i.nodeModel,h=c.minWidth,p=c.minHeight,f=c.maxWidth,g=c.maxHeight,v=i.index,m=h===f,y=p===g,b=i.getResize({index:v,deltaX:t,deltaY:n,width:s,height:l,PCTResizeInfo:d,pct:1,freezeWidth:m,freezeHeight:y});if(b.width<h||b.width>f||b.height<p||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:o,y:a,width:s,height:l,radius:u},E={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:E})}},i.updateEllipse=function(e){var t=e.deltaX,n=e.deltaY,r=i.nodeModel,o=r.rx,a=r.ry,s=r.x,l=r.y,u=r.PCTResizeInfo,d=i.index,c=i.nodeModel,h=c.minWidth,p=c.minHeight,f=c.maxWidth,g=c.maxHeight,v=h===f,m=p===g,b=o,x=a,E=i.getResize({index:d,deltaX:t,deltaY:n,width:b,height:x,PCTResizeInfo:u,pct:.5,freezeWidth:v,freezeHeight:m});if(E.width<h/2||E.width>f/2||E.height<p/2||E.height>g/2)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:v?0:E.deltaX,deltaY:m?0:E.deltaY}),i.nodeModel.rx=E.width,i.nodeModel.ry=E.height,i.nodeModel.setProperties({nodeSize:{rx:E.width,ry:E.height}});var w={x:s,y:l},C={rx:E.width,ry:E.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:y(y({},w),{rx:o,ry:a}),afterNode:C})}},i.updateDiamond=function(e){var t=e.deltaX,n=e.deltaY,r=i.nodeModel,o=r.rx,a=r.ry,s=r.x,l=r.y,u=r.PCTResizeInfo,d=i.index,c=i.nodeModel,h=c.minWidth,p=c.minHeight,f=c.maxWidth,g=c.maxHeight,v=h===f,m=p===g,y=o,b=a,x=i.getResize({index:d,deltaX:t,deltaY:n,width:y,height:b,PCTResizeInfo:u,pct:.5,freezeWidth:v,freezeHeight:m});if(x.width<h/2||x.width>f/2||x.height<p/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 E={x:s,y:l,rx:o,ry:a},w={rx:x.width,ry:x.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:E,afterNode:w})}},i.eventEmit=function(e){var t=e.deltaX,n=e.deltaY,r=e.beforeNode,o=e.afterNode,a=i.nodeModel,s=a.id,l=a.modelType,u=a.type,d=y({id:s,modelType:l,type:u},r),c=y({id:s,modelType:l,type:u},o);i.graphModel.eventCenter.emit("node:resize",{preData:d,data:c,deltaX:t,deltaY:n,index:i.index,model:i.nodeModel})},i.onDragging=function(e){var n,r=e.deltaX,o=e.deltaY,a=i.graphModel.transformModel,s=i.nodeModel.modelType;r=(n=N(a.fixDeltaXY(r,o),2))[0],o=n[1],s===t.ModelType.RECT_NODE||s===t.ModelType.HTML_NODE?i.updateRect({deltaX:r,deltaY:o}):s===t.ModelType.ELLIPSE_NODE?i.updateEllipse({deltaX:r,deltaY:o}):s===t.ModelType.DIAMOND_NODE&&i.updateDiamond({deltaX:r,deltaY:o})},i.onDragEnd=function(){var e=i.graphModel.gridSize,t=void 0===e?1:e,n=t*Math.round(i.nodeModel.x/t),r=t*Math.round(i.nodeModel.y/t);i.nodeModel.moveTo(n,r),i.updateEdgePointByAnchors()},i.index=n.index,i.nodeModel=n.model,i.graphModel=n.graphModel,i.dragHandler=new jf({onDragging:i.onDragging,onDragEnd:i.onDragEnd,step:1}),i}return m(n,e),n.prototype.getNodeEdges=function(e){for(var t=this.graphModel.edges,n=[],i=[],r=0;r<t.length;r++){var o=t[r];o.sourceNodeId===e?n.push(o):t[r].targetNodeId===e&&i.push(o)}return{sourceEdges:n,targetEdges:i}},n.prototype.render=function(){var e=this.props,n=e.x,i=e.y,r=e.index,o=e.model.getControlPointStyle();return Bf("g",{className:"lf-resize-control-".concat(r),children:Bf(t.Rect,y({className:"lf-node-control",x:n,y:i},o,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(t.Component),Hf=function(e){function n(){var t=e.call(this)||this;return t.state={},t}return m(n,e),n.prototype.getResizeControl=function(){var e=this.props,t=e.model,n=e.graphModel,i=t.x,r=t.y,o=t.width,a=t.height,s={minX:i-o/2,minY:r-a/2,maxX:i+o/2,maxY:r+a/2},l=s.minX,u=s.minY,d=s.maxX,c=s.maxY;return[{x:l,y:u},{x:d,y:u},{x:d,y:c},{x:l,y:c}].map((function(e,i){return Bf(zf,y({index:i},e,{model:t,graphModel:n}))}))},n.prototype.getGroupSolid=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.getResizeOutlineStyle();return Bf(t.Rect,y({},a,{x:n,y:i,width:r,height:o}))},n.prototype.render=function(){return Bf("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(t.Component),Ff=function(e){function t(t,n){var i=e.call(this,t,n)||this,r=t.properties.nodeSize;return r&&(i.rx=r.rx,i.ry=r.ry),i}return m(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),Wf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Bf(Hf,{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 Bf("g",{children:[this.getResizeShape(),t.isSelected&&!n?this.getControlGroup():""]})},t}(t.EllipseNode),Gf={type:"ellipse",view:Wf,model:Ff},Uf=function(e){function t(t,n){var i=e.call(this,t,n)||this,r=t.properties.nodeSize;return r&&(i.rx=r.rx,i.ry=r.ry),i}return m(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),Vf=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Bf(Hf,{model:t,graphModel:n})},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.points,i=e.getNodeStyle();return Bf("g",{children:Bf(t.Polygon,y({},i,{points:n}))})},n.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Bf("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},n}(t.DiamondNode),Xf={type:"diamond",view:Vf,model:Uf},qf=function(e){function t(t,n){var i=e.call(this,t,n)||this,r=t.properties.nodeSize;return r&&(i.width=r.width,i.height=r.height),i}return m(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),Kf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Bf(Hf,{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 Bf("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},t}(t.HtmlNode),Yf={type:"html",view:Kf,model:qf},Qf=function(e){function t(t,n){var i=e.call(this,t,n)||this,r=t.properties.nodeSize;return r&&(i.width=r.width,i.height=r.height),i}return m(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.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),Zf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Bf(Hf,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){return Bf("g",{children:this.getResizeShape()})},t}(t.RectNode),$f={type:"rect",view:Zf,model:Qf},Jf={pluginName:"nodeResize",step:0,install:function(e){e.register(Gf),e.register(Xf),e.register(Yf),e.register($f)}},eg=function(t){function n(){var e=t.apply(this,_([],N(arguments),!1))||this;return e.isGroup=!0,e.isFolded=!1,e.unfoldedWidth=500,e.unfoldedHeight=300,e.childrenLastFoldStatus={},e}return m(n,t),n.prototype.initNodeData=function(e){var n=this;t.prototype.initNodeData.call(this,e);var i=[];at(e.children)&&(i=e.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)}))},n.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=_(_([],N(this.incoming.edges),!1),N(this.outgoing.edges),!1);this.children.forEach((function(i){var r=t.graphModel.getElement(i);if(r){var o=r.isFolded;if(r.isGroup&&!r.isFolded&&r.foldGroup(e),r.isGroup&&!e){var a=t.childrenLastFoldStatus[i];void 0!==a&&a!==r.isFolded&&r.foldGroup(a)}t.childrenLastFoldStatus[i]=!!o,r.visible=!e;var s=r.incoming.edges,l=r.outgoing.edges;n=_(_(_([],N(n),!1),N(s),!1),N(l),!1)}})),this.foldEdge(e,n)}},n.prototype.getAnchorStyle=function(e){var n=t.prototype.getAnchorStyle.call(this,e);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},n.prototype.foldEdge=function(e,t){var n=this;t.forEach((function(t,i){var r=t.id,o=t.sourceNodeId,a=t.targetNodeId,s=t.startPoint,l=t.endPoint,u=t.type,d=t.text,c=t.getProperties(),h={id:"".concat(r,"__").concat(i),sourceNodeId:o,targetNodeId:a,startPoint:s,endPoint:l,type:u,properties:c,text:null==d?void 0:d.value};t.virtual&&n.graphModel.deleteEdgeById(t.id);var p=n.graphModel.group.getNodeGroup(a);p||(p=n.graphModel.getNodeModelById(a));var f=n.graphModel.group.getNodeGroup(o);f||(f=n.graphModel.getNodeModelById(o)),e&&!1!==t.visible&&(n.children.has(o)||n.id===o?(h.startPoint=void 0,h.sourceNodeId=n.id):(h.endPoint=void 0,h.targetNodeId=n.id),p.id===n.id&&f.id===n.id||n.createVirtualEdge(h),t.visible=!1),e||!1!==t.visible||(p&&p.isGroup&&p.isFolded?(h.targetNodeId=p.id,h.endPoint=void 0,n.createVirtualEdge(h)):f&&f.isGroup&&f.isFolded?(h.sourceNodeId=f.id,h.startPoint=void 0,n.createVirtualEdge(h)):t.visible=!0)}))},n.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isFoldedEdge=!0},n.prototype.isInRange=function(e){var t=e.minX,n=e.minY,i=e.maxX,r=e.maxY;return t>=this.x-this.width/2&&i<=this.x+this.width/2&&n>=this.y-this.height/2&&r<=this.y+this.height/2},n.prototype.isAllowMoveTo=function(e){var t=e.minX,n=e.minY,i=e.maxX,r=e.maxY;return{x:t>=this.x-this.width/2&&i<=this.x+this.width/2,y:n>=this.y-this.height/2&&r<=this.y+this.height/2}},n.prototype.setAllowAppendChild=function(e){this.setProperty("groupAddable",e)},n.prototype.addChild=function(t){this.children.add(t),this.graphModel.eventCenter.emit(e.ExtensionEventType.GROUP_ADD_NODE,{data:this.getData()})},n.prototype.removeChild=function(t){this.children.delete(t),this.graphModel.eventCenter.emit(e.ExtensionEventType.GROUP_REMOVE_NODE,{data:this.getData()})},n.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},n.prototype.getData=function(){var e=this,n=t.prototype.getData.call(this);n.children=[],this.children.forEach((function(t){var i=e.graphModel.getNodeModelById(t);i&&!i.virtual&&n.children.push(t)}));var i=n.properties;return null==i||delete i.groupAddable,null==i||delete i.isFolded,n},n.prototype.getHistoryData=function(){var e=t.prototype.getData.call(this);e.children=_([],N(this.children),!1),e.isGroup=!0;var n=e.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(e.x=e.x+this.unfoldedWidth/2-this.foldedWidth/2,e.y=e.y+this.unfoldedHeight/2-this.foldedHeight/2),e},n.prototype.isAllowAppendIn=function(e){return!0},n.prototype.toBack=function(){this.zIndex--},n}(Qf),tg=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(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,r=e.x,o=e.y,a=e.radius,s=e.properties,l=e.getAddableOutlineStyle;if(!s.groupAddable)return null;var u=this.props.model.getNodeStyle().strokeWidth,d=void 0===u?0:u,c=l(),h=n+d+8,p=i+d+8;return t.h("rect",y(y({},c),{width:h,height:p,x:r-h/2,y:o-p/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 r=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)}}),r])},n.prototype.getResizeShape=function(){return t.h("g",{},[this.getAddableShape(),e.prototype.getResizeShape.call(this),this.getFoldIcon()])},n}(Zf),ng={type:"group",view:tg,model:eg},ig=-1e4,rg=function(){function n(n){var o=n.lf,a=this;this.topGroupZIndex=ig,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){a.nodeGroupMap.set(t,e.id)}))})),a.checkAndCorrectTopGroupZIndex(t.nodes))},this.appendNodeToGroup=function(t){var n=t.data,i=a.nodeGroupMap.get(n.id);if(i){var r=a.lf.getNodeModelById(i);r.removeChild(n.id),a.nodeGroupMap.delete(n.id),r.setAllowAppendChild(!1)}var o=a.lf.getNodeModelById(n.id),s=null==o?void 0:o.getBounds();if(s&&o){var l=a.getGroup(s,n);if(o.isGroup&&(n.children.forEach((function(e){a.nodeGroupMap.set(e,n.id)})),a.checkAndCorrectTopGroupZIndex([n]),a.nodeSelected({data:n,isSelected:!1,isMultiple:!1})),!l)return;if(!l.isAllowAppendIn(n))return void a.lf.emit(e.ExtensionEventType.GROUP_NOT_ALLOWED,{group:l.getData(),node:n});l.addChild(n.id),a.nodeGroupMap.set(n.id,l.id),l.setAllowAppendChild(!1)}},this.deleteGroupChild=function(e){var t=e.data;t.children&&t.children.forEach((function(e){a.nodeGroupMap.delete(e),a.lf.deleteNode(e)}));var n=a.nodeGroupMap.get(t.id);n&&(a.lf.getNodeModelById(n).removeChild(t.id),a.nodeGroupMap.delete(t.id))},this.setActiveGroup=function(e){var t=e.data,n=a.lf.getNodeModelById(t.id),i=null==n?void 0:n.getBounds();if(n&&i){var r=a.getGroup(i,t);if(a.activeGroup&&a.activeGroup.setAllowAppendChild(!1),!r||n.isGroup&&r.id===t.id)return;if(!r.isAllowAppendIn(t))return;a.activeGroup=r,a.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(e){var t=ig;return e.isGroup&&(t=Math.max(t,e.zIndex)),e.children&&e.children.forEach((function(e){"object"==typeof e&&(e=e.id);var n=a.lf.getNodeModelById(e);if(null==n?void 0:n.isGroup){var i=a.findNodeAndChildMaxZIndex(n);t=Math.max(i,t)}})),t},this.checkAndCorrectTopGroupZIndex=function(e){var t=ig;if(e.forEach((function(e){var n=a.lf.getNodeModelById(e.id);if(n){var i=a.findNodeAndChildMaxZIndex(n);i>t&&(t=i)}})),!(a.topGroupZIndex>=t)){for(var n=a.lf.graphModel.nodes.filter((function(e){return e.isGroup})),i=a.topGroupZIndex,r=0;r<n.length;r++){var o=n[r];o.zIndex>i&&(i=o.zIndex)}a.topGroupZIndex=i}},this.nodeSelected=function(e){var t=e.data,n=e.isMultiple,i=e.isSelected,r=a.lf.getNodeModelById(t.id);if(a.toFrontGroup(r),a.topGroupZIndex>-1e3){a.topGroupZIndex=ig;for(var o=a.lf.graphModel.nodes.filter((function(e){return e.isGroup})).sort((function(e,t){return e.zIndex-t.zIndex})),s=0,l=0;l<o.length;l++){var u=o[l];u.zIndex!==s&&(a.topGroupZIndex++,s=u.zIndex),u.setZIndex(a.topGroupZIndex)}}if(n&&i)if(null==r?void 0:r.isGroup)r.children.forEach((function(e){var t=a.lf.graphModel.getElement(e);null==t||t.setSelected(!1)}));else{var d=a.nodeGroupMap.get(t.id);if(d){var c=a.lf.getNodeModelById(d);(null==c?void 0:c.isSelected)&&(null==r||r.setSelected(!1))}}},this.toFrontGroup=function(e){e&&e.isGroup&&(a.topGroupZIndex++,e.setZIndex(a.topGroupZIndex),e.children&&e.children.forEach((function(e){var t=a.lf.getNodeModelById(e);a.toFrontGroup(t)})))},o.register(ng),this.lf=o,o.graphModel.addNodeMoveRules((function(e,t,n){if(e.isGroup){var i=a.getNodeAllChild(e);return o.graphModel.moveNodes(i,t,n,!0),!0}var r=o.getNodeModelById(a.nodeGroupMap.get(e.id));if(r&&r.isRestrict){var s=e.getBounds(),l=s.minX,u=s.minY,d=s.maxX,c=s.maxY;return r.isAllowMoveTo({minX:l+t,minY:u+n,maxX:d+t,maxY:c+n})}return!0})),o.graphModel.group=this,o.on(r,this.appendNodeToGroup),o.on(t.EventType.NODE_DELETE,this.deleteGroupChild),o.on(i,this.setActiveGroup),o.on(t.EventType.NODE_CLICK,this.nodeSelected),o.on(t.EventType.GRAPH_RENDERED,this.graphRendered),o.addElements=function(e,t){var n=e.nodes,i=e.edges,r={},s={nodes:[],edges:[]},l=[];return _u(n,(function(e){var n=e.id,i=e.children,u=b(e,["children"]),d=o.addNode(u);if(!d)return{nodes:[],edges:[]};n&&(r[n]=d.id),s.nodes.push(d);var c=a.createAllChildNodes(r,i,d,t).edgesArray;l.push.apply(l,_([],N(c),!1))})),l.forEach((function(e){a.createEdgeModel(e,r,t)})),_u(i,(function(e){var t=a.createEdgeModel(e,r,0);s.edges.push(t)})),s}}return n.prototype.createAllChildNodes=function(e,n,i,r){var o=this,a=this.lf,s=[],l=[],u=[];null==n||n.forEach((function(n){var d=a.getNodeModelById(n);if(d){var c=d.x,h=d.y,p=d.properties,f=d.type,g=d.rotate,v=d.children,m={x:c+r,y:h+r,properties:p,type:f,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),d.incoming.edges.forEach((function(e){l.push(e)})),d.outgoing.edges.forEach((function(e){l.push(e)})),v instanceof Set){var x=o.createAllChildNodes(e,v,b,r),E=x.nodesArray,w=x.edgesArray;u.push.apply(u,_([],N(E),!1)),s.push.apply(s,_([],N(w),!1))}}}));var d=l.filter((function(t){return e[t.sourceNodeId]&&e[t.targetNodeId]})).map((function(e){return e.getData()}));return{nodesArray:u,edgesArray:s.concat(d)}},n.prototype.createEdgeModel=function(e,t,n){var i=this.lf,r=e.sourceNodeId,o=e.targetNodeId;t[r]&&(r=t[r]),t[o]&&(o=t[o]);var a=e.type,s=e.startPoint,l=e.endPoint,u=e.pointsList,d=e.text,c={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},p=[];u&&u.length>0&&(p=u.map((function(e){return e.x+=n,e.y+=n,e})));var f={type:a,startPoint:c,endPoint:h,sourceNodeId:r,targetNodeId:o,pointsList:p};return mt(d)&&!Qd(d)&&(f.text=y(y({},d),{x:(null==d?void 0:d.x)+n,y:(null==d?void 0:d.y)+n})),i.graphModel.addEdge(f)},n.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},n.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],r=n.length-2;r>=0;r--)n[r].zIndex>i.zIndex&&(i=n[r]);return i}},n.prototype.getNodeGroup=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},n.prototype.render=function(){},n.prototype.destroy=function(){},n.pluginName="group",n}();function og(){var e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getFoldIcon=function(){var e=this.props.model,n=e,i=n.x,r=n.y,o=n.width,a=n.height,s=n.properties,l=n.foldable,u=e.x-e.width/2+5,d=e.y-e.height/2+5;if(!l)return null;var c=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:s.isFolded?"M ".concat(u+3,",").concat(d+6," ").concat(u+11,",").concat(d+6," M").concat(u+7,",").concat(d+2," ").concat(u+7,",").concat(d+10):"M ".concat(u+3,",").concat(d+6," ").concat(u+11,",").concat(d+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-o/2+5,y:r-a/2+5,onClick:function(t){var n,i;t.stopPropagation(),null===(i=(n=e).foldGroup)||void 0===i||i.call(n,!s.isFolded)}}),c])},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.getNodeStyle(),s=y(y({},a),{x:n-r/2,y:i-o/2,width:r,height:o,stroke:"black",strokeWidth:2,strokeDasharray:"0 0"});return t.h("g",{},[t.h("rect",y({},s)),this.getFoldIcon()])},n}(tg),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(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}(eg);return{type:"bpmn:subProcess",view:e,model:n}}function ag(e){var t=He("bpmn:serviceTask",De),n=He("bpmn:userTask",Re);e.register(t),e.register(n),e.register(og()),function(e){function t(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=e.id,s=n-r/2,l=n+r/2,u=i-o/2,d=i+o/2,c=t.x,h=t.y;return c>s-5&&c<l+5&&h>u-5&&h<d+5&&!(c>s+5&&c<l-5&&h>u+5&&h<d-5)?a:null}e.on("node:drag,node:dnd-drag",(function(n){var i,r,o=n.data;if("bpmn:boundaryEvent"===o.type){var a=e.graphModel.nodes;try{for(var s=C(a),l=s.next();!l.done;l=s.next()){var u=l.value;u.isTaskNode&&(t(u,o)?u.setTouching(!0):u.setTouching(!1))}}catch(e){i={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}}})),e.on("node:drop,node:dnd-add",(function(n){var i,r,o=n.data,a=o.type,s=o.id;if("bpmn:boundaryEvent"===a){var l=e.graphModel.nodes;try{for(var u=C(l),d=u.next();!d.done;d=u.next()){var c,h=d.value;if(h.isTaskNode)if(null!==(c=t(h,o))){var p=e.graphModel.getNodeModelById(s),f=e.graphModel.getNodeModelById(c),g=p.properties.attachedToRef;return g&&g!==c&&e.graphModel.getNodeModelById(g).deleteBoundaryEvent(s),void f.addBoundaryEvent(s)}}}catch(e){i={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}}})),e.graphModel.addNodeMoveRules((function(t,n,i){if(t.isTaskNode){var r=t.boundaryEvents;return e.graphModel.moveNodes(r,n,i,!0),!0}return!0}))}(e)}function sg(e){var n=function(t){function n(n,i){n.id||(n.id="Flow_".concat(xe()));var r=y(y(y({},e||{}),n.properties),{isDefaultFlow:!1});return n.properties=r,t.call(this,n,i)||this}return m(n,t),n.extendKey="SequenceFlowModel",n}(t.PolylineEdgeModel),i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(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 lg=sg();var ug=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:Me,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function dg(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 cg=function(){function e(e){var t=e.lf;t.definition={},t.useDefinition=dg(t.definition);var n=N(t.useDefinition(),2);n[0];(0,n[1])(ug),function(e){e.register(Ne(e)),e.register(we(e)),e.register(Ce(e)),e.register(Se(e)),e.register(_e(e))}(t),function(e){var t=je("bpmn:exclusiveGateway",Ae),n=je("bpmn:parallelGateway",Oe),i=je("bpmn:inclusiveGateway",ke);e.register(t),e.register(i),e.register(n)}(t),function(e){e.register(lg)}(t),ag(t),t.setDefaultEdgeType("bpmn:sequenceFlow")}return e.pluginName="BpmnElementsPlugin",e}(),hg=40,pg=40,fg=40,gg=40,vg=100,mg=80,yg=100,bg=80,xg=100,Eg=80,wg=100,Cg=80,Ng=100,_g=80,Sg=100,Mg=80,Tg=100,Ag=80,Og=100,kg=80;function Dg(e){return Object.prototype.toString.call(e)}function Rg(e){return" ".repeat(e)}function Pg(e){return"[object Object]"===Dg(e)?Object.keys(e).reduce((function(t,n){var i=n;return"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=Pg(e[n]),t}),{}):Array.isArray(e)?e.map((function(e){return Pg(e)})):e}function Ig(e){return null==e?"":e.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Lg="\t\n";function Bg(e,t,n){var i=Rg(n),r="",o=Lg+i;if("-json"===t)return"";if(0!==e&&!1!==e&&!e)return"".concat(o,"<").concat(t," />");if("#text"===t)return o+Ig(String(e));if("#cdata-section"===t)return"".concat(o,"<![CDATA[").concat(e,"]]>");if("#comment"===t)return"".concat(o,"\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(Pg(e)).replace(/"/g,"'")}return Ig(String(t))}(e),'"');if(Array.isArray(e))r+=e.map((function(e){return Bg(e,t,n+1)})).join("");else if("[object Object]"===Dg(e)){var a=Object.keys(e),s="",l=e["-json"]?Lg+Rg(n+1)+e["-json"]:"";r+="".concat(0===n?"":o,"<").concat(t),a.forEach((function(t){"-"===t.charAt(0)?s+=Bg(e[t],t,n+1):l+=Bg(e[t],t,n+1)})),r+=s+(""!==l?">".concat(l).concat(o,"</").concat(t,">"):" />")}else r+="".concat(o,"<").concat(t,">").concat(Ig(String(e)),"</").concat(t,">");return r}var jg=function(){};(jg.ObjTree=function(){return this}).VERSION="0.23",jg.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',jg.ObjTree.prototype.attr_prefix="-",jg.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)},jg.ObjTree.prototype.parseHTTP=function(e,t,n){var i,r={};for(var o in t)r[o]=t[o];if(r.method||(void 0===r.postBody&&void 0===r.postbody&&void 0===r.parameters?r.method="get":r.method="post"),n){r.asynchronous=!0;var a=this,s=n,l=r.onComplete;r.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else r.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)r.uri=e,(u=new HTTP.Request(r))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,r))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},jg.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}},jg.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 r=e.attributes[i].nodeValue;try{r=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){r=e.attributes[i].nodeValue}null!=r&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],r))}}}if(e.childNodes&&e.childNodes.length){var o=!0;t&&(o=!1);for(i=0;i<e.childNodes.length&&o;i++){var a=e.childNodes[i].nodeType;3!==a&&4!==a&&8!==a&&(o=!1)}if(o){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))(r=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],r))}}}else null===t&&(t={});return t}},jg.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},jg.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},jg.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var r in t)if(bd(t,r)){var o=t[r];r.charAt(0)!==this.attr_prefix?void 0===o||null==o?n[n.length]="<".concat(r," />"):"object"==typeof o&&o.constructor===Array?n[n.length]=this.array_to_xml(r,o):n[n.length]="object"==typeof o?this.hash_to_xml(r,o):this.scalar_to_xml(r,o):i[i.length]=" ".concat(r.substring(1),'="').concat(this.xml_escape(o),'"')}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},jg.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var r=t[i];void 0===r||null==r?n[n.length]="<".concat(e," />"):"object"==typeof r&&r.constructor===Array?n[n.length]=this.array_to_xml(e,r):n[n.length]="object"==typeof r?this.hash_to_xml(e,r):this.scalar_to_xml(e,r)}return n.join("")},jg.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")},jg.ObjTree.prototype.xml_escape=Ig;var zg;!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"}(zg||(zg={}));var Hg=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],Fg=["properties","startPoint","endPoint","pointsList"],Wg={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Gg=function(e,t){return Object.keys(t||{}).forEach((function(n){if(e[n]){var i=t[n],r=i.in,o=i.out;r&&(e[n].in=r),o&&(e[n].out=o)}else e[n]=t[n]})),e},Ug={"bpmn:startEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Ug[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=Ug[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=Ug[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=Ug[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,r=t.definitionId;return{json:'<bpmn:timerEventDefinition id="'.concat(r,'"').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,r,o=e,a=t["-id"],s="",l="";try{for(var u=C(Object.keys(t)),d=u.next();!d.done;d=u.next()){var c=d.value;c.includes("bpmn:")&&(s=N(c.split(":"),2)[1],l=null===(r=t[c])||void 0===r?void 0:r["#text"])}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return{"-definitionId":a,"-definitionType":o,"-timerType":s,"-timerValue":l}}},"bpmn:conditionExpression":{in:function(e,t){var n,i="",r="";return t["#cdata-section"]?(r="cdata",i=(null===(n=/^\$\{(.*)\}$/g.exec(t["#cdata-section"]))||void 0===n?void 0:n[1])||""):t["#text"]&&(r="normal",i=t["#text"]),{"-condition":i,"-expressionType":r}}}};function Vg(e){var t=null!=e?e:{},n=t.retainedAttrsFields,i=t.excludeFields,r=t.transformer,o=new Set(_(_([],N(Fg),!1),N(n||[]),!1)),a={in:new Set(_(_([],N(Wg.in),!1),N((null==i?void 0:i.in)||[]),!1)),out:new Set(_(_([],N(Wg.out),!1),N((null==i?void 0:i.out)||[]),!1))};return Ug=Gg(Ug,r),function(e){var t=e.nodes,n=e.edges;return function e(i,r){var s,l;if(1!==(null==i?void 0:i.flag)){var u;if((u=Ug[i.type])&&u.out){var d=u.out(i),c=Object.keys(d);c.length>0&&c.forEach((function(e){i[e]=d[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 p=C(Object.entries(i)),f=p.next();!f.done;f=p.next()){var g=N(f.value,2),v=g[0],m=g[1];if(1===(null==m?void 0:m.flag))return;var y=[r,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:o.has(y)?h["-".concat(v)]=e(m,y):h[v]=e(m,y))}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}return h}}(e,"")}}function Xg(e){var t,n,i={};try{for(var r=C(Object.entries(e)),o=r.next();!o.done;o=r.next()){var a=N(o.value,2),s=a[0],l=a[1];0===s.indexOf("-")?i[s.substring(1)]=Pg(l):"string"==typeof l?i[s]=l:"[object Object]"===Object.prototype.toString.call(l)?i[s]=Xg(l):Array.isArray(l)?i[s]=l.map((function(e){return Xg(e)})):i[s]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return i}function qg(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}})),r={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(r["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}}),r})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,r=80,o=e.x,a=e.y,s=$g.shapeConfigMap.get(e.type);s&&(i=s.width,r=s.height),o-=i/2,a-=r/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":o,"-y":a,"-width":i,"-height":r}};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 Kg=["bpmn:incoming","bpmn:outgoing"];function Yg(e,t){var n=[],i=[],r=new Map,o=null!=t?t:{},a=o.transformer,s=o.excludeFields,l={in:new Set(_(_([],N(Wg.in),!1),N((null==s?void 0:s.in)||[]),!1)),out:new Set(_(_([],N(Wg.out),!1),N((null==s?void 0:s.out)||[]),!1))};Ug=Gg(Ug,a);var u,d,c=e["bpmn:definitions"];if(c){var h=c["bpmn:process"];u=h,d=[function(e){function t(e){e["-children"]||(e["-children"]=[]),Object.keys(e).forEach((function(t){var n;0!==t.indexOf("bpmn:")||Kg.includes(t)||(h[t]||(h[t]=[]),!Array.isArray(h[t])&&(h[t]=[h[t]]),Array.isArray(e[t])?(n=h[t]).push.apply(n,_([],N(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;r.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,r;if(e.includes("bpmn:")){var o={};Ug[e]&&Ug[e].in?(o=null===(r=(i=Ug[e]).in)||void 0===r?void 0:r.call(i,e,yn.cloneDeep(n[e])),delete n[e]):t(n[e]);var a=void 0;(a=Reflect.ownKeys(o)).length>0&&a.forEach((function(e){Reflect.set(n,e,o[e])}))}})))}t(h[e])},function(e){if(0===e.indexOf("bpmn:")){var t=h[e];if("bpmn:sequenceFlow"===e){var o=c["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(Zg(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(Zg(i,e))}return n}(t,o)}else{var a=c["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if("bpmn:boundaryEvent"===e){var s=h[e],l=function(e){var t=e["-attachedToRef"],n=r.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 r=Qg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}));else{var r=Qg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}return i}(t,a,e))}}}],d.forEach((function(e){try{Object.keys(u).forEach((function(t){try{e(t)}catch(e){}}))}catch(e){}}))}var p=function(e,t,n){Object.keys(e).forEach((function(i){var r=n?"".concat(n,".").concat(i):i;t.has(r)?delete e[i]:"object"==typeof e[i]&&p(e[i],t,r)}))};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 r=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,o=e.type;r[o]&&(e.type=r[o])}p(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 r=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,o=e.type;r[o]&&(e.type=r[o])}p(e,l.in,"")})),{nodes:n,edges:i}}function Qg(e,t,n){var i=Number(e["dc:Bounds"]["-x"]),r=Number(e["dc:Bounds"]["-y"]),o=n["-children"],a=n["-name"],s=$g.shapeConfigMap.get(t);s&&(i+=s.width/2,r+=s.height/2);var l,u={};if(Object.entries(n).forEach((function(e){var t=N(e,2),n=t[0],i=t[1];Hg.includes(n)||(u[n]=i)})),u=Xg(u),a&&(l={x:i,y:r,value:a},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var d=e["bpmndi:BPMNLabel"]["dc:Bounds"];l.x=Number(d["-x"])+Number(d["-width"])/2,l.y=Number(d["-y"])+Number(d["-height"])/2}var c={id:e["-bpmnElement"],type:t,x:i,y:r,properties:u};return o&&(c.children=o),l&&(c.text=l),c}function Zg(e,t){var n,i=t["-name"]?"".concat(t["-name"]):"";if(i){var r=e["bpmndi:BPMNLabel"]["dc:Bounds"],o=0;i.split("\n").forEach((function(e){o<e.length&&(o=e.length)})),n={value:i,x:Number(r["-x"])+10*o/2,y:Number(r["-y"])+7}}var a={};Object.entries(t).forEach((function(e){var t=N(e,2),n=t[0],i=t[1];Hg.includes(n)||(a[n]=i)})),a=Xg(a);var s=e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),l={id:t["-id"],type:zg.FLOW,pointsList:s,sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:a};return n&&(l.text=n),l}var $g=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i,r,o=y({},n.processAttributes);!function(e,t,n){var i,r=new Map,o=Vg(n)(t);o.nodes.forEach((function(t){var n=t["-id"],i=t["-type"],o=t.text,a=t.children,s=b(t,["-id","-type","text","children"]),l={"-id":n};(null==o?void 0:o["-value"])&&(l["-name"]=o["-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),r.set(n,l)}));var a=o.edges.map((function(e){var t=e["-id"],n=e["-sourceNodeId"],i=e["-targetNodeId"],o=e.text,a=b(e,["-id","-sourceNodeId","-targetNodeId","text"]),s=r.get(i);s["bpmn:incoming"]||(s["bpmn:incoming"]=[]),s["bpmn:incoming"].push(t);var l={"-id":t,"-sourceRef":n,"-targetRef":i};return(null==o?void 0:o["-value"])&&(l["-name"]=o["-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=r.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 o,a=r.get(i["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach((function(e){a[e]&&a[e].forEach((function(t){n[e].add(t)}))}));var s=null===(o=e[i["-type"]])||void 0===o?void 0:o.findIndex((function(e){return e["-id"]===i["-id"]}));s>=0&&e[i["-type"]].splice(s,1),r.delete(i["-id"]),t[i["-type"]]||(t[i["-type"]]=[]),t[i["-type"]].push(a)}));var o=n["bpmn:incoming"];n["bpmn:outgoing"].forEach((function(e){o.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[zg.FLOW]=a}(o,e,t);var a={"-id":"BPMNPlane_1","-bpmnElement":o["-id"]};qg(a,e);var s=n.definitionAttributes;s["bpmn:process"]=o,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===(r=null==t?void 0:t.mapping)||void 0===r?void 0:r.out,d=function(e){Array.isArray(e)&&e.forEach((function(e){return d(e)})),"object"==typeof e&&Object.keys(e).forEach((function(t){var n;(n=u[t])?(e[n]=yn.cloneDeep(e[t]),delete e[t],d(e[n])):d(e[t])}))};d(l)}return l},this.adapterIn=function(e,t){if(e)return Yg(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}();$g.shapeConfigMap.set(zg.START,{width:hg,height:pg}),$g.shapeConfigMap.set(zg.END,{width:fg,height:gg}),$g.shapeConfigMap.set(zg.INTERMEDIATE_CATCH,{width:yg,height:bg}),$g.shapeConfigMap.set(zg.INTERMEDIATE_THROW,{width:yg,height:bg}),$g.shapeConfigMap.set(zg.BOUNDARY,{width:vg,height:mg}),$g.shapeConfigMap.set(zg.PARALLEL_GATEWAY,{width:xg,height:Eg}),$g.shapeConfigMap.set(zg.INCLUSIVE_GATEWAY,{width:wg,height:Cg}),$g.shapeConfigMap.set(zg.EXCLUSIVE_GATEWAY,{width:Ng,height:_g}),$g.shapeConfigMap.set(zg.SYSTEM,{width:Sg,height:Mg}),$g.shapeConfigMap.set(zg.USER,{width:Tg,height:Ag}),$g.shapeConfigMap.set(zg.SUBPROCESS,{width:Og,height:kg});var Jg=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t,i=(t=e,(new jg.ObjTree).parseXML(t));return n.adapterIn(i,n.props)},n.adapterXmlOut=function(e){return function(e){var t="";for(var n in e)t+=Bg(e[n],n,0);return t}(n.adapterOut(e,n.props))};var i=t.lf,r=t.props;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n.props=r,n}return m(t,e),t.pluginName="BPMNAdapter",t}($g),ev={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},tv={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function nv(e){switch(e){case"bpmn:sequenceFlow":return ev.SEQUENCE_FLOW;case"bpmn:startEvent":return ev.START_EVENT;case"bpmn:endEvent":return ev.END_EVENT;case"bpmn:userTask":return ev.USER_TASK;case"bpmn:exclusiveGateway":return ev.EXCLUSIVE_GATEWAY;default:return e}}var iv="An invariant failed, however the error is obfuscated because this is a production build.",rv=[];Object.freeze(rv);var ov={};function av(){return++_m.mobxGuid}function sv(e){throw lv(!1,e),"X"}function lv(e,t){if(!e)throw new Error("[mobx] "+(t||iv))}function uv(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}Object.freeze(ov);var dv=function(){};function cv(e){return null!==e&&"object"==typeof e}function hv(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function pv(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function fv(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return cv(e)&&!0===e[n]}}function gv(e){return e instanceof Map}function vv(e){return e instanceof Set}function mv(e){return e&&e.toString?e.toString():new String(e).toString()}function yv(e){return null===e?null:"object"==typeof e?""+e:e}var bv="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,xv=Symbol("mobx administration"),Ev=function(){function e(e){void 0===e&&(e="Atom@"+av()),this.name=e,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=new Set,this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=Yv.NOT_TRACKING}return e.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach((function(e){return e()}))},e.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach((function(e){return e()}))},e.prototype.reportObserved=function(){return km(this)},e.prototype.reportChanged=function(){Am(),function(e){if(e.lowestObserverState===Yv.STALE)return;e.lowestObserverState=Yv.STALE,e.observers.forEach((function(t){t.dependenciesState===Yv.UP_TO_DATE&&(t.isTracing!==Qv.NONE&&Dm(t,e),t.onBecomeStale()),t.dependenciesState=Yv.STALE}))}(this),Om()},e.prototype.toString=function(){return this.name},e}(),wv=fv("Atom",Ev);function Cv(e,t,n){void 0===t&&(t=dv),void 0===n&&(n=dv);var i=new Ev(e);return t!==dv&&Wm("onBecomeObserved",i,t),n!==dv&&Fm(i,n),i}var Nv={identity:function(e,t){return e===t},structural:function(e,t){return My(e,t)},default:function(e,t){return Object.is(e,t)},shallow:function(e,t){return My(e,t,1)}},_v=function(e,t){return _v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},_v(e,t)};var Sv=function(){return Sv=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Sv.apply(this,arguments)};function Mv(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function Tv(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}function Av(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Tv(arguments[t]));return e}var Ov=Symbol("mobx did run lazy initializers"),kv=Symbol("mobx pending decorators"),Dv={},Rv={};function Pv(e){var t,n;if(!0!==e[Ov]){var i=e[kv];if(i){pv(e,Ov,!0);var r=Av(Object.getOwnPropertySymbols(i),Object.keys(i));try{for(var o=Mv(r),a=o.next();!a.done;a=o.next()){var s=i[a.value];s.propertyCreator(e,s.prop,s.descriptor,s.decoratorTarget,s.decoratorArguments)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}}}function Iv(e,t){return function(){var n,i,r=function(i,r,o,a){if(!0===a)return t(i,r,o,i,n),null;if(!Object.prototype.hasOwnProperty.call(i,kv)){var s=i[kv];pv(i,kv,Sv({},s))}return i[kv][r]={prop:r,propertyCreator:t,descriptor:o,decoratorTarget:i,decoratorArguments:n},function(e,t){var n=t?Dv:Rv;return n[e]||(n[e]={configurable:!0,enumerable:t,get:function(){return Pv(this),this[e]},set:function(t){Pv(this),this[e]=t}})}(r,e)};return(2===(i=arguments).length||3===i.length)&&("string"==typeof i[1]||"symbol"==typeof i[1])||4===i.length&&!0===i[3]?(n=rv,r.apply(null,arguments)):(n=Array.prototype.slice.call(arguments),r)}}function Lv(e,t,n){return qm(e)?e:Array.isArray(e)?qv.array(e,{name:n}):hv(e)?qv.object(e,void 0,{name:n}):gv(e)?qv.map(e,{name:n}):vv(e)?qv.set(e,{name:n}):e}function Bv(e){return e}function jv(e){lv(e);var t=Iv(!0,(function(t,n,i,r,o){var a=i?i.initializer?i.initializer.call(t):i.value:void 0;by(t).addObservableProp(n,a,e)})),n=("undefined"!=typeof process&&process.env,t);return n.enhancer=e,n}var zv={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Hv(e){return null==e?zv:"string"==typeof e?{name:e,deep:!0,proxy:!0}:e}Object.freeze(zv);var Fv=jv(Lv),Wv=jv((function(e,t,n){return null==e||Ny(e)||dy(e)||fy(e)||my(e)?e:Array.isArray(e)?qv.array(e,{name:n,deep:!1}):hv(e)?qv.object(e,void 0,{name:n,deep:!1}):gv(e)?qv.map(e,{name:n,deep:!1}):vv(e)?qv.set(e,{name:n,deep:!1}):sv(!1)})),Gv=jv(Bv),Uv=jv((function(e,t,n){return My(e,t)?t:e}));function Vv(e){return e.defaultDecorator?e.defaultDecorator.enhancer:!1===e.deep?Bv:Lv}var Xv={box:function(e,t){arguments.length>2&&Kv("box");var n=Hv(t);return new ym(e,Vv(n),n.name,!0,n.equals)},array:function(e,t){arguments.length>2&&Kv("array");var n=Hv(t);return function(e,t,n,i){void 0===n&&(n="ObservableArray@"+av());void 0===i&&(i=!1);var r=new ay(n,t,i);!function(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}(r.values,xv,r);var o=new Proxy(r.values,oy);if(r.proxy=o,e&&e.length){var a=vm(!0);r.spliceWithArray(0,0,e),mm(a)}return o}(e,Vv(n),n.name)},map:function(e,t){arguments.length>2&&Kv("map");var n=Hv(t);return new py(e,Vv(n),n.name)},set:function(e,t){arguments.length>2&&Kv("set");var n=Hv(t);return new vy(e,Vv(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&Kv("object");var i=Hv(n);if(!1===i.proxy)return Gm({},e,t,i);var r=Um(i),o=function(e){var t=new Proxy(e,$m);return e[xv].proxy=t,t}(Gm({},void 0,void 0,i));return Vm(o,e,t,r),o},ref:Gv,shallow:Wv,deep:Fv,struct:Uv},qv=function(e,t,n){if("string"==typeof arguments[1]||"symbol"==typeof arguments[1])return Fv.apply(null,arguments);if(qm(e))return e;var i=hv(e)?qv.object(e,t,n):Array.isArray(e)?qv.array(e,t):gv(e)?qv.map(e,t):vv(e)?qv.set(e,t):e;if(i!==e)return i;sv(!1)};function Kv(e){sv("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(Xv).forEach((function(e){return qv[e]=Xv[e]}));var Yv,Qv,Zv=Iv(!1,(function(e,t,n,i,r){var o=n.get,a=n.set,s=r[0]||{};by(e).addComputedProp(e,t,Sv({get:o,set:a,context:e},s))})),$v=Zv({equals:Nv.structural}),Jv=function(e,t,n){if("string"==typeof t)return Zv.apply(null,arguments);if(null!==e&&"object"==typeof e&&1===arguments.length)return Zv.apply(null,arguments);var i="object"==typeof t?t:{};return i.get=e,i.set="function"==typeof t?t:i.set,i.name=i.name||e.name||"",new bm(i)};Jv.struct=$v,function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Yv||(Yv={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Qv||(Qv={}));var em=function(e){this.cause=e};function tm(e){return e instanceof em}function nm(e){switch(e.dependenciesState){case Yv.UP_TO_DATE:return!1;case Yv.NOT_TRACKING:case Yv.STALE:return!0;case Yv.POSSIBLY_STALE:for(var t=um(!0),n=sm(),i=e.observing,r=i.length,o=0;o<r;o++){var a=i[o];if(xm(a)){if(_m.disableErrorBoundaries)a.get();else try{a.get()}catch(e){return lm(n),dm(t),!0}if(e.dependenciesState===Yv.STALE)return lm(n),dm(t),!0}}return cm(e),lm(n),dm(t),!1}}function im(e){var t=e.observers.size>0;_m.computationDepth>0&&t&&sv(!1),_m.allowStateChanges||!t&&"strict"!==_m.enforceActions||sv(!1)}function rm(e,t,n){var i=um(!0);cm(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++_m.runId;var r,o=_m.trackingDerivation;if(_m.trackingDerivation=e,!0===_m.disableErrorBoundaries)r=t.call(n);else try{r=t.call(n)}catch(e){r=new em(e)}return _m.trackingDerivation=o,function(e){for(var t=e.observing,n=e.observing=e.newObserving,i=Yv.UP_TO_DATE,r=0,o=e.unboundDepsCount,a=0;a<o;a++){0===(s=n[a]).diffValue&&(s.diffValue=1,r!==a&&(n[r]=s),r++),s.dependenciesState>i&&(i=s.dependenciesState)}n.length=r,e.newObserving=null,o=t.length;for(;o--;){0===(s=t[o]).diffValue&&Mm(s,e),s.diffValue=0}for(;r--;){var s;1===(s=n[r]).diffValue&&(s.diffValue=0,Sm(s,e))}i!==Yv.UP_TO_DATE&&(e.dependenciesState=i,e.onBecomeStale())}(e),dm(i),r}function om(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Mm(t[n],e);e.dependenciesState=Yv.NOT_TRACKING}function am(e){var t=sm();try{return e()}finally{lm(t)}}function sm(){var e=_m.trackingDerivation;return _m.trackingDerivation=null,e}function lm(e){_m.trackingDerivation=e}function um(e){var t=_m.allowStateReads;return _m.allowStateReads=e,t}function dm(e){_m.allowStateReads=e}function cm(e){if(e.dependenciesState!==Yv.UP_TO_DATE){e.dependenciesState=Yv.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=Yv.UP_TO_DATE}}var hm=0,pm=1,fm=Object.getOwnPropertyDescriptor((function(){}),"name");function gm(e,t,n){var i=function(){return function(e,t,n,i){var r=function(){var e=!1,t=0,n=sm();Am();var i=vm(!0),r=um(!0),o={prevDerivation:n,prevAllowStateChanges:i,prevAllowStateReads:r,notifySpy:e,startTime:t,actionId:pm++,parentActionId:hm};return hm=o.actionId,o}();try{return t.apply(n,i)}catch(e){throw r.error=e,e}finally{!function(e){hm!==e.actionId&&sv("invalid action stack. did you forget to finish an action?");hm=e.parentActionId,void 0!==e.error&&(_m.suppressReactionErrors=!0);mm(e.prevAllowStateChanges),dm(e.prevAllowStateReads),Om(),lm(e.prevDerivation),e.notifySpy&&!1;_m.suppressReactionErrors=!1}(r)}}(0,t,this,arguments)};return i.isMobxAction=!0,i}function vm(e){var t=_m.allowStateChanges;return _m.allowStateChanges=e,t}function mm(e){_m.allowStateChanges=e}fm&&fm.configurable;var ym=function(e){function t(t,n,i,r,o){void 0===i&&(i="ObservableValue@"+av()),void 0===r&&(r=!0),void 0===o&&(o=Nv.default);var a=e.call(this,i)||this;return a.enhancer=n,a.name=i,a.equals=o,a.hasUnreportedChange=!1,a.value=n(t,void 0,i),a}return function(e,t){function n(){this.constructor=e}_v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.prototype.set=function(e){this.value;if((e=this.prepareNewValue(e))!==_m.UNCHANGED){false,this.setNewValue(e)}},t.prototype.prepareNewValue=function(e){if(im(this),Jm(this)){var t=ty(this,{object:this,type:"update",newValue:e});if(!t)return _m.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value,this.name),this.equals(this.value,e)?_m.UNCHANGED:e},t.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),ny(this)&&ry(this,{type:"update",object:this,newValue:e,oldValue:t})},t.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},t.prototype.intercept=function(e){return ey(this,e)},t.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),iy(this,e)},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.value+"]"},t.prototype.valueOf=function(){return yv(this.get())},t.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Ev);fv("ObservableValue",ym);var bm=function(){function e(e){this.dependenciesState=Yv.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isBeingObserved=!1,this.isPendingUnobservation=!1,this.observers=new Set,this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Yv.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+av(),this.value=new em(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Qv.NONE,lv(e.get,"missing option for computed: get"),this.derivation=e.get,this.name=e.name||"ComputedValue@"+av(),e.set&&(this.setter=gm(this.name,e.set)),this.equals=e.equals||(e.compareStructural||e.struct?Nv.structural:Nv.default),this.scope=e.context,this.requiresReaction=!!e.requiresReaction,this.keepAlive=!!e.keepAlive}return e.prototype.onBecomeStale=function(){!function(e){if(e.lowestObserverState!==Yv.UP_TO_DATE)return;e.lowestObserverState=Yv.POSSIBLY_STALE,e.observers.forEach((function(t){t.dependenciesState===Yv.UP_TO_DATE&&(t.dependenciesState=Yv.POSSIBLY_STALE,t.isTracing!==Qv.NONE&&Dm(t,e),t.onBecomeStale())}))}(this)},e.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach((function(e){return e()}))},e.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach((function(e){return e()}))},e.prototype.get=function(){this.isComputing&&sv("Cycle detected in computation "+this.name+": "+this.derivation),0!==_m.inBatch||0!==this.observers.size||this.keepAlive?(km(this),nm(this)&&this.trackAndCompute()&&function(e){if(e.lowestObserverState===Yv.STALE)return;e.lowestObserverState=Yv.STALE,e.observers.forEach((function(t){t.dependenciesState===Yv.POSSIBLY_STALE?t.dependenciesState=Yv.STALE:t.dependenciesState===Yv.UP_TO_DATE&&(e.lowestObserverState=Yv.UP_TO_DATE)}))}(this)):nm(this)&&(this.warnAboutUntrackedRead(),Am(),this.value=this.computeValue(!1),Om());var e=this.value;if(tm(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(tm(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){lv(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else lv(!1,!1)},e.prototype.trackAndCompute=function(){var e=this.value,t=this.dependenciesState===Yv.NOT_TRACKING,n=this.computeValue(!0),i=t||tm(e)||tm(n)||!this.equals(e,n);return i&&(this.value=n),i},e.prototype.computeValue=function(e){var t;if(this.isComputing=!0,_m.computationDepth++,e)t=rm(this,this.derivation,this.scope);else if(!0===_m.disableErrorBoundaries)t=this.derivation.call(this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new em(e)}return _m.computationDepth--,this.isComputing=!1,t},e.prototype.suspend=function(){this.keepAlive||(om(this),this.value=void 0)},e.prototype.observe=function(e,t){var n=this,i=!0,r=void 0;return function(e,t){void 0===t&&(t=ov);var n,i=t&&t.name||e.name||"Autorun@"+av();if(t.scheduler||t.delay){var r=function(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Hm}(t),o=!1;n=new Pm(i,(function(){o||(o=!0,r((function(){o=!1,n.isDisposed||n.track(a)})))}),t.onError,t.requiresObservable)}else n=new Pm(i,(function(){this.track(a)}),t.onError,t.requiresObservable);function a(){e(n)}return n.schedule(),n.getDisposer()}((function(){var o=n.get();if(!i||t){var a=sm();e({type:"update",object:n,newValue:o,oldValue:r}),lm(a)}i=!1,r=o}))},e.prototype.warnAboutUntrackedRead=function(){},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return yv(this.get())},e.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},e}(),xm=fv("ComputedValue",bm),Em=function(){this.version=5,this.UNCHANGED={},this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.allowStateReads=!0,this.enforceActions=!1,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.computedConfigurable=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1},wm={};function Cm(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:wm}var Nm=!0,_m=function(){var e=Cm();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Nm=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Em).version&&(Nm=!1),Nm?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Em):(setTimeout((function(){sv("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Em)}();function Sm(e,t){e.observers.add(t),e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Mm(e,t){e.observers.delete(t),0===e.observers.size&&Tm(e)}function Tm(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,_m.pendingUnobservations.push(e))}function Am(){_m.inBatch++}function Om(){if(0==--_m.inBatch){Bm();for(var e=_m.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers.size&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBecomeUnobserved()),n instanceof bm&&n.suspend())}_m.pendingUnobservations=[]}}function km(e){var t=_m.trackingDerivation;return null!==t?(t.runId!==e.lastAccessedBy&&(e.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=e,e.isBeingObserved||(e.isBeingObserved=!0,e.onBecomeObserved())),!0):(0===e.observers.size&&_m.inBatch>0&&Tm(e),!1)}function Dm(e,t){if(e.isTracing===Qv.BREAK){var n=[];Rm(function(e,t){return Xm(_y(e,t))}(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof bm?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function Rm(e,t,n){t.length>=1e3?t.push("(and many more)"):(t.push(""+new Array(n).join("\t")+e.name),e.dependencies&&e.dependencies.forEach((function(e){return Rm(e,t,n+1)})))}var Pm=function(){function e(e,t,n,i){void 0===e&&(e="Reaction@"+av()),void 0===i&&(i=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=i,this.observing=[],this.newObserving=[],this.dependenciesState=Yv.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+av(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Qv.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,_m.pendingReactions.push(this),Bm())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Am(),this._isScheduled=!1,nm(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending}catch(e){this.reportExceptionInDerivation(e)}}Om()}},e.prototype.track=function(e){if(!this.isDisposed){Am(),this._isRunning=!0;var t=rm(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&om(this),tm(t)&&this.reportExceptionInDerivation(t.cause),Om()}},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(_m.disableErrorBoundaries)throw e;_m.suppressReactionErrors,_m.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Am(),om(this),Om()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e[xv]=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=!1;"boolean"==typeof e[e.length-1]&&(n=e.pop());var i=function(e){switch(e.length){case 0:return _m.trackingDerivation;case 1:return _y(e[0]);case 2:return _y(e[0],e[1])}}(e);if(!i)return sv(!1);i.isTracing,Qv.NONE;i.isTracing=n?Qv.BREAK:Qv.LOG}(this,e)},e}(),Im=100,Lm=function(e){return e()};function Bm(){_m.inBatch>0||_m.isRunningReactions||Lm(jm)}function jm(){_m.isRunningReactions=!0;for(var e=_m.pendingReactions,t=0;e.length>0;){++t===Im&&e.splice(0);for(var n=e.splice(0),i=0,r=n.length;i<r;i++)n[i].runReaction()}_m.isRunningReactions=!1}var zm=fv("Reaction",Pm);var Hm=function(e){return e()};function Fm(e,t,n){return Wm("onBecomeUnobserved",e,t)}function Wm(e,t,n,i){var r=_y(t),o=n,a=e+"Listeners";return r[a]?r[a].add(o):r[a]=new Set([o]),"function"!=typeof r[e]?sv(!1):function(){var e=r[a];e&&(e.delete(o),0===e.size&&delete r[a])}}function Gm(e,t,n,i){var r=Um(i=Hv(i));return Pv(e),by(e,i.name,r.enhancer),t&&Vm(e,t,n,r),e}function Um(e){return e.defaultDecorator||(!1===e.deep?Gv:Fv)}function Vm(e,t,n,i){var r,o;Am();try{var a=bv(t);try{for(var s=Mv(a),l=s.next();!l.done;l=s.next()){var u=l.value,d=Object.getOwnPropertyDescriptor(t,u);0;var c=n&&u in n?n[u]:d.get?Zv:i;0;var h=c(e,u,d,!0);h&&Object.defineProperty(e,u,h)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}finally{Om()}}function Xm(e){var t,n,i={name:e.name};return e.observing&&e.observing.length>0&&(i.dependencies=(t=e.observing,n=[],t.forEach((function(e){-1===n.indexOf(e)&&n.push(e)})),n).map(Xm)),i}function qm(e){return 1!==arguments.length&&sv(!1),function(e){return null!=e&&(Ny(e)||!!e[xv]||wv(e)||zm(e)||xm(e))}(e)}function Km(e,t,n){if(2!==arguments.length||my(e))if(Ny(e)){var i=e[xv];i.values.get(t)?i.write(t,n):i.addObservableProp(t,n,i.defaultEnhancer)}else if(fy(e))e.set(t,n);else if(my(e))e.add(t);else{if(!dy(e))return sv(!1);"number"!=typeof t&&(t=parseInt(t,10)),lv(t>=0,"Not a valid index: '"+t+"'"),Am(),t>=e.length&&(e.length=t+1),e[t]=n,Om()}else{Am();var r=t;try{for(var o in r)Km(e,o,r[o])}finally{Om()}}}function Ym(e,t){void 0===t&&(t=void 0),Am();try{return e.apply(t)}finally{Om()}}function Qm(e){return e[xv]}function Zm(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e}var $m={has:function(e,t){if(t===xv||"constructor"===t||t===Ov)return!0;var n=Qm(e);return Zm(t)?n.has(t):t in e},get:function(e,t){if(t===xv||"constructor"===t||t===Ov)return e[t];var n=Qm(e),i=n.values.get(t);if(i instanceof Ev){var r=i.get();return void 0===r&&n.has(t),r}return Zm(t)&&n.has(t),e[t]},set:function(e,t,n){return!!Zm(t)&&(Km(e,t,n),!0)},deleteProperty:function(e,t){return!!Zm(t)&&(Qm(e).remove(t),!0)},ownKeys:function(e){return Qm(e).keysAtom.reportObserved(),Reflect.ownKeys(e)},preventExtensions:function(e){return sv("Dynamic observable objects cannot be frozen"),!1}};function Jm(e){return void 0!==e.interceptors&&e.interceptors.length>0}function ey(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),uv((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ty(e,t){var n=sm();try{for(var i=Av(e.interceptors||[]),r=0,o=i.length;r<o&&(lv(!(t=i[r](t))||t.type,"Intercept handlers should return nothing or a change object"),t);r++);return t}finally{lm(n)}}function ny(e){return void 0!==e.changeListeners&&e.changeListeners.length>0}function iy(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),uv((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ry(e,t){var n=sm(),i=e.changeListeners;if(i){for(var r=0,o=(i=i.slice()).length;r<o;r++)i[r](t);lm(n)}}var oy={get:function(e,t){return t===xv?e[xv]:"length"===t?e[xv].getArrayLength():"number"==typeof t?sy.get.call(e,t):"string"!=typeof t||isNaN(t)?sy.hasOwnProperty(t)?sy[t]:e[t]:sy.get.call(e,parseInt(t))},set:function(e,t,n){return"length"===t&&e[xv].setArrayLength(n),"number"==typeof t&&sy.set.call(e,t,n),"symbol"==typeof t||isNaN(t)?e[t]=n:sy.set.call(e,parseInt(t),n),!0},preventExtensions:function(e){return sv("Observable arrays cannot be frozen"),!1}};var ay=function(){function e(e,t,n){this.owned=n,this.values=[],this.proxy=void 0,this.lastKnownLength=0,this.atom=new Ev(e||"ObservableArray@"+av()),this.enhancer=function(n,i){return t(n,i,e+"[..]")}}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.dehanceValues=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return ey(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.proxy,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),iy(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i<e-t;i++)n[i]=void 0;this.spliceWithArray(t,0,n)}else this.spliceWithArray(e,t-e)},e.prototype.updateArrayLength=function(e,t){if(e!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed.");this.lastKnownLength+=t},e.prototype.spliceWithArray=function(e,t,n){var i=this;im(this.atom);var r=this.values.length;if(void 0===e?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=1===arguments.length?r-e:null==t?0:Math.max(0,Math.min(t,r-e)),void 0===n&&(n=rv),Jm(this)){var o=ty(this,{object:this.proxy,type:"splice",index:e,removedCount:t,added:n});if(!o)return rv;t=o.removedCount,n=o.added}n=0===n.length?n:n.map((function(e){return i.enhancer(e,void 0)}));var a=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,a),this.dehanceValues(a)},e.prototype.spliceItemsIntoValues=function(e,t,n){var i;if(n.length<1e4)return(i=this.values).splice.apply(i,Av([e,t],n));var r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r},e.prototype.notifyArrayChildUpdate=function(e,t,n){var i=!this.owned&&!1,r=ny(this),o=r||i?{object:this.proxy,type:"update",index:e,newValue:t,oldValue:n}:null;this.atom.reportChanged(),r&&ry(this,o)},e.prototype.notifyArraySplice=function(e,t,n){var i=!this.owned&&!1,r=ny(this),o=r||i?{object:this.proxy,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom.reportChanged(),r&&ry(this,o)},e}(),sy={intercept:function(e){return this[xv].intercept(e)},observe:function(e,t){return void 0===t&&(t=!1),this[xv].observe(e,t)},clear:function(){return this.splice(0)},replace:function(e){var t=this[xv];return t.spliceWithArray(0,t.values.length,e)},toJS:function(){return this.slice()},toJSON:function(){return this.toJS()},splice:function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var r=this[xv];switch(arguments.length){case 0:return[];case 1:return r.spliceWithArray(e);case 2:return r.spliceWithArray(e,t)}return r.spliceWithArray(e,t,n)},spliceWithArray:function(e,t,n){return this[xv].spliceWithArray(e,t,n)},push:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this[xv];return n.spliceWithArray(n.values.length,0,e),n.values.length},pop:function(){return this.splice(Math.max(this[xv].values.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this[xv];return n.spliceWithArray(0,0,e),n.values.length},reverse:function(){var e=this.slice();return e.reverse.apply(e,arguments)},sort:function(e){var t=this.slice();return t.sort.apply(t,arguments)},remove:function(e){var t=this[xv],n=t.dehanceValues(t.values).indexOf(e);return n>-1&&(this.splice(n,1),!0)},get:function(e){var t=this[xv];if(t&&e<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[e])},set:function(e,t){var n=this[xv],i=n.values;if(e<i.length){im(n.atom);var r=i[e];if(Jm(n)){var o=ty(n,{type:"update",object:n.proxy,index:e,newValue:t});if(!o)return;t=o.newValue}(t=n.enhancer(t,r))!==r&&(i[e]=t,n.notifyArrayChildUpdate(e,t,r))}else{if(e!==i.length)throw new Error("[mobx.array] Index out of bounds, "+e+" is larger than "+i.length);n.spliceWithArray(e,0,[t])}}};["concat","flat","includes","indexOf","join","lastIndexOf","slice","toString","toLocaleString"].forEach((function(e){"function"==typeof Array.prototype[e]&&(sy[e]=function(){var t=this[xv];t.atom.reportObserved();var n=t.dehanceValues(t.values);return n[e].apply(n,arguments)})})),["every","filter","find","findIndex","flatMap","forEach","map","some"].forEach((function(e){"function"==typeof Array.prototype[e]&&(sy[e]=function(t,n){var i=this,r=this[xv];return r.atom.reportObserved(),r.dehanceValues(r.values)[e]((function(e,r){return t.call(n,e,r,i)}),n)})})),["reduce","reduceRight"].forEach((function(e){sy[e]=function(){var t=this,n=this[xv];n.atom.reportObserved();var i=arguments[0];return arguments[0]=function(e,r,o){return r=n.dehanceValue(r),i(e,r,o,t)},n.values[e].apply(n.values,arguments)}}));var ly,uy=fv("ObservableArrayAdministration",ay);function dy(e){return cv(e)&&uy(e[xv])}var cy,hy={},py=function(){function e(e,t,n){if(void 0===t&&(t=Lv),void 0===n&&(n="ObservableMap@"+av()),this.enhancer=t,this.name=n,this[ly]=hy,this._keysAtom=Cv(this.name+".keys()"),this[Symbol.toStringTag]="Map","function"!=typeof Map)throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");this._data=new Map,this._hasMap=new Map,this.merge(e)}return e.prototype._has=function(e){return this._data.has(e)},e.prototype.has=function(e){var t=this;if(!_m.trackingDerivation)return this._has(e);var n=this._hasMap.get(e);if(!n){var i=n=new ym(this._has(e),Bv,this.name+"."+mv(e)+"?",!1);this._hasMap.set(e,i),Fm(i,(function(){return t._hasMap.delete(e)}))}return n.get()},e.prototype.set=function(e,t){var n=this._has(e);if(Jm(this)){var i=ty(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!i)return this;t=i.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if((im(this._keysAtom),Jm(this))&&!(i=ty(this,{type:"delete",object:this,name:e})))return!1;if(this._has(e)){var n=ny(this),i=n?{type:"delete",object:this,oldValue:this._data.get(e).value,name:e}:null;return Ym((function(){t._keysAtom.reportChanged(),t._updateHasMapEntry(e,!1),t._data.get(e).setNewValue(void 0),t._data.delete(e)})),n&&ry(this,i),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap.get(e);n&&n.setNewValue(t)},e.prototype._updateValue=function(e,t){var n=this._data.get(e);if((t=n.prepareNewValue(t))!==_m.UNCHANGED){var i=!1,r=ny(this),o=r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;i,n.setNewValue(t),r&&ry(this,o)}},e.prototype._addValue=function(e,t){var n=this;im(this._keysAtom),Ym((function(){var i=new ym(t,n.enhancer,n.name+"."+mv(e),!1);n._data.set(e,i),t=i.value,n._updateHasMapEntry(e,!0),n._keysAtom.reportChanged()}));var i=ny(this);i&&ry(this,i?{type:"add",object:this,name:e,newValue:t}:null)},e.prototype.get=function(e){return this.has(e)?this.dehanceValue(this._data.get(e).get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return this._keysAtom.reportObserved(),this._data.keys()},e.prototype.values=function(){var e=this,t=this.keys();return ky({next:function(){var n=t.next(),i=n.done,r=n.value;return{done:i,value:i?void 0:e.get(r)}}})},e.prototype.entries=function(){var e=this,t=this.keys();return ky({next:function(){var n=t.next(),i=n.done,r=n.value;return{done:i,value:i?void 0:[r,e.get(r)]}}})},e.prototype[(ly=xv,Symbol.iterator)]=function(){return this.entries()},e.prototype.forEach=function(e,t){var n,i;try{for(var r=Mv(this),o=r.next();!o.done;o=r.next()){var a=Tv(o.value,2),s=a[0],l=a[1];e.call(t,l,s,this)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}},e.prototype.merge=function(e){var t=this;return fy(e)&&(e=e.toJS()),Ym((function(){var n=vm(!0);try{hv(e)?function(e){var t=new Set;for(var n in e)t.add(n);return Object.getOwnPropertySymbols(e).forEach((function(n){Object.getOwnPropertyDescriptor(e,n).enumerable&&t.add(n)})),Array.from(t)}(e).forEach((function(n){return t.set(n,e[n])})):Array.isArray(e)?e.forEach((function(e){var n=Tv(e,2),i=n[0],r=n[1];return t.set(i,r)})):gv(e)?(e.constructor!==Map&&sv("Cannot initialize from classes that inherit from Map: "+e.constructor.name),e.forEach((function(e,n){return t.set(n,e)}))):null!=e&&sv("Cannot initialize map from "+e)}finally{mm(n)}})),this},e.prototype.clear=function(){var e=this;Ym((function(){am((function(){var t,n;try{for(var i=Mv(e.keys()),r=i.next();!r.done;r=i.next()){var o=r.value;e.delete(o)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}))}))},e.prototype.replace=function(e){var t=this;return Ym((function(){var n,i,r,o,a=function(e){if(gv(e)||fy(e))return e;if(Array.isArray(e))return new Map(e);if(hv(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return sv("Cannot convert to map from '"+e+"'")}(e),s=new Map,l=!1;try{for(var u=Mv(t._data.keys()),d=u.next();!d.done;d=u.next()){var c=d.value;if(!a.has(c))if(t.delete(c))l=!0;else{var h=t._data.get(c);s.set(c,h)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}try{for(var p=Mv(a.entries()),f=p.next();!f.done;f=p.next()){var g=Tv(f.value,2),v=(c=g[0],h=g[1],t._data.has(c));if(t.set(c,h),t._data.has(c)){var m=t._data.get(c);s.set(c,m),v||(l=!0)}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}if(!l)if(t._data.size!==s.size)t._keysAtom.reportChanged();else for(var y=t._data.keys(),b=s.keys(),x=y.next(),E=b.next();!x.done;){if(x.value!==E.value){t._keysAtom.reportChanged();break}x=y.next(),E=b.next()}t._data=s})),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keysAtom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),e.prototype.toPOJO=function(){var e,t,n={};try{for(var i=Mv(this),r=i.next();!r.done;r=i.next()){var o=Tv(r.value,2),a=o[0],s=o[1];n["symbol"==typeof a?a:mv(a)]=s}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},e.prototype.toJS=function(){return new Map(this)},e.prototype.toJSON=function(){return this.toPOJO()},e.prototype.toString=function(){var e=this;return this.name+"[{ "+Array.from(this.keys()).map((function(t){return mv(t)+": "+e.get(t)})).join(", ")+" }]"},e.prototype.observe=function(e,t){return iy(this,e)},e.prototype.intercept=function(e){return ey(this,e)},e}(),fy=fv("ObservableMap",py),gy={},vy=function(){function e(e,t,n){if(void 0===t&&(t=Lv),void 0===n&&(n="ObservableSet@"+av()),this.name=n,this[cy]=gy,this._data=new Set,this._atom=Cv(this.name),this[Symbol.toStringTag]="Set","function"!=typeof Set)throw new Error("mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js");this.enhancer=function(e,i){return t(e,i,n)},e&&this.replace(e)}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.clear=function(){var e=this;Ym((function(){am((function(){var t,n;try{for(var i=Mv(e._data.values()),r=i.next();!r.done;r=i.next()){var o=r.value;e.delete(o)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}))}))},e.prototype.forEach=function(e,t){var n,i;try{for(var r=Mv(this),o=r.next();!o.done;o=r.next()){var a=o.value;e.call(t,a,a,this)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._atom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),e.prototype.add=function(e){var t=this;if((im(this._atom),Jm(this))&&!(i=ty(this,{type:"add",object:this,newValue:e})))return this;if(!this.has(e)){Ym((function(){t._data.add(t.enhancer(e,void 0)),t._atom.reportChanged()}));var n=ny(this),i=n?{type:"add",object:this,newValue:e}:null;n&&ry(this,i)}return this},e.prototype.delete=function(e){var t=this;if(Jm(this)&&!(i=ty(this,{type:"delete",object:this,oldValue:e})))return!1;if(this.has(e)){var n=ny(this),i=n?{type:"delete",object:this,oldValue:e}:null;return Ym((function(){t._atom.reportChanged(),t._data.delete(e)})),n&&ry(this,i),!0}return!1},e.prototype.has=function(e){return this._atom.reportObserved(),this._data.has(this.dehanceValue(e))},e.prototype.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return ky({next:function(){var i=e;return e+=1,i<n.length?{value:[t[i],n[i]],done:!1}:{done:!0}}})},e.prototype.keys=function(){return this.values()},e.prototype.values=function(){this._atom.reportObserved();var e=this,t=0,n=Array.from(this._data.values());return ky({next:function(){return t<n.length?{value:e.dehanceValue(n[t++]),done:!1}:{done:!0}}})},e.prototype.replace=function(e){var t=this;return my(e)&&(e=e.toJS()),Ym((function(){var n=vm(!0);try{Array.isArray(e)||vv(e)?(t.clear(),e.forEach((function(e){return t.add(e)}))):null!=e&&sv("Cannot initialize set from "+e)}finally{mm(n)}})),this},e.prototype.observe=function(e,t){return iy(this,e)},e.prototype.intercept=function(e){return ey(this,e)},e.prototype.toJS=function(){return new Set(this)},e.prototype.toString=function(){return this.name+"[ "+Array.from(this).join(", ")+" ]"},e.prototype[(cy=xv,Symbol.iterator)]=function(){return this.values()},e}(),my=fv("ObservableSet",vy),yy=function(){function e(e,t,n,i){void 0===t&&(t=new Map),this.target=e,this.values=t,this.name=n,this.defaultEnhancer=i,this.keysAtom=new Ev(n+".keys")}return e.prototype.read=function(e){return this.values.get(e).get()},e.prototype.write=function(e,t){var n=this.target,i=this.values.get(e);if(i instanceof bm)i.set(t);else{if(Jm(this)){if(!(a=ty(this,{type:"update",object:this.proxy||n,name:e,newValue:t})))return;t=a.newValue}if((t=i.prepareNewValue(t))!==_m.UNCHANGED){var r=ny(this),o=!1,a=r?{type:"update",object:this.proxy||n,oldValue:i.value,name:e,newValue:t}:null;o,i.setNewValue(t),r&&ry(this,a)}}},e.prototype.has=function(e){var t=this.pendingKeys||(this.pendingKeys=new Map),n=t.get(e);if(n)return n.get();var i=!!this.values.get(e);return n=new ym(i,Bv,this.name+"."+mv(e)+"?",!1),t.set(e,n),n.get()},e.prototype.addObservableProp=function(e,t,n){void 0===n&&(n=this.defaultEnhancer);var i=this.target;if(Jm(this)){var r=ty(this,{object:this.proxy||i,name:e,type:"add",newValue:t});if(!r)return;t=r.newValue}var o=new ym(t,n,this.name+"."+mv(e),!1);this.values.set(e,o),t=o.value,Object.defineProperty(i,e,function(e){return xy[e]||(xy[e]={configurable:!0,enumerable:!0,get:function(){return this[xv].read(e)},set:function(t){this[xv].write(e,t)}})}(e)),this.notifyPropertyAddition(e,t)},e.prototype.addComputedProp=function(e,t,n){var i=this.target;n.name=n.name||this.name+"."+mv(t),this.values.set(t,new bm(n)),(e===i||function(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!n||!1!==n.configurable&&!1!==n.writable}(e,t))&&Object.defineProperty(e,t,function(e){return Ey[e]||(Ey[e]={configurable:_m.computedConfigurable,enumerable:!1,get:function(){return wy(this).read(e)},set:function(t){wy(this).write(e,t)}})}(t))},e.prototype.remove=function(e){if(this.values.has(e)){var t=this.target;if(Jm(this))if(!(s=ty(this,{object:this.proxy||t,name:e,type:"remove"})))return;try{Am();var n=ny(this),i=!1,r=this.values.get(e),o=r&&r.get();if(r&&r.set(void 0),this.keysAtom.reportChanged(),this.values.delete(e),this.pendingKeys){var a=this.pendingKeys.get(e);a&&a.set(!1)}delete this.target[e];var s=n?{type:"remove",object:this.proxy||t,oldValue:o,name:e}:null;i,n&&ry(this,s)}finally{Om()}}},e.prototype.illegalAccess=function(e,t){},e.prototype.observe=function(e,t){return iy(this,e)},e.prototype.intercept=function(e){return ey(this,e)},e.prototype.notifyPropertyAddition=function(e,t){var n=ny(this),i=n?{type:"add",object:this.proxy||this.target,name:e,newValue:t}:null;if(n&&ry(this,i),this.pendingKeys){var r=this.pendingKeys.get(e);r&&r.set(!0)}this.keysAtom.reportChanged()},e.prototype.getKeys=function(){var e,t;this.keysAtom.reportObserved();var n=[];try{for(var i=Mv(this.values),r=i.next();!r.done;r=i.next()){var o=Tv(r.value,2),a=o[0];o[1]instanceof ym&&n.push(a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},e}();function by(e,t,n){if(void 0===t&&(t=""),void 0===n&&(n=Lv),Object.prototype.hasOwnProperty.call(e,xv))return e[xv];hv(e)||(t=(e.constructor.name||"ObservableObject")+"@"+av()),t||(t="ObservableObject@"+av());var i=new yy(e,new Map,mv(t),n);return pv(e,xv,i),i}var xy=Object.create(null),Ey=Object.create(null);function wy(e){var t=e[xv];return t||(Pv(e),e[xv])}var Cy=fv("ObservableObjectAdministration",yy);function Ny(e){return!!cv(e)&&(Pv(e),Cy(e[xv]))}function _y(e,t){if("object"==typeof e&&null!==e){if(dy(e))return void 0!==t&&sv(!1),e[xv].atom;if(my(e))return e[xv];if(fy(e)){var n=e;return void 0===t?n._keysAtom:((i=n._data.get(t)||n._hasMap.get(t))||sv(!1),i)}var i;if(Pv(e),t&&!e[xv]&&e[t],Ny(e))return t?((i=e[xv].values.get(t))||sv(!1),i):sv(!1);if(wv(e)||xm(e)||zm(e))return e}else if("function"==typeof e&&zm(e[xv]))return e[xv];return sv(!1)}var Sy=Object.prototype.toString;function My(e,t,n){return void 0===n&&(n=-1),Ty(e,t,n)}function Ty(e,t,n,i,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var o=typeof e;if("function"!==o&&"object"!==o&&"object"!=typeof t)return!1;var a=Sy.call(e);if(a!==Sy.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++}e=Ay(e),t=Ay(t);var s="[object Array]"===a;if(!s){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!("function"==typeof l&&l instanceof l&&"function"==typeof u&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),r=r||[];for(var d=(i=i||[]).length;d--;)if(i[d]===e)return r[d]===t;if(i.push(e),r.push(t),s){if((d=e.length)!==t.length)return!1;for(;d--;)if(!Ty(e[d],t[d],n-1,i,r))return!1}else{var c=Object.keys(e),h=void 0;if(d=c.length,Object.keys(t).length!==d)return!1;for(;d--;)if(!Oy(t,h=c[d])||!Ty(e[h],t[h],n-1,i,r))return!1}return i.pop(),r.pop(),!0}function Ay(e){return dy(e)?e.slice():gv(e)||fy(e)||vv(e)||my(e)?Array.from(e.entries()):e}function Oy(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ky(e){return e[Symbol.iterator]=Dy,e}function Dy(){return this}if("undefined"==typeof Proxy||"undefined"==typeof Symbol)throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");function Ry(e,t){var n=e.minX,i=e.minY,r=e.maxX,o=e.maxY,a=t.x,s=t.y,l=t.width,u=t.height;return n>=a-l/2&&r<=a+l/2&&i>=s-u/2&&o<=s+u/2}function Py(e,t){var n,i;if(!e.children||0===e.children.size)return null;var r=1/0,o=1/0,a=-1/0,s=-1/0,l=!1;try{for(var u=C(Array.from(e.children)),d=u.next();!d.done;d=u.next()){var c=t(d.value);if(c){l=!0;var h=c.getBounds();r=Math.min(r,h.minX),o=Math.min(o,h.minY),a=Math.max(a,h.maxX),s=Math.max(s,h.maxY)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return l?{minX:r,minY:o,maxX:a,maxY:s}:null}function Iy(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&e.maxX>=t.maxX&&e.maxY>=t.maxY}"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return function(){}},extras:{getDebugName:function(e,t){return(void 0!==t?_y(e,t):Ny(e)||fy(e)||my(e)?function(e){return e||sv("Expecting some object"),wv(e)||xm(e)||zm(e)||fy(e)||my(e)?e:(Pv(e),e[xv]?e[xv]:void sv(!1))}(e):_y(e)).name}},$mobx:xv});var Ly=10,By="0,0,0,0",jy="center";function zy(e){var t=e.x,n=e.y,i=e.width,r=e.height;return{bandLeft:t-i/2,bandTop:n-r/2+Ly,bandWidth:i,bandHeight:r-Ly}}function Hy(e){var t=zy(e),n=t.bandLeft,i=t.bandTop,r=t.bandWidth,o=t.bandHeight,a=e.overflowMode,s=e.fontSize,l=e.pad;return{foX:n,foY:i,foWidth:r,foHeight:"ellipsis"===a?l.top+s+2+l.bottom:o}}function Fy(e){if(null==e||""===e)return{top:0,right:0,bottom:0,left:0};if("number"==typeof e)return{top:t=Math.max(0,e),right:t,bottom:t,left:t};var t,n=String(e).split(/[\s,]+/).filter(Boolean).map((function(e){return parseFloat(e.replace(/px$/i,""))||0}));return 1===n.length?{top:t=n[0],right:t,bottom:t,left:t}:2===n.length?{top:n[0],right:n[1],bottom:n[0],left:n[1]}:3===n.length?{top:n[0],right:n[1],bottom:n[2],left:n[1]}:{top:n[0],right:n[1],bottom:n[2],left:n[3]}}function Wy(e){var t=Fy(e);return"".concat(t.top,"px ").concat(t.right,"px ").concat(t.bottom,"px ").concat(t.left,"px")}var Gy=function(n){function i(e,t){var i=n.call(this,e,t)||this;return i.isGroup=!0,i.isRestrict=!1,i.autoResize=!1,i.collapsible=!0,i.staticTextPosition=!0,i.isCollapsed=!1,i.groupAddable=!1,i.transformWithContainer=!1,i.childrenLastCollapseStateDict=new Map,i.childrenLastCollapseStateDict=new Map,i.initNodeData(e),i.setAttributes(),i}return m(i,n),i.prototype.initNodeData=function(e){var t;n.prototype.initNodeData.call(this,e);var i=null!==(t=e.properties)&&void 0!==t?t:{},r=i.children,o=i.width,a=i.height,s=i.collapsedWidth,l=i.collapsedHeight,u=i.collapsible,d=i.isCollapsed,c=i.zIndex,h=i.isRestrict,p=i.autoResize,f=i.autoToFront,g=i.transformWithContainer;this.children=r?new Set(r):new Set,this.zIndex=null!=c?c:-1e4,this.isCollapsed=null!=d&&d,this.setProperties({isCollapsed:null!=d&&d});var v=null!=o?o: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!=p&&p,this.collapsible=null==u||u,this.autoToFront=null!=f&&f,this.setTextPosition(),this.text.draggable=!1},i.prototype.setAttributes=function(){n.prototype.setAttributes.call(this),this.setTextPosition()},i.prototype.getTextStyle=function(){var e,t,i,r,o,a,s,l=n.prototype.getTextStyle.call(this),u=null!==(r=null!==(i=null===(t=null===(e=this.properties)||void 0===e?void 0:e.textStyle)||void 0===t?void 0:t.wrapPadding)&&void 0!==i?i:l.wrapPadding)&&void 0!==r?r:By,d=Fy(u),c=y(y({textAlign:jy},l),{wrapPadding:Wy(u)}),h=null!==(o=c.overflowMode)&&void 0!==o?o:"default",p=Number(null!==(a=c.fontSize)&&void 0!==a?a:12);return"ellipsis"===h&&(c.textHeight=d.top+p+2+d.bottom),c.textAnchor="left"===(s=c.textAlign)?"start":"right"===s?"end":"middle",c.dominantBaseline="hanging",Fs(c)},i.prototype.setProperties=function(e){n.prototype.setProperties.call(this,e)},i.prototype.getData=function(){var e=this,t=n.prototype.getData.call(this),i=[];return _u(Array.from(this.children),(function(t){var n=e.graphModel.getNodeModelById(t);n&&!n.virtual&&i.push(t)})),t.children=i,t.properties&&(t.properties.children=i,t.properties.isCollapsed=this.isCollapsed),t},i.prototype.getNodesInGroup=function(e){var t=[];return e.isGroup&&_u(Array.from(e.children),(function(e){t.push(e)})),t},i.prototype.getMoveDistance=function(e,t,i){void 0===i&&(i=!1);var r=N(n.prototype.getMoveDistance.call(this,e,t,i),2),o=r[0],a=r[1],s=this.getNodesInGroup(this);return this.graphModel.moveNodes(s,e,t,i),[o,a]},i.prototype.getHistoryData=function(){var e=n.prototype.getHistoryData.call(this);e.children=Array.from(this.children),e.isGroup=!0;var t=this,i=t.x,r=t.y,o=t.collapsedWidth,a=t.collapsedHeight,s=t.expandWidth,l=t.expandHeight;return t.isCollapsed&&(e.x=i+s/2-o/2,e.y=r+l/2-a/2,e.text&&(e.text.x=e.text.x+s/2-o/2,e.text.y=e.text.y+l/2-a/2)),e},i.prototype.toggleCollapse=function(e){var n=this,i=this.graphModel,r=!!e;this.isCollapsed=r,this.setProperties({isCollapsed:r}),i.eventCenter.emit("dynamicGroup:collapse",{collapse:r,nodeModel:this}),r?this.collapse():this.expand();var o=_(_([],N(this.incoming.edges),!1),N(this.outgoing.edges),!1);_u(Array.from(this.children),(function(i){var r,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 d=null===(r=n.childrenLastCollapseStateDict)||void 0===r?void 0:r.get(i);void 0!==d&&d!==s.isCollapsed&&u.toggleCollapse(d)}}if(null===(a=n.childrenLastCollapseStateDict)||void 0===a||a.set(i,!!l),s.visible=!e,s.BaseType===t.ElementType.NODE){var c=s.incoming.edges,h=s.outgoing.edges;o=_(_(_([],N(o),!1),N(c),!1),N(h),!1)}}})),this.collapseEdge(r,o)},i.prototype.getTitleHtmlRect=function(){var e,t,n,i,r,o=this.getTextStyle(),a=Fy(null!==(n=null===(t=null===(e=this.properties)||void 0===e?void 0:e.textStyle)||void 0===t?void 0:t.wrapPadding)&&void 0!==n?n:By),s="ellipsis"===(null!==(i=o.overflowMode)&&void 0!==i?i:"default")?"ellipsis":"autoWrap";return Hy({x:this.x,y:this.y,width:this.width,height:this.height,overflowMode:s,fontSize:Number(null!==(r=o.fontSize)&&void 0!==r?r:12),pad:a})},i.prototype.updateExpandedSize=function(e,t){this.expandWidth=e,this.expandHeight=t,this.setProperties({width:e,height:t})},i.prototype.setTextPosition=function(){var e,t,n,i,r=this,o=r.x,a=r.y,s=r.width,l=r.height,u=r.text;if(u)if(this.isCollapsed)u.x===o&&u.y===a||(this.text=y(y({},u),{x:o,y:a}));else{var d=this.getTextStyle(),c=Fy(null!==(n=null===(t=null===(e=this.properties)||void 0===e?void 0:e.textStyle)||void 0===t?void 0:t.wrapPadding)&&void 0!==n?n:By),h=function(e){var t=e.x,n=e.width,i=e.height,r=e.textAlign,o=e.pad,a=zy({x:t,y:e.y,width:n,height:i}),s=a.bandLeft,l=a.bandTop,u=a.bandWidth,d=s+o.left,c=s+u-o.right,h=l+o.top,p=d+Math.max(0,c-d)/2;return"left"===r?{x:d,y:h}:"right"===r?{x:c,y:h}:{x:p,y:h}}({x:o,y:a,width:s,height:l,textAlign:null!==(i=d.textAlign)&&void 0!==i?i:jy,pad:c}),p=h.x,f=h.y;p===u.x&&f===u.y||(this.text=y(y({},u),{x:p,y:f}))}},i.prototype.collapse=function(){var e=this,t=e.x,n=e.y,i=e.width,r=e.height,o=e.collapsedWidth,a=e.collapsedHeight;this.x=t-i/2+o/2,this.y=n-r/2+a/2,this.expandWidth=i,this.expandHeight=r,this.width=o,this.height=a,this.setTextPosition()},i.prototype.expand=function(){var e=this,t=e.x,n=e.y,i=e.expandWidth,r=e.expandHeight,o=e.collapsedWidth,a=e.collapsedHeight;this.width=i,this.height=r,this.x=t+this.width/2-o/2,this.y=n+this.height/2-a/2,this.setTextPosition()},i.prototype.createVirtualEdge=function(e,t){e.pointsList=void 0;var n=this.graphModel.addEdge(e);n.virtual=!0,n.text.editable=!1,n.isCollapsedEdge=!0;var i=this.graphModel.dynamicGroup;return null==i||i.registerCollapsedVirtualEdge(n.id,this.id,t),n},i.prototype.collapseEdge=function(e,t){var n=this,i=this.graphModel;_u(t,(function(t,r){var o,a=t.getData(),s=a.targetNodeId,l=a.sourceNodeId,u=y(y({},a),{id:"".concat(a.id,"__").concat(r),text:null===(o=a.text)||void 0===o?void 0:o.value});if(t.virtual){var d=i.dynamicGroup;return null==d||d.unregisterCollapsedVirtualEdge(t.id),void i.deleteEdgeById(t.id)}var c=i.dynamicGroup.getGroupByNodeId(s);c||(c=i.getNodeModelById(s));var h=i.dynamicGroup.getGroupByNodeId(l);if(h||(h=i.getNodeModelById(l)),e&&t.visible&&(n.children.has(l)||n.id===l?(u.startPoint=void 0,u.sourceNodeId=n.id,delete u.sourceAnchorId):(u.endPoint=void 0,u.targetNodeId=n.id,delete u.targetAnchorId),c.id===n.id&&h.id===n.id||n.createVirtualEdge(u,t.id),t.visible=!1),!e&&!t.visible){if(!i.getEdgeModelById(t.id))return;c&&c.isGroup&&c.isCollapsed?(u.targetNodeId=c.id,u.endPoint=void 0,delete u.targetAnchorId,n.createVirtualEdge(u,t.id)):h&&h.isGroup&&h.isCollapsed?(u.sourceNodeId=h.id,u.startPoint=void 0,delete u.sourceAnchorId,n.createVirtualEdge(u,t.id)):t.visible=!0}}))},i.prototype.isAllowAppendIn=function(e){return!0},i.prototype.setAllowAppendChild=function(e){this.groupAddable=e},i.prototype.addChild=function(t){this.children.add(t);var n=this.getData();this.graphModel.eventCenter.emit(e.ExtensionEventType.GROUP_ADD_NODE,{data:n,childId:t})},i.prototype.removeChild=function(t){this.children.delete(t);var n=this.getData();this.graphModel.eventCenter.emit(e.ExtensionEventType.GROUP_REMOVE_NODE,{data:n})},i.prototype.toBack=function(){this.zIndex--},i.prototype.isManualEdgeConnectAllowed=function(){var e,t=(null!==(e=this.properties)&&void 0!==e?e:{}).allowEdgeConnect;if(void 0!==t)return t;var n=this.graphModel.dynamicGroup;return!(null==n?void 0:n.disallowEdgeConnectToGroup)},i.prototype.getConnectedTargetRules=function(){var e=this,t=n.prototype.getConnectedTargetRules.call(this);return t.push({message:"分组节点不允许作为边的终点",validate:function(){return e.isManualEdgeConnectAllowed()}}),t},i.prototype.getConnectedSourceRules=function(){var e=this,t=n.prototype.getConnectedSourceRules.call(this);return t.push({message:"分组节点不允许作为边的起点",validate:function(){return e.isManualEdgeConnectAllowed()}}),t},i.prototype.getDefaultAnchor=function(){var e=n.prototype.getDefaultAnchor.call(this);return this.isManualEdgeConnectAllowed()?e:e.map((function(e){return y(y({},e),{edgeAddable:!1})}))},i.prototype.getAnchorStyle=function(){var e=n.prototype.getAnchorStyle.call(this);return e.stroke="transparent",e.fill="transparent",e.hover&&(e.hover.fill="transparent",e.hover.stroke="transparent"),e},i.prototype.getAddableOutlineStyle=function(){var e,t=this.graphModel.dynamicGroup,n=null!==(e=null==t?void 0:t.sensorOutline)&&void 0!==e?e:{},i=n.stroke,r=n.strokeWidth;return{stroke:null!=i?i:Uy.stroke,strokeWidth:null!=r?r:Uy.strokeWidth,strokeDasharray:"4 4",fill:"transparent"}},x([t.observable],i.prototype,"isCollapsed",void 0),x([t.observable],i.prototype,"groupAddable",void 0),x([t.observable],i.prototype,"transformWithContainer",void 0),i}(t.RectNodeModel),Uy={stroke:"#feb663",strokeWidth:2},Vy={defaultWidth:120,defaultHeight:120,titleSize:60,poolMinSize:20},Xy=120,qy=120,Ky=20,Yy=20,Qy=15,Zy=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.titleSize=Vy.titleSize,i.poolConfig=Vy,i.isPool=!0,i._defaultLaneCreated=!1,i}return m(t,e),Object.defineProperty(t.prototype,"isHorizontal",{get:function(){var e;return"horizontal"===(null===(e=this.properties)||void 0===e?void 0:e.direction)},enumerable:!1,configurable:!0}),t.prototype.initNodeData=function(t){var n,i;e.prototype.initNodeData.call(this,t),t.properties&&(this.width=(null===(n=t.properties)||void 0===n?void 0:n.width)||Vy.defaultWidth,this.height=(null===(i=t.properties)||void 0===i?void 0:i.height)||Vy.defaultHeight),this.autoResize=!1,this.isRestrict=!0,this.transformWithContainer=!0,this.resizable=!1,this.rotatable=!1,this.autoToFront=!1,this.text.editable=!0,this.updateTextPosition(),this.addEventListeners(),this.resizePool()},t.prototype.addEventListeners=function(){var e=this;this.graphModel.eventCenter.on("node:resize",(function(t){var n=t.data,i=t.index;if(e.children.has(n.id)){var r=e.graphModel.getNodeModelById(n.id);if(!r||!r.type||"lane"!==r.type)return;var o,a,s=e.getLanes(),l=void 0,u=void 0;if(e.isHorizontal){var d=s.reduce((function(e,t){return e+t.height}),0);l=r.width+Vy.titleSize,u=d}else{var c=s.reduce((function(e,t){return e+t.width}),0);u=r.height+Vy.titleSize,l=c}var h="number"==typeof i?i:2,p=0===h||1===h?-1:1;o=(0===h||3===h?-1:1)*(l-e.width),a=p*(u-e.height),e.width=l,e.height=u,e.move(o/2,a/2)}e.resizeChildren(),e.updateTextPosition()}))},t.prototype.getNodesInGroup=function(e){var t=this,n=[];return e.isGroup&&_u(Array.from(e.children),(function(e){var i=t.graphModel.getNodeModelById(e);i&&!i.isDragging&&n.push(e)})),n},t.prototype.updateTextPosition=function(){this.isHorizontal?(this.text.x=this.x-this.width/2+Vy.titleSize/2,this.text.y=this.y):(this.text.x=this.x,this.text.y=this.y-this.height/2+Vy.titleSize/2)},t.prototype.resizePool=function(){var e=this.getLanes();if(0!==e.length){var t=0,n=0;this.isHorizontal?(_u(e,(function(e){var i=e.width,r=e.height;t=Math.max(t,i),n+=r})),this.width=t+Vy.titleSize,this.height=n):(_u(e,(function(e){var i=e.width,r=e.height;t+=i,n=Math.max(n,r)})),this.width=t,this.height=n+Vy.titleSize),this.updateTextPosition()}},t.prototype.resizeChildrenWithNewLane=function(e,t){var n,i=this,r=this.getLanes();if(e&&t&&!Qd(r)){var o=[],a=r.find((function(e){return e.id===t}));if(o=r.filter((function(e){return e.id!==t})).slice().sort((function(e,t){return i.isHorizontal?e.y-t.y:e.x-t.x})),a){var s=null===(n=a.properties)||void 0===n?void 0:n.referenceLaneId,l=s?o.findIndex((function(e){return e.id===s})):0,u=["above","left"].includes(e)?Math.max(l,0):Math.min(l+1,o.length);o.splice(u,0,a)}if(this.isHorizontal){var d=this.width-Vy.titleSize,c=o.reduce((function(e,t){return e+t.height}),0),h=this.y-c/2;o.forEach((function(e,t){var n=h+e.height/2;e.text=y(y({},e.text),{x:e.x-d/2+Ky/2,y:e.y}),i.moveLane(e,e.x,n),t<o.length-1&&(h+=e.height)})),this.height=c}else{var p=this.height-Vy.titleSize,f=o.reduce((function(e,t){return e+t.width}),0),g=this.x-f/2;o.forEach((function(e,t){var n=g+e.width/2;e.text=y(y({},e.text),{x:e.x,y:e.y-p/2+Ky/2}),i.moveLane(e,n,e.y),t<o.length-1&&(g+=e.width)})),this.width=f}this.updateTextPosition()}},t.prototype.moveLane=function(e,t,n){var i=this,r=[];e.children&&e.children.size>0&&e.children.forEach((function(t){var n=i.graphModel.getNodeModelById(t);n&&!n.isDragging&&"lane"!==String(n.type)&&r.push({id:t,dx:n.x-e.x,dy:n.y-e.y})})),e.moveTo(t,n,!0),r.forEach((function(t){var n=t.id,r=t.dx,o=t.dy,a=i.graphModel.getNodeModelById(n);if(a){var s=a.x,l=a.y,u=e.x+r,d=e.y+o;a.moveTo(u,d);var c=a.incoming.edges,h=a.outgoing.edges;c.forEach((function(e){e.moveEndPoint(u-s,d-l)})),h.forEach((function(e){e.moveStartPoint(u-s,d-l)}))}}))},t.prototype.resizeChildren=function(){var e=this,t=this.getLanes();if(0!==t.length)if(this.isHorizontal){this.height=t.reduce((function(e,t){return e+t.height}),0);var n=t.slice().sort((function(e,t){return e.y-t.y}));t.forEach((function(t){t.width=e.width-Vy.titleSize;var i=n.findIndex((function(e){return e.id===t.id})),r=n.reduce((function(e,n,r){return r<i&&n.id!==t.id?e+n.height:e}),e.y-e.height/2);t.moveTo(e.x-e.width/2+Vy.titleSize+t.width/2,r+t.height/2,!0)}))}else{this.width=t.reduce((function(e,t){return e+t.width}),0);var i=Fs(t).sort((function(e,t){return e.x-t.x}));t.forEach((function(t){t.height=e.height-Vy.titleSize;var n=i.findIndex((function(e){return e.id===t.id})),r=i.reduce((function(e,i,r){return r<n&&i.id!==t.id?e+i.width:e}),e.x-e.width/2);t.moveTo(r+t.width/2,e.y-e.height/2+Vy.titleSize+t.height/2,!0)}))}},t.prototype.getLanes=function(){var e=this,t=[];return Array.from(this.children).forEach((function(n){var i=e.graphModel.getNodeModelById(n);i&&"lane"===String(i.type)&&t.push(i)})),t},t.prototype.addLane=function(e,t){var n,i,r,o,a=this.getLanes();if(0===a.length)return this.createDefaultLane(t);var s=this.x,l=this.y,u=a.find((function(e){return e.id===(null==t?void 0:t.id)})),d=u||a[0],c=null!==(n=null==d?void 0:d.width)&&void 0!==n?n:this.width,h=null!==(i=null==d?void 0:d.height)&&void 0!==i?i:this.height;this.isHorizontal&&["above","below"].includes(e)&&u&&(l="above"===e?u.y-u.height/2-h/2:u.y+u.height/2+h/2,s=u.x),!this.isHorizontal&&["left","right"].includes(e)&&u&&(s="left"===e?u.x-u.width/2-c/2:u.x+u.width/2+c/2,l=u.y);var p=Fs(t);p&&(delete p.id,delete p.children,null===(r=p.properties)||void 0===r||delete r.parent,null===(o=p.properties)||void 0===o||delete o.children);var f=wc(p,{type:"lane",x:s,y:l,width:c,height:h,text:"新泳道",properties:{parent:this.id,position:e,referenceLaneId:null==u?void 0:u.id},zIndex:this.zIndex},this.properties.laneConfig),g=this.graphModel.addNode(f);return this.setZIndex(this.zIndex-1),this.addChild(g.id),this.resizeChildrenWithNewLane(e,g.id),g},t.prototype.setZIndex=function(e){this.zIndex=Math.min(e,-100)},t.prototype.addChildAbove=function(e){return this.addLane("above",e)},t.prototype.addChildBelow=function(e){return this.addLane("below",e)},t.prototype.addChildLeft=function(e){return this.addLane("left",e)},t.prototype.addChildRight=function(e){return this.addLane("right",e)},t.prototype.createDefaultLane=function(e){var t=null;if(this.isHorizontal){var n=this.width-Vy.titleSize,i=this.height;t=this.graphModel.addNode(wc({type:"lane",x:this.x-this.width/2+Vy.titleSize+n/2,y:this.y,width:n,height:i,text:{x:this.x-this.width/2+Vy.titleSize/2,y:this.y,value:"泳道1"},properties:{parent:this.id,isHorizontal:this.isHorizontal},zIndex:this.zIndex},e))}else{n=this.width,i=this.height-Vy.titleSize;t=this.graphModel.addNode(wc({type:"lane",x:this.x,y:this.y-this.height/2+Vy.titleSize+(this.height-Vy.titleSize)/2,width:n,height:i,text:{x:this.x,y:this.y-this.height/2+Vy.titleSize/2,value:"泳道1"},properties:{parent:this.id},zIndex:this.zIndex},e))}return this.setZIndex(this.zIndex-1),this.addChild(t.id),this.resizeChildren(),this.updateTextPosition(),t},t.prototype.deleteChild=function(e){var t=this.getLanes();t.length<=1||t.find((function(t){return t.id===e}))&&(this.removeChild(e),this.graphModel.deleteNode(e),this.resizePool(),this.resizeChildren())},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.strokeWidth=2,t},t.prototype.getTextStyle=function(){var t=e.prototype.getTextStyle.call(this);return t.overflowMode="ellipsis",t.strokeWidth=2,t.textWidth=this.isHorizontal?this.height:this.width,t.textHeight=this.isHorizontal?this.width:this.height,this.isHorizontal&&(t.transform="rotate(-90deg)",t.textAlign="center"),t},t.prototype.getData=function(){var t=e.prototype.getData.call(this);return y(y({},t),{properties:y(y({},t.properties),{width:this.width,height:this.height})})},x([Jv],t.prototype,"isHorizontal",null),t}(Gy),$y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Jy={};!function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=r(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 o in e)t.call(e,o)&&e[o]&&(i=r(i,o));return i}function r(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}({get exports(){return Jy},set exports(e){Jy=e}});var eb=Jy,tb=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.getShape=function(){var t,n=this.props.model,i=n.text.value,r=n.getTextStyle();return function(e){return"autoWrap"===e||"ellipsis"===e}(null!==(t=r.overflowMode)&&void 0!==t?t:"default")?this.renderTitleHtmlText(i,r):e.prototype.getShape.call(this)},t.prototype.renderTitleHtmlText=function(e,t){var n,i=this.props,r=i.model,o=i.graphModel,a=r.text,s=a.editable,l=a.draggable,u=o.editConfigModel,d=t.overflowMode,c=Number(null!==(n=t.fontSize)&&void 0!==n?n:12),h=t.wrapPadding,p=Fy(h),f=Wy(h),g=Hy({x:r.x,y:r.y,width:r.width,height:r.height,overflowMode:d,fontSize:c,pad:p}),v=g.foX,m=g.foY,y=g.foWidth,b=g.foHeight,x="ellipsis"===d,E=String(e).split(/\r\n|\r|\n/g),w=u.nodeTextDraggable||l;return Bf("g",{className:eb({"lf-element-text":s,"lf-text-draggable":!s&&w,"lf-text-disabled":!s&&!w}),children:Bf("foreignObject",{width:y,height:b,x:v,y:m,style:{overflow:"visible",textAlign:"left"},children:Bf("div",{className:"lf-node-text-auto-wrap lf-dg-title-html",style:{boxSizing:"border-box",display:"flex",alignItems:"flex-start",justifyContent:"stretch",width:y,height:b,padding:f},children:Bf("div",{className:x?"lf-node-text-ellipsis-content":"lf-node-text-auto-wrap-content",title:x?E.join(""):"",style:{textAlign:t.textAlign,fontSize:c,lineHeight:t.lineHeight,fontFamily:t.fontFamily,color:t.fill,width:"100%"},children:E.map((function(e,t){return Bf("div",{className:"lf-node-text--auto-wrap-inner",children:e},t)}))})})})})},t}(t.BaseText);function nb(e,t,n){var i=t.x,r=t.y,o=e.x-i,a=e.y-r;return{x:o*Math.cos(n)-a*Math.sin(n)+i,y:o*Math.sin(n)+a*Math.cos(n)+r}}var ib=function(e){function n(){var n=e.apply(this,_([],N(arguments),!1))||this;return n.childrenPositionMap=new Map,n.onNodeRotate=function(e){var t=e.model,i=n.props,r=i.model,o=i.graphModel,a=r.transformWithContainer,s=r.isRestrict,l=n.childrenPositionMap;if(a&&!s&&t.id===r.id){var u={x:r.x,y:r.y};_u(Array.from(r.children),(function(e){var n=o.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 r=t.rotate*(180/Math.PI);r<0&&(r+=360);var a=r*(Math.PI/180),s=nb(i,u,a);n.moveTo(s.x,s.y),n.rotate=t.rotate}}))}},n.onNodeResize=function(e){var i=e.deltaX,r=e.deltaY,o=e.index,a=e.model,s=e.preData,l=n.props,u=l.model,d=l.graphModel,c=u.transformWithContainer,h=u.isRestrict;if(c&&!h&&a.id===u.id){var p=s.properties||{},f=p.width,g=p.height;_u(Array.from(u.children),(function(e){var n=d.getNodeModelById(e);if(n){var a=n.width/f*i,s=n.height/g*r;t.handleResize({deltaX:a,deltaY:s,index:o,nodeModel:n,graphModel:d,cancelCallback:function(){}})}}))}},n.onNodeMouseMove=function(){},n.graphRendered=function(){var e=n.props.model;e.isCollapsed&&e.toggleCollapse(!0)},n}return m(n,e),n.prototype.componentDidMount=function(){e.prototype.componentDidMount.call(this);var n=this.props.graphModel.eventCenter;n.on(t.EventType.NODE_ROTATE,this.onNodeRotate),n.on(t.EventType.NODE_RESIZE,this.onNodeResize),n.on(t.EventType.NODE_MOUSEMOVE,this.onNodeMouseMove),n.on(t.EventType.GRAPH_RENDERED,this.graphRendered)},n.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this);var n=this.props.graphModel.eventCenter;n.off(t.EventType.NODE_ROTATE,this.onNodeRotate),n.off(t.EventType.NODE_RESIZE,this.onNodeResize),n.off(t.EventType.NODE_MOUSEMOVE,this.onNodeMouseMove),n.off(t.EventType.GRAPH_RENDERED,this.graphRendered)},n.prototype.getNodesInGroup=function(e,t){var n=this,i=[];return e.isGroup&&_u(Array.from(e.children),(function(e){i.push(e);var r=t.getNodeModelById(e);(null==r?void 0:r.isGroup)&&(i=i.concat(n.getNodesInGroup(r,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,r=e.x,o=e.y,a=e.radius;if(!e.groupAddable)return null;var s=e.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=e.getAddableOutlineStyle(),d=n+l+8,c=i+l+8;return t.h("rect",y(y({},u),{width:d,height:c,x:r-d/2,y:o-c/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,r=e.width,o=e.height,a=n-r/2+Ly,s=i-o/2+Ly;if(!e.collapsible)return null;var l=(null==e?void 0:e.isCollapsed)?this.getCollapseIcon(a,s):this.getExpandIcon(a,s),u=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:l});return t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#f4f5f6",stroke:"#cecece",cursor:"pointer",x:a,y:s,onPointerDown:function(e){e.stopPropagation()},onClick:function(t){t.stopPropagation(),e.toggleCollapse(!e.isCollapsed)},onDblClick:function(e){e.stopPropagation()}}),u])},n.prototype.getText=function(){var e,n=this.props,i=n.model,r=n.graphModel,o=r.editConfigModel;if(o.nodeTextMode!==t.TextMode.TEXT)return null;if(i.state===t.ElementState.TEXT_EDIT)return null;var a=null;if(i.text){var s=!1;o.nodeTextDraggable&&i.text.draggable&&(s=!0),a=t.h(tb,{editable:o.nodeTextEdit&&(null===(e=i.text.editable)||void 0===e||e),model:i,graphModel:r,draggable:s})}var l=this.getOperateIcon();return a||l?t.h("g",{},a,l):null},n.prototype.getShape=function(){return t.h("g",{},[this.getAppendAreaShape(),e.prototype.getShape.call(this)])},n}(t.RectNode),rb=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.componentDidMount=function(){var e,t,n,i=this.props,r=i.graphModel,o=i.model,a=r.nodes.findIndex((function(e){return e.id===o.id})),s=r.nodes.filter((function(e){return"pool"===String(e.type)})).length;o.setZIndex(-100*(s-a)),(null===(t=null===(e=o.properties)||void 0===e?void 0:e.children)||void 0===t?void 0:t.length)||o._defaultLaneCreated||o.virtual||(o.createDefaultLane(null===(n=o.properties)||void 0===n?void 0:n.laneConfig),o._defaultLaneCreated=!0)},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.properties,s=a.textStyle,l=void 0===s?{}:s,u=a.style,d=void 0===u?{}:u,c=e.isHorizontal,h=e.getNodeStyle(),p={fill:"#ffffff",stroke:"#000000",strokeWidth:1},f=n-r/2,g=i-o/2,v=y(y(y(y({},p),h),{x:f,y:g,width:c?Vy.titleSize:r,height:c?o:Vy.titleSize}),c&&l),m=y(y(y(y({},p),h),{x:c?f+Vy.titleSize:f,y:c?g:g+Vy.titleSize,width:c?r-Vy.titleSize:r,height:c?o:o-Vy.titleSize}),c&&d);return t.h("g",{},[t.h("rect",v),t.h("rect",m)])},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}(ib),ob={type:"dynamic-group",view:ib,model:Gy},ab=-1e4,sb=function(){function n(t){var n=t.lf,i=t.options,r=this;this.disallowEdgeConnectToGroup=!1,this.cascadeDeleteChildren=!0,this.topGroupZIndex=ab,this.activeGroups=new Set,this.nodeGroupMap=new Map,this.collapsedVirtualEdges=new Map,this.collapsedRealEdgeToGroup=new Map,this.onEdgeDelete=function(e){var t=e.data,n=r.collapsedVirtualEdges.get(t.id);if(n)return r.collapsedVirtualEdges.delete(t.id),r.collapsedRealEdgeToGroup.delete(n.realEdgeId),void(r.lf.getEdgeModelById(n.realEdgeId)&&r.lf.deleteEdge(n.realEdgeId));r.collapsedRealEdgeToGroup.get(t.id)&&r.collapsedRealEdgeToGroup.delete(t.id);var i=[];r.collapsedVirtualEdges.forEach((function(e,n){e.realEdgeId===t.id&&i.push(n)})),i.forEach((function(e){r.collapsedVirtualEdges.delete(e),r.lf.getEdgeModelById(e)&&r.lf.deleteEdge(e)}))},this.onSelectionDrop=function(){r.clearDragTargetHighlight(),r.lf.graphModel.getSelectElements().nodes.forEach((function(e){r.addNodeToGroup(e)}))},this.onNodeAdd=function(e){var t=e.data;r.syncGroupChildren(t)},this.onNodeDndAdd=function(e){var t=e.data;r.syncGroupChildren(t),r.addNodeToGroup(t),r.clearDragTargetHighlight()},this.onNodeDrop=function(e){var t=e.data;r.clearDragTargetHighlight(),r.addNodeToGroup(t)},this.onNodeMouseUp=function(){r.clearDragTargetHighlight()},this.detachNodeFromGroup=function(e,t){var n=r.lf.getNodeModelById(e);n&&(n.removeChild(t),r.nodeGroupMap.delete(t),n.setAllowAppendChild(!1))},this.releaseGroupMembers=function(e){e.isCollapsed&&e.toggleCollapse(!1),_u(Array.from(e.children),(function(t){r.detachNodeFromGroup(e.id,t)}))},this.removeChildFromOtherGroups=function(e,t){var n=r.nodeGroupMap.get(e);if(n&&n!==t){var i=r.lf.getNodeModelById(n);null==i||i.removeChild(e)}_u(r.lf.graphModel.nodes,(function(n){var i;if(n.isGroup&&n.id!==t){var r=n;(null===(i=r.children)||void 0===i?void 0:i.has(e))&&r.removeChild(e)}}))},this.setNodeGroup=function(e,t){r.removeChildFromOtherGroups(t,e),r.nodeGroupMap.set(t,e)},this.syncGroupChildren=function(e){var t=r.lf.getNodeModelById(e.id);if(null==t?void 0:t.isGroup){var n=t;_u(Array.from(n.children),(function(t){r.setNodeGroup(e.id,t)})),r.calibrateTopGroupZIndex([e]),r.onNodeSelect({data:e,isSelected:!1,isMultiple:!1})}},this.addNodeToGroup=function(t){var n=r.lf.getNodeModelById(t.id),i=null==n?void 0:n.getBounds();if(n&&i){var o=r.nodeGroupMap.get(t.id),a=r.getGroupByBounds(i,t);if(!o||(null==a?void 0:a.id)!==o)if(a)if(o)if(a.isAllowAppendIn(t))r.detachNodeFromGroup(o,t.id),a.addChild(t.id);else{var s=r.lf.getNodeModelById(o);if(s&&Ry(i,s))return;r.detachNodeFromGroup(o,t.id),r.lf.emit(e.ExtensionEventType.GROUP_NOT_ALLOWED,{group:a.getData(),node:t})}else a.isAllowAppendIn(t)?a.addChild(t.id):r.lf.emit(e.ExtensionEventType.GROUP_NOT_ALLOWED,{group:a.getData(),node:t});else o&&r.detachNodeFromGroup(o,t.id)}},this.onGroupAddNode=function(e){var t=e.data,n=e.childId;r.setNodeGroup(t.id,n)},this.removeNodeFromGroup=function(e){var t=e.data,n=e.model;if(n.isGroup&&t.children){var i=n;r.cascadeDeleteChildren?_u(Array.from(i.children),(function(e){r.nodeGroupMap.delete(e),r.lf.deleteNode(e)})):i.children.size>0&&r.releaseGroupMembers(i)}var o=r.nodeGroupMap.get(t.id);if(o){var a=r.lf.getNodeModelById(o);a&&a.removeChild(t.id),r.nodeGroupMap.delete(t.id)}},this.onSelectionDrag=function(){var e=r.lf.graphModel.getSelectElements().nodes,t=new Set;e.forEach((function(e){var n=r.getTargetGroupForNode(e);n&&t.add(n)})),r.activeGroups.forEach((function(e){t.has(e)||e.setAllowAppendChild(!1)})),t.forEach((function(e){r.activeGroups.has(e)||e.setAllowAppendChild(!0)})),r.activeGroups=t},this.onNodeDrag=function(e){var t=e.data;r.setActiveGroup(t)},this.setActiveGroup=function(e){var t=r.getTargetGroupForNode(e),n=new Set;t&&n.add(t),r.activeGroups.forEach((function(e){n.has(e)||e.setAllowAppendChild(!1)})),n.forEach((function(e){r.activeGroups.has(e)||e.setAllowAppendChild(!0)})),r.activeGroups=n},this.onNodeSelect=function(e){var t=e.data,n=e.isMultiple,i=e.isSelected,o=r.lf.getNodeModelById(t.id);if(r.sendNodeToFront(o),r.topGroupZIndex>-1e3){var a=r.lf.graphModel.nodes;r.topGroupZIndex=ab;var s=ip(Vu(a,(function(e){return!!e.isGroup})),"zIndex"),l=0;_u(s,(function(e){e.zIndex!==l&&(r.topGroupZIndex++,l=e.zIndex),e.setZIndex(r.topGroupZIndex)}))}if(n&&i)if(null==o?void 0:o.isGroup){var u=o.children;_u(Array.from(u),(function(e){var t=r.lf.getNodeModelById(e);null==t||t.setSelected(!1)}))}else{var d=r.nodeGroupMap.get(t.id);if(d){var c=r.lf.getNodeModelById(d);(null==c?void 0:c.isSelected)&&(null==o||o.setSelected(!1))}}},this.onNodeMove=function(e){var t=e.data.id,n=r.nodeGroupMap.get(t);if(n){var i=r.lf.getNodeModelById(n);if(i&&i.isRestrict&&i.autoResize){var o=r.lf.getNodeModelById(t);if(o){var a=o.getBounds(),s=a.minX,l=a.minY,u=a.maxX,d=a.maxY,c=!1,h=i.getBounds(),p=Object.assign({},h);if(s<p.minX&&(p.minX=s,c=!0),l<p.minY&&(p.minY=l,c=!0),u>p.maxX&&(p.maxX=u,c=!0),d>p.maxY&&(p.maxY=d,c=!0),c){var f=p.minX+(p.maxX-p.minX)/2,g=p.minY+(p.maxY-p.minY)/2,v=p.maxX-p.minX,m=p.maxY-p.minY;i.moveTo(f,g),i.width=v,i.height=m,i.updateExpandedSize(v,m),i.setTextPosition()}}}}},this.onNodeResize=function(e){var t=e.model;(null==t?void 0:t.isGroup)&&!t.isCollapsed&&t.setTextPosition()},this.onGraphRendered=function(e){var t=e.data;r.nodeGroupMap.clear(),r.collapsedVirtualEdges.clear(),r.collapsedRealEdgeToGroup.clear(),r.activeGroups.clear(),r.topGroupZIndex=ab,_u(t.nodes,(function(e){e.children&&_u(e.children,(function(t){r.nodeGroupMap.set(t,e.id)}))})),r.calibrateTopGroupZIndex(t.nodes)},n.register(ob),this.lf=n,hr(this,i),this.init()}return n.prototype.getGroupByNodeId=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},n.prototype.registerCollapsedVirtualEdge=function(e,t,n){this.collapsedVirtualEdges.set(e,{groupId:t,realEdgeId:n}),this.collapsedRealEdgeToGroup.set(n,t)},n.prototype.unregisterCollapsedVirtualEdge=function(e){var t=this.collapsedVirtualEdges.get(e);t&&(this.collapsedVirtualEdges.delete(e),this.collapsedRealEdgeToGroup.get(t.realEdgeId)===t.groupId&&this.collapsedRealEdgeToGroup.delete(t.realEdgeId))},n.prototype.getGroupByBounds=function(e,t){var n=Vu(this.lf.graphModel.nodes,(function(n){return!!n.isGroup&&Ry(e,n)&&n.id!==t.id})),i=n.length;if(i<=1)return n[0];for(var r=n[i-1],o=i-2;o>=0;o--)n[o].zIndex>r.zIndex&&(r=n[o]);return r},n.prototype.sendNodeToFront=function(e){var t=this;if(e&&e.isGroup&&(this.topGroupZIndex++,e.setZIndex(this.topGroupZIndex),e.children)){var n=e.children;_u(Array.from(n),(function(e){var n=t.lf.getNodeModelById(e);t.sendNodeToFront(n)}))}},n.prototype.getMaxZIndex=function(e){var t=this,n=ab;if(e.isGroup&&(n=Math.max(n,e.zIndex)),e.children){var i=e.children;_u(Array.from(i),(function(e){var i=t.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var r=t.getMaxZIndex(i);n=Math.max(n,r)}}))}return n},n.prototype.calibrateTopGroupZIndex=function(e){var t=this,n=ab;if(_u(e,(function(e){var i=t.lf.getNodeModelById(e.id);if(i){var r=t.getMaxZIndex(i);r>n&&(n=r)}})),!(this.topGroupZIndex>=n)){var i=Vu(this.lf.graphModel.nodes,(function(e){return!!e.isGroup})),r=this.topGroupZIndex;_u(i,(function(e){e.zIndex>r&&(r=e.zIndex)})),this.topGroupZIndex=r}},n.prototype.clearDragTargetHighlight=function(){this.activeGroups.forEach((function(e){e.setAllowAppendChild(!1)})),this.activeGroups.clear()},n.prototype.getTargetGroupForNode=function(e){var t=this.lf.getNodeModelById(e.id),n=null==t?void 0:t.getBounds();if(t&&n){var i=this.getGroupByBounds(n,e);if(i&&(!t.isGroup||i.id!==e.id)&&i.isAllowAppendIn(e))return i}},n.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},n.prototype.initGroupChildNodes=function(e,n,i,r){var o=this,a=[],s=[],l=[];_u(Array.from(n),(function(n){var u=o.lf.getNodeModelById(n);if(u){var d=u.children,c=u.getData(),h=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",p=t.transformNodeData(o.removeChildrenInGroupNodeData(c),r),f=o.lf.addNode(p,h);if(i.addChild(f.id),e[n]=f.id,a.push(f),l.push.apply(l,_([],N(_(_([],N(f.incoming.edges),!1),N(f.outgoing.edges),!1)),!1)),d instanceof Set){var g=o.initGroupChildNodes(e,d,f,r),v=g.childNodes,m=g.edgesData;a.push.apply(a,_([],N(v),!1)),s.push.apply(s,_([],N(m),!1))}}}));var u=id(Vu(l,(function(t){return bd(e,t.sourceNodeId)&&bd(e,t.targetNodeId)})),(function(e){return e.getData()}));return{childNodes:a,edgesData:s.concat(u)}},n.prototype.createEdge=function(e,n,i){var r,o,a=e.sourceNodeId,s=e.targetNodeId,l=null!==(r=n[a])&&void 0!==r?r:a,u=null!==(o=n[s])&&void 0!==o?o:s,d=Fs(e);return e.id&&"object"==typeof e.text&&null!==e.text&&(d=t.transformEdgeData(e,i)),this.lf.graphModel.addEdge(y(y({},d),{sourceNodeId:l,targetNodeId:u}))},n.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,r){var o=this,a=Py(e,(function(e){return o.lf.getNodeModelById(e)}));if(!a)return!0;var s=e.x+t/2,l=e.y+n/2;return Iy({minX:s-i/2,minY:l-r/2,maxX:s+i/2,maxY:l+r/2},a)},n.prototype.init=function(){var n=this,r=this.lf,o=r.graphModel;o.addNodeMoveRules((function(e,t,i){if(e.isGroup)return!0;var r=n.nodeGroupMap.get(e.id),o=n.lf.getNodeModelById(r);return!o||!o.isRestrict||(!!o.autoResize||function(e,t,n,i){var r=e.minX,o=e.minY,a=e.maxX,s=e.maxY,l=t.x,u=t.y,d=t.width,c=t.height;return{x:l+n>=r+d/2&&l+n<=a-d/2,y:u+i>=o+c/2&&u+i<=s-c/2}}(o.getBounds(),e,t,i))})),o.addNodeResizeRules((function(e,t,i,r,o){return!e.isGroup||n.checkGroupBoundsWithChildren(e,t,i,r,o)})),o.dynamicGroup=this,this.originDeleteNode=r.deleteNode.bind(r),r.deleteNode=function(e){var t=r.getNodeModelById(e);if(!n.cascadeDeleteChildren&&(null==t?void 0:t.isGroup)){var i=t;i.children.size>0&&n.releaseGroupMembers(i)}return n.originDeleteNode(e)},r.on(t.EventType.NODE_ADD,this.onNodeAdd),r.on(t.EventType.NODE_DND_ADD,this.onNodeDndAdd),r.on(t.EventType.NODE_DROP,this.onNodeDrop),r.on(t.EventType.NODE_MOUSEUP,this.onNodeMouseUp),r.on(t.EventType.SELECTION_DROP,this.onSelectionDrop),r.on(t.EventType.NODE_DELETE,this.removeNodeFromGroup),r.on(t.EventType.EDGE_DELETE,this.onEdgeDelete),r.on(i,this.onNodeDrag),r.on(t.EventType.SELECTION_DRAG,this.onSelectionDrag),r.on(t.EventType.NODE_CLICK,this.onNodeSelect),r.on(t.EventType.NODE_MOUSEMOVE,this.onNodeMove),r.on(t.EventType.NODE_RESIZE,this.onNodeResize),r.on(t.EventType.GRAPH_RENDERED,this.onGraphRendered),r.on(e.ExtensionEventType.GROUP_ADD_NODE,this.onGroupAddNode),r.addElements=function(e,t){var i=e.nodes,o=e.edges;void 0===t&&(t=40);var a={},s={nodes:[],edges:[]},l=[];return _u(i,(function(e){var i,o,u=e.id,d=null!==(o=null===(i=e.properties)||void 0===i?void 0:i.children)&&void 0!==o?o:e.children,c=r.addNode(n.removeChildrenInGroupNodeData(e));if(u&&(a[u]=c.id),s.nodes.push(c),c.isGroup){var h=n.initGroupChildNodes(a,d,c,t).edgesData;l.push.apply(l,_([],N(h),!1))}})),_u(l,(function(e){n.createEdge(e,a,t)})),_u(o,(function(e){s.edges.push(n.createEdge(e,a,t))})),s},this.render()},n.prototype.render=function(){},n.prototype.destroy=function(){this.lf.off(t.EventType.NODE_ADD,this.onNodeAdd),this.lf.off(t.EventType.NODE_DND_ADD,this.onNodeDndAdd),this.lf.off(t.EventType.NODE_DROP,this.onNodeDrop),this.lf.off(t.EventType.NODE_MOUSEUP,this.onNodeMouseUp),this.lf.off(t.EventType.SELECTION_DROP,this.onSelectionDrop),this.lf.off(t.EventType.NODE_DELETE,this.removeNodeFromGroup),this.lf.off(t.EventType.EDGE_DELETE,this.onEdgeDelete),this.lf.off(i,this.onNodeDrag),this.lf.off(t.EventType.SELECTION_DRAG,this.onSelectionDrag),this.lf.off(t.EventType.NODE_CLICK,this.onNodeSelect),this.lf.off(t.EventType.NODE_MOUSEMOVE,this.onNodeMove),this.lf.off(t.EventType.NODE_RESIZE,this.onNodeResize),this.lf.off(t.EventType.GRAPH_RENDERED,this.onGraphRendered),this.lf.off(e.ExtensionEventType.GROUP_ADD_NODE,this.onGroupAddNode),this.originDeleteNode&&(this.lf.deleteNode=this.originDeleteNode)},n.pluginName="dynamicGroup",n}(),lb=function(e){function t(){var t=e.apply(this,_([],N(arguments),!1))||this;return t.isLane=!0,t.defaultZIndex=-1,t}return m(t,e),t.prototype.initNodeData=function(t){var n;e.prototype.initNodeData.call(this,t),this.width=t.width||Xy,this.height=t.height||qy,this.draggable=!0,this.resizable=!0,this.rotatable=!1,this.defaultZIndex=t.zIndex||-1,this.setZIndex(this.defaultZIndex),this.autoToFront=!0,this.text.editable=!0,this.style.stroke="#000",this.style.strokeWidth=1,this.properties=y(y({},this.properties),{processRef:"",panels:["processRef"],direction:(null===(n=t.properties)||void 0===n?void 0:n.direction)||"vertical"}),this.collapsedWidth=this.width,this.collapsedHeight=this.height,this.expandWidth=this.width,this.expandHeight=this.height},t.prototype.setAttributes=function(){e.prototype.setAttributes.call(this),this.updateTextPosition()},t.prototype.setZIndex=function(e){this.zIndex=Math.min(e,this.defaultZIndex)||this.defaultZIndex},t.prototype.toggleCollapse=function(){this.isCollapsed=!1,this.setProperties({isCollapsed:!1})},t.prototype.getPoolId=function(){var e=this;try{if(!this.graphModel)return null;var t=this.graphModel.nodes.find((function(t){return t.children&&t.children.has(e.id)}));return(null==t?void 0:t.id)||null}catch(e){return null}},t.prototype.getPoolModel=function(){try{var e=this.getPoolId();return e&&(this.graphModel&&this.graphModel.getNodeModelById(e))||null}catch(e){return null}},t.prototype.changeAttribute=function(e){var t=e.width,n=e.height,i=e.x,r=e.y;t&&(this.width=t),n&&(this.height=n),i&&(this.x=i),r&&(this.y=r)},t.prototype.getData=function(){var t=e.prototype.getData.call(this);return y(y({},t),{properties:y(y({},t.properties),{width:this.width,height:this.height,processRef:this.properties.processRef,direction:this.properties.direction})})},t.prototype.isAllowAppendIn=function(e){return"lane"!==String(e.type)},t.prototype.getNodesInGroup=function(e){var t=this,n=[],i=e.properties.parent;return e.isDragging&&i&&n.push(i),_u(Array.from(e.children),(function(e){var i=t.graphModel.getNodeModelById(e);i&&!i.isDragging&&"lane"!==String(i.type)&&n.push(e)})),n},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.strokeWidth=2,t},t.prototype.getTextStyle=function(){var t=this.properties.isHorizontal,n=void 0!==t&&t,i=e.prototype.getTextStyle.call(this);return i.overflowMode="ellipsis",i.strokeWidth=2,i.textWidth=n?this.height:this.width,i.textHeight=n?this.width:this.height,n&&(i.transform="rotate(-90deg)",i.textAlign="center"),i},t.prototype.getSubNodes=function(){var e=this,t=[];return Array.from(this.children).forEach((function(n){var i=e.graphModel.getNodeModelById(n);i&&t.push(i)})),t},t.prototype.updateTextPosition=function(){this.properties.isHorizontal?(this.text.x=this.x-this.width/2+Ky/2,this.text.y=this.y):(this.text.x=this.x,this.text.y=this.y-this.height/2+Ky/2)},t}(Gy),ub=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getAppendAreaShape=function(){var e=this.props.model,n=e.width,i=e.height,r=e.x,o=e.y,a=e.radius;if(!e.groupAddable)return null;var s=e.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=e.getAddableOutlineStyle(),d=n+l+8,c=i+l+8;return t.h("rect",y(y({},u),{width:d,height:c,x:r-d/2,y:o-c/2,rx:a,ry:a}))},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.properties,s=a.textStyle,l=void 0===s?{}:s,u=a.isHorizontal,d=e.getNodeStyle(),c=n-r/2,h=i-o/2,p=y({x:n-r/2,y:i-o/2,width:r,height:o,stroke:"#000000",strokeWidth:2,fill:"transparent"},d),f=this.getOperateIcons(),g=y(y(y(y({},{fill:"#ffffff",stroke:"#000000",strokeWidth:1}),d),{x:u?c+Ky:c,y:u?h:h+Ky,width:u?r-Ky:r,height:u?o:Ky}),u?l:{});return t.h("g",{},_([this.getAppendAreaShape(),t.h("rect",g),t.h("rect",y({},p))],N(f),!1))},n.prototype.getOperateIcons=function(){var e=this.props.model;if(!e.isSelected)return[];var t=e.getPoolModel();if(!t)return[];var n=t.isHorizontal,i=e.getData();return[this.addBeforeLaneIcon(n,(function(){var e,r;return n?null===(e=t.addChildAbove)||void 0===e?void 0:e.call(t,i):null===(r=t.addChildRight)||void 0===r?void 0:r.call(t,i)})),this.addAfterLaneIcon(n,(function(){var e,r;return n?null===(e=t.addChildBelow)||void 0===e?void 0:e.call(t,i):null===(r=t.addChildLeft)||void 0===r?void 0:r.call(t,i)})),this.deleteLaneIcon((function(){var e;return null===(e=t.deleteChild)||void 0===e?void 0:e.call(t,i.id)}))]},n.prototype.addBeforeLaneIcon=function(e,n){var i=this.props.model,r=i.x,o=i.y,a=i.width,s=i.height,l=r+a/2+Qy,u=o-s/2,d={width:Yy/2,height:Yy,strokeWidth:1,fill:"#fff",stroke:"#000",x:l,y:u},c=[t.h("rect",y(y({},d),{x:l+Yy/2,strokeDasharray:"2 2"})),t.h("rect",d)];return e&&(c=[t.h("rect",y(y({},d),{width:Yy,height:Yy/2,strokeDasharray:"2 2"})),t.h("rect",y(y({},d),{width:Yy,height:Yy/2,y:u+Yy/2}))]),t.h("g",{cursor:"pointer",onClick:n},c)},n.prototype.addAfterLaneIcon=function(e,n){var i=this.props.model,r=i.x,o=i.y,a=i.width,s=i.height,l=r+a/2+Qy,u=o-s/2+Yy+Qy,d={width:Yy/2,height:Yy,strokeWidth:1,fill:"#fff",stroke:"#000",x:l,y:u},c=[t.h("rect",y(y({},d),{x:l+Yy/2})),t.h("rect",y(y({},d),{strokeDasharray:"2 2"}))];return e&&(c=[t.h("rect",y(y({},d),{width:Yy,height:Yy/2})),t.h("rect",y(y({},d),{width:Yy,height:Yy/2,y:u+Yy/2,strokeDasharray:"2 2"}))]),t.h("g",{cursor:"pointer",onClick:n},c)},n.prototype.deleteLaneIcon=function(e){var n=this.props.model,i=n.x,r=n.y,o=n.width,a=n.height,s=i+o/2+Qy,l=r-a/2+3*(Yy+Qy);return t.h("g",{cursor:"pointer",onClick:e,width:Yy,height:Yy,transform:"translate(".concat(s,", ").concat(l,")")},[t.h("rect",{width:Yy,height:Yy,fill:"transparent"}),t.h("path",{transform:"translate(2, 1) scale(".concat(Yy/18,")"),fill:"#000",d:"M1.6361705,0.07275847000000002L1.6362224,0.07267305000000002L5.1435161,2.2034403L6.3516493,1.28341734Q7.2009554,0.63665058,8.0902505,1.22722644L10.1215935,2.5762291Q11.006711,3.1640306,10.745867,4.1940317L10.4062386,5.5351257L13.625054,7.5778356L13.625001,7.5779204Q13.678322,7.6117587,13.721552,7.6577945Q13.764784,7.7038307,13.795207,7.7591715Q13.82563,7.8145118,13.841336,7.87568Q13.857041,7.9368477,13.857041,8Q13.85704,8.0492353,13.847435,8.0975251Q13.83783,8.145814900000001,13.818987,8.191302799999999Q13.800144,8.2367907,13.772791,8.2777286Q13.745438,8.318666499999999,13.710623,8.3534818Q13.675808,8.3882966,13.63487,8.4156504Q13.593931,8.4430046,13.548444,8.461846399999999Q13.502956,8.4806881,13.454666,8.4902935Q13.406377,8.4998994,13.357141,8.499899899999999Q13.211908,8.499899899999999,13.089283,8.4220805L13.08923,8.4221654L4.9074116,3.229857L1.1170242400000001,0.92732695L1.1170761599999999,0.92724147Q1.06204063,0.8938076500000001,1.0172748,0.84751782Q0.97250897,0.80122799,0.9409355500000001,0.74510445Q0.9093622,0.68898091,0.89304277,0.626688Q0.87672335,0.564395107,0.87672332,0.5Q0.8767232899999999,0.450764146,0.88632876,0.402474351Q0.8959341599999999,0.35418455,0.91477591,0.30869657Q0.93361765,0.26320857,0.9609716500000001,0.22227046Q0.9883256,0.18133234999999998,1.02314061,0.14651734Q1.05795562,0.11170232000000002,1.0988937,0.08434838Q1.13983184,0.056994409999999995,1.18531984,0.038152660000000005Q1.2308077800000001,0.019310890000000025,1.27909762,0.009705450000000004Q1.32738745,0.00010001999999997846,1.3766233300000001,0.00009998999999999425Q1.516567,0.00009998999999999425,1.6361705,0.07275847000000002ZM9.5175018,4.9711194L9.7764683,3.9485345Q9.8634167,3.6052005,9.5683784,3.4092672L7.537035,2.0602646Q7.240603,1.8634058,6.9575009,2.0789949L6.0496349,2.7703574L9.5175018,4.9711194ZM11.227273,14.5L11.227273,9.7307692L11.227173,9.7307692Q11.227173,9.6815329,11.217567,9.6332426Q11.207962,9.5849533,11.189119,9.539465Q11.170278,9.4939766,11.142924,9.4530392Q11.11557,9.4121017,11.080755,9.3772869Q11.04594,9.3424721,11.005002,9.3151178Q10.964064,9.2877636,10.918575,9.2689209Q10.873087,9.2500801,10.824797,9.2404747Q10.776508,9.2308693,10.727273,9.2308693Q10.678036,9.2308693,10.629745,9.2404747Q10.581455,9.2500801,10.535968,9.2689209Q10.4904804,9.2877636,10.449542,9.3151178Q10.4086046,9.3424721,10.3737898,9.377286Q10.338975,9.4121008,10.3116207,9.4530382Q10.2842674,9.4939766,10.2654257,9.539465Q10.2465839,9.5849533,10.2369785,9.6332426Q10.2273731,9.6815329,10.2273731,9.7307692L10.2272739,9.7307692L10.2272739,14.5Q10.2272739,15,9.727273,15L7.7207794,15L7.7207789,8.2500091L7.7206788,8.2500091Q7.7206783,8.2007728,7.7110729,8.152483Q7.7014675,8.104193200000001,7.6826253,8.0587053Q7.6637836,8.013217000000001,7.6364298,7.9722791Q7.6090755,7.9313412,7.5742612,7.8965263Q7.5394459,7.861711,7.4985075,7.8343568Q7.4575696,7.807003,7.4120817,7.7881613Q7.3665934,7.7693195,7.3183041,7.7597141Q7.2700143,7.7501092,7.2207789,7.7501092Q7.1715426,7.7501092,7.1232524,7.7597141Q7.0749626,7.7693195,7.0294747,7.7881613Q6.9839869,7.807003,6.943049,7.8343573Q6.9021111,7.861711,6.8672962,7.8965263Q6.8324809,7.9313412,6.8051271,7.9722791Q6.7777729,8.013217000000001,6.7589312,8.0587053Q6.7400894,8.1041937,6.7304845,8.1524839Q6.7208786,8.2007732,6.7208791,8.2500095L6.7207789,8.2500091L6.7207794,15L4.2142854,15L4.2142854,6.2692308L4.2141855,6.2692308Q4.2141852,6.2199945,4.204579799999999,6.1717048Q4.1949743999999995,6.123415,4.1761324,6.0779266Q4.1572905,6.0324383,4.1299367,5.9915004Q4.1025827,5.9505625,4.0677679,5.9157476Q4.0329528,5.8809328,3.9920146,5.8535786Q3.9510765,5.8262248,3.9055884,5.8073831Q3.8601003,5.7885418,3.811811,5.7789364Q3.7635212,5.769331,3.7142854,5.769331Q3.6650493,5.769331,3.6167595,5.7789364Q3.5684695,5.7885418,3.5229816,5.8073831Q3.4774938,5.8262248,3.4365554,5.8535786Q3.3956175,5.8809328,3.3608027,5.9157476Q3.3259873,5.9505625,3.2986333,5.9915004Q3.2712793,6.0324383,3.2524376,6.0779266Q3.2335958,6.123415,3.2239904,6.1717048Q3.214385,6.2199945,3.2143853,6.2692308L3.2142854,6.2692308L3.2142854,15L1.5000002,15Q1.0000001200000002,15,1.0000001200000002,14.5L1,5.4150848Q1,5.0384622,1.3766233300000001,5.0384622L1.3766233300000001,5.0383615Q1.42585915,5.0383615,1.47414887,5.0287557Q1.5224386,5.0191503,1.5679266,5.0003085Q1.6134146,4.9814663,1.6543528,4.954113Q1.695291,4.9267588,1.730106,4.8919439Q1.7649209,4.8571291,1.792275,4.8161907Q1.8196288,4.7752523,1.8384706,4.7297645Q1.8573124,4.6842766,1.8669178,4.6359868Q1.8765233,4.587697,1.8765234,4.5384617Q1.8765233,4.4892254000000005,1.8669178,4.4409355999999995Q1.8573124,4.3926458,1.8384707,4.3471577Q1.819629,4.3016696,1.792275,4.2607315Q1.7649209,4.2197936,1.730106,4.1849787Q1.695291,4.1501637,1.6543529,4.1228096Q1.6134148,4.0954556,1.5679268,4.0766139Q1.5224388,4.0577724,1.4741489300000001,4.048166999999999Q1.42585915,4.0385615999999995,1.3766233300000001,4.0385615999999995L1.3766233300000001,4.0384617Q0.8064074800000001,4.0384617,0.403203636,4.4416654Q0,4.8448691,0,5.4150848L9.000000000813912e-8,14.5Q2.9999999984209325e-8,15.121321,0.439339694,15.56066Q0.8786805,16.000002000000002,1.5000002,16.000002000000002L9.727273,16.000002000000002Q10.3485928,16.000002000000002,10.787933,15.56066Q11.227273,15.121321,11.227273,14.5Z"})])},n}(ib);var db,cb={type:"pool",view:rb,model:Zy},hb={type:"lane",view:ub,model:lb},pb=function(){function n(e){var t=e.lf,n=e.options,i=this;this.activeGroups=new Set,this.nodeLaneMap=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.nodeLaneMap.get(e.id);t&&((a=i.lf.getNodeModelById(t)).removeChild(e.id),i.nodeLaneMap.delete(e.id),a.setAllowAppendChild(!1));var n=i.lf.getNodeModelById(e.id),r=null==n?void 0:n.getBounds();if(n&&r){if(n.isGroup){var o=n;_u(Array.from(o.children),(function(t){i.nodeLaneMap.set(t,e.id)}))}var a;if(a=i.getLaneByBounds(r,e))if(a.isAllowAppendIn(e)){a.addChild(e.id),a.setAllowAppendChild(!1);var s=i.lf.getNodeModelById(e.id);null==s||s.setProperties(y(y({},s.properties),{parent:a.id}))}else i.lf.emit("lane:not-allowed",{lane:a.getData(),node:e})}},this.onGroupAddNode=function(e){var t=e.data,n=e.childId;i.nodeLaneMap.set(n,t.id)},this.removeNodeFromGroup=function(e){var t=e.data;e.model.isGroup&&t.children&&_u(Array.from(t.children),(function(e){i.nodeLaneMap.delete(e),i.lf.deleteNode(e)}));var n=i.nodeLaneMap.get(t.id);if(n){var r=i.lf.getNodeModelById(n);r&&r.removeChild(t.id),i.nodeLaneMap.delete(t.id);var o=i.lf.getNodeModelById(t.id),a=y(y({},null==o?void 0:o.properties),{parent:void 0,relativeDistanceX:void 0,relativeDistanceY:void 0});null==o||o.setProperties(a)}},this.onSelectionDrag=function(){var e=i.lf.graphModel.getSelectElements().nodes,t=new Set;e.forEach((function(e){var n=i.getTargetLaneForNode(e);n&&t.add(n)})),i.activeGroups.forEach((function(e){t.has(e)||e.setAllowAppendChild(!1)})),t.forEach((function(e){i.activeGroups.has(e)||e.setAllowAppendChild(!0)})),i.activeGroups=t},this.onNodeDrag=function(e){var t=e.data;i.setActiveGroup(t)},this.setActiveGroup=function(e){var t=i.getTargetLaneForNode(e),n=new Set;t&&n.add(t),i.activeGroups.forEach((function(e){n.has(e)||e.setAllowAppendChild(!1)})),n.forEach((function(e){i.activeGroups.has(e)||e.setAllowAppendChild(!0)})),i.activeGroups=n},this.onNodeDrop=function(){i.clearDragTargetHighlight()},this.onNodeMouseUp=function(){i.clearDragTargetHighlight()},this.onNodeSelect=function(e){var t=e.data,n=e.isMultiple,r=e.isSelected,o=i.lf.getNodeModelById(t.id);if(n&&r)if(null==o?void 0:o.isGroup){var a=o.children;_u(Array.from(a),(function(e){var t=i.lf.getNodeModelById(e);null==t||t.setSelected(!1)}))}else{var s=i.nodeLaneMap.get(t.id);if(s){var l=i.lf.getNodeModelById(s);(null==l?void 0:l.isSelected)&&(null==o||o.setSelected(!1))}}},this.onNodeMove=function(e){var t=e.data.id,n=i.nodeLaneMap.get(t);if(n){var r=i.lf.getNodeModelById(n);if(r&&r.isRestrict&&r.autoResize){var o=i.lf.getNodeModelById(t);if(o){var a=o.getBounds(),s=a.minX,l=a.minY,u=a.maxX,d=a.maxY,c=!1,h=r.getBounds(),p=Object.assign({},h);if(s<p.minX&&(p.minX=s,c=!0),l<p.minY&&(p.minY=l,c=!0),u>p.maxX&&(p.maxX=u,c=!0),d>p.maxY&&(p.maxY=d,c=!0),c){var f=p.minX+(p.maxX-p.minX)/2,g=p.minY+(p.maxY-p.minY)/2,v=p.maxX-p.minX,m=p.maxY-p.minY;r.moveTo(f,g),r.width=v,r.height=m,r.updateExpandedSize(v,m),r.setTextPosition()}}}}},this.onGraphRendered=function(e){_u(e.data.nodes,(function(e){e.children&&_u(e.children,(function(t){i.nodeLaneMap.set(t,e.id)}))}))},t.register(cb),t.register(hb),this.lf=t,hr(this,n),this.init()}return n.prototype.getLaneByNodeId=function(e){var t=this.nodeLaneMap.get(e);if(t)return this.lf.getNodeModelById(t)},n.prototype.getLaneByBounds=function(e,t){var n=Vu(this.lf.graphModel.nodes,(function(n){return!!n.isGroup&&function(e,t){var n=e.minX,i=e.minY,r=e.maxX,o=e.maxY,a=t.x,s=t.y,l=t.width,u=t.height;return n>=a-l/2&&r<=a+l/2&&i>=s-u/2&&o<=s+u/2}(e,n)&&n.id!==t.id})),i=n.length;if(i<=1)return n[0];for(var r=n[i-1],o=i-2;o>=0;o--)n[o].zIndex>r.zIndex&&(r=n[o]);return r},n.prototype.getTargetLaneForNode=function(e){var t=this.lf.getNodeModelById(e.id),n=null==t?void 0:t.getBounds();if(t&&n){var i=this.getLaneByBounds(n,e);if(i&&(!t.isGroup||i.id!==e.id)&&i.isAllowAppendIn(e))return i}},n.prototype.clearDragTargetHighlight=function(){this.activeGroups.forEach((function(e){e.setAllowAppendChild(!1)})),this.activeGroups.clear()},n.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},n.prototype.initGroupChildNodes=function(e,n,i,r){var o=this,a=[],s=[],l=[];_u(Array.from(n),(function(n){var u=o.lf.getNodeModelById(n);if(u){var d=u.children,c=u.getData(),h=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",p=t.transformNodeData(o.removeChildrenInGroupNodeData(c),r),f=o.lf.addNode(p,h);if(i.addChild(f.id),e[n]=f.id,a.push(f),l.push.apply(l,_([],N(_(_([],N(f.incoming.edges),!1),N(f.outgoing.edges),!1)),!1)),d instanceof Set){var g=o.initGroupChildNodes(e,d,f,r),v=g.childNodes,m=g.edgesData;a.push.apply(a,_([],N(v),!1)),s.push.apply(s,_([],N(m),!1))}}}));var u=id(Vu(l,(function(t){return bd(e,t.sourceNodeId)&&bd(e,t.targetNodeId)})),(function(e){return e.getData()}));return{childNodes:a,edgesData:s.concat(u)}},n.prototype.createEdge=function(e,n,i){var r,o,a=e.sourceNodeId,s=e.targetNodeId,l=null!==(r=n[a])&&void 0!==r?r:a,u=null!==(o=n[s])&&void 0!==o?o:s,d=Fs(e);return e.id&&"object"==typeof e.text&&null!==e.text&&(d=t.transformEdgeData(e,i)),this.lf.graphModel.addEdge(y(y({},d),{sourceNodeId:l,targetNodeId:u}))},n.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,r){var o=this,a=Py(e,(function(e){return o.lf.getNodeModelById(e)}));if(!a)return!0;var s=e.x+t/2,l=e.y+n/2;return Iy({minX:s-i/2,minY:l-r/2,maxX:s+i/2,maxY:l+r/2},a)},n.prototype.init=function(){var n=this,o=this.lf,a=o.graphModel;a.addNodeMoveRules((function(e,t,i){if(e.isGroup)return!0;var r=n.nodeLaneMap.get(e.id),o=n.lf.getNodeModelById(r);return!o||!o.isRestrict||(!!o.autoResize||function(e,t,n,i){var r=e.minX,o=e.minY,a=e.maxX,s=e.maxY,l=t.x,u=t.y,d=t.width,c=t.height;return{x:l+n>=r+d/2&&l+n<=a-d/2,y:u+i>=o+c/2&&u+i<=s-c/2}}(o.getBounds(),e,t,i))})),a.addNodeResizeRules((function(e,t,i,r,o){return!e.isGroup||n.checkGroupBoundsWithChildren(e,t,i,r,o)})),a.dynamicGroup=this,o.on(r,this.onNodeAddOrDrop),o.on(t.EventType.SELECTION_DROP,this.onSelectionDrop),o.on(t.EventType.NODE_DELETE,this.removeNodeFromGroup),o.on(i,this.onNodeDrag),o.on(t.EventType.SELECTION_DRAG,this.onSelectionDrag),o.on(t.EventType.NODE_DROP,this.onNodeDrop),o.on(t.EventType.NODE_MOUSEUP,this.onNodeMouseUp),o.on(t.EventType.NODE_CLICK,this.onNodeSelect),o.on(t.EventType.NODE_MOUSEMOVE,this.onNodeMove),o.on(t.EventType.GRAPH_RENDERED,this.onGraphRendered),o.on(e.ExtensionEventType.GROUP_ADD_NODE,this.onGroupAddNode),o.addElements=function(e,t){var i=e.nodes,r=e.edges;void 0===t&&(t=40);var a={},s={nodes:[],edges:[]},l=[];return _u(i,(function(e){var i,r,u=e.id,d=null!==(r=null===(i=e.properties)||void 0===i?void 0:i.children)&&void 0!==r?r:e.children,c=o.addNode(n.removeChildrenInGroupNodeData(e));if(u&&(a[u]=c.id),s.nodes.push(c),c.isGroup){var h=n.initGroupChildNodes(a,d,c,t).edgesData;l.push.apply(l,_([],N(h),!1))}})),_u(l,(function(e){n.createEdge(e,a,t)})),_u(r,(function(e){s.edges.push(n.createEdge(e,a,t))})),s},this.render()},n.prototype.render=function(){},n.prototype.destroy=function(){this.lf.off(r,this.onNodeAddOrDrop),this.lf.off(t.EventType.SELECTION_DROP,this.onSelectionDrop),this.lf.off(t.EventType.NODE_DELETE,this.removeNodeFromGroup),this.lf.off(i,this.onNodeDrag),this.lf.off(t.EventType.SELECTION_DRAG,this.onSelectionDrag),this.lf.off(t.EventType.NODE_DROP,this.onNodeDrop),this.lf.off(t.EventType.NODE_MOUSEUP,this.onNodeMouseUp),this.lf.off(t.EventType.NODE_CLICK,this.onNodeSelect),this.lf.off(t.EventType.NODE_MOUSEMOVE,this.onNodeMove),this.lf.off(t.EventType.GRAPH_RENDERED,this.onGraphRendered),this.lf.off(e.ExtensionEventType.GROUP_ADD_NODE,this.onGroupAddNode)},n.pluginName="PoolElements",n}();!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(db||(db={}));var fb=function(e,t,n,i){return void 0===i&&(i=0),mb(e,t,n)<=i};function gb(e){return e*e}function vb(e,t){return gb(e.x-t.x)+gb(e.y-t.y)}var mb=function(e,t,n){return Math.sqrt(function(e,t,n){var i=vb(t,n);if(0===i)return vb(e,t);var r=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/i;return r=Math.max(0,Math.min(1,r)),vb(e,{x:t.x+r*(n.x-t.x),y:t.y+r*(n.y-t.y)})}(e,t,n))},yb=function(e,t,n){var i=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return{minX:t-i/2,minY:n-r/2,maxX:t+i/2,maxY:n+r/2,x:t,y:n,width:i,height:r,centerX:t,centerY:n}}(e),r=function(e,t){var n;return e.x===t.x?n=db.VERTICAL:e.y===t.y&&(n=db.HORIZONTAL),n}(t,n),o=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,d=e.y,c=e.width,h=e.height;if(r===db.HORIZONTAL){if(o>=i.maxX&&a<=i.minX)return{startCrossPoint:{x:t.x>n.x?u+c/2:u-c/2,y:t.y},endCrossPoint:{x:t.x>n.x?u-c/2:u+c/2,y:t.y}}}else if(r===db.VERTICAL&&s>=i.maxY&&l<=i.minY)return{startCrossPoint:{x:t.x,y:t.y>n.y?d+h/2:d-h/2},endCrossPoint:{x:t.x,y:t.y>n.y?d-h/2:d+h/2}}},bb=function(e,t,n){void 0===n&&(n=0);for(var i=e.x,r=e.y,o=t.pointsList,a=0;a<o.length-1;a++)if(fb({x:i,y:r},o[a],o[a+1],n)){var s=yb(e,o[a],o[a+1]);if(s)return{crossIndex:a+1,crossPoints:s}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},xb=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,r=n.id,o=!0,a=0;a<i.length;a++)if(i[a].sourceNodeId===r||i[a].targetNodeId===r){o=!1;break}o&&e.insetNode(n)}))},e.prototype.checkRuleBeforeInsetNode=function(e,n,i,r,o){var a=this._lf.getNodeModelById(e),s=this._lf.getNodeModelById(n),l=a.getAnchorInfo(i),u=s.getAnchorInfo(r),d=a.isAllowConnectedAsSource(o,l,u),c=s.isAllowConnectedAsTarget(o,l,u),h=t.formatAnchorConnectValidateData(d),p=h.isAllPass,f=h.msg,g=t.formatAnchorConnectValidateData(c),v=g.isAllPass;return{isPass:p&&v,sourceMsg:f,targetMsg:g.msg}},e.prototype.insetNode=function(e){var n=this,i=this._lf.graphModel.edges,r=this._lf.getNodeModelById(e.id),o=null==r?void 0:r.getDefaultAnchor();if(!o||0===o.length)this._lf.graphModel.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:e,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(r)for(var a=0;a<i.length;a++){var s=bb(r,i[a],this.deviation),l=s.crossIndex,u=s.crossPoints;if(l>=0){var d=i[a],c=d.sourceNodeId,h=d.targetNodeId,p=d.id,f=d.type,g=d.pointsList,v=d.sourceAnchorId,m=d.targetAnchorId,y=Fs(g[0]);this._lf.deleteEdge(p);var b=this.checkRuleBeforeInsetNode(c,h,v,m,e),x=t.getClosestAnchor(u.startCrossPoint,r).anchor;this._lf.addEdge({type:f,sourceNodeId:c,targetNodeId:e.id,startPoint:y,endPoint:x});var E=t.getClosestAnchor(u.endCrossPoint,r).anchor;if(this._lf.addEdge({type:f,sourceNodeId:e.id,targetNodeId:h,startPoint:Fs(E),endPoint:Fs(g[g.length-1])}),b.isPass)break;this._lf.graphModel.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:e,msg:b.targetMsg||b.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},e.pluginName="insertNodeInPolyline",e}(),Eb=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,r=n.label,o=n.graphModel.editConfigModel.nodeTextDraggable;!(null!==(t=r.draggable)&&void 0!==t?t:o)||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 r=i.props,o=r.label,a=r.graphModel,s=N(a.transformModel.fixDeltaXY(t,n),2),l=s[0],u=s[1];i.setElementModelLabelInfo({x:o.x+l,y:o.y+u}),a.eventCenter.emit("label:drag",{data:o.getData(),model:o})},i.handleDragEnd=function(){i.setState({isDragging:!1})},i.handleClick=function(e){var t=i.props,n=t.label,r=t.element,o=t.graphModel;r.setSelected(!i.state.isSelected),i.setState({isSelected:!i.state.isSelected}),i.setElementModelLabelInfo({isSelected:!0}),o.eventCenter.emit("label:click",{data:n.getData(),e:e,model:r})},i.handleDbClick=function(e){var n=i.props,r=n.label,o=n.element;if(n.graphModel.eventCenter.emit("label:dblclick",{data:r.getData(),e:e,model:o}),r.editable){if(o.setSelected(),o.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 o.setSelected(!0)},i.handleBlur=function(e){var t=i.props,n=t.label,r=t.element;t.graphModel.eventCenter.emit("label:blur",{e:e,model:r,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 r=n.label,o=n.graphModel,a=o.gridSize,s=o.eventCenter;return i.stepDrag=new t.StepDrag({onDragging:i.handleDragging,onDragEnd:i.handleDragEnd,step:a,eventType:"LABEL",model:r,eventCenter:s}),i.state={isEditing:!1,isHovered:!1,isDragging:!1,isSelected:!1},i}return m(n,e),n.prototype.setElementModelLabelInfo=function(e){var t=this.props,n=t.label,i=t.element,r=t.graphModel,o=i.properties._label,a=Ku(o,(function(e){return e.id===n.id})),s=o[a];o[a]=y(y({},s),e);var l=r.getElement(i.id);null==l||l.setProperty("_label",o)},n.prototype.componentDidMount=function(){var e=this,n=this.props,i=n.label,r=n.element;n.graphModel.eventCenter.on("blank:click,node:click,edge:click,label:click",(function(n){var o,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 d=null!==(a=null===(o=e.textRef.current)||void 0===o?void 0:o.innerText)&&void 0!==a?a:"",c=null!==(l=null===(s=e.textRef.current)||void 0===s?void 0:s.innerHTML)&&void 0!==l?l:"";e.setElementModelLabelInfo({value:d,content:c,isSelected:!1}),r.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,r=t.graphModel,o=this.state,a=o.isDragging,s=o.isHovered,l=o.isSelected,u=o.isEditing,d=r.transformModel.getTransformStyle().transform,c=n.id,h=n.x,p=n.y,f=n.zIndex,g=n.vertical,v=n.style,m=n.rotate,b=n.content,x=n.labelWidth,E=n.textOverflowMode,w=null!=x?x:"node"===i.BaseType?i.width-20:80,C={left:"".concat(h-w/2,"px"),top:"".concat(p-10,"px"),width:"".concat(w,"px"),height:"20px",zIndex:null!=f?f:1,transform:m?"".concat(d," rotate(").concat(m,"deg)"):"".concat(d," rotate(").concat(g?-.25:0,"turn)")};return Bf("div",{id:"element-container-".concat(c),className:eb("lf-label-editor-container"),style:C,onPointerDown:this.handleMouseDown,onPointerUp:this.handleMouseUp,onClick:this.handleClick,onDblClick:this.handleDbClick,onBlur:this.handleBlur,onMouseEnter:this.setHoverOn,onMouseOver:this.setHoverOn,onMouseLeave:this.setHoverOff,children:Bf("div",{ref:this.textRef,id:"editor-container-".concat(c),className:eb("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(E)]=!u,e)),onInput:this.handleInput,style:y({maxWidth:"".concat(w,"px"),boxSizing:"border-box",display:"inline-block",background:u||"edge"===i.BaseType?"#fff":"transparent"},v),dangerouslySetInnerHTML:{__html:b}})})},n=x([t.observer],n)}(t.Component),wb=t.LogicFlowUtil.createUuid,Cb=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:wb(),this.initLabelData(e)}return e.prototype.initLabelData=function(e){hr(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}},x([t.observable],e.prototype,"x",void 0),x([t.observable],e.prototype,"y",void 0),x([t.observable],e.prototype,"content",void 0),x([t.observable],e.prototype,"value",void 0),x([t.observable],e.prototype,"rotate",void 0),x([t.observable],e.prototype,"style",void 0),x([t.observable],e.prototype,"zIndex",void 0),x([t.observable],e.prototype,"vertical",void 0),x([t.observable],e.prototype,"editable",void 0),x([t.observable],e.prototype,"draggable",void 0),x([t.observable],e.prototype,"labelWidth",void 0),x([t.observable],e.prototype,"textOverflowMode",void 0),e}(),Nb={};!function(e){"classList"in document.createElement("_")||function(e){if("Element"in e){var t="classList",n="prototype",i=e.Element[n],r=Object,o=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=o.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],i=0,r=n.length;i<r;i++)this.push(n[i]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},d=u[n]=[],c=function(){return new u(this)};if(s[n]=Error[n],d.item=function(e){return this[e]||null},d.contains=function(e){return-1!==l(this,e+="")},d.add=function(){var e,t=arguments,n=0,i=t.length,r=!1;do{-1===l(this,e=t[n]+"")&&(this.push(e),r=!0)}while(++n<i);r&&this._updateClassName()},d.remove=function(){var e,t,n=arguments,i=0,r=n.length,o=!1;do{for(t=l(this,e=n[i]+"");-1!==t;)this.splice(t,1),o=!0,t=l(this,e)}while(++i<r);o&&this._updateClassName()},d.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},d.toString=function(){return this.join(" ")},r.defineProperty){var h={get:c,enumerable:!0,configurable:!0};try{r.defineProperty(i,t,h)}catch(e){-2146823252===e.number&&(h.enumerable=!1,r.defineProperty(i,t,h))}}else r[n].__defineGetter__&&i.__defineGetter__(t,c)}}(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},r=n.prototype,o=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,d=e.URL||e.webkitURL||e,c=d.createObjectURL,h=d.revokeObjectURL,p=d,f=e.btoa,g=e.atob,v=e.ArrayBuffer,m=e.Uint8Array,y=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(i.fake=o.fake=!0;u--;)s.prototype[l[u]]=u+1;return d.createObjectURL||(p=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}),p.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):f?t+";base64,"+f(e.data):t+","+encodeURIComponent(e.data)):c?c.call(d,e):void 0},p.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&h&&h.call(d,e)},r.append=function(e){var n=this.data;if(m&&(e instanceof v||e instanceof m)){for(var r="",o=new m(e),l=0,u=o.length;l<u;l++)r+=String.fromCharCode(o[l]);n.push(r)}else if("Blob"===t(e)||"File"===t(e)){if(!a)throw new s("NOT_READABLE_ERR");var d=new a;n.push(d.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))))},r.getBlob=function(e){return arguments.length||(e=null),new i(this.data.join(""),e,"raw")},r.toString=function(){return"[object BlobBuilder]"},o.slice=function(e,t,n){var r=arguments.length;return r<3&&(n=null),new i(this.data.slice(e,r>1?t:this.data.length),n,this.encoding)},o.toString=function(){return"[object Blob]"},o.close=function(){this.size=0,delete this.data},n}(e);e.Blob=function(e,n){var i=n&&n.type||"",r=new t;if(e)for(var o=0,a=e.length;o<a;o++)Uint8Array&&e[o]instanceof Uint8Array?r.append(e[o].buffer):r.append(e[o]);var s=r.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||$y.content||$y),function(t,n){"undefined"!=typeof process&&process&&process.versions&&process.versions.electron?t.MediumEditor=n:e.exports=n}($y,function(){function e(e,t){return this.init(e,t)}var t,n,i,r,o,a,s,l,u,d,c;return e.extensions={},function(t){function n(e,t){var n,i=Array.prototype.slice.call(arguments,2);t=t||{};for(var r=0;r<i.length;r++){var o=i[r];if(o)for(n in o)o.hasOwnProperty(n)&&void 0!==o[n]&&(e||!1===t.hasOwnProperty(n))&&(t[n]=o[n])}return t}var i=!1;try{var r=document.createElement("div"),o=document.createTextNode(" ");r.appendChild(o),i=r.contains(o)}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 r=e.createElement("a");return a.moveTextRangeIntoElement(t[0],t[t.length-1],r),r.setAttribute("href",n),i&&("_blank"===i&&r.setAttribute("rel","noopener noreferrer"),r.setAttribute("target",i)),r},findOrCreateMatchingTextNodes:function(e,t,n){for(var i=e.createTreeWalker(t,NodeFilter.SHOW_ALL,null,!1),r=[],o=0,s=!1,l=null,u=null;null!==(l=i.nextNode());)if(!(l.nodeType>3))if(3===l.nodeType){if(!s&&n.start<o+l.nodeValue.length&&(s=!0,u=a.splitStartNodeIfNeeded(l,n.start,o)),s&&a.splitEndNodeIfNeeded(l,u,n.end,o),s&&o===n.end)break;if(s&&o>n.end+1)throw new Error("PerformLinking overshot the target!");s&&r.push(u||l),o+=l.nodeValue.length,null!==u&&(o+=u.nodeValue.length,i.nextNode()),u=null}else"img"===l.tagName.toLowerCase()&&(!s&&n.start<=o&&(s=!0),s&&r.push(l));return r},splitStartNodeIfNeeded:function(e,t,n){return t!==n?e.splitText(t-n):null},splitEndNodeIfNeeded:function(e,t,n,i){var r,o;r=i+e.nodeValue.length+(t?t.nodeValue.length:0)-1,o=n-i-(t?e.nodeValue.length:0),r>=n&&i!==r&&0!==o&&(t||e).splitText(o)},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 r=0;r<t.childNodes.length;r++){var o=t.childNodes[r];if(3===o.nodeType)n.push(o);else if(1===o.nodeType){0===o.querySelectorAll(i).length?n.push(o):n=n.concat(e.util.splitByBlockElements(o))}}return n},findAdjacentTextNodeWithContent:function(e,t,n){var i,r=!1,o=n.createNodeIterator(e,NodeFilter.SHOW_TEXT,null,!1);for(i=o.nextNode();i;){if(i===t)r=!0;else if(r&&3===i.nodeType&&i.nodeValue&&i.nodeValue.trim().length>0)break;i=o.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 r=t.parentNode;null!==r;){if(r===e)return!0;r=r.parentNode}return!1},isElement:function(e){return!(!e||1!==e.nodeType)},throttle:function(e,t){var n,i,r,o=null,a=0,s=function(){a=Date.now(),o=null,r=e.apply(n,i),o||(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?(o&&(clearTimeout(o),o=null),a=l,r=e.apply(n,i),o||(n=i=null)):o||(o=setTimeout(s,u)),r}},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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},insertHTMLCommand:function(t,n){var i,r,o,s,l,u,d,c=!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(d=(r=i.getRangeAt(0)).commonAncestorContainer,a.isMediumEditorElement(d)&&!d.firstChild)r.selectNode(d.appendChild(t.createTextNode("")));else if(3===d.nodeType&&0===r.startOffset&&r.endOffset===d.nodeValue.length||3!==d.nodeType&&d.innerHTML===r.toString()){for(;!a.isMediumEditorElement(d)&&d.parentNode&&1===d.parentNode.childNodes.length&&!a.isMediumEditorElement(d.parentNode);)d=d.parentNode;r.selectNode(d)}for(r.deleteContents(),(o=t.createElement("div")).innerHTML=n,s=t.createDocumentFragment();o.firstChild;)l=o.firstChild,u=s.appendChild(l);r.insertNode(s),u&&((r=r.cloneRange()).setStartAfter(u),r.collapse(!0),e.selection.selectRange(t,r)),c=!0}return t.execCommand.callListeners&&t.execCommand.callListeners(h,c),c},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,r=t.split(" ");if("a"===e.nodeName.toLowerCase())for(i=0;i<r.length;i+=1)e.classList.add(r[i]);else{var o=e.getElementsByTagName("a");if(0===o.length){var s=a.getClosestTag(e,"a");e=s?[s]:[]}else e=o;for(n=0;n<e.length;n+=1)for(i=0;i<r.length;i+=1)e[n].classList.add(r[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,r=null,o=!n;i!==e;){var a,s=i.parentNode,l=s.cloneNode(!1),u=o?i:s.firstChild;for(r&&(o?l.appendChild(r):a=r),r=l;u;){var d=u.nextSibling;u===i?(u.hasChildNodes()?u=u.cloneNode(!1):u.parentNode.removeChild(u),u.textContent&&r.appendChild(u),u=o?d:null):(u.parentNode.removeChild(u),(u.hasChildNodes()||u.textContent)&&r.appendChild(u),u=d)}a&&r.appendChild(a),i=s}return r},moveTextRangeIntoElement:function(e,t,n){if(!e||!t)return!1;var i=a.findCommonRoot(e,t);if(!i)return!1;if(t===e){var r=e.parentNode,o=e.nextSibling;return r.removeChild(e),n.appendChild(e),o?r.insertBefore(n,o):r.appendChild(n),n.hasChildNodes()}for(var s,l,u,d=[],c=0;c<i.childNodes.length;c++)if(u=i.childNodes[c],s){if(a.isDescendant(u,t,!0)){l=u;break}d.push(u)}else a.isDescendant(u,e,!0)&&(s=u);var h=l.nextSibling,p=i.ownerDocument.createDocumentFragment();return s===e?(s.parentNode.removeChild(s),p.appendChild(s)):p.appendChild(a.splitOffDOMTree(s,e)),d.forEach((function(e){e.parentNode.removeChild(e),p.appendChild(e)})),l===t?(l.parentNode.removeChild(l),p.appendChild(l)):p.appendChild(a.splitOffDOMTree(l,t,!0)),n.appendChild(p),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),r=e,o=t;n!==i;)n>i?(r=r.parentNode,n-=1):(o=o.parentNode,i-=1);for(;r!==o;)r=r.parentNode,o=o.parentNode;return r},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),r=0;r<i.length;r++)n.appendChild(i[r]);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 r=function(){this.constructor=n};return r.prototype=i.prototype,n.prototype=new r,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,r=n.getSelection();return 0!==r.rangeCount&&(i=r.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 r,o=i.getRangeAt(0),a=o.cloneRange();a.selectNodeContents(e),a.setEnd(o.startContainer,o.startOffset),n={start:r=a.toString().length,end:r+o.toString().length},this.doesRangeStartWithImages(o,t)&&(n.startsWithImage=!0);var s=this.getTrailingImageCount(e,n,o.endContainer,o.endOffset);if(s&&(n.trailingImageCount=s),0!==r){var l=this.getIndexRelativeToAdjacentEmptyBlocks(t,e,o.startContainer,o.startOffset);-1!==l&&(n.emptyBlocksIndex=l)}}return n},importSelection:function(e,t,n,i){if(e&&t){var r=n.createRange();r.setStart(t,0),r.collapse(!0);var o,a=t,s=[],l=0,u=!1,d=!1,c=0,h=!1,p=!1,f=null;for((i||e.startsWithImage||void 0!==e.emptyBlocksIndex)&&(p=!0);!h&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||d){if(e.trailingImageCount&&d&&("img"===a.nodeName.toLowerCase()&&c++,c===e.trailingImageCount)){for(var g=0;a.parentNode.childNodes[g]!==a;)g++;r.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 o=l+a.length,!u&&e.start>=l&&e.start<=o&&(p||e.start<o?(r.setStart(a,e.start-l),u=!0):f=a),u&&e.end>=l&&e.end<=o&&(e.trailingImageCount?d=!0:(r.setEnd(a,e.end-l),h=!0)),l=o;h||(a=s.pop())}!u&&f&&(r.setStart(f,f.length),r.setEnd(f,f.length)),void 0!==e.emptyBlocksIndex&&(r=this.importSelectionMoveCursorPastBlocks(n,t,e.emptyBlocksIndex,r)),i&&(r=this.importSelectionMoveCursorPastAnchor(e,r)),this.selectRange(n,r)}},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,r=n.startContainer.parentNode;null!==r&&"a"!==r.nodeName.toLowerCase();)r.childNodes[r.childNodes.length-1]!==i?r=null:(i=r,r=r.parentNode);if(null!==r&&"a"===r.nodeName.toLowerCase()){for(var o=null,a=0;null===o&&a<r.parentNode.childNodes.length;a++)r.parentNode.childNodes[a]===r&&(o=a);n.setStart(r.parentNode,o+1),n.collapse(!0)}}return n},importSelectionMoveCursorPastBlocks:function(n,i,r,o){var a,s,l=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),u=o.startContainer,d=0;for(r=r||1,a=3===u.nodeType&&e.util.isBlockContainer(u.previousSibling)?u.previousSibling:e.util.getClosestBlockContainer(u);l.nextNode();)if(s){if(s=l.currentNode,++d===r)break;if(s.textContent.length>0)break}else a===l.currentNode&&(s=l.currentNode);return s||(s=a),o.setStart(e.util.getFirstSelectableLeafNode(s),0),o},getIndexRelativeToAdjacentEmptyBlocks:function(n,i,r,o){if(r.textContent.length>0&&o>0)return-1;var a=r;if(3!==a.nodeType&&(a=r.childNodes[o]),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(r),u=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),d=0;u.nextNode();){var c=""===u.currentNode.textContent;if((c||d>0)&&(d+=1),u.currentNode===l)return d;c||(d=0)}return d},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 r=i.currentNode;if(r===n)break;if(r.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 r=n.childNodes[i-1];r.hasChildNodes();)r=r.lastChild;for(var o,a=e,s=[],l=0,u=!1,d=!1,c=!1,h=0;!c&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||d){if("img"===a.nodeName.toLowerCase()&&h++,a===r)c=!0;else if(1===a.nodeType)for(var p=a.childNodes.length-1;p>=0;)s.push(a.childNodes[p]),p-=1}else h=0,o=l+a.length,!u&&t.start>=l&&t.start<=o&&(u=!0),u&&t.end>=l&&t.end<=o&&(d=!0),l=o;c||(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,r="",o=e.getSelection();if(o.rangeCount){for(i=e.createElement("div"),t=0,n=o.rangeCount;t<n;t+=1)i.appendChild(o.getRangeAt(t).cloneContents());r=i.innerHTML}return r},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,r=e.getSelection();if(!r.rangeCount||r.isCollapsed||!r.getRangeAt(0).commonAncestorContainer)return[];if(3===(t=r.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 r.containsNode||r.containsNode(e,!0)}))},selectNode:function(e,t){var n=t.createRange();n.selectNodeContents(e),this.selectRange(t,n)},select:function(e,t,n,i,r){var o=e.createRange();return o.setStart(t,n),i?o.setEnd(i,r):o.collapse(!0),this.selectRange(e,o),o},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,r){var o=this.base.options.contentWindow,a=this.base.options.ownerDocument;t=e.util.isElement(t)||[o,a].indexOf(t)>-1?[t]:t,Array.prototype.forEach.call(t,function(e){e.addEventListener(n,i,r),this.events.push([e,n,i,r])}.bind(this))},detachDOMEvent:function(t,n,i,r){var o,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!==(o=this.indexOfListener(e,n,i,r))&&(a=this.events.splice(o,1)[0])[0].removeEventListener(a[1],a[2],a[3])}.bind(this)))},indexOfListener:function(e,t,n,i){var r,o,a;for(r=0,o=this.events.length;r<o;r+=1)if((a=this.events[r])[0]===e&&a[1]===t&&a[2]===n&&a[3]===i)return r;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 r=t[n];this.detachDOMEvent(r[0],r[1],r[2],r[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 r,o=this.base.getFocusedElement();o&&"click"===i.type&&this.lastMousedownTarget&&(e.util.isDescendant(o,this.lastMousedownTarget,!0)||t(this.base.extensions,this.lastMousedownTarget))&&(r=o),r||this.base.elements.some((function(t){return!r&&e.util.isDescendant(t,n,!0)&&(r=t),!!r}),this);var a=!e.util.isDescendant(o,n,!0)&&!t(this.base.extensions,n);r!==o&&(o&&a&&(o.removeAttribute("data-medium-focused"),this.triggerCustomEvent("blur",i,o)),r&&(r.setAttribute("data-medium-focused",!0),this.triggerCustomEvent("focus",i,r))),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,r=this.getTagNames();return!1===this.knownState||!0===this.knownState?this.knownState:(r&&r.length>0&&(i=-1!==r.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>•</b>",contentFA:'<i class="fa fa-list-ul"></i>'},indent:{name:"indent",action:"indent",aria:"indent",tagNames:[],contentDefault:"<b>→</b>",contentFA:'<i class="fa fa-indent"></i>'},outdent:{name:"outdent",action:"outdent",aria:"outdent",tagNames:[],contentDefault:"<b>←</b>",contentFA:'<i class="fa fa-outdent"></i>'},justifyCenter:{name:"justifyCenter",action:"justifyCenter",aria:"center justify",tagNames:[],style:{prop:"text-align",value:"center"},contentDefault:"<b>C</b>",contentFA:'<i class="fa fa-align-center"></i>'},justifyFull:{name:"justifyFull",action:"justifyFull",aria:"full justify",tagNames:[],style:{prop:"text-align",value:"justify"},contentDefault:"<b>J</b>",contentFA:'<i class="fa fa-align-justify"></i>'},justifyLeft:{name:"justifyLeft",action:"justifyLeft",aria:"left justify",tagNames:[],style:{prop:"text-align",value:"left"},contentDefault:"<b>L</b>",contentFA:'<i class="fa fa-align-left"></i>'},justifyRight:{name:"justifyRight",action:"justifyRight",aria:"right justify",tagNames:[],style:{prop:"text-align",value:"right"},contentDefault:"<b>R</b>",contentFA:'<i class="fa fa-align-right"></i>'},removeFormat:{name:"removeFormat",aria:"remove formatting",action:"removeFormat",contentDefault:"<b>X</b>",contentFA:'<i class="fa fa-eraser"></i>'},quote:{name:"quote",action:"append-blockquote",aria:"blockquote",tagNames:["blockquote"],contentDefault:"<b>“</b>",contentFA:'<i class="fa fa-quote-right"></i>'},pre:{name:"pre",action:"append-pre",aria:"preformatted text",tagNames:["pre"],contentDefault:"<b>0101</b>",contentFA:'<i class="fa fa-code fa-lg"></i>'},h1:{name:"h1",action:"append-h1",aria:"header type one",tagNames:["h1"],contentDefault:"<b>H1</b>",contentFA:'<i class="fa fa-header"><sup>1</sup>'},h2:{name:"h2",action:"append-h2",aria:"header type two",tagNames:["h2"],contentDefault:"<b>H2</b>",contentFA:'<i class="fa fa-header"><sup>2</sup>'},h3:{name:"h3",action:"append-h3",aria:"header type three",tagNames:["h3"],contentDefault:"<b>H3</b>",contentFA:'<i class="fa fa-header"><sup>3</sup>'},h4:{name:"h4",action:"append-h4",aria:"header type four",tagNames:["h4"],contentDefault:"<b>H4</b>",contentFA:'<i class="fa fa-header"><sup>4</sup>'},h5:{name:"h5",action:"append-h5",aria:"header type five",tagNames:["h5"],contentDefault:"<b>H5</b>",contentFA:'<i class="fa fa-header"><sup>5</sup>'},h6:{name:"h6",action:"append-h6",aria:"header type six",tagNames:["h6"],contentDefault:"<b>H6</b>",contentFA:'<i class="fa fa-header"><sup>6</sup>'}},i=e.extensions.button.extend({init:function(){e.extensions.button.prototype.init.apply(this,arguments)},formSaveLabel:"✓",formCloseLabel:"×",activeClass:"medium-editor-toolbar-form-active",hasForm:!0,getForm:function(){},isDisplayed:function(){return!!this.hasForm&&this.getForm().classList.contains(this.activeClass)},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,r=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(),r=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),r){var o=t.buttonClass?t.buttonClass.split(" "):[];r.checked=-1!==o.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(/^(.*?)(?:\?(.*?))?(?:#(.*))?$/),r=i[1],o=i[2],a=i[3];if(/^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/.test(e))return"tel:"+e;if(!t){var s=r.split("/")[0];(s.match(/.+(\.|:).+/)||"localhost"===s)&&(n="http://")}return n+this.ensureEncodedUri(r)+(void 0===o?"":"?"+this.ensureEncodedQuery(o))+(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=r,o=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,r,o,a=this.window.innerWidth,s=this.anchorPreview.offsetHeight,l=e.getBoundingClientRect(),u=this.diffLeft,d=this.diffTop,c=this.getEditorOption("elementsContainer"),h=["absolute","fixed"].indexOf(window.getComputedStyle(c).getPropertyValue("position"))>-1,p={};t=this.anchorPreview.offsetWidth/2;var f=this.base.getExtensionByName("toolbar");f&&(u=f.diffLeft,d=f.diffTop),n=u-t,h?(r=c.getBoundingClientRect(),["top","left"].forEach((function(e){p[e]=l[e]-r[e]})),p.width=l.width,p.height=l.height,l=p,a=r.width,o=c.scrollTop):o=this.window.pageYOffset,i=l.left+l.width/2,o+=s+l.top+l.height-d-this.anchorPreview.offsetHeight,this.anchorPreview.style.top=Math.round(o)+"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=o,function(){var t,n,i,r,o;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+"))",r=new RegExp("^("+n+")$","i"),o=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 r=0;r<n.length;r++)i=this.removeObsoleteAutoLinkSpans(n[r])||i,i=this.performLinkingWithinElement(n[r])||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,r=0;r<n.length;r++){var o=n[r].textContent;if(-1===o.indexOf("://")&&(o=e.util.ensureUrlHasProtocol(o)),n[r].getAttribute("data-href")!==o&&a(n[r])){i=!0;var s=o.replace(/\s+$/,"");if(n[r].getAttribute("data-href")===s){var l=o.length-s.length,u=e.util.splitOffDOMTree(n[r],this.splitTextBeforeEnd(n[r],l));n[r].parentNode.insertBefore(u,n[r].nextSibling)}else e.util.unwrap(n[r],this.document)}}return i},splitTextBeforeEnd:function(e,t){for(var n,i,r,o=this.document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),a=!0;a;)a=null!==o.lastChild();for(;t>0&&null!==r;)(i=(n=o.currentNode).nodeValue).length>t?(r=n.splitText(i.length-t),t=0):(r=o.previousNode(),t-=i.length);return r},performLinkingWithinElement:function(t){for(var n=this.findLinkableText(t),i=0;i<n.length;i++){var r=e.util.findOrCreateMatchingTextNodes(this.document,t,n[i]);this.shouldNotLink(r)||this.createAutoLink(r,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=o.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("/")||r.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),r=this.document.createElement("span");for(r.setAttribute("data-auto-link","true"),r.setAttribute("data-href",n),i.insertBefore(r,i.firstChild);i.childNodes.length>1;)r.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),r=!!t.shiftKey,o=!!t.altKey;this.keys[n].forEach((function(e){e.meta!==i||e.shift!==r||e.alt!==o&&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:"±",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"),r=t.createElement("a"),o=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)),o.setAttribute("href","#"),o.className="medium-editor-toobar-save",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"✓",n.appendChild(o),this.on(o,"click",this.handleSaveClick.bind(this),!0),r.setAttribute("href","#"),r.className="medium-editor-toobar-close",r.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"×",n.appendChild(r),this.on(r,"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:"±",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"),r=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)),r.setAttribute("href","#"),r.className="medium-editor-toobar-save",r.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"✓",t.appendChild(r),this.on(r,"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>':"×",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,r=function(e){e.stopPropagation()};function o(e,t,n){var i=e.clipboardData||t.clipboardData||n.dataTransfer,r={};if(!i)return r;if(i.getData){var o=i.getData("Text");o&&o.length>0&&(r["text/plain"]=o)}if(i.types)for(var a=0;a<i.types.length;a++){var s=i.types[a];r[s]=i.getData(s)}return r}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=o(e,this.window,this.document),i=n["text/html"],r=n["text/plain"];this.window.clipboardData&&void 0===e.clipboardData&&!i&&(i=r),(i||r)&&(e.preventDefault(),this.doPaste(i,r,t))}},doPaste:function(t,n,i){var r,o,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((r=n.split(/[\r\n]+/g)).length>1)for(o=0;o<r.length;o+=1)""!==r[o]&&(a+="<p>"+e.util.htmlEntities(r[o])+"</p>");else a=e.util.htmlEntities(r[0]);e.util.insertHTMLCommand(this.document,a)}},handlePasteBinPaste:function(e){if(e.defaultPrevented)this.removePasteBin();else{var t=o(e,this.window,this.document),n=t["text/html"],r=t["text/plain"],a=i;if(!this.cleanPastedHTML||n)return e.preventDefault(),this.removePasteBin(),this.doPaste(n,r,a),void this.trigger("editablePaste",{currentTarget:a,target:a},a);setTimeout(function(){this.cleanPastedHTML&&(n=this.getPasteBinHtml()),this.removePasteBin(),this.doPaste(n,r,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(o){var a,s=e.selection.getSelectionRange(this.document),l=this.window.pageYOffset;i=o,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",r),this.on(u,"focusin",r),this.on(u,"focusout",r),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",r),this.off(t,"focusin",r),this.off(t,"focusout",r),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,r,o=/<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(/<(\/?)(i|b|a)>/gi),"<$1$2>"],[new RegExp(/<a(?:(?!href).)+href=(?:"|”|“|"|“|”)(((?!"|”|“|"|“|”).)*)(?:"|”|“|"|“|”)(?:(?!>).)*>/gi),'<a href="$1">'],[new RegExp(/<\/p>\n+/gi),"</p>"],[new RegExp(/\n+<p/gi),"<p"],[new RegExp(/<\/?o:[a-z]*>/gi),""],[new RegExp(/<!\[if !supportLists\]>(((?!<!).)*)<!\[endif]\>/gi),"$1"]],this.cleanReplacements||[]);for(t=0;t<a.length;t+=1)e=e.replace(a[t][0],a[t][1]);if(!o)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((r=n[t]).innerHTML=r.innerHTML.replace(/\n/gi," "),r.nodeName.toLowerCase()){case"p":case"div":this.filterCommonBlocks(r);break;case"br":this.filterLineBreak(r)}this.pasteHTML(i.innerHTML)},pasteHTML:function(t,n){n=e.util.defaults({},n,{cleanAttrs:this.cleanAttrs,cleanTags:this.cleanTags,unwrapTags:this.unwrapTags});var i,r,o,a,s=this.document.createDocumentFragment();for(s.appendChild(this.document.createElement("body")),(a=s.querySelector("body")).innerHTML=t,this.cleanupSpans(a),i=a.querySelectorAll("*"),o=0;o<i.length;o+=1)"a"===(r=i[o]).nodeName.toLowerCase()&&this.getEditorOption("targetBlank")&&e.util.setTargetBlank(r),e.util.cleanupAttrs(r,n.cleanAttrs),e.util.cleanupTags(r,n.cleanTags),e.util.unwrapTags(r,n.unwrapTags);e.util.insertHTMLCommand(this.document,a.innerHTML.replace(/ /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,r,o=t.querySelectorAll(".replace-with"),a=function(e){return e&&"#text"!==e.nodeName&&"false"===e.getAttribute("contenteditable")};for(n=0;n<o.length;n+=1)i=o[n],r=this.document.createElement(i.classList.contains("bold")?"b":"i"),i.classList.contains("bold")&&i.classList.contains("italic")?r.innerHTML="<i>"+i.innerHTML+"</i>":r.innerHTML=i.innerHTML,i.parentNode.replaceChild(r,i);for(o=t.querySelectorAll("span"),n=0;n<o.length;n+=1){if(i=o[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,d=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,r,o,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?(o=i,a=null):(o=i.name,a=i),(r=this.base.addBuiltInExtension(o,a))&&"function"==typeof r.getButton&&(n=r.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,r=e.selection.getSelectionRange(this.document),o=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(r&&(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(r),this.getEditorElements().some((function(n){return e.util.isDescendant(n,t,!0)}))))for(;t&&(n.forEach(o),!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,r=this.getToolbarElement(),o=e.getBoundingClientRect(),a=o.top+n,s=o.left+o.width/2,l=r.offsetHeight,u=r.offsetWidth,d=u/2;switch(this.sticky?n>a+e.offsetHeight-l-this.stickyTopOffset?(r.style.top=a+e.offsetHeight-l+"px",r.classList.remove("medium-editor-sticky-toolbar")):n>a-l-this.stickyTopOffset?(r.classList.add("medium-editor-sticky-toolbar"),r.style.top=this.stickyTopOffset+"px"):(r.classList.remove("medium-editor-sticky-toolbar"),r.style.top=a-l+"px"):r.style.top=a-l+"px",this.align){case"left":t=o.left;break;case"right":t=o.right-u;break;case"center":t=s-d}t<0?t=0:t+u>i&&(t=i-Math.ceil(u)-1),r.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,r,o=this.window.innerWidth,a=this.getToolbarElement(),s=a.offsetHeight,l=a.offsetWidth/2,u=this.diffLeft-l,d=this.getEditorOption("elementsContainer"),c=["absolute","fixed"].indexOf(window.getComputedStyle(d).getPropertyValue("position"))>-1,h={},p={};c?(r=d.getBoundingClientRect(),["top","left"].forEach((function(e){p[e]=n[e]-r[e]})),p.width=n.width,p.height=n.height,n=p,o=r.width,h.top=d.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"):o-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=d,c=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=c,function(){function t(t){var n=e.selection.getSelectionStart(this.options.ownerDocument),i=n.textContent,r=e.selection.getCaretOffsets(n);(void 0===i[r.left-1]||""===i[r.left-1].trim()||void 0!==i[r.left]&&""===i[r.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 r(t){var n,i=e.selection.getSelectionStart(this.options.ownerDocument),r=i.nodeName.toLowerCase(),o=/^(\s+|<br\/?>)?$/i,a=/h\d/i;e.util.isKey(t,[e.util.keyCode.BACKSPACE,e.util.keyCode.ENTER])&&i.previousElementSibling&&a.test(r)&&0===e.selection.getCaretOffsets(i).left?e.util.isKey(t,e.util.keyCode.BACKSPACE)&&o.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(r)&&o.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"===r&&o.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&&o.test(i.innerHTML)&&(t.preventDefault(),e.selection.moveCursor(this.options.ownerDocument,i.nextSibling),i.parentElement.removeChild(i))}function o(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 r=[];if(t||(t=[]),"string"==typeof t&&(t=n.querySelectorAll(t)),e.util.isElement(t)&&(t=[t]),i)for(var o=0;o<t.length;o++){var a=t[o];!e.util.isElement(a)||a.getAttribute("data-medium-editor-element")||a.getAttribute("medium-editor-textarea-id")||r.push(a)}else r=Array.prototype.slice.apply(t);return r}function d(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 c(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 p(){return!!h.call(this)&&!1!==this.options.anchorPreview}function f(){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,r=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 o=0,a=r.length;o<a;o++)t.hasAttribute(r[o].nodeName)||t.setAttribute(r[o].nodeName,r[o].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",o.bind(this));var r=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",r),S[r]=t.innerHTML,this.events.attachAllEventsToElement(t)}return t}function E(){this.subscribe("editableKeydownTab",i.bind(this)),this.subscribe("editableKeydownDelete",r.bind(this)),this.subscribe("editableKeydownEnter",r.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 w(){if(this.extensions=[],Object.keys(this.options.extensions).forEach((function(e){"toolbar"!==e&&this.options.extensions[e]&&this.extensions.push(c(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":p.call(this),autoLink:g.call(this),keyboardCommands:m.call(this),placeholder:f.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 r=e.util.extend({},this.options.toolbar,{allowMultiParagraphSelection:this.options.allowMultiParagraphSelection});i=new e.extensions.toolbar(r)}i&&this.extensions.push(c(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,r;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"),r=n.value||n.size,this.options.ownerDocument.execCommand("fontSize",!1,r);if("fontName"===t)return n.name&&e.util.deprecated(".name option for fontName command",".value","6.0.0"),r=n.value||n.name,this.options.ownerDocument.execCommand("fontName",!1,r);if("createLink"===t)return this.createLink(n);if("image"===t){var o=this.options.contentWindow.getSelection().toString().trim();return this.options.ownerDocument.execCommand("insertImage",!1,o)}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 r=n&&n.value,this.options.ownerDocument.execCommand(t,!1,r)}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 r=this.options.ownerDocument.createElement("BR");i.parentNode.insertBefore(r,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,w.call(this),E.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")&&d(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,r=this.getExtensionByName(t);if(r)return r;switch(t){case"anchor":i=e.util.extend({},this.options.anchor,n),r=new e.extensions.anchor(i);break;case"anchor-preview":r=new e.extensions.anchorPreview(this.options.anchorPreview);break;case"autoLink":r=new e.extensions.autoLink;break;case"fileDragging":r=new e.extensions.fileDragging(n);break;case"fontname":r=new e.extensions.fontName(this.options.fontName);break;case"fontsize":r=new e.extensions.fontSize(n);break;case"keyboardCommands":r=new e.extensions.keyboardCommands(this.options.keyboardCommands);break;case"paste":r=new e.extensions.paste(this.options.paste);break;case"placeholder":r=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]),r=new e.extensions.button(i)):r=new e.extensions.button(t))}return r&&this.extensions.push(c(r,t,this)),r},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,r;return(i=/^full-(.+)$/gi.exec(t))?(this.saveSelection(),this.selectAllContents(),r=N.call(this,i[1],n),this.restoreSelection()):r=N.call(this,t,n),"insertunorderedlist"!==t&&"insertorderedlist"!==t||e.util.cleanListDOM(this.options.ownerDocument,this.getSelectedParentElement()),this.checkSelection(),r},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),r={};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 o=this.options.contentWindow.getSelection();if(o){var a,s,l,u,d=o.getRangeAt(0),c=d.commonAncestorContainer;if(3===d.endContainer.nodeType&&3!==d.startContainer.nodeType&&0===d.startOffset&&d.startContainer.firstChild===d.endContainer&&(c=d.endContainer),s=e.util.getClosestBlockContainer(d.startContainer),l=e.util.getClosestBlockContainer(d.endContainer),3!==c.nodeType&&0!==c.textContent.length&&s===l){var h=s||i,p=this.options.ownerDocument.createDocumentFragment();this.execAction("unlink"),a=this.exportSelection(),p.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 f=this.exportSelection();0===(u=e.util.findOrCreateMatchingTextNodes(this.options.ownerDocument,p,{start:a.start-f.start,end:a.end-f.start,editableElementIndex:a.editableElementIndex})).length&&((p=this.options.ownerDocument.createDocumentFragment()).appendChild(c.cloneNode(!0)),u=[p.firstChild.firstChild,p.firstChild.lastChild]),e.util.createLink(this.options.ownerDocument,u,n.trim());var g=(p.firstChild.innerHTML.match(/^\s+/)||[""])[0].length;e.util.insertHTMLCommand(this.options.ownerDocument,p.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){(r=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(r)}}finally{this.events.enableCustomEvent("editableInput")}this.events.triggerCustomEvent("editableInput",r,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")&&d(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 Nb},set exports(e){Nb=e}});var _b=Nb,Sb=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Mb=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}}(),Tb=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,r=!1,o=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){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}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 Ab={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 Ob(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 kb=function(){function e(t,n,i,r){Sb(this,e);var o=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=Tb(n,4),r=i[0],a=i[1],s=i[2],l=i[3];void 0===l&&(l=1),r/=360,a/=100,s/=100,o.hsla=[r,a,s,l]}else if(t.startsWith("rgb")){var u=t.match(/([\-\d\.e]+)/g).map(Number),d=Tb(u,4),c=d[0],h=d[1],p=d[2],f=d[3];void 0===f&&(f=1),o.rgba=[c,h,p,f]}else t.startsWith("#")?o.rgba=e.hexToRgb(t):o.rgba=e.nameToRgb(t)||e.hexToRgb(t)}(a.toLowerCase())}else this.rgba=[t,n,i,void 0===r?1:r]}return Mb(e,[{key:"printRGB",value:function(e){var t=(e?this.rgba:this.rgba.slice(0,3)).map((function(e,t){return Ob(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 Ob(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=Ab[n];return void 0===i?i:e.hexToRgb(i.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=Tb(e,4),n=t[0],i=t[1],r=t[2],o=t[3];n/=255,i/=255,r/=255;var a=Math.max(n,i,r),s=Math.min(n,i,r),l=void 0,u=void 0,d=(a+s)/2;if(a===s)l=u=0;else{var c=a-s;switch(u=d>.5?c/(2-a-s):c/(a+s),a){case n:l=(i-r)/c+(i<r?6:0);break;case i:l=(r-n)/c+2;break;case r:l=(n-i)/c+4}l/=6}return[l,u,d,o]}},{key:"hslToRgb",value:function(e){var t=Tb(e,4),n=t[0],i=t[1],r=t[2],o=t[3],a=void 0,s=void 0,l=void 0;if(0===i)a=s=l=r;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},d=r<.5?r*(1+i):r+i-r*i,c=2*r-d;a=u(c,d,n+1/3),s=u(c,d,n),l=u(c,d,n-1/3)}var h=[255*a,255*s,255*l].map(Math.round);return h[3]=o,h}}]),e}(),Db=function(){function e(){Sb(this,e),this._events=[]}return Mb(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(r){var o=!0;return t&&t!==r.target&&(o=!1),n&&n!==r.type&&(o=!1),i&&i!==r.handler&&(o=!1),o&&e._doRemove(r.target,r.type,r.handler),!o}))}},{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 Rb(e,t,n){var i=!1;function r(e,t,n){return Math.max(t,Math.min(e,n))}function o(e,o,a){if(a&&(i=!0),i){e.preventDefault();var s=t.getBoundingClientRect(),l=s.width,u=s.height,d=o.clientX,c=o.clientY,h=r(d-s.left,0,l),p=r(c-s.top,0,u);n(h/l,p/u)}}function a(e,t){1===(void 0===e.buttons?e.which:e.buttons)?o(e,e,t):i=!1}function s(e,t){1===e.touches.length?o(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 Pb="keydown",Ib="mousedown",Lb="focusin";function Bb(e,t){return(t||document).querySelector(e)}function jb(e,t,n,i,r){e.add(t,Pb,(function(e){n.indexOf(e.key)>=0&&i(e)}))}var zb=function(){function e(t){Sb(this,e),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Db,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return Mb(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 r=n.parent;if(r&&n.popup&&!this._popupInited){var o=function(e){return t.openHandler(e)};this._events.add(r,"click",o),jb(this._events,r,[" ","Spacebar","Enter"],o),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===Pb?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===Ib||t===Lb){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!==Ib&&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 kb(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>',r=(t=i,(n=document.createElement("div")).innerHTML=t,n.firstElementChild);return this.domElement=r,this._domH=Bb(".picker_hue",r),this._domSL=Bb(".picker_sl",r),this._domA=Bb(".picker_alpha",r),this._domEdit=Bb(".picker_editor input",r),this._domSample=Bb(".picker_sample",r),this._domOkay=Bb(".picker_done button",r),this._domCancel=Bb(".picker_cancel button",r),r.classList.add("layout_"+this.settings.layout),this.settings.alpha||r.classList.add("no_alpha"),this.settings.editor||r.classList.add("no_editor"),this.settings.cancelButton||r.classList.add("no_cancel"),this._ifPopup((function(){return r.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 r(e,t,n){i.add(e,t,n)}r(n,"click",(function(e){return e.preventDefault()})),Rb(i,this._domH,(function(e,n){return t._setHSLA(e)})),Rb(i,this._domSL,(function(e,n){return t._setHSLA(null,e,1-n)})),this.settings.alpha&&Rb(i,this._domA,(function(e,n){return t._setHSLA(null,null,null,1-n)}));var o=this._domEdit;r(o,"input",(function(e){t._setColor(this.value,{fromEditor:!0,failSilently:!0})})),r(o,"focus",(function(e){var t=this;t.selectionStart===t.selectionEnd&&t.select()})),this._ifPopup((function(){var t=function(t){return e.closeHandler(t)};r(window,Ib,t),r(window,Lb,t),jb(i,n,["Esc","Escape"],t);var o=function(t){e.__containedEvent=t.timeStamp};r(n,Ib,o),r(n,Lb,o),r(e._domCancel,"click",t)}));var a=function(t){e._ifPopup((function(){return e.closeHandler(t)})),e.onDone&&e.onDone(e.colour)};r(this._domOkay,"click",a),jb(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,r){r=r||{};var o=this.colour,a=o.hsla;[e,t,n,i].forEach((function(e,t){(e||0===e)&&(a[t]=e)})),o.hsla=a,this._updateUI(r),this.onChange&&!r.silent&&this.onChange(o)}},{key:"_updateUI",value:function(e){if(this.domElement){e=e||{};var t=this.colour,n=t.hsla,i="hsl("+360*n[0]+", 100%, 50%)",r=t.hslString,o=t.hslaString,a=this._domH,s=this._domSL,l=this._domA,u=Bb(".picker_selector",a),d=Bb(".picker_selector",s),c=Bb(".picker_selector",l);y(0,u,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=i,y(0,d,n[1]),b(0,d,1-n[2]),s.style.color=r,b(0,c,1-n[3]);var h=r,p=h.replace("hsl","hsla").replace(")",", 0)"),f="linear-gradient("+[h,p]+")";if(this._domA.style.background=f+", 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=o}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}(),Hb=document.createElement("style");Hb.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(Hb),zb.StyleElement=Hb;var Fb={};!function(e){e.exports=function(){var e="object",t="function",n="undefined",i=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],r=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],o=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],a=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"];function s(n,i){var r=typeof n[i];return r==t||!(r!=e||!n[i])||"unknown"==r}function l(t,n){return!(typeof t[n]!=e||!t[n])}function u(e,t){return typeof e[t]!=n}function d(e){return function(t,n){for(var i=n.length;i--;)if(!e(t,n[i]))return!1;return!0}}var c=d(s),h=d(l),p=d(u);function f(e){return e&&c(e,a)&&p(e,o)}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,E={isHostMethod:s,isHostObject:l,isHostProperty:u,areHostMethods:c,areHostObjects:h,areHostProperties:p,isTextRange:f,getBody:g,forEach:y},w={version:"1.3.1",initialized:!1,isBrowser:x,supported:!0,util:E,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){w.initialized=!0,w.supported=!1,N("Rangy is not supported in this environment. Reason: "+e,w.config.alertOnFail)}function S(e){N("Rangy warning: "+e,w.config.alertOnWarn)}w.fail=_,w.warn=S,{}.hasOwnProperty?(E.extend=v=function(e,t,n){var i,r;for(var o in t)t.hasOwnProperty(o)&&(i=e[o],r=t[o],n&&null!==i&&"object"==typeof i&&null!==r&&"object"==typeof r&&v(i,r,!0),e[o]=r);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},E.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}),E.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"),E.addListener=m);var M=[];function T(e){return e.message||e.description||String(e)}function A(){if(x&&!w.initialized){var e,t=!1,n=!1;s(document,"createRange")&&(e=document.createRange(),c(e,r)&&p(e,i)&&(t=!0));var o=g(document);if(o&&"body"==o.nodeName.toLowerCase())if(o&&s(o,"createTextRange")&&f(e=o.createTextRange())&&(n=!0),t||n){var a;for(var l in w.initialized=!0,w.features={implementsDomRange:t,implementsTextRange:n},b)(a=b[l])instanceof P&&a.init(a,w);for(var u=0,d=M.length;u<d;++u)try{M[u](w)}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 O(e,t,n){n&&(e+=" in module "+n.name),w.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function k(e,t,n,i){e[t]=function(){return O(t,n,i),e[n].apply(e,E.toArray(arguments))}}E.deprecationNotice=O,E.createAliasForDeprecatedMethod=k,w.init=A,w.addInitListener=function(e){w.initialized?e(w):M.push(e)};var D=[];function R(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(w,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(){}w.addShimListener=function(e){D.push(e)},x&&(w.shim=w.createMissingNativeApi=R,k(w,"createMissingNativeApi","shim")),P.prototype={init:function(){for(var e,t,n=this.dependencies||[],i=0,r=n.length;i<r;++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){w.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){w.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)}},w.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);w.initialized&&w.supported&&i.init()},w.createCoreModule=function(e,t,n){I(e,t,n)},w.RangePrototype=L,w.rangePrototype=new L,w.selectionPrototype=new B,w.createCoreModule("DomUtil",[],(function(e,t){var n="undefined",i=e.util,r=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 o=document.createElement("div");i.areHostMethods(o,["insertBefore","appendChild","cloneNode"]||!i.areHostObjects(o,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),i.isHostProperty(o,"innerHTML")||t.fail("Element is missing innerHTML property");var a=document.createTextNode("test");i.areHostMethods(a,["splitText","deleteData","insertData","appendData","cloneNode"]||!i.areHostObjects(o,["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 d(e){for(var t=0;e=e.previousSibling;)++t;return t}function c(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 p(e,t,n){for(var i=n?t:t.parentNode;i;){if(i===e)return!0;i=i.parentNode}return!1}function f(e,t){return p(e,t,!0)}function g(e,t,n){for(var i,r=n?e:e.parentNode;r;){if((i=r.parentNode)===t)return r;r=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 r,o=0;r=n[o++];)r.node==e&&r.offset>t?(r.node=i,r.offset-=t):r.node==e.parentNode&&r.offset>d(e)&&++r.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 E(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 w(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 r;if(e?i.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?w(e):x(e):N(e)&&(r=e.document):r=document,!r)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return r}function S(e){for(var t;t=e.parentNode;)e=t;return e}function M(e,n,i,r){var o,a,s,l,u;if(e==i)return n===r?0:n<r?-1:1;if(o=g(i,e,!0))return n<=d(o)?-1:1;if(o=g(e,i,!0))return d(o)<r?-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 O(e){try{return e.parentNode,!1}catch(e){return!0}}function k(e){if(!e)return"[No node]";if(A&&O(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:"+d(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 R(e,t,n){var i=r(e),o=e.createElement("div");o.contentEditable=""+!!n,t&&(o.innerHTML=t);var a=i.firstChild;return a?i.insertBefore(o,a):i.appendChild(o),o}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=O(n),e.features.crashyTextNodes=A}(),typeof window.getComputedStyle!=n?T=function(e,t){return E(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("+k(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:d,getNodeLength:c,getCommonAncestor:h,isAncestorOf:p,isOrIsAncestorOf:f,getClosestAncestorIn:g,isCharacterDataNode:v,isTextOrCommentNode:m,insertAfter:y,splitDataNode:b,getDocument:x,getWindow:E,getIframeWindow:C,getIframeDocument:w,getBody:r,isWindow:N,getContentDocument:_,getRootContainer:S,comparePoints:M,isBrokenNode:O,inspectNode:k,getComputedStyleProperty:T,createTestElement:R,removeNode:P,fragmentFromNodeChildren:D,createIterator:L,DomPosition:B},e.DOMException=j})),w.createCoreModule("DomRange",["DomUtil"],(function(e,t){var n=e.dom,i=e.util,r=n.DomPosition,o=e.DOMException,a=n.isCharacterDataNode,s=n.getNodeIndex,l=n.isOrIsAncestorOf,u=n.getDocument,d=n.comparePoints,c=n.splitDataNode,h=n.getClosestAncestorIn,p=n.getNodeLength,f=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 E(e){return new r(e.parentNode,s(e))}function w(e){return new r(e.parentNode,s(e)+1)}function C(e,t,i){var r=11==e.nodeType?e.firstChild:e;return a(t)?i==t.length?n.insertAfter(e,t):t.parentNode.insertBefore(e,0==i?t:c(t,i)):i>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[i]),r}function N(e,t,n){if(Q(e),Q(t),b(t)!=b(e))throw new o("WRONG_DOCUMENT_ERR");var i=d(e.startContainer,e.startOffset,t.endContainer,t.endOffset),r=d(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return n?i<=0&&r>=0:i<0&&r>0}function _(e){for(var t,n,i,r=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 o("HIERARCHY_REQUEST_ERR");r.appendChild(n)}return r}function S(e,t,i){var r,o,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(r=n.createIterator(a);o=r.next();)if(!1===t(o))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 o("HIERARCHY_REQUEST_ERR");i.appendChild(t)}return i}function A(e,t,n){var i,r=!(!t||!t.length),o=!!n;r&&(i=new RegExp("^("+t.join("|")+")$"));var s=[];return S(new k(e,!1),(function(t){if((!r||i.test(t.nodeType))&&(!o||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 O(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+n.inspectNode(e.startContainer)+":"+e.startOffset+", "+n.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function k(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])}}k.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,r=t,o=p(t);l(t,this.sc)&&(n=this.sc,i=this.so),l(t,this.ec)&&(r=this.ec,o=this.eo),ve(e,n,i,r,o)}return new k(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],R=[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,r=n?t:t.parentNode;r;){if(i=r.nodeType,f(e,i))return r;r=r.parentNode}return null}}var j=B([9,11]),z=B(P),H=B([6,10,12]),F=B([1]);function W(e,t){if(H(e,t))throw new o("INVALID_NODE_TYPE_ERR")}function G(e,t){if(!f(t,e.nodeType))throw new o("INVALID_NODE_TYPE_ERR")}function U(e,t){if(t<0||t>(a(e)?e.length:e.childNodes.length))throw new o("INDEX_SIZE_ERR")}function V(e,t){if(j(e,!0)!==j(t,!0))throw new o("WRONG_DOCUMENT_ERR")}function X(e){if(z(e,!0))throw new o("NO_MODIFICATION_ALLOWED_ERR")}function q(e,t){if(!e)throw new o(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 Q(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"),$=!1;try{Z.innerHTML="<b>x</b>",$=3==Z.firstChild.nodeType}catch(e){}e.features.htmlParsingConforms=$;var J=$?function(e){var t=this.startContainer,i=u(t);if(!t)throw new o("INVALID_STATE_ERR");var r=null;return 1==t.nodeType?r=t:a(t)&&(r=n.parentElement(t)),(r=null===r||"HTML"==r.nodeName&&n.isHtmlNamespace(u(r).documentElement)&&n.isHtmlNamespace(r)?i.createElement("body"):r.cloneNode(!1)).innerHTML=e,n.fragmentFromNodeChildren(r)}:function(e){var t=b(this).createElement("body");return t.innerHTML=e,n.fragmentFromNodeChildren(t)};function ee(e,t){Q(e);var n=e.startContainer,i=e.startOffset,r=e.endContainer,o=e.endOffset,l=n===r;a(r)&&o>0&&o<r.length&&c(r,o,t),a(n)&&i>0&&i<n.length&&(n=c(n,i,t),l?(o-=i,r=n):r==n.parentNode&&o>=s(n)&&o++,i=0),e.setStartAndEnd(n,i,r,o)}function te(e){Q(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,re=1,oe=2,ae=3,se=0,le=1,ue=2,de=3;function ce(e){e.START_TO_START=ie,e.START_TO_END=re,e.END_TO_END=oe,e.END_TO_START=ae,e.NODE_BEFORE=se,e.NODE_AFTER=le,e.NODE_BEFORE_AND_AFTER=ue,e.NODE_INSIDE=de}function he(e){ce(e),ce(e.prototype)}function pe(e,t){return function(){Q(this);var n,i=this.startContainer,r=this.startOffset,o=this.commonAncestorContainer,a=new k(this,!0);i!==o&&(i=(n=w(h(i,o,!0))).node,r=n.offset),S(a,X),a.reset();var s=e(a);return a.detach(),t(this,i,r,i,r),s}}function fe(t,n){function r(e,t){return function(n){G(n,D),G(g(n),R);var i=(e?E:w)(n);(t?o:l)(this,i.node,i.offset)}}function o(e,t,i){var r=e.endContainer,o=e.endOffset;t===e.startContainer&&i===e.startOffset||(g(t)==g(r)&&1!=d(t,i,r,o)||(r=t,o=i),n(e,t,i,r,o))}function l(e,t,i){var r=e.startContainer,o=e.startOffset;t===e.endContainer&&i===e.endOffset||(g(t)==g(r)&&-1!=d(t,i,r,o)||(r=t,o=i),n(e,r,o,t,i))}var u=function(){};u.prototype=e.rangePrototype,t.prototype=new u,i.extend(t.prototype,{setStart:function(e,t){W(e,!0),U(e,t),o(this,e,t)},setEnd:function(e,t){W(e,!0),U(e,t),l(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],i=e[1],r=t,o=i;switch(e.length){case 3:o=e[2];break;case 4:r=e[2],o=e[3]}W(t,!0),U(t,i),W(r,!0),U(r,o),n(this,t,i,r,o)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:r(!0,!0),setStartAfter:r(!1,!0),setEndBefore:r(!0,!1),setEndAfter:r(!1,!1),collapse:function(e){Q(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){W(e,!0),n(this,e,0,e,p(e))},selectNode:function(e){W(e,!1),G(e,D);var t=E(e),i=w(e);n(this,t.node,t.offset,i.node,i.offset)},extractContents:pe(T,n),deleteContents:pe(M,n),canSurroundContents:function(){Q(this),X(this.startContainer),X(this.endContainer);var e=new k(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(){Q(this);var e,t=this.startContainer,i=this.startOffset,r=this.endContainer,o=this.endOffset,l=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(r=e,o=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==r)o+=i,r=t;else if(r==e.parentNode){var l=s(e);o==l?(r=e,o=a):o>l&&o--}}},d=!0;if(a(r))o==r.length?l(r):0==o&&(e=r.previousSibling)&&e.nodeType==r.nodeType&&(o=e.length,t==r&&(d=!1),e.appendData(r.data),m(r),r=e);else{if(o>0){var c=r.childNodes[o-1];c&&a(c)&&l(c)}d=!this.collapsed}if(d){if(a(t))0==i?u(t):i==t.length&&(e=t.nextSibling)&&e.nodeType==t.nodeType&&(r==e&&(r=t,o+=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=r,i=o;n(this,t,i,r,o)},collapseToPoint:function(e,t){W(e,!0),U(e,t),this.setStartAndEnd(e,t)},parentElement:function(){return Q(this),this.commonAncestorContainer?F(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,r,o){e.startContainer=t,e.startOffset=i,e.endContainer=r,e.endOffset=o,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,r,o;Q(this),V(this.startContainer,t.startContainer);var a=e==ae||e==ie?"start":"end",s=e==re||e==ie?"start":"end";return n=this[a+"Container"],i=this[a+"Offset"],r=t[s+"Container"],o=t[s+"Offset"],d(n,i,r,o)},insertNode:function(e){if(Q(this),G(e,I),X(this.startContainer),l(e,this.startContainer))throw new o("HIERARCHY_REQUEST_ERR");var t=C(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){var e,t;if(Q(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 k(this,!0);return e=_(n),n.detach(),e},canSurroundContents:function(){Q(this),X(this.startContainer),X(this.endContainer);var e=new k(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 o("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(){Q(this);for(var e,t=new me(b(this)),n=ne.length;n--;)t[e=ne[n]]=this[e];return t},toString:function(){Q(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 k(this,!0);return S(n,(function(e){3!=e.nodeType&&4!=e.nodeType||t.push(e.data)})),n.detach(),t.join("")},compareNode:function(e){Q(this);var t=e.parentNode,n=s(e);if(!t)throw new o("NOT_FOUND_ERR");var i=this.comparePoint(t,n),r=this.comparePoint(t,n+1);return i<0?r>0?ue:se:r>0?le:de},comparePoint:function(e,t){return Q(this),q(e,"HIERARCHY_REQUEST_ERR"),V(e,this.startContainer),d(e,t,this.startContainer,this.startOffset)<0?-1:d(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:J,toHtml:function(){return te(this)},intersectsNode:function(e,t){if(Q(this),g(e)!=x(this))return!1;var n=e.parentNode,i=s(e);if(!n)return!0;var r=d(n,i,this.endContainer,this.endOffset),o=d(n,i+1,this.startContainer,this.startOffset);return t?r<=0&&o>=0:r<0&&o>0},isPointInRange:function(e,t){return Q(this),q(e,"HIERARCHY_REQUEST_ERR"),V(e,this.startContainer),d(e,t,this.startContainer,this.startOffset)>=0&&d(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=d(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=d(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==d(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==d(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new o("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==de},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,p(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 Q(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),r=e.createRange(i);t=t||n.getBody(i),r.selectNodeContents(t);var o=this.intersection(r),a=0,s=0;return o&&(r.setEnd(o.startContainer,o.startOffset),s=(a=r.toString().length)+o.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,r,o,a,s=[t],l=!1,u=!1;!u&&(i=s.pop());)if(3==i.nodeType)r=n+i.length,!l&&e.start>=n&&e.start<=r&&(this.setStart(i,e.start-n),l=!0),l&&e.end>=n&&e.end<=r&&(this.setEnd(i,e.end-n),u=!0),n=r;else for(o=(a=i.childNodes).length;o--;)s.push(a[o])},getName:function(){return"DomRange"},equals:function(e){return me.rangesEqual(this,e)},isValid:function(){return Y(this)},inspect:function(){return O(this)},detach:function(){}}),fe(me,ve),i.extend(me,{rangeProperties:ne,RangeIterator:k,copyComparisonConstants:he,createPrototypeRange:fe,inspect:O,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})),w.createCoreModule("WrappedRange",["DomRange"],(function(e,t){var n,i,r=e.dom,o=e.util,a=r.DomPosition,s=e.DomRange,l=r.getBody,u=r.getContentDocument,d=r.isCharacterDataNode;if(e.features.implementsDomRange&&function(){var i,a,d=s.rangeProperties;function c(e){for(var t,n=d.length;n--;)e[t=d[n]]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function h(e,t,n,i,r){var o=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==i||e.endOffset!=r,s=!e.equals(e.nativeRange);(o||a||s)&&(e.setEnd(i,r),e.setStart(t,n))}n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,c(this)},s.createPrototypeRange(n,h),(i=n.prototype).selectNode=function(e){this.nativeRange.selectNode(e),c(this)},i.cloneContents=function(){return this.nativeRange.cloneContents()},i.surroundContents=function(e){this.nativeRange.surroundContents(e),c(this)},i.collapse=function(e){this.nativeRange.collapse(e),c(this)},i.cloneRange=function(){return new n(this.nativeRange.cloneRange())},i.refresh=function(){c(this)},i.toString=function(){return this.nativeRange.toString()};var p=document.createTextNode("test");l(document).appendChild(p);var f=document.createRange();f.setStart(p,0),f.setEnd(p,0);try{f.setStart(p,1),i.setStart=function(e,t){this.nativeRange.setStart(e,t),c(this)},i.setEnd=function(e,t){this.nativeRange.setEnd(e,t),c(this)},a=function(e){return function(t){this.nativeRange[e](t),c(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)}c(this)},i.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}c(this)},a=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(i){this.nativeRange[t](n),this.nativeRange[e](n)}c(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,r.getNodeLength(e))},f.selectNodeContents(p),f.setEnd(p,3);var g=document.createRange();g.selectNodeContents(p),g.setEnd(p,4),g.setStart(p,2),-1==f.compareBoundaryPoints(f.START_TO_END,g)&&1==f.compareBoundaryPoints(f.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),f.setStart(m,1),f.setEnd(m,2),f.deleteContents(),"13"==m.data&&(i.deleteContents=function(){this.nativeRange.deleteContents(),c(this)},i.extractContents=function(){var e=this.nativeRange.extractContents();return c(this),e}),y.removeChild(v),y=null,o.isHostMethod(f,"createContextualFragment")&&(i.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),l(document).removeChild(p),i.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return(e=u(e,t,"createNativeRange")).createRange()}}(),e.features.implementsTextRange){var c=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var i=n.parentElement();(n=e.duplicate()).collapse(!1);var o=n.parentElement(),a=i==o?i:r.getCommonAncestor(i,o);return a==t?a:r.getCommonAncestor(t,a)},h=function(e){return 0==e.compareEndPoints("StartToEnd",e)},p=function(e,t,n,i,o){var s=e.duplicate();s.collapse(n);var l=s.parentElement();if(r.isOrIsAncestorOf(t,l)||(l=t),!l.canHaveHTML){var u=new a(l.parentNode,r.getNodeIndex(l));return{boundaryPosition:u,nodeInfo:{nodeIndex:u.offset,containerElement:u.node}}}var c=r.getDocument(l).createElement("span");c.parentNode&&r.removeNode(c);for(var h,p,f,g,v,m=n?"StartToStart":"StartToEnd",y=o&&o.containerElement==l?o.nodeIndex:0,b=l.childNodes.length,x=b,E=x;E==b?l.appendChild(c):l.insertBefore(c,l.childNodes[E]),s.moveToElementText(c),0!=(h=s.compareEndPoints(m,e))&&y!=x;){if(-1==h){if(x==y+1)break;y=E}else x=x==y+1?y:E;E=Math.floor((y+x)/2),l.removeChild(c)}if(v=c.nextSibling,-1==h&&v&&d(v)){var w;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(w=C.moveStart("character",N);-1==(h=C.compareEndPoints("StartToEnd",C));)w++,C.moveStart("character",1)}else w=s.text.length;g=new a(v,w)}else p=(i||!n)&&c.previousSibling,g=(f=(i||n)&&c.nextSibling)&&d(f)?new a(f,0):p&&d(p)?new a(p,p.data.length):new a(l,r.getNodeIndex(c));return r.removeNode(c),{boundaryPosition:g,nodeInfo:{nodeIndex:E,containerElement:l}}},f=function(e,t){var n,i,o,a,s=e.offset,u=r.getDocument(e.node),c=l(u).createTextRange(),h=d(e.node);return h?i=(n=e.node).parentNode:(n=s<(a=e.node.childNodes).length?a[s]:null,i=e.node),(o=u.createElement("span")).innerHTML="&#feff;",n?i.insertBefore(o,n):i.appendChild(o),c.moveToElementText(o),c.collapse(!t),i.removeChild(o),h&&c[t?"moveStart":"moveEnd"]("character",s),c};(i=function(e){this.textRange=e,this.refresh()}).prototype=new s(document),i.prototype.refresh=function(){var e,t,n,i=c(this.textRange);h(this.textRange)?t=e=p(this.textRange,i,!0,!0).boundaryPosition:(e=(n=p(this.textRange,i,!0,!1)).boundaryPosition,t=p(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 f(new a(e.startContainer,e.startOffset),!0);var t=f(new a(e.startContainer,e.startOffset),!0),n=f(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)},o.createAliasForDeprecatedMethod(e,"createIframeRange","createRange"),o.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}))})),w.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(e,t){e.config.checkSelectionRanges=!0;var n,i,r="boolean",o="number",a=e.dom,s=e.util,l=s.isHostMethod,u=e.DomRange,d=e.WrappedRange,c=e.DOMException,h=a.DomPosition,p=e.features,f="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 Q)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 E(e){return b(e,"getDocSelection").document.selection}function w(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");p.implementsWinGetSelection=C,p.implementsDocSelection=N;var _=N&&(!C||e.config.preferTextRange);if(_)n=E,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"]);p.selectionHasAnchorAndFocus=A;var O=l(S,"extend");p.selectionHasExtend=O;var k=l(S,"setBaseAndExtent");p.selectionHasSetBaseAndExtent=k;var D=typeof S.rangeCount==o;p.selectionHasRangeCount=D;var R=!1,P=!0,I=O?function(t,n){var i=u.getRangeDocument(n),r=e.createRange(i);r.collapseToPoint(n.endContainer,n.endOffset),t.addRange(G(r)),t.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(S,["addRange","getRangeAt","removeAllRanges"])&&typeof S.rangeCount==o&&p.implementsDomRange&&function(){var t=window.getSelection();if(t){for(var n=t.rangeCount,i=n>1,r=[],o=w(t),s=0;s<n;++s)r[s]=t.getRangeAt(s);var l=a.createTestElement(document,"",!1),u=l.appendChild(document.createTextNode(" ")),d=document.createRange();if(d.setStart(u,1),d.collapse(!0),t.removeAllRanges(),t.addRange(d),P=1==t.rangeCount,t.removeAllRanges(),!i){var c=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(c&&parseInt(c[1])>=36)R=!1;else{var h=d.cloneRange();d.setStart(u,0),h.setEnd(u,3),h.setStart(u,2),t.addRange(d),t.addRange(h),R=2==t.rangeCount}}for(a.removeNode(l),t.removeAllRanges(),s=0;s<n;++s)0==s&&o?I?I(t,r[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(r[s])):t.addRange(r[s])}}(),p.selectionSupportsMultipleRanges=R,p.collapsedNonEditableSelectionsSupported=P;var L,B,j=!1;function z(e,t,n){var i=n?"end":"start",r=n?"start":"end";e.anchorNode=t[i+"Container"],e.anchorOffset=t[i+"Offset"],e.focusNode=t[r+"Container"],e.focusOffset=t[r+"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 F(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0,W(e)}function W(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 d?n=t.nativeRange:p.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 V(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 q(e,t){var n=new d(t);e._ranges=[n],z(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed,W(e)}function K(t){if(t._ranges.length=0,"None"==t.docSelection.type)F(t);else{var n=t.docSelection.createRange();if(X(n))q(t,n);else{t.rangeCount=n.length;for(var i,r=g(n.item(0)),o=0;o<t.rangeCount;++o)(i=e.createRange(r)).selectNode(n.item(o)),t._ranges.push(i);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed,z(t,t._ranges[t.rangeCount-1],!1),W(t)}}}function Y(e,n){for(var i=e.docSelection.createRange(),r=V(n),o=g(i.item(0)),a=v(o).createControlRange(),s=0,l=i.length;s<l;++s)a.add(i.item(s));try{a.add(r)}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 Q(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,W(e)}T&&l(T,"createControlRange")&&(L=T.createControlRange(),s.areHostProperties(L,["item","add"])&&(j=!0)),p.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}),Q.prototype=e.selectionPrototype;var $=[];function J(e,t){for(var n,i,r=$.length;r--;)if(i=(n=$[r]).selection,"deleteAll"==t)Z(i);else if(n.win==e)return"delete"==t?($.splice(r,1),!0):i;return"deleteAll"==t&&($.length=0),null}var ee=function(e){if(e&&e instanceof Q)return e.refresh(),e;var t=J(e=b(e,"getNativeSelection")),i=n(e),r=N?E(e):null;return t?(t.nativeSelection=i,t.docSelection=r,t.refresh()):(t=new Q(i,r,e),$.push({win:e,selection:t})),t};e.getSelection=ee,s.createAliasForDeprecatedMethod(e,"getIframeSelection","getSelection");var te,ne=Q.prototype;function ie(e,n){for(var i,r=g(n[0].startContainer),o=v(r).createControlRange(),a=0,s=n.length;a<s;++a){i=V(n[a]);try{o.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?)")}}o.select(),K(e)}if(!_&&A&&s.areHostMethods(S,["removeAllRanges","addRange"])){ne.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),F(this)};var re=function(e,t){I(e.nativeSelection,t),e.refresh()};ne.addRange=D?function(t,n){if(j&&N&&this.docSelection.type==f)Y(this,t);else if(y(n)&&O)re(this,t);else{var r;R?r=this.rangeCount:(this.removeAllRanges(),r=0);var o=G(t).cloneRange();try{this.nativeSelection.addRange(o)}catch(e){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==r+1){if(e.config.checkSelectionRanges){var a=B(this.nativeSelection,this.rangeCount-1);a&&!m(a,t)&&(t=new d(a))}this._ranges[this.rangeCount-1]=t,z(this,t,oe(this.nativeSelection)),this.isCollapsed=i(this),W(this)}else this.refresh()}}:function(e,t){y(t)&&O?re(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==f){var t=this.docSelection.createRange();t.length&&(e=g(t.item(0)))}e&&(v(e).createTextRange().select(),this.docSelection.empty())}}catch(e){}F(this)},ne.addRange=function(t){this.docSelection.type==f?Y(this,t):(e.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,z(this,t,!1),W(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 c("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==f?K(t):X(n)?q(t,n):F(t)};else if(l(S,"getRangeAt")&&typeof S.rangeCount==o)te=function(t){if(j&&N&&t.docSelection.type==f)K(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,r=t.rangeCount;n<r;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));z(t,t._ranges[t.rangeCount-1],oe(t.nativeSelection)),t.isCollapsed=i(t),W(t)}else F(t)};else{if(!A||typeof S.isCollapsed!=r||typeof M.collapsed!=r||!p.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),W(e)):F(e)}}ne.refresh=function(e){var t=e?this._ranges.slice(0):null,n=this.anchorNode,i=this.anchorOffset;if(te(this),e){var r=t.length;if(r!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=i)return!0;for(;r--;)if(!m(t[r],this._ranges[r]))return!0;return!1}};var oe,ae=function(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var i=0,r=n.length;i<r;++i)m(t,n[i])||e.addRange(n[i]);e.rangeCount||F(e)};function se(e,t){if(e.win.document!=g(t))throw new c("WRONG_DOCUMENT_ERR")}function le(e,t){if(t<0||t>(a.isCharacterDataNode(e)?e.length:e.childNodes.length))throw new c("INDEX_SIZE_ERR")}function ue(t){return function(n,i){var r;this.rangeCount?(r=this.getRangeAt(0))["set"+(t?"Start":"End")](n,i):(r=e.createRange(this.win.document)).setStartAndEnd(n,i),this.setSingleRange(r,this.isBackward())}}function de(e){var t=[],n=new h(e.anchorNode,e.anchorOffset),i=new h(e.focusNode,e.focusOffset),r="function"==typeof e.getName?e.getName():"Selection";if(void 0!==e.rangeCount)for(var o=0,a=e.rangeCount;o<a;++o)t[o]=u.inspect(e.getRangeAt(o));return"["+r+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}ne.removeRange=j&&N?function(e){if(this.docSelection.type==f){for(var t=this.docSelection.createRange(),n=V(e),i=g(t.item(0)),r=v(i).createControlRange(),o=!1,a=0,s=t.length;a<s;++a)t.item(a)!==n||o?r.add(t.item(a)):o=!0;r.select(),K(this)}else ae(this,e)}:function(e){ae(this,e)},!_&&A&&p.implementsDomRange?(oe=w,ne.isBackward=function(){return oe(this)}):oe=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 c("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},ne.collapseToEnd=function(){if(!this.rangeCount)throw new c("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)},k?ne.setBaseAndExtent=function(e,t,n,i){this.nativeSelection.setBaseAndExtent(e,t,n,i),this.refresh()}:O&&(ne.setBaseAndExtent=function(t,n,i,r){le(t,n),le(i,r),se(this,t),se(this,i);var o=e.createRange(node),s=-1==a.comparePoints(t,n,i,r);s?o.setStartAndEnd(i,r,t,n):o.setStartAndEnd(t,n,i,r),this.setSingleRange(o,s)}),ne.deleteFromDocument=function(){if(j&&N&&this.docSelection.type==f){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,r=n.length;i<r;++i)n[i].deleteContents();this.addRange(n[r-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,r=[],o=0;n=t.rangeBookmarks[o++];)(i=e.createRange(this.win)).moveToBookmark(n),r.push(i);t.backward?this.setSingleRange(r[0],"backward"):this.setRanges(r)},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("")},p.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 de(this)},ne.detach=function(){J(this.win,"delete"),Z(this)},Q.detachAll=function(){J(null,"deleteAll")},Q.inspect=de,Q.isDirectionBackward=y,e.Selection=Q,e.selectionPrototype=ne,e.addShimListener((function(e){void 0===e.getSelection&&(e.getSelection=function(){return ee(e)}),e=null}))}));var j=!1,z=function(e){j||(j=!0,!w.initialized&&w.config.autoInitialize&&A())};return x&&("complete"==document.readyState?z():(s(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",z,!1),m(window,"load",z))),w}()}({get exports(){return Fb},set exports(e){Fb=e}});var Wb=Fb,Gb={};!function(e){e.exports=function(e){return e.createModule("ClassApplier",["WrappedSelection"],(function(e,t){var n=e.dom,i=n.DomPosition,r=n.arrayContains,o=e.util,a=o.forEach,s="span",l=o.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 d(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function c(e,t){return!!e&&new RegExp("(?:^|\\s)"+t+"(?:\\s|$)").test(e)}function h(e,t){return"object"==typeof e.classList?e.classList.contains(t):c("string"==typeof e.className?e.className:e.getAttribute("class"),t)}function p(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?c(i,t)||(i+=" "+t):i=t,n?e.className=i:e.setAttribute("class",i)}}var f=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,r=i?t.className:t.getAttribute("class");r=r.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),e),i?t.className=r:t.setAttribute("class",r)}}}();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,r=n.length;i<r;++i)if(!h(e,d(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 E(e,t,n,i,r){var o=e.node,a=e.offset,s=o,l=a;o==i&&a>r&&++l,o!=t||a!=n&&a!=n+1||(s=i,l+=r-n),o==t&&a>n+1&&--l,e.node=s,e.offset=l}function w(e,t,n){e.node==t&&e.offset>n&&--e.offset}function C(e,t,i,r){-1==i&&(i=t.childNodes.length);var o=e.parentNode,s=n.getNodeIndex(e);a(r,(function(e){E(e,o,s,t,i)})),t.childNodes.length==i?t.appendChild(e):t.insertBefore(e,t.childNodes[i])}function N(e,t){var i=e.parentNode,r=n.getNodeIndex(e);a(t,(function(e){w(e,i,r)})),n.removeNode(e)}function _(e,t,n,i,r){for(var o,a=[];o=e.firstChild;)C(o,t,n++,r),a.push(o);return N(e,r),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 r=n.length-1;(t=n[r])&&!M(e,t);)--r;return n.slice(i,r+1)}function A(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n,i,r,o=0,a=e.attributes.length;o<a;++o)if("class"!=(r=(n=e.attributes[o]).name)){if(null===n!=(null===(i=t.attributes.getNamedItem(r))))return!1;if(n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}function O(e,t){for(var n,i=0,o=e.attributes.length;i<o;++i)if(n=e.attributes[i].name,(!t||!r(t,n))&&e.attributes[i].specified&&"class"!=n)return!0;return!1}var k=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 R(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))&&!R(e)}var I=/^inline(-block|-table)?$/i;function L(e){return e&&1==e.nodeType&&!I.test(k(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(k(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 z(e){var t,n,r=[];for(t=0;n=e[t++];)r.push(new i(n.startContainer,n.startOffset),new i(n.endContainer,n.endOffset));return r}function H(e,t){for(var n,i,r,o=0,a=e.length;o<a;++o)n=e[o],i=t[2*o],r=t[2*o+1],n.setStartAndEnd(i.node,i.offset,r.node,r.offset)}function F(e,t){return n.isCharacterDataNode(e)?0==t?!!e.previousSibling:t!=e.length||!!e.nextSibling:t>0&&t<e.childNodes.length}function W(e,i,r,o){var a,s,l=0==r;if(n.isAncestorOf(i,e))return e;if(n.isCharacterDataNode(i)){var u=n.getNodeIndex(i);if(0==r)r=u;else{if(r!=i.length)throw t.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+r+" in "+i.data);r=u+1}i=i.parentNode}if(F(i,r)){a=i.cloneNode(!1),s=i.parentNode,a.id&&a.removeAttribute("id");for(var d,c=0;d=i.childNodes[r];)C(d,a,c++,o);return C(a,s,n.getNodeIndex(i)+1,o),i==e?a:W(e,s,n.getNodeIndex(a),o)}if(e!=i){a=i.parentNode;var h=n.getNodeIndex(i);return l||h++,W(e,a,h,o)}return e}function G(e,t){return e.namespaceURI==t.namespaceURI&&e.tagName.toLowerCase()==t.tagName.toLowerCase()&&y(e,t)&&A(e,t)&&"inline"==k(e,"display")&&"inline"==k(t,"display")}function U(e){var t=e?"nextSibling":"previousSibling";return function(n,i){var r=n.parentNode,o=n[t];if(o){if(o&&3==o.nodeType)return o}else if(i&&(o=r[t])&&1==o.nodeType&&G(r,o)){var a=o[e?"firstChild":"lastChild"];if(a&&3==a.nodeType)return a}return null}}var V=U(!1),X=U(!0);function q(e){this.isElementMerge=1==e.nodeType,this.textNodes=[];var t=this.isElementMerge?e.lastChild:e;t&&(this.textNodes[0]=t)}q.prototype={doMerge:function(e){var t=this.textNodes,i=t[0];if(t.length>1){var r,o=n.getNodeIndex(i),s=[],l=0;a(t,(function(u,d){r=u.parentNode,d>0&&(r.removeChild(u),r.hasChildNodes()||n.removeNode(r),e&&a(e,(function(e){e.node==u&&(e.node=i,e.offset+=l),e.node==r&&e.offset>o&&(--e.offset,e.offset==o+1&&d<t.length-1&&(e.node=i,e.offset=l))}))),s[d]=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 Q(e,t,n){var i,r,o,a,s=this;s.cssClass=s.className=e;var l=null,c={};if("object"==typeof t&&null!==t){for(void 0!==t.elementTagName&&(t.elementTagName=t.elementTagName.toLowerCase()),n=t.tagNames,l=t.elementProperties,c=t.elementAttributes,r=0;a=K[r++];)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(c,(function(e,t){s.attrExceptions.push(e),c[e]=""+t})),s.elementAttributes=c,s.elementSortedClassName=s.elementProperties.hasOwnProperty("className")?v(s.elementProperties.className+" "+e):e,s.applyToAnyTagName=!1;var p=typeof n;if("string"==p)"*"==n?s.applyToAnyTagName=!0:s.tagNames=d(n.toLowerCase()).split(/\s*,\s*/);else if("object"==p&&"number"==typeof n.length)for(s.tagNames=[],r=0,o=n.length;r<o;++r)"*"==n[r]?s.applyToAnyTagName=!0:s.tagNames.push(n[r].toLowerCase());else s.tagNames=[s.elementTagName]}function Z(e,t,n){return new Q(e,t,n)}Q.prototype={elementTagName:s,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(e,t,n){var i,r,o,a,s,l,u={};for(var d in e)if(e.hasOwnProperty(d))if(a=e[d],s=t[d],"className"==d)p(t,a),p(t,this.className),t[d]=v(t[d]),n&&(u[d]=a);else if("style"==d){for(i in r=s,n&&(u[d]=o={}),e[d])e[d].hasOwnProperty(i)&&(r[i]=a[i],n&&(o[i]=r[i]));this.attrExceptions.push(d)}else t[d]=a,n&&(u[d]=t[d],l=Y.hasOwnProperty(d)?Y[d]:d,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 r(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 r,o,s=e[0],l=e[e.length-1],u=[],d=s,c=l,h=0,p=l.length;a(e,(function(e){(o=V(e,!i))?(r||(r=new q(o),u.push(r)),r.textNodes.push(e),e===s&&(d=r.textNodes[0],h=d.length),e===l&&(c=r.textNodes[0],p=r.getLength())):r=null}));var f=X(l,!i);if(f&&(r||(r=new q(l),u.push(r)),r.textNodes.push(f)),u.length){for(var g=0,v=u.length;g<v;++g)u[g].doMerge(n);t.setStartAndEnd(d,h,c,p)}},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),p(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))p(n,this.className);else{var i=e.parentNode,r=this.createContainer(i);i.insertBefore(r,e),r.appendChild(e)}}},isRemovable:function(e){return e.tagName.toLowerCase()==this.elementTagName&&m(e)==this.elementSortedClassName&&this.elementHasProperties(e,this.elementProperties)&&!O(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],r=z(i);a(n,(function(e){N(e,r)})),H(i,r)},undoToTextNode:function(e,t,n,i){if(!t.containsNode(n)){var r=t.cloneRange();r.selectNode(n),r.isPointInRange(t.endContainer,t.endOffset)&&(W(n,t.endContainer,t.endOffset,i),t.setEndAfter(n)),r.isPointInRange(t.startContainer,t.startOffset)&&(n=W(n,t.startContainer,t.startOffset,i))}this.isRemovable(n)?S(n,i):f(n,this.className)},splitAncestorWithClass:function(e,t,n){var i=this.getSelfOrAncestorWithClass(e);i&&W(i,e,t,n)},undoToAncestor:function(e,t){this.isRemovable(e)?S(e,t):f(e,this.className)},applyToRange:function(e,t){var n=this,i=z((t=t||[])||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e);var r=T(e);if(r.length){a(r,(function(e){n.isIgnorableWhiteSpaceNode(e)||n.getSelfOrAncestorWithClass(e)||!n.isModifiable(e)||n.applyToTextNode(e,i)}));var o=r[r.length-1];e.setStartAndEnd(r[0],0,o,o.length),n.normalize&&n.postApply(r,e,i,!1),H(t,i)}var s=n.getEmptyElements(e);a(s,(function(e){p(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=z(t=t||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e,i);var r,o,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,d=s.length;u<d;++u)r=s[u],(o=n.getSelfOrAncestorWithClass(r))&&n.isModifiable(r)&&n.undoToAncestor(o,i);e.setStartAndEnd(s[0],0,l,l.length),n.normalize&&n.postApply(s,e,i,!0),H(t,i)}var c=n.getEmptyElements(e);a(c,(function(e){f(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&&!r(t,i)&&t.push(i)})),t},detach:function(){}},Q.util={hasClass:h,addClass:p,removeClass:f,getClass:g,hasSameClasses:y,hasAllClasses:b,replaceWithOwnChildren:S,elementsHaveSameNonClassAttributes:A,elementHasNonClassAttributes:O,splitNodeAt:W,isEditableElement:D,isEditingHost:R,isEditable:P},e.CssClassApplier=e.ClassApplier=Q,e.createClassApplier=Z,o.createAliasForDeprecatedMethod(e,"createCssClassApplier","createClassApplier",t)})),e}(Fb)}({get exports(){return Gb},set exports(e){Gb=e}});var Ub={toolbar:{allowMultiParagraphSelection:!0,buttons:["bold","colorpicker","italic","underline","strikethrough","quote","justifyLeft","justifyCenter","justifyRight","justifyFull","superscript","subscript","orderedlist","unorderedlist","pre","removeFormat","outdent","indent","h2","h3"],standardizeSelectionStart:!1,updateOnEmptySelection:!1},placeholder:{text:"请输入内容",hideOnClick:!0},disableEditing:!0};function Vb(e){var t,n,i=(null===(t=null==e?void 0:e.extensions)||void 0===t?void 0:t.button)||(null===(n=null==e?void 0:e.extensions)||void 0===n?void 0:n.button),r=(null==e?void 0:e.Extension)||(null==e?void 0:e.Extension),o=i||r;return o?o.extend({name:"colorpicker",tagNames:["mark"],contentDefault:"<b>Color</b>",aria:"Color Picker",action:"colorPicker",init:function(){var e,t,n=this;try{Wb.init()}catch(e){}try{null===(t=null===(e=null==i?void 0:i.prototype)||void 0===e?void 0:e.init)||void 0===t||t.call(this)}catch(e){}this.colorPicker=new zb({parent:this.button||void 0,color:"#000",onDone:function(e){var t,i,r,o,a;try{n.coloredText&&(null===(i=(t=n.coloredText).isAppliedToSelection)||void 0===i?void 0:i.call(t))&&n.coloredText.undoToSelection(),n.coloredText=Wb.createClassApplier("colored",{elementTagName:"span",elementProperties:{style:{color:e.hex}},normalize:!0}),n.coloredText.toggleSelection(),null===(o=null===(r=n.base)||void 0===r?void 0:r.checkContentChanged)||void 0===o||o.call(r),null===(a=n.setInactive)||void 0===a||a.call(n)}catch(e){}}})},getButton:function(){return this.button},handleClick:function(){var e,t,n;null===(e=this.setActive)||void 0===e||e.call(this),null===(n=null===(t=this.colorPicker)||void 0===t?void 0:t.show)||void 0===n||n.call(t)},isAlreadyApplied:function(e){var t,n;return"mark"===(null===(n=null===(t=null==e?void 0:e.nodeName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t))},isActive:function(){var e,t;return null===(t=null===(e=this.button)||void 0===e?void 0:e.classList)||void 0===t?void 0:t.contains("medium-editor-button-active")},setInactive:function(){var e,t;null===(t=null===(e=this.button)||void 0===e?void 0:e.classList)||void 0===t||t.remove("medium-editor-button-active")},setActive:function(){var e,t;null===(t=null===(e=this.button)||void 0===e?void 0:e.classList)||void 0===t||t.add("medium-editor-button-active")}}):function(){}}var Xb=function(e){function n(t){var n=e.call(this,t)||this;n.labelMap=new Map;var i=t.lf,r=t.graphModel;return n.lf=i,n.graphModel=r,n.state={tick:0},n}return m(n,e),n.prototype.componentDidMount=function(){var e=this,t=this.props.graphModel;this.editor=new _b(".lf-label-editor",wc(Ub,{autoLink:!0,extensions:{colorPicker:new(Vb(_b))}})),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 _b(".lf-label-editor",wc(Ub,{autoLink:!0,extensions:{colorPicker:new(Vb(_b))}})))},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,r=_(_([],N(i.nodes),!1),N(i.edges),!1);if(n.label){var o=[];return _u(r,(function(t){var n,r;_u(null!==(r=null===(n=t.getData().properties)||void 0===n?void 0:n._label)&&void 0!==r?r:[],(function(n){var r=e.labelMap,a=new Cb(n,t,i);r.set(a.id,a),o.push(Bf(Eb,{label:a,element:t,graphModel:i},a.id))}))})),o}return null},n.prototype.render=function(){return Bf("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},n.toolName="label-edit-tool",n=x([t.observer],n)}(t.Component),qb=function(){function e(e){var n,i,r,o=e.lf,a=e.options;this.labelInitPositionMap=new Map,this.lf=o,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!==(r=a.maxCount)&&void 0!==r?r:1/0,o.graphModel.editConfigModel.updateTextMode(t.TextMode.LABEL),this.addEventListeners(),this.rewriteShortcut(),o.tool.registerTool(Xb.toolName,Xb),o.tool.disableTool("text-edit-tool")}return e.prototype.formatConfig=function(e,n){var i=e.editConfigModel,r=i.nodeTextEdit,o=i.edgeTextEdit,a=i.nodeTextDraggable,s=i.edgeTextDraggable,l=this,u=l.textOverflowMode,d=l.isMultiple,c=l.maxCount,h=l.labelWidth,p=n.text,f=n.zIndex,g=n.properties,v=g._label,m=g._labelOption,b=v,x=void 0===m?{}:m,E=x.isMultiple,w=x.maxCount,C=[];if(at(b)){var N=null!=w?w:c;C=d&&E?b.length>N?b.slice(0,N):b:[b[0]]}else if(mt(b))C=[b];else if("string"==typeof b||!b){var _=y(y({},p),{content:b||(null==p?void 0:p.value),draggable:"edge"===n.BaseType?s:a});C=_.value?[_]:[]}return"edge"===n.BaseType&&(C=id(C,(function(e){return e}))),id(C,(function(e){e.id||(e.id=t.createUuid());var i=e.value,l=e.content,d=e.vertical,c=e.editable,p=e.draggable,g=e.textOverflowMode,v="node"===n.BaseType?r:o,m="node"===n.BaseType?a:s;return y(y({},e),{zIndex:f,labelWidth:h,content:null!=l?l:i,vertical:null!=d&&d,editable:Boolean(v)&&c,draggable:Boolean(m)&&p,textOverflowMode:null!=g?g:u})}))},e.prototype.setupLabels=function(e){var t=this;_u(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,r,o,a=this.isMultiple,s=this.maxCount,l=e.properties,u=null!==(i=l._label)&&void 0!==i?i:[],d=null!==(r=l._labelOption)&&void 0!==r?r:{},c=u.length,h={id:t.createUuid(),x:n.x,y:n.y,content:"Label".concat(c+1),value:"Label".concat(c+1),style:{},draggable:!0,editable:!0,vertical:!1};!a||a&&!1===d.isMultiple||c>=(null!==(o=null==d?void 0:d.maxCount)&&void 0!==o?o:s)||(u.push(h),e.setProperty("_label",u))},e.prototype.addEventListeners=function(){var e=this,n=this.lf.graphModel,i=n.eventCenter,r=n.editConfigModel;i.on("graph:rendered",(function(t){var n=t.graphModel;e.setupLabels(n)})),i.on("node:dbclick,edge:dbclick",(function(i){var o=i.e,a=i.data,s=n.getElement(a.id),l=n.getPointByClient({x:o.clientX,y:o.clientY}).canvasOverlayPosition,u={x:l.x,y:l.y};s&&r.textMode===t.TextMode.LABEL&&e.addLabel(s,u)})),i.on("node:resize",(function(e){var t,n,i=e.preData,r=e.data,o=e.model,a=null!==(t=i.properties)&&void 0!==t?t:{},s=a.width,l=a.height,u=a._label,d=void 0===u?[]:u,c=null!==(n=r.properties)&&void 0!==n?n:{},h=c.width,p=c.height;if(s&&l&&h&&p){var f={x:i.x,y:i.y,width:s,height:l},g={x:r.x,y:r.y,width:h,height:p},v=id(d,(function(e){var t,n,i,r,o,a,s,l,u,d,c,h=e.x,p=e.y,v=(n=g,i={x:h,y:p},r=(t=f).x,o=t.y,a=t.width,s=t.height,l=n.x,u=n.y,d=n.width,c=n.height,{x:l+(i.x-r)/a*d,y:u+(i.y-o)/s*c});return y(y({},e),v)}));o.setProperty("_label",v)}})),i.on("node:rotate",(function(t){var n=t.model,i=n.x,r=n.y,o=n.rotate,a=n.properties._label,s={x:i,y:r},l=id(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=o*(180/Math.PI);i<0&&(i+=360);var r=i*(Math.PI/180),a=nb(n,s,r);return y(y(y({},t),a),{rotate:i})}));n.setProperty("_label",l)})),i.on("node:dnd-add,node:add,edge:add",(function(t){var i=t.data,r=n.getElement(i.id);if(r){e.rewriteInnerMethods(r);var o=r.properties._label;if(!at(o)||0===o.length||!o[0].id){var a=e.formatConfig(n,i);r.setProperty("_label",a)}}}))},e.prototype.rewriteInnerMethods=function(e){e.moveText=function(t,n){if(e.text){var i=e.text,r=i.x,o=i.y,a=i.value,s=i.draggable,l=i.editable;e.text={value:a,editable:l,draggable:s,x:r+t,y:o+n};var u=Fs(e.getProperties());if(at(u._label)){var d=id(u._label,(function(e){return y(y({},e),{x:e.x+t,y:e.y+n})}));null==e||e.setProperty("_label",d)}}}},e.prototype.rewriteShortcut=function(){var e=this,n=this.lf,i=n.keyboard,r=n.graphModel,o=i.options.keyboard;i.off(["backspace"]),i.on(["backspace"],(function(){if(!(null==o?void 0:o.enabled))return!0;if(r.textEditElement)return!0;var n=r.getSelectElements(!0);e.lf.clearSelectElements();var i=e.lf.graphModel.editConfigModel;return n.edges.forEach((function(n){var o=n.properties;if(o&&!Qd(o._label)&&i.textMode===t.TextMode.LABEL){var a=o._label.filter((function(e){return!e.isSelected}));if(!Zd(a.length,o._label.length)){var s=r.getEdgeModelById(n.id);return void(null==s||s.setProperty("_label",a))}}n.id&&e.lf.deleteEdge(n.id)})),n.nodes.forEach((function(n){var o=n.properties;if(o&&!Qd(o._label)&&i.textMode===t.TextMode.LABEL){var a=o._label.filter((function(e){return!e.isSelected}));if(!Zd(a.length,o._label.length)){var s=r.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(Xb.toolName),this.lf.tool.disableTool("text-edit-tool")):e===t.TextMode.TEXT&&(this.lf.tool.enableTool("text-edit-tool"),this.lf.tool.disableTool(Xb.toolName)))},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="label",e}(),Kb={};function Yb(e){return e.startsWith("data:text/plain")}function Qb(e){return E(this,void 0,void 0,(function(){return w(this,(function(t){return Kb[e]?[2,Kb[e]]:[2,new Promise((function(t,n){try{fetch(e).then((function(e){return e.blob()})).then((function(i){var r=new FileReader;r.onloadend=function(){t(Kb[e]=r.result)},r.onerror=n,r.readAsDataURL(i)})).catch((function(){t(Kb[e]=e)}))}catch(t){return Kb[e]=e}}))]}))}))}function Zb(e,t){return E(this,void 0,void 0,(function(){var n,i;return w(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(n=e.getAttribute(t)||"").startsWith("data:")?[2]:[4,Qb(n)];case 1:return Yb(i=r.sent())?[2]:(e.setAttribute(t,i),[3,3]);case 2:return r.sent(),[3,3];case 3:return[2]}}))}))}function $b(e,t){return E(this,void 0,void 0,(function(){var n;return w(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t.startsWith("data:")?[2]:[4,Qb(t)];case 1:return Yb(n=i.sent())?[2]:(e.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return i.sent(),[3,3];case 3:return[2]}}))}))}function Jb(e){return E(this,void 0,void 0,(function(){var t,n,i,r,o,a,s,l,u;return w(this,(function(d){switch(d.label){case 0:for(t=[e],i=[];t.length;)(n=t.shift()).children.length&&t.push.apply(t,_([],N(n.children),!1)),n instanceof HTMLElement&&(r=n.style,o=r.background,a=r.backgroundImage,(s=o.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(u=s[1],i.push($b(n,u))),(l=a.match(/url\(["']?(.*?)["']?\)/))&&l[1]&&(u=l[1],i.push($b(n,u)))),n instanceof HTMLImageElement?i.push(Zb(n,"src")):n instanceof SVGImageElement&&i.push(Zb(n,"href"));return[4,Promise.all(i)];case 1:return d.sent(),[2]}}))}))}function ex(e,t,n){var i=document.createElement("canvas");i.width=t,i.height=n;var r=i.getContext("2d");return r&&r.drawImage(e,0,0,e.width,e.height,0,0,t,n),i}var tx=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.customCssRules="",this.useGlobalRules=!0,t.getSnapshot=function(e,t){return E(n,void 0,void 0,(function(){return w(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 E(n,void 0,void 0,(function(){return w(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 E(n,void 0,void 0,(function(){return w(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 r=t[i];(r.classList&&Array.from(r.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 r=t[i];(r.classList&&Array.from(r.classList)||[]).indexOf("lf-rotate-control")>-1&&(e.removeChild(e.childNodes[i]),n--,i--)}},e.prototype.convertImageToBase64=function(e){return E(this,void 0,void 0,(function(){return w(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 r=e.toDataURL("image/png");t(r)},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 E(this,void 0,void 0,(function(){var t,n,i,r,o,a,s,l,u,d;return w(this,(function(c){switch(c.label){case 0:t=e.getElementsByTagName("image"),r=0,c.label=1;case 1:if(!(r<t.length))return[3,6];if(l=t[r],!(n=l.getAttributeNS("http://www.w3.org/1999/xlink","href")||l.getAttribute("href"))||!this.isRelativePath(n))return[3,5];c.label=2;case 2:return c.trys.push([2,4,,5]),[4,this.convertImageToBase64(n)];case 3:return d=c.sent(),l.setAttributeNS("http://www.w3.org/1999/xlink","href",d),l.setAttribute("href",d),[3,5];case 4:return c.sent(),[3,5];case 5:return r++,[3,1];case 6:i=e.getElementsByTagName("foreignObject"),r=0,c.label=7;case 7:if(!(r<i.length))return[3,14];o=i[r],a=o.getElementsByTagName("img"),s=0,c.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];c.label=9;case 9:return c.trys.push([9,11,,12]),[4,this.convertImageToBase64(u)];case 10:return d=c.sent(),l.setAttribute("src",d),[3,12];case 11:return c.sent(),[3,12];case 12:return s++,[3,8];case 13:return r++,[3,7];case 14:return[2]}}))}))},e.prototype.cloneSvg=function(e){return E(this,arguments,void 0,(function(e,t){var n,i,r,o,a,s,l,u,d,c,h=this;return void 0===t&&(t=!0),w(this,(function(p){switch(p.label){case 0:if(n=e.cloneNode(!0),i=n.lastChild,r=null===(c=null==i?void 0:i.childNodes)||void 0===c?void 0:c.length)for(o=0;o<r;o++)a=null==i?void 0:i.childNodes[o],(s=a.classList&&Array.from(a.classList))&&s.indexOf("lf-base")<0?(null==i||i.removeChild(i.childNodes[o]),r--,o--):(l=null==i?void 0:i.childNodes[o])&&l.childNodes.forEach((function(e){var t=e;h.removeAnchor(t.firstChild),h.removeRotateControl(t.firstChild)}));return[4,this.processImages(n)];case 1:return p.sent(),t&&((u=document.createElement("style")).innerHTML=this.getClassRules(),(d=document.createElement("foreignObject")).appendChild(u),n.appendChild(d)),[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 r=0;r<i.cssRules.length;r++)e+=i.cssRules[r].cssText}catch(e){}}return this.customCssRules&&(e+=this.customCssRules),e},e.prototype.getCanvasScaleRatio=function(e,t){var n=32767,i=268435456,r=e*t;if(e<=n&&t<=n&&r<=i)return 1;var o=n/e,a=n/t,s=i/r;return Math.min(o,a,s)},e.prototype.getCanvasData=function(e,t){return E(this,void 0,void 0,(function(){var n,i,r,o,a,s,l,u,d,c,h,p,f,g,v,m,y,b,x,E,C,N,_,S,M,T,A,O,k,D,R,P,I,L,B;return w(this,(function(w){switch(w.label){case 0:return n=t.width,i=t.height,r=t.backgroundColor,o=t.padding,a=void 0===o?40:o,[4,this.cloneSvg(e,!1)];case 1:return s=w.sent(),(l=window.devicePixelRatio||1)<1&&(l=1),u=this.lf.graphModel.rootEl.querySelector(".lf-base"),d=u.getBoundingClientRect(),c=this.lf.container.querySelector(".lf-canvas-overlay"),h=c.getBoundingClientRect(),p=d.x-h.x,f=d.y-h.y,g=this.lf.graphModel,v=g.transformModel,m=v.SCALE_X,y=v.SCALE_Y,b=v.TRANSLATE_X,x=v.TRANSLATE_Y,E=t.safetyFactor||1,C=d.width/m,N=d.height/y,_=C*(E-1),S=N*(E-1),M=Math.ceil(C+_),T=Math.ceil(N+S),(A=document.createElement("canvas")).style.width="".concat(M,"px"),A.style.height="".concat(T,"px"),O=t.safetyMargin||0,k=M*l,D=T*l,(R=this.getCanvasScaleRatio(k,D))<1&&(k=Math.floor(k*R),D=Math.floor(D*R)),s.lastChild.style.transform="matrix(".concat(R,", 0, 0, ").concat(R,", ").concat((-p+b)*(1/m)*R+a+_/2+O,", ").concat((-f+x)*(1/y)*R+a+S/2+O,")"),A.width=k+2*(a+O)*l,A.height=D+2*(a+O)*l,(P=A.getContext("2d"))&&(P.clearRect(0,0,A.width,A.height),P.scale(l,l),r?(P.fillStyle=r,P.fillRect(0,0,A.width,A.height)):P.clearRect(0,0,A.width,A.height)),I=new Image,(L=document.createElement("style")).innerHTML=this.getClassRules(),(B=document.createElement("foreignObject")).appendChild(L),s.appendChild(B),[2,new Promise((function(e){I.onload=function(){var t=navigator.userAgent.indexOf("Firefox")>-1;try{t?createImageBitmap(I,{resizeWidth:n&&i?ex(A,n,i).width:A.width,resizeHeight:n&&i?ex(A,n,i).height:A.height}).then((function(t){null==P||P.drawImage(t,0,0),e(n&&i?ex(A,n,i):A)})):(null==P||P.drawImage(I,0,0),e(n&&i?ex(A,n,i):A))}catch(t){null==P||P.drawImage(I,0,0),e(n&&i?ex(A,n,i):A)}};var t="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(s)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");I.src=t}))]}}))}))},e.prototype.withExportPreparation=function(e,t){return E(this,void 0,void 0,(function(){var n,i,r,o,a,s=this;return w(this,(function(l){switch(l.label){case 0:n=this.lf.graphModel.getPartial(),i=(null!=t?t:{}).partial,r=void 0===i?n:i,o=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===r?[3,3]:(this.lf.graphModel.setPartial(r),[4,new Promise((function(t){s.lf.graphModel.eventCenter.once("graph:updated",(function(){return E(s,void 0,void 0,(function(){var i;return w(this,(function(r){switch(r.label){case 0:return[4,e()];case 1:return i=r.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(o),[7];case 7:return[2,a]}}))}))},e.prototype.getSnapshot=function(e,t){return E(this,void 0,void 0,(function(){var n=this;return w(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 E(this,void 0,void 0,(function(){var n,i,r,o,a,s,l,u,d,c=this;return w(this,(function(h){switch(h.label){case 0:return i=(n=null!=t?t:{}).fileType,r=void 0===i?"png":i,o=n.quality,this.fileName="".concat(null!=e?e:"logic-flow.".concat(Date.now()),".").concat(r),[4,Jb(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"!==r?[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"}),d=URL.createObjectURL(u),this.triggerDownload(d),[3,4];case 3:this.getCanvasData(a,null!=t?t:{}).then((function(e){var t=e.toDataURL("image/".concat(r),o).replace("image/".concat(r),"image/octet-stream");c.triggerDownload(t)})),h.label=4;case 4:return[2]}}))}))},e.prototype.getSnapshotBlob=function(e,t,n){return E(this,void 0,void 0,(function(){var i=this;return w(this,(function(r){switch(r.label){case 0:return[4,this.withExportPreparation((function(){return i.snapshotBlob(n,t,e)}),n)];case 1:return[2,r.sent()]}}))}))},e.prototype.snapshotBlob=function(e,t,n){return E(this,void 0,void 0,(function(){var i,r,o,a,s,l=this;return w(this,(function(u){switch(u.label){case 0:return i=(null!=e?e:{}).fileType,r=void 0===i?t:i,[4,Jb(o=this.getSvgRootElement(this.lf))];case 1:return u.sent(),"svg"!==r?[3,3]:[4,this.cloneSvg(o)];case 2:return a=u.sent(),s=(new XMLSerializer).serializeToString(a),[2,{data:new Blob([s],{type:"image/svg+xml;charset=utf-8"}),width:0,height:0}];case 3:return[2,new Promise((function(t){l.getCanvasData(o,y({backgroundColor:n},null!=e?e:{})).then((function(e){e.toBlob((function(n){t({data:n,width:e.width,height:e.height})}),"image/".concat(null!=r?r:"png"))}))}))]}}))}))},e.prototype.getSnapshotBase64=function(e,t,n){return E(this,void 0,void 0,(function(){var i=this;return w(this,(function(r){switch(r.label){case 0:return[4,this.withExportPreparation((function(){return i._getSnapshotBase64(e,t,n)}),n)];case 1:return[2,r.sent()]}}))}))},e.prototype._getSnapshotBase64=function(e,t,n){return E(this,void 0,void 0,(function(){var i,r,o,a=this;return w(this,(function(s){switch(s.label){case 0:return i=(null!=n?n:{}).fileType,r=void 0===i?t:i,[4,Jb(o=this.getSvgRootElement(this.lf))];case 1:return s.sent(),[2,new Promise((function(t){a.getCanvasData(o,y({backgroundColor:e},null!=n?n:{})).then((function(e){var n=e.toDataURL("image/".concat(null!=r?r:"png"));t({data:n,width:e.width,height:e.height})}))}))]}}))}))},e.pluginName="snapshot",e}(),nx=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 r=[];return i.forEach((function(t){var i=n.get(t);i&&(r=r.concat(e.findPathElements(i,n,[])))})),this.getNewPathes(r)},e.prototype.findPathElements=function(e,t,n){void 0===n&&(n=[]);var i=_([],N(n),!1);if(i.push(e.id),0===e.nextNodes.length)return[i];for(var r=[],o=0;o<e.nextNodes.length;o++){var a=t.get(e.nextNodes[o]),s=void 0;if(a){var l=i.indexOf(a.id);s=-1!==l?[_(_([],N(i.slice(l)),!1),[a.id],!1)]:this.findPathElements(a,t,_([],N(i),!1)),r=r.concat(s)}}return r},e.prototype.getNewPathes=function(e){var t=this,n=[],i=new Set;e.forEach((function(e){var r=t.getNewId("path"),o=t.getNewId("路径"),a=t.isLoopPath(e),s=e.join(",");i.has(s)||(i.add(s),n.push({routeId:r,name:o,elements:e,type:a,weight:0,similarElement:""}))}));var r=JSON.parse(JSON.stringify(this.paths));return n.forEach((function(e){for(var n=0;n<r.length;n++){var i=r[n],o=t.similar2Path(_([],N(e.elements),!1),_([],N(i.elements),!1));o>e.weight&&i.weight<=o&&(e.weight=o,e.similarElement=i,o===i.weight&&i.similarElement?(i.similarElement.similarElement=null,i.similarElement.weight=0,i.similarElement=null,i.weight=0):(i.similarElement=e,i.weight=o))}})),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 r=e.shift(),o=t.shift();void 0!==r&&void 0!==o;)r===o?(n++,r=e.shift(),o=t.shift()):r<o?r=e.shift():r>o&&(o=t.shift());return n/i*200},e.prototype.getNewId=function(e){return"".concat(e,"_").concat(T())},e.prototype.isLoopPath=function(e){var t=e.length;return e.indexOf(e[t-1])!==t-1?1:0},e.pluginName="flowPath",e}(),ix=-1,rx=0,ox=1,ax=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 r=this.formatData(e),o={nodes:[],edges:[]},a=i.length-1;a>=0;a--)this.setNodePosition(i[a],r,o,a,1);this.lf.graphModel.graphDataToModel(o)},e.prototype.setNodePosition=function(e,t,n,i,r){var o=this,a=t[e],s=a.text,l=a.type,u=a.next,d=a.properties,c=160*i+40,h=120*r,p={id:e,x:c,text:s,y:h,type:l,properties:d};return s&&"object"==typeof s&&(p.text=y(y({},s),{x:c+s.x,y:h+s.y})),this.newNodeMap.set(p.id,{x:p.x,y:p.y,type:l}),n.nodes.push(p),a.isFixed=!0,this.addLevelHeight(i,1),u&&u.length>0&&u.forEach((function(r){if(!t[r.nodeId].isFixed){var a=o.getLevelHeight(i+1);o.addLevelHeight(i,1),o.setNodePosition(r.nodeId,t,n,i+1,a+1)}n.edges.push(y({id:r.edgeId,type:r.edgeType,sourceNodeId:e,targetNodeId:r.nodeId,properties:r.properties,text:r.text},o.getEdgeDataPoints(e,r.nodeId)))})),p},e.prototype.getEdgeDataPoints=function(e,t){var n=this.newNodeMap.get(e),i=this.newNodeMap.get(t),r=this.getShape(e),o=r.width,a=r.height,s=this.getShape(t),l=s.width,u=s.height,d=this.getRelativePosition(n,i),c={x:n.x,y:n.y},h={x:i.x,y:i.y};switch(d){case rx:c.x=n.x+o/2,h.x=i.x-l/2;break;case ix:c.y=n.y+a/2,h.x=i.x-l/2;break;case ox:c.x=n.x+o/2,h.y=i.y+u/2}return{startPoint:c,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,r=t.text,o=t.x,a=t.y;return r&&"object"==typeof r&&(r.x=r.x-o,r.y=r.y-a),e[t.id]={type:n,properties:i,text:r,prev:[],next:[]},e}),{});return e.edges.forEach((function(e){var n=e.sourceNodeId,i=e.targetNodeId,r=e.id,o=e.properties,a=e.text,s=a;"object"==typeof a&&(s=a.value),t[n].next.push({edgeId:r,nodeId:i,edgeType:e.type,properties:o,text:s}),t[i].prev.push({edgeId:r,nodeId:n,properties:o,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}(),sx=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,hr(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,r=n.id;e.currentNode=i.getNodeModelById(r)}})),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,r=n.clientY;e.enable&&"node"!==e.type&&e.handleAnchorDrag(i,r)})),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,r=n.edgeModel;if(e.enable&&"node"!==e.type){var o=e.lf.graphModel.getPointByClient({x:i.clientX,y:i.clientY}).canvasOverlayPosition,a=o.x,s=o.y;if(r&&e.virtualEdge){var l=e.virtualEdge.id,u=r.targetNodeId,d=e.lf.graphModel.getNodeModelById(u);if(d&&t.isInNode({x:a,y:s},d,10))return void e.lf.deleteEdge(l)}e.handleDrop()}}))},e.prototype.handleNodeDrag=function(){var e=this.lf.graphModel.nodes;if(!rc(this.virtualEdge)){var n=this.virtualEdge,i=n.startPoint,r=n.endPoint,o=n.id;t.twoPointDistance(i,r)>this.thresholdDistance&&(this.lf.deleteEdge(o),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,r=i.getPointByClient({x:e,y:n}).canvasOverlayPosition,o=r.x,a=r.y;if(!rc(o)&&!rc(a)){var s={x:o,y:a},l=i.nodes;if(!rc(this.virtualEdge)){var u=this.virtualEdge,d=u.endPoint,c=u.id;t.twoPointDistance(s,d)>this.thresholdDistance&&(this.lf.deleteEdge(c),this.virtualEdge=void 0)}this.findClosestAnchorOfAnchor(s,l),this.currentDistance<this.thresholdDistance&&this.addVirtualEdge()}},e.prototype.findClosestAnchorOfNode=function(e,n){var i=this;if(!rc(e)&&!Qd(e)){var r,o,a,s,l=e.anchors,u=void 0===l?[]:l,d=e.id;n.forEach((function(e){if(!Zd(e.id,d)){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);(!r||u<r)&&(r=u,o=l,a=n,s=e)}}))}))}})),this.currentDistance=r,this.currentAnchor=o,this.closestAnchor=a,this.closestNode=s}},e.prototype.findClosestAnchorOfAnchor=function(e,n){var i=this;if(!rc(e)){var r,o,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(!Zd(null===(u=i.currentAnchor)||void 0===u?void 0:u.id,s.id)&&i.anchorAllowConnect(n,s,l)){var d=t.twoPointDistance(e,s);(!r||d<r)&&(r=d,o=s,a=n)}}))}})),this.currentDistance=r,this.closestAnchor=o,this.closestNode=a}},e.prototype.anchorAllowConnect=function(e,t,n){var i=this.currentNode;if(i){var r=(this.reverseDirection?e.isAllowConnectedAsSource(i,t,n):i.isAllowConnectedAsSource(e,n,t)).isAllPass,o=(this.reverseDirection?i.isAllowConnectedAsTarget(e,t,n):e.isAllowConnectedAsTarget(i,n,t)).isAllPass;return r&&o}},e.prototype.sameEdgeIsExist=function(e){if(rc(this.closestNode)||rc(this.currentNode)||rc(this.closestAnchor)||rc(this.currentAnchor))return!1;if(rc(e))return!1;var t=this,n=t.closestNode.id,i=t.currentNode.id,r=t.closestAnchor.id,o=t.currentAnchor.id,a=t.reverseDirection,s=e.sourceNodeId,l=e.targetNodeId,u=e.sourceAnchorId,d=e.targetAnchorId;return a?Zd(n,s)&&Zd(i,l)&&Zd(r,u)&&Zd(o,d):Zd(i,s)&&Zd(n,l)&&Zd(o,u)&&Zd(r,d)},e.prototype.addVirtualEdge=function(){var e=this,t=Gh(this.lf.graphModel.edges,(function(t,n){return n.virtual?t:t||e.sameEdgeIsExist(n)}),!1);if(!t){if(!rc(this.virtualEdge)){var n=this.virtualEdge.id;if(this.sameEdgeIsExist(this.virtualEdge))return;this.lf.deleteEdge(n)}var i=this,r=i.reverseDirection,o=i.currentNode,a=i.closestNode,s=i.currentAnchor,l=i.closestAnchor;if(!Qd(o)&&!Qd(a)){var u={style:this.virtualEdgeStyle};this.virtualEdge=this.lf.addEdge(r?{sourceNodeId:null==a?void 0:a.id,targetNodeId:null==o?void 0:o.id,sourceAnchorId:null==l?void 0:l.id,targetAnchorId:null==s?void 0:s.id,properties:u}:{sourceNodeId:null==o?void 0:o.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(!rc(this.virtualEdge)){var e=this.virtualEdge,t=e.type,n=e.sourceNodeId,i=e.targetNodeId,r=e.sourceAnchorId,o=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:r,targetAnchorId:o,startPoint:a,endPoint:s,pointsList:l})}},e.prototype.setVirtualEdgeStyle=function(e){this.virtualEdgeStyle=y(y({},this.virtualEdgeStyle),e)},e.prototype.setThresholdDistance=function(e){Jd(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}(),lx=function(){function e(e){var t=e.lf,n=this;this.controlItems=[{key:"zoom-out",iconClass:"lf-control-zoomOut",title:"缩小流程图",text:"缩小",hideText:!1,onClick:function(){n.lf.zoom(!1)}},{key:"zoom-in",iconClass:"lf-control-zoomIn",title:"放大流程图",text:"放大",hideText:!1,onClick:function(){n.lf.zoom(!0)}},{key:"reset",iconClass:"lf-control-fit",title:"恢复流程原有尺寸",text:"适应",hideText:!1,onClick:function(){n.lf.resetZoom()}},{key:"undo",iconClass:"lf-control-undo",title:"回到上一步",text:"上一步",hideText:!1,onClick:function(){n.lf.undo()}},{key:"redo",iconClass:"lf-control-redo",title:"移到下一步",text:"下一步",hideText:!1,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=this.lf.graphModel.themeMode,n="lf-control-item-".concat(t," lf-control-item"),i="lf-control-item disabled",r=document.createElement("div"),o=[];return r.className="lf-control-".concat(t," lf-control"),_([],N(this.controlItems),!1).forEach((function(r){var a=document.createElement("div"),s=document.createElement("i");if(a.className=i,r.onClick&&(a.onclick=r.onClick.bind(null,e.lf)),r.onMouseEnter&&(a.onmouseenter=r.onMouseEnter.bind(null,e.lf)),r.onMouseLeave&&(a.onmouseleave=r.onMouseLeave.bind(null,e.lf)),s.className=r.iconClass,rc(r.hideText)||!0!==r.hideText){var l=document.createElement("span");l.className="lf-control-text-".concat(t," lf-control-text"),l.title=r.title,l.innerText=r.text,a.append(s,l)}else a.append(s);switch(r.key){case"undo":e.lf.on("history:change",(function(e){var t=e.data.undoAble;a.className=t?n:i}));break;case"redo":e.lf.on("history:change",(function(e){var t=e.data.redoAble;a.className=t?n:i}));break;default:a.className=n}o.push(a)})),r.append.apply(r,_([],N(o),!1)),r},e.pluginName="control",e}(),ux="lf:defaultNodeMenu",dx="lf:defaultEdgeMenu",cx="lf:defaultGraphMenu",hx="lf:defaultSelectionMenu",px={nodeMenu:ux,edgeMenu:dx,graphMenu:cx,selectionMenu:hx},fx={nodeMenu:[],edgeMenu:[],graphMenu:[],selectionMenu:[]},gx=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;fx.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(ux,fx.nodeMenu),fx.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(dx,fx.edgeMenu),fx.graphMenu=[],fx.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(hx,fx.selectionMenu)},e.prototype.showMenu=function(e,t,n,i){if(!this.__isSilentMode&&n&&n.length){var r=this.__menuDOM;if(r){if(r.innerHTML="",r.append.apply(r,_([],N(this.__getMenuDom(n)),!1)),!r.children.length)return;if(r.style.display="block",!i)return r.style.top="".concat(t,"px"),void(r.style.left="".concat(e,"px"));var o=i.width,a=i.height,s=i.clientX,l=i.clientY,u=this.lf.graphModel,d=r.offsetWidth,c=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,p=h-s,f=u.rootEl.getBoundingClientRect(),g=f.left+f.width;g<h&&(p=g-s),p<d&&(c=!1),r.style.left="".concat(c?e:e-o,"px");var v=r.offsetHeight,m=!0,y=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=y-l,x=f.top+f.height;x<y&&(b=x-l),b<v&&(m=!1),r.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 r,o,a,s,l=e[i],u=px[i];if(void 0!==l)if("set"===t)null===(r=n.menuTypeMap)||void 0===r||r.set(u,l||[]);else if("add"===t&&Array.isArray(l)){var d=null!==(a=null===(o=n.menuTypeMap)||void 0===o?void 0:o.get(u))&&void 0!==a?a:[];null===(s=n.menuTypeMap)||void 0===s||s.set(u,d.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 r=t;if(r.startsWith("data:image/")){var o=this.createImageElement(r,n||"icon");e.appendChild(o)}else if(this.isImageFile(r)){o=this.createImageElement(r,n||"icon");e.appendChild(o)}else if(r.includes("<")&&r.includes(">"))e.innerHTML=r;else if(r.includes(" ")||r.startsWith(".")){var a=r.replace(/^\./,"").split(" ");(i=e.classList).add.apply(i,_([],N(a),!1))}else e.classList.add(r)}},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 r=document.createElement("span");r.className="lf-menu-item-icon",t.processIcon(r,e.icon,e.text),i.appendChild(r)}var o=document.createElement("span");o.className="lf-menu-item-text",e.text&&(o.innerText=e.text),i.appendChild(o),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,r,o,a,s,l,u,d;if(this.__menuDOM&&"none"!==this.__menuDOM.style.display&&this.__currentData){var c=this.__menuDOM.style,h=c.left,p=c.top,f=[];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);f=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(i=null===(n=this.menuTypeMap)||void 0===n?void 0:n.get(dx))&&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===(r=this.menuTypeMap)||void 0===r?void 0:r.get(v.type);f=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(a=null===(o=this.menuTypeMap)||void 0===o?void 0:o.get(ux))&&void 0!==a?a:[])}}else f="nodes"in this.__currentData&&"edges"in this.__currentData?null!==(l=null===(s=this.menuTypeMap)||void 0===s?void 0:s.get(hx))&&void 0!==l?l:[]:null!==(d=null===(u=this.menuTypeMap)||void 0===u?void 0:u.get(cx))&&void 0!==d?d:[];f&&f.length>0?(this.__menuDOM.innerHTML="",(e=this.__menuDOM).append.apply(e,_([],N(this.__getMenuDom(f)),!1)),h&&(this.__menuDOM.style.left=h),p&&(this.__menuDOM.style.top=p)):(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(px[e]))&&void 0!==n?n:[]},e.prototype.resetMenuConfigByType=function(e){var t;this.setMenuConfig(((t={})[e]=fx[e],t))},e.prototype.resetAllMenuConfig=function(){this.setMenuConfig(fx)},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,r;if(e&&t){var o=null!==(r=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(px[e]))&&void 0!==r?r:[];if(o.length){var a=o.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,r=e.data,o=e.position,a=e.e,s=o.domOverlayPosition,l=s.x,u=s.y,d=r.id,c=n.lf.graphModel.getNodeModelById(d);if(c&&!n.__isSilentMode){var h=[],p=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(c.type);h=c&&c.menu&&Array.isArray(c.menu)?c.menu:p||(null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(ux)),n.__currentData=r,n.showMenu(l,u,h,{width:c.width,height:c.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(e){var t,i,r,o=e.data,a=e.position,s=e.e,l=a.domOverlayPosition,u=l.x,d=l.y,c=o.id,h=n.lf.graphModel.getEdgeModelById(c);if(h&&!n.__isSilentMode){var p=[],f=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(h.type);p=h&&h.menu&&Array.isArray(h.menu)?h.menu:f||(null!==(r=null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(dx))&&void 0!==r?r:[]),n.__currentData=o,n.showMenu(u,d,p,{width:h.width,height:h.height,clientX:s.clientX,clientY:s.clientY})}})),this.lf.on("blank:contextmenu",(function(e){var t,i,r=e.position;if(!n.__isSilentMode){var o=null!==(i=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(cx))&&void 0!==i?i:[],a=r.domOverlayPosition,s=a.x,l=a.y;n.__currentData=y({},r.canvasOverlayPosition),n.showMenu(s,l,o)}})),this.lf.on("selection:contextmenu",(function(e){var t,i=e.data,r=e.position;if(!n.__isSilentMode){var o=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(hx),a=r.domOverlayPosition,s=a.x,l=a.y;n.__currentData=i,n.showMenu(s,l,o)}})),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}(),vx="menu-common",mx=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(vx,[]),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(vx,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 r=t.getData();n=Math.max(r.startPoint.x,n),i=Math.min(r.startPoint.y,i),n=Math.max(r.endPoint.x,n),i=Math.min(r.endPoint.y,i),r.pointsList&&r.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=_(_([],N(this.menuTypeMap.get(this._activeData.type)||[]),!1),N(this.menuTypeMap.get(vx)||[]),!1),n=document.createDocumentFragment();t.forEach((function(t){var i=document.createElement("div");i.className="lf-context-item";var r=document.createElement("img");r.src=t.icon,r.className="lf-context-img",t.className&&(i.className="".concat(i.className," ").concat(t.className)),r.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(r),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 r=e.x-i.width+200,o=t-e.y/2-20,a=e.x+i.width+200,s=t+e.y/2+20;if(this.lf.getAreaElement([r,o],[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,d=void 0;n&&(u={x:e.x,y:e.y+i.height/2},d={x:l.x-l.width/2,y:l.y}),this.lf.addEdge({sourceNodeId:e.sourceId,targetNodeId:l.id,startPoint:u,endPoint:d})}}},e.prototype.showMenu=function(){var e=this.getContextMenuPosition();if(e){var t=N(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}(),yx=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.panelEl.addEventListener("touchmove",(function(e){e.preventDefault()}),{passive:!1}),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 r=document.createElement("div");r.innerText=e.label,r.className="lf-dnd-text",n.appendChild(r)}return e.disabled?(n.classList.add("disabled"),n.onpointerdown=function(){e.callback&&e.callback(t.lf,t.domContainer)},n):(n.onpointerdown=function(n){e.type&&t.lf.dnd.startDrag({type:e.type,properties:e.properties,text:e.text}),e.callback&&e.callback(t.lf,t.domContainer),n.preventDefault()},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}(),bx=function(){function e(e){var t=e.lf,n=e.LogicFlow,i=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&&(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("pointermove",r.drag),document.addEventListener("pointerup",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("pointermove",r.drag),document.removeEventListener("pointerup",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=n,i&&this.setOption(i),this.viewPortWidth=t.graphModel.width,this.viewPortHeight=t.graphModel.height;var o={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=o,this.elementAreaBounds=o,this.viewPortBounds=o}return e.prototype.setOption=function(e){var t=e.width,n=void 0===t?200:t,i=e.height,r=void 0===i?150:i,o=e.showEdge,a=void 0!==o&&o,s=e.isShowHeader,l=void 0!==s&&s,u=e.isShowCloseIcon,d=void 0!==u&&u,c=e.leftPosition,h=e.topPosition,p=e.rightPosition,f=void 0===p?0:p,g=e.bottomPosition,v=void 0===g?0:g,m=e.headerTitle,y=void 0===m?"导航":m;this.width=n,this.height=r,this.showEdge=a,this.isShowHeader=l,this.isShowCloseIcon=d,this.leftPosition=c,this.rightPosition=void 0!==c?void 0:f,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 r=document.createElement("div");r.className="lf-mini-map-header",r.innerText=this.headerTitle,i.appendChild(r);var o=document.createElement("span");o.className="lf-mini-map-close",o.addEventListener("click",this.hide),i.appendChild(o)},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,r=e.x,o=e.y,a=null!==(n=e.width)&&void 0!==n?n:200,s=null!==(i=e.height)&&void 0!==i?i:200,l=r-a/2,u=r+a/2,d=o-s/2,c=o+s/2;t.left=Math.min(l,t.left),t.right=Math.max(u,t.right),t.top=Math.min(d,t.top),t.bottom=Math.max(c,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,r=e.SCALE_Y,o=this.lf.graphModel,a=o.width,s=o.height;this.viewPortBounds={left:-t/i,right:(-t+a)/i,top:-n/r,bottom:(-n+s)/r}},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(),r=this.resetData(i),o=this.lf.viewMap,a=this.lf.graphModel.modelMap,s=this.lfMap.viewMap;try{for(var l=C(o.keys()),u=l.next();!u.done;u=l.next()){var d=u.value;s.has(d)||this.lfMap.register({type:d,view:o.get(d),model:a.get(d)})}}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(r),this.updateBounds(r)}else this.updateBounds();var c=this.bounds,h=c.left,p=c.top,f=c.right-h,g=c.bottom-p,v=this.width/f,m=this.height/g,y=Math.min(v,m);this.scale=y;var b=h-(this.width/y-f)/2,x=p-(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,r=t.SCALE_X,o=t.SCALE_Y,a=this.lf.graphModel,s=a.width,l=a.height;this.viewPortLeft=-n/r,this.viewPortTop=-i/o,this.viewPortWidth=s/r*this.scale,this.viewPortHeight=l/o*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.style.touchAction="none",e.addEventListener("pointerdown",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}(),xx=function(){function e(e){var t,n=e.lf,i=e.options,r=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;r.handleMouseDown(t)},this.draw=function(e){if(r.lf.graphModel.editConfigModel.isPinching)return r.lf.updateEditConfig({stopMoveGraph:r.originalStopMoveGraph}),r.originStatusSaved=!1,void r.cleanupSelectionState();var t=r.lf.getPointByClient(e.clientX,e.clientY).domOverlayPosition,n=t.x,i=t.y;if(r.endPoint={x:n,y:i},r.startPoint){var o=r.startPoint,a=o.x,s=o.y,l=a,u=s,d=n-a,c=i-s;n<a&&(l=n,d=a-n),i<s&&(u=i,c=s-i),r.wrapper&&(r.wrapper.style.left="".concat(l,"px"),r.wrapper.style.top="".concat(u,"px"),r.wrapper.style.width="".concat(d,"px"),r.wrapper.style.height="".concat(c,"px"))}},this.drawOff=function(e){if(r.lf.updateEditConfig({stopMoveGraph:r.originalStopMoveGraph}),r.originStatusSaved=!1,r.mouseDownInfo){var t=r.mouseDownInfo,n=t.x,i=t.y,o=t.time;if(Math.abs(e.clientX-n)<5&&Math.abs(e.clientY-i)<5&&Date.now()-o<200)return r.lf.clearSelectElements(),void r.cleanupSelectionState()}var a=Fs(r.startPoint),s=Fs(r.endPoint);if(document.removeEventListener("pointermove",r.draw),r.exclusiveMode||document.removeEventListener("pointerup",r.drawOff),a&&s){n=a.x,i=a.y;var l=s.x,u=s.y,d=[Math.min(n,l),Math.min(i,u)],c=[Math.max(n,l),Math.max(i,u)];if(r.lf.emit("selection:selected-area",{topLeft:d,bottomRight:c}),Math.abs(l-n)<10&&Math.abs(u-i)<10)return void(r.wrapper&&(r.wrapper.oncontextmenu=null,r.container&&r.wrapper.parentNode===r.container&&r.container.removeChild(r.wrapper),r.wrapper=void 0));var h=r.lf.graphModel.getAreaElement(d,c,r.isWholeEdge,r.isWholeNode,!0),p=r.lf.graphModel,f=p.dynamicGroup,g=p.group,v=[],m=r.lf.getSelectElements(),y=new Set(_(_([],N(m.nodes.map((function(e){return e.id}))),!1),N(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(f){t=f.getGroupByNodeId(e.id);if(h.includes(t))return}r.exclusiveMode&&y.has(e.id)?r.lf.deselectElementById(e.id):(r.lf.selectElementById(e.id,!0),v.push(e))})),r.startPoint=void 0,r.endPoint=void 0,v.length>0&&r.lf.emit("selection:drop",{e:e}),r.lf.emit("selection:selected",{elements:v,leftTopPoint:d,rightBottomPoint:c})}r.wrapper&&(r.wrapper.oncontextmenu=null,r.container&&r.wrapper.parentNode===r.container&&r.container.removeChild(r.wrapper),r.wrapper=void 0)},this.lf=n,this.exclusiveMode=null!==(t=null==i?void 0:i.exclusiveMode)&&void 0!==t&&t,n.openSelectionSelect=function(){r.openSelectionSelect()},n.closeSelectionSelect=function(){r.closeSelectionSelect()},n.setSelectionSelectMode=function(e){r.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("pointermove",this.draw),document.removeEventListener("pointerup",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.style.touchAction="none",this.container.addEventListener("pointerdown",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("pointerdown",this.handleMouseDown)),this.lf.off("blank:mousedown",this.handleBlankMouseDown)},e.prototype.handleMouseDown=function(e){var t;if(this.container&&!this.disabled&&!(this.lf.graphModel.editConfigModel.isPinching||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,r=n.y;this.startPoint={x:i,y:r},this.endPoint={x:i,y:r};var o=document.createElement("div");o.className="lf-selection-select",o.oncontextmenu=function(e){e.preventDefault()},o.style.top="".concat(this.startPoint.y,"px"),o.style.left="".concat(this.startPoint.x,"px"),null===(t=this.container)||void 0===t||t.appendChild(o),this.wrapper=o,document.addEventListener("pointermove",this.draw),document.addEventListener("pointerup",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 PointerEvent("pointerup",{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}(),Ex=function(e,t){var n=[],i=[],r=function(e,i,o){e&&(o&&i.unshift.apply(i,_([],N(t.getEdgeModels({sourceNodeId:e.id,targetNodeId:null==o?void 0:o.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){r(t,i.slice(),e)})):n.push(i)))},o=function(e,n,r){e&&(r&&n.push.apply(n,_([],N(t.getEdgeModels({sourceNodeId:null==r?void 0:r.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){o(t,n.slice(),e)})):i.push(n)))};return r(e,[]),o(e,[]),_([],N(new Set(_(_([],N(n.flat()),!1),N(i.flat()),!1))),!1)},wx=function(){function e(e){var t=e.lf,n=e.options;this.mode="path",this.enable=!0,this.tempStyles={};var i=n.mode,r=void 0===i?"path":i,o=n.enable,a=void 0===o||o;this.lf=t,this.mode=r,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 r=n.incoming,o=r.nodes,a=r.edges,s=n.outgoing,l=s.nodes,u=s.edges;Ws(o,l).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),Ws(a,u).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),i=Kp(Ws(i,o,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 Ex("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]=y({},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(y({},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}(),Cx={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function Nx(e,t,n,i){var r,o=function(e,t){var n=t[0]-e[0],i=t[1]-e[1],r=Math.abs(n),o=Math.abs(i);return o<=1&&r>1?n<0?"l":"r":r<=1&&o>1?i<0?"t":"b":r<=1&&o<=1?"":r<o?n<0?"l":"r":i<0?"t":"b"},a=o(e,t),s=o(t,n),l=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,u="".concat(a).concat(s),d=Cx[u]||"-",c="";if("-"===d)c+="L ".concat(t[0]," ").concat(t[1]);else{var h=N(function(e,t,n,i){var r=[e[0],e[1]],o=[e[0],e[1]];switch(n){case"tl":return"tr"===t?(r[1]+=i,o[0]+=i):"lb"===t&&(r[0]+=i,o[1]+=i),[r,o];case"tr":return"tl"===t?(r[1]+=i,o[0]-=i):"rb"===t&&(r[0]-=i,o[1]+=i),[r,o];case"bl":return"br"===t?(r[1]-=i,o[0]+=i):"lt"===t&&(r[0]+=i,o[1]-=i),[r,o];case"br":return"bl"===t?(r[1]-=i,o[0]-=i):"rt"===t&&(r[0]-=i,o[1]-=i),[r,o];default:return[]}}(t,u,d,l),2),p=h[0],f=h[1];p&&f&&(c+="L ".concat(p[0]," ").concat(p[1]," Q ").concat(t[0]," ").concat(t[1]," ").concat(f[0]," ").concat(f[1]),r=N(f,2),t[0]=r[0],t[1]=r[1])}return c}function _x(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+=Nx(e[n-1],e[n],e[1+n++],t)}i+="L ".concat(e[n][0]," ").concat(e[n][1])}return i}var Sx=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getEdge=function(){var e=this.props.model,n=e.points,i=e.isAnimation,r=e.arrowConfig,o=e.radius,a=void 0===o?5:o,s=e.getEdgeStyle(),l=e.getEdgeAnimationStyle(),u=function(e){for(var t=e,n=1;n<t.length-1;){var i=N(t[n-1],2),r=i[0],o=i[1],a=N(t[n],2),s=a[0],l=a[1],u=N(t[n+1],2),d=u[0],c=u[1];r===s&&s===d||o===l&&l===c?t.splice(n,1):n++}return t}(n.split(" ").map((function(e){return e.split(",").map((function(e){return+e}))}))),d=_x(u,a),c=y(y(y({style:i?l:{}},s),r),{fill:"none"});return t.h("path",y({d:d},c))},n}(t.PolylineEdge),Mx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t}(t.PolylineEdgeModel),Tx=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.id,i=e.x,r=e.y,o=e.width,a=e.height,s=e.properties,l=this.props.model.getNodeStyle();return t.h("svg",{x:i-o/2,y:r-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,r=e.width,o=e.height,a=e.id,s=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",y(y({},s),{x:n-r/2,y:i-o/2,width:r,height:o,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(e){this.props.graphModel.deleteNode(e)},n}(t.PolygonNode),Ax=function(e){function t(){var t=e.apply(this,_([],N(arguments),!1))||this;return t.d=10,t.isResize=!1,t}return m(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,r=1/0,o=-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,d=n.y;i=Math.min(i,u-s/2-t.d),r=Math.min(r,d-l/2-t.d),o=Math.max(o,u+s/2+t.d),a=Math.max(a,d+l/2+t.d)}})),n.push([i,r],[o,r],[o,a],[i,a]),[i,r,o,a].some((function(e){return Math.abs(e)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(o+i)/2,y:(a+r)/2}))},t.prototype.resize=function(t){var n;this.isResize=!0;for(var i=t.width,r=t.height,o=i/this.width,a=r/this.height,s=(this.properties.node_selection_ids||[]).slice(),l=[],u=new Set;s.length;){var d=s.shift(),c=null===(n=this.graphModel.nodesMap[d])||void 0===n?void 0:n.model;c&&(Dx(c)?u.has(c.id)||(u.add(c.id),s.push.apply(s,_([],N(c.properties.node_selection_ids||[]),!1))):l.push(c))}var h=this.x-this.width/2,p=this.y-this.height/2,f=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*o,e.height=e.height*a;var t=(e.x-h)*o+g-e.x,n=(e.y-p)*a+v-e.y;e.move(t,n,!0)})),this.isResize=!1,f},t}(t.PolygonNodeModel),Ox="node-selection",kx=function(){function e(e){var t=e.lf;this.selectNodes=[],this.d=10,this.lf=t,t.register({type:Ox,view:Tx,model:Ax})}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=Wr(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!!Dx(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!==Ox){t.currentClickNode=n.data;var r=!1;t.selectNodesIds.includes(n.data.id)&&(null===(i=t.lf.getNodeModelById(n.data.id))||void 0===i||i.setSelected(!1),r=!0);var o=e.getSelectElements(!0).nodes;t.selectNodes=o,1===t.selectNodes.length?r?t.updateNodeSelection():t.addNodeSelection():t.selectNodes.length>1&&t.updateNodeSelection()}})),e.graphModel.addNodeMoveRules((function(n,i,r){if(t.onNodeChange(e,n),Dx(n)&&!n.isResize){var o=n.properties.node_selection_ids||[];return e.graphModel.moveNodes(o,i,r,!0),!0}return!0})),e.graphModel.addNodeResizeRules((function(n){return Dx(n)||t.onNodeChange(e,n),!0}))},e.pluginName="node-selection",e}(),Dx=function(e){return!(!e||e.type!==Ox)},Rx=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=e.properties;return t.h("text",{x:n-r/2+5,y:i-o/2+16,fontSize:12,fill:"blue"},a.moreText)},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,r=e.width,o=e.height,a=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",y(y({},a),{fill:"#FFFFFF",x:n-r/2,y:i-o/2})),this.getLabelShape()])},n}(t.RectNode),Px={pluginName:"rectLabelNode",install:function(e){e.register({type:"rect-label",model:t.RectNodeModel,view:Rx})}};e.AutoLayout=ax,e.BPMNAdapter=Jg,e.BPMNBaseAdapter=$g,e.BPMNElements=cg,e.BoundaryEventFactory=_e,e.BpmnAdapter=ge,e.BpmnElement=q,e.BpmnXmlAdapter=ve,e.ContextMenu=mx,e.Control=lx,e.CurvedEdge=Sx,e.CurvedEdgeModel=Mx,e.DEFAULT_SENSOR_OUTLINE=Uy,e.DiamondResize=Xf,e.DiamondResizeModel=Uf,e.DiamondResizeView=Vf,e.DndPanel=yx,e.DynamicGroup=sb,e.DynamicGroupNode=ib,e.DynamicGroupNodeModel=Gy,e.EllipseResize=Gf,e.EllipseResizeModel=Ff,e.EllipseResizeView=Wf,e.EndEventFactory=we,e.EndEventModel=D,e.EndEventView=R,e.ExclusiveGatewayModel=j,e.ExclusiveGatewayView=z,e.FlowPath=nx,e.GatewayNodeFactory=je,e.Group=rg,e.GroupNode=tg,e.GroupNodeModel=eg,e.Highlight=wx,e.HtmlResize=Yf,e.HtmlResizeModel=qf,e.HtmlResizeView=Kf,e.InsertNodeInPolyline=xb,e.IntermediateCatchEventFactory=Ce,e.IntermediateThrowEventFactory=Se,e.Label=qb,e.LaneNode=hb,e.Menu=gx,e.MiniMap=bx,e.NODE_ADD_DROP_DND_EVENTS=r,e.NODE_DRAG_EVENTS=i,e.NodeResize=Jf,e.NodeSelection=kx,e.PoolElements=pb,e.PoolNode=cb,e.ProximityConnect=sx,e.RectLabelNode=Px,e.RectResize=$f,e.RectResizeModel=Qf,e.RectResizeView=Zf,e.SelectionSelect=xx,e.SequenceFlowModel=I,e.SequenceFlowView=L,e.ServiceTaskModel=F,e.ServiceTaskView=W,e.Snapshot=tx,e.StartEventFactory=Ne,e.StartEventModel=A,e.StartEventView=O,e.SubProcessFactory=og,e.TaskNodeFactory=He,e.UserTaskModel=U,e.UserTaskView=V,e.bpmnUtils=Ee,e.convertNormalToXml=Vg,e.convertXmlToNormal=Xg,e.dynamicGroup=ob,e.escapeXml=J,e.gateway={exclusive:0,inclusive:1,parallel:2},e.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],e.getCurvedEdgePath=_x,e.handleAttributes=$,e.icons=Be,e.lfJson2Xml=ne,e.lfXml2Json=oe,e.multiInstanceIcon=ze,e.sequenceFlowFactory=sg,e.toLogicflowData=function(e){var t={nodes:[],edges:[]},n=e.flowElementList;return n&&n.length>0&&n.forEach((function(e){if(e.type===ev.SEQUENCE_FLOW){var n=function(e){var t=e.incoming,n=e.outgoing,i=e.properties,r=e.key,o=e.type,a=i.text,s=i.name,l=i.startPoint,u=i.endPoint,d=i.pointsList,c={id:r,type:tv[o],sourceNodeId:t[0],targetNodeId:n[0],text:a||s,properties:{}};l&&(c.startPoint=JSON.parse(l)),u&&(c.endPoint=JSON.parse(u)),d&&(c.pointsList=JSON.parse(d));var h=["startPoint","endPoint","pointsList","text"];return Object.keys(e.properties).forEach((function(t){-1===h.indexOf(t)&&(c.properties[t]=e.properties[t])})),c}(e);t.edges.push(n)}else{var i=function(e){var t=e.properties,n=e.key,i=e.type,r=e.bounds,o=t.x,a=t.y,s=t.text;if(void 0===o){var l=N(r,2),u=l[0],d=u.x,c=u.y,h=l[1];o=(d+h.x)/2,a=(c+h.y)/2}var p={id:n,type:tv[i],x:o,y:a,text:s,properties:{}},f=["x","y","text"];return Object.keys(e.properties).forEach((function(t){-1===f.indexOf(t)&&(p.properties[t]=e.properties[t])})),p}(e);t.nodes.push(i)}})),t},e.toNormalJson=de,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,r=e.y,o=e.text,a=void 0===o?"":o,s=e.properties;return{incoming:[],outgoing:[],dockers:[],type:nv(n),properties:y(y({},s),{name:a&&a.value||"",x:i,y:r,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,r=e.targetNodeId,o=e.startPoint,a=e.endPoint,s=e.pointsList,l=e.text,u=void 0===l?"":l,d=e.properties;return{incoming:[i],outgoing:[r],type:nv(n),dockers:[],properties:y(y({},d),{name:u&&u.value||"",text:u,startPoint:JSON.stringify(o),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=ue,e.useDefinition=dg}));
|
|
2
2
|
//# sourceMappingURL=index.min.js.map
|