@logicflow/extension 2.0.0-beta.5 → 2.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +871 -20
- package/dist/index.css +63 -0
- package/dist/index.min.js +18 -2
- package/es/NodeResize/control/Control.js +3 -2
- package/es/NodeResize/control/Control.js.map +1 -1
- package/es/components/mini-map/index.js +2 -2
- package/es/components/mini-map/index.js.map +1 -1
- package/es/components/selection-select/index.js.map +1 -1
- package/es/index.css +63 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/materials/group/GroupNode.d.ts +6 -6
- package/es/materials/group/GroupNode.js +7 -6
- package/es/materials/group/GroupNode.js.map +1 -1
- package/es/materials/group/index.js +20 -25
- package/es/materials/group/index.js.map +1 -1
- package/es/style/index.css +63 -0
- package/es/style/index.less +73 -0
- package/es/style/raw.d.ts +1 -1
- package/es/style/raw.js +1 -1
- package/es/style/raw.js.map +1 -1
- package/es/tools/flow-path/index.js +0 -1
- package/es/tools/flow-path/index.js.map +1 -1
- package/es/tools/label/Label.d.ts +30 -0
- package/es/tools/label/Label.js +241 -0
- package/es/tools/label/Label.js.map +1 -0
- package/es/tools/label/LabelModel.d.ts +26 -0
- package/es/tools/label/LabelModel.js +86 -0
- package/es/tools/label/LabelModel.js.map +1 -0
- package/es/tools/label/LabelOverlay.d.ts +28 -0
- package/es/tools/label/LabelOverlay.js +161 -0
- package/es/tools/label/LabelOverlay.js.map +1 -0
- package/es/tools/label/algorithm.d.ts +16 -0
- package/es/tools/label/algorithm.js +27 -0
- package/es/tools/label/algorithm.js.map +1 -0
- package/es/tools/label/index.d.ts +59 -0
- package/es/tools/label/index.js +292 -0
- package/es/tools/label/index.js.map +1 -0
- package/es/tools/label/mediumEditor.d.ts +16 -0
- package/es/tools/label/mediumEditor.js +91 -0
- package/es/tools/label/mediumEditor.js.map +1 -0
- package/es/tools/label/utils.d.ts +64 -0
- package/es/tools/label/utils.js +336 -0
- package/es/tools/label/utils.js.map +1 -0
- package/es/tools/snapshot/index.js +0 -2
- package/es/tools/snapshot/index.js.map +1 -1
- package/lib/NodeResize/control/Control.js +3 -2
- package/lib/NodeResize/control/Control.js.map +1 -1
- package/lib/components/mini-map/index.js +2 -2
- package/lib/components/mini-map/index.js.map +1 -1
- package/lib/components/selection-select/index.js.map +1 -1
- package/lib/index.css +63 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/materials/group/GroupNode.d.ts +6 -6
- package/lib/materials/group/GroupNode.js +7 -6
- package/lib/materials/group/GroupNode.js.map +1 -1
- package/lib/materials/group/index.js +19 -24
- package/lib/materials/group/index.js.map +1 -1
- package/lib/style/index.css +63 -0
- package/lib/style/index.less +73 -0
- package/lib/style/raw.d.ts +1 -1
- package/lib/style/raw.js +1 -1
- package/lib/style/raw.js.map +1 -1
- package/lib/tools/flow-path/index.js +0 -1
- package/lib/tools/flow-path/index.js.map +1 -1
- package/lib/tools/label/Label.d.ts +30 -0
- package/lib/tools/label/Label.js +247 -0
- package/lib/tools/label/Label.js.map +1 -0
- package/lib/tools/label/LabelModel.d.ts +26 -0
- package/lib/tools/label/LabelModel.js +89 -0
- package/lib/tools/label/LabelModel.js.map +1 -0
- package/lib/tools/label/LabelOverlay.d.ts +28 -0
- package/lib/tools/label/LabelOverlay.js +167 -0
- package/lib/tools/label/LabelOverlay.js.map +1 -0
- package/lib/tools/label/algorithm.d.ts +16 -0
- package/lib/tools/label/algorithm.js +32 -0
- package/lib/tools/label/algorithm.js.map +1 -0
- package/lib/tools/label/index.d.ts +59 -0
- package/lib/tools/label/index.js +298 -0
- package/lib/tools/label/index.js.map +1 -0
- package/lib/tools/label/mediumEditor.d.ts +16 -0
- package/lib/tools/label/mediumEditor.js +97 -0
- package/lib/tools/label/mediumEditor.js.map +1 -0
- package/lib/tools/label/utils.d.ts +64 -0
- package/lib/tools/label/utils.js +349 -0
- package/lib/tools/label/utils.js.map +1 -0
- package/lib/tools/snapshot/index.js +0 -2
- package/lib/tools/snapshot/index.js.map +1 -1
- package/package.json +9 -7
- package/src/NodeResize/control/Control.tsx +3 -2
- package/src/components/mini-map/index.ts +2 -2
- package/src/components/selection-select/index.ts +5 -1
- package/src/index.ts +1 -0
- package/src/materials/group/GroupNode.ts +11 -8
- package/src/materials/group/index.ts +33 -38
- package/src/style/index.less +73 -0
- package/src/style/raw.ts +64 -1
- package/src/tools/flow-path/index.ts +0 -1
- package/src/tools/label/Label.tsx +297 -0
- package/src/tools/label/LabelModel.ts +82 -0
- package/src/tools/label/LabelOverlay.tsx +159 -0
- package/src/tools/label/algorithm.ts +42 -0
- package/src/tools/label/index.ts +401 -0
- package/src/tools/label/mediumEditor.ts +93 -0
- package/src/tools/label/utils.ts +395 -0
- package/src/tools/snapshot/README.md +27 -16
- package/src/tools/snapshot/index.ts +0 -2
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@logicflow/core")):"function"==typeof define&&define.amd?define(["exports","@logicflow/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Extension={},t.Core)}(this,(function(t,e){"use strict";var n=40,r=40,i=40,o=40,a=40,u=40,s=100,l=80,c=100,d=80,h={rect:{radius:5,stroke:"rgb(24, 125, 255)"},circle:{r:18,stroke:"rgb(24, 125, 255)"},polygon:{stroke:"rgb(24, 125, 255)"},polyline:{stroke:"rgb(24, 125, 255)",hoverStroke:"rgb(24, 125, 255)",selectedStroke:"rgb(24, 125, 255)"},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"white",height:14,stroke:"transparent",radius:3}}},p=function(t,e){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},p(t,e)};function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return v=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},v.apply(this,arguments)};function g(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function y(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))}function m(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){a.label=u[1];break}if(6===u[0]&&a.label<i[1]){a.label=i[1],i=u;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(u);break}i[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}function b(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function _(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var w=function(){function t(){globalThis._ids=this,this._ids=new Set}return t.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))},t.prototype.next=function(){for(var t=this.generateId();this._ids.has(t);)t=this.generateId();return this._ids.add(t),t},t}(),M=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new w;function E(){return M.next()}var N=function(t){function e(e,n){return e.id||(e.id="Event_".concat(E())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40}),t.call(this,e,n)||this}return f(e,t),e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedTargetRules=function(){var e=t.prototype.getConnectedTargetRules.call(this);return e.push({message:"起始节点不能作为边的终点",validate:function(){return!1}}),e},e.extendKey="StartEventModel",e}(e.CircleNodeModel),S=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.extendKey="StartEventNode",e}(e.CircleNode),A={type:"bpmn:startEvent",view:S,model:N},P=function(t){function e(e,n){return e.id||(e.id="Event_".concat(E())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40}),t.call(this,e,n)||this}return f(e,t),e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedSourceRules=function(){var e=t.prototype.getConnectedSourceRules.call(this);return e.push({message:"结束节点不能作为边的起点",validate:function(){return!1}}),e},e.extendKey="EndEventModel",e}(e.CircleNodeModel),T=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},n.prototype.getShape=function(){var n=this.props.model,r=n.getNodeStyle(),i=n,o=i.x,a=i.y,u=i.r,s=t.prototype.getShape.call(this);return e.h("g",{},s,e.h("circle",v(v({},r),{cx:o,cy:a,r:u-5})))},n.extendKey="EndEventView",n}(e.CircleNode),k={type:"bpmn:endEvent",view:T,model:P},C=function(t){function e(e,n){return e.id||(e.id="Flow_".concat(E())),t.call(this,e,n)||this}return f(e,t),e.extendKey="SequenceFlowModel",e}(e.PolylineEdgeModel),O=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.extendKey="SequenceFlowEdge",e}(e.PolylineEdge),I={type:"bpmn:sequenceFlow",view:O,model:C},j=function(t){function e(e,n){var r=this;return e.id||(e.id="Gateway_".concat(E())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40}),(r=t.call(this,e,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],r}return f(e,t),e.extendKey="ExclusiveGatewayModel",e}(e.PolygonNodeModel),R=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getShape=function(){var t=this.props.model,n=t,r=n.x,i=n.y,o=n.width,a=n.height,u=n.points,s=t.getNodeStyle();return e.h("g",{transform:"matrix(1 0 0 1 ".concat(r-o/2," ").concat(i-a/2,")")},e.h("polygon",v(v({},s),{x:r,y:i,points:u})),e.h("path",v({d:"m 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z"},s)))},n.extendKey="ExclusiveGatewayNode",n}(e.PolygonNode),D={type:"bpmn:exclusiveGateway",view:R,model:j},L=function(t){function e(e,n){return e.id||(e.id="Activity_".concat(E())),t.call(this,e,n)||this}return f(e,t),e.extendKey="ServiceTaskModel",e}(e.RectNodeModel),B=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getLabelShape=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.getNodeStyle();return e.h("svg",{x:n-i/2+5,y:r-o/2+5,width:30,height:30,viewBox:"0 0 1274 1024"},e.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 t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.radius,u=t.getNodeStyle();return e.h("g",{},[e.h("rect",v({x:n-i/2,y:r-o/2,rx:a,ry:a,width:i,height:o},u)),this.getLabelShape()])},n.extendKey="ServiceTaskNode",n}(e.RectNode),z={type:"bpmn:serviceTask",view:B,model:L},W=function(t){function e(e,n){return e.id||(e.id="Activity_".concat(E())),t.call(this,e,n)||this}return f(e,t),e.extendKey="UserTaskModel",e}(e.RectNodeModel),F=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getLabelShape=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.getNodeStyle();return e.h("svg",{x:n-i/2+5,y:r-o/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},e.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 t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.radius,u=t.getNodeStyle();return e.h("g",{},[e.h("rect",v(v({},u),{x:n-i/2,y:r-o/2,rx:a,ry:a,width:i,height:o})),this.getLabelShape()])},n.extendKey="UserTaskNode",n}(e.RectNode),G={type:"bpmn:userTask",view:F,model:W},H={pluginName:"bpmnElement",install:function(t){t.setTheme(h),t.register(A),t.register(k),t.register(D),t.register(G),t.register(z),t.options.customBpmnEdge||(t.register(I),t.setDefaultEdgeType("bpmn:sequenceFlow"))}},X=function(){function t(){globalThis._ids=this,this._ids=new Set}return t.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))},t.prototype.next=function(){for(var t=this.generateId();this._ids.has(t);)t=this.generateId();return this._ids.add(t),t},t}(),U=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new X;function V(){return U.next()}function q(t){return Object.prototype.toString.call(t)}function Y(t){var e=t;return"[object Object]"===q(t)?(e={},Object.keys(t).forEach((function(n){var r=n;"-"===n.charAt(0)&&(r=n.substring(1)),e[r]=Y(t[n])}))):Array.isArray(t)&&(e=[],t.forEach((function(t,n){e[n]=Y(t)}))),e}var Z="\t\n";function K(t,e,n){var r=function(t){return" ".repeat(t)}(n),i="";if("#text"===e)return Z+r+t;if("#cdata-section"===e)return Z+r+"<![CDATA["+t+"]]>";if("#comment"===e)return Z+r+"\x3c!--"+t+"--\x3e";if("-"==="".concat(e).charAt(0))return" "+e.substring(1)+'="'+function(t){var e=t;try{"string"!=typeof e&&(e=JSON.parse(t))}catch(n){e=JSON.stringify(Y(t)).replace(/"/g,"'")}return e}(t)+'"';if(Array.isArray(t))t.forEach((function(t){i+=K(t,e,n+1)}));else if("[object Object]"===q(t)){var o=Object.keys(t),a="",u="";i+=(0===n?"":Z+r)+"<"+e,o.forEach((function(e){"-"===e.charAt(0)?a+=K(t[e],e,n+1):u+=K(t[e],e,n+1)})),i+=a+(""!==u?">".concat(u).concat(Z+r,"</").concat(e,">"):" />")}else i+=Z+r+"<".concat(e,">").concat(t.toString(),"</").concat(e,">");return i}function $(t){var e="";for(var n in t)e+=K(t[n],n,0);return e}var J=function(){};(J.ObjTree=function(){return this}).VERSION="0.23",J.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',J.ObjTree.prototype.attr_prefix="-",J.ObjTree.prototype.parseXML=function(t){var e;if(window.DOMParser){var n=new DOMParser,r=n.parseFromString(t,"application/xml");if(!r)return;e=r.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(t),e=n.documentElement);if(e)return this.parseDOM(e)},J.ObjTree.prototype.parseHTTP=function(t,e,n){var r,i={};for(var o in e)i[o]=e[o];if(i.method||(void 0===i.postBody&&void 0===i.postbody&&void 0===i.parameters?i.method="get":i.method="post"),n){i.asynchronous=!0;var a=this,u=n,s=i.onComplete;i.onComplete=function(t){var e;t&&t.responseXML&&t.responseXML.documentElement&&(e=a.parseDOM(t.responseXML.documentElement)),u(e,t),s&&s(t)}}else i.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)i.uri=t,(l=new HTTP.Request(i))&&(r=l.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var l;(l=new Ajax.Request(t,i))&&(r=l.transport)}return n?r:r&&r.responseXML&&r.responseXML.documentElement?this.parseDOM(r.responseXML.documentElement):void 0},J.ObjTree.prototype.parseDOM=function(t){if(t){if(this.__force_array={},this.force_array)for(var e=0;e<this.force_array.length;e++)this.__force_array[this.force_array[e]]=1;var n=this.parseElement(t);if(this.__force_array[t.nodeName]&&(n=[n]),11!=t.nodeType){var r={};r[t.nodeName]=n,n=r}return n}},J.ObjTree.prototype.parseElement=function(t){if(7!=t.nodeType){if(3==t.nodeType||4==t.nodeType||8==t.nodeType){if(null==t.nodeValue.match(/[^\x00-\x20]/))return;return t.nodeValue}var e=null,n={};if(t.attributes&&t.attributes.length){e={};for(var r=0;r<t.attributes.length;r++){if("string"==typeof(u=t.attributes[r].nodeName)){var i=t.attributes[r].nodeValue;try{i=JSON.parse(t.attributes[r].nodeValue.replace(/'/g,'"'))}catch(e){i=t.attributes[r].nodeValue}i&&(void 0===n[u=this.attr_prefix+u]&&(n[u]=0),n[u]++,this.addNode(e,u,n[u],i))}}}if(t.childNodes&&t.childNodes.length){var o=!0;e&&(o=!1);for(r=0;r<t.childNodes.length&&o;r++){var a=t.childNodes[r].nodeType;3!=a&&4!=a&&8!=a&&(o=!1)}if(o){e||(e="");for(r=0;r<t.childNodes.length;r++)e+=t.childNodes[r].nodeValue}else{e||(e={});for(r=0;r<t.childNodes.length;r++){var u;if("string"==typeof(u=t.childNodes[r].nodeName))(i=this.parseElement(t.childNodes[r]))&&(void 0===n[u]&&(n[u]=0),n[u]++,this.addNode(e,u,n[u],i))}}}else null===e&&(e={});return e}},J.ObjTree.prototype.addNode=function(t,e,n,r){this.__force_array[e]?(1==n&&(t[e]=[]),t[e][t[e].length]=r):1==n?t[e]=r:2==n?t[e]=[t[e],r]:t[e][t[e].length]=r},J.ObjTree.prototype.writeXML=function(t){var e=this.hash_to_xml(null,t);return this.xmlDecl+e},J.ObjTree.prototype.hash_to_xml=function(t,e){var n=[],r=[];for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];i.charAt(0)!=this.attr_prefix?void 0===o||null==o?n[n.length]="<"+i+" />":"object"==typeof o&&o.constructor==Array?n[n.length]=this.array_to_xml(i,o):n[n.length]="object"==typeof o?this.hash_to_xml(i,o):this.scalar_to_xml(i,o):r[r.length]=" "+i.substring(1)+'="'+this.xml_escape(o)+'"'}var a=r.join(""),u=n.join("");return void 0===t||null==t||(u=n.length>0?u.match(/\n/)?"<"+t+a+">\n"+u+"</"+t+">\n":"<"+t+a+">"+u+"</"+t+">\n":"<"+t+a+" />\n"),u},J.ObjTree.prototype.array_to_xml=function(t,e){for(var n=[],r=0;r<e.length;r++){var i=e[r];void 0===i||null==i?n[n.length]="<"+t+" />":"object"==typeof i&&i.constructor==Array?n[n.length]=this.array_to_xml(t,i):n[n.length]="object"==typeof i?this.hash_to_xml(t,i):this.scalar_to_xml(t,i)}return n.join("")},J.ObjTree.prototype.scalar_to_xml=function(t,e){return"#text"==t?this.xml_escape(e):"<"+t+">"+this.xml_escape(e)+"</"+t+">\n"},J.ObjTree.prototype.xml_escape=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};var Q,tt=function(t){return(new J.ObjTree).parseXML(t)};!function(t){t.START="bpmn:startEvent",t.END="bpmn:endEvent",t.GATEWAY="bpmn:exclusiveGateway",t.USER="bpmn:userTask",t.SYSTEM="bpmn:serviceTask",t.FLOW="bpmn:sequenceFlow"}(Q||(Q={}));var et=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef"],nt=["properties","startPoint","endPoint","pointsList"];function rt(t){var e=t?nt.concat(t):nt;return function(t){return function t(n){var r={};return"string"==typeof n?n:Array.isArray(n)?n.map((function(e){return t(e)})):(Object.entries(n).forEach((function(n){var i=x(n,2),o=i[0],a=i[1];"object"!=typeof a?0===o.indexOf("-")||["#text","#cdata-section","#comment"].includes(o)?r[o]=a:r["-".concat(o)]=a:e.includes(o)?r["-".concat(o)]=t(a):r[o]=t(a)})),r)}(t)}}function it(t){var e={};return Object.entries(t).forEach((function(t){var n=x(t,2),r=n[0],i=n[1];0===r.indexOf("-")?e[r.substring(1)]=Y(i):"string"==typeof i?e[r]=i:"[object Object]"===Object.prototype.toString.call(i)?e[r]=it(i):Array.isArray(i)?e[r]=i.map((function(t){return it(t)})):e[r]=i})),e}function ot(t,e){t["bpmndi:BPMNEdge"]=e.edges.map((function(t){var e,n=t.id,r=t.pointsList.map((function(t){return{"-x":t.x,"-y":t.y}})),i={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":r};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(i["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),i})),t["bpmndi:BPMNShape"]=e.nodes.map((function(t){var e,n=t.id,r=100,i=80,o=t.x,a=t.y,u=lt.shapeConfigMap.get(t.type);u&&(r=u.width,i=u.height),o-=r/2,a-=i/2;var s={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":o,"-y":a,"-width":r,"-height":i}};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(s["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),s}))}function at(t){var e=[],n=[],r=t["bpmn:definitions"];if(r){var i=r["bpmn:process"];Object.keys(i).forEach((function(t){if(0===t.indexOf("bpmn:")){var o=i[t];if(t===Q.FLOW){var a=r["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNEdge"];n=function(t,e){var n=[];if(Array.isArray(t))t.forEach((function(t){var r;r=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(st(r,t))}));else{var r=void 0;r=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(st(r,t))}return n}(o,a)}else{var u=r["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];e=e.concat(function(t,e,n){var r=[];if(Array.isArray(t))t.forEach((function(t){var i=ut(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);r.push(i)}));else{var i=ut(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);r.push(i)}return r}(o,u,t))}}}))}return{nodes:e,edges:n}}function ut(t,e,n){var r,i,o=Number(t["dc:Bounds"]["-x"]),a=Number(t["dc:Bounds"]["-y"]),u=n["-name"],s=lt.shapeConfigMap.get(e);if(s&&(o+=s.width/2,a+=s.height/2),Object.entries(n).forEach((function(t){var e=x(t,2),n=e[0],i=e[1];-1===et.indexOf(n)&&(r||(r={}),r[n]=i)})),r&&(r=it(r)),u&&(i={x:o,y:a,value:u},t["bpmndi:BPMNLabel"]&&t["bpmndi:BPMNLabel"]["dc:Bounds"])){var l=t["bpmndi:BPMNLabel"]["dc:Bounds"];i.x=Number(l["-x"])+Number(l["-width"])/2,i.y=Number(l["-y"])+Number(l["-height"])/2}var c={id:t["-bpmnElement"],type:e,x:o,y:a,properties:r};return i&&(c.text=i),c}function st(t,e){var n,r,i=e["-name"];if(i){var o=t["bpmndi:BPMNLabel"]["dc:Bounds"],a=0;i.split("\n").forEach((function(t){a<t.length&&(a=t.length)})),n={value:i,x:Number(o["-x"])+10*a/2,y:Number(o["-y"])+7}}Object.entries(e).forEach((function(t){var e=x(t,2),n=e[0],i=e[1];-1===et.indexOf(n)&&(r||(r={}),r[n]=i)})),r&&(r=it(r));var u={id:e["-id"],type:Q.FLOW,pointsList:t["di:waypoint"].map((function(t){return{x:Number(t["-x"]),y:Number(t["-y"])}})),sourceNodeId:e["-sourceRef"],targetNodeId:e["-targetRef"],properties:r};return n&&(u.text=n),u}var lt=function(){function t(t){var e=t.lf,n=this;this.adapterOut=function(t,e){var r=v({},n.processAttributes);!function(t,e,n){var r=new Map;e.nodes.forEach((function(e){var i,o={"-id":e.id};if((null===(i=e.text)||void 0===i?void 0:i.value)&&(o["-name"]=e.text.value),e.properties){var a=rt(n)(e.properties);Object.assign(o,a)}r.set(e.id,o),t[e.type]?Array.isArray(t[e.type])?t[e.type].push(o):t[e.type]=[t[e.type],o]:t[e.type]=o}));var i=e.edges.map((function(t){var e,i,o=r.get(t.targetNodeId);o["bpmn:incoming"]?Array.isArray(o["bpmn:incoming"])?o["bpmn:incoming"].push(t.id):o["bpmn:incoming"]=[o["bpmn:incoming"],t.id]:o["bpmn:incoming"]=t.id;var a={"-id":t.id,"-sourceRef":t.sourceNodeId,"-targetRef":t.targetNodeId};if((null===(e=t.text)||void 0===e?void 0:e.value)&&(a["-name"]=null===(i=t.text)||void 0===i?void 0:i.value),t.properties){var u=rt(n)(t.properties);Object.assign(a,u)}return a}));e.edges.forEach((function(t){var e=r.get(t.sourceNodeId);e["bpmn:outgoing"]?Array.isArray(e["bpmn:outgoing"])?e["bpmn:outgoing"].push(t.id):e["bpmn:outgoing"]=[e["bpmn:outgoing"],t.id]:e["bpmn:outgoing"]=t.id})),t[Q.FLOW]=i}(r,t,e);var i={"-id":"BPMNPlane_1","-bpmnElement":r["-id"]};ot(i,t);var o=n.definitionAttributes;return o["bpmn:process"]=r,o["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":i},{"bpmn:definitions":o}},this.adapterIn=function(t){if(t)return at(t)},e.adapterIn=function(t){return n.adapterIn(t)},e.adapterOut=function(t,e){return n.adapterOut(t,e)},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 t.prototype.setCustomShape=function(e,n){t.shapeConfigMap.set(e,n)},t.pluginName="bpmn-adapter",t.shapeConfigMap=new Map,t}();lt.shapeConfigMap.set(Q.START,{width:n,height:r}),lt.shapeConfigMap.set(Q.END,{width:i,height:o}),lt.shapeConfigMap.set(Q.GATEWAY,{width:a,height:u}),lt.shapeConfigMap.set(Q.SYSTEM,{width:s,height:l}),lt.shapeConfigMap.set(Q.USER,{width:c,height:d});var ct=function(t){function e(e){var n=t.call(this,e)||this;n.adapterXmlIn=function(t){var e=tt(t);return n.adapterIn(e)},n.adapterXmlOut=function(t,e){return $(n.adapterOut(t,e))};var r=e.lf;return r.adapterIn=n.adapterXmlIn,r.adapterOut=n.adapterXmlOut,n}return f(e,t),e.pluginName="bpmnXmlAdapter",e}(lt);function dt(){this.targetRules.push({message:"分组外的节点不允许连接分组内的",validate:function(t,e){var n=!!t.properties.parent,r=!!e.properties.parent;return!(!n&&r)}})}var ht=function(){function t(){globalThis._ids=this,this._ids=new Set}return t.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))},t.prototype.next=function(){for(var t=this.generateId();this._ids.has(t);)t=this.generateId();return this._ids.add(t),t},t}(),pt=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new ht;function ft(){return pt.next()}var vt=Object.freeze({__proto__:null,genBpmnId:ft,groupRule:dt});function gt(t){var n=x(t.useDefinition(),1)[0],r=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return f(r,t),r.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},r.prototype.getShape=function(){var r,i=this.props.model,o=i.getNodeStyle(),a=i,u=a.x,s=a.y,l=a.r,c=a.width,d=a.height,h=a.properties,p=t.prototype.getShape.call(this),f=h.definitionType,g=((null===(r=n.endEvent)||void 0===r?void 0:r.get(f))||{}).icon,y=Array.isArray(g)?e.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(u-c/2," ").concat(s-d/2,")")}],x(g),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(u-c/2," ").concat(s-d/2,")"),d:g,style:"fill: black; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;"});return e.h("g",{},p,e.h("circle",v(v({},o),{strokeWidth:2,cx:u,cy:s,r:l-2})),y)},r}(e.CircleNode),i=function(t){function e(e,r){var i,o,a,u;e.id||(e.id="Event_".concat(ft())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var s=((null===(o=n.endEvent)||void 0===o?void 0:o.get(null===(a=e.properties)||void 0===a?void 0:a.definitionType))||{}).properties,l=void 0===s?{}:s;return e.properties=v(v({},l),e.properties),(null===(u=e.properties)||void 0===u?void 0:u.definitionType)&&(e.properties.definitionId="Definition_".concat(ft())),i=t.call(this,e,r)||this,dt.call(i),i}return f(e,t),e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedSourceRules=function(){var e=this,n=t.prototype.getConnectedSourceRules.call(this),r={message:"结束节点不能作为边的起点",validate:function(t,n){return console.log("_target",n),t!==e}};return n.push(r),n},e}(e.CircleNodeModel);return{type:"bpmn:endEvent",view:r,model:i}}function yt(t){var n=x(t.useDefinition(),1)[0],r=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return f(r,t),r.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},r.prototype.getShape=function(){var t,r=this.props.model,i=r.getNodeStyle(),o=r,a=o.x,u=o.y,s=o.r,l=o.width,c=o.height,d=o.properties.definitionType,h=((null===(t=n.intermediateCatchEvent)||void 0===t?void 0:t.get(d))||{}).icon,p=Array.isArray(h)?e.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-l/2," ").concat(u-c/2,")")}],x(h),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(a-l/2," ").concat(u-c/2,")"),d:h});return e.h("g",{},e.h("circle",v(v({},i),{cx:a,cy:u,r:s,strokeWidth:1.5})),e.h("circle",v(v({},i),{cx:a,cy:u,r:s-3,strokeWidth:1.5})),p)},r}(e.CircleNode),i=function(t){function e(e,r){var i,o,a,u;e.id||(e.id="Event_".concat(ft())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var s=((null===(o=n.intermediateCatchEvent)||void 0===o?void 0:o.get(null===(a=e.properties)||void 0===a?void 0:a.definitionType))||{}).properties,l=void 0===s?{}:s;return e.properties=v(v({},l),e.properties),(null===(u=e.properties)||void 0===u?void 0:u.definitionType)&&(e.properties.definitionId="Definition_".concat(ft())),i=t.call(this,e,r)||this,dt.call(i),i}return f(e,t),e.prototype.setAttributes=function(){this.r=18},e}(e.CircleNodeModel);return{type:"bpmn:intermediateCatchEvent",view:r,model:i}}function mt(t){var n=x(t.useDefinition(),1)[0],r=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return f(r,t),r.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},r.prototype.getShape=function(){var t,r=this.props.model,i=r.getNodeStyle(),o=r,a=o.x,u=o.y,s=o.r,l=o.width,c=o.height,d=o.properties,h=d.definitionType,p=d.isInterrupting,f=((null===(t=n.startEvent)||void 0===t?void 0:t.get(h))||{}).icon,g=Array.isArray(f)?e.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-l/2," ").concat(u-c/2,")")}],x(f),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(a-l/2," ").concat(u-c/2,")"),d:f,style:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"});return e.h("g",{},e.h("circle",v(v({},i),{cx:a,cy:u,r:s,strokeDasharray:p?"5,5":"",strokeWidth:2})),g)},r}(e.CircleNode),i=function(t){function e(e,r){var i,o,a;e.id||(e.id="Event_".concat(ft())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var u=((null===(i=n.startEvent)||void 0===i?void 0:i.get(null===(o=e.properties)||void 0===o?void 0:o.definitionType))||{}).properties,s=void 0===u?{}:u;return e.properties=v(v({},s),e.properties),(null===(a=e.properties)||void 0===a?void 0:a.definitionType)&&(e.properties.definitionId="Definition_".concat(ft())),t.call(this,e,r)||this}return f(e,t),e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedTargetRules=function(){var e=this,n=t.prototype.getConnectedTargetRules.call(this),r={message:"起始节点不能作为边的终点",validate:function(t,n){return n!==e}};return n.push(r),n},e}(e.CircleNodeModel);return{type:"bpmn:startEvent",view:r,model:i}}function bt(t){var n=x(t.useDefinition(),1)[0],r=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return f(r,t),r.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},r.prototype.getShape=function(){var t,r=this.props.model,i=r.getNodeStyle(),o=r,a=o.x,u=o.y,s=o.r,l=o.width,c=o.height,d=o.properties,h=d.definitionType,p=d.cancelActivity,f=((null===(t=n.boundaryEvent)||void 0===t?void 0:t.get(h))||{}).icon,g=Array.isArray(f)?e.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-l/2," ").concat(u-c/2,")")}],x(f),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(a-l/2," ").concat(u-c/2,")"),d:f});return e.h("g",{},e.h("circle",v(v({},i),{cx:a,cy:u,r:s,strokeDasharray:p?"":"5,5",strokeWidth:1.5})),e.h("circle",v(v({},i),{cx:a,cy:u,r:s-3,strokeDasharray:p?"":"5,5",strokeWidth:1.5})),g)},r}(e.CircleNode),i=function(t){function e(e,r){var i,o,a,u;e.id||(e.id="Event_".concat(ft())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var s=((null===(o=n.boundaryEvent)||void 0===o?void 0:o.get(null===(a=e.properties)||void 0===a?void 0:a.definitionType))||{}).properties,l=void 0===s?{}:s;return e.properties=v(v({attachedToRef:"",cancelActivity:!0},l),e.properties),(null===(u=e.properties)||void 0===u?void 0:u.definitionType)&&(e.properties.definitionId="Definition_".concat(ft())),i=t.call(this,e,r)||this,dt.call(i),i}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.r=20,this.autoToFront=!1,this.zIndex=99999},e.prototype.setAttributes=function(){this.r=18},e}(e.CircleNodeModel);return{type:"bpmn:boundaryEvent",view:r,model:i}}function xt(t){var n=x(t.useDefinition(),1)[0],r=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return f(r,t),r.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},r.prototype.getShape=function(){var t,r=this.props.model,i=r.getNodeStyle(),o=r,a=o.x,u=o.y,s=o.r,l=o.width,c=o.height,d=o.properties.definitionType,h=((null===(t=n.intermediateThrowEvent)||void 0===t?void 0:t.get(d))||{}).icon,p=Array.isArray(h)?e.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(a-l/2," ").concat(u-c/2,")")}],x(h),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(a-l/2," ").concat(u-c/2,")"),d:h,style:"fill: black"});return e.h("g",{},e.h("circle",v(v({},i),{cx:a,cy:u,r:s,strokeWidth:1.5})),e.h("circle",v(v({},i),{cx:a,cy:u,r:s-3,strokeWidth:1.5})),p)},r}(e.CircleNode),i=function(t){function e(e,r){var i,o,a,u;e.id||(e.id="Event_".concat(ft())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var s=((null===(o=n.intermediateThrowEvent)||void 0===o?void 0:o.get(null===(a=e.properties)||void 0===a?void 0:a.definitionType))||{}).properties,l=void 0===s?{}:s;return e.properties=v(v({},l),e.properties),(null===(u=e.properties)||void 0===u?void 0:u.definitionType)&&(e.properties.definitionId="Definition_".concat(ft())),i=t.call(this,e,r)||this,dt.call(i),i}return f(e,t),e.prototype.setAttributes=function(){this.r=18},e}(e.CircleNodeModel);return{type:"bpmn:intermediateThrowEvent",view:r,model:i}}var _t=[e.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"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"})],wt=[e.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);"})],Mt="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",Et="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",Nt=e.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;"}),St="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",At="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",Pt="m44,60 m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",Tt="m47,61 m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",kt="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",Ct=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:Mt,inclusiveIcon:Nt,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:kt,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:Et,parallelMarker:Pt,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:Tt,serviceTaskIcon:St,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:wt,timerIcon:_t,userTaskIcon:At});function Ot(t,n,r){var i=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return f(r,t),r.prototype.getShape=function(){var t=this.props.model,r=t,i=r.x,o=r.y,a=r.width,u=r.height,s=r.points,l=t.getNodeStyle();return e.h("g",{transform:"matrix(1 0 0 1 ".concat(i-a/2," ").concat(o-u/2,")")},e.h(e.Polygon,v(v({},l),{x:i,y:o,points:s})),"string"==typeof n?e.h("path",v(v({d:n},l),{fill:"rgb(34, 36, 42)",strokeWidth:1})):n)},r}(e.PolygonNode);return{type:t,view:i,model:function(t){function e(e,n){var i=this;return e.id||(e.id="Gateway_".concat(ft())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40}),e.properties=v(v({},r||{}),e.properties),(i=t.call(this,e,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],dt.call(i),i}return f(e,t),e}(e.PolygonNodeModel)}}var It={parallel:Pt,sequential:Tt,loop:kt};function jt(t,n,r){var i=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return f(r,t),r.prototype.getLabelShape=function(){var t=this.props.model,r=t.x,i=t.y,o=t.width,a=t.height,u=t.getNodeStyle(),s=Array.isArray(n)?e.h.apply(void 0,_(["g",{transform:"matrix(1 0 0 1 ".concat(r-o/2," ").concat(i-a/2,")")}],x(n),!1)):e.h("path",{fill:u.stroke,d:n});return e.h("svg",{x:r-o/2+5,y:i-a/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},s)},r.prototype.getShape=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.radius,u=t.properties,s=t.getNodeStyle();return e.h("g",{},[e.h("rect",v(v({},s),{x:n-i/2,y:r-o/2,rx:a,ry:a,width:i,height:o,opacity:.95})),this.getLabelShape(),e.h("g",{transform:"matrix(1 0 0 1 ".concat(n-i/2," ").concat(r-o/2,")")},e.h("path",{fill:"white",strokeLinecap:"round",strokeLinejoin:"round",stroke:"rgb(34, 36, 42)",strokeWidth:"2",d:It[u.multiInstanceType]||""}))])},r}(e.RectNode),o=function(t){function e(e,n){var i,o=this;e.id||(e.id="Activity_".concat(ft()));var a=v(v({},r||{}),e.properties);return e.properties=a,o=t.call(this,e,n)||this,null===(i=null==a?void 0:a.boundaryEvents)||void 0===i||i.forEach((function(t){o.addBoundaryEvent(t)})),o.deleteProperty("boundaryEvents"),dt.call(o),o}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.isTaskNode=!0,this.boundaryEvents=[]},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return this.properties.isBoundaryEventTouchingTask&&(e.stroke="#00acff",e.strokeWidth=2),e},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return e.stroke="transparent",!e.hover&&(e.hover={}),e.hover.stroke="transparent",e},e.prototype.setTouching=function(t){this.setProperty("isBoundaryEventTouchingTask",t)},e.prototype.addBoundaryEvent=function(t){if(this.setTouching(!1),this.boundaryEvents.find((function(e){return e===t})))return!1;var e=this.graphModel.getNodeModelById(t);return null==e||e.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(t),!0},e.prototype.deleteBoundaryEvent=function(t){this.boundaryEvents=this.boundaryEvents.filter((function(e){return e!==t}))},e}(e.RectNodeModel);return{type:t,view:i,model:o}}var Rt="object"==typeof global&&global&&global.Object===Object&&global,Dt="object"==typeof self&&self&&self.Object===Object&&self,Lt=Rt||Dt||Function("return this")(),Bt=Lt.Symbol,zt=Object.prototype,Wt=zt.hasOwnProperty,Ft=zt.toString,Gt=Bt?Bt.toStringTag:void 0;var Ht=Object.prototype.toString;var Xt="[object Null]",Ut="[object Undefined]",Vt=Bt?Bt.toStringTag:void 0;function qt(t){return null==t?void 0===t?Ut:Xt:Vt&&Vt in Object(t)?function(t){var e=Wt.call(t,Gt),n=t[Gt];try{t[Gt]=void 0;var r=!0}catch(t){}var i=Ft.call(t);return r&&(e?t[Gt]=n:delete t[Gt]),i}(t):function(t){return Ht.call(t)}(t)}function Yt(t){return null!=t&&"object"==typeof t}var Zt="[object Symbol]";function Kt(t){return"symbol"==typeof t||Yt(t)&&qt(t)==Zt}var $t=NaN;function Jt(t){return"number"==typeof t?t:Kt(t)?$t:+t}function Qt(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var te=Array.isArray,ee=1/0,ne=Bt?Bt.prototype:void 0,re=ne?ne.toString:void 0;function ie(t){if("string"==typeof t)return t;if(te(t))return Qt(t,ie)+"";if(Kt(t))return re?re.call(t):"";var e=t+"";return"0"==e&&1/t==-ee?"-0":e}function oe(t,e){return function(n,r){var i;if(void 0===n&&void 0===r)return e;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=ie(n),r=ie(r)):(n=Jt(n),r=Jt(r)),i=t(n,r)}return i}}var ae=oe((function(t,e){return t+e}),0),ue=/\s/;function se(t){for(var e=t.length;e--&&ue.test(t.charAt(e)););return e}var le=/^\s+/;function ce(t){return t?t.slice(0,se(t)+1).replace(le,""):t}function de(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var he=NaN,pe=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,ve=/^0o[0-7]+$/i,ge=parseInt;function ye(t){if("number"==typeof t)return t;if(Kt(t))return he;if(de(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=de(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=ce(t);var n=fe.test(t);return n||ve.test(t)?ge(t.slice(2),n?2:8):pe.test(t)?he:+t}var me=1/0,be=17976931348623157e292;function xe(t){return t?(t=ye(t))===me||t===-me?(t<0?-1:1)*be:t==t?t:0:0===t?t:0}function _e(t){var e=xe(t),n=e%1;return e==e?n?e-n:e:0}function we(t){return t}var Me="[object AsyncFunction]",Ee="[object Function]",Ne="[object GeneratorFunction]",Se="[object Proxy]";function Ae(t){if(!de(t))return!1;var e=qt(t);return e==Ee||e==Ne||e==Me||e==Se}var Pe,Te=Lt["__core-js_shared__"],ke=(Pe=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||""))?"Symbol(src)_1."+Pe:"";var Ce=Function.prototype.toString;function Oe(t){if(null!=t){try{return Ce.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var Ie=/^\[object .+?Constructor\]$/,je=Function.prototype,Re=Object.prototype,De=je.toString,Le=Re.hasOwnProperty,Be=RegExp("^"+De.call(Le).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ze(t){return!(!de(t)||function(t){return!!ke&&ke in t}(t))&&(Ae(t)?Be:Ie).test(Oe(t))}function We(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return ze(n)?n:void 0}var Fe=We(Lt,"WeakMap"),Ge=Fe&&new Fe,He=Ge?function(t,e){return Ge.set(t,e),t}:we,Xe=Object.create,Ue=function(){function t(){}return function(e){if(!de(e))return{};if(Xe)return Xe(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Ve(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Ue(t.prototype),r=t.apply(n,e);return de(r)?r:n}}var qe=1;function Ye(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var Ze=Math.max;function Ke(t,e,n,r){for(var i=-1,o=t.length,a=n.length,u=-1,s=e.length,l=Ze(o-a,0),c=Array(s+l),d=!r;++u<s;)c[u]=e[u];for(;++i<a;)(d||i<o)&&(c[n[i]]=t[i]);for(;l--;)c[u++]=t[i++];return c}var $e=Math.max;function Je(t,e,n,r){for(var i=-1,o=t.length,a=-1,u=n.length,s=-1,l=e.length,c=$e(o-u,0),d=Array(c+l),h=!r;++i<c;)d[i]=t[i];for(var p=i;++s<l;)d[p+s]=e[s];for(;++a<u;)(h||i<o)&&(d[p+n[a]]=t[i++]);return d}function Qe(){}var tn=4294967295;function en(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=tn,this.__views__=[]}function nn(){}en.prototype=Ue(Qe.prototype),en.prototype.constructor=en;var rn=Ge?function(t){return Ge.get(t)}:nn,on={},an=Object.prototype.hasOwnProperty;function un(t){for(var e=t.name+"",n=on[e],r=an.call(on,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function sn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function ln(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function cn(t){if(t instanceof en)return t.clone();var e=new sn(t.__wrapped__,t.__chain__);return e.__actions__=ln(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}sn.prototype=Ue(Qe.prototype),sn.prototype.constructor=sn;var dn=Object.prototype.hasOwnProperty;function hn(t){if(Yt(t)&&!te(t)&&!(t instanceof en)){if(t instanceof sn)return t;if(dn.call(t,"__wrapped__"))return cn(t)}return new sn(t)}function pn(t){var e=un(t),n=hn[e];if("function"!=typeof n||!(e in en.prototype))return!1;if(t===n)return!0;var r=rn(n);return!!r&&t===r[0]}hn.prototype=Qe.prototype,hn.prototype.constructor=hn;var fn=Date.now;function vn(t){var e=0,n=0;return function(){var r=fn(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var gn=vn(He),yn=/\{\n\/\* \[wrapped with (.+)\] \*/,mn=/,? & /;var bn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function xn(t){return function(){return t}}var _n=function(){try{var t=We(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),wn=_n?function(t,e){return _n(t,"toString",{configurable:!0,enumerable:!1,value:xn(e),writable:!0})}:we,Mn=vn(wn);function En(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Nn(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Sn(t){return t!=t}function An(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Nn(t,Sn,n)}function Pn(t,e){return!!(null==t?0:t.length)&&An(t,e,0)>-1}var Tn=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function kn(t,e,n){var r=e+"";return Mn(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(bn,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return En(Tn,(function(n){var r="_."+n[0];e&n[1]&&!Pn(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(yn);return e?e[1].split(mn):[]}(r),n)))}var Cn=1,On=2,In=4,jn=8,Rn=32,Dn=64;function Ln(t,e,n,r,i,o,a,u,s,l){var c=e&jn;e|=c?Rn:Dn,(e&=~(c?Dn:Rn))&In||(e&=~(Cn|On));var d=[t,e,i,c?o:void 0,c?a:void 0,c?void 0:o,c?void 0:a,u,s,l],h=n.apply(void 0,d);return pn(t)&&gn(h,d),h.placeholder=r,kn(h,t,e)}function Bn(t){return t.placeholder}var zn=9007199254740991,Wn=/^(?:0|[1-9]\d*)$/;function Fn(t,e){var n=typeof t;return!!(e=null==e?zn:e)&&("number"==n||"symbol"!=n&&Wn.test(t))&&t>-1&&t%1==0&&t<e}var Gn=Math.min;var Hn="__lodash_placeholder__";function Xn(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n];a!==e&&a!==Hn||(t[n]=Hn,o[i++]=n)}return o}var Un=1,Vn=2,qn=8,Yn=16,Zn=128,Kn=512;function $n(t,e,n,r,i,o,a,u,s,l){var c=e&Zn,d=e&Un,h=e&Vn,p=e&(qn|Yn),f=e&Kn,v=h?void 0:Ve(t);return function g(){for(var y=arguments.length,m=Array(y),b=y;b--;)m[b]=arguments[b];if(p)var x=Bn(g),_=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(m,x);if(r&&(m=Ke(m,r,i,p)),o&&(m=Je(m,o,a,p)),y-=_,p&&y<l){var w=Xn(m,x);return Ln(t,e,$n,g.placeholder,n,m,w,u,s,l-y)}var M=d?n:this,E=h?M[t]:t;return y=m.length,u?m=function(t,e){for(var n=t.length,r=Gn(e.length,n),i=ln(t);r--;){var o=e[r];t[r]=Fn(o,n)?i[o]:void 0}return t}(m,u):f&&y>1&&m.reverse(),c&&s<y&&(m.length=s),this&&this!==Lt&&this instanceof g&&(E=v||Ve(E)),E.apply(M,m)}}var Jn=1;var Qn="__lodash_placeholder__",tr=1,er=2,nr=4,rr=8,ir=128,or=256,ar=Math.min;var ur="Expected a function",sr=1,lr=2,cr=8,dr=16,hr=32,pr=64,fr=Math.max;function vr(t,e,n,r,i,o,a,u){var s=e&lr;if(!s&&"function"!=typeof t)throw new TypeError(ur);var l=r?r.length:0;if(l||(e&=~(hr|pr),r=i=void 0),a=void 0===a?a:fr(_e(a),0),u=void 0===u?u:_e(u),l-=i?i.length:0,e&pr){var c=r,d=i;r=i=void 0}var h=s?void 0:rn(t),p=[t,e,n,r,i,c,d,o,a,u];if(h&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<(tr|er|ir),a=r==ir&&n==rr||r==ir&&n==or&&t[7].length<=e[8]||r==(ir|or)&&e[7].length<=e[8]&&n==rr;if(!o&&!a)return t;r&tr&&(t[2]=e[2],i|=n&tr?0:nr);var u=e[3];if(u){var s=t[3];t[3]=s?Ke(s,u,e[4]):u,t[4]=s?Xn(t[3],Qn):e[4]}(u=e[5])&&(s=t[5],t[5]=s?Je(s,u,e[6]):u,t[6]=s?Xn(t[5],Qn):e[6]),(u=e[7])&&(t[7]=u),r&ir&&(t[8]=null==t[8]?e[8]:ar(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(p,h),t=p[0],e=p[1],n=p[2],r=p[3],i=p[4],!(u=p[9]=void 0===p[9]?s?0:t.length:fr(p[9]-l,0))&&e&(cr|dr)&&(e&=~(cr|dr)),e&&e!=sr)f=e==cr||e==dr?function(t,e,n){var r=Ve(t);return function i(){for(var o=arguments.length,a=Array(o),u=o,s=Bn(i);u--;)a[u]=arguments[u];var l=o<3&&a[0]!==s&&a[o-1]!==s?[]:Xn(a,s);return(o-=l.length)<n?Ln(t,e,$n,i.placeholder,void 0,a,l,void 0,void 0,n-o):Ye(this&&this!==Lt&&this instanceof i?r:t,this,a)}}(t,e,u):e!=hr&&e!=(sr|hr)||i.length?$n.apply(void 0,p):function(t,e,n,r){var i=e&Jn,o=Ve(t);return function e(){for(var a=-1,u=arguments.length,s=-1,l=r.length,c=Array(l+u),d=this&&this!==Lt&&this instanceof e?o:t;++s<l;)c[s]=r[s];for(;u--;)c[s++]=arguments[++a];return Ye(d,i?n:this,c)}}(t,e,n,r);else var f=function(t,e,n){var r=e&qe,i=Ve(t);return function e(){return(this&&this!==Lt&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return kn((h?He:gn)(f,p),t,e)}var gr=128;function yr(t,e,n){return e=n?void 0:e,e=t&&null==e?t.length:e,vr(t,gr,void 0,void 0,void 0,void 0,e)}function mr(t,e,n){"__proto__"==e&&_n?_n(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function br(t,e){return t===e||t!=t&&e!=e}var xr=Object.prototype.hasOwnProperty;function _r(t,e,n){var r=t[e];xr.call(t,e)&&br(r,n)&&(void 0!==n||e in t)||mr(t,e,n)}function wr(t,e,n,r){var i=!n;n||(n={});for(var o=-1,a=e.length;++o<a;){var u=e[o],s=r?r(n[u],t[u],u,n,t):void 0;void 0===s&&(s=t[u]),i?mr(n,u,s):_r(n,u,s)}return n}var Mr=Math.max;function Er(t,e,n){return e=Mr(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=Mr(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=r[i];return u[e]=n(a),Ye(t,this,u)}}function Nr(t,e){return Mn(Er(t,e,we),t+"")}var Sr=9007199254740991;function Ar(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Sr}function Pr(t){return null!=t&&Ar(t.length)&&!Ae(t)}function Tr(t,e,n){if(!de(n))return!1;var r=typeof e;return!!("number"==r?Pr(n)&&Fn(e,n.length):"string"==r&&e in n)&&br(n[e],t)}function kr(t){return Nr((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&Tr(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++r<i;){var u=n[r];u&&t(e,u,r,o)}return e}))}var Cr=Object.prototype;function Or(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Cr)}function Ir(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function jr(t){return Yt(t)&&"[object Arguments]"==qt(t)}var Rr=Object.prototype,Dr=Rr.hasOwnProperty,Lr=Rr.propertyIsEnumerable,Br=jr(function(){return arguments}())?jr:function(t){return Yt(t)&&Dr.call(t,"callee")&&!Lr.call(t,"callee")};function zr(){return!1}var Wr="object"==typeof t&&t&&!t.nodeType&&t,Fr=Wr&&"object"==typeof module&&module&&!module.nodeType&&module,Gr=Fr&&Fr.exports===Wr?Lt.Buffer:void 0,Hr=(Gr?Gr.isBuffer:void 0)||zr,Xr={};function Ur(t){return function(e){return t(e)}}Xr["[object Float32Array]"]=Xr["[object Float64Array]"]=Xr["[object Int8Array]"]=Xr["[object Int16Array]"]=Xr["[object Int32Array]"]=Xr["[object Uint8Array]"]=Xr["[object Uint8ClampedArray]"]=Xr["[object Uint16Array]"]=Xr["[object Uint32Array]"]=!0,Xr["[object Arguments]"]=Xr["[object Array]"]=Xr["[object ArrayBuffer]"]=Xr["[object Boolean]"]=Xr["[object DataView]"]=Xr["[object Date]"]=Xr["[object Error]"]=Xr["[object Function]"]=Xr["[object Map]"]=Xr["[object Number]"]=Xr["[object Object]"]=Xr["[object RegExp]"]=Xr["[object Set]"]=Xr["[object String]"]=Xr["[object WeakMap]"]=!1;var Vr="object"==typeof t&&t&&!t.nodeType&&t,qr=Vr&&"object"==typeof module&&module&&!module.nodeType&&module,Yr=qr&&qr.exports===Vr&&Rt.process,Zr=function(){try{var t=qr&&qr.require&&qr.require("util").types;return t||Yr&&Yr.binding&&Yr.binding("util")}catch(t){}}(),Kr=Zr&&Zr.isTypedArray,$r=Kr?Ur(Kr):function(t){return Yt(t)&&Ar(t.length)&&!!Xr[qt(t)]},Jr=Object.prototype.hasOwnProperty;function Qr(t,e){var n=te(t),r=!n&&Br(t),i=!n&&!r&&Hr(t),o=!n&&!r&&!i&&$r(t),a=n||r||i||o,u=a?Ir(t.length,String):[],s=u.length;for(var l in t)!e&&!Jr.call(t,l)||a&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Fn(l,s))||u.push(l);return u}function ti(t,e){return function(n){return t(e(n))}}var ei=ti(Object.keys,Object),ni=Object.prototype.hasOwnProperty;function ri(t){if(!Or(t))return ei(t);var e=[];for(var n in Object(t))ni.call(t,n)&&"constructor"!=n&&e.push(n);return e}function ii(t){return Pr(t)?Qr(t):ri(t)}var oi=Object.prototype.hasOwnProperty,ai=kr((function(t,e){if(Or(e)||Pr(e))wr(e,ii(e),t);else for(var n in e)oi.call(e,n)&&_r(t,n,e[n])}));var ui=Object.prototype.hasOwnProperty;function si(t){if(!de(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Or(t),n=[];for(var r in t)("constructor"!=r||!e&&ui.call(t,r))&&n.push(r);return n}function li(t){return Pr(t)?Qr(t,!0):si(t)}var ci=kr((function(t,e){wr(e,li(e),t)})),di=kr((function(t,e,n,r){wr(e,li(e),t,r)})),hi=kr((function(t,e,n,r){wr(e,ii(e),t,r)})),pi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,fi=/^\w*$/;function vi(t,e){if(te(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Kt(t))||(fi.test(t)||!pi.test(t)||null!=e&&t in Object(e))}var gi=We(Object,"create");var yi=Object.prototype.hasOwnProperty;var mi=Object.prototype.hasOwnProperty;function bi(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function xi(t,e){for(var n=t.length;n--;)if(br(t[n][0],e))return n;return-1}bi.prototype.clear=function(){this.__data__=gi?gi(null):{},this.size=0},bi.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},bi.prototype.get=function(t){var e=this.__data__;if(gi){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return yi.call(e,t)?e[t]:void 0},bi.prototype.has=function(t){var e=this.__data__;return gi?void 0!==e[t]:mi.call(e,t)},bi.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=gi&&void 0===e?"__lodash_hash_undefined__":e,this};var _i=Array.prototype.splice;function wi(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}wi.prototype.clear=function(){this.__data__=[],this.size=0},wi.prototype.delete=function(t){var e=this.__data__,n=xi(e,t);return!(n<0)&&(n==e.length-1?e.pop():_i.call(e,n,1),--this.size,!0)},wi.prototype.get=function(t){var e=this.__data__,n=xi(e,t);return n<0?void 0:e[n][1]},wi.prototype.has=function(t){return xi(this.__data__,t)>-1},wi.prototype.set=function(t,e){var n=this.__data__,r=xi(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var Mi=We(Lt,"Map");function Ei(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map}function Ni(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Ni.prototype.clear=function(){this.size=0,this.__data__={hash:new bi,map:new(Mi||wi),string:new bi}},Ni.prototype.delete=function(t){var e=Ei(this,t).delete(t);return this.size-=e?1:0,e},Ni.prototype.get=function(t){return Ei(this,t).get(t)},Ni.prototype.has=function(t){return Ei(this,t).has(t)},Ni.prototype.set=function(t,e){var n=Ei(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};var Si="Expected a function";function Ai(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(Si);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Ai.Cache||Ni),n}Ai.Cache=Ni;var Pi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ti=/\\(\\)?/g,ki=function(t){var e=Ai(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Pi,(function(t,n,r,i){e.push(r?i.replace(Ti,"$1"):n||t)})),e}));function Ci(t){return null==t?"":ie(t)}function Oi(t,e){return te(t)?t:vi(t,e)?[t]:ki(Ci(t))}var Ii=1/0;function ji(t){if("string"==typeof t||Kt(t))return t;var e=t+"";return"0"==e&&1/t==-Ii?"-0":e}function Ri(t,e){for(var n=0,r=(e=Oi(e,t)).length;null!=t&&n<r;)t=t[ji(e[n++])];return n&&n==r?t:void 0}function Di(t,e,n){var r=null==t?void 0:Ri(t,e);return void 0===r?n:r}function Li(t,e){for(var n=-1,r=e.length,i=Array(r),o=null==t;++n<r;)i[n]=o?void 0:Di(t,e[n]);return i}function Bi(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var zi=Bt?Bt.isConcatSpreadable:void 0;function Wi(t){return te(t)||Br(t)||!!(zi&&t&&t[zi])}function Fi(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=Wi),i||(i=[]);++o<a;){var u=t[o];e>0&&n(u)?e>1?Fi(u,e-1,n,r,i):Bi(i,u):r||(i[i.length]=u)}return i}function Gi(t){return(null==t?0:t.length)?Fi(t,1):[]}function Hi(t){return Mn(Er(t,void 0,Gi),t+"")}var Xi=Hi(Li),Ui=ti(Object.getPrototypeOf,Object),Vi="[object Object]",qi=Function.prototype,Yi=Object.prototype,Zi=qi.toString,Ki=Yi.hasOwnProperty,$i=Zi.call(Object);function Ji(t){if(!Yt(t)||qt(t)!=Vi)return!1;var e=Ui(t);if(null===e)return!0;var n=Ki.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Zi.call(n)==$i}var Qi="[object DOMException]",to="[object Error]";function eo(t){if(!Yt(t))return!1;var e=qt(t);return e==to||e==Qi||"string"==typeof t.message&&"string"==typeof t.name&&!Ji(t)}var no=Nr((function(t,e){try{return Ye(t,void 0,e)}catch(t){return eo(t)?t:new Error(t)}})),ro="Expected a function";function io(t,e){var n;if("function"!=typeof e)throw new TypeError(ro);return t=_e(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var oo=Nr((function(t,e,n){var r=1;if(n.length){var i=Xn(n,Bn(oo));r|=32}return vr(t,r,e,n,i)}));oo.placeholder={};var ao=Hi((function(t,e){return En(e,(function(e){e=ji(e),mr(t,e,oo(t[e],t))})),t})),uo=Nr((function(t,e,n){var r=3;if(n.length){var i=Xn(n,Bn(uo));r|=32}return vr(e,r,t,n,i)}));function so(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}function lo(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:so(t,e,n)}uo.placeholder={};var co=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function ho(t){return co.test(t)}var po="\\ud800-\\udfff",fo="["+po+"]",vo="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",go="\\ud83c[\\udffb-\\udfff]",yo="[^"+po+"]",mo="(?:\\ud83c[\\udde6-\\uddff]){2}",bo="[\\ud800-\\udbff][\\udc00-\\udfff]",xo="(?:"+vo+"|"+go+")"+"?",_o="[\\ufe0e\\ufe0f]?",wo=_o+xo+("(?:\\u200d(?:"+[yo,mo,bo].join("|")+")"+_o+xo+")*"),Mo="(?:"+[yo+vo+"?",vo,mo,bo,fo].join("|")+")",Eo=RegExp(go+"(?="+go+")|"+Mo+wo,"g");function No(t){return ho(t)?function(t){return t.match(Eo)||[]}(t):function(t){return t.split("")}(t)}function So(t){return function(e){var n=ho(e=Ci(e))?No(e):void 0,r=n?n[0]:e.charAt(0),i=n?lo(n,1).join(""):e.slice(1);return r[t]()+i}}var Ao=So("toUpperCase");function Po(t){return Ao(Ci(t).toLowerCase())}function To(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ko(t){return function(e){return null==t?void 0:t[e]}}var Co=ko({"À":"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"}),Oo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Io=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");function jo(t){return(t=Ci(t))&&t.replace(Oo,Co).replace(Io,"")}var Ro=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Do=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Lo="\\ud800-\\udfff",Bo="\\u2700-\\u27bf",zo="a-z\\xdf-\\xf6\\xf8-\\xff",Wo="A-Z\\xc0-\\xd6\\xd8-\\xde",Fo="\\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",Go="["+Fo+"]",Ho="\\d+",Xo="["+Bo+"]",Uo="["+zo+"]",Vo="[^"+Lo+Fo+Ho+Bo+zo+Wo+"]",qo="(?:\\ud83c[\\udde6-\\uddff]){2}",Yo="[\\ud800-\\udbff][\\udc00-\\udfff]",Zo="["+Wo+"]",Ko="(?:"+Uo+"|"+Vo+")",$o="(?:"+Zo+"|"+Vo+")",Jo="(?:['’](?:d|ll|m|re|s|t|ve))?",Qo="(?:['’](?:D|LL|M|RE|S|T|VE))?",ta="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",ea="[\\ufe0e\\ufe0f]?",na=ea+ta+("(?:\\u200d(?:"+["[^"+Lo+"]",qo,Yo].join("|")+")"+ea+ta+")*"),ra="(?:"+[Xo,qo,Yo].join("|")+")"+na,ia=RegExp([Zo+"?"+Uo+"+"+Jo+"(?="+[Go,Zo,"$"].join("|")+")",$o+"+"+Qo+"(?="+[Go,Zo+Ko,"$"].join("|")+")",Zo+"?"+Ko+"+"+Jo,Zo+"+"+Qo,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ho,ra].join("|"),"g");function oa(t,e,n){return t=Ci(t),void 0===(e=n?void 0:e)?function(t){return Do.test(t)}(t)?function(t){return t.match(ia)||[]}(t):function(t){return t.match(Ro)||[]}(t):t.match(e)||[]}var aa=RegExp("['’]","g");function ua(t){return function(e){return To(oa(jo(e).replace(aa,"")),t,"")}}var sa=ua((function(t,e,n){return e=e.toLowerCase(),t+(n?Po(e):e)}));var la=Lt.isFinite,ca=Math.min;function da(t){var e=Math[t];return function(t,n){if(t=ye(t),(n=null==n?0:ca(_e(n),292))&&la(t)){var r=(Ci(t)+"e").split("e");return+((r=(Ci(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var ha=da("ceil");function pa(t){var e=hn(t);return e.__chain__=!0,e}var fa=Math.ceil,va=Math.max;function ga(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}function ya(t){var e=this.__data__=new wi(t);this.size=e.size}function ma(t,e){return t&&wr(e,ii(e),t)}ya.prototype.clear=function(){this.__data__=new wi,this.size=0},ya.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},ya.prototype.get=function(t){return this.__data__.get(t)},ya.prototype.has=function(t){return this.__data__.has(t)},ya.prototype.set=function(t,e){var n=this.__data__;if(n instanceof wi){var r=n.__data__;if(!Mi||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ni(r)}return n.set(t,e),this.size=n.size,this};var ba="object"==typeof t&&t&&!t.nodeType&&t,xa=ba&&"object"==typeof module&&module&&!module.nodeType&&module,_a=xa&&xa.exports===ba?Lt.Buffer:void 0,wa=_a?_a.allocUnsafe:void 0;function Ma(t,e){if(e)return t.slice();var n=t.length,r=wa?wa(n):new t.constructor(n);return t.copy(r),r}function Ea(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}function Na(){return[]}var Sa=Object.prototype.propertyIsEnumerable,Aa=Object.getOwnPropertySymbols,Pa=Aa?function(t){return null==t?[]:(t=Object(t),Ea(Aa(t),(function(e){return Sa.call(t,e)})))}:Na;var Ta=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Bi(e,Pa(t)),t=Ui(t);return e}:Na;function ka(t,e,n){var r=e(t);return te(t)?r:Bi(r,n(t))}function Ca(t){return ka(t,ii,Pa)}function Oa(t){return ka(t,li,Ta)}var Ia=We(Lt,"DataView"),ja=We(Lt,"Promise"),Ra=We(Lt,"Set"),Da="[object Map]",La="[object Promise]",Ba="[object Set]",za="[object WeakMap]",Wa="[object DataView]",Fa=Oe(Ia),Ga=Oe(Mi),Ha=Oe(ja),Xa=Oe(Ra),Ua=Oe(Fe),Va=qt;(Ia&&Va(new Ia(new ArrayBuffer(1)))!=Wa||Mi&&Va(new Mi)!=Da||ja&&Va(ja.resolve())!=La||Ra&&Va(new Ra)!=Ba||Fe&&Va(new Fe)!=za)&&(Va=function(t){var e=qt(t),n="[object Object]"==e?t.constructor:void 0,r=n?Oe(n):"";if(r)switch(r){case Fa:return Wa;case Ga:return Da;case Ha:return La;case Xa:return Ba;case Ua:return za}return e});var qa=Va,Ya=Object.prototype.hasOwnProperty;var Za=Lt.Uint8Array;function Ka(t){var e=new t.constructor(t.byteLength);return new Za(e).set(new Za(t)),e}var $a=/\w*$/;var Ja=Bt?Bt.prototype:void 0,Qa=Ja?Ja.valueOf:void 0;function tu(t,e){var n=e?Ka(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var eu="[object Boolean]",nu="[object Date]",ru="[object Map]",iu="[object Number]",ou="[object RegExp]",au="[object Set]",uu="[object String]",su="[object Symbol]",lu="[object ArrayBuffer]",cu="[object DataView]",du="[object Float32Array]",hu="[object Float64Array]",pu="[object Int8Array]",fu="[object Int16Array]",vu="[object Int32Array]",gu="[object Uint8Array]",yu="[object Uint8ClampedArray]",mu="[object Uint16Array]",bu="[object Uint32Array]";function xu(t,e,n){var r,i=t.constructor;switch(e){case lu:return Ka(t);case eu:case nu:return new i(+t);case cu:return function(t,e){var n=e?Ka(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case du:case hu:case pu:case fu:case vu:case gu:case yu:case mu:case bu:return tu(t,n);case ru:return new i;case iu:case uu:return new i(t);case ou:return function(t){var e=new t.constructor(t.source,$a.exec(t));return e.lastIndex=t.lastIndex,e}(t);case au:return new i;case su:return r=t,Qa?Object(Qa.call(r)):{}}}function _u(t){return"function"!=typeof t.constructor||Or(t)?{}:Ue(Ui(t))}var wu=Zr&&Zr.isMap,Mu=wu?Ur(wu):function(t){return Yt(t)&&"[object Map]"==qa(t)};var Eu=Zr&&Zr.isSet,Nu=Eu?Ur(Eu):function(t){return Yt(t)&&"[object Set]"==qa(t)},Su=1,Au=2,Pu=4,Tu="[object Arguments]",ku="[object Function]",Cu="[object GeneratorFunction]",Ou="[object Object]",Iu={};function ju(t,e,n,r,i,o){var a,u=e&Su,s=e&Au,l=e&Pu;if(n&&(a=i?n(t,r,i,o):n(t)),void 0!==a)return a;if(!de(t))return t;var c=te(t);if(c){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Ya.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!u)return ln(t,a)}else{var d=qa(t),h=d==ku||d==Cu;if(Hr(t))return Ma(t,u);if(d==Ou||d==Tu||h&&!i){if(a=s||h?{}:_u(t),!u)return s?function(t,e){return wr(t,Ta(t),e)}(t,function(t,e){return t&&wr(e,li(e),t)}(a,t)):function(t,e){return wr(t,Pa(t),e)}(t,ma(a,t))}else{if(!Iu[d])return i?t:{};a=xu(t,d,u)}}o||(o=new ya);var p=o.get(t);if(p)return p;o.set(t,a),Nu(t)?t.forEach((function(r){a.add(ju(r,e,n,r,t,o))})):Mu(t)&&t.forEach((function(r,i){a.set(i,ju(r,e,n,i,t,o))}));var f=c?void 0:(l?s?Oa:Ca:s?li:ii)(t);return En(f||t,(function(r,i){f&&(r=t[i=r]),_r(a,i,ju(r,e,n,i,t,o))})),a}Iu[Tu]=Iu["[object Array]"]=Iu["[object ArrayBuffer]"]=Iu["[object DataView]"]=Iu["[object Boolean]"]=Iu["[object Date]"]=Iu["[object Float32Array]"]=Iu["[object Float64Array]"]=Iu["[object Int8Array]"]=Iu["[object Int16Array]"]=Iu["[object Int32Array]"]=Iu["[object Map]"]=Iu["[object Number]"]=Iu[Ou]=Iu["[object RegExp]"]=Iu["[object Set]"]=Iu["[object String]"]=Iu["[object Symbol]"]=Iu["[object Uint8Array]"]=Iu["[object Uint8ClampedArray]"]=Iu["[object Uint16Array]"]=Iu["[object Uint32Array]"]=!0,Iu["[object Error]"]=Iu[ku]=Iu["[object WeakMap]"]=!1;function Ru(t){return ju(t,5)}function Du(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Ni;++e<n;)this.add(t[e])}function Lu(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function Bu(t,e){return t.has(e)}Du.prototype.add=Du.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Du.prototype.has=function(t){return this.__data__.has(t)};var zu=1,Wu=2;function Fu(t,e,n,r,i,o){var a=n&zu,u=t.length,s=e.length;if(u!=s&&!(a&&s>u))return!1;var l=o.get(t),c=o.get(e);if(l&&c)return l==e&&c==t;var d=-1,h=!0,p=n&Wu?new Du:void 0;for(o.set(t,e),o.set(e,t);++d<u;){var f=t[d],v=e[d];if(r)var g=a?r(v,f,d,e,t,o):r(f,v,d,t,e,o);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!Lu(e,(function(t,e){if(!Bu(p,e)&&(f===t||i(f,t,n,r,o)))return p.push(e)}))){h=!1;break}}else if(f!==v&&!i(f,v,n,r,o)){h=!1;break}}return o.delete(t),o.delete(e),h}function Gu(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function Hu(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var Xu=1,Uu=2,Vu="[object Boolean]",qu="[object Date]",Yu="[object Error]",Zu="[object Map]",Ku="[object Number]",$u="[object RegExp]",Ju="[object Set]",Qu="[object String]",ts="[object Symbol]",es="[object ArrayBuffer]",ns="[object DataView]",rs=Bt?Bt.prototype:void 0,is=rs?rs.valueOf:void 0;var os=1,as=Object.prototype.hasOwnProperty;var us=1,ss="[object Arguments]",ls="[object Array]",cs="[object Object]",ds=Object.prototype.hasOwnProperty;function hs(t,e,n,r,i,o){var a=te(t),u=te(e),s=a?ls:qa(t),l=u?ls:qa(e),c=(s=s==ss?cs:s)==cs,d=(l=l==ss?cs:l)==cs,h=s==l;if(h&&Hr(t)){if(!Hr(e))return!1;a=!0,c=!1}if(h&&!c)return o||(o=new ya),a||$r(t)?Fu(t,e,n,r,i,o):function(t,e,n,r,i,o,a){switch(n){case ns:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case es:return!(t.byteLength!=e.byteLength||!o(new Za(t),new Za(e)));case Vu:case qu:case Ku:return br(+t,+e);case Yu:return t.name==e.name&&t.message==e.message;case $u:case Qu:return t==e+"";case Zu:var u=Gu;case Ju:var s=r&Xu;if(u||(u=Hu),t.size!=e.size&&!s)return!1;var l=a.get(t);if(l)return l==e;r|=Uu,a.set(t,e);var c=Fu(u(t),u(e),r,i,o,a);return a.delete(t),c;case ts:if(is)return is.call(t)==is.call(e)}return!1}(t,e,s,n,r,i,o);if(!(n&us)){var p=c&&ds.call(t,"__wrapped__"),f=d&&ds.call(e,"__wrapped__");if(p||f){var v=p?t.value():t,g=f?e.value():e;return o||(o=new ya),i(v,g,n,r,o)}}return!!h&&(o||(o=new ya),function(t,e,n,r,i,o){var a=n&os,u=Ca(t),s=u.length;if(s!=Ca(e).length&&!a)return!1;for(var l=s;l--;){var c=u[l];if(!(a?c in e:as.call(e,c)))return!1}var d=o.get(t),h=o.get(e);if(d&&h)return d==e&&h==t;var p=!0;o.set(t,e),o.set(e,t);for(var f=a;++l<s;){var v=t[c=u[l]],g=e[c];if(r)var y=a?r(g,v,c,e,t,o):r(v,g,c,t,e,o);if(!(void 0===y?v===g||i(v,g,n,r,o):y)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var m=t.constructor,b=e.constructor;m==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof m&&m instanceof m&&"function"==typeof b&&b instanceof b||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,n,r,i,o))}function ps(t,e,n,r,i){return t===e||(null==t||null==e||!Yt(t)&&!Yt(e)?t!=t&&e!=e:hs(t,e,n,r,ps,i))}var fs=1,vs=2;function gs(t,e,n,r){var i=n.length,o=i,a=!r;if(null==t)return!o;for(t=Object(t);i--;){var u=n[i];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++i<o;){var s=(u=n[i])[0],l=t[s],c=u[1];if(a&&u[2]){if(void 0===l&&!(s in t))return!1}else{var d=new ya;if(r)var h=r(l,c,s,t,e,d);if(!(void 0===h?ps(c,l,fs|vs,r,d):h))return!1}}return!0}function ys(t){return t==t&&!de(t)}function ms(t){for(var e=ii(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,ys(i)]}return e}function bs(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}function xs(t){var e=ms(t);return 1==e.length&&e[0][2]?bs(e[0][0],e[0][1]):function(n){return n===t||gs(n,t,e)}}function _s(t,e){return null!=t&&e in Object(t)}function ws(t,e,n){for(var r=-1,i=(e=Oi(e,t)).length,o=!1;++r<i;){var a=ji(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Ar(i)&&Fn(a,i)&&(te(t)||Br(t))}function Ms(t,e){return null!=t&&ws(t,e,_s)}var Es=1,Ns=2;function Ss(t,e){return vi(t)&&ys(e)?bs(ji(t),e):function(n){var r=Di(n,t);return void 0===r&&r===e?Ms(n,t):ps(e,r,Es|Ns)}}function As(t){return function(e){return null==e?void 0:e[t]}}function Ps(t){return vi(t)?As(ji(t)):function(t){return function(e){return Ri(e,t)}}(t)}function Ts(t){return"function"==typeof t?t:null==t?we:"object"==typeof t?te(t)?Ss(t[0],t[1]):xs(t):Ps(t)}function ks(t,e,n){var r=n.length;if(null==t)return!r;for(t=Object(t);r--;){var i=n[r],o=e[i],a=t[i];if(void 0===a&&!(i in t)||!o(a))return!1}return!0}function Cs(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(r,a,n(a),t)}return r}function Os(t){return function(e,n,r){for(var i=-1,o=Object(e),a=r(e),u=a.length;u--;){var s=a[t?u:++i];if(!1===n(o[s],s,o))break}return e}}var Is=Os();function js(t,e){return t&&Is(t,e,ii)}function Rs(t,e){return function(n,r){if(null==n)return n;if(!Pr(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=Object(n);(e?o--:++o<i)&&!1!==r(a[o],o,a););return n}}var Ds=Rs(js);function Ls(t,e,n,r){return Ds(t,(function(t,i,o){e(r,t,n(t),o)})),r}function Bs(t,e){return function(n,r){var i=te(n)?Cs:Ls,o=e?e():{};return i(n,t,Ts(r),o)}}var zs=Object.prototype.hasOwnProperty,Ws=Bs((function(t,e,n){zs.call(t,n)?++t[n]:mr(t,n,1)}));function Fs(t,e,n){var r=vr(t,8,void 0,void 0,void 0,void 0,void 0,e=n?void 0:e);return r.placeholder=Fs.placeholder,r}Fs.placeholder={};function Gs(t,e,n){var r=vr(t,16,void 0,void 0,void 0,void 0,void 0,e=n?void 0:e);return r.placeholder=Gs.placeholder,r}Gs.placeholder={};var Hs=function(){return Lt.Date.now()},Xs="Expected a function",Us=Math.max,Vs=Math.min;function qs(t,e,n){var r,i,o,a,u,s,l=0,c=!1,d=!1,h=!0;if("function"!=typeof t)throw new TypeError(Xs);function p(e){var n=r,o=i;return r=i=void 0,l=e,a=t.apply(o,n)}function f(t){var n=t-s;return void 0===s||n>=e||n<0||d&&t-l>=o}function v(){var t=Hs();if(f(t))return g(t);u=setTimeout(v,function(t){var n=e-(t-s);return d?Vs(n,o-(t-l)):n}(t))}function g(t){return u=void 0,h&&r?p(t):(r=i=void 0,a)}function y(){var t=Hs(),n=f(t);if(r=arguments,i=this,s=t,n){if(void 0===u)return function(t){return l=t,u=setTimeout(v,e),c?p(t):a}(s);if(d)return clearTimeout(u),u=setTimeout(v,e),p(s)}return void 0===u&&(u=setTimeout(v,e)),a}return e=ye(e)||0,de(n)&&(c=!!n.leading,o=(d="maxWait"in n)?Us(ye(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==u&&clearTimeout(u),l=0,r=s=i=u=void 0},y.flush=function(){return void 0===u?a:g(Hs())},y}var Ys=Object.prototype,Zs=Ys.hasOwnProperty,Ks=Nr((function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&Tr(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],a=li(o),u=-1,s=a.length;++u<s;){var l=a[u],c=t[l];(void 0===c||br(c,Ys[l])&&!Zs.call(t,l))&&(t[l]=o[l])}return t}));function $s(t,e,n){(void 0!==n&&!br(t[e],n)||void 0===n&&!(e in t))&&mr(t,e,n)}function Js(t){return Yt(t)&&Pr(t)}function Qs(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function tl(t){return wr(t,li(t))}function el(t,e,n,r,i){t!==e&&Is(e,(function(o,a){if(i||(i=new ya),de(o))!function(t,e,n,r,i,o,a){var u=Qs(t,n),s=Qs(e,n),l=a.get(s);if(l)$s(t,n,l);else{var c=o?o(u,s,n+"",t,e,a):void 0,d=void 0===c;if(d){var h=te(s),p=!h&&Hr(s),f=!h&&!p&&$r(s);c=s,h||p||f?te(u)?c=u:Js(u)?c=ln(u):p?(d=!1,c=Ma(s,!0)):f?(d=!1,c=tu(s,!0)):c=[]:Ji(s)||Br(s)?(c=u,Br(u)?c=tl(u):de(u)&&!Ae(u)||(c=_u(s))):d=!1}d&&(a.set(s,c),i(c,s,r,o,a),a.delete(s)),$s(t,n,c)}}(t,e,a,n,el,r,i);else{var u=r?r(Qs(t,a),o,a+"",t,e,i):void 0;void 0===u&&(u=o),$s(t,a,u)}}),li)}function nl(t,e,n,r,i,o){return de(t)&&de(e)&&(o.set(e,t),el(t,e,void 0,nl,o),o.delete(e)),t}var rl=kr((function(t,e,n,r){el(t,e,n,r)})),il=Nr((function(t){return t.push(void 0,nl),Ye(rl,void 0,t)}));function ol(t,e,n){if("function"!=typeof t)throw new TypeError("Expected a function");return setTimeout((function(){t.apply(void 0,n)}),e)}var al=Nr((function(t,e){return ol(t,1,e)})),ul=Nr((function(t,e,n){return ol(t,ye(e)||0,n)}));function sl(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}var ll=200;function cl(t,e,n,r){var i=-1,o=Pn,a=!0,u=t.length,s=[],l=e.length;if(!u)return s;n&&(e=Qt(e,Ur(n))),r?(o=sl,a=!1):e.length>=ll&&(o=Bu,a=!1,e=new Du(e));t:for(;++i<u;){var c=t[i],d=null==n?c:n(c);if(c=r||0!==c?c:0,a&&d==d){for(var h=l;h--;)if(e[h]===d)continue t;s.push(c)}else o(e,d,r)||s.push(c)}return s}var dl=Nr((function(t,e){return Js(t)?cl(t,Fi(e,1,Js,!0)):[]}));function hl(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}var pl=Nr((function(t,e){var n=hl(e);return Js(n)&&(n=void 0),Js(t)?cl(t,Fi(e,1,Js,!0),Ts(n)):[]})),fl=Nr((function(t,e){var n=hl(e);return Js(n)&&(n=void 0),Js(t)?cl(t,Fi(e,1,Js,!0),void 0,n):[]})),vl=oe((function(t,e){return t/e}),1);function gl(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?so(t,r?0:o,r?o+1:i):so(t,r?o+1:0,r?i:o)}function yl(t){return"function"==typeof t?t:we}function ml(t,e){return(te(t)?En:Ds)(t,yl(e))}function bl(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}var xl=Os(!0);function _l(t,e){return t&&xl(t,e,ii)}var wl=Rs(_l,!0);function Ml(t,e){return(te(t)?bl:wl)(t,yl(e))}function El(t){return function(e){var n=qa(e);return"[object Map]"==n?Gu(e):"[object Set]"==n?function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}(e):function(t,e){return Qt(e,(function(e){return[e,t[e]]}))}(e,t(e))}}var Nl=El(ii),Sl=El(li),Al=ko({"&":"&","<":"<",">":">",'"':""","'":"'"}),Pl=/[&<>"']/g,Tl=RegExp(Pl.source);function kl(t){return(t=Ci(t))&&Tl.test(t)?t.replace(Pl,Al):t}var Cl=/[\\^$.*+?()[\]{}|]/g,Ol=RegExp(Cl.source);function Il(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function jl(t,e){var n=!0;return Ds(t,(function(t,r,i){return n=!!e(t,r,i)})),n}var Rl=4294967295;function Dl(t){return t?ga(_e(t),0,Rl):0}function Ll(t,e){var n=[];return Ds(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function Bl(t){return function(e,n,r){var i=Object(e);if(!Pr(e)){var o=Ts(n);e=ii(e),n=function(t){return o(i[t],t,i)}}var a=t(e,n,r);return a>-1?i[o?e[a]:a]:void 0}}var zl=Math.max;function Wl(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:_e(n);return i<0&&(i=zl(r+i,0)),Nn(t,Ts(e),i)}var Fl=Bl(Wl);function Gl(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}var Hl=Math.max,Xl=Math.min;function Ul(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=_e(n),i=n<0?Hl(r+i,0):Xl(i,r-1)),Nn(t,Ts(e),i,!0)}var Vl=Bl(Ul);function ql(t){return t&&t.length?t[0]:void 0}function Yl(t,e){var n=-1,r=Pr(t)?Array(t.length):[];return Ds(t,(function(t,i,o){r[++n]=e(t,i,o)})),r}function Zl(t,e){return(te(t)?Qt:Yl)(t,Ts(e))}var Kl=da("floor");function $l(t){return Hi((function(e){var n=e.length,r=n,i=sn.prototype.thru;for(t&&e.reverse();r--;){var o=e[r];if("function"!=typeof o)throw new TypeError("Expected a function");if(i&&!a&&"wrapper"==un(o))var a=new sn([],!0)}for(r=a?r:n;++r<n;){var u=un(o=e[r]),s="wrapper"==u?rn(o):void 0;a=s&&pn(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?a[un(s[0])].apply(a,s[3]):1==o.length&&pn(o)?a[u]():a.thru(o)}return function(){var t=arguments,r=t[0];if(a&&1==t.length&&te(r))return a.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}var Jl=$l(),Ql=$l(!0);function tc(t,e){return Ea(e,(function(e){return Ae(t[e])}))}var ec=Object.prototype.hasOwnProperty,nc=Bs((function(t,e,n){ec.call(t,n)?t[n].push(e):mr(t,n,[e])}));function rc(t,e){return t>e}function ic(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ye(e),n=ye(n)),t(e,n)}}var oc=ic(rc),ac=ic((function(t,e){return t>=e})),uc=Object.prototype.hasOwnProperty;function sc(t,e){return null!=t&&uc.call(t,e)}function lc(t,e){return null!=t&&ws(t,e,sc)}var cc=Math.max,dc=Math.min;var hc="[object String]";function pc(t){return"string"==typeof t||!te(t)&&Yt(t)&&qt(t)==hc}function fc(t,e){return Qt(e,(function(e){return t[e]}))}function vc(t){return null==t?[]:fc(t,ii(t))}var gc=Math.max;var yc=Math.max;var mc=Math.min;function bc(t,e,n){for(var r=n?sl:Pn,i=t[0].length,o=t.length,a=o,u=Array(o),s=1/0,l=[];a--;){var c=t[a];a&&e&&(c=Qt(c,Ur(e))),s=mc(c.length,s),u[a]=!n&&(e||i>=120&&c.length>=120)?new Du(a&&c):void 0}c=t[0];var d=-1,h=u[0];t:for(;++d<i&&l.length<s;){var p=c[d],f=e?e(p):p;if(p=n||0!==p?p:0,!(h?Bu(h,f):r(l,f,n))){for(a=o;--a;){var v=u[a];if(!(v?Bu(v,f):r(t[a],f,n)))continue t}h&&h.push(f),l.push(p)}}return l}function xc(t){return Js(t)?t:[]}var _c=Nr((function(t){var e=Qt(t,xc);return e.length&&e[0]===t[0]?bc(e):[]})),wc=Nr((function(t){var e=hl(t),n=Qt(t,xc);return e===hl(n)?e=void 0:n.pop(),n.length&&n[0]===t[0]?bc(n,Ts(e)):[]})),Mc=Nr((function(t){var e=hl(t),n=Qt(t,xc);return(e="function"==typeof e?e:void 0)&&n.pop(),n.length&&n[0]===t[0]?bc(n,void 0,e):[]}));function Ec(t,e){return function(n,r){return function(t,e,n,r){return js(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}var Nc=Object.prototype.toString,Sc=Ec((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Nc.call(e)),t[e]=n}),xn(we)),Ac=Object.prototype,Pc=Ac.hasOwnProperty,Tc=Ac.toString,kc=Ec((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Tc.call(e)),Pc.call(t,e)?t[e].push(n):t[e]=[n]}),Ts);function Cc(t,e){return e.length<2?t:Ri(t,so(e,0,-1))}function Oc(t,e,n){var r=null==(t=Cc(t,e=Oi(e,t)))?t:t[ji(hl(e))];return null==r?void 0:Ye(r,t,n)}var Ic=Nr(Oc),jc=Nr((function(t,e,n){var r=-1,i="function"==typeof e,o=Pr(t)?Array(t.length):[];return Ds(t,(function(t){o[++r]=i?Ye(e,t,n):Oc(t,e,n)})),o}));var Rc=Zr&&Zr.isArrayBuffer,Dc=Rc?Ur(Rc):function(t){return Yt(t)&&"[object ArrayBuffer]"==qt(t)};var Lc=Zr&&Zr.isDate,Bc=Lc?Ur(Lc):function(t){return Yt(t)&&"[object Date]"==qt(t)};var zc=Object.prototype.hasOwnProperty;var Wc=Lt.isFinite;function Fc(t){return"number"==typeof t&&t==_e(t)}var Gc="[object Number]";function Hc(t){return"number"==typeof t||Yt(t)&&qt(t)==Gc}var Xc=Te?Ae:zr;var Uc=Zr&&Zr.isRegExp,Vc=Uc?Ur(Uc):function(t){return Yt(t)&&"[object RegExp]"==qt(t)},qc=9007199254740991;var Yc=Array.prototype.join;var Zc=ua((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Kc=Bs((function(t,e,n){mr(t,n,e)}));var $c=Math.max,Jc=Math.min;var Qc=ua((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),td=So("toLowerCase");function ed(t,e){return t<e}var nd=ic(ed),rd=ic((function(t,e){return t<=e}));function id(t,e,n){for(var r=-1,i=t.length;++r<i;){var o=t[r],a=e(o);if(null!=a&&(void 0===u?a==a&&!Kt(a):n(a,u)))var u=a,s=o}return s}function od(t,e){for(var n,r=-1,i=t.length;++r<i;){var o=e(t[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n}var ad=NaN;function ud(t,e){var n=null==t?0:t.length;return n?od(t,e)/n:ad}var sd=kr((function(t,e,n){el(t,e,n)})),ld=Nr((function(t,e){return function(n){return Oc(n,t,e)}})),cd=Nr((function(t,e){return function(n){return Oc(t,n,e)}}));function dd(t,e,n){var r=ii(e),i=tc(e,r),o=!(de(n)&&"chain"in n&&!n.chain),a=Ae(t);return En(i,(function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=ln(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Bi([this.value()],arguments))})})),t}var hd=oe((function(t,e){return t*e}),1),pd="Expected a function";function fd(t){if("function"!=typeof t)throw new TypeError(pd);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var vd="[object Map]",gd="[object Set]",yd=Bt?Bt.iterator:void 0;function md(t){if(!t)return[];if(Pr(t))return pc(t)?No(t):ln(t);if(yd&&t[yd])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[yd]());var e=qa(t);return(e==vd?Gu:e==gd?Hu:vc)(t)}function bd(t,e){var n=t.length;if(n)return Fn(e+=e<0?n:0,n)?t[e]:void 0}function xd(t,e){return null==(t=Cc(t,e=Oi(e,t)))||delete t[ji(hl(e))]}function _d(t){return Ji(t)?void 0:t}var wd=Hi((function(t,e){var n={};if(null==t)return n;var r=!1;e=Qt(e,(function(e){return e=Oi(e,t),r||(r=e.length>1),e})),wr(t,Oa(t),n),r&&(n=ju(n,7,_d));for(var i=e.length;i--;)xd(n,e[i]);return n}));function Md(t,e,n,r){if(!de(t))return t;for(var i=-1,o=(e=Oi(e,t)).length,a=o-1,u=t;null!=u&&++i<o;){var s=ji(e[i]),l=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return t;if(i!=a){var c=u[s];void 0===(l=r?r(c,s,u):void 0)&&(l=de(c)?c:Fn(e[i+1])?[]:{})}_r(u,s,l),u=u[s]}return t}function Ed(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],u=Ri(t,a);n(u,a)&&Md(o,Oi(a,t),u)}return o}function Nd(t,e){if(null==t)return{};var n=Qt(Oa(t),(function(t){return[t]}));return e=Ts(e),Ed(t,n,(function(t,n){return e(t,n[0])}))}function Sd(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,o=Kt(t),a=void 0!==e,u=null===e,s=e==e,l=Kt(e);if(!u&&!l&&!o&&t>e||o&&a&&s&&!u&&!l||r&&a&&s||!n&&s||!i)return 1;if(!r&&!o&&!l&&t<e||l&&n&&i&&!r&&!o||u&&n&&i||!a&&i||!s)return-1}return 0}function Ad(t,e,n){e=e.length?Qt(e,(function(t){return te(t)?function(e){return Ri(e,1===t.length?t[0]:t)}:t})):[we];var r=-1;e=Qt(e,Ur(Ts));var i=Yl(t,(function(t,n,i){var o=Qt(e,(function(e){return e(t)}));return{criteria:o,index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,u=n.length;++r<a;){var s=Sd(i[r],o[r]);if(s)return r>=u?s:s*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function Pd(t){return Hi((function(e){return e=Qt(e,Ur(Ts)),Nr((function(n){var r=this;return t(e,(function(t){return Ye(t,r,n)}))}))}))}var Td=Pd(Qt),kd=Nr,Cd=Math.min,Od=kd((function(t,e){var n=(e=1==e.length&&te(e[0])?Qt(e[0],Ur(Ts)):Qt(Fi(e,1),Ur(Ts))).length;return Nr((function(r){for(var i=-1,o=Cd(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return Ye(t,this,r)}))})),Id=Pd(Il),jd=Pd(Lu),Rd=9007199254740991,Dd=Math.floor;function Ld(t,e){var n="";if(!t||e<1||e>Rd)return n;do{e%2&&(n+=t),(e=Dd(e/2))&&(t+=t)}while(e);return n}var Bd=As("length"),zd="\\ud800-\\udfff",Wd="["+zd+"]",Fd="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Gd="\\ud83c[\\udffb-\\udfff]",Hd="[^"+zd+"]",Xd="(?:\\ud83c[\\udde6-\\uddff]){2}",Ud="[\\ud800-\\udbff][\\udc00-\\udfff]",Vd="(?:"+Fd+"|"+Gd+")"+"?",qd="[\\ufe0e\\ufe0f]?",Yd=qd+Vd+("(?:\\u200d(?:"+[Hd,Xd,Ud].join("|")+")"+qd+Vd+")*"),Zd="(?:"+[Hd+Fd+"?",Fd,Xd,Ud,Wd].join("|")+")",Kd=RegExp(Gd+"(?="+Gd+")|"+Zd+Yd,"g");function $d(t){return ho(t)?function(t){for(var e=Kd.lastIndex=0;Kd.test(t);)++e;return e}(t):Bd(t)}var Jd=Math.ceil;function Qd(t,e){var n=(e=void 0===e?" ":ie(e)).length;if(n<2)return n?Ld(e,t):e;var r=Ld(e,Jd(t/$d(e)));return ho(e)?lo(No(r),0,t).join(""):r.slice(0,t)}var th=Math.ceil,eh=Math.floor;var nh=/^\s+/,rh=Lt.parseInt;var ih=Nr((function(t,e){return vr(t,32,void 0,e,Xn(e,Bn(ih)))}));ih.placeholder={};var oh=Nr((function(t,e){return vr(t,64,void 0,e,Xn(e,Bn(oh)))}));oh.placeholder={};var ah=Bs((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var uh=Hi((function(t,e){return null==t?{}:function(t,e){return Ed(t,e,(function(e,n){return Ms(t,n)}))}(t,e)}));function sh(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}var lh=Array.prototype.splice;function ch(t,e,n,r){var i=r?sh:An,o=-1,a=e.length,u=t;for(t===e&&(e=ln(e)),n&&(u=Qt(t,Ur(n)));++o<a;)for(var s=0,l=e[o],c=n?n(l):l;(s=i(u,c,s,r))>-1;)u!==t&&lh.call(u,s,1),lh.call(t,s,1);return t}function dh(t,e){return t&&t.length&&e&&e.length?ch(t,e):t}var hh=Nr(dh);var ph=Array.prototype.splice;function fh(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;Fn(i)?ph.call(t,i,1):xd(t,i)}}return t}var vh=Hi((function(t,e){var n=null==t?0:t.length,r=Li(t,e);return fh(t,Qt(e,(function(t){return Fn(t,n)?+t:t})).sort(Sd)),r})),gh=Math.floor,yh=Math.random;function mh(t,e){return t+gh(yh()*(e-t+1))}var bh=parseFloat,xh=Math.min,_h=Math.random;var wh=Math.ceil,Mh=Math.max;function Eh(t){return function(e,n,r){return r&&"number"!=typeof r&&Tr(e,n,r)&&(n=r=void 0),e=xe(e),void 0===n?(n=e,e=0):n=xe(n),function(t,e,n,r){for(var i=-1,o=Mh(wh((e-t)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=t,t+=n;return a}(e,n,r=void 0===r?e<n?1:-1:xe(r),t)}}var Nh=Eh(),Sh=Eh(!0),Ah=Hi((function(t,e){return vr(t,256,void 0,void 0,void 0,e)}));function Ph(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Th(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}var kh=Array.prototype.reverse;function Ch(t){return null==t?t:kh.call(t)}var Oh=da("round");function Ih(t){var e=t.length;return e?t[mh(0,e-1)]:void 0}function jh(t){return Ih(vc(t))}function Rh(t,e){var n=-1,r=t.length,i=r-1;for(e=void 0===e?r:e;++n<e;){var o=mh(n,i),a=t[o];t[o]=t[n],t[n]=a}return t.length=e,t}function Dh(t,e){return Rh(ln(t),ga(e,0,t.length))}function Lh(t,e){var n=vc(t);return Rh(n,ga(e,0,n.length))}function Bh(t){return Rh(ln(t))}function zh(t){return Rh(vc(t))}var Wh=ua((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));function Fh(t,e){var n;return Ds(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}var Gh=Nr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&Tr(t,e[0],e[1])?e=[]:n>2&&Tr(e[0],e[1],e[2])&&(e=[e[0]]),Ad(t,Fi(e,1),[])})),Hh=4294967294,Xh=Math.floor,Uh=Math.min;function Vh(t,e,n,r){var i=0,o=null==t?0:t.length;if(0===o)return 0;for(var a=(e=n(e))!=e,u=null===e,s=Kt(e),l=void 0===e;i<o;){var c=Xh((i+o)/2),d=n(t[c]),h=void 0!==d,p=null===d,f=d==d,v=Kt(d);if(a)var g=r||f;else g=l?f&&(r||h):u?f&&h&&(r||!p):s?f&&h&&!p&&(r||!v):!p&&!v&&(r?d<=e:d<e);g?i=c+1:o=c}return Uh(o,Hh)}var qh=2147483647;function Yh(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=qh){for(;r<i;){var o=r+i>>>1,a=t[o];null!==a&&!Kt(a)&&(n?a<=e:a<e)?r=o+1:i=o}return i}return Vh(t,e,we,n)}function Zh(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n],u=e?e(a):a;if(!n||!br(u,s)){var s=u;o[i++]=0===a?0:a}}return o}var Kh=Math.max;var $h=ua((function(t,e,n){return t+(n?" ":"")+Ao(e)}));var Jh=oe((function(t,e){return t-e}),0);var Qh=Object.prototype,tp=Qh.hasOwnProperty;function ep(t,e,n,r){return void 0===t||br(t,Qh[n])&&!tp.call(r,n)?e:t}var np={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function rp(t){return"\\"+np[t]}var ip=/<%=([\s\S]+?)%>/g,op={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:ip,variable:"",imports:{_:{escape:kl}}},ap=/\b__p \+= '';/g,up=/\b(__p \+=) '' \+/g,sp=/(__e\(.*?\)|\b__t\)) \+\n'';/g,lp=/[()=,{}\[\]\/\s]/,cp=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dp=/($^)/,hp=/['\n\r\u2028\u2029\\]/g,pp=Object.prototype.hasOwnProperty;function fp(t,e){return e(t)}var vp=4294967295,gp=Math.min;function yp(t,e){var n=t;return n instanceof en&&(n=n.value()),To(e,(function(t,e){return e.func.apply(e.thisArg,Bi([t],e.args))}),n)}function mp(){return yp(this.__wrapped__,this.__actions__)}var bp=9007199254740991;function xp(t,e){for(var n=t.length;n--&&An(e,t[n],0)>-1;);return n}function _p(t,e){for(var n=-1,r=t.length;++n<r&&An(e,t[n],0)>-1;);return n}var wp=/^\s+/;var Mp=/\w*$/;var Ep=ko({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Np=/&(?:amp|lt|gt|quot|#39);/g,Sp=RegExp(Np.source);var Ap=Ra&&1/Hu(new Ra([,-0]))[1]==1/0?function(t){return new Ra(t)}:nn,Pp=200;function Tp(t,e,n){var r=-1,i=Pn,o=t.length,a=!0,u=[],s=u;if(n)a=!1,i=sl;else if(o>=Pp){var l=e?null:Ap(t);if(l)return Hu(l);a=!1,i=Bu,s=new Du}else s=e?[]:u;t:for(;++r<o;){var c=t[r],d=e?e(c):c;if(c=n||0!==c?c:0,a&&d==d){for(var h=s.length;h--;)if(s[h]===d)continue t;e&&s.push(d),u.push(c)}else i(s,d,n)||(s!==u&&s.push(d),u.push(c))}return u}var kp=Nr((function(t){return Tp(Fi(t,1,Js,!0))})),Cp=Nr((function(t){var e=hl(t);return Js(e)&&(e=void 0),Tp(Fi(t,1,Js,!0),Ts(e))})),Op=Nr((function(t){var e=hl(t);return e="function"==typeof e?e:void 0,Tp(Fi(t,1,Js,!0),void 0,e)}));var Ip=0;var jp=Math.max;function Rp(t){if(!t||!t.length)return[];var e=0;return t=Ea(t,(function(t){if(Js(t))return e=jp(t.length,e),!0})),Ir(e,(function(e){return Qt(t,As(e))}))}function Dp(t,e){if(!t||!t.length)return[];var n=Rp(t);return null==e?n:Qt(n,(function(t){return Ye(e,void 0,t)}))}function Lp(t,e,n,r){return Md(t,e,n(Ri(t,e)),r)}var Bp=ua((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}));var zp=Nr((function(t,e){return Js(t)?cl(t,e):[]}));var Wp=Hi((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return Li(e,t)};return!(e>1||this.__actions__.length)&&r instanceof en&&Fn(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fp,args:[i],thisArg:void 0}),new sn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(i)}));function Fp(t,e,n){var r=t.length;if(r<2)return r?Tp(t[0]):[];for(var i=-1,o=Array(r);++i<r;)for(var a=t[i],u=-1;++u<r;)u!=i&&(o[i]=cl(o[i]||a,t[u],e,n));return Tp(Fi(o,1),e,n)}var Gp=Nr((function(t){return Fp(Ea(t,Js))})),Hp=Nr((function(t){var e=hl(t);return Js(e)&&(e=void 0),Fp(Ea(t,Js),Ts(e))})),Xp=Nr((function(t){var e=hl(t);return e="function"==typeof e?e:void 0,Fp(Ea(t,Js),void 0,e)})),Up=Nr(Rp);function Vp(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r<i;){var u=r<o?e[r]:void 0;n(a,t[r],u)}return a}var qp=Nr((function(t){var e=t.length,n=e>1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Dp(t,n)})),Yp={chunk:function(t,e,n){e=(n?Tr(t,e,n):void 0===e)?1:va(_e(e),0);var r=null==t?0:t.length;if(!r||e<1)return[];for(var i=0,o=0,a=Array(fa(r/e));i<r;)a[o++]=so(t,i,i+=e);return a},compact:function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},concat:function(){var t=arguments.length;if(!t)return[];for(var e=Array(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return Bi(te(n)?ln(n):[n],Fi(e,1))},difference:dl,differenceBy:pl,differenceWith:fl,drop:function(t,e,n){var r=null==t?0:t.length;return r?so(t,(e=n||void 0===e?1:_e(e))<0?0:e,r):[]},dropRight:function(t,e,n){var r=null==t?0:t.length;return r?so(t,0,(e=r-(e=n||void 0===e?1:_e(e)))<0?0:e):[]},dropRightWhile:function(t,e){return t&&t.length?gl(t,Ts(e),!0,!0):[]},dropWhile:function(t,e){return t&&t.length?gl(t,Ts(e),!0):[]},fill:function(t,e,n,r){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&Tr(t,e,n)&&(n=0,r=i),function(t,e,n,r){var i=t.length;for((n=_e(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:_e(r))<0&&(r+=i),r=n>r?0:Dl(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},findIndex:Wl,findLastIndex:Ul,first:ql,flatten:Gi,flattenDeep:function(t){return(null==t?0:t.length)?Fi(t,Infinity):[]},flattenDepth:function(t,e){return(null==t?0:t.length)?Fi(t,e=void 0===e?1:_e(e)):[]},fromPairs:function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},head:ql,indexOf:function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:_e(n);return i<0&&(i=yc(r+i,0)),An(t,e,i)},initial:function(t){return(null==t?0:t.length)?so(t,0,-1):[]},intersection:_c,intersectionBy:wc,intersectionWith:Mc,join:function(t,e){return null==t?"":Yc.call(t,e)},last:hl,lastIndexOf:function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=_e(n))<0?$c(r+i,0):Jc(i,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,i):Nn(t,Sn,i,!0)},nth:function(t,e){return t&&t.length?bd(t,_e(e)):void 0},pull:hh,pullAll:dh,pullAllBy:function(t,e,n){return t&&t.length&&e&&e.length?ch(t,e,Ts(n)):t},pullAllWith:function(t,e,n){return t&&t.length&&e&&e.length?ch(t,e,void 0,n):t},pullAt:vh,remove:function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=Ts(e);++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return fh(t,i),n},reverse:Ch,slice:function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&Tr(t,e,n)?(e=0,n=r):(e=null==e?0:_e(e),n=void 0===n?r:_e(n)),so(t,e,n)):[]},sortedIndex:function(t,e){return Yh(t,e)},sortedIndexBy:function(t,e,n){return Vh(t,e,Ts(n))},sortedIndexOf:function(t,e){var n=null==t?0:t.length;if(n){var r=Yh(t,e);if(r<n&&br(t[r],e))return r}return-1},sortedLastIndex:function(t,e){return Yh(t,e,!0)},sortedLastIndexBy:function(t,e,n){return Vh(t,e,Ts(n),!0)},sortedLastIndexOf:function(t,e){if(null==t?0:t.length){var n=Yh(t,e,!0)-1;if(br(t[n],e))return n}return-1},sortedUniq:function(t){return t&&t.length?Zh(t):[]},sortedUniqBy:function(t,e){return t&&t.length?Zh(t,Ts(e)):[]},tail:function(t){var e=null==t?0:t.length;return e?so(t,1,e):[]},take:function(t,e,n){return t&&t.length?so(t,0,(e=n||void 0===e?1:_e(e))<0?0:e):[]},takeRight:function(t,e,n){var r=null==t?0:t.length;return r?so(t,(e=r-(e=n||void 0===e?1:_e(e)))<0?0:e,r):[]},takeRightWhile:function(t,e){return t&&t.length?gl(t,Ts(e),!1,!0):[]},takeWhile:function(t,e){return t&&t.length?gl(t,Ts(e)):[]},union:kp,unionBy:Cp,unionWith:Op,uniq:function(t){return t&&t.length?Tp(t):[]},uniqBy:function(t,e){return t&&t.length?Tp(t,Ts(e)):[]},uniqWith:function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Tp(t,void 0,e):[]},unzip:Rp,unzipWith:Dp,without:zp,xor:Gp,xorBy:Hp,xorWith:Xp,zip:Up,zipObject:function(t,e){return Vp(t||[],e||[],_r)},zipObjectDeep:function(t,e){return Vp(t||[],e||[],Md)},zipWith:qp},Zp={countBy:Ws,each:ml,eachRight:Ml,every:function(t,e,n){var r=te(t)?Il:jl;return n&&Tr(t,e,n)&&(e=void 0),r(t,Ts(e))},filter:function(t,e){return(te(t)?Ea:Ll)(t,Ts(e))},find:Fl,findLast:Vl,flatMap:function(t,e){return Fi(Zl(t,e),1)},flatMapDeep:function(t,e){return Fi(Zl(t,e),Infinity)},flatMapDepth:function(t,e,n){return n=void 0===n?1:_e(n),Fi(Zl(t,e),n)},forEach:ml,forEachRight:Ml,groupBy:nc,includes:function(t,e,n,r){t=Pr(t)?t:vc(t),n=n&&!r?_e(n):0;var i=t.length;return n<0&&(n=gc(i+n,0)),pc(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&An(t,e,n)>-1},invokeMap:jc,keyBy:Kc,map:Zl,orderBy:function(t,e,n,r){return null==t?[]:(te(e)||(e=null==e?[]:[e]),te(n=r?void 0:n)||(n=null==n?[]:[n]),Ad(t,e,n))},partition:ah,reduce:function(t,e,n){var r=te(t)?To:Ph,i=arguments.length<3;return r(t,Ts(e),n,i,Ds)},reduceRight:function(t,e,n){var r=te(t)?Th:Ph,i=arguments.length<3;return r(t,Ts(e),n,i,wl)},reject:function(t,e){return(te(t)?Ea:Ll)(t,fd(Ts(e)))},sample:function(t){return(te(t)?Ih:jh)(t)},sampleSize:function(t,e,n){return e=(n?Tr(t,e,n):void 0===e)?1:_e(e),(te(t)?Dh:Lh)(t,e)},shuffle:function(t){return(te(t)?Bh:zh)(t)},size:function(t){if(null==t)return 0;if(Pr(t))return pc(t)?$d(t):t.length;var e=qa(t);return"[object Map]"==e||"[object Set]"==e?t.size:ri(t).length},some:function(t,e,n){var r=te(t)?Lu:Fh;return n&&Tr(t,e,n)&&(e=void 0),r(t,Ts(e))},sortBy:Gh},Kp=Hs,$p={after:function(t,e){if("function"!=typeof e)throw new TypeError("Expected a function");return t=_e(t),function(){if(--t<1)return e.apply(this,arguments)}},ary:yr,before:io,bind:oo,bindKey:uo,curry:Fs,curryRight:Gs,debounce:qs,defer:al,delay:ul,flip:function(t){return vr(t,512)},memoize:Ai,negate:fd,once:function(t){return io(2,t)},overArgs:Od,partial:ih,partialRight:oh,rearg:Ah,rest:function(t,e){if("function"!=typeof t)throw new TypeError("Expected a function");return Nr(t,e=void 0===e?e:_e(e))},spread:function(t,e){if("function"!=typeof t)throw new TypeError("Expected a function");return e=null==e?0:Kh(_e(e),0),Nr((function(n){var r=n[e],i=lo(n,0,e);return r&&Bi(i,r),Ye(t,this,i)}))},throttle:function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return de(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),qs(t,e,{leading:r,maxWait:e,trailing:i})},unary:function(t){return yr(t,1)},wrap:function(t,e){return ih(yl(e),t)}},Jp={castArray:function(){if(!arguments.length)return[];var t=arguments[0];return te(t)?t:[t]},clone:function(t){return ju(t,4)},cloneDeep:Ru,cloneDeepWith:function(t,e){return ju(t,5,e="function"==typeof e?e:void 0)},cloneWith:function(t,e){return ju(t,4,e="function"==typeof e?e:void 0)},conformsTo:function(t,e){return null==e||ks(t,e,ii(e))},eq:br,gt:oc,gte:ac,isArguments:Br,isArray:te,isArrayBuffer:Dc,isArrayLike:Pr,isArrayLikeObject:Js,isBoolean:function(t){return!0===t||!1===t||Yt(t)&&"[object Boolean]"==qt(t)},isBuffer:Hr,isDate:Bc,isElement:function(t){return Yt(t)&&1===t.nodeType&&!Ji(t)},isEmpty:function(t){if(null==t)return!0;if(Pr(t)&&(te(t)||"string"==typeof t||"function"==typeof t.splice||Hr(t)||$r(t)||Br(t)))return!t.length;var e=qa(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(Or(t))return!ri(t).length;for(var n in t)if(zc.call(t,n))return!1;return!0},isEqual:function(t,e){return ps(t,e)},isEqualWith:function(t,e,n){var r=(n="function"==typeof n?n:void 0)?n(t,e):void 0;return void 0===r?ps(t,e,void 0,n):!!r},isError:eo,isFinite:function(t){return"number"==typeof t&&Wc(t)},isFunction:Ae,isInteger:Fc,isLength:Ar,isMap:Mu,isMatch:function(t,e){return t===e||gs(t,e,ms(e))},isMatchWith:function(t,e,n){return n="function"==typeof n?n:void 0,gs(t,e,ms(e),n)},isNaN:function(t){return Hc(t)&&t!=+t},isNative:function(t){if(Xc(t))throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return ze(t)},isNil:function(t){return null==t},isNull:function(t){return null===t},isNumber:Hc,isObject:de,isObjectLike:Yt,isPlainObject:Ji,isRegExp:Vc,isSafeInteger:function(t){return Fc(t)&&t>=-9007199254740991&&t<=qc},isSet:Nu,isString:pc,isSymbol:Kt,isTypedArray:$r,isUndefined:function(t){return void 0===t},isWeakMap:function(t){return Yt(t)&&"[object WeakMap]"==qa(t)},isWeakSet:function(t){return Yt(t)&&"[object WeakSet]"==qt(t)},lt:nd,lte:rd,toArray:md,toFinite:xe,toInteger:_e,toLength:Dl,toNumber:ye,toPlainObject:tl,toSafeInteger:function(t){return t?ga(_e(t),-9007199254740991,bp):0===t?t:0},toString:Ci},Qp={add:ae,ceil:ha,divide:vl,floor:Kl,max:function(t){return t&&t.length?id(t,we,rc):void 0},maxBy:function(t,e){return t&&t.length?id(t,Ts(e),rc):void 0},mean:function(t){return ud(t,we)},meanBy:function(t,e){return ud(t,Ts(e))},min:function(t){return t&&t.length?id(t,we,ed):void 0},minBy:function(t,e){return t&&t.length?id(t,Ts(e),ed):void 0},multiply:hd,round:Oh,subtract:Jh,sum:function(t){return t&&t.length?od(t,we):0},sumBy:function(t,e){return t&&t.length?od(t,Ts(e)):0}},tf=function(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=ye(n))==n?n:0),void 0!==e&&(e=(e=ye(e))==e?e:0),ga(ye(t),e,n)},ef=function(t,e,n){return e=xe(e),void 0===n?(n=e,e=0):n=xe(n),function(t,e,n){return t>=dc(e,n)&&t<cc(e,n)}(t=ye(t),e,n)},nf=function(t,e,n){if(n&&"boolean"!=typeof n&&Tr(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=xe(t),void 0===e?(e=t,t=0):e=xe(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var i=_h();return xh(t+i*(e-t+bh("1e-"+((i+"").length-1))),e)}return mh(t,e)},rf={assign:ai,assignIn:ci,assignInWith:di,assignWith:hi,at:Xi,create:function(t,e){var n=Ue(t);return null==e?n:ma(n,e)},defaults:Ks,defaultsDeep:il,entries:Nl,entriesIn:Sl,extend:ci,extendWith:di,findKey:function(t,e){return Gl(t,Ts(e),js)},findLastKey:function(t,e){return Gl(t,Ts(e),_l)},forIn:function(t,e){return null==t?t:Is(t,yl(e),li)},forInRight:function(t,e){return null==t?t:xl(t,yl(e),li)},forOwn:function(t,e){return t&&js(t,yl(e))},forOwnRight:function(t,e){return t&&_l(t,yl(e))},functions:function(t){return null==t?[]:tc(t,ii(t))},functionsIn:function(t){return null==t?[]:tc(t,li(t))},get:Di,has:lc,hasIn:Ms,invert:Sc,invertBy:kc,invoke:Ic,keys:ii,keysIn:li,mapKeys:function(t,e){var n={};return e=Ts(e),js(t,(function(t,r,i){mr(n,e(t,r,i),t)})),n},mapValues:function(t,e){var n={};return e=Ts(e),js(t,(function(t,r,i){mr(n,r,e(t,r,i))})),n},merge:sd,mergeWith:rl,omit:wd,omitBy:function(t,e){return Nd(t,fd(Ts(e)))},pick:uh,pickBy:Nd,result:function(t,e,n){var r=-1,i=(e=Oi(e,t)).length;for(i||(i=1,t=void 0);++r<i;){var o=null==t?void 0:t[ji(e[r])];void 0===o&&(r=i,o=n),t=Ae(o)?o.call(t):o}return t},set:function(t,e,n){return null==t?t:Md(t,e,n)},setWith:function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:Md(t,e,n,r)},toPairs:Nl,toPairsIn:Sl,transform:function(t,e,n){var r=te(t),i=r||Hr(t)||$r(t);if(e=Ts(e),null==n){var o=t&&t.constructor;n=i?r?new o:[]:de(t)&&Ae(o)?Ue(Ui(t)):{}}return(i?En:js)(t,(function(t,r,i){return e(n,t,r,i)})),n},unset:function(t,e){return null==t||xd(t,e)},update:function(t,e,n){return null==t?t:Lp(t,e,yl(n))},updateWith:function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:Lp(t,e,yl(n),r)},values:vc,valuesIn:function(t){return null==t?[]:fc(t,li(t))}},of={at:Wp,chain:pa,commit:function(){return new sn(this.value(),this.__chain__)},lodash:hn,next:function(){void 0===this.__values__&&(this.__values__=md(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},plant:function(t){for(var e,n=this;n instanceof Qe;){var r=cn(n);r.__index__=0,r.__values__=void 0,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e},reverse:function(){var t=this.__wrapped__;if(t instanceof en){var e=t;return this.__actions__.length&&(e=new en(this)),(e=e.reverse()).__actions__.push({func:fp,args:[Ch],thisArg:void 0}),new sn(e,this.__chain__)}return this.thru(Ch)},tap:function(t,e){return e(t),t},thru:fp,toIterator:function(){return this},toJSON:mp,value:mp,valueOf:mp,wrapperChain:function(){return pa(this)}},af={camelCase:sa,capitalize:Po,deburr:jo,endsWith:function(t,e,n){t=Ci(t),e=ie(e);var r=t.length,i=n=void 0===n?r:ga(_e(n),0,r);return(n-=e.length)>=0&&t.slice(n,i)==e},escape:kl,escapeRegExp:function(t){return(t=Ci(t))&&Ol.test(t)?t.replace(Cl,"\\$&"):t},kebabCase:Zc,lowerCase:Qc,lowerFirst:td,pad:function(t,e,n){t=Ci(t);var r=(e=_e(e))?$d(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Qd(eh(i),n)+t+Qd(th(i),n)},padEnd:function(t,e,n){t=Ci(t);var r=(e=_e(e))?$d(t):0;return e&&r<e?t+Qd(e-r,n):t},padStart:function(t,e,n){t=Ci(t);var r=(e=_e(e))?$d(t):0;return e&&r<e?Qd(e-r,n)+t:t},parseInt:function(t,e,n){return n||null==e?e=0:e&&(e=+e),rh(Ci(t).replace(nh,""),e||0)},repeat:function(t,e,n){return e=(n?Tr(t,e,n):void 0===e)?1:_e(e),Ld(Ci(t),e)},replace:function(){var t=arguments,e=Ci(t[0]);return t.length<3?e:e.replace(t[1],t[2])},snakeCase:Wh,split:function(t,e,n){return n&&"number"!=typeof n&&Tr(t,e,n)&&(e=n=void 0),(n=void 0===n?4294967295:n>>>0)?(t=Ci(t))&&("string"==typeof e||null!=e&&!Vc(e))&&!(e=ie(e))&&ho(t)?lo(No(t),0,n):t.split(e,n):[]},startCase:$h,startsWith:function(t,e,n){return t=Ci(t),n=null==n?0:ga(_e(n),0,t.length),e=ie(e),t.slice(n,n+e.length)==e},template:function(t,e,n){var r=op.imports._.templateSettings||op;n&&Tr(t,e,n)&&(e=void 0),t=Ci(t),e=di({},e,r,ep);var i,o,a=di({},e.imports,r.imports,ep),u=ii(a),s=fc(a,u),l=0,c=e.interpolate||dp,d="__p += '",h=RegExp((e.escape||dp).source+"|"+c.source+"|"+(c===ip?cp:dp).source+"|"+(e.evaluate||dp).source+"|$","g"),p=pp.call(e,"sourceURL")?"//# sourceURL="+(e.sourceURL+"").replace(/\s/g," ")+"\n":"";t.replace(h,(function(e,n,r,a,u,s){return r||(r=a),d+=t.slice(l,s).replace(hp,rp),n&&(i=!0,d+="' +\n__e("+n+") +\n'"),u&&(o=!0,d+="';\n"+u+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=s+e.length,e})),d+="';\n";var f=pp.call(e,"variable")&&e.variable;if(f){if(lp.test(f))throw new Error("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(ap,""):d).replace(up,"$1").replace(sp,"$1;"),d="function("+(f||"obj")+") {\n"+(f?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var v=no((function(){return Function(u,p+"return "+d).apply(void 0,s)}));if(v.source=d,eo(v))throw v;return v},templateSettings:op,toLower:function(t){return Ci(t).toLowerCase()},toUpper:function(t){return Ci(t).toUpperCase()},trim:function(t,e,n){if((t=Ci(t))&&(n||void 0===e))return ce(t);if(!t||!(e=ie(e)))return t;var r=No(t),i=No(e);return lo(r,_p(r,i),xp(r,i)+1).join("")},trimEnd:function(t,e,n){if((t=Ci(t))&&(n||void 0===e))return t.slice(0,se(t)+1);if(!t||!(e=ie(e)))return t;var r=No(t);return lo(r,0,xp(r,No(e))+1).join("")},trimStart:function(t,e,n){if((t=Ci(t))&&(n||void 0===e))return t.replace(wp,"");if(!t||!(e=ie(e)))return t;var r=No(t);return lo(r,_p(r,No(e))).join("")},truncate:function(t,e){var n=30,r="...";if(de(e)){var i="separator"in e?e.separator:i;n="length"in e?_e(e.length):n,r="omission"in e?ie(e.omission):r}var o=(t=Ci(t)).length;if(ho(t)){var a=No(t);o=a.length}if(n>=o)return t;var u=n-$d(r);if(u<1)return r;var s=a?lo(a,0,u).join(""):t.slice(0,u);if(void 0===i)return s+r;if(a&&(u+=s.length-u),Vc(i)){if(t.slice(u).search(i)){var l,c=s;for(i.global||(i=RegExp(i.source,Ci(Mp.exec(i))+"g")),i.lastIndex=0;l=i.exec(c);)var d=l.index;s=s.slice(0,void 0===d?u:d)}}else if(t.indexOf(ie(i),u)!=u){var h=s.lastIndexOf(i);h>-1&&(s=s.slice(0,h))}return s+r},unescape:function(t){return(t=Ci(t))&&Sp.test(t)?t.replace(Np,Ep):t},upperCase:Bp,upperFirst:Ao,words:oa},uf={attempt:no,bindAll:ao,cond:function(t){var e=null==t?0:t.length,n=Ts;return t=e?Qt(t,(function(t){if("function"!=typeof t[1])throw new TypeError("Expected a function");return[n(t[0]),t[1]]})):[],Nr((function(n){for(var r=-1;++r<e;){var i=t[r];if(Ye(i[0],this,n))return Ye(i[1],this,n)}}))},conforms:function(t){return function(t){var e=ii(t);return function(n){return ks(n,t,e)}}(ju(t,1))},constant:xn,defaultTo:function(t,e){return null==t||t!=t?e:t},flow:Jl,flowRight:Ql,identity:we,iteratee:function(t){return Ts("function"==typeof t?t:ju(t,1))},matches:function(t){return xs(ju(t,1))},matchesProperty:function(t,e){return Ss(t,ju(e,1))},method:ld,methodOf:cd,mixin:dd,noop:nn,nthArg:function(t){return t=_e(t),Nr((function(e){return bd(e,t)}))},over:Td,overEvery:Id,overSome:jd,property:Ps,propertyOf:function(t){return function(e){return null==t?void 0:Ri(t,e)}},range:Nh,rangeRight:Sh,stubArray:Na,stubFalse:zr,stubObject:function(){return{}},stubString:function(){return""},stubTrue:function(){return!0},times:function(t,e){if((t=_e(t))<1||t>9007199254740991)return[];var n=vp,r=gp(t,vp);e=yl(e),t-=vp;for(var i=Ir(r,e);++n<t;)e(n);return i},toPath:function(t){return te(t)?Qt(t,ji):Kt(t)?[t]:ln(ki(Ci(t)))},uniqueId:function(t){var e=++Ip;return Ci(t)+e}};var sf=Math.max,lf=Math.min;var cf=Math.min;
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@logicflow/core")):"function"==typeof define&&define.amd?define(["exports","@logicflow/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Extension={},t.Core)}(this,(function(t,e){"use strict";var n=40,i=40,o=40,r=40,a=40,s=40,l=100,u=80,c=100,d=80,h={rect:{radius:5,stroke:"rgb(24, 125, 255)"},circle:{r:18,stroke:"rgb(24, 125, 255)"},polygon:{stroke:"rgb(24, 125, 255)"},polyline:{stroke:"rgb(24, 125, 255)",hoverStroke:"rgb(24, 125, 255)",selectedStroke:"rgb(24, 125, 255)"},edgeText:{textWidth:100,overflowMode:"default",fontSize:12,background:{fill:"white",height:14,stroke:"transparent",radius:3}}},f=function(t,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},f(t,e)};function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var g=function(){return g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},g.apply(this,arguments)};function v(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]])}return n}function m(t,e,n,i){var o,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,n,a):o(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a}function y(t,e,n,i){return new(n||(n=Promise))((function(o,r){function a(t){try{l(i.next(t))}catch(t){r(t)}}function s(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((i=i.apply(t,e||[])).next())}))}function b(t,e){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=e.call(t,a)}catch(t){s=[6,t],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(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function E(t,e,n){if(n||2===arguments.length)for(var i,o=0,r=e.length;o<r;o++)!i&&o in e||(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var C=function(){function t(){globalThis._ids=this,this._ids=new Set}return t.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))},t.prototype.next=function(){for(var t=this.generateId();this._ids.has(t);)t=this.generateId();return this._ids.add(t),t},t}(),_=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new C;function N(){return _.next()}var S=function(t){function e(e,n){return e.id||(e.id="Event_".concat(N())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40}),t.call(this,e,n)||this}return p(e,t),e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedTargetRules=function(){var e=t.prototype.getConnectedTargetRules.call(this);return e.push({message:"起始节点不能作为边的终点",validate:function(){return!1}}),e},e.extendKey="StartEventModel",e}(e.CircleNodeModel),T=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.extendKey="StartEventNode",e}(e.CircleNode),M={type:"bpmn:startEvent",view:T,model:S},k=function(t){function e(e,n){return e.id||(e.id="Event_".concat(N())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40}),t.call(this,e,n)||this}return p(e,t),e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedSourceRules=function(){var e=t.prototype.getConnectedSourceRules.call(this);return e.push({message:"结束节点不能作为边的起点",validate:function(){return!1}}),e},e.extendKey="EndEventModel",e}(e.CircleNodeModel),A=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),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=t.prototype.getShape.call(this);return e.h("g",{},l,e.h("circle",g(g({},i),{cx:r,cy:a,r:s-5})))},n.extendKey="EndEventView",n}(e.CircleNode),R={type:"bpmn:endEvent",view:A,model:k},O=function(t){function e(e,n){return e.id||(e.id="Flow_".concat(N())),t.call(this,e,n)||this}return p(e,t),e.extendKey="SequenceFlowModel",e}(e.PolylineEdgeModel),P=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.extendKey="SequenceFlowEdge",e}(e.PolylineEdge),D={type:"bpmn:sequenceFlow",view:P,model:O},L=function(t){function e(e,n){var i=this;return e.id||(e.id="Gateway_".concat(N())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40}),(i=t.call(this,e,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],i}return p(e,t),e.extendKey="ExclusiveGatewayModel",e}(e.PolygonNodeModel),I=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),n.prototype.getShape=function(){var t=this.props.model,n=t,i=n.x,o=n.y,r=n.width,a=n.height,s=n.points,l=t.getNodeStyle();return e.h("g",{transform:"matrix(1 0 0 1 ".concat(i-r/2," ").concat(o-a/2,")")},e.h("polygon",g(g({},l),{x:i,y:o,points:s})),e.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}(e.PolygonNode),B={type:"bpmn:exclusiveGateway",view:I,model:L},j=function(t){function e(e,n){return e.id||(e.id="Activity_".concat(N())),t.call(this,e,n)||this}return p(e,t),e.extendKey="ServiceTaskModel",e}(e.RectNodeModel),F=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),n.prototype.getLabelShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,r=t.height,a=t.getNodeStyle();return e.h("svg",{x:n-o/2+5,y:i-r/2+5,width:30,height:30,viewBox:"0 0 1274 1024"},e.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 t=this.props.model,n=t.x,i=t.y,o=t.width,r=t.height,a=t.radius,s=t.getNodeStyle();return e.h("g",{},[e.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}(e.RectNode),H={type:"bpmn:serviceTask",view:F,model:j},W=function(t){function e(e,n){return e.id||(e.id="Activity_".concat(N())),t.call(this,e,n)||this}return p(e,t),e.extendKey="UserTaskModel",e}(e.RectNodeModel),z=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),n.prototype.getLabelShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,r=t.height,a=t.getNodeStyle();return e.h("svg",{x:n-o/2+5,y:i-r/2+5,width:25,height:25,viewBox:"0 0 1274 1024"},e.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 t=this.props.model,n=t.x,i=t.y,o=t.width,r=t.height,a=t.radius,s=t.getNodeStyle();return e.h("g",{},[e.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}(e.RectNode),U={type:"bpmn:userTask",view:z,model:W},q={pluginName:"bpmnElement",install:function(t){t.setTheme(h),t.register(M),t.register(R),t.register(B),t.register(U),t.register(H),t.options.customBpmnEdge||(t.register(D),t.setDefaultEdgeType("bpmn:sequenceFlow"))}},G=function(){function t(){globalThis._ids=this,this._ids=new Set}return t.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))},t.prototype.next=function(){for(var t=this.generateId();this._ids.has(t);)t=this.generateId();return this._ids.add(t),t},t}(),V=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new G;function K(){return V.next()}function X(t){return Object.prototype.toString.call(t)}function Y(t){var e=t;return"[object Object]"===X(t)?(e={},Object.keys(t).forEach((function(n){var i=n;"-"===n.charAt(0)&&(i=n.substring(1)),e[i]=Y(t[n])}))):Array.isArray(t)&&(e=[],t.forEach((function(t,n){e[n]=Y(t)}))),e}var $="\t\n";function Z(t,e,n){var i=function(t){return" ".repeat(t)}(n),o="";if("#text"===e)return $+i+t;if("#cdata-section"===e)return $+i+"<![CDATA["+t+"]]>";if("#comment"===e)return $+i+"\x3c!--"+t+"--\x3e";if("-"==="".concat(e).charAt(0))return" "+e.substring(1)+'="'+function(t){var e=t;try{"string"!=typeof e&&(e=JSON.parse(t))}catch(n){e=JSON.stringify(Y(t)).replace(/"/g,"'")}return e}(t)+'"';if(Array.isArray(t))t.forEach((function(t){o+=Z(t,e,n+1)}));else if("[object Object]"===X(t)){var r=Object.keys(t),a="",s="";o+=(0===n?"":$+i)+"<"+e,r.forEach((function(e){"-"===e.charAt(0)?a+=Z(t[e],e,n+1):s+=Z(t[e],e,n+1)})),o+=a+(""!==s?">".concat(s).concat($+i,"</").concat(e,">"):" />")}else o+=$+i+"<".concat(e,">").concat(t.toString(),"</").concat(e,">");return o}function J(t){var e="";for(var n in t)e+=Z(t[n],n,0);return e}var Q=function(){};(Q.ObjTree=function(){return this}).VERSION="0.23",Q.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',Q.ObjTree.prototype.attr_prefix="-",Q.ObjTree.prototype.parseXML=function(t){var e;if(window.DOMParser){var n=new DOMParser,i=n.parseFromString(t,"application/xml");if(!i)return;e=i.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(t),e=n.documentElement);if(e)return this.parseDOM(e)},Q.ObjTree.prototype.parseHTTP=function(t,e,n){var i,o={};for(var r in e)o[r]=e[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(t){var e;t&&t.responseXML&&t.responseXML.documentElement&&(e=a.parseDOM(t.responseXML.documentElement)),s(e,t),l&&l(t)}}else o.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)o.uri=t,(u=new HTTP.Request(o))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(t,o))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},Q.ObjTree.prototype.parseDOM=function(t){if(t){if(this.__force_array={},this.force_array)for(var e=0;e<this.force_array.length;e++)this.__force_array[this.force_array[e]]=1;var n=this.parseElement(t);if(this.__force_array[t.nodeName]&&(n=[n]),11!=t.nodeType){var i={};i[t.nodeName]=n,n=i}return n}},Q.ObjTree.prototype.parseElement=function(t){if(7!=t.nodeType){if(3==t.nodeType||4==t.nodeType||8==t.nodeType){if(null==t.nodeValue.match(/[^\x00-\x20]/))return;return t.nodeValue}var e=null,n={};if(t.attributes&&t.attributes.length){e={};for(var i=0;i<t.attributes.length;i++){if("string"==typeof(s=t.attributes[i].nodeName)){var o=t.attributes[i].nodeValue;try{o=JSON.parse(t.attributes[i].nodeValue.replace(/'/g,'"'))}catch(e){o=t.attributes[i].nodeValue}o&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(e,s,n[s],o))}}}if(t.childNodes&&t.childNodes.length){var r=!0;e&&(r=!1);for(i=0;i<t.childNodes.length&&r;i++){var a=t.childNodes[i].nodeType;3!=a&&4!=a&&8!=a&&(r=!1)}if(r){e||(e="");for(i=0;i<t.childNodes.length;i++)e+=t.childNodes[i].nodeValue}else{e||(e={});for(i=0;i<t.childNodes.length;i++){var s;if("string"==typeof(s=t.childNodes[i].nodeName))(o=this.parseElement(t.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(e,s,n[s],o))}}}else null===e&&(e={});return e}},Q.ObjTree.prototype.addNode=function(t,e,n,i){this.__force_array[e]?(1==n&&(t[e]=[]),t[e][t[e].length]=i):1==n?t[e]=i:2==n?t[e]=[t[e],i]:t[e][t[e].length]=i},Q.ObjTree.prototype.writeXML=function(t){var e=this.hash_to_xml(null,t);return this.xmlDecl+e},Q.ObjTree.prototype.hash_to_xml=function(t,e){var n=[],i=[];for(var o in e)if(e.hasOwnProperty(o)){var r=e[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===t||null==t||(s=n.length>0?s.match(/\n/)?"<"+t+a+">\n"+s+"</"+t+">\n":"<"+t+a+">"+s+"</"+t+">\n":"<"+t+a+" />\n"),s},Q.ObjTree.prototype.array_to_xml=function(t,e){for(var n=[],i=0;i<e.length;i++){var o=e[i];void 0===o||null==o?n[n.length]="<"+t+" />":"object"==typeof o&&o.constructor==Array?n[n.length]=this.array_to_xml(t,o):n[n.length]="object"==typeof o?this.hash_to_xml(t,o):this.scalar_to_xml(t,o)}return n.join("")},Q.ObjTree.prototype.scalar_to_xml=function(t,e){return"#text"==t?this.xml_escape(e):"<"+t+">"+this.xml_escape(e)+"</"+t+">\n"},Q.ObjTree.prototype.xml_escape=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};var tt,et=function(t){return(new Q.ObjTree).parseXML(t)};!function(t){t.START="bpmn:startEvent",t.END="bpmn:endEvent",t.GATEWAY="bpmn:exclusiveGateway",t.USER="bpmn:userTask",t.SYSTEM="bpmn:serviceTask",t.FLOW="bpmn:sequenceFlow"}(tt||(tt={}));var nt=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef"],it=["properties","startPoint","endPoint","pointsList"];function ot(t){var e=t?it.concat(t):it;return function(t){return function t(n){var i={};return"string"==typeof n?n:Array.isArray(n)?n.map((function(e){return t(e)})):(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:e.includes(r)?i["-".concat(r)]=t(a):i[r]=t(a)})),i)}(t)}}function rt(t){var e={};return Object.entries(t).forEach((function(t){var n=w(t,2),i=n[0],o=n[1];0===i.indexOf("-")?e[i.substring(1)]=Y(o):"string"==typeof o?e[i]=o:"[object Object]"===Object.prototype.toString.call(o)?e[i]=rt(o):Array.isArray(o)?e[i]=o.map((function(t){return rt(t)})):e[i]=o})),e}function at(t,e){t["bpmndi:BPMNEdge"]=e.edges.map((function(t){var e,n=t.id,i=t.pointsList.map((function(t){return{"-x":t.x,"-y":t.y}})),o={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(o["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),o})),t["bpmndi:BPMNShape"]=e.nodes.map((function(t){var e,n=t.id,i=100,o=80,r=t.x,a=t.y,s=ct.shapeConfigMap.get(t.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===(e=t.text)||void 0===e?void 0:e.value)&&(l["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),l}))}function st(t){var e=[],n=[],i=t["bpmn:definitions"];if(i){var o=i["bpmn:process"];Object.keys(o).forEach((function(t){if(0===t.indexOf("bpmn:")){var r=o[t];if(t===tt.FLOW){var a=i["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNEdge"];n=function(t,e){var n=[];if(Array.isArray(t))t.forEach((function(t){var i;i=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(ut(i,t))}));else{var i=void 0;i=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(ut(i,t))}return n}(r,a)}else{var s=i["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];e=e.concat(function(t,e,n){var i=[];if(Array.isArray(t))t.forEach((function(t){var o=lt(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);i.push(o)}));else{var o=lt(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);i.push(o)}return i}(r,s,t))}}}))}return{nodes:e,edges:n}}function lt(t,e,n){var i,o,r=Number(t["dc:Bounds"]["-x"]),a=Number(t["dc:Bounds"]["-y"]),s=n["-name"],l=ct.shapeConfigMap.get(e);if(l&&(r+=l.width/2,a+=l.height/2),Object.entries(n).forEach((function(t){var e=w(t,2),n=e[0],o=e[1];-1===nt.indexOf(n)&&(i||(i={}),i[n]=o)})),i&&(i=rt(i)),s&&(o={x:r,y:a,value:s},t["bpmndi:BPMNLabel"]&&t["bpmndi:BPMNLabel"]["dc:Bounds"])){var u=t["bpmndi:BPMNLabel"]["dc:Bounds"];o.x=Number(u["-x"])+Number(u["-width"])/2,o.y=Number(u["-y"])+Number(u["-height"])/2}var c={id:t["-bpmnElement"],type:e,x:r,y:a,properties:i};return o&&(c.text=o),c}function ut(t,e){var n,i,o=e["-name"];if(o){var r=t["bpmndi:BPMNLabel"]["dc:Bounds"],a=0;o.split("\n").forEach((function(t){a<t.length&&(a=t.length)})),n={value:o,x:Number(r["-x"])+10*a/2,y:Number(r["-y"])+7}}Object.entries(e).forEach((function(t){var e=w(t,2),n=e[0],o=e[1];-1===nt.indexOf(n)&&(i||(i={}),i[n]=o)})),i&&(i=rt(i));var s={id:e["-id"],type:tt.FLOW,pointsList:t["di:waypoint"].map((function(t){return{x:Number(t["-x"]),y:Number(t["-y"])}})),sourceNodeId:e["-sourceRef"],targetNodeId:e["-targetRef"],properties:i};return n&&(s.text=n),s}var ct=function(){function t(t){var e=t.lf,n=this;this.adapterOut=function(t,e){var i=g({},n.processAttributes);!function(t,e,n){var i=new Map;e.nodes.forEach((function(e){var o,r={"-id":e.id};if((null===(o=e.text)||void 0===o?void 0:o.value)&&(r["-name"]=e.text.value),e.properties){var a=ot(n)(e.properties);Object.assign(r,a)}i.set(e.id,r),t[e.type]?Array.isArray(t[e.type])?t[e.type].push(r):t[e.type]=[t[e.type],r]:t[e.type]=r}));var o=e.edges.map((function(t){var e,o,r=i.get(t.targetNodeId);r["bpmn:incoming"]?Array.isArray(r["bpmn:incoming"])?r["bpmn:incoming"].push(t.id):r["bpmn:incoming"]=[r["bpmn:incoming"],t.id]:r["bpmn:incoming"]=t.id;var a={"-id":t.id,"-sourceRef":t.sourceNodeId,"-targetRef":t.targetNodeId};if((null===(e=t.text)||void 0===e?void 0:e.value)&&(a["-name"]=null===(o=t.text)||void 0===o?void 0:o.value),t.properties){var s=ot(n)(t.properties);Object.assign(a,s)}return a}));e.edges.forEach((function(t){var e=i.get(t.sourceNodeId);e["bpmn:outgoing"]?Array.isArray(e["bpmn:outgoing"])?e["bpmn:outgoing"].push(t.id):e["bpmn:outgoing"]=[e["bpmn:outgoing"],t.id]:e["bpmn:outgoing"]=t.id})),t[tt.FLOW]=o}(i,t,e);var o={"-id":"BPMNPlane_1","-bpmnElement":i["-id"]};at(o,t);var r=n.definitionAttributes;return r["bpmn:process"]=i,r["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":o},{"bpmn:definitions":r}},this.adapterIn=function(t){if(t)return st(t)},e.adapterIn=function(t){return n.adapterIn(t)},e.adapterOut=function(t,e){return n.adapterOut(t,e)},this.processAttributes={"-isExecutable":"true","-id":"Process_".concat(K())},this.definitionAttributes={"-id":"Definitions_".concat(K()),"-xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","-xmlns:bpmn":"http://www.omg.org/spec/BPMN/20100524/MODEL","-xmlns:bpmndi":"http://www.omg.org/spec/BPMN/20100524/DI","-xmlns:dc":"http://www.omg.org/spec/DD/20100524/DC","-xmlns:di":"http://www.omg.org/spec/DD/20100524/DI","-targetNamespace":"http://logic-flow.org","-exporter":"logicflow","-exporterVersion":"1.2.0"}}return t.prototype.setCustomShape=function(e,n){t.shapeConfigMap.set(e,n)},t.pluginName="bpmn-adapter",t.shapeConfigMap=new Map,t}();ct.shapeConfigMap.set(tt.START,{width:n,height:i}),ct.shapeConfigMap.set(tt.END,{width:o,height:r}),ct.shapeConfigMap.set(tt.GATEWAY,{width:a,height:s}),ct.shapeConfigMap.set(tt.SYSTEM,{width:l,height:u}),ct.shapeConfigMap.set(tt.USER,{width:c,height:d});var dt=function(t){function e(e){var n=t.call(this,e)||this;n.adapterXmlIn=function(t){var e=et(t);return n.adapterIn(e)},n.adapterXmlOut=function(t,e){return J(n.adapterOut(t,e))};var i=e.lf;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n}return p(e,t),e.pluginName="bpmnXmlAdapter",e}(ct);function ht(){this.targetRules.push({message:"分组外的节点不允许连接分组内的",validate:function(t,e){var n=!!t.properties.parent,i=!!e.properties.parent;return!(!n&&i)}})}var ft=function(){function t(){globalThis._ids=this,this._ids=new Set}return t.prototype.generateId=function(){return"xxxxxxx".replace(/[x]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))},t.prototype.next=function(){for(var t=this.generateId();this._ids.has(t);)t=this.generateId();return this._ids.add(t),t},t}(),pt=(null===globalThis||void 0===globalThis?void 0:globalThis._ids)||new ft;function gt(){return pt.next()}var vt=Object.freeze({__proto__:null,genBpmnId:gt,groupRule:ht});function mt(t){var n=w(t.useDefinition(),1)[0],i=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return p(i,t),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var i,o=this.props.model,r=o.getNodeStyle(),a=o,s=a.x,l=a.y,u=a.r,c=a.width,d=a.height,h=a.properties,f=t.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)?e.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(s-c/2," ").concat(l-d/2,")")}],w(v),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(s-c/2," ").concat(l-d/2,")"),d:v,style:"fill: black; stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;"});return e.h("g",{},f,e.h("circle",g(g({},r),{strokeWidth:2,cx:s,cy:l,r:u-2})),m)},i}(e.CircleNode),o=function(t){function e(e,i){var o,r,a,s;e.id||(e.id="Event_".concat(gt())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var l=((null===(r=n.endEvent)||void 0===r?void 0:r.get(null===(a=e.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return e.properties=g(g({},u),e.properties),(null===(s=e.properties)||void 0===s?void 0:s.definitionType)&&(e.properties.definitionId="Definition_".concat(gt())),o=t.call(this,e,i)||this,ht.call(o),o}return p(e,t),e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedSourceRules=function(){var e=this,n=t.prototype.getConnectedSourceRules.call(this),i={message:"结束节点不能作为边的起点",validate:function(t,n){return console.log("_target",n),t!==e}};return n.push(i),n},e}(e.CircleNodeModel);return{type:"bpmn:endEvent",view:i,model:o}}function yt(t){var n=w(t.useDefinition(),1)[0],i=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return p(i,t),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var t,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties.definitionType,h=((null===(t=n.intermediateCatchEvent)||void 0===t?void 0:t.get(d))||{}).icon,f=Array.isArray(h)?e.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],w(h),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:h});return e.h("g",{},e.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeWidth:1.5})),e.h("circle",g(g({},o),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),f)},i}(e.CircleNode),o=function(t){function e(e,i){var o,r,a,s;e.id||(e.id="Event_".concat(gt())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var l=((null===(r=n.intermediateCatchEvent)||void 0===r?void 0:r.get(null===(a=e.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return e.properties=g(g({},u),e.properties),(null===(s=e.properties)||void 0===s?void 0:s.definitionType)&&(e.properties.definitionId="Definition_".concat(gt())),o=t.call(this,e,i)||this,ht.call(o),o}return p(e,t),e.prototype.setAttributes=function(){this.r=18},e}(e.CircleNodeModel);return{type:"bpmn:intermediateCatchEvent",view:i,model:o}}function bt(t){var n=w(t.useDefinition(),1)[0],i=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return p(i,t),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var t,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties,h=d.definitionType,f=d.isInterrupting,p=((null===(t=n.startEvent)||void 0===t?void 0:t.get(h))||{}).icon,v=Array.isArray(p)?e.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],w(p),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:p,style:"fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;"});return e.h("g",{},e.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeDasharray:f?"5,5":"",strokeWidth:2})),v)},i}(e.CircleNode),o=function(t){function e(e,i){var o,r,a;e.id||(e.id="Event_".concat(gt())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var s=((null===(o=n.startEvent)||void 0===o?void 0:o.get(null===(r=e.properties)||void 0===r?void 0:r.definitionType))||{}).properties,l=void 0===s?{}:s;return e.properties=g(g({},l),e.properties),(null===(a=e.properties)||void 0===a?void 0:a.definitionType)&&(e.properties.definitionId="Definition_".concat(gt())),t.call(this,e,i)||this}return p(e,t),e.prototype.setAttributes=function(){this.r=18},e.prototype.getConnectedTargetRules=function(){var e=this,n=t.prototype.getConnectedTargetRules.call(this),i={message:"起始节点不能作为边的终点",validate:function(t,n){return n!==e}};return n.push(i),n},e}(e.CircleNodeModel);return{type:"bpmn:startEvent",view:i,model:o}}function xt(t){var n=w(t.useDefinition(),1)[0],i=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return p(i,t),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var t,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties,h=d.definitionType,f=d.cancelActivity,p=((null===(t=n.boundaryEvent)||void 0===t?void 0:t.get(h))||{}).icon,v=Array.isArray(p)?e.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],w(p),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:p});return e.h("g",{},e.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeDasharray:f?"":"5,5",strokeWidth:1.5})),e.h("circle",g(g({},o),{cx:a,cy:s,r:l-3,strokeDasharray:f?"":"5,5",strokeWidth:1.5})),v)},i}(e.CircleNode),o=function(t){function e(e,i){var o,r,a,s;e.id||(e.id="Event_".concat(gt())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var l=((null===(r=n.boundaryEvent)||void 0===r?void 0:r.get(null===(a=e.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return e.properties=g(g({attachedToRef:"",cancelActivity:!0},u),e.properties),(null===(s=e.properties)||void 0===s?void 0:s.definitionType)&&(e.properties.definitionId="Definition_".concat(gt())),o=t.call(this,e,i)||this,ht.call(o),o}return p(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.r=20,this.autoToFront=!1,this.zIndex=99999},e.prototype.setAttributes=function(){this.r=18},e}(e.CircleNodeModel);return{type:"bpmn:boundaryEvent",view:i,model:o}}function wt(t){var n=w(t.useDefinition(),1)[0],i=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return p(i,t),i.prototype.getAnchorStyle=function(){return{visibility:"hidden"}},i.prototype.getShape=function(){var t,i=this.props.model,o=i.getNodeStyle(),r=i,a=r.x,s=r.y,l=r.r,u=r.width,c=r.height,d=r.properties.definitionType,h=((null===(t=n.intermediateThrowEvent)||void 0===t?void 0:t.get(d))||{}).icon,f=Array.isArray(h)?e.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")")}],w(h),!1)):e.h("path",{transform:"matrix(1 0 0 1 ".concat(a-u/2," ").concat(s-c/2,")"),d:h,style:"fill: black"});return e.h("g",{},e.h("circle",g(g({},o),{cx:a,cy:s,r:l,strokeWidth:1.5})),e.h("circle",g(g({},o),{cx:a,cy:s,r:l-3,strokeWidth:1.5})),f)},i}(e.CircleNode),o=function(t){function e(e,i){var o,r,a,s;e.id||(e.id="Event_".concat(gt())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40});var l=((null===(r=n.intermediateThrowEvent)||void 0===r?void 0:r.get(null===(a=e.properties)||void 0===a?void 0:a.definitionType))||{}).properties,u=void 0===l?{}:l;return e.properties=g(g({},u),e.properties),(null===(s=e.properties)||void 0===s?void 0:s.definitionType)&&(e.properties.definitionId="Definition_".concat(gt())),o=t.call(this,e,i)||this,ht.call(o),o}return p(e,t),e.prototype.setAttributes=function(){this.r=18},e}(e.CircleNodeModel);return{type:"bpmn:intermediateThrowEvent",view:i,model:o}}var Et=[e.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"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"}),e.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;"})],Ct=[e.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);"})],_t="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",Nt="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",St=e.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;"}),Tt="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",Mt="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",kt="m44,60 m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",At="m47,61 m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",Rt="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",Ot=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:_t,inclusiveIcon:St,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:Rt,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:Nt,parallelMarker:kt,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:At,serviceTaskIcon:Tt,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:Ct,timerIcon:Et,userTaskIcon:Mt});function Pt(t,n,i){var o=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return p(i,t),i.prototype.getShape=function(){var t=this.props.model,i=t,o=i.x,r=i.y,a=i.width,s=i.height,l=i.points,u=t.getNodeStyle();return e.h("g",{transform:"matrix(1 0 0 1 ".concat(o-a/2," ").concat(r-s/2,")")},e.h(e.Polygon,g(g({},u),{x:o,y:r,points:l})),"string"==typeof n?e.h("path",g(g({d:n},u),{fill:"rgb(34, 36, 42)",strokeWidth:1})):n)},i}(e.PolygonNode);return{type:t,view:o,model:function(t){function e(e,n){var o=this;return e.id||(e.id="Gateway_".concat(gt())),e.text||(e.text=""),e.text&&"string"==typeof e.text&&(e.text={value:e.text,x:e.x,y:e.y+40}),e.properties=g(g({},i||{}),e.properties),(o=t.call(this,e,n)||this).points=[[25,0],[50,25],[25,50],[0,25]],ht.call(o),o}return p(e,t),e}(e.PolygonNodeModel)}}var Dt={parallel:kt,sequential:At,loop:Rt};function Lt(t,n,i){var o=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return p(i,t),i.prototype.getLabelShape=function(){var t=this.props.model,i=t.x,o=t.y,r=t.width,a=t.height,s=t.getNodeStyle(),l=Array.isArray(n)?e.h.apply(void 0,E(["g",{transform:"matrix(1 0 0 1 ".concat(i-r/2," ").concat(o-a/2,")")}],w(n),!1)):e.h("path",{fill:s.stroke,d:n});return e.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 t=this.props.model,n=t.x,i=t.y,o=t.width,r=t.height,a=t.radius,s=t.properties,l=t.getNodeStyle();return e.h("g",{},[e.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(),e.h("g",{transform:"matrix(1 0 0 1 ".concat(n-o/2," ").concat(i-r/2,")")},e.h("path",{fill:"white",strokeLinecap:"round",strokeLinejoin:"round",stroke:"rgb(34, 36, 42)",strokeWidth:"2",d:Dt[s.multiInstanceType]||""}))])},i}(e.RectNode),r=function(t){function e(e,n){var o,r=this;e.id||(e.id="Activity_".concat(gt()));var a=g(g({},i||{}),e.properties);return e.properties=a,r=t.call(this,e,n)||this,null===(o=null==a?void 0:a.boundaryEvents)||void 0===o||o.forEach((function(t){r.addBoundaryEvent(t)})),r.deleteProperty("boundaryEvents"),ht.call(r),r}return p(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.isTaskNode=!0,this.boundaryEvents=[]},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return this.properties.isBoundaryEventTouchingTask&&(e.stroke="#00acff",e.strokeWidth=2),e},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return e.stroke="transparent",!e.hover&&(e.hover={}),e.hover.stroke="transparent",e},e.prototype.setTouching=function(t){this.setProperty("isBoundaryEventTouchingTask",t)},e.prototype.addBoundaryEvent=function(t){if(this.setTouching(!1),this.boundaryEvents.find((function(e){return e===t})))return!1;var e=this.graphModel.getNodeModelById(t);return null==e||e.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(t),!0},e.prototype.deleteBoundaryEvent=function(t){this.boundaryEvents=this.boundaryEvents.filter((function(e){return e!==t}))},e}(e.RectNodeModel);return{type:t,view:o,model:r}}var It="object"==typeof global&&global&&global.Object===Object&&global,Bt="object"==typeof self&&self&&self.Object===Object&&self,jt=It||Bt||Function("return this")(),Ft=jt.Symbol,Ht=Object.prototype,Wt=Ht.hasOwnProperty,zt=Ht.toString,Ut=Ft?Ft.toStringTag:void 0;var qt=Object.prototype.toString;var Gt="[object Null]",Vt="[object Undefined]",Kt=Ft?Ft.toStringTag:void 0;function Xt(t){return null==t?void 0===t?Vt:Gt:Kt&&Kt in Object(t)?function(t){var e=Wt.call(t,Ut),n=t[Ut];try{t[Ut]=void 0;var i=!0}catch(t){}var o=zt.call(t);return i&&(e?t[Ut]=n:delete t[Ut]),o}(t):function(t){return qt.call(t)}(t)}function Yt(t){return null!=t&&"object"==typeof t}var $t="[object Symbol]";function Zt(t){return"symbol"==typeof t||Yt(t)&&Xt(t)==$t}var Jt=NaN;function Qt(t){return"number"==typeof t?t:Zt(t)?Jt:+t}function te(t,e){for(var n=-1,i=null==t?0:t.length,o=Array(i);++n<i;)o[n]=e(t[n],n,t);return o}var ee=Array.isArray,ne=1/0,ie=Ft?Ft.prototype:void 0,oe=ie?ie.toString:void 0;function re(t){if("string"==typeof t)return t;if(ee(t))return te(t,re)+"";if(Zt(t))return oe?oe.call(t):"";var e=t+"";return"0"==e&&1/t==-ne?"-0":e}function ae(t,e){return function(n,i){var o;if(void 0===n&&void 0===i)return e;if(void 0!==n&&(o=n),void 0!==i){if(void 0===o)return i;"string"==typeof n||"string"==typeof i?(n=re(n),i=re(i)):(n=Qt(n),i=Qt(i)),o=t(n,i)}return o}}var se=ae((function(t,e){return t+e}),0),le=/\s/;function ue(t){for(var e=t.length;e--&&le.test(t.charAt(e)););return e}var ce=/^\s+/;function de(t){return t?t.slice(0,ue(t)+1).replace(ce,""):t}function he(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var fe=NaN,pe=/^[-+]0x[0-9a-f]+$/i,ge=/^0b[01]+$/i,ve=/^0o[0-7]+$/i,me=parseInt;function ye(t){if("number"==typeof t)return t;if(Zt(t))return fe;if(he(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=he(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=de(t);var n=ge.test(t);return n||ve.test(t)?me(t.slice(2),n?2:8):pe.test(t)?fe:+t}var be=1/0,xe=17976931348623157e292;function we(t){return t?(t=ye(t))===be||t===-be?(t<0?-1:1)*xe:t==t?t:0:0===t?t:0}function Ee(t){var e=we(t),n=e%1;return e==e?n?e-n:e:0}function Ce(t){return t}var _e="[object AsyncFunction]",Ne="[object Function]",Se="[object GeneratorFunction]",Te="[object Proxy]";function Me(t){if(!he(t))return!1;var e=Xt(t);return e==Ne||e==Se||e==_e||e==Te}var ke,Ae=jt["__core-js_shared__"],Re=(ke=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||""))?"Symbol(src)_1."+ke:"";var Oe=Function.prototype.toString;function Pe(t){if(null!=t){try{return Oe.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var De=/^\[object .+?Constructor\]$/,Le=Function.prototype,Ie=Object.prototype,Be=Le.toString,je=Ie.hasOwnProperty,Fe=RegExp("^"+Be.call(je).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function He(t){return!(!he(t)||function(t){return!!Re&&Re in t}(t))&&(Me(t)?Fe:De).test(Pe(t))}function We(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return He(n)?n:void 0}var ze=We(jt,"WeakMap"),Ue=ze&&new ze,qe=Ue?function(t,e){return Ue.set(t,e),t}:Ce,Ge=Object.create,Ve=function(){function t(){}return function(e){if(!he(e))return{};if(Ge)return Ge(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Ke(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Ve(t.prototype),i=t.apply(n,e);return he(i)?i:n}}var Xe=1;function Ye(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var $e=Math.max;function Ze(t,e,n,i){for(var o=-1,r=t.length,a=n.length,s=-1,l=e.length,u=$e(r-a,0),c=Array(l+u),d=!i;++s<l;)c[s]=e[s];for(;++o<a;)(d||o<r)&&(c[n[o]]=t[o]);for(;u--;)c[s++]=t[o++];return c}var Je=Math.max;function Qe(t,e,n,i){for(var o=-1,r=t.length,a=-1,s=n.length,l=-1,u=e.length,c=Je(r-s,0),d=Array(c+u),h=!i;++o<c;)d[o]=t[o];for(var f=o;++l<u;)d[f+l]=e[l];for(;++a<s;)(h||o<r)&&(d[f+n[a]]=t[o++]);return d}function tn(){}var en=4294967295;function nn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=en,this.__views__=[]}function on(){}nn.prototype=Ve(tn.prototype),nn.prototype.constructor=nn;var rn=Ue?function(t){return Ue.get(t)}:on,an={},sn=Object.prototype.hasOwnProperty;function ln(t){for(var e=t.name+"",n=an[e],i=sn.call(an,e)?n.length:0;i--;){var o=n[i],r=o.func;if(null==r||r==t)return o.name}return e}function un(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function cn(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}function dn(t){if(t instanceof nn)return t.clone();var e=new un(t.__wrapped__,t.__chain__);return e.__actions__=cn(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}un.prototype=Ve(tn.prototype),un.prototype.constructor=un;var hn=Object.prototype.hasOwnProperty;function fn(t){if(Yt(t)&&!ee(t)&&!(t instanceof nn)){if(t instanceof un)return t;if(hn.call(t,"__wrapped__"))return dn(t)}return new un(t)}function pn(t){var e=ln(t),n=fn[e];if("function"!=typeof n||!(e in nn.prototype))return!1;if(t===n)return!0;var i=rn(n);return!!i&&t===i[0]}fn.prototype=tn.prototype,fn.prototype.constructor=fn;var gn=Date.now;function vn(t){var e=0,n=0;return function(){var i=gn(),o=16-(i-n);if(n=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var mn=vn(qe),yn=/\{\n\/\* \[wrapped with (.+)\] \*/,bn=/,? & /;var xn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function wn(t){return function(){return t}}var En=function(){try{var t=We(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Cn=En?function(t,e){return En(t,"toString",{configurable:!0,enumerable:!1,value:wn(e),writable:!0})}:Ce,_n=vn(Cn);function Nn(t,e){for(var n=-1,i=null==t?0:t.length;++n<i&&!1!==e(t[n],n,t););return t}function Sn(t,e,n,i){for(var o=t.length,r=n+(i?1:-1);i?r--:++r<o;)if(e(t[r],r,t))return r;return-1}function Tn(t){return t!=t}function Mn(t,e,n){return e==e?function(t,e,n){for(var i=n-1,o=t.length;++i<o;)if(t[i]===e)return i;return-1}(t,e,n):Sn(t,Tn,n)}function kn(t,e){return!!(null==t?0:t.length)&&Mn(t,e,0)>-1}var An=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function Rn(t,e,n){var i=e+"";return _n(t,function(t,e){var n=e.length;if(!n)return t;var i=n-1;return e[i]=(n>1?"& ":"")+e[i],e=e.join(n>2?", ":" "),t.replace(xn,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return Nn(An,(function(n){var i="_."+n[0];e&n[1]&&!kn(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(yn);return e?e[1].split(bn):[]}(i),n)))}var On=1,Pn=2,Dn=4,Ln=8,In=32,Bn=64;function jn(t,e,n,i,o,r,a,s,l,u){var c=e&Ln;e|=c?In:Bn,(e&=~(c?Bn:In))&Dn||(e&=~(On|Pn));var d=[t,e,o,c?r:void 0,c?a:void 0,c?void 0:r,c?void 0:a,s,l,u],h=n.apply(void 0,d);return pn(t)&&mn(h,d),h.placeholder=i,Rn(h,t,e)}function Fn(t){return t.placeholder}var Hn=9007199254740991,Wn=/^(?:0|[1-9]\d*)$/;function zn(t,e){var n=typeof t;return!!(e=null==e?Hn:e)&&("number"==n||"symbol"!=n&&Wn.test(t))&&t>-1&&t%1==0&&t<e}var Un=Math.min;var qn="__lodash_placeholder__";function Gn(t,e){for(var n=-1,i=t.length,o=0,r=[];++n<i;){var a=t[n];a!==e&&a!==qn||(t[n]=qn,r[o++]=n)}return r}var Vn=1,Kn=2,Xn=8,Yn=16,$n=128,Zn=512;function Jn(t,e,n,i,o,r,a,s,l,u){var c=e&$n,d=e&Vn,h=e&Kn,f=e&(Xn|Yn),p=e&Zn,g=h?void 0:Ke(t);return function v(){for(var m=arguments.length,y=Array(m),b=m;b--;)y[b]=arguments[b];if(f)var x=Fn(v),w=function(t,e){for(var n=t.length,i=0;n--;)t[n]===e&&++i;return i}(y,x);if(i&&(y=Ze(y,i,o,f)),r&&(y=Qe(y,r,a,f)),m-=w,f&&m<u){var E=Gn(y,x);return jn(t,e,Jn,v.placeholder,n,y,E,s,l,u-m)}var C=d?n:this,_=h?C[t]:t;return m=y.length,s?y=function(t,e){for(var n=t.length,i=Un(e.length,n),o=cn(t);i--;){var r=e[i];t[i]=zn(r,n)?o[r]:void 0}return t}(y,s):p&&m>1&&y.reverse(),c&&l<m&&(y.length=l),this&&this!==jt&&this instanceof v&&(_=g||Ke(_)),_.apply(C,y)}}var Qn=1;var ti="__lodash_placeholder__",ei=1,ni=2,ii=4,oi=8,ri=128,ai=256,si=Math.min;var li="Expected a function",ui=1,ci=2,di=8,hi=16,fi=32,pi=64,gi=Math.max;function vi(t,e,n,i,o,r,a,s){var l=e&ci;if(!l&&"function"!=typeof t)throw new TypeError(li);var u=i?i.length:0;if(u||(e&=~(fi|pi),i=o=void 0),a=void 0===a?a:gi(Ee(a),0),s=void 0===s?s:Ee(s),u-=o?o.length:0,e&pi){var c=i,d=o;i=o=void 0}var h=l?void 0:rn(t),f=[t,e,n,i,o,c,d,r,a,s];if(h&&function(t,e){var n=t[1],i=e[1],o=n|i,r=o<(ei|ni|ri),a=i==ri&&n==oi||i==ri&&n==ai&&t[7].length<=e[8]||i==(ri|ai)&&e[7].length<=e[8]&&n==oi;if(!r&&!a)return t;i&ei&&(t[2]=e[2],o|=n&ei?0:ii);var s=e[3];if(s){var l=t[3];t[3]=l?Ze(l,s,e[4]):s,t[4]=l?Gn(t[3],ti):e[4]}(s=e[5])&&(l=t[5],t[5]=l?Qe(l,s,e[6]):s,t[6]=l?Gn(t[5],ti):e[6]),(s=e[7])&&(t[7]=s),i&ri&&(t[8]=null==t[8]?e[8]:si(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=o}(f,h),t=f[0],e=f[1],n=f[2],i=f[3],o=f[4],!(s=f[9]=void 0===f[9]?l?0:t.length:gi(f[9]-u,0))&&e&(di|hi)&&(e&=~(di|hi)),e&&e!=ui)p=e==di||e==hi?function(t,e,n){var i=Ke(t);return function o(){for(var r=arguments.length,a=Array(r),s=r,l=Fn(o);s--;)a[s]=arguments[s];var u=r<3&&a[0]!==l&&a[r-1]!==l?[]:Gn(a,l);return(r-=u.length)<n?jn(t,e,Jn,o.placeholder,void 0,a,u,void 0,void 0,n-r):Ye(this&&this!==jt&&this instanceof o?i:t,this,a)}}(t,e,s):e!=fi&&e!=(ui|fi)||o.length?Jn.apply(void 0,f):function(t,e,n,i){var o=e&Qn,r=Ke(t);return function e(){for(var a=-1,s=arguments.length,l=-1,u=i.length,c=Array(u+s),d=this&&this!==jt&&this instanceof e?r:t;++l<u;)c[l]=i[l];for(;s--;)c[l++]=arguments[++a];return Ye(d,o?n:this,c)}}(t,e,n,i);else var p=function(t,e,n){var i=e&Xe,o=Ke(t);return function e(){return(this&&this!==jt&&this instanceof e?o:t).apply(i?n:this,arguments)}}(t,e,n);return Rn((h?qe:mn)(p,f),t,e)}var mi=128;function yi(t,e,n){return e=n?void 0:e,e=t&&null==e?t.length:e,vi(t,mi,void 0,void 0,void 0,void 0,e)}function bi(t,e,n){"__proto__"==e&&En?En(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function xi(t,e){return t===e||t!=t&&e!=e}var wi=Object.prototype.hasOwnProperty;function Ei(t,e,n){var i=t[e];wi.call(t,e)&&xi(i,n)&&(void 0!==n||e in t)||bi(t,e,n)}function Ci(t,e,n,i){var o=!n;n||(n={});for(var r=-1,a=e.length;++r<a;){var s=e[r],l=i?i(n[s],t[s],s,n,t):void 0;void 0===l&&(l=t[s]),o?bi(n,s,l):Ei(n,s,l)}return n}var _i=Math.max;function Ni(t,e,n){return e=_i(void 0===e?t.length-1:e,0),function(){for(var i=arguments,o=-1,r=_i(i.length-e,0),a=Array(r);++o<r;)a[o]=i[e+o];o=-1;for(var s=Array(e+1);++o<e;)s[o]=i[o];return s[e]=n(a),Ye(t,this,s)}}function Si(t,e){return _n(Ni(t,e,Ce),t+"")}var Ti=9007199254740991;function Mi(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Ti}function ki(t){return null!=t&&Mi(t.length)&&!Me(t)}function Ai(t,e,n){if(!he(n))return!1;var i=typeof e;return!!("number"==i?ki(n)&&zn(e,n.length):"string"==i&&e in n)&&xi(n[e],t)}function Ri(t){return Si((function(e,n){var i=-1,o=n.length,r=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(o--,r):void 0,a&&Ai(n[0],n[1],a)&&(r=o<3?void 0:r,o=1),e=Object(e);++i<o;){var s=n[i];s&&t(e,s,i,r)}return e}))}var Oi=Object.prototype;function Pi(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Oi)}function Di(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}function Li(t){return Yt(t)&&"[object Arguments]"==Xt(t)}var Ii=Object.prototype,Bi=Ii.hasOwnProperty,ji=Ii.propertyIsEnumerable,Fi=Li(function(){return arguments}())?Li:function(t){return Yt(t)&&Bi.call(t,"callee")&&!ji.call(t,"callee")};function Hi(){return!1}var Wi="object"==typeof t&&t&&!t.nodeType&&t,zi=Wi&&"object"==typeof module&&module&&!module.nodeType&&module,Ui=zi&&zi.exports===Wi?jt.Buffer:void 0,qi=(Ui?Ui.isBuffer:void 0)||Hi,Gi={};function Vi(t){return function(e){return t(e)}}Gi["[object Float32Array]"]=Gi["[object Float64Array]"]=Gi["[object Int8Array]"]=Gi["[object Int16Array]"]=Gi["[object Int32Array]"]=Gi["[object Uint8Array]"]=Gi["[object Uint8ClampedArray]"]=Gi["[object Uint16Array]"]=Gi["[object Uint32Array]"]=!0,Gi["[object Arguments]"]=Gi["[object Array]"]=Gi["[object ArrayBuffer]"]=Gi["[object Boolean]"]=Gi["[object DataView]"]=Gi["[object Date]"]=Gi["[object Error]"]=Gi["[object Function]"]=Gi["[object Map]"]=Gi["[object Number]"]=Gi["[object Object]"]=Gi["[object RegExp]"]=Gi["[object Set]"]=Gi["[object String]"]=Gi["[object WeakMap]"]=!1;var Ki="object"==typeof t&&t&&!t.nodeType&&t,Xi=Ki&&"object"==typeof module&&module&&!module.nodeType&&module,Yi=Xi&&Xi.exports===Ki&&It.process,$i=function(){try{var t=Xi&&Xi.require&&Xi.require("util").types;return t||Yi&&Yi.binding&&Yi.binding("util")}catch(t){}}(),Zi=$i&&$i.isTypedArray,Ji=Zi?Vi(Zi):function(t){return Yt(t)&&Mi(t.length)&&!!Gi[Xt(t)]},Qi=Object.prototype.hasOwnProperty;function to(t,e){var n=ee(t),i=!n&&Fi(t),o=!n&&!i&&qi(t),r=!n&&!i&&!o&&Ji(t),a=n||i||o||r,s=a?Di(t.length,String):[],l=s.length;for(var u in t)!e&&!Qi.call(t,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||r&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||zn(u,l))||s.push(u);return s}function eo(t,e){return function(n){return t(e(n))}}var no=eo(Object.keys,Object),io=Object.prototype.hasOwnProperty;function oo(t){if(!Pi(t))return no(t);var e=[];for(var n in Object(t))io.call(t,n)&&"constructor"!=n&&e.push(n);return e}function ro(t){return ki(t)?to(t):oo(t)}var ao=Object.prototype.hasOwnProperty,so=Ri((function(t,e){if(Pi(e)||ki(e))Ci(e,ro(e),t);else for(var n in e)ao.call(e,n)&&Ei(t,n,e[n])}));var lo=Object.prototype.hasOwnProperty;function uo(t){if(!he(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Pi(t),n=[];for(var i in t)("constructor"!=i||!e&&lo.call(t,i))&&n.push(i);return n}function co(t){return ki(t)?to(t,!0):uo(t)}var ho=Ri((function(t,e){Ci(e,co(e),t)})),fo=Ri((function(t,e,n,i){Ci(e,co(e),t,i)})),po=Ri((function(t,e,n,i){Ci(e,ro(e),t,i)})),go=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,vo=/^\w*$/;function mo(t,e){if(ee(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Zt(t))||(vo.test(t)||!go.test(t)||null!=e&&t in Object(e))}var yo=We(Object,"create");var bo=Object.prototype.hasOwnProperty;var xo=Object.prototype.hasOwnProperty;function wo(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function Eo(t,e){for(var n=t.length;n--;)if(xi(t[n][0],e))return n;return-1}wo.prototype.clear=function(){this.__data__=yo?yo(null):{},this.size=0},wo.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},wo.prototype.get=function(t){var e=this.__data__;if(yo){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return bo.call(e,t)?e[t]:void 0},wo.prototype.has=function(t){var e=this.__data__;return yo?void 0!==e[t]:xo.call(e,t)},wo.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=yo&&void 0===e?"__lodash_hash_undefined__":e,this};var Co=Array.prototype.splice;function _o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}_o.prototype.clear=function(){this.__data__=[],this.size=0},_o.prototype.delete=function(t){var e=this.__data__,n=Eo(e,t);return!(n<0)&&(n==e.length-1?e.pop():Co.call(e,n,1),--this.size,!0)},_o.prototype.get=function(t){var e=this.__data__,n=Eo(e,t);return n<0?void 0:e[n][1]},_o.prototype.has=function(t){return Eo(this.__data__,t)>-1},_o.prototype.set=function(t,e){var n=this.__data__,i=Eo(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};var No=We(jt,"Map");function So(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map}function To(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}To.prototype.clear=function(){this.size=0,this.__data__={hash:new wo,map:new(No||_o),string:new wo}},To.prototype.delete=function(t){var e=So(this,t).delete(t);return this.size-=e?1:0,e},To.prototype.get=function(t){return So(this,t).get(t)},To.prototype.has=function(t){return So(this,t).has(t)},To.prototype.set=function(t,e){var n=So(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};var Mo="Expected a function";function ko(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(Mo);var n=function(){var i=arguments,o=e?e.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=t.apply(this,i);return n.cache=r.set(o,a)||r,a};return n.cache=new(ko.Cache||To),n}ko.Cache=To;var Ao=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ro=/\\(\\)?/g,Oo=function(t){var e=ko(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Ao,(function(t,n,i,o){e.push(i?o.replace(Ro,"$1"):n||t)})),e}));function Po(t){return null==t?"":re(t)}function Do(t,e){return ee(t)?t:mo(t,e)?[t]:Oo(Po(t))}var Lo=1/0;function Io(t){if("string"==typeof t||Zt(t))return t;var e=t+"";return"0"==e&&1/t==-Lo?"-0":e}function Bo(t,e){for(var n=0,i=(e=Do(e,t)).length;null!=t&&n<i;)t=t[Io(e[n++])];return n&&n==i?t:void 0}function jo(t,e,n){var i=null==t?void 0:Bo(t,e);return void 0===i?n:i}function Fo(t,e){for(var n=-1,i=e.length,o=Array(i),r=null==t;++n<i;)o[n]=r?void 0:jo(t,e[n]);return o}function Ho(t,e){for(var n=-1,i=e.length,o=t.length;++n<i;)t[o+n]=e[n];return t}var Wo=Ft?Ft.isConcatSpreadable:void 0;function zo(t){return ee(t)||Fi(t)||!!(Wo&&t&&t[Wo])}function Uo(t,e,n,i,o){var r=-1,a=t.length;for(n||(n=zo),o||(o=[]);++r<a;){var s=t[r];e>0&&n(s)?e>1?Uo(s,e-1,n,i,o):Ho(o,s):i||(o[o.length]=s)}return o}function qo(t){return(null==t?0:t.length)?Uo(t,1):[]}function Go(t){return _n(Ni(t,void 0,qo),t+"")}var Vo=Go(Fo),Ko=eo(Object.getPrototypeOf,Object),Xo="[object Object]",Yo=Function.prototype,$o=Object.prototype,Zo=Yo.toString,Jo=$o.hasOwnProperty,Qo=Zo.call(Object);function tr(t){if(!Yt(t)||Xt(t)!=Xo)return!1;var e=Ko(t);if(null===e)return!0;var n=Jo.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Zo.call(n)==Qo}var er="[object DOMException]",nr="[object Error]";function ir(t){if(!Yt(t))return!1;var e=Xt(t);return e==nr||e==er||"string"==typeof t.message&&"string"==typeof t.name&&!tr(t)}var or=Si((function(t,e){try{return Ye(t,void 0,e)}catch(t){return ir(t)?t:new Error(t)}})),rr="Expected a function";function ar(t,e){var n;if("function"!=typeof e)throw new TypeError(rr);return t=Ee(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var sr=Si((function(t,e,n){var i=1;if(n.length){var o=Gn(n,Fn(sr));i|=32}return vi(t,i,e,n,o)}));sr.placeholder={};var lr=Go((function(t,e){return Nn(e,(function(e){e=Io(e),bi(t,e,sr(t[e],t))})),t})),ur=Si((function(t,e,n){var i=3;if(n.length){var o=Gn(n,Fn(ur));i|=32}return vi(e,i,t,n,o)}));function cr(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var r=Array(o);++i<o;)r[i]=t[i+e];return r}function dr(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:cr(t,e,n)}ur.placeholder={};var hr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function fr(t){return hr.test(t)}var pr="\\ud800-\\udfff",gr="["+pr+"]",vr="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",mr="\\ud83c[\\udffb-\\udfff]",yr="[^"+pr+"]",br="(?:\\ud83c[\\udde6-\\uddff]){2}",xr="[\\ud800-\\udbff][\\udc00-\\udfff]",wr="(?:"+vr+"|"+mr+")"+"?",Er="[\\ufe0e\\ufe0f]?",Cr=Er+wr+("(?:\\u200d(?:"+[yr,br,xr].join("|")+")"+Er+wr+")*"),_r="(?:"+[yr+vr+"?",vr,br,xr,gr].join("|")+")",Nr=RegExp(mr+"(?="+mr+")|"+_r+Cr,"g");function Sr(t){return fr(t)?function(t){return t.match(Nr)||[]}(t):function(t){return t.split("")}(t)}function Tr(t){return function(e){var n=fr(e=Po(e))?Sr(e):void 0,i=n?n[0]:e.charAt(0),o=n?dr(n,1).join(""):e.slice(1);return i[t]()+o}}var Mr=Tr("toUpperCase");function kr(t){return Mr(Po(t).toLowerCase())}function Ar(t,e,n,i){var o=-1,r=null==t?0:t.length;for(i&&r&&(n=t[++o]);++o<r;)n=e(n,t[o],o,t);return n}function Rr(t){return function(e){return null==t?void 0:t[e]}}var Or=Rr({"À":"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"}),Pr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Dr=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");function Lr(t){return(t=Po(t))&&t.replace(Pr,Or).replace(Dr,"")}var Ir=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Br=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var jr="\\ud800-\\udfff",Fr="\\u2700-\\u27bf",Hr="a-z\\xdf-\\xf6\\xf8-\\xff",Wr="A-Z\\xc0-\\xd6\\xd8-\\xde",zr="\\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",Ur="["+zr+"]",qr="\\d+",Gr="["+Fr+"]",Vr="["+Hr+"]",Kr="[^"+jr+zr+qr+Fr+Hr+Wr+"]",Xr="(?:\\ud83c[\\udde6-\\uddff]){2}",Yr="[\\ud800-\\udbff][\\udc00-\\udfff]",$r="["+Wr+"]",Zr="(?:"+Vr+"|"+Kr+")",Jr="(?:"+$r+"|"+Kr+")",Qr="(?:['’](?:d|ll|m|re|s|t|ve))?",ta="(?:['’](?:D|LL|M|RE|S|T|VE))?",ea="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",na="[\\ufe0e\\ufe0f]?",ia=na+ea+("(?:\\u200d(?:"+["[^"+jr+"]",Xr,Yr].join("|")+")"+na+ea+")*"),oa="(?:"+[Gr,Xr,Yr].join("|")+")"+ia,ra=RegExp([$r+"?"+Vr+"+"+Qr+"(?="+[Ur,$r,"$"].join("|")+")",Jr+"+"+ta+"(?="+[Ur,$r+Zr,"$"].join("|")+")",$r+"?"+Zr+"+"+Qr,$r+"+"+ta,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",qr,oa].join("|"),"g");function aa(t,e,n){return t=Po(t),void 0===(e=n?void 0:e)?function(t){return Br.test(t)}(t)?function(t){return t.match(ra)||[]}(t):function(t){return t.match(Ir)||[]}(t):t.match(e)||[]}var sa=RegExp("['’]","g");function la(t){return function(e){return Ar(aa(Lr(e).replace(sa,"")),t,"")}}var ua=la((function(t,e,n){return e=e.toLowerCase(),t+(n?kr(e):e)}));var ca=jt.isFinite,da=Math.min;function ha(t){var e=Math[t];return function(t,n){if(t=ye(t),(n=null==n?0:da(Ee(n),292))&&ca(t)){var i=(Po(t)+"e").split("e");return+((i=(Po(e(i[0]+"e"+(+i[1]+n)))+"e").split("e"))[0]+"e"+(+i[1]-n))}return e(t)}}var fa=ha("ceil");function pa(t){var e=fn(t);return e.__chain__=!0,e}var ga=Math.ceil,va=Math.max;function ma(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}function ya(t){var e=this.__data__=new _o(t);this.size=e.size}function ba(t,e){return t&&Ci(e,ro(e),t)}ya.prototype.clear=function(){this.__data__=new _o,this.size=0},ya.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},ya.prototype.get=function(t){return this.__data__.get(t)},ya.prototype.has=function(t){return this.__data__.has(t)},ya.prototype.set=function(t,e){var n=this.__data__;if(n instanceof _o){var i=n.__data__;if(!No||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new To(i)}return n.set(t,e),this.size=n.size,this};var xa="object"==typeof t&&t&&!t.nodeType&&t,wa=xa&&"object"==typeof module&&module&&!module.nodeType&&module,Ea=wa&&wa.exports===xa?jt.Buffer:void 0,Ca=Ea?Ea.allocUnsafe:void 0;function _a(t,e){if(e)return t.slice();var n=t.length,i=Ca?Ca(n):new t.constructor(n);return t.copy(i),i}function Na(t,e){for(var n=-1,i=null==t?0:t.length,o=0,r=[];++n<i;){var a=t[n];e(a,n,t)&&(r[o++]=a)}return r}function Sa(){return[]}var Ta=Object.prototype.propertyIsEnumerable,Ma=Object.getOwnPropertySymbols,ka=Ma?function(t){return null==t?[]:(t=Object(t),Na(Ma(t),(function(e){return Ta.call(t,e)})))}:Sa;var Aa=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Ho(e,ka(t)),t=Ko(t);return e}:Sa;function Ra(t,e,n){var i=e(t);return ee(t)?i:Ho(i,n(t))}function Oa(t){return Ra(t,ro,ka)}function Pa(t){return Ra(t,co,Aa)}var Da=We(jt,"DataView"),La=We(jt,"Promise"),Ia=We(jt,"Set"),Ba="[object Map]",ja="[object Promise]",Fa="[object Set]",Ha="[object WeakMap]",Wa="[object DataView]",za=Pe(Da),Ua=Pe(No),qa=Pe(La),Ga=Pe(Ia),Va=Pe(ze),Ka=Xt;(Da&&Ka(new Da(new ArrayBuffer(1)))!=Wa||No&&Ka(new No)!=Ba||La&&Ka(La.resolve())!=ja||Ia&&Ka(new Ia)!=Fa||ze&&Ka(new ze)!=Ha)&&(Ka=function(t){var e=Xt(t),n="[object Object]"==e?t.constructor:void 0,i=n?Pe(n):"";if(i)switch(i){case za:return Wa;case Ua:return Ba;case qa:return ja;case Ga:return Fa;case Va:return Ha}return e});var Xa=Ka,Ya=Object.prototype.hasOwnProperty;var $a=jt.Uint8Array;function Za(t){var e=new t.constructor(t.byteLength);return new $a(e).set(new $a(t)),e}var Ja=/\w*$/;var Qa=Ft?Ft.prototype:void 0,ts=Qa?Qa.valueOf:void 0;function es(t,e){var n=e?Za(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var ns="[object Boolean]",is="[object Date]",os="[object Map]",rs="[object Number]",as="[object RegExp]",ss="[object Set]",ls="[object String]",us="[object Symbol]",cs="[object ArrayBuffer]",ds="[object DataView]",hs="[object Float32Array]",fs="[object Float64Array]",ps="[object Int8Array]",gs="[object Int16Array]",vs="[object Int32Array]",ms="[object Uint8Array]",ys="[object Uint8ClampedArray]",bs="[object Uint16Array]",xs="[object Uint32Array]";function ws(t,e,n){var i,o=t.constructor;switch(e){case cs:return Za(t);case ns:case is:return new o(+t);case ds:return function(t,e){var n=e?Za(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case hs:case fs:case ps:case gs:case vs:case ms:case ys:case bs:case xs:return es(t,n);case os:return new o;case rs:case ls:return new o(t);case as:return function(t){var e=new t.constructor(t.source,Ja.exec(t));return e.lastIndex=t.lastIndex,e}(t);case ss:return new o;case us:return i=t,ts?Object(ts.call(i)):{}}}function Es(t){return"function"!=typeof t.constructor||Pi(t)?{}:Ve(Ko(t))}var Cs=$i&&$i.isMap,_s=Cs?Vi(Cs):function(t){return Yt(t)&&"[object Map]"==Xa(t)};var Ns=$i&&$i.isSet,Ss=Ns?Vi(Ns):function(t){return Yt(t)&&"[object Set]"==Xa(t)},Ts=1,Ms=2,ks=4,As="[object Arguments]",Rs="[object Function]",Os="[object GeneratorFunction]",Ps="[object Object]",Ds={};function Ls(t,e,n,i,o,r){var a,s=e&Ts,l=e&Ms,u=e&ks;if(n&&(a=o?n(t,i,o,r):n(t)),void 0!==a)return a;if(!he(t))return t;var c=ee(t);if(c){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Ya.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!s)return cn(t,a)}else{var d=Xa(t),h=d==Rs||d==Os;if(qi(t))return _a(t,s);if(d==Ps||d==As||h&&!o){if(a=l||h?{}:Es(t),!s)return l?function(t,e){return Ci(t,Aa(t),e)}(t,function(t,e){return t&&Ci(e,co(e),t)}(a,t)):function(t,e){return Ci(t,ka(t),e)}(t,ba(a,t))}else{if(!Ds[d])return o?t:{};a=ws(t,d,s)}}r||(r=new ya);var f=r.get(t);if(f)return f;r.set(t,a),Ss(t)?t.forEach((function(i){a.add(Ls(i,e,n,i,t,r))})):_s(t)&&t.forEach((function(i,o){a.set(o,Ls(i,e,n,o,t,r))}));var p=c?void 0:(u?l?Pa:Oa:l?co:ro)(t);return Nn(p||t,(function(i,o){p&&(i=t[o=i]),Ei(a,o,Ls(i,e,n,o,t,r))})),a}Ds[As]=Ds["[object Array]"]=Ds["[object ArrayBuffer]"]=Ds["[object DataView]"]=Ds["[object Boolean]"]=Ds["[object Date]"]=Ds["[object Float32Array]"]=Ds["[object Float64Array]"]=Ds["[object Int8Array]"]=Ds["[object Int16Array]"]=Ds["[object Int32Array]"]=Ds["[object Map]"]=Ds["[object Number]"]=Ds[Ps]=Ds["[object RegExp]"]=Ds["[object Set]"]=Ds["[object String]"]=Ds["[object Symbol]"]=Ds["[object Uint8Array]"]=Ds["[object Uint8ClampedArray]"]=Ds["[object Uint16Array]"]=Ds["[object Uint32Array]"]=!0,Ds["[object Error]"]=Ds[Rs]=Ds["[object WeakMap]"]=!1;function Is(t){return Ls(t,5)}function Bs(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new To;++e<n;)this.add(t[e])}function js(t,e){for(var n=-1,i=null==t?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1}function Fs(t,e){return t.has(e)}Bs.prototype.add=Bs.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Bs.prototype.has=function(t){return this.__data__.has(t)};var Hs=1,Ws=2;function zs(t,e,n,i,o,r){var a=n&Hs,s=t.length,l=e.length;if(s!=l&&!(a&&l>s))return!1;var u=r.get(t),c=r.get(e);if(u&&c)return u==e&&c==t;var d=-1,h=!0,f=n&Ws?new Bs:void 0;for(r.set(t,e),r.set(e,t);++d<s;){var p=t[d],g=e[d];if(i)var v=a?i(g,p,d,e,t,r):i(p,g,d,t,e,r);if(void 0!==v){if(v)continue;h=!1;break}if(f){if(!js(e,(function(t,e){if(!Fs(f,e)&&(p===t||o(p,t,n,i,r)))return f.push(e)}))){h=!1;break}}else if(p!==g&&!o(p,g,n,i,r)){h=!1;break}}return r.delete(t),r.delete(e),h}function Us(t){var e=-1,n=Array(t.size);return t.forEach((function(t,i){n[++e]=[i,t]})),n}function qs(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var Gs=1,Vs=2,Ks="[object Boolean]",Xs="[object Date]",Ys="[object Error]",$s="[object Map]",Zs="[object Number]",Js="[object RegExp]",Qs="[object Set]",tl="[object String]",el="[object Symbol]",nl="[object ArrayBuffer]",il="[object DataView]",ol=Ft?Ft.prototype:void 0,rl=ol?ol.valueOf:void 0;var al=1,sl=Object.prototype.hasOwnProperty;var ll=1,ul="[object Arguments]",cl="[object Array]",dl="[object Object]",hl=Object.prototype.hasOwnProperty;function fl(t,e,n,i,o,r){var a=ee(t),s=ee(e),l=a?cl:Xa(t),u=s?cl:Xa(e),c=(l=l==ul?dl:l)==dl,d=(u=u==ul?dl:u)==dl,h=l==u;if(h&&qi(t)){if(!qi(e))return!1;a=!0,c=!1}if(h&&!c)return r||(r=new ya),a||Ji(t)?zs(t,e,n,i,o,r):function(t,e,n,i,o,r,a){switch(n){case il:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case nl:return!(t.byteLength!=e.byteLength||!r(new $a(t),new $a(e)));case Ks:case Xs:case Zs:return xi(+t,+e);case Ys:return t.name==e.name&&t.message==e.message;case Js:case tl:return t==e+"";case $s:var s=Us;case Qs:var l=i&Gs;if(s||(s=qs),t.size!=e.size&&!l)return!1;var u=a.get(t);if(u)return u==e;i|=Vs,a.set(t,e);var c=zs(s(t),s(e),i,o,r,a);return a.delete(t),c;case el:if(rl)return rl.call(t)==rl.call(e)}return!1}(t,e,l,n,i,o,r);if(!(n&ll)){var f=c&&hl.call(t,"__wrapped__"),p=d&&hl.call(e,"__wrapped__");if(f||p){var g=f?t.value():t,v=p?e.value():e;return r||(r=new ya),o(g,v,n,i,r)}}return!!h&&(r||(r=new ya),function(t,e,n,i,o,r){var a=n&al,s=Oa(t),l=s.length;if(l!=Oa(e).length&&!a)return!1;for(var u=l;u--;){var c=s[u];if(!(a?c in e:sl.call(e,c)))return!1}var d=r.get(t),h=r.get(e);if(d&&h)return d==e&&h==t;var f=!0;r.set(t,e),r.set(e,t);for(var p=a;++u<l;){var g=t[c=s[u]],v=e[c];if(i)var m=a?i(v,g,c,e,t,r):i(g,v,c,t,e,r);if(!(void 0===m?g===v||o(g,v,n,i,r):m)){f=!1;break}p||(p="constructor"==c)}if(f&&!p){var y=t.constructor,b=e.constructor;y==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(f=!1)}return r.delete(t),r.delete(e),f}(t,e,n,i,o,r))}function pl(t,e,n,i,o){return t===e||(null==t||null==e||!Yt(t)&&!Yt(e)?t!=t&&e!=e:fl(t,e,n,i,pl,o))}var gl=1,vl=2;function ml(t,e,n,i){var o=n.length,r=o,a=!i;if(null==t)return!r;for(t=Object(t);o--;){var s=n[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<r;){var l=(s=n[o])[0],u=t[l],c=s[1];if(a&&s[2]){if(void 0===u&&!(l in t))return!1}else{var d=new ya;if(i)var h=i(u,c,l,t,e,d);if(!(void 0===h?pl(c,u,gl|vl,i,d):h))return!1}}return!0}function yl(t){return t==t&&!he(t)}function bl(t){for(var e=ro(t),n=e.length;n--;){var i=e[n],o=t[i];e[n]=[i,o,yl(o)]}return e}function xl(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}function wl(t){var e=bl(t);return 1==e.length&&e[0][2]?xl(e[0][0],e[0][1]):function(n){return n===t||ml(n,t,e)}}function El(t,e){return null!=t&&e in Object(t)}function Cl(t,e,n){for(var i=-1,o=(e=Do(e,t)).length,r=!1;++i<o;){var a=Io(e[i]);if(!(r=null!=t&&n(t,a)))break;t=t[a]}return r||++i!=o?r:!!(o=null==t?0:t.length)&&Mi(o)&&zn(a,o)&&(ee(t)||Fi(t))}function _l(t,e){return null!=t&&Cl(t,e,El)}var Nl=1,Sl=2;function Tl(t,e){return mo(t)&&yl(e)?xl(Io(t),e):function(n){var i=jo(n,t);return void 0===i&&i===e?_l(n,t):pl(e,i,Nl|Sl)}}function Ml(t){return function(e){return null==e?void 0:e[t]}}function kl(t){return mo(t)?Ml(Io(t)):function(t){return function(e){return Bo(e,t)}}(t)}function Al(t){return"function"==typeof t?t:null==t?Ce:"object"==typeof t?ee(t)?Tl(t[0],t[1]):wl(t):kl(t)}function Rl(t,e,n){var i=n.length;if(null==t)return!i;for(t=Object(t);i--;){var o=n[i],r=e[o],a=t[o];if(void 0===a&&!(o in t)||!r(a))return!1}return!0}function Ol(t,e,n,i){for(var o=-1,r=null==t?0:t.length;++o<r;){var a=t[o];e(i,a,n(a),t)}return i}function Pl(t){return function(e,n,i){for(var o=-1,r=Object(e),a=i(e),s=a.length;s--;){var l=a[t?s:++o];if(!1===n(r[l],l,r))break}return e}}var Dl=Pl();function Ll(t,e){return t&&Dl(t,e,ro)}function Il(t,e){return function(n,i){if(null==n)return n;if(!ki(n))return t(n,i);for(var o=n.length,r=e?o:-1,a=Object(n);(e?r--:++r<o)&&!1!==i(a[r],r,a););return n}}var Bl=Il(Ll);function jl(t,e,n,i){return Bl(t,(function(t,o,r){e(i,t,n(t),r)})),i}function Fl(t,e){return function(n,i){var o=ee(n)?Ol:jl,r=e?e():{};return o(n,t,Al(i),r)}}var Hl=Object.prototype.hasOwnProperty,Wl=Fl((function(t,e,n){Hl.call(t,n)?++t[n]:bi(t,n,1)}));function zl(t,e,n){var i=vi(t,8,void 0,void 0,void 0,void 0,void 0,e=n?void 0:e);return i.placeholder=zl.placeholder,i}zl.placeholder={};function Ul(t,e,n){var i=vi(t,16,void 0,void 0,void 0,void 0,void 0,e=n?void 0:e);return i.placeholder=Ul.placeholder,i}Ul.placeholder={};var ql=function(){return jt.Date.now()},Gl="Expected a function",Vl=Math.max,Kl=Math.min;function Xl(t,e,n){var i,o,r,a,s,l,u=0,c=!1,d=!1,h=!0;if("function"!=typeof t)throw new TypeError(Gl);function f(e){var n=i,r=o;return i=o=void 0,u=e,a=t.apply(r,n)}function p(t){var n=t-l;return void 0===l||n>=e||n<0||d&&t-u>=r}function g(){var t=ql();if(p(t))return v(t);s=setTimeout(g,function(t){var n=e-(t-l);return d?Kl(n,r-(t-u)):n}(t))}function v(t){return s=void 0,h&&i?f(t):(i=o=void 0,a)}function m(){var t=ql(),n=p(t);if(i=arguments,o=this,l=t,n){if(void 0===s)return function(t){return u=t,s=setTimeout(g,e),c?f(t):a}(l);if(d)return clearTimeout(s),s=setTimeout(g,e),f(l)}return void 0===s&&(s=setTimeout(g,e)),a}return e=ye(e)||0,he(n)&&(c=!!n.leading,r=(d="maxWait"in n)?Vl(ye(n.maxWait)||0,e):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(ql())},m}var Yl=Object.prototype,$l=Yl.hasOwnProperty,Zl=Si((function(t,e){t=Object(t);var n=-1,i=e.length,o=i>2?e[2]:void 0;for(o&&Ai(e[0],e[1],o)&&(i=1);++n<i;)for(var r=e[n],a=co(r),s=-1,l=a.length;++s<l;){var u=a[s],c=t[u];(void 0===c||xi(c,Yl[u])&&!$l.call(t,u))&&(t[u]=r[u])}return t}));function Jl(t,e,n){(void 0!==n&&!xi(t[e],n)||void 0===n&&!(e in t))&&bi(t,e,n)}function Ql(t){return Yt(t)&&ki(t)}function tu(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function eu(t){return Ci(t,co(t))}function nu(t,e,n,i,o){t!==e&&Dl(e,(function(r,a){if(o||(o=new ya),he(r))!function(t,e,n,i,o,r,a){var s=tu(t,n),l=tu(e,n),u=a.get(l);if(u)Jl(t,n,u);else{var c=r?r(s,l,n+"",t,e,a):void 0,d=void 0===c;if(d){var h=ee(l),f=!h&&qi(l),p=!h&&!f&&Ji(l);c=l,h||f||p?ee(s)?c=s:Ql(s)?c=cn(s):f?(d=!1,c=_a(l,!0)):p?(d=!1,c=es(l,!0)):c=[]:tr(l)||Fi(l)?(c=s,Fi(s)?c=eu(s):he(s)&&!Me(s)||(c=Es(l))):d=!1}d&&(a.set(l,c),o(c,l,i,r,a),a.delete(l)),Jl(t,n,c)}}(t,e,a,n,nu,i,o);else{var s=i?i(tu(t,a),r,a+"",t,e,o):void 0;void 0===s&&(s=r),Jl(t,a,s)}}),co)}function iu(t,e,n,i,o,r){return he(t)&&he(e)&&(r.set(e,t),nu(t,e,void 0,iu,r),r.delete(e)),t}var ou=Ri((function(t,e,n,i){nu(t,e,n,i)})),ru=Si((function(t){return t.push(void 0,iu),Ye(ou,void 0,t)}));function au(t,e,n){if("function"!=typeof t)throw new TypeError("Expected a function");return setTimeout((function(){t.apply(void 0,n)}),e)}var su=Si((function(t,e){return au(t,1,e)})),lu=Si((function(t,e,n){return au(t,ye(e)||0,n)}));function uu(t,e,n){for(var i=-1,o=null==t?0:t.length;++i<o;)if(n(e,t[i]))return!0;return!1}var cu=200;function du(t,e,n,i){var o=-1,r=kn,a=!0,s=t.length,l=[],u=e.length;if(!s)return l;n&&(e=te(e,Vi(n))),i?(r=uu,a=!1):e.length>=cu&&(r=Fs,a=!1,e=new Bs(e));t:for(;++o<s;){var c=t[o],d=null==n?c:n(c);if(c=i||0!==c?c:0,a&&d==d){for(var h=u;h--;)if(e[h]===d)continue t;l.push(c)}else r(e,d,i)||l.push(c)}return l}var hu=Si((function(t,e){return Ql(t)?du(t,Uo(e,1,Ql,!0)):[]}));function fu(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}var pu=Si((function(t,e){var n=fu(e);return Ql(n)&&(n=void 0),Ql(t)?du(t,Uo(e,1,Ql,!0),Al(n)):[]})),gu=Si((function(t,e){var n=fu(e);return Ql(n)&&(n=void 0),Ql(t)?du(t,Uo(e,1,Ql,!0),void 0,n):[]})),vu=ae((function(t,e){return t/e}),1);function mu(t,e,n,i){for(var o=t.length,r=i?o:-1;(i?r--:++r<o)&&e(t[r],r,t););return n?cr(t,i?0:r,i?r+1:o):cr(t,i?r+1:0,i?o:r)}function yu(t){return"function"==typeof t?t:Ce}function bu(t,e){return(ee(t)?Nn:Bl)(t,yu(e))}function xu(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}var wu=Pl(!0);function Eu(t,e){return t&&wu(t,e,ro)}var Cu=Il(Eu,!0);function _u(t,e){return(ee(t)?xu:Cu)(t,yu(e))}function Nu(t){return function(e){var n=Xa(e);return"[object Map]"==n?Us(e):"[object Set]"==n?function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}(e):function(t,e){return te(e,(function(e){return[e,t[e]]}))}(e,t(e))}}var Su=Nu(ro),Tu=Nu(co),Mu=Rr({"&":"&","<":"<",">":">",'"':""","'":"'"}),ku=/[&<>"']/g,Au=RegExp(ku.source);function Ru(t){return(t=Po(t))&&Au.test(t)?t.replace(ku,Mu):t}var Ou=/[\\^$.*+?()[\]{}|]/g,Pu=RegExp(Ou.source);function Du(t,e){for(var n=-1,i=null==t?0:t.length;++n<i;)if(!e(t[n],n,t))return!1;return!0}function Lu(t,e){var n=!0;return Bl(t,(function(t,i,o){return n=!!e(t,i,o)})),n}var Iu=4294967295;function Bu(t){return t?ma(Ee(t),0,Iu):0}function ju(t,e){var n=[];return Bl(t,(function(t,i,o){e(t,i,o)&&n.push(t)})),n}function Fu(t){return function(e,n,i){var o=Object(e);if(!ki(e)){var r=Al(n);e=ro(e),n=function(t){return r(o[t],t,o)}}var a=t(e,n,i);return a>-1?o[r?e[a]:a]:void 0}}var Hu=Math.max;function Wu(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=null==n?0:Ee(n);return o<0&&(o=Hu(i+o,0)),Sn(t,Al(e),o)}var zu=Fu(Wu);function Uu(t,e,n){var i;return n(t,(function(t,n,o){if(e(t,n,o))return i=n,!1})),i}var qu=Math.max,Gu=Math.min;function Vu(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i-1;return void 0!==n&&(o=Ee(n),o=n<0?qu(i+o,0):Gu(o,i-1)),Sn(t,Al(e),o,!0)}var Ku=Fu(Vu);function Xu(t){return t&&t.length?t[0]:void 0}function Yu(t,e){var n=-1,i=ki(t)?Array(t.length):[];return Bl(t,(function(t,o,r){i[++n]=e(t,o,r)})),i}function $u(t,e){return(ee(t)?te:Yu)(t,Al(e))}var Zu=ha("floor");function Ju(t){return Go((function(e){var n=e.length,i=n,o=un.prototype.thru;for(t&&e.reverse();i--;){var r=e[i];if("function"!=typeof r)throw new TypeError("Expected a function");if(o&&!a&&"wrapper"==ln(r))var a=new un([],!0)}for(i=a?i:n;++i<n;){var s=ln(r=e[i]),l="wrapper"==s?rn(r):void 0;a=l&&pn(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[ln(l[0])].apply(a,l[3]):1==r.length&&pn(r)?a[s]():a.thru(r)}return function(){var t=arguments,i=t[0];if(a&&1==t.length&&ee(i))return a.plant(i).value();for(var o=0,r=n?e[o].apply(this,t):i;++o<n;)r=e[o].call(this,r);return r}}))}var Qu=Ju(),tc=Ju(!0);function ec(t,e){return Na(e,(function(e){return Me(t[e])}))}var nc=Object.prototype.hasOwnProperty,ic=Fl((function(t,e,n){nc.call(t,n)?t[n].push(e):bi(t,n,[e])}));function oc(t,e){return t>e}function rc(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ye(e),n=ye(n)),t(e,n)}}var ac=rc(oc),sc=rc((function(t,e){return t>=e})),lc=Object.prototype.hasOwnProperty;function uc(t,e){return null!=t&&lc.call(t,e)}function cc(t,e){return null!=t&&Cl(t,e,uc)}var dc=Math.max,hc=Math.min;var fc="[object String]";function pc(t){return"string"==typeof t||!ee(t)&&Yt(t)&&Xt(t)==fc}function gc(t,e){return te(e,(function(e){return t[e]}))}function vc(t){return null==t?[]:gc(t,ro(t))}var mc=Math.max;var yc=Math.max;var bc=Math.min;function xc(t,e,n){for(var i=n?uu:kn,o=t[0].length,r=t.length,a=r,s=Array(r),l=1/0,u=[];a--;){var c=t[a];a&&e&&(c=te(c,Vi(e))),l=bc(c.length,l),s[a]=!n&&(e||o>=120&&c.length>=120)?new Bs(a&&c):void 0}c=t[0];var d=-1,h=s[0];t:for(;++d<o&&u.length<l;){var f=c[d],p=e?e(f):f;if(f=n||0!==f?f:0,!(h?Fs(h,p):i(u,p,n))){for(a=r;--a;){var g=s[a];if(!(g?Fs(g,p):i(t[a],p,n)))continue t}h&&h.push(p),u.push(f)}}return u}function wc(t){return Ql(t)?t:[]}var Ec=Si((function(t){var e=te(t,wc);return e.length&&e[0]===t[0]?xc(e):[]})),Cc=Si((function(t){var e=fu(t),n=te(t,wc);return e===fu(n)?e=void 0:n.pop(),n.length&&n[0]===t[0]?xc(n,Al(e)):[]})),_c=Si((function(t){var e=fu(t),n=te(t,wc);return(e="function"==typeof e?e:void 0)&&n.pop(),n.length&&n[0]===t[0]?xc(n,void 0,e):[]}));function Nc(t,e){return function(n,i){return function(t,e,n,i){return Ll(t,(function(t,o,r){e(i,n(t),o,r)})),i}(n,t,e(i),{})}}var Sc=Object.prototype.toString,Tc=Nc((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Sc.call(e)),t[e]=n}),wn(Ce)),Mc=Object.prototype,kc=Mc.hasOwnProperty,Ac=Mc.toString,Rc=Nc((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ac.call(e)),kc.call(t,e)?t[e].push(n):t[e]=[n]}),Al);function Oc(t,e){return e.length<2?t:Bo(t,cr(e,0,-1))}function Pc(t,e,n){var i=null==(t=Oc(t,e=Do(e,t)))?t:t[Io(fu(e))];return null==i?void 0:Ye(i,t,n)}var Dc=Si(Pc),Lc=Si((function(t,e,n){var i=-1,o="function"==typeof e,r=ki(t)?Array(t.length):[];return Bl(t,(function(t){r[++i]=o?Ye(e,t,n):Pc(t,e,n)})),r}));var Ic=$i&&$i.isArrayBuffer,Bc=Ic?Vi(Ic):function(t){return Yt(t)&&"[object ArrayBuffer]"==Xt(t)};var jc=$i&&$i.isDate,Fc=jc?Vi(jc):function(t){return Yt(t)&&"[object Date]"==Xt(t)};var Hc=Object.prototype.hasOwnProperty;function Wc(t){if(null==t)return!0;if(ki(t)&&(ee(t)||"string"==typeof t||"function"==typeof t.splice||qi(t)||Ji(t)||Fi(t)))return!t.length;var e=Xa(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(Pi(t))return!oo(t).length;for(var n in t)if(Hc.call(t,n))return!1;return!0}var zc=jt.isFinite;function Uc(t){return"number"==typeof t&&t==Ee(t)}var qc="[object Number]";function Gc(t){return"number"==typeof t||Yt(t)&&Xt(t)==qc}var Vc=Ae?Me:Hi;var Kc=$i&&$i.isRegExp,Xc=Kc?Vi(Kc):function(t){return Yt(t)&&"[object RegExp]"==Xt(t)},Yc=9007199254740991;var $c=Array.prototype.join;var Zc=la((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Jc=Fl((function(t,e,n){bi(t,n,e)}));var Qc=Math.max,td=Math.min;var ed=la((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),nd=Tr("toLowerCase");function id(t,e){return t<e}var od=rc(id),rd=rc((function(t,e){return t<=e}));function ad(t,e,n){for(var i=-1,o=t.length;++i<o;){var r=t[i],a=e(r);if(null!=a&&(void 0===s?a==a&&!Zt(a):n(a,s)))var s=a,l=r}return l}function sd(t,e){for(var n,i=-1,o=t.length;++i<o;){var r=e(t[i]);void 0!==r&&(n=void 0===n?r:n+r)}return n}var ld=NaN;function ud(t,e){var n=null==t?0:t.length;return n?sd(t,e)/n:ld}var cd=Ri((function(t,e,n){nu(t,e,n)})),dd=Si((function(t,e){return function(n){return Pc(n,t,e)}})),hd=Si((function(t,e){return function(n){return Pc(t,n,e)}}));function fd(t,e,n){var i=ro(e),o=ec(e,i),r=!(he(n)&&"chain"in n&&!n.chain),a=Me(t);return Nn(o,(function(n){var i=e[n];t[n]=i,a&&(t.prototype[n]=function(){var e=this.__chain__;if(r||e){var n=t(this.__wrapped__);return(n.__actions__=cn(this.__actions__)).push({func:i,args:arguments,thisArg:t}),n.__chain__=e,n}return i.apply(t,Ho([this.value()],arguments))})})),t}var pd=ae((function(t,e){return t*e}),1),gd="Expected a function";function vd(t){if("function"!=typeof t)throw new TypeError(gd);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var md="[object Map]",yd="[object Set]",bd=Ft?Ft.iterator:void 0;function xd(t){if(!t)return[];if(ki(t))return pc(t)?Sr(t):cn(t);if(bd&&t[bd])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[bd]());var e=Xa(t);return(e==md?Us:e==yd?qs:vc)(t)}function wd(t,e){var n=t.length;if(n)return zn(e+=e<0?n:0,n)?t[e]:void 0}function Ed(t,e){return null==(t=Oc(t,e=Do(e,t)))||delete t[Io(fu(e))]}function Cd(t){return tr(t)?void 0:t}var _d=Go((function(t,e){var n={};if(null==t)return n;var i=!1;e=te(e,(function(e){return e=Do(e,t),i||(i=e.length>1),e})),Ci(t,Pa(t),n),i&&(n=Ls(n,7,Cd));for(var o=e.length;o--;)Ed(n,e[o]);return n}));function Nd(t,e,n,i){if(!he(t))return t;for(var o=-1,r=(e=Do(e,t)).length,a=r-1,s=t;null!=s&&++o<r;){var l=Io(e[o]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(o!=a){var c=s[l];void 0===(u=i?i(c,l,s):void 0)&&(u=he(c)?c:zn(e[o+1])?[]:{})}Ei(s,l,u),s=s[l]}return t}function Sd(t,e,n){for(var i=-1,o=e.length,r={};++i<o;){var a=e[i],s=Bo(t,a);n(s,a)&&Nd(r,Do(a,t),s)}return r}function Td(t,e){if(null==t)return{};var n=te(Pa(t),(function(t){return[t]}));return e=Al(e),Sd(t,n,(function(t,n){return e(t,n[0])}))}function Md(t,e){if(t!==e){var n=void 0!==t,i=null===t,o=t==t,r=Zt(t),a=void 0!==e,s=null===e,l=e==e,u=Zt(e);if(!s&&!u&&!r&&t>e||r&&a&&l&&!s&&!u||i&&a&&l||!n&&l||!o)return 1;if(!i&&!r&&!u&&t<e||u&&n&&o&&!i&&!r||s&&n&&o||!a&&o||!l)return-1}return 0}function kd(t,e,n){e=e.length?te(e,(function(t){return ee(t)?function(e){return Bo(e,1===t.length?t[0]:t)}:t})):[Ce];var i=-1;e=te(e,Vi(Al));var o=Yu(t,(function(t,n,o){var r=te(e,(function(e){return e(t)}));return{criteria:r,index:++i,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(o,(function(t,e){return function(t,e,n){for(var i=-1,o=t.criteria,r=e.criteria,a=o.length,s=n.length;++i<a;){var l=Md(o[i],r[i]);if(l)return i>=s?l:l*("desc"==n[i]?-1:1)}return t.index-e.index}(t,e,n)}))}function Ad(t){return Go((function(e){return e=te(e,Vi(Al)),Si((function(n){var i=this;return t(e,(function(t){return Ye(t,i,n)}))}))}))}var Rd=Ad(te),Od=Si,Pd=Math.min,Dd=Od((function(t,e){var n=(e=1==e.length&&ee(e[0])?te(e[0],Vi(Al)):te(Uo(e,1),Vi(Al))).length;return Si((function(i){for(var o=-1,r=Pd(i.length,n);++o<r;)i[o]=e[o].call(this,i[o]);return Ye(t,this,i)}))})),Ld=Ad(Du),Id=Ad(js),Bd=9007199254740991,jd=Math.floor;function Fd(t,e){var n="";if(!t||e<1||e>Bd)return n;do{e%2&&(n+=t),(e=jd(e/2))&&(t+=t)}while(e);return n}var Hd=Ml("length"),Wd="\\ud800-\\udfff",zd="["+Wd+"]",Ud="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",qd="\\ud83c[\\udffb-\\udfff]",Gd="[^"+Wd+"]",Vd="(?:\\ud83c[\\udde6-\\uddff]){2}",Kd="[\\ud800-\\udbff][\\udc00-\\udfff]",Xd="(?:"+Ud+"|"+qd+")"+"?",Yd="[\\ufe0e\\ufe0f]?",$d=Yd+Xd+("(?:\\u200d(?:"+[Gd,Vd,Kd].join("|")+")"+Yd+Xd+")*"),Zd="(?:"+[Gd+Ud+"?",Ud,Vd,Kd,zd].join("|")+")",Jd=RegExp(qd+"(?="+qd+")|"+Zd+$d,"g");function Qd(t){return fr(t)?function(t){for(var e=Jd.lastIndex=0;Jd.test(t);)++e;return e}(t):Hd(t)}var th=Math.ceil;function eh(t,e){var n=(e=void 0===e?" ":re(e)).length;if(n<2)return n?Fd(e,t):e;var i=Fd(e,th(t/Qd(e)));return fr(e)?dr(Sr(i),0,t).join(""):i.slice(0,t)}var nh=Math.ceil,ih=Math.floor;var oh=/^\s+/,rh=jt.parseInt;var ah=Si((function(t,e){return vi(t,32,void 0,e,Gn(e,Fn(ah)))}));ah.placeholder={};var sh=Si((function(t,e){return vi(t,64,void 0,e,Gn(e,Fn(sh)))}));sh.placeholder={};var lh=Fl((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var uh=Go((function(t,e){return null==t?{}:function(t,e){return Sd(t,e,(function(e,n){return _l(t,n)}))}(t,e)}));function ch(t,e,n,i){for(var o=n-1,r=t.length;++o<r;)if(i(t[o],e))return o;return-1}var dh=Array.prototype.splice;function hh(t,e,n,i){var o=i?ch:Mn,r=-1,a=e.length,s=t;for(t===e&&(e=cn(e)),n&&(s=te(t,Vi(n)));++r<a;)for(var l=0,u=e[r],c=n?n(u):u;(l=o(s,c,l,i))>-1;)s!==t&&dh.call(s,l,1),dh.call(t,l,1);return t}function fh(t,e){return t&&t.length&&e&&e.length?hh(t,e):t}var ph=Si(fh);var gh=Array.prototype.splice;function vh(t,e){for(var n=t?e.length:0,i=n-1;n--;){var o=e[n];if(n==i||o!==r){var r=o;zn(o)?gh.call(t,o,1):Ed(t,o)}}return t}var mh=Go((function(t,e){var n=null==t?0:t.length,i=Fo(t,e);return vh(t,te(e,(function(t){return zn(t,n)?+t:t})).sort(Md)),i})),yh=Math.floor,bh=Math.random;function xh(t,e){return t+yh(bh()*(e-t+1))}var wh=parseFloat,Eh=Math.min,Ch=Math.random;var _h=Math.ceil,Nh=Math.max;function Sh(t){return function(e,n,i){return i&&"number"!=typeof i&&Ai(e,n,i)&&(n=i=void 0),e=we(e),void 0===n?(n=e,e=0):n=we(n),function(t,e,n,i){for(var o=-1,r=Nh(_h((e-t)/(n||1)),0),a=Array(r);r--;)a[i?r:++o]=t,t+=n;return a}(e,n,i=void 0===i?e<n?1:-1:we(i),t)}}var Th=Sh(),Mh=Sh(!0),kh=Go((function(t,e){return vi(t,256,void 0,void 0,void 0,e)}));function Ah(t,e,n,i,o){return o(t,(function(t,o,r){n=i?(i=!1,t):e(n,t,o,r)})),n}function Rh(t,e,n,i){var o=null==t?0:t.length;for(i&&o&&(n=t[--o]);o--;)n=e(n,t[o],o,t);return n}var Oh=Array.prototype.reverse;function Ph(t){return null==t?t:Oh.call(t)}var Dh=ha("round");function Lh(t){var e=t.length;return e?t[xh(0,e-1)]:void 0}function Ih(t){return Lh(vc(t))}function Bh(t,e){var n=-1,i=t.length,o=i-1;for(e=void 0===e?i:e;++n<e;){var r=xh(n,o),a=t[r];t[r]=t[n],t[n]=a}return t.length=e,t}function jh(t,e){return Bh(cn(t),ma(e,0,t.length))}function Fh(t,e){var n=vc(t);return Bh(n,ma(e,0,n.length))}function Hh(t){return Bh(cn(t))}function Wh(t){return Bh(vc(t))}var zh=la((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));function Uh(t,e){var n;return Bl(t,(function(t,i,o){return!(n=e(t,i,o))})),!!n}var qh=Si((function(t,e){if(null==t)return[];var n=e.length;return n>1&&Ai(t,e[0],e[1])?e=[]:n>2&&Ai(e[0],e[1],e[2])&&(e=[e[0]]),kd(t,Uo(e,1),[])})),Gh=4294967294,Vh=Math.floor,Kh=Math.min;function Xh(t,e,n,i){var o=0,r=null==t?0:t.length;if(0===r)return 0;for(var a=(e=n(e))!=e,s=null===e,l=Zt(e),u=void 0===e;o<r;){var c=Vh((o+r)/2),d=n(t[c]),h=void 0!==d,f=null===d,p=d==d,g=Zt(d);if(a)var v=i||p;else v=u?p&&(i||h):s?p&&h&&(i||!f):l?p&&h&&!f&&(i||!g):!f&&!g&&(i?d<=e:d<e);v?o=c+1:r=c}return Kh(r,Gh)}var Yh=2147483647;function $h(t,e,n){var i=0,o=null==t?i:t.length;if("number"==typeof e&&e==e&&o<=Yh){for(;i<o;){var r=i+o>>>1,a=t[r];null!==a&&!Zt(a)&&(n?a<=e:a<e)?i=r+1:o=r}return o}return Xh(t,e,Ce,n)}function Zh(t,e){for(var n=-1,i=t.length,o=0,r=[];++n<i;){var a=t[n],s=e?e(a):a;if(!n||!xi(s,l)){var l=s;r[o++]=0===a?0:a}}return r}var Jh=Math.max;var Qh=la((function(t,e,n){return t+(n?" ":"")+Mr(e)}));var tf=ae((function(t,e){return t-e}),0);var ef=Object.prototype,nf=ef.hasOwnProperty;function of(t,e,n,i){return void 0===t||xi(t,ef[n])&&!nf.call(i,n)?e:t}var rf={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function af(t){return"\\"+rf[t]}var sf=/<%=([\s\S]+?)%>/g,lf={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:sf,variable:"",imports:{_:{escape:Ru}}},uf=/\b__p \+= '';/g,cf=/\b(__p \+=) '' \+/g,df=/(__e\(.*?\)|\b__t\)) \+\n'';/g,hf=/[()=,{}\[\]\/\s]/,ff=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pf=/($^)/,gf=/['\n\r\u2028\u2029\\]/g,vf=Object.prototype.hasOwnProperty;function mf(t,e){return e(t)}var yf=4294967295,bf=Math.min;function xf(t,e){var n=t;return n instanceof nn&&(n=n.value()),Ar(e,(function(t,e){return e.func.apply(e.thisArg,Ho([t],e.args))}),n)}function wf(){return xf(this.__wrapped__,this.__actions__)}var Ef=9007199254740991;function Cf(t,e){for(var n=t.length;n--&&Mn(e,t[n],0)>-1;);return n}function _f(t,e){for(var n=-1,i=t.length;++n<i&&Mn(e,t[n],0)>-1;);return n}var Nf=/^\s+/;var Sf=/\w*$/;var Tf=Rr({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Mf=/&(?:amp|lt|gt|quot|#39);/g,kf=RegExp(Mf.source);var Af=Ia&&1/qs(new Ia([,-0]))[1]==1/0?function(t){return new Ia(t)}:on,Rf=200;function Of(t,e,n){var i=-1,o=kn,r=t.length,a=!0,s=[],l=s;if(n)a=!1,o=uu;else if(r>=Rf){var u=e?null:Af(t);if(u)return qs(u);a=!1,o=Fs,l=new Bs}else l=e?[]:s;t:for(;++i<r;){var c=t[i],d=e?e(c):c;if(c=n||0!==c?c:0,a&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue t;e&&l.push(d),s.push(c)}else o(l,d,n)||(l!==s&&l.push(d),s.push(c))}return s}var Pf=Si((function(t){return Of(Uo(t,1,Ql,!0))})),Df=Si((function(t){var e=fu(t);return Ql(e)&&(e=void 0),Of(Uo(t,1,Ql,!0),Al(e))})),Lf=Si((function(t){var e=fu(t);return e="function"==typeof e?e:void 0,Of(Uo(t,1,Ql,!0),void 0,e)}));var If=0;var Bf=Math.max;function jf(t){if(!t||!t.length)return[];var e=0;return t=Na(t,(function(t){if(Ql(t))return e=Bf(t.length,e),!0})),Di(e,(function(e){return te(t,Ml(e))}))}function Ff(t,e){if(!t||!t.length)return[];var n=jf(t);return null==e?n:te(n,(function(t){return Ye(e,void 0,t)}))}function Hf(t,e,n,i){return Nd(t,e,n(Bo(t,e)),i)}var Wf=la((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}));var zf=Si((function(t,e){return Ql(t)?du(t,e):[]}));var Uf=Go((function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,o=function(e){return Fo(e,t)};return!(e>1||this.__actions__.length)&&i instanceof nn&&zn(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:mf,args:[o],thisArg:void 0}),new un(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(o)}));function qf(t,e,n){var i=t.length;if(i<2)return i?Of(t[0]):[];for(var o=-1,r=Array(i);++o<i;)for(var a=t[o],s=-1;++s<i;)s!=o&&(r[o]=du(r[o]||a,t[s],e,n));return Of(Uo(r,1),e,n)}var Gf=Si((function(t){return qf(Na(t,Ql))})),Vf=Si((function(t){var e=fu(t);return Ql(e)&&(e=void 0),qf(Na(t,Ql),Al(e))})),Kf=Si((function(t){var e=fu(t);return e="function"==typeof e?e:void 0,qf(Na(t,Ql),void 0,e)})),Xf=Si(jf);function Yf(t,e,n){for(var i=-1,o=t.length,r=e.length,a={};++i<o;){var s=i<r?e[i]:void 0;n(a,t[i],s)}return a}var $f=Si((function(t){var e=t.length,n=e>1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Ff(t,n)})),Zf={chunk:function(t,e,n){e=(n?Ai(t,e,n):void 0===e)?1:va(Ee(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,r=0,a=Array(ga(i/e));o<i;)a[r++]=cr(t,o,o+=e);return a},compact:function(t){for(var e=-1,n=null==t?0:t.length,i=0,o=[];++e<n;){var r=t[e];r&&(o[i++]=r)}return o},concat:function(){var t=arguments.length;if(!t)return[];for(var e=Array(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Ho(ee(n)?cn(n):[n],Uo(e,1))},difference:hu,differenceBy:pu,differenceWith:gu,drop:function(t,e,n){var i=null==t?0:t.length;return i?cr(t,(e=n||void 0===e?1:Ee(e))<0?0:e,i):[]},dropRight:function(t,e,n){var i=null==t?0:t.length;return i?cr(t,0,(e=i-(e=n||void 0===e?1:Ee(e)))<0?0:e):[]},dropRightWhile:function(t,e){return t&&t.length?mu(t,Al(e),!0,!0):[]},dropWhile:function(t,e){return t&&t.length?mu(t,Al(e),!0):[]},fill:function(t,e,n,i){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&Ai(t,e,n)&&(n=0,i=o),function(t,e,n,i){var o=t.length;for((n=Ee(n))<0&&(n=-n>o?0:o+n),(i=void 0===i||i>o?o:Ee(i))<0&&(i+=o),i=n>i?0:Bu(i);n<i;)t[n++]=e;return t}(t,e,n,i)):[]},findIndex:Wu,findLastIndex:Vu,first:Xu,flatten:qo,flattenDeep:function(t){return(null==t?0:t.length)?Uo(t,Infinity):[]},flattenDepth:function(t,e){return(null==t?0:t.length)?Uo(t,e=void 0===e?1:Ee(e)):[]},fromPairs:function(t){for(var e=-1,n=null==t?0:t.length,i={};++e<n;){var o=t[e];i[o[0]]=o[1]}return i},head:Xu,indexOf:function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=null==n?0:Ee(n);return o<0&&(o=yc(i+o,0)),Mn(t,e,o)},initial:function(t){return(null==t?0:t.length)?cr(t,0,-1):[]},intersection:Ec,intersectionBy:Cc,intersectionWith:_c,join:function(t,e){return null==t?"":$c.call(t,e)},last:fu,lastIndexOf:function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return void 0!==n&&(o=(o=Ee(n))<0?Qc(i+o,0):td(o,i-1)),e==e?function(t,e,n){for(var i=n+1;i--;)if(t[i]===e)return i;return i}(t,e,o):Sn(t,Tn,o,!0)},nth:function(t,e){return t&&t.length?wd(t,Ee(e)):void 0},pull:ph,pullAll:fh,pullAllBy:function(t,e,n){return t&&t.length&&e&&e.length?hh(t,e,Al(n)):t},pullAllWith:function(t,e,n){return t&&t.length&&e&&e.length?hh(t,e,void 0,n):t},pullAt:mh,remove:function(t,e){var n=[];if(!t||!t.length)return n;var i=-1,o=[],r=t.length;for(e=Al(e);++i<r;){var a=t[i];e(a,i,t)&&(n.push(a),o.push(i))}return vh(t,o),n},reverse:Ph,slice:function(t,e,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&Ai(t,e,n)?(e=0,n=i):(e=null==e?0:Ee(e),n=void 0===n?i:Ee(n)),cr(t,e,n)):[]},sortedIndex:function(t,e){return $h(t,e)},sortedIndexBy:function(t,e,n){return Xh(t,e,Al(n))},sortedIndexOf:function(t,e){var n=null==t?0:t.length;if(n){var i=$h(t,e);if(i<n&&xi(t[i],e))return i}return-1},sortedLastIndex:function(t,e){return $h(t,e,!0)},sortedLastIndexBy:function(t,e,n){return Xh(t,e,Al(n),!0)},sortedLastIndexOf:function(t,e){if(null==t?0:t.length){var n=$h(t,e,!0)-1;if(xi(t[n],e))return n}return-1},sortedUniq:function(t){return t&&t.length?Zh(t):[]},sortedUniqBy:function(t,e){return t&&t.length?Zh(t,Al(e)):[]},tail:function(t){var e=null==t?0:t.length;return e?cr(t,1,e):[]},take:function(t,e,n){return t&&t.length?cr(t,0,(e=n||void 0===e?1:Ee(e))<0?0:e):[]},takeRight:function(t,e,n){var i=null==t?0:t.length;return i?cr(t,(e=i-(e=n||void 0===e?1:Ee(e)))<0?0:e,i):[]},takeRightWhile:function(t,e){return t&&t.length?mu(t,Al(e),!1,!0):[]},takeWhile:function(t,e){return t&&t.length?mu(t,Al(e)):[]},union:Pf,unionBy:Df,unionWith:Lf,uniq:function(t){return t&&t.length?Of(t):[]},uniqBy:function(t,e){return t&&t.length?Of(t,Al(e)):[]},uniqWith:function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Of(t,void 0,e):[]},unzip:jf,unzipWith:Ff,without:zf,xor:Gf,xorBy:Vf,xorWith:Kf,zip:Xf,zipObject:function(t,e){return Yf(t||[],e||[],Ei)},zipObjectDeep:function(t,e){return Yf(t||[],e||[],Nd)},zipWith:$f},Jf={countBy:Wl,each:bu,eachRight:_u,every:function(t,e,n){var i=ee(t)?Du:Lu;return n&&Ai(t,e,n)&&(e=void 0),i(t,Al(e))},filter:function(t,e){return(ee(t)?Na:ju)(t,Al(e))},find:zu,findLast:Ku,flatMap:function(t,e){return Uo($u(t,e),1)},flatMapDeep:function(t,e){return Uo($u(t,e),Infinity)},flatMapDepth:function(t,e,n){return n=void 0===n?1:Ee(n),Uo($u(t,e),n)},forEach:bu,forEachRight:_u,groupBy:ic,includes:function(t,e,n,i){t=ki(t)?t:vc(t),n=n&&!i?Ee(n):0;var o=t.length;return n<0&&(n=mc(o+n,0)),pc(t)?n<=o&&t.indexOf(e,n)>-1:!!o&&Mn(t,e,n)>-1},invokeMap:Lc,keyBy:Jc,map:$u,orderBy:function(t,e,n,i){return null==t?[]:(ee(e)||(e=null==e?[]:[e]),ee(n=i?void 0:n)||(n=null==n?[]:[n]),kd(t,e,n))},partition:lh,reduce:function(t,e,n){var i=ee(t)?Ar:Ah,o=arguments.length<3;return i(t,Al(e),n,o,Bl)},reduceRight:function(t,e,n){var i=ee(t)?Rh:Ah,o=arguments.length<3;return i(t,Al(e),n,o,Cu)},reject:function(t,e){return(ee(t)?Na:ju)(t,vd(Al(e)))},sample:function(t){return(ee(t)?Lh:Ih)(t)},sampleSize:function(t,e,n){return e=(n?Ai(t,e,n):void 0===e)?1:Ee(e),(ee(t)?jh:Fh)(t,e)},shuffle:function(t){return(ee(t)?Hh:Wh)(t)},size:function(t){if(null==t)return 0;if(ki(t))return pc(t)?Qd(t):t.length;var e=Xa(t);return"[object Map]"==e||"[object Set]"==e?t.size:oo(t).length},some:function(t,e,n){var i=ee(t)?js:Uh;return n&&Ai(t,e,n)&&(e=void 0),i(t,Al(e))},sortBy:qh},Qf=ql,tp={after:function(t,e){if("function"!=typeof e)throw new TypeError("Expected a function");return t=Ee(t),function(){if(--t<1)return e.apply(this,arguments)}},ary:yi,before:ar,bind:sr,bindKey:ur,curry:zl,curryRight:Ul,debounce:Xl,defer:su,delay:lu,flip:function(t){return vi(t,512)},memoize:ko,negate:vd,once:function(t){return ar(2,t)},overArgs:Dd,partial:ah,partialRight:sh,rearg:kh,rest:function(t,e){if("function"!=typeof t)throw new TypeError("Expected a function");return Si(t,e=void 0===e?e:Ee(e))},spread:function(t,e){if("function"!=typeof t)throw new TypeError("Expected a function");return e=null==e?0:Jh(Ee(e),0),Si((function(n){var i=n[e],o=dr(n,0,e);return i&&Ho(o,i),Ye(t,this,o)}))},throttle:function(t,e,n){var i=!0,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return he(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Xl(t,e,{leading:i,maxWait:e,trailing:o})},unary:function(t){return yi(t,1)},wrap:function(t,e){return ah(yu(e),t)}},ep={castArray:function(){if(!arguments.length)return[];var t=arguments[0];return ee(t)?t:[t]},clone:function(t){return Ls(t,4)},cloneDeep:Is,cloneDeepWith:function(t,e){return Ls(t,5,e="function"==typeof e?e:void 0)},cloneWith:function(t,e){return Ls(t,4,e="function"==typeof e?e:void 0)},conformsTo:function(t,e){return null==e||Rl(t,e,ro(e))},eq:xi,gt:ac,gte:sc,isArguments:Fi,isArray:ee,isArrayBuffer:Bc,isArrayLike:ki,isArrayLikeObject:Ql,isBoolean:function(t){return!0===t||!1===t||Yt(t)&&"[object Boolean]"==Xt(t)},isBuffer:qi,isDate:Fc,isElement:function(t){return Yt(t)&&1===t.nodeType&&!tr(t)},isEmpty:Wc,isEqual:function(t,e){return pl(t,e)},isEqualWith:function(t,e,n){var i=(n="function"==typeof n?n:void 0)?n(t,e):void 0;return void 0===i?pl(t,e,void 0,n):!!i},isError:ir,isFinite:function(t){return"number"==typeof t&&zc(t)},isFunction:Me,isInteger:Uc,isLength:Mi,isMap:_s,isMatch:function(t,e){return t===e||ml(t,e,bl(e))},isMatchWith:function(t,e,n){return n="function"==typeof n?n:void 0,ml(t,e,bl(e),n)},isNaN:function(t){return Gc(t)&&t!=+t},isNative:function(t){if(Vc(t))throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return He(t)},isNil:function(t){return null==t},isNull:function(t){return null===t},isNumber:Gc,isObject:he,isObjectLike:Yt,isPlainObject:tr,isRegExp:Xc,isSafeInteger:function(t){return Uc(t)&&t>=-9007199254740991&&t<=Yc},isSet:Ss,isString:pc,isSymbol:Zt,isTypedArray:Ji,isUndefined:function(t){return void 0===t},isWeakMap:function(t){return Yt(t)&&"[object WeakMap]"==Xa(t)},isWeakSet:function(t){return Yt(t)&&"[object WeakSet]"==Xt(t)},lt:od,lte:rd,toArray:xd,toFinite:we,toInteger:Ee,toLength:Bu,toNumber:ye,toPlainObject:eu,toSafeInteger:function(t){return t?ma(Ee(t),-9007199254740991,Ef):0===t?t:0},toString:Po},np={add:se,ceil:fa,divide:vu,floor:Zu,max:function(t){return t&&t.length?ad(t,Ce,oc):void 0},maxBy:function(t,e){return t&&t.length?ad(t,Al(e),oc):void 0},mean:function(t){return ud(t,Ce)},meanBy:function(t,e){return ud(t,Al(e))},min:function(t){return t&&t.length?ad(t,Ce,id):void 0},minBy:function(t,e){return t&&t.length?ad(t,Al(e),id):void 0},multiply:pd,round:Dh,subtract:tf,sum:function(t){return t&&t.length?sd(t,Ce):0},sumBy:function(t,e){return t&&t.length?sd(t,Al(e)):0}},ip=function(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=ye(n))==n?n:0),void 0!==e&&(e=(e=ye(e))==e?e:0),ma(ye(t),e,n)},op=function(t,e,n){return e=we(e),void 0===n?(n=e,e=0):n=we(n),function(t,e,n){return t>=hc(e,n)&&t<dc(e,n)}(t=ye(t),e,n)},rp=function(t,e,n){if(n&&"boolean"!=typeof n&&Ai(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=we(t),void 0===e?(e=t,t=0):e=we(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var o=Ch();return Eh(t+o*(e-t+wh("1e-"+((o+"").length-1))),e)}return xh(t,e)},ap={assign:so,assignIn:ho,assignInWith:fo,assignWith:po,at:Vo,create:function(t,e){var n=Ve(t);return null==e?n:ba(n,e)},defaults:Zl,defaultsDeep:ru,entries:Su,entriesIn:Tu,extend:ho,extendWith:fo,findKey:function(t,e){return Uu(t,Al(e),Ll)},findLastKey:function(t,e){return Uu(t,Al(e),Eu)},forIn:function(t,e){return null==t?t:Dl(t,yu(e),co)},forInRight:function(t,e){return null==t?t:wu(t,yu(e),co)},forOwn:function(t,e){return t&&Ll(t,yu(e))},forOwnRight:function(t,e){return t&&Eu(t,yu(e))},functions:function(t){return null==t?[]:ec(t,ro(t))},functionsIn:function(t){return null==t?[]:ec(t,co(t))},get:jo,has:cc,hasIn:_l,invert:Tc,invertBy:Rc,invoke:Dc,keys:ro,keysIn:co,mapKeys:function(t,e){var n={};return e=Al(e),Ll(t,(function(t,i,o){bi(n,e(t,i,o),t)})),n},mapValues:function(t,e){var n={};return e=Al(e),Ll(t,(function(t,i,o){bi(n,i,e(t,i,o))})),n},merge:cd,mergeWith:ou,omit:_d,omitBy:function(t,e){return Td(t,vd(Al(e)))},pick:uh,pickBy:Td,result:function(t,e,n){var i=-1,o=(e=Do(e,t)).length;for(o||(o=1,t=void 0);++i<o;){var r=null==t?void 0:t[Io(e[i])];void 0===r&&(i=o,r=n),t=Me(r)?r.call(t):r}return t},set:function(t,e,n){return null==t?t:Nd(t,e,n)},setWith:function(t,e,n,i){return i="function"==typeof i?i:void 0,null==t?t:Nd(t,e,n,i)},toPairs:Su,toPairsIn:Tu,transform:function(t,e,n){var i=ee(t),o=i||qi(t)||Ji(t);if(e=Al(e),null==n){var r=t&&t.constructor;n=o?i?new r:[]:he(t)&&Me(r)?Ve(Ko(t)):{}}return(o?Nn:Ll)(t,(function(t,i,o){return e(n,t,i,o)})),n},unset:function(t,e){return null==t||Ed(t,e)},update:function(t,e,n){return null==t?t:Hf(t,e,yu(n))},updateWith:function(t,e,n,i){return i="function"==typeof i?i:void 0,null==t?t:Hf(t,e,yu(n),i)},values:vc,valuesIn:function(t){return null==t?[]:gc(t,co(t))}},sp={at:Uf,chain:pa,commit:function(){return new un(this.value(),this.__chain__)},lodash:fn,next:function(){void 0===this.__values__&&(this.__values__=xd(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},plant:function(t){for(var e,n=this;n instanceof tn;){var i=dn(n);i.__index__=0,i.__values__=void 0,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},reverse:function(){var t=this.__wrapped__;if(t instanceof nn){var e=t;return this.__actions__.length&&(e=new nn(this)),(e=e.reverse()).__actions__.push({func:mf,args:[Ph],thisArg:void 0}),new un(e,this.__chain__)}return this.thru(Ph)},tap:function(t,e){return e(t),t},thru:mf,toIterator:function(){return this},toJSON:wf,value:wf,valueOf:wf,wrapperChain:function(){return pa(this)}},lp={camelCase:ua,capitalize:kr,deburr:Lr,endsWith:function(t,e,n){t=Po(t),e=re(e);var i=t.length,o=n=void 0===n?i:ma(Ee(n),0,i);return(n-=e.length)>=0&&t.slice(n,o)==e},escape:Ru,escapeRegExp:function(t){return(t=Po(t))&&Pu.test(t)?t.replace(Ou,"\\$&"):t},kebabCase:Zc,lowerCase:ed,lowerFirst:nd,pad:function(t,e,n){t=Po(t);var i=(e=Ee(e))?Qd(t):0;if(!e||i>=e)return t;var o=(e-i)/2;return eh(ih(o),n)+t+eh(nh(o),n)},padEnd:function(t,e,n){t=Po(t);var i=(e=Ee(e))?Qd(t):0;return e&&i<e?t+eh(e-i,n):t},padStart:function(t,e,n){t=Po(t);var i=(e=Ee(e))?Qd(t):0;return e&&i<e?eh(e-i,n)+t:t},parseInt:function(t,e,n){return n||null==e?e=0:e&&(e=+e),rh(Po(t).replace(oh,""),e||0)},repeat:function(t,e,n){return e=(n?Ai(t,e,n):void 0===e)?1:Ee(e),Fd(Po(t),e)},replace:function(){var t=arguments,e=Po(t[0]);return t.length<3?e:e.replace(t[1],t[2])},snakeCase:zh,split:function(t,e,n){return n&&"number"!=typeof n&&Ai(t,e,n)&&(e=n=void 0),(n=void 0===n?4294967295:n>>>0)?(t=Po(t))&&("string"==typeof e||null!=e&&!Xc(e))&&!(e=re(e))&&fr(t)?dr(Sr(t),0,n):t.split(e,n):[]},startCase:Qh,startsWith:function(t,e,n){return t=Po(t),n=null==n?0:ma(Ee(n),0,t.length),e=re(e),t.slice(n,n+e.length)==e},template:function(t,e,n){var i=lf.imports._.templateSettings||lf;n&&Ai(t,e,n)&&(e=void 0),t=Po(t),e=fo({},e,i,of);var o,r,a=fo({},e.imports,i.imports,of),s=ro(a),l=gc(a,s),u=0,c=e.interpolate||pf,d="__p += '",h=RegExp((e.escape||pf).source+"|"+c.source+"|"+(c===sf?ff:pf).source+"|"+(e.evaluate||pf).source+"|$","g"),f=vf.call(e,"sourceURL")?"//# sourceURL="+(e.sourceURL+"").replace(/\s/g," ")+"\n":"";t.replace(h,(function(e,n,i,a,s,l){return i||(i=a),d+=t.slice(u,l).replace(gf,af),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),s&&(r=!0,d+="';\n"+s+";\n__p += '"),i&&(d+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),u=l+e.length,e})),d+="';\n";var p=vf.call(e,"variable")&&e.variable;if(p){if(hf.test(p))throw new Error("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(r?d.replace(uf,""):d).replace(cf,"$1").replace(df,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(r?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=or((function(){return Function(s,f+"return "+d).apply(void 0,l)}));if(g.source=d,ir(g))throw g;return g},templateSettings:lf,toLower:function(t){return Po(t).toLowerCase()},toUpper:function(t){return Po(t).toUpperCase()},trim:function(t,e,n){if((t=Po(t))&&(n||void 0===e))return de(t);if(!t||!(e=re(e)))return t;var i=Sr(t),o=Sr(e);return dr(i,_f(i,o),Cf(i,o)+1).join("")},trimEnd:function(t,e,n){if((t=Po(t))&&(n||void 0===e))return t.slice(0,ue(t)+1);if(!t||!(e=re(e)))return t;var i=Sr(t);return dr(i,0,Cf(i,Sr(e))+1).join("")},trimStart:function(t,e,n){if((t=Po(t))&&(n||void 0===e))return t.replace(Nf,"");if(!t||!(e=re(e)))return t;var i=Sr(t);return dr(i,_f(i,Sr(e))).join("")},truncate:function(t,e){var n=30,i="...";if(he(e)){var o="separator"in e?e.separator:o;n="length"in e?Ee(e.length):n,i="omission"in e?re(e.omission):i}var r=(t=Po(t)).length;if(fr(t)){var a=Sr(t);r=a.length}if(n>=r)return t;var s=n-Qd(i);if(s<1)return i;var l=a?dr(a,0,s).join(""):t.slice(0,s);if(void 0===o)return l+i;if(a&&(s+=l.length-s),Xc(o)){if(t.slice(s).search(o)){var u,c=l;for(o.global||(o=RegExp(o.source,Po(Sf.exec(o))+"g")),o.lastIndex=0;u=o.exec(c);)var d=u.index;l=l.slice(0,void 0===d?s:d)}}else if(t.indexOf(re(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+i},unescape:function(t){return(t=Po(t))&&kf.test(t)?t.replace(Mf,Tf):t},upperCase:Wf,upperFirst:Mr,words:aa},up={attempt:or,bindAll:lr,cond:function(t){var e=null==t?0:t.length,n=Al;return t=e?te(t,(function(t){if("function"!=typeof t[1])throw new TypeError("Expected a function");return[n(t[0]),t[1]]})):[],Si((function(n){for(var i=-1;++i<e;){var o=t[i];if(Ye(o[0],this,n))return Ye(o[1],this,n)}}))},conforms:function(t){return function(t){var e=ro(t);return function(n){return Rl(n,t,e)}}(Ls(t,1))},constant:wn,defaultTo:function(t,e){return null==t||t!=t?e:t},flow:Qu,flowRight:tc,identity:Ce,iteratee:function(t){return Al("function"==typeof t?t:Ls(t,1))},matches:function(t){return wl(Ls(t,1))},matchesProperty:function(t,e){return Tl(t,Ls(e,1))},method:dd,methodOf:hd,mixin:fd,noop:on,nthArg:function(t){return t=Ee(t),Si((function(e){return wd(e,t)}))},over:Rd,overEvery:Ld,overSome:Id,property:kl,propertyOf:function(t){return function(e){return null==t?void 0:Bo(t,e)}},range:Th,rangeRight:Mh,stubArray:Sa,stubFalse:Hi,stubObject:function(){return{}},stubString:function(){return""},stubTrue:function(){return!0},times:function(t,e){if((t=Ee(t))<1||t>9007199254740991)return[];var n=yf,i=bf(t,yf);e=yu(e),t-=yf;for(var o=Di(i,e);++n<t;)e(n);return o},toPath:function(t){return ee(t)?te(t,Io):Zt(t)?[t]:cn(Oo(Po(t)))},uniqueId:function(t){var e=++If;return Po(t)+e}};var cp=Math.max,dp=Math.min;var hp=Math.min;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Lodash (Custom Build) <https://lodash.com/>
|
|
@@ -8,5 +8,21 @@
|
|
|
8
8
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
9
9
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
10
10
|
*/
|
|
11
|
-
var df,hf,pf=4294967295,ff=Array.prototype,vf=Object.prototype.hasOwnProperty,gf=Bt?Bt.iterator:void 0,yf=Math.max,mf=Math.min,bf=function(t){return function(e,n,r){if(null==r){var i=de(n),o=i&&ii(n),a=o&&o.length&&tc(n,o);(a?a.length:i)||(r=n,n=e,e=this)}return t(e,n,r)}}(dd);hn.after=$p.after,hn.ary=$p.ary,hn.assign=rf.assign,hn.assignIn=rf.assignIn,hn.assignInWith=rf.assignInWith,hn.assignWith=rf.assignWith,hn.at=rf.at,hn.before=$p.before,hn.bind=$p.bind,hn.bindAll=uf.bindAll,hn.bindKey=$p.bindKey,hn.castArray=Jp.castArray,hn.chain=of.chain,hn.chunk=Yp.chunk,hn.compact=Yp.compact,hn.concat=Yp.concat,hn.cond=uf.cond,hn.conforms=uf.conforms,hn.constant=uf.constant,hn.countBy=Zp.countBy,hn.create=rf.create,hn.curry=$p.curry,hn.curryRight=$p.curryRight,hn.debounce=$p.debounce,hn.defaults=rf.defaults,hn.defaultsDeep=rf.defaultsDeep,hn.defer=$p.defer,hn.delay=$p.delay,hn.difference=Yp.difference,hn.differenceBy=Yp.differenceBy,hn.differenceWith=Yp.differenceWith,hn.drop=Yp.drop,hn.dropRight=Yp.dropRight,hn.dropRightWhile=Yp.dropRightWhile,hn.dropWhile=Yp.dropWhile,hn.fill=Yp.fill,hn.filter=Zp.filter,hn.flatMap=Zp.flatMap,hn.flatMapDeep=Zp.flatMapDeep,hn.flatMapDepth=Zp.flatMapDepth,hn.flatten=Yp.flatten,hn.flattenDeep=Yp.flattenDeep,hn.flattenDepth=Yp.flattenDepth,hn.flip=$p.flip,hn.flow=uf.flow,hn.flowRight=uf.flowRight,hn.fromPairs=Yp.fromPairs,hn.functions=rf.functions,hn.functionsIn=rf.functionsIn,hn.groupBy=Zp.groupBy,hn.initial=Yp.initial,hn.intersection=Yp.intersection,hn.intersectionBy=Yp.intersectionBy,hn.intersectionWith=Yp.intersectionWith,hn.invert=rf.invert,hn.invertBy=rf.invertBy,hn.invokeMap=Zp.invokeMap,hn.iteratee=uf.iteratee,hn.keyBy=Zp.keyBy,hn.keys=ii,hn.keysIn=rf.keysIn,hn.map=Zp.map,hn.mapKeys=rf.mapKeys,hn.mapValues=rf.mapValues,hn.matches=uf.matches,hn.matchesProperty=uf.matchesProperty,hn.memoize=$p.memoize,hn.merge=rf.merge,hn.mergeWith=rf.mergeWith,hn.method=uf.method,hn.methodOf=uf.methodOf,hn.mixin=bf,hn.negate=fd,hn.nthArg=uf.nthArg,hn.omit=rf.omit,hn.omitBy=rf.omitBy,hn.once=$p.once,hn.orderBy=Zp.orderBy,hn.over=uf.over,hn.overArgs=$p.overArgs,hn.overEvery=uf.overEvery,hn.overSome=uf.overSome,hn.partial=$p.partial,hn.partialRight=$p.partialRight,hn.partition=Zp.partition,hn.pick=rf.pick,hn.pickBy=rf.pickBy,hn.property=uf.property,hn.propertyOf=uf.propertyOf,hn.pull=Yp.pull,hn.pullAll=Yp.pullAll,hn.pullAllBy=Yp.pullAllBy,hn.pullAllWith=Yp.pullAllWith,hn.pullAt=Yp.pullAt,hn.range=uf.range,hn.rangeRight=uf.rangeRight,hn.rearg=$p.rearg,hn.reject=Zp.reject,hn.remove=Yp.remove,hn.rest=$p.rest,hn.reverse=Yp.reverse,hn.sampleSize=Zp.sampleSize,hn.set=rf.set,hn.setWith=rf.setWith,hn.shuffle=Zp.shuffle,hn.slice=Yp.slice,hn.sortBy=Zp.sortBy,hn.sortedUniq=Yp.sortedUniq,hn.sortedUniqBy=Yp.sortedUniqBy,hn.split=af.split,hn.spread=$p.spread,hn.tail=Yp.tail,hn.take=Yp.take,hn.takeRight=Yp.takeRight,hn.takeRightWhile=Yp.takeRightWhile,hn.takeWhile=Yp.takeWhile,hn.tap=of.tap,hn.throttle=$p.throttle,hn.thru=fp,hn.toArray=Jp.toArray,hn.toPairs=rf.toPairs,hn.toPairsIn=rf.toPairsIn,hn.toPath=uf.toPath,hn.toPlainObject=Jp.toPlainObject,hn.transform=rf.transform,hn.unary=$p.unary,hn.union=Yp.union,hn.unionBy=Yp.unionBy,hn.unionWith=Yp.unionWith,hn.uniq=Yp.uniq,hn.uniqBy=Yp.uniqBy,hn.uniqWith=Yp.uniqWith,hn.unset=rf.unset,hn.unzip=Yp.unzip,hn.unzipWith=Yp.unzipWith,hn.update=rf.update,hn.updateWith=rf.updateWith,hn.values=rf.values,hn.valuesIn=rf.valuesIn,hn.without=Yp.without,hn.words=af.words,hn.wrap=$p.wrap,hn.xor=Yp.xor,hn.xorBy=Yp.xorBy,hn.xorWith=Yp.xorWith,hn.zip=Yp.zip,hn.zipObject=Yp.zipObject,hn.zipObjectDeep=Yp.zipObjectDeep,hn.zipWith=Yp.zipWith,hn.entries=rf.toPairs,hn.entriesIn=rf.toPairsIn,hn.extend=rf.assignIn,hn.extendWith=rf.assignInWith,bf(hn,hn),hn.add=Qp.add,hn.attempt=uf.attempt,hn.camelCase=af.camelCase,hn.capitalize=af.capitalize,hn.ceil=Qp.ceil,hn.clamp=tf,hn.clone=Jp.clone,hn.cloneDeep=Jp.cloneDeep,hn.cloneDeepWith=Jp.cloneDeepWith,hn.cloneWith=Jp.cloneWith,hn.conformsTo=Jp.conformsTo,hn.deburr=af.deburr,hn.defaultTo=uf.defaultTo,hn.divide=Qp.divide,hn.endsWith=af.endsWith,hn.eq=Jp.eq,hn.escape=af.escape,hn.escapeRegExp=af.escapeRegExp,hn.every=Zp.every,hn.find=Zp.find,hn.findIndex=Yp.findIndex,hn.findKey=rf.findKey,hn.findLast=Zp.findLast,hn.findLastIndex=Yp.findLastIndex,hn.findLastKey=rf.findLastKey,hn.floor=Qp.floor,hn.forEach=Zp.forEach,hn.forEachRight=Zp.forEachRight,hn.forIn=rf.forIn,hn.forInRight=rf.forInRight,hn.forOwn=rf.forOwn,hn.forOwnRight=rf.forOwnRight,hn.get=rf.get,hn.gt=Jp.gt,hn.gte=Jp.gte,hn.has=rf.has,hn.hasIn=rf.hasIn,hn.head=Yp.head,hn.identity=we,hn.includes=Zp.includes,hn.indexOf=Yp.indexOf,hn.inRange=ef,hn.invoke=rf.invoke,hn.isArguments=Jp.isArguments,hn.isArray=te,hn.isArrayBuffer=Jp.isArrayBuffer,hn.isArrayLike=Jp.isArrayLike,hn.isArrayLikeObject=Jp.isArrayLikeObject,hn.isBoolean=Jp.isBoolean,hn.isBuffer=Jp.isBuffer,hn.isDate=Jp.isDate,hn.isElement=Jp.isElement,hn.isEmpty=Jp.isEmpty,hn.isEqual=Jp.isEqual,hn.isEqualWith=Jp.isEqualWith,hn.isError=Jp.isError,hn.isFinite=Jp.isFinite,hn.isFunction=Jp.isFunction,hn.isInteger=Jp.isInteger,hn.isLength=Jp.isLength,hn.isMap=Jp.isMap,hn.isMatch=Jp.isMatch,hn.isMatchWith=Jp.isMatchWith,hn.isNaN=Jp.isNaN,hn.isNative=Jp.isNative,hn.isNil=Jp.isNil,hn.isNull=Jp.isNull,hn.isNumber=Jp.isNumber,hn.isObject=de,hn.isObjectLike=Jp.isObjectLike,hn.isPlainObject=Jp.isPlainObject,hn.isRegExp=Jp.isRegExp,hn.isSafeInteger=Jp.isSafeInteger,hn.isSet=Jp.isSet,hn.isString=Jp.isString,hn.isSymbol=Jp.isSymbol,hn.isTypedArray=Jp.isTypedArray,hn.isUndefined=Jp.isUndefined,hn.isWeakMap=Jp.isWeakMap,hn.isWeakSet=Jp.isWeakSet,hn.join=Yp.join,hn.kebabCase=af.kebabCase,hn.last=hl,hn.lastIndexOf=Yp.lastIndexOf,hn.lowerCase=af.lowerCase,hn.lowerFirst=af.lowerFirst,hn.lt=Jp.lt,hn.lte=Jp.lte,hn.max=Qp.max,hn.maxBy=Qp.maxBy,hn.mean=Qp.mean,hn.meanBy=Qp.meanBy,hn.min=Qp.min,hn.minBy=Qp.minBy,hn.stubArray=uf.stubArray,hn.stubFalse=uf.stubFalse,hn.stubObject=uf.stubObject,hn.stubString=uf.stubString,hn.stubTrue=uf.stubTrue,hn.multiply=Qp.multiply,hn.nth=Yp.nth,hn.noop=uf.noop,hn.now=Kp,hn.pad=af.pad,hn.padEnd=af.padEnd,hn.padStart=af.padStart,hn.parseInt=af.parseInt,hn.random=nf,hn.reduce=Zp.reduce,hn.reduceRight=Zp.reduceRight,hn.repeat=af.repeat,hn.replace=af.replace,hn.result=rf.result,hn.round=Qp.round,hn.sample=Zp.sample,hn.size=Zp.size,hn.snakeCase=af.snakeCase,hn.some=Zp.some,hn.sortedIndex=Yp.sortedIndex,hn.sortedIndexBy=Yp.sortedIndexBy,hn.sortedIndexOf=Yp.sortedIndexOf,hn.sortedLastIndex=Yp.sortedLastIndex,hn.sortedLastIndexBy=Yp.sortedLastIndexBy,hn.sortedLastIndexOf=Yp.sortedLastIndexOf,hn.startCase=af.startCase,hn.startsWith=af.startsWith,hn.subtract=Qp.subtract,hn.sum=Qp.sum,hn.sumBy=Qp.sumBy,hn.template=af.template,hn.times=uf.times,hn.toFinite=Jp.toFinite,hn.toInteger=_e,hn.toLength=Jp.toLength,hn.toLower=af.toLower,hn.toNumber=Jp.toNumber,hn.toSafeInteger=Jp.toSafeInteger,hn.toString=Jp.toString,hn.toUpper=af.toUpper,hn.trim=af.trim,hn.trimEnd=af.trimEnd,hn.trimStart=af.trimStart,hn.truncate=af.truncate,hn.unescape=af.unescape,hn.uniqueId=uf.uniqueId,hn.upperCase=af.upperCase,hn.upperFirst=af.upperFirst,hn.each=Zp.forEach,hn.eachRight=Zp.forEachRight,hn.first=Yp.head,bf(hn,(df={},js(hn,(function(t,e){vf.call(hn.prototype,e)||(df[e]=t)})),df),{chain:!1}),hn.VERSION="4.17.21",(hn.templateSettings=af.templateSettings).imports._=hn,En(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){hn[t].placeholder=hn})),En(["drop","take"],(function(t,e){en.prototype[t]=function(n){n=void 0===n?1:yf(_e(n),0);var r=this.__filtered__&&!e?new en(this):this.clone();return r.__filtered__?r.__takeCount__=mf(n,r.__takeCount__):r.__views__.push({size:mf(n,pf),type:t+(r.__dir__<0?"Right":"")}),r},en.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),En(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;en.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Ts(t),type:n}),e.__filtered__=e.__filtered__||r,e}})),En(["head","last"],(function(t,e){var n="take"+(e?"Right":"");en.prototype[t]=function(){return this[n](1).value()[0]}})),En(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");en.prototype[t]=function(){return this.__filtered__?new en(this):this[n](1)}})),en.prototype.compact=function(){return this.filter(we)},en.prototype.find=function(t){return this.filter(t).head()},en.prototype.findLast=function(t){return this.reverse().find(t)},en.prototype.invokeMap=Nr((function(t,e){return"function"==typeof t?new en(this):this.map((function(n){return Oc(n,t,e)}))})),en.prototype.reject=function(t){return this.filter(fd(Ts(t)))},en.prototype.slice=function(t,e){t=_e(t);var n=this;return n.__filtered__&&(t>0||e<0)?new en(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=_e(e))<0?n.dropRight(-e):n.take(e-t)),n)},en.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},en.prototype.toArray=function(){return this.take(pf)},js(en.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=hn[r?"take"+("last"==e?"Right":""):e],o=r||/^find/.test(e);i&&(hn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,u=e instanceof en,s=a[0],l=u||te(e),c=function(t){var e=i.apply(hn,Bi([t],a));return r&&d?e[0]:e};l&&n&&"function"==typeof s&&1!=s.length&&(u=l=!1);var d=this.__chain__,h=!!this.__actions__.length,p=o&&!d,f=u&&!h;if(!o&&l){e=f?e:new en(this);var v=t.apply(e,a);return v.__actions__.push({func:fp,args:[c],thisArg:void 0}),new sn(v,d)}return p&&f?t.apply(this,a):(v=this.thru(c),p?r?v.value()[0]:v.value():v)})})),En(["pop","push","shift","sort","splice","unshift"],(function(t){var e=ff[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);hn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(te(i)?i:[],t)}return this[n]((function(n){return e.apply(te(n)?n:[],t)}))}})),js(en.prototype,(function(t,e){var n=hn[e];if(n){var r=n.name+"";vf.call(on,r)||(on[r]=[]),on[r].push({name:e,func:n})}})),on[$n(void 0,2).name]=[{name:"wrapper",func:void 0}],en.prototype.clone=function(){var t=new en(this.__wrapped__);return t.__actions__=ln(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ln(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ln(this.__views__),t},en.prototype.reverse=function(){if(this.__filtered__){var t=new en(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},en.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=te(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=lf(e,t+a);break;case"takeRight":t=sf(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,u=o.end,s=u-a,l=r?u:a-1,c=this.__iteratees__,d=c.length,h=0,p=cf(s,this.__takeCount__);if(!n||!r&&i==s&&p==s)return yp(t,this.__actions__);var f=[];t:for(;s--&&h<p;){for(var v=-1,g=t[l+=e];++v<d;){var y=c[v],m=y.iteratee,b=y.type,x=m(g);if(2==b)g=x;else if(!x){if(1==b)continue t;break t}}f[h++]=g}return f},hn.prototype.at=of.at,hn.prototype.chain=of.wrapperChain,hn.prototype.commit=of.commit,hn.prototype.next=of.next,hn.prototype.plant=of.plant,hn.prototype.reverse=of.reverse,hn.prototype.toJSON=hn.prototype.valueOf=hn.prototype.value=of.value,hn.prototype.first=hn.prototype.head,gf&&(hn.prototype[gf]=of.toIterator),hf={__e:function(t,e,n,r){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),a=i.__d),a)return i.__E=i}catch(e){t=e}throw t}},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;var xf=0;function _f(t,e,n,r,i,o){e||(e={});var a,u,s=e;if("ref"in s)for(u in s={},e)"ref"==u?a=e[u]:s[u]=e[u];var l={type:t,props:s,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--xf,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof t&&(a=t.defaultProps))for(u in a)void 0===s[u]&&(s[u]=a[u]);return hf.vnode&&hf.vnode(l),l}var wf=e.LogicFlowUtil.StepDrag,Mf=function(t){function n(n){var r=t.call(this)||this;return r.updatePosition=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.x,a=i.y;r.nodeModel.x=o+e/2,r.nodeModel.y=a+n/2,r.nodeModel.moveText(e/2,n/2)},r.getResize=function(t){var e=t.index,n=t.deltaX,r=t.deltaY,i=t.width,o=t.height,a=t.PCTResizeInfo,u=t.pct,s=void 0===u?1:u,l=t.freezeWidth,c=void 0!==l&&l,d=t.freezeHeight,h=void 0!==d&&d,p={width:i,height:o,deltaX:n,deltaY:r};if(a){var f=0,v=0;switch(e){case 0:v=(-1*n-r)/4;break;case 1:v=(n-r)/4;break;case 2:v=(n+r)/4;break;case 3:v=(-1*n+r)/4}0!==v&&(f=Math.round(v/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 g=Math.round(a.ResizePCT.widthPCT*a.ResizeBasis.basisWidth/100),y=Math.round(a.ResizePCT.heightPCT*a.ResizeBasis.basisHeight/100);switch(e){case 0:n=i-g,r=o-y;break;case 1:n=g-i,r=o-y;break;case 2:n=g-i,r=y-o;break;case 3:n=i-g,r=y-o}return p.width=g,p.height=y,p.deltaX=n/s,p.deltaY=r/s,p}switch(e){case 0:p.width=c?i:i-n*s,p.height=h?o:o-r*s;break;case 1:p.width=c?i:i+n*s,p.height=h?o:o-r*s;break;case 2:p.width=c?i:i+n*s,p.height=h?o:o+r*s;break;case 3:p.width=c?i:i-n*s,p.height=h?o:o+r*s}return p},r.updateEdgePointByAnchors=function(){var t=r.nodeModel,e=t.id,n=t.anchors,i=r.getNodeEdges(e);i.sourceEdges.forEach((function(t){var e=n.find((function(e){return e.id===t.sourceAnchorId}));e&&t.updateStartPoint({x:e.x,y:e.y})})),i.targetEdges.forEach((function(t){var e=n.find((function(e){return e.id===t.targetAnchorId}));e&&t.updateEndPoint({x:e.x,y:e.y})}))},r.updateRect=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.x,a=i.y,u=i.width,s=i.height,l=i.radius,c=i.PCTResizeInfo,d=r.nodeModel,h=d.minWidth,p=d.minHeight,f=d.maxWidth,v=d.maxHeight,g=r.index,y=h===f,m=p===v,b=r.getResize({index:g,deltaX:e,deltaY:n,width:u,height:s,PCTResizeInfo:c,pct:1,freezeWidth:y,freezeHeight:m});if(b.width<h||b.width>f||b.height<p||b.height>v)r.dragHandler.cancelDrag();else{r.updatePosition({deltaX:y?0:b.deltaX,deltaY:m?0:b.deltaY}),r.nodeModel.width=b.width,r.nodeModel.height=b.height,r.nodeModel.setProperties({nodeSize:{width:b.width,height:b.height}});var x={x:o,y:a,width:u,height:s,radius:l},_={x:r.nodeModel.x,y:r.nodeModel.y,width:r.nodeModel.width,height:r.nodeModel.height,radius:l};r.updateEdgePointByAnchors(),r.eventEmit({beforeNode:x,afterNode:_})}},r.updateEllipse=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.rx,a=i.ry,u=i.x,s=i.y,l=i.PCTResizeInfo,c=r.index,d=r.nodeModel,h=d.minWidth,p=d.minHeight,f=d.maxWidth,g=d.maxHeight,y=h===f,m=p===g,b=o,x=a,_=r.getResize({index:c,deltaX:e,deltaY:n,width:b,height:x,PCTResizeInfo:l,pct:.5,freezeWidth:y,freezeHeight:m});if(_.width<h/2||_.width>f/2||_.height<p/2||_.height>g/2)r.dragHandler.cancelDrag();else{r.updatePosition({deltaX:y?0:_.deltaX,deltaY:m?0:_.deltaY}),r.nodeModel.rx=_.width,r.nodeModel.ry=_.height,r.nodeModel.setProperties({nodeSize:{rx:_.width,ry:_.height}});var w={x:u,y:s},M={rx:_.width,ry:_.height,x:r.nodeModel.x,y:r.nodeModel.y};r.updateEdgePointByAnchors(),r.eventEmit({beforeNode:v(v({},w),{rx:o,ry:a}),afterNode:M})}},r.updateDiamond=function(t){var e=t.deltaX,n=t.deltaY,i=r.nodeModel,o=i.rx,a=i.ry,u=i.x,s=i.y,l=i.PCTResizeInfo,c=r.index,d=r.nodeModel,h=d.minWidth,p=d.minHeight,f=d.maxWidth,v=d.maxHeight,g=h===f,y=p===v,m=o,b=a,x=r.getResize({index:c,deltaX:e,deltaY:n,width:m,height:b,PCTResizeInfo:l,pct:.5,freezeWidth:g,freezeHeight:y});if(x.width<h/2||x.width>f/2||x.height<p/2||x.height>v/2)r.dragHandler.cancelDrag();else{r.updatePosition({deltaX:g?0:x.deltaX,deltaY:y?0:x.deltaY}),r.nodeModel.rx=x.width,r.nodeModel.ry=x.height,r.nodeModel.setProperties({nodeSize:{rx:x.width,ry:x.height}});var _={x:u,y:s,rx:o,ry:a},w={rx:x.width,ry:x.height,x:r.nodeModel.x,y:r.nodeModel.y};r.updateEdgePointByAnchors(),r.eventEmit({beforeNode:_,afterNode:w})}},r.eventEmit=function(t){var e=t.beforeNode,n=t.afterNode,i=r.nodeModel,o=i.id,a=i.modelType,u=i.type,s=v({id:o,modelType:a,type:u},e),l=v({id:o,modelType:a,type:u},n);r.graphModel.eventCenter.emit("node:resize",{oldNodeSize:s,newNodeSize:l})},r.onDragging=function(t){var n,i=t.deltaX,o=t.deltaY,a=r.graphModel.transformModel,u=r.nodeModel.modelType;i=(n=x(a.fixDeltaXY(i,o),2))[0],o=n[1],u===e.ModelType.RECT_NODE||u===e.ModelType.HTML_NODE?r.updateRect({deltaX:i,deltaY:o}):u===e.ModelType.ELLIPSE_NODE?r.updateEllipse({deltaX:i,deltaY:o}):u===e.ModelType.DIAMOND_NODE&&r.updateDiamond({deltaX:i,deltaY:o})},r.onDragEnd=function(){var t=r.graphModel.gridSize,e=void 0===t?1:t,n=e*Math.round(r.nodeModel.x/e),i=e*Math.round(r.nodeModel.y/e);r.nodeModel.moveTo(n,i),r.updateEdgePointByAnchors()},r.index=n.index,r.nodeModel=n.model,r.graphModel=n.graphModel,r.dragHandler=new wf({onDragging:r.onDragging,onDragEnd:r.onDragEnd,step:1}),r}return f(n,t),n.prototype.getNodeEdges=function(t){for(var e=this.graphModel.edges,n=[],r=[],i=0;i<e.length;i++){var o=e[i];o.sourceNodeId===t?n.push(o):e[i].targetNodeId===t&&r.push(o)}return{sourceEdges:n,targetEdges:r}},n.prototype.render=function(){var t=this.props,n=t.x,r=t.y,i=t.index,o=t.model.getControlPointStyle();return _f("g",{className:"lf-resize-control-".concat(i),children:_f(e.Rect,v({className:"lf-node-control",x:n,y:r},o,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(e.Component),Ef=function(t){function n(){var e=t.call(this)||this;return e.state={},e}return f(n,t),n.prototype.getResizeControl=function(){var t=this.props,e=t.model,n=t.graphModel,r=e.x,i=e.y,o=e.width,a=e.height,u={minX:r-o/2,minY:i-a/2,maxX:r+o/2,maxY:i+a/2},s=u.minX,l=u.minY,c=u.maxX,d=u.maxY;return[{x:s,y:l},{x:c,y:l},{x:c,y:d},{x:s,y:d}].map((function(t,r){return _f(Mf,v({index:r},t,{model:e,graphModel:n}))}))},n.prototype.getGroupSolid=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.getResizeOutlineStyle();return _f(e.Rect,v({},a,{x:n,y:r,width:i,height:o}))},n.prototype.render=function(){return _f("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(e.Component),Nf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.rx=i.rx,r.ry=i.ry),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={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:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.EllipseNodeModel),Sf=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e.isSelected&&!n?this.getControlGroup():""]})},e}(e.EllipseNode),Af={type:"ellipse",view:Sf,model:Nf},Pf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.rx=i.rx,r.ry=i.ry),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.gridSize=1},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={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:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.DiamondNodeModel),Tf=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},n.prototype.getResizeShape=function(){var t=this.props.model,n=t.points,r=t.getNodeStyle();return _f("g",{children:_f(e.Polygon,v({},r,{points:n}))})},n.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},n}(e.DiamondNode),kf={type:"diamond",view:Tf,model:Pf},Cf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.width=i.width,r.height=i.height),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={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:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.HtmlNodeModel),Of=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},e}(e.HtmlNode),If={type:"html",view:Of,model:Cf},jf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=e.properties.nodeSize;return i&&(r.width=i.width,r.height=i.height),r}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={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:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.RectNodeModel),Rf=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return _f(Ef,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return _f("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},e}(e.RectNode),Df={type:"rect",view:Rf,model:jf},Lf={pluginName:"nodeResize",step:0,install:function(t){t.register(Af),t.register(kf),t.register(If),t.register(Df)}},Bf=function(t){function e(){var e=t.apply(this,_([],x(arguments),!1))||this;return e.isGroup=!0,e.isFolded=!1,e.unfoldedWidth=500,e.unfoldedHeight=300,e.childrenLastFoldStatus={},e}return f(e,t),e.prototype.initNodeData=function(e){var n=this;t.prototype.initNodeData.call(this,e);var r=[];Array.isArray(e.children)&&(r=e.children),this.children=new Set(r),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)}))},e.prototype.getResizeOutlineStyle=function(){var e=t.prototype.getResizeOutlineStyle.call(this);return e.stroke="none",e},e.prototype.foldGroup=function(t){var e=this;if(t!==this.isFolded){this.setProperty("isFolded",t),this.isFolded=t,t?(this.x=this.x-this.width/2+this.foldedWidth/2,this.y=this.y-this.height/2+this.foldedHeight/2,this.unfoldedWidth=this.width,this.unfoldedHeight=this.height,this.width=this.foldedWidth,this.height=this.foldedHeight):(this.width=this.unfoldedWidth,this.height=this.unfoldedHeight,this.x=this.x+this.width/2-this.foldedWidth/2,this.y=this.y+this.height/2-this.foldedHeight/2);var n=_(_([],x(this.incoming.edges),!1),x(this.outgoing.edges),!1);this.children.forEach((function(r){var i=e.graphModel.getElement(r);if(i){var o=i.isFolded;if(i.isGroup&&!i.isFolded&&i.foldGroup(t),i.isGroup&&!t){var a=e.childrenLastFoldStatus[r];void 0!==a&&a!==i.isFolded&&i.foldGroup(a)}e.childrenLastFoldStatus[r]=!!o,i.visible=!t;var u=i.incoming.edges,s=i.outgoing.edges;n=_(_(_([],x(n),!1),x(u),!1),x(s),!1)}})),this.foldEdge(t,n)}},e.prototype.getAnchorStyle=function(e){var n=t.prototype.getAnchorStyle.call(this,e);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},e.prototype.foldEdge=function(t,e){var n=this;e.forEach((function(e,r){var i=e.id,o=e.sourceNodeId,a=e.targetNodeId,u=e.startPoint,s=e.endPoint,l=e.type,c=e.text,d=e.getProperties(),h={id:"".concat(i,"__").concat(r),sourceNodeId:o,targetNodeId:a,startPoint:u,endPoint:s,type:l,properties:d,text:null==c?void 0:c.value};e.virtual&&n.graphModel.deleteEdgeById(e.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)),t&&!1!==e.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),e.visible=!1),t||!1!==e.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)):e.visible=!0)}))},e.prototype.createVirtualEdge=function(t){t.pointsList=void 0;var e=this.graphModel.addEdge(t);e.virtual=!0,e.text.editable=!1,e.isFoldedEdge=!0},e.prototype.isInRange=function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2;return e>=this.x-this.width/2&&r<=this.x+this.width/2&&n>=this.y-this.height/2&&i<=this.y+this.height/2},e.prototype.isAllowMoveTo=function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2;return{x:e>=this.x-this.width/2&&r<=this.x+this.width/2,y:n>=this.y-this.height/2&&i<=this.y+this.height/2}},e.prototype.setAllowAppendChild=function(t){this.setProperty("groupAddable",t)},e.prototype.addChild=function(t){this.children.add(t),this.graphModel.eventCenter.emit("group:add-node",{data:this.getData()})},e.prototype.removeChild=function(t){this.children.delete(t),this.graphModel.eventCenter.emit("group:remove-node",{data:this.getData()})},e.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},e.prototype.getData=function(){var e=this,n=t.prototype.getData.call(this);n.children=[],this.children.forEach((function(t){var r=e.graphModel.getNodeModelById(t);r&&!r.virtual&&n.children.push(t)}));var r=n.properties;return null==r||delete r.groupAddable,null==r||delete r.isFolded,n},e.prototype.getHistoryData=function(){var e=t.prototype.getData.call(this);e.children=_([],x(this.children),!1),e.isGroup=!0;var n=e.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(e.x=e.x+this.unfoldedWidth/2-this.foldedWidth/2,e.y=e.y+this.unfoldedHeight/2-this.foldedHeight/2),e},e.prototype.isAllowAppendIn=function(t){return console.info("_nodeData",t),!0},e.prototype.toBack=function(){this.zIndex--},e}(jf),zf=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getControlGroup=function(){var e=this.props.model,n=e.resizable,r=e.properties;return n&&!r.isFolded?t.prototype.getControlGroup.call(this):null},n.prototype.getAddableShape=function(){var t=this.props.model,n=t.width,r=t.height,i=t.x,o=t.y,a=t.radius,u=t.properties,s=t.getAddableOutlineStyle;if(!u.groupAddable)return null;var l=this.props.model.getNodeStyle().strokeWidth,c=void 0===l?0:l,d=s(),h=n+c+8,p=r+c+8;return e.h("rect",v(v({},d),{width:h,height:p,x:i-h/2,y:o-p/2,rx:a,ry:a}))},n.prototype.getFoldIcon=function(){var t=this.props.model,n=t.x-t.width/2+5,r=t.y-t.height/2+5;if(!t.foldable)return null;var i=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:t.properties.isFolded?"M ".concat(n+3,",").concat(r+6," ").concat(n+11,",").concat(r+6," M").concat(n+7,",").concat(r+2," ").concat(n+7,",").concat(r+10):"M ".concat(n+3,",").concat(r+6," ").concat(n+11,",").concat(r+6," ")});return e.h("g",{},[e.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:t.x-t.width/2+5,y:t.y-t.height/2+5,onClick:function(){t.foldGroup(!t.properties.isFolded)}}),i])},n.prototype.getResizeShape=function(){return e.h("g",{},[this.getAddableShape(),t.prototype.getResizeShape.call(this),this.getFoldIcon()])},n}(Rf),Wf={type:"group",view:zf,model:Bf},Ff=-1e4,Gf=function(){function t(t){var e=t.lf,n=this;this.topGroupZIndex=Ff,this.nodeGroupMap=new Map,this.graphRendered=function(t){var e=t.data;e&&e.nodes&&(e.nodes.forEach((function(t){t.children&&t.children.forEach((function(e){n.nodeGroupMap.set(e,t.id)}))})),n.checkAndCorrectTopGroupZIndex(e.nodes))},this.appendNodeToGroup=function(t){var e=t.data,r=n.nodeGroupMap.get(e.id);if(r){var i=n.lf.getNodeModelById(r);i.removeChild(e.id),n.nodeGroupMap.delete(e.id),i.setAllowAppendChild(!1)}var o=n.lf.getNodeModelById(e.id),a=null==o?void 0:o.getBounds();if(a&&o){var u=n.getGroup(a,e);if(o.isGroup&&(e.children.forEach((function(t){n.nodeGroupMap.set(t,e.id)})),n.checkAndCorrectTopGroupZIndex([e]),n.nodeSelected({data:e,isSelected:!1,isMultiple:!1})),!u)return;if(!u.isAllowAppendIn(e))return void n.lf.emit("group:not-allowed",{group:u.getData(),node:e});u.addChild(e.id),n.nodeGroupMap.set(e.id,u.id),u.setAllowAppendChild(!1)}},this.deleteGroupChild=function(t){var e=t.data;e.children&&e.children.forEach((function(t){n.nodeGroupMap.delete(t),n.lf.deleteNode(t)}));var r=n.nodeGroupMap.get(e.id);r&&(n.lf.getNodeModelById(r).removeChild(e.id),n.nodeGroupMap.delete(e.id))},this.setActiveGroup=function(t){var e=t.data,r=n.lf.getNodeModelById(e.id),i=null==r?void 0:r.getBounds();if(r&&i){var o=n.getGroup(i,e);if(n.activeGroup&&n.activeGroup.setAllowAppendChild(!1),!o||r.isGroup&&o.id===e.id)return;if(!o.isAllowAppendIn(e))return;n.activeGroup=o,n.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(t){var e=Ff;return t.isGroup&&(e=Math.max(e,t.zIndex)),t.children&&t.children.forEach((function(t){"object"==typeof t&&(t=t.id);var r=n.lf.getNodeModelById(t);if(null==r?void 0:r.isGroup){var i=n.findNodeAndChildMaxZIndex(r);e=Math.max(i,e)}})),e},this.checkAndCorrectTopGroupZIndex=function(t){var e=Ff;if(t.forEach((function(t){var r=n.lf.getNodeModelById(t.id);if(r){var i=n.findNodeAndChildMaxZIndex(r);i>e&&(e=i)}})),!(n.topGroupZIndex>=e)){for(var r=n.lf.graphModel.nodes.filter((function(t){return t.isGroup})),i=n.topGroupZIndex,o=0;o<r.length;o++){var a=r[o];a.zIndex>i&&(i=a.zIndex)}n.topGroupZIndex=i}},this.nodeSelected=function(t){var e=t.data,r=t.isMultiple,i=t.isSelected,o=n.lf.getNodeModelById(e.id);if(n.toFrontGroup(o),n.topGroupZIndex>-1e3){n.topGroupZIndex=Ff;for(var a=n.lf.graphModel.nodes.filter((function(t){return t.isGroup})).sort((function(t,e){return t.zIndex-e.zIndex})),u=0,s=0;s<a.length;s++){var l=a[s];l.zIndex!==u&&(n.topGroupZIndex++,u=l.zIndex),l.setZIndex(n.topGroupZIndex)}}if(r&&i)if(null==o?void 0:o.isGroup)o.children.forEach((function(t){var e=n.lf.graphModel.getElement(t);null==e||e.setSelected(!1)}));else{var c=n.nodeGroupMap.get(e.id);if(c){var d=n.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==o||o.setSelected(!1))}}},this.toFrontGroup=function(t){t&&t.isGroup&&(n.topGroupZIndex++,t.setZIndex(n.topGroupZIndex),t.children&&t.children.forEach((function(t){var e=n.lf.getNodeModelById(t);n.toFrontGroup(e)})))},e.register(Wf),this.lf=e,e.graphModel.addNodeMoveRules((function(t,r,i){if(t.isGroup){var o=n.getNodeAllChild(t);return e.graphModel.moveNodes(o,r,i,!0),!0}var a=e.getNodeModelById(n.nodeGroupMap.get(t.id));if(a&&a.isRestrict){var u=t.getBounds(),s=u.x1,l=u.y1,c=u.x2,d=u.y2;return a.isAllowMoveTo({x1:s+r,y1:l+i,x2:c+r,y2:d+i})}return!0})),e.graphModel.group=this,e.on("node:add,node:drop,node:dnd-add",this.appendNodeToGroup),e.on("node:delete",this.deleteGroupChild),e.on("node:dnd-drag,node:drag",this.setActiveGroup),e.on("node:click",this.nodeSelected),e.on("graph:rendered",this.graphRendered),e.addElements=function(t,r){var i=t.nodes,o=t.edges,a={},u={nodes:[],edges:[]},s=[];return ml(i,(function(t){var i=t.id,o=t.children,l=g(t,["children"]),c=e.addNode(l);if(!c)return{nodes:[],edges:[]};i&&(a[i]=c.id),u.nodes.push(c);var d=n.createAllChildNodes(a,o,c,r).edgesArray;s.push.apply(s,_([],x(d),!1))})),s.forEach((function(t){n.createEdgeModel(t,a,r)})),ml(o,(function(t){var e=n.createEdgeModel(t,a,0);u.edges.push(e)})),u}}return t.prototype.createAllChildNodes=function(t,n,r,i){var o=this,a=this.lf,u=[],s=[],l=[];null==n||n.forEach((function(n){var c=a.getNodeModelById(n);if(c){var d=c.x,h=c.y,p=c.properties,f=c.type,g=c.text,y=c.rotate,m=c.children,b=e.EventType.NODE_GROUP_COPY||"node:group-copy-add",w=a.addNode({x:d+i,y:h+i,properties:p,type:f,text:v(v({},g),{x:g.x+i,y:g.y+i}),rotate:y},b);if(r.addChild(w.id),t[n]=w.id,l.push(w),c.incoming.edges.forEach((function(t){s.push(t)})),c.outgoing.edges.forEach((function(t){s.push(t)})),m instanceof Set){var M=o.createAllChildNodes(t,m,w,i),E=M.nodesArray,N=M.edgesArray;l.push.apply(l,_([],x(E),!1)),u.push.apply(u,_([],x(N),!1))}}}));var c=s.filter((function(e){return t[e.sourceNodeId]&&t[e.targetNodeId]})).map((function(t){return t.getData()}));return{nodesArray:l,edgesArray:u.concat(c)}},t.prototype.createEdgeModel=function(t,e,n){var r=this.lf,i=t.sourceNodeId,o=t.targetNodeId;e[i]&&(i=e[i]),e[o]&&(o=e[o]);var a=t.type,u=t.startPoint,s=t.endPoint,l=t.pointsList,c=t.text,d={x:((null==u?void 0:u.x)||0)+n,y:((null==u?void 0:u.y)||0)+n},h={x:((null==s?void 0:s.x)||0)+n,y:((null==s?void 0:s.y)||0)+n},p=[];l&&l.length>0&&(p=l.map((function(t){return t.x+=n,t.y+=n,t})));var f=c;return c&&"string"!=typeof c&&(f.x=c.x+n,f.y=c.y+n),r.graphModel.addEdge({type:a,startPoint:d,endPoint:h,sourceNodeId:i,targetNodeId:o,pointsList:p,text:f})},t.prototype.getNodeAllChild=function(t){var e=this,n=[];return t.children&&t.children.forEach((function(t){n.push(t);var r=e.lf.getNodeModelById(t);(null==r?void 0:r.isGroup)&&(n=n.concat(e.getNodeAllChild(r)))})),n},t.prototype.getGroup=function(t,e){var n=this.lf.graphModel.nodes.filter((function(n){return n.isGroup&&n.isInRange(t)&&n.id!==e.id}));if(0!==n.length){if(1===n.length)return n[0];for(var r=n[n.length-1],i=n.length-2;i>=0;i--)n[i].zIndex>r.zIndex&&(r=n[i]);return r}},t.prototype.getNodeGroup=function(t){var e=this.nodeGroupMap.get(t);if(e)return this.lf.getNodeModelById(e)},t.prototype.render=function(){},t.prototype.destroy=function(){},t.pluginName="group",t}();function Hf(){var t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getFoldIcon=function(){var t=this.props.model,n=t,r=n.x,i=n.y,o=n.width,a=n.height,u=n.properties,s=n.foldable,l=t.x-t.width/2+5,c=t.y-t.height/2+5;if(!s)return null;var d=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:u.isFolded?"M ".concat(l+3,",").concat(c+6," ").concat(l+11,",").concat(c+6," M").concat(l+7,",").concat(c+2," ").concat(l+7,",").concat(c+10):"M ".concat(l+3,",").concat(c+6," ").concat(l+11,",").concat(c+6," ")});return e.h("g",{},[e.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:r-o/2+5,y:i-a/2+5,onClick:function(e){var n,r;null===(r=(n=e.stopPropagation()(t)).foldGroup)||void 0===r||r.call(n,!u.isFolded)}}),d])},n.prototype.getResizeShape=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.getNodeStyle(),u=v(v({},a),{x:n-i/2,y:r-o/2,width:i,height:o,stroke:"black",strokeWidth:2,strokeDasharray:"0 0"});return e.h("g",{},[e.h("rect",v({},u)),this.getFoldIcon()])},n}(zf),n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.foldable=!0,this.resizable=!0,this.width=400,this.height=200,this.resetWidthHeight(),this.isTaskNode=!0,this.boundaryEvents=[]},e.prototype.resetWidthHeight=function(){var t,e,n=null===(t=this.properties.iniProp)||void 0===t?void 0:t.width,r=null===(e=this.properties.iniProp)||void 0===e?void 0:e.height;n&&(this.width=n),r&&(this.height=r)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return e.stroke="#989891",e.strokeWidth=1,e.strokeDasharray="3 3",this.isSelected&&(e.stroke="rgb(124, 15, 255)"),this.properties.isBoundaryEventTouchingTask&&(e.stroke="#00acff",e.strokeWidth=2),e},e.prototype.addChild=function(e){var n=this.graphModel.getElement(e);null==n||n.setProperties({parent:this.id}),t.prototype.addChild.call(this,e)},e.prototype.getAnchorStyle=function(){var e=t.prototype.getAnchorStyle.call(this);return e.stroke="#000",e.fill="#fff",e.hover||(e.hover={}),e.hover.stroke="transparent",e},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return e.stroke="transparent",e.hover||(e.hover={}),e.hover.stroke="transparent",e},e.prototype.setTouching=function(t){this.setProperty("isBoundaryEventTouchingTask",t)},e.prototype.addBoundaryEvent=function(t){if(this.setTouching(!1),this.boundaryEvents.find((function(e){return e===t})))return!1;var e=this.graphModel.getNodeModelById(t);return null==e||e.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(t),!0},e.prototype.deleteBoundaryEvent=function(t){this.boundaryEvents=this.boundaryEvents.filter((function(e){return e!==t}))},e}(Bf);return{type:"bpmn:subProcess",view:t,model:n}}function Xf(t){var e=jt("bpmn:serviceTask",St),n=jt("bpmn:userTask",At);t.register(e),t.register(n),t.register(Hf()),function(t){function e(t,e){var n=t.x,r=t.y,i=t.width,o=t.height,a=t.id,u=n-i/2,s=n+i/2,l=r-o/2,c=r+o/2,d=e.x,h=e.y;return d>u-5&&d<s+5&&h>l-5&&h<c+5&&!(d>u+5&&d<s-5&&h>l+5&&h<c-5)?a:null}t.on("node:drag,node:dnd-drag",(function(n){var r,i,o=n.data;if("bpmn:boundaryEvent"===o.type){var a=t.graphModel.nodes;try{for(var u=b(a),s=u.next();!s.done;s=u.next()){var l=s.value;l.isTaskNode&&(e(l,o)?l.setTouching(!0):l.setTouching(!1))}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}})),t.on("node:drop,node:dnd-add",(function(n){var r,i,o=n.data,a=o.type,u=o.id;if("bpmn:boundaryEvent"===a){var s=t.graphModel.nodes;try{for(var l=b(s),c=l.next();!c.done;c=l.next()){var d,h=c.value;if(h.isTaskNode)if(null!==(d=e(h,o))){var p=t.graphModel.getNodeModelById(u),f=t.graphModel.getNodeModelById(d),v=p.properties.attachedToRef;return v&&v!==d&&t.graphModel.getNodeModelById(v).deleteBoundaryEvent(u),void f.addBoundaryEvent(u)}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}})),t.graphModel.addNodeMoveRules((function(e,n,r){if(e.isTaskNode){var i=e.boundaryEvents;return t.graphModel.moveNodes(i,n,r,!0),!0}return!0}))}(t)}function Uf(t){var n=function(e){function n(n,r){n.id||(n.id="Flow_".concat(ft()));var i=v(v(v({},t||{}),n.properties),{isDefaultFlow:!1});return n.properties=i,e.call(this,n,r)||this}return f(n,e),n.extendKey="SequenceFlowModel",n}(e.PolylineEdgeModel),r=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getStartArrow=function(){return this.props.model.properties.isDefaultFlow?e.h("path",{refX:15,stroke:"#000000",strokeWidth:2,d:"M 20 5 10 -5 z"}):e.h("path",{d:""})},n.extendKey="SequenceFlowEdge",n}(e.PolylineEdge);return{type:"bpmn:sequenceFlow",view:r,model:n}}var Vf=Uf();var qf=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:_t,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function Yf(t){function e(e){e.forEach((function(e){var n,r;n=e.nodes,r=e.definition,n.forEach((function(e){(null==t?void 0:t[e])||(t[e]=new Map);var n=null==t?void 0:t[e];r.forEach((function(t){n.set(t.type,t)}))}))}))}return function(){return[t,e]}}var Zf=function(){function t(t){var e=t.lf;e.definition={},e.useDefinition=Yf(e.definition);var n=x(e.useDefinition(),2),r=n[0],i=n[1];console.log("_definition",r),i(qf),function(t){t.register(mt(t)),t.register(gt(t)),t.register(yt(t)),t.register(xt(t)),t.register(bt(t))}(e),function(t){var e=Ot("bpmn:exclusiveGateway",Mt),n=Ot("bpmn:parallelGateway",Et),r=Ot("bpmn:inclusiveGateway",Nt);t.register(e),t.register(r),t.register(n)}(e),function(t){t.register(Vf)}(e),Xf(e),e.setDefaultEdgeType("bpmn:sequenceFlow")}return t.pluginName="BpmnElementsPlugin",t}(),Kf=40,$f=40,Jf=40,Qf=40,tv=100,ev=80,nv=100,rv=80,iv=100,ov=80,av=100,uv=80,sv=100,lv=80,cv=100,dv=80,hv=100,pv=80,fv=100,vv=80,gv=function(){};(gv.ObjTree=function(){return this}).VERSION="0.23",gv.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',gv.ObjTree.prototype.attr_prefix="-",gv.ObjTree.prototype.parseXML=function(t){var e;if(window.DOMParser){var n=new DOMParser,r=n.parseFromString(t,"application/xml");if(!r)return;e=r.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(t),e=n.documentElement);if(e)return this.parseDOM(e)},gv.ObjTree.prototype.parseHTTP=function(t,e,n){var r,i={};for(var o in e)i[o]=e[o];if(i.method||(void 0===i.postBody&&void 0===i.postbody&&void 0===i.parameters?i.method="get":i.method="post"),n){i.asynchronous=!0;var a=this,u=n,s=i.onComplete;i.onComplete=function(t){var e;t&&t.responseXML&&t.responseXML.documentElement&&(e=a.parseDOM(t.responseXML.documentElement)),u(e,t),s&&s(t)}}else i.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)i.uri=t,(l=new HTTP.Request(i))&&(r=l.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var l;(l=new Ajax.Request(t,i))&&(r=l.transport)}return n?r:r&&r.responseXML&&r.responseXML.documentElement?this.parseDOM(r.responseXML.documentElement):void 0},gv.ObjTree.prototype.parseDOM=function(t){if(t){if(this.__force_array={},this.force_array)for(var e=0;e<this.force_array.length;e++)this.__force_array[this.force_array[e]]=1;var n=this.parseElement(t);if(this.__force_array[t.nodeName]&&(n=[n]),11!==t.nodeType){var r={};r[t.nodeName]=n,n=r}return n}},gv.ObjTree.prototype.parseElement=function(t){if(7!==t.nodeType){if(3===t.nodeType||4===t.nodeType||8===t.nodeType){if(null==t.nodeValue.match(/[^\x00-\x20]/))return;return t.nodeValue}var e=null,n={};if(t.attributes&&t.attributes.length){e={};for(var r=0;r<t.attributes.length;r++){if("string"==typeof(u=t.attributes[r].nodeName)){var i=t.attributes[r].nodeValue;try{i=JSON.parse(t.attributes[r].nodeValue.replace(/'/g,'"'))}catch(e){i=t.attributes[r].nodeValue}null!=i&&(void 0===n[u=this.attr_prefix+u]&&(n[u]=0),n[u]++,this.addNode(e,u,n[u],i))}}}if(t.childNodes&&t.childNodes.length){var o=!0;e&&(o=!1);for(r=0;r<t.childNodes.length&&o;r++){var a=t.childNodes[r].nodeType;3!==a&&4!==a&&8!==a&&(o=!1)}if(o){e||(e="");for(r=0;r<t.childNodes.length;r++)e+=t.childNodes[r].nodeValue}else{e||(e={});for(r=0;r<t.childNodes.length;r++){var u;if("string"==typeof(u=t.childNodes[r].nodeName))(i=this.parseElement(t.childNodes[r]))&&(void 0===n[u]&&(n[u]=0),n[u]++,this.addNode(e,u,n[u],i))}}}else null===e&&(e={});return e}},gv.ObjTree.prototype.addNode=function(t,e,n,r){this.__force_array[e]?(1===n&&(t[e]=[]),t[e][t[e].length]=r):1===n?t[e]=r:2===n?t[e]=[t[e],r]:t[e][t[e].length]=r},gv.ObjTree.prototype.writeXML=function(t){var e=this.hash_to_xml(null,t);return this.xmlDecl+e},gv.ObjTree.prototype.hash_to_xml=function(t,e){var n=[],r=[];for(var i in e)if(lc(e,i)){var o=e[i];i.charAt(0)!==this.attr_prefix?void 0===o||null==o?n[n.length]="<".concat(i," />"):"object"==typeof o&&o.constructor===Array?n[n.length]=this.array_to_xml(i,o):n[n.length]="object"==typeof o?this.hash_to_xml(i,o):this.scalar_to_xml(i,o):r[r.length]=" ".concat(i.substring(1),'="').concat(this.xml_escape(o),'"')}var a=r.join(""),u=n.join("");return void 0===t||null==t||(u=n.length>0?u.match(/\n/)?"<".concat(t).concat(a,">\n").concat(u,"</").concat(t,">\n"):"<".concat(t).concat(a,">").concat(u,"</").concat(t,">\n"):"<".concat(t).concat(a," />\n")),u},gv.ObjTree.prototype.array_to_xml=function(t,e){for(var n=[],r=0;r<e.length;r++){var i=e[r];void 0===i||null==i?n[n.length]="<".concat(t," />"):"object"==typeof i&&i.constructor===Array?n[n.length]=this.array_to_xml(t,i):n[n.length]="object"==typeof i?this.hash_to_xml(t,i):this.scalar_to_xml(t,i)}return n.join("")},gv.ObjTree.prototype.scalar_to_xml=function(t,e){return"#text"===t?this.xml_escape(e):"<".concat(t,">").concat(this.xml_escape(e),"</").concat(t,">\n")},gv.ObjTree.prototype.xml_escape=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};function yv(t){return Object.prototype.toString.call(t)}function mv(t){return" ".repeat(t)}function bv(t){return"[object Object]"===yv(t)?Object.keys(t).reduce((function(e,n){var r=n;return"-"===n.charAt(0)&&(r=n.substring(1)),e[r]=bv(t[n]),e}),{}):Array.isArray(t)?t.map((function(t){return bv(t)})):t}var xv,_v="\t\n";function wv(t,e,n){var r=mv(n),i="",o=_v+r;if("-json"===e)return"";if("#text"===e)return o+t;if("#cdata-section"===e)return"".concat(o,"<![CDATA[").concat(t,"]]>");if("#comment"===e)return"".concat(o,"\x3c!--").concat(t,"--\x3e");if("-"==="".concat(e).charAt(0))return" ".concat(e.substring(1),'="').concat(function(t){var e=t;try{"string"!=typeof e&&(e=JSON.parse(t))}catch(n){e=JSON.stringify(bv(t)).replace(/"/g,"'")}return e}(t),'"');if(Array.isArray(t))i+=t.map((function(t){return wv(t,e,n+1)})).join("");else if("[object Object]"===yv(t)){var a=Object.keys(t),u="",s=t["-json"]?_v+mv(n+1)+t["-json"]:"";i+="".concat(0===n?"":o,"<").concat(e),a.forEach((function(e){"-"===e.charAt(0)?u+=wv(t[e],e,n+1):s+=wv(t[e],e,n+1)})),i+=u+(""!==s?">".concat(s).concat(o,"</").concat(e,">"):" />")}else i+="".concat(o,"<").concat(e,">").concat(t.toString(),"</").concat(e,">");return i}!function(t){t.START="bpmn:startEvent",t.END="bpmn:endEvent",t.INTERMEDIATE_CATCH="bpmn:intermediateCatchEvent",t.INTERMEDIATE_THROW="bpmn:intermediateThrowEvent",t.BOUNDARY="bpmn:boundaryEvent",t.PARALLEL_GATEWAY="bpmn:parallelGateway",t.INCLUSIVE_GATEWAY="bpmn:inclusiveGateway",t.EXCLUSIVE_GATEWAY="bpmn:exclusiveGateway",t.USER="bpmn:userTask",t.SYSTEM="bpmn:serviceTask",t.FLOW="bpmn:sequenceFlow",t.SUBPROCESS="bpmn:subProcess"}(xv||(xv={}));var Mv=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],Ev=["properties","startPoint","endPoint","pointsList"],Nv={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Sv=function(t,e){return Object.keys(e||{}).forEach((function(n){if(t[n]){var r=e[n],i=r.in,o=r.out;i&&(t[n].in=i),o&&(t[n].out=o)}else t[n]=e[n]})),t},Av={"bpmn:startEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:intermediateCatchEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:intermediateThrowEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:boundaryEvent":{out:function(t){var e,n,r=t.properties;return(null===(n=null===(e=Av[r.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:sequenceFlow":{out:function(t){var e=t.properties,n=e.expressionType,r=e.condition;return r?"cdata"===n?{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[${'.concat(r,"}]]></bpmn:conditionExpression>")}:{json:'<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">'.concat(r,"</bpmn:conditionExpression>")}:{json:""}}},"bpmn:timerEventDefinition":{out:function(t){var e=t.properties,n=e.timerType,r=e.timerValue,i=e.definitionId;return{json:'<bpmn:timerEventDefinition id="'.concat(i,'"').concat(n&&r?">".concat("<bpmn:".concat(n,' xsi:type="bpmn:tFormalExpression">').concat(r,"</bpmn:").concat(n,">"),"</bpmn:timerEventDefinition>"):"/>")}},in:function(t,e){var n,r,i,o=t,a=e["-id"],u="",s="";try{for(var l=b(Object.keys(e)),c=l.next();!c.done;c=l.next()){var d=c.value;d.includes("bpmn:")&&(u=x(d.split(":"),2)[1],s=null===(i=e[d])||void 0===i?void 0:i["#text"])}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return{"-definitionId":a,"-definitionType":o,"-timerType":u,"-timerValue":s}}},"bpmn:conditionExpression":{in:function(t,e){var n,r="",i="";return e["#cdata-section"]?(i="cdata",r=(null===(n=/^\$\{(.*)\}$/g.exec(e["#cdata-section"]))||void 0===n?void 0:n[1])||""):e["#text"]&&(i="normal",r=e["#text"]),{"-condition":r,"-expressionType":i}}}};function Pv(t){var e=null!=t?t:{},n=e.retainedAttrsFields,r=e.excludeFields,i=e.transformer,o=new Set(_(_([],x(Ev),!1),x(n||[]),!1)),a={in:new Set(_(_([],x(Nv.in),!1),x((null==r?void 0:r.in)||[]),!1)),out:new Set(_(_([],x(Nv.out),!1),x((null==r?void 0:r.out)||[]),!1))};return Av=Sv(Av,i),function(t){var e=t.nodes,n=t.edges;return function t(r,i){var u,s;if(1!==(null==r?void 0:r.flag)){var l;if((l=Av[r.type])&&l.out){var c=l.out(r),d=Object.keys(c);d.length>0&&d.forEach((function(t){r[t]=c[t]}))}(null==r?void 0:r.children)&&(r.children=r.children.map((function(t){return e.find((function(e){return e.id===t}))||n.find((function(e){return e.id===t}))||{}})));var h={};if("string"==typeof r)return r;if(Array.isArray(r))return r.map((function(e){return t(e,"")})).filter((function(t){return null!=t}));try{for(var p=b(Object.entries(r)),f=p.next();!f.done;f=p.next()){var v=x(f.value,2),g=v[0],y=v[1];if(1===(null==y?void 0:y.flag))return;var m=[i,g].filter((function(t){return t})).join(".");a.out.has(m)||("object"!=typeof y?0===g.indexOf("-")||["#text","#cdata-section","#comment"].includes(g)?h[g]=y:h["-".concat(g)]=y:o.has(m)?h["-".concat(g)]=t(y,m):h[g]=t(y,m))}}catch(t){u={error:t}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(u)throw u.error}}return h}}(t,"")}}function Tv(t){var e,n,r={};try{for(var i=b(Object.entries(t)),o=i.next();!o.done;o=i.next()){var a=x(o.value,2),u=a[0],s=a[1];0===u.indexOf("-")?r[u.substring(1)]=bv(s):"string"==typeof s?r[u]=s:"[object Object]"===Object.prototype.toString.call(s)?r[u]=Tv(s):Array.isArray(s)?r[u]=s.map((function(t){return Tv(t)})):r[u]=s}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function kv(t,e){t["bpmndi:BPMNEdge"]=e.edges.map((function(t){var e,n=t.id,r=t.pointsList.map((function(t){return{"-x":t.x,"-y":t.y}})),i={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":r};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(i["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),i})),t["bpmndi:BPMNShape"]=e.nodes.map((function(t){var e,n=t.id,r=100,i=80,o=t.x,a=t.y,u=Rv.shapeConfigMap.get(t.type);u&&(r=u.width,i=u.height),o-=r/2,a-=i/2;var s={"-id":"".concat(n,"_di"),"-bpmnElement":n,"dc:Bounds":{"-x":o,"-y":a,"-width":r,"-height":i}};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(s["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),s}))}var Cv=["bpmn:incoming","bpmn:outgoing"];function Ov(t,e){var n=[],r=[],i=new Map,o=null!=e?e:{},a=o.transformer,u=o.excludeFields,s={in:new Set(_(_([],x(Nv.in),!1),x((null==u?void 0:u.in)||[]),!1)),out:new Set(_(_([],x(Nv.out),!1),x((null==u?void 0:u.out)||[]),!1))};Av=Sv(Av,a);var l,c,d=t["bpmn:definitions"];if(d){var h=d["bpmn:process"];l=h,c=[function(t){function e(t){t["-children"]||(t["-children"]=[]),Object.keys(t).forEach((function(e){var n;0!==e.indexOf("bpmn:")||Cv.includes(e)||(h[e]||(h[e]=[]),!Array.isArray(h[e])&&(h[e]=[h[e]]),Array.isArray(t[e])?(n=h[e]).push.apply(n,_([],x(t[e]),!1)):h[e].push(t[e]),Array.isArray(t[e])?t[e].forEach((function(n){!e.includes("Flow")&&t["-children"].push(n["-id"])})):!e.includes("Flow")&&t["-children"].push(t[e]["-id"]),delete t[e])}))}if("bpmn:subProcess"===t){var n=h[t];Array.isArray(n)?n.forEach((function(n){"bpmn:subProcess"===t&&e(n)})):e(n)}},function(t){function e(t){var n;i.set(t["-id"],t),Array.isArray(t)?t.forEach((function(t){e(t)})):"object"==typeof t&&(n=t,Object.keys(n).forEach((function(t){var r,i;if(t.includes("bpmn:")){var o={};Av[t]&&Av[t].in?(o=null===(i=(r=Av[t]).in)||void 0===i?void 0:i.call(r,t,hn.cloneDeep(n[t])),delete n[t]):e(n[t]);var a=void 0;(a=Reflect.ownKeys(o)).length>0&&a.forEach((function(t){Reflect.set(n,t,o[t])}))}})))}e(h[t])},function(t){if(0===t.indexOf("bpmn:")){var e=h[t];if("bpmn:sequenceFlow"===t){var o=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNEdge"];r=function(t,e){var n=[];if(Array.isArray(t))t.forEach((function(t){var r;r=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(jv(r,t))}));else{var r=void 0;r=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(jv(r,t))}return n}(e,o)}else{var a=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if("bpmn:boundaryEvent"===t){var u=h[t],s=function(t){var e=t["-attachedToRef"],n=i.get(e);n["-boundaryEvents"]||(n["-boundaryEvents"]=[]),n["-boundaryEvents"].push(t["-id"])};Array.isArray(u)?u.forEach((function(t){s(t)})):s(u)}n=n.concat(function(t,e,n){var r=[];if(Array.isArray(t))t.forEach((function(t){var i=Iv(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);r.push(i)}));else{var i=Iv(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);r.push(i)}return r}(e,a,t))}}}],c.forEach((function(t){try{Object.keys(l).forEach((function(e){try{t(e)}catch(t){console.error(t)}}))}catch(t){console.error(t)}}))}var p=function(t,e,n){Object.keys(t).forEach((function(r){var i=n?"".concat(n,".").concat(r):r;e.has(i)?delete t[r]:"object"==typeof t[r]&&p(t[r],e,i)}))};return n.forEach((function(t){var n,r;if(null===(n=null==e?void 0:e.mapping)||void 0===n?void 0:n.in){var i=null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.in,o=t.type;i[o]&&(t.type=i[o])}p(t,s.in,"")})),r.forEach((function(t){var n,r;if(null===(n=null==e?void 0:e.mapping)||void 0===n?void 0:n.in){var i=null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.in,o=t.type;i[o]&&(t.type=i[o])}p(t,s.in,"")})),{nodes:n,edges:r}}function Iv(t,e,n){var r=Number(t["dc:Bounds"]["-x"]),i=Number(t["dc:Bounds"]["-y"]),o=n["-children"],a=n["-name"],u=Rv.shapeConfigMap.get(e);u&&(r+=u.width/2,i+=u.height/2);var s,l={};if(Object.entries(n).forEach((function(t){var e=x(t,2),n=e[0],r=e[1];Mv.includes(n)||(l[n]=r)})),l=Tv(l),a&&(s={x:r,y:i,value:a},t["bpmndi:BPMNLabel"]&&t["bpmndi:BPMNLabel"]["dc:Bounds"])){var c=t["bpmndi:BPMNLabel"]["dc:Bounds"];s.x=Number(c["-x"])+Number(c["-width"])/2,s.y=Number(c["-y"])+Number(c["-height"])/2}var d={id:t["-bpmnElement"],type:e,x:r,y:i,properties:l};return o&&(d.children=o),s&&(d.text=s),d}function jv(t,e){var n,r=e["-name"];if(r){var i=t["bpmndi:BPMNLabel"]["dc:Bounds"],o=0;r.split("\n").forEach((function(t){o<t.length&&(o=t.length)})),n={value:r,x:Number(i["-x"])+10*o/2,y:Number(i["-y"])+7}}var a={};Object.entries(e).forEach((function(t){var e=x(t,2),n=e[0],r=e[1];Mv.includes(n)||(a[n]=r)})),a=Tv(a);var u=t["di:waypoint"].map((function(t){return{x:Number(t["-x"]),y:Number(t["-y"])}})),s={id:e["-id"],type:xv.FLOW,pointsList:u,sourceNodeId:e["-sourceRef"],targetNodeId:e["-targetRef"],properties:a};return n&&(s.text=n),s}var Rv=function(){function t(t){var e=t.lf,n=this;this.adapterOut=function(t,e){var r,i,o=v({},n.processAttributes);!function(t,e,n){var r,i=new Map,o=Pv(n)(e);o.nodes.forEach((function(e){var n=e["-id"],r=e["-type"],o=e.text,a=e.children,u=g(e,["-id","-type","text","children"]),s={"-id":n};(null==o?void 0:o["-value"])&&(s["-name"]=o["-value"]),u["-json"]&&(s["-json"]=u["-json"]),u["-properties"]&&Object.assign(s,u["-properties"]),a&&(s.children=a),t[r]||(t[r]=[]),t[r].push(s),i.set(n,s)}));var a=o.edges.map((function(t){var e=t["-id"],n=t["-sourceNodeId"],r=t["-targetNodeId"],o=t.text,a=g(t,["-id","-sourceNodeId","-targetNodeId","text"]),u=i.get(r);u["bpmn:incoming"]||(u["bpmn:incoming"]=[]),u["bpmn:incoming"].push(e);var s={"-id":e,"-sourceRef":n,"-targetRef":r};return(null==o?void 0:o["-value"])&&(s["-name"]=o["-value"]),a["-json"]&&(s["-json"]=a["-json"]),a["-properties"]&&Object.assign(s,a["-properties"]),s}));e.edges.forEach((function(t){var e=t.sourceNodeId,n=t.id,r=i.get(e);r["bpmn:outgoing"]||(r["bpmn:outgoing"]=[]),r["bpmn:outgoing"].push(n)})),null===(r=t["bpmn:subProcess"])||void 0===r||r.forEach((function(e){var n={"bpmn:incoming":new Set,"bpmn:outgoing":new Set},r=[];e.children.forEach((function(r){var o,a=i.get(r["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach((function(t){a[t]&&a[t].forEach((function(e){n[t].add(e)}))}));var u=null===(o=t[r["-type"]])||void 0===o?void 0:o.findIndex((function(t){return t["-id"]===r["-id"]}));u>=0&&t[r["-type"]].splice(u,1),i.delete(r["-id"]),e[r["-type"]]||(e[r["-type"]]=[]),e[r["-type"]].push(a)}));var o=n["bpmn:incoming"];n["bpmn:outgoing"].forEach((function(t){o.has(t)&&r.push(t)}));for(var u,s=function(t){var n=a.findIndex((function(e){return e["-id"]===r[t]}));n>=0?(e["bpmn:sequenceFlow"]||(e["bpmn:sequenceFlow"]=[]),e["bpmn:sequenceFlow"].push(a[n]),a.splice(n,1)):t++,u=t},l=0;l<r.length;)s(l),l=u;delete e.children})),t[xv.FLOW]=a}(o,t,e);var a={"-id":"BPMNPlane_1","-bpmnElement":o["-id"]};kv(a,t);var u=n.definitionAttributes;u["bpmn:process"]=o,u["bpmndi:BPMNDiagram"]={"-id":"BPMNDiagram_1","bpmndi:BPMNPlane":a};var s={"bpmn:definitions":u};if(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.out){var l=null===(i=null==e?void 0:e.mapping)||void 0===i?void 0:i.out,c=function(t){Array.isArray(t)&&t.forEach((function(t){return c(t)})),"object"==typeof t&&Object.keys(t).forEach((function(e){var n;(n=l[e])?(t[n]=hn.cloneDeep(t[e]),delete t[e],c(t[n])):c(t[e])}))};c(s)}return s},this.adapterIn=function(t,e){if(t)return Ov(t,e)},e.adapterIn=this.adapterIn,e.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 t.prototype.setCustomShape=function(e,n){t.shapeConfigMap.set(e,n)},t.pluginName="bpmn-adapter",t.shapeConfigMap=new Map,t}();Rv.shapeConfigMap.set(xv.START,{width:Kf,height:$f}),Rv.shapeConfigMap.set(xv.END,{width:Jf,height:Qf}),Rv.shapeConfigMap.set(xv.INTERMEDIATE_CATCH,{width:nv,height:rv}),Rv.shapeConfigMap.set(xv.INTERMEDIATE_THROW,{width:nv,height:rv}),Rv.shapeConfigMap.set(xv.BOUNDARY,{width:tv,height:ev}),Rv.shapeConfigMap.set(xv.PARALLEL_GATEWAY,{width:iv,height:ov}),Rv.shapeConfigMap.set(xv.INCLUSIVE_GATEWAY,{width:av,height:uv}),Rv.shapeConfigMap.set(xv.EXCLUSIVE_GATEWAY,{width:sv,height:lv}),Rv.shapeConfigMap.set(xv.SYSTEM,{width:cv,height:dv}),Rv.shapeConfigMap.set(xv.USER,{width:hv,height:pv}),Rv.shapeConfigMap.set(xv.SUBPROCESS,{width:fv,height:vv});var Dv=function(t){function e(e){var n=t.call(this,e)||this;n.adapterXmlIn=function(t){var e,r=(e=t,(new gv.ObjTree).parseXML(e));return n.adapterIn(r,n.props)},n.adapterXmlOut=function(t){return function(t){var e="";for(var n in t)e+=wv(t[n],n,0);return e}(n.adapterOut(t,n.props))};var r=e.lf,i=e.props;return r.adapterIn=n.adapterXmlIn,r.adapterOut=n.adapterXmlOut,n.props=i,n}return f(e,t),e.pluginName="BPMNAdapter",e}(Rv),Lv={};function Bv(t){return t.startsWith("data:text/plain")}function zv(t){return y(this,void 0,void 0,(function(){return m(this,(function(e){return Lv[t]?[2,Lv[t]]:[2,new Promise((function(e,n){try{fetch(t).then((function(t){return t.blob()})).then((function(r){var i=new FileReader;i.onloadend=function(){e(Lv[t]=i.result)},i.onerror=n,i.readAsDataURL(r)})).catch((function(){e(Lv[t]=t)}))}catch(e){return Lv[t]=t}}))]}))}))}function Wv(t,e){return y(this,void 0,void 0,(function(){var n,r,i;return m(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),(n=t.getAttribute(e)||"").startsWith("data:")?[2]:[4,zv(n)];case 1:return Bv(r=o.sent())?[2]:(t.setAttribute(e,r),[3,3]);case 2:return i=o.sent(),console.error(i),[3,3];case 3:return[2]}}))}))}function Fv(t,e){return y(this,void 0,void 0,(function(){var n,r;return m(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e.startsWith("data:")?[2]:[4,zv(e)];case 1:return Bv(n=i.sent())?[2]:(t.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return r=i.sent(),console.error(r),[3,3];case 3:return[2]}}))}))}function Gv(t){return y(this,void 0,void 0,(function(){var e,n,r,i,o,a,u,s,l;return m(this,(function(c){switch(c.label){case 0:for(e=[t],r=[];e.length;)(n=e.shift()).children.length&&e.push.apply(e,_([],x(n.children),!1)),n instanceof HTMLElement&&(i=n.style,o=i.background,a=i.backgroundImage,(u=o.match(/url\(["']?(.*?)["']?\)/))&&u[1]&&(l=u[1],r.push(Fv(n,l))),(s=a.match(/url\(["']?(.*?)["']?\)/))&&s[1]&&(l=s[1],r.push(Fv(n,l)))),n instanceof HTMLImageElement?r.push(Wv(n,"src")):n instanceof SVGImageElement&&r.push(Wv(n,"href"));return[4,Promise.all(r)];case 1:return c.sent(),[2]}}))}))}function Hv(t,e,n){var r=document.createElement("canvas");r.width=e,r.height=n;var i=r.getContext("2d");return i&&i.drawImage(t,0,0,t.width,t.height,0,0,e,n),r}var Xv,Uv=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.customCssRules="",this.useGlobalRules=!0,e.getSnapshot=function(t,e){return y(n,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshot(t,e)];case 1:return[2,n.sent()]}}))}))},e.getSnapshotBlob=function(t,e){return y(n,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBlob(t,e)];case 1:return[2,n.sent()]}}))}))},e.getSnapshotBase64=function(t,e){return y(n,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBase64(t,e)];case 1:return[2,n.sent()]}}))}))}}return t.prototype.getSvgRootElement=function(t){return t.container.querySelector(".lf-canvas-overlay")},t.prototype.triggerDownload=function(t){var e=new MouseEvent("click",{view:document.defaultView,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",this.fileName),n.setAttribute("href",t),n.setAttribute("target","_blank"),n.dispatchEvent(e)},t.prototype.removeAnchor=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,r=0;r<n;r++){var i=e[r];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-anchor")>-1&&(t.removeChild(t.childNodes[r]),n--,r--)}},t.prototype.removeRotateControl=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,r=0;r<n;r++){var i=e[r];(i.classList&&Array.from(i.classList)||[]).indexOf("lf-rotate-control")>-1&&(t.removeChild(t.childNodes[r]),n--,r--)}},t.prototype.getSnapshot=function(t,e){return y(this,void 0,void 0,(function(){var n,r,i,o,a=this;return m(this,(function(u){switch(u.label){case 0:return n=this.lf.graphModel.getPartial(),r=(null!=e?e:{}).partial,i=void 0===r?n:r,o=this.lf.getEditConfig(),this.lf.updateEditConfig({isSilentMode:!0,stopScrollGraph:!0,stopMoveGraph:!0}),n===i?[3,1]:(this.lf.graphModel.setPartial(i),this.lf.graphModel.eventCenter.once("graph:updated",(function(){return y(a,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,this.snapshot(t,e)];case 1:return r.sent(),this.lf.graphModel.setPartial(n),[2]}}))}))})),[3,3]);case 1:return[4,this.snapshot(t,e)];case 2:u.sent(),u.label=3;case 3:return this.lf.updateEditConfig(o),[2]}}))}))},t.prototype.snapshot=function(t,e){return y(this,void 0,void 0,(function(){var n,r,i,o,a,u,s,l,c,d=this;return m(this,(function(h){switch(h.label){case 0:return r=(n=null!=e?e:{}).fileType,i=void 0===r?"png":r,o=n.quality,this.fileName="".concat(null!=t?t:"logic-flow.".concat(Date.now()),".").concat(i),[4,Gv(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"===i?(u=this.cloneSvg(a),s=(new XMLSerializer).serializeToString(u),l=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(l),this.triggerDownload(c)):this.getCanvasData(a,null!=e?e:{}).then((function(t){var e=t.toDataURL("image/".concat(i),o).replace("image/".concat(i),"image/octet-stream");d.triggerDownload(e)})),[2]}}))}))},t.prototype.getSnapshotBase64=function(t,e){return y(this,void 0,void 0,(function(){var n,r=this;return m(this,(function(i){switch(i.label){case 0:return[4,Gv(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){r.getCanvasData(n,{backgroundColor:t}).then((function(t){var n=t.toDataURL("image/".concat(null!=e?e:"png"));i({data:n,width:t.width,height:t.height})}))}))]}}))}))},t.prototype.getSnapshotBlob=function(t,e){return y(this,void 0,void 0,(function(){var n,r=this;return m(this,(function(i){switch(i.label){case 0:return[4,Gv(n=this.getSvgRootElement(this.lf))];case 1:return i.sent(),[2,new Promise((function(i){r.getCanvasData(n,{backgroundColor:t}).then((function(t){t.toBlob((function(e){i({data:e,width:t.width,height:t.height})}),"image/".concat(null!=e?e:"png"))}))}))]}}))}))},t.prototype.getClassRules=function(){var t="";if(this.useGlobalRules)for(var e=document.styleSheets,n=0;n<e.length;n++){var r=e[n];try{for(var i=0;i<r.cssRules.length;i++)t+=r.cssRules[i].cssText}catch(t){console.log("CSS scripts from different sources have been filtered out")}}return this.customCssRules&&(t+=this.customCssRules),t},t.prototype.getCanvasData=function(t,e){return y(this,void 0,void 0,(function(){var n,r,i,o,a,u,s,l,c,d,h,p,f,v,g,y,b,x,_,w,M,E,N,S,A,P;return m(this,(function(m){return n=e.width,r=e.height,i=e.backgroundColor,o=e.padding,a=void 0===o?40:o,u=this.cloneSvg(t,!1),(s=window.devicePixelRatio||1)<1&&(s=1),l=this.lf.graphModel.rootEl.querySelector(".lf-base"),c=l.getBoundingClientRect(),d=this.lf.container.querySelector(".lf-canvas-overlay"),h=d.getBoundingClientRect(),p=c.x-h.x,f=c.y-h.y,v=this.lf.graphModel,g=v.transformModel,y=g.SCALE_X,b=g.SCALE_Y,x=g.TRANSLATE_X,_=g.TRANSLATE_Y,u.lastChild.style.transform="matrix(1, 0, 0, 1, ".concat((-p+x)*(1/y),", ").concat((-f+_)*(1/b),")"),w=Math.ceil(c.width/y),M=Math.ceil(c.height/b),(E=document.createElement("canvas")).style.width="".concat(w,"px"),E.style.height="".concat(M,"px"),E.width=w*s+2*a,E.height=M*s+2*a,(N=E.getContext("2d"))&&(N.clearRect(0,0,E.width,E.height),N.scale(s,s),i?(N.fillStyle=i,N.fillRect(0,0,E.width,E.height)):N.clearRect(0,0,E.width,E.height)),S=new Image,(A=document.createElement("style")).innerHTML=this.getClassRules(),(P=document.createElement("foreignObject")).appendChild(A),u.appendChild(P),[2,new Promise((function(t){S.onload=function(){var e=navigator.userAgent.indexOf("Firefox")>-1;try{e?createImageBitmap(S,{resizeWidth:n&&r?Hv(E,n,r).width:E.width,resizeHeight:n&&r?Hv(E,n,r).height:E.height}).then((function(e){null==N||N.drawImage(e,a/s,a/s),t(n&&r?Hv(E,n,r):E)})):(null==N||N.drawImage(S,a/s,a/s),t(n&&r?Hv(E,n,r):E))}catch(e){null==N||N.drawImage(S,a/s,a/s),t(n&&r?Hv(E,n,r):E)}};var e="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(u)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");S.src=e}))]}))}))},t.prototype.cloneSvg=function(t,e){var n,r=this;void 0===e&&(e=!0);var i=t.cloneNode(!0),o=i.lastChild,a=null===(n=null==o?void 0:o.childNodes)||void 0===n?void 0:n.length;if(a)for(var u=0;u<a;u++){var s=null==o?void 0:o.childNodes[u],l=s.classList&&Array.from(s.classList);if(l&&l.indexOf("lf-base")<0)null==o||o.removeChild(o.childNodes[u]),a--,u--;else{var c=null==o?void 0:o.childNodes[u];c&&c.childNodes.forEach((function(t){var e=t;r.removeAnchor(e.firstChild),r.removeRotateControl(e.firstChild)}))}}if(e){var d=document.createElement("style");d.innerHTML=this.getClassRules();var h=document.createElement("foreignObject");h.appendChild(d),i.appendChild(h)}return i},t.pluginName="snapshot",t}(),Vv={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},qv={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function Yv(t){switch(t){case"bpmn:sequenceFlow":return Vv.SEQUENCE_FLOW;case"bpmn:startEvent":return Vv.START_EVENT;case"bpmn:endEvent":return Vv.END_EVENT;case"bpmn:userTask":return Vv.USER_TASK;case"bpmn:exclusiveGateway":return Vv.EXCLUSIVE_GATEWAY;default:return t}}!function(t){t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(Xv||(Xv={}));var Zv=function(t,e,n,r){return void 0===r&&(r=0),Jv(t,e,n)<=r};function Kv(t){return t*t}function $v(t,e){return Kv(t.x-e.x)+Kv(t.y-e.y)}var Jv=function(t,e,n){return Math.sqrt(function(t,e,n){var r=$v(e,n);if(0===r)return $v(t,e);var i=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;return i=Math.max(0,Math.min(1,i)),$v(t,{x:e.x+i*(n.x-e.x),y:e.y+i*(n.y-e.y)})}(t,e,n))},Qv=function(t,e,n){var r=function(t){var e=t.x,n=t.y,r=t.width,i=t.height;return{minX:e-r/2,minY:n-i/2,maxX:e+r/2,maxY:n+i/2,x:e,y:n,width:r,height:i,centerX:e,centerY:n}}(t),i=function(t,e){var n;return t.x===e.x?n=Xv.VERTICAL:t.y===e.y&&(n=Xv.HORIZONTAL),n}(e,n),o=Math.max(e.x,n.x),a=Math.min(e.x,n.x),u=Math.max(e.y,n.y),s=Math.min(e.y,n.y),l=t.x,c=t.y,d=t.width,h=t.height;if(i===Xv.HORIZONTAL){if(o>=r.maxX&&a<=r.minX)return{startCrossPoint:{x:e.x>n.x?l+d/2:l-d/2,y:e.y},endCrossPoint:{x:e.x>n.x?l-d/2:l+d/2,y:e.y}}}else if(i===Xv.VERTICAL&&u>=r.maxY&&s<=r.minY)return{startCrossPoint:{x:e.x,y:e.y>n.y?c+h/2:c-h/2},endCrossPoint:{x:e.x,y:e.y>n.y?c-h/2:c+h/2}}},tg=function(t,e,n){void 0===n&&(n=0);for(var r=t.x,i=t.y,o=e.pointsList,a=0;a<o.length-1;a++)if(Zv({x:r,y:i},o[a],o[a+1],n)){var u=Qv(t,o[a],o[a+1]);if(u)return{crossIndex:a+1,crossPoints:u}}return{crossIndex:-1,crossPoints:{startCrossPoint:{x:0,y:0},endCrossPoint:{x:0,y:0}}}},eg=function(){function t(t){var e=t.lf;this._lf=e,this.deviation=20,this.dndAdd=!0,this.dropAdd=!0,this.eventHandler()}return t.prototype.eventHandler=function(){var t=this;this.dndAdd&&this._lf.on("node:dnd-add",(function(e){var n=e.data;t.insetNode(n)})),this.dropAdd&&this._lf.on("node:drop",(function(e){for(var n=e.data,r=t._lf.graphModel.edges,i=n.id,o=!0,a=0;a<r.length;a++)if(r[a].sourceNodeId===i||r[a].targetNodeId===i){o=!1;break}o&&t.insetNode(n)}))},t.prototype.checkRuleBeforeInsetNode=function(t,n,r,i,o){var a=this._lf.getNodeModelById(t),u=this._lf.getNodeModelById(n),s=a.getAnchorInfo(r),l=u.getAnchorInfo(i),c=a.isAllowConnectedAsSource(o,s,l),d=u.isAllowConnectedAsTarget(o,s,l),h=e.formatAnchorConnectValidateData(c),p=h.isAllPass,f=h.msg,v=e.formatAnchorConnectValidateData(d),g=v.isAllPass;return{isPass:p&&g,sourceMsg:f,targetMsg:v.msg}},t.prototype.insetNode=function(t){var n=this,r=this._lf.graphModel.edges,i=this._lf.getNodeModelById(t.id),o=null==i?void 0:i.getDefaultAnchor();if(!o||0===o.length)this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(i)for(var a=0;a<r.length;a++){var u=tg(i,r[a],this.deviation),s=u.crossIndex,l=u.crossPoints;if(s>=0){var c=r[a],d=c.sourceNodeId,h=c.targetNodeId,p=c.id,f=c.type,v=c.pointsList,g=c.sourceAnchorId,y=c.targetAnchorId,m=Ru(v[0]),b=Ru(l.startCrossPoint);this._lf.deleteEdge(p);var w=this.checkRuleBeforeInsetNode(d,h,g,y,t);if(this._lf.addEdge({type:f,sourceNodeId:d,targetNodeId:t.id,startPoint:m,endPoint:b,pointsList:_(_([],x(v.slice(0,s)),!1),[l.startCrossPoint],!1)}),this._lf.addEdge({type:f,sourceNodeId:t.id,targetNodeId:h,startPoint:Ru(l.endCrossPoint),endPoint:Ru(v[v.length-1]),pointsList:_([l.endCrossPoint],x(v.slice(s)),!1)}),w.isPass)break;this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:w.targetMsg||w.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},t.pluginName="insertNodeInPolyline",t}(),ng=function(){function t(t){var e=t.lf,n=this;this.controlItems=[{key:"zoom-out",iconClass:"lf-control-zoomOut",title:"缩小流程图",text:"缩小",onClick:function(){n.lf.zoom(!1)}},{key:"zoom-in",iconClass:"lf-control-zoomIn",title:"放大流程图",text:"放大",onClick:function(){n.lf.zoom(!0)}},{key:"reset",iconClass:"lf-control-fit",title:"恢复流程原有尺寸",text:"适应",onClick:function(){n.lf.resetZoom()}},{key:"undo",iconClass:"lf-control-undo",title:"回到上一步",text:"上一步",onClick:function(){n.lf.undo()}},{key:"redo",iconClass:"lf-control-redo",title:"移到下一步",text:"下一步",onClick:function(){n.lf.redo()}}],this.lf=e}return t.prototype.render=function(t,e){this.destroy();var n=this.getControlTool();this.toolEl=n,e.appendChild(n),this.domContainer=e},t.prototype.destroy=function(){this.domContainer&&this.toolEl&&this.domContainer.contains(this.toolEl)&&this.domContainer.removeChild(this.toolEl)},t.prototype.addItem=function(t){this.controlItems.push(t)},t.prototype.removeItem=function(t){var e=this.controlItems.findIndex((function(e){return e.key===t}));return-1==e?null:this.controlItems.splice(e,1)[0]},t.prototype.getControlTool=function(){var t=this,e="lf-control-item",n="lf-control-item disabled",r=document.createElement("div"),i=[];return r.className="lf-control",this.controlItems.forEach((function(r){var o=document.createElement("div"),a=document.createElement("i"),u=document.createElement("span");switch(o.className=n,r.onClick&&(o.onclick=r.onClick.bind(null,t.lf)),r.onMouseEnter&&(o.onmouseenter=r.onMouseEnter.bind(null,t.lf)),r.onMouseLeave&&(o.onmouseleave=r.onMouseLeave.bind(null,t.lf)),a.className=r.iconClass,u.className="lf-control-text",u.title=r.title,u.innerText=r.text,o.append(a,u),r.text){case"上一步":t.lf.on("history:change",(function(t){var r=t.data.undoAble;o.className=r?e:n}));break;case"下一步":t.lf.on("history:change",(function(t){var r=t.data.redoAble;o.className=r?e:n}));break;default:o.className=e}i.push(o)})),r.append.apply(r,_([],x(i),!1)),r},t.pluginName="control",t}(),rg="lf:defaultNodeMenu",ig="lf:defaultEdgeMenu",og="lf:defaultGraphMenu",ag="lf:defaultSelectionMenu",ug=function(){function t(t){var e=t.lf,n=this;this.__currentData=null,this.lf=e,e.options.isSilentMode||(this.__menuDOM=document.createElement("ul"),this.menuTypeMap=new Map,this.init(),this.lf.setMenuConfig=function(t){n.setMenuConfig(t)},this.lf.addMenuConfig=function(t){n.addMenuConfig(t)},this.lf.setMenuByType=function(t){n.setMenuByType(t)})}return t.prototype.init=function(){var t,e,n,r,i=this,o=[{text:"删除",callback:function(t){i.lf.deleteNode(t.id)}},{text:"编辑文本",callback:function(t){i.lf.graphModel.editText(t.id)}},{text:"复制",callback:function(t){i.lf.cloneNode(t.id)}}];null===(t=this.menuTypeMap)||void 0===t||t.set(rg,o);var a=[{text:"删除",callback:function(t){i.lf.deleteEdge(t.id)}},{text:"编辑文本",callback:function(t){i.lf.graphModel.editText(t.id)}}];null===(e=this.menuTypeMap)||void 0===e||e.set(ig,a),null===(n=this.menuTypeMap)||void 0===n||n.set(og,[]);var u=[{text:"删除",callback:function(t){i.lf.clearSelectElements(),t.edges.forEach((function(t){return i.lf.deleteEdge(t.id)})),t.nodes.forEach((function(t){return i.lf.deleteNode(t.id)}))}}];null===(r=this.menuTypeMap)||void 0===r||r.set(ag,u)},t.prototype.render=function(t,e){var n=this;t.options.isSilentMode||(this.__container=e,this.__currentData=null,this.__menuDOM&&(this.__menuDOM.className="lf-menu",e.appendChild(this.__menuDOM),this.__menuDOM.addEventListener("click",(function(t){t.stopPropagation();for(var e=t.target;-1===Array.from(e.classList).indexOf("lf-menu-item")&&-1===Array.from(e.classList).indexOf("lf-menu");)e=null==e?void 0:e.parentElement;Array.from(e.classList).indexOf("lf-menu-item")>-1?(e.onclickCallback(n.__currentData),n.__menuDOM&&(n.__menuDOM.style.display="none"),n.__currentData=null):console.warn("点击区域不在菜单项内,请检查代码!")}),!0)),this.lf.on("node:contextmenu",(function(t){var e,r,i=t.data,o=t.position,a=t.e,u=o.domOverlayPosition,s=u.x,l=u.y,c=i.id,d=n.lf.graphModel.getNodeModelById(c);if(d){var h=[],p=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(d.type);h=d&&d.menu&&Array.isArray(d.menu)?d.menu:p||(null===(r=n.menuTypeMap)||void 0===r?void 0:r.get(rg)),n.__currentData=i,n.showMenu(s,l,h,{width:d.width,height:d.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(t){var e,r,i,o=t.data,a=t.position,u=t.e,s=a.domOverlayPosition,l=s.x,c=s.y,d=o.id,h=n.lf.graphModel.getEdgeModelById(d);if(h){var p=[],f=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(h.type);p=h&&h.menu&&Array.isArray(h.menu)?h.menu:f||(null!==(i=null===(r=n.menuTypeMap)||void 0===r?void 0:r.get(ig))&&void 0!==i?i:[]),n.__currentData=o,n.showMenu(l,c,p,{width:h.width,height:h.height,clientX:u.clientX,clientY:u.clientY})}})),this.lf.on("blank:contextmenu",(function(t){var e,r,i=t.position,o=null!==(r=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(og))&&void 0!==r?r:[],a=i.domOverlayPosition,u=a.x,s=a.y;n.showMenu(u,s,o)})),this.lf.on("selection:contextmenu",(function(t){var e,r=t.data,i=t.position,o=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(ag),a=i.domOverlayPosition,u=a.x,s=a.y;n.__currentData=r,n.showMenu(u,s,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"})))},t.prototype.destroy=function(){var t;this.__menuDOM&&(null===(t=null==this?void 0:this.__container)||void 0===t||t.removeChild(this.__menuDOM),this.__menuDOM=void 0)},t.prototype.showMenu=function(t,e,n,r){if(n&&n.length){var i=this.__menuDOM;if(i){if(i.innerHTML="",i.append.apply(i,_([],x(this.__getMenuDom(n)),!1)),!i.children.length)return;if(i.style.display="block",!r)return i.style.top="".concat(e,"px"),void(i.style.left="".concat(t,"px"));var o=r.width,a=r.height,u=r.clientX,s=r.clientY,l=this.lf.graphModel,c=i.offsetWidth,d=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,p=h-u,f=l.rootEl.getBoundingClientRect(),v=f.left+f.width;v<h&&(p=v-u),p<c&&(d=!1),i.style.left="".concat(d?t:t-o,"px");var g=i.offsetHeight,y=!0,m=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=m-s,w=f.top+f.height;w<m&&(b=w-s),b<g&&(y=!1),i.style.top="".concat(y?e:e-a,"px")}}},t.prototype.setMenuByType=function(t){var e;t.type&&t.menu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(t.type,t.menu))},t.prototype.__getMenuDom=function(t){var e=[];return t&&t.length>0&&t.forEach((function(t){var n=document.createElement("li");if(t.className?n.className="lf-menu-item ".concat(t.className):n.className="lf-menu-item",!0===t.icon){var r=document.createElement("span");r.className="lf-menu-item-icon",n.appendChild(r)}var i=document.createElement("span");i.className="lf-menu-item-text",t.text&&(i.innerText=t.text),n.appendChild(i),n.onclickCallback=t.callback,e.push(n)})),e},t.prototype.setMenuConfig=function(t){var e,n,r;t&&(void 0!==t.nodeMenu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(rg,t.nodeMenu?t.nodeMenu:[])),void 0!==t.edgeMenu&&(null===(n=this.menuTypeMap)||void 0===n||n.set(ig,t.edgeMenu?t.edgeMenu:[])),void 0!==t.graphMenu&&(null===(r=this.menuTypeMap)||void 0===r||r.set(og,t.graphMenu?t.graphMenu:[])))},t.prototype.addMenuConfig=function(t){var e,n,r,i,o,a,u,s,l;if(t){if(Array.isArray(t.nodeMenu)){var c=null!==(n=null===(e=this.menuTypeMap)||void 0===e?void 0:e.get(rg))&&void 0!==n?n:[];null===(r=this.menuTypeMap)||void 0===r||r.set(rg,c.concat(t.nodeMenu))}if(Array.isArray(t.edgeMenu)){c=null!==(o=null===(i=this.menuTypeMap)||void 0===i?void 0:i.get(ig))&&void 0!==o?o:[];null===(a=this.menuTypeMap)||void 0===a||a.set(ig,c.concat(t.edgeMenu))}if(Array.isArray(t.graphMenu)){c=null!==(s=null===(u=this.menuTypeMap)||void 0===u?void 0:u.get(og))&&void 0!==s?s:[];null===(l=this.menuTypeMap)||void 0===l||l.set(og,c.concat(t.graphMenu))}}},t.prototype.changeMenuItem=function(t,e){if("add"===t)this.addMenuConfig(e);else{if("reset"!==t)throw new Error("The first parameter of changeMenuConfig should be 'add' or 'reset'");this.setMenuConfig(e)}},t.pluginName="menu",t}(),sg="menu-common",lg=function(){function t(t){var e=t.lf,n=this;this.menuTypeMap=new Map,this.listenDelete=function(){n.hideContextMenu()},this.lf=e,this.__menuDOM=document.createElement("div"),this.__menuDOM.className="lf-inner-context",this.menuTypeMap.set(sg,[]),this.lf.setContextMenuByType=function(t,e){n.setContextMenuByType(t,e)},this.lf.setContextMenuItems=function(t){n.setContextMenuItems(t)},this.lf.showContextMenu=function(t){n.showContextMenu(t)},this.lf.hideContextMenu=function(){n.hideContextMenu()}}return t.prototype.render=function(t,e){var n=this;this.container=e,t.on("node:click",(function(t){var e=t.data;n._activeData=e,n.createContextMenu()})),t.on("edge:click",(function(t){var e=t.data;n._activeData=e,n.createContextMenu()})),t.on("blank:click",(function(){n.hideContextMenu()}))},t.prototype.setContextMenuByType=function(t,e){this.menuTypeMap.set(t,e)},t.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},t.prototype.showContextMenu=function(t){t&&t.id?(this._activeData=t,this.createContextMenu()):console.warn("请检查传入的参数")},t.prototype.setContextMenuItems=function(t){this.menuTypeMap.set(sg,t)},t.prototype.getContextMenuPosition=function(){var t=this._activeData,e=this.lf.graphModel.getElement(t.id);if(e){var n,r;if("edge"===e.BaseType){n=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER;var i=e.getData();n=Math.max(i.startPoint.x,n),r=Math.min(i.startPoint.y,r),n=Math.max(i.endPoint.x,n),r=Math.min(i.endPoint.y,r),i.pointsList&&i.pointsList.forEach((function(t){n=Math.max(t.x,n),r=Math.min(t.y,r)}))}return"node"===e.BaseType&&(n=t.x+e.width/2,r=t.y-e.height/2),this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([n,r])}},t.prototype.createContextMenu=function(){var t=this;if(!this.lf.options.isSilentMode){var e=_(_([],x(this.menuTypeMap.get(this._activeData.type)||[]),!1),x(this.menuTypeMap.get(sg)||[]),!1),n=document.createDocumentFragment();e.forEach((function(e){var r=document.createElement("div");r.className="lf-context-item";var i=document.createElement("img");i.src=e.icon,i.className="lf-context-img",e.className&&(r.className="".concat(r.className," ").concat(e.className)),i.addEventListener("click",(function(){t.hideContextMenu(),e.callback?e.callback(t._activeData):t.addNode({sourceId:t._activeData.id,x:t._activeData.x,y:t._activeData.y,properties:e.properties,type:e.type})})),r.appendChild(i),n.appendChild(r)})),this.__menuDOM.innerHTML="",this.__menuDOM.appendChild(n),this.showMenu()}},t.prototype.addNode=function(t,e){var n=void 0!==e;void 0===e&&(e=t.y);var r=this.lf.getNodeModelById(t.sourceId);if(r){var i=t.x-r.width+200,o=e-t.y/2-20,a=t.x+r.width+200,u=e+t.y/2+20;if(this.lf.getAreaElement([i,o],[a,u]).length)return e+=100,void this.addNode(t,e);if(t.type){var s=this.lf.addNode({type:t.type,x:t.x+200,y:e,properties:t.properties}),l=void 0,c=void 0;n&&(l={x:t.x,y:t.y+r.height/2},c={x:s.x-s.width/2,y:s.y}),this.lf.addEdge({sourceNodeId:t.sourceId,targetNodeId:s.id,startPoint:l,endPoint:c})}}},t.prototype.showMenu=function(){var t=this.getContextMenuPosition();if(t){var e=x(t,2),n=e[0],r=e[1];this.__menuDOM.style.display="flex",this.__menuDOM.style.top="".concat(r,"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}},t.pluginName="contextMenu",t}(),cg=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.lf.setPatternItems=function(t){n.setPatternItems(t)}}return t.prototype.render=function(t,e){var n=this;this.destroy(),this.shapeList&&0!==this.shapeList.length?(this.panelEl=document.createElement("div"),this.panelEl.className="lf-dndpanel",this.shapeList.forEach((function(t){var e;null===(e=n.panelEl)||void 0===e||e.appendChild(n.createDndItem(t))})),e.appendChild(this.panelEl),this.domContainer=e):this.domContainer=e},t.prototype.destroy=function(){this.domContainer&&this.panelEl&&this.domContainer.contains(this.panelEl)&&this.domContainer.removeChild(this.panelEl)},t.prototype.setPatternItems=function(t){this.shapeList=t,this.domContainer&&this.render(this.lf,this.domContainer)},t.prototype.createDndItem=function(t){var e=this,n=document.createElement("div");n.className=t.className?"lf-dnd-item ".concat(t.className):"lf-dnd-item";var r=document.createElement("div");if(r.className="lf-dnd-shape",t.icon&&(r.style.backgroundImage="url(".concat(t.icon,")")),n.appendChild(r),t.label){var i=document.createElement("div");i.innerText=t.label,i.className="lf-dnd-text",n.appendChild(i)}return t.disabled?(n.classList.add("disabled"),n.onmousedown=function(){t.callback&&t.callback(e.lf,e.domContainer)},n):(n.onmousedown=function(){t.type&&e.lf.dnd.startDrag({type:t.type,properties:t.properties,text:t.text}),t.callback&&t.callback(e.lf,e.domContainer)},n.ondblclick=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-dbclick",{e:n,data:t})},n.onclick=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-click",{e:n,data:t})},n.oncontextmenu=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-contextmenu",{e:n,data:t})},n)},t.pluginName="dndPanel",t}(),dg=function(){function t(t){var e=t.lf,n=this;this.disabled=!0,this.isDefaultStopMoveGraph=!1,this.isWholeNode=!0,this.isWholeEdge=!0,this.draw=function(t){var e=n.lf.getPointByClient(t.clientX,t.clientY).domOverlayPosition,r=e.x,i=e.y;if(n.endPoint={x:r,y:i},n.startPoint){var o=n.startPoint,a=o.x,u=o.y,s=a,l=u,c=r-a,d=i-u;r<a&&(s=r,c=a-r),i<u&&(l=i,d=u-i),n.wrapper&&(n.wrapper.style.left="".concat(s,"px"),n.wrapper.style.top="".concat(l,"px"),n.wrapper.style.width="".concat(c,"px"),n.wrapper.style.height="".concat(d,"px"))}},this.drawOff=function(){var t;if(document.removeEventListener("mousemove",n.draw),document.removeEventListener("mouseup",n.drawOff),n.wrapper&&(n.wrapper.oncontextmenu=null,null===(t=n.container)||void 0===t||t.removeChild(n.wrapper)),n.startPoint&&n.endPoint){var e=n.startPoint,r=e.x,i=e.y,o=n.endPoint,a=o.x,u=o.y,s=[Math.min(r,a),Math.min(i,u)],l=[Math.max(r,a),Math.max(i,u)];if(n.lf.emit("selection:selected-area",{topLeft:s,bottomRight:l}),Math.abs(a-r)<10&&Math.abs(u-i)<10)return;var c=n.lf.graphModel.getAreaElement(s,l,n.isWholeEdge,n.isWholeNode,!0),d=n.lf.graphModel.group;c.forEach((function(t){d&&d.getNodeGroup(t.id)||n.lf.selectElementById(t.id,!0)})),n.lf.emit("selection:selected",c)}},this.lf=e;var r=e.getEditConfig().stopMoveGraph;this.isDefaultStopMoveGraph=r,e.openSelectionSelect=function(){n.openSelectionSelect()},e.closeSelectionSelect=function(){n.closeSelectionSelect()}}return t.prototype.render=function(t,e){var n=this;this.container=e,t.on("blank:mousedown",(function(r){var i=r.e;if(t.getEditConfig().stopMoveGraph&&!n.disabled&&!(2===i.button)){var o=t.getPointByClient(i.clientX,i.clientY).domOverlayPosition,a=o.x,u=o.y;n.startPoint={x:a,y:u},n.endPoint={x:a,y:u};var s=document.createElement("div");s.className="lf-selection-select",s.oncontextmenu=function(t){t.preventDefault()},s.style.top="".concat(n.startPoint.y,"px"),s.style.left="".concat(n.startPoint.x,"px"),e.appendChild(s),n.wrapper=s,document.addEventListener("mousemove",n.draw),document.addEventListener("mouseup",n.drawOff)}}))},t.prototype.setSelectionSense=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0),this.isWholeEdge=t,this.isWholeNode=e},t.prototype.openSelectionSelect=function(){this.lf.getEditConfig().stopMoveGraph||(this.isDefaultStopMoveGraph=!1,this.lf.updateEditConfig({stopMoveGraph:!0})),this.open()},t.prototype.closeSelectionSelect=function(){this.isDefaultStopMoveGraph||this.lf.updateEditConfig({stopMoveGraph:!1}),this.close()},t.prototype.open=function(){this.disabled=!1},t.prototype.close=function(){this.disabled=!0},t.pluginName="selectionSelect",t}(),hg=function(){function t(t){var e=t.lf,n=t.LogicFlow,r=t.options,i=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.render=function(t,e){i.container=e,i.lf.on("history:change",(function(){i.isShow&&i.setView()})),i.lf.on("graph:transform",(function(){i.isShow&&i.setView(!1)}))},this.show=function(t,e){i.isShow||(i.createMiniMap(t,e),i.setView()),i.isShow=!0},this.hide=function(){i.isShow&&(i.removeMiniMap(),i.lf.emit("miniMap:close",{})),i.isShow=!1},this.updatePosition=function(t){if("object"==typeof t)void 0===t.left&&void 0===t.right||(i.leftPosition=t.left,i.rightPosition=t.right),void 0===t.top&&void 0===t.bottom||(i.topPosition=t.top,i.bottomPosition=t.bottom);else switch(t){case"left-top":i.leftPosition=0,i.rightPosition=void 0,i.topPosition=0,i.bottomPosition=void 0;break;case"right-top":i.leftPosition=void 0,i.rightPosition=0,i.topPosition=0,i.bottomPosition=void 0;break;case"left-bottom":i.leftPosition=0,i.rightPosition=void 0,i.topPosition=void 0,i.bottomPosition=0;break;case"right-bottom":i.leftPosition=void 0,i.rightPosition=0,i.topPosition=void 0,i.bottomPosition=0}i.updateMiniMapPosition()},this.reset=function(){i.lf.resetTranslate(),i.lf.resetZoom()},this.setShowEdge=function(t){i.showEdge!==t&&(i.showEdge=t,i.setView())},this.startDrag=function(t){document.addEventListener("mousemove",i.drag),document.addEventListener("mouseup",i.drop);var e=t.x,n=t.y;i.startPosition={x:e,y:n}},this.drag=function(t){var e=t.x,n=t.y,r=(e-i.startPosition.x)/i.scale,o=(n-i.startPosition.y)/i.scale,a=i.viewPortLeft+r+i.viewPortWidth/i.scale/2,u=i.viewPortTop+o+i.viewPortHeight/i.scale/2;i.startPosition={x:e,y:n},i.lf.focusOn({coordinate:{x:a,y:u}})},this.drop=function(){document.removeEventListener("mousemove",i.drag),document.removeEventListener("mouseup",i.drop)},this.mapClick=function(t){var e=t.offsetX,n=t.offsetY,r=i.translateX+e/i.scale,o=i.translateY+n/i.scale;i.lf.focusOn({coordinate:{x:r,y:o}})},this.lf=e,this.LFCtor=n,r&&r.MiniMap&&this.setOption(r.MiniMap),this.viewPortWidth=e.graphModel.width,this.viewPortHeight=e.graphModel.height;var o={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=o,this.elementAreaBounds=o,this.viewPortBounds=o,this.initMiniMap()}return t.prototype.setOption=function(t){var e=t.width,n=void 0===e?150:e,r=t.height,i=void 0===r?220:r,o=t.showEdge,a=void 0!==o&&o,u=t.isShowHeader,s=void 0!==u&&u,l=t.isShowCloseIcon,c=void 0!==l&&l,d=t.leftPosition,h=t.topPosition,p=t.rightPosition,f=void 0===p?0:p,v=t.bottomPosition,g=void 0===v?0:v,y=t.headerTitle,m=void 0===y?"导航":y;this.width=n,this.height=i,this.showEdge=a,this.isShowHeader=s,this.isShowCloseIcon=c,this.leftPosition=d,this.rightPosition=void 0!==d?void 0:f,this.topPosition=h,this.bottomPosition=void 0!==h?void 0:g,this.headerTitle=m},t.prototype.initMiniMap=function(){var t=document.createElement("div");t.className="lf-mini-map-graph",t.style.width="".concat(this.width,"px"),t.style.height="".concat(this.height,"px"),this.lfMap=new this.LFCtor({container:t,grid:!1,isSilentMode:!0,stopZoomGraph:!0,stopScrollGraph:!0,stopMoveGraph:!1,history:!1,snapline:!1,disabledPlugins:this.disabledPlugins}),this.miniMapWrap=t,this.createViewPort(),t.addEventListener("click",this.mapClick)},t.prototype.createMiniMap=function(t,e){var n,r=document.createElement("div");this.miniMapContainer=r,r.appendChild(this.miniMapWrap),r.style.position="absolute",void 0===t&&void 0===e||(this.leftPosition=t||0,this.topPosition=e||0,this.rightPosition=void 0,this.bottomPosition=void 0),this.updateMiniMapPosition(),r.className="lf-mini-map",this.isShowCloseIcon||r.classList.add("lf-mini-map-no-close-icon"),this.isShowHeader||r.classList.add("lf-mini-map-no-header"),null===(n=this.container)||void 0===n||n.appendChild(r),this.miniMapWrap.appendChild(this.viewport);var i=document.createElement("div");i.className="lf-mini-map-header",i.innerText=this.headerTitle,r.appendChild(i);var o=document.createElement("span");o.className="lf-mini-map-close",o.addEventListener("click",this.hide),r.appendChild(o)},t.prototype.updateMiniMapPosition=function(){if(this.miniMapContainer){var t=this.miniMapContainer.style;void 0!==this.rightPosition?(t.right="".concat(this.rightPosition,"px"),t.left=""):(t.left="".concat(this.leftPosition,"px"),t.right=""),void 0!==this.bottomPosition?(t.bottom="".concat(this.bottomPosition,"px"),t.top=""):(t.top="".concat(this.topPosition,"px"),t.bottom="")}},t.prototype.removeMiniMap=function(){var t;this.miniMapContainer&&(null===(t=this.container)||void 0===t||t.removeChild(this.miniMapContainer))},t.prototype.updateBounds=function(t){t&&this.updateElementAreaBounds(t),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)}},t.prototype.updateElementAreaBounds=function(t){var e={left:0,right:0,top:0,bottom:0},n=t.nodes;n&&n.length>0&&n.forEach((function(t){var n,r,i=t.x,o=t.y,a=null!==(n=t.width)&&void 0!==n?n:200,u=null!==(r=t.height)&&void 0!==r?r:200,s=i-a/2,l=i+a/2,c=o-u/2,d=o+u/2;e.left=Math.min(s,e.left),e.right=Math.max(l,e.right),e.top=Math.min(c,e.top),e.bottom=Math.max(d,e.bottom)})),this.elementAreaBounds=e},t.prototype.updateViewPortBounds=function(){var t=this.lf.getTransform(),e=t.TRANSLATE_X,n=t.TRANSLATE_Y,r=t.SCALE_X,i=t.SCALE_Y,o=this.lf.graphModel,a=o.width,u=o.height;this.viewPortBounds={left:-e/r,right:(-e+a)/r,top:-n/i,bottom:(-n+u)/i}},t.prototype.resetData=function(t){var e=t.nodes,n=t.edges;return e.forEach((function(t){t.text=void 0})),this.showEdge&&n.forEach((function(t){t.text=void 0})),{nodes:e,edges:this.showEdge?n:[]}},t.prototype.setView=function(t){var e,n;if(void 0===t&&(t=!0),t){var r=this.lf.getGraphRawData(),i=this.resetData(r),o=this.lf.viewMap,a=this.lf.graphModel.modelMap,u=this.lfMap.viewMap;try{for(var s=b(o.keys()),l=s.next();!l.done;l=s.next()){var c=l.value;u.has(c)||this.lfMap.register({type:c,view:o.get(c),model:a.get(c)})}}catch(t){e={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}this.lfMap.render(i),this.updateBounds(i)}else this.updateBounds();var d=this.bounds,h=d.left,p=d.top,f=d.right-h,v=d.bottom-p,g=this.width/f,y=this.height/v,m=Math.min(g,y);this.scale=m;var x=h-(this.width/m-f)/2,_=p-(this.height/m-v)/2;if(this.lfMap.graphModel.transformModel.translate(-x+this.translateX,-_+this.translateY),this.translateX=x,this.translateY=_,this.miniMapWrap.firstChild){var w=this.miniMapWrap.firstChild.style;w.pointerEvents="none",w.transform="matrix(".concat(m,", 0, 0, ").concat(m,", 0, 0)"),w.transformOrigin="left top",w.height="".concat(this.height/m,"px"),w.width="".concat(this.width/m,"px"),this.updateViewPort()}},t.prototype.updateViewPort=function(){var t=this.viewport.style,e=this.lf.getTransform(),n=e.TRANSLATE_X,r=e.TRANSLATE_Y,i=e.SCALE_X,o=e.SCALE_Y,a=this.lf.graphModel,u=a.width,s=a.height;this.viewPortLeft=-n/i,this.viewPortTop=-r/o,this.viewPortWidth=u/i*this.scale,this.viewPortHeight=s/o*this.scale,t.width="".concat(this.viewPortWidth,"px"),t.height="".concat(this.viewPortHeight,"px"),t.left="".concat((this.viewPortLeft-this.translateX)*this.scale,"px"),t.top="".concat((this.viewPortTop-this.translateY)*this.scale,"px")},t.prototype.createViewPort=function(){var t=document.createElement("div");t.className="lf-minimap-viewport",t.addEventListener("mousedown",this.startDrag),t.addEventListener("click",(function(t){t.stopPropagation()})),this.viewport=t},t.pluginName="miniMap",t}(),pg={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function fg(t,e,n,r){var i,o="",a="";t[0]===e[0]?o=t[1]>e[1]?"t":"b":t[1]===e[1]&&(o=t[0]>e[0]?"l":"r"),e[0]===n[0]?a=e[1]>n[1]?"t":"b":e[1]===n[1]&&(a=e[0]>n[0]?"l":"r");var u=Math.min(Math.hypot(e[0]-t[0],e[1]-t[1])/2,Math.hypot(n[0]-e[0],n[1]-e[1])/2,r)||.2*r,s="".concat(o).concat(a),l=pg[s]||"-",c="L ".concat(t[0]," ").concat(t[1]);if("-"===l)c+="L ".concat(e[0]," ").concat(e[1]," L ").concat(n[0]," ").concat(n[1]);else{var d=x(function(t,e,n,r){var i=[t[0],t[1]],o=[t[0],t[1]];switch(n){case"tl":return"tr"===e?(i[1]+=r,o[0]+=r):"lb"===e&&(i[0]+=r,o[1]+=r),[i,o];case"tr":return"tl"===e?(i[1]+=r,o[0]-=r):"rb"===e&&(i[0]-=r,o[1]+=r),[i,o];case"bl":return"br"===e?(i[1]-=r,o[0]+=r):"lt"===e&&(i[0]+=r,o[1]-=r),[i,o];case"br":return"bl"===e?(i[1]-=r,o[0]-=r):"rt"===e&&(i[0]-=r,o[1]-=r),[i,o];default:return[]}}(e,s,l,u),2),h=d[0],p=d[1];h&&p&&(c+="L ".concat(h[0]," ").concat(h[1]," Q ").concat(e[0]," ").concat(e[1]," ").concat(p[0]," ").concat(p[1]),i=x(p,2),e[0]=i[0],e[1]=i[1])}return c}function vg(t,e){var n=0,r="";if(2===t.length)r+="M".concat(t[n][0]," ").concat(t[n++][1]," L ").concat(t[n][0]," ").concat(t[n][1]);else{for(r+="M".concat(t[n][0]," ").concat(t[n++][1]);n+1<t.length;){r+=fg(t[n-1],t[n],t[1+n++],e)}r+="L ".concat(t[n][0]," ").concat(t[n][1])}return r}var gg=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getEdge=function(){var t=this.props.model,n=t.points,r=t.isAnimation,i=t.arrowConfig,o=t.radius,a=void 0===o?5:o,u=t.getEdgeStyle(),s=t.getEdgeAnimationStyle(),l=function(t){for(var e=t,n=1;n<e.length-1;){var r=x(e[n-1],2),i=r[0],o=r[1],a=x(e[n],2),u=a[0],s=a[1],l=x(e[n+1],2),c=l[0],d=l[1];i===u&&u===c||o===s&&s===d?e.splice(n,1):n++}return e}(n.split(" ").map((function(t){return t.split(",").map((function(t){return+t}))}))),c=vg(l,a),d=v(v(v({style:r?s:{}},u),i),{fill:"none"});return e.h("path",v({d:c},d))},n}(e.PolylineEdge),yg=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e}(e.PolylineEdgeModel),mg=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return f(n,t),n.prototype.getLabelShape=function(){var t=this.props.model,n=t.id,r=t.x,i=t.y,o=t.width,a=t.height,u=t.properties,s=this.props.model.getNodeStyle();return e.h("svg",{x:r-o/2,y:i-a/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[u.labelText?e.h("text",{x:0,y:-5,fontSize:"16px",fill:s.stroke},u.labelText):"",u.disabledDelete?"":e.h("text",{x:u.labelText?50:0,y:-5,fontSize:"24px",cursor:"pointer",fill:s.stroke,onclick:this.handleCustomDeleteIconClick.bind(this,n)},"x")])},n.prototype.getShape=function(){var t=this.props.model,n=t.x,r=t.y,i=t.width,o=t.height,a=t.id,u=this.props.model.getNodeStyle();return e.h("g",{},[e.h("rect",v(v({},u),{x:n-i/2,y:r-o/2,width:i,height:o,id:a})),this.getLabelShape()])},n.prototype.toFront=function(){},n.prototype.handleCustomDeleteIconClick=function(t){this.props.graphModel.deleteNode(t)},n}(e.PolygonNode),bg=function(t){function e(){var e=t.apply(this,_([],x(arguments),!1))||this;return e.d=10,e}return f(e,t),e.prototype.initNodeData=function(e){e.text={value:"",x:e.x,y:e.y,draggable:!1,editable:!1},t.prototype.initNodeData.call(this,e),this.zIndex=0,this.draggable=!0},e.prototype.setAttributes=function(){var t,e=this;this.points=[],(null===(t=this.properties)||void 0===t?void 0:t.node_selection_ids).length>1&&setTimeout((function(){var t;e.updatePointsByNodes((null===(t=e.properties)||void 0===t?void 0:t.node_selection_ids)||[])}))},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return e.stroke=this.properties.strokeColor||"#008000",e.strokeDasharray="10 5",e},e.prototype.getDefaultAnchor=function(){return[]},e.prototype.updatePoints=function(t){this.points=t},e.prototype.updateCoordinate=function(t){var e=t.x,n=t.y;this.x=e,this.y=n},e.prototype.updatePointsByNodes=function(t){var e=this,n=[],r=1/0,i=1/0,o=-1/0,a=-1/0;t.forEach((function(t){var n=e.graphModel.getNodeModelById(t);if(n){var u=n.width,s=n.height,l=n.x,c=n.y;r=Math.min(r,l-u/2-e.d),i=Math.min(i,c-s/2-e.d),o=Math.max(o,l+u/2+e.d),a=Math.max(a,c+s/2+e.d)}})),n.push([r,i],[o,i],[o,a],[r,a]),[r,i,o,a].some((function(t){return Math.abs(t)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(o+r)/2,y:(a+i)/2}))},e}(e.PolygonNodeModel),xg=function(){function t(t){var e=t.lf;this.selectNodes=[],this.d=10,e.register({type:"node-selection",view:mg,model:bg})}return Object.defineProperty(t.prototype,"selectNodesIds",{get:function(){return this.selectNodes.map((function(t){return t.id}))},enumerable:!1,configurable:!0}),t.prototype.addNodeSelection=function(){this.lf.addNode({type:"node-selection",text:"",properties:{node_selection_ids:this.selectNodesIds}}).updatePointsByNodes(this.selectNodesIds)},t.prototype.updateNodeSelection=function(){var t=this.getNodeSelection();t&&(this.lf.setProperties(t.id,{node_selection_ids:this.selectNodesIds}),this.lf.getNodeModelById(t.id).updatePointsByNodes(this.selectNodesIds))},t.prototype.getNodeSelection=function(){var t=this,e=this.selectNodesIds,n=this.lf.getGraphRawData(),r=e.filter((function(e){return e!==t.currentClickNode.id}));return n.nodes.find((function(t){if("node-selection"===t.type){var e=Di(t,"properties.node_selection_ids",[]);return r.every((function(t){return e.includes(t)}))}return!1}))},t.prototype.render=function(t){var e=this;this.lf=t,t.on("node:click",(function(n){if(n.e.shiftKey&&"node-selection"!==n.data.type){e.currentClickNode=n.data;var r=!1;e.selectNodesIds.includes(n.data.id)&&(e.lf.getNodeModelById(n.data.id).setSelected(!1),r=!0);var i=t.getSelectElements(!0).nodes;e.selectNodes=i,1===e.selectNodes.length?r?e.updateNodeSelection():e.addNodeSelection():e.selectNodes.length>1&&e.updateNodeSelection()}})),t.graphModel.addNodeMoveRules((function(e,n,r){if("node-selection"===e.type){var i=e.properties.node_selection_ids;return t.graphModel.moveNodes(i,n,r,!0),!0}return!0}))},t.pluginName="node-selection",t}(),_g=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.paths=[],e.getPathes=function(){if(!n.startNodeType)throw new Error("需要预先指定开始节点类型");return n.getPathes()},e.setRawPaths=function(t){n.setPathes(t)},e.getRawPathes=function(){return n.paths},e.setStartNodeType=function(t){n.startNodeType=t}}return t.prototype.setPathes=function(t){this.paths=t.map((function(t){return{routeId:t.routeId,name:t.name,elements:t.elements,type:t.type,similarElement:null,weight:0}}))},t.prototype.getPathes=function(){var t=this,e=this.lf.getGraphRawData(),n=new Map,r=[];e.nodes.forEach((function(e){n.set(e.id,{id:e.id,data:e,nextNodes:[]}),e.type===t.startNodeType&&r.push(e.id)})),e.edges.forEach((function(t){var e=n.get(t.sourceNodeId);null==e||e.nextNodes.push(t.targetNodeId)}));var i=[];return r.forEach((function(e){var r=n.get(e);r&&(i=i.concat(t.findPathElements(r,n,[])))})),this.getNewPathes(i)},t.prototype.findPathElements=function(t,e,n){void 0===n&&(n=[]);var r=_([],x(n),!1);if(r.push(t.id),0===t.nextNodes.length)return[r];for(var i=[],o=0;o<t.nextNodes.length;o++){var a=e.get(t.nextNodes[o]),u=void 0;if(a){var s=r.indexOf(a.id);u=-1!==s?[_(_([],x(r.slice(s)),!1),[a.id],!1)]:this.findPathElements(a,e,_([],x(r),!1)),i=i.concat(u)}}return i},t.prototype.getNewPathes=function(t){var e=this,n=[],r=new Set;t.forEach((function(t){console.log("elements",t);var i=e.getNewId("path"),o=e.getNewId("路径"),a=e.isLoopPath(t),u=t.join(",");r.has(u)||(r.add(u),n.push({routeId:i,name:o,elements:t,type:a,weight:0,similarElement:""}))}));var i=JSON.parse(JSON.stringify(this.paths));return n.forEach((function(t){for(var n=0;n<i.length;n++){var r=i[n],o=e.similar2Path(_([],x(t.elements),!1),_([],x(r.elements),!1));o>t.weight&&r.weight<=o&&(t.weight=o,t.similarElement=r,o===r.weight&&r.similarElement?(r.similarElement.similarElement=null,r.similarElement.weight=0,r.similarElement=null,r.weight=0):(r.similarElement=t,r.weight=o))}})),n.forEach((function(t){t.similarElement&&t.similarElement.similarElement===t&&(t.routeId=t.similarElement.routeId,t.name=t.similarElement.name),delete t.similarElement,delete t.weight})),this.setPathes(n),n},t.prototype.similar2Path=function(t,e){var n=0,r=t.length+e.length;t.sort(),e.sort();for(var i=t.shift(),o=e.shift();void 0!==i&&void 0!==o;)i===o?(n++,i=t.shift(),o=e.shift()):i<o?i=t.shift():i>o&&(o=e.shift());return n/r*200},t.prototype.getNewId=function(t){return"".concat(t,"_").concat(E())},t.prototype.isLoopPath=function(t){var e=t.length;return t.indexOf(t[e-1])!==e-1?1:0},t.pluginName="flowPath",t}(),wg=-1,Mg=0,Eg=1,Ng=function(){function t(t){var e=t.lf,n=this;this.levelHeight=[],this.newNodeMap=new Map,this.lf=e,this.trunk=[],e.layout=function(t){var e=n.lf.getGraphRawData();n.lf.setStartNodeType(t);var r=n.lf.getPathes();return n.levelHeight=[],n.newNodeMap=new Map,n.layout(e,r)}}return t.prototype.layout=function(t,e){var n=this,r=[];e.forEach((function(t){var e=t.elements;e.length>r.length?r=e:e.length===r.length&&JSON.stringify(e)===JSON.stringify(n.trunk)&&(r=n.trunk)})),this.trunk=r;for(var i=this.formatData(t),o={nodes:[],edges:[]},a=r.length-1;a>=0;a--)this.setNodePosition(r[a],i,o,a,1);this.lf.graphModel.graphDataToModel(o)},t.prototype.setNodePosition=function(t,e,n,r,i){var o=this,a=e[t],u=a.text,s=a.type,l=a.next,c=a.properties,d=160*r+40,h=120*i,p={id:t,x:d,text:u,y:h,type:s,properties:c};return u&&"object"==typeof u&&(p.text=v(v({},u),{x:d+u.x,y:h+u.y})),this.newNodeMap.set(p.id,{x:p.x,y:p.y,type:s}),n.nodes.push(p),a.isFixed=!0,this.addLevelHeight(r,1),l&&l.length>0&&l.forEach((function(i){if(!e[i.nodeId].isFixed){var a=o.getLevelHeight(r+1);o.addLevelHeight(r,1),o.setNodePosition(i.nodeId,e,n,r+1,a+1)}n.edges.push(v({id:i.edgeId,type:i.edgeType,sourceNodeId:t,targetNodeId:i.nodeId,properties:i.properties,text:i.text},o.getEdgeDataPoints(t,i.nodeId)))})),p},t.prototype.getEdgeDataPoints=function(t,e){var n=this.newNodeMap.get(t),r=this.newNodeMap.get(e),i=this.getShape(t),o=i.width,a=i.height,u=this.getShape(e),s=u.width,l=u.height,c=this.getRelativePosition(n,r),d={x:n.x,y:n.y},h={x:r.x,y:r.y};switch(c){case Mg:d.x=n.x+o/2,h.x=r.x-s/2;break;case wg:d.y=n.y+a/2,h.x=r.x-s/2;break;case Eg:d.x=n.x+o/2,h.y=r.y+l/2}return{startPoint:d,endPoint:h}},t.prototype.getRelativePosition=function(t,e){var n=t.y,r=e.y;return n<r?-1:n===r?0:1},t.prototype.getShape=function(t){var e,n,r=this.lf.getNodeModelById(t);return{height:null!==(e=null==r?void 0:r.height)&&void 0!==e?e:0,width:null!==(n=null==r?void 0:r.width)&&void 0!==n?n:0}},t.prototype.formatData=function(t){var e=t.nodes.reduce((function(t,e){var n=e.type,r=e.properties,i=e.text,o=e.x,a=e.y;return i&&"object"==typeof i&&(i.x=i.x-o,i.y=i.y-a),t[e.id]={type:n,properties:r,text:i,prev:[],next:[]},t}),{});return t.edges.forEach((function(t){var n=t.sourceNodeId,r=t.targetNodeId,i=t.id,o=t.properties,a=t.text,u=a;"object"==typeof a&&(u=a.value),e[n].next.push({edgeId:i,nodeId:r,edgeType:t.type,properties:o,text:u}),e[r].prev.push({edgeId:i,nodeId:n,properties:o,text:u})})),e},t.prototype.addLevelHeight=function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!1);var r=this.levelHeight[t];r||(r={positiveHeight:0,negativeHeight:0},this.levelHeight[t]=r),n?r.negativeHeight-=e:r.positiveHeight+=e},t.prototype.getLevelHeight=function(t,e){void 0===e&&(e=!1);var n=this.levelHeight[t];return n?e?n.negativeHeight:n.positiveHeight:0},t.pluginName="AutoLayout",t}(),Sg=function(t,e){var n=[],r=[],i=function(t,r,o){o&&r.unshift.apply(r,_([],x(e.getEdgeModels({sourceNodeId:t.id,targetNodeId:null==o?void 0:o.id}).map((function(t){return t.id}))),!1)),r.includes(t.id)?n.push(r):(r.unshift(t.id),t.incoming.nodes.length?t.incoming.nodes.forEach((function(e){i(e,r.slice(),t)})):n.push(r))},o=function(t,n,i){i&&n.push.apply(n,_([],x(e.getEdgeModels({sourceNodeId:null==i?void 0:i.id,targetNodeId:t.id}).map((function(t){return t.id}))),!1)),n.includes(t.id)?r.push(n):(n.push(t.id),t.outgoing.nodes.length?t.outgoing.nodes.forEach((function(e){o(e,n.slice(),t)})):r.push(n))};return i(t,[]),o(t,[]),_([],x(new Set(_(_([],x(n.flat()),!1),x(r.flat()),!1))),!1)},Ag=function(){function t(t){var e=t.lf;this.mode="path",this.manual=!1,this.tempStyles={},this.lf=e}return t.prototype.setMode=function(t){this.mode=t},t.prototype.setManual=function(t){this.manual=t},t.prototype.highlightSingle=function(t){var e=this.lf.getModelById(t);"node"===(null==e?void 0:e.BaseType)?e.updateStyles(this.tempStyles[t]):"edge"===(null==e?void 0:e.BaseType)&&(e.updateStyles(this.tempStyles[t]),e.sourceNode.updateStyles(this.tempStyles[e.sourceNode.id]),e.targetNode.updateStyles(this.tempStyles[e.targetNode.id]))},t.prototype.highlightPath=function(t){var e=this,n=function(t,e){var n=e.getModelById(t);return Sg("node"===(null==n?void 0:n.BaseType)?n:null==n?void 0:n.targetNode,e)}(t,this.lf);n.forEach((function(t){var n;null===(n=e.lf.getModelById(t))||void 0===n||n.updateStyles(e.tempStyles[t])}))},t.prototype.highlight=function(t,e){var n=this;(void 0===e&&(e=this.mode),this.manual)||(Object.keys(this.tempStyles).length&&this.restoreHighlight(),Object.values(this.lf.graphModel.modelsMap).forEach((function(t){var e="node"===t.BaseType?t.getNodeStyle():t.getEdgeStyle();n.tempStyles[t.id]=v({},e),t.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),path:this.highlightPath.bind(this)}[e](t))},t.prototype.restoreHighlight=function(){var t=this;Object.keys(this.tempStyles).length&&(Object.values(this.lf.graphModel.modelsMap).forEach((function(e){var n,r=null!==(n=t.tempStyles[e.id])&&void 0!==n?n:{};e.updateStyles(v({},r))})),this.tempStyles={})},t.prototype.render=function(){var t=this;this.lf.on("node:mouseenter",(function(e){var n=e.data;return t.highlight(n.id)})),this.lf.on("edge:mouseenter",(function(e){var n=e.data;return t.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))},t.prototype.destroy=function(){},t.pluginName="highlight",t}();t.AutoLayout=Ng,t.BPMNAdapter=Dv,t.BPMNBaseAdapter=Rv,t.BPMNElements=Zf,t.BoundaryEventFactory=bt,t.BpmnAdapter=lt,t.BpmnElement=H,t.BpmnXmlAdapter=ct,t.ContextMenu=lg,t.Control=ng,t.CurvedEdge=gg,t.CurvedEdgeModel=yg,t.DiamondResize=kf,t.DiamondResizeModel=Pf,t.DiamondResizeView=Tf,t.DndPanel=cg,t.EllipseResize=Af,t.EllipseResizeModel=Nf,t.EllipseResizeView=Sf,t.EndEventFactory=gt,t.EndEventModel=P,t.EndEventView=T,t.ExclusiveGatewayModel=j,t.ExclusiveGatewayView=R,t.FlowPath=_g,t.GatewayNodeFactory=Ot,t.Group=Gf,t.GroupNode=zf,t.GroupNodeModel=Bf,t.Highlight=Ag,t.HtmlResize=If,t.HtmlResizeModel=Cf,t.HtmlResizeView=Of,t.InsertNodeInPolyline=eg,t.IntermediateCatchEventFactory=yt,t.IntermediateThrowEventFactory=xt,t.Menu=ug,t.MiniMap=hg,t.NodeResize=Lf,t.NodeSelection=xg,t.RectResize=Df,t.RectResizeModel=jf,t.RectResizeView=Rf,t.SelectionSelect=dg,t.SequenceFlowModel=C,t.SequenceFlowView=O,t.ServiceTaskModel=L,t.ServiceTaskView=B,t.Snapshot=Uv,t.StartEventFactory=mt,t.StartEventModel=N,t.StartEventView=S,t.SubProcessFactory=Hf,t.TaskNodeFactory=jt,t.UserTaskModel=W,t.UserTaskView=F,t.bpmnUtils=vt,t.convertNormalToXml=Pv,t.convertXmlToNormal=Tv,t.gateway={exclusive:0,inclusive:1,parallel:2},t.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],t.getCurvedEdgePath=vg,t.handleAttributes=Y,t.icons=Ct,t.lfJson2Xml=$,t.lfXml2Json=tt,t.multiInstanceIcon=It,t.sequenceFlowFactory=Uf,t.toLogicflowData=function(t){var e={nodes:[],edges:[]},n=t.flowElementList;return n&&n.length>0&&n.forEach((function(t){if(t.type===Vv.SEQUENCE_FLOW){var n=function(t){var e=t.incoming,n=t.outgoing,r=t.properties,i=t.key,o=t.type,a=r.text,u=r.name,s=r.startPoint,l=r.endPoint,c=r.pointsList,d={id:i,type:qv[o],sourceNodeId:e[0],targetNodeId:n[0],text:a||u,properties:{}};s&&(d.startPoint=JSON.parse(s)),l&&(d.endPoint=JSON.parse(l)),c&&(d.pointsList=JSON.parse(c));var h=["startPoint","endPoint","pointsList","text"];return Object.keys(t.properties).forEach((function(e){-1===h.indexOf(e)&&(d.properties[e]=t.properties[e])})),d}(t);e.edges.push(n)}else{var r=function(t){var e=t.properties,n=t.key,r=t.type,i=t.bounds,o=e.x,a=e.y,u=e.text;if(void 0===o){var s=x(i,2),l=s[0],c=l.x,d=l.y,h=s[1];o=(c+h.x)/2,a=(d+h.y)/2}var p={id:n,type:qv[r],x:o,y:a,text:u,properties:{}},f=["x","y","text"];return Object.keys(t.properties).forEach((function(e){-1===f.indexOf(e)&&(p.properties[e]=t.properties[e])})),p}(t);e.nodes.push(r)}})),e},t.toNormalJson=it,t.toTurboData=function(t){var e=new Map,n={flowElementList:[]};return t.nodes.forEach((function(t){var r=function(t){var e=t.id,n=t.type,r=t.x,i=t.y,o=t.text,a=void 0===o?"":o,u=t.properties;return{incoming:[],outgoing:[],dockers:[],type:Yv(n),properties:v(v({},u),{name:a&&a.value||"",x:r,y:i,text:a}),key:e}}(t);n.flowElementList.push(r),e.set(t.id,r)})),t.edges.forEach((function(t){var r=function(t){var e=t.id,n=t.type,r=t.sourceNodeId,i=t.targetNodeId,o=t.startPoint,a=t.endPoint,u=t.pointsList,s=t.text,l=void 0===s?"":s,c=t.properties;return{incoming:[r],outgoing:[i],type:Yv(n),dockers:[],properties:v(v({},c),{name:l&&l.value||"",text:l,startPoint:JSON.stringify(o),endPoint:JSON.stringify(a),pointsList:JSON.stringify(u)}),key:e}}(t);e.get(t.sourceNodeId).outgoing.push(r.key),e.get(t.targetNodeId).incoming.push(r.key),n.flowElementList.push(r)})),n},t.toXmlJson=rt,t.useDefinition=Yf}));
|
|
11
|
+
var fp,pp,gp=4294967295,vp=Array.prototype,mp=Object.prototype.hasOwnProperty,yp=Ft?Ft.iterator:void 0,bp=Math.max,xp=Math.min,wp=function(t){return function(e,n,i){if(null==i){var o=he(n),r=o&&ro(n),a=r&&r.length&&ec(n,r);(a?a.length:o)||(i=n,n=e,e=this)}return t(e,n,i)}}(fd);fn.after=tp.after,fn.ary=tp.ary,fn.assign=ap.assign,fn.assignIn=ap.assignIn,fn.assignInWith=ap.assignInWith,fn.assignWith=ap.assignWith,fn.at=ap.at,fn.before=tp.before,fn.bind=tp.bind,fn.bindAll=up.bindAll,fn.bindKey=tp.bindKey,fn.castArray=ep.castArray,fn.chain=sp.chain,fn.chunk=Zf.chunk,fn.compact=Zf.compact,fn.concat=Zf.concat,fn.cond=up.cond,fn.conforms=up.conforms,fn.constant=up.constant,fn.countBy=Jf.countBy,fn.create=ap.create,fn.curry=tp.curry,fn.curryRight=tp.curryRight,fn.debounce=tp.debounce,fn.defaults=ap.defaults,fn.defaultsDeep=ap.defaultsDeep,fn.defer=tp.defer,fn.delay=tp.delay,fn.difference=Zf.difference,fn.differenceBy=Zf.differenceBy,fn.differenceWith=Zf.differenceWith,fn.drop=Zf.drop,fn.dropRight=Zf.dropRight,fn.dropRightWhile=Zf.dropRightWhile,fn.dropWhile=Zf.dropWhile,fn.fill=Zf.fill,fn.filter=Jf.filter,fn.flatMap=Jf.flatMap,fn.flatMapDeep=Jf.flatMapDeep,fn.flatMapDepth=Jf.flatMapDepth,fn.flatten=Zf.flatten,fn.flattenDeep=Zf.flattenDeep,fn.flattenDepth=Zf.flattenDepth,fn.flip=tp.flip,fn.flow=up.flow,fn.flowRight=up.flowRight,fn.fromPairs=Zf.fromPairs,fn.functions=ap.functions,fn.functionsIn=ap.functionsIn,fn.groupBy=Jf.groupBy,fn.initial=Zf.initial,fn.intersection=Zf.intersection,fn.intersectionBy=Zf.intersectionBy,fn.intersectionWith=Zf.intersectionWith,fn.invert=ap.invert,fn.invertBy=ap.invertBy,fn.invokeMap=Jf.invokeMap,fn.iteratee=up.iteratee,fn.keyBy=Jf.keyBy,fn.keys=ro,fn.keysIn=ap.keysIn,fn.map=Jf.map,fn.mapKeys=ap.mapKeys,fn.mapValues=ap.mapValues,fn.matches=up.matches,fn.matchesProperty=up.matchesProperty,fn.memoize=tp.memoize,fn.merge=ap.merge,fn.mergeWith=ap.mergeWith,fn.method=up.method,fn.methodOf=up.methodOf,fn.mixin=wp,fn.negate=vd,fn.nthArg=up.nthArg,fn.omit=ap.omit,fn.omitBy=ap.omitBy,fn.once=tp.once,fn.orderBy=Jf.orderBy,fn.over=up.over,fn.overArgs=tp.overArgs,fn.overEvery=up.overEvery,fn.overSome=up.overSome,fn.partial=tp.partial,fn.partialRight=tp.partialRight,fn.partition=Jf.partition,fn.pick=ap.pick,fn.pickBy=ap.pickBy,fn.property=up.property,fn.propertyOf=up.propertyOf,fn.pull=Zf.pull,fn.pullAll=Zf.pullAll,fn.pullAllBy=Zf.pullAllBy,fn.pullAllWith=Zf.pullAllWith,fn.pullAt=Zf.pullAt,fn.range=up.range,fn.rangeRight=up.rangeRight,fn.rearg=tp.rearg,fn.reject=Jf.reject,fn.remove=Zf.remove,fn.rest=tp.rest,fn.reverse=Zf.reverse,fn.sampleSize=Jf.sampleSize,fn.set=ap.set,fn.setWith=ap.setWith,fn.shuffle=Jf.shuffle,fn.slice=Zf.slice,fn.sortBy=Jf.sortBy,fn.sortedUniq=Zf.sortedUniq,fn.sortedUniqBy=Zf.sortedUniqBy,fn.split=lp.split,fn.spread=tp.spread,fn.tail=Zf.tail,fn.take=Zf.take,fn.takeRight=Zf.takeRight,fn.takeRightWhile=Zf.takeRightWhile,fn.takeWhile=Zf.takeWhile,fn.tap=sp.tap,fn.throttle=tp.throttle,fn.thru=mf,fn.toArray=ep.toArray,fn.toPairs=ap.toPairs,fn.toPairsIn=ap.toPairsIn,fn.toPath=up.toPath,fn.toPlainObject=ep.toPlainObject,fn.transform=ap.transform,fn.unary=tp.unary,fn.union=Zf.union,fn.unionBy=Zf.unionBy,fn.unionWith=Zf.unionWith,fn.uniq=Zf.uniq,fn.uniqBy=Zf.uniqBy,fn.uniqWith=Zf.uniqWith,fn.unset=ap.unset,fn.unzip=Zf.unzip,fn.unzipWith=Zf.unzipWith,fn.update=ap.update,fn.updateWith=ap.updateWith,fn.values=ap.values,fn.valuesIn=ap.valuesIn,fn.without=Zf.without,fn.words=lp.words,fn.wrap=tp.wrap,fn.xor=Zf.xor,fn.xorBy=Zf.xorBy,fn.xorWith=Zf.xorWith,fn.zip=Zf.zip,fn.zipObject=Zf.zipObject,fn.zipObjectDeep=Zf.zipObjectDeep,fn.zipWith=Zf.zipWith,fn.entries=ap.toPairs,fn.entriesIn=ap.toPairsIn,fn.extend=ap.assignIn,fn.extendWith=ap.assignInWith,wp(fn,fn),fn.add=np.add,fn.attempt=up.attempt,fn.camelCase=lp.camelCase,fn.capitalize=lp.capitalize,fn.ceil=np.ceil,fn.clamp=ip,fn.clone=ep.clone,fn.cloneDeep=ep.cloneDeep,fn.cloneDeepWith=ep.cloneDeepWith,fn.cloneWith=ep.cloneWith,fn.conformsTo=ep.conformsTo,fn.deburr=lp.deburr,fn.defaultTo=up.defaultTo,fn.divide=np.divide,fn.endsWith=lp.endsWith,fn.eq=ep.eq,fn.escape=lp.escape,fn.escapeRegExp=lp.escapeRegExp,fn.every=Jf.every,fn.find=Jf.find,fn.findIndex=Zf.findIndex,fn.findKey=ap.findKey,fn.findLast=Jf.findLast,fn.findLastIndex=Zf.findLastIndex,fn.findLastKey=ap.findLastKey,fn.floor=np.floor,fn.forEach=Jf.forEach,fn.forEachRight=Jf.forEachRight,fn.forIn=ap.forIn,fn.forInRight=ap.forInRight,fn.forOwn=ap.forOwn,fn.forOwnRight=ap.forOwnRight,fn.get=ap.get,fn.gt=ep.gt,fn.gte=ep.gte,fn.has=ap.has,fn.hasIn=ap.hasIn,fn.head=Zf.head,fn.identity=Ce,fn.includes=Jf.includes,fn.indexOf=Zf.indexOf,fn.inRange=op,fn.invoke=ap.invoke,fn.isArguments=ep.isArguments,fn.isArray=ee,fn.isArrayBuffer=ep.isArrayBuffer,fn.isArrayLike=ep.isArrayLike,fn.isArrayLikeObject=ep.isArrayLikeObject,fn.isBoolean=ep.isBoolean,fn.isBuffer=ep.isBuffer,fn.isDate=ep.isDate,fn.isElement=ep.isElement,fn.isEmpty=ep.isEmpty,fn.isEqual=ep.isEqual,fn.isEqualWith=ep.isEqualWith,fn.isError=ep.isError,fn.isFinite=ep.isFinite,fn.isFunction=ep.isFunction,fn.isInteger=ep.isInteger,fn.isLength=ep.isLength,fn.isMap=ep.isMap,fn.isMatch=ep.isMatch,fn.isMatchWith=ep.isMatchWith,fn.isNaN=ep.isNaN,fn.isNative=ep.isNative,fn.isNil=ep.isNil,fn.isNull=ep.isNull,fn.isNumber=ep.isNumber,fn.isObject=he,fn.isObjectLike=ep.isObjectLike,fn.isPlainObject=ep.isPlainObject,fn.isRegExp=ep.isRegExp,fn.isSafeInteger=ep.isSafeInteger,fn.isSet=ep.isSet,fn.isString=ep.isString,fn.isSymbol=ep.isSymbol,fn.isTypedArray=ep.isTypedArray,fn.isUndefined=ep.isUndefined,fn.isWeakMap=ep.isWeakMap,fn.isWeakSet=ep.isWeakSet,fn.join=Zf.join,fn.kebabCase=lp.kebabCase,fn.last=fu,fn.lastIndexOf=Zf.lastIndexOf,fn.lowerCase=lp.lowerCase,fn.lowerFirst=lp.lowerFirst,fn.lt=ep.lt,fn.lte=ep.lte,fn.max=np.max,fn.maxBy=np.maxBy,fn.mean=np.mean,fn.meanBy=np.meanBy,fn.min=np.min,fn.minBy=np.minBy,fn.stubArray=up.stubArray,fn.stubFalse=up.stubFalse,fn.stubObject=up.stubObject,fn.stubString=up.stubString,fn.stubTrue=up.stubTrue,fn.multiply=np.multiply,fn.nth=Zf.nth,fn.noop=up.noop,fn.now=Qf,fn.pad=lp.pad,fn.padEnd=lp.padEnd,fn.padStart=lp.padStart,fn.parseInt=lp.parseInt,fn.random=rp,fn.reduce=Jf.reduce,fn.reduceRight=Jf.reduceRight,fn.repeat=lp.repeat,fn.replace=lp.replace,fn.result=ap.result,fn.round=np.round,fn.sample=Jf.sample,fn.size=Jf.size,fn.snakeCase=lp.snakeCase,fn.some=Jf.some,fn.sortedIndex=Zf.sortedIndex,fn.sortedIndexBy=Zf.sortedIndexBy,fn.sortedIndexOf=Zf.sortedIndexOf,fn.sortedLastIndex=Zf.sortedLastIndex,fn.sortedLastIndexBy=Zf.sortedLastIndexBy,fn.sortedLastIndexOf=Zf.sortedLastIndexOf,fn.startCase=lp.startCase,fn.startsWith=lp.startsWith,fn.subtract=np.subtract,fn.sum=np.sum,fn.sumBy=np.sumBy,fn.template=lp.template,fn.times=up.times,fn.toFinite=ep.toFinite,fn.toInteger=Ee,fn.toLength=ep.toLength,fn.toLower=lp.toLower,fn.toNumber=ep.toNumber,fn.toSafeInteger=ep.toSafeInteger,fn.toString=ep.toString,fn.toUpper=lp.toUpper,fn.trim=lp.trim,fn.trimEnd=lp.trimEnd,fn.trimStart=lp.trimStart,fn.truncate=lp.truncate,fn.unescape=lp.unescape,fn.uniqueId=up.uniqueId,fn.upperCase=lp.upperCase,fn.upperFirst=lp.upperFirst,fn.each=Jf.forEach,fn.eachRight=Jf.forEachRight,fn.first=Zf.head,wp(fn,(fp={},Ll(fn,(function(t,e){mp.call(fn.prototype,e)||(fp[e]=t)})),fp),{chain:!1}),fn.VERSION="4.17.21",(fn.templateSettings=lp.templateSettings).imports._=fn,Nn(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){fn[t].placeholder=fn})),Nn(["drop","take"],(function(t,e){nn.prototype[t]=function(n){n=void 0===n?1:bp(Ee(n),0);var i=this.__filtered__&&!e?new nn(this):this.clone();return i.__filtered__?i.__takeCount__=xp(n,i.__takeCount__):i.__views__.push({size:xp(n,gp),type:t+(i.__dir__<0?"Right":"")}),i},nn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Nn(["filter","map","takeWhile"],(function(t,e){var n=e+1,i=1==n||3==n;nn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Al(t),type:n}),e.__filtered__=e.__filtered__||i,e}})),Nn(["head","last"],(function(t,e){var n="take"+(e?"Right":"");nn.prototype[t]=function(){return this[n](1).value()[0]}})),Nn(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");nn.prototype[t]=function(){return this.__filtered__?new nn(this):this[n](1)}})),nn.prototype.compact=function(){return this.filter(Ce)},nn.prototype.find=function(t){return this.filter(t).head()},nn.prototype.findLast=function(t){return this.reverse().find(t)},nn.prototype.invokeMap=Si((function(t,e){return"function"==typeof t?new nn(this):this.map((function(n){return Pc(n,t,e)}))})),nn.prototype.reject=function(t){return this.filter(vd(Al(t)))},nn.prototype.slice=function(t,e){t=Ee(t);var n=this;return n.__filtered__&&(t>0||e<0)?new nn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=Ee(e))<0?n.dropRight(-e):n.take(e-t)),n)},nn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},nn.prototype.toArray=function(){return this.take(gp)},Ll(nn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=fn[i?"take"+("last"==e?"Right":""):e],r=i||/^find/.test(e);o&&(fn.prototype[e]=function(){var e=this.__wrapped__,a=i?[1]:arguments,s=e instanceof nn,l=a[0],u=s||ee(e),c=function(t){var e=o.apply(fn,Ho([t],a));return i&&d?e[0]:e};u&&n&&"function"==typeof l&&1!=l.length&&(s=u=!1);var d=this.__chain__,h=!!this.__actions__.length,f=r&&!d,p=s&&!h;if(!r&&u){e=p?e:new nn(this);var g=t.apply(e,a);return g.__actions__.push({func:mf,args:[c],thisArg:void 0}),new un(g,d)}return f&&p?t.apply(this,a):(g=this.thru(c),f?i?g.value()[0]:g.value():g)})})),Nn(["pop","push","shift","sort","splice","unshift"],(function(t){var e=vp[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);fn.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var o=this.value();return e.apply(ee(o)?o:[],t)}return this[n]((function(n){return e.apply(ee(n)?n:[],t)}))}})),Ll(nn.prototype,(function(t,e){var n=fn[e];if(n){var i=n.name+"";mp.call(an,i)||(an[i]=[]),an[i].push({name:e,func:n})}})),an[Jn(void 0,2).name]=[{name:"wrapper",func:void 0}],nn.prototype.clone=function(){var t=new nn(this.__wrapped__);return t.__actions__=cn(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=cn(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=cn(this.__views__),t},nn.prototype.reverse=function(){if(this.__filtered__){var t=new nn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},nn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=ee(t),i=e<0,o=n?t.length:0,r=function(t,e,n){for(var i=-1,o=n.length;++i<o;){var r=n[i],a=r.size;switch(r.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=dp(e,t+a);break;case"takeRight":t=cp(t,e-a)}}return{start:t,end:e}}(0,o,this.__views__),a=r.start,s=r.end,l=s-a,u=i?s:a-1,c=this.__iteratees__,d=c.length,h=0,f=hp(l,this.__takeCount__);if(!n||!i&&o==l&&f==l)return xf(t,this.__actions__);var p=[];t:for(;l--&&h<f;){for(var g=-1,v=t[u+=e];++g<d;){var m=c[g],y=m.iteratee,b=m.type,x=y(v);if(2==b)v=x;else if(!x){if(1==b)continue t;break t}}p[h++]=v}return p},fn.prototype.at=sp.at,fn.prototype.chain=sp.wrapperChain,fn.prototype.commit=sp.commit,fn.prototype.next=sp.next,fn.prototype.plant=sp.plant,fn.prototype.reverse=sp.reverse,fn.prototype.toJSON=fn.prototype.valueOf=fn.prototype.value=sp.value,fn.prototype.first=fn.prototype.head,yp&&(fn.prototype[yp]=sp.toIterator),pp={__e:function(t,e,n,i){for(var o,r,a;e=e.__;)if((o=e.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(t)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(t,i||{}),a=o.__d),a)return o.__E=o}catch(e){t=e}throw t}},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;var Ep=0;function Cp(t,e,n,i,o,r){e||(e={});var a,s,l=e;if("ref"in l)for(s in l={},e)"ref"==s?a=e[s]:l[s]=e[s];var u={type:t,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ep,__i:-1,__u:0,__source:o,__self:r};if("function"==typeof t&&(a=t.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return pp.vnode&&pp.vnode(u),u}var _p=e.LogicFlowUtil.StepDrag,Np=function(t){function n(n){var i=t.call(this)||this;return i.updatePosition=function(t){var e=t.deltaX,n=t.deltaY,o=i.nodeModel,r=o.x,a=o.y;i.nodeModel.x=r+e/2,i.nodeModel.y=a+n/2,i.nodeModel.moveText(e/2,n/2)},i.getResize=function(t){var e=t.index,n=t.deltaX,i=t.deltaY,o=t.width,r=t.height,a=t.PCTResizeInfo,s=t.pct,l=void 0===s?1:s,u=t.freezeWidth,c=void 0!==u&&u,d=t.freezeHeight,h=void 0!==d&&d,f={width:o,height:r,deltaX:n,deltaY:i};if(a){var p=0,g=0;switch(e){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(e){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(e){case 0:f.width=c?o:o-n*l,f.height=h?r:r-i*l;break;case 1:f.width=c?o:o+n*l,f.height=h?r:r-i*l;break;case 2:f.width=c?o:o+n*l,f.height=h?r:r+i*l;break;case 3:f.width=c?o:o-n*l,f.height=h?r:r+i*l}return f},i.updateEdgePointByAnchors=function(){var t=i.nodeModel,e=t.id,n=t.anchors,o=i.getNodeEdges(e);o.sourceEdges.forEach((function(t){var e=n.find((function(e){return e.id===t.sourceAnchorId}));e&&t.updateStartPoint({x:e.x,y:e.y})})),o.targetEdges.forEach((function(t){var e=n.find((function(e){return e.id===t.targetAnchorId}));e&&t.updateEndPoint({x:e.x,y:e.y})}))},i.updateRect=function(t){var e=t.deltaX,n=t.deltaY,o=i.nodeModel,r=o.x,a=o.y,s=o.width,l=o.height,u=o.radius,c=o.PCTResizeInfo,d=i.nodeModel,h=d.minWidth,f=d.minHeight,p=d.maxWidth,g=d.maxHeight,v=i.index,m=h===p,y=f===g,b=i.getResize({index:v,deltaX:e,deltaY:n,width:s,height:l,PCTResizeInfo:c,pct:1,freezeWidth:m,freezeHeight:y});if(b.width<h||b.width>p||b.height<f||b.height>g)i.dragHandler.cancelDrag();else{i.updatePosition({deltaX:m?0:b.deltaX,deltaY:y?0:b.deltaY}),i.nodeModel.width=b.width,i.nodeModel.height=b.height,i.nodeModel.setProperties({nodeSize:{width:b.width,height:b.height}});var x={x:r,y:a,width:s,height:l,radius:u},w={x:i.nodeModel.x,y:i.nodeModel.y,width:i.nodeModel.width,height:i.nodeModel.height,radius:u};i.updateEdgePointByAnchors(),i.eventEmit({beforeNode:x,afterNode:w})}},i.updateEllipse=function(t){var e=t.deltaX,n=t.deltaY,o=i.nodeModel,r=o.rx,a=o.ry,s=o.x,l=o.y,u=o.PCTResizeInfo,c=i.index,d=i.nodeModel,h=d.minWidth,f=d.minHeight,p=d.maxWidth,v=d.maxHeight,m=h===p,y=f===v,b=r,x=a,w=i.getResize({index:c,deltaX:e,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({beforeNode:g(g({},E),{rx:r,ry:a}),afterNode:C})}},i.updateDiamond=function(t){var e=t.deltaX,n=t.deltaY,o=i.nodeModel,r=o.rx,a=o.ry,s=o.x,l=o.y,u=o.PCTResizeInfo,c=i.index,d=i.nodeModel,h=d.minWidth,f=d.minHeight,p=d.maxWidth,g=d.maxHeight,v=h===p,m=f===g,y=r,b=a,x=i.getResize({index:c,deltaX:e,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({beforeNode:w,afterNode:E})}},i.eventEmit=function(t){var e=t.beforeNode,n=t.afterNode,o=i.nodeModel,r=o.id,a=o.modelType,s=o.type,l=g({id:r,modelType:a,type:s},e),u=g({id:r,modelType:a,type:s},n);i.graphModel.eventCenter.emit("node:resize",{preData:l,data:u,model:i.nodeModel})},i.onDragging=function(t){var n,o=t.deltaX,r=t.deltaY,a=i.graphModel.transformModel,s=i.nodeModel.modelType;o=(n=w(a.fixDeltaXY(o,r),2))[0],r=n[1],s===e.ModelType.RECT_NODE||s===e.ModelType.HTML_NODE?i.updateRect({deltaX:o,deltaY:r}):s===e.ModelType.ELLIPSE_NODE?i.updateEllipse({deltaX:o,deltaY:r}):s===e.ModelType.DIAMOND_NODE&&i.updateDiamond({deltaX:o,deltaY:r})},i.onDragEnd=function(){var t=i.graphModel.gridSize,e=void 0===t?1:t,n=e*Math.round(i.nodeModel.x/e),o=e*Math.round(i.nodeModel.y/e);i.nodeModel.moveTo(n,o),i.updateEdgePointByAnchors()},i.index=n.index,i.nodeModel=n.model,i.graphModel=n.graphModel,i.dragHandler=new _p({onDragging:i.onDragging,onDragEnd:i.onDragEnd,step:1}),i}return p(n,t),n.prototype.getNodeEdges=function(t){for(var e=this.graphModel.edges,n=[],i=[],o=0;o<e.length;o++){var r=e[o];r.sourceNodeId===t?n.push(r):e[o].targetNodeId===t&&i.push(r)}return{sourceEdges:n,targetEdges:i}},n.prototype.render=function(){var t=this.props,n=t.x,i=t.y,o=t.index,r=t.model.getControlPointStyle();return Cp("g",{className:"lf-resize-control-".concat(o),children:Cp(e.Rect,g({className:"lf-node-control",x:n,y:i},r,{onMouseDown:this.dragHandler.handleMouseDown}))})},n}(e.Component),Sp=function(t){function n(){var e=t.call(this)||this;return e.state={},e}return p(n,t),n.prototype.getResizeControl=function(){var t=this.props,e=t.model,n=t.graphModel,i=e.x,o=e.y,r=e.width,a=e.height,s={minX:i-r/2,minY:o-a/2,maxX:i+r/2,maxY:o+a/2},l=s.minX,u=s.minY,c=s.maxX,d=s.maxY;return[{x:l,y:u},{x:c,y:u},{x:c,y:d},{x:l,y:d}].map((function(t,i){return Cp(Np,g({index:i},t,{model:e,graphModel:n}))}))},n.prototype.getGroupSolid=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,r=t.height,a=t.getResizeOutlineStyle();return Cp(e.Rect,g({},a,{x:n,y:i,width:o,height:r}))},n.prototype.render=function(){return Cp("g",{className:"lf-resize-control",children:[this.getGroupSolid(),this.getResizeControl()]})},n}(e.Component),Tp=function(t){function e(e,n){var i=t.call(this,e,n)||this,o=e.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return p(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={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:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.EllipseNodeModel),Mp=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return Cp(Sp,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model,n=t.graphModel.editConfigModel.isSilentMode;return Cp("g",{children:[this.getResizeShape(),e.isSelected&&!n?this.getControlGroup():""]})},e}(e.EllipseNode),kp={type:"ellipse",view:Mp,model:Tp},Ap=function(t){function e(e,n){var i=t.call(this,e,n)||this,o=e.properties.nodeSize;return o&&(i.rx=o.rx,i.ry=o.ry),i}return p(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3,this.gridSize=1},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={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:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.DiamondNodeModel),Rp=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),n.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return Cp(Sp,{model:e,graphModel:n})},n.prototype.getResizeShape=function(){var t=this.props.model,n=t.points,i=t.getNodeStyle();return Cp("g",{children:Cp(e.Polygon,g({},i,{points:n}))})},n.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return Cp("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},n}(e.DiamondNode),Op={type:"diamond",view:Rp,model:Ap},Pp=function(t){function e(e,n){var i=t.call(this,e,n)||this,o=e.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return p(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={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:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.HtmlNodeModel),Dp=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return Cp(Sp,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return Cp("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},e}(e.HtmlNode),Lp={type:"html",view:Dp,model:Pp},Ip=function(t){function e(e,n){var i=t.call(this,e,n)||this,o=e.properties.nodeSize;return o&&(i.width=o.width,i.height=o.height),i}return p(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.minWidth=30,this.minHeight=30,this.maxWidth=2e3,this.maxHeight=2e3},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return this.graphModel.editConfigModel.isSilentMode||(e.stroke="none",e.hover&&(e.hover.stroke="none")),e},e.prototype.getResizeOutlineStyle=function(){return{fill:"none",stroke:"transparent",strokeWidth:1,strokeDasharray:"3,3"}},e.prototype.getControlPointStyle=function(){return{width:7,height:7,fill:"#FFFFFF",stroke:"#000000"}},e.prototype.enableProportionResize=function(t){if(void 0===t&&(t=!0),t){var e={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:e,ScaleLimit:n}}else delete this.PCTResizeInfo},e}(e.RectNodeModel),Bp=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.prototype.getControlGroup=function(){var t=this.props,e=t.model,n=t.graphModel;return Cp(Sp,{model:e,graphModel:n})},e.prototype.getResizeShape=function(){return t.prototype.getShape.call(this)},e.prototype.getShape=function(){var t=this.props,e=t.model.isSelected,n=t.graphModel.editConfigModel.isSilentMode;return Cp("g",{children:[this.getResizeShape(),e&&!n?this.getControlGroup():""]})},e}(e.RectNode),jp={type:"rect",view:Bp,model:Ip},Fp={pluginName:"nodeResize",step:0,install:function(t){t.register(kp),t.register(Op),t.register(Lp),t.register(jp)}},Hp=function(t){function e(){var e=t.apply(this,E([],w(arguments),!1))||this;return e.isGroup=!0,e.isFolded=!1,e.unfoldedWidth=500,e.unfoldedHeight=300,e.childrenLastFoldStatus={},e}return p(e,t),e.prototype.initNodeData=function(e){var n=this;t.prototype.initNodeData.call(this,e);var i=[];ee(e.children)&&(i=e.children),this.children=new Set(i),this.width=500,this.height=300,this.foldedWidth=80,this.foldedHeight=60,this.zIndex=-1e4,this.radius=0,this.text.editable=!1,this.text.draggable=!1,this.isRestrict=!1,this.resizable=!1,this.autoToFront=!1,this.foldable=!1,void 0===this.properties.isFolded&&(this.properties.isFolded=!1),this.isFolded=!!this.properties.isFolded,setTimeout((function(){n.isFolded&&n.foldGroup(n.isFolded)}))},e.prototype.getResizeOutlineStyle=function(){var e=t.prototype.getResizeOutlineStyle.call(this);return e.stroke="none",e},e.prototype.foldGroup=function(t){var e=this;if(t!==this.isFolded){this.setProperty("isFolded",t),this.isFolded=t,t?(this.x=this.x-this.width/2+this.foldedWidth/2,this.y=this.y-this.height/2+this.foldedHeight/2,this.unfoldedWidth=this.width,this.unfoldedHeight=this.height,this.width=this.foldedWidth,this.height=this.foldedHeight):(this.width=this.unfoldedWidth,this.height=this.unfoldedHeight,this.x=this.x+this.width/2-this.foldedWidth/2,this.y=this.y+this.height/2-this.foldedHeight/2);var n=E(E([],w(this.incoming.edges),!1),w(this.outgoing.edges),!1);this.children.forEach((function(i){var o=e.graphModel.getElement(i);if(o){var r=o.isFolded;if(o.isGroup&&!o.isFolded&&o.foldGroup(t),o.isGroup&&!t){var a=e.childrenLastFoldStatus[i];void 0!==a&&a!==o.isFolded&&o.foldGroup(a)}e.childrenLastFoldStatus[i]=!!r,o.visible=!t;var s=o.incoming.edges,l=o.outgoing.edges;n=E(E(E([],w(n),!1),w(s),!1),w(l),!1)}})),this.foldEdge(t,n)}},e.prototype.getAnchorStyle=function(e){var n=t.prototype.getAnchorStyle.call(this,e);return n.stroke="transparent",n.fill="transparent",n.hover.fill="transparent",n.hover.stroke="transparent",n},e.prototype.foldEdge=function(t,e){var n=this;e.forEach((function(e,i){var o=e.id,r=e.sourceNodeId,a=e.targetNodeId,s=e.startPoint,l=e.endPoint,u=e.type,c=e.text,d=e.getProperties(),h={id:"".concat(o,"__").concat(i),sourceNodeId:r,targetNodeId:a,startPoint:s,endPoint:l,type:u,properties:d,text:null==c?void 0:c.value};e.virtual&&n.graphModel.deleteEdgeById(e.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)),t&&!1!==e.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),e.visible=!1),t||!1!==e.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)):e.visible=!0)}))},e.prototype.createVirtualEdge=function(t){t.pointsList=void 0;var e=this.graphModel.addEdge(t);e.virtual=!0,e.text.editable=!1,e.isFoldedEdge=!0},e.prototype.isInRange=function(t){var e=t.minX,n=t.minY,i=t.maxX,o=t.maxY;return e>=this.x-this.width/2&&i<=this.x+this.width/2&&n>=this.y-this.height/2&&o<=this.y+this.height/2},e.prototype.isAllowMoveTo=function(t){var e=t.x1,n=t.y1,i=t.x2,o=t.y2;return{x:e>=this.x-this.width/2&&i<=this.x+this.width/2,y:n>=this.y-this.height/2&&o<=this.y+this.height/2}},e.prototype.setAllowAppendChild=function(t){this.setProperty("groupAddable",t)},e.prototype.addChild=function(t){this.children.add(t),this.graphModel.eventCenter.emit("group:add-node",{data:this.getData()})},e.prototype.removeChild=function(t){this.children.delete(t),this.graphModel.eventCenter.emit("group:remove-node",{data:this.getData()})},e.prototype.getAddableOutlineStyle=function(){return{stroke:"#FEB663",strokeWidth:2,strokeDasharray:"4 4",fill:"transparent"}},e.prototype.getData=function(){var e=this,n=t.prototype.getData.call(this);n.children=[],this.children.forEach((function(t){var i=e.graphModel.getNodeModelById(t);i&&!i.virtual&&n.children.push(t)}));var i=n.properties;return null==i||delete i.groupAddable,null==i||delete i.isFolded,n},e.prototype.getHistoryData=function(){var e=t.prototype.getData.call(this);e.children=E([],w(this.children),!1),e.isGroup=!0;var n=e.properties;return null==n||delete n.groupAddable,(null==n?void 0:n.isFolded)&&(e.x=e.x+this.unfoldedWidth/2-this.foldedWidth/2,e.y=e.y+this.unfoldedHeight/2-this.foldedHeight/2),e},e.prototype.isAllowAppendIn=function(t){return console.info("_nodeData",t),!0},e.prototype.toBack=function(){this.zIndex--},e}(Ip),Wp=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),n.prototype.getControlGroup=function(){var e=this.props.model,n=e.resizable,i=e.properties;return n&&!i.isFolded?t.prototype.getControlGroup.call(this):null},n.prototype.getAddableShape=function(){var t=this.props.model,n=t.width,i=t.height,o=t.x,r=t.y,a=t.radius,s=t.properties,l=t.getAddableOutlineStyle;if(!s.groupAddable)return null;var u=this.props.model.getNodeStyle().strokeWidth,c=void 0===u?0:u,d=l(),h=n+c+8,f=i+c+8;return e.h("rect",g(g({},d),{width:h,height:f,x:o-h/2,y:r-f/2,rx:a,ry:a}))},n.prototype.getFoldIcon=function(){var t=this.props.model,n=t.x-t.width/2+5,i=t.y-t.height/2+5;if(!t.foldable)return null;var o=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:t.properties.isFolded?"M ".concat(n+3,",").concat(i+6," ").concat(n+11,",").concat(i+6," M").concat(n+7,",").concat(i+2," ").concat(n+7,",").concat(i+10):"M ".concat(n+3,",").concat(i+6," ").concat(n+11,",").concat(i+6," ")});return e.h("g",{},[e.h("rect",{height:12,width:14,rx:2,ry:2,strokeWidth:1,fill:"#F4F5F6",stroke:"#CECECE",cursor:"pointer",x:t.x-t.width/2+5,y:t.y-t.height/2+5,onClick:function(){t.foldGroup(!t.properties.isFolded)}}),o])},n.prototype.getResizeShape=function(){return e.h("g",{},[this.getAddableShape(),t.prototype.getResizeShape.call(this),this.getFoldIcon()])},n}(Bp),zp={type:"group",view:Wp,model:Hp},Up=-1e4,qp=function(){function t(t){var e=t.lf,n=this;this.topGroupZIndex=Up,this.nodeGroupMap=new Map,this.graphRendered=function(t){var e=t.data;e&&e.nodes&&(e.nodes.forEach((function(t){t.children&&t.children.forEach((function(e){n.nodeGroupMap.set(e,t.id)}))})),n.checkAndCorrectTopGroupZIndex(e.nodes))},this.appendNodeToGroup=function(t){var e=t.data,i=n.nodeGroupMap.get(e.id);if(i){var o=n.lf.getNodeModelById(i);o.removeChild(e.id),n.nodeGroupMap.delete(e.id),o.setAllowAppendChild(!1)}var r=n.lf.getNodeModelById(e.id),a=null==r?void 0:r.getBounds();if(a&&r){var s=n.getGroup(a,e);if(r.isGroup&&(e.children.forEach((function(t){n.nodeGroupMap.set(t,e.id)})),n.checkAndCorrectTopGroupZIndex([e]),n.nodeSelected({data:e,isSelected:!1,isMultiple:!1})),!s)return;if(!s.isAllowAppendIn(e))return void n.lf.emit("group:not-allowed",{group:s.getData(),node:e});s.addChild(e.id),n.nodeGroupMap.set(e.id,s.id),s.setAllowAppendChild(!1)}},this.deleteGroupChild=function(t){var e=t.data;e.children&&e.children.forEach((function(t){n.nodeGroupMap.delete(t),n.lf.deleteNode(t)}));var i=n.nodeGroupMap.get(e.id);i&&(n.lf.getNodeModelById(i).removeChild(e.id),n.nodeGroupMap.delete(e.id))},this.setActiveGroup=function(t){var e=t.data,i=n.lf.getNodeModelById(e.id),o=null==i?void 0:i.getBounds();if(i&&o){var r=n.getGroup(o,e);if(n.activeGroup&&n.activeGroup.setAllowAppendChild(!1),!r||i.isGroup&&r.id===e.id)return;if(!r.isAllowAppendIn(e))return;n.activeGroup=r,n.activeGroup.setAllowAppendChild(!0)}},this.findNodeAndChildMaxZIndex=function(t){var e=Up;return t.isGroup&&(e=Math.max(e,t.zIndex)),t.children&&t.children.forEach((function(t){"object"==typeof t&&(t=t.id);var i=n.lf.getNodeModelById(t);if(null==i?void 0:i.isGroup){var o=n.findNodeAndChildMaxZIndex(i);e=Math.max(o,e)}})),e},this.checkAndCorrectTopGroupZIndex=function(t){var e=Up;if(t.forEach((function(t){var i=n.lf.getNodeModelById(t.id);if(i){var o=n.findNodeAndChildMaxZIndex(i);o>e&&(e=o)}})),!(n.topGroupZIndex>=e)){for(var i=n.lf.graphModel.nodes.filter((function(t){return t.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(t){var e=t.data,i=t.isMultiple,o=t.isSelected,r=n.lf.getNodeModelById(e.id);if(n.toFrontGroup(r),n.topGroupZIndex>-1e3){n.topGroupZIndex=Up;for(var a=n.lf.graphModel.nodes.filter((function(t){return t.isGroup})).sort((function(t,e){return t.zIndex-e.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(t){var e=n.lf.graphModel.getElement(t);null==e||e.setSelected(!1)}));else{var c=n.nodeGroupMap.get(e.id);if(c){var d=n.lf.getNodeModelById(c);(null==d?void 0:d.isSelected)&&(null==r||r.setSelected(!1))}}},this.toFrontGroup=function(t){t&&t.isGroup&&(n.topGroupZIndex++,t.setZIndex(n.topGroupZIndex),t.children&&t.children.forEach((function(t){var e=n.lf.getNodeModelById(t);n.toFrontGroup(e)})))},e.register(zp),this.lf=e,e.graphModel.addNodeMoveRules((function(t,i,o){if(t.isGroup){var r=n.getNodeAllChild(t);return e.graphModel.moveNodes(r,i,o,!0),!0}var a=e.getNodeModelById(n.nodeGroupMap.get(t.id));if(a&&a.isRestrict){var s=t.getBounds(),l=s.minX,u=s.minY,c=s.maxX,d=s.maxY;return a.isAllowMoveTo({x1:l+i,y1:u+o,x2:c+i,y2:d+o})}return!0})),e.graphModel.group=this,e.on("node:add,node:drop,node:dnd-add",this.appendNodeToGroup),e.on("node:delete",this.deleteGroupChild),e.on("node:dnd-drag,node:drag",this.setActiveGroup),e.on("node:click",this.nodeSelected),e.on("graph:rendered",this.graphRendered),e.addElements=function(t,i){var o=t.nodes,r=t.edges,a={},s={nodes:[],edges:[]},l=[];return bu(o,(function(t){var o=t.id,r=t.children,u=v(t,["children"]),c=e.addNode(u);if(!c)return{nodes:[],edges:[]};o&&(a[o]=c.id),s.nodes.push(c);var d=n.createAllChildNodes(a,r,c,i).edgesArray;l.push.apply(l,E([],w(d),!1))})),l.forEach((function(t){n.createEdgeModel(t,a,i)})),bu(r,(function(t){var e=n.createEdgeModel(t,a,0);s.edges.push(e)})),s}}return t.prototype.createAllChildNodes=function(t,n,i,o){var r=this,a=this.lf,s=[],l=[],u=[];null==n||n.forEach((function(n){var c=a.getNodeModelById(n);if(c){var d=c.x,h=c.y,f=c.properties,p=c.type,g=c.rotate,v=c.children,m={x:d+o,y:h+o,properties:f,type:p,rotate:g},y=e.EventType.NODE_GROUP_COPY||"node:group-copy-add",b=a.addNode(m,y);if(i.addChild(b.id),t[n]=b.id,u.push(b),c.incoming.edges.forEach((function(t){l.push(t)})),c.outgoing.edges.forEach((function(t){l.push(t)})),v instanceof Set){var x=r.createAllChildNodes(t,v,b,o),C=x.nodesArray,_=x.edgesArray;u.push.apply(u,E([],w(C),!1)),s.push.apply(s,E([],w(_),!1))}}}));var c=l.filter((function(e){return t[e.sourceNodeId]&&t[e.targetNodeId]})).map((function(t){return t.getData()}));return{nodesArray:u,edgesArray:s.concat(c)}},t.prototype.createEdgeModel=function(t,e,n){var i=this.lf,o=t.sourceNodeId,r=t.targetNodeId;e[o]&&(o=e[o]),e[r]&&(r=e[r]);var a=t.type,s=t.startPoint,l=t.endPoint,u=t.pointsList,c=t.text,d={x:((null==s?void 0:s.x)||0)+n,y:((null==s?void 0:s.y)||0)+n},h={x:((null==l?void 0:l.x)||0)+n,y:((null==l?void 0:l.y)||0)+n},f=[];u&&u.length>0&&(f=u.map((function(t){return t.x+=n,t.y+=n,t})));var p={type:a,startPoint:d,endPoint:h,sourceNodeId:o,targetNodeId:r,pointsList:f};return he(c)&&!Wc(c)&&(p.text=g(g({},c),{x:(null==c?void 0:c.x)+n,y:(null==c?void 0:c.y)+n})),i.graphModel.addEdge(p)},t.prototype.getNodeAllChild=function(t){var e=this,n=[];return t.children&&t.children.forEach((function(t){n.push(t);var i=e.lf.getNodeModelById(t);(null==i?void 0:i.isGroup)&&(n=n.concat(e.getNodeAllChild(i)))})),n},t.prototype.getGroup=function(t,e){var n=this.lf.graphModel.nodes.filter((function(n){return n.isGroup&&n.isInRange(t)&&n.id!==e.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}},t.prototype.getNodeGroup=function(t){var e=this.nodeGroupMap.get(t);if(e)return this.lf.getNodeModelById(e)},t.prototype.render=function(){},t.prototype.destroy=function(){},t.pluginName="group",t}();function Gp(){var t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),n.prototype.getFoldIcon=function(){var t=this.props.model,n=t,i=n.x,o=n.y,r=n.width,a=n.height,s=n.properties,l=n.foldable,u=t.x-t.width/2+5,c=t.y-t.height/2+5;if(!l)return null;var d=e.h("path",{fill:"none",stroke:"#818281",strokeWidth:2,"pointer-events":"none",d:s.isFolded?"M ".concat(u+3,",").concat(c+6," ").concat(u+11,",").concat(c+6," M").concat(u+7,",").concat(c+2," ").concat(u+7,",").concat(c+10):"M ".concat(u+3,",").concat(c+6," ").concat(u+11,",").concat(c+6," ")});return e.h("g",{},[e.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(e){var n,i;null===(i=(n=e.stopPropagation()(t)).foldGroup)||void 0===i||i.call(n,!s.isFolded)}}),d])},n.prototype.getResizeShape=function(){var t=this.props.model,n=t.x,i=t.y,o=t.width,r=t.height,a=t.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 e.h("g",{},[e.h("rect",g({},s)),this.getFoldIcon()])},n}(Wp),n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.prototype.initNodeData=function(e){t.prototype.initNodeData.call(this,e),this.foldable=!0,this.resizable=!0,this.width=400,this.height=200,this.resetWidthHeight(),this.isTaskNode=!0,this.boundaryEvents=[]},e.prototype.resetWidthHeight=function(){var t,e,n=null===(t=this.properties.iniProp)||void 0===t?void 0:t.width,i=null===(e=this.properties.iniProp)||void 0===e?void 0:e.height;n&&(this.width=n),i&&(this.height=i)},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return e.stroke="#989891",e.strokeWidth=1,e.strokeDasharray="3 3",this.isSelected&&(e.stroke="rgb(124, 15, 255)"),this.properties.isBoundaryEventTouchingTask&&(e.stroke="#00acff",e.strokeWidth=2),e},e.prototype.addChild=function(e){var n=this.graphModel.getElement(e);null==n||n.setProperties({parent:this.id}),t.prototype.addChild.call(this,e)},e.prototype.getAnchorStyle=function(){var e=t.prototype.getAnchorStyle.call(this);return e.stroke="#000",e.fill="#fff",e.hover||(e.hover={}),e.hover.stroke="transparent",e},e.prototype.getOutlineStyle=function(){var e=t.prototype.getOutlineStyle.call(this);return e.stroke="transparent",e.hover||(e.hover={}),e.hover.stroke="transparent",e},e.prototype.setTouching=function(t){this.setProperty("isBoundaryEventTouchingTask",t)},e.prototype.addBoundaryEvent=function(t){if(this.setTouching(!1),this.boundaryEvents.find((function(e){return e===t})))return!1;var e=this.graphModel.getNodeModelById(t);return null==e||e.setProperties({attachedToRef:this.id}),this.boundaryEvents.push(t),!0},e.prototype.deleteBoundaryEvent=function(t){this.boundaryEvents=this.boundaryEvents.filter((function(e){return e!==t}))},e}(Hp);return{type:"bpmn:subProcess",view:t,model:n}}function Vp(t){var e=Lt("bpmn:serviceTask",Tt),n=Lt("bpmn:userTask",Mt);t.register(e),t.register(n),t.register(Gp()),function(t){function e(t,e){var n=t.x,i=t.y,o=t.width,r=t.height,a=t.id,s=n-o/2,l=n+o/2,u=i-r/2,c=i+r/2,d=e.x,h=e.y;return d>s-5&&d<l+5&&h>u-5&&h<c+5&&!(d>s+5&&d<l-5&&h>u+5&&h<c-5)?a:null}t.on("node:drag,node:dnd-drag",(function(n){var i,o,r=n.data;if("bpmn:boundaryEvent"===r.type){var a=t.graphModel.nodes;try{for(var s=x(a),l=s.next();!l.done;l=s.next()){var u=l.value;u.isTaskNode&&(e(u,r)?u.setTouching(!0):u.setTouching(!1))}}catch(t){i={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})),t.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=t.graphModel.nodes;try{for(var u=x(l),c=u.next();!c.done;c=u.next()){var d,h=c.value;if(h.isTaskNode)if(null!==(d=e(h,r))){var f=t.graphModel.getNodeModelById(s),p=t.graphModel.getNodeModelById(d),g=f.properties.attachedToRef;return g&&g!==d&&t.graphModel.getNodeModelById(g).deleteBoundaryEvent(s),void p.addBoundaryEvent(s)}}}catch(t){i={error:t}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}}})),t.graphModel.addNodeMoveRules((function(e,n,i){if(e.isTaskNode){var o=e.boundaryEvents;return t.graphModel.moveNodes(o,n,i,!0),!0}return!0}))}(t)}function Kp(t){var n=function(e){function n(n,i){n.id||(n.id="Flow_".concat(gt()));var o=g(g(g({},t||{}),n.properties),{isDefaultFlow:!1});return n.properties=o,e.call(this,n,i)||this}return p(n,e),n.extendKey="SequenceFlowModel",n}(e.PolylineEdgeModel),i=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),n.prototype.getStartArrow=function(){return this.props.model.properties.isDefaultFlow?e.h("path",{refX:15,stroke:"#000000",strokeWidth:2,d:"M 20 5 10 -5 z"}):e.h("path",{d:""})},n.extendKey="SequenceFlowEdge",n}(e.PolylineEdge);return{type:"bpmn:sequenceFlow",view:i,model:n}}var Xp=Kp();var Yp=[{nodes:["startEvent","intermediateCatchEvent","boundaryEvent"],definition:[{type:"bpmn:timerEventDefinition",icon:Et,properties:{definitionType:"bpmn:timerEventDefinition",timerValue:"",timerType:""}}]}];function $p(t){function e(e){e.forEach((function(e){var n,i;n=e.nodes,i=e.definition,n.forEach((function(e){(null==t?void 0:t[e])||(t[e]=new Map);var n=null==t?void 0:t[e];i.forEach((function(t){n.set(t.type,t)}))}))}))}return function(){return[t,e]}}var Zp=function(){function t(t){var e=t.lf;e.definition={},e.useDefinition=$p(e.definition);var n=w(e.useDefinition(),2),i=n[0],o=n[1];console.log("_definition",i),o(Yp),function(t){t.register(bt(t)),t.register(mt(t)),t.register(yt(t)),t.register(wt(t)),t.register(xt(t))}(e),function(t){var e=Pt("bpmn:exclusiveGateway",_t),n=Pt("bpmn:parallelGateway",Nt),i=Pt("bpmn:inclusiveGateway",St);t.register(e),t.register(i),t.register(n)}(e),function(t){t.register(Xp)}(e),Vp(e),e.setDefaultEdgeType("bpmn:sequenceFlow")}return t.pluginName="BpmnElementsPlugin",t}(),Jp=40,Qp=40,tg=40,eg=40,ng=100,ig=80,og=100,rg=80,ag=100,sg=80,lg=100,ug=80,cg=100,dg=80,hg=100,fg=80,pg=100,gg=80,vg=100,mg=80,yg=function(){};(yg.ObjTree=function(){return this}).VERSION="0.23",yg.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n',yg.ObjTree.prototype.attr_prefix="-",yg.ObjTree.prototype.parseXML=function(t){var e;if(window.DOMParser){var n=new DOMParser,i=n.parseFromString(t,"application/xml");if(!i)return;e=i.documentElement}else window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async=!1,n.loadXML(t),e=n.documentElement);if(e)return this.parseDOM(e)},yg.ObjTree.prototype.parseHTTP=function(t,e,n){var i,o={};for(var r in e)o[r]=e[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(t){var e;t&&t.responseXML&&t.responseXML.documentElement&&(e=a.parseDOM(t.responseXML.documentElement)),s(e,t),l&&l(t)}}else o.asynchronous=!1;if("undefined"!=typeof HTTP&&HTTP.Request)o.uri=t,(u=new HTTP.Request(o))&&(i=u.transport);else if("undefined"!=typeof Ajax&&Ajax.Request){var u;(u=new Ajax.Request(t,o))&&(i=u.transport)}return n?i:i&&i.responseXML&&i.responseXML.documentElement?this.parseDOM(i.responseXML.documentElement):void 0},yg.ObjTree.prototype.parseDOM=function(t){if(t){if(this.__force_array={},this.force_array)for(var e=0;e<this.force_array.length;e++)this.__force_array[this.force_array[e]]=1;var n=this.parseElement(t);if(this.__force_array[t.nodeName]&&(n=[n]),11!==t.nodeType){var i={};i[t.nodeName]=n,n=i}return n}},yg.ObjTree.prototype.parseElement=function(t){if(7!==t.nodeType){if(3===t.nodeType||4===t.nodeType||8===t.nodeType){if(null==t.nodeValue.match(/[^\x00-\x20]/))return;return t.nodeValue}var e=null,n={};if(t.attributes&&t.attributes.length){e={};for(var i=0;i<t.attributes.length;i++){if("string"==typeof(s=t.attributes[i].nodeName)){var o=t.attributes[i].nodeValue;try{o=JSON.parse(t.attributes[i].nodeValue.replace(/'/g,'"'))}catch(e){o=t.attributes[i].nodeValue}null!=o&&(void 0===n[s=this.attr_prefix+s]&&(n[s]=0),n[s]++,this.addNode(e,s,n[s],o))}}}if(t.childNodes&&t.childNodes.length){var r=!0;e&&(r=!1);for(i=0;i<t.childNodes.length&&r;i++){var a=t.childNodes[i].nodeType;3!==a&&4!==a&&8!==a&&(r=!1)}if(r){e||(e="");for(i=0;i<t.childNodes.length;i++)e+=t.childNodes[i].nodeValue}else{e||(e={});for(i=0;i<t.childNodes.length;i++){var s;if("string"==typeof(s=t.childNodes[i].nodeName))(o=this.parseElement(t.childNodes[i]))&&(void 0===n[s]&&(n[s]=0),n[s]++,this.addNode(e,s,n[s],o))}}}else null===e&&(e={});return e}},yg.ObjTree.prototype.addNode=function(t,e,n,i){this.__force_array[e]?(1===n&&(t[e]=[]),t[e][t[e].length]=i):1===n?t[e]=i:2===n?t[e]=[t[e],i]:t[e][t[e].length]=i},yg.ObjTree.prototype.writeXML=function(t){var e=this.hash_to_xml(null,t);return this.xmlDecl+e},yg.ObjTree.prototype.hash_to_xml=function(t,e){var n=[],i=[];for(var o in e)if(cc(e,o)){var r=e[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===t||null==t||(s=n.length>0?s.match(/\n/)?"<".concat(t).concat(a,">\n").concat(s,"</").concat(t,">\n"):"<".concat(t).concat(a,">").concat(s,"</").concat(t,">\n"):"<".concat(t).concat(a," />\n")),s},yg.ObjTree.prototype.array_to_xml=function(t,e){for(var n=[],i=0;i<e.length;i++){var o=e[i];void 0===o||null==o?n[n.length]="<".concat(t," />"):"object"==typeof o&&o.constructor===Array?n[n.length]=this.array_to_xml(t,o):n[n.length]="object"==typeof o?this.hash_to_xml(t,o):this.scalar_to_xml(t,o)}return n.join("")},yg.ObjTree.prototype.scalar_to_xml=function(t,e){return"#text"===t?this.xml_escape(e):"<".concat(t,">").concat(this.xml_escape(e),"</").concat(t,">\n")},yg.ObjTree.prototype.xml_escape=function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')};function bg(t){return Object.prototype.toString.call(t)}function xg(t){return" ".repeat(t)}function wg(t){return"[object Object]"===bg(t)?Object.keys(t).reduce((function(e,n){var i=n;return"-"===n.charAt(0)&&(i=n.substring(1)),e[i]=wg(t[n]),e}),{}):Array.isArray(t)?t.map((function(t){return wg(t)})):t}var Eg,Cg="\t\n";function _g(t,e,n){var i=xg(n),o="",r=Cg+i;if("-json"===e)return"";if("#text"===e)return r+t;if("#cdata-section"===e)return"".concat(r,"<![CDATA[").concat(t,"]]>");if("#comment"===e)return"".concat(r,"\x3c!--").concat(t,"--\x3e");if("-"==="".concat(e).charAt(0))return" ".concat(e.substring(1),'="').concat(function(t){var e=t;try{"string"!=typeof e&&(e=JSON.parse(t))}catch(n){e=JSON.stringify(wg(t)).replace(/"/g,"'")}return e}(t),'"');if(Array.isArray(t))o+=t.map((function(t){return _g(t,e,n+1)})).join("");else if("[object Object]"===bg(t)){var a=Object.keys(t),s="",l=t["-json"]?Cg+xg(n+1)+t["-json"]:"";o+="".concat(0===n?"":r,"<").concat(e),a.forEach((function(e){"-"===e.charAt(0)?s+=_g(t[e],e,n+1):l+=_g(t[e],e,n+1)})),o+=s+(""!==l?">".concat(l).concat(r,"</").concat(e,">"):" />")}else o+="".concat(r,"<").concat(e,">").concat(t.toString(),"</").concat(e,">");return o}!function(t){t.START="bpmn:startEvent",t.END="bpmn:endEvent",t.INTERMEDIATE_CATCH="bpmn:intermediateCatchEvent",t.INTERMEDIATE_THROW="bpmn:intermediateThrowEvent",t.BOUNDARY="bpmn:boundaryEvent",t.PARALLEL_GATEWAY="bpmn:parallelGateway",t.INCLUSIVE_GATEWAY="bpmn:inclusiveGateway",t.EXCLUSIVE_GATEWAY="bpmn:exclusiveGateway",t.USER="bpmn:userTask",t.SYSTEM="bpmn:serviceTask",t.FLOW="bpmn:sequenceFlow",t.SUBPROCESS="bpmn:subProcess"}(Eg||(Eg={}));var Ng=["-name","-id","bpmn:incoming","bpmn:outgoing","-sourceRef","-targetRef","-children"],Sg=["properties","startPoint","endPoint","pointsList"],Tg={in:[],out:["properties.panels","properties.nodeSize","properties.definitionId","properties.timerValue","properties.timerType","properties.definitionType","properties.parent","properties.isBoundaryEventTouchingTask"]},Mg=function(t,e){return Object.keys(e||{}).forEach((function(n){if(t[n]){var i=e[n],o=i.in,r=i.out;o&&(t[n].in=o),r&&(t[n].out=r)}else t[n]=e[n]})),t},kg={"bpmn:startEvent":{out:function(t){var e,n,i=t.properties;return(null===(n=null===(e=kg[i.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:intermediateCatchEvent":{out:function(t){var e,n,i=t.properties;return(null===(n=null===(e=kg[i.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:intermediateThrowEvent":{out:function(t){var e,n,i=t.properties;return(null===(n=null===(e=kg[i.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:boundaryEvent":{out:function(t){var e,n,i=t.properties;return(null===(n=null===(e=kg[i.definitionType])||void 0===e?void 0:e.out)||void 0===n?void 0:n.call(e,t))||{}}},"bpmn:sequenceFlow":{out:function(t){var e=t.properties,n=e.expressionType,i=e.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(t){var e=t.properties,n=e.timerType,i=e.timerValue,o=e.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(t,e){var n,i,o,r=t,a=e["-id"],s="",l="";try{for(var u=x(Object.keys(e)),c=u.next();!c.done;c=u.next()){var d=c.value;d.includes("bpmn:")&&(s=w(d.split(":"),2)[1],l=null===(o=e[d])||void 0===o?void 0:o["#text"])}}catch(t){n={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return{"-definitionId":a,"-definitionType":r,"-timerType":s,"-timerValue":l}}},"bpmn:conditionExpression":{in:function(t,e){var n,i="",o="";return e["#cdata-section"]?(o="cdata",i=(null===(n=/^\$\{(.*)\}$/g.exec(e["#cdata-section"]))||void 0===n?void 0:n[1])||""):e["#text"]&&(o="normal",i=e["#text"]),{"-condition":i,"-expressionType":o}}}};function Ag(t){var e=null!=t?t:{},n=e.retainedAttrsFields,i=e.excludeFields,o=e.transformer,r=new Set(E(E([],w(Sg),!1),w(n||[]),!1)),a={in:new Set(E(E([],w(Tg.in),!1),w((null==i?void 0:i.in)||[]),!1)),out:new Set(E(E([],w(Tg.out),!1),w((null==i?void 0:i.out)||[]),!1))};return kg=Mg(kg,o),function(t){var e=t.nodes,n=t.edges;return function t(i,o){var s,l;if(1!==(null==i?void 0:i.flag)){var u;if((u=kg[i.type])&&u.out){var c=u.out(i),d=Object.keys(c);d.length>0&&d.forEach((function(t){i[t]=c[t]}))}(null==i?void 0:i.children)&&(i.children=i.children.map((function(t){return e.find((function(e){return e.id===t}))||n.find((function(e){return e.id===t}))||{}})));var h={};if("string"==typeof i)return i;if(Array.isArray(i))return i.map((function(e){return t(e,"")})).filter((function(t){return null!=t}));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(t){return t})).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)]=t(m,y):h[v]=t(m,y))}}catch(t){s={error:t}}finally{try{p&&!p.done&&(l=f.return)&&l.call(f)}finally{if(s)throw s.error}}return h}}(t,"")}}function Rg(t){var e,n,i={};try{for(var o=x(Object.entries(t)),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)]=wg(l):"string"==typeof l?i[s]=l:"[object Object]"===Object.prototype.toString.call(l)?i[s]=Rg(l):Array.isArray(l)?i[s]=l.map((function(t){return Rg(t)})):i[s]=l}}catch(t){e={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return i}function Og(t,e){t["bpmndi:BPMNEdge"]=e.edges.map((function(t){var e,n=t.id,i=t.pointsList.map((function(t){return{"-x":t.x,"-y":t.y}})),o={"-id":"".concat(n,"_di"),"-bpmnElement":n,"di:waypoint":i};return(null===(e=t.text)||void 0===e?void 0:e.value)&&(o["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),o})),t["bpmndi:BPMNShape"]=e.nodes.map((function(t){var e,n=t.id,i=100,o=80,r=t.x,a=t.y,s=Bg.shapeConfigMap.get(t.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===(e=t.text)||void 0===e?void 0:e.value)&&(l["bpmndi:BPMNLabel"]={"dc:Bounds":{"-x":t.text.x-10*t.text.value.length/2,"-y":t.text.y-7,"-width":10*t.text.value.length,"-height":14}}),l}))}var Pg=["bpmn:incoming","bpmn:outgoing"];function Dg(t,e){var n=[],i=[],o=new Map,r=null!=e?e:{},a=r.transformer,s=r.excludeFields,l={in:new Set(E(E([],w(Tg.in),!1),w((null==s?void 0:s.in)||[]),!1)),out:new Set(E(E([],w(Tg.out),!1),w((null==s?void 0:s.out)||[]),!1))};kg=Mg(kg,a);var u,c,d=t["bpmn:definitions"];if(d){var h=d["bpmn:process"];u=h,c=[function(t){function e(t){t["-children"]||(t["-children"]=[]),Object.keys(t).forEach((function(e){var n;0!==e.indexOf("bpmn:")||Pg.includes(e)||(h[e]||(h[e]=[]),!Array.isArray(h[e])&&(h[e]=[h[e]]),Array.isArray(t[e])?(n=h[e]).push.apply(n,E([],w(t[e]),!1)):h[e].push(t[e]),Array.isArray(t[e])?t[e].forEach((function(n){!e.includes("Flow")&&t["-children"].push(n["-id"])})):!e.includes("Flow")&&t["-children"].push(t[e]["-id"]),delete t[e])}))}if("bpmn:subProcess"===t){var n=h[t];Array.isArray(n)?n.forEach((function(n){"bpmn:subProcess"===t&&e(n)})):e(n)}},function(t){function e(t){var n;o.set(t["-id"],t),Array.isArray(t)?t.forEach((function(t){e(t)})):"object"==typeof t&&(n=t,Object.keys(n).forEach((function(t){var i,o;if(t.includes("bpmn:")){var r={};kg[t]&&kg[t].in?(r=null===(o=(i=kg[t]).in)||void 0===o?void 0:o.call(i,t,fn.cloneDeep(n[t])),delete n[t]):e(n[t]);var a=void 0;(a=Reflect.ownKeys(r)).length>0&&a.forEach((function(t){Reflect.set(n,t,r[t])}))}})))}e(h[t])},function(t){if(0===t.indexOf("bpmn:")){var e=h[t];if("bpmn:sequenceFlow"===t){var r=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNEdge"];i=function(t,e){var n=[];if(Array.isArray(t))t.forEach((function(t){var i;i=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(Ig(i,t))}));else{var i=void 0;i=Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n.push(Ig(i,t))}return n}(e,r)}else{var a=d["bpmndi:BPMNDiagram"]["bpmndi:BPMNPlane"]["bpmndi:BPMNShape"];if("bpmn:boundaryEvent"===t){var s=h[t],l=function(t){var e=t["-attachedToRef"],n=o.get(e);n["-boundaryEvents"]||(n["-boundaryEvents"]=[]),n["-boundaryEvents"].push(t["-id"])};Array.isArray(s)?s.forEach((function(t){l(t)})):l(s)}n=n.concat(function(t,e,n){var i=[];if(Array.isArray(t))t.forEach((function(t){var o=Lg(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);i.push(o)}));else{var o=Lg(Array.isArray(e)?e.find((function(e){return e["-bpmnElement"]===t["-id"]})):e,n,t);i.push(o)}return i}(e,a,t))}}}],c.forEach((function(t){try{Object.keys(u).forEach((function(e){try{t(e)}catch(t){console.error(t)}}))}catch(t){console.error(t)}}))}var f=function(t,e,n){Object.keys(t).forEach((function(i){var o=n?"".concat(n,".").concat(i):i;e.has(o)?delete t[i]:"object"==typeof t[i]&&f(t[i],e,o)}))};return n.forEach((function(t){var n,i;if(null===(n=null==e?void 0:e.mapping)||void 0===n?void 0:n.in){var o=null===(i=null==e?void 0:e.mapping)||void 0===i?void 0:i.in,r=t.type;o[r]&&(t.type=o[r])}f(t,l.in,"")})),i.forEach((function(t){var n,i;if(null===(n=null==e?void 0:e.mapping)||void 0===n?void 0:n.in){var o=null===(i=null==e?void 0:e.mapping)||void 0===i?void 0:i.in,r=t.type;o[r]&&(t.type=o[r])}f(t,l.in,"")})),{nodes:n,edges:i}}function Lg(t,e,n){var i=Number(t["dc:Bounds"]["-x"]),o=Number(t["dc:Bounds"]["-y"]),r=n["-children"],a=n["-name"],s=Bg.shapeConfigMap.get(e);s&&(i+=s.width/2,o+=s.height/2);var l,u={};if(Object.entries(n).forEach((function(t){var e=w(t,2),n=e[0],i=e[1];Ng.includes(n)||(u[n]=i)})),u=Rg(u),a&&(l={x:i,y:o,value:a},t["bpmndi:BPMNLabel"]&&t["bpmndi:BPMNLabel"]["dc:Bounds"])){var c=t["bpmndi:BPMNLabel"]["dc:Bounds"];l.x=Number(c["-x"])+Number(c["-width"])/2,l.y=Number(c["-y"])+Number(c["-height"])/2}var d={id:t["-bpmnElement"],type:e,x:i,y:o,properties:u};return r&&(d.children=r),l&&(d.text=l),d}function Ig(t,e){var n,i=e["-name"];if(i){var o=t["bpmndi:BPMNLabel"]["dc:Bounds"],r=0;i.split("\n").forEach((function(t){r<t.length&&(r=t.length)})),n={value:i,x:Number(o["-x"])+10*r/2,y:Number(o["-y"])+7}}var a={};Object.entries(e).forEach((function(t){var e=w(t,2),n=e[0],i=e[1];Ng.includes(n)||(a[n]=i)})),a=Rg(a);var s=t["di:waypoint"].map((function(t){return{x:Number(t["-x"]),y:Number(t["-y"])}})),l={id:e["-id"],type:Eg.FLOW,pointsList:s,sourceNodeId:e["-sourceRef"],targetNodeId:e["-targetRef"],properties:a};return n&&(l.text=n),l}var Bg=function(){function t(t){var e=t.lf,n=this;this.adapterOut=function(t,e){var i,o,r=g({},n.processAttributes);!function(t,e,n){var i,o=new Map,r=Ag(n)(e);r.nodes.forEach((function(e){var n=e["-id"],i=e["-type"],r=e.text,a=e.children,s=v(e,["-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),t[i]||(t[i]=[]),t[i].push(l),o.set(n,l)}));var a=r.edges.map((function(t){var e=t["-id"],n=t["-sourceNodeId"],i=t["-targetNodeId"],r=t.text,a=v(t,["-id","-sourceNodeId","-targetNodeId","text"]),s=o.get(i);s["bpmn:incoming"]||(s["bpmn:incoming"]=[]),s["bpmn:incoming"].push(e);var l={"-id":e,"-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}));e.edges.forEach((function(t){var e=t.sourceNodeId,n=t.id,i=o.get(e);i["bpmn:outgoing"]||(i["bpmn:outgoing"]=[]),i["bpmn:outgoing"].push(n)})),null===(i=t["bpmn:subProcess"])||void 0===i||i.forEach((function(e){var n={"bpmn:incoming":new Set,"bpmn:outgoing":new Set},i=[];e.children.forEach((function(i){var r,a=o.get(i["-id"]);["bpmn:incoming","bpmn:outgoing"].forEach((function(t){a[t]&&a[t].forEach((function(e){n[t].add(e)}))}));var s=null===(r=t[i["-type"]])||void 0===r?void 0:r.findIndex((function(t){return t["-id"]===i["-id"]}));s>=0&&t[i["-type"]].splice(s,1),o.delete(i["-id"]),e[i["-type"]]||(e[i["-type"]]=[]),e[i["-type"]].push(a)}));var r=n["bpmn:incoming"];n["bpmn:outgoing"].forEach((function(t){r.has(t)&&i.push(t)}));for(var s,l=function(t){var n=a.findIndex((function(e){return e["-id"]===i[t]}));n>=0?(e["bpmn:sequenceFlow"]||(e["bpmn:sequenceFlow"]=[]),e["bpmn:sequenceFlow"].push(a[n]),a.splice(n,1)):t++,s=t},u=0;u<i.length;)l(u),u=s;delete e.children})),t[Eg.FLOW]=a}(r,t,e);var a={"-id":"BPMNPlane_1","-bpmnElement":r["-id"]};Og(a,t);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==e?void 0:e.mapping)||void 0===i?void 0:i.out){var u=null===(o=null==e?void 0:e.mapping)||void 0===o?void 0:o.out,c=function(t){Array.isArray(t)&&t.forEach((function(t){return c(t)})),"object"==typeof t&&Object.keys(t).forEach((function(e){var n;(n=u[e])?(t[n]=fn.cloneDeep(t[e]),delete t[e],c(t[n])):c(t[e])}))};c(l)}return l},this.adapterIn=function(t,e){if(t)return Dg(t,e)},e.adapterIn=this.adapterIn,e.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 t.prototype.setCustomShape=function(e,n){t.shapeConfigMap.set(e,n)},t.pluginName="bpmn-adapter",t.shapeConfigMap=new Map,t}();Bg.shapeConfigMap.set(Eg.START,{width:Jp,height:Qp}),Bg.shapeConfigMap.set(Eg.END,{width:tg,height:eg}),Bg.shapeConfigMap.set(Eg.INTERMEDIATE_CATCH,{width:og,height:rg}),Bg.shapeConfigMap.set(Eg.INTERMEDIATE_THROW,{width:og,height:rg}),Bg.shapeConfigMap.set(Eg.BOUNDARY,{width:ng,height:ig}),Bg.shapeConfigMap.set(Eg.PARALLEL_GATEWAY,{width:ag,height:sg}),Bg.shapeConfigMap.set(Eg.INCLUSIVE_GATEWAY,{width:lg,height:ug}),Bg.shapeConfigMap.set(Eg.EXCLUSIVE_GATEWAY,{width:cg,height:dg}),Bg.shapeConfigMap.set(Eg.SYSTEM,{width:hg,height:fg}),Bg.shapeConfigMap.set(Eg.USER,{width:pg,height:gg}),Bg.shapeConfigMap.set(Eg.SUBPROCESS,{width:vg,height:mg});var jg=function(t){function e(e){var n=t.call(this,e)||this;n.adapterXmlIn=function(t){var e,i=(e=t,(new yg.ObjTree).parseXML(e));return n.adapterIn(i,n.props)},n.adapterXmlOut=function(t){return function(t){var e="";for(var n in t)e+=_g(t[n],n,0);return e}(n.adapterOut(t,n.props))};var i=e.lf,o=e.props;return i.adapterIn=n.adapterXmlIn,i.adapterOut=n.adapterXmlOut,n.props=o,n}return p(e,t),e.pluginName="BPMNAdapter",e}(Bg),Fg={};function Hg(t){return t.startsWith("data:text/plain")}function Wg(t){return y(this,void 0,void 0,(function(){return b(this,(function(e){return Fg[t]?[2,Fg[t]]:[2,new Promise((function(e,n){try{fetch(t).then((function(t){return t.blob()})).then((function(i){var o=new FileReader;o.onloadend=function(){e(Fg[t]=o.result)},o.onerror=n,o.readAsDataURL(i)})).catch((function(){e(Fg[t]=t)}))}catch(e){return Fg[t]=t}}))]}))}))}function zg(t,e){return y(this,void 0,void 0,(function(){var n,i,o;return b(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(n=t.getAttribute(e)||"").startsWith("data:")?[2]:[4,Wg(n)];case 1:return Hg(i=r.sent())?[2]:(t.setAttribute(e,i),[3,3]);case 2:return o=r.sent(),console.error(o),[3,3];case 3:return[2]}}))}))}function Ug(t,e){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]),e.startsWith("data:")?[2]:[4,Wg(e)];case 1:return Hg(n=o.sent())?[2]:(t.style.backgroundImage="url(".concat(n,")"),[3,3]);case 2:return i=o.sent(),console.error(i),[3,3];case 3:return[2]}}))}))}function qg(t){return y(this,void 0,void 0,(function(){var e,n,i,o,r,a,s,l,u;return b(this,(function(c){switch(c.label){case 0:for(e=[t],i=[];e.length;)(n=e.shift()).children.length&&e.push.apply(e,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(Ug(n,u))),(l=a.match(/url\(["']?(.*?)["']?\)/))&&l[1]&&(u=l[1],i.push(Ug(n,u)))),n instanceof HTMLImageElement?i.push(zg(n,"src")):n instanceof SVGImageElement&&i.push(zg(n,"href"));return[4,Promise.all(i)];case 1:return c.sent(),[2]}}))}))}function Gg(t,e,n){var i=document.createElement("canvas");i.width=e,i.height=n;var o=i.getContext("2d");return o&&o.drawImage(t,0,0,t.width,t.height,0,0,e,n),i}var Vg,Kg=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.customCssRules="",this.useGlobalRules=!0,e.getSnapshot=function(t,e){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshot(t,e)];case 1:return[2,n.sent()]}}))}))},e.getSnapshotBlob=function(t,e){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBlob(t,e)];case 1:return[2,n.sent()]}}))}))},e.getSnapshotBase64=function(t,e){return y(n,void 0,void 0,(function(){return b(this,(function(n){switch(n.label){case 0:return[4,this.getSnapshotBase64(t,e)];case 1:return[2,n.sent()]}}))}))}}return t.prototype.getSvgRootElement=function(t){return t.container.querySelector(".lf-canvas-overlay")},t.prototype.triggerDownload=function(t){var e=new MouseEvent("click",{view:document.defaultView,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",this.fileName),n.setAttribute("href",t),n.setAttribute("target","_blank"),n.dispatchEvent(e)},t.prototype.removeAnchor=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,i=0;i<n;i++){var o=e[i];(o.classList&&Array.from(o.classList)||[]).indexOf("lf-anchor")>-1&&(t.removeChild(t.childNodes[i]),n--,i--)}},t.prototype.removeRotateControl=function(t){for(var e=t.childNodes,n=t.childNodes&&t.childNodes.length,i=0;i<n;i++){var o=e[i];(o.classList&&Array.from(o.classList)||[]).indexOf("lf-rotate-control")>-1&&(t.removeChild(t.childNodes[i]),n--,i--)}},t.prototype.getSnapshot=function(t,e){return y(this,void 0,void 0,(function(){var n,i,o,r,a=this;return b(this,(function(s){switch(s.label){case 0:return n=this.lf.graphModel.getPartial(),i=(null!=e?e:{}).partial,o=void 0===i?n:i,r=this.lf.getEditConfig(),this.lf.updateEditConfig({isSilentMode:!0,stopScrollGraph:!0,stopMoveGraph:!0}),n===o?[3,1]:(this.lf.graphModel.setPartial(o),this.lf.graphModel.eventCenter.once("graph:updated",(function(){return y(a,void 0,void 0,(function(){return b(this,(function(i){switch(i.label){case 0:return[4,this.snapshot(t,e)];case 1:return i.sent(),this.lf.graphModel.setPartial(n),[2]}}))}))})),[3,3]);case 1:return[4,this.snapshot(t,e)];case 2:s.sent(),s.label=3;case 3:return this.lf.updateEditConfig(r),[2]}}))}))},t.prototype.snapshot=function(t,e){return y(this,void 0,void 0,(function(){var n,i,o,r,a,s,l,u,c,d=this;return b(this,(function(h){switch(h.label){case 0:return i=(n=null!=e?e:{}).fileType,o=void 0===i?"png":i,r=n.quality,this.fileName="".concat(null!=t?t:"logic-flow.".concat(Date.now()),".").concat(o),[4,qg(a=this.getSvgRootElement(this.lf))];case 1:return h.sent(),"svg"===o?(s=this.cloneSvg(a),l=(new XMLSerializer).serializeToString(s),u=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(u),this.triggerDownload(c)):this.getCanvasData(a,null!=e?e:{}).then((function(t){var e=t.toDataURL("image/".concat(o),r).replace("image/".concat(o),"image/octet-stream");d.triggerDownload(e)})),[2]}}))}))},t.prototype.getSnapshotBase64=function(t,e){return y(this,void 0,void 0,(function(){var n,i=this;return b(this,(function(o){switch(o.label){case 0:return[4,qg(n=this.getSvgRootElement(this.lf))];case 1:return o.sent(),[2,new Promise((function(o){i.getCanvasData(n,{backgroundColor:t}).then((function(t){var n=t.toDataURL("image/".concat(null!=e?e:"png"));o({data:n,width:t.width,height:t.height})}))}))]}}))}))},t.prototype.getSnapshotBlob=function(t,e){return y(this,void 0,void 0,(function(){var n,i=this;return b(this,(function(o){switch(o.label){case 0:return[4,qg(n=this.getSvgRootElement(this.lf))];case 1:return o.sent(),[2,new Promise((function(o){i.getCanvasData(n,{backgroundColor:t}).then((function(t){t.toBlob((function(e){o({data:e,width:t.width,height:t.height})}),"image/".concat(null!=e?e:"png"))}))}))]}}))}))},t.prototype.getClassRules=function(){var t="";if(this.useGlobalRules)for(var e=document.styleSheets,n=0;n<e.length;n++){var i=e[n];try{for(var o=0;o<i.cssRules.length;o++)t+=i.cssRules[o].cssText}catch(t){console.log("CSS scripts from different sources have been filtered out")}}return this.customCssRules&&(t+=this.customCssRules),t},t.prototype.getCanvasData=function(t,e){return y(this,void 0,void 0,(function(){var n,i,o,r,a,s,l,u,c,d,h,f,p,g,v,m,y,x,w,E,C,_,N,S,T,M;return b(this,(function(b){return n=e.width,i=e.height,o=e.backgroundColor,r=e.padding,a=void 0===r?40:r,s=this.cloneSvg(t,!1),(l=window.devicePixelRatio||1)<1&&(l=1),u=this.lf.graphModel.rootEl.querySelector(".lf-base"),c=u.getBoundingClientRect(),d=this.lf.container.querySelector(".lf-canvas-overlay"),h=d.getBoundingClientRect(),f=c.x-h.x,p=c.y-h.y,g=this.lf.graphModel,v=g.transformModel,m=v.SCALE_X,y=v.SCALE_Y,x=v.TRANSLATE_X,w=v.TRANSLATE_Y,s.lastChild.style.transform="matrix(1, 0, 0, 1, ".concat((-f+x)*(1/m),", ").concat((-p+w)*(1/y),")"),E=Math.ceil(c.width/m),C=Math.ceil(c.height/y),(_=document.createElement("canvas")).style.width="".concat(E,"px"),_.style.height="".concat(C,"px"),_.width=E*l+2*a,_.height=C*l+2*a,(N=_.getContext("2d"))&&(N.clearRect(0,0,_.width,_.height),N.scale(l,l),o?(N.fillStyle=o,N.fillRect(0,0,_.width,_.height)):N.clearRect(0,0,_.width,_.height)),S=new Image,(T=document.createElement("style")).innerHTML=this.getClassRules(),(M=document.createElement("foreignObject")).appendChild(T),s.appendChild(M),[2,new Promise((function(t){S.onload=function(){var e=navigator.userAgent.indexOf("Firefox")>-1;try{e?createImageBitmap(S,{resizeWidth:n&&i?Gg(_,n,i).width:_.width,resizeHeight:n&&i?Gg(_,n,i).height:_.height}).then((function(e){null==N||N.drawImage(e,a/l,a/l),t(n&&i?Gg(_,n,i):_)})):(null==N||N.drawImage(S,a/l,a/l),t(n&&i?Gg(_,n,i):_))}catch(e){null==N||N.drawImage(S,a/l,a/l),t(n&&i?Gg(_,n,i):_)}};var e="data:image/svg+xml;charset=utf-8,".concat((new XMLSerializer).serializeToString(s)).replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");S.src=e}))]}))}))},t.prototype.cloneSvg=function(t,e){var n,i=this;void 0===e&&(e=!0);var o=t.cloneNode(!0),r=o.lastChild,a=null===(n=null==r?void 0:r.childNodes)||void 0===n?void 0:n.length;if(a)for(var s=0;s<a;s++){var l=null==r?void 0:r.childNodes[s],u=l.classList&&Array.from(l.classList);if(u&&u.indexOf("lf-base")<0)null==r||r.removeChild(r.childNodes[s]),a--,s--;else{var c=null==r?void 0:r.childNodes[s];c&&c.childNodes.forEach((function(t){var e=t;i.removeAnchor(e.firstChild),i.removeRotateControl(e.firstChild)}))}}if(e){var d=document.createElement("style");d.innerHTML=this.getClassRules();var h=document.createElement("foreignObject");h.appendChild(d),o.appendChild(h)}return o},t.pluginName="snapshot",t}(),Xg={SEQUENCE_FLOW:1,START_EVENT:2,END_EVENT:3,USER_TASK:4,EXCLUSIVE_GATEWAY:6},Yg={1:"bpmn:sequenceFlow",2:"bpmn:startEvent",3:"bpmn:endEvent",4:"bpmn:userTask",6:"bpmn:exclusiveGateway"};function $g(t){switch(t){case"bpmn:sequenceFlow":return Xg.SEQUENCE_FLOW;case"bpmn:startEvent":return Xg.START_EVENT;case"bpmn:endEvent":return Xg.END_EVENT;case"bpmn:userTask":return Xg.USER_TASK;case"bpmn:exclusiveGateway":return Xg.EXCLUSIVE_GATEWAY;default:return t}}!function(t){t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(Vg||(Vg={}));var Zg=function(t,e,n,i){return void 0===i&&(i=0),tv(t,e,n)<=i};function Jg(t){return t*t}function Qg(t,e){return Jg(t.x-e.x)+Jg(t.y-e.y)}var tv=function(t,e,n){return Math.sqrt(function(t,e,n){var i=Qg(e,n);if(0===i)return Qg(t,e);var o=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/i;return o=Math.max(0,Math.min(1,o)),Qg(t,{x:e.x+o*(n.x-e.x),y:e.y+o*(n.y-e.y)})}(t,e,n))},ev=function(t,e,n){var i=function(t){var e=t.x,n=t.y,i=t.width,o=t.height;return{minX:e-i/2,minY:n-o/2,maxX:e+i/2,maxY:n+o/2,x:e,y:n,width:i,height:o,centerX:e,centerY:n}}(t),o=function(t,e){var n;return t.x===e.x?n=Vg.VERTICAL:t.y===e.y&&(n=Vg.HORIZONTAL),n}(e,n),r=Math.max(e.x,n.x),a=Math.min(e.x,n.x),s=Math.max(e.y,n.y),l=Math.min(e.y,n.y),u=t.x,c=t.y,d=t.width,h=t.height;if(o===Vg.HORIZONTAL){if(r>=i.maxX&&a<=i.minX)return{startCrossPoint:{x:e.x>n.x?u+d/2:u-d/2,y:e.y},endCrossPoint:{x:e.x>n.x?u-d/2:u+d/2,y:e.y}}}else if(o===Vg.VERTICAL&&s>=i.maxY&&l<=i.minY)return{startCrossPoint:{x:e.x,y:e.y>n.y?c+h/2:c-h/2},endCrossPoint:{x:e.x,y:e.y>n.y?c-h/2:c+h/2}}},nv=function(t,e,n){void 0===n&&(n=0);for(var i=t.x,o=t.y,r=e.pointsList,a=0;a<r.length-1;a++)if(Zg({x:i,y:o},r[a],r[a+1],n)){var s=ev(t,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}}}},iv=function(){function t(t){var e=t.lf;this._lf=e,this.deviation=20,this.dndAdd=!0,this.dropAdd=!0,this.eventHandler()}return t.prototype.eventHandler=function(){var t=this;this.dndAdd&&this._lf.on("node:dnd-add",(function(e){var n=e.data;t.insetNode(n)})),this.dropAdd&&this._lf.on("node:drop",(function(e){for(var n=e.data,i=t._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&&t.insetNode(n)}))},t.prototype.checkRuleBeforeInsetNode=function(t,n,i,o,r){var a=this._lf.getNodeModelById(t),s=this._lf.getNodeModelById(n),l=a.getAnchorInfo(i),u=s.getAnchorInfo(o),c=a.isAllowConnectedAsSource(r,l,u),d=s.isAllowConnectedAsTarget(r,l,u),h=e.formatAnchorConnectValidateData(c),f=h.isAllPass,p=h.msg,g=e.formatAnchorConnectValidateData(d),v=g.isAllPass;return{isPass:f&&v,sourceMsg:p,targetMsg:g.msg}},t.prototype.insetNode=function(t){var n=this,i=this._lf.graphModel.edges,o=this._lf.getNodeModelById(t.id),r=null==o?void 0:o.getDefaultAnchor();if(!r||0===r.length)this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:"自定义类型节点不显示锚点,也不允许其他节点连接到此节点"});else if(o)for(var a=0;a<i.length;a++){var s=nv(o,i[a],this.deviation),l=s.crossIndex,u=s.crossPoints;if(l>=0){var c=i[a],d=c.sourceNodeId,h=c.targetNodeId,f=c.id,p=c.type,g=c.pointsList,v=c.sourceAnchorId,m=c.targetAnchorId,y=Is(g[0]),b=Is(u.startCrossPoint);this._lf.deleteEdge(f);var x=this.checkRuleBeforeInsetNode(d,h,v,m,t);if(this._lf.addEdge({type:p,sourceNodeId:d,targetNodeId:t.id,startPoint:y,endPoint:b,pointsList:E(E([],w(g.slice(0,l)),!1),[u.startCrossPoint],!1)}),this._lf.addEdge({type:p,sourceNodeId:t.id,targetNodeId:h,startPoint:Is(u.endCrossPoint),endPoint:Is(g[g.length-1]),pointsList:E([u.endCrossPoint],w(g.slice(l)),!1)}),x.isPass)break;this._lf.graphModel.eventCenter.emit(e.EventType.CONNECTION_NOT_ALLOWED,{data:t,msg:x.targetMsg||x.sourceMsg}),setTimeout((function(){n._lf.undo()}),200);break}}},t.pluginName="insertNodeInPolyline",t}(),ov=function(){function t(t){var e=t.lf,n=this;this.controlItems=[{key:"zoom-out",iconClass:"lf-control-zoomOut",title:"缩小流程图",text:"缩小",onClick:function(){n.lf.zoom(!1)}},{key:"zoom-in",iconClass:"lf-control-zoomIn",title:"放大流程图",text:"放大",onClick:function(){n.lf.zoom(!0)}},{key:"reset",iconClass:"lf-control-fit",title:"恢复流程原有尺寸",text:"适应",onClick:function(){n.lf.resetZoom()}},{key:"undo",iconClass:"lf-control-undo",title:"回到上一步",text:"上一步",onClick:function(){n.lf.undo()}},{key:"redo",iconClass:"lf-control-redo",title:"移到下一步",text:"下一步",onClick:function(){n.lf.redo()}}],this.lf=e}return t.prototype.render=function(t,e){this.destroy();var n=this.getControlTool();this.toolEl=n,e.appendChild(n),this.domContainer=e},t.prototype.destroy=function(){this.domContainer&&this.toolEl&&this.domContainer.contains(this.toolEl)&&this.domContainer.removeChild(this.toolEl)},t.prototype.addItem=function(t){this.controlItems.push(t)},t.prototype.removeItem=function(t){var e=this.controlItems.findIndex((function(e){return e.key===t}));return-1==e?null:this.controlItems.splice(e,1)[0]},t.prototype.getControlTool=function(){var t=this,e="lf-control-item",n="lf-control-item disabled",i=document.createElement("div"),o=[];return i.className="lf-control",this.controlItems.forEach((function(i){var r=document.createElement("div"),a=document.createElement("i"),s=document.createElement("span");switch(r.className=n,i.onClick&&(r.onclick=i.onClick.bind(null,t.lf)),i.onMouseEnter&&(r.onmouseenter=i.onMouseEnter.bind(null,t.lf)),i.onMouseLeave&&(r.onmouseleave=i.onMouseLeave.bind(null,t.lf)),a.className=i.iconClass,s.className="lf-control-text",s.title=i.title,s.innerText=i.text,r.append(a,s),i.text){case"上一步":t.lf.on("history:change",(function(t){var i=t.data.undoAble;r.className=i?e:n}));break;case"下一步":t.lf.on("history:change",(function(t){var i=t.data.redoAble;r.className=i?e:n}));break;default:r.className=e}o.push(r)})),i.append.apply(i,E([],w(o),!1)),i},t.pluginName="control",t}(),rv="lf:defaultNodeMenu",av="lf:defaultEdgeMenu",sv="lf:defaultGraphMenu",lv="lf:defaultSelectionMenu",uv=function(){function t(t){var e=t.lf,n=this;this.__currentData=null,this.lf=e,e.options.isSilentMode||(this.__menuDOM=document.createElement("ul"),this.menuTypeMap=new Map,this.init(),this.lf.setMenuConfig=function(t){n.setMenuConfig(t)},this.lf.addMenuConfig=function(t){n.addMenuConfig(t)},this.lf.setMenuByType=function(t){n.setMenuByType(t)})}return t.prototype.init=function(){var t,e,n,i,o=this,r=[{text:"删除",callback:function(t){o.lf.deleteNode(t.id)}},{text:"编辑文本",callback:function(t){o.lf.graphModel.editText(t.id)}},{text:"复制",callback:function(t){o.lf.cloneNode(t.id)}}];null===(t=this.menuTypeMap)||void 0===t||t.set(rv,r);var a=[{text:"删除",callback:function(t){o.lf.deleteEdge(t.id)}},{text:"编辑文本",callback:function(t){o.lf.graphModel.editText(t.id)}}];null===(e=this.menuTypeMap)||void 0===e||e.set(av,a),null===(n=this.menuTypeMap)||void 0===n||n.set(sv,[]);var s=[{text:"删除",callback:function(t){o.lf.clearSelectElements(),t.edges.forEach((function(t){return o.lf.deleteEdge(t.id)})),t.nodes.forEach((function(t){return o.lf.deleteNode(t.id)}))}}];null===(i=this.menuTypeMap)||void 0===i||i.set(lv,s)},t.prototype.render=function(t,e){var n=this;t.options.isSilentMode||(this.__container=e,this.__currentData=null,this.__menuDOM&&(this.__menuDOM.className="lf-menu",e.appendChild(this.__menuDOM),this.__menuDOM.addEventListener("click",(function(t){t.stopPropagation();for(var e=t.target;-1===Array.from(e.classList).indexOf("lf-menu-item")&&-1===Array.from(e.classList).indexOf("lf-menu");)e=null==e?void 0:e.parentElement;Array.from(e.classList).indexOf("lf-menu-item")>-1?(e.onclickCallback(n.__currentData),n.__menuDOM&&(n.__menuDOM.style.display="none"),n.__currentData=null):console.warn("点击区域不在菜单项内,请检查代码!")}),!0)),this.lf.on("node:contextmenu",(function(t){var e,i,o=t.data,r=t.position,a=t.e,s=r.domOverlayPosition,l=s.x,u=s.y,c=o.id,d=n.lf.graphModel.getNodeModelById(c);if(d){var h=[],f=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(d.type);h=d&&d.menu&&Array.isArray(d.menu)?d.menu:f||(null===(i=n.menuTypeMap)||void 0===i?void 0:i.get(rv)),n.__currentData=o,n.showMenu(l,u,h,{width:d.width,height:d.height,clientX:a.clientX,clientY:a.clientY})}})),this.lf.on("edge:contextmenu",(function(t){var e,i,o,r=t.data,a=t.position,s=t.e,l=a.domOverlayPosition,u=l.x,c=l.y,d=r.id,h=n.lf.graphModel.getEdgeModelById(d);if(h){var f=[],p=null===(e=n.menuTypeMap)||void 0===e?void 0:e.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(av))&&void 0!==o?o:[]),n.__currentData=r,n.showMenu(u,c,f,{width:h.width,height:h.height,clientX:s.clientX,clientY:s.clientY})}})),this.lf.on("blank:contextmenu",(function(t){var e,i,o=t.position,r=null!==(i=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(sv))&&void 0!==i?i:[],a=o.domOverlayPosition,s=a.x,l=a.y;n.showMenu(s,l,r)})),this.lf.on("selection:contextmenu",(function(t){var e,i=t.data,o=t.position,r=null===(e=n.menuTypeMap)||void 0===e?void 0:e.get(lv),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"})))},t.prototype.destroy=function(){var t;this.__menuDOM&&(null===(t=null==this?void 0:this.__container)||void 0===t||t.removeChild(this.__menuDOM),this.__menuDOM=void 0)},t.prototype.showMenu=function(t,e,n,i){if(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(e,"px"),void(o.style.left="".concat(t,"px"));var r=i.width,a=i.height,s=i.clientX,l=i.clientY,u=this.lf.graphModel,c=o.offsetWidth,d=!0,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f=h-s,p=u.rootEl.getBoundingClientRect(),g=p.left+p.width;g<h&&(f=g-s),f<c&&(d=!1),o.style.left="".concat(d?t:t-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?e:e-a,"px")}}},t.prototype.setMenuByType=function(t){var e;t.type&&t.menu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(t.type,t.menu))},t.prototype.__getMenuDom=function(t){var e=[];return t&&t.length>0&&t.forEach((function(t){var n=document.createElement("li");if(t.className?n.className="lf-menu-item ".concat(t.className):n.className="lf-menu-item",!0===t.icon){var i=document.createElement("span");i.className="lf-menu-item-icon",n.appendChild(i)}var o=document.createElement("span");o.className="lf-menu-item-text",t.text&&(o.innerText=t.text),n.appendChild(o),n.onclickCallback=t.callback,e.push(n)})),e},t.prototype.setMenuConfig=function(t){var e,n,i;t&&(void 0!==t.nodeMenu&&(null===(e=this.menuTypeMap)||void 0===e||e.set(rv,t.nodeMenu?t.nodeMenu:[])),void 0!==t.edgeMenu&&(null===(n=this.menuTypeMap)||void 0===n||n.set(av,t.edgeMenu?t.edgeMenu:[])),void 0!==t.graphMenu&&(null===(i=this.menuTypeMap)||void 0===i||i.set(sv,t.graphMenu?t.graphMenu:[])))},t.prototype.addMenuConfig=function(t){var e,n,i,o,r,a,s,l,u;if(t){if(Array.isArray(t.nodeMenu)){var c=null!==(n=null===(e=this.menuTypeMap)||void 0===e?void 0:e.get(rv))&&void 0!==n?n:[];null===(i=this.menuTypeMap)||void 0===i||i.set(rv,c.concat(t.nodeMenu))}if(Array.isArray(t.edgeMenu)){c=null!==(r=null===(o=this.menuTypeMap)||void 0===o?void 0:o.get(av))&&void 0!==r?r:[];null===(a=this.menuTypeMap)||void 0===a||a.set(av,c.concat(t.edgeMenu))}if(Array.isArray(t.graphMenu)){c=null!==(l=null===(s=this.menuTypeMap)||void 0===s?void 0:s.get(sv))&&void 0!==l?l:[];null===(u=this.menuTypeMap)||void 0===u||u.set(sv,c.concat(t.graphMenu))}}},t.prototype.changeMenuItem=function(t,e){if("add"===t)this.addMenuConfig(e);else{if("reset"!==t)throw new Error("The first parameter of changeMenuConfig should be 'add' or 'reset'");this.setMenuConfig(e)}},t.pluginName="menu",t}(),cv="menu-common",dv=function(){function t(t){var e=t.lf,n=this;this.menuTypeMap=new Map,this.listenDelete=function(){n.hideContextMenu()},this.lf=e,this.__menuDOM=document.createElement("div"),this.__menuDOM.className="lf-inner-context",this.menuTypeMap.set(cv,[]),this.lf.setContextMenuByType=function(t,e){n.setContextMenuByType(t,e)},this.lf.setContextMenuItems=function(t){n.setContextMenuItems(t)},this.lf.showContextMenu=function(t){n.showContextMenu(t)},this.lf.hideContextMenu=function(){n.hideContextMenu()}}return t.prototype.render=function(t,e){var n=this;this.container=e,t.on("node:click",(function(t){var e=t.data;n._activeData=e,n.createContextMenu()})),t.on("edge:click",(function(t){var e=t.data;n._activeData=e,n.createContextMenu()})),t.on("blank:click",(function(){n.hideContextMenu()}))},t.prototype.setContextMenuByType=function(t,e){this.menuTypeMap.set(t,e)},t.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},t.prototype.showContextMenu=function(t){t&&t.id?(this._activeData=t,this.createContextMenu()):console.warn("请检查传入的参数")},t.prototype.setContextMenuItems=function(t){this.menuTypeMap.set(cv,t)},t.prototype.getContextMenuPosition=function(){var t=this._activeData,e=this.lf.graphModel.getElement(t.id);if(e){var n,i;if("edge"===e.BaseType){n=Number.MIN_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER;var o=e.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(t){n=Math.max(t.x,n),i=Math.min(t.y,i)}))}return"node"===e.BaseType&&(n=t.x+e.width/2,i=t.y-e.height/2),this.lf.graphModel.transformModel.CanvasPointToHtmlPoint([n,i])}},t.prototype.createContextMenu=function(){var t=this;if(!this.lf.options.isSilentMode){var e=E(E([],w(this.menuTypeMap.get(this._activeData.type)||[]),!1),w(this.menuTypeMap.get(cv)||[]),!1),n=document.createDocumentFragment();e.forEach((function(e){var i=document.createElement("div");i.className="lf-context-item";var o=document.createElement("img");o.src=e.icon,o.className="lf-context-img",e.className&&(i.className="".concat(i.className," ").concat(e.className)),o.addEventListener("click",(function(){t.hideContextMenu(),e.callback?e.callback(t._activeData):t.addNode({sourceId:t._activeData.id,x:t._activeData.x,y:t._activeData.y,properties:e.properties,type:e.type})})),i.appendChild(o),n.appendChild(i)})),this.__menuDOM.innerHTML="",this.__menuDOM.appendChild(n),this.showMenu()}},t.prototype.addNode=function(t,e){var n=void 0!==e;void 0===e&&(e=t.y);var i=this.lf.getNodeModelById(t.sourceId);if(i){var o=t.x-i.width+200,r=e-t.y/2-20,a=t.x+i.width+200,s=e+t.y/2+20;if(this.lf.getAreaElement([o,r],[a,s]).length)return e+=100,void this.addNode(t,e);if(t.type){var l=this.lf.addNode({type:t.type,x:t.x+200,y:e,properties:t.properties}),u=void 0,c=void 0;n&&(u={x:t.x,y:t.y+i.height/2},c={x:l.x-l.width/2,y:l.y}),this.lf.addEdge({sourceNodeId:t.sourceId,targetNodeId:l.id,startPoint:u,endPoint:c})}}},t.prototype.showMenu=function(){var t=this.getContextMenuPosition();if(t){var e=w(t,2),n=e[0],i=e[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}},t.pluginName="contextMenu",t}(),hv=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.lf.setPatternItems=function(t){n.setPatternItems(t)}}return t.prototype.render=function(t,e){var n=this;this.destroy(),this.shapeList&&0!==this.shapeList.length?(this.panelEl=document.createElement("div"),this.panelEl.className="lf-dndpanel",this.shapeList.forEach((function(t){var e;null===(e=n.panelEl)||void 0===e||e.appendChild(n.createDndItem(t))})),e.appendChild(this.panelEl),this.domContainer=e):this.domContainer=e},t.prototype.destroy=function(){this.domContainer&&this.panelEl&&this.domContainer.contains(this.panelEl)&&this.domContainer.removeChild(this.panelEl)},t.prototype.setPatternItems=function(t){this.shapeList=t,this.domContainer&&this.render(this.lf,this.domContainer)},t.prototype.createDndItem=function(t){var e=this,n=document.createElement("div");n.className=t.className?"lf-dnd-item ".concat(t.className):"lf-dnd-item";var i=document.createElement("div");if(i.className="lf-dnd-shape",t.icon&&(i.style.backgroundImage="url(".concat(t.icon,")")),n.appendChild(i),t.label){var o=document.createElement("div");o.innerText=t.label,o.className="lf-dnd-text",n.appendChild(o)}return t.disabled?(n.classList.add("disabled"),n.onmousedown=function(){t.callback&&t.callback(e.lf,e.domContainer)},n):(n.onmousedown=function(){t.type&&e.lf.dnd.startDrag({type:t.type,properties:t.properties,text:t.text}),t.callback&&t.callback(e.lf,e.domContainer)},n.ondblclick=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-dbclick",{e:n,data:t})},n.onclick=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-click",{e:n,data:t})},n.oncontextmenu=function(n){e.lf.graphModel.eventCenter.emit("dnd:panel-contextmenu",{e:n,data:t})},n)},t.pluginName="dndPanel",t}(),fv=function(){function t(t){var e=t.lf,n=this;this.disabled=!0,this.isDefaultStopMoveGraph=!1,this.isWholeNode=!0,this.isWholeEdge=!0,this.draw=function(t){var e=n.lf.getPointByClient(t.clientX,t.clientY).domOverlayPosition,i=e.x,o=e.y;if(n.endPoint={x:i,y:o},n.startPoint){var r=n.startPoint,a=r.x,s=r.y,l=a,u=s,c=i-a,d=o-s;i<a&&(l=i,c=a-i),o<s&&(u=o,d=s-o),n.wrapper&&(n.wrapper.style.left="".concat(l,"px"),n.wrapper.style.top="".concat(u,"px"),n.wrapper.style.width="".concat(c,"px"),n.wrapper.style.height="".concat(d,"px"))}},this.drawOff=function(){var t;if(document.removeEventListener("mousemove",n.draw),document.removeEventListener("mouseup",n.drawOff),n.wrapper&&(n.wrapper.oncontextmenu=null,null===(t=n.container)||void 0===t||t.removeChild(n.wrapper)),n.startPoint&&n.endPoint){var e=n.startPoint,i=e.x,o=e.y,r=n.endPoint,a=r.x,s=r.y,l=[Math.min(i,a),Math.min(o,s)],u=[Math.max(i,a),Math.max(o,s)];if(n.lf.emit("selection:selected-area",{topLeft:l,bottomRight:u}),Math.abs(a-i)<10&&Math.abs(s-o)<10)return;var c=n.lf.graphModel.getAreaElement(l,u,n.isWholeEdge,n.isWholeNode,!0),d=n.lf.graphModel.group;c.forEach((function(t){d&&d.getNodeGroup(t.id)||n.lf.selectElementById(t.id,!0)})),n.lf.emit("selection:selected",c)}},this.lf=e;var i=e.getEditConfig().stopMoveGraph;this.isDefaultStopMoveGraph=i,e.openSelectionSelect=function(){n.openSelectionSelect()},e.closeSelectionSelect=function(){n.closeSelectionSelect()}}return t.prototype.render=function(t,e){var n=this;this.container=e,t.on("blank:mousedown",(function(i){var o=i.e;if(t.getEditConfig().stopMoveGraph&&!n.disabled&&!(2===o.button)){var r=t.getPointByClient(o.clientX,o.clientY).domOverlayPosition,a=r.x,s=r.y;n.startPoint={x:a,y:s},n.endPoint={x:a,y:s};var l=document.createElement("div");l.className="lf-selection-select",l.oncontextmenu=function(t){t.preventDefault()},l.style.top="".concat(n.startPoint.y,"px"),l.style.left="".concat(n.startPoint.x,"px"),e.appendChild(l),n.wrapper=l,document.addEventListener("mousemove",n.draw),document.addEventListener("mouseup",n.drawOff)}}))},t.prototype.setSelectionSense=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0),this.isWholeEdge=t,this.isWholeNode=e},t.prototype.openSelectionSelect=function(){this.lf.getEditConfig().stopMoveGraph||(this.isDefaultStopMoveGraph=!1,this.lf.updateEditConfig({stopMoveGraph:!0})),this.open()},t.prototype.closeSelectionSelect=function(){this.isDefaultStopMoveGraph||this.lf.updateEditConfig({stopMoveGraph:!1}),this.close()},t.prototype.open=function(){this.disabled=!1},t.prototype.close=function(){this.disabled=!0},t.pluginName="selectionSelect",t}(),pv=function(){function t(t){var e=t.lf,n=t.LogicFlow,i=t.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.render=function(t,e){o.container=e,o.lf.on("history:change",(function(){o.isShow&&o.setView()})),o.lf.on("graph:transform",(function(){o.isShow&&o.setView(!1)}))},this.show=function(t,e){o.isShow||(o.createMiniMap(t,e),o.setView()),o.isShow=!0},this.hide=function(){o.isShow&&(o.removeMiniMap(),o.lf.emit("miniMap:close",{})),o.isShow=!1},this.updatePosition=function(t){if("object"==typeof t)void 0===t.left&&void 0===t.right||(o.leftPosition=t.left,o.rightPosition=t.right),void 0===t.top&&void 0===t.bottom||(o.topPosition=t.top,o.bottomPosition=t.bottom);else switch(t){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(t){o.showEdge!==t&&(o.showEdge=t,o.setView())},this.startDrag=function(t){document.addEventListener("mousemove",o.drag),document.addEventListener("mouseup",o.drop);var e=t.x,n=t.y;o.startPosition={x:e,y:n}},this.drag=function(t){var e=t.x,n=t.y,i=(e-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:e,y:n},o.lf.focusOn({coordinate:{x:a,y:s}})},this.drop=function(){document.removeEventListener("mousemove",o.drag),document.removeEventListener("mouseup",o.drop)},this.mapClick=function(t){var e=t.offsetX,n=t.offsetY,i=o.translateX+e/o.scale,r=o.translateY+n/o.scale;o.lf.focusOn({coordinate:{x:i,y:r}})},this.lf=e,this.LFCtor=n,i&&this.setOption(i),this.viewPortWidth=e.graphModel.width,this.viewPortHeight=e.graphModel.height;var r={left:0,right:this.viewPortWidth,top:0,bottom:this.viewPortHeight};this.bounds=r,this.elementAreaBounds=r,this.viewPortBounds=r,this.initMiniMap()}return t.prototype.setOption=function(t){var e=t.width,n=void 0===e?150:e,i=t.height,o=void 0===i?220:i,r=t.showEdge,a=void 0!==r&&r,s=t.isShowHeader,l=void 0!==s&&s,u=t.isShowCloseIcon,c=void 0!==u&&u,d=t.leftPosition,h=t.topPosition,f=t.rightPosition,p=void 0===f?0:f,g=t.bottomPosition,v=void 0===g?0:g,m=t.headerTitle,y=void 0===m?"导航":m;this.width=n,this.height=o,this.showEdge=a,this.isShowHeader=l,this.isShowCloseIcon=c,this.leftPosition=d,this.rightPosition=void 0!==d?void 0:p,this.topPosition=h,this.bottomPosition=void 0!==h?void 0:v,this.headerTitle=y},t.prototype.initMiniMap=function(){var t=document.createElement("div");t.className="lf-mini-map-graph",t.style.width="".concat(this.width,"px"),t.style.height="".concat(this.height,"px"),this.lfMap=new this.LFCtor({container:t,grid:!1,isSilentMode:!0,stopZoomGraph:!0,stopScrollGraph:!0,stopMoveGraph:!1,history:!1,snapline:!1,disabledPlugins:this.disabledPlugins}),this.miniMapWrap=t,this.createViewPort(),t.addEventListener("click",this.mapClick)},t.prototype.createMiniMap=function(t,e){var n,i=document.createElement("div");this.miniMapContainer=i,i.appendChild(this.miniMapWrap),i.style.position="absolute",void 0===t&&void 0===e||(this.leftPosition=t||0,this.topPosition=e||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)},t.prototype.updateMiniMapPosition=function(){if(this.miniMapContainer){var t=this.miniMapContainer.style;void 0!==this.rightPosition?(t.right="".concat(this.rightPosition,"px"),t.left=""):(t.left="".concat(this.leftPosition,"px"),t.right=""),void 0!==this.bottomPosition?(t.bottom="".concat(this.bottomPosition,"px"),t.top=""):(t.top="".concat(this.topPosition,"px"),t.bottom="")}},t.prototype.removeMiniMap=function(){var t;this.miniMapContainer&&(null===(t=this.container)||void 0===t||t.removeChild(this.miniMapContainer))},t.prototype.updateBounds=function(t){t&&this.updateElementAreaBounds(t),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)}},t.prototype.updateElementAreaBounds=function(t){var e={left:0,right:0,top:0,bottom:0},n=t.nodes;n&&n.length>0&&n.forEach((function(t){var n,i,o=t.x,r=t.y,a=null!==(n=t.width)&&void 0!==n?n:200,s=null!==(i=t.height)&&void 0!==i?i:200,l=o-a/2,u=o+a/2,c=r-s/2,d=r+s/2;e.left=Math.min(l,e.left),e.right=Math.max(u,e.right),e.top=Math.min(c,e.top),e.bottom=Math.max(d,e.bottom)})),this.elementAreaBounds=e},t.prototype.updateViewPortBounds=function(){var t=this.lf.getTransform(),e=t.TRANSLATE_X,n=t.TRANSLATE_Y,i=t.SCALE_X,o=t.SCALE_Y,r=this.lf.graphModel,a=r.width,s=r.height;this.viewPortBounds={left:-e/i,right:(-e+a)/i,top:-n/o,bottom:(-n+s)/o}},t.prototype.resetData=function(t){var e=t.nodes,n=t.edges;return e.forEach((function(t){t.text=void 0})),this.showEdge&&n.forEach((function(t){t.text=void 0})),{nodes:e,edges:this.showEdge?n:[]}},t.prototype.setView=function(t){var e,n;if(void 0===t&&(t=!0),t){var i=this.lf.getGraphRawData(),o=this.resetData(i),r=this.lf.viewMap,a=this.lf.graphModel.modelMap,s=this.lfMap.viewMap;try{for(var l=x(r.keys()),u=l.next();!u.done;u=l.next()){var c=u.value;s.has(c)||this.lfMap.register({type:c,view:r.get(c),model:a.get(c)})}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}this.lfMap.render(o),this.updateBounds(o)}else this.updateBounds();var d=this.bounds,h=d.left,f=d.top,p=d.right-h,g=d.bottom-f,v=this.width/p,m=this.height/g,y=Math.min(v,m);this.scale=y;var b=h-(this.width/y-p)/2,w=f-(this.height/y-g)/2;if(this.lfMap.graphModel.transformModel.translate(-b+this.translateX,-w+this.translateY),this.translateX=b,this.translateY=w,this.miniMapWrap.firstChild){var E=this.miniMapWrap.firstChild.style;E.pointerEvents="none",E.transform="matrix(".concat(y,", 0, 0, ").concat(y,", 0, 0)"),E.transformOrigin="left top",E.height="".concat(this.height/y,"px"),E.width="".concat(this.width/y,"px"),this.updateViewPort()}},t.prototype.updateViewPort=function(){var t=this.viewport.style,e=this.lf.getTransform(),n=e.TRANSLATE_X,i=e.TRANSLATE_Y,o=e.SCALE_X,r=e.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,t.width="".concat(this.viewPortWidth,"px"),t.height="".concat(this.viewPortHeight,"px"),t.left="".concat((this.viewPortLeft-this.translateX)*this.scale,"px"),t.top="".concat((this.viewPortTop-this.translateY)*this.scale,"px")},t.prototype.createViewPort=function(){var t=document.createElement("div");t.className="lf-minimap-viewport",t.addEventListener("mousedown",this.startDrag),t.addEventListener("click",(function(t){t.stopPropagation()})),this.viewport=t},t.pluginName="miniMap",t}(),gv={tr:"tl",lb:"tl",tl:"tr",rb:"tr",br:"bl",lt:"bl",bl:"br",rt:"br"};function vv(t,e,n,i){var o,r="",a="";t[0]===e[0]?r=t[1]>e[1]?"t":"b":t[1]===e[1]&&(r=t[0]>e[0]?"l":"r"),e[0]===n[0]?a=e[1]>n[1]?"t":"b":e[1]===n[1]&&(a=e[0]>n[0]?"l":"r");var s=Math.min(Math.hypot(e[0]-t[0],e[1]-t[1])/2,Math.hypot(n[0]-e[0],n[1]-e[1])/2,i)||.2*i,l="".concat(r).concat(a),u=gv[l]||"-",c="L ".concat(t[0]," ").concat(t[1]);if("-"===u)c+="L ".concat(e[0]," ").concat(e[1]," L ").concat(n[0]," ").concat(n[1]);else{var d=w(function(t,e,n,i){var o=[t[0],t[1]],r=[t[0],t[1]];switch(n){case"tl":return"tr"===e?(o[1]+=i,r[0]+=i):"lb"===e&&(o[0]+=i,r[1]+=i),[o,r];case"tr":return"tl"===e?(o[1]+=i,r[0]-=i):"rb"===e&&(o[0]-=i,r[1]+=i),[o,r];case"bl":return"br"===e?(o[1]-=i,r[0]+=i):"lt"===e&&(o[0]+=i,r[1]-=i),[o,r];case"br":return"bl"===e?(o[1]-=i,r[0]-=i):"rt"===e&&(o[0]-=i,r[1]-=i),[o,r];default:return[]}}(e,l,u,s),2),h=d[0],f=d[1];h&&f&&(c+="L ".concat(h[0]," ").concat(h[1]," Q ").concat(e[0]," ").concat(e[1]," ").concat(f[0]," ").concat(f[1]),o=w(f,2),e[0]=o[0],e[1]=o[1])}return c}function mv(t,e){var n=0,i="";if(2===t.length)i+="M".concat(t[n][0]," ").concat(t[n++][1]," L ").concat(t[n][0]," ").concat(t[n][1]);else{for(i+="M".concat(t[n][0]," ").concat(t[n++][1]);n+1<t.length;){i+=vv(t[n-1],t[n],t[1+n++],e)}i+="L ".concat(t[n][0]," ").concat(t[n][1])}return i}var yv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),n.prototype.getEdge=function(){var t=this.props.model,n=t.points,i=t.isAnimation,o=t.arrowConfig,r=t.radius,a=void 0===r?5:r,s=t.getEdgeStyle(),l=t.getEdgeAnimationStyle(),u=function(t){for(var e=t,n=1;n<e.length-1;){var i=w(e[n-1],2),o=i[0],r=i[1],a=w(e[n],2),s=a[0],l=a[1],u=w(e[n+1],2),c=u[0],d=u[1];o===s&&s===c||r===l&&l===d?e.splice(n,1):n++}return e}(n.split(" ").map((function(t){return t.split(",").map((function(t){return+t}))}))),c=mv(u,a),d=g(g(g({style:i?l:{}},s),o),{fill:"none"});return e.h("path",g({d:c},d))},n}(e.PolylineEdge),bv=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e}(e.PolylineEdgeModel),xv=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return p(n,t),n.prototype.getLabelShape=function(){var t=this.props.model,n=t.id,i=t.x,o=t.y,r=t.width,a=t.height,s=t.properties,l=this.props.model.getNodeStyle();return e.h("svg",{x:i-r/2,y:o-a/2,width:50,height:24,style:"z-index: 0; background: none; overflow: auto;"},[s.labelText?e.h("text",{x:0,y:-5,fontSize:"16px",fill:l.stroke},s.labelText):"",s.disabledDelete?"":e.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 t=this.props.model,n=t.x,i=t.y,o=t.width,r=t.height,a=t.id,s=this.props.model.getNodeStyle();return e.h("g",{},[e.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(t){this.props.graphModel.deleteNode(t)},n}(e.PolygonNode),wv=function(t){function e(){var e=t.apply(this,E([],w(arguments),!1))||this;return e.d=10,e}return p(e,t),e.prototype.initNodeData=function(e){e.text={value:"",x:e.x,y:e.y,draggable:!1,editable:!1},t.prototype.initNodeData.call(this,e),this.zIndex=0,this.draggable=!0},e.prototype.setAttributes=function(){var t,e=this;this.points=[],(null===(t=this.properties)||void 0===t?void 0:t.node_selection_ids).length>1&&setTimeout((function(){var t;e.updatePointsByNodes((null===(t=e.properties)||void 0===t?void 0:t.node_selection_ids)||[])}))},e.prototype.getNodeStyle=function(){var e=t.prototype.getNodeStyle.call(this);return e.stroke=this.properties.strokeColor||"#008000",e.strokeDasharray="10 5",e},e.prototype.getDefaultAnchor=function(){return[]},e.prototype.updatePoints=function(t){this.points=t},e.prototype.updateCoordinate=function(t){var e=t.x,n=t.y;this.x=e,this.y=n},e.prototype.updatePointsByNodes=function(t){var e=this,n=[],i=1/0,o=1/0,r=-1/0,a=-1/0;t.forEach((function(t){var n=e.graphModel.getNodeModelById(t);if(n){var s=n.width,l=n.height,u=n.x,c=n.y;i=Math.min(i,u-s/2-e.d),o=Math.min(o,c-l/2-e.d),r=Math.max(r,u+s/2+e.d),a=Math.max(a,c+l/2+e.d)}})),n.push([i,o],[r,o],[r,a],[i,a]),[i,o,r,a].some((function(t){return Math.abs(t)===1/0}))||(this.updatePoints(n),this.updateCoordinate({x:(r+i)/2,y:(a+o)/2}))},e}(e.PolygonNodeModel),Ev=function(){function t(t){var e=t.lf;this.selectNodes=[],this.d=10,e.register({type:"node-selection",view:xv,model:wv})}return Object.defineProperty(t.prototype,"selectNodesIds",{get:function(){return this.selectNodes.map((function(t){return t.id}))},enumerable:!1,configurable:!0}),t.prototype.addNodeSelection=function(){this.lf.addNode({type:"node-selection",text:"",properties:{node_selection_ids:this.selectNodesIds}}).updatePointsByNodes(this.selectNodesIds)},t.prototype.updateNodeSelection=function(){var t=this.getNodeSelection();t&&(this.lf.setProperties(t.id,{node_selection_ids:this.selectNodesIds}),this.lf.getNodeModelById(t.id).updatePointsByNodes(this.selectNodesIds))},t.prototype.getNodeSelection=function(){var t=this,e=this.selectNodesIds,n=this.lf.getGraphRawData(),i=e.filter((function(e){return e!==t.currentClickNode.id}));return n.nodes.find((function(t){if("node-selection"===t.type){var e=jo(t,"properties.node_selection_ids",[]);return i.every((function(t){return e.includes(t)}))}return!1}))},t.prototype.render=function(t){var e=this;this.lf=t,t.on("node:click",(function(n){if(n.e.shiftKey&&"node-selection"!==n.data.type){e.currentClickNode=n.data;var i=!1;e.selectNodesIds.includes(n.data.id)&&(e.lf.getNodeModelById(n.data.id).setSelected(!1),i=!0);var o=t.getSelectElements(!0).nodes;e.selectNodes=o,1===e.selectNodes.length?i?e.updateNodeSelection():e.addNodeSelection():e.selectNodes.length>1&&e.updateNodeSelection()}})),t.graphModel.addNodeMoveRules((function(e,n,i){if("node-selection"===e.type){var o=e.properties.node_selection_ids;return t.graphModel.moveNodes(o,n,i,!0),!0}return!0}))},t.pluginName="node-selection",t}(),Cv="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},_v={};
|
|
12
|
+
/*!
|
|
13
|
+
Copyright (c) 2018 Jed Watson.
|
|
14
|
+
Licensed under the MIT License (MIT), see
|
|
15
|
+
http://jedwatson.github.io/classnames
|
|
16
|
+
*/
|
|
17
|
+
!function(t){!function(){var e={}.hasOwnProperty;function n(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=o(t,i(n)))}return t}function i(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var i="";for(var r in t)e.call(t,r)&&t[r]&&(i=o(i,r));return i}function o(t,e){return e?t?t+" "+e:t+e:t}t.exports?(n.default=n,t.exports=n):window.classNames=n}()}({get exports(){return _v},set exports(t){_v=t}});var Nv=_v,Sv=function(t){function n(n){var i=t.call(this,n)||this;i.textRef=e.createRef(),i.setHoverOn=function(){var t=i.props.element;t.isDragging||i.state.isHovered||(i.setState({isHovered:!0}),t.setHovered(!0))},i.setHoverOff=function(){var t=i.props.element;i.state.isHovered&&(i.setState({isHovered:!1}),t.setHovered(!1))},i.handleMouseDown=function(t){var e,n=i.props,o=n.label,r=n.graphModel.editConfigModel.nodeTextDraggable;(null!==(e=o.draggable)&&void 0!==e?e:r)&&!i.state.isDragging&&(i.setState({isDragging:!0}),i.stepDrag.handleMouseDown(t))},i.handleDragging=function(t){var e=t.deltaX,n=t.deltaY,o=i.props,r=o.label,a=o.element,s=o.graphModel,l=w(s.transformModel.fixDeltaXY(e,n),2),u=l[0],c=l[1],d=a.properties._label,h=Wu(d,(function(t){return t.id===r.id})),f=d[h];d[h]=g(g({},f),{x:f.x+u,y:f.y+c});var p=s.getElement(a.id);null==p||p.setProperty("_label",d),s.eventCenter.emit("label:drag",{data:r.getData(),model:r})},i.handleDragEnd=function(){i.setState({isDragging:!1})},i.handleDbClick=function(t){var n=i.props,o=n.label,r=n.element;if(n.graphModel.eventCenter.emit("label:dblclick",{data:o.getData(),e:t,model:r}),o.editable){if(r.setSelected(),r.setElementState(e.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(t){var e=i.props,n=e.label,o=e.element;e.graphModel.eventCenter.emit("label:blur",{e:t,model:o,data:n.getData(),element:i.textRef.current}),i.setState({isDragging:!1,isHovered:!1})},i.reCalcLabelSize=function(){};var o=n.label,r=n.graphModel,a=r.gridSize,s=r.eventCenter;return i.stepDrag=new e.StepDrag({onDragging:i.handleDragging,onDragEnd:i.handleDragEnd,step:a,eventType:"LABEL",model:o,eventCenter:s}),i.state={isEditing:!1,isHovered:!1,isDragging:!1},i}return p(n,t),n.prototype.componentDidMount=function(){var t=this,n=this.props,i=n.label,o=n.element,r=n.graphModel;r.eventCenter.on("blank:click,node:click,edge:click",(function(){var n,a,s,l;if(t.state.isEditing){t.setState({isEditing:!1});var u=null!==(a=null===(n=t.textRef.current)||void 0===n?void 0:n.innerText)&&void 0!==a?a:"",c=null!==(l=null===(s=t.textRef.current)||void 0===s?void 0:s.innerHTML)&&void 0!==l?l:"",d=o.properties._label,h=Wu(d,(function(t){return t.id===i.id})),f=d[h];d[h]=g(g({},f),{value:u,content:c});var p=r.getElement(o.id);null==p||p.setProperty("_label",d),o.setElementState(e.ElementState.DEFAULT)}t.textRef.current&&(t.textRef.current.contentEditable="false")}))},n.prototype.componentDidUpdate=function(){console.log("Label componentDidUpdate")},n.prototype.componentWillUnmount=function(){this.props.graphModel.eventCenter.off("blank:click,node:click,edge:click")},n.prototype.render=function(){var t,e=this.props,n=e.label,i=e.element,o=e.graphModel,r=this.state,a=r.isDragging,s=r.isHovered,l=r.isEditing,u=o.transformModel.getTransformStyle().transform,c=n.id,d=n.x,h=n.y,f=n.zIndex,p=n.vertical,v=n.style,m=n.rotate,y=n.content,b=n.labelWidth,x=n.textOverflowMode,w=null!=b?b:"node"===i.BaseType?i.width-20:80,E={left:"".concat(d-w/2,"px"),top:"".concat(h-10,"px"),width:"".concat(w,"px"),height:"20px",zIndex:null!=f?f:1,transform:m?"".concat(u," rotate(").concat(m,"deg)"):"".concat(u," rotate(").concat(p?-.25:0,"turn)")};return Cp("div",{id:"element-container-".concat(c),className:Nv("lf-label-editor-container"),style:E,onMouseDown:this.handleMouseDown,onDblClick:this.handleDbClick,onBlur:this.handleBlur,onMouseEnter:this.setHoverOn,onMouseOver:this.setHoverOn,onMouseLeave:this.setHoverOff,children:Cp("div",{ref:this.textRef,id:"editor-container-".concat(c),className:Nv("lf-label-editor",(t={"lf-label-editor-dragging":a,"lf-label-editor-editing":l,"lf-label-editor-hover":!l&&s},t["lf-label-editor-".concat(x)]=!l,t)),style:g({maxWidth:"".concat(w,"px"),width:"".concat(w,"px")},v),dangerouslySetInnerHTML:{__html:y}})})},n=m([e.observer],n)}(e.Component),Tv=e.LogicFlowUtil.createUuid,Mv=function(){function t(t,e,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=e,this.graphModel=n,this.id=null!==(i=t.id)&&void 0!==i?i:Tv(),this.initLabelData(t)}return t.prototype.initLabelData=function(t){so(this,t)},t.prototype.getData=function(){return{id:this.id,x:this.x,y:this.y,content:this.content,value:this.value,rotate:this.rotate,style:e.toJS(this.style),draggable:this.draggable,editable:this.editable,labelWidth:this.labelWidth,textOverflowMode:this.textOverflowMode,vertical:this.vertical}},m([e.observable],t.prototype,"x",void 0),m([e.observable],t.prototype,"y",void 0),m([e.observable],t.prototype,"content",void 0),m([e.observable],t.prototype,"value",void 0),m([e.observable],t.prototype,"rotate",void 0),m([e.observable],t.prototype,"style",void 0),m([e.observable],t.prototype,"zIndex",void 0),m([e.observable],t.prototype,"vertical",void 0),m([e.observable],t.prototype,"editable",void 0),m([e.observable],t.prototype,"draggable",void 0),m([e.observable],t.prototype,"labelWidth",void 0),m([e.observable],t.prototype,"textOverflowMode",void 0),t}(),kv={};!function(t){
|
|
18
|
+
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
|
|
19
|
+
"classList"in document.createElement("_")||function(t){if("Element"in t){var e="classList",n="prototype",i=t.Element[n],o=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},a=Array[n].indexOf||function(t){for(var e=0,n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return-1},s=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},l=function(t,e){if(""===e)throw new s("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new s("INVALID_CHARACTER_ERR","String contains an invalid character");return a.call(t,e)},u=function(t){for(var e=r.call(t.getAttribute("class")||""),n=e?e.split(/\s+/):[],i=0,o=n.length;i<o;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute("class",this.toString())}},c=u[n]=[],d=function(){return new u(this)};if(s[n]=Error[n],c.item=function(t){return this[t]||null},c.contains=function(t){return-1!==l(this,t+="")},c.add=function(){var t,e=arguments,n=0,i=e.length,o=!1;do{-1===l(this,t=e[n]+"")&&(this.push(t),o=!0)}while(++n<i);o&&this._updateClassName()},c.remove=function(){var t,e,n=arguments,i=0,o=n.length,r=!1;do{for(e=l(this,t=n[i]+"");-1!==e;)this.splice(e,1),r=!0,e=l(this,t)}while(++i<o);r&&this._updateClassName()},c.toggle=function(t,e){t+="";var n=this.contains(t),i=n?!0!==e&&"remove":!1!==e&&"add";return i&&this[i](t),!0===e||!1===e?e:!n},c.toString=function(){return this.join(" ")},o.defineProperty){var h={get:d,enumerable:!0,configurable:!0};try{o.defineProperty(i,e,h)}catch(t){-2146823252===t.number&&(h.enumerable=!1,o.defineProperty(i,e,h))}}else o[n].__defineGetter__&&i.__defineGetter__(e,d)}}(self)
|
|
20
|
+
/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */,function(t){if(t.URL=t.URL||t.webkitURL,t.Blob&&t.URL)try{return void new Blob}catch(t){}var e=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||function(t){var e=function(t){return Object.prototype.toString.call(t).match(/^\[object\s(.*)\]$/)[1]},n=function(){this.data=[]},i=function(t,e,n){this.data=t,this.size=t.length,this.type=e,this.encoding=n},o=n.prototype,r=i.prototype,a=t.FileReaderSync,s=function(t){this.code=this[this.name=t]},l="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),u=l.length,c=t.URL||t.webkitURL||t,d=c.createObjectURL,h=c.revokeObjectURL,f=c,p=t.btoa,g=t.atob,v=t.ArrayBuffer,m=t.Uint8Array,y=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(i.fake=r.fake=!0;u--;)s.prototype[l[u]]=u+1;return c.createObjectURL||(f=t.URL=function(t){var e,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");return n.href=t,"origin"in n||("data:"===n.protocol.toLowerCase()?n.origin=null:(e=t.match(y),n.origin=e&&e[1])),n}),f.createObjectURL=function(t){var e,n=t.type;return null===n&&(n="application/octet-stream"),t instanceof i?(e="data:"+n,"base64"===t.encoding?e+";base64,"+t.data:"URI"===t.encoding?e+","+decodeURIComponent(t.data):p?e+";base64,"+p(t.data):e+","+encodeURIComponent(t.data)):d?d.call(c,t):void 0},f.revokeObjectURL=function(t){"data:"!==t.substring(0,5)&&h&&h.call(c,t)},o.append=function(t){var n=this.data;if(m&&(t instanceof v||t instanceof m)){for(var o="",r=new m(t),l=0,u=r.length;l<u;l++)o+=String.fromCharCode(r[l]);n.push(o)}else if("Blob"===e(t)||"File"===e(t)){if(!a)throw new s("NOT_READABLE_ERR");var c=new a;n.push(c.readAsBinaryString(t))}else t instanceof i?"base64"===t.encoding&&g?n.push(g(t.data)):"URI"===t.encoding?n.push(decodeURIComponent(t.data)):"raw"===t.encoding&&n.push(t.data):("string"!=typeof t&&(t+=""),n.push(unescape(encodeURIComponent(t))))},o.getBlob=function(t){return arguments.length||(t=null),new i(this.data.join(""),t,"raw")},o.toString=function(){return"[object BlobBuilder]"},r.slice=function(t,e,n){var o=arguments.length;return o<3&&(n=null),new i(this.data.slice(t,o>1?e:this.data.length),n,this.encoding)},r.toString=function(){return"[object Blob]"},r.close=function(){this.size=0,delete this.data},n}(t);t.Blob=function(t,n){var i=n&&n.type||"",o=new e;if(t)for(var r=0,a=t.length;r<a;r++)Uint8Array&&t[r]instanceof Uint8Array?o.append(t[r].buffer):o.append(t[r]);var s=o.getBlob(i);return!s.slice&&s.webkitSlice&&(s.slice=s.webkitSlice),s};var n=Object.getPrototypeOf||function(t){return t.__proto__};t.Blob.prototype=n(new t.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||Cv.content||Cv),function(e,n){"undefined"!=typeof process&&process&&process.versions&&process.versions.electron?e.MediumEditor=n:t.exports=n}(Cv,function(){function t(t,e){return this.init(t,e)}var e,n,i,o,r,a,s,l,u,c,d;return t.extensions={},function(e){function n(t,e){var n,i=Array.prototype.slice.call(arguments,2);e=e||{};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]&&(t||!1===e.hasOwnProperty(n))&&(e[n]=r[n])}return e}var i=!1;try{var o=document.createElement("div"),r=document.createTextNode(" ");o.appendChild(r),i=o.contains(r)}catch(t){}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:e.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(t){return!!(a.isMac&&t.metaKey||!a.isMac&&t.ctrlKey)},isKey:function(t,e){var n=a.getKeyCode(t);return!1===Array.isArray(e)?n===e:-1!==e.indexOf(n)},getKeyCode:function(t){var e=t.which;return null===e&&(e=null!==t.charCode?t.charCode:t.keyCode),e},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 t=[!0].concat(Array.prototype.slice.call(arguments));return n.apply(this,t)},defaults:function(){var t=[!1].concat(Array.prototype.slice.call(arguments));return n.apply(this,t)},createLink:function(t,e,n,i){var o=t.createElement("a");return a.moveTextRangeIntoElement(e[0],e[e.length-1],o),o.setAttribute("href",n),i&&("_blank"===i&&o.setAttribute("rel","noopener noreferrer"),o.setAttribute("target",i)),o},findOrCreateMatchingTextNodes:function(t,e,n){for(var i=t.createTreeWalker(e,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(t,e,n){return e!==n?t.splitText(e-n):null},splitEndNodeIfNeeded:function(t,e,n,i){var o,r;o=i+t.nodeValue.length+(e?e.nodeValue.length:0)-1,r=n-i-(e?t.nodeValue.length:0),o>=n&&i!==o&&0!==r&&(e||t).splitText(r)},splitByBlockElements:function(e){if(3!==e.nodeType&&1!==e.nodeType)return[];var n=[],i=t.util.blockContainerElementNames.join(",");if(3===e.nodeType||0===e.querySelectorAll(i).length)return[e];for(var o=0;o<e.childNodes.length;o++){var r=e.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(t.util.splitByBlockElements(r))}}return n},findAdjacentTextNodeWithContent:function(t,e,n){var i,o=!1,r=n.createNodeIterator(t,NodeFilter.SHOW_TEXT,null,!1);for(i=r.nextNode();i;){if(i===e)o=!0;else if(o&&3===i.nodeType&&i.nodeValue&&i.nodeValue.trim().length>0)break;i=r.nextNode()}return i},findPreviousSibling:function(t){if(!t||a.isMediumEditorElement(t))return!1;for(var e=t.previousSibling;!e&&!a.isMediumEditorElement(t.parentNode);)e=(t=t.parentNode).previousSibling;return e},isDescendant:function(t,e,n){if(!t||!e)return!1;if(t===e)return!!n;if(1!==t.nodeType)return!1;if(i||3!==e.nodeType)return t.contains(e);for(var o=e.parentNode;null!==o;){if(o===t)return!0;o=o.parentNode}return!1},isElement:function(t){return!(!t||1!==t.nodeType)},throttle:function(t,e){var n,i,o,r=null,a=0,s=function(){a=Date.now(),r=null,o=t.apply(n,i),r||(n=i=null)};return e||0===e||(e=50),function(){var l=Date.now(),u=e-(l-a);return n=this,i=arguments,u<=0||u>e?(r&&(clearTimeout(r),r=null),a=l,o=t.apply(n,i),r||(n=i=null)):r||(r=setTimeout(s,u)),o}},traverseUp:function(t,e){if(!t)return!1;do{if(1===t.nodeType){if(e(t))return t;if(a.isMediumEditorElement(t))return!1}t=t.parentNode}while(t);return!1},htmlEntities:function(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},insertHTMLCommand:function(e,n){var i,o,r,s,l,u,c,d=!1,h=["insertHTML",!1,n];if(!t.util.isEdge&&e.queryCommandSupported("insertHTML"))try{return e.execCommand.apply(e,h)}catch(t){}if((i=e.getSelection()).rangeCount){if(c=(o=i.getRangeAt(0)).commonAncestorContainer,a.isMediumEditorElement(c)&&!c.firstChild)o.selectNode(c.appendChild(e.createTextNode("")));else if(3===c.nodeType&&0===o.startOffset&&o.endOffset===c.nodeValue.length||3!==c.nodeType&&c.innerHTML===o.toString()){for(;!a.isMediumEditorElement(c)&&c.parentNode&&1===c.parentNode.childNodes.length&&!a.isMediumEditorElement(c.parentNode);)c=c.parentNode;o.selectNode(c)}for(o.deleteContents(),(r=e.createElement("div")).innerHTML=n,s=e.createDocumentFragment();r.firstChild;)l=r.firstChild,u=s.appendChild(l);o.insertNode(s),u&&((o=o.cloneRange()).setStartAfter(u),o.collapse(!0),t.selection.selectRange(e,o)),d=!0}return e.execCommand.callListeners&&e.execCommand.callListeners(h,d),d},execFormatBlock:function(e,n){var i=a.getTopBlockContainer(t.selection.getSelectionStart(e));if("blockquote"===n){if(i&&Array.prototype.slice.call(i.childNodes).some((function(t){return a.isBlockContainer(t)})))return e.execCommand("outdent",!1,null);if(a.isIE)return e.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 e.execCommand("outdent",!1,n);if((a.isFF||a.isEdge)&&"p"===n)return Array.prototype.slice.call(i.childNodes).some((function(t){return!a.isBlockContainer(t)}))&&e.execCommand("formatBlock",!1,n),e.execCommand("outdent",!1,n)}return e.execCommand("formatBlock",!1,n)},setTargetBlank:function(t,e){var n,i=e||!1;if("a"===t.nodeName.toLowerCase())t.target="_blank",t.rel="noopener noreferrer";else for(t=t.getElementsByTagName("a"),n=0;n<t.length;n+=1)!1!==i&&i!==t[n].attributes.href.value||(t[n].target="_blank",t[n].rel="noopener noreferrer")},removeTargetBlank:function(t,e){var n;if("a"===t.nodeName.toLowerCase())t.removeAttribute("target"),t.removeAttribute("rel");else for(t=t.getElementsByTagName("a"),n=0;n<t.length;n+=1)e===t[n].attributes.href.value&&(t[n].removeAttribute("target"),t[n].removeAttribute("rel"))},addClassToAnchors:function(t,e){var n,i,o=e.split(" ");if("a"===t.nodeName.toLowerCase())for(i=0;i<o.length;i+=1)t.classList.add(o[i]);else{var r=t.getElementsByTagName("a");if(0===r.length){var s=a.getClosestTag(t,"a");t=s?[s]:[]}else t=r;for(n=0;n<t.length;n+=1)for(i=0;i<o.length;i+=1)t[n].classList.add(o[i])}},isListItem:function(t){if(!t)return!1;if("li"===t.nodeName.toLowerCase())return!0;for(var e=t.parentNode,n=e.nodeName.toLowerCase();"li"===n||!a.isBlockContainer(e)&&"div"!==n;){if("li"===n)return!0;if(!(e=e.parentNode))return!1;n=e.nodeName.toLowerCase()}return!1},cleanListDOM:function(e,n){if("li"===n.nodeName.toLowerCase()){var i=n.parentElement;"p"===i.parentElement.nodeName.toLowerCase()&&(a.unwrap(i.parentElement,e),t.selection.moveCursor(e,n.firstChild,n.firstChild.textContent.length))}},splitOffDOMTree:function(t,e,n){for(var i=e,o=null,r=!n;i!==t;){var a,s=i.parentNode,l=s.cloneNode(!1),u=r?i:s.firstChild;for(o&&(r?l.appendChild(o):a=o),o=l;u;){var c=u.nextSibling;u===i?(u.hasChildNodes()?u=u.cloneNode(!1):u.parentNode.removeChild(u),u.textContent&&o.appendChild(u),u=r?c:null):(u.parentNode.removeChild(u),(u.hasChildNodes()||u.textContent)&&o.appendChild(u),u=c)}a&&o.appendChild(a),i=s}return o},moveTextRangeIntoElement:function(t,e,n){if(!t||!e)return!1;var i=a.findCommonRoot(t,e);if(!i)return!1;if(e===t){var o=t.parentNode,r=t.nextSibling;return o.removeChild(t),n.appendChild(t),r?o.insertBefore(n,r):o.appendChild(n),n.hasChildNodes()}for(var s,l,u,c=[],d=0;d<i.childNodes.length;d++)if(u=i.childNodes[d],s){if(a.isDescendant(u,e,!0)){l=u;break}c.push(u)}else a.isDescendant(u,t,!0)&&(s=u);var h=l.nextSibling,f=i.ownerDocument.createDocumentFragment();return s===t?(s.parentNode.removeChild(s),f.appendChild(s)):f.appendChild(a.splitOffDOMTree(s,t)),c.forEach((function(t){t.parentNode.removeChild(t),f.appendChild(t)})),l===e?(l.parentNode.removeChild(l),f.appendChild(l)):f.appendChild(a.splitOffDOMTree(l,e,!0)),n.appendChild(f),l.parentNode===i?i.insertBefore(n,l):h?i.insertBefore(n,h):i.appendChild(n),n.hasChildNodes()},depthOfNode:function(t){for(var e=0,n=t;null!==n.parentNode;)n=n.parentNode,e++;return e},findCommonRoot:function(t,e){for(var n=a.depthOfNode(t),i=a.depthOfNode(e),o=t,r=e;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(t){for(var e;!a.isBlockContainer(t)&&!a.isMediumEditorElement(t);){for(e=t;e=e.previousSibling;)if((3===e.nodeType?e.nodeValue:e.textContent).length>0)return!1;t=t.parentNode}return!0},isMediumEditorElement:function(t){return t&&t.getAttribute&&!!t.getAttribute("data-medium-editor-element")},getContainerEditorElement:function(t){return a.traverseUp(t,(function(t){return a.isMediumEditorElement(t)}))},isBlockContainer:function(t){return t&&3!==t.nodeType&&-1!==a.blockContainerElementNames.indexOf(t.nodeName.toLowerCase())},getClosestBlockContainer:function(t){return a.traverseUp(t,(function(t){return a.isBlockContainer(t)||a.isMediumEditorElement(t)}))},getTopBlockContainer:function(t){var e=!!a.isBlockContainer(t)&&t;return a.traverseUp(t,(function(t){return a.isBlockContainer(t)&&(e=t),!(e||!a.isMediumEditorElement(t))&&(e=t,!0)})),e},getFirstSelectableLeafNode:function(t){for(;t&&t.firstChild;)t=t.firstChild;if("table"===(t=a.traverseUp(t,(function(t){return-1===a.emptyElementNames.indexOf(t.nodeName.toLowerCase())}))).nodeName.toLowerCase()){var e=t.querySelector("th, td");e&&(t=e)}return t},getFirstTextNode:function(t){return a.warn("getFirstTextNode is deprecated and will be removed in version 6.0.0"),a._getFirstTextNode(t)},_getFirstTextNode:function(t){if(3===t.nodeType)return t;for(var e=0;e<t.childNodes.length;e++){var n=a._getFirstTextNode(t.childNodes[e]);if(null!==n)return n}return null},ensureUrlHasProtocol:function(t){return-1===t.indexOf("://")?"http://"+t:t},warn:function(){void 0!==e.console&&"function"==typeof e.console.warn&&e.console.warn.apply(e.console,arguments)},deprecated:function(t,e,n){var i=t+" is deprecated, please use "+e+" instead.";n&&(i+=" Will be removed in "+n),a.warn(i)},deprecatedMethod:function(t,e,n,i){a.deprecated(t,e,i),"function"==typeof this[e]&&this[e].apply(this,n)},cleanupAttrs:function(t,e){e.forEach((function(e){t.removeAttribute(e)}))},cleanupTags:function(t,e){-1!==e.indexOf(t.nodeName.toLowerCase())&&t.parentNode.removeChild(t)},unwrapTags:function(e,n){-1!==n.indexOf(e.nodeName.toLowerCase())&&t.util.unwrap(e,document)},getClosestTag:function(t,e){return a.traverseUp(t,(function(t){return t.nodeName.toLowerCase()===e.toLowerCase()}))},unwrap:function(t,e){for(var n=e.createDocumentFragment(),i=Array.prototype.slice.call(t.childNodes),o=0;o<i.length;o++)n.appendChild(i[o]);n.childNodes.length?t.parentNode.replaceChild(n,t):t.parentNode.removeChild(t)},guid:function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}};t.util=a}(window),(e=function(e){t.util.extend(this,e)}).extend=function(e){var n,i=this;n=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return i.apply(this,arguments)},t.util.extend(n,i);var o=function(){this.constructor=n};return o.prototype=i.prototype,n.prototype=new o,e&&t.util.extend(n.prototype,e),n},e.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(t){return this.base.options[t]}},["execAction","on","off","subscribe","trigger"].forEach((function(t){e.prototype[t]=function(){return this.base[t].apply(this.base,arguments)}})),t.Extension=e,function(){function e(e){return t.util.isBlockContainer(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}var n={findMatchingSelectionParent:function(e,n){var i,o=n.getSelection();return 0!==o.rangeCount&&(i=o.getRangeAt(0).commonAncestorContainer,t.util.traverseUp(i,e))},getSelectionElement:function(e){return this.findMatchingSelectionParent((function(e){return t.util.isMediumEditorElement(e)}),e)},exportSelection:function(t,e){if(!t)return null;var n=null,i=e.getSelection();if(i.rangeCount>0){var o,r=i.getRangeAt(0),a=r.cloneRange();a.selectNodeContents(t),a.setEnd(r.startContainer,r.startOffset),n={start:o=a.toString().length,end:o+r.toString().length},this.doesRangeStartWithImages(r,e)&&(n.startsWithImage=!0);var s=this.getTrailingImageCount(t,n,r.endContainer,r.endOffset);if(s&&(n.trailingImageCount=s),0!==o){var l=this.getIndexRelativeToAdjacentEmptyBlocks(e,t,r.startContainer,r.startOffset);-1!==l&&(n.emptyBlocksIndex=l)}}return n},importSelection:function(t,e,n,i){if(t&&e){var o=n.createRange();o.setStart(e,0),o.collapse(!0);var r,a=e,s=[],l=0,u=!1,c=!1,d=0,h=!1,f=!1,p=null;for((i||t.startsWithImage||void 0!==t.emptyBlocksIndex)&&(f=!0);!h&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||c){if(t.trailingImageCount&&c&&("img"===a.nodeName.toLowerCase()&&d++,d===t.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&&t.start>=l&&t.start<=r&&(f||t.start<r?(o.setStart(a,t.start-l),u=!0):p=a),u&&t.end>=l&&t.end<=r&&(t.trailingImageCount?c=!0:(o.setEnd(a,t.end-l),h=!0)),l=r;h||(a=s.pop())}!u&&p&&(o.setStart(p,p.length),o.setEnd(p,p.length)),void 0!==t.emptyBlocksIndex&&(o=this.importSelectionMoveCursorPastBlocks(n,e,t.emptyBlocksIndex,o)),i&&(o=this.importSelectionMoveCursorPastAnchor(t,o)),this.selectRange(n,o)}},importSelectionMoveCursorPastAnchor:function(e,n){if(e.start===e.end&&3===n.startContainer.nodeType&&n.startOffset===n.startContainer.nodeValue.length&&t.util.traverseUp(n.startContainer,(function(t){return"a"===t.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,e,!1),u=r.startContainer,c=0;for(o=o||1,a=3===u.nodeType&&t.util.isBlockContainer(u.previousSibling)?u.previousSibling:t.util.getClosestBlockContainer(u);l.nextNode();)if(s){if(s=l.currentNode,++c===o)break;if(s.textContent.length>0)break}else a===l.currentNode&&(s=l.currentNode);return s||(s=a),r.setStart(t.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(!t.util.isElementAtBeginningOfBlock(a))return-1;var s=t.util.findPreviousSibling(a);if(!s)return-1;if(s.nodeValue)return-1}for(var l=t.util.getClosestBlockContainer(o),u=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,e,!1),c=0;u.nextNode();){var d=""===u.currentNode.textContent;if((d||c>0)&&(c+=1),u.currentNode===l)return c;d||(c=0)}return c},doesRangeStartWithImages:function(t,e){if(0!==t.startOffset||1!==t.startContainer.nodeType)return!1;if("img"===t.startContainer.nodeName.toLowerCase())return!0;var n=t.startContainer.querySelector("img");if(!n)return!1;for(var i=e.createTreeWalker(t.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(t,e,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=t,s=[],l=0,u=!1,c=!1,d=!1,h=0;!d&&a;)if(a.nodeType>3)a=s.pop();else{if(3!==a.nodeType||c){if("img"===a.nodeName.toLowerCase()&&h++,a===o)d=!0;else if(1===a.nodeType)for(var f=a.childNodes.length-1;f>=0;)s.push(a.childNodes[f]),f-=1}else h=0,r=l+a.length,!u&&e.start>=l&&e.start<=r&&(u=!0),u&&e.end>=l&&e.end<=r&&(c=!0),l=r;d||(a=s.pop())}return h},selectionContainsContent:function(t){var e=t.getSelection();if(!e||e.isCollapsed||!e.rangeCount)return!1;if(""!==e.toString().trim())return!0;var n=this.getSelectedParentElement(e.getRangeAt(0));return!(!n||!("img"===n.nodeName.toLowerCase()||1===n.nodeType&&n.querySelector("img")))},selectionInContentEditableFalse:function(t){var e,n=this.findMatchingSelectionParent((function(t){var n=t&&t.getAttribute("contenteditable");return"true"===n&&(e=!0),"#text"!==t.nodeName&&"false"===n}),t);return!e&&n},getSelectionHtml:function(t){var e,n,i,o="",r=t.getSelection();if(r.rangeCount){for(i=t.createElement("div"),e=0,n=r.rangeCount;e<n;e+=1)i.appendChild(r.getRangeAt(e).cloneContents());o=i.innerHTML}return o},getCaretOffsets:function(t,e){var n,i;return e||(e=window.getSelection().getRangeAt(0)),n=e.cloneRange(),i=e.cloneRange(),n.selectNodeContents(t),n.setEnd(e.endContainer,e.endOffset),i.selectNodeContents(t),i.setStart(e.endContainer,e.endOffset),{left:n.toString().length,right:i.toString().length}},rangeSelectsSingleNode:function(t){var e=t.startContainer;return e===t.endContainer&&e.hasChildNodes()&&t.endOffset===t.startOffset+1},getSelectedParentElement:function(t){return t?this.rangeSelectsSingleNode(t)&&3!==t.startContainer.childNodes[t.startOffset].nodeType?t.startContainer.childNodes[t.startOffset]:3===t.startContainer.nodeType?t.startContainer.parentNode:t.startContainer:null},getSelectedElements:function(t){var e,n,i,o=t.getSelection();if(!o.rangeCount||o.isCollapsed||!o.getRangeAt(0).commonAncestorContainer)return[];if(3===(e=o.getRangeAt(0)).commonAncestorContainer.nodeType){for(n=[],i=e.commonAncestorContainer;i.parentNode&&1===i.parentNode.childNodes.length;)n.push(i.parentNode),i=i.parentNode;return n}return[].filter.call(e.commonAncestorContainer.getElementsByTagName("*"),(function(t){return"function"!=typeof o.containsNode||o.containsNode(t,!0)}))},selectNode:function(t,e){var n=e.createRange();n.selectNodeContents(t),this.selectRange(e,n)},select:function(t,e,n,i,o){var r=t.createRange();return r.setStart(e,n),i?r.setEnd(i,o):r.collapse(!0),this.selectRange(t,r),r},clearSelection:function(t,e){e?t.getSelection().collapseToStart():t.getSelection().collapseToEnd()},moveCursor:function(t,e,n){this.select(t,e,n)},getSelectionRange:function(t){var e=t.getSelection();return 0===e.rangeCount?null:e.getRangeAt(0)},selectRange:function(t,e){var n=t.getSelection();n.removeAllRanges(),n.addRange(e)},getSelectionStart:function(t){var e=t.getSelection().anchorNode;return e&&3===e.nodeType?e.parentNode:e}};t.selection=n}(),function(){function e(e,n){return!!e&&e.some((function(e){if("function"!=typeof e.getInteractionElements)return!1;var i=e.getInteractionElements();return!!i&&(Array.isArray(i)||(i=[i]),i.some((function(e){return t.util.isDescendant(e,n,!0)})))}))}var n=function(t){this.base=t,this.options=this.base.options,this.events=[],this.disabledEvents={},this.customEvents={},this.listeners={}};n.prototype={InputEventOnContenteditableSupported:!t.util.isIE&&!t.util.isEdge,attachDOMEvent:function(e,n,i,o){var r=this.base.options.contentWindow,a=this.base.options.ownerDocument;e=t.util.isElement(e)||[r,a].indexOf(e)>-1?[e]:e,Array.prototype.forEach.call(e,function(t){t.addEventListener(n,i,o),this.events.push([t,n,i,o])}.bind(this))},detachDOMEvent:function(e,n,i,o){var r,a,s=this.base.options.contentWindow,l=this.base.options.ownerDocument;e&&(e=t.util.isElement(e)||[s,l].indexOf(e)>-1?[e]:e,Array.prototype.forEach.call(e,function(t){-1!==(r=this.indexOfListener(t,n,i,o))&&(a=this.events.splice(r,1)[0])[0].removeEventListener(a[1],a[2],a[3])}.bind(this)))},indexOfListener:function(t,e,n,i){var o,r,a;for(o=0,r=this.events.length;o<r;o+=1)if((a=this.events[o])[0]===t&&a[1]===e&&a[2]===n&&a[3]===i)return o;return-1},detachAllDOMEvents:function(){for(var t=this.events.pop();t;)t[0].removeEventListener(t[1],t[2],t[3]),t=this.events.pop()},detachAllEventsFromElement:function(t){for(var e=this.events.filter((function(e){return e&&e[0].getAttribute&&e[0].getAttribute("medium-editor-index")===t.getAttribute("medium-editor-index")})),n=0,i=e.length;n<i;n++){var o=e[n];this.detachDOMEvent(o[0],o[1],o[2],o[3])}},attachAllEventsToElement:function(t){this.listeners.editableInput&&(this.contentCache[t.getAttribute("medium-editor-index")]=t.innerHTML),this.eventsCache&&this.eventsCache.forEach((function(e){this.attachDOMEvent(t,e.name,e.handler.bind(this))}),this)},enableCustomEvent:function(t){void 0!==this.disabledEvents[t]&&delete this.disabledEvents[t]},disableCustomEvent:function(t){this.disabledEvents[t]=!0},attachCustomEvent:function(t,e){this.setupListener(t),this.customEvents[t]||(this.customEvents[t]=[]),this.customEvents[t].push(e)},detachCustomEvent:function(t,e){var n=this.indexOfCustomListener(t,e);-1!==n&&this.customEvents[t].splice(n,1)},indexOfCustomListener:function(t,e){return this.customEvents[t]&&this.customEvents[t].length?this.customEvents[t].indexOf(e):-1},detachAllCustomEvents:function(){this.customEvents={}},triggerCustomEvent:function(t,e,n){this.customEvents[t]&&!this.disabledEvents[t]&&this.customEvents[t].forEach((function(t){t(e,n)}))},destroy:function(){this.detachAllDOMEvents(),this.detachAllCustomEvents(),this.detachExecCommand(),this.base.elements&&this.base.elements.forEach((function(t){t.removeAttribute("data-medium-focused")}))},attachToExecCommand:function(){this.execCommandListener||(this.execCommandListener=function(t){this.handleDocumentExecCommand(t)}.bind(this),this.wrapExecCommand(),this.options.ownerDocument.execCommand.listeners.push(this.execCommandListener))},detachExecCommand:function(){var t=this.options.ownerDocument;if(this.execCommandListener&&t.execCommand.listeners){var e=t.execCommand.listeners.indexOf(this.execCommandListener);-1!==e&&t.execCommand.listeners.splice(e,1),t.execCommand.listeners.length||this.unwrapExecCommand()}},wrapExecCommand:function(){var t=this.options.ownerDocument;if(!t.execCommand.listeners){var e=function(e,n){t.execCommand.listeners&&t.execCommand.listeners.forEach((function(t){t({command:e[0],value:e[2],args:e,result:n})}))},n=function(){var n=t.execCommand.orig.apply(this,arguments);if(!t.execCommand.listeners)return n;var i=Array.prototype.slice.call(arguments);return e(i,n),n};n.orig=t.execCommand,n.listeners=[],n.callListeners=e,t.execCommand=n}},unwrapExecCommand:function(){var t=this.options.ownerDocument;t.execCommand.orig&&(t.execCommand=t.execCommand.orig)},setupListener:function(t){if(!this.listeners[t]){switch(t){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(t){this.contentCache[t.getAttribute("medium-editor-index")]=t.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[t]=!0}},attachToEachElement:function(t,e){this.eventsCache||(this.eventsCache=[]),this.base.elements.forEach((function(n){this.attachDOMEvent(n,t,e.bind(this))}),this),this.eventsCache.push({name:t,handler:e})},cleanupElement:function(t){var e=t.getAttribute("medium-editor-index");e&&(this.detachAllEventsFromElement(t),this.contentCache&&delete this.contentCache[e])},focusElement:function(t){t.focus(),this.updateFocus(t,{target:t,type:"focus"})},updateFocus:function(n,i){var o,r=this.base.getFocusedElement();r&&"click"===i.type&&this.lastMousedownTarget&&(t.util.isDescendant(r,this.lastMousedownTarget,!0)||e(this.base.extensions,this.lastMousedownTarget))&&(o=r),o||this.base.elements.some((function(e){return!o&&t.util.isDescendant(e,n,!0)&&(o=e),!!o}),this);var a=!t.util.isDescendant(r,n,!0)&&!e(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(t,e){if(this.contentCache){var n=t.getAttribute("medium-editor-index"),i=t.innerHTML;i!==this.contentCache[n]&&this.triggerCustomEvent("editableInput",e,t),this.contentCache[n]=i}},handleDocumentSelectionChange:function(e){if(e.currentTarget&&e.currentTarget.activeElement){var n,i=e.currentTarget.activeElement;this.base.elements.some((function(e){return!!t.util.isDescendant(e,i,!0)&&(n=e,!0)}),this),n&&this.updateInput(n,{target:i,currentTarget:n})}},handleDocumentExecCommand:function(){var t=this.base.getFocusedElement();t&&this.updateInput(t,{target:t,currentTarget:t})},handleBodyClick:function(t){this.updateFocus(t.target,t)},handleBodyFocus:function(t){this.updateFocus(t.target,t)},handleBodyMousedown:function(t){this.lastMousedownTarget=t.target},handleInput:function(t){this.updateInput(t.currentTarget,t)},handleClick:function(t){this.triggerCustomEvent("editableClick",t,t.currentTarget)},handleBlur:function(t){this.triggerCustomEvent("editableBlur",t,t.currentTarget)},handleKeypress:function(t){if(this.triggerCustomEvent("editableKeypress",t,t.currentTarget),this.keypressUpdateInput){var e={target:t.target,currentTarget:t.currentTarget};setTimeout(function(){this.updateInput(e.currentTarget,e)}.bind(this),0)}},handleKeyup:function(t){this.triggerCustomEvent("editableKeyup",t,t.currentTarget)},handleMouseover:function(t){this.triggerCustomEvent("editableMouseover",t,t.currentTarget)},handleDragging:function(t){this.triggerCustomEvent("editableDrag",t,t.currentTarget)},handleDrop:function(t){this.triggerCustomEvent("editableDrop",t,t.currentTarget)},handlePaste:function(t){this.triggerCustomEvent("editablePaste",t,t.currentTarget)},handleKeydown:function(e){return this.triggerCustomEvent("editableKeydown",e,e.currentTarget),t.util.isKey(e,t.util.keyCode.SPACE)?this.triggerCustomEvent("editableKeydownSpace",e,e.currentTarget):t.util.isKey(e,t.util.keyCode.ENTER)||e.ctrlKey&&t.util.isKey(e,t.util.keyCode.M)?this.triggerCustomEvent("editableKeydownEnter",e,e.currentTarget):t.util.isKey(e,t.util.keyCode.TAB)?this.triggerCustomEvent("editableKeydownTab",e,e.currentTarget):t.util.isKey(e,[t.util.keyCode.DELETE,t.util.keyCode.BACKSPACE])?this.triggerCustomEvent("editableKeydownDelete",e,e.currentTarget):void 0}},t.Events=n}(),n=t.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(e){n.isBuiltInButton(e)?t.Extension.call(this,this.defaults[e]):t.Extension.call(this,e)},init:function(){t.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 t=this.document.createElement("button"),e=this.contentDefault,n=this.getAria(),i=this.getEditorOption("buttonLabels");return t.classList.add("medium-editor-action"),t.classList.add("medium-editor-action-"+this.name),this.classList&&this.classList.forEach((function(e){t.classList.add(e)})),t.setAttribute("data-action",this.getAction()),n&&(t.setAttribute("title",n),t.setAttribute("aria-label",n)),this.attrs&&Object.keys(this.attrs).forEach((function(e){t.setAttribute(e,this.attrs[e])}),this),"fontawesome"===i&&this.contentFA&&(e=this.contentFA),t.innerHTML=e,t},handleClick:function(t){t.preventDefault(),t.stopPropagation();var e=this.getAction();e&&this.execAction(e)},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 t=null;return this.useQueryState&&(t=this.base.queryCommandState(this.getAction())),t},isAlreadyApplied:function(t){var e,n,i=!1,o=this.getTagNames();return!1===this.knownState||!0===this.knownState?this.knownState:(o&&o.length>0&&(i=-1!==o.indexOf(t.nodeName.toLowerCase())),!i&&this.style&&(e=this.style.value.split("|"),n=this.window.getComputedStyle(t,null).getPropertyValue(this.style.prop),e.forEach((function(t){this.knownState||((i=-1!==n.indexOf(t))||"text-decoration"!==this.style.prop)&&(this.knownState=i)}),this)),i)}}),n.isBuiltInButton=function(e){return"string"==typeof e&&t.extensions.button.prototype.defaults.hasOwnProperty(e)},t.extensions.button=n,t.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=t.extensions.button.extend({init:function(){t.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 t=this.base.getExtensionByName("toolbar");t&&t.showToolbarDefaultActions()},hideToolbarDefaultActions:function(){var t=this.base.getExtensionByName("toolbar");t&&t.hideToolbarDefaultActions()},setToolbarPosition:function(){var t=this.base.getExtensionByName("toolbar");t&&t.setToolbarPosition()}}),t.extensions.form=i,o=t.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(){t.extensions.form.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this))},handleClick:function(e){e.preventDefault(),e.stopPropagation();var n=t.selection.getSelectionRange(this.document);return"a"===n.startContainer.nodeName.toLowerCase()||"a"===n.endContainer.nodeName.toLowerCase()||t.util.getClosestTag(t.selection.getSelectedParentElement(n),"a")?this.execAction("unlink"):(this.isDisplayed()||this.showForm(),!1)},handleKeydown:function(e){t.util.isKey(e,t.util.keyCode.K)&&t.util.isMetaCtrlKey(e)&&!e.shiftKey&&this.handleClick(e)},getForm:function(){return this.form||(this.form=this.createForm()),this.form},getTemplate:function(){var t=['<input type="text" class="medium-editor-toolbar-input" placeholder="',this.placeholderText,'">'];return t.push('<a href="#" class="medium-editor-toolbar-save">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-check"></i>':this.formSaveLabel,"</a>"),t.push('<a href="#" class="medium-editor-toolbar-close">',"fontawesome"===this.getEditorOption("buttonLabels")?'<i class="fa fa-times"></i>':this.formCloseLabel,"</a>"),this.targetCheckbox&&t.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&&t.push('<div class="medium-editor-toolbar-form-row">','<input type="checkbox" class="medium-editor-toolbar-anchor-button">',"<label>",this.customClassOptionText,"</label>","</div>"),t.join("")},isDisplayed:function(){return t.extensions.form.prototype.isDisplayed.apply(this)},hideForm:function(){t.extensions.form.prototype.hideForm.apply(this),this.getInput().value=""},showForm:function(e){var n=this.getInput(),i=this.getAnchorTargetCheckbox(),o=this.getAnchorButtonCheckbox();if("string"==typeof(e=e||{value:""})&&(e={value:e}),this.base.saveSelection(),this.hideToolbarDefaultActions(),t.extensions.form.prototype.showForm.apply(this),this.setToolbarPosition(),n.value=e.value,n.focus(),i&&(i.checked="_blank"===e.target),o){var r=e.buttonClass?e.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 t=this.getAnchorTargetCheckbox(),e=this.getAnchorButtonCheckbox(),n={value:this.getInput().value.trim()};return this.linkValidation&&(n.value=this.checkLinkFormat(n.value)),n.target="_self",t&&t.checked&&(n.target="_blank"),e&&e.checked&&(n.buttonClass=this.customClassOption),n},doFormSave:function(){var t=this.getFormOpts();this.completeFormSave(t)},completeFormSave:function(t){this.base.restoreSelection(),this.execAction(this.action,t),this.base.checkSelection()},ensureEncodedUri:function(t){return t===decodeURI(t)?encodeURI(t):t},ensureEncodedUriComponent:function(t){return t===decodeURIComponent(t)?encodeURIComponent(t):t},ensureEncodedParam:function(t){var e=t.split("="),n=e[0],i=e[1];return n+(void 0===i?"":"="+this.ensureEncodedUriComponent(i))},ensureEncodedQuery:function(t){return t.split("&").map(this.ensureEncodedParam.bind(this)).join("&")},checkLinkFormat:function(t){var e=/^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#/i.test(t),n="",i=t.match(/^(.*?)(?:\?(.*?))?(?:#(.*))?$/),o=i[1],r=i[2],a=i[3];if(/^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/.test(t))return"tel:"+t;if(!e){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(t){var e=t.querySelector(".medium-editor-toolbar-close"),n=t.querySelector(".medium-editor-toolbar-save"),i=t.querySelector(".medium-editor-toolbar-input");this.on(t,"click",this.handleFormClick.bind(this)),this.on(i,"keyup",this.handleTextboxKeyup.bind(this)),this.on(e,"click",this.handleCloseClick.bind(this)),this.on(n,"click",this.handleSaveClick.bind(this),!0)},createForm:function(){var t=this.document.createElement("div");return t.className="medium-editor-toolbar-form",t.id="medium-editor-toolbar-form-anchor-"+this.getEditorId(),t.innerHTML=this.getTemplate(),this.attachFormEvents(t),t},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(e){if(e.keyCode===t.util.keyCode.ENTER)return e.preventDefault(),void this.doFormSave();e.keyCode===t.util.keyCode.ESCAPE&&(e.preventDefault(),this.doFormCancel())},handleFormClick:function(t){t.stopPropagation()},handleSaveClick:function(t){t.preventDefault(),this.doFormSave()},handleCloseClick:function(t){t.preventDefault(),this.doFormCancel()}}),t.extensions.anchor=o,r=t.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 t=this.document.createElement("div");return t.id="medium-editor-anchor-preview-"+this.getEditorId(),t.className="medium-editor-anchor-preview",t.innerHTML=this.getTemplate(),this.on(t,"click",this.handleClick.bind(this)),t},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(t){return!(!this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")&&!t.getAttribute("data-disable-preview"))||(this.previewValueSelector&&(this.anchorPreview.querySelector(this.previewValueSelector).textContent=t.attributes.href.value,this.anchorPreview.querySelector(this.previewValueSelector).href=t.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=t,this.positionPreview(),this.attachPreviewHandlers(),this)},positionPreview:function(t){t=t||this.activeAnchor;var e,n,i,o,r,a=this.window.innerWidth,s=this.anchorPreview.offsetHeight,l=t.getBoundingClientRect(),u=this.diffLeft,c=this.diffTop,d=this.getEditorOption("elementsContainer"),h=["absolute","fixed"].indexOf(window.getComputedStyle(d).getPropertyValue("position"))>-1,f={};e=this.anchorPreview.offsetWidth/2;var p=this.base.getExtensionByName("toolbar");p&&(u=p.diffLeft,c=p.diffTop),n=u-e,h?(o=d.getBoundingClientRect(),["top","left"].forEach((function(t){f[t]=l[t]-o[t]})),f.width=l.width,f.height=l.height,l=f,a=o.width,r=d.scrollTop):r=this.window.pageYOffset,i=l.left+l.width/2,r+=s+l.top+l.height-c-this.anchorPreview.offsetHeight,this.anchorPreview.style.top=Math.round(r)+"px",this.anchorPreview.style.right="initial",i<e?(this.anchorPreview.style.left=n+e+"px",this.anchorPreview.style.right="initial"):a-i<e?(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(t){var e=this.base.getExtensionByName("anchor"),n=this.activeAnchor;e&&n&&(t.preventDefault(),this.base.selectElement(this.activeAnchor),this.base.delay(function(){if(n){var t={value:n.attributes.href.value,target:n.getAttribute("target"),buttonClass:n.getAttribute("class")};e.showForm(t),n=null}}.bind(this))),this.hidePreview()},handleAnchorMouseout:function(){this.anchorToPreview=null,this.off(this.activeAnchor,"mouseout",this.instanceHandleAnchorMouseout),this.instanceHandleAnchorMouseout=null},handleEditableMouseover:function(e){var n=t.util.getClosestTag(e.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(t){t.relatedTarget&&/anchor-preview/.test(t.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)}}),t.extensions.anchorPreview=r,function(){var e,n,i,o,r;function a(e){return!t.util.getClosestTag(e,"a")}e=[" ","\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=t.Extension.extend({init:function(){t.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 t=0,e=0;e<this.window._mediumEditors.length;e++){var n=this.window._mediumEditors[e];null!==n&&void 0!==n.getExtensionByName("autoLink")&&t++}return 1===t},destroy:function(){this.document.queryCommandSupported("AutoUrlDetect")&&this.isLastInstance()&&this.document.execCommand("AutoUrlDetect",!1,!0)},onBlur:function(t,e){this.performLinking(e)},onKeypress:function(e){this.disableEventHandling||t.util.isKey(e,[t.util.keyCode.SPACE,t.util.keyCode.ENTER])&&(clearTimeout(this.performLinkingTimeout),this.performLinkingTimeout=setTimeout(function(){try{var t=this.base.exportSelection();this.performLinking(e.target)&&this.base.importSelection(t,!0)}catch(t){window.console&&window.console.error("Failed to perform linking",t),this.disableEventHandling=!0}}.bind(this),0))},performLinking:function(e){var n=t.util.splitByBlockElements(e),i=!1;0===n.length&&(n=[e]);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(e,{target:e,currentTarget:e}),i},removeObsoleteAutoLinkSpans:function(e){if(!e||3===e.nodeType)return!1;for(var n=e.querySelectorAll('span[data-auto-link="true"]'),i=!1,o=0;o<n.length;o++){var r=n[o].textContent;if(-1===r.indexOf("://")&&(r=t.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=t.util.splitOffDOMTree(n[o],this.splitTextBeforeEnd(n[o],l));n[o].parentNode.insertBefore(u,n[o].nextSibling)}else t.util.unwrap(n[o],this.document)}}return i},splitTextBeforeEnd:function(t,e){for(var n,i,o,r=this.document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null,!1),a=!0;a;)a=null!==r.lastChild();for(;e>0&&null!==o;)(i=(n=r.currentNode).nodeValue).length>e?(o=n.splitText(i.length-e),e=0):(o=r.previousNode(),e-=i.length);return o},performLinkingWithinElement:function(e){for(var n=this.findLinkableText(e),i=0;i<n.length;i++){var o=t.util.findOrCreateMatchingTextNodes(this.document,e,n[i]);this.shouldNotLink(o)||this.createAutoLink(o,n[i].href)}return!1},shouldNotLink:function(e){for(var n=!1,i=0;i<e.length&&!1===n;i++)n=!!t.util.traverseUp(e[i],(function(t){return"a"===t.nodeName.toLowerCase()||t.getAttribute&&"true"===t.getAttribute("data-auto-link")}));return n},findLinkableText:function(t){for(var n=t.textContent,i=null,a=[];null!==(i=r.exec(n));){var s=i.index+i[0].length;!(0!==i.index&&-1===e.indexOf(n[i.index-1])||s!==n.length&&-1===e.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(e,n){n=t.util.ensureUrlHasProtocol(n);var i=t.util.createLink(this.document,e,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])}});t.extensions.autoLink=s}(),function(){var e="medium-editor-dragover";function n(n){var i=t.util.getContainerEditorElement(n);Array.prototype.slice.call(i.parentElement.querySelectorAll("."+e)).forEach((function(t){t.classList.remove(e)}))}var i=t.Extension.extend({name:"fileDragging",allowedTypes:["image"],init:function(){t.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(t){t.preventDefault(),t.dataTransfer.dropEffect="copy";var i=t.target.classList?t.target:t.target.parentElement;n(i),"dragover"===t.type&&i.classList.add(e)},handleDrop:function(t){t.preventDefault(),t.stopPropagation(),this.base.selectElement(t.target);var e=this.base.exportSelection();e.start=e.end,this.base.importSelection(e),t.dataTransfer.files&&Array.prototype.slice.call(t.dataTransfer.files).forEach((function(t){this.isAllowedFile(t)&&t.type.match("image")&&this.insertImageFile(t)}),this),n(t.target)},isAllowedFile:function(t){return this.allowedTypes.some((function(e){return!!t.type.match(e)}))},insertImageFile:function(e){if("function"==typeof FileReader){var n=new FileReader;n.readAsDataURL(e),n.addEventListener("load",function(e){var n=this.document.createElement("img");n.src=e.target.result,t.util.insertHTMLCommand(this.document,n.outerHTML)}.bind(this))}}});t.extensions.fileDragging=i}(),a=t.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(){t.Extension.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.keys={},this.commands.forEach((function(t){var e=t.key.charCodeAt(0);this.keys[e]||(this.keys[e]=[]),this.keys[e].push(t)}),this)},handleKeydown:function(e){var n=t.util.getKeyCode(e);if(this.keys[n]){var i=t.util.isMetaCtrlKey(e),o=!!e.shiftKey,r=!!e.altKey;this.keys[n].forEach((function(t){t.meta!==i||t.shift!==o||t.alt!==r&&void 0!==t.alt||(e.preventDefault(),e.stopPropagation(),"function"==typeof t.command?t.command.apply(this):!1!==t.command&&this.execAction(t.command))}),this)}}}),t.extensions.keyboardCommands=a,s=t.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(){t.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(t){if(t.preventDefault(),t.stopPropagation(),!this.isDisplayed()){var e=this.document.queryCommandValue("fontName")+"";this.showForm(e)}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(t){var e=this.getSelect();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),e.value=t||"",e.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 t,e=this.document,n=e.createElement("div"),i=e.createElement("select"),o=e.createElement("a"),r=e.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++)(t=e.createElement("option")).innerHTML=this.fonts[a],t.value=this.fonts[a],i.appendChild(t);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(){t.selection.getSelectedElements(this.document).forEach((function(t){"font"===t.nodeName.toLowerCase()&&t.hasAttribute("face")&&t.removeAttribute("face")}))},handleFontChange:function(){var t=this.getSelect().value;""===t?this.clearFontName():this.execAction("fontName",{value:t})},handleFormClick:function(t){t.stopPropagation()},handleSaveClick:function(t){t.preventDefault(),this.doFormSave()},handleCloseClick:function(t){t.preventDefault(),this.doFormCancel()}}),t.extensions.fontName=s,l=t.extensions.form.extend({name:"fontsize",action:"fontSize",aria:"increase/decrease font size",contentDefault:"±",contentFA:'<i class="fa fa-text-height"></i>',init:function(){t.extensions.form.prototype.init.apply(this,arguments)},handleClick:function(t){if(t.preventDefault(),t.stopPropagation(),!this.isDisplayed()){var e=this.document.queryCommandValue("fontSize")+"";this.showForm(e)}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(t){var e=this.getInput();this.base.saveSelection(),this.hideToolbarDefaultActions(),this.getForm().style.display="block",this.setToolbarPosition(),e.value=t||"",e.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 t=this.document,e=t.createElement("div"),n=t.createElement("input"),i=t.createElement("a"),o=t.createElement("a");return e.className="medium-editor-toolbar-form",e.id="medium-editor-toolbar-form-fontsize-"+this.getEditorId(),this.on(e,"click",this.handleFormClick.bind(this)),n.setAttribute("type","range"),n.setAttribute("min","1"),n.setAttribute("max","7"),n.className="medium-editor-toolbar-input",e.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>':"✓",e.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>':"×",e.appendChild(i),this.on(i,"click",this.handleCloseClick.bind(this)),e},getInput:function(){return this.getForm().querySelector("input.medium-editor-toolbar-input")},clearFontSize:function(){t.selection.getSelectedElements(this.document).forEach((function(t){"font"===t.nodeName.toLowerCase()&&t.hasAttribute("size")&&t.removeAttribute("size")}))},handleSliderChange:function(){var t=this.getInput().value;"4"===t?this.clearFontSize():this.execAction("fontSize",{value:t})},handleFormClick:function(t){t.stopPropagation()},handleSaveClick:function(t){t.preventDefault(),this.doFormSave()},handleCloseClick:function(t){t.preventDefault(),this.doFormCancel()}}),t.extensions.fontSize=l,function(){var e="%ME_PASTEBIN%",n=null,i=null,o=function(t){t.stopPropagation()};function r(t,e,n){var i=t.clipboardData||e.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=t.Extension.extend({forcePlainText:!0,cleanPastedHTML:!1,preCleanReplacements:[],cleanReplacements:[],cleanAttrs:["class","style","dir"],cleanTags:["meta"],unwrapTags:[],init:function(){t.Extension.prototype.init.apply(this,arguments),(this.forcePlainText||this.cleanPastedHTML)&&(this.subscribe("editableKeydown",this.handleKeydown.bind(this)),this.getEditorElements().forEach((function(t){this.on(t,"paste",this.handlePaste.bind(this))}),this),this.subscribe("addElement",this.handleAddElement.bind(this)))},handleAddElement:function(t,e){this.on(e,"paste",this.handlePaste.bind(this))},destroy:function(){(this.forcePlainText||this.cleanPastedHTML)&&this.removePasteBin()},handlePaste:function(t,e){if(!t.defaultPrevented){var n=r(t,this.window,this.document),i=n["text/html"],o=n["text/plain"];this.window.clipboardData&&void 0===t.clipboardData&&!i&&(i=o),(i||o)&&(t.preventDefault(),this.doPaste(i,o,e))}},doPaste:function(e,n,i){var o,r,a="";if(this.cleanPastedHTML&&e)return this.cleanPaste(e);if(n){if(this.getEditorOption("disableReturn")||i&&i.getAttribute("data-disable-return"))a=t.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>"+t.util.htmlEntities(o[r])+"</p>");else a=t.util.htmlEntities(o[0]);t.util.insertHTMLCommand(this.document,a)}},handlePasteBinPaste:function(t){if(t.defaultPrevented)this.removePasteBin();else{var e=r(t,this.window,this.document),n=e["text/html"],o=e["text/plain"],a=i;if(!this.cleanPastedHTML||n)return t.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(e,n){t.util.isKey(e,t.util.keyCode.V)&&t.util.isMetaCtrlKey(e)&&(e.stopImmediatePropagation(),this.removePasteBin(),this.createPasteBin(n))},createPasteBin:function(r){var a,s=t.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=e,this.document.body.appendChild(u),this.on(u,"focus",o),this.on(u,"focusin",o),this.on(u,"focusout",o),u.focus(),t.selection.selectNode(u,this.document),this.boundHandlePaste||(this.boundHandlePaste=this.handlePasteBinPaste.bind(this)),this.on(u,"paste",this.boundHandlePaste)},removePasteBin:function(){null!==n&&(t.selection.selectRange(this.document,n),n=null),null!==i&&(i=null);var e=this.getPasteBin();e&&e&&(this.off(e,"focus",o),this.off(e,"focusin",o),this.off(e,"focusout",o),this.off(e,"paste",this.boundHandlePaste),e.parentElement.removeChild(e))},getPasteBin:function(){return this.document.getElementById(this.pasteBinId)},getPasteBinHtml:function(){var t=this.getPasteBin();if(!t)return!1;if(t.firstChild&&"mcepastebin"===t.firstChild.id)return!1;var n=t.innerHTML;return!(!n||n===e)&&n},cleanPaste:function(t){var e,n,i,o,r=/<p|<br|<div/.test(t),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(e=0;e<a.length;e+=1)t=t.replace(a[e][0],a[e][1]);if(!r)return this.pasteHTML(t);for((i=this.document.createElement("div")).innerHTML="<p>"+t.split("<br><br>").join("</p><p>")+"</p>",n=i.querySelectorAll("a,p,div,br"),e=0;e<n.length;e+=1)switch((o=n[e]).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(e,n){n=t.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=e,this.cleanupSpans(a),i=a.querySelectorAll("*"),r=0;r<i.length;r+=1)"a"===(o=i[r]).nodeName.toLowerCase()&&this.getEditorOption("targetBlank")&&t.util.setTargetBlank(o),t.util.cleanupAttrs(o,n.cleanAttrs),t.util.cleanupTags(o,n.cleanTags),t.util.unwrapTags(o,n.unwrapTags);t.util.insertHTMLCommand(this.document,a.innerHTML.replace(/ /g," "))},isCommonBlock:function(t){return t&&("p"===t.nodeName.toLowerCase()||"div"===t.nodeName.toLowerCase())},filterCommonBlocks:function(t){/^\s*$/.test(t.textContent)&&t.parentNode&&t.parentNode.removeChild(t)},filterLineBreak:function(t){this.isCommonBlock(t.previousElementSibling)?this.removeWithParent(t):!this.isCommonBlock(t.parentNode)||t.parentNode.firstChild!==t&&t.parentNode.lastChild!==t?t.parentNode&&1===t.parentNode.childElementCount&&""===t.parentNode.textContent&&this.removeWithParent(t):this.removeWithParent(t)},removeWithParent:function(t){t&&t.parentNode&&(t.parentNode.parentNode&&1===t.parentNode.childElementCount?t.parentNode.parentNode.removeChild(t.parentNode):t.parentNode.removeChild(t))},cleanupSpans:function(e){var n,i,o,r=e.querySelectorAll(".replace-with"),a=function(t){return t&&"#text"!==t.nodeName&&"false"===t.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=e.querySelectorAll("span"),n=0;n<r.length;n+=1){if(i=r[n],t.util.traverseUp(i,a))return!1;t.util.unwrap(i,this.document)}}});t.extensions.paste=a}(),u=t.Extension.extend({name:"placeholder",text:"Type your text",hideOnClick:!0,init:function(){t.Extension.prototype.init.apply(this,arguments),this.initPlaceholders(),this.attachEventHandlers()},initPlaceholders:function(){this.getEditorElements().forEach(this.initElement,this)},handleAddElement:function(t,e){this.initElement(e)},initElement:function(t){t.getAttribute("data-placeholder")||t.setAttribute("data-placeholder",this.text),this.updatePlaceholder(t)},destroy:function(){this.getEditorElements().forEach(this.cleanupElement,this)},handleRemoveElement:function(t,e){this.cleanupElement(e)},cleanupElement:function(t){t.getAttribute("data-placeholder")===this.text&&t.removeAttribute("data-placeholder")},showPlaceholder:function(e){e&&(t.util.isFF&&0===e.childNodes.length?(e.classList.add("medium-editor-placeholder-relative"),e.classList.remove("medium-editor-placeholder")):(e.classList.add("medium-editor-placeholder"),e.classList.remove("medium-editor-placeholder-relative")))},hidePlaceholder:function(t){t&&(t.classList.remove("medium-editor-placeholder"),t.classList.remove("medium-editor-placeholder-relative"))},updatePlaceholder:function(t,e){if(t.querySelector("img, blockquote, ul, ol, table")||""!==t.textContent.replace(/^\s+|\s+$/g,""))return this.hidePlaceholder(t);e||this.showPlaceholder(t)},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(t,e){var n=this.hideOnClick&&e===this.base.getFocusedElement();this.updatePlaceholder(e,n)},handleFocus:function(t,e){this.hidePlaceholder(e)},handleBlur:function(t,e){this.updatePlaceholder(e)}}),t.extensions.placeholder=u,c=t.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(){t.Extension.prototype.init.apply(this,arguments),this.initThrottledMethods(),this.relativeContainer?this.relativeContainer.appendChild(this.getToolbarElement()):this.getEditorOption("elementsContainer").appendChild(this.getToolbarElement())},forEachExtension:function(t,e){return this.base.extensions.forEach((function(n){if(n!==this)return t.apply(e||this,arguments)}),this)},createToolbar:function(){var t=this.document.createElement("div");return t.id="medium-editor-toolbar-"+this.getEditorId(),t.className="medium-editor-toolbar",this.static?t.className+=" static-toolbar":this.relativeContainer?t.className+=" medium-editor-relative-toolbar":t.className+=" medium-editor-stalker-toolbar",t.appendChild(this.createToolbarButtons()),this.forEachExtension((function(e){e.hasForm&&t.appendChild(e.getForm())})),this.attachEventHandlers(),t},createToolbarButtons:function(){var e,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),e=this.document.createElement("li"),t.util.isElement(n)?e.appendChild(n):e.innerHTML=n,s.appendChild(e))}),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=t.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(e){if(e&&e.target&&t.util.isDescendant(this.getToolbarElement(),e.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(t){t.hasForm&&t.isDisplayed()&&t.hideForm()}))},multipleBlockElementsSelected:function(){var e=new RegExp("<("+t.util.blockContainerElementNames.join("|")+")[^>]*>","g"),n=t.selection.getSelectionHtml(this.document).replace(/<[^\/>][^>]*><\/[^>]+>/gim,"").match(e);return!!n&&n.length>1},modifySelection:function(){var e=this.window.getSelection().getRangeAt(0);if(this.standardizeSelectionStart&&e.startContainer.nodeValue&&e.startOffset===e.startContainer.nodeValue.length){var n=t.util.findAdjacentTextNodeWithContent(t.selection.getSelectionElement(this.window),e.startContainer,this.document);if(n){for(var i=0;0===n.nodeValue.substr(i,1).trim().length;)i+=1;e=t.selection.select(this.document,n,i,e.endContainer,e.endOffset)}}},checkState:function(){if(!this.base.preventSelectionUpdates){if(!this.base.getFocusedElement()||t.selection.selectionInContentEditableFalse(this.window))return this.hideToolbar();var e=t.selection.getSelectionElement(this.window);return!e||-1===this.getEditorElements().indexOf(e)||e.getAttribute("data-disable-toolbar")?this.hideToolbar():this.updateOnEmptySelection&&this.static?this.showAndUpdateToolbar():!t.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(t){"function"==typeof t.isActive&&"function"==typeof t.setInactive&&t.setInactive()})),this.checkActiveButtons()},checkActiveButtons:function(){var e,n=[],i=null,o=t.selection.getSelectionRange(this.document),r=function(t){"function"==typeof t.checkState?t.checkState(e):"function"==typeof t.isActive&&"function"==typeof t.isAlreadyApplied&&"function"==typeof t.setActive&&!t.isActive()&&t.isAlreadyApplied(e)&&t.setActive()};if(o&&(this.forEachExtension((function(t){"function"!=typeof t.queryCommandState||null===(i=t.queryCommandState())?n.push(t):i&&"function"==typeof t.setActive&&t.setActive()})),e=t.selection.getSelectedParentElement(o),this.getEditorElements().some((function(n){return t.util.isDescendant(n,e,!0)}))))for(;e&&(n.forEach(r),!t.util.isMediumEditorElement(e));)e=e.parentNode},positionToolbarIfShown:function(){this.isDisplayed()&&this.setToolbarPosition()},setToolbarPosition:function(){var t=this.base.getFocusedElement(),e=this.window.getSelection();if(!t)return this;!this.static&&e.isCollapsed||(this.showToolbar(),this.relativeContainer||(this.static?this.positionStaticToolbar(t):this.positionToolbar(e)),this.trigger("positionedToolbar",{},this.base.getFocusedElement()))},positionStaticToolbar:function(t){this.getToolbarElement().style.left="0";var e,n=this.document.documentElement&&this.document.documentElement.scrollTop||this.document.body.scrollTop,i=this.window.innerWidth,o=this.getToolbarElement(),r=t.getBoundingClientRect(),a=r.top+n,s=r.left+r.width/2,l=o.offsetHeight,u=o.offsetWidth,c=u/2;switch(this.sticky?n>a+t.offsetHeight-l-this.stickyTopOffset?(o.style.top=a+t.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":e=r.left;break;case"right":e=r.right-u;break;case"center":e=s-c}e<0?e=0:e+u>i&&(e=i-Math.ceil(u)-1),o.style.left=e+"px"},positionToolbar:function(t){this.getToolbarElement().style.left="0",this.getToolbarElement().style.right="initial";var e=t.getRangeAt(0),n=e.getBoundingClientRect();(!n||0===n.height&&0===n.width&&e.startContainer===e.endContainer)&&(n=1===e.startContainer.nodeType&&e.startContainer.querySelector("img")?e.startContainer.querySelector("img").getBoundingClientRect():e.startContainer.getBoundingClientRect());var i,o,r=this.window.innerWidth,a=this.getToolbarElement(),s=a.offsetHeight,l=a.offsetWidth/2,u=this.diffLeft-l,c=this.getEditorOption("elementsContainer"),d=["absolute","fixed"].indexOf(window.getComputedStyle(c).getPropertyValue("position"))>-1,h={},f={};d?(o=c.getBoundingClientRect(),["top","left"].forEach((function(t){f[t]=n[t]-o[t]})),f.width=n.width,f.height=n.height,n=f,r=o.width,h.top=c.scrollTop):h.top=this.window.pageYOffset,i=n.left+n.width/2,h.top+=n.top-s,n.top<50?(a.classList.add("medium-toolbar-arrow-over"),a.classList.remove("medium-toolbar-arrow-under"),h.top+=50+n.height-this.diffTop):(a.classList.add("medium-toolbar-arrow-under"),a.classList.remove("medium-toolbar-arrow-over"),h.top+=this.diffTop),i<l?(h.left=u+l,h.right="initial"):r-i<l?(h.left="auto",h.right=0):(h.left=u+i,h.right="initial"),["top","left","right"].forEach((function(t){a.style[t]=h[t]+(isNaN(h[t])?"":"px")}))}}),t.extensions.toolbar=c,d=t.Extension.extend({init:function(){t.Extension.prototype.init.apply(this,arguments),this.subscribe("editableDrag",this.handleDrag.bind(this)),this.subscribe("editableDrop",this.handleDrop.bind(this))},handleDrag:function(t){var e="medium-editor-dragover";t.preventDefault(),t.dataTransfer.dropEffect="copy","dragover"===t.type?t.target.classList.add(e):"dragleave"===t.type&&t.target.classList.remove(e)},handleDrop:function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.files&&Array.prototype.slice.call(e.dataTransfer.files,0).some(function(e){var n,i;e.type.match("image")&&((n=new FileReader).readAsDataURL(e),i="medium-img-"+ +new Date,t.util.insertHTMLCommand(this.document,'<img class="medium-editor-image-loading" id="'+i+'" />'),n.onload=function(){var t=this.document.getElementById(i);t&&(t.removeAttribute("id"),t.removeAttribute("class"),t.src=n.result)}.bind(this))}.bind(this)),e.target.classList.remove("medium-editor-dragover")}}),t.extensions.imageDragging=d,function(){function e(e){var n=t.selection.getSelectionStart(this.options.ownerDocument),i=n.textContent,o=t.selection.getCaretOffsets(n);(void 0===i[o.left-1]||""===i[o.left-1].trim()||void 0!==i[o.left]&&""===i[o.left].trim())&&e.preventDefault()}function n(e,n){if(this.options.disableReturn||n.getAttribute("data-disable-return"))e.preventDefault();else if(this.options.disableDoubleReturn||n.getAttribute("data-disable-double-return")){var i=t.selection.getSelectionStart(this.options.ownerDocument);(i&&""===i.textContent.trim()&&"li"!==i.nodeName.toLowerCase()||i.previousElementSibling&&"br"!==i.previousElementSibling.nodeName.toLowerCase()&&""===i.previousElementSibling.textContent.trim())&&e.preventDefault()}}function i(e){var n=t.selection.getSelectionStart(this.options.ownerDocument);"pre"===(n&&n.nodeName.toLowerCase())&&(e.preventDefault(),t.util.insertHTMLCommand(this.options.ownerDocument," ")),t.util.isListItem(n)&&(e.preventDefault(),e.shiftKey?this.options.ownerDocument.execCommand("outdent",!1,null):this.options.ownerDocument.execCommand("indent",!1,null))}function o(e){var n,i=t.selection.getSelectionStart(this.options.ownerDocument),o=i.nodeName.toLowerCase(),r=/^(\s+|<br\/?>)?$/i,a=/h\d/i;t.util.isKey(e,[t.util.keyCode.BACKSPACE,t.util.keyCode.ENTER])&&i.previousElementSibling&&a.test(o)&&0===t.selection.getCaretOffsets(i).left?t.util.isKey(e,t.util.keyCode.BACKSPACE)&&r.test(i.previousElementSibling.innerHTML)?(i.previousElementSibling.parentNode.removeChild(i.previousElementSibling),e.preventDefault()):!this.options.disableDoubleReturn&&t.util.isKey(e,t.util.keyCode.ENTER)&&((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.previousElementSibling.parentNode.insertBefore(n,i),e.preventDefault()):t.util.isKey(e,t.util.keyCode.DELETE)&&i.nextElementSibling&&i.previousElementSibling&&!a.test(o)&&r.test(i.innerHTML)&&a.test(i.nextElementSibling.nodeName.toLowerCase())?(t.selection.moveCursor(this.options.ownerDocument,i.nextElementSibling),i.previousElementSibling.parentNode.removeChild(i),e.preventDefault()):t.util.isKey(e,t.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),t.selection.moveCursor(this.options.ownerDocument,n),i.parentElement.removeChild(i),e.preventDefault()):t.util.isKey(e,t.util.keyCode.BACKSPACE)&&!1!==t.util.getClosestTag(i,"blockquote")&&0===t.selection.getCaretOffsets(i).left?(e.preventDefault(),t.util.execFormatBlock(this.options.ownerDocument,"p")):t.util.isKey(e,t.util.keyCode.ENTER)&&!1!==t.util.getClosestTag(i,"blockquote")&&0===t.selection.getCaretOffsets(i).right?((n=this.options.ownerDocument.createElement("p")).innerHTML="<br>",i.parentElement.insertBefore(n,i.nextSibling),t.selection.moveCursor(this.options.ownerDocument,n),e.preventDefault()):t.util.isKey(e,t.util.keyCode.BACKSPACE)&&t.util.isMediumEditorElement(i.parentElement)&&!i.previousElementSibling&&i.nextElementSibling&&r.test(i.innerHTML)&&(e.preventDefault(),t.selection.moveCursor(this.options.ownerDocument,i.nextSibling),i.parentElement.removeChild(i))}function r(e){var n=t.selection.getSelectionStart(this.options.ownerDocument);n&&(t.util.isMediumEditorElement(n)&&0===n.children.length&&!t.util.isBlockContainer(n)&&this.options.ownerDocument.execCommand("formatBlock",!1,"p"),!t.util.isKey(e,t.util.keyCode.ENTER)||t.util.isListItem(n)||t.util.isBlockContainer(n)||("a"===n.nodeName.toLowerCase()?this.options.ownerDocument.execCommand("unlink",!1,null):e.shiftKey||e.ctrlKey||this.options.ownerDocument.execCommand("formatBlock",!1,"p")))}function a(t,e){var n=e.parentNode.querySelector('textarea[medium-editor-textarea-id="'+e.getAttribute("medium-editor-textarea-id")+'"]');n&&(n.value=e.innerHTML.trim())}function s(t){t._mediumEditors||(t._mediumEditors=[null]),this.id||(this.id=t._mediumEditors.length),t._mediumEditors[this.id]=this}function l(t){t._mediumEditors&&t._mediumEditors[this.id]&&(t._mediumEditors[this.id]=null)}function u(e,n,i){var o=[];if(e||(e=[]),"string"==typeof e&&(e=n.querySelectorAll(e)),t.util.isElement(e)&&(e=[e]),i)for(var r=0;r<e.length;r++){var a=e[r];!t.util.isElement(a)||a.getAttribute("data-medium-editor-element")||a.getAttribute("medium-editor-textarea-id")||o.push(a)}else o=Array.prototype.slice.apply(e);return o}function c(t){var e=t.parentNode.querySelector('textarea[medium-editor-textarea-id="'+t.getAttribute("medium-editor-textarea-id")+'"]');e&&(e.classList.remove("medium-editor-hidden"),e.removeAttribute("medium-editor-textarea-id")),t.parentNode&&t.parentNode.removeChild(t)}function d(t,e,n){return t=function(t,e){return Object.keys(e).forEach((function(n){void 0===t[n]&&(t[n]=e[n])})),t}(t,{window:n.options.contentWindow,document:n.options.ownerDocument,base:n}),"function"==typeof t.init&&t.init(),t.name||(t.name=e),t}function h(){return!this.elements.every((function(t){return!!t.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(t){for(var e=this.options.ownerDocument.createElement("div"),n=Date.now(),i="medium-editor-"+n,o=t.attributes;this.options.ownerDocument.getElementById(i);)n++,i="medium-editor-"+n;e.className=t.className,e.id=i,e.innerHTML=t.value,t.setAttribute("medium-editor-textarea-id",i);for(var r=0,a=o.length;r<a;r++)e.hasAttribute(o[r].nodeName)||e.setAttribute(o[r].nodeName,o[r].value);return t.form&&this.on(t.form,"reset",function(t){t.defaultPrevented||this.resetContent(this.options.ownerDocument.getElementById(i))}.bind(this)),t.classList.add("medium-editor-hidden"),t.parentNode.insertBefore(e,t),e}function x(e,i){if(!e.getAttribute("data-medium-editor-element")){"textarea"===e.nodeName.toLowerCase()&&(e=b.call(this,e),this.instanceHandleEditableInput||(this.instanceHandleEditableInput=a.bind(this),this.subscribe("editableInput",this.instanceHandleEditableInput))),this.options.disableEditing||e.getAttribute("data-disable-editing")||(e.setAttribute("contentEditable",!0),e.setAttribute("spellcheck",this.options.spellcheck)),this.instanceHandleEditableKeydownEnter||(e.getAttribute("data-disable-return")||e.getAttribute("data-disable-double-return"))&&(this.instanceHandleEditableKeydownEnter=n.bind(this),this.subscribe("editableKeydownEnter",this.instanceHandleEditableKeydownEnter)),this.options.disableReturn||e.getAttribute("data-disable-return")||this.on(e,"keyup",r.bind(this));var o=t.util.guid();e.setAttribute("data-medium-editor-element",!0),e.classList.add("medium-editor-element"),e.setAttribute("role","textbox"),e.setAttribute("aria-multiline",!0),e.setAttribute("data-medium-editor-editor-index",i),e.setAttribute("medium-editor-index",o),S[o]=e.innerHTML,this.events.attachAllEventsToElement(e)}return e}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",e.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(t){"toolbar"!==t&&this.options.extensions[t]&&this.extensions.push(d(this.options.extensions[t],t,this))}),this),y.call(this)){var e=this.options.fileDragging;e||(e={},v.call(this)||(e.allowedTypes=[])),this.addBuiltInExtension("fileDragging",e)}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(t){n[t]&&this.addBuiltInExtension(t)}),this);var i=this.options.extensions.toolbar;if(!i&&h.call(this)){var o=t.util.extend({},this.options.toolbar,{allowMultiParagraphSelection:this.options.allowMultiParagraphSelection});i=new t.extensions.toolbar(o)}i&&this.extensions.push(d(i,"toolbar",this))}function C(e,n){return n&&[["allowMultiParagraphSelection","toolbar.allowMultiParagraphSelection"]].forEach((function(e){n.hasOwnProperty(e[0])&&void 0!==n[e[0]]&&t.util.deprecated(e[0],e[1],"v6.0.0")})),t.util.defaults({},n,e)}function _(e,n){var i,o;if(i=/^append-(.+)$/gi.exec(e))return t.util.execFormatBlock(this.options.ownerDocument,i[1]);if("fontSize"===e)return n.size&&t.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"===e)return n.name&&t.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"===e)return this.createLink(n);if("image"===e){var r=this.options.contentWindow.getSelection().toString().trim();return this.options.ownerDocument.execCommand("insertImage",!1,r)}if("html"===e){var a=this.options.contentWindow.getSelection().toString().trim();return t.util.insertHTMLCommand(this.options.ownerDocument,a)}if(/justify([A-Za-z]*)$/g.exec(e)){var s=this.options.ownerDocument.execCommand(e,!1,null),l=t.selection.getSelectedParentElement(t.selection.getSelectionRange(this.options.ownerDocument));return l&&N.call(this,t.util.getTopBlockContainer(l)),s}return o=n&&n.value,this.options.ownerDocument.execCommand(e,!1,o)}function N(e){if(e){var n,i=Array.prototype.slice.call(e.childNodes).filter((function(t){var e="div"===t.nodeName.toLowerCase();return e&&!n&&(n=t.style.textAlign),e}));i.length&&(this.saveSelection(),i.forEach((function(e){if(e.style.textAlign===n){var i=e.lastChild;if(i){t.util.unwrap(e,this.options.ownerDocument);var o=this.options.ownerDocument.createElement("BR");i.parentNode.insertBefore(o,i.nextSibling)}}}),this),e.style.textAlign=n,this.restoreSelection())}}var S={};t.prototype={init:function(t,e){return this.options=C.call(this,this.defaults,e),this.origElements=t,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 t.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(t){"function"==typeof t.destroy&&t.destroy()}),this),this.events.destroy(),this.elements.forEach((function(t){this.options.spellcheck&&(t.innerHTML=t.innerHTML),t.removeAttribute("contentEditable"),t.removeAttribute("spellcheck"),t.removeAttribute("data-medium-editor-element"),t.classList.remove("medium-editor-element"),t.removeAttribute("role"),t.removeAttribute("aria-multiline"),t.removeAttribute("medium-editor-index"),t.removeAttribute("data-medium-editor-editor-index"),t.getAttribute("medium-editor-textarea-id")&&c(t)}),this),this.elements=[],this.instanceHandleEditableKeydownEnter=null,this.instanceHandleEditableInput=null,l.call(this,this.options.contentWindow))},on:function(t,e,n,i){return this.events.attachDOMEvent(t,e,n,i),this},off:function(t,e,n,i){return this.events.detachDOMEvent(t,e,n,i),this},subscribe:function(t,e){return this.events.attachCustomEvent(t,e),this},unsubscribe:function(t,e){return this.events.detachCustomEvent(t,e),this},trigger:function(t,e,n){return this.events.triggerCustomEvent(t,e,n),this},delay:function(t){var e=this;return setTimeout((function(){e.isActive&&t()}),this.options.delay)},serialize:function(){var t,e={},n=this.elements.length;for(t=0;t<n;t+=1)e[""!==this.elements[t].id?this.elements[t].id:"element-"+t]={value:this.elements[t].innerHTML.trim()};return e},getExtensionByName:function(t){var e;return this.extensions&&this.extensions.length&&this.extensions.some((function(n){return n.name===t&&(e=n,!0)})),e},addBuiltInExtension:function(e,n){var i,o=this.getExtensionByName(e);if(o)return o;switch(e){case"anchor":i=t.util.extend({},this.options.anchor,n),o=new t.extensions.anchor(i);break;case"anchor-preview":o=new t.extensions.anchorPreview(this.options.anchorPreview);break;case"autoLink":o=new t.extensions.autoLink;break;case"fileDragging":o=new t.extensions.fileDragging(n);break;case"fontname":o=new t.extensions.fontName(this.options.fontName);break;case"fontsize":o=new t.extensions.fontSize(n);break;case"keyboardCommands":o=new t.extensions.keyboardCommands(this.options.keyboardCommands);break;case"paste":o=new t.extensions.paste(this.options.paste);break;case"placeholder":o=new t.extensions.placeholder(this.options.placeholder);break;default:t.extensions.button.isBuiltInButton(e)&&(n?(i=t.util.defaults({},n,t.extensions.button.prototype.defaults[e]),o=new t.extensions.button(i)):o=new t.extensions.button(e))}return o&&this.extensions.push(d(o,e,this)),o},stopSelectionUpdates:function(){this.preventSelectionUpdates=!0},startSelectionUpdates:function(){this.preventSelectionUpdates=!1},checkSelection:function(){var t=this.getExtensionByName("toolbar");return t&&t.checkState(),this},queryCommandState:function(t){var e,n=null;(e=/^full-(.+)$/gi.exec(t))&&(t=e[1]);try{n=this.options.ownerDocument.queryCommandState(t)}catch(t){n=null}return n},execAction:function(e,n){var i,o;return(i=/^full-(.+)$/gi.exec(e))?(this.saveSelection(),this.selectAllContents(),o=_.call(this,i[1],n),this.restoreSelection()):o=_.call(this,e,n),"insertunorderedlist"!==e&&"insertorderedlist"!==e||t.util.cleanListDOM(this.options.ownerDocument,this.getSelectedParentElement()),this.checkSelection(),o},getSelectedParentElement:function(e){return void 0===e&&(e=this.options.contentWindow.getSelection().getRangeAt(0)),t.selection.getSelectedParentElement(e)},selectAllContents:function(){var e=t.selection.getSelectionElement(this.options.contentWindow);if(e){for(;1===e.children.length;)e=e.children[0];this.selectElement(e)}},selectElement:function(e){t.selection.selectNode(e,this.options.ownerDocument);var n=t.selection.getSelectionElement(this.options.contentWindow);n&&this.events.focusElement(n)},getFocusedElement:function(){var t;return this.elements.some((function(e){return!t&&e.getAttribute("data-medium-focused")&&(t=e),!!t}),this),t},exportSelection:function(){var e=t.selection.getSelectionElement(this.options.contentWindow),n=this.elements.indexOf(e),i=null;return n>=0&&(i=t.selection.exportSelection(e,this.options.ownerDocument)),null!==i&&0!==n&&(i.editableElementIndex=n),i},saveSelection:function(){this.selectionState=this.exportSelection()},importSelection:function(e,n){if(e){var i=this.elements[e.editableElementIndex||0];t.selection.importSelection(e,i,this.options.ownerDocument,n)}},restoreSelection:function(){this.importSelection(this.selectionState)},createLink:function(e){var n,i=t.selection.getSelectionElement(this.options.contentWindow),o={};if(-1!==this.elements.indexOf(i)){try{if(this.events.disableCustomEvent("editableInput"),e.url&&t.util.deprecated(".url option for createLink",".value","6.0.0"),(n=e.url||e.value)&&n.trim().length>0){var r=this.options.contentWindow.getSelection();if(r){var a,s,l,u,c=r.getRangeAt(0),d=c.commonAncestorContainer;if(3===c.endContainer.nodeType&&3!==c.startContainer.nodeType&&0===c.startOffset&&c.startContainer.firstChild===c.endContainer&&(d=c.endContainer),s=t.util.getClosestBlockContainer(c.startContainer),l=t.util.getClosestBlockContainer(c.endContainer),3!==d.nodeType&&0!==d.textContent.length&&s===l){var h=s||i,f=this.options.ownerDocument.createDocumentFragment();this.execAction("unlink"),a=this.exportSelection(),f.appendChild(h.cloneNode(!0)),i===h?t.selection.select(this.options.ownerDocument,h.firstChild,0,h.lastChild,3===h.lastChild.nodeType?h.lastChild.nodeValue.length:h.lastChild.childNodes.length):t.selection.select(this.options.ownerDocument,h,0,h,h.childNodes.length);var p=this.exportSelection();0===(u=t.util.findOrCreateMatchingTextNodes(this.options.ownerDocument,f,{start:a.start-p.start,end:a.end-p.start,editableElementIndex:a.editableElementIndex})).length&&((f=this.options.ownerDocument.createDocumentFragment()).appendChild(d.cloneNode(!0)),u=[f.firstChild.firstChild,f.firstChild.lastChild]),t.util.createLink(this.options.ownerDocument,u,n.trim());var g=(f.firstChild.innerHTML.match(/^\s+/)||[""])[0].length;t.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"===e.target?t.util.setTargetBlank(t.selection.getSelectionStart(this.options.ownerDocument),n):t.util.removeTargetBlank(t.selection.getSelectionStart(this.options.ownerDocument),n),e.buttonClass&&t.util.addClassToAnchors(t.selection.getSelectionStart(this.options.ownerDocument),e.buttonClass)}}if(this.options.targetBlank||"_blank"===e.target||e.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(t){this.getExtensionByName("paste").cleanPaste(t)},pasteHTML:function(t,e){this.getExtensionByName("paste").pasteHTML(t,e)},setContent:function(t,e){if(e=e||0,this.elements[e]){var n=this.elements[e];n.innerHTML=t,this.checkContentChanged(n)}},getContent:function(t){return t=t||0,this.elements[t]?this.elements[t].innerHTML.trim():null},checkContentChanged:function(e){e=e||t.selection.getSelectionElement(this.options.contentWindow),this.events.updateInput(e,{target:e,currentTarget:e})},resetContent:function(t){if(t){var e=this.elements.indexOf(t);-1!==e&&this.setContent(S[t.getAttribute("medium-editor-index")],e)}else this.elements.forEach((function(t,e){this.setContent(S[t.getAttribute("medium-editor-index")],e)}),this)},addElements:function(t){var e=u(t,this.options.ownerDocument,!0);if(0===e.length)return!1;e.forEach((function(t){t=x.call(this,t,this.id),this.elements.push(t),this.trigger("addElement",{target:t,currentTarget:t},t)}),this)},removeElements:function(t){var e=u(t,this.options.ownerDocument).map((function(t){return t.getAttribute("medium-editor-textarea-id")&&t.parentNode?t.parentNode.querySelector('div[medium-editor-textarea-id="'+t.getAttribute("medium-editor-textarea-id")+'"]'):t}));this.elements=this.elements.filter((function(t){return-1===e.indexOf(t)||(this.events.cleanupElement(t),t.getAttribute("medium-editor-textarea-id")&&c(t),this.trigger("removeElement",{target:t,currentTarget:t},t),!1)}),this)}},t.getEditorFromElement=function(t){var e=t.getAttribute("data-medium-editor-editor-index"),n=t&&t.ownerDocument&&(t.ownerDocument.defaultView||t.ownerDocument.parentWindow);return n&&n._mediumEditors&&n._mediumEditors[e]?n._mediumEditors[e]:null}}(),t.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},t.parseVersionString=function(t){var e=t.split("-"),n=e[0].split("."),i=e.length>1?e[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:"")}}},t.version=t.parseVersionString.call(this,"5.23.3"),t}())}({get exports(){return kv},set exports(t){kv=t}});var Av=kv,Rv=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Ov=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),Pv=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],i=!0,o=!1,r=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){o=!0,r=t}finally{try{!i&&s.return&&s.return()}finally{if(o)throw r}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")};
|
|
21
|
+
/*!
|
|
22
|
+
* vanilla-picker v2.12.3
|
|
23
|
+
* https://vanilla-picker.js.org
|
|
24
|
+
*
|
|
25
|
+
* Copyright 2017-2024 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
|
|
26
|
+
* Released under the ISC license.
|
|
27
|
+
*/String.prototype.startsWith=String.prototype.startsWith||function(t){return 0===this.indexOf(t)},String.prototype.padStart=String.prototype.padStart||function(t,e){for(var n=this;n.length<t;)n=e+n;return n};var Dv={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 Lv(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e>0?t.toFixed(e).replace(/0+$/,"").replace(/\.$/,""):t.toString())||"0"}var Iv=function(){function t(e,n,i,o){Rv(this,t);var r=this;if(void 0===e);else if(Array.isArray(e))this.rgba=e;else if(void 0===i){var a=e&&""+e;a&&function(e){if(e.startsWith("hsl")){var n=e.match(/([\-\d\.e]+)/g).map(Number),i=Pv(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(e.startsWith("rgb")){var u=e.match(/([\-\d\.e]+)/g).map(Number),c=Pv(u,4),d=c[0],h=c[1],f=c[2],p=c[3];void 0===p&&(p=1),r.rgba=[d,h,f,p]}else e.startsWith("#")?r.rgba=t.hexToRgb(e):r.rgba=t.nameToRgb(e)||t.hexToRgb(e)}(a.toLowerCase())}else this.rgba=[e,n,i,void 0===o?1:o]}return Ov(t,[{key:"printRGB",value:function(t){var e=(t?this.rgba:this.rgba.slice(0,3)).map((function(t,e){return Lv(t,3===e?3:0)}));return t?"rgba("+e+")":"rgb("+e+")"}},{key:"printHSL",value:function(t){var e=[360,100,100,1],n=["","%","%",""],i=(t?this.hsla:this.hsla.slice(0,3)).map((function(t,i){return Lv(t*e[i],3===i?3:1)+n[i]}));return t?"hsla("+i+")":"hsl("+i+")"}},{key:"printHex",value:function(t){var e=this.hex;return t?e:e.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=t.hslToRgb(this._hsla)},set:function(t){3===t.length&&(t[3]=1),this._rgba=t,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=t.rgbToHsl(this._rgba)},set:function(t){3===t.length&&(t[3]=1),this._hsla=t,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(t,e){return e<3?t.toString(16):Math.round(255*t).toString(16)})).map((function(t){return t.padStart(2,"0")})).join("")},set:function(e){this.rgba=t.hexToRgb(e)}}],[{key:"hexToRgb",value:function(t){var e=(t.startsWith("#")?t.slice(1):t).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!e.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+t);var n=e.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map((function(t){return parseInt(t,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(e){var n=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),i=Dv[n];return void 0===i?i:t.hexToRgb(i.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(t){var e=Pv(t,4),n=e[0],i=e[1],o=e[2],r=e[3];n/=255,i/=255,o/=255;var a=Math.max(n,i,o),s=Math.min(n,i,o),l=void 0,u=void 0,c=(a+s)/2;if(a===s)l=u=0;else{var d=a-s;switch(u=c>.5?d/(2-a-s):d/(a+s),a){case n:l=(i-o)/d+(i<o?6:0);break;case i:l=(o-n)/d+2;break;case o:l=(n-i)/d+4}l/=6}return[l,u,c,r]}},{key:"hslToRgb",value:function(t){var e=Pv(t,4),n=e[0],i=e[1],o=e[2],r=e[3],a=void 0,s=void 0,l=void 0;if(0===i)a=s=l=o;else{var u=function(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t},c=o<.5?o*(1+i):o+i-o*i,d=2*o-c;a=u(d,c,n+1/3),s=u(d,c,n),l=u(d,c,n-1/3)}var h=[255*a,255*s,255*l].map(Math.round);return h[3]=r,h}}]),t}(),Bv=function(){function t(){Rv(this,t),this._events=[]}return Ov(t,[{key:"add",value:function(t,e,n){t.addEventListener(e,n,!1),this._events.push({target:t,type:e,handler:n})}},{key:"remove",value:function(e,n,i){this._events=this._events.filter((function(o){var r=!0;return e&&e!==o.target&&(r=!1),n&&n!==o.type&&(r=!1),i&&i!==o.handler&&(r=!1),r&&t._doRemove(o.target,o.type,o.handler),!r}))}},{key:"destroy",value:function(){this._events.forEach((function(e){return t._doRemove(e.target,e.type,e.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(t,e,n){t.removeEventListener(e,n,!1)}}]),t}();function jv(t,e,n){var i=!1;function o(t,e,n){return Math.max(e,Math.min(t,n))}function r(t,r,a){if(a&&(i=!0),i){t.preventDefault();var s=e.getBoundingClientRect(),l=s.width,u=s.height,c=r.clientX,d=r.clientY,h=o(c-s.left,0,l),f=o(d-s.top,0,u);n(h/l,f/u)}}function a(t,e){1===(void 0===t.buttons?t.which:t.buttons)?r(t,t,e):i=!1}function s(t,e){1===t.touches.length?r(t,t.touches[0],e):i=!1}t.add(e,"mousedown",(function(t){a(t,!0)})),t.add(e,"touchstart",(function(t){s(t,!0)})),t.add(window,"mousemove",a),t.add(e,"touchmove",s),t.add(window,"mouseup",(function(t){i=!1})),t.add(e,"touchend",(function(t){i=!1})),t.add(e,"touchcancel",(function(t){i=!1}))}var Fv="keydown",Hv="mousedown",Wv="focusin";function zv(t,e){return(e||document).querySelector(t)}function Uv(t){t.preventDefault(),t.stopPropagation()}function qv(t,e,n,i,o){t.add(e,Fv,(function(t){n.indexOf(t.key)>=0&&(o&&Uv(t),i(t))}))}var Gv=function(){function t(e){Rv(this,t),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Bv,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(e)}return Ov(t,[{key:"setOptions",value:function(t){var e=this;if(t){var n=this.settings;if(t instanceof HTMLElement)n.parent=t;else{n.parent&&t.parent&&n.parent!==t.parent&&(this._events.remove(n.parent),this._popupInited=!1),function(t,e,n){for(var i in t)n&&n.indexOf(i)>=0||(e[i]=t[i])}(t,n),t.onChange&&(this.onChange=t.onChange),t.onDone&&(this.onDone=t.onDone),t.onOpen&&(this.onOpen=t.onOpen),t.onClose&&(this.onClose=t.onClose);var i=t.color||t.colour;i&&this._setColor(i)}var o=n.parent;if(o&&n.popup&&!this._popupInited){var r=function(t){return e.openHandler(t)};this._events.add(o,"click",r),qv(this._events,o,[" ","Spacebar","Enter"],r),this._popupInited=!0}else t.parent&&!n.popup&&this.show()}}},{key:"openHandler",value:function(t){if(this.show()){t&&t.preventDefault(),this.settings.parent.style.pointerEvents="none";var e=t&&t.type===Fv?this._domEdit:this.domElement;setTimeout((function(){return e.focus()}),100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(t){var e=t&&t.type,n=!1;if(t)if(e===Hv||e===Wv){var i=(this.__containedEvent||0)+100;t.timeStamp>i&&(n=!0)}else Uv(t),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",e!==Hv&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(t,e){this.closeHandler(),this.setOptions(t),e&&this.openHandler()}},{key:"setColor",value:function(t,e){this._setColor(t,{silent:e})}},{key:"_setColor",value:function(t,e){if("string"==typeof t&&(t=t.trim()),t){e=e||{};var n=void 0;try{n=new Iv(t)}catch(t){if(e.failSilently)return;throw t}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,e)}}},{key:"setColour",value:function(t,e){this.setColor(t,e)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var e,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=(e=i,(n=document.createElement("div")).innerHTML=e,n.firstElementChild);return this.domElement=o,this._domH=zv(".picker_hue",o),this._domSL=zv(".picker_sl",o),this._domA=zv(".picker_alpha",o),this._domEdit=zv(".picker_editor input",o),this._domSample=zv(".picker_sample",o),this._domOkay=zv(".picker_done button",o),this._domCancel=zv(".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 t=this,e=this,n=this.domElement,i=this._events;function o(t,e,n){i.add(t,e,n)}o(n,"click",(function(t){return t.preventDefault()})),jv(i,this._domH,(function(t,n){return e._setHSLA(t)})),jv(i,this._domSL,(function(t,n){return e._setHSLA(null,t,1-n)})),this.settings.alpha&&jv(i,this._domA,(function(t,n){return e._setHSLA(null,null,null,1-n)}));var r=this._domEdit;o(r,"input",(function(t){e._setColor(this.value,{fromEditor:!0,failSilently:!0})})),o(r,"focus",(function(t){var e=this;e.selectionStart===e.selectionEnd&&e.select()})),this._ifPopup((function(){var e=function(e){return t.closeHandler(e)};o(window,Hv,e),o(window,Wv,e),qv(i,n,["Esc","Escape"],e);var r=function(e){t.__containedEvent=e.timeStamp};o(n,Hv,r),o(n,Wv,r),o(t._domCancel,"click",e)}));var a=function(e){t._ifPopup((function(){return t.closeHandler(e)})),t.onDone&&t.onDone(t.colour)};o(this._domOkay,"click",a),qv(i,n,["Enter"],a)}},{key:"_setPosition",value:function(){var t=this.settings.parent,e=this.domElement;t!==e.parentNode&&t.appendChild(e),this._ifPopup((function(n){"static"===getComputedStyle(t).position&&(t.style.position="relative");var i=!0===n?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(t){t===i?e.classList.add(t):e.classList.remove(t)})),e.classList.add(i)}))}},{key:"_setHSLA",value:function(t,e,n,i,o){o=o||{};var r=this.colour,a=r.hsla;[t,e,n,i].forEach((function(t,e){(t||0===t)&&(a[e]=t)})),r.hsla=a,this._updateUI(o),this.onChange&&!o.silent&&this.onChange(r)}},{key:"_updateUI",value:function(t){if(this.domElement){t=t||{};var e=this.colour,n=e.hsla,i="hsl("+360*n[0]+", 100%, 50%)",o=e.hslString,r=e.hslaString,a=this._domH,s=this._domSL,l=this._domA,u=zv(".picker_selector",a),c=zv(".picker_selector",s),d=zv(".picker_selector",l);y(0,u,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=i,y(0,c,n[1]),b(0,c,1-n[2]),s.style.color=o,b(0,d,1-n[3]);var h=o,f=h.replace("hsl","hsla").replace(")",", 0)"),p="linear-gradient("+[h,f]+")";if(this._domA.style.background=p+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!t.fromEditor){var g=this.settings.editorFormat,v=this.settings.alpha,m=void 0;switch(g){case"rgb":m=e.printRGB(v);break;case"hsl":m=e.printHSL(v);break;default:m=e.printHex(v)}this._domEdit.value=m}this._domSample.style.color=r}function y(t,e,n){e.style.left=100*n+"%"}function b(t,e,n){e.style.top=100*n+"%"}}},{key:"_ifPopup",value:function(t,e){this.settings.parent&&this.settings.popup?t&&t(this.settings.popup):e&&e()}},{key:"_toggleDOM",value:function(t){var e=this.domElement;if(!e)return!1;var n=t?"":"none",i=e.style.display!==n;return i&&(e.style.display=n),i}}]),t}(),Vv=document.createElement("style");Vv.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(Vv),Gv.StyleElement=Vv;var Kv={};!function(t,e){t.exports=function(){var t="object",e="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==e||!(o!=t||!n[i])||"unknown"==o}function l(e,n){return!(typeof e[n]!=t||!e[n])}function u(t,e){return typeof t[e]!=n}function c(t){return function(e,n){for(var i=n.length;i--;)if(!t(e,n[i]))return!1;return!0}}var d=c(s),h=c(l),f=c(u);function p(t){return t&&d(t,a)&&f(t,r)}function g(t){return l(t,"body")?t.body:t.getElementsByTagName("body")[0]}var v,m,y=[].forEach?function(t,e){t.forEach(e)}:function(t,e){for(var n=0,i=t.length;n<i;++n)e(t[n],n)},b={},x=typeof window!=n&&typeof document!=n,w={isHostMethod:s,isHostObject:l,isHostProperty:u,areHostMethods:d,areHostObjects:h,areHostProperties:f,isTextRange:p,getBody:g,forEach:y},E={version:"1.3.1",initialized:!1,isBrowser:x,supported:!0,util:w,features:{},modules:b,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==n||rangyAutoInitialize}};function C(t){typeof console!=n&&s(console,"log")&&console.log(t)}function _(t,e){x&&e?alert(t):C(t)}function N(t){E.initialized=!0,E.supported=!1,_("Rangy is not supported in this environment. Reason: "+t,E.config.alertOnFail)}function S(t){_("Rangy warning: "+t,E.config.alertOnWarn)}E.fail=N,E.warn=S,{}.hasOwnProperty?(w.extend=v=function(t,e,n){var i,o;for(var r in e)e.hasOwnProperty(r)&&(i=t[r],o=e[r],n&&null!==i&&"object"==typeof i&&null!==o&&"object"==typeof o&&v(i,o,!0),t[r]=o);return e.hasOwnProperty("toString")&&(t.toString=e.toString),t},w.createOptions=function(t,e){var n={};return v(n,e),t&&v(n,t),n}):N("hasOwnProperty not supported"),x||N("Rangy can only run in a browser"),function(){var t;if(x){var e=document.createElement("div");e.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(e.childNodes,0)[0].nodeType&&(t=function(t){return n.call(t,0)})}catch(t){}}t||(t=function(t){for(var e=[],n=0,i=t.length;n<i;++n)e[n]=t[n];return e}),w.toArray=t}(),x&&(s(document,"addEventListener")?m=function(t,e,n){t.addEventListener(e,n,!1)}:s(document,"attachEvent")?m=function(t,e,n){t.attachEvent("on"+e,n)}:N("Document does not have required addEventListener or attachEvent method"),w.addListener=m);var T=[];function M(t){return t.message||t.description||String(t)}function k(){if(x&&!E.initialized){var t,e=!1,n=!1;s(document,"createRange")&&(t=document.createRange(),d(t,o)&&f(t,i)&&(e=!0));var r=g(document);if(r&&"body"==r.nodeName.toLowerCase())if(r&&s(r,"createTextRange")&&p(t=r.createTextRange())&&(n=!0),e||n){var a;for(var l in E.initialized=!0,E.features={implementsDomRange:e,implementsTextRange:n},b)(a=b[l])instanceof D&&a.init(a,E);for(var u=0,c=T.length;u<c;++u)try{T[u](E)}catch(t){C("Rangy init listener threw an exception. Continuing. Detail: "+M(t))}}else N("Neither Range nor TextRange are available");else N("No body element found")}}function A(t,e,n){n&&(t+=" in module "+n.name),E.warn("DEPRECATED: "+t+" is deprecated. Please use "+e+" instead.")}function R(t,e,n,i){t[e]=function(){return A(e,n,i),t[n].apply(t,w.toArray(arguments))}}w.deprecationNotice=A,w.createAliasForDeprecatedMethod=R,E.init=k,E.addInitListener=function(t){E.initialized?t(E):T.push(t)};var O=[];function P(t){t=t||window,k();for(var e=0,n=O.length;e<n;++e)O[e](t)}function D(t,e,n){this.name=t,this.dependencies=e,this.initialized=!1,this.supported=!1,this.initializer=n}function L(t,e,n){var i=new D(t,e,(function(e){if(!e.initialized){e.initialized=!0;try{n(E,e),e.supported=!0}catch(e){C("Module '"+t+"' failed to load: "+M(e)),e.stack&&C(e.stack)}}}));return b[t]=i,i}function I(){}function B(){}E.addShimListener=function(t){O.push(t)},x&&(E.shim=E.createMissingNativeApi=P,R(E,"createMissingNativeApi","shim")),D.prototype={init:function(){for(var t,e,n=this.dependencies||[],i=0,o=n.length;i<o;++i){if(e=n[i],!((t=b[e])&&t instanceof D))throw new Error("required module '"+e+"' not found");if(t.init(),!t.supported)throw new Error("required module '"+e+"' not supported")}this.initializer(this)},fail:function(t){throw this.initialized=!0,this.supported=!1,new Error(t)},warn:function(t){E.warn("Module "+this.name+": "+t)},deprecationNotice:function(t,e){E.warn("DEPRECATED: "+t+" in module "+this.name+" is deprecated. Please use "+e+" instead")},createError:function(t){return new Error("Error in Rangy "+this.name+" module: "+t)}},E.createModule=function(t){var e,n;2==arguments.length?(e=arguments[1],n=[]):(e=arguments[2],n=arguments[1]);var i=L(t,n,e);E.initialized&&E.supported&&i.init()},E.createCoreModule=function(t,e,n){L(t,e,n)},E.RangePrototype=I,E.rangePrototype=new I,E.selectionPrototype=new B,E.createCoreModule("DomUtil",[],(function(t,e){var n="undefined",i=t.util,o=i.getBody;i.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||e.fail("document missing a Node creation method"),i.isHostMethod(document,"getElementsByTagName")||e.fail("document missing getElementsByTagName method");var r=document.createElement("div");i.areHostMethods(r,["insertBefore","appendChild","cloneNode"]||!i.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"]))||e.fail("Incomplete Element implementation"),i.isHostProperty(r,"innerHTML")||e.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"]))||e.fail("Incomplete Text Node implementation");var s=function(t,e){for(var n=t.length;n--;)if(t[n]===e)return!0;return!1};function l(t){var e;return typeof t.namespaceURI==n||null===(e=t.namespaceURI)||"http://www.w3.org/1999/xhtml"==e}function u(t){var e=t.parentNode;return 1==e.nodeType?e:null}function c(t){for(var e=0;t=t.previousSibling;)++e;return e}function d(t){switch(t.nodeType){case 7:case 10:return 0;case 3:case 8:return t.length;default:return t.childNodes.length}}function h(t,e){var n,i=[];for(n=t;n;n=n.parentNode)i.push(n);for(n=e;n;n=n.parentNode)if(s(i,n))return n;return null}function f(t,e,n){for(var i=n?e:e.parentNode;i;){if(i===t)return!0;i=i.parentNode}return!1}function p(t,e){return f(t,e,!0)}function g(t,e,n){for(var i,o=n?t:t.parentNode;o;){if((i=o.parentNode)===e)return o;o=i}return null}function v(t){var e=t.nodeType;return 3==e||4==e||8==e}function m(t){if(!t)return!1;var e=t.nodeType;return 3==e||8==e}function y(t,e){var n=e.nextSibling,i=e.parentNode;return n?i.insertBefore(t,n):i.appendChild(t),t}function b(t,e,n){var i=t.cloneNode(!1);if(i.deleteData(0,e),t.deleteData(e,t.length-e),y(i,t),n)for(var o,r=0;o=n[r++];)o.node==t&&o.offset>e?(o.node=i,o.offset-=e):o.node==t.parentNode&&o.offset>c(t)&&++o.offset;return i}function x(t){if(9==t.nodeType)return t;if(typeof t.ownerDocument!=n)return t.ownerDocument;if(typeof t.document!=n)return t.document;if(t.parentNode)return x(t.parentNode);throw e.createError("getDocument: no document found for node")}function w(t){var i=x(t);if(typeof i.defaultView!=n)return i.defaultView;if(typeof i.parentWindow!=n)return i.parentWindow;throw e.createError("Cannot get a window object for node")}function E(t){if(typeof t.contentDocument!=n)return t.contentDocument;if(typeof t.contentWindow!=n)return t.contentWindow.document;throw e.createError("getIframeDocument: No Document object found for iframe element")}function C(t){if(typeof t.contentWindow!=n)return t.contentWindow;if(typeof t.contentDocument!=n)return t.contentDocument.defaultView;throw e.createError("getIframeWindow: No Window object found for iframe element")}function _(t){return t&&i.isHostMethod(t,"setTimeout")&&i.isHostObject(t,"document")}function N(t,e,n){var o;if(t?i.isHostProperty(t,"nodeType")?o=1==t.nodeType&&"iframe"==t.tagName.toLowerCase()?E(t):x(t):_(t)&&(o=t.document):o=document,!o)throw e.createError(n+"(): Parameter must be a Window object or DOM node");return o}function S(t){for(var e;e=t.parentNode;)t=e;return t}function T(t,n,i,o){var r,a,s,l,u;if(t==i)return n===o?0:n<o?-1:1;if(r=g(i,t,!0))return n<=c(r)?-1:1;if(r=g(t,i,!0))return c(r)<o?-1:1;if(!(a=h(t,i)))throw new Error("comparePoints error: nodes have no common ancestor");if((s=t===a?a:g(t,a,!0))===(l=i===a?a:g(i,a,!0)))throw e.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 M,k=!1;function A(t){try{return t.parentNode,!1}catch(t){return!0}}function R(t){if(!t)return"[No node]";if(k&&A(t))return"[Broken node]";if(v(t))return'"'+t.data+'"';if(1==t.nodeType){var e=t.id?' id="'+t.id+'"':"";return"<"+t.nodeName+e+">[index:"+c(t)+",length:"+t.childNodes.length+"]["+(t.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return t.nodeName}function O(t){for(var e,n=x(t).createDocumentFragment();e=t.firstChild;)n.appendChild(e);return n}function P(t,e,n){var i=o(t),r=t.createElement("div");r.contentEditable=""+!!n,e&&(r.innerHTML=e);var a=i.firstChild;return a?i.insertBefore(r,a):i.appendChild(r),r}function D(t){return t.parentNode.removeChild(t)}function L(t){this.root=t,this._next=t}function I(t){return new L(t)}function B(t,e){this.node=t,this.offset=e}function j(t){this.code=this[t],this.codeName=t,this.message="DOMException: "+this.codeName}!function(){var e=document.createElement("b");e.innerHTML="1";var n=e.firstChild;e.innerHTML="<br />",k=A(n),t.features.crashyTextNodes=k}(),typeof window.getComputedStyle!=n?M=function(t,e){return w(t).getComputedStyle(t,null)[e]}:typeof document.documentElement.currentStyle!=n?M=function(t,e){return t.currentStyle?t.currentStyle[e]:""}:e.fail("No means of obtaining computed style properties found"),L.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var t,e,n=this._current=this._next;if(this._current)if(t=n.firstChild)this._next=t;else{for(e=null;n!==this.root&&!(e=n.nextSibling);)n=n.parentNode;this._next=e}return this._current},detach:function(){this._current=this._next=this.root=null}},B.prototype={equals:function(t){return!!t&&this.node===t.node&&this.offset==t.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},t.dom={arrayContains:s,isHtmlNamespace:l,parentElement:u,getNodeIndex:c,getNodeLength:d,getCommonAncestor:h,isAncestorOf:f,isOrIsAncestorOf:p,getClosestAncestorIn:g,isCharacterDataNode:v,isTextOrCommentNode:m,insertAfter:y,splitDataNode:b,getDocument:x,getWindow:w,getIframeWindow:C,getIframeDocument:E,getBody:o,isWindow:_,getContentDocument:N,getRootContainer:S,comparePoints:T,isBrokenNode:A,inspectNode:R,getComputedStyleProperty:M,createTestElement:P,removeNode:D,fragmentFromNodeChildren:O,createIterator:I,DomPosition:B},t.DOMException=j})),E.createCoreModule("DomRange",["DomUtil"],(function(t,e){var n=t.dom,i=t.util,o=n.DomPosition,r=t.DOMException,a=n.isCharacterDataNode,s=n.getNodeIndex,l=n.isOrIsAncestorOf,u=n.getDocument,c=n.comparePoints,d=n.splitDataNode,h=n.getClosestAncestorIn,f=n.getNodeLength,p=n.arrayContains,g=n.getRootContainer,v=t.features.crashyTextNodes,m=n.removeNode;function y(t,e){return 3!=t.nodeType&&(l(t,e.startContainer)||l(t,e.endContainer))}function b(t){return t.document||u(t.startContainer)}function x(t){return g(t.startContainer)}function w(t){return new o(t.parentNode,s(t))}function E(t){return new o(t.parentNode,s(t)+1)}function C(t,e,i){var o=11==t.nodeType?t.firstChild:t;return a(e)?i==e.length?n.insertAfter(t,e):e.parentNode.insertBefore(t,0==i?e:d(e,i)):i>=e.childNodes.length?e.appendChild(t):e.insertBefore(t,e.childNodes[i]),o}function _(t,e,n){if($(t),$(e),b(e)!=b(t))throw new r("WRONG_DOCUMENT_ERR");var i=c(t.startContainer,t.startOffset,e.endContainer,e.endOffset),o=c(t.endContainer,t.endOffset,e.startContainer,e.startOffset);return n?i<=0&&o>=0:i<0&&o>0}function N(t){for(var e,n,i,o=b(t.range).createDocumentFragment();n=t.next();){if(e=t.isPartiallySelectedSubtree(),n=n.cloneNode(!e),e&&(i=t.getSubtreeIterator(),n.appendChild(N(i)),i.detach()),10==n.nodeType)throw new r("HIERARCHY_REQUEST_ERR");o.appendChild(n)}return o}function S(t,e,i){var o,r,a,s;for(i=i||{stop:!1};a=t.next();)if(t.isPartiallySelectedSubtree()){if(!1===e(a))return void(i.stop=!0);if(S(s=t.getSubtreeIterator(),e,i),s.detach(),i.stop)return}else for(o=n.createIterator(a);r=o.next();)if(!1===e(r))return void(i.stop=!0)}function T(t){for(var e;t.next();)t.isPartiallySelectedSubtree()?(T(e=t.getSubtreeIterator()),e.detach()):t.remove()}function M(t){for(var e,n,i=b(t.range).createDocumentFragment();e=t.next();){if(t.isPartiallySelectedSubtree()?(e=e.cloneNode(!1),n=t.getSubtreeIterator(),e.appendChild(M(n)),n.detach()):t.remove(),10==e.nodeType)throw new r("HIERARCHY_REQUEST_ERR");i.appendChild(e)}return i}function k(t,e,n){var i,o=!(!e||!e.length),r=!!n;o&&(i=new RegExp("^("+e.join("|")+")$"));var s=[];return S(new R(t,!1),(function(e){if((!o||i.test(e.nodeType))&&(!r||n(e))){var l=t.startContainer;if(e!=l||!a(l)||t.startOffset!=l.length){var u=t.endContainer;e==u&&a(u)&&0==t.endOffset||s.push(e)}}})),s}function A(t){return"["+(void 0===t.getName?"Range":t.getName())+"("+n.inspectNode(t.startContainer)+":"+t.startOffset+", "+n.inspectNode(t.endContainer)+":"+t.endOffset+")]"}function R(t,e){if(this.range=t,this.clonePartiallySelectedTextNodes=e,!t.collapsed){this.sc=t.startContainer,this.so=t.startOffset,this.ec=t.endContainer,this.eo=t.endOffset;var n=t.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 t=this._current=this._next;return t&&(this._next=t!==this._last?t.nextSibling:null,a(t)&&this.clonePartiallySelectedTextNodes&&(t===this.ec&&(t=t.cloneNode(!0)).deleteData(this.eo,t.length-this.eo),this._current===this.sc&&(t=t.cloneNode(!0)).deleteData(0,this.so))),t},remove:function(){var t,e,n=this._current;!a(n)||n!==this.sc&&n!==this.ec?n.parentNode&&m(n):(t=n===this.sc?this.so:0)!=(e=n===this.ec?this.eo:n.length)&&n.deleteData(t,e-t)},isPartiallySelectedSubtree:function(){return y(this._current,this.range)},getSubtreeIterator:function(){var t;if(this.isSingleCharacterDataNode)(t=this.range.cloneRange()).collapse(!1);else{t=new mt(b(this.range));var e=this._current,n=e,i=0,o=e,r=f(e);l(e,this.sc)&&(n=this.sc,i=this.so),l(e,this.ec)&&(o=this.ec,r=this.eo),vt(t,n,i,o,r)}return new R(t,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var O=[1,3,4,5,7,8,10],P=[2,9,11],D=[5,6,10,12],L=[1,3,4,5,7,8,10,11],I=[1,3,4,5,7,8];function B(t){return function(e,n){for(var i,o=n?e:e.parentNode;o;){if(i=o.nodeType,p(t,i))return o;o=o.parentNode}return null}}var j=B([9,11]),F=B(D),H=B([6,10,12]),W=B([1]);function z(t,e){if(H(t,e))throw new r("INVALID_NODE_TYPE_ERR")}function U(t,e){if(!p(e,t.nodeType))throw new r("INVALID_NODE_TYPE_ERR")}function q(t,e){if(e<0||e>(a(t)?t.length:t.childNodes.length))throw new r("INDEX_SIZE_ERR")}function G(t,e){if(j(t,!0)!==j(e,!0))throw new r("WRONG_DOCUMENT_ERR")}function V(t){if(F(t,!0))throw new r("NO_MODIFICATION_ALLOWED_ERR")}function K(t,e){if(!t)throw new r(e)}function X(t,e){return e<=(a(t)?t.length:t.childNodes.length)}function Y(t){return!!t.startContainer&&!!t.endContainer&&!(v&&(n.isBrokenNode(t.startContainer)||n.isBrokenNode(t.endContainer)))&&g(t.startContainer)==g(t.endContainer)&&X(t.startContainer,t.startOffset)&&X(t.endContainer,t.endOffset)}function $(t){if(!Y(t))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+t.inspect()+")")}var Z=document.createElement("style"),J=!1;try{Z.innerHTML="<b>x</b>",J=3==Z.firstChild.nodeType}catch(t){}t.features.htmlParsingConforms=J;var Q=J?function(t){var e=this.startContainer,i=u(e);if(!e)throw new r("INVALID_STATE_ERR");var o=null;return 1==e.nodeType?o=e:a(e)&&(o=n.parentElement(e)),(o=null===o||"HTML"==o.nodeName&&n.isHtmlNamespace(u(o).documentElement)&&n.isHtmlNamespace(o)?i.createElement("body"):o.cloneNode(!1)).innerHTML=t,n.fragmentFromNodeChildren(o)}:function(t){var e=b(this).createElement("body");return e.innerHTML=t,n.fragmentFromNodeChildren(e)};function tt(t,e){$(t);var n=t.startContainer,i=t.startOffset,o=t.endContainer,r=t.endOffset,l=n===o;a(o)&&r>0&&r<o.length&&d(o,r,e),a(n)&&i>0&&i<n.length&&(n=d(n,i,e),l?(r-=i,o=n):o==n.parentNode&&r>=s(n)&&r++,i=0),t.setStartAndEnd(n,i,o,r)}function et(t){$(t);var e=t.commonAncestorContainer.parentNode.cloneNode(!1);return e.appendChild(t.cloneContents()),e.innerHTML}var nt=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],it=0,ot=1,rt=2,at=3,st=0,lt=1,ut=2,ct=3;function dt(t){t.START_TO_START=it,t.START_TO_END=ot,t.END_TO_END=rt,t.END_TO_START=at,t.NODE_BEFORE=st,t.NODE_AFTER=lt,t.NODE_BEFORE_AND_AFTER=ut,t.NODE_INSIDE=ct}function ht(t){dt(t),dt(t.prototype)}function ft(t,e){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,V),a.reset();var s=t(a);return a.detach(),e(this,i,o,i,o),s}}function pt(e,n){function o(t,e){return function(n){U(n,O),U(g(n),P);var i=(t?w:E)(n);(e?r:l)(this,i.node,i.offset)}}function r(t,e,i){var o=t.endContainer,r=t.endOffset;e===t.startContainer&&i===t.startOffset||(g(e)==g(o)&&1!=c(e,i,o,r)||(o=e,r=i),n(t,e,i,o,r))}function l(t,e,i){var o=t.startContainer,r=t.startOffset;e===t.endContainer&&i===t.endOffset||(g(e)==g(o)&&-1!=c(e,i,o,r)||(o=e,r=i),n(t,o,r,e,i))}var u=function(){};u.prototype=t.rangePrototype,e.prototype=new u,i.extend(e.prototype,{setStart:function(t,e){z(t,!0),q(t,e),r(this,t,e)},setEnd:function(t,e){z(t,!0),q(t,e),l(this,t,e)},setStartAndEnd:function(){var t=arguments,e=t[0],i=t[1],o=e,r=i;switch(t.length){case 3:r=t[2];break;case 4:o=t[2],r=t[3]}z(e,!0),q(e,i),z(o,!0),q(o,r),n(this,e,i,o,r)},setBoundary:function(t,e,n){this["set"+(n?"Start":"End")](t,e)},setStartBefore:o(!0,!0),setStartAfter:o(!1,!0),setEndBefore:o(!0,!1),setEndAfter:o(!1,!1),collapse:function(t){$(this),t?n(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):n(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(t){z(t,!0),n(this,t,0,t,f(t))},selectNode:function(t){z(t,!1),U(t,O);var e=w(t),i=E(t);n(this,e.node,e.offset,i.node,i.offset)},extractContents:ft(M,n),deleteContents:ft(T,n),canSurroundContents:function(){$(this),V(this.startContainer),V(this.endContainer);var t=new R(this,!0),e=t._first&&y(t._first,this)||t._last&&y(t._last,this);return t.detach(),!e},splitBoundaries:function(){tt(this)},splitBoundariesPreservingPositions:function(t){tt(this,t)},normalizeBoundaries:function(){$(this);var t,e=this.startContainer,i=this.startOffset,o=this.endContainer,r=this.endOffset,l=function(t){var e=t.nextSibling;e&&e.nodeType==t.nodeType&&(o=t,r=t.length,t.appendData(e.data),m(e))},u=function(t){var n=t.previousSibling;if(n&&n.nodeType==t.nodeType){e=t;var a=t.length;if(i=n.length,t.insertData(0,n.data),m(n),e==o)r+=i,o=e;else if(o==t.parentNode){var l=s(t);r==l?(o=t,r=a):r>l&&r--}}},c=!0;if(a(o))r==o.length?l(o):0==r&&(t=o.previousSibling)&&t.nodeType==o.nodeType&&(r=t.length,e==o&&(c=!1),t.appendData(o.data),m(o),o=t);else{if(r>0){var d=o.childNodes[r-1];d&&a(d)&&l(d)}c=!this.collapsed}if(c){if(a(e))0==i?u(e):i==e.length&&(t=e.nextSibling)&&t.nodeType==e.nodeType&&(o==t&&(o=e,r+=e.length),e.appendData(t.data),m(t));else if(i<e.childNodes.length){var h=e.childNodes[i];h&&a(h)&&u(h)}}else e=o,i=r;n(this,e,i,o,r)},collapseToPoint:function(t,e){z(t,!0),q(t,e),this.setStartAndEnd(t,e)},parentElement:function(){return $(this),this.commonAncestorContainer?W(this.commonAncestorContainer,!0):null}}),ht(e)}function gt(t){t.collapsed=t.startContainer===t.endContainer&&t.startOffset===t.endOffset,t.commonAncestorContainer=t.collapsed?t.startContainer:n.getCommonAncestor(t.startContainer,t.endContainer)}function vt(t,e,i,o,r){t.startContainer=e,t.startOffset=i,t.endContainer=o,t.endOffset=r,t.document=n.getDocument(e),gt(t)}function mt(t){vt(this,t,0,t,0)}i.extend(t.rangePrototype,{compareBoundaryPoints:function(t,e){var n,i,o,r;$(this),G(this.startContainer,e.startContainer);var a=t==at||t==it?"start":"end",s=t==ot||t==it?"start":"end";return n=this[a+"Container"],i=this[a+"Offset"],o=e[s+"Container"],r=e[s+"Offset"],c(n,i,o,r)},insertNode:function(t){if($(this),U(t,L),V(this.startContainer),l(t,this.startContainer))throw new r("HIERARCHY_REQUEST_ERR");var e=C(t,this.startContainer,this.startOffset);this.setStartBefore(e)},cloneContents:function(){var t,e;if($(this),this.collapsed)return b(this).createDocumentFragment();if(this.startContainer===this.endContainer&&a(this.startContainer))return(t=this.startContainer.cloneNode(!0)).data=t.data.slice(this.startOffset,this.endOffset),(e=b(this).createDocumentFragment()).appendChild(t),e;var n=new R(this,!0);return t=N(n),n.detach(),t},canSurroundContents:function(){$(this),V(this.startContainer),V(this.endContainer);var t=new R(this,!0),e=t._first&&y(t._first,this)||t._last&&y(t._last,this);return t.detach(),!e},surroundContents:function(t){if(U(t,I),!this.canSurroundContents())throw new r("INVALID_STATE_ERR");var e=this.extractContents();if(t.hasChildNodes())for(;t.lastChild;)t.removeChild(t.lastChild);C(t,this.startContainer,this.startOffset),t.appendChild(e),this.selectNode(t)},cloneRange:function(){$(this);for(var t,e=new mt(b(this)),n=nt.length;n--;)e[t=nt[n]]=this[t];return e},toString:function(){$(this);var t=this.startContainer;if(t===this.endContainer&&a(t))return 3==t.nodeType||4==t.nodeType?t.data.slice(this.startOffset,this.endOffset):"";var e=[],n=new R(this,!0);return S(n,(function(t){3!=t.nodeType&&4!=t.nodeType||e.push(t.data)})),n.detach(),e.join("")},compareNode:function(t){$(this);var e=t.parentNode,n=s(t);if(!e)throw new r("NOT_FOUND_ERR");var i=this.comparePoint(e,n),o=this.comparePoint(e,n+1);return i<0?o>0?ut:st:o>0?lt:ct},comparePoint:function(t,e){return $(this),K(t,"HIERARCHY_REQUEST_ERR"),G(t,this.startContainer),c(t,e,this.startContainer,this.startOffset)<0?-1:c(t,e,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:Q,toHtml:function(){return et(this)},intersectsNode:function(t,e){if($(this),g(t)!=x(this))return!1;var n=t.parentNode,i=s(t);if(!n)return!0;var o=c(n,i,this.endContainer,this.endOffset),r=c(n,i+1,this.startContainer,this.startOffset);return e?o<=0&&r>=0:o<0&&r>0},isPointInRange:function(t,e){return $(this),K(t,"HIERARCHY_REQUEST_ERR"),G(t,this.startContainer),c(t,e,this.startContainer,this.startOffset)>=0&&c(t,e,this.endContainer,this.endOffset)<=0},intersectsRange:function(t){return _(this,t,!1)},intersectsOrTouchesRange:function(t){return _(this,t,!0)},intersection:function(t){if(this.intersectsRange(t)){var e=c(this.startContainer,this.startOffset,t.startContainer,t.startOffset),n=c(this.endContainer,this.endOffset,t.endContainer,t.endOffset),i=this.cloneRange();return-1==e&&i.setStart(t.startContainer,t.startOffset),1==n&&i.setEnd(t.endContainer,t.endOffset),i}return null},union:function(t){if(this.intersectsOrTouchesRange(t)){var e=this.cloneRange();return-1==c(t.startContainer,t.startOffset,this.startContainer,this.startOffset)&&e.setStart(t.startContainer,t.startOffset),1==c(t.endContainer,t.endOffset,this.endContainer,this.endOffset)&&e.setEnd(t.endContainer,t.endOffset),e}throw new r("Ranges do not intersect")},containsNode:function(t,e){return e?this.intersectsNode(t,!1):this.compareNode(t)==ct},containsNodeContents:function(t){return this.comparePoint(t,0)>=0&&this.comparePoint(t,f(t))<=0},containsRange:function(t){var e=this.intersection(t);return null!==e&&t.equals(e)},containsNodeText:function(t){var e=this.cloneRange();e.selectNode(t);var n=e.getNodes([3]);if(n.length>0){e.setStart(n[0],0);var i=n.pop();return e.setEnd(i,i.length),this.containsRange(e)}return this.containsNodeContents(t)},getNodes:function(t,e){return $(this),k(this,t,e)},getDocument:function(){return b(this)},collapseBefore:function(t){this.setEndBefore(t),this.collapse(!1)},collapseAfter:function(t){this.setStartAfter(t),this.collapse(!0)},getBookmark:function(e){var i=b(this),o=t.createRange(i);e=e||n.getBody(i),o.selectNodeContents(e);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:e}},moveToBookmark:function(t){var e=t.containerNode,n=0;this.setStart(e,0),this.collapse(!0);for(var i,o,r,a,s=[e],l=!1,u=!1;!u&&(i=s.pop());)if(3==i.nodeType)o=n+i.length,!l&&t.start>=n&&t.start<=o&&(this.setStart(i,t.start-n),l=!0),l&&t.end>=n&&t.end<=o&&(this.setEnd(i,t.end-n),u=!0),n=o;else for(r=(a=i.childNodes).length;r--;)s.push(a[r])},getName:function(){return"DomRange"},equals:function(t){return mt.rangesEqual(this,t)},isValid:function(){return Y(this)},inspect:function(){return A(this)},detach:function(){}}),pt(mt,vt),i.extend(mt,{rangeProperties:nt,RangeIterator:R,copyComparisonConstants:ht,createPrototypeRange:pt,inspect:A,toHtml:et,getRangeDocument:b,rangesEqual:function(t,e){return t.startContainer===e.startContainer&&t.startOffset===e.startOffset&&t.endContainer===e.endContainer&&t.endOffset===e.endOffset}}),t.DomRange=mt})),E.createCoreModule("WrappedRange",["DomRange"],(function(t,e){var n,i,o=t.dom,r=t.util,a=o.DomPosition,s=t.DomRange,l=o.getBody,u=o.getContentDocument,c=o.isCharacterDataNode;if(t.features.implementsDomRange&&function(){var i,a,c=s.rangeProperties;function d(t){for(var e,n=c.length;n--;)t[e=c[n]]=t.nativeRange[e];t.collapsed=t.startContainer===t.endContainer&&t.startOffset===t.endOffset}function h(t,e,n,i,o){var r=t.startContainer!==e||t.startOffset!=n,a=t.endContainer!==i||t.endOffset!=o,s=!t.equals(t.nativeRange);(r||a||s)&&(t.setEnd(i,o),t.setStart(e,n))}n=function(t){if(!t)throw e.createError("WrappedRange: Range must be specified");this.nativeRange=t,d(this)},s.createPrototypeRange(n,h),(i=n.prototype).selectNode=function(t){this.nativeRange.selectNode(t),d(this)},i.cloneContents=function(){return this.nativeRange.cloneContents()},i.surroundContents=function(t){this.nativeRange.surroundContents(t),d(this)},i.collapse=function(t){this.nativeRange.collapse(t),d(this)},i.cloneRange=function(){return new n(this.nativeRange.cloneRange())},i.refresh=function(){d(this)},i.toString=function(){return this.nativeRange.toString()};var f=document.createTextNode("test");l(document).appendChild(f);var p=document.createRange();p.setStart(f,0),p.setEnd(f,0);try{p.setStart(f,1),i.setStart=function(t,e){this.nativeRange.setStart(t,e),d(this)},i.setEnd=function(t,e){this.nativeRange.setEnd(t,e),d(this)},a=function(t){return function(e){this.nativeRange[t](e),d(this)}}}catch(t){i.setStart=function(t,e){try{this.nativeRange.setStart(t,e)}catch(n){this.nativeRange.setEnd(t,e),this.nativeRange.setStart(t,e)}d(this)},i.setEnd=function(t,e){try{this.nativeRange.setEnd(t,e)}catch(n){this.nativeRange.setStart(t,e),this.nativeRange.setEnd(t,e)}d(this)},a=function(t,e){return function(n){try{this.nativeRange[t](n)}catch(i){this.nativeRange[e](n),this.nativeRange[t](n)}d(this)}}}i.setStartBefore=a("setStartBefore","setEndBefore"),i.setStartAfter=a("setStartAfter","setEndAfter"),i.setEndBefore=a("setEndBefore","setStartBefore"),i.setEndAfter=a("setEndAfter","setStartAfter"),i.selectNodeContents=function(t){this.setStartAndEnd(t,0,o.getNodeLength(t))},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(t,e){return t==(e=e.nativeRange||e).START_TO_END?t=e.END_TO_START:t==e.END_TO_START&&(t=e.START_TO_END),this.nativeRange.compareBoundaryPoints(t,e)}:i.compareBoundaryPoints=function(t,e){return this.nativeRange.compareBoundaryPoints(t,e.nativeRange||e)};var v=document.createElement("div");v.innerHTML="123";var m=v.firstChild,y=l(document);y.appendChild(v),p.setStart(m,1),p.setEnd(m,2),p.deleteContents(),"13"==m.data&&(i.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},i.extractContents=function(){var t=this.nativeRange.extractContents();return d(this),t}),y.removeChild(v),y=null,r.isHostMethod(p,"createContextualFragment")&&(i.createContextualFragment=function(t){return this.nativeRange.createContextualFragment(t)}),l(document).removeChild(f),i.getName=function(){return"WrappedRange"},t.WrappedRange=n,t.createNativeRange=function(t){return(t=u(t,e,"createNativeRange")).createRange()}}(),t.features.implementsTextRange){var d=function(t){var e=t.parentElement(),n=t.duplicate();n.collapse(!0);var i=n.parentElement();(n=t.duplicate()).collapse(!1);var r=n.parentElement(),a=i==r?i:o.getCommonAncestor(i,r);return a==e?a:o.getCommonAncestor(e,a)},h=function(t){return 0==t.compareEndPoints("StartToEnd",t)},f=function(t,e,n,i,r){var s=t.duplicate();s.collapse(n);var l=s.parentElement();if(o.isOrIsAncestorOf(e,l)||(l=e),!l.canHaveHTML){var u=new a(l.parentNode,o.getNodeIndex(l));return{boundaryPosition:u,nodeInfo:{nodeIndex:u.offset,containerElement:u.node}}}var d=o.getDocument(l).createElement("span");d.parentNode&&o.removeNode(d);for(var h,f,p,g,v,m=n?"StartToStart":"StartToEnd",y=r&&r.containerElement==l?r.nodeIndex:0,b=l.childNodes.length,x=b,w=x;w==b?l.appendChild(d):l.insertBefore(d,l.childNodes[w]),s.moveToElementText(d),0!=(h=s.compareEndPoints(m,t))&&y!=x;){if(-1==h){if(x==y+1)break;y=w}else x=x==y+1?y:w;w=Math.floor((y+x)/2),l.removeChild(d)}if(v=d.nextSibling,-1==h&&v&&c(v)){var E;if(s.setEndPoint(n?"EndToStart":"EndToEnd",t),/[\r\n]/.test(v.data)){var C=s.duplicate(),_=C.text.replace(/\r\n/g,"\r").length;for(E=C.moveStart("character",_);-1==(h=C.compareEndPoints("StartToEnd",C));)E++,C.moveStart("character",1)}else E=s.text.length;g=new a(v,E)}else f=(i||!n)&&d.previousSibling,g=(p=(i||n)&&d.nextSibling)&&c(p)?new a(p,0):f&&c(f)?new a(f,f.data.length):new a(l,o.getNodeIndex(d));return o.removeNode(d),{boundaryPosition:g,nodeInfo:{nodeIndex:w,containerElement:l}}},p=function(t,e){var n,i,r,a,s=t.offset,u=o.getDocument(t.node),d=l(u).createTextRange(),h=c(t.node);return h?i=(n=t.node).parentNode:(n=s<(a=t.node.childNodes).length?a[s]:null,i=t.node),(r=u.createElement("span")).innerHTML="&#feff;",n?i.insertBefore(r,n):i.appendChild(r),d.moveToElementText(r),d.collapse(!e),i.removeChild(r),h&&d[e?"moveStart":"moveEnd"]("character",s),d};(i=function(t){this.textRange=t,this.refresh()}).prototype=new s(document),i.prototype.refresh=function(){var t,e,n,i=d(this.textRange);h(this.textRange)?e=t=f(this.textRange,i,!0,!0).boundaryPosition:(t=(n=f(this.textRange,i,!0,!1)).boundaryPosition,e=f(this.textRange,i,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(t.node,t.offset),this.setEnd(e.node,e.offset)},i.prototype.getName=function(){return"WrappedTextRange"},s.copyComparisonConstants(i);var g=function(t){if(t.collapsed)return p(new a(t.startContainer,t.startOffset),!0);var e=p(new a(t.startContainer,t.startOffset),!0),n=p(new a(t.endContainer,t.endOffset),!1),i=l(s.getRangeDocument(t)).createTextRange();return i.setEndPoint("StartToStart",e),i.setEndPoint("EndToEnd",n),i};if(i.rangeToTextRange=g,i.prototype.toTextRange=function(){return g(this)},t.WrappedTextRange=i,!t.features.implementsDomRange||t.config.preferTextRange){var v=Function("return this;")();void 0===v.Range&&(v.Range=i),t.createNativeRange=function(t){return t=u(t,e,"createNativeRange"),l(t).createTextRange()},t.WrappedRange=i}}t.createRange=function(n){return n=u(n,e,"createRange"),new t.WrappedRange(t.createNativeRange(n))},t.createRangyRange=function(t){return t=u(t,e,"createRangyRange"),new s(t)},r.createAliasForDeprecatedMethod(t,"createIframeRange","createRange"),r.createAliasForDeprecatedMethod(t,"createIframeRangyRange","createRangyRange"),t.addShimListener((function(e){var n=e.document;void 0===n.createRange&&(n.createRange=function(){return t.createRange(n)}),n=e=null}))})),E.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(t,e){t.config.checkSelectionRanges=!0;var n,i,o="boolean",r="number",a=t.dom,s=t.util,l=s.isHostMethod,u=t.DomRange,c=t.WrappedRange,d=t.DOMException,h=a.DomPosition,f=t.features,p="Control",g=a.getDocument,v=a.getBody,m=u.rangesEqual;function y(t){return"string"==typeof t?/^backward(s)?$/i.test(t):!!t}function b(t,n){if(t){if(a.isWindow(t))return t;if(t instanceof $)return t.win;var i=a.getContentDocument(t,e,n);return a.getWindow(i)}return window}function x(t){return b(t,"getWinSelection").getSelection()}function w(t){return b(t,"getDocSelection").document.selection}function E(t){var e=!1;return t.anchorNode&&(e=1==a.comparePoints(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)),e}var C=l(window,"getSelection"),_=s.isHostObject(document,"selection");f.implementsWinGetSelection=C,f.implementsDocSelection=_;var N=_&&(!C||t.config.preferTextRange);if(N)n=w,t.isSelectionValid=function(t){var e=b(t,"isSelectionValid").document,n=e.selection;return"None"!=n.type||g(n.createRange().parentElement())==e};else{if(!C)return e.fail("Neither document.selection or window.getSelection() detected."),!1;n=x,t.isSelectionValid=function(){return!0}}t.getNativeSelection=n;var S=n();if(!S)return e.fail("Native selection was null (possibly issue 138?)"),!1;var T=t.createNativeRange(document),M=v(document),k=s.areHostProperties(S,["anchorNode","focusNode","anchorOffset","focusOffset"]);f.selectionHasAnchorAndFocus=k;var A=l(S,"extend");f.selectionHasExtend=A;var R=l(S,"setBaseAndExtent");f.selectionHasSetBaseAndExtent=R;var O=typeof S.rangeCount==r;f.selectionHasRangeCount=O;var P=!1,D=!0,L=A?function(e,n){var i=u.getRangeDocument(n),o=t.createRange(i);o.collapseToPoint(n.endContainer,n.endOffset),e.addRange(U(o)),e.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(S,["addRange","getRangeAt","removeAllRanges"])&&typeof S.rangeCount==r&&f.implementsDomRange&&function(){var e=window.getSelection();if(e){for(var n=e.rangeCount,i=n>1,o=[],r=E(e),s=0;s<n;++s)o[s]=e.getRangeAt(s);var l=a.createTestElement(document,"",!1),u=l.appendChild(document.createTextNode(" ")),c=document.createRange();if(c.setStart(u,1),c.collapse(!0),e.removeAllRanges(),e.addRange(c),D=1==e.rangeCount,e.removeAllRanges(),!i){var d=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(d&&parseInt(d[1])>=36)P=!1;else{var h=c.cloneRange();c.setStart(u,0),h.setEnd(u,3),h.setStart(u,2),e.addRange(c),e.addRange(h),P=2==e.rangeCount}}for(a.removeNode(l),e.removeAllRanges(),s=0;s<n;++s)0==s&&r?L?L(e,o[s]):(t.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),e.addRange(o[s])):e.addRange(o[s])}}(),f.selectionSupportsMultipleRanges=P,f.collapsedNonEditableSelectionsSupported=D;var I,B,j=!1;function F(t,e,n){var i=n?"end":"start",o=n?"start":"end";t.anchorNode=e[i+"Container"],t.anchorOffset=e[i+"Offset"],t.focusNode=e[o+"Container"],t.focusOffset=e[o+"Offset"]}function H(t){var e=t.nativeSelection;t.anchorNode=e.anchorNode,t.anchorOffset=e.anchorOffset,t.focusNode=e.focusNode,t.focusOffset=e.focusOffset}function W(t){t.anchorNode=t.focusNode=null,t.anchorOffset=t.focusOffset=0,t.rangeCount=0,t.isCollapsed=!0,t._ranges.length=0,z(t)}function z(t){t.type=0==t.rangeCount?"None":i(t)?"Caret":"Range"}function U(e){var n;return e instanceof u?((n=t.createNativeRange(e.getDocument())).setEnd(e.endContainer,e.endOffset),n.setStart(e.startContainer,e.startOffset)):e instanceof c?n=e.nativeRange:f.implementsDomRange&&e instanceof a.getWindow(e.startContainer).Range&&(n=e),n}function q(t){if(!t.length||1!=t[0].nodeType)return!1;for(var e=1,n=t.length;e<n;++e)if(!a.isAncestorOf(t[0],t[e]))return!1;return!0}function G(t){var n=t.getNodes();if(!q(n))throw e.createError("getSingleElementFromRange: range "+t.inspect()+" did not consist of a single element");return n[0]}function V(t){return!!t&&void 0!==t.text}function K(t,e){var n=new c(e);t._ranges=[n],F(t,n,!1),t.rangeCount=1,t.isCollapsed=n.collapsed,z(t)}function X(e){if(e._ranges.length=0,"None"==e.docSelection.type)W(e);else{var n=e.docSelection.createRange();if(V(n))K(e,n);else{e.rangeCount=n.length;for(var i,o=g(n.item(0)),r=0;r<e.rangeCount;++r)(i=t.createRange(o)).selectNode(n.item(r)),e._ranges.push(i);e.isCollapsed=1==e.rangeCount&&e._ranges[0].collapsed,F(e,e._ranges[e.rangeCount-1],!1),z(e)}}}function Y(t,n){for(var i=t.docSelection.createRange(),o=G(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(t){throw e.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}a.select(),X(t)}function $(t,e,n){this.nativeSelection=t,this.docSelection=e,this._ranges=[],this.win=n,this.refresh()}function Z(t){t.win=t.anchorNode=t.focusNode=t._ranges=null,t.rangeCount=t.anchorOffset=t.focusOffset=0,t.detached=!0,z(t)}M&&l(M,"createControlRange")&&(I=M.createControlRange(),s.areHostProperties(I,["item","add"])&&(j=!0)),f.implementsControlRange=j,i=k?function(t){return t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset}:function(t){return!!t.rangeCount&&t.getRangeAt(t.rangeCount-1).collapsed},l(S,"getRangeAt")?B=function(t,e){try{return t.getRangeAt(e)}catch(t){return null}}:k&&(B=function(e){var n=g(e.anchorNode),i=t.createRange(n);return i.setStartAndEnd(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset),i.collapsed!==this.isCollapsed&&i.setStartAndEnd(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset),i}),$.prototype=t.selectionPrototype;var J=[];function Q(t,e){for(var n,i,o=J.length;o--;)if(i=(n=J[o]).selection,"deleteAll"==e)Z(i);else if(n.win==t)return"delete"==e?(J.splice(o,1),!0):i;return"deleteAll"==e&&(J.length=0),null}var tt=function(t){if(t&&t instanceof $)return t.refresh(),t;var e=Q(t=b(t,"getNativeSelection")),i=n(t),o=_?w(t):null;return e?(e.nativeSelection=i,e.docSelection=o,e.refresh()):(e=new $(i,o,t),J.push({win:t,selection:e})),e};t.getSelection=tt,s.createAliasForDeprecatedMethod(t,"getIframeSelection","getSelection");var et,nt=$.prototype;function it(t,n){for(var i,o=g(n[0].startContainer),r=v(o).createControlRange(),a=0,s=n.length;a<s;++a){i=G(n[a]);try{r.add(i)}catch(t){throw e.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),X(t)}if(!N&&k&&s.areHostMethods(S,["removeAllRanges","addRange"])){nt.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),W(this)};var ot=function(t,e){L(t.nativeSelection,e),t.refresh()};nt.addRange=O?function(e,n){if(j&&_&&this.docSelection.type==p)Y(this,e);else if(y(n)&&A)ot(this,e);else{var o;P?o=this.rangeCount:(this.removeAllRanges(),o=0);var r=U(e).cloneRange();try{this.nativeSelection.addRange(r)}catch(t){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==o+1){if(t.config.checkSelectionRanges){var a=B(this.nativeSelection,this.rangeCount-1);a&&!m(a,e)&&(e=new c(a))}this._ranges[this.rangeCount-1]=e,F(this,e,rt(this.nativeSelection)),this.isCollapsed=i(this),z(this)}else this.refresh()}}:function(t,e){y(e)&&A?ot(this,t):(this.nativeSelection.addRange(U(t)),this.refresh())},nt.setRanges=function(t){if(j&&_&&t.length>1)it(this,t);else{this.removeAllRanges();for(var e=0,n=t.length;e<n;++e)this.addRange(t[e])}}}else{if(!(l(S,"empty")&&l(T,"select")&&j&&N))return e.fail("No means of selecting a Range or TextRange was found"),!1;nt.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var t;if(this.anchorNode)t=g(this.anchorNode);else if(this.docSelection.type==p){var e=this.docSelection.createRange();e.length&&(t=g(e.item(0)))}t&&(v(t).createTextRange().select(),this.docSelection.empty())}}catch(t){}W(this)},nt.addRange=function(e){this.docSelection.type==p?Y(this,e):(t.WrappedTextRange.rangeToTextRange(e).select(),this._ranges[0]=e,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,F(this,e,!1),z(this))},nt.setRanges=function(t){this.removeAllRanges();var e=t.length;e>1?it(this,t):e&&this.addRange(t[0])}}if(nt.getRangeAt=function(t){if(t<0||t>=this.rangeCount)throw new d("INDEX_SIZE_ERR");return this._ranges[t].cloneRange()},N)et=function(e){var n;t.isSelectionValid(e.win)?n=e.docSelection.createRange():(n=v(e.win.document).createTextRange()).collapse(!0),e.docSelection.type==p?X(e):V(n)?K(e,n):W(e)};else if(l(S,"getRangeAt")&&typeof S.rangeCount==r)et=function(e){if(j&&_&&e.docSelection.type==p)X(e);else if(e._ranges.length=e.rangeCount=e.nativeSelection.rangeCount,e.rangeCount){for(var n=0,o=e.rangeCount;n<o;++n)e._ranges[n]=new t.WrappedRange(e.nativeSelection.getRangeAt(n));F(e,e._ranges[e.rangeCount-1],rt(e.nativeSelection)),e.isCollapsed=i(e),z(e)}else W(e)};else{if(!k||typeof S.isCollapsed!=o||typeof T.collapsed!=o||!f.implementsDomRange)return e.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;et=function(t){var e,n=t.nativeSelection;n.anchorNode?(e=B(n,0),t._ranges=[e],t.rangeCount=1,H(t),t.isCollapsed=i(t),z(t)):W(t)}}nt.refresh=function(t){var e=t?this._ranges.slice(0):null,n=this.anchorNode,i=this.anchorOffset;if(et(this),t){var o=e.length;if(o!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=i)return!0;for(;o--;)if(!m(e[o],this._ranges[o]))return!0;return!1}};var rt,at=function(t,e){var n=t.getAllRanges();t.removeAllRanges();for(var i=0,o=n.length;i<o;++i)m(e,n[i])||t.addRange(n[i]);t.rangeCount||W(t)};function st(t,e){if(t.win.document!=g(e))throw new d("WRONG_DOCUMENT_ERR")}function lt(t,e){if(e<0||e>(a.isCharacterDataNode(t)?t.length:t.childNodes.length))throw new d("INDEX_SIZE_ERR")}function ut(e){return function(n,i){var o;this.rangeCount?(o=this.getRangeAt(0))["set"+(e?"Start":"End")](n,i):(o=t.createRange(this.win.document)).setStartAndEnd(n,i),this.setSingleRange(o,this.isBackward())}}function ct(t){var e=[],n=new h(t.anchorNode,t.anchorOffset),i=new h(t.focusNode,t.focusOffset),o="function"==typeof t.getName?t.getName():"Selection";if(void 0!==t.rangeCount)for(var r=0,a=t.rangeCount;r<a;++r)e[r]=u.inspect(t.getRangeAt(r));return"["+o+"(Ranges: "+e.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}nt.removeRange=j&&_?function(t){if(this.docSelection.type==p){for(var e=this.docSelection.createRange(),n=G(t),i=g(e.item(0)),o=v(i).createControlRange(),r=!1,a=0,s=e.length;a<s;++a)e.item(a)!==n||r?o.add(e.item(a)):r=!0;o.select(),X(this)}else at(this,t)}:function(t){at(this,t)},!N&&k&&f.implementsDomRange?(rt=E,nt.isBackward=function(){return rt(this)}):rt=nt.isBackward=function(){return!1},nt.isBackwards=nt.isBackward,nt.toString=function(){for(var t=[],e=0,n=this.rangeCount;e<n;++e)t[e]=""+this._ranges[e];return t.join("")},nt.collapse=function(e,n){st(this,e);var i=t.createRange(e);i.collapseToPoint(e,n),this.setSingleRange(i),this.isCollapsed=!0},nt.collapseToStart=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var t=this._ranges[0];this.collapse(t.startContainer,t.startOffset)},nt.collapseToEnd=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var t=this._ranges[this.rangeCount-1];this.collapse(t.endContainer,t.endOffset)},nt.selectAllChildren=function(e){st(this,e);var n=t.createRange(e);n.selectNodeContents(e),this.setSingleRange(n)},R?nt.setBaseAndExtent=function(t,e,n,i){this.nativeSelection.setBaseAndExtent(t,e,n,i),this.refresh()}:A&&(nt.setBaseAndExtent=function(e,n,i,o){lt(e,n),lt(i,o),st(this,e),st(this,i);var r=t.createRange(node),s=-1==a.comparePoints(e,n,i,o);s?r.setStartAndEnd(i,o,e,n):r.setStartAndEnd(e,n,i,o),this.setSingleRange(r,s)}),nt.deleteFromDocument=function(){if(j&&_&&this.docSelection.type==p){for(var t,e=this.docSelection.createRange();e.length;)t=e.item(0),e.remove(t),a.removeNode(t);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])}}},nt.eachRange=function(t,e){for(var n=0,i=this._ranges.length;n<i;++n)if(t(this.getRangeAt(n)))return e},nt.getAllRanges=function(){var t=[];return this.eachRange((function(e){t.push(e)})),t},nt.setSingleRange=function(t,e){this.removeAllRanges(),this.addRange(t,e)},nt.callMethodOnEachRange=function(t,e){var n=[];return this.eachRange((function(i){n.push(i[t].apply(i,e||[]))})),n},nt.setStart=ut(!0),nt.setEnd=ut(!1),t.rangePrototype.select=function(t){tt(this.getDocument()).setSingleRange(this,t)},nt.changeEachRange=function(t){var e=[],n=this.isBackward();this.eachRange((function(n){t(n),e.push(n)})),this.removeAllRanges(),n&&1==e.length?this.addRange(e[0],"backward"):this.setRanges(e)},nt.containsNode=function(t,e){return this.eachRange((function(n){return n.containsNode(t,e)}),!0)||!1},nt.getBookmark=function(t){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[t])}},nt.moveToBookmark=function(e){for(var n,i,o=[],r=0;n=e.rangeBookmarks[r++];)(i=t.createRange(this.win)).moveToBookmark(n),o.push(i);e.backward?this.setSingleRange(o[0],"backward"):this.setRanges(o)},nt.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},nt.restoreRanges=function(t){this.removeAllRanges();for(var e,n=0;e=t.ranges[n];++n)this.addRange(e,t.backward&&0==n)},nt.toHtml=function(){var t=[];return this.eachRange((function(e){t.push(u.toHtml(e))})),t.join("")},f.implementsTextRange&&(nt.getNativeTextRange=function(){var n;if(n=this.docSelection){var i=n.createRange();if(V(i))return i;throw e.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return t.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw e.createError("getNativeTextRange: selection contains no range")}),nt.getName=function(){return"WrappedSelection"},nt.inspect=function(){return ct(this)},nt.detach=function(){Q(this.win,"delete"),Z(this)},$.detachAll=function(){Q(null,"deleteAll")},$.inspect=ct,$.isDirectionBackward=y,t.Selection=$,t.selectionPrototype=nt,t.addShimListener((function(t){void 0===t.getSelection&&(t.getSelection=function(){return tt(t)}),t=null}))}));var j=!1,F=function(t){j||(j=!0,!E.initialized&&E.config.autoInitialize&&k())};return x&&("complete"==document.readyState?F():(s(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",F,!1),m(window,"load",F))),E}()}({get exports(){return Kv},set exports(t){Kv=t}});var Xv=Kv,Yv={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},$v=Av.extensions.button.extend({name:"colorpicker",tagNames:["mark"],contentDefault:"<b>Color</b>",aria:"Color Picker",action:"colorPicker",init:function(){var t=this;Xv.init(),Av.extensions.button.prototype.init.call(this),this.colorPicker=new Gv({parent:this.button,color:"#000",onDone:function(e){t.coloredText&&t.coloredText.isAppliedToSelection()&&t.coloredText.undoToSelection(),t.coloredText=Xv.createClassApplier("colored",{elementTagName:"span",elementProperties:{style:{color:e.hex}},normalize:!0}),t.coloredText.toggleSelection(),t.base.checkContentChanged(),t.setInactive()}})},getButton:function(){return this.button},handleClick:function(){this.setActive(),this.colorPicker.show()},isAlreadyApplied:function(t){return"mark"===t.nodeName.toLowerCase()},isActive:function(){return this.button.classList.contains("medium-editor-button-active")},setInactive:function(){this.button.classList.remove("medium-editor-button-active")},setActive:function(){this.button.classList.add("medium-editor-button-active")}}),Zv=function(t){function n(e){var n=t.call(this,e)||this;n.labelMap=new Map;var i=e.lf,o=e.graphModel;return n.lf=i,n.graphModel=o,n.state={tick:0},n}return p(n,t),n.prototype.componentDidMount=function(){var t=this,e=this.props.graphModel;this.editor=new Av(".lf-label-editor",cd(Yv,{autoLink:!0,extensions:{colorPicker:new $v}})),e.eventCenter.on("text:update,node:mousemove,node:resize,node:rotate,node:drag,label:drop,node:drop",(function(){})),e.eventCenter.on("node:properties-change,node:properties-delete",(function(){t.setState({tick:t.state.tick+1})}))},n.prototype.componentDidUpdate=function(){var t;this.editor&&this.editor.elements.length>0?this.editor.addElements(".lf-label-editor"):(null===(t=this.editor)||void 0===t||t.destroy(),this.editor=new Av(".lf-label-editor",cd(Yv,{autoLink:!0,extensions:{colorPicker:new $v}})))},n.prototype.componentWillUnmount=function(){var t;null===(t=this.editor)||void 0===t||t.destroy()},n.prototype.getLabels=function(){var t=this,e=this.props,n=e.lf.extension,i=e.graphModel,o=E(E([],w(i.nodes),!1),w(i.edges),!1);if(n.Label){var r=[];return bu(o,(function(e){var n,o;bu(null!==(o=null===(n=e.getData().properties)||void 0===n?void 0:n._label)&&void 0!==o?o:[],(function(n){var o=t.labelMap,a=new Mv(n,e,i);o.set(a.id,a),r.push(Cp(Sv,{label:a,element:e,graphModel:i},a.id))}))})),r}return null},n.prototype.render=function(){return Cp("foreignObject",{id:"lf-label-overlay",class:"lf-label-overlay",children:this.getLabels()})},n.toolName="label-edit-tool",n=m([e.observer],n)}(e.Component);var Jv=function(){function t(t){var n,i,o,r=t.lf,a=t.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(e.TextMode.LABEL),this.addEventListeners(),r.tool.registerTool(Zv.toolName,Zv),r.tool.disableTool("text-edit-tool")}return t.prototype.formatConfig=function(t,n){var i=t.editConfigModel,o=i.nodeTextEdit,r=i.edgeTextEdit,a=i.nodeTextDraggable,s=i.edgeTextDraggable,l=this,u=l.textOverflowMode,c=l.isMultiple,d=l.maxCount,h=l.labelWidth,f=n.text,p=n.zIndex,v=n.properties,m=v._label,y=v._labelOption,b=m,x=void 0===y?{}:y,w=x.isMultiple,E=x.maxCount,C=[];if(ee(b)){var _=null!=E?E:d;C=c&&w?b.length>_?b.slice(0,_):b:[b[0]]}else if(he(b))C=[b];else if("string"==typeof b||!b){var N=g(g({},f),{content:b||f.value,draggable:"edge"===n.BaseType?s:a});C=N.value?[N]:[]}return"edge"===n.BaseType&&(C=$u(C,(function(t){var e=t.x,n=t.y;return console.log("x, y ---\x3e>>",e,n),t}))),$u(C,(function(t){t.id||(t.id=e.createUuid());var i=t.value,l=t.content,c=t.vertical,d=t.editable,f=t.draggable,v=t.textOverflowMode,m="node"===n.BaseType?o:r,y="node"===n.BaseType?a:s;return g(g({},t),{zIndex:p,labelWidth:h,content:null!=l?l:i,vertical:null!=c&&c,editable:m&&d,draggable:y&&f,textOverflowMode:null!=v?v:u})}))},t.prototype.setupLabels=function(t){var e=this;bu(t.sortElements,(function(n){e.rewriteInnerMethods(n);var i=e.formatConfig(t,n);n.setProperty("_label",i)}))},t.prototype.addLabel=function(t,n){var i,o,r,a=this.maxCount,s=t.properties,l=null!==(i=s._label)&&void 0!==i?i:[],u=null!==(o=s._labelOption)&&void 0!==o?o:{},c=l.length,d={id:e.createUuid(),x:n.x,y:n.y,content:"Label".concat(c+1),value:"Label".concat(c+1),style:{},draggable:!0,editable:!0,vertical:!1};c>=(null!==(r=null==u?void 0:u.maxCount)&&void 0!==r?r:a)||(l.push(d),t.setProperty("_label",l))},t.prototype.addEventListeners=function(){var t=this,n=this.lf.graphModel,i=n.eventCenter,o=n.editConfigModel;i.on("graph:rendered",(function(e){var n=e.graphModel;t.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===e.TextMode.LABEL&&t.addLabel(s,u)})),i.on("node:resize",(function(t){var e,n,i=t.preData,o=t.data,r=t.model,a=null!==(e=i.properties)&&void 0!==e?e:{},s=a.width,l=a.height,u=a._label,c=void 0===u?[]:u,d=null!==(n=o.properties)&&void 0!==n?n:{},h=d.width,f=d.height;if(s&&l&&h&&f){var p={x:i.x,y:i.y,width:s,height:l},v={x:o.x,y:o.y,width:h,height:f},m=$u(c,(function(t){var e,n,i,o,r,a,s,l,u,c,d,h=t.x,f=t.y,m=(n=v,i={x:h,y:f},o=(e=p).x,r=e.y,a=e.width,s=e.height,l=n.x,u=n.y,c=n.width,d=n.height,{x:l+(i.x-o)/a*c,y:u+(i.y-r)/s*d});return g(g({},t),m)}));r.setProperty("_label",m)}})),i.on("node:rotate",(function(e){var n=e.model,i=n.x,o=n.y,r=n.rotate,a=n.properties._label,s={x:i,y:o},l=$u(void 0===a?[]:a,(function(e){if(!e.id)return e;var n={x:e.x,y:e.y};t.labelInitPositionMap.has(e.id)?n=t.labelInitPositionMap.get(e.id):t.labelInitPositionMap.set(e.id,n);var i=r*(180/Math.PI);i<0&&(i+=360);var o=i*(Math.PI/180),a=function(t,e,n){var i=e.x,o=e.y,r=t.x-i,a=t.y-o;return{x:r*Math.cos(n)-a*Math.sin(n)+i,y:r*Math.sin(n)+a*Math.cos(n)+o}}(n,s,o);return g(g(g({},e),a),{rotate:i})}));n.setProperty("_label",l)}))},t.prototype.rewriteInnerMethods=function(t){t.moveText=function(e,n){if(t.text){var i=t.text,o=i.x,r=i.y,a=i.value,s=i.draggable,l=i.editable;t.text={value:a,editable:l,draggable:s,x:o+e,y:r+n};var u=Is(t.getProperties());if(ee(u._label)){var c=$u(u._label,(function(t){return g(g({},t),{x:t.x+e,y:t.y+n})}));null==t||t.setProperty("_label",c)}}}},t.prototype.updateTextMode=function(t){var n=this.lf.graphModel.editConfigModel;t!==n.textMode&&(n.updateTextMode(t),t===e.TextMode.LABEL?(this.lf.tool.enableTool(Zv.toolName),this.lf.tool.disableTool("text-edit-tool")):t===e.TextMode.TEXT&&(this.lf.tool.enableTool("text-edit-tool"),this.lf.tool.disableTool(Zv.toolName)))},t.prototype.render=function(){},t.prototype.destroy=function(){},t.pluginName="Label",t}(),Qv=function(){function t(t){var e=t.lf,n=this;this.lf=e,this.paths=[],e.getPathes=function(){if(!n.startNodeType)throw new Error("需要预先指定开始节点类型");return n.getPathes()},e.setRawPaths=function(t){n.setPathes(t)},e.getRawPathes=function(){return n.paths},e.setStartNodeType=function(t){n.startNodeType=t}}return t.prototype.setPathes=function(t){this.paths=t.map((function(t){return{routeId:t.routeId,name:t.name,elements:t.elements,type:t.type,similarElement:null,weight:0}}))},t.prototype.getPathes=function(){var t=this,e=this.lf.getGraphRawData(),n=new Map,i=[];e.nodes.forEach((function(e){n.set(e.id,{id:e.id,data:e,nextNodes:[]}),e.type===t.startNodeType&&i.push(e.id)})),e.edges.forEach((function(t){var e=n.get(t.sourceNodeId);null==e||e.nextNodes.push(t.targetNodeId)}));var o=[];return i.forEach((function(e){var i=n.get(e);i&&(o=o.concat(t.findPathElements(i,n,[])))})),this.getNewPathes(o)},t.prototype.findPathElements=function(t,e,n){void 0===n&&(n=[]);var i=E([],w(n),!1);if(i.push(t.id),0===t.nextNodes.length)return[i];for(var o=[],r=0;r<t.nextNodes.length;r++){var a=e.get(t.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,e,E([],w(i),!1)),o=o.concat(s)}}return o},t.prototype.getNewPathes=function(t){var e=this,n=[],i=new Set;t.forEach((function(t){var o=e.getNewId("path"),r=e.getNewId("路径"),a=e.isLoopPath(t),s=t.join(",");i.has(s)||(i.add(s),n.push({routeId:o,name:r,elements:t,type:a,weight:0,similarElement:""}))}));var o=JSON.parse(JSON.stringify(this.paths));return n.forEach((function(t){for(var n=0;n<o.length;n++){var i=o[n],r=e.similar2Path(E([],w(t.elements),!1),E([],w(i.elements),!1));r>t.weight&&i.weight<=r&&(t.weight=r,t.similarElement=i,r===i.weight&&i.similarElement?(i.similarElement.similarElement=null,i.similarElement.weight=0,i.similarElement=null,i.weight=0):(i.similarElement=t,i.weight=r))}})),n.forEach((function(t){t.similarElement&&t.similarElement.similarElement===t&&(t.routeId=t.similarElement.routeId,t.name=t.similarElement.name),delete t.similarElement,delete t.weight})),this.setPathes(n),n},t.prototype.similar2Path=function(t,e){var n=0,i=t.length+e.length;t.sort(),e.sort();for(var o=t.shift(),r=e.shift();void 0!==o&&void 0!==r;)o===r?(n++,o=t.shift(),r=e.shift()):o<r?o=t.shift():o>r&&(r=e.shift());return n/i*200},t.prototype.getNewId=function(t){return"".concat(t,"_").concat(N())},t.prototype.isLoopPath=function(t){var e=t.length;return t.indexOf(t[e-1])!==e-1?1:0},t.pluginName="flowPath",t}(),tm=-1,em=0,nm=1,im=function(){function t(t){var e=t.lf,n=this;this.levelHeight=[],this.newNodeMap=new Map,this.lf=e,this.trunk=[],e.layout=function(t){var e=n.lf.getGraphRawData();n.lf.setStartNodeType(t);var i=n.lf.getPathes();return n.levelHeight=[],n.newNodeMap=new Map,n.layout(e,i)}}return t.prototype.layout=function(t,e){var n=this,i=[];e.forEach((function(t){var e=t.elements;e.length>i.length?i=e:e.length===i.length&&JSON.stringify(e)===JSON.stringify(n.trunk)&&(i=n.trunk)})),this.trunk=i;for(var o=this.formatData(t),r={nodes:[],edges:[]},a=i.length-1;a>=0;a--)this.setNodePosition(i[a],o,r,a,1);this.lf.graphModel.graphDataToModel(r)},t.prototype.setNodePosition=function(t,e,n,i,o){var r=this,a=e[t],s=a.text,l=a.type,u=a.next,c=a.properties,d=160*i+40,h=120*o,f={id:t,x:d,text:s,y:h,type:l,properties:c};return s&&"object"==typeof s&&(f.text=g(g({},s),{x:d+s.x,y:h+s.y})),this.newNodeMap.set(f.id,{x:f.x,y:f.y,type:l}),n.nodes.push(f),a.isFixed=!0,this.addLevelHeight(i,1),u&&u.length>0&&u.forEach((function(o){if(!e[o.nodeId].isFixed){var a=r.getLevelHeight(i+1);r.addLevelHeight(i,1),r.setNodePosition(o.nodeId,e,n,i+1,a+1)}n.edges.push(g({id:o.edgeId,type:o.edgeType,sourceNodeId:t,targetNodeId:o.nodeId,properties:o.properties,text:o.text},r.getEdgeDataPoints(t,o.nodeId)))})),f},t.prototype.getEdgeDataPoints=function(t,e){var n=this.newNodeMap.get(t),i=this.newNodeMap.get(e),o=this.getShape(t),r=o.width,a=o.height,s=this.getShape(e),l=s.width,u=s.height,c=this.getRelativePosition(n,i),d={x:n.x,y:n.y},h={x:i.x,y:i.y};switch(c){case em:d.x=n.x+r/2,h.x=i.x-l/2;break;case tm:d.y=n.y+a/2,h.x=i.x-l/2;break;case nm:d.x=n.x+r/2,h.y=i.y+u/2}return{startPoint:d,endPoint:h}},t.prototype.getRelativePosition=function(t,e){var n=t.y,i=e.y;return n<i?-1:n===i?0:1},t.prototype.getShape=function(t){var e,n,i=this.lf.getNodeModelById(t);return{height:null!==(e=null==i?void 0:i.height)&&void 0!==e?e:0,width:null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0}},t.prototype.formatData=function(t){var e=t.nodes.reduce((function(t,e){var n=e.type,i=e.properties,o=e.text,r=e.x,a=e.y;return o&&"object"==typeof o&&(o.x=o.x-r,o.y=o.y-a),t[e.id]={type:n,properties:i,text:o,prev:[],next:[]},t}),{});return t.edges.forEach((function(t){var n=t.sourceNodeId,i=t.targetNodeId,o=t.id,r=t.properties,a=t.text,s=a;"object"==typeof a&&(s=a.value),e[n].next.push({edgeId:o,nodeId:i,edgeType:t.type,properties:r,text:s}),e[i].prev.push({edgeId:o,nodeId:n,properties:r,text:s})})),e},t.prototype.addLevelHeight=function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!1);var i=this.levelHeight[t];i||(i={positiveHeight:0,negativeHeight:0},this.levelHeight[t]=i),n?i.negativeHeight-=e:i.positiveHeight+=e},t.prototype.getLevelHeight=function(t,e){void 0===e&&(e=!1);var n=this.levelHeight[t];return n?e?n.negativeHeight:n.positiveHeight:0},t.pluginName="AutoLayout",t}(),om=function(t,e){var n=[],i=[],o=function(t,i,r){r&&i.unshift.apply(i,E([],w(e.getEdgeModels({sourceNodeId:t.id,targetNodeId:null==r?void 0:r.id}).map((function(t){return t.id}))),!1)),i.includes(t.id)?n.push(i):(i.unshift(t.id),t.incoming.nodes.length?t.incoming.nodes.forEach((function(e){o(e,i.slice(),t)})):n.push(i))},r=function(t,n,o){o&&n.push.apply(n,E([],w(e.getEdgeModels({sourceNodeId:null==o?void 0:o.id,targetNodeId:t.id}).map((function(t){return t.id}))),!1)),n.includes(t.id)?i.push(n):(n.push(t.id),t.outgoing.nodes.length?t.outgoing.nodes.forEach((function(e){r(e,n.slice(),t)})):i.push(n))};return o(t,[]),r(t,[]),E([],w(new Set(E(E([],w(n.flat()),!1),w(i.flat()),!1))),!1)},rm=function(){function t(t){var e=t.lf;this.mode="path",this.manual=!1,this.tempStyles={},this.lf=e}return t.prototype.setMode=function(t){this.mode=t},t.prototype.setManual=function(t){this.manual=t},t.prototype.highlightSingle=function(t){var e=this.lf.getModelById(t);"node"===(null==e?void 0:e.BaseType)?e.updateStyles(this.tempStyles[t]):"edge"===(null==e?void 0:e.BaseType)&&(e.updateStyles(this.tempStyles[t]),e.sourceNode.updateStyles(this.tempStyles[e.sourceNode.id]),e.targetNode.updateStyles(this.tempStyles[e.targetNode.id]))},t.prototype.highlightPath=function(t){var e=this,n=function(t,e){var n=e.getModelById(t);return om("node"===(null==n?void 0:n.BaseType)?n:null==n?void 0:n.targetNode,e)}(t,this.lf);n.forEach((function(t){var n;null===(n=e.lf.getModelById(t))||void 0===n||n.updateStyles(e.tempStyles[t])}))},t.prototype.highlight=function(t,e){var n=this;(void 0===e&&(e=this.mode),this.manual)||(Object.keys(this.tempStyles).length&&this.restoreHighlight(),Object.values(this.lf.graphModel.modelsMap).forEach((function(t){var e="node"===t.BaseType?t.getNodeStyle():t.getEdgeStyle();n.tempStyles[t.id]=g({},e),t.setStyles({opacity:.1})})),{single:this.highlightSingle.bind(this),path:this.highlightPath.bind(this)}[e](t))},t.prototype.restoreHighlight=function(){var t=this;Object.keys(this.tempStyles).length&&(Object.values(this.lf.graphModel.modelsMap).forEach((function(e){var n,i=null!==(n=t.tempStyles[e.id])&&void 0!==n?n:{};e.updateStyles(g({},i))})),this.tempStyles={})},t.prototype.render=function(){var t=this;this.lf.on("node:mouseenter",(function(e){var n=e.data;return t.highlight(n.id)})),this.lf.on("edge:mouseenter",(function(e){var n=e.data;return t.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))},t.prototype.destroy=function(){},t.pluginName="highlight",t}();t.AutoLayout=im,t.BPMNAdapter=jg,t.BPMNBaseAdapter=Bg,t.BPMNElements=Zp,t.BoundaryEventFactory=xt,t.BpmnAdapter=ct,t.BpmnElement=q,t.BpmnXmlAdapter=dt,t.ContextMenu=dv,t.Control=ov,t.CurvedEdge=yv,t.CurvedEdgeModel=bv,t.DiamondResize=Op,t.DiamondResizeModel=Ap,t.DiamondResizeView=Rp,t.DndPanel=hv,t.EllipseResize=kp,t.EllipseResizeModel=Tp,t.EllipseResizeView=Mp,t.EndEventFactory=mt,t.EndEventModel=k,t.EndEventView=A,t.ExclusiveGatewayModel=L,t.ExclusiveGatewayView=I,t.FlowPath=Qv,t.GatewayNodeFactory=Pt,t.Group=qp,t.GroupNode=Wp,t.GroupNodeModel=Hp,t.Highlight=rm,t.HtmlResize=Lp,t.HtmlResizeModel=Pp,t.HtmlResizeView=Dp,t.InsertNodeInPolyline=iv,t.IntermediateCatchEventFactory=yt,t.IntermediateThrowEventFactory=wt,t.Label=Jv,t.Menu=uv,t.MiniMap=pv,t.NodeResize=Fp,t.NodeSelection=Ev,t.RectResize=jp,t.RectResizeModel=Ip,t.RectResizeView=Bp,t.SelectionSelect=fv,t.SequenceFlowModel=O,t.SequenceFlowView=P,t.ServiceTaskModel=j,t.ServiceTaskView=F,t.Snapshot=Kg,t.StartEventFactory=bt,t.StartEventModel=S,t.StartEventView=T,t.SubProcessFactory=Gp,t.TaskNodeFactory=Lt,t.UserTaskModel=W,t.UserTaskView=z,t.bpmnUtils=vt,t.convertNormalToXml=Ag,t.convertXmlToNormal=Rg,t.gateway={exclusive:0,inclusive:1,parallel:2},t.gatewayComposable=[[1,1,0],[0,0,1],[0,1,1]],t.getCurvedEdgePath=mv,t.handleAttributes=Y,t.icons=Ot,t.lfJson2Xml=J,t.lfXml2Json=et,t.multiInstanceIcon=Dt,t.sequenceFlowFactory=Kp,t.toLogicflowData=function(t){var e={nodes:[],edges:[]},n=t.flowElementList;return n&&n.length>0&&n.forEach((function(t){if(t.type===Xg.SEQUENCE_FLOW){var n=function(t){var e=t.incoming,n=t.outgoing,i=t.properties,o=t.key,r=t.type,a=i.text,s=i.name,l=i.startPoint,u=i.endPoint,c=i.pointsList,d={id:o,type:Yg[r],sourceNodeId:e[0],targetNodeId:n[0],text:a||s,properties:{}};l&&(d.startPoint=JSON.parse(l)),u&&(d.endPoint=JSON.parse(u)),c&&(d.pointsList=JSON.parse(c));var h=["startPoint","endPoint","pointsList","text"];return Object.keys(t.properties).forEach((function(e){-1===h.indexOf(e)&&(d.properties[e]=t.properties[e])})),d}(t);e.edges.push(n)}else{var i=function(t){var e=t.properties,n=t.key,i=t.type,o=t.bounds,r=e.x,a=e.y,s=e.text;if(void 0===r){var l=w(o,2),u=l[0],c=u.x,d=u.y,h=l[1];r=(c+h.x)/2,a=(d+h.y)/2}var f={id:n,type:Yg[i],x:r,y:a,text:s,properties:{}},p=["x","y","text"];return Object.keys(t.properties).forEach((function(e){-1===p.indexOf(e)&&(f.properties[e]=t.properties[e])})),f}(t);e.nodes.push(i)}})),e},t.toNormalJson=rt,t.toTurboData=function(t){var e=new Map,n={flowElementList:[]};return t.nodes.forEach((function(t){var i=function(t){var e=t.id,n=t.type,i=t.x,o=t.y,r=t.text,a=void 0===r?"":r,s=t.properties;return{incoming:[],outgoing:[],dockers:[],type:$g(n),properties:g(g({},s),{name:a&&a.value||"",x:i,y:o,text:a}),key:e}}(t);n.flowElementList.push(i),e.set(t.id,i)})),t.edges.forEach((function(t){var i=function(t){var e=t.id,n=t.type,i=t.sourceNodeId,o=t.targetNodeId,r=t.startPoint,a=t.endPoint,s=t.pointsList,l=t.text,u=void 0===l?"":l,c=t.properties;return{incoming:[i],outgoing:[o],type:$g(n),dockers:[],properties:g(g({},c),{name:u&&u.value||"",text:u,startPoint:JSON.stringify(r),endPoint:JSON.stringify(a),pointsList:JSON.stringify(s)}),key:e}}(t);e.get(t.sourceNodeId).outgoing.push(i.key),e.get(t.targetNodeId).incoming.push(i.key),n.flowElementList.push(i)})),n},t.toXmlJson=ot,t.useDefinition=$p}));
|
|
12
28
|
//# sourceMappingURL=index.min.js.map
|