@logicflow/extension 2.2.0-alpha.6 → 2.2.0-alpha.7
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +6 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/bpmn-elements-adapter/json2xml.d.ts +2 -1
- package/es/bpmn-elements-adapter/json2xml.js +18 -4
- package/es/bpmn-elements-adapter/xml2json.js +2 -7
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/pool/LaneModel.d.ts +90 -0
- package/es/pool/LaneModel.js +252 -0
- package/es/pool/LaneView.d.ts +40 -0
- package/es/pool/LaneView.js +202 -0
- package/es/pool/PoolModel.d.ts +120 -0
- package/es/pool/PoolModel.js +586 -0
- package/es/pool/PoolView.d.ts +17 -0
- package/es/pool/PoolView.js +76 -0
- package/es/pool/constant.d.ts +15 -0
- package/es/pool/constant.js +17 -0
- package/es/pool/index.d.ts +89 -0
- package/es/pool/index.js +524 -0
- package/es/pool/utils.d.ts +19 -0
- package/es/pool/utils.js +33 -0
- package/lib/bpmn-elements-adapter/json2xml.d.ts +2 -1
- package/lib/bpmn-elements-adapter/json2xml.js +19 -4
- package/lib/bpmn-elements-adapter/xml2json.js +2 -7
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/pool/LaneModel.d.ts +90 -0
- package/lib/pool/LaneModel.js +255 -0
- package/lib/pool/LaneView.d.ts +40 -0
- package/lib/pool/LaneView.js +205 -0
- package/lib/pool/PoolModel.d.ts +120 -0
- package/lib/pool/PoolModel.js +589 -0
- package/lib/pool/PoolView.d.ts +17 -0
- package/lib/pool/PoolView.js +79 -0
- package/lib/pool/constant.d.ts +15 -0
- package/lib/pool/constant.js +20 -0
- package/lib/pool/index.d.ts +89 -0
- package/lib/pool/index.js +527 -0
- package/lib/pool/utils.d.ts +19 -0
- package/lib/pool/utils.js +38 -0
- package/package.json +3 -3
- package/src/bpmn-elements-adapter/json2xml.ts +18 -4
- package/src/bpmn-elements-adapter/xml2json.ts +2 -8
- package/src/dynamic-group/index.ts +0 -1
- package/src/index.ts +2 -0
- package/src/pool/LaneModel.ts +226 -0
- package/src/pool/LaneView.ts +220 -0
- package/src/pool/PoolModel.ts +631 -0
- package/src/pool/PoolView.ts +75 -0
- package/src/pool/constant.ts +19 -0
- package/src/pool/index.ts +621 -0
- package/src/pool/utils.ts +46 -0
- package/stats.html +1 -1
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=40,i=40,o=40,r=40,a=40,s=40,l=100,u=80,d=100,c=80,h={rect:{radius:5,stroke:"rgb(24, 125, 255)"},circle:{r:18,stroke:"rgb(24, 125, 255)"},polygon:{stroke:"rgb(24, 125, 255)"},polyline:{stroke:"rgb(24, 125, 255)",hoverStroke:"rgb(24, 125, 255)",selectedStroke:"rgb(24, 125, 255)"},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"white",height:14,stroke:"transparent",radius:3}}},f=function(e,t){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},f(e,t)};function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var g=function(){return g=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},g.apply(this,arguments)};function v(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}function m(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function y(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function b(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,s[0]&&(a=0)),a;)try{if(n=1,i&&(o=2&s[0]?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function x(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function E(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var C=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),N=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new C;function _(){return N.next()}var S=function(e){function t(t,n){return t.id||(t.id="Event_".concat(_())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),e.call(this,t,n)||this}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedTargetRules=function(){var t=e.prototype.getConnectedTargetRules.call(this);return t.push({message:"起始节点不能作为边的终点",validate:function(){return!1}}),t},t.extendKey="StartEventModel",t}(t.CircleNodeModel),M=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.extendKey="StartEventNode",t}(t.CircleNode),T={type:"bpmn:startEvent",view:M,model:S},A=function(e){function t(t,n){return t.id||(t.id="Event_".concat(_())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),e.call(this,t,n)||this}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedSourceRules=function(){var t=e.prototype.getConnectedSourceRules.call(this);return t.push({message:"结束节点不能作为边的起点",validate:function(){return!1}}),t},t.extendKey="EndEventModel",t}(t.CircleNodeModel),k=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},n.prototype.getShape=function(){var n=this.props.model,i=n.getNodeStyle(),o=n,r=o.x,a=o.y,s=o.r,l=e.prototype.getShape.call(this);return t.h("g",{},l,t.h("circle",g(g({},i),{cx:r,cy:a,r:s-5})))},n.extendKey="EndEventView",n}(t.CircleNode),R={type:"bpmn:endEvent",view:k,model:A},D=function(e){function t(t,n){return t.id||(t.id="Flow_".concat(_())),e.call(this,t,n)||this}return p(t,e),t.extendKey="SequenceFlowModel",t}(t.PolylineEdgeModel),O=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.extendKey="SequenceFlowEdge",t}(t.PolylineEdge),P={type:"bpmn:sequenceFlow",view:O,model:D},I=function(e){function t(t,n){var i=this;return t.id||(t.id="Gateway_".concat(_())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),(i=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],i}return p(t,e),t.extendKey="ExclusiveGatewayModel",t}(t.PolygonNodeModel),L=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getShape=function(){var e=this.props.model,n=e,i=n.x,o=n.y,r=n.width,a=n.height,s=n.points,l=e.getNodeStyle();return t.h("g",{transform:"matrix(1 0 0 1 ".concat(i-r/2," ").concat(o-a/2,")")},t.h("polygon",g(g({},l),{x:i,y:o,points:s})),t.h("path",g({d:"m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z"},l)))},n.extendKey="ExclusiveGatewayNode",n}(t.PolygonNode),B={type:"bpmn:exclusiveGateway",view:L,model:I},j=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(_())),e.call(this,t,n)||this}return p(t,e),t.extendKey="ServiceTaskModel",t}(t.RectNodeModel),F=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-o/2+5,y:i-r/2+5,width:30,height:30,viewBox:"0 0 1274 1024"},t.h("path",{fill:a.stroke,d:"M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z"}))},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",g({x:n-o/2,y:i-r/2,rx:a,ry:a,width:o,height:r},s)),this.getLabelShape()])},n.extendKey="ServiceTaskNode",n}(t.RectNode),H={type:"bpmn:serviceTask",view:F,model:j},W=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(_())),e.call(this,t,n)||this}return p(t,e),t.extendKey="UserTaskModel",t}(t.RectNodeModel),z=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getNodeStyle();return t.h("svg",{x:n-o/2+5,y:i-r/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},t.h("path",{fill:a.stroke,d:"M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z"}))},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.radius,s=e.getNodeStyle();return t.h("g",{},[t.h("rect",g(g({},s),{x:n-o/2,y:i-r/2,rx:a,ry:a,width:o,height:r})),this.getLabelShape()])},n.extendKey="UserTaskNode",n}(t.RectNode),G={type:"bpmn:userTask",view:z,model:W},U={pluginName:"bpmnElement",install:function(e){e.setTheme(h),e.register(T),e.register(R),e.register(B),e.register(G),e.register(H),e.options.customBpmnEdge||(e.register(P),e.setDefaultEdgeType("bpmn:sequenceFlow"))}},q=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),X=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new q;function V(){return X.next()}function K(e){return Object.prototype.toString.call(e)}function Y(e){var t=e;return"[object Object]"===K(e)?(t={},Object.keys(e).forEach((function(n){var i=n;"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=Y(e[n])}))):Array.isArray(e)&&(t=[],e.forEach((function(e,n){t[n]=Y(e)}))),t}function $(e){return null==e?"":e.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Z="\t\n";function J(e,t,n){var i=function(e){return" ".repeat(e)}(n);if(0!==e&&!1!==e&&!e)return Z+i+"<".concat(t," />");var o="";if("#text"===t)return Z+i+$(String(e));if("#cdata-section"===t)return Z+i+"<![CDATA["+e+"]]>";if("#comment"===t)return Z+i+"\x3c!--"+e+"--\x3e";if("-"==="".concat(t).charAt(0))return" "+t.substring(1)+'="'+function(e){var t=e;try{"string"!=typeof t&&(t=JSON.parse(e))}catch(n){t=JSON.stringify(Y(e)).replace(/"/g,"'")}return $(String(t))}(e)+'"';if(Array.isArray(e))e.forEach((function(e){o+=J(e,t,n+1)}));else if("[object Object]"===K(e)){var r=Object.keys(e),a="",s="";o+=(0===n?"":Z+i)+"<"+t,r.forEach((function(t){"-"===t.charAt(0)?a+=J(e[t],t,n+1):s+=J(e[t],t,n+1)})),o+=a+(""!==s?">".concat(s).concat(Z+i,"</").concat(t,">"):" />")}else o+=Z+i+"<".concat(t,">").concat($(String(e)),"</").concat(t,">");return o}function Q(e){var t="";for(var n in e)t+=J(e[n],n,0);return t}var ee=function(){};(ee.ObjTree=function(){return this}).VERSION="0.23",ee.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',ee.ObjTree.prototype.attr_prefix="-",ee.ObjTree.prototype.parseXML=function(e){var t;if(window.DOMParser){var n=new DOMParser,i=n.parseFromString(e,"application/xml");if(!i)return;t=i.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(e),t=n.documentElement);if(t)return this.parseDOM(t)},ee.ObjTree.prototype.parseHTTP=function(e,t,n){var i,o={};for(var r in t)o[r]=t[r];if(o.method||(void 0===o.postBody&&void 0===o.postbody&&void 0===o.parameters?o.method="get":o.method="post"),n){o.asynchronous=!0;var a=this,s=n,l=o.onComplete;o.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else o.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)o.uri=e,(u=new HTTP.Request(o))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,o))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},ee.ObjTree.prototype.parseDOM=function(e){if(e){if(this.__force_array={},this.force_array)for(var t=0;t<this.force_array.length;t++)this.__force_array[this.force_array[t]]=1;var n=this.parseElement(e);if(this.__force_array[e.nodeName]&&(n=[n]),11!=e.nodeType){var i={};i[e.nodeName]=n,n=i}return n}},ee.ObjTree.prototype.parseElement=function(e){if(7!=e.nodeType){if(3==e.nodeType||4==e.nodeType||8==e.nodeType){if(null==e.nodeValue.match(/[^\x00-\x20]/))return;return e.nodeValue}var t=null,n={};if(e.attributes&&e.attributes.length){t={};for(var i=0;i<e.attributes.length;i++){if("string"==typeof(s=e.attributes[i].nodeName)){var o=e.attributes[i].nodeValue;try{o=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){o=e.attributes[i].nodeValue}o&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}if(e.childNodes&&e.childNodes.length){var r=!0;t&&(r=!1);for(i=0;i<e.childNodes.length&&r;i++){var a=e.childNodes[i].nodeType;3!=a&&4!=a&&8!=a&&(r=!1)}if(r){t||(t="");for(i=0;i<e.childNodes.length;i++)t+=e.childNodes[i].nodeValue}else{t||(t={});for(i=0;i<e.childNodes.length;i++){var s;if("string"==typeof(s=e.childNodes[i].nodeName))(o=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}else null===t&&(t={});return t}},ee.ObjTree.prototype.addNode=function(e,t,n,i){this.__force_array[t]?(1==n&&(e[t]=[]),e[t][e[t].length]=i):1==n?e[t]=i:2==n?e[t]=[e[t],i]:e[t][e[t].length]=i},ee.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},ee.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var o in t)if(t.hasOwnProperty(o)){var r=t[o];o.charAt(0)!=this.attr_prefix?void 0===r||null==r?n[n.length]="<"+o+" />":"object"==typeof r&&r.constructor==Array?n[n.length]=this.array_to_xml(o,r):n[n.length]="object"==typeof r?this.hash_to_xml(o,r):this.scalar_to_xml(o,r):i[i.length]=" "+o.substring(1)+'="'+this.xml_escape(r)+'"'}var a=i.join(""),s=n.join("");return void 0===e||null==e||(s=n.length>0?s.match(/\n/)?"<"+e+a+">\n"+s+"</"+e+">\n":"<"+e+a+">"+s+"</"+e+">\n":"<"+e+a+" />\n"),s},ee.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var o=t[i];void 0===o||null==o?n[n.length]="<"+e+" />":"object"==typeof o&&o.constructor==Array?n[n.length]=this.array_to_xml(e,o):n[n.length]="object"==typeof o?this.hash_to_xml(e,o):this.scalar_to_xml(e,o)}return n.join("")},ee.ObjTree.prototype.scalar_to_xml=function(e,t){return"#text"==e?this.xml_escape(t):"<"+e+">"+this.xml_escape(t)+"</"+e+">\n"},ee.ObjTree.prototype.xml_escape=$;var te,ne=function(e){return(new ee.ObjTree).parseXML(e)};!function(e){e.START="bpmn:startEvent",e.END="bpmn:endEvent",e.GATEWAY="bpmn:exclusiveGateway",e.USER="bpmn:userTask",e.SYSTEM="bpmn:serviceTask",e.FLOW="bpmn:sequenceFlow"}(te||(te={}));var ie=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef"],oe=["properties","startPoint","endPoint","pointsList"],re=function(e){return String(e||"").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'")};function ae(e){var t=e?oe.concat(e):oe;return function(e){return function e(n){var i={};return"string"==typeof n?n:Array.isArray(n)?n.map((function(t){return e(t)})):(Object.entries(n).forEach((function(n){var o=w(n,2),r=o[0],a=o[1];"object"!=typeof a?0===r.indexOf("-")||["#text","#cdata-section","#comment"].includes(r)?i[r]=a:i["-".concat(r)]=a:t.includes(r)?i["-".concat(r)]=e(a):i[r]=e(a)})),i)}(e)}}function se(e){var t={};return Object.entries(e).forEach((function(e){var n=w(e,2),i=n[0],o=n[1];0===i.indexOf("-")?t[i.substring(1)]=Y(o):"string"==typeof o?t[i]=o:"[object Object]"===Object.prototype.toString.call(o)?t[i]=se(o):Array.isArray(o)?t[i]=o.map((function(e){return se(e)})):t[i]=o})),t}function le(e,t){e["bpmndi:BPMNEdge"]=t.edges.map((function(e){var t,n=e.id,i=e.pointsList.map((function(e){return{"-x":e.x,"-y":e.y}})),o={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(o["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),o})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,o=80,r=e.x,a=e.y,s=he.shapeConfigMap.get(e.type);s&&(i=s.width,o=s.height),r-=i/2,a-=o/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":r,"-y":a,"-width":i,"-height":o}};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(l["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),l}))}function ue(e){var t=[],n=[],i=e["bpmn:definitions"];if(i){var o=i["bpmn:process"],r=i["bpmndi:BPMNDiagram"],a=null==r?void 0:r["bpmndi:BPMNPlane"];if(!o||!a)return{nodes:t,edges:n};Object.keys(o).forEach((function(e){if(0===e.indexOf("bpmn:")){var i=o[e];if(e===te.FLOW){var r=a["bpmndi:BPMNEdge"],s=(Array.isArray(r),r);n=function(e,t){var n=[];if(Array.isArray(e))e.forEach((function(e){var i;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(ce(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(ce(i,e))}return n}(i,s)}else{var l=a["bpmndi:BPMNShape"],u=(Array.isArray(l),l);t=t.concat(function(e,t,n){var i=[];if(Array.isArray(e))e.forEach((function(e){var o=de(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}));else{var o=de(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}return i}(i,u,e))}}}))}return{nodes:t,edges:n}}function de(e,t,n){var i,o,r=Number(e["dc:Bounds"]["-x"]),a=Number(e["dc:Bounds"]["-y"]),s=re(n["-name"]),l=he.shapeConfigMap.get(t);if(l&&(r+=l.width/2,a+=l.height/2),Object.entries(n).forEach((function(e){var t=w(e,2),n=t[0],o=t[1];-1===ie.indexOf(n)&&(i||(i={}),i[n]=o)})),i&&(i=se(i)),s&&(o={x:r,y:a,value:s},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var u=e["bpmndi:BPMNLabel"]["dc:Bounds"];o.x=Number(u["-x"])+Number(u["-width"])/2,o.y=Number(u["-y"])+Number(u["-height"])/2}var d={id:e["-bpmnElement"],type:t,x:r,y:a,properties:i};return o&&(d.text=o),d}function ce(e,t){var n,i,o=t["-name"]?re("".concat(t["-name"])):"";if(o){var r=void 0;e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"]&&(r=e["bpmndi:BPMNLabel"]["dc:Bounds"]);var a=0;if(o.split("\n").forEach((function(e){a<e.length&&(a=e.length)})),r)n={value:o,x:Number(r["-x"])+10*a/2,y:Number(r["-y"])+7};else{var s=e["di:waypoint"]||[],l=s[0],u=s[s.length-1]||l;n={value:o,x:(Number((null==l?void 0:l["-x"])||0)+Number((null==u?void 0:u["-x"])||0))/2,y:(Number((null==l?void 0:l["-y"])||0)+Number((null==u?void 0:u["-y"])||0))/2}}}Object.entries(t).forEach((function(e){var t=w(e,2),n=t[0],o=t[1];-1===ie.indexOf(n)&&(i||(i={}),i[n]=o)})),i&&(i=se(i));var d={id:t["-id"],type:te.FLOW,pointsList:e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:i};return n&&(d.text=n),d}var he=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i=g({},n.processAttributes);!function(e,t,n){var i=new Map;t.nodes.forEach((function(t){var o,r={"-id":t.id};if((null===(o=t.text)||void 0===o?void 0:o.value)&&(r["-name"]=t.text.value),t.properties){var a=ae(n)(t.properties);Object.assign(r,a)}i.set(t.id,r),e[t.type]?Array.isArray(e[t.type])?e[t.type].push(r):e[t.type]=[e[t.type],r]:e[t.type]=r}));var o=t.edges.map((function(e){var t,o,r=i.get(e.targetNodeId);r["bpmn:incoming"]?Array.isArray(r["bpmn:incoming"])?r["bpmn:incoming"].push(e.id):r["bpmn:incoming"]=[r["bpmn:incoming"],e.id]:r["bpmn:incoming"]=e.id;var a={"-id":e.id,"-sourceRef":e.sourceNodeId,"-targetRef":e.targetNodeId};if((null===(t=e.text)||void 0===t?void 0:t.value)&&(a["-name"]=null===(o=e.text)||void 0===o?void 0:o.value),e.properties){var s=ae(n)(e.properties);Object.assign(a,s)}return a}));t.edges.forEach((function(e){var t=i.get(e.sourceNodeId);t["bpmn:outgoing"]?Array.isArray(t["bpmn:outgoing"])?t["bpmn:outgoing"].push(e.id):t["bpmn:outgoing"]=[t["bpmn:outgoing"],e.id]:t["bpmn:outgoing"]=e.id})),e[te.FLOW]=o}(i,e,t);var o={"-id":"BPMNPlane_1","-bpmnElement":i["-id"]};le(o,e);var r=n.definitionAttributes;return r["bpmn:process"]=i,r["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":o},{"bpmn:definitions":r}},this.adapterIn=function(e){if(e)return ue(e)},t.adapterIn=function(e){return n.adapterIn(e)},t.adapterOut=function(e,t){return n.adapterOut(e,t)},this.processAttributes={"-isExecutable":"true","-id":"Process_".concat(V())},this.definitionAttributes={"-id":"Definitions_".concat(V()),"-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.0"}}return e.prototype.setCustomShape=function(t,n){e.shapeConfigMap.set(t,n)},e.pluginName="bpmn-adapter",e.shapeConfigMap=new Map,e}();he.shapeConfigMap.set(te.START,{width:n,height:i}),he.shapeConfigMap.set(te.END,{width:o,height:r}),he.shapeConfigMap.set(te.GATEWAY,{width:a,height:s}),he.shapeConfigMap.set(te.SYSTEM,{width:l,height:u}),he.shapeConfigMap.set(te.USER,{width:d,height:c});var fe=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t="string"==typeof e?n.sanitizeNameAttributes(e):e,i=ne(t);return n.adapterIn(i)},n.adapterXmlOut=function(e,t){return Q(n.adapterOut(e,t))};var i=t.lf;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n}return p(t,e),t.prototype.sanitizeNameAttributes=function(e){return e.replace(/name="([^"]*)"/g,(function(e,t){var n=t.replace(/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">");return'name="'.concat(n,'"')}))},t.pluginName="bpmnXmlAdapter",t}(he);function pe(){this.targetRules.push({message:"分组外的节点不允许连接分组内的",validate:function(e,t){var n=!!e.properties.parent,i=!!t.properties.parent;return!(!n&&i)}})}var ge=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),ve=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new ge;function me(){return ve.next()}var ye=Object.freeze({__proto__:null,genBpmnId:me,groupRule:pe});function be(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var i,o=this.props.model,r=o.getNodeStyle(),a=o,s=a.x,l=a.y,u=a.r,d=a.width,c=a.height,h=a.properties,f=e.prototype.getShape.call(this),p=h.definitionType,v=((null===(i=n.endEvent)||void 0===i?void 0:i.get(p))||{}).icon,m=Array.isArray(v)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(s-d/2," ").concat(l-c/2,")")}],w(v),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(s-d/2," ").concat(l-c/2,")"),d:v,style:"fill: black; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;"});return t.h("g",{},f,t.h("circle",g(g({},r),{strokeWidth:2,cx:s,cy:l,r:u-2})),m)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.endEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=g(g({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),o=e.call(this,t,i)||this,pe.call(o),o}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedSourceRules=function(){var t=this,n=e.prototype.getConnectedSourceRules.call(this),i={message:"结束节点不能作为边的起点",validate:function(e,n){return e!==t}};return n.push(i),n},t}(t.CircleNodeModel);return{type:"bpmn:endEvent",view:i,model:o}}function xe(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,d=r.height,c=r.properties.definitionType,h=((null===(e=n.intermediateCatchEvent)||void 0===e?void 0:e.get(c))||{}).icon,f=Array.isArray(h)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],w(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",g(g({},o),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",g(g({},o),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),f)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.intermediateCatchEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=g(g({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),o=e.call(this,t,i)||this,pe.call(o),o}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateCatchEvent",view:i,model:o}}function we(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,d=r.height,c=r.properties,h=c.definitionType,f=c.isInterrupting,p=((null===(e=n.startEvent)||void 0===e?void 0:e.get(h))||{}).icon,v=Array.isArray(p)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],w(p),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:p,style:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"});return t.h("g",{},t.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeDasharray:f?"5,5":"",strokeWidth:2})),v)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var s=((null===(o=n.startEvent)||void 0===o?void 0:o.get(null===(r=t.properties)||void 0===r?void 0:r.definitionType))||{}).properties,l=void 0===s?{}:s;return t.properties=g(g({},l),t.properties),(null===(a=t.properties)||void 0===a?void 0:a.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),e.call(this,t,i)||this}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedTargetRules=function(){var t=this,n=e.prototype.getConnectedTargetRules.call(this),i={message:"起始节点不能作为边的终点",validate:function(e,n){return n!==t}};return n.push(i),n},t}(t.CircleNodeModel);return{type:"bpmn:startEvent",view:i,model:o}}function Ee(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,d=r.height,c=r.properties,h=c.definitionType,f=c.cancelActivity,p=((null===(e=n.boundaryEvent)||void 0===e?void 0:e.get(h))||{}).icon,v=Array.isArray(p)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],w(p),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")"),d:p});return t.h("g",{},t.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeDasharray:f?"":"5,5",strokeWidth:1.5})),t.h("circle",g(g({},o),{cx:a,cy:s,r:l-3,strokeDasharray:f?"":"5,5",strokeWidth:1.5})),v)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.boundaryEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=g(g({attachedToRef:"",cancelActivity:!0},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),o=e.call(this,t,i)||this,pe.call(o),o}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.r=20,this.autoToFront=!1,this.zIndex=99999},t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:boundaryEvent",view:i,model:o}}function Ce(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var e,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,d=r.height,c=r.properties.definitionType,h=((null===(e=n.intermediateThrowEvent)||void 0===e?void 0:e.get(c))||{}).icon,f=Array.isArray(h)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],w(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",g(g({},o),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",g(g({},o),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),f)},i}(t.CircleNode),o=function(e){function t(t,i){var o,r,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(r=n.intermediateThrowEvent)||void 0===r?void 0:r.get(null===(a=t.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return t.properties=g(g({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),o=e.call(this,t,i)||this,pe.call(o),o}return p(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateThrowEvent",view:i,model:o}}var Ne=[t.h("circle",{cx:18,cy:18,r:11,style:"stroke-linecap: round;stroke-linejoin: round;stroke: rgb(34, 36, 42);stroke-width: 2px;fill: white"}),t.h("path",{d:"M 18,18 l 2.25,-7.5 m -2.25,7.5 l 5.25,1.5",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 2px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(0,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(30,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(60,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(90,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(120,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(150,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(180,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(210,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(240,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(270,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(300,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(330,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"})],_e=[t.h("circle",{cx:18,cy:18,r:10,style:"stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 4px; fill: rgb(34, 36, 42);"})],Se="m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z",Me="m 23,10 0,12.5 -12.5,0 0,5 12.5,0 0,12.5 5,0 0,-12.5 12.5,0 0,-5 -12.5,0 0,-12.5 -5,0 z",Te=t.h("circle",{cx:25,cy:25,r:13,style:"stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 2.5px; fill: white;"}),Ae="M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z",ke="M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z",Re="m44,60 m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",De="m47,61 m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",Oe="m 50,73 c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",Pe=Object.freeze({__proto__:null,compensationIcon:"m 7.92,18 9,-6.5 0,13 z m 9.3,-0.4 8.7,-6.1 0,13 -8.7,-6.1 z",conditionalIcon:"M 10.5,8.5 l 14.5,0 l 0,18 l -14.5,0 Z M 12.5,11.5 l 10.5,0 M 12.5,14.5 l 10.5,0 M 12.5,17.5 l 10.5,0 M 12.5,20.5 l 10.5,0 M 12.5,23.5 l 10.5,0 M 12.5,26.5 l 10.5,0 ",errorIcon:"m 7.2,25.991999999999997 0.09350000000000001,-0.025300000000000003 7.3392,-9.610700000000001 7.667000000000001,8.9661 4.7003,-18.2204 -5.8707,11.6501 -7.299600000000001,-9.585400000000002 z",escalationIcon:"M 18,7.2 l 8,20 l -8,-7 l -8,7 Z",exclusiveIcon:Se,inclusiveIcon:Te,linkIcon:"m 20.52,9.468 0,4.4375 -13.5,0 0,6.75 13.5,0 0,4.4375 9.84375,-7.8125 -9.84375,-7.8125 z",loopMarker:Oe,manualTaskIcon:"M0.5,3.751L4.583,0.5009999999999999C4.583,0.5009999999999999,15.749,0.5839999999999999,16.666,0.5839999999999999S14.249,3.5009999999999994,15.166,3.5009999999999994S26.833,3.5009999999999994,27.75,3.5009999999999994C28.916,5.209,27.582,6.667999999999999,26.916,7.167999999999999S27.791,9.084999999999999,25.916,11.584999999999999C25.166,11.834999999999999,26.666,13.459999999999999,24.583000000000002,14.918C23.416,15.501,25.166,16.46,23.333000000000002,17.750999999999998C22.166,17.750999999999998,2.5000000000000036,17.833999999999996,2.5000000000000036,17.833999999999996L0.5000000000000036,16.500999999999998V3.751ZM13.5,7L27,7M13.5,11L26,11M14,14.5L25,14.5M8.2,3.1L15,3.1",messageIcon:"m 8.459999999999999,11.34 l 0,12.6 l 18.900000000000002,0 l 0,-12.6 z l 9.450000000000001,5.4 l 9.450000000000001,-5.4",parallelIcon:Me,parallelMarker:Re,scriptTaskIcon:"M6.402,0.5H20.902C20.902,0.5,15.069,3.333,15.069,6.083S19.486,12.083,19.486,15.25S15.319,20.333,15.319,20.333H0.235C0.235,20.333,5.235,17.665999999999997,5.235,15.332999999999998S0.6520000000000001,8.582999999999998,0.6520000000000001,6.082999999999998S6.402,0.5,6.402,0.5ZM3.5,4.5L13.5,4.5M3.8,8.5L13.8,8.5M6.3,12.5L16.3,12.5M6.5,16.5L16.5,16.5",sequentialMarker:De,serviceTaskIcon:Ae,signalIcon:"M 18,7.2 l 9,16.2 l -18,0 Z",style:{throw:"fill: rgb(34, 36, 42); stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;",catch:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;",nonIntermediate:"stroke-width: 1.5; stroke-dash-array: 6",intermediate:"stroke-width: 1.5"},terminateIcon:_e,timerIcon:Ne,userTaskIcon:ke});function Ie(e,n,i){var o=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getShape=function(){var e=this.props.model,i=e,o=i.x,r=i.y,a=i.width,s=i.height,l=i.points,u=e.getNodeStyle();return t.h("g",{transform:"matrix(1 0 0 1 ".concat(o-a/2," ").concat(r-s/2,")")},t.h(t.Polygon,g(g({},u),{x:o,y:r,points:l})),"string"==typeof n?t.h("path",g(g({d:n},u),{fill:"rgb(34, 36, 42)",strokeWidth:1})):n)},i}(t.PolygonNode);return{type:e,view:o,model:function(e){function t(t,n){var o=this;return t.id||(t.id="Gateway_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),t.properties=g(g({},i||{}),t.properties),(o=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],pe.call(o),o}return p(t,e),t}(t.PolygonNodeModel)}}var Le={parallel:Re,sequential:De,loop:Oe};function Be(e,n,i){var o=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return p(i,e),i.prototype.getLabelShape=function(){var e=this.props.model,i=e.x,o=e.y,r=e.width,a=e.height,s=e.getNodeStyle(),l=Array.isArray(n)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(i-r/2," ").concat(o-a/2,")")}],w(n),!1)):t.h("path",{fill:s.stroke,d:n});return t.h("svg",{x:i-r/2+5,y:o-a/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},l)},i.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.radius,s=e.properties,l=e.getNodeStyle();return t.h("g",{},[t.h("rect",g(g({},l),{x:n-o/2,y:i-r/2,rx:a,ry:a,width:o,height:r,opacity:.95})),this.getLabelShape(),t.h("g",{transform:"matrix(1 0 0 1 ".concat(n-o/2," ").concat(i-r/2,")")},t.h("path",{fill:"white",strokeLinecap:"round",strokeLinejoin:"round",stroke:"rgb(34, 36, 42)",strokeWidth:"2",d:Le[s.multiInstanceType]||""}))])},i}(t.RectNode),r=function(e){function t(t,n){var o,r=this;t.id||(t.id="Activity_".concat(me()));var a=g(g({},i||{}),t.properties);return t.properties=a,r=e.call(this,t,n)||this,null===(o=null==a?void 0:a.boundaryEvents)||void 0===o||o.forEach((function(e){r.addBoundaryEvent(e)})),r.deleteProperty("boundaryEvents"),pe.call(r),r}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.isTaskNode=!0,this.boundaryEvents=[]},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return this.properties.isBoundaryEventTouchingTask&&(t.stroke="#00acff",t.strokeWidth=2),t},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return t.stroke="transparent",!t.hover&&(t.hover={}),t.hover.stroke="transparent",t},t.prototype.setTouching=function(e){this.setProperty("isBoundaryEventTouchingTask",e)},t.prototype.addBoundaryEvent=function(e){if(this.setTouching(!1),this.boundaryEvents.find((function(t){return t===e})))return!1;var t=this.graphModel.getNodeModelById(e);return null==t||t.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(e),!0},t.prototype.deleteBoundaryEvent=function(e){this.boundaryEvents=this.boundaryEvents.filter((function(t){return t!==e}))},t}(t.RectNodeModel);return{type:e,view:o,model:r}}var je="object"==typeof global&&global&&global.Object===Object&&global,Fe="object"==typeof self&&self&&self.Object===Object&&self,He=je||Fe||Function("return this")(),We=He.Symbol,ze=Object.prototype,Ge=ze.hasOwnProperty,Ue=ze.toString,qe=We?We.toStringTag:void 0;var Xe=Object.prototype.toString;var Ve="[object Null]",Ke="[object Undefined]",Ye=We?We.toStringTag:void 0;function $e(e){return null==e?void 0===e?Ke:Ve:Ye&&Ye in Object(e)?function(e){var t=Ge.call(e,qe),n=e[qe];try{e[qe]=void 0;var i=!0}catch(e){}var o=Ue.call(e);return i&&(t?e[qe]=n:delete e[qe]),o}(e):function(e){return Xe.call(e)}(e)}function Ze(e){return null!=e&&"object"==typeof e}var Je="[object Symbol]";function Qe(e){return"symbol"==typeof e||Ze(e)&&$e(e)==Je}var et=NaN;function tt(e){return"number"==typeof e?e:Qe(e)?et:+e}function nt(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o}var it=Array.isArray,ot=1/0,rt=We?We.prototype:void 0,at=rt?rt.toString:void 0;function st(e){if("string"==typeof e)return e;if(it(e))return nt(e,st)+"";if(Qe(e))return at?at.call(e):"";var t=e+"";return"0"==t&&1/e==-ot?"-0":t}function lt(e,t){return function(n,i){var o;if(void 0===n&&void 0===i)return t;if(void 0!==n&&(o=n),void 0!==i){if(void 0===o)return i;"string"==typeof n||"string"==typeof i?(n=st(n),i=st(i)):(n=tt(n),i=tt(i)),o=e(n,i)}return o}}var ut=lt((function(e,t){return e+t}),0),dt=/\s/;function ct(e){for(var t=e.length;t--&&dt.test(e.charAt(t)););return t}var ht=/^\s+/;function ft(e){return e?e.slice(0,ct(e)+1).replace(ht,""):e}function pt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var gt=NaN,vt=/^[-+]0x[0-9a-f]+$/i,mt=/^0b[01]+$/i,yt=/^0o[0-7]+$/i,bt=parseInt;function xt(e){if("number"==typeof e)return e;if(Qe(e))return gt;if(pt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=pt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=ft(e);var n=mt.test(e);return n||yt.test(e)?bt(e.slice(2),n?2:8):vt.test(e)?gt:+e}var wt=1/0,Et=17976931348623157e292;function Ct(e){return e?(e=xt(e))===wt||e===-wt?(e<0?-1:1)*Et:e==e?e:0:0===e?e:0}function Nt(e){var t=Ct(e),n=t%1;return t==t?n?t-n:t:0}function _t(e){return e}var St="[object AsyncFunction]",Mt="[object Function]",Tt="[object GeneratorFunction]",At="[object Proxy]";function kt(e){if(!pt(e))return!1;var t=$e(e);return t==Mt||t==Tt||t==St||t==At}var Rt,Dt=He["__core-js_shared__"],Ot=(Rt=/[^.]+$/.exec(Dt&&Dt.keys&&Dt.keys.IE_PROTO||""))?"Symbol(src)_1."+Rt:"";var Pt=Function.prototype.toString;function It(e){if(null!=e){try{return Pt.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Lt=/^\[object .+?Constructor\]$/,Bt=Function.prototype,jt=Object.prototype,Ft=Bt.toString,Ht=jt.hasOwnProperty,Wt=RegExp("^"+Ft.call(Ht).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function zt(e){return!(!pt(e)||function(e){return!!Ot&&Ot in e}(e))&&(kt(e)?Wt:Lt).test(It(e))}function Gt(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return zt(n)?n:void 0}var Ut=Gt(He,"WeakMap"),qt=Ut&&new Ut,Xt=qt?function(e,t){return qt.set(e,t),e}:_t,Vt=Object.create,Kt=function(){function e(){}return function(t){if(!pt(t))return{};if(Vt)return Vt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Yt(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Kt(e.prototype),i=e.apply(n,t);return pt(i)?i:n}}var $t=1;function Zt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Jt=Math.max;function Qt(e,t,n,i){for(var o=-1,r=e.length,a=n.length,s=-1,l=t.length,u=Jt(r-a,0),d=Array(l+u),c=!i;++s<l;)d[s]=t[s];for(;++o<a;)(c||o<r)&&(d[n[o]]=e[o]);for(;u--;)d[s++]=e[o++];return d}var en=Math.max;function tn(e,t,n,i){for(var o=-1,r=e.length,a=-1,s=n.length,l=-1,u=t.length,d=en(r-s,0),c=Array(d+u),h=!i;++o<d;)c[o]=e[o];for(var f=o;++l<u;)c[f+l]=t[l];for(;++a<s;)(h||o<r)&&(c[f+n[a]]=e[o++]);return c}function nn(){}var on=4294967295;function rn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=on,this.__views__=[]}function an(){}rn.prototype=Kt(nn.prototype),rn.prototype.constructor=rn;var sn=qt?function(e){return qt.get(e)}:an,ln={},un=Object.prototype.hasOwnProperty;function dn(e){for(var t=e.name+"",n=ln[t],i=un.call(ln,t)?n.length:0;i--;){var o=n[i],r=o.func;if(null==r||r==e)return o.name}return t}function cn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function hn(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}function fn(e){if(e instanceof rn)return e.clone();var t=new cn(e.__wrapped__,e.__chain__);return t.__actions__=hn(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}cn.prototype=Kt(nn.prototype),cn.prototype.constructor=cn;var pn=Object.prototype.hasOwnProperty;function gn(e){if(Ze(e)&&!it(e)&&!(e instanceof rn)){if(e instanceof cn)return e;if(pn.call(e,"__wrapped__"))return fn(e)}return new cn(e)}function vn(e){var t=dn(e),n=gn[t];if("function"!=typeof n||!(t in rn.prototype))return!1;if(e===n)return!0;var i=sn(n);return!!i&&e===i[0]}gn.prototype=nn.prototype,gn.prototype.constructor=gn;var mn=Date.now;function yn(e){var t=0,n=0;return function(){var i=mn(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var bn=yn(Xt),xn=/\{\n\/\* \[wrapped with (.+)\] \*/,wn=/,? & /;var En=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function Cn(e){return function(){return e}}var Nn=function(){try{var e=Gt(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_n=Nn?function(e,t){return Nn(e,"toString",{configurable:!0,enumerable:!1,value:Cn(t),writable:!0})}:_t,Sn=yn(_n);function Mn(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););return e}function Tn(e,t,n,i){for(var o=e.length,r=n+(i?1:-1);i?r--:++r<o;)if(t(e[r],r,e))return r;return-1}function An(e){return e!=e}function kn(e,t,n){return t==t?function(e,t,n){for(var i=n-1,o=e.length;++i<o;)if(e[i]===t)return i;return-1}(e,t,n):Tn(e,An,n)}function Rn(e,t){return!!(null==e?0:e.length)&&kn(e,t,0)>-1}var Dn=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function On(e,t,n){var i=t+"";return Sn(e,function(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(En,"{\n/* [wrapped with "+t+"] */\n")}(i,function(e,t){return Mn(Dn,(function(n){var i="_."+n[0];t&n[1]&&!Rn(e,i)&&e.push(i)})),e.sort()}(function(e){var t=e.match(xn);return t?t[1].split(wn):[]}(i),n)))}var Pn=1,In=2,Ln=4,Bn=8,jn=32,Fn=64;function Hn(e,t,n,i,o,r,a,s,l,u){var d=t&Bn;t|=d?jn:Fn,(t&=~(d?Fn:jn))&Ln||(t&=~(Pn|In));var c=[e,t,o,d?r:void 0,d?a:void 0,d?void 0:r,d?void 0:a,s,l,u],h=n.apply(void 0,c);return vn(e)&&bn(h,c),h.placeholder=i,On(h,e,t)}function Wn(e){return e.placeholder}var zn=9007199254740991,Gn=/^(?:0|[1-9]\d*)$/;function Un(e,t){var n=typeof e;return!!(t=null==t?zn:t)&&("number"==n||"symbol"!=n&&Gn.test(e))&&e>-1&&e%1==0&&e<t}var qn=Math.min;var Xn="__lodash_placeholder__";function Vn(e,t){for(var n=-1,i=e.length,o=0,r=[];++n<i;){var a=e[n];a!==t&&a!==Xn||(e[n]=Xn,r[o++]=n)}return r}var Kn=1,Yn=2,$n=8,Zn=16,Jn=128,Qn=512;function ei(e,t,n,i,o,r,a,s,l,u){var d=t&Jn,c=t&Kn,h=t&Yn,f=t&($n|Zn),p=t&Qn,g=h?void 0:Yt(e);return function v(){for(var m=arguments.length,y=Array(m),b=m;b--;)y[b]=arguments[b];if(f)var x=Wn(v),w=function(e,t){for(var n=e.length,i=0;n--;)e[n]===t&&++i;return i}(y,x);if(i&&(y=Qt(y,i,o,f)),r&&(y=tn(y,r,a,f)),m-=w,f&&m<u){var E=Vn(y,x);return Hn(e,t,ei,v.placeholder,n,y,E,s,l,u-m)}var C=c?n:this,N=h?C[e]:e;return m=y.length,s?y=function(e,t){for(var n=e.length,i=qn(t.length,n),o=hn(e);i--;){var r=t[i];e[i]=Un(r,n)?o[r]:void 0}return e}(y,s):p&&m>1&&y.reverse(),d&&l<m&&(y.length=l),this&&this!==He&&this instanceof v&&(N=g||Yt(N)),N.apply(C,y)}}var ti=1;var ni="__lodash_placeholder__",ii=1,oi=2,ri=4,ai=8,si=128,li=256,ui=Math.min;var di="Expected a function",ci=1,hi=2,fi=8,pi=16,gi=32,vi=64,mi=Math.max;function yi(e,t,n,i,o,r,a,s){var l=t&hi;if(!l&&"function"!=typeof e)throw new TypeError(di);var u=i?i.length:0;if(u||(t&=~(gi|vi),i=o=void 0),a=void 0===a?a:mi(Nt(a),0),s=void 0===s?s:Nt(s),u-=o?o.length:0,t&vi){var d=i,c=o;i=o=void 0}var h=l?void 0:sn(e),f=[e,t,n,i,o,d,c,r,a,s];if(h&&function(e,t){var n=e[1],i=t[1],o=n|i,r=o<(ii|oi|si),a=i==si&&n==ai||i==si&&n==li&&e[7].length<=t[8]||i==(si|li)&&t[7].length<=t[8]&&n==ai;if(!r&&!a)return e;i&ii&&(e[2]=t[2],o|=n&ii?0:ri);var s=t[3];if(s){var l=e[3];e[3]=l?Qt(l,s,t[4]):s,e[4]=l?Vn(e[3],ni):t[4]}(s=t[5])&&(l=e[5],e[5]=l?tn(l,s,t[6]):s,e[6]=l?Vn(e[5],ni):t[6]),(s=t[7])&&(e[7]=s),i&si&&(e[8]=null==e[8]?t[8]:ui(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(f,h),e=f[0],t=f[1],n=f[2],i=f[3],o=f[4],!(s=f[9]=void 0===f[9]?l?0:e.length:mi(f[9]-u,0))&&t&(fi|pi)&&(t&=~(fi|pi)),t&&t!=ci)p=t==fi||t==pi?function(e,t,n){var i=Yt(e);return function o(){for(var r=arguments.length,a=Array(r),s=r,l=Wn(o);s--;)a[s]=arguments[s];var u=r<3&&a[0]!==l&&a[r-1]!==l?[]:Vn(a,l);return(r-=u.length)<n?Hn(e,t,ei,o.placeholder,void 0,a,u,void 0,void 0,n-r):Zt(this&&this!==He&&this instanceof o?i:e,this,a)}}(e,t,s):t!=gi&&t!=(ci|gi)||o.length?ei.apply(void 0,f):function(e,t,n,i){var o=t&ti,r=Yt(e);return function t(){for(var a=-1,s=arguments.length,l=-1,u=i.length,d=Array(u+s),c=this&&this!==He&&this instanceof t?r:e;++l<u;)d[l]=i[l];for(;s--;)d[l++]=arguments[++a];return Zt(c,o?n:this,d)}}(e,t,n,i);else var p=function(e,t,n){var i=t&$t,o=Yt(e);return function t(){return(this&&this!==He&&this instanceof t?o:e).apply(i?n:this,arguments)}}(e,t,n);return On((h?Xt:bn)(p,f),e,t)}var bi=128;function xi(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,yi(e,bi,void 0,void 0,void 0,void 0,t)}function wi(e,t,n){"__proto__"==t&&Nn?Nn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ei(e,t){return e===t||e!=e&&t!=t}var Ci=Object.prototype.hasOwnProperty;function Ni(e,t,n){var i=e[t];Ci.call(e,t)&&Ei(i,n)&&(void 0!==n||t in e)||wi(e,t,n)}function _i(e,t,n,i){var o=!n;n||(n={});for(var r=-1,a=t.length;++r<a;){var s=t[r],l=i?i(n[s],e[s],s,n,e):void 0;void 0===l&&(l=e[s]),o?wi(n,s,l):Ni(n,s,l)}return n}var Si=Math.max;function Mi(e,t,n){return t=Si(void 0===t?e.length-1:t,0),function(){for(var i=arguments,o=-1,r=Si(i.length-t,0),a=Array(r);++o<r;)a[o]=i[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=i[o];return s[t]=n(a),Zt(e,this,s)}}function Ti(e,t){return Sn(Mi(e,t,_t),e+"")}var Ai=9007199254740991;function ki(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Ai}function Ri(e){return null!=e&&ki(e.length)&&!kt(e)}function Di(e,t,n){if(!pt(n))return!1;var i=typeof t;return!!("number"==i?Ri(n)&&Un(t,n.length):"string"==i&&t in n)&&Ei(n[t],e)}function Oi(e){return Ti((function(t,n){var i=-1,o=n.length,r=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(o--,r):void 0,a&&Di(n[0],n[1],a)&&(r=o<3?void 0:r,o=1),t=Object(t);++i<o;){var s=n[i];s&&e(t,s,i,r)}return t}))}var Pi=Object.prototype;function Ii(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Pi)}function Li(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}function Bi(e){return Ze(e)&&"[object Arguments]"==$e(e)}var ji=Object.prototype,Fi=ji.hasOwnProperty,Hi=ji.propertyIsEnumerable,Wi=Bi(function(){return arguments}())?Bi:function(e){return Ze(e)&&Fi.call(e,"callee")&&!Hi.call(e,"callee")};function zi(){return!1}var Gi="object"==typeof e&&e&&!e.nodeType&&e,Ui=Gi&&"object"==typeof module&&module&&!module.nodeType&&module,qi=Ui&&Ui.exports===Gi?He.Buffer:void 0,Xi=(qi?qi.isBuffer:void 0)||zi,Vi={};function Ki(e){return function(t){return e(t)}}Vi["[object Float32Array]"]=Vi["[object Float64Array]"]=Vi["[object Int8Array]"]=Vi["[object Int16Array]"]=Vi["[object Int32Array]"]=Vi["[object Uint8Array]"]=Vi["[object Uint8ClampedArray]"]=Vi["[object Uint16Array]"]=Vi["[object Uint32Array]"]=!0,Vi["[object Arguments]"]=Vi["[object Array]"]=Vi["[object ArrayBuffer]"]=Vi["[object Boolean]"]=Vi["[object DataView]"]=Vi["[object Date]"]=Vi["[object Error]"]=Vi["[object Function]"]=Vi["[object Map]"]=Vi["[object Number]"]=Vi["[object Object]"]=Vi["[object RegExp]"]=Vi["[object Set]"]=Vi["[object String]"]=Vi["[object WeakMap]"]=!1;var Yi="object"==typeof e&&e&&!e.nodeType&&e,$i=Yi&&"object"==typeof module&&module&&!module.nodeType&&module,Zi=$i&&$i.exports===Yi&&je.process,Ji=function(){try{var e=$i&&$i.require&&$i.require("util").types;return e||Zi&&Zi.binding&&Zi.binding("util")}catch(e){}}(),Qi=Ji&&Ji.isTypedArray,eo=Qi?Ki(Qi):function(e){return Ze(e)&&ki(e.length)&&!!Vi[$e(e)]},to=Object.prototype.hasOwnProperty;function no(e,t){var n=it(e),i=!n&&Wi(e),o=!n&&!i&&Xi(e),r=!n&&!i&&!o&&eo(e),a=n||i||o||r,s=a?Li(e.length,String):[],l=s.length;for(var u in e)!t&&!to.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||r&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Un(u,l))||s.push(u);return s}function io(e,t){return function(n){return e(t(n))}}var oo=io(Object.keys,Object),ro=Object.prototype.hasOwnProperty;function ao(e){if(!Ii(e))return oo(e);var t=[];for(var n in Object(e))ro.call(e,n)&&"constructor"!=n&&t.push(n);return t}function so(e){return Ri(e)?no(e):ao(e)}var lo=Object.prototype.hasOwnProperty,uo=Oi((function(e,t){if(Ii(t)||Ri(t))_i(t,so(t),e);else for(var n in t)lo.call(t,n)&&Ni(e,n,t[n])}));var co=Object.prototype.hasOwnProperty;function ho(e){if(!pt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Ii(e),n=[];for(var i in e)("constructor"!=i||!t&&co.call(e,i))&&n.push(i);return n}function fo(e){return Ri(e)?no(e,!0):ho(e)}var po=Oi((function(e,t){_i(t,fo(t),e)})),go=Oi((function(e,t,n,i){_i(t,fo(t),e,i)})),vo=Oi((function(e,t,n,i){_i(t,so(t),e,i)})),mo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,yo=/^\w*$/;function bo(e,t){if(it(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Qe(e))||(yo.test(e)||!mo.test(e)||null!=t&&e in Object(t))}var xo=Gt(Object,"create");var wo=Object.prototype.hasOwnProperty;var Eo=Object.prototype.hasOwnProperty;function Co(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function No(e,t){for(var n=e.length;n--;)if(Ei(e[n][0],t))return n;return-1}Co.prototype.clear=function(){this.__data__=xo?xo(null):{},this.size=0},Co.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Co.prototype.get=function(e){var t=this.__data__;if(xo){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return wo.call(t,e)?t[e]:void 0},Co.prototype.has=function(e){var t=this.__data__;return xo?void 0!==t[e]:Eo.call(t,e)},Co.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=xo&&void 0===t?"__lodash_hash_undefined__":t,this};var _o=Array.prototype.splice;function So(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}So.prototype.clear=function(){this.__data__=[],this.size=0},So.prototype.delete=function(e){var t=this.__data__,n=No(t,e);return!(n<0)&&(n==t.length-1?t.pop():_o.call(t,n,1),--this.size,!0)},So.prototype.get=function(e){var t=this.__data__,n=No(t,e);return n<0?void 0:t[n][1]},So.prototype.has=function(e){return No(this.__data__,e)>-1},So.prototype.set=function(e,t){var n=this.__data__,i=No(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var Mo=Gt(He,"Map");function To(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Ao(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Ao.prototype.clear=function(){this.size=0,this.__data__={hash:new Co,map:new(Mo||So),string:new Co}},Ao.prototype.delete=function(e){var t=To(this,e).delete(e);return this.size-=t?1:0,t},Ao.prototype.get=function(e){return To(this,e).get(e)},Ao.prototype.has=function(e){return To(this,e).has(e)},Ao.prototype.set=function(e,t){var n=To(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};var ko="Expected a function";function Ro(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(ko);var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(Ro.Cache||Ao),n}Ro.Cache=Ao;var Do=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Oo=/\\(\\)?/g,Po=function(e){var t=Ro(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Do,(function(e,n,i,o){t.push(i?o.replace(Oo,"$1"):n||e)})),t}));function Io(e){return null==e?"":st(e)}function Lo(e,t){return it(e)?e:bo(e,t)?[e]:Po(Io(e))}var Bo=1/0;function jo(e){if("string"==typeof e||Qe(e))return e;var t=e+"";return"0"==t&&1/e==-Bo?"-0":t}function Fo(e,t){for(var n=0,i=(t=Lo(t,e)).length;null!=e&&n<i;)e=e[jo(t[n++])];return n&&n==i?e:void 0}function Ho(e,t,n){var i=null==e?void 0:Fo(e,t);return void 0===i?n:i}function Wo(e,t){for(var n=-1,i=t.length,o=Array(i),r=null==e;++n<i;)o[n]=r?void 0:Ho(e,t[n]);return o}function zo(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}var Go=We?We.isConcatSpreadable:void 0;function Uo(e){return it(e)||Wi(e)||!!(Go&&e&&e[Go])}function qo(e,t,n,i,o){var r=-1,a=e.length;for(n||(n=Uo),o||(o=[]);++r<a;){var s=e[r];t>0&&n(s)?t>1?qo(s,t-1,n,i,o):zo(o,s):i||(o[o.length]=s)}return o}function Xo(e){return(null==e?0:e.length)?qo(e,1):[]}function Vo(e){return Sn(Mi(e,void 0,Xo),e+"")}var Ko=Vo(Wo),Yo=io(Object.getPrototypeOf,Object),$o="[object Object]",Zo=Function.prototype,Jo=Object.prototype,Qo=Zo.toString,er=Jo.hasOwnProperty,tr=Qo.call(Object);function nr(e){if(!Ze(e)||$e(e)!=$o)return!1;var t=Yo(e);if(null===t)return!0;var n=er.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Qo.call(n)==tr}var ir="[object DOMException]",or="[object Error]";function rr(e){if(!Ze(e))return!1;var t=$e(e);return t==or||t==ir||"string"==typeof e.message&&"string"==typeof e.name&&!nr(e)}var ar=Ti((function(e,t){try{return Zt(e,void 0,t)}catch(e){return rr(e)?e:new Error(e)}})),sr="Expected a function";function lr(e,t){var n;if("function"!=typeof t)throw new TypeError(sr);return e=Nt(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var ur=Ti((function(e,t,n){var i=1;if(n.length){var o=Vn(n,Wn(ur));i|=32}return yi(e,i,t,n,o)}));ur.placeholder={};var dr=Vo((function(e,t){return Mn(t,(function(t){t=jo(t),wi(e,t,ur(e[t],e))})),e})),cr=Ti((function(e,t,n){var i=3;if(n.length){var o=Vn(n,Wn(cr));i|=32}return yi(t,i,e,n,o)}));function hr(e,t,n){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(o);++i<o;)r[i]=e[i+t];return r}function fr(e,t,n){var i=e.length;return n=void 0===n?i:n,!t&&n>=i?e:hr(e,t,n)}cr.placeholder={};var pr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function gr(e){return pr.test(e)}var vr="\\ud800-\\udfff",mr="["+vr+"]",yr="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",br="\\ud83c[\\udffb-\\udfff]",xr="[^"+vr+"]",wr="(?:\\ud83c[\\udde6-\\uddff]){2}",Er="[\\ud800-\\udbff][\\udc00-\\udfff]",Cr="(?:"+yr+"|"+br+")"+"?",Nr="[\\ufe0e\\ufe0f]?",_r=Nr+Cr+("(?:\\u200d(?:"+[xr,wr,Er].join("|")+")"+Nr+Cr+")*"),Sr="(?:"+[xr+yr+"?",yr,wr,Er,mr].join("|")+")",Mr=RegExp(br+"(?="+br+")|"+Sr+_r,"g");function Tr(e){return gr(e)?function(e){return e.match(Mr)||[]}(e):function(e){return e.split("")}(e)}function Ar(e){return function(t){var n=gr(t=Io(t))?Tr(t):void 0,i=n?n[0]:t.charAt(0),o=n?fr(n,1).join(""):t.slice(1);return i[e]()+o}}var kr=Ar("toUpperCase");function Rr(e){return kr(Io(e).toLowerCase())}function Dr(e,t,n,i){var o=-1,r=null==e?0:e.length;for(i&&r&&(n=e[++o]);++o<r;)n=t(n,e[o],o,e);return n}function Or(e){return function(t){return null==e?void 0:e[t]}}var Pr=Or({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Ir=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Lr=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");function Br(e){return(e=Io(e))&&e.replace(Ir,Pr).replace(Lr,"")}var jr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Fr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Hr="\\ud800-\\udfff",Wr="\\u2700-\\u27bf",zr="a-z\\xdf-\\xf6\\xf8-\\xff",Gr="A-Z\\xc0-\\xd6\\xd8-\\xde",Ur="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",qr="["+Ur+"]",Xr="\\d+",Vr="["+Wr+"]",Kr="["+zr+"]",Yr="[^"+Hr+Ur+Xr+Wr+zr+Gr+"]",$r="(?:\\ud83c[\\udde6-\\uddff]){2}",Zr="[\\ud800-\\udbff][\\udc00-\\udfff]",Jr="["+Gr+"]",Qr="(?:"+Kr+"|"+Yr+")",ea="(?:"+Jr+"|"+Yr+")",ta="(?:['’](?:d|ll|m|re|s|t|ve))?",na="(?:['’](?:D|LL|M|RE|S|T|VE))?",ia="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",oa="[\\ufe0e\\ufe0f]?",ra=oa+ia+("(?:\\u200d(?:"+["[^"+Hr+"]",$r,Zr].join("|")+")"+oa+ia+")*"),aa="(?:"+[Vr,$r,Zr].join("|")+")"+ra,sa=RegExp([Jr+"?"+Kr+"+"+ta+"(?="+[qr,Jr,"$"].join("|")+")",ea+"+"+na+"(?="+[qr,Jr+Qr,"$"].join("|")+")",Jr+"?"+Qr+"+"+ta,Jr+"+"+na,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Xr,aa].join("|"),"g");function la(e,t,n){return e=Io(e),void 0===(t=n?void 0:t)?function(e){return Fr.test(e)}(e)?function(e){return e.match(sa)||[]}(e):function(e){return e.match(jr)||[]}(e):e.match(t)||[]}var ua=RegExp("['’]","g");function da(e){return function(t){return Dr(la(Br(t).replace(ua,"")),e,"")}}var ca=da((function(e,t,n){return t=t.toLowerCase(),e+(n?Rr(t):t)}));var ha=He.isFinite,fa=Math.min;function pa(e){var t=Math[e];return function(e,n){if(e=xt(e),(n=null==n?0:fa(Nt(n),292))&&ha(e)){var i=(Io(e)+"e").split("e");return+((i=(Io(t(i[0]+"e"+(+i[1]+n)))+"e").split("e"))[0]+"e"+(+i[1]-n))}return t(e)}}var ga=pa("ceil");function va(e){var t=gn(e);return t.__chain__=!0,t}var ma=Math.ceil,ya=Math.max;function ba(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function xa(e){var t=this.__data__=new So(e);this.size=t.size}function wa(e,t){return e&&_i(t,so(t),e)}xa.prototype.clear=function(){this.__data__=new So,this.size=0},xa.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},xa.prototype.get=function(e){return this.__data__.get(e)},xa.prototype.has=function(e){return this.__data__.has(e)},xa.prototype.set=function(e,t){var n=this.__data__;if(n instanceof So){var i=n.__data__;if(!Mo||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ao(i)}return n.set(e,t),this.size=n.size,this};var Ea="object"==typeof e&&e&&!e.nodeType&&e,Ca=Ea&&"object"==typeof module&&module&&!module.nodeType&&module,Na=Ca&&Ca.exports===Ea?He.Buffer:void 0,_a=Na?Na.allocUnsafe:void 0;function Sa(e,t){if(t)return e.slice();var n=e.length,i=_a?_a(n):new e.constructor(n);return e.copy(i),i}function Ma(e,t){for(var n=-1,i=null==e?0:e.length,o=0,r=[];++n<i;){var a=e[n];t(a,n,e)&&(r[o++]=a)}return r}function Ta(){return[]}var Aa=Object.prototype.propertyIsEnumerable,ka=Object.getOwnPropertySymbols,Ra=ka?function(e){return null==e?[]:(e=Object(e),Ma(ka(e),(function(t){return Aa.call(e,t)})))}:Ta;var Da=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)zo(t,Ra(e)),e=Yo(e);return t}:Ta;function Oa(e,t,n){var i=t(e);return it(e)?i:zo(i,n(e))}function Pa(e){return Oa(e,so,Ra)}function Ia(e){return Oa(e,fo,Da)}var La=Gt(He,"DataView"),Ba=Gt(He,"Promise"),ja=Gt(He,"Set"),Fa="[object Map]",Ha="[object Promise]",Wa="[object Set]",za="[object WeakMap]",Ga="[object DataView]",Ua=It(La),qa=It(Mo),Xa=It(Ba),Va=It(ja),Ka=It(Ut),Ya=$e;(La&&Ya(new La(new ArrayBuffer(1)))!=Ga||Mo&&Ya(new Mo)!=Fa||Ba&&Ya(Ba.resolve())!=Ha||ja&&Ya(new ja)!=Wa||Ut&&Ya(new Ut)!=za)&&(Ya=function(e){var t=$e(e),n="[object Object]"==t?e.constructor:void 0,i=n?It(n):"";if(i)switch(i){case Ua:return Ga;case qa:return Fa;case Xa:return Ha;case Va:return Wa;case Ka:return za}return t});var $a=Ya,Za=Object.prototype.hasOwnProperty;var Ja=He.Uint8Array;function Qa(e){var t=new e.constructor(e.byteLength);return new Ja(t).set(new Ja(e)),t}var es=/\w*$/;var ts=We?We.prototype:void 0,ns=ts?ts.valueOf:void 0;function is(e,t){var n=t?Qa(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var os="[object Boolean]",rs="[object Date]",as="[object Map]",ss="[object Number]",ls="[object RegExp]",us="[object Set]",ds="[object String]",cs="[object Symbol]",hs="[object ArrayBuffer]",fs="[object DataView]",ps="[object Float32Array]",gs="[object Float64Array]",vs="[object Int8Array]",ms="[object Int16Array]",ys="[object Int32Array]",bs="[object Uint8Array]",xs="[object Uint8ClampedArray]",ws="[object Uint16Array]",Es="[object Uint32Array]";function Cs(e,t,n){var i,o=e.constructor;switch(t){case hs:return Qa(e);case os:case rs:return new o(+e);case fs:return function(e,t){var n=t?Qa(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case ps:case gs:case vs:case ms:case ys:case bs:case xs:case ws:case Es:return is(e,n);case as:return new o;case ss:case ds:return new o(e);case ls:return function(e){var t=new e.constructor(e.source,es.exec(e));return t.lastIndex=e.lastIndex,t}(e);case us:return new o;case cs:return i=e,ns?Object(ns.call(i)):{}}}function Ns(e){return"function"!=typeof e.constructor||Ii(e)?{}:Kt(Yo(e))}var _s=Ji&&Ji.isMap,Ss=_s?Ki(_s):function(e){return Ze(e)&&"[object Map]"==$a(e)};var Ms=Ji&&Ji.isSet,Ts=Ms?Ki(Ms):function(e){return Ze(e)&&"[object Set]"==$a(e)},As=1,ks=2,Rs=4,Ds="[object Arguments]",Os="[object Function]",Ps="[object GeneratorFunction]",Is="[object Object]",Ls={};function Bs(e,t,n,i,o,r){var a,s=t&As,l=t&ks,u=t&Rs;if(n&&(a=o?n(e,i,o,r):n(e)),void 0!==a)return a;if(!pt(e))return e;var d=it(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Za.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return hn(e,a)}else{var c=$a(e),h=c==Os||c==Ps;if(Xi(e))return Sa(e,s);if(c==Is||c==Ds||h&&!o){if(a=l||h?{}:Ns(e),!s)return l?function(e,t){return _i(e,Da(e),t)}(e,function(e,t){return e&&_i(t,fo(t),e)}(a,e)):function(e,t){return _i(e,Ra(e),t)}(e,wa(a,e))}else{if(!Ls[c])return o?e:{};a=Cs(e,c,s)}}r||(r=new xa);var f=r.get(e);if(f)return f;r.set(e,a),Ts(e)?e.forEach((function(i){a.add(Bs(i,t,n,i,e,r))})):Ss(e)&&e.forEach((function(i,o){a.set(o,Bs(i,t,n,o,e,r))}));var p=d?void 0:(u?l?Ia:Pa:l?fo:so)(e);return Mn(p||e,(function(i,o){p&&(i=e[o=i]),Ni(a,o,Bs(i,t,n,o,e,r))})),a}Ls[Ds]=Ls["[object Array]"]=Ls["[object ArrayBuffer]"]=Ls["[object DataView]"]=Ls["[object Boolean]"]=Ls["[object Date]"]=Ls["[object Float32Array]"]=Ls["[object Float64Array]"]=Ls["[object Int8Array]"]=Ls["[object Int16Array]"]=Ls["[object Int32Array]"]=Ls["[object Map]"]=Ls["[object Number]"]=Ls[Is]=Ls["[object RegExp]"]=Ls["[object Set]"]=Ls["[object String]"]=Ls["[object Symbol]"]=Ls["[object Uint8Array]"]=Ls["[object Uint8ClampedArray]"]=Ls["[object Uint16Array]"]=Ls["[object Uint32Array]"]=!0,Ls["[object Error]"]=Ls[Os]=Ls["[object WeakMap]"]=!1;function js(e){return Bs(e,5)}function Fs(){var e=arguments.length;if(!e)return[];for(var t=Array(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return zo(it(n)?hn(n):[n],qo(t,1))}function Hs(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Ao;++t<n;)this.add(e[t])}function Ws(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function zs(e,t){return e.has(t)}Hs.prototype.add=Hs.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Hs.prototype.has=function(e){return this.__data__.has(e)};var Gs=1,Us=2;function qs(e,t,n,i,o,r){var a=n&Gs,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var u=r.get(e),d=r.get(t);if(u&&d)return u==t&&d==e;var c=-1,h=!0,f=n&Us?new Hs:void 0;for(r.set(e,t),r.set(t,e);++c<s;){var p=e[c],g=t[c];if(i)var v=a?i(g,p,c,t,e,r):i(p,g,c,e,t,r);if(void 0!==v){if(v)continue;h=!1;break}if(f){if(!Ws(t,(function(e,t){if(!zs(f,t)&&(p===e||o(p,e,n,i,r)))return f.push(t)}))){h=!1;break}}else if(p!==g&&!o(p,g,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h}function Xs(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Vs(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Ks=1,Ys=2,$s="[object Boolean]",Zs="[object Date]",Js="[object Error]",Qs="[object Map]",el="[object Number]",tl="[object RegExp]",nl="[object Set]",il="[object String]",ol="[object Symbol]",rl="[object ArrayBuffer]",al="[object DataView]",sl=We?We.prototype:void 0,ll=sl?sl.valueOf:void 0;var ul=1,dl=Object.prototype.hasOwnProperty;var cl=1,hl="[object Arguments]",fl="[object Array]",pl="[object Object]",gl=Object.prototype.hasOwnProperty;function vl(e,t,n,i,o,r){var a=it(e),s=it(t),l=a?fl:$a(e),u=s?fl:$a(t),d=(l=l==hl?pl:l)==pl,c=(u=u==hl?pl:u)==pl,h=l==u;if(h&&Xi(e)){if(!Xi(t))return!1;a=!0,d=!1}if(h&&!d)return r||(r=new xa),a||eo(e)?qs(e,t,n,i,o,r):function(e,t,n,i,o,r,a){switch(n){case al:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rl:return!(e.byteLength!=t.byteLength||!r(new Ja(e),new Ja(t)));case $s:case Zs:case el:return Ei(+e,+t);case Js:return e.name==t.name&&e.message==t.message;case tl:case il:return e==t+"";case Qs:var s=Xs;case nl:var l=i&Ks;if(s||(s=Vs),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;i|=Ys,a.set(e,t);var d=qs(s(e),s(t),i,o,r,a);return a.delete(e),d;case ol:if(ll)return ll.call(e)==ll.call(t)}return!1}(e,t,l,n,i,o,r);if(!(n&cl)){var f=d&&gl.call(e,"__wrapped__"),p=c&&gl.call(t,"__wrapped__");if(f||p){var g=f?e.value():e,v=p?t.value():t;return r||(r=new xa),o(g,v,n,i,r)}}return!!h&&(r||(r=new xa),function(e,t,n,i,o,r){var a=n&ul,s=Pa(e),l=s.length;if(l!=Pa(t).length&&!a)return!1;for(var u=l;u--;){var d=s[u];if(!(a?d in t:dl.call(t,d)))return!1}var c=r.get(e),h=r.get(t);if(c&&h)return c==t&&h==e;var f=!0;r.set(e,t),r.set(t,e);for(var p=a;++u<l;){var g=e[d=s[u]],v=t[d];if(i)var m=a?i(v,g,d,t,e,r):i(g,v,d,e,t,r);if(!(void 0===m?g===v||o(g,v,n,i,r):m)){f=!1;break}p||(p="constructor"==d)}if(f&&!p){var y=e.constructor,b=t.constructor;y==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(f=!1)}return r.delete(e),r.delete(t),f}(e,t,n,i,o,r))}function ml(e,t,n,i,o){return e===t||(null==e||null==t||!Ze(e)&&!Ze(t)?e!=e&&t!=t:vl(e,t,n,i,ml,o))}var yl=1,bl=2;function xl(e,t,n,i){var o=n.length,r=o,a=!i;if(null==e)return!r;for(e=Object(e);o--;){var s=n[o];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<r;){var l=(s=n[o])[0],u=e[l],d=s[1];if(a&&s[2]){if(void 0===u&&!(l in e))return!1}else{var c=new xa;if(i)var h=i(u,d,l,e,t,c);if(!(void 0===h?ml(d,u,yl|bl,i,c):h))return!1}}return!0}function wl(e){return e==e&&!pt(e)}function El(e){for(var t=so(e),n=t.length;n--;){var i=t[n],o=e[i];t[n]=[i,o,wl(o)]}return t}function Cl(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function Nl(e){var t=El(e);return 1==t.length&&t[0][2]?Cl(t[0][0],t[0][1]):function(n){return n===e||xl(n,e,t)}}function _l(e,t){return null!=e&&t in Object(e)}function Sl(e,t,n){for(var i=-1,o=(t=Lo(t,e)).length,r=!1;++i<o;){var a=jo(t[i]);if(!(r=null!=e&&n(e,a)))break;e=e[a]}return r||++i!=o?r:!!(o=null==e?0:e.length)&&ki(o)&&Un(a,o)&&(it(e)||Wi(e))}function Ml(e,t){return null!=e&&Sl(e,t,_l)}var Tl=1,Al=2;function kl(e,t){return bo(e)&&wl(t)?Cl(jo(e),t):function(n){var i=Ho(n,e);return void 0===i&&i===t?Ml(n,e):ml(t,i,Tl|Al)}}function Rl(e){return function(t){return null==t?void 0:t[e]}}function Dl(e){return bo(e)?Rl(jo(e)):function(e){return function(t){return Fo(t,e)}}(e)}function Ol(e){return"function"==typeof e?e:null==e?_t:"object"==typeof e?it(e)?kl(e[0],e[1]):Nl(e):Dl(e)}function Pl(e,t,n){var i=n.length;if(null==e)return!i;for(e=Object(e);i--;){var o=n[i],r=t[o],a=e[o];if(void 0===a&&!(o in e)||!r(a))return!1}return!0}function Il(e,t,n,i){for(var o=-1,r=null==e?0:e.length;++o<r;){var a=e[o];t(i,a,n(a),e)}return i}function Ll(e){return function(t,n,i){for(var o=-1,r=Object(t),a=i(t),s=a.length;s--;){var l=a[e?s:++o];if(!1===n(r[l],l,r))break}return t}}var Bl=Ll();function jl(e,t){return e&&Bl(e,t,so)}function Fl(e,t){return function(n,i){if(null==n)return n;if(!Ri(n))return e(n,i);for(var o=n.length,r=t?o:-1,a=Object(n);(t?r--:++r<o)&&!1!==i(a[r],r,a););return n}}var Hl=Fl(jl);function Wl(e,t,n,i){return Hl(e,(function(e,o,r){t(i,e,n(e),r)})),i}function zl(e,t){return function(n,i){var o=it(n)?Il:Wl,r=t?t():{};return o(n,e,Ol(i),r)}}var Gl=Object.prototype.hasOwnProperty,Ul=zl((function(e,t,n){Gl.call(e,n)?++e[n]:wi(e,n,1)}));function ql(e,t,n){var i=yi(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=ql.placeholder,i}ql.placeholder={};function Xl(e,t,n){var i=yi(e,16,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=Xl.placeholder,i}Xl.placeholder={};var Vl=function(){return He.Date.now()},Kl="Expected a function",Yl=Math.max,$l=Math.min;function Zl(e,t,n){var i,o,r,a,s,l,u=0,d=!1,c=!1,h=!0;if("function"!=typeof e)throw new TypeError(Kl);function f(t){var n=i,r=o;return i=o=void 0,u=t,a=e.apply(r,n)}function p(e){var n=e-l;return void 0===l||n>=t||n<0||c&&e-u>=r}function g(){var e=Vl();if(p(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return c?$l(n,r-(e-u)):n}(e))}function v(e){return s=void 0,h&&i?f(e):(i=o=void 0,a)}function m(){var e=Vl(),n=p(e);if(i=arguments,o=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(g,t),d?f(e):a}(l);if(c)return clearTimeout(s),s=setTimeout(g,t),f(l)}return void 0===s&&(s=setTimeout(g,t)),a}return t=xt(t)||0,pt(n)&&(d=!!n.leading,r=(c="maxWait"in n)?Yl(xt(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,i=l=o=s=void 0},m.flush=function(){return void 0===s?a:v(Vl())},m}var Jl=Object.prototype,Ql=Jl.hasOwnProperty,eu=Ti((function(e,t){e=Object(e);var n=-1,i=t.length,o=i>2?t[2]:void 0;for(o&&Di(t[0],t[1],o)&&(i=1);++n<i;)for(var r=t[n],a=fo(r),s=-1,l=a.length;++s<l;){var u=a[s],d=e[u];(void 0===d||Ei(d,Jl[u])&&!Ql.call(e,u))&&(e[u]=r[u])}return e}));function tu(e,t,n){(void 0!==n&&!Ei(e[t],n)||void 0===n&&!(t in e))&&wi(e,t,n)}function nu(e){return Ze(e)&&Ri(e)}function iu(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ou(e){return _i(e,fo(e))}function ru(e,t,n,i,o){e!==t&&Bl(t,(function(r,a){if(o||(o=new xa),pt(r))!function(e,t,n,i,o,r,a){var s=iu(e,n),l=iu(t,n),u=a.get(l);if(u)tu(e,n,u);else{var d=r?r(s,l,n+"",e,t,a):void 0,c=void 0===d;if(c){var h=it(l),f=!h&&Xi(l),p=!h&&!f&&eo(l);d=l,h||f||p?it(s)?d=s:nu(s)?d=hn(s):f?(c=!1,d=Sa(l,!0)):p?(c=!1,d=is(l,!0)):d=[]:nr(l)||Wi(l)?(d=s,Wi(s)?d=ou(s):pt(s)&&!kt(s)||(d=Ns(l))):c=!1}c&&(a.set(l,d),o(d,l,i,r,a),a.delete(l)),tu(e,n,d)}}(e,t,a,n,ru,i,o);else{var s=i?i(iu(e,a),r,a+"",e,t,o):void 0;void 0===s&&(s=r),tu(e,a,s)}}),fo)}function au(e,t,n,i,o,r){return pt(e)&&pt(t)&&(r.set(t,e),ru(e,t,void 0,au,r),r.delete(t)),e}var su=Oi((function(e,t,n,i){ru(e,t,n,i)})),lu=Ti((function(e){return e.push(void 0,au),Zt(su,void 0,e)}));function uu(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)}var du=Ti((function(e,t){return uu(e,1,t)})),cu=Ti((function(e,t,n){return uu(e,xt(t)||0,n)}));function hu(e,t,n){for(var i=-1,o=null==e?0:e.length;++i<o;)if(n(t,e[i]))return!0;return!1}var fu=200;function pu(e,t,n,i){var o=-1,r=Rn,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=nt(t,Ki(n))),i?(r=hu,a=!1):t.length>=fu&&(r=zs,a=!1,t=new Hs(t));e:for(;++o<s;){var d=e[o],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 r(t,c,i)||l.push(d)}return l}var gu=Ti((function(e,t){return nu(e)?pu(e,qo(t,1,nu,!0)):[]}));function vu(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var mu=Ti((function(e,t){var n=vu(t);return nu(n)&&(n=void 0),nu(e)?pu(e,qo(t,1,nu,!0),Ol(n)):[]})),yu=Ti((function(e,t){var n=vu(t);return nu(n)&&(n=void 0),nu(e)?pu(e,qo(t,1,nu,!0),void 0,n):[]})),bu=lt((function(e,t){return e/t}),1);function xu(e,t,n,i){for(var o=e.length,r=i?o:-1;(i?r--:++r<o)&&t(e[r],r,e););return n?hr(e,i?0:r,i?r+1:o):hr(e,i?r+1:0,i?o:r)}function wu(e){return"function"==typeof e?e:_t}function Eu(e,t){return(it(e)?Mn:Hl)(e,wu(t))}function Cu(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}var Nu=Ll(!0);function _u(e,t){return e&&Nu(e,t,so)}var Su=Fl(_u,!0);function Mu(e,t){return(it(e)?Cu:Su)(e,wu(t))}function Tu(e){return function(t){var n=$a(t);return"[object Map]"==n?Xs(t):"[object Set]"==n?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return nt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}var Au=Tu(so),ku=Tu(fo),Ru=Or({"&":"&","<":"<",">":">",'"':""","'":"'"}),Du=/[&<>"']/g,Ou=RegExp(Du.source);function Pu(e){return(e=Io(e))&&Ou.test(e)?e.replace(Du,Ru):e}var Iu=/[\\^$.*+?()[\]{}|]/g,Lu=RegExp(Iu.source);function Bu(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(!t(e[n],n,e))return!1;return!0}function ju(e,t){var n=!0;return Hl(e,(function(e,i,o){return n=!!t(e,i,o)})),n}var Fu=4294967295;function Hu(e){return e?ba(Nt(e),0,Fu):0}function Wu(e,t){var n=[];return Hl(e,(function(e,i,o){t(e,i,o)&&n.push(e)})),n}function zu(e,t){return(it(e)?Ma:Wu)(e,Ol(t))}function Gu(e){return function(t,n,i){var o=Object(t);if(!Ri(t)){var r=Ol(n);t=so(t),n=function(e){return r(o[e],e,o)}}var a=e(t,n,i);return a>-1?o[r?t[a]:a]:void 0}}var Uu=Math.max;function qu(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=null==n?0:Nt(n);return o<0&&(o=Uu(i+o,0)),Tn(e,Ol(t),o)}var Xu=Gu(qu);function Vu(e,t,n){var i;return n(e,(function(e,n,o){if(t(e,n,o))return i=n,!1})),i}var Ku=Math.max,Yu=Math.min;function $u(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return void 0!==n&&(o=Nt(n),o=n<0?Ku(i+o,0):Yu(o,i-1)),Tn(e,Ol(t),o,!0)}var Zu=Gu($u);function Ju(e){return e&&e.length?e[0]:void 0}function Qu(e,t){var n=-1,i=Ri(e)?Array(e.length):[];return Hl(e,(function(e,o,r){i[++n]=t(e,o,r)})),i}function ed(e,t){return(it(e)?nt:Qu)(e,Ol(t))}var td=1/0;var nd=1/0;var id=pa("floor");function od(e){return Vo((function(t){var n=t.length,i=n,o=cn.prototype.thru;for(e&&t.reverse();i--;){var r=t[i];if("function"!=typeof r)throw new TypeError("Expected a function");if(o&&!a&&"wrapper"==dn(r))var a=new cn([],!0)}for(i=a?i:n;++i<n;){var s=dn(r=t[i]),l="wrapper"==s?sn(r):void 0;a=l&&vn(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[dn(l[0])].apply(a,l[3]):1==r.length&&vn(r)?a[s]():a.thru(r)}return function(){var e=arguments,i=e[0];if(a&&1==e.length&&it(i))return a.plant(i).value();for(var o=0,r=n?t[o].apply(this,e):i;++o<n;)r=t[o].call(this,r);return r}}))}var rd=od(),ad=od(!0);function sd(e,t){return Ma(t,(function(t){return kt(e[t])}))}var ld=Object.prototype.hasOwnProperty,ud=zl((function(e,t,n){ld.call(e,n)?e[n].push(t):wi(e,n,[t])}));function dd(e,t){return e>t}function cd(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=xt(t),n=xt(n)),e(t,n)}}var hd=cd(dd),fd=cd((function(e,t){return e>=t})),pd=Object.prototype.hasOwnProperty;function gd(e,t){return null!=e&&pd.call(e,t)}function vd(e,t){return null!=e&&Sl(e,t,gd)}var md=Math.max,yd=Math.min;var bd="[object String]";function xd(e){return"string"==typeof e||!it(e)&&Ze(e)&&$e(e)==bd}function wd(e,t){return nt(t,(function(t){return e[t]}))}function Ed(e){return null==e?[]:wd(e,so(e))}var Cd=Math.max;var Nd=Math.max;var _d=Math.min;function Sd(e,t,n){for(var i=n?hu:Rn,o=e[0].length,r=e.length,a=r,s=Array(r),l=1/0,u=[];a--;){var d=e[a];a&&t&&(d=nt(d,Ki(t))),l=_d(d.length,l),s[a]=!n&&(t||o>=120&&d.length>=120)?new Hs(a&&d):void 0}d=e[0];var c=-1,h=s[0];e:for(;++c<o&&u.length<l;){var f=d[c],p=t?t(f):f;if(f=n||0!==f?f:0,!(h?zs(h,p):i(u,p,n))){for(a=r;--a;){var g=s[a];if(!(g?zs(g,p):i(e[a],p,n)))continue e}h&&h.push(p),u.push(f)}}return u}function Md(e){return nu(e)?e:[]}var Td=Ti((function(e){var t=nt(e,Md);return t.length&&t[0]===e[0]?Sd(t):[]})),Ad=Ti((function(e){var t=vu(e),n=nt(e,Md);return t===vu(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?Sd(n,Ol(t)):[]})),kd=Ti((function(e){var t=vu(e),n=nt(e,Md);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?Sd(n,void 0,t):[]}));function Rd(e,t){return function(n,i){return function(e,t,n,i){return jl(e,(function(e,o,r){t(i,n(e),o,r)})),i}(n,e,t(i),{})}}var Dd=Object.prototype.toString,Od=Rd((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Dd.call(t)),e[t]=n}),Cn(_t)),Pd=Object.prototype,Id=Pd.hasOwnProperty,Ld=Pd.toString,Bd=Rd((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ld.call(t)),Id.call(e,t)?e[t].push(n):e[t]=[n]}),Ol);function jd(e,t){return t.length<2?e:Fo(e,hr(t,0,-1))}function Fd(e,t,n){var i=null==(e=jd(e,t=Lo(t,e)))?e:e[jo(vu(t))];return null==i?void 0:Zt(i,e,n)}var Hd=Ti(Fd),Wd=Ti((function(e,t,n){var i=-1,o="function"==typeof t,r=Ri(e)?Array(e.length):[];return Hl(e,(function(e){r[++i]=o?Zt(t,e,n):Fd(e,t,n)})),r}));var zd=Ji&&Ji.isArrayBuffer,Gd=zd?Ki(zd):function(e){return Ze(e)&&"[object ArrayBuffer]"==$e(e)};var Ud=Ji&&Ji.isDate,qd=Ud?Ki(Ud):function(e){return Ze(e)&&"[object Date]"==$e(e)};var Xd=Object.prototype.hasOwnProperty;function Vd(e){if(null==e)return!0;if(Ri(e)&&(it(e)||"string"==typeof e||"function"==typeof e.splice||Xi(e)||eo(e)||Wi(e)))return!e.length;var t=$a(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Ii(e))return!ao(e).length;for(var n in e)if(Xd.call(e,n))return!1;return!0}function Kd(e,t){return ml(e,t)}var Yd=He.isFinite;function $d(e){return"number"==typeof e&&Yd(e)}function Zd(e){return"number"==typeof e&&e==Nt(e)}var Jd="[object Number]";function Qd(e){return"number"==typeof e||Ze(e)&&$e(e)==Jd}var ec=Dt?kt:zi;function tc(e){return null==e}var nc=Ji&&Ji.isRegExp,ic=nc?Ki(nc):function(e){return Ze(e)&&"[object RegExp]"==$e(e)},oc=9007199254740991;var rc=Array.prototype.join;var ac=da((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),sc=zl((function(e,t,n){wi(e,n,t)}));var lc=Math.max,uc=Math.min;var dc=da((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),cc=Ar("toLowerCase");function hc(e,t){return e<t}var fc=cd(hc),pc=cd((function(e,t){return e<=t}));function gc(e,t,n){for(var i=-1,o=e.length;++i<o;){var r=e[i],a=t(r);if(null!=a&&(void 0===s?a==a&&!Qe(a):n(a,s)))var s=a,l=r}return l}function vc(e,t){for(var n,i=-1,o=e.length;++i<o;){var r=t(e[i]);void 0!==r&&(n=void 0===n?r:n+r)}return n}var mc=NaN;function yc(e,t){var n=null==e?0:e.length;return n?vc(e,t)/n:mc}var bc=Oi((function(e,t,n){ru(e,t,n)})),xc=Ti((function(e,t){return function(n){return Fd(n,e,t)}})),wc=Ti((function(e,t){return function(n){return Fd(e,n,t)}}));function Ec(e,t,n){var i=so(t),o=sd(t,i),r=!(pt(n)&&"chain"in n&&!n.chain),a=kt(e);return Mn(o,(function(n){var i=t[n];e[n]=i,a&&(e.prototype[n]=function(){var t=this.__chain__;if(r||t){var n=e(this.__wrapped__);return(n.__actions__=hn(this.__actions__)).push({func:i,args:arguments,thisArg:e}),n.__chain__=t,n}return i.apply(e,zo([this.value()],arguments))})})),e}var Cc=lt((function(e,t){return e*t}),1),Nc="Expected a function";function _c(e){if("function"!=typeof e)throw new TypeError(Nc);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 Sc="[object Map]",Mc="[object Set]",Tc=We?We.iterator:void 0;function Ac(e){if(!e)return[];if(Ri(e))return xd(e)?Tr(e):hn(e);if(Tc&&e[Tc])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Tc]());var t=$a(e);return(t==Sc?Xs:t==Mc?Vs:Ed)(e)}function kc(e,t){var n=e.length;if(n)return Un(t+=t<0?n:0,n)?e[t]:void 0}function Rc(e,t){return null==(e=jd(e,t=Lo(t,e)))||delete e[jo(vu(t))]}function Dc(e){return nr(e)?void 0:e}var Oc=Vo((function(e,t){var n={};if(null==e)return n;var i=!1;t=nt(t,(function(t){return t=Lo(t,e),i||(i=t.length>1),t})),_i(e,Ia(e),n),i&&(n=Bs(n,7,Dc));for(var o=t.length;o--;)Rc(n,t[o]);return n}));function Pc(e,t,n,i){if(!pt(e))return e;for(var o=-1,r=(t=Lo(t,e)).length,a=r-1,s=e;null!=s&&++o<r;){var l=jo(t[o]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=a){var d=s[l];void 0===(u=i?i(d,l,s):void 0)&&(u=pt(d)?d:Un(t[o+1])?[]:{})}Ni(s,l,u),s=s[l]}return e}function Ic(e,t,n){for(var i=-1,o=t.length,r={};++i<o;){var a=t[i],s=Fo(e,a);n(s,a)&&Pc(r,Lo(a,e),s)}return r}function Lc(e,t){if(null==e)return{};var n=nt(Ia(e),(function(e){return[e]}));return t=Ol(t),Ic(e,n,(function(e,n){return t(e,n[0])}))}function Bc(e,t){if(e!==t){var n=void 0!==e,i=null===e,o=e==e,r=Qe(e),a=void 0!==t,s=null===t,l=t==t,u=Qe(t);if(!s&&!u&&!r&&e>t||r&&a&&l&&!s&&!u||i&&a&&l||!n&&l||!o)return 1;if(!i&&!r&&!u&&e<t||u&&n&&o&&!i&&!r||s&&n&&o||!a&&o||!l)return-1}return 0}function jc(e,t,n){t=t.length?nt(t,(function(e){return it(e)?function(t){return Fo(t,1===e.length?e[0]:e)}:e})):[_t];var i=-1;t=nt(t,Ki(Ol));var o=Qu(e,(function(e,n,o){var r=nt(t,(function(t){return t(e)}));return{criteria:r,index:++i,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(o,(function(e,t){return function(e,t,n){for(var i=-1,o=e.criteria,r=t.criteria,a=o.length,s=n.length;++i<a;){var l=Bc(o[i],r[i]);if(l)return i>=s?l:l*("desc"==n[i]?-1:1)}return e.index-t.index}(e,t,n)}))}function Fc(e){return Vo((function(t){return t=nt(t,Ki(Ol)),Ti((function(n){var i=this;return e(t,(function(e){return Zt(e,i,n)}))}))}))}var Hc=Fc(nt),Wc=Ti,zc=Math.min,Gc=Wc((function(e,t){var n=(t=1==t.length&&it(t[0])?nt(t[0],Ki(Ol)):nt(qo(t,1),Ki(Ol))).length;return Ti((function(i){for(var o=-1,r=zc(i.length,n);++o<r;)i[o]=t[o].call(this,i[o]);return Zt(e,this,i)}))})),Uc=Fc(Bu),qc=Fc(Ws),Xc=9007199254740991,Vc=Math.floor;function Kc(e,t){var n="";if(!e||t<1||t>Xc)return n;do{t%2&&(n+=e),(t=Vc(t/2))&&(e+=e)}while(t);return n}var Yc=Rl("length"),$c="\\ud800-\\udfff",Zc="["+$c+"]",Jc="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Qc="\\ud83c[\\udffb-\\udfff]",eh="[^"+$c+"]",th="(?:\\ud83c[\\udde6-\\uddff]){2}",nh="[\\ud800-\\udbff][\\udc00-\\udfff]",ih="(?:"+Jc+"|"+Qc+")"+"?",oh="[\\ufe0e\\ufe0f]?",rh=oh+ih+("(?:\\u200d(?:"+[eh,th,nh].join("|")+")"+oh+ih+")*"),ah="(?:"+[eh+Jc+"?",Jc,th,nh,Zc].join("|")+")",sh=RegExp(Qc+"(?="+Qc+")|"+ah+rh,"g");function lh(e){return gr(e)?function(e){for(var t=sh.lastIndex=0;sh.test(e);)++t;return t}(e):Yc(e)}var uh=Math.ceil;function dh(e,t){var n=(t=void 0===t?" ":st(t)).length;if(n<2)return n?Kc(t,e):t;var i=Kc(t,uh(e/lh(t)));return gr(t)?fr(Tr(i),0,e).join(""):i.slice(0,e)}var ch=Math.ceil,hh=Math.floor;var fh=/^\s+/,ph=He.parseInt;var gh=Ti((function(e,t){return yi(e,32,void 0,t,Vn(t,Wn(gh)))}));gh.placeholder={};var vh=Ti((function(e,t){return yi(e,64,void 0,t,Vn(t,Wn(vh)))}));vh.placeholder={};var mh=zl((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var yh=Vo((function(e,t){return null==e?{}:function(e,t){return Ic(e,t,(function(t,n){return Ml(e,n)}))}(e,t)}));function bh(e,t,n,i){for(var o=n-1,r=e.length;++o<r;)if(i(e[o],t))return o;return-1}var xh=Array.prototype.splice;function wh(e,t,n,i){var o=i?bh:kn,r=-1,a=t.length,s=e;for(e===t&&(t=hn(t)),n&&(s=nt(e,Ki(n)));++r<a;)for(var l=0,u=t[r],d=n?n(u):u;(l=o(s,d,l,i))>-1;)s!==e&&xh.call(s,l,1),xh.call(e,l,1);return e}function Eh(e,t){return e&&e.length&&t&&t.length?wh(e,t):e}var Ch=Ti(Eh);var Nh=Array.prototype.splice;function _h(e,t){for(var n=e?t.length:0,i=n-1;n--;){var o=t[n];if(n==i||o!==r){var r=o;Un(o)?Nh.call(e,o,1):Rc(e,o)}}return e}var Sh=Vo((function(e,t){var n=null==e?0:e.length,i=Wo(e,t);return _h(e,nt(t,(function(e){return Un(e,n)?+e:e})).sort(Bc)),i})),Mh=Math.floor,Th=Math.random;function Ah(e,t){return e+Mh(Th()*(t-e+1))}var kh=parseFloat,Rh=Math.min,Dh=Math.random;var Oh=Math.ceil,Ph=Math.max;function Ih(e){return function(t,n,i){return i&&"number"!=typeof i&&Di(t,n,i)&&(n=i=void 0),t=Ct(t),void 0===n?(n=t,t=0):n=Ct(n),function(e,t,n,i){for(var o=-1,r=Ph(Oh((t-e)/(n||1)),0),a=Array(r);r--;)a[i?r:++o]=e,e+=n;return a}(t,n,i=void 0===i?t<n?1:-1:Ct(i),e)}}var Lh=Ih(),Bh=Ih(!0),jh=Vo((function(e,t){return yi(e,256,void 0,void 0,void 0,t)}));function Fh(e,t,n,i,o){return o(e,(function(e,o,r){n=i?(i=!1,e):t(n,e,o,r)})),n}function Hh(e,t,n){var i=it(e)?Dr:Fh,o=arguments.length<3;return i(e,Ol(t),n,o,Hl)}function Wh(e,t,n,i){var o=null==e?0:e.length;for(i&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}var zh=Array.prototype.reverse;function Gh(e){return null==e?e:zh.call(e)}var Uh=pa("round");function qh(e){var t=e.length;return t?e[Ah(0,t-1)]:void 0}function Xh(e){return qh(Ed(e))}function Vh(e,t){var n=-1,i=e.length,o=i-1;for(t=void 0===t?i:t;++n<t;){var r=Ah(n,o),a=e[r];e[r]=e[n],e[n]=a}return e.length=t,e}function Kh(e,t){return Vh(hn(e),ba(t,0,e.length))}function Yh(e,t){var n=Ed(e);return Vh(n,ba(t,0,n.length))}function $h(e){return Vh(hn(e))}function Zh(e){return Vh(Ed(e))}var Jh=da((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));function Qh(e,t){var n;return Hl(e,(function(e,i,o){return!(n=t(e,i,o))})),!!n}var ef=Ti((function(e,t){if(null==e)return[];var n=t.length;return n>1&&Di(e,t[0],t[1])?t=[]:n>2&&Di(t[0],t[1],t[2])&&(t=[t[0]]),jc(e,qo(t,1),[])})),tf=4294967294,nf=Math.floor,of=Math.min;function rf(e,t,n,i){var o=0,r=null==e?0:e.length;if(0===r)return 0;for(var a=(t=n(t))!=t,s=null===t,l=Qe(t),u=void 0===t;o<r;){var d=nf((o+r)/2),c=n(e[d]),h=void 0!==c,f=null===c,p=c==c,g=Qe(c);if(a)var v=i||p;else v=u?p&&(i||h):s?p&&h&&(i||!f):l?p&&h&&!f&&(i||!g):!f&&!g&&(i?c<=t:c<t);v?o=d+1:r=d}return of(r,tf)}var af=2147483647;function sf(e,t,n){var i=0,o=null==e?i:e.length;if("number"==typeof t&&t==t&&o<=af){for(;i<o;){var r=i+o>>>1,a=e[r];null!==a&&!Qe(a)&&(n?a<=t:a<t)?i=r+1:o=r}return o}return rf(e,t,_t,n)}function lf(e,t){for(var n=-1,i=e.length,o=0,r=[];++n<i;){var a=e[n],s=t?t(a):a;if(!n||!Ei(s,l)){var l=s;r[o++]=0===a?0:a}}return r}var uf=Math.max;var df=da((function(e,t,n){return e+(n?" ":"")+kr(t)}));var cf=lt((function(e,t){return e-t}),0);var hf=Object.prototype,ff=hf.hasOwnProperty;function pf(e,t,n,i){return void 0===e||Ei(e,hf[n])&&!ff.call(i,n)?t:e}var gf={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function vf(e){return"\\"+gf[e]}var mf=/<%=([\s\S]+?)%>/g,yf={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:mf,variable:"",imports:{_:{escape:Pu}}},bf=/\b__p \+= '';/g,xf=/\b(__p \+=) '' \+/g,wf=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ef=/[()=,{}\[\]\/\s]/,Cf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nf=/($^)/,_f=/['\n\r\u2028\u2029\\]/g,Sf=Object.prototype.hasOwnProperty;function Mf(e,t){return t(e)}var Tf=4294967295,Af=Math.min;function kf(e,t){var n=e;return n instanceof rn&&(n=n.value()),Dr(t,(function(e,t){return t.func.apply(t.thisArg,zo([e],t.args))}),n)}function Rf(){return kf(this.__wrapped__,this.__actions__)}var Df=9007199254740991;function Of(e,t){for(var n=e.length;n--&&kn(t,e[n],0)>-1;);return n}function Pf(e,t){for(var n=-1,i=e.length;++n<i&&kn(t,e[n],0)>-1;);return n}var If=/^\s+/;var Lf=/\w*$/;var Bf=Or({"&":"&","<":"<",">":">",""":'"',"'":"'"}),jf=/&(?:amp|lt|gt|quot|#39);/g,Ff=RegExp(jf.source);var Hf=ja&&1/Vs(new ja([,-0]))[1]==1/0?function(e){return new ja(e)}:an,Wf=200;function zf(e,t,n){var i=-1,o=Rn,r=e.length,a=!0,s=[],l=s;if(n)a=!1,o=hu;else if(r>=Wf){var u=t?null:Hf(e);if(u)return Vs(u);a=!1,o=zs,l=new Hs}else l=t?[]:s;e:for(;++i<r;){var 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 o(l,c,n)||(l!==s&&l.push(c),s.push(d))}return s}var Gf=Ti((function(e){return zf(qo(e,1,nu,!0))})),Uf=Ti((function(e){var t=vu(e);return nu(t)&&(t=void 0),zf(qo(e,1,nu,!0),Ol(t))})),qf=Ti((function(e){var t=vu(e);return t="function"==typeof t?t:void 0,zf(qo(e,1,nu,!0),void 0,t)}));function Xf(e,t){return e&&e.length?zf(e,Ol(t)):[]}var Vf=0;var Kf=Math.max;function Yf(e){if(!e||!e.length)return[];var t=0;return e=Ma(e,(function(e){if(nu(e))return t=Kf(e.length,t),!0})),Li(t,(function(t){return nt(e,Rl(t))}))}function $f(e,t){if(!e||!e.length)return[];var n=Yf(e);return null==t?n:nt(n,(function(e){return Zt(t,void 0,e)}))}function Zf(e,t,n,i){return Pc(e,t,n(Fo(e,t)),i)}var Jf=da((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}));var Qf=Ti((function(e,t){return nu(e)?pu(e,t):[]}));var ep=Vo((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return Wo(t,e)};return!(t>1||this.__actions__.length)&&i instanceof rn&&Un(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Mf,args:[o],thisArg:void 0}),new cn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(o)}));function tp(e,t,n){var i=e.length;if(i<2)return i?zf(e[0]):[];for(var o=-1,r=Array(i);++o<i;)for(var a=e[o],s=-1;++s<i;)s!=o&&(r[o]=pu(r[o]||a,e[s],t,n));return zf(qo(r,1),t,n)}var np=Ti((function(e){return tp(Ma(e,nu))})),ip=Ti((function(e){var t=vu(e);return nu(t)&&(t=void 0),tp(Ma(e,nu),Ol(t))})),op=Ti((function(e){var t=vu(e);return t="function"==typeof t?t:void 0,tp(Ma(e,nu),void 0,t)})),rp=Ti(Yf);function ap(e,t,n){for(var i=-1,o=e.length,r=t.length,a={};++i<o;){var s=i<r?t[i]:void 0;n(a,e[i],s)}return a}var sp=Ti((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,$f(e,n)})),lp={chunk:function(e,t,n){t=(n?Di(e,t,n):void 0===t)?1:ya(Nt(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,r=0,a=Array(ma(i/t));o<i;)a[r++]=hr(e,o,o+=t);return a},compact:function(e){for(var t=-1,n=null==e?0:e.length,i=0,o=[];++t<n;){var r=e[t];r&&(o[i++]=r)}return o},concat:Fs,difference:gu,differenceBy:mu,differenceWith:yu,drop:function(e,t,n){var i=null==e?0:e.length;return i?hr(e,(t=n||void 0===t?1:Nt(t))<0?0:t,i):[]},dropRight:function(e,t,n){var i=null==e?0:e.length;return i?hr(e,0,(t=i-(t=n||void 0===t?1:Nt(t)))<0?0:t):[]},dropRightWhile:function(e,t){return e&&e.length?xu(e,Ol(t),!0,!0):[]},dropWhile:function(e,t){return e&&e.length?xu(e,Ol(t),!0):[]},fill:function(e,t,n,i){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&Di(e,t,n)&&(n=0,i=o),function(e,t,n,i){var o=e.length;for((n=Nt(n))<0&&(n=-n>o?0:o+n),(i=void 0===i||i>o?o:Nt(i))<0&&(i+=o),i=n>i?0:Hu(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},findIndex:qu,findLastIndex:$u,first:Ju,flatten:Xo,flattenDeep:function(e){return(null==e?0:e.length)?qo(e,nd):[]},flattenDepth:function(e,t){return(null==e?0:e.length)?qo(e,t=void 0===t?1:Nt(t)):[]},fromPairs:function(e){for(var t=-1,n=null==e?0:e.length,i={};++t<n;){var o=e[t];i[o[0]]=o[1]}return i},head:Ju,indexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=null==n?0:Nt(n);return o<0&&(o=Nd(i+o,0)),kn(e,t,o)},initial:function(e){return(null==e?0:e.length)?hr(e,0,-1):[]},intersection:Td,intersectionBy:Ad,intersectionWith:kd,join:function(e,t){return null==e?"":rc.call(e,t)},last:vu,lastIndexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return void 0!==n&&(o=(o=Nt(n))<0?lc(i+o,0):uc(o,i-1)),t==t?function(e,t,n){for(var i=n+1;i--;)if(e[i]===t)return i;return i}(e,t,o):Tn(e,An,o,!0)},nth:function(e,t){return e&&e.length?kc(e,Nt(t)):void 0},pull:Ch,pullAll:Eh,pullAllBy:function(e,t,n){return e&&e.length&&t&&t.length?wh(e,t,Ol(n)):e},pullAllWith:function(e,t,n){return e&&e.length&&t&&t.length?wh(e,t,void 0,n):e},pullAt:Sh,remove:function(e,t){var n=[];if(!e||!e.length)return n;var i=-1,o=[],r=e.length;for(t=Ol(t);++i<r;){var a=e[i];t(a,i,e)&&(n.push(a),o.push(i))}return _h(e,o),n},reverse:Gh,slice:function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&Di(e,t,n)?(t=0,n=i):(t=null==t?0:Nt(t),n=void 0===n?i:Nt(n)),hr(e,t,n)):[]},sortedIndex:function(e,t){return sf(e,t)},sortedIndexBy:function(e,t,n){return rf(e,t,Ol(n))},sortedIndexOf:function(e,t){var n=null==e?0:e.length;if(n){var i=sf(e,t);if(i<n&&Ei(e[i],t))return i}return-1},sortedLastIndex:function(e,t){return sf(e,t,!0)},sortedLastIndexBy:function(e,t,n){return rf(e,t,Ol(n),!0)},sortedLastIndexOf:function(e,t){if(null==e?0:e.length){var n=sf(e,t,!0)-1;if(Ei(e[n],t))return n}return-1},sortedUniq:function(e){return e&&e.length?lf(e):[]},sortedUniqBy:function(e,t){return e&&e.length?lf(e,Ol(t)):[]},tail:function(e){var t=null==e?0:e.length;return t?hr(e,1,t):[]},take:function(e,t,n){return e&&e.length?hr(e,0,(t=n||void 0===t?1:Nt(t))<0?0:t):[]},takeRight:function(e,t,n){var i=null==e?0:e.length;return i?hr(e,(t=i-(t=n||void 0===t?1:Nt(t)))<0?0:t,i):[]},takeRightWhile:function(e,t){return e&&e.length?xu(e,Ol(t),!1,!0):[]},takeWhile:function(e,t){return e&&e.length?xu(e,Ol(t)):[]},union:Gf,unionBy:Uf,unionWith:qf,uniq:function(e){return e&&e.length?zf(e):[]},uniqBy:Xf,uniqWith:function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?zf(e,void 0,t):[]},unzip:Yf,unzipWith:$f,without:Qf,xor:np,xorBy:ip,xorWith:op,zip:rp,zipObject:function(e,t){return ap(e||[],t||[],Ni)},zipObjectDeep:function(e,t){return ap(e||[],t||[],Pc)},zipWith:sp},up={countBy:Ul,each:Eu,eachRight:Mu,every:function(e,t,n){var i=it(e)?Bu:ju;return n&&Di(e,t,n)&&(t=void 0),i(e,Ol(t))},filter:zu,find:Xu,findLast:Zu,flatMap:function(e,t){return qo(ed(e,t),1)},flatMapDeep:function(e,t){return qo(ed(e,t),td)},flatMapDepth:function(e,t,n){return n=void 0===n?1:Nt(n),qo(ed(e,t),n)},forEach:Eu,forEachRight:Mu,groupBy:ud,includes:function(e,t,n,i){e=Ri(e)?e:Ed(e),n=n&&!i?Nt(n):0;var o=e.length;return n<0&&(n=Cd(o+n,0)),xd(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&kn(e,t,n)>-1},invokeMap:Wd,keyBy:sc,map:ed,orderBy:function(e,t,n,i){return null==e?[]:(it(t)||(t=null==t?[]:[t]),it(n=i?void 0:n)||(n=null==n?[]:[n]),jc(e,t,n))},partition:mh,reduce:Hh,reduceRight:function(e,t,n){var i=it(e)?Wh:Fh,o=arguments.length<3;return i(e,Ol(t),n,o,Su)},reject:function(e,t){return(it(e)?Ma:Wu)(e,_c(Ol(t)))},sample:function(e){return(it(e)?qh:Xh)(e)},sampleSize:function(e,t,n){return t=(n?Di(e,t,n):void 0===t)?1:Nt(t),(it(e)?Kh:Yh)(e,t)},shuffle:function(e){return(it(e)?$h:Zh)(e)},size:function(e){if(null==e)return 0;if(Ri(e))return xd(e)?lh(e):e.length;var t=$a(e);return"[object Map]"==t||"[object Set]"==t?e.size:ao(e).length},some:function(e,t,n){var i=it(e)?Ws:Qh;return n&&Di(e,t,n)&&(t=void 0),i(e,Ol(t))},sortBy:ef},dp=Vl,cp={after:function(e,t){if("function"!=typeof t)throw new TypeError("Expected a function");return e=Nt(e),function(){if(--e<1)return t.apply(this,arguments)}},ary:xi,before:lr,bind:ur,bindKey:cr,curry:ql,curryRight:Xl,debounce:Zl,defer:du,delay:cu,flip:function(e){return yi(e,512)},memoize:Ro,negate:_c,once:function(e){return lr(2,e)},overArgs:Gc,partial:gh,partialRight:vh,rearg:jh,rest:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return Ti(e,t=void 0===t?t:Nt(t))},spread:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=null==t?0:uf(Nt(t),0),Ti((function(n){var i=n[t],o=fr(n,0,t);return i&&zo(o,i),Zt(e,this,o)}))},throttle:function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return pt(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Zl(e,t,{leading:i,maxWait:t,trailing:o})},unary:function(e){return xi(e,1)},wrap:function(e,t){return gh(wu(t),e)}},hp={castArray:function(){if(!arguments.length)return[];var e=arguments[0];return it(e)?e:[e]},clone:function(e){return Bs(e,4)},cloneDeep:js,cloneDeepWith:function(e,t){return Bs(e,5,t="function"==typeof t?t:void 0)},cloneWith:function(e,t){return Bs(e,4,t="function"==typeof t?t:void 0)},conformsTo:function(e,t){return null==t||Pl(e,t,so(t))},eq:Ei,gt:hd,gte:fd,isArguments:Wi,isArray:it,isArrayBuffer:Gd,isArrayLike:Ri,isArrayLikeObject:nu,isBoolean:function(e){return!0===e||!1===e||Ze(e)&&"[object Boolean]"==$e(e)},isBuffer:Xi,isDate:qd,isElement:function(e){return Ze(e)&&1===e.nodeType&&!nr(e)},isEmpty:Vd,isEqual:Kd,isEqualWith:function(e,t,n){var i=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===i?ml(e,t,void 0,n):!!i},isError:rr,isFinite:$d,isFunction:kt,isInteger:Zd,isLength:ki,isMap:Ss,isMatch:function(e,t){return e===t||xl(e,t,El(t))},isMatchWith:function(e,t,n){return n="function"==typeof n?n:void 0,xl(e,t,El(t),n)},isNaN:function(e){return Qd(e)&&e!=+e},isNative:function(e){if(ec(e))throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return zt(e)},isNil:tc,isNull:function(e){return null===e},isNumber:Qd,isObject:pt,isObjectLike:Ze,isPlainObject:nr,isRegExp:ic,isSafeInteger:function(e){return Zd(e)&&e>=-9007199254740991&&e<=oc},isSet:Ts,isString:xd,isSymbol:Qe,isTypedArray:eo,isUndefined:function(e){return void 0===e},isWeakMap:function(e){return Ze(e)&&"[object WeakMap]"==$a(e)},isWeakSet:function(e){return Ze(e)&&"[object WeakSet]"==$e(e)},lt:fc,lte:pc,toArray:Ac,toFinite:Ct,toInteger:Nt,toLength:Hu,toNumber:xt,toPlainObject:ou,toSafeInteger:function(e){return e?ba(Nt(e),-9007199254740991,Df):0===e?e:0},toString:Io},fp={add:ut,ceil:ga,divide:bu,floor:id,max:function(e){return e&&e.length?gc(e,_t,dd):void 0},maxBy:function(e,t){return e&&e.length?gc(e,Ol(t),dd):void 0},mean:function(e){return yc(e,_t)},meanBy:function(e,t){return yc(e,Ol(t))},min:function(e){return e&&e.length?gc(e,_t,hc):void 0},minBy:function(e,t){return e&&e.length?gc(e,Ol(t),hc):void 0},multiply:Cc,round:Uh,subtract:cf,sum:function(e){return e&&e.length?vc(e,_t):0},sumBy:function(e,t){return e&&e.length?vc(e,Ol(t)):0}},pp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=xt(n))==n?n:0),void 0!==t&&(t=(t=xt(t))==t?t:0),ba(xt(e),t,n)},gp=function(e,t,n){return t=Ct(t),void 0===n?(n=t,t=0):n=Ct(n),function(e,t,n){return e>=yd(t,n)&&e<md(t,n)}(e=xt(e),t,n)},vp=function(e,t,n){if(n&&"boolean"!=typeof n&&Di(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=Ct(e),void 0===t?(t=e,e=0):t=Ct(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=Dh();return Rh(e+o*(t-e+kh("1e-"+((o+"").length-1))),t)}return Ah(e,t)},mp={assign:uo,assignIn:po,assignInWith:go,assignWith:vo,at:Ko,create:function(e,t){var n=Kt(e);return null==t?n:wa(n,t)},defaults:eu,defaultsDeep:lu,entries:Au,entriesIn:ku,extend:po,extendWith:go,findKey:function(e,t){return Vu(e,Ol(t),jl)},findLastKey:function(e,t){return Vu(e,Ol(t),_u)},forIn:function(e,t){return null==e?e:Bl(e,wu(t),fo)},forInRight:function(e,t){return null==e?e:Nu(e,wu(t),fo)},forOwn:function(e,t){return e&&jl(e,wu(t))},forOwnRight:function(e,t){return e&&_u(e,wu(t))},functions:function(e){return null==e?[]:sd(e,so(e))},functionsIn:function(e){return null==e?[]:sd(e,fo(e))},get:Ho,has:vd,hasIn:Ml,invert:Od,invertBy:Bd,invoke:Hd,keys:so,keysIn:fo,mapKeys:function(e,t){var n={};return t=Ol(t),jl(e,(function(e,i,o){wi(n,t(e,i,o),e)})),n},mapValues:function(e,t){var n={};return t=Ol(t),jl(e,(function(e,i,o){wi(n,i,t(e,i,o))})),n},merge:bc,mergeWith:su,omit:Oc,omitBy:function(e,t){return Lc(e,_c(Ol(t)))},pick:yh,pickBy:Lc,result:function(e,t,n){var i=-1,o=(t=Lo(t,e)).length;for(o||(o=1,e=void 0);++i<o;){var r=null==e?void 0:e[jo(t[i])];void 0===r&&(i=o,r=n),e=kt(r)?r.call(e):r}return e},set:function(e,t,n){return null==e?e:Pc(e,t,n)},setWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Pc(e,t,n,i)},toPairs:Au,toPairsIn:ku,transform:function(e,t,n){var i=it(e),o=i||Xi(e)||eo(e);if(t=Ol(t),null==n){var r=e&&e.constructor;n=o?i?new r:[]:pt(e)&&kt(r)?Kt(Yo(e)):{}}return(o?Mn:jl)(e,(function(e,i,o){return t(n,e,i,o)})),n},unset:function(e,t){return null==e||Rc(e,t)},update:function(e,t,n){return null==e?e:Zf(e,t,wu(n))},updateWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Zf(e,t,wu(n),i)},values:Ed,valuesIn:function(e){return null==e?[]:wd(e,fo(e))}},yp={at:ep,chain:va,commit:function(){return new cn(this.value(),this.__chain__)},lodash:gn,next:function(){void 0===this.__values__&&(this.__values__=Ac(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},plant:function(e){for(var t,n=this;n instanceof nn;){var i=fn(n);i.__index__=0,i.__values__=void 0,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},reverse:function(){var e=this.__wrapped__;if(e instanceof rn){var t=e;return this.__actions__.length&&(t=new rn(this)),(t=t.reverse()).__actions__.push({func:Mf,args:[Gh],thisArg:void 0}),new cn(t,this.__chain__)}return this.thru(Gh)},tap:function(e,t){return t(e),e},thru:Mf,toIterator:function(){return this},toJSON:Rf,value:Rf,valueOf:Rf,wrapperChain:function(){return va(this)}},bp={camelCase:ca,capitalize:Rr,deburr:Br,endsWith:function(e,t,n){e=Io(e),t=st(t);var i=e.length,o=n=void 0===n?i:ba(Nt(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},escape:Pu,escapeRegExp:function(e){return(e=Io(e))&&Lu.test(e)?e.replace(Iu,"\\$&"):e},kebabCase:ac,lowerCase:dc,lowerFirst:cc,pad:function(e,t,n){e=Io(e);var i=(t=Nt(t))?lh(e):0;if(!t||i>=t)return e;var o=(t-i)/2;return dh(hh(o),n)+e+dh(ch(o),n)},padEnd:function(e,t,n){e=Io(e);var i=(t=Nt(t))?lh(e):0;return t&&i<t?e+dh(t-i,n):e},padStart:function(e,t,n){e=Io(e);var i=(t=Nt(t))?lh(e):0;return t&&i<t?dh(t-i,n)+e:e},parseInt:function(e,t,n){return n||null==t?t=0:t&&(t=+t),ph(Io(e).replace(fh,""),t||0)},repeat:function(e,t,n){return t=(n?Di(e,t,n):void 0===t)?1:Nt(t),Kc(Io(e),t)},replace:function(){var e=arguments,t=Io(e[0]);return e.length<3?t:t.replace(e[1],e[2])},snakeCase:Jh,split:function(e,t,n){return n&&"number"!=typeof n&&Di(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=Io(e))&&("string"==typeof t||null!=t&&!ic(t))&&!(t=st(t))&&gr(e)?fr(Tr(e),0,n):e.split(t,n):[]},startCase:df,startsWith:function(e,t,n){return e=Io(e),n=null==n?0:ba(Nt(n),0,e.length),t=st(t),e.slice(n,n+t.length)==t},template:function(e,t,n){var i=yf.imports._.templateSettings||yf;n&&Di(e,t,n)&&(t=void 0),e=Io(e),t=go({},t,i,pf);var o,r,a=go({},t.imports,i.imports,pf),s=so(a),l=wd(a,s),u=0,d=t.interpolate||Nf,c="__p += '",h=RegExp((t.escape||Nf).source+"|"+d.source+"|"+(d===mf?Cf:Nf).source+"|"+(t.evaluate||Nf).source+"|$","g"),f=Sf.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(h,(function(t,n,i,a,s,l){return i||(i=a),c+=e.slice(u,l).replace(_f,vf),n&&(o=!0,c+="' +\n__e("+n+") +\n'"),s&&(r=!0,c+="';\n"+s+";\n__p += '"),i&&(c+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),u=l+t.length,t})),c+="';\n";var p=Sf.call(t,"variable")&&t.variable;if(p){if(Ef.test(p))throw new Error("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(r?c.replace(bf,""):c).replace(xf,"$1").replace(wf,"$1;"),c="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(r?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var g=ar((function(){return Function(s,f+"return "+c).apply(void 0,l)}));if(g.source=c,rr(g))throw g;return g},templateSettings:yf,toLower:function(e){return Io(e).toLowerCase()},toUpper:function(e){return Io(e).toUpperCase()},trim:function(e,t,n){if((e=Io(e))&&(n||void 0===t))return ft(e);if(!e||!(t=st(t)))return e;var i=Tr(e),o=Tr(t);return fr(i,Pf(i,o),Of(i,o)+1).join("")},trimEnd:function(e,t,n){if((e=Io(e))&&(n||void 0===t))return e.slice(0,ct(e)+1);if(!e||!(t=st(t)))return e;var i=Tr(e);return fr(i,0,Of(i,Tr(t))+1).join("")},trimStart:function(e,t,n){if((e=Io(e))&&(n||void 0===t))return e.replace(If,"");if(!e||!(t=st(t)))return e;var i=Tr(e);return fr(i,Pf(i,Tr(t))).join("")},truncate:function(e,t){var n=30,i="...";if(pt(t)){var o="separator"in t?t.separator:o;n="length"in t?Nt(t.length):n,i="omission"in t?st(t.omission):i}var r=(e=Io(e)).length;if(gr(e)){var a=Tr(e);r=a.length}if(n>=r)return e;var s=n-lh(i);if(s<1)return i;var l=a?fr(a,0,s).join(""):e.slice(0,s);if(void 0===o)return l+i;if(a&&(s+=l.length-s),ic(o)){if(e.slice(s).search(o)){var u,d=l;for(o.global||(o=RegExp(o.source,Io(Lf.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var c=u.index;l=l.slice(0,void 0===c?s:c)}}else if(e.indexOf(st(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+i},unescape:function(e){return(e=Io(e))&&Ff.test(e)?e.replace(jf,Bf):e},upperCase:Jf,upperFirst:kr,words:la},xp={attempt:ar,bindAll:dr,cond:function(e){var t=null==e?0:e.length,n=Ol;return e=t?nt(e,(function(e){if("function"!=typeof e[1])throw new TypeError("Expected a function");return[n(e[0]),e[1]]})):[],Ti((function(n){for(var i=-1;++i<t;){var o=e[i];if(Zt(o[0],this,n))return Zt(o[1],this,n)}}))},conforms:function(e){return function(e){var t=so(e);return function(n){return Pl(n,e,t)}}(Bs(e,1))},constant:Cn,defaultTo:function(e,t){return null==e||e!=e?t:e},flow:rd,flowRight:ad,identity:_t,iteratee:function(e){return Ol("function"==typeof e?e:Bs(e,1))},matches:function(e){return Nl(Bs(e,1))},matchesProperty:function(e,t){return kl(e,Bs(t,1))},method:xc,methodOf:wc,mixin:Ec,noop:an,nthArg:function(e){return e=Nt(e),Ti((function(t){return kc(t,e)}))},over:Hc,overEvery:Uc,overSome:qc,property:Dl,propertyOf:function(e){return function(t){return null==e?void 0:Fo(e,t)}},range:Lh,rangeRight:Bh,stubArray:Ta,stubFalse:zi,stubObject:function(){return{}},stubString:function(){return""},stubTrue:function(){return!0},times:function(e,t){if((e=Nt(e))<1||e>9007199254740991)return[];var n=Tf,i=Af(e,Tf);t=wu(t),e-=Tf;for(var o=Li(i,t);++n<e;)t(n);return o},toPath:function(e){return it(e)?nt(e,jo):Qe(e)?[e]:hn(Po(Io(e)))},uniqueId:function(e){var t=++Vf;return Io(e)+t}};var wp=Math.max,Ep=Math.min;var Cp=Math.min;var Np,_p,Sp=4294967295,Mp=Array.prototype,Tp=Object.prototype.hasOwnProperty,Ap=We?We.iterator:void 0,kp=Math.max,Rp=Math.min,Dp=function(e){return function(t,n,i){if(null==i){var o=pt(n),r=o&&so(n),a=r&&r.length&&sd(n,r);(a?a.length:o)||(i=n,n=t,t=this)}return e(t,n,i)}}(Ec);gn.after=cp.after,gn.ary=cp.ary,gn.assign=mp.assign,gn.assignIn=mp.assignIn,gn.assignInWith=mp.assignInWith,gn.assignWith=mp.assignWith,gn.at=mp.at,gn.before=cp.before,gn.bind=cp.bind,gn.bindAll=xp.bindAll,gn.bindKey=cp.bindKey,gn.castArray=hp.castArray,gn.chain=yp.chain,gn.chunk=lp.chunk,gn.compact=lp.compact,gn.concat=lp.concat,gn.cond=xp.cond,gn.conforms=xp.conforms,gn.constant=xp.constant,gn.countBy=up.countBy,gn.create=mp.create,gn.curry=cp.curry,gn.curryRight=cp.curryRight,gn.debounce=cp.debounce,gn.defaults=mp.defaults,gn.defaultsDeep=mp.defaultsDeep,gn.defer=cp.defer,gn.delay=cp.delay,gn.difference=lp.difference,gn.differenceBy=lp.differenceBy,gn.differenceWith=lp.differenceWith,gn.drop=lp.drop,gn.dropRight=lp.dropRight,gn.dropRightWhile=lp.dropRightWhile,gn.dropWhile=lp.dropWhile,gn.fill=lp.fill,gn.filter=up.filter,gn.flatMap=up.flatMap,gn.flatMapDeep=up.flatMapDeep,gn.flatMapDepth=up.flatMapDepth,gn.flatten=lp.flatten,gn.flattenDeep=lp.flattenDeep,gn.flattenDepth=lp.flattenDepth,gn.flip=cp.flip,gn.flow=xp.flow,gn.flowRight=xp.flowRight,gn.fromPairs=lp.fromPairs,gn.functions=mp.functions,gn.functionsIn=mp.functionsIn,gn.groupBy=up.groupBy,gn.initial=lp.initial,gn.intersection=lp.intersection,gn.intersectionBy=lp.intersectionBy,gn.intersectionWith=lp.intersectionWith,gn.invert=mp.invert,gn.invertBy=mp.invertBy,gn.invokeMap=up.invokeMap,gn.iteratee=xp.iteratee,gn.keyBy=up.keyBy,gn.keys=so,gn.keysIn=mp.keysIn,gn.map=up.map,gn.mapKeys=mp.mapKeys,gn.mapValues=mp.mapValues,gn.matches=xp.matches,gn.matchesProperty=xp.matchesProperty,gn.memoize=cp.memoize,gn.merge=mp.merge,gn.mergeWith=mp.mergeWith,gn.method=xp.method,gn.methodOf=xp.methodOf,gn.mixin=Dp,gn.negate=_c,gn.nthArg=xp.nthArg,gn.omit=mp.omit,gn.omitBy=mp.omitBy,gn.once=cp.once,gn.orderBy=up.orderBy,gn.over=xp.over,gn.overArgs=cp.overArgs,gn.overEvery=xp.overEvery,gn.overSome=xp.overSome,gn.partial=cp.partial,gn.partialRight=cp.partialRight,gn.partition=up.partition,gn.pick=mp.pick,gn.pickBy=mp.pickBy,gn.property=xp.property,gn.propertyOf=xp.propertyOf,gn.pull=lp.pull,gn.pullAll=lp.pullAll,gn.pullAllBy=lp.pullAllBy,gn.pullAllWith=lp.pullAllWith,gn.pullAt=lp.pullAt,gn.range=xp.range,gn.rangeRight=xp.rangeRight,gn.rearg=cp.rearg,gn.reject=up.reject,gn.remove=lp.remove,gn.rest=cp.rest,gn.reverse=lp.reverse,gn.sampleSize=up.sampleSize,gn.set=mp.set,gn.setWith=mp.setWith,gn.shuffle=up.shuffle,gn.slice=lp.slice,gn.sortBy=up.sortBy,gn.sortedUniq=lp.sortedUniq,gn.sortedUniqBy=lp.sortedUniqBy,gn.split=bp.split,gn.spread=cp.spread,gn.tail=lp.tail,gn.take=lp.take,gn.takeRight=lp.takeRight,gn.takeRightWhile=lp.takeRightWhile,gn.takeWhile=lp.takeWhile,gn.tap=yp.tap,gn.throttle=cp.throttle,gn.thru=Mf,gn.toArray=hp.toArray,gn.toPairs=mp.toPairs,gn.toPairsIn=mp.toPairsIn,gn.toPath=xp.toPath,gn.toPlainObject=hp.toPlainObject,gn.transform=mp.transform,gn.unary=cp.unary,gn.union=lp.union,gn.unionBy=lp.unionBy,gn.unionWith=lp.unionWith,gn.uniq=lp.uniq,gn.uniqBy=lp.uniqBy,gn.uniqWith=lp.uniqWith,gn.unset=mp.unset,gn.unzip=lp.unzip,gn.unzipWith=lp.unzipWith,gn.update=mp.update,gn.updateWith=mp.updateWith,gn.values=mp.values,gn.valuesIn=mp.valuesIn,gn.without=lp.without,gn.words=bp.words,gn.wrap=cp.wrap,gn.xor=lp.xor,gn.xorBy=lp.xorBy,gn.xorWith=lp.xorWith,gn.zip=lp.zip,gn.zipObject=lp.zipObject,gn.zipObjectDeep=lp.zipObjectDeep,gn.zipWith=lp.zipWith,gn.entries=mp.toPairs,gn.entriesIn=mp.toPairsIn,gn.extend=mp.assignIn,gn.extendWith=mp.assignInWith,Dp(gn,gn),gn.add=fp.add,gn.attempt=xp.attempt,gn.camelCase=bp.camelCase,gn.capitalize=bp.capitalize,gn.ceil=fp.ceil,gn.clamp=pp,gn.clone=hp.clone,gn.cloneDeep=hp.cloneDeep,gn.cloneDeepWith=hp.cloneDeepWith,gn.cloneWith=hp.cloneWith,gn.conformsTo=hp.conformsTo,gn.deburr=bp.deburr,gn.defaultTo=xp.defaultTo,gn.divide=fp.divide,gn.endsWith=bp.endsWith,gn.eq=hp.eq,gn.escape=bp.escape,gn.escapeRegExp=bp.escapeRegExp,gn.every=up.every,gn.find=up.find,gn.findIndex=lp.findIndex,gn.findKey=mp.findKey,gn.findLast=up.findLast,gn.findLastIndex=lp.findLastIndex,gn.findLastKey=mp.findLastKey,gn.floor=fp.floor,gn.forEach=up.forEach,gn.forEachRight=up.forEachRight,gn.forIn=mp.forIn,gn.forInRight=mp.forInRight,gn.forOwn=mp.forOwn,gn.forOwnRight=mp.forOwnRight,gn.get=mp.get,gn.gt=hp.gt,gn.gte=hp.gte,gn.has=mp.has,gn.hasIn=mp.hasIn,gn.head=lp.head,gn.identity=_t,gn.includes=up.includes,gn.indexOf=lp.indexOf,gn.inRange=gp,gn.invoke=mp.invoke,gn.isArguments=hp.isArguments,gn.isArray=it,gn.isArrayBuffer=hp.isArrayBuffer,gn.isArrayLike=hp.isArrayLike,gn.isArrayLikeObject=hp.isArrayLikeObject,gn.isBoolean=hp.isBoolean,gn.isBuffer=hp.isBuffer,gn.isDate=hp.isDate,gn.isElement=hp.isElement,gn.isEmpty=hp.isEmpty,gn.isEqual=hp.isEqual,gn.isEqualWith=hp.isEqualWith,gn.isError=hp.isError,gn.isFinite=hp.isFinite,gn.isFunction=hp.isFunction,gn.isInteger=hp.isInteger,gn.isLength=hp.isLength,gn.isMap=hp.isMap,gn.isMatch=hp.isMatch,gn.isMatchWith=hp.isMatchWith,gn.isNaN=hp.isNaN,gn.isNative=hp.isNative,gn.isNil=hp.isNil,gn.isNull=hp.isNull,gn.isNumber=hp.isNumber,gn.isObject=pt,gn.isObjectLike=hp.isObjectLike,gn.isPlainObject=hp.isPlainObject,gn.isRegExp=hp.isRegExp,gn.isSafeInteger=hp.isSafeInteger,gn.isSet=hp.isSet,gn.isString=hp.isString,gn.isSymbol=hp.isSymbol,gn.isTypedArray=hp.isTypedArray,gn.isUndefined=hp.isUndefined,gn.isWeakMap=hp.isWeakMap,gn.isWeakSet=hp.isWeakSet,gn.join=lp.join,gn.kebabCase=bp.kebabCase,gn.last=vu,gn.lastIndexOf=lp.lastIndexOf,gn.lowerCase=bp.lowerCase,gn.lowerFirst=bp.lowerFirst,gn.lt=hp.lt,gn.lte=hp.lte,gn.max=fp.max,gn.maxBy=fp.maxBy,gn.mean=fp.mean,gn.meanBy=fp.meanBy,gn.min=fp.min,gn.minBy=fp.minBy,gn.stubArray=xp.stubArray,gn.stubFalse=xp.stubFalse,gn.stubObject=xp.stubObject,gn.stubString=xp.stubString,gn.stubTrue=xp.stubTrue,gn.multiply=fp.multiply,gn.nth=lp.nth,gn.noop=xp.noop,gn.now=dp,gn.pad=bp.pad,gn.padEnd=bp.padEnd,gn.padStart=bp.padStart,gn.parseInt=bp.parseInt,gn.random=vp,gn.reduce=up.reduce,gn.reduceRight=up.reduceRight,gn.repeat=bp.repeat,gn.replace=bp.replace,gn.result=mp.result,gn.round=fp.round,gn.sample=up.sample,gn.size=up.size,gn.snakeCase=bp.snakeCase,gn.some=up.some,gn.sortedIndex=lp.sortedIndex,gn.sortedIndexBy=lp.sortedIndexBy,gn.sortedIndexOf=lp.sortedIndexOf,gn.sortedLastIndex=lp.sortedLastIndex,gn.sortedLastIndexBy=lp.sortedLastIndexBy,gn.sortedLastIndexOf=lp.sortedLastIndexOf,gn.startCase=bp.startCase,gn.startsWith=bp.startsWith,gn.subtract=fp.subtract,gn.sum=fp.sum,gn.sumBy=fp.sumBy,gn.template=bp.template,gn.times=xp.times,gn.toFinite=hp.toFinite,gn.toInteger=Nt,gn.toLength=hp.toLength,gn.toLower=bp.toLower,gn.toNumber=hp.toNumber,gn.toSafeInteger=hp.toSafeInteger,gn.toString=hp.toString,gn.toUpper=bp.toUpper,gn.trim=bp.trim,gn.trimEnd=bp.trimEnd,gn.trimStart=bp.trimStart,gn.truncate=bp.truncate,gn.unescape=bp.unescape,gn.uniqueId=xp.uniqueId,gn.upperCase=bp.upperCase,gn.upperFirst=bp.upperFirst,gn.each=up.forEach,gn.eachRight=up.forEachRight,gn.first=lp.head,Dp(gn,(Np={},jl(gn,(function(e,t){Tp.call(gn.prototype,t)||(Np[t]=e)})),Np),{chain:!1}),gn.VERSION="4.17.21",(gn.templateSettings=bp.templateSettings).imports._=gn,Mn(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){gn[e].placeholder=gn})),Mn(["drop","take"],(function(e,t){rn.prototype[e]=function(n){n=void 0===n?1:kp(Nt(n),0);var i=this.__filtered__&&!t?new rn(this):this.clone();return i.__filtered__?i.__takeCount__=Rp(n,i.__takeCount__):i.__views__.push({size:Rp(n,Sp),type:e+(i.__dir__<0?"Right":"")}),i},rn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Mn(["filter","map","takeWhile"],(function(e,t){var n=t+1,i=1==n||3==n;rn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ol(e),type:n}),t.__filtered__=t.__filtered__||i,t}})),Mn(["head","last"],(function(e,t){var n="take"+(t?"Right":"");rn.prototype[e]=function(){return this[n](1).value()[0]}})),Mn(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");rn.prototype[e]=function(){return this.__filtered__?new rn(this):this[n](1)}})),rn.prototype.compact=function(){return this.filter(_t)},rn.prototype.find=function(e){return this.filter(e).head()},rn.prototype.findLast=function(e){return this.reverse().find(e)},rn.prototype.invokeMap=Ti((function(e,t){return"function"==typeof e?new rn(this):this.map((function(n){return Fd(n,e,t)}))})),rn.prototype.reject=function(e){return this.filter(_c(Ol(e)))},rn.prototype.slice=function(e,t){e=Nt(e);var n=this;return n.__filtered__&&(e>0||t<0)?new rn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=Nt(t))<0?n.dropRight(-t):n.take(t-e)),n)},rn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},rn.prototype.toArray=function(){return this.take(Sp)},jl(rn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=gn[i?"take"+("last"==t?"Right":""):t],r=i||/^find/.test(t);o&&(gn.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,s=t instanceof rn,l=a[0],u=s||it(t),d=function(e){var t=o.apply(gn,zo([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,f=r&&!c,p=s&&!h;if(!r&&u){t=p?t:new rn(this);var g=e.apply(t,a);return g.__actions__.push({func:Mf,args:[d],thisArg:void 0}),new cn(g,c)}return f&&p?e.apply(this,a):(g=this.thru(d),f?i?g.value()[0]:g.value():g)})})),Mn(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Mp[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);gn.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var o=this.value();return t.apply(it(o)?o:[],e)}return this[n]((function(n){return t.apply(it(n)?n:[],e)}))}})),jl(rn.prototype,(function(e,t){var n=gn[t];if(n){var i=n.name+"";Tp.call(ln,i)||(ln[i]=[]),ln[i].push({name:t,func:n})}})),ln[ei(void 0,2).name]=[{name:"wrapper",func:void 0}],rn.prototype.clone=function(){var e=new rn(this.__wrapped__);return e.__actions__=hn(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=hn(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=hn(this.__views__),e},rn.prototype.reverse=function(){if(this.__filtered__){var e=new rn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},rn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=it(e),i=t<0,o=n?e.length:0,r=function(e,t,n){for(var i=-1,o=n.length;++i<o;){var r=n[i],a=r.size;switch(r.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=Ep(t,e+a);break;case"takeRight":e=wp(e,t-a)}}return{start:e,end:t}}(0,o,this.__views__),a=r.start,s=r.end,l=s-a,u=i?s:a-1,d=this.__iteratees__,c=d.length,h=0,f=Cp(l,this.__takeCount__);if(!n||!i&&o==l&&f==l)return kf(e,this.__actions__);var p=[];e:for(;l--&&h<f;){for(var g=-1,v=e[u+=t];++g<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}}p[h++]=v}return p},gn.prototype.at=yp.at,gn.prototype.chain=yp.wrapperChain,gn.prototype.commit=yp.commit,gn.prototype.next=yp.next,gn.prototype.plant=yp.plant,gn.prototype.reverse=yp.reverse,gn.prototype.toJSON=gn.prototype.valueOf=gn.prototype.value=yp.value,gn.prototype.first=gn.prototype.head,Ap&&(gn.prototype[Ap]=yp.toIterator),_p={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(t){e=t}throw e}},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;var Op=0;function Pp(e,t,n,i,o,r){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)"ref"==s?a=t[s]:l[s]=t[s];var u={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Op,__i:-1,__u:0,__source:o,__self:r};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return _p.vnode&&_p.vnode(u),u}var Ip=t.LogicFlowUtil.StepDrag,Lp=function(e){function n(n){var i=e.call(this)||this;return i.updatePosition=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.x,a=o.y;i.nodeModel.x=r+t/2,i.nodeModel.y=a+n/2,i.nodeModel.moveText(t/2,n/2)},i.getResize=function(e){var t=e.index,n=e.deltaX,i=e.deltaY,o=e.width,r=e.height,a=e.PCTResizeInfo,s=e.pct,l=void 0===s?1:s,u=e.freezeWidth,d=void 0!==u&&u,c=e.freezeHeight,h=void 0!==c&&c,f={width:o,height:r,deltaX:n,deltaY:i};if(a){var p=0,g=0;switch(t){case 0:g=(-1*n-i)/4;break;case 1:g=(n-i)/4;break;case 2:g=(n+i)/4;break;case 3:g=(-1*n+i)/4}0!==g&&(p=Math.round(g/a.ResizeBasis.basisHeight*1e5)/1e3),a.ResizePCT.widthPCT=Math.max(Math.min(a.ResizePCT.widthPCT+p,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit),a.ResizePCT.heightPCT=Math.max(Math.min(a.ResizePCT.heightPCT+p,a.ScaleLimit.maxScaleLimit),a.ScaleLimit.minScaleLimit);var v=Math.round(a.ResizePCT.widthPCT*a.ResizeBasis.basisWidth/100),m=Math.round(a.ResizePCT.heightPCT*a.ResizeBasis.basisHeight/100);switch(t){case 0:n=o-v,i=r-m;break;case 1:n=v-o,i=r-m;break;case 2:n=v-o,i=m-r;break;case 3:n=o-v,i=m-r}return f.width=v,f.height=m,f.deltaX=n/l,f.deltaY=i/l,f}switch(t){case 0:f.width=d?o:o-n*l,f.height=h?r:r-i*l;break;case 1:f.width=d?o:o+n*l,f.height=h?r:r-i*l;break;case 2:f.width=d?o:o+n*l,f.height=h?r:r+i*l;break;case 3:f.width=d?o:o-n*l,f.height=h?r:r+i*l}return f},i.updateEdgePointByAnchors=function(){var e=i.nodeModel,t=e.id,n=e.anchors,o=i.getNodeEdges(t);o.sourceEdges.forEach((function(e){var t=n.find((function(t){return t.id===e.sourceAnchorId}));t&&e.updateStartPoint({x:t.x,y:t.y})})),o.targetEdges.forEach((function(e){var t=n.find((function(t){return t.id===e.targetAnchorId}));t&&e.updateEndPoint({x:t.x,y:t.y})}))},i.updateRect=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.x,a=o.y,s=o.width,l=o.height,u=o.radius,d=o.PCTResizeInfo,c=i.nodeModel,h=c.minWidth,f=c.minHeight,p=c.maxWidth,g=c.maxHeight,v=i.index,m=h===p,y=f===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>p||b.height<f||b.height>g)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:m?0:b.deltaX,deltaY:y?0:b.deltaY}),i.nodeModel.width=b.width,i.nodeModel.height=b.height,i.nodeModel.setProperties({nodeSize:{width:b.width,height:b.height}});var x={x:r,y:a,width:s,height:l,radius:u},w={x:i.nodeModel.x,y:i.nodeModel.y,width:i.nodeModel.width,height:i.nodeModel.height,radius:u};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:x,afterNode:w})}},i.updateEllipse=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.rx,a=o.ry,s=o.x,l=o.y,u=o.PCTResizeInfo,d=i.index,c=i.nodeModel,h=c.minWidth,f=c.minHeight,p=c.maxWidth,v=c.maxHeight,m=h===p,y=f===v,b=r,x=a,w=i.getResize({index:d,deltaX:t,deltaY:n,width:b,height:x,PCTResizeInfo:u,pct:.5,freezeWidth:m,freezeHeight:y});if(w.width<h/2||w.width>p/2||w.height<f/2||w.height>v/2)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:m?0:w.deltaX,deltaY:y?0:w.deltaY}),i.nodeModel.rx=w.width,i.nodeModel.ry=w.height,i.nodeModel.setProperties({nodeSize:{rx:w.width,ry:w.height}});var E={x:s,y:l},C={rx:w.width,ry:w.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:g(g({},E),{rx:r,ry:a}),afterNode:C})}},i.updateDiamond=function(e){var t=e.deltaX,n=e.deltaY,o=i.nodeModel,r=o.rx,a=o.ry,s=o.x,l=o.y,u=o.PCTResizeInfo,d=i.index,c=i.nodeModel,h=c.minWidth,f=c.minHeight,p=c.maxWidth,g=c.maxHeight,v=h===p,m=f===g,y=r,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>p/2||x.height<f/2||x.height>g/2)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:v?0:x.deltaX,deltaY:m?0:x.deltaY}),i.nodeModel.rx=x.width,i.nodeModel.ry=x.height,i.nodeModel.setProperties({nodeSize:{rx:x.width,ry:x.height}});var w={x:s,y:l,rx:r,ry:a},E={rx:x.width,ry:x.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:w,afterNode:E})}},i.eventEmit=function(e){var t=e.deltaX,n=e.deltaY,o=e.beforeNode,r=e.afterNode,a=i.nodeModel,s=a.id,l=a.modelType,u=a.type,d=g({id:s,modelType:l,type:u},o),c=g({id:s,modelType:l,type:u},r);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,o=e.deltaX,r=e.deltaY,a=i.graphModel.transformModel,s=i.nodeModel.modelType;o=(n=w(a.fixDeltaXY(o,r),2))[0],r=n[1],s===t.ModelType.RECT_NODE||s===t.ModelType.HTML_NODE?i.updateRect({deltaX:o,deltaY:r}):s===t.ModelType.ELLIPSE_NODE?i.updateEllipse({deltaX:o,deltaY:r}):s===t.ModelType.DIAMOND_NODE&&i.updateDiamond({deltaX:o,deltaY:r})},i.onDragEnd=function(){var e=i.graphModel.gridSize,t=void 0===e?1:e,n=t*Math.round(i.nodeModel.x/t),o=t*Math.round(i.nodeModel.y/t);i.nodeModel.moveTo(n,o),i.updateEdgePointByAnchors()},i.index=n.index,i.nodeModel=n.model,i.graphModel=n.graphModel,i.dragHandler=new Ip({onDragging:i.onDragging,onDragEnd:i.onDragEnd,step:1}),i}return p(n,e),n.prototype.getNodeEdges=function(e){for(var t=this.graphModel.edges,n=[],i=[],o=0;o<t.length;o++){var r=t[o];r.sourceNodeId===e?n.push(r):t[o].targetNodeId===e&&i.push(r)}return{sourceEdges:n,targetEdges:i}},n.prototype.render=function(){var e=this.props,n=e.x,i=e.y,o=e.index,r=e.model.getControlPointStyle();return Pp("g",{className:"lf-resize-control-".concat(o),children:Pp(t.Rect,g({className:"lf-node-control",x:n,y:i},r,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(t.Component),Bp=function(e){function n(){var t=e.call(this)||this;return t.state={},t}return p(n,e),n.prototype.getResizeControl=function(){var e=this.props,t=e.model,n=e.graphModel,i=t.x,o=t.y,r=t.width,a=t.height,s={minX:i-r/2,minY:o-a/2,maxX:i+r/2,maxY:o+a/2},l=s.minX,u=s.minY,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 Pp(Lp,g({index:i},e,{model:t,graphModel:n}))}))},n.prototype.getGroupSolid=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getResizeOutlineStyle();return Pp(t.Rect,g({},a,{x:n,y:i,width:o,height:r}))},n.prototype.render=function(){return Pp("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(t.Component),jp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.EllipseNodeModel),Fp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pp(Bp,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){var e=this.props,t=e.model,n=e.graphModel.editConfigModel.isSilentMode;return Pp("g",{children:[this.getResizeShape(),t.isSelected&&!n?this.getControlGroup():""]})},t}(t.EllipseNode),Hp={type:"ellipse",view:Fp,model:jp},Wp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.gridSize=1},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.rx,basisHeight:this.ry},n={maxScaleLimit:Math.min(this.maxWidth/(2*this.rx)*100,this.maxHeight/(2*this.ry)*100),minScaleLimit:Math.max(this.minWidth/(2*this.rx)*100,this.minHeight/(2*this.ry)*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.DiamondNodeModel),zp=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pp(Bp,{model:t,graphModel:n})},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.points,i=e.getNodeStyle();return Pp("g",{children:Pp(t.Polygon,g({},i,{points:n}))})},n.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Pp("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},n}(t.DiamondNode),Gp={type:"diamond",view:zp,model:Wp},Up=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.HtmlNodeModel),qp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pp(Bp,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Pp("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},t}(t.HtmlNode),Xp={type:"html",view:qp,model:Up},Vp=function(e){function t(t,n){var i=e.call(this,t,n)||this,o=t.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(t.stroke="none",t.hover&&(t.hover.stroke="none")),t},t.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},t.prototype.enableProportionResize=function(e){if(void 0===e&&(e=!0),e){var t={basisWidth:this.width,basisHeight:this.height},n={maxScaleLimit:Math.min(this.maxWidth/this.width*100,this.maxHeight/this.height*100),minScaleLimit:Math.max(this.minWidth/this.width*100,this.minHeight/this.height*100)};this.PCTResizeInfo={ResizePCT:{widthPCT:100,heightPCT:100},ResizeBasis:t,ScaleLimit:n}}else delete this.PCTResizeInfo},t}(t.RectNodeModel),Kp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pp(Bp,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){return Pp("g",{children:this.getResizeShape()})},t}(t.RectNode),Yp={type:"rect",view:Kp,model:Vp},$p={pluginName:"nodeResize",step:0,install:function(e){e.register(Hp),e.register(Gp),e.register(Xp),e.register(Yp)}},Zp=function(e){function t(){var t=e.apply(this,E([],w(arguments),!1))||this;return t.isGroup=!0,t.isFolded=!1,t.unfoldedWidth=500,t.unfoldedHeight=300,t.childrenLastFoldStatus={},t}return p(t,e),t.prototype.initNodeData=function(t){var n=this;e.prototype.initNodeData.call(this,t);var i=[];it(t.children)&&(i=t.children),this.children=new Set(i),this.width=500,this.height=300,this.foldedWidth=80,this.foldedHeight=60,this.zIndex=-1e4,this.radius=0,this.text.editable=!1,this.text.draggable=!1,this.isRestrict=!1,this.resizable=!1,this.autoToFront=!1,this.foldable=!1,void 0===this.properties.isFolded&&(this.properties.isFolded=!1),this.isFolded=!!this.properties.isFolded,setTimeout((function(){n.isFolded&&n.foldGroup(n.isFolded)}))},t.prototype.foldGroup=function(e){var t=this;if(e!==this.isFolded){this.setProperty("isFolded",e),this.isFolded=e,e?(this.x=this.x-this.width/2+this.foldedWidth/2,this.y=this.y-this.height/2+this.foldedHeight/2,this.unfoldedWidth=this.width,this.unfoldedHeight=this.height,this.width=this.foldedWidth,this.height=this.foldedHeight):(this.width=this.unfoldedWidth,this.height=this.unfoldedHeight,this.x=this.x+this.width/2-this.foldedWidth/2,this.y=this.y+this.height/2-this.foldedHeight/2);var n=E(E([],w(this.incoming.edges),!1),w(this.outgoing.edges),!1);this.children.forEach((function(i){var o=t.graphModel.getElement(i);if(o){var r=o.isFolded;if(o.isGroup&&!o.isFolded&&o.foldGroup(e),o.isGroup&&!e){var a=t.childrenLastFoldStatus[i];void 0!==a&&a!==o.isFolded&&o.foldGroup(a)}t.childrenLastFoldStatus[i]=!!r,o.visible=!e;var s=o.incoming.edges,l=o.outgoing.edges;n=E(E(E([],w(n),!1),w(s),!1),w(l),!1)}})),this.foldEdge(e,n)}},t.prototype.getAnchorStyle=function(t){var n=e.prototype.getAnchorStyle.call(this,t);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},t.prototype.foldEdge=function(e,t){var n=this;t.forEach((function(t,i){var o=t.id,r=t.sourceNodeId,a=t.targetNodeId,s=t.startPoint,l=t.endPoint,u=t.type,d=t.text,c=t.getProperties(),h={id:"".concat(o,"__").concat(i),sourceNodeId:r,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 f=n.graphModel.group.getNodeGroup(a);f||(f=n.graphModel.getNodeModelById(a));var p=n.graphModel.group.getNodeGroup(r);p||(p=n.graphModel.getNodeModelById(r)),e&&!1!==t.visible&&(n.children.has(r)||n.id===r?(h.startPoint=void 0,h.sourceNodeId=n.id):(h.endPoint=void 0,h.targetNodeId=n.id),f.id===n.id&&p.id===n.id||n.createVirtualEdge(h),t.visible=!1),e||!1!==t.visible||(f&&f.isGroup&&f.isFolded?(h.targetNodeId=f.id,h.endPoint=void 0,n.createVirtualEdge(h)):p&&p.isGroup&&p.isFolded?(h.sourceNodeId=p.id,h.startPoint=void 0,n.createVirtualEdge(h)):t.visible=!0)}))},t.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isFoldedEdge=!0},t.prototype.isInRange=function(e){var t=e.minX,n=e.minY,i=e.maxX,o=e.maxY;return t>=this.x-this.width/2&&i<=this.x+this.width/2&&n>=this.y-this.height/2&&o<=this.y+this.height/2},t.prototype.isAllowMoveTo=function(e){var t=e.minX,n=e.minY,i=e.maxX,o=e.maxY;return{x:t>=this.x-this.width/2&&i<=this.x+this.width/2,y:n>=this.y-this.height/2&&o<=this.y+this.height/2}},t.prototype.setAllowAppendChild=function(e){this.setProperty("groupAddable",e)},t.prototype.addChild=function(e){this.children.add(e),this.graphModel.eventCenter.emit("group:add-node",{data:this.getData()})},t.prototype.removeChild=function(e){this.children.delete(e),this.graphModel.eventCenter.emit("group:remove-node",{data:this.getData()})},t.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},t.prototype.getData=function(){var t=this,n=e.prototype.getData.call(this);n.children=[],this.children.forEach((function(e){var i=t.graphModel.getNodeModelById(e);i&&!i.virtual&&n.children.push(e)}));var i=n.properties;return null==i||delete i.groupAddable,null==i||delete i.isFolded,n},t.prototype.getHistoryData=function(){var t=e.prototype.getData.call(this);t.children=E([],w(this.children),!1),t.isGroup=!0;var n=t.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(t.x=t.x+this.unfoldedWidth/2-this.foldedWidth/2,t.y=t.y+this.unfoldedHeight/2-this.foldedHeight/2),t},t.prototype.isAllowAppendIn=function(e){return!0},t.prototype.toBack=function(){this.zIndex--},t}(Vp),Jp=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getControlGroup=function(){var t=this.props.model,n=t.resizable,i=t.properties;return n&&!i.isFolded?e.prototype.getControlGroup.call(this):null},n.prototype.getAddableShape=function(){var e=this.props.model,n=e.width,i=e.height,o=e.x,r=e.y,a=e.radius,s=e.properties,l=e.getAddableOutlineStyle;if(!s.groupAddable)return null;var u=this.props.model.getNodeStyle().strokeWidth,d=void 0===u?0:u,c=l(),h=n+d+8,f=i+d+8;return t.h("rect",g(g({},c),{width:h,height:f,x:o-h/2,y:r-f/2,rx:a,ry:a}))},n.prototype.getFoldIcon=function(){var e=this.props.model,n=e.x-e.width/2+5,i=e.y-e.height/2+5;if(!e.foldable)return null;var o=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:e.properties.isFolded?"M ".concat(n+3,",").concat(i+6," ").concat(n+11,",").concat(i+6," M").concat(n+7,",").concat(i+2," ").concat(n+7,",").concat(i+10):"M ".concat(n+3,",").concat(i+6," ").concat(n+11,",").concat(i+6," ")});return t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:e.x-e.width/2+5,y:e.y-e.height/2+5,onClick:function(){e.foldGroup(!e.properties.isFolded)}}),o])},n.prototype.getResizeShape=function(){return t.h("g",{},[this.getAddableShape(),e.prototype.getResizeShape.call(this),this.getFoldIcon()])},n}(Kp),Qp={type:"group",view:Jp,model:Zp},eg=-1e4,tg=function(){function e(e){var t=e.lf,n=this;this.topGroupZIndex=eg,this.nodeGroupMap=new Map,this.graphRendered=function(e){var t=e.data;t&&t.nodes&&(t.nodes.forEach((function(e){e.children&&e.children.forEach((function(t){n.nodeGroupMap.set(t,e.id)}))})),n.checkAndCorrectTopGroupZIndex(t.nodes))},this.appendNodeToGroup=function(e){var t=e.data,i=n.nodeGroupMap.get(t.id);if(i){var o=n.lf.getNodeModelById(i);o.removeChild(t.id),n.nodeGroupMap.delete(t.id),o.setAllowAppendChild(!1)}var r=n.lf.getNodeModelById(t.id),a=null==r?void 0:r.getBounds();if(a&&r){var s=n.getGroup(a,t);if(r.isGroup&&(t.children.forEach((function(e){n.nodeGroupMap.set(e,t.id)})),n.checkAndCorrectTopGroupZIndex([t]),n.nodeSelected({data:t,isSelected:!1,isMultiple:!1})),!s)return;if(!s.isAllowAppendIn(t))return void n.lf.emit("group:not-allowed",{group:s.getData(),node:t});s.addChild(t.id),n.nodeGroupMap.set(t.id,s.id),s.setAllowAppendChild(!1)}},this.deleteGroupChild=function(e){var t=e.data;t.children&&t.children.forEach((function(e){n.nodeGroupMap.delete(e),n.lf.deleteNode(e)}));var i=n.nodeGroupMap.get(t.id);i&&(n.lf.getNodeModelById(i).removeChild(t.id),n.nodeGroupMap.delete(t.id))},this.setActiveGroup=function(e){var t=e.data,i=n.lf.getNodeModelById(t.id),o=null==i?void 0:i.getBounds();if(i&&o){var r=n.getGroup(o,t);if(n.activeGroup&&n.activeGroup.setAllowAppendChild(!1),!r||i.isGroup&&r.id===t.id)return;if(!r.isAllowAppendIn(t))return;n.activeGroup=r,n.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(e){var t=eg;return e.isGroup&&(t=Math.max(t,e.zIndex)),e.children&&e.children.forEach((function(e){"object"==typeof e&&(e=e.id);var i=n.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var o=n.findNodeAndChildMaxZIndex(i);t=Math.max(o,t)}})),t},this.checkAndCorrectTopGroupZIndex=function(e){var t=eg;if(e.forEach((function(e){var i=n.lf.getNodeModelById(e.id);if(i){var o=n.findNodeAndChildMaxZIndex(i);o>t&&(t=o)}})),!(n.topGroupZIndex>=t)){for(var i=n.lf.graphModel.nodes.filter((function(e){return e.isGroup})),o=n.topGroupZIndex,r=0;r<i.length;r++){var a=i[r];a.zIndex>o&&(o=a.zIndex)}n.topGroupZIndex=o}},this.nodeSelected=function(e){var t=e.data,i=e.isMultiple,o=e.isSelected,r=n.lf.getNodeModelById(t.id);if(n.toFrontGroup(r),n.topGroupZIndex>-1e3){n.topGroupZIndex=eg;for(var a=n.lf.graphModel.nodes.filter((function(e){return e.isGroup})).sort((function(e,t){return e.zIndex-t.zIndex})),s=0,l=0;l<a.length;l++){var u=a[l];u.zIndex!==s&&(n.topGroupZIndex++,s=u.zIndex),u.setZIndex(n.topGroupZIndex)}}if(i&&o)if(null==r?void 0:r.isGroup)r.children.forEach((function(e){var t=n.lf.graphModel.getElement(e);null==t||t.setSelected(!1)}));else{var d=n.nodeGroupMap.get(t.id);if(d){var c=n.lf.getNodeModelById(d);(null==c?void 0:c.isSelected)&&(null==r||r.setSelected(!1))}}},this.toFrontGroup=function(e){e&&e.isGroup&&(n.topGroupZIndex++,e.setZIndex(n.topGroupZIndex),e.children&&e.children.forEach((function(e){var t=n.lf.getNodeModelById(e);n.toFrontGroup(t)})))},t.register(Qp),this.lf=t,t.graphModel.addNodeMoveRules((function(e,i,o){if(e.isGroup){var r=n.getNodeAllChild(e);return t.graphModel.moveNodes(r,i,o,!0),!0}var a=t.getNodeModelById(n.nodeGroupMap.get(e.id));if(a&&a.isRestrict){var s=e.getBounds(),l=s.minX,u=s.minY,d=s.maxX,c=s.maxY;return a.isAllowMoveTo({minX:l+i,minY:u+o,maxX:d+i,maxY:c+o})}return!0})),t.graphModel.group=this,t.on("node:add,node:drop,node:dnd-add",this.appendNodeToGroup),t.on("node:delete",this.deleteGroupChild),t.on("node:dnd-drag,node:drag",this.setActiveGroup),t.on("node:click",this.nodeSelected),t.on("graph:rendered",this.graphRendered),t.addElements=function(e,i){var o=e.nodes,r=e.edges,a={},s={nodes:[],edges:[]},l=[];return Eu(o,(function(e){var o=e.id,r=e.children,u=v(e,["children"]),d=t.addNode(u);if(!d)return{nodes:[],edges:[]};o&&(a[o]=d.id),s.nodes.push(d);var c=n.createAllChildNodes(a,r,d,i).edgesArray;l.push.apply(l,E([],w(c),!1))})),l.forEach((function(e){n.createEdgeModel(e,a,i)})),Eu(r,(function(e){var t=n.createEdgeModel(e,a,0);s.edges.push(t)})),s}}return e.prototype.createAllChildNodes=function(e,n,i,o){var r=this,a=this.lf,s=[],l=[],u=[];null==n||n.forEach((function(n){var d=a.getNodeModelById(n);if(d){var c=d.x,h=d.y,f=d.properties,p=d.type,g=d.rotate,v=d.children,m={x:c+o,y:h+o,properties:f,type:p,rotate:g},y=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",b=a.addNode(m,y);if(i.addChild(b.id),e[n]=b.id,u.push(b),d.incoming.edges.forEach((function(e){l.push(e)})),d.outgoing.edges.forEach((function(e){l.push(e)})),v instanceof Set){var x=r.createAllChildNodes(e,v,b,o),C=x.nodesArray,N=x.edgesArray;u.push.apply(u,E([],w(C),!1)),s.push.apply(s,E([],w(N),!1))}}}));var 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)}},e.prototype.createEdgeModel=function(e,t,n){var i=this.lf,o=e.sourceNodeId,r=e.targetNodeId;t[o]&&(o=t[o]),t[r]&&(r=t[r]);var a=e.type,s=e.startPoint,l=e.endPoint,u=e.pointsList,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},f=[];u&&u.length>0&&(f=u.map((function(e){return e.x+=n,e.y+=n,e})));var p={type:a,startPoint:c,endPoint:h,sourceNodeId:o,targetNodeId:r,pointsList:f};return pt(d)&&!Vd(d)&&(p.text=g(g({},d),{x:(null==d?void 0:d.x)+n,y:(null==d?void 0:d.y)+n})),i.graphModel.addEdge(p)},e.prototype.getNodeAllChild=function(e){var t=this,n=[];return e.children&&e.children.forEach((function(e){n.push(e);var i=t.lf.getNodeModelById(e);(null==i?void 0:i.isGroup)&&(n=n.concat(t.getNodeAllChild(i)))})),n},e.prototype.getGroup=function(e,t){var n=this.lf.graphModel.nodes.filter((function(n){return n.isGroup&&n.isInRange(e)&&n.id!==t.id}));if(0!==n.length){if(1===n.length)return n[0];for(var i=n[n.length-1],o=n.length-2;o>=0;o--)n[o].zIndex>i.zIndex&&(i=n[o]);return i}},e.prototype.getNodeGroup=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="group",e}();function ng(){var e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getFoldIcon=function(){var e=this.props.model,n=e,i=n.x,o=n.y,r=n.width,a=n.height,s=n.properties,l=n.foldable,u=e.x-e.width/2+5,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-r/2+5,y:o-a/2+5,onClick:function(t){var n,i;t.stopPropagation(),null===(i=(n=e).foldGroup)||void 0===i||i.call(n,!s.isFolded)}}),c])},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.getNodeStyle(),s=g(g({},a),{x:n-o/2,y:i-r/2,width:o,height:r,stroke:"black",strokeWidth:2,strokeDasharray:"0 0"});return t.h("g",{},[t.h("rect",g({},s)),this.getFoldIcon()])},n}(Jp),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.initNodeData=function(t){e.prototype.initNodeData.call(this,t),this.foldable=!0,this.resizable=!0,this.width=400,this.height=200,this.resetWidthHeight(),this.isTaskNode=!0,this.boundaryEvents=[]},t.prototype.resetWidthHeight=function(){var e,t,n=null===(e=this.properties.iniProp)||void 0===e?void 0:e.width,i=null===(t=this.properties.iniProp)||void 0===t?void 0:t.height;n&&(this.width=n),i&&(this.height=i)},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.stroke="#989891",t.strokeWidth=1,t.strokeDasharray="3 3",this.isSelected&&(t.stroke="rgb(124, 15, 255)"),this.properties.isBoundaryEventTouchingTask&&(t.stroke="#00acff",t.strokeWidth=2),t},t.prototype.addChild=function(t){var n=this.graphModel.getElement(t);null==n||n.setProperties({parent:this.id}),e.prototype.addChild.call(this,t)},t.prototype.getAnchorStyle=function(){var t=e.prototype.getAnchorStyle.call(this);return t.stroke="#000",t.fill="#fff",t.hover||(t.hover={}),t.hover.stroke="transparent",t},t.prototype.getOutlineStyle=function(){var t=e.prototype.getOutlineStyle.call(this);return t.stroke="transparent",t.hover||(t.hover={}),t.hover.stroke="transparent",t},t.prototype.setTouching=function(e){this.setProperty("isBoundaryEventTouchingTask",e)},t.prototype.addBoundaryEvent=function(e){if(this.setTouching(!1),this.boundaryEvents.find((function(t){return t===e})))return!1;var t=this.graphModel.getNodeModelById(e);return null==t||t.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(e),!0},t.prototype.deleteBoundaryEvent=function(e){this.boundaryEvents=this.boundaryEvents.filter((function(t){return t!==e}))},t}(Zp);return{type:"bpmn:subProcess",view:e,model:n}}function ig(e){var t=Be("bpmn:serviceTask",Ae),n=Be("bpmn:userTask",ke);e.register(t),e.register(n),e.register(ng()),function(e){function t(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=e.id,s=n-o/2,l=n+o/2,u=i-r/2,d=i+r/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,o,r=n.data;if("bpmn:boundaryEvent"===r.type){var a=e.graphModel.nodes;try{for(var s=x(a),l=s.next();!l.done;l=s.next()){var u=l.value;u.isTaskNode&&(t(u,r)?u.setTouching(!0):u.setTouching(!1))}}catch(e){i={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})),e.on("node:drop,node:dnd-add",(function(n){var i,o,r=n.data,a=r.type,s=r.id;if("bpmn:boundaryEvent"===a){var l=e.graphModel.nodes;try{for(var u=x(l),d=u.next();!d.done;d=u.next()){var c,h=d.value;if(h.isTaskNode)if(null!==(c=t(h,r))){var f=e.graphModel.getNodeModelById(s),p=e.graphModel.getNodeModelById(c),g=f.properties.attachedToRef;return g&&g!==c&&e.graphModel.getNodeModelById(g).deleteBoundaryEvent(s),void p.addBoundaryEvent(s)}}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}}})),e.graphModel.addNodeMoveRules((function(t,n,i){if(t.isTaskNode){var o=t.boundaryEvents;return e.graphModel.moveNodes(o,n,i,!0),!0}return!0}))}(e)}function og(e){var n=function(t){function n(n,i){n.id||(n.id="Flow_".concat(me()));var o=g(g(g({},e||{}),n.properties),{isDefaultFlow:!1});return n.properties=o,t.call(this,n,i)||this}return p(n,t),n.extendKey="SequenceFlowModel",n}(t.PolylineEdgeModel),i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getStartArrow=function(){return this.props.model.properties.isDefaultFlow?t.h("path",{refX:15,stroke:"#000000",strokeWidth:2,d:"M 20 5 10 -5 z"}):t.h("path",{d:""})},n.extendKey="SequenceFlowEdge",n}(t.PolylineEdge);return{type:"bpmn:sequenceFlow",view:i,model:n}}var rg=og();var ag=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:Ne,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function sg(e){function t(t){t.forEach((function(t){var n,i;n=t.nodes,i=t.definition,n.forEach((function(t){(null==e?void 0:e[t])||(e[t]=new Map);var n=null==e?void 0:e[t];i.forEach((function(e){n.set(e.type,e)}))}))}))}return function(){return[e,t]}}var lg=function(){function e(e){var t=e.lf;t.definition={},t.useDefinition=sg(t.definition);var n=w(t.useDefinition(),2);n[0];(0,n[1])(ag),function(e){e.register(we(e)),e.register(be(e)),e.register(xe(e)),e.register(Ce(e)),e.register(Ee(e))}(t),function(e){var t=Ie("bpmn:exclusiveGateway",Se),n=Ie("bpmn:parallelGateway",Me),i=Ie("bpmn:inclusiveGateway",Te);e.register(t),e.register(i),e.register(n)}(t),function(e){e.register(rg)}(t),ig(t),t.setDefaultEdgeType("bpmn:sequenceFlow")}return e.pluginName="BpmnElementsPlugin",e}(),ug=40,dg=40,cg=40,hg=40,fg=100,pg=80,gg=100,vg=80,mg=100,yg=80,bg=100,xg=80,wg=100,Eg=80,Cg=100,Ng=80,_g=100,Sg=80,Mg=100,Tg=80,Ag=function(){};(Ag.ObjTree=function(){return this}).VERSION="0.23",Ag.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',Ag.ObjTree.prototype.attr_prefix="-",Ag.ObjTree.prototype.parseXML=function(e){var t;if(window.DOMParser){var n=new DOMParser,i=n.parseFromString(e,"application/xml");if(!i)return;t=i.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(e),t=n.documentElement);if(t)return this.parseDOM(t)},Ag.ObjTree.prototype.parseHTTP=function(e,t,n){var i,o={};for(var r in t)o[r]=t[r];if(o.method||(void 0===o.postBody&&void 0===o.postbody&&void 0===o.parameters?o.method="get":o.method="post"),n){o.asynchronous=!0;var a=this,s=n,l=o.onComplete;o.onComplete=function(e){var t;e&&e.responseXML&&e.responseXML.documentElement&&(t=a.parseDOM(e.responseXML.documentElement)),s(t,e),l&&l(e)}}else o.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)o.uri=e,(u=new HTTP.Request(o))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(e,o))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},Ag.ObjTree.prototype.parseDOM=function(e){if(e){if(this.__force_array={},this.force_array)for(var t=0;t<this.force_array.length;t++)this.__force_array[this.force_array[t]]=1;var n=this.parseElement(e);if(this.__force_array[e.nodeName]&&(n=[n]),11!==e.nodeType){var i={};i[e.nodeName]=n,n=i}return n}},Ag.ObjTree.prototype.parseElement=function(e){if(7!==e.nodeType){if(3===e.nodeType||4===e.nodeType||8===e.nodeType){if(null==e.nodeValue.match(/[^\x00-\x20]/))return;return e.nodeValue}var t=null,n={};if(e.attributes&&e.attributes.length){t={};for(var i=0;i<e.attributes.length;i++){if("string"==typeof(s=e.attributes[i].nodeName)){var o=e.attributes[i].nodeValue;try{o=JSON.parse(e.attributes[i].nodeValue.replace(/'/g,'"'))}catch(t){o=e.attributes[i].nodeValue}null!=o&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}if(e.childNodes&&e.childNodes.length){var r=!0;t&&(r=!1);for(i=0;i<e.childNodes.length&&r;i++){var a=e.childNodes[i].nodeType;3!==a&&4!==a&&8!==a&&(r=!1)}if(r){t||(t="");for(i=0;i<e.childNodes.length;i++)t+=e.childNodes[i].nodeValue}else{t||(t={});for(i=0;i<e.childNodes.length;i++){var s;if("string"==typeof(s=e.childNodes[i].nodeName))(o=this.parseElement(e.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(t,s,n[s],o))}}}else null===t&&(t={});return t}},Ag.ObjTree.prototype.addNode=function(e,t,n,i){this.__force_array[t]?(1===n&&(e[t]=[]),e[t][e[t].length]=i):1===n?e[t]=i:2===n?e[t]=[e[t],i]:e[t][e[t].length]=i},Ag.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},Ag.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var o in t)if(vd(t,o)){var r=t[o];o.charAt(0)!==this.attr_prefix?void 0===r||null==r?n[n.length]="<".concat(o," />"):"object"==typeof r&&r.constructor===Array?n[n.length]=this.array_to_xml(o,r):n[n.length]="object"==typeof r?this.hash_to_xml(o,r):this.scalar_to_xml(o,r):i[i.length]=" ".concat(o.substring(1),'="').concat(this.xml_escape(r),'"')}var a=i.join(""),s=n.join("");return void 0===e||null==e||(s=n.length>0?s.match(/\n/)?"<".concat(e).concat(a,">\n").concat(s,"</").concat(e,">\n"):"<".concat(e).concat(a,">").concat(s,"</").concat(e,">\n"):"<".concat(e).concat(a," />\n")),s},Ag.ObjTree.prototype.array_to_xml=function(e,t){for(var n=[],i=0;i<t.length;i++){var o=t[i];void 0===o||null==o?n[n.length]="<".concat(e," />"):"object"==typeof o&&o.constructor===Array?n[n.length]=this.array_to_xml(e,o):n[n.length]="object"==typeof o?this.hash_to_xml(e,o):this.scalar_to_xml(e,o)}return n.join("")},Ag.ObjTree.prototype.scalar_to_xml=function(e,t){return"#text"===e?this.xml_escape(t):"<".concat(e,">").concat(this.xml_escape(t),"</").concat(e,">\n")},Ag.ObjTree.prototype.xml_escape=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};function kg(e){return Object.prototype.toString.call(e)}function Rg(e){return" ".repeat(e)}function Dg(e){return"[object Object]"===kg(e)?Object.keys(e).reduce((function(t,n){var i=n;return"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=Dg(e[n]),t}),{}):Array.isArray(e)?e.map((function(e){return Dg(e)})):e}var Og,Pg="\t\n";function Ig(e,t,n){var i=Rg(n),o="",r=Pg+i;if("-json"===t)return"";if("#text"===t)return r+e;if("#cdata-section"===t)return"".concat(r,"<![CDATA[").concat(e,"]]>");if("#comment"===t)return"".concat(r,"\x3c!--").concat(e,"--\x3e");if("-"==="".concat(t).charAt(0))return" ".concat(t.substring(1),'="').concat(function(e){var t=e;try{"string"!=typeof t&&(t=JSON.parse(e))}catch(n){t=JSON.stringify(Dg(e)).replace(/"/g,"'")}return t}(e),'"');if(Array.isArray(e))o+=e.map((function(e){return Ig(e,t,n+1)})).join("");else if("[object Object]"===kg(e)){var a=Object.keys(e),s="",l=e["-json"]?Pg+Rg(n+1)+e["-json"]:"";o+="".concat(0===n?"":r,"<").concat(t),a.forEach((function(t){"-"===t.charAt(0)?s+=Ig(e[t],t,n+1):l+=Ig(e[t],t,n+1)})),o+=s+(""!==l?">".concat(l).concat(r,"</").concat(t,">"):" />")}else o+="".concat(r,"<").concat(t,">").concat(e.toString(),"</").concat(t,">");return o}!function(e){e.START="bpmn:startEvent",e.END="bpmn:endEvent",e.INTERMEDIATE_CATCH="bpmn:intermediateCatchEvent",e.INTERMEDIATE_THROW="bpmn:intermediateThrowEvent",e.BOUNDARY="bpmn:boundaryEvent",e.PARALLEL_GATEWAY="bpmn:parallelGateway",e.INCLUSIVE_GATEWAY="bpmn:inclusiveGateway",e.EXCLUSIVE_GATEWAY="bpmn:exclusiveGateway",e.USER="bpmn:userTask",e.SYSTEM="bpmn:serviceTask",e.FLOW="bpmn:sequenceFlow",e.SUBPROCESS="bpmn:subProcess"}(Og||(Og={}));var Lg=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],Bg=["properties","startPoint","endPoint","pointsList"],jg={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Fg=function(e,t){return Object.keys(t||{}).forEach((function(n){if(e[n]){var i=t[n],o=i.in,r=i.out;o&&(e[n].in=o),r&&(e[n].out=r)}else e[n]=t[n]})),e},Hg={"bpmn:startEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Hg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:intermediateCatchEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Hg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:intermediateThrowEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Hg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:boundaryEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Hg[i.definitionType])||void 0===t?void 0:t.out)||void 0===n?void 0:n.call(t,e))||{}}},"bpmn:sequenceFlow":{out:function(e){var t=e.properties,n=t.expressionType,i=t.condition;return i?"cdata"===n?{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[${'.concat(i,"}]]></bpmn:conditionExpression>")}:{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">'.concat(i,"</bpmn:conditionExpression>")}:{json:""}}},"bpmn:timerEventDefinition":{out:function(e){var t=e.properties,n=t.timerType,i=t.timerValue,o=t.definitionId;return{json:'<bpmn:timerEventDefinition id="'.concat(o,'"').concat(n&&i?">".concat("<bpmn:".concat(n,' xsi:type="bpmn:tFormalExpression">').concat(i,"</bpmn:").concat(n,">"),"</bpmn:timerEventDefinition>"):"/>")}},in:function(e,t){var n,i,o,r=e,a=t["-id"],s="",l="";try{for(var u=x(Object.keys(t)),d=u.next();!d.done;d=u.next()){var c=d.value;c.includes("bpmn:")&&(s=w(c.split(":"),2)[1],l=null===(o=t[c])||void 0===o?void 0:o["#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":r,"-timerType":s,"-timerValue":l}}},"bpmn:conditionExpression":{in:function(e,t){var n,i="",o="";return t["#cdata-section"]?(o="cdata",i=(null===(n=/^\$\{(.*)\}$/g.exec(t["#cdata-section"]))||void 0===n?void 0:n[1])||""):t["#text"]&&(o="normal",i=t["#text"]),{"-condition":i,"-expressionType":o}}}};function Wg(e){var t=null!=e?e:{},n=t.retainedAttrsFields,i=t.excludeFields,o=t.transformer,r=new Set(E(E([],w(Bg),!1),w(n||[]),!1)),a={in:new Set(E(E([],w(jg.in),!1),w((null==i?void 0:i.in)||[]),!1)),out:new Set(E(E([],w(jg.out),!1),w((null==i?void 0:i.out)||[]),!1))};return Hg=Fg(Hg,o),function(e){var t=e.nodes,n=e.edges;return function e(i,o){var s,l;if(1!==(null==i?void 0:i.flag)){var u;if((u=Hg[i.type])&&u.out){var 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 f=x(Object.entries(i)),p=f.next();!p.done;p=f.next()){var g=w(p.value,2),v=g[0],m=g[1];if(1===(null==m?void 0:m.flag))return;var y=[o,v].filter((function(e){return e})).join(".");a.out.has(y)||("object"!=typeof m?0===v.indexOf("-")||["#text","#cdata-section","#comment"].includes(v)?h[v]=m:h["-".concat(v)]=m:r.has(y)?h["-".concat(v)]=e(m,y):h[v]=e(m,y))}}catch(e){s={error:e}}finally{try{p&&!p.done&&(l=f.return)&&l.call(f)}finally{if(s)throw s.error}}return h}}(e,"")}}function zg(e){var t,n,i={};try{for(var o=x(Object.entries(e)),r=o.next();!r.done;r=o.next()){var a=w(r.value,2),s=a[0],l=a[1];0===s.indexOf("-")?i[s.substring(1)]=Dg(l):"string"==typeof l?i[s]=l:"[object Object]"===Object.prototype.toString.call(l)?i[s]=zg(l):Array.isArray(l)?i[s]=l.map((function(e){return zg(e)})):i[s]=l}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i}function Gg(e,t){e["bpmndi:BPMNEdge"]=t.edges.map((function(e){var t,n=e.id,i=e.pointsList.map((function(e){return{"-x":e.x,"-y":e.y}})),o={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(o["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),o})),e["bpmndi:BPMNShape"]=t.nodes.map((function(e){var t,n=e.id,i=100,o=80,r=e.x,a=e.y,s=Kg.shapeConfigMap.get(e.type);s&&(i=s.width,o=s.height),r-=i/2,a-=o/2;var l={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":r,"-y":a,"-width":i,"-height":o}};return(null===(t=e.text)||void 0===t?void 0:t.value)&&(l["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":e.text.x-10*e.text.value.length/2,"-y":e.text.y-7,"-width":10*e.text.value.length,"-height":14}}),l}))}var Ug=["bpmn:incoming","bpmn:outgoing"];function qg(e,t){var n=[],i=[],o=new Map,r=null!=t?t:{},a=r.transformer,s=r.excludeFields,l={in:new Set(E(E([],w(jg.in),!1),w((null==s?void 0:s.in)||[]),!1)),out:new Set(E(E([],w(jg.out),!1),w((null==s?void 0:s.out)||[]),!1))};Hg=Fg(Hg,a);var u,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:")||Ug.includes(t)||(h[t]||(h[t]=[]),!Array.isArray(h[t])&&(h[t]=[h[t]]),Array.isArray(e[t])?(n=h[t]).push.apply(n,E([],w(e[t]),!1)):h[t].push(e[t]),Array.isArray(e[t])?e[t].forEach((function(n){!t.includes("Flow")&&e["-children"].push(n["-id"])})):!t.includes("Flow")&&e["-children"].push(e[t]["-id"]),delete e[t])}))}if("bpmn:subProcess"===e){var n=h[e];Array.isArray(n)?n.forEach((function(n){"bpmn:subProcess"===e&&t(n)})):t(n)}},function(e){function t(e){var n;o.set(e["-id"],e),Array.isArray(e)?e.forEach((function(e){t(e)})):"object"==typeof e&&(n=e,Object.keys(n).forEach((function(e){var i,o;if(e.includes("bpmn:")){var r={};Hg[e]&&Hg[e].in?(r=null===(o=(i=Hg[e]).in)||void 0===o?void 0:o.call(i,e,gn.cloneDeep(n[e])),delete n[e]):t(n[e]);var a=void 0;(a=Reflect.ownKeys(r)).length>0&&a.forEach((function(e){Reflect.set(n,e,r[e])}))}})))}t(h[e])},function(e){if(0===e.indexOf("bpmn:")){var t=h[e];if("bpmn:sequenceFlow"===e){var r=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(Vg(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(Vg(i,e))}return n}(t,r)}else{var a=c["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if("bpmn:boundaryEvent"===e){var s=h[e],l=function(e){var t=e["-attachedToRef"],n=o.get(t);n["-boundaryEvents"]||(n["-boundaryEvents"]=[]),n["-boundaryEvents"].push(e["-id"])};Array.isArray(s)?s.forEach((function(e){l(e)})):l(s)}n=n.concat(function(e,t,n){var i=[];if(Array.isArray(e))e.forEach((function(e){var o=Xg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}));else{var o=Xg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(o)}return i}(t,a,e))}}}],d.forEach((function(e){try{Object.keys(u).forEach((function(t){try{e(t)}catch(e){}}))}catch(e){}}))}var f=function(e,t,n){Object.keys(e).forEach((function(i){var o=n?"".concat(n,".").concat(i):i;t.has(o)?delete e[i]:"object"==typeof e[i]&&f(e[i],t,o)}))};return n.forEach((function(e){var n,i;if(null===(n=null==t?void 0:t.mapping)||void 0===n?void 0:n.in){var o=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,r=e.type;o[r]&&(e.type=o[r])}f(e,l.in,"")})),i.forEach((function(e){var n,i;if(null===(n=null==t?void 0:t.mapping)||void 0===n?void 0:n.in){var o=null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.in,r=e.type;o[r]&&(e.type=o[r])}f(e,l.in,"")})),{nodes:n,edges:i}}function Xg(e,t,n){var i=Number(e["dc:Bounds"]["-x"]),o=Number(e["dc:Bounds"]["-y"]),r=n["-children"],a=n["-name"],s=Kg.shapeConfigMap.get(t);s&&(i+=s.width/2,o+=s.height/2);var l,u={};if(Object.entries(n).forEach((function(e){var t=w(e,2),n=t[0],i=t[1];Lg.includes(n)||(u[n]=i)})),u=zg(u),a&&(l={x:i,y:o,value:a},e["bpmndi:BPMNLabel"]&&e["bpmndi:BPMNLabel"]["dc:Bounds"])){var 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:o,properties:u};return r&&(c.children=r),l&&(c.text=l),c}function Vg(e,t){var n,i=t["-name"]?"".concat(t["-name"]):"";if(i){var o=e["bpmndi:BPMNLabel"]["dc:Bounds"],r=0;i.split("\n").forEach((function(e){r<e.length&&(r=e.length)})),n={value:i,x:Number(o["-x"])+10*r/2,y:Number(o["-y"])+7}}var a={};Object.entries(t).forEach((function(e){var t=w(e,2),n=t[0],i=t[1];Lg.includes(n)||(a[n]=i)})),a=zg(a);var s=e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),l={id:t["-id"],type:Og.FLOW,pointsList:s,sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:a};return n&&(l.text=n),l}var Kg=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i,o,r=g({},n.processAttributes);!function(e,t,n){var i,o=new Map,r=Wg(n)(t);r.nodes.forEach((function(t){var n=t["-id"],i=t["-type"],r=t.text,a=t.children,s=v(t,["-id","-type","text","children"]),l={"-id":n};(null==r?void 0:r["-value"])&&(l["-name"]=r["-value"]),s["-json"]&&(l["-json"]=s["-json"]),s["-properties"]&&Object.assign(l,s["-properties"]),a&&(l.children=a),e[i]||(e[i]=[]),e[i].push(l),o.set(n,l)}));var a=r.edges.map((function(e){var t=e["-id"],n=e["-sourceNodeId"],i=e["-targetNodeId"],r=e.text,a=v(e,["-id","-sourceNodeId","-targetNodeId","text"]),s=o.get(i);s["bpmn:incoming"]||(s["bpmn:incoming"]=[]),s["bpmn:incoming"].push(t);var l={"-id":t,"-sourceRef":n,"-targetRef":i};return(null==r?void 0:r["-value"])&&(l["-name"]=r["-value"]),a["-json"]&&(l["-json"]=a["-json"]),a["-properties"]&&Object.assign(l,a["-properties"]),l}));t.edges.forEach((function(e){var t=e.sourceNodeId,n=e.id,i=o.get(t);i["bpmn:outgoing"]||(i["bpmn:outgoing"]=[]),i["bpmn:outgoing"].push(n)})),null===(i=e["bpmn:subProcess"])||void 0===i||i.forEach((function(t){var n={"bpmn:incoming":new Set,"bpmn:outgoing":new Set},i=[];t.children.forEach((function(i){var r,a=o.get(i["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach((function(e){a[e]&&a[e].forEach((function(t){n[e].add(t)}))}));var s=null===(r=e[i["-type"]])||void 0===r?void 0:r.findIndex((function(e){return e["-id"]===i["-id"]}));s>=0&&e[i["-type"]].splice(s,1),o.delete(i["-id"]),t[i["-type"]]||(t[i["-type"]]=[]),t[i["-type"]].push(a)}));var r=n["bpmn:incoming"];n["bpmn:outgoing"].forEach((function(e){r.has(e)&&i.push(e)}));for(var s,l=function(e){var n=a.findIndex((function(t){return t["-id"]===i[e]}));n>=0?(t["bpmn:sequenceFlow"]||(t["bpmn:sequenceFlow"]=[]),t["bpmn:sequenceFlow"].push(a[n]),a.splice(n,1)):e++,s=e},u=0;u<i.length;)l(u),u=s;delete t.children})),e[Og.FLOW]=a}(r,e,t);var a={"-id":"BPMNPlane_1","-bpmnElement":r["-id"]};Gg(a,e);var s=n.definitionAttributes;s["bpmn:process"]=r,s["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":a};var l={"bpmn:definitions":s};if(null===(i=null==t?void 0:t.mapping)||void 0===i?void 0:i.out){var u=null===(o=null==t?void 0:t.mapping)||void 0===o?void 0:o.out,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]=gn.cloneDeep(e[t]),delete e[t],d(e[n])):d(e[t])}))};d(l)}return l},this.adapterIn=function(e,t){if(e)return qg(e,t)},t.adapterIn=this.adapterIn,t.adapterOut=this.adapterOut,this.processAttributes={"-isExecutable":"true","-id":"Process"},this.definitionAttributes={"-id":"Definitions","-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.10"}}return e.prototype.setCustomShape=function(t,n){e.shapeConfigMap.set(t,n)},e.pluginName="bpmn-adapter",e.shapeConfigMap=new Map,e}();Kg.shapeConfigMap.set(Og.START,{width:ug,height:dg}),Kg.shapeConfigMap.set(Og.END,{width:cg,height:hg}),Kg.shapeConfigMap.set(Og.INTERMEDIATE_CATCH,{width:gg,height:vg}),Kg.shapeConfigMap.set(Og.INTERMEDIATE_THROW,{width:gg,height:vg}),Kg.shapeConfigMap.set(Og.BOUNDARY,{width:fg,height:pg}),Kg.shapeConfigMap.set(Og.PARALLEL_GATEWAY,{width:mg,height:yg}),Kg.shapeConfigMap.set(Og.INCLUSIVE_GATEWAY,{width:bg,height:xg}),Kg.shapeConfigMap.set(Og.EXCLUSIVE_GATEWAY,{width:wg,height:Eg}),Kg.shapeConfigMap.set(Og.SYSTEM,{width:Cg,height:Ng}),Kg.shapeConfigMap.set(Og.USER,{width:_g,height:Sg}),Kg.shapeConfigMap.set(Og.SUBPROCESS,{width:Mg,height:Tg});var Yg=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t,i=(t=e,(new Ag.ObjTree).parseXML(t));return n.adapterIn(i,n.props)},n.adapterXmlOut=function(e){return function(e){var t="";for(var n in e)t+=Ig(e[n],n,0);return t}(n.adapterOut(e,n.props))};var i=t.lf,o=t.props;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n.props=o,n}return p(t,e),t.pluginName="BPMNAdapter",t}(Kg),$g={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},Zg={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function Jg(e){switch(e){case"bpmn:sequenceFlow":return $g.SEQUENCE_FLOW;case"bpmn:startEvent":return $g.START_EVENT;case"bpmn:endEvent":return $g.END_EVENT;case"bpmn:userTask":return $g.USER_TASK;case"bpmn:exclusiveGateway":return $g.EXCLUSIVE_GATEWAY;default:return e}}function Qg(e,t,n){var i=t.x,o=t.y,r=e.x-i,a=e.y-o;return{x:r*Math.cos(n)-a*Math.sin(n)+i,y:r*Math.sin(n)+a*Math.cos(n)+o}}var ev=function(e){function n(){var n=e.apply(this,E([],w(arguments),!1))||this;return n.childrenPositionMap=new Map,n.onNodeRotate=function(e){var t=e.model,i=n.props,o=i.model,r=i.graphModel,a=o.transformWithContainer,s=o.isRestrict,l=n.childrenPositionMap;if(a&&!s&&t.id===o.id){var u={x:o.x,y:o.y};Eu(Array.from(o.children),(function(e){var n=r.getNodeModelById(e);if(n){var i={x:n.x,y:n.y};l.has(n.id)?i=l.get(n.id):l.set(n.id,i);var o=t.rotate*(180/Math.PI);o<0&&(o+=360);var a=o*(Math.PI/180),s=Qg(i,u,a);n.moveTo(s.x,s.y),n.rotate=t.rotate}}))}},n.onNodeResize=function(e){var i=e.deltaX,o=e.deltaY,r=e.index,a=e.model,s=e.preData,l=n.props,u=l.model,d=l.graphModel,c=u.transformWithContainer,h=u.isRestrict;if(c&&!h&&a.id===u.id){var f=s.properties||{},p=f.width,g=f.height;Eu(Array.from(u.children),(function(e){var n=d.getNodeModelById(e);if(n){var a=n.width/p*i,s=n.height/g*o;t.handleResize({deltaX:a,deltaY:s,index:r,nodeModel:n,graphModel:d,cancelCallback:function(){}})}}))}},n.onNodeMouseMove=function(){},n.graphRendered=function(){var e=n.props.model;e.isCollapsed&&e.toggleCollapse(!0)},n}return p(n,e),n.prototype.componentDidMount=function(){e.prototype.componentDidMount.call(this);var t=this.props.graphModel.eventCenter;t.on("node:rotate",this.onNodeRotate),t.on("node:resize",this.onNodeResize),t.on("node:mousemove",this.onNodeMouseMove),t.on("graph:rendered",this.graphRendered)},n.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this);var t=this.props.graphModel.eventCenter;t.off("node:rotate",this.onNodeRotate),t.off("node:resize",this.onNodeResize),t.off("node:mousemove",this.onNodeMouseMove),t.off("graph:rendered",this.graphRendered)},n.prototype.getNodesInGroup=function(e,t){var n=this,i=[];return e.isGroup&&Eu(Array.from(e.children),(function(e){i.push(e);var o=t.getNodeModelById(e);(null==o?void 0:o.isGroup)&&(i=i.concat(n.getNodesInGroup(o,t)))})),i},n.prototype.getResizeControl=function(){var t=this.props.model,n=t.resizable,i=t.isCollapsed;return n&&!i?e.prototype.getResizeControl.call(this):null},n.prototype.getAppendAreaShape=function(){var e=this.props.model,n=e.width,i=e.height,o=e.x,r=e.y,a=e.radius;if(!e.groupAddable)return null;var s=e.getNodeStyle().strokeWidth,l=void 0===s?0:s,u=e.getAddableOutlineStyle(),d=n+l+8,c=i+l+8;return t.h("rect",g(g({},u),{width:d,height:c,x:o-d/2,y:r-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,o=n-e.width/2+10,r=i-e.height/2+10;if(!e.collapsible)return null;var a=(null==e?void 0:e.isCollapsed)?this.getCollapseIcon(o,r):this.getExpandIcon(o,r),s=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:a});return t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#f4f5f6",stroke:"#cecece",cursor:"pointer",x:o,y:r,onClick:function(){e.toggleCollapse(!e.isCollapsed)}}),s])},n.prototype.getShape=function(){return t.h("g",{},[this.getAppendAreaShape(),e.prototype.getShape.call(this),this.getOperateIcon()])},n}(t.RectNode),tv=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.isGroup=!0,i.isRestrict=!1,i.autoResize=!1,i.collapsible=!0,i.staticTextPosition=!0,i.isCollapsed=!1,i.groupAddable=!1,i.transformWithContainer=!1,i.childrenLastCollapseStateDict=new Map,i.childrenLastCollapseStateDict=new Map,i.initNodeData(t),i.setAttributes(),i}return p(n,e),n.prototype.initNodeData=function(t){var n;e.prototype.initNodeData.call(this,t);var i=null!==(n=t.properties)&&void 0!==n?n:{},o=i.children,r=i.width,a=i.height,s=i.collapsedWidth,l=i.collapsedHeight,u=i.collapsible,d=i.isCollapsed,c=i.zIndex,h=i.isRestrict,f=i.autoResize,p=i.autoToFront,g=i.transformWithContainer;this.children=o?new Set(o):new Set,this.zIndex=null!=c?c:-1e4,this.isCollapsed=null!=d&&d,this.setProperties({isCollapsed:null!=d&&d});var v=null!=r?r:400,m=null!=a?a:230;this.width=v,this.height=m,this.expandWidth=v,this.expandHeight=m,this.collapsedWidth=null!=s?s:80,this.collapsedHeight=null!=l?l:60,this.isRestrict=null!=h&&h,this.transformWithContainer=null!=g&&g,this.autoResize=null!=f&&f,this.collapsible=null==u||u,this.autoToFront=null!=p&&p,this.setTextPosition(),this.text.editable=!1,this.text.draggable=!1},n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this)},n.prototype.getData=function(){var t=this,n=e.prototype.getData.call(this),i=[];return Eu(Array.from(this.children),(function(e){var n=t.graphModel.getNodeModelById(e);n&&!n.virtual&&i.push(e)})),n.children=i,n.properties&&(n.properties.children=i,n.properties.isCollapsed=this.isCollapsed),n},n.prototype.getNodesInGroup=function(e){var t=[];return e.isGroup&&Eu(Array.from(e.children),(function(e){t.push(e)})),t},n.prototype.getMoveDistance=function(t,n,i){void 0===i&&(i=!1);var o=w(e.prototype.getMoveDistance.call(this,t,n,i),2),r=o[0],a=o[1],s=this.getNodesInGroup(this);return this.graphModel.moveNodes(s,t,n,i),[r,a]},n.prototype.getHistoryData=function(){var t=e.prototype.getHistoryData.call(this);t.children=Array.from(this.children),t.isGroup=!0;var n=this,i=n.x,o=n.y,r=n.collapsedWidth,a=n.collapsedHeight,s=n.expandWidth,l=n.expandHeight;return n.isCollapsed&&(t.x=i+s/2-r/2,t.y=o+l/2-a/2,t.text&&(t.text.x=t.text.x+s/2-r/2,t.text.y=t.text.y+l/2-a/2)),t},n.prototype.toggleCollapse=function(e){var n=this,i=this.graphModel,o=!!e;this.isCollapsed=o,this.setProperties({isCollapsed:o}),i.eventCenter.emit("dynamicGroup:collapse",{collapse:o,nodeModel:this}),o?this.collapse():this.expand();var r=E(E([],w(this.incoming.edges),!1),w(this.outgoing.edges),!1);Eu(Array.from(this.children),(function(i){var o,a,s=n.graphModel.elementsModelMap.get(i);if(s){var l=s.isCollapsed;if(s.isGroup){var u=s;if(u.isCollapsed||u.toggleCollapse(e),!e){var d=null===(o=n.childrenLastCollapseStateDict)||void 0===o?void 0:o.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;r=E(E(E([],w(r),!1),w(c),!1),w(h),!1)}}})),this.collapseEdge(o,r)},n.prototype.setTextPosition=function(){var e=this,t=e.x,n=e.y,i=e.staticTextPosition,o=e.text,r=e.isCollapsed,a=e.width,s=e.height,l=e.collapsedWidth,u=e.collapsedHeight;if(i)return o.x=t,void(o.y=r?n:n-s/2+15);o.x=r?t-a/2+l/2:t+a/2-l/2,o.y=r?n-s/2+u/2:n+s/2-u/2},n.prototype.collapse=function(){var e=this,t=e.x,n=e.y,i=e.width,o=e.height,r=e.collapsedWidth,a=e.collapsedHeight;this.x=t-i/2+r/2,this.y=n-o/2+a/2,this.expandWidth=i,this.expandHeight=o,this.width=r,this.height=a,this.setTextPosition()},n.prototype.expand=function(){var e=this,t=e.x,n=e.y,i=e.expandWidth,o=e.expandHeight,r=e.collapsedWidth,a=e.collapsedHeight;this.width=i,this.height=o,this.x=t+this.width/2-r/2,this.y=n+this.height/2-a/2,this.setTextPosition()},n.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isCollapsedEdge=!0},n.prototype.collapseEdge=function(e,t){var n=this,i=this.graphModel;Eu(t,(function(t,o){var r,a=t.getData(),s=a.targetNodeId,l=a.sourceNodeId,u=g(g({},a),{id:"".concat(a.id,"__").concat(o),text:null===(r=a.text)||void 0===r?void 0:r.value});t.virtual&&i.deleteEdgeById(t.id);var d=i.dynamicGroup.getGroupByNodeId(s);d||(d=i.getNodeModelById(s));var c=i.dynamicGroup.getGroupByNodeId(l);c||(c=i.getNodeModelById(l)),e&&t.visible&&(n.children.has(l)||n.id===l?(u.startPoint=void 0,u.sourceNodeId=n.id):(u.endPoint=void 0,u.targetNodeId=n.id),d.id===n.id&&c.id===n.id||n.createVirtualEdge(u),t.visible=!1),e||t.visible||(d&&d.isGroup&&d.isCollapsed?(u.targetNodeId=d.id,u.endPoint=void 0,n.createVirtualEdge(u)):c&&c.isGroup&&c.isCollapsed?(u.sourceNodeId=c.id,u.startPoint=void 0,n.createVirtualEdge(u)):t.visible=!0)}))},n.prototype.isAllowAppendIn=function(e){return!0},n.prototype.setAllowAppendChild=function(e){this.groupAddable=e},n.prototype.addChild=function(e){this.children.add(e);var t=this.getData();this.graphModel.eventCenter.emit("group:add-node",{data:t,childId:e})},n.prototype.removeChild=function(e){this.children.delete(e);var t=this.getData();this.graphModel.eventCenter.emit("group:remove-node",{data:t})},n.prototype.toBack=function(){this.zIndex--},n.prototype.getAnchorStyle=function(){var t=e.prototype.getAnchorStyle.call(this);return t.stroke="transparent",t.fill="transparent",t.hover&&(t.hover.fill="transparent",t.hover.stroke="transparent"),t},n.prototype.getAddableOutlineStyle=function(){return{stroke:"#feb663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},m([t.observable],n.prototype,"isCollapsed",void 0),m([t.observable],n.prototype,"groupAddable",void 0),m([t.observable],n.prototype,"transformWithContainer",void 0),n}(t.RectNodeModel);var nv,iv={type:"dynamic-group",view:ev,model:tv},ov=-1e4,rv=function(){function e(e){var t=e.lf,n=e.options,i=this;this.topGroupZIndex=ov,this.nodeGroupMap=new Map,this.onSelectionDrop=function(){i.lf.graphModel.getSelectElements().nodes.forEach((function(e){i.addNodeToGroup(e)}))},this.onNodeAddOrDrop=function(e){var t=e.data;i.addNodeToGroup(t)},this.addNodeToGroup=function(e){var t=i.nodeGroupMap.get(e.id);t&&((a=i.lf.getNodeModelById(t)).removeChild(e.id),i.nodeGroupMap.delete(e.id),a.setAllowAppendChild(!1));var n=i.lf.getNodeModelById(e.id),o=null==n?void 0:n.getBounds();if(n&&o){if(n.isGroup){var r=n;Eu(Array.from(r.children),(function(t){i.nodeGroupMap.set(t,e.id)})),i.calibrateTopGroupZIndex([e]),i.onNodeSelect({data:e,isSelected:!1,isMultiple:!1})}var a;if(a=i.getGroupByBounds(o,e))a.isAllowAppendIn(e)?(a.addChild(e.id),a.setAllowAppendChild(!1)):i.lf.emit("group:not-allowed",{group:a.getData(),node:e})}},this.onGroupAddNode=function(e){var t=e.data,n=e.childId;i.nodeGroupMap.set(n,t.id)},this.removeNodeFromGroup=function(e){var t=e.data;e.model.isGroup&&t.children&&Eu(Array.from(t.children),(function(e){i.nodeGroupMap.delete(e),i.lf.deleteNode(e)}));var n=i.nodeGroupMap.get(t.id);if(n){var o=i.lf.getNodeModelById(n);o&&o.removeChild(t.id),i.nodeGroupMap.delete(t.id)}},this.onSelectionDrag=function(){i.lf.graphModel.getSelectElements().nodes.forEach((function(e){i.setActiveGroup(e)}))},this.onNodeDrag=function(e){var t=e.data;i.setActiveGroup(t)},this.setActiveGroup=function(e){var t=i.lf.getNodeModelById(e.id),n=null==t?void 0:t.getBounds();if(t&&n){var o=i.getGroupByBounds(n,e);if(i.activeGroup&&i.activeGroup.setAllowAppendChild(!1),!o||t.isGroup&&o.id===e.id)return;if(!o.isAllowAppendIn(e))return;i.activeGroup=o,i.activeGroup.setAllowAppendChild(!0)}},this.onNodeSelect=function(e){var t=e.data,n=e.isMultiple,o=e.isSelected,r=i.lf.getNodeModelById(t.id);if(i.sendNodeToFront(r),i.topGroupZIndex>-1e3){var a=i.lf.graphModel.nodes;i.topGroupZIndex=ov;var s=ef(zu(a,(function(e){return!!e.isGroup})),"zIndex"),l=0;Eu(s,(function(e){e.zIndex!==l&&(i.topGroupZIndex++,l=e.zIndex),e.setZIndex(i.topGroupZIndex)}))}if(n&&o)if(null==r?void 0:r.isGroup){var u=r.children;Eu(Array.from(u),(function(e){var t=i.lf.getNodeModelById(e);null==t||t.setSelected(!1)}))}else{var d=i.nodeGroupMap.get(t.id);if(d){var c=i.lf.getNodeModelById(d);(null==c?void 0:c.isSelected)&&(null==r||r.setSelected(!1))}}},this.onNodeMove=function(e){var t=e.deltaX,n=e.deltaY,o=e.data,r=o.id,a=o.x,s=o.y,l=o.properties;if(l){var u=l.width,d=l.height,c=i.nodeGroupMap.get(r);if(c){var h=i.lf.getNodeModelById(c);if(h&&h.isRestrict&&h.autoResize){var f=a+t/2,p=s+n/2,g=f-u/2,v=p-d/2,m=f+u/2,y=p+d/2,b=!1,x=h.getBounds(),w=Object.assign({},x);if(g<w.minX&&(w.minX=g,b=!0),v<w.minY&&(w.minY=v,b=!0),m>w.maxX&&(w.maxX=m,b=!0),y>w.maxY&&(w.maxY=y,b=!0),b){var E=w.minX+(w.maxX-w.minX)/2,C=w.minY+(w.maxY-w.minY)/2,N=w.maxX-w.minX,_=w.maxY-w.minY;h.moveTo(E,C),h.width=N,h.height=_}}}}},this.onGraphRendered=function(e){var t=e.data;Eu(t.nodes,(function(e){e.children&&Eu(e.children,(function(t){i.nodeGroupMap.set(t,e.id)}))})),i.calibrateTopGroupZIndex(t.nodes)},t.register(iv),this.lf=t,uo(this,n),this.init()}return e.prototype.getGroupByNodeId=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},e.prototype.getGroupByBounds=function(e,t){var n=zu(this.lf.graphModel.nodes,(function(n){return!!n.isGroup&&function(e,t){var n=e.minX,i=e.minY,o=e.maxX,r=e.maxY,a=t.x,s=t.y,l=t.width,u=t.height;return n>=a-l/2&&o<=a+l/2&&i>=s-u/2&&r<=s+u/2}(e,n)&&n.id!==t.id})),i=n.length;if(i<=1)return n[0];for(var o=n[i-1],r=i-2;r>=0;r--)n[r].zIndex>o.zIndex&&(o=n[r]);return o},e.prototype.sendNodeToFront=function(e){var t=this;if(e&&e.isGroup&&(this.topGroupZIndex++,e.setZIndex(this.topGroupZIndex),e.children)){var n=e.children;Eu(Array.from(n),(function(e){var n=t.lf.getNodeModelById(e);t.sendNodeToFront(n)}))}},e.prototype.getMaxZIndex=function(e){var t=this,n=ov;if(e.isGroup&&(n=Math.max(n,e.zIndex)),e.children){var i=e.children;Eu(Array.from(i),(function(e){var i=t.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var o=t.getMaxZIndex(i);n=Math.max(n,o)}}))}return n},e.prototype.calibrateTopGroupZIndex=function(e){var t=this,n=ov;if(Eu(e,(function(e){var i=t.lf.getNodeModelById(e.id);if(i){var o=t.getMaxZIndex(i);o>n&&(n=o)}})),!(this.topGroupZIndex>=n)){var i=zu(this.lf.graphModel.nodes,(function(e){return!!e.isGroup})),o=this.topGroupZIndex;Eu(i,(function(e){e.zIndex>o&&(o=e.zIndex)})),this.topGroupZIndex=o}},e.prototype.removeChildrenInGroupNodeData=function(e){var t,n=js(e);return delete n.children,(null===(t=n.properties)||void 0===t?void 0:t.children)&&delete n.properties.children,n},e.prototype.initGroupChildNodes=function(e,n,i,o){var r=this,a=[],s=[],l=[];Eu(Array.from(n),(function(n){var u=r.lf.getNodeModelById(n);if(u){var d=u.children,c=u.getData(),h=t.EventType.NODE_GROUP_COPY||"node:group-copy-add",f=t.transformNodeData(r.removeChildrenInGroupNodeData(c),o),p=r.lf.addNode(f,h);if(i.addChild(p.id),e[n]=p.id,a.push(p),l.push.apply(l,E([],w(E(E([],w(p.incoming.edges),!1),w(p.outgoing.edges),!1)),!1)),d instanceof Set){var g=r.initGroupChildNodes(e,d,p,o),v=g.childNodes,m=g.edgesData;a.push.apply(a,E([],w(v),!1)),s.push.apply(s,E([],w(m),!1))}}}));var u=ed(zu(l,(function(t){return vd(e,t.sourceNodeId)&&vd(e,t.targetNodeId)})),(function(e){return e.getData()}));return{childNodes:a,edgesData:s.concat(u)}},e.prototype.createEdge=function(e,n,i){var o,r,a=e.sourceNodeId,s=e.targetNodeId,l=null!==(o=n[a])&&void 0!==o?o:a,u=null!==(r=n[s])&&void 0!==r?r:s,d=js(e);return e.id&&"object"==typeof e.text&&null!==e.text&&(d=t.transformEdgeData(e,i)),this.lf.graphModel.addEdge(g(g({},d),{sourceNodeId:l,targetNodeId:u}))},e.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,o){if(e.children)for(var r=e.children,a=e.x+t/2,s=e.y+n/2,l=a-i/2,u=s-o/2,d=a+i/2,c=s+o/2,h=Array.from(r),f=0;f<h.length;f++){var p=h[f],g=this.lf.getNodeModelById(p);if(g){var v=g.getBounds(),m=v.minX,y=v.minY,b=v.maxX,x=v.maxY;if(!(l<=m&&u<=y&&d>=b&&c>=x))return!1}}return!0},e.prototype.init=function(){var e=this,t=this.lf,n=t.graphModel;n.addNodeMoveRules((function(t,n,i){if(t.isGroup)return!0;var o=e.nodeGroupMap.get(t.id),r=e.lf.getNodeModelById(o);return!r||!r.isRestrict||(!!r.autoResize||function(e,t,n,i){var o=e.minX,r=e.minY,a=e.maxX,s=e.maxY,l=t.x,u=t.y,d=t.width,c=t.height;return{x:l+n>=o+d/2&&l+n<=a-d/2,y:u+i>=r+c/2&&u+i<=s-c/2}}(r.getBounds(),t,n,i))})),n.addNodeResizeRules((function(t,n,i,o,r){return!t.isGroup||!t.isRestrict||e.checkGroupBoundsWithChildren(t,n,i,o,r)})),n.dynamicGroup=this,t.on("node:add,node:drop,node:dnd-add",this.onNodeAddOrDrop),t.on("selection:drop",this.onSelectionDrop),t.on("node:delete",this.removeNodeFromGroup),t.on("node:drag,node:dnd-drag",this.onNodeDrag),t.on("selection:drag",this.onSelectionDrag),t.on("node:click",this.onNodeSelect),t.on("node:mousemove",this.onNodeMove),t.on("graph:rendered",this.onGraphRendered),t.on("group:add-node",this.onGroupAddNode),t.addElements=function(n,i){var o=n.nodes,r=n.edges;void 0===i&&(i=40);var a={},s={nodes:[],edges:[]},l=[];return Eu(o,(function(n){var o,r,u=n.id,d=null!==(r=null===(o=n.properties)||void 0===o?void 0:o.children)&&void 0!==r?r:n.children,c=t.addNode(e.removeChildrenInGroupNodeData(n));if(u&&(a[u]=c.id),s.nodes.push(c),c.isGroup){var h=e.initGroupChildNodes(a,d,c,i).edgesData;l.push.apply(l,E([],w(h),!1))}})),Eu(l,(function(t){e.createEdge(t,a,i)})),Eu(r,(function(t){s.edges.push(e.createEdge(t,a,i))})),s},this.render()},e.prototype.render=function(){},e.prototype.destroy=function(){this.lf.off("node:add,node:drop,node:dnd-add",this.onNodeAddOrDrop),this.lf.off("selection:drop",this.onSelectionDrop),this.lf.off("node:delete",this.removeNodeFromGroup),this.lf.off("node:drag,node:dnd-drag",this.onNodeDrag),this.lf.off("selection:drag",this.onSelectionDrag),this.lf.off("node:click",this.onNodeSelect),this.lf.off("node:mousemove",this.onNodeMove),this.lf.off("graph:rendered",this.onGraphRendered),this.lf.off("group:add-node",this.onGroupAddNode)},e.pluginName="dynamicGroup",e}();!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(nv||(nv={}));var av=function(e,t,n,i){return void 0===i&&(i=0),uv(e,t,n)<=i};function sv(e){return e*e}function lv(e,t){return sv(e.x-t.x)+sv(e.y-t.y)}var uv=function(e,t,n){return Math.sqrt(function(e,t,n){var i=lv(t,n);if(0===i)return lv(e,t);var o=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/i;return o=Math.max(0,Math.min(1,o)),lv(e,{x:t.x+o*(n.x-t.x),y:t.y+o*(n.y-t.y)})}(e,t,n))},dv=function(e,t,n){var i=function(e){var t=e.x,n=e.y,i=e.width,o=e.height;return{minX:t-i/2,minY:n-o/2,maxX:t+i/2,maxY:n+o/2,x:t,y:n,width:i,height:o,centerX:t,centerY:n}}(e),o=function(e,t){var n;return e.x===t.x?n=nv.VERTICAL:e.y===t.y&&(n=nv.HORIZONTAL),n}(t,n),r=Math.max(t.x,n.x),a=Math.min(t.x,n.x),s=Math.max(t.y,n.y),l=Math.min(t.y,n.y),u=e.x,d=e.y,c=e.width,h=e.height;if(o===nv.HORIZONTAL){if(r>=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(o===nv.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}}},cv=function(e,t,n){void 0===n&&(n=0);for(var i=e.x,o=e.y,r=t.pointsList,a=0;a<r.length-1;a++)if(av({x:i,y:o},r[a],r[a+1],n)){var s=dv(e,r[a],r[a+1]);if(s)return{crossIndex:a+1,crossPoints:s}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},hv=function(){function e(e){var t=e.lf;this._lf=t,this.deviation=20,this.dndAdd=!0,this.dropAdd=!0,this.eventHandler()}return e.prototype.eventHandler=function(){var e=this;this.dndAdd&&this._lf.on("node:dnd-add",(function(t){var n=t.data;e.insetNode(n)})),this.dropAdd&&this._lf.on("node:drop",(function(t){for(var n=t.data,i=e._lf.graphModel.edges,o=n.id,r=!0,a=0;a<i.length;a++)if(i[a].sourceNodeId===o||i[a].targetNodeId===o){r=!1;break}r&&e.insetNode(n)}))},e.prototype.checkRuleBeforeInsetNode=function(e,n,i,o,r){var a=this._lf.getNodeModelById(e),s=this._lf.getNodeModelById(n),l=a.getAnchorInfo(i),u=s.getAnchorInfo(o),d=a.isAllowConnectedAsSource(r,l,u),c=s.isAllowConnectedAsTarget(r,l,u),h=t.formatAnchorConnectValidateData(d),f=h.isAllPass,p=h.msg,g=t.formatAnchorConnectValidateData(c),v=g.isAllPass;return{isPass:f&&v,sourceMsg:p,targetMsg:g.msg}},e.prototype.insetNode=function(e){var n=this,i=this._lf.graphModel.edges,o=this._lf.getNodeModelById(e.id),r=null==o?void 0:o.getDefaultAnchor();if(!r||0===r.length)this._lf.graphModel.eventCenter.emit(t.EventType.CONNECTION_NOT_ALLOWED,{data:e,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(o)for(var a=0;a<i.length;a++){var s=cv(o,i[a],this.deviation),l=s.crossIndex,u=s.crossPoints;if(l>=0){var d=i[a],c=d.sourceNodeId,h=d.targetNodeId,f=d.id,p=d.type,g=d.pointsList,v=d.sourceAnchorId,m=d.targetAnchorId,y=js(g[0]);this._lf.deleteEdge(f);var b=this.checkRuleBeforeInsetNode(c,h,v,m,e),x=t.getClosestAnchor(u.startCrossPoint,o).anchor;this._lf.addEdge({type:p,sourceNodeId:c,targetNodeId:e.id,startPoint:y,endPoint:x});var w=t.getClosestAnchor(u.endCrossPoint,o).anchor;if(this._lf.addEdge({type:p,sourceNodeId:e.id,targetNodeId:h,startPoint:js(w),endPoint:js(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}(),fv="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},pv={};!function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,i(n)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var i="";for(var r in e)t.call(e,r)&&e[r]&&(i=o(i,r));return i}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}({get exports(){return pv},set exports(e){pv=e}});var gv=pv,vv=function(e){function n(n){var i=e.call(this,n)||this;i.textRef=t.createRef(),i.setHoverOn=function(){var e=i.props.element;e.isDragging||i.state.isHovered||(i.setState({isHovered:!0}),e.setHovered(!0))},i.setHoverOff=function(){var e=i.props.element;i.state.isHovered&&(i.setState({isHovered:!1}),e.setHovered(!1))},i.handleMouseDown=function(e){var t,n=i.props,o=n.label,r=n.graphModel.editConfigModel.nodeTextDraggable;!(null!==(t=o.draggable)&&void 0!==t?t:r)||i.state.isDragging||i.state.isEditing||i.stepDrag.handleMouseDown(e)},i.handleMouseUp=function(e){i.state.isDragging&&i.stepDrag.handleMouseUp(e)},i.handleDragging=function(e){var t=e.deltaX,n=e.deltaY;i.state.isDragging||i.setState({isDragging:!0});var o=i.props,r=o.label,a=o.graphModel,s=w(a.transformModel.fixDeltaXY(t,n),2),l=s[0],u=s[1];i.setElementModelLabelInfo({x:r.x+l,y:r.y+u}),a.eventCenter.emit("label:drag",{data:r.getData(),model:r})},i.handleDragEnd=function(){i.setState({isDragging:!1})},i.handleClick=function(e){var t=i.props,n=t.label,o=t.element,r=t.graphModel;o.setSelected(!i.state.isSelected),i.setState({isSelected:!i.state.isSelected}),i.setElementModelLabelInfo({isSelected:!0}),r.eventCenter.emit("label:click",{data:n.getData(),e:e,model:o})},i.handleDbClick=function(e){var n=i.props,o=n.label,r=n.element;if(n.graphModel.eventCenter.emit("label:dblclick",{data:o.getData(),e:e,model:r}),o.editable){if(r.setSelected(),r.setElementState(t.ElementState.TEXT_EDIT),i.setState({isEditing:!0}),i.textRef.current){i.textRef.current.contentEditable="true",i.textRef.current.focus();var a=document.createRange(),s=window.getSelection();a.selectNodeContents(i.textRef.current),a.collapse(!1),null==s||s.removeAllRanges(),null==s||s.addRange(a)}}else r.setSelected(!0)},i.handleBlur=function(e){var t=i.props,n=t.label,o=t.element;t.graphModel.eventCenter.emit("label:blur",{e:e,model:o,data:n.getData(),element:i.textRef.current}),i.setState({isDragging:!1,isHovered:!1,isSelected:!1})},i.handleInput=function(e){var t=i.props,n=t.label;t.graphModel.eventCenter.emit("label:input",{e:e,data:n.getData()})},i.reCalcLabelSize=function(){};var o=n.label,r=n.graphModel,a=r.gridSize,s=r.eventCenter;return i.stepDrag=new t.StepDrag({onDragging:i.handleDragging,onDragEnd:i.handleDragEnd,step:a,eventType:"LABEL",model:o,eventCenter:s}),i.state={isEditing:!1,isHovered:!1,isDragging:!1,isSelected:!1},i}return p(n,e),n.prototype.setElementModelLabelInfo=function(e){var t=this.props,n=t.label,i=t.element,o=t.graphModel,r=i.properties._label,a=qu(r,(function(e){return e.id===n.id})),s=r[a];r[a]=g(g({},s),e);var l=o.getElement(i.id);null==l||l.setProperty("_label",r)},n.prototype.componentDidMount=function(){var e=this,n=this.props,i=n.label,o=n.element;n.graphModel.eventCenter.on("blank:click,node:click,edge:click,label:click",(function(n){var r,a,s,l,u=n.data;if(("label"!==(null==u?void 0:u.type)||"label"===u.type&&u.id!==i.id||e.state.isSelected)&&e.setState({isSelected:!1}),("label"!==(null==u?void 0:u.type)||"label"==u.type&&u.id!==i.id)&&e.state.isEditing){e.setState({isEditing:!1});var d=null!==(a=null===(r=e.textRef.current)||void 0===r?void 0:r.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}),o.setElementState(t.ElementState.DEFAULT)}("label"!==(null==u?void 0:u.type)||"label"==u.type&&u.id!==i.id)&&e.textRef.current&&(e.textRef.current.contentEditable="false")}))},n.prototype.componentDidUpdate=function(){},n.prototype.componentWillUnmount=function(){this.props.graphModel.eventCenter.off("blank:click,node:click,edge:click")},n.prototype.render=function(){var e,t=this.props,n=t.label,i=t.element,o=t.graphModel,r=this.state,a=r.isDragging,s=r.isHovered,l=r.isSelected,u=r.isEditing,d=o.transformModel.getTransformStyle().transform,c=n.id,h=n.x,f=n.y,p=n.zIndex,v=n.vertical,m=n.style,y=n.rotate,b=n.content,x=n.labelWidth,w=n.textOverflowMode,E=null!=x?x:"node"===i.BaseType?i.width-20:80,C={left:"".concat(h-E/2,"px"),top:"".concat(f-10,"px"),width:"".concat(E,"px"),height:"20px",zIndex:null!=p?p:1,transform:y?"".concat(d," rotate(").concat(y,"deg)"):"".concat(d," rotate(").concat(v?-.25:0,"turn)")};return Pp("div",{id:"element-container-".concat(c),className:gv("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:Pp("div",{ref:this.textRef,id:"editor-container-".concat(c),className:gv("lf-label-editor",(e={"lf-label-editor-dragging":a,"lf-label-editor-editing":u,"lf-label-editor-hover":!u&&(s||l)},e["lf-label-editor-".concat(w)]=!u,e)),onInput:this.handleInput,style:g({maxWidth:"".concat(E,"px"),boxSizing:"border-box",display:"inline-block",background:u||"edge"===i.BaseType?"#fff":"transparent"},m),dangerouslySetInnerHTML:{__html:b}})})},n=m([t.observer],n)}(t.Component),mv=t.LogicFlowUtil.createUuid,yv=function(){function e(e,t,n){var i;this.type="label",this.content="",this.value="",this.style={},this.vertical=!1,this.editable=!0,this.draggable=!0,this.textOverflowMode="default",this.element=t,this.graphModel=n,this.id=null!==(i=e.id)&&void 0!==i?i:mv(),this.initLabelData(e)}return e.prototype.initLabelData=function(e){uo(this,e)},e.prototype.getData=function(){return{id:this.id,x:this.x,y:this.y,type:"label",content:this.content,value:this.value,rotate:this.rotate,style:t.toJS(this.style),draggable:this.draggable,editable:this.editable,labelWidth:this.labelWidth,textOverflowMode:this.textOverflowMode,vertical:this.vertical}},m([t.observable],e.prototype,"x",void 0),m([t.observable],e.prototype,"y",void 0),m([t.observable],e.prototype,"content",void 0),m([t.observable],e.prototype,"value",void 0),m([t.observable],e.prototype,"rotate",void 0),m([t.observable],e.prototype,"style",void 0),m([t.observable],e.prototype,"zIndex",void 0),m([t.observable],e.prototype,"vertical",void 0),m([t.observable],e.prototype,"editable",void 0),m([t.observable],e.prototype,"draggable",void 0),m([t.observable],e.prototype,"labelWidth",void 0),m([t.observable],e.prototype,"textOverflowMode",void 0),e}(),bv={};!function(e){"classList"in document.createElement("_")||function(e){if("Element"in e){var t="classList",n="prototype",i=e.Element[n],o=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},a=Array[n].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},s=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},l=function(e,t){if(""===t)throw new s("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new s("INVALID_CHARACTER_ERR","String contains an invalid character");return a.call(e,t)},u=function(e){for(var t=r.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],i=0,o=n.length;i<o;i++)this.push(n[i]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},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,o=!1;do{-1===l(this,e=t[n]+"")&&(this.push(e),o=!0)}while(++n<i);o&&this._updateClassName()},d.remove=function(){var e,t,n=arguments,i=0,o=n.length,r=!1;do{for(t=l(this,e=n[i]+"");-1!==t;)this.splice(t,1),r=!0,t=l(this,e)}while(++i<o);r&&this._updateClassName()},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(" ")},o.defineProperty){var h={get:c,enumerable:!0,configurable:!0};try{o.defineProperty(i,t,h)}catch(e){-2146823252===e.number&&(h.enumerable=!1,o.defineProperty(i,t,h))}}else o[n].__defineGetter__&&i.__defineGetter__(t,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},o=n.prototype,r=i.prototype,a=e.FileReaderSync,s=function(e){this.code=this[this.name=e]},l="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),u=l.length,d=e.URL||e.webkitURL||e,c=d.createObjectURL,h=d.revokeObjectURL,f=d,p=e.btoa,g=e.atob,v=e.ArrayBuffer,m=e.Uint8Array,y=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(i.fake=r.fake=!0;u--;)s.prototype[l[u]]=u+1;return d.createObjectURL||(f=e.URL=function(e){var t,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");return n.href=e,"origin"in n||("data:"===n.protocol.toLowerCase()?n.origin=null:(t=e.match(y),n.origin=t&&t[1])),n}),f.createObjectURL=function(e){var t,n=e.type;return null===n&&(n="application/octet-stream"),e instanceof i?(t="data:"+n,"base64"===e.encoding?t+";base64,"+e.data:"URI"===e.encoding?t+","+decodeURIComponent(e.data):p?t+";base64,"+p(e.data):t+","+encodeURIComponent(e.data)):c?c.call(d,e):void 0},f.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&h&&h.call(d,e)},o.append=function(e){var n=this.data;if(m&&(e instanceof v||e instanceof m)){for(var o="",r=new m(e),l=0,u=r.length;l<u;l++)o+=String.fromCharCode(r[l]);n.push(o)}else if("Blob"===t(e)||"File"===t(e)){if(!a)throw new s("NOT_READABLE_ERR");var 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))))},o.getBlob=function(e){return arguments.length||(e=null),new i(this.data.join(""),e,"raw")},o.toString=function(){return"[object BlobBuilder]"},r.slice=function(e,t,n){var o=arguments.length;return o<3&&(n=null),new i(this.data.slice(e,o>1?t:this.data.length),n,this.encoding)},r.toString=function(){return"[object Blob]"},r.close=function(){this.size=0,delete this.data},n}(e);e.Blob=function(e,n){var i=n&&n.type||"",o=new t;if(e)for(var r=0,a=e.length;r<a;r++)Uint8Array&&e[r]instanceof Uint8Array?o.append(e[r].buffer):o.append(e[r]);var s=o.getBlob(i);return!s.slice&&s.webkitSlice&&(s.slice=s.webkitSlice),s};var n=Object.getPrototypeOf||function(e){return e.__proto__};e.Blob.prototype=n(new e.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||fv.content||fv),function(t,n){"undefined"!=typeof process&&process&&process.versions&&process.versions.electron?t.MediumEditor=n:e.exports=n}(fv,function(){function e(e,t){return this.init(e,t)}var t,n,i,o,r,a,s,l,u,d,c;return e.extensions={},function(t){function n(e,t){var n,i=Array.prototype.slice.call(arguments,2);t=t||{};for(var o=0;o<i.length;o++){var r=i[o];if(r)for(n in r)r.hasOwnProperty(n)&&void 0!==r[n]&&(e||!1===t.hasOwnProperty(n))&&(t[n]=r[n])}return t}var i=!1;try{var o=document.createElement("div"),r=document.createTextNode(" ");o.appendChild(r),i=o.contains(r)}catch(e){}var a={isIE:"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent),isEdge:null!==/Edge\/\d+/.exec(navigator.userAgent),isFF:navigator.userAgent.toLowerCase().indexOf("firefox")>-1,isMac:t.navigator.platform.toUpperCase().indexOf("MAC")>=0,keyCode:{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DELETE:46,K:75,M:77,V:86},isMetaCtrlKey:function(e){return!!(a.isMac&&e.metaKey||!a.isMac&&e.ctrlKey)},isKey:function(e,t){var n=a.getKeyCode(e);return!1===Array.isArray(t)?n===t:-1!==t.indexOf(n)},getKeyCode:function(e){var t=e.which;return null===t&&(t=null!==e.charCode?e.charCode:e.keyCode),t},blockContainerElementNames:["p","h1","h2","h3","h4","h5","h6","blockquote","pre","ul","li","ol","address","article","aside","audio","canvas","dd","dl","dt","fieldset","figcaption","figure","footer","form","header","hgroup","main","nav","noscript","output","section","video","table","thead","tbody","tfoot","tr","th","td"],emptyElementNames:["br","col","colgroup","hr","img","input","source","wbr"],extend:function(){var e=[!0].concat(Array.prototype.slice.call(arguments));return n.apply(this,e)},defaults:function(){var e=[!1].concat(Array.prototype.slice.call(arguments));return n.apply(this,e)},createLink:function(e,t,n,i){var o=e.createElement("a");return a.moveTextRangeIntoElement(t[0],t[t.length-1],o),o.setAttribute("href",n),i&&("_blank"===i&&o.setAttribute("rel","noopener noreferrer"),o.setAttribute("target",i)),o},findOrCreateMatchingTextNodes:function(e,t,n){for(var i=e.createTreeWalker(t,NodeFilter.SHOW_ALL,null,!1),o=[],r=0,s=!1,l=null,u=null;null!==(l=i.nextNode());)if(!(l.nodeType>3))if(3===l.nodeType){if(!s&&n.start<r+l.nodeValue.length&&(s=!0,u=a.splitStartNodeIfNeeded(l,n.start,r)),s&&a.splitEndNodeIfNeeded(l,u,n.end,r),s&&r===n.end)break;if(s&&r>n.end+1)throw new Error("PerformLinking overshot the target!");s&&o.push(u||l),r+=l.nodeValue.length,null!==u&&(r+=u.nodeValue.length,i.nextNode()),u=null}else"img"===l.tagName.toLowerCase()&&(!s&&n.start<=r&&(s=!0),s&&o.push(l));return o},splitStartNodeIfNeeded:function(e,t,n){return t!==n?e.splitText(t-n):null},splitEndNodeIfNeeded:function(e,t,n,i){var o,r;o=i+e.nodeValue.length+(t?t.nodeValue.length:0)-1,r=n-i-(t?e.nodeValue.length:0),o>=n&&i!==o&&0!==r&&(t||e).splitText(r)},splitByBlockElements:function(t){if(3!==t.nodeType&&1!==t.nodeType)return[];var n=[],i=e.util.blockContainerElementNames.join(",");if(3===t.nodeType||0===t.querySelectorAll(i).length)return[t];for(var o=0;o<t.childNodes.length;o++){var r=t.childNodes[o];if(3===r.nodeType)n.push(r);else if(1===r.nodeType){0===r.querySelectorAll(i).length?n.push(r):n=n.concat(e.util.splitByBlockElements(r))}}return n},findAdjacentTextNodeWithContent:function(e,t,n){var i,o=!1,r=n.createNodeIterator(e,NodeFilter.SHOW_TEXT,null,!1);for(i=r.nextNode();i;){if(i===t)o=!0;else if(o&&3===i.nodeType&&i.nodeValue&&i.nodeValue.trim().length>0)break;i=r.nextNode()}return i},findPreviousSibling:function(e){if(!e||a.isMediumEditorElement(e))return!1;for(var t=e.previousSibling;!t&&!a.isMediumEditorElement(e.parentNode);)t=(e=e.parentNode).previousSibling;return t},isDescendant:function(e,t,n){if(!e||!t)return!1;if(e===t)return!!n;if(1!==e.nodeType)return!1;if(i||3!==t.nodeType)return e.contains(t);for(var o=t.parentNode;null!==o;){if(o===e)return!0;o=o.parentNode}return!1},isElement:function(e){return!(!e||1!==e.nodeType)},throttle:function(e,t){var n,i,o,r=null,a=0,s=function(){a=Date.now(),r=null,o=e.apply(n,i),r||(n=i=null)};return t||0===t||(t=50),function(){var l=Date.now(),u=t-(l-a);return n=this,i=arguments,u<=0||u>t?(r&&(clearTimeout(r),r=null),a=l,o=e.apply(n,i),r||(n=i=null)):r||(r=setTimeout(s,u)),o}},traverseUp:function(e,t){if(!e)return!1;do{if(1===e.nodeType){if(t(e))return e;if(a.isMediumEditorElement(e))return!1}e=e.parentNode}while(e);return!1},htmlEntities:function(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},insertHTMLCommand:function(t,n){var i,o,r,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=(o=i.getRangeAt(0)).commonAncestorContainer,a.isMediumEditorElement(d)&&!d.firstChild)o.selectNode(d.appendChild(t.createTextNode("")));else if(3===d.nodeType&&0===o.startOffset&&o.endOffset===d.nodeValue.length||3!==d.nodeType&&d.innerHTML===o.toString()){for(;!a.isMediumEditorElement(d)&&d.parentNode&&1===d.parentNode.childNodes.length&&!a.isMediumEditorElement(d.parentNode);)d=d.parentNode;o.selectNode(d)}for(o.deleteContents(),(r=t.createElement("div")).innerHTML=n,s=t.createDocumentFragment();r.firstChild;)l=r.firstChild,u=s.appendChild(l);o.insertNode(s),u&&((o=o.cloneRange()).setStartAfter(u),o.collapse(!0),e.selection.selectRange(t,o)),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,o=t.split(" ");if("a"===e.nodeName.toLowerCase())for(i=0;i<o.length;i+=1)e.classList.add(o[i]);else{var r=e.getElementsByTagName("a");if(0===r.length){var s=a.getClosestTag(e,"a");e=s?[s]:[]}else e=r;for(n=0;n<e.length;n+=1)for(i=0;i<o.length;i+=1)e[n].classList.add(o[i])}},isListItem:function(e){if(!e)return!1;if("li"===e.nodeName.toLowerCase())return!0;for(var t=e.parentNode,n=t.nodeName.toLowerCase();"li"===n||!a.isBlockContainer(t)&&"div"!==n;){if("li"===n)return!0;if(!(t=t.parentNode))return!1;n=t.nodeName.toLowerCase()}return!1},cleanListDOM:function(t,n){if("li"===n.nodeName.toLowerCase()){var i=n.parentElement;"p"===i.parentElement.nodeName.toLowerCase()&&(a.unwrap(i.parentElement,t),e.selection.moveCursor(t,n.firstChild,n.firstChild.textContent.length))}},splitOffDOMTree:function(e,t,n){for(var i=t,o=null,r=!n;i!==e;){var a,s=i.parentNode,l=s.cloneNode(!1),u=r?i:s.firstChild;for(o&&(r?l.appendChild(o):a=o),o=l;u;){var d=u.nextSibling;u===i?(u.hasChildNodes()?u=u.cloneNode(!1):u.parentNode.removeChild(u),u.textContent&&o.appendChild(u),u=r?d:null):(u.parentNode.removeChild(u),(u.hasChildNodes()||u.textContent)&&o.appendChild(u),u=d)}a&&o.appendChild(a),i=s}return o},moveTextRangeIntoElement:function(e,t,n){if(!e||!t)return!1;var i=a.findCommonRoot(e,t);if(!i)return!1;if(t===e){var o=e.parentNode,r=e.nextSibling;return o.removeChild(e),n.appendChild(e),r?o.insertBefore(n,r):o.appendChild(n),n.hasChildNodes()}for(var s,l,u,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,f=i.ownerDocument.createDocumentFragment();return s===e?(s.parentNode.removeChild(s),f.appendChild(s)):f.appendChild(a.splitOffDOMTree(s,e)),d.forEach((function(e){e.parentNode.removeChild(e),f.appendChild(e)})),l===t?(l.parentNode.removeChild(l),f.appendChild(l)):f.appendChild(a.splitOffDOMTree(l,t,!0)),n.appendChild(f),l.parentNode===i?i.insertBefore(n,l):h?i.insertBefore(n,h):i.appendChild(n),n.hasChildNodes()},depthOfNode:function(e){for(var t=0,n=e;null!==n.parentNode;)n=n.parentNode,t++;return t},findCommonRoot:function(e,t){for(var n=a.depthOfNode(e),i=a.depthOfNode(t),o=e,r=t;n!==i;)n>i?(o=o.parentNode,n-=1):(r=r.parentNode,i-=1);for(;o!==r;)o=o.parentNode,r=r.parentNode;return o},isElementAtBeginningOfBlock:function(e){for(var t;!a.isBlockContainer(e)&&!a.isMediumEditorElement(e);){for(t=e;t=t.previousSibling;)if((3===t.nodeType?t.nodeValue:t.textContent).length>0)return!1;e=e.parentNode}return!0},isMediumEditorElement:function(e){return e&&e.getAttribute&&!!e.getAttribute("data-medium-editor-element")},getContainerEditorElement:function(e){return a.traverseUp(e,(function(e){return a.isMediumEditorElement(e)}))},isBlockContainer:function(e){return e&&3!==e.nodeType&&-1!==a.blockContainerElementNames.indexOf(e.nodeName.toLowerCase())},getClosestBlockContainer:function(e){return a.traverseUp(e,(function(e){return a.isBlockContainer(e)||a.isMediumEditorElement(e)}))},getTopBlockContainer:function(e){var t=!!a.isBlockContainer(e)&&e;return a.traverseUp(e,(function(e){return a.isBlockContainer(e)&&(t=e),!(t||!a.isMediumEditorElement(e))&&(t=e,!0)})),t},getFirstSelectableLeafNode:function(e){for(;e&&e.firstChild;)e=e.firstChild;if("table"===(e=a.traverseUp(e,(function(e){return-1===a.emptyElementNames.indexOf(e.nodeName.toLowerCase())}))).nodeName.toLowerCase()){var t=e.querySelector("th, td");t&&(e=t)}return e},getFirstTextNode:function(e){return a.warn("getFirstTextNode is deprecated and will be removed in version 6.0.0"),a._getFirstTextNode(e)},_getFirstTextNode:function(e){if(3===e.nodeType)return e;for(var t=0;t<e.childNodes.length;t++){var n=a._getFirstTextNode(e.childNodes[t]);if(null!==n)return n}return null},ensureUrlHasProtocol:function(e){return-1===e.indexOf("://")?"http://"+e:e},warn:function(){void 0!==t.console&&"function"==typeof t.console.warn&&t.console.warn.apply(t.console,arguments)},deprecated:function(e,t,n){var i=e+" is deprecated, please use "+t+" instead.";n&&(i+=" Will be removed in "+n),a.warn(i)},deprecatedMethod:function(e,t,n,i){a.deprecated(e,t,i),"function"==typeof this[t]&&this[t].apply(this,n)},cleanupAttrs:function(e,t){t.forEach((function(t){e.removeAttribute(t)}))},cleanupTags:function(e,t){-1!==t.indexOf(e.nodeName.toLowerCase())&&e.parentNode.removeChild(e)},unwrapTags:function(t,n){-1!==n.indexOf(t.nodeName.toLowerCase())&&e.util.unwrap(t,document)},getClosestTag:function(e,t){return a.traverseUp(e,(function(e){return e.nodeName.toLowerCase()===t.toLowerCase()}))},unwrap:function(e,t){for(var n=t.createDocumentFragment(),i=Array.prototype.slice.call(e.childNodes),o=0;o<i.length;o++)n.appendChild(i[o]);n.childNodes.length?e.parentNode.replaceChild(n,e):e.parentNode.removeChild(e)},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}};e.util=a}(window),(t=function(t){e.util.extend(this,t)}).extend=function(t){var n,i=this;n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},e.util.extend(n,i);var o=function(){this.constructor=n};return o.prototype=i.prototype,n.prototype=new o,t&&e.util.extend(n.prototype,t),n},t.prototype={init:function(){},base:void 0,name:void 0,checkState:void 0,destroy:void 0,queryCommandState:void 0,isActive:void 0,isAlreadyApplied:void 0,setActive:void 0,setInactive:void 0,getInteractionElements:void 0,window:void 0,document:void 0,getEditorElements:function(){return this.base.elements},getEditorId:function(){return this.base.id},getEditorOption:function(e){return this.base.options[e]}},["execAction","on","off","subscribe","trigger"].forEach((function(e){t.prototype[e]=function(){return this.base[e].apply(this.base,arguments)}})),e.Extension=t,function(){function t(t){return e.util.isBlockContainer(t)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}var n={findMatchingSelectionParent:function(t,n){var i,o=n.getSelection();return 0!==o.rangeCount&&(i=o.getRangeAt(0).commonAncestorContainer,e.util.traverseUp(i,t))},getSelectionElement:function(t){return this.findMatchingSelectionParent((function(t){return e.util.isMediumEditorElement(t)}),t)},exportSelection:function(e,t){if(!e)return null;var n=null,i=t.getSelection();if(i.rangeCount>0){var o,r=i.getRangeAt(0),a=r.cloneRange();a.selectNodeContents(e),a.setEnd(r.startContainer,r.startOffset),n={start:o=a.toString().length,end:o+r.toString().length},this.doesRangeStartWithImages(r,t)&&(n.startsWithImage=!0);var s=this.getTrailingImageCount(e,n,r.endContainer,r.endOffset);if(s&&(n.trailingImageCount=s),0!==o){var l=this.getIndexRelativeToAdjacentEmptyBlocks(t,e,r.startContainer,r.startOffset);-1!==l&&(n.emptyBlocksIndex=l)}}return n},importSelection:function(e,t,n,i){if(e&&t){var o=n.createRange();o.setStart(t,0),o.collapse(!0);var r,a=t,s=[],l=0,u=!1,d=!1,c=0,h=!1,f=!1,p=null;for((i||e.startsWithImage||void 0!==e.emptyBlocksIndex)&&(f=!0);!h&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||d){if(e.trailingImageCount&&d&&("img"===a.nodeName.toLowerCase()&&c++,c===e.trailingImageCount)){for(var g=0;a.parentNode.childNodes[g]!==a;)g++;o.setEnd(a.parentNode,g+1),h=!0}if(!h&&1===a.nodeType)for(var v=a.childNodes.length-1;v>=0;)s.push(a.childNodes[v]),v-=1}else r=l+a.length,!u&&e.start>=l&&e.start<=r&&(f||e.start<r?(o.setStart(a,e.start-l),u=!0):p=a),u&&e.end>=l&&e.end<=r&&(e.trailingImageCount?d=!0:(o.setEnd(a,e.end-l),h=!0)),l=r;h||(a=s.pop())}!u&&p&&(o.setStart(p,p.length),o.setEnd(p,p.length)),void 0!==e.emptyBlocksIndex&&(o=this.importSelectionMoveCursorPastBlocks(n,t,e.emptyBlocksIndex,o)),i&&(o=this.importSelectionMoveCursorPastAnchor(e,o)),this.selectRange(n,o)}},importSelectionMoveCursorPastAnchor:function(t,n){if(t.start===t.end&&3===n.startContainer.nodeType&&n.startOffset===n.startContainer.nodeValue.length&&e.util.traverseUp(n.startContainer,(function(e){return"a"===e.nodeName.toLowerCase()}))){for(var i=n.startContainer,o=n.startContainer.parentNode;null!==o&&"a"!==o.nodeName.toLowerCase();)o.childNodes[o.childNodes.length-1]!==i?o=null:(i=o,o=o.parentNode);if(null!==o&&"a"===o.nodeName.toLowerCase()){for(var r=null,a=0;null===r&&a<o.parentNode.childNodes.length;a++)o.parentNode.childNodes[a]===o&&(r=a);n.setStart(o.parentNode,r+1),n.collapse(!0)}}return n},importSelectionMoveCursorPastBlocks:function(n,i,o,r){var a,s,l=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),u=r.startContainer,d=0;for(o=o||1,a=3===u.nodeType&&e.util.isBlockContainer(u.previousSibling)?u.previousSibling:e.util.getClosestBlockContainer(u);l.nextNode();)if(s){if(s=l.currentNode,++d===o)break;if(s.textContent.length>0)break}else a===l.currentNode&&(s=l.currentNode);return s||(s=a),r.setStart(e.util.getFirstSelectableLeafNode(s),0),r},getIndexRelativeToAdjacentEmptyBlocks:function(n,i,o,r){if(o.textContent.length>0&&r>0)return-1;var a=o;if(3!==a.nodeType&&(a=o.childNodes[r]),a){if(!e.util.isElementAtBeginningOfBlock(a))return-1;var s=e.util.findPreviousSibling(a);if(!s)return-1;if(s.nodeValue)return-1}for(var l=e.util.getClosestBlockContainer(o),u=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t,!1),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 o=i.currentNode;if(o===n)break;if(o.nodeValue)return!1}return!0},getTrailingImageCount:function(e,t,n,i){if(0===i||1!==n.nodeType)return 0;if("img"!==n.nodeName.toLowerCase()&&!n.querySelector("img"))return 0;for(var o=n.childNodes[i-1];o.hasChildNodes();)o=o.lastChild;for(var r,a=e,s=[],l=0,u=!1,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===o)c=!0;else if(1===a.nodeType)for(var f=a.childNodes.length-1;f>=0;)s.push(a.childNodes[f]),f-=1}else h=0,r=l+a.length,!u&&t.start>=l&&t.start<=r&&(u=!0),u&&t.end>=l&&t.end<=r&&(d=!0),l=r;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,o="",r=e.getSelection();if(r.rangeCount){for(i=e.createElement("div"),t=0,n=r.rangeCount;t<n;t+=1)i.appendChild(r.getRangeAt(t).cloneContents());o=i.innerHTML}return o},getCaretOffsets:function(e,t){var n,i;return t||(t=window.getSelection().getRangeAt(0)),n=t.cloneRange(),i=t.cloneRange(),n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset),i.selectNodeContents(e),i.setStart(t.endContainer,t.endOffset),{left:n.toString().length,right:i.toString().length}},rangeSelectsSingleNode:function(e){var t=e.startContainer;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===e.startOffset+1},getSelectedParentElement:function(e){return e?this.rangeSelectsSingleNode(e)&&3!==e.startContainer.childNodes[e.startOffset].nodeType?e.startContainer.childNodes[e.startOffset]:3===e.startContainer.nodeType?e.startContainer.parentNode:e.startContainer:null},getSelectedElements:function(e){var t,n,i,o=e.getSelection();if(!o.rangeCount||o.isCollapsed||!o.getRangeAt(0).commonAncestorContainer)return[];if(3===(t=o.getRangeAt(0)).commonAncestorContainer.nodeType){for(n=[],i=t.commonAncestorContainer;i.parentNode&&1===i.parentNode.childNodes.length;)n.push(i.parentNode),i=i.parentNode;return n}return[].filter.call(t.commonAncestorContainer.getElementsByTagName("*"),(function(e){return"function"!=typeof o.containsNode||o.containsNode(e,!0)}))},selectNode:function(e,t){var n=t.createRange();n.selectNodeContents(e),this.selectRange(t,n)},select:function(e,t,n,i,o){var r=e.createRange();return r.setStart(t,n),i?r.setEnd(i,o):r.collapse(!0),this.selectRange(e,r),r},clearSelection:function(e,t){t?e.getSelection().collapseToStart():e.getSelection().collapseToEnd()},moveCursor:function(e,t,n){this.select(e,t,n)},getSelectionRange:function(e){var t=e.getSelection();return 0===t.rangeCount?null:t.getRangeAt(0)},selectRange:function(e,t){var n=e.getSelection();n.removeAllRanges(),n.addRange(t)},getSelectionStart:function(e){var t=e.getSelection().anchorNode;return t&&3===t.nodeType?t.parentNode:t}};e.selection=n}(),function(){function t(t,n){return!!t&&t.some((function(t){if("function"!=typeof t.getInteractionElements)return!1;var i=t.getInteractionElements();return!!i&&(Array.isArray(i)||(i=[i]),i.some((function(t){return e.util.isDescendant(t,n,!0)})))}))}var n=function(e){this.base=e,this.options=this.base.options,this.events=[],this.disabledEvents={},this.customEvents={},this.listeners={}};n.prototype={InputEventOnContenteditableSupported:!e.util.isIE&&!e.util.isEdge,attachDOMEvent:function(t,n,i,o){var r=this.base.options.contentWindow,a=this.base.options.ownerDocument;t=e.util.isElement(t)||[r,a].indexOf(t)>-1?[t]:t,Array.prototype.forEach.call(t,function(e){e.addEventListener(n,i,o),this.events.push([e,n,i,o])}.bind(this))},detachDOMEvent:function(t,n,i,o){var r,a,s=this.base.options.contentWindow,l=this.base.options.ownerDocument;t&&(t=e.util.isElement(t)||[s,l].indexOf(t)>-1?[t]:t,Array.prototype.forEach.call(t,function(e){-1!==(r=this.indexOfListener(e,n,i,o))&&(a=this.events.splice(r,1)[0])[0].removeEventListener(a[1],a[2],a[3])}.bind(this)))},indexOfListener:function(e,t,n,i){var o,r,a;for(o=0,r=this.events.length;o<r;o+=1)if((a=this.events[o])[0]===e&&a[1]===t&&a[2]===n&&a[3]===i)return o;return-1},detachAllDOMEvents:function(){for(var e=this.events.pop();e;)e[0].removeEventListener(e[1],e[2],e[3]),e=this.events.pop()},detachAllEventsFromElement:function(e){for(var t=this.events.filter((function(t){return t&&t[0].getAttribute&&t[0].getAttribute("medium-editor-index")===e.getAttribute("medium-editor-index")})),n=0,i=t.length;n<i;n++){var o=t[n];this.detachDOMEvent(o[0],o[1],o[2],o[3])}},attachAllEventsToElement:function(e){this.listeners.editableInput&&(this.contentCache[e.getAttribute("medium-editor-index")]=e.innerHTML),this.eventsCache&&this.eventsCache.forEach((function(t){this.attachDOMEvent(e,t.name,t.handler.bind(this))}),this)},enableCustomEvent:function(e){void 0!==this.disabledEvents[e]&&delete this.disabledEvents[e]},disableCustomEvent:function(e){this.disabledEvents[e]=!0},attachCustomEvent:function(e,t){this.setupListener(e),this.customEvents[e]||(this.customEvents[e]=[]),this.customEvents[e].push(t)},detachCustomEvent:function(e,t){var n=this.indexOfCustomListener(e,t);-1!==n&&this.customEvents[e].splice(n,1)},indexOfCustomListener:function(e,t){return this.customEvents[e]&&this.customEvents[e].length?this.customEvents[e].indexOf(t):-1},detachAllCustomEvents:function(){this.customEvents={}},triggerCustomEvent:function(e,t,n){this.customEvents[e]&&!this.disabledEvents[e]&&this.customEvents[e].forEach((function(e){e(t,n)}))},destroy:function(){this.detachAllDOMEvents(),this.detachAllCustomEvents(),this.detachExecCommand(),this.base.elements&&this.base.elements.forEach((function(e){e.removeAttribute("data-medium-focused")}))},attachToExecCommand:function(){this.execCommandListener||(this.execCommandListener=function(e){this.handleDocumentExecCommand(e)}.bind(this),this.wrapExecCommand(),this.options.ownerDocument.execCommand.listeners.push(this.execCommandListener))},detachExecCommand:function(){var e=this.options.ownerDocument;if(this.execCommandListener&&e.execCommand.listeners){var t=e.execCommand.listeners.indexOf(this.execCommandListener);-1!==t&&e.execCommand.listeners.splice(t,1),e.execCommand.listeners.length||this.unwrapExecCommand()}},wrapExecCommand:function(){var e=this.options.ownerDocument;if(!e.execCommand.listeners){var t=function(t,n){e.execCommand.listeners&&e.execCommand.listeners.forEach((function(e){e({command:t[0],value:t[2],args:t,result:n})}))},n=function(){var n=e.execCommand.orig.apply(this,arguments);if(!e.execCommand.listeners)return n;var i=Array.prototype.slice.call(arguments);return t(i,n),n};n.orig=e.execCommand,n.listeners=[],n.callListeners=t,e.execCommand=n}},unwrapExecCommand:function(){var e=this.options.ownerDocument;e.execCommand.orig&&(e.execCommand=e.execCommand.orig)},setupListener:function(e){if(!this.listeners[e]){switch(e){case"externalInteraction":this.attachDOMEvent(this.options.ownerDocument.body,"mousedown",this.handleBodyMousedown.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"click",this.handleBodyClick.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"focus",this.handleBodyFocus.bind(this),!0);break;case"blur":case"focus":this.setupListener("externalInteraction");break;case"editableInput":this.contentCache={},this.base.elements.forEach((function(e){this.contentCache[e.getAttribute("medium-editor-index")]=e.innerHTML}),this),this.InputEventOnContenteditableSupported&&this.attachToEachElement("input",this.handleInput),this.InputEventOnContenteditableSupported||(this.setupListener("editableKeypress"),this.keypressUpdateInput=!0,this.attachDOMEvent(document,"selectionchange",this.handleDocumentSelectionChange.bind(this)),this.attachToExecCommand());break;case"editableClick":this.attachToEachElement("click",this.handleClick);break;case"editableBlur":this.attachToEachElement("blur",this.handleBlur);break;case"editableKeypress":this.attachToEachElement("keypress",this.handleKeypress);break;case"editableKeyup":this.attachToEachElement("keyup",this.handleKeyup);break;case"editableKeydown":this.attachToEachElement("keydown",this.handleKeydown);break;case"editableKeydownSpace":case"editableKeydownEnter":case"editableKeydownTab":case"editableKeydownDelete":this.setupListener("editableKeydown");break;case"editableMouseover":this.attachToEachElement("mouseover",this.handleMouseover);break;case"editableDrag":this.attachToEachElement("dragover",this.handleDragging),this.attachToEachElement("dragleave",this.handleDragging);break;case"editableDrop":this.attachToEachElement("drop",this.handleDrop);break;case"editablePaste":this.attachToEachElement("paste",this.handlePaste)}this.listeners[e]=!0}},attachToEachElement:function(e,t){this.eventsCache||(this.eventsCache=[]),this.base.elements.forEach((function(n){this.attachDOMEvent(n,e,t.bind(this))}),this),this.eventsCache.push({name:e,handler:t})},cleanupElement:function(e){var t=e.getAttribute("medium-editor-index");t&&(this.detachAllEventsFromElement(e),this.contentCache&&delete this.contentCache[t])},focusElement:function(e){e.focus(),this.updateFocus(e,{target:e,type:"focus"})},updateFocus:function(n,i){var o,r=this.base.getFocusedElement();r&&"click"===i.type&&this.lastMousedownTarget&&(e.util.isDescendant(r,this.lastMousedownTarget,!0)||t(this.base.extensions,this.lastMousedownTarget))&&(o=r),o||this.base.elements.some((function(t){return!o&&e.util.isDescendant(t,n,!0)&&(o=t),!!o}),this);var a=!e.util.isDescendant(r,n,!0)&&!t(this.base.extensions,n);o!==r&&(r&&a&&(r.removeAttribute("data-medium-focused"),this.triggerCustomEvent("blur",i,r)),o&&(o.setAttribute("data-medium-focused",!0),this.triggerCustomEvent("focus",i,o))),a&&this.triggerCustomEvent("externalInteraction",i)},updateInput:function(e,t){if(this.contentCache){var n=e.getAttribute("medium-editor-index"),i=e.innerHTML;i!==this.contentCache[n]&&this.triggerCustomEvent("editableInput",t,e),this.contentCache[n]=i}},handleDocumentSelectionChange:function(t){if(t.currentTarget&&t.currentTarget.activeElement){var n,i=t.currentTarget.activeElement;this.base.elements.some((function(t){return!!e.util.isDescendant(t,i,!0)&&(n=t,!0)}),this),n&&this.updateInput(n,{target:i,currentTarget:n})}},handleDocumentExecCommand:function(){var e=this.base.getFocusedElement();e&&this.updateInput(e,{target:e,currentTarget:e})},handleBodyClick:function(e){this.updateFocus(e.target,e)},handleBodyFocus:function(e){this.updateFocus(e.target,e)},handleBodyMousedown:function(e){this.lastMousedownTarget=e.target},handleInput:function(e){this.updateInput(e.currentTarget,e)},handleClick:function(e){this.triggerCustomEvent("editableClick",e,e.currentTarget)},handleBlur:function(e){this.triggerCustomEvent("editableBlur",e,e.currentTarget)},handleKeypress:function(e){if(this.triggerCustomEvent("editableKeypress",e,e.currentTarget),this.keypressUpdateInput){var t={target:e.target,currentTarget:e.currentTarget};setTimeout(function(){this.updateInput(t.currentTarget,t)}.bind(this),0)}},handleKeyup:function(e){this.triggerCustomEvent("editableKeyup",e,e.currentTarget)},handleMouseover:function(e){this.triggerCustomEvent("editableMouseover",e,e.currentTarget)},handleDragging:function(e){this.triggerCustomEvent("editableDrag",e,e.currentTarget)},handleDrop:function(e){this.triggerCustomEvent("editableDrop",e,e.currentTarget)},handlePaste:function(e){this.triggerCustomEvent("editablePaste",e,e.currentTarget)},handleKeydown:function(t){return this.triggerCustomEvent("editableKeydown",t,t.currentTarget),e.util.isKey(t,e.util.keyCode.SPACE)?this.triggerCustomEvent("editableKeydownSpace",t,t.currentTarget):e.util.isKey(t,e.util.keyCode.ENTER)||t.ctrlKey&&e.util.isKey(t,e.util.keyCode.M)?this.triggerCustomEvent("editableKeydownEnter",t,t.currentTarget):e.util.isKey(t,e.util.keyCode.TAB)?this.triggerCustomEvent("editableKeydownTab",t,t.currentTarget):e.util.isKey(t,[e.util.keyCode.DELETE,e.util.keyCode.BACKSPACE])?this.triggerCustomEvent("editableKeydownDelete",t,t.currentTarget):void 0}},e.Events=n}(),n=e.Extension.extend({action:void 0,aria:void 0,tagNames:void 0,style:void 0,useQueryState:void 0,contentDefault:void 0,contentFA:void 0,classList:void 0,attrs:void 0,constructor:function(t){n.isBuiltInButton(t)?e.Extension.call(this,this.defaults[t]):e.Extension.call(this,t)},init:function(){e.Extension.prototype.init.apply(this,arguments),this.button=this.createButton(),this.on(this.button,"click",this.handleClick.bind(this))},getButton:function(){return this.button},getAction:function(){return"function"==typeof this.action?this.action(this.base.options):this.action},getAria:function(){return"function"==typeof this.aria?this.aria(this.base.options):this.aria},getTagNames:function(){return"function"==typeof this.tagNames?this.tagNames(this.base.options):this.tagNames},createButton:function(){var e=this.document.createElement("button"),t=this.contentDefault,n=this.getAria(),i=this.getEditorOption("buttonLabels");return e.classList.add("medium-editor-action"),e.classList.add("medium-editor-action-"+this.name),this.classList&&this.classList.forEach((function(t){e.classList.add(t)})),e.setAttribute("data-action",this.getAction()),n&&(e.setAttribute("title",n),e.setAttribute("aria-label",n)),this.attrs&&Object.keys(this.attrs).forEach((function(t){e.setAttribute(t,this.attrs[t])}),this),"fontawesome"===i&&this.contentFA&&(t=this.contentFA),e.innerHTML=t,e},handleClick:function(e){e.preventDefault(),e.stopPropagation();var t=this.getAction();t&&this.execAction(t)},isActive:function(){return this.button.classList.contains(this.getEditorOption("activeButtonClass"))},setInactive:function(){this.button.classList.remove(this.getEditorOption("activeButtonClass")),delete this.knownState},setActive:function(){this.button.classList.add(this.getEditorOption("activeButtonClass")),delete this.knownState},queryCommandState:function(){var e=null;return this.useQueryState&&(e=this.base.queryCommandState(this.getAction())),e},isAlreadyApplied:function(e){var t,n,i=!1,o=this.getTagNames();return!1===this.knownState||!0===this.knownState?this.knownState:(o&&o.length>0&&(i=-1!==o.indexOf(e.nodeName.toLowerCase())),!i&&this.style&&(t=this.style.value.split("|"),n=this.window.getComputedStyle(e,null).getPropertyValue(this.style.prop),t.forEach((function(e){this.knownState||((i=-1!==n.indexOf(e))||"text-decoration"!==this.style.prop)&&(this.knownState=i)}),this)),i)}}),n.isBuiltInButton=function(t){return"string"==typeof t&&e.extensions.button.prototype.defaults.hasOwnProperty(t)},e.extensions.button=n,e.extensions.button.prototype.defaults={bold:{name:"bold",action:"bold",aria:"bold",tagNames:["b","strong"],style:{prop:"font-weight",value:"700|bold"},useQueryState:!0,contentDefault:"<b>B</b>",contentFA:'<i class="fa fa-bold"></i>'},italic:{name:"italic",action:"italic",aria:"italic",tagNames:["i","em"],style:{prop:"font-style",value:"italic"},useQueryState:!0,contentDefault:"<b><i>I</i></b>",contentFA:'<i class="fa fa-italic"></i>'},underline:{name:"underline",action:"underline",aria:"underline",tagNames:["u"],style:{prop:"text-decoration",value:"underline"},useQueryState:!0,contentDefault:"<b><u>U</u></b>",contentFA:'<i class="fa fa-underline"></i>'},strikethrough:{name:"strikethrough",action:"strikethrough",aria:"strike through",tagNames:["strike"],style:{prop:"text-decoration",value:"line-through"},useQueryState:!0,contentDefault:"<s>A</s>",contentFA:'<i class="fa fa-strikethrough"></i>'},superscript:{name:"superscript",action:"superscript",aria:"superscript",tagNames:["sup"],contentDefault:"<b>x<sup>1</sup></b>",contentFA:'<i class="fa fa-superscript"></i>'},subscript:{name:"subscript",action:"subscript",aria:"subscript",tagNames:["sub"],contentDefault:"<b>x<sub>1</sub></b>",contentFA:'<i class="fa fa-subscript"></i>'},image:{name:"image",action:"image",aria:"image",tagNames:["img"],contentDefault:"<b>image</b>",contentFA:'<i class="fa fa-picture-o"></i>'},html:{name:"html",action:"html",aria:"evaluate html",tagNames:["iframe","object"],contentDefault:"<b>html</b>",contentFA:'<i class="fa fa-code"></i>'},orderedlist:{name:"orderedlist",action:"insertorderedlist",aria:"ordered list",tagNames:["ol"],useQueryState:!0,contentDefault:"<b>1.</b>",contentFA:'<i class="fa fa-list-ol"></i>'},unorderedlist:{name:"unorderedlist",action:"insertunorderedlist",aria:"unordered list",tagNames:["ul"],useQueryState:!0,contentDefault:"<b>•</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,o=e.extensions.form.extend({customClassOption:null,customClassOptionText:"Button",linkValidation:!1,placeholderText:"Paste or type a link",targetCheckbox:!1,targetCheckboxText:"Open in new window",name:"anchor",action:"createLink",aria:"link",tagNames:["a"],contentDefault:"<b>#</b>",contentFA:'<i class="fa fa-link"></i>',init:function(){e.extensions.form.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this))},handleClick:function(t){t.preventDefault(),t.stopPropagation();var n=e.selection.getSelectionRange(this.document);return"a"===n.startContainer.nodeName.toLowerCase()||"a"===n.endContainer.nodeName.toLowerCase()||e.util.getClosestTag(e.selection.getSelectedParentElement(n),"a")?this.execAction("unlink"):(this.isDisplayed()||this.showForm(),!1)},handleKeydown:function(t){e.util.isKey(t,e.util.keyCode.K)&&e.util.isMetaCtrlKey(t)&&!t.shiftKey&&this.handleClick(t)},getForm:function(){return this.form||(this.form=this.createForm()),this.form},getTemplate:function(){var e=['<input type="text" class="medium-editor-toolbar-input" placeholder="',this.placeholderText,'">'];return e.push('<a href="#" class="medium-editor-toolbar-save">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':this.formSaveLabel,"</a>"),e.push('<a href="#" class="medium-editor-toolbar-close">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':this.formCloseLabel,"</a>"),this.targetCheckbox&&e.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-target" id="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">','<label for="medium-editor-toolbar-anchor-target-field-'+this.getEditorId()+'">',this.targetCheckboxText,"</label>","</div>"),this.customClassOption&&e.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-button">',"<label>",this.customClassOptionText,"</label>","</div>"),e.join("")},isDisplayed:function(){return e.extensions.form.prototype.isDisplayed.apply(this)},hideForm:function(){e.extensions.form.prototype.hideForm.apply(this),this.getInput().value=""},showForm:function(t){var n=this.getInput(),i=this.getAnchorTargetCheckbox(),o=this.getAnchorButtonCheckbox();if("string"==typeof(t=t||{value:""})&&(t={value:t}),this.base.saveSelection(),this.hideToolbarDefaultActions(),e.extensions.form.prototype.showForm.apply(this),this.setToolbarPosition(),n.value=t.value,n.focus(),i&&(i.checked="_blank"===t.target),o){var r=t.buttonClass?t.buttonClass.split(" "):[];o.checked=-1!==r.indexOf(this.customClassOption)}},destroy:function(){if(!this.form)return!1;this.form.parentNode&&this.form.parentNode.removeChild(this.form),delete this.form},getFormOpts:function(){var e=this.getAnchorTargetCheckbox(),t=this.getAnchorButtonCheckbox(),n={value:this.getInput().value.trim()};return this.linkValidation&&(n.value=this.checkLinkFormat(n.value)),n.target="_self",e&&e.checked&&(n.target="_blank"),t&&t.checked&&(n.buttonClass=this.customClassOption),n},doFormSave:function(){var e=this.getFormOpts();this.completeFormSave(e)},completeFormSave:function(e){this.base.restoreSelection(),this.execAction(this.action,e),this.base.checkSelection()},ensureEncodedUri:function(e){return e===decodeURI(e)?encodeURI(e):e},ensureEncodedUriComponent:function(e){return e===decodeURIComponent(e)?encodeURIComponent(e):e},ensureEncodedParam:function(e){var t=e.split("="),n=t[0],i=t[1];return n+(void 0===i?"":"="+this.ensureEncodedUriComponent(i))},ensureEncodedQuery:function(e){return e.split("&").map(this.ensureEncodedParam.bind(this)).join("&")},checkLinkFormat:function(e){var t=/^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#/i.test(e),n="",i=e.match(/^(.*?)(?:\?(.*?))?(?:#(.*))?$/),o=i[1],r=i[2],a=i[3];if(/^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/.test(e))return"tel:"+e;if(!t){var s=o.split("/")[0];(s.match(/.+(\.|:).+/)||"localhost"===s)&&(n="http://")}return n+this.ensureEncodedUri(o)+(void 0===r?"":"?"+this.ensureEncodedQuery(r))+(void 0===a?"":"#"+a)},doFormCancel:function(){this.base.restoreSelection(),this.base.checkSelection()},attachFormEvents:function(e){var t=e.querySelector(".medium-editor-toolbar-close"),n=e.querySelector(".medium-editor-toolbar-save"),i=e.querySelector(".medium-editor-toolbar-input");this.on(e,"click",this.handleFormClick.bind(this)),this.on(i,"keyup",this.handleTextboxKeyup.bind(this)),this.on(t,"click",this.handleCloseClick.bind(this)),this.on(n,"click",this.handleSaveClick.bind(this),!0)},createForm:function(){var e=this.document.createElement("div");return e.className="medium-editor-toolbar-form",e.id="medium-editor-toolbar-form-anchor-"+this.getEditorId(),e.innerHTML=this.getTemplate(),this.attachFormEvents(e),e},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},getAnchorTargetCheckbox:function(){return this.getForm().querySelector(".medium-editor-toolbar-anchor-target")},getAnchorButtonCheckbox:function(){return this.getForm().querySelector(".medium-editor-toolbar-anchor-button")},handleTextboxKeyup:function(t){if(t.keyCode===e.util.keyCode.ENTER)return t.preventDefault(),void this.doFormSave();t.keyCode===e.util.keyCode.ESCAPE&&(t.preventDefault(),this.doFormCancel())},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),e.extensions.anchor=o,r=e.Extension.extend({name:"anchor-preview",hideDelay:500,previewValueSelector:"a",showWhenToolbarIsVisible:!1,showOnEmptyLinks:!0,init:function(){this.anchorPreview=this.createPreview(),this.getEditorOption("elementsContainer").appendChild(this.anchorPreview),this.attachToEditables()},getInteractionElements:function(){return this.getPreviewElement()},getPreviewElement:function(){return this.anchorPreview},createPreview:function(){var e=this.document.createElement("div");return e.id="medium-editor-anchor-preview-"+this.getEditorId(),e.className="medium-editor-anchor-preview",e.innerHTML=this.getTemplate(),this.on(e,"click",this.handleClick.bind(this)),e},getTemplate:function(){return'<div class="medium-editor-toolbar-anchor-preview" id="medium-editor-toolbar-anchor-preview"> <a class="medium-editor-toolbar-anchor-preview-inner"></a></div>'},destroy:function(){this.anchorPreview&&(this.anchorPreview.parentNode&&this.anchorPreview.parentNode.removeChild(this.anchorPreview),delete this.anchorPreview)},hidePreview:function(){this.anchorPreview&&this.anchorPreview.classList.remove("medium-editor-anchor-preview-active"),this.activeAnchor=null},showPreview:function(e){return!(!this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")&&!e.getAttribute("data-disable-preview"))||(this.previewValueSelector&&(this.anchorPreview.querySelector(this.previewValueSelector).textContent=e.attributes.href.value,this.anchorPreview.querySelector(this.previewValueSelector).href=e.attributes.href.value),this.anchorPreview.classList.add("medium-toolbar-arrow-over"),this.anchorPreview.classList.remove("medium-toolbar-arrow-under"),this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")||this.anchorPreview.classList.add("medium-editor-anchor-preview-active"),this.activeAnchor=e,this.positionPreview(),this.attachPreviewHandlers(),this)},positionPreview:function(e){e=e||this.activeAnchor;var t,n,i,o,r,a=this.window.innerWidth,s=this.anchorPreview.offsetHeight,l=e.getBoundingClientRect(),u=this.diffLeft,d=this.diffTop,c=this.getEditorOption("elementsContainer"),h=["absolute","fixed"].indexOf(window.getComputedStyle(c).getPropertyValue("position"))>-1,f={};t=this.anchorPreview.offsetWidth/2;var p=this.base.getExtensionByName("toolbar");p&&(u=p.diffLeft,d=p.diffTop),n=u-t,h?(o=c.getBoundingClientRect(),["top","left"].forEach((function(e){f[e]=l[e]-o[e]})),f.width=l.width,f.height=l.height,l=f,a=o.width,r=c.scrollTop):r=this.window.pageYOffset,i=l.left+l.width/2,r+=s+l.top+l.height-d-this.anchorPreview.offsetHeight,this.anchorPreview.style.top=Math.round(r)+"px",this.anchorPreview.style.right="initial",i<t?(this.anchorPreview.style.left=n+t+"px",this.anchorPreview.style.right="initial"):a-i<t?(this.anchorPreview.style.left="auto",this.anchorPreview.style.right=0):(this.anchorPreview.style.left=n+i+"px",this.anchorPreview.style.right="initial")},attachToEditables:function(){this.subscribe("editableMouseover",this.handleEditableMouseover.bind(this)),this.subscribe("positionedToolbar",this.handlePositionedToolbar.bind(this))},handlePositionedToolbar:function(){this.showWhenToolbarIsVisible||this.hidePreview()},handleClick:function(e){var t=this.base.getExtensionByName("anchor"),n=this.activeAnchor;t&&n&&(e.preventDefault(),this.base.selectElement(this.activeAnchor),this.base.delay(function(){if(n){var e={value:n.attributes.href.value,target:n.getAttribute("target"),buttonClass:n.getAttribute("class")};t.showForm(e),n=null}}.bind(this))),this.hidePreview()},handleAnchorMouseout:function(){this.anchorToPreview=null,this.off(this.activeAnchor,"mouseout",this.instanceHandleAnchorMouseout),this.instanceHandleAnchorMouseout=null},handleEditableMouseover:function(t){var n=e.util.getClosestTag(t.target,"a");if(!1!==n){if(!this.showOnEmptyLinks&&(!/href=["']\S+["']/.test(n.outerHTML)||/href=["']#\S+["']/.test(n.outerHTML)))return!0;var i=this.base.getExtensionByName("toolbar");if(!this.showWhenToolbarIsVisible&&i&&i.isDisplayed&&i.isDisplayed())return!0;this.activeAnchor&&this.activeAnchor!==n&&this.detachPreviewHandlers(),this.anchorToPreview=n,this.instanceHandleAnchorMouseout=this.handleAnchorMouseout.bind(this),this.on(this.anchorToPreview,"mouseout",this.instanceHandleAnchorMouseout),this.base.delay(function(){this.anchorToPreview&&this.showPreview(this.anchorToPreview)}.bind(this))}},handlePreviewMouseover:function(){this.lastOver=(new Date).getTime(),this.hovering=!0},handlePreviewMouseout:function(e){e.relatedTarget&&/anchor-preview/.test(e.relatedTarget.className)||(this.hovering=!1)},updatePreview:function(){if(this.hovering)return!0;(new Date).getTime()-this.lastOver>this.hideDelay&&this.detachPreviewHandlers()},detachPreviewHandlers:function(){clearInterval(this.intervalTimer),this.instanceHandlePreviewMouseover&&(this.off(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.activeAnchor&&(this.off(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.off(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout))),this.hidePreview(),this.hovering=this.instanceHandlePreviewMouseover=this.instanceHandlePreviewMouseout=null},attachPreviewHandlers:function(){this.lastOver=(new Date).getTime(),this.hovering=!0,this.instanceHandlePreviewMouseover=this.handlePreviewMouseover.bind(this),this.instanceHandlePreviewMouseout=this.handlePreviewMouseout.bind(this),this.intervalTimer=setInterval(this.updatePreview.bind(this),200),this.on(this.anchorPreview,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.anchorPreview,"mouseout",this.instanceHandlePreviewMouseout),this.on(this.activeAnchor,"mouseover",this.instanceHandlePreviewMouseover),this.on(this.activeAnchor,"mouseout",this.instanceHandlePreviewMouseout)}}),e.extensions.anchorPreview=r,function(){var t,n,i,o,r;function a(t){return!e.util.getClosestTag(t,"a")}t=[" ","\t","\n","\r"," "," "," "," "," ","\u2028","\u2029"],i="(((?:(https?://|ftps?://|nntp://)|www\\d{0,3}[.]|[a-z0-9.\\-]+[.]("+(n="com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw")+")\\/)\\S+(?:[^\\s`!\\[\\]{};:'\".,?«»“”‘’])))|(([a-z0-9\\-]+\\.)?[a-z0-9\\-]+\\.("+n+"))",o=new RegExp("^("+n+")$","i"),r=new RegExp(i,"gi");var s=e.Extension.extend({init:function(){e.Extension.prototype.init.apply(this,arguments),this.disableEventHandling=!1,this.subscribe("editableKeypress",this.onKeypress.bind(this)),this.subscribe("editableBlur",this.onBlur.bind(this)),this.document.execCommand("AutoUrlDetect",!1,!1)},isLastInstance:function(){for(var e=0,t=0;t<this.window._mediumEditors.length;t++){var n=this.window._mediumEditors[t];null!==n&&void 0!==n.getExtensionByName("autoLink")&&e++}return 1===e},destroy:function(){this.document.queryCommandSupported("AutoUrlDetect")&&this.isLastInstance()&&this.document.execCommand("AutoUrlDetect",!1,!0)},onBlur:function(e,t){this.performLinking(t)},onKeypress:function(t){this.disableEventHandling||e.util.isKey(t,[e.util.keyCode.SPACE,e.util.keyCode.ENTER])&&(clearTimeout(this.performLinkingTimeout),this.performLinkingTimeout=setTimeout(function(){try{var e=this.base.exportSelection();this.performLinking(t.target)&&this.base.importSelection(e,!0)}catch(e){window.console&&window.console.error("Failed to perform linking",e),this.disableEventHandling=!0}}.bind(this),0))},performLinking:function(t){var n=e.util.splitByBlockElements(t),i=!1;0===n.length&&(n=[t]);for(var o=0;o<n.length;o++)i=this.removeObsoleteAutoLinkSpans(n[o])||i,i=this.performLinkingWithinElement(n[o])||i;return this.base.events.updateInput(t,{target:t,currentTarget:t}),i},removeObsoleteAutoLinkSpans:function(t){if(!t||3===t.nodeType)return!1;for(var n=t.querySelectorAll('span[data-auto-link="true"]'),i=!1,o=0;o<n.length;o++){var r=n[o].textContent;if(-1===r.indexOf("://")&&(r=e.util.ensureUrlHasProtocol(r)),n[o].getAttribute("data-href")!==r&&a(n[o])){i=!0;var s=r.replace(/\s+$/,"");if(n[o].getAttribute("data-href")===s){var l=r.length-s.length,u=e.util.splitOffDOMTree(n[o],this.splitTextBeforeEnd(n[o],l));n[o].parentNode.insertBefore(u,n[o].nextSibling)}else e.util.unwrap(n[o],this.document)}}return i},splitTextBeforeEnd:function(e,t){for(var n,i,o,r=this.document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),a=!0;a;)a=null!==r.lastChild();for(;t>0&&null!==o;)(i=(n=r.currentNode).nodeValue).length>t?(o=n.splitText(i.length-t),t=0):(o=r.previousNode(),t-=i.length);return o},performLinkingWithinElement:function(t){for(var n=this.findLinkableText(t),i=0;i<n.length;i++){var o=e.util.findOrCreateMatchingTextNodes(this.document,t,n[i]);this.shouldNotLink(o)||this.createAutoLink(o,n[i].href)}return!1},shouldNotLink:function(t){for(var n=!1,i=0;i<t.length&&!1===n;i++)n=!!e.util.traverseUp(t[i],(function(e){return"a"===e.nodeName.toLowerCase()||e.getAttribute&&"true"===e.getAttribute("data-auto-link")}));return n},findLinkableText:function(e){for(var n=e.textContent,i=null,a=[];null!==(i=r.exec(n));){var s=i.index+i[0].length;!(0!==i.index&&-1===t.indexOf(n[i.index-1])||s!==n.length&&-1===t.indexOf(n[s]))&&(-1!==i[0].indexOf("/")||o.test(i[0].split(".").pop().split("?").shift()))&&a.push({href:i[0],start:i.index,end:s})}return a},createAutoLink:function(t,n){n=e.util.ensureUrlHasProtocol(n);var i=e.util.createLink(this.document,t,n,this.getEditorOption("targetBlank")?"_blank":null),o=this.document.createElement("span");for(o.setAttribute("data-auto-link","true"),o.setAttribute("data-href",n),i.insertBefore(o,i.firstChild);i.childNodes.length>1;)o.appendChild(i.childNodes[1])}});e.extensions.autoLink=s}(),function(){var t="medium-editor-dragover";function n(n){var i=e.util.getContainerEditorElement(n);Array.prototype.slice.call(i.parentElement.querySelectorAll("."+t)).forEach((function(e){e.classList.remove(t)}))}var i=e.Extension.extend({name:"fileDragging",allowedTypes:["image"],init:function(){e.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(e){e.preventDefault(),e.dataTransfer.dropEffect="copy";var i=e.target.classList?e.target:e.target.parentElement;n(i),"dragover"===e.type&&i.classList.add(t)},handleDrop:function(e){e.preventDefault(),e.stopPropagation(),this.base.selectElement(e.target);var t=this.base.exportSelection();t.start=t.end,this.base.importSelection(t),e.dataTransfer.files&&Array.prototype.slice.call(e.dataTransfer.files).forEach((function(e){this.isAllowedFile(e)&&e.type.match("image")&&this.insertImageFile(e)}),this),n(e.target)},isAllowedFile:function(e){return this.allowedTypes.some((function(t){return!!e.type.match(t)}))},insertImageFile:function(t){if("function"==typeof FileReader){var n=new FileReader;n.readAsDataURL(t),n.addEventListener("load",function(t){var n=this.document.createElement("img");n.src=t.target.result,e.util.insertHTMLCommand(this.document,n.outerHTML)}.bind(this))}}});e.extensions.fileDragging=i}(),a=e.Extension.extend({name:"keyboard-commands",commands:[{command:"bold",key:"B",meta:!0,shift:!1,alt:!1},{command:"italic",key:"I",meta:!0,shift:!1,alt:!1},{command:"underline",key:"U",meta:!0,shift:!1,alt:!1}],init:function(){e.Extension.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.keys={},this.commands.forEach((function(e){var t=e.key.charCodeAt(0);this.keys[t]||(this.keys[t]=[]),this.keys[t].push(e)}),this)},handleKeydown:function(t){var n=e.util.getKeyCode(t);if(this.keys[n]){var i=e.util.isMetaCtrlKey(t),o=!!t.shiftKey,r=!!t.altKey;this.keys[n].forEach((function(e){e.meta!==i||e.shift!==o||e.alt!==r&&void 0!==e.alt||(t.preventDefault(),t.stopPropagation(),"function"==typeof e.command?e.command.apply(this):!1!==e.command&&this.execAction(e.command))}),this)}}}),e.extensions.keyboardCommands=a,s=e.extensions.form.extend({name:"fontname",action:"fontName",aria:"change font name",contentDefault:"±",contentFA:'<i class="fa fa-font"></i>',fonts:["","Arial","Verdana","Times New Roman"],init:function(){e.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(e){if(e.preventDefault(),e.stopPropagation(),!this.isDisplayed()){var t=this.document.queryCommandValue("fontName")+"";this.showForm(t)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getSelect().value=""},showForm:function(e){var t=this.getSelect();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),t.value=e||"",t.focus()},destroy:function(){if(!this.form)return!1;this.form.parentNode&&this.form.parentNode.removeChild(this.form),delete this.form},doFormSave:function(){this.base.restoreSelection(),this.base.checkSelection()},doFormCancel:function(){this.base.restoreSelection(),this.clearFontName(),this.base.checkSelection()},createForm:function(){var e,t=this.document,n=t.createElement("div"),i=t.createElement("select"),o=t.createElement("a"),r=t.createElement("a");n.className="medium-editor-toolbar-form",n.id="medium-editor-toolbar-form-fontname-"+this.getEditorId(),this.on(n,"click",this.handleFormClick.bind(this));for(var a=0;a<this.fonts.length;a++)(e=t.createElement("option")).innerHTML=this.fonts[a],e.value=this.fonts[a],i.appendChild(e);return i.className="medium-editor-toolbar-select",n.appendChild(i),this.on(i,"change",this.handleFontChange.bind(this)),r.setAttribute("href","#"),r.className="medium-editor-toobar-save",r.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"✓",n.appendChild(r),this.on(r,"click",this.handleSaveClick.bind(this),!0),o.setAttribute("href","#"),o.className="medium-editor-toobar-close",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"×",n.appendChild(o),this.on(o,"click",this.handleCloseClick.bind(this)),n},getSelect:function(){return this.getForm().querySelector("select.medium-editor-toolbar-select")},clearFontName:function(){e.selection.getSelectedElements(this.document).forEach((function(e){"font"===e.nodeName.toLowerCase()&&e.hasAttribute("face")&&e.removeAttribute("face")}))},handleFontChange:function(){var e=this.getSelect().value;""===e?this.clearFontName():this.execAction("fontName",{value:e})},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),e.extensions.fontName=s,l=e.extensions.form.extend({name:"fontsize",action:"fontSize",aria:"increase/decrease font size",contentDefault:"±",contentFA:'<i class="fa fa-text-height"></i>',init:function(){e.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(e){if(e.preventDefault(),e.stopPropagation(),!this.isDisplayed()){var t=this.document.queryCommandValue("fontSize")+"";this.showForm(t)}return!1},getForm:function(){return this.form||(this.form=this.createForm()),this.form},isDisplayed:function(){return"block"===this.getForm().style.display},hideForm:function(){this.getForm().style.display="none",this.getInput().value=""},showForm:function(e){var t=this.getInput();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),t.value=e||"",t.focus()},destroy:function(){if(!this.form)return!1;this.form.parentNode&&this.form.parentNode.removeChild(this.form),delete this.form},doFormSave:function(){this.base.restoreSelection(),this.base.checkSelection()},doFormCancel:function(){this.base.restoreSelection(),this.clearFontSize(),this.base.checkSelection()},createForm:function(){var e=this.document,t=e.createElement("div"),n=e.createElement("input"),i=e.createElement("a"),o=e.createElement("a");return t.className="medium-editor-toolbar-form",t.id="medium-editor-toolbar-form-fontsize-"+this.getEditorId(),this.on(t,"click",this.handleFormClick.bind(this)),n.setAttribute("type","range"),n.setAttribute("min","1"),n.setAttribute("max","7"),n.className="medium-editor-toolbar-input",t.appendChild(n),this.on(n,"change",this.handleSliderChange.bind(this)),o.setAttribute("href","#"),o.className="medium-editor-toobar-save",o.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':"✓",t.appendChild(o),this.on(o,"click",this.handleSaveClick.bind(this),!0),i.setAttribute("href","#"),i.className="medium-editor-toobar-close",i.innerHTML="fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':"×",t.appendChild(i),this.on(i,"click",this.handleCloseClick.bind(this)),t},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},clearFontSize:function(){e.selection.getSelectedElements(this.document).forEach((function(e){"font"===e.nodeName.toLowerCase()&&e.hasAttribute("size")&&e.removeAttribute("size")}))},handleSliderChange:function(){var e=this.getInput().value;"4"===e?this.clearFontSize():this.execAction("fontSize",{value:e})},handleFormClick:function(e){e.stopPropagation()},handleSaveClick:function(e){e.preventDefault(),this.doFormSave()},handleCloseClick:function(e){e.preventDefault(),this.doFormCancel()}}),e.extensions.fontSize=l,function(){var t="%ME_PASTEBIN%",n=null,i=null,o=function(e){e.stopPropagation()};function r(e,t,n){var i=e.clipboardData||t.clipboardData||n.dataTransfer,o={};if(!i)return o;if(i.getData){var r=i.getData("Text");r&&r.length>0&&(o["text/plain"]=r)}if(i.types)for(var a=0;a<i.types.length;a++){var s=i.types[a];o[s]=i.getData(s)}return o}var a=e.Extension.extend({forcePlainText:!0,cleanPastedHTML:!1,preCleanReplacements:[],cleanReplacements:[],cleanAttrs:["class","style","dir"],cleanTags:["meta"],unwrapTags:[],init:function(){e.Extension.prototype.init.apply(this,arguments),(this.forcePlainText||this.cleanPastedHTML)&&(this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.getEditorElements().forEach((function(e){this.on(e,"paste",this.handlePaste.bind(this))}),this),this.subscribe("addElement",this.handleAddElement.bind(this)))},handleAddElement:function(e,t){this.on(t,"paste",this.handlePaste.bind(this))},destroy:function(){(this.forcePlainText||this.cleanPastedHTML)&&this.removePasteBin()},handlePaste:function(e,t){if(!e.defaultPrevented){var n=r(e,this.window,this.document),i=n["text/html"],o=n["text/plain"];this.window.clipboardData&&void 0===e.clipboardData&&!i&&(i=o),(i||o)&&(e.preventDefault(),this.doPaste(i,o,t))}},doPaste:function(t,n,i){var o,r,a="";if(this.cleanPastedHTML&&t)return this.cleanPaste(t);if(n){if(this.getEditorOption("disableReturn")||i&&i.getAttribute("data-disable-return"))a=e.util.htmlEntities(n);else if((o=n.split(/[\r\n]+/g)).length>1)for(r=0;r<o.length;r+=1)""!==o[r]&&(a+="<p>"+e.util.htmlEntities(o[r])+"</p>");else a=e.util.htmlEntities(o[0]);e.util.insertHTMLCommand(this.document,a)}},handlePasteBinPaste:function(e){if(e.defaultPrevented)this.removePasteBin();else{var t=r(e,this.window,this.document),n=t["text/html"],o=t["text/plain"],a=i;if(!this.cleanPastedHTML||n)return e.preventDefault(),this.removePasteBin(),this.doPaste(n,o,a),void this.trigger("editablePaste",{currentTarget:a,target:a},a);setTimeout(function(){this.cleanPastedHTML&&(n=this.getPasteBinHtml()),this.removePasteBin(),this.doPaste(n,o,a),this.trigger("editablePaste",{currentTarget:a,target:a},a)}.bind(this),0)}},handleKeydown:function(t,n){e.util.isKey(t,e.util.keyCode.V)&&e.util.isMetaCtrlKey(t)&&(t.stopImmediatePropagation(),this.removePasteBin(),this.createPasteBin(n))},createPasteBin:function(r){var a,s=e.selection.getSelectionRange(this.document),l=this.window.pageYOffset;i=r,s&&((a=s.getClientRects()).length?l+=a[0].top:void 0!==s.startContainer.getBoundingClientRect?l+=s.startContainer.getBoundingClientRect().top:l+=s.getBoundingClientRect().top),n=s;var u=this.document.createElement("div");u.id=this.pasteBinId="medium-editor-pastebin-"+ +Date.now(),u.setAttribute("style","border: 1px red solid; position: absolute; top: "+l+"px; width: 10px; height: 10px; overflow: hidden; opacity: 0"),u.setAttribute("contentEditable",!0),u.innerHTML=t,this.document.body.appendChild(u),this.on(u,"focus",o),this.on(u,"focusin",o),this.on(u,"focusout",o),u.focus(),e.selection.selectNode(u,this.document),this.boundHandlePaste||(this.boundHandlePaste=this.handlePasteBinPaste.bind(this)),this.on(u,"paste",this.boundHandlePaste)},removePasteBin:function(){null!==n&&(e.selection.selectRange(this.document,n),n=null),null!==i&&(i=null);var t=this.getPasteBin();t&&t&&(this.off(t,"focus",o),this.off(t,"focusin",o),this.off(t,"focusout",o),this.off(t,"paste",this.boundHandlePaste),t.parentElement.removeChild(t))},getPasteBin:function(){return this.document.getElementById(this.pasteBinId)},getPasteBinHtml:function(){var e=this.getPasteBin();if(!e)return!1;if(e.firstChild&&"mcepastebin"===e.firstChild.id)return!1;var n=e.innerHTML;return!(!n||n===t)&&n},cleanPaste:function(e){var t,n,i,o,r=/<p|<br|<div/.test(e),a=[].concat(this.preCleanReplacements||[],[[new RegExp(/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g),""],[new RegExp(/<!--StartFragment-->|<!--EndFragment-->/g),""],[new RegExp(/<br>$/i),""],[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi),""],[new RegExp(/<\/b>(<br[^>]*>)?$/gi),""],[new RegExp(/<span class="Apple-converted-space">\s+<\/span>/g)," "],[new RegExp(/<br class="Apple-interchange-newline">/g),"<br>"],[new RegExp(/<span[^>]*(font-style:italic;font-weight:(bold|700)|font-weight:(bold|700);font-style:italic)[^>]*>/gi),'<span class="replace-with italic bold">'],[new RegExp(/<span[^>]*font-style:italic[^>]*>/gi),'<span class="replace-with italic">'],[new RegExp(/<span[^>]*font-weight:(bold|700)[^>]*>/gi),'<span class="replace-with bold">'],[new RegExp(/<(\/?)(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(!r)return this.pasteHTML(e);for((i=this.document.createElement("div")).innerHTML="<p>"+e.split("<br><br>").join("</p><p>")+"</p>",n=i.querySelectorAll("a,p,div,br"),t=0;t<n.length;t+=1)switch((o=n[t]).innerHTML=o.innerHTML.replace(/\n/gi," "),o.nodeName.toLowerCase()){case"p":case"div":this.filterCommonBlocks(o);break;case"br":this.filterLineBreak(o)}this.pasteHTML(i.innerHTML)},pasteHTML:function(t,n){n=e.util.defaults({},n,{cleanAttrs:this.cleanAttrs,cleanTags:this.cleanTags,unwrapTags:this.unwrapTags});var i,o,r,a,s=this.document.createDocumentFragment();for(s.appendChild(this.document.createElement("body")),(a=s.querySelector("body")).innerHTML=t,this.cleanupSpans(a),i=a.querySelectorAll("*"),r=0;r<i.length;r+=1)"a"===(o=i[r]).nodeName.toLowerCase()&&this.getEditorOption("targetBlank")&&e.util.setTargetBlank(o),e.util.cleanupAttrs(o,n.cleanAttrs),e.util.cleanupTags(o,n.cleanTags),e.util.unwrapTags(o,n.unwrapTags);e.util.insertHTMLCommand(this.document,a.innerHTML.replace(/ /g," "))},isCommonBlock:function(e){return e&&("p"===e.nodeName.toLowerCase()||"div"===e.nodeName.toLowerCase())},filterCommonBlocks:function(e){/^\s*$/.test(e.textContent)&&e.parentNode&&e.parentNode.removeChild(e)},filterLineBreak:function(e){this.isCommonBlock(e.previousElementSibling)?this.removeWithParent(e):!this.isCommonBlock(e.parentNode)||e.parentNode.firstChild!==e&&e.parentNode.lastChild!==e?e.parentNode&&1===e.parentNode.childElementCount&&""===e.parentNode.textContent&&this.removeWithParent(e):this.removeWithParent(e)},removeWithParent:function(e){e&&e.parentNode&&(e.parentNode.parentNode&&1===e.parentNode.childElementCount?e.parentNode.parentNode.removeChild(e.parentNode):e.parentNode.removeChild(e))},cleanupSpans:function(t){var n,i,o,r=t.querySelectorAll(".replace-with"),a=function(e){return e&&"#text"!==e.nodeName&&"false"===e.getAttribute("contenteditable")};for(n=0;n<r.length;n+=1)i=r[n],o=this.document.createElement(i.classList.contains("bold")?"b":"i"),i.classList.contains("bold")&&i.classList.contains("italic")?o.innerHTML="<i>"+i.innerHTML+"</i>":o.innerHTML=i.innerHTML,i.parentNode.replaceChild(o,i);for(r=t.querySelectorAll("span"),n=0;n<r.length;n+=1){if(i=r[n],e.util.traverseUp(i,a))return!1;e.util.unwrap(i,this.document)}}});e.extensions.paste=a}(),u=e.Extension.extend({name:"placeholder",text:"Type your text",hideOnClick:!0,init:function(){e.Extension.prototype.init.apply(this,arguments),this.initPlaceholders(),this.attachEventHandlers()},initPlaceholders:function(){this.getEditorElements().forEach(this.initElement,this)},handleAddElement:function(e,t){this.initElement(t)},initElement:function(e){e.getAttribute("data-placeholder")||e.setAttribute("data-placeholder",this.text),this.updatePlaceholder(e)},destroy:function(){this.getEditorElements().forEach(this.cleanupElement,this)},handleRemoveElement:function(e,t){this.cleanupElement(t)},cleanupElement:function(e){e.getAttribute("data-placeholder")===this.text&&e.removeAttribute("data-placeholder")},showPlaceholder:function(t){t&&(e.util.isFF&&0===t.childNodes.length?(t.classList.add("medium-editor-placeholder-relative"),t.classList.remove("medium-editor-placeholder")):(t.classList.add("medium-editor-placeholder"),t.classList.remove("medium-editor-placeholder-relative")))},hidePlaceholder:function(e){e&&(e.classList.remove("medium-editor-placeholder"),e.classList.remove("medium-editor-placeholder-relative"))},updatePlaceholder:function(e,t){if(e.querySelector("img, blockquote, ul, ol, table")||""!==e.textContent.replace(/^\s+|\s+$/g,""))return this.hidePlaceholder(e);t||this.showPlaceholder(e)},attachEventHandlers:function(){this.hideOnClick&&this.subscribe("focus",this.handleFocus.bind(this)),this.subscribe("editableInput",this.handleInput.bind(this)),this.subscribe("blur",this.handleBlur.bind(this)),this.subscribe("addElement",this.handleAddElement.bind(this)),this.subscribe("removeElement",this.handleRemoveElement.bind(this))},handleInput:function(e,t){var n=this.hideOnClick&&t===this.base.getFocusedElement();this.updatePlaceholder(t,n)},handleFocus:function(e,t){this.hidePlaceholder(t)},handleBlur:function(e,t){this.updatePlaceholder(t)}}),e.extensions.placeholder=u,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,o,r,a,s=this.document.createElement("ul");return s.id="medium-editor-toolbar-actions"+this.getEditorId(),s.className="medium-editor-toolbar-actions",s.style.display="block",this.buttons.forEach((function(i){"string"==typeof i?(r=i,a=null):(r=i.name,a=i),(o=this.base.addBuiltInExtension(r,a))&&"function"==typeof o.getButton&&(n=o.getButton(this.base),t=this.document.createElement("li"),e.util.isElement(n)?t.appendChild(n):t.innerHTML=n,s.appendChild(t))}),this),(i=s.querySelectorAll("button")).length>0&&(i[0].classList.add(this.firstButtonClass),i[i.length-1].classList.add(this.lastButtonClass)),s},destroy:function(){this.toolbar&&(this.toolbar.parentNode&&this.toolbar.parentNode.removeChild(this.toolbar),delete this.toolbar)},getInteractionElements:function(){return this.getToolbarElement()},getToolbarElement:function(){return this.toolbar||(this.toolbar=this.createToolbar()),this.toolbar},getToolbarActionsElement:function(){return this.getToolbarElement().querySelector(".medium-editor-toolbar-actions")},initThrottledMethods:function(){this.throttledPositionToolbar=e.util.throttle(function(){this.base.isActive&&this.positionToolbarIfShown()}.bind(this))},attachEventHandlers:function(){this.subscribe("blur",this.handleBlur.bind(this)),this.subscribe("focus",this.handleFocus.bind(this)),this.subscribe("editableClick",this.handleEditableClick.bind(this)),this.subscribe("editableKeyup",this.handleEditableKeyup.bind(this)),this.on(this.document.documentElement,"mouseup",this.handleDocumentMouseup.bind(this)),this.static&&this.sticky&&this.on(this.window,"scroll",this.handleWindowScroll.bind(this),!0),this.on(this.window,"resize",this.handleWindowResize.bind(this))},handleWindowScroll:function(){this.positionToolbarIfShown()},handleWindowResize:function(){this.throttledPositionToolbar()},handleDocumentMouseup:function(t){if(t&&t.target&&e.util.isDescendant(this.getToolbarElement(),t.target))return!1;this.checkState()},handleEditableClick:function(){setTimeout(function(){this.checkState()}.bind(this),0)},handleEditableKeyup:function(){this.checkState()},handleBlur:function(){clearTimeout(this.hideTimeout),clearTimeout(this.delayShowTimeout),this.hideTimeout=setTimeout(function(){this.hideToolbar()}.bind(this),1)},handleFocus:function(){this.checkState()},isDisplayed:function(){return this.getToolbarElement().classList.contains("medium-editor-toolbar-active")},showToolbar:function(){clearTimeout(this.hideTimeout),this.isDisplayed()||(this.getToolbarElement().classList.add("medium-editor-toolbar-active"),this.trigger("showToolbar",{},this.base.getFocusedElement()))},hideToolbar:function(){this.isDisplayed()&&(this.getToolbarElement().classList.remove("medium-editor-toolbar-active"),this.trigger("hideToolbar",{},this.base.getFocusedElement()))},isToolbarDefaultActionsDisplayed:function(){return"block"===this.getToolbarActionsElement().style.display},hideToolbarDefaultActions:function(){this.isToolbarDefaultActionsDisplayed()&&(this.getToolbarActionsElement().style.display="none")},showToolbarDefaultActions:function(){this.hideExtensionForms(),this.isToolbarDefaultActionsDisplayed()||(this.getToolbarActionsElement().style.display="block"),this.delayShowTimeout=this.base.delay(function(){this.showToolbar()}.bind(this))},hideExtensionForms:function(){this.forEachExtension((function(e){e.hasForm&&e.isDisplayed()&&e.hideForm()}))},multipleBlockElementsSelected:function(){var t=new RegExp("<("+e.util.blockContainerElementNames.join("|")+")[^>]*>","g"),n=e.selection.getSelectionHtml(this.document).replace(/<[^\/>][^>]*><\/[^>]+>/gim,"").match(t);return!!n&&n.length>1},modifySelection:function(){var t=this.window.getSelection().getRangeAt(0);if(this.standardizeSelectionStart&&t.startContainer.nodeValue&&t.startOffset===t.startContainer.nodeValue.length){var n=e.util.findAdjacentTextNodeWithContent(e.selection.getSelectionElement(this.window),t.startContainer,this.document);if(n){for(var i=0;0===n.nodeValue.substr(i,1).trim().length;)i+=1;t=e.selection.select(this.document,n,i,t.endContainer,t.endOffset)}}},checkState:function(){if(!this.base.preventSelectionUpdates){if(!this.base.getFocusedElement()||e.selection.selectionInContentEditableFalse(this.window))return this.hideToolbar();var t=e.selection.getSelectionElement(this.window);return!t||-1===this.getEditorElements().indexOf(t)||t.getAttribute("data-disable-toolbar")?this.hideToolbar():this.updateOnEmptySelection&&this.static?this.showAndUpdateToolbar():!e.selection.selectionContainsContent(this.document)||!1===this.allowMultiParagraphSelection&&this.multipleBlockElementsSelected()?this.hideToolbar():void this.showAndUpdateToolbar()}},showAndUpdateToolbar:function(){this.modifySelection(),this.setToolbarButtonStates(),this.trigger("positionToolbar",{},this.base.getFocusedElement()),this.showToolbarDefaultActions(),this.setToolbarPosition()},setToolbarButtonStates:function(){this.forEachExtension((function(e){"function"==typeof e.isActive&&"function"==typeof e.setInactive&&e.setInactive()})),this.checkActiveButtons()},checkActiveButtons:function(){var t,n=[],i=null,o=e.selection.getSelectionRange(this.document),r=function(e){"function"==typeof e.checkState?e.checkState(t):"function"==typeof e.isActive&&"function"==typeof e.isAlreadyApplied&&"function"==typeof e.setActive&&!e.isActive()&&e.isAlreadyApplied(t)&&e.setActive()};if(o&&(this.forEachExtension((function(e){"function"!=typeof e.queryCommandState||null===(i=e.queryCommandState())?n.push(e):i&&"function"==typeof e.setActive&&e.setActive()})),t=e.selection.getSelectedParentElement(o),this.getEditorElements().some((function(n){return e.util.isDescendant(n,t,!0)}))))for(;t&&(n.forEach(r),!e.util.isMediumEditorElement(t));)t=t.parentNode},positionToolbarIfShown:function(){this.isDisplayed()&&this.setToolbarPosition()},setToolbarPosition:function(){var e=this.base.getFocusedElement(),t=this.window.getSelection();if(!e)return this;!this.static&&t.isCollapsed||(this.showToolbar(),this.relativeContainer||(this.static?this.positionStaticToolbar(e):this.positionToolbar(t)),this.trigger("positionedToolbar",{},this.base.getFocusedElement()))},positionStaticToolbar:function(e){this.getToolbarElement().style.left="0";var t,n=this.document.documentElement&&this.document.documentElement.scrollTop||this.document.body.scrollTop,i=this.window.innerWidth,o=this.getToolbarElement(),r=e.getBoundingClientRect(),a=r.top+n,s=r.left+r.width/2,l=o.offsetHeight,u=o.offsetWidth,d=u/2;switch(this.sticky?n>a+e.offsetHeight-l-this.stickyTopOffset?(o.style.top=a+e.offsetHeight-l+"px",o.classList.remove("medium-editor-sticky-toolbar")):n>a-l-this.stickyTopOffset?(o.classList.add("medium-editor-sticky-toolbar"),o.style.top=this.stickyTopOffset+"px"):(o.classList.remove("medium-editor-sticky-toolbar"),o.style.top=a-l+"px"):o.style.top=a-l+"px",this.align){case"left":t=r.left;break;case"right":t=r.right-u;break;case"center":t=s-d}t<0?t=0:t+u>i&&(t=i-Math.ceil(u)-1),o.style.left=t+"px"},positionToolbar:function(e){this.getToolbarElement().style.left="0",this.getToolbarElement().style.right="initial";var t=e.getRangeAt(0),n=t.getBoundingClientRect();(!n||0===n.height&&0===n.width&&t.startContainer===t.endContainer)&&(n=1===t.startContainer.nodeType&&t.startContainer.querySelector("img")?t.startContainer.querySelector("img").getBoundingClientRect():t.startContainer.getBoundingClientRect());var i,o,r=this.window.innerWidth,a=this.getToolbarElement(),s=a.offsetHeight,l=a.offsetWidth/2,u=this.diffLeft-l,d=this.getEditorOption("elementsContainer"),c=["absolute","fixed"].indexOf(window.getComputedStyle(d).getPropertyValue("position"))>-1,h={},f={};c?(o=d.getBoundingClientRect(),["top","left"].forEach((function(e){f[e]=n[e]-o[e]})),f.width=n.width,f.height=n.height,n=f,r=o.width,h.top=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"):r-i<l?(h.left="auto",h.right=0):(h.left=u+i,h.right="initial"),["top","left","right"].forEach((function(e){a.style[e]=h[e]+(isNaN(h[e])?"":"px")}))}}),e.extensions.toolbar=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,o=e.selection.getCaretOffsets(n);(void 0===i[o.left-1]||""===i[o.left-1].trim()||void 0!==i[o.left]&&""===i[o.left].trim())&&t.preventDefault()}function n(t,n){if(this.options.disableReturn||n.getAttribute("data-disable-return"))t.preventDefault();else if(this.options.disableDoubleReturn||n.getAttribute("data-disable-double-return")){var i=e.selection.getSelectionStart(this.options.ownerDocument);(i&&""===i.textContent.trim()&&"li"!==i.nodeName.toLowerCase()||i.previousElementSibling&&"br"!==i.previousElementSibling.nodeName.toLowerCase()&&""===i.previousElementSibling.textContent.trim())&&t.preventDefault()}}function i(t){var n=e.selection.getSelectionStart(this.options.ownerDocument);"pre"===(n&&n.nodeName.toLowerCase())&&(t.preventDefault(),e.util.insertHTMLCommand(this.options.ownerDocument," ")),e.util.isListItem(n)&&(t.preventDefault(),t.shiftKey?this.options.ownerDocument.execCommand("outdent",!1,null):this.options.ownerDocument.execCommand("indent",!1,null))}function o(t){var n,i=e.selection.getSelectionStart(this.options.ownerDocument),o=i.nodeName.toLowerCase(),r=/^(\s+|<br\/?>)?$/i,a=/h\d/i;e.util.isKey(t,[e.util.keyCode.BACKSPACE,e.util.keyCode.ENTER])&&i.previousElementSibling&&a.test(o)&&0===e.selection.getCaretOffsets(i).left?e.util.isKey(t,e.util.keyCode.BACKSPACE)&&r.test(i.previousElementSibling.innerHTML)?(i.previousElementSibling.parentNode.removeChild(i.previousElementSibling),t.preventDefault()):!this.options.disableDoubleReturn&&e.util.isKey(t,e.util.keyCode.ENTER)&&((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.previousElementSibling.parentNode.insertBefore(n,i),t.preventDefault()):e.util.isKey(t,e.util.keyCode.DELETE)&&i.nextElementSibling&&i.previousElementSibling&&!a.test(o)&&r.test(i.innerHTML)&&a.test(i.nextElementSibling.nodeName.toLowerCase())?(e.selection.moveCursor(this.options.ownerDocument,i.nextElementSibling),i.previousElementSibling.parentNode.removeChild(i),t.preventDefault()):e.util.isKey(t,e.util.keyCode.BACKSPACE)&&"li"===o&&r.test(i.innerHTML)&&!i.previousElementSibling&&!i.parentElement.previousElementSibling&&i.nextElementSibling&&"li"===i.nextElementSibling.nodeName.toLowerCase()?((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.parentElement.parentElement.insertBefore(n,i.parentElement),e.selection.moveCursor(this.options.ownerDocument,n),i.parentElement.removeChild(i),t.preventDefault()):e.util.isKey(t,e.util.keyCode.BACKSPACE)&&!1!==e.util.getClosestTag(i,"blockquote")&&0===e.selection.getCaretOffsets(i).left?(t.preventDefault(),e.util.execFormatBlock(this.options.ownerDocument,"p")):e.util.isKey(t,e.util.keyCode.ENTER)&&!1!==e.util.getClosestTag(i,"blockquote")&&0===e.selection.getCaretOffsets(i).right?((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.parentElement.insertBefore(n,i.nextSibling),e.selection.moveCursor(this.options.ownerDocument,n),t.preventDefault()):e.util.isKey(t,e.util.keyCode.BACKSPACE)&&e.util.isMediumEditorElement(i.parentElement)&&!i.previousElementSibling&&i.nextElementSibling&&r.test(i.innerHTML)&&(t.preventDefault(),e.selection.moveCursor(this.options.ownerDocument,i.nextSibling),i.parentElement.removeChild(i))}function r(t){var n=e.selection.getSelectionStart(this.options.ownerDocument);n&&(e.util.isMediumEditorElement(n)&&0===n.children.length&&!e.util.isBlockContainer(n)&&this.options.ownerDocument.execCommand("formatBlock",!1,"p"),!e.util.isKey(t,e.util.keyCode.ENTER)||e.util.isListItem(n)||e.util.isBlockContainer(n)||("a"===n.nodeName.toLowerCase()?this.options.ownerDocument.execCommand("unlink",!1,null):t.shiftKey||t.ctrlKey||this.options.ownerDocument.execCommand("formatBlock",!1,"p")))}function a(e,t){var n=t.parentNode.querySelector('textarea[medium-editor-textarea-id="'+t.getAttribute("medium-editor-textarea-id")+'"]');n&&(n.value=t.innerHTML.trim())}function s(e){e._mediumEditors||(e._mediumEditors=[null]),this.id||(this.id=e._mediumEditors.length),e._mediumEditors[this.id]=this}function l(e){e._mediumEditors&&e._mediumEditors[this.id]&&(e._mediumEditors[this.id]=null)}function u(t,n,i){var o=[];if(t||(t=[]),"string"==typeof t&&(t=n.querySelectorAll(t)),e.util.isElement(t)&&(t=[t]),i)for(var r=0;r<t.length;r++){var a=t[r];!e.util.isElement(a)||a.getAttribute("data-medium-editor-element")||a.getAttribute("medium-editor-textarea-id")||o.push(a)}else o=Array.prototype.slice.apply(t);return o}function 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 f(){return!!h.call(this)&&!1!==this.options.anchorPreview}function p(){return!1!==this.options.placeholder}function g(){return!1!==this.options.autoLink}function v(){return!1!==this.options.imageDragging}function m(){return!1!==this.options.keyboardCommands}function y(){return!this.options.extensions.imageDragging}function b(e){for(var t=this.options.ownerDocument.createElement("div"),n=Date.now(),i="medium-editor-"+n,o=e.attributes;this.options.ownerDocument.getElementById(i);)n++,i="medium-editor-"+n;t.className=e.className,t.id=i,t.innerHTML=e.value,e.setAttribute("medium-editor-textarea-id",i);for(var r=0,a=o.length;r<a;r++)t.hasAttribute(o[r].nodeName)||t.setAttribute(o[r].nodeName,o[r].value);return e.form&&this.on(e.form,"reset",function(e){e.defaultPrevented||this.resetContent(this.options.ownerDocument.getElementById(i))}.bind(this)),e.classList.add("medium-editor-hidden"),e.parentNode.insertBefore(t,e),t}function x(t,i){if(!t.getAttribute("data-medium-editor-element")){"textarea"===t.nodeName.toLowerCase()&&(t=b.call(this,t),this.instanceHandleEditableInput||(this.instanceHandleEditableInput=a.bind(this),this.subscribe("editableInput",this.instanceHandleEditableInput))),this.options.disableEditing||t.getAttribute("data-disable-editing")||(t.setAttribute("contentEditable",!0),t.setAttribute("spellcheck",this.options.spellcheck)),this.instanceHandleEditableKeydownEnter||(t.getAttribute("data-disable-return")||t.getAttribute("data-disable-double-return"))&&(this.instanceHandleEditableKeydownEnter=n.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter)),this.options.disableReturn||t.getAttribute("data-disable-return")||this.on(t,"keyup",r.bind(this));var o=e.util.guid();t.setAttribute("data-medium-editor-element",!0),t.classList.add("medium-editor-element"),t.setAttribute("role","textbox"),t.setAttribute("aria-multiline",!0),t.setAttribute("data-medium-editor-editor-index",i),t.setAttribute("medium-editor-index",o),S[o]=t.innerHTML,this.events.attachAllEventsToElement(t)}return t}function w(){this.subscribe("editableKeydownTab",i.bind(this)),this.subscribe("editableKeydownDelete",o.bind(this)),this.subscribe("editableKeydownEnter",o.bind(this)),this.options.disableExtraSpaces&&this.subscribe("editableKeydownSpace",t.bind(this)),this.instanceHandleEditableKeydownEnter||(this.options.disableReturn||this.options.disableDoubleReturn)&&(this.instanceHandleEditableKeydownEnter=n.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter))}function E(){if(this.extensions=[],Object.keys(this.options.extensions).forEach((function(e){"toolbar"!==e&&this.options.extensions[e]&&this.extensions.push(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":f.call(this),autoLink:g.call(this),keyboardCommands:m.call(this),placeholder:p.call(this)};Object.keys(n).forEach((function(e){n[e]&&this.addBuiltInExtension(e)}),this);var i=this.options.extensions.toolbar;if(!i&&h.call(this)){var o=e.util.extend({},this.options.toolbar,{allowMultiParagraphSelection:this.options.allowMultiParagraphSelection});i=new e.extensions.toolbar(o)}i&&this.extensions.push(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,o;if(i=/^append-(.+)$/gi.exec(t))return e.util.execFormatBlock(this.options.ownerDocument,i[1]);if("fontSize"===t)return n.size&&e.util.deprecated(".size option for fontSize command",".value","6.0.0"),o=n.value||n.size,this.options.ownerDocument.execCommand("fontSize",!1,o);if("fontName"===t)return n.name&&e.util.deprecated(".name option for fontName command",".value","6.0.0"),o=n.value||n.name,this.options.ownerDocument.execCommand("fontName",!1,o);if("createLink"===t)return this.createLink(n);if("image"===t){var r=this.options.contentWindow.getSelection().toString().trim();return this.options.ownerDocument.execCommand("insertImage",!1,r)}if("html"===t){var a=this.options.contentWindow.getSelection().toString().trim();return e.util.insertHTMLCommand(this.options.ownerDocument,a)}if(/justify([A-Za-z]*)$/g.exec(t)){var s=this.options.ownerDocument.execCommand(t,!1,null),l=e.selection.getSelectedParentElement(e.selection.getSelectionRange(this.options.ownerDocument));return l&&_.call(this,e.util.getTopBlockContainer(l)),s}return o=n&&n.value,this.options.ownerDocument.execCommand(t,!1,o)}function _(t){if(t){var n,i=Array.prototype.slice.call(t.childNodes).filter((function(e){var t="div"===e.nodeName.toLowerCase();return t&&!n&&(n=e.style.textAlign),t}));i.length&&(this.saveSelection(),i.forEach((function(t){if(t.style.textAlign===n){var i=t.lastChild;if(i){e.util.unwrap(t,this.options.ownerDocument);var o=this.options.ownerDocument.createElement("BR");i.parentNode.insertBefore(o,i.nextSibling)}}}),this),t.style.textAlign=n,this.restoreSelection())}}var S={};e.prototype={init:function(e,t){return this.options=C.call(this,this.defaults,t),this.origElements=e,this.options.elementsContainer||(this.options.elementsContainer=this.options.ownerDocument.body),this.setup()},setup:function(){this.isActive||(s.call(this,this.options.contentWindow),this.events=new e.Events(this),this.elements=[],this.addElements(this.origElements),0!==this.elements.length&&(this.isActive=!0,E.call(this),w.call(this)))},destroy:function(){this.isActive&&(this.isActive=!1,this.extensions.forEach((function(e){"function"==typeof e.destroy&&e.destroy()}),this),this.events.destroy(),this.elements.forEach((function(e){this.options.spellcheck&&(e.innerHTML=e.innerHTML),e.removeAttribute("contentEditable"),e.removeAttribute("spellcheck"),e.removeAttribute("data-medium-editor-element"),e.classList.remove("medium-editor-element"),e.removeAttribute("role"),e.removeAttribute("aria-multiline"),e.removeAttribute("medium-editor-index"),e.removeAttribute("data-medium-editor-editor-index"),e.getAttribute("medium-editor-textarea-id")&&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,o=this.getExtensionByName(t);if(o)return o;switch(t){case"anchor":i=e.util.extend({},this.options.anchor,n),o=new e.extensions.anchor(i);break;case"anchor-preview":o=new e.extensions.anchorPreview(this.options.anchorPreview);break;case"autoLink":o=new e.extensions.autoLink;break;case"fileDragging":o=new e.extensions.fileDragging(n);break;case"fontname":o=new e.extensions.fontName(this.options.fontName);break;case"fontsize":o=new e.extensions.fontSize(n);break;case"keyboardCommands":o=new e.extensions.keyboardCommands(this.options.keyboardCommands);break;case"paste":o=new e.extensions.paste(this.options.paste);break;case"placeholder":o=new e.extensions.placeholder(this.options.placeholder);break;default:e.extensions.button.isBuiltInButton(t)&&(n?(i=e.util.defaults({},n,e.extensions.button.prototype.defaults[t]),o=new e.extensions.button(i)):o=new e.extensions.button(t))}return o&&this.extensions.push(c(o,t,this)),o},stopSelectionUpdates:function(){this.preventSelectionUpdates=!0},startSelectionUpdates:function(){this.preventSelectionUpdates=!1},checkSelection:function(){var e=this.getExtensionByName("toolbar");return e&&e.checkState(),this},queryCommandState:function(e){var t,n=null;(t=/^full-(.+)$/gi.exec(e))&&(e=t[1]);try{n=this.options.ownerDocument.queryCommandState(e)}catch(e){n=null}return n},execAction:function(t,n){var i,o;return(i=/^full-(.+)$/gi.exec(t))?(this.saveSelection(),this.selectAllContents(),o=N.call(this,i[1],n),this.restoreSelection()):o=N.call(this,t,n),"insertunorderedlist"!==t&&"insertorderedlist"!==t||e.util.cleanListDOM(this.options.ownerDocument,this.getSelectedParentElement()),this.checkSelection(),o},getSelectedParentElement:function(t){return void 0===t&&(t=this.options.contentWindow.getSelection().getRangeAt(0)),e.selection.getSelectedParentElement(t)},selectAllContents:function(){var t=e.selection.getSelectionElement(this.options.contentWindow);if(t){for(;1===t.children.length;)t=t.children[0];this.selectElement(t)}},selectElement:function(t){e.selection.selectNode(t,this.options.ownerDocument);var n=e.selection.getSelectionElement(this.options.contentWindow);n&&this.events.focusElement(n)},getFocusedElement:function(){var e;return this.elements.some((function(t){return!e&&t.getAttribute("data-medium-focused")&&(e=t),!!e}),this),e},exportSelection:function(){var t=e.selection.getSelectionElement(this.options.contentWindow),n=this.elements.indexOf(t),i=null;return n>=0&&(i=e.selection.exportSelection(t,this.options.ownerDocument)),null!==i&&0!==n&&(i.editableElementIndex=n),i},saveSelection:function(){this.selectionState=this.exportSelection()},importSelection:function(t,n){if(t){var i=this.elements[t.editableElementIndex||0];e.selection.importSelection(t,i,this.options.ownerDocument,n)}},restoreSelection:function(){this.importSelection(this.selectionState)},createLink:function(t){var n,i=e.selection.getSelectionElement(this.options.contentWindow),o={};if(-1!==this.elements.indexOf(i)){try{if(this.events.disableCustomEvent("editableInput"),t.url&&e.util.deprecated(".url option for createLink",".value","6.0.0"),(n=t.url||t.value)&&n.trim().length>0){var r=this.options.contentWindow.getSelection();if(r){var a,s,l,u,d=r.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,f=this.options.ownerDocument.createDocumentFragment();this.execAction("unlink"),a=this.exportSelection(),f.appendChild(h.cloneNode(!0)),i===h?e.selection.select(this.options.ownerDocument,h.firstChild,0,h.lastChild,3===h.lastChild.nodeType?h.lastChild.nodeValue.length:h.lastChild.childNodes.length):e.selection.select(this.options.ownerDocument,h,0,h,h.childNodes.length);var p=this.exportSelection();0===(u=e.util.findOrCreateMatchingTextNodes(this.options.ownerDocument,f,{start:a.start-p.start,end:a.end-p.start,editableElementIndex:a.editableElementIndex})).length&&((f=this.options.ownerDocument.createDocumentFragment()).appendChild(c.cloneNode(!0)),u=[f.firstChild.firstChild,f.firstChild.lastChild]),e.util.createLink(this.options.ownerDocument,u,n.trim());var g=(f.firstChild.innerHTML.match(/^\s+/)||[""])[0].length;e.util.insertHTMLCommand(this.options.ownerDocument,f.firstChild.innerHTML.replace(/^\s+/,"")),a.start-=g,a.end-=g,this.importSelection(a)}else this.options.ownerDocument.execCommand("createLink",!1,n);this.options.targetBlank||"_blank"===t.target?e.util.setTargetBlank(e.selection.getSelectionStart(this.options.ownerDocument),n):e.util.removeTargetBlank(e.selection.getSelectionStart(this.options.ownerDocument),n),t.buttonClass&&e.util.addClassToAnchors(e.selection.getSelectionStart(this.options.ownerDocument),t.buttonClass)}}if(this.options.targetBlank||"_blank"===t.target||t.buttonClass){(o=this.options.ownerDocument.createEvent("HTMLEvents")).initEvent("input",!0,!0,this.options.contentWindow);for(var v=0,m=this.elements.length;v<m;v+=1)this.elements[v].dispatchEvent(o)}}finally{this.events.enableCustomEvent("editableInput")}this.events.triggerCustomEvent("editableInput",o,i)}},cleanPaste:function(e){this.getExtensionByName("paste").cleanPaste(e)},pasteHTML:function(e,t){this.getExtensionByName("paste").pasteHTML(e,t)},setContent:function(e,t){if(t=t||0,this.elements[t]){var n=this.elements[t];n.innerHTML=e,this.checkContentChanged(n)}},getContent:function(e){return e=e||0,this.elements[e]?this.elements[e].innerHTML.trim():null},checkContentChanged:function(t){t=t||e.selection.getSelectionElement(this.options.contentWindow),this.events.updateInput(t,{target:t,currentTarget:t})},resetContent:function(e){if(e){var t=this.elements.indexOf(e);-1!==t&&this.setContent(S[e.getAttribute("medium-editor-index")],t)}else this.elements.forEach((function(e,t){this.setContent(S[e.getAttribute("medium-editor-index")],t)}),this)},addElements:function(e){var t=u(e,this.options.ownerDocument,!0);if(0===t.length)return!1;t.forEach((function(e){e=x.call(this,e,this.id),this.elements.push(e),this.trigger("addElement",{target:e,currentTarget:e},e)}),this)},removeElements:function(e){var t=u(e,this.options.ownerDocument).map((function(e){return e.getAttribute("medium-editor-textarea-id")&&e.parentNode?e.parentNode.querySelector('div[medium-editor-textarea-id="'+e.getAttribute("medium-editor-textarea-id")+'"]'):e}));this.elements=this.elements.filter((function(e){return-1===t.indexOf(e)||(this.events.cleanupElement(e),e.getAttribute("medium-editor-textarea-id")&&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 bv},set exports(e){bv=e}});var xv=bv,wv=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Ev=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),Cv=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{!i&&s.return&&s.return()}finally{if(o)throw r}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};String.prototype.startsWith=String.prototype.startsWith||function(e){return 0===this.indexOf(e)},String.prototype.padStart=String.prototype.padStart||function(e,t){for(var n=this;n.length<e;)n=t+n;return n};var Nv={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function _v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(t>0?e.toFixed(t).replace(/0+$/,"").replace(/\.$/,""):e.toString())||"0"}var Sv=function(){function e(t,n,i,o){wv(this,e);var r=this;if(void 0===t);else if(Array.isArray(t))this.rgba=t;else if(void 0===i){var a=t&&""+t;a&&function(t){if(t.startsWith("hsl")){var n=t.match(/([\-\d\.e]+)/g).map(Number),i=Cv(n,4),o=i[0],a=i[1],s=i[2],l=i[3];void 0===l&&(l=1),o/=360,a/=100,s/=100,r.hsla=[o,a,s,l]}else if(t.startsWith("rgb")){var u=t.match(/([\-\d\.e]+)/g).map(Number),d=Cv(u,4),c=d[0],h=d[1],f=d[2],p=d[3];void 0===p&&(p=1),r.rgba=[c,h,f,p]}else t.startsWith("#")?r.rgba=e.hexToRgb(t):r.rgba=e.nameToRgb(t)||e.hexToRgb(t)}(a.toLowerCase())}else this.rgba=[t,n,i,void 0===o?1:o]}return Ev(e,[{key:"printRGB",value:function(e){var t=(e?this.rgba:this.rgba.slice(0,3)).map((function(e,t){return _v(e,3===t?3:0)}));return e?"rgba("+t+")":"rgb("+t+")"}},{key:"printHSL",value:function(e){var t=[360,100,100,1],n=["","%","%",""],i=(e?this.hsla:this.hsla.slice(0,3)).map((function(e,i){return _v(e*t[i],3===i?3:1)+n[i]}));return e?"hsla("+i+")":"hsl("+i+")"}},{key:"printHex",value:function(e){var t=this.hex;return e?t:t.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=e.hslToRgb(this._hsla)},set:function(e){3===e.length&&(e[3]=1),this._rgba=e,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=e.rgbToHsl(this._rgba)},set:function(e){3===e.length&&(e[3]=1),this._hsla=e,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){return"#"+this.rgba.map((function(e,t){return t<3?e.toString(16):Math.round(255*e).toString(16)})).map((function(e){return e.padStart(2,"0")})).join("")},set:function(t){this.rgba=e.hexToRgb(t)}}],[{key:"hexToRgb",value:function(e){var t=(e.startsWith("#")?e.slice(1):e).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!t.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+e);var n=t.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map((function(e){return parseInt(e,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(t){var n=t.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),i=Nv[n];return void 0===i?i:e.hexToRgb(i.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=Cv(e,4),n=t[0],i=t[1],o=t[2],r=t[3];n/=255,i/=255,o/=255;var a=Math.max(n,i,o),s=Math.min(n,i,o),l=void 0,u=void 0,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-o)/c+(i<o?6:0);break;case i:l=(o-n)/c+2;break;case o:l=(n-i)/c+4}l/=6}return[l,u,d,r]}},{key:"hslToRgb",value:function(e){var t=Cv(e,4),n=t[0],i=t[1],o=t[2],r=t[3],a=void 0,s=void 0,l=void 0;if(0===i)a=s=l=o;else{var u=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},d=o<.5?o*(1+i):o+i-o*i,c=2*o-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]=r,h}}]),e}(),Mv=function(){function e(){wv(this,e),this._events=[]}return Ev(e,[{key:"add",value:function(e,t,n){e.addEventListener(t,n,!1),this._events.push({target:e,type:t,handler:n})}},{key:"remove",value:function(t,n,i){this._events=this._events.filter((function(o){var r=!0;return t&&t!==o.target&&(r=!1),n&&n!==o.type&&(r=!1),i&&i!==o.handler&&(r=!1),r&&e._doRemove(o.target,o.type,o.handler),!r}))}},{key:"destroy",value:function(){this._events.forEach((function(t){return e._doRemove(t.target,t.type,t.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(e,t,n){e.removeEventListener(t,n,!1)}}]),e}();function Tv(e,t,n){var i=!1;function o(e,t,n){return Math.max(t,Math.min(e,n))}function r(e,r,a){if(a&&(i=!0),i){e.preventDefault();var s=t.getBoundingClientRect(),l=s.width,u=s.height,d=r.clientX,c=r.clientY,h=o(d-s.left,0,l),f=o(c-s.top,0,u);n(h/l,f/u)}}function a(e,t){1===(void 0===e.buttons?e.which:e.buttons)?r(e,e,t):i=!1}function s(e,t){1===e.touches.length?r(e,e.touches[0],t):i=!1}e.add(t,"mousedown",(function(e){a(e,!0)})),e.add(t,"touchstart",(function(e){s(e,!0)})),e.add(window,"mousemove",a),e.add(t,"touchmove",s),e.add(window,"mouseup",(function(e){i=!1})),e.add(t,"touchend",(function(e){i=!1})),e.add(t,"touchcancel",(function(e){i=!1}))}var Av="keydown",kv="mousedown",Rv="focusin";function Dv(e,t){return(t||document).querySelector(e)}function Ov(e,t,n,i,o){e.add(t,Av,(function(e){n.indexOf(e.key)>=0&&i(e)}))}var Pv=function(){function e(t){wv(this,e),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Mv,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return Ev(e,[{key:"setOptions",value:function(e){var t=this;if(e){var n=this.settings;if(e instanceof HTMLElement)n.parent=e;else{n.parent&&e.parent&&n.parent!==e.parent&&(this._events.remove(n.parent),this._popupInited=!1),function(e,t){for(var n in e)t[n]=e[n]}(e,n),e.onChange&&(this.onChange=e.onChange),e.onDone&&(this.onDone=e.onDone),e.onOpen&&(this.onOpen=e.onOpen),e.onClose&&(this.onClose=e.onClose);var i=e.color||e.colour;i&&this._setColor(i)}var o=n.parent;if(o&&n.popup&&!this._popupInited){var r=function(e){return t.openHandler(e)};this._events.add(o,"click",r),Ov(this._events,o,[" ","Spacebar","Enter"],r),this._popupInited=!0}else e.parent&&!n.popup&&this.show()}}},{key:"openHandler",value:function(e){if(this.show()){e&&e.preventDefault(),this.settings.parent.style.pointerEvents="none";var t=e&&e.type===Av?this._domEdit:this.domElement;setTimeout((function(){return t.focus()}),100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(e){var t=e&&e.type,n=!1;if(e)if(t===kv||t===Rv){var i=(this.__containedEvent||0)+100;e.timeStamp>i&&(n=!0)}else!function(e){e.preventDefault(),e.stopPropagation()}(e),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",t!==kv&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(e,t){this.closeHandler(),this.setOptions(e),t&&this.openHandler()}},{key:"setColor",value:function(e,t){this._setColor(e,{silent:t})}},{key:"_setColor",value:function(e,t){if("string"==typeof e&&(e=e.trim()),e){t=t||{};var n=void 0;try{n=new Sv(e)}catch(e){if(t.failSilently)return;throw e}if(!this.settings.alpha){var i=n.hsla;i[3]=1,n.hsla=i}this.colour=this.color=n,this._setHSLA(null,null,null,null,t)}}},{key:"setColour",value:function(e,t){this.setColor(e,t)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var e=this._toggleDOM(!0);return this._setPosition(),e}var t,n,i=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',o=(t=i,(n=document.createElement("div")).innerHTML=t,n.firstElementChild);return this.domElement=o,this._domH=Dv(".picker_hue",o),this._domSL=Dv(".picker_sl",o),this._domA=Dv(".picker_alpha",o),this._domEdit=Dv(".picker_editor input",o),this._domSample=Dv(".picker_sample",o),this._domOkay=Dv(".picker_done button",o),this._domCancel=Dv(".picker_cancel button",o),o.classList.add("layout_"+this.settings.layout),this.settings.alpha||o.classList.add("no_alpha"),this.settings.editor||o.classList.add("no_editor"),this.settings.cancelButton||o.classList.add("no_cancel"),this._ifPopup((function(){return o.classList.add("popup")})),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var e=this,t=this,n=this.domElement,i=this._events;function o(e,t,n){i.add(e,t,n)}o(n,"click",(function(e){return e.preventDefault()})),Tv(i,this._domH,(function(e,n){return t._setHSLA(e)})),Tv(i,this._domSL,(function(e,n){return t._setHSLA(null,e,1-n)})),this.settings.alpha&&Tv(i,this._domA,(function(e,n){return t._setHSLA(null,null,null,1-n)}));var r=this._domEdit;o(r,"input",(function(e){t._setColor(this.value,{fromEditor:!0,failSilently:!0})})),o(r,"focus",(function(e){var t=this;t.selectionStart===t.selectionEnd&&t.select()})),this._ifPopup((function(){var t=function(t){return e.closeHandler(t)};o(window,kv,t),o(window,Rv,t),Ov(i,n,["Esc","Escape"],t);var r=function(t){e.__containedEvent=t.timeStamp};o(n,kv,r),o(n,Rv,r),o(e._domCancel,"click",t)}));var a=function(t){e._ifPopup((function(){return e.closeHandler(t)})),e.onDone&&e.onDone(e.colour)};o(this._domOkay,"click",a),Ov(i,n,["Enter"],a)}},{key:"_setPosition",value:function(){var e=this.settings.parent,t=this.domElement;e!==t.parentNode&&e.appendChild(t),this._ifPopup((function(n){"static"===getComputedStyle(e).position&&(e.style.position="relative");var i=!0===n?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(e){e===i?t.classList.add(e):t.classList.remove(e)})),t.classList.add(i)}))}},{key:"_setHSLA",value:function(e,t,n,i,o){o=o||{};var r=this.colour,a=r.hsla;[e,t,n,i].forEach((function(e,t){(e||0===e)&&(a[t]=e)})),r.hsla=a,this._updateUI(o),this.onChange&&!o.silent&&this.onChange(r)}},{key:"_updateUI",value:function(e){if(this.domElement){e=e||{};var t=this.colour,n=t.hsla,i="hsl("+360*n[0]+", 100%, 50%)",o=t.hslString,r=t.hslaString,a=this._domH,s=this._domSL,l=this._domA,u=Dv(".picker_selector",a),d=Dv(".picker_selector",s),c=Dv(".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=o,b(0,c,1-n[3]);var h=o,f=h.replace("hsl","hsla").replace(")",", 0)"),p="linear-gradient("+[h,f]+")";if(this._domA.style.background=p+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!e.fromEditor){var g=this.settings.editorFormat,v=this.settings.alpha,m=void 0;switch(g){case"rgb":m=t.printRGB(v);break;case"hsl":m=t.printHSL(v);break;default:m=t.printHex(v)}this._domEdit.value=m}this._domSample.style.color=r}function y(e,t,n){t.style.left=100*n+"%"}function b(e,t,n){t.style.top=100*n+"%"}}},{key:"_ifPopup",value:function(e,t){this.settings.parent&&this.settings.popup?e&&e(this.settings.popup):t&&t()}},{key:"_toggleDOM",value:function(e){var t=this.domElement;if(!t)return!1;var n=e?"":"none",i=t.style.display!==n;return i&&(t.style.display=n),i}}]),e}(),Iv=document.createElement("style");Iv.textContent='.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}',document.documentElement.firstElementChild.appendChild(Iv),Pv.StyleElement=Iv;var Lv={};!function(e){e.exports=function(){var e="object",t="function",n="undefined",i=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],o=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],r=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],a=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"];function s(n,i){var o=typeof n[i];return o==t||!(o!=e||!n[i])||"unknown"==o}function l(t,n){return!(typeof t[n]!=e||!t[n])}function u(e,t){return typeof e[t]!=n}function 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),f=d(u);function p(e){return e&&c(e,a)&&f(e,r)}function g(e){return l(e,"body")?e.body:e.getElementsByTagName("body")[0]}var v,m,y=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,i=e.length;n<i;++n)t(e[n],n)},b={},x=typeof window!=n&&typeof document!=n,w={isHostMethod:s,isHostObject:l,isHostProperty:u,areHostMethods:c,areHostObjects:h,areHostProperties:f,isTextRange:p,getBody:g,forEach:y},E={version:"1.3.1",initialized:!1,isBrowser:x,supported:!0,util:w,features:{},modules:b,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==n||rangyAutoInitialize}};function C(e){typeof console!=n&&s(console,"log")}function N(e,t){x&&t?alert(e):C(e)}function _(e){E.initialized=!0,E.supported=!1,N("Rangy is not supported in this environment. Reason: "+e,E.config.alertOnFail)}function S(e){N("Rangy warning: "+e,E.config.alertOnWarn)}E.fail=_,E.warn=S,{}.hasOwnProperty?(w.extend=v=function(e,t,n){var i,o;for(var r in t)t.hasOwnProperty(r)&&(i=e[r],o=t[r],n&&null!==i&&"object"==typeof i&&null!==o&&"object"==typeof o&&v(i,o,!0),e[r]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},w.createOptions=function(e,t){var n={};return v(n,t),e&&v(n,e),n}):_("hasOwnProperty not supported"),x||_("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(e){}}e||(e=function(e){for(var t=[],n=0,i=e.length;n<i;++n)t[n]=e[n];return t}),w.toArray=e}(),x&&(s(document,"addEventListener")?m=function(e,t,n){e.addEventListener(t,n,!1)}:s(document,"attachEvent")?m=function(e,t,n){e.attachEvent("on"+t,n)}:_("Document does not have required addEventListener or attachEvent method"),w.addListener=m);var M=[];function T(e){return e.message||e.description||String(e)}function A(){if(x&&!E.initialized){var e,t=!1,n=!1;s(document,"createRange")&&(e=document.createRange(),c(e,o)&&f(e,i)&&(t=!0));var r=g(document);if(r&&"body"==r.nodeName.toLowerCase())if(r&&s(r,"createTextRange")&&p(e=r.createTextRange())&&(n=!0),t||n){var a;for(var l in E.initialized=!0,E.features={implementsDomRange:t,implementsTextRange:n},b)(a=b[l])instanceof P&&a.init(a,E);for(var u=0,d=M.length;u<d;++u)try{M[u](E)}catch(e){C("Rangy init listener threw an exception. Continuing. Detail: "+T(e))}}else _("Neither Range nor TextRange are available");else _("No body element found")}}function k(e,t,n){n&&(e+=" in module "+n.name),E.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function R(e,t,n,i){e[t]=function(){return k(t,n,i),e[n].apply(e,w.toArray(arguments))}}w.deprecationNotice=k,w.createAliasForDeprecatedMethod=R,E.init=A,E.addInitListener=function(e){E.initialized?e(E):M.push(e)};var D=[];function O(e){e=e||window,A();for(var t=0,n=D.length;t<n;++t)D[t](e)}function P(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function I(e,t,n){var i=new P(e,t,(function(t){if(!t.initialized){t.initialized=!0;try{n(E,t),t.supported=!0}catch(t){C("Module '"+e+"' failed to load: "+T(t)),t.stack&&C(t.stack)}}}));return b[e]=i,i}function L(){}function B(){}E.addShimListener=function(e){D.push(e)},x&&(E.shim=E.createMissingNativeApi=O,R(E,"createMissingNativeApi","shim")),P.prototype={init:function(){for(var e,t,n=this.dependencies||[],i=0,o=n.length;i<o;++i){if(t=n[i],!((e=b[t])&&e instanceof P))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){E.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){E.warn("DEPRECATED: "+e+" in module "+this.name+" is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},E.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var i=I(e,n,t);E.initialized&&E.supported&&i.init()},E.createCoreModule=function(e,t,n){I(e,t,n)},E.RangePrototype=L,E.rangePrototype=new L,E.selectionPrototype=new B,E.createCoreModule("DomUtil",[],(function(e,t){var n="undefined",i=e.util,o=i.getBody;i.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),i.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var r=document.createElement("div");i.areHostMethods(r,["insertBefore","appendChild","cloneNode"]||!i.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),i.isHostProperty(r,"innerHTML")||t.fail("Element is missing innerHTML property");var a=document.createTextNode("test");i.areHostMethods(a,["splitText","deleteData","insertData","appendData","cloneNode"]||!i.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"])||!i.areHostProperties(a,["data"]))||t.fail("Incomplete Text Node implementation");var s=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1};function l(e){var t;return typeof e.namespaceURI==n||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function u(e){var t=e.parentNode;return 1==t.nodeType?t:null}function 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 f(e,t,n){for(var i=n?t:t.parentNode;i;){if(i===e)return!0;i=i.parentNode}return!1}function p(e,t){return f(e,t,!0)}function g(e,t,n){for(var i,o=n?e:e.parentNode;o;){if((i=o.parentNode)===t)return o;o=i}return null}function v(e){var t=e.nodeType;return 3==t||4==t||8==t}function m(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function y(e,t){var n=t.nextSibling,i=t.parentNode;return n?i.insertBefore(e,n):i.appendChild(e),e}function b(e,t,n){var i=e.cloneNode(!1);if(i.deleteData(0,t),e.deleteData(t,e.length-t),y(i,e),n)for(var o,r=0;o=n[r++];)o.node==e&&o.offset>t?(o.node=i,o.offset-=t):o.node==e.parentNode&&o.offset>d(e)&&++o.offset;return i}function x(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=n)return e.ownerDocument;if(typeof e.document!=n)return e.document;if(e.parentNode)return x(e.parentNode);throw t.createError("getDocument: no document found for node")}function w(e){var i=x(e);if(typeof i.defaultView!=n)return i.defaultView;if(typeof i.parentWindow!=n)return i.parentWindow;throw t.createError("Cannot get a window object for node")}function E(e){if(typeof e.contentDocument!=n)return e.contentDocument;if(typeof e.contentWindow!=n)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function C(e){if(typeof e.contentWindow!=n)return e.contentWindow;if(typeof e.contentDocument!=n)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function N(e){return e&&i.isHostMethod(e,"setTimeout")&&i.isHostObject(e,"document")}function _(e,t,n){var o;if(e?i.isHostProperty(e,"nodeType")?o=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?E(e):x(e):N(e)&&(o=e.document):o=document,!o)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return o}function S(e){for(var t;t=e.parentNode;)e=t;return e}function M(e,n,i,o){var r,a,s,l,u;if(e==i)return n===o?0:n<o?-1:1;if(r=g(i,e,!0))return n<=d(r)?-1:1;if(r=g(e,i,!0))return d(r)<o?-1:1;if(!(a=h(e,i)))throw new Error("comparePoints error: nodes have no common ancestor");if((s=e===a?a:g(e,a,!0))===(l=i===a?a:g(i,a,!0)))throw t.createError("comparePoints got to case 4 and childA and childB are the same!");for(u=a.firstChild;u;){if(u===s)return-1;if(u===l)return 1;u=u.nextSibling}}var T,A=!1;function k(e){try{return e.parentNode,!1}catch(e){return!0}}function R(e){if(!e)return"[No node]";if(A&&k(e))return"[Broken node]";if(v(e))return'"'+e.data+'"';if(1==e.nodeType){var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">[index:"+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 O(e,t,n){var i=o(e),r=e.createElement("div");r.contentEditable=""+!!n,t&&(r.innerHTML=t);var a=i.firstChild;return a?i.insertBefore(r,a):i.appendChild(r),r}function P(e){return e.parentNode.removeChild(e)}function I(e){this.root=e,this._next=e}function L(e){return new I(e)}function B(e,t){this.node=e,this.offset=t}function j(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="<br />",A=k(n),e.features.crashyTextNodes=A}(),typeof window.getComputedStyle!=n?T=function(e,t){return w(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=n?T=function(e,t){return e.currentStyle?e.currentStyle[t]:""}:t.fail("No means of obtaining computed style properties found"),I.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},B.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+R(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},j.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},j.prototype.toString=function(){return this.message},e.dom={arrayContains:s,isHtmlNamespace:l,parentElement:u,getNodeIndex:d,getNodeLength:c,getCommonAncestor:h,isAncestorOf:f,isOrIsAncestorOf:p,getClosestAncestorIn:g,isCharacterDataNode:v,isTextOrCommentNode:m,insertAfter:y,splitDataNode:b,getDocument:x,getWindow:w,getIframeWindow:C,getIframeDocument:E,getBody:o,isWindow:N,getContentDocument:_,getRootContainer:S,comparePoints:M,isBrokenNode:k,inspectNode:R,getComputedStyleProperty:T,createTestElement:O,removeNode:P,fragmentFromNodeChildren:D,createIterator:L,DomPosition:B},e.DOMException=j})),E.createCoreModule("DomRange",["DomUtil"],(function(e,t){var n=e.dom,i=e.util,o=n.DomPosition,r=e.DOMException,a=n.isCharacterDataNode,s=n.getNodeIndex,l=n.isOrIsAncestorOf,u=n.getDocument,d=n.comparePoints,c=n.splitDataNode,h=n.getClosestAncestorIn,f=n.getNodeLength,p=n.arrayContains,g=n.getRootContainer,v=e.features.crashyTextNodes,m=n.removeNode;function y(e,t){return 3!=e.nodeType&&(l(e,t.startContainer)||l(e,t.endContainer))}function b(e){return e.document||u(e.startContainer)}function x(e){return g(e.startContainer)}function w(e){return new o(e.parentNode,s(e))}function E(e){return new o(e.parentNode,s(e)+1)}function C(e,t,i){var o=11==e.nodeType?e.firstChild:e;return a(t)?i==t.length?n.insertAfter(e,t):t.parentNode.insertBefore(e,0==i?t:c(t,i)):i>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[i]),o}function N(e,t,n){if($(e),$(t),b(t)!=b(e))throw new r("WRONG_DOCUMENT_ERR");var i=d(e.startContainer,e.startOffset,t.endContainer,t.endOffset),o=d(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return n?i<=0&&o>=0:i<0&&o>0}function _(e){for(var t,n,i,o=b(e.range).createDocumentFragment();n=e.next();){if(t=e.isPartiallySelectedSubtree(),n=n.cloneNode(!t),t&&(i=e.getSubtreeIterator(),n.appendChild(_(i)),i.detach()),10==n.nodeType)throw new r("HIERARCHY_REQUEST_ERR");o.appendChild(n)}return o}function S(e,t,i){var o,r,a,s;for(i=i||{stop:!1};a=e.next();)if(e.isPartiallySelectedSubtree()){if(!1===t(a))return void(i.stop=!0);if(S(s=e.getSubtreeIterator(),t,i),s.detach(),i.stop)return}else for(o=n.createIterator(a);r=o.next();)if(!1===t(r))return void(i.stop=!0)}function M(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(M(t=e.getSubtreeIterator()),t.detach()):e.remove()}function T(e){for(var t,n,i=b(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),n=e.getSubtreeIterator(),t.appendChild(T(n)),n.detach()):e.remove(),10==t.nodeType)throw new r("HIERARCHY_REQUEST_ERR");i.appendChild(t)}return i}function A(e,t,n){var i,o=!(!t||!t.length),r=!!n;o&&(i=new RegExp("^("+t.join("|")+")$"));var s=[];return S(new R(e,!1),(function(t){if((!o||i.test(t.nodeType))&&(!r||n(t))){var l=e.startContainer;if(t!=l||!a(l)||e.startOffset!=l.length){var u=e.endContainer;t==u&&a(u)&&0==e.endOffset||s.push(t)}}})),s}function k(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+n.inspectNode(e.startContainer)+":"+e.startOffset+", "+n.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function R(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&a(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||a(this.sc)?h(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||a(this.ec)?h(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}R.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){var e=this._current=this._next;return e&&(this._next=e!==this._last?e.nextSibling:null,a(e)&&this.clonePartiallySelectedTextNodes&&(e===this.ec&&(e=e.cloneNode(!0)).deleteData(this.eo,e.length-this.eo),this._current===this.sc&&(e=e.cloneNode(!0)).deleteData(0,this.so))),e},remove:function(){var e,t,n=this._current;!a(n)||n!==this.sc&&n!==this.ec?n.parentNode&&m(n):(e=n===this.sc?this.so:0)!=(t=n===this.ec?this.eo:n.length)&&n.deleteData(e,t-e)},isPartiallySelectedSubtree:function(){return y(this._current,this.range)},getSubtreeIterator:function(){var e;if(this.isSingleCharacterDataNode)(e=this.range.cloneRange()).collapse(!1);else{e=new me(b(this.range));var t=this._current,n=t,i=0,o=t,r=f(t);l(t,this.sc)&&(n=this.sc,i=this.so),l(t,this.ec)&&(o=this.ec,r=this.eo),ve(e,n,i,o,r)}return new R(e,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var D=[1,3,4,5,7,8,10],O=[2,9,11],P=[5,6,10,12],I=[1,3,4,5,7,8,10,11],L=[1,3,4,5,7,8];function B(e){return function(t,n){for(var i,o=n?t:t.parentNode;o;){if(i=o.nodeType,p(e,i))return o;o=o.parentNode}return null}}var j=B([9,11]),F=B(P),H=B([6,10,12]),W=B([1]);function z(e,t){if(H(e,t))throw new r("INVALID_NODE_TYPE_ERR")}function G(e,t){if(!p(t,e.nodeType))throw new r("INVALID_NODE_TYPE_ERR")}function U(e,t){if(t<0||t>(a(e)?e.length:e.childNodes.length))throw new r("INDEX_SIZE_ERR")}function q(e,t){if(j(e,!0)!==j(t,!0))throw new r("WRONG_DOCUMENT_ERR")}function X(e){if(F(e,!0))throw new r("NO_MODIFICATION_ALLOWED_ERR")}function V(e,t){if(!e)throw new r(t)}function K(e,t){return t<=(a(e)?e.length:e.childNodes.length)}function Y(e){return!!e.startContainer&&!!e.endContainer&&!(v&&(n.isBrokenNode(e.startContainer)||n.isBrokenNode(e.endContainer)))&&g(e.startContainer)==g(e.endContainer)&&K(e.startContainer,e.startOffset)&&K(e.endContainer,e.endOffset)}function $(e){if(!Y(e))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+e.inspect()+")")}var Z=document.createElement("style"),J=!1;try{Z.innerHTML="<b>x</b>",J=3==Z.firstChild.nodeType}catch(e){}e.features.htmlParsingConforms=J;var Q=J?function(e){var t=this.startContainer,i=u(t);if(!t)throw new r("INVALID_STATE_ERR");var o=null;return 1==t.nodeType?o=t:a(t)&&(o=n.parentElement(t)),(o=null===o||"HTML"==o.nodeName&&n.isHtmlNamespace(u(o).documentElement)&&n.isHtmlNamespace(o)?i.createElement("body"):o.cloneNode(!1)).innerHTML=e,n.fragmentFromNodeChildren(o)}:function(e){var t=b(this).createElement("body");return t.innerHTML=e,n.fragmentFromNodeChildren(t)};function ee(e,t){$(e);var n=e.startContainer,i=e.startOffset,o=e.endContainer,r=e.endOffset,l=n===o;a(o)&&r>0&&r<o.length&&c(o,r,t),a(n)&&i>0&&i<n.length&&(n=c(n,i,t),l?(r-=i,o=n):o==n.parentNode&&r>=s(n)&&r++,i=0),e.setStartAndEnd(n,i,o,r)}function te(e){$(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}var ne=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ie=0,oe=1,re=2,ae=3,se=0,le=1,ue=2,de=3;function ce(e){e.START_TO_START=ie,e.START_TO_END=oe,e.END_TO_END=re,e.END_TO_START=ae,e.NODE_BEFORE=se,e.NODE_AFTER=le,e.NODE_BEFORE_AND_AFTER=ue,e.NODE_INSIDE=de}function he(e){ce(e),ce(e.prototype)}function fe(e,t){return function(){$(this);var n,i=this.startContainer,o=this.startOffset,r=this.commonAncestorContainer,a=new R(this,!0);i!==r&&(i=(n=E(h(i,r,!0))).node,o=n.offset),S(a,X),a.reset();var s=e(a);return a.detach(),t(this,i,o,i,o),s}}function pe(t,n){function o(e,t){return function(n){G(n,D),G(g(n),O);var i=(e?w:E)(n);(t?r:l)(this,i.node,i.offset)}}function r(e,t,i){var o=e.endContainer,r=e.endOffset;t===e.startContainer&&i===e.startOffset||(g(t)==g(o)&&1!=d(t,i,o,r)||(o=t,r=i),n(e,t,i,o,r))}function l(e,t,i){var o=e.startContainer,r=e.startOffset;t===e.endContainer&&i===e.endOffset||(g(t)==g(o)&&-1!=d(t,i,o,r)||(o=t,r=i),n(e,o,r,t,i))}var u=function(){};u.prototype=e.rangePrototype,t.prototype=new u,i.extend(t.prototype,{setStart:function(e,t){z(e,!0),U(e,t),r(this,e,t)},setEnd:function(e,t){z(e,!0),U(e,t),l(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],i=e[1],o=t,r=i;switch(e.length){case 3:r=e[2];break;case 4:o=e[2],r=e[3]}z(t,!0),U(t,i),z(o,!0),U(o,r),n(this,t,i,o,r)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:o(!0,!0),setStartAfter:o(!1,!0),setEndBefore:o(!0,!1),setEndAfter:o(!1,!1),collapse:function(e){$(this),e?n(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):n(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){z(e,!0),n(this,e,0,e,f(e))},selectNode:function(e){z(e,!1),G(e,D);var t=w(e),i=E(e);n(this,t.node,t.offset,i.node,i.offset)},extractContents:fe(T,n),deleteContents:fe(M,n),canSurroundContents:function(){$(this),X(this.startContainer),X(this.endContainer);var e=new R(this,!0),t=e._first&&y(e._first,this)||e._last&&y(e._last,this);return e.detach(),!t},splitBoundaries:function(){ee(this)},splitBoundariesPreservingPositions:function(e){ee(this,e)},normalizeBoundaries:function(){$(this);var e,t=this.startContainer,i=this.startOffset,o=this.endContainer,r=this.endOffset,l=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(o=e,r=e.length,e.appendData(t.data),m(t))},u=function(e){var n=e.previousSibling;if(n&&n.nodeType==e.nodeType){t=e;var a=e.length;if(i=n.length,e.insertData(0,n.data),m(n),t==o)r+=i,o=t;else if(o==e.parentNode){var l=s(e);r==l?(o=e,r=a):r>l&&r--}}},d=!0;if(a(o))r==o.length?l(o):0==r&&(e=o.previousSibling)&&e.nodeType==o.nodeType&&(r=e.length,t==o&&(d=!1),e.appendData(o.data),m(o),o=e);else{if(r>0){var c=o.childNodes[r-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&&(o==e&&(o=t,r+=t.length),t.appendData(e.data),m(e));else if(i<t.childNodes.length){var h=t.childNodes[i];h&&a(h)&&u(h)}}else t=o,i=r;n(this,t,i,o,r)},collapseToPoint:function(e,t){z(e,!0),U(e,t),this.setStartAndEnd(e,t)},parentElement:function(){return $(this),this.commonAncestorContainer?W(this.commonAncestorContainer,!0):null}}),he(t)}function ge(e){e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e.commonAncestorContainer=e.collapsed?e.startContainer:n.getCommonAncestor(e.startContainer,e.endContainer)}function ve(e,t,i,o,r){e.startContainer=t,e.startOffset=i,e.endContainer=o,e.endOffset=r,e.document=n.getDocument(t),ge(e)}function me(e){ve(this,e,0,e,0)}i.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){var n,i,o,r;$(this),q(this.startContainer,t.startContainer);var a=e==ae||e==ie?"start":"end",s=e==oe||e==ie?"start":"end";return n=this[a+"Container"],i=this[a+"Offset"],o=t[s+"Container"],r=t[s+"Offset"],d(n,i,o,r)},insertNode:function(e){if($(this),G(e,I),X(this.startContainer),l(e,this.startContainer))throw new r("HIERARCHY_REQUEST_ERR");var t=C(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){var e,t;if($(this),this.collapsed)return b(this).createDocumentFragment();if(this.startContainer===this.endContainer&&a(this.startContainer))return(e=this.startContainer.cloneNode(!0)).data=e.data.slice(this.startOffset,this.endOffset),(t=b(this).createDocumentFragment()).appendChild(e),t;var n=new R(this,!0);return e=_(n),n.detach(),e},canSurroundContents:function(){$(this),X(this.startContainer),X(this.endContainer);var e=new R(this,!0),t=e._first&&y(e._first,this)||e._last&&y(e._last,this);return e.detach(),!t},surroundContents:function(e){if(G(e,L),!this.canSurroundContents())throw new r("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);C(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){$(this);for(var e,t=new me(b(this)),n=ne.length;n--;)t[e=ne[n]]=this[e];return t},toString:function(){$(this);var e=this.startContainer;if(e===this.endContainer&&a(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new R(this,!0);return S(n,(function(e){3!=e.nodeType&&4!=e.nodeType||t.push(e.data)})),n.detach(),t.join("")},compareNode:function(e){$(this);var t=e.parentNode,n=s(e);if(!t)throw new r("NOT_FOUND_ERR");var i=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return i<0?o>0?ue:se:o>0?le:de},comparePoint:function(e,t){return $(this),V(e,"HIERARCHY_REQUEST_ERR"),q(e,this.startContainer),d(e,t,this.startContainer,this.startOffset)<0?-1:d(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:Q,toHtml:function(){return te(this)},intersectsNode:function(e,t){if($(this),g(e)!=x(this))return!1;var n=e.parentNode,i=s(e);if(!n)return!0;var o=d(n,i,this.endContainer,this.endOffset),r=d(n,i+1,this.startContainer,this.startOffset);return t?o<=0&&r>=0:o<0&&r>0},isPointInRange:function(e,t){return $(this),V(e,"HIERARCHY_REQUEST_ERR"),q(e,this.startContainer),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 r("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,f(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var i=n.pop();return t.setEnd(i,i.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return $(this),A(this,e,t)},getDocument:function(){return b(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var i=b(this),o=e.createRange(i);t=t||n.getBody(i),o.selectNodeContents(t);var r=this.intersection(o),a=0,s=0;return r&&(o.setEnd(r.startContainer,r.startOffset),s=(a=o.toString().length)+r.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var i,o,r,a,s=[t],l=!1,u=!1;!u&&(i=s.pop());)if(3==i.nodeType)o=n+i.length,!l&&e.start>=n&&e.start<=o&&(this.setStart(i,e.start-n),l=!0),l&&e.end>=n&&e.end<=o&&(this.setEnd(i,e.end-n),u=!0),n=o;else for(r=(a=i.childNodes).length;r--;)s.push(a[r])},getName:function(){return"DomRange"},equals:function(e){return me.rangesEqual(this,e)},isValid:function(){return Y(this)},inspect:function(){return k(this)},detach:function(){}}),pe(me,ve),i.extend(me,{rangeProperties:ne,RangeIterator:R,copyComparisonConstants:he,createPrototypeRange:pe,inspect:k,toHtml:te,getRangeDocument:b,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=me})),E.createCoreModule("WrappedRange",["DomRange"],(function(e,t){var n,i,o=e.dom,r=e.util,a=o.DomPosition,s=e.DomRange,l=o.getBody,u=o.getContentDocument,d=o.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,o){var r=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==i||e.endOffset!=o,s=!e.equals(e.nativeRange);(r||a||s)&&(e.setEnd(i,o),e.setStart(t,n))}n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,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 f=document.createTextNode("test");l(document).appendChild(f);var p=document.createRange();p.setStart(f,0),p.setEnd(f,0);try{p.setStart(f,1),i.setStart=function(e,t){this.nativeRange.setStart(e,t),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,o.getNodeLength(e))},p.selectNodeContents(f),p.setEnd(f,3);var g=document.createRange();g.selectNodeContents(f),g.setEnd(f,4),g.setStart(f,2),-1==p.compareBoundaryPoints(p.START_TO_END,g)&&1==p.compareBoundaryPoints(p.END_TO_START,g)?i.compareBoundaryPoints=function(e,t){return e==(t=t.nativeRange||t).START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:i.compareBoundaryPoints=function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var v=document.createElement("div");v.innerHTML="123";var m=v.firstChild,y=l(document);y.appendChild(v),p.setStart(m,1),p.setEnd(m,2),p.deleteContents(),"13"==m.data&&(i.deleteContents=function(){this.nativeRange.deleteContents(),c(this)},i.extractContents=function(){var e=this.nativeRange.extractContents();return c(this),e}),y.removeChild(v),y=null,r.isHostMethod(p,"createContextualFragment")&&(i.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),l(document).removeChild(f),i.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return(e=u(e,t,"createNativeRange")).createRange()}}(),e.features.implementsTextRange){var c=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var i=n.parentElement();(n=e.duplicate()).collapse(!1);var r=n.parentElement(),a=i==r?i:o.getCommonAncestor(i,r);return a==t?a:o.getCommonAncestor(t,a)},h=function(e){return 0==e.compareEndPoints("StartToEnd",e)},f=function(e,t,n,i,r){var s=e.duplicate();s.collapse(n);var l=s.parentElement();if(o.isOrIsAncestorOf(t,l)||(l=t),!l.canHaveHTML){var u=new a(l.parentNode,o.getNodeIndex(l));return{boundaryPosition:u,nodeInfo:{nodeIndex:u.offset,containerElement:u.node}}}var c=o.getDocument(l).createElement("span");c.parentNode&&o.removeNode(c);for(var h,f,p,g,v,m=n?"StartToStart":"StartToEnd",y=r&&r.containerElement==l?r.nodeIndex:0,b=l.childNodes.length,x=b,w=x;w==b?l.appendChild(c):l.insertBefore(c,l.childNodes[w]),s.moveToElementText(c),0!=(h=s.compareEndPoints(m,e))&&y!=x;){if(-1==h){if(x==y+1)break;y=w}else x=x==y+1?y:w;w=Math.floor((y+x)/2),l.removeChild(c)}if(v=c.nextSibling,-1==h&&v&&d(v)){var E;if(s.setEndPoint(n?"EndToStart":"EndToEnd",e),/[\r\n]/.test(v.data)){var C=s.duplicate(),N=C.text.replace(/\r\n/g,"\r").length;for(E=C.moveStart("character",N);-1==(h=C.compareEndPoints("StartToEnd",C));)E++,C.moveStart("character",1)}else E=s.text.length;g=new a(v,E)}else f=(i||!n)&&c.previousSibling,g=(p=(i||n)&&c.nextSibling)&&d(p)?new a(p,0):f&&d(f)?new a(f,f.data.length):new a(l,o.getNodeIndex(c));return o.removeNode(c),{boundaryPosition:g,nodeInfo:{nodeIndex:w,containerElement:l}}},p=function(e,t){var n,i,r,a,s=e.offset,u=o.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),(r=u.createElement("span")).innerHTML="&#feff;",n?i.insertBefore(r,n):i.appendChild(r),c.moveToElementText(r),c.collapse(!t),i.removeChild(r),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=f(this.textRange,i,!0,!0).boundaryPosition:(e=(n=f(this.textRange,i,!0,!1)).boundaryPosition,t=f(this.textRange,i,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(e.node,e.offset),this.setEnd(t.node,t.offset)},i.prototype.getName=function(){return"WrappedTextRange"},s.copyComparisonConstants(i);var g=function(e){if(e.collapsed)return p(new a(e.startContainer,e.startOffset),!0);var t=p(new a(e.startContainer,e.startOffset),!0),n=p(new a(e.endContainer,e.endOffset),!1),i=l(s.getRangeDocument(e)).createTextRange();return i.setEndPoint("StartToStart",t),i.setEndPoint("EndToEnd",n),i};if(i.rangeToTextRange=g,i.prototype.toTextRange=function(){return g(this)},e.WrappedTextRange=i,!e.features.implementsDomRange||e.config.preferTextRange){var v=Function("return this;")();void 0===v.Range&&(v.Range=i),e.createNativeRange=function(e){return e=u(e,t,"createNativeRange"),l(e).createTextRange()},e.WrappedRange=i}}e.createRange=function(n){return n=u(n,t,"createRange"),new e.WrappedRange(e.createNativeRange(n))},e.createRangyRange=function(e){return e=u(e,t,"createRangyRange"),new s(e)},r.createAliasForDeprecatedMethod(e,"createIframeRange","createRange"),r.createAliasForDeprecatedMethod(e,"createIframeRangyRange","createRangyRange"),e.addShimListener((function(t){var n=t.document;void 0===n.createRange&&(n.createRange=function(){return e.createRange(n)}),n=t=null}))})),E.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(e,t){e.config.checkSelectionRanges=!0;var n,i,o="boolean",r="number",a=e.dom,s=e.util,l=s.isHostMethod,u=e.DomRange,d=e.WrappedRange,c=e.DOMException,h=a.DomPosition,f=e.features,p="Control",g=a.getDocument,v=a.getBody,m=u.rangesEqual;function y(e){return"string"==typeof e?/^backward(s)?$/i.test(e):!!e}function b(e,n){if(e){if(a.isWindow(e))return e;if(e instanceof $)return e.win;var i=a.getContentDocument(e,t,n);return a.getWindow(i)}return window}function x(e){return b(e,"getWinSelection").getSelection()}function w(e){return b(e,"getDocSelection").document.selection}function E(e){var t=!1;return e.anchorNode&&(t=1==a.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)),t}var C=l(window,"getSelection"),N=s.isHostObject(document,"selection");f.implementsWinGetSelection=C,f.implementsDocSelection=N;var _=N&&(!C||e.config.preferTextRange);if(_)n=w,e.isSelectionValid=function(e){var t=b(e,"isSelectionValid").document,n=t.selection;return"None"!=n.type||g(n.createRange().parentElement())==t};else{if(!C)return t.fail("Neither document.selection or window.getSelection() detected."),!1;n=x,e.isSelectionValid=function(){return!0}}e.getNativeSelection=n;var S=n();if(!S)return t.fail("Native selection was null (possibly issue 138?)"),!1;var M=e.createNativeRange(document),T=v(document),A=s.areHostProperties(S,["anchorNode","focusNode","anchorOffset","focusOffset"]);f.selectionHasAnchorAndFocus=A;var k=l(S,"extend");f.selectionHasExtend=k;var R=l(S,"setBaseAndExtent");f.selectionHasSetBaseAndExtent=R;var D=typeof S.rangeCount==r;f.selectionHasRangeCount=D;var O=!1,P=!0,I=k?function(t,n){var i=u.getRangeDocument(n),o=e.createRange(i);o.collapseToPoint(n.endContainer,n.endOffset),t.addRange(G(o)),t.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(S,["addRange","getRangeAt","removeAllRanges"])&&typeof S.rangeCount==r&&f.implementsDomRange&&function(){var t=window.getSelection();if(t){for(var n=t.rangeCount,i=n>1,o=[],r=E(t),s=0;s<n;++s)o[s]=t.getRangeAt(s);var l=a.createTestElement(document,"",!1),u=l.appendChild(document.createTextNode(" ")),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)O=!1;else{var h=d.cloneRange();d.setStart(u,0),h.setEnd(u,3),h.setStart(u,2),t.addRange(d),t.addRange(h),O=2==t.rangeCount}}for(a.removeNode(l),t.removeAllRanges(),s=0;s<n;++s)0==s&&r?I?I(t,o[s]):(e.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),t.addRange(o[s])):t.addRange(o[s])}}(),f.selectionSupportsMultipleRanges=O,f.collapsedNonEditableSelectionsSupported=P;var L,B,j=!1;function F(e,t,n){var i=n?"end":"start",o=n?"start":"end";e.anchorNode=t[i+"Container"],e.anchorOffset=t[i+"Offset"],e.focusNode=t[o+"Container"],e.focusOffset=t[o+"Offset"]}function H(e){var t=e.nativeSelection;e.anchorNode=t.anchorNode,e.anchorOffset=t.anchorOffset,e.focusNode=t.focusNode,e.focusOffset=t.focusOffset}function W(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0,z(e)}function z(e){e.type=0==e.rangeCount?"None":i(e)?"Caret":"Range"}function G(t){var n;return t instanceof u?((n=e.createNativeRange(t.getDocument())).setEnd(t.endContainer,t.endOffset),n.setStart(t.startContainer,t.startOffset)):t instanceof d?n=t.nativeRange:f.implementsDomRange&&t instanceof a.getWindow(t.startContainer).Range&&(n=t),n}function U(e){if(!e.length||1!=e[0].nodeType)return!1;for(var t=1,n=e.length;t<n;++t)if(!a.isAncestorOf(e[0],e[t]))return!1;return!0}function q(e){var n=e.getNodes();if(!U(n))throw t.createError("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return n[0]}function X(e){return!!e&&void 0!==e.text}function V(e,t){var n=new d(t);e._ranges=[n],F(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed,z(e)}function K(t){if(t._ranges.length=0,"None"==t.docSelection.type)W(t);else{var n=t.docSelection.createRange();if(X(n))V(t,n);else{t.rangeCount=n.length;for(var i,o=g(n.item(0)),r=0;r<t.rangeCount;++r)(i=e.createRange(o)).selectNode(n.item(r)),t._ranges.push(i);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed,F(t,t._ranges[t.rangeCount-1],!1),z(t)}}}function Y(e,n){for(var i=e.docSelection.createRange(),o=q(n),r=g(i.item(0)),a=v(r).createControlRange(),s=0,l=i.length;s<l;++s)a.add(i.item(s));try{a.add(o)}catch(e){throw t.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}a.select(),K(e)}function $(e,t,n){this.nativeSelection=e,this.docSelection=t,this._ranges=[],this.win=n,this.refresh()}function Z(e){e.win=e.anchorNode=e.focusNode=e._ranges=null,e.rangeCount=e.anchorOffset=e.focusOffset=0,e.detached=!0,z(e)}T&&l(T,"createControlRange")&&(L=T.createControlRange(),s.areHostProperties(L,["item","add"])&&(j=!0)),f.implementsControlRange=j,i=A?function(e){return e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset}:function(e){return!!e.rangeCount&&e.getRangeAt(e.rangeCount-1).collapsed},l(S,"getRangeAt")?B=function(e,t){try{return e.getRangeAt(t)}catch(e){return null}}:A&&(B=function(t){var n=g(t.anchorNode),i=e.createRange(n);return i.setStartAndEnd(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),i.collapsed!==this.isCollapsed&&i.setStartAndEnd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset),i}),$.prototype=e.selectionPrototype;var J=[];function Q(e,t){for(var n,i,o=J.length;o--;)if(i=(n=J[o]).selection,"deleteAll"==t)Z(i);else if(n.win==e)return"delete"==t?(J.splice(o,1),!0):i;return"deleteAll"==t&&(J.length=0),null}var ee=function(e){if(e&&e instanceof $)return e.refresh(),e;var t=Q(e=b(e,"getNativeSelection")),i=n(e),o=N?w(e):null;return t?(t.nativeSelection=i,t.docSelection=o,t.refresh()):(t=new $(i,o,e),J.push({win:e,selection:t})),t};e.getSelection=ee,s.createAliasForDeprecatedMethod(e,"getIframeSelection","getSelection");var te,ne=$.prototype;function ie(e,n){for(var i,o=g(n[0].startContainer),r=v(o).createControlRange(),a=0,s=n.length;a<s;++a){i=q(n[a]);try{r.add(i)}catch(e){throw t.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),K(e)}if(!_&&A&&s.areHostMethods(S,["removeAllRanges","addRange"])){ne.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),W(this)};var oe=function(e,t){I(e.nativeSelection,t),e.refresh()};ne.addRange=D?function(t,n){if(j&&N&&this.docSelection.type==p)Y(this,t);else if(y(n)&&k)oe(this,t);else{var o;O?o=this.rangeCount:(this.removeAllRanges(),o=0);var r=G(t).cloneRange();try{this.nativeSelection.addRange(r)}catch(e){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==o+1){if(e.config.checkSelectionRanges){var a=B(this.nativeSelection,this.rangeCount-1);a&&!m(a,t)&&(t=new d(a))}this._ranges[this.rangeCount-1]=t,F(this,t,re(this.nativeSelection)),this.isCollapsed=i(this),z(this)}else this.refresh()}}:function(e,t){y(t)&&k?oe(this,e):(this.nativeSelection.addRange(G(e)),this.refresh())},ne.setRanges=function(e){if(j&&N&&e.length>1)ie(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;t<n;++t)this.addRange(e[t])}}}else{if(!(l(S,"empty")&&l(M,"select")&&j&&_))return t.fail("No means of selecting a Range or TextRange was found"),!1;ne.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var e;if(this.anchorNode)e=g(this.anchorNode);else if(this.docSelection.type==p){var t=this.docSelection.createRange();t.length&&(e=g(t.item(0)))}e&&(v(e).createTextRange().select(),this.docSelection.empty())}}catch(e){}W(this)},ne.addRange=function(t){this.docSelection.type==p?Y(this,t):(e.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,F(this,t,!1),z(this))},ne.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?ie(this,e):t&&this.addRange(e[0])}}if(ne.getRangeAt=function(e){if(e<0||e>=this.rangeCount)throw new 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==p?K(t):X(n)?V(t,n):W(t)};else if(l(S,"getRangeAt")&&typeof S.rangeCount==r)te=function(t){if(j&&N&&t.docSelection.type==p)K(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,o=t.rangeCount;n<o;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));F(t,t._ranges[t.rangeCount-1],re(t.nativeSelection)),t.isCollapsed=i(t),z(t)}else W(t)};else{if(!A||typeof S.isCollapsed!=o||typeof M.collapsed!=o||!f.implementsDomRange)return t.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;te=function(e){var t,n=e.nativeSelection;n.anchorNode?(t=B(n,0),e._ranges=[t],e.rangeCount=1,H(e),e.isCollapsed=i(e),z(e)):W(e)}}ne.refresh=function(e){var t=e?this._ranges.slice(0):null,n=this.anchorNode,i=this.anchorOffset;if(te(this),e){var o=t.length;if(o!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=i)return!0;for(;o--;)if(!m(t[o],this._ranges[o]))return!0;return!1}};var re,ae=function(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var i=0,o=n.length;i<o;++i)m(t,n[i])||e.addRange(n[i]);e.rangeCount||W(e)};function se(e,t){if(e.win.document!=g(t))throw new 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 o;this.rangeCount?(o=this.getRangeAt(0))["set"+(t?"Start":"End")](n,i):(o=e.createRange(this.win.document)).setStartAndEnd(n,i),this.setSingleRange(o,this.isBackward())}}function de(e){var t=[],n=new h(e.anchorNode,e.anchorOffset),i=new h(e.focusNode,e.focusOffset),o="function"==typeof e.getName?e.getName():"Selection";if(void 0!==e.rangeCount)for(var r=0,a=e.rangeCount;r<a;++r)t[r]=u.inspect(e.getRangeAt(r));return"["+o+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}ne.removeRange=j&&N?function(e){if(this.docSelection.type==p){for(var t=this.docSelection.createRange(),n=q(e),i=g(t.item(0)),o=v(i).createControlRange(),r=!1,a=0,s=t.length;a<s;++a)t.item(a)!==n||r?o.add(t.item(a)):r=!0;o.select(),K(this)}else ae(this,e)}:function(e){ae(this,e)},!_&&A&&f.implementsDomRange?(re=E,ne.isBackward=function(){return re(this)}):re=ne.isBackward=function(){return!1},ne.isBackwards=ne.isBackward,ne.toString=function(){for(var e=[],t=0,n=this.rangeCount;t<n;++t)e[t]=""+this._ranges[t];return e.join("")},ne.collapse=function(t,n){se(this,t);var i=e.createRange(t);i.collapseToPoint(t,n),this.setSingleRange(i),this.isCollapsed=!0},ne.collapseToStart=function(){if(!this.rangeCount)throw new 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)},R?ne.setBaseAndExtent=function(e,t,n,i){this.nativeSelection.setBaseAndExtent(e,t,n,i),this.refresh()}:k&&(ne.setBaseAndExtent=function(t,n,i,o){le(t,n),le(i,o),se(this,t),se(this,i);var r=e.createRange(node),s=-1==a.comparePoints(t,n,i,o);s?r.setStartAndEnd(i,o,t,n):r.setStartAndEnd(t,n,i,o),this.setSingleRange(r,s)}),ne.deleteFromDocument=function(){if(j&&N&&this.docSelection.type==p){for(var e,t=this.docSelection.createRange();t.length;)e=t.item(0),t.remove(e),a.removeNode(e);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var i=0,o=n.length;i<o;++i)n[i].deleteContents();this.addRange(n[o-1])}}},ne.eachRange=function(e,t){for(var n=0,i=this._ranges.length;n<i;++n)if(e(this.getRangeAt(n)))return t},ne.getAllRanges=function(){var e=[];return this.eachRange((function(t){e.push(t)})),e},ne.setSingleRange=function(e,t){this.removeAllRanges(),this.addRange(e,t)},ne.callMethodOnEachRange=function(e,t){var n=[];return this.eachRange((function(i){n.push(i[e].apply(i,t||[]))})),n},ne.setStart=ue(!0),ne.setEnd=ue(!1),e.rangePrototype.select=function(e){ee(this.getDocument()).setSingleRange(this,e)},ne.changeEachRange=function(e){var t=[],n=this.isBackward();this.eachRange((function(n){e(n),t.push(n)})),this.removeAllRanges(),n&&1==t.length?this.addRange(t[0],"backward"):this.setRanges(t)},ne.containsNode=function(e,t){return this.eachRange((function(n){return n.containsNode(e,t)}),!0)||!1},ne.getBookmark=function(e){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[e])}},ne.moveToBookmark=function(t){for(var n,i,o=[],r=0;n=t.rangeBookmarks[r++];)(i=e.createRange(this.win)).moveToBookmark(n),o.push(i);t.backward?this.setSingleRange(o[0],"backward"):this.setRanges(o)},ne.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},ne.restoreRanges=function(e){this.removeAllRanges();for(var t,n=0;t=e.ranges[n];++n)this.addRange(t,e.backward&&0==n)},ne.toHtml=function(){var e=[];return this.eachRange((function(t){e.push(u.toHtml(t))})),e.join("")},f.implementsTextRange&&(ne.getNativeTextRange=function(){var n;if(n=this.docSelection){var i=n.createRange();if(X(i))return i;throw t.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return e.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw t.createError("getNativeTextRange: selection contains no range")}),ne.getName=function(){return"WrappedSelection"},ne.inspect=function(){return de(this)},ne.detach=function(){Q(this.win,"delete"),Z(this)},$.detachAll=function(){Q(null,"deleteAll")},$.inspect=de,$.isDirectionBackward=y,e.Selection=$,e.selectionPrototype=ne,e.addShimListener((function(e){void 0===e.getSelection&&(e.getSelection=function(){return ee(e)}),e=null}))}));var j=!1,F=function(e){j||(j=!0,!E.initialized&&E.config.autoInitialize&&A())};return x&&("complete"==document.readyState?F():(s(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",F,!1),m(window,"load",F))),E}()}({get exports(){return Lv},set exports(e){Lv=e}});var Bv=Lv,jv={};!function(e){e.exports=function(e){return e.createModule("ClassApplier",["WrappedSelection"],(function(e,t){var n=e.dom,i=n.DomPosition,o=n.arrayContains,r=e.util,a=r.forEach,s="span",l=r.isHostMethod(document,"createElementNS");function u(e,t){for(var n in e)if(e.hasOwnProperty(n)&&!1===t(n,e[n]))return!1;return!0}function 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 f(e,t){if("object"==typeof e.classList)e.classList.add(t);else{var n="string"==typeof e.className,i=n?e.className:e.getAttribute("class");i?c(i,t)||(i+=" "+t):i=t,n?e.className=i:e.setAttribute("class",i)}}var p=function(){function e(e,t,n){return t&&n?" ":""}return function(t,n){if("object"==typeof t.classList)t.classList.remove(n);else{var i="string"==typeof t.className,o=i?t.className:t.getAttribute("class");o=o.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),e),i?t.className=o:t.setAttribute("class",o)}}}();function g(e){return"string"==typeof e.className?e.className:e.getAttribute("class")}function v(e){return e&&e.split(/\s+/).sort().join(" ")}function m(e){return v(g(e))}function y(e,t){return m(e)==m(t)}function b(e,t){for(var n=t.split(/\s+/),i=0,o=n.length;i<o;++i)if(!h(e,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 w(e,t,n,i,o){var r=e.node,a=e.offset,s=r,l=a;r==i&&a>o&&++l,r!=t||a!=n&&a!=n+1||(s=i,l+=o-n),r==t&&a>n+1&&--l,e.node=s,e.offset=l}function E(e,t,n){e.node==t&&e.offset>n&&--e.offset}function C(e,t,i,o){-1==i&&(i=t.childNodes.length);var r=e.parentNode,s=n.getNodeIndex(e);a(o,(function(e){w(e,r,s,t,i)})),t.childNodes.length==i?t.appendChild(e):t.insertBefore(e,t.childNodes[i])}function N(e,t){var i=e.parentNode,o=n.getNodeIndex(e);a(t,(function(e){E(e,i,o)})),n.removeNode(e)}function _(e,t,n,i,o){for(var r,a=[];r=e.firstChild;)C(r,t,n++,o),a.push(r);return N(e,o),a}function S(e,t){return _(e,e.parentNode,n.getNodeIndex(e),!0,t)}function M(e,t){var n=e.cloneRange();n.selectNodeContents(t);var i=n.intersection(e);return""!=(i?i.toString():"")}function T(e){for(var t,n=e.getNodes([3]),i=0;(t=n[i])&&!M(e,t);)++i;for(var o=n.length-1;(t=n[o])&&!M(e,t);)--o;return n.slice(i,o+1)}function A(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n,i,o,r=0,a=e.attributes.length;r<a;++r)if("class"!=(o=(n=e.attributes[r]).name)){if(null===n!=(null===(i=t.attributes.getNamedItem(o))))return!1;if(n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}function k(e,t){for(var n,i=0,r=e.attributes.length;i<r;++i)if(n=e.attributes[i].name,(!t||!o(t,n))&&e.attributes[i].specified&&"class"!=n)return!0;return!1}var R=n.getComputedStyleProperty,D="boolean"==typeof document.createElement("div").isContentEditable?function(e){return e&&1==e.nodeType&&e.isContentEditable}:function(e){return!(!e||1!=e.nodeType||"false"==e.contentEditable)&&("true"==e.contentEditable||D(e.parentNode))};function O(e){var t;return e&&1==e.nodeType&&((t=e.parentNode)&&9==t.nodeType&&"on"==t.designMode||D(e)&&!D(e.parentNode))}function P(e){return(D(e)||1!=e.nodeType&&D(e.parentNode))&&!O(e)}var I=/^inline(-block|-table)?$/i;function L(e){return e&&1==e.nodeType&&!I.test(R(e,"display"))}var B=/[^\r\n\t\f \u200B]/;function j(e){if(0==e.data.length)return!0;if(B.test(e.data))return!1;switch(R(e.parentNode,"whiteSpace")){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(e.data))return!1}return L(e.previousSibling)||L(e.nextSibling)}function F(e){var t,n,o=[];for(t=0;n=e[t++];)o.push(new i(n.startContainer,n.startOffset),new i(n.endContainer,n.endOffset));return o}function H(e,t){for(var n,i,o,r=0,a=e.length;r<a;++r)n=e[r],i=t[2*r],o=t[2*r+1],n.setStartAndEnd(i.node,i.offset,o.node,o.offset)}function W(e,t){return n.isCharacterDataNode(e)?0==t?!!e.previousSibling:t!=e.length||!!e.nextSibling:t>0&&t<e.childNodes.length}function z(e,i,o,r){var a,s,l=0==o;if(n.isAncestorOf(i,e))return e;if(n.isCharacterDataNode(i)){var u=n.getNodeIndex(i);if(0==o)o=u;else{if(o!=i.length)throw t.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+o+" in "+i.data);o=u+1}i=i.parentNode}if(W(i,o)){a=i.cloneNode(!1),s=i.parentNode,a.id&&a.removeAttribute("id");for(var d,c=0;d=i.childNodes[o];)C(d,a,c++,r);return C(a,s,n.getNodeIndex(i)+1,r),i==e?a:z(e,s,n.getNodeIndex(a),r)}if(e!=i){a=i.parentNode;var h=n.getNodeIndex(i);return l||h++,z(e,a,h,r)}return e}function G(e,t){return e.namespaceURI==t.namespaceURI&&e.tagName.toLowerCase()==t.tagName.toLowerCase()&&y(e,t)&&A(e,t)&&"inline"==R(e,"display")&&"inline"==R(t,"display")}function U(e){var t=e?"nextSibling":"previousSibling";return function(n,i){var o=n.parentNode,r=n[t];if(r){if(r&&3==r.nodeType)return r}else if(i&&(r=o[t])&&1==r.nodeType&&G(o,r)){var a=r[e?"firstChild":"lastChild"];if(a&&3==a.nodeType)return a}return null}}var q=U(!1),X=U(!0);function V(e){this.isElementMerge=1==e.nodeType,this.textNodes=[];var t=this.isElementMerge?e.lastChild:e;t&&(this.textNodes[0]=t)}V.prototype={doMerge:function(e){var t=this.textNodes,i=t[0];if(t.length>1){var o,r=n.getNodeIndex(i),s=[],l=0;a(t,(function(u,d){o=u.parentNode,d>0&&(o.removeChild(u),o.hasChildNodes()||n.removeNode(o),e&&a(e,(function(e){e.node==u&&(e.node=i,e.offset+=l),e.node==o&&e.offset>r&&(--e.offset,e.offset==r+1&&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 $(e,t,n){var i,o,r,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,o=0;a=K[o++];)t.hasOwnProperty(a)&&(s[a]=t[a]);i=t.normalize}else i=t;s.normalize=void 0===i||i,s.attrExceptions=[];var h=document.createElement(s.elementTagName);s.elementProperties=s.copyPropertiesToElement(l,h,!0),u(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 f=typeof n;if("string"==f)"*"==n?s.applyToAnyTagName=!0:s.tagNames=d(n.toLowerCase()).split(/\s*,\s*/);else if("object"==f&&"number"==typeof n.length)for(s.tagNames=[],o=0,r=n.length;o<r;++o)"*"==n[o]?s.applyToAnyTagName=!0:s.tagNames.push(n[o].toLowerCase());else s.tagNames=[s.elementTagName]}function Z(e,t,n){return new $(e,t,n)}$.prototype={elementTagName:s,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(e,t,n){var i,o,r,a,s,l,u={};for(var d in e)if(e.hasOwnProperty(d))if(a=e[d],s=t[d],"className"==d)f(t,a),f(t,this.className),t[d]=v(t[d]),n&&(u[d]=a);else if("style"==d){for(i in o=s,n&&(u[d]=r={}),e[d])e[d].hasOwnProperty(i)&&(o[i]=a[i],n&&(r[i]=o[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 o(this.tagNames,e.tagName.toLowerCase())},getEmptyElements:function(e){var t=this;return e.getNodes([1],(function(e){return t.appliesToElement(e)&&!e.hasChildNodes()}))},hasClass:function(e){return 1==e.nodeType&&(this.applyToAnyTagName||this.appliesToElement(e))&&h(e,this.className)},getSelfOrAncestorWithClass:function(e){for(;e;){if(this.hasClass(e))return e;e=e.parentNode}return null},isModifiable:function(e){return!this.applyToEditableOnly||P(e)},isIgnorableWhiteSpaceNode:function(e){return this.ignoreWhiteSpace&&e&&3==e.nodeType&&j(e)},postApply:function(e,t,n,i){var o,r,s=e[0],l=e[e.length-1],u=[],d=s,c=l,h=0,f=l.length;a(e,(function(e){(r=q(e,!i))?(o||(o=new V(r),u.push(o)),o.textNodes.push(e),e===s&&(d=o.textNodes[0],h=d.length),e===l&&(c=o.textNodes[0],f=o.getLength())):o=null}));var p=X(l,!i);if(p&&(o||(o=new V(l),u.push(o)),o.textNodes.push(p)),u.length){for(var g=0,v=u.length;g<v;++g)u[g].doMerge(n);t.setStartAndEnd(d,h,c,f)}},createContainer:function(e){var t=n.getDocument(e),i=l&&!n.isHtmlNamespace(e)&&e.namespaceURI?t.createElementNS(e.namespaceURI,this.elementTagName):t.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,i,!1),this.copyAttributesToElement(this.elementAttributes,i),f(i,this.className),this.onElementCreate&&this.onElementCreate(i,this),i},elementHasProperties:function(e,t){var n=this;return u(t,(function(t,i){if("className"==t)return b(e,i);if("object"==typeof i){if(!n.elementHasProperties(e[t],i))return!1}else if(e[t]!==i)return!1}))},elementHasAttributes:function(e,t){return u(t,(function(t,n){if(e.getAttribute(t)!==n)return!1}))},applyToTextNode:function(e,t){if(x(e)){var n=e.parentNode;if(1==n.childNodes.length&&this.useExistingElements&&this.appliesToElement(n)&&this.elementHasProperties(n,this.elementProperties)&&this.elementHasAttributes(n,this.elementAttributes))f(n,this.className);else{var i=e.parentNode,o=this.createContainer(i);i.insertBefore(o,e),o.appendChild(e)}}},isRemovable:function(e){return e.tagName.toLowerCase()==this.elementTagName&&m(e)==this.elementSortedClassName&&this.elementHasProperties(e,this.elementProperties)&&!k(e,this.attrExceptions)&&this.elementHasAttributes(e,this.elementAttributes)&&this.isModifiable(e)},isEmptyContainer:function(e){var t=e.childNodes.length;return 1==e.nodeType&&this.isRemovable(e)&&(0==t||1==t&&this.isEmptyContainer(e.firstChild))},removeEmptyContainers:function(e){var t=this,n=e.getNodes([1],(function(e){return t.isEmptyContainer(e)})),i=[e],o=F(i);a(n,(function(e){N(e,o)})),H(i,o)},undoToTextNode:function(e,t,n,i){if(!t.containsNode(n)){var o=t.cloneRange();o.selectNode(n),o.isPointInRange(t.endContainer,t.endOffset)&&(z(n,t.endContainer,t.endOffset,i),t.setEndAfter(n)),o.isPointInRange(t.startContainer,t.startOffset)&&(n=z(n,t.startContainer,t.startOffset,i))}this.isRemovable(n)?S(n,i):p(n,this.className)},splitAncestorWithClass:function(e,t,n){var i=this.getSelfOrAncestorWithClass(e);i&&z(i,e,t,n)},undoToAncestor:function(e,t){this.isRemovable(e)?S(e,t):p(e,this.className)},applyToRange:function(e,t){var n=this,i=F((t=t||[])||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e);var o=T(e);if(o.length){a(o,(function(e){n.isIgnorableWhiteSpaceNode(e)||n.getSelfOrAncestorWithClass(e)||!n.isModifiable(e)||n.applyToTextNode(e,i)}));var r=o[o.length-1];e.setStartAndEnd(o[0],0,r,r.length),n.normalize&&n.postApply(o,e,i,!1),H(t,i)}var s=n.getEmptyElements(e);a(s,(function(e){f(e,n.className)}))},applyToRanges:function(e){for(var t=e.length;t--;)this.applyToRange(e[t],e);return e},applyToSelection:function(t){var n=e.getSelection(t);n.setRanges(this.applyToRanges(n.getAllRanges()))},undoToRange:function(e,t){var n=this,i=F(t=t||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e,i);var o,r,s=T(e),l=s[s.length-1];if(s.length){n.splitAncestorWithClass(e.endContainer,e.endOffset,i),n.splitAncestorWithClass(e.startContainer,e.startOffset,i);for(var u=0,d=s.length;u<d;++u)o=s[u],(r=n.getSelfOrAncestorWithClass(o))&&n.isModifiable(o)&&n.undoToAncestor(r,i);e.setStartAndEnd(s[0],0,l,l.length),n.normalize&&n.postApply(s,e,i,!0),H(t,i)}var c=n.getEmptyElements(e);a(c,(function(e){p(e,n.className)}))},undoToRanges:function(e){for(var t=e.length;t--;)this.undoToRange(e[t],e);return e},undoToSelection:function(t){var n=e.getSelection(t),i=e.getSelection(t).getAllRanges();this.undoToRanges(i),n.setRanges(i)},isAppliedToRange:function(e){if(e.collapsed||""==e.toString())return!!this.getSelfOrAncestorWithClass(e.commonAncestorContainer);var t=e.getNodes([3]);if(t.length)for(var n,i=0;n=t[i++];)if(!this.isIgnorableWhiteSpaceNode(n)&&M(e,n)&&this.isModifiable(n)&&!this.getSelfOrAncestorWithClass(n))return!1;return!0},isAppliedToRanges:function(e){var t=e.length;if(0==t)return!1;for(;t--;)if(!this.isAppliedToRange(e[t]))return!1;return!0},isAppliedToSelection:function(t){var n=e.getSelection(t);return this.isAppliedToRanges(n.getAllRanges())},toggleRange:function(e){this.isAppliedToRange(e)?this.undoToRange(e):this.applyToRange(e)},toggleSelection:function(e){this.isAppliedToSelection(e)?this.undoToSelection(e):this.applyToSelection(e)},getElementsWithClassIntersectingRange:function(e){var t=[],n=this;return e.getNodes([3],(function(e){var i=n.getSelfOrAncestorWithClass(e);i&&!o(t,i)&&t.push(i)})),t},detach:function(){}},$.util={hasClass:h,addClass:f,removeClass:p,getClass:g,hasSameClasses:y,hasAllClasses:b,replaceWithOwnChildren:S,elementsHaveSameNonClassAttributes:A,elementHasNonClassAttributes:k,splitNodeAt:z,isEditableElement:D,isEditingHost:O,isEditable:P},e.CssClassApplier=e.ClassApplier=$,e.createClassApplier=Z,r.createAliasForDeprecatedMethod(e,"createCssClassApplier","createClassApplier",t)})),e}(Lv)}({get exports(){return jv},set exports(e){jv=e}});var Fv={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 Hv(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),o=(null==e?void 0:e.Extension)||(null==e?void 0:e.Extension),r=i||o;return r?r.extend({name:"colorpicker",tagNames:["mark"],contentDefault:"<b>Color</b>",aria:"Color Picker",action:"colorPicker",init:function(){var e,t,n=this;try{Bv.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 Pv({parent:this.button||void 0,color:"#000",onDone:function(e){var t,i,o,r,a;try{n.coloredText&&(null===(i=(t=n.coloredText).isAppliedToSelection)||void 0===i?void 0:i.call(t))&&n.coloredText.undoToSelection(),n.coloredText=Bv.createClassApplier("colored",{elementTagName:"span",elementProperties:{style:{color:e.hex}},normalize:!0}),n.coloredText.toggleSelection(),null===(r=null===(o=n.base)||void 0===o?void 0:o.checkContentChanged)||void 0===r||r.call(o),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 Wv=function(e){function n(t){var n=e.call(this,t)||this;n.labelMap=new Map;var i=t.lf,o=t.graphModel;return n.lf=i,n.graphModel=o,n.state={tick:0},n}return p(n,e),n.prototype.componentDidMount=function(){var e=this,t=this.props.graphModel;this.editor=new xv(".lf-label-editor",bc(Fv,{autoLink:!0,extensions:{colorPicker:new(Hv(xv))}})),t.eventCenter.on("text:update,node:mousemove,node:resize,node:rotate,node:drag,label:drop,node:drop",(function(){})),t.eventCenter.on("node:properties-change,node:properties-delete",(function(){e.setState({tick:e.state.tick+1})}))},n.prototype.componentDidUpdate=function(){var e;this.editor&&this.editor.elements.length>0?this.editor.addElements(".lf-label-editor"):(null===(e=this.editor)||void 0===e||e.destroy(),this.editor=new xv(".lf-label-editor",bc(Fv,{autoLink:!0,extensions:{colorPicker:new(Hv(xv))}})))},n.prototype.componentWillUnmount=function(){var e;null===(e=this.editor)||void 0===e||e.destroy()},n.prototype.getLabels=function(){var e=this,t=this.props,n=t.lf.extension,i=t.graphModel,o=E(E([],w(i.nodes),!1),w(i.edges),!1);if(n.label){var r=[];return Eu(o,(function(t){var n,o;Eu(null!==(o=null===(n=t.getData().properties)||void 0===n?void 0:n._label)&&void 0!==o?o:[],(function(n){var o=e.labelMap,a=new yv(n,t,i);o.set(a.id,a),r.push(Pp(vv,{label:a,element:t,graphModel:i},a.id))}))})),r}return null},n.prototype.render=function(){return Pp("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},n.toolName="label-edit-tool",n=m([t.observer],n)}(t.Component),zv=function(){function e(e){var n,i,o,r=e.lf,a=e.options;this.labelInitPositionMap=new Map,this.lf=r,this.options=null!=a?a:{},this.textOverflowMode=null!==(n=a.textOverflowMode)&&void 0!==n?n:"default",this.isMultiple=null===(i=a.isMultiple)||void 0===i||i,this.labelWidth=a.labelWidth,this.maxCount=null!==(o=a.maxCount)&&void 0!==o?o:1/0,r.graphModel.editConfigModel.updateTextMode(t.TextMode.LABEL),this.addEventListeners(),this.rewriteShortcut(),r.tool.registerTool(Wv.toolName,Wv),r.tool.disableTool("text-edit-tool")}return e.prototype.formatConfig=function(e,n){var i=e.editConfigModel,o=i.nodeTextEdit,r=i.edgeTextEdit,a=i.nodeTextDraggable,s=i.edgeTextDraggable,l=this,u=l.textOverflowMode,d=l.isMultiple,c=l.maxCount,h=l.labelWidth,f=n.text,p=n.zIndex,v=n.properties,m=v._label,y=v._labelOption,b=m,x=void 0===y?{}:y,w=x.isMultiple,E=x.maxCount,C=[];if(it(b)){var N=null!=E?E:c;C=d&&w?b.length>N?b.slice(0,N):b:[b[0]]}else if(pt(b))C=[b];else if("string"==typeof b||!b){var _=g(g({},f),{content:b||(null==f?void 0:f.value),draggable:"edge"===n.BaseType?s:a});C=_.value?[_]:[]}return"edge"===n.BaseType&&(C=ed(C,(function(e){return e}))),ed(C,(function(e){e.id||(e.id=t.createUuid());var i=e.value,l=e.content,d=e.vertical,c=e.editable,f=e.draggable,v=e.textOverflowMode,m="node"===n.BaseType?o:r,y="node"===n.BaseType?a:s;return g(g({},e),{zIndex:p,labelWidth:h,content:null!=l?l:i,vertical:null!=d&&d,editable:Boolean(m)&&c,draggable:Boolean(y)&&f,textOverflowMode:null!=v?v:u})}))},e.prototype.setupLabels=function(e){var t=this;Eu(e.sortElements,(function(n){t.rewriteInnerMethods(n);var i=t.formatConfig(e,n);n.setProperty("_label",i)}))},e.prototype.addLabel=function(e,n){var i,o,r,a=this.isMultiple,s=this.maxCount,l=e.properties,u=null!==(i=l._label)&&void 0!==i?i:[],d=null!==(o=l._labelOption)&&void 0!==o?o:{},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!==(r=null==d?void 0:d.maxCount)&&void 0!==r?r:s)||(u.push(h),e.setProperty("_label",u))},e.prototype.addEventListeners=function(){var e=this,n=this.lf.graphModel,i=n.eventCenter,o=n.editConfigModel;i.on("graph:rendered",(function(t){var n=t.graphModel;e.setupLabels(n)})),i.on("node:dbclick,edge:dbclick",(function(i){var r=i.e,a=i.data,s=n.getElement(a.id),l=n.getPointByClient({x:r.clientX,y:r.clientY}).canvasOverlayPosition,u={x:l.x,y:l.y};s&&o.textMode===t.TextMode.LABEL&&e.addLabel(s,u)})),i.on("node:resize",(function(e){var t,n,i=e.preData,o=e.data,r=e.model,a=null!==(t=i.properties)&&void 0!==t?t:{},s=a.width,l=a.height,u=a._label,d=void 0===u?[]:u,c=null!==(n=o.properties)&&void 0!==n?n:{},h=c.width,f=c.height;if(s&&l&&h&&f){var p={x:i.x,y:i.y,width:s,height:l},v={x:o.x,y:o.y,width:h,height:f},m=ed(d,(function(e){var t,n,i,o,r,a,s,l,u,d,c,h=e.x,f=e.y,m=(n=v,i={x:h,y:f},o=(t=p).x,r=t.y,a=t.width,s=t.height,l=n.x,u=n.y,d=n.width,c=n.height,{x:l+(i.x-o)/a*d,y:u+(i.y-r)/s*c});return g(g({},e),m)}));r.setProperty("_label",m)}})),i.on("node:rotate",(function(t){var n=t.model,i=n.x,o=n.y,r=n.rotate,a=n.properties._label,s={x:i,y:o},l=ed(void 0===a?[]:a,(function(t){if(!t.id)return t;var n={x:t.x,y:t.y};e.labelInitPositionMap.has(t.id)?n=e.labelInitPositionMap.get(t.id):e.labelInitPositionMap.set(t.id,n);var i=r*(180/Math.PI);i<0&&(i+=360);var o=i*(Math.PI/180),a=Qg(n,s,o);return g(g(g({},t),a),{rotate:i})}));n.setProperty("_label",l)})),i.on("node:dnd-add,node:add,edge:add",(function(t){var i=t.data,o=n.getElement(i.id);if(o){e.rewriteInnerMethods(o);var r=o.properties._label;if(!it(r)||0===r.length||!r[0].id){var a=e.formatConfig(n,i);o.setProperty("_label",a)}}}))},e.prototype.rewriteInnerMethods=function(e){e.moveText=function(t,n){if(e.text){var i=e.text,o=i.x,r=i.y,a=i.value,s=i.draggable,l=i.editable;e.text={value:a,editable:l,draggable:s,x:o+t,y:r+n};var u=js(e.getProperties());if(it(u._label)){var d=ed(u._label,(function(e){return g(g({},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,o=n.graphModel,r=i.options.keyboard;i.off(["backspace"]),i.on(["backspace"],(function(){if(!(null==r?void 0:r.enabled))return!0;if(o.textEditElement)return!0;var n=o.getSelectElements(!0);e.lf.clearSelectElements();var i=e.lf.graphModel.editConfigModel;return n.edges.forEach((function(n){var r=n.properties;if(r&&!Vd(r._label)&&i.textMode===t.TextMode.LABEL){var a=r._label.filter((function(e){return!e.isSelected}));if(!Kd(a.length,r._label.length)){var s=o.getEdgeModelById(n.id);return void(null==s||s.setProperty("_label",a))}}n.id&&e.lf.deleteEdge(n.id)})),n.nodes.forEach((function(n){var r=n.properties;if(r&&!Vd(r._label)&&i.textMode===t.TextMode.LABEL){var a=r._label.filter((function(e){return!e.isSelected}));if(!Kd(a.length,r._label.length)){var s=o.getNodeModelById(n.id);return void(null==s||s.setProperty("_label",a))}}n.id&&e.lf.deleteNode(n.id)})),!1}))},e.prototype.updateTextMode=function(e){var n=this.lf.graphModel.editConfigModel;e!==n.textMode&&(n.updateTextMode(e),e===t.TextMode.LABEL?(this.lf.tool.enableTool(Wv.toolName),this.lf.tool.disableTool("text-edit-tool")):e===t.TextMode.TEXT&&(this.lf.tool.enableTool("text-edit-tool"),this.lf.tool.disableTool(Wv.toolName)))},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="label",e}(),Gv={};function Uv(e){return e.startsWith("data:text/plain")}function qv(e){return y(this,void 0,void 0,(function(){return b(this,(function(t){return Gv[e]?[2,Gv[e]]:[2,new Promise((function(t,n){try{fetch(e).then((function(e){return e.blob()})).then((function(i){var o=new FileReader;o.onloadend=function(){t(Gv[e]=o.result)},o.onerror=n,o.readAsDataURL(i)})).catch((function(){t(Gv[e]=e)}))}catch(t){return Gv[e]=e}}))]}))}))}function Xv(e,t){return y(this,void 0,void 0,(function(){var n,i;return b(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),(n=e.getAttribute(t)||"").startsWith("data:")?[2]:[4,qv(n)];case 1:return Uv(i=o.sent())?[2]:(e.setAttribute(t,i),[3,3]);case 2:return o.sent(),[3,3];case 3:return[2]}}))}))}function Vv(e,t){return y(this,void 0,void 0,(function(){var n;return b(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t.startsWith("data:")?[2]:[4,qv(t)];case 1:return Uv(n=i.sent())?[2]:(e.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return i.sent(),[3,3];case 3:return[2]}}))}))}function Kv(e){return y(this,void 0,void 0,(function(){var t,n,i,o,r,a,s,l,u;return b(this,(function(d){switch(d.label){case 0:for(t=[e],i=[];t.length;)(n=t.shift()).children.length&&t.push.apply(t,E([],w(n.children),!1)),n instanceof HTMLElement&&(o=n.style,r=o.background,a=o.backgroundImage,(s=r.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(u=s[1],i.push(Vv(n,u))),(l=a.match(/url\(["']?(.*?)["']?\)/))&&l[1]&&(u=l[1],i.push(Vv(n,u)))),n instanceof HTMLImageElement?i.push(Xv(n,"src")):n instanceof SVGImageElement&&i.push(Xv(n,"href"));return[4,Promise.all(i)];case 1:return d.sent(),[2]}}))}))}function Yv(e,t,n){var i=document.createElement("canvas");i.width=t,i.height=n;var o=i.getContext("2d");return o&&o.drawImage(e,0,0,e.width,e.height,0,0,t,n),i}var $v=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.customCssRules="",this.useGlobalRules=!0,t.getSnapshot=function(e,t){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshot(e,t)];case 1:return[2,n.sent()]}}))}))},t.getSnapshotBlob=function(e,t,i){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBlob(e,t,i)];case 1:return[2,n.sent()]}}))}))},t.getSnapshotBase64=function(e,t,i){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBase64(e,t,i)];case 1:return[2,n.sent()]}}))}))}}return e.prototype.getSvgRootElement=function(e){return e.container.querySelector(".lf-canvas-overlay")},e.prototype.triggerDownload=function(e){var t=new MouseEvent("click",{view:document.defaultView,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",this.fileName),n.setAttribute("href",e),n.setAttribute("target","_blank"),n.dispatchEvent(t)},e.prototype.removeAnchor=function(e){for(var t=e.childNodes,n=e.childNodes&&e.childNodes.length,i=0;i<n;i++){var o=t[i];(o.classList&&Array.from(o.classList)||[]).indexOf("lf-anchor")>-1&&(e.removeChild(e.childNodes[i]),n--,i--)}},e.prototype.removeRotateControl=function(e){for(var t=e.childNodes,n=e.childNodes&&e.childNodes.length,i=0;i<n;i++){var o=t[i];(o.classList&&Array.from(o.classList)||[]).indexOf("lf-rotate-control")>-1&&(e.removeChild(e.childNodes[i]),n--,i--)}},e.prototype.convertImageToBase64=function(e){return y(this,void 0,void 0,(function(){return b(this,(function(t){return[2,new Promise((function(t,n){var i=new Image;i.crossOrigin="anonymous",i.onload=function(){var e=document.createElement("canvas");e.width=i.width,e.height=i.height;var n=e.getContext("2d");null==n||n.drawImage(i,0,0);var o=e.toDataURL("image/png");t(o)},i.onerror=function(){n(new Error("Failed to load image: ".concat(e)))},i.src=e}))]}))}))},e.prototype.isRelativePath=function(e){return!(e.startsWith("data:")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//"))},e.prototype.processImages=function(e){return y(this,void 0,void 0,(function(){var t,n,i,o,r,a,s,l,u,d;return b(this,(function(c){switch(c.label){case 0:t=e.getElementsByTagName("image"),o=0,c.label=1;case 1:if(!(o<t.length))return[3,6];if(l=t[o],!(n=l.getAttributeNS("http://www.w3.org/1999/xlink","href")||l.getAttribute("href"))||!this.isRelativePath(n))return[3,5];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 o++,[3,1];case 6:i=e.getElementsByTagName("foreignObject"),o=0,c.label=7;case 7:if(!(o<i.length))return[3,14];r=i[o],a=r.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 o++,[3,7];case 14:return[2]}}))}))},e.prototype.cloneSvg=function(e){return y(this,arguments,void 0,(function(e,t){var n,i,o,r,a,s,l,u,d,c,h=this;return void 0===t&&(t=!0),b(this,(function(f){switch(f.label){case 0:if(n=e.cloneNode(!0),i=n.lastChild,o=null===(c=null==i?void 0:i.childNodes)||void 0===c?void 0:c.length)for(r=0;r<o;r++)a=null==i?void 0:i.childNodes[r],(s=a.classList&&Array.from(a.classList))&&s.indexOf("lf-base")<0?(null==i||i.removeChild(i.childNodes[r]),o--,r--):(l=null==i?void 0:i.childNodes[r])&&l.childNodes.forEach((function(e){var t=e;h.removeAnchor(t.firstChild),h.removeRotateControl(t.firstChild)}));return[4,this.processImages(n)];case 1:return f.sent(),t&&((u=document.createElement("style")).innerHTML=this.getClassRules(),(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 o=0;o<i.cssRules.length;o++)e+=i.cssRules[o].cssText}catch(e){}}return this.customCssRules&&(e+=this.customCssRules),e},e.prototype.getCanvasScaleRatio=function(e,t){var n=32767,i=268435456,o=e*t;if(e<=n&&t<=n&&o<=i)return 1;var r=n/e,a=n/t,s=i/o;return Math.min(r,a,s)},e.prototype.getCanvasData=function(e,t){return y(this,void 0,void 0,(function(){var n,i,o,r,a,s,l,u,d,c,h,f,p,g,v,m,y,x,w,E,C,N,_,S,M,T,A,k,R,D,O,P,I,L,B;return b(this,(function(b){switch(b.label){case 0:return n=t.width,i=t.height,o=t.backgroundColor,r=t.padding,a=void 0===r?40:r,[4,this.cloneSvg(e,!1)];case 1:return s=b.sent(),(l=window.devicePixelRatio||1)<1&&(l=1),u=this.lf.graphModel.rootEl.querySelector(".lf-base"),d=u.getBoundingClientRect(),c=this.lf.container.querySelector(".lf-canvas-overlay"),h=c.getBoundingClientRect(),f=d.x-h.x,p=d.y-h.y,g=this.lf.graphModel,v=g.transformModel,m=v.SCALE_X,y=v.SCALE_Y,x=v.TRANSLATE_X,w=v.TRANSLATE_Y,E=t.safetyFactor||1,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"),k=t.safetyMargin||0,R=M*l,D=T*l,(O=this.getCanvasScaleRatio(R,D))<1&&(R=Math.floor(R*O),D=Math.floor(D*O)),s.lastChild.style.transform="matrix(".concat(O,", 0, 0, ").concat(O,", ").concat((-f+x)*(1/m)*O+a+_/2+k,", ").concat((-p+w)*(1/y)*O+a+S/2+k,")"),A.width=R+2*(a+k)*l,A.height=D+2*(a+k)*l,(P=A.getContext("2d"))&&(P.clearRect(0,0,A.width,A.height),P.scale(l,l),o?(P.fillStyle=o,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?Yv(A,n,i).width:A.width,resizeHeight:n&&i?Yv(A,n,i).height:A.height}).then((function(t){null==P||P.drawImage(t,0,0),e(n&&i?Yv(A,n,i):A)})):(null==P||P.drawImage(I,0,0),e(n&&i?Yv(A,n,i):A))}catch(t){null==P||P.drawImage(I,0,0),e(n&&i?Yv(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 y(this,void 0,void 0,(function(){var n,i,o,r,a,s=this;return b(this,(function(l){switch(l.label){case 0:n=this.lf.graphModel.getPartial(),i=(null!=t?t:{}).partial,o=void 0===i?n:i,r=this.lf.getEditConfig(),this.lf.updateEditConfig({isSilentMode:!0,stopScrollGraph:!0,stopMoveGraph:!0}),l.label=1;case 1:return l.trys.push([1,,6,7]),n===o?[3,3]:(this.lf.graphModel.setPartial(o),[4,new Promise((function(t){s.lf.graphModel.eventCenter.once("graph:updated",(function(){return y(s,void 0,void 0,(function(){var i;return b(this,(function(o){switch(o.label){case 0:return[4,e()];case 1:return i=o.sent(),this.lf.graphModel.setPartial(n),t(i),[2]}}))}))}))}))]);case 2:return a=l.sent(),[3,5];case 3:return[4,e()];case 4:a=l.sent(),l.label=5;case 5:return[3,7];case 6:return this.lf.updateEditConfig(r),[7];case 7:return[2,a]}}))}))},e.prototype.getSnapshot=function(e,t){return y(this,void 0,void 0,(function(){var n=this;return b(this,(function(i){switch(i.label){case 0:return[4,this.withExportPreparation((function(){return n.snapshot(e,t)}),t)];case 1:return i.sent(),[2]}}))}))},e.prototype.snapshot=function(e,t){return y(this,void 0,void 0,(function(){var n,i,o,r,a,s,l,u,d,c=this;return b(this,(function(h){switch(h.label){case 0:return i=(n=null!=t?t:{}).fileType,o=void 0===i?"png":i,r=n.quality,this.fileName="".concat(null!=e?e:"logic-flow.".concat(Date.now()),".").concat(o),[4,Kv(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"!==o?[3,3]:[4,this.cloneSvg(a)];case 2:return s=h.sent(),l=(new XMLSerializer).serializeToString(s),u=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),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(o),r).replace("image/".concat(o),"image/octet-stream");c.triggerDownload(t)})),h.label=4;case 4:return[2]}}))}))},e.prototype.getSnapshotBlob=function(e,t,n){return y(this,void 0,void 0,(function(){var i=this;return b(this,(function(o){switch(o.label){case 0:return[4,this.withExportPreparation((function(){return i.snapshotBlob(n,t,e)}),n)];case 1:return[2,o.sent()]}}))}))},e.prototype.snapshotBlob=function(e,t,n){return y(this,void 0,void 0,(function(){var i,o,r,a,s,l=this;return b(this,(function(u){switch(u.label){case 0:return i=(null!=e?e:{}).fileType,o=void 0===i?t:i,[4,Kv(r=this.getSvgRootElement(this.lf))];case 1:return u.sent(),"svg"!==o?[3,3]:[4,this.cloneSvg(r)];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(r,g({backgroundColor:n},null!=e?e:{})).then((function(e){e.toBlob((function(n){t({data:n,width:e.width,height:e.height})}),"image/".concat(null!=o?o:"png"))}))}))]}}))}))},e.prototype.getSnapshotBase64=function(e,t,n){return y(this,void 0,void 0,(function(){var i=this;return b(this,(function(o){switch(o.label){case 0:return[4,this.withExportPreparation((function(){return i._getSnapshotBase64(e,t,n)}),n)];case 1:return[2,o.sent()]}}))}))},e.prototype._getSnapshotBase64=function(e,t,n){return y(this,void 0,void 0,(function(){var i,o,r,a=this;return b(this,(function(s){switch(s.label){case 0:return i=(null!=n?n:{}).fileType,o=void 0===i?t:i,[4,Kv(r=this.getSvgRootElement(this.lf))];case 1:return s.sent(),[2,new Promise((function(t){a.getCanvasData(r,g({backgroundColor:e},null!=n?n:{})).then((function(e){var n=e.toDataURL("image/".concat(null!=o?o:"png"));t({data:n,width:e.width,height:e.height})}))}))]}}))}))},e.pluginName="snapshot",e}(),Zv=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.paths=[],t.getPathes=function(){if(!n.startNodeType)throw new Error("需要预先指定开始节点类型");return n.getPathes()},t.setRawPaths=function(e){n.setPathes(e)},t.getRawPathes=function(){return n.paths},t.setStartNodeType=function(e){n.startNodeType=e}}return e.prototype.setPathes=function(e){this.paths=e.map((function(e){return{routeId:e.routeId,name:e.name,elements:e.elements,type:e.type,similarElement:null,weight:0}}))},e.prototype.getPathes=function(){var e=this,t=this.lf.getGraphRawData(),n=new Map,i=[];t.nodes.forEach((function(t){n.set(t.id,{id:t.id,data:t,nextNodes:[]}),t.type===e.startNodeType&&i.push(t.id)})),t.edges.forEach((function(e){var t=n.get(e.sourceNodeId);null==t||t.nextNodes.push(e.targetNodeId)}));var o=[];return i.forEach((function(t){var i=n.get(t);i&&(o=o.concat(e.findPathElements(i,n,[])))})),this.getNewPathes(o)},e.prototype.findPathElements=function(e,t,n){void 0===n&&(n=[]);var i=E([],w(n),!1);if(i.push(e.id),0===e.nextNodes.length)return[i];for(var o=[],r=0;r<e.nextNodes.length;r++){var a=t.get(e.nextNodes[r]),s=void 0;if(a){var l=i.indexOf(a.id);s=-1!==l?[E(E([],w(i.slice(l)),!1),[a.id],!1)]:this.findPathElements(a,t,E([],w(i),!1)),o=o.concat(s)}}return o},e.prototype.getNewPathes=function(e){var t=this,n=[],i=new Set;e.forEach((function(e){var o=t.getNewId("path"),r=t.getNewId("路径"),a=t.isLoopPath(e),s=e.join(",");i.has(s)||(i.add(s),n.push({routeId:o,name:r,elements:e,type:a,weight:0,similarElement:""}))}));var o=JSON.parse(JSON.stringify(this.paths));return n.forEach((function(e){for(var n=0;n<o.length;n++){var i=o[n],r=t.similar2Path(E([],w(e.elements),!1),E([],w(i.elements),!1));r>e.weight&&i.weight<=r&&(e.weight=r,e.similarElement=i,r===i.weight&&i.similarElement?(i.similarElement.similarElement=null,i.similarElement.weight=0,i.similarElement=null,i.weight=0):(i.similarElement=e,i.weight=r))}})),n.forEach((function(e){e.similarElement&&e.similarElement.similarElement===e&&(e.routeId=e.similarElement.routeId,e.name=e.similarElement.name),delete e.similarElement,delete e.weight})),this.setPathes(n),n},e.prototype.similar2Path=function(e,t){var n=0,i=e.length+t.length;e.sort(),t.sort();for(var o=e.shift(),r=t.shift();void 0!==o&&void 0!==r;)o===r?(n++,o=e.shift(),r=t.shift()):o<r?o=e.shift():o>r&&(r=t.shift());return n/i*200},e.prototype.getNewId=function(e){return"".concat(e,"_").concat(_())},e.prototype.isLoopPath=function(e){var t=e.length;return e.indexOf(e[t-1])!==t-1?1:0},e.pluginName="flowPath",e}(),Jv=-1,Qv=0,em=1,tm=function(){function e(e){var t=e.lf,n=this;this.levelHeight=[],this.newNodeMap=new Map,this.lf=t,this.trunk=[],t.layout=function(e){var t=n.lf.getGraphRawData();n.lf.setStartNodeType(e);var i=n.lf.getPathes();return n.levelHeight=[],n.newNodeMap=new Map,n.layout(t,i)}}return e.prototype.layout=function(e,t){var n=this,i=[];t.forEach((function(e){var t=e.elements;t.length>i.length?i=t:t.length===i.length&&JSON.stringify(t)===JSON.stringify(n.trunk)&&(i=n.trunk)})),this.trunk=i;for(var o=this.formatData(e),r={nodes:[],edges:[]},a=i.length-1;a>=0;a--)this.setNodePosition(i[a],o,r,a,1);this.lf.graphModel.graphDataToModel(r)},e.prototype.setNodePosition=function(e,t,n,i,o){var r=this,a=t[e],s=a.text,l=a.type,u=a.next,d=a.properties,c=160*i+40,h=120*o,f={id:e,x:c,text:s,y:h,type:l,properties:d};return s&&"object"==typeof s&&(f.text=g(g({},s),{x:c+s.x,y:h+s.y})),this.newNodeMap.set(f.id,{x:f.x,y:f.y,type:l}),n.nodes.push(f),a.isFixed=!0,this.addLevelHeight(i,1),u&&u.length>0&&u.forEach((function(o){if(!t[o.nodeId].isFixed){var a=r.getLevelHeight(i+1);r.addLevelHeight(i,1),r.setNodePosition(o.nodeId,t,n,i+1,a+1)}n.edges.push(g({id:o.edgeId,type:o.edgeType,sourceNodeId:e,targetNodeId:o.nodeId,properties:o.properties,text:o.text},r.getEdgeDataPoints(e,o.nodeId)))})),f},e.prototype.getEdgeDataPoints=function(e,t){var n=this.newNodeMap.get(e),i=this.newNodeMap.get(t),o=this.getShape(e),r=o.width,a=o.height,s=this.getShape(t),l=s.width,u=s.height,d=this.getRelativePosition(n,i),c={x:n.x,y:n.y},h={x:i.x,y:i.y};switch(d){case Qv:c.x=n.x+r/2,h.x=i.x-l/2;break;case Jv:c.y=n.y+a/2,h.x=i.x-l/2;break;case em:c.x=n.x+r/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,o=t.text,r=t.x,a=t.y;return o&&"object"==typeof o&&(o.x=o.x-r,o.y=o.y-a),e[t.id]={type:n,properties:i,text:o,prev:[],next:[]},e}),{});return e.edges.forEach((function(e){var n=e.sourceNodeId,i=e.targetNodeId,o=e.id,r=e.properties,a=e.text,s=a;"object"==typeof a&&(s=a.value),t[n].next.push({edgeId:o,nodeId:i,edgeType:e.type,properties:r,text:s}),t[i].prev.push({edgeId:o,nodeId:n,properties:r,text:s})})),t},e.prototype.addLevelHeight=function(e,t,n){void 0===t&&(t=1),void 0===n&&(n=!1);var i=this.levelHeight[e];i||(i={positiveHeight:0,negativeHeight:0},this.levelHeight[e]=i),n?i.negativeHeight-=t:i.positiveHeight+=t},e.prototype.getLevelHeight=function(e,t){void 0===t&&(t=!1);var n=this.levelHeight[e];return n?t?n.negativeHeight:n.positiveHeight:0},e.pluginName="AutoLayout",e}(),nm=function(){function e(e){var t=e.lf,n=e.options;this.enable=!0,this.type="default",this.currentDistance=1/0,this.thresholdDistance=100,this.reverseDirection=!1,this.virtualEdgeStyle={strokeDasharray:"10,10",stroke:"#acacac"},this.lf=t,uo(this,n)}return e.prototype.render=function(){this.addEventListeners()},e.prototype.addEventListeners=function(){var e=this;this.lf.graphModel.eventCenter.on("node:dragstart",(function(t){var n=t.data;if("anchor"!==e.type&&e.enable){var i=e.lf.graphModel,o=n.id;e.currentNode=i.getNodeModelById(o)}})),this.lf.graphModel.eventCenter.on("node:drag",(function(){"anchor"!==e.type&&e.handleNodeDrag()})),this.lf.graphModel.eventCenter.on("anchor:dragstart",(function(t){var n=t.data,i=t.nodeModel;e.enable&&"node"!==e.type&&(e.currentNode=i,e.currentAnchor=n)})),this.lf.graphModel.eventCenter.on("anchor:drag",(function(t){var n=t.e,i=n.clientX,o=n.clientY;e.enable&&"node"!==e.type&&e.handleAnchorDrag(i,o)})),this.lf.graphModel.eventCenter.on("node:drop",(function(){e.enable&&"anchor"!==e.type&&e.handleDrop()})),this.lf.graphModel.eventCenter.on("anchor:dragend",(function(n){var i=n.e,o=n.edgeModel;if(e.enable&&"node"!==e.type){var r=e.lf.graphModel.getPointByClient({x:i.clientX,y:i.clientY}).canvasOverlayPosition,a=r.x,s=r.y;if(o&&e.virtualEdge){var l=e.virtualEdge.id,u=o.targetNodeId,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(!tc(this.virtualEdge)){var n=this.virtualEdge,i=n.startPoint,o=n.endPoint,r=n.id;t.twoPointDistance(i,o)>this.thresholdDistance&&(this.lf.deleteEdge(r),this.virtualEdge=void 0)}this.currentNode&&this.findClosestAnchorOfNode(this.currentNode,e),this.currentDistance<this.thresholdDistance&&this.addVirtualEdge()},e.prototype.handleDrop=function(){this.addActualEdge(),this.resetData()},e.prototype.handleAnchorDrag=function(e,n){var i=this.lf.graphModel,o=i.getPointByClient({x:e,y:n}).canvasOverlayPosition,r=o.x,a=o.y;if(!tc(r)&&!tc(a)){var s={x:r,y:a},l=i.nodes;if(!tc(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(!tc(e)&&!Vd(e)){var o,r,a,s,l=e.anchors,u=void 0===l?[]:l,d=e.id;n.forEach((function(e){if(!Kd(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);(!o||u<o)&&(o=u,r=l,a=n,s=e)}}))}))}})),this.currentDistance=o,this.currentAnchor=r,this.closestAnchor=a,this.closestNode=s}},e.prototype.findClosestAnchorOfAnchor=function(e,n){var i=this;if(!tc(e)){var o,r,a,s=this.currentNode,l=this.currentAnchor;n.forEach((function(n){if(s){var u=n.anchors;(void 0===u?[]:u).forEach((function(s){var u;if(!Kd(null===(u=i.currentAnchor)||void 0===u?void 0:u.id,s.id)&&i.anchorAllowConnect(n,s,l)){var d=t.twoPointDistance(e,s);(!o||d<o)&&(o=d,r=s,a=n)}}))}})),this.currentDistance=o,this.closestAnchor=r,this.closestNode=a}},e.prototype.anchorAllowConnect=function(e,t,n){var i=this.currentNode;if(i){var o=(this.reverseDirection?e.isAllowConnectedAsSource(i,t,n):i.isAllowConnectedAsSource(e,n,t)).isAllPass,r=(this.reverseDirection?i.isAllowConnectedAsTarget(e,t,n):e.isAllowConnectedAsTarget(i,n,t)).isAllPass;return o&&r}},e.prototype.sameEdgeIsExist=function(e){if(tc(this.closestNode)||tc(this.currentNode)||tc(this.closestAnchor)||tc(this.currentAnchor))return!1;if(tc(e))return!1;var t=this,n=t.closestNode.id,i=t.currentNode.id,o=t.closestAnchor.id,r=t.currentAnchor.id,a=t.reverseDirection,s=e.sourceNodeId,l=e.targetNodeId,u=e.sourceAnchorId,d=e.targetAnchorId;return a?Kd(n,s)&&Kd(i,l)&&Kd(o,u)&&Kd(r,d):Kd(i,s)&&Kd(n,l)&&Kd(r,u)&&Kd(o,d)},e.prototype.addVirtualEdge=function(){var e=this,t=Hh(this.lf.graphModel.edges,(function(t,n){return n.virtual?t:t||e.sameEdgeIsExist(n)}),!1);if(!t){if(!tc(this.virtualEdge)){var n=this.virtualEdge.id;if(this.sameEdgeIsExist(this.virtualEdge))return;this.lf.deleteEdge(n)}var i=this,o=i.reverseDirection,r=i.currentNode,a=i.closestNode,s=i.currentAnchor,l=i.closestAnchor;if(!Vd(r)&&!Vd(a)){var u={style:this.virtualEdgeStyle};this.virtualEdge=this.lf.addEdge(o?{sourceNodeId:null==a?void 0:a.id,targetNodeId:null==r?void 0:r.id,sourceAnchorId:null==l?void 0:l.id,targetAnchorId:null==s?void 0:s.id,properties:u}:{sourceNodeId:null==r?void 0:r.id,targetNodeId:null==a?void 0:a.id,sourceAnchorId:null==s?void 0:s.id,targetAnchorId:null==l?void 0:l.id,properties:u}),this.virtualEdge.virtual=!0}}},e.prototype.addActualEdge=function(){if(!tc(this.virtualEdge)){var e=this.virtualEdge,t=e.type,n=e.sourceNodeId,i=e.targetNodeId,o=e.sourceAnchorId,r=e.targetAnchorId,a=e.startPoint,s=e.endPoint,l=e.pointsList;this.lf.deleteEdge(this.virtualEdge.id),this.lf.addEdge({type:t,sourceNodeId:n,targetNodeId:i,sourceAnchorId:o,targetAnchorId:r,startPoint:a,endPoint:s,pointsList:l})}},e.prototype.setVirtualEdgeStyle=function(e){this.virtualEdgeStyle=g(g({},this.virtualEdgeStyle),e)},e.prototype.setThresholdDistance=function(e){$d(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}(),im=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",o=document.createElement("div"),r=[];return o.className="lf-control-".concat(t," lf-control"),E([],w(this.controlItems),!1).forEach((function(o){var a=document.createElement("div"),s=document.createElement("i");if(a.className=i,o.onClick&&(a.onclick=o.onClick.bind(null,e.lf)),o.onMouseEnter&&(a.onmouseenter=o.onMouseEnter.bind(null,e.lf)),o.onMouseLeave&&(a.onmouseleave=o.onMouseLeave.bind(null,e.lf)),s.className=o.iconClass,tc(o.hideText)||!0!==o.hideText){var l=document.createElement("span");l.className="lf-control-text-".concat(t," lf-control-text"),l.title=o.title,l.innerText=o.text,a.append(s,l)}else a.append(s);switch(o.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}r.push(a)})),o.append.apply(o,E([],w(r),!1)),o},e.pluginName="control",e}(),om="lf:defaultNodeMenu",rm="lf:defaultEdgeMenu",am="lf:defaultGraphMenu",sm="lf:defaultSelectionMenu",lm={nodeMenu:om,edgeMenu:rm,graphMenu:am,selectionMenu:sm},um={nodeMenu:[],edgeMenu:[],graphMenu:[],selectionMenu:[]},dm=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;um.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(om,um.nodeMenu),um.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(rm,um.edgeMenu),um.graphMenu=[],um.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(sm,um.selectionMenu)},e.prototype.showMenu=function(e,t,n,i){if(!this.__isSilentMode&&n&&n.length){var o=this.__menuDOM;if(o){if(o.innerHTML="",o.append.apply(o,E([],w(this.__getMenuDom(n)),!1)),!o.children.length)return;if(o.style.display="block",!i)return o.style.top="".concat(t,"px"),void(o.style.left="".concat(e,"px"));var r=i.width,a=i.height,s=i.clientX,l=i.clientY,u=this.lf.graphModel,d=o.offsetWidth,c=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f=h-s,p=u.rootEl.getBoundingClientRect(),g=p.left+p.width;g<h&&(f=g-s),f<d&&(c=!1),o.style.left="".concat(c?e:e-r,"px");var v=o.offsetHeight,m=!0,y=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=y-l,x=p.top+p.height;x<y&&(b=x-l),b<v&&(m=!1),o.style.top="".concat(m?t:t-a,"px")}}},e.prototype.processMenuConfig=function(e,t){var n=this;if(e){["nodeMenu","edgeMenu","graphMenu","selectionMenu"].forEach((function(i){var o,r,a,s,l=e[i],u=lm[i];if(void 0!==l)if("set"===t)null===(o=n.menuTypeMap)||void 0===o||o.set(u,l||[]);else if("add"===t&&Array.isArray(l)){var d=null!==(a=null===(r=n.menuTypeMap)||void 0===r?void 0:r.get(u))&&void 0!==a?a:[];null===(s=n.menuTypeMap)||void 0===s||s.set(u,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 o=t;if(o.startsWith("data:image/")){var r=this.createImageElement(o,n||"icon");e.appendChild(r)}else if(this.isImageFile(o)){r=this.createImageElement(o,n||"icon");e.appendChild(r)}else if(o.includes("<")&&o.includes(">"))e.innerHTML=o;else if(o.includes(" ")||o.startsWith(".")){var a=o.replace(/^\./,"").split(" ");(i=e.classList).add.apply(i,E([],w(a),!1))}else e.classList.add(o)}},e.prototype.__getMenuDom=function(e){var t=this,n=[];return e&&e.length>0&&e.forEach((function(e){var i=document.createElement("li");if(e.className?i.className="lf-menu-item ".concat(e.disabled?"lf-menu-item__disabled":""," ").concat(e.className):i.className="lf-menu-item ".concat(e.disabled?"lf-menu-item__disabled":""),e.icon){var o=document.createElement("span");o.className="lf-menu-item-icon",t.processIcon(o,e.icon,e.text),i.appendChild(o)}var r=document.createElement("span");r.className="lf-menu-item-text",e.text&&(r.innerText=e.text),i.appendChild(r),e.disabled&&i.setAttribute("disabled","true"),i.onclickCallback=e.callback,n.push(i)})),n},e.prototype.updateMenuItemDOMStatus=function(e,t){if(this.__menuDOM&&"none"!==this.__menuDOM.style.display){var n=Array.from(this.__menuDOM.querySelectorAll(".lf-menu-item")).find((function(t){var n=t.querySelector(".lf-menu-item-text");return(null==n?void 0:n.textContent)===e}));if(n){var i=n;t?(i.classList.add("lf-menu-item__disabled"),i.setAttribute("disabled","true")):(i.classList.remove("lf-menu-item__disabled"),i.removeAttribute("disabled"))}}},e.prototype.setupSilentModeListener=function(){var e=this;this.__editConfigChangeHandler=function(t){var n=t.data.isSilentMode;n!==e.__isSilentMode&&(e.__isSilentMode=n,e.updateMenuVisibility(!n))},this.lf.on("editConfig:changed",this.__editConfigChangeHandler)},e.prototype.updateMenuVisibility=function(e){this.__menuDOM&&(e?this.__currentData&&(this.__menuDOM.style.display="block"):(this.__menuDOM.style.display="none",this.__currentData=null))},e.prototype.refreshCurrentMenu=function(){var e,t,n,i,o,r,a,s,l,u,d;if(this.__menuDOM&&"none"!==this.__menuDOM.style.display&&this.__currentData){var c=this.__menuDOM.style,h=c.left,f=c.top,p=[];if(this.__currentData&&"object"==typeof this.__currentData)if("sourceNodeId"in this.__currentData&&"targetNodeId"in this.__currentData){if(v=this.lf.graphModel.getEdgeModelById(this.__currentData.id)){var g=null===(t=this.menuTypeMap)||void 0===t?void 0:t.get(v.type);p=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(i=null===(n=this.menuTypeMap)||void 0===n?void 0:n.get(rm))&&void 0!==i?i:[])}}else if("id"in this.__currentData&&"type"in this.__currentData){var v;if(v=this.lf.graphModel.getNodeModelById(this.__currentData.id)){g=null===(o=this.menuTypeMap)||void 0===o?void 0:o.get(v.type);p=v.menu&&Array.isArray(v.menu)?v.menu:g||(null!==(a=null===(r=this.menuTypeMap)||void 0===r?void 0:r.get(om))&&void 0!==a?a:[])}}else p="nodes"in this.__currentData&&"edges"in this.__currentData?null!==(l=null===(s=this.menuTypeMap)||void 0===s?void 0:s.get(sm))&&void 0!==l?l:[]:null!==(d=null===(u=this.menuTypeMap)||void 0===u?void 0:u.get(am))&&void 0!==d?d:[];p&&p.length>0?(this.__menuDOM.innerHTML="",(e=this.__menuDOM).append.apply(e,E([],w(this.__getMenuDom(p)),!1)),h&&(this.__menuDOM.style.left=h),f&&(this.__menuDOM.style.top=f)):(this.__menuDOM.style.display="none",this.__currentData=null)}},e.prototype.setMenuByType=function(e){var t,n=e.type,i=e.menu;n&&i&&(null===(t=this.menuTypeMap)||void 0===t||t.set(n,i),this.refreshCurrentMenu())},e.prototype.getMenuConfig=function(e){var t,n;return null!==(n=null===(t=this.menuTypeMap)||void 0===t?void 0:t.get(lm[e]))&&void 0!==n?n:[]},e.prototype.resetMenuConfigByType=function(e){var t;this.setMenuConfig(((t={})[e]=um[e],t))},e.prototype.resetAllMenuConfig=function(){this.setMenuConfig(um)},e.prototype.setMenuConfig=function(e){this.processMenuConfig(e,"set"),this.refreshCurrentMenu()},e.prototype.addMenuConfig=function(e){this.processMenuConfig(e,"add"),this.refreshCurrentMenu()},e.prototype.changeMenuItem=function(e,t){if("add"===e)this.addMenuConfig(t);else{if("reset"!==e)throw new Error("The first parameter of changeMenuConfig should be 'add' or 'reset'");this.setMenuConfig(t)}},e.prototype.changeMenuItemDisableStatus=function(e,t,n){var i,o;if(e&&t){var r=null!==(o=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(lm[e]))&&void 0!==o?o:[];if(r.length){var a=r.find((function(e){return e.text===t}));a&&(a.disabled=n,this.updateMenuItemDOMStatus(t,n))}}},e.prototype.render=function(e,t){var n=this;e.graphModel.editConfigModel.isSilentMode||(this.__container=t,this.__currentData=null,this.setupSilentModeListener(),this.__menuDOM&&(this.__menuDOM.className="lf-menu",t.appendChild(this.__menuDOM),this.__menuDOM.addEventListener("click",(function(e){e.stopPropagation();for(var t=e.target;-1===Array.from(t.classList).indexOf("lf-menu-item")&&-1===Array.from(t.classList).indexOf("lf-menu");)t=null==t?void 0:t.parentElement;Array.from(t.classList).indexOf("lf-menu-item__disabled")>-1||Array.from(t.classList).indexOf("lf-menu-item")>-1&&(t.onclickCallback(n.__currentData,t),n.__menuDOM&&(n.__menuDOM.style.display="none"),n.__currentData=null)}),!0)),this.lf.on("node:contextmenu",(function(e){var t,i,o=e.data,r=e.position,a=e.e,s=r.domOverlayPosition,l=s.x,u=s.y,d=o.id,c=n.lf.graphModel.getNodeModelById(d);if(c&&!n.__isSilentMode){var h=[],f=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(c.type);h=c&&c.menu&&Array.isArray(c.menu)?c.menu:f||(null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(om)),n.__currentData=o,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,o,r=e.data,a=e.position,s=e.e,l=a.domOverlayPosition,u=l.x,d=l.y,c=r.id,h=n.lf.graphModel.getEdgeModelById(c);if(h&&!n.__isSilentMode){var f=[],p=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(h.type);f=h&&h.menu&&Array.isArray(h.menu)?h.menu:p||(null!==(o=null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(rm))&&void 0!==o?o:[]),n.__currentData=r,n.showMenu(u,d,f,{width:h.width,height:h.height,clientX:s.clientX,clientY:s.clientY})}})),this.lf.on("blank:contextmenu",(function(e){var t,i,o=e.position;if(!n.__isSilentMode){var r=null!==(i=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(am))&&void 0!==i?i:[],a=o.domOverlayPosition,s=a.x,l=a.y;n.__currentData=g({},o.canvasOverlayPosition),n.showMenu(s,l,r)}})),this.lf.on("selection:contextmenu",(function(e){var t,i=e.data,o=e.position;if(!n.__isSilentMode){var r=null===(t=n.menuTypeMap)||void 0===t?void 0:t.get(sm),a=o.domOverlayPosition,s=a.x,l=a.y;n.__currentData=i,n.showMenu(s,l,r)}})),this.lf.on("node:mousedown",(function(){n.__menuDOM.style.display="none"})),this.lf.on("edge:click",(function(){n.__menuDOM.style.display="none"})),this.lf.on("blank:click",(function(){n.__menuDOM.style.display="none"})))},e.prototype.destroy=function(){var e;this.__editConfigChangeHandler&&this.lf.off("editConfig:changed",this.__editConfigChangeHandler),this.__menuDOM&&(null===(e=null==this?void 0:this.__container)||void 0===e||e.removeChild(this.__menuDOM),this.__menuDOM=void 0)},e.pluginName="menu",e}(),cm="menu-common",hm=function(){function e(e){var t=e.lf,n=this;this.menuTypeMap=new Map,this.listenDelete=function(){n.hideContextMenu()},this.lf=t,this.__menuDOM=document.createElement("div"),this.__menuDOM.className="lf-inner-context",this.menuTypeMap.set(cm,[]),this.lf.setContextMenuByType=function(e,t){n.setContextMenuByType(e,t)},this.lf.setContextMenuItems=function(e){n.setContextMenuItems(e)},this.lf.showContextMenu=function(e){n.showContextMenu(e)},this.lf.hideContextMenu=function(){n.hideContextMenu()}}return e.prototype.render=function(e,t){var n=this;this.container=t,e.on("node:click",(function(e){var t=e.data;n._activeData=t,n.createContextMenu()})),e.on("edge:click",(function(e){var t=e.data;n._activeData=t,n.createContextMenu()})),e.on("blank:click",(function(){n.hideContextMenu()}))},e.prototype.setContextMenuByType=function(e,t){this.menuTypeMap.set(e,t)},e.prototype.hideContextMenu=function(){this.__menuDOM.innerHTML="",this.__menuDOM.style.display="none",this.isShow&&this.container.removeChild(this.__menuDOM),this.lf.off("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!1},e.prototype.showContextMenu=function(e){e&&e.id&&(this._activeData=e,this.createContextMenu())},e.prototype.setContextMenuItems=function(e){this.menuTypeMap.set(cm,e)},e.prototype.getContextMenuPosition=function(){var e=this._activeData,t=this.lf.graphModel.getElement(e.id);if(t){var n,i;if("edge"===t.BaseType){n=Number.MIN_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER;var o=t.getData();n=Math.max(o.startPoint.x,n),i=Math.min(o.startPoint.y,i),n=Math.max(o.endPoint.x,n),i=Math.min(o.endPoint.y,i),o.pointsList&&o.pointsList.forEach((function(e){n=Math.max(e.x,n),i=Math.min(e.y,i)}))}return"node"===t.BaseType&&(n=e.x+t.width/2,i=e.y-t.height/2),this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([n,i])}},e.prototype.createContextMenu=function(){var e=this;if(!this.lf.options.isSilentMode){var t=E(E([],w(this.menuTypeMap.get(this._activeData.type)||[]),!1),w(this.menuTypeMap.get(cm)||[]),!1),n=document.createDocumentFragment();t.forEach((function(t){var i=document.createElement("div");i.className="lf-context-item";var o=document.createElement("img");o.src=t.icon,o.className="lf-context-img",t.className&&(i.className="".concat(i.className," ").concat(t.className)),o.addEventListener("click",(function(){e.hideContextMenu(),t.callback?t.callback(e._activeData):e.addNode({sourceId:e._activeData.id,x:e._activeData.x,y:e._activeData.y,properties:t.properties,type:t.type})})),i.appendChild(o),n.appendChild(i)})),this.__menuDOM.innerHTML="",this.__menuDOM.appendChild(n),this.showMenu()}},e.prototype.addNode=function(e,t){var n=void 0!==t;void 0===t&&(t=e.y);var i=this.lf.getNodeModelById(e.sourceId);if(i){var o=e.x-i.width+200,r=t-e.y/2-20,a=e.x+i.width+200,s=t+e.y/2+20;if(this.lf.getAreaElement([o,r],[a,s]).length)return t+=100,void this.addNode(e,t);if(e.type){var l=this.lf.addNode({type:e.type,x:e.x+200,y:t,properties:e.properties}),u=void 0,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=w(e,2),n=t[0],i=t[1];this.__menuDOM.style.display="flex",this.__menuDOM.style.top="".concat(i,"px"),this.__menuDOM.style.left="".concat(n+10,"px"),this.container.appendChild(this.__menuDOM),!this.isShow&&this.lf.on("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!0}},e.pluginName="contextMenu",e}(),fm=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 o=document.createElement("div");o.innerText=e.label,o.className="lf-dnd-text",n.appendChild(o)}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}(),pm=function(){function e(e){var t=e.lf,n=e.LogicFlow,i=e.options,o=this;this.width=200,this.height=150,this.scale=1,this.translateX=0,this.translateY=0,this.showEdge=!1,this.viewPortTop=0,this.viewPortLeft=0,this.viewPortWidth=150,this.viewPortHeight=75,this.isShow=!1,this.isShowHeader=!1,this.isShowCloseIcon=!1,this.headerTitle="导航",this.disabledPlugins=["miniMap","control","selectionSelect"],this.onGraphResize=function(){o.updateViewPortBounds(),o.isShow&&o.updateViewPort()},this.render=function(e,t){o.container=t,o.lf.on("history:change",(function(){o.isShow&&o.setView()})),o.lf.on("graph:transform",(function(){o.isShow&&o.setView(!1)}))},this.show=function(e,t){o.isShow||(o.initMiniMap(),o.lf.on("graph:resize",o.onGraphResize),o.createMiniMap(e,t),o.setView(!0)),o.isShow=!0},this.hide=function(){o.isShow&&(o.lf.off("graph:resize",o.onGraphResize),o.lfMap.destroy(),o.translateX=0,o.translateY=0,o.removeMiniMap(),o.lf.emit("miniMap:close",{})),o.isShow=!1},this.updatePosition=function(e){if("object"==typeof e)void 0===e.left&&void 0===e.right||(o.leftPosition=e.left,o.rightPosition=e.right),void 0===e.top&&void 0===e.bottom||(o.topPosition=e.top,o.bottomPosition=e.bottom);else switch(e){case"left-top":o.leftPosition=0,o.rightPosition=void 0,o.topPosition=0,o.bottomPosition=void 0;break;case"right-top":o.leftPosition=void 0,o.rightPosition=0,o.topPosition=0,o.bottomPosition=void 0;break;case"left-bottom":o.leftPosition=0,o.rightPosition=void 0,o.topPosition=void 0,o.bottomPosition=0;break;case"right-bottom":o.leftPosition=void 0,o.rightPosition=0,o.topPosition=void 0,o.bottomPosition=0}o.updateMiniMapPosition()},this.reset=function(){o.lf.resetTranslate(),o.lf.resetZoom()},this.setShowEdge=function(e){o.showEdge!==e&&(o.showEdge=e,o.setView())},this.startDrag=function(e){document.addEventListener("pointermove",o.drag),document.addEventListener("pointerup",o.drop);var t=e.x,n=e.y;o.startPosition={x:t,y:n}},this.drag=function(e){var t=e.x,n=e.y,i=(t-o.startPosition.x)/o.scale,r=(n-o.startPosition.y)/o.scale,a=o.viewPortLeft+i+o.viewPortWidth/o.scale/2,s=o.viewPortTop+r+o.viewPortHeight/o.scale/2;o.startPosition={x:t,y:n},o.lf.focusOn({coordinate:{x:a,y:s}})},this.drop=function(){document.removeEventListener("pointermove",o.drag),document.removeEventListener("pointerup",o.drop)},this.mapClick=function(e){var t=e.offsetX,n=e.offsetY,i=o.translateX+t/o.scale,r=o.translateY+n/o.scale;o.lf.focusOn({coordinate:{x:i,y:r}})},this.lf=t,this.LFCtor=n,i&&this.setOption(i),this.viewPortWidth=t.graphModel.width,this.viewPortHeight=t.graphModel.height;var r={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=r,this.elementAreaBounds=r,this.viewPortBounds=r}return e.prototype.setOption=function(e){var t=e.width,n=void 0===t?200:t,i=e.height,o=void 0===i?150:i,r=e.showEdge,a=void 0!==r&&r,s=e.isShowHeader,l=void 0!==s&&s,u=e.isShowCloseIcon,d=void 0!==u&&u,c=e.leftPosition,h=e.topPosition,f=e.rightPosition,p=void 0===f?0:f,g=e.bottomPosition,v=void 0===g?0:g,m=e.headerTitle,y=void 0===m?"导航":m;this.width=n,this.height=o,this.showEdge=a,this.isShowHeader=l,this.isShowCloseIcon=d,this.leftPosition=c,this.rightPosition=void 0!==c?void 0:p,this.topPosition=h,this.bottomPosition=void 0!==h?void 0:v,this.headerTitle=y},e.prototype.initMiniMap=function(){var e=document.createElement("div");e.className="lf-mini-map-graph",e.style.width="".concat(this.width,"px"),e.style.height="".concat(this.height,"px"),this.lfMap=new this.LFCtor({container:e,grid:!1,isSilentMode:!0,stopZoomGraph:!0,stopScrollGraph:!0,stopMoveGraph:!1,history:!1,snapline:!1,disabledPlugins:this.disabledPlugins,isMiniMap:!0}),this.miniMapWrap=e,this.createViewPort(),e.addEventListener("click",this.mapClick)},e.prototype.createMiniMap=function(e,t){var n,i=document.createElement("div");this.miniMapContainer=i,i.appendChild(this.miniMapWrap),i.style.position="absolute",void 0===e&&void 0===t||(this.leftPosition=e||0,this.topPosition=t||0,this.rightPosition=void 0,this.bottomPosition=void 0),this.updateMiniMapPosition(),i.className="lf-mini-map",this.isShowCloseIcon||i.classList.add("lf-mini-map-no-close-icon"),this.isShowHeader||i.classList.add("lf-mini-map-no-header"),null===(n=this.container)||void 0===n||n.appendChild(i),this.miniMapWrap.appendChild(this.viewport);var o=document.createElement("div");o.className="lf-mini-map-header",o.innerText=this.headerTitle,i.appendChild(o);var r=document.createElement("span");r.className="lf-mini-map-close",r.addEventListener("click",this.hide),i.appendChild(r)},e.prototype.updateMiniMapPosition=function(){if(this.miniMapContainer){var e=this.miniMapContainer.style;void 0!==this.rightPosition?(e.right="".concat(this.rightPosition,"px"),e.left=""):(e.left="".concat(this.leftPosition,"px"),e.right=""),void 0!==this.bottomPosition?(e.bottom="".concat(this.bottomPosition,"px"),e.top=""):(e.top="".concat(this.topPosition,"px"),e.bottom="")}},e.prototype.removeMiniMap=function(){var e;this.miniMapContainer&&(null===(e=this.container)||void 0===e||e.removeChild(this.miniMapContainer))},e.prototype.updateBounds=function(e){e&&this.updateElementAreaBounds(e),this.updateViewPortBounds(),this.bounds={left:Math.min(this.elementAreaBounds.left,this.viewPortBounds.left),right:Math.max(this.elementAreaBounds.right,this.viewPortBounds.right),top:Math.min(this.elementAreaBounds.top,this.viewPortBounds.top),bottom:Math.max(this.elementAreaBounds.bottom,this.viewPortBounds.bottom)}},e.prototype.updateElementAreaBounds=function(e){var t={left:0,right:0,top:0,bottom:0},n=e.nodes;n&&n.length>0&&n.forEach((function(e){var n,i,o=e.x,r=e.y,a=null!==(n=e.width)&&void 0!==n?n:200,s=null!==(i=e.height)&&void 0!==i?i:200,l=o-a/2,u=o+a/2,d=r-s/2,c=r+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,o=e.SCALE_Y,r=this.lf.graphModel,a=r.width,s=r.height;this.viewPortBounds={left:-t/i,right:(-t+a)/i,top:-n/o,bottom:(-n+s)/o}},e.prototype.resetData=function(e){var t=e.nodes,n=e.edges;return t.forEach((function(e){e.text=void 0})),this.showEdge&&n.forEach((function(e){e.text=void 0})),{nodes:t,edges:this.showEdge?n:[]}},e.prototype.setView=function(e){var t,n;if(void 0===e&&(e=!0),e){var i=this.lf.getGraphRawData(),o=this.resetData(i),r=this.lf.viewMap,a=this.lf.graphModel.modelMap,s=this.lfMap.viewMap;try{for(var l=x(r.keys()),u=l.next();!u.done;u=l.next()){var d=u.value;s.has(d)||this.lfMap.register({type:d,view:r.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(o),this.updateBounds(o)}else this.updateBounds();var c=this.bounds,h=c.left,f=c.top,p=c.right-h,g=c.bottom-f,v=this.width/p,m=this.height/g,y=Math.min(v,m);this.scale=y;var b=h-(this.width/y-p)/2,w=f-(this.height/y-g)/2;if(this.lfMap.graphModel.transformModel.translate(-b+this.translateX,-w+this.translateY),this.translateX=b,this.translateY=w,this.miniMapWrap.firstChild){var E=this.miniMapWrap.firstChild.style;E.pointerEvents="none",E.transform="matrix(".concat(y,", 0, 0, ").concat(y,", 0, 0)"),E.transformOrigin="left top",E.height="".concat(this.height/y,"px"),E.width="".concat(this.width/y,"px"),this.updateViewPort()}},e.prototype.updateViewPort=function(){var e=this.viewport.style,t=this.lf.getTransform(),n=t.TRANSLATE_X,i=t.TRANSLATE_Y,o=t.SCALE_X,r=t.SCALE_Y,a=this.lf.graphModel,s=a.width,l=a.height;this.viewPortLeft=-n/o,this.viewPortTop=-i/r,this.viewPortWidth=s/o*this.scale,this.viewPortHeight=l/r*this.scale,e.width="".concat(this.viewPortWidth,"px"),e.height="".concat(this.viewPortHeight,"px"),e.left="".concat((this.viewPortLeft-this.translateX)*this.scale,"px"),e.top="".concat((this.viewPortTop-this.translateY)*this.scale,"px")},e.prototype.createViewPort=function(){var e=document.createElement("div");e.className="lf-minimap-viewport",e.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}(),gm=function(){function e(e){var t,n=e.lf,i=e.options,o=this;this.disabled=!0,this.isWholeNode=!0,this.isWholeEdge=!0,this.originStatusSaved=!1,this.exclusiveMode=!1,this.mouseDownInfo=null,this.originalStopMoveGraph=!1,this.handleBlankMouseDown=function(e){var t=e.e;o.handleMouseDown(t)},this.draw=function(e){if(o.lf.graphModel.editConfigModel.isPinching)return o.lf.updateEditConfig({stopMoveGraph:o.originalStopMoveGraph}),o.originStatusSaved=!1,void o.cleanupSelectionState();var t=o.lf.getPointByClient(e.clientX,e.clientY).domOverlayPosition,n=t.x,i=t.y;if(o.endPoint={x:n,y:i},o.startPoint){var r=o.startPoint,a=r.x,s=r.y,l=a,u=s,d=n-a,c=i-s;n<a&&(l=n,d=a-n),i<s&&(u=i,c=s-i),o.wrapper&&(o.wrapper.style.left="".concat(l,"px"),o.wrapper.style.top="".concat(u,"px"),o.wrapper.style.width="".concat(d,"px"),o.wrapper.style.height="".concat(c,"px"))}},this.drawOff=function(e){if(o.lf.updateEditConfig({stopMoveGraph:o.originalStopMoveGraph}),o.originStatusSaved=!1,o.mouseDownInfo){var t=o.mouseDownInfo,n=t.x,i=t.y,r=t.time;if(Math.abs(e.clientX-n)<5&&Math.abs(e.clientY-i)<5&&Date.now()-r<200)return o.lf.clearSelectElements(),void o.cleanupSelectionState()}var a=js(o.startPoint),s=js(o.endPoint);if(document.removeEventListener("pointermove",o.draw),o.exclusiveMode||document.removeEventListener("pointerup",o.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(o.lf.emit("selection:selected-area",{topLeft:d,bottomRight:c}),Math.abs(l-n)<10&&Math.abs(u-i)<10)return void(o.wrapper&&(o.wrapper.oncontextmenu=null,o.container&&o.wrapper.parentNode===o.container&&o.container.removeChild(o.wrapper),o.wrapper=void 0));var h=o.lf.graphModel.getAreaElement(d,c,o.isWholeEdge,o.isWholeNode,!0),f=o.lf.graphModel,p=f.dynamicGroup,g=f.group,v=[],m=o.lf.getSelectElements(),y=new Set(E(E([],w(m.nodes.map((function(e){return e.id}))),!1),w(m.edges.map((function(e){return e.id}))),!1));h.forEach((function(e){if(g){var t=g.getNodeGroup(e.id);if(h.includes(t))return}if(p){t=p.getGroupByNodeId(e.id);if(h.includes(t))return}o.exclusiveMode&&y.has(e.id)?o.lf.deselectElementById(e.id):(o.lf.selectElementById(e.id,!0),v.push(e))})),o.startPoint=void 0,o.endPoint=void 0,v.length>0&&o.lf.emit("selection:drop",{e:e}),o.lf.emit("selection:selected",{elements:v,leftTopPoint:d,rightBottomPoint:c})}o.wrapper&&(o.wrapper.oncontextmenu=null,o.container&&o.wrapper.parentNode===o.container&&o.container.removeChild(o.wrapper),o.wrapper=void 0)},this.lf=n,this.exclusiveMode=null!==(t=null==i?void 0:i.exclusiveMode)&&void 0!==t&&t,n.openSelectionSelect=function(){o.openSelectionSelect()},n.closeSelectionSelect=function(){o.closeSelectionSelect()},n.setSelectionSelectMode=function(e){o.setExclusiveMode(e)},this.handleMouseDown=this.handleMouseDown.bind(this),this.draw=this.draw.bind(this),this.drawOff=this.drawOff.bind(this)}return e.prototype.render=function(e,t){this.container=t},e.prototype.cleanupSelectionState=function(){this.wrapper&&(this.wrapper.oncontextmenu=null,this.container&&this.wrapper.parentNode===this.container&&this.container.removeChild(this.wrapper),this.wrapper=void 0),this.startPoint=void 0,this.endPoint=void 0,this.mouseDownInfo=null,document.removeEventListener("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,o=n.y;this.startPoint={x:i,y:o},this.endPoint={x:i,y:o};var r=document.createElement("div");r.className="lf-selection-select",r.oncontextmenu=function(e){e.preventDefault()},r.style.top="".concat(this.startPoint.y,"px"),r.style.left="".concat(this.startPoint.x,"px"),null===(t=this.container)||void 0===t||t.appendChild(r),this.wrapper=r,document.addEventListener("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=js(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}(),vm=function(e,t){var n=[],i=[],o=function(e,i,r){e&&(r&&i.unshift.apply(i,E([],w(t.getEdgeModels({sourceNodeId:e.id,targetNodeId:null==r?void 0:r.id}).map((function(e){return e.id}))),!1)),i.includes(e.id)?n.push(i):(i.unshift(e.id),e.incoming.nodes.length?e.incoming.nodes.forEach((function(t){o(t,i.slice(),e)})):n.push(i)))},r=function(e,n,o){e&&(o&&n.push.apply(n,E([],w(t.getEdgeModels({sourceNodeId:null==o?void 0:o.id,targetNodeId:e.id}).map((function(e){return e.id}))),!1)),n.includes(e.id)?i.push(n):(n.push(e.id),e.outgoing.nodes.length?e.outgoing.nodes.forEach((function(t){r(t,n.slice(),e)})):i.push(n)))};return o(e,[]),r(e,[]),E([],w(new Set(E(E([],w(n.flat()),!1),w(i.flat()),!1))),!1)},mm=function(){function e(e){var t=e.lf,n=e.options;this.mode="path",this.enable=!0,this.tempStyles={};var i=n.mode,o=void 0===i?"path":i,r=n.enable,a=void 0===r||r;this.lf=t,this.mode=o,this.enable=a}return e.prototype.setMode=function(e){this.mode=e},e.prototype.setEnable=function(e){this.enable=e},e.prototype.highlightSingle=function(e){var t=this.lf.getModelById(e);"node"===(null==t?void 0:t.BaseType)?t.updateStyles(this.tempStyles[e]):"edge"===(null==t?void 0:t.BaseType)&&(t.updateStyles(this.tempStyles[e]),t.sourceNode.updateStyles(this.tempStyles[t.sourceNode.id]),t.targetNode.updateStyles(this.tempStyles[t.targetNode.id])),this.lf.emit("highlight:single",{data:t})},e.prototype.highlightNeighbours=function(e){var t=this,n=this.lf.getModelById(e),i=[];if("node"===(null==n?void 0:n.BaseType)){n.updateStyles(this.tempStyles[e]);var o=n.incoming,r=o.nodes,a=o.edges,s=n.outgoing,l=s.nodes,u=s.edges;Fs(r,l).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),Fs(a,u).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),i=Xf(Fs(i,r,l,a,u),"id")}else"edge"===(null==n?void 0:n.BaseType)&&(n.updateStyles(this.tempStyles[e]),n.sourceNode.updateStyles(this.tempStyles[n.sourceNode.id]),n.targetNode.updateStyles(this.tempStyles[n.targetNode.id]),i=[n.sourceNode,n.targetNode]);this.lf.emit("highlight:neighbours",{data:n,relateElements:i})},e.prototype.highlightPath=function(e){var t=this,n=function(e,t){var n=t.getModelById(e);return vm("node"===(null==n?void 0:n.BaseType)?n:null==n?void 0:n.targetNode,t)}(e,this.lf),i=[];n.forEach((function(e){var n=t.lf.getModelById(e);null==n||n.updateStyles(t.tempStyles[e]),i.push(n)})),this.lf.emit("highlight:path",{data:this.lf.getModelById(e),relateElements:i})},e.prototype.highlight=function(e,t){var n=this;(void 0===t&&(t=this.mode),this.enable)&&(Object.keys(this.tempStyles).length&&this.restoreHighlight(),Object.values(this.lf.graphModel.modelsMap).forEach((function(e){var t="node"===e.BaseType?e.getNodeStyle():e.getEdgeStyle();n.tempStyles[e.id]=g({},t),e.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),neighbour:this.highlightNeighbours.bind(this),path:this.highlightPath.bind(this)}[t](e))},e.prototype.restoreHighlight=function(){var e=this;Object.keys(this.tempStyles).length&&(Object.values(this.lf.graphModel.modelsMap).forEach((function(t){var n,i=null!==(n=e.tempStyles[t.id])&&void 0!==n?n:{};t.updateStyles(g({},i))})),this.tempStyles={})},e.prototype.render=function(){var e=this;this.lf.on("node:mouseenter",(function(t){var n=t.data;return e.highlight(n.id)})),this.lf.on("edge:mouseenter",(function(t){var n=t.data;return e.highlight(n.id)})),this.lf.on("node:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("edge:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("history:change",this.restoreHighlight.bind(this))},e.prototype.destroy=function(){},e.pluginName="highlight",e}(),ym={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function bm(e,t,n,i){var o,r=function(e,t){var n=t[0]-e[0],i=t[1]-e[1],o=Math.abs(n),r=Math.abs(i);return r<=1&&o>1?n<0?"l":"r":o<=1&&r>1?i<0?"t":"b":o<=1&&r<=1?"":o<r?n<0?"l":"r":i<0?"t":"b"},a=r(e,t),s=r(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=ym[u]||"-",c="";if("-"===d)c+="L ".concat(t[0]," ").concat(t[1]);else{var h=w(function(e,t,n,i){var o=[e[0],e[1]],r=[e[0],e[1]];switch(n){case"tl":return"tr"===t?(o[1]+=i,r[0]+=i):"lb"===t&&(o[0]+=i,r[1]+=i),[o,r];case"tr":return"tl"===t?(o[1]+=i,r[0]-=i):"rb"===t&&(o[0]-=i,r[1]+=i),[o,r];case"bl":return"br"===t?(o[1]-=i,r[0]+=i):"lt"===t&&(o[0]+=i,r[1]-=i),[o,r];case"br":return"bl"===t?(o[1]-=i,r[0]-=i):"rt"===t&&(o[0]-=i,r[1]-=i),[o,r];default:return[]}}(t,u,d,l),2),f=h[0],p=h[1];f&&p&&(c+="L ".concat(f[0]," ").concat(f[1]," Q ").concat(t[0]," ").concat(t[1]," ").concat(p[0]," ").concat(p[1]),o=w(p,2),t[0]=o[0],t[1]=o[1])}return c}function xm(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+=bm(e[n-1],e[n],e[1+n++],t)}i+="L ".concat(e[n][0]," ").concat(e[n][1])}return i}var wm=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getEdge=function(){var e=this.props.model,n=e.points,i=e.isAnimation,o=e.arrowConfig,r=e.radius,a=void 0===r?5:r,s=e.getEdgeStyle(),l=e.getEdgeAnimationStyle(),u=function(e){for(var t=e,n=1;n<t.length-1;){var i=w(t[n-1],2),o=i[0],r=i[1],a=w(t[n],2),s=a[0],l=a[1],u=w(t[n+1],2),d=u[0],c=u[1];o===s&&s===d||r===l&&l===c?t.splice(n,1):n++}return t}(n.split(" ").map((function(e){return e.split(",").map((function(e){return+e}))}))),d=xm(u,a),c=g(g(g({style:i?l:{}},s),o),{fill:"none"});return t.h("path",g({d:d},c))},n}(t.PolylineEdge),Em=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t}(t.PolylineEdgeModel),Cm=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.id,i=e.x,o=e.y,r=e.width,a=e.height,s=e.properties,l=this.props.model.getNodeStyle();return t.h("svg",{x:i-r/2,y:o-a/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[s.labelText?t.h("text",{x:0,y:-5,fontSize:"16px",fill:l.stroke},s.labelText):"",s.disabledDelete?"":t.h("text",{x:s.labelText?50:0,y:-5,fontSize:"24px",cursor:"pointer",fill:l.stroke,onclick:this.handleCustomDeleteIconClick.bind(this,n)},"x")])},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.id,s=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",g(g({},s),{x:n-o/2,y:i-r/2,width:o,height:r,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(e){this.props.graphModel.deleteNode(e)},n}(t.PolygonNode),Nm=function(e){function t(){var t=e.apply(this,E([],w(arguments),!1))||this;return t.d=10,t.isResize=!1,t}return p(t,e),t.prototype.initNodeData=function(t){t.text={value:"",x:t.x,y:t.y,draggable:!1,editable:!1},e.prototype.initNodeData.call(this,t),this.zIndex=0,this.draggable=!0},t.prototype.setAttributes=function(){var e,t=this;this.points=[],(null===(e=this.properties)||void 0===e?void 0:e.node_selection_ids).length>1&&setTimeout((function(){var e;t.updatePointsByNodes((null===(e=t.properties)||void 0===e?void 0:e.node_selection_ids)||[])}))},t.prototype.getNodeStyle=function(){var t=e.prototype.getNodeStyle.call(this);return t.stroke=this.properties.strokeColor||"#008000",t.strokeDasharray="10 5",t},t.prototype.getDefaultAnchor=function(){return[]},t.prototype.updatePoints=function(e){this.points=e},t.prototype.updateCoordinate=function(e){var t=e.x,n=e.y;this.x=t,this.y=n},t.prototype.updatePointsByNodes=function(e){var t=this,n=[],i=1/0,o=1/0,r=-1/0,a=-1/0;e.forEach((function(e){var n=t.graphModel.getNodeModelById(e);if(n){var s=n.width,l=n.height,u=n.x,d=n.y;i=Math.min(i,u-s/2-t.d),o=Math.min(o,d-l/2-t.d),r=Math.max(r,u+s/2+t.d),a=Math.max(a,d+l/2+t.d)}})),n.push([i,o],[r,o],[r,a],[i,a]),[i,o,r,a].some((function(e){return Math.abs(e)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(r+i)/2,y:(a+o)/2}))},t.prototype.resize=function(t){var n;this.isResize=!0;for(var i=t.width,o=t.height,r=i/this.width,a=o/this.height,s=(this.properties.node_selection_ids||[]).slice(),l=[],u=new Set;s.length;){var d=s.shift(),c=null===(n=this.graphModel.nodesMap[d])||void 0===n?void 0:n.model;c&&(Mm(c)?u.has(c.id)||(u.add(c.id),s.push.apply(s,E([],w(c.properties.node_selection_ids||[]),!1))):l.push(c))}var h=this.x-this.width/2,f=this.y-this.height/2,p=e.prototype.resize.call(this,t),g=this.x-this.width/2,v=this.y-this.height/2;return l.forEach((function(e){e.width=e.width*r,e.height=e.height*a;var t=(e.x-h)*r+g-e.x,n=(e.y-f)*a+v-e.y;e.move(t,n,!0)})),this.isResize=!1,p},t}(t.PolygonNodeModel),_m="node-selection",Sm=function(){function e(e){var t=e.lf;this.selectNodes=[],this.d=10,this.lf=t,t.register({type:_m,view:Cm,model:Nm})}return Object.defineProperty(e.prototype,"selectNodesIds",{get:function(){return this.selectNodes.map((function(e){return e.id}))},enumerable:!1,configurable:!0}),e.prototype.addNodeSelection=function(){this.lf.addNode({type:"node-selection",text:"",properties:{node_selection_ids:this.selectNodesIds},x:0,y:0}).updatePointsByNodes(this.selectNodesIds)},e.prototype.updateNodeSelection=function(){var e,t=this.getNodeSelection();t&&(this.lf.setProperties(t.id,{node_selection_ids:this.selectNodesIds}),null===(e=this.lf.getNodeModelById(t.id))||void 0===e||e.updatePointsByNodes(this.selectNodesIds))},e.prototype.getNodeSelection=function(){var e=this,t=this.selectNodesIds,n=this.lf.getGraphRawData(),i=t.filter((function(t){return t!==e.currentClickNode.id}));return n.nodes.find((function(e){if("node-selection"===e.type){var t=Ho(e,"properties.node_selection_ids",[]);return i.every((function(e){return t.includes(e)}))}return!1}))},e.prototype.onNodeChange=function(e,t){var n=e.graphModel.nodes.filter((function(e){return!!Mm(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!==_m){t.currentClickNode=n.data;var o=!1;t.selectNodesIds.includes(n.data.id)&&(null===(i=t.lf.getNodeModelById(n.data.id))||void 0===i||i.setSelected(!1),o=!0);var r=e.getSelectElements(!0).nodes;t.selectNodes=r,1===t.selectNodes.length?o?t.updateNodeSelection():t.addNodeSelection():t.selectNodes.length>1&&t.updateNodeSelection()}})),e.graphModel.addNodeMoveRules((function(n,i,o){if(t.onNodeChange(e,n),Mm(n)&&!n.isResize){var r=n.properties.node_selection_ids||[];return e.graphModel.moveNodes(r,i,o,!0),!0}return!0})),e.graphModel.addNodeResizeRules((function(n){return Mm(n)||t.onNodeChange(e,n),!0}))},e.pluginName="node-selection",e}(),Mm=function(e){return!(!e||e.type!==_m)},Tm=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return p(n,e),n.prototype.getLabelShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=e.properties;return t.h("text",{x:n-o/2+5,y:i-r/2+16,fontSize:12,fill:"blue"},a.moreText)},n.prototype.getShape=function(){var e=this.props.model,n=e.x,i=e.y,o=e.width,r=e.height,a=this.props.model.getNodeStyle();return t.h("g",{},[t.h("rect",g(g({},a),{fill:"#FFFFFF",x:n-o/2,y:i-r/2})),this.getLabelShape()])},n}(t.RectNode),Am={pluginName:"rectLabelNode",install:function(e){e.register({type:"rect-label",model:t.RectNodeModel,view:Tm})}};e.AutoLayout=tm,e.BPMNAdapter=Yg,e.BPMNBaseAdapter=Kg,e.BPMNElements=lg,e.BoundaryEventFactory=Ee,e.BpmnAdapter=he,e.BpmnElement=U,e.BpmnXmlAdapter=fe,e.ContextMenu=hm,e.Control=im,e.CurvedEdge=wm,e.CurvedEdgeModel=Em,e.DiamondResize=Gp,e.DiamondResizeModel=Wp,e.DiamondResizeView=zp,e.DndPanel=fm,e.DynamicGroup=rv,e.DynamicGroupNode=ev,e.DynamicGroupNodeModel=tv,e.EllipseResize=Hp,e.EllipseResizeModel=jp,e.EllipseResizeView=Fp,e.EndEventFactory=be,e.EndEventModel=A,e.EndEventView=k,e.ExclusiveGatewayModel=I,e.ExclusiveGatewayView=L,e.FlowPath=Zv,e.GatewayNodeFactory=Ie,e.Group=tg,e.GroupNode=Jp,e.GroupNodeModel=Zp,e.Highlight=mm,e.HtmlResize=Xp,e.HtmlResizeModel=Up,e.HtmlResizeView=qp,e.InsertNodeInPolyline=hv,e.IntermediateCatchEventFactory=xe,e.IntermediateThrowEventFactory=Ce,e.Label=zv,e.Menu=dm,e.MiniMap=pm,e.NodeResize=$p,e.NodeSelection=Sm,e.ProximityConnect=nm,e.RectLabelNode=Am,e.RectResize=Yp,e.RectResizeModel=Vp,e.RectResizeView=Kp,e.SelectionSelect=gm,e.SequenceFlowModel=D,e.SequenceFlowView=O,e.ServiceTaskModel=j,e.ServiceTaskView=F,e.Snapshot=$v,e.StartEventFactory=we,e.StartEventModel=S,e.StartEventView=M,e.SubProcessFactory=ng,e.TaskNodeFactory=Be,e.UserTaskModel=W,e.UserTaskView=z,e.bpmnUtils=ye,e.convertNormalToXml=Wg,e.convertXmlToNormal=zg,e.dynamicGroup=iv,e.escapeXml=$,e.gateway={exclusive:0,inclusive:1,parallel:2},e.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],e.getCurvedEdgePath=xm,e.handleAttributes=Y,e.icons=Pe,e.lfJson2Xml=Q,e.lfXml2Json=ne,e.multiInstanceIcon=Le,e.sequenceFlowFactory=og,e.toLogicflowData=function(e){var t={nodes:[],edges:[]},n=e.flowElementList;return n&&n.length>0&&n.forEach((function(e){if(e.type===$g.SEQUENCE_FLOW){var n=function(e){var t=e.incoming,n=e.outgoing,i=e.properties,o=e.key,r=e.type,a=i.text,s=i.name,l=i.startPoint,u=i.endPoint,d=i.pointsList,c={id:o,type:Zg[r],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,o=e.bounds,r=t.x,a=t.y,s=t.text;if(void 0===r){var l=w(o,2),u=l[0],d=u.x,c=u.y,h=l[1];r=(d+h.x)/2,a=(c+h.y)/2}var f={id:n,type:Zg[i],x:r,y:a,text:s,properties:{}},p=["x","y","text"];return Object.keys(e.properties).forEach((function(t){-1===p.indexOf(t)&&(f.properties[t]=e.properties[t])})),f}(e);t.nodes.push(i)}})),t},e.toNormalJson=se,e.toTurboData=function(e){var t=new Map,n={flowElementList:[]};return e.nodes.forEach((function(e){var i=function(e){var t=e.id,n=e.type,i=e.x,o=e.y,r=e.text,a=void 0===r?"":r,s=e.properties;return{incoming:[],outgoing:[],dockers:[],type:Jg(n),properties:g(g({},s),{name:a&&a.value||"",x:i,y:o,text:a}),key:t}}(e);n.flowElementList.push(i),t.set(e.id,i)})),e.edges.forEach((function(e){var i=function(e){var t=e.id,n=e.type,i=e.sourceNodeId,o=e.targetNodeId,r=e.startPoint,a=e.endPoint,s=e.pointsList,l=e.text,u=void 0===l?"":l,d=e.properties;return{incoming:[i],outgoing:[o],type:Jg(n),dockers:[],properties:g(g({},d),{name:u&&u.value||"",text:u,startPoint:JSON.stringify(r),endPoint:JSON.stringify(a),pointsList:JSON.stringify(s)}),key:t}}(e);t.get(e.sourceNodeId).outgoing.push(i.key),t.get(e.targetNodeId).incoming.push(i.key),n.flowElementList.push(i)})),n},e.toXmlJson=ae,e.useDefinition=sg}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@logicflow/core")):"function"==typeof define&&define.amd?define(["exports","@logicflow/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Extension={},e.Core)}(this,(function(e,t){"use strict";var n=40,i=40,r=40,o=40,a=40,s=40,l=100,u=80,d=100,c=80,h={rect:{radius:5,stroke:"rgb(24, 125, 255)"},circle:{r:18,stroke:"rgb(24, 125, 255)"},polygon:{stroke:"rgb(24, 125, 255)"},polyline:{stroke:"rgb(24, 125, 255)",hoverStroke:"rgb(24, 125, 255)",selectedStroke:"rgb(24, 125, 255)"},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"white",height:14,stroke:"transparent",radius:3}}},p=function(e,t){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},p(e,t)};function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var g=function(){return g=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},g.apply(this,arguments)};function v(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var 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 m(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 y(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 b(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 x(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,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(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 C=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),N=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new C;function _(){return N.next()}var S=function(e){function t(t,n){return t.id||(t.id="Event_".concat(_())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),e.call(this,t,n)||this}return f(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedTargetRules=function(){var t=e.prototype.getConnectedTargetRules.call(this);return t.push({message:"起始节点不能作为边的终点",validate:function(){return!1}}),t},t.extendKey="StartEventModel",t}(t.CircleNodeModel),M=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.extendKey="StartEventNode",t}(t.CircleNode),A={type:"bpmn:startEvent",view:M,model:S},T=function(e){function t(t,n){return t.id||(t.id="Event_".concat(_())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),e.call(this,t,n)||this}return f(t,e),t.prototype.setAttributes=function(){this.r=18},t.prototype.getConnectedSourceRules=function(){var t=e.prototype.getConnectedSourceRules.call(this);return t.push({message:"结束节点不能作为边的起点",validate:function(){return!1}}),t},t.extendKey="EndEventModel",t}(t.CircleNodeModel),k=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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",g(g({},i),{cx:o,cy:a,r:s-5})))},n.extendKey="EndEventView",n}(t.CircleNode),O={type:"bpmn:endEvent",view:k,model:T},R=function(e){function t(t,n){return t.id||(t.id="Flow_".concat(_())),e.call(this,t,n)||this}return f(t,e),t.extendKey="SequenceFlowModel",t}(t.PolylineEdgeModel),D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.extendKey="SequenceFlowEdge",t}(t.PolylineEdge),P={type:"bpmn:sequenceFlow",view:D,model:R},I=function(e){function t(t,n){var i=this;return t.id||(t.id="Gateway_".concat(_())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),(i=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],i}return f(t,e),t.extendKey="ExclusiveGatewayModel",t}(t.PolygonNodeModel),L=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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",g(g({},l),{x:i,y:r,points:s})),t.h("path",g({d:"m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z"},l)))},n.extendKey="ExclusiveGatewayNode",n}(t.PolygonNode),B={type:"bpmn:exclusiveGateway",view:L,model:I},j=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(_())),e.call(this,t,n)||this}return f(t,e),t.extendKey="ServiceTaskModel",t}(t.RectNodeModel),z=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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",g({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),H={type:"bpmn:serviceTask",view:z,model:j},F=function(e){function t(t,n){return t.id||(t.id="Activity_".concat(_())),e.call(this,t,n)||this}return f(t,e),t.extendKey="UserTaskModel",t}(t.RectNodeModel),W=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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",g(g({},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),G={type:"bpmn:userTask",view:W,model:F},V={pluginName:"bpmnElement",install:function(e){e.setTheme(h),e.register(A),e.register(O),e.register(B),e.register(G),e.register(H),e.options.customBpmnEdge||(e.register(P),e.setDefaultEdgeType("bpmn:sequenceFlow"))}},U=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}(),q=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new U;function X(){return q.next()}function K(e){return Object.prototype.toString.call(e)}function Y(e){var t=e;return"[object Object]"===K(e)?(t={},Object.keys(e).forEach((function(n){var i=n;"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=Y(e[n])}))):Array.isArray(e)&&(t=[],e.forEach((function(e,n){t[n]=Y(e)}))),t}function Q(e){return null==e?"":e.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Z="\t\n";function $(e,t,n){var i=function(e){return" ".repeat(e)}(n);if(0!==e&&!1!==e&&!e)return Z+i+"<".concat(t," />");var r="";if("#text"===t)return Z+i+Q(String(e));if("#cdata-section"===t)return Z+i+"<![CDATA["+e+"]]>";if("#comment"===t)return Z+i+"\x3c!--"+e+"--\x3e";if("-"==="".concat(t).charAt(0))return" "+t.substring(1)+'="'+function(e){var t=e;try{"string"!=typeof t&&(t=JSON.parse(e))}catch(n){t=JSON.stringify(Y(e)).replace(/"/g,"'")}return Q(String(t))}(e)+'"';if(Array.isArray(e))e.forEach((function(e){r+=$(e,t,n+1)}));else if("[object Object]"===K(e)){var o=Object.keys(e),a="",s="";r+=(0===n?"":Z+i)+"<"+t,o.forEach((function(t){"-"===t.charAt(0)?a+=$(e[t],t,n+1):s+=$(e[t],t,n+1)})),r+=a+(""!==s?">".concat(s).concat(Z+i,"</").concat(t,">"):" />")}else r+=Z+i+"<".concat(t,">").concat(Q(String(e)),"</").concat(t,">");return r}function J(e){var t="";for(var n in e)t+=$(e[n],n,0);return t}var ee=function(){};(ee.ObjTree=function(){return this}).VERSION="0.23",ee.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',ee.ObjTree.prototype.attr_prefix="-",ee.ObjTree.prototype.parseXML=function(e){var t;if(window.DOMParser){var n=new DOMParser,i=n.parseFromString(e,"application/xml");if(!i)return;t=i.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(e),t=n.documentElement);if(t)return this.parseDOM(t)},ee.ObjTree.prototype.parseHTTP=function(e,t,n){var i,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},ee.ObjTree.prototype.parseDOM=function(e){if(e){if(this.__force_array={},this.force_array)for(var t=0;t<this.force_array.length;t++)this.__force_array[this.force_array[t]]=1;var n=this.parseElement(e);if(this.__force_array[e.nodeName]&&(n=[n]),11!=e.nodeType){var i={};i[e.nodeName]=n,n=i}return n}},ee.ObjTree.prototype.parseElement=function(e){if(7!=e.nodeType){if(3==e.nodeType||4==e.nodeType||8==e.nodeType){if(null==e.nodeValue.match(/[^\x00-\x20]/))return;return e.nodeValue}var t=null,n={};if(e.attributes&&e.attributes.length){t={};for(var i=0;i<e.attributes.length;i++){if("string"==typeof(s=e.attributes[i].nodeName)){var 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}},ee.ObjTree.prototype.addNode=function(e,t,n,i){this.__force_array[t]?(1==n&&(e[t]=[]),e[t][e[t].length]=i):1==n?e[t]=i:2==n?e[t]=[e[t],i]:e[t][e[t].length]=i},ee.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},ee.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var 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},ee.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("")},ee.ObjTree.prototype.scalar_to_xml=function(e,t){return"#text"==e?this.xml_escape(t):"<"+e+">"+this.xml_escape(t)+"</"+e+">\n"},ee.ObjTree.prototype.xml_escape=Q;var te,ne=function(e){return(new ee.ObjTree).parseXML(e)};!function(e){e.START="bpmn:startEvent",e.END="bpmn:endEvent",e.GATEWAY="bpmn:exclusiveGateway",e.USER="bpmn:userTask",e.SYSTEM="bpmn:serviceTask",e.FLOW="bpmn:sequenceFlow"}(te||(te={}));var ie=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef"],re=["properties","startPoint","endPoint","pointsList"],oe=function(e){return String(e||"").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'")};function ae(e){var t=e?re.concat(e):re;return function(e){return function e(n){var i={};return"string"==typeof n?n:Array.isArray(n)?n.map((function(t){return e(t)})):(Object.entries(n).forEach((function(n){var r=w(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 se(e){var t={};return Object.entries(e).forEach((function(e){var n=w(e,2),i=n[0],r=n[1];0===i.indexOf("-")?t[i.substring(1)]=Y(r):"string"==typeof r?t[i]=r:"[object Object]"===Object.prototype.toString.call(r)?t[i]=se(r):Array.isArray(r)?t[i]=r.map((function(e){return se(e)})):t[i]=r})),t}function le(e,t){e["bpmndi:BPMNEdge"]=t.edges.map((function(e){var t,n=e.id,i=e.pointsList.map((function(e){return{"-x":e.x,"-y":e.y}})),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=he.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 ue(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===te.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(ce(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(ce(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=de(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}));else{var r=de(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 de(e,t,n){var i,r,o=Number(e["dc:Bounds"]["-x"]),a=Number(e["dc:Bounds"]["-y"]),s=oe(n["-name"]),l=he.shapeConfigMap.get(t);if(l&&(o+=l.width/2,a+=l.height/2),Object.entries(n).forEach((function(e){var t=w(e,2),n=t[0],r=t[1];-1===ie.indexOf(n)&&(i||(i={}),i[n]=r)})),i&&(i=se(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 ce(e,t){var n,i,r=t["-name"]?oe("".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=w(e,2),n=t[0],r=t[1];-1===ie.indexOf(n)&&(i||(i={}),i[n]=r)})),i&&(i=se(i));var d={id:t["-id"],type:te.FLOW,pointsList:e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:i};return n&&(d.text=n),d}var he=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i=g({},n.processAttributes);!function(e,t,n){var i=new Map;t.nodes.forEach((function(t){var 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=ae(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=ae(n)(e.properties);Object.assign(a,s)}return a}));t.edges.forEach((function(e){var t=i.get(e.sourceNodeId);t["bpmn:outgoing"]?Array.isArray(t["bpmn:outgoing"])?t["bpmn:outgoing"].push(e.id):t["bpmn:outgoing"]=[t["bpmn:outgoing"],e.id]:t["bpmn:outgoing"]=e.id})),e[te.FLOW]=r}(i,e,t);var r={"-id":"BPMNPlane_1","-bpmnElement":i["-id"]};le(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 ue(e)},t.adapterIn=function(e){return n.adapterIn(e)},t.adapterOut=function(e,t){return n.adapterOut(e,t)},this.processAttributes={"-isExecutable":"true","-id":"Process_".concat(X())},this.definitionAttributes={"-id":"Definitions_".concat(X()),"-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.0"}}return e.prototype.setCustomShape=function(t,n){e.shapeConfigMap.set(t,n)},e.pluginName="bpmn-adapter",e.shapeConfigMap=new Map,e}();he.shapeConfigMap.set(te.START,{width:n,height:i}),he.shapeConfigMap.set(te.END,{width:r,height:o}),he.shapeConfigMap.set(te.GATEWAY,{width:a,height:s}),he.shapeConfigMap.set(te.SYSTEM,{width:l,height:u}),he.shapeConfigMap.set(te.USER,{width:d,height:c});var pe=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t="string"==typeof e?n.sanitizeNameAttributes(e):e,i=ne(t);return n.adapterIn(i)},n.adapterXmlOut=function(e,t){return J(n.adapterOut(e,t))};var i=t.lf;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n}return f(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}(he);function fe(){this.targetRules.push({message:"分组外的节点不允许连接分组内的",validate:function(e,t){var n=!!e.properties.parent,i=!!t.properties.parent;return!(!n&&i)}})}var ge=function(){function e(){globalThis._ids=this,this._ids=new Set}return e.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.next=function(){for(var e=this.generateId();this._ids.has(e);)e=this.generateId();return this._ids.add(e),e},e}(),ve=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new ge;function me(){return ve.next()}var ye=Object.freeze({__proto__:null,genBpmnId:me,groupRule:fe});function be(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return f(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,v=((null===(i=n.endEvent)||void 0===i?void 0:i.get(f))||{}).icon,m=Array.isArray(v)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(s-d/2," ").concat(l-c/2,")")}],w(v),!1)):t.h("path",{transform:"matrix(1 0 0 1 ".concat(s-d/2," ").concat(l-c/2,")"),d:v,style:"fill: black; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;"});return t.h("g",{},p,t.h("circle",g(g({},o),{strokeWidth:2,cx:s,cy:l,r:u-2})),m)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(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=g(g({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),r=e.call(this,t,i)||this,fe.call(r),r}return f(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 xe(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return f(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,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],w(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",g(g({},r),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",g(g({},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(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(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=g(g({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),r=e.call(this,t,i)||this,fe.call(r),r}return f(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateCatchEvent",view:i,model:r}}function we(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return f(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,v=Array.isArray(f)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],w(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",g(g({},r),{cx:a,cy:s,r:l,strokeDasharray:p?"5,5":"",strokeWidth:2})),v)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var s=((null===(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=g(g({},l),t.properties),(null===(a=t.properties)||void 0===a?void 0:a.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),e.call(this,t,i)||this}return f(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 Ee(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return f(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,v=Array.isArray(f)?t.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],w(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",g(g({},r),{cx:a,cy:s,r:l,strokeDasharray:p?"":"5,5",strokeWidth:1.5})),t.h("circle",g(g({},r),{cx:a,cy:s,r:l-3,strokeDasharray:p?"":"5,5",strokeWidth:1.5})),v)},i}(t.CircleNode),r=function(e){function t(t,i){var r,o,a,s;t.id||(t.id="Event_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(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=g(g({attachedToRef:"",cancelActivity:!0},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),r=e.call(this,t,i)||this,fe.call(r),r}return f(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 Ce(e){var n=w(e.useDefinition(),1)[0],i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return f(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,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-d/2,")")}],w(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",g(g({},r),{cx:a,cy:s,r:l,strokeWidth:1.5})),t.h("circle",g(g({},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(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40});var l=((null===(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=g(g({},u),t.properties),(null===(s=t.properties)||void 0===s?void 0:s.definitionType)&&(t.properties.definitionId="Definition_".concat(me())),r=e.call(this,t,i)||this,fe.call(r),r}return f(t,e),t.prototype.setAttributes=function(){this.r=18},t}(t.CircleNodeModel);return{type:"bpmn:intermediateThrowEvent",view:i,model:r}}var Ne=[t.h("circle",{cx:18,cy:18,r:11,style:"stroke-linecap: round;stroke-linejoin: round;stroke: rgb(34, 36, 42);stroke-width: 2px;fill: white"}),t.h("path",{d:"M 18,18 l 2.25,-7.5 m -2.25,7.5 l 5.25,1.5",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 2px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(0,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(30,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(60,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(90,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(120,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(150,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(180,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(210,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(240,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(270,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(300,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"}),t.h("path",{d:"M 18,18 m 0,7.5 l -0,2.25",transform:"rotate(330,18,18)",style:"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"})],_e=[t.h("circle",{cx:18,cy:18,r:10,style:"stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 4px; fill: rgb(34, 36, 42);"})],Se="m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z",Me="m 23,10 0,12.5 -12.5,0 0,5 12.5,0 0,12.5 5,0 0,-12.5 12.5,0 0,-5 -12.5,0 0,-12.5 -5,0 z",Ae=t.h("circle",{cx:25,cy:25,r:13,style:"stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 2.5px; fill: white;"}),Te="M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z",ke="M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z",Oe="m44,60 m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",Re="m47,61 m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",De="m 50,73 c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",Pe=Object.freeze({__proto__:null,compensationIcon:"m 7.92,18 9,-6.5 0,13 z m 9.3,-0.4 8.7,-6.1 0,13 -8.7,-6.1 z",conditionalIcon:"M 10.5,8.5 l 14.5,0 l 0,18 l -14.5,0 Z M 12.5,11.5 l 10.5,0 M 12.5,14.5 l 10.5,0 M 12.5,17.5 l 10.5,0 M 12.5,20.5 l 10.5,0 M 12.5,23.5 l 10.5,0 M 12.5,26.5 l 10.5,0 ",errorIcon:"m 7.2,25.991999999999997 0.09350000000000001,-0.025300000000000003 7.3392,-9.610700000000001 7.667000000000001,8.9661 4.7003,-18.2204 -5.8707,11.6501 -7.299600000000001,-9.585400000000002 z",escalationIcon:"M 18,7.2 l 8,20 l -8,-7 l -8,7 Z",exclusiveIcon:Se,inclusiveIcon:Ae,linkIcon:"m 20.52,9.468 0,4.4375 -13.5,0 0,6.75 13.5,0 0,4.4375 9.84375,-7.8125 -9.84375,-7.8125 z",loopMarker:De,manualTaskIcon:"M0.5,3.751L4.583,0.5009999999999999C4.583,0.5009999999999999,15.749,0.5839999999999999,16.666,0.5839999999999999S14.249,3.5009999999999994,15.166,3.5009999999999994S26.833,3.5009999999999994,27.75,3.5009999999999994C28.916,5.209,27.582,6.667999999999999,26.916,7.167999999999999S27.791,9.084999999999999,25.916,11.584999999999999C25.166,11.834999999999999,26.666,13.459999999999999,24.583000000000002,14.918C23.416,15.501,25.166,16.46,23.333000000000002,17.750999999999998C22.166,17.750999999999998,2.5000000000000036,17.833999999999996,2.5000000000000036,17.833999999999996L0.5000000000000036,16.500999999999998V3.751ZM13.5,7L27,7M13.5,11L26,11M14,14.5L25,14.5M8.2,3.1L15,3.1",messageIcon:"m 8.459999999999999,11.34 l 0,12.6 l 18.900000000000002,0 l 0,-12.6 z l 9.450000000000001,5.4 l 9.450000000000001,-5.4",parallelIcon:Me,parallelMarker:Oe,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:Re,serviceTaskIcon:Te,signalIcon:"M 18,7.2 l 9,16.2 l -18,0 Z",style:{throw:"fill: rgb(34, 36, 42); stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;",catch:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;",nonIntermediate:"stroke-width: 1.5; stroke-dash-array: 6",intermediate:"stroke-width: 1.5"},terminateIcon:_e,timerIcon:Ne,userTaskIcon:ke});function Ie(e,n,i){var r=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return f(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,g(g({},u),{x:r,y:o,points:l})),"string"==typeof n?t.h("path",g(g({d:n},u),{fill:"rgb(34, 36, 42)",strokeWidth:1})):n)},i}(t.PolygonNode);return{type:e,view:r,model:function(e){function t(t,n){var r=this;return t.id||(t.id="Gateway_".concat(me())),t.text||(t.text=""),t.text&&"string"==typeof t.text&&(t.text={value:t.text,x:t.x,y:t.y+40}),t.properties=g(g({},i||{}),t.properties),(r=e.call(this,t,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],fe.call(r),r}return f(t,e),t}(t.PolygonNodeModel)}}var Le={parallel:Oe,sequential:Re,loop:De};function Be(e,n,i){var r=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return f(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,E(["g",{transform:"matrix(1 0 0 1 ".concat(i-o/2," ").concat(r-a/2,")")}],w(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",g(g({},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:Le[s.multiInstanceType]||""}))])},i}(t.RectNode),o=function(e){function t(t,n){var r,o=this;t.id||(t.id="Activity_".concat(me()));var a=g(g({},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"),fe.call(o),o}return f(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 je="object"==typeof global&&global&&global.Object===Object&&global,ze="object"==typeof self&&self&&self.Object===Object&&self,He=je||ze||Function("return this")(),Fe=He.Symbol,We=Object.prototype,Ge=We.hasOwnProperty,Ve=We.toString,Ue=Fe?Fe.toStringTag:void 0;var qe=Object.prototype.toString;var Xe="[object Null]",Ke="[object Undefined]",Ye=Fe?Fe.toStringTag:void 0;function Qe(e){return null==e?void 0===e?Ke:Xe:Ye&&Ye in Object(e)?function(e){var t=Ge.call(e,Ue),n=e[Ue];try{e[Ue]=void 0;var i=!0}catch(e){}var r=Ve.call(e);return i&&(t?e[Ue]=n:delete e[Ue]),r}(e):function(e){return qe.call(e)}(e)}function Ze(e){return null!=e&&"object"==typeof e}var $e="[object Symbol]";function Je(e){return"symbol"==typeof e||Ze(e)&&Qe(e)==$e}var et=NaN;function tt(e){return"number"==typeof e?e:Je(e)?et:+e}function nt(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 it=Array.isArray,rt=1/0,ot=Fe?Fe.prototype:void 0,at=ot?ot.toString:void 0;function st(e){if("string"==typeof e)return e;if(it(e))return nt(e,st)+"";if(Je(e))return at?at.call(e):"";var t=e+"";return"0"==t&&1/e==-rt?"-0":t}function lt(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=st(n),i=st(i)):(n=tt(n),i=tt(i)),r=e(n,i)}return r}}var ut=lt((function(e,t){return e+t}),0),dt=/\s/;function ct(e){for(var t=e.length;t--&&dt.test(e.charAt(t)););return t}var ht=/^\s+/;function pt(e){return e?e.slice(0,ct(e)+1).replace(ht,""):e}function ft(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var gt=NaN,vt=/^[-+]0x[0-9a-f]+$/i,mt=/^0b[01]+$/i,yt=/^0o[0-7]+$/i,bt=parseInt;function xt(e){if("number"==typeof e)return e;if(Je(e))return gt;if(ft(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ft(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=pt(e);var n=mt.test(e);return n||yt.test(e)?bt(e.slice(2),n?2:8):vt.test(e)?gt:+e}var wt=1/0,Et=17976931348623157e292;function Ct(e){return e?(e=xt(e))===wt||e===-wt?(e<0?-1:1)*Et:e==e?e:0:0===e?e:0}function Nt(e){var t=Ct(e),n=t%1;return t==t?n?t-n:t:0}function _t(e){return e}var St="[object AsyncFunction]",Mt="[object Function]",At="[object GeneratorFunction]",Tt="[object Proxy]";function kt(e){if(!ft(e))return!1;var t=Qe(e);return t==Mt||t==At||t==St||t==Tt}var Ot,Rt=He["__core-js_shared__"],Dt=(Ot=/[^.]+$/.exec(Rt&&Rt.keys&&Rt.keys.IE_PROTO||""))?"Symbol(src)_1."+Ot:"";var Pt=Function.prototype.toString;function It(e){if(null!=e){try{return Pt.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Lt=/^\[object .+?Constructor\]$/,Bt=Function.prototype,jt=Object.prototype,zt=Bt.toString,Ht=jt.hasOwnProperty,Ft=RegExp("^"+zt.call(Ht).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wt(e){return!(!ft(e)||function(e){return!!Dt&&Dt in e}(e))&&(kt(e)?Ft:Lt).test(It(e))}function Gt(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Wt(n)?n:void 0}var Vt=Gt(He,"WeakMap"),Ut=Vt&&new Vt,qt=Ut?function(e,t){return Ut.set(e,t),e}:_t,Xt=Object.create,Kt=function(){function e(){}return function(t){if(!ft(t))return{};if(Xt)return Xt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Yt(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Kt(e.prototype),i=e.apply(n,t);return ft(i)?i:n}}var Qt=1;function Zt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var $t=Math.max;function Jt(e,t,n,i){for(var r=-1,o=e.length,a=n.length,s=-1,l=t.length,u=$t(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 en=Math.max;function tn(e,t,n,i){for(var r=-1,o=e.length,a=-1,s=n.length,l=-1,u=t.length,d=en(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 nn(){}var rn=4294967295;function on(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=rn,this.__views__=[]}function an(){}on.prototype=Kt(nn.prototype),on.prototype.constructor=on;var sn=Ut?function(e){return Ut.get(e)}:an,ln={},un=Object.prototype.hasOwnProperty;function dn(e){for(var t=e.name+"",n=ln[t],i=un.call(ln,t)?n.length:0;i--;){var r=n[i],o=r.func;if(null==o||o==e)return r.name}return t}function cn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function hn(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}function pn(e){if(e instanceof on)return e.clone();var t=new cn(e.__wrapped__,e.__chain__);return t.__actions__=hn(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}cn.prototype=Kt(nn.prototype),cn.prototype.constructor=cn;var fn=Object.prototype.hasOwnProperty;function gn(e){if(Ze(e)&&!it(e)&&!(e instanceof on)){if(e instanceof cn)return e;if(fn.call(e,"__wrapped__"))return pn(e)}return new cn(e)}function vn(e){var t=dn(e),n=gn[t];if("function"!=typeof n||!(t in on.prototype))return!1;if(e===n)return!0;var i=sn(n);return!!i&&e===i[0]}gn.prototype=nn.prototype,gn.prototype.constructor=gn;var mn=Date.now;function yn(e){var t=0,n=0;return function(){var i=mn(),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 bn=yn(qt),xn=/\{\n\/\* \[wrapped with (.+)\] \*/,wn=/,? & /;var En=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function Cn(e){return function(){return e}}var Nn=function(){try{var e=Gt(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_n=Nn?function(e,t){return Nn(e,"toString",{configurable:!0,enumerable:!1,value:Cn(t),writable:!0})}:_t,Sn=yn(_n);function Mn(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););return e}function An(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 Tn(e){return e!=e}function kn(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):An(e,Tn,n)}function On(e,t){return!!(null==e?0:e.length)&&kn(e,t,0)>-1}var Rn=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function Dn(e,t,n){var i=t+"";return Sn(e,function(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(En,"{\n/* [wrapped with "+t+"] */\n")}(i,function(e,t){return Mn(Rn,(function(n){var i="_."+n[0];t&n[1]&&!On(e,i)&&e.push(i)})),e.sort()}(function(e){var t=e.match(xn);return t?t[1].split(wn):[]}(i),n)))}var Pn=1,In=2,Ln=4,Bn=8,jn=32,zn=64;function Hn(e,t,n,i,r,o,a,s,l,u){var d=t&Bn;t|=d?jn:zn,(t&=~(d?zn:jn))&Ln||(t&=~(Pn|In));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 vn(e)&&bn(h,c),h.placeholder=i,Dn(h,e,t)}function Fn(e){return e.placeholder}var Wn=9007199254740991,Gn=/^(?:0|[1-9]\d*)$/;function Vn(e,t){var n=typeof e;return!!(t=null==t?Wn:t)&&("number"==n||"symbol"!=n&&Gn.test(e))&&e>-1&&e%1==0&&e<t}var Un=Math.min;var qn="__lodash_placeholder__";function Xn(e,t){for(var n=-1,i=e.length,r=0,o=[];++n<i;){var a=e[n];a!==t&&a!==qn||(e[n]=qn,o[r++]=n)}return o}var Kn=1,Yn=2,Qn=8,Zn=16,$n=128,Jn=512;function ei(e,t,n,i,r,o,a,s,l,u){var d=t&$n,c=t&Kn,h=t&Yn,p=t&(Qn|Zn),f=t&Jn,g=h?void 0:Yt(e);return function v(){for(var m=arguments.length,y=Array(m),b=m;b--;)y[b]=arguments[b];if(p)var x=Fn(v),w=function(e,t){for(var n=e.length,i=0;n--;)e[n]===t&&++i;return i}(y,x);if(i&&(y=Jt(y,i,r,p)),o&&(y=tn(y,o,a,p)),m-=w,p&&m<u){var E=Xn(y,x);return Hn(e,t,ei,v.placeholder,n,y,E,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=Un(t.length,n),r=hn(e);i--;){var o=t[i];e[i]=Vn(o,n)?r[o]:void 0}return e}(y,s):f&&m>1&&y.reverse(),d&&l<m&&(y.length=l),this&&this!==He&&this instanceof v&&(N=g||Yt(N)),N.apply(C,y)}}var ti=1;var ni="__lodash_placeholder__",ii=1,ri=2,oi=4,ai=8,si=128,li=256,ui=Math.min;var di="Expected a function",ci=1,hi=2,pi=8,fi=16,gi=32,vi=64,mi=Math.max;function yi(e,t,n,i,r,o,a,s){var l=t&hi;if(!l&&"function"!=typeof e)throw new TypeError(di);var u=i?i.length:0;if(u||(t&=~(gi|vi),i=r=void 0),a=void 0===a?a:mi(Nt(a),0),s=void 0===s?s:Nt(s),u-=r?r.length:0,t&vi){var d=i,c=r;i=r=void 0}var h=l?void 0:sn(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<(ii|ri|si),a=i==si&&n==ai||i==si&&n==li&&e[7].length<=t[8]||i==(si|li)&&t[7].length<=t[8]&&n==ai;if(!o&&!a)return e;i&ii&&(e[2]=t[2],r|=n&ii?0:oi);var s=t[3];if(s){var l=e[3];e[3]=l?Jt(l,s,t[4]):s,e[4]=l?Xn(e[3],ni):t[4]}(s=t[5])&&(l=e[5],e[5]=l?tn(l,s,t[6]):s,e[6]=l?Xn(e[5],ni):t[6]),(s=t[7])&&(e[7]=s),i&si&&(e[8]=null==e[8]?t[8]:ui(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=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:mi(p[9]-u,0))&&t&(pi|fi)&&(t&=~(pi|fi)),t&&t!=ci)f=t==pi||t==fi?function(e,t,n){var i=Yt(e);return function r(){for(var o=arguments.length,a=Array(o),s=o,l=Fn(r);s--;)a[s]=arguments[s];var u=o<3&&a[0]!==l&&a[o-1]!==l?[]:Xn(a,l);return(o-=u.length)<n?Hn(e,t,ei,r.placeholder,void 0,a,u,void 0,void 0,n-o):Zt(this&&this!==He&&this instanceof r?i:e,this,a)}}(e,t,s):t!=gi&&t!=(ci|gi)||r.length?ei.apply(void 0,p):function(e,t,n,i){var r=t&ti,o=Yt(e);return function t(){for(var a=-1,s=arguments.length,l=-1,u=i.length,d=Array(u+s),c=this&&this!==He&&this instanceof t?o:e;++l<u;)d[l]=i[l];for(;s--;)d[l++]=arguments[++a];return Zt(c,r?n:this,d)}}(e,t,n,i);else var f=function(e,t,n){var i=t&Qt,r=Yt(e);return function t(){return(this&&this!==He&&this instanceof t?r:e).apply(i?n:this,arguments)}}(e,t,n);return Dn((h?qt:bn)(f,p),e,t)}var bi=128;function xi(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,yi(e,bi,void 0,void 0,void 0,void 0,t)}function wi(e,t,n){"__proto__"==t&&Nn?Nn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ei(e,t){return e===t||e!=e&&t!=t}var Ci=Object.prototype.hasOwnProperty;function Ni(e,t,n){var i=e[t];Ci.call(e,t)&&Ei(i,n)&&(void 0!==n||t in e)||wi(e,t,n)}function _i(e,t,n,i){var 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?wi(n,s,l):Ni(n,s,l)}return n}var Si=Math.max;function Mi(e,t,n){return t=Si(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=Si(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),Zt(e,this,s)}}function Ai(e,t){return Sn(Mi(e,t,_t),e+"")}var Ti=9007199254740991;function ki(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Ti}function Oi(e){return null!=e&&ki(e.length)&&!kt(e)}function Ri(e,t,n){if(!ft(n))return!1;var i=typeof t;return!!("number"==i?Oi(n)&&Vn(t,n.length):"string"==i&&t in n)&&Ei(n[t],e)}function Di(e){return Ai((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&&Ri(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 Pi=Object.prototype;function Ii(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Pi)}function Li(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}function Bi(e){return Ze(e)&&"[object Arguments]"==Qe(e)}var ji=Object.prototype,zi=ji.hasOwnProperty,Hi=ji.propertyIsEnumerable,Fi=Bi(function(){return arguments}())?Bi:function(e){return Ze(e)&&zi.call(e,"callee")&&!Hi.call(e,"callee")};function Wi(){return!1}var Gi="object"==typeof e&&e&&!e.nodeType&&e,Vi=Gi&&"object"==typeof module&&module&&!module.nodeType&&module,Ui=Vi&&Vi.exports===Gi?He.Buffer:void 0,qi=(Ui?Ui.isBuffer:void 0)||Wi,Xi={};function Ki(e){return function(t){return e(t)}}Xi["[object Float32Array]"]=Xi["[object Float64Array]"]=Xi["[object Int8Array]"]=Xi["[object Int16Array]"]=Xi["[object Int32Array]"]=Xi["[object Uint8Array]"]=Xi["[object Uint8ClampedArray]"]=Xi["[object Uint16Array]"]=Xi["[object Uint32Array]"]=!0,Xi["[object Arguments]"]=Xi["[object Array]"]=Xi["[object ArrayBuffer]"]=Xi["[object Boolean]"]=Xi["[object DataView]"]=Xi["[object Date]"]=Xi["[object Error]"]=Xi["[object Function]"]=Xi["[object Map]"]=Xi["[object Number]"]=Xi["[object Object]"]=Xi["[object RegExp]"]=Xi["[object Set]"]=Xi["[object String]"]=Xi["[object WeakMap]"]=!1;var Yi="object"==typeof e&&e&&!e.nodeType&&e,Qi=Yi&&"object"==typeof module&&module&&!module.nodeType&&module,Zi=Qi&&Qi.exports===Yi&&je.process,$i=function(){try{var e=Qi&&Qi.require&&Qi.require("util").types;return e||Zi&&Zi.binding&&Zi.binding("util")}catch(e){}}(),Ji=$i&&$i.isTypedArray,er=Ji?Ki(Ji):function(e){return Ze(e)&&ki(e.length)&&!!Xi[Qe(e)]},tr=Object.prototype.hasOwnProperty;function nr(e,t){var n=it(e),i=!n&&Fi(e),r=!n&&!i&&qi(e),o=!n&&!i&&!r&&er(e),a=n||i||r||o,s=a?Li(e.length,String):[],l=s.length;for(var u in e)!t&&!tr.call(e,u)||a&&("length"==u||r&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Vn(u,l))||s.push(u);return s}function ir(e,t){return function(n){return e(t(n))}}var rr=ir(Object.keys,Object),or=Object.prototype.hasOwnProperty;function ar(e){if(!Ii(e))return rr(e);var t=[];for(var n in Object(e))or.call(e,n)&&"constructor"!=n&&t.push(n);return t}function sr(e){return Oi(e)?nr(e):ar(e)}var lr=Object.prototype.hasOwnProperty,ur=Di((function(e,t){if(Ii(t)||Oi(t))_i(t,sr(t),e);else for(var n in t)lr.call(t,n)&&Ni(e,n,t[n])}));var dr=Object.prototype.hasOwnProperty;function cr(e){if(!ft(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Ii(e),n=[];for(var i in e)("constructor"!=i||!t&&dr.call(e,i))&&n.push(i);return n}function hr(e){return Oi(e)?nr(e,!0):cr(e)}var pr=Di((function(e,t){_i(t,hr(t),e)})),fr=Di((function(e,t,n,i){_i(t,hr(t),e,i)})),gr=Di((function(e,t,n,i){_i(t,sr(t),e,i)})),vr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mr=/^\w*$/;function yr(e,t){if(it(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Je(e))||(mr.test(e)||!vr.test(e)||null!=t&&e in Object(t))}var br=Gt(Object,"create");var xr=Object.prototype.hasOwnProperty;var wr=Object.prototype.hasOwnProperty;function Er(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 Cr(e,t){for(var n=e.length;n--;)if(Ei(e[n][0],t))return n;return-1}Er.prototype.clear=function(){this.__data__=br?br(null):{},this.size=0},Er.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Er.prototype.get=function(e){var t=this.__data__;if(br){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return xr.call(t,e)?t[e]:void 0},Er.prototype.has=function(e){var t=this.__data__;return br?void 0!==t[e]:wr.call(t,e)},Er.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=br&&void 0===t?"__lodash_hash_undefined__":t,this};var Nr=Array.prototype.splice;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])}}_r.prototype.clear=function(){this.__data__=[],this.size=0},_r.prototype.delete=function(e){var t=this.__data__,n=Cr(t,e);return!(n<0)&&(n==t.length-1?t.pop():Nr.call(t,n,1),--this.size,!0)},_r.prototype.get=function(e){var t=this.__data__,n=Cr(t,e);return n<0?void 0:t[n][1]},_r.prototype.has=function(e){return Cr(this.__data__,e)>-1},_r.prototype.set=function(e,t){var n=this.__data__,i=Cr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var Sr=Gt(He,"Map");function Mr(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 Ar(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])}}Ar.prototype.clear=function(){this.size=0,this.__data__={hash:new Er,map:new(Sr||_r),string:new Er}},Ar.prototype.delete=function(e){var t=Mr(this,e).delete(e);return this.size-=t?1:0,t},Ar.prototype.get=function(e){return Mr(this,e).get(e)},Ar.prototype.has=function(e){return Mr(this,e).has(e)},Ar.prototype.set=function(e,t){var n=Mr(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};var Tr="Expected a function";function kr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Tr);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(kr.Cache||Ar),n}kr.Cache=Ar;var Or=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rr=/\\(\\)?/g,Dr=function(e){var t=kr(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(Or,(function(e,n,i,r){t.push(i?r.replace(Rr,"$1"):n||e)})),t}));function Pr(e){return null==e?"":st(e)}function Ir(e,t){return it(e)?e:yr(e,t)?[e]:Dr(Pr(e))}var Lr=1/0;function Br(e){if("string"==typeof e||Je(e))return e;var t=e+"";return"0"==t&&1/e==-Lr?"-0":t}function jr(e,t){for(var n=0,i=(t=Ir(t,e)).length;null!=e&&n<i;)e=e[Br(t[n++])];return n&&n==i?e:void 0}function zr(e,t,n){var i=null==e?void 0:jr(e,t);return void 0===i?n:i}function Hr(e,t){for(var n=-1,i=t.length,r=Array(i),o=null==e;++n<i;)r[n]=o?void 0:zr(e,t[n]);return r}function Fr(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e}var Wr=Fe?Fe.isConcatSpreadable:void 0;function Gr(e){return it(e)||Fi(e)||!!(Wr&&e&&e[Wr])}function Vr(e,t,n,i,r){var o=-1,a=e.length;for(n||(n=Gr),r||(r=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?Vr(s,t-1,n,i,r):Fr(r,s):i||(r[r.length]=s)}return r}function Ur(e){return(null==e?0:e.length)?Vr(e,1):[]}function qr(e){return Sn(Mi(e,void 0,Ur),e+"")}var Xr=qr(Hr),Kr=ir(Object.getPrototypeOf,Object),Yr="[object Object]",Qr=Function.prototype,Zr=Object.prototype,$r=Qr.toString,Jr=Zr.hasOwnProperty,eo=$r.call(Object);function to(e){if(!Ze(e)||Qe(e)!=Yr)return!1;var t=Kr(e);if(null===t)return!0;var n=Jr.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&$r.call(n)==eo}var no="[object DOMException]",io="[object Error]";function ro(e){if(!Ze(e))return!1;var t=Qe(e);return t==io||t==no||"string"==typeof e.message&&"string"==typeof e.name&&!to(e)}var oo=Ai((function(e,t){try{return Zt(e,void 0,t)}catch(e){return ro(e)?e:new Error(e)}})),ao="Expected a function";function so(e,t){var n;if("function"!=typeof t)throw new TypeError(ao);return e=Nt(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var lo=Ai((function(e,t,n){var i=1;if(n.length){var r=Xn(n,Fn(lo));i|=32}return yi(e,i,t,n,r)}));lo.placeholder={};var uo=qr((function(e,t){return Mn(t,(function(t){t=Br(t),wi(e,t,lo(e[t],e))})),e})),co=Ai((function(e,t,n){var i=3;if(n.length){var r=Xn(n,Fn(co));i|=32}return yi(t,i,e,n,r)}));function ho(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 po(e,t,n){var i=e.length;return n=void 0===n?i:n,!t&&n>=i?e:ho(e,t,n)}co.placeholder={};var fo=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function go(e){return fo.test(e)}var vo="\\ud800-\\udfff",mo="["+vo+"]",yo="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",bo="\\ud83c[\\udffb-\\udfff]",xo="[^"+vo+"]",wo="(?:\\ud83c[\\udde6-\\uddff]){2}",Eo="[\\ud800-\\udbff][\\udc00-\\udfff]",Co="(?:"+yo+"|"+bo+")"+"?",No="[\\ufe0e\\ufe0f]?",_o=No+Co+("(?:\\u200d(?:"+[xo,wo,Eo].join("|")+")"+No+Co+")*"),So="(?:"+[xo+yo+"?",yo,wo,Eo,mo].join("|")+")",Mo=RegExp(bo+"(?="+bo+")|"+So+_o,"g");function Ao(e){return go(e)?function(e){return e.match(Mo)||[]}(e):function(e){return e.split("")}(e)}function To(e){return function(t){var n=go(t=Pr(t))?Ao(t):void 0,i=n?n[0]:t.charAt(0),r=n?po(n,1).join(""):t.slice(1);return i[e]()+r}}var ko=To("toUpperCase");function Oo(e){return ko(Pr(e).toLowerCase())}function Ro(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 Do(e){return function(t){return null==e?void 0:e[t]}}var Po=Do({"À":"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"}),Io=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Lo=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");function Bo(e){return(e=Pr(e))&&e.replace(Io,Po).replace(Lo,"")}var jo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var zo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Ho="\\ud800-\\udfff",Fo="\\u2700-\\u27bf",Wo="a-z\\xdf-\\xf6\\xf8-\\xff",Go="A-Z\\xc0-\\xd6\\xd8-\\xde",Vo="\\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",Uo="["+Vo+"]",qo="\\d+",Xo="["+Fo+"]",Ko="["+Wo+"]",Yo="[^"+Ho+Vo+qo+Fo+Wo+Go+"]",Qo="(?:\\ud83c[\\udde6-\\uddff]){2}",Zo="[\\ud800-\\udbff][\\udc00-\\udfff]",$o="["+Go+"]",Jo="(?:"+Ko+"|"+Yo+")",ea="(?:"+$o+"|"+Yo+")",ta="(?:['’](?:d|ll|m|re|s|t|ve))?",na="(?:['’](?:D|LL|M|RE|S|T|VE))?",ia="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",ra="[\\ufe0e\\ufe0f]?",oa=ra+ia+("(?:\\u200d(?:"+["[^"+Ho+"]",Qo,Zo].join("|")+")"+ra+ia+")*"),aa="(?:"+[Xo,Qo,Zo].join("|")+")"+oa,sa=RegExp([$o+"?"+Ko+"+"+ta+"(?="+[Uo,$o,"$"].join("|")+")",ea+"+"+na+"(?="+[Uo,$o+Jo,"$"].join("|")+")",$o+"?"+Jo+"+"+ta,$o+"+"+na,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",qo,aa].join("|"),"g");function la(e,t,n){return e=Pr(e),void 0===(t=n?void 0:t)?function(e){return zo.test(e)}(e)?function(e){return e.match(sa)||[]}(e):function(e){return e.match(jo)||[]}(e):e.match(t)||[]}var ua=RegExp("['’]","g");function da(e){return function(t){return Ro(la(Bo(t).replace(ua,"")),e,"")}}var ca=da((function(e,t,n){return t=t.toLowerCase(),e+(n?Oo(t):t)}));var ha=He.isFinite,pa=Math.min;function fa(e){var t=Math[e];return function(e,n){if(e=xt(e),(n=null==n?0:pa(Nt(n),292))&&ha(e)){var i=(Pr(e)+"e").split("e");return+((i=(Pr(t(i[0]+"e"+(+i[1]+n)))+"e").split("e"))[0]+"e"+(+i[1]-n))}return t(e)}}var ga=fa("ceil");function va(e){var t=gn(e);return t.__chain__=!0,t}var ma=Math.ceil,ya=Math.max;function ba(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function xa(e){var t=this.__data__=new _r(e);this.size=t.size}function wa(e,t){return e&&_i(t,sr(t),e)}xa.prototype.clear=function(){this.__data__=new _r,this.size=0},xa.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},xa.prototype.get=function(e){return this.__data__.get(e)},xa.prototype.has=function(e){return this.__data__.has(e)},xa.prototype.set=function(e,t){var n=this.__data__;if(n instanceof _r){var i=n.__data__;if(!Sr||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ar(i)}return n.set(e,t),this.size=n.size,this};var Ea="object"==typeof e&&e&&!e.nodeType&&e,Ca=Ea&&"object"==typeof module&&module&&!module.nodeType&&module,Na=Ca&&Ca.exports===Ea?He.Buffer:void 0,_a=Na?Na.allocUnsafe:void 0;function Sa(e,t){if(t)return e.slice();var n=e.length,i=_a?_a(n):new e.constructor(n);return e.copy(i),i}function Ma(e,t){for(var n=-1,i=null==e?0:e.length,r=0,o=[];++n<i;){var a=e[n];t(a,n,e)&&(o[r++]=a)}return o}function Aa(){return[]}var Ta=Object.prototype.propertyIsEnumerable,ka=Object.getOwnPropertySymbols,Oa=ka?function(e){return null==e?[]:(e=Object(e),Ma(ka(e),(function(t){return Ta.call(e,t)})))}:Aa;var Ra=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Fr(t,Oa(e)),e=Kr(e);return t}:Aa;function Da(e,t,n){var i=t(e);return it(e)?i:Fr(i,n(e))}function Pa(e){return Da(e,sr,Oa)}function Ia(e){return Da(e,hr,Ra)}var La=Gt(He,"DataView"),Ba=Gt(He,"Promise"),ja=Gt(He,"Set"),za="[object Map]",Ha="[object Promise]",Fa="[object Set]",Wa="[object WeakMap]",Ga="[object DataView]",Va=It(La),Ua=It(Sr),qa=It(Ba),Xa=It(ja),Ka=It(Vt),Ya=Qe;(La&&Ya(new La(new ArrayBuffer(1)))!=Ga||Sr&&Ya(new Sr)!=za||Ba&&Ya(Ba.resolve())!=Ha||ja&&Ya(new ja)!=Fa||Vt&&Ya(new Vt)!=Wa)&&(Ya=function(e){var t=Qe(e),n="[object Object]"==t?e.constructor:void 0,i=n?It(n):"";if(i)switch(i){case Va:return Ga;case Ua:return za;case qa:return Ha;case Xa:return Fa;case Ka:return Wa}return t});var Qa=Ya,Za=Object.prototype.hasOwnProperty;var $a=He.Uint8Array;function Ja(e){var t=new e.constructor(e.byteLength);return new $a(t).set(new $a(e)),t}var es=/\w*$/;var ts=Fe?Fe.prototype:void 0,ns=ts?ts.valueOf:void 0;function is(e,t){var n=t?Ja(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var rs="[object Boolean]",os="[object Date]",as="[object Map]",ss="[object Number]",ls="[object RegExp]",us="[object Set]",ds="[object String]",cs="[object Symbol]",hs="[object ArrayBuffer]",ps="[object DataView]",fs="[object Float32Array]",gs="[object Float64Array]",vs="[object Int8Array]",ms="[object Int16Array]",ys="[object Int32Array]",bs="[object Uint8Array]",xs="[object Uint8ClampedArray]",ws="[object Uint16Array]",Es="[object Uint32Array]";function Cs(e,t,n){var i,r=e.constructor;switch(t){case hs:return Ja(e);case rs:case os:return new r(+e);case ps:return function(e,t){var n=t?Ja(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case fs:case gs:case vs:case ms:case ys:case bs:case xs:case ws:case Es:return is(e,n);case as:return new r;case ss:case ds:return new r(e);case ls:return function(e){var t=new e.constructor(e.source,es.exec(e));return t.lastIndex=e.lastIndex,t}(e);case us:return new r;case cs:return i=e,ns?Object(ns.call(i)):{}}}function Ns(e){return"function"!=typeof e.constructor||Ii(e)?{}:Kt(Kr(e))}var _s=$i&&$i.isMap,Ss=_s?Ki(_s):function(e){return Ze(e)&&"[object Map]"==Qa(e)};var Ms=$i&&$i.isSet,As=Ms?Ki(Ms):function(e){return Ze(e)&&"[object Set]"==Qa(e)},Ts=1,ks=2,Os=4,Rs="[object Arguments]",Ds="[object Function]",Ps="[object GeneratorFunction]",Is="[object Object]",Ls={};function Bs(e,t,n,i,r,o){var a,s=t&Ts,l=t&ks,u=t&Os;if(n&&(a=r?n(e,i,r,o):n(e)),void 0!==a)return a;if(!ft(e))return e;var d=it(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Za.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return hn(e,a)}else{var c=Qa(e),h=c==Ds||c==Ps;if(qi(e))return Sa(e,s);if(c==Is||c==Rs||h&&!r){if(a=l||h?{}:Ns(e),!s)return l?function(e,t){return _i(e,Ra(e),t)}(e,function(e,t){return e&&_i(t,hr(t),e)}(a,e)):function(e,t){return _i(e,Oa(e),t)}(e,wa(a,e))}else{if(!Ls[c])return r?e:{};a=Cs(e,c,s)}}o||(o=new xa);var p=o.get(e);if(p)return p;o.set(e,a),As(e)?e.forEach((function(i){a.add(Bs(i,t,n,i,e,o))})):Ss(e)&&e.forEach((function(i,r){a.set(r,Bs(i,t,n,r,e,o))}));var f=d?void 0:(u?l?Ia:Pa:l?hr:sr)(e);return Mn(f||e,(function(i,r){f&&(i=e[r=i]),Ni(a,r,Bs(i,t,n,r,e,o))})),a}Ls[Rs]=Ls["[object Array]"]=Ls["[object ArrayBuffer]"]=Ls["[object DataView]"]=Ls["[object Boolean]"]=Ls["[object Date]"]=Ls["[object Float32Array]"]=Ls["[object Float64Array]"]=Ls["[object Int8Array]"]=Ls["[object Int16Array]"]=Ls["[object Int32Array]"]=Ls["[object Map]"]=Ls["[object Number]"]=Ls[Is]=Ls["[object RegExp]"]=Ls["[object Set]"]=Ls["[object String]"]=Ls["[object Symbol]"]=Ls["[object Uint8Array]"]=Ls["[object Uint8ClampedArray]"]=Ls["[object Uint16Array]"]=Ls["[object Uint32Array]"]=!0,Ls["[object Error]"]=Ls[Ds]=Ls["[object WeakMap]"]=!1;function js(e){return Bs(e,5)}function zs(){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 Fr(it(n)?hn(n):[n],Vr(t,1))}function Hs(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Ar;++t<n;)this.add(e[t])}function Fs(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 Ws(e,t){return e.has(t)}Hs.prototype.add=Hs.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Hs.prototype.has=function(e){return this.__data__.has(e)};var Gs=1,Vs=2;function Us(e,t,n,i,r,o){var a=n&Gs,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&Vs?new Hs: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(!Fs(t,(function(e,t){if(!Ws(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 qs(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Xs(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Ks=1,Ys=2,Qs="[object Boolean]",Zs="[object Date]",$s="[object Error]",Js="[object Map]",el="[object Number]",tl="[object RegExp]",nl="[object Set]",il="[object String]",rl="[object Symbol]",ol="[object ArrayBuffer]",al="[object DataView]",sl=Fe?Fe.prototype:void 0,ll=sl?sl.valueOf:void 0;var ul=1,dl=Object.prototype.hasOwnProperty;var cl=1,hl="[object Arguments]",pl="[object Array]",fl="[object Object]",gl=Object.prototype.hasOwnProperty;function vl(e,t,n,i,r,o){var a=it(e),s=it(t),l=a?pl:Qa(e),u=s?pl:Qa(t),d=(l=l==hl?fl:l)==fl,c=(u=u==hl?fl:u)==fl,h=l==u;if(h&&qi(e)){if(!qi(t))return!1;a=!0,d=!1}if(h&&!d)return o||(o=new xa),a||er(e)?Us(e,t,n,i,r,o):function(e,t,n,i,r,o,a){switch(n){case al:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ol:return!(e.byteLength!=t.byteLength||!o(new $a(e),new $a(t)));case Qs:case Zs:case el:return Ei(+e,+t);case $s:return e.name==t.name&&e.message==t.message;case tl:case il:return e==t+"";case Js:var s=qs;case nl:var l=i&Ks;if(s||(s=Xs),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;i|=Ys,a.set(e,t);var d=Us(s(e),s(t),i,r,o,a);return a.delete(e),d;case rl:if(ll)return ll.call(e)==ll.call(t)}return!1}(e,t,l,n,i,r,o);if(!(n&cl)){var p=d&&gl.call(e,"__wrapped__"),f=c&&gl.call(t,"__wrapped__");if(p||f){var g=p?e.value():e,v=f?t.value():t;return o||(o=new xa),r(g,v,n,i,o)}}return!!h&&(o||(o=new xa),function(e,t,n,i,r,o){var a=n&ul,s=Pa(e),l=s.length;if(l!=Pa(t).length&&!a)return!1;for(var u=l;u--;){var d=s[u];if(!(a?d in t:dl.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 ml(e,t,n,i,r){return e===t||(null==e||null==t||!Ze(e)&&!Ze(t)?e!=e&&t!=t:vl(e,t,n,i,ml,r))}var yl=1,bl=2;function xl(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 xa;if(i)var h=i(u,d,l,e,t,c);if(!(void 0===h?ml(d,u,yl|bl,i,c):h))return!1}}return!0}function wl(e){return e==e&&!ft(e)}function El(e){for(var t=sr(e),n=t.length;n--;){var i=t[n],r=e[i];t[n]=[i,r,wl(r)]}return t}function Cl(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function Nl(e){var t=El(e);return 1==t.length&&t[0][2]?Cl(t[0][0],t[0][1]):function(n){return n===e||xl(n,e,t)}}function _l(e,t){return null!=e&&t in Object(e)}function Sl(e,t,n){for(var i=-1,r=(t=Ir(t,e)).length,o=!1;++i<r;){var a=Br(t[i]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++i!=r?o:!!(r=null==e?0:e.length)&&ki(r)&&Vn(a,r)&&(it(e)||Fi(e))}function Ml(e,t){return null!=e&&Sl(e,t,_l)}var Al=1,Tl=2;function kl(e,t){return yr(e)&&wl(t)?Cl(Br(e),t):function(n){var i=zr(n,e);return void 0===i&&i===t?Ml(n,e):ml(t,i,Al|Tl)}}function Ol(e){return function(t){return null==t?void 0:t[e]}}function Rl(e){return yr(e)?Ol(Br(e)):function(e){return function(t){return jr(t,e)}}(e)}function Dl(e){return"function"==typeof e?e:null==e?_t:"object"==typeof e?it(e)?kl(e[0],e[1]):Nl(e):Rl(e)}function Pl(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 Il(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 Ll(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 Bl=Ll();function jl(e,t){return e&&Bl(e,t,sr)}function zl(e,t){return function(n,i){if(null==n)return n;if(!Oi(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 Hl=zl(jl);function Fl(e,t,n,i){return Hl(e,(function(e,r,o){t(i,e,n(e),o)})),i}function Wl(e,t){return function(n,i){var r=it(n)?Il:Fl,o=t?t():{};return r(n,e,Dl(i),o)}}var Gl=Object.prototype.hasOwnProperty,Vl=Wl((function(e,t,n){Gl.call(e,n)?++e[n]:wi(e,n,1)}));function Ul(e,t,n){var i=yi(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=Ul.placeholder,i}Ul.placeholder={};function ql(e,t,n){var i=yi(e,16,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=ql.placeholder,i}ql.placeholder={};var Xl=function(){return He.Date.now()},Kl="Expected a function",Yl=Math.max,Ql=Math.min;function Zl(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(Kl);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=Xl();if(f(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return c?Ql(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=Xl(),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=xt(t)||0,ft(n)&&(d=!!n.leading,o=(c="maxWait"in n)?Yl(xt(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(Xl())},m}var $l=Object.prototype,Jl=$l.hasOwnProperty,eu=Ai((function(e,t){e=Object(e);var n=-1,i=t.length,r=i>2?t[2]:void 0;for(r&&Ri(t[0],t[1],r)&&(i=1);++n<i;)for(var o=t[n],a=hr(o),s=-1,l=a.length;++s<l;){var u=a[s],d=e[u];(void 0===d||Ei(d,$l[u])&&!Jl.call(e,u))&&(e[u]=o[u])}return e}));function tu(e,t,n){(void 0!==n&&!Ei(e[t],n)||void 0===n&&!(t in e))&&wi(e,t,n)}function nu(e){return Ze(e)&&Oi(e)}function iu(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ru(e){return _i(e,hr(e))}function ou(e,t,n,i,r){e!==t&&Bl(t,(function(o,a){if(r||(r=new xa),ft(o))!function(e,t,n,i,r,o,a){var s=iu(e,n),l=iu(t,n),u=a.get(l);if(u)tu(e,n,u);else{var d=o?o(s,l,n+"",e,t,a):void 0,c=void 0===d;if(c){var h=it(l),p=!h&&qi(l),f=!h&&!p&&er(l);d=l,h||p||f?it(s)?d=s:nu(s)?d=hn(s):p?(c=!1,d=Sa(l,!0)):f?(c=!1,d=is(l,!0)):d=[]:to(l)||Fi(l)?(d=s,Fi(s)?d=ru(s):ft(s)&&!kt(s)||(d=Ns(l))):c=!1}c&&(a.set(l,d),r(d,l,i,o,a),a.delete(l)),tu(e,n,d)}}(e,t,a,n,ou,i,r);else{var s=i?i(iu(e,a),o,a+"",e,t,r):void 0;void 0===s&&(s=o),tu(e,a,s)}}),hr)}function au(e,t,n,i,r,o){return ft(e)&&ft(t)&&(o.set(t,e),ou(e,t,void 0,au,o),o.delete(t)),e}var su=Di((function(e,t,n,i){ou(e,t,n,i)})),lu=Ai((function(e){return e.push(void 0,au),Zt(su,void 0,e)}));function uu(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)}var du=Ai((function(e,t){return uu(e,1,t)})),cu=Ai((function(e,t,n){return uu(e,xt(t)||0,n)}));function hu(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 pu=200;function fu(e,t,n,i){var r=-1,o=On,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=nt(t,Ki(n))),i?(o=hu,a=!1):t.length>=pu&&(o=Ws,a=!1,t=new Hs(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 gu=Ai((function(e,t){return nu(e)?fu(e,Vr(t,1,nu,!0)):[]}));function vu(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var mu=Ai((function(e,t){var n=vu(t);return nu(n)&&(n=void 0),nu(e)?fu(e,Vr(t,1,nu,!0),Dl(n)):[]})),yu=Ai((function(e,t){var n=vu(t);return nu(n)&&(n=void 0),nu(e)?fu(e,Vr(t,1,nu,!0),void 0,n):[]})),bu=lt((function(e,t){return e/t}),1);function xu(e,t,n,i){for(var r=e.length,o=i?r:-1;(i?o--:++o<r)&&t(e[o],o,e););return n?ho(e,i?0:o,i?o+1:r):ho(e,i?o+1:0,i?r:o)}function wu(e){return"function"==typeof e?e:_t}function Eu(e,t){return(it(e)?Mn:Hl)(e,wu(t))}function Cu(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}var Nu=Ll(!0);function _u(e,t){return e&&Nu(e,t,sr)}var Su=zl(_u,!0);function Mu(e,t){return(it(e)?Cu:Su)(e,wu(t))}function Au(e){return function(t){var n=Qa(t);return"[object Map]"==n?qs(t):"[object Set]"==n?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return nt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}var Tu=Au(sr),ku=Au(hr),Ou=Do({"&":"&","<":"<",">":">",'"':""","'":"'"}),Ru=/[&<>"']/g,Du=RegExp(Ru.source);function Pu(e){return(e=Pr(e))&&Du.test(e)?e.replace(Ru,Ou):e}var Iu=/[\\^$.*+?()[\]{}|]/g,Lu=RegExp(Iu.source);function Bu(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(!t(e[n],n,e))return!1;return!0}function ju(e,t){var n=!0;return Hl(e,(function(e,i,r){return n=!!t(e,i,r)})),n}var zu=4294967295;function Hu(e){return e?ba(Nt(e),0,zu):0}function Fu(e,t){var n=[];return Hl(e,(function(e,i,r){t(e,i,r)&&n.push(e)})),n}function Wu(e,t){return(it(e)?Ma:Fu)(e,Dl(t))}function Gu(e){return function(t,n,i){var r=Object(t);if(!Oi(t)){var o=Dl(n);t=sr(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 Vu=Math.max;function Uu(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=null==n?0:Nt(n);return r<0&&(r=Vu(i+r,0)),An(e,Dl(t),r)}var qu=Gu(Uu);function Xu(e,t,n){var i;return n(e,(function(e,n,r){if(t(e,n,r))return i=n,!1})),i}var Ku=Math.max,Yu=Math.min;function Qu(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i-1;return void 0!==n&&(r=Nt(n),r=n<0?Ku(i+r,0):Yu(r,i-1)),An(e,Dl(t),r,!0)}var Zu=Gu(Qu);function $u(e){return e&&e.length?e[0]:void 0}function Ju(e,t){var n=-1,i=Oi(e)?Array(e.length):[];return Hl(e,(function(e,r,o){i[++n]=t(e,r,o)})),i}function ed(e,t){return(it(e)?nt:Ju)(e,Dl(t))}var td=1/0;var nd=1/0;var id=fa("floor");function rd(e){return qr((function(t){var n=t.length,i=n,r=cn.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"==dn(o))var a=new cn([],!0)}for(i=a?i:n;++i<n;){var s=dn(o=t[i]),l="wrapper"==s?sn(o):void 0;a=l&&vn(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[dn(l[0])].apply(a,l[3]):1==o.length&&vn(o)?a[s]():a.thru(o)}return function(){var e=arguments,i=e[0];if(a&&1==e.length&&it(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 od=rd(),ad=rd(!0);function sd(e,t){return Ma(t,(function(t){return kt(e[t])}))}var ld=Object.prototype.hasOwnProperty,ud=Wl((function(e,t,n){ld.call(e,n)?e[n].push(t):wi(e,n,[t])}));function dd(e,t){return e>t}function cd(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=xt(t),n=xt(n)),e(t,n)}}var hd=cd(dd),pd=cd((function(e,t){return e>=t})),fd=Object.prototype.hasOwnProperty;function gd(e,t){return null!=e&&fd.call(e,t)}function vd(e,t){return null!=e&&Sl(e,t,gd)}var md=Math.max,yd=Math.min;var bd="[object String]";function xd(e){return"string"==typeof e||!it(e)&&Ze(e)&&Qe(e)==bd}function wd(e,t){return nt(t,(function(t){return e[t]}))}function Ed(e){return null==e?[]:wd(e,sr(e))}var Cd=Math.max;var Nd=Math.max;var _d=Math.min;function Sd(e,t,n){for(var i=n?hu:On,r=e[0].length,o=e.length,a=o,s=Array(o),l=1/0,u=[];a--;){var d=e[a];a&&t&&(d=nt(d,Ki(t))),l=_d(d.length,l),s[a]=!n&&(t||r>=120&&d.length>=120)?new Hs(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?Ws(h,f):i(u,f,n))){for(a=o;--a;){var g=s[a];if(!(g?Ws(g,f):i(e[a],f,n)))continue e}h&&h.push(f),u.push(p)}}return u}function Md(e){return nu(e)?e:[]}var Ad=Ai((function(e){var t=nt(e,Md);return t.length&&t[0]===e[0]?Sd(t):[]})),Td=Ai((function(e){var t=vu(e),n=nt(e,Md);return t===vu(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?Sd(n,Dl(t)):[]})),kd=Ai((function(e){var t=vu(e),n=nt(e,Md);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?Sd(n,void 0,t):[]}));function Od(e,t){return function(n,i){return function(e,t,n,i){return jl(e,(function(e,r,o){t(i,n(e),r,o)})),i}(n,e,t(i),{})}}var Rd=Object.prototype.toString,Dd=Od((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Rd.call(t)),e[t]=n}),Cn(_t)),Pd=Object.prototype,Id=Pd.hasOwnProperty,Ld=Pd.toString,Bd=Od((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ld.call(t)),Id.call(e,t)?e[t].push(n):e[t]=[n]}),Dl);function jd(e,t){return t.length<2?e:jr(e,ho(t,0,-1))}function zd(e,t,n){var i=null==(e=jd(e,t=Ir(t,e)))?e:e[Br(vu(t))];return null==i?void 0:Zt(i,e,n)}var Hd=Ai(zd),Fd=Ai((function(e,t,n){var i=-1,r="function"==typeof t,o=Oi(e)?Array(e.length):[];return Hl(e,(function(e){o[++i]=r?Zt(t,e,n):zd(e,t,n)})),o}));var Wd=$i&&$i.isArrayBuffer,Gd=Wd?Ki(Wd):function(e){return Ze(e)&&"[object ArrayBuffer]"==Qe(e)};var Vd=$i&&$i.isDate,Ud=Vd?Ki(Vd):function(e){return Ze(e)&&"[object Date]"==Qe(e)};var qd=Object.prototype.hasOwnProperty;function Xd(e){if(null==e)return!0;if(Oi(e)&&(it(e)||"string"==typeof e||"function"==typeof e.splice||qi(e)||er(e)||Fi(e)))return!e.length;var t=Qa(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Ii(e))return!ar(e).length;for(var n in e)if(qd.call(e,n))return!1;return!0}function Kd(e,t){return ml(e,t)}var Yd=He.isFinite;function Qd(e){return"number"==typeof e&&Yd(e)}function Zd(e){return"number"==typeof e&&e==Nt(e)}var $d="[object Number]";function Jd(e){return"number"==typeof e||Ze(e)&&Qe(e)==$d}var ec=Rt?kt:Wi;function tc(e){return null==e}var nc=$i&&$i.isRegExp,ic=nc?Ki(nc):function(e){return Ze(e)&&"[object RegExp]"==Qe(e)},rc=9007199254740991;var oc=Array.prototype.join;var ac=da((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),sc=Wl((function(e,t,n){wi(e,n,t)}));var lc=Math.max,uc=Math.min;var dc=da((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),cc=To("toLowerCase");function hc(e,t){return e<t}var pc=cd(hc),fc=cd((function(e,t){return e<=t}));function gc(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&&!Je(a):n(a,s)))var s=a,l=o}return l}function vc(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 mc=NaN;function yc(e,t){var n=null==e?0:e.length;return n?vc(e,t)/n:mc}var bc=Di((function(e,t,n){ou(e,t,n)})),xc=Ai((function(e,t){return function(n){return zd(n,e,t)}})),wc=Ai((function(e,t){return function(n){return zd(e,n,t)}}));function Ec(e,t,n){var i=sr(t),r=sd(t,i),o=!(ft(n)&&"chain"in n&&!n.chain),a=kt(e);return Mn(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__=hn(this.__actions__)).push({func:i,args:arguments,thisArg:e}),n.__chain__=t,n}return i.apply(e,Fr([this.value()],arguments))})})),e}var Cc=lt((function(e,t){return e*t}),1),Nc="Expected a function";function _c(e){if("function"!=typeof e)throw new TypeError(Nc);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 Sc="[object Map]",Mc="[object Set]",Ac=Fe?Fe.iterator:void 0;function Tc(e){if(!e)return[];if(Oi(e))return xd(e)?Ao(e):hn(e);if(Ac&&e[Ac])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ac]());var t=Qa(e);return(t==Sc?qs:t==Mc?Xs:Ed)(e)}function kc(e,t){var n=e.length;if(n)return Vn(t+=t<0?n:0,n)?e[t]:void 0}function Oc(e,t){return null==(e=jd(e,t=Ir(t,e)))||delete e[Br(vu(t))]}function Rc(e){return to(e)?void 0:e}var Dc=qr((function(e,t){var n={};if(null==e)return n;var i=!1;t=nt(t,(function(t){return t=Ir(t,e),i||(i=t.length>1),t})),_i(e,Ia(e),n),i&&(n=Bs(n,7,Rc));for(var r=t.length;r--;)Oc(n,t[r]);return n}));function Pc(e,t,n,i){if(!ft(e))return e;for(var r=-1,o=(t=Ir(t,e)).length,a=o-1,s=e;null!=s&&++r<o;){var l=Br(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=ft(d)?d:Vn(t[r+1])?[]:{})}Ni(s,l,u),s=s[l]}return e}function Ic(e,t,n){for(var i=-1,r=t.length,o={};++i<r;){var a=t[i],s=jr(e,a);n(s,a)&&Pc(o,Ir(a,e),s)}return o}function Lc(e,t){if(null==e)return{};var n=nt(Ia(e),(function(e){return[e]}));return t=Dl(t),Ic(e,n,(function(e,n){return t(e,n[0])}))}function Bc(e,t){if(e!==t){var n=void 0!==e,i=null===e,r=e==e,o=Je(e),a=void 0!==t,s=null===t,l=t==t,u=Je(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 jc(e,t,n){t=t.length?nt(t,(function(e){return it(e)?function(t){return jr(t,1===e.length?e[0]:e)}:e})):[_t];var i=-1;t=nt(t,Ki(Dl));var r=Ju(e,(function(e,n,r){var o=nt(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=Bc(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 zc(e){return qr((function(t){return t=nt(t,Ki(Dl)),Ai((function(n){var i=this;return e(t,(function(e){return Zt(e,i,n)}))}))}))}var Hc=zc(nt),Fc=Ai,Wc=Math.min,Gc=Fc((function(e,t){var n=(t=1==t.length&&it(t[0])?nt(t[0],Ki(Dl)):nt(Vr(t,1),Ki(Dl))).length;return Ai((function(i){for(var r=-1,o=Wc(i.length,n);++r<o;)i[r]=t[r].call(this,i[r]);return Zt(e,this,i)}))})),Vc=zc(Bu),Uc=zc(Fs),qc=9007199254740991,Xc=Math.floor;function Kc(e,t){var n="";if(!e||t<1||t>qc)return n;do{t%2&&(n+=e),(t=Xc(t/2))&&(e+=e)}while(t);return n}var Yc=Ol("length"),Qc="\\ud800-\\udfff",Zc="["+Qc+"]",$c="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Jc="\\ud83c[\\udffb-\\udfff]",eh="[^"+Qc+"]",th="(?:\\ud83c[\\udde6-\\uddff]){2}",nh="[\\ud800-\\udbff][\\udc00-\\udfff]",ih="(?:"+$c+"|"+Jc+")"+"?",rh="[\\ufe0e\\ufe0f]?",oh=rh+ih+("(?:\\u200d(?:"+[eh,th,nh].join("|")+")"+rh+ih+")*"),ah="(?:"+[eh+$c+"?",$c,th,nh,Zc].join("|")+")",sh=RegExp(Jc+"(?="+Jc+")|"+ah+oh,"g");function lh(e){return go(e)?function(e){for(var t=sh.lastIndex=0;sh.test(e);)++t;return t}(e):Yc(e)}var uh=Math.ceil;function dh(e,t){var n=(t=void 0===t?" ":st(t)).length;if(n<2)return n?Kc(t,e):t;var i=Kc(t,uh(e/lh(t)));return go(t)?po(Ao(i),0,e).join(""):i.slice(0,e)}var ch=Math.ceil,hh=Math.floor;var ph=/^\s+/,fh=He.parseInt;var gh=Ai((function(e,t){return yi(e,32,void 0,t,Xn(t,Fn(gh)))}));gh.placeholder={};var vh=Ai((function(e,t){return yi(e,64,void 0,t,Xn(t,Fn(vh)))}));vh.placeholder={};var mh=Wl((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var yh=qr((function(e,t){return null==e?{}:function(e,t){return Ic(e,t,(function(t,n){return Ml(e,n)}))}(e,t)}));function bh(e,t,n,i){for(var r=n-1,o=e.length;++r<o;)if(i(e[r],t))return r;return-1}var xh=Array.prototype.splice;function wh(e,t,n,i){var r=i?bh:kn,o=-1,a=t.length,s=e;for(e===t&&(t=hn(t)),n&&(s=nt(e,Ki(n)));++o<a;)for(var l=0,u=t[o],d=n?n(u):u;(l=r(s,d,l,i))>-1;)s!==e&&xh.call(s,l,1),xh.call(e,l,1);return e}function Eh(e,t){return e&&e.length&&t&&t.length?wh(e,t):e}var Ch=Ai(Eh);var Nh=Array.prototype.splice;function _h(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;Vn(r)?Nh.call(e,r,1):Oc(e,r)}}return e}var Sh=qr((function(e,t){var n=null==e?0:e.length,i=Hr(e,t);return _h(e,nt(t,(function(e){return Vn(e,n)?+e:e})).sort(Bc)),i})),Mh=Math.floor,Ah=Math.random;function Th(e,t){return e+Mh(Ah()*(t-e+1))}var kh=parseFloat,Oh=Math.min,Rh=Math.random;var Dh=Math.ceil,Ph=Math.max;function Ih(e){return function(t,n,i){return i&&"number"!=typeof i&&Ri(t,n,i)&&(n=i=void 0),t=Ct(t),void 0===n?(n=t,t=0):n=Ct(n),function(e,t,n,i){for(var r=-1,o=Ph(Dh((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:Ct(i),e)}}var Lh=Ih(),Bh=Ih(!0),jh=qr((function(e,t){return yi(e,256,void 0,void 0,void 0,t)}));function zh(e,t,n,i,r){return r(e,(function(e,r,o){n=i?(i=!1,e):t(n,e,r,o)})),n}function Hh(e,t,n){var i=it(e)?Ro:zh,r=arguments.length<3;return i(e,Dl(t),n,r,Hl)}function Fh(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 Wh=Array.prototype.reverse;function Gh(e){return null==e?e:Wh.call(e)}var Vh=fa("round");function Uh(e){var t=e.length;return t?e[Th(0,t-1)]:void 0}function qh(e){return Uh(Ed(e))}function Xh(e,t){var n=-1,i=e.length,r=i-1;for(t=void 0===t?i:t;++n<t;){var o=Th(n,r),a=e[o];e[o]=e[n],e[n]=a}return e.length=t,e}function Kh(e,t){return Xh(hn(e),ba(t,0,e.length))}function Yh(e,t){var n=Ed(e);return Xh(n,ba(t,0,n.length))}function Qh(e){return Xh(hn(e))}function Zh(e){return Xh(Ed(e))}var $h=da((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));function Jh(e,t){var n;return Hl(e,(function(e,i,r){return!(n=t(e,i,r))})),!!n}var ep=Ai((function(e,t){if(null==e)return[];var n=t.length;return n>1&&Ri(e,t[0],t[1])?t=[]:n>2&&Ri(t[0],t[1],t[2])&&(t=[t[0]]),jc(e,Vr(t,1),[])})),tp=4294967294,np=Math.floor,ip=Math.min;function rp(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=Je(t),u=void 0===t;r<o;){var d=np((r+o)/2),c=n(e[d]),h=void 0!==c,p=null===c,f=c==c,g=Je(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 ip(o,tp)}var op=2147483647;function ap(e,t,n){var i=0,r=null==e?i:e.length;if("number"==typeof t&&t==t&&r<=op){for(;i<r;){var o=i+r>>>1,a=e[o];null!==a&&!Je(a)&&(n?a<=t:a<t)?i=o+1:r=o}return r}return rp(e,t,_t,n)}function sp(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||!Ei(s,l)){var l=s;o[r++]=0===a?0:a}}return o}var lp=Math.max;var up=da((function(e,t,n){return e+(n?" ":"")+ko(t)}));var dp=lt((function(e,t){return e-t}),0);var cp=Object.prototype,hp=cp.hasOwnProperty;function pp(e,t,n,i){return void 0===e||Ei(e,cp[n])&&!hp.call(i,n)?t:e}var fp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function gp(e){return"\\"+fp[e]}var vp=/<%=([\s\S]+?)%>/g,mp={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:vp,variable:"",imports:{_:{escape:Pu}}},yp=/\b__p \+= '';/g,bp=/\b(__p \+=) '' \+/g,xp=/(__e\(.*?\)|\b__t\)) \+\n'';/g,wp=/[()=,{}\[\]\/\s]/,Ep=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Cp=/($^)/,Np=/['\n\r\u2028\u2029\\]/g,_p=Object.prototype.hasOwnProperty;function Sp(e,t){return t(e)}var Mp=4294967295,Ap=Math.min;function Tp(e,t){var n=e;return n instanceof on&&(n=n.value()),Ro(t,(function(e,t){return t.func.apply(t.thisArg,Fr([e],t.args))}),n)}function kp(){return Tp(this.__wrapped__,this.__actions__)}var Op=9007199254740991;function Rp(e,t){for(var n=e.length;n--&&kn(t,e[n],0)>-1;);return n}function Dp(e,t){for(var n=-1,i=e.length;++n<i&&kn(t,e[n],0)>-1;);return n}var Pp=/^\s+/;var Ip=/\w*$/;var Lp=Do({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Bp=/&(?:amp|lt|gt|quot|#39);/g,jp=RegExp(Bp.source);var zp=ja&&1/Xs(new ja([,-0]))[1]==1/0?function(e){return new ja(e)}:an,Hp=200;function Fp(e,t,n){var i=-1,r=On,o=e.length,a=!0,s=[],l=s;if(n)a=!1,r=hu;else if(o>=Hp){var u=t?null:zp(e);if(u)return Xs(u);a=!1,r=Ws,l=new Hs}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 Wp=Ai((function(e){return Fp(Vr(e,1,nu,!0))})),Gp=Ai((function(e){var t=vu(e);return nu(t)&&(t=void 0),Fp(Vr(e,1,nu,!0),Dl(t))})),Vp=Ai((function(e){var t=vu(e);return t="function"==typeof t?t:void 0,Fp(Vr(e,1,nu,!0),void 0,t)}));function Up(e,t){return e&&e.length?Fp(e,Dl(t)):[]}var qp=0;var Xp=Math.max;function Kp(e){if(!e||!e.length)return[];var t=0;return e=Ma(e,(function(e){if(nu(e))return t=Xp(e.length,t),!0})),Li(t,(function(t){return nt(e,Ol(t))}))}function Yp(e,t){if(!e||!e.length)return[];var n=Kp(e);return null==t?n:nt(n,(function(e){return Zt(t,void 0,e)}))}function Qp(e,t,n,i){return Pc(e,t,n(jr(e,t)),i)}var Zp=da((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}));var $p=Ai((function(e,t){return nu(e)?fu(e,t):[]}));var Jp=qr((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,r=function(t){return Hr(t,e)};return!(t>1||this.__actions__.length)&&i instanceof on&&Vn(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Sp,args:[r],thisArg:void 0}),new cn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(r)}));function ef(e,t,n){var i=e.length;if(i<2)return i?Fp(e[0]):[];for(var r=-1,o=Array(i);++r<i;)for(var a=e[r],s=-1;++s<i;)s!=r&&(o[r]=fu(o[r]||a,e[s],t,n));return Fp(Vr(o,1),t,n)}var tf=Ai((function(e){return ef(Ma(e,nu))})),nf=Ai((function(e){var t=vu(e);return nu(t)&&(t=void 0),ef(Ma(e,nu),Dl(t))})),rf=Ai((function(e){var t=vu(e);return t="function"==typeof t?t:void 0,ef(Ma(e,nu),void 0,t)})),of=Ai(Kp);function af(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 sf=Ai((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Yp(e,n)})),lf={chunk:function(e,t,n){t=(n?Ri(e,t,n):void 0===t)?1:ya(Nt(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var r=0,o=0,a=Array(ma(i/t));r<i;)a[o++]=ho(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:zs,difference:gu,differenceBy:mu,differenceWith:yu,drop:function(e,t,n){var i=null==e?0:e.length;return i?ho(e,(t=n||void 0===t?1:Nt(t))<0?0:t,i):[]},dropRight:function(e,t,n){var i=null==e?0:e.length;return i?ho(e,0,(t=i-(t=n||void 0===t?1:Nt(t)))<0?0:t):[]},dropRightWhile:function(e,t){return e&&e.length?xu(e,Dl(t),!0,!0):[]},dropWhile:function(e,t){return e&&e.length?xu(e,Dl(t),!0):[]},fill:function(e,t,n,i){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&Ri(e,t,n)&&(n=0,i=r),function(e,t,n,i){var r=e.length;for((n=Nt(n))<0&&(n=-n>r?0:r+n),(i=void 0===i||i>r?r:Nt(i))<0&&(i+=r),i=n>i?0:Hu(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},findIndex:Uu,findLastIndex:Qu,first:$u,flatten:Ur,flattenDeep:function(e){return(null==e?0:e.length)?Vr(e,nd):[]},flattenDepth:function(e,t){return(null==e?0:e.length)?Vr(e,t=void 0===t?1:Nt(t)):[]},fromPairs:function(e){for(var t=-1,n=null==e?0:e.length,i={};++t<n;){var r=e[t];i[r[0]]=r[1]}return i},head:$u,indexOf:function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=null==n?0:Nt(n);return r<0&&(r=Nd(i+r,0)),kn(e,t,r)},initial:function(e){return(null==e?0:e.length)?ho(e,0,-1):[]},intersection:Ad,intersectionBy:Td,intersectionWith:kd,join:function(e,t){return null==e?"":oc.call(e,t)},last:vu,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=Nt(n))<0?lc(i+r,0):uc(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):An(e,Tn,r,!0)},nth:function(e,t){return e&&e.length?kc(e,Nt(t)):void 0},pull:Ch,pullAll:Eh,pullAllBy:function(e,t,n){return e&&e.length&&t&&t.length?wh(e,t,Dl(n)):e},pullAllWith:function(e,t,n){return e&&e.length&&t&&t.length?wh(e,t,void 0,n):e},pullAt:Sh,remove:function(e,t){var n=[];if(!e||!e.length)return n;var i=-1,r=[],o=e.length;for(t=Dl(t);++i<o;){var a=e[i];t(a,i,e)&&(n.push(a),r.push(i))}return _h(e,r),n},reverse:Gh,slice:function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&Ri(e,t,n)?(t=0,n=i):(t=null==t?0:Nt(t),n=void 0===n?i:Nt(n)),ho(e,t,n)):[]},sortedIndex:function(e,t){return ap(e,t)},sortedIndexBy:function(e,t,n){return rp(e,t,Dl(n))},sortedIndexOf:function(e,t){var n=null==e?0:e.length;if(n){var i=ap(e,t);if(i<n&&Ei(e[i],t))return i}return-1},sortedLastIndex:function(e,t){return ap(e,t,!0)},sortedLastIndexBy:function(e,t,n){return rp(e,t,Dl(n),!0)},sortedLastIndexOf:function(e,t){if(null==e?0:e.length){var n=ap(e,t,!0)-1;if(Ei(e[n],t))return n}return-1},sortedUniq:function(e){return e&&e.length?sp(e):[]},sortedUniqBy:function(e,t){return e&&e.length?sp(e,Dl(t)):[]},tail:function(e){var t=null==e?0:e.length;return t?ho(e,1,t):[]},take:function(e,t,n){return e&&e.length?ho(e,0,(t=n||void 0===t?1:Nt(t))<0?0:t):[]},takeRight:function(e,t,n){var i=null==e?0:e.length;return i?ho(e,(t=i-(t=n||void 0===t?1:Nt(t)))<0?0:t,i):[]},takeRightWhile:function(e,t){return e&&e.length?xu(e,Dl(t),!1,!0):[]},takeWhile:function(e,t){return e&&e.length?xu(e,Dl(t)):[]},union:Wp,unionBy:Gp,unionWith:Vp,uniq:function(e){return e&&e.length?Fp(e):[]},uniqBy:Up,uniqWith:function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Fp(e,void 0,t):[]},unzip:Kp,unzipWith:Yp,without:$p,xor:tf,xorBy:nf,xorWith:rf,zip:of,zipObject:function(e,t){return af(e||[],t||[],Ni)},zipObjectDeep:function(e,t){return af(e||[],t||[],Pc)},zipWith:sf},uf={countBy:Vl,each:Eu,eachRight:Mu,every:function(e,t,n){var i=it(e)?Bu:ju;return n&&Ri(e,t,n)&&(t=void 0),i(e,Dl(t))},filter:Wu,find:qu,findLast:Zu,flatMap:function(e,t){return Vr(ed(e,t),1)},flatMapDeep:function(e,t){return Vr(ed(e,t),td)},flatMapDepth:function(e,t,n){return n=void 0===n?1:Nt(n),Vr(ed(e,t),n)},forEach:Eu,forEachRight:Mu,groupBy:ud,includes:function(e,t,n,i){e=Oi(e)?e:Ed(e),n=n&&!i?Nt(n):0;var r=e.length;return n<0&&(n=Cd(r+n,0)),xd(e)?n<=r&&e.indexOf(t,n)>-1:!!r&&kn(e,t,n)>-1},invokeMap:Fd,keyBy:sc,map:ed,orderBy:function(e,t,n,i){return null==e?[]:(it(t)||(t=null==t?[]:[t]),it(n=i?void 0:n)||(n=null==n?[]:[n]),jc(e,t,n))},partition:mh,reduce:Hh,reduceRight:function(e,t,n){var i=it(e)?Fh:zh,r=arguments.length<3;return i(e,Dl(t),n,r,Su)},reject:function(e,t){return(it(e)?Ma:Fu)(e,_c(Dl(t)))},sample:function(e){return(it(e)?Uh:qh)(e)},sampleSize:function(e,t,n){return t=(n?Ri(e,t,n):void 0===t)?1:Nt(t),(it(e)?Kh:Yh)(e,t)},shuffle:function(e){return(it(e)?Qh:Zh)(e)},size:function(e){if(null==e)return 0;if(Oi(e))return xd(e)?lh(e):e.length;var t=Qa(e);return"[object Map]"==t||"[object Set]"==t?e.size:ar(e).length},some:function(e,t,n){var i=it(e)?Fs:Jh;return n&&Ri(e,t,n)&&(t=void 0),i(e,Dl(t))},sortBy:ep},df=Xl,cf={after:function(e,t){if("function"!=typeof t)throw new TypeError("Expected a function");return e=Nt(e),function(){if(--e<1)return t.apply(this,arguments)}},ary:xi,before:so,bind:lo,bindKey:co,curry:Ul,curryRight:ql,debounce:Zl,defer:du,delay:cu,flip:function(e){return yi(e,512)},memoize:kr,negate:_c,once:function(e){return so(2,e)},overArgs:Gc,partial:gh,partialRight:vh,rearg:jh,rest:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return Ai(e,t=void 0===t?t:Nt(t))},spread:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=null==t?0:lp(Nt(t),0),Ai((function(n){var i=n[t],r=po(n,0,t);return i&&Fr(r,i),Zt(e,this,r)}))},throttle:function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return ft(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),Zl(e,t,{leading:i,maxWait:t,trailing:r})},unary:function(e){return xi(e,1)},wrap:function(e,t){return gh(wu(t),e)}},hf={castArray:function(){if(!arguments.length)return[];var e=arguments[0];return it(e)?e:[e]},clone:function(e){return Bs(e,4)},cloneDeep:js,cloneDeepWith:function(e,t){return Bs(e,5,t="function"==typeof t?t:void 0)},cloneWith:function(e,t){return Bs(e,4,t="function"==typeof t?t:void 0)},conformsTo:function(e,t){return null==t||Pl(e,t,sr(t))},eq:Ei,gt:hd,gte:pd,isArguments:Fi,isArray:it,isArrayBuffer:Gd,isArrayLike:Oi,isArrayLikeObject:nu,isBoolean:function(e){return!0===e||!1===e||Ze(e)&&"[object Boolean]"==Qe(e)},isBuffer:qi,isDate:Ud,isElement:function(e){return Ze(e)&&1===e.nodeType&&!to(e)},isEmpty:Xd,isEqual:Kd,isEqualWith:function(e,t,n){var i=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===i?ml(e,t,void 0,n):!!i},isError:ro,isFinite:Qd,isFunction:kt,isInteger:Zd,isLength:ki,isMap:Ss,isMatch:function(e,t){return e===t||xl(e,t,El(t))},isMatchWith:function(e,t,n){return n="function"==typeof n?n:void 0,xl(e,t,El(t),n)},isNaN:function(e){return Jd(e)&&e!=+e},isNative:function(e){if(ec(e))throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Wt(e)},isNil:tc,isNull:function(e){return null===e},isNumber:Jd,isObject:ft,isObjectLike:Ze,isPlainObject:to,isRegExp:ic,isSafeInteger:function(e){return Zd(e)&&e>=-9007199254740991&&e<=rc},isSet:As,isString:xd,isSymbol:Je,isTypedArray:er,isUndefined:function(e){return void 0===e},isWeakMap:function(e){return Ze(e)&&"[object WeakMap]"==Qa(e)},isWeakSet:function(e){return Ze(e)&&"[object WeakSet]"==Qe(e)},lt:pc,lte:fc,toArray:Tc,toFinite:Ct,toInteger:Nt,toLength:Hu,toNumber:xt,toPlainObject:ru,toSafeInteger:function(e){return e?ba(Nt(e),-9007199254740991,Op):0===e?e:0},toString:Pr},pf={add:ut,ceil:ga,divide:bu,floor:id,max:function(e){return e&&e.length?gc(e,_t,dd):void 0},maxBy:function(e,t){return e&&e.length?gc(e,Dl(t),dd):void 0},mean:function(e){return yc(e,_t)},meanBy:function(e,t){return yc(e,Dl(t))},min:function(e){return e&&e.length?gc(e,_t,hc):void 0},minBy:function(e,t){return e&&e.length?gc(e,Dl(t),hc):void 0},multiply:Cc,round:Vh,subtract:dp,sum:function(e){return e&&e.length?vc(e,_t):0},sumBy:function(e,t){return e&&e.length?vc(e,Dl(t)):0}},ff=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=xt(n))==n?n:0),void 0!==t&&(t=(t=xt(t))==t?t:0),ba(xt(e),t,n)},gf=function(e,t,n){return t=Ct(t),void 0===n?(n=t,t=0):n=Ct(n),function(e,t,n){return e>=yd(t,n)&&e<md(t,n)}(e=xt(e),t,n)},vf=function(e,t,n){if(n&&"boolean"!=typeof n&&Ri(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=Ct(e),void 0===t?(t=e,e=0):t=Ct(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var r=Rh();return Oh(e+r*(t-e+kh("1e-"+((r+"").length-1))),t)}return Th(e,t)},mf={assign:ur,assignIn:pr,assignInWith:fr,assignWith:gr,at:Xr,create:function(e,t){var n=Kt(e);return null==t?n:wa(n,t)},defaults:eu,defaultsDeep:lu,entries:Tu,entriesIn:ku,extend:pr,extendWith:fr,findKey:function(e,t){return Xu(e,Dl(t),jl)},findLastKey:function(e,t){return Xu(e,Dl(t),_u)},forIn:function(e,t){return null==e?e:Bl(e,wu(t),hr)},forInRight:function(e,t){return null==e?e:Nu(e,wu(t),hr)},forOwn:function(e,t){return e&&jl(e,wu(t))},forOwnRight:function(e,t){return e&&_u(e,wu(t))},functions:function(e){return null==e?[]:sd(e,sr(e))},functionsIn:function(e){return null==e?[]:sd(e,hr(e))},get:zr,has:vd,hasIn:Ml,invert:Dd,invertBy:Bd,invoke:Hd,keys:sr,keysIn:hr,mapKeys:function(e,t){var n={};return t=Dl(t),jl(e,(function(e,i,r){wi(n,t(e,i,r),e)})),n},mapValues:function(e,t){var n={};return t=Dl(t),jl(e,(function(e,i,r){wi(n,i,t(e,i,r))})),n},merge:bc,mergeWith:su,omit:Dc,omitBy:function(e,t){return Lc(e,_c(Dl(t)))},pick:yh,pickBy:Lc,result:function(e,t,n){var i=-1,r=(t=Ir(t,e)).length;for(r||(r=1,e=void 0);++i<r;){var o=null==e?void 0:e[Br(t[i])];void 0===o&&(i=r,o=n),e=kt(o)?o.call(e):o}return e},set:function(e,t,n){return null==e?e:Pc(e,t,n)},setWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Pc(e,t,n,i)},toPairs:Tu,toPairsIn:ku,transform:function(e,t,n){var i=it(e),r=i||qi(e)||er(e);if(t=Dl(t),null==n){var o=e&&e.constructor;n=r?i?new o:[]:ft(e)&&kt(o)?Kt(Kr(e)):{}}return(r?Mn:jl)(e,(function(e,i,r){return t(n,e,i,r)})),n},unset:function(e,t){return null==e||Oc(e,t)},update:function(e,t,n){return null==e?e:Qp(e,t,wu(n))},updateWith:function(e,t,n,i){return i="function"==typeof i?i:void 0,null==e?e:Qp(e,t,wu(n),i)},values:Ed,valuesIn:function(e){return null==e?[]:wd(e,hr(e))}},yf={at:Jp,chain:va,commit:function(){return new cn(this.value(),this.__chain__)},lodash:gn,next:function(){void 0===this.__values__&&(this.__values__=Tc(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},plant:function(e){for(var t,n=this;n instanceof nn;){var i=pn(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 on){var t=e;return this.__actions__.length&&(t=new on(this)),(t=t.reverse()).__actions__.push({func:Sp,args:[Gh],thisArg:void 0}),new cn(t,this.__chain__)}return this.thru(Gh)},tap:function(e,t){return t(e),e},thru:Sp,toIterator:function(){return this},toJSON:kp,value:kp,valueOf:kp,wrapperChain:function(){return va(this)}},bf={camelCase:ca,capitalize:Oo,deburr:Bo,endsWith:function(e,t,n){e=Pr(e),t=st(t);var i=e.length,r=n=void 0===n?i:ba(Nt(n),0,i);return(n-=t.length)>=0&&e.slice(n,r)==t},escape:Pu,escapeRegExp:function(e){return(e=Pr(e))&&Lu.test(e)?e.replace(Iu,"\\$&"):e},kebabCase:ac,lowerCase:dc,lowerFirst:cc,pad:function(e,t,n){e=Pr(e);var i=(t=Nt(t))?lh(e):0;if(!t||i>=t)return e;var r=(t-i)/2;return dh(hh(r),n)+e+dh(ch(r),n)},padEnd:function(e,t,n){e=Pr(e);var i=(t=Nt(t))?lh(e):0;return t&&i<t?e+dh(t-i,n):e},padStart:function(e,t,n){e=Pr(e);var i=(t=Nt(t))?lh(e):0;return t&&i<t?dh(t-i,n)+e:e},parseInt:function(e,t,n){return n||null==t?t=0:t&&(t=+t),fh(Pr(e).replace(ph,""),t||0)},repeat:function(e,t,n){return t=(n?Ri(e,t,n):void 0===t)?1:Nt(t),Kc(Pr(e),t)},replace:function(){var e=arguments,t=Pr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},snakeCase:$h,split:function(e,t,n){return n&&"number"!=typeof n&&Ri(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=Pr(e))&&("string"==typeof t||null!=t&&!ic(t))&&!(t=st(t))&&go(e)?po(Ao(e),0,n):e.split(t,n):[]},startCase:up,startsWith:function(e,t,n){return e=Pr(e),n=null==n?0:ba(Nt(n),0,e.length),t=st(t),e.slice(n,n+t.length)==t},template:function(e,t,n){var i=mp.imports._.templateSettings||mp;n&&Ri(e,t,n)&&(t=void 0),e=Pr(e),t=fr({},t,i,pp);var r,o,a=fr({},t.imports,i.imports,pp),s=sr(a),l=wd(a,s),u=0,d=t.interpolate||Cp,c="__p += '",h=RegExp((t.escape||Cp).source+"|"+d.source+"|"+(d===vp?Ep:Cp).source+"|"+(t.evaluate||Cp).source+"|$","g"),p=_p.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(Np,gp),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=_p.call(t,"variable")&&t.variable;if(f){if(wp.test(f))throw new Error("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(o?c.replace(yp,""):c).replace(bp,"$1").replace(xp,"$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=oo((function(){return Function(s,p+"return "+c).apply(void 0,l)}));if(g.source=c,ro(g))throw g;return g},templateSettings:mp,toLower:function(e){return Pr(e).toLowerCase()},toUpper:function(e){return Pr(e).toUpperCase()},trim:function(e,t,n){if((e=Pr(e))&&(n||void 0===t))return pt(e);if(!e||!(t=st(t)))return e;var i=Ao(e),r=Ao(t);return po(i,Dp(i,r),Rp(i,r)+1).join("")},trimEnd:function(e,t,n){if((e=Pr(e))&&(n||void 0===t))return e.slice(0,ct(e)+1);if(!e||!(t=st(t)))return e;var i=Ao(e);return po(i,0,Rp(i,Ao(t))+1).join("")},trimStart:function(e,t,n){if((e=Pr(e))&&(n||void 0===t))return e.replace(Pp,"");if(!e||!(t=st(t)))return e;var i=Ao(e);return po(i,Dp(i,Ao(t))).join("")},truncate:function(e,t){var n=30,i="...";if(ft(t)){var r="separator"in t?t.separator:r;n="length"in t?Nt(t.length):n,i="omission"in t?st(t.omission):i}var o=(e=Pr(e)).length;if(go(e)){var a=Ao(e);o=a.length}if(n>=o)return e;var s=n-lh(i);if(s<1)return i;var l=a?po(a,0,s).join(""):e.slice(0,s);if(void 0===r)return l+i;if(a&&(s+=l.length-s),ic(r)){if(e.slice(s).search(r)){var u,d=l;for(r.global||(r=RegExp(r.source,Pr(Ip.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(st(r),s)!=s){var h=l.lastIndexOf(r);h>-1&&(l=l.slice(0,h))}return l+i},unescape:function(e){return(e=Pr(e))&&jp.test(e)?e.replace(Bp,Lp):e},upperCase:Zp,upperFirst:ko,words:la},xf={attempt:oo,bindAll:uo,cond:function(e){var t=null==e?0:e.length,n=Dl;return e=t?nt(e,(function(e){if("function"!=typeof e[1])throw new TypeError("Expected a function");return[n(e[0]),e[1]]})):[],Ai((function(n){for(var i=-1;++i<t;){var r=e[i];if(Zt(r[0],this,n))return Zt(r[1],this,n)}}))},conforms:function(e){return function(e){var t=sr(e);return function(n){return Pl(n,e,t)}}(Bs(e,1))},constant:Cn,defaultTo:function(e,t){return null==e||e!=e?t:e},flow:od,flowRight:ad,identity:_t,iteratee:function(e){return Dl("function"==typeof e?e:Bs(e,1))},matches:function(e){return Nl(Bs(e,1))},matchesProperty:function(e,t){return kl(e,Bs(t,1))},method:xc,methodOf:wc,mixin:Ec,noop:an,nthArg:function(e){return e=Nt(e),Ai((function(t){return kc(t,e)}))},over:Hc,overEvery:Vc,overSome:Uc,property:Rl,propertyOf:function(e){return function(t){return null==e?void 0:jr(e,t)}},range:Lh,rangeRight:Bh,stubArray:Aa,stubFalse:Wi,stubObject:function(){return{}},stubString:function(){return""},stubTrue:function(){return!0},times:function(e,t){if((e=Nt(e))<1||e>9007199254740991)return[];var n=Mp,i=Ap(e,Mp);t=wu(t),e-=Mp;for(var r=Li(i,t);++n<e;)t(n);return r},toPath:function(e){return it(e)?nt(e,Br):Je(e)?[e]:hn(Dr(Pr(e)))},uniqueId:function(e){var t=++qp;return Pr(e)+t}};var wf=Math.max,Ef=Math.min;var Cf=Math.min;var Nf,_f,Sf=4294967295,Mf=Array.prototype,Af=Object.prototype.hasOwnProperty,Tf=Fe?Fe.iterator:void 0,kf=Math.max,Of=Math.min,Rf=function(e){return function(t,n,i){if(null==i){var r=ft(n),o=r&&sr(n),a=o&&o.length&&sd(n,o);(a?a.length:r)||(i=n,n=t,t=this)}return e(t,n,i)}}(Ec);gn.after=cf.after,gn.ary=cf.ary,gn.assign=mf.assign,gn.assignIn=mf.assignIn,gn.assignInWith=mf.assignInWith,gn.assignWith=mf.assignWith,gn.at=mf.at,gn.before=cf.before,gn.bind=cf.bind,gn.bindAll=xf.bindAll,gn.bindKey=cf.bindKey,gn.castArray=hf.castArray,gn.chain=yf.chain,gn.chunk=lf.chunk,gn.compact=lf.compact,gn.concat=lf.concat,gn.cond=xf.cond,gn.conforms=xf.conforms,gn.constant=xf.constant,gn.countBy=uf.countBy,gn.create=mf.create,gn.curry=cf.curry,gn.curryRight=cf.curryRight,gn.debounce=cf.debounce,gn.defaults=mf.defaults,gn.defaultsDeep=mf.defaultsDeep,gn.defer=cf.defer,gn.delay=cf.delay,gn.difference=lf.difference,gn.differenceBy=lf.differenceBy,gn.differenceWith=lf.differenceWith,gn.drop=lf.drop,gn.dropRight=lf.dropRight,gn.dropRightWhile=lf.dropRightWhile,gn.dropWhile=lf.dropWhile,gn.fill=lf.fill,gn.filter=uf.filter,gn.flatMap=uf.flatMap,gn.flatMapDeep=uf.flatMapDeep,gn.flatMapDepth=uf.flatMapDepth,gn.flatten=lf.flatten,gn.flattenDeep=lf.flattenDeep,gn.flattenDepth=lf.flattenDepth,gn.flip=cf.flip,gn.flow=xf.flow,gn.flowRight=xf.flowRight,gn.fromPairs=lf.fromPairs,gn.functions=mf.functions,gn.functionsIn=mf.functionsIn,gn.groupBy=uf.groupBy,gn.initial=lf.initial,gn.intersection=lf.intersection,gn.intersectionBy=lf.intersectionBy,gn.intersectionWith=lf.intersectionWith,gn.invert=mf.invert,gn.invertBy=mf.invertBy,gn.invokeMap=uf.invokeMap,gn.iteratee=xf.iteratee,gn.keyBy=uf.keyBy,gn.keys=sr,gn.keysIn=mf.keysIn,gn.map=uf.map,gn.mapKeys=mf.mapKeys,gn.mapValues=mf.mapValues,gn.matches=xf.matches,gn.matchesProperty=xf.matchesProperty,gn.memoize=cf.memoize,gn.merge=mf.merge,gn.mergeWith=mf.mergeWith,gn.method=xf.method,gn.methodOf=xf.methodOf,gn.mixin=Rf,gn.negate=_c,gn.nthArg=xf.nthArg,gn.omit=mf.omit,gn.omitBy=mf.omitBy,gn.once=cf.once,gn.orderBy=uf.orderBy,gn.over=xf.over,gn.overArgs=cf.overArgs,gn.overEvery=xf.overEvery,gn.overSome=xf.overSome,gn.partial=cf.partial,gn.partialRight=cf.partialRight,gn.partition=uf.partition,gn.pick=mf.pick,gn.pickBy=mf.pickBy,gn.property=xf.property,gn.propertyOf=xf.propertyOf,gn.pull=lf.pull,gn.pullAll=lf.pullAll,gn.pullAllBy=lf.pullAllBy,gn.pullAllWith=lf.pullAllWith,gn.pullAt=lf.pullAt,gn.range=xf.range,gn.rangeRight=xf.rangeRight,gn.rearg=cf.rearg,gn.reject=uf.reject,gn.remove=lf.remove,gn.rest=cf.rest,gn.reverse=lf.reverse,gn.sampleSize=uf.sampleSize,gn.set=mf.set,gn.setWith=mf.setWith,gn.shuffle=uf.shuffle,gn.slice=lf.slice,gn.sortBy=uf.sortBy,gn.sortedUniq=lf.sortedUniq,gn.sortedUniqBy=lf.sortedUniqBy,gn.split=bf.split,gn.spread=cf.spread,gn.tail=lf.tail,gn.take=lf.take,gn.takeRight=lf.takeRight,gn.takeRightWhile=lf.takeRightWhile,gn.takeWhile=lf.takeWhile,gn.tap=yf.tap,gn.throttle=cf.throttle,gn.thru=Sp,gn.toArray=hf.toArray,gn.toPairs=mf.toPairs,gn.toPairsIn=mf.toPairsIn,gn.toPath=xf.toPath,gn.toPlainObject=hf.toPlainObject,gn.transform=mf.transform,gn.unary=cf.unary,gn.union=lf.union,gn.unionBy=lf.unionBy,gn.unionWith=lf.unionWith,gn.uniq=lf.uniq,gn.uniqBy=lf.uniqBy,gn.uniqWith=lf.uniqWith,gn.unset=mf.unset,gn.unzip=lf.unzip,gn.unzipWith=lf.unzipWith,gn.update=mf.update,gn.updateWith=mf.updateWith,gn.values=mf.values,gn.valuesIn=mf.valuesIn,gn.without=lf.without,gn.words=bf.words,gn.wrap=cf.wrap,gn.xor=lf.xor,gn.xorBy=lf.xorBy,gn.xorWith=lf.xorWith,gn.zip=lf.zip,gn.zipObject=lf.zipObject,gn.zipObjectDeep=lf.zipObjectDeep,gn.zipWith=lf.zipWith,gn.entries=mf.toPairs,gn.entriesIn=mf.toPairsIn,gn.extend=mf.assignIn,gn.extendWith=mf.assignInWith,Rf(gn,gn),gn.add=pf.add,gn.attempt=xf.attempt,gn.camelCase=bf.camelCase,gn.capitalize=bf.capitalize,gn.ceil=pf.ceil,gn.clamp=ff,gn.clone=hf.clone,gn.cloneDeep=hf.cloneDeep,gn.cloneDeepWith=hf.cloneDeepWith,gn.cloneWith=hf.cloneWith,gn.conformsTo=hf.conformsTo,gn.deburr=bf.deburr,gn.defaultTo=xf.defaultTo,gn.divide=pf.divide,gn.endsWith=bf.endsWith,gn.eq=hf.eq,gn.escape=bf.escape,gn.escapeRegExp=bf.escapeRegExp,gn.every=uf.every,gn.find=uf.find,gn.findIndex=lf.findIndex,gn.findKey=mf.findKey,gn.findLast=uf.findLast,gn.findLastIndex=lf.findLastIndex,gn.findLastKey=mf.findLastKey,gn.floor=pf.floor,gn.forEach=uf.forEach,gn.forEachRight=uf.forEachRight,gn.forIn=mf.forIn,gn.forInRight=mf.forInRight,gn.forOwn=mf.forOwn,gn.forOwnRight=mf.forOwnRight,gn.get=mf.get,gn.gt=hf.gt,gn.gte=hf.gte,gn.has=mf.has,gn.hasIn=mf.hasIn,gn.head=lf.head,gn.identity=_t,gn.includes=uf.includes,gn.indexOf=lf.indexOf,gn.inRange=gf,gn.invoke=mf.invoke,gn.isArguments=hf.isArguments,gn.isArray=it,gn.isArrayBuffer=hf.isArrayBuffer,gn.isArrayLike=hf.isArrayLike,gn.isArrayLikeObject=hf.isArrayLikeObject,gn.isBoolean=hf.isBoolean,gn.isBuffer=hf.isBuffer,gn.isDate=hf.isDate,gn.isElement=hf.isElement,gn.isEmpty=hf.isEmpty,gn.isEqual=hf.isEqual,gn.isEqualWith=hf.isEqualWith,gn.isError=hf.isError,gn.isFinite=hf.isFinite,gn.isFunction=hf.isFunction,gn.isInteger=hf.isInteger,gn.isLength=hf.isLength,gn.isMap=hf.isMap,gn.isMatch=hf.isMatch,gn.isMatchWith=hf.isMatchWith,gn.isNaN=hf.isNaN,gn.isNative=hf.isNative,gn.isNil=hf.isNil,gn.isNull=hf.isNull,gn.isNumber=hf.isNumber,gn.isObject=ft,gn.isObjectLike=hf.isObjectLike,gn.isPlainObject=hf.isPlainObject,gn.isRegExp=hf.isRegExp,gn.isSafeInteger=hf.isSafeInteger,gn.isSet=hf.isSet,gn.isString=hf.isString,gn.isSymbol=hf.isSymbol,gn.isTypedArray=hf.isTypedArray,gn.isUndefined=hf.isUndefined,gn.isWeakMap=hf.isWeakMap,gn.isWeakSet=hf.isWeakSet,gn.join=lf.join,gn.kebabCase=bf.kebabCase,gn.last=vu,gn.lastIndexOf=lf.lastIndexOf,gn.lowerCase=bf.lowerCase,gn.lowerFirst=bf.lowerFirst,gn.lt=hf.lt,gn.lte=hf.lte,gn.max=pf.max,gn.maxBy=pf.maxBy,gn.mean=pf.mean,gn.meanBy=pf.meanBy,gn.min=pf.min,gn.minBy=pf.minBy,gn.stubArray=xf.stubArray,gn.stubFalse=xf.stubFalse,gn.stubObject=xf.stubObject,gn.stubString=xf.stubString,gn.stubTrue=xf.stubTrue,gn.multiply=pf.multiply,gn.nth=lf.nth,gn.noop=xf.noop,gn.now=df,gn.pad=bf.pad,gn.padEnd=bf.padEnd,gn.padStart=bf.padStart,gn.parseInt=bf.parseInt,gn.random=vf,gn.reduce=uf.reduce,gn.reduceRight=uf.reduceRight,gn.repeat=bf.repeat,gn.replace=bf.replace,gn.result=mf.result,gn.round=pf.round,gn.sample=uf.sample,gn.size=uf.size,gn.snakeCase=bf.snakeCase,gn.some=uf.some,gn.sortedIndex=lf.sortedIndex,gn.sortedIndexBy=lf.sortedIndexBy,gn.sortedIndexOf=lf.sortedIndexOf,gn.sortedLastIndex=lf.sortedLastIndex,gn.sortedLastIndexBy=lf.sortedLastIndexBy,gn.sortedLastIndexOf=lf.sortedLastIndexOf,gn.startCase=bf.startCase,gn.startsWith=bf.startsWith,gn.subtract=pf.subtract,gn.sum=pf.sum,gn.sumBy=pf.sumBy,gn.template=bf.template,gn.times=xf.times,gn.toFinite=hf.toFinite,gn.toInteger=Nt,gn.toLength=hf.toLength,gn.toLower=bf.toLower,gn.toNumber=hf.toNumber,gn.toSafeInteger=hf.toSafeInteger,gn.toString=hf.toString,gn.toUpper=bf.toUpper,gn.trim=bf.trim,gn.trimEnd=bf.trimEnd,gn.trimStart=bf.trimStart,gn.truncate=bf.truncate,gn.unescape=bf.unescape,gn.uniqueId=xf.uniqueId,gn.upperCase=bf.upperCase,gn.upperFirst=bf.upperFirst,gn.each=uf.forEach,gn.eachRight=uf.forEachRight,gn.first=lf.head,Rf(gn,(Nf={},jl(gn,(function(e,t){Af.call(gn.prototype,t)||(Nf[t]=e)})),Nf),{chain:!1}),gn.VERSION="4.17.21",(gn.templateSettings=bf.templateSettings).imports._=gn,Mn(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){gn[e].placeholder=gn})),Mn(["drop","take"],(function(e,t){on.prototype[e]=function(n){n=void 0===n?1:kf(Nt(n),0);var i=this.__filtered__&&!t?new on(this):this.clone();return i.__filtered__?i.__takeCount__=Of(n,i.__takeCount__):i.__views__.push({size:Of(n,Sf),type:e+(i.__dir__<0?"Right":"")}),i},on.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Mn(["filter","map","takeWhile"],(function(e,t){var n=t+1,i=1==n||3==n;on.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Dl(e),type:n}),t.__filtered__=t.__filtered__||i,t}})),Mn(["head","last"],(function(e,t){var n="take"+(t?"Right":"");on.prototype[e]=function(){return this[n](1).value()[0]}})),Mn(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");on.prototype[e]=function(){return this.__filtered__?new on(this):this[n](1)}})),on.prototype.compact=function(){return this.filter(_t)},on.prototype.find=function(e){return this.filter(e).head()},on.prototype.findLast=function(e){return this.reverse().find(e)},on.prototype.invokeMap=Ai((function(e,t){return"function"==typeof e?new on(this):this.map((function(n){return zd(n,e,t)}))})),on.prototype.reject=function(e){return this.filter(_c(Dl(e)))},on.prototype.slice=function(e,t){e=Nt(e);var n=this;return n.__filtered__&&(e>0||t<0)?new on(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=Nt(t))<0?n.dropRight(-t):n.take(t-e)),n)},on.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},on.prototype.toArray=function(){return this.take(Sf)},jl(on.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),r=gn[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);r&&(gn.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,s=t instanceof on,l=a[0],u=s||it(t),d=function(e){var t=r.apply(gn,Fr([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 on(this);var g=e.apply(t,a);return g.__actions__.push({func:Sp,args:[d],thisArg:void 0}),new cn(g,c)}return p&&f?e.apply(this,a):(g=this.thru(d),p?i?g.value()[0]:g.value():g)})})),Mn(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Mf[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);gn.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var r=this.value();return t.apply(it(r)?r:[],e)}return this[n]((function(n){return t.apply(it(n)?n:[],e)}))}})),jl(on.prototype,(function(e,t){var n=gn[t];if(n){var i=n.name+"";Af.call(ln,i)||(ln[i]=[]),ln[i].push({name:t,func:n})}})),ln[ei(void 0,2).name]=[{name:"wrapper",func:void 0}],on.prototype.clone=function(){var e=new on(this.__wrapped__);return e.__actions__=hn(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=hn(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=hn(this.__views__),e},on.prototype.reverse=function(){if(this.__filtered__){var e=new on(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},on.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=it(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=Ef(t,e+a);break;case"takeRight":e=wf(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=Cf(l,this.__takeCount__);if(!n||!i&&r==l&&p==l)return Tp(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},gn.prototype.at=yf.at,gn.prototype.chain=yf.wrapperChain,gn.prototype.commit=yf.commit,gn.prototype.next=yf.next,gn.prototype.plant=yf.plant,gn.prototype.reverse=yf.reverse,gn.prototype.toJSON=gn.prototype.valueOf=gn.prototype.value=yf.value,gn.prototype.first=gn.prototype.head,Tf&&(gn.prototype[Tf]=yf.toIterator),_f={__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 Df=0;function Pf(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:--Df,__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 _f.vnode&&_f.vnode(u),u}var If=t.LogicFlowUtil.StepDrag,Lf=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},w={x:i.nodeModel.x,y:i.nodeModel.y,width:i.nodeModel.width,height:i.nodeModel.height,radius:u};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:x,afterNode:w})}},i.updateEllipse=function(e){var t=e.deltaX,n=e.deltaY,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,v=c.maxHeight,m=h===f,y=p===v,b=o,x=a,w=i.getResize({index:d,deltaX:t,deltaY:n,width:b,height:x,PCTResizeInfo:u,pct:.5,freezeWidth:m,freezeHeight:y});if(w.width<h/2||w.width>f/2||w.height<p/2||w.height>v/2)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:m?0:w.deltaX,deltaY:y?0:w.deltaY}),i.nodeModel.rx=w.width,i.nodeModel.ry=w.height,i.nodeModel.setProperties({nodeSize:{rx:w.width,ry:w.height}});var E={x:s,y:l},C={rx:w.width,ry:w.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:g(g({},E),{rx: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 w={x:s,y:l,rx:o,ry:a},E={rx:x.width,ry:x.height,x:i.nodeModel.x,y:i.nodeModel.y};i.updateEdgePointByAnchors(),i.eventEmit({deltaX:t,deltaY:n,beforeNode:w,afterNode:E})}},i.eventEmit=function(e){var t=e.deltaX,n=e.deltaY,r=e.beforeNode,o=e.afterNode,a=i.nodeModel,s=a.id,l=a.modelType,u=a.type,d=g({id:s,modelType:l,type:u},r),c=g({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=w(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 If({onDragging:i.onDragging,onDragEnd:i.onDragEnd,step:1}),i}return f(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 Pf("g",{className:"lf-resize-control-".concat(r),children:Pf(t.Rect,g({className:"lf-node-control",x:n,y:i},o,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(t.Component),Bf=function(e){function n(){var t=e.call(this)||this;return t.state={},t}return f(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 Pf(Lf,g({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 Pf(t.Rect,g({},a,{x:n,y:i,width:r,height:o}))},n.prototype.render=function(){return Pf("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(t.Component),jf=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 f(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),zf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pf(Bf,{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 Pf("g",{children:[this.getResizeShape(),t.isSelected&&!n?this.getControlGroup():""]})},t}(t.EllipseNode),Hf={type:"ellipse",view:zf,model:jf},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 f(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),Wf=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(n,e),n.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pf(Bf,{model:t,graphModel:n})},n.prototype.getResizeShape=function(){var e=this.props.model,n=e.points,i=e.getNodeStyle();return Pf("g",{children:Pf(t.Polygon,g({},i,{points:n}))})},n.prototype.getShape=function(){var e=this.props,t=e.model.isSelected,n=e.graphModel.editConfigModel.isSilentMode;return Pf("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},n}(t.DiamondNode),Gf={type:"diamond",view:Wf,model:Ff},Vf=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 f(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),Uf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pf(Bf,{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 Pf("g",{children:[this.getResizeShape(),t&&!n?this.getControlGroup():""]})},t}(t.HtmlNode),qf={type:"html",view:Uf,model:Vf},Xf=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 f(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),Kf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.prototype.getControlGroup=function(){var e=this.props,t=e.model,n=e.graphModel;return Pf(Bf,{model:t,graphModel:n})},t.prototype.getResizeShape=function(){return e.prototype.getShape.call(this)},t.prototype.getShape=function(){return Pf("g",{children:this.getResizeShape()})},t}(t.RectNode),Yf={type:"rect",view:Kf,model:Xf},Qf={pluginName:"nodeResize",step:0,install:function(e){e.register(Hf),e.register(Gf),e.register(qf),e.register(Yf)}},Zf=function(e){function t(){var t=e.apply(this,E([],w(arguments),!1))||this;return t.isGroup=!0,t.isFolded=!1,t.unfoldedWidth=500,t.unfoldedHeight=300,t.childrenLastFoldStatus={},t}return f(t,e),t.prototype.initNodeData=function(t){var n=this;e.prototype.initNodeData.call(this,t);var i=[];it(t.children)&&(i=t.children),this.children=new Set(i),this.width=500,this.height=300,this.foldedWidth=80,this.foldedHeight=60,this.zIndex=-1e4,this.radius=0,this.text.editable=!1,this.text.draggable=!1,this.isRestrict=!1,this.resizable=!1,this.autoToFront=!1,this.foldable=!1,void 0===this.properties.isFolded&&(this.properties.isFolded=!1),this.isFolded=!!this.properties.isFolded,setTimeout((function(){n.isFolded&&n.foldGroup(n.isFolded)}))},t.prototype.foldGroup=function(e){var t=this;if(e!==this.isFolded){this.setProperty("isFolded",e),this.isFolded=e,e?(this.x=this.x-this.width/2+this.foldedWidth/2,this.y=this.y-this.height/2+this.foldedHeight/2,this.unfoldedWidth=this.width,this.unfoldedHeight=this.height,this.width=this.foldedWidth,this.height=this.foldedHeight):(this.width=this.unfoldedWidth,this.height=this.unfoldedHeight,this.x=this.x+this.width/2-this.foldedWidth/2,this.y=this.y+this.height/2-this.foldedHeight/2);var n=E(E([],w(this.incoming.edges),!1),w(this.outgoing.edges),!1);this.children.forEach((function(i){var 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=E(E(E([],w(n),!1),w(s),!1),w(l),!1)}})),this.foldEdge(e,n)}},t.prototype.getAnchorStyle=function(t){var n=e.prototype.getAnchorStyle.call(this,t);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},t.prototype.foldEdge=function(e,t){var n=this;t.forEach((function(t,i){var 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)}))},t.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isFoldedEdge=!0},t.prototype.isInRange=function(e){var t=e.minX,n=e.minY,i=e.maxX,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},t.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}},t.prototype.setAllowAppendChild=function(e){this.setProperty("groupAddable",e)},t.prototype.addChild=function(e){this.children.add(e),this.graphModel.eventCenter.emit("group:add-node",{data:this.getData()})},t.prototype.removeChild=function(e){this.children.delete(e),this.graphModel.eventCenter.emit("group:remove-node",{data:this.getData()})},t.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},t.prototype.getData=function(){var t=this,n=e.prototype.getData.call(this);n.children=[],this.children.forEach((function(e){var i=t.graphModel.getNodeModelById(e);i&&!i.virtual&&n.children.push(e)}));var i=n.properties;return null==i||delete i.groupAddable,null==i||delete i.isFolded,n},t.prototype.getHistoryData=function(){var t=e.prototype.getData.call(this);t.children=E([],w(this.children),!1),t.isGroup=!0;var n=t.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(t.x=t.x+this.unfoldedWidth/2-this.foldedWidth/2,t.y=t.y+this.unfoldedHeight/2-this.foldedHeight/2),t},t.prototype.isAllowAppendIn=function(e){return!0},t.prototype.toBack=function(){this.zIndex--},t}(Xf),$f=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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",g(g({},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}(Kf),Jf={type:"group",view:$f,model:Zf},eg=-1e4,tg=function(){function e(e){var t=e.lf,n=this;this.topGroupZIndex=eg,this.nodeGroupMap=new Map,this.graphRendered=function(e){var t=e.data;t&&t.nodes&&(t.nodes.forEach((function(e){e.children&&e.children.forEach((function(t){n.nodeGroupMap.set(t,e.id)}))})),n.checkAndCorrectTopGroupZIndex(t.nodes))},this.appendNodeToGroup=function(e){var t=e.data,i=n.nodeGroupMap.get(t.id);if(i){var r=n.lf.getNodeModelById(i);r.removeChild(t.id),n.nodeGroupMap.delete(t.id),r.setAllowAppendChild(!1)}var o=n.lf.getNodeModelById(t.id),a=null==o?void 0:o.getBounds();if(a&&o){var s=n.getGroup(a,t);if(o.isGroup&&(t.children.forEach((function(e){n.nodeGroupMap.set(e,t.id)})),n.checkAndCorrectTopGroupZIndex([t]),n.nodeSelected({data:t,isSelected:!1,isMultiple:!1})),!s)return;if(!s.isAllowAppendIn(t))return void n.lf.emit("group:not-allowed",{group:s.getData(),node:t});s.addChild(t.id),n.nodeGroupMap.set(t.id,s.id),s.setAllowAppendChild(!1)}},this.deleteGroupChild=function(e){var t=e.data;t.children&&t.children.forEach((function(e){n.nodeGroupMap.delete(e),n.lf.deleteNode(e)}));var i=n.nodeGroupMap.get(t.id);i&&(n.lf.getNodeModelById(i).removeChild(t.id),n.nodeGroupMap.delete(t.id))},this.setActiveGroup=function(e){var t=e.data,i=n.lf.getNodeModelById(t.id),r=null==i?void 0:i.getBounds();if(i&&r){var o=n.getGroup(r,t);if(n.activeGroup&&n.activeGroup.setAllowAppendChild(!1),!o||i.isGroup&&o.id===t.id)return;if(!o.isAllowAppendIn(t))return;n.activeGroup=o,n.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(e){var t=eg;return e.isGroup&&(t=Math.max(t,e.zIndex)),e.children&&e.children.forEach((function(e){"object"==typeof e&&(e=e.id);var i=n.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var r=n.findNodeAndChildMaxZIndex(i);t=Math.max(r,t)}})),t},this.checkAndCorrectTopGroupZIndex=function(e){var t=eg;if(e.forEach((function(e){var i=n.lf.getNodeModelById(e.id);if(i){var r=n.findNodeAndChildMaxZIndex(i);r>t&&(t=r)}})),!(n.topGroupZIndex>=t)){for(var i=n.lf.graphModel.nodes.filter((function(e){return e.isGroup})),r=n.topGroupZIndex,o=0;o<i.length;o++){var a=i[o];a.zIndex>r&&(r=a.zIndex)}n.topGroupZIndex=r}},this.nodeSelected=function(e){var t=e.data,i=e.isMultiple,r=e.isSelected,o=n.lf.getNodeModelById(t.id);if(n.toFrontGroup(o),n.topGroupZIndex>-1e3){n.topGroupZIndex=eg;for(var a=n.lf.graphModel.nodes.filter((function(e){return e.isGroup})).sort((function(e,t){return e.zIndex-t.zIndex})),s=0,l=0;l<a.length;l++){var u=a[l];u.zIndex!==s&&(n.topGroupZIndex++,s=u.zIndex),u.setZIndex(n.topGroupZIndex)}}if(i&&r)if(null==o?void 0:o.isGroup)o.children.forEach((function(e){var t=n.lf.graphModel.getElement(e);null==t||t.setSelected(!1)}));else{var d=n.nodeGroupMap.get(t.id);if(d){var c=n.lf.getNodeModelById(d);(null==c?void 0:c.isSelected)&&(null==o||o.setSelected(!1))}}},this.toFrontGroup=function(e){e&&e.isGroup&&(n.topGroupZIndex++,e.setZIndex(n.topGroupZIndex),e.children&&e.children.forEach((function(e){var t=n.lf.getNodeModelById(e);n.toFrontGroup(t)})))},t.register(Jf),this.lf=t,t.graphModel.addNodeMoveRules((function(e,i,r){if(e.isGroup){var o=n.getNodeAllChild(e);return t.graphModel.moveNodes(o,i,r,!0),!0}var a=t.getNodeModelById(n.nodeGroupMap.get(e.id));if(a&&a.isRestrict){var s=e.getBounds(),l=s.minX,u=s.minY,d=s.maxX,c=s.maxY;return a.isAllowMoveTo({minX:l+i,minY:u+r,maxX:d+i,maxY:c+r})}return!0})),t.graphModel.group=this,t.on("node:add,node:drop,node:dnd-add",this.appendNodeToGroup),t.on("node:delete",this.deleteGroupChild),t.on("node:dnd-drag,node:drag",this.setActiveGroup),t.on("node:click",this.nodeSelected),t.on("graph:rendered",this.graphRendered),t.addElements=function(e,i){var r=e.nodes,o=e.edges,a={},s={nodes:[],edges:[]},l=[];return Eu(r,(function(e){var r=e.id,o=e.children,u=v(e,["children"]),d=t.addNode(u);if(!d)return{nodes:[],edges:[]};r&&(a[r]=d.id),s.nodes.push(d);var c=n.createAllChildNodes(a,o,d,i).edgesArray;l.push.apply(l,E([],w(c),!1))})),l.forEach((function(e){n.createEdgeModel(e,a,i)})),Eu(o,(function(e){var t=n.createEdgeModel(e,a,0);s.edges.push(t)})),s}}return e.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),C=x.nodesArray,N=x.edgesArray;u.push.apply(u,E([],w(C),!1)),s.push.apply(s,E([],w(N),!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)}},e.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 ft(d)&&!Xd(d)&&(f.text=g(g({},d),{x:(null==d?void 0:d.x)+n,y:(null==d?void 0:d.y)+n})),i.graphModel.addEdge(f)},e.prototype.getNodeAllChild=function(e){var t=this,n=[];return e.children&&e.children.forEach((function(e){n.push(e);var i=t.lf.getNodeModelById(e);(null==i?void 0:i.isGroup)&&(n=n.concat(t.getNodeAllChild(i)))})),n},e.prototype.getGroup=function(e,t){var n=this.lf.graphModel.nodes.filter((function(n){return n.isGroup&&n.isInRange(e)&&n.id!==t.id}));if(0!==n.length){if(1===n.length)return n[0];for(var i=n[n.length-1],r=n.length-2;r>=0;r--)n[r].zIndex>i.zIndex&&(i=n[r]);return i}},e.prototype.getNodeGroup=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="group",e}();function ng(){var e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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=g(g({},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",g({},s)),this.getFoldIcon()])},n}($f),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(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}(Zf);return{type:"bpmn:subProcess",view:e,model:n}}function ig(e){var t=Be("bpmn:serviceTask",Te),n=Be("bpmn:userTask",ke);e.register(t),e.register(n),e.register(ng()),function(e){function t(e,t){var n=e.x,i=e.y,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=x(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=x(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 rg(e){var n=function(t){function n(n,i){n.id||(n.id="Flow_".concat(me()));var r=g(g(g({},e||{}),n.properties),{isDefaultFlow:!1});return n.properties=r,t.call(this,n,i)||this}return f(n,t),n.extendKey="SequenceFlowModel",n}(t.PolylineEdgeModel),i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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 og=rg();var ag=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:Ne,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function sg(e){function t(t){t.forEach((function(t){var n,i;n=t.nodes,i=t.definition,n.forEach((function(t){(null==e?void 0:e[t])||(e[t]=new Map);var n=null==e?void 0:e[t];i.forEach((function(e){n.set(e.type,e)}))}))}))}return function(){return[e,t]}}var lg=function(){function e(e){var t=e.lf;t.definition={},t.useDefinition=sg(t.definition);var n=w(t.useDefinition(),2);n[0];(0,n[1])(ag),function(e){e.register(we(e)),e.register(be(e)),e.register(xe(e)),e.register(Ce(e)),e.register(Ee(e))}(t),function(e){var t=Ie("bpmn:exclusiveGateway",Se),n=Ie("bpmn:parallelGateway",Me),i=Ie("bpmn:inclusiveGateway",Ae);e.register(t),e.register(i),e.register(n)}(t),function(e){e.register(og)}(t),ig(t),t.setDefaultEdgeType("bpmn:sequenceFlow")}return e.pluginName="BpmnElementsPlugin",e}(),ug=40,dg=40,cg=40,hg=40,pg=100,fg=80,gg=100,vg=80,mg=100,yg=80,bg=100,xg=80,wg=100,Eg=80,Cg=100,Ng=80,_g=100,Sg=80,Mg=100,Ag=80;function Tg(e){return Object.prototype.toString.call(e)}function kg(e){return" ".repeat(e)}function Og(e){return"[object Object]"===Tg(e)?Object.keys(e).reduce((function(t,n){var i=n;return"-"===n.charAt(0)&&(i=n.substring(1)),t[i]=Og(e[n]),t}),{}):Array.isArray(e)?e.map((function(e){return Og(e)})):e}function Rg(e){return null==e?"":e.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Dg="\t\n";function Pg(e,t,n){var i=kg(n),r="",o=Dg+i;if("-json"===t)return"";if(0!==e&&!1!==e&&!e)return"".concat(o,"<").concat(t," />");if("#text"===t)return o+Rg(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(Og(e)).replace(/"/g,"'")}return Rg(String(t))}(e),'"');if(Array.isArray(e))r+=e.map((function(e){return Pg(e,t,n+1)})).join("");else if("[object Object]"===Tg(e)){var a=Object.keys(e),s="",l=e["-json"]?Dg+kg(n+1)+e["-json"]:"";r+="".concat(0===n?"":o,"<").concat(t),a.forEach((function(t){"-"===t.charAt(0)?s+=Pg(e[t],t,n+1):l+=Pg(e[t],t,n+1)})),r+=s+(""!==l?">".concat(l).concat(o,"</").concat(t,">"):" />")}else r+="".concat(o,"<").concat(t,">").concat(Rg(String(e)),"</").concat(t,">");return r}var Ig=function(){};(Ig.ObjTree=function(){return this}).VERSION="0.23",Ig.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',Ig.ObjTree.prototype.attr_prefix="-",Ig.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)},Ig.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},Ig.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}},Ig.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}},Ig.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},Ig.ObjTree.prototype.writeXML=function(e){var t=this.hash_to_xml(null,e);return this.xmlDecl+t},Ig.ObjTree.prototype.hash_to_xml=function(e,t){var n=[],i=[];for(var r in t)if(vd(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},Ig.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("")},Ig.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")},Ig.ObjTree.prototype.xml_escape=Rg;var Lg;!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"}(Lg||(Lg={}));var Bg=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],jg=["properties","startPoint","endPoint","pointsList"],zg={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Hg=function(e,t){return Object.keys(t||{}).forEach((function(n){if(e[n]){var i=t[n],r=i.in,o=i.out;r&&(e[n].in=r),o&&(e[n].out=o)}else e[n]=t[n]})),e},Fg={"bpmn:startEvent":{out:function(e){var t,n,i=e.properties;return(null===(n=null===(t=Fg[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=Fg[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=Fg[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=Fg[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=x(Object.keys(t)),d=u.next();!d.done;d=u.next()){var c=d.value;c.includes("bpmn:")&&(s=w(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 Wg(e){var t=null!=e?e:{},n=t.retainedAttrsFields,i=t.excludeFields,r=t.transformer,o=new Set(E(E([],w(jg),!1),w(n||[]),!1)),a={in:new Set(E(E([],w(zg.in),!1),w((null==i?void 0:i.in)||[]),!1)),out:new Set(E(E([],w(zg.out),!1),w((null==i?void 0:i.out)||[]),!1))};return Fg=Hg(Fg,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=Fg[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=x(Object.entries(i)),f=p.next();!f.done;f=p.next()){var g=w(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 Gg(e){var t,n,i={};try{for(var r=x(Object.entries(e)),o=r.next();!o.done;o=r.next()){var a=w(o.value,2),s=a[0],l=a[1];0===s.indexOf("-")?i[s.substring(1)]=Og(l):"string"==typeof l?i[s]=l:"[object Object]"===Object.prototype.toString.call(l)?i[s]=Gg(l):Array.isArray(l)?i[s]=l.map((function(e){return Gg(e)})):i[s]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return i}function Vg(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=Yg.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 Ug=["bpmn:incoming","bpmn:outgoing"];function qg(e,t){var n=[],i=[],r=new Map,o=null!=t?t:{},a=o.transformer,s=o.excludeFields,l={in:new Set(E(E([],w(zg.in),!1),w((null==s?void 0:s.in)||[]),!1)),out:new Set(E(E([],w(zg.out),!1),w((null==s?void 0:s.out)||[]),!1))};Fg=Hg(Fg,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:")||Ug.includes(t)||(h[t]||(h[t]=[]),!Array.isArray(h[t])&&(h[t]=[h[t]]),Array.isArray(e[t])?(n=h[t]).push.apply(n,E([],w(e[t]),!1)):h[t].push(e[t]),Array.isArray(e[t])?e[t].forEach((function(n){!t.includes("Flow")&&e["-children"].push(n["-id"])})):!t.includes("Flow")&&e["-children"].push(e[t]["-id"]),delete e[t])}))}if("bpmn:subProcess"===e){var n=h[e];Array.isArray(n)?n.forEach((function(n){"bpmn:subProcess"===e&&t(n)})):t(n)}},function(e){function t(e){var n;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={};Fg[e]&&Fg[e].in?(o=null===(r=(i=Fg[e]).in)||void 0===r?void 0:r.call(i,e,gn.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(Kg(i,e))}));else{var i=void 0;i=Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n.push(Kg(i,e))}return n}(t,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=Xg(Array.isArray(t)?t.find((function(t){return t["-bpmnElement"]===e["-id"]})):t,n,e);i.push(r)}));else{var r=Xg(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 Xg(e,t,n){var i=Number(e["dc:Bounds"]["-x"]),r=Number(e["dc:Bounds"]["-y"]),o=n["-children"],a=n["-name"],s=Yg.shapeConfigMap.get(t);s&&(i+=s.width/2,r+=s.height/2);var l,u={};if(Object.entries(n).forEach((function(e){var t=w(e,2),n=t[0],i=t[1];Bg.includes(n)||(u[n]=i)})),u=Gg(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 Kg(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=w(e,2),n=t[0],i=t[1];Bg.includes(n)||(a[n]=i)})),a=Gg(a);var s=e["di:waypoint"].map((function(e){return{x:Number(e["-x"]),y:Number(e["-y"])}})),l={id:t["-id"],type:Lg.FLOW,pointsList:s,sourceNodeId:t["-sourceRef"],targetNodeId:t["-targetRef"],properties:a};return n&&(l.text=n),l}var Yg=function(){function e(e){var t=e.lf,n=this;this.adapterOut=function(e,t){var i,r,o=g({},n.processAttributes);!function(e,t,n){var i,r=new Map,o=Wg(n)(t);o.nodes.forEach((function(t){var n=t["-id"],i=t["-type"],o=t.text,a=t.children,s=v(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=v(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[Lg.FLOW]=a}(o,e,t);var a={"-id":"BPMNPlane_1","-bpmnElement":o["-id"]};Vg(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]=gn.cloneDeep(e[t]),delete e[t],d(e[n])):d(e[t])}))};d(l)}return l},this.adapterIn=function(e,t){if(e)return qg(e,t)},t.adapterIn=this.adapterIn,t.adapterOut=this.adapterOut,this.processAttributes={"-isExecutable":"true","-id":"Process"},this.definitionAttributes={"-id":"Definitions","-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.10"}}return e.prototype.setCustomShape=function(t,n){e.shapeConfigMap.set(t,n)},e.pluginName="bpmn-adapter",e.shapeConfigMap=new Map,e}();Yg.shapeConfigMap.set(Lg.START,{width:ug,height:dg}),Yg.shapeConfigMap.set(Lg.END,{width:cg,height:hg}),Yg.shapeConfigMap.set(Lg.INTERMEDIATE_CATCH,{width:gg,height:vg}),Yg.shapeConfigMap.set(Lg.INTERMEDIATE_THROW,{width:gg,height:vg}),Yg.shapeConfigMap.set(Lg.BOUNDARY,{width:pg,height:fg}),Yg.shapeConfigMap.set(Lg.PARALLEL_GATEWAY,{width:mg,height:yg}),Yg.shapeConfigMap.set(Lg.INCLUSIVE_GATEWAY,{width:bg,height:xg}),Yg.shapeConfigMap.set(Lg.EXCLUSIVE_GATEWAY,{width:wg,height:Eg}),Yg.shapeConfigMap.set(Lg.SYSTEM,{width:Cg,height:Ng}),Yg.shapeConfigMap.set(Lg.USER,{width:_g,height:Sg}),Yg.shapeConfigMap.set(Lg.SUBPROCESS,{width:Mg,height:Ag});var Qg=function(e){function t(t){var n=e.call(this,t)||this;n.adapterXmlIn=function(e){var t,i=(t=e,(new Ig.ObjTree).parseXML(t));return n.adapterIn(i,n.props)},n.adapterXmlOut=function(e){return function(e){var t="";for(var n in e)t+=Pg(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 f(t,e),t.pluginName="BPMNAdapter",t}(Yg),Zg={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},$g={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function Jg(e){switch(e){case"bpmn:sequenceFlow":return Zg.SEQUENCE_FLOW;case"bpmn:startEvent":return Zg.START_EVENT;case"bpmn:endEvent":return Zg.END_EVENT;case"bpmn:userTask":return Zg.USER_TASK;case"bpmn:exclusiveGateway":return Zg.EXCLUSIVE_GATEWAY;default:return e}}var ev="An invariant failed, however the error is obfuscated because this is a production build.",tv=[];Object.freeze(tv);var nv={};function iv(){return++Em.mobxGuid}function rv(e){throw ov(!1,e),"X"}function ov(e,t){if(!e)throw new Error("[mobx] "+(t||ev))}function av(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}Object.freeze(nv);var sv=function(){};function lv(e){return null!==e&&"object"==typeof e}function uv(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function dv(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function cv(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return lv(e)&&!0===e[n]}}function hv(e){return e instanceof Map}function pv(e){return e instanceof Set}function fv(e){return e&&e.toString?e.toString():new String(e).toString()}function gv(e){return null===e?null:"object"==typeof e?""+e:e}var vv="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,mv=Symbol("mobx administration"),yv=function(){function e(e){void 0===e&&(e="Atom@"+iv()),this.name=e,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=new Set,this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=qv.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 Am(this)},e.prototype.reportChanged=function(){Sm(),function(e){if(e.lowestObserverState===qv.STALE)return;e.lowestObserverState=qv.STALE,e.observers.forEach((function(t){t.dependenciesState===qv.UP_TO_DATE&&(t.isTracing!==Xv.NONE&&Tm(t,e),t.onBecomeStale()),t.dependenciesState=qv.STALE}))}(this),Mm()},e.prototype.toString=function(){return this.name},e}(),bv=cv("Atom",yv);function xv(e,t,n){void 0===t&&(t=sv),void 0===n&&(n=sv);var i=new yv(e);return t!==sv&&zm("onBecomeObserved",i,t),n!==sv&&jm(i,n),i}var wv={identity:function(e,t){return e===t},structural:function(e,t){return Ny(e,t)},default:function(e,t){return Object.is(e,t)},shallow:function(e,t){return Ny(e,t,1)}},Ev=function(e,t){return Ev=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])},Ev(e,t)};var Cv=function(){return Cv=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},Cv.apply(this,arguments)};function Nv(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 _v(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 Sv(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(_v(arguments[t]));return e}var Mv=Symbol("mobx did run lazy initializers"),Av=Symbol("mobx pending decorators"),Tv={},kv={};function Ov(e){var t,n;if(!0!==e[Mv]){var i=e[Av];if(i){dv(e,Mv,!0);var r=Sv(Object.getOwnPropertySymbols(i),Object.keys(i));try{for(var o=Nv(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 Rv(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,Av)){var s=i[Av];dv(i,Av,Cv({},s))}return i[Av][r]={prop:r,propertyCreator:t,descriptor:o,decoratorTarget:i,decoratorArguments:n},function(e,t){var n=t?Tv:kv;return n[e]||(n[e]={configurable:!0,enumerable:t,get:function(){return Ov(this),this[e]},set:function(t){Ov(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=tv,r.apply(null,arguments)):(n=Array.prototype.slice.call(arguments),r)}}function Dv(e,t,n){return Vm(e)?e:Array.isArray(e)?Vv.array(e,{name:n}):uv(e)?Vv.object(e,void 0,{name:n}):hv(e)?Vv.map(e,{name:n}):pv(e)?Vv.set(e,{name:n}):e}function Pv(e){return e}function Iv(e){ov(e);var t=Rv(!0,(function(t,n,i,r,o){var a=i?i.initializer?i.initializer.call(t):i.value:void 0;vy(t).addObservableProp(n,a,e)})),n=("undefined"!=typeof process&&process.env,t);return n.enhancer=e,n}var Lv={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Bv(e){return null==e?Lv:"string"==typeof e?{name:e,deep:!0,proxy:!0}:e}Object.freeze(Lv);var jv=Iv(Dv),zv=Iv((function(e,t,n){return null==e||wy(e)||sy(e)||cy(e)||fy(e)?e:Array.isArray(e)?Vv.array(e,{name:n,deep:!1}):uv(e)?Vv.object(e,void 0,{name:n,deep:!1}):hv(e)?Vv.map(e,{name:n,deep:!1}):pv(e)?Vv.set(e,{name:n,deep:!1}):rv(!1)})),Hv=Iv(Pv),Fv=Iv((function(e,t,n){return Ny(e,t)?t:e}));function Wv(e){return e.defaultDecorator?e.defaultDecorator.enhancer:!1===e.deep?Pv:Dv}var Gv={box:function(e,t){arguments.length>2&&Uv("box");var n=Bv(t);return new gm(e,Wv(n),n.name,!0,n.equals)},array:function(e,t){arguments.length>2&&Uv("array");var n=Bv(t);return function(e,t,n,i){void 0===n&&(n="ObservableArray@"+iv());void 0===i&&(i=!1);var r=new iy(n,t,i);!function(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}(r.values,mv,r);var o=new Proxy(r.values,ny);if(r.proxy=o,e&&e.length){var a=pm(!0);r.spliceWithArray(0,0,e),fm(a)}return o}(e,Wv(n),n.name)},map:function(e,t){arguments.length>2&&Uv("map");var n=Bv(t);return new dy(e,Wv(n),n.name)},set:function(e,t){arguments.length>2&&Uv("set");var n=Bv(t);return new py(e,Wv(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&Uv("object");var i=Bv(n);if(!1===i.proxy)return Hm({},e,t,i);var r=Fm(i),o=function(e){var t=new Proxy(e,Ym);return e[mv].proxy=t,t}(Hm({},void 0,void 0,i));return Wm(o,e,t,r),o},ref:Hv,shallow:zv,deep:jv,struct:Fv},Vv=function(e,t,n){if("string"==typeof arguments[1]||"symbol"==typeof arguments[1])return jv.apply(null,arguments);if(Vm(e))return e;var i=uv(e)?Vv.object(e,t,n):Array.isArray(e)?Vv.array(e,t):hv(e)?Vv.map(e,t):pv(e)?Vv.set(e,t):e;if(i!==e)return i;rv(!1)};function Uv(e){rv("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(Gv).forEach((function(e){return Vv[e]=Gv[e]}));var qv,Xv,Kv=Rv(!1,(function(e,t,n,i,r){var o=n.get,a=n.set,s=r[0]||{};vy(e).addComputedProp(e,t,Cv({get:o,set:a,context:e},s))})),Yv=Kv({equals:wv.structural}),Qv=function(e,t,n){if("string"==typeof t)return Kv.apply(null,arguments);if(null!==e&&"object"==typeof e&&1===arguments.length)return Kv.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 vm(i)};Qv.struct=Yv,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"}(qv||(qv={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Xv||(Xv={}));var Zv=function(e){this.cause=e};function $v(e){return e instanceof Zv}function Jv(e){switch(e.dependenciesState){case qv.UP_TO_DATE:return!1;case qv.NOT_TRACKING:case qv.STALE:return!0;case qv.POSSIBLY_STALE:for(var t=am(!0),n=rm(),i=e.observing,r=i.length,o=0;o<r;o++){var a=i[o];if(mm(a)){if(Em.disableErrorBoundaries)a.get();else try{a.get()}catch(e){return om(n),sm(t),!0}if(e.dependenciesState===qv.STALE)return om(n),sm(t),!0}}return lm(e),om(n),sm(t),!1}}function em(e){var t=e.observers.size>0;Em.computationDepth>0&&t&&rv(!1),Em.allowStateChanges||!t&&"strict"!==Em.enforceActions||rv(!1)}function tm(e,t,n){var i=am(!0);lm(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Em.runId;var r,o=Em.trackingDerivation;if(Em.trackingDerivation=e,!0===Em.disableErrorBoundaries)r=t.call(n);else try{r=t.call(n)}catch(e){r=new Zv(e)}return Em.trackingDerivation=o,function(e){for(var t=e.observing,n=e.observing=e.newObserving,i=qv.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&&Nm(s,e),s.diffValue=0}for(;r--;){var s;1===(s=n[r]).diffValue&&(s.diffValue=0,Cm(s,e))}i!==qv.UP_TO_DATE&&(e.dependenciesState=i,e.onBecomeStale())}(e),sm(i),r}function nm(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Nm(t[n],e);e.dependenciesState=qv.NOT_TRACKING}function im(e){var t=rm();try{return e()}finally{om(t)}}function rm(){var e=Em.trackingDerivation;return Em.trackingDerivation=null,e}function om(e){Em.trackingDerivation=e}function am(e){var t=Em.allowStateReads;return Em.allowStateReads=e,t}function sm(e){Em.allowStateReads=e}function lm(e){if(e.dependenciesState!==qv.UP_TO_DATE){e.dependenciesState=qv.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=qv.UP_TO_DATE}}var um=0,dm=1,cm=Object.getOwnPropertyDescriptor((function(){}),"name");function hm(e,t,n){var i=function(){return function(e,t,n,i){var r=function(){var e=!1,t=0,n=rm();Sm();var i=pm(!0),r=am(!0),o={prevDerivation:n,prevAllowStateChanges:i,prevAllowStateReads:r,notifySpy:e,startTime:t,actionId:dm++,parentActionId:um};return um=o.actionId,o}();try{return t.apply(n,i)}catch(e){throw r.error=e,e}finally{!function(e){um!==e.actionId&&rv("invalid action stack. did you forget to finish an action?");um=e.parentActionId,void 0!==e.error&&(Em.suppressReactionErrors=!0);fm(e.prevAllowStateChanges),sm(e.prevAllowStateReads),Mm(),om(e.prevDerivation),e.notifySpy&&!1;Em.suppressReactionErrors=!1}(r)}}(0,t,this,arguments)};return i.isMobxAction=!0,i}function pm(e){var t=Em.allowStateChanges;return Em.allowStateChanges=e,t}function fm(e){Em.allowStateChanges=e}cm&&cm.configurable;var gm=function(e){function t(t,n,i,r,o){void 0===i&&(i="ObservableValue@"+iv()),void 0===r&&(r=!0),void 0===o&&(o=wv.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}Ev(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))!==Em.UNCHANGED){false,this.setNewValue(e)}},t.prototype.prepareNewValue=function(e){if(em(this),Qm(this)){var t=$m(this,{object:this,type:"update",newValue:e});if(!t)return Em.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value,this.name),this.equals(this.value,e)?Em.UNCHANGED:e},t.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),Jm(this)&&ty(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 Zm(this,e)},t.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),ey(this,e)},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.value+"]"},t.prototype.valueOf=function(){return gv(this.get())},t.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},t}(yv);cv("ObservableValue",gm);var vm=function(){function e(e){this.dependenciesState=qv.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=qv.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+iv(),this.value=new Zv(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Xv.NONE,ov(e.get,"missing option for computed: get"),this.derivation=e.get,this.name=e.name||"ComputedValue@"+iv(),e.set&&(this.setter=hm(this.name,e.set)),this.equals=e.equals||(e.compareStructural||e.struct?wv.structural:wv.default),this.scope=e.context,this.requiresReaction=!!e.requiresReaction,this.keepAlive=!!e.keepAlive}return e.prototype.onBecomeStale=function(){!function(e){if(e.lowestObserverState!==qv.UP_TO_DATE)return;e.lowestObserverState=qv.POSSIBLY_STALE,e.observers.forEach((function(t){t.dependenciesState===qv.UP_TO_DATE&&(t.dependenciesState=qv.POSSIBLY_STALE,t.isTracing!==Xv.NONE&&Tm(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&&rv("Cycle detected in computation "+this.name+": "+this.derivation),0!==Em.inBatch||0!==this.observers.size||this.keepAlive?(Am(this),Jv(this)&&this.trackAndCompute()&&function(e){if(e.lowestObserverState===qv.STALE)return;e.lowestObserverState=qv.STALE,e.observers.forEach((function(t){t.dependenciesState===qv.POSSIBLY_STALE?t.dependenciesState=qv.STALE:t.dependenciesState===qv.UP_TO_DATE&&(e.lowestObserverState=qv.UP_TO_DATE)}))}(this)):Jv(this)&&(this.warnAboutUntrackedRead(),Sm(),this.value=this.computeValue(!1),Mm());var e=this.value;if($v(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if($v(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){ov(!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 ov(!1,!1)},e.prototype.trackAndCompute=function(){var e=this.value,t=this.dependenciesState===qv.NOT_TRACKING,n=this.computeValue(!0),i=t||$v(e)||$v(n)||!this.equals(e,n);return i&&(this.value=n),i},e.prototype.computeValue=function(e){var t;if(this.isComputing=!0,Em.computationDepth++,e)t=tm(this,this.derivation,this.scope);else if(!0===Em.disableErrorBoundaries)t=this.derivation.call(this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Zv(e)}return Em.computationDepth--,this.isComputing=!1,t},e.prototype.suspend=function(){this.keepAlive||(nm(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=nv);var n,i=t&&t.name||e.name||"Autorun@"+iv();if(t.scheduler||t.delay){var r=function(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Bm}(t),o=!1;n=new Om(i,(function(){o||(o=!0,r((function(){o=!1,n.isDisposed||n.track(a)})))}),t.onError,t.requiresObservable)}else n=new Om(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=rm();e({type:"update",object:n,newValue:o,oldValue:r}),om(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 gv(this.get())},e.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},e}(),mm=cv("ComputedValue",vm),ym=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},bm={};function xm(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:bm}var wm=!0,Em=function(){var e=xm();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(wm=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new ym).version&&(wm=!1),wm?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new ym):(setTimeout((function(){rv("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new ym)}();function Cm(e,t){e.observers.add(t),e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Nm(e,t){e.observers.delete(t),0===e.observers.size&&_m(e)}function _m(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,Em.pendingUnobservations.push(e))}function Sm(){Em.inBatch++}function Mm(){if(0==--Em.inBatch){Pm();for(var e=Em.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 vm&&n.suspend())}Em.pendingUnobservations=[]}}function Am(e){var t=Em.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&&Em.inBatch>0&&_m(e),!1)}function Tm(e,t){if(e.isTracing===Xv.BREAK){var n=[];km(function(e,t){return Gm(Ey(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 vm?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function km(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 km(e,t,n+1)})))}var Om=function(){function e(e,t,n,i){void 0===e&&(e="Reaction@"+iv()),void 0===i&&(i=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=i,this.observing=[],this.newObserving=[],this.dependenciesState=qv.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+iv(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Xv.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Em.pendingReactions.push(this),Pm())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Sm(),this._isScheduled=!1,Jv(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending}catch(e){this.reportExceptionInDerivation(e)}}Mm()}},e.prototype.track=function(e){if(!this.isDisposed){Sm(),this._isRunning=!0;var t=tm(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&nm(this),$v(t)&&this.reportExceptionInDerivation(t.cause),Mm()}},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(Em.disableErrorBoundaries)throw e;Em.suppressReactionErrors,Em.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Sm(),nm(this),Mm()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e[mv]=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 Em.trackingDerivation;case 1:return Ey(e[0]);case 2:return Ey(e[0],e[1])}}(e);if(!i)return rv(!1);i.isTracing,Xv.NONE;i.isTracing=n?Xv.BREAK:Xv.LOG}(this,e)},e}(),Rm=100,Dm=function(e){return e()};function Pm(){Em.inBatch>0||Em.isRunningReactions||Dm(Im)}function Im(){Em.isRunningReactions=!0;for(var e=Em.pendingReactions,t=0;e.length>0;){++t===Rm&&e.splice(0);for(var n=e.splice(0),i=0,r=n.length;i<r;i++)n[i].runReaction()}Em.isRunningReactions=!1}var Lm=cv("Reaction",Om);var Bm=function(e){return e()};function jm(e,t,n){return zm("onBecomeUnobserved",e,t)}function zm(e,t,n,i){var r=Ey(t),o=n,a=e+"Listeners";return r[a]?r[a].add(o):r[a]=new Set([o]),"function"!=typeof r[e]?rv(!1):function(){var e=r[a];e&&(e.delete(o),0===e.size&&delete r[a])}}function Hm(e,t,n,i){var r=Fm(i=Bv(i));return Ov(e),vy(e,i.name,r.enhancer),t&&Wm(e,t,n,r),e}function Fm(e){return e.defaultDecorator||(!1===e.deep?Hv:jv)}function Wm(e,t,n,i){var r,o;Sm();try{var a=vv(t);try{for(var s=Nv(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?Kv: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{Mm()}}function Gm(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(Gm)),i}function Vm(e){return 1!==arguments.length&&rv(!1),function(e){return null!=e&&(wy(e)||!!e[mv]||bv(e)||Lm(e)||mm(e))}(e)}function Um(e,t,n){if(2!==arguments.length||fy(e))if(wy(e)){var i=e[mv];i.values.get(t)?i.write(t,n):i.addObservableProp(t,n,i.defaultEnhancer)}else if(cy(e))e.set(t,n);else if(fy(e))e.add(t);else{if(!sy(e))return rv(!1);"number"!=typeof t&&(t=parseInt(t,10)),ov(t>=0,"Not a valid index: '"+t+"'"),Sm(),t>=e.length&&(e.length=t+1),e[t]=n,Mm()}else{Sm();var r=t;try{for(var o in r)Um(e,o,r[o])}finally{Mm()}}}function qm(e,t){void 0===t&&(t=void 0),Sm();try{return e.apply(t)}finally{Mm()}}function Xm(e){return e[mv]}function Km(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e}var Ym={has:function(e,t){if(t===mv||"constructor"===t||t===Mv)return!0;var n=Xm(e);return Km(t)?n.has(t):t in e},get:function(e,t){if(t===mv||"constructor"===t||t===Mv)return e[t];var n=Xm(e),i=n.values.get(t);if(i instanceof yv){var r=i.get();return void 0===r&&n.has(t),r}return Km(t)&&n.has(t),e[t]},set:function(e,t,n){return!!Km(t)&&(Um(e,t,n),!0)},deleteProperty:function(e,t){return!!Km(t)&&(Xm(e).remove(t),!0)},ownKeys:function(e){return Xm(e).keysAtom.reportObserved(),Reflect.ownKeys(e)},preventExtensions:function(e){return rv("Dynamic observable objects cannot be frozen"),!1}};function Qm(e){return void 0!==e.interceptors&&e.interceptors.length>0}function Zm(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),av((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function $m(e,t){var n=rm();try{for(var i=Sv(e.interceptors||[]),r=0,o=i.length;r<o&&(ov(!(t=i[r](t))||t.type,"Intercept handlers should return nothing or a change object"),t);r++);return t}finally{om(n)}}function Jm(e){return void 0!==e.changeListeners&&e.changeListeners.length>0}function ey(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),av((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ty(e,t){var n=rm(),i=e.changeListeners;if(i){for(var r=0,o=(i=i.slice()).length;r<o;r++)i[r](t);om(n)}}var ny={get:function(e,t){return t===mv?e[mv]:"length"===t?e[mv].getArrayLength():"number"==typeof t?ry.get.call(e,t):"string"!=typeof t||isNaN(t)?ry.hasOwnProperty(t)?ry[t]:e[t]:ry.get.call(e,parseInt(t))},set:function(e,t,n){return"length"===t&&e[mv].setArrayLength(n),"number"==typeof t&&ry.set.call(e,t,n),"symbol"==typeof t||isNaN(t)?e[t]=n:ry.set.call(e,parseInt(t),n),!0},preventExtensions:function(e){return rv("Observable arrays cannot be frozen"),!1}};var iy=function(){function e(e,t,n){this.owned=n,this.values=[],this.proxy=void 0,this.lastKnownLength=0,this.atom=new yv(e||"ObservableArray@"+iv()),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 Zm(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}),ey(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;em(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=tv),Qm(this)){var o=$m(this,{object:this.proxy,type:"splice",index:e,removedCount:t,added:n});if(!o)return tv;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,Sv([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=Jm(this),o=r||i?{object:this.proxy,type:"update",index:e,newValue:t,oldValue:n}:null;this.atom.reportChanged(),r&&ty(this,o)},e.prototype.notifyArraySplice=function(e,t,n){var i=!this.owned&&!1,r=Jm(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&&ty(this,o)},e}(),ry={intercept:function(e){return this[mv].intercept(e)},observe:function(e,t){return void 0===t&&(t=!1),this[mv].observe(e,t)},clear:function(){return this.splice(0)},replace:function(e){var t=this[mv];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[mv];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[mv].spliceWithArray(e,t,n)},push:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this[mv];return n.spliceWithArray(n.values.length,0,e),n.values.length},pop:function(){return this.splice(Math.max(this[mv].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[mv];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[mv],n=t.dehanceValues(t.values).indexOf(e);return n>-1&&(this.splice(n,1),!0)},get:function(e){var t=this[mv];if(t&&e<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[e])},set:function(e,t){var n=this[mv],i=n.values;if(e<i.length){em(n.atom);var r=i[e];if(Qm(n)){var o=$m(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]&&(ry[e]=function(){var t=this[mv];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]&&(ry[e]=function(t,n){var i=this,r=this[mv];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){ry[e]=function(){var t=this,n=this[mv];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 oy,ay=cv("ObservableArrayAdministration",iy);function sy(e){return lv(e)&&ay(e[mv])}var ly,uy={},dy=function(){function e(e,t,n){if(void 0===t&&(t=Dv),void 0===n&&(n="ObservableMap@"+iv()),this.enhancer=t,this.name=n,this[oy]=uy,this._keysAtom=xv(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(!Em.trackingDerivation)return this._has(e);var n=this._hasMap.get(e);if(!n){var i=n=new gm(this._has(e),Pv,this.name+"."+fv(e)+"?",!1);this._hasMap.set(e,i),jm(i,(function(){return t._hasMap.delete(e)}))}return n.get()},e.prototype.set=function(e,t){var n=this._has(e);if(Qm(this)){var i=$m(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((em(this._keysAtom),Qm(this))&&!(i=$m(this,{type:"delete",object:this,name:e})))return!1;if(this._has(e)){var n=Jm(this),i=n?{type:"delete",object:this,oldValue:this._data.get(e).value,name:e}:null;return qm((function(){t._keysAtom.reportChanged(),t._updateHasMapEntry(e,!1),t._data.get(e).setNewValue(void 0),t._data.delete(e)})),n&&ty(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))!==Em.UNCHANGED){var i=!1,r=Jm(this),o=r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;i,n.setNewValue(t),r&&ty(this,o)}},e.prototype._addValue=function(e,t){var n=this;em(this._keysAtom),qm((function(){var i=new gm(t,n.enhancer,n.name+"."+fv(e),!1);n._data.set(e,i),t=i.value,n._updateHasMapEntry(e,!0),n._keysAtom.reportChanged()}));var i=Jm(this);i&&ty(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 Ay({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 Ay({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[(oy=mv,Symbol.iterator)]=function(){return this.entries()},e.prototype.forEach=function(e,t){var n,i;try{for(var r=Nv(this),o=r.next();!o.done;o=r.next()){var a=_v(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 cy(e)&&(e=e.toJS()),qm((function(){var n=pm(!0);try{uv(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=_v(e,2),i=n[0],r=n[1];return t.set(i,r)})):hv(e)?(e.constructor!==Map&&rv("Cannot initialize from classes that inherit from Map: "+e.constructor.name),e.forEach((function(e,n){return t.set(n,e)}))):null!=e&&rv("Cannot initialize map from "+e)}finally{fm(n)}})),this},e.prototype.clear=function(){var e=this;qm((function(){im((function(){var t,n;try{for(var i=Nv(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 qm((function(){var n,i,r,o,a=function(e){if(hv(e)||cy(e))return e;if(Array.isArray(e))return new Map(e);if(uv(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return rv("Cannot convert to map from '"+e+"'")}(e),s=new Map,l=!1;try{for(var u=Nv(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=Nv(a.entries()),f=p.next();!f.done;f=p.next()){var g=_v(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(),w=b.next();!x.done;){if(x.value!==w.value){t._keysAtom.reportChanged();break}x=y.next(),w=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=Nv(this),r=i.next();!r.done;r=i.next()){var o=_v(r.value,2),a=o[0],s=o[1];n["symbol"==typeof a?a:fv(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 fv(t)+": "+e.get(t)})).join(", ")+" }]"},e.prototype.observe=function(e,t){return ey(this,e)},e.prototype.intercept=function(e){return Zm(this,e)},e}(),cy=cv("ObservableMap",dy),hy={},py=function(){function e(e,t,n){if(void 0===t&&(t=Dv),void 0===n&&(n="ObservableSet@"+iv()),this.name=n,this[ly]=hy,this._data=new Set,this._atom=xv(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;qm((function(){im((function(){var t,n;try{for(var i=Nv(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=Nv(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((em(this._atom),Qm(this))&&!(i=$m(this,{type:"add",object:this,newValue:e})))return this;if(!this.has(e)){qm((function(){t._data.add(t.enhancer(e,void 0)),t._atom.reportChanged()}));var n=Jm(this),i=n?{type:"add",object:this,newValue:e}:null;n&&ty(this,i)}return this},e.prototype.delete=function(e){var t=this;if(Qm(this)&&!(i=$m(this,{type:"delete",object:this,oldValue:e})))return!1;if(this.has(e)){var n=Jm(this),i=n?{type:"delete",object:this,oldValue:e}:null;return qm((function(){t._atom.reportChanged(),t._data.delete(e)})),n&&ty(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 Ay({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 Ay({next:function(){return t<n.length?{value:e.dehanceValue(n[t++]),done:!1}:{done:!0}}})},e.prototype.replace=function(e){var t=this;return fy(e)&&(e=e.toJS()),qm((function(){var n=pm(!0);try{Array.isArray(e)||pv(e)?(t.clear(),e.forEach((function(e){return t.add(e)}))):null!=e&&rv("Cannot initialize set from "+e)}finally{fm(n)}})),this},e.prototype.observe=function(e,t){return ey(this,e)},e.prototype.intercept=function(e){return Zm(this,e)},e.prototype.toJS=function(){return new Set(this)},e.prototype.toString=function(){return this.name+"[ "+Array.from(this).join(", ")+" ]"},e.prototype[(ly=mv,Symbol.iterator)]=function(){return this.values()},e}(),fy=cv("ObservableSet",py),gy=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 yv(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 vm)i.set(t);else{if(Qm(this)){if(!(a=$m(this,{type:"update",object:this.proxy||n,name:e,newValue:t})))return;t=a.newValue}if((t=i.prepareNewValue(t))!==Em.UNCHANGED){var r=Jm(this),o=!1,a=r?{type:"update",object:this.proxy||n,oldValue:i.value,name:e,newValue:t}:null;o,i.setNewValue(t),r&&ty(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 gm(i,Pv,this.name+"."+fv(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(Qm(this)){var r=$m(this,{object:this.proxy||i,name:e,type:"add",newValue:t});if(!r)return;t=r.newValue}var o=new gm(t,n,this.name+"."+fv(e),!1);this.values.set(e,o),t=o.value,Object.defineProperty(i,e,function(e){return my[e]||(my[e]={configurable:!0,enumerable:!0,get:function(){return this[mv].read(e)},set:function(t){this[mv].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+"."+fv(t),this.values.set(t,new vm(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 yy[e]||(yy[e]={configurable:Em.computedConfigurable,enumerable:!1,get:function(){return by(this).read(e)},set:function(t){by(this).write(e,t)}})}(t))},e.prototype.remove=function(e){if(this.values.has(e)){var t=this.target;if(Qm(this))if(!(s=$m(this,{object:this.proxy||t,name:e,type:"remove"})))return;try{Sm();var n=Jm(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&&ty(this,s)}finally{Mm()}}},e.prototype.illegalAccess=function(e,t){},e.prototype.observe=function(e,t){return ey(this,e)},e.prototype.intercept=function(e){return Zm(this,e)},e.prototype.notifyPropertyAddition=function(e,t){var n=Jm(this),i=n?{type:"add",object:this.proxy||this.target,name:e,newValue:t}:null;if(n&&ty(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=Nv(this.values),r=i.next();!r.done;r=i.next()){var o=_v(r.value,2),a=o[0];o[1]instanceof gm&&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 vy(e,t,n){if(void 0===t&&(t=""),void 0===n&&(n=Dv),Object.prototype.hasOwnProperty.call(e,mv))return e[mv];uv(e)||(t=(e.constructor.name||"ObservableObject")+"@"+iv()),t||(t="ObservableObject@"+iv());var i=new gy(e,new Map,fv(t),n);return dv(e,mv,i),i}var my=Object.create(null),yy=Object.create(null);function by(e){var t=e[mv];return t||(Ov(e),e[mv])}var xy=cv("ObservableObjectAdministration",gy);function wy(e){return!!lv(e)&&(Ov(e),xy(e[mv]))}function Ey(e,t){if("object"==typeof e&&null!==e){if(sy(e))return void 0!==t&&rv(!1),e[mv].atom;if(fy(e))return e[mv];if(cy(e)){var n=e;return void 0===t?n._keysAtom:((i=n._data.get(t)||n._hasMap.get(t))||rv(!1),i)}var i;if(Ov(e),t&&!e[mv]&&e[t],wy(e))return t?((i=e[mv].values.get(t))||rv(!1),i):rv(!1);if(bv(e)||mm(e)||Lm(e))return e}else if("function"==typeof e&&Lm(e[mv]))return e[mv];return rv(!1)}var Cy=Object.prototype.toString;function Ny(e,t,n){return void 0===n&&(n=-1),_y(e,t,n)}function _y(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=Cy.call(e);if(a!==Cy.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=Sy(e),t=Sy(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(!_y(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(!My(t,h=c[d])||!_y(e[h],t[h],n-1,i,r))return!1}return i.pop(),r.pop(),!0}function Sy(e){return sy(e)?e.slice():hv(e)||cy(e)||pv(e)||fy(e)?Array.from(e.entries()):e}function My(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ay(e){return e[Symbol.iterator]=Ty,e}function Ty(){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.");"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?Ey(e,t):wy(e)||cy(e)||fy(e)?function(e){return e||rv("Expecting some object"),bv(e)||mm(e)||Lm(e)||cy(e)||fy(e)?e:(Ov(e),e[mv]?e[mv]:void rv(!1))}(e):Ey(e)).name}},$mobx:mv});var ky=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.isGroup=!0,i.isRestrict=!1,i.autoResize=!1,i.collapsible=!0,i.staticTextPosition=!0,i.isCollapsed=!1,i.groupAddable=!1,i.transformWithContainer=!1,i.childrenLastCollapseStateDict=new Map,i.childrenLastCollapseStateDict=new Map,i.initNodeData(t),i.setAttributes(),i}return f(n,e),n.prototype.initNodeData=function(t){var n;e.prototype.initNodeData.call(this,t);var i=null!==(n=t.properties)&&void 0!==n?n:{},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.editable=!1,this.text.draggable=!1},n.prototype.setAttributes=function(){e.prototype.setAttributes.call(this)},n.prototype.getData=function(){var t=this,n=e.prototype.getData.call(this),i=[];return Eu(Array.from(this.children),(function(e){var n=t.graphModel.getNodeModelById(e);n&&!n.virtual&&i.push(e)})),n.children=i,n.properties&&(n.properties.children=i,n.properties.isCollapsed=this.isCollapsed),n},n.prototype.getNodesInGroup=function(e){var t=[];return e.isGroup&&Eu(Array.from(e.children),(function(e){t.push(e)})),t},n.prototype.getMoveDistance=function(t,n,i){void 0===i&&(i=!1);var r=w(e.prototype.getMoveDistance.call(this,t,n,i),2),o=r[0],a=r[1],s=this.getNodesInGroup(this);return this.graphModel.moveNodes(s,t,n,i),[o,a]},n.prototype.getHistoryData=function(){var t=e.prototype.getHistoryData.call(this);t.children=Array.from(this.children),t.isGroup=!0;var n=this,i=n.x,r=n.y,o=n.collapsedWidth,a=n.collapsedHeight,s=n.expandWidth,l=n.expandHeight;return n.isCollapsed&&(t.x=i+s/2-o/2,t.y=r+l/2-a/2,t.text&&(t.text.x=t.text.x+s/2-o/2,t.text.y=t.text.y+l/2-a/2)),t},n.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=E(E([],w(this.incoming.edges),!1),w(this.outgoing.edges),!1);Eu(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=E(E(E([],w(o),!1),w(c),!1),w(h),!1)}}})),this.collapseEdge(r,o)},n.prototype.setTextPosition=function(){var e=this,t=e.x,n=e.y,i=e.staticTextPosition,r=e.text,o=e.isCollapsed,a=e.width,s=e.height,l=e.collapsedWidth,u=e.collapsedHeight;if(i)return r.x=t,void(r.y=o?n:n-s/2+15);r.x=o?t-a/2+l/2:t+a/2-l/2,r.y=o?n-s/2+u/2:n+s/2-u/2},n.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()},n.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()},n.prototype.createVirtualEdge=function(e){e.pointsList=void 0;var t=this.graphModel.addEdge(e);t.virtual=!0,t.text.editable=!1,t.isCollapsedEdge=!0},n.prototype.collapseEdge=function(e,t){var n=this,i=this.graphModel;Eu(t,(function(t,r){var o,a=t.getData(),s=a.targetNodeId,l=a.sourceNodeId,u=g(g({},a),{id:"".concat(a.id,"__").concat(r),text:null===(o=a.text)||void 0===o?void 0:o.value});t.virtual&&i.deleteEdgeById(t.id);var d=i.dynamicGroup.getGroupByNodeId(s);d||(d=i.getNodeModelById(s));var c=i.dynamicGroup.getGroupByNodeId(l);c||(c=i.getNodeModelById(l)),e&&t.visible&&(n.children.has(l)||n.id===l?(u.startPoint=void 0,u.sourceNodeId=n.id):(u.endPoint=void 0,u.targetNodeId=n.id),d.id===n.id&&c.id===n.id||n.createVirtualEdge(u),t.visible=!1),e||t.visible||(d&&d.isGroup&&d.isCollapsed?(u.targetNodeId=d.id,u.endPoint=void 0,n.createVirtualEdge(u)):c&&c.isGroup&&c.isCollapsed?(u.sourceNodeId=c.id,u.startPoint=void 0,n.createVirtualEdge(u)):t.visible=!0)}))},n.prototype.isAllowAppendIn=function(e){return!0},n.prototype.setAllowAppendChild=function(e){this.groupAddable=e},n.prototype.addChild=function(e){this.children.add(e);var t=this.getData();this.graphModel.eventCenter.emit("group:add-node",{data:t,childId:e})},n.prototype.removeChild=function(e){this.children.delete(e);var t=this.getData();this.graphModel.eventCenter.emit("group:remove-node",{data:t})},n.prototype.toBack=function(){this.zIndex--},n.prototype.getAnchorStyle=function(){var t=e.prototype.getAnchorStyle.call(this);return t.stroke="transparent",t.fill="transparent",t.hover&&(t.hover.fill="transparent",t.hover.stroke="transparent"),t},n.prototype.getAddableOutlineStyle=function(){return{stroke:"#feb663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},m([t.observable],n.prototype,"isCollapsed",void 0),m([t.observable],n.prototype,"groupAddable",void 0),m([t.observable],n.prototype,"transformWithContainer",void 0),n}(t.RectNodeModel),Oy={defaultWidth:120,defaultHeight:120,titleSize:60,poolMinSize:20},Ry=120,Dy=120,Py=20,Iy=20,Ly=15,By=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.titleSize=Oy.titleSize,i.poolConfig=Oy,i.isPool=!0,i._defaultLaneCreated=!1,i}return f(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)||Oy.defaultWidth,this.height=(null===(i=t.properties)||void 0===i?void 0:i.height)||Oy.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+Oy.titleSize,u=d}else{var c=s.reduce((function(e,t){return e+t.width}),0);u=r.height+Oy.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&&Eu(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+Oy.titleSize/2,this.text.y=this.y):(this.text.x=this.x,this.text.y=this.y-this.height/2+Oy.titleSize/2)},t.prototype.resizePool=function(){var e=this.getLanes();if(0!==e.length){var t=0,n=0;this.isHorizontal?(Eu(e,(function(e){var i=e.width,r=e.height;t=Math.max(t,i),n+=r})),this.width=t+Oy.titleSize,this.height=n):(Eu(e,(function(e){var i=e.width,r=e.height;t+=i,n=Math.max(n,r)})),this.width=t,this.height=n+Oy.titleSize),this.updateTextPosition()}},t.prototype.resizeChildrenWithNewLane=function(e,t){var n,i=this,r=this.getLanes();if(e&&t&&!Xd(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-Oy.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=g(g({},e.text),{x:e.x-d/2+Py/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-Oy.titleSize,f=o.reduce((function(e,t){return e+t.width}),0),v=this.x-f/2;o.forEach((function(e,t){var n=v+e.width/2;e.text=g(g({},e.text),{x:e.x,y:e.y-p/2+Py/2}),i.moveLane(e,n,e.y),t<o.length-1&&(v+=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-Oy.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+Oy.titleSize+t.width/2,r+t.height/2,!0)}))}else{this.width=t.reduce((function(e,t){return e+t.width}),0);var i=js(t).sort((function(e,t){return e.x-t.x}));t.forEach((function(t){t.height=e.height-Oy.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+Oy.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=js(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=bc(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-Oy.titleSize,i=this.height;t=this.graphModel.addNode(bc({type:"lane",x:this.x-this.width/2+Oy.titleSize+n/2,y:this.y,width:n,height:i,text:{x:this.x-this.width/2+Oy.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-Oy.titleSize;t=this.graphModel.addNode(bc({type:"lane",x:this.x,y:this.y-this.height/2+Oy.titleSize+(this.height-Oy.titleSize)/2,width:n,height:i,text:{x:this.x,y:this.y-this.height/2+Oy.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 g(g({},t),{properties:g(g({},t.properties),{width:this.width,height:this.height})})},m([Qv],t.prototype,"isHorizontal",null),t}(ky);function jy(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 zy=function(e){function n(){var n=e.apply(this,E([],w(arguments),!1))||this;return n.childrenPositionMap=new Map,n.onNodeRotate=function(e){var t=e.model,i=n.props,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};Eu(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=jy(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;Eu(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 f(n,e),n.prototype.componentDidMount=function(){e.prototype.componentDidMount.call(this);var t=this.props.graphModel.eventCenter;t.on("node:rotate",this.onNodeRotate),t.on("node:resize",this.onNodeResize),t.on("node:mousemove",this.onNodeMouseMove),t.on("graph:rendered",this.graphRendered)},n.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this);var t=this.props.graphModel.eventCenter;t.off("node:rotate",this.onNodeRotate),t.off("node:resize",this.onNodeResize),t.off("node:mousemove",this.onNodeMouseMove),t.off("graph:rendered",this.graphRendered)},n.prototype.getNodesInGroup=function(e,t){var n=this,i=[];return e.isGroup&&Eu(Array.from(e.children),(function(e){i.push(e);var 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",g(g({},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=n-e.width/2+10,o=i-e.height/2+10;if(!e.collapsible)return null;var a=(null==e?void 0:e.isCollapsed)?this.getCollapseIcon(r,o):this.getExpandIcon(r,o),s=t.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:a});return t.h("g",{},[t.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#f4f5f6",stroke:"#cecece",cursor:"pointer",x:r,y:o,onClick:function(){e.toggleCollapse(!e.isCollapsed)}}),s])},n.prototype.getShape=function(){return t.h("g",{},[this.getAppendAreaShape(),e.prototype.getShape.call(this),this.getOperateIcon()])},n}(t.RectNode),Hy=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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,v=i-o/2,m=g(g(g(g({},p),h),{x:f,y:v,width:c?Oy.titleSize:r,height:c?o:Oy.titleSize}),c&&l),y=g(g(g(g({},p),h),{x:c?f+Oy.titleSize:f,y:c?v:v+Oy.titleSize,width:c?r-Oy.titleSize:r,height:c?o:o-Oy.titleSize}),c&&d);return t.h("g",{},[t.h("rect",m),t.h("rect",y)])},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}(zy);var Fy={type:"dynamic-group",view:zy,model:ky},Wy=-1e4,Gy=function(){function e(e){var t=e.lf,n=e.options,i=this;this.topGroupZIndex=Wy,this.nodeGroupMap=new Map,this.onSelectionDrop=function(){i.lf.graphModel.getSelectElements().nodes.forEach((function(e){i.addNodeToGroup(e)}))},this.onNodeAddOrDrop=function(e){var t=e.data;i.addNodeToGroup(t)},this.addNodeToGroup=function(e){var t=i.nodeGroupMap.get(e.id);t&&((a=i.lf.getNodeModelById(t)).removeChild(e.id),i.nodeGroupMap.delete(e.id),a.setAllowAppendChild(!1));var n=i.lf.getNodeModelById(e.id),r=null==n?void 0:n.getBounds();if(n&&r){if(n.isGroup){var o=n;Eu(Array.from(o.children),(function(t){i.nodeGroupMap.set(t,e.id)})),i.calibrateTopGroupZIndex([e]),i.onNodeSelect({data:e,isSelected:!1,isMultiple:!1})}var a;if(a=i.getGroupByBounds(r,e))a.isAllowAppendIn(e)?(a.addChild(e.id),a.setAllowAppendChild(!1)):i.lf.emit("group:not-allowed",{group:a.getData(),node:e})}},this.onGroupAddNode=function(e){var t=e.data,n=e.childId;i.nodeGroupMap.set(n,t.id)},this.removeNodeFromGroup=function(e){var t=e.data;e.model.isGroup&&t.children&&Eu(Array.from(t.children),(function(e){i.nodeGroupMap.delete(e),i.lf.deleteNode(e)}));var n=i.nodeGroupMap.get(t.id);if(n){var r=i.lf.getNodeModelById(n);r&&r.removeChild(t.id),i.nodeGroupMap.delete(t.id)}},this.onSelectionDrag=function(){i.lf.graphModel.getSelectElements().nodes.forEach((function(e){i.setActiveGroup(e)}))},this.onNodeDrag=function(e){var t=e.data;i.setActiveGroup(t)},this.setActiveGroup=function(e){var t=i.lf.getNodeModelById(e.id),n=null==t?void 0:t.getBounds();if(t&&n){var r=i.getGroupByBounds(n,e);if(i.activeGroup&&i.activeGroup.setAllowAppendChild(!1),!r||t.isGroup&&r.id===e.id)return;if(!r.isAllowAppendIn(e))return;i.activeGroup=r,i.activeGroup.setAllowAppendChild(!0)}},this.onNodeSelect=function(e){var t=e.data,n=e.isMultiple,r=e.isSelected,o=i.lf.getNodeModelById(t.id);if(i.sendNodeToFront(o),i.topGroupZIndex>-1e3){var a=i.lf.graphModel.nodes;i.topGroupZIndex=Wy;var s=ep(Wu(a,(function(e){return!!e.isGroup})),"zIndex"),l=0;Eu(s,(function(e){e.zIndex!==l&&(i.topGroupZIndex++,l=e.zIndex),e.setZIndex(i.topGroupZIndex)}))}if(n&&r)if(null==o?void 0:o.isGroup){var u=o.children;Eu(Array.from(u),(function(e){var t=i.lf.getNodeModelById(e);null==t||t.setSelected(!1)}))}else{var d=i.nodeGroupMap.get(t.id);if(d){var c=i.lf.getNodeModelById(d);(null==c?void 0:c.isSelected)&&(null==o||o.setSelected(!1))}}},this.onNodeMove=function(e){var t=e.deltaX,n=e.deltaY,r=e.data,o=r.id,a=r.x,s=r.y,l=r.properties;if(l){var u=l.width,d=l.height,c=i.nodeGroupMap.get(o);if(c){var h=i.lf.getNodeModelById(c);if(h&&h.isRestrict&&h.autoResize){var p=a+t/2,f=s+n/2,g=p-u/2,v=f-d/2,m=p+u/2,y=f+d/2,b=!1,x=h.getBounds(),w=Object.assign({},x);if(g<w.minX&&(w.minX=g,b=!0),v<w.minY&&(w.minY=v,b=!0),m>w.maxX&&(w.maxX=m,b=!0),y>w.maxY&&(w.maxY=y,b=!0),b){var E=w.minX+(w.maxX-w.minX)/2,C=w.minY+(w.maxY-w.minY)/2,N=w.maxX-w.minX,_=w.maxY-w.minY;h.moveTo(E,C),h.width=N,h.height=_}}}}},this.onGraphRendered=function(e){var t=e.data;Eu(t.nodes,(function(e){e.children&&Eu(e.children,(function(t){i.nodeGroupMap.set(t,e.id)}))})),i.calibrateTopGroupZIndex(t.nodes)},t.register(Fy),this.lf=t,ur(this,n),this.init()}return e.prototype.getGroupByNodeId=function(e){var t=this.nodeGroupMap.get(e);if(t)return this.lf.getNodeModelById(t)},e.prototype.getGroupByBounds=function(e,t){var n=Wu(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},e.prototype.sendNodeToFront=function(e){var t=this;if(e&&e.isGroup&&(this.topGroupZIndex++,e.setZIndex(this.topGroupZIndex),e.children)){var n=e.children;Eu(Array.from(n),(function(e){var n=t.lf.getNodeModelById(e);t.sendNodeToFront(n)}))}},e.prototype.getMaxZIndex=function(e){var t=this,n=Wy;if(e.isGroup&&(n=Math.max(n,e.zIndex)),e.children){var i=e.children;Eu(Array.from(i),(function(e){var i=t.lf.getNodeModelById(e);if(null==i?void 0:i.isGroup){var r=t.getMaxZIndex(i);n=Math.max(n,r)}}))}return n},e.prototype.calibrateTopGroupZIndex=function(e){var t=this,n=Wy;if(Eu(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=Wu(this.lf.graphModel.nodes,(function(e){return!!e.isGroup})),r=this.topGroupZIndex;Eu(i,(function(e){e.zIndex>r&&(r=e.zIndex)})),this.topGroupZIndex=r}},e.prototype.removeChildrenInGroupNodeData=function(e){var t,n=js(e);return delete n.children,(null===(t=n.properties)||void 0===t?void 0:t.children)&&delete n.properties.children,n},e.prototype.initGroupChildNodes=function(e,n,i,r){var o=this,a=[],s=[],l=[];Eu(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,E([],w(E(E([],w(f.incoming.edges),!1),w(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,E([],w(v),!1)),s.push.apply(s,E([],w(m),!1))}}}));var u=ed(Wu(l,(function(t){return vd(e,t.sourceNodeId)&&vd(e,t.targetNodeId)})),(function(e){return e.getData()}));return{childNodes:a,edgesData:s.concat(u)}},e.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=js(e);return e.id&&"object"==typeof e.text&&null!==e.text&&(d=t.transformEdgeData(e,i)),this.lf.graphModel.addEdge(g(g({},d),{sourceNodeId:l,targetNodeId:u}))},e.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,r){if(e.children)for(var o=e.children,a=e.x+t/2,s=e.y+n/2,l=a-i/2,u=s-r/2,d=a+i/2,c=s+r/2,h=Array.from(o),p=0;p<h.length;p++){var f=h[p],g=this.lf.getNodeModelById(f);if(g){var v=g.getBounds(),m=v.minX,y=v.minY,b=v.maxX,x=v.maxY;if(!(l<=m&&u<=y&&d>=b&&c>=x))return!1}}return!0},e.prototype.init=function(){var e=this,t=this.lf,n=t.graphModel;n.addNodeMoveRules((function(t,n,i){if(t.isGroup)return!0;var r=e.nodeGroupMap.get(t.id),o=e.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(),t,n,i))})),n.addNodeResizeRules((function(t,n,i,r,o){return!t.isGroup||!t.isRestrict||e.checkGroupBoundsWithChildren(t,n,i,r,o)})),n.dynamicGroup=this,t.on("node:add,node:drop,node:dnd-add",this.onNodeAddOrDrop),t.on("selection:drop",this.onSelectionDrop),t.on("node:delete",this.removeNodeFromGroup),t.on("node:drag,node:dnd-drag",this.onNodeDrag),t.on("selection:drag",this.onSelectionDrag),t.on("node:click",this.onNodeSelect),t.on("node:mousemove",this.onNodeMove),t.on("graph:rendered",this.onGraphRendered),t.on("group:add-node",this.onGroupAddNode),t.addElements=function(n,i){var r=n.nodes,o=n.edges;void 0===i&&(i=40);var a={},s={nodes:[],edges:[]},l=[];return Eu(r,(function(n){var r,o,u=n.id,d=null!==(o=null===(r=n.properties)||void 0===r?void 0:r.children)&&void 0!==o?o:n.children,c=t.addNode(e.removeChildrenInGroupNodeData(n));if(u&&(a[u]=c.id),s.nodes.push(c),c.isGroup){var h=e.initGroupChildNodes(a,d,c,i).edgesData;l.push.apply(l,E([],w(h),!1))}})),Eu(l,(function(t){e.createEdge(t,a,i)})),Eu(o,(function(t){s.edges.push(e.createEdge(t,a,i))})),s},this.render()},e.prototype.render=function(){},e.prototype.destroy=function(){this.lf.off("node:add,node:drop,node:dnd-add",this.onNodeAddOrDrop),this.lf.off("selection:drop",this.onSelectionDrop),this.lf.off("node:delete",this.removeNodeFromGroup),this.lf.off("node:drag,node:dnd-drag",this.onNodeDrag),this.lf.off("selection:drag",this.onSelectionDrag),this.lf.off("node:click",this.onNodeSelect),this.lf.off("node:mousemove",this.onNodeMove),this.lf.off("graph:rendered",this.onGraphRendered),this.lf.off("group:add-node",this.onGroupAddNode)},e.pluginName="dynamicGroup",e}(),Vy=function(e){function t(){var t=e.apply(this,E([],w(arguments),!1))||this;return t.isLane=!0,t.defaultZIndex=-1,t}return f(t,e),t.prototype.initNodeData=function(t){var n;e.prototype.initNodeData.call(this,t),this.width=t.width||Ry,this.height=t.height||Dy,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=g(g({},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 g(g({},t),{properties:g(g({},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),Eu(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+Py/2,this.text.y=this.y):(this.text.x=this.x,this.text.y=this.y-this.height/2+Py/2)},t}(ky),Uy=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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",g(g({},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=g({x:n-r/2,y:i-o/2,width:r,height:o,stroke:"#000000",strokeWidth:2,fill:"transparent"},d),f=this.getOperateIcons(),v=g(g(g(g({},{fill:"#ffffff",stroke:"#000000",strokeWidth:1}),d),{x:u?c+Py:c,y:u?h:h+Py,width:u?r-Py:r,height:u?o:Py}),u?l:{});return t.h("g",{},E([this.getAppendAreaShape(),t.h("rect",v),t.h("rect",g({},p))],w(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+Ly,u=o-s/2,d={width:Iy/2,height:Iy,strokeWidth:1,fill:"#fff",stroke:"#000",x:l,y:u},c=[t.h("rect",g(g({},d),{x:l+Iy/2,strokeDasharray:"2 2"})),t.h("rect",d)];return e&&(c=[t.h("rect",g(g({},d),{width:Iy,height:Iy/2,strokeDasharray:"2 2"})),t.h("rect",g(g({},d),{width:Iy,height:Iy/2,y:u+Iy/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+Ly,u=o-s/2+Iy+Ly,d={width:Iy/2,height:Iy,strokeWidth:1,fill:"#fff",stroke:"#000",x:l,y:u},c=[t.h("rect",g(g({},d),{x:l+Iy/2})),t.h("rect",g(g({},d),{strokeDasharray:"2 2"}))];return e&&(c=[t.h("rect",g(g({},d),{width:Iy,height:Iy/2})),t.h("rect",g(g({},d),{width:Iy,height:Iy/2,y:u+Iy/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+Ly,l=r-a/2+3*(Iy+Ly);return t.h("g",{cursor:"pointer",onClick:e,width:Iy,height:Iy,transform:"translate(".concat(s,", ").concat(l,")")},[t.h("rect",{width:Iy,height:Iy,fill:"transparent"}),t.h("path",{transform:"translate(2, 1) scale(".concat(Iy/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}(zy);var qy,Xy={type:"pool",view:Hy,model:By},Ky={type:"lane",view:Uy,model:Vy},Yy=function(){function e(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;Eu(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(g(g({},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&&Eu(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=g(g({},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;Eu(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.deltaX,n=e.deltaY,r=e.data,o=r.id,a=r.x,s=r.y,l=r.properties;if(l){var u=l.width,d=l.height,c=i.nodeLaneMap.get(o);if(c){var h=i.lf.getNodeModelById(c);if(h&&h.isRestrict&&h.autoResize){var p=a+t/2,f=s+n/2,g=p-u/2,v=f-d/2,m=p+u/2,y=f+d/2,b=!1,x=h.getBounds(),w=Object.assign({},x);if(g<w.minX&&(w.minX=g,b=!0),v<w.minY&&(w.minY=v,b=!0),m>w.maxX&&(w.maxX=m,b=!0),y>w.maxY&&(w.maxY=y,b=!0),b){var E=w.minX+(w.maxX-w.minX)/2,C=w.minY+(w.maxY-w.minY)/2,N=w.maxX-w.minX,_=w.maxY-w.minY;h.moveTo(E,C),h.width=N,h.height=_}}}}},this.onGraphRendered=function(e){Eu(e.data.nodes,(function(e){e.children&&Eu(e.children,(function(t){i.nodeLaneMap.set(t,e.id)}))}))},t.register(Xy),t.register(Ky),this.lf=t,ur(this,n),this.init()}return e.prototype.getLaneByNodeId=function(e){var t=this.nodeLaneMap.get(e);if(t)return this.lf.getNodeModelById(t)},e.prototype.getLaneByBounds=function(e,t){var n=Wu(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},e.prototype.removeChildrenInGroupNodeData=function(e){var t,n=js(e);return delete n.children,(null===(t=n.properties)||void 0===t?void 0:t.children)&&delete n.properties.children,n},e.prototype.initGroupChildNodes=function(e,n,i,r){var o=this,a=[],s=[],l=[];Eu(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,E([],w(E(E([],w(f.incoming.edges),!1),w(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,E([],w(v),!1)),s.push.apply(s,E([],w(m),!1))}}}));var u=ed(Wu(l,(function(t){return vd(e,t.sourceNodeId)&&vd(e,t.targetNodeId)})),(function(e){return e.getData()}));return{childNodes:a,edgesData:s.concat(u)}},e.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=js(e);return e.id&&"object"==typeof e.text&&null!==e.text&&(d=t.transformEdgeData(e,i)),this.lf.graphModel.addEdge(g(g({},d),{sourceNodeId:l,targetNodeId:u}))},e.prototype.checkGroupBoundsWithChildren=function(e,t,n,i,r){if(e.children)for(var o=e.children,a=e.x+t/2,s=e.y+n/2,l=a-i/2,u=s-r/2,d=a+i/2,c=s+r/2,h=Array.from(o),p=0;p<h.length;p++){var f=h[p],g=this.lf.getNodeModelById(f);if(g){var v=g.getBounds(),m=v.minX,y=v.minY,b=v.maxX,x=v.maxY;if(!(l<=m&&u<=y&&d>=b&&c>=x))return!1}}return!0},e.prototype.init=function(){var e=this,t=this.lf,n=t.graphModel;n.addNodeMoveRules((function(t,n,i){if(t.isGroup)return!0;var r=e.nodeLaneMap.get(t.id),o=e.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(),t,n,i))})),n.addNodeResizeRules((function(t,n,i,r,o){return!t.isGroup||!t.isRestrict||e.checkGroupBoundsWithChildren(t,n,i,r,o)})),n.dynamicGroup=this,t.on("node:add,node:drop,node:dnd-add",this.onNodeAddOrDrop),t.on("selection:drop",this.onSelectionDrop),t.on("node:delete",this.removeNodeFromGroup),t.on("node:drag,node:dnd-drag",this.onNodeDrag),t.on("selection:drag",this.onSelectionDrag),t.on("node:click",this.onNodeSelect),t.on("node:mousemove",this.onNodeMove),t.on("graph:rendered",this.onGraphRendered),t.on("group:add-node",this.onGroupAddNode),t.addElements=function(n,i){var r=n.nodes,o=n.edges;void 0===i&&(i=40);var a={},s={nodes:[],edges:[]},l=[];return Eu(r,(function(n){var r,o,u=n.id,d=null!==(o=null===(r=n.properties)||void 0===r?void 0:r.children)&&void 0!==o?o:n.children,c=t.addNode(e.removeChildrenInGroupNodeData(n));if(u&&(a[u]=c.id),s.nodes.push(c),c.isGroup){var h=e.initGroupChildNodes(a,d,c,i).edgesData;l.push.apply(l,E([],w(h),!1))}})),Eu(l,(function(t){e.createEdge(t,a,i)})),Eu(o,(function(t){s.edges.push(e.createEdge(t,a,i))})),s},this.render()},e.prototype.render=function(){},e.prototype.destroy=function(){this.lf.off("node:add,node:drop,node:dnd-add",this.onNodeAddOrDrop),this.lf.off("selection:drop",this.onSelectionDrop),this.lf.off("node:delete",this.removeNodeFromGroup),this.lf.off("node:drag,node:dnd-drag",this.onNodeDrag),this.lf.off("selection:drag",this.onSelectionDrag),this.lf.off("node:click",this.onNodeSelect),this.lf.off("node:mousemove",this.onNodeMove),this.lf.off("graph:rendered",this.onGraphRendered),this.lf.off("group:add-node",this.onGroupAddNode)},e.pluginName="PoolElements",e}();!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(qy||(qy={}));var Qy=function(e,t,n,i){return void 0===i&&(i=0),Jy(e,t,n)<=i};function Zy(e){return e*e}function $y(e,t){return Zy(e.x-t.x)+Zy(e.y-t.y)}var Jy=function(e,t,n){return Math.sqrt(function(e,t,n){var i=$y(t,n);if(0===i)return $y(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)),$y(e,{x:t.x+r*(n.x-t.x),y:t.y+r*(n.y-t.y)})}(e,t,n))},eb=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=qy.VERTICAL:e.y===t.y&&(n=qy.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===qy.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===qy.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}}},tb=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(Qy({x:i,y:r},o[a],o[a+1],n)){var s=eb(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}}}},nb=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=tb(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=js(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 w=t.getClosestAnchor(u.endCrossPoint,r).anchor;if(this._lf.addEdge({type:f,sourceNodeId:e.id,targetNodeId:h,startPoint:js(w),endPoint:js(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}(),ib="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},rb={};!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 rb},set exports(e){rb=e}});var ob=rb,ab=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=w(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 f(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=Uu(o,(function(e){return e.id===n.id})),s=o[a];o[a]=g(g({},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,v=n.vertical,m=n.style,y=n.rotate,b=n.content,x=n.labelWidth,w=n.textOverflowMode,E=null!=x?x:"node"===i.BaseType?i.width-20:80,C={left:"".concat(h-E/2,"px"),top:"".concat(p-10,"px"),width:"".concat(E,"px"),height:"20px",zIndex:null!=f?f:1,transform:y?"".concat(d," rotate(").concat(y,"deg)"):"".concat(d," rotate(").concat(v?-.25:0,"turn)")};return Pf("div",{id:"element-container-".concat(c),className:ob("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:Pf("div",{ref:this.textRef,id:"editor-container-".concat(c),className:ob("lf-label-editor",(e={"lf-label-editor-dragging":a,"lf-label-editor-editing":u,"lf-label-editor-hover":!u&&(s||l)},e["lf-label-editor-".concat(w)]=!u,e)),onInput:this.handleInput,style:g({maxWidth:"".concat(E,"px"),boxSizing:"border-box",display:"inline-block",background:u||"edge"===i.BaseType?"#fff":"transparent"},m),dangerouslySetInnerHTML:{__html:b}})})},n=m([t.observer],n)}(t.Component),sb=t.LogicFlowUtil.createUuid,lb=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:sb(),this.initLabelData(e)}return e.prototype.initLabelData=function(e){ur(this,e)},e.prototype.getData=function(){return{id:this.id,x:this.x,y:this.y,type:"label",content:this.content,value:this.value,rotate:this.rotate,style:t.toJS(this.style),draggable:this.draggable,editable:this.editable,labelWidth:this.labelWidth,textOverflowMode:this.textOverflowMode,vertical:this.vertical}},m([t.observable],e.prototype,"x",void 0),m([t.observable],e.prototype,"y",void 0),m([t.observable],e.prototype,"content",void 0),m([t.observable],e.prototype,"value",void 0),m([t.observable],e.prototype,"rotate",void 0),m([t.observable],e.prototype,"style",void 0),m([t.observable],e.prototype,"zIndex",void 0),m([t.observable],e.prototype,"vertical",void 0),m([t.observable],e.prototype,"editable",void 0),m([t.observable],e.prototype,"draggable",void 0),m([t.observable],e.prototype,"labelWidth",void 0),m([t.observable],e.prototype,"textOverflowMode",void 0),e}(),ub={};!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||ib.content||ib),function(t,n){"undefined"!=typeof process&&process&&process.versions&&process.versions.electron?t.MediumEditor=n:e.exports=n}(ib,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 w(){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 E(){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,E.call(this),w.call(this)))},destroy:function(){this.isActive&&(this.isActive=!1,this.extensions.forEach((function(e){"function"==typeof e.destroy&&e.destroy()}),this),this.events.destroy(),this.elements.forEach((function(e){this.options.spellcheck&&(e.innerHTML=e.innerHTML),e.removeAttribute("contentEditable"),e.removeAttribute("spellcheck"),e.removeAttribute("data-medium-editor-element"),e.classList.remove("medium-editor-element"),e.removeAttribute("role"),e.removeAttribute("aria-multiline"),e.removeAttribute("medium-editor-index"),e.removeAttribute("data-medium-editor-editor-index"),e.getAttribute("medium-editor-textarea-id")&&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 ub},set exports(e){ub=e}});var db=ub,cb=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},hb=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}}(),pb=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 fb={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 gb(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 vb=function(){function e(t,n,i,r){cb(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=pb(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=pb(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 hb(e,[{key:"printRGB",value:function(e){var t=(e?this.rgba:this.rgba.slice(0,3)).map((function(e,t){return gb(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 gb(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=fb[n];return void 0===i?i:e.hexToRgb(i.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=pb(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=pb(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}(),mb=function(){function e(){cb(this,e),this._events=[]}return hb(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 yb(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 bb="keydown",xb="mousedown",wb="focusin";function Eb(e,t){return(t||document).querySelector(e)}function Cb(e,t,n,i,r){e.add(t,bb,(function(e){n.indexOf(e.key)>=0&&i(e)}))}var Nb=function(){function e(t){cb(this,e),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new mb,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return hb(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),Cb(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===bb?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===xb||t===wb){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!==xb&&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 vb(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=Eb(".picker_hue",r),this._domSL=Eb(".picker_sl",r),this._domA=Eb(".picker_alpha",r),this._domEdit=Eb(".picker_editor input",r),this._domSample=Eb(".picker_sample",r),this._domOkay=Eb(".picker_done button",r),this._domCancel=Eb(".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()})),yb(i,this._domH,(function(e,n){return t._setHSLA(e)})),yb(i,this._domSL,(function(e,n){return t._setHSLA(null,e,1-n)})),this.settings.alpha&&yb(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,xb,t),r(window,wb,t),Cb(i,n,["Esc","Escape"],t);var o=function(t){e.__containedEvent=t.timeStamp};r(n,xb,o),r(n,wb,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),Cb(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=Eb(".picker_selector",a),d=Eb(".picker_selector",s),c=Eb(".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}(),_b=document.createElement("style");_b.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(_b),Nb.StyleElement=_b;var Sb={};!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,w={isHostMethod:s,isHostObject:l,isHostProperty:u,areHostMethods:c,areHostObjects:h,areHostProperties:p,isTextRange:f,getBody:g,forEach:y},E={version:"1.3.1",initialized:!1,isBrowser:x,supported:!0,util:w,features:{},modules:b,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==n||rangyAutoInitialize}};function C(e){typeof console!=n&&s(console,"log")}function N(e,t){x&&t?alert(e):C(e)}function _(e){E.initialized=!0,E.supported=!1,N("Rangy is not supported in this environment. Reason: "+e,E.config.alertOnFail)}function S(e){N("Rangy warning: "+e,E.config.alertOnWarn)}E.fail=_,E.warn=S,{}.hasOwnProperty?(w.extend=v=function(e,t,n){var i,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},w.createOptions=function(e,t){var n={};return v(n,t),e&&v(n,e),n}):_("hasOwnProperty not supported"),x||_("Rangy can only run in a browser"),function(){var e;if(x){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(e){}}e||(e=function(e){for(var t=[],n=0,i=e.length;n<i;++n)t[n]=e[n];return t}),w.toArray=e}(),x&&(s(document,"addEventListener")?m=function(e,t,n){e.addEventListener(t,n,!1)}:s(document,"attachEvent")?m=function(e,t,n){e.attachEvent("on"+t,n)}:_("Document does not have required addEventListener or attachEvent method"),w.addListener=m);var M=[];function A(e){return e.message||e.description||String(e)}function T(){if(x&&!E.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 E.initialized=!0,E.features={implementsDomRange:t,implementsTextRange:n},b)(a=b[l])instanceof P&&a.init(a,E);for(var u=0,d=M.length;u<d;++u)try{M[u](E)}catch(e){C("Rangy init listener threw an exception. Continuing. Detail: "+A(e))}}else _("Neither Range nor TextRange are available");else _("No body element found")}}function k(e,t,n){n&&(e+=" in module "+n.name),E.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function O(e,t,n,i){e[t]=function(){return k(t,n,i),e[n].apply(e,w.toArray(arguments))}}w.deprecationNotice=k,w.createAliasForDeprecatedMethod=O,E.init=T,E.addInitListener=function(e){E.initialized?e(E):M.push(e)};var R=[];function D(e){e=e||window,T();for(var t=0,n=R.length;t<n;++t)R[t](e)}function P(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function I(e,t,n){var i=new P(e,t,(function(t){if(!t.initialized){t.initialized=!0;try{n(E,t),t.supported=!0}catch(t){C("Module '"+e+"' failed to load: "+A(t)),t.stack&&C(t.stack)}}}));return b[e]=i,i}function L(){}function B(){}E.addShimListener=function(e){R.push(e)},x&&(E.shim=E.createMissingNativeApi=D,O(E,"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){E.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){E.warn("DEPRECATED: "+e+" in module "+this.name+" is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},E.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var i=I(e,n,t);E.initialized&&E.supported&&i.init()},E.createCoreModule=function(e,t,n){I(e,t,n)},E.RangePrototype=L,E.rangePrototype=new L,E.selectionPrototype=new B,E.createCoreModule("DomUtil",[],(function(e,t){var n="undefined",i=e.util,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 w(e){var i=x(e);if(typeof i.defaultView!=n)return i.defaultView;if(typeof i.parentWindow!=n)return i.parentWindow;throw t.createError("Cannot get a window object for node")}function E(e){if(typeof e.contentDocument!=n)return e.contentDocument;if(typeof e.contentWindow!=n)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function C(e){if(typeof e.contentWindow!=n)return e.contentWindow;if(typeof e.contentDocument!=n)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function N(e){return e&&i.isHostMethod(e,"setTimeout")&&i.isHostObject(e,"document")}function _(e,t,n){var r;if(e?i.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?E(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 A,T=!1;function k(e){try{return e.parentNode,!1}catch(e){return!0}}function O(e){if(!e)return"[No node]";if(T&&k(e))return"[Broken node]";if(v(e))return'"'+e.data+'"';if(1==e.nodeType){var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">[index:"+d(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function R(e){for(var t,n=x(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function D(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 />",T=k(n),e.features.crashyTextNodes=T}(),typeof window.getComputedStyle!=n?A=function(e,t){return w(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=n?A=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("+O(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:w,getIframeWindow:C,getIframeDocument:E,getBody:r,isWindow:N,getContentDocument:_,getRootContainer:S,comparePoints:M,isBrokenNode:k,inspectNode:O,getComputedStyleProperty:A,createTestElement:D,removeNode:P,fragmentFromNodeChildren:R,createIterator:L,DomPosition:B},e.DOMException=j})),E.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 w(e){return new r(e.parentNode,s(e))}function E(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 A(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(A(n)),n.detach()):e.remove(),10==t.nodeType)throw new o("HIERARCHY_REQUEST_ERR");i.appendChild(t)}return i}function T(e,t,n){var i,r=!(!t||!t.length),o=!!n;r&&(i=new RegExp("^("+t.join("|")+")$"));var s=[];return S(new O(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 k(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+n.inspectNode(e.startContainer)+":"+e.startOffset+", "+n.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function O(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])}}O.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 O(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 R=[1,3,4,5,7,8,10],D=[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 V(e,t){if(t<0||t>(a(e)?e.length:e.childNodes.length))throw new o("INDEX_SIZE_ERR")}function U(e,t){if(j(e,!0)!==j(t,!0))throw new o("WRONG_DOCUMENT_ERR")}function q(e){if(z(e,!0))throw new o("NO_MODIFICATION_ALLOWED_ERR")}function X(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 O(this,!0);i!==o&&(i=(n=E(h(i,o,!0))).node,r=n.offset),S(a,q),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,R),G(g(n),D);var i=(e?w:E)(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),V(e,t),o(this,e,t)},setEnd:function(e,t){W(e,!0),V(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),V(t,i),W(r,!0),V(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,R);var t=w(e),i=E(e);n(this,t.node,t.offset,i.node,i.offset)},extractContents:pe(A,n),deleteContents:pe(M,n),canSurroundContents:function(){Q(this),q(this.startContainer),q(this.endContainer);var e=new O(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),V(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),U(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),q(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 O(this,!0);return e=_(n),n.detach(),e},canSurroundContents:function(){Q(this),q(this.startContainer),q(this.endContainer);var e=new O(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 O(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),X(e,"HIERARCHY_REQUEST_ERR"),U(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),X(e,"HIERARCHY_REQUEST_ERR"),U(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),T(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 k(this)},detach:function(){}}),fe(me,ve),i.extend(me,{rangeProperties:ne,RangeIterator:O,copyComparisonConstants:he,createPrototypeRange:fe,inspect:k,toHtml:te,getRangeDocument:b,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=me})),E.createCoreModule("WrappedRange",["DomRange"],(function(e,t){var n,i,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,w=x;w==b?l.appendChild(c):l.insertBefore(c,l.childNodes[w]),s.moveToElementText(c),0!=(h=s.compareEndPoints(m,e))&&y!=x;){if(-1==h){if(x==y+1)break;y=w}else x=x==y+1?y:w;w=Math.floor((y+x)/2),l.removeChild(c)}if(v=c.nextSibling,-1==h&&v&&d(v)){var E;if(s.setEndPoint(n?"EndToStart":"EndToEnd",e),/[\r\n]/.test(v.data)){var C=s.duplicate(),N=C.text.replace(/\r\n/g,"\r").length;for(E=C.moveStart("character",N);-1==(h=C.compareEndPoints("StartToEnd",C));)E++,C.moveStart("character",1)}else E=s.text.length;g=new a(v,E)}else 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:w,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}))})),E.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 w(e){return b(e,"getDocSelection").document.selection}function E(e){var t=!1;return e.anchorNode&&(t=1==a.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)),t}var C=l(window,"getSelection"),N=s.isHostObject(document,"selection");p.implementsWinGetSelection=C,p.implementsDocSelection=N;var _=N&&(!C||e.config.preferTextRange);if(_)n=w,e.isSelectionValid=function(e){var t=b(e,"isSelectionValid").document,n=t.selection;return"None"!=n.type||g(n.createRange().parentElement())==t};else{if(!C)return t.fail("Neither document.selection or window.getSelection() detected."),!1;n=x,e.isSelectionValid=function(){return!0}}e.getNativeSelection=n;var S=n();if(!S)return t.fail("Native selection was null (possibly issue 138?)"),!1;var M=e.createNativeRange(document),A=v(document),T=s.areHostProperties(S,["anchorNode","focusNode","anchorOffset","focusOffset"]);p.selectionHasAnchorAndFocus=T;var k=l(S,"extend");p.selectionHasExtend=k;var O=l(S,"setBaseAndExtent");p.selectionHasSetBaseAndExtent=O;var R=typeof S.rangeCount==o;p.selectionHasRangeCount=R;var D=!1,P=!0,I=k?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=E(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)D=!1;else{var h=d.cloneRange();d.setStart(u,0),h.setEnd(u,3),h.setStart(u,2),t.addRange(d),t.addRange(h),D=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=D,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 V(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 U(e){var n=e.getNodes();if(!V(n))throw t.createError("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return n[0]}function q(e){return!!e&&void 0!==e.text}function X(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(q(n))X(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=U(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)}A&&l(A,"createControlRange")&&(L=A.createControlRange(),s.areHostProperties(L,["item","add"])&&(j=!0)),p.implementsControlRange=j,i=T?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}}:T&&(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?w(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=U(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(!_&&T&&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=R?function(t,n){if(j&&N&&this.docSelection.type==f)Y(this,t);else if(y(n)&&k)re(this,t);else{var r;D?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)&&k?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):q(n)?X(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(!T||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=U(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)},!_&&T&&p.implementsDomRange?(oe=E,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)},O?ne.setBaseAndExtent=function(e,t,n,i){this.nativeSelection.setBaseAndExtent(e,t,n,i),this.refresh()}:k&&(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(q(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,!E.initialized&&E.config.autoInitialize&&T())};return x&&("complete"==document.readyState?z():(s(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",z,!1),m(window,"load",z))),E}()}({get exports(){return Sb},set exports(e){Sb=e}});var Mb=Sb,Ab={};!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 w(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 E(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){w(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){E(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 A(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 T(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 k(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 O=n.getComputedStyleProperty,R="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||R(e.parentNode))};function D(e){var t;return e&&1==e.nodeType&&((t=e.parentNode)&&9==t.nodeType&&"on"==t.designMode||R(e)&&!R(e.parentNode))}function P(e){return(R(e)||1!=e.nodeType&&R(e.parentNode))&&!D(e)}var I=/^inline(-block|-table)?$/i;function L(e){return e&&1==e.nodeType&&!I.test(O(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(O(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)&&T(e,t)&&"inline"==O(e,"display")&&"inline"==O(t,"display")}function V(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 U=V(!1),q=V(!0);function X(e){this.isElementMerge=1==e.nodeType,this.textNodes=[];var t=this.isElementMerge?e.lastChild:e;t&&(this.textNodes[0]=t)}X.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=U(e,!i))?(r||(r=new X(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=q(l,!i);if(f&&(r||(r=new X(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)&&!k(e,this.attrExceptions)&&this.elementHasAttributes(e,this.elementAttributes)&&this.isModifiable(e)},isEmptyContainer:function(e){var t=e.childNodes.length;return 1==e.nodeType&&this.isRemovable(e)&&(0==t||1==t&&this.isEmptyContainer(e.firstChild))},removeEmptyContainers:function(e){var t=this,n=e.getNodes([1],(function(e){return t.isEmptyContainer(e)})),i=[e],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=A(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=A(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:T,elementHasNonClassAttributes:k,splitNodeAt:W,isEditableElement:R,isEditingHost:D,isEditable:P},e.CssClassApplier=e.ClassApplier=Q,e.createClassApplier=Z,o.createAliasForDeprecatedMethod(e,"createCssClassApplier","createClassApplier",t)})),e}(Sb)}({get exports(){return Ab},set exports(e){Ab=e}});var Tb={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 kb(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{Mb.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 Nb({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=Mb.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 Ob=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 f(n,e),n.prototype.componentDidMount=function(){var e=this,t=this.props.graphModel;this.editor=new db(".lf-label-editor",bc(Tb,{autoLink:!0,extensions:{colorPicker:new(kb(db))}})),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 db(".lf-label-editor",bc(Tb,{autoLink:!0,extensions:{colorPicker:new(kb(db))}})))},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=E(E([],w(i.nodes),!1),w(i.edges),!1);if(n.label){var o=[];return Eu(r,(function(t){var n,r;Eu(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 lb(n,t,i);r.set(a.id,a),o.push(Pf(ab,{label:a,element:t,graphModel:i},a.id))}))})),o}return null},n.prototype.render=function(){return Pf("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},n.toolName="label-edit-tool",n=m([t.observer],n)}(t.Component),Rb=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(Ob.toolName,Ob),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,v=n.properties,m=v._label,y=v._labelOption,b=m,x=void 0===y?{}:y,w=x.isMultiple,E=x.maxCount,C=[];if(it(b)){var N=null!=E?E:c;C=d&&w?b.length>N?b.slice(0,N):b:[b[0]]}else if(ft(b))C=[b];else if("string"==typeof b||!b){var _=g(g({},p),{content:b||(null==p?void 0:p.value),draggable:"edge"===n.BaseType?s:a});C=_.value?[_]:[]}return"edge"===n.BaseType&&(C=ed(C,(function(e){return e}))),ed(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,v=e.textOverflowMode,m="node"===n.BaseType?r:o,y="node"===n.BaseType?a:s;return g(g({},e),{zIndex:f,labelWidth:h,content:null!=l?l:i,vertical:null!=d&&d,editable:Boolean(m)&&c,draggable:Boolean(y)&&p,textOverflowMode:null!=v?v:u})}))},e.prototype.setupLabels=function(e){var t=this;Eu(e.sortElements,(function(n){t.rewriteInnerMethods(n);var i=t.formatConfig(e,n);n.setProperty("_label",i)}))},e.prototype.addLabel=function(e,n){var i,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},v={x:r.x,y:r.y,width:h,height:p},m=ed(d,(function(e){var t,n,i,r,o,a,s,l,u,d,c,h=e.x,p=e.y,m=(n=v,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 g(g({},e),m)}));o.setProperty("_label",m)}})),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=ed(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=jy(n,s,r);return g(g(g({},t),a),{rotate:i})}));n.setProperty("_label",l)})),i.on("node:dnd-add,node:add,edge:add",(function(t){var i=t.data,r=n.getElement(i.id);if(r){e.rewriteInnerMethods(r);var o=r.properties._label;if(!it(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=js(e.getProperties());if(it(u._label)){var d=ed(u._label,(function(e){return g(g({},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&&!Xd(o._label)&&i.textMode===t.TextMode.LABEL){var a=o._label.filter((function(e){return!e.isSelected}));if(!Kd(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&&!Xd(o._label)&&i.textMode===t.TextMode.LABEL){var a=o._label.filter((function(e){return!e.isSelected}));if(!Kd(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(Ob.toolName),this.lf.tool.disableTool("text-edit-tool")):e===t.TextMode.TEXT&&(this.lf.tool.enableTool("text-edit-tool"),this.lf.tool.disableTool(Ob.toolName)))},e.prototype.render=function(){},e.prototype.destroy=function(){},e.pluginName="label",e}(),Db={};function Pb(e){return e.startsWith("data:text/plain")}function Ib(e){return y(this,void 0,void 0,(function(){return b(this,(function(t){return Db[e]?[2,Db[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(Db[e]=r.result)},r.onerror=n,r.readAsDataURL(i)})).catch((function(){t(Db[e]=e)}))}catch(t){return Db[e]=e}}))]}))}))}function Lb(e,t){return y(this,void 0,void 0,(function(){var n,i;return b(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(n=e.getAttribute(t)||"").startsWith("data:")?[2]:[4,Ib(n)];case 1:return Pb(i=r.sent())?[2]:(e.setAttribute(t,i),[3,3]);case 2:return r.sent(),[3,3];case 3:return[2]}}))}))}function Bb(e,t){return y(this,void 0,void 0,(function(){var n;return b(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t.startsWith("data:")?[2]:[4,Ib(t)];case 1:return Pb(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 y(this,void 0,void 0,(function(){var t,n,i,r,o,a,s,l,u;return b(this,(function(d){switch(d.label){case 0:for(t=[e],i=[];t.length;)(n=t.shift()).children.length&&t.push.apply(t,E([],w(n.children),!1)),n instanceof HTMLElement&&(r=n.style,o=r.background,a=r.backgroundImage,(s=o.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(u=s[1],i.push(Bb(n,u))),(l=a.match(/url\(["']?(.*?)["']?\)/))&&l[1]&&(u=l[1],i.push(Bb(n,u)))),n instanceof HTMLImageElement?i.push(Lb(n,"src")):n instanceof SVGImageElement&&i.push(Lb(n,"href"));return[4,Promise.all(i)];case 1:return d.sent(),[2]}}))}))}function zb(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 Hb=function(){function e(e){var t=e.lf,n=this;this.lf=t,this.customCssRules="",this.useGlobalRules=!0,t.getSnapshot=function(e,t){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshot(e,t)];case 1:return[2,n.sent()]}}))}))},t.getSnapshotBlob=function(e,t,i){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBlob(e,t,i)];case 1:return[2,n.sent()]}}))}))},t.getSnapshotBase64=function(e,t,i){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBase64(e,t,i)];case 1:return[2,n.sent()]}}))}))}}return e.prototype.getSvgRootElement=function(e){return e.container.querySelector(".lf-canvas-overlay")},e.prototype.triggerDownload=function(e){var t=new MouseEvent("click",{view:document.defaultView,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",this.fileName),n.setAttribute("href",e),n.setAttribute("target","_blank"),n.dispatchEvent(t)},e.prototype.removeAnchor=function(e){for(var t=e.childNodes,n=e.childNodes&&e.childNodes.length,i=0;i<n;i++){var 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 y(this,void 0,void 0,(function(){return b(this,(function(t){return[2,new Promise((function(t,n){var i=new Image;i.crossOrigin="anonymous",i.onload=function(){var e=document.createElement("canvas");e.width=i.width,e.height=i.height;var n=e.getContext("2d");null==n||n.drawImage(i,0,0);var 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 y(this,void 0,void 0,(function(){var t,n,i,r,o,a,s,l,u,d;return b(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 y(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),b(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 y(this,void 0,void 0,(function(){var n,i,r,o,a,s,l,u,d,c,h,p,f,g,v,m,y,x,w,E,C,N,_,S,M,A,T,k,O,R,D,P,I,L,B;return b(this,(function(b){switch(b.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=b.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,x=v.TRANSLATE_X,w=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+_),A=Math.ceil(N+S),(T=document.createElement("canvas")).style.width="".concat(M,"px"),T.style.height="".concat(A,"px"),k=t.safetyMargin||0,O=M*l,R=A*l,(D=this.getCanvasScaleRatio(O,R))<1&&(O=Math.floor(O*D),R=Math.floor(R*D)),s.lastChild.style.transform="matrix(".concat(D,", 0, 0, ").concat(D,", ").concat((-p+x)*(1/m)*D+a+_/2+k,", ").concat((-f+w)*(1/y)*D+a+S/2+k,")"),T.width=O+2*(a+k)*l,T.height=R+2*(a+k)*l,(P=T.getContext("2d"))&&(P.clearRect(0,0,T.width,T.height),P.scale(l,l),r?(P.fillStyle=r,P.fillRect(0,0,T.width,T.height)):P.clearRect(0,0,T.width,T.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?zb(T,n,i).width:T.width,resizeHeight:n&&i?zb(T,n,i).height:T.height}).then((function(t){null==P||P.drawImage(t,0,0),e(n&&i?zb(T,n,i):T)})):(null==P||P.drawImage(I,0,0),e(n&&i?zb(T,n,i):T))}catch(t){null==P||P.drawImage(I,0,0),e(n&&i?zb(T,n,i):T)}};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 y(this,void 0,void 0,(function(){var n,i,r,o,a,s=this;return b(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 y(s,void 0,void 0,(function(){var i;return b(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 y(this,void 0,void 0,(function(){var n=this;return b(this,(function(i){switch(i.label){case 0:return[4,this.withExportPreparation((function(){return n.snapshot(e,t)}),t)];case 1:return i.sent(),[2]}}))}))},e.prototype.snapshot=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,a,s,l,u,d,c=this;return b(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 y(this,void 0,void 0,(function(){var i=this;return b(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 y(this,void 0,void 0,(function(){var i,r,o,a,s,l=this;return b(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,g({backgroundColor:n},null!=e?e:{})).then((function(e){e.toBlob((function(n){t({data:n,width:e.width,height:e.height})}),"image/".concat(null!=r?r:"png"))}))}))]}}))}))},e.prototype.getSnapshotBase64=function(e,t,n){return y(this,void 0,void 0,(function(){var i=this;return b(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 y(this,void 0,void 0,(function(){var i,r,o,a=this;return b(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,g({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}(),Fb=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=E([],w(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?[E(E([],w(i.slice(l)),!1),[a.id],!1)]:this.findPathElements(a,t,E([],w(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(E([],w(e.elements),!1),E([],w(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(_())},e.prototype.isLoopPath=function(e){var t=e.length;return e.indexOf(e[t-1])!==t-1?1:0},e.pluginName="flowPath",e}(),Wb=-1,Gb=0,Vb=1,Ub=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=g(g({},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(g({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 Gb:c.x=n.x+o/2,h.x=i.x-l/2;break;case Wb:c.y=n.y+a/2,h.x=i.x-l/2;break;case Vb: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}(),qb=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,ur(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(!tc(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(!tc(o)&&!tc(a)){var s={x:o,y:a},l=i.nodes;if(!tc(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(!tc(e)&&!Xd(e)){var r,o,a,s,l=e.anchors,u=void 0===l?[]:l,d=e.id;n.forEach((function(e){if(!Kd(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(!tc(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(!Kd(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(tc(this.closestNode)||tc(this.currentNode)||tc(this.closestAnchor)||tc(this.currentAnchor))return!1;if(tc(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?Kd(n,s)&&Kd(i,l)&&Kd(r,u)&&Kd(o,d):Kd(i,s)&&Kd(n,l)&&Kd(o,u)&&Kd(r,d)},e.prototype.addVirtualEdge=function(){var e=this,t=Hh(this.lf.graphModel.edges,(function(t,n){return n.virtual?t:t||e.sameEdgeIsExist(n)}),!1);if(!t){if(!tc(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(!Xd(o)&&!Xd(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(!tc(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=g(g({},this.virtualEdgeStyle),e)},e.prototype.setThresholdDistance=function(e){Qd(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}(),Xb=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"),E([],w(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,tc(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,E([],w(o),!1)),r},e.pluginName="control",e}(),Kb="lf:defaultNodeMenu",Yb="lf:defaultEdgeMenu",Qb="lf:defaultGraphMenu",Zb="lf:defaultSelectionMenu",$b={nodeMenu:Kb,edgeMenu:Yb,graphMenu:Qb,selectionMenu:Zb},Jb={nodeMenu:[],edgeMenu:[],graphMenu:[],selectionMenu:[]},ex=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;Jb.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(Kb,Jb.nodeMenu),Jb.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(Yb,Jb.edgeMenu),Jb.graphMenu=[],Jb.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(Zb,Jb.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,E([],w(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=$b[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,E([],w(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(Yb))&&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(Kb))&&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(Zb))&&void 0!==l?l:[]:null!==(d=null===(u=this.menuTypeMap)||void 0===u?void 0:u.get(Qb))&&void 0!==d?d:[];f&&f.length>0?(this.__menuDOM.innerHTML="",(e=this.__menuDOM).append.apply(e,E([],w(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($b[e]))&&void 0!==n?n:[]},e.prototype.resetMenuConfigByType=function(e){var t;this.setMenuConfig(((t={})[e]=Jb[e],t))},e.prototype.resetAllMenuConfig=function(){this.setMenuConfig(Jb)},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($b[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(Kb)),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(Yb))&&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(Qb))&&void 0!==i?i:[],a=r.domOverlayPosition,s=a.x,l=a.y;n.__currentData=g({},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(Zb),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}(),tx="menu-common",nx=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(tx,[]),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(tx,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=E(E([],w(this.menuTypeMap.get(this._activeData.type)||[]),!1),w(this.menuTypeMap.get(tx)||[]),!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=w(e,2),n=t[0],i=t[1];this.__menuDOM.style.display="flex",this.__menuDOM.style.top="".concat(i,"px"),this.__menuDOM.style.left="".concat(n+10,"px"),this.container.appendChild(this.__menuDOM),!this.isShow&&this.lf.on("node:delete,edge:delete,node:drag,graph:transform",this.listenDelete),this.isShow=!0}},e.pluginName="contextMenu",e}(),ix=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}(),rx=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=x(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,w=p-(this.height/y-g)/2;if(this.lfMap.graphModel.transformModel.translate(-b+this.translateX,-w+this.translateY),this.translateX=b,this.translateY=w,this.miniMapWrap.firstChild){var E=this.miniMapWrap.firstChild.style;E.pointerEvents="none",E.transform="matrix(".concat(y,", 0, 0, ").concat(y,", 0, 0)"),E.transformOrigin="left top",E.height="".concat(this.height/y,"px"),E.width="".concat(this.width/y,"px"),this.updateViewPort()}},e.prototype.updateViewPort=function(){var e=this.viewport.style,t=this.lf.getTransform(),n=t.TRANSLATE_X,i=t.TRANSLATE_Y,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}(),ox=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=js(r.startPoint),s=js(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(E(E([],w(m.nodes.map((function(e){return e.id}))),!1),w(m.edges.map((function(e){return e.id}))),!1));h.forEach((function(e){if(g){var t=g.getNodeGroup(e.id);if(h.includes(t))return}if(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=js(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}(),ax=function(e,t){var n=[],i=[],r=function(e,i,o){e&&(o&&i.unshift.apply(i,E([],w(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,E([],w(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,[]),E([],w(new Set(E(E([],w(n.flat()),!1),w(i.flat()),!1))),!1)},sx=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;zs(o,l).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),zs(a,u).forEach((function(e){e.updateStyles(t.tempStyles[e.id])})),i=Up(zs(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 ax("node"===(null==n?void 0:n.BaseType)?n:null==n?void 0:n.targetNode,t)}(e,this.lf),i=[];n.forEach((function(e){var n=t.lf.getModelById(e);null==n||n.updateStyles(t.tempStyles[e]),i.push(n)})),this.lf.emit("highlight:path",{data:this.lf.getModelById(e),relateElements:i})},e.prototype.highlight=function(e,t){var n=this;(void 0===t&&(t=this.mode),this.enable)&&(Object.keys(this.tempStyles).length&&this.restoreHighlight(),Object.values(this.lf.graphModel.modelsMap).forEach((function(e){var t="node"===e.BaseType?e.getNodeStyle():e.getEdgeStyle();n.tempStyles[e.id]=g({},t),e.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),neighbour:this.highlightNeighbours.bind(this),path:this.highlightPath.bind(this)}[t](e))},e.prototype.restoreHighlight=function(){var e=this;Object.keys(this.tempStyles).length&&(Object.values(this.lf.graphModel.modelsMap).forEach((function(t){var n,i=null!==(n=e.tempStyles[t.id])&&void 0!==n?n:{};t.updateStyles(g({},i))})),this.tempStyles={})},e.prototype.render=function(){var e=this;this.lf.on("node:mouseenter",(function(t){var n=t.data;return e.highlight(n.id)})),this.lf.on("edge:mouseenter",(function(t){var n=t.data;return e.highlight(n.id)})),this.lf.on("node:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("edge:mouseleave",this.restoreHighlight.bind(this)),this.lf.on("history:change",this.restoreHighlight.bind(this))},e.prototype.destroy=function(){},e.pluginName="highlight",e}(),lx={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function ux(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=lx[u]||"-",c="";if("-"===d)c+="L ".concat(t[0]," ").concat(t[1]);else{var h=w(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=w(f,2),t[0]=r[0],t[1]=r[1])}return c}function dx(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+=ux(e[n-1],e[n],e[1+n++],t)}i+="L ".concat(e[n][0]," ").concat(e[n][1])}return i}var cx=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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=w(t[n-1],2),r=i[0],o=i[1],a=w(t[n],2),s=a[0],l=a[1],u=w(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=dx(u,a),c=g(g(g({style:i?l:{}},s),r),{fill:"none"});return t.h("path",g({d:d},c))},n}(t.PolylineEdge),hx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t}(t.PolylineEdgeModel),px=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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",g(g({},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),fx=function(e){function t(){var t=e.apply(this,E([],w(arguments),!1))||this;return t.d=10,t.isResize=!1,t}return f(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&&(mx(c)?u.has(c.id)||(u.add(c.id),s.push.apply(s,E([],w(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),gx="node-selection",vx=function(){function e(e){var t=e.lf;this.selectNodes=[],this.d=10,this.lf=t,t.register({type:gx,view:px,model:fx})}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=zr(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!!mx(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!==gx){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),mx(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 mx(n)||t.onNodeChange(e,n),!0}))},e.pluginName="node-selection",e}(),mx=function(e){return!(!e||e.type!==gx)},yx=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(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",g(g({},a),{fill:"#FFFFFF",x:n-r/2,y:i-o/2})),this.getLabelShape()])},n}(t.RectNode),bx={pluginName:"rectLabelNode",install:function(e){e.register({type:"rect-label",model:t.RectNodeModel,view:yx})}};e.AutoLayout=Ub,e.BPMNAdapter=Qg,e.BPMNBaseAdapter=Yg,e.BPMNElements=lg,e.BoundaryEventFactory=Ee,e.BpmnAdapter=he,e.BpmnElement=V,e.BpmnXmlAdapter=pe,e.ContextMenu=nx,e.Control=Xb,e.CurvedEdge=cx,e.CurvedEdgeModel=hx,e.DiamondResize=Gf,e.DiamondResizeModel=Ff,e.DiamondResizeView=Wf,e.DndPanel=ix,e.DynamicGroup=Gy,e.DynamicGroupNode=zy,e.DynamicGroupNodeModel=ky,e.EllipseResize=Hf,e.EllipseResizeModel=jf,e.EllipseResizeView=zf,e.EndEventFactory=be,e.EndEventModel=T,e.EndEventView=k,e.ExclusiveGatewayModel=I,e.ExclusiveGatewayView=L,e.FlowPath=Fb,e.GatewayNodeFactory=Ie,e.Group=tg,e.GroupNode=$f,e.GroupNodeModel=Zf,e.Highlight=sx,e.HtmlResize=qf,e.HtmlResizeModel=Vf,e.HtmlResizeView=Uf,e.InsertNodeInPolyline=nb,e.IntermediateCatchEventFactory=xe,e.IntermediateThrowEventFactory=Ce,e.Label=Rb,e.LaneNode=Ky,e.Menu=ex,e.MiniMap=rx,e.NodeResize=Qf,e.NodeSelection=vx,e.PoolElements=Yy,e.PoolNode=Xy,e.ProximityConnect=qb,e.RectLabelNode=bx,e.RectResize=Yf,e.RectResizeModel=Xf,e.RectResizeView=Kf,e.SelectionSelect=ox,e.SequenceFlowModel=R,e.SequenceFlowView=D,e.ServiceTaskModel=j,e.ServiceTaskView=z,e.Snapshot=Hb,e.StartEventFactory=we,e.StartEventModel=S,e.StartEventView=M,e.SubProcessFactory=ng,e.TaskNodeFactory=Be,e.UserTaskModel=F,e.UserTaskView=W,e.bpmnUtils=ye,e.convertNormalToXml=Wg,e.convertXmlToNormal=Gg,e.dynamicGroup=Fy,e.escapeXml=Q,e.gateway={exclusive:0,inclusive:1,parallel:2},e.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],e.getCurvedEdgePath=dx,e.handleAttributes=Y,e.icons=Pe,e.lfJson2Xml=J,e.lfXml2Json=ne,e.multiInstanceIcon=Le,e.sequenceFlowFactory=rg,e.toLogicflowData=function(e){var t={nodes:[],edges:[]},n=e.flowElementList;return n&&n.length>0&&n.forEach((function(e){if(e.type===Zg.SEQUENCE_FLOW){var n=function(e){var t=e.incoming,n=e.outgoing,i=e.properties,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:$g[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=w(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:$g[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=se,e.toTurboData=function(e){var t=new Map,n={flowElementList:[]};return e.nodes.forEach((function(e){var i=function(e){var t=e.id,n=e.type,i=e.x,r=e.y,o=e.text,a=void 0===o?"":o,s=e.properties;return{incoming:[],outgoing:[],dockers:[],type:Jg(n),properties:g(g({},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:Jg(n),dockers:[],properties:g(g({},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=ae,e.useDefinition=sg}));
|
|
2
2
|
//# sourceMappingURL=index.min.js.map
|